From 6a2a2b65a097b03f970540896672d8be60502866 Mon Sep 17 00:00:00 2001 From: dzeusking-dev Date: Sun, 30 Aug 2026 20:53:57 +0200 Subject: [PATCH 1/7] release: PC FileBridge v0.2.1 --- .codex-plugin/plugin.json | 2 +- .dockerignore | 9 + .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/dependabot.yml | 4 + .github/workflows/ci.yml | 109 +- .github/workflows/codeql.yml | 4 +- .github/workflows/release.yml | 9 +- .gitignore | 3 + ARCHITECTURE.md | 9 +- CHANGELOG.md | 43 + README.md | 42 +- SECURITY.md | 9 +- THREAT_MODEL.md | 6 + config/roots.example.json | 2 +- config/roots.infrastructure.example.json | 26 + config/roots.laptop.example.json | 26 + config/roots.pc.example.json | 26 + config/roots.server.example.json | 19 + config/tunnel-roles.json | 54 + deploy/docker/Dockerfile | 98 + deploy/docker/THIRD_PARTY_NOTICES.md | 13 + deploy/docker/compose.example.yml | 55 + deploy/docker/compose.host-ca.example.yml | 14 + deploy/docker/entrypoint.sh | 58 + deploy/docker/healthcheck.mjs | 43 + deploy/docker/validate-role-config.mjs | 42 + docs/IMAGE_SECURITY.md | 20 + docs/PUBLIC_LAUNCH_READINESS.md | 1 + docs/RELEASE_PROCESS.md | 2 +- docs/RELEASE_VERIFICATION.md | 3 +- docs/TUNNEL_ROLES.md | 117 + docs/VPS_DEPLOYMENT.md | 69 + mcp/server.mjs | 9311 ++++++++++++----- package-lock.json | 476 +- package.json | 71 +- scripts/Approve-PCFileBridgeVolume.ps1 | 51 + .../Connect-PCFileBridgeRoleTunnel-Task.ps1 | 12 + scripts/Connect-PCFileBridgeRoleTunnel.ps1 | 124 + scripts/Get-PCFileBridgeVolumeCandidates.ps1 | 14 + scripts/Revoke-PCFileBridgeVolumeApproval.ps1 | 35 + scripts/Set-PCFileBridgeGate.ps1 | 37 + scripts/Start-PCFileBridgeVolumeMonitor.ps1 | 241 + scripts/Test-PCFileBridgeRoleConfig.ps1 | 99 + scripts/Update-PCFileBridgeVolumeConfig.ps1 | 275 + scripts/container-smoke.mjs | 133 + scripts/crash-window.windows.test.ps1 | 112 + scripts/docker-role-config.test.mjs | 73 + scripts/healthcheck-smoke.mjs | 78 + scripts/image-vulnerability-gate.mjs | 64 + scripts/image-vulnerability-gate.test.mjs | 79 + scripts/license-check.mjs | 22 + scripts/mcp-config-smoke.mjs | 96 + scripts/mcp-smoke.mjs | 7 +- scripts/package-contents-check.mjs | 69 + scripts/run-image-vulnerability-gate.sh | 45 + scripts/runtime-rollback.windows.test.ps1 | 113 + scripts/secret-scan.mjs | 4 +- scripts/tunnel-role-contract.mjs | 128 + scripts/version-consistency.mjs | 39 + scripts/volume-discovery.windows.test.ps1 | 143 + src/filePolicy.ts | 375 +- src/server.ts | 2 +- test/filePolicy.test.ts | 44 +- .../windows-8dot3.integration.windows.test.ts | 165 + 64 files changed, 10738 insertions(+), 2738 deletions(-) create mode 100644 .dockerignore create mode 100644 config/roots.infrastructure.example.json create mode 100644 config/roots.laptop.example.json create mode 100644 config/roots.pc.example.json create mode 100644 config/roots.server.example.json create mode 100644 config/tunnel-roles.json create mode 100644 deploy/docker/Dockerfile create mode 100644 deploy/docker/THIRD_PARTY_NOTICES.md create mode 100644 deploy/docker/compose.example.yml create mode 100644 deploy/docker/compose.host-ca.example.yml create mode 100644 deploy/docker/entrypoint.sh create mode 100644 deploy/docker/healthcheck.mjs create mode 100644 deploy/docker/validate-role-config.mjs create mode 100644 docs/IMAGE_SECURITY.md create mode 100644 docs/TUNNEL_ROLES.md create mode 100644 docs/VPS_DEPLOYMENT.md create mode 100644 scripts/Approve-PCFileBridgeVolume.ps1 create mode 100644 scripts/Connect-PCFileBridgeRoleTunnel-Task.ps1 create mode 100644 scripts/Connect-PCFileBridgeRoleTunnel.ps1 create mode 100644 scripts/Get-PCFileBridgeVolumeCandidates.ps1 create mode 100644 scripts/Revoke-PCFileBridgeVolumeApproval.ps1 create mode 100644 scripts/Set-PCFileBridgeGate.ps1 create mode 100644 scripts/Start-PCFileBridgeVolumeMonitor.ps1 create mode 100644 scripts/Test-PCFileBridgeRoleConfig.ps1 create mode 100644 scripts/Update-PCFileBridgeVolumeConfig.ps1 create mode 100644 scripts/container-smoke.mjs create mode 100644 scripts/crash-window.windows.test.ps1 create mode 100644 scripts/docker-role-config.test.mjs create mode 100644 scripts/healthcheck-smoke.mjs create mode 100644 scripts/image-vulnerability-gate.mjs create mode 100644 scripts/image-vulnerability-gate.test.mjs create mode 100644 scripts/license-check.mjs create mode 100644 scripts/mcp-config-smoke.mjs create mode 100644 scripts/package-contents-check.mjs create mode 100755 scripts/run-image-vulnerability-gate.sh create mode 100644 scripts/runtime-rollback.windows.test.ps1 create mode 100644 scripts/tunnel-role-contract.mjs create mode 100644 scripts/version-consistency.mjs create mode 100644 scripts/volume-discovery.windows.test.ps1 create mode 100644 test/windows-8dot3.integration.windows.test.ts diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 6883f45..d4c1a43 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "pc-filebridge", - "version": "0.1.1", + "version": "0.2.1", "description": "Read files and create new files on explicitly allowed PC folders without overwrite or delete capabilities.", "author": { "name": "Gexiro Global Enterprises Ltd." diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..526379a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.git +.github +node_modules +release +test +config/roots.local.json +*.tgz +*.zip +*.bundle diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index a75d201..02952d9 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -10,7 +10,7 @@ body: id: version attributes: label: Release version - placeholder: v0.1.1 + placeholder: v0.2.0 validations: required: true - type: input diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e53634d..723abe3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,6 +7,8 @@ updates: day: monday time: "06:00" timezone: Europe/Berlin + cooldown: + default-days: 7 open-pull-requests-limit: 5 commit-message: prefix: deps @@ -17,6 +19,8 @@ updates: day: monday time: "06:30" timezone: Europe/Berlin + cooldown: + default-days: 7 open-pull-requests-limit: 5 commit-message: prefix: ci diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 170fa32..b6f4f85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,35 +15,90 @@ concurrency: cancel-in-progress: true jobs: - verify-linux: - name: Build, test, and security checks - runs-on: ubuntu-latest - timeout-minutes: 15 + verify: + name: ${{ matrix.label }} + runs-on: ${{ matrix.os }} + timeout-minutes: 25 + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + node: "22" + label: Ubuntu Node 22 + - os: ubuntu-latest + node: "24" + label: Ubuntu Node 24 + - os: windows-latest + node: "22" + label: Windows Node 22 + - os: windows-latest + node: "24" + label: Windows Node 24 steps: - name: Check out repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: - node-version: "24" + node-version: ${{ matrix.node }} cache: npm - name: Install locked dependencies run: npm ci --ignore-scripts - - name: Verify - run: npm run check - - name: Validate package contents - run: npm pack --dry-run --ignore-scripts + - name: Verify cross-platform policy and MCP invariants + run: npm run verify + - name: Verify a real Windows 8.3 fixture without skipping + if: runner.os == 'Windows' + run: npm run test:windows-8dot3 + - name: Verify fixed-volume discovery fails closed on Windows + if: runner.os == 'Windows' + run: npm run test:volume-discovery:windows + - name: Verify discovery and ACL helpers under PowerShell 7 + if: runner.os == 'Windows' + run: npm run test:volume-discovery:pwsh + - name: Verify failed topology changes roll back to the last-known-good runtime + if: runner.os == 'Windows' + run: npm run test:runtime-rollback:windows + - name: Verify crash-window recovery and monitor singleton + if: runner.os == 'Windows' + run: npm run test:crash-window:windows - name: Generate and validate CycloneDX SBOM - shell: bash - run: | - npm sbom --sbom-format cyclonedx > pc-filebridge-sbom.cdx.json + shell: pwsh + run: >- + npm sbom --sbom-format cyclonedx | + Out-File -LiteralPath pc-filebridge-sbom.cdx.json -Encoding utf8; node -e "JSON.parse(require('node:fs').readFileSync('pc-filebridge-sbom.cdx.json','utf8'))" - name: Audit production dependencies run: npm audit --omit=dev --audit-level=high - verify-windows: - name: Windows security checks - runs-on: windows-latest + container-runtime: + name: Hardened VPS container + needs: verify + runs-on: ubuntu-latest + timeout-minutes: 25 + steps: + - name: Check out repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Set up Node.js + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: "24" + cache: npm + - name: Install locked dependencies + run: npm ci --ignore-scripts + - name: Build digest-pinned runtime image + run: docker build --pull -f deploy/docker/Dockerfile -t pc-filebridge:0.2.1 . + - name: Verify container policy, tunnel version, and fail-closed startup + run: npm run check:container + - name: Scan complete runtime image + run: sh scripts/run-image-vulnerability-gate.sh + - name: Validate Compose model + run: docker compose -f deploy/docker/compose.example.yml -f deploy/docker/compose.host-ca.example.yml config --quiet + + receiver-simulation: + name: Clean-room receiver simulation + needs: verify + runs-on: ubuntu-latest timeout-minutes: 20 steps: - name: Check out repository @@ -55,5 +110,25 @@ jobs: cache: npm - name: Install locked dependencies run: npm ci --ignore-scripts - - name: Verify Windows path and MCP invariants - run: npm run check + - name: Build receiver artifacts with basename-only checksums + shell: bash + run: | + set -euo pipefail + npm run verify + version="$(node --input-type=commonjs -p "require('./package.json').version")" + tag="v${version}" + rm -rf release-ci + mkdir release-ci + runtime_name="pc-filebridge-${tag}-runtime-npm.tgz" + source_name="pc-filebridge-${tag}-source.tar.gz" + sbom_name="pc-filebridge-${tag}-sbom.cdx.json" + package_file="$(npm pack --ignore-scripts --silent)" + mv -- "${package_file}" "release-ci/${runtime_name}" + git archive --format=tar.gz --prefix="pc-filebridge-${tag}-source/" --output="release-ci/${source_name}" HEAD + npm sbom --sbom-format cyclonedx > "release-ci/${sbom_name}" + ( + cd release-ci + sha256sum "${runtime_name}" "${source_name}" "${sbom_name}" > SHA256SUMS + sha256sum -c SHA256SUMS + ) + node scripts/verify-release-artifact.mjs --release-dir release-ci --tag "${tag}" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 16e1adf..9471f21 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -21,8 +21,8 @@ jobs: - name: Check out repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Initialize CodeQL - uses: github/codeql-action/init@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4 + uses: github/codeql-action/init@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4 with: languages: javascript-typescript - name: Perform CodeQL analysis - uses: github/codeql-action/analyze@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28 # v4 + uses: github/codeql-action/analyze@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1710334..e3bae24 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,6 +58,13 @@ jobs: - name: Verify release source run: npm run check + - name: Verify hardened VPS container + run: | + docker build --pull -f deploy/docker/Dockerfile -t pc-filebridge:0.2.1 . + npm run check:container + docker compose -f deploy/docker/compose.example.yml -f deploy/docker/compose.host-ca.example.yml config --quiet + sh scripts/run-image-vulnerability-gate.sh + - name: Build release artifacts and checksums shell: bash run: | @@ -127,7 +134,7 @@ jobs: git merge-base --is-ancestor "${GITHUB_SHA}" refs/remotes/origin/main - name: Download verified release bundle - uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: pc-filebridge-release-${{ github.ref_name }} path: release diff --git a/.gitignore b/.gitignore index 544467a..495bb06 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ node_modules/ +.pc-filebridge-test-*/ +.pc-filebridge-8dot3-*/ +.pc-filebridge-mcp-smoke-*/ coverage/ *.log private/ diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index a4dfef1..71fe341 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -1,6 +1,6 @@ # Architecture -PC FileBridge is a local stdio MCP server. The MCP client launches `mcp/server.mjs`; the server loads one operator-controlled JSON configuration and exposes seven bounded tools. +PC FileBridge is a stdio MCP server. A local MCP client or the authenticated Secure MCP Tunnel runtime launches `mcp/server.mjs`; the server loads one operator-controlled JSON configuration and exposes seven bounded tools. ## Components @@ -8,7 +8,9 @@ PC FileBridge is a local stdio MCP server. The MCP client launches `mcp/server.m - `src/server.ts` defines the fixed MCP tool catalog and translates policy failures into structured MCP errors. - `src/filePolicy.ts` owns root authorization, path validation, link containment, read bounds, redaction, and exclusive-create writes. - `config/roots.local.json` is operator data, is ignored by Git, and fails closed when absent. -- Secure MCP Tunnel helper scripts connect a dedicated runtime on the PC to ChatGPT. Secrets remain outside the repository under the current user's local application-data directory. +- Secure MCP Tunnel helper scripts bind separate `pc-local` and `laptop-local` runtimes to exact tunnel names, root IDs, and drive paths. Their operator gates fail closed and remain locked by default. Secrets remain outside the repository under the current user's local application-data directory. +- The optional Linux container owns only the `infrastructure` role, validates its exact tunnel name and the neutral example paths `/data/primary`, `/data/secondary`, and optional `/data/agent`, and packages the same stdio server with a digest-pinned tunnel client. Server data and runtime secrets remain in separate external volumes. +- One tunnel identifier has exactly one active poller. PC, laptop, and infrastructure identifiers are never shared. ## Data flow @@ -17,7 +19,7 @@ PC FileBridge is a local stdio MCP server. The MCP client launches `mcp/server.m 3. The policy resolves and canonicalizes the path, rejects sensitive components and link escapes, enforces the operation-specific bounds, and performs the filesystem operation. 4. The server returns bounded metadata or redacted UTF-8 text. Absolute host paths are not returned. -The server initiates no network connection and executes no shell command. Remote access is a separate authenticated transport boundary; it does not change the filesystem policy. +The MCP server initiates no network connection and executes no shell command. In a remote deployment, the separate tunnel-client process makes the outbound authenticated connection; it does not change the filesystem policy. ## Security invariants @@ -26,5 +28,6 @@ The server initiates no network connection and executes no shell command. Remote - The tool catalog has no delete, overwrite, append, move, rename, patch, or link operation. - Link and reparse-point traversal is rejected before access; read handles are checked again after opening. - Full-drive roots require both configuration and an exact process-level opt-in. +- Role-bound launchers reject a mismatched tunnel name, root ID, root path, local gate, or duplicate-poller topology before serving files. Residual risks and operator controls are documented in [THREAT_MODEL.md](THREAT_MODEL.md) and [SECURITY.md](SECURITY.md). diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d123bb..b19787c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,48 @@ # Changelog +## 0.2.1 - 2026-08-30 + +- Derive a stable, opaque volume id from host, disk, partition, volume, and serial identity; drive-letter, label, health, filesystem, and bus changes do not change that id. +- Restrict automatic discovery to healthy online NTFS volumes on internal NVMe, SATA, SAS, RAID, Storage Spaces, or SCM buses. +- Require an ACL-protected, explicit operator approval for File Backed Virtual, USB, SD, MMC, 1394, and removable volumes; network, optical, unknown, ReFS, unhealthy, and incomplete or colliding identities fail closed. +- Expose additive non-secret topology metadata through `list_roots` while preserving the exact seven-tool MCP contract. +- Add candidate-only discovery plus approval and revocation helpers. +- Require three matching topology snapshots, a real local MCP probe, transactional last-known-good promotion, rejected-topology suppression, crash-window recovery, and a role-scoped singleton monitor. +- Add Windows regression coverage for stable identity, approval ACLs, identity collisions, runtime rollback, all six crash windows, and singleton enforcement. +- Publish the runtime version through OCI metadata, the container environment, and successful healthcheck output. +- Fix approval-registry ACL validation under PowerShell 7 and execute the discovery regression suite under both Windows PowerShell and PowerShell 7 in CI. + +## 0.2.0 - 2026-08-30 + +- Separate PC-local, laptop-local, and infrastructure access into distinct tunnel roles, runtime aliases, and root-id namespaces. +- Add fail-closed tunnel metadata verification so a role refuses a tunnel created for another backend. +- Add an explicit `armed/locked` operator gate for local ChatGPT connectors while keeping local Codex stdio independent. +- Add PC C/D, laptop C/optional D, and infrastructure root configuration examples without mirroring complete local drives to the VPS. +- Pin the container deployment to the infrastructure tunnel role and require its exact operator-visible tunnel name. +- Add a machine-checked role contract, exact root-path enforcement, container configuration negative tests, split-brain recovery procedure, and truthful device availability documentation. +- Add release-wide version consistency checks, exclude private VPS records from the public runtime package, and refresh production dependencies. +- Add fail-closed Windows volume discovery with bus/filesystem/health/identity policy, automatic role-bound root generation, and a singleton monitor that transactionally reapplies only the affected runtime and rolls back failed topology changes to a private last-known-good configuration. + +## 0.1.3 - 2026-08-28 + +- Update the hardened VPS image to digest-pinned Node.js 24.20.0 LTS, remove the unused npm CLI from the runtime layer, and refresh current MCP, type, build, and test dependencies. +- Replace the local-only readiness probe with a tunnel-aware healthcheck that requires a recent successful command poll. +- Default tunnel logs to warning level and add bounded local log rotation in the Compose deployment. +- Add an optional host-managed CA overlay for Linux environments with TLS inspection without disabling certificate verification. +- Rebuild the exact OpenAI tunnel-client v0.0.13 source revision with fixed OpenTelemetry Go and `x/net` dependencies, after running the upstream Go test suite. +- Add a digest-pinned Syft, Grype, and `govulncheck` image gate with no HIGH/CRITICAL vulnerability allowlist. +- Refresh pinned GitHub Actions used by CodeQL and release artifact download. + +## 0.1.2 - 2026-08-27 + +- Resolve every existing path component to its filesystem-stored name by exact BigInt file identity before authorization. +- Block Windows 8.3 and other alternate spellings while continuing to allow case-only Windows spelling differences. +- Re-apply sensitive-name policy to stored directory entries and fail closed for missing, zero, unstable, or ambiguous identity. +- Block multiply linked regular files and add parent/file identity checks around create-only operations. +- Add a non-skippable real Windows 8.3 fixture covering stat, list, read, search, and create-parent paths. +- Require Ubuntu and Windows CI on Node.js 22 and 24, production-license review, package-content review, SBOM validation, and clean-room receiver simulation. +- Add an always-on hardened VPS deployment with digest-pinned Node and OpenAI tunnel images, external data/secret volumes, non-root execution, a read-only root filesystem, no published ports, and container create-only/fail-closed CI. + ## 0.1.1 - 2026-08-26 - Block PuTTY `.ppk`, Java keystores, additional private-key formats, and SSH `id_*` private-key variants. diff --git a/README.md b/README.md index 0d6b4ad..88b662b 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,15 @@ The create-only guarantee is enforced by the server. New files use operating-sys - Every operation uses a configured `root_id` and a relative path. - Absolute paths, UNC paths, traversal, alternate data streams, reserved Windows names, symlinks, junctions, and reparse-point escapes are blocked. +- Each existing component is matched to the filesystem-stored directory entry by exact file identity. Windows 8.3 and other alternate spellings are rejected; case-only spelling differences remain allowed on Windows. +- Missing, zero, unstable, or ambiguous file identity fails closed. Regular files with multiple hard links are rejected. - Sensitive folders and credential filenames are hidden and rejected, including `.ssh`, `.aws`, `.azure`, `.codex`, `.git`, `AppData`, `.env*`, private-key formats, PuTTY `.ppk`, Java keystores, and SSH `id_*` private-key names. - Text reads are UTF-8 only, byte-bounded, and redact common credential patterns. - Directory listings and filename searches are bounded. - The server has no network client and does not execute shell commands. - A complete drive root requires an exact, explicit risk opt-in. -These controls reduce risk but cannot determine whether every ordinary document is private. Configure the narrowest useful roots and treat returned file content as untrusted data. +These controls reduce risk but cannot determine whether every ordinary document is private. Configure the narrowest useful roots and treat returned file content as untrusted data. Portable Node.js cannot provide race-free Windows `openat2` semantics, so pre/post-operation identity checks reduce but do not eliminate attacks by a more-privileged process that can mutate the filesystem concurrently. ## MCP tools @@ -37,10 +39,10 @@ There are no delete, overwrite, append, patch, rename, move, remove, or unlink t ## Requirements - Node.js 22 or newer -- Windows for the supplied Secure MCP Tunnel and Task Scheduler helpers +- Windows for the supplied Task Scheduler helpers, or Docker on Linux for the always-on VPS deployment - An MCP-compatible client -The core server and policy tests also run on Linux and macOS. +The core server and policy tests also run on Linux and macOS. The hardened Docker deployment pins Node.js and the official Secure MCP Tunnel runtime by immutable OCI digest. ## Install and configure @@ -78,7 +80,27 @@ For ChatGPT, create a dedicated Secure MCP Tunnel and a dedicated runtime API ke .\scripts\Get-PCFileBridgeTunnelStatus.ps1 ``` -The tunnel runtime must run on the computer that owns the configured folders. A remote VPS does not gain access to a PC disk unless a separately secured private channel reaches a runtime on that PC. +The tunnel runtime must run on the computer that owns the configured folders. A VPS deployment can remain available while personal devices are offline, but it exposes files stored in its persistent server volume; it does not make a powered-off PC disk remotely readable. See [VPS deployment](docs/VPS_DEPLOYMENT.md). + +Version 0.2.1 separates the main PC, laptop, and infrastructure into three role-bound tunnels. Their tunnel identifiers, runtime aliases, and root ids must never be reused across roles. The Windows and Docker launchers verify the operator-visible tunnel name before starting, and local ChatGPT connectors require an explicit `armed` operator gate. This prevents a PC and VPS poller from silently serving different backends through one connector. + +ChatGPT cannot securely infer which physical device opened a conversation. Operators must select the clearly named PC, laptop, or infrastructure connector. Local Codex can instead use its device-local stdio configuration. + +Windows local roles automatically discover healthy, online NTFS volumes on internal NVMe, SATA, SAS, RAID, Storage Spaces, or SCM buses. Each volume gets a stable opaque id derived from host, disk, partition, volume, and serial identity. A drive-letter change keeps the same volume id while changing the role-bound root id, for example `pc-e` to `pc-f`. Labels and raw hardware identifiers are never exposed. + +File Backed Virtual, USB, SD, MMC, 1394, and removable volumes are blocked until the operator approves the exact opaque volume id in the ACL-protected private registry. Network, optical, unknown, ReFS, unhealthy, offline, incomplete-identity, and identity-collision candidates always fail closed. + +```powershell +.\scripts\Get-PCFileBridgeVolumeCandidates.ps1 -Role pc-local +.\scripts\Approve-PCFileBridgeVolume.ps1 -Role pc-local -VolumeId 'vol-0123456789abcdef' -BusType 'File Backed Virtual' -Reason 'Authorized lab VHDX' +.\scripts\Revoke-PCFileBridgeVolumeApproval.ps1 -Role pc-local -VolumeId 'vol-0123456789abcdef' +``` + +The monitor requires three identical topology snapshots, writes a separate candidate, runs a real local seven-tool MCP probe, and only then promotes the candidate and last-known-good state. Failed and crash-interrupted candidates roll back or recover transactionally and are suppressed until topology changes. The connector is not reinstalled: callers discover the live set through `list_roots`. + +See [tunnel roles and device isolation](docs/TUNNEL_ROLES.md) for the exact role contract, gate workflow, split-brain recovery, and availability limits. + +For an always-on private deployment, use `deploy/docker/compose.example.yml`. It runs on digest-pinned Node.js 24 LTS as a non-root user with a read-only root filesystem, no published ports or Linux capabilities, bounded resources, external data and secret volumes, warning-only tunnel logs with rotation, and a tunnel-aware healthcheck. The runtime key and tunnel ID are mounted from files and never embedded in the image or Compose configuration. The helper defaults to the configured narrow roots. Full-drive mode is never enabled by default. @@ -92,6 +114,14 @@ After a successful manual connection: The installer creates a new per-user scheduled task and refuses to replace an existing task. +For role-bound automatic volume discovery, configure the task or a hidden per-user Startup shortcut to run: + +```powershell +powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File .\scripts\Connect-PCFileBridgeRoleTunnel-Task.ps1 -Role pc-local +``` + +The task script runs a singleton monitor and does not contain a tunnel identifier or API key in its arguments. + ## Full-drive mode Exposing an entire drive materially increases disclosure risk. The server refuses a filesystem root unless both the full-drive configuration and this exact process variable are supplied: @@ -112,7 +142,7 @@ npm run check npm pack --dry-run --ignore-scripts ``` -`npm run check` performs a tracked-file secret scan, type checking, policy tests, a production build, and a real MCP stdio smoke test that requires exactly seven tools and zero forbidden mutation tools. Pull requests run the same security gates on Linux and Windows; the Windows job must create and reject a real junction and cannot silently skip that check. +`npm run check` performs a tracked-file secret scan, type checking, policy tests, a production build, license and package-content checks, and a real MCP stdio smoke test that requires exactly seven tools and zero forbidden mutation tools. Pull requests run on Ubuntu and Windows with Node.js 22 and 24. Windows jobs must create and reject a real 8.3 alternate-name fixture and cannot silently skip that check. ## Release verification @@ -134,7 +164,7 @@ Get-Content .\SHA256SUMS | ForEach-Object { } ``` -The GitHub release also carries build-provenance attestations. See [Release verification](docs/RELEASE_VERIFICATION.md) and [Release process](docs/RELEASE_PROCESS.md). +The GitHub release also carries build-provenance attestations. See [Release verification](docs/RELEASE_VERIFICATION.md), [container image security](docs/IMAGE_SECURITY.md), and [Release process](docs/RELEASE_PROCESS.md). ## Privacy and security diff --git a/SECURITY.md b/SECURITY.md index 902f22a..af25a7b 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -13,29 +13,32 @@ Use [GitHub private vulnerability reporting](https://github.com/gexiro-global/pc - Every operation is scoped to a configured root ID and relative path. - Absolute, UNC, traversal, alternate-data-stream, reserved-name, symlink, junction, and reparse-point paths are rejected. - Canonicalized targets must remain inside their root. +- Every existing component is mapped to its filesystem-stored name by exact BigInt file identity; alternate spellings are rejected and stored names are checked again against the sensitive-name policy. +- Zero, unavailable, changed, or multiply matched identity fails closed. Multiply linked regular files are rejected. - File creation uses `open(..., "wx")`; directory creation is non-recursive and refuses existing targets. - The tool catalog contains no overwrite, append, patch, rename, move, link, delete, remove, or unlink capability. - Reads, listings, searches, and writes have server-side bounds. - Reads accept UTF-8 only and redact common credential patterns. - Sensitive system and credential names, including `.ppk`, Java keystores, and SSH private-key variants, are hidden from listings/search and blocked directly. - A complete filesystem root requires the exact `FILEBRIDGE_ALLOW_DRIVE_ROOT=I_ACCEPT_FULL_DRIVE_ACCESS_RISK` opt-in. +- PC, laptop, and infrastructure runtimes use distinct tunnel identities. Launchers validate the exact tunnel name, role-specific root IDs and paths, and local operator gate before connection; one tunnel identifier must have only one active poller. - The server executes no shell commands and initiates no network connections. ## Trust boundary -Files and filenames are untrusted input and may contain prompt injection. MCP clients must treat returned content as data, never as instructions. The stdio process relies on the operating-system identity that launches it. A remote connection must use an authenticated private transport such as OpenAI Secure MCP Tunnel. +Files and filenames are untrusted input and may contain prompt injection. MCP clients must treat returned content as data, never as instructions. The stdio process relies on the operating-system identity that launches it. A remote connection must use an authenticated private transport such as OpenAI Secure MCP Tunnel. The supplied container publishes no inbound port and reads its dedicated runtime credential from a read-only file mount. ## Residual risk - An allowed folder may still contain ordinary private documents not recognized by filename filters. - Pattern redaction cannot detect every custom secret format. -- A malicious same-user local process may attempt path races. Pre/post-open checks reduce risk, but portable Node.js does not provide Windows `openat2` semantics. +- A malicious same-user or more-privileged local process may attempt path races. Root, parent, component, and open-handle identity checks reduce risk, but portable Node.js does not provide Windows `openat2` semantics and cannot eliminate every race. - Full-drive mode expands exposure even while deny rules remain active. - A failed physical write may leave a partial new file. The server intentionally does not delete it. - Data returned to an MCP client follows that client's model-provider and workspace policies. ## Operator responsibilities -Use narrow roots, run the process as a non-administrator, protect tunnel credentials, keep configuration and credential files out of Git, review client tool permissions, patch dependencies, and revoke the tunnel key after suspected exposure. +Use narrow roots, run the process as a non-administrator, protect tunnel credentials, keep configuration and credential files out of Git and image layers, review client tool permissions, patch dependencies, and revoke the tunnel key after suspected exposure. On VPS deployments, restrict the secret volume, keep health/admin endpoints unexposed, and preserve encrypted recovery material separately from the host. Security controls reduce known risk; they are not a guarantee that every deployment is safe. diff --git a/THREAT_MODEL.md b/THREAT_MODEL.md index cf0c6bb..9692e86 100644 --- a/THREAT_MODEL.md +++ b/THREAT_MODEL.md @@ -15,11 +15,17 @@ | Critical | overwrite or deletion of existing data | no mutation tools; exclusive file create; existing directory refusal; invariant tests | host or dependency compromise | | Critical | credential disclosure | blocked names/extensions/segments; bounded UTF-8 reads; secret redaction; credentials outside Git | unknown secret formats in ordinary files | | High | path escape | relative paths; canonical containment; link/junction checks; blocked ADS and reserved names | same-user path races | +| High | Windows alternate-name policy bypass | stored-name lookup by exact BigInt file identity; alternate spelling rejection; stored-name denylist; real 8.3 integration test | filesystem races or a more-privileged local process | +| High | hard-link aliasing | ambiguous identity rejection and multiply linked regular-file refusal | privileged filesystem mutation after validation | | High | unauthorized remote access | local stdio; authenticated private tunnel; dedicated revocable runtime key | compromised client account or host | +| High | split-brain or tunnel-role confusion | distinct PC, laptop, and infrastructure tunnel identities; exact metadata-name, root-ID, and root-path validation; one poller per tunnel; local operator gates locked by default | control-plane or host compromise | +| High | secret leakage from deployment artifacts | external read-only secret mount; no values in Git, image layers, Compose, arguments, or logs | root compromise or unencrypted host storage | | High | prompt injection from files | content labeled and documented as untrusted; no server-side instruction following | client model may misinterpret data | | High | excessive disclosure | explicit roots; full-drive fail-closed opt-in; size/result/traversal bounds | operator configures roots too broadly | +| High | unsafe automatic volume exposure | fixed-disk inventory plus allowlisted bus and NTFS/ReFS policy; healthy-state and stable disk/partition/volume identity required; exact role-prefix/drive-letter binding; required system volume; private generated config; USB, removable, optical, network, unknown, and unhealthy volumes excluded | an allowed fixed disk may still contain sensitive ordinary documents | | Medium | resource exhaustion | byte, entry, result, and traversal limits | slow or hostile filesystems | | Medium | sensitive logs | categorical error codes only; no content or absolute paths on stderr | operator-added logging | | Medium | partial create after hardware failure | exclusive create and sync; explicit `WRITE_INCOMPLETE`; no automatic cleanup | manual cleanup may be required | +| Medium | VPS availability or storage loss | restart policy; readiness probe; persistent data volume; verified recovery artifacts | provider or host failure | All MCP arguments, filenames, file contents, configuration values, filesystem metadata, and client responses are untrusted input. PC FileBridge is not a sandbox for arbitrary code and must not be run with broader operating-system privileges than required. diff --git a/config/roots.example.json b/config/roots.example.json index 0752fb0..081fd5b 100644 --- a/config/roots.example.json +++ b/config/roots.example.json @@ -3,7 +3,7 @@ "roots": [ { "id": "documents", - "label": "Documents", + "label": "Documents (recommended narrow root)", "path": "C:\\Users\\YOUR_WINDOWS_USERNAME\\Documents", "read": true, "create": true diff --git a/config/roots.infrastructure.example.json b/config/roots.infrastructure.example.json new file mode 100644 index 0000000..0edaccc --- /dev/null +++ b/config/roots.infrastructure.example.json @@ -0,0 +1,26 @@ +{ + "version": 1, + "roots": [ + { + "id": "primary-data", + "label": "Primary infrastructure data", + "path": "/data/primary", + "read": true, + "create": true + }, + { + "id": "secondary-data", + "label": "Secondary infrastructure data", + "path": "/data/secondary", + "read": true, + "create": true + } + ], + "limits": { + "maxReadBytes": 262144, + "maxWriteBytes": 1048576, + "maxDirectoryEntries": 250, + "maxSearchResults": 100, + "maxSearchEntries": 5000 + } +} diff --git a/config/roots.laptop.example.json b/config/roots.laptop.example.json new file mode 100644 index 0000000..fe41356 --- /dev/null +++ b/config/roots.laptop.example.json @@ -0,0 +1,26 @@ +{ + "version": 1, + "roots": [ + { + "id": "laptop-c", + "label": "Laptop C drive", + "path": "C:\\", + "read": true, + "create": true + }, + { + "id": "laptop-d", + "label": "Laptop D drive (remove this root when absent)", + "path": "D:\\", + "read": true, + "create": true + } + ], + "limits": { + "maxReadBytes": 262144, + "maxWriteBytes": 1048576, + "maxDirectoryEntries": 250, + "maxSearchResults": 100, + "maxSearchEntries": 5000 + } +} diff --git a/config/roots.pc.example.json b/config/roots.pc.example.json new file mode 100644 index 0000000..2fe79ce --- /dev/null +++ b/config/roots.pc.example.json @@ -0,0 +1,26 @@ +{ + "version": 1, + "roots": [ + { + "id": "pc-c", + "label": "Main PC C drive", + "path": "C:\\", + "read": true, + "create": true + }, + { + "id": "pc-d", + "label": "Main PC D drive", + "path": "D:\\", + "read": true, + "create": true + } + ], + "limits": { + "maxReadBytes": 262144, + "maxWriteBytes": 1048576, + "maxDirectoryEntries": 250, + "maxSearchResults": 100, + "maxSearchEntries": 5000 + } +} diff --git a/config/roots.server.example.json b/config/roots.server.example.json new file mode 100644 index 0000000..da4f362 --- /dev/null +++ b/config/roots.server.example.json @@ -0,0 +1,19 @@ +{ + "version": 1, + "roots": [ + { + "id": "server-data", + "label": "Persistent server data", + "path": "/data/global", + "read": true, + "create": true + } + ], + "limits": { + "maxReadBytes": 262144, + "maxWriteBytes": 1048576, + "maxDirectoryEntries": 250, + "maxSearchResults": 100, + "maxSearchEntries": 5000 + } +} diff --git a/config/tunnel-roles.json b/config/tunnel-roles.json new file mode 100644 index 0000000..67facb5 --- /dev/null +++ b/config/tunnel-roles.json @@ -0,0 +1,54 @@ +{ + "version": 1, + "roles": [ + { + "id": "pc-local", + "hostId": "pc-main", + "expectedTunnelName": "PC FileBridge - PC Local", + "alias": "pc-filebridge-pc-local", + "gateRequired": true, + "rootIds": ["pc-c", "pc-d"], + "requiredRootIds": ["pc-c"], + "rootPaths": { "pc-c": "C:\\", "pc-d": "D:\\" }, + "volumeDiscovery": { + "enabled": true, + "driveType": 3, + "rootIdPrefix": "pc-", + "allowedBusTypes": ["NVMe", "SATA", "SAS", "RAID", "Storage Spaces", "SCM"], + "allowedFileSystems": ["NTFS"], + "requireHealthy": true + } + }, + { + "id": "laptop-local", + "hostId": "laptop-main", + "expectedTunnelName": "PC FileBridge - Laptop Local", + "alias": "pc-filebridge-laptop-local", + "gateRequired": true, + "rootIds": ["laptop-c", "laptop-d"], + "requiredRootIds": ["laptop-c"], + "rootPaths": { "laptop-c": "C:\\", "laptop-d": "D:\\" }, + "volumeDiscovery": { + "enabled": true, + "driveType": 3, + "rootIdPrefix": "laptop-", + "allowedBusTypes": ["NVMe", "SATA", "SAS", "RAID", "Storage Spaces", "SCM"], + "allowedFileSystems": ["NTFS"], + "requireHealthy": true + } + }, + { + "id": "infrastructure", + "expectedTunnelName": "PC FileBridge - Infrastructure", + "alias": "pc-filebridge-infrastructure", + "gateRequired": false, + "rootIds": ["primary-data", "secondary-data", "agent-data"], + "requiredRootIds": ["primary-data", "secondary-data"], + "rootPaths": { + "primary-data": "/data/primary", + "secondary-data": "/data/secondary", + "agent-data": "/data/agent" + } + } + ] +} diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile new file mode 100644 index 0000000..0ad1f41 --- /dev/null +++ b/deploy/docker/Dockerfile @@ -0,0 +1,98 @@ +# syntax=docker/dockerfile:1.7 + +ARG NODE_IMAGE=node:24.20.0-bookworm-slim@sha256:ba849c60be29959425b8734d57b8b4b7d56f98edd9504c9af091d5281095a71e +ARG GO_IMAGE=golang:1.27.0-bookworm@sha256:ded31c68586d2e49e760acc2e65a884b23d032e9bbbed0ae0c55abd3fcaf4452 +ARG TUNNEL_ASSETS_IMAGE=ghcr.io/openai/tunnel-client:v0.0.13@sha256:4c6b1441a6ca2506ce04231c1022e6ada32ec488f41d300a4f29f7675cfb4337 +ARG TUNNEL_COMMIT=4b5267f823be0b046bb883aacb51603cfde3a0ea +ARG OTEL_VERSION=v1.44.0 +ARG X_NET_VERSION=v0.56.0 +ARG APP_VERSION=0.2.1 + +FROM ${NODE_IMAGE} AS build +WORKDIR /src +COPY package.json package-lock.json ./ +RUN npm ci --ignore-scripts +COPY tsconfig.json ./ +COPY src ./src +RUN npm run build + +FROM ${GO_IMAGE} AS tunnel-builder +ARG TARGETOS=linux +ARG TARGETARCH=amd64 +ARG TUNNEL_COMMIT +ARG OTEL_VERSION +ARG X_NET_VERSION +WORKDIR /src +RUN git init . \ + && git remote add origin https://github.com/openai/tunnel-client.git \ + && git fetch --depth 1 origin "${TUNNEL_COMMIT}" \ + && git checkout --detach FETCH_HEAD \ + && test "$(git rev-parse HEAD)" = "${TUNNEL_COMMIT}" +RUN go get \ + "go.opentelemetry.io/otel@${OTEL_VERSION}" \ + "go.opentelemetry.io/otel/metric@${OTEL_VERSION}" \ + "go.opentelemetry.io/otel/sdk@${OTEL_VERSION}" \ + "go.opentelemetry.io/otel/sdk/metric@${OTEL_VERSION}" \ + "go.opentelemetry.io/otel/trace@${OTEL_VERSION}" \ + "golang.org/x/net@${X_NET_VERSION}" \ + && go mod tidy \ + && go mod verify \ + && go test ./... \ + && CGO_ENABLED=0 GOOS="${TARGETOS}" GOARCH="${TARGETARCH}" go build \ + -trimpath \ + -ldflags "-s -w -X github.com/openai/tunnel-client/pkg/version.GitSHA=${TUNNEL_COMMIT}" \ + -o /out/tunnel-client \ + ./cmd/client \ + && go clean -cache -modcache + +FROM ${TUNNEL_ASSETS_IMAGE} AS tunnel-assets + +FROM ${NODE_IMAGE} AS runtime +ARG APP_VERSION +LABEL org.opencontainers.image.title="PC FileBridge" \ + org.opencontainers.image.description="Create-only filesystem MCP runtime" \ + org.opencontainers.image.version="${APP_VERSION}" \ + org.opencontainers.image.licenses="Apache-2.0" + +ENV NODE_ENV=production \ + HOME=/tmp \ + PC_FILEBRIDGE_VERSION="${APP_VERSION}" \ + FILEBRIDGE_ROLE=infrastructure \ + EXPECTED_TUNNEL_NAME="PC FileBridge - Infrastructure" \ + FILEBRIDGE_CONFIG=/app/config/roots.infrastructure.json \ + HEALTH_LISTEN_ADDR=127.0.0.1:8080 \ + LOG_FORMAT=json \ + LOG_LEVEL=warn \ + TUNNEL_HEALTH_MAX_AGE_SECONDS=180 + +RUN groupadd --gid 10001 filebridge \ + && useradd --uid 10001 --gid 10001 --no-create-home --shell /usr/sbin/nologin filebridge \ + && install -d -o 10001 -g 10001 /app/config /data/primary /data/secondary /usr/share/pc-filebridge/tunnel-client + +RUN rm -rf /usr/local/lib/node_modules/npm \ + && rm -f /usr/local/bin/npm /usr/local/bin/npx + +WORKDIR /app +COPY --from=build --chown=10001:10001 /src/mcp/server.mjs /app/mcp/server.mjs +COPY --chown=10001:10001 config/roots.infrastructure.example.json /app/config/roots.infrastructure.json +COPY deploy/docker/entrypoint.sh /usr/local/bin/pc-filebridge-entrypoint +COPY deploy/docker/healthcheck.mjs /usr/local/lib/pc-filebridge/healthcheck.mjs +COPY deploy/docker/validate-role-config.mjs /usr/local/lib/pc-filebridge/validate-role-config.mjs +COPY --from=tunnel-builder /out/tunnel-client /usr/local/bin/tunnel-client +COPY --from=tunnel-assets /usr/bin/cloudflared /usr/local/bin/cloudflared +COPY --from=tunnel-builder /src/LICENSE /usr/share/pc-filebridge/tunnel-client/LICENSE +COPY deploy/docker/THIRD_PARTY_NOTICES.md /usr/share/pc-filebridge/tunnel-client/THIRD_PARTY_NOTICES.md + +RUN chmod 0555 /usr/local/bin/pc-filebridge-entrypoint /usr/local/bin/tunnel-client /usr/local/bin/cloudflared \ + && chmod 0444 /app/mcp/server.mjs /app/config/roots.infrastructure.json \ + /usr/local/lib/pc-filebridge/healthcheck.mjs \ + /usr/local/lib/pc-filebridge/validate-role-config.mjs \ + /usr/share/pc-filebridge/tunnel-client/LICENSE \ + /usr/share/pc-filebridge/tunnel-client/THIRD_PARTY_NOTICES.md + +USER 10001:10001 + +HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \ + CMD ["node", "/usr/local/lib/pc-filebridge/healthcheck.mjs"] + +ENTRYPOINT ["/usr/local/bin/pc-filebridge-entrypoint"] diff --git a/deploy/docker/THIRD_PARTY_NOTICES.md b/deploy/docker/THIRD_PARTY_NOTICES.md new file mode 100644 index 0000000..0163bb4 --- /dev/null +++ b/deploy/docker/THIRD_PARTY_NOTICES.md @@ -0,0 +1,13 @@ +# Third-party notices + +The VPS image contains two upstream executables: + +- OpenAI tunnel-client v0.0.13, commit 4b5267f823be0b046bb883aacb51603cfde3a0ea, licensed under Apache-2.0. PC FileBridge reproducibly rebuilds this exact source revision with security-only dependency updates: OpenTelemetry Go v1.44.0 and golang.org/x/net v0.56.0. +- Cloudflare cloudflared, copied unchanged from the digest-pinned official OpenAI tunnel-client v0.0.13 image, licensed under Apache-2.0. + +Upstream source and license information: + +- https://github.com/openai/tunnel-client +- https://github.com/cloudflare/cloudflared + +The Apache License 2.0 text is installed beside this notice in the runtime image. diff --git a/deploy/docker/compose.example.yml b/deploy/docker/compose.example.yml new file mode 100644 index 0000000..5626a39 --- /dev/null +++ b/deploy/docker/compose.example.yml @@ -0,0 +1,55 @@ +name: pc-filebridge + +services: + filebridge: + build: + context: ../.. + dockerfile: deploy/docker/Dockerfile + image: pc-filebridge:0.2.1 + container_name: pc-filebridge + restart: unless-stopped + init: true + read_only: true + user: "10001:10001" + cap_drop: + - ALL + security_opt: + - no-new-privileges:true + pids_limit: 64 + mem_limit: 512m + cpus: 1.0 + environment: + FILEBRIDGE_ROLE: infrastructure + EXPECTED_TUNNEL_NAME: "PC FileBridge - Infrastructure" + FILEBRIDGE_CONFIG: /app/config/roots.infrastructure.json + OPENAI_API_KEY_FILE: /run/pc-filebridge-secrets/OPENAI_API_KEY + TUNNEL_ID_FILE: /run/pc-filebridge-secrets/TUNNEL_ID + HEALTH_LISTEN_ADDR: 127.0.0.1:8080 + LOG_FORMAT: json + LOG_LEVEL: warn + TUNNEL_HEALTH_MAX_AGE_SECONDS: 180 + volumes: + - pc-filebridge-data:/data + - pc-filebridge-secrets:/run/pc-filebridge-secrets:ro + tmpfs: + - /tmp:rw,noexec,nosuid,nodev,size=32m,uid=10001,gid=10001,mode=0700 + healthcheck: + test: + - CMD + - node + - /usr/local/lib/pc-filebridge/healthcheck.mjs + interval: 30s + timeout: 5s + retries: 3 + start_period: 60s + logging: + driver: local + options: + max-size: 10m + max-file: "3" + +volumes: + pc-filebridge-data: + external: true + pc-filebridge-secrets: + external: true diff --git a/deploy/docker/compose.host-ca.example.yml b/deploy/docker/compose.host-ca.example.yml new file mode 100644 index 0000000..0616726 --- /dev/null +++ b/deploy/docker/compose.host-ca.example.yml @@ -0,0 +1,14 @@ +services: + filebridge: + environment: + SSL_CERT_FILE: /run/pc-filebridge-trust/ca-certificates.crt + NODE_EXTRA_CA_CERTS: /run/pc-filebridge-trust/ca-certificates.crt + volumes: + - type: bind + source: /etc/ssl/certs/ca-certificates.crt + target: /run/pc-filebridge-trust/ca-certificates.crt + read_only: true + +# Optional Linux overlay for hosts that require a host-managed CA bundle. +# Keep certificate verification enabled. Never set NODE_TLS_REJECT_UNAUTHORIZED=0 +# or use insecure tunnel flags. diff --git a/deploy/docker/entrypoint.sh b/deploy/docker/entrypoint.sh new file mode 100644 index 0000000..1780dd9 --- /dev/null +++ b/deploy/docker/entrypoint.sh @@ -0,0 +1,58 @@ +#!/bin/sh +set -eu + +api_key_file="${OPENAI_API_KEY_FILE:-/run/pc-filebridge-secrets/OPENAI_API_KEY}" +tunnel_id_file="${TUNNEL_ID_FILE:-/run/pc-filebridge-secrets/TUNNEL_ID}" +expected_tunnel_name="${EXPECTED_TUNNEL_NAME:-}" +filebridge_role="${FILEBRIDGE_ROLE:-}" + +fail() { + printf '%s\n' "PC_FILEBRIDGE_STARTUP_FAIL code=$1" >&2 + exit 1 +} + +[ -r "$api_key_file" ] && [ -s "$api_key_file" ] || fail API_KEY_UNAVAILABLE +[ -r "$tunnel_id_file" ] && [ -s "$tunnel_id_file" ] || fail TUNNEL_ID_UNAVAILABLE +[ -r "$FILEBRIDGE_CONFIG" ] && [ -s "$FILEBRIDGE_CONFIG" ] || fail CONFIG_UNAVAILABLE +[ "$filebridge_role" = "infrastructure" ] || fail ROLE_INVALID +[ "$expected_tunnel_name" = "PC FileBridge - Infrastructure" ] || fail EXPECTED_TUNNEL_NAME_INVALID +node /usr/local/lib/pc-filebridge/validate-role-config.mjs "$FILEBRIDGE_CONFIG" >/dev/null 2>&1 \ + || fail INFRASTRUCTURE_CONFIG_INVALID + +tunnel_id="$(tr -d '\r\n' < "$tunnel_id_file")" +case "$tunnel_id" in + tunnel_*) ;; + *) fail TUNNEL_ID_INVALID ;; +esac +case "$tunnel_id" in + *[!A-Za-z0-9_-]*) fail TUNNEL_ID_INVALID ;; +esac + +umask 077 +metadata_file="/tmp/pc-filebridge-tunnel-metadata.json" +runtime_key="$(tr -d '\r\n' < "$api_key_file")" +metadata_ok=false +attempt=1 +while [ "$attempt" -le 3 ]; do + if CONTROL_PLANE_API_KEY="$runtime_key" /usr/local/bin/tunnel-client admin --json tunnels get "$tunnel_id" > "$metadata_file" 2>/dev/null; then + metadata_ok=true + break + fi + attempt=$((attempt + 1)) + [ "$attempt" -le 3 ] && sleep 2 +done +runtime_key= +[ "$metadata_ok" = true ] || fail TUNNEL_METADATA_UNAVAILABLE +actual_tunnel_name="$(node -e 'const fs=require("fs");const value=JSON.parse(fs.readFileSync(process.argv[1],"utf8"));process.stdout.write(String(value.name||""))' "$metadata_file")" +rm -f "$metadata_file" +[ "$actual_tunnel_name" = "$expected_tunnel_name" ] || fail TUNNEL_ROLE_MISMATCH +actual_tunnel_name= + +export CONTROL_PLANE_TUNNEL_ID="$tunnel_id" + +exec /usr/local/bin/tunnel-client run \ + --control-plane.api-key "file:${api_key_file}" \ + --mcp.command "command=node /app/mcp/server.mjs,channel=main" \ + --health.listen-addr "$HEALTH_LISTEN_ADDR" \ + --log.format "$LOG_FORMAT" \ + --log.level "$LOG_LEVEL" diff --git a/deploy/docker/healthcheck.mjs b/deploy/docker/healthcheck.mjs new file mode 100644 index 0000000..08e5e55 --- /dev/null +++ b/deploy/docker/healthcheck.mjs @@ -0,0 +1,43 @@ +#!/usr/bin/env node + +const listenAddress = process.env.HEALTH_LISTEN_ADDR ?? "127.0.0.1:8080"; +const version = process.env.PC_FILEBRIDGE_VERSION ?? "unknown"; +const maximumAge = Number(process.env.TUNNEL_HEALTH_MAX_AGE_SECONDS ?? "180"); + +if (!Number.isFinite(maximumAge) || maximumAge < 30 || maximumAge > 3600) { + fail("INVALID_MAX_AGE"); +} + +try { + const [readyResponse, metricsResponse] = await Promise.all([ + fetch(`http://${listenAddress}/readyz`), + fetch(`http://${listenAddress}/metrics`), + ]); + if (!readyResponse.ok) fail("LOCAL_READY_FAILED"); + if (!metricsResponse.ok) fail("METRICS_UNAVAILABLE"); + + const metrics = await metricsResponse.text(); + const match = metrics.match( + /^commands_poll_last_successful_timestamp_seconds(?:\{[^\n]*\})?\s+([0-9.eE+-]+)$/mu, + ); + if (!match) fail("POLL_SUCCESS_MISSING"); + + const lastSuccess = Number(match[1]); + const age = Date.now() / 1000 - lastSuccess; + if (!Number.isFinite(lastSuccess) || lastSuccess <= 0 || !Number.isFinite(age)) { + fail("POLL_SUCCESS_INVALID"); + } + if (age < -300 || age > maximumAge) { + fail("POLL_SUCCESS_STALE"); + } +} catch { + fail("CHECK_EXCEPTION"); +} + +process.stdout.write(`PC_FILEBRIDGE_HEALTH_PASS version=${version}\n`); +process.exit(0); + +function fail(code) { + process.stderr.write(`PC_FILEBRIDGE_HEALTH_FAIL code=${code}\n`); + process.exit(1); +} diff --git a/deploy/docker/validate-role-config.mjs b/deploy/docker/validate-role-config.mjs new file mode 100644 index 0000000..dd4812f --- /dev/null +++ b/deploy/docker/validate-role-config.mjs @@ -0,0 +1,42 @@ +#!/usr/bin/env node + +import { readFileSync } from "node:fs"; + +const configPath = process.argv[2]; +if (!configPath) throw new Error("CONFIG_PATH_REQUIRED"); + +const config = JSON.parse(readFileSync(configPath, "utf8")); +const expectedPaths = new Map([ + ["primary-data", "/data/primary"], + ["secondary-data", "/data/secondary"], + ["agent-data", "/data/agent"], +]); +const requiredIds = ["primary-data", "secondary-data"]; + +if (config.version !== 1 || !Array.isArray(config.roots)) { + throw new Error("INFRASTRUCTURE_CONFIG_INVALID"); +} +const configuredIds = config.roots.map((entry) => String(entry.id)); +if (new Set(configuredIds).size !== configuredIds.length) { + throw new Error("INFRASTRUCTURE_ROOT_DUPLICATE"); +} +for (const requiredId of requiredIds) { + if (!configuredIds.includes(requiredId)) throw new Error("INFRASTRUCTURE_ROOT_REQUIRED"); +} +const expectedOrder = [...expectedPaths.keys()].filter((rootId) => configuredIds.includes(rootId)); +if (JSON.stringify(configuredIds) !== JSON.stringify(expectedOrder)) { + throw new Error("INFRASTRUCTURE_ROOT_ORDER_INVALID"); +} +for (const entry of config.roots) { + const expectedPath = expectedPaths.get(String(entry.id)); + if (!expectedPath || entry.path !== expectedPath) { + throw new Error("INFRASTRUCTURE_ROOT_PATH_INVALID"); + } + if (entry.read !== true || entry.create !== true) { + throw new Error("INFRASTRUCTURE_ROOT_POLICY_INVALID"); + } +} + +process.stdout.write( + `INFRASTRUCTURE_ROLE_CONFIG_PASS roots=${configuredIds.length} agent=${configuredIds.includes("agent-data")}\n`, +); diff --git a/docs/IMAGE_SECURITY.md b/docs/IMAGE_SECURITY.md new file mode 100644 index 0000000..6c18506 --- /dev/null +++ b/docs/IMAGE_SECURITY.md @@ -0,0 +1,20 @@ +# Container image security gate + +The VPS image is scanned as a complete runtime, not only as an npm project. Release verification uses digest-pinned Syft and Grype images plus `govulncheck` v1.7.0 in binary mode for the Secure MCP Tunnel client. + +## Release policy + +- Any fixed HIGH or CRITICAL finding fails the image gate. There is no vulnerability-ID allowlist. +- Any Go finding that identifies a vulnerable function symbol in the tunnel binary fails the image gate. +- A package-only `govulncheck` finding is reported as `imported_not_called`; Go documents this shape as an imported package with no vulnerable symbol called. It is not silently discarded. +- The runtime image does not ship the npm CLI or its dependency tree because the service needs only the Node.js executable. +- Scanner reports and the image SBOM are release evidence; they do not contain runtime credentials. + +## Hardened tunnel build + +PC FileBridge starts from the exact OpenAI tunnel-client v0.0.13 source revision `4b5267f823be0b046bb883aacb51603cfde3a0ea`. The Docker build verifies that commit, applies only explicit dependency upgrades, runs the upstream Go test suite, and then builds the client: + +- OpenTelemetry Go: v1.44.0 +- `golang.org/x/net`: v0.56.0 + +The unchanged `cloudflared` executable comes from the digest-pinned official OpenAI v0.0.13 image. Re-run the complete image gate whenever the tunnel source revision, dependency pins, Node.js image, cloudflared image, scanner images, or vulnerability database changes. diff --git a/docs/PUBLIC_LAUNCH_READINESS.md b/docs/PUBLIC_LAUNCH_READINESS.md index b4fb427..2aada67 100644 --- a/docs/PUBLIC_LAUNCH_READINESS.md +++ b/docs/PUBLIC_LAUNCH_READINESS.md @@ -6,6 +6,7 @@ A release is launch-ready only when all gates below are satisfied for the exact - [ ] Force-push and branch deletion are disabled and administrators are subject to protection. - [ ] GitHub vulnerability alerts, automated security fixes, private vulnerability reporting, secret scanning, and push protection are enabled. - [ ] Tracked-file secret scan, typecheck, policy tests, build, MCP smoke, package dry-run, SBOM validation, and production dependency audit pass. +- [ ] The digest-pinned VPS image builds, exposes exactly seven tools, preserves create-only bytes, fails closed without secrets, and its Compose model validates. - [ ] Windows CI creates and rejects a real junction and covers alternate data streams and reserved names without a silent skip. - [ ] CodeQL, Dependabot, and secret-scanning have no unresolved release-blocking alert. - [ ] Tag matches all version fields and points to a reviewed commit on `main`. diff --git a/docs/RELEASE_PROCESS.md b/docs/RELEASE_PROCESS.md index 88f3c84..8efa6a6 100644 --- a/docs/RELEASE_PROCESS.md +++ b/docs/RELEASE_PROCESS.md @@ -7,7 +7,7 @@ PC FileBridge releases are built from the canonical public repository, never fro 1. Start from a clean, reviewed commit on the protected `main` branch. 2. Set one semantic version consistently in `package.json`, `package-lock.json`, `.codex-plugin/plugin.json`, and the MCP smoke client. 3. Update `CHANGELOG.md` and complete [Public launch readiness](PUBLIC_LAUNCH_READINESS.md). -4. Confirm Linux CI, mandatory Windows security checks, CodeQL, dependency review, tracked-file secret scan, production dependency audit, and MCP smoke are green. +4. Confirm Ubuntu and Windows CI on Node.js 22 and 24, the real Windows 8.3 fixture, CodeQL, dependency review, tracked-file secret scan, production dependency and license audits, package-content review, clean-room receiver simulation, and MCP smoke are green. 5. Confirm the source contains no credentials, private endpoints, operator identifiers, private configuration, logs, or real user files. ## Automated workflow diff --git a/docs/RELEASE_VERIFICATION.md b/docs/RELEASE_VERIFICATION.md index 940f937..14bc699 100644 --- a/docs/RELEASE_VERIFICATION.md +++ b/docs/RELEASE_VERIFICATION.md @@ -22,6 +22,7 @@ With GitHub CLI authenticated: gh attestation verify pc-filebridge-vX.Y.Z-runtime-npm.tgz --repo gexiro-global/pc-filebridge gh attestation verify pc-filebridge-vX.Y.Z-source.tar.gz --repo gexiro-global/pc-filebridge gh attestation verify pc-filebridge-vX.Y.Z-sbom.cdx.json --repo gexiro-global/pc-filebridge +gh attestation verify SHA256SUMS --repo gexiro-global/pc-filebridge ``` The subject digest must match the downloaded file and the workflow source must be this repository. @@ -36,4 +37,4 @@ Expected result: MCP_SMOKE_PASS tools=7 forbidden_mutations=0 list_roots=ok ``` -A matching hash alone is not proof that the package installs or preserves the MCP security invariants. +A matching hash alone is not proof that the package installs or preserves the MCP security invariants. The release is accepted only after all four public assets are downloaded again, basename-only checksums pass, all four provenance subjects match, and the runtime archive passes this clean-room receiver simulation. diff --git a/docs/TUNNEL_ROLES.md b/docs/TUNNEL_ROLES.md new file mode 100644 index 0000000..d2c21fd --- /dev/null +++ b/docs/TUNNEL_ROLES.md @@ -0,0 +1,117 @@ +# Tunnel roles and device isolation + +PC FileBridge 0.2.1 uses three distinct Secure MCP Tunnel identities. A tunnel identifier must never be shared by two roles or by two active pollers. + +| Role | Required tunnel name | Runtime alias | Root ids | +|---|---|---|---| +| `pc-local` | `PC FileBridge - PC Local` | `pc-filebridge-pc-local` | detected fixed volumes as `pc-a` through `pc-z` | +| `laptop-local` | `PC FileBridge - Laptop Local` | `pc-filebridge-laptop-local` | detected fixed volumes as `laptop-a` through `laptop-z` | +| `infrastructure` | `PC FileBridge - Infrastructure` | `pc-filebridge-infrastructure` | `primary-data`, `secondary-data`, optional `agent-data` | + +The role contract is machine-readable in `config/tunnel-roles.json`. Windows and container launchers verify the control-plane tunnel name before starting. A tunnel created for one role therefore fails closed when its identifier is accidentally installed in another role. + +## Automatic fixed-volume discovery on Windows + +`Start-PCFileBridgeVolumeMonitor.ps1` inventories Windows logical disks with `DriveType=3` every 15 seconds, then joins each letter to its disk, partition, volume, and serial identity. Healthy online NTFS volumes on NVMe, SATA, SAS, RAID, Storage Spaces, or SCM are auto-exposed. New accepted drive-letter partitions are added in deterministic letter order and removed volumes are withdrawn. + +The stable opaque `volume_id` is derived from a versioned schema plus host id, disk identity, partition identity, volume identity, and serial. Its input intentionally excludes drive letter, label, bus, filesystem, health, and online state. Reassigning `E:\` to `F:\` therefore retains the volume id while changing `pc-e` to `pc-f`. Missing, zero, duplicate, or colliding identities fail closed. + +File Backed Virtual, USB, SD, MMC, 1394, and removable volumes require an explicit approval for the exact opaque volume id and observed bus type. The approval registry lives outside the repository under `%LOCALAPPDATA%\PCFileBridge\private`, disables inheritance, and grants access only to the current user and SYSTEM. Network, optical, unknown, ReFS, unhealthy, offline, and incomplete candidates remain blocked regardless of approval. + +The monitor requires three consecutive matching snapshots. It writes a separate candidate, validates role/path policy, starts only the matching runtime, performs a real local MCP probe for exactly seven tools and the expected roots, records the applied hash, and only then promotes last-known-good state. Six injected crash windows recover transactionally; a role-scoped named mutex prevents a second monitor. Rejected topologies are suppressed until their topology hash changes. + +Operator approval workflow: + +```powershell +.\scripts\Get-PCFileBridgeVolumeCandidates.ps1 -Role pc-local +.\scripts\Approve-PCFileBridgeVolume.ps1 -Role pc-local -VolumeId "vol-0123456789abcdef" -BusType "File Backed Virtual" -Reason "Authorized lab VHDX" +.\scripts\Revoke-PCFileBridgeVolumeApproval.ps1 -Role pc-local -VolumeId "vol-0123456789abcdef" +``` + +Run the Windows-only fail-closed tests with: + +```powershell +npm run test:volume-discovery:windows +npm run test:runtime-rollback:windows +npm run test:crash-window:windows +``` + +## Local Codex + +Local Codex may launch the stdio MCP server directly with the device-specific configuration. No Secure MCP Tunnel is required for that local path. + +Copy exactly one example to the ignored `config/roots.local.json`: + +- main PC: `config/roots.pc.example.json`; +- laptop: `config/roots.laptop.example.json`. + +Remove the laptop D root when the device has no D drive. Complete drive roots still require the exact full-drive process opt-in. + +## ChatGPT and GPT Classic + +ChatGPT is cloud-hosted and cannot cryptographically infer whether a conversation was opened on the PC or laptop. Device separation therefore uses distinct connectors and tunnels, not prompts, User-Agent strings, IP addresses, or conversation names. + +Local roles require an operator gate. The gate is locked by default because absence, an invalid value, or the wrong role all fail closed. + +Arm only the device currently in use: + +```powershell +.\scripts\Set-PCFileBridgeGate.ps1 -Role pc-local -State Armed +``` + +Lock it after use: + +```powershell +.\scripts\Set-PCFileBridgeGate.ps1 -Role pc-local -State Locked +``` + +The laptop uses `laptop-local` in the same commands. + +Start a role-bound runtime only with its own tunnel and configuration: + +```powershell +.\scripts\Connect-PCFileBridgeRoleTunnel.ps1 ` + -Role pc-local ` + -TunnelId 'tunnel_...' ` + -ConfigPath .\config\roots.local.json ` + -EnableFullDrive +``` + +The launcher verifies all of the following before it starts: + +1. the local operator gate is armed for the exact role; +2. configured root ids exactly match the role contract; +3. full-drive access has an explicit process opt-in; +4. the OpenAI control-plane tunnel name exactly matches the role; +5. the runtime reaches running, healthy, and ready state. + +For automatic fixed-volume discovery and runtime recovery, launch the monitor instead of the one-shot connector: + +```powershell +.\scripts\Start-PCFileBridgeVolumeMonitor.ps1 -Role pc-local +``` + +The supplied `Connect-PCFileBridgeRoleTunnel-Task.ps1` invokes this monitor and is suitable for a hidden per-user Startup shortcut. Only one monitor instance per role runs at a time. + +## Infrastructure hub + +Only the infrastructure host runs the `infrastructure` tunnel-client poller. Secondary hosts and remote agents must not run additional pollers with that tunnel identifier. + +The infrastructure FileBridge process can expose only paths mounted on its own host. Secondary hosts and remote agents data require separately authorized host mounts or agents. Their absence must make the corresponding root unavailable; it must not silently fall back to another host. + +## Availability truth + +A powered-off PC cannot expose `pc-c` or `pc-d`. A powered-off laptop cannot expose `laptop-c` or `laptop-d`. PC FileBridge does not mirror complete local drives to the VPS. + +The infrastructure connector may remain available while personal devices are offline because its roots live on infrastructure storage. + +## Incident recovery + +If one connector alternates between unrelated root sets, treat it as split-brain: + +1. compare tunnel identifiers only by a secure hash; +2. identify every active tunnel-client poller; +3. stop the unintended poller without deleting its data or secrets; +4. keep only one poller per tunnel identifier; +5. create a new, role-specific tunnel before re-enabling the stopped role; +6. verify repeated `list_roots` calls and one bounded directory listing. diff --git a/docs/VPS_DEPLOYMENT.md b/docs/VPS_DEPLOYMENT.md new file mode 100644 index 0000000..1d0c8af --- /dev/null +++ b/docs/VPS_DEPLOYMENT.md @@ -0,0 +1,69 @@ +# VPS deployment with Secure MCP Tunnel + +This deployment keeps PC FileBridge online independently of a laptop or desktop by storing the exposed files in a persistent VPS volume. It does not mirror or remotely read a powered-off PC disk. Files that must be available on every device must first exist in the server data volume. + +## Trust boundaries + +- `pc-filebridge-data` contains only operator-selected server files. +- `pc-filebridge-secrets` contains the dedicated runtime key and tunnel ID and is mounted read-only. +- Secrets never belong in the image, Compose file, Git history, command line, or logs. +- The service runs as UID/GID 10001, with a read-only root filesystem, no Linux capabilities, no published ports, bounded resources, warning-only rotated logs, and a tunnel-aware healthcheck. +- Secure MCP Tunnel makes an outbound authenticated connection. Do not publish a second unauthenticated MCP endpoint. + +## Prerequisites + +- Docker Engine with Compose v2. +- A dedicated OpenAI runtime key with Tunnel Read and Use permissions. +- A Secure MCP Tunnel named exactly `PC FileBridge - Infrastructure`. +- Two pre-created external volumes named `pc-filebridge-data` and `pc-filebridge-secrets`. + +Place the two single-line secret files in the secret volume as `OPENAI_API_KEY` and `TUNNEL_ID`, mode `0600`, owned by UID/GID 10001. Transfer them through an authenticated encrypted channel and remove temporary plaintext immediately. Do not use an OpenAI admin key for the runtime. + +Create `/data/primary` and `/data/secondary` in the data volume and make them writable by UID/GID 10001. The supplied root configuration exposes only the neutral `primary-data` and `secondary-data` examples and preserves the create-only policy. To enable an optional remote agent, create or mount `/data/agent`, add the documented `agent-data` entry to a private runtime configuration derived from the example, and point `FILEBRIDGE_CONFIG` at that mounted read-only file. Never advertise `agent-data` when its authorized storage is absent. + +Only this infrastructure host may run the tunnel-client poller for the infrastructure tunnel. Secondary hosts and remote agents must connect through authorized mounts or agents; they must never run a second poller with the same tunnel identifier. + +## Build and preflight + +From the repository root: + +```sh +npm ci --ignore-scripts +npm run verify +docker compose -f deploy/docker/compose.example.yml build --pull +npm run check:container +docker compose -f deploy/docker/compose.example.yml config --quiet +``` + +The image pins both the Node base image and the official Secure MCP Tunnel image by immutable OCI digest. + +### Optional host-managed CA + +If the Linux host requires a host-managed CA bundle for outbound TLS inspection, validate and start with the supplied overlay: + +```sh +docker compose \ + -f deploy/docker/compose.example.yml \ + -f deploy/docker/compose.host-ca.example.yml \ + config --quiet +``` + +The overlay mounts the host CA bundle read-only and points Node.js at it. Use it only when required by the host trust policy. Never disable certificate verification or add insecure tunnel flags. + +## Start and verify + +```sh +docker compose -f deploy/docker/compose.example.yml up -d +docker inspect --format '{{.State.Health.Status}}' pc-filebridge +docker logs --tail 100 pc-filebridge +``` + +Report success only when the container is running, the healthcheck reports a recent successful command poll, the tunnel is connected, and a client can list exactly seven tools with no forbidden mutation tools. Then test one new-file create and verify that a second create at the same path returns `TARGET_EXISTS` without changing the original bytes. + +## Recovery + +Keep release checksums, the exact Git commit, the image digest, and an encrypted backup of the two volumes. A rollback should start the prior verified image against the same volumes; never copy secrets into a repository or image layer. Rotate the runtime key after suspected exposure. + +## Public distribution boundary + +This Compose deployment is a self-hosted private connector. A public ChatGPT app submission is a separate product surface and requires a stable public HTTPS Streamable HTTP MCP endpoint plus the applicable authentication and review requirements. Secure MCP Tunnel alone is not a public marketplace endpoint. diff --git a/mcp/server.mjs b/mcp/server.mjs index ae61c39..e2c9c35 100644 --- a/mcp/server.mjs +++ b/mcp/server.mjs @@ -473,9 +473,9 @@ var require_codegen = __commonJS({ } }; var Throw = class extends Node { - constructor(error51) { + constructor(error61) { super(); - this.error = error51; + this.error = error61; } render({ _n }) { return `throw ${this.error};` + _n; @@ -712,9 +712,9 @@ var require_codegen = __commonJS({ } }; var Catch = class extends BlockNode { - constructor(error51) { + constructor(error61) { super(); - this.error = error51; + this.error = error61; } render(opts) { return `catch(${this.error})` + super.render(opts); @@ -840,8 +840,8 @@ var require_codegen = __commonJS({ endIf() { return this._endBlockNode(If, Else); } - _for(node, forBody) { - this._blockNode(node); + _for(node2, forBody) { + this._blockNode(node2); if (forBody) this.code(forBody).endFor(); return this; @@ -890,10 +890,10 @@ var require_codegen = __commonJS({ } // `return` statement return(value) { - const node = new Return(); - this._blockNode(node); + const node2 = new Return(); + this._blockNode(node2); this.code(value); - if (node.nodes.length !== 1) + if (node2.nodes.length !== 1) throw new Error('CodeGen: "return" should have one node'); return this._endBlockNode(Return); } @@ -901,23 +901,23 @@ var require_codegen = __commonJS({ try(tryBody, catchCode, finallyCode) { if (!catchCode && !finallyCode) throw new Error('CodeGen: "try" without "catch" and "finally"'); - const node = new Try(); - this._blockNode(node); + const node2 = new Try(); + this._blockNode(node2); this.code(tryBody); if (catchCode) { - const error51 = this.name("e"); - this._currNode = node.catch = new Catch(error51); - catchCode(error51); + const error61 = this.name("e"); + this._currNode = node2.catch = new Catch(error61); + catchCode(error61); } if (finallyCode) { - this._currNode = node.finally = new Finally(); + this._currNode = node2.finally = new Finally(); this.code(finallyCode); } return this._endBlockNode(Catch, Finally); } // `throw` statement - throw(error51) { - return this._leafNode(new Throw(error51)); + throw(error61) { + return this._leafNode(new Throw(error61)); } // start self-balancing block block(body, nodeCount) { @@ -955,13 +955,13 @@ var require_codegen = __commonJS({ this._root.optimizeNames(this._root.names, this._constants); } } - _leafNode(node) { - this._currNode.nodes.push(node); + _leafNode(node2) { + this._currNode.nodes.push(node2); return this; } - _blockNode(node) { - this._currNode.nodes.push(node); - this._nodes.push(node); + _blockNode(node2) { + this._currNode.nodes.push(node2); + this._nodes.push(node2); } _endBlockNode(N1, N2) { const n = this._currNode; @@ -971,12 +971,12 @@ var require_codegen = __commonJS({ } throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`); } - _elseNode(node) { + _elseNode(node2) { const n = this._currNode; if (!(n instanceof If)) { throw new Error('CodeGen: "else" without "if"'); } - this._currNode = n.else = node; + this._currNode = n.else = node2; return this; } get _root() { @@ -986,9 +986,9 @@ var require_codegen = __commonJS({ const ns = this._nodes; return ns[ns.length - 1]; } - set _currNode(node) { + set _currNode(node2) { const ns = this._nodes; - ns[ns.length - 1] = node; + ns[ns.length - 1] = node2; } }; exports.CodeGen = CodeGen; @@ -1273,10 +1273,10 @@ var require_errors = __commonJS({ exports.keyword$DataError = { message: ({ keyword, schemaType }) => schemaType ? (0, codegen_1.str)`"${keyword}" keyword must be ${schemaType} ($data)` : (0, codegen_1.str)`"${keyword}" keyword is invalid ($data)` }; - function reportError(cxt, error51 = exports.keywordError, errorPaths, overrideAllErrors) { + function reportError(cxt, error61 = exports.keywordError, errorPaths, overrideAllErrors) { const { it } = cxt; const { gen, compositeRule, allErrors } = it; - const errObj = errorObjectCode(cxt, error51, errorPaths); + const errObj = errorObjectCode(cxt, error61, errorPaths); if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : compositeRule || allErrors) { addError(gen, errObj); } else { @@ -1284,10 +1284,10 @@ var require_errors = __commonJS({ } } exports.reportError = reportError; - function reportExtraError(cxt, error51 = exports.keywordError, errorPaths) { + function reportExtraError(cxt, error61 = exports.keywordError, errorPaths) { const { it } = cxt; const { gen, compositeRule, allErrors } = it; - const errObj = errorObjectCode(cxt, error51, errorPaths); + const errObj = errorObjectCode(cxt, error61, errorPaths); addError(gen, errObj); if (!(compositeRule || allErrors)) { returnErrors(it, names_1.default.vErrors); @@ -1338,19 +1338,19 @@ var require_errors = __commonJS({ schema: new codegen_1.Name("schema"), parentSchema: new codegen_1.Name("parentSchema") }; - function errorObjectCode(cxt, error51, errorPaths) { + function errorObjectCode(cxt, error61, errorPaths) { const { createErrors } = cxt.it; if (createErrors === false) return (0, codegen_1._)`{}`; - return errorObject(cxt, error51, errorPaths); + return errorObject(cxt, error61, errorPaths); } - function errorObject(cxt, error51, errorPaths = {}) { + function errorObject(cxt, error61, errorPaths = {}) { const { gen, it } = cxt; const keyValues = [ errorInstancePath(it, errorPaths), errorSchemaPath(cxt, errorPaths) ]; - extraErrorProps(cxt, error51, keyValues); + extraErrorProps(cxt, error61, keyValues); return gen.object(...keyValues); } function errorInstancePath({ errorPath }, { instancePath }) { @@ -1870,8 +1870,8 @@ var require_keyword = __commonJS({ var _a3; const { gen, keyword, schema, parentSchema, $data, it } = cxt; checkAsyncKeyword(it, def); - const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate; - const validateRef = useKeyword(gen, keyword, validate); + const validate2 = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate; + const validateRef = useKeyword(gen, keyword, validate2); const valid = gen.let("valid"); cxt.block$data(valid, validateKeyword); cxt.ok((_a3 = def.valid) !== null && _a3 !== void 0 ? _a3 : valid); @@ -1882,13 +1882,13 @@ var require_keyword = __commonJS({ modifyData(cxt); reportErrs(() => cxt.error()); } else { - const ruleErrs = def.async ? validateAsync() : validateSync(); + const ruleErrs = def.async ? validateAsync2() : validateSync(); if (def.modifying) modifyData(cxt); reportErrs(() => addErrs(cxt, ruleErrs)); } } - function validateAsync() { + function validateAsync2() { const ruleErrs = gen.let("ruleErrs", null); gen.try(() => assignValid((0, codegen_1._)`await `), (e) => gen.assign(valid, false).if((0, codegen_1._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._)`${e}.errors`), () => gen.throw(e))); return ruleErrs; @@ -2298,11 +2298,11 @@ var require_resolve = __commonJS({ } return ref; } - function addAnchor(anchor) { - if (typeof anchor == "string") { - if (!ANCHOR.test(anchor)) - throw new Error(`invalid anchor "${anchor}"`); - addRef.call(this, `#${anchor}`); + function addAnchor(anchor2) { + if (typeof anchor2 == "string") { + if (!ANCHOR.test(anchor2)) + throw new Error(`invalid anchor "${anchor2}"`); + addRef.call(this, `#${anchor2}`); } } }); @@ -2944,28 +2944,28 @@ var require_compile = __commonJS({ if (this.opts.code.process) sourceCode = this.opts.code.process(sourceCode, sch); const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode); - const validate = makeValidate(this, this.scope.get()); - this.scope.value(validateName, { ref: validate }); - validate.errors = null; - validate.schema = sch.schema; - validate.schemaEnv = sch; + const validate2 = makeValidate(this, this.scope.get()); + this.scope.value(validateName, { ref: validate2 }); + validate2.errors = null; + validate2.schema = sch.schema; + validate2.schemaEnv = sch; if (sch.$async) - validate.$async = true; + validate2.$async = true; if (this.opts.code.source === true) { - validate.source = { validateName, validateCode, scopeValues: gen._values }; + validate2.source = { validateName, validateCode, scopeValues: gen._values }; } if (this.opts.unevaluated) { const { props, items } = schemaCxt; - validate.evaluated = { + validate2.evaluated = { props: props instanceof codegen_1.Name ? void 0 : props, items: items instanceof codegen_1.Name ? void 0 : items, dynamicProps: props instanceof codegen_1.Name, dynamicItems: items instanceof codegen_1.Name }; - if (validate.source) - validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated); + if (validate2.source) + validate2.source.evaluated = (0, codegen_1.stringify)(validate2.evaluated); } - sch.validate = validate; + sch.validate = validate2; return sch; } catch (e) { delete sch.validate; @@ -3130,27 +3130,27 @@ var require_utils = __commonJS({ } return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63]; } - function stringArrayToHexStripped(input) { + function stringArrayToHexStripped(input2) { let acc = ""; let code = 0; let i = 0; - for (i = 0; i < input.length; i++) { - code = input[i].charCodeAt(0); + for (i = 0; i < input2.length; i++) { + code = input2[i].charCodeAt(0); if (code === 48) { continue; } if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) { return ""; } - acc += input[i]; + acc += input2[i]; break; } - for (i += 1; i < input.length; i++) { - code = input[i].charCodeAt(0); + for (i += 1; i < input2.length; i++) { + code = input2[i].charCodeAt(0); if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) { return ""; } - acc += input[i]; + acc += input2[i]; } return acc; } @@ -3193,11 +3193,11 @@ var require_utils = __commonJS({ const tail = hextets.slice(bestStart + bestLength).join(":"); return head + "::" + tail; } - function normalizeIPv6Address(input) { - const compression = input.indexOf("::"); - if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0; - const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":"); - const right = compression === -1 ? [] : input.slice(compression + 2).split(":"); + function normalizeIPv6Address(input2) { + const compression = input2.indexOf("::"); + if (compression !== -1 && input2.indexOf("::", compression + 1) !== -1) return void 0; + const left = compression === -1 ? input2.split(":") : input2.slice(0, compression).split(":"); + const right = compression === -1 ? [] : input2.slice(compression + 2).split(":"); if (compression !== -1) { if (left.length === 1 && left[0] === "") left.length = 0; if (right.length === 1 && right[0] === "") right.length = 0; @@ -3230,23 +3230,23 @@ var require_utils = __commonJS({ const bracketed = host[0] === "[" && host[host.length - 1] === "]"; const hasBracket = host[0] === "[" || host[host.length - 1] === "]"; if (hasBracket && !bracketed) return { host, isIPV6: false, error: true }; - let input = bracketed ? host.slice(1, -1) : host; - if (bracketed && isIPvFuture(input)) { - input = input.toLowerCase(); - return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true }; + let input2 = bracketed ? host.slice(1, -1) : host; + if (bracketed && isIPvFuture(input2)) { + input2 = input2.toLowerCase(); + return { host: `[${input2}]`, escapedHost: input2, isIPV6: false, isIPVFuture: true }; } - if (findToken(input, ":") < 2) { + if (findToken(input2, ":") < 2) { return { host, isIPV6: false, error: bracketed }; } let zoneIdentifier = ""; - const zoneSeparator = input.indexOf("%"); + const zoneSeparator = input2.indexOf("%"); if (zoneSeparator !== -1) { - const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1; - zoneIdentifier = input.slice(zoneSeparator + separatorLength); + const separatorLength = input2.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1; + zoneIdentifier = input2.slice(zoneSeparator + separatorLength); if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true }; - input = input.slice(0, zoneSeparator); + input2 = input2.slice(0, zoneSeparator); } - const address = normalizeIPv6Address(input); + const address = normalizeIPv6Address(input2); if (address === void 0) return { host, isIPV6: false, error: true }; return { host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""), @@ -3262,79 +3262,79 @@ var require_utils = __commonJS({ return ind; } function removeDotSegments(path3) { - let input = path3; - const output = []; + let input2 = path3; + const output2 = []; let nextSlash = -1; let len = 0; - while (len = input.length) { + while (len = input2.length) { if (len === 1) { - if (input === ".") { + if (input2 === ".") { break; - } else if (input === "/") { - output.push("/"); + } else if (input2 === "/") { + output2.push("/"); break; } else { - output.push(input); + output2.push(input2); break; } } else if (len === 2) { - if (input[0] === ".") { - if (input[1] === ".") { + if (input2[0] === ".") { + if (input2[1] === ".") { break; - } else if (input[1] === "/") { - input = input.slice(2); + } else if (input2[1] === "/") { + input2 = input2.slice(2); continue; } - } else if (input[0] === "/") { - if (input[1] === "." || input[1] === "/") { - output.push("/"); + } else if (input2[0] === "/") { + if (input2[1] === "." || input2[1] === "/") { + output2.push("/"); break; } } } else if (len === 3) { - if (input === "/..") { - if (output.length !== 0) { - output.pop(); + if (input2 === "/..") { + if (output2.length !== 0) { + output2.pop(); } - output.push("/"); + output2.push("/"); break; } } - if (input[0] === ".") { - if (input[1] === ".") { - if (input[2] === "/") { - input = input.slice(3); + if (input2[0] === ".") { + if (input2[1] === ".") { + if (input2[2] === "/") { + input2 = input2.slice(3); continue; } - } else if (input[1] === "/") { - input = input.slice(2); + } else if (input2[1] === "/") { + input2 = input2.slice(2); continue; } - } else if (input[0] === "/") { - if (input[1] === ".") { - if (input[2] === "/") { - input = input.slice(2); + } else if (input2[0] === "/") { + if (input2[1] === ".") { + if (input2[2] === "/") { + input2 = input2.slice(2); continue; - } else if (input[2] === ".") { - if (input[3] === "/") { - input = input.slice(3); - if (output.length !== 0) { - output.pop(); + } else if (input2[2] === ".") { + if (input2[3] === "/") { + input2 = input2.slice(3); + if (output2.length !== 0) { + output2.pop(); } continue; } } } } - if ((nextSlash = input.indexOf("/", 1)) === -1) { - output.push(input); + if ((nextSlash = input2.indexOf("/", 1)) === -1) { + output2.push(input2); break; } else { - output.push(input.slice(0, nextSlash)); - input = input.slice(nextSlash); + output2.push(input2.slice(0, nextSlash)); + input2 = input2.slice(nextSlash); } } - return output.join(""); + return output2.join(""); } var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" }; var HOST_DELIM_RE = /[@/?#:]/g; @@ -3344,80 +3344,80 @@ var require_utils = __commonJS({ re.lastIndex = 0; return host.replace(re, (ch) => HOST_DELIMS[ch]); } - function normalizePercentEncoding(input, decodeUnreserved = false) { - if (input.indexOf("%") === -1) { - return input; + function normalizePercentEncoding(input2, decodeUnreserved = false) { + if (input2.indexOf("%") === -1) { + return input2; } - let output = ""; - for (let i = 0; i < input.length; i++) { - if (input[i] === "%" && i + 2 < input.length) { - const hex3 = input.slice(i + 1, i + 3); + let output2 = ""; + for (let i = 0; i < input2.length; i++) { + if (input2[i] === "%" && i + 2 < input2.length) { + const hex3 = input2.slice(i + 1, i + 3); if (isHexPair(hex3)) { const normalizedHex = hex3.toUpperCase(); const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); if (decodeUnreserved && isUnreserved(decoded)) { - output += decoded; + output2 += decoded; } else { - output += "%" + normalizedHex; + output2 += "%" + normalizedHex; } i += 2; continue; } } - output += input[i]; + output2 += input2[i]; } - return output; + return output2; } - function normalizePathEncoding(input) { - let output = ""; - for (let i = 0; i < input.length; i++) { - const ch = input[i]; - if (ch === "%" && i + 2 < input.length) { - const hex3 = input.slice(i + 1, i + 3); + function normalizePathEncoding(input2) { + let output2 = ""; + for (let i = 0; i < input2.length; i++) { + const ch = input2[i]; + if (ch === "%" && i + 2 < input2.length) { + const hex3 = input2.slice(i + 1, i + 3); if (isHexPair(hex3)) { const normalizedHex = hex3.toUpperCase(); const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); if (decoded !== "." && isUnreserved(decoded)) { - output += decoded; + output2 += decoded; } else { - output += "%" + normalizedHex; + output2 += "%" + normalizedHex; } i += 2; continue; } } if (isPathCharacter(ch)) { - output += ch; + output2 += ch; } else { - const code = input.charCodeAt(i); + const code = input2.charCodeAt(i); if (code < 128) { - output += isEscapeSafe(code) ? ch : BYTE_HEX[code]; + output2 += isEscapeSafe(code) ? ch : BYTE_HEX[code]; } else if (code < 55296 || code > 57343) { - output += percentEncodeNonAscii(code); - } else if (code <= 56319 && i + 1 < input.length) { - const low = input.charCodeAt(i + 1); + output2 += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input2.length) { + const low = input2.charCodeAt(i + 1); if (low >= 56320 && low <= 57343) { - output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + output2 += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); i++; } else { - output += percentEncodeNonAscii(65533); + output2 += percentEncodeNonAscii(65533); } } else { - output += percentEncodeNonAscii(65533); + output2 += percentEncodeNonAscii(65533); } } } - return output; + return output2; } - function serializePathEncoding(input, pathNoScheme = false) { - let output = ""; - let firstSegment = pathNoScheme && input[0] !== "/"; - for (let i = 0; i < input.length; i++) { - const ch = input[i]; - if (ch === "%" && i + 2 < input.length) { - const hex3 = input.slice(i + 1, i + 3); + function serializePathEncoding(input2, pathNoScheme = false) { + let output2 = ""; + let firstSegment = pathNoScheme && input2[0] !== "/"; + for (let i = 0; i < input2.length; i++) { + const ch = input2[i]; + if (ch === "%" && i + 2 < input2.length) { + const hex3 = input2.slice(i + 1, i + 3); if (isHexPair(hex3)) { - output += "%" + hex3.toUpperCase(); + output2 += "%" + hex3.toUpperCase(); i += 2; continue; } @@ -3426,130 +3426,130 @@ var require_utils = __commonJS({ firstSegment = false; } if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) { - output += ch; + output2 += ch; } else { - const code = input.charCodeAt(i); + const code = input2.charCodeAt(i); if (code < 128) { - output += BYTE_HEX[code]; + output2 += BYTE_HEX[code]; } else if (code < 55296 || code > 57343) { - output += percentEncodeNonAscii(code); - } else if (code <= 56319 && i + 1 < input.length) { - const low = input.charCodeAt(i + 1); + output2 += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input2.length) { + const low = input2.charCodeAt(i + 1); if (low >= 56320 && low <= 57343) { - output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + output2 += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); i++; } else { - output += percentEncodeNonAscii(65533); + output2 += percentEncodeNonAscii(65533); } } else { - output += percentEncodeNonAscii(65533); + output2 += percentEncodeNonAscii(65533); } } } - return output; + return output2; } - function encodeComponent(input, isAllowed) { - let output = ""; - for (let i = 0; i < input.length; i++) { - const ch = input[i]; - if (ch === "%" && i + 2 < input.length) { - const hex3 = input.slice(i + 1, i + 3); + function encodeComponent(input2, isAllowed) { + let output2 = ""; + for (let i = 0; i < input2.length; i++) { + const ch = input2[i]; + if (ch === "%" && i + 2 < input2.length) { + const hex3 = input2.slice(i + 1, i + 3); if (isHexPair(hex3)) { - output += "%" + hex3.toUpperCase(); + output2 += "%" + hex3.toUpperCase(); i += 2; continue; } } if (isAllowed(ch)) { - output += ch; + output2 += ch; } else { - const code = input.charCodeAt(i); + const code = input2.charCodeAt(i); if (code < 128) { - output += BYTE_HEX[code]; + output2 += BYTE_HEX[code]; } else if (code < 55296 || code > 57343) { - output += percentEncodeNonAscii(code); - } else if (code <= 56319 && i + 1 < input.length) { - const low = input.charCodeAt(i + 1); + output2 += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input2.length) { + const low = input2.charCodeAt(i + 1); if (low >= 56320 && low <= 57343) { - output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + output2 += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); i++; } else { - output += percentEncodeNonAscii(65533); + output2 += percentEncodeNonAscii(65533); } } else { - output += percentEncodeNonAscii(65533); + output2 += percentEncodeNonAscii(65533); } } } - return output; + return output2; } - function encodeUserinfo(input) { - return encodeComponent(input, isUserinfoCharacter); + function encodeUserinfo(input2) { + return encodeComponent(input2, isUserinfoCharacter); } - function encodeQuery(input) { - return encodeComponent(input, isQueryFragmentCharacter); + function encodeQuery(input2) { + return encodeComponent(input2, isQueryFragmentCharacter); } - function encodeFragment(input) { - return encodeComponent(input, isQueryFragmentCharacter); + function encodeFragment(input2) { + return encodeComponent(input2, isQueryFragmentCharacter); } function isEscapeSafe(cp) { return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95; } - function normalizeQueryFragmentEncoding(input) { - let output = ""; - for (let i = 0; i < input.length; i++) { - const ch = input[i]; - if (ch === "%" && i + 2 < input.length) { - const hex3 = input.slice(i + 1, i + 3); + function normalizeQueryFragmentEncoding(input2) { + let output2 = ""; + for (let i = 0; i < input2.length; i++) { + const ch = input2[i]; + if (ch === "%" && i + 2 < input2.length) { + const hex3 = input2.slice(i + 1, i + 3); if (isHexPair(hex3)) { const normalizedHex = hex3.toUpperCase(); const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); if (isUnreserved(decoded)) { - output += decoded; + output2 += decoded; } else { - output += "%" + normalizedHex; + output2 += "%" + normalizedHex; } i += 2; continue; } } if (isQueryFragmentCharacter(ch)) { - output += ch; + output2 += ch; } else { - const code = input.charCodeAt(i); + const code = input2.charCodeAt(i); if (code < 128) { - output += isEscapeSafe(code) ? ch : BYTE_HEX[code]; + output2 += isEscapeSafe(code) ? ch : BYTE_HEX[code]; } else if (code < 55296 || code > 57343) { - output += percentEncodeNonAscii(code); - } else if (code <= 56319 && i + 1 < input.length) { - const low = input.charCodeAt(i + 1); + output2 += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input2.length) { + const low = input2.charCodeAt(i + 1); if (low >= 56320 && low <= 57343) { - output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + output2 += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); i++; } else { - output += percentEncodeNonAscii(65533); + output2 += percentEncodeNonAscii(65533); } } else { - output += percentEncodeNonAscii(65533); + output2 += percentEncodeNonAscii(65533); } } } - return output; + return output2; } - function escapePreservingEscapes(input) { - let output = ""; - for (let i = 0; i < input.length; i++) { - if (input[i] === "%" && i + 2 < input.length) { - const hex3 = input.slice(i + 1, i + 3); + function escapePreservingEscapes(input2) { + let output2 = ""; + for (let i = 0; i < input2.length; i++) { + if (input2[i] === "%" && i + 2 < input2.length) { + const hex3 = input2.slice(i + 1, i + 3); if (isHexPair(hex3)) { - output += "%" + hex3.toUpperCase(); + output2 += "%" + hex3.toUpperCase(); i += 2; continue; } } - output += escape(input[i]); + output2 += escape(input2[i]); } - return output; + return output2; } function recomposeAuthority(component) { const uriTokens = []; @@ -5003,7 +5003,7 @@ var require_limitNumber = __commonJS({ exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE } }; - var error51 = { + var error61 = { message: ({ keyword, schemaCode }) => (0, codegen_1.str)`must be ${KWDs[keyword].okStr} ${schemaCode}`, params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}` }; @@ -5012,7 +5012,7 @@ var require_limitNumber = __commonJS({ type: "number", schemaType: "number", $data: true, - error: error51, + error: error61, code(cxt) { const { keyword, data, schemaCode } = cxt; cxt.fail$data((0, codegen_1._)`${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`); @@ -5028,7 +5028,7 @@ var require_multipleOf = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); - var error51 = { + var error61 = { message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`, params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}` }; @@ -5037,7 +5037,7 @@ var require_multipleOf = __commonJS({ type: "number", schemaType: "number", $data: true, - error: error51, + error: error61, code(cxt) { const { gen, data, schemaCode, it } = cxt; const prec = it.opts.multipleOfPrecision; @@ -5084,7 +5084,7 @@ var require_limitLength = __commonJS({ var codegen_1 = require_codegen(); var util_1 = require_util(); var ucs2length_1 = require_ucs2length(); - var error51 = { + var error61 = { message({ keyword, schemaCode }) { const comp = keyword === "maxLength" ? "more" : "fewer"; return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} characters`; @@ -5096,7 +5096,7 @@ var require_limitLength = __commonJS({ type: "string", schemaType: "number", $data: true, - error: error51, + error: error61, code(cxt) { const { keyword, data, schemaCode, it } = cxt; const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT; @@ -5116,7 +5116,7 @@ var require_pattern = __commonJS({ var code_1 = require_code2(); var util_1 = require_util(); var codegen_1 = require_codegen(); - var error51 = { + var error61 = { message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`, params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}` }; @@ -5125,7 +5125,7 @@ var require_pattern = __commonJS({ type: "string", schemaType: "string", $data: true, - error: error51, + error: error61, code(cxt) { const { gen, data, $data, schema, schemaCode, it } = cxt; const u = it.opts.unicodeRegExp ? "u" : ""; @@ -5151,7 +5151,7 @@ var require_limitProperties = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); - var error51 = { + var error61 = { message({ keyword, schemaCode }) { const comp = keyword === "maxProperties" ? "more" : "fewer"; return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} properties`; @@ -5163,7 +5163,7 @@ var require_limitProperties = __commonJS({ type: "object", schemaType: "number", $data: true, - error: error51, + error: error61, code(cxt) { const { keyword, data, schemaCode } = cxt; const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT; @@ -5182,7 +5182,7 @@ var require_required = __commonJS({ var code_1 = require_code2(); var codegen_1 = require_codegen(); var util_1 = require_util(); - var error51 = { + var error61 = { message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`, params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}` }; @@ -5191,7 +5191,7 @@ var require_required = __commonJS({ type: "object", schemaType: "array", $data: true, - error: error51, + error: error61, code(cxt) { const { gen, schema, schemaCode, data, $data, it } = cxt; const { opts } = it; @@ -5262,7 +5262,7 @@ var require_limitItems = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); - var error51 = { + var error61 = { message({ keyword, schemaCode }) { const comp = keyword === "maxItems" ? "more" : "fewer"; return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} items`; @@ -5274,7 +5274,7 @@ var require_limitItems = __commonJS({ type: "array", schemaType: "number", $data: true, - error: error51, + error: error61, code(cxt) { const { keyword, data, schemaCode } = cxt; const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT; @@ -5305,7 +5305,7 @@ var require_uniqueItems = __commonJS({ var codegen_1 = require_codegen(); var util_1 = require_util(); var equal_1 = require_equal(); - var error51 = { + var error61 = { message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`, params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}` }; @@ -5314,7 +5314,7 @@ var require_uniqueItems = __commonJS({ type: "array", schemaType: "boolean", $data: true, - error: error51, + error: error61, code(cxt) { const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt; if (!$data && !schema) @@ -5371,14 +5371,14 @@ var require_const = __commonJS({ var codegen_1 = require_codegen(); var util_1 = require_util(); var equal_1 = require_equal(); - var error51 = { + var error61 = { message: "must be equal to constant", params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}` }; var def = { keyword: "const", $data: true, - error: error51, + error: error61, code(cxt) { const { gen, data, $data, schemaCode, schema } = cxt; if ($data || schema && typeof schema == "object") { @@ -5400,7 +5400,7 @@ var require_enum = __commonJS({ var codegen_1 = require_codegen(); var util_1 = require_util(); var equal_1 = require_equal(); - var error51 = { + var error61 = { message: "must be equal to one of the allowed values", params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}` }; @@ -5408,7 +5408,7 @@ var require_enum = __commonJS({ keyword: "enum", schemaType: "array", $data: true, - error: error51, + error: error61, code(cxt) { const { gen, data, $data, schema, schemaCode, it } = cxt; if (!$data && schema.length === 0) @@ -5487,7 +5487,7 @@ var require_additionalItems = __commonJS({ exports.validateAdditionalItems = void 0; var codegen_1 = require_codegen(); var util_1 = require_util(); - var error51 = { + var error61 = { message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`, params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}` }; @@ -5496,7 +5496,7 @@ var require_additionalItems = __commonJS({ type: "array", schemaType: ["boolean", "object"], before: "uniqueItems", - error: error51, + error: error61, code(cxt) { const { parentSchema, it } = cxt; const { items } = parentSchema; @@ -5615,7 +5615,7 @@ var require_items2020 = __commonJS({ var util_1 = require_util(); var code_1 = require_code2(); var additionalItems_1 = require_additionalItems(); - var error51 = { + var error61 = { message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`, params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}` }; @@ -5624,7 +5624,7 @@ var require_items2020 = __commonJS({ type: "array", schemaType: ["object", "boolean"], before: "uniqueItems", - error: error51, + error: error61, code(cxt) { const { schema, parentSchema, it } = cxt; const { prefixItems } = parentSchema; @@ -5648,7 +5648,7 @@ var require_contains = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); var util_1 = require_util(); - var error51 = { + var error61 = { message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`, params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}` }; @@ -5658,7 +5658,7 @@ var require_contains = __commonJS({ schemaType: ["object", "boolean"], before: "uniqueItems", trackErrors: true, - error: error51, + error: error61, code(cxt) { const { gen, schema, parentSchema, data, it } = cxt; let min; @@ -5836,7 +5836,7 @@ var require_propertyNames = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); var util_1 = require_util(); - var error51 = { + var error61 = { message: "property name must be valid", params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}` }; @@ -5844,7 +5844,7 @@ var require_propertyNames = __commonJS({ keyword: "propertyNames", type: "object", schemaType: ["object", "boolean"], - error: error51, + error: error61, code(cxt) { const { gen, schema, data, it } = cxt; if ((0, util_1.alwaysValidSchema)(it, schema)) @@ -5881,7 +5881,7 @@ var require_additionalProperties = __commonJS({ var codegen_1 = require_codegen(); var names_1 = require_names(); var util_1 = require_util(); - var error51 = { + var error61 = { message: "must NOT have additional properties", params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}` }; @@ -5891,7 +5891,7 @@ var require_additionalProperties = __commonJS({ schemaType: ["boolean", "object"], allowUndefined: true, trackErrors: true, - error: error51, + error: error61, code(cxt) { const { gen, schema, parentSchema, data, errsCount, it } = cxt; if (!errsCount) @@ -6165,7 +6165,7 @@ var require_oneOf = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); var util_1 = require_util(); - var error51 = { + var error61 = { message: "must match exactly one schema in oneOf", params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}` }; @@ -6173,7 +6173,7 @@ var require_oneOf = __commonJS({ keyword: "oneOf", schemaType: "array", trackErrors: true, - error: error51, + error: error61, code(cxt) { const { gen, schema, parentSchema, it } = cxt; if (!Array.isArray(schema)) @@ -6250,7 +6250,7 @@ var require_if = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); var util_1 = require_util(); - var error51 = { + var error61 = { message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`, params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}` }; @@ -6258,7 +6258,7 @@ var require_if = __commonJS({ keyword: "if", schemaType: ["object", "boolean"], trackErrors: true, - error: error51, + error: error61, code(cxt) { const { gen, parentSchema, it } = cxt; if (parentSchema.then === void 0 && parentSchema.else === void 0) { @@ -6384,7 +6384,7 @@ var require_format = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); - var error51 = { + var error61 = { message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`, params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}` }; @@ -6393,7 +6393,7 @@ var require_format = __commonJS({ type: ["number", "string"], schemaType: "string", $data: true, - error: error51, + error: error61, code(cxt, ruleType) { const { gen, data, $data, schema, schemaCode, it } = cxt; const { opts, errSchemaPath, schemaEnv, self } = it; @@ -6548,7 +6548,7 @@ var require_discriminator = __commonJS({ var compile_1 = require_compile(); var ref_error_1 = require_ref_error(); var util_1 = require_util(); - var error51 = { + var error61 = { message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`, params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}` }; @@ -6556,7 +6556,7 @@ var require_discriminator = __commonJS({ keyword: "discriminator", type: "object", schemaType: "object", - error: error51, + error: error61, code(cxt) { const { gen, data, schema, parentSchema, it } = cxt; const { oneOf } = parentSchema; @@ -6876,8 +6876,8 @@ var require_formats = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatNames = exports.fastFormats = exports.fullFormats = void 0; - function fmtDef(validate, compare) { - return { validate, compare }; + function fmtDef(validate2, compare) { + return { validate: validate2, compare }; } exports.fullFormats = { // date: http://tools.ietf.org/html/rfc3339#section-5.6 @@ -7088,7 +7088,7 @@ var require_limit = __commonJS({ formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE } }; - var error51 = { + var error61 = { message: ({ keyword, schemaCode }) => (0, codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`, params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}` }; @@ -7097,7 +7097,7 @@ var require_limit = __commonJS({ type: "string", schemaType: "string", $data: true, - error: error51, + error: error61, code(cxt) { const { gen, data, schemaCode, keyword, it } = cxt; const { opts, self } = it; @@ -7367,8 +7367,8 @@ var ZodError = class _ZodError extends Error { return issue2.message; }; const fieldErrors = { _errors: [] }; - const processError = (error51) => { - for (const issue2 of error51.issues) { + const processError = (error61) => { + for (const issue2 of error61.issues) { if (issue2.code === "invalid_union") { issue2.unionErrors.map(processError); } else if (issue2.code === "invalid_return_type") { @@ -7383,13 +7383,28 @@ var ZodError = class _ZodError extends Error { while (i < issue2.path.length) { const el = issue2.path[i]; const terminal = i === issue2.path.length - 1; - if (!terminal) { - curr[el] = curr[el] || { _errors: [] }; - } else { - curr[el] = curr[el] || { _errors: [] }; - curr[el]._errors.push(mapper(issue2)); + if (el === "_errors") { + if (terminal) + curr._errors.push(mapper(issue2)); + i++; + continue; + } + if (!Object.prototype.hasOwnProperty.call(curr, el)) { + if (el === "__proto__") { + Object.defineProperty(curr, el, { + value: { _errors: [] }, + writable: true, + enumerable: true, + configurable: true + }); + } else { + curr[el] = { _errors: [] }; + } } curr = curr[el]; + if (terminal) { + curr._errors.push(mapper(issue2)); + } i++; } } @@ -7431,8 +7446,8 @@ var ZodError = class _ZodError extends Error { } }; ZodError.create = (issues) => { - const error51 = new ZodError(issues); - return error51; + const error61 = new ZodError(issues); + return error61; }; // node_modules/zod/v3/locales/en.js @@ -7692,8 +7707,8 @@ var handleResult = (ctx, result) => { get error() { if (this._error) return this._error; - const error51 = new ZodError(ctx.common.issues); - this._error = error51; + const error61 = new ZodError(ctx.common.issues); + this._error = error61; return this._error; } }; @@ -7726,41 +7741,41 @@ var ZodType = class { get description() { return this._def.description; } - _getType(input) { - return getParsedType(input.data); + _getType(input2) { + return getParsedType(input2.data); } - _getOrReturnCtx(input, ctx) { + _getOrReturnCtx(input2, ctx) { return ctx || { - common: input.parent.common, - data: input.data, - parsedType: getParsedType(input.data), + common: input2.parent.common, + data: input2.data, + parsedType: getParsedType(input2.data), schemaErrorMap: this._def.errorMap, - path: input.path, - parent: input.parent + path: input2.path, + parent: input2.parent }; } - _processInputParams(input) { + _processInputParams(input2) { return { status: new ParseStatus(), ctx: { - common: input.parent.common, - data: input.data, - parsedType: getParsedType(input.data), + common: input2.parent.common, + data: input2.data, + parsedType: getParsedType(input2.data), schemaErrorMap: this._def.errorMap, - path: input.path, - parent: input.parent + path: input2.path, + parent: input2.parent } }; } - _parseSync(input) { - const result = this._parse(input); + _parseSync(input2) { + const result = this._parse(input2); if (isAsync(result)) { throw new Error("Synchronous parse encountered promise."); } return result; } - _parseAsync(input) { - const result = this._parse(input); + _parseAsync(input2) { + const result = this._parse(input2); return Promise.resolve(result); } parse(data, params) { @@ -8013,7 +8028,7 @@ var nanoidRegex = /^[a-z0-9_-]{21}$/i; var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/; var 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)?)??$/; var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i; -var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`; +var _emojiRegex = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`; var emojiRegex; var 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])$/; var 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])$/; @@ -8086,13 +8101,13 @@ function isValidCidr(ip, version2) { return false; } var ZodString = class _ZodString2 extends ZodType { - _parse(input) { + _parse(input2) { if (this._def.coerce) { - input.data = String(input.data); + input2.data = String(input2.data); } - const parsedType2 = this._getType(input); + const parsedType2 = this._getType(input2); if (parsedType2 !== ZodParsedType.string) { - const ctx2 = this._getOrReturnCtx(input); + const ctx2 = this._getOrReturnCtx(input2); addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.string, @@ -8104,8 +8119,8 @@ var ZodString = class _ZodString2 extends ZodType { let ctx = void 0; for (const check2 of this._def.checks) { if (check2.kind === "min") { - if (input.data.length < check2.value) { - ctx = this._getOrReturnCtx(input, ctx); + if (input2.data.length < check2.value) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: check2.value, @@ -8117,8 +8132,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "max") { - if (input.data.length > check2.value) { - ctx = this._getOrReturnCtx(input, ctx); + if (input2.data.length > check2.value) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: check2.value, @@ -8130,10 +8145,10 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "length") { - const tooBig = input.data.length > check2.value; - const tooSmall = input.data.length < check2.value; + const tooBig = input2.data.length > check2.value; + const tooSmall = input2.data.length < check2.value; if (tooBig || tooSmall) { - ctx = this._getOrReturnCtx(input, ctx); + ctx = this._getOrReturnCtx(input2, ctx); if (tooBig) { addIssueToContext(ctx, { code: ZodIssueCode.too_big, @@ -8156,8 +8171,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "email") { - if (!emailRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!emailRegex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "email", code: ZodIssueCode.invalid_string, @@ -8169,8 +8184,8 @@ var ZodString = class _ZodString2 extends ZodType { if (!emojiRegex) { emojiRegex = new RegExp(_emojiRegex, "u"); } - if (!emojiRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!emojiRegex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "emoji", code: ZodIssueCode.invalid_string, @@ -8179,8 +8194,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "uuid") { - if (!uuidRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!uuidRegex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "uuid", code: ZodIssueCode.invalid_string, @@ -8189,8 +8204,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "nanoid") { - if (!nanoidRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!nanoidRegex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "nanoid", code: ZodIssueCode.invalid_string, @@ -8199,8 +8214,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "cuid") { - if (!cuidRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!cuidRegex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "cuid", code: ZodIssueCode.invalid_string, @@ -8209,8 +8224,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "cuid2") { - if (!cuid2Regex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!cuid2Regex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "cuid2", code: ZodIssueCode.invalid_string, @@ -8219,8 +8234,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "ulid") { - if (!ulidRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!ulidRegex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "ulid", code: ZodIssueCode.invalid_string, @@ -8230,9 +8245,9 @@ var ZodString = class _ZodString2 extends ZodType { } } else if (check2.kind === "url") { try { - new URL(input.data); + new URL(input2.data); } catch { - ctx = this._getOrReturnCtx(input, ctx); + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "url", code: ZodIssueCode.invalid_string, @@ -8242,9 +8257,9 @@ var ZodString = class _ZodString2 extends ZodType { } } else if (check2.kind === "regex") { check2.regex.lastIndex = 0; - const testResult = check2.regex.test(input.data); + const testResult = check2.regex.test(input2.data); if (!testResult) { - ctx = this._getOrReturnCtx(input, ctx); + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "regex", code: ZodIssueCode.invalid_string, @@ -8253,10 +8268,10 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "trim") { - input.data = input.data.trim(); + input2.data = input2.data.trim(); } else if (check2.kind === "includes") { - if (!input.data.includes(check2.value, check2.position)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!input2.data.includes(check2.value, check2.position)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: { includes: check2.value, position: check2.position }, @@ -8265,12 +8280,12 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "toLowerCase") { - input.data = input.data.toLowerCase(); + input2.data = input2.data.toLowerCase(); } else if (check2.kind === "toUpperCase") { - input.data = input.data.toUpperCase(); + input2.data = input2.data.toUpperCase(); } else if (check2.kind === "startsWith") { - if (!input.data.startsWith(check2.value)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!input2.data.startsWith(check2.value)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: { startsWith: check2.value }, @@ -8279,8 +8294,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "endsWith") { - if (!input.data.endsWith(check2.value)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!input2.data.endsWith(check2.value)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: { endsWith: check2.value }, @@ -8290,8 +8305,8 @@ var ZodString = class _ZodString2 extends ZodType { } } else if (check2.kind === "datetime") { const regex = datetimeRegex(check2); - if (!regex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!regex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: "datetime", @@ -8301,8 +8316,8 @@ var ZodString = class _ZodString2 extends ZodType { } } else if (check2.kind === "date") { const regex = dateRegex; - if (!regex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!regex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: "date", @@ -8312,8 +8327,8 @@ var ZodString = class _ZodString2 extends ZodType { } } else if (check2.kind === "time") { const regex = timeRegex(check2); - if (!regex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!regex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_string, validation: "time", @@ -8322,8 +8337,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "duration") { - if (!durationRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!durationRegex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "duration", code: ZodIssueCode.invalid_string, @@ -8332,8 +8347,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "ip") { - if (!isValidIP(input.data, check2.version)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!isValidIP(input2.data, check2.version)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "ip", code: ZodIssueCode.invalid_string, @@ -8342,8 +8357,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "jwt") { - if (!isValidJWT(input.data, check2.alg)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!isValidJWT(input2.data, check2.alg)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "jwt", code: ZodIssueCode.invalid_string, @@ -8352,8 +8367,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "cidr") { - if (!isValidCidr(input.data, check2.version)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!isValidCidr(input2.data, check2.version)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "cidr", code: ZodIssueCode.invalid_string, @@ -8362,8 +8377,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "base64") { - if (!base64Regex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!base64Regex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "base64", code: ZodIssueCode.invalid_string, @@ -8372,8 +8387,8 @@ var ZodString = class _ZodString2 extends ZodType { status.dirty(); } } else if (check2.kind === "base64url") { - if (!base64urlRegex.test(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!base64urlRegex.test(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { validation: "base64url", code: ZodIssueCode.invalid_string, @@ -8385,7 +8400,7 @@ var ZodString = class _ZodString2 extends ZodType { util.assertNever(check2); } } - return { status: status.value, value: input.data }; + return { status: status.value, value: input2.data }; } _regex(regex, validation, message) { return this.refinement((data) => regex.test(data), { @@ -8646,13 +8661,13 @@ var ZodNumber = class _ZodNumber extends ZodType { this.max = this.lte; this.step = this.multipleOf; } - _parse(input) { + _parse(input2) { if (this._def.coerce) { - input.data = Number(input.data); + input2.data = Number(input2.data); } - const parsedType2 = this._getType(input); + const parsedType2 = this._getType(input2); if (parsedType2 !== ZodParsedType.number) { - const ctx2 = this._getOrReturnCtx(input); + const ctx2 = this._getOrReturnCtx(input2); addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.number, @@ -8664,8 +8679,8 @@ var ZodNumber = class _ZodNumber extends ZodType { const status = new ParseStatus(); for (const check2 of this._def.checks) { if (check2.kind === "int") { - if (!util.isInteger(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!util.isInteger(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: "integer", @@ -8675,9 +8690,9 @@ var ZodNumber = class _ZodNumber extends ZodType { status.dirty(); } } else if (check2.kind === "min") { - const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value; + const tooSmall = check2.inclusive ? input2.data < check2.value : input2.data <= check2.value; if (tooSmall) { - ctx = this._getOrReturnCtx(input, ctx); + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_small, minimum: check2.value, @@ -8689,9 +8704,9 @@ var ZodNumber = class _ZodNumber extends ZodType { status.dirty(); } } else if (check2.kind === "max") { - const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value; + const tooBig = check2.inclusive ? input2.data > check2.value : input2.data >= check2.value; if (tooBig) { - ctx = this._getOrReturnCtx(input, ctx); + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_big, maximum: check2.value, @@ -8703,8 +8718,8 @@ var ZodNumber = class _ZodNumber extends ZodType { status.dirty(); } } else if (check2.kind === "multipleOf") { - if (floatSafeRemainder(input.data, check2.value) !== 0) { - ctx = this._getOrReturnCtx(input, ctx); + if (floatSafeRemainder(input2.data, check2.value) !== 0) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.not_multiple_of, multipleOf: check2.value, @@ -8713,8 +8728,8 @@ var ZodNumber = class _ZodNumber extends ZodType { status.dirty(); } } else if (check2.kind === "finite") { - if (!Number.isFinite(input.data)) { - ctx = this._getOrReturnCtx(input, ctx); + if (!Number.isFinite(input2.data)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.not_finite, message: check2.message @@ -8725,7 +8740,7 @@ var ZodNumber = class _ZodNumber extends ZodType { util.assertNever(check2); } } - return { status: status.value, value: input.data }; + return { status: status.value, value: input2.data }; } gte(value, message) { return this.setLimit("min", value, true, errorUtil.toString(message)); @@ -8877,25 +8892,25 @@ var ZodBigInt = class _ZodBigInt extends ZodType { this.min = this.gte; this.max = this.lte; } - _parse(input) { + _parse(input2) { if (this._def.coerce) { try { - input.data = BigInt(input.data); + input2.data = BigInt(input2.data); } catch { - return this._getInvalidInput(input); + return this._getInvalidInput(input2); } } - const parsedType2 = this._getType(input); + const parsedType2 = this._getType(input2); if (parsedType2 !== ZodParsedType.bigint) { - return this._getInvalidInput(input); + return this._getInvalidInput(input2); } let ctx = void 0; const status = new ParseStatus(); for (const check2 of this._def.checks) { if (check2.kind === "min") { - const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value; + const tooSmall = check2.inclusive ? input2.data < check2.value : input2.data <= check2.value; if (tooSmall) { - ctx = this._getOrReturnCtx(input, ctx); + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_small, type: "bigint", @@ -8906,9 +8921,9 @@ var ZodBigInt = class _ZodBigInt extends ZodType { status.dirty(); } } else if (check2.kind === "max") { - const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value; + const tooBig = check2.inclusive ? input2.data > check2.value : input2.data >= check2.value; if (tooBig) { - ctx = this._getOrReturnCtx(input, ctx); + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_big, type: "bigint", @@ -8919,8 +8934,8 @@ var ZodBigInt = class _ZodBigInt extends ZodType { status.dirty(); } } else if (check2.kind === "multipleOf") { - if (input.data % check2.value !== BigInt(0)) { - ctx = this._getOrReturnCtx(input, ctx); + if (input2.data % check2.value !== BigInt(0)) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.not_multiple_of, multipleOf: check2.value, @@ -8932,10 +8947,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType { util.assertNever(check2); } } - return { status: status.value, value: input.data }; + return { status: status.value, value: input2.data }; } - _getInvalidInput(input) { - const ctx = this._getOrReturnCtx(input); + _getInvalidInput(input2) { + const ctx = this._getOrReturnCtx(input2); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.bigint, @@ -9044,13 +9059,13 @@ ZodBigInt.create = (params) => { }); }; var ZodBoolean = class extends ZodType { - _parse(input) { + _parse(input2) { if (this._def.coerce) { - input.data = Boolean(input.data); + input2.data = Boolean(input2.data); } - const parsedType2 = this._getType(input); + const parsedType2 = this._getType(input2); if (parsedType2 !== ZodParsedType.boolean) { - const ctx = this._getOrReturnCtx(input); + const ctx = this._getOrReturnCtx(input2); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.boolean, @@ -9058,7 +9073,7 @@ var ZodBoolean = class extends ZodType { }); return INVALID; } - return OK(input.data); + return OK(input2.data); } }; ZodBoolean.create = (params) => { @@ -9069,13 +9084,13 @@ ZodBoolean.create = (params) => { }); }; var ZodDate = class _ZodDate extends ZodType { - _parse(input) { + _parse(input2) { if (this._def.coerce) { - input.data = new Date(input.data); + input2.data = new Date(input2.data); } - const parsedType2 = this._getType(input); + const parsedType2 = this._getType(input2); if (parsedType2 !== ZodParsedType.date) { - const ctx2 = this._getOrReturnCtx(input); + const ctx2 = this._getOrReturnCtx(input2); addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.date, @@ -9083,8 +9098,8 @@ var ZodDate = class _ZodDate extends ZodType { }); return INVALID; } - if (Number.isNaN(input.data.getTime())) { - const ctx2 = this._getOrReturnCtx(input); + if (Number.isNaN(input2.data.getTime())) { + const ctx2 = this._getOrReturnCtx(input2); addIssueToContext(ctx2, { code: ZodIssueCode.invalid_date }); @@ -9094,8 +9109,8 @@ var ZodDate = class _ZodDate extends ZodType { let ctx = void 0; for (const check2 of this._def.checks) { if (check2.kind === "min") { - if (input.data.getTime() < check2.value) { - ctx = this._getOrReturnCtx(input, ctx); + if (input2.data.getTime() < check2.value) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_small, message: check2.message, @@ -9107,8 +9122,8 @@ var ZodDate = class _ZodDate extends ZodType { status.dirty(); } } else if (check2.kind === "max") { - if (input.data.getTime() > check2.value) { - ctx = this._getOrReturnCtx(input, ctx); + if (input2.data.getTime() > check2.value) { + ctx = this._getOrReturnCtx(input2, ctx); addIssueToContext(ctx, { code: ZodIssueCode.too_big, message: check2.message, @@ -9125,7 +9140,7 @@ var ZodDate = class _ZodDate extends ZodType { } return { status: status.value, - value: new Date(input.data.getTime()) + value: new Date(input2.data.getTime()) }; } _addCheck(check2) { @@ -9178,10 +9193,10 @@ ZodDate.create = (params) => { }); }; var ZodSymbol = class extends ZodType { - _parse(input) { - const parsedType2 = this._getType(input); + _parse(input2) { + const parsedType2 = this._getType(input2); if (parsedType2 !== ZodParsedType.symbol) { - const ctx = this._getOrReturnCtx(input); + const ctx = this._getOrReturnCtx(input2); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.symbol, @@ -9189,7 +9204,7 @@ var ZodSymbol = class extends ZodType { }); return INVALID; } - return OK(input.data); + return OK(input2.data); } }; ZodSymbol.create = (params) => { @@ -9199,10 +9214,10 @@ ZodSymbol.create = (params) => { }); }; var ZodUndefined = class extends ZodType { - _parse(input) { - const parsedType2 = this._getType(input); + _parse(input2) { + const parsedType2 = this._getType(input2); if (parsedType2 !== ZodParsedType.undefined) { - const ctx = this._getOrReturnCtx(input); + const ctx = this._getOrReturnCtx(input2); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.undefined, @@ -9210,7 +9225,7 @@ var ZodUndefined = class extends ZodType { }); return INVALID; } - return OK(input.data); + return OK(input2.data); } }; ZodUndefined.create = (params) => { @@ -9220,10 +9235,10 @@ ZodUndefined.create = (params) => { }); }; var ZodNull = class extends ZodType { - _parse(input) { - const parsedType2 = this._getType(input); + _parse(input2) { + const parsedType2 = this._getType(input2); if (parsedType2 !== ZodParsedType.null) { - const ctx = this._getOrReturnCtx(input); + const ctx = this._getOrReturnCtx(input2); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.null, @@ -9231,7 +9246,7 @@ var ZodNull = class extends ZodType { }); return INVALID; } - return OK(input.data); + return OK(input2.data); } }; ZodNull.create = (params) => { @@ -9245,8 +9260,8 @@ var ZodAny = class extends ZodType { super(...arguments); this._any = true; } - _parse(input) { - return OK(input.data); + _parse(input2) { + return OK(input2.data); } }; ZodAny.create = (params) => { @@ -9260,8 +9275,8 @@ var ZodUnknown = class extends ZodType { super(...arguments); this._unknown = true; } - _parse(input) { - return OK(input.data); + _parse(input2) { + return OK(input2.data); } }; ZodUnknown.create = (params) => { @@ -9271,8 +9286,8 @@ ZodUnknown.create = (params) => { }); }; var ZodNever = class extends ZodType { - _parse(input) { - const ctx = this._getOrReturnCtx(input); + _parse(input2) { + const ctx = this._getOrReturnCtx(input2); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.never, @@ -9288,10 +9303,10 @@ ZodNever.create = (params) => { }); }; var ZodVoid = class extends ZodType { - _parse(input) { - const parsedType2 = this._getType(input); + _parse(input2) { + const parsedType2 = this._getType(input2); if (parsedType2 !== ZodParsedType.undefined) { - const ctx = this._getOrReturnCtx(input); + const ctx = this._getOrReturnCtx(input2); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.void, @@ -9299,7 +9314,7 @@ var ZodVoid = class extends ZodType { }); return INVALID; } - return OK(input.data); + return OK(input2.data); } }; ZodVoid.create = (params) => { @@ -9309,8 +9324,8 @@ ZodVoid.create = (params) => { }); }; var ZodArray = class _ZodArray extends ZodType { - _parse(input) { - const { ctx, status } = this._processInputParams(input); + _parse(input2) { + const { ctx, status } = this._processInputParams(input2); const def = this._def; if (ctx.parsedType !== ZodParsedType.array) { addIssueToContext(ctx, { @@ -9450,10 +9465,10 @@ var ZodObject = class _ZodObject extends ZodType { this._cached = { shape, keys }; return this._cached; } - _parse(input) { - const parsedType2 = this._getType(input); + _parse(input2) { + const parsedType2 = this._getType(input2); if (parsedType2 !== ZodParsedType.object) { - const ctx2 = this._getOrReturnCtx(input); + const ctx2 = this._getOrReturnCtx(input2); addIssueToContext(ctx2, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.object, @@ -9461,7 +9476,7 @@ var ZodObject = class _ZodObject extends ZodType { }); return INVALID; } - const { status, ctx } = this._processInputParams(input); + const { status, ctx } = this._processInputParams(input2); const { shape, keys: shapeKeys } = this._getCached(); const extraKeys = []; if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) { @@ -9774,8 +9789,8 @@ ZodObject.lazycreate = (shape, params) => { }); }; var ZodUnion = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); + _parse(input2) { + const { ctx } = this._processInputParams(input2); const options = this._def.options; function handleResults(results) { for (const result of results) { @@ -9896,8 +9911,8 @@ var getDiscriminator = (type) => { } }; var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); + _parse(input2) { + const { ctx } = this._processInputParams(input2); if (ctx.parsedType !== ZodParsedType.object) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, @@ -9980,7 +9995,11 @@ function mergeValues(a, b) { const bKeys = util.objectKeys(b); const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1); const newObj = { ...a, ...b }; + if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) + delete newObj.__proto__; for (const key of sharedKeys) { + if (key === "__proto__") + continue; const sharedValue = mergeValues(a[key], b[key]); if (!sharedValue.valid) { return { valid: false }; @@ -10010,8 +10029,8 @@ function mergeValues(a, b) { } } var ZodIntersection = class extends ZodType { - _parse(input) { - const { status, ctx } = this._processInputParams(input); + _parse(input2) { + const { status, ctx } = this._processInputParams(input2); const handleParsed = (parsedLeft, parsedRight) => { if (isAborted(parsedLeft) || isAborted(parsedRight)) { return INVALID; @@ -10063,8 +10082,8 @@ ZodIntersection.create = (left, right, params) => { }); }; var ZodTuple = class _ZodTuple extends ZodType { - _parse(input) { - const { status, ctx } = this._processInputParams(input); + _parse(input2) { + const { status, ctx } = this._processInputParams(input2); if (ctx.parsedType !== ZodParsedType.array) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, @@ -10136,8 +10155,8 @@ var ZodRecord = class _ZodRecord extends ZodType { get valueSchema() { return this._def.valueType; } - _parse(input) { - const { status, ctx } = this._processInputParams(input); + _parse(input2) { + const { status, ctx } = this._processInputParams(input2); if (ctx.parsedType !== ZodParsedType.object) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, @@ -10189,8 +10208,8 @@ var ZodMap = class extends ZodType { get valueSchema() { return this._def.valueType; } - _parse(input) { - const { status, ctx } = this._processInputParams(input); + _parse(input2) { + const { status, ctx } = this._processInputParams(input2); if (ctx.parsedType !== ZodParsedType.map) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, @@ -10249,8 +10268,8 @@ ZodMap.create = (keyType, valueType, params) => { }); }; var ZodSet = class _ZodSet extends ZodType { - _parse(input) { - const { status, ctx } = this._processInputParams(input); + _parse(input2) { + const { status, ctx } = this._processInputParams(input2); if (ctx.parsedType !== ZodParsedType.set) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, @@ -10338,8 +10357,8 @@ var ZodFunction = class _ZodFunction extends ZodType { super(...arguments); this.validate = this.implement; } - _parse(input) { - const { ctx } = this._processInputParams(input); + _parse(input2) { + const { ctx } = this._processInputParams(input2); if (ctx.parsedType !== ZodParsedType.function) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, @@ -10348,25 +10367,25 @@ var ZodFunction = class _ZodFunction extends ZodType { }); return INVALID; } - function makeArgsIssue(args, error51) { + function makeArgsIssue(args, error61) { return makeIssue({ data: args, path: ctx.path, errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x), issueData: { code: ZodIssueCode.invalid_arguments, - argumentsError: error51 + argumentsError: error61 } }); } - function makeReturnsIssue(returns, error51) { + function makeReturnsIssue(returns, error61) { return makeIssue({ data: returns, path: ctx.path, errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x), issueData: { code: ZodIssueCode.invalid_return_type, - returnTypeError: error51 + returnTypeError: error61 } }); } @@ -10375,15 +10394,15 @@ var ZodFunction = class _ZodFunction extends ZodType { if (this._def.returns instanceof ZodPromise) { const me = this; return OK(async function(...args) { - const error51 = new ZodError([]); + const error61 = new ZodError([]); const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => { - error51.addIssue(makeArgsIssue(args, e)); - throw error51; + error61.addIssue(makeArgsIssue(args, e)); + throw error61; }); const result = await Reflect.apply(fn, this, parsedArgs); const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => { - error51.addIssue(makeReturnsIssue(result, e)); - throw error51; + error61.addIssue(makeReturnsIssue(result, e)); + throw error61; }); return parsedReturns; }); @@ -10442,8 +10461,8 @@ var ZodLazy = class extends ZodType { get schema() { return this._def.getter(); } - _parse(input) { - const { ctx } = this._processInputParams(input); + _parse(input2) { + const { ctx } = this._processInputParams(input2); const lazySchema = this._def.getter(); return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx }); } @@ -10456,9 +10475,9 @@ ZodLazy.create = (getter, params) => { }); }; var ZodLiteral = class extends ZodType { - _parse(input) { - if (input.data !== this._def.value) { - const ctx = this._getOrReturnCtx(input); + _parse(input2) { + if (input2.data !== this._def.value) { + const ctx = this._getOrReturnCtx(input2); addIssueToContext(ctx, { received: ctx.data, code: ZodIssueCode.invalid_literal, @@ -10466,7 +10485,7 @@ var ZodLiteral = class extends ZodType { }); return INVALID; } - return { status: "valid", value: input.data }; + return { status: "valid", value: input2.data }; } get value() { return this._def.value; @@ -10487,9 +10506,9 @@ function createZodEnum(values, params) { }); } var ZodEnum = class _ZodEnum extends ZodType { - _parse(input) { - if (typeof input.data !== "string") { - const ctx = this._getOrReturnCtx(input); + _parse(input2) { + if (typeof input2.data !== "string") { + const ctx = this._getOrReturnCtx(input2); const expectedValues = this._def.values; addIssueToContext(ctx, { expected: util.joinValues(expectedValues), @@ -10501,8 +10520,8 @@ var ZodEnum = class _ZodEnum extends ZodType { if (!this._cache) { this._cache = new Set(this._def.values); } - if (!this._cache.has(input.data)) { - const ctx = this._getOrReturnCtx(input); + if (!this._cache.has(input2.data)) { + const ctx = this._getOrReturnCtx(input2); const expectedValues = this._def.values; addIssueToContext(ctx, { received: ctx.data, @@ -10511,7 +10530,7 @@ var ZodEnum = class _ZodEnum extends ZodType { }); return INVALID; } - return OK(input.data); + return OK(input2.data); } get options() { return this._def.values; @@ -10552,9 +10571,9 @@ var ZodEnum = class _ZodEnum extends ZodType { }; ZodEnum.create = createZodEnum; var ZodNativeEnum = class extends ZodType { - _parse(input) { + _parse(input2) { const nativeEnumValues = util.getValidEnumValues(this._def.values); - const ctx = this._getOrReturnCtx(input); + const ctx = this._getOrReturnCtx(input2); if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) { const expectedValues = util.objectValues(nativeEnumValues); addIssueToContext(ctx, { @@ -10567,7 +10586,7 @@ var ZodNativeEnum = class extends ZodType { if (!this._cache) { this._cache = new Set(util.getValidEnumValues(this._def.values)); } - if (!this._cache.has(input.data)) { + if (!this._cache.has(input2.data)) { const expectedValues = util.objectValues(nativeEnumValues); addIssueToContext(ctx, { received: ctx.data, @@ -10576,7 +10595,7 @@ var ZodNativeEnum = class extends ZodType { }); return INVALID; } - return OK(input.data); + return OK(input2.data); } get enum() { return this._def.values; @@ -10593,8 +10612,8 @@ var ZodPromise = class extends ZodType { unwrap() { return this._def.type; } - _parse(input) { - const { ctx } = this._processInputParams(input); + _parse(input2) { + const { ctx } = this._processInputParams(input2); if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) { addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, @@ -10626,8 +10645,8 @@ var ZodEffects = class extends ZodType { sourceType() { return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema; } - _parse(input) { - const { status, ctx } = this._processInputParams(input); + _parse(input2) { + const { status, ctx } = this._processInputParams(input2); const effect = this._def.effect || null; const checkCtx = { addIssue: (arg) => { @@ -10759,12 +10778,12 @@ ZodEffects.createWithPreprocess = (preprocess2, schema, params) => { }); }; var ZodOptional = class extends ZodType { - _parse(input) { - const parsedType2 = this._getType(input); + _parse(input2) { + const parsedType2 = this._getType(input2); if (parsedType2 === ZodParsedType.undefined) { return OK(void 0); } - return this._def.innerType._parse(input); + return this._def.innerType._parse(input2); } unwrap() { return this._def.innerType; @@ -10778,12 +10797,12 @@ ZodOptional.create = (type, params) => { }); }; var ZodNullable = class extends ZodType { - _parse(input) { - const parsedType2 = this._getType(input); + _parse(input2) { + const parsedType2 = this._getType(input2); if (parsedType2 === ZodParsedType.null) { return OK(null); } - return this._def.innerType._parse(input); + return this._def.innerType._parse(input2); } unwrap() { return this._def.innerType; @@ -10797,8 +10816,8 @@ ZodNullable.create = (type, params) => { }); }; var ZodDefault = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); + _parse(input2) { + const { ctx } = this._processInputParams(input2); let data = ctx.data; if (ctx.parsedType === ZodParsedType.undefined) { data = this._def.defaultValue(); @@ -10822,8 +10841,8 @@ ZodDefault.create = (type, params) => { }); }; var ZodCatch = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); + _parse(input2) { + const { ctx } = this._processInputParams(input2); const newCtx = { ...ctx, common: { @@ -10875,10 +10894,10 @@ ZodCatch.create = (type, params) => { }); }; var ZodNaN = class extends ZodType { - _parse(input) { - const parsedType2 = this._getType(input); + _parse(input2) { + const parsedType2 = this._getType(input2); if (parsedType2 !== ZodParsedType.nan) { - const ctx = this._getOrReturnCtx(input); + const ctx = this._getOrReturnCtx(input2); addIssueToContext(ctx, { code: ZodIssueCode.invalid_type, expected: ZodParsedType.nan, @@ -10886,7 +10905,7 @@ var ZodNaN = class extends ZodType { }); return INVALID; } - return { status: "valid", value: input.data }; + return { status: "valid", value: input2.data }; } }; ZodNaN.create = (params) => { @@ -10896,8 +10915,8 @@ ZodNaN.create = (params) => { }); }; var ZodBranded = class extends ZodType { - _parse(input) { - const { ctx } = this._processInputParams(input); + _parse(input2) { + const { ctx } = this._processInputParams(input2); const data = ctx.data; return this._def.type._parse({ data, @@ -10910,8 +10929,8 @@ var ZodBranded = class extends ZodType { } }; var ZodPipeline = class _ZodPipeline extends ZodType { - _parse(input) { - const { status, ctx } = this._processInputParams(input); + _parse(input2) { + const { status, ctx } = this._processInputParams(input2); if (ctx.common.async) { const handleAsync = async () => { const inResult = await this._def.in._parseAsync({ @@ -10965,8 +10984,8 @@ var ZodPipeline = class _ZodPipeline extends ZodType { } }; var ZodReadonly = class extends ZodType { - _parse(input) { - const result = this._def.innerType._parse(input); + _parse(input2) { + const result = this._def.innerType._parse(input2); const freeze = (data) => { if (isValid(data)) { data.value = Object.freeze(data.value); @@ -11102,8 +11121,10 @@ __export(core_exports2, { $ZodCheckStringFormat: () => $ZodCheckStringFormat, $ZodCheckUpperCase: () => $ZodCheckUpperCase, $ZodCodec: () => $ZodCodec, + $ZodCreditCard: () => $ZodCreditCard, $ZodCustom: () => $ZodCustom, $ZodCustomStringFormat: () => $ZodCustomStringFormat, + $ZodCyclicError: () => $ZodCyclicError, $ZodDate: () => $ZodDate, $ZodDefault: () => $ZodDefault, $ZodDiscriminatedUnion: () => $ZodDiscriminatedUnion, @@ -11172,10 +11193,15 @@ __export(core_exports2, { $input: () => $input, $output: () => $output, Doc: () => Doc, + INVALID: () => INVALID2, JSONSchema: () => json_schema_exports, JSONSchemaGenerator: () => JSONSchemaGenerator, NEVER: () => NEVER, TimePrecision: () => TimePrecision, + URL_BAD_FORMAT: () => URL_BAD_FORMAT, + URL_UNPARSEABLE: () => URL_UNPARSEABLE, + ZodCompileAsyncError: () => ZodCompileAsyncError, + ZodCompileUnsupportedError: () => ZodCompileUnsupportedError, _any: () => _any, _array: () => _array, _base64: () => _base64, @@ -11191,6 +11217,7 @@ __export(core_exports2, { _coercedDate: () => _coercedDate, _coercedNumber: () => _coercedNumber, _coercedString: () => _coercedString, + _creditCard: () => _creditCard, _cuid: () => _cuid, _cuid2: () => _cuid2, _custom: () => _custom, @@ -11260,6 +11287,7 @@ __export(core_exports2, { _pipe: () => _pipe, _positive: () => _positive, _promise: () => _promise, + _properties: () => _properties, _property: () => _property, _readonly: () => _readonly, _record: () => _record, @@ -11303,6 +11331,8 @@ __export(core_exports2, { _xid: () => _xid, _xor: () => _xor, clone: () => clone, + compile: () => compile, + compileFn: () => compileFn, config: () => config, createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod, createToJSONSchemaMethod: () => createToJSONSchemaMethod, @@ -11315,16 +11345,26 @@ __export(core_exports2, { finalize: () => finalize, flattenError: () => flattenError, formatError: () => formatError, + getDiscriminatedOption: () => getDiscriminatedOption, globalConfig: () => globalConfig, globalRegistry: () => globalRegistry, + handleUnrepresentable: () => handleUnrepresentable, initializeContext: () => initializeContext, + isBackEdge: () => isBackEdge, + isRecursiveSchema: () => isRecursiveSchema, isValidBase64: () => isValidBase64, isValidBase64URL: () => isValidBase64URL, + isValidCIDRv6: () => isValidCIDRv6, + isValidCreditCard: () => isValidCreditCard, + isValidIPv6: () => isValidIPv6, isValidJWT: () => isValidJWT2, locales: () => locales_exports, + memoizer: () => memoizer, + mergeValues: () => mergeValues2, meta: () => meta, parse: () => parse, parseAsync: () => parseAsync, + parseURLObject: () => parseURLObject, prettifyError: () => prettifyError, process: () => process2, regexes: () => regexes_exports, @@ -11335,94 +11375,25 @@ __export(core_exports2, { safeEncodeAsync: () => safeEncodeAsync, safeParse: () => safeParse, safeParseAsync: () => safeParseAsync, + standardProps: () => standardProps, + stripTabAndNewline: () => stripTabAndNewline, toDotPath: () => toDotPath, toJSONSchema: () => toJSONSchema, + toZod: () => toZod, treeifyError: () => treeifyError, + urlHostnameOk: () => urlHostnameOk, + urlProtocolOk: () => urlProtocolOk, util: () => util_exports, + validate: () => validate, + validateAsync: () => validateAsync, version: () => version }); -// node_modules/zod/v4/core/core.js -var _a; -var NEVER = /* @__PURE__ */ Object.freeze({ - status: "aborted" -}); -// @__NO_SIDE_EFFECTS__ -function $constructor(name, initializer3, params) { - function init(inst, def) { - if (!inst._zod) { - Object.defineProperty(inst, "_zod", { - value: { - def, - constr: _, - traits: /* @__PURE__ */ new Set() - }, - enumerable: false - }); - } - if (inst._zod.traits.has(name)) { - return; - } - inst._zod.traits.add(name); - initializer3(inst, def); - const proto = _.prototype; - const keys = Object.keys(proto); - for (let i = 0; i < keys.length; i++) { - const k = keys[i]; - if (!(k in inst)) { - inst[k] = proto[k].bind(inst); - } - } - } - const Parent = params?.Parent ?? Object; - class Definition extends Parent { - } - Object.defineProperty(Definition, "name", { value: name }); - function _(def) { - var _a3; - const inst = params?.Parent ? new Definition() : this; - init(inst, def); - (_a3 = inst._zod).deferred ?? (_a3.deferred = []); - for (const fn of inst._zod.deferred) { - fn(); - } - return inst; - } - Object.defineProperty(_, "init", { value: init }); - Object.defineProperty(_, Symbol.hasInstance, { - value: (inst) => { - if (params?.Parent && inst instanceof params.Parent) - return true; - return inst?._zod?.traits?.has(name); - } - }); - Object.defineProperty(_, "name", { value: name }); - return _; -} -var $brand = /* @__PURE__ */ Symbol("zod_brand"); -var $ZodAsyncError = class extends Error { - constructor() { - super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`); - } -}; -var $ZodEncodeError = class extends Error { - constructor(name) { - super(`Encountered unidirectional transform during encode: ${name}`); - this.name = "ZodEncodeError"; - } -}; -(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {}); -var globalConfig = globalThis.__zod_globalConfig; -function config(newConfig) { - if (newConfig) - Object.assign(globalConfig, newConfig); - return globalConfig; -} - // node_modules/zod/v4/core/util.js var util_exports = {}; __export(util_exports, { BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES, + CONSTANT_CATCH: () => CONSTANT_CATCH, Class: () => Class, NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES, aborted: () => aborted, @@ -11433,6 +11404,7 @@ __export(util_exports, { assertNever: () => assertNever, assertNotEqual: () => assertNotEqual, assignProp: () => assignProp, + attachSchema: () => attachSchema, base64ToUint8Array: () => base64ToUint8Array, base64urlToUint8Array: () => base64urlToUint8Array, cached: () => cached, @@ -11441,8 +11413,11 @@ __export(util_exports, { cleanRegex: () => cleanRegex, clone: () => clone, cloneDef: () => cloneDef, + codePointLength: () => codePointLength, + constantCatch: () => constantCatch, createTransparentProxy: () => createTransparentProxy, defineLazy: () => defineLazy, + defineLazyInternal: () => defineLazyInternal, esc: () => esc, escapeRegex: () => escapeRegex, explicitlyAborted: () => explicitlyAborted, @@ -11455,11 +11430,14 @@ __export(util_exports, { getParsedType: () => getParsedType2, getSizableOrigin: () => getSizableOrigin, hexToUint8Array: () => hexToUint8Array, + hide: () => hide, + installLazyProp: () => installLazyProp, isObject: () => isObject, isPlainObject: () => isPlainObject, issue: () => issue, joinValues: () => joinValues, jsonStringifyReplacer: () => jsonStringifyReplacer, + members: () => members, merge: () => merge, mergeDefs: () => mergeDefs, normalizeParams: () => normalizeParams, @@ -11468,6 +11446,7 @@ __export(util_exports, { objectClone: () => objectClone, omit: () => omit, optionalKeys: () => optionalKeys, + own: () => own, parsedType: () => parsedType, partial: () => partial, pick: () => pick, @@ -11481,6 +11460,7 @@ __export(util_exports, { shallowClone: () => shallowClone, slugify: () => slugify, stringifyPrimitive: () => stringifyPrimitive, + toZod: () => toZod, uint8ArrayToBase64: () => uint8ArrayToBase64, uint8ArrayToBase64url: () => uint8ArrayToBase64url, uint8ArrayToHex: () => uint8ArrayToHex, @@ -11492,6 +11472,9 @@ function assertEqual(val) { function assertNotEqual(val) { return val; } +function toZod() { + return (schema) => schema; +} function assertIs(_arg) { } function assertNever(_x) { @@ -11525,8 +11508,8 @@ function cached(getter) { } }; } -function nullish(input) { - return input === null || input === void 0; +function nullish(input2) { + return input2 === null || input2 === void 0; } function cleanRegex(source) { const start = source.startsWith("^") ? 1 : 0; @@ -11536,7 +11519,7 @@ function cleanRegex(source) { function floatSafeRemainder2(val, step) { const ratio = val / step; const roundedRatio = Math.round(ratio); - const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1); + const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1); if (Math.abs(ratio - roundedRatio) < tolerance) return 0; return ratio - roundedRatio; @@ -11613,8 +11596,8 @@ function randomString(length = 10) { function esc(str) { return JSON.stringify(str); } -function slugify(input) { - return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, ""); +function slugify(input2) { + return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, ""); } var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => { }; @@ -11792,16 +11775,16 @@ function stringifyPrimitive(value) { } function optionalKeys(shape) { return Object.keys(shape).filter((k) => { - return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional"; + return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional"; }); } -var NUMBER_FORMAT_RANGES = { +var NUMBER_FORMAT_RANGES = /* @__PURE__ */ (() => ({ safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER], int32: [-2147483648, 2147483647], uint32: [0, 4294967295], float32: [-34028234663852886e22, 34028234663852886e22], float64: [-Number.MAX_VALUE, Number.MAX_VALUE] -}; +}))(); var BIGINT_FORMAT_RANGES = { int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")], uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")] @@ -11816,13 +11799,13 @@ function pick(schema, mask) { const def = mergeDefs(schema._zod.def, { get shape() { const newShape = {}; - for (const key in mask) { - if (!(key in currDef.shape)) { - throw new Error(`Unrecognized key: "${key}"`); + for (const key of Reflect.ownKeys(mask)) { + if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) { + throw new Error(`Unrecognized key: "${String(key)}"`); } if (!mask[key]) continue; - newShape[key] = currDef.shape[key]; + assignProp(newShape, key, currDef.shape[key]); } assignProp(this, "shape", newShape); return newShape; @@ -11841,9 +11824,9 @@ function omit(schema, mask) { const def = mergeDefs(schema._zod.def, { get shape() { const newShape = { ...schema._zod.def.shape }; - for (const key in mask) { - if (!(key in currDef.shape)) { - throw new Error(`Unrecognized key: "${key}"`); + for (const key of Reflect.ownKeys(mask)) { + if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) { + throw new Error(`Unrecognized key: "${String(key)}"`); } if (!mask[key]) continue; @@ -11864,7 +11847,7 @@ function extend(schema, shape) { const hasChecks = checks && checks.length > 0; if (hasChecks) { const existingShape = schema._zod.def.shape; - for (const key in shape) { + for (const key of Reflect.ownKeys(shape)) { if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) { throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead."); } @@ -11893,6 +11876,9 @@ function safeExtend(schema, shape) { return clone(schema, def); } function merge(a, b) { + if (!b?._zod?.def) { + throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`."); + } if (a._zod.def.checks?.length) { throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead."); } @@ -11909,21 +11895,21 @@ function merge(a, b) { }); return clone(a, def); } -function partial(Class2, schema, mask) { +function partial(Class2, schema, mask, name = "partial") { const currDef = schema._zod.def; const checks = currDef.checks; const hasChecks = checks && checks.length > 0; if (hasChecks) { - throw new Error(".partial() cannot be used on object schemas containing refinements"); + throw new Error(`.${name}() cannot be used on object schemas containing refinements`); } const def = mergeDefs(schema._zod.def, { get shape() { const oldShape = schema._zod.def.shape; const shape = { ...oldShape }; if (mask) { - for (const key in mask) { - if (!(key in oldShape)) { - throw new Error(`Unrecognized key: "${key}"`); + for (const key of Reflect.ownKeys(mask)) { + if (!Object.prototype.hasOwnProperty.call(oldShape, key)) { + throw new Error(`Unrecognized key: "${String(key)}"`); } if (!mask[key]) continue; @@ -11933,7 +11919,7 @@ function partial(Class2, schema, mask) { }) : oldShape[key]; } } else { - for (const key in oldShape) { + for (const key of Reflect.ownKeys(oldShape)) { shape[key] = Class2 ? new Class2({ type: "optional", innerType: oldShape[key] @@ -11953,9 +11939,9 @@ function required(Class2, schema, mask) { const oldShape = schema._zod.def.shape; const shape = { ...oldShape }; if (mask) { - for (const key in mask) { - if (!(key in shape)) { - throw new Error(`Unrecognized key: "${key}"`); + for (const key of Reflect.ownKeys(mask)) { + if (!Object.prototype.hasOwnProperty.call(shape, key)) { + throw new Error(`Unrecognized key: "${String(key)}"`); } if (!mask[key]) continue; @@ -11965,7 +11951,7 @@ function required(Class2, schema, mask) { }); } } else { - for (const key in oldShape) { + for (const key of Reflect.ownKeys(oldShape)) { shape[key] = new Class2({ type: "nonoptional", innerType: oldShape[key] @@ -12009,9 +11995,24 @@ function prefixIssues(path3, issues) { function unwrapMessage(message) { return typeof message === "string" ? message : message?.message; } +function attachSchema(issues, start, inst) { + var _a3; + for (let i = start; i < issues.length; i++) { + (_a3 = issues[i]).schema ?? (_a3.schema = inst); + } +} function finalizeIssue(iss, ctx, config2) { - const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input"; - const { inst: _inst, continue: _continue, input: _input, ...rest } = iss; + var _a3; + const traits = iss.inst?._zod?.traits; + if (traits?.has("$ZodType")) { + if (traits.has("$ZodCheck")) + (_a3 = iss).schema ?? (_a3.schema = iss.inst); + else + iss.schema = iss.inst; + } + const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0; + const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input"; + const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss; rest.path ?? (rest.path = []); rest.message = message; if (ctx?.reportInput) { @@ -12019,19 +12020,33 @@ function finalizeIssue(iss, ctx, config2) { } return rest; } -function getSizableOrigin(input) { - if (input instanceof Set) +function getSizableOrigin(input2) { + if (input2 instanceof Set) return "set"; - if (input instanceof Map) + if (input2 instanceof Map) return "map"; - if (input instanceof File) + if (input2 instanceof File) return "file"; return "unknown"; } -function getLengthableOrigin(input) { - if (Array.isArray(input)) +var highSurrogate = /[\uD800-\uDBFF]/; +function codePointLength(str) { + const units = str.length; + if (!highSurrogate.test(str)) + return units; + let count = units; + for (let i = 0; i < units - 1; i++) { + if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) { + count--; + i++; + } + } + return count; +} +function getLengthableOrigin(input2) { + if (Array.isArray(input2)) return "array"; - if (typeof input === "string") + if (typeof input2 === "string") return "string"; return "unknown"; } @@ -12057,12 +12072,12 @@ function parsedType(data) { return t; } function issue(...args) { - const [iss, input, inst] = args; + const [iss, input2, inst] = args; if (typeof iss === "string") { return { message: iss, code: "custom", - input, + input: input2, inst }; } @@ -12114,43 +12129,300 @@ var Class = class { constructor(..._args) { } }; +function members(proto, table) { + for (const key in table) { + const desc = Object.getOwnPropertyDescriptor(table, key); + if (desc.get) + Object.defineProperty(proto, key, { ...desc, enumerable: false }); + else + defineBound(proto, key, desc.value); + } +} +function own(inst, key, value, enumerable = true) { + Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value }); + return value; +} +function hide(inst, key, value) { + return own(inst, key, value, false); +} +function defineBound(proto, key, fn) { + Object.defineProperty(proto, key, { + configurable: true, + get() { + return this == null ? fn : own(this, key, fn.bind(this)); + }, + set(value) { + own(this, key, value); + } + }); +} +function claim(inst, sentinel) { + const proto = Object.getPrototypeOf(inst); + return sentinel in proto ? void 0 : proto; +} +var installing; +var broke = false; +var breaker = { + configurable: true, + get() { + broke = true; + return void 0; + } +}; +function defineLazyInternal(inst, key, compute) { + const proto = Object.getPrototypeOf(inst._zod); + if (key in proto && installing !== inst._zod) { + installing = void 0; + return; + } + installing = inst._zod; + Object.defineProperty(proto, key, { + configurable: true, + get() { + Object.defineProperty(this, key, breaker); + const outer = broke; + broke = false; + try { + const value = compute(this); + if (broke) + delete this[key]; + else + Object.defineProperty(this, key, { configurable: true, writable: true, value }); + broke = broke || outer; + return value; + } catch (err) { + delete this[key]; + broke = broke || outer; + throw err; + } + }, + set(value) { + Object.defineProperty(this, key, { configurable: true, writable: true, value }); + } + }); +} +function installLazyProp(inst, key, make, enumerable) { + const proto = claim(inst, key); + if (!proto) + return; + Object.defineProperty(proto, key, { + configurable: true, + get() { + const desc = { configurable: true, writable: true, enumerable, value: void 0 }; + Object.defineProperty(this, key, desc); + desc.value = make(this); + Object.defineProperty(this, key, desc); + return desc.value; + }, + set(value) { + Object.defineProperty(this, key, { configurable: true, writable: true, enumerable, value }); + } + }); +} +var CONSTANT_CATCH = "~constantCatch"; +function constantCatch(value) { + const fn = () => value; + fn[CONSTANT_CATCH] = true; + return fn; +} + +// node_modules/zod/v4/core/core.js +var _a; +var NEVER = /* @__PURE__ */ Object.freeze({ + status: "aborted" +}); +var _zodDesc = { value: void 0, enumerable: false }; +var _E = "captureStackTrace" in Error ? Error : null; +function newError(Definition) { + const E = _E; + if (E) { + const saved = E.stackTraceLimit; + if (typeof saved === "number") { + try { + E.stackTraceLimit = 0; + } catch { + _E = null; + return new Definition(); + } + try { + return new Definition(); + } finally { + E.stackTraceLimit = saved; + } + } + } + return new Definition(); +} +// @__NO_SIDE_EFFECTS__ +function $constructor(name, initializer3, proto, params) { + const zodProto = {}; + function Internals(def) { + this.def = def; + this.constr = _; + this.traits = /* @__PURE__ */ new Set(); + } + Internals.prototype = zodProto; + const protoMembers = proto; + const initialized = protoMembers && /* @__PURE__ */ new WeakSet(); + function init(inst, def) { + if (!inst._zod) { + _zodDesc.value = new Internals(def); + try { + Object.defineProperty(inst, "_zod", _zodDesc); + } finally { + _zodDesc.value = void 0; + } + } + if (inst._zod.traits.has(name)) { + return; + } + inst._zod.traits.add(name); + initializer3(inst, def); + if (initialized) { + const own2 = Object.getPrototypeOf(inst); + const ctorProto = inst._zod.constr.prototype; + let up = own2; + while (up && up !== ctorProto) + up = Object.getPrototypeOf(up); + const target = up ?? own2; + if (!initialized.has(target)) { + initialized.add(target); + members(target, protoMembers); + } + } + const proto2 = _.prototype; + for (const k in proto2) { + if (!Object.prototype.hasOwnProperty.call(proto2, k)) + continue; + if (!(k in inst)) { + inst[k] = proto2[k].bind(inst); + } + } + } + const Parent = params?.Parent ?? Object; + class Definition extends Parent { + } + Object.defineProperty(Definition, "name", { value: name }); + function _(def) { + const inst = params?.Parent ? newError(Definition) : this; + init(inst, def); + const deferred = inst._zod.deferred; + if (deferred) { + for (const fn of deferred) { + fn(); + } + inst._zod.deferred = void 0; + } + const pp = globalThis.__zod_globalConfig?.postProcessor; + if (pp) + pp(inst); + return inst; + } + Object.defineProperty(_, "init", { value: init }); + Object.defineProperty(_, Symbol.hasInstance, { + value: (inst) => { + if (params?.Parent && inst instanceof params.Parent) + return true; + return inst?._zod?.traits?.has(name); + } + }); + Object.defineProperty(_, "name", { value: name }); + return _; +} +var $brand = /* @__PURE__ */ Symbol("zod_brand"); +var $ZodAsyncError = class extends Error { + constructor() { + super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`); + } +}; +var $ZodEncodeError = class extends Error { + constructor(name) { + super(`Encountered unidirectional transform during encode: ${name}`); + this.name = "ZodEncodeError"; + } +}; +(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {}); +var globalConfig = globalThis.__zod_globalConfig; +function config(newConfig) { + if (newConfig) + Object.assign(globalConfig, newConfig); + return globalConfig; +} // node_modules/zod/v4/core/errors.js +function _getMessage() { + const internals = this._zod; + internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2)); + return internals.message; +} +function _setMessage(value) { + this._zod.message = value; +} +var _messageDesc = { + get: _getMessage, + set: _setMessage, + enumerable: true, + configurable: true +}; +var _zodDesc2 = { value: void 0, enumerable: false }; +var _issuesDesc = { value: void 0, enumerable: false }; +var _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]); var initializer = (inst, def) => { inst.name = "$ZodError"; - Object.defineProperty(inst, "_zod", { - value: inst._zod, - enumerable: false - }); - Object.defineProperty(inst, "issues", { - value: def, - enumerable: false - }); - inst.message = JSON.stringify(def, jsonStringifyReplacer, 2); - Object.defineProperty(inst, "toString", { - value: () => inst.message, - enumerable: false - }); + _zodDesc2.value = inst._zod; + Object.defineProperty(inst, "_zod", _zodDesc2); + _issuesDesc.value = def; + Object.defineProperty(inst, "issues", _issuesDesc); + _zodDesc2.value = void 0; + _issuesDesc.value = void 0; + Object.defineProperty(inst, "message", _messageDesc); + const proto = Object.getPrototypeOf(inst); + if (!_installedToString.has(proto)) { + _installedToString.add(proto); + Object.defineProperty(proto, "toString", { + configurable: true, + enumerable: false, + get() { + const value = () => this.message; + Object.defineProperty(this, "toString", { value, configurable: true, writable: true }); + return value; + }, + set(value) { + Object.defineProperty(this, "toString", { value, configurable: true, writable: true }); + } + }); + } }; var $ZodError = $constructor("$ZodError", initializer); -var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error }); -function flattenError(error51, mapper = (issue2) => issue2.message) { +var $ZodRealError = $constructor("$ZodError", initializer, void 0, { + Parent: Error +}); +function node(obj, key, make) { + if (!Object.prototype.hasOwnProperty.call(obj, key)) { + if (key === "__proto__") { + Object.defineProperty(obj, key, { value: make(), writable: true, enumerable: true, configurable: true }); + } else { + obj[key] = make(); + } + } + return obj[key]; +} +function flattenError(error61, mapper = (issue2) => issue2.message) { const fieldErrors = {}; const formErrors = []; - for (const sub of error51.issues) { + for (const sub of error61.issues) { if (sub.path.length > 0) { - fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || []; - fieldErrors[sub.path[0]].push(mapper(sub)); + node(fieldErrors, sub.path[0], () => []).push(mapper(sub)); } else { formErrors.push(mapper(sub)); } } return { formErrors, fieldErrors }; } -function formatError(error51, mapper = (issue2) => issue2.message) { +function formatError(error61, mapper = (issue2) => issue2.message) { const fieldErrors = { _errors: [] }; - const processError = (error52, path3 = []) => { - for (const issue2 of error52.issues) { + const processError = (error62, path3 = []) => { + for (const issue2 of error62.issues) { if (issue2.code === "invalid_union" && issue2.errors.length) { issue2.errors.map((issues) => processError({ issues }, [...path3, ...issue2.path])); } else if (issue2.code === "invalid_key") { @@ -12167,27 +12439,39 @@ function formatError(error51, mapper = (issue2) => issue2.message) { while (i < fullpath.length) { const el = fullpath[i]; const terminal = i === fullpath.length - 1; - if (!terminal) { - curr[el] = curr[el] || { _errors: [] }; - } else { - curr[el] = curr[el] || { _errors: [] }; - curr[el]._errors.push(mapper(issue2)); + if (el === "_errors") { + if (terminal) + curr._errors.push(mapper(issue2)); + i++; + continue; } - curr = curr[el]; + if (!Object.prototype.hasOwnProperty.call(curr, el)) { + Object.defineProperty(curr, el, { + value: { _errors: [] }, + enumerable: true, + writable: true, + configurable: true + }); + } + const node2 = curr[el]; + if (terminal) { + node2._errors.push(mapper(issue2)); + } + curr = node2; i++; } } } } }; - processError(error51); + processError(error61); return fieldErrors; } -function treeifyError(error51, mapper = (issue2) => issue2.message) { +function treeifyError(error61, mapper = (issue2) => issue2.message) { const result = { errors: [] }; - const processError = (error52, path3 = []) => { - var _a3, _b; - for (const issue2 of error52.issues) { + const processError = (error62, path3 = []) => { + var _a3; + for (const issue2 of error62.issues) { if (issue2.code === "invalid_union" && issue2.errors.length) { issue2.errors.map((issues) => processError({ issues }, [...path3, ...issue2.path])); } else if (issue2.code === "invalid_key") { @@ -12207,11 +12491,18 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) { const terminal = i === fullpath.length - 1; if (typeof el === "string") { curr.properties ?? (curr.properties = {}); - (_a3 = curr.properties)[el] ?? (_a3[el] = { errors: [] }); + if (!Object.prototype.hasOwnProperty.call(curr.properties, el)) { + Object.defineProperty(curr.properties, el, { + value: { errors: [] }, + enumerable: true, + writable: true, + configurable: true + }); + } curr = curr.properties[el]; } else { curr.items ?? (curr.items = []); - (_b = curr.items)[el] ?? (_b[el] = { errors: [] }); + (_a3 = curr.items)[el] ?? (_a3[el] = { errors: [] }); curr = curr.items[el]; } if (terminal) { @@ -12222,7 +12513,7 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) { } } }; - processError(error51); + processError(error61); return result; } function toDotPath(_path) { @@ -12243,9 +12534,9 @@ function toDotPath(_path) { } return segs.join(""); } -function prettifyError(error51) { +function prettifyError(error61) { const lines = []; - const issues = [...error51.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length); + const issues = [...error61.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length); for (const issue2 of issues) { lines.push(`\u2716 ${issue2.message}`); if (issue2.path?.length) @@ -12255,31 +12546,40 @@ function prettifyError(error51) { } // node_modules/zod/v4/core/parse.js -var _parse = (_Err) => (schema, value, _ctx, _params) => { - const ctx = _ctx ? { ..._ctx, async: false } : { async: false }; - const result = schema._zod.run({ value, issues: [] }, ctx); - if (result instanceof Promise) { - throw new $ZodAsyncError(); - } - if (result.issues.length) { - const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); - captureStackTrace(e, _params?.callee); - throw e; - } - return result.value; +function finalizeParams(callee, params) { + return { callee: params?.callee ?? callee, Err: params?.Err }; +} +var _parse = (_Err) => { + const fn = (schema, value, _ctx, _params) => { + const ctx = _ctx ? { ..._ctx, async: false } : { async: false }; + const result = schema._zod.run({ value, issues: [] }, ctx); + if (result instanceof Promise) { + throw new $ZodAsyncError(); + } + if (result.issues.length) { + const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); + captureStackTrace(e, _params?.callee ?? fn); + throw e; + } + return result.value; + }; + return fn; }; var parse = /* @__PURE__ */ _parse($ZodRealError); -var _parseAsync = (_Err) => async (schema, value, _ctx, params) => { - const ctx = _ctx ? { ..._ctx, async: true } : { async: true }; - let result = schema._zod.run({ value, issues: [] }, ctx); - if (result instanceof Promise) - result = await result; - if (result.issues.length) { - const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); - captureStackTrace(e, params?.callee); - throw e; - } - return result.value; +var _parseAsync = (_Err) => { + const fn = async (schema, value, _ctx, params) => { + const ctx = _ctx ? { ..._ctx, async: true } : { async: true }; + let result = schema._zod.run({ value, issues: [] }, ctx); + if (result instanceof Promise) + result = await result; + if (result.issues.length) { + const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); + captureStackTrace(e, params?.callee ?? fn); + throw e; + } + return result.value; + }; + return fn; }; var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError); var _safeParse = (_Err) => (schema, value, _ctx) => { @@ -12305,22 +12605,68 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => { } : { success: true, data: result.value }; }; var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError); -var _encode = (_Err) => (schema, value, _ctx) => { - const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" }; - return _parse(_Err)(schema, value, ctx); +var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid"); +var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback"); +var validate = ((schema, value, _ctx) => { + const validator = schema._zod.bag.validator; + if (validator !== void 0 && validator(value) !== COMPILE_INVALID) + return true; + return validateFallback(schema, value, _ctx); +}); +function validateFallback(schema, value, _ctx) { + const ctx = _ctx ? { ..._ctx, async: false } : { async: false }; + const fallbackRun = schema._zod.bag.fallbackRun; + let result; + if (fallbackRun) { + ctx[COMPILE_FALLBACK] = true; + result = fallbackRun({ value, issues: [] }, ctx); + } else { + result = schema._zod.run({ value, issues: [] }, ctx); + } + if (result instanceof Promise) { + throw new $ZodAsyncError(); + } + return result.issues.length === 0; +} +var validateAsync = async (schema, value, _ctx) => { + const ctx = _ctx ? { ..._ctx, async: true } : { async: true }; + let result = schema._zod.run({ value, issues: [] }, ctx); + if (result instanceof Promise) + result = await result; + return result.issues.length === 0; +}; +var _encode = (_Err) => { + const parse3 = _parse(_Err); + const fn = (schema, value, _ctx, _params) => { + const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" }; + return parse3(schema, value, ctx, finalizeParams(fn, _params)); + }; + return fn; }; var encode = /* @__PURE__ */ _encode($ZodRealError); -var _decode = (_Err) => (schema, value, _ctx) => { - return _parse(_Err)(schema, value, _ctx); +var _decode = (_Err) => { + const parse3 = _parse(_Err); + const fn = (schema, value, _ctx, _params) => { + return parse3(schema, value, _ctx, finalizeParams(fn, _params)); + }; + return fn; }; var decode = /* @__PURE__ */ _decode($ZodRealError); -var _encodeAsync = (_Err) => async (schema, value, _ctx) => { - const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" }; - return _parseAsync(_Err)(schema, value, ctx); +var _encodeAsync = (_Err) => { + const parseAsync3 = _parseAsync(_Err); + const fn = async (schema, value, _ctx, _params) => { + const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" }; + return await parseAsync3(schema, value, ctx, finalizeParams(fn, _params)); + }; + return fn; }; var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError); -var _decodeAsync = (_Err) => async (schema, value, _ctx) => { - return _parseAsync(_Err)(schema, value, _ctx); +var _decodeAsync = (_Err) => { + const parseAsync3 = _parseAsync(_Err); + const fn = async (schema, value, _ctx, _params) => { + return await parseAsync3(schema, value, _ctx, finalizeParams(fn, _params)); + }; + return fn; }; var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError); var _safeEncode = (_Err) => (schema, value, _ctx) => { @@ -12352,6 +12698,7 @@ __export(regexes_exports, { browserEmail: () => browserEmail, cidrv4: () => cidrv4, cidrv6: () => cidrv6, + creditCard: () => creditCard, cuid: () => cuid, cuid2: () => cuid2, date: () => date, @@ -12378,6 +12725,7 @@ __export(regexes_exports, { md5_base64url: () => md5_base64url, md5_hex: () => md5_hex, nanoid: () => nanoid, + nanoidOfLength: () => nanoidOfLength, null: () => _null, number: () => number, rfc5322Email: () => rfc5322Email, @@ -12407,10 +12755,13 @@ __export(regexes_exports, { }); var cuid = /^[cC][0-9a-z]{6,}$/; var cuid2 = /^[0-9a-z]+$/; -var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/; +var ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/; var xid = /^[0-9a-vA-V]{20}$/; var ksuid = /^[A-Za-z0-9]{27}$/; var nanoid = /^[a-zA-Z0-9_-]{21}$/; +function nanoidOfLength(length) { + return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`); +} var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/; var 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)?)??$/; var 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})$/; @@ -12428,7 +12779,7 @@ var rfc5322Email = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+") var unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u; var idnEmail = unicodeEmail; var 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])?)*$/; -var _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`; +var _emoji = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`; function emoji() { return new RegExp(_emoji, "u"); } @@ -12439,31 +12790,33 @@ var mac = (delimiter) => { return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`); }; var 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])$/; -var 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])$/; +var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/; var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/; var base64url = /^[A-Za-z0-9_-]*$/; var hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/; -var domain = /^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/; +var domain = /^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/; var httpProtocol = /^https?$/; var e164 = /^\+[1-9]\d{6,14}$/; +var creditCard = /^\d(?:[ -]?\d){11,18}$/; var 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])))`; -var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`); +function anchor(source) { + return new RegExp(`^${source}$`); +} +var date = /* @__PURE__ */ anchor(dateSource); function timeSource(args) { const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`; - const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`; + const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`; return regex; } function time(args) { return new RegExp(`^${timeSource(args)}$`); } function datetime(args) { - const time3 = timeSource({ precision: args.precision }); const opts = ["Z"]; - if (args.local) - opts.push(""); if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`); - const timeRegex2 = `${time3}(?:${opts.join("|")})`; + const qualified = `${timeSource({ precision: args.precision, seconds: true })}(?:${opts.join("|")})`; + const timeRegex2 = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified; return new RegExp(`^${dateSource}T(?:${timeRegex2})$`); } var string = (params) => { @@ -12508,6 +12861,14 @@ var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => { inst._zod.def = def; (_a3 = inst._zod).onattach ?? (_a3.onattach = []); }); +var _whenHasSize = (payload) => { + const val = payload.value; + return !nullish(val) && val.size !== void 0; +}; +var _whenHasLength = (payload) => { + const val = payload.value; + return !nullish(val) && val.length !== void 0; +}; var numericOriginMap = { number: "number", bigint: "bigint", @@ -12531,7 +12892,7 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, return; } payload.issues.push({ - origin, + origin: numericOriginMap[typeof payload.value] ?? origin, code: "too_big", maximum: typeof def.value === "object" ? def.value.getTime() : def.value, input: payload.value, @@ -12559,7 +12920,7 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", return; } payload.issues.push({ - origin, + origin: numericOriginMap[typeof payload.value] ?? origin, code: "too_small", minimum: typeof def.value === "object" ? def.value.getTime() : def.value, input: payload.value, @@ -12578,7 +12939,10 @@ var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (i inst._zod.check = (payload) => { if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check."); - const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder2(payload.value, def.value) === 0; + const isMultiple = typeof payload.value === "bigint" ? ( + // `value % 0n` throws, and nothing is a multiple of zero — the number branch already fails this way via NaN + def.value !== BigInt(0) && payload.value % def.value === BigInt(0) + ) : floatSafeRemainder2(payload.value, def.value) === 0; if (isMultiple) return; payload.issues.push({ @@ -12606,23 +12970,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat" bag.pattern = integer; }); inst._zod.check = (payload) => { - const input = payload.value; + const input2 = payload.value; if (isInt) { - if (!Number.isInteger(input)) { + if (!Number.isInteger(input2)) { payload.issues.push({ expected: origin, format: def.format, code: "invalid_type", continue: false, - input, + input: input2, inst }); return; } - if (!Number.isSafeInteger(input)) { - if (input > 0) { + if (!Number.isSafeInteger(input2)) { + if (input2 > 0) { payload.issues.push({ - input, + input: input2, code: "too_big", maximum: Number.MAX_SAFE_INTEGER, note: "Integers must be within the safe integer range.", @@ -12633,7 +12997,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat" }); } else { payload.issues.push({ - input, + input: input2, code: "too_small", minimum: Number.MIN_SAFE_INTEGER, note: "Integers must be within the safe integer range.", @@ -12646,10 +13010,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat" return; } } - if (input < minimum) { + if (input2 < minimum) { payload.issues.push({ origin: "number", - input, + input: input2, code: "too_small", minimum, inclusive: true, @@ -12657,10 +13021,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat" continue: !def.abort }); } - if (input > maximum) { + if (input2 > maximum) { payload.issues.push({ origin: "number", - input, + input: input2, code: "too_big", maximum, inclusive: true, @@ -12680,11 +13044,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat" bag.maximum = maximum; }); inst._zod.check = (payload) => { - const input = payload.value; - if (input < minimum) { + const input2 = payload.value; + if (input2 < minimum) { payload.issues.push({ origin: "bigint", - input, + input: input2, code: "too_small", minimum, inclusive: true, @@ -12692,10 +13056,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat" continue: !def.abort }); } - if (input > maximum) { + if (input2 > maximum) { payload.issues.push({ origin: "bigint", - input, + input: input2, code: "too_big", maximum, inclusive: true, @@ -12708,26 +13072,23 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat" var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => { var _a3; $ZodCheck.init(inst, def); - (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => { - const val = payload.value; - return !nullish(val) && val.size !== void 0; - }); + (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize); inst._zod.onattach.push((inst2) => { const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY; if (def.maximum < curr) inst2._zod.bag.maximum = def.maximum; }); inst._zod.check = (payload) => { - const input = payload.value; - const size = input.size; + const input2 = payload.value; + const size = input2.size; if (size <= def.maximum) return; payload.issues.push({ - origin: getSizableOrigin(input), + origin: getSizableOrigin(input2), code: "too_big", maximum: def.maximum, inclusive: true, - input, + input: input2, inst, continue: !def.abort }); @@ -12736,26 +13097,23 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => { var _a3; $ZodCheck.init(inst, def); - (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => { - const val = payload.value; - return !nullish(val) && val.size !== void 0; - }); + (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize); inst._zod.onattach.push((inst2) => { const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY; if (def.minimum > curr) inst2._zod.bag.minimum = def.minimum; }); inst._zod.check = (payload) => { - const input = payload.value; - const size = input.size; + const input2 = payload.value; + const size = input2.size; if (size >= def.minimum) return; payload.issues.push({ - origin: getSizableOrigin(input), + origin: getSizableOrigin(input2), code: "too_small", minimum: def.minimum, inclusive: true, - input, + input: input2, inst, continue: !def.abort }); @@ -12764,10 +13122,7 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => { var _a3; $ZodCheck.init(inst, def); - (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => { - const val = payload.value; - return !nullish(val) && val.size !== void 0; - }); + (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize); inst._zod.onattach.push((inst2) => { const bag = inst2._zod.bag; bag.minimum = def.size; @@ -12775,13 +13130,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i bag.size = def.size; }); inst._zod.check = (payload) => { - const input = payload.value; - const size = input.size; + const input2 = payload.value; + const size = input2.size; if (size === def.size) return; const tooBig = size > def.size; payload.issues.push({ - origin: getSizableOrigin(input), + origin: getSizableOrigin(input2), ...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size }, inclusive: true, exact: true, @@ -12794,27 +13149,25 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => { var _a3; $ZodCheck.init(inst, def); - (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => { - const val = payload.value; - return !nullish(val) && val.length !== void 0; - }); + (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength); inst._zod.onattach.push((inst2) => { const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY; if (def.maximum < curr) inst2._zod.bag.maximum = def.maximum; }); inst._zod.check = (payload) => { - const input = payload.value; - const length = input.length; + const input2 = payload.value; + const units = input2.length; + const length = typeof input2 === "string" && units > def.maximum ? codePointLength(input2) : units; if (length <= def.maximum) return; - const origin = getLengthableOrigin(input); + const origin = getLengthableOrigin(input2); payload.issues.push({ origin, code: "too_big", maximum: def.maximum, inclusive: true, - input, + input: input2, inst, continue: !def.abort }); @@ -12823,27 +13176,25 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => { var _a3; $ZodCheck.init(inst, def); - (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => { - const val = payload.value; - return !nullish(val) && val.length !== void 0; - }); + (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength); inst._zod.onattach.push((inst2) => { const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY; if (def.minimum > curr) inst2._zod.bag.minimum = def.minimum; }); inst._zod.check = (payload) => { - const input = payload.value; - const length = input.length; + const input2 = payload.value; + const units = input2.length; + const length = typeof input2 === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input2) : units; if (length >= def.minimum) return; - const origin = getLengthableOrigin(input); + const origin = getLengthableOrigin(input2); payload.issues.push({ origin, code: "too_small", minimum: def.minimum, inclusive: true, - input, + input: input2, inst, continue: !def.abort }); @@ -12852,10 +13203,7 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => { var _a3; $ZodCheck.init(inst, def); - (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => { - const val = payload.value; - return !nullish(val) && val.length !== void 0; - }); + (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength); inst._zod.onattach.push((inst2) => { const bag = inst2._zod.bag; bag.minimum = def.length; @@ -12863,11 +13211,12 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals" bag.length = def.length; }); inst._zod.check = (payload) => { - const input = payload.value; - const length = input.length; + const input2 = payload.value; + const units = input2.length; + const length = typeof input2 === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input2) : units; if (length === def.length) return; - const origin = getLengthableOrigin(input); + const origin = getLengthableOrigin(input2); const tooBig = length > def.length; payload.issues.push({ origin, @@ -12938,7 +13287,7 @@ var $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (ins var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => { $ZodCheck.init(inst, def); const escapedRegex = escapeRegex(def.includes); - const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex); + const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex); def.pattern = pattern; inst._zod.onattach.push((inst2) => { const bag = inst2._zod.bag; @@ -13051,11 +13400,11 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins // node_modules/zod/v4/core/doc.js var Doc = class { - constructor(args = []) { + constructor(args = [], closed = {}) { this.content = []; this.indent = 0; - if (this) - this.args = args; + this.args = args; + this.closed = closed; } indented(fn) { this.indent += 1; @@ -13078,18 +13427,19 @@ var Doc = class { } compile() { const F = Function; - const args = this?.args; const content = this?.content ?? [``]; - const lines = [...content.map((x) => ` ${x}`)]; - return new F(...args, lines.join("\n")); + const factory = new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) { +${content.join("\n")} +};`); + return factory(...Object.values(this.closed)); } }; // node_modules/zod/v4/core/versions.js var version = { major: 4, - minor: 4, - patch: 3 + minor: 5, + patch: 4 }; // node_modules/zod/v4/core/schemas.js @@ -13099,10 +13449,8 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => { inst._zod.def = def; inst._zod.bag = inst._zod.bag || {}; inst._zod.version = version; - const checks = [...inst._zod.def.checks ?? []]; - if (inst._zod.traits.has("$ZodCheck")) { - checks.unshift(inst); - } + const defChecks = inst._zod.def.checks; + const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : []; for (const ch of checks) { for (const fn of ch._zod.onattach) { fn(inst); @@ -13115,6 +13463,8 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => { }); } else { const runChecks = (payload, checks2, ctx) => { + if (payload.memo) + return payload; let isAborted2 = aborted(payload); let asyncResult; for (const ch of checks2) { @@ -13138,6 +13488,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => { const nextLen = payload.issues.length; if (nextLen === currLen) return; + attachSchema(payload.issues, currLen, inst); if (!isAborted2) isAborted2 = aborted(payload, currLen); }); @@ -13145,6 +13496,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => { const nextLen = payload.issues.length; if (nextLen === currLen) continue; + attachSchema(payload.issues, currLen, inst); if (!isAborted2) isAborted2 = aborted(payload, currLen); } @@ -13191,19 +13543,29 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => { return runChecks(result, checks, ctx); }; } - defineLazy(inst, "~standard", () => ({ +}, { + // Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness. + get "~standard"() { + return hide(this, "~standard", standardProps(this)); + }, + set "~standard"(value) { + own(this, "~standard", value); + } +}); +var toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues }; +function standardProps(inst) { + return { validate: (value) => { try { - const r = safeParse(inst, value); - return r.success ? { value: r.data } : { issues: r.error?.issues }; + return toStandardResult(safeParse(inst, value)); } catch (_) { - return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues }); + return safeParseAsync(inst, value).then(toStandardResult); } }, vendor: "zod", version: 1 - })); -}); + }; +} var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => { $ZodType.init(inst, def); inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag); @@ -13256,58 +13618,80 @@ var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => { def.pattern ?? (def.pattern = email); $ZodStringFormat.init(inst, def); }); +var URL_BAD_FORMAT = 1; +var URL_UNPARSEABLE = 2; +function parseURLObject(trimmed, def) { + if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) { + return URL_BAD_FORMAT; + } + try { + return new URL(trimmed); + } catch { + return URL_UNPARSEABLE; + } +} +var asciiTabOrNewline = /[\t\n\r]/g; +function stripTabAndNewline(value) { + return value.replace(asciiTabOrNewline, ""); +} +function urlHostnameOk(url2, hostname3) { + hostname3.lastIndex = 0; + return hostname3.test(url2.hostname); +} +function urlProtocolOk(url2, protocol) { + protocol.lastIndex = 0; + return protocol.test(url2.protocol.endsWith(":") ? url2.protocol.slice(0, -1) : url2.protocol); +} var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => { $ZodStringFormat.init(inst, def); inst._zod.check = (payload) => { try { const trimmed = payload.value.trim(); - if (!def.normalize && def.protocol?.source === httpProtocol.source) { - if (!/^https?:\/\//i.test(trimmed)) { - payload.issues.push({ - code: "invalid_format", - format: "url", - note: "Invalid URL format", - input: payload.value, - inst, - continue: !def.abort - }); - return; - } + const url2 = parseURLObject(trimmed, def); + if (url2 === URL_BAD_FORMAT) { + payload.issues.push({ + code: "invalid_format", + format: "url", + note: "Invalid URL format", + input: payload.value, + inst, + continue: !def.abort + }); + return; } - const url2 = new URL(trimmed); - if (def.hostname) { - def.hostname.lastIndex = 0; - if (!def.hostname.test(url2.hostname)) { - payload.issues.push({ - code: "invalid_format", - format: "url", - note: "Invalid hostname", - pattern: def.hostname.source, - input: payload.value, - inst, - continue: !def.abort - }); - } + if (url2 === URL_UNPARSEABLE) { + payload.issues.push({ + code: "invalid_format", + format: "url", + input: payload.value, + inst, + continue: !def.abort + }); + return; } - if (def.protocol) { - def.protocol.lastIndex = 0; - if (!def.protocol.test(url2.protocol.endsWith(":") ? url2.protocol.slice(0, -1) : url2.protocol)) { - payload.issues.push({ - code: "invalid_format", - format: "url", - note: "Invalid protocol", - pattern: def.protocol.source, - input: payload.value, - inst, - continue: !def.abort - }); - } + if (def.hostname && !urlHostnameOk(url2, def.hostname)) { + payload.issues.push({ + code: "invalid_format", + format: "url", + note: "Invalid hostname", + pattern: def.hostname.source, + input: payload.value, + inst, + continue: !def.abort + }); } - if (def.normalize) { - payload.value = url2.href; - } else { - payload.value = trimmed; + if (def.protocol && !urlProtocolOk(url2, def.protocol)) { + payload.issues.push({ + code: "invalid_format", + format: "url", + note: "Invalid protocol", + pattern: def.protocol.source, + input: payload.value, + inst, + continue: !def.abort + }); } + payload.value = def.normalize ? url2.href : stripTabAndNewline(trimmed); return; } catch (_) { payload.issues.push({ @@ -13325,7 +13709,9 @@ var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => { $ZodStringFormat.init(inst, def); }); var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => { - def.pattern ?? (def.pattern = nanoid); + if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) + throw new Error(`Invalid nanoid length: ${def.length}`); + def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length)); $ZodStringFormat.init(inst, def); }); var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => { @@ -13351,6 +13737,12 @@ var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => { var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => { def.pattern ?? (def.pattern = datetime(def)); $ZodStringFormat.init(inst, def); + if (def.local || def.precision === -1) { + inst._zod.bag.laxFormat = true; + inst._zod.onattach.push((s) => { + s._zod.bag.laxFormat = true; + }); + } }); var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => { def.pattern ?? (def.pattern = date); @@ -13369,14 +13761,23 @@ var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => { $ZodStringFormat.init(inst, def); inst._zod.bag.format = `ipv4`; }); +var ipv6Alphabet = /^[0-9a-fA-F:.]+$/; +function isValidIPv6(value) { + if (!ipv6Alphabet.test(value)) + return false; + try { + new URL(`http://[${value}]`); + return true; + } catch { + return false; + } +} var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => { def.pattern ?? (def.pattern = ipv6); $ZodStringFormat.init(inst, def); inst._zod.bag.format = `ipv6`; inst._zod.check = (payload) => { - try { - new URL(`http://[${payload.value}]`); - } catch { + if (!isValidIPv6(payload.value)) { payload.issues.push({ code: "invalid_format", format: "ipv6", @@ -13396,24 +13797,25 @@ var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => { def.pattern ?? (def.pattern = cidrv4); $ZodStringFormat.init(inst, def); }); +function isValidCIDRv6(value) { + const parts = value.split("/"); + if (parts.length !== 2) + return false; + const [address, prefix] = parts; + if (!prefix) + return false; + const prefixNum = Number(prefix); + if (`${prefixNum}` !== prefix) + return false; + if (prefixNum < 0 || prefixNum > 128) + return false; + return isValidIPv6(address); +} var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => { def.pattern ?? (def.pattern = cidrv6); $ZodStringFormat.init(inst, def); inst._zod.check = (payload) => { - const parts = payload.value.split("/"); - try { - if (parts.length !== 2) - throw new Error(); - const [address, prefix] = parts; - if (!prefix) - throw new Error(); - const prefixNum = Number(prefix); - if (`${prefixNum}` !== prefix) - throw new Error(); - if (prefixNum < 0 || prefixNum > 128) - throw new Error(); - new URL(`http://[${address}]`); - } catch { + if (!isValidCIDRv6(payload.value)) { payload.issues.push({ code: "invalid_format", format: "cidrv6", @@ -13481,6 +13883,38 @@ var $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => { def.pattern ?? (def.pattern = e164); $ZodStringFormat.init(inst, def); }); +var CC_SANITIZE = /[- ]/g; +function isLuhnAlgo(digits) { + let length = digits.length; + let bit = 1; + let sum = 0; + while (length) { + const value = +digits[--length]; + bit ^= 1; + sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value; + } + return sum % 10 === 0; +} +function isValidCreditCard(input2) { + if (!creditCard.test(input2)) + return false; + return isLuhnAlgo(input2.replace(CC_SANITIZE, "")); +} +var $ZodCreditCard = /* @__PURE__ */ $constructor("$ZodCreditCard", (inst, def) => { + def.pattern ?? (def.pattern = creditCard); + $ZodStringFormat.init(inst, def); + inst._zod.check = (payload) => { + if (isValidCreditCard(payload.value)) + return; + payload.issues.push({ + code: "invalid_format", + format: "credit_card", + input: payload.value, + inst, + continue: !def.abort + }); + }; +}); function isValidJWT2(token, algorithm = null) { try { const tokensParts = token.split("."); @@ -13538,15 +13972,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => { payload.value = Number(payload.value); } catch (_) { } - const input = payload.value; - if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) { + const input2 = payload.value; + if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) { return payload; } - const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0; + const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? String(input2) : void 0 : void 0; payload.issues.push({ expected: "number", code: "invalid_type", - input, + input: input2, inst, ...received ? { received } : {} }); @@ -13566,13 +14000,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => { payload.value = Boolean(payload.value); } catch (_) { } - const input = payload.value; - if (typeof input === "boolean") + const input2 = payload.value; + if (typeof input2 === "boolean") return payload; payload.issues.push({ expected: "boolean", code: "invalid_type", - input, + input: input2, inst }); return payload; @@ -13605,13 +14039,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => { $ZodType.init(inst, def); inst._zod.parse = (payload, _ctx) => { - const input = payload.value; - if (typeof input === "symbol") + const input2 = payload.value; + if (typeof input2 === "symbol") return payload; payload.issues.push({ expected: "symbol", code: "invalid_type", - input, + input: input2, inst }); return payload; @@ -13622,13 +14056,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) => inst._zod.pattern = _undefined; inst._zod.values = /* @__PURE__ */ new Set([void 0]); inst._zod.parse = (payload, _ctx) => { - const input = payload.value; - if (typeof input === "undefined") + const input2 = payload.value; + if (typeof input2 === "undefined") return payload; payload.issues.push({ expected: "undefined", code: "invalid_type", - input, + input: input2, inst }); return payload; @@ -13639,13 +14073,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => { inst._zod.pattern = _null; inst._zod.values = /* @__PURE__ */ new Set([null]); inst._zod.parse = (payload, _ctx) => { - const input = payload.value; - if (input === null) + const input2 = payload.value; + if (input2 === null) return payload; payload.issues.push({ expected: "null", code: "invalid_type", - input, + input: input2, inst }); return payload; @@ -13674,13 +14108,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => { var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => { $ZodType.init(inst, def); inst._zod.parse = (payload, _ctx) => { - const input = payload.value; - if (typeof input === "undefined") + const input2 = payload.value; + if (typeof input2 === "undefined") return payload; payload.issues.push({ expected: "void", code: "invalid_type", - input, + input: input2, inst }); return payload; @@ -13695,15 +14129,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => { } catch (_err) { } } - const input = payload.value; - const isDate = input instanceof Date; - const isValidDate = isDate && !Number.isNaN(input.getTime()); + const input2 = payload.value; + const isDate = input2 instanceof Date; + const isValidDate = isDate && !Number.isNaN(input2.getTime()); if (isValidDate) return payload; payload.issues.push({ expected: "date", code: "invalid_type", - input, + input: input2, ...isDate ? { received: "Invalid Date" } : {}, inst }); @@ -13718,21 +14152,23 @@ function handleArrayResult(result, final, index) { } var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => { $ZodType.init(inst, def); + const memo2 = globalConfig.memoizer; + memo2?.attach(inst); inst._zod.parse = (payload, ctx) => { - const input = payload.value; - if (!Array.isArray(input)) { + const input2 = payload.value; + if (!Array.isArray(input2)) { payload.issues.push({ expected: "array", code: "invalid_type", - input, + input: input2, inst }); return payload; } - payload.value = Array(input.length); + payload.value = memo2 ? memo2.alloc(inst, payload, Array(input2.length), ctx) : Array(input2.length); const proms = []; - for (let i = 0; i < input.length; i++) { - const item = input[i]; + for (let i = 0; i < input2.length; i++) { + const item = input2[i]; const result = def.element._zod.run({ value: item, issues: [] @@ -13749,15 +14185,19 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => { return payload; }; }); -function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) { - const isPresent = key in input; +function handlePropertyResult(result, final, key, input2, optin, optout) { + const isPresent = key in input2; + const isOptionalOut = optout === "optional"; + if (!isPresent && isOptionalOut && optin === "optional") { + return; + } if (result.issues.length) { - if (isOptionalIn && isOptionalOut && !isPresent) { + if (optin !== void 0 && isOptionalOut && !isPresent) { return; } final.issues.push(...prefixIssues(key, result.issues)); } - if (!isPresent && !isOptionalIn) { + if (!isPresent && optin === void 0) { if (!result.issues.length) { final.issues.push({ code: "invalid_type", @@ -13776,51 +14216,62 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona final.value[key] = result.value; } } +var NO_SYMBOL_KEYS = []; function normalizeDef(def) { const keys = Object.keys(def.shape); - for (const k of keys) { + const ownSymbols = Object.getOwnPropertySymbols(def.shape); + const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS; + const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys; + for (const k of allKeys) { if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) { - throw new Error(`Invalid element at key "${k}": expected a Zod schema`); + throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`); } } const okeys = optionalKeys(def.shape); return { ...def, - keys, + allKeys, + symbolKeys, + // string-only: handleCatchall matches it against `for...in`, which never yields a symbol keySet: new Set(keys), numKeys: keys.length, optionalKeys: new Set(okeys) }; } -function handleCatchall(proms, input, payload, ctx, def, inst) { +function handleCatchall(proms, input2, payload, ctx, def, inst) { const unrecognized = []; const keySet = def.keySet; const _catchall = def.catchall._zod; const t = _catchall.def.type; - const isOptionalIn = _catchall.optin === "optional"; - const isOptionalOut = _catchall.optout === "optional"; - for (const key in input) { - if (key === "__proto__") - continue; + const optin = _catchall.optin; + const optout = _catchall.optout; + for (const key in input2) { if (keySet.has(key)) continue; + if (key === "__proto__") { + if (t === "never") + unrecognized.push(key); + continue; + } if (t === "never") { unrecognized.push(key); continue; } - const r = _catchall.run({ value: input[key], issues: [] }, ctx); + const r = _catchall.run({ value: input2[key], issues: [] }, ctx); if (r instanceof Promise) { - proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut))); + proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, optin, optout))); } else { - handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut); + handlePropertyResult(r, payload, key, input2, optin, optout); } } if (unrecognized.length) { payload.issues.push({ code: "unrecognized_keys", keys: unrecognized, - input, - inst + input: input2, + inst, + // Describes the shape of the input, not the validity of the parsed value, so it never aborts. The parse still fails; the schema's own checks just get to run first, and an enclosing intersection can reconcile the key against a sibling operand. + continue: true }); } if (!proms.length) @@ -13829,31 +14280,38 @@ function handleCatchall(proms, input, payload, ctx, def, inst) { return payload; }); } +var propShapes = /* @__PURE__ */ new WeakMap(); var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => { $ZodType.init(inst, def); const desc = Object.getOwnPropertyDescriptor(def, "shape"); if (!desc?.get) { const sh = def.shape; + propShapes.set(def, sh); Object.defineProperty(def, "shape", { get: () => { const newSh = { ...sh }; Object.defineProperty(def, "shape", { value: newSh }); + propShapes.set(def, newSh); return newSh; } }); } const _normalized = cached(() => normalizeDef(def)); - defineLazy(inst._zod, "propValues", () => { - const shape = def.shape; + defineLazyInternal(inst, "propValues", (zod) => { + const shape = zod.def.shape; const propValues = {}; for (const key in shape) { const field = shape[key]._zod; if (field.values) { - propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set()); + if (!Object.prototype.hasOwnProperty.call(propValues, key)) { + assignProp(propValues, key, /* @__PURE__ */ new Set()); + } for (const v of field.values) propValues[key].add(v); + if (field.optin !== void 0) + propValues[key].add(void 0); } } return propValues; @@ -13861,91 +14319,94 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => { const isObject2 = isObject; const catchall = def.catchall; let value; + const memo2 = globalConfig.memoizer; + memo2?.attach(inst); inst._zod.parse = (payload, ctx) => { value ?? (value = _normalized.value); - const input = payload.value; - if (!isObject2(input)) { + const input2 = payload.value; + if (!isObject2(input2)) { payload.issues.push({ expected: "object", code: "invalid_type", - input, + input: input2, inst }); return payload; } - payload.value = {}; + payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {}; const proms = []; const shape = value.shape; - for (const key of value.keys) { + for (const key of value.allKeys) { + if (key === "__proto__") + continue; const el = shape[key]; - const isOptionalIn = el._zod.optin === "optional"; - const isOptionalOut = el._zod.optout === "optional"; - const r = el._zod.run({ value: input[key], issues: [] }, ctx); + const optin = el._zod.optin; + const optout = el._zod.optout; + const r = el._zod.run({ value: input2[key], issues: [] }, ctx); if (r instanceof Promise) { - proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut))); + proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, optin, optout))); } else { - handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut); + handlePropertyResult(r, payload, key, input2, optin, optout); } } if (!catchall) { return proms.length ? Promise.all(proms).then(() => payload) : payload; } - return handleCatchall(proms, input, payload, ctx, _normalized.value, inst); + return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst); }; }); var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => { $ZodObject.init(inst, def); const superParse = inst._zod.parse; const _normalized = cached(() => normalizeDef(def)); + const memo2 = globalConfig.memoizer; const generateFastpass = (shape) => { - const doc = new Doc(["shape", "payload", "ctx"]); const normalized = _normalized.value; - const parseStr = (key) => { - const k = esc(key); - return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`; - }; + const syms = normalized.symbolKeys; + const doc = new Doc(["payload", "ctx"], { shape, inst, memo: memo2, syms }); + const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`; + const prefixStr = (id, k) => ` + for (let i = 0; i < ${id}.issues.length; i++) { + const iss = ${id}.issues[i]; + iss.path = iss.path ? [${k}, ...iss.path] : [${k}]; + payload.issues.push(iss); + }`; doc.write(`const input = payload.value;`); const ids = /* @__PURE__ */ Object.create(null); let counter = 0; - for (const key of normalized.keys) { + for (const key of normalized.allKeys) { ids[key] = `key_${counter++}`; } - doc.write(`const newResult = {};`); - for (const key of normalized.keys) { + doc.write(memo2 ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`); + for (const key of normalized.allKeys) { + if (key === "__proto__") + continue; const id = ids[key]; - const k = esc(key); + const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key); + const isPresent = `${k} in input`; const schema = shape[key]; - const isOptionalIn = schema?._zod?.optin === "optional"; + const optin = schema?._zod?.optin; + const isOptionalIn = optin !== void 0; const isOptionalOut = schema?._zod?.optout === "optional"; - doc.write(`const ${id} = ${parseStr(key)};`); + doc.write(`const ${id} = ${parseStr(k)};`); if (isOptionalIn && isOptionalOut) { + const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`; doc.write(` - if (${id}.issues.length) { - if (${k} in input) { - payload.issues = payload.issues.concat(${id}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${k}, ...iss.path] : [${k}] - }))); + const ${id}_present = ${isPresent}; + if (!${id}.issues.length || ${id}_present) { + if (${id}.issues.length) {${prefixStr(id, k)} } - } - - if (${id}.value === undefined) { - if (${k} in input) { - newResult[${k}] = undefined; + + if (${assign}) { + newResult[${k}] = ${id}.value; } - } else { - newResult[${k}] = ${id}.value; } - + `); } else if (!isOptionalIn) { doc.write(` - const ${id}_present = ${k} in input; - if (${id}.issues.length) { - payload.issues = payload.issues.concat(${id}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${k}, ...iss.path] : [${k}] - }))); + const ${id}_present = ${isPresent}; + if (${id}.issues.length) {${prefixStr(id, k)} } if (!${id}_present && !${id}.issues.length) { payload.issues.push({ @@ -13957,38 +14418,29 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => } if (${id}_present) { - if (${id}.value === undefined) { - newResult[${k}] = undefined; - } else { - newResult[${k}] = ${id}.value; - } + newResult[${k}] = ${id}.value; } `); } else { doc.write(` - if (${id}.issues.length) { - payload.issues = payload.issues.concat(${id}.issues.map(iss => ({ - ...iss, - path: iss.path ? [${k}, ...iss.path] : [${k}] - }))); + if (${id}.issues.length) {${prefixStr(id, k)} } if (${id}.value === undefined) { - if (${k} in input) { + if (${isPresent}) { newResult[${k}] = undefined; } } else { newResult[${k}] = ${id}.value; } - + `); } } doc.write(`payload.value = newResult;`); doc.write(`return payload;`); - const fn = doc.compile(); - return (payload, ctx) => fn(shape, payload, ctx); + return doc.compile(); }; let fastpass; const isObject2 = isObject; @@ -13999,12 +14451,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => let value; inst._zod.parse = (payload, ctx) => { value ?? (value = _normalized.value); - const input = payload.value; - if (!isObject2(input)) { + const input2 = payload.value; + if (!isObject2(input2)) { payload.issues.push({ expected: "object", code: "invalid_type", - input, + input: input2, inst }); return payload; @@ -14015,7 +14467,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => payload = fastpass(payload, ctx); if (!catchall) return payload; - return handleCatchall([], input, payload, ctx, value, inst); + return handleCatchall([], input2, payload, ctx, value, inst); } return superParse(payload, ctx); }; @@ -14042,17 +14494,17 @@ function handleUnionResults(results, final, inst, ctx) { } var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => { $ZodType.init(inst, def); - defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0); - defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0); - defineLazy(inst._zod, "values", () => { - if (def.options.every((o) => o._zod.values)) { - return new Set(def.options.flatMap((option) => Array.from(option._zod.values))); + defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted") ? "defaulted" : zod.def.options.some((o) => o._zod.optin !== void 0) ? "optional" : void 0); + defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0); + defineLazyInternal(inst, "values", (zod) => { + if (zod.def.options.every((o) => o._zod.values)) { + return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values))); } return void 0; }); - defineLazy(inst._zod, "pattern", () => { - if (def.options.every((o) => o._zod.pattern)) { - const patterns = def.options.map((o) => o._zod.pattern); + defineLazyInternal(inst, "pattern", (zod) => { + if (zod.def.options.every((o) => o._zod.pattern)) { + const patterns = zod.def.options.map((o) => o._zod.pattern); return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`); } return void 0; @@ -14086,12 +14538,16 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => { }; }); function handleExclusiveUnionResults(results, final, inst, ctx) { - const successes = results.filter((r) => r.issues.length === 0); - if (successes.length === 1) { - final.value = successes[0].value; + const matches = []; + for (let i = 0; i < results.length; i++) { + if (results[i].issues.length === 0) + matches.push(i); + } + if (matches.length === 1) { + final.value = results[matches[0]].value; return final; } - if (successes.length === 0) { + if (matches.length === 0) { final.issues.push({ code: "invalid_union", input: final.value, @@ -14104,7 +14560,8 @@ function handleExclusiveUnionResults(results, final, inst, ctx) { input: final.value, inst, errors: [], - inclusive: false + inclusive: false, + matches }); } return final; @@ -14138,19 +14595,35 @@ var $ZodXor = /* @__PURE__ */ $constructor("$ZodXor", (inst, def) => { }); }; }); +function getDiscriminatedOption(union2, value) { + const internals = union2._zod; + let map2 = internals.bag.optionsMap; + if (!map2) { + map2 = /* @__PURE__ */ new Map(); + const { options, discriminator } = internals.def; + for (const option of options) { + for (const v of option._zod.propValues?.[discriminator] ?? []) + if (!map2.has(v)) + map2.set(v, option); + } + internals.bag.optionsMap = map2; + } + return map2.get(value); +} var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => { def.inclusive = false; $ZodUnion.init(inst, def); const _super = inst._zod.parse; - defineLazy(inst._zod, "propValues", () => { + defineLazyInternal(inst, "propValues", (zod) => { const propValues = {}; - for (const option of def.options) { + for (const option of zod.def.options) { const pv = option._zod.propValues; if (!pv || Object.keys(pv).length === 0) - throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`); + throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`); for (const [k, v] of Object.entries(pv)) { - if (!propValues[k]) - propValues[k] = /* @__PURE__ */ new Set(); + if (!Object.prototype.hasOwnProperty.call(propValues, k)) { + assignProp(propValues, k, /* @__PURE__ */ new Set()); + } for (const val of v) { propValues[k].add(val); } @@ -14158,6 +14631,12 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio } return propValues; }); + def.options.forEach((option, i) => { + const propShape = propShapes.get(option._zod.def); + if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) { + throw new Error(`Invalid discriminated union option at index "${i}"`); + } + }); const disc = cached(() => { const opts = def.options; const map2 = /* @__PURE__ */ new Map(); @@ -14175,17 +14654,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio return map2; }); inst._zod.parse = (payload, ctx) => { - const input = payload.value; - if (!isObject(input)) { + const input2 = payload.value; + if (!isObject(input2)) { payload.issues.push({ code: "invalid_type", expected: "object", - input, + input: input2, inst }); return payload; } - const opt = disc.value.get(input?.[def.discriminator]); + const opt = disc.value.get(input2?.[def.discriminator]); if (opt) { return opt._zod.run(payload, ctx); } @@ -14198,7 +14677,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio note: "No matching discriminator", discriminator: def.discriminator, options: Array.from(disc.value.keys()), - input, + input: input2, path: [def.discriminator], inst }); @@ -14208,9 +14687,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => { $ZodType.init(inst, def); inst._zod.parse = (payload, ctx) => { - const input = payload.value; - const left = def.left._zod.run({ value: input, issues: [] }, ctx); - const right = def.right._zod.run({ value: input, issues: [] }, ctx); + const input2 = payload.value; + const left = def.left._zod.run({ value: input2, issues: [] }, ctx); + const right = def.right._zod.run({ value: input2, issues: [] }, ctx); const async = left instanceof Promise || right instanceof Promise; if (async) { return Promise.all([left, right]).then(([left2, right2]) => { @@ -14231,7 +14710,11 @@ function mergeValues2(a, b) { const bKeys = Object.keys(b); const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1); const newObj = { ...a, ...b }; + if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) + delete newObj.__proto__; for (const key of sharedKeys) { + if (key === "__proto__") + continue; const sharedValue = mergeValues2(a[key], b[key]); if (!sharedValue.valid) { return { @@ -14267,37 +14750,49 @@ function mergeValues2(a, b) { function handleIntersectionResults(result, left, right) { const unrecKeys = /* @__PURE__ */ new Map(); let unrecIssue; - for (const iss of left.issues) { - if (iss.code === "unrecognized_keys") { + const keyIssues = /* @__PURE__ */ new Map(); + const collect = (iss, side) => { + let keys; + if (iss.code === "unrecognized_keys" && !iss.path?.length) { unrecIssue ?? (unrecIssue = iss); - for (const k of iss.keys) { - if (!unrecKeys.has(k)) - unrecKeys.set(k, {}); - unrecKeys.get(k).l = true; - } + keys = iss.keys; + } else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) { + const k = String(iss.path[0]); + if (!keyIssues.has(k)) + keyIssues.set(k, iss); + keys = [k]; } else { - result.issues.push(iss); + return false; + } + for (const k of keys) { + if (!unrecKeys.has(k)) + unrecKeys.set(k, {}); + unrecKeys.get(k)[side] = true; } + return true; + }; + for (const iss of left.issues) { + if (!collect(iss, "l")) + result.issues.push(iss); } for (const iss of right.issues) { - if (iss.code === "unrecognized_keys") { - for (const k of iss.keys) { - if (!unrecKeys.has(k)) - unrecKeys.set(k, {}); - unrecKeys.get(k).r = true; - } - } else { + if (!collect(iss, "r")) result.issues.push(iss); - } } const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k); - if (bothKeys.length && unrecIssue) { - result.issues.push({ ...unrecIssue, keys: bothKeys }); + if (bothKeys.length) { + const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : []; + if (aggregated.length) + result.issues.push({ ...unrecIssue, keys: aggregated }); + for (const k of bothKeys) { + if (!aggregated.includes(k) && keyIssues.has(k)) + result.issues.push(keyIssues.get(k)); + } } - if (aborted(result)) - return result; const merged = mergeValues2(left.value, right.value); if (!merged.valid) { + if (aborted(result)) + return result; throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`); } result.value = merged.data; @@ -14306,39 +14801,41 @@ function handleIntersectionResults(result, left, right) { var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => { $ZodType.init(inst, def); const items = def.items; + const memo2 = globalConfig.memoizer; + memo2?.attach(inst); inst._zod.parse = (payload, ctx) => { - const input = payload.value; - if (!Array.isArray(input)) { + const input2 = payload.value; + if (!Array.isArray(input2)) { payload.issues.push({ - input, + input: input2, inst, expected: "tuple", code: "invalid_type" }); return payload; } - payload.value = []; + payload.value = memo2 ? memo2.alloc(inst, payload, [], ctx) : []; const proms = []; const optinStart = getTupleOptStart(items, "optin"); const optoutStart = getTupleOptStart(items, "optout"); if (!def.rest) { - if (input.length < optinStart) { + if (input2.length < optinStart) { payload.issues.push({ code: "too_small", minimum: optinStart, inclusive: true, - input, + input: input2, inst, origin: "array" }); return payload; } - if (input.length > items.length) { + if (input2.length > items.length) { payload.issues.push({ code: "too_big", maximum: items.length, inclusive: true, - input, + input: input2, inst, origin: "array" }); @@ -14346,7 +14843,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => { } const itemResults = new Array(items.length); for (let i = 0; i < items.length; i++) { - const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx); + const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx); if (r instanceof Promise) { proms.push(r.then((rr) => { itemResults[i] = rr; @@ -14357,7 +14854,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => { } if (def.rest) { let i = items.length - 1; - const rest = input.slice(items.length); + const rest = input2.slice(items.length); for (const el of rest) { i++; const result = def.rest._zod.run({ value: el, issues: [] }, ctx); @@ -14369,14 +14866,15 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => { } } if (proms.length) { - return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart)); + return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input2, optoutStart)); } - return handleTupleResults(itemResults, payload, items, input, optoutStart); + return handleTupleResults(itemResults, payload, items, input2, optoutStart); }; }); function getTupleOptStart(items, key) { for (let i = items.length - 1; i >= 0; i--) { - if (items[i]._zod[key] !== "optional") + const omittable = key === "optin" ? items[i]._zod.optin !== void 0 : items[i]._zod.optout === "optional"; + if (!omittable) return i + 1; } return 0; @@ -14387,10 +14885,14 @@ function handleTupleResult(result, final, index) { } final.value[index] = result.value; } -function handleTupleResults(itemResults, final, items, input, optoutStart) { +function handleTupleResults(itemResults, final, items, input2, optoutStart) { for (let i = 0; i < items.length; i++) { const r = itemResults[i]; - const isPresent = i < input.length; + const isPresent = i < input2.length; + if (!isPresent && i >= optoutStart && items[i]._zod.optin === "optional") { + final.value.length = i; + break; + } if (r.issues.length) { if (!isPresent && i >= optoutStart) { final.value.length = i; @@ -14400,7 +14902,7 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) { } final.value[i] = r.value; } - for (let i = final.value.length - 1; i >= input.length; i--) { + for (let i = final.value.length - 1; i >= input2.length; i--) { if (items[i]._zod.optout === "optional" && final.value[i] === void 0) { final.value.length = i; } else { @@ -14411,25 +14913,29 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) { } var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => { $ZodType.init(inst, def); + const memo2 = globalConfig.memoizer; + memo2?.attach(inst); inst._zod.parse = (payload, ctx) => { - const input = payload.value; - if (!isPlainObject(input)) { + const input2 = payload.value; + if (!isPlainObject(input2)) { payload.issues.push({ expected: "record", code: "invalid_type", - input, + input: input2, inst }); return payload; } const proms = []; const values = def.keyType._zod.values; - if (values) { - payload.value = {}; + if (values && !def.partial) { + payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {}; const recordKeys = /* @__PURE__ */ new Set(); for (const key of values) { if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") { recordKeys.add(typeof key === "number" ? key.toString() : key); + if (key === "__proto__") + continue; const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx); if (keyResult instanceof Promise) { throw new Error("Async schemas not supported in object keys currently"); @@ -14446,7 +14952,9 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => { continue; } const outKey = keyResult.value; - const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx); + if (outKey === "__proto__") + continue; + const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx); if (result instanceof Promise) { proms.push(result.then((result2) => { if (result2.issues.length) { @@ -14463,26 +14971,34 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => { } } let unrecognized; - for (const key in input) { + for (const key in input2) { if (!recordKeys.has(key)) { - unrecognized = unrecognized ?? []; - unrecognized.push(key); + if (def.mode === "loose") { + if (key === "__proto__") + continue; + payload.value[key] = input2[key]; + } else { + unrecognized = unrecognized ?? []; + unrecognized.push(key); + } } } if (unrecognized && unrecognized.length > 0) { payload.issues.push({ code: "unrecognized_keys", - input, + input: input2, inst, - keys: unrecognized + keys: unrecognized, + continue: true }); } } else { - payload.value = {}; - for (const key of Reflect.ownKeys(input)) { + payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {}; + let unrecognized; + for (const key of Reflect.ownKeys(input2)) { if (key === "__proto__") continue; - if (!Object.prototype.propertyIsEnumerable.call(input, key)) + if (!Object.prototype.propertyIsEnumerable.call(input2, key)) continue; let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx); if (keyResult instanceof Promise) { @@ -14500,7 +15016,10 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => { } if (keyResult.issues.length) { if (def.mode === "loose") { - payload.value[key] = input[key]; + payload.value[key] = input2[key]; + } else if (values) { + unrecognized = unrecognized ?? []; + unrecognized.push(key); } else { payload.issues.push({ code: "invalid_key", @@ -14513,21 +15032,33 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => { } continue; } - const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx); + const outKey = keyResult.value; + if (outKey === "__proto__") + continue; + const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx); if (result instanceof Promise) { proms.push(result.then((result2) => { if (result2.issues.length) { payload.issues.push(...prefixIssues(key, result2.issues)); } - payload.value[keyResult.value] = result2.value; + payload.value[outKey] = result2.value; })); } else { if (result.issues.length) { payload.issues.push(...prefixIssues(key, result.issues)); } - payload.value[keyResult.value] = result.value; + payload.value[outKey] = result.value; } } + if (unrecognized && unrecognized.length > 0) { + payload.issues.push({ + code: "unrecognized_keys", + input: input2, + inst, + keys: unrecognized, + continue: true + }); + } } if (proms.length) { return Promise.all(proms).then(() => payload); @@ -14537,28 +15068,30 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => { }); var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => { $ZodType.init(inst, def); + const memo2 = globalConfig.memoizer; + memo2?.attach(inst); inst._zod.parse = (payload, ctx) => { - const input = payload.value; - if (!(input instanceof Map)) { + const input2 = payload.value; + if (!(input2 instanceof Map)) { payload.issues.push({ expected: "map", code: "invalid_type", - input, + input: input2, inst }); return payload; } const proms = []; - payload.value = /* @__PURE__ */ new Map(); - for (const [key, value] of input) { + payload.value = memo2 ? memo2.alloc(inst, payload, /* @__PURE__ */ new Map(), ctx) : /* @__PURE__ */ new Map(); + for (const [key, value] of input2) { const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx); const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx); if (keyResult instanceof Promise || valueResult instanceof Promise) { proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => { - handleMapResult(keyResult2, valueResult2, payload, key, input, inst, ctx); + handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx); })); } else { - handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx); + handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx); } } if (proms.length) @@ -14566,7 +15099,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => { return payload; }; }); -function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) { +function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) { if (keyResult.issues.length) { if (propertyKeyTypes.has(typeof key)) { final.issues.push(...prefixIssues(key, keyResult.issues)); @@ -14574,7 +15107,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) { final.issues.push({ code: "invalid_key", origin: "map", - input, + input: input2, inst, issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())) }); @@ -14587,7 +15120,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) { final.issues.push({ origin: "map", code: "invalid_element", - input, + input: input2, inst, key, issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config())) @@ -14598,11 +15131,13 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) { } var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => { $ZodType.init(inst, def); + const memo2 = globalConfig.memoizer; + memo2?.attach(inst); inst._zod.parse = (payload, ctx) => { - const input = payload.value; - if (!(input instanceof Set)) { + const input2 = payload.value; + if (!(input2 instanceof Set)) { payload.issues.push({ - input, + input: input2, inst, expected: "set", code: "invalid_type" @@ -14610,8 +15145,8 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => { return payload; } const proms = []; - payload.value = /* @__PURE__ */ new Set(); - for (const item of input) { + payload.value = memo2 ? memo2.alloc(inst, payload, /* @__PURE__ */ new Set(), ctx) : /* @__PURE__ */ new Set(); + for (const item of input2) { const result = def.valueType._zod.run({ value: item, issues: [] }, ctx); if (result instanceof Promise) { proms.push(result.then((result2) => handleSetResult(result2, payload))); @@ -14634,16 +15169,17 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => { const values = getEnumValues(def.entries); const valuesSet = new Set(values); inst._zod.values = valuesSet; - inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`); + const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k)); + inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$"); inst._zod.parse = (payload, _ctx) => { - const input = payload.value; - if (valuesSet.has(input)) { + const input2 = payload.value; + if (valuesSet.has(input2)) { return payload; } payload.issues.push({ code: "invalid_value", values, - input, + input: input2, inst }); return payload; @@ -14651,21 +15187,18 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => { }); var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => { $ZodType.init(inst, def); - if (def.values.length === 0) { - throw new Error("Cannot create literal schema with no valid values"); - } const values = new Set(def.values); inst._zod.values = values; - inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`); + inst._zod.pattern = new RegExp(def.values.length ? `^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$"); inst._zod.parse = (payload, _ctx) => { - const input = payload.value; - if (values.has(input)) { + const input2 = payload.value; + if (values.has(input2)) { return payload; } payload.issues.push({ code: "invalid_value", values: def.values, - input, + input: input2, inst }); return payload; @@ -14674,13 +15207,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => { var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => { $ZodType.init(inst, def); inst._zod.parse = (payload, _ctx) => { - const input = payload.value; - if (input instanceof File) + const input2 = payload.value; + if (input2 instanceof File) return payload; payload.issues.push({ expected: "file", code: "invalid_type", - input, + input: input2, inst }); return payload; @@ -14689,16 +15222,16 @@ var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => { var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => { $ZodType.init(inst, def); inst._zod.optin = "optional"; + globalConfig.memoizer?.guard(inst); inst._zod.parse = (payload, ctx) => { if (ctx.direction === "backward") { throw new $ZodEncodeError(inst.constructor.name); } const _out = def.transform(payload.value, payload); if (ctx.async) { - const output = _out instanceof Promise ? _out : Promise.resolve(_out); - return output.then((output2) => { - payload.value = output2; - payload.fallback = true; + const output2 = _out instanceof Promise ? _out : Promise.resolve(_out); + return output2.then((output3) => { + payload.value = output3; return payload; }); } @@ -14706,59 +15239,55 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => throw new $ZodAsyncError(); } payload.value = _out; - payload.fallback = true; return payload; }; }); -function handleOptionalResult(result, input) { - if (input === void 0 && (result.issues.length || result.fallback)) { - return { issues: [], value: void 0 }; - } - return result; +function handleOptionalResult(payload, result) { + payload.value = result.issues.length ? void 0 : result.value; + return payload; } var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => { $ZodType.init(inst, def); - inst._zod.optin = "optional"; + defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional"); inst._zod.optout = "optional"; - defineLazy(inst._zod, "values", () => { - return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0; + defineLazyInternal(inst, "values", (zod) => { + const values = zod.def.innerType._zod.values; + return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0; }); - defineLazy(inst._zod, "pattern", () => { - const pattern = def.innerType._zod.pattern; + defineLazyInternal(inst, "pattern", (zod) => { + const pattern = zod.def.innerType._zod.pattern; return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0; }); inst._zod.parse = (payload, ctx) => { - if (def.innerType._zod.optin === "optional") { - const input = payload.value; - const result = def.innerType._zod.run(payload, ctx); - if (result instanceof Promise) - return result.then((r) => handleOptionalResult(r, input)); - return handleOptionalResult(result, input); - } if (payload.value === void 0) { - return payload; + if (def.innerType._zod.optin !== "defaulted") + return payload; + const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx); + if (result instanceof Promise) + return result.then((result2) => handleOptionalResult(payload, result2)); + return handleOptionalResult(payload, result); } return def.innerType._zod.run(payload, ctx); }; }); var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => { $ZodOptional.init(inst, def); - defineLazy(inst._zod, "values", () => def.innerType._zod.values); - defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern); + defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); + defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern); inst._zod.parse = (payload, ctx) => { return def.innerType._zod.run(payload, ctx); }; }); var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => { $ZodType.init(inst, def); - defineLazy(inst._zod, "optin", () => def.innerType._zod.optin); - defineLazy(inst._zod, "optout", () => def.innerType._zod.optout); - defineLazy(inst._zod, "pattern", () => { - const pattern = def.innerType._zod.pattern; + defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin); + defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout); + defineLazyInternal(inst, "pattern", (zod) => { + const pattern = zod.def.innerType._zod.pattern; return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0; }); - defineLazy(inst._zod, "values", () => { - return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0; + defineLazyInternal(inst, "values", (zod) => { + return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0; }); inst._zod.parse = (payload, ctx) => { if (payload.value === null) @@ -14768,8 +15297,8 @@ var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => { }); var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => { $ZodType.init(inst, def); - inst._zod.optin = "optional"; - defineLazy(inst._zod, "values", () => def.innerType._zod.values); + inst._zod.optin = "defaulted"; + defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); inst._zod.parse = (payload, ctx) => { if (ctx.direction === "backward") { return def.innerType._zod.run(payload, ctx); @@ -14793,8 +15322,8 @@ function handleDefaultResult(payload, def) { } var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => { $ZodType.init(inst, def); - inst._zod.optin = "optional"; - defineLazy(inst._zod, "values", () => def.innerType._zod.values); + inst._zod.optin = "defaulted"; + defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); inst._zod.parse = (payload, ctx) => { if (ctx.direction === "backward") { return def.innerType._zod.run(payload, ctx); @@ -14807,8 +15336,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => { }); var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => { $ZodType.init(inst, def); - defineLazy(inst._zod, "values", () => { - const v = def.innerType._zod.values; + defineLazyInternal(inst, "values", (zod) => { + const v = zod.def.innerType._zod.values; return v ? new Set([...v].filter((x) => x !== void 0)) : void 0; }); inst._zod.parse = (payload, ctx) => { @@ -14847,46 +15376,37 @@ var $ZodSuccess = /* @__PURE__ */ $constructor("$ZodSuccess", (inst, def) => { return payload; }; }); +function handleCatchResult(payload, result, def, ctx) { + if (!result.issues.length) { + payload.value = result.value; + if (result.memo) + payload.memo = true; + return payload; + } + payload.value = def.catchValue({ + ...result, + value: payload.value, + error: { + issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) + }, + input: payload.value + }); + return payload; +} var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => { $ZodType.init(inst, def); - inst._zod.optin = "optional"; - defineLazy(inst._zod, "optout", () => def.innerType._zod.optout); - defineLazy(inst._zod, "values", () => def.innerType._zod.values); + defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional"); + defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout); + defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); inst._zod.parse = (payload, ctx) => { if (ctx.direction === "backward") { return def.innerType._zod.run(payload, ctx); } - const result = def.innerType._zod.run(payload, ctx); + const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx); if (result instanceof Promise) { - return result.then((result2) => { - payload.value = result2.value; - if (result2.issues.length) { - payload.value = def.catchValue({ - ...payload, - error: { - issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config())) - }, - input: payload.value - }); - payload.issues = []; - payload.fallback = true; - } - return payload; - }); - } - payload.value = result.value; - if (result.issues.length) { - payload.value = def.catchValue({ - ...payload, - error: { - issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) - }, - input: payload.value - }); - payload.issues = []; - payload.fallback = true; + return result.then((result2) => handleCatchResult(payload, result2, def, ctx)); } - return payload; + return handleCatchResult(payload, result, def, ctx); }; }); var $ZodNaN = /* @__PURE__ */ $constructor("$ZodNaN", (inst, def) => { @@ -14906,10 +15426,10 @@ var $ZodNaN = /* @__PURE__ */ $constructor("$ZodNaN", (inst, def) => { }); var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => { $ZodType.init(inst, def); - defineLazy(inst._zod, "values", () => def.in._zod.values); - defineLazy(inst._zod, "optin", () => def.in._zod.optin); - defineLazy(inst._zod, "optout", () => def.out._zod.optout); - defineLazy(inst._zod, "propValues", () => def.in._zod.propValues); + defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values); + defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin); + defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout); + defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues); inst._zod.parse = (payload, ctx) => { if (ctx.direction === "backward") { const right = def.out._zod.run(payload, ctx); @@ -14926,18 +15446,18 @@ var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => { }; }); function handlePipeResult(left, next, ctx) { - if (left.issues.length) { + if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) { left.aborted = true; return left; } - return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx); + return next._zod.run({ value: left.value, issues: left.issues }, ctx); } var $ZodCodec = /* @__PURE__ */ $constructor("$ZodCodec", (inst, def) => { $ZodType.init(inst, def); - defineLazy(inst._zod, "values", () => def.in._zod.values); - defineLazy(inst._zod, "optin", () => def.in._zod.optin); - defineLazy(inst._zod, "optout", () => def.out._zod.optout); - defineLazy(inst._zod, "propValues", () => def.in._zod.propValues); + defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values); + defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin); + defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout); + defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues); inst._zod.parse = (payload, ctx) => { const direction = ctx.direction || "forward"; if (direction === "forward") { @@ -14987,10 +15507,10 @@ var $ZodPreprocess = /* @__PURE__ */ $constructor("$ZodPreprocess", (inst, def) }); var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => { $ZodType.init(inst, def); - defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues); - defineLazy(inst._zod, "values", () => def.innerType._zod.values); - defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin); - defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout); + defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues); + defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); + defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin); + defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout); inst._zod.parse = (payload, ctx) => { if (ctx.direction === "backward") { return def.innerType._zod.run(payload, ctx); @@ -15003,7 +15523,8 @@ var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => { }; }); function handleReadonlyResult(payload) { - payload.value = Object.freeze(payload.value); + if (!payload.memo) + payload.value = Object.freeze(payload.value); return payload; } var $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (inst, def) => { @@ -15053,33 +15574,33 @@ var $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (i }); var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => { $ZodType.init(inst, def); - inst._def = def; + Object.defineProperty(inst, "_def", { value: def }); inst._zod.def = def; inst.implement = (func) => { if (typeof func !== "function") { throw new Error("implement() must be called with a function"); } - return function(...args) { + return Object.defineProperty(function(...args) { const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args; const result = Reflect.apply(func, this, parsedArgs); if (inst._def.output) { return parse(inst._def.output, result); } return result; - }; + }, "_zod", { value: inst._zod, enumerable: false }); }; inst.implementAsync = (func) => { if (typeof func !== "function") { throw new Error("implementAsync() must be called with a function"); } - return async function(...args) { + return Object.defineProperty(async function(...args) { const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args; const result = await Reflect.apply(func, this, parsedArgs); if (inst._def.output) { return await parseAsync(inst._def.output, result); } return result; - }; + }, "_zod", { value: inst._zod, enumerable: false }); }; inst._zod.parse = (payload, _ctx) => { if (typeof payload.value !== "function") { @@ -15118,12 +15639,12 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => { output: inst._def.output }); }; - inst.output = (output) => { + inst.output = (output2) => { const F = inst.constructor; return new F({ type: "function", input: inst._def.input, - output + output: output2 }); }; return inst; @@ -15142,10 +15663,10 @@ var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => { d._cachedInner = def.getter(); return d._cachedInner; }); - defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern); - defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues); - defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? void 0); - defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? void 0); + defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern); + defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues); + defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? void 0); + defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? void 0); inst._zod.parse = (payload, ctx) => { const inner = inst._zod.innerType; return inner._zod.run(payload, ctx); @@ -15158,20 +15679,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => { return payload; }; inst._zod.check = (payload) => { - const input = payload.value; - const r = def.fn(input); + const input2 = payload.value; + const r = def.fn(input2); if (r instanceof Promise) { - return r.then((r2) => handleRefineResult(r2, payload, input, inst)); + return r.then((r2) => handleRefineResult(r2, payload, input2, inst)); } - handleRefineResult(r, payload, input, inst); + handleRefineResult(r, payload, input2, inst); return; }; }); -function handleRefineResult(result, payload, input, inst) { +function handleRefineResult(result, payload, input2, inst) { if (!result) { const _iss = { code: "custom", - input, + input: input2, inst, // incorporates params.error into issue reporting path: [...inst._zod.def.path ?? []], @@ -15185,52 +15706,303 @@ function handleRefineResult(result, payload, input, inst) { } } -// node_modules/zod/v4/locales/index.js -var locales_exports = {}; -__export(locales_exports, { - ar: () => ar_default, - az: () => az_default, - be: () => be_default, - bg: () => bg_default, - ca: () => ca_default, - cs: () => cs_default, - da: () => da_default, - de: () => de_default, - el: () => el_default, - en: () => en_default2, - eo: () => eo_default, - es: () => es_default, - fa: () => fa_default, - fi: () => fi_default, - fr: () => fr_default, - frCA: () => fr_CA_default, - he: () => he_default, - hr: () => hr_default, - hu: () => hu_default, - hy: () => hy_default, - id: () => id_default, - is: () => is_default, - it: () => it_default, - ja: () => ja_default, - ka: () => ka_default, - kh: () => kh_default, - km: () => km_default, - ko: () => ko_default, - lt: () => lt_default, - mk: () => mk_default, - ms: () => ms_default, - nl: () => nl_default, - no: () => no_default, - ota: () => ota_default, - pl: () => pl_default, - ps: () => ps_default, - pt: () => pt_default, - ro: () => ro_default, - ru: () => ru_default, - sl: () => sl_default, - sv: () => sv_default, +// node_modules/zod/v4/core/memoizer.js +var $ZodCyclicError = class extends Error { + constructor() { + super(`Cannot parse a reference cycle that closes through a transform`); + this.name = "ZodCyclicError"; + } +}; +var STATE = "~memo"; +var NO_ISSUES = []; +function cloneIssues(issues) { + return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss }); +} +var recursive = /* @__PURE__ */ new WeakMap(); +function isRecursive(inst, stack) { + const cached2 = recursive.get(inst); + if (cached2 !== void 0) + return cached2; + if (stack.has(inst)) + return true; + stack.add(inst); + let result = false; + const check2 = (child) => { + if (!result && child?._zod && isRecursive(child, stack)) + result = true; + }; + const def = inst._zod.def; + const kind = def.type; + switch (kind) { + case "object": { + for (const key of Reflect.ownKeys(def.shape)) + check2(def.shape[key]); + check2(def.catchall); + break; + } + case "array": + check2(def.element); + break; + case "tuple": + for (const el of def.items) + check2(el); + check2(def.rest); + break; + case "record": + case "map": + check2(def.keyType); + check2(def.valueType); + break; + case "set": + check2(def.valueType); + break; + case "union": + for (const el of def.options) + check2(el); + break; + case "intersection": + check2(def.left); + check2(def.right); + break; + case "optional": + case "nullable": + case "default": + case "prefault": + case "catch": + case "readonly": + case "nonoptional": + case "promise": + case "success": + check2(def.innerType); + break; + case "pipe": + check2(def.in); + check2(def.out); + break; + case "function": + check2(def.input); + check2(def.output); + break; + // reading `_zod.innerType` resolves the getter once and caches it + case "lazy": + check2(inst._zod.innerType); + break; + // a leaf by choice: `parts` are regex fragments, not data positions + case "template_literal": + // leaves + case "string": + case "number": + case "int": + case "boolean": + case "bigint": + case "symbol": + case "undefined": + case "null": + case "void": + case "never": + case "any": + case "unknown": + case "date": + case "nan": + case "enum": + case "literal": + case "file": + case "transform": + case "custom": + break; + default: { + kind; + for (const key in def) { + const desc = Object.getOwnPropertyDescriptor(def, key); + if (!desc || desc.get) + continue; + const value = desc.value; + if (!value || typeof value !== "object") + continue; + if (value._zod) + check2(value); + else if (Array.isArray(value)) + for (const el of value) + check2(el); + } + } + } + stack.delete(inst); + recursive.set(inst, result); + return result; +} +function isRecursiveSchema(inst) { + return isRecursive(inst, /* @__PURE__ */ new Set()); +} +function bucketFor(state, inst) { + let bucket = state.buckets.get(inst); + if (!bucket) { + bucket = /* @__PURE__ */ new Map(); + state.buckets.set(inst, bucket); + } + return bucket; +} +var handoff; +var open = []; +var memo = { + alloc(_inst, payload, empty) { + const bucket = handoff; + if (!bucket) + return empty; + handoff = void 0; + const entry = { value: empty, issues: null }; + bucket.set(payload.value, entry); + open.push(entry); + return empty; + }, + guard(inst) { + var _a3; + (_a3 = inst._zod).deferred ?? (_a3.deferred = []); + inst._zod.deferred.push(() => { + const base = inst._zod.parse; + const wrapped = (payload, ctx) => { + if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) + throw new $ZodCyclicError(); + return base(payload, ctx); + }; + inst._zod.parse = wrapped; + if (inst._zod.run === base) + inst._zod.run = wrapped; + }); + }, + attach(inst) { + var _a3; + let isRecursiveInst; + let lastCtx; + let lastBucket; + (_a3 = inst._zod).deferred ?? (_a3.deferred = []); + inst._zod.deferred.push(() => { + const base = inst._zod.parse; + const wrapped = (payload, ctx) => { + if (isRecursiveInst === void 0) { + isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set()); + if (!isRecursiveInst) { + inst._zod.parse = base; + if (inst._zod.run === wrapped) + inst._zod.run = base; + return base(payload, ctx); + } + } + const input2 = payload.value; + if (input2 === null || typeof input2 !== "object") + return base(payload, ctx); + let state = ctx[STATE]; + if (!state) { + state = { buckets: /* @__PURE__ */ new Map(), backEdges: void 0 }; + ctx[STATE] = state; + } + let bucket; + if (lastCtx === ctx) { + bucket = lastBucket; + } else { + bucket = bucketFor(state, inst); + lastCtx = ctx; + lastBucket = bucket; + } + const hit = bucket.get(input2); + if (hit) { + payload.value = hit.value; + if (hit.issues) { + if (hit.issues.length) + payload.issues.push(...cloneIssues(hit.issues)); + } else { + payload.memo = true; + state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set()); + state.backEdges.add(hit.value); + } + return payload; + } + handoff = bucket; + const depth = open.length; + const result = base(payload, ctx); + handoff = void 0; + const entry = open.length > depth ? open.pop() : void 0; + if (result instanceof Promise) { + return result.then((r) => { + if (entry) + entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES; + return r; + }); + } + if (entry) + entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES; + return result; + }; + inst._zod.parse = wrapped; + if (inst._zod.run === base) + inst._zod.run = wrapped; + }); + } +}; +function memoizer() { + return memo; +} +function isBackEdge(ctx, value) { + const backEdges = ctx[STATE]?.backEdges; + return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value); +} + +// node_modules/zod/v4/locales/index.js +var locales_exports = {}; +__export(locales_exports, { + ar: () => ar_default, + az: () => az_default, + be: () => be_default, + bg: () => bg_default, + bn: () => bn_default, + ca: () => ca_default, + ckb: () => ckb_default, + cs: () => cs_default, + da: () => da_default, + de: () => de_default, + el: () => el_default, + en: () => en_default2, + eo: () => eo_default, + es: () => es_default, + fa: () => fa_default, + fi: () => fi_default, + fr: () => fr_default, + frCA: () => fr_CA_default, + gu: () => gu_default, + he: () => he_default, + hi: () => hi_default, + hr: () => hr_default, + hu: () => hu_default, + hy: () => hy_default, + id: () => id_default, + is: () => is_default, + it: () => it_default, + ja: () => ja_default, + ka: () => ka_default, + kh: () => kh_default, + km: () => km_default, + kn: () => kn_default, + ko: () => ko_default, + lt: () => lt_default, + mk: () => mk_default, + ms: () => ms_default, + ne: () => ne_default, + nl: () => nl_default, + nn: () => nn_default, + no: () => no_default, + ota: () => ota_default, + pl: () => pl_default, + ps: () => ps_default, + pt: () => pt_default, + ptBR: () => pt_BR_default, + ro: () => ro_default, + ru: () => ru_default, + sk: () => sk_default, + sl: () => sl_default, + sv: () => sv_default, ta: () => ta_default, th: () => th_default, + tk: () => tk_default, tr: () => tr_default, ua: () => ua_default, uk: () => uk_default, @@ -15248,7 +16020,8 @@ var error = () => { string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }, file: { unit: "\u0628\u0627\u064A\u062A", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }, array: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }, - set: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" } + set: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }, + map: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -15274,12 +16047,14 @@ var error = () => { duration: "\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO", ipv4: "\u0639\u0646\u0648\u0627\u0646 IPv4", ipv6: "\u0639\u0646\u0648\u0627\u0646 IPv6", + mac: "\u0639\u0646\u0648\u0627\u0646 MAC", cidrv4: "\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4", cidrv6: "\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6", base64: "\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded", base64url: "\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded", json_string: "\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON", e164: "\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164", + credit_card: "\u0631\u0642\u0645 \u0628\u0637\u0627\u0642\u0629 \u0627\u0644\u0627\u0626\u062A\u0645\u0627\u0646", jwt: "JWT", template_literal: "\u0645\u062F\u062E\u0644" }; @@ -15355,7 +16130,8 @@ var error2 = () => { string: { unit: "simvol", verb: "olmal\u0131d\u0131r" }, file: { unit: "bayt", verb: "olmal\u0131d\u0131r" }, array: { unit: "element", verb: "olmal\u0131d\u0131r" }, - set: { unit: "element", verb: "olmal\u0131d\u0131r" } + set: { unit: "element", verb: "olmal\u0131d\u0131r" }, + map: { unit: "element", verb: "olmal\u0131d\u0131r" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -15381,12 +16157,14 @@ var error2 = () => { duration: "ISO duration", ipv4: "IPv4 address", ipv6: "IPv6 address", + mac: "MAC address", cidrv4: "IPv4 range", cidrv6: "IPv6 range", base64: "base64-encoded string", base64url: "base64url-encoded string", json_string: "JSON string", e164: "E.164 number", + credit_card: "kredit kart\u0131 n\xF6mr\u0259si", jwt: "JWT", template_literal: "input" }; @@ -15497,6 +16275,14 @@ var error3 = () => { }, verb: "\u043C\u0435\u0446\u044C" }, + map: { + unit: { + one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442", + few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B", + many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E" + }, + verb: "\u043C\u0435\u0446\u044C" + }, file: { unit: { one: "\u0431\u0430\u0439\u0442", @@ -15530,12 +16316,14 @@ var error3 = () => { duration: "ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C", ipv4: "IPv4 \u0430\u0434\u0440\u0430\u0441", ipv6: "IPv6 \u0430\u0434\u0440\u0430\u0441", + mac: "MAC \u0430\u0434\u0440\u0430\u0441", cidrv4: "IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D", cidrv6: "IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D", base64: "\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64", base64url: "\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url", json_string: "JSON \u0440\u0430\u0434\u043E\u043A", e164: "\u043D\u0443\u043C\u0430\u0440 E.164", + credit_card: "\u043D\u0443\u043C\u0430\u0440 \u043A\u0440\u044D\u0434\u044B\u0442\u043D\u0430\u0439 \u043A\u0430\u0440\u0442\u044B", jwt: "JWT", template_literal: "\u0443\u0432\u043E\u0434" }; @@ -15618,7 +16406,8 @@ var error4 = () => { string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" }, file: { unit: "\u0431\u0430\u0439\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" }, array: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" }, - set: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" } + set: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" }, + map: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -15644,12 +16433,14 @@ var error4 = () => { duration: "ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442", ipv4: "IPv4 \u0430\u0434\u0440\u0435\u0441", ipv6: "IPv6 \u0430\u0434\u0440\u0435\u0441", + mac: "MAC \u0430\u0434\u0440\u0435\u0441", cidrv4: "IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D", cidrv6: "IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D", base64: "base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437", base64url: "base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437", json_string: "JSON \u043D\u0438\u0437", e164: "E.164 \u043D\u043E\u043C\u0435\u0440", + credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0430", jwt: "JWT", template_literal: "\u0432\u0445\u043E\u0434" }; @@ -15733,13 +16524,126 @@ function bg_default() { }; } -// node_modules/zod/v4/locales/ca.js +// node_modules/zod/v4/locales/bn.js var error5 = () => { + const Sizable = { + string: { unit: "\u0985\u0995\u09CD\u09B7\u09B0", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" }, + file: { unit: "\u09AC\u09BE\u0987\u099F", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" }, + array: { unit: "\u0986\u0987\u099F\u09C7\u09AE", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" }, + set: { unit: "\u0986\u0987\u099F\u09C7\u09AE", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" }, + map: { unit: "\u098F\u09A8\u09CD\u099F\u09CD\u09B0\u09BF", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const FormatDictionary = { + regex: "\u0987\u09A8\u09AA\u09C1\u099F", + email: "\u0987\u09AE\u09C7\u0987\u09B2 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE", + url: "URL", + emoji: "\u0987\u09AE\u09CB\u099C\u09BF", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO \u09A4\u09BE\u09B0\u09BF\u0996 \u0993 \u09B8\u09AE\u09AF\u09BC", + date: "ISO \u09A4\u09BE\u09B0\u09BF\u0996", + time: "ISO \u09B8\u09AE\u09AF\u09BC", + duration: "ISO \u09B8\u09AE\u09AF\u09BC\u0995\u09BE\u09B2", + ipv4: "IPv4 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE", + ipv6: "IPv6 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE", + mac: "MAC \u09A0\u09BF\u0995\u09BE\u09A8\u09BE", + cidrv4: "IPv4 \u09B0\u09C7\u099E\u09CD\u099C", + cidrv6: "IPv6 \u09B0\u09C7\u099E\u09CD\u099C", + base64: "base64-\u098F\u09A8\u0995\u09CB\u09A1\u09C7\u09A1 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982", + base64url: "base64url-\u098F\u09A8\u0995\u09CB\u09A1\u09C7\u09A1 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982", + json_string: "JSON \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982", + e164: "E.164 \u09A8\u09AE\u09CD\u09AC\u09B0", + credit_card: "\u0995\u09CD\u09B0\u09C7\u09A1\u09BF\u099F \u0995\u09BE\u09B0\u09CD\u09A1 \u09A8\u09AE\u09CD\u09AC\u09B0", + jwt: "JWT", + template_literal: "\u0987\u09A8\u09AA\u09C1\u099F" + }; + const TypeDictionary = { + nan: "NaN" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": { + const expected = TypeDictionary[issue2.expected] ?? issue2.expected; + const receivedType = parsedType(issue2.input); + const received = TypeDictionary[receivedType] ?? receivedType; + return `\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F: \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${expected}, \u09AA\u09CD\u09B0\u09BE\u09AA\u09CD\u09A4 ${received}`; + } + case "invalid_value": + if (issue2.values.length === 1) + return `\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F: \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${stringifyPrimitive(issue2.values[0])}`; + return `\u0985\u09AC\u09C8\u09A7 \u0985\u09AA\u09B6\u09A8: ${joinValues(issue2.values, " | ")} \u098F\u09B0 \u09AE\u09A7\u09CD\u09AF\u09C7 \u098F\u0995\u099F\u09BF \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u0985\u09A8\u09C7\u0995 \u09AC\u09A1\u09BC: ${issue2.origin ?? "\u09AE\u09BE\u09A8"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u098F\u09B2\u09BF\u09AE\u09C7\u09A8\u09CD\u099F"} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; + return `\u0985\u09A8\u09C7\u0995 \u09AC\u09A1\u09BC: ${issue2.origin ?? "\u09AE\u09BE\u09A8"} ${adj}${issue2.maximum.toString()} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u0985\u09A8\u09C7\u0995 \u099B\u09CB\u099F: ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; + } + return `\u0985\u09A8\u09C7\u0995 \u099B\u09CB\u099F: ${issue2.origin} ${adj}${issue2.minimum.toString()} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${_issue.prefix}" \u09A6\u09BF\u09AF\u09BC\u09C7 \u09B6\u09C1\u09B0\u09C1 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; + } + if (_issue.format === "ends_with") + return `\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${_issue.suffix}" \u09A6\u09BF\u09AF\u09BC\u09C7 \u09B6\u09C7\u09B7 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; + if (_issue.format === "includes") + return `\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${_issue.includes}" \u0985\u09A8\u09CD\u09A4\u09B0\u09CD\u09AD\u09C1\u0995\u09CD\u09A4 \u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7`; + if (_issue.format === "regex") + return `\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: ${_issue.pattern} \u09AA\u09CD\u09AF\u09BE\u099F\u09BE\u09B0\u09CD\u09A8 \u09AE\u09BF\u09B2\u09A4\u09C7 \u09B9\u09AC\u09C7`; + return `\u0985\u09AC\u09C8\u09A7 ${FormatDictionary[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u0985\u09AC\u09C8\u09A7 \u09A8\u09AE\u09CD\u09AC\u09B0: ${issue2.divisor} \u098F\u09B0 \u0997\u09C1\u09A3\u09BF\u09A4\u0995 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; + case "unrecognized_keys": + return `\u0985\u099A\u09C7\u09A8\u09BE \u0995\u09C0${issue2.keys.length > 1 ? "\u0997\u09C1\u09B2\u09CB" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `${issue2.origin} \u098F \u0985\u09AC\u09C8\u09A7 \u0995\u09C0`; + case "invalid_union": + if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { + const opts = issue2.options.map((o) => `'${o}'`).join(" | "); + return `\u0985\u09AC\u09C8\u09A7 \u09A1\u09BF\u09B8\u0995\u09CD\u09B0\u09BF\u09AE\u09BF\u09A8\u09C7\u099F\u09B0 \u09AE\u09BE\u09A8\u0964 \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${opts}`; + } + return "\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F"; + case "invalid_element": + return `${issue2.origin} \u098F \u0985\u09AC\u09C8\u09A7 \u09AE\u09BE\u09A8`; + default: + return "\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F"; + } + }; +}; +function bn_default() { + return { + localeError: error5() + }; +} + +// node_modules/zod/v4/locales/ca.js +var error6 = () => { const Sizable = { string: { unit: "car\xE0cters", verb: "contenir" }, file: { unit: "bytes", verb: "contenir" }, array: { unit: "elements", verb: "contenir" }, - set: { unit: "elements", verb: "contenir" } + set: { unit: "elements", verb: "contenir" }, + map: { unit: "elements", verb: "contenir" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -15765,12 +16669,14 @@ var error5 = () => { duration: "durada ISO", ipv4: "adre\xE7a IPv4", ipv6: "adre\xE7a IPv6", + mac: "adre\xE7a MAC", cidrv4: "rang IPv4", cidrv6: "rang IPv6", base64: "cadena codificada en base64", base64url: "cadena codificada en base64url", json_string: "cadena JSON", e164: "n\xFAmero E.164", + credit_card: "n\xFAmero de targeta de cr\xE8dit", jwt: "JWT", template_literal: "entrada" }; @@ -15838,17 +16744,149 @@ var error5 = () => { }; function ca_default() { return { - localeError: error5() + localeError: error6() + }; +} + +// node_modules/zod/v4/locales/ckb.js +var error7 = () => { + const Sizable = { + string: { unit: "\u067E\u06CC\u062A", verb: "\u0628\u06CE\u062A" }, + file: { unit: "\u0628\u0627\u06CC\u062A", verb: "\u0628\u06CE\u062A" }, + array: { unit: "\u062F\u0627\u0646\u06D5", verb: "\u0628\u06CE\u062A" }, + set: { unit: "\u062F\u0627\u0646\u06D5", verb: "\u0628\u06CE\u062A" }, + map: { unit: "\u062F\u0627\u0646\u06D5", verb: "\u0628\u06CE\u062A" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const FormatDictionary = { + regex: "regex", + email: "\u0626\u06CC\u0645\u06D5\u06CC\u06B5", + url: "\u0628\u06D5\u0633\u062A\u06D5\u0631 (URL)", + emoji: "\u0626\u06CC\u0645\u06C6\u062C\u06CC", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "\u0695\u06CE\u06A9\u06D5\u0648\u062A \u0648 \u06A9\u0627\u062A", + date: "\u0695\u06CE\u06A9\u06D5\u0648\u062A", + time: "\u06A9\u0627\u062A", + duration: "\u0645\u0627\u0648\u06D5", + ipv4: "\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC IPv4", + ipv6: "\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC IPv6", + mac: "\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC MAC", + cidrv4: "\u0645\u06D5\u0648\u062F\u0627\u06CC IPv4", + cidrv6: "\u0645\u06D5\u0648\u062F\u0627\u06CC IPv6", + base64: "\u062F\u06D5\u0642\u06CC base64", + base64url: "\u062F\u06D5\u0642\u06CC base64url", + json_string: "\u062F\u06D5\u0642\u06CC JSON", + e164: "\u0698\u0645\u0627\u0631\u06D5\u06CC E.164", + credit_card: "\u0698\u0645\u0627\u0631\u06D5\u06CC \u06A9\u0627\u0631\u062A\u06CC \u06A9\u0631\u06CE\u062F\u06CC\u062A", + jwt: "JWT", + template_literal: "\u062A\u06CE\u06A9\u0631\u062F\u06D5" + }; + const TypeDictionary = { + nan: "NaN", + string: "\u0646\u0648\u0648\u0633\u06CC\u0646", + number: "\u0698\u0645\u0627\u0631\u06D5", + boolean: "boolean", + array: "array", + object: "object", + date: "\u0695\u06CE\u06A9\u06D5\u0648\u062A", + integer: "\u0698\u0645\u0627\u0631\u06D5", + float: "\u0698\u0645\u0627\u0631\u06D5", + null: "null", + undefined: "undefined", + function: "function", + symbol: "symbol", + unknown: "unknown", + promise: "promise", + void: "void", + never: "never", + map: "map", + set: "set" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": { + const expected = TypeDictionary[issue2.expected] ?? issue2.expected; + const receivedType = parsedType(issue2.input); + const received = TypeDictionary[receivedType] ?? receivedType; + const postfix = ["\u0627", "\u0648", "\u06C6", "\u0648\u0648", "\u06D5", "\u06CC", "\u06CE"].some((p) => received.endsWith(p)) ? "\u06CC\u06D5" : "\u06D5"; + const isEnglish = /^[a-zA-Z]+$/.test(received); + if (receivedType === "null" || receivedType === "undefined") + return `\u062F\u0627\u0648\u0627\u06A9\u0631\u0627\u0648\u06D5`; + return `\u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 ${expected} \u0628\u06CE\u062A\u060C \u0628\u06D5\u06B5\u0627\u0645 ${received}${isEnglish ? "" : postfix}`; + } + case "invalid_value": + if (issue2.values.length === 1) + return `\u0628\u06D5\u0647\u0627\u06A9\u06D5 \u0646\u0627\u062F\u0631\u0648\u0648\u0633\u062A\u06D5: \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 ${stringifyPrimitive(issue2.values[0])} \u0628\u06CE\u062A`; + return `\u0647\u06D5\u06B5\u0628\u0698\u0627\u0631\u062F\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 \u06CC\u06D5\u06A9\u06CE\u06A9 \u0628\u06CE\u062A \u0644\u06D5 ${joinValues(issue2.values, "|")}`; + case "too_big": { + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u0632\u06C6\u0631\u06D5\u0648\u06D5 ${issue2.maximum.toString()} ${sizing.unit} ${sizing.verb}`; + return `\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u0632\u06C6\u0631\u06D5\u0648\u06D5 ${issue2.maximum.toString()} \u0628\u06CE\u062A`; + } + case "too_small": { + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u06A9\u06D5\u0645\u06D5\u0648\u06D5 ${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`; + return `\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u06A9\u06D5\u0645\u06D5\u0648\u06D5 ${issue2.minimum.toString()} \u0628\u06CE\u062A`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u062F\u06D5\u0633\u062A\u067E\u06CE\u0628\u06A9\u0627\u062A \u0628\u06D5 "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") + return `\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u06A9\u06C6\u062A\u0627\u06CC\u06CC\u0628\u06CE\u062A \u0628\u06D5 "${_issue.suffix}"`; + if (_issue.format === "includes") + return `\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 "${_issue.includes}" \u0644\u06D5\u062E\u06C6\u0628\u06AF\u0631\u06CE\u062A`; + if (_issue.format === "regex") + return `\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0644\u06D5\u06AF\u06D5\u06B5 \u067E\u0627\u062A\u06CE\u0631\u0646\u06CC ${_issue.pattern} \u0628\u06AF\u0648\u0646\u062C\u06CE\u062A`; + return `\u0628\u06D5\u0647\u0627\u06CC ${FormatDictionary[_issue.format] ?? issue2.format} \u0646\u0627\u062F\u0631\u0648\u0633\u062A\u06D5`; + } + case "not_multiple_of": + return `\u0698\u0645\u0627\u0631\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u062F\u06D5\u0628\u06CE\u062A \u0686\u06D5\u0646\u062F \u0647\u06CE\u0646\u062F\u06D5 \u0628\u06CE\u062A \u0628\u06C6 ${issue2.divisor}`; + case "unrecognized_keys": + return `\u06A9\u0644\u06CC\u0644\u06CC \u0646\u06D5\u0646\u0627\u0633\u0631\u0627\u0648: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u06A9\u0644\u06CC\u0644\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A \u0644\u06D5 ${issue2.origin}`; + case "invalid_union": + if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { + const opts = issue2.options.map((o) => `'${o}'`).join(" | "); + return `\u0628\u06D5\u0647\u0627\u06CC \u0646\u06D5\u0646\u0627\u0633\u0631\u0627\u0648 \u0647\u06D5\u06CC\u06D5. \u0628\u06D5\u0647\u0627\u06CC \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648: ${opts}`; + } + return "\u06CC\u06D5\u06A9\u06AF\u0631\u062A\u0646\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A"; + case "invalid_element": + return `${issue2.origin} \u0628\u06D5\u0647\u0627\u06A9\u06D5 \u0646\u0627\u062F\u0631\u0648\u0633\u062A\u06D5`; + default: + return `\u062A\u06CE\u06A9\u0631\u062F\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A`; + } + }; +}; +function ckb_default() { + return { + localeError: error7() }; } // node_modules/zod/v4/locales/cs.js -var error6 = () => { +var error8 = () => { const Sizable = { string: { unit: "znak\u016F", verb: "m\xEDt" }, file: { unit: "bajt\u016F", verb: "m\xEDt" }, array: { unit: "prvk\u016F", verb: "m\xEDt" }, - set: { unit: "prvk\u016F", verb: "m\xEDt" } + set: { unit: "prvk\u016F", verb: "m\xEDt" }, + map: { unit: "prvk\u016F", verb: "m\xEDt" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -15874,12 +16912,14 @@ var error6 = () => { duration: "doba trv\xE1n\xED ISO", ipv4: "IPv4 adresa", ipv6: "IPv6 adresa", + mac: "MAC adresa", cidrv4: "rozsah IPv4", cidrv6: "rozsah IPv6", base64: "\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64", base64url: "\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url", json_string: "\u0159et\u011Bzec ve form\xE1tu JSON", e164: "\u010D\xEDslo E.164", + credit_card: "\u010D\xEDslo kreditn\xED karty", jwt: "JWT", template_literal: "vstup" }; @@ -15950,17 +16990,18 @@ var error6 = () => { }; function cs_default() { return { - localeError: error6() + localeError: error8() }; } // node_modules/zod/v4/locales/da.js -var error7 = () => { +var error9 = () => { const Sizable = { string: { unit: "tegn", verb: "havde" }, file: { unit: "bytes", verb: "havde" }, array: { unit: "elementer", verb: "indeholdt" }, - set: { unit: "elementer", verb: "indeholdt" } + set: { unit: "elementer", verb: "indeholdt" }, + map: { unit: "elementer", verb: "indeholdt" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -15984,14 +17025,16 @@ var error7 = () => { date: "ISO-dato", time: "ISO-klokkesl\xE6t", duration: "ISO-varighed", - ipv4: "IPv4-omr\xE5de", - ipv6: "IPv6-omr\xE5de", + ipv4: "IPv4-adresse", + ipv6: "IPv6-adresse", + mac: "MAC-adresse", cidrv4: "IPv4-spektrum", cidrv6: "IPv6-spektrum", base64: "base64-kodet streng", base64url: "base64url-kodet streng", json_string: "JSON-streng", e164: "E.164-nummer", + credit_card: "kreditkortnummer", jwt: "JWT", template_literal: "input" }; @@ -16066,17 +17109,18 @@ var error7 = () => { }; function da_default() { return { - localeError: error7() + localeError: error9() }; } // node_modules/zod/v4/locales/de.js -var error8 = () => { +var error10 = () => { const Sizable = { string: { unit: "Zeichen", verb: "zu haben" }, file: { unit: "Bytes", verb: "zu haben" }, array: { unit: "Elemente", verb: "zu haben" }, - set: { unit: "Elemente", verb: "zu haben" } + set: { unit: "Elemente", verb: "zu haben" }, + map: { unit: "Elemente", verb: "zu haben" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -16102,12 +17146,14 @@ var error8 = () => { duration: "ISO-Dauer", ipv4: "IPv4-Adresse", ipv6: "IPv6-Adresse", + mac: "MAC-Adresse", cidrv4: "IPv4-Bereich", cidrv6: "IPv6-Bereich", base64: "Base64-codierter String", base64url: "Base64-URL-codierter String", json_string: "JSON-String", e164: "E.164-Nummer", + credit_card: "Kreditkartennummer", jwt: "JWT", template_literal: "Eingabe" }; @@ -16175,12 +17221,12 @@ var error8 = () => { }; function de_default() { return { - localeError: error8() + localeError: error10() }; } // node_modules/zod/v4/locales/el.js -var error9 = () => { +var error11 = () => { const Sizable = { string: { unit: "\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" }, file: { unit: "bytes", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" }, @@ -16219,6 +17265,7 @@ var error9 = () => { base64url: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url", json_string: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON", e164: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164", + credit_card: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 \u03C0\u03B9\u03C3\u03C4\u03C9\u03C4\u03B9\u03BA\u03AE\u03C2 \u03BA\u03AC\u03C1\u03C4\u03B1\u03C2", jwt: "JWT", template_literal: "\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2" }; @@ -16285,12 +17332,12 @@ var error9 = () => { }; function el_default() { return { - localeError: error9() + localeError: error11() }; } // node_modules/zod/v4/locales/en.js -var error10 = () => { +var error12 = () => { const Sizable = { string: { unit: "characters", verb: "to have" }, file: { unit: "bytes", verb: "to have" }, @@ -16329,6 +17376,7 @@ var error10 = () => { base64url: "base64url-encoded string", json_string: "JSON string", e164: "E.164 number", + credit_card: "credit card number", jwt: "JWT", template_literal: "input" }; @@ -16337,12 +17385,18 @@ var error10 = () => { nan: "NaN" // All other type names omitted - they fall back to raw values via ?? operator }; + function getTypeName(type, input2) { + if (type === "number" && typeof input2 === "number" && !Number.isFinite(input2)) { + return String(input2); + } + return TypeDictionary[type] ?? type; + } return (issue2) => { switch (issue2.code) { case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; + const expected = getTypeName(issue2.expected); const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; + const received = getTypeName(receivedType, issue2.input); return `Invalid input: expected ${expected}, received ${received}`; } case "invalid_value": @@ -16350,14 +17404,14 @@ var error10 = () => { return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`; return `Invalid option: expected one of ${joinValues(issue2.values, "|")}`; case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; + const adj = issue2.exact ? "exactly " : issue2.inclusive ? "<=" : "<"; const sizing = getSizing(issue2.origin); if (sizing) return `Too big: expected ${issue2.origin ?? "value"} to have ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`; return `Too big: expected ${issue2.origin ?? "value"} to be ${adj}${issue2.maximum.toString()}`; } case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; + const adj = issue2.exact ? "exactly " : issue2.inclusive ? ">=" : ">"; const sizing = getSizing(issue2.origin); if (sizing) { return `Too small: expected ${issue2.origin} to have ${adj}${issue2.minimum.toString()} ${sizing.unit}`; @@ -16388,6 +17442,9 @@ var error10 = () => { const opts = issue2.options.map((o) => `'${o}'`).join(" | "); return `Invalid discriminator value. Expected ${opts}`; } + if (issue2.inclusive === false) { + return "Invalid input: more than one option matched"; + } return "Invalid input"; case "invalid_element": return `Invalid value in ${issue2.origin}`; @@ -16398,17 +17455,18 @@ var error10 = () => { }; function en_default2() { return { - localeError: error10() + localeError: error12() }; } // node_modules/zod/v4/locales/eo.js -var error11 = () => { +var error13 = () => { const Sizable = { string: { unit: "karaktrojn", verb: "havi" }, file: { unit: "bajtojn", verb: "havi" }, array: { unit: "elementojn", verb: "havi" }, - set: { unit: "elementojn", verb: "havi" } + set: { unit: "elementojn", verb: "havi" }, + map: { unit: "elementojn", verb: "havi" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -16434,12 +17492,14 @@ var error11 = () => { duration: "ISO-da\u016Dro", ipv4: "IPv4-adreso", ipv6: "IPv6-adreso", + mac: "MAC-adreso", cidrv4: "IPv4-rango", cidrv6: "IPv6-rango", base64: "64-ume kodita karaktraro", base64url: "URL-64-ume kodita karaktraro", json_string: "JSON-karaktraro", e164: "E.164-nombro", + credit_card: "kreditkarta numero", jwt: "JWT", template_literal: "enigo" }; @@ -16508,12 +17568,12 @@ var error11 = () => { }; function eo_default() { return { - localeError: error11() + localeError: error13() }; } // node_modules/zod/v4/locales/es.js -var error12 = () => { +var error14 = () => { const Sizable = { string: { unit: "caracteres", verb: "tener" }, file: { unit: "bytes", verb: "tener" }, @@ -16544,12 +17604,14 @@ var error12 = () => { duration: "duraci\xF3n ISO", ipv4: "direcci\xF3n IPv4", ipv6: "direcci\xF3n IPv6", + mac: "direcci\xF3n MAC", cidrv4: "rango IPv4", cidrv6: "rango IPv6", base64: "cadena codificada en base64", base64url: "URL codificada en base64", json_string: "cadena JSON", e164: "n\xFAmero E.164", + credit_card: "n\xFAmero de tarjeta de cr\xE9dito", jwt: "JWT", template_literal: "entrada" }; @@ -16641,17 +17703,18 @@ var error12 = () => { }; function es_default() { return { - localeError: error12() + localeError: error14() }; } // node_modules/zod/v4/locales/fa.js -var error13 = () => { +var error15 = () => { const Sizable = { string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }, file: { unit: "\u0628\u0627\u06CC\u062A", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }, array: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }, - set: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" } + set: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }, + map: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -16677,12 +17740,14 @@ var error13 = () => { duration: "\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648", ipv4: "IPv4 \u0622\u062F\u0631\u0633", ipv6: "IPv6 \u0622\u062F\u0631\u0633", + mac: "MAC \u0622\u062F\u0631\u0633", cidrv4: "IPv4 \u062F\u0627\u0645\u0646\u0647", cidrv6: "IPv6 \u062F\u0627\u0645\u0646\u0647", base64: "base64-encoded \u0631\u0634\u062A\u0647", base64url: "base64url-encoded \u0631\u0634\u062A\u0647", json_string: "JSON \u0631\u0634\u062A\u0647", e164: "E.164 \u0639\u062F\u062F", + credit_card: "\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A \u0627\u0639\u062A\u0628\u0627\u0631\u06CC", jwt: "JWT", template_literal: "\u0648\u0631\u0648\u062F\u06CC" }; @@ -16756,17 +17821,18 @@ var error13 = () => { }; function fa_default() { return { - localeError: error13() + localeError: error15() }; } // node_modules/zod/v4/locales/fi.js -var error14 = () => { +var error16 = () => { const Sizable = { string: { unit: "merkki\xE4", subject: "merkkijonon" }, file: { unit: "tavua", subject: "tiedoston" }, array: { unit: "alkiota", subject: "listan" }, set: { unit: "alkiota", subject: "joukon" }, + map: { unit: "alkiota", subject: "kuvauksen" }, number: { unit: "", subject: "luvun" }, bigint: { unit: "", subject: "suuren kokonaisluvun" }, int: { unit: "", subject: "kokonaisluvun" }, @@ -16796,12 +17862,14 @@ var error14 = () => { duration: "ISO-kesto", ipv4: "IPv4-osoite", ipv6: "IPv6-osoite", + mac: "MAC-osoite", cidrv4: "IPv4-alue", cidrv6: "IPv6-alue", base64: "base64-koodattu merkkijono", base64url: "base64url-koodattu merkkijono", json_string: "JSON-merkkijono", e164: "E.164-luku", + credit_card: "luottokortin numero", jwt: "JWT", template_literal: "templaattimerkkijono" }; @@ -16869,12 +17937,12 @@ var error14 = () => { }; function fi_default() { return { - localeError: error14() + localeError: error16() }; } // node_modules/zod/v4/locales/fr.js -var error15 = () => { +var error17 = () => { const Sizable = { string: { unit: "caract\xE8res", verb: "avoir" }, file: { unit: "octets", verb: "avoir" }, @@ -16885,7 +17953,7 @@ var error15 = () => { return Sizable[origin] ?? null; } const FormatDictionary = { - regex: "entr\xE9e", + regex: "expression r\xE9guli\xE8re", email: "adresse e-mail", url: "URL", emoji: "emoji", @@ -16905,17 +17973,19 @@ var error15 = () => { duration: "dur\xE9e ISO", ipv4: "adresse IPv4", ipv6: "adresse IPv6", + mac: "adresse MAC", cidrv4: "plage IPv4", cidrv6: "plage IPv6", - base64: "cha\xEEne encod\xE9e en base64", - base64url: "cha\xEEne encod\xE9e en base64url", - json_string: "cha\xEEne JSON", - e164: "num\xE9ro E.164", + base64: "cha\xEEne de caract\xE8res encod\xE9e en base64", + base64url: "cha\xEEne de caract\xE8res encod\xE9e en base64url", + json_string: "cha\xEEne de caract\xE8res JSON", + e164: "num\xE9ro au format E.164", + credit_card: "num\xE9ro de carte de cr\xE9dit", jwt: "JWT", template_literal: "entr\xE9e" }; const TypeDictionary = { - string: "cha\xEEne", + string: "cha\xEEne de caract\xE8res", number: "nombre", int: "entier", boolean: "bool\xE9en", @@ -16929,11 +17999,11 @@ var error15 = () => { array: "tableau", object: "objet", tuple: "tuple", - record: "enregistrement", - map: "carte", + record: "record", + map: "map", set: "ensemble", file: "fichier", - nonoptional: "non-optionnel", + nonoptional: "non optionnel", nan: "NaN", function: "fonction" }; @@ -16944,7 +18014,7 @@ var error15 = () => { const receivedType = parsedType(issue2.input); const received = TypeDictionary[receivedType] ?? receivedType; if (/^[A-Z]/.test(issue2.expected)) { - return `Entr\xE9e invalide : instanceof ${issue2.expected} attendu, ${received} re\xE7u`; + return `Entr\xE9e invalide : instance de ${issue2.expected} attendu, ${received} re\xE7u`; } return `Entr\xE9e invalide : ${expected} attendu, ${received} re\xE7u`; } @@ -16969,13 +18039,13 @@ var error15 = () => { case "invalid_format": { const _issue = issue2; if (_issue.format === "starts_with") - return `Cha\xEEne invalide : doit commencer par "${_issue.prefix}"`; + return `Cha\xEEne de caract\xE8res invalide : doit commencer par "${_issue.prefix}"`; if (_issue.format === "ends_with") - return `Cha\xEEne invalide : doit se terminer par "${_issue.suffix}"`; + return `Cha\xEEne de caract\xE8res invalide : doit se terminer par "${_issue.suffix}"`; if (_issue.format === "includes") - return `Cha\xEEne invalide : doit inclure "${_issue.includes}"`; + return `Cha\xEEne de caract\xE8res invalide : doit inclure "${_issue.includes}"`; if (_issue.format === "regex") - return `Cha\xEEne invalide : doit correspondre au mod\xE8le ${_issue.pattern}`; + return `Cha\xEEne de caract\xE8res invalide : doit correspondre au motif ${_issue.pattern}`; return `${FormatDictionary[_issue.format] ?? issue2.format} invalide`; } case "not_multiple_of": @@ -16995,17 +18065,18 @@ var error15 = () => { }; function fr_default() { return { - localeError: error15() + localeError: error17() }; } // node_modules/zod/v4/locales/fr-CA.js -var error16 = () => { +var error18 = () => { const Sizable = { string: { unit: "caract\xE8res", verb: "avoir" }, file: { unit: "octets", verb: "avoir" }, array: { unit: "\xE9l\xE9ments", verb: "avoir" }, - set: { unit: "\xE9l\xE9ments", verb: "avoir" } + set: { unit: "\xE9l\xE9ments", verb: "avoir" }, + map: { unit: "\xE9l\xE9ments", verb: "avoir" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -17031,12 +18102,14 @@ var error16 = () => { duration: "dur\xE9e ISO", ipv4: "adresse IPv4", ipv6: "adresse IPv6", + mac: "adresse MAC", cidrv4: "plage IPv4", cidrv6: "plage IPv6", base64: "cha\xEEne encod\xE9e en base64", base64url: "cha\xEEne encod\xE9e en base64url", json_string: "cha\xEEne JSON", e164: "num\xE9ro E.164", + credit_card: "num\xE9ro de carte de cr\xE9dit", jwt: "JWT", template_literal: "entr\xE9e" }; @@ -17103,12 +18176,124 @@ var error16 = () => { }; function fr_CA_default() { return { - localeError: error16() + localeError: error18() + }; +} + +// node_modules/zod/v4/locales/gu.js +var error19 = () => { + const Sizable = { + string: { unit: "\u0A85\u0A95\u0ACD\u0AB7\u0AB0", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" }, + file: { unit: "\u0AAC\u0ABE\u0AAF\u0A9F", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" }, + array: { unit: "\u0A86\u0A87\u0A9F\u0AAE", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" }, + set: { unit: "\u0A86\u0A87\u0A9F\u0AAE", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" }, + map: { unit: "\u0A8F\u0AA8\u0ACD\u0A9F\u0ACD\u0AB0\u0AC0", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const FormatDictionary = { + regex: "\u0A87\u0AA8\u0AAA\u0AC1\u0A9F", + email: "\u0A88\u0AAE\u0AC7\u0A87\u0AB2 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8", + url: "URL", + emoji: "\u0A87\u0AAE\u0ACB\u0A9C\u0AC0", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO \u0AA4\u0ABE\u0AB0\u0AC0\u0A96 \u0A85\u0AA8\u0AC7 \u0AB8\u0AAE\u0AAF", + date: "ISO \u0AA4\u0ABE\u0AB0\u0AC0\u0A96", + time: "ISO \u0AB8\u0AAE\u0AAF", + duration: "ISO \u0A85\u0AB5\u0AA7\u0ABF", + ipv4: "IPv4 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8", + ipv6: "IPv6 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8", + mac: "MAC \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8", + cidrv4: "IPv4 \u0AB6\u0ACD\u0AB0\u0AC7\u0AA3\u0AC0", + cidrv6: "IPv6 \u0AB6\u0ACD\u0AB0\u0AC7\u0AA3\u0AC0", + base64: "base64-\u0A8F\u0AA8\u0ACD\u0A95\u0ACB\u0AA1\u0AC7\u0AA1 \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97", + base64url: "base64url-\u0A8F\u0AA8\u0ACD\u0A95\u0ACB\u0AA1\u0AC7\u0AA1 \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97", + json_string: "JSON \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97", + e164: "E.164 \u0AA8\u0A82\u0AAC\u0AB0", + credit_card: "\u0A95\u0ACD\u0AB0\u0AC7\u0AA1\u0ABF\u0A9F \u0A95\u0ABE\u0AB0\u0ACD\u0AA1 \u0AA8\u0A82\u0AAC\u0AB0", + jwt: "JWT", + template_literal: "\u0A87\u0AA8\u0AAA\u0AC1\u0A9F" + }; + const TypeDictionary = { + nan: "NaN" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": { + const expected = TypeDictionary[issue2.expected] ?? issue2.expected; + const receivedType = parsedType(issue2.input); + const received = TypeDictionary[receivedType] ?? receivedType; + return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F: \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${expected}, \u0AAA\u0ACD\u0AB0\u0ABE\u0AAA\u0ACD\u0AA4 ${received}`; + } + case "invalid_value": + if (issue2.values.length === 1) + return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F: \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${stringifyPrimitive(issue2.values[0])}`; + return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB5\u0ABF\u0A95\u0AB2\u0ACD\u0AAA: ${joinValues(issue2.values, " | ")} \u0AAE\u0ABE\u0AA7\u0ACD\u0AAF\u0AAE\u0AA5\u0AC0 \u0A8F\u0A95 \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u0A96\u0AC2\u0AAC \u0AAE\u0ACB\u0A9F\u0AC1\u0A82: ${issue2.origin ?? "\u0AAE\u0AC2\u0AB2\u0ACD\u0AAF"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0A8F\u0AB2\u0ABF\u0AAE\u0AC7\u0AA8\u0ACD\u0A9F"} \u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F`; + return `\u0A96\u0AC2\u0AAC \u0AAE\u0ACB\u0A9F\u0AC1\u0A82: ${issue2.origin ?? "\u0AAE\u0AC2\u0AB2\u0ACD\u0AAF"} ${adj}${issue2.maximum.toString()} \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u0A96\u0AC2\u0AAC \u0AA8\u0ABE\u0AA8\u0AC1\u0A82: ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} \u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F`; + } + return `\u0A96\u0AC2\u0AAC \u0AA8\u0ABE\u0AA8\u0AC1\u0A82: ${issue2.origin} ${adj}${issue2.minimum.toString()} \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${_issue.prefix}" \u0AA5\u0AC0 \u0AB6\u0AB0\u0AC2 \u0AA5\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`; + } + if (_issue.format === "ends_with") + return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${_issue.suffix}" \u0AAA\u0AB0 \u0AB8\u0AAE\u0ABE\u0AAA\u0ACD\u0AA4 \u0AA5\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`; + if (_issue.format === "includes") + return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${_issue.includes}" \u0AB6\u0ABE\u0AAE\u0AC7\u0AB2 \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`; + if (_issue.format === "regex") + return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: \u0AAA\u0AC7\u0A9F\u0AB0\u0ACD\u0AA8 ${_issue.pattern} \u0AB8\u0ABE\u0AA5\u0AC7 \u0AAE\u0AC7\u0AB3 \u0A96\u0ABE\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`; + return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF ${FormatDictionary[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AA8\u0A82\u0AAC\u0AB0: ${issue2.divisor} \u0AA8\u0ACB \u0A97\u0AC1\u0AA3\u0ABE\u0A82\u0A95 \u0AB9\u0ACB\u0AB5\u0ACB \u0A9C\u0ACB\u0A88\u0A8F`; + case "unrecognized_keys": + return `\u0A93\u0AB3\u0A96\u0AC0 \u0AB6\u0A95\u0ABE\u0AA4\u0ABE \u0AA8\u0AB9\u0AC0\u0A82 \u0AA4\u0AC7 \u0A95\u0AC0${issue2.keys.length > 1 ? "\u0A93" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `${issue2.origin} \u0AAE\u0ABE\u0A82 \u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A95\u0AC0`; + case "invalid_union": + if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { + const opts = issue2.options.map((o) => `'${o}'`).join(" | "); + return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AA1\u0ABF\u0AB8\u0ACD\u0A95\u0ACD\u0AB0\u0ABF\u0AAE\u0ABF\u0AA8\u0AC7\u0A9F\u0AB0 \u0AAE\u0AC2\u0AB2\u0ACD\u0AAF. \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${opts}`; + } + return "\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F"; + case "invalid_element": + return `${issue2.origin} \u0AAE\u0ABE\u0A82 \u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AAE\u0AC2\u0AB2\u0ACD\u0AAF`; + default: + return "\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F"; + } + }; +}; +function gu_default() { + return { + localeError: error19() }; } // node_modules/zod/v4/locales/he.js -var error17 = () => { +var error20 = () => { const TypeNames = { string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA", gender: "f" }, number: { label: "\u05DE\u05E1\u05E4\u05E8", gender: "m" }, @@ -17161,6 +18346,8 @@ var error17 = () => { url: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA", gender: "f" }, emoji: { label: "\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9", gender: "m" }, uuid: { label: "UUID", gender: "m" }, + uuidv4: { label: "UUIDv4", gender: "m" }, + uuidv6: { label: "UUIDv6", gender: "m" }, nanoid: { label: "nanoid", gender: "m" }, guid: { label: "GUID", gender: "m" }, cuid: { label: "cuid", gender: "m" }, @@ -17174,13 +18361,16 @@ var error17 = () => { duration: { label: "\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO", gender: "m" }, ipv4: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA IPv4", gender: "f" }, ipv6: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA IPv6", gender: "f" }, + mac: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA MAC", gender: "f" }, cidrv4: { label: "\u05D8\u05D5\u05D5\u05D7 IPv4", gender: "m" }, cidrv6: { label: "\u05D8\u05D5\u05D5\u05D7 IPv6", gender: "m" }, base64: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64", gender: "f" }, base64url: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA", gender: "f" }, json_string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON", gender: "f" }, e164: { label: "\u05DE\u05E1\u05E4\u05E8 E.164", gender: "m" }, + credit_card: { label: "\u05DE\u05E1\u05E4\u05E8 \u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9", gender: "m" }, jwt: { label: "JWT", gender: "m" }, + template_literal: { label: "\u05E7\u05DC\u05D8", gender: "m" }, ends_with: { label: "\u05E7\u05DC\u05D8", gender: "m" }, includes: { label: "\u05E7\u05DC\u05D8", gender: "m" }, lowercase: { label: "\u05E7\u05DC\u05D8", gender: "m" }, @@ -17298,12 +18488,122 @@ var error17 = () => { }; function he_default() { return { - localeError: error17() + localeError: error20() + }; +} + +// node_modules/zod/v4/locales/hi.js +var error21 = () => { + const Sizable = { + string: { unit: "\u0905\u0915\u094D\u0937\u0930", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" }, + file: { unit: "\u092C\u093E\u0907\u091F\u094D\u0938", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" }, + array: { unit: "\u0924\u0924\u094D\u0935", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" }, + set: { unit: "\u0924\u0924\u094D\u0935", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" }, + map: { unit: "\u092A\u094D\u0930\u0935\u093F\u0937\u094D\u091F\u093F\u092F\u093E\u0901", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const FormatDictionary = { + regex: "\u0907\u0928\u092A\u0941\u091F", + email: "\u0908\u092E\u0947\u0932 \u092A\u0924\u093E", + url: "URL", + emoji: "\u0907\u092E\u094B\u091C\u0940", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO \u0924\u093F\u0925\u093F \u0914\u0930 \u0938\u092E\u092F", + date: "ISO \u0924\u093F\u0925\u093F", + time: "ISO \u0938\u092E\u092F", + duration: "ISO \u0905\u0935\u0927\u093F", + ipv4: "IPv4 \u092A\u0924\u093E", + ipv6: "IPv6 \u092A\u0924\u093E", + mac: "MAC \u092A\u0924\u093E", + cidrv4: "IPv4 \u0936\u094D\u0930\u0947\u0923\u0940", + cidrv6: "IPv6 \u0936\u094D\u0930\u0947\u0923\u0940", + base64: "Base64-\u090F\u0928\u094D\u0915\u094B\u0921\u0947\u0921 \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917", + base64url: "Base64URL-\u090F\u0928\u094D\u0915\u094B\u0921\u0947\u0921 \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917", + json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917", + e164: "E.164 \u0938\u0902\u0916\u094D\u092F\u093E", + credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0938\u0902\u0916\u094D\u092F\u093E", + jwt: "JWT", + template_literal: "\u0907\u0928\u092A\u0941\u091F" + }; + const TypeDictionary = { + nan: "NaN" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": { + const expected = TypeDictionary[issue2.expected] ?? issue2.expected; + const receivedType = parsedType(issue2.input); + const received = TypeDictionary[receivedType] ?? receivedType; + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${expected}, \u092A\u094D\u0930\u093E\u092A\u094D\u0924 ${received}`; + } + case "invalid_value": + if (issue2.values.length === 1) + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${stringifyPrimitive(issue2.values[0])}`; + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0935\u093F\u0915\u0932\u094D\u092A: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u092E\u093E\u0928\u094B\u0902 \u092E\u0947\u0902 \u0938\u0947 \u090F\u0915 ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u092C\u0939\u0941\u0924 \u092C\u0921\u093C\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${issue2.origin ?? "\u092E\u093E\u0928"} \u092E\u0947\u0902 ${adj}${issue2.maximum} ${sizing.unit} \u0939\u094B\u0902`; + return `\u092C\u0939\u0941\u0924 \u092C\u0921\u093C\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${issue2.origin ?? "\u092E\u093E\u0928"} ${adj}${issue2.maximum} \u0939\u094B`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u092C\u0939\u0941\u0924 \u091B\u094B\u091F\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${issue2.origin} \u092E\u0947\u0902 ${adj}${issue2.minimum} ${sizing.unit} \u0939\u094B\u0902`; + return `\u092C\u0939\u0941\u0924 \u091B\u094B\u091F\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${issue2.origin} ${adj}${issue2.minimum} \u0939\u094B`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: "${_issue.prefix}" \u0938\u0947 \u0936\u0941\u0930\u0942 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`; + if (_issue.format === "ends_with") + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: "${_issue.suffix}" \u092A\u0930 \u0938\u092E\u093E\u092A\u094D\u0924 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`; + if (_issue.format === "includes") + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: \u0907\u0938\u092E\u0947\u0902 "${_issue.includes}" \u0936\u093E\u092E\u093F\u0932 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`; + if (_issue.format === "regex") + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: \u092A\u0948\u091F\u0930\u094D\u0928 ${_issue.pattern} \u0938\u0947 \u092E\u0947\u0932 \u0916\u093E\u0928\u093E \u091A\u093E\u0939\u093F\u090F`; + return `\u0905\u092E\u093E\u0928\u094D\u092F ${FormatDictionary[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u0902\u0916\u094D\u092F\u093E: \u092F\u0939 ${issue2.divisor} \u0915\u093E \u0917\u0941\u0923\u091C \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`; + case "unrecognized_keys": + return `\u0905\u092A\u0930\u093F\u091A\u093F\u0924 \u0915\u0941\u0902\u091C\u0940${issue2.keys.length > 1 ? "\u092F\u093E\u0901" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0915\u0941\u0902\u091C\u0940: ${issue2.origin} \u092E\u0947\u0902`; + case "invalid_union": + if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { + const opts = issue2.options.map((o) => `'${o}'`).join(" | "); + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0921\u093F\u0938\u094D\u0915\u094D\u0930\u093F\u092E\u093F\u0928\u0947\u091F\u0930 \u092E\u093E\u0928: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${opts}`; + } + return "\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F"; + case "invalid_element": + return `\u0905\u092E\u093E\u0928\u094D\u092F \u092E\u093E\u0928: ${issue2.origin} \u092E\u0947\u0902`; + default: + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F`; + } + }; +}; +function hi_default() { + return { + localeError: error21() }; } // node_modules/zod/v4/locales/hr.js -var error18 = () => { +var error22 = () => { const Sizable = { string: { unit: "znakova", verb: "imati" }, file: { unit: "bajtova", verb: "imati" }, @@ -17334,12 +18634,14 @@ var error18 = () => { duration: "ISO trajanje", ipv4: "IPv4 adresa", ipv6: "IPv6 adresa", + mac: "MAC adresa", cidrv4: "IPv4 raspon", cidrv6: "IPv6 raspon", base64: "base64 kodirani tekst", base64url: "base64url kodirani tekst", json_string: "JSON tekst", e164: "E.164 broj", + credit_card: "broj kreditne kartice", jwt: "JWT", template_literal: "unos" }; @@ -17421,17 +18723,18 @@ var error18 = () => { }; function hr_default() { return { - localeError: error18() + localeError: error22() }; } // node_modules/zod/v4/locales/hu.js -var error19 = () => { +var error23 = () => { const Sizable = { string: { unit: "karakter", verb: "legyen" }, file: { unit: "byte", verb: "legyen" }, array: { unit: "elem", verb: "legyen" }, - set: { unit: "elem", verb: "legyen" } + set: { unit: "elem", verb: "legyen" }, + map: { unit: "elem", verb: "legyen" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -17457,12 +18760,14 @@ var error19 = () => { duration: "ISO id\u0151intervallum", ipv4: "IPv4 c\xEDm", ipv6: "IPv6 c\xEDm", + mac: "MAC c\xEDm", cidrv4: "IPv4 tartom\xE1ny", cidrv6: "IPv6 tartom\xE1ny", base64: "base64-k\xF3dolt string", base64url: "base64url-k\xF3dolt string", json_string: "JSON string", e164: "E.164 sz\xE1m", + credit_card: "hitelk\xE1rtyasz\xE1m", jwt: "JWT", template_literal: "bemenet" }; @@ -17530,7 +18835,7 @@ var error19 = () => { }; function hu_default() { return { - localeError: error19() + localeError: error23() }; } @@ -17545,7 +18850,7 @@ function withDefiniteArticle(word) { const lastChar = word[word.length - 1]; return word + (vowels.includes(lastChar) ? "\u0576" : "\u0568"); } -var error20 = () => { +var error24 = () => { const Sizable = { string: { unit: { @@ -17574,6 +18879,13 @@ var error20 = () => { many: "\u057F\u0561\u0580\u0580\u0565\u0580" }, verb: "\u0578\u0582\u0576\u0565\u0576\u0561\u056C" + }, + map: { + unit: { + one: "\u057F\u0561\u0580\u0580", + many: "\u057F\u0561\u0580\u0580\u0565\u0580" + }, + verb: "\u0578\u0582\u0576\u0565\u0576\u0561\u056C" } }; function getSizing(origin) { @@ -17600,12 +18912,14 @@ var error20 = () => { duration: "ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576", ipv4: "IPv4 \u0570\u0561\u057D\u0581\u0565", ipv6: "IPv6 \u0570\u0561\u057D\u0581\u0565", + mac: "MAC \u0570\u0561\u057D\u0581\u0565", cidrv4: "IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584", cidrv6: "IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584", base64: "base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572", base64url: "base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572", json_string: "JSON \u057F\u0578\u0572", e164: "E.164 \u0570\u0561\u0574\u0561\u0580", + credit_card: "\u056F\u0580\u0565\u0564\u056B\u057F \u0584\u0561\u0580\u057F\u056B \u0570\u0561\u0574\u0561\u0580", jwt: "JWT", template_literal: "\u0574\u0578\u0582\u057F\u0584" }; @@ -17678,17 +18992,18 @@ var error20 = () => { }; function hy_default() { return { - localeError: error20() + localeError: error24() }; } // node_modules/zod/v4/locales/id.js -var error21 = () => { +var error25 = () => { const Sizable = { string: { unit: "karakter", verb: "memiliki" }, file: { unit: "byte", verb: "memiliki" }, array: { unit: "item", verb: "memiliki" }, - set: { unit: "item", verb: "memiliki" } + set: { unit: "item", verb: "memiliki" }, + map: { unit: "item", verb: "memiliki" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -17714,12 +19029,14 @@ var error21 = () => { duration: "durasi format ISO", ipv4: "alamat IPv4", ipv6: "alamat IPv6", + mac: "alamat MAC", 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", + credit_card: "nomor kartu kredit", jwt: "JWT", template_literal: "input" }; @@ -17785,17 +19102,18 @@ var error21 = () => { }; function id_default() { return { - localeError: error21() + localeError: error25() }; } // node_modules/zod/v4/locales/is.js -var error22 = () => { +var error26 = () => { const Sizable = { string: { unit: "stafi", verb: "a\xF0 hafa" }, file: { unit: "b\xE6ti", verb: "a\xF0 hafa" }, array: { unit: "hluti", verb: "a\xF0 hafa" }, - set: { unit: "hluti", verb: "a\xF0 hafa" } + set: { unit: "hluti", verb: "a\xF0 hafa" }, + map: { unit: "hluti", verb: "a\xF0 hafa" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -17821,12 +19139,14 @@ var error22 = () => { duration: "ISO t\xEDmalengd", ipv4: "IPv4 address", ipv6: "IPv6 address", + mac: "MAC address", cidrv4: "IPv4 range", cidrv6: "IPv6 range", base64: "base64-encoded strengur", base64url: "base64url-encoded strengur", json_string: "JSON strengur", e164: "E.164 t\xF6lugildi", + credit_card: "kreditkortan\xFAmer", jwt: "JWT", template_literal: "gildi" }; @@ -17895,17 +19215,18 @@ var error22 = () => { }; function is_default() { return { - localeError: error22() + localeError: error26() }; } // node_modules/zod/v4/locales/it.js -var error23 = () => { +var error27 = () => { const Sizable = { string: { unit: "caratteri", verb: "avere" }, file: { unit: "byte", verb: "avere" }, array: { unit: "elementi", verb: "avere" }, - set: { unit: "elementi", verb: "avere" } + set: { unit: "elementi", verb: "avere" }, + map: { unit: "elementi", verb: "avere" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -17931,12 +19252,14 @@ var error23 = () => { duration: "durata ISO", ipv4: "indirizzo IPv4", ipv6: "indirizzo IPv6", + mac: "indirizzo MAC", cidrv4: "intervallo IPv4", cidrv6: "intervallo IPv6", base64: "stringa codificata in base64", base64url: "URL codificata in base64", json_string: "stringa JSON", e164: "numero E.164", + credit_card: "numero di carta di credito", jwt: "JWT", template_literal: "input" }; @@ -18004,17 +19327,18 @@ var error23 = () => { }; function it_default() { return { - localeError: error23() + localeError: error27() }; } // node_modules/zod/v4/locales/ja.js -var error24 = () => { +var error28 = () => { const Sizable = { string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" }, file: { unit: "\u30D0\u30A4\u30C8", verb: "\u3067\u3042\u308B" }, array: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" }, - set: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" } + set: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" }, + map: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -18040,12 +19364,14 @@ var error24 = () => { duration: "ISO\u671F\u9593", ipv4: "IPv4\u30A2\u30C9\u30EC\u30B9", ipv6: "IPv6\u30A2\u30C9\u30EC\u30B9", + mac: "MAC\u30A2\u30C9\u30EC\u30B9", cidrv4: "IPv4\u7BC4\u56F2", cidrv6: "IPv6\u7BC4\u56F2", base64: "base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217", base64url: "base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217", json_string: "JSON\u6587\u5B57\u5217", e164: "E.164\u756A\u53F7", + credit_card: "\u30AF\u30EC\u30B8\u30C3\u30C8\u30AB\u30FC\u30C9\u756A\u53F7", jwt: "JWT", template_literal: "\u5165\u529B\u5024" }; @@ -18112,17 +19438,18 @@ var error24 = () => { }; function ja_default() { return { - localeError: error24() + localeError: error28() }; } // node_modules/zod/v4/locales/ka.js -var error25 = () => { +var error29 = () => { const Sizable = { string: { unit: "\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }, file: { unit: "\u10D1\u10D0\u10D8\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }, array: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }, - set: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" } + set: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }, + map: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -18148,12 +19475,14 @@ var error25 = () => { duration: "\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0", ipv4: "IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8", ipv6: "IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8", + mac: "MAC \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8", cidrv4: "IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8", cidrv6: "IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8", base64: "base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8", base64url: "base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8", json_string: "JSON \u10D5\u10D4\u10DA\u10D8", e164: "E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8", + credit_card: "\u10E1\u10D0\u10D9\u10E0\u10D4\u10D3\u10D8\u10E2\u10DD \u10D1\u10D0\u10E0\u10D0\u10D7\u10D8\u10E1 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8", jwt: "JWT", template_literal: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0" }; @@ -18225,17 +19554,18 @@ var error25 = () => { }; function ka_default() { return { - localeError: error25() + localeError: error29() }; } // node_modules/zod/v4/locales/km.js -var error26 = () => { +var error30 = () => { const Sizable = { string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }, file: { unit: "\u1794\u17C3", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }, array: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }, - set: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" } + set: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }, + map: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -18261,12 +19591,14 @@ var error26 = () => { duration: "\u179A\u1799\u17C8\u1796\u17C1\u179B ISO", ipv4: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4", ipv6: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6", + mac: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 MAC", cidrv4: "\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4", cidrv6: "\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6", base64: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64", base64url: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url", json_string: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON", e164: "\u179B\u17C1\u1781 E.164", + credit_card: "\u179B\u17C1\u1781\u1794\u17D0\u178E\u17D2\u178E\u17A5\u178E\u1791\u17B6\u1793", jwt: "JWT", template_literal: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B" }; @@ -18336,7 +19668,7 @@ var error26 = () => { }; function km_default() { return { - localeError: error26() + localeError: error30() }; } @@ -18345,22 +19677,23 @@ function kh_default() { return km_default(); } -// node_modules/zod/v4/locales/ko.js -var error27 = () => { +// node_modules/zod/v4/locales/kn.js +var error31 = () => { const Sizable = { - string: { unit: "\uBB38\uC790", verb: "to have" }, - file: { unit: "\uBC14\uC774\uD2B8", verb: "to have" }, - array: { unit: "\uAC1C", verb: "to have" }, - set: { unit: "\uAC1C", verb: "to have" } + string: { unit: "\u0C85\u0C95\u0CCD\u0CB7\u0CB0\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" }, + file: { unit: "\u0CAC\u0CC8\u0C9F\u0CCD\u200C\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" }, + array: { unit: "\u0CB5\u0CB8\u0CCD\u0CA4\u0CC1\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" }, + set: { unit: "\u0CB5\u0CB8\u0CCD\u0CA4\u0CC1\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" }, + map: { unit: "entries", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" } }; function getSizing(origin) { return Sizable[origin] ?? null; } const FormatDictionary = { - regex: "\uC785\uB825", - email: "\uC774\uBA54\uC77C \uC8FC\uC18C", + regex: "\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD", + email: "email \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8", url: "URL", - emoji: "\uC774\uBAA8\uC9C0", + emoji: "emoji", uuid: "UUID", uuidv4: "UUIDv4", uuidv6: "UUIDv6", @@ -18371,18 +19704,134 @@ var error27 = () => { ulid: "ULID", xid: "XID", ksuid: "KSUID", - datetime: "ISO \uB0A0\uC9DC\uC2DC\uAC04", - date: "ISO \uB0A0\uC9DC", - time: "ISO \uC2DC\uAC04", - duration: "ISO \uAE30\uAC04", - ipv4: "IPv4 \uC8FC\uC18C", - ipv6: "IPv6 \uC8FC\uC18C", - cidrv4: "IPv4 \uBC94\uC704", - cidrv6: "IPv6 \uBC94\uC704", - base64: "base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4", + datetime: "ISO \u0CA6\u0CBF\u0CA8\u0CBE\u0C82\u0C95\u0CA6 \u0CB8\u0CAE\u0CAF", + date: "ISO \u0CA6\u0CBF\u0CA8\u0CBE\u0C82\u0C95", + time: "ISO \u0CB8\u0CAE\u0CAF", + duration: "ISO \u0C85\u0CB5\u0CA7\u0CBF", + ipv4: "IPv4 \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8", + ipv6: "IPv6 \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8", + mac: "MAC \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8", + cidrv4: "IPv4 \u0CB5\u0CCD\u0CAF\u0CBE\u0CAA\u0CCD\u0CA4\u0CBF\u0CAF", + cidrv6: "IPv6 \u0CB5\u0CCD\u0CAF\u0CBE\u0CAA\u0CCD\u0CA4\u0CBF\u0CAF", + base64: "base64-encoded\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD", + base64url: "base64url-encoded\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD", + json_string: "JSON\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD", + e164: "E.164 \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6", + credit_card: "\u0C95\u0CCD\u0CB0\u0CC6\u0CA1\u0CBF\u0C9F\u0CCD \u0C95\u0CBE\u0CB0\u0CCD\u0CA1\u0CCD \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6", + jwt: "JWT", + template_literal: "\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD" + }; + const TypeDictionary = { + // Compatibility: "nan" -> "NaN" for display + nan: "NaN" + // All other type names omitted - they fall back to raw values via ?? operator + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": { + const expected = TypeDictionary[issue2.expected] ?? issue2.expected; + const receivedType = parsedType(issue2.input); + const received = TypeDictionary[receivedType] ?? receivedType; + return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${expected}, \u0CB8\u0CCD\u0CB5\u0CC0\u0C95\u0CB0\u0CBF\u0CB8\u0CBF\u0CA6\u0CA8\u0CC1 ${received}`; + } + case "invalid_value": + if (issue2.values.length === 1) + return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${stringifyPrimitive(issue2.values[0])}`; + return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C86\u0CAF\u0CCD\u0C95\u0CC6: \u0C87\u0CB5\u0CC1\u0C97\u0CB3\u0CB2\u0CCD\u0CB2\u0CBF \u0C92\u0C82\u0CA6\u0CA8\u0CCD\u0CA8\u0CC1 \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0CA6\u0CCA\u0CA1\u0CCD\u0CA1\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${issue2.origin ?? "value"} \u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0C85\u0C82\u0CB6\u0C97\u0CB3\u0CC1"}`; + return `\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0CA6\u0CCA\u0CA1\u0CCD\u0CA1\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${issue2.origin ?? "value"} \u0C8E\u0C82\u0CA6\u0CC1 ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0C9A\u0CBF\u0C95\u0CCD\u0C95\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${issue2.origin} \u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1 ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + } + return `\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0C9A\u0CBF\u0C95\u0CCD\u0C95\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${issue2.origin} \u0C8E\u0C82\u0CA6\u0CC1 ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { + return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C87\u0CA6\u0CB0\u0CCA\u0C82\u0CA6\u0CBF\u0C97\u0CC6 \u0CAA\u0CCD\u0CB0\u0CBE\u0CB0\u0C82\u0CAD\u0CBF\u0CB8\u0CAC\u0CC7\u0C95\u0CC1 "${_issue.prefix}"`; + } + if (_issue.format === "ends_with") + return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C87\u0CA6\u0CB0\u0CCA\u0C82\u0CA6\u0CBF\u0C97\u0CC6 \u0C95\u0CCA\u0CA8\u0CC6\u0C97\u0CCA\u0CB3\u0CCD\u0CB3\u0CAC\u0CC7\u0C95\u0CC1 "${_issue.suffix}"`; + if (_issue.format === "includes") + return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C92\u0CB3\u0C97\u0CCA\u0C82\u0CA1\u0CBF\u0CB0\u0CAC\u0CC7\u0C95\u0CC1 "${_issue.includes}"`; + if (_issue.format === "regex") + return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0CAE\u0CBE\u0CA6\u0CB0\u0CBF\u0C97\u0CC6 \u0CB9\u0CCA\u0C82\u0CA6\u0CBF\u0C95\u0CC6\u0CAF\u0CBE\u0C97\u0CAC\u0CC7\u0C95\u0CC1 ${_issue.pattern}`; + return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF ${FormatDictionary[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6: \u0CAC\u0CB9\u0CC1\u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6\u0CAF\u0CBE\u0C97\u0CBF\u0CB0\u0CAC\u0CC7\u0C95\u0CC1 ${issue2.divisor}`; + case "unrecognized_keys": + return `\u0C97\u0CC1\u0CB0\u0CC1\u0CA4\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CA6 \u0C95\u0CC0 ${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0C95\u0CC0 \u0C87\u0CA8\u0CCD ${issue2.origin}`; + case "invalid_union": + if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { + const opts = issue2.options.map((o) => `'${o}'`).join(" | "); + return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CA4\u0CBE\u0CB0\u0CA4\u0CAE\u0CCD\u0CAF \u0CAE\u0CCC\u0CB2\u0CCD\u0CAF. \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${opts}`; + } + return "\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD"; + case "invalid_element": + return `\u0CB0\u0CB2\u0CCD\u0CB2\u0CBF \u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CAE\u0CCC\u0CB2\u0CCD\u0CAF ${issue2.origin}`; + default: + return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD`; + } + }; +}; +function kn_default() { + return { + localeError: error31() + }; +} + +// node_modules/zod/v4/locales/ko.js +var error32 = () => { + const Sizable = { + string: { unit: "\uBB38\uC790", verb: "to have" }, + file: { unit: "\uBC14\uC774\uD2B8", verb: "to have" }, + array: { unit: "\uAC1C", verb: "to have" }, + set: { unit: "\uAC1C", verb: "to have" }, + map: { unit: "\uAC1C", verb: "to have" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const FormatDictionary = { + regex: "\uC785\uB825", + email: "\uC774\uBA54\uC77C \uC8FC\uC18C", + url: "URL", + emoji: "\uC774\uBAA8\uC9C0", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO \uB0A0\uC9DC\uC2DC\uAC04", + date: "ISO \uB0A0\uC9DC", + time: "ISO \uC2DC\uAC04", + duration: "ISO \uAE30\uAC04", + ipv4: "IPv4 \uC8FC\uC18C", + ipv6: "IPv6 \uC8FC\uC18C", + mac: "MAC \uC8FC\uC18C", + cidrv4: "IPv4 \uBC94\uC704", + cidrv6: "IPv6 \uBC94\uC704", + base64: "base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4", base64url: "base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4", json_string: "JSON \uBB38\uC790\uC5F4", e164: "E.164 \uBC88\uD638", + credit_card: "\uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638", jwt: "JWT", template_literal: "\uC785\uB825" }; @@ -18453,7 +19902,7 @@ var error27 = () => { }; function ko_default() { return { - localeError: error27() + localeError: error32() }; } @@ -18471,7 +19920,7 @@ function getUnitTypeFromNumber(number4) { return "one"; return "few"; } -var error28 = () => { +var error33 = () => { const Sizable = { string: { unit: { @@ -18572,12 +20021,14 @@ var error28 = () => { duration: "ISO trukm\u0117", ipv4: "IPv4 adresas", ipv6: "IPv6 adresas", + mac: "MAC adresas", cidrv4: "IPv4 tinklo prefiksas (CIDR)", cidrv6: "IPv6 tinklo prefiksas (CIDR)", base64: "base64 u\u017Ekoduota eilut\u0117", base64url: "base64url u\u017Ekoduota eilut\u0117", json_string: "JSON eilut\u0117", e164: "E.164 numeris", + credit_card: "kredito kortel\u0117s numeris", jwt: "JWT", template_literal: "\u012Fvestis" }; @@ -18657,17 +20108,18 @@ var error28 = () => { }; function lt_default() { return { - localeError: error28() + localeError: error33() }; } // node_modules/zod/v4/locales/mk.js -var error29 = () => { +var error34 = () => { const Sizable = { string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }, file: { unit: "\u0431\u0430\u0458\u0442\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }, array: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }, - set: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" } + set: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }, + map: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -18693,12 +20145,14 @@ var error29 = () => { duration: "ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435", ipv4: "IPv4 \u0430\u0434\u0440\u0435\u0441\u0430", ipv6: "IPv6 \u0430\u0434\u0440\u0435\u0441\u0430", + mac: "MAC \u0430\u0434\u0440\u0435\u0441\u0430", cidrv4: "IPv4 \u043E\u043F\u0441\u0435\u0433", cidrv6: "IPv6 \u043E\u043F\u0441\u0435\u0433", base64: "base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430", base64url: "base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430", json_string: "JSON \u043D\u0438\u0437\u0430", e164: "E.164 \u0431\u0440\u043E\u0458", + credit_card: "\u0431\u0440\u043E\u0458 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0438\u0447\u043A\u0430", jwt: "JWT", template_literal: "\u0432\u043D\u0435\u0441" }; @@ -18767,17 +20221,18 @@ var error29 = () => { }; function mk_default() { return { - localeError: error29() + localeError: error34() }; } // node_modules/zod/v4/locales/ms.js -var error30 = () => { +var error35 = () => { const Sizable = { string: { unit: "aksara", verb: "mempunyai" }, file: { unit: "bait", verb: "mempunyai" }, array: { unit: "elemen", verb: "mempunyai" }, - set: { unit: "elemen", verb: "mempunyai" } + set: { unit: "elemen", verb: "mempunyai" }, + map: { unit: "elemen", verb: "mempunyai" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -18803,12 +20258,14 @@ var error30 = () => { duration: "tempoh ISO", ipv4: "alamat IPv4", ipv6: "alamat IPv6", + mac: "alamat MAC", cidrv4: "julat IPv4", cidrv6: "julat IPv6", base64: "string dikodkan base64", base64url: "string dikodkan base64url", json_string: "string JSON", e164: "nombor E.164", + credit_card: "nombor kad kredit", jwt: "JWT", template_literal: "input" }; @@ -18875,17 +20332,128 @@ var error30 = () => { }; function ms_default() { return { - localeError: error30() + localeError: error35() + }; +} + +// node_modules/zod/v4/locales/ne.js +var error36 = () => { + const Sizable = { + string: { unit: "\u0905\u0915\u094D\u0937\u0930", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" }, + file: { unit: "\u092C\u093E\u0907\u091F", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" }, + array: { unit: "\u0924\u0924\u094D\u0935", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" }, + set: { unit: "\u0924\u0924\u094D\u0935", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" }, + map: { unit: "\u092A\u094D\u0930\u0935\u093F\u0937\u094D\u091F\u093F", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const FormatDictionary = { + regex: "\u0907\u0928\u092A\u0941\u091F", + email: "\u0907\u092E\u0947\u0932 \u0920\u0947\u0917\u093E\u0928\u093E", + url: "URL", + emoji: "\u0907\u092E\u094B\u091C\u0940", + uuid: "UUID", + uuidv4: "UUIDv4", + uuidv6: "UUIDv6", + nanoid: "nanoid", + guid: "GUID", + cuid: "cuid", + cuid2: "cuid2", + ulid: "ULID", + xid: "XID", + ksuid: "KSUID", + datetime: "ISO \u092E\u093F\u0924\u093F \u0930 \u0938\u092E\u092F", + date: "ISO \u092E\u093F\u0924\u093F", + time: "ISO \u0938\u092E\u092F", + duration: "ISO \u0905\u0935\u0927\u093F", + ipv4: "IPv4 \u0920\u0947\u0917\u093E\u0928\u093E", + ipv6: "IPv6 \u0920\u0947\u0917\u093E\u0928\u093E", + mac: "MAC \u0920\u0947\u0917\u093E\u0928\u093E", + cidrv4: "IPv4 \u0926\u093E\u092F\u0930\u093E", + cidrv6: "IPv6 \u0926\u093E\u092F\u0930\u093E", + base64: "base64-\u0907\u0928\u094D\u0915\u094B\u0921 \u0917\u0930\u093F\u090F\u0915\u094B \u0938\u094D\u091F\u094D\u0930\u093F\u0919", + base64url: "base64url-\u0907\u0928\u094D\u0915\u094B\u0921 \u0917\u0930\u093F\u090F\u0915\u094B \u0938\u094D\u091F\u094D\u0930\u093F\u0919", + json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0919", + e164: "E.164 \u0928\u092E\u094D\u092C\u0930", + credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0928\u092E\u094D\u092C\u0930", + jwt: "JWT", + template_literal: "\u0907\u0928\u092A\u0941\u091F" + }; + const TypeDictionary = { + nan: "NaN" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": { + const expected = TypeDictionary[issue2.expected] ?? issue2.expected; + const receivedType = parsedType(issue2.input); + const received = TypeDictionary[receivedType] ?? receivedType; + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${expected}, \u092A\u094D\u0930\u093E\u092A\u094D\u0924 ${received}`; + } + case "invalid_value": + if (issue2.values.length === 1) + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${stringifyPrimitive(issue2.values[0])}`; + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0935\u093F\u0915\u0932\u094D\u092A: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u092E\u093E\u0928\u0939\u0930\u0942 \u092E\u0927\u094D\u092F\u0947 \u090F\u0915 ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u0927\u0947\u0930\u0948 \u0920\u0942\u0932\u094B: ${issue2.origin ?? "\u092E\u093E\u0928"} \u092E\u093E ${adj}${issue2.maximum.toString()} ${sizing.unit} ${sizing.verb}`; + return `\u0927\u0947\u0930\u0948 \u0920\u0942\u0932\u094B: ${issue2.origin ?? "\u092E\u093E\u0928"} ${adj}${issue2.maximum.toString()} \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `\u0927\u0947\u0930\u0948 \u0938\u093E\u0928\u094B: ${issue2.origin} \u092E\u093E ${adj}${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`; + return `\u0927\u0947\u0930\u0948 \u0938\u093E\u0928\u094B: ${issue2.origin} ${adj}${issue2.minimum.toString()} \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${_issue.prefix}" \u092C\u093E\u091F \u0938\u0941\u0930\u0941 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`; + if (_issue.format === "ends_with") + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${_issue.suffix}" \u092E\u093E \u0938\u092E\u093E\u092A\u094D\u0924 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`; + if (_issue.format === "includes") + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${_issue.includes}" \u0938\u092E\u093E\u0935\u0947\u0936 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`; + if (_issue.format === "regex") + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: \u0922\u093E\u0901\u091A\u093E ${_issue.pattern} \u0938\u0901\u0917 \u092E\u0947\u0932 \u0916\u093E\u0928\u0941\u092A\u0930\u094D\u091B`; + return `\u0905\u092E\u093E\u0928\u094D\u092F ${FormatDictionary[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u0902\u0916\u094D\u092F\u093E: ${issue2.divisor} \u0915\u094B \u0917\u0941\u0923\u091C \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`; + case "unrecognized_keys": + return `\u0905\u092A\u0930\u093F\u091A\u093F\u0924 \u0915\u0941\u091E\u094D\u091C\u0940${issue2.keys.length > 1 ? "\u0939\u0930\u0942" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0915\u0941\u091E\u094D\u091C\u0940: ${issue2.origin} \u092E\u093E`; + case "invalid_union": + if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { + const opts = issue2.options.map((o) => `'${o}'`).join(" | "); + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0921\u093F\u0938\u094D\u0915\u094D\u0930\u093F\u092E\u093F\u0928\u0947\u091F\u0930 \u092E\u093E\u0928: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${opts}`; + } + return "\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F"; + case "invalid_element": + return `\u0905\u092E\u093E\u0928\u094D\u092F \u092E\u093E\u0928: ${issue2.origin} \u092E\u093E`; + default: + return `\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F`; + } + }; +}; +function ne_default() { + return { + localeError: error36() }; } // node_modules/zod/v4/locales/nl.js -var error31 = () => { +var error37 = () => { const Sizable = { string: { unit: "tekens", verb: "heeft" }, file: { unit: "bytes", verb: "heeft" }, array: { unit: "elementen", verb: "heeft" }, - set: { unit: "elementen", verb: "heeft" } + set: { unit: "elementen", verb: "heeft" }, + map: { unit: "elementen", verb: "heeft" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -18911,12 +20479,14 @@ var error31 = () => { duration: "ISO duur", ipv4: "IPv4-adres", ipv6: "IPv6-adres", + mac: "MAC-adres", cidrv4: "IPv4-bereik", cidrv6: "IPv6-bereik", base64: "base64-gecodeerde tekst", base64url: "base64 URL-gecodeerde tekst", json_string: "JSON string", e164: "E.164-nummer", + credit_card: "creditcardnummer", jwt: "JWT", template_literal: "invoer" }; @@ -18986,17 +20556,18 @@ var error31 = () => { }; function nl_default() { return { - localeError: error31() + localeError: error37() }; } -// node_modules/zod/v4/locales/no.js -var error32 = () => { +// node_modules/zod/v4/locales/nn.js +var error38 = () => { const Sizable = { - string: { unit: "tegn", verb: "\xE5 ha" }, + string: { unit: "teikn", verb: "\xE5 ha" }, file: { unit: "bytes", verb: "\xE5 ha" }, - array: { unit: "elementer", verb: "\xE5 inneholde" }, - set: { unit: "elementer", verb: "\xE5 inneholde" } + array: { unit: "element", verb: "\xE5 innehalde" }, + set: { unit: "element", verb: "\xE5 innehalde" }, + map: { unit: "element", verb: "\xE5 innehalde" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -19019,21 +20590,23 @@ var error32 = () => { datetime: "ISO dato- og klokkeslett", date: "ISO-dato", time: "ISO-klokkeslett", - duration: "ISO-varighet", - ipv4: "IPv4-omr\xE5de", - ipv6: "IPv6-omr\xE5de", + duration: "ISO-varigheit", + ipv4: "IPv4-adresse", + ipv6: "IPv6-adresse", + mac: "MAC-adresse", cidrv4: "IPv4-spekter", cidrv6: "IPv6-spekter", - base64: "base64-enkodet streng", - base64url: "base64url-enkodet streng", + base64: "base64-enkoda streng", + base64url: "base64url-enkoda streng", json_string: "JSON-streng", e164: "E.164-nummer", + credit_card: "kredittkortnummer", jwt: "JWT", template_literal: "input" }; const TypeDictionary = { nan: "NaN", - number: "tall", + number: "tal", array: "liste" }; return (issue2) => { @@ -19043,45 +20616,45 @@ var error32 = () => { const receivedType = parsedType(issue2.input); const received = TypeDictionary[receivedType] ?? receivedType; if (/^[A-Z]/.test(issue2.expected)) { - return `Ugyldig input: forventet instanceof ${issue2.expected}, fikk ${received}`; + return `Ugyldig input: forventa instanceof ${issue2.expected}, fekk ${received}`; } - return `Ugyldig input: forventet ${expected}, fikk ${received}`; + return `Ugyldig input: forventa ${expected}, fekk ${received}`; } case "invalid_value": if (issue2.values.length === 1) - return `Ugyldig verdi: forventet ${stringifyPrimitive(issue2.values[0])}`; - return `Ugyldig valg: forventet en av ${joinValues(issue2.values, "|")}`; + return `Ugyldig verdi: forventa ${stringifyPrimitive(issue2.values[0])}`; + return `Ugyldig val: forventa eitt av ${joinValues(issue2.values, "|")}`; case "too_big": { const adj = issue2.inclusive ? "<=" : "<"; const sizing = getSizing(issue2.origin); if (sizing) - return `For stor(t): forventet ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementer"}`; - return `For stor(t): forventet ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()}`; + return `For stor(t): forventa ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element"}`; + return `For stor(t): forventa ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()}`; } case "too_small": { const adj = issue2.inclusive ? ">=" : ">"; const sizing = getSizing(issue2.origin); if (sizing) { - return `For lite(n): forventet ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + return `For lite(n): forventa ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`; } - return `For lite(n): forventet ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()}`; + return `For lite(n): forventa ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()}`; } case "invalid_format": { const _issue = issue2; if (_issue.format === "starts_with") return `Ugyldig streng: m\xE5 starte med "${_issue.prefix}"`; if (_issue.format === "ends_with") - return `Ugyldig streng: m\xE5 ende med "${_issue.suffix}"`; + return `Ugyldig streng: m\xE5 slutte med "${_issue.suffix}"`; if (_issue.format === "includes") - return `Ugyldig streng: m\xE5 inneholde "${_issue.includes}"`; + return `Ugyldig streng: m\xE5 innehalde "${_issue.includes}"`; if (_issue.format === "regex") return `Ugyldig streng: m\xE5 matche m\xF8nsteret ${_issue.pattern}`; return `Ugyldig ${FormatDictionary[_issue.format] ?? issue2.format}`; } case "not_multiple_of": - return `Ugyldig tall: m\xE5 v\xE6re et multiplum av ${issue2.divisor}`; + return `Ugyldig tal: m\xE5 vere eit multiplum av ${issue2.divisor}`; case "unrecognized_keys": - return `${issue2.keys.length > 1 ? "Ukjente n\xF8kler" : "Ukjent n\xF8kkel"}: ${joinValues(issue2.keys, ", ")}`; + return `${issue2.keys.length > 1 ? "Ukjende n\xF8klar" : "Ukjend n\xF8kkel"}: ${joinValues(issue2.keys, ", ")}`; case "invalid_key": return `Ugyldig n\xF8kkel i ${issue2.origin}`; case "invalid_union": @@ -19093,26 +20666,27 @@ var error32 = () => { } }; }; -function no_default() { +function nn_default() { return { - localeError: error32() + localeError: error38() }; } -// node_modules/zod/v4/locales/ota.js -var error33 = () => { +// node_modules/zod/v4/locales/no.js +var error39 = () => { const Sizable = { - string: { unit: "harf", verb: "olmal\u0131d\u0131r" }, - file: { unit: "bayt", verb: "olmal\u0131d\u0131r" }, - array: { unit: "unsur", verb: "olmal\u0131d\u0131r" }, - set: { unit: "unsur", verb: "olmal\u0131d\u0131r" } + string: { unit: "tegn", verb: "\xE5 ha" }, + file: { unit: "bytes", verb: "\xE5 ha" }, + array: { unit: "elementer", verb: "\xE5 inneholde" }, + set: { unit: "elementer", verb: "\xE5 inneholde" }, + map: { unit: "elementer", verb: "\xE5 inneholde" } }; function getSizing(origin) { return Sizable[origin] ?? null; } const FormatDictionary = { - regex: "giren", - email: "epostag\xE2h", + regex: "input", + email: "e-postadresse", url: "URL", emoji: "emoji", uuid: "UUID", @@ -19125,26 +20699,27 @@ var error33 = () => { ulid: "ULID", xid: "XID", ksuid: "KSUID", - datetime: "ISO heng\xE2m\u0131", - date: "ISO tarihi", - time: "ISO zaman\u0131", - duration: "ISO m\xFCddeti", - ipv4: "IPv4 ni\u015F\xE2n\u0131", - ipv6: "IPv6 ni\u015F\xE2n\u0131", - cidrv4: "IPv4 menzili", - cidrv6: "IPv6 menzili", - base64: "base64-\u015Fifreli metin", - base64url: "base64url-\u015Fifreli metin", - json_string: "JSON metin", - e164: "E.164 say\u0131s\u0131", + datetime: "ISO dato- og klokkeslett", + date: "ISO-dato", + time: "ISO-klokkeslett", + duration: "ISO-varighet", + ipv4: "IPv4-adresse", + ipv6: "IPv6-adresse", + mac: "MAC-adresse", + cidrv4: "IPv4-spekter", + cidrv6: "IPv6-spekter", + base64: "base64-enkodet streng", + base64url: "base64url-enkodet streng", + json_string: "JSON-streng", + e164: "E.164-nummer", + credit_card: "kredittkortnummer", jwt: "JWT", - template_literal: "giren" + template_literal: "input" }; const TypeDictionary = { nan: "NaN", - number: "numara", - array: "saf", - null: "gayb" + number: "tall", + array: "liste" }; return (issue2) => { switch (issue2.code) { @@ -19153,33 +20728,146 @@ var error33 = () => { const receivedType = parsedType(issue2.input); const received = TypeDictionary[receivedType] ?? receivedType; if (/^[A-Z]/.test(issue2.expected)) { - return `F\xE2sit giren: umulan instanceof ${issue2.expected}, al\u0131nan ${received}`; + return `Ugyldig input: forventet instanceof ${issue2.expected}, fikk ${received}`; } - return `F\xE2sit giren: umulan ${expected}, al\u0131nan ${received}`; + return `Ugyldig input: forventet ${expected}, fikk ${received}`; } case "invalid_value": if (issue2.values.length === 1) - return `F\xE2sit giren: umulan ${stringifyPrimitive(issue2.values[0])}`; - return `F\xE2sit tercih: m\xFBteberler ${joinValues(issue2.values, "|")}`; + return `Ugyldig verdi: forventet ${stringifyPrimitive(issue2.values[0])}`; + return `Ugyldig valg: forventet en av ${joinValues(issue2.values, "|")}`; case "too_big": { const adj = issue2.inclusive ? "<=" : "<"; const sizing = getSizing(issue2.origin); if (sizing) - return `Fazla b\xFCy\xFCk: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"} sahip olmal\u0131yd\u0131.`; - return `Fazla b\xFCy\xFCk: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} olmal\u0131yd\u0131.`; + return `For stor(t): forventet ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementer"}`; + return `For stor(t): forventet ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()}`; } case "too_small": { const adj = issue2.inclusive ? ">=" : ">"; const sizing = getSizing(issue2.origin); if (sizing) { - return `Fazla k\xFC\xE7\xFCk: ${issue2.origin}, ${adj}${issue2.minimum.toString()} ${sizing.unit} sahip olmal\u0131yd\u0131.`; + return `For lite(n): forventet ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`; } - return `Fazla k\xFC\xE7\xFCk: ${issue2.origin}, ${adj}${issue2.minimum.toString()} olmal\u0131yd\u0131.`; + return `For lite(n): forventet ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()}`; } case "invalid_format": { const _issue = issue2; if (_issue.format === "starts_with") - return `F\xE2sit metin: "${_issue.prefix}" ile ba\u015Flamal\u0131.`; + return `Ugyldig streng: m\xE5 starte med "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Ugyldig streng: m\xE5 ende med "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Ugyldig streng: m\xE5 inneholde "${_issue.includes}"`; + if (_issue.format === "regex") + return `Ugyldig streng: m\xE5 matche m\xF8nsteret ${_issue.pattern}`; + return `Ugyldig ${FormatDictionary[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Ugyldig tall: m\xE5 v\xE6re et multiplum av ${issue2.divisor}`; + case "unrecognized_keys": + return `${issue2.keys.length > 1 ? "Ukjente n\xF8kler" : "Ukjent n\xF8kkel"}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Ugyldig n\xF8kkel i ${issue2.origin}`; + case "invalid_union": + return "Ugyldig input"; + case "invalid_element": + return `Ugyldig verdi i ${issue2.origin}`; + default: + return `Ugyldig input`; + } + }; +}; +function no_default() { + return { + localeError: error39() + }; +} + +// node_modules/zod/v4/locales/ota.js +var error40 = () => { + const Sizable = { + string: { unit: "harf", verb: "olmal\u0131d\u0131r" }, + file: { unit: "bayt", verb: "olmal\u0131d\u0131r" }, + array: { unit: "unsur", verb: "olmal\u0131d\u0131r" }, + set: { unit: "unsur", verb: "olmal\u0131d\u0131r" }, + map: { unit: "unsur", verb: "olmal\u0131d\u0131r" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const FormatDictionary = { + regex: "giren", + email: "epostag\xE2h", + 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\xE2m\u0131", + date: "ISO tarihi", + time: "ISO zaman\u0131", + duration: "ISO m\xFCddeti", + ipv4: "IPv4 ni\u015F\xE2n\u0131", + ipv6: "IPv6 ni\u015F\xE2n\u0131", + mac: "MAC ni\u015F\xE2n\u0131", + cidrv4: "IPv4 menzili", + cidrv6: "IPv6 menzili", + base64: "base64-\u015Fifreli metin", + base64url: "base64url-\u015Fifreli metin", + json_string: "JSON metin", + e164: "E.164 say\u0131s\u0131", + credit_card: "i'tib\xE2r kart\u0131 numaras\u0131", + jwt: "JWT", + template_literal: "giren" + }; + const TypeDictionary = { + nan: "NaN", + number: "numara", + array: "saf", + null: "gayb" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": { + const expected = TypeDictionary[issue2.expected] ?? issue2.expected; + const receivedType = parsedType(issue2.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue2.expected)) { + return `F\xE2sit giren: umulan instanceof ${issue2.expected}, al\u0131nan ${received}`; + } + return `F\xE2sit giren: umulan ${expected}, al\u0131nan ${received}`; + } + case "invalid_value": + if (issue2.values.length === 1) + return `F\xE2sit giren: umulan ${stringifyPrimitive(issue2.values[0])}`; + return `F\xE2sit tercih: m\xFBteberler ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Fazla b\xFCy\xFCk: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"} sahip olmal\u0131yd\u0131.`; + return `Fazla b\xFCy\xFCk: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} olmal\u0131yd\u0131.`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Fazla k\xFC\xE7\xFCk: ${issue2.origin}, ${adj}${issue2.minimum.toString()} ${sizing.unit} sahip olmal\u0131yd\u0131.`; + } + return `Fazla k\xFC\xE7\xFCk: ${issue2.origin}, ${adj}${issue2.minimum.toString()} olmal\u0131yd\u0131.`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `F\xE2sit metin: "${_issue.prefix}" ile ba\u015Flamal\u0131.`; if (_issue.format === "ends_with") return `F\xE2sit metin: "${_issue.suffix}" ile bitmeli.`; if (_issue.format === "includes") @@ -19205,17 +20893,18 @@ var error33 = () => { }; function ota_default() { return { - localeError: error33() + localeError: error40() }; } // node_modules/zod/v4/locales/ps.js -var error34 = () => { +var error41 = () => { const Sizable = { string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" }, file: { unit: "\u0628\u0627\u06CC\u067C\u0633", verb: "\u0648\u0644\u0631\u064A" }, array: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" }, - set: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" } + set: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" }, + map: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -19241,12 +20930,14 @@ var error34 = () => { duration: "\u0645\u0648\u062F\u0647", ipv4: "\u062F IPv4 \u067E\u062A\u0647", ipv6: "\u062F IPv6 \u067E\u062A\u0647", + mac: "\u062F MAC \u067E\u062A\u0647", cidrv4: "\u062F IPv4 \u0633\u0627\u062D\u0647", cidrv6: "\u062F IPv6 \u0633\u0627\u062D\u0647", base64: "base64-encoded \u0645\u062A\u0646", base64url: "base64url-encoded \u0645\u062A\u0646", json_string: "JSON \u0645\u062A\u0646", e164: "\u062F E.164 \u0634\u0645\u06D0\u0631\u0647", + credit_card: "\u062F \u06A9\u0631\u06CC\u0689\u06CC\u067C \u06A9\u0627\u0631\u062A \u0634\u0645\u06CC\u0631\u0647", jwt: "JWT", template_literal: "\u0648\u0631\u0648\u062F\u064A" }; @@ -19320,17 +21011,18 @@ var error34 = () => { }; function ps_default() { return { - localeError: error34() + localeError: error41() }; } // node_modules/zod/v4/locales/pl.js -var error35 = () => { +var error42 = () => { const Sizable = { string: { unit: "znak\xF3w", verb: "mie\u0107" }, file: { unit: "bajt\xF3w", verb: "mie\u0107" }, array: { unit: "element\xF3w", verb: "mie\u0107" }, - set: { unit: "element\xF3w", verb: "mie\u0107" } + set: { unit: "element\xF3w", verb: "mie\u0107" }, + map: { unit: "element\xF3w", verb: "mie\u0107" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -19356,12 +21048,14 @@ var error35 = () => { duration: "czas trwania ISO", ipv4: "adres IPv4", ipv6: "adres IPv6", + mac: "adres MAC", cidrv4: "zakres IPv4", cidrv6: "zakres IPv6", base64: "ci\u0105g znak\xF3w zakodowany w formacie base64", base64url: "ci\u0105g znak\xF3w zakodowany w formacie base64url", json_string: "ci\u0105g znak\xF3w w formacie JSON", e164: "liczba E.164", + credit_card: "numer karty kredytowej", jwt: "JWT", template_literal: "wej\u015Bcie" }; @@ -19430,121 +21124,297 @@ var error35 = () => { }; function pl_default() { return { - localeError: error35() + localeError: error42() }; } // node_modules/zod/v4/locales/pt.js -var error36 = () => { +var error43 = () => { const Sizable = { - string: { unit: "caracteres", verb: "ter" }, - file: { unit: "bytes", verb: "ter" }, - array: { unit: "itens", verb: "ter" }, - set: { unit: "itens", verb: "ter" } + string: { unit: "caracteres" }, + file: { unit: "bytes" }, + array: { unit: "elementos" }, + set: { unit: "elementos" }, + map: { unit: "entradas" } }; function getSizing(origin) { return Sizable[origin] ?? null; } const FormatDictionary = { - regex: "padr\xE3o", - email: "endere\xE7o 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\xE7\xE3o ISO", - ipv4: "endere\xE7o IPv4", - ipv6: "endere\xE7o 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\xFAmero E.164", - jwt: "JWT", - template_literal: "entrada" + regex: "a entrada", + email: "o endere\xE7o de e-mail", + url: "o URL", + emoji: "o emoji", + uuid: "o UUID", + uuidv4: "o UUIDv4", + uuidv6: "o UUIDv6", + nanoid: "o nanoid", + guid: "o GUID", + cuid: "o cuid", + cuid2: "o cuid2", + ulid: "o ULID", + xid: "o XID", + ksuid: "o KSUID", + datetime: "a data e hora ISO", + date: "a data ISO", + time: "a hora ISO", + duration: "a dura\xE7\xE3o ISO", + ipv4: "o endere\xE7o IPv4", + ipv6: "o endere\xE7o IPv6", + mac: "o endere\xE7o MAC", + cidrv4: "o intervalo de endere\xE7os IPv4", + cidrv6: "o intervalo de endere\xE7os IPv6", + base64: "o texto codificado em base64", + base64url: "o texto codificado em base64url", + json_string: "o texto JSON", + e164: "o n\xFAmero E.164", + credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito", + jwt: "o JWT", + template_literal: "a entrada" + }; + const Gender = { + masculine: { definite: "o", indefinite: "um" }, + feminine: { definite: "a", indefinite: "uma" } }; const TypeDictionary = { - nan: "NaN", - number: "n\xFAmero", - null: "nulo" + string: { name: "texto", articles: Gender.masculine }, + number: { name: "n\xFAmero", articles: Gender.masculine }, + int: { name: "n\xFAmero inteiro", articles: Gender.masculine }, + boolean: { name: "valor booleano", articles: Gender.masculine }, + bigint: { name: "n\xFAmero bigint", articles: Gender.masculine }, + symbol: { name: "s\xEDmbolo", articles: Gender.masculine }, + undefined: { name: 'valor "undefined"', articles: Gender.masculine }, + null: { name: 'valor "nulo"', articles: Gender.masculine }, + never: { name: 'valor "never"', articles: Gender.masculine }, + void: { name: 'valor "void"', articles: Gender.masculine }, + date: { name: "data", articles: Gender.feminine }, + array: { name: "vetor", articles: Gender.masculine }, + object: { name: "objeto", articles: Gender.masculine }, + tuple: { name: "tuplo", articles: Gender.masculine }, + record: { name: "registo", articles: Gender.masculine }, + map: { name: "mapa", articles: Gender.masculine }, + set: { name: "conjunto", articles: Gender.masculine }, + file: { name: "ficheiro", articles: Gender.masculine }, + nonoptional: { name: "valor n\xE3o opcional", articles: Gender.masculine }, + nan: { name: 'valor "NaN"', articles: Gender.masculine }, + // Compatibility: "nan" -> "NaN" for display + function: { name: "fun\xE7\xE3o", articles: Gender.feminine } }; + function translateOriginWithArticle(type, articleType) { + const translatedValue = TypeDictionary[type] ?? { name: `valor "${type}"`, articles: Gender.masculine }; + return `${translatedValue.articles[articleType]} ${translatedValue.name}`; + } return (issue2) => { switch (issue2.code) { case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; + const expected = translateOriginWithArticle(issue2.expected, "indefinite"); const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Tipo inv\xE1lido: esperado instanceof ${issue2.expected}, recebido ${received}`; - } - return `Tipo inv\xE1lido: esperado ${expected}, recebido ${received}`; + const received = translateOriginWithArticle(receivedType, "indefinite"); + return `Entrada inv\xE1lida: esperava ${expected}, recebeu ${received}`; } case "invalid_value": if (issue2.values.length === 1) - return `Entrada inv\xE1lida: esperado ${stringifyPrimitive(issue2.values[0])}`; - return `Op\xE7\xE3o inv\xE1lida: esperada uma das ${joinValues(issue2.values, "|")}`; + return `Entrada inv\xE1lida: esperava ${stringifyPrimitive(issue2.values[0])}`; + return `Op\xE7\xE3o inv\xE1lida: esperava uma das seguintes op\xE7\xF5es: ${joinValues(issue2.values, "|")}`; case "too_big": { const adj = issue2.inclusive ? "<=" : "<"; const sizing = getSizing(issue2.origin); if (sizing) - return `Muito grande: esperado que ${issue2.origin ?? "valor"} tivesse ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`; - return `Muito grande: esperado que ${issue2.origin ?? "valor"} fosse ${adj}${issue2.maximum.toString()}`; + return `Demasiado grande: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} tivesse ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`; + return `Demasiado grande: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} fosse ${adj} ${issue2.maximum.toString()}`; } case "too_small": { const adj = issue2.inclusive ? ">=" : ">"; const sizing = getSizing(issue2.origin); if (sizing) { - return `Muito pequeno: esperado que ${issue2.origin} tivesse ${adj}${issue2.minimum.toString()} ${sizing.unit}`; + return `Demasiado pequeno: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} tivesse ${adj} ${issue2.minimum.toString()} ${sizing.unit ?? "elementos"}`; } - return `Muito pequeno: esperado que ${issue2.origin} fosse ${adj}${issue2.minimum.toString()}`; + return `Demasiado pequeno: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} fosse ${adj} ${issue2.minimum.toString()}`; } case "invalid_format": { const _issue = issue2; if (_issue.format === "starts_with") + return `Texto inv\xE1lido: deve come\xE7ar por "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Texto inv\xE1lido: deve terminar em "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Texto inv\xE1lido: deve incluir "${_issue.includes}"`; + if (_issue.format === "regex") + return `Texto inv\xE1lido: deve corresponder ao padr\xE3o ${_issue.pattern}`; + return `Formato d${FormatDictionary[_issue.format] ?? issue2.format} inv\xE1lido`; + } + case "not_multiple_of": + return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`; + case "unrecognized_keys": { + const plural = issue2.keys.length > 1 ? "s" : ""; + return `Chave${plural} inv\xE1lida${plural}: ${joinValues(issue2.keys, ", ")}`; + } + case "invalid_key": + return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`; + case "invalid_union": + if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { + const opts = issue2.options.map((o) => `'${o}'`).join(" | "); + return `Valor de discrimina\xE7\xE3o inv\xE1lido. Esperava ${opts}`; + } + return "Entrada inv\xE1lida"; + case "invalid_element": + return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`; + default: + return `Entrada inv\xE1lida`; + } + }; +}; +function pt_default() { + return { + localeError: error43() + }; +} + +// node_modules/zod/v4/locales/pt-BR.js +var error44 = () => { + const Sizable = { + string: { unit: "caracteres" }, + file: { unit: "bytes" }, + array: { unit: "elementos" }, + set: { unit: "elementos" }, + map: { unit: "entradas" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const FormatDictionary = { + regex: "a entrada", + email: "o endere\xE7o de e-mail", + url: "o URL", + emoji: "o emoji", + uuid: "o UUID", + uuidv4: "o UUIDv4", + uuidv6: "o UUIDv6", + nanoid: "o nanoid", + guid: "o GUID", + cuid: "o cuid", + cuid2: "o cuid2", + ulid: "o ULID", + xid: "o XID", + ksuid: "o KSUID", + datetime: "a data e hora ISO", + date: "a data ISO", + time: "a hora ISO", + duration: "a dura\xE7\xE3o ISO", + ipv4: "o endere\xE7o IPv4", + ipv6: "o endere\xE7o IPv6", + mac: "o endere\xE7o MAC", + cidrv4: "a faixa de endere\xE7os IPv4", + cidrv6: "a faixa de endere\xE7os IPv6", + base64: "o texto codificado em base64", + base64url: "o texto codificado em base64url", + json_string: "o texto JSON", + e164: "o n\xFAmero E.164", + credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito", + jwt: "o JWT", + template_literal: "a entrada" + }; + const Gender = { + masculine: { definite: "o", indefinite: "um" }, + feminine: { definite: "a", indefinite: "uma" } + }; + const TypeDictionary = { + string: { name: "texto", articles: Gender.masculine }, + number: { name: "n\xFAmero", articles: Gender.masculine }, + int: { name: "n\xFAmero inteiro", articles: Gender.masculine }, + boolean: { name: "valor booleano", articles: Gender.masculine }, + bigint: { name: "n\xFAmero bigint", articles: Gender.masculine }, + symbol: { name: "s\xEDmbolo", articles: Gender.masculine }, + undefined: { name: 'valor "undefined"', articles: Gender.masculine }, + null: { name: 'valor "nulo"', articles: Gender.masculine }, + never: { name: 'valor "never"', articles: Gender.masculine }, + void: { name: 'valor "void"', articles: Gender.masculine }, + date: { name: "data", articles: Gender.feminine }, + array: { name: "vetor", articles: Gender.masculine }, + object: { name: "objeto", articles: Gender.masculine }, + tuple: { name: "tupla", articles: Gender.feminine }, + record: { name: "registro", articles: Gender.masculine }, + map: { name: "mapa", articles: Gender.masculine }, + set: { name: "conjunto", articles: Gender.masculine }, + file: { name: "arquivo", articles: Gender.masculine }, + nonoptional: { name: "valor n\xE3o opcional", articles: Gender.masculine }, + nan: { name: 'valor "NaN"', articles: Gender.masculine }, + // Compatibility: "nan" -> "NaN" for display + function: { name: "fun\xE7\xE3o", articles: Gender.feminine } + }; + function translateOriginWithArticle(type, articleType) { + const translatedValue = TypeDictionary[type] ?? { name: `valor "${type}"`, articles: Gender.masculine }; + return `${translatedValue.articles[articleType]} ${translatedValue.name}`; + } + return (issue2) => { + switch (issue2.code) { + case "invalid_type": { + const expected = translateOriginWithArticle(issue2.expected, "indefinite"); + const receivedType = parsedType(issue2.input); + const received = translateOriginWithArticle(receivedType, "indefinite"); + return `Entrada inv\xE1lida: esperava ${expected}, recebeu ${received}`; + } + case "invalid_value": + if (issue2.values.length === 1) + return `Entrada inv\xE1lida: esperava ${stringifyPrimitive(issue2.values[0])}`; + return `Op\xE7\xE3o inv\xE1lida: esperava uma das seguintes op\xE7\xF5es: ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Grande demais: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} tivesse ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`; + return `Grande demais: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} fosse ${adj} ${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Pequeno demais: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} tivesse ${adj} ${issue2.minimum.toString()} ${sizing.unit ?? "elementos"}`; + } + return `Pequeno demais: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} fosse ${adj} ${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") { return `Texto inv\xE1lido: deve come\xE7ar com "${_issue.prefix}"`; + } if (_issue.format === "ends_with") return `Texto inv\xE1lido: deve terminar com "${_issue.suffix}"`; if (_issue.format === "includes") return `Texto inv\xE1lido: deve incluir "${_issue.includes}"`; if (_issue.format === "regex") return `Texto inv\xE1lido: deve corresponder ao padr\xE3o ${_issue.pattern}`; - return `${FormatDictionary[_issue.format] ?? issue2.format} inv\xE1lido`; + return `Formato d${FormatDictionary[_issue.format] ?? issue2.format} inv\xE1lido`; } case "not_multiple_of": return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`; - case "unrecognized_keys": - return `Chave${issue2.keys.length > 1 ? "s" : ""} desconhecida${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "unrecognized_keys": { + const plural = issue2.keys.length > 1 ? "s" : ""; + return `Chave${plural} inv\xE1lida${plural}: ${joinValues(issue2.keys, ", ")}`; + } case "invalid_key": - return `Chave inv\xE1lida em ${issue2.origin}`; + return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`; case "invalid_union": + if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { + const opts = issue2.options.map((o) => `'${o}'`).join(" | "); + return `Valor de discrimina\xE7\xE3o inv\xE1lido. Esperava ${opts}`; + } return "Entrada inv\xE1lida"; case "invalid_element": - return `Valor inv\xE1lido em ${issue2.origin}`; + return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`; default: - return `Campo inv\xE1lido`; + return `Entrada inv\xE1lida`; } }; }; -function pt_default() { +function pt_BR_default() { return { - localeError: error36() + localeError: error44() }; } // node_modules/zod/v4/locales/ro.js -var error37 = () => { +var error45 = () => { const Sizable = { string: { unit: "caractere", verb: "s\u0103 aib\u0103" }, file: { unit: "octe\u021Bi", verb: "s\u0103 aib\u0103" }, @@ -19583,6 +21453,7 @@ var error37 = () => { base64url: "\u0219ir codat base64url", json_string: "\u0219ir JSON", e164: "num\u0103r E.164", + credit_card: "num\u0103r de card de credit", jwt: "JWT", template_literal: "intrare" }; @@ -19659,7 +21530,7 @@ var error37 = () => { }; function ro_default() { return { - localeError: error37() + localeError: error45() }; } @@ -19679,7 +21550,7 @@ function getRussianPlural(count, one, few, many) { } return many; } -var error38 = () => { +var error46 = () => { const Sizable = { string: { unit: { @@ -19712,6 +21583,14 @@ var error38 = () => { many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432" }, verb: "\u0438\u043C\u0435\u0442\u044C" + }, + map: { + unit: { + one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442", + few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430", + many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432" + }, + verb: "\u0438\u043C\u0435\u0442\u044C" } }; function getSizing(origin) { @@ -19738,12 +21617,14 @@ var error38 = () => { duration: "ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C", ipv4: "IPv4 \u0430\u0434\u0440\u0435\u0441", ipv6: "IPv6 \u0430\u0434\u0440\u0435\u0441", + mac: "MAC \u0430\u0434\u0440\u0435\u0441", cidrv4: "IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D", cidrv6: "IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D", base64: "\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64", base64url: "\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url", json_string: "JSON \u0441\u0442\u0440\u043E\u043A\u0430", e164: "\u043D\u043E\u043C\u0435\u0440 E.164", + credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u044B", jwt: "JWT", template_literal: "\u0432\u0432\u043E\u0434" }; @@ -19816,24 +21697,25 @@ var error38 = () => { }; function ru_default() { return { - localeError: error38() + localeError: error46() }; } -// node_modules/zod/v4/locales/sl.js -var error39 = () => { +// node_modules/zod/v4/locales/sk.js +var error47 = () => { const Sizable = { - string: { unit: "znakov", verb: "imeti" }, - file: { unit: "bajtov", verb: "imeti" }, - array: { unit: "elementov", verb: "imeti" }, - set: { unit: "elementov", verb: "imeti" } + string: { unit: "znakov", verb: "ma\u0165" }, + file: { unit: "bajtov", verb: "ma\u0165" }, + array: { unit: "prvkov", verb: "ma\u0165" }, + set: { unit: "prvkov", verb: "ma\u0165" }, + map: { unit: "polo\u017Eiek", verb: "ma\u0165" } }; function getSizing(origin) { return Sizable[origin] ?? null; } const FormatDictionary = { - regex: "vnos", - email: "e-po\u0161tni naslov", + regex: "regul\xE1rny v\xFDraz", + email: "e-mailov\xE1 adresa", url: "URL", emoji: "emoji", uuid: "UUID", @@ -19846,22 +21728,139 @@ var error39 = () => { ulid: "ULID", xid: "XID", ksuid: "KSUID", - datetime: "ISO datum in \u010Das", - date: "ISO datum", - time: "ISO \u010Das", - 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 \u0161tevilka", - jwt: "JWT", - template_literal: "vnos" - }; - const TypeDictionary = { + datetime: "d\xE1tum a \u010Das vo form\xE1te ISO", + date: "d\xE1tum vo form\xE1te ISO", + time: "\u010Das vo form\xE1te ISO", + duration: "doba trvania ISO", + ipv4: "IPv4 adresa", + ipv6: "IPv6 adresa", + mac: "MAC adresa", + cidrv4: "rozsah IPv4", + cidrv6: "rozsah IPv6", + base64: "re\u0165azec zak\xF3dovan\xFD vo form\xE1te base64", + base64url: "re\u0165azec zak\xF3dovan\xFD vo form\xE1te base64url", + json_string: "re\u0165azec vo form\xE1te JSON", + e164: "\u010D\xEDslo E.164", + credit_card: "\u010D\xEDslo kreditnej karty", + jwt: "JWT", + template_literal: "vstup" + }; + const TypeDictionary = { + nan: "NaN", + number: "\u010D\xEDslo", + string: "re\u0165azec", + function: "funkcia", + array: "pole" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": { + const expected = TypeDictionary[issue2.expected] ?? issue2.expected; + const receivedType = parsedType(issue2.input); + const received = TypeDictionary[receivedType] ?? receivedType; + if (/^[A-Z]/.test(issue2.expected)) { + return `Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 instanceof ${issue2.expected}, obdr\u017Ean\xE9 ${received}`; + } + return `Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 ${expected}, obdr\u017Ean\xE9 ${received}`; + } + case "invalid_value": + if (issue2.values.length === 1) + return `Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 ${stringifyPrimitive(issue2.values[0])}`; + return `Neplatn\xFD vstup: o\u010Dak\xE1van\xE1 jedna z hodn\xF4t ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Hodnota je pr\xEDli\u0161 ve\u013Ek\xE1: ${issue2.origin ?? "hodnota"} mus\xED ma\u0165 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "prvkov"}`; + } + return `Hodnota je pr\xEDli\u0161 ve\u013Ek\xE1: ${issue2.origin ?? "hodnota"} mus\xED by\u0165 ${adj}${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) { + return `Hodnota je pr\xEDli\u0161 mal\xE1: ${issue2.origin ?? "hodnota"} mus\xED ma\u0165 ${adj}${issue2.minimum.toString()} ${sizing.unit ?? "prvkov"}`; + } + return `Hodnota je pr\xEDli\u0161 mal\xE1: ${issue2.origin ?? "hodnota"} mus\xED by\u0165 ${adj}${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `Neplatn\xFD re\u0165azec: mus\xED za\u010D\xEDna\u0165 na "${_issue.prefix}"`; + if (_issue.format === "ends_with") + return `Neplatn\xFD re\u0165azec: mus\xED kon\u010Di\u0165 na "${_issue.suffix}"`; + if (_issue.format === "includes") + return `Neplatn\xFD re\u0165azec: mus\xED obsahova\u0165 "${_issue.includes}"`; + if (_issue.format === "regex") + return `Neplatn\xFD re\u0165azec: mus\xED zodpoveda\u0165 vzoru ${_issue.pattern}`; + return `Neplatn\xFD form\xE1t ${FormatDictionary[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `Neplatn\xE9 \u010D\xEDslo: mus\xED by\u0165 n\xE1sobkom ${issue2.divisor}`; + case "unrecognized_keys": + return `Nezn\xE1me kl\xFA\u010De: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `Neplatn\xFD kl\xFA\u010D v ${issue2.origin}`; + case "invalid_union": + return "Neplatn\xFD vstup"; + case "invalid_element": + return `Neplatn\xE1 hodnota v ${issue2.origin}`; + default: + return `Neplatn\xFD vstup`; + } + }; +}; +function sk_default() { + return { + localeError: error47() + }; +} + +// node_modules/zod/v4/locales/sl.js +var error48 = () => { + const Sizable = { + string: { unit: "znakov", verb: "imeti" }, + file: { unit: "bajtov", verb: "imeti" }, + array: { unit: "elementov", verb: "imeti" }, + set: { unit: "elementov", verb: "imeti" }, + map: { unit: "elementov", verb: "imeti" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const FormatDictionary = { + regex: "vnos", + email: "e-po\u0161tni 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 \u010Das", + date: "ISO datum", + time: "ISO \u010Das", + duration: "ISO trajanje", + ipv4: "IPv4 naslov", + ipv6: "IPv6 naslov", + mac: "MAC naslov", + cidrv4: "obseg IPv4", + cidrv6: "obseg IPv6", + base64: "base64 kodiran niz", + base64url: "base64url kodiran niz", + json_string: "JSON niz", + e164: "E.164 \u0161tevilka", + credit_card: "\u0161tevilka kreditne kartice", + jwt: "JWT", + template_literal: "vnos" + }; + const TypeDictionary = { nan: "NaN", number: "\u0161tevilo", array: "tabela" @@ -19926,17 +21925,18 @@ var error39 = () => { }; function sl_default() { return { - localeError: error39() + localeError: error48() }; } // node_modules/zod/v4/locales/sv.js -var error40 = () => { +var error49 = () => { const Sizable = { string: { unit: "tecken", verb: "att ha" }, file: { unit: "bytes", verb: "att ha" }, array: { unit: "objekt", verb: "att inneh\xE5lla" }, - set: { unit: "objekt", verb: "att inneh\xE5lla" } + set: { unit: "objekt", verb: "att inneh\xE5lla" }, + map: { unit: "objekt", verb: "att inneh\xE5lla" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -19960,14 +21960,16 @@ var error40 = () => { date: "ISO-datum", time: "ISO-tid", duration: "ISO-varaktighet", - ipv4: "IPv4-intervall", - ipv6: "IPv6-intervall", + ipv4: "IPv4-adress", + ipv6: "IPv6-adress", + mac: "MAC-adress", cidrv4: "IPv4-spektrum", cidrv6: "IPv6-spektrum", base64: "base64-kodad str\xE4ng", base64url: "base64url-kodad str\xE4ng", json_string: "JSON-str\xE4ng", e164: "E.164-nummer", + credit_card: "kreditkortsnummer", jwt: "JWT", template_literal: "mall-literal" }; @@ -20037,17 +22039,18 @@ var error40 = () => { }; function sv_default() { return { - localeError: error40() + localeError: error49() }; } // node_modules/zod/v4/locales/ta.js -var error41 = () => { +var error50 = () => { const Sizable = { string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }, file: { unit: "\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }, array: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }, - set: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" } + set: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }, + map: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -20073,12 +22076,14 @@ var error41 = () => { duration: "ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1", ipv4: "IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF", ipv6: "IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF", + mac: "MAC \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF", cidrv4: "IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1", cidrv6: "IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1", base64: "base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD", base64url: "base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD", json_string: "JSON \u0B9A\u0BB0\u0BAE\u0BCD", e164: "E.164 \u0B8E\u0BA3\u0BCD", + credit_card: "\u0B95\u0B9F\u0BA9\u0BCD \u0B85\u0B9F\u0BCD\u0B9F\u0BC8 \u0B8E\u0BA3\u0BCD", jwt: "JWT", template_literal: "input" }; @@ -20148,17 +22153,18 @@ var error41 = () => { }; function ta_default() { return { - localeError: error41() + localeError: error50() }; } // node_modules/zod/v4/locales/th.js -var error42 = () => { +var error51 = () => { const Sizable = { string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }, file: { unit: "\u0E44\u0E1A\u0E15\u0E4C", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }, array: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }, - set: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" } + set: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }, + map: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -20184,12 +22190,14 @@ var error42 = () => { duration: "\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO", ipv4: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4", ipv6: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6", + mac: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 MAC", cidrv4: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4", cidrv6: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6", base64: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64", base64url: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL", json_string: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON", e164: "\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)", + credit_card: "\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E40\u0E04\u0E23\u0E14\u0E34\u0E15", jwt: "\u0E42\u0E17\u0E40\u0E04\u0E19 JWT", template_literal: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19" }; @@ -20259,17 +22267,124 @@ var error42 = () => { }; function th_default() { return { - localeError: error42() + localeError: error51() + }; +} + +// node_modules/zod/v4/locales/tk.js +var error52 = () => { + const Sizable = { + string: { unit: "simwol", verb: "bolmaly" }, + file: { unit: "ba\xFDt", verb: "bolmaly" }, + array: { unit: "elementler", verb: "bolmaly" }, + set: { unit: "elementler", verb: "bolmaly" }, + map: { unit: "elementler", verb: "bolmaly" } + }; + function getSizing(origin) { + return Sizable[origin] ?? null; + } + const FormatDictionary = { + regex: "giri\u015F", + email: "e-po\xE7ta salgysy", + 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 sene we wagt", + date: "ISO sene", + time: "ISO wagt", + duration: "ISO wagt aralygy", + ipv4: "IPv4 salgysy", + ipv6: "IPv6 salgysy", + mac: "MAC salgysy", + cidrv4: "IPv4 aralygy", + cidrv6: "IPv6 aralygy", + base64: "base64 bilen \u015Fifrlenen setir", + base64url: "base64url bilen \u015Fifrlenen setir", + json_string: "JSON setiri", + e164: "E.164 nomeri", + credit_card: "kredit kartyny\u0148 nomeri", + jwt: "JWT", + template_literal: "\u015Fablon" + }; + const TypeDictionary = { + nan: "NaN" + }; + return (issue2) => { + switch (issue2.code) { + case "invalid_type": { + const expected = TypeDictionary[issue2.expected] ?? issue2.expected; + const receivedType = parsedType(issue2.input); + const received = TypeDictionary[receivedType] ?? receivedType; + return `N\xE4dogry baha: gara\u015Fylan ${expected} \xFDerine ${received} alyndy`; + } + case "invalid_value": + if (issue2.values.length === 1) + return `N\xE4dogry baha: ${stringifyPrimitive(issue2.values[0])} bolmaly`; + return `N\xE4dogry sa\xFDlaw: a\u015Fakdakylardan biri bolmaly: ${joinValues(issue2.values, "|")}`; + case "too_big": { + const adj = issue2.inclusive ? "<=" : "<"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Has uly: gara\u015Fyl\xFDan ${issue2.origin ?? "baha"} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "element"}`; + return `Has uly: gara\u015Fyl\xFDan ${issue2.origin ?? "baha"} ${adj} ${issue2.maximum.toString()}`; + } + case "too_small": { + const adj = issue2.inclusive ? ">=" : ">"; + const sizing = getSizing(issue2.origin); + if (sizing) + return `Has ki\xE7i: gara\u015Fyl\xFDan ${issue2.origin} ${adj} ${issue2.minimum.toString()} ${sizing.unit}`; + return `Has ki\xE7i: gara\u015Fyl\xFDan ${issue2.origin} ${adj} ${issue2.minimum.toString()}`; + } + case "invalid_format": { + const _issue = issue2; + if (_issue.format === "starts_with") + return `N\xE4dogry setir: "${_issue.prefix}" bilen ba\u015Flamaly`; + if (_issue.format === "ends_with") + return `N\xE4dogry setir: "${_issue.suffix}" bilen gutarmaly`; + if (_issue.format === "includes") + return `N\xE4dogry setir: "${_issue.includes}" saklamaly`; + if (_issue.format === "regex") + return `N\xE4dogry setir: ${_issue.pattern} nusga la\xFDyk bolmaly`; + return `N\xE4dogry ${FormatDictionary[_issue.format] ?? issue2.format}`; + } + case "not_multiple_of": + return `N\xE4dogry san: ${issue2.divisor} bilen galyndysyz b\xF6l\xFCnmeli`; + case "unrecognized_keys": + return `Tanalma\xFDan a\xE7ar${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`; + case "invalid_key": + return `${issue2.origin} i\xE7inde n\xE4dogry a\xE7ar`; + case "invalid_union": + return "N\xE4dogry baha"; + case "invalid_element": + return `${issue2.origin} i\xE7inde n\xE4dogry baha`; + default: + return `N\xE4dogry baha`; + } + }; +}; +function tk_default() { + return { + localeError: error52() }; } // node_modules/zod/v4/locales/tr.js -var error43 = () => { +var error53 = () => { const Sizable = { string: { unit: "karakter", verb: "olmal\u0131" }, file: { unit: "bayt", verb: "olmal\u0131" }, array: { unit: "\xF6\u011Fe", verb: "olmal\u0131" }, - set: { unit: "\xF6\u011Fe", verb: "olmal\u0131" } + set: { unit: "\xF6\u011Fe", verb: "olmal\u0131" }, + map: { unit: "\xF6\u011Fe", verb: "olmal\u0131" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -20295,12 +22410,14 @@ var error43 = () => { duration: "ISO s\xFCre", ipv4: "IPv4 adresi", ipv6: "IPv6 adresi", + mac: "MAC adresi", cidrv4: "IPv4 aral\u0131\u011F\u0131", cidrv6: "IPv6 aral\u0131\u011F\u0131", base64: "base64 ile \u015Fifrelenmi\u015F metin", base64url: "base64url ile \u015Fifrelenmi\u015F metin", json_string: "JSON dizesi", e164: "E.164 say\u0131s\u0131", + credit_card: "kredi kart\u0131 numaras\u0131", jwt: "JWT", template_literal: "\u015Eablon dizesi" }; @@ -20365,17 +22482,18 @@ var error43 = () => { }; function tr_default() { return { - localeError: error43() + localeError: error53() }; } // node_modules/zod/v4/locales/uk.js -var error44 = () => { +var error54 = () => { const Sizable = { string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }, file: { unit: "\u0431\u0430\u0439\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }, array: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }, - set: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" } + set: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }, + map: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -20401,12 +22519,14 @@ var error44 = () => { duration: "\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO", ipv4: "\u0430\u0434\u0440\u0435\u0441\u0430 IPv4", ipv6: "\u0430\u0434\u0440\u0435\u0441\u0430 IPv6", + mac: "\u0430\u0434\u0440\u0435\u0441\u0430 MAC", cidrv4: "\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4", cidrv6: "\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6", base64: "\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64", base64url: "\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url", json_string: "\u0440\u044F\u0434\u043E\u043A JSON", e164: "\u043D\u043E\u043C\u0435\u0440 E.164", + credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0457 \u043A\u0430\u0440\u0442\u043A\u0438", jwt: "JWT", template_literal: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456" }; @@ -20474,7 +22594,7 @@ var error44 = () => { }; function uk_default() { return { - localeError: error44() + localeError: error54() }; } @@ -20484,12 +22604,13 @@ function ua_default() { } // node_modules/zod/v4/locales/ur.js -var error45 = () => { +var error55 = () => { const Sizable = { string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" }, file: { unit: "\u0628\u0627\u0626\u0679\u0633", verb: "\u06C1\u0648\u0646\u0627" }, array: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" }, - set: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" } + set: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" }, + map: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -20515,12 +22636,14 @@ var error45 = () => { duration: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A", ipv4: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633", ipv6: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633", + mac: "\u0627\u06CC\u0645 \u0627\u06D2 \u0633\u06CC \u0627\u06CC\u0688\u0631\u06CC\u0633", cidrv4: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C", cidrv6: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C", base64: "\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF", base64url: "\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF", json_string: "\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF", e164: "\u0627\u06CC 164 \u0646\u0645\u0628\u0631", + credit_card: "\u06A9\u0631\u06CC\u0688\u0679 \u06A9\u0627\u0631\u0688 \u0646\u0645\u0628\u0631", jwt: "\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC", template_literal: "\u0627\u0646 \u067E\u0679" }; @@ -20590,12 +22713,12 @@ var error45 = () => { }; function ur_default() { return { - localeError: error45() + localeError: error55() }; } // node_modules/zod/v4/locales/uz.js -var error46 = () => { +var error56 = () => { const Sizable = { string: { unit: "belgi", verb: "bo\u2018lishi kerak" }, file: { unit: "bayt", verb: "bo\u2018lishi kerak" }, @@ -20634,6 +22757,7 @@ var error46 = () => { base64url: "base64url kodlangan satr", json_string: "JSON satr", e164: "E.164 raqam", + credit_card: "kredit karta raqami", jwt: "JWT", template_literal: "kirish" }; @@ -20701,17 +22825,18 @@ var error46 = () => { }; function uz_default() { return { - localeError: error46() + localeError: error56() }; } // node_modules/zod/v4/locales/vi.js -var error47 = () => { +var error57 = () => { const Sizable = { string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" }, file: { unit: "byte", verb: "c\xF3" }, array: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" }, - set: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" } + set: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" }, + map: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -20737,12 +22862,14 @@ var error47 = () => { duration: "kho\u1EA3ng th\u1EDDi gian ISO", ipv4: "\u0111\u1ECBa ch\u1EC9 IPv4", ipv6: "\u0111\u1ECBa ch\u1EC9 IPv6", + mac: "\u0111\u1ECBa ch\u1EC9 MAC", cidrv4: "d\u1EA3i IPv4", cidrv6: "d\u1EA3i IPv6", base64: "chu\u1ED7i m\xE3 h\xF3a base64", base64url: "chu\u1ED7i m\xE3 h\xF3a base64url", json_string: "chu\u1ED7i JSON", e164: "s\u1ED1 E.164", + credit_card: "s\u1ED1 th\u1EBB t\xEDn d\u1EE5ng", jwt: "JWT", template_literal: "\u0111\u1EA7u v\xE0o" }; @@ -20810,17 +22937,18 @@ var error47 = () => { }; function vi_default() { return { - localeError: error47() + localeError: error57() }; } // node_modules/zod/v4/locales/zh-CN.js -var error48 = () => { +var error58 = () => { const Sizable = { string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" }, file: { unit: "\u5B57\u8282", verb: "\u5305\u542B" }, array: { unit: "\u9879", verb: "\u5305\u542B" }, - set: { unit: "\u9879", verb: "\u5305\u542B" } + set: { unit: "\u9879", verb: "\u5305\u542B" }, + map: { unit: "\u9879", verb: "\u5305\u542B" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -20846,12 +22974,14 @@ var error48 = () => { duration: "ISO\u65F6\u957F", ipv4: "IPv4\u5730\u5740", ipv6: "IPv6\u5730\u5740", + mac: "MAC\u5730\u5740", cidrv4: "IPv4\u7F51\u6BB5", cidrv6: "IPv6\u7F51\u6BB5", base64: "base64\u7F16\u7801\u5B57\u7B26\u4E32", base64url: "base64url\u7F16\u7801\u5B57\u7B26\u4E32", json_string: "JSON\u5B57\u7B26\u4E32", e164: "E.164\u53F7\u7801", + credit_card: "\u4FE1\u7528\u5361\u53F7", jwt: "JWT", template_literal: "\u8F93\u5165" }; @@ -20920,17 +23050,18 @@ var error48 = () => { }; function zh_CN_default() { return { - localeError: error48() + localeError: error58() }; } // node_modules/zod/v4/locales/zh-TW.js -var error49 = () => { +var error59 = () => { const Sizable = { string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" }, file: { unit: "\u4F4D\u5143\u7D44", verb: "\u64C1\u6709" }, array: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" }, - set: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" } + set: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" }, + map: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -20956,12 +23087,14 @@ var error49 = () => { duration: "ISO \u671F\u9593", ipv4: "IPv4 \u4F4D\u5740", ipv6: "IPv6 \u4F4D\u5740", + mac: "MAC \u4F4D\u5740", cidrv4: "IPv4 \u7BC4\u570D", cidrv6: "IPv6 \u7BC4\u570D", base64: "base64 \u7DE8\u78BC\u5B57\u4E32", base64url: "base64url \u7DE8\u78BC\u5B57\u4E32", json_string: "JSON \u5B57\u4E32", e164: "E.164 \u6578\u503C", + credit_card: "\u4FE1\u7528\u5361\u865F", jwt: "JWT", template_literal: "\u8F38\u5165" }; @@ -21028,17 +23161,18 @@ var error49 = () => { }; function zh_TW_default() { return { - localeError: error49() + localeError: error59() }; } // node_modules/zod/v4/locales/yo.js -var error50 = () => { +var error60 = () => { const Sizable = { string: { unit: "\xE0mi", verb: "n\xED" }, file: { unit: "bytes", verb: "n\xED" }, array: { unit: "nkan", verb: "n\xED" }, - set: { unit: "nkan", verb: "n\xED" } + set: { unit: "nkan", verb: "n\xED" }, + map: { unit: "nkan", verb: "n\xED" } }; function getSizing(origin) { return Sizable[origin] ?? null; @@ -21064,12 +23198,14 @@ var error50 = () => { duration: "\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO", ipv4: "\xE0d\xEDr\u1EB9\u0301s\xEC IPv4", ipv6: "\xE0d\xEDr\u1EB9\u0301s\xEC IPv6", + mac: "\xE0d\xEDr\u1EB9\u0301s\xEC MAC", cidrv4: "\xE0gb\xE8gb\xE8 IPv4", cidrv6: "\xE0gb\xE8gb\xE8 IPv6", base64: "\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64", base64url: "\u1ECD\u0300r\u1ECD\u0300 base64url", json_string: "\u1ECD\u0300r\u1ECD\u0300 JSON", e164: "n\u1ECD\u0301mb\xE0 E.164", + credit_card: "n\u1ECDmba kaadi gbese", jwt: "JWT", template_literal: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9" }; @@ -21136,7 +23272,7 @@ var error50 = () => { }; function yo_default() { return { - localeError: error50() + localeError: error60() }; } @@ -21190,53 +23326,1596 @@ function registry() { (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry()); var globalRegistry = globalThis.__zod_globalRegistry; -// node_modules/zod/v4/core/api.js -// @__NO_SIDE_EFFECTS__ -function _string(Class2, params) { - return new Class2({ - type: "string", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _coercedString(Class2, params) { - return new Class2({ - type: "string", - coerce: true, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _email(Class2, params) { - return new Class2({ - type: "string", - format: "email", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); +// node_modules/zod/v4/core/compile.js +var INVALID2 = /* @__PURE__ */ Symbol.for("zod.compile.invalid"); +var FALLBACK_FLAG = /* @__PURE__ */ Symbol.for("zod.compile.fallback"); +var ZodCompileAsyncError = class extends Error { + constructor(message = "z.compile does not support async refinements, transforms, or checks") { + super(message); + this.name = "ZodCompileAsyncError"; + } +}; +var ZodCompileUnsupportedError = class extends Error { + constructor(feature, islandable = true) { + super(`z.compile does not support ${feature}; this schema must use the runtime parser`); + this.name = "ZodCompileUnsupportedError"; + this.islandable = islandable; + } +}; +function compileValidator(schema, parser) { + try { + return compileFn(schema, { assertOnly: true }); + } catch { + return parser; + } } -// @__NO_SIDE_EFFECTS__ -function _guid(Class2, params) { - return new Class2({ - type: "string", - format: "guid", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); +function compile(schema, options) { + try { + const parser = compileFn(schema); + const clone2 = clone(schema); + const liveRun = schema._zod.run; + const originalRun = liveRun.__originalRun ?? liveRun; + const wrapped = (payload, ctx) => { + if (ctx?.async || ctx?.direction === "backward" || ctx?.skipChecks || ctx?.[FALLBACK_FLAG]) { + return originalRun(payload, ctx); + } + if (ctx && isBackEdge(ctx, payload.value)) { + return originalRun(payload, ctx); + } + const out = parser(payload.value); + if (out !== INVALID2) { + payload.value = out; + return payload; + } + if (ctx) + ctx[FALLBACK_FLAG] = true; + return originalRun(payload, ctx); + }; + wrapped.__originalRun = originalRun; + clone2._zod.bag.fallbackRun = originalRun; + clone2._zod.bag.validator = compileValidator(schema, parser); + clone2._zod.run = wrapped; + if (!liveRun.__originalRun) + installCompiledUserMethods(clone2, schema, parser); + return clone2; + } catch (err) { + if (options?.strict) + throw err; + return schema; + } } -// @__NO_SIDE_EFFECTS__ -function _uuid(Class2, params) { - return new Class2({ - type: "string", - format: "uuid", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); +function installCompiledUserMethods(target, source, parser) { + const targetAny = target; + const sourceAny = source; + if (typeof sourceAny.safeParse === "function") { + const originalSafeParse = sourceAny.safeParse; + targetAny.safeParse = (data, params) => { + const out = parser(data); + if (out !== INVALID2) { + return { success: true, data: out }; + } + return originalSafeParse(data, params); + }; + } + if (typeof sourceAny.parse === "function") { + const originalParse = sourceAny.parse; + targetAny.parse = (data, params) => { + const out = parser(data); + if (out !== INVALID2) { + return out; + } + return originalParse(data, params); + }; + } } -// @__NO_SIDE_EFFECTS__ +function compileFn(schema, options) { + let recursive2 = true; + try { + recursive2 = isRecursiveSchema(schema); + } catch { + } + if (recursive2) { + throw new ZodCompileUnsupportedError("a schema whose subtree contains a reference cycle"); + } + const ctx = { + constants: /* @__PURE__ */ new Map(), + constantCounter: 0, + varCounter: 0 + }; + const doc = new Doc(["input"]); + const outputAccessor = generateCheck(doc, ctx, schema, "input", !options?.assertOnly); + doc.write(outputAccessor === null ? `return true;` : `return ${outputAccessor};`); + const constantNames = ["INVALID", ...ctx.constants.keys()]; + const constantValues = [INVALID2, ...ctx.constants.values()]; + const code = doc.content.join("\n"); + const fullCode = options?.debug ? constantNames.length > 0 ? `// Constants: ${constantNames.join(", ")} +${code}` : code : ""; + const F = Function; + const factoryCode = `return (input) => { +${code} +}`; + let fn; + try { + const factory = new F(...constantNames, factoryCode); + fn = factory(...constantValues); + } catch (err) { + throw new ZodCompileUnsupportedError(`this schema (generated code failed to evaluate: ${err.message})`); + } + if (options?.debug) { + fn.code = fullCode; + } + return fn; +} +function addConstant(ctx, value) { + for (const [name2, v] of ctx.constants) { + if (v === value) + return name2; + } + const name = `c${ctx.constantCounter++}`; + ctx.constants.set(name, value); + return name; +} +function newVar(ctx) { + return `v${ctx.varCounter++}`; +} +function runtimeRun(schema, value) { + const result = schema._zod.run({ value, issues: [] }, {}); + if (result && typeof result.then === "function") + return INVALID2; + const r = result; + return r.issues.length === 0 ? r.value : INVALID2; +} +function compileChild(doc, ctx, schema, accessor, needsValue = true) { + const contentLen = doc.content.length; + const constantCount = ctx.constants.size; + const constantCounter = ctx.constantCounter; + const varCounter = ctx.varCounter; + try { + return generateCheck(doc, ctx, schema, accessor, needsValue); + } catch (err) { + if (!(err instanceof ZodCompileUnsupportedError) || !err.islandable) + throw err; + doc.content.length = contentLen; + if (ctx.constants.size > constantCount) { + const trailing = Array.from(ctx.constants.keys()).slice(constantCount); + for (const k of trailing) + ctx.constants.delete(k); + } + ctx.constantCounter = constantCounter; + ctx.varCounter = varCounter; + return emitRuntimeIsland(doc, ctx, schema, accessor); + } +} +function emitRuntimeIsland(doc, ctx, schema, accessor) { + const schemaConst = addConstant(ctx, schema); + const runConst = addConstant(ctx, runtimeRun); + const outVar = newVar(ctx); + doc.write(`const ${outVar} = ${runConst}(${schemaConst}, ${accessor});`); + doc.write(`if (${outVar} === INVALID) return INVALID;`); + return outVar; +} +var WHEN_DEFAULTED_CHECKS = /* @__PURE__ */ new Set([ + "max_size", + "min_size", + "size_equals", + "max_length", + "min_length", + "length_equals" +]); +function generateChecks(doc, ctx, schema, accessor) { + const schemaChecks = schema._zod.def.checks; + if (!schemaChecks || schemaChecks.length === 0) + return accessor; + let currentAccessor = accessor; + for (const check2 of schemaChecks) { + const def = check2._zod.def; + if (def.when && !WHEN_DEFAULTED_CHECKS.has(def.check)) { + throw new ZodCompileUnsupportedError(`check with a custom "when" condition`); + } + switch (def.check) { + case "greater_than": + generateGreaterThanCheck(doc, ctx, def, currentAccessor); + break; + case "less_than": + generateLessThanCheck(doc, ctx, def, currentAccessor); + break; + case "multiple_of": + generateMultipleOfCheck(doc, ctx, def, currentAccessor); + break; + case "number_format": + generateNumberFormatCheck(doc, def, currentAccessor); + break; + case "min_length": { + const min = numericOperand(def.minimum, "min_length"); + const len = codePointLengthVar(doc, ctx, currentAccessor, `${currentAccessor}.length >= ${min} && ${currentAccessor}.length < ${def.minimum * 2}`); + doc.write(`if (${len} < ${min}) return INVALID;`); + break; + } + case "max_length": { + const max = numericOperand(def.maximum, "max_length"); + const len = codePointLengthVar(doc, ctx, currentAccessor, `${currentAccessor}.length > ${max}`); + doc.write(`if (${len} > ${max}) return INVALID;`); + break; + } + case "length_equals": { + const exact = numericOperand(def.length, "length_equals"); + const len = codePointLengthVar(doc, ctx, currentAccessor, `${currentAccessor}.length >= ${exact} && ${currentAccessor}.length <= ${def.length * 2}`); + doc.write(`if (${len} !== ${exact}) return INVALID;`); + break; + } + case "min_size": + doc.write(`if (${currentAccessor}.size < ${numericOperand(def.minimum, "min_size")}) return INVALID;`); + break; + case "max_size": + doc.write(`if (${currentAccessor}.size > ${numericOperand(def.maximum, "max_size")}) return INVALID;`); + break; + case "size_equals": + doc.write(`if (${currentAccessor}.size !== ${numericOperand(def.size, "size_equals")}) return INVALID;`); + break; + case "string_format": + currentAccessor = generateStringFormatCheck(doc, ctx, def, currentAccessor); + break; + case "custom": + currentAccessor = generateCustomRefineCheck(doc, ctx, check2, currentAccessor); + break; + case "bigint_format": + generateBigIntFormatCheck(doc, def, currentAccessor); + break; + case "mime_type": + generateMimeTypeCheck(doc, ctx, def, currentAccessor); + break; + case "property": + generatePropertyCheck(doc, ctx, def, currentAccessor); + break; + case "overwrite": { + const newAccessor = newVar(ctx); + generateOverwriteCheck(doc, ctx, check2, currentAccessor, newAccessor); + currentAccessor = newAccessor; + break; + } + default: { + void def; + throw new ZodCompileUnsupportedError(`check type ${def.check}`); + } + } + } + return currentAccessor; +} +function codePointLengthVar(doc, ctx, accessor, inDoubt) { + const cpLen = addConstant(ctx, codePointLength); + const v = newVar(ctx); + doc.write(`const ${v} = typeof ${accessor} === "string" && ${inDoubt} ? ${cpLen}(${accessor}) : ${accessor}.length;`); + return v; +} +function numericOperand(value, label) { + if (typeof value !== "number" || !Number.isFinite(value)) { + throw new ZodCompileUnsupportedError(`${label} bound of type ${typeof value}`); + } + return `${value}`; +} +function comparisonOperand(ctx, value) { + if (typeof value === "bigint") + return `${value}n`; + if (typeof value === "number") { + if (Number.isNaN(value)) + throw new ZodCompileUnsupportedError("comparison check with NaN bound"); + return `${value}`; + } + if (value instanceof Date) { + if (Number.isNaN(value.getTime())) { + throw new ZodCompileUnsupportedError("comparison check with Invalid Date bound"); + } + return addConstant(ctx, value); + } + throw new ZodCompileUnsupportedError(`comparison check bound of type ${typeof value}`); +} +function generateGreaterThanCheck(doc, ctx, def, accessor) { + const op = def.inclusive ? "<" : "<="; + doc.write(`if (${accessor} ${op} ${comparisonOperand(ctx, def.value)}) return INVALID;`); +} +function generateLessThanCheck(doc, ctx, def, accessor) { + const op = def.inclusive ? ">" : ">="; + doc.write(`if (${accessor} ${op} ${comparisonOperand(ctx, def.value)}) return INVALID;`); +} +function generateMultipleOfCheck(doc, ctx, def, accessor) { + if (typeof def.value === "bigint") { + if (def.value === BigInt(0)) + throw new ZodCompileUnsupportedError("multiple_of check with a zero divisor"); + doc.write(`if (${accessor} % ${def.value}n !== 0n) return INVALID;`); + } else { + const remainder = addConstant(ctx, floatSafeRemainder2); + doc.write(`if (${remainder}(${accessor}, ${numericOperand(def.value, "multiple_of")}) !== 0) return INVALID;`); + } +} +function generateNumberFormatCheck(doc, def, accessor) { + const format = def.format; + switch (format) { + case "safeint": + doc.write(`if (!Number.isSafeInteger(${accessor})) return INVALID;`); + break; + case "int32": + doc.write(`if (!Number.isInteger(${accessor}) || ${accessor} < -2147483648 || ${accessor} > 2147483647) return INVALID;`); + break; + case "uint32": + doc.write(`if (!Number.isInteger(${accessor}) || ${accessor} < 0 || ${accessor} > 4294967295) return INVALID;`); + break; + case "float32": + doc.write(`if (!Number.isFinite(${accessor}) || ${accessor} < -3.4028234663852886e38 || ${accessor} > 3.4028234663852886e38) return INVALID;`); + break; + case "float64": + doc.write(`if (!Number.isFinite(${accessor})) return INVALID;`); + break; + default: { + void format; + throw new ZodCompileUnsupportedError(`number format ${format}`); + } + } +} +function generateBigIntFormatCheck(doc, def, accessor) { + const format = def.format; + if (!format) + return; + switch (format) { + case "int64": + doc.write(`if (${accessor} < -9223372036854775808n || ${accessor} > 9223372036854775807n) return INVALID;`); + break; + case "uint64": + doc.write(`if (${accessor} < 0n || ${accessor} > 18446744073709551615n) return INVALID;`); + break; + default: { + void format; + throw new ZodCompileUnsupportedError(`bigint format ${format}`); + } + } +} +function generateMimeTypeCheck(doc, ctx, def, accessor) { + const mimeTypes = def.mime; + if (mimeTypes && mimeTypes.length > 0) { + const mimeSet = addConstant(ctx, new Set(mimeTypes)); + doc.write(`if (!${mimeSet}.has(${accessor}.type)) return INVALID;`); + } +} +function generatePropertyCheck(doc, ctx, def, accessor) { + const propAccessor = `${accessor}[${JSON.stringify(def.property)}]`; + generateCheck(doc, ctx, def.schema, propAccessor); +} +function generateOverwriteCheck(doc, ctx, check2, currentAccessor, newAccessor) { + const tx = check2._zod.def.tx; + if (!tx) { + throw new ZodCompileUnsupportedError("overwrite check without a transform function"); + } + if (isAsyncFunction(tx)) { + throw new ZodCompileAsyncError("z.compile: async overwrite transforms are not supported"); + } + const txConst = addConstant(ctx, tx); + doc.write(`const ${newAccessor} = ${txConst}(${currentAccessor});`); +} +function throwAsync() { + throw new $ZodAsyncError(); +} +function pushIssue(issue2) { + this.issues.push(issue2); +} +function generateCustomRefineCheck(doc, ctx, check2, accessor) { + const def = check2._zod.def; + if (def.fn) { + if (isAsyncFunction(def.fn)) { + throw new ZodCompileAsyncError("z.compile: async .refine() predicates are not supported"); + } + const fnConst = addConstant(ctx, def.fn); + const throwAsyncConst = addConstant(ctx, throwAsync); + const resVar = newVar(ctx); + doc.write(`const ${resVar} = ${fnConst}(${accessor});`); + doc.write(`if (${resVar} instanceof Promise) ${throwAsyncConst}();`); + doc.write(`if (!${resVar}) return INVALID;`); + return accessor; + } + if (check2._zod.check) { + if (isAsyncFunction(check2._zod.check)) { + throw new ZodCompileAsyncError("z.compile: async .superRefine() / check functions are not supported"); + } + const checkFn = check2._zod.check; + const helperFn = (value) => { + const fakePayload = { value, issues: [], addIssue: pushIssue }; + const result = checkFn(fakePayload); + if (result instanceof Promise) + throwAsync(); + return fakePayload.issues.length === 0 ? fakePayload.value : INVALID2; + }; + const helperConst = addConstant(ctx, helperFn); + const outVar = newVar(ctx); + doc.write(`const ${outVar} = ${helperConst}(${accessor});`); + doc.write(`if (${outVar} === INVALID) return INVALID;`); + return outVar; + } + throw new ZodCompileUnsupportedError("custom check without a predicate or check function"); +} +var PATTERN_IS_COMPLETE = /* @__PURE__ */ new Set([ + "cidrv4", + "cuid", + "cuid2", + "date", + "datetime", + "duration", + "e164", + "email", + "emoji", + "ends_with", + "guid", + "includes", + "ipv4", + "ksuid", + "lowercase", + "mac", + "nanoid", + "regex", + "starts_with", + "time", + "ulid", + "uppercase", + "uuid", + "xid" +]); +function generateStringFormatCheck(doc, ctx, def, accessor) { + const fmt = def.format; + if (fmt === "base64") { + const validator = addConstant(ctx, isValidBase64); + doc.write(`if (!${validator}(${accessor})) return INVALID;`); + return accessor; + } + if (fmt === "base64url") { + const validator = addConstant(ctx, isValidBase64URL); + doc.write(`if (!${validator}(${accessor})) return INVALID;`); + return accessor; + } + if (fmt === "jwt") { + const validator = addConstant(ctx, isValidJWT2); + const alg = addConstant(ctx, def.alg ?? null); + doc.write(`if (!${validator}(${accessor}, ${alg})) return INVALID;`); + return accessor; + } + if (fmt === "ipv6") { + const validator = addConstant(ctx, isValidIPv6); + doc.write(`if (!${validator}(${accessor})) return INVALID;`); + return accessor; + } + if (fmt === "cidrv6") { + const validator = addConstant(ctx, isValidCIDRv6); + doc.write(`if (!${validator}(${accessor})) return INVALID;`); + return accessor; + } + if (fmt === "credit_card") { + const validator = addConstant(ctx, isValidCreditCard); + doc.write(`if (!${validator}(${accessor})) return INVALID;`); + return accessor; + } + const formatDef = def; + if (fmt === "url" || fmt === "httpurl" || formatDef.normalize || formatDef.hostname !== void 0 || formatDef.protocol !== void 0) { + const parseConst = addConstant(ctx, parseURLObject); + const defConst = addConstant(ctx, def); + const trimVar = newVar(ctx); + const urlVar = newVar(ctx); + doc.write(`const ${trimVar} = ${accessor}.trim();`); + doc.write(`const ${urlVar} = ${parseConst}(${trimVar}, ${defConst});`); + doc.write(`if (typeof ${urlVar} === "number") return INVALID;`); + if (formatDef.hostname !== void 0) { + const hostnameConst = addConstant(ctx, urlHostnameOk); + doc.write(`if (!${hostnameConst}(${urlVar}, ${defConst}.hostname)) return INVALID;`); + } + if (formatDef.protocol !== void 0) { + const protocolConst = addConstant(ctx, urlProtocolOk); + doc.write(`if (!${protocolConst}(${urlVar}, ${defConst}.protocol)) return INVALID;`); + } + const outputVar = newVar(ctx); + const outputExpr = formatDef.normalize ? `${urlVar}.href` : `${addConstant(ctx, stripTabAndNewline)}(${trimVar})`; + doc.write(`const ${outputVar} = ${outputExpr};`); + return outputVar; + } + const customFn = def.fn; + if (customFn) { + if (isAsyncFunction(customFn)) + throw new ZodCompileUnsupportedError(`async string format ${fmt}`); + const fnConst = addConstant(ctx, customFn); + doc.write(`if (!${fnConst}(${accessor})) return INVALID;`); + return accessor; + } + if (PATTERN_IS_COMPLETE.has(fmt) && def.pattern) { + const patternConst = addConstant(ctx, def.pattern); + doc.write(`${patternConst}.lastIndex = 0;`); + doc.write(`if (!${patternConst}.test(${accessor})) return INVALID;`); + return accessor; + } + const format = def.format; + switch (format) { + case "regex": + throw new ZodCompileUnsupportedError("regex format without a pattern"); + case "lowercase": + doc.write(`if (${accessor} !== ${accessor}.toLowerCase()) return INVALID;`); + break; + case "uppercase": + doc.write(`if (${accessor} !== ${accessor}.toUpperCase()) return INVALID;`); + break; + case "includes": + doc.write(`if (!${accessor}.includes(${esc(def.includes)})) return INVALID;`); + break; + case "starts_with": { + const prefix = def.prefix; + doc.write(`if (${accessor}.slice(0, ${prefix.length}) !== ${esc(prefix)}) return INVALID;`); + break; + } + case "ends_with": { + const suffix = def.suffix; + doc.write(`if (${accessor}.slice(-${suffix.length}) !== ${esc(suffix)}) return INVALID;`); + break; + } + default: { + void format; + throw new ZodCompileUnsupportedError(`string format ${format}`); + } + } + return accessor; +} +function generateCheck(doc, ctx, schema, accessor, needsValue = true) { + const def = schema._zod.def; + const type = def.type; + if (def.coerce) { + throw new ZodCompileUnsupportedError(`coercion (z.coerce.${type}())`); + } + const buildsValue = needsValue || !!def.checks?.length; + let typeAccessor; + switch (type) { + case "string": + typeAccessor = generateStringCheck(doc, ctx, schema, accessor); + break; + case "number": + typeAccessor = generateNumberCheck(doc, schema, accessor); + break; + case "boolean": + typeAccessor = generateBooleanCheck(doc, accessor); + break; + case "bigint": + typeAccessor = generateBigIntCheck(doc, schema, accessor); + break; + case "symbol": + typeAccessor = generateSymbolCheck(doc, accessor); + break; + case "undefined": + typeAccessor = generateUndefinedCheck(doc, accessor); + break; + case "null": + typeAccessor = generateNullCheck(doc, accessor); + break; + case "any": + case "unknown": + typeAccessor = accessor; + break; + case "never": + doc.write("return INVALID;"); + typeAccessor = accessor; + break; + case "void": + typeAccessor = generateVoidCheck(doc, accessor); + break; + case "nan": + typeAccessor = generateNaNCheck(doc, accessor); + break; + case "date": + typeAccessor = generateDateCheck(doc, accessor); + break; + case "object": + typeAccessor = generateObjectCheck(doc, ctx, schema, accessor, buildsValue); + break; + case "optional": + typeAccessor = generateOptionalCheck(doc, ctx, schema, accessor, buildsValue); + break; + case "nullable": + typeAccessor = generateNullableCheck(doc, ctx, schema, accessor, buildsValue); + break; + case "array": + typeAccessor = generateArrayCheck(doc, ctx, schema, accessor, buildsValue); + break; + case "literal": + typeAccessor = generateLiteralCheck(doc, ctx, schema, accessor); + break; + case "enum": + typeAccessor = generateEnumCheck(doc, ctx, schema, accessor); + break; + case "readonly": { + const innerOut = generateWrapperCheck(doc, ctx, schema, accessor); + const frozenVar = newVar(ctx); + doc.write(`const ${frozenVar} = Object.freeze(${innerOut});`); + typeAccessor = frozenVar; + break; + } + case "success": + generateWrapperCheck(doc, ctx, schema, accessor); + typeAccessor = "true"; + break; + case "default": + case "prefault": + typeAccessor = generateDefaultCheck(doc, ctx, schema, accessor); + break; + case "nonoptional": + typeAccessor = generateNonOptionalCheck(doc, ctx, schema, accessor); + break; + case "tuple": + typeAccessor = generateTupleCheck(doc, ctx, schema, accessor); + break; + case "union": + typeAccessor = generateUnionCheck(doc, ctx, schema, accessor); + break; + case "intersection": + typeAccessor = generateIntersectionCheck(doc, ctx, schema, accessor); + break; + case "record": + typeAccessor = generateRecordCheck(doc, ctx, schema, accessor); + break; + case "map": + typeAccessor = generateMapCheck(doc, ctx, schema, accessor); + break; + case "set": + typeAccessor = generateSetCheck(doc, ctx, schema, accessor); + break; + case "file": + typeAccessor = generateFileCheck(doc, accessor); + break; + case "template_literal": + typeAccessor = generateTemplateLiteralCheck(doc, ctx, schema, accessor); + break; + case "lazy": + typeAccessor = generateLazyCheck(doc, ctx, schema, accessor); + break; + case "pipe": + typeAccessor = generatePipeCheck(doc, ctx, schema, accessor); + break; + case "custom": + typeAccessor = generateCustomCheck(doc, ctx, schema, accessor); + break; + case "transform": + typeAccessor = generateTransformCheck(doc, ctx, schema, accessor); + break; + case "catch": + typeAccessor = generateCatchCheck(doc, ctx, schema, accessor); + break; + default: { + void type; + throw new ZodCompileUnsupportedError(`schema type ${type}`); + } + } + if (typeAccessor === null) + return null; + return generateChecks(doc, ctx, schema, typeAccessor); +} +function generateStringCheck(doc, ctx, schema, accessor) { + doc.write(`if (typeof ${accessor} !== "string") return INVALID;`); + const def = schema._zod.def; + if (def.format === void 0) + return accessor; + return generateStringFormatCheck(doc, ctx, def, accessor); +} +function generateNumberCheck(doc, schema, accessor) { + doc.write(`if (typeof ${accessor} !== "number" || !Number.isFinite(${accessor})) return INVALID;`); + const def = schema._zod.def; + if (def.check === "number_format" && def.format) { + generateNumberFormatCheck(doc, { format: def.format }, accessor); + } + return accessor; +} +function generateBooleanCheck(doc, accessor) { + doc.write(`if (typeof ${accessor} !== "boolean") return INVALID;`); + return accessor; +} +function generateBigIntCheck(doc, schema, accessor) { + doc.write(`if (typeof ${accessor} !== "bigint") return INVALID;`); + const def = schema._zod.def; + if (def.format) { + switch (def.format) { + case "int64": + doc.write(`if (${accessor} < -9223372036854775808n || ${accessor} > 9223372036854775807n) return INVALID;`); + break; + case "uint64": + doc.write(`if (${accessor} < 0n || ${accessor} > 18446744073709551615n) return INVALID;`); + break; + } + } + return accessor; +} +function generateSymbolCheck(doc, accessor) { + doc.write(`if (typeof ${accessor} !== "symbol") return INVALID;`); + return accessor; +} +function generateUndefinedCheck(doc, accessor) { + doc.write(`if (${accessor} !== undefined) return INVALID;`); + return accessor; +} +function generateNullCheck(doc, accessor) { + doc.write(`if (${accessor} !== null) return INVALID;`); + return accessor; +} +function generateVoidCheck(doc, accessor) { + doc.write(`if (${accessor} !== undefined) return INVALID;`); + return accessor; +} +function generateNaNCheck(doc, accessor) { + doc.write(`if (typeof ${accessor} !== "number" || !Number.isNaN(${accessor})) return INVALID;`); + return accessor; +} +function generateDateCheck(doc, accessor) { + doc.write(`if (!(${accessor} instanceof Date) || Number.isNaN(${accessor}.getTime())) return INVALID;`); + return accessor; +} +function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) { + const def = schema._zod.def; + doc.write(`if (typeof ${accessor} !== "object" || ${accessor} === null || Array.isArray(${accessor})) return INVALID;`); + const shape = def.shape; + const keys = Object.keys(shape); + const symbolKeys = Object.getOwnPropertySymbols(shape); + const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys; + const keyExpr = (k) => typeof k === "symbol" ? addConstant(ctx, k) : esc(k); + const propKey = (k) => typeof k === "symbol" ? `[${keyExpr(k)}]` : esc(k); + const propShape = shape; + if (keys.includes("__proto__")) { + throw new ZodCompileUnsupportedError('object shape key "__proto__"'); + } + const propOutputs = /* @__PURE__ */ new Map(); + for (const key of allKeys) { + const propSchema = propShape[key]; + const kx = keyExpr(key); + const inputVar = newVar(ctx); + doc.write(`const ${inputVar} = ${accessor}[${kx}];`); + if (propSchema._zod.optin !== void 0) { + const outputVar2 = newVar(ctx); + doc.write(`let ${outputVar2} = (() => {`); + doc.indented((d) => { + const outputAccessor = compileChild(d, ctx, propSchema, inputVar); + d.write(`return ${outputAccessor};`); + }); + doc.write(`})();`); + if (propSchema._zod.optout === "optional") { + doc.write(`if (${outputVar2} === INVALID) {`); + doc.indented((d) => { + d.write(`if (${kx} in ${accessor}) return INVALID;`); + d.write(`${outputVar2} = undefined;`); + }); + doc.write(`}`); + } else { + doc.write(`if (${outputVar2} === INVALID) return INVALID;`); + } + propOutputs.set(key, outputVar2); + } else { + if (requiresPresenceCheck(propSchema)) { + doc.write(`if (!(${kx} in ${accessor})) return INVALID;`); + } + const outputAccessor = compileChild(doc, ctx, propSchema, inputVar, buildsValue); + if (outputAccessor !== null) + propOutputs.set(key, outputAccessor); + } + } + const catchall = def.catchall; + let unknownKeysMode = "none"; + if (catchall) { + const catchallType = catchall._zod.def.type; + if (catchallType === "never") { + const condition = keys.map((k) => `k !== ${esc(k)}`).join(" && ") || "true"; + doc.write(`for (const k in ${accessor}) {`); + doc.indented((d) => { + d.write(`if (${condition}) return INVALID;`); + }); + doc.write(`}`); + } else if ((catchallType === "unknown" || catchallType === "any") && !catchall._zod.def.checks?.length) { + unknownKeysMode = "passthrough"; + } else { + unknownKeysMode = "schema"; + } + } + const outputVar = newVar(ctx); + const hasConditionalKeys = allKeys.some((k) => mayOutputUndefined(propShape[k]) || dropsWhenAbsent(propShape[k])); + if (!buildsValue) { + if (unknownKeysMode === "schema") { + const knownSet = keys.length > 0 ? addConstant(ctx, new Set(keys)) : null; + doc.write(`for (const k in ${accessor}) {`); + doc.indented((d) => { + d.write(`if (k === "__proto__") continue;`); + if (knownSet) + d.write(`if (${knownSet}.has(k)) continue;`); + const valVar = newVar(ctx); + d.write(`const ${valVar} = ${accessor}[k];`); + compileChild(d, ctx, catchall, valVar, false); + }); + doc.write(`}`); + } + return null; + } + if (!hasConditionalKeys) { + const propLiterals = allKeys.map((k) => `${propKey(k)}: ${propOutputs.get(k)}`).join(", "); + doc.write(`const ${outputVar} = { ${propLiterals} };`); + } else { + doc.write(`const ${outputVar} = {};`); + for (const k of allKeys) { + const kx = keyExpr(k); + const out = propOutputs.get(k); + if (dropsWhenAbsent(propShape[k])) { + doc.write(`if (${kx} in ${accessor}) ${outputVar}[${kx}] = ${out};`); + } else if (mayOutputUndefined(propShape[k])) { + doc.write(`if (${out} !== undefined || ${kx} in ${accessor}) ${outputVar}[${kx}] = ${out};`); + } else { + doc.write(`${outputVar}[${kx}] = ${out};`); + } + } + } + if (unknownKeysMode !== "none") { + const knownSet = keys.length > 0 ? addConstant(ctx, new Set(keys)) : null; + doc.write(`for (const k in ${accessor}) {`); + doc.indented((d) => { + d.write(`if (k === "__proto__") continue;`); + if (knownSet) + d.write(`if (${knownSet}.has(k)) continue;`); + if (unknownKeysMode === "passthrough") { + d.write(`${outputVar}[k] = ${accessor}[k];`); + } else { + const valVar = newVar(ctx); + d.write(`const ${valVar} = ${accessor}[k];`); + const catchallOut = compileChild(d, ctx, catchall, valVar); + d.write(`${outputVar}[k] = ${catchallOut};`); + } + }); + doc.write(`}`); + } + return outputVar; +} +function generateOptionalCheck(doc, ctx, schema, accessor, buildsValue = true) { + const def = schema._zod.def; + if (isExactOptional(schema)) { + return generateCheck(doc, ctx, def.innerType, accessor, buildsValue); + } + if (def.innerType._zod.optin === "defaulted") { + const outputVar2 = newVar(ctx); + const branchVar = newVar(ctx); + doc.write(`let ${outputVar2};`); + doc.write(`if (${accessor} === undefined) {`); + doc.indented((d) => { + d.write(`const ${branchVar} = (() => {`); + d.indented((d2) => { + const innerOutput = generateCheck(d2, ctx, def.innerType, accessor); + d2.write(`return ${innerOutput};`); + }); + d.write(`})();`); + d.write(`if (${branchVar} !== INVALID) ${outputVar2} = ${branchVar};`); + }); + doc.write(`} else {`); + doc.indented((d) => { + const innerOutput = generateCheck(d, ctx, def.innerType, accessor); + d.write(`${outputVar2} = ${innerOutput};`); + }); + doc.write(`}`); + return outputVar2; + } + const outputVar = buildsValue ? newVar(ctx) : null; + if (outputVar) + doc.write(`let ${outputVar};`); + doc.write(`if (${accessor} !== undefined) {`); + doc.indented((d) => { + const innerOutput = generateCheck(d, ctx, def.innerType, accessor, buildsValue); + if (outputVar && innerOutput !== null) + d.write(`${outputVar} = ${innerOutput};`); + }); + doc.write(`}`); + return outputVar; +} +function isExactOptional(schema) { + return schema._zod.traits?.has("$ZodExactOptional") === true; +} +function requiresPresenceCheck(schema) { + return schema._zod.optin === void 0 && fastPathAcceptsAbsence(schema); +} +function fastPathAcceptsAbsence(schema) { + if (schema._zod.def.coerce) + return true; + const def = schema._zod.def; + switch (def.type) { + case "any": + case "unknown": + case "undefined": + case "void": + case "default": + case "prefault": + case "transform": + case "custom": + case "lazy": + return true; + case "string": + case "number": + case "boolean": + case "bigint": + case "symbol": + case "null": + case "never": + case "nan": + case "date": + case "object": + case "array": + case "tuple": + case "record": + case "map": + case "set": + case "file": + case "template_literal": + return false; + case "nonoptional": + return def.innerType ? fastPathAcceptsAbsence(def.innerType) : false; + case "literal": + return !!def.values?.includes(void 0); + case "enum": + return !!schema._zod.values?.has(void 0); + case "optional": + case "nullable": + case "readonly": + case "success": + return def.innerType ? fastPathAcceptsAbsence(def.innerType) : true; + case "catch": + return true; + case "union": + return def.options ? def.options.some(fastPathAcceptsAbsence) : true; + case "intersection": + if (!def.left || !def.right) + return true; + return fastPathAcceptsAbsence(def.left) && fastPathAcceptsAbsence(def.right); + case "pipe": + return def.in ? fastPathAcceptsAbsence(def.in) : true; + default: + return true; + } +} +function dropsWhenAbsent(schema) { + return schema._zod.optin === "optional" && schema._zod.optout === "optional"; +} +function mayOutputUndefined(schema) { + const def = schema._zod.def; + switch (def.type) { + case "string": + case "number": + case "boolean": + case "bigint": + case "symbol": + case "null": + case "nan": + case "date": + case "object": + case "array": + case "tuple": + case "record": + case "map": + case "set": + case "file": + case "template_literal": + case "never": + case "success": + return false; + case "literal": + return !!def.values?.includes(void 0); + case "enum": + return !!schema._zod.values?.has(void 0); + case "optional": + return true; + case "nullable": + case "readonly": + case "nonoptional": + return def.innerType ? mayOutputUndefined(def.innerType) : true; + case "union": + return def.options ? def.options.some(mayOutputUndefined) : true; + case "intersection": + return !def.left || !def.right || mayOutputUndefined(def.left) || mayOutputUndefined(def.right); + case "pipe": + return def.out ? mayOutputUndefined(def.out) : true; + default: + return true; + } +} +function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) { + const def = schema._zod.def; + const outputVar = buildsValue ? newVar(ctx) : null; + if (outputVar) + doc.write(`let ${outputVar} = null;`); + doc.write(`if (${accessor} !== null) {`); + doc.indented((d) => { + const innerOutput = generateCheck(d, ctx, def.innerType, accessor, buildsValue); + if (outputVar && innerOutput !== null) + d.write(`${outputVar} = ${innerOutput};`); + }); + doc.write(`}`); + return outputVar; +} +function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) { + const def = schema._zod.def; + doc.write(`if (!Array.isArray(${accessor})) return INVALID;`); + const outputVar = buildsValue ? newVar(ctx) : null; + const iVar = newVar(ctx); + const elemVar = newVar(ctx); + if (outputVar) + doc.write(`const ${outputVar} = new Array(${accessor}.length);`); + doc.write(`for (let ${iVar} = 0; ${iVar} < ${accessor}.length; ${iVar}++) {`); + doc.indented((d) => { + d.write(`const ${elemVar} = ${accessor}[${iVar}];`); + const elemOutput = compileChild(d, ctx, def.element, elemVar, buildsValue); + if (outputVar && elemOutput !== null) + d.write(`${outputVar}[${iVar}] = ${elemOutput};`); + }); + doc.write(`}`); + return outputVar; +} +function generateLiteralCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + const values = def.values; + if (values.length !== 1) { + const literalSet = addConstant(ctx, new Set(values)); + doc.write(`if (!${literalSet}.has(${accessor})) return INVALID;`); + return accessor; + } + const value = values[0]; + if (typeof value === "number" && Number.isNaN(value)) { + const literalSet = addConstant(ctx, new Set(values)); + doc.write(`if (!${literalSet}.has(${accessor})) return INVALID;`); + return accessor; + } + if (typeof value === "string") { + doc.write(`if (${accessor} !== ${esc(value)}) return INVALID;`); + } else if (typeof value === "number" || typeof value === "boolean") { + doc.write(`if (${accessor} !== ${value}) return INVALID;`); + } else if (value === null) { + doc.write(`if (${accessor} !== null) return INVALID;`); + } else if (value === void 0) { + doc.write(`if (${accessor} !== undefined) return INVALID;`); + } else if (typeof value === "bigint") { + doc.write(`if (${accessor} !== ${value}n) return INVALID;`); + } else { + throw new ZodCompileUnsupportedError(`literal type ${typeof value}`); + } + return accessor; +} +function generateEnumCheck(doc, ctx, schema, accessor) { + const values = schema._zod.values; + if (!values) { + throw new ZodCompileUnsupportedError("enum schema without enumerated values"); + } + const enumSet = addConstant(ctx, values); + doc.write(`if (!${enumSet}.has(${accessor})) return INVALID;`); + return accessor; +} +function generateWrapperCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + return generateCheck(doc, ctx, def.innerType, accessor); +} +function generateDefaultCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + const descriptor = Object.getOwnPropertyDescriptor(schema._zod.def, "defaultValue"); + const defaultGetter = descriptor ? () => schema._zod.def.defaultValue : void 0; + if (schema._zod.def.type === "prefault") { + if (!defaultGetter) { + return generateCheck(doc, ctx, def.innerType, accessor); + } + const defaultFn = addConstant(ctx, defaultGetter); + const inputVar = newVar(ctx); + doc.write(`let ${inputVar} = ${accessor};`); + doc.write(`if (${accessor} === undefined) ${inputVar} = ${defaultFn}();`); + return generateCheck(doc, ctx, def.innerType, inputVar); + } + const outputVar = newVar(ctx); + if (defaultGetter) { + const defaultFn = addConstant(ctx, defaultGetter); + const cloneFn = addConstant(ctx, shallowClone); + doc.write(`let ${outputVar};`); + doc.write(`if (${accessor} === undefined) {`); + doc.indented((d) => { + d.write(`${outputVar} = ${cloneFn}(${defaultFn}());`); + }); + doc.write(`} else {`); + doc.indented((d) => { + const innerOutput = generateCheck(d, ctx, def.innerType, accessor); + d.write(`${outputVar} = ${innerOutput} === undefined ? ${cloneFn}(${defaultFn}()) : ${innerOutput};`); + }); + doc.write(`}`); + } else { + doc.write(`let ${outputVar};`); + doc.write(`if (${accessor} !== undefined) {`); + doc.indented((d) => { + const innerOutput = generateCheck(d, ctx, def.innerType, accessor); + d.write(`${outputVar} = ${innerOutput};`); + }); + doc.write(`}`); + } + return outputVar; +} +function generateNonOptionalCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + const innerOutput = generateCheck(doc, ctx, def.innerType, accessor); + const outputVar = newVar(ctx); + doc.write(`const ${outputVar} = ${innerOutput};`); + doc.write(`if (${outputVar} === undefined) return INVALID;`); + return outputVar; +} +function generateTupleCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + const items = def.items; + const rest = def.rest; + doc.write(`if (!Array.isArray(${accessor})) return INVALID;`); + const optinStart = getTupleOptStart2(items, "optin"); + const optoutStart = getTupleOptStart2(items, "optout"); + if (rest) { + doc.write(`if (${accessor}.length < ${optinStart}) return INVALID;`); + } else { + doc.write(`if (${accessor}.length < ${optinStart} || ${accessor}.length > ${items.length}) return INVALID;`); + } + const outputVar = newVar(ctx); + doc.write(`const ${outputVar} = [];`); + for (let i = 0; i < items.length; i++) { + const itemSchema = items[i]; + if (i >= optoutStart) { + doc.write(`if (${outputVar}.length === ${i}) {`); + doc.indented((d) => { + d.write(`if (${i} < ${accessor}.length) {`); + d.indented((d2) => { + const elemVar = newVar(ctx); + d2.write(`const ${elemVar} = ${accessor}[${i}];`); + const elemOutput = compileChild(d2, ctx, itemSchema, elemVar); + d2.write(`${outputVar}[${i}] = ${elemOutput};`); + }); + d.write(`} else {`); + d.indented((d2) => { + if (dropsWhenAbsent(itemSchema)) { + d2.write(`${outputVar}.length = ${i};`); + return; + } + const elemVar = newVar(ctx); + const branchVar = newVar(ctx); + d2.write(`const ${elemVar} = undefined;`); + d2.write(`const ${branchVar} = (() => {`); + d2.indented((d3) => { + const elemOutput = compileChild(d3, ctx, itemSchema, elemVar); + d3.write(`return ${elemOutput};`); + }); + d2.write(`})();`); + d2.write(`if (${branchVar} === INVALID || ${branchVar} === undefined) ${outputVar}.length = ${i};`); + d2.write(`else ${outputVar}[${i}] = ${branchVar};`); + }); + d.write(`}`); + }); + doc.write(`}`); + } else { + const elemVar = newVar(ctx); + doc.write(`const ${elemVar} = ${accessor}[${i}];`); + const elemOutput = compileChild(doc, ctx, itemSchema, elemVar); + doc.write(`${outputVar}[${i}] = ${elemOutput};`); + } + } + if (rest) { + const iVar = newVar(ctx); + const elemVar = newVar(ctx); + doc.write(`for (let ${iVar} = ${items.length}; ${iVar} < ${accessor}.length; ${iVar}++) {`); + doc.indented((d) => { + d.write(`const ${elemVar} = ${accessor}[${iVar}];`); + const elemOutput = compileChild(d, ctx, rest, elemVar); + d.write(`${outputVar}[${iVar}] = ${elemOutput};`); + }); + doc.write(`}`); + } + return outputVar; +} +function getTupleOptStart2(items, key) { + for (let i = items.length - 1; i >= 0; i--) { + const omittable = key === "optin" ? items[i]._zod.optin !== void 0 : items[i]._zod.optout === "optional"; + if (!omittable) + return i + 1; + } + return 0; +} +function generateUnionCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + const options = def.options; + if (def.discriminator) { + return generateDiscriminatedUnionCheck(doc, ctx, def, accessor); + } + if (def.inclusive === false) { + throw new ZodCompileUnsupportedError("exclusive unions (z.xor)"); + } + if (options.length === 0) { + doc.write("return INVALID;"); + return accessor; + } + if (options.length === 1) { + return generateCheck(doc, ctx, options[0], accessor); + } + const allLiterals = options.every((opt) => opt._zod.def.type === "literal" && !opt._zod.def.checks?.length); + if (allLiterals) { + const values = new Set(options.flatMap((opt) => opt._zod.def.values)); + const valuesConst = addConstant(ctx, values); + doc.write(`if (!${valuesConst}.has(${accessor})) return INVALID;`); + return accessor; + } + const outputVar = newVar(ctx); + doc.write(`let ${outputVar};`); + for (let i = 0; i < options.length; i++) { + const opt = options[i]; + if (i === 0) { + doc.write(`${outputVar} = (() => {`); + } else { + doc.write(`if (${outputVar} === INVALID) ${outputVar} = (() => {`); + } + doc.indented((d) => { + const branchOutput = generateCheck(d, ctx, opt, accessor); + d.write(`return ${branchOutput};`); + }); + doc.write(`})();`); + } + doc.write(`if (${outputVar} === INVALID) return INVALID;`); + return outputVar; +} +function generateDiscriminatedUnionCheck(doc, ctx, def, accessor) { + if (def.unionFallback) { + throw new ZodCompileUnsupportedError("discriminated union with unionFallback"); + } + if (def.options.length === 0) { + doc.write("return INVALID;"); + return accessor; + } + const discVar = newVar(ctx); + const outputVar = newVar(ctx); + doc.write(`const ${discVar} = ${accessor}?.[${esc(def.discriminator)}];`); + doc.write(`let ${outputVar};`); + let firstBranch = true; + const claimed = /* @__PURE__ */ new Set(); + for (const option of def.options) { + const values = option._zod.propValues?.[def.discriminator]; + if (!values || values.size === 0) { + throw new ZodCompileUnsupportedError("discriminated union option without static discriminator values"); + } + for (const value of values) { + if (claimed.has(value)) { + throw new ZodCompileUnsupportedError(`duplicate discriminator value ${String(value)}`); + } + claimed.add(value); + } + const conditions = Array.from(values, (value) => literalEquality(ctx, discVar, value)); + const prefix = firstBranch ? "if" : "else if"; + doc.write(`${prefix} (${conditions.join(" || ")}) {`); + doc.indented((d) => { + const branchOutput = generateCheck(d, ctx, option, accessor); + d.write(`${outputVar} = ${branchOutput};`); + }); + doc.write(`}`); + firstBranch = false; + } + doc.write(`else { return INVALID; }`); + return outputVar; +} +function literalEquality(ctx, accessor, value) { + if (typeof value === "string") + return `${accessor} === ${esc(value)}`; + if (typeof value === "number") { + if (Number.isNaN(value)) + return `Number.isNaN(${accessor})`; + return `${accessor} === ${value}`; + } + if (typeof value === "boolean") + return `${accessor} === ${value}`; + if (value === null) + return `${accessor} === null`; + if (value === void 0) + return `${accessor} === undefined`; + if (typeof value === "bigint") + return `${accessor} === ${value}n`; + if (typeof value === "symbol") { + const symbolConst = addConstant(ctx, value); + return `${accessor} === ${symbolConst}`; + } + throw new ZodCompileUnsupportedError(`literal discriminator value ${String(value)}`); +} +function generateIntersectionCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + const leftOutput = compileChild(doc, ctx, def.left, accessor); + const rightOutput = compileChild(doc, ctx, def.right, accessor); + const mergeConst = addConstant(ctx, mergeValues2); + const mergedVar = newVar(ctx); + doc.write(`const ${mergedVar} = ${mergeConst}(${leftOutput}, ${rightOutput});`); + doc.write(`if (!${mergedVar}.valid) return INVALID;`); + return `${mergedVar}.data`; +} +function generateRecordCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + const isPlainObjectConst = addConstant(ctx, isPlainObject); + doc.write(`if (!${isPlainObjectConst}(${accessor})) return INVALID;`); + const outputVar = newVar(ctx); + const kVar = newVar(ctx); + const valVar = newVar(ctx); + doc.write(`const ${outputVar} = {};`); + const recordDef = def; + const keyValues = recordDef.partial ? void 0 : def.keyType._zod.values; + if (keyValues) { + const inputKeys = []; + for (const key of keyValues) { + if (!(typeof key === "string" || typeof key === "number" || typeof key === "symbol")) { + throw new ZodCompileUnsupportedError(`record key value ${String(key)}`); + } + const inputKey = typeof key === "number" ? key.toString() : key; + if (inputKey === "__proto__") { + throw new ZodCompileUnsupportedError('record key "__proto__"'); + } + inputKeys.push(inputKey); + const keyConst = addConstant(ctx, key); + const outKey = generateCheck(doc, ctx, def.keyType, keyConst); + const valueVar = newVar(ctx); + doc.write(`const ${valueVar} = ${accessor}[${literalPropertyKey(ctx, inputKey)}];`); + const valOutput = compileChild(doc, ctx, def.valueType, valueVar); + doc.write(`${outputVar}[${outKey}] = ${valOutput};`); + } + const knownKeysConst = addConstant(ctx, new Set(inputKeys)); + doc.write(`for (const ${kVar} in ${accessor}) {`); + doc.indented((d) => { + d.write(`if (${knownKeysConst}.has(${kVar})) continue;`); + if (recordDef.mode === "loose") { + d.write(`if (${kVar} !== "__proto__") ${outputVar}[${kVar}] = ${accessor}[${kVar}];`); + } else { + d.write(`return INVALID;`); + } + }); + doc.write(`}`); + return outputVar; + } + const keyDef = def.keyType._zod.def; + const keyIsBareString = keyDef.type === "string" && keyDef.format === void 0 && !keyDef.coerce && (keyDef.checks?.length ?? 0) === 0; + if (!keyIsBareString) { + const isLoose = def.mode === "loose"; + const keyFast = addConstant(ctx, compileFn(def.keyType)); + const numericConst = addConstant(ctx, number); + const propIsEnumerableConst = addConstant(ctx, Object.prototype.propertyIsEnumerable); + const outKeyVar = newVar(ctx); + doc.write(`for (const ${kVar} of Reflect.ownKeys(${accessor})) {`); + doc.indented((d) => { + d.write(`if (${kVar} === "__proto__") continue;`); + d.write(`if (!${propIsEnumerableConst}.call(${accessor}, ${kVar})) continue;`); + d.write(`let ${outKeyVar} = ${keyFast}(${kVar});`); + d.write(`if (${outKeyVar} === INVALID && typeof ${kVar} === "string" && ${numericConst}.test(${kVar})) ${outKeyVar} = ${keyFast}(Number(${kVar}));`); + if (isLoose) { + d.write(`if (${outKeyVar} === INVALID) { ${outputVar}[${kVar}] = ${accessor}[${kVar}]; continue; }`); + } else { + d.write(`if (${outKeyVar} === INVALID) return INVALID;`); + } + d.write(`if (${outKeyVar} === "__proto__") continue;`); + const valueVar = newVar(ctx); + d.write(`const ${valueVar} = ${accessor}[${kVar}];`); + const valOutput = compileChild(d, ctx, def.valueType, valueVar); + d.write(`${outputVar}[${outKeyVar}] = ${valOutput};`); + }); + doc.write(`}`); + return outputVar; + } + const propIsEnumerable = addConstant(ctx, Object.prototype.propertyIsEnumerable); + doc.write(`for (const ${kVar} of Reflect.ownKeys(${accessor})) {`); + doc.indented((d) => { + d.write(`if (${kVar} === "__proto__") continue;`); + d.write(`if (!${propIsEnumerable}.call(${accessor}, ${kVar})) continue;`); + d.write(`if (typeof ${kVar} !== "string") return INVALID;`); + d.write(`const ${valVar} = ${accessor}[${kVar}];`); + const valOutput = compileChild(d, ctx, def.valueType, valVar); + d.write(`${outputVar}[${kVar}] = ${valOutput};`); + }); + doc.write(`}`); + return outputVar; +} +function literalPropertyKey(ctx, key) { + if (typeof key === "string") + return esc(key); + return addConstant(ctx, key); +} +function generateMapCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`); + const outputVar = newVar(ctx); + const kVar = newVar(ctx); + const valVar = newVar(ctx); + doc.write(`const ${outputVar} = new Map();`); + doc.write(`for (const [${kVar}, ${valVar}] of ${accessor}) {`); + doc.indented((d) => { + const keyOutput = generateCheck(d, ctx, def.keyType, kVar); + const valOutput = generateCheck(d, ctx, def.valueType, valVar); + d.write(`${outputVar}.set(${keyOutput}, ${valOutput});`); + }); + doc.write(`}`); + return outputVar; +} +function generateSetCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`); + const outputVar = newVar(ctx); + const valVar = newVar(ctx); + doc.write(`const ${outputVar} = new Set();`); + doc.write(`for (const ${valVar} of ${accessor}) {`); + doc.indented((d) => { + const valOutput = generateCheck(d, ctx, def.valueType, valVar); + d.write(`${outputVar}.add(${valOutput});`); + }); + doc.write(`}`); + return outputVar; +} +function generateFileCheck(doc, accessor) { + doc.write(`if (!(${accessor} instanceof File)) return INVALID;`); + return accessor; +} +function generateTemplateLiteralCheck(doc, ctx, schema, accessor) { + doc.write(`if (typeof ${accessor} !== "string") return INVALID;`); + const pattern = schema._zod.pattern; + if (pattern) { + const patternConst = addConstant(ctx, pattern); + doc.write(`${patternConst}.lastIndex = 0;`); + doc.write(`if (!${patternConst}.test(${accessor})) return INVALID;`); + } + return accessor; +} +function generateLazyCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + const getterConst = addConstant(ctx, def.getter); + const cacheConst = addConstant(ctx, { parser: null }); + doc.write(`if (!${cacheConst}.parser) {`); + doc.indented((d) => { + d.write(`const inner = ${getterConst}();`); + d.write(`${cacheConst}.parser = function(input) {`); + d.indented((d2) => { + d2.write(`const result = inner._zod.run({ value: input, issues: [] }, {});`); + d2.write(`return result.issues.length === 0 ? result.value : INVALID;`); + }); + d.write(`};`); + }); + doc.write(`}`); + const outputVar = newVar(ctx); + doc.write(`const ${outputVar} = ${cacheConst}.parser(${accessor});`); + doc.write(`if (${outputVar} === INVALID) return INVALID;`); + return outputVar; +} +function generatePipeCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + const inputOutput = generateCheck(doc, ctx, def.in, accessor); + if (def.transform) { + if (isAsyncFunction(def.transform)) { + throw new ZodCompileAsyncError("z.compile: async transforms in pipes are not supported"); + } + const transformFn = def.transform; + const helperFn = (value) => { + const fakePayload = { value, issues: [], addIssue: pushIssue }; + const result = transformFn(value, fakePayload); + if (result instanceof Promise) + return INVALID2; + return fakePayload.issues.length === 0 ? result : INVALID2; + }; + const helperConst = addConstant(ctx, helperFn); + const transformedVar = newVar(ctx); + doc.write(`const ${transformedVar} = ${helperConst}(${inputOutput});`); + doc.write(`if (${transformedVar} === INVALID) return INVALID;`); + return generateCheck(doc, ctx, def.out, transformedVar); + } else { + return generateCheck(doc, ctx, def.out, inputOutput); + } +} +function isAsyncFunction(fn) { + return typeof fn === "function" && (fn.constructor.name === "AsyncFunction" || fn[Symbol.toStringTag] === "AsyncFunction"); +} +function generateCustomCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + if (def.fn) { + if (isAsyncFunction(def.fn)) { + throw new ZodCompileAsyncError("z.compile: async custom predicates are not supported"); + } + const fnConst = addConstant(ctx, def.fn); + const throwAsyncConst = addConstant(ctx, throwAsync); + const resVar = newVar(ctx); + doc.write(`const ${resVar} = ${fnConst}(${accessor});`); + doc.write(`if (${resVar} instanceof Promise) ${throwAsyncConst}();`); + doc.write(`if (!${resVar}) return INVALID;`); + } else { + throw new ZodCompileUnsupportedError("custom schema without a predicate function"); + } + return accessor; +} +function runtimeCatch(innerSchema, catchValue, value) { + const result = innerSchema._zod.run({ value, issues: [] }, {}); + if (result && typeof result.then === "function") + return INVALID2; + const r = result; + if (r.issues.length === 0) + return r.value; + return catchValue(); +} +function generateCatchCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + if (!def.catchValue[CONSTANT_CATCH]) { + throw new ZodCompileUnsupportedError("catch with a callback (only a constant catch value compiles)", false); + } + const outputVar = newVar(ctx); + doc.write(`let ${outputVar} = (() => {`); + doc.indented((d) => { + const innerOut = compileChild(d, ctx, def.innerType, accessor); + d.write(`return ${innerOut};`); + }); + doc.write(`})();`); + const innerConst = addConstant(ctx, def.innerType); + const catchConst = addConstant(ctx, def.catchValue); + const catchHelperConst = addConstant(ctx, runtimeCatch); + doc.write(`if (${outputVar} === INVALID) {`); + doc.indented((d) => { + d.write(`${outputVar} = ${catchHelperConst}(${innerConst}, ${catchConst}, ${accessor});`); + d.write(`if (${outputVar} === INVALID) return INVALID;`); + }); + doc.write(`}`); + return outputVar; +} +function generateTransformCheck(doc, ctx, schema, accessor) { + const def = schema._zod.def; + if (def.transform) { + if (isAsyncFunction(def.transform)) { + throw new ZodCompileAsyncError("z.compile: async transforms are not supported"); + } + const transformFn = def.transform; + const helperFn = (value) => { + const fakePayload = { value, issues: [], addIssue: pushIssue }; + const result = transformFn(value, fakePayload); + if (result instanceof Promise) + return INVALID2; + return fakePayload.issues.length === 0 ? result : INVALID2; + }; + const helperConst = addConstant(ctx, helperFn); + const outputVar = newVar(ctx); + doc.write(`const ${outputVar} = ${helperConst}(${accessor});`); + doc.write(`if (${outputVar} === INVALID) return INVALID;`); + return outputVar; + } + return accessor; +} + +// node_modules/zod/v4/core/api.js +// @__NO_SIDE_EFFECTS__ +function _string(Class2, params) { + return new Class2({ + type: "string", + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _coercedString(Class2, params) { + return new Class2({ + type: "string", + coerce: true, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _email(Class2, params) { + return new Class2({ + type: "string", + format: "email", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _guid(Class2, params) { + return new Class2({ + type: "string", + format: "guid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ +function _uuid(Class2, params) { + return new Class2({ + type: "string", + format: "uuid", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ function _uuidv4(Class2, params) { return new Class2({ type: "string", @@ -21430,6 +25109,16 @@ function _e164(Class2, params) { }); } // @__NO_SIDE_EFFECTS__ +function _creditCard(Class2, params) { + return new Class2({ + type: "string", + format: "credit_card", + check: "string_format", + abort: false, + ...normalizeParams(params) + }); +} +// @__NO_SIDE_EFFECTS__ function _jwt(Class2, params) { return new Class2({ type: "string", @@ -21843,6 +25532,10 @@ function _property(property, schema, params) { }); } // @__NO_SIDE_EFFECTS__ +function _properties(shape) { + return Object.entries(shape).map(([property, schema]) => new $ZodCheckProperty({ check: "property", property, schema })); +} +// @__NO_SIDE_EFFECTS__ function _mime(types, params) { return new $ZodCheckMimeType({ check: "mime_type", @@ -21859,23 +25552,23 @@ function _overwrite(tx) { } // @__NO_SIDE_EFFECTS__ function _normalize(form) { - return /* @__PURE__ */ _overwrite((input) => input.normalize(form)); + return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form)); } // @__NO_SIDE_EFFECTS__ function _trim() { - return /* @__PURE__ */ _overwrite((input) => input.trim()); + return /* @__PURE__ */ _overwrite((input2) => input2.trim()); } // @__NO_SIDE_EFFECTS__ function _toLowerCase() { - return /* @__PURE__ */ _overwrite((input) => input.toLowerCase()); + return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase()); } // @__NO_SIDE_EFFECTS__ function _toUpperCase() { - return /* @__PURE__ */ _overwrite((input) => input.toUpperCase()); + return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase()); } // @__NO_SIDE_EFFECTS__ function _slugify() { - return /* @__PURE__ */ _overwrite((input) => slugify(input)); + return /* @__PURE__ */ _overwrite((input2) => slugify(input2)); } // @__NO_SIDE_EFFECTS__ function _array(Class2, element, params) { @@ -22042,7 +25735,7 @@ function _catch(Class2, innerType, catchValue) { return new Class2({ type: "catch", innerType, - catchValue: typeof catchValue === "function" ? catchValue : () => catchValue + catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue) }); } // @__NO_SIDE_EFFECTS__ @@ -22115,7 +25808,8 @@ function _superRefine(fn, params) { if (_issue.fatal) _issue.continue = false; _issue.code ?? (_issue.code = "custom"); - _issue.input ?? (_issue.input = payload.value); + if (!("input" in _issue)) + _issue.input = payload.value; _issue.inst ?? (_issue.inst = ch); _issue.continue ?? (_issue.continue = !ch._zod.def.abort); payload.issues.push(issue(_issue)); @@ -22180,8 +25874,8 @@ function _stringbool(Classes, _params) { type: "pipe", in: stringSchema, out: booleanSchema, - transform: ((input, payload) => { - let data = input; + transform: ((input2, payload) => { + let data = input2; if (params.case !== "sensitive") data = data.toLowerCase(); if (truthySet.has(data)) { @@ -22200,8 +25894,8 @@ function _stringbool(Classes, _params) { return {}; } }), - reverseTransform: ((input, _payload) => { - if (input === true) { + reverseTransform: ((input2, _payload) => { + if (input2 === true) { return truthyArray[0] || "true"; } else { return falsyArray[0] || "false"; @@ -22209,13 +25903,15 @@ function _stringbool(Classes, _params) { }), error: params.error }); + codec2._zod.bag.truthy = truthyArray; + codec2._zod.bag.falsy = falsyArray; + codec2._zod.bag.case = params.case ?? "insensitive"; return codec2; } // @__NO_SIDE_EFFECTS__ function _stringFormat(Class2, format, fnOrRegex, _params = {}) { const params = normalizeParams(_params); const def = { - ...normalizeParams(_params), check: "string_format", type: "string", format, @@ -22230,6 +25926,16 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) { } // node_modules/zod/v4/core/to-json-schema.js +function assignProps(target, ...sources) { + for (const source of sources) { + for (const key of Reflect.ownKeys(source)) { + if (Object.prototype.propertyIsEnumerable.call(source, key)) { + assignProp(target, key, source[key]); + } + } + } + return target; +} function initializeContext(params) { let target = params?.target ?? "draft-2020-12"; if (target === "draft-4") @@ -22246,11 +25952,24 @@ function initializeContext(params) { io: params?.io ?? "output", counter: 0, seen: /* @__PURE__ */ new Map(), + sharedDefsExtractedFor: void 0, + sharedEmitDoneFor: void 0, cycles: params?.cycles ?? "ref", reused: params?.reused ?? "inline", + intersections: [], + deferred: [], external: params?.external ?? void 0 }; } +function handleUnrepresentable(schema, ctx, json2, params, message) { + const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message }) : ctx.unrepresentable; + if (result === "any") + return false; + if (result === void 0 || result === "throw") + throw new Error(message); + Object.assign(json2, result); + return true; +} function process2(schema, ctx, _params = { path: [], schemaPath: [] }) { var _a3; const def = schema._zod.def; @@ -22265,6 +25984,8 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) { } const result = { schema: {}, count: 1, cycle: void 0, path: _params.path }; ctx.seen.set(schema, result); + ctx.sharedDefsExtractedFor = void 0; + ctx.sharedEmitDoneFor = void 0; const overrideSchema = schema._zod.toJSONSchema?.(); if (overrideSchema) { result.schema = overrideSchema; @@ -22294,7 +26015,7 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) { } const meta3 = ctx.metadataRegistry.get(schema); if (meta3) - Object.assign(result.schema, meta3); + assignProps(result.schema, meta3); if (ctx.io === "input" && isTransforming(schema)) { delete result.schema.examples; delete result.schema.default; @@ -22305,10 +26026,15 @@ function process2(schema, ctx, _params = { path: [], schemaPath: [] }) { const _result = ctx.seen.get(schema); return _result.schema; } +function encodeJSONPointerSegment(segment) { + return segment.replace(/~/g, "~0").replace(/\//g, "~1"); +} function extractDefs(ctx, schema) { const root = ctx.seen.get(schema); if (!root) throw new Error("Unprocessed schema. This is a bug in Zod."); + if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) + return; const idToSchema = /* @__PURE__ */ new Map(); for (const entry of ctx.seen.entries()) { const id = ctx.metadataRegistry.get(entry[0])?.id; @@ -22330,15 +26056,15 @@ function extractDefs(ctx, schema) { } const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`; entry[1].defId = id; - return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` }; - } - if (entry[1] === root) { - return { ref: "#" }; + return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}` }; } const uriPrefix = `#`; const defUriPrefix = `${uriPrefix}/${defsSegment}/`; + if (entry[1] === root && !entry[1].schema.id) { + return { ref: uriPrefix }; + } const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`; - return { defId, ref: defUriPrefix + defId }; + return { defId, ref: defUriPrefix + encodeJSONPointerSegment(defId) }; }; const extractToDef = (entry) => { if (entry[1].schema.$ref) { @@ -22394,6 +26120,116 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. } } } + if (ctx.external) + ctx.sharedDefsExtractedFor = ctx.external; +} +function compactTypeUnion(schema) { + const options = schema.anyOf; + if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) + return; + const types = []; + for (const option of options) { + if (!option || typeof option !== "object") + return; + compactTypeUnion(option); + const keys = Object.keys(option); + if (keys.length !== 1 || keys[0] !== "type") + return; + const type = option.type; + for (const member of Array.isArray(type) ? type : [type]) { + if (typeof member !== "string") + return; + if (!types.includes(member)) + types.push(member); + } + } + delete schema.anyOf; + schema.type = types.length === 1 ? types[0] : types; +} +var FOLDABLE_KEYS = /* @__PURE__ */ new Set(["type", "properties", "required", "additionalProperties"]); +var UNION_KEYS = ["oneOf", "anyOf"]; +function undeclaredConstraint(member) { + const extra = member.additionalProperties; + if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) + return null; + return Object.keys(extra).length ? extra : null; +} +function foldObjects(members2) { + const objects = []; + for (const member of members2) { + if (typeof member !== "object" || member.type !== "object") + return null; + for (const key in member) { + if (!FOLDABLE_KEYS.has(key)) + return null; + } + objects.push(member); + } + const properties = {}; + const required2 = /* @__PURE__ */ new Set(); + for (const object3 of objects) { + for (const key in object3.properties) { + if (Object.prototype.hasOwnProperty.call(properties, key)) + continue; + const parts = []; + for (const other of objects) { + const part = other.properties?.[key] ?? undeclaredConstraint(other); + if (part === null || part === void 0) + continue; + if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) + parts.push(part); + } + const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts }; + assignProp(properties, key, merged); + } + for (const key of object3.required ?? []) + required2.add(key); + } + const folded = { type: "object", properties }; + if (required2.size) + folded.required = [...required2]; + if (objects.every((object3) => object3.additionalProperties === false)) { + folded.additionalProperties = false; + } else { + const constraints = []; + for (const object3 of objects) { + const constraint = undeclaredConstraint(object3); + if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) + constraints.push(constraint); + } + if (constraints.length === 1) + folded.additionalProperties = constraints[0]; + else if (constraints.length > 1) + folded.additionalProperties = { allOf: constraints }; + } + return folded; +} +function foldIntersection(json2) { + const allOf = json2.allOf; + if (!Array.isArray(allOf) || allOf.length < 2) + return; + for (const key of FOLDABLE_KEYS) + if (key in json2) + return; + const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k]))); + let folded = null; + if (!unions.length) { + folded = foldObjects(allOf); + } else { + const union2 = unions[0]; + const keyword = UNION_KEYS.find((k) => Array.isArray(union2[k])); + if (Object.keys(union2).length !== 1) + return; + const rest = allOf.filter((m) => m !== union2); + const branches = union2[keyword].map((branch) => foldObjects([...rest, branch])); + if (branches.some((b) => !b)) + return; + folded = { [keyword]: branches }; + } + if (!folded) + return; + delete json2.allOf; + assignProps(json2, folded); } function finalize(ctx, schema) { const root = ctx.seen.get(schema); @@ -22415,9 +26251,9 @@ function finalize(ctx, schema) { schema2.allOf = schema2.allOf ?? []; schema2.allOf.push(refSchema); } else { - Object.assign(schema2, refSchema); + assignProps(schema2, refSchema); } - Object.assign(schema2, _cached); + assignProps(schema2, _cached); const isParentRef = zodSchema._zod.parent === ref; if (isParentRef) { for (const key in schema2) { @@ -22461,8 +26297,36 @@ function finalize(ctx, schema) { path: seen.path ?? [] }); }; - for (const entry of [...ctx.seen.entries()].reverse()) { - flattenRef(entry[0]); + if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) { + for (const entry of [...ctx.seen.entries()].reverse()) { + flattenRef(entry[0]); + } + if (ctx.target !== "openapi-3.0") { + for (const entry of ctx.seen.entries()) { + compactTypeUnion(entry[1].def ?? entry[1].schema); + } + } + for (const rewrite of ctx.deferred) + rewrite(); + if (ctx.intersections.length) { + const carriers = /* @__PURE__ */ new Map(); + for (const seen of ctx.seen.values()) { + for (const json2 of [seen.schema, seen.def]) { + const allOf = json2?.allOf; + if (!Array.isArray(allOf)) + continue; + const existing = carriers.get(allOf); + if (existing) + existing.push(json2); + else + carriers.set(allOf, [json2]); + } + } + for (const allOf of ctx.intersections) { + for (const json2 of carriers.get(allOf) ?? []) + foldIntersection(json2); + } + } } const result = {}; if (ctx.target === "draft-2020-12") { @@ -22480,19 +26344,23 @@ function finalize(ctx, schema) { throw new Error("Schema is missing an `id` property"); result.$id = ctx.external.uri(id); } - Object.assign(result, root.def ?? root.schema); + assignProps(result, root.defId ? root.schema : root.def ?? root.schema); const rootMetaId = ctx.metadataRegistry.get(schema)?.id; if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id; const defs = ctx.external?.defs ?? {}; - for (const entry of ctx.seen.entries()) { - const seen = entry[1]; - if (seen.def && seen.defId) { - if (seen.def.id === seen.defId) - delete seen.def.id; - defs[seen.defId] = seen.def; + if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) { + for (const entry of ctx.seen.entries()) { + const seen = entry[1]; + if (seen.def && seen.defId) { + if (seen.def.id === seen.defId) + delete seen.def.id; + assignProp(defs, seen.defId, seen.def); + } } } + if (ctx.external) + ctx.sharedEmitDoneFor = ctx.external; if (ctx.external) { } else { if (Object.keys(defs).length > 0) { @@ -22535,7 +26403,7 @@ function isTransforming(_schema, _ctx) { return isTransforming(def.valueType, ctx); if (def.type === "lazy") return isTransforming(def.getter(), ctx); - if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") { + if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault" || def.type === "catch") { return isTransforming(def.innerType, ctx); } if (def.type === "intersection") { @@ -22600,7 +26468,7 @@ var formatMap = { var stringProcessor = (schema, ctx, _json, _params) => { const json2 = _json; json2.type = "string"; - const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag; + const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag; if (typeof minimum === "number") json2.minLength = minimum; if (typeof maximum === "number") @@ -22609,19 +26477,19 @@ var stringProcessor = (schema, ctx, _json, _params) => { json2.format = formatMap[format] ?? format; if (json2.format === "") delete json2.format; - if (format === "time") { + if (format === "time" || laxFormat) { delete json2.format; } } if (contentEncoding) json2.contentEncoding = contentEncoding; if (patterns && patterns.size > 0) { - const regexes = [...patterns]; - if (regexes.length === 1) - json2.pattern = regexes[0].source; - else if (regexes.length > 1) { + const patternList = [...patterns]; + if (patternList.length === 1) + json2.pattern = patternList[0].source; + else if (patternList.length > 1) { json2.allOf = [ - ...regexes.map((regex) => ({ + ...patternList.map((regex) => ({ ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {}, pattern: regex.source })) @@ -22629,7 +26497,7 @@ var stringProcessor = (schema, ctx, _json, _params) => { } } }; -var numberProcessor = (schema, ctx, _json, _params) => { +var numberProcessor = (schema, ctx, _json, params) => { const json2 = _json; const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag; if (typeof format === "string" && format.includes("int")) @@ -22659,21 +26527,21 @@ var numberProcessor = (schema, ctx, _json, _params) => { } else if (typeof maximum === "number") { json2.maximum = maximum; } - if (typeof multipleOf === "number") - json2.multipleOf = multipleOf; + if (typeof multipleOf === "number") { + if (Number.isFinite(multipleOf) && multipleOf !== 0) + json2.multipleOf = Math.abs(multipleOf); + else + handleUnrepresentable(schema, ctx, json2, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`); + } }; var booleanProcessor = (_schema, _ctx, json2, _params) => { json2.type = "boolean"; }; -var bigintProcessor = (_schema, ctx, _json, _params) => { - if (ctx.unrepresentable === "throw") { - throw new Error("BigInt cannot be represented in JSON Schema"); - } +var bigintProcessor = (schema, ctx, json2, params) => { + handleUnrepresentable(schema, ctx, json2, params, "BigInt cannot be represented in JSON Schema"); }; -var symbolProcessor = (_schema, ctx, _json, _params) => { - if (ctx.unrepresentable === "throw") { - throw new Error("Symbols cannot be represented in JSON Schema"); - } +var symbolProcessor = (schema, ctx, json2, params) => { + handleUnrepresentable(schema, ctx, json2, params, "Symbols cannot be represented in JSON Schema"); }; var nullProcessor = (_schema, ctx, json2, _params) => { if (ctx.target === "openapi-3.0") { @@ -22684,15 +26552,11 @@ var nullProcessor = (_schema, ctx, json2, _params) => { json2.type = "null"; } }; -var undefinedProcessor = (_schema, ctx, _json, _params) => { - if (ctx.unrepresentable === "throw") { - throw new Error("Undefined cannot be represented in JSON Schema"); - } +var undefinedProcessor = (schema, ctx, json2, params) => { + handleUnrepresentable(schema, ctx, json2, params, "Undefined cannot be represented in JSON Schema"); }; -var voidProcessor = (_schema, ctx, _json, _params) => { - if (ctx.unrepresentable === "throw") { - throw new Error("Void cannot be represented in JSON Schema"); - } +var voidProcessor = (schema, ctx, json2, params) => { + handleUnrepresentable(schema, ctx, json2, params, "Void cannot be represented in JSON Schema"); }; var neverProcessor = (_schema, _ctx, json2, _params) => { json2.not = {}; @@ -22701,35 +26565,37 @@ var anyProcessor = (_schema, _ctx, _json, _params) => { }; var unknownProcessor = (_schema, _ctx, _json, _params) => { }; -var dateProcessor = (_schema, ctx, _json, _params) => { - if (ctx.unrepresentable === "throw") { - throw new Error("Date cannot be represented in JSON Schema"); - } +var dateProcessor = (schema, ctx, json2, params) => { + handleUnrepresentable(schema, ctx, json2, params, "Date cannot be represented in JSON Schema"); }; var enumProcessor = (schema, _ctx, json2, _params) => { const def = schema._zod.def; const values = getEnumValues(def.entries); + if (values.length === 0) { + json2.not = {}; + return; + } if (values.every((v) => typeof v === "number")) json2.type = "number"; if (values.every((v) => typeof v === "string")) json2.type = "string"; json2.enum = values; }; -var literalProcessor = (schema, ctx, json2, _params) => { +var literalProcessor = (schema, ctx, json2, params) => { const def = schema._zod.def; + if (def.values.length === 0) { + json2.not = {}; + return; + } const vals = []; for (const val of def.values) { if (val === void 0) { - if (ctx.unrepresentable === "throw") { - throw new Error("Literal `undefined` cannot be represented in JSON Schema"); - } else { - } + if (handleUnrepresentable(schema, ctx, json2, params, "Literal `undefined` cannot be represented in JSON Schema")) + return; } else if (typeof val === "bigint") { - if (ctx.unrepresentable === "throw") { - throw new Error("BigInt literals cannot be represented in JSON Schema"); - } else { - vals.push(Number(val)); - } + if (handleUnrepresentable(schema, ctx, json2, params, "BigInt literals cannot be represented in JSON Schema")) + return; + vals.push(Number(val)); } else { vals.push(val); } @@ -22755,10 +26621,8 @@ var literalProcessor = (schema, ctx, json2, _params) => { json2.enum = vals; } }; -var nanProcessor = (_schema, ctx, _json, _params) => { - if (ctx.unrepresentable === "throw") { - throw new Error("NaN cannot be represented in JSON Schema"); - } +var nanProcessor = (schema, ctx, json2, params) => { + handleUnrepresentable(schema, ctx, json2, params, "NaN cannot be represented in JSON Schema"); }; var templateLiteralProcessor = (schema, _ctx, json2, _params) => { const _json = json2; @@ -22795,30 +26659,20 @@ var fileProcessor = (schema, _ctx, json2, _params) => { var successProcessor = (_schema, _ctx, json2, _params) => { json2.type = "boolean"; }; -var customProcessor = (_schema, ctx, _json, _params) => { - if (ctx.unrepresentable === "throw") { - throw new Error("Custom types cannot be represented in JSON Schema"); - } +var customProcessor = (schema, ctx, json2, params) => { + handleUnrepresentable(schema, ctx, json2, params, "Custom types cannot be represented in JSON Schema"); }; -var functionProcessor = (_schema, ctx, _json, _params) => { - if (ctx.unrepresentable === "throw") { - throw new Error("Function types cannot be represented in JSON Schema"); - } +var functionProcessor = (schema, ctx, json2, params) => { + handleUnrepresentable(schema, ctx, json2, params, "Function types cannot be represented in JSON Schema"); }; -var transformProcessor = (_schema, ctx, _json, _params) => { - if (ctx.unrepresentable === "throw") { - throw new Error("Transforms cannot be represented in JSON Schema"); - } +var transformProcessor = (schema, ctx, json2, params) => { + handleUnrepresentable(schema, ctx, json2, params, "Transforms cannot be represented in JSON Schema"); }; -var mapProcessor = (_schema, ctx, _json, _params) => { - if (ctx.unrepresentable === "throw") { - throw new Error("Map cannot be represented in JSON Schema"); - } +var mapProcessor = (schema, ctx, json2, params) => { + handleUnrepresentable(schema, ctx, json2, params, "Map cannot be represented in JSON Schema"); }; -var setProcessor = (_schema, ctx, _json, _params) => { - if (ctx.unrepresentable === "throw") { - throw new Error("Set cannot be represented in JSON Schema"); - } +var setProcessor = (schema, ctx, json2, params) => { + handleUnrepresentable(schema, ctx, json2, params, "Set cannot be represented in JSON Schema"); }; var arrayProcessor = (schema, ctx, _json, params) => { const json2 = _json; @@ -22834,25 +26688,39 @@ var arrayProcessor = (schema, ctx, _json, params) => { path: [...params.path, "items"] }); }; +function inputOptin(schema) { + const def = schema._zod.def; + if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) { + return inputOptin(def.out); + } + if (def.type === "catch") { + return inputOptin(def.innerType); + } + return schema._zod.optin; +} var objectProcessor = (schema, ctx, _json, params) => { const json2 = _json; const def = schema._zod.def; + const shape = def.shape; + const symbolKeys = Object.getOwnPropertySymbols(shape); + if (symbolKeys.length && handleUnrepresentable(schema, ctx, json2, params, "Symbol keys cannot be represented in JSON Schema")) { + return; + } json2.type = "object"; json2.properties = {}; - const shape = def.shape; for (const key in shape) { - json2.properties[key] = process2(shape[key], ctx, { + assignProp(json2.properties, key, process2(shape[key], ctx, { ...params, path: [...params.path, "properties", key] - }); + })); } const allKeys = new Set(Object.keys(shape)); const requiredKeys = new Set([...allKeys].filter((key) => { - const v = def.shape[key]._zod; + const field = def.shape[key]; if (ctx.io === "input") { - return v.optin === void 0; + return inputOptin(field) === void 0; } else { - return v.optout === void 0; + return field._zod.optout === void 0; } })); if (requiredKeys.size > 0) { @@ -22899,6 +26767,7 @@ var intersectionProcessor = (schema, ctx, json2, params) => { ...isSimpleIntersection(b) ? b.allOf : [b] ]; json2.allOf = allOf; + ctx.intersections.push(allOf); }; var tupleProcessor = (schema, ctx, _json, params) => { const json2 = _json; @@ -22914,11 +26783,27 @@ var tupleProcessor = (schema, ctx, _json, params) => { ...params, path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []] }) : null; + let minItems = def.items.length; + while (minItems > 0) { + const item = def.items[minItems - 1]; + const optional2 = ctx.io === "input" ? inputOptin(item) !== void 0 : item._zod.optout === "optional"; + if (!optional2) + break; + minItems--; + } + const maxItems = def.items.length; + const isClosed = !def.rest; if (ctx.target === "draft-2020-12") { json2.prefixItems = prefixItems; - if (rest) { + if (isClosed) { + json2.items = false; + } else if (rest) { json2.items = rest; } + if (minItems > 0) + json2.minItems = minItems; + if (isClosed) + json2.maxItems = maxItems; } else if (ctx.target === "openapi-3.0") { json2.items = { anyOf: prefixItems @@ -22926,15 +26811,21 @@ var tupleProcessor = (schema, ctx, _json, params) => { if (rest) { json2.items.anyOf.push(rest); } - json2.minItems = prefixItems.length; - if (!rest) { - json2.maxItems = prefixItems.length; - } + if (minItems > 0) + json2.minItems = minItems; + if (isClosed) + json2.maxItems = maxItems; } else { json2.items = prefixItems; - if (rest) { + if (isClosed) { + json2.additionalItems = false; + } else if (rest) { json2.additionalItems = rest; } + if (minItems > 0) + json2.minItems = minItems; + if (isClosed) + json2.maxItems = maxItems; } const { minimum, maximum } = schema._zod.bag; if (typeof minimum === "number") @@ -22942,6 +26833,69 @@ var tupleProcessor = (schema, ctx, _json, params) => { if (typeof maximum === "number") json2.maxItems = maximum; }; +function stringifyKeyNames(bySchema, json2, visited) { + if (json2.$ref) { + if (visited.has(json2)) + return json2; + visited.add(json2); + const def = bySchema.get(json2)?.def; + if (!def) + return json2; + const inlined = stringifyKeyNames(bySchema, def, visited); + return inlined === def ? json2 : inlined; + } + for (const keyword of ["anyOf", "oneOf"]) { + const branches = json2[keyword]; + if (!Array.isArray(branches)) + continue; + const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited)); + if (mapped.some((branch, i) => branch !== branches[i])) + json2 = { ...json2, [keyword]: mapped }; + } + const types = Array.isArray(json2.type) ? json2.type : [json2.type]; + const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer"); + const values = json2.enum ?? (json2.const !== void 0 ? [json2.const] : void 0); + if (!numericType && !values?.some((v) => typeof v === "number")) + return json2; + const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json2; + if (rest.enum) + rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v); + else if (typeof rest.const === "number") + rest.const = String(rest.const); + if (!numericType) + return rest; + rest.type = "string"; + if (!values) + rest.pattern = (types.includes("number") ? number : integer).source; + return rest; +} +var pendingRecords = /* @__PURE__ */ new WeakMap(); +function rewriteKeyNames(ctx) { + const bySchema = /* @__PURE__ */ new Map(); + for (const entry of ctx.seen.values()) { + if (entry.def && !bySchema.has(entry.schema)) + bySchema.set(entry.schema, entry); + } + const rewrites = /* @__PURE__ */ new Map(); + for (const record2 of pendingRecords.get(ctx) ?? []) { + const seen = ctx.seen.get(record2); + const names = (seen?.def ?? seen?.schema)?.propertyNames; + if (!names || names === true || rewrites.has(names)) + continue; + const rewritten = stringifyKeyNames(bySchema, names, /* @__PURE__ */ new Set()); + if (rewritten !== names) + rewrites.set(names, rewritten); + } + if (!rewrites.size) + return; + for (const entry of ctx.seen.values()) { + for (const carrier of [entry.schema, entry.def]) { + const rewritten = carrier && rewrites.get(carrier.propertyNames); + if (rewritten) + carrier.propertyNames = rewritten; + } + } +} var recordProcessor = (schema, ctx, _json, params) => { const json2 = _json; const def = schema._zod.def; @@ -22956,7 +26910,7 @@ var recordProcessor = (schema, ctx, _json, params) => { }); json2.patternProperties = {}; for (const pattern of patterns) { - json2.patternProperties[pattern.source] = valueSchema; + assignProp(json2.patternProperties, pattern.source, valueSchema); } } else { if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") { @@ -22964,6 +26918,13 @@ var recordProcessor = (schema, ctx, _json, params) => { ...params, path: [...params.path, "propertyNames"] }); + let pending = pendingRecords.get(ctx); + if (!pending) { + pending = []; + pendingRecords.set(ctx, pending); + ctx.deferred.push(() => rewriteKeyNames(ctx)); + } + pending.push(schema); } json2.additionalProperties = process2(def.valueType, ctx, { ...params, @@ -22971,10 +26932,11 @@ var recordProcessor = (schema, ctx, _json, params) => { }); } const keyValues = keyType._zod.values; - if (keyValues) { + const omittableOnInput = ctx.io === "input" && inputOptin(def.valueType) !== void 0; + if (keyValues && !def.partial && !omittableOnInput) { const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number"); if (validKeyValues.length > 0) { - json2.required = validKeyValues; + json2.required = validKeyValues.map(String); } } }; @@ -22995,20 +26957,39 @@ var nonoptionalProcessor = (schema, ctx, _json, params) => { const seen = ctx.seen.get(schema); seen.ref = def.innerType; }; +var UNREPRESENTABLE_DEFAULT = /* @__PURE__ */ Symbol(); +function serializeDefaultValue(value, schema, ctx, json2, params) { + let unrepresentable = false; + const serialized = JSON.stringify(value, (_, val) => { + if (typeof val !== "bigint") + return val; + unrepresentable = true; + return null; + }); + if (!unrepresentable) + return JSON.parse(serialized); + handleUnrepresentable(schema, ctx, json2, params, "BigInt defaults cannot be represented in JSON Schema"); + return UNREPRESENTABLE_DEFAULT; +} var defaultProcessor = (schema, ctx, json2, params) => { const def = schema._zod.def; process2(def.innerType, ctx, params); const seen = ctx.seen.get(schema); seen.ref = def.innerType; - json2.default = JSON.parse(JSON.stringify(def.defaultValue)); + const value = serializeDefaultValue(def.defaultValue, schema, ctx, json2, params); + if (value !== UNREPRESENTABLE_DEFAULT) + json2.default = value; }; var prefaultProcessor = (schema, ctx, json2, params) => { const def = schema._zod.def; process2(def.innerType, ctx, params); const seen = ctx.seen.get(schema); seen.ref = def.innerType; - if (ctx.io === "input") - json2._prefault = JSON.parse(JSON.stringify(def.defaultValue)); + if (ctx.io !== "input") + return; + const value = serializeDefaultValue(def.defaultValue, schema, ctx, json2, params); + if (value !== UNREPRESENTABLE_DEFAULT) + json2._prefault = value; }; var catchProcessor = (schema, ctx, json2, params) => { const def = schema._zod.def; @@ -23019,7 +27000,8 @@ var catchProcessor = (schema, ctx, json2, params) => { try { catchValue = def.catchValue(void 0); } catch { - throw new Error("Dynamic catch values are not supported in JSON Schema"); + handleUnrepresentable(schema, ctx, json2, params, "Dynamic catch values are not supported in JSON Schema"); + return; } json2.default = catchValue; }; @@ -23097,9 +27079,9 @@ var allProcessors = { optional: optionalProcessor, lazy: lazyProcessor }; -function toJSONSchema(input, params) { - if ("_idmap" in input) { - const registry2 = input; +function toJSONSchema(input2, params) { + if ("_idmap" in input2) { + const registry2 = input2; const ctx2 = initializeContext({ ...params, processors: allProcessors }); const defs = {}; for (const entry of registry2._idmap.entries()) { @@ -23116,7 +27098,7 @@ function toJSONSchema(input, params) { for (const entry of registry2._idmap.entries()) { const [key, schema] = entry; extractDefs(ctx2, schema); - schemas[key] = finalize(ctx2, schema); + assignProp(schemas, key, finalize(ctx2, schema)); } if (Object.keys(defs).length > 0) { const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions"; @@ -23127,9 +27109,9 @@ function toJSONSchema(input, params) { return { schemas }; } const ctx = initializeContext({ ...params, processors: allProcessors }); - process2(input, ctx); - extractDefs(ctx, input); - return finalize(ctx, input); + process2(input2, ctx); + extractDefs(ctx, input2); + return finalize(ctx, input2); } // node_modules/zod/v4/core/json-schema-generator.js @@ -23142,6 +27124,7 @@ var JSONSchemaGenerator = class { get target() { return this.ctx.target; } + // annotated so the .d.cts emits an indexed access rather than an inline `import()` of an ESM path /** @deprecated Access via ctx instead */ get unrepresentable() { return this.ctx.unrepresentable; @@ -23200,6 +27183,8 @@ var JSONSchemaGenerator = class { if (_params.external) this.ctx.external = _params.external; } + this.ctx.sharedDefsExtractedFor = void 0; + this.ctx.sharedEmitDoneFor = void 0; extractDefs(this.ctx, schema); const result = finalize(this.ctx, schema); const { "~standard": _, ...plainResult } = result; @@ -23217,34 +27202,54 @@ var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => { $ZodType.init(inst, def); inst.def = def; inst.type = def.type; - inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse }); - inst.safeParse = (data, params) => safeParse(inst, data, params); - inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync }); - inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params); - inst.check = (...checks) => { - return inst.clone({ +}, { + // `with` is an alias for `check`: the same function object, not a wrapper. + get with() { + return this.check; + }, + set with(value) { + own(this, "with", value); + }, + parse(data, params) { + return parse(this, data, params, { callee: this.parse }); + }, + parseAsync(data, params) { + return parseAsync(this, data, params, { callee: this.parseAsync }); + }, + safeParse(data, params) { + return safeParse(this, data, params); + }, + safeParseAsync(data, params) { + return safeParseAsync(this, data, params); + }, + check(...checks) { + const def = this.def; + return this.clone({ ...def, checks: [ ...def.checks ?? [], - ...checks.map((ch) => typeof ch === "function" ? { - _zod: { check: ch, def: { check: "custom" }, onattach: [] } - } : ch) + ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch) ] }, { parent: true }); - }; - inst.with = inst.check; - inst.clone = (_def, params) => clone(inst, _def, params); - inst.brand = () => inst; - inst.register = ((reg, meta3) => { - reg.add(inst, meta3); - return inst; - }); - inst.apply = (fn) => fn(inst); + }, + clone(_def, params) { + return clone(this, _def, params); + }, + brand() { + return this; + }, + register(reg, meta3) { + reg.add(this, meta3); + return this; + }, + apply(fn, ...args) { + return args.length === 0 ? fn(this) : fn(this, ...args); + } }); var ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => { $ZodObject.init(inst, def); ZodMiniType.init(inst, def); - defineLazy(inst, "shape", () => def.shape); + installLazyProp(inst, "shape", (self) => self._zod.def.shape, false); }); // @__NO_SIDE_EFFECTS__ function object(shape, params) { @@ -23256,6 +27261,161 @@ function object(shape, params) { return new ZodMiniObject(def); } +// node_modules/zod/v4/core/visit.js +var RESOLVING = /* @__PURE__ */ Symbol("z.visit/resolving"); +function visit(schema, fnOrHandlers) { + const fn = typeof fnOrHandlers === "function" ? fnOrHandlers : (node2, rewritten) => { + const h = fnOrHandlers[node2._zod.def.type]; + return h ? h(node2, rewritten) : node2; + }; + const cache = /* @__PURE__ */ new Map(); + function run(s) { + const cached2 = cache.get(s); + if (cached2 === RESOLVING) { + return new $ZodLazy({ + type: "lazy", + getter: () => cache.get(s) + }); + } + if (cached2 !== void 0) + return cached2; + cache.set(s, RESOLVING); + const inner = mapInner(s); + const mapped = fn(inner, inner !== s); + cache.set(s, mapped); + return mapped; + } + function mapInner(s) { + const def = s._zod.def; + const kind = def.type; + switch (kind) { + case "object": { + const oldShape = def.shape; + const keys = Object.keys(oldShape); + let changed = false; + const newShape = {}; + for (const k of keys) { + const mapped = run(oldShape[k]); + if (mapped !== oldShape[k]) + changed = true; + newShape[k] = mapped; + } + let newCatchall = def.catchall; + if (def.catchall) { + newCatchall = run(def.catchall); + if (newCatchall !== def.catchall) + changed = true; + } + return changed ? clone(s, { ...def, shape: newShape, catchall: newCatchall }) : s; + } + case "array": { + const mapped = run(def.element); + return mapped === def.element ? s : clone(s, { ...def, element: mapped }); + } + case "tuple": { + const oldItems = def.items; + let changed = false; + const newItems = []; + for (const item of oldItems) { + const mapped = run(item); + if (mapped !== item) + changed = true; + newItems.push(mapped); + } + let newRest = def.rest; + if (def.rest) { + newRest = run(def.rest); + if (newRest !== def.rest) + changed = true; + } + return changed ? clone(s, { ...def, items: newItems, rest: newRest }) : s; + } + case "record": + case "map": { + const newKey = run(def.keyType); + const newVal = run(def.valueType); + return newKey === def.keyType && newVal === def.valueType ? s : clone(s, { ...def, keyType: newKey, valueType: newVal }); + } + case "set": { + const newVal = run(def.valueType); + return newVal === def.valueType ? s : clone(s, { ...def, valueType: newVal }); + } + case "union": { + const oldOptions = def.options; + let changed = false; + const newOptions = []; + for (const opt of oldOptions) { + const mapped = run(opt); + if (mapped !== opt) + changed = true; + newOptions.push(mapped); + } + return changed ? clone(s, { ...def, options: newOptions }) : s; + } + case "intersection": { + const newLeft = run(def.left); + const newRight = run(def.right); + return newLeft === def.left && newRight === def.right ? s : clone(s, { ...def, left: newLeft, right: newRight }); + } + case "optional": + case "nullable": + case "default": + case "prefault": + case "catch": + case "readonly": + case "nonoptional": + case "promise": + case "success": { + const newInner = run(def.innerType); + return newInner === def.innerType ? s : clone(s, { ...def, innerType: newInner }); + } + case "pipe": { + const newIn = run(def.in); + const newOut = run(def.out); + return newIn === def.in && newOut === def.out ? s : clone(s, { ...def, in: newIn, out: newOut }); + } + case "function": { + const newInput = run(def.input); + const newOutput = run(def.output); + return newInput === def.input && newOutput === def.output ? s : clone(s, { ...def, input: newInput, output: newOutput }); + } + case "lazy": { + const original = def.getter; + const { _cachedInner, ...rest } = def; + return clone(s, { ...rest, getter: () => run(original()) }); + } + // A leaf by choice: `parts` are regex fragments, not data positions. + case "template_literal": + // Leaves. + case "string": + case "number": + case "int": + case "boolean": + case "bigint": + case "symbol": + case "undefined": + case "null": + case "void": + case "never": + case "any": + case "unknown": + case "date": + case "nan": + case "enum": + case "literal": + case "file": + case "transform": + case "custom": + return s; + default: { + kind; + return s; + } + } + } + return run(schema); +} + // node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js function isZ4Schema(s) { const schema = s; @@ -23340,24 +27500,40 @@ function normalizeObjectSchema(schema) { } return void 0; } -function getParseErrorMessage(error51) { - if (error51 && typeof error51 === "object") { - if ("message" in error51 && typeof error51.message === "string") { - return error51.message; +function getDotPath(path3) { + if (path3.length === 0) { + return "object root"; + } + return path3.reduce((acc, seg, index) => { + if (index === 0) { + return String(seg); } - if ("issues" in error51 && Array.isArray(error51.issues) && error51.issues.length > 0) { - const firstIssue = error51.issues[0]; - if (firstIssue && typeof firstIssue === "object" && "message" in firstIssue) { - return String(firstIssue.message); - } + if (typeof seg === "number") { + return `${acc}[${seg}]`; + } + return `${acc}.${seg}`; + }, ""); +} +function getParseErrorMessage(error61) { + if (error61 && typeof error61 === "object") { + if ("issues" in error61 && Array.isArray(error61.issues) && error61.issues.length > 0) { + return error61.issues.map((i) => { + if (!i.path?.length) { + return i.message; + } + return `${i.message} at ${getDotPath(i.path)}`; + }).join("\n"); + } + if ("message" in error61 && typeof error61.message === "string") { + return error61.message; } try { - return JSON.stringify(error51); + return JSON.stringify(error61); } catch { - return String(error51); + return String(error61); } } - return String(error51); + return String(error61); } function getSchemaDescription(schema) { return schema.description; @@ -23421,6 +27597,9 @@ __export(external_exports, { ZodCUID2: () => ZodCUID2, ZodCatch: () => ZodCatch2, ZodCodec: () => ZodCodec, + ZodCompileAsyncError: () => ZodCompileAsyncError, + ZodCompileUnsupportedError: () => ZodCompileUnsupportedError, + ZodCreditCard: () => ZodCreditCard, ZodCustom: () => ZodCustom, ZodCustomStringFormat: () => ZodCustomStringFormat, ZodDate: () => ZodDate2, @@ -23501,14 +27680,17 @@ __export(external_exports, { clone: () => clone, codec: () => codec, coerce: () => coerce_exports2, + compile: () => compile, config: () => config, core: () => core_exports2, + creditCard: () => creditCard2, cuid: () => cuid3, cuid2: () => cuid22, custom: () => custom, - date: () => date3, + date: () => date2, decode: () => decode2, decodeAsync: () => decodeAsync2, + deepPartial: () => deepPartial, describe: () => describe2, discriminatedUnion: () => discriminatedUnion, e164: () => e1642, @@ -23526,6 +27708,7 @@ __export(external_exports, { formatError: () => formatError, fromJSONSchema: () => fromJSONSchema, function: () => _function, + getDiscriminatedOption: () => getDiscriminatedOption, getErrorMap: () => getErrorMap2, globalRegistry: () => globalRegistry, gt: () => _gt, @@ -23536,6 +27719,7 @@ __export(external_exports, { hostname: () => hostname2, httpUrl: () => httpUrl, includes: () => _includes, + input: () => input, instanceof: () => _instanceof, int: () => int, int32: () => int32, @@ -23562,6 +27746,7 @@ __export(external_exports, { map: () => map, maxLength: () => _maxLength, maxSize: () => _maxSize, + memoizer: () => memoizer, meta: () => meta2, mime: () => _mime, minLength: () => _minLength, @@ -23582,6 +27767,7 @@ __export(external_exports, { number: () => number2, object: () => object2, optional: () => optional, + output: () => output, overwrite: () => _overwrite, parse: () => parse2, parseAsync: () => parseAsync2, @@ -23592,6 +27778,7 @@ __export(external_exports, { preprocess: () => preprocess, prettifyError: () => prettifyError, promise: () => promise, + properties: () => _properties, property: () => _property, readonly: () => readonly, record: () => record, @@ -23621,6 +27808,7 @@ __export(external_exports, { toJSONSchema: () => toJSONSchema, toLowerCase: () => _toLowerCase, toUpperCase: () => _toUpperCase, + toZod: () => toZod, transform: () => transform, treeifyError: () => treeifyError, trim: () => _trim, @@ -23638,6 +27826,8 @@ __export(external_exports, { uuidv4: () => uuidv4, uuidv6: () => uuidv6, uuidv7: () => uuidv7, + validate: () => validate, + validateAsync: () => validateAsync, void: () => _void2, xid: () => xid2, xor: () => xor @@ -23659,6 +27849,7 @@ __export(schemas_exports2, { ZodCUID2: () => ZodCUID2, ZodCatch: () => ZodCatch2, ZodCodec: () => ZodCodec, + ZodCreditCard: () => ZodCreditCard, ZodCustom: () => ZodCustom, ZodCustomStringFormat: () => ZodCustomStringFormat, ZodDate: () => ZodDate2, @@ -23674,6 +27865,10 @@ __export(schemas_exports2, { ZodGUID: () => ZodGUID, ZodIPv4: () => ZodIPv4, ZodIPv6: () => ZodIPv6, + ZodISODate: () => ZodISODate, + ZodISODateTime: () => ZodISODateTime, + ZodISODuration: () => ZodISODuration, + ZodISOTime: () => ZodISOTime, ZodIntersection: () => ZodIntersection2, ZodJWT: () => ZodJWT, ZodKSUID: () => ZodKSUID, @@ -23729,10 +27924,11 @@ __export(schemas_exports2, { cidrv4: () => cidrv42, cidrv6: () => cidrv62, codec: () => codec, + creditCard: () => creditCard2, cuid: () => cuid3, cuid2: () => cuid22, custom: () => custom, - date: () => date3, + date: () => date2, describe: () => describe2, discriminatedUnion: () => discriminatedUnion, e164: () => e1642, @@ -23837,95 +28033,61 @@ __export(checks_exports2, { normalize: () => _normalize, overwrite: () => _overwrite, positive: () => _positive, - property: () => _property, - regex: () => _regex, - size: () => _size, - slugify: () => _slugify, - startsWith: () => _startsWith, - toLowerCase: () => _toLowerCase, - toUpperCase: () => _toUpperCase, - trim: () => _trim, - uppercase: () => _uppercase -}); - -// node_modules/zod/v4/classic/iso.js -var iso_exports2 = {}; -__export(iso_exports2, { - ZodISODate: () => ZodISODate, - ZodISODateTime: () => ZodISODateTime, - ZodISODuration: () => ZodISODuration, - ZodISOTime: () => ZodISOTime, - date: () => date2, - datetime: () => datetime2, - duration: () => duration2, - time: () => time2 -}); -var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => { - $ZodISODateTime.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function datetime2(params) { - return _isoDateTime(ZodISODateTime, params); -} -var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => { - $ZodISODate.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function date2(params) { - return _isoDate(ZodISODate, params); -} -var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => { - $ZodISOTime.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function time2(params) { - return _isoTime(ZodISOTime, params); -} -var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => { - $ZodISODuration.init(inst, def); - ZodStringFormat.init(inst, def); + properties: () => _properties, + property: () => _property, + regex: () => _regex, + size: () => _size, + slugify: () => _slugify, + startsWith: () => _startsWith, + toLowerCase: () => _toLowerCase, + toUpperCase: () => _toUpperCase, + trim: () => _trim, + uppercase: () => _uppercase }); -function duration2(params) { - return _isoDuration(ZodISODuration, params); -} // node_modules/zod/v4/classic/errors.js +var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]); +function _lazyMethod(proto, key, make) { + Object.defineProperty(proto, key, { + configurable: true, + enumerable: false, + get() { + const value = make(this); + Object.defineProperty(this, key, { value, configurable: true, writable: true }); + return value; + }, + set(value) { + Object.defineProperty(this, key, { value, configurable: true, writable: true }); + } + }); +} var initializer2 = (inst, issues) => { $ZodError.init(inst, issues); inst.name = "ZodError"; - Object.defineProperties(inst, { - format: { - value: (mapper) => formatError(inst, mapper) - // enumerable: false, - }, - flatten: { - value: (mapper) => flattenError(inst, mapper) - // enumerable: false, - }, - addIssue: { - value: (issue2) => { - inst.issues.push(issue2); - inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2); - } - // enumerable: false, - }, - addIssues: { - value: (issues2) => { - inst.issues.push(...issues2); - inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2); - } - // enumerable: false, - }, - isEmpty: { - get() { - return inst.issues.length === 0; - } - // enumerable: false, + const proto = Object.getPrototypeOf(inst); + if (_installedErrorProtos.has(proto)) + return; + _installedErrorProtos.add(proto); + _lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper)); + _lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper)); + _lazyMethod(proto, "addIssue", (self) => (issue2) => { + self.issues.push(issue2); + self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2); + }); + _lazyMethod(proto, "addIssues", (self) => (issues2) => { + self.issues.push(...issues2); + self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2); + }); + Object.defineProperty(proto, "isEmpty", { + configurable: true, + enumerable: false, + get() { + return this.issues.length === 0; } }); }; var ZodError2 = /* @__PURE__ */ $constructor("ZodError", initializer2); -var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, { +var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, void 0, { Parent: Error }); @@ -23944,171 +28106,182 @@ var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError); var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError); // node_modules/zod/v4/classic/schemas.js -var _installedGroups = /* @__PURE__ */ new WeakMap(); -function _installLazyMethods(inst, group, methods) { - const proto = Object.getPrototypeOf(inst); - let installed = _installedGroups.get(proto); - if (!installed) { - installed = /* @__PURE__ */ new Set(); - _installedGroups.set(proto, installed); - } - if (installed.has(group)) - return; - installed.add(group); - for (const key in methods) { - const fn = methods[key]; - Object.defineProperty(proto, key, { - configurable: true, - enumerable: false, - get() { - const bound = fn.bind(this); - Object.defineProperty(this, key, { - configurable: true, - writable: true, - enumerable: true, - value: bound - }); - return bound; - }, - set(v) { - Object.defineProperty(this, key, { - configurable: true, - writable: true, - enumerable: true, - value: v - }); - } - }); - } +function _ensureDefaultLocale() { + if (!globalConfig.localeError) + config(en_default2()); +} +function _ensureDefaultMemoizer() { + if (!globalConfig.memoizer) + config({ memoizer: memoizer() }); } var ZodType2 = /* @__PURE__ */ $constructor("ZodType", (inst, def) => { + _ensureDefaultLocale(); $ZodType.init(inst, def); - Object.assign(inst["~standard"], { - jsonSchema: { - input: createStandardJSONSchemaMethod(inst, "input"), - output: createStandardJSONSchemaMethod(inst, "output") - } - }); - inst.toJSONSchema = createToJSONSchemaMethod(inst, {}); inst.def = def; inst.type = def.type; - Object.defineProperty(inst, "_def", { value: def }); - inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse }); - inst.safeParse = (data, params) => safeParse3(inst, data, params); - inst.parseAsync = async (data, params) => parseAsync2(inst, data, params, { callee: inst.parseAsync }); - inst.safeParseAsync = async (data, params) => safeParseAsync3(inst, data, params); - inst.spa = inst.safeParseAsync; - inst.encode = (data, params) => encode2(inst, data, params); - inst.decode = (data, params) => decode2(inst, data, params); - inst.encodeAsync = async (data, params) => encodeAsync2(inst, data, params); - inst.decodeAsync = async (data, params) => decodeAsync2(inst, data, params); - inst.safeEncode = (data, params) => safeEncode2(inst, data, params); - inst.safeDecode = (data, params) => safeDecode2(inst, data, params); - inst.safeEncodeAsync = async (data, params) => safeEncodeAsync2(inst, data, params); - inst.safeDecodeAsync = async (data, params) => safeDecodeAsync2(inst, data, params); - _installLazyMethods(inst, "ZodType", { - check(...chks) { - const def2 = this.def; - return this.clone(util_exports.mergeDefs(def2, { - checks: [ - ...def2.checks ?? [], - ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch) - ] - }), { parent: true }); - }, - with(...chks) { - return this.check(...chks); - }, - clone(def2, params) { - return clone(this, def2, params); - }, - brand() { - return this; - }, - register(reg, meta3) { - reg.add(this, meta3); - return this; - }, - refine(check2, params) { - return this.check(refine(check2, params)); - }, - superRefine(refinement, params) { - return this.check(superRefine(refinement, params)); - }, - overwrite(fn) { - return this.check(_overwrite(fn)); - }, - optional() { - return optional(this); - }, - exactOptional() { - return exactOptional(this); - }, - nullable() { - return nullable(this); - }, - nullish() { - return optional(nullable(this)); - }, - nonoptional(params) { - return nonoptional(this, params); - }, - array() { - return array(this); - }, - or(arg) { - return union([this, arg]); - }, - and(arg) { - return intersection(this, arg); - }, - transform(tx) { - return pipe(this, transform(tx)); - }, - default(d) { - return _default2(this, d); - }, - prefault(d) { - return prefault(this, d); - }, - catch(params) { - return _catch2(this, params); - }, - pipe(target) { - return pipe(this, target); - }, - readonly() { - return readonly(this); - }, - describe(description) { - const cl = this.clone(); - globalRegistry.add(cl, { description }); - return cl; - }, - meta(...args) { - if (args.length === 0) - return globalRegistry.get(this); - const cl = this.clone(); - globalRegistry.add(cl, args[0]); - return cl; - }, - isOptional() { - return this.safeParse(void 0).success; - }, - isNullable() { - return this.safeParse(null).success; - }, - apply(fn) { - return fn(this); - } - }); - Object.defineProperty(inst, "description", { - get() { - return globalRegistry.get(inst)?.description; - }, - configurable: true - }); return inst; +}, { + check(...chks) { + const def = this.def; + return this.clone(util_exports.mergeDefs(def, { + checks: [ + ...def.checks ?? [], + ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch) + ] + }), { parent: true }); + }, + with(...chks) { + return this.check(...chks); + }, + clone(def, params) { + return clone(this, def, params); + }, + brand() { + return this; + }, + register(reg, meta3) { + reg.add(this, meta3); + return this; + }, + refine(check2, params) { + return this.check(refine(check2, params)); + }, + superRefine(refinement, params) { + return this.check(superRefine(refinement, params)); + }, + overwrite(fn) { + return this.check(_overwrite(fn)); + }, + optional() { + return optional(this); + }, + exactOptional() { + return exactOptional(this); + }, + nullable() { + return nullable(this); + }, + nullish() { + return optional(nullable(this)); + }, + nonoptional(params) { + return nonoptional(this, params); + }, + array() { + return array(this); + }, + or(arg) { + return union([this, arg]); + }, + and(arg) { + return intersection(this, arg); + }, + transform(tx) { + return pipe(this, transform(tx)); + }, + default(d) { + return _default2(this, d); + }, + prefault(d) { + return prefault(this, d); + }, + catch(params) { + return _catch2(this, params); + }, + pipe(target) { + return pipe(this, target); + }, + readonly() { + return readonly(this); + }, + describe(description) { + const cl = this.clone(); + globalRegistry.add(cl, { description }); + return cl; + }, + meta(...args) { + if (args.length === 0) + return globalRegistry.get(this); + const cl = this.clone(); + globalRegistry.add(cl, args[0]); + return cl; + }, + isOptional() { + return this.safeParse(void 0).success; + }, + isNullable() { + return this.safeParse(null).success; + }, + apply(fn, ...args) { + return args.length === 0 ? fn(this) : fn(this, ...args); + }, + // Overrides core's `~standard` to add `jsonSchema`. Must stay a prototype entry: redefining it per instance demotes instances to dictionary mode. + get "~standard"() { + return util_exports.hide(this, "~standard", { + ...standardProps(this), + jsonSchema: { + input: createStandardJSONSchemaMethod(this, "input"), + output: createStandardJSONSchemaMethod(this, "output") + } + }); + }, + set "~standard"(value) { + util_exports.own(this, "~standard", value); + }, + parse: function _parse2(data, params) { + return parse2(this, data, params, { callee: _parse2 }); + }, + parseAsync: async function _parseAsync2(data, params) { + return await parseAsync2(this, data, params, { callee: _parseAsync2 }); + }, + safeParse(data, params) { + return safeParse3(this, data, params); + }, + async safeParseAsync(data, params) { + return safeParseAsync3(this, data, params); + }, + // `spa` is an alias: same function object as `safeParseAsync`, as before. + get spa() { + return this?.safeParseAsync; + }, + set spa(value) { + util_exports.own(this, "spa", value); + }, + encode: function _encode2(data, params) { + return encode2(this, data, params, { callee: _encode2 }); + }, + decode: function _decode2(data, params) { + return decode2(this, data, params, { callee: _decode2 }); + }, + encodeAsync: async function _encodeAsync2(data, params) { + return await encodeAsync2(this, data, params, { callee: _encodeAsync2 }); + }, + decodeAsync: async function _decodeAsync2(data, params) { + return await decodeAsync2(this, data, params, { callee: _decodeAsync2 }); + }, + safeEncode(data, params) { + return safeEncode2(this, data, params); + }, + safeDecode(data, params) { + return safeDecode2(this, data, params); + }, + async safeEncodeAsync(data, params) { + return safeEncodeAsync2(this, data, params); + }, + async safeDecodeAsync(data, params) { + return safeDecodeAsync2(this, data, params); + }, + toJSONSchema(params) { + return createToJSONSchemaMethod(this, {})(params); + }, + // Reads through to the registry on every access, so it must not cache. + get description() { + return globalRegistry.get(this)?.description; + }, + // No setter: `schema._def = x` throws, as it did when `_def` was a non-writable own property. + get _def() { + return this._zod.def; + } }); var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => { $ZodString.init(inst, def); @@ -24118,84 +28291,135 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => { inst.format = bag.format ?? null; inst.minLength = bag.minimum ?? null; inst.maxLength = bag.maximum ?? null; - _installLazyMethods(inst, "_ZodString", { - regex(...args) { - return this.check(_regex(...args)); - }, - includes(...args) { - return this.check(_includes(...args)); - }, - startsWith(...args) { - return this.check(_startsWith(...args)); - }, - endsWith(...args) { - return this.check(_endsWith(...args)); - }, - min(...args) { - return this.check(_minLength(...args)); - }, - max(...args) { - return this.check(_maxLength(...args)); - }, - length(...args) { - return this.check(_length(...args)); - }, - nonempty(...args) { - return this.check(_minLength(1, ...args)); - }, - lowercase(params) { - return this.check(_lowercase(params)); - }, - uppercase(params) { - return this.check(_uppercase(params)); - }, - trim() { - return this.check(_trim()); - }, - normalize(...args) { - return this.check(_normalize(...args)); - }, - toLowerCase() { - return this.check(_toLowerCase()); - }, - toUpperCase() { - return this.check(_toUpperCase()); - }, - slugify() { - return this.check(_slugify()); - } - }); +}, { + regex(...args) { + return this.check(_regex(...args)); + }, + includes(...args) { + return this.check(_includes(...args)); + }, + startsWith(...args) { + return this.check(_startsWith(...args)); + }, + endsWith(...args) { + return this.check(_endsWith(...args)); + }, + min(...args) { + return this.check(_minLength(...args)); + }, + max(...args) { + return this.check(_maxLength(...args)); + }, + length(...args) { + return this.check(_length(...args)); + }, + nonempty(...args) { + return this.check(_minLength(1, ...args)); + }, + lowercase(params) { + return this.check(_lowercase(params)); + }, + uppercase(params) { + return this.check(_uppercase(params)); + }, + trim() { + return this.check(_trim()); + }, + normalize(...args) { + return this.check(_normalize(...args)); + }, + toLowerCase() { + return this.check(_toLowerCase()); + }, + toUpperCase() { + return this.check(_toUpperCase()); + }, + slugify() { + return this.check(_slugify()); + } }); var ZodString2 = /* @__PURE__ */ $constructor("ZodString", (inst, def) => { $ZodString.init(inst, def); _ZodString.init(inst, def); - inst.email = (params) => inst.check(_email(ZodEmail, params)); - inst.url = (params) => inst.check(_url(ZodURL, params)); - inst.jwt = (params) => inst.check(_jwt(ZodJWT, params)); - inst.emoji = (params) => inst.check(_emoji2(ZodEmoji, params)); - inst.guid = (params) => inst.check(_guid(ZodGUID, params)); - inst.uuid = (params) => inst.check(_uuid(ZodUUID, params)); - inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params)); - inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params)); - inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params)); - inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params)); - inst.guid = (params) => inst.check(_guid(ZodGUID, params)); - inst.cuid = (params) => inst.check(_cuid(ZodCUID, params)); - inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params)); - inst.ulid = (params) => inst.check(_ulid(ZodULID, params)); - inst.base64 = (params) => inst.check(_base64(ZodBase64, params)); - inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params)); - inst.xid = (params) => inst.check(_xid(ZodXID, params)); - inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params)); - inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params)); - inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params)); - inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params)); - inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params)); - inst.e164 = (params) => inst.check(_e164(ZodE164, params)); - inst.datetime = (params) => inst.check(datetime2(params)); - inst.date = (params) => inst.check(date2(params)); - inst.time = (params) => inst.check(time2(params)); - inst.duration = (params) => inst.check(duration2(params)); +}, { + email(params) { + return this.check(_email(ZodEmail, params)); + }, + url(params) { + return this.check(_url(ZodURL, params)); + }, + jwt(params) { + return this.check(_jwt(ZodJWT, params)); + }, + emoji(params) { + return this.check(_emoji2(ZodEmoji, params)); + }, + guid(params) { + return this.check(_guid(ZodGUID, params)); + }, + uuid(params) { + return this.check(_uuid(ZodUUID, params)); + }, + uuidv4(params) { + return this.check(_uuidv4(ZodUUID, params)); + }, + uuidv6(params) { + return this.check(_uuidv6(ZodUUID, params)); + }, + uuidv7(params) { + return this.check(_uuidv7(ZodUUID, params)); + }, + nanoid(params) { + return this.check(_nanoid(ZodNanoID, params)); + }, + cuid(params) { + return this.check(_cuid(ZodCUID, params)); + }, + cuid2(params) { + return this.check(_cuid2(ZodCUID2, params)); + }, + ulid(params) { + return this.check(_ulid(ZodULID, params)); + }, + base64(params) { + return this.check(_base64(ZodBase64, params)); + }, + base64url(params) { + return this.check(_base64url(ZodBase64URL, params)); + }, + xid(params) { + return this.check(_xid(ZodXID, params)); + }, + ksuid(params) { + return this.check(_ksuid(ZodKSUID, params)); + }, + ipv4(params) { + return this.check(_ipv4(ZodIPv4, params)); + }, + ipv6(params) { + return this.check(_ipv6(ZodIPv6, params)); + }, + cidrv4(params) { + return this.check(_cidrv4(ZodCIDRv4, params)); + }, + cidrv6(params) { + return this.check(_cidrv6(ZodCIDRv6, params)); + }, + e164(params) { + return this.check(_e164(ZodE164, params)); + }, + datetime(params) { + return this.check(_isoDateTime(ZodISODateTime, params)); + }, + date(params) { + return this.check(_isoDate(ZodISODate, params)); + }, + time(params) { + return this.check(_isoTime(ZodISOTime, params)); + }, + duration(params) { + return this.check(_isoDuration(ZodISODuration, params)); + } }); function string2(params) { return _string(ZodString2, params); @@ -24204,6 +28428,22 @@ var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def $ZodStringFormat.init(inst, def); _ZodString.init(inst, def); }); +var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => { + $ZodISODateTime.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => { + $ZodISODate.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => { + $ZodISOTime.init(inst, def); + ZodStringFormat.init(inst, def); +}); +var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => { + $ZodISODuration.init(inst, def); + ZodStringFormat.init(inst, def); +}); var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => { $ZodEmail.init(inst, def); ZodStringFormat.init(inst, def); @@ -24353,6 +28593,13 @@ var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => { function e1642(params) { return _e164(ZodE164, params); } +var ZodCreditCard = /* @__PURE__ */ $constructor("ZodCreditCard", (inst, def) => { + $ZodCreditCard.init(inst, def); + ZodStringFormat.init(inst, def); +}); +function creditCard2(params) { + return _creditCard(ZodCreditCard, params); +} var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => { $ZodJWT.init(inst, def); ZodStringFormat.init(inst, def); @@ -24371,73 +28618,72 @@ function hostname2(_params) { return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params); } function hex2(_params) { - return _stringFormat(ZodCustomStringFormat, "hex", regexes_exports.hex, _params); -} -function hash(alg, params) { - const enc = params?.enc ?? "hex"; - const format = `${alg}_${enc}`; - const regex = regexes_exports[format]; - if (!regex) - throw new Error(`Unrecognized hash format: ${format}`); - return _stringFormat(ZodCustomStringFormat, format, regex, params); -} -var ZodNumber2 = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => { - $ZodNumber.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2, params); - _installLazyMethods(inst, "ZodNumber", { - gt(value, params) { - return this.check(_gt(value, params)); - }, - gte(value, params) { - return this.check(_gte(value, params)); - }, - min(value, params) { - return this.check(_gte(value, params)); - }, - lt(value, params) { - return this.check(_lt(value, params)); - }, - lte(value, params) { - return this.check(_lte(value, params)); - }, - max(value, params) { - return this.check(_lte(value, params)); - }, - int(params) { - return this.check(int(params)); - }, - safe(params) { - return this.check(int(params)); - }, - positive(params) { - return this.check(_gt(0, params)); - }, - nonnegative(params) { - return this.check(_gte(0, params)); - }, - negative(params) { - return this.check(_lt(0, params)); - }, - nonpositive(params) { - return this.check(_lte(0, params)); - }, - multipleOf(value, params) { - return this.check(_multipleOf(value, params)); - }, - step(value, params) { - return this.check(_multipleOf(value, params)); - }, - finite() { - return this; - } - }); + return _stringFormat(ZodCustomStringFormat, "hex", regexes_exports.hex, _params); +} +function hash(alg, params) { + const enc = params?.enc ?? "hex"; + const format = `${alg}_${enc}`; + const regex = regexes_exports[format]; + if (!regex) + throw new Error(`Unrecognized hash format: ${format}`); + return _stringFormat(ZodCustomStringFormat, format, regex, params); +} +var ZodNumber2 = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => { + $ZodNumber.init(inst, def); + ZodType2.init(inst, def); + inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2, params); const bag = inst._zod.bag; inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null; inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null; inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5); inst.isFinite = true; inst.format = bag.format ?? null; +}, { + gt(value, params) { + return this.check(_gt(value, params)); + }, + gte(value, params) { + return this.check(_gte(value, params)); + }, + min(value, params) { + return this.check(_gte(value, params)); + }, + lt(value, params) { + return this.check(_lt(value, params)); + }, + lte(value, params) { + return this.check(_lte(value, params)); + }, + max(value, params) { + return this.check(_lte(value, params)); + }, + int(params) { + return this.check(int(params)); + }, + safe(params) { + return this.check(int(params)); + }, + positive(params) { + return this.check(_gt(0, params)); + }, + nonnegative(params) { + return this.check(_gte(0, params)); + }, + negative(params) { + return this.check(_lt(0, params)); + }, + nonpositive(params) { + return this.check(_lte(0, params)); + }, + multipleOf(value, params) { + return this.check(_multipleOf(value, params)); + }, + step(value, params) { + return this.check(_multipleOf(value, params)); + }, + finite() { + return this; + } }); function number2(params) { return _number(ZodNumber2, params); @@ -24473,23 +28719,44 @@ var ZodBigInt2 = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => { $ZodBigInt.init(inst, def); ZodType2.init(inst, def); inst._zod.processJSONSchema = (ctx, json2, params) => bigintProcessor(inst, ctx, json2, params); - inst.gte = (value, params) => inst.check(_gte(value, params)); - inst.min = (value, params) => inst.check(_gte(value, params)); - inst.gt = (value, params) => inst.check(_gt(value, params)); - inst.gte = (value, params) => inst.check(_gte(value, params)); - inst.min = (value, params) => inst.check(_gte(value, params)); - inst.lt = (value, params) => inst.check(_lt(value, params)); - inst.lte = (value, params) => inst.check(_lte(value, params)); - inst.max = (value, params) => inst.check(_lte(value, params)); - inst.positive = (params) => inst.check(_gt(BigInt(0), params)); - inst.negative = (params) => inst.check(_lt(BigInt(0), params)); - inst.nonpositive = (params) => inst.check(_lte(BigInt(0), params)); - inst.nonnegative = (params) => inst.check(_gte(BigInt(0), params)); - inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params)); const bag = inst._zod.bag; inst.minValue = bag.minimum ?? null; inst.maxValue = bag.maximum ?? null; inst.format = bag.format ?? null; +}, { + gte(value, params) { + return this.check(_gte(value, params)); + }, + min(value, params) { + return this.check(_gte(value, params)); + }, + gt(value, params) { + return this.check(_gt(value, params)); + }, + lt(value, params) { + return this.check(_lt(value, params)); + }, + lte(value, params) { + return this.check(_lte(value, params)); + }, + max(value, params) { + return this.check(_lte(value, params)); + }, + positive(params) { + return this.check(_gt(BigInt(0), params)); + }, + negative(params) { + return this.check(_lt(BigInt(0), params)); + }, + nonpositive(params) { + return this.check(_lte(BigInt(0), params)); + }, + nonnegative(params) { + return this.check(_gte(BigInt(0), params)); + }, + multipleOf(value, params) { + return this.check(_multipleOf(value, params)); + } }); function bigint2(params) { return _bigint(ZodBigInt2, params); @@ -24570,31 +28837,31 @@ var ZodDate2 = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => { inst.minDate = c.minimum ? new Date(c.minimum) : null; inst.maxDate = c.maximum ? new Date(c.maximum) : null; }); -function date3(params) { +function date2(params) { return _date(ZodDate2, params); } var ZodArray2 = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => { + _ensureDefaultMemoizer(); $ZodArray.init(inst, def); ZodType2.init(inst, def); inst._zod.processJSONSchema = (ctx, json2, params) => arrayProcessor(inst, ctx, json2, params); inst.element = def.element; - _installLazyMethods(inst, "ZodArray", { - min(n, params) { - return this.check(_minLength(n, params)); - }, - nonempty(params) { - return this.check(_minLength(1, params)); - }, - max(n, params) { - return this.check(_maxLength(n, params)); - }, - length(n, params) { - return this.check(_length(n, params)); - }, - unwrap() { - return this.element; - } - }); +}, { + min(n, params) { + return this.check(_minLength(n, params)); + }, + nonempty(params) { + return this.check(_minLength(1, params)); + }, + max(n, params) { + return this.check(_maxLength(n, params)); + }, + length(n, params) { + return this.check(_length(n, params)); + }, + unwrap() { + return this.element; + } }); function array(element, params) { return _array(ZodArray2, element, params); @@ -24604,53 +28871,54 @@ function keyof(schema) { return _enum2(Object.keys(shape)); } var ZodObject2 = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => { + _ensureDefaultMemoizer(); $ZodObjectJIT.init(inst, def); ZodType2.init(inst, def); inst._zod.processJSONSchema = (ctx, json2, params) => objectProcessor(inst, ctx, json2, params); - util_exports.defineLazy(inst, "shape", () => { - return def.shape; - }); - _installLazyMethods(inst, "ZodObject", { - keyof() { - return _enum2(Object.keys(this._zod.def.shape)); - }, - catchall(catchall) { - return this.clone({ ...this._zod.def, catchall }); - }, - passthrough() { - return this.clone({ ...this._zod.def, catchall: unknown() }); - }, - loose() { - return this.clone({ ...this._zod.def, catchall: unknown() }); - }, - strict() { - return this.clone({ ...this._zod.def, catchall: never() }); - }, - strip() { - return this.clone({ ...this._zod.def, catchall: void 0 }); - }, - extend(incoming) { - return util_exports.extend(this, incoming); - }, - safeExtend(incoming) { - return util_exports.safeExtend(this, incoming); - }, - merge(other) { - return util_exports.merge(this, other); - }, - pick(mask) { - return util_exports.pick(this, mask); - }, - omit(mask) { - return util_exports.omit(this, mask); - }, - partial(...args) { - return util_exports.partial(ZodOptional2, this, args[0]); - }, - required(...args) { - return util_exports.required(ZodNonOptional, this, args[0]); - } - }); + util_exports.installLazyProp(inst, "shape", (self) => self._zod.def.shape, false); +}, { + keyof() { + return _enum2(Object.keys(this._zod.def.shape)); + }, + catchall(catchall) { + return this.clone({ ...this._zod.def, catchall }); + }, + passthrough() { + return this.clone({ ...this._zod.def, catchall: unknown() }); + }, + loose() { + return this.clone({ ...this._zod.def, catchall: unknown() }); + }, + strict() { + return this.clone({ ...this._zod.def, catchall: never() }); + }, + strip() { + return this.clone({ ...this._zod.def, catchall: void 0 }); + }, + extend(incoming) { + return util_exports.extend(this, incoming); + }, + safeExtend(incoming) { + return util_exports.safeExtend(this, incoming); + }, + merge(other) { + return util_exports.merge(this, other); + }, + pick(mask) { + return util_exports.pick(this, mask); + }, + omit(mask) { + return util_exports.omit(this, mask); + }, + partial(...args) { + return util_exports.partial(ZodOptional2, this, args[0]); + }, + exactPartial(...args) { + return util_exports.partial(ZodExactOptional, this, args[0], "exactPartial"); + }, + required(...args) { + return util_exports.required(ZodNonOptional, this, args[0]); + } }); function object2(shape, params) { const def = { @@ -24728,13 +28996,26 @@ function intersection(left, right) { }); } var ZodTuple2 = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => { + _ensureDefaultMemoizer(); $ZodTuple.init(inst, def); ZodType2.init(inst, def); inst._zod.processJSONSchema = (ctx, json2, params) => tupleProcessor(inst, ctx, json2, params); - inst.rest = (rest) => inst.clone({ - ...inst._zod.def, - rest - }); +}, { + rest(rest) { + return this.clone({ + ...this._zod.def, + rest + }); + }, + partial() { + const def = this._zod.def; + if (def.checks?.length) + throw new Error(".partial() cannot be used on tuple schemas containing refinements"); + return this.clone({ + ...def, + items: def.items.map((item) => new ZodOptional2({ type: "optional", innerType: item })) + }); + } }); function tuple(items, _paramsOrRest, _params) { const hasRest = _paramsOrRest instanceof $ZodType; @@ -24748,6 +29029,7 @@ function tuple(items, _paramsOrRest, _params) { }); } var ZodRecord2 = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => { + _ensureDefaultMemoizer(); $ZodRecord.init(inst, def); ZodType2.init(inst, def); inst._zod.processJSONSchema = (ctx, json2, params) => recordProcessor(inst, ctx, json2, params); @@ -24771,13 +29053,12 @@ function record(keyType, valueType, params) { }); } function partialRecord(keyType, valueType, params) { - const k = clone(keyType); - k._zod.values = void 0; return new ZodRecord2({ type: "record", - keyType: k, + keyType, valueType, - ...util_exports.normalizeParams(params) + ...util_exports.normalizeParams(params), + partial: true }); } function looseRecord(keyType, valueType, params) { @@ -24790,6 +29071,7 @@ function looseRecord(keyType, valueType, params) { }); } var ZodMap2 = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => { + _ensureDefaultMemoizer(); $ZodMap.init(inst, def); ZodType2.init(inst, def); inst._zod.processJSONSchema = (ctx, json2, params) => mapProcessor(inst, ctx, json2, params); @@ -24809,6 +29091,7 @@ function map(keyType, valueType, params) { }); } var ZodSet2 = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => { + _ensureDefaultMemoizer(); $ZodSet.init(inst, def); ZodType2.init(inst, def); inst._zod.processJSONSchema = (ctx, json2, params) => setProcessor(inst, ctx, json2, params); @@ -24910,6 +29193,7 @@ function file(params) { return _file(ZodFile, params); } var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => { + _ensureDefaultMemoizer(); $ZodTransform.init(inst, def); ZodType2.init(inst, def); inst._zod.processJSONSchema = (ctx, json2, params) => transformProcessor(inst, ctx, json2, params); @@ -24925,21 +29209,20 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => { if (_issue.fatal) _issue.continue = false; _issue.code ?? (_issue.code = "custom"); - _issue.input ?? (_issue.input = payload.value); + if (!("input" in _issue)) + _issue.input = payload.value; _issue.inst ?? (_issue.inst = inst); payload.issues.push(util_exports.issue(_issue)); } }; - const output = def.transform(payload.value, payload); - if (output instanceof Promise) { - return output.then((output2) => { - payload.value = output2; - payload.fallback = true; + const output2 = def.transform(payload.value, payload); + if (output2 instanceof Promise) { + return output2.then((output3) => { + payload.value = output3; return payload; }); } - payload.value = output; - payload.fallback = true; + payload.value = output2; return payload; }; }); @@ -25055,7 +29338,7 @@ function _catch2(innerType, catchValue) { return new ZodCatch2({ type: "catch", innerType, - catchValue: typeof catchValue === "function" ? catchValue : () => catchValue + catchValue: typeof catchValue === "function" ? catchValue : util_exports.constantCatch(catchValue) }); } var ZodNaN2 = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => { @@ -25259,6 +29542,31 @@ var ZodFirstPartyTypeKind2; /* @__PURE__ */ (function(ZodFirstPartyTypeKind3) { })(ZodFirstPartyTypeKind2 || (ZodFirstPartyTypeKind2 = {})); +// node_modules/zod/v4/classic/iso.js +var iso_exports2 = {}; +__export(iso_exports2, { + ZodISODate: () => ZodISODate, + ZodISODateTime: () => ZodISODateTime, + ZodISODuration: () => ZodISODuration, + ZodISOTime: () => ZodISOTime, + date: () => date3, + datetime: () => datetime2, + duration: () => duration2, + time: () => time2 +}); +function datetime2(params) { + return _isoDateTime(ZodISODateTime, params); +} +function date3(params) { + return _isoDate(ZodISODate, params); +} +function time2(params) { + return _isoTime(ZodISOTime, params); +} +function duration2(params) { + return _isoDuration(ZodISODuration, params); +} + // node_modules/zod/v4/classic/from-json-schema.js var z = { ...schemas_exports2, @@ -25349,6 +29657,12 @@ function detectVersion(schema, defaultTarget) { } return defaultTarget ?? "draft-2020-12"; } +function applyMinItems(items, minItems) { + return items.map((item, index) => index < minItems ? item : item.optional()); +} +function decodeJSONPointerSegment(segment) { + return segment.replace(/~1/g, "/").replace(/~0/g, "~"); +} function resolveRef(ref, ctx) { if (!ref.startsWith("#")) { throw new Error("External $ref is not supported, only local refs (#/...) are allowed"); @@ -25359,7 +29673,7 @@ function resolveRef(ref, ctx) { } const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions"; if (path3[0] === defsKey) { - const key = path3[1]; + const key = path3[1] === void 0 ? void 0 : decodeJSONPointerSegment(path3[1]); if (!key || !ctx.defs[key]) { throw new Error(`Reference not found: ${ref}`); } @@ -25367,6 +29681,37 @@ function resolveRef(ref, ctx) { } throw new Error(`Reference not found: ${ref}`); } +function checkPropertyNames(objectSchema, keySchema) { + const guard = z.transform((value) => value).check((payload) => { + const value = payload.value; + if (typeof value !== "object" || value === null || Array.isArray(value)) + return; + for (const key of Object.getOwnPropertyNames(value)) { + const result = keySchema.safeParse(key); + if (result.success) + continue; + payload.issues.push({ + code: "invalid_key", + origin: "record", + issues: result.error.issues, + input: key, + path: [key], + continue: true + }); + } + }); + return guard.pipe(objectSchema); +} +function getTupleRest(restSchema, ctx) { + if (restSchema === false) { + return void 0; + } + if (restSchema === void 0 || restSchema === true) { + return z.any(); + } + return convertSchema(restSchema, ctx); +} +var fullTime = /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/; function convertBaseSchema(schema, ctx) { if (schema.not !== void 0) { if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) { @@ -25459,13 +29804,15 @@ function convertBaseSchema(schema, ctx) { } else if (format === "uuid" || format === "guid") { stringSchema = stringSchema.check(z.uuid()); } else if (format === "date-time") { - stringSchema = stringSchema.check(z.iso.datetime()); + stringSchema = stringSchema.check(z.iso.datetime({ offset: true })); } else if (format === "date") { stringSchema = stringSchema.check(z.iso.date()); } else if (format === "time") { - stringSchema = stringSchema.check(z.iso.time()); + stringSchema = stringSchema.check(z.regex(fullTime)); } else if (format === "duration") { stringSchema = stringSchema.check(z.iso.duration()); + } else if (format === "hostname") { + stringSchema = stringSchema.check(z.hostname()); } else if (format === "ipv4") { stringSchema = stringSchema.check(z.ipv4()); } else if (format === "ipv6") { @@ -25482,6 +29829,8 @@ function convertBaseSchema(schema, ctx) { stringSchema = stringSchema.check(z.base64url()); } else if (format === "e164") { stringSchema = stringSchema.check(z.e164()); + } else if (format === "credit_card") { + stringSchema = stringSchema.check(z.creditCard()); } else if (format === "jwt") { stringSchema = stringSchema.check(z.jwt()); } else if (format === "emoji") { @@ -25515,10 +29864,10 @@ function convertBaseSchema(schema, ctx) { case "number": case "integer": { let numberSchema = type === "integer" ? z.number().int() : z.number(); - if (typeof schema.minimum === "number") { + if (typeof schema.minimum === "number" && schema.exclusiveMinimum !== true) { numberSchema = numberSchema.min(schema.minimum); } - if (typeof schema.maximum === "number") { + if (typeof schema.maximum === "number" && schema.exclusiveMaximum !== true) { numberSchema = numberSchema.max(schema.maximum); } if (typeof schema.exclusiveMinimum === "number") { @@ -25549,21 +29898,10 @@ function convertBaseSchema(schema, ctx) { const shape = {}; const properties = schema.properties || {}; const requiredSet = new Set(schema.required || []); + const additionalSchema = typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : void 0; for (const [key, propSchema] of Object.entries(properties)) { const propZodSchema = convertSchema(propSchema, ctx); - shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional(); - } - if (schema.propertyNames) { - const keySchema = convertSchema(schema.propertyNames, ctx); - const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z.any(); - if (Object.keys(shape).length === 0) { - zodSchema = z.record(keySchema, valueSchema); - break; - } - const objectSchema2 = z.object(shape).passthrough(); - const recordSchema = z.looseRecord(keySchema, valueSchema); - zodSchema = z.intersection(objectSchema2, recordSchema); - break; + assignProp(shape, key, requiredSet.has(key) ? propZodSchema : propZodSchema.optional()); } if (schema.patternProperties) { const patternProps = schema.patternProperties; @@ -25590,15 +29928,44 @@ function convertBaseSchema(schema, ctx) { } zodSchema = result; } - break; - } - const objectSchema = z.object(shape); - if (schema.additionalProperties === false) { - zodSchema = objectSchema.strict(); - } else if (typeof schema.additionalProperties === "object") { - zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx)); + if (schema.additionalProperties === false) { + const propertyKeys = Object.keys(shape); + const patterns = patternKeys.map((p) => new RegExp(p)); + const basePatternSchema = zodSchema; + zodSchema = zodSchema.check((payload) => { + if (!isPlainObject(payload.value)) + return; + const unrecognized = []; + for (const key of Object.keys(payload.value)) { + if (propertyKeys.includes(key)) + continue; + if (patterns.some((regex) => regex.test(key))) + continue; + unrecognized.push(key); + } + if (unrecognized.length) { + payload.issues.push({ + code: "unrecognized_keys", + keys: unrecognized, + input: payload.value, + inst: basePatternSchema + }); + } + }); + } } else { - zodSchema = objectSchema.passthrough(); + const objectSchema = z.object(shape); + if (schema.additionalProperties === false) { + zodSchema = objectSchema.strict(); + } else if (additionalSchema) { + zodSchema = objectSchema.catchall(additionalSchema); + } else { + zodSchema = objectSchema.passthrough(); + } + } + if (schema.propertyNames !== void 0 && schema.propertyNames !== true) { + const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === void 0 ? { type: "string", ...schema.propertyNames } : schema.propertyNames; + zodSchema = checkPropertyNames(zodSchema, convertSchema(keyJSONSchema, ctx)); } break; } @@ -25606,13 +29973,12 @@ function convertBaseSchema(schema, ctx) { const prefixItems = schema.prefixItems; const items = schema.items; if (prefixItems && Array.isArray(prefixItems)) { + const minItems = typeof schema.minItems === "number" ? schema.minItems : 0; const tupleItems = prefixItems.map((item) => convertSchema(item, ctx)); - const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0; - if (rest) { - zodSchema = z.tuple(tupleItems).rest(rest); - } else { - zodSchema = z.tuple(tupleItems); - } + const positionalItems = applyMinItems(tupleItems, minItems); + const rest = !Array.isArray(items) ? getTupleRest(items, ctx) : void 0; + const tupleSchema = z.tuple(positionalItems); + zodSchema = rest ? tupleSchema.rest(rest) : tupleSchema; if (typeof schema.minItems === "number") { zodSchema = zodSchema.check(z.minLength(schema.minItems)); } @@ -25620,13 +29986,12 @@ function convertBaseSchema(schema, ctx) { zodSchema = zodSchema.check(z.maxLength(schema.maxItems)); } } else if (Array.isArray(items)) { + const minItems = typeof schema.minItems === "number" ? schema.minItems : 0; const tupleItems = items.map((item) => convertSchema(item, ctx)); - const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0; - if (rest) { - zodSchema = z.tuple(tupleItems).rest(rest); - } else { - zodSchema = z.tuple(tupleItems); - } + const positionalItems = applyMinItems(tupleItems, minItems); + const rest = getTupleRest(schema.additionalItems, ctx); + const tupleSchema = z.tuple(positionalItems); + zodSchema = rest ? tupleSchema.rest(rest) : tupleSchema; if (typeof schema.minItems === "number") { zodSchema = zodSchema.check(z.minLength(schema.minItems)); } @@ -25703,9 +30068,12 @@ function convertSchema(schema, ctx) { extraMeta[key] = schema[key]; } } + if (schema.propertyNames !== void 0 && schema.type === "object" && schema.$ref === void 0) { + extraMeta.propertyNames = schema.propertyNames; + } for (const key of Object.keys(schema)) { if (!RECOGNIZED_KEYS.has(key)) { - extraMeta[key] = schema[key]; + assignProp(extraMeta, key, schema[key]); } } if (Object.keys(extraMeta).length > 0) { @@ -25739,6 +30107,48 @@ function fromJSONSchema(schema, params) { return convertSchema(normalized, ctx); } +// node_modules/zod/v4/classic/deep-partial.js +function deepPartial(schema) { + return visit(schema, { + object: (s) => s.partial(), + // Every partialed option now admits `undefined`, which the constructor rejects as a duplicate. + union: (s) => { + const def = s._zod.def; + return def.discriminator === void 0 ? s : union(def.options); + } + }); +} + +// node_modules/zod/v4/classic/in-out.js +function withChecks(side, checks) { + if (!checks?.length) + return side; + const def = side._zod.def; + return clone(side, mergeDefs(def, { checks: [...def.checks ?? [], ...checks] }), { parent: true }); +} +function outSide(def) { + return withChecks(def.out, def.checks); +} +function inSide(def) { + return def.in._zod.traits.has("$ZodTransform") ? outSide(def) : def.in; +} +function input(schema) { + return visit(schema, { + pipe: (s) => inSide(s._zod.def), + // A default value belongs to the output side, so a rewritten inner type leaves it stranded. `.default()` widens the declared input type with `undefined`, and `optional` is what carries that across. + default: (s, rewritten) => rewritten ? optional(s._zod.def.innerType) : s, + // A catch value is output-side too, but `.catch()` leaves the declared input type alone, so the inner schema stands on its own. + catch: (s, rewritten) => rewritten ? s._zod.def.innerType : s + }); +} +function output(schema) { + return visit(schema, { + pipe: (s) => outSide(s._zod.def), + // A prefault value is fed through the schema, which makes it input-side, so a rewritten inner type leaves it stranded. + prefault: (s, rewritten) => rewritten ? s._zod.def.innerType : s + }); +} + // node_modules/zod/v4/classic/coerce.js var coerce_exports2 = {}; __export(coerce_exports2, { @@ -25764,9 +30174,6 @@ function date4(params) { return _coercedDate(ZodDate2, params); } -// node_modules/zod/v4/classic/external.js -config(en_default2()); - // node_modules/@modelcontextprotocol/sdk/dist/esm/types.js var LATEST_PROTOCOL_VERSION = "2025-11-25"; var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"]; @@ -28683,8 +33090,8 @@ var Protocol = class { resolver(message); } else { const errorMessage = message; - const error51 = new McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data); - resolver(error51); + const error61 = new McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data); + resolver(error61); } } else { const messageType = queuedMessage.type === "response" ? "Response" : "Error"; @@ -28728,8 +33135,8 @@ var Protocol = class { nextCursor, _meta: {} }; - } catch (error51) { - throw new McpError(ErrorCode.InvalidParams, `Failed to list tasks: ${error51 instanceof Error ? error51.message : String(error51)}`); + } catch (error61) { + throw new McpError(ErrorCode.InvalidParams, `Failed to list tasks: ${error61 instanceof Error ? error61.message : String(error61)}`); } }); this.setRequestHandler(CancelTaskRequestSchema, async (request, extra) => { @@ -28751,11 +33158,11 @@ var Protocol = class { _meta: {}, ...cancelledTask }; - } catch (error51) { - if (error51 instanceof McpError) { - throw error51; + } catch (error61) { + if (error61 instanceof McpError) { + throw error61; } - throw new McpError(ErrorCode.InvalidRequest, `Failed to cancel task: ${error51 instanceof Error ? error51.message : String(error51)}`); + throw new McpError(ErrorCode.InvalidRequest, `Failed to cancel task: ${error61 instanceof Error ? error61.message : String(error61)}`); } }); } @@ -28816,9 +33223,9 @@ var Protocol = class { this._onclose(); }; const _onerror = this.transport?.onerror; - this._transport.onerror = (error51) => { - _onerror?.(error51); - this._onerror(error51); + this._transport.onerror = (error61) => { + _onerror?.(error61); + this._onerror(error61); }; const _onmessage = this._transport?.onmessage; this._transport.onmessage = (message, extra) => { @@ -28849,22 +33256,22 @@ var Protocol = class { controller.abort(); } this._requestHandlerAbortControllers.clear(); - const error51 = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed"); + const error61 = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed"); this._transport = void 0; this.onclose?.(); for (const handler of responseHandlers.values()) { - handler(error51); + handler(error61); } } - _onerror(error51) { - this.onerror?.(error51); + _onerror(error61) { + this.onerror?.(error61); } _onnotification(notification) { const handler = this._notificationHandlers.get(notification.method) ?? this.fallbackNotificationHandler; if (handler === void 0) { return; } - Promise.resolve().then(() => handler(notification)).catch((error51) => this._onerror(new Error(`Uncaught error in notification handler: ${error51}`))); + Promise.resolve().then(() => handler(notification)).catch((error61) => this._onerror(new Error(`Uncaught error in notification handler: ${error61}`))); } _onrequest(request, extra) { const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler; @@ -28884,9 +33291,9 @@ var Protocol = class { type: "error", message: errorResponse, timestamp: Date.now() - }, capturedTransport?.sessionId).catch((error51) => this._onerror(new Error(`Failed to enqueue error response: ${error51}`))); + }, capturedTransport?.sessionId).catch((error61) => this._onerror(new Error(`Failed to enqueue error response: ${error61}`))); } else { - capturedTransport?.send(errorResponse).catch((error51) => this._onerror(new Error(`Failed to send an error response: ${error51}`))); + capturedTransport?.send(errorResponse).catch((error61) => this._onerror(new Error(`Failed to send an error response: ${error61}`))); } return; } @@ -28952,7 +33359,7 @@ var Protocol = class { } else { await capturedTransport?.send(response); } - }, async (error51) => { + }, async (error61) => { if (abortController.signal.aborted) { return; } @@ -28960,9 +33367,9 @@ var Protocol = class { jsonrpc: "2.0", id: request.id, error: { - code: Number.isSafeInteger(error51["code"]) ? error51["code"] : ErrorCode.InternalError, - message: error51.message ?? "Internal error", - ...error51["data"] !== void 0 && { data: error51["data"] } + code: Number.isSafeInteger(error61["code"]) ? error61["code"] : ErrorCode.InternalError, + message: error61.message ?? "Internal error", + ...error61["data"] !== void 0 && { data: error61["data"] } } }; if (relatedTaskId && this._taskMessageQueue) { @@ -28974,7 +33381,7 @@ var Protocol = class { } else { await capturedTransport?.send(errorResponse); } - }).catch((error51) => this._onerror(new Error(`Failed to send response: ${error51}`))).finally(() => { + }).catch((error61) => this._onerror(new Error(`Failed to send response: ${error61}`))).finally(() => { if (this._requestHandlerAbortControllers.get(request.id) === abortController) { this._requestHandlerAbortControllers.delete(request.id); } @@ -28993,11 +33400,11 @@ var Protocol = class { if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) { try { this._resetTimeout(messageId); - } catch (error51) { + } catch (error61) { this._responseHandlers.delete(messageId); this._progressHandlers.delete(messageId); this._cleanupTimeout(messageId); - responseHandler(error51); + responseHandler(error61); return; } } @@ -29011,8 +33418,8 @@ var Protocol = class { if (isJSONRPCResultResponse(response)) { resolver(response); } else { - const error51 = new McpError(response.error.code, response.error.message, response.error.data); - resolver(error51); + const error61 = new McpError(response.error.code, response.error.message, response.error.data); + resolver(error61); } return; } @@ -29040,8 +33447,8 @@ var Protocol = class { if (isJSONRPCResultResponse(response)) { handler(response); } else { - const error51 = McpError.fromError(response.error.code, response.error.message, response.error.data); - handler(error51); + const error61 = McpError.fromError(response.error.code, response.error.message, response.error.data); + handler(error61); } } get transport() { @@ -29086,10 +33493,10 @@ var Protocol = class { try { const result = await this.request(request, resultSchema, options); yield { type: "result", result }; - } catch (error51) { + } catch (error61) { yield { type: "error", - error: error51 instanceof McpError ? error51 : new McpError(ErrorCode.InternalError, String(error51)) + error: error61 instanceof McpError ? error61 : new McpError(ErrorCode.InternalError, String(error61)) }; } return; @@ -29132,10 +33539,10 @@ var Protocol = class { await new Promise((resolve) => setTimeout(resolve, pollInterval)); options?.signal?.throwIfAborted(); } - } catch (error51) { + } catch (error61) { yield { type: "error", - error: error51 instanceof McpError ? error51 : new McpError(ErrorCode.InternalError, String(error51)) + error: error61 instanceof McpError ? error61 : new McpError(ErrorCode.InternalError, String(error61)) }; } } @@ -29147,8 +33554,8 @@ var Protocol = class { request(request, resultSchema, options) { const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {}; return new Promise((resolve, reject) => { - const earlyReject = (error51) => { - reject(error51); + const earlyReject = (error61) => { + reject(error61); }; if (!this._transport) { earlyReject(new Error("Not connected")); @@ -29208,9 +33615,9 @@ var Protocol = class { requestId: messageId, reason: String(reason) } - }, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error52) => this._onerror(new Error(`Failed to send cancellation: ${error52}`))); - const error51 = reason instanceof McpError ? reason : new McpError(ErrorCode.RequestTimeout, String(reason)); - reject(error51); + }, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error62) => this._onerror(new Error(`Failed to send cancellation: ${error62}`))); + const error61 = reason instanceof McpError ? reason : new McpError(ErrorCode.RequestTimeout, String(reason)); + reject(error61); }; this._responseHandlers.set(messageId, (response) => { if (options?.signal?.aborted) { @@ -29226,8 +33633,8 @@ var Protocol = class { } else { resolve(parseResult.data); } - } catch (error51) { - reject(error51); + } catch (error61) { + reject(error61); } }); options?.signal?.addEventListener("abort", () => { @@ -29251,14 +33658,14 @@ var Protocol = class { type: "request", message: jsonrpcRequest, timestamp: Date.now() - }).catch((error51) => { + }).catch((error61) => { this._cleanupTimeout(messageId); - reject(error51); + reject(error61); }); } else { - this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error51) => { + this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error61) => { this._cleanupTimeout(messageId); - reject(error51); + reject(error61); }); } }); @@ -29351,7 +33758,7 @@ var Protocol = class { } }; } - this._transport?.send(jsonrpcNotification2, options).catch((error51) => this._onerror(error51)); + this._transport?.send(jsonrpcNotification2, options).catch((error61) => this._onerror(error61)); }); return; } @@ -29632,12 +34039,12 @@ var AjvJsonSchemaValidator = class { */ getValidator(schema) { const ajvValidator = "$id" in schema && typeof schema.$id === "string" ? this._ajv.getSchema(schema.$id) ?? this._ajv.compile(schema) : this._ajv.compile(schema); - return (input) => { - const valid = ajvValidator(input); + return (input2) => { + const valid = ajvValidator(input2); if (valid) { return { valid: true, - data: input, + data: input2, errorMessage: void 0 }; } else { @@ -29965,16 +34372,7 @@ var Server = class extends Protocol { if (!methodSchema) { throw new Error("Schema is missing a method literal"); } - let methodValue; - if (isZ4Schema(methodSchema)) { - const v4Schema = methodSchema; - const v4Def = v4Schema._zod?.def; - methodValue = v4Def?.value ?? v4Schema.value; - } else { - const v3Schema = methodSchema; - const legacyDef = v3Schema._def; - methodValue = legacyDef?.value ?? v3Schema.value; - } + const methodValue = getLiteralValue(methodSchema); if (typeof methodValue !== "string") { throw new Error("Schema method literal must be a string"); } @@ -30213,11 +34611,11 @@ var Server = class extends Protocol { if (!validationResult.valid) { throw new McpError(ErrorCode.InvalidParams, `Elicitation response content does not match requested schema: ${validationResult.errorMessage}`); } - } catch (error51) { - if (error51 instanceof McpError) { - throw error51; + } catch (error61) { + if (error61 instanceof McpError) { + throw error61; } - throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error51 instanceof Error ? error51.message : String(error51)}`); + throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error61 instanceof Error ? error61.message : String(error61)}`); } } return result; @@ -30476,13 +34874,13 @@ var McpServer = class { } await this.validateToolOutput(tool, result, request.params.name); return result; - } catch (error51) { - if (error51 instanceof McpError) { - if (error51.code === ErrorCode.UrlElicitationRequired) { - throw error51; + } catch (error61) { + if (error61 instanceof McpError) { + if (error61.code === ErrorCode.UrlElicitationRequired) { + throw error61; } } - return this.createToolError(error51 instanceof Error ? error51.message : String(error51)); + return this.createToolError(error61 instanceof Error ? error61.message : String(error61)); } }); this._toolHandlersInitialized = true; @@ -30515,8 +34913,8 @@ var McpServer = class { const schemaToParse = inputObj ?? tool.inputSchema; const parseResult = await safeParseAsync2(schemaToParse, args); if (!parseResult.success) { - const error51 = "error" in parseResult ? parseResult.error : "Unknown error"; - const errorMessage = getParseErrorMessage(error51); + const error61 = "error" in parseResult ? parseResult.error : "Unknown error"; + const errorMessage = getParseErrorMessage(error61); throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage}`); } return parseResult.data; @@ -30540,8 +34938,8 @@ var McpServer = class { const outputObj = normalizeObjectSchema(tool.outputSchema); const parseResult = await safeParseAsync2(outputObj, result.structuredContent); if (!parseResult.success) { - const error51 = "error" in parseResult ? parseResult.error : "Unknown error"; - const errorMessage = getParseErrorMessage(error51); + const error61 = "error" in parseResult ? parseResult.error : "Unknown error"; + const errorMessage = getParseErrorMessage(error61); throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage}`); } } @@ -30753,8 +35151,8 @@ var McpServer = class { const argsObj = normalizeObjectSchema(prompt.argsSchema); const parseResult = await safeParseAsync2(argsObj, request.params.arguments); if (!parseResult.success) { - const error51 = "error" in parseResult ? parseResult.error : "Unknown error"; - const errorMessage = getParseErrorMessage(error51); + const error61 = "error" in parseResult ? parseResult.error : "Unknown error"; + const errorMessage = getParseErrorMessage(error61); throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage}`); } const args = parseResult.data; @@ -31162,8 +35560,17 @@ var EMPTY_COMPLETION_RESULT = { import process3 from "node:process"; // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js +var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024; var ReadBuffer = class { + constructor(options) { + this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE; + } append(chunk) { + const newSize = (this._buffer?.length ?? 0) + chunk.length; + if (newSize > this._maxBufferSize) { + this.clear(); + throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`); + } this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk; } readMessage() { @@ -31191,18 +35598,24 @@ function serializeMessage(message) { // node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js var StdioServerTransport = class { - constructor(_stdin = process3.stdin, _stdout = process3.stdout) { + constructor(_stdin = process3.stdin, _stdout = process3.stdout, options) { this._stdin = _stdin; this._stdout = _stdout; - this._readBuffer = new ReadBuffer(); this._started = false; this._ondata = (chunk) => { - this._readBuffer.append(chunk); - this.processReadBuffer(); + try { + this._readBuffer.append(chunk); + this.processReadBuffer(); + } catch (error61) { + this.onerror?.(error61); + this.close().catch(() => { + }); + } }; - this._onerror = (error51) => { - this.onerror?.(error51); + this._onerror = (error61) => { + this.onerror?.(error61); }; + this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize }); } /** * Starts listening for messages on stdin. @@ -31223,8 +35636,8 @@ var StdioServerTransport = class { break; } this.onmessage?.(message); - } catch (error51) { - this.onerror?.(error51); + } catch (error61) { + this.onerror?.(error61); } } } @@ -31256,7 +35669,7 @@ import { fileURLToPath } from "node:url"; // src/filePolicy.ts import { createHash } from "node:crypto"; -import { open, lstat, mkdir, opendir, readFile, realpath } from "node:fs/promises"; +import { open as open2, lstat, mkdir, opendir, readFile, realpath } from "node:fs/promises"; import path from "node:path"; import { TextDecoder } from "node:util"; var RootConfigSchema = external_exports.object({ @@ -31264,7 +35677,14 @@ var RootConfigSchema = external_exports.object({ label: external_exports.string().min(1).max(80), path: external_exports.string().min(1), read: external_exports.boolean(), - create: external_exports.boolean() + create: external_exports.boolean(), + host_id: external_exports.string().regex(/^[a-z][a-z0-9-]{0,63}$/).optional(), + volume_id: external_exports.string().regex(/^vol-[a-f0-9]{16}$/).optional(), + current_drive_letter: external_exports.string().regex(/^[A-Z]$/).optional(), + filesystem: external_exports.string().min(1).max(32).optional(), + bus_type: external_exports.string().min(1).max(64).optional(), + online: external_exports.boolean().optional(), + auto_discovered: external_exports.boolean().optional() }).strict(); var LimitsSchema = external_exports.object({ maxReadBytes: external_exports.number().int().min(1024).max(1024 * 1024).default(256 * 1024), @@ -31275,7 +35695,7 @@ var LimitsSchema = external_exports.object({ }).strict(); var FileBridgeConfigSchema = external_exports.object({ version: external_exports.literal(1), - roots: external_exports.array(RootConfigSchema).min(1).max(16), + roots: external_exports.array(RootConfigSchema).min(1).max(26), limits: LimitsSchema }).strict(); var PolicyError = class extends Error { @@ -31340,6 +35760,7 @@ var BLOCKED_EXTENSIONS = /* @__PURE__ */ new Set([ var SSH_PRIVATE_KEY_FILENAME = /^id_(?:rsa|dsa|ecdsa|ed25519)(?:[._-].*)?$/; var WINDOWS_RESERVED = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/i; var DRIVE_ROOT_OPT_IN = "I_ACCEPT_FULL_DRIVE_ACCESS_RISK"; +var MAX_CANONICALIZATION_ENTRIES = 25e3; var FileBridgePolicy = class _FileBridgePolicy { constructor(roots, limits) { this.roots = roots; @@ -31370,11 +35791,14 @@ var FileBridgePolicy = class _FileBridgePolicy { throw new PolicyError("CONFIG_DUPLICATE_ROOT", "Root identifiers must be unique."); } let canonicalPath; + let rootInfo; try { - canonicalPath = await realpath(path.resolve(configured.path)); - const info = await lstat(canonicalPath); - if (!info.isDirectory() || info.isSymbolicLink()) throw new Error("not a real directory"); - } catch { + const authorized = await authorizeConfiguredRoot(configured.path); + canonicalPath = authorized.target; + rootInfo = authorized.info; + if (!rootInfo.isDirectory() || rootInfo.isSymbolicLink()) throw new Error("not a real directory"); + } catch (error61) { + if (error61 instanceof PolicyError) throw error61; throw new PolicyError("CONFIG_ROOT_UNAVAILABLE", `Configured root '${configured.id}' is unavailable.`); } if (isFilesystemRoot(canonicalPath) && driveRootOptIn !== DRIVE_ROOT_OPT_IN) { @@ -31383,7 +35807,7 @@ var FileBridgePolicy = class _FileBridgePolicy { `Root '${configured.id}' points at a complete filesystem. Explicit risk opt-in is required.` ); } - roots.set(configured.id, { ...configured, canonicalPath }); + roots.set(configured.id, { ...configured, canonicalPath, identity: identityOf(rootInfo) }); } return new _FileBridgePolicy(roots, validated.limits); } @@ -31393,24 +35817,32 @@ var FileBridgePolicy = class _FileBridgePolicy { label: root.label, read: root.read, create: root.create, - full_drive: isFilesystemRoot(root.canonicalPath) + full_drive: isFilesystemRoot(root.canonicalPath), + ...root.host_id === void 0 ? {} : { host_id: root.host_id }, + ...root.volume_id === void 0 ? {} : { volume_id: root.volume_id }, + ...root.current_drive_letter === void 0 ? {} : { current_drive_letter: root.current_drive_letter }, + ...root.filesystem === void 0 ? {} : { filesystem: root.filesystem }, + ...root.bus_type === void 0 ? {} : { bus_type: root.bus_type }, + ...root.online === void 0 ? {} : { online: root.online }, + ...root.auto_discovered === void 0 ? {} : { auto_discovered: root.auto_discovered } })); } async statPath(rootId2, relativePath2) { const resolved = await this.resolveForRead(rootId2, relativePath2); - const info = await lstat(resolved.target); + const info = resolved.info; if (info.isSymbolicLink()) throw new PolicyError("LINK_BLOCKED", "Links and junctions are blocked."); + await assertUnchanged(resolved.target, info); return { root_id: rootId2, path: logicalPath(relativePath2), kind: info.isFile() ? "file" : info.isDirectory() ? "directory" : "other", - size: info.size, + size: Number(info.size), modified_at: info.mtime.toISOString() }; } async listDirectory(rootId2, relativePath2, requestedLimit) { const resolved = await this.resolveForRead(rootId2, relativePath2); - const directoryInfo = await lstat(resolved.target); + const directoryInfo = resolved.info; if (!directoryInfo.isDirectory()) throw new PolicyError("NOT_A_DIRECTORY", "The requested path is not a directory."); const limit = Math.min(requestedLimit ?? this.limits.maxDirectoryEntries, this.limits.maxDirectoryEntries); const entries = []; @@ -31431,34 +35863,35 @@ var FileBridgePolicy = class _FileBridgePolicy { kind: entry.isFile() ? "file" : entry.isDirectory() ? "directory" : "other" }); } + await assertUnchanged(resolved.target, directoryInfo); entries.sort((left, right) => left.name.localeCompare(right.name)); return { root_id: rootId2, path: logicalPath(relativePath2), entries, blocked_entries, truncated }; } async readTextFile(rootId2, relativePath2, requestedMaxBytes) { const resolved = await this.resolveForRead(rootId2, relativePath2); - const before = await lstat(resolved.target); + const before = resolved.info; if (!before.isFile() || before.isSymbolicLink()) { throw new PolicyError("NOT_A_REGULAR_FILE", "Only regular files can be read."); } const limit = Math.min(requestedMaxBytes ?? this.limits.maxReadBytes, this.limits.maxReadBytes); - const handle = await open(resolved.target, "r"); + const handle = await open2(resolved.target, "r"); try { - const after = await handle.stat(); - if (!after.isFile() || !sameFile(before, after)) { + const after = await handle.stat({ bigint: true }); + if (!after.isFile() || !sameFileIdentity(before, after)) { throw new PolicyError("PATH_CHANGED", "The file changed while it was being opened."); } - const bytesToRead = Math.min(after.size, limit); + const bytesToRead = Number(after.size < BigInt(limit) ? after.size : BigInt(limit)); const buffer = Buffer.alloc(bytesToRead); const { bytesRead } = await handle.read(buffer, 0, bytesToRead, 0); const returned = buffer.subarray(0, bytesRead); - const text = decodeUtf8(returned, after.size > bytesRead); + const text = decodeUtf8(returned, after.size > BigInt(bytesRead)); const redacted = redactSecrets(text); return { root_id: rootId2, path: logicalPath(relativePath2), bytes_returned: bytesRead, - file_bytes: after.size, - truncated: after.size > bytesRead, + file_bytes: Number(after.size), + truncated: after.size > BigInt(bytesRead), sha256_returned: createHash("sha256").update(returned).digest("hex"), redactions: redacted.count, text: redacted.text @@ -31471,7 +35904,7 @@ var FileBridgePolicy = class _FileBridgePolicy { const normalizedQuery = query.trim().toLocaleLowerCase(); if (!normalizedQuery) throw new PolicyError("INVALID_QUERY", "Search query cannot be empty."); const start = await this.resolveForRead(rootId2, startPath); - const startInfo = await lstat(start.target); + const startInfo = start.info; if (!startInfo.isDirectory()) throw new PolicyError("NOT_A_DIRECTORY", "Search start path is not a directory."); const queue = [logicalPath(startPath) === "." ? "" : logicalPath(startPath)]; const matches = []; @@ -31514,11 +35947,19 @@ var FileBridgePolicy = class _FileBridgePolicy { async createDirectory(rootId2, relativePath2) { const resolved = await this.resolveForCreate(rootId2, relativePath2); if (!resolved.normalizedRelative) throw new PolicyError("ROOT_WRITE_BLOCKED", "The configured root cannot be created or replaced."); - await this.assertCreateParent(resolved.root, resolved.target); try { await mkdir(resolved.target, { recursive: false }); - } catch (error51) { - throw translateCreateError(error51); + } catch (error61) { + throw translateCreateError(error61); + } + await assertUnchanged(resolved.parent.target, resolved.parent.info); + try { + await authorizeExistingPath(resolved.root, resolved.normalizedRelative); + } catch { + throw new PolicyError( + "CREATE_INCOMPLETE", + "The new directory was created but post-create authorization failed; FileBridge will not delete it automatically." + ); } return { root_id: rootId2, path: logicalPath(relativePath2), created: true, kind: "directory" }; } @@ -31530,16 +35971,25 @@ var FileBridgePolicy = class _FileBridgePolicy { if (data.byteLength > this.limits.maxWriteBytes) { throw new PolicyError("WRITE_LIMIT_EXCEEDED", `New file content exceeds the ${this.limits.maxWriteBytes}-byte limit.`); } - await this.assertCreateParent(resolved.root, resolved.target); let handle; try { - handle = await open(resolved.target, "wx", 384); - } catch (error51) { - throw translateCreateError(error51); + handle = await open2(resolved.target, "wx", 384); + } catch (error61) { + throw translateCreateError(error61); } try { + const [opened, named] = await Promise.all([handle.stat({ bigint: true }), lstat(resolved.target, { bigint: true })]); + if (!opened.isFile() || named.isSymbolicLink() || !sameFileIdentity(opened, named)) { + throw new PolicyError("PATH_CHANGED", "The new file path changed while it was being opened."); + } + await assertUnchanged(resolved.parent.target, resolved.parent.info); await handle.writeFile(data); await handle.sync(); + const [written, finalNamed] = await Promise.all([handle.stat({ bigint: true }), lstat(resolved.target, { bigint: true })]); + if (!written.isFile() || finalNamed.isSymbolicLink() || !sameFileIdentity(written, finalNamed)) { + throw new PolicyError("PATH_CHANGED", "The new file path changed while it was being written."); + } + await assertUnchanged(resolved.parent.target, resolved.parent.info); } catch { throw new PolicyError( "WRITE_INCOMPLETE", @@ -31566,76 +36016,217 @@ var FileBridgePolicy = class _FileBridgePolicy { } async resolveForRead(rootId2, relativePath2) { const root = this.getRoot(rootId2, "read"); - const resolved = resolveLogicalPath(root, relativePath2); - await assertNoLinks(root.canonicalPath, resolved.target); - let canonicalTarget; - try { - canonicalTarget = await realpath(resolved.target); - } catch { - throw new PolicyError("PATH_NOT_FOUND", "The requested path does not exist."); - } - if (!isWithin(root.canonicalPath, canonicalTarget)) throw new PolicyError("PATH_ESCAPE_BLOCKED", "Path escapes the configured root."); - return resolved; + const normalizedRelative = validateRelativePath(relativePath2); + const authorized = await authorizeExistingPath(root, normalizedRelative); + return { root, normalizedRelative, ...authorized }; } async resolveForCreate(rootId2, relativePath2) { const root = this.getRoot(rootId2, "create"); - const resolved = resolveLogicalPath(root, relativePath2); - await assertNoLinks(root.canonicalPath, path.dirname(resolved.target)); - return resolved; - } - async assertCreateParent(root, target) { - const parent = path.dirname(target); - let canonicalParent; - try { - canonicalParent = await realpath(parent); - const parentInfo = await lstat(parent); - if (!parentInfo.isDirectory() || parentInfo.isSymbolicLink()) throw new Error("unsafe parent"); - } catch { + const normalizedRelative = validateRelativePath(relativePath2); + const parts = splitNormalizedPath(normalizedRelative); + if (parts.length === 0) { + return { + root, + target: root.canonicalPath, + normalizedRelative, + parent: await authorizeExistingPath(root, "") + }; + } + const leaf = parts.pop(); + const parentRelative = parts.join(path.sep); + const parent = await authorizeExistingPath(root, parentRelative); + if (!parent.info.isDirectory()) { throw new PolicyError("PARENT_UNAVAILABLE", "The parent directory must already exist and cannot be a link."); } - if (!isWithin(root.canonicalPath, canonicalParent)) throw new PolicyError("PATH_ESCAPE_BLOCKED", "Parent escapes the configured root."); + const target = path.join(parent.target, leaf); + if (!isWithin(root.canonicalPath, target)) throw new PolicyError("PATH_ESCAPE_BLOCKED", "Path escapes the configured root."); + return { root, target, normalizedRelative, parent }; } }; -function resolveLogicalPath(root, relativePath2) { - const normalizedRelative = validateRelativePath(relativePath2); - const target = path.resolve(root.canonicalPath, normalizedRelative || "."); - if (!isWithin(root.canonicalPath, target)) throw new PolicyError("PATH_ESCAPE_BLOCKED", "Path escapes the configured root."); - return { root, target, normalizedRelative }; -} -function validateRelativePath(input) { - if (typeof input !== "string" || input.includes("\0")) throw new PolicyError("INVALID_PATH", "Path is invalid."); - if (path.isAbsolute(input) || path.win32.isAbsolute(input) || path.posix.isAbsolute(input)) { +function validateRelativePath(input2) { + if (typeof input2 !== "string" || input2.includes("\0")) throw new PolicyError("INVALID_PATH", "Path is invalid."); + if (path.isAbsolute(input2) || path.win32.isAbsolute(input2) || path.posix.isAbsolute(input2)) { throw new PolicyError("ABSOLUTE_PATH_BLOCKED", "Use a configured root id and a relative path."); } - const parts = input.split(/[\\/]+/).filter(Boolean); + if (input2.includes("/") && input2.includes("\\") || /[\\/]{2,}/u.test(input2)) { + throw new PolicyError("AMBIGUOUS_PATH_BLOCKED", "Mixed or repeated path separators are not allowed."); + } + const parts = input2.split(/[\\/]+/).filter(Boolean); for (const part of parts) { - if (part === "." || part === "..") throw new PolicyError("PATH_TRAVERSAL_BLOCKED", "Dot segments are not allowed."); - if (/[<>:"|?*\u0000-\u001f]/u.test(part) || /[. ]$/u.test(part) || WINDOWS_RESERVED.test(part)) { - throw new PolicyError("INVALID_PATH_COMPONENT", "Path contains a blocked Windows path component."); - } - if (isBlockedPart(part)) throw new PolicyError("SENSITIVE_PATH_BLOCKED", "Sensitive credential or system paths are blocked."); + validatePathComponent(part); } return parts.join(path.sep); } +function validatePathComponent(part) { + validatePathComponentSyntax(part); + if (isBlockedPart(part)) throw new PolicyError("SENSITIVE_PATH_BLOCKED", "Sensitive credential or system paths are blocked."); +} +function validatePathComponentSyntax(part) { + if (part === "." || part === "..") throw new PolicyError("PATH_TRAVERSAL_BLOCKED", "Dot segments are not allowed."); + if (/[<>:"|?*\u0000-\u001f]/u.test(part) || /[. ]$/u.test(part) || WINDOWS_RESERVED.test(part)) { + throw new PolicyError("INVALID_PATH_COMPONENT", "Path contains a blocked Windows path component."); + } +} function isBlockedPart(part) { const lower = part.toLocaleLowerCase(); return BLOCKED_SEGMENTS.has(lower) || BLOCKED_FILENAMES.has(lower) || SSH_PRIVATE_KEY_FILENAME.test(lower) || lower.startsWith(".env") || BLOCKED_EXTENSIONS.has(path.extname(lower)); } -async function assertNoLinks(root, target) { - if (!isWithin(root, target)) throw new PolicyError("PATH_ESCAPE_BLOCKED", "Path escapes the configured root."); - const relative = path.relative(root, target); +async function authorizeConfiguredRoot(configuredPath) { + const absolute = path.resolve(configuredPath); + const filesystemRoot = path.parse(absolute).root; + const relative = path.relative(filesystemRoot, absolute); const parts = relative ? relative.split(path.sep) : []; - let current = root; - for (const part of ["", ...parts]) { - if (part) current = path.join(current, part); + for (const part of parts) validatePathComponentSyntax(part); + let rootInfo; + try { + rootInfo = await lstat(filesystemRoot, { bigint: true }); + } catch { + throw new PolicyError("CONFIG_ROOT_UNAVAILABLE", "Configured root filesystem is unavailable."); + } + assertSafeObject(rootInfo); + const result = await authorizeStoredComponents( + filesystemRoot, + rootInfo, + parts, + filesystemRoot, + false, + Math.max(parts.length - 1, 0) + ); + if (!result.info.isDirectory()) { + throw new PolicyError("CONFIG_ROOT_UNAVAILABLE", "Configured root must be a directory."); + } + if (result.storedParts.length > 0 && isBlockedPart(result.storedParts.at(-1))) { + throw new PolicyError("SENSITIVE_PATH_BLOCKED", "A configured root cannot itself be a sensitive path."); + } + return result; +} +async function authorizeExistingPath(root, normalizedRelative) { + let rootInfo; + try { + rootInfo = await lstat(root.canonicalPath, { bigint: true }); + } catch { + throw new PolicyError("PATH_UNAVAILABLE", "The configured root is unavailable."); + } + assertSafeObject(rootInfo); + if (!sameFileIdentity(root.identity, rootInfo)) { + throw new PolicyError("PATH_CHANGED", "The configured root changed after startup."); + } + const parts = splitNormalizedPath(normalizedRelative); + return authorizeStoredComponents(root.canonicalPath, rootInfo, parts, root.canonicalPath); +} +async function authorizeStoredComponents(start, startInfo, suppliedParts, boundary, enforceSensitiveNames = true, enforceAlternateFromIndex = 0) { + let current = start; + let currentInfo = startInfo; + const storedParts = []; + for (let partIndex = 0; partIndex < suppliedParts.length; partIndex += 1) { + const suppliedPart = suppliedParts[partIndex]; + if (!currentInfo.isDirectory()) { + throw new PolicyError("PATH_NOT_FOUND", "A parent path component is not a directory."); + } + const suppliedTarget = path.join(current, suppliedPart); + if (!isWithin(boundary, suppliedTarget)) { + throw new PolicyError("PATH_ESCAPE_BLOCKED", "Path escapes the configured root."); + } + let suppliedInfo; try { - const info = await lstat(current); - if (info.isSymbolicLink()) throw new PolicyError("LINK_BLOCKED", "Links and junctions are blocked."); - } catch (error51) { - if (error51 instanceof PolicyError) throw error51; - if (isNodeError(error51) && error51.code === "ENOENT") return; + suppliedInfo = await lstat(suppliedTarget, { bigint: true }); + } catch (error61) { + if (isNodeError(error61) && error61.code === "ENOENT") { + throw new PolicyError("PATH_NOT_FOUND", "The requested path does not exist."); + } throw new PolicyError("PATH_UNAVAILABLE", "A path component is unavailable."); } + assertSafeObject(suppliedInfo); + const matches = []; + let scanned = 0; + let directory; + try { + directory = await opendir(current); + for await (const entry of directory) { + scanned += 1; + if (scanned > MAX_CANONICALIZATION_ENTRIES) { + throw new PolicyError("PATH_IDENTITY_UNAVAILABLE", "Directory identity mapping exceeded the safety bound."); + } + let candidateInfo; + try { + candidateInfo = await lstat(path.join(current, entry.name), { bigint: true }); + } catch { + continue; + } + if (!hasStableIdentity(candidateInfo)) continue; + if (sameFileIdentity(suppliedInfo, candidateInfo)) matches.push({ name: entry.name, info: candidateInfo }); + } + } finally { + await directory?.close().catch(() => void 0); + } + await assertUnchanged(current, currentInfo); + if (matches.length === 0) { + throw new PolicyError("PATH_IDENTITY_UNAVAILABLE", "The stored path name could not be established safely."); + } + if (matches.length !== 1) { + throw new PolicyError("PATH_IDENTITY_AMBIGUOUS", "Multiple stored names identify the same filesystem object."); + } + const stored = matches[0]; + if (enforceSensitiveNames && isBlockedPart(stored.name)) { + throw new PolicyError("SENSITIVE_PATH_BLOCKED", "Sensitive credential or system paths are blocked."); + } + if (partIndex >= enforceAlternateFromIndex && !sameSpellingOrWindowsCase(suppliedPart, stored.name)) { + throw new PolicyError("ALTERNATE_NAME_BLOCKED", "Alternate filesystem names are blocked."); + } + const storedTarget = path.join(current, stored.name); + await assertUnchanged(storedTarget, suppliedInfo); + const canonicalTarget = await realpath(storedTarget).catch(() => { + throw new PolicyError("PATH_CHANGED", "A path component changed during canonicalization."); + }); + if (!isWithin(boundary, canonicalTarget)) { + throw new PolicyError("PATH_ESCAPE_BLOCKED", "Path escapes the configured root."); + } + await assertUnchanged(canonicalTarget, suppliedInfo); + current = canonicalTarget; + currentInfo = stored.info; + storedParts.push(stored.name); + } + if (currentInfo.isFile() && currentInfo.nlink > 1n) { + throw new PolicyError("HARDLINK_BLOCKED", "Files with multiple hard links are blocked."); + } + return { target: current, info: currentInfo, storedParts }; +} +function splitNormalizedPath(value) { + return value ? value.split(path.sep) : []; +} +function sameSpellingOrWindowsCase(supplied, stored) { + if (supplied === stored) return true; + return process.platform === "win32" && supplied.toLowerCase() === stored.toLowerCase(); +} +function assertSafeObject(info) { + if (info.isSymbolicLink()) throw new PolicyError("LINK_BLOCKED", "Links and junctions are blocked."); + if (!info.isFile() && !info.isDirectory()) { + throw new PolicyError("UNSUPPORTED_OBJECT_BLOCKED", "Unsupported filesystem objects and reparse points are blocked."); + } + assertStableIdentity(info); +} +function assertStableIdentity(info) { + if (!hasStableIdentity(info)) { + throw new PolicyError("PATH_IDENTITY_UNAVAILABLE", "Stable filesystem identity is unavailable."); + } +} +function hasStableIdentity(info) { + return info.dev >= 0n && info.ino > 0n; +} +function identityOf(info) { + assertStableIdentity(info); + return { dev: info.dev, ino: info.ino }; +} +async function assertUnchanged(target, expected) { + let current; + try { + current = await lstat(target, { bigint: true }); + } catch { + throw new PolicyError("PATH_CHANGED", "The path changed during authorization."); + } + assertSafeObject(current); + if (!sameFileIdentity(expected, current)) { + throw new PolicyError("PATH_CHANGED", "The path changed during authorization."); } } function isWithin(root, target) { @@ -31650,9 +36241,17 @@ function logicalPath(value) { const normalized = validateRelativePath(value); return normalized ? normalized.split(path.sep).join("/") : "."; } -function sameFile(left, right) { - if (left.ino === 0 || right.ino === 0) return true; - return left.dev === right.dev && left.ino === right.ino; +function sameFileIdentity(left, right) { + const leftDev = exactBigInt(left.dev); + const leftIno = exactBigInt(left.ino); + const rightDev = exactBigInt(right.dev); + const rightIno = exactBigInt(right.ino); + if (leftDev === null || leftIno === null || rightDev === null || rightIno === null || leftDev < 0n || rightDev < 0n || leftIno <= 0n || rightIno <= 0n) return false; + return leftDev === rightDev && leftIno === rightIno; +} +function exactBigInt(value) { + if (typeof value === "bigint") return value; + return Number.isSafeInteger(value) ? BigInt(value) : null; } function decodeUtf8(buffer, truncated) { for (let trim = 0; trim <= (truncated ? 3 : 0); trim += 1) { @@ -31663,8 +36262,8 @@ function decodeUtf8(buffer, truncated) { } throw new PolicyError("NON_TEXT_FILE", "The requested file is not valid UTF-8 text."); } -function redactSecrets(input) { - let text = input; +function redactSecrets(input2) { + let text = input2; let count = 0; const replace = (pattern, replacement) => { text = text.replace(pattern, (...values) => { @@ -31683,20 +36282,20 @@ function redactSecrets(input) { ); return { text, count }; } -function translateCreateError(error51) { - if (isNodeError(error51) && error51.code === "EEXIST") { +function translateCreateError(error61) { + if (isNodeError(error61) && error61.code === "EEXIST") { return new PolicyError("TARGET_EXISTS", "Target already exists. FileBridge never overwrites existing paths."); } - if (isNodeError(error51) && error51.code === "ENOENT") { + if (isNodeError(error61) && error61.code === "ENOENT") { return new PolicyError("PARENT_UNAVAILABLE", "The parent directory must already exist."); } - if (isNodeError(error51) && (error51.code === "EACCES" || error51.code === "EPERM")) { + if (isNodeError(error61) && (error61.code === "EACCES" || error61.code === "EPERM")) { return new PolicyError("CREATE_DENIED", "The operating system denied creation."); } return new PolicyError("CREATE_FAILED", "The new path could not be created."); } -function isNodeError(error51) { - return error51 instanceof Error && "code" in error51; +function isNodeError(error61) { + return error61 instanceof Error && "code" in error61; } // src/server.ts @@ -31720,7 +36319,7 @@ async function main() { const configPath = path2.resolve(process.env.FILEBRIDGE_CONFIG ?? path2.join(pluginRoot, "config", "roots.local.json")); const policy = await FileBridgePolicy.fromFile(configPath); const server = new McpServer( - { name: "pc-filebridge", version: "0.1.1" }, + { name: "pc-filebridge", version: "0.2.1" }, { instructions: "Create-only filesystem bridge. Use only configured root IDs and relative paths. Reads are bounded and secret-redacted. Writes may create a new file or directory only. Overwrite, append, patch, rename, move, link traversal, and delete are unavailable and must never be claimed." } @@ -31826,8 +36425,8 @@ async function execute(operation) { content: [{ type: "text", text: JSON.stringify(data) }], structuredContent: data }; - } catch (error51) { - const safe = safeError(error51); + } catch (error61) { + const safe = safeError(error61); process.stderr.write(`${JSON.stringify({ event: "tool_error", code: safe.code })} `); return { @@ -31836,13 +36435,13 @@ async function execute(operation) { }; } } -function safeError(error51) { - if (error51 instanceof PolicyError) return { code: error51.code, message: error51.message }; - if (error51 instanceof external_exports.ZodError) return { code: "INVALID_INPUT", message: "Tool input did not match the required schema." }; +function safeError(error61) { + if (error61 instanceof PolicyError) return { code: error61.code, message: error61.message }; + if (error61 instanceof external_exports.ZodError) return { code: "INVALID_INPUT", message: "Tool input did not match the required schema." }; return { code: "INTERNAL_ERROR", message: "The filesystem operation failed safely." }; } -main().catch((error51) => { - const safe = safeError(error51); +main().catch((error61) => { + const safe = safeError(error61); process.stderr.write(`${JSON.stringify({ event: "startup_failed", code: safe.code, message: safe.message })} `); process.exitCode = 1; diff --git a/package-lock.json b/package-lock.json index f6b8e83..7322e00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,31 +1,31 @@ { "name": "pc-filebridge", - "version": "0.1.1", + "version": "0.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pc-filebridge", - "version": "0.1.1", + "version": "0.2.1", "license": "Apache-2.0", "dependencies": { - "@modelcontextprotocol/sdk": "1.29.0", - "zod": "4.4.3" + "@modelcontextprotocol/sdk": "1.30.0", + "zod": "4.5.4" }, "devDependencies": { - "@types/node": "26.1.1", - "esbuild": "0.28.1", + "@types/node": "26.4.0", + "esbuild": "0.28.2", "typescript": "7.0.2", - "vitest": "4.1.10" + "vitest": "4.1.11" }, "engines": { "node": ">=22.0.0" } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", - "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", "cpu": [ "ppc64" ], @@ -40,9 +40,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz", - "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", "cpu": [ "arm" ], @@ -57,9 +57,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", - "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", "cpu": [ "arm64" ], @@ -74,9 +74,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz", - "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", "cpu": [ "x64" ], @@ -91,9 +91,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", - "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", "cpu": [ "arm64" ], @@ -108,9 +108,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", - "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", "cpu": [ "x64" ], @@ -125,9 +125,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", - "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", "cpu": [ "arm64" ], @@ -142,9 +142,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", - "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", "cpu": [ "x64" ], @@ -159,9 +159,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", - "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", "cpu": [ "arm" ], @@ -176,9 +176,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", - "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", "cpu": [ "arm64" ], @@ -193,9 +193,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", - "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", "cpu": [ "ia32" ], @@ -210,9 +210,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", - "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", "cpu": [ "loong64" ], @@ -227,9 +227,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", - "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", "cpu": [ "mips64el" ], @@ -244,9 +244,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", - "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", "cpu": [ "ppc64" ], @@ -261,9 +261,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", - "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", "cpu": [ "riscv64" ], @@ -278,9 +278,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", - "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", "cpu": [ "s390x" ], @@ -295,9 +295,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", - "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", "cpu": [ "x64" ], @@ -312,9 +312,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", - "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", "cpu": [ "arm64" ], @@ -329,9 +329,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", - "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", "cpu": [ "x64" ], @@ -346,9 +346,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", - "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", "cpu": [ "arm64" ], @@ -363,9 +363,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", - "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", "cpu": [ "x64" ], @@ -380,9 +380,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", - "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", "cpu": [ "arm64" ], @@ -397,9 +397,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", - "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", "cpu": [ "x64" ], @@ -414,9 +414,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", - "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", "cpu": [ "arm64" ], @@ -431,9 +431,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", - "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", "cpu": [ "ia32" ], @@ -448,9 +448,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", - "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", "cpu": [ "x64" ], @@ -477,19 +477,19 @@ } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", "dev": true, "license": "MIT" }, "node_modules/@modelcontextprotocol/sdk": { - "version": "1.29.0", - "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.29.0.tgz", - "integrity": "sha512-zo37mZA9hJWpULgkRpowewez1y6ML5GsXJPY8FI0tBBCd77HEvza4jDqRKOXgHNn867PVGCyTdzqpz0izu5ZjQ==", + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.30.0.tgz", + "integrity": "sha512-xKd8OIzlqNzcqcNumGAa6g+PW2kjD5vrpcKOnfldAUPP3j7lnqMPwlTXQm8gF+UwH72z0lqaRbjr9hqGz0eITA==", "license": "MIT", "dependencies": { - "@hono/node-server": "^1.19.9", + "@hono/node-server": "^1.19.9 || ^2.0.5", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", @@ -524,9 +524,9 @@ } }, "node_modules/@oxc-project/types": { - "version": "0.146.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.146.0.tgz", - "integrity": "sha512-XC0QsnnhVe7sLIWmYmdPw7x5P0h4W8vUU3Nv1ySgWXtvCz8NizoAEpGXA0sOYoJQV2Rl13LgURAHQ5cI5ILCSA==", + "version": "0.147.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.147.0.tgz", + "integrity": "sha512-IJ3s6ltHLp45S0bh7phkX+gJO7A1Wuz2EaqpAhb8WjqDwbzMiWKHhyyT42tskaWjEYXtHtVCPpnBJVT9+dcRLg==", "dev": true, "license": "MIT", "funding": { @@ -534,9 +534,9 @@ } }, "node_modules/@rolldown/binding-android-arm-eabi": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.5.tgz", - "integrity": "sha512-DLe/i+l8ynIBY7XEQ191TeZvCoowIGa18R+dIV30GW7DiOtp74i/xX8hs8GUjW5ARV7VZuie3d6AumSmCwbeRA==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.6.tgz", + "integrity": "sha512-b+jTcARdTiFLI6jB4a5XjTm0RWd6KcRfQj/I2356fxUZemiho9zQLxo0RtCuMDAyKcLo6cEltkgbQp6d1+sjjQ==", "cpu": [ "arm" ], @@ -551,9 +551,9 @@ } }, "node_modules/@rolldown/binding-android-arm64": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.5.tgz", - "integrity": "sha512-zXcwKlQApYAOELHd8PwKDFkagYF9Wy4e0RJ+0qnzl9Pjnpj75TEG8ufv40p2J7kCEfwZAsNiuzRIyNNMWT38ig==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.6.tgz", + "integrity": "sha512-lkWU8ZJaRk9q3CIEY1Tc7vIFALp3Xw5NfGJo2hQg5oIqNgxWi1zI+IiDEK3r70BF5Dzol1tcXsnzsRc8NLhG+Q==", "cpu": [ "arm64" ], @@ -568,9 +568,9 @@ } }, "node_modules/@rolldown/binding-darwin-arm64": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.5.tgz", - "integrity": "sha512-dK4QakI42nzWgJT5sm4y4y/O//D4OxM75/cH28RLV+nzIN9AY+YsbuUVrUTjlLjXR6vpyxFbSsbmNuJ6BP9sww==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.6.tgz", + "integrity": "sha512-dgR56NYnvAszm7Ob1B2/Vn0e8bUQYZH2UjVaMMtMVOCKFSfjhfLmuA/9+O+F+ajUdG6B/bSssrKW6JJYASa8jA==", "cpu": [ "arm64" ], @@ -585,9 +585,9 @@ } }, "node_modules/@rolldown/binding-darwin-x64": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.5.tgz", - "integrity": "sha512-fqSALaUu1Wjd1nK2uW2kJDWdLCc8lx1IcY+MTY26Aurfdx19anlzhqXOgCFbBFQnlFDTn4TC1/7Nz4Bl2mLP3A==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.6.tgz", + "integrity": "sha512-vpVxFvUCFioJqug7OTvqptkc4yb8UX0AwfDmJpaR/0sWz+BUmqSVAf7c8JkUgnN8YLspb4a/N6NhTyMAmdyQ7Q==", "cpu": [ "x64" ], @@ -602,9 +602,9 @@ } }, "node_modules/@rolldown/binding-freebsd-x64": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.5.tgz", - "integrity": "sha512-/vCnNxlkxs9tKxNDcyWUePpJ/PgTzxIaVhoM5SmG8UV+GR/IcPam4VYxi7GIMo7PSDuNqlJqvprqii9NqqVCMw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.6.tgz", + "integrity": "sha512-h1wG6Y6K3JlRswxsI64qQJqBAy4vrLuHgRbc8CZMGSWTOFRY6ghMApM1NKzB2I0n5xV1fjkE18SuVl2QpLeNpA==", "cpu": [ "x64" ], @@ -619,9 +619,9 @@ } }, "node_modules/@rolldown/binding-linux-arm-gnueabihf": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.5.tgz", - "integrity": "sha512-abk0NLA519LxRCszmbE0jYKuQ9YPocOXTiOXOo6Yr+YAT95VH+PtqYAjOJvGKt3viEd/x4qzabAlwd5bHOOARg==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.6.tgz", + "integrity": "sha512-tbCiqub0q2MVWJKgF5PoAlNWCtQydiOYSLIkd8sByqK/6MMYLJRcSXSYodqYtd0O+Fw7QaVmKKlS4oL94YRZ0w==", "cpu": [ "arm" ], @@ -636,9 +636,9 @@ } }, "node_modules/@rolldown/binding-linux-arm64-gnu": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.5.tgz", - "integrity": "sha512-Y7eALiJ8lr0M2HH103Js+g7V34wf6snlpZLAsHI90uLhr3PVlNsbFVAXJC9d/V6BnPyKtpSwI+NcB/RLxsQxuA==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.6.tgz", + "integrity": "sha512-oxK9+baEBPhZG5HB4URY+uU04zJWeZlH6Tb9rB5DK4DF9XR1uXNLXt5Q5ZsugTKayNCNLhkcwz/ye74hRI98dg==", "cpu": [ "arm64" ], @@ -653,9 +653,9 @@ } }, "node_modules/@rolldown/binding-linux-arm64-musl": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.5.tgz", - "integrity": "sha512-xMvZgnbZg4YVnR/AX2b3oOPDTFYJvUVaJg5FedA/LuvexAtXibZQej4cnTkw3rjsJ/ggUROB64TdtETiim+FYA==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.6.tgz", + "integrity": "sha512-muWCk27FVBEZtv0MsK8gnfSmgczA8KQ0uRVJbTABKhkRfQc38aUrcb7fhi3BNiyseFmgcRsoMfQsSNJ+DbZdSw==", "cpu": [ "arm64" ], @@ -670,9 +670,9 @@ } }, "node_modules/@rolldown/binding-linux-ppc64-gnu": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.5.tgz", - "integrity": "sha512-GRjeqTUDHTo5GwntsLaAMcBahG3nlpjftXWZLN73HiYQlhwEowvarFgQnRnQZtIp4keXX7quXFbG38uPZBa2EA==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.6.tgz", + "integrity": "sha512-eWDoSfU7Co2qj3vgB3Dt4lj1mG6CoWbcJQkRMP3XJplyCMtuaq3LHvPFjS9QIPvMGWVadJC04Xiy0IdcVPtnwQ==", "cpu": [ "ppc64" ], @@ -687,9 +687,9 @@ } }, "node_modules/@rolldown/binding-linux-s390x-gnu": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.5.tgz", - "integrity": "sha512-vLNTR45F2Uwc8AufkNXPmB4VliaXs+FvcheEogIzOXzO4l+LzieXF5A/TWxLy5HtqpsRCHUfd0lPVrrdgXdLHQ==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.6.tgz", + "integrity": "sha512-2bWNjRSIayvupRKxXUY2tWG9fYdoUlTqWywHRvE8Eq3GvuQ+f2HeIkve697fIt+IQs/PV8yFsdWuhp1aJ1PdnA==", "cpu": [ "s390x" ], @@ -704,9 +704,9 @@ } }, "node_modules/@rolldown/binding-linux-x64-gnu": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.5.tgz", - "integrity": "sha512-Mgj59/HTuYeK9Gz2MA+mBWKnHsAgkBSec15ZMb1st3oIfFbX7gCjOae7GydHhzcyQi9Z/7M1QuN9bR3oFqF0jQ==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.6.tgz", + "integrity": "sha512-KekI0gS0wLxe1UBSQSjenBVwou/JkcQPDzBPICGZjxUv9k3RteHDPBQaiOicZUFKRIH2wKEimGwVpnJsbPzu7w==", "cpu": [ "x64" ], @@ -721,9 +721,9 @@ } }, "node_modules/@rolldown/binding-linux-x64-musl": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.5.tgz", - "integrity": "sha512-mY8AP0/ichsbhAxGnLa3d3+MwV0EfgrPND2bplI3Ym8T6R2pJ0N87bvrKVwNXmdy3jnr6eQBecdqx/HMknBmpA==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.6.tgz", + "integrity": "sha512-TvtPnfVr+HtyGiDmPK4VWmlNm7QhNNAcK5Q9A7aOXsI8545yCyaoMaicXrFZ72JzeYjaUVk7yT243zT0jzjFKQ==", "cpu": [ "x64" ], @@ -738,9 +738,9 @@ } }, "node_modules/@rolldown/binding-openharmony-arm64": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.5.tgz", - "integrity": "sha512-8SLssA2oweAxyRgDp789ACfRb/3P+zNRJpzZxSizxF9m8NUDQ4+3xjo8ttjhVGGw6Qxb70oZiEtIjaKikCO7Yw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.6.tgz", + "integrity": "sha512-iOo0VEay2XFhaCcH0sps5XIimkSuOnNaZrf6+ZkoSOQBJPKNU48RkmJv0/lSpipexu5P+ouFgafe5IGr/DiQfg==", "cpu": [ "arm64" ], @@ -755,9 +755,9 @@ } }, "node_modules/@rolldown/binding-win32-arm64-msvc": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.5.tgz", - "integrity": "sha512-vGbruD5zquhoc8D9SViXgN2FBJtNdTyQ4DtG+SWiEGlJiAzoKcZ2xp+xuXCffhubVdt0NJlTZqkeRuERy7g8Cw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.6.tgz", + "integrity": "sha512-y5NTmmasMS455JlOCO4ZM9krIchv3Mvm1crL1iUPGOPgEzSkves9n0SdC5Sjz6+qWDFhd8/JpfWMH8NSWNHe+A==", "cpu": [ "arm64" ], @@ -772,9 +772,9 @@ } }, "node_modules/@rolldown/binding-win32-x64-msvc": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.5.tgz", - "integrity": "sha512-e/SXpgISz+IoqVcSSI0rx/d/he8zqLex+/rCWpnHpmVfmPIUjag9H6P7zotf0gJHwPUhQxZ/mF8tr6acebT9yw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.6.tgz", + "integrity": "sha512-np8iZSLfXlAD4kWhiyq/u0Yt8oZDtRQ8lGhQaCXo2rl37KNjeU0GjJuwr4P3oeZ++ROfofsKNBqR5LTO8aXyWQ==", "cpu": [ "x64" ], @@ -828,9 +828,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "26.1.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-26.1.1.tgz", - "integrity": "sha512-nxAkRSVkN1Y0JC1W8ky/fTfkGsMmcrRsbx+3XoZE+rMOX71kLYTV7fLXpqud1GpbpP5TuffXFqfX7fH2GgZREw==", + "version": "26.4.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.4.0.tgz", + "integrity": "sha512-faiGnoIrLH/V8cibOMEAZ8pMw6oXqSukl29ra4mN8GdaB2ZewzeaLj+INpV5N+Z1eKWzY+IzaIZH2EIR6YZRNQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1178,16 +1178,16 @@ } }, "node_modules/@vitest/expect": { - "version": "4.1.10", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.10.tgz", - "integrity": "sha512-YsCn+qAk1GWjQOWFEsEcL2gNQ0zmVmQu3T03qP6UyjhtmdtwtbuI+DASn/7iQB3HGTXkdBwGddzxPlmiql5vlA==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.11.tgz", + "integrity": "sha512-VX2x5vNJXET47KAFzwERI+KRMtTTCSWTfSMKsW7JsUsXV4psq++e3DvZpuTDOpHcxytiDs6p2nhVb2tVDiiUYw==", "dev": true, "license": "MIT", "dependencies": { "@standard-schema/spec": "^1.1.0", "@types/chai": "^5.2.2", - "@vitest/spy": "4.1.10", - "@vitest/utils": "4.1.10", + "@vitest/spy": "4.1.11", + "@vitest/utils": "4.1.11", "chai": "^6.2.2", "tinyrainbow": "^3.1.0" }, @@ -1196,13 +1196,13 @@ } }, "node_modules/@vitest/mocker": { - "version": "4.1.10", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.10.tgz", - "integrity": "sha512-v0xaezt+DKEmKfaxg133ldzADrwLGd7Ze1MfQQTYfvs8OqZIwbxyxaYURivwV7sWy5fqn3rH5uOrSp07bp44Ow==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.11.tgz", + "integrity": "sha512-2XJVD55d1o5AZous5CCGKS74g/riOj9odEt2bQpCVZeblHyHdnMeFl4jl0XjU21stf4mbjUkew2eXQZt65g5CQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "4.1.10", + "@vitest/spy": "4.1.11", "estree-walker": "^3.0.3", "magic-string": "^0.30.21" }, @@ -1223,9 +1223,9 @@ } }, "node_modules/@vitest/pretty-format": { - "version": "4.1.10", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.10.tgz", - "integrity": "sha512-W1HsjSH4MXQ9YfmmhLAoIYf1HRfekQCGngeIgcei6MP5QQGWUe0gkopdZQaVCFO+JDJMrAJGwa5pRpNpvy4P8Q==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.11.tgz", + "integrity": "sha512-yiZzPbGTS9Sr/JpFl8zHrcIkAofNbFV6k21vIgQN/cY/oxZeXhJv5sc/MBJ5jFKWmWs+oJHw0UXLZjmf931+Vw==", "dev": true, "license": "MIT", "dependencies": { @@ -1236,13 +1236,13 @@ } }, "node_modules/@vitest/runner": { - "version": "4.1.10", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.10.tgz", - "integrity": "sha512-IKI6kpIH+LmpROplyLwBBaCfMgOZOMsygVa6BARD6ahA04VRuJSa6OaVG7kRvSEMD870Vd91rSSw0eegtWyLGg==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.11.tgz", + "integrity": "sha512-LztvUgdwMNJMIkj3hQnnxiC2Xy1zNxq928W/xhjCLaNCzqTZOudjwbQf6v9IntZGPw132i2Lq2rgTRZHD3JHNw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "4.1.10", + "@vitest/utils": "4.1.11", "pathe": "^2.0.3" }, "funding": { @@ -1250,14 +1250,14 @@ } }, "node_modules/@vitest/snapshot": { - "version": "4.1.10", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.10.tgz", - "integrity": "sha512-xRkfOT1qpTAi/Ti4Y1LtfRc3kEuqxGw59eN2jN9pRWMtS/XDevekhcFSqvQqjUNGksfjMJu3Y+oJ+4Ypn2OaJw==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.11.tgz", + "integrity": "sha512-pN7ikn1ON7h8ee4gIAp4AzyK+zBtJPzVbqOgu5LCEh4VaJVbPQcgYQYJIMGQPXVeJJq1fnfazis7a5pFNPahog==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "4.1.10", - "@vitest/utils": "4.1.10", + "@vitest/pretty-format": "4.1.11", + "@vitest/utils": "4.1.11", "magic-string": "^0.30.21", "pathe": "^2.0.3" }, @@ -1266,9 +1266,9 @@ } }, "node_modules/@vitest/spy": { - "version": "4.1.10", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.10.tgz", - "integrity": "sha512-PLf/Ugvoq5wO/b4rwYCR1h2PSIdXz7wnkQFMiUpLdtM7l6pqVFcQIBEHyT1+l+cj7mNwAfZHzqXqDyjvOuwbDw==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.11.tgz", + "integrity": "sha512-apNa/prQy2qCeywhnixOHPRCgGNhvg7T4Dapfl1GahLp/R+uhBm5cPyFoNVyqsNd2h1nJxL6BqqdIjiABL60YA==", "dev": true, "license": "MIT", "funding": { @@ -1276,13 +1276,13 @@ } }, "node_modules/@vitest/utils": { - "version": "4.1.10", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.10.tgz", - "integrity": "sha512-fy9am/HWxbaGt/Sawrp90vt6Y6jQwf1RX77cz3uwoJwJVMli/e1IEwRPnMNJ7vKfPTwo0diXifkpPvwH9v7nGA==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.11.tgz", + "integrity": "sha512-zTCVGpyFsGWBhllOyKlTw/vnr6D9qxsfSDyfbyZmTyjHw5N/VuvzHpHoQjm2ZJzn4RJgx5w4r7V0er69CmLgPQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "4.1.10", + "@vitest/pretty-format": "4.1.11", "convert-source-map": "^2.0.0", "tinyrainbow": "^3.1.0" }, @@ -1612,9 +1612,9 @@ } }, "node_modules/esbuild": { - "version": "0.28.1", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz", - "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -1625,32 +1625,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.28.1", - "@esbuild/android-arm": "0.28.1", - "@esbuild/android-arm64": "0.28.1", - "@esbuild/android-x64": "0.28.1", - "@esbuild/darwin-arm64": "0.28.1", - "@esbuild/darwin-x64": "0.28.1", - "@esbuild/freebsd-arm64": "0.28.1", - "@esbuild/freebsd-x64": "0.28.1", - "@esbuild/linux-arm": "0.28.1", - "@esbuild/linux-arm64": "0.28.1", - "@esbuild/linux-ia32": "0.28.1", - "@esbuild/linux-loong64": "0.28.1", - "@esbuild/linux-mips64el": "0.28.1", - "@esbuild/linux-ppc64": "0.28.1", - "@esbuild/linux-riscv64": "0.28.1", - "@esbuild/linux-s390x": "0.28.1", - "@esbuild/linux-x64": "0.28.1", - "@esbuild/netbsd-arm64": "0.28.1", - "@esbuild/netbsd-x64": "0.28.1", - "@esbuild/openbsd-arm64": "0.28.1", - "@esbuild/openbsd-x64": "0.28.1", - "@esbuild/openharmony-arm64": "0.28.1", - "@esbuild/sunos-x64": "0.28.1", - "@esbuild/win32-arm64": "0.28.1", - "@esbuild/win32-ia32": "0.28.1", - "@esbuild/win32-x64": "0.28.1" + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" } }, "node_modules/escape-html": { @@ -2649,13 +2649,13 @@ } }, "node_modules/rolldown": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.5.tgz", - "integrity": "sha512-VD2IE5PUG4Oj8zz2VGykiYd5wbnjdIiSsNQb8Qu5B+noEp+A78mu2iVvpp27g8es14Tk9rofNs5Tku9iQCS4fA==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.6.tgz", + "integrity": "sha512-vMM4q3aixf46GiF1Kok8jDPFsEpXgFWGjUHXNkNHNm+Y2adXAG2dbX91jkti3i0ZRsOlcmbuzAz1poObSHCmUA==", "dev": true, "license": "MIT", "dependencies": { - "@oxc-project/types": "=0.146.0", + "@oxc-project/types": "=0.147.0", "@rolldown/pluginutils": "^1.0.0" }, "bin": { @@ -2665,21 +2665,21 @@ "node": "^20.19.0 || >=22.12.0" }, "optionalDependencies": { - "@rolldown/binding-android-arm-eabi": "1.2.5", - "@rolldown/binding-android-arm64": "1.2.5", - "@rolldown/binding-darwin-arm64": "1.2.5", - "@rolldown/binding-darwin-x64": "1.2.5", - "@rolldown/binding-freebsd-x64": "1.2.5", - "@rolldown/binding-linux-arm-gnueabihf": "1.2.5", - "@rolldown/binding-linux-arm64-gnu": "1.2.5", - "@rolldown/binding-linux-arm64-musl": "1.2.5", - "@rolldown/binding-linux-ppc64-gnu": "1.2.5", - "@rolldown/binding-linux-s390x-gnu": "1.2.5", - "@rolldown/binding-linux-x64-gnu": "1.2.5", - "@rolldown/binding-linux-x64-musl": "1.2.5", - "@rolldown/binding-openharmony-arm64": "1.2.5", - "@rolldown/binding-win32-arm64-msvc": "1.2.5", - "@rolldown/binding-win32-x64-msvc": "1.2.5" + "@rolldown/binding-android-arm-eabi": "1.2.6", + "@rolldown/binding-android-arm64": "1.2.6", + "@rolldown/binding-darwin-arm64": "1.2.6", + "@rolldown/binding-darwin-x64": "1.2.6", + "@rolldown/binding-freebsd-x64": "1.2.6", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.6", + "@rolldown/binding-linux-arm64-gnu": "1.2.6", + "@rolldown/binding-linux-arm64-musl": "1.2.6", + "@rolldown/binding-linux-ppc64-gnu": "1.2.6", + "@rolldown/binding-linux-s390x-gnu": "1.2.6", + "@rolldown/binding-linux-x64-gnu": "1.2.6", + "@rolldown/binding-linux-x64-musl": "1.2.6", + "@rolldown/binding-openharmony-arm64": "1.2.6", + "@rolldown/binding-win32-arm64-msvc": "1.2.6", + "@rolldown/binding-win32-x64-msvc": "1.2.6" } }, "node_modules/router": { @@ -3111,19 +3111,19 @@ } }, "node_modules/vitest": { - "version": "4.1.10", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.10.tgz", - "integrity": "sha512-R9jUTe5S4Qb0HCd4TNqpC7oGcrMssMRGXLW80ubjWsW9VH5GF8y1Y0SFLY9AbqSk6nt0PnOx4H4WNJYZ13GUPw==", + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.11.tgz", + "integrity": "sha512-fhACrNXUidIbGSBr5FlbuBkO7VWC1ZyLl0DO4CU2DrQoAPxX84Ysxs+HeGQpii5lZWV1Q4gBZTTu49mF+A6Edw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/expect": "4.1.10", - "@vitest/mocker": "4.1.10", - "@vitest/pretty-format": "4.1.10", - "@vitest/runner": "4.1.10", - "@vitest/snapshot": "4.1.10", - "@vitest/spy": "4.1.10", - "@vitest/utils": "4.1.10", + "@vitest/expect": "4.1.11", + "@vitest/mocker": "4.1.11", + "@vitest/pretty-format": "4.1.11", + "@vitest/runner": "4.1.11", + "@vitest/snapshot": "4.1.11", + "@vitest/spy": "4.1.11", + "@vitest/utils": "4.1.11", "es-module-lexer": "^2.0.0", "expect-type": "^1.3.0", "magic-string": "^0.30.21", @@ -3151,12 +3151,12 @@ "@edge-runtime/vm": "*", "@opentelemetry/api": "^1.9.0", "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", - "@vitest/browser-playwright": "4.1.10", - "@vitest/browser-preview": "4.1.10", - "@vitest/browser-webdriverio": "4.1.10", - "@vitest/coverage-istanbul": "4.1.10", - "@vitest/coverage-v8": "4.1.10", - "@vitest/ui": "4.1.10", + "@vitest/browser-playwright": "4.1.11", + "@vitest/browser-preview": "4.1.11", + "@vitest/browser-webdriverio": "4.1.11", + "@vitest/coverage-istanbul": "4.1.11", + "@vitest/coverage-v8": "4.1.11", + "@vitest/ui": "4.1.11", "happy-dom": "*", "jsdom": "*", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" @@ -3239,9 +3239,9 @@ "license": "ISC" }, "node_modules/zod": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", - "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.5.4.tgz", + "integrity": "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/package.json b/package.json index 8b4b448..fcde1d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ -{ - "name": "pc-filebridge", - "version": "0.1.1", +{ + "name": "pc-filebridge", + "version": "0.2.1", "description": "Create-only filesystem MCP server for ChatGPT, Codex, and other MCP clients.", "license": "Apache-2.0", "repository": { @@ -23,10 +23,17 @@ ".codex-plugin/", ".mcp.json", "config/", + "deploy/", "mcp/", "scripts/", "skills/", - "docs/", + "docs/IMAGE_SECURITY.md", + "docs/INCIDENT_RESPONSE.md", + "docs/PUBLIC_LAUNCH_READINESS.md", + "docs/RELEASE_PROCESS.md", + "docs/RELEASE_VERIFICATION.md", + "docs/TUNNEL_ROLES.md", + "docs/VPS_DEPLOYMENT.md", "ARCHITECTURE.md", "CHANGELOG.md", "CODE_OF_CONDUCT.md", @@ -39,27 +46,41 @@ "LICENSE", "NOTICE" ], - "type": "module", - "engines": { - "node": ">=22.0.0" - }, - "scripts": { - "build": "esbuild src/server.ts --bundle --platform=node --format=esm --target=node22 --outfile=mcp/server.mjs --banner:js=\"#!/usr/bin/env node\"", - "typecheck": "tsc -p tsconfig.json --noEmit", - "test": "vitest run", + "type": "module", + "engines": { + "node": ">=22.0.0" + }, + "scripts": { + "build": "esbuild src/server.ts --bundle --platform=node --format=esm --target=node22 --outfile=mcp/server.mjs --banner:js=\"#!/usr/bin/env node\"", + "typecheck": "tsc -p tsconfig.json --noEmit", + "test": "vitest run test/filePolicy.test.ts", + "test:windows-8dot3": "vitest run test/windows-8dot3.integration.windows.test.ts", "test:mcp": "node scripts/mcp-smoke.mjs", + "test:versions": "node scripts/version-consistency.mjs", + "test:tunnel-roles": "node scripts/tunnel-role-contract.mjs", + "test:volume-discovery:windows": "powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File scripts/volume-discovery.windows.test.ps1", + "test:volume-discovery:pwsh": "pwsh.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File scripts/volume-discovery.windows.test.ps1", + "test:runtime-rollback:windows": "powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File scripts/runtime-rollback.windows.test.ps1", + "test:crash-window:windows": "powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File scripts/crash-window.windows.test.ps1", + "test:docker-role-config": "node scripts/docker-role-config.test.mjs", + "test:healthcheck": "node scripts/healthcheck-smoke.mjs", + "test:image-gate": "node scripts/image-vulnerability-gate.test.mjs", "check:secrets": "node scripts/secret-scan.mjs", - "verify": "npm run check:secrets && npm run typecheck && npm test && npm run build && npm run test:mcp", + "check:licenses": "node scripts/license-check.mjs", + "check:package": "node scripts/package-contents-check.mjs", + "check:container": "node scripts/container-smoke.mjs", + "check:image-vulnerabilities": "node scripts/image-vulnerability-gate.mjs", + "verify": "npm run check:secrets && npm run typecheck && npm test && npm run build && npm run test:versions && npm run test:mcp && npm run test:tunnel-roles && npm run test:docker-role-config && npm run test:healthcheck && npm run test:image-gate && npm run check:licenses && npm run check:package", "check": "npm run verify" - }, - "dependencies": { - "@modelcontextprotocol/sdk": "1.29.0", - "zod": "4.4.3" - }, - "devDependencies": { - "@types/node": "26.1.1", - "esbuild": "0.28.1", - "typescript": "7.0.2", - "vitest": "4.1.10" - } -} + }, + "dependencies": { + "@modelcontextprotocol/sdk": "1.30.0", + "zod": "4.5.4" + }, + "devDependencies": { + "@types/node": "26.4.0", + "esbuild": "0.28.2", + "typescript": "7.0.2", + "vitest": "4.1.11" + } +} diff --git a/scripts/Approve-PCFileBridgeVolume.ps1 b/scripts/Approve-PCFileBridgeVolume.ps1 new file mode 100644 index 0000000..a59c858 --- /dev/null +++ b/scripts/Approve-PCFileBridgeVolume.ps1 @@ -0,0 +1,51 @@ +[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] +param( + [Parameter(Mandatory = $true)] + [ValidateSet('pc-local', 'laptop-local')] + [string]$Role, + [Parameter(Mandatory = $true)] + [ValidatePattern('^vol-[a-f0-9]{16}$')] + [string]$VolumeId, + [Parameter(Mandatory = $true)] + [ValidateSet('File Backed Virtual', 'USB', 'SD', 'MMC', '1394', 'Removable')] + [string]$BusType, + [Parameter(Mandatory = $true)] + [ValidateLength(4, 160)] + [string]$Reason, + [string]$RegistryPath = '' +) +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' +if ([string]::IsNullOrWhiteSpace($RegistryPath)) { + $RegistryPath = Join-Path $env:LOCALAPPDATA "PCFileBridge\private\volume-approvals.$Role.json" +} +$fullPath = [IO.Path]::GetFullPath($RegistryPath) +$directory = Split-Path -Parent $fullPath +[IO.Directory]::CreateDirectory($directory) | Out-Null +$registry = if (Test-Path -LiteralPath $fullPath -PathType Leaf) { + Get-Content -Raw -LiteralPath $fullPath | ConvertFrom-Json +} else { + [pscustomobject]@{ version = 1; approvals = @() } +} +if ([int]$registry.version -ne 1) { throw 'APPROVAL_REGISTRY_INVALID' } +$items = @($registry.approvals) +if (@($items | Where-Object { [string]$_.volume_id -ceq $VolumeId }).Count -gt 0) { throw 'VOLUME_ALREADY_APPROVED' } +if (-not $PSCmdlet.ShouldProcess("$VolumeId on $Role", "Approve bus type $BusType")) { return } +$items += [ordered]@{ + volume_id = $VolumeId + allowed_bus_types = @($BusType) + reason = $Reason.Trim() + approved_at_utc = (Get-Date).ToUniversalTime().ToString('o') +} +$value = [ordered]@{ version = 1; approvals = @($items | Sort-Object volume_id) } +$temp = Join-Path $directory ('.pcfb-approval-' + [Guid]::NewGuid().ToString('N') + '.tmp') +try { + [IO.File]::WriteAllText($temp, (($value | ConvertTo-Json -Depth 8) + [Environment]::NewLine), (New-Object Text.UTF8Encoding($false))) + $current = [Security.Principal.WindowsIdentity]::GetCurrent() + & icacls.exe $temp /inheritance:r /grant:r ('*' + $current.User.Value + ':(F)') '*S-1-5-18:(F)' | Out-Null + if ($LASTEXITCODE -ne 0) { throw 'APPROVAL_REGISTRY_ACL_FAILED' } + Move-Item -LiteralPath $temp -Destination $fullPath -Force +} finally { + if (Test-Path -LiteralPath $temp) { Remove-Item -LiteralPath $temp -Force } +} +[pscustomobject]@{ role = $Role; volume_id = $VolumeId; bus_type = $BusType; approved = $true; registry_path = $fullPath } diff --git a/scripts/Connect-PCFileBridgeRoleTunnel-Task.ps1 b/scripts/Connect-PCFileBridgeRoleTunnel-Task.ps1 new file mode 100644 index 0000000..66abf5d --- /dev/null +++ b/scripts/Connect-PCFileBridgeRoleTunnel-Task.ps1 @@ -0,0 +1,12 @@ +[CmdletBinding()] +param( + [ValidateSet('pc-local', 'laptop-local')] + [string]$Role = 'pc-local', + [ValidateRange(5, 3600)] + [int]$PollSeconds = 15 +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +& (Join-Path $PSScriptRoot 'Start-PCFileBridgeVolumeMonitor.ps1') -Role $Role -PollSeconds $PollSeconds diff --git a/scripts/Connect-PCFileBridgeRoleTunnel.ps1 b/scripts/Connect-PCFileBridgeRoleTunnel.ps1 new file mode 100644 index 0000000..4c29aac --- /dev/null +++ b/scripts/Connect-PCFileBridgeRoleTunnel.ps1 @@ -0,0 +1,124 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory = $true)] + [ValidateSet('pc-local', 'laptop-local')] + [string]$Role, + [Parameter(Mandatory = $true)] + [ValidatePattern('^tunnel_[A-Za-z0-9_-]{8,}$')] + [string]$TunnelId, + [Parameter(Mandatory = $true)] + [string]$ConfigPath, + [string]$TunnelClientPath = (Join-Path $env:LOCALAPPDATA 'PCFileBridge\bin\tunnel-client.exe'), + [string]$EnvironmentFile = (Join-Path $env:LOCALAPPDATA 'PCFileBridge\private\.env.local'), + [string]$NodePath = '', + [string]$GateFile = '', + [string]$ProfileDirectory = '', + [switch]$EnableFullDrive +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +$pluginRoot = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..') -ErrorAction Stop).Path +$selectedConfig = (Resolve-Path -LiteralPath $ConfigPath -ErrorAction Stop).Path +$validationScript = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot 'Test-PCFileBridgeRoleConfig.ps1') -ErrorAction Stop).Path +$roleValidation = & $validationScript -Role $Role -ConfigPath $selectedConfig +$alias = [string]$roleValidation.alias +$expectedTunnelName = [string]$roleValidation.expectedTunnelName + +if ([bool]$roleValidation.gateRequired) { + if ([string]::IsNullOrWhiteSpace($GateFile)) { + $GateFile = Join-Path $env:LOCALAPPDATA "PCFileBridge\private\$Role.gate" + } + $gatePath = (Resolve-Path -LiteralPath $GateFile -ErrorAction Stop).Path + $gateState = [IO.File]::ReadAllText($gatePath, [Text.Encoding]::UTF8).Trim() + if ($gateState -cne "ARMED:$Role") { throw 'LOCAL_CONNECTOR_LOCKED' } +} + +$tunnelClient = (Resolve-Path -LiteralPath $TunnelClientPath -ErrorAction Stop).Path +$environmentPath = (Resolve-Path -LiteralPath $EnvironmentFile -ErrorAction Stop).Path +Resolve-Path -LiteralPath (Join-Path $pluginRoot 'mcp\server.mjs') -ErrorAction Stop | Out-Null + +if ([bool]$roleValidation.usesDriveRoot -and -not $EnableFullDrive) { + throw 'DRIVE_ROOT_OPT_IN_REQUIRED' +} + +$node = if ([string]::IsNullOrWhiteSpace($NodePath)) { + (Get-Command node -ErrorAction Stop).Source +} else { + (Resolve-Path -LiteralPath $NodePath -ErrorAction Stop).Path +} +if ([string]::IsNullOrWhiteSpace($ProfileDirectory)) { + $ProfileDirectory = Join-Path $env:LOCALAPPDATA "PCFileBridge\tunnel-client\$Role" +} +[IO.Directory]::CreateDirectory([IO.Path]::GetFullPath($ProfileDirectory)) | Out-Null + +$keyEntries = @([IO.File]::ReadAllLines($environmentPath) | Where-Object { $_ -match '^OPENAI_API_KEY=\S+$' }) +if ($keyEntries.Count -ne 1) { throw 'RUNTIME_KEY_INVALID' } +$keyValue = $keyEntries[0].Substring($keyEntries[0].IndexOf('=') + 1) + +$previousLocation = (Get-Location).Path +$previousConfig = [Environment]::GetEnvironmentVariable('FILEBRIDGE_CONFIG', 'Process') +$previousDriveOptIn = [Environment]::GetEnvironmentVariable('FILEBRIDGE_ALLOW_DRIVE_ROOT', 'Process') +$previousRuntimeKey = [Environment]::GetEnvironmentVariable('OPENAI_API_KEY', 'Process') +$previousControlPlaneKey = [Environment]::GetEnvironmentVariable('CONTROL_PLANE_API_KEY', 'Process') +try { + [Environment]::SetEnvironmentVariable('CONTROL_PLANE_API_KEY', $keyValue, 'Process') + $metadata = $null + for ($attempt = 1; $attempt -le 3; $attempt += 1) { + $metadataRaw = @(& $tunnelClient admin --json tunnels get $TunnelId) + if ($LASTEXITCODE -eq 0) { + $metadata = ($metadataRaw -join [Environment]::NewLine) | ConvertFrom-Json + break + } + if ($attempt -lt 3) { Start-Sleep -Seconds 2 } + } + if ($null -eq $metadata) { throw 'TUNNEL_METADATA_UNAVAILABLE' } + if ([string]$metadata.name -cne $expectedTunnelName) { throw 'TUNNEL_ROLE_MISMATCH' } + + Set-Location -LiteralPath $pluginRoot + [Environment]::SetEnvironmentVariable('FILEBRIDGE_CONFIG', $selectedConfig, 'Process') + [Environment]::SetEnvironmentVariable( + 'FILEBRIDGE_ALLOW_DRIVE_ROOT', + $(if ($EnableFullDrive) { 'I_ACCEPT_FULL_DRIVE_ACCESS_RISK' } else { $null }), + 'Process' + ) + [Environment]::SetEnvironmentVariable('OPENAI_API_KEY', $keyValue, 'Process') + $nodeCommand = [IO.Path]::GetFileName($node) + $mcpCommand = '{0} mcp/server.mjs' -f $nodeCommand + $connectRaw = @(& $tunnelClient runtimes connect ` + --alias $alias ` + --profile $alias ` + --profile-dir $ProfileDirectory ` + --tunnel-id $TunnelId ` + --runtime-api-key 'env:OPENAI_API_KEY' ` + --mcp-command $mcpCommand ` + --json) + if ($LASTEXITCODE -ne 0) { throw 'TUNNEL_CONNECT_FAILED' } + $connect = ($connectRaw -join [Environment]::NewLine) | ConvertFrom-Json +} finally { + [Environment]::SetEnvironmentVariable('OPENAI_API_KEY', $previousRuntimeKey, 'Process') + [Environment]::SetEnvironmentVariable('CONTROL_PLANE_API_KEY', $previousControlPlaneKey, 'Process') + [Environment]::SetEnvironmentVariable('FILEBRIDGE_CONFIG', $previousConfig, 'Process') + [Environment]::SetEnvironmentVariable('FILEBRIDGE_ALLOW_DRIVE_ROOT', $previousDriveOptIn, 'Process') + $keyValue = $null + Set-Location -LiteralPath $previousLocation +} + +$statusRaw = @(& $tunnelClient runtimes status $alias --json) +if ($LASTEXITCODE -ne 0) { throw 'TUNNEL_STATUS_FAILED' } +$status = ($statusRaw -join [Environment]::NewLine) | ConvertFrom-Json +$issueCount = @($status.local.issues | Where-Object { $null -ne $_ }).Count +if (-not $status.process_running -or -not $status.healthy -or -not $status.ready) { + throw 'TUNNEL_RUNTIME_NOT_READY' +} +[pscustomobject]@{ + role = $Role + alias = $alias + already_running = [bool]$connect.already_running + process_running = [bool]$status.process_running + healthy = [bool]$status.healthy + ready = [bool]$status.ready + runtime_state = [string]$status.runtime_state + issue_count = $issueCount +} | ConvertTo-Json diff --git a/scripts/Get-PCFileBridgeVolumeCandidates.ps1 b/scripts/Get-PCFileBridgeVolumeCandidates.ps1 new file mode 100644 index 0000000..6cd3386 --- /dev/null +++ b/scripts/Get-PCFileBridgeVolumeCandidates.ps1 @@ -0,0 +1,14 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory = $true)] + [ValidateSet('pc-local', 'laptop-local')] + [string]$Role, + [string]$InventoryPath = '', + [string]$ApprovalRegistryPath = '' +) +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' +$argsMap = @{ Role = $Role; CandidatesOnly = $true } +if (-not [string]::IsNullOrWhiteSpace($InventoryPath)) { $argsMap.InventoryPath = $InventoryPath } +if (-not [string]::IsNullOrWhiteSpace($ApprovalRegistryPath)) { $argsMap.ApprovalRegistryPath = $ApprovalRegistryPath } +& (Join-Path $PSScriptRoot 'Update-PCFileBridgeVolumeConfig.ps1') @argsMap diff --git a/scripts/Revoke-PCFileBridgeVolumeApproval.ps1 b/scripts/Revoke-PCFileBridgeVolumeApproval.ps1 new file mode 100644 index 0000000..250a6ec --- /dev/null +++ b/scripts/Revoke-PCFileBridgeVolumeApproval.ps1 @@ -0,0 +1,35 @@ +[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] +param( + [Parameter(Mandatory = $true)] + [ValidateSet('pc-local', 'laptop-local')] + [string]$Role, + [Parameter(Mandatory = $true)] + [ValidatePattern('^vol-[a-f0-9]{16}$')] + [string]$VolumeId, + [string]$RegistryPath = '' +) +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' +if ([string]::IsNullOrWhiteSpace($RegistryPath)) { + $RegistryPath = Join-Path $env:LOCALAPPDATA "PCFileBridge\private\volume-approvals.$Role.json" +} +$fullPath = (Resolve-Path -LiteralPath $RegistryPath -ErrorAction Stop).Path +$registry = Get-Content -Raw -LiteralPath $fullPath | ConvertFrom-Json +if ([int]$registry.version -ne 1) { throw 'APPROVAL_REGISTRY_INVALID' } +$before = @($registry.approvals) +$after = @($before | Where-Object { [string]$_.volume_id -cne $VolumeId }) +if ($after.Count -eq $before.Count) { throw 'VOLUME_APPROVAL_NOT_FOUND' } +if (-not $PSCmdlet.ShouldProcess("$VolumeId on $Role", 'Revoke volume approval')) { return } +$value = [ordered]@{ version = 1; approvals = $after } +$directory = Split-Path -Parent $fullPath +$temp = Join-Path $directory ('.pcfb-approval-' + [Guid]::NewGuid().ToString('N') + '.tmp') +try { + [IO.File]::WriteAllText($temp, (($value | ConvertTo-Json -Depth 8) + [Environment]::NewLine), (New-Object Text.UTF8Encoding($false))) + $current = [Security.Principal.WindowsIdentity]::GetCurrent() + & icacls.exe $temp /inheritance:r /grant:r ('*' + $current.User.Value + ':(F)') '*S-1-5-18:(F)' | Out-Null + if ($LASTEXITCODE -ne 0) { throw 'APPROVAL_REGISTRY_ACL_FAILED' } + Move-Item -LiteralPath $temp -Destination $fullPath -Force +} finally { + if (Test-Path -LiteralPath $temp) { Remove-Item -LiteralPath $temp -Force } +} +[pscustomobject]@{ role = $Role; volume_id = $VolumeId; revoked = $true; registry_path = $fullPath } diff --git a/scripts/Set-PCFileBridgeGate.ps1 b/scripts/Set-PCFileBridgeGate.ps1 new file mode 100644 index 0000000..e5e317a --- /dev/null +++ b/scripts/Set-PCFileBridgeGate.ps1 @@ -0,0 +1,37 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory = $true)] + [ValidateSet('pc-local', 'laptop-local')] + [string]$Role, + [Parameter(Mandatory = $true)] + [ValidateSet('Armed', 'Locked')] + [string]$State, + [string]$Destination = '' +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +if ([string]::IsNullOrWhiteSpace($Destination)) { + $Destination = Join-Path $env:LOCALAPPDATA "PCFileBridge\private\$Role.gate" +} +$path = [IO.Path]::GetFullPath($Destination) +$directory = [IO.Path]::GetDirectoryName($path) +if ([string]::IsNullOrWhiteSpace($directory)) { throw 'GATE_PATH_INVALID' } +[IO.Directory]::CreateDirectory($directory) | Out-Null + +$account = [Security.Principal.WindowsIdentity]::GetCurrent().Name +& icacls.exe $directory '/inheritance:r' '/grant:r' "${account}:(OI)(CI)(F)" 'SYSTEM:(OI)(CI)(F)' | Out-Null +if ($LASTEXITCODE -ne 0) { throw 'GATE_DIRECTORY_ACL_FAILED' } + +$value = if ($State -ceq 'Armed') { "ARMED:$Role`n" } else { "LOCKED:$Role`n" } +$temp = "$path.tmp" +[IO.File]::WriteAllText($temp, $value, [Text.UTF8Encoding]::new($false)) +Move-Item -LiteralPath $temp -Destination $path -Force +& icacls.exe $path '/inheritance:r' '/grant:r' "${account}:(R,W)" 'SYSTEM:(F)' | Out-Null +if ($LASTEXITCODE -ne 0) { throw 'GATE_FILE_ACL_FAILED' } + +[pscustomobject]@{ + role = $Role + state = $State.ToLowerInvariant() +} | ConvertTo-Json diff --git a/scripts/Start-PCFileBridgeVolumeMonitor.ps1 b/scripts/Start-PCFileBridgeVolumeMonitor.ps1 new file mode 100644 index 0000000..20d4c44 --- /dev/null +++ b/scripts/Start-PCFileBridgeVolumeMonitor.ps1 @@ -0,0 +1,241 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory = $true)] + [ValidateSet('pc-local', 'laptop-local')] + [string]$Role, + [ValidateRange(5, 3600)] + [int]$PollSeconds = 15, + [ValidateRange(1, 10)] + [int]$StableSnapshots = 3, + [string]$InventoryPath = '', + [string]$ConfigPath = '', + [string]$TunnelIdPath = '', + [string]$TunnelClientPath = (Join-Path $env:LOCALAPPDATA 'PCFileBridge\bin\tunnel-client.exe'), + [string]$ConnectScriptPath = '', + [switch]$Once, + [switch]$SkipConnect, + [switch]$SkipMcpProbe +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +$pluginRoot = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..') -ErrorAction Stop).Path +if ([string]::IsNullOrWhiteSpace($ConnectScriptPath)) { $ConnectScriptPath = Join-Path $PSScriptRoot 'Connect-PCFileBridgeRoleTunnel.ps1' } +$resolvedConnectScript = (Resolve-Path -LiteralPath $ConnectScriptPath -ErrorAction Stop).Path +$contract = Get-Content -Raw -LiteralPath (Join-Path $pluginRoot 'config\tunnel-roles.json') | ConvertFrom-Json +$roleContract = @($contract.roles | Where-Object { $_.id -ceq $Role }) +if ($roleContract.Count -ne 1) { throw 'ROLE_CONTRACT_INVALID' } +$alias = [string]$roleContract[0].alias + +$privateRoot = Join-Path $env:LOCALAPPDATA 'PCFileBridge\private' +[IO.Directory]::CreateDirectory($privateRoot) | Out-Null +if ([string]::IsNullOrWhiteSpace($ConfigPath)) { $ConfigPath = Join-Path $privateRoot "roots.$Role.auto.json" } +if ([string]::IsNullOrWhiteSpace($TunnelIdPath)) { $TunnelIdPath = Join-Path $privateRoot "$Role.tunnel-id" } +$ConfigPath = [IO.Path]::GetFullPath($ConfigPath) +$candidateConfigPath = "$ConfigPath.candidate" +$appliedHashPath = Join-Path $privateRoot "roots.$Role.applied.sha256" +$lastGoodConfigPath = Join-Path $privateRoot "roots.$Role.last-good.json" +$lastGoodHashPath = Join-Path $privateRoot "roots.$Role.last-good.sha256" +$rejectedHashPath = Join-Path $privateRoot "roots.$Role.rejected.sha256" +$stableStatePath = Join-Path $privateRoot "roots.$Role.stable-snapshots.json" +$tunnelClient = if ($SkipConnect) { $null } else { (Resolve-Path -LiteralPath $TunnelClientPath -ErrorAction Stop).Path } + +function Set-PrivateStateFile([string]$Path, [string]$Value, [System.Text.Encoding]$Encoding) { + [IO.File]::WriteAllText($Path, $Value, $Encoding) + $current = [Security.Principal.WindowsIdentity]::GetCurrent() + & icacls.exe $Path /inheritance:r /grant:r ('*' + $current.User.Value + ':(F)') '*S-1-5-18:(F)' | Out-Null + if ($LASTEXITCODE -ne 0) { throw 'MONITOR_STATE_ACL_FAILED' } +} + +function Get-FileSha256([string]$Path) { + $algorithm = [Security.Cryptography.SHA256]::Create() + $stream = [IO.File]::OpenRead($Path) + try { return ([BitConverter]::ToString($algorithm.ComputeHash($stream))).Replace('-', '').ToLowerInvariant() } + finally { $stream.Dispose(); $algorithm.Dispose() } +} + +function Get-CombinedHash([string]$ConfigHash, [string]$TopologyHash) { + $algorithm = [Security.Cryptography.SHA256]::Create() + try { + return ([BitConverter]::ToString($algorithm.ComputeHash([Text.Encoding]::ASCII.GetBytes(($ConfigHash + ':' + $TopologyHash))))).Replace('-', '').ToLowerInvariant() + } finally { $algorithm.Dispose() } +} + +function Get-RuntimeStatus { + $raw = @(& $tunnelClient runtimes status $alias --json 2>$null) + if ($LASTEXITCODE -ne 0) { return $null } + try { return (($raw -join [Environment]::NewLine) | ConvertFrom-Json) } catch { return $null } +} + +function Invoke-LocalMcpProbe([string]$Path, [string[]]$ExpectedRoots) { + if ($SkipMcpProbe) { return } + $previousConfig = $env:FILEBRIDGE_CONFIG + $previousRoots = $env:PCFB_EXPECTED_ROOTS + $previousOptIn = $env:FILEBRIDGE_ALLOW_DRIVE_ROOT + try { + $env:FILEBRIDGE_CONFIG = $Path + $env:PCFB_EXPECTED_ROOTS = ($ExpectedRoots | Sort-Object) -join ',' + $env:FILEBRIDGE_ALLOW_DRIVE_ROOT = 'I_ACCEPT_FULL_DRIVE_ACCESS_RISK' + & (Get-Command node -ErrorAction Stop).Source (Join-Path $PSScriptRoot 'mcp-config-smoke.mjs') | Out-Null + if ($LASTEXITCODE -ne 0) { throw 'LOCAL_MCP_SMOKE_FAILED' } + } finally { + $env:FILEBRIDGE_CONFIG = $previousConfig + $env:PCFB_EXPECTED_ROOTS = $previousRoots + $env:FILEBRIDGE_ALLOW_DRIVE_ROOT = $previousOptIn + } +} + +function Invoke-CrashPoint([string]$Name) { + if ($env:PCFB_TEST_CRASH_AT -ceq $Name) { throw "SIMULATED_CRASH_$Name" } +} + +$mutexAlgorithm = [Security.Cryptography.SHA256]::Create() +try { + $mutexScope = ([BitConverter]::ToString($mutexAlgorithm.ComputeHash([Text.Encoding]::UTF8.GetBytes($privateRoot.ToLowerInvariant())))).Replace('-', '').Substring(0, 12) +} finally { + $mutexAlgorithm.Dispose() +} +$mutexName = "Local\PCFileBridgeVolumeMonitor-$Role-$mutexScope" +$mutex = New-Object Threading.Mutex($false, $mutexName) +$ownsMutex = $false +try { + try { $ownsMutex = $mutex.WaitOne(0) } catch [Threading.AbandonedMutexException] { $ownsMutex = $true } + if (-not $ownsMutex) { + [pscustomobject]@{ role = $Role; monitor = 'already_running' } + exit 0 + } + + while ($true) { + try { + $updateArgs = @{ Role = $Role; OutputPath = $candidateConfigPath } + if (-not [string]::IsNullOrWhiteSpace($InventoryPath)) { $updateArgs.InventoryPath = $InventoryPath } + $update = & (Join-Path $PSScriptRoot 'Update-PCFileBridgeVolumeConfig.ps1') @updateArgs + $candidatePath = (Resolve-Path -LiteralPath ([string]$update.config_path) -ErrorAction Stop).Path + Invoke-CrashPoint 'candidate_written' + + $stable = if (Test-Path -LiteralPath $stableStatePath -PathType Leaf) { + try { Get-Content -Raw -LiteralPath $stableStatePath | ConvertFrom-Json } catch { $null } + } else { $null } + $topologyHash = [string]$update.topology_sha256 + $stableCount = if ($null -ne $stable -and [string]$stable.topology_sha256 -ceq $topologyHash) { [int]$stable.count + 1 } else { 1 } + Set-PrivateStateFile -Path $stableStatePath -Value (([ordered]@{ topology_sha256 = $topologyHash; count = $stableCount } | ConvertTo-Json -Compress) + [Environment]::NewLine) -Encoding ([Text.Encoding]::ASCII) + if ($stableCount -lt $StableSnapshots) { + [pscustomobject]@{ + role = $Role + changed = [bool]$update.changed + fixed_volume_count = [int]$update.fixed_volume_count + root_ids = @($update.root_ids) + stable_snapshot_count = $stableCount + runtime_action = 'stabilizing' + } + if ($Once) { break } + Start-Sleep -Seconds $PollSeconds + continue + } + + if ($SkipConnect) { + [pscustomobject]@{ + role = $Role + changed = [bool]$update.changed + fixed_volume_count = [int]$update.fixed_volume_count + root_ids = @($update.root_ids) + stable_snapshot_count = $stableCount + runtime_action = 'skipped' + } + if ($Once) { break } + Start-Sleep -Seconds $PollSeconds + continue + } + + $candidateHash = Get-CombinedHash -ConfigHash (Get-FileSha256 $candidatePath) -TopologyHash $topologyHash + $appliedHash = if (Test-Path -LiteralPath $appliedHashPath -PathType Leaf) { [IO.File]::ReadAllText($appliedHashPath).Trim().ToLowerInvariant() } else { '' } + $lastGoodHash = if (Test-Path -LiteralPath $lastGoodHashPath -PathType Leaf) { [IO.File]::ReadAllText($lastGoodHashPath).Trim().ToLowerInvariant() } else { '' } + $rejectedHash = if (Test-Path -LiteralPath $rejectedHashPath -PathType Leaf) { [IO.File]::ReadAllText($rejectedHashPath).Trim().ToLowerInvariant() } else { '' } + $status = Get-RuntimeStatus + $runtimeReady = $null -ne $status -and [bool]$status.process_running -and [bool]$status.healthy -and [bool]$status.ready + $runtimeAction = 'none' + $rollbackApplied = $false + + if ($rejectedHash -ceq $candidateHash -and -not [string]::IsNullOrWhiteSpace($rejectedHash)) { + if (-not $runtimeReady -and (Test-Path -LiteralPath $lastGoodConfigPath -PathType Leaf)) { + Copy-Item -LiteralPath $lastGoodConfigPath -Destination $ConfigPath -Force + $tunnelId = [IO.File]::ReadAllText((Resolve-Path -LiteralPath $TunnelIdPath -ErrorAction Stop).Path).Trim() + & $resolvedConnectScript -Role $Role -TunnelId $tunnelId -ConfigPath $ConfigPath -EnableFullDrive | Out-Null + Invoke-LocalMcpProbe -Path $ConfigPath -ExpectedRoots @((Get-Content -Raw -LiteralPath $ConfigPath | ConvertFrom-Json).roots.id) + $runtimeReady = $true + } + $runtimeAction = 'rejected_skipped_lkg_active' + } elseif ($appliedHash -ceq $candidateHash -and $runtimeReady -and (Test-Path -LiteralPath $ConfigPath -PathType Leaf)) { + Invoke-LocalMcpProbe -Path $ConfigPath -ExpectedRoots @($update.root_ids) + if ($lastGoodHash -cne $candidateHash) { + Copy-Item -LiteralPath $ConfigPath -Destination $lastGoodConfigPath -Force + Set-PrivateStateFile -Path $lastGoodConfigPath -Value ([IO.File]::ReadAllText($lastGoodConfigPath, [Text.Encoding]::UTF8)) -Encoding (New-Object Text.UTF8Encoding($false)) + Set-PrivateStateFile -Path $lastGoodHashPath -Value ($candidateHash + [Environment]::NewLine) -Encoding ([Text.Encoding]::ASCII) + $runtimeAction = 'crash_recovered_lkg_promoted' + } + } else { + if ($null -ne $status -and [bool]$status.process_running) { + & $tunnelClient runtimes stop $alias --json | Out-Null + if ($LASTEXITCODE -ne 0) { throw 'TUNNEL_STOP_FAILED' } + Invoke-CrashPoint 'after_stop' + } + Copy-Item -LiteralPath $candidatePath -Destination $ConfigPath -Force + $tunnelId = [IO.File]::ReadAllText((Resolve-Path -LiteralPath $TunnelIdPath -ErrorAction Stop).Path).Trim() + if ($tunnelId -cnotmatch '^tunnel_[A-Za-z0-9_-]{8,}$') { throw 'TUNNEL_ID_INVALID' } + try { + & $resolvedConnectScript -Role $Role -TunnelId $tunnelId -ConfigPath $ConfigPath -EnableFullDrive | Out-Null + Invoke-CrashPoint 'after_candidate_start' + Invoke-LocalMcpProbe -Path $ConfigPath -ExpectedRoots @($update.root_ids) + $postStatus = Get-RuntimeStatus + if ($null -eq $postStatus -or -not [bool]$postStatus.process_running -or -not [bool]$postStatus.healthy -or -not [bool]$postStatus.ready) { throw 'TUNNEL_RUNTIME_NOT_READY' } + Invoke-CrashPoint 'before_applied_hash' + Set-PrivateStateFile -Path $appliedHashPath -Value ($candidateHash + [Environment]::NewLine) -Encoding ([Text.Encoding]::ASCII) + Invoke-CrashPoint 'after_applied_hash' + Invoke-CrashPoint 'before_lkg_promotion' + Copy-Item -LiteralPath $ConfigPath -Destination $lastGoodConfigPath -Force + Set-PrivateStateFile -Path $lastGoodConfigPath -Value ([IO.File]::ReadAllText($lastGoodConfigPath, [Text.Encoding]::UTF8)) -Encoding (New-Object Text.UTF8Encoding($false)) + Set-PrivateStateFile -Path $lastGoodHashPath -Value ($candidateHash + [Environment]::NewLine) -Encoding ([Text.Encoding]::ASCII) + if (Test-Path -LiteralPath $rejectedHashPath) { Remove-Item -LiteralPath $rejectedHashPath -Force } + $runtimeAction = 'candidate_promoted' + $runtimeReady = $true + } catch { + if ($_.Exception.Message -like 'SIMULATED_CRASH_*') { throw } + if (-not (Test-Path -LiteralPath $lastGoodConfigPath -PathType Leaf) -or -not (Test-Path -LiteralPath $lastGoodHashPath -PathType Leaf)) { throw 'RUNTIME_ROLLBACK_UNAVAILABLE' } + & $tunnelClient runtimes stop $alias --json 2>$null | Out-Null + Copy-Item -LiteralPath $lastGoodConfigPath -Destination $ConfigPath -Force + $lastGoodHash = [IO.File]::ReadAllText($lastGoodHashPath).Trim().ToLowerInvariant() + & $resolvedConnectScript -Role $Role -TunnelId $tunnelId -ConfigPath $ConfigPath -EnableFullDrive | Out-Null + $lkgRoots = @((Get-Content -Raw -LiteralPath $ConfigPath | ConvertFrom-Json).roots.id) + Invoke-LocalMcpProbe -Path $ConfigPath -ExpectedRoots $lkgRoots + Set-PrivateStateFile -Path $appliedHashPath -Value ($lastGoodHash + [Environment]::NewLine) -Encoding ([Text.Encoding]::ASCII) + Set-PrivateStateFile -Path $rejectedHashPath -Value ($candidateHash + [Environment]::NewLine) -Encoding ([Text.Encoding]::ASCII) + $runtimeAction = 'candidate_failed_rolled_back' + $runtimeReady = $true + $rollbackApplied = $true + } finally { $tunnelId = $null } + } + + [pscustomobject]@{ + role = $Role + changed = [bool]$update.changed + fixed_volume_count = [int]$update.fixed_volume_count + blocked_volume_count = [int]$update.blocked_volume_count + root_ids = @($update.root_ids) + stable_snapshot_count = $stableCount + runtime_action = $runtimeAction + runtime_ready = $runtimeReady + rollback_applied = $rollbackApplied + } + } catch { + if ($Once) { throw } + Write-Error -ErrorAction Continue -Message ('PC_FILEBRIDGE_VOLUME_MONITOR_RETRY: ' + $_.Exception.Message) + } + + if ($Once) { break } + Start-Sleep -Seconds $PollSeconds + } +} finally { + if ($ownsMutex) { $mutex.ReleaseMutex() } + $mutex.Dispose() +} diff --git a/scripts/Test-PCFileBridgeRoleConfig.ps1 b/scripts/Test-PCFileBridgeRoleConfig.ps1 new file mode 100644 index 0000000..e61c301 --- /dev/null +++ b/scripts/Test-PCFileBridgeRoleConfig.ps1 @@ -0,0 +1,99 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory = $true)] + [ValidateSet('pc-local', 'laptop-local')] + [string]$Role, + [Parameter(Mandatory = $true)] + [string]$ConfigPath, + [string]$ContractPath = '' +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +if ([string]::IsNullOrWhiteSpace($ContractPath)) { + $ContractPath = Join-Path $PSScriptRoot '..\config\tunnel-roles.json' +} +$resolvedContract = (Resolve-Path -LiteralPath $ContractPath -ErrorAction Stop).Path +$resolvedConfig = (Resolve-Path -LiteralPath $ConfigPath -ErrorAction Stop).Path +$contract = Get-Content -Raw -LiteralPath $resolvedContract | ConvertFrom-Json +$config = Get-Content -Raw -LiteralPath $resolvedConfig | ConvertFrom-Json +$roleContract = @($contract.roles | Where-Object { $_.id -ceq $Role }) +if ($roleContract.Count -ne 1) { throw 'ROLE_CONTRACT_INVALID' } +$roleContract = $roleContract[0] + +$roots = @($config.roots) +if ($roots.Count -lt 1 -or $roots.Count -gt 26) { throw 'ROOT_ROLE_MISMATCH' } +$configuredIds = @($roots | ForEach-Object { [string]$_.id }) +if (@($configuredIds | Sort-Object -Unique).Count -ne $configuredIds.Count) { + throw 'ROOT_ROLE_MISMATCH' +} + +$allowedIds = @($roleContract.rootIds | ForEach-Object { [string]$_ }) +$requiredIds = @($roleContract.requiredRootIds | ForEach-Object { [string]$_ }) +$discoveryProperty = $roleContract.PSObject.Properties['volumeDiscovery'] +$discoveryEnabled = $null -ne $discoveryProperty -and [bool]$discoveryProperty.Value.enabled +$prefix = if ($discoveryEnabled) { [string]$discoveryProperty.Value.rootIdPrefix } else { '' } +if ($discoveryEnabled) { + if ($prefix -cnotmatch '^[a-z][a-z0-9-]{0,29}-$') { throw 'ROLE_CONTRACT_INVALID' } + if ([int]$discoveryProperty.Value.driveType -ne 3) { throw 'ROLE_CONTRACT_INVALID' } +} + +foreach ($entry in $roots) { + $id = [string]$entry.id + $rawPath = [string]$entry.path + if (-not [bool]$entry.read -or -not [bool]$entry.create) { throw 'ROOT_ROLE_MISMATCH' } + if ($rawPath -cnotmatch '^(?[A-Za-z]):\\$') { throw 'ROOT_ROLE_MISMATCH' } + $driveLetter = $Matches.letter.ToLowerInvariant() + $metadataPresent = $null -ne $entry.PSObject.Properties['volume_id'] + if ($metadataPresent) { + if ( + [string]$entry.host_id -cne [string]$roleContract.hostId -or + [string]$entry.volume_id -cnotmatch '^vol-[a-f0-9]{16}$' -or + [string]$entry.current_drive_letter -cne $driveLetter.ToUpperInvariant() -or + [string]$entry.filesystem -cne 'NTFS' -or + [string]::IsNullOrWhiteSpace([string]$entry.bus_type) -or + -not [bool]$entry.online -or + -not [bool]$entry.auto_discovered + ) { + throw 'ROOT_METADATA_INVALID' + } + } + + $staticPathProperty = $roleContract.rootPaths.PSObject.Properties[$id] + if ($allowedIds -ccontains $id -and $null -ne $staticPathProperty) { + $expectedPath = [string]$staticPathProperty.Value + if (-not [string]::Equals($rawPath, $expectedPath, [StringComparison]::OrdinalIgnoreCase)) { + throw 'ROOT_ROLE_MISMATCH' + } + continue + } + + if (-not $discoveryEnabled) { throw 'ROOT_ROLE_MISMATCH' } + $escapedPrefix = [Regex]::Escape($prefix) + if ($id -cnotmatch "^$escapedPrefix(?[a-z])$") { throw 'ROOT_ROLE_MISMATCH' } + if ($Matches.suffix -cne $driveLetter) { throw 'ROOT_ROLE_MISMATCH' } +} + +foreach ($requiredId in $requiredIds) { + if ($configuredIds -cnotcontains $requiredId) { throw 'ROOT_ROLE_MISMATCH' } +} + +$expectedOrder = if ($discoveryEnabled) { + @($configuredIds | Sort-Object) +} else { + @($allowedIds | Where-Object { $configuredIds -ccontains $_ }) +} +if (($configuredIds -join [char]0) -cne ($expectedOrder -join [char]0)) { + throw 'ROOT_ROLE_MISMATCH' +} + +[pscustomobject]@{ + role = $Role + alias = [string]$roleContract.alias + expectedTunnelName = [string]$roleContract.expectedTunnelName + gateRequired = [bool]$roleContract.gateRequired + configuredIds = $configuredIds + usesDriveRoot = $true + discoveryEnabled = $discoveryEnabled +} diff --git a/scripts/Update-PCFileBridgeVolumeConfig.ps1 b/scripts/Update-PCFileBridgeVolumeConfig.ps1 new file mode 100644 index 0000000..5eff6cd --- /dev/null +++ b/scripts/Update-PCFileBridgeVolumeConfig.ps1 @@ -0,0 +1,275 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory = $true)] + [ValidateSet('pc-local', 'laptop-local')] + [string]$Role, + [string]$OutputPath = '', + [string]$InventoryPath = '', + [string]$TemplatePath = '', + [string]$ContractPath = '', + [string]$HostId = '', + [string]$ApprovalRegistryPath = '', + [switch]$CandidatesOnly +) + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +function Get-Sha256([string]$Value) { + $algorithm = [Security.Cryptography.SHA256]::Create() + try { + $bytes = [Text.Encoding]::UTF8.GetBytes($Value) + return ([BitConverter]::ToString($algorithm.ComputeHash($bytes))).Replace('-', '').ToLowerInvariant() + } finally { $algorithm.Dispose() } +} + +function Normalize-Identifier([object]$Value) { + if ($null -eq $Value) { return '' } + return (([string]$Value).Trim() -replace '\s+', '').ToLowerInvariant() +} + +function Set-PrivateFileAcl([string]$Path) { + $current = [System.Security.Principal.WindowsIdentity]::GetCurrent() + & icacls.exe $Path /inheritance:r /grant:r ('*' + $current.User.Value + ':(F)') '*S-1-5-18:(F)' | Out-Null + if ($LASTEXITCODE -ne 0) { throw 'PRIVATE_FILE_ACL_FAILED' } +} + +function Test-PrivateFileAcl([string]$Path) { + $fileInfo = New-Object IO.FileInfo($Path) + $acl = if ($PSVersionTable.PSEdition -ceq 'Core') { + [System.IO.FileSystemAclExtensions]::GetAccessControl($fileInfo) + } else { + $fileInfo.GetAccessControl() + } + if (-not $acl.AreAccessRulesProtected) { throw 'APPROVAL_REGISTRY_ACL_INVALID' } + $allowedSids = @([Security.Principal.WindowsIdentity]::GetCurrent().User.Value, 'S-1-5-18') + $rules = $acl.GetAccessRules($true, $true, [Security.Principal.SecurityIdentifier]) + foreach ($rule in @($rules)) { + $sid = $rule.IdentityReference.Value + if ($rule.AccessControlType -eq 'Allow' -and $allowedSids -notcontains $sid) { + throw 'APPROVAL_REGISTRY_ACL_INVALID' + } + } +} + +$pluginRoot = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..') -ErrorAction Stop).Path +if ([string]::IsNullOrWhiteSpace($ContractPath)) { $ContractPath = Join-Path $pluginRoot 'config\tunnel-roles.json' } +$resolvedContract = (Resolve-Path -LiteralPath $ContractPath -ErrorAction Stop).Path +$contract = Get-Content -Raw -LiteralPath $resolvedContract | ConvertFrom-Json +$roleContract = @($contract.roles | Where-Object { $_.id -ceq $Role }) +if ($roleContract.Count -ne 1) { throw 'ROLE_CONTRACT_INVALID' } +$roleContract = $roleContract[0] +$discoveryProperty = $roleContract.PSObject.Properties['volumeDiscovery'] +if ($null -eq $discoveryProperty -or -not [bool]$discoveryProperty.Value.enabled) { throw 'VOLUME_DISCOVERY_DISABLED' } +$driveType = [int]$discoveryProperty.Value.driveType +$rootIdPrefix = [string]$discoveryProperty.Value.rootIdPrefix +$allowedBusTypes = @($discoveryProperty.Value.allowedBusTypes | ForEach-Object { ([string]$_).Trim() }) +$allowedFileSystems = @($discoveryProperty.Value.allowedFileSystems | ForEach-Object { ([string]$_).Trim() }) +$requireHealthy = [bool]$discoveryProperty.Value.requireHealthy +if ([string]::IsNullOrWhiteSpace($HostId)) { $HostId = [string]$roleContract.hostId } +$HostId = $HostId.Trim().ToLowerInvariant() +if ($driveType -ne 3 -or $rootIdPrefix -cnotmatch '^[a-z][a-z0-9-]{0,29}-$' -or $HostId -cnotmatch '^[a-z][a-z0-9-]{0,63}$' -or $allowedBusTypes.Count -lt 1 -or ($allowedFileSystems -join ',') -cne 'NTFS') { + throw 'ROLE_CONTRACT_INVALID' +} + +if ([string]::IsNullOrWhiteSpace($TemplatePath)) { + $templateName = if ($Role -ceq 'pc-local') { 'roots.pc.example.json' } else { 'roots.laptop.example.json' } + $TemplatePath = Join-Path $pluginRoot "config\$templateName" +} +$resolvedTemplate = (Resolve-Path -LiteralPath $TemplatePath -ErrorAction Stop).Path +$template = Get-Content -Raw -LiteralPath $resolvedTemplate | ConvertFrom-Json + +$privateRoot = Join-Path $env:LOCALAPPDATA 'PCFileBridge\private' +[IO.Directory]::CreateDirectory($privateRoot) | Out-Null +if ([string]::IsNullOrWhiteSpace($OutputPath)) { $OutputPath = Join-Path $privateRoot "roots.$Role.auto.json" } +if ([string]::IsNullOrWhiteSpace($ApprovalRegistryPath)) { $ApprovalRegistryPath = Join-Path $privateRoot "volume-approvals.$Role.json" } +$outputFullPath = [IO.Path]::GetFullPath($OutputPath) +$outputDirectory = Split-Path -Parent $outputFullPath +[IO.Directory]::CreateDirectory($outputDirectory) | Out-Null +$approvalFullPath = [IO.Path]::GetFullPath($ApprovalRegistryPath) + +$approvals = @{} +if (Test-Path -LiteralPath $approvalFullPath -PathType Leaf) { + Test-PrivateFileAcl -Path $approvalFullPath + $registry = Get-Content -Raw -LiteralPath $approvalFullPath | ConvertFrom-Json + if ([int]$registry.version -ne 1) { throw 'APPROVAL_REGISTRY_INVALID' } + foreach ($approval in @($registry.approvals)) { + $approvedId = ([string]$approval.volume_id).Trim().ToLowerInvariant() + if ($approvedId -cnotmatch '^vol-[a-f0-9]{16}$' -or $approvals.ContainsKey($approvedId)) { throw 'APPROVAL_REGISTRY_INVALID' } + $approvedBuses = @($approval.allowed_bus_types | ForEach-Object { ([string]$_).Trim() }) + if ($approvedBuses.Count -lt 1) { throw 'APPROVAL_REGISTRY_INVALID' } + $approvals[$approvedId] = $approvedBuses + } +} + +$fixtureMode = -not [string]::IsNullOrWhiteSpace($InventoryPath) +if ($fixtureMode) { + $resolvedInventory = (Resolve-Path -LiteralPath $InventoryPath -ErrorAction Stop).Path + $inventoryValue = Get-Content -Raw -LiteralPath $resolvedInventory | ConvertFrom-Json + $volumesProperty = $inventoryValue.PSObject.Properties['volumes'] + $volumes = if ($null -ne $volumesProperty) { @($volumesProperty.Value) } else { @($inventoryValue) } +} else { + $volumes = @() + foreach ($logical in @(Get-CimInstance -ClassName Win32_LogicalDisk -ErrorAction Stop)) { + $deviceId = ([string]$logical.DeviceID).Trim().ToUpperInvariant() + if ($deviceId -cnotmatch '^(?[A-Z]):$') { continue } + $letter = $Matches.letter + try { + $partition = @(Get-Partition -DriveLetter $letter -ErrorAction Stop) + if ($partition.Count -ne 1) { continue } + $disk = Get-Disk -Number $partition[0].DiskNumber -ErrorAction Stop + $volume = Get-Volume -DriveLetter $letter -ErrorAction Stop + $volumes += [pscustomobject]@{ + DeviceID = $deviceId + DriveType = [int]$logical.DriveType + VolumeName = [string]$logical.VolumeName + VolumeSerialNumber = [string]$logical.VolumeSerialNumber + FileSystem = [string]$volume.FileSystem + HealthStatus = [string]$volume.HealthStatus + BusType = [string]$disk.BusType + DiskUniqueId = [string]$disk.UniqueId + PartitionUniqueId = [string]$partition[0].UniqueId + VolumeUniqueId = [string]$volume.UniqueId + Online = -not [bool]$disk.IsOffline + } + } catch { continue } + } +} + +$normalized = @() +$candidates = @() +$blockedCount = 0 +$identityOwners = @{} +$hardBlockedBusTypes = @('Network', 'Optical', 'Unknown') +foreach ($volume in $volumes) { + $deviceId = ([string]$volume.DeviceID).Trim().ToUpperInvariant() + if ($deviceId -cnotmatch '^(?[A-Z]):$') { throw 'VOLUME_INVENTORY_INVALID' } + $letter = $Matches.letter + $rootPath = "${letter}:\" + $itemDriveType = [int]$volume.DriveType + $busType = ([string]$volume.BusType).Trim() + $fileSystem = ([string]$volume.FileSystem).Trim() + $healthStatus = ([string]$volume.HealthStatus).Trim() + $onlineProperty = $volume.PSObject.Properties['Online'] + $online = if ($null -eq $onlineProperty) { $true } else { [bool]$onlineProperty.Value } + $identityParts = @( + (Normalize-Identifier $volume.DiskUniqueId), + (Normalize-Identifier $volume.PartitionUniqueId), + (Normalize-Identifier $volume.VolumeUniqueId), + (Normalize-Identifier $volume.VolumeSerialNumber) + ) + $identityAvailable = @($identityParts | Where-Object { [string]::IsNullOrWhiteSpace($_) }).Count -eq 0 + $volumeId = '' + if ($identityAvailable) { + $identityMaterial = @('pcfb-volume-id-v1', $HostId) + $identityParts + $volumeId = 'vol-' + (Get-Sha256 -Value ($identityMaterial -join [char]0)).Substring(0, 16) + if ($identityOwners.ContainsKey($volumeId)) { throw 'VOLUME_IDENTITY_COLLISION' } + $identityOwners[$volumeId] = $letter + } + + $approved = -not [string]::IsNullOrWhiteSpace($volumeId) -and $approvals.ContainsKey($volumeId) -and @($approvals[$volumeId]) -contains $busType + $reason = 'ELIGIBLE' + if ($itemDriveType -ne $driveType) { $reason = 'DRIVE_TYPE_BLOCKED' } + elseif (-not $online) { $reason = 'VOLUME_OFFLINE' } + elseif (-not $identityAvailable) { $reason = 'VOLUME_IDENTITY_UNAVAILABLE' } + elseif ($allowedFileSystems -notcontains $fileSystem) { $reason = 'UNSUPPORTED_FILESYSTEM' } + elseif ($requireHealthy -and $healthStatus -cne 'Healthy') { $reason = 'VOLUME_UNHEALTHY' } + elseif ($hardBlockedBusTypes -contains $busType) { $reason = 'BUS_TYPE_BLOCKED' } + elseif ($allowedBusTypes -notcontains $busType -and -not $approved) { $reason = 'OPERATOR_APPROVAL_REQUIRED' } + elseif (-not $fixtureMode -and -not (Test-Path -LiteralPath $rootPath -PathType Container)) { $reason = 'VOLUME_OFFLINE' } + + $eligible = $reason -ceq 'ELIGIBLE' + $candidates += [pscustomobject]@{ + root_id = "$rootIdPrefix$($letter.ToLowerInvariant())" + volume_id = $volumeId + current_drive_letter = $letter + filesystem = $fileSystem + bus_type = $busType + health = $healthStatus + online = $online + approved = $approved + eligible = $eligible + reason = $reason + } + if (-not $eligible) { $blockedCount += 1; continue } + if (@($normalized | Where-Object { $_.letter -ceq $letter }).Count -gt 0) { throw 'VOLUME_INVENTORY_INVALID' } + $volumeName = ([string]$volume.VolumeName).Trim() + if ($volumeName.Length -gt 40 -or $volumeName -cnotmatch '^[\p{L}\p{N} _.-]*$') { $volumeName = '' } + $normalized += [pscustomobject]@{ + letter = $letter + rootPath = $rootPath + volumeName = $volumeName + busType = $busType + fileSystem = $fileSystem + healthStatus = $healthStatus + volumeId = $volumeId + approved = $approved + } +} + +if ($CandidatesOnly) { + [pscustomobject]@{ role = $Role; host_id = $HostId; candidates = @($candidates | Sort-Object current_drive_letter) } + exit 0 +} + +$normalized = @($normalized | Sort-Object letter) +if ($normalized.Count -lt 1 -or $normalized.Count -gt 26) { throw 'VOLUME_INVENTORY_INVALID' } + +$deviceLabel = if ($Role -ceq 'pc-local') { 'Main PC' } else { 'Laptop' } +$roots = @($normalized | ForEach-Object { + $suffix = $_.letter.ToLowerInvariant() + $labelSuffix = if ([string]::IsNullOrWhiteSpace($_.volumeName)) { '' } else { " - $($_.volumeName)" } + [ordered]@{ + id = "$rootIdPrefix$suffix" + label = "$deviceLabel $($_.letter) drive$labelSuffix" + path = $_.rootPath + read = $true + create = $true + host_id = $HostId + volume_id = $_.volumeId + current_drive_letter = $_.letter + filesystem = $_.fileSystem + bus_type = $_.busType + online = $true + auto_discovered = $true + } +}) +$config = [ordered]@{ version = 1; roots = $roots; limits = $template.limits } +$json = ($config | ConvertTo-Json -Depth 8) + [Environment]::NewLine +$encoding = New-Object Text.UTF8Encoding($false) +$tempPath = Join-Path $outputDirectory ('.pc-filebridge-roots-' + [Guid]::NewGuid().ToString('N') + '.tmp') + +$changed = $true +if (Test-Path -LiteralPath $outputFullPath -PathType Leaf) { + $existing = [IO.File]::ReadAllText($outputFullPath, [Text.Encoding]::UTF8) + $changed = $existing -cne $json +} +if ($changed) { + try { + [IO.File]::WriteAllText($tempPath, $json, $encoding) + & (Join-Path $PSScriptRoot 'Test-PCFileBridgeRoleConfig.ps1') -Role $Role -ConfigPath $tempPath -ContractPath $resolvedContract | Out-Null + Set-PrivateFileAcl -Path $tempPath + Move-Item -LiteralPath $tempPath -Destination $outputFullPath -Force + } finally { + if (Test-Path -LiteralPath $tempPath) { Remove-Item -LiteralPath $tempPath -Force } + } +} else { + & (Join-Path $PSScriptRoot 'Test-PCFileBridgeRoleConfig.ps1') -Role $Role -ConfigPath $outputFullPath -ContractPath $resolvedContract | Out-Null + Set-PrivateFileAcl -Path $outputFullPath +} + +$topologyMaterial = @($normalized | ForEach-Object { + @($_.volumeId, $_.letter, $_.busType, $_.fileSystem, $_.healthStatus, 'online', $(if ($_.approved) { 'approved' } else { 'automatic' })) -join [char]0 +}) -join [char]0x1e + +[pscustomobject]@{ + role = $Role + host_id = $HostId + changed = $changed + fixed_volume_count = $roots.Count + blocked_volume_count = $blockedCount + root_ids = @($roots | ForEach-Object { [string]$_.id }) + volume_ids = @($roots | ForEach-Object { [string]$_.volume_id }) + config_path = $outputFullPath + topology_sha256 = Get-Sha256 -Value $topologyMaterial +} diff --git a/scripts/container-smoke.mjs b/scripts/container-smoke.mjs new file mode 100644 index 0000000..3f05ad3 --- /dev/null +++ b/scripts/container-smoke.mjs @@ -0,0 +1,133 @@ +#!/usr/bin/env node + +import { execFileSync } from "node:child_process"; +import { Client } from "@modelcontextprotocol/sdk/client/index.js"; +import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; + +const image = process.env.FILEBRIDGE_IMAGE ?? "pc-filebridge:0.2.1"; +const expectedTunnelVersion = "0.0.13"; +const expectedNodeVersion = "v24.20.0"; +const expectedTools = [ + "create_directory", + "create_text_file", + "list_directory", + "list_roots", + "read_text_file", + "search_file_names", + "stat_path", +]; + +const imageConfig = JSON.parse(execFileSync("docker", ["image", "inspect", image], { encoding: "utf8" }))[0]?.Config; +if (!imageConfig) throw new Error("Docker image configuration was unavailable."); +if (imageConfig.User !== "10001:10001") { + throw new Error(`Unexpected image user: ${imageConfig.User}`); +} +const environment = new Set(imageConfig.Env ?? []); +if (!environment.has("LOG_LEVEL=warn")) { + throw new Error("Container image does not default to warning-only tunnel logs."); +} +if (!environment.has("FILEBRIDGE_ROLE=infrastructure")) { + throw new Error("Container image is not pinned to the infrastructure role."); +} +if (!environment.has("EXPECTED_TUNNEL_NAME=PC FileBridge - Infrastructure")) { + throw new Error("Container image does not enforce the infrastructure tunnel name."); +} +const healthTest = imageConfig.Healthcheck?.Test ?? []; +if (!healthTest.includes("/usr/local/lib/pc-filebridge/healthcheck.mjs")) { + throw new Error(`Container healthcheck is not tunnel-aware: ${JSON.stringify(healthTest)}`); +} + +const nodeVersion = execFileSync("docker", ["run", "--rm", "--entrypoint", "node", image, "--version"], { + encoding: "utf8", +}).trim(); +if (nodeVersion !== expectedNodeVersion) { + throw new Error(`Unexpected Node.js version: ${nodeVersion}`); +} + +const roleConfigResult = execFileSync("docker", [ + "run", "--rm", "--entrypoint", "node", image, + "/usr/local/lib/pc-filebridge/validate-role-config.mjs", + "/app/config/roots.infrastructure.json", +], { encoding: "utf8" }); +if (!roleConfigResult.includes("INFRASTRUCTURE_ROLE_CONFIG_PASS")) { + throw new Error("Container image did not validate its infrastructure role configuration."); +} + +execFileSync("docker", [ + "run", "--rm", "--entrypoint", "sh", image, "-c", + "test ! -e /usr/local/lib/node_modules/npm && ! command -v npm && ! command -v npx", +], { stdio: "pipe" }); + +const version = execFileSync("docker", ["run", "--rm", "--entrypoint", "/usr/local/bin/tunnel-client", image, "--version"], { + encoding: "utf8", +}).trim(); +if (!version.includes(expectedTunnelVersion)) { + throw new Error(`Unexpected tunnel-client version: ${version}`); +} + +let failedClosed = false; +try { + execFileSync("docker", ["run", "--rm", image], { encoding: "utf8", stdio: "pipe" }); +} catch (error) { + const stderr = String(error.stderr ?? ""); + failedClosed = stderr.includes("PC_FILEBRIDGE_STARTUP_FAIL code=API_KEY_UNAVAILABLE"); +} +if (!failedClosed) throw new Error("Container did not fail closed when secrets were absent."); + +const client = new Client({ name: "pc-filebridge-container-smoke", version: "0.2.1" }); +const transport = new StdioClientTransport({ + command: "docker", + args: [ + "run", "--rm", "-i", + "--read-only", + "--user", "10001:10001", + "--cap-drop", "ALL", + "--security-opt", "no-new-privileges:true", + "--tmpfs", "/tmp:rw,noexec,nosuid,nodev,size=16m,uid=10001,gid=10001,mode=0700", + "--tmpfs", "/data/primary:rw,noexec,nosuid,nodev,size=16m,uid=10001,gid=10001,mode=0700", + "--tmpfs", "/data/secondary:rw,noexec,nosuid,nodev,size=16m,uid=10001,gid=10001,mode=0700", + "--entrypoint", "node", + image, + "/app/mcp/server.mjs", + ], +}); + +try { + await client.connect(transport); + const catalog = await client.listTools(); + const actualTools = catalog.tools.map((tool) => tool.name).sort(); + if (JSON.stringify(actualTools) !== JSON.stringify(expectedTools)) { + throw new Error(`Unexpected container MCP tool catalog: ${JSON.stringify(actualTools)}`); + } + if (actualTools.some((name) => /delete|overwrite|append|rename|move|remove|unlink/i.test(name))) { + throw new Error("A forbidden mutation tool was exposed by the container."); + } + + const filePath = "container-create-only-smoke.txt"; + const content = "PC FileBridge container create-only smoke"; + const first = await client.callTool({ + name: "create_text_file", + arguments: { root_id: "primary-data", relative_path: filePath, content }, + }); + if (first.isError) throw new Error(`Initial container create failed: ${JSON.stringify(first)}`); + + const second = await client.callTool({ + name: "create_text_file", + arguments: { root_id: "primary-data", relative_path: filePath, content: "must-not-replace" }, + }); + if (!second.isError || !JSON.stringify(second).includes("TARGET_EXISTS")) { + throw new Error(`Repeated create did not fail with TARGET_EXISTS: ${JSON.stringify(second)}`); + } + + const readBack = await client.callTool({ + name: "read_text_file", + arguments: { root_id: "primary-data", relative_path: filePath, max_bytes: 4096 }, + }); + if (readBack.isError || !JSON.stringify(readBack).includes(content) || JSON.stringify(readBack).includes("must-not-replace")) { + throw new Error("Container create-only bytes were not preserved."); + } +} finally { + await client.close(); +} + +process.stdout.write(`CONTAINER_SMOKE_PASS image=${image} node=${expectedNodeVersion} tunnel_client=${expectedTunnelVersion} healthcheck=tunnel-aware logs=warn package_manager=absent tools=7 forbidden_mutations=0 create_only=preserved missing_secrets=fail_closed\n`); diff --git a/scripts/crash-window.windows.test.ps1 b/scripts/crash-window.windows.test.ps1 new file mode 100644 index 0000000..fbcd7cf --- /dev/null +++ b/scripts/crash-window.windows.test.ps1 @@ -0,0 +1,112 @@ +[CmdletBinding()] +param() +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' +$tempBase = [IO.Path]::GetFullPath([IO.Path]::GetTempPath()) +$root = Join-Path $tempBase ('pcfb-crash-window-' + [Guid]::NewGuid().ToString('N')) +[IO.Directory]::CreateDirectory($root) | Out-Null +$encoding = New-Object Text.UTF8Encoding($false) +$previousLocalAppData = $env:LOCALAPPDATA +$previousState = $env:PCFB_TEST_STATE +$previousCrash = $env:PCFB_TEST_CRASH_AT + +function Write-Json([string]$Path, [object]$Value) { + [IO.File]::WriteAllText($Path, (($Value | ConvertTo-Json -Depth 10) + [Environment]::NewLine), $encoding) +} +function New-Volume([string]$Letter, [string]$Bus = 'NVMe') { + $t = $Letter.ToLowerInvariant() + [ordered]@{ DeviceID=($Letter + ':'); DriveType=3; VolumeName="Volume-$t"; VolumeSerialNumber="serial-$t"; FileSystem='NTFS'; HealthStatus='Healthy'; BusType=$Bus; DiskUniqueId="disk-$t"; PartitionUniqueId="partition-$t"; VolumeUniqueId="volume-$t"; Online=$true } +} + +try { + $points = @('candidate_written','after_stop','after_candidate_start','before_applied_hash','after_applied_hash','before_lkg_promotion') + foreach ($point in $points) { + $case = Join-Path $root $point + $local = Join-Path $case 'localappdata' + $private = Join-Path $local 'PCFileBridge\private' + [IO.Directory]::CreateDirectory($private) | Out-Null + $env:LOCALAPPDATA = $local + $state = Join-Path $case 'state.json' + $env:PCFB_TEST_STATE = $state + Write-Json $state ([ordered]@{ running = $false }) + [IO.File]::WriteAllText((Join-Path $private 'pc-local.tunnel-id'), (('tun' + 'nel_crash_test_1234') + [Environment]::NewLine), $encoding) + + $client = Join-Path $case 'client.ps1' + [IO.File]::WriteAllText($client, @' +$state = Get-Content -Raw -LiteralPath $env:PCFB_TEST_STATE | ConvertFrom-Json +if ($args[0] -ceq 'runtimes' -and $args[1] -ceq 'status') { + [ordered]@{ process_running=[bool]$state.running; healthy=[bool]$state.running; ready=[bool]$state.running } | ConvertTo-Json -Compress + exit 0 +} +if ($args[0] -ceq 'runtimes' -and $args[1] -ceq 'stop') { + [IO.File]::WriteAllText($env:PCFB_TEST_STATE, '{"running":false}', [Text.Encoding]::ASCII) + '{}' + exit 0 +} +throw 'MOCK_ARGUMENT' +'@, $encoding) + $connect = Join-Path $case 'connect.ps1' + [IO.File]::WriteAllText($connect, @' +param([string]$Role,[string]$TunnelId,[string]$ConfigPath,[switch]$EnableFullDrive) +[IO.File]::WriteAllText($env:PCFB_TEST_STATE, '{"running":true}', [Text.Encoding]::ASCII) +'@, $encoding) + $initial = Join-Path $case 'initial.json' + $candidate = Join-Path $case 'candidate.json' + Write-Json $initial ([ordered]@{ volumes=@((New-Volume C),(New-Volume D 'SATA')) }) + Write-Json $candidate ([ordered]@{ volumes=@((New-Volume C),(New-Volume D 'SATA'),(New-Volume F 'SAS')) }) + $config = Join-Path $private 'roots.pc-local.auto.json' + & (Join-Path $PSScriptRoot 'Start-PCFileBridgeVolumeMonitor.ps1') -Role pc-local -Once -InventoryPath $initial -ConfigPath $config -TunnelClientPath $client -ConnectScriptPath $connect -StableSnapshots 1 -SkipMcpProbe | Out-Null + $env:PCFB_TEST_CRASH_AT = $point + $crashed = $false + try { + & (Join-Path $PSScriptRoot 'Start-PCFileBridgeVolumeMonitor.ps1') -Role pc-local -Once -InventoryPath $candidate -ConfigPath $config -TunnelClientPath $client -ConnectScriptPath $connect -StableSnapshots 1 -SkipMcpProbe | Out-Null + } catch { + if ($_.Exception.Message -notlike 'SIMULATED_CRASH_*') { throw } + $crashed = $true + } + if (-not $crashed) { throw "CRASH_POINT_NOT_REACHED_$point" } + $env:PCFB_TEST_CRASH_AT = '' + $recovery = & (Join-Path $PSScriptRoot 'Start-PCFileBridgeVolumeMonitor.ps1') -Role pc-local -Once -InventoryPath $candidate -ConfigPath $config -TunnelClientPath $client -ConnectScriptPath $connect -StableSnapshots 1 -SkipMcpProbe + if (-not [bool]$recovery.runtime_ready) { throw "CRASH_RECOVERY_FAILED_$point" } + $active = Get-Content -Raw -LiteralPath $config | ConvertFrom-Json + if (@($active.roots.id) -notcontains 'pc-f') { throw "CANDIDATE_NOT_RECOVERED_$point" } + } + + $env:LOCALAPPDATA = Join-Path $root 'singleton-local' + $singletonPrivate = Join-Path $env:LOCALAPPDATA 'PCFileBridge\private' + [IO.Directory]::CreateDirectory($singletonPrivate) | Out-Null + $algorithm = [Security.Cryptography.SHA256]::Create() + try { + $scope = ([BitConverter]::ToString($algorithm.ComputeHash([Text.Encoding]::UTF8.GetBytes($singletonPrivate.ToLowerInvariant())))).Replace('-', '').Substring(0, 12) + } finally { + $algorithm.Dispose() + } + $mutexName = "Local\PCFileBridgeVolumeMonitor-pc-local-$scope" + $readyFile = Join-Path $root 'singleton-ready' + $job = Start-Job -ArgumentList $mutexName, $readyFile -ScriptBlock { + param($Name, $Ready) + $held = New-Object Threading.Mutex($false, $Name) + $owns = $held.WaitOne(0) + if (-not $owns) { throw 'SINGLETON_TEST_MUTEX_FAILED' } + [IO.File]::WriteAllText($Ready, 'ready', [Text.Encoding]::ASCII) + try { Start-Sleep -Seconds 20 } finally { + $held.ReleaseMutex() + $held.Dispose() + } + } + try { + for ($attempt = 0; $attempt -lt 50 -and -not (Test-Path -LiteralPath $readyFile); $attempt += 1) { Start-Sleep -Milliseconds 100 } + if (-not (Test-Path -LiteralPath $readyFile)) { throw 'SINGLETON_TEST_JOB_NOT_READY' } + $singleton = & (Join-Path $PSScriptRoot 'Start-PCFileBridgeVolumeMonitor.ps1') -Role pc-local -Once -SkipConnect -StableSnapshots 1 + if ([string]$singleton.monitor -cne 'already_running') { throw 'MONITOR_SINGLETON_FAILED' } + } finally { + Stop-Job -Job $job -ErrorAction SilentlyContinue + Remove-Job -Job $job -Force -ErrorAction SilentlyContinue + } + Write-Output 'CRASH_WINDOW_WINDOWS_TEST_PASS points=6 singleton=pass recovery=pass' +} finally { + $env:LOCALAPPDATA = $previousLocalAppData + $env:PCFB_TEST_STATE = $previousState + $env:PCFB_TEST_CRASH_AT = $previousCrash + if (Test-Path -LiteralPath $root) { Remove-Item -LiteralPath $root -Recurse -Force } +} diff --git a/scripts/docker-role-config.test.mjs b/scripts/docker-role-config.test.mjs new file mode 100644 index 0000000..82f54f4 --- /dev/null +++ b/scripts/docker-role-config.test.mjs @@ -0,0 +1,73 @@ +#!/usr/bin/env node + +import { execFileSync } from "node:child_process"; +import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const validator = path.join(root, "deploy", "docker", "validate-role-config.mjs"); +const defaultConfig = path.join(root, "config", "roots.infrastructure.example.json"); +const fixtureDir = mkdtempSync(path.join(tmpdir(), "pc-filebridge-role-config-")); + +function run(configPath) { + return execFileSync(process.execPath, [validator, configPath], { + encoding: "utf8", + stdio: ["ignore", "pipe", "pipe"], + }); +} + +function expectReject(name, config) { + const fixture = path.join(fixtureDir, `${name}.json`); + writeFileSync(fixture, JSON.stringify(config), "utf8"); + try { + run(fixture); + } catch { + return; + } + throw new Error(`Unsafe infrastructure config was accepted: ${name}`); +} + +try { + const base = JSON.parse(readFileSync(defaultConfig, "utf8")); + if (!run(defaultConfig).includes("INFRASTRUCTURE_ROLE_CONFIG_PASS")) { + throw new Error("Default infrastructure config did not pass."); + } + + const withNode1 = structuredClone(base); + withNode1.roots.push({ + id: "agent-data", + label: "remote agent infrastructure data", + path: "/data/agent", + read: true, + create: true, + }); + const agentFixture = path.join(fixtureDir, "with-agent.json"); + writeFileSync(agentFixture, JSON.stringify(withNode1), "utf8"); + if (!run(agentFixture).includes("agent=true")) { + throw new Error("Authorized optional remote agent config did not pass."); + } + + const wrongPath = structuredClone(base); + wrongPath.roots[0].path = "/etc"; + expectReject("wrong-path", wrongPath); + + const missingRequired = structuredClone(base); + missingRequired.roots = missingRequired.roots.filter((entry) => entry.id !== "secondary-data"); + expectReject("missing-required", missingRequired); + + const crossRole = structuredClone(base); + crossRole.roots[0].id = "pc-c"; + expectReject("cross-role", crossRole); + + const writablePolicyMissing = structuredClone(base); + writablePolicyMissing.roots[0].create = false; + expectReject("policy-mismatch", writablePolicyMissing); +} finally { + rmSync(fixtureDir, { recursive: true, force: true }); +} + +process.stdout.write( + "DOCKER_ROLE_CONFIG_TEST_PASS default=pass agent_optional=pass wrong_path=blocked missing_required=blocked cross_role=blocked policy_mismatch=blocked\n", +); diff --git a/scripts/healthcheck-smoke.mjs b/scripts/healthcheck-smoke.mjs new file mode 100644 index 0000000..2c591e9 --- /dev/null +++ b/scripts/healthcheck-smoke.mjs @@ -0,0 +1,78 @@ +#!/usr/bin/env node + +import { execFileSync, spawn } from "node:child_process"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const pluginRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const healthcheckPath = path.join(pluginRoot, "deploy", "docker", "healthcheck.mjs"); + +const currentServer = await startMetricsServer("current"); +try { + runHealthcheck(currentServer.address); +} finally { + currentServer.stop(); +} + +const staleServer = await startMetricsServer("stale"); +try { + let rejected = false; + try { + runHealthcheck(staleServer.address); + } catch (error) { + rejected = String(error.stderr ?? "").includes("PC_FILEBRIDGE_HEALTH_FAIL code=POLL_SUCCESS_STALE"); + } + if (!rejected) throw new Error("Tunnel healthcheck accepted a stale successful poll."); +} finally { + staleServer.stop(); +} + +process.stdout.write("HEALTHCHECK_SMOKE_PASS current=healthy stale=fail_closed\n"); + +function runHealthcheck(address) { + execFileSync(process.execPath, [healthcheckPath], { + encoding: "utf8", + env: { + ...process.env, + HEALTH_LISTEN_ADDR: address, + TUNNEL_HEALTH_MAX_AGE_SECONDS: "180", + }, + stdio: "pipe", + }); +} + +async function startMetricsServer(mode) { + const source = ` + const http = require("node:http"); + const mode = process.argv[1]; + const server = http.createServer((request, response) => { + if (request.url === "/readyz") { + response.writeHead(200).end("ready"); + return; + } + if (request.url === "/metrics") { + const timestamp = mode === "current" ? Date.now() / 1000 : 1; + response.writeHead(200, { "content-type": "text/plain" }); + response.end("commands_poll_last_successful_timestamp_seconds " + timestamp + "\\n"); + return; + } + response.writeHead(404).end(); + }); + server.listen(0, "127.0.0.1", () => { + const address = server.address(); + process.stdout.write("127.0.0.1:" + address.port + "\\n"); + }); + `; + const child = spawn(process.execPath, ["-e", source, mode], { + stdio: ["ignore", "pipe", "pipe"], + }); + const address = await new Promise((resolve, reject) => { + child.once("error", reject); + child.stderr.once("data", (chunk) => reject(new Error(String(chunk)))); + child.stdout.once("data", (chunk) => resolve(String(chunk).trim())); + }); + return { + address, + stop: () => child.kill("SIGTERM"), + }; +} diff --git a/scripts/image-vulnerability-gate.mjs b/scripts/image-vulnerability-gate.mjs new file mode 100644 index 0000000..c3b1890 --- /dev/null +++ b/scripts/image-vulnerability-gate.mjs @@ -0,0 +1,64 @@ +#!/usr/bin/env node + +import { readFileSync } from "node:fs"; + +const argumentsMap = parseArguments(process.argv.slice(2)); +const grypePath = argumentsMap.get("--grype") ?? "release-scan/grype.json"; +const govulnPath = argumentsMap.get("--govuln") ?? "release-scan/govulncheck.json"; +const grype = JSON.parse(readFileSync(grypePath, "utf8")); +const govuln = JSON.parse(readFileSync(govulnPath, "utf8")); + +const blocked = []; +for (const match of grype.matches ?? []) { + const vulnerability = match.vulnerability ?? {}; + const fixes = vulnerability.fix?.versions ?? []; + if (fixes.length === 0 || !["High", "Critical"].includes(vulnerability.severity)) continue; + + blocked.push({ + id: vulnerability.id, + severity: vulnerability.severity, + package: match.artifact?.name, + location: match.artifact?.locations?.[0]?.path, + }); +} + +const govulnFindings = govuln + .filter((message) => message.finding) + .map((message) => message.finding); +const called = govulnFindings.filter((finding) => + (finding.trace ?? []).some((frame) => frame.function), +); +const importedNotCalled = new Set( + govulnFindings + .filter((finding) => + (finding.trace ?? []).some((frame) => frame.package) && + !(finding.trace ?? []).some((frame) => frame.function), + ) + .map((finding) => finding.osv), +); + +if (blocked.length > 0 || called.length > 0) { + process.stderr.write(`${JSON.stringify({ + event: "image_vulnerability_gate_failed", + blocked, + called_go_vulnerabilities: [...new Set(called.map((finding) => finding.osv))], + imported_not_called: [...importedNotCalled], + })}\n`); + process.exit(1); +} + +process.stdout.write( + `IMAGE_VULNERABILITY_GATE_PASS unreviewed_fixed_high_or_critical=0 ` + + `called_go_vulnerabilities=0 imported_not_called=${importedNotCalled.size}\n`, +); + +function parseArguments(values) { + const parsed = new Map(); + for (let index = 0; index < values.length; index += 2) { + const key = values[index]; + const value = values[index + 1]; + if (!key?.startsWith("--") || !value) throw new Error("Expected --name value arguments."); + parsed.set(key, value); + } + return parsed; +} diff --git a/scripts/image-vulnerability-gate.test.mjs b/scripts/image-vulnerability-gate.test.mjs new file mode 100644 index 0000000..e6da167 --- /dev/null +++ b/scripts/image-vulnerability-gate.test.mjs @@ -0,0 +1,79 @@ +#!/usr/bin/env node + +import { spawnSync } from "node:child_process"; +import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { basename, join } from "node:path"; +import { tmpdir } from "node:os"; + +const testDirectory = mkdtempSync(join(tmpdir(), "pcfb-image-gate-test-")); +try { + const clean = runGate({ matches: [] }, []); + assert(clean.status === 0, `clean fixture failed: ${clean.stderr}`); + + const imported = runGate( + { matches: [] }, + [{ + finding: { + osv: "GO-TEST-IMPORTED", + trace: [{ module: "example.invalid/module", package: "example.invalid/module/pkg" }], + }, + }], + ); + assert(imported.status === 0, `package-only fixture failed: ${imported.stderr}`); + assert(imported.stdout.includes("imported_not_called=1"), "package-only finding was not reported"); + + const called = runGate( + { matches: [] }, + [{ + finding: { + osv: "GO-TEST-CALLED", + trace: [{ + module: "example.invalid/module", + package: "example.invalid/module/pkg", + function: "Vulnerable", + }], + }, + }], + ); + assert(called.status !== 0, "called vulnerable function did not fail the gate"); + assert(called.stderr.includes("GO-TEST-CALLED"), "called vulnerability ID was not reported"); + + const fixedHigh = runGate({ + matches: [{ + vulnerability: { + id: "CVE-TEST-HIGH", + severity: "High", + fix: { versions: ["9.9.9"] }, + }, + artifact: { + name: "test-package", + locations: [{ path: "/test/path" }], + }, + }], + }, []); + assert(fixedHigh.status !== 0, "fixed HIGH finding did not fail the gate"); + assert(fixedHigh.stderr.includes("CVE-TEST-HIGH"), "fixed HIGH ID was not reported"); + + process.stdout.write("IMAGE_VULNERABILITY_GATE_TEST_PASS clean=pass imported=reported called=blocked fixed_high=blocked\n"); +} finally { + if (basename(testDirectory).startsWith("pcfb-image-gate-test-")) { + rmSync(testDirectory, { recursive: true, force: true }); + } +} + +function runGate(grype, govuln) { + const unique = Math.random().toString(16).slice(2); + const grypePath = join(testDirectory, `grype-${unique}.json`); + const govulnPath = join(testDirectory, `govuln-${unique}.json`); + writeFileSync(grypePath, JSON.stringify(grype), { flag: "wx", mode: 0o600 }); + writeFileSync(govulnPath, JSON.stringify(govuln), { flag: "wx", mode: 0o600 }); + return spawnSync(process.execPath, [ + "scripts/image-vulnerability-gate.mjs", + "--grype", grypePath, + "--govuln", govulnPath, + ], { encoding: "utf8" }); +} + +function assert(condition, message) { + if (!condition) throw new Error(message); +} diff --git a/scripts/license-check.mjs b/scripts/license-check.mjs new file mode 100644 index 0000000..fed8c29 --- /dev/null +++ b/scripts/license-check.mjs @@ -0,0 +1,22 @@ +#!/usr/bin/env node + +import { readFile } from "node:fs/promises"; + +const allowed = new Set(["0BSD", "Apache-2.0", "BSD-2-Clause", "BSD-3-Clause", "ISC", "MIT"]); +const lock = JSON.parse(await readFile(new URL("../package-lock.json", import.meta.url), "utf8")); +const rejected = []; +let checked = 0; + +for (const [packagePath, metadata] of Object.entries(lock.packages ?? {})) { + if (!packagePath.includes("node_modules/") || metadata.dev === true) continue; + checked += 1; + const license = typeof metadata.license === "string" ? metadata.license : "MISSING"; + if (!allowed.has(license)) rejected.push({ package: packagePath.replace(/^.*node_modules\//u, ""), license }); +} + +if (checked === 0 || rejected.length > 0) { + process.stderr.write(`${JSON.stringify({ event: "license_check_failed", checked, rejected })}\n`); + process.exit(1); +} + +process.stdout.write(`LICENSE_CHECK_PASS production_packages=${checked} allowed=${[...allowed].join(",")}\n`); diff --git a/scripts/mcp-config-smoke.mjs b/scripts/mcp-config-smoke.mjs new file mode 100644 index 0000000..7bc69ed --- /dev/null +++ b/scripts/mcp-config-smoke.mjs @@ -0,0 +1,96 @@ +#!/usr/bin/env node + +import { spawn } from "node:child_process"; +import path from "node:path"; +import readline from "node:readline"; +import { fileURLToPath } from "node:url"; + +const pluginRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const configPath = process.env.FILEBRIDGE_CONFIG; +if (!configPath) throw new Error("FILEBRIDGE_CONFIG is required."); +const expectedRoots = (process.env.PCFB_EXPECTED_ROOTS ?? "").split(",").filter(Boolean).sort(); +const child = spawn(process.execPath, [path.join(pluginRoot, "mcp", "server.mjs")], { + cwd: pluginRoot, + env: { + ...process.env, + FILEBRIDGE_CONFIG: configPath, + FILEBRIDGE_ALLOW_DRIVE_ROOT: process.env.FILEBRIDGE_ALLOW_DRIVE_ROOT ?? "", + }, + stdio: ["pipe", "pipe", "pipe"], + windowsHide: true, +}); + +let nextId = 1; +let stderr = ""; +const pending = new Map(); +const lines = readline.createInterface({ input: child.stdout }); +lines.on("line", (line) => { + let message; + try { + message = JSON.parse(line); + } catch { + return; + } + if (message.id === undefined || message.id === null) return; + const waiter = pending.get(message.id); + if (!waiter) return; + pending.delete(message.id); + if (message.error) waiter.reject(new Error(`MCP_ERROR_${message.error.code}`)); + else waiter.resolve(message.result); +}); +child.stderr.setEncoding("utf8"); +child.stderr.on("data", (chunk) => { + stderr = (stderr + chunk).slice(-8192); +}); + +function send(message) { + child.stdin.write(JSON.stringify(message) + "\n"); +} + +function request(method, params = {}) { + const id = nextId++; + return new Promise((resolve, reject) => { + const timer = setTimeout(() => { + pending.delete(id); + reject(new Error(`MCP_REQUEST_TIMEOUT_${method}`)); + }, 10000); + pending.set(id, { + resolve: (value) => { + clearTimeout(timer); + resolve(value); + }, + reject: (error) => { + clearTimeout(timer); + reject(error); + }, + }); + send({ jsonrpc: "2.0", id, method, params }); + }); +} + +try { + await request("initialize", { + protocolVersion: "2025-06-18", + capabilities: {}, + clientInfo: { name: "pc-filebridge-config-smoke", version: "0.2.1" }, + }); + send({ jsonrpc: "2.0", method: "notifications/initialized", params: {} }); + + const catalog = await request("tools/list"); + const actualTools = catalog.tools.map((tool) => tool.name).sort(); + const expectedTools = ["create_directory", "create_text_file", "list_directory", "list_roots", "read_text_file", "search_file_names", "stat_path"]; + if (JSON.stringify(actualTools) !== JSON.stringify(expectedTools)) throw new Error("MCP_TOOL_CATALOG_MISMATCH"); + + const response = await request("tools/call", { name: "list_roots", arguments: {} }); + if (response.isError) throw new Error("MCP_LIST_ROOTS_FAILED"); + const roots = (response.structuredContent?.roots ?? []).map((root) => root.id).sort(); + if (JSON.stringify(roots) !== JSON.stringify(expectedRoots)) throw new Error("MCP_ROOT_CONTRACT_MISMATCH"); + process.stdout.write(JSON.stringify({ tools: actualTools.length, root_ids: roots }) + "\n"); +} catch (error) { + if (stderr) process.stderr.write(stderr); + throw error; +} finally { + lines.close(); + child.stdin.end(); + if (!child.killed) child.kill(); +} diff --git a/scripts/mcp-smoke.mjs b/scripts/mcp-smoke.mjs index 656d9dc..518059b 100644 --- a/scripts/mcp-smoke.mjs +++ b/scripts/mcp-smoke.mjs @@ -1,7 +1,6 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; import { mkdtemp, rm, writeFile } from "node:fs/promises"; -import os from "node:os"; import path from "node:path"; import { fileURLToPath } from "node:url"; @@ -15,9 +14,9 @@ const expectedTools = [ "stat_path", ]; -const client = new Client({ name: "pc-filebridge-smoke", version: "0.1.1" }); +const client = new Client({ name: "pc-filebridge-smoke", version: "0.2.1" }); const pluginRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); -const fixtureDirectory = await mkdtemp(path.join(os.tmpdir(), "pc-filebridge-mcp-smoke-")); +const fixtureDirectory = await mkdtemp(path.join(pluginRoot, ".pc-filebridge-mcp-smoke-")); const configPath = path.join(fixtureDirectory, "roots.json"); await writeFile(configPath, JSON.stringify({ version: 1, @@ -33,7 +32,7 @@ await writeFile(configPath, JSON.stringify({ const transport = new StdioClientTransport({ command: process.execPath, args: [path.join(pluginRoot, "mcp", "server.mjs")], - cwd: os.tmpdir(), + cwd: pluginRoot, env: { FILEBRIDGE_CONFIG: configPath }, }); diff --git a/scripts/package-contents-check.mjs b/scripts/package-contents-check.mjs new file mode 100644 index 0000000..6949dd0 --- /dev/null +++ b/scripts/package-contents-check.mjs @@ -0,0 +1,69 @@ +#!/usr/bin/env node + +import { execFileSync } from "node:child_process"; + +const npmCli = process.env.npm_execpath; +if (!npmCli) throw new Error("Run this check through npm so npm_execpath is available."); +const output = execFileSync(process.execPath, [npmCli, "pack", "--dry-run", "--json", "--ignore-scripts"], { + cwd: new URL("..", import.meta.url), + encoding: "utf8", +}); +const report = JSON.parse(output); +const packageReports = Array.isArray(report) ? report : Object.values(report); +const files = new Set(packageReports[0]?.files?.map((entry) => entry.path) ?? []); +const required = [ + ".codex-plugin/plugin.json", + ".mcp.json", + "config/roots.example.json", + "config/roots.server.example.json", + "config/roots.pc.example.json", + "config/roots.laptop.example.json", + "config/roots.infrastructure.example.json", + "config/tunnel-roles.json", + "scripts/Connect-PCFileBridgeRoleTunnel.ps1", + "scripts/Connect-PCFileBridgeRoleTunnel-Task.ps1", + "scripts/Set-PCFileBridgeGate.ps1", + "scripts/Start-PCFileBridgeVolumeMonitor.ps1", + "scripts/Test-PCFileBridgeRoleConfig.ps1", + "scripts/Update-PCFileBridgeVolumeConfig.ps1", + "scripts/volume-discovery.windows.test.ps1", + "deploy/docker/Dockerfile", + "deploy/docker/THIRD_PARTY_NOTICES.md", + "deploy/docker/compose.example.yml", + "deploy/docker/compose.host-ca.example.yml", + "deploy/docker/entrypoint.sh", + "deploy/docker/healthcheck.mjs", + "deploy/docker/validate-role-config.mjs", + "docs/IMAGE_SECURITY.md", + "docs/TUNNEL_ROLES.md", + "docs/VPS_DEPLOYMENT.md", + "mcp/server.mjs", + "scripts/image-vulnerability-gate.mjs", + "scripts/image-vulnerability-gate.test.mjs", + "scripts/docker-role-config.test.mjs", + "scripts/version-consistency.mjs", + "scripts/run-image-vulnerability-gate.sh", + "README.md", + "SECURITY.md", + "THREAT_MODEL.md", +]; +const forbiddenPatterns = [ + /(^|\/)\.env(?:\.|$)/iu, + /(^|\/)(?:credentials?|secrets?)(?:\.|\/|$)/iu, + /(^|\/)config\/roots\.local\.json$/iu, + /(^|\/)node_modules\//u, + /(^|\/)test\//u, + /(^|\/)src\//u, + /(^|\/)docs\/PRIVATE_VPS_OPERATIONS\.md$/u, + /\.bak$/iu, + /\.(?:key|pem|p12|pfx|ppk)$/iu, +]; +const missing = required.filter((name) => !files.has(name)); +const forbidden = [...files].filter((name) => forbiddenPatterns.some((pattern) => pattern.test(name))); + +if (missing.length > 0 || forbidden.length > 0) { + process.stderr.write(`${JSON.stringify({ event: "package_contents_failed", missing, forbidden })}\n`); + process.exit(1); +} + +process.stdout.write(`PACKAGE_CONTENTS_PASS files=${files.size} required=${required.length} forbidden=0\n`); diff --git a/scripts/run-image-vulnerability-gate.sh b/scripts/run-image-vulnerability-gate.sh new file mode 100755 index 0000000..c6c8817 --- /dev/null +++ b/scripts/run-image-vulnerability-gate.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +set -eu + +image="${FILEBRIDGE_IMAGE:-pc-filebridge:0.2.1}" +scan_dir="$(mktemp -d "${TMPDIR:-/tmp}/pc-filebridge-scan.XXXXXX")" +source_container="" +govuln_container="" + +cleanup() { + if [ -n "$source_container" ]; then docker rm -f "$source_container" >/dev/null 2>&1 || true; fi + if [ -n "$govuln_container" ]; then docker rm -f "$govuln_container" >/dev/null 2>&1 || true; fi + case "$(basename "$scan_dir")" in + pc-filebridge-scan.*) rm -rf -- "$scan_dir" ;; + *) printf "%s\n" "Refusing to remove unexpected scan directory." >&2 ;; + esac +} +trap cleanup EXIT INT TERM + +syft_image="ghcr.io/anchore/syft@sha256:95fe0835e5bebc6f8b1f8acef68d47d63d594ef4c0f25c097ff853b23cbac74c" +grype_image="ghcr.io/anchore/grype@sha256:8a93fc48da96bd6ec5981279d099b69de11541dc68fdf222fb9161f8ff284af7" +go_image="golang:1.27.0-bookworm@sha256:ded31c68586d2e49e760acc2e65a884b23d032e9bbbed0ae0c55abd3fcaf4452" + +docker run --rm -v /var/run/docker.sock:/var/run/docker.sock "$syft_image" \ + "$image" -o cyclonedx-json > "$scan_dir/image-sbom.cdx.json" +docker run --rm -v /var/run/docker.sock:/var/run/docker.sock "$grype_image" \ + "$image" -o json > "$scan_dir/grype.json" +jq -e '.bomFormat == "CycloneDX"' "$scan_dir/image-sbom.cdx.json" >/dev/null + +source_container="$(docker create "$image")" +docker cp "$source_container:/usr/local/bin/tunnel-client" "$scan_dir/tunnel-client" +docker rm "$source_container" >/dev/null +source_container="" + +govuln_container="$(docker create --entrypoint sh "$go_image" -c \ + 'GOBIN=/tmp/bin /usr/local/go/bin/go install golang.org/x/vuln/cmd/govulncheck@v1.7.0 && /tmp/bin/govulncheck -mode=binary -json /tmp/tunnel-client')" +docker cp "$scan_dir/tunnel-client" "$govuln_container:/tmp/tunnel-client" +docker start -a "$govuln_container" > "$scan_dir/govulncheck.stream.json" +docker rm "$govuln_container" >/dev/null +govuln_container="" +jq -s '.' "$scan_dir/govulncheck.stream.json" > "$scan_dir/govulncheck.json" + +node scripts/image-vulnerability-gate.mjs \ + --grype "$scan_dir/grype.json" \ + --govuln "$scan_dir/govulncheck.json" diff --git a/scripts/runtime-rollback.windows.test.ps1 b/scripts/runtime-rollback.windows.test.ps1 new file mode 100644 index 0000000..63b5633 --- /dev/null +++ b/scripts/runtime-rollback.windows.test.ps1 @@ -0,0 +1,113 @@ +[CmdletBinding()] +param() + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +$tempBase = [IO.Path]::GetFullPath([IO.Path]::GetTempPath()) +$tempRoot = Join-Path $tempBase ('pc-filebridge-rollback-test-' + [Guid]::NewGuid().ToString('N')) +[IO.Directory]::CreateDirectory($tempRoot) | Out-Null +if (-not ([IO.Path]::GetFullPath($tempRoot)).StartsWith($tempBase, [StringComparison]::OrdinalIgnoreCase)) { throw 'TEMP_SCOPE_INVALID' } +$encoding = New-Object Text.UTF8Encoding($false) +$previousLocalAppData = $env:LOCALAPPDATA +$previousState = $env:PCFB_TEST_STATE +$previousFailure = $env:PCFB_TEST_FAIL_CANDIDATE + +function Write-Json([string]$Path, [object]$Value) { + [IO.File]::WriteAllText($Path, (($Value | ConvertTo-Json -Depth 10) + [Environment]::NewLine), $encoding) +} + +function New-VolumeFixture([string]$DeviceID, [string]$BusType = 'NVMe') { + $token = $DeviceID.Substring(0, 1).ToLowerInvariant() + [ordered]@{ + DeviceID = $DeviceID + DriveType = 3 + VolumeName = "Volume-$token" + VolumeSerialNumber = "serial-$token" + FileSystem = 'NTFS' + HealthStatus = 'Healthy' + BusType = $BusType + DiskUniqueId = "disk-$token" + PartitionUniqueId = "partition-$token" + VolumeUniqueId = "volume-$token" + } +} + +try { + $localAppData = Join-Path $tempRoot 'localappdata' + $privateRoot = Join-Path $localAppData 'PCFileBridge\private' + [IO.Directory]::CreateDirectory($privateRoot) | Out-Null + $env:LOCALAPPDATA = $localAppData + $statePath = Join-Path $tempRoot 'runtime-state.json' + $env:PCFB_TEST_STATE = $statePath + $env:PCFB_TEST_FAIL_CANDIDATE = '0' + Write-Json -Path $statePath -Value ([ordered]@{ running = $false }) + $testTunnelId = 'tunnel_' + 'test_runtime_1234' + [IO.File]::WriteAllText((Join-Path $privateRoot 'pc-local.tunnel-id'), ($testTunnelId + [Environment]::NewLine), $encoding) + + $tunnelClient = Join-Path $tempRoot 'mock-tunnel-client.ps1' + [IO.File]::WriteAllText($tunnelClient, @' +$ErrorActionPreference = 'Stop' +$state = Get-Content -Raw -LiteralPath $env:PCFB_TEST_STATE | ConvertFrom-Json +if ($args.Count -ge 2 -and $args[0] -ceq 'runtimes' -and $args[1] -ceq 'status') { + [ordered]@{ process_running = [bool]$state.running; healthy = [bool]$state.running; ready = [bool]$state.running } | ConvertTo-Json -Compress + exit 0 +} +if ($args.Count -ge 2 -and $args[0] -ceq 'runtimes' -and $args[1] -ceq 'stop') { + [IO.File]::WriteAllText($env:PCFB_TEST_STATE, '{"running":false}', [Text.Encoding]::ASCII) + '{}' + exit 0 +} +throw 'MOCK_TUNNEL_CLIENT_ARGUMENT' +'@, $encoding) + + $connectScript = Join-Path $tempRoot 'mock-connect.ps1' + [IO.File]::WriteAllText($connectScript, @' +param( + [string]$Role, + [string]$TunnelId, + [string]$ConfigPath, + [switch]$EnableFullDrive +) +$config = Get-Content -Raw -LiteralPath $ConfigPath | ConvertFrom-Json +if ($env:PCFB_TEST_FAIL_CANDIDATE -ceq '1' -and @($config.roots.id) -contains 'pc-f') { + throw 'MOCK_CANDIDATE_CONNECT_FAILED' +} +[IO.File]::WriteAllText($env:PCFB_TEST_STATE, '{"running":true}', [Text.Encoding]::ASCII) +'@, $encoding) + + $initialInventory = Join-Path $tempRoot 'initial.json' + Write-Json -Path $initialInventory -Value ([ordered]@{ volumes = @( + (New-VolumeFixture -DeviceID 'C:' -BusType 'NVMe'), + (New-VolumeFixture -DeviceID 'D:' -BusType 'SATA') + ) }) + $configPath = Join-Path $privateRoot 'roots.pc-local.auto.json' + $first = & (Join-Path $PSScriptRoot 'Start-PCFileBridgeVolumeMonitor.ps1') -Role pc-local -Once -InventoryPath $initialInventory -ConfigPath $configPath -TunnelClientPath $tunnelClient -ConnectScriptPath $connectScript -StableSnapshots 1 -SkipMcpProbe + if (-not [bool]$first.runtime_ready -or [bool]$first.rollback_applied) { throw 'INITIAL_CONNECT_FAILED' } + if (-not (Test-Path -LiteralPath (Join-Path $privateRoot 'roots.pc-local.last-good.json'))) { throw 'LKG_NOT_CREATED' } + + $candidateInventory = Join-Path $tempRoot 'candidate.json' + Write-Json -Path $candidateInventory -Value ([ordered]@{ volumes = @( + (New-VolumeFixture -DeviceID 'C:' -BusType 'NVMe'), + (New-VolumeFixture -DeviceID 'D:' -BusType 'SATA'), + (New-VolumeFixture -DeviceID 'F:' -BusType 'SAS') + ) }) + $env:PCFB_TEST_FAIL_CANDIDATE = '1' + $second = & (Join-Path $PSScriptRoot 'Start-PCFileBridgeVolumeMonitor.ps1') -Role pc-local -Once -InventoryPath $candidateInventory -ConfigPath $configPath -TunnelClientPath $tunnelClient -ConnectScriptPath $connectScript -StableSnapshots 1 -SkipMcpProbe + if (-not [bool]$second.runtime_ready -or -not [bool]$second.rollback_applied -or [string]$second.runtime_action -cne 'candidate_failed_rolled_back') { + throw 'ROLLBACK_NOT_APPLIED' + } + $activeAfterRollback = Get-Content -Raw -LiteralPath $configPath | ConvertFrom-Json + if (@($activeAfterRollback.roots.id) -contains 'pc-f') { throw 'FAILED_CANDIDATE_REMAINED_ACTIVE' } + + $third = & (Join-Path $PSScriptRoot 'Start-PCFileBridgeVolumeMonitor.ps1') -Role pc-local -Once -InventoryPath $candidateInventory -ConfigPath $configPath -TunnelClientPath $tunnelClient -ConnectScriptPath $connectScript -StableSnapshots 1 -SkipMcpProbe + if ([string]$third.runtime_action -cne 'rejected_skipped_lkg_active' -or -not [bool]$third.runtime_ready) { + throw 'REJECTED_TOPOLOGY_RETRY_NOT_SUPPRESSED' + } + Write-Output 'RUNTIME_ROLLBACK_WINDOWS_TEST_PASS candidate=failed rollback=ready rejected=skipped' +} finally { + $env:LOCALAPPDATA = $previousLocalAppData + $env:PCFB_TEST_STATE = $previousState + $env:PCFB_TEST_FAIL_CANDIDATE = $previousFailure + if (Test-Path -LiteralPath $tempRoot) { Remove-Item -LiteralPath $tempRoot -Recurse -Force } +} diff --git a/scripts/secret-scan.mjs b/scripts/secret-scan.mjs index d6df9ed..aa0fa9e 100644 --- a/scripts/secret-scan.mjs +++ b/scripts/secret-scan.mjs @@ -18,8 +18,8 @@ const blockedContent = [ ["private key block", new RegExp("-----BEGIN " + "(?:RSA |OPENSSH |EC |DSA |ENCRYPTED )?PRIVATE KEY-----", "g")], ["real tunnel id", /\btunnel_[A-Za-z0-9_-]{8,}\b/g], ["private ChatGPT app id", /\basdk_app_[A-Za-z0-9_-]+\b/g], - ["local Windows account", new RegExp("Hacking" + "_" + "Base", "gi")], - ["private Gitea host", /git\.affihub\.site/gi], + ["local Windows profile", /\b[A-Za-z]:\\Users\\[^\\\r\n]+/g], + ["private forge URL", /https?:\/\/(?:git|gitea)\.[^\s/]+/gi], ]; const findings = []; diff --git a/scripts/tunnel-role-contract.mjs b/scripts/tunnel-role-contract.mjs new file mode 100644 index 0000000..13f23ca --- /dev/null +++ b/scripts/tunnel-role-contract.mjs @@ -0,0 +1,128 @@ +import { readFile } from "node:fs/promises"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const contract = JSON.parse(await readFile(path.join(root, "config", "tunnel-roles.json"), "utf8")); +const volumePolicy = (rootIdPrefix) => ({ + enabled: true, + driveType: 3, + rootIdPrefix, + allowedBusTypes: ["NVMe", "SATA", "SAS", "RAID", "Storage Spaces", "SCM"], + allowedFileSystems: ["NTFS"], + requireHealthy: true, +}); +const expectedRoles = new Map([ + ["pc-local", { + configName: "roots.pc.example.json", + hostId: "pc-main", + tunnelName: "PC FileBridge - PC Local", + alias: "pc-filebridge-pc-local", + gateRequired: true, + rootIds: ["pc-c", "pc-d"], + requiredRootIds: ["pc-c"], + rootPaths: { "pc-c": "C:\\", "pc-d": "D:\\" }, + volumeDiscovery: volumePolicy("pc-"), + }], + ["laptop-local", { + configName: "roots.laptop.example.json", + hostId: "laptop-main", + tunnelName: "PC FileBridge - Laptop Local", + alias: "pc-filebridge-laptop-local", + gateRequired: true, + rootIds: ["laptop-c", "laptop-d"], + requiredRootIds: ["laptop-c"], + rootPaths: { "laptop-c": "C:\\", "laptop-d": "D:\\" }, + volumeDiscovery: volumePolicy("laptop-"), + }], + ["infrastructure", { + configName: "roots.infrastructure.example.json", + tunnelName: "PC FileBridge - Infrastructure", + alias: "pc-filebridge-infrastructure", + gateRequired: false, + rootIds: ["primary-data", "secondary-data", "agent-data"], + requiredRootIds: ["primary-data", "secondary-data"], + rootPaths: { "primary-data": "/data/primary", "secondary-data": "/data/secondary", "agent-data": "/data/agent" }, + }], +]); + +if (contract.version !== 1 || !Array.isArray(contract.roles)) { + throw new Error("Tunnel role contract must use version 1 and contain a roles array."); +} +if (contract.roles.length !== expectedRoles.size) { + throw new Error("Tunnel role contract must define exactly three roles."); +} + +const names = new Set(); +const aliases = new Set(); +const allRootIds = new Set(); +for (const role of contract.roles) { + const expected = expectedRoles.get(role.id); + if (!expected) throw new Error(`Unexpected tunnel role: ${role.id}`); + const configName = expected.configName; + if (expected.hostId !== undefined && role.hostId !== expected.hostId) { + throw new Error(`Unexpected host id for role ${role.id}`); + } + if (role.expectedTunnelName !== expected.tunnelName) { + throw new Error(`Unexpected tunnel name for role ${role.id}`); + } + if (role.alias !== expected.alias) throw new Error(`Unexpected runtime alias for role ${role.id}`); + if (role.gateRequired !== expected.gateRequired) throw new Error(`Invalid gate policy for role ${role.id}`); + if (JSON.stringify(role.rootIds) !== JSON.stringify(expected.rootIds)) { + throw new Error(`Invalid allowed roots for role ${role.id}`); + } + if (JSON.stringify(role.requiredRootIds) !== JSON.stringify(expected.requiredRootIds)) { + throw new Error(`Invalid required roots for role ${role.id}`); + } + if (JSON.stringify(role.rootPaths) !== JSON.stringify(expected.rootPaths)) { + throw new Error(`Invalid root paths for role ${role.id}`); + } + if (JSON.stringify(role.volumeDiscovery) !== JSON.stringify(expected.volumeDiscovery)) { + throw new Error(`Invalid volume discovery policy for role ${role.id}`); + } + if (names.has(role.expectedTunnelName)) throw new Error("Tunnel names must be unique."); + if (aliases.has(role.alias)) throw new Error("Runtime aliases must be unique."); + names.add(role.expectedTunnelName); + aliases.add(role.alias); + + if (!Array.isArray(role.rootIds) || role.rootIds.length < 1) { + throw new Error(`Role ${role.id} must declare root ids.`); + } + if (!Array.isArray(role.requiredRootIds) || role.requiredRootIds.length < 1) { + throw new Error(`Role ${role.id} must declare required root ids.`); + } + if (new Set(role.rootIds).size !== role.rootIds.length) throw new Error(`Duplicate root id in role ${role.id}`); + for (const requiredId of role.requiredRootIds) { + if (!role.rootIds.includes(requiredId)) throw new Error(`Required root is not allowed for role ${role.id}`); + } + + const config = JSON.parse(await readFile(path.join(root, "config", configName), "utf8")); + const configuredIds = config.roots.map((entry) => entry.id); + for (const entry of config.roots) { + if (entry.path !== expected.rootPaths[entry.id]) { + throw new Error(`Root path for ${entry.id} does not match role ${role.id}.`); + } + } + const configuredUnique = new Set(configuredIds); + if (configuredUnique.size !== configuredIds.length) { + throw new Error(`Duplicate root id in ${configName}.`); + } + if (configuredIds.some((rootId) => !role.rootIds.includes(rootId))) { + throw new Error(`Root ids for role ${role.id} exceed the role contract.`); + } + if (role.requiredRootIds.some((rootId) => !configuredUnique.has(rootId))) { + throw new Error(`Required root ids for role ${role.id} are absent from ${configName}.`); + } + const configuredInContractOrder = role.rootIds.filter((rootId) => configuredUnique.has(rootId)); + if (JSON.stringify(configuredIds) !== JSON.stringify(configuredInContractOrder)) { + throw new Error(`Root ids for role ${role.id} are not in contract order.`); + } + for (const rootId of role.rootIds) { + if (allRootIds.has(rootId)) throw new Error(`Root id is reused across roles: ${rootId}`); + allRootIds.add(rootId); + } +} + +process.stdout.write( + `TUNNEL_ROLE_CONTRACT_PASS roles=${contract.roles.length} tunnel_names=${names.size} root_ids=${allRootIds.size}\n`, +); diff --git a/scripts/version-consistency.mjs b/scripts/version-consistency.mjs new file mode 100644 index 0000000..d84777b --- /dev/null +++ b/scripts/version-consistency.mjs @@ -0,0 +1,39 @@ +#!/usr/bin/env node + +import { readFile } from "node:fs/promises"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const read = (relativePath) => readFile(path.join(root, relativePath), "utf8"); +const packageJson = JSON.parse(await read("package.json")); +const packageLock = JSON.parse(await read("package-lock.json")); +const plugin = JSON.parse(await read(".codex-plugin/plugin.json")); +const version = packageJson.version; + +if (!/^\d+\.\d+\.\d+$/u.test(version)) throw new Error("Package version is not semantic."); +if (packageLock.version !== version || packageLock.packages?.[""]?.version !== version) { + throw new Error("package-lock.json version does not match package.json."); +} +if (plugin.version !== version) throw new Error("Codex plugin version does not match package.json."); + +const exactNeedles = new Map([ + ["src/server.ts", `version: "${version}"`], + ["mcp/server.mjs", `version: "${version}"`], + ["scripts/mcp-smoke.mjs", `version: "${version}"`], + ["scripts/container-smoke.mjs", `version: "${version}"`], + ["scripts/run-image-vulnerability-gate.sh", `pc-filebridge:${version}`], + [".github/workflows/ci.yml", `pc-filebridge:${version}`], + [".github/workflows/release.yml", `pc-filebridge:${version}`], + ["deploy/docker/compose.example.yml", `pc-filebridge:${version}`], + ["deploy/docker/Dockerfile", `ARG APP_VERSION=${version}`], + ["README.md", `Version ${version}`], + ["CHANGELOG.md", `## ${version} -`], + ["docs/TUNNEL_ROLES.md", `PC FileBridge ${version}`], +]); +for (const [relativePath, needle] of exactNeedles) { + const text = await read(relativePath); + if (!text.includes(needle)) throw new Error(`Version mismatch in ${relativePath}.`); +} + +process.stdout.write(`VERSION_CONSISTENCY_PASS version=${version} checked=${exactNeedles.size + 3}\n`); diff --git a/scripts/volume-discovery.windows.test.ps1 b/scripts/volume-discovery.windows.test.ps1 new file mode 100644 index 0000000..cf6f08a --- /dev/null +++ b/scripts/volume-discovery.windows.test.ps1 @@ -0,0 +1,143 @@ +[CmdletBinding()] +param() + +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' + +$tempBase = [IO.Path]::GetFullPath([IO.Path]::GetTempPath()) +$tempRoot = Join-Path $tempBase ('pc-filebridge-volume-test-' + [Guid]::NewGuid().ToString('N')) +[IO.Directory]::CreateDirectory($tempRoot) | Out-Null +$resolvedTemp = [IO.Path]::GetFullPath($tempRoot) +if (-not $resolvedTemp.StartsWith($tempBase, [StringComparison]::OrdinalIgnoreCase)) { throw 'TEMP_SCOPE_INVALID' } +$encoding = New-Object Text.UTF8Encoding($false) +$previousLocalAppData = $env:LOCALAPPDATA + +function Write-Json([string]$Path, [object]$Value) { + [IO.File]::WriteAllText($Path, (($Value | ConvertTo-Json -Depth 12) + [Environment]::NewLine), $encoding) +} + +function Assert-Throws([scriptblock]$Action, [string]$ExpectedCode) { + try { & $Action } catch { + if ($_.Exception.Message -ceq $ExpectedCode) { return } + throw + } + throw "Expected $ExpectedCode" +} + +function New-VolumeFixture( + [string]$DeviceID, + [int]$DriveType = 3, + [string]$VolumeName = 'Fixture', + [string]$BusType = 'NVMe', + [string]$FileSystem = 'NTFS', + [string]$HealthStatus = 'Healthy', + [string]$IdentityToken = '', + [bool]$Online = $true +) { + $token = if ([string]::IsNullOrWhiteSpace($IdentityToken)) { $DeviceID.Substring(0, 1).ToLowerInvariant() } else { $IdentityToken } + [ordered]@{ + DeviceID = $DeviceID + DriveType = $DriveType + VolumeName = $VolumeName + VolumeSerialNumber = "serial-$token" + FileSystem = $FileSystem + HealthStatus = $HealthStatus + BusType = $BusType + DiskUniqueId = "disk-$token" + PartitionUniqueId = "partition-$token" + VolumeUniqueId = "volume-$token" + Online = $Online + } +} + +try { + $env:LOCALAPPDATA = Join-Path $tempRoot 'localappdata' + $privateRoot = Join-Path $env:LOCALAPPDATA 'PCFileBridge\private' + [IO.Directory]::CreateDirectory($privateRoot) | Out-Null + $registry = Join-Path $privateRoot 'volume-approvals.pc-local.json' + $inventory = Join-Path $tempRoot 'inventory.json' + $output = Join-Path $tempRoot 'roots.auto.json' + $missingIdentity = New-VolumeFixture -DeviceID 'M:' -BusType 'SATA' + $missingIdentity.DiskUniqueId = '' + Write-Json -Path $inventory -Value ([ordered]@{ volumes = @( + (New-VolumeFixture -DeviceID 'E:' -VolumeName 'LABS' -BusType 'File Backed Virtual'), + (New-VolumeFixture -DeviceID 'C:' -VolumeName 'System' -BusType 'NVMe'), + (New-VolumeFixture -DeviceID 'R:' -DriveType 2 -VolumeName 'Removable' -BusType 'USB'), + (New-VolumeFixture -DeviceID 'D:' -VolumeName 'Data' -BusType 'SATA'), + (New-VolumeFixture -DeviceID 'U:' -VolumeName 'USB-fixed' -BusType 'USB'), + (New-VolumeFixture -DeviceID 'X:' -VolumeName 'WrongFS' -BusType 'SATA' -FileSystem 'exFAT'), + (New-VolumeFixture -DeviceID 'Q:' -VolumeName 'ReFS' -BusType 'SATA' -FileSystem 'ReFS'), + (New-VolumeFixture -DeviceID 'Y:' -VolumeName 'Unhealthy' -BusType 'SATA' -HealthStatus 'Unhealthy'), + (New-VolumeFixture -DeviceID 'Z:' -VolumeName 'Network' -BusType 'Network'), + $missingIdentity + ) }) + + $candidateSet = & (Join-Path $PSScriptRoot 'Get-PCFileBridgeVolumeCandidates.ps1') -Role pc-local -InventoryPath $inventory -ApprovalRegistryPath $registry + $virtual = @($candidateSet.candidates | Where-Object { $_.current_drive_letter -ceq 'E' }) + if ($virtual.Count -ne 1 -or $virtual[0].reason -cne 'OPERATOR_APPROVAL_REQUIRED') { throw 'VIRTUAL_AUTO_ALLOW_NOT_BLOCKED' } + $usb = @($candidateSet.candidates | Where-Object { $_.current_drive_letter -ceq 'U' }) + if ($usb.Count -ne 1 -or $usb[0].reason -cne 'OPERATOR_APPROVAL_REQUIRED') { throw 'USB_FIXED_AUTO_ALLOW_NOT_BLOCKED' } + $refs = @($candidateSet.candidates | Where-Object { $_.current_drive_letter -ceq 'Q' }) + if ($refs.Count -ne 1 -or $refs[0].reason -cne 'UNSUPPORTED_FILESYSTEM') { throw 'REFS_NOT_AUTO_DISABLED' } + $missing = @($candidateSet.candidates | Where-Object { $_.current_drive_letter -ceq 'M' }) + if ($missing.Count -ne 1 -or $missing[0].reason -cne 'VOLUME_IDENTITY_UNAVAILABLE') { throw 'MISSING_IDENTITY_NOT_BLOCKED' } + + $first = & (Join-Path $PSScriptRoot 'Update-PCFileBridgeVolumeConfig.ps1') -Role pc-local -OutputPath $output -InventoryPath $inventory -ApprovalRegistryPath $registry + if ((@($first.root_ids) -join ',') -cne 'pc-c,pc-d') { throw 'AUTO_POLICY_FILTER_FAILED' } + if ([int]$first.blocked_volume_count -ne 8) { throw 'VOLUME_POLICY_BLOCK_COUNT_FAILED' } + + $virtualId = [string]$virtual[0].volume_id + & (Join-Path $PSScriptRoot 'Approve-PCFileBridgeVolume.ps1') -Role pc-local -VolumeId $virtualId -BusType 'File Backed Virtual' -Reason 'task-owned live VHDX verification fixture' -RegistryPath $registry -Confirm:$false | Out-Null + $approved = & (Join-Path $PSScriptRoot 'Update-PCFileBridgeVolumeConfig.ps1') -Role pc-local -OutputPath $output -InventoryPath $inventory -ApprovalRegistryPath $registry + if ((@($approved.root_ids) -join ',') -cne 'pc-c,pc-d,pc-e') { throw 'APPROVED_VIRTUAL_NOT_ACCEPTED' } + $config = Get-Content -Raw -LiteralPath $output | ConvertFrom-Json + $rootE = @($config.roots | Where-Object { $_.id -ceq 'pc-e' }) + if ($rootE.Count -ne 1 -or [string]$rootE[0].volume_id -cne $virtualId -or [string]$rootE[0].host_id -cne 'pc-main') { throw 'ROOT_METADATA_INVALID' } + if ($rootE[0].PSObject.Properties.Name -contains 'DiskUniqueId') { throw 'RAW_IDENTIFIER_EXPOSED' } + $registryInfo = New-Object IO.FileInfo($registry) + $acl = if ($PSVersionTable.PSEdition -ceq 'Core') { + [System.IO.FileSystemAclExtensions]::GetAccessControl($registryInfo) + } else { + $registryInfo.GetAccessControl() + } + if (-not $acl.AreAccessRulesProtected) { throw 'APPROVAL_REGISTRY_ACL_NOT_PROTECTED' } + + $same = & (Join-Path $PSScriptRoot 'Update-PCFileBridgeVolumeConfig.ps1') -Role pc-local -OutputPath $output -InventoryPath $inventory -ApprovalRegistryPath $registry + if ([bool]$same.changed) { throw 'UNCHANGED_INVENTORY_REWROTE_CONFIG' } + + $remount = Join-Path $tempRoot 'remount.json' + Write-Json -Path $remount -Value ([ordered]@{ volumes = @( + (New-VolumeFixture -DeviceID 'C:' -VolumeName 'System' -BusType 'NVMe'), + (New-VolumeFixture -DeviceID 'D:' -VolumeName 'Data' -BusType 'SATA'), + (New-VolumeFixture -DeviceID 'F:' -VolumeName 'LABS' -BusType 'File Backed Virtual' -IdentityToken 'e') + ) }) + $second = & (Join-Path $PSScriptRoot 'Update-PCFileBridgeVolumeConfig.ps1') -Role pc-local -OutputPath $output -InventoryPath $remount -ApprovalRegistryPath $registry + $remountConfig = Get-Content -Raw -LiteralPath $output | ConvertFrom-Json + $rootF = @($remountConfig.roots | Where-Object { $_.id -ceq 'pc-f' }) + if ($rootF.Count -ne 1 -or [string]$rootF[0].volume_id -cne $virtualId) { throw 'LETTER_CHANGE_CHANGED_VOLUME_ID' } + if ([string]$second.topology_sha256 -ceq [string]$approved.topology_sha256) { throw 'LETTER_CHANGE_DID_NOT_CHANGE_TOPOLOGY' } + + $collision = Join-Path $tempRoot 'collision.json' + Write-Json -Path $collision -Value ([ordered]@{ volumes = @( + (New-VolumeFixture -DeviceID 'C:' -BusType 'NVMe' -IdentityToken 'same'), + (New-VolumeFixture -DeviceID 'D:' -BusType 'SATA' -IdentityToken 'same') + ) }) + Assert-Throws -ExpectedCode 'VOLUME_IDENTITY_COLLISION' -Action { + & (Join-Path $PSScriptRoot 'Update-PCFileBridgeVolumeConfig.ps1') -Role pc-local -OutputPath (Join-Path $tempRoot 'collision-output.json') -InventoryPath $collision -ApprovalRegistryPath $registry | Out-Null + } + + & (Join-Path $PSScriptRoot 'Revoke-PCFileBridgeVolumeApproval.ps1') -Role pc-local -VolumeId $virtualId -RegistryPath $registry -Confirm:$false | Out-Null + $revoked = & (Join-Path $PSScriptRoot 'Update-PCFileBridgeVolumeConfig.ps1') -Role pc-local -OutputPath $output -InventoryPath $inventory -ApprovalRegistryPath $registry + if ((@($revoked.root_ids) -join ',') -cne 'pc-c,pc-d') { throw 'REVOKED_VOLUME_REMAINED' } + + $missingRequired = Join-Path $tempRoot 'missing-c.json' + Write-Json -Path $missingRequired -Value ([ordered]@{ volumes = @((New-VolumeFixture -DeviceID 'D:' -BusType 'SATA')) }) + Assert-Throws -ExpectedCode 'ROOT_ROLE_MISMATCH' -Action { + & (Join-Path $PSScriptRoot 'Update-PCFileBridgeVolumeConfig.ps1') -Role pc-local -OutputPath (Join-Path $tempRoot 'missing-c-output.json') -InventoryPath $missingRequired -ApprovalRegistryPath $registry | Out-Null + } + + Write-Output 'VOLUME_DISCOVERY_WINDOWS_TEST_PASS stable_id=pass letter_change=pass topology=pass usb_fixed=blocked refs=disabled approval=pass revoke=pass collision=blocked acl=pass' +} finally { + $env:LOCALAPPDATA = $previousLocalAppData + if (Test-Path -LiteralPath $resolvedTemp) { Remove-Item -LiteralPath $resolvedTemp -Recurse -Force } +} diff --git a/src/filePolicy.ts b/src/filePolicy.ts index e3e179a..d4073f1 100644 --- a/src/filePolicy.ts +++ b/src/filePolicy.ts @@ -1,5 +1,6 @@ import { createHash } from "node:crypto"; import { open, lstat, mkdir, opendir, readFile, realpath } from "node:fs/promises"; +import type { BigIntStats } from "node:fs"; import path from "node:path"; import { TextDecoder } from "node:util"; import { z } from "zod"; @@ -10,6 +11,13 @@ const RootConfigSchema = z.object({ path: z.string().min(1), read: z.boolean(), create: z.boolean(), + host_id: z.string().regex(/^[a-z][a-z0-9-]{0,63}$/).optional(), + volume_id: z.string().regex(/^vol-[a-f0-9]{16}$/).optional(), + current_drive_letter: z.string().regex(/^[A-Z]$/).optional(), + filesystem: z.string().min(1).max(32).optional(), + bus_type: z.string().min(1).max(64).optional(), + online: z.boolean().optional(), + auto_discovered: z.boolean().optional(), }).strict(); const LimitsSchema = z.object({ @@ -22,7 +30,7 @@ const LimitsSchema = z.object({ export const FileBridgeConfigSchema = z.object({ version: z.literal(1), - roots: z.array(RootConfigSchema).min(1).max(16), + roots: z.array(RootConfigSchema).min(1).max(26), limits: LimitsSchema, }).strict(); @@ -32,6 +40,16 @@ type Limits = z.infer; interface RuntimeRoot extends RootConfig { canonicalPath: string; + identity: FileIdentity; +} + +type FileIdentity = Pick; +type FileIdentityInput = { dev: number | bigint; ino: number | bigint }; + +interface AuthorizedExistingPath { + target: string; + info: BigIntStats; + storedParts: string[]; } export class PolicyError extends Error { @@ -97,6 +115,7 @@ const BLOCKED_EXTENSIONS = new Set([ const SSH_PRIVATE_KEY_FILENAME = /^id_(?:rsa|dsa|ecdsa|ed25519)(?:[._-].*)?$/; const WINDOWS_RESERVED = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\..*)?$/i; const DRIVE_ROOT_OPT_IN = "I_ACCEPT_FULL_DRIVE_ACCESS_RISK"; +const MAX_CANONICALIZATION_ENTRIES = 25_000; export interface ReadTextResult { root_id: string; @@ -142,11 +161,14 @@ export class FileBridgePolicy { } let canonicalPath: string; + let rootInfo: BigIntStats; try { - canonicalPath = await realpath(path.resolve(configured.path)); - const info = await lstat(canonicalPath); - if (!info.isDirectory() || info.isSymbolicLink()) throw new Error("not a real directory"); - } catch { + const authorized = await authorizeConfiguredRoot(configured.path); + canonicalPath = authorized.target; + rootInfo = authorized.info; + if (!rootInfo.isDirectory() || rootInfo.isSymbolicLink()) throw new Error("not a real directory"); + } catch (error) { + if (error instanceof PolicyError) throw error; throw new PolicyError("CONFIG_ROOT_UNAVAILABLE", `Configured root '${configured.id}' is unavailable.`); } @@ -157,38 +179,59 @@ export class FileBridgePolicy { ); } - roots.set(configured.id, { ...configured, canonicalPath }); + roots.set(configured.id, { ...configured, canonicalPath, identity: identityOf(rootInfo) }); } return new FileBridgePolicy(roots, validated.limits); } - listRoots(): Array<{ id: string; label: string; read: boolean; create: boolean; full_drive: boolean }> { + listRoots(): Array<{ + id: string; + label: string; + read: boolean; + create: boolean; + full_drive: boolean; + host_id?: string; + volume_id?: string; + current_drive_letter?: string; + filesystem?: string; + bus_type?: string; + online?: boolean; + auto_discovered?: boolean; + }> { return [...this.roots.values()].map((root) => ({ id: root.id, label: root.label, read: root.read, create: root.create, full_drive: isFilesystemRoot(root.canonicalPath), + ...(root.host_id === undefined ? {} : { host_id: root.host_id }), + ...(root.volume_id === undefined ? {} : { volume_id: root.volume_id }), + ...(root.current_drive_letter === undefined ? {} : { current_drive_letter: root.current_drive_letter }), + ...(root.filesystem === undefined ? {} : { filesystem: root.filesystem }), + ...(root.bus_type === undefined ? {} : { bus_type: root.bus_type }), + ...(root.online === undefined ? {} : { online: root.online }), + ...(root.auto_discovered === undefined ? {} : { auto_discovered: root.auto_discovered }), })); } async statPath(rootId: string, relativePath: string) { const resolved = await this.resolveForRead(rootId, relativePath); - const info = await lstat(resolved.target); + const info = resolved.info; if (info.isSymbolicLink()) throw new PolicyError("LINK_BLOCKED", "Links and junctions are blocked."); + await assertUnchanged(resolved.target, info); return { root_id: rootId, path: logicalPath(relativePath), kind: info.isFile() ? "file" : info.isDirectory() ? "directory" : "other", - size: info.size, + size: Number(info.size), modified_at: info.mtime.toISOString(), }; } async listDirectory(rootId: string, relativePath: string, requestedLimit?: number) { const resolved = await this.resolveForRead(rootId, relativePath); - const directoryInfo = await lstat(resolved.target); + const directoryInfo = resolved.info; if (!directoryInfo.isDirectory()) throw new PolicyError("NOT_A_DIRECTORY", "The requested path is not a directory."); const limit = Math.min(requestedLimit ?? this.limits.maxDirectoryEntries, this.limits.maxDirectoryEntries); @@ -210,13 +253,14 @@ export class FileBridgePolicy { kind: entry.isFile() ? "file" : entry.isDirectory() ? "directory" : "other", }); } + await assertUnchanged(resolved.target, directoryInfo); entries.sort((left, right) => left.name.localeCompare(right.name)); return { root_id: rootId, path: logicalPath(relativePath), entries, blocked_entries, truncated }; } async readTextFile(rootId: string, relativePath: string, requestedMaxBytes?: number): Promise { const resolved = await this.resolveForRead(rootId, relativePath); - const before = await lstat(resolved.target); + const before = resolved.info; if (!before.isFile() || before.isSymbolicLink()) { throw new PolicyError("NOT_A_REGULAR_FILE", "Only regular files can be read."); } @@ -224,22 +268,22 @@ export class FileBridgePolicy { const limit = Math.min(requestedMaxBytes ?? this.limits.maxReadBytes, this.limits.maxReadBytes); const handle = await open(resolved.target, "r"); try { - const after = await handle.stat(); - if (!after.isFile() || !sameFile(before, after)) { + const after = await handle.stat({ bigint: true }); + if (!after.isFile() || !sameFileIdentity(before, after)) { throw new PolicyError("PATH_CHANGED", "The file changed while it was being opened."); } - const bytesToRead = Math.min(after.size, limit); + const bytesToRead = Number(after.size < BigInt(limit) ? after.size : BigInt(limit)); const buffer = Buffer.alloc(bytesToRead); const { bytesRead } = await handle.read(buffer, 0, bytesToRead, 0); const returned = buffer.subarray(0, bytesRead); - const text = decodeUtf8(returned, after.size > bytesRead); + const text = decodeUtf8(returned, after.size > BigInt(bytesRead)); const redacted = redactSecrets(text); return { root_id: rootId, path: logicalPath(relativePath), bytes_returned: bytesRead, - file_bytes: after.size, - truncated: after.size > bytesRead, + file_bytes: Number(after.size), + truncated: after.size > BigInt(bytesRead), sha256_returned: createHash("sha256").update(returned).digest("hex"), redactions: redacted.count, text: redacted.text, @@ -253,7 +297,7 @@ export class FileBridgePolicy { const normalizedQuery = query.trim().toLocaleLowerCase(); if (!normalizedQuery) throw new PolicyError("INVALID_QUERY", "Search query cannot be empty."); const start = await this.resolveForRead(rootId, startPath); - const startInfo = await lstat(start.target); + const startInfo = start.info; if (!startInfo.isDirectory()) throw new PolicyError("NOT_A_DIRECTORY", "Search start path is not a directory."); const queue = [logicalPath(startPath) === "." ? "" : logicalPath(startPath)]; @@ -301,12 +345,20 @@ export class FileBridgePolicy { async createDirectory(rootId: string, relativePath: string) { const resolved = await this.resolveForCreate(rootId, relativePath); if (!resolved.normalizedRelative) throw new PolicyError("ROOT_WRITE_BLOCKED", "The configured root cannot be created or replaced."); - await this.assertCreateParent(resolved.root, resolved.target); try { await mkdir(resolved.target, { recursive: false }); } catch (error) { throw translateCreateError(error); } + await assertUnchanged(resolved.parent.target, resolved.parent.info); + try { + await authorizeExistingPath(resolved.root, resolved.normalizedRelative); + } catch { + throw new PolicyError( + "CREATE_INCOMPLETE", + "The new directory was created but post-create authorization failed; FileBridge will not delete it automatically.", + ); + } return { root_id: rootId, path: logicalPath(relativePath), created: true, kind: "directory" as const }; } @@ -318,8 +370,6 @@ export class FileBridgePolicy { if (data.byteLength > this.limits.maxWriteBytes) { throw new PolicyError("WRITE_LIMIT_EXCEEDED", `New file content exceeds the ${this.limits.maxWriteBytes}-byte limit.`); } - await this.assertCreateParent(resolved.root, resolved.target); - let handle; try { handle = await open(resolved.target, "wx", 0o600); @@ -327,8 +377,18 @@ export class FileBridgePolicy { throw translateCreateError(error); } try { + const [opened, named] = await Promise.all([handle.stat({ bigint: true }), lstat(resolved.target, { bigint: true })]); + if (!opened.isFile() || named.isSymbolicLink() || !sameFileIdentity(opened, named)) { + throw new PolicyError("PATH_CHANGED", "The new file path changed while it was being opened."); + } + await assertUnchanged(resolved.parent.target, resolved.parent.info); await handle.writeFile(data); await handle.sync(); + const [written, finalNamed] = await Promise.all([handle.stat({ bigint: true }), lstat(resolved.target, { bigint: true })]); + if (!written.isFile() || finalNamed.isSymbolicLink() || !sameFileIdentity(written, finalNamed)) { + throw new PolicyError("PATH_CHANGED", "The new file path changed while it was being written."); + } + await assertUnchanged(resolved.parent.target, resolved.parent.info); } catch { throw new PolicyError( "WRITE_INCOMPLETE", @@ -358,62 +418,62 @@ export class FileBridgePolicy { private async resolveForRead(rootId: string, relativePath: string) { const root = this.getRoot(rootId, "read"); - const resolved = resolveLogicalPath(root, relativePath); - await assertNoLinks(root.canonicalPath, resolved.target); - let canonicalTarget: string; - try { - canonicalTarget = await realpath(resolved.target); - } catch { - throw new PolicyError("PATH_NOT_FOUND", "The requested path does not exist."); - } - if (!isWithin(root.canonicalPath, canonicalTarget)) throw new PolicyError("PATH_ESCAPE_BLOCKED", "Path escapes the configured root."); - return resolved; + const normalizedRelative = validateRelativePath(relativePath); + const authorized = await authorizeExistingPath(root, normalizedRelative); + return { root, normalizedRelative, ...authorized }; } private async resolveForCreate(rootId: string, relativePath: string) { const root = this.getRoot(rootId, "create"); - const resolved = resolveLogicalPath(root, relativePath); - await assertNoLinks(root.canonicalPath, path.dirname(resolved.target)); - return resolved; - } - - private async assertCreateParent(root: RuntimeRoot, target: string): Promise { - const parent = path.dirname(target); - let canonicalParent: string; - try { - canonicalParent = await realpath(parent); - const parentInfo = await lstat(parent); - if (!parentInfo.isDirectory() || parentInfo.isSymbolicLink()) throw new Error("unsafe parent"); - } catch { + const normalizedRelative = validateRelativePath(relativePath); + const parts = splitNormalizedPath(normalizedRelative); + if (parts.length === 0) { + return { + root, + target: root.canonicalPath, + normalizedRelative, + parent: await authorizeExistingPath(root, ""), + }; + } + const leaf = parts.pop()!; + const parentRelative = parts.join(path.sep); + const parent = await authorizeExistingPath(root, parentRelative); + if (!parent.info.isDirectory()) { throw new PolicyError("PARENT_UNAVAILABLE", "The parent directory must already exist and cannot be a link."); } - if (!isWithin(root.canonicalPath, canonicalParent)) throw new PolicyError("PATH_ESCAPE_BLOCKED", "Parent escapes the configured root."); + const target = path.join(parent.target, leaf); + if (!isWithin(root.canonicalPath, target)) throw new PolicyError("PATH_ESCAPE_BLOCKED", "Path escapes the configured root."); + return { root, target, normalizedRelative, parent }; } } -function resolveLogicalPath(root: RuntimeRoot, relativePath: string) { - const normalizedRelative = validateRelativePath(relativePath); - const target = path.resolve(root.canonicalPath, normalizedRelative || "."); - if (!isWithin(root.canonicalPath, target)) throw new PolicyError("PATH_ESCAPE_BLOCKED", "Path escapes the configured root."); - return { root, target, normalizedRelative }; -} - function validateRelativePath(input: string): string { if (typeof input !== "string" || input.includes("\u0000")) throw new PolicyError("INVALID_PATH", "Path is invalid."); if (path.isAbsolute(input) || path.win32.isAbsolute(input) || path.posix.isAbsolute(input)) { throw new PolicyError("ABSOLUTE_PATH_BLOCKED", "Use a configured root id and a relative path."); } + if ((input.includes("/") && input.includes("\\")) || /[\\/]{2,}/u.test(input)) { + throw new PolicyError("AMBIGUOUS_PATH_BLOCKED", "Mixed or repeated path separators are not allowed."); + } const parts = input.split(/[\\/]+/).filter(Boolean); for (const part of parts) { - if (part === "." || part === "..") throw new PolicyError("PATH_TRAVERSAL_BLOCKED", "Dot segments are not allowed."); - if (/[<>:"|?*\u0000-\u001f]/u.test(part) || /[. ]$/u.test(part) || WINDOWS_RESERVED.test(part)) { - throw new PolicyError("INVALID_PATH_COMPONENT", "Path contains a blocked Windows path component."); - } - if (isBlockedPart(part)) throw new PolicyError("SENSITIVE_PATH_BLOCKED", "Sensitive credential or system paths are blocked."); + validatePathComponent(part); } return parts.join(path.sep); } +function validatePathComponent(part: string): void { + validatePathComponentSyntax(part); + if (isBlockedPart(part)) throw new PolicyError("SENSITIVE_PATH_BLOCKED", "Sensitive credential or system paths are blocked."); +} + +function validatePathComponentSyntax(part: string): void { + if (part === "." || part === "..") throw new PolicyError("PATH_TRAVERSAL_BLOCKED", "Dot segments are not allowed."); + if (/[<>:"|?*\u0000-\u001f]/u.test(part) || /[. ]$/u.test(part) || WINDOWS_RESERVED.test(part)) { + throw new PolicyError("INVALID_PATH_COMPONENT", "Path contains a blocked Windows path component."); + } +} + function isBlockedPart(part: string): boolean { const lower = part.toLocaleLowerCase(); return BLOCKED_SEGMENTS.has(lower) @@ -423,21 +483,186 @@ function isBlockedPart(part: string): boolean { || BLOCKED_EXTENSIONS.has(path.extname(lower)); } -async function assertNoLinks(root: string, target: string): Promise { - if (!isWithin(root, target)) throw new PolicyError("PATH_ESCAPE_BLOCKED", "Path escapes the configured root."); - const relative = path.relative(root, target); +async function authorizeConfiguredRoot(configuredPath: string): Promise { + const absolute = path.resolve(configuredPath); + const filesystemRoot = path.parse(absolute).root; + const relative = path.relative(filesystemRoot, absolute); const parts = relative ? relative.split(path.sep) : []; - let current = root; - for (const part of ["", ...parts]) { - if (part) current = path.join(current, part); + for (const part of parts) validatePathComponentSyntax(part); + + let rootInfo: BigIntStats; + try { + rootInfo = await lstat(filesystemRoot, { bigint: true }); + } catch { + throw new PolicyError("CONFIG_ROOT_UNAVAILABLE", "Configured root filesystem is unavailable."); + } + assertSafeObject(rootInfo); + const result = await authorizeStoredComponents( + filesystemRoot, + rootInfo, + parts, + filesystemRoot, + false, + Math.max(parts.length - 1, 0), + ); + if (!result.info.isDirectory()) { + throw new PolicyError("CONFIG_ROOT_UNAVAILABLE", "Configured root must be a directory."); + } + if (result.storedParts.length > 0 && isBlockedPart(result.storedParts.at(-1)!)) { + throw new PolicyError("SENSITIVE_PATH_BLOCKED", "A configured root cannot itself be a sensitive path."); + } + return result; +} + +async function authorizeExistingPath(root: RuntimeRoot, normalizedRelative: string): Promise { + let rootInfo: BigIntStats; + try { + rootInfo = await lstat(root.canonicalPath, { bigint: true }); + } catch { + throw new PolicyError("PATH_UNAVAILABLE", "The configured root is unavailable."); + } + assertSafeObject(rootInfo); + if (!sameFileIdentity(root.identity, rootInfo)) { + throw new PolicyError("PATH_CHANGED", "The configured root changed after startup."); + } + const parts = splitNormalizedPath(normalizedRelative); + return authorizeStoredComponents(root.canonicalPath, rootInfo, parts, root.canonicalPath); +} + +async function authorizeStoredComponents( + start: string, + startInfo: BigIntStats, + suppliedParts: string[], + boundary: string, + enforceSensitiveNames = true, + enforceAlternateFromIndex = 0, +): Promise { + let current = start; + let currentInfo = startInfo; + const storedParts: string[] = []; + + for (let partIndex = 0; partIndex < suppliedParts.length; partIndex += 1) { + const suppliedPart = suppliedParts[partIndex]!; + if (!currentInfo.isDirectory()) { + throw new PolicyError("PATH_NOT_FOUND", "A parent path component is not a directory."); + } + const suppliedTarget = path.join(current, suppliedPart); + if (!isWithin(boundary, suppliedTarget)) { + throw new PolicyError("PATH_ESCAPE_BLOCKED", "Path escapes the configured root."); + } + + let suppliedInfo: BigIntStats; try { - const info = await lstat(current); - if (info.isSymbolicLink()) throw new PolicyError("LINK_BLOCKED", "Links and junctions are blocked."); + suppliedInfo = await lstat(suppliedTarget, { bigint: true }); } catch (error) { - if (error instanceof PolicyError) throw error; - if (isNodeError(error) && error.code === "ENOENT") return; + if (isNodeError(error) && error.code === "ENOENT") { + throw new PolicyError("PATH_NOT_FOUND", "The requested path does not exist."); + } throw new PolicyError("PATH_UNAVAILABLE", "A path component is unavailable."); } + assertSafeObject(suppliedInfo); + + const matches: Array<{ name: string; info: BigIntStats }> = []; + let scanned = 0; + let directory; + try { + directory = await opendir(current); + for await (const entry of directory) { + scanned += 1; + if (scanned > MAX_CANONICALIZATION_ENTRIES) { + throw new PolicyError("PATH_IDENTITY_UNAVAILABLE", "Directory identity mapping exceeded the safety bound."); + } + let candidateInfo: BigIntStats; + try { + candidateInfo = await lstat(path.join(current, entry.name), { bigint: true }); + } catch { + continue; + } + if (!hasStableIdentity(candidateInfo)) continue; + if (sameFileIdentity(suppliedInfo, candidateInfo)) matches.push({ name: entry.name, info: candidateInfo }); + } + } finally { + await directory?.close().catch(() => undefined); + } + + await assertUnchanged(current, currentInfo); + if (matches.length === 0) { + throw new PolicyError("PATH_IDENTITY_UNAVAILABLE", "The stored path name could not be established safely."); + } + if (matches.length !== 1) { + throw new PolicyError("PATH_IDENTITY_AMBIGUOUS", "Multiple stored names identify the same filesystem object."); + } + + const stored = matches[0]!; + if (enforceSensitiveNames && isBlockedPart(stored.name)) { + throw new PolicyError("SENSITIVE_PATH_BLOCKED", "Sensitive credential or system paths are blocked."); + } + if (partIndex >= enforceAlternateFromIndex && !sameSpellingOrWindowsCase(suppliedPart, stored.name)) { + throw new PolicyError("ALTERNATE_NAME_BLOCKED", "Alternate filesystem names are blocked."); + } + + const storedTarget = path.join(current, stored.name); + await assertUnchanged(storedTarget, suppliedInfo); + const canonicalTarget = await realpath(storedTarget).catch(() => { + throw new PolicyError("PATH_CHANGED", "A path component changed during canonicalization."); + }); + if (!isWithin(boundary, canonicalTarget)) { + throw new PolicyError("PATH_ESCAPE_BLOCKED", "Path escapes the configured root."); + } + await assertUnchanged(canonicalTarget, suppliedInfo); + current = canonicalTarget; + currentInfo = stored.info; + storedParts.push(stored.name); + } + + if (currentInfo.isFile() && currentInfo.nlink > 1n) { + throw new PolicyError("HARDLINK_BLOCKED", "Files with multiple hard links are blocked."); + } + return { target: current, info: currentInfo, storedParts }; +} + +function splitNormalizedPath(value: string): string[] { + return value ? value.split(path.sep) : []; +} + +function sameSpellingOrWindowsCase(supplied: string, stored: string): boolean { + if (supplied === stored) return true; + return process.platform === "win32" && supplied.toLowerCase() === stored.toLowerCase(); +} + +function assertSafeObject(info: BigIntStats): void { + if (info.isSymbolicLink()) throw new PolicyError("LINK_BLOCKED", "Links and junctions are blocked."); + if (!info.isFile() && !info.isDirectory()) { + throw new PolicyError("UNSUPPORTED_OBJECT_BLOCKED", "Unsupported filesystem objects and reparse points are blocked."); + } + assertStableIdentity(info); +} + +function assertStableIdentity(info: FileIdentity): void { + if (!hasStableIdentity(info)) { + throw new PolicyError("PATH_IDENTITY_UNAVAILABLE", "Stable filesystem identity is unavailable."); + } +} + +function hasStableIdentity(info: FileIdentity): boolean { + return info.dev >= 0n && info.ino > 0n; +} + +function identityOf(info: FileIdentity): FileIdentity { + assertStableIdentity(info); + return { dev: info.dev, ino: info.ino }; +} + +async function assertUnchanged(target: string, expected: FileIdentity): Promise { + let current: BigIntStats; + try { + current = await lstat(target, { bigint: true }); + } catch { + throw new PolicyError("PATH_CHANGED", "The path changed during authorization."); + } + assertSafeObject(current); + if (!sameFileIdentity(expected, current)) { + throw new PolicyError("PATH_CHANGED", "The path changed during authorization."); } } @@ -456,9 +681,19 @@ function logicalPath(value: string): string { return normalized ? normalized.split(path.sep).join("/") : "."; } -function sameFile(left: { dev: number; ino: number }, right: { dev: number; ino: number }): boolean { - if (left.ino === 0 || right.ino === 0) return true; - return left.dev === right.dev && left.ino === right.ino; +export function sameFileIdentity(left: FileIdentityInput, right: FileIdentityInput): boolean { + const leftDev = exactBigInt(left.dev); + const leftIno = exactBigInt(left.ino); + const rightDev = exactBigInt(right.dev); + const rightIno = exactBigInt(right.ino); + if (leftDev === null || leftIno === null || rightDev === null || rightIno === null + || leftDev < 0n || rightDev < 0n || leftIno <= 0n || rightIno <= 0n) return false; + return leftDev === rightDev && leftIno === rightIno; +} + +function exactBigInt(value: number | bigint): bigint | null { + if (typeof value === "bigint") return value; + return Number.isSafeInteger(value) ? BigInt(value) : null; } function decodeUtf8(buffer: Buffer, truncated: boolean): string { diff --git a/src/server.ts b/src/server.ts index 891c929..977d4dc 100644 --- a/src/server.ts +++ b/src/server.ts @@ -28,7 +28,7 @@ async function main(): Promise { const configPath = path.resolve(process.env.FILEBRIDGE_CONFIG ?? path.join(pluginRoot, "config", "roots.local.json")); const policy = await FileBridgePolicy.fromFile(configPath); const server = new McpServer( - { name: "pc-filebridge", version: "0.1.1" }, + { name: "pc-filebridge", version: "0.2.1" }, { instructions: "Create-only filesystem bridge. Use only configured root IDs and relative paths. " + diff --git a/test/filePolicy.test.ts b/test/filePolicy.test.ts index 750d6b3..26b8022 100644 --- a/test/filePolicy.test.ts +++ b/test/filePolicy.test.ts @@ -1,8 +1,7 @@ -import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from "node:fs/promises"; -import { tmpdir } from "node:os"; +import { link, mkdir, mkdtemp, readFile, rm, symlink, writeFile } from "node:fs/promises"; import path from "node:path"; import { afterEach, describe, expect, test } from "vitest"; -import { FileBridgePolicy, type FileBridgeConfig, PolicyError } from "../src/filePolicy.js"; +import { FileBridgePolicy, type FileBridgeConfig, PolicyError, sameFileIdentity } from "../src/filePolicy.js"; const cleanup: string[] = []; @@ -11,7 +10,7 @@ afterEach(async () => { }); async function fixture() { - const base = await mkdtemp(path.join(tmpdir(), "pc-filebridge-test-")); + const base = await mkdtemp(path.join(process.cwd(), ".pc-filebridge-test-")); cleanup.push(base); const root = path.join(base, "allowed"); await mkdir(root); @@ -53,7 +52,7 @@ describe("create-only invariant", () => { }); }); -describe("path containment", () => { +describe("path containment", () => { test.each(["../outside.txt", "folder/../../outside.txt", "C:\\Windows\\win.ini", "\\\\server\\share\\file.txt"])( "blocks traversal or absolute path: %s", async (unsafe) => { @@ -105,6 +104,41 @@ describe("path containment", () => { const { policy } = await fixture(); await expect(policy.statPath("test", unsafe)).rejects.toMatchObject({ code: "INVALID_PATH_COMPONENT" }); }); + + test.each([ + "\\\\?\\C:\\Windows\\win.ini", + "\\\\.\\PhysicalDrive0", + "\\rooted", + "/rooted", + "C:drive-relative.txt", + "folder/child\\mixed.txt", + "folder//double.txt", + "folder/./dot.txt", + ])("fails closed for an ambiguous Windows path representation: %s", async (unsafe) => { + const { policy } = await fixture(); + await expect(policy.statPath("test", unsafe)).rejects.toBeInstanceOf(PolicyError); + }); + + test("fails closed for zero, unsafe, or ambiguous file identity", async () => { + expect(sameFileIdentity({ dev: 1, ino: 0 }, { dev: 1, ino: 0 })).toBe(false); + expect(sameFileIdentity({ dev: 1, ino: Number.MAX_SAFE_INTEGER + 1 }, { dev: 1, ino: Number.MAX_SAFE_INTEGER + 1 })).toBe(false); + expect(sameFileIdentity({ dev: 1n, ino: 2n }, { dev: 1n, ino: 2n })).toBe(true); + + const { root, policy } = await fixture(); + await writeFile(path.join(root, "hardlink-source.txt"), "fixture", "utf8"); + await link(path.join(root, "hardlink-source.txt"), path.join(root, "hardlink-peer.txt")); + await expect(policy.statPath("test", "hardlink-source.txt")).rejects.toMatchObject({ + code: "PATH_IDENTITY_AMBIGUOUS", + }); + }); + + test("does not silently normalize a Unicode spelling variant", async () => { + const { root, policy } = await fixture(); + const stored = "caf\u00e9.txt"; + const alternate = "cafe\u0301.txt"; + await writeFile(path.join(root, stored), "fixture", "utf8"); + await expect(policy.statPath("test", alternate)).rejects.toBeInstanceOf(PolicyError); + }); test("requires an explicit exact opt-in for a complete drive root", async () => { const filesystemRoot = path.parse(process.cwd()).root; diff --git a/test/windows-8dot3.integration.windows.test.ts b/test/windows-8dot3.integration.windows.test.ts new file mode 100644 index 0000000..d46e9b2 --- /dev/null +++ b/test/windows-8dot3.integration.windows.test.ts @@ -0,0 +1,165 @@ +import { execFileSync } from "node:child_process"; +import { link, lstat, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; +import path from "node:path"; +import { afterAll, beforeAll, describe, expect, test } from "vitest"; +import { FileBridgePolicy, type FileBridgeConfig } from "../src/filePolicy.js"; + +if (process.platform !== "win32") { + throw new Error("The mandatory Windows 8.3 integration test must run on Windows."); +} + +describe("real Windows 8.3 alternate-name policy", () => { + let base: string; + let root: string; + let longBlocked: string; + let shortBlocked: string; + let longOrdinary: string; + let shortOrdinary: string; + let nestedOrdinary: string; + let policy: FileBridgePolicy; + + beforeAll(async () => { + base = await mkdtemp(path.join(process.cwd(), ".pc-filebridge-8dot3-")); + root = path.join(base, "allowed"); + longBlocked = path.join(root, "Program Files"); + shortBlocked = path.join(root, "PROGRA~1"); + longOrdinary = path.join(root, "Ordinary Long Folder"); + shortOrdinary = path.join(root, "ORDINA~1"); + nestedOrdinary = path.join(longOrdinary, "Nested Long Folder"); + await mkdir(path.join(longBlocked, "Common Files"), { recursive: true }); + await mkdir(nestedOrdinary, { recursive: true }); + await writeFile(path.join(longBlocked, "fixture.txt"), "safe integration fixture", "utf8"); + + execFileSync("fsutil.exe", ["file", "setshortname", longBlocked, "PROGRA~1"], { stdio: "pipe" }); + execFileSync("fsutil.exe", ["file", "setshortname", longOrdinary, "ORDINA~1"], { stdio: "pipe" }); + execFileSync("fsutil.exe", ["file", "setshortname", nestedOrdinary, "NESTED~1"], { stdio: "pipe" }); + execFileSync("fsutil.exe", ["file", "setshortname", path.join(longBlocked, "Common Files"), "COMMON~1"], { + stdio: "pipe", + }); + + const [longInfo, shortInfo, nestedShortInfo] = await Promise.all([ + lstat(longBlocked), + lstat(shortBlocked), + lstat(path.join(shortBlocked, "COMMON~1")), + ]); + if (longInfo.ino === 0 || shortInfo.ino === 0 || nestedShortInfo.ino === 0) { + throw new Error("Windows fixture file identity is unavailable or zero."); + } + if (longInfo.dev !== shortInfo.dev || longInfo.ino !== shortInfo.ino) { + throw new Error("PROGRA~1 does not identify the controlled long-name fixture."); + } + + const config: FileBridgeConfig = { + version: 1, + roots: [{ id: "test", label: "Windows 8.3 fixture", path: root, read: true, create: true }], + limits: { + maxReadBytes: 4096, + maxWriteBytes: 4096, + maxDirectoryEntries: 50, + maxSearchResults: 20, + maxSearchEntries: 100, + }, + }; + policy = await FileBridgePolicy.fromConfig(config); + }); + + afterAll(async () => { + if (base) await rm(base, { recursive: true, force: true }); + }); + + test("confirms the real short-name fixture", async () => { + const [longInfo, shortInfo] = await Promise.all([lstat(longBlocked), lstat(shortBlocked)]); + expect(shortInfo.ino).not.toBe(0); + expect({ dev: shortInfo.dev, ino: shortInfo.ino }).toEqual({ dev: longInfo.dev, ino: longInfo.ino }); + }); + + test("blocks the sensitive long name", async () => { + await expect(policy.statPath("test", "Program Files")).rejects.toMatchObject({ code: "SENSITIVE_PATH_BLOCKED" }); + }); + + test("blocks a real alternate name even when the stored long name is ordinary", async () => { + const [longInfo, shortInfo] = await Promise.all([lstat(longOrdinary), lstat(shortOrdinary)]); + expect({ dev: shortInfo.dev, ino: shortInfo.ino }).toEqual({ dev: longInfo.dev, ino: longInfo.ino }); + await expect(policy.statPath("test", "ORDINA~1")).rejects.toMatchObject({ code: "ALTERNATE_NAME_BLOCKED" }); + }); + + test("blocks a nested alternate component below an exactly spelled parent", async () => { + await expect(policy.statPath("test", "Ordinary Long Folder/NESTED~1")).rejects.toMatchObject({ + code: "ALTERNATE_NAME_BLOCKED", + }); + }); + + test("rejects a configured root that itself uses an alternate name", async () => { + const config: FileBridgeConfig = { + version: 1, + roots: [{ id: "alias", label: "Alias root", path: shortOrdinary, read: true, create: true }], + limits: { + maxReadBytes: 4096, + maxWriteBytes: 4096, + maxDirectoryEntries: 50, + maxSearchResults: 20, + maxSearchEntries: 100, + }, + }; + await expect(FileBridgePolicy.fromConfig(config)).rejects.toMatchObject({ code: "ALTERNATE_NAME_BLOCKED" }); + }); + + test("allows an alternate ancestor outside an exactly spelled configured root", async () => { + const longParent = path.join(base, "Configured Root Parent"); + const shortParent = path.join(base, "CONFIG~1"); + const exactRoot = path.join(longParent, "Allowed Root"); + await mkdir(exactRoot, { recursive: true }); + execFileSync("fsutil.exe", ["file", "setshortname", longParent, "CONFIG~1"], { stdio: "pipe" }); + + const [longInfo, shortInfo] = await Promise.all([lstat(longParent), lstat(shortParent)]); + expect({ dev: shortInfo.dev, ino: shortInfo.ino }).toEqual({ dev: longInfo.dev, ino: longInfo.ino }); + + const config: FileBridgeConfig = { + version: 1, + roots: [{ id: "trusted-ancestor", label: "Trusted ancestor", path: path.join(shortParent, "Allowed Root"), read: true, create: true }], + limits: { + maxReadBytes: 4096, + maxWriteBytes: 4096, + maxDirectoryEntries: 50, + maxSearchResults: 20, + maxSearchEntries: 100, + }, + }; + await expect(FileBridgePolicy.fromConfig(config)).resolves.toBeInstanceOf(FileBridgePolicy); + }); + + test.each([ + ["stat", () => policy.statPath("test", "PROGRA~1")], + ["nested stat", () => policy.statPath("test", "PROGRA~1/COMMON~1")], + ["list", () => policy.listDirectory("test", "PROGRA~1")], + ["read", () => policy.readTextFile("test", "PROGRA~1/fixture.txt")], + ["search", () => policy.searchNames("test", "fixture", "PROGRA~1")], + ["create directory", () => policy.createDirectory("test", "PROGRA~1/new-directory")], + ["create text file", () => policy.createTextFile("test", "PROGRA~1/new-file.txt", "must not be created")], + ])("blocks %s through a real alternate name", async (_label, operation) => { + await expect(operation()).rejects.toMatchObject({ + code: expect.stringMatching(/^(ALTERNATE_NAME_BLOCKED|SENSITIVE_PATH_BLOCKED)$/), + }); + }); + + test("allows case-only spelling and a literal legal tilde name", async () => { + await mkdir(path.join(root, "Case Folder")); + await mkdir(path.join(root, "legal~1-name")); + await expect(policy.statPath("test", "case folder")).resolves.toMatchObject({ kind: "directory" }); + await expect(policy.statPath("test", "legal~1-name")).resolves.toMatchObject({ kind: "directory" }); + }); + + test("keeps create-only behavior inside the ordinary root", async () => { + await policy.createTextFile("test", "proof.txt", "first"); + await expect(policy.createTextFile("test", "proof.txt", "second")).rejects.toMatchObject({ code: "TARGET_EXISTS" }); + await expect(readFile(path.join(root, "proof.txt"), "utf8")).resolves.toBe("first"); + }); + + test("fails closed for hard-linked file identities", async () => { + await writeFile(path.join(root, "hardlink-source.txt"), "fixture", "utf8"); + await link(path.join(root, "hardlink-source.txt"), path.join(root, "hardlink-peer.txt")); + await expect(policy.statPath("test", "hardlink-source.txt")).rejects.toMatchObject({ + code: expect.stringMatching(/^(HARDLINK_BLOCKED|PATH_IDENTITY_AMBIGUOUS)$/), + }); + }); +}); From a89d309e2b40b398b218e19871c6bd9e34ee1ffb Mon Sep 17 00:00:00 2001 From: dzeusking-dev Date: Sun, 30 Aug 2026 21:08:05 +0200 Subject: [PATCH 2/7] fix(windows): replace inherited ACLs deterministically --- scripts/Approve-PCFileBridgeVolume.ps1 | 21 +++++++++++++++++-- scripts/Revoke-PCFileBridgeVolumeApproval.ps1 | 21 +++++++++++++++++-- scripts/Start-PCFileBridgeVolumeMonitor.ps1 | 21 +++++++++++++++++-- scripts/Update-PCFileBridgeVolumeConfig.ps1 | 21 +++++++++++++++++-- 4 files changed, 76 insertions(+), 8 deletions(-) diff --git a/scripts/Approve-PCFileBridgeVolume.ps1 b/scripts/Approve-PCFileBridgeVolume.ps1 index a59c858..fb25fd0 100644 --- a/scripts/Approve-PCFileBridgeVolume.ps1 +++ b/scripts/Approve-PCFileBridgeVolume.ps1 @@ -42,8 +42,25 @@ $temp = Join-Path $directory ('.pcfb-approval-' + [Guid]::NewGuid().ToString('N' try { [IO.File]::WriteAllText($temp, (($value | ConvertTo-Json -Depth 8) + [Environment]::NewLine), (New-Object Text.UTF8Encoding($false))) $current = [Security.Principal.WindowsIdentity]::GetCurrent() - & icacls.exe $temp /inheritance:r /grant:r ('*' + $current.User.Value + ':(F)') '*S-1-5-18:(F)' | Out-Null - if ($LASTEXITCODE -ne 0) { throw 'APPROVAL_REGISTRY_ACL_FAILED' } + $fileInfo = New-Object IO.FileInfo($temp) + $acl = New-Object Security.AccessControl.FileSecurity + $acl.SetAccessRuleProtection($true, $false) + foreach ($sidValue in @($current.User.Value, 'S-1-5-18')) { + $sid = New-Object Security.Principal.SecurityIdentifier($sidValue) + $rule = New-Object Security.AccessControl.FileSystemAccessRule( + $sid, + [Security.AccessControl.FileSystemRights]::FullControl, + [Security.AccessControl.InheritanceFlags]::None, + [Security.AccessControl.PropagationFlags]::None, + [Security.AccessControl.AccessControlType]::Allow + ) + [void]$acl.AddAccessRule($rule) + } + if ($PSVersionTable.PSEdition -ceq 'Core') { + [System.IO.FileSystemAclExtensions]::SetAccessControl($fileInfo, $acl) + } else { + $fileInfo.SetAccessControl($acl) + } Move-Item -LiteralPath $temp -Destination $fullPath -Force } finally { if (Test-Path -LiteralPath $temp) { Remove-Item -LiteralPath $temp -Force } diff --git a/scripts/Revoke-PCFileBridgeVolumeApproval.ps1 b/scripts/Revoke-PCFileBridgeVolumeApproval.ps1 index 250a6ec..e886b7e 100644 --- a/scripts/Revoke-PCFileBridgeVolumeApproval.ps1 +++ b/scripts/Revoke-PCFileBridgeVolumeApproval.ps1 @@ -26,8 +26,25 @@ $temp = Join-Path $directory ('.pcfb-approval-' + [Guid]::NewGuid().ToString('N' try { [IO.File]::WriteAllText($temp, (($value | ConvertTo-Json -Depth 8) + [Environment]::NewLine), (New-Object Text.UTF8Encoding($false))) $current = [Security.Principal.WindowsIdentity]::GetCurrent() - & icacls.exe $temp /inheritance:r /grant:r ('*' + $current.User.Value + ':(F)') '*S-1-5-18:(F)' | Out-Null - if ($LASTEXITCODE -ne 0) { throw 'APPROVAL_REGISTRY_ACL_FAILED' } + $fileInfo = New-Object IO.FileInfo($temp) + $acl = New-Object Security.AccessControl.FileSecurity + $acl.SetAccessRuleProtection($true, $false) + foreach ($sidValue in @($current.User.Value, 'S-1-5-18')) { + $sid = New-Object Security.Principal.SecurityIdentifier($sidValue) + $rule = New-Object Security.AccessControl.FileSystemAccessRule( + $sid, + [Security.AccessControl.FileSystemRights]::FullControl, + [Security.AccessControl.InheritanceFlags]::None, + [Security.AccessControl.PropagationFlags]::None, + [Security.AccessControl.AccessControlType]::Allow + ) + [void]$acl.AddAccessRule($rule) + } + if ($PSVersionTable.PSEdition -ceq 'Core') { + [System.IO.FileSystemAclExtensions]::SetAccessControl($fileInfo, $acl) + } else { + $fileInfo.SetAccessControl($acl) + } Move-Item -LiteralPath $temp -Destination $fullPath -Force } finally { if (Test-Path -LiteralPath $temp) { Remove-Item -LiteralPath $temp -Force } diff --git a/scripts/Start-PCFileBridgeVolumeMonitor.ps1 b/scripts/Start-PCFileBridgeVolumeMonitor.ps1 index 20d4c44..4f0b837 100644 --- a/scripts/Start-PCFileBridgeVolumeMonitor.ps1 +++ b/scripts/Start-PCFileBridgeVolumeMonitor.ps1 @@ -44,8 +44,25 @@ $tunnelClient = if ($SkipConnect) { $null } else { (Resolve-Path -LiteralPath $T function Set-PrivateStateFile([string]$Path, [string]$Value, [System.Text.Encoding]$Encoding) { [IO.File]::WriteAllText($Path, $Value, $Encoding) $current = [Security.Principal.WindowsIdentity]::GetCurrent() - & icacls.exe $Path /inheritance:r /grant:r ('*' + $current.User.Value + ':(F)') '*S-1-5-18:(F)' | Out-Null - if ($LASTEXITCODE -ne 0) { throw 'MONITOR_STATE_ACL_FAILED' } + $fileInfo = New-Object IO.FileInfo($Path) + $acl = New-Object Security.AccessControl.FileSecurity + $acl.SetAccessRuleProtection($true, $false) + foreach ($sidValue in @($current.User.Value, 'S-1-5-18')) { + $sid = New-Object Security.Principal.SecurityIdentifier($sidValue) + $rule = New-Object Security.AccessControl.FileSystemAccessRule( + $sid, + [Security.AccessControl.FileSystemRights]::FullControl, + [Security.AccessControl.InheritanceFlags]::None, + [Security.AccessControl.PropagationFlags]::None, + [Security.AccessControl.AccessControlType]::Allow + ) + [void]$acl.AddAccessRule($rule) + } + if ($PSVersionTable.PSEdition -ceq 'Core') { + [System.IO.FileSystemAclExtensions]::SetAccessControl($fileInfo, $acl) + } else { + $fileInfo.SetAccessControl($acl) + } } function Get-FileSha256([string]$Path) { diff --git a/scripts/Update-PCFileBridgeVolumeConfig.ps1 b/scripts/Update-PCFileBridgeVolumeConfig.ps1 index 5eff6cd..67d197d 100644 --- a/scripts/Update-PCFileBridgeVolumeConfig.ps1 +++ b/scripts/Update-PCFileBridgeVolumeConfig.ps1 @@ -30,8 +30,25 @@ function Normalize-Identifier([object]$Value) { function Set-PrivateFileAcl([string]$Path) { $current = [System.Security.Principal.WindowsIdentity]::GetCurrent() - & icacls.exe $Path /inheritance:r /grant:r ('*' + $current.User.Value + ':(F)') '*S-1-5-18:(F)' | Out-Null - if ($LASTEXITCODE -ne 0) { throw 'PRIVATE_FILE_ACL_FAILED' } + $fileInfo = New-Object IO.FileInfo($Path) + $acl = New-Object Security.AccessControl.FileSecurity + $acl.SetAccessRuleProtection($true, $false) + foreach ($sidValue in @($current.User.Value, 'S-1-5-18')) { + $sid = New-Object Security.Principal.SecurityIdentifier($sidValue) + $rule = New-Object Security.AccessControl.FileSystemAccessRule( + $sid, + [Security.AccessControl.FileSystemRights]::FullControl, + [Security.AccessControl.InheritanceFlags]::None, + [Security.AccessControl.PropagationFlags]::None, + [Security.AccessControl.AccessControlType]::Allow + ) + [void]$acl.AddAccessRule($rule) + } + if ($PSVersionTable.PSEdition -ceq 'Core') { + [System.IO.FileSystemAclExtensions]::SetAccessControl($fileInfo, $acl) + } else { + $fileInfo.SetAccessControl($acl) + } } function Test-PrivateFileAcl([string]$Path) { From 1fa99e30d28c30c340abef9359c2b6f20b49c6c0 Mon Sep 17 00:00:00 2001 From: dzeusking-dev Date: Sun, 30 Aug 2026 21:26:05 +0200 Subject: [PATCH 3/7] fix(runtime): enforce locked gate on active tunnels --- scripts/Start-PCFileBridgeVolumeMonitor.ps1 | 30 +++++++++++++++++++ scripts/crash-window.windows.test.ps1 | 32 ++++++++++++++++++++- scripts/runtime-rollback.windows.test.ps1 | 1 + 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/scripts/Start-PCFileBridgeVolumeMonitor.ps1 b/scripts/Start-PCFileBridgeVolumeMonitor.ps1 index 4f0b837..a20c261 100644 --- a/scripts/Start-PCFileBridgeVolumeMonitor.ps1 +++ b/scripts/Start-PCFileBridgeVolumeMonitor.ps1 @@ -27,6 +27,7 @@ $contract = Get-Content -Raw -LiteralPath (Join-Path $pluginRoot 'config\tunnel- $roleContract = @($contract.roles | Where-Object { $_.id -ceq $Role }) if ($roleContract.Count -ne 1) { throw 'ROLE_CONTRACT_INVALID' } $alias = [string]$roleContract[0].alias +$gateRequired = [bool]$roleContract[0].gateRequired $privateRoot = Join-Path $env:LOCALAPPDATA 'PCFileBridge\private' [IO.Directory]::CreateDirectory($privateRoot) | Out-Null @@ -85,6 +86,17 @@ function Get-RuntimeStatus { try { return (($raw -join [Environment]::NewLine) | ConvertFrom-Json) } catch { return $null } } +function Test-ConnectorGateArmed { + if (-not $gateRequired) { return $true } + $gatePath = Join-Path $privateRoot "$Role.gate" + if (-not (Test-Path -LiteralPath $gatePath -PathType Leaf)) { return $false } + try { + return [IO.File]::ReadAllText($gatePath, [Text.Encoding]::UTF8).Trim() -ceq "ARMED:$Role" + } catch { + return $false + } +} + function Invoke-LocalMcpProbe([string]$Path, [string[]]$ExpectedRoots) { if ($SkipMcpProbe) { return } $previousConfig = $env:FILEBRIDGE_CONFIG @@ -125,6 +137,24 @@ try { while ($true) { try { + if (-not $SkipConnect -and -not (Test-ConnectorGateArmed)) { + $lockedStatus = Get-RuntimeStatus + $lockedRuntimeStopped = $false + if ($null -ne $lockedStatus -and [bool]$lockedStatus.process_running) { + & $tunnelClient runtimes stop $alias --json | Out-Null + if ($LASTEXITCODE -ne 0) { throw 'TUNNEL_STOP_FAILED' } + $lockedRuntimeStopped = $true + } + [pscustomobject]@{ + role = $Role + runtime_action = $(if ($lockedRuntimeStopped) { 'gate_locked_stopped' } else { 'gate_locked' }) + runtime_ready = $false + } + if ($Once) { break } + Start-Sleep -Seconds $PollSeconds + continue + } + $updateArgs = @{ Role = $Role; OutputPath = $candidateConfigPath } if (-not [string]::IsNullOrWhiteSpace($InventoryPath)) { $updateArgs.InventoryPath = $InventoryPath } $update = & (Join-Path $PSScriptRoot 'Update-PCFileBridgeVolumeConfig.ps1') @updateArgs diff --git a/scripts/crash-window.windows.test.ps1 b/scripts/crash-window.windows.test.ps1 index fbcd7cf..0654b68 100644 --- a/scripts/crash-window.windows.test.ps1 +++ b/scripts/crash-window.windows.test.ps1 @@ -30,6 +30,7 @@ try { $env:PCFB_TEST_STATE = $state Write-Json $state ([ordered]@{ running = $false }) [IO.File]::WriteAllText((Join-Path $private 'pc-local.tunnel-id'), (('tun' + 'nel_crash_test_1234') + [Environment]::NewLine), $encoding) + [IO.File]::WriteAllText((Join-Path $private 'pc-local.gate'), ("ARMED:pc-local" + [Environment]::NewLine), $encoding) $client = Join-Path $case 'client.ps1' [IO.File]::WriteAllText($client, @' @@ -72,6 +73,35 @@ param([string]$Role,[string]$TunnelId,[string]$ConfigPath,[switch]$EnableFullDri if (@($active.roots.id) -notcontains 'pc-f') { throw "CANDIDATE_NOT_RECOVERED_$point" } } + $gateCase = Join-Path $root 'gate-lock' + $gateLocal = Join-Path $gateCase 'localappdata' + $gatePrivate = Join-Path $gateLocal 'PCFileBridge\private' + [IO.Directory]::CreateDirectory($gatePrivate) | Out-Null + $env:LOCALAPPDATA = $gateLocal + $gateState = Join-Path $gateCase 'state.json' + $env:PCFB_TEST_STATE = $gateState + Write-Json $gateState ([ordered]@{ running = $true }) + [IO.File]::WriteAllText((Join-Path $gatePrivate 'pc-local.gate'), ("LOCKED:pc-local" + [Environment]::NewLine), $encoding) + $gateClient = Join-Path $gateCase 'client.ps1' + [IO.File]::WriteAllText($gateClient, @' +$state = Get-Content -Raw -LiteralPath $env:PCFB_TEST_STATE | ConvertFrom-Json +if ($args[0] -ceq 'runtimes' -and $args[1] -ceq 'status') { + [ordered]@{ process_running=[bool]$state.running; healthy=[bool]$state.running; ready=[bool]$state.running } | ConvertTo-Json -Compress + exit 0 +} +if ($args[0] -ceq 'runtimes' -and $args[1] -ceq 'stop') { + [IO.File]::WriteAllText($env:PCFB_TEST_STATE, '{"running":false}', [Text.Encoding]::ASCII) + '{}' + exit 0 +} +throw 'MOCK_ARGUMENT' +'@, $encoding) + $gateResult = & (Join-Path $PSScriptRoot 'Start-PCFileBridgeVolumeMonitor.ps1') -Role pc-local -Once -TunnelClientPath $gateClient -StableSnapshots 1 -SkipMcpProbe + $gateFinalState = Get-Content -Raw -LiteralPath $gateState | ConvertFrom-Json + if ([bool]$gateFinalState.running -or [bool]$gateResult.runtime_ready -or [string]$gateResult.runtime_action -cne 'gate_locked_stopped') { + throw 'LOCKED_GATE_DID_NOT_STOP_RUNTIME' + } + $env:LOCALAPPDATA = Join-Path $root 'singleton-local' $singletonPrivate = Join-Path $env:LOCALAPPDATA 'PCFileBridge\private' [IO.Directory]::CreateDirectory($singletonPrivate) | Out-Null @@ -103,7 +133,7 @@ param([string]$Role,[string]$TunnelId,[string]$ConfigPath,[switch]$EnableFullDri Stop-Job -Job $job -ErrorAction SilentlyContinue Remove-Job -Job $job -Force -ErrorAction SilentlyContinue } - Write-Output 'CRASH_WINDOW_WINDOWS_TEST_PASS points=6 singleton=pass recovery=pass' + Write-Output 'CRASH_WINDOW_WINDOWS_TEST_PASS points=6 singleton=pass recovery=pass gate_lock=pass' } finally { $env:LOCALAPPDATA = $previousLocalAppData $env:PCFB_TEST_STATE = $previousState diff --git a/scripts/runtime-rollback.windows.test.ps1 b/scripts/runtime-rollback.windows.test.ps1 index 63b5633..997e243 100644 --- a/scripts/runtime-rollback.windows.test.ps1 +++ b/scripts/runtime-rollback.windows.test.ps1 @@ -44,6 +44,7 @@ try { Write-Json -Path $statePath -Value ([ordered]@{ running = $false }) $testTunnelId = 'tunnel_' + 'test_runtime_1234' [IO.File]::WriteAllText((Join-Path $privateRoot 'pc-local.tunnel-id'), ($testTunnelId + [Environment]::NewLine), $encoding) + [IO.File]::WriteAllText((Join-Path $privateRoot 'pc-local.gate'), ("ARMED:pc-local" + [Environment]::NewLine), $encoding) $tunnelClient = Join-Path $tempRoot 'mock-tunnel-client.ps1' [IO.File]::WriteAllText($tunnelClient, @' From 7c51bbe91e8178fd4cba9d2e678a5c8681130088 Mon Sep 17 00:00:00 2001 From: dzeusking-dev Date: Sun, 30 Aug 2026 21:36:02 +0200 Subject: [PATCH 4/7] fix(build): externalize zod code generation --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fcde1d1..8cdbf91 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "node": ">=22.0.0" }, "scripts": { - "build": "esbuild src/server.ts --bundle --platform=node --format=esm --target=node22 --outfile=mcp/server.mjs --banner:js=\"#!/usr/bin/env node\"", + "build": "esbuild src/server.ts --bundle --external:zod --platform=node --format=esm --target=node22 --outfile=mcp/server.mjs --banner:js=\"#!/usr/bin/env node\"", "typecheck": "tsc -p tsconfig.json --noEmit", "test": "vitest run test/filePolicy.test.ts", "test:windows-8dot3": "vitest run test/windows-8dot3.integration.windows.test.ts", From 7045fa57f1799c1ac486562de188609810a7e669 Mon Sep 17 00:00:00 2001 From: dzeusking-dev Date: Sun, 30 Aug 2026 21:36:17 +0200 Subject: [PATCH 5/7] fix(build): regenerate without bundled zod codegen --- mcp/server.mjs | 25081 +++-------------------------------------------- 1 file changed, 1133 insertions(+), 23948 deletions(-) diff --git a/mcp/server.mjs b/mcp/server.mjs index e2c9c35..2072f19 100644 --- a/mcp/server.mjs +++ b/mcp/server.mjs @@ -12,10 +12,6 @@ var __commonJS = (cb, mod) => function __require() { throw mod = 0, e; } }; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) @@ -76,12 +72,12 @@ var require_code = __commonJS({ return item === "" || item === '""'; } get str() { - var _a3; - return (_a3 = this._str) !== null && _a3 !== void 0 ? _a3 : this._str = this._items.reduce((s, c) => `${s}${c}`, ""); + var _a; + return (_a = this._str) !== null && _a !== void 0 ? _a : this._str = this._items.reduce((s, c) => `${s}${c}`, ""); } get names() { - var _a3; - return (_a3 = this._names) !== null && _a3 !== void 0 ? _a3 : this._names = this._items.reduce((names, c) => { + var _a; + return (_a = this._names) !== null && _a !== void 0 ? _a : this._names = this._items.reduce((names, c) => { if (c instanceof Name) names[c.str] = (names[c.str] || 0) + 1; return names; @@ -227,8 +223,8 @@ var require_scope = __commonJS({ return `${prefix}${ng.index++}`; } _nameGroup(prefix) { - var _a3, _b; - if (((_b = (_a3 = this._parent) === null || _a3 === void 0 ? void 0 : _a3._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) { + var _a, _b; + if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) { throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`); } return this._names[prefix] = { prefix, index: 0 }; @@ -261,12 +257,12 @@ var require_scope = __commonJS({ return new ValueScopeName(prefix, this._newName(prefix)); } value(nameOrPrefix, value) { - var _a3; + var _a; if (value.ref === void 0) throw new Error("CodeGen: ref must be passed in value"); const name = this.toName(nameOrPrefix); const { prefix } = name; - const valueKey = (_a3 = value.key) !== null && _a3 !== void 0 ? _a3 : value.ref; + const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref; let vs = this._values[prefix]; if (vs) { const _name = vs.get(valueKey); @@ -473,9 +469,9 @@ var require_codegen = __commonJS({ } }; var Throw = class extends Node { - constructor(error61) { + constructor(error) { super(); - this.error = error61; + this.error = error; } render({ _n }) { return `throw ${this.error};` + _n; @@ -584,8 +580,8 @@ var require_codegen = __commonJS({ return this; } optimizeNames(names, constants) { - var _a3; - this.else = (_a3 = this.else) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants); + var _a; + this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants); if (!(super.optimizeNames(names, constants) || this.else)) return; this.condition = optimizeExpr(this.condition, names, constants); @@ -689,16 +685,16 @@ var require_codegen = __commonJS({ return code; } optimizeNodes() { - var _a3, _b; + var _a, _b; super.optimizeNodes(); - (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNodes(); + (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes(); (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes(); return this; } optimizeNames(names, constants) { - var _a3, _b; + var _a, _b; super.optimizeNames(names, constants); - (_a3 = this.catch) === null || _a3 === void 0 ? void 0 : _a3.optimizeNames(names, constants); + (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants); (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants); return this; } @@ -712,9 +708,9 @@ var require_codegen = __commonJS({ } }; var Catch = class extends BlockNode { - constructor(error61) { + constructor(error) { super(); - this.error = error61; + this.error = error; } render(opts) { return `catch(${this.error})` + super.render(opts); @@ -840,8 +836,8 @@ var require_codegen = __commonJS({ endIf() { return this._endBlockNode(If, Else); } - _for(node2, forBody) { - this._blockNode(node2); + _for(node, forBody) { + this._blockNode(node); if (forBody) this.code(forBody).endFor(); return this; @@ -890,10 +886,10 @@ var require_codegen = __commonJS({ } // `return` statement return(value) { - const node2 = new Return(); - this._blockNode(node2); + const node = new Return(); + this._blockNode(node); this.code(value); - if (node2.nodes.length !== 1) + if (node.nodes.length !== 1) throw new Error('CodeGen: "return" should have one node'); return this._endBlockNode(Return); } @@ -901,23 +897,23 @@ var require_codegen = __commonJS({ try(tryBody, catchCode, finallyCode) { if (!catchCode && !finallyCode) throw new Error('CodeGen: "try" without "catch" and "finally"'); - const node2 = new Try(); - this._blockNode(node2); + const node = new Try(); + this._blockNode(node); this.code(tryBody); if (catchCode) { - const error61 = this.name("e"); - this._currNode = node2.catch = new Catch(error61); - catchCode(error61); + const error = this.name("e"); + this._currNode = node.catch = new Catch(error); + catchCode(error); } if (finallyCode) { - this._currNode = node2.finally = new Finally(); + this._currNode = node.finally = new Finally(); this.code(finallyCode); } return this._endBlockNode(Catch, Finally); } // `throw` statement - throw(error61) { - return this._leafNode(new Throw(error61)); + throw(error) { + return this._leafNode(new Throw(error)); } // start self-balancing block block(body, nodeCount) { @@ -955,13 +951,13 @@ var require_codegen = __commonJS({ this._root.optimizeNames(this._root.names, this._constants); } } - _leafNode(node2) { - this._currNode.nodes.push(node2); + _leafNode(node) { + this._currNode.nodes.push(node); return this; } - _blockNode(node2) { - this._currNode.nodes.push(node2); - this._nodes.push(node2); + _blockNode(node) { + this._currNode.nodes.push(node); + this._nodes.push(node); } _endBlockNode(N1, N2) { const n = this._currNode; @@ -971,12 +967,12 @@ var require_codegen = __commonJS({ } throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`); } - _elseNode(node2) { + _elseNode(node) { const n = this._currNode; if (!(n instanceof If)) { throw new Error('CodeGen: "else" without "if"'); } - this._currNode = n.else = node2; + this._currNode = n.else = node; return this; } get _root() { @@ -986,9 +982,9 @@ var require_codegen = __commonJS({ const ns = this._nodes; return ns[ns.length - 1]; } - set _currNode(node2) { + set _currNode(node) { const ns = this._nodes; - ns[ns.length - 1] = node2; + ns[ns.length - 1] = node; } }; exports.CodeGen = CodeGen; @@ -1061,10 +1057,10 @@ var require_util = __commonJS({ var codegen_1 = require_codegen(); var code_1 = require_code(); function toHash(arr) { - const hash2 = {}; + const hash = {}; for (const item of arr) - hash2[item] = true; - return hash2; + hash[item] = true; + return hash; } exports.toHash = toHash; function alwaysValidSchema(it, schema) { @@ -1144,9 +1140,9 @@ var require_util = __commonJS({ } } exports.eachItem = eachItem; - function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues: mergeValues3, resultToName }) { + function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName }) { return (gen, from, to, toName) => { - const res = to === void 0 ? from : to instanceof codegen_1.Name ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1.Name ? (mergeToName(gen, to, from), from) : mergeValues3(from, to); + const res = to === void 0 ? from : to instanceof codegen_1.Name ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1.Name ? (mergeToName(gen, to, from), from) : mergeValues(from, to); return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res; }; } @@ -1273,10 +1269,10 @@ var require_errors = __commonJS({ exports.keyword$DataError = { message: ({ keyword, schemaType }) => schemaType ? (0, codegen_1.str)`"${keyword}" keyword must be ${schemaType} ($data)` : (0, codegen_1.str)`"${keyword}" keyword is invalid ($data)` }; - function reportError(cxt, error61 = exports.keywordError, errorPaths, overrideAllErrors) { + function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) { const { it } = cxt; const { gen, compositeRule, allErrors } = it; - const errObj = errorObjectCode(cxt, error61, errorPaths); + const errObj = errorObjectCode(cxt, error, errorPaths); if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : compositeRule || allErrors) { addError(gen, errObj); } else { @@ -1284,10 +1280,10 @@ var require_errors = __commonJS({ } } exports.reportError = reportError; - function reportExtraError(cxt, error61 = exports.keywordError, errorPaths) { + function reportExtraError(cxt, error = exports.keywordError, errorPaths) { const { it } = cxt; const { gen, compositeRule, allErrors } = it; - const errObj = errorObjectCode(cxt, error61, errorPaths); + const errObj = errorObjectCode(cxt, error, errorPaths); addError(gen, errObj); if (!(compositeRule || allErrors)) { returnErrors(it, names_1.default.vErrors); @@ -1338,19 +1334,19 @@ var require_errors = __commonJS({ schema: new codegen_1.Name("schema"), parentSchema: new codegen_1.Name("parentSchema") }; - function errorObjectCode(cxt, error61, errorPaths) { + function errorObjectCode(cxt, error, errorPaths) { const { createErrors } = cxt.it; if (createErrors === false) return (0, codegen_1._)`{}`; - return errorObject(cxt, error61, errorPaths); + return errorObject(cxt, error, errorPaths); } - function errorObject(cxt, error61, errorPaths = {}) { + function errorObject(cxt, error, errorPaths = {}) { const { gen, it } = cxt; const keyValues = [ errorInstancePath(it, errorPaths), errorSchemaPath(cxt, errorPaths) ]; - extraErrorProps(cxt, error61, keyValues); + extraErrorProps(cxt, error, keyValues); return gen.object(...keyValues); } function errorInstancePath({ errorPath }, { instancePath }) { @@ -1478,8 +1474,8 @@ var require_applicability = __commonJS({ } exports.shouldUseGroup = shouldUseGroup; function shouldUseRule(schema, rule) { - var _a3; - return schema[rule.keyword] !== void 0 || ((_a3 = rule.definition.implements) === null || _a3 === void 0 ? void 0 : _a3.some((kwd) => schema[kwd] !== void 0)); + var _a; + return schema[rule.keyword] !== void 0 || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== void 0)); } exports.shouldUseRule = shouldUseRule; } @@ -1867,14 +1863,14 @@ var require_keyword = __commonJS({ } exports.macroKeywordCode = macroKeywordCode; function funcKeywordCode(cxt, def) { - var _a3; + var _a; const { gen, keyword, schema, parentSchema, $data, it } = cxt; checkAsyncKeyword(it, def); - const validate2 = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate; - const validateRef = useKeyword(gen, keyword, validate2); + const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate; + const validateRef = useKeyword(gen, keyword, validate); const valid = gen.let("valid"); cxt.block$data(valid, validateKeyword); - cxt.ok((_a3 = def.valid) !== null && _a3 !== void 0 ? _a3 : valid); + cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid); function validateKeyword() { if (def.errors === false) { assignValid(); @@ -1882,13 +1878,13 @@ var require_keyword = __commonJS({ modifyData(cxt); reportErrs(() => cxt.error()); } else { - const ruleErrs = def.async ? validateAsync2() : validateSync(); + const ruleErrs = def.async ? validateAsync() : validateSync(); if (def.modifying) modifyData(cxt); reportErrs(() => addErrs(cxt, ruleErrs)); } } - function validateAsync2() { + function validateAsync() { const ruleErrs = gen.let("ruleErrs", null); gen.try(() => assignValid((0, codegen_1._)`await `), (e) => gen.assign(valid, false).if((0, codegen_1._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._)`${e}.errors`), () => gen.throw(e))); return ruleErrs; @@ -1905,8 +1901,8 @@ var require_keyword = __commonJS({ gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying); } function reportErrs(errors) { - var _a4; - gen.if((0, codegen_1.not)((_a4 = def.valid) !== null && _a4 !== void 0 ? _a4 : valid), errors); + var _a2; + gen.if((0, codegen_1.not)((_a2 = def.valid) !== null && _a2 !== void 0 ? _a2 : valid), errors); } } exports.funcKeywordCode = funcKeywordCode; @@ -2298,11 +2294,11 @@ var require_resolve = __commonJS({ } return ref; } - function addAnchor(anchor2) { - if (typeof anchor2 == "string") { - if (!ANCHOR.test(anchor2)) - throw new Error(`invalid anchor "${anchor2}"`); - addRef.call(this, `#${anchor2}`); + function addAnchor(anchor) { + if (typeof anchor == "string") { + if (!ANCHOR.test(anchor)) + throw new Error(`invalid anchor "${anchor}"`); + addRef.call(this, `#${anchor}`); } } }); @@ -2874,7 +2870,7 @@ var require_compile = __commonJS({ var validate_1 = require_validate(); var SchemaEnv = class { constructor(env) { - var _a3; + var _a; this.refs = {}; this.dynamicAnchors = {}; let schema; @@ -2883,7 +2879,7 @@ var require_compile = __commonJS({ this.schema = env.schema; this.schemaId = env.schemaId; this.root = env.root || this; - this.baseId = (_a3 = env.baseId) !== null && _a3 !== void 0 ? _a3 : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]); + this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]); this.schemaPath = env.schemaPath; this.localRefs = env.localRefs; this.meta = env.meta; @@ -2944,28 +2940,28 @@ var require_compile = __commonJS({ if (this.opts.code.process) sourceCode = this.opts.code.process(sourceCode, sch); const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode); - const validate2 = makeValidate(this, this.scope.get()); - this.scope.value(validateName, { ref: validate2 }); - validate2.errors = null; - validate2.schema = sch.schema; - validate2.schemaEnv = sch; + const validate = makeValidate(this, this.scope.get()); + this.scope.value(validateName, { ref: validate }); + validate.errors = null; + validate.schema = sch.schema; + validate.schemaEnv = sch; if (sch.$async) - validate2.$async = true; + validate.$async = true; if (this.opts.code.source === true) { - validate2.source = { validateName, validateCode, scopeValues: gen._values }; + validate.source = { validateName, validateCode, scopeValues: gen._values }; } if (this.opts.unevaluated) { const { props, items } = schemaCxt; - validate2.evaluated = { + validate.evaluated = { props: props instanceof codegen_1.Name ? void 0 : props, items: items instanceof codegen_1.Name ? void 0 : items, dynamicProps: props instanceof codegen_1.Name, dynamicItems: items instanceof codegen_1.Name }; - if (validate2.source) - validate2.source.evaluated = (0, codegen_1.stringify)(validate2.evaluated); + if (validate.source) + validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated); } - sch.validate = validate2; + sch.validate = validate; return sch; } catch (e) { delete sch.validate; @@ -2978,15 +2974,15 @@ var require_compile = __commonJS({ } } exports.compileSchema = compileSchema; - function resolveRef2(root, baseId, ref) { - var _a3; + function resolveRef(root, baseId, ref) { + var _a; ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref); const schOrFunc = root.refs[ref]; if (schOrFunc) return schOrFunc; let _sch = resolve.call(this, root, ref); if (_sch === void 0) { - const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref]; + const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; const { schemaId } = this.opts; if (schema) _sch = new SchemaEnv({ schema, schemaId, root, baseId }); @@ -2995,7 +2991,7 @@ var require_compile = __commonJS({ return; return root.refs[ref] = inlineOrCompile.call(this, _sch); } - exports.resolveRef = resolveRef2; + exports.resolveRef = resolveRef; function inlineOrCompile(sch) { if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs)) return sch.schema; @@ -3055,8 +3051,8 @@ var require_compile = __commonJS({ "definitions" ]); function getJsonPointer(parsedRef, { baseId, schema, root }) { - var _a3; - if (((_a3 = parsedRef.fragment) === null || _a3 === void 0 ? void 0 : _a3[0]) !== "/") + var _a; + if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/") return; for (const part of parsedRef.fragment.slice(1).split("/")) { if (typeof schema === "boolean") @@ -3130,27 +3126,27 @@ var require_utils = __commonJS({ } return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63]; } - function stringArrayToHexStripped(input2) { + function stringArrayToHexStripped(input) { let acc = ""; let code = 0; let i = 0; - for (i = 0; i < input2.length; i++) { - code = input2[i].charCodeAt(0); + for (i = 0; i < input.length; i++) { + code = input[i].charCodeAt(0); if (code === 48) { continue; } if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) { return ""; } - acc += input2[i]; + acc += input[i]; break; } - for (i += 1; i < input2.length; i++) { - code = input2[i].charCodeAt(0); + for (i += 1; i < input.length; i++) { + code = input[i].charCodeAt(0); if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) { return ""; } - acc += input2[i]; + acc += input[i]; } return acc; } @@ -3193,11 +3189,11 @@ var require_utils = __commonJS({ const tail = hextets.slice(bestStart + bestLength).join(":"); return head + "::" + tail; } - function normalizeIPv6Address(input2) { - const compression = input2.indexOf("::"); - if (compression !== -1 && input2.indexOf("::", compression + 1) !== -1) return void 0; - const left = compression === -1 ? input2.split(":") : input2.slice(0, compression).split(":"); - const right = compression === -1 ? [] : input2.slice(compression + 2).split(":"); + function normalizeIPv6Address(input) { + const compression = input.indexOf("::"); + if (compression !== -1 && input.indexOf("::", compression + 1) !== -1) return void 0; + const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":"); + const right = compression === -1 ? [] : input.slice(compression + 2).split(":"); if (compression !== -1) { if (left.length === 1 && left[0] === "") left.length = 0; if (right.length === 1 && right[0] === "") right.length = 0; @@ -3230,23 +3226,23 @@ var require_utils = __commonJS({ const bracketed = host[0] === "[" && host[host.length - 1] === "]"; const hasBracket = host[0] === "[" || host[host.length - 1] === "]"; if (hasBracket && !bracketed) return { host, isIPV6: false, error: true }; - let input2 = bracketed ? host.slice(1, -1) : host; - if (bracketed && isIPvFuture(input2)) { - input2 = input2.toLowerCase(); - return { host: `[${input2}]`, escapedHost: input2, isIPV6: false, isIPVFuture: true }; + let input = bracketed ? host.slice(1, -1) : host; + if (bracketed && isIPvFuture(input)) { + input = input.toLowerCase(); + return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true }; } - if (findToken(input2, ":") < 2) { + if (findToken(input, ":") < 2) { return { host, isIPV6: false, error: bracketed }; } let zoneIdentifier = ""; - const zoneSeparator = input2.indexOf("%"); + const zoneSeparator = input.indexOf("%"); if (zoneSeparator !== -1) { - const separatorLength = input2.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1; - zoneIdentifier = input2.slice(zoneSeparator + separatorLength); + const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1; + zoneIdentifier = input.slice(zoneSeparator + separatorLength); if (!isZoneIdentifier(zoneIdentifier)) return { host, isIPV6: false, error: true }; - input2 = input2.slice(0, zoneSeparator); + input = input.slice(0, zoneSeparator); } - const address = normalizeIPv6Address(input2); + const address = normalizeIPv6Address(input); if (address === void 0) return { host, isIPV6: false, error: true }; return { host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""), @@ -3262,79 +3258,79 @@ var require_utils = __commonJS({ return ind; } function removeDotSegments(path3) { - let input2 = path3; - const output2 = []; + let input = path3; + const output = []; let nextSlash = -1; let len = 0; - while (len = input2.length) { + while (len = input.length) { if (len === 1) { - if (input2 === ".") { + if (input === ".") { break; - } else if (input2 === "/") { - output2.push("/"); + } else if (input === "/") { + output.push("/"); break; } else { - output2.push(input2); + output.push(input); break; } } else if (len === 2) { - if (input2[0] === ".") { - if (input2[1] === ".") { + if (input[0] === ".") { + if (input[1] === ".") { break; - } else if (input2[1] === "/") { - input2 = input2.slice(2); + } else if (input[1] === "/") { + input = input.slice(2); continue; } - } else if (input2[0] === "/") { - if (input2[1] === "." || input2[1] === "/") { - output2.push("/"); + } else if (input[0] === "/") { + if (input[1] === "." || input[1] === "/") { + output.push("/"); break; } } } else if (len === 3) { - if (input2 === "/..") { - if (output2.length !== 0) { - output2.pop(); + if (input === "/..") { + if (output.length !== 0) { + output.pop(); } - output2.push("/"); + output.push("/"); break; } } - if (input2[0] === ".") { - if (input2[1] === ".") { - if (input2[2] === "/") { - input2 = input2.slice(3); + if (input[0] === ".") { + if (input[1] === ".") { + if (input[2] === "/") { + input = input.slice(3); continue; } - } else if (input2[1] === "/") { - input2 = input2.slice(2); + } else if (input[1] === "/") { + input = input.slice(2); continue; } - } else if (input2[0] === "/") { - if (input2[1] === ".") { - if (input2[2] === "/") { - input2 = input2.slice(2); + } else if (input[0] === "/") { + if (input[1] === ".") { + if (input[2] === "/") { + input = input.slice(2); continue; - } else if (input2[2] === ".") { - if (input2[3] === "/") { - input2 = input2.slice(3); - if (output2.length !== 0) { - output2.pop(); + } else if (input[2] === ".") { + if (input[3] === "/") { + input = input.slice(3); + if (output.length !== 0) { + output.pop(); } continue; } } } } - if ((nextSlash = input2.indexOf("/", 1)) === -1) { - output2.push(input2); + if ((nextSlash = input.indexOf("/", 1)) === -1) { + output.push(input); break; } else { - output2.push(input2.slice(0, nextSlash)); - input2 = input2.slice(nextSlash); + output.push(input.slice(0, nextSlash)); + input = input.slice(nextSlash); } } - return output2.join(""); + return output.join(""); } var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" }; var HOST_DELIM_RE = /[@/?#:]/g; @@ -3344,80 +3340,80 @@ var require_utils = __commonJS({ re.lastIndex = 0; return host.replace(re, (ch) => HOST_DELIMS[ch]); } - function normalizePercentEncoding(input2, decodeUnreserved = false) { - if (input2.indexOf("%") === -1) { - return input2; + function normalizePercentEncoding(input, decodeUnreserved = false) { + if (input.indexOf("%") === -1) { + return input; } - let output2 = ""; - for (let i = 0; i < input2.length; i++) { - if (input2[i] === "%" && i + 2 < input2.length) { - const hex3 = input2.slice(i + 1, i + 3); - if (isHexPair(hex3)) { - const normalizedHex = hex3.toUpperCase(); + let output = ""; + for (let i = 0; i < input.length; i++) { + if (input[i] === "%" && i + 2 < input.length) { + const hex = input.slice(i + 1, i + 3); + if (isHexPair(hex)) { + const normalizedHex = hex.toUpperCase(); const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); if (decodeUnreserved && isUnreserved(decoded)) { - output2 += decoded; + output += decoded; } else { - output2 += "%" + normalizedHex; + output += "%" + normalizedHex; } i += 2; continue; } } - output2 += input2[i]; + output += input[i]; } - return output2; + return output; } - function normalizePathEncoding(input2) { - let output2 = ""; - for (let i = 0; i < input2.length; i++) { - const ch = input2[i]; - if (ch === "%" && i + 2 < input2.length) { - const hex3 = input2.slice(i + 1, i + 3); - if (isHexPair(hex3)) { - const normalizedHex = hex3.toUpperCase(); + function normalizePathEncoding(input) { + let output = ""; + for (let i = 0; i < input.length; i++) { + const ch = input[i]; + if (ch === "%" && i + 2 < input.length) { + const hex = input.slice(i + 1, i + 3); + if (isHexPair(hex)) { + const normalizedHex = hex.toUpperCase(); const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); if (decoded !== "." && isUnreserved(decoded)) { - output2 += decoded; + output += decoded; } else { - output2 += "%" + normalizedHex; + output += "%" + normalizedHex; } i += 2; continue; } } if (isPathCharacter(ch)) { - output2 += ch; + output += ch; } else { - const code = input2.charCodeAt(i); + const code = input.charCodeAt(i); if (code < 128) { - output2 += isEscapeSafe(code) ? ch : BYTE_HEX[code]; + output += isEscapeSafe(code) ? ch : BYTE_HEX[code]; } else if (code < 55296 || code > 57343) { - output2 += percentEncodeNonAscii(code); - } else if (code <= 56319 && i + 1 < input2.length) { - const low = input2.charCodeAt(i + 1); + output += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input.length) { + const low = input.charCodeAt(i + 1); if (low >= 56320 && low <= 57343) { - output2 += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); i++; } else { - output2 += percentEncodeNonAscii(65533); + output += percentEncodeNonAscii(65533); } } else { - output2 += percentEncodeNonAscii(65533); + output += percentEncodeNonAscii(65533); } } } - return output2; + return output; } - function serializePathEncoding(input2, pathNoScheme = false) { - let output2 = ""; - let firstSegment = pathNoScheme && input2[0] !== "/"; - for (let i = 0; i < input2.length; i++) { - const ch = input2[i]; - if (ch === "%" && i + 2 < input2.length) { - const hex3 = input2.slice(i + 1, i + 3); - if (isHexPair(hex3)) { - output2 += "%" + hex3.toUpperCase(); + function serializePathEncoding(input, pathNoScheme = false) { + let output = ""; + let firstSegment = pathNoScheme && input[0] !== "/"; + for (let i = 0; i < input.length; i++) { + const ch = input[i]; + if (ch === "%" && i + 2 < input.length) { + const hex = input.slice(i + 1, i + 3); + if (isHexPair(hex)) { + output += "%" + hex.toUpperCase(); i += 2; continue; } @@ -3426,130 +3422,130 @@ var require_utils = __commonJS({ firstSegment = false; } if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) { - output2 += ch; + output += ch; } else { - const code = input2.charCodeAt(i); + const code = input.charCodeAt(i); if (code < 128) { - output2 += BYTE_HEX[code]; + output += BYTE_HEX[code]; } else if (code < 55296 || code > 57343) { - output2 += percentEncodeNonAscii(code); - } else if (code <= 56319 && i + 1 < input2.length) { - const low = input2.charCodeAt(i + 1); + output += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input.length) { + const low = input.charCodeAt(i + 1); if (low >= 56320 && low <= 57343) { - output2 += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); i++; } else { - output2 += percentEncodeNonAscii(65533); + output += percentEncodeNonAscii(65533); } } else { - output2 += percentEncodeNonAscii(65533); + output += percentEncodeNonAscii(65533); } } } - return output2; + return output; } - function encodeComponent(input2, isAllowed) { - let output2 = ""; - for (let i = 0; i < input2.length; i++) { - const ch = input2[i]; - if (ch === "%" && i + 2 < input2.length) { - const hex3 = input2.slice(i + 1, i + 3); - if (isHexPair(hex3)) { - output2 += "%" + hex3.toUpperCase(); + function encodeComponent(input, isAllowed) { + let output = ""; + for (let i = 0; i < input.length; i++) { + const ch = input[i]; + if (ch === "%" && i + 2 < input.length) { + const hex = input.slice(i + 1, i + 3); + if (isHexPair(hex)) { + output += "%" + hex.toUpperCase(); i += 2; continue; } } if (isAllowed(ch)) { - output2 += ch; + output += ch; } else { - const code = input2.charCodeAt(i); + const code = input.charCodeAt(i); if (code < 128) { - output2 += BYTE_HEX[code]; + output += BYTE_HEX[code]; } else if (code < 55296 || code > 57343) { - output2 += percentEncodeNonAscii(code); - } else if (code <= 56319 && i + 1 < input2.length) { - const low = input2.charCodeAt(i + 1); + output += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input.length) { + const low = input.charCodeAt(i + 1); if (low >= 56320 && low <= 57343) { - output2 += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); i++; } else { - output2 += percentEncodeNonAscii(65533); + output += percentEncodeNonAscii(65533); } } else { - output2 += percentEncodeNonAscii(65533); + output += percentEncodeNonAscii(65533); } } } - return output2; + return output; } - function encodeUserinfo(input2) { - return encodeComponent(input2, isUserinfoCharacter); + function encodeUserinfo(input) { + return encodeComponent(input, isUserinfoCharacter); } - function encodeQuery(input2) { - return encodeComponent(input2, isQueryFragmentCharacter); + function encodeQuery(input) { + return encodeComponent(input, isQueryFragmentCharacter); } - function encodeFragment(input2) { - return encodeComponent(input2, isQueryFragmentCharacter); + function encodeFragment(input) { + return encodeComponent(input, isQueryFragmentCharacter); } function isEscapeSafe(cp) { return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95; } - function normalizeQueryFragmentEncoding(input2) { - let output2 = ""; - for (let i = 0; i < input2.length; i++) { - const ch = input2[i]; - if (ch === "%" && i + 2 < input2.length) { - const hex3 = input2.slice(i + 1, i + 3); - if (isHexPair(hex3)) { - const normalizedHex = hex3.toUpperCase(); + function normalizeQueryFragmentEncoding(input) { + let output = ""; + for (let i = 0; i < input.length; i++) { + const ch = input[i]; + if (ch === "%" && i + 2 < input.length) { + const hex = input.slice(i + 1, i + 3); + if (isHexPair(hex)) { + const normalizedHex = hex.toUpperCase(); const decoded = String.fromCharCode(parseInt(normalizedHex, 16)); if (isUnreserved(decoded)) { - output2 += decoded; + output += decoded; } else { - output2 += "%" + normalizedHex; + output += "%" + normalizedHex; } i += 2; continue; } } if (isQueryFragmentCharacter(ch)) { - output2 += ch; + output += ch; } else { - const code = input2.charCodeAt(i); + const code = input.charCodeAt(i); if (code < 128) { - output2 += isEscapeSafe(code) ? ch : BYTE_HEX[code]; + output += isEscapeSafe(code) ? ch : BYTE_HEX[code]; } else if (code < 55296 || code > 57343) { - output2 += percentEncodeNonAscii(code); - } else if (code <= 56319 && i + 1 < input2.length) { - const low = input2.charCodeAt(i + 1); + output += percentEncodeNonAscii(code); + } else if (code <= 56319 && i + 1 < input.length) { + const low = input.charCodeAt(i + 1); if (low >= 56320 && low <= 57343) { - output2 += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); + output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320)); i++; } else { - output2 += percentEncodeNonAscii(65533); + output += percentEncodeNonAscii(65533); } } else { - output2 += percentEncodeNonAscii(65533); + output += percentEncodeNonAscii(65533); } } } - return output2; + return output; } - function escapePreservingEscapes(input2) { - let output2 = ""; - for (let i = 0; i < input2.length; i++) { - if (input2[i] === "%" && i + 2 < input2.length) { - const hex3 = input2.slice(i + 1, i + 3); - if (isHexPair(hex3)) { - output2 += "%" + hex3.toUpperCase(); + function escapePreservingEscapes(input) { + let output = ""; + for (let i = 0; i < input.length; i++) { + if (input[i] === "%" && i + 2 < input.length) { + const hex = input.slice(i + 1, i + 3); + if (isHexPair(hex)) { + output += "%" + hex.toUpperCase(); i += 2; continue; } } - output2 += escape(input2[i]); + output += escape(input[i]); } - return output2; + return output; } function recomposeAuthority(component) { const uriTokens = []; @@ -3832,7 +3828,7 @@ var require_fast_uri = __commonJS({ normalizeString(uri, options); } else if (typeof uri === "object") { uri = /** @type {T} */ - parse3(serialize(uri, options), options); + parse(serialize(uri, options), options); } return uri; } @@ -3872,8 +3868,8 @@ var require_fast_uri = __commonJS({ function resolveComponent(base, relative, options, skipNormalization) { const target = {}; if (!skipNormalization) { - base = parse3(serialize(base, options), options); - relative = parse3(serialize(relative, options), options); + base = parse(serialize(base, options), options); + relative = parse(serialize(relative, options), options); } options = options || {}; if (!options.tolerant && relative.scheme) { @@ -4165,7 +4161,7 @@ var require_fast_uri = __commonJS({ } return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme }; } - function parse3(uri, opts) { + function parse(uri, opts) { return parseWithStatus(uri, opts).parsed; } function normalizeString(uri, opts) { @@ -4202,7 +4198,7 @@ var require_fast_uri = __commonJS({ resolveComponent, equal, serialize, - parse: parse3 + parse }; module.exports = fastUri; module.exports.default = fastUri; @@ -4302,9 +4298,9 @@ var require_core = __commonJS({ }; var MAX_EXPRESSION = 200; function requiredOptions(o) { - var _a3, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0; const s = o.strict; - const _optz = (_a3 = o.code) === null || _a3 === void 0 ? void 0 : _a3.optimize; + const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize; const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0; const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp; const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default; @@ -4362,19 +4358,19 @@ var require_core = __commonJS({ this.addKeyword("$async"); } _addDefaultMetaSchema() { - const { $data, meta: meta3, schemaId } = this.opts; + const { $data, meta, schemaId } = this.opts; let _dataRefSchema = $dataRefSchema; if (schemaId === "id") { _dataRefSchema = { ...$dataRefSchema }; _dataRefSchema.id = _dataRefSchema.$id; delete _dataRefSchema.$id; } - if (meta3 && $data) + if (meta && $data) this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false); } defaultMeta() { - const { meta: meta3, schemaId } = this.opts; - return this.opts.defaultMeta = typeof meta3 == "object" ? meta3[schemaId] || meta3 : void 0; + const { meta, schemaId } = this.opts; + return this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : void 0; } validate(schemaKeyRef, data) { let v; @@ -4394,12 +4390,12 @@ var require_core = __commonJS({ const sch = this._addSchema(schema, _meta); return sch.validate || this._compileSchemaEnv(sch); } - compileAsync(schema, meta3) { + compileAsync(schema, meta) { if (typeof this.opts.loadSchema != "function") { throw new Error("options.loadSchema should be a function"); } const { loadSchema } = this.opts; - return runCompileAsync.call(this, schema, meta3); + return runCompileAsync.call(this, schema, meta); async function runCompileAsync(_schema, _meta) { await loadMetaSchema.call(this, _schema.$schema); const sch = this._addSchema(_schema, _meta); @@ -4431,7 +4427,7 @@ var require_core = __commonJS({ if (!this.refs[ref]) await loadMetaSchema.call(this, _schema.$schema); if (!this.refs[ref]) - this.addSchema(_schema, ref, meta3); + this.addSchema(_schema, ref, meta); } async function _loadSchema(ref) { const p = this._loading[ref]; @@ -4648,7 +4644,7 @@ var require_core = __commonJS({ } } } - _addSchema(schema, meta3, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) { + _addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) { let id; const { schemaId } = this.opts; if (typeof schema == "object") { @@ -4664,7 +4660,7 @@ var require_core = __commonJS({ return sch; baseId = (0, resolve_1.normalizeId)(id || baseId); const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId); - sch = new compile_1.SchemaEnv({ schema, schemaId, meta: meta3, baseId, localRefs }); + sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs }); this._cache.set(sch.schema, sch); if (addSchema && !baseId.startsWith("#")) { if (baseId) @@ -4778,7 +4774,7 @@ var require_core = __commonJS({ } } function addRule(keyword, definition, dataType) { - var _a3; + var _a; const post = definition === null || definition === void 0 ? void 0 : definition.post; if (dataType && post) throw new Error('keyword with "post" flag cannot have "type"'); @@ -4804,7 +4800,7 @@ var require_core = __commonJS({ else ruleGroup.rules.push(rule); RULES.all[keyword] = rule; - (_a3 = definition.implements) === null || _a3 === void 0 ? void 0 : _a3.forEach((kwd) => this.addKeyword(kwd)); + (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd)); } function addBeforeRule(ruleGroup, rule, before) { const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before); @@ -4938,10 +4934,10 @@ var require_ref = __commonJS({ gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`); } function addEvaluatedFrom(source) { - var _a3; + var _a; if (!it.opts.unevaluated) return; - const schEvaluated = (_a3 = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a3 === void 0 ? void 0 : _a3.evaluated; + const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated; if (it.props !== true) { if (schEvaluated && !schEvaluated.dynamicProps) { if (schEvaluated.props !== void 0) { @@ -5003,7 +4999,7 @@ var require_limitNumber = __commonJS({ exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE } }; - var error61 = { + var error = { message: ({ keyword, schemaCode }) => (0, codegen_1.str)`must be ${KWDs[keyword].okStr} ${schemaCode}`, params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}` }; @@ -5012,7 +5008,7 @@ var require_limitNumber = __commonJS({ type: "number", schemaType: "number", $data: true, - error: error61, + error, code(cxt) { const { keyword, data, schemaCode } = cxt; cxt.fail$data((0, codegen_1._)`${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`); @@ -5028,7 +5024,7 @@ var require_multipleOf = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); - var error61 = { + var error = { message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`, params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}` }; @@ -5037,7 +5033,7 @@ var require_multipleOf = __commonJS({ type: "number", schemaType: "number", $data: true, - error: error61, + error, code(cxt) { const { gen, data, schemaCode, it } = cxt; const prec = it.opts.multipleOfPrecision; @@ -5084,7 +5080,7 @@ var require_limitLength = __commonJS({ var codegen_1 = require_codegen(); var util_1 = require_util(); var ucs2length_1 = require_ucs2length(); - var error61 = { + var error = { message({ keyword, schemaCode }) { const comp = keyword === "maxLength" ? "more" : "fewer"; return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} characters`; @@ -5096,7 +5092,7 @@ var require_limitLength = __commonJS({ type: "string", schemaType: "number", $data: true, - error: error61, + error, code(cxt) { const { keyword, data, schemaCode, it } = cxt; const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT; @@ -5116,7 +5112,7 @@ var require_pattern = __commonJS({ var code_1 = require_code2(); var util_1 = require_util(); var codegen_1 = require_codegen(); - var error61 = { + var error = { message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`, params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}` }; @@ -5125,7 +5121,7 @@ var require_pattern = __commonJS({ type: "string", schemaType: "string", $data: true, - error: error61, + error, code(cxt) { const { gen, data, $data, schema, schemaCode, it } = cxt; const u = it.opts.unicodeRegExp ? "u" : ""; @@ -5151,7 +5147,7 @@ var require_limitProperties = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); - var error61 = { + var error = { message({ keyword, schemaCode }) { const comp = keyword === "maxProperties" ? "more" : "fewer"; return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} properties`; @@ -5163,7 +5159,7 @@ var require_limitProperties = __commonJS({ type: "object", schemaType: "number", $data: true, - error: error61, + error, code(cxt) { const { keyword, data, schemaCode } = cxt; const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT; @@ -5182,7 +5178,7 @@ var require_required = __commonJS({ var code_1 = require_code2(); var codegen_1 = require_codegen(); var util_1 = require_util(); - var error61 = { + var error = { message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`, params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}` }; @@ -5191,7 +5187,7 @@ var require_required = __commonJS({ type: "object", schemaType: "array", $data: true, - error: error61, + error, code(cxt) { const { gen, schema, schemaCode, data, $data, it } = cxt; const { opts } = it; @@ -5262,7 +5258,7 @@ var require_limitItems = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); - var error61 = { + var error = { message({ keyword, schemaCode }) { const comp = keyword === "maxItems" ? "more" : "fewer"; return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} items`; @@ -5274,7 +5270,7 @@ var require_limitItems = __commonJS({ type: "array", schemaType: "number", $data: true, - error: error61, + error, code(cxt) { const { keyword, data, schemaCode } = cxt; const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT; @@ -5305,7 +5301,7 @@ var require_uniqueItems = __commonJS({ var codegen_1 = require_codegen(); var util_1 = require_util(); var equal_1 = require_equal(); - var error61 = { + var error = { message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`, params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}` }; @@ -5314,7 +5310,7 @@ var require_uniqueItems = __commonJS({ type: "array", schemaType: "boolean", $data: true, - error: error61, + error, code(cxt) { const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt; if (!$data && !schema) @@ -5371,14 +5367,14 @@ var require_const = __commonJS({ var codegen_1 = require_codegen(); var util_1 = require_util(); var equal_1 = require_equal(); - var error61 = { + var error = { message: "must be equal to constant", params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}` }; var def = { keyword: "const", $data: true, - error: error61, + error, code(cxt) { const { gen, data, $data, schemaCode, schema } = cxt; if ($data || schema && typeof schema == "object") { @@ -5400,7 +5396,7 @@ var require_enum = __commonJS({ var codegen_1 = require_codegen(); var util_1 = require_util(); var equal_1 = require_equal(); - var error61 = { + var error = { message: "must be equal to one of the allowed values", params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}` }; @@ -5408,7 +5404,7 @@ var require_enum = __commonJS({ keyword: "enum", schemaType: "array", $data: true, - error: error61, + error, code(cxt) { const { gen, data, $data, schema, schemaCode, it } = cxt; if (!$data && schema.length === 0) @@ -5487,7 +5483,7 @@ var require_additionalItems = __commonJS({ exports.validateAdditionalItems = void 0; var codegen_1 = require_codegen(); var util_1 = require_util(); - var error61 = { + var error = { message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`, params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}` }; @@ -5496,7 +5492,7 @@ var require_additionalItems = __commonJS({ type: "array", schemaType: ["boolean", "object"], before: "uniqueItems", - error: error61, + error, code(cxt) { const { parentSchema, it } = cxt; const { items } = parentSchema; @@ -5615,7 +5611,7 @@ var require_items2020 = __commonJS({ var util_1 = require_util(); var code_1 = require_code2(); var additionalItems_1 = require_additionalItems(); - var error61 = { + var error = { message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`, params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}` }; @@ -5624,7 +5620,7 @@ var require_items2020 = __commonJS({ type: "array", schemaType: ["object", "boolean"], before: "uniqueItems", - error: error61, + error, code(cxt) { const { schema, parentSchema, it } = cxt; const { prefixItems } = parentSchema; @@ -5648,7 +5644,7 @@ var require_contains = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); var util_1 = require_util(); - var error61 = { + var error = { message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`, params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}` }; @@ -5658,7 +5654,7 @@ var require_contains = __commonJS({ schemaType: ["object", "boolean"], before: "uniqueItems", trackErrors: true, - error: error61, + error, code(cxt) { const { gen, schema, parentSchema, data, it } = cxt; let min; @@ -5836,7 +5832,7 @@ var require_propertyNames = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); var util_1 = require_util(); - var error61 = { + var error = { message: "property name must be valid", params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}` }; @@ -5844,7 +5840,7 @@ var require_propertyNames = __commonJS({ keyword: "propertyNames", type: "object", schemaType: ["object", "boolean"], - error: error61, + error, code(cxt) { const { gen, schema, data, it } = cxt; if ((0, util_1.alwaysValidSchema)(it, schema)) @@ -5881,7 +5877,7 @@ var require_additionalProperties = __commonJS({ var codegen_1 = require_codegen(); var names_1 = require_names(); var util_1 = require_util(); - var error61 = { + var error = { message: "must NOT have additional properties", params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}` }; @@ -5891,7 +5887,7 @@ var require_additionalProperties = __commonJS({ schemaType: ["boolean", "object"], allowUndefined: true, trackErrors: true, - error: error61, + error, code(cxt) { const { gen, schema, parentSchema, data, errsCount, it } = cxt; if (!errsCount) @@ -6165,7 +6161,7 @@ var require_oneOf = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); var util_1 = require_util(); - var error61 = { + var error = { message: "must match exactly one schema in oneOf", params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}` }; @@ -6173,7 +6169,7 @@ var require_oneOf = __commonJS({ keyword: "oneOf", schemaType: "array", trackErrors: true, - error: error61, + error, code(cxt) { const { gen, schema, parentSchema, it } = cxt; if (!Array.isArray(schema)) @@ -6250,7 +6246,7 @@ var require_if = __commonJS({ Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); var util_1 = require_util(); - var error61 = { + var error = { message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`, params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}` }; @@ -6258,7 +6254,7 @@ var require_if = __commonJS({ keyword: "if", schemaType: ["object", "boolean"], trackErrors: true, - error: error61, + error, code(cxt) { const { gen, parentSchema, it } = cxt; if (parentSchema.then === void 0 && parentSchema.else === void 0) { @@ -6384,7 +6380,7 @@ var require_format = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var codegen_1 = require_codegen(); - var error61 = { + var error = { message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`, params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}` }; @@ -6393,7 +6389,7 @@ var require_format = __commonJS({ type: ["number", "string"], schemaType: "string", $data: true, - error: error61, + error, code(cxt, ruleType) { const { gen, data, $data, schema, schemaCode, it } = cxt; const { opts, errSchemaPath, schemaEnv, self } = it; @@ -6548,7 +6544,7 @@ var require_discriminator = __commonJS({ var compile_1 = require_compile(); var ref_error_1 = require_ref_error(); var util_1 = require_util(); - var error61 = { + var error = { message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`, params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}` }; @@ -6556,7 +6552,7 @@ var require_discriminator = __commonJS({ keyword: "discriminator", type: "object", schemaType: "object", - error: error61, + error, code(cxt) { const { gen, data, schema, parentSchema, it } = cxt; const { oneOf } = parentSchema; @@ -6592,7 +6588,7 @@ var require_discriminator = __commonJS({ return _valid; } function getMapping() { - var _a3; + var _a; const oneOfMapping = {}; const topRequired = hasRequired(parentSchema); let tagRequired = true; @@ -6606,7 +6602,7 @@ var require_discriminator = __commonJS({ if (sch === void 0) throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref); } - const propSch = (_a3 = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a3 === void 0 ? void 0 : _a3[tagName]; + const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName]; if (typeof propSch != "object") { throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`); } @@ -6616,8 +6612,8 @@ var require_discriminator = __commonJS({ if (!tagRequired) throw new Error(`discriminator: "${tagName}" must be required`); return oneOfMapping; - function hasRequired({ required: required2 }) { - return Array.isArray(required2) && required2.includes(tagName); + function hasRequired({ required }) { + return Array.isArray(required) && required.includes(tagName); } function addMappings(sch, i) { if (sch.const) { @@ -6876,12 +6872,12 @@ var require_formats = __commonJS({ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatNames = exports.fastFormats = exports.fullFormats = void 0; - function fmtDef(validate2, compare) { - return { validate: validate2, compare }; + function fmtDef(validate, compare) { + return { validate, compare }; } exports.fullFormats = { // date: http://tools.ietf.org/html/rfc3339#section-5.6 - date: fmtDef(date5, compareDate), + date: fmtDef(date, compareDate), // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 time: fmtDef(getTime(true), compareTime), "date-time": fmtDef(getDateTime(true), compareDateTime), @@ -6947,7 +6943,7 @@ var require_formats = __commonJS({ } var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - function date5(str) { + function date(str) { const matches = DATE.exec(str); if (!matches) return false; @@ -6967,7 +6963,7 @@ var require_formats = __commonJS({ } var TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i; function getTime(strictTimeZone) { - return function time3(str) { + return function time(str) { const matches = TIME.exec(str); if (!matches) return false; @@ -7013,10 +7009,10 @@ var require_formats = __commonJS({ } var DATE_TIME_SEPARATOR = /t|\s/i; function getDateTime(strictTimeZone) { - const time3 = getTime(strictTimeZone); + const time = getTime(strictTimeZone); return function date_time(str) { const dateTime = str.split(DATE_TIME_SEPARATOR); - return dateTime.length === 2 && date5(dateTime[0]) && time3(dateTime[1]); + return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1]); }; } function compareDateTime(dt1, dt2) { @@ -7088,7 +7084,7 @@ var require_limit = __commonJS({ formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE } }; - var error61 = { + var error = { message: ({ keyword, schemaCode }) => (0, codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`, params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}` }; @@ -7097,7 +7093,7 @@ var require_limit = __commonJS({ type: "string", schemaType: "string", $data: true, - error: error61, + error, code(cxt) { const { gen, data, schemaCode, keyword, it } = cxt; const { opts, self } = it; @@ -7175,9 +7171,9 @@ var require_dist = __commonJS({ return f; }; function addFormats(ajv, list, fs, exportName) { - var _a3; + var _a; var _b; - (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`; + (_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`; for (const f of list) ajv.addFormat(f, fs[f]); } @@ -7187,23018 +7183,194 @@ var require_dist = __commonJS({ } }); -// node_modules/zod/v3/helpers/util.js -var util; -(function(util2) { - util2.assertEqual = (_) => { - }; - function assertIs2(_arg) { +// node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +import * as z3rt from "zod/v3"; +import * as z4mini from "zod/v4-mini"; +function isZ4Schema(s) { + const schema = s; + return !!schema._zod; +} +function objectFromShape(shape) { + const values = Object.values(shape); + if (values.length === 0) + return z4mini.object({}); + const allV4 = values.every(isZ4Schema); + const allV3 = values.every((s) => !isZ4Schema(s)); + if (allV4) + return z4mini.object(shape); + if (allV3) + return z3rt.object(shape); + throw new Error("Mixed Zod versions detected in object shape."); +} +function safeParse2(schema, data) { + if (isZ4Schema(schema)) { + const result2 = z4mini.safeParse(schema, data); + return result2; } - util2.assertIs = assertIs2; - function assertNever2(_x) { - throw new Error(); + const v3Schema = schema; + const result = v3Schema.safeParse(data); + return result; +} +async function safeParseAsync2(schema, data) { + if (isZ4Schema(schema)) { + const result2 = await z4mini.safeParseAsync(schema, data); + return result2; } - util2.assertNever = assertNever2; - util2.arrayToEnum = (items) => { - const obj = {}; - for (const item of items) { - obj[item] = item; - } - return obj; - }; - util2.getValidEnumValues = (obj) => { - const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number"); - const filtered = {}; - for (const k of validKeys) { - filtered[k] = obj[k]; - } - return util2.objectValues(filtered); - }; - util2.objectValues = (obj) => { - return util2.objectKeys(obj).map(function(e) { - return obj[e]; - }); - }; - util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object3) => { - const keys = []; - for (const key in object3) { - if (Object.prototype.hasOwnProperty.call(object3, key)) { - keys.push(key); - } - } - return keys; - }; - util2.find = (arr, checker) => { - for (const item of arr) { - if (checker(item)) - return item; - } + const v3Schema = schema; + const result = await v3Schema.safeParseAsync(data); + return result; +} +function getObjectShape(schema) { + if (!schema) return void 0; - }; - util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val; - function joinValues2(array2, separator = " | ") { - return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator); - } - util2.joinValues = joinValues2; - util2.jsonStringifyReplacer = (_, value) => { - if (typeof value === "bigint") { - return value.toString(); - } - return value; - }; -})(util || (util = {})); -var objectUtil; -(function(objectUtil2) { - objectUtil2.mergeShapes = (first, second) => { - return { - ...first, - ...second - // second overwrites first - }; - }; -})(objectUtil || (objectUtil = {})); -var ZodParsedType = util.arrayToEnum([ - "string", - "nan", - "number", - "integer", - "float", - "boolean", - "date", - "bigint", - "symbol", - "function", - "undefined", - "null", - "array", - "object", - "unknown", - "promise", - "void", - "never", - "map", - "set" -]); -var getParsedType = (data) => { - const t = typeof data; - switch (t) { - case "undefined": - return ZodParsedType.undefined; - case "string": - return ZodParsedType.string; - case "number": - return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number; - case "boolean": - return ZodParsedType.boolean; - case "function": - return ZodParsedType.function; - case "bigint": - return ZodParsedType.bigint; - case "symbol": - return ZodParsedType.symbol; - case "object": - if (Array.isArray(data)) { - return ZodParsedType.array; - } - if (data === null) { - return ZodParsedType.null; - } - if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") { - return ZodParsedType.promise; - } - if (typeof Map !== "undefined" && data instanceof Map) { - return ZodParsedType.map; - } - if (typeof Set !== "undefined" && data instanceof Set) { - return ZodParsedType.set; - } - if (typeof Date !== "undefined" && data instanceof Date) { - return ZodParsedType.date; - } - return ZodParsedType.object; - default: - return ZodParsedType.unknown; + let rawShape; + if (isZ4Schema(schema)) { + const v4Schema = schema; + rawShape = v4Schema._zod?.def?.shape; + } else { + const v3Schema = schema; + rawShape = v3Schema.shape; } -}; - -// node_modules/zod/v3/ZodError.js -var ZodIssueCode = util.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" -]); -var ZodError = class _ZodError extends Error { - get errors() { - return this.issues; - } - constructor(issues) { - super(); - this.issues = []; - this.addIssue = (sub) => { - this.issues = [...this.issues, sub]; - }; - this.addIssues = (subs = []) => { - this.issues = [...this.issues, ...subs]; - }; - const actualProto = new.target.prototype; - if (Object.setPrototypeOf) { - Object.setPrototypeOf(this, actualProto); - } else { - this.__proto__ = actualProto; + if (!rawShape) + return void 0; + if (typeof rawShape === "function") { + try { + return rawShape(); + } catch { + return void 0; } - this.name = "ZodError"; - this.issues = issues; } - format(_mapper) { - const mapper = _mapper || function(issue2) { - return issue2.message; - }; - const fieldErrors = { _errors: [] }; - const processError = (error61) => { - for (const issue2 of error61.issues) { - if (issue2.code === "invalid_union") { - issue2.unionErrors.map(processError); - } else if (issue2.code === "invalid_return_type") { - processError(issue2.returnTypeError); - } else if (issue2.code === "invalid_arguments") { - processError(issue2.argumentsError); - } else if (issue2.path.length === 0) { - fieldErrors._errors.push(mapper(issue2)); - } else { - let curr = fieldErrors; - let i = 0; - while (i < issue2.path.length) { - const el = issue2.path[i]; - const terminal = i === issue2.path.length - 1; - if (el === "_errors") { - if (terminal) - curr._errors.push(mapper(issue2)); - i++; - continue; - } - if (!Object.prototype.hasOwnProperty.call(curr, el)) { - if (el === "__proto__") { - Object.defineProperty(curr, el, { - value: { _errors: [] }, - writable: true, - enumerable: true, - configurable: true - }); - } else { - curr[el] = { _errors: [] }; - } - } - curr = curr[el]; - if (terminal) { - curr._errors.push(mapper(issue2)); - } - i++; - } - } + return rawShape; +} +function normalizeObjectSchema(schema) { + if (!schema) + return void 0; + if (typeof schema === "object") { + const asV3 = schema; + const asV4 = schema; + if (!asV3._def && !asV4._zod) { + const values = Object.values(schema); + if (values.length > 0 && values.every((v) => typeof v === "object" && v !== null && (v._def !== void 0 || v._zod !== void 0 || typeof v.parse === "function"))) { + return objectFromShape(schema); } - }; - processError(this); - return fieldErrors; - } - static assert(value) { - if (!(value instanceof _ZodError)) { - throw new Error(`Not a ZodError: ${value}`); } } - toString() { - return this.message; - } - get message() { - return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2); - } - get isEmpty() { - return this.issues.length === 0; - } - flatten(mapper = (issue2) => issue2.message) { - const fieldErrors = /* @__PURE__ */ Object.create(null); - const formErrors = []; - for (const sub of this.issues) { - if (sub.path.length > 0) { - const firstEl = sub.path[0]; - fieldErrors[firstEl] = fieldErrors[firstEl] || []; - fieldErrors[firstEl].push(mapper(sub)); - } else { - formErrors.push(mapper(sub)); - } + if (isZ4Schema(schema)) { + const v4Schema = schema; + const def = v4Schema._zod?.def; + if (def && (def.type === "object" || def.shape !== void 0)) { + return schema; + } + } else { + const v3Schema = schema; + if (v3Schema.shape !== void 0) { + return schema; } - return { formErrors, fieldErrors }; - } - get formErrors() { - return this.flatten(); - } -}; -ZodError.create = (issues) => { - const error61 = new ZodError(issues); - return error61; -}; - -// node_modules/zod/v3/locales/en.js -var errorMap = (issue2, _ctx) => { - let message; - switch (issue2.code) { - case ZodIssueCode.invalid_type: - if (issue2.received === ZodParsedType.undefined) { - message = "Required"; - } else { - message = `Expected ${issue2.expected}, received ${issue2.received}`; - } - break; - case ZodIssueCode.invalid_literal: - message = `Invalid literal value, expected ${JSON.stringify(issue2.expected, util.jsonStringifyReplacer)}`; - break; - case ZodIssueCode.unrecognized_keys: - message = `Unrecognized key(s) in object: ${util.joinValues(issue2.keys, ", ")}`; - break; - case ZodIssueCode.invalid_union: - message = `Invalid input`; - break; - case ZodIssueCode.invalid_union_discriminator: - message = `Invalid discriminator value. Expected ${util.joinValues(issue2.options)}`; - break; - case ZodIssueCode.invalid_enum_value: - message = `Invalid enum value. Expected ${util.joinValues(issue2.options)}, received '${issue2.received}'`; - break; - case ZodIssueCode.invalid_arguments: - message = `Invalid function arguments`; - break; - case ZodIssueCode.invalid_return_type: - message = `Invalid function return type`; - break; - case ZodIssueCode.invalid_date: - message = `Invalid date`; - break; - case ZodIssueCode.invalid_string: - if (typeof issue2.validation === "object") { - if ("includes" in issue2.validation) { - message = `Invalid input: must include "${issue2.validation.includes}"`; - if (typeof issue2.validation.position === "number") { - message = `${message} at one or more positions greater than or equal to ${issue2.validation.position}`; - } - } else if ("startsWith" in issue2.validation) { - message = `Invalid input: must start with "${issue2.validation.startsWith}"`; - } else if ("endsWith" in issue2.validation) { - message = `Invalid input: must end with "${issue2.validation.endsWith}"`; - } else { - util.assertNever(issue2.validation); - } - } else if (issue2.validation !== "regex") { - message = `Invalid ${issue2.validation}`; - } else { - message = "Invalid"; - } - break; - case ZodIssueCode.too_small: - if (issue2.type === "array") - message = `Array must contain ${issue2.exact ? "exactly" : issue2.inclusive ? `at least` : `more than`} ${issue2.minimum} element(s)`; - else if (issue2.type === "string") - message = `String must contain ${issue2.exact ? "exactly" : issue2.inclusive ? `at least` : `over`} ${issue2.minimum} character(s)`; - else if (issue2.type === "number") - message = `Number must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${issue2.minimum}`; - else if (issue2.type === "bigint") - message = `Number must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${issue2.minimum}`; - else if (issue2.type === "date") - message = `Date must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue2.minimum))}`; - else - message = "Invalid input"; - break; - case ZodIssueCode.too_big: - if (issue2.type === "array") - message = `Array must contain ${issue2.exact ? `exactly` : issue2.inclusive ? `at most` : `less than`} ${issue2.maximum} element(s)`; - else if (issue2.type === "string") - message = `String must contain ${issue2.exact ? `exactly` : issue2.inclusive ? `at most` : `under`} ${issue2.maximum} character(s)`; - else if (issue2.type === "number") - message = `Number must be ${issue2.exact ? `exactly` : issue2.inclusive ? `less than or equal to` : `less than`} ${issue2.maximum}`; - else if (issue2.type === "bigint") - message = `BigInt must be ${issue2.exact ? `exactly` : issue2.inclusive ? `less than or equal to` : `less than`} ${issue2.maximum}`; - else if (issue2.type === "date") - message = `Date must be ${issue2.exact ? `exactly` : issue2.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue2.maximum))}`; - else - message = "Invalid input"; - break; - case ZodIssueCode.custom: - message = `Invalid input`; - break; - case ZodIssueCode.invalid_intersection_types: - message = `Intersection results could not be merged`; - break; - case ZodIssueCode.not_multiple_of: - message = `Number must be a multiple of ${issue2.multipleOf}`; - break; - case ZodIssueCode.not_finite: - message = "Number must be finite"; - break; - default: - message = _ctx.defaultError; - util.assertNever(issue2); } - return { message }; -}; -var en_default = errorMap; - -// node_modules/zod/v3/errors.js -var overrideErrorMap = en_default; -function getErrorMap() { - return overrideErrorMap; + return void 0; } - -// node_modules/zod/v3/helpers/parseUtil.js -var makeIssue = (params) => { - const { data, path: path3, errorMaps, issueData } = params; - const fullPath = [...path3, ...issueData.path || []]; - const fullIssue = { - ...issueData, - path: fullPath - }; - if (issueData.message !== void 0) { - return { - ...issueData, - path: fullPath, - message: issueData.message - }; - } - let errorMessage = ""; - const maps = errorMaps.filter((m) => !!m).slice().reverse(); - for (const map2 of maps) { - errorMessage = map2(fullIssue, { data, defaultError: errorMessage }).message; +function getDotPath(path3) { + if (path3.length === 0) { + return "object root"; } - return { - ...issueData, - path: fullPath, - message: errorMessage - }; -}; -function addIssueToContext(ctx, issueData) { - const overrideMap = getErrorMap(); - const issue2 = makeIssue({ - issueData, - data: ctx.data, - path: ctx.path, - errorMaps: [ - ctx.common.contextualErrorMap, - // contextual error map is first priority - ctx.schemaErrorMap, - // then schema-bound map if available - overrideMap, - // then global override map - overrideMap === en_default ? void 0 : en_default - // then global default map - ].filter((x) => !!x) - }); - ctx.common.issues.push(issue2); -} -var ParseStatus = class _ParseStatus { - constructor() { - this.value = "valid"; - } - dirty() { - if (this.value === "valid") - this.value = "dirty"; - } - abort() { - if (this.value !== "aborted") - this.value = "aborted"; - } - static mergeArray(status, results) { - const arrayValue = []; - for (const s of results) { - if (s.status === "aborted") - return INVALID; - if (s.status === "dirty") - status.dirty(); - arrayValue.push(s.value); - } - return { status: status.value, value: arrayValue }; - } - static async mergeObjectAsync(status, pairs) { - const syncPairs = []; - for (const pair of pairs) { - const key = await pair.key; - const value = await pair.value; - syncPairs.push({ - key, - value - }); + return path3.reduce((acc, seg, index) => { + if (index === 0) { + return String(seg); } - return _ParseStatus.mergeObjectSync(status, syncPairs); - } - static mergeObjectSync(status, pairs) { - const finalObject = {}; - for (const pair of pairs) { - const { key, value } = pair; - if (key.status === "aborted") - return INVALID; - if (value.status === "aborted") - return INVALID; - if (key.status === "dirty") - status.dirty(); - if (value.status === "dirty") - status.dirty(); - if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) { - finalObject[key.value] = value.value; - } + if (typeof seg === "number") { + return `${acc}[${seg}]`; } - return { status: status.value, value: finalObject }; - } -}; -var INVALID = Object.freeze({ - status: "aborted" -}); -var DIRTY = (value) => ({ status: "dirty", value }); -var OK = (value) => ({ status: "valid", value }); -var isAborted = (x) => x.status === "aborted"; -var isDirty = (x) => x.status === "dirty"; -var isValid = (x) => x.status === "valid"; -var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise; - -// node_modules/zod/v3/helpers/errorUtil.js -var errorUtil; -(function(errorUtil2) { - errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {}; - errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message; -})(errorUtil || (errorUtil = {})); - -// node_modules/zod/v3/types.js -var ParseInputLazyPath = class { - constructor(parent, value, path3, key) { - this._cachedPath = []; - this.parent = parent; - this.data = value; - this._path = path3; - this._key = key; - } - 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 `${acc}.${seg}`; + }, ""); +} +function getParseErrorMessage(error) { + if (error && typeof error === "object") { + if ("issues" in error && Array.isArray(error.issues) && error.issues.length > 0) { + return error.issues.map((i) => { + if (!i.path?.length) { + return i.message; + } + return `${i.message} at ${getDotPath(i.path)}`; + }).join("\n"); } - return this._cachedPath; - } -}; -var handleResult = (ctx, result) => { - if (isValid(result)) { - return { success: true, data: result.value }; - } else { - if (!ctx.common.issues.length) { - throw new Error("Validation failed but no issues detected."); + if ("message" in error && typeof error.message === "string") { + return error.message; } - return { - success: false, - get error() { - if (this._error) - return this._error; - const error61 = new ZodError(ctx.common.issues); - this._error = error61; - return this._error; - } - }; - } -}; -function processCreateParams(params) { - if (!params) - return {}; - const { errorMap: errorMap2, invalid_type_error, required_error, description } = params; - if (errorMap2 && (invalid_type_error || required_error)) { - throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`); - } - if (errorMap2) - return { errorMap: errorMap2, description }; - const customMap = (iss, ctx) => { - const { message } = params; - if (iss.code === "invalid_enum_value") { - return { message: message ?? ctx.defaultError }; - } - if (typeof ctx.data === "undefined") { - return { message: message ?? required_error ?? ctx.defaultError }; - } - if (iss.code !== "invalid_type") - return { message: ctx.defaultError }; - return { message: message ?? invalid_type_error ?? ctx.defaultError }; - }; - return { errorMap: customMap, description }; -} -var ZodType = class { - get description() { - return this._def.description; - } - _getType(input2) { - return getParsedType(input2.data); - } - _getOrReturnCtx(input2, ctx) { - return ctx || { - common: input2.parent.common, - data: input2.data, - parsedType: getParsedType(input2.data), - schemaErrorMap: this._def.errorMap, - path: input2.path, - parent: input2.parent - }; - } - _processInputParams(input2) { - return { - status: new ParseStatus(), - ctx: { - common: input2.parent.common, - data: input2.data, - parsedType: getParsedType(input2.data), - schemaErrorMap: this._def.errorMap, - path: input2.path, - parent: input2.parent - } - }; - } - _parseSync(input2) { - const result = this._parse(input2); - if (isAsync(result)) { - throw new Error("Synchronous parse encountered promise."); + try { + return JSON.stringify(error); + } catch { + return String(error); } - return result; } - _parseAsync(input2) { - const result = this._parse(input2); - return Promise.resolve(result); + return String(error); +} +function getSchemaDescription(schema) { + return schema.description; +} +function isSchemaOptional(schema) { + if (isZ4Schema(schema)) { + const v4Schema = schema; + return v4Schema._zod?.def?.type === "optional"; } - parse(data, params) { - const result = this.safeParse(data, params); - if (result.success) - return result.data; - throw result.error; + const v3Schema = schema; + if (typeof schema.isOptional === "function") { + return schema.isOptional(); } - safeParse(data, params) { - const ctx = { - common: { - issues: [], - async: params?.async ?? false, - contextualErrorMap: params?.errorMap - }, - path: params?.path || [], - schemaErrorMap: this._def.errorMap, - parent: null, - data, - parsedType: getParsedType(data) - }; - const result = this._parseSync({ data, path: ctx.path, parent: ctx }); - return handleResult(ctx, result); - } - "~validate"(data) { - const ctx = { - common: { - issues: [], - async: !!this["~standard"].async - }, - path: [], - schemaErrorMap: this._def.errorMap, - parent: null, - data, - parsedType: getParsedType(data) - }; - if (!this["~standard"].async) { - try { - const result = this._parseSync({ data, path: [], parent: ctx }); - return isValid(result) ? { - value: result.value - } : { - issues: ctx.common.issues - }; - } catch (err) { - if (err?.message?.toLowerCase()?.includes("encountered")) { - this["~standard"].async = true; - } - ctx.common = { - issues: [], - async: true - }; + return v3Schema._def?.typeName === "ZodOptional"; +} +function getLiteralValue(schema) { + if (isZ4Schema(schema)) { + const v4Schema = schema; + const def2 = v4Schema._zod?.def; + if (def2) { + if (def2.value !== void 0) + return def2.value; + if (Array.isArray(def2.values) && def2.values.length > 0) { + return def2.values[0]; } } - return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? { - value: result.value - } : { - issues: ctx.common.issues - }); } - async parseAsync(data, params) { - const result = await this.safeParseAsync(data, params); - if (result.success) - return result.data; - throw result.error; + const v3Schema = schema; + const def = v3Schema._def; + if (def) { + if (def.value !== void 0) + return def.value; + if (Array.isArray(def.values) && def.values.length > 0) { + return def.values[0]; + } } - async safeParseAsync(data, params) { - const ctx = { - common: { - issues: [], - contextualErrorMap: params?.errorMap, - async: true - }, - path: params?.path || [], - schemaErrorMap: this._def.errorMap, - parent: null, - data, - parsedType: getParsedType(data) - }; - const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx }); - const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult)); - return handleResult(ctx, result); - } - refine(check2, message) { - const getIssueProperties = (val) => { - if (typeof message === "string" || typeof message === "undefined") { - return { message }; - } else if (typeof message === "function") { - return message(val); - } else { - return message; - } - }; - return this._refinement((val, ctx) => { - const result = check2(val); - const setError = () => ctx.addIssue({ - code: ZodIssueCode.custom, - ...getIssueProperties(val) - }); - if (typeof Promise !== "undefined" && result instanceof Promise) { - return result.then((data) => { - if (!data) { - setError(); - return false; - } else { - return true; - } - }); - } - if (!result) { - setError(); - return false; - } else { - return true; - } - }); - } - refinement(check2, refinementData) { - return this._refinement((val, ctx) => { - if (!check2(val)) { - ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData); - return false; - } else { - return true; - } - }); - } - _refinement(refinement) { - return new ZodEffects({ - schema: this, - typeName: ZodFirstPartyTypeKind.ZodEffects, - effect: { type: "refinement", refinement } - }); - } - superRefine(refinement) { - return this._refinement(refinement); - } - constructor(def) { - this.spa = this.safeParseAsync; - this._def = def; - 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: (data) => this["~validate"](data) - }; - } - optional() { - return ZodOptional.create(this, this._def); - } - nullable() { - return ZodNullable.create(this, this._def); - } - nullish() { - return this.nullable().optional(); - } - array() { - return ZodArray.create(this); - } - promise() { - return ZodPromise.create(this, this._def); - } - or(option) { - return ZodUnion.create([this, option], this._def); - } - and(incoming) { - return ZodIntersection.create(this, incoming, this._def); - } - transform(transform2) { - return new ZodEffects({ - ...processCreateParams(this._def), - schema: this, - typeName: ZodFirstPartyTypeKind.ZodEffects, - effect: { type: "transform", transform: transform2 } - }); - } - default(def) { - const defaultValueFunc = typeof def === "function" ? def : () => def; - return new ZodDefault({ - ...processCreateParams(this._def), - innerType: this, - defaultValue: defaultValueFunc, - typeName: ZodFirstPartyTypeKind.ZodDefault - }); - } - brand() { - return new ZodBranded({ - typeName: ZodFirstPartyTypeKind.ZodBranded, - type: this, - ...processCreateParams(this._def) - }); - } - catch(def) { - const catchValueFunc = typeof def === "function" ? def : () => def; - return new ZodCatch({ - ...processCreateParams(this._def), - innerType: this, - catchValue: catchValueFunc, - typeName: ZodFirstPartyTypeKind.ZodCatch - }); - } - describe(description) { - const This = this.constructor; - return new This({ - ...this._def, - description - }); - } - pipe(target) { - return ZodPipeline.create(this, target); - } - readonly() { - return ZodReadonly.create(this); - } - isOptional() { - return this.safeParse(void 0).success; - } - isNullable() { - return this.safeParse(null).success; - } -}; -var cuidRegex = /^c[^\s-]{8,}$/i; -var cuid2Regex = /^[0-9a-z]+$/; -var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i; -var 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; -var nanoidRegex = /^[a-z0-9_-]{21}$/i; -var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/; -var 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)?)??$/; -var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i; -var _emojiRegex = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`; -var emojiRegex; -var 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])$/; -var 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])$/; -var 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]))$/; -var 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])$/; -var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/; -var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/; -var 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])))`; -var dateRegex = new RegExp(`^${dateRegexSource}$`); -function timeRegexSource(args) { - let secondsRegexSource = `[0-5]\\d`; - if (args.precision) { - secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`; - } else if (args.precision == null) { - secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`; - } - const secondsQuantifier = args.precision ? "+" : "?"; - return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`; -} -function timeRegex(args) { - return new RegExp(`^${timeRegexSource(args)}$`); -} -function datetimeRegex(args) { - let regex = `${dateRegexSource}T${timeRegexSource(args)}`; - const opts = []; - opts.push(args.local ? `Z?` : `Z`); - if (args.offset) - opts.push(`([+-]\\d{2}:?\\d{2})`); - regex = `${regex}(${opts.join("|")})`; - return new RegExp(`^${regex}$`); -} -function isValidIP(ip, version2) { - if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) { - return true; - } - if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) { - return true; - } - return false; -} -function isValidJWT(jwt2, alg) { - if (!jwtRegex.test(jwt2)) - return false; - try { - const [header] = jwt2.split("."); - if (!header) - return false; - const base643 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "="); - const decoded = JSON.parse(atob(base643)); - if (typeof decoded !== "object" || decoded === null) - return false; - if ("typ" in decoded && decoded?.typ !== "JWT") - return false; - if (!decoded.alg) - return false; - if (alg && decoded.alg !== alg) - return false; - return true; - } catch { - return false; - } -} -function isValidCidr(ip, version2) { - if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) { - return true; - } - if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) { - return true; - } - return false; -} -var ZodString = class _ZodString2 extends ZodType { - _parse(input2) { - if (this._def.coerce) { - input2.data = String(input2.data); - } - const parsedType2 = this._getType(input2); - if (parsedType2 !== ZodParsedType.string) { - const ctx2 = this._getOrReturnCtx(input2); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.string, - received: ctx2.parsedType - }); - return INVALID; - } - const status = new ParseStatus(); - let ctx = void 0; - for (const check2 of this._def.checks) { - if (check2.kind === "min") { - if (input2.data.length < check2.value) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: check2.value, - type: "string", - inclusive: true, - exact: false, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "max") { - if (input2.data.length > check2.value) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: check2.value, - type: "string", - inclusive: true, - exact: false, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "length") { - const tooBig = input2.data.length > check2.value; - const tooSmall = input2.data.length < check2.value; - if (tooBig || tooSmall) { - ctx = this._getOrReturnCtx(input2, ctx); - if (tooBig) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: check2.value, - type: "string", - inclusive: true, - exact: true, - message: check2.message - }); - } else if (tooSmall) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: check2.value, - type: "string", - inclusive: true, - exact: true, - message: check2.message - }); - } - status.dirty(); - } - } else if (check2.kind === "email") { - if (!emailRegex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "email", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "emoji") { - if (!emojiRegex) { - emojiRegex = new RegExp(_emojiRegex, "u"); - } - if (!emojiRegex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "emoji", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "uuid") { - if (!uuidRegex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "uuid", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "nanoid") { - if (!nanoidRegex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "nanoid", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "cuid") { - if (!cuidRegex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "cuid", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "cuid2") { - if (!cuid2Regex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "cuid2", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "ulid") { - if (!ulidRegex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "ulid", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "url") { - try { - new URL(input2.data); - } catch { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "url", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "regex") { - check2.regex.lastIndex = 0; - const testResult = check2.regex.test(input2.data); - if (!testResult) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "regex", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "trim") { - input2.data = input2.data.trim(); - } else if (check2.kind === "includes") { - if (!input2.data.includes(check2.value, check2.position)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: { includes: check2.value, position: check2.position }, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "toLowerCase") { - input2.data = input2.data.toLowerCase(); - } else if (check2.kind === "toUpperCase") { - input2.data = input2.data.toUpperCase(); - } else if (check2.kind === "startsWith") { - if (!input2.data.startsWith(check2.value)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: { startsWith: check2.value }, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "endsWith") { - if (!input2.data.endsWith(check2.value)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: { endsWith: check2.value }, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "datetime") { - const regex = datetimeRegex(check2); - if (!regex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: "datetime", - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "date") { - const regex = dateRegex; - if (!regex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: "date", - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "time") { - const regex = timeRegex(check2); - if (!regex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_string, - validation: "time", - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "duration") { - if (!durationRegex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "duration", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "ip") { - if (!isValidIP(input2.data, check2.version)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "ip", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "jwt") { - if (!isValidJWT(input2.data, check2.alg)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "jwt", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "cidr") { - if (!isValidCidr(input2.data, check2.version)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "cidr", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "base64") { - if (!base64Regex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "base64", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "base64url") { - if (!base64urlRegex.test(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - validation: "base64url", - code: ZodIssueCode.invalid_string, - message: check2.message - }); - status.dirty(); - } - } else { - util.assertNever(check2); - } - } - return { status: status.value, value: input2.data }; - } - _regex(regex, validation, message) { - return this.refinement((data) => regex.test(data), { - validation, - code: ZodIssueCode.invalid_string, - ...errorUtil.errToObj(message) - }); - } - _addCheck(check2) { - return new _ZodString2({ - ...this._def, - checks: [...this._def.checks, check2] - }); - } - email(message) { - return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) }); - } - url(message) { - return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) }); - } - emoji(message) { - return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) }); - } - uuid(message) { - return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) }); - } - nanoid(message) { - return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) }); - } - cuid(message) { - return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) }); - } - cuid2(message) { - return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) }); - } - ulid(message) { - return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) }); - } - base64(message) { - return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) }); - } - base64url(message) { - return this._addCheck({ - kind: "base64url", - ...errorUtil.errToObj(message) - }); - } - jwt(options) { - return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) }); - } - ip(options) { - return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) }); - } - cidr(options) { - return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) }); - } - datetime(options) { - if (typeof options === "string") { - return this._addCheck({ - kind: "datetime", - precision: null, - offset: false, - local: false, - message: options - }); - } - return this._addCheck({ - kind: "datetime", - precision: typeof options?.precision === "undefined" ? null : options?.precision, - offset: options?.offset ?? false, - local: options?.local ?? false, - ...errorUtil.errToObj(options?.message) - }); - } - date(message) { - return this._addCheck({ kind: "date", message }); - } - time(options) { - if (typeof options === "string") { - return this._addCheck({ - kind: "time", - precision: null, - message: options - }); - } - return this._addCheck({ - kind: "time", - precision: typeof options?.precision === "undefined" ? null : options?.precision, - ...errorUtil.errToObj(options?.message) - }); - } - duration(message) { - return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) }); - } - regex(regex, message) { - return this._addCheck({ - kind: "regex", - regex, - ...errorUtil.errToObj(message) - }); - } - includes(value, options) { - return this._addCheck({ - kind: "includes", - value, - position: options?.position, - ...errorUtil.errToObj(options?.message) - }); - } - startsWith(value, message) { - return this._addCheck({ - kind: "startsWith", - value, - ...errorUtil.errToObj(message) - }); - } - endsWith(value, message) { - return this._addCheck({ - kind: "endsWith", - value, - ...errorUtil.errToObj(message) - }); - } - min(minLength, message) { - return this._addCheck({ - kind: "min", - value: minLength, - ...errorUtil.errToObj(message) - }); - } - max(maxLength, message) { - return this._addCheck({ - kind: "max", - value: maxLength, - ...errorUtil.errToObj(message) - }); - } - length(len, message) { - return this._addCheck({ - kind: "length", - value: len, - ...errorUtil.errToObj(message) - }); - } - /** - * Equivalent to `.min(1)` - */ - nonempty(message) { - return this.min(1, errorUtil.errToObj(message)); - } - trim() { - return new _ZodString2({ - ...this._def, - checks: [...this._def.checks, { kind: "trim" }] - }); - } - toLowerCase() { - return new _ZodString2({ - ...this._def, - checks: [...this._def.checks, { kind: "toLowerCase" }] - }); - } - toUpperCase() { - return new _ZodString2({ - ...this._def, - checks: [...this._def.checks, { kind: "toUpperCase" }] - }); - } - get isDatetime() { - return !!this._def.checks.find((ch) => ch.kind === "datetime"); - } - get isDate() { - return !!this._def.checks.find((ch) => ch.kind === "date"); - } - get isTime() { - return !!this._def.checks.find((ch) => ch.kind === "time"); - } - get isDuration() { - return !!this._def.checks.find((ch) => ch.kind === "duration"); - } - get isEmail() { - return !!this._def.checks.find((ch) => ch.kind === "email"); - } - get isURL() { - return !!this._def.checks.find((ch) => ch.kind === "url"); - } - get isEmoji() { - return !!this._def.checks.find((ch) => ch.kind === "emoji"); - } - get isUUID() { - return !!this._def.checks.find((ch) => ch.kind === "uuid"); - } - get isNANOID() { - return !!this._def.checks.find((ch) => ch.kind === "nanoid"); - } - get isCUID() { - return !!this._def.checks.find((ch) => ch.kind === "cuid"); - } - get isCUID2() { - return !!this._def.checks.find((ch) => ch.kind === "cuid2"); - } - get isULID() { - return !!this._def.checks.find((ch) => ch.kind === "ulid"); - } - get isIP() { - return !!this._def.checks.find((ch) => ch.kind === "ip"); - } - get isCIDR() { - return !!this._def.checks.find((ch) => ch.kind === "cidr"); - } - get isBase64() { - return !!this._def.checks.find((ch) => ch.kind === "base64"); - } - get isBase64url() { - return !!this._def.checks.find((ch) => ch.kind === "base64url"); - } - get minLength() { - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "min") { - if (min === null || ch.value > min) - min = ch.value; - } - } - return min; - } - get maxLength() { - let max = null; - for (const ch of this._def.checks) { - if (ch.kind === "max") { - if (max === null || ch.value < max) - max = ch.value; - } - } - return max; - } -}; -ZodString.create = (params) => { - return new ZodString({ - checks: [], - typeName: ZodFirstPartyTypeKind.ZodString, - coerce: params?.coerce ?? false, - ...processCreateParams(params) - }); -}; -function floatSafeRemainder(val, step) { - const valDecCount = (val.toString().split(".")[1] || "").length; - const stepDecCount = (step.toString().split(".")[1] || "").length; - const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount; - const valInt = Number.parseInt(val.toFixed(decCount).replace(".", "")); - const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", "")); - return valInt % stepInt / 10 ** decCount; -} -var ZodNumber = class _ZodNumber extends ZodType { - constructor() { - super(...arguments); - this.min = this.gte; - this.max = this.lte; - this.step = this.multipleOf; - } - _parse(input2) { - if (this._def.coerce) { - input2.data = Number(input2.data); - } - const parsedType2 = this._getType(input2); - if (parsedType2 !== ZodParsedType.number) { - const ctx2 = this._getOrReturnCtx(input2); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.number, - received: ctx2.parsedType - }); - return INVALID; - } - let ctx = void 0; - const status = new ParseStatus(); - for (const check2 of this._def.checks) { - if (check2.kind === "int") { - if (!util.isInteger(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: "integer", - received: "float", - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "min") { - const tooSmall = check2.inclusive ? input2.data < check2.value : input2.data <= check2.value; - if (tooSmall) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: check2.value, - type: "number", - inclusive: check2.inclusive, - exact: false, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "max") { - const tooBig = check2.inclusive ? input2.data > check2.value : input2.data >= check2.value; - if (tooBig) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: check2.value, - type: "number", - inclusive: check2.inclusive, - exact: false, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "multipleOf") { - if (floatSafeRemainder(input2.data, check2.value) !== 0) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.not_multiple_of, - multipleOf: check2.value, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "finite") { - if (!Number.isFinite(input2.data)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.not_finite, - message: check2.message - }); - status.dirty(); - } - } else { - util.assertNever(check2); - } - } - return { status: status.value, value: input2.data }; - } - gte(value, message) { - return this.setLimit("min", value, true, errorUtil.toString(message)); - } - gt(value, message) { - return this.setLimit("min", value, false, errorUtil.toString(message)); - } - lte(value, message) { - return this.setLimit("max", value, true, errorUtil.toString(message)); - } - lt(value, message) { - return this.setLimit("max", value, false, errorUtil.toString(message)); - } - setLimit(kind, value, inclusive, message) { - return new _ZodNumber({ - ...this._def, - checks: [ - ...this._def.checks, - { - kind, - value, - inclusive, - message: errorUtil.toString(message) - } - ] - }); - } - _addCheck(check2) { - return new _ZodNumber({ - ...this._def, - checks: [...this._def.checks, check2] - }); - } - int(message) { - return this._addCheck({ - kind: "int", - message: errorUtil.toString(message) - }); - } - positive(message) { - return this._addCheck({ - kind: "min", - value: 0, - inclusive: false, - message: errorUtil.toString(message) - }); - } - negative(message) { - return this._addCheck({ - kind: "max", - value: 0, - inclusive: false, - message: errorUtil.toString(message) - }); - } - nonpositive(message) { - return this._addCheck({ - kind: "max", - value: 0, - inclusive: true, - message: errorUtil.toString(message) - }); - } - nonnegative(message) { - return this._addCheck({ - kind: "min", - value: 0, - inclusive: true, - message: errorUtil.toString(message) - }); - } - multipleOf(value, message) { - return this._addCheck({ - kind: "multipleOf", - value, - message: errorUtil.toString(message) - }); - } - finite(message) { - return this._addCheck({ - kind: "finite", - message: errorUtil.toString(message) - }); - } - safe(message) { - return this._addCheck({ - kind: "min", - inclusive: true, - value: Number.MIN_SAFE_INTEGER, - message: errorUtil.toString(message) - })._addCheck({ - kind: "max", - inclusive: true, - value: Number.MAX_SAFE_INTEGER, - message: errorUtil.toString(message) - }); - } - get minValue() { - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "min") { - if (min === null || ch.value > min) - min = ch.value; - } - } - return min; - } - get maxValue() { - let max = null; - for (const ch of this._def.checks) { - if (ch.kind === "max") { - if (max === null || ch.value < max) - max = ch.value; - } - } - return max; - } - get isInt() { - return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value)); - } - get isFinite() { - let max = null; - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") { - return true; - } else if (ch.kind === "min") { - if (min === null || ch.value > min) - min = ch.value; - } else if (ch.kind === "max") { - if (max === null || ch.value < max) - max = ch.value; - } - } - return Number.isFinite(min) && Number.isFinite(max); - } -}; -ZodNumber.create = (params) => { - return new ZodNumber({ - checks: [], - typeName: ZodFirstPartyTypeKind.ZodNumber, - coerce: params?.coerce || false, - ...processCreateParams(params) - }); -}; -var ZodBigInt = class _ZodBigInt extends ZodType { - constructor() { - super(...arguments); - this.min = this.gte; - this.max = this.lte; - } - _parse(input2) { - if (this._def.coerce) { - try { - input2.data = BigInt(input2.data); - } catch { - return this._getInvalidInput(input2); - } - } - const parsedType2 = this._getType(input2); - if (parsedType2 !== ZodParsedType.bigint) { - return this._getInvalidInput(input2); - } - let ctx = void 0; - const status = new ParseStatus(); - for (const check2 of this._def.checks) { - if (check2.kind === "min") { - const tooSmall = check2.inclusive ? input2.data < check2.value : input2.data <= check2.value; - if (tooSmall) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - type: "bigint", - minimum: check2.value, - inclusive: check2.inclusive, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "max") { - const tooBig = check2.inclusive ? input2.data > check2.value : input2.data >= check2.value; - if (tooBig) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - type: "bigint", - maximum: check2.value, - inclusive: check2.inclusive, - message: check2.message - }); - status.dirty(); - } - } else if (check2.kind === "multipleOf") { - if (input2.data % check2.value !== BigInt(0)) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.not_multiple_of, - multipleOf: check2.value, - message: check2.message - }); - status.dirty(); - } - } else { - util.assertNever(check2); - } - } - return { status: status.value, value: input2.data }; - } - _getInvalidInput(input2) { - const ctx = this._getOrReturnCtx(input2); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.bigint, - received: ctx.parsedType - }); - return INVALID; - } - gte(value, message) { - return this.setLimit("min", value, true, errorUtil.toString(message)); - } - gt(value, message) { - return this.setLimit("min", value, false, errorUtil.toString(message)); - } - lte(value, message) { - return this.setLimit("max", value, true, errorUtil.toString(message)); - } - lt(value, message) { - return this.setLimit("max", value, false, errorUtil.toString(message)); - } - setLimit(kind, value, inclusive, message) { - return new _ZodBigInt({ - ...this._def, - checks: [ - ...this._def.checks, - { - kind, - value, - inclusive, - message: errorUtil.toString(message) - } - ] - }); - } - _addCheck(check2) { - return new _ZodBigInt({ - ...this._def, - checks: [...this._def.checks, check2] - }); - } - positive(message) { - return this._addCheck({ - kind: "min", - value: BigInt(0), - inclusive: false, - message: errorUtil.toString(message) - }); - } - negative(message) { - return this._addCheck({ - kind: "max", - value: BigInt(0), - inclusive: false, - message: errorUtil.toString(message) - }); - } - nonpositive(message) { - return this._addCheck({ - kind: "max", - value: BigInt(0), - inclusive: true, - message: errorUtil.toString(message) - }); - } - nonnegative(message) { - return this._addCheck({ - kind: "min", - value: BigInt(0), - inclusive: true, - message: errorUtil.toString(message) - }); - } - multipleOf(value, message) { - return this._addCheck({ - kind: "multipleOf", - value, - message: errorUtil.toString(message) - }); - } - get minValue() { - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "min") { - if (min === null || ch.value > min) - min = ch.value; - } - } - return min; - } - get maxValue() { - let max = null; - for (const ch of this._def.checks) { - if (ch.kind === "max") { - if (max === null || ch.value < max) - max = ch.value; - } - } - return max; - } -}; -ZodBigInt.create = (params) => { - return new ZodBigInt({ - checks: [], - typeName: ZodFirstPartyTypeKind.ZodBigInt, - coerce: params?.coerce ?? false, - ...processCreateParams(params) - }); -}; -var ZodBoolean = class extends ZodType { - _parse(input2) { - if (this._def.coerce) { - input2.data = Boolean(input2.data); - } - const parsedType2 = this._getType(input2); - if (parsedType2 !== ZodParsedType.boolean) { - const ctx = this._getOrReturnCtx(input2); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.boolean, - received: ctx.parsedType - }); - return INVALID; - } - return OK(input2.data); - } -}; -ZodBoolean.create = (params) => { - return new ZodBoolean({ - typeName: ZodFirstPartyTypeKind.ZodBoolean, - coerce: params?.coerce || false, - ...processCreateParams(params) - }); -}; -var ZodDate = class _ZodDate extends ZodType { - _parse(input2) { - if (this._def.coerce) { - input2.data = new Date(input2.data); - } - const parsedType2 = this._getType(input2); - if (parsedType2 !== ZodParsedType.date) { - const ctx2 = this._getOrReturnCtx(input2); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.date, - received: ctx2.parsedType - }); - return INVALID; - } - if (Number.isNaN(input2.data.getTime())) { - const ctx2 = this._getOrReturnCtx(input2); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_date - }); - return INVALID; - } - const status = new ParseStatus(); - let ctx = void 0; - for (const check2 of this._def.checks) { - if (check2.kind === "min") { - if (input2.data.getTime() < check2.value) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - message: check2.message, - inclusive: true, - exact: false, - minimum: check2.value, - type: "date" - }); - status.dirty(); - } - } else if (check2.kind === "max") { - if (input2.data.getTime() > check2.value) { - ctx = this._getOrReturnCtx(input2, ctx); - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - message: check2.message, - inclusive: true, - exact: false, - maximum: check2.value, - type: "date" - }); - status.dirty(); - } - } else { - util.assertNever(check2); - } - } - return { - status: status.value, - value: new Date(input2.data.getTime()) - }; - } - _addCheck(check2) { - return new _ZodDate({ - ...this._def, - checks: [...this._def.checks, check2] - }); - } - min(minDate, message) { - return this._addCheck({ - kind: "min", - value: minDate.getTime(), - message: errorUtil.toString(message) - }); - } - max(maxDate, message) { - return this._addCheck({ - kind: "max", - value: maxDate.getTime(), - message: errorUtil.toString(message) - }); - } - get minDate() { - let min = null; - for (const ch of this._def.checks) { - if (ch.kind === "min") { - if (min === null || ch.value > min) - min = ch.value; - } - } - return min != null ? new Date(min) : null; - } - get maxDate() { - let max = null; - for (const ch of this._def.checks) { - if (ch.kind === "max") { - if (max === null || ch.value < max) - max = ch.value; - } - } - return max != null ? new Date(max) : null; - } -}; -ZodDate.create = (params) => { - return new ZodDate({ - checks: [], - coerce: params?.coerce || false, - typeName: ZodFirstPartyTypeKind.ZodDate, - ...processCreateParams(params) - }); -}; -var ZodSymbol = class extends ZodType { - _parse(input2) { - const parsedType2 = this._getType(input2); - if (parsedType2 !== ZodParsedType.symbol) { - const ctx = this._getOrReturnCtx(input2); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.symbol, - received: ctx.parsedType - }); - return INVALID; - } - return OK(input2.data); - } -}; -ZodSymbol.create = (params) => { - return new ZodSymbol({ - typeName: ZodFirstPartyTypeKind.ZodSymbol, - ...processCreateParams(params) - }); -}; -var ZodUndefined = class extends ZodType { - _parse(input2) { - const parsedType2 = this._getType(input2); - if (parsedType2 !== ZodParsedType.undefined) { - const ctx = this._getOrReturnCtx(input2); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.undefined, - received: ctx.parsedType - }); - return INVALID; - } - return OK(input2.data); - } -}; -ZodUndefined.create = (params) => { - return new ZodUndefined({ - typeName: ZodFirstPartyTypeKind.ZodUndefined, - ...processCreateParams(params) - }); -}; -var ZodNull = class extends ZodType { - _parse(input2) { - const parsedType2 = this._getType(input2); - if (parsedType2 !== ZodParsedType.null) { - const ctx = this._getOrReturnCtx(input2); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.null, - received: ctx.parsedType - }); - return INVALID; - } - return OK(input2.data); - } -}; -ZodNull.create = (params) => { - return new ZodNull({ - typeName: ZodFirstPartyTypeKind.ZodNull, - ...processCreateParams(params) - }); -}; -var ZodAny = class extends ZodType { - constructor() { - super(...arguments); - this._any = true; - } - _parse(input2) { - return OK(input2.data); - } -}; -ZodAny.create = (params) => { - return new ZodAny({ - typeName: ZodFirstPartyTypeKind.ZodAny, - ...processCreateParams(params) - }); -}; -var ZodUnknown = class extends ZodType { - constructor() { - super(...arguments); - this._unknown = true; - } - _parse(input2) { - return OK(input2.data); - } -}; -ZodUnknown.create = (params) => { - return new ZodUnknown({ - typeName: ZodFirstPartyTypeKind.ZodUnknown, - ...processCreateParams(params) - }); -}; -var ZodNever = class extends ZodType { - _parse(input2) { - const ctx = this._getOrReturnCtx(input2); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.never, - received: ctx.parsedType - }); - return INVALID; - } -}; -ZodNever.create = (params) => { - return new ZodNever({ - typeName: ZodFirstPartyTypeKind.ZodNever, - ...processCreateParams(params) - }); -}; -var ZodVoid = class extends ZodType { - _parse(input2) { - const parsedType2 = this._getType(input2); - if (parsedType2 !== ZodParsedType.undefined) { - const ctx = this._getOrReturnCtx(input2); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.void, - received: ctx.parsedType - }); - return INVALID; - } - return OK(input2.data); - } -}; -ZodVoid.create = (params) => { - return new ZodVoid({ - typeName: ZodFirstPartyTypeKind.ZodVoid, - ...processCreateParams(params) - }); -}; -var ZodArray = class _ZodArray extends ZodType { - _parse(input2) { - const { ctx, status } = this._processInputParams(input2); - const def = this._def; - if (ctx.parsedType !== ZodParsedType.array) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.array, - received: ctx.parsedType - }); - return INVALID; - } - if (def.exactLength !== null) { - const tooBig = ctx.data.length > def.exactLength.value; - const tooSmall = ctx.data.length < def.exactLength.value; - if (tooBig || tooSmall) { - addIssueToContext(ctx, { - code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small, - minimum: tooSmall ? def.exactLength.value : void 0, - maximum: tooBig ? def.exactLength.value : void 0, - type: "array", - inclusive: true, - exact: true, - message: def.exactLength.message - }); - status.dirty(); - } - } - if (def.minLength !== null) { - if (ctx.data.length < def.minLength.value) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: def.minLength.value, - type: "array", - inclusive: true, - exact: false, - message: def.minLength.message - }); - status.dirty(); - } - } - if (def.maxLength !== null) { - if (ctx.data.length > def.maxLength.value) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: def.maxLength.value, - type: "array", - inclusive: true, - exact: false, - message: def.maxLength.message - }); - status.dirty(); - } - } - if (ctx.common.async) { - return Promise.all([...ctx.data].map((item, i) => { - return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i)); - })).then((result2) => { - return ParseStatus.mergeArray(status, result2); - }); - } - const result = [...ctx.data].map((item, i) => { - return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i)); - }); - return ParseStatus.mergeArray(status, result); - } - get element() { - return this._def.type; - } - min(minLength, message) { - return new _ZodArray({ - ...this._def, - minLength: { value: minLength, message: errorUtil.toString(message) } - }); - } - max(maxLength, message) { - return new _ZodArray({ - ...this._def, - maxLength: { value: maxLength, message: errorUtil.toString(message) } - }); - } - length(len, message) { - return new _ZodArray({ - ...this._def, - exactLength: { value: len, message: errorUtil.toString(message) } - }); - } - nonempty(message) { - return this.min(1, message); - } -}; -ZodArray.create = (schema, params) => { - return new ZodArray({ - type: schema, - minLength: null, - maxLength: null, - exactLength: null, - typeName: ZodFirstPartyTypeKind.ZodArray, - ...processCreateParams(params) - }); -}; -function deepPartialify(schema) { - if (schema instanceof ZodObject) { - const newShape = {}; - for (const key in schema.shape) { - const fieldSchema = schema.shape[key]; - newShape[key] = ZodOptional.create(deepPartialify(fieldSchema)); - } - return new ZodObject({ - ...schema._def, - shape: () => newShape - }); - } else if (schema instanceof ZodArray) { - return new ZodArray({ - ...schema._def, - type: deepPartialify(schema.element) - }); - } else if (schema instanceof ZodOptional) { - return ZodOptional.create(deepPartialify(schema.unwrap())); - } else if (schema instanceof ZodNullable) { - return ZodNullable.create(deepPartialify(schema.unwrap())); - } else if (schema instanceof ZodTuple) { - return ZodTuple.create(schema.items.map((item) => deepPartialify(item))); - } else { - return schema; - } -} -var ZodObject = class _ZodObject extends ZodType { - constructor() { - super(...arguments); - this._cached = null; - this.nonstrict = this.passthrough; - this.augment = this.extend; - } - _getCached() { - if (this._cached !== null) - return this._cached; - const shape = this._def.shape(); - const keys = util.objectKeys(shape); - this._cached = { shape, keys }; - return this._cached; - } - _parse(input2) { - const parsedType2 = this._getType(input2); - if (parsedType2 !== ZodParsedType.object) { - const ctx2 = this._getOrReturnCtx(input2); - addIssueToContext(ctx2, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.object, - received: ctx2.parsedType - }); - return INVALID; - } - const { status, ctx } = this._processInputParams(input2); - const { shape, keys: shapeKeys } = this._getCached(); - const extraKeys = []; - if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) { - for (const key in ctx.data) { - if (!shapeKeys.includes(key)) { - extraKeys.push(key); - } - } - } - const pairs = []; - for (const key of shapeKeys) { - const keyValidator = shape[key]; - const value = ctx.data[key]; - pairs.push({ - key: { status: "valid", value: key }, - value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)), - alwaysSet: key in ctx.data - }); - } - if (this._def.catchall instanceof ZodNever) { - const unknownKeys = this._def.unknownKeys; - if (unknownKeys === "passthrough") { - for (const key of extraKeys) { - pairs.push({ - key: { status: "valid", value: key }, - value: { status: "valid", value: ctx.data[key] } - }); - } - } else if (unknownKeys === "strict") { - if (extraKeys.length > 0) { - addIssueToContext(ctx, { - code: ZodIssueCode.unrecognized_keys, - keys: extraKeys - }); - status.dirty(); - } - } else if (unknownKeys === "strip") { - } else { - throw new Error(`Internal ZodObject error: invalid unknownKeys value.`); - } - } else { - const catchall = this._def.catchall; - for (const key of extraKeys) { - const value = ctx.data[key]; - pairs.push({ - key: { status: "valid", value: key }, - value: catchall._parse( - new ParseInputLazyPath(ctx, value, ctx.path, key) - //, ctx.child(key), value, getParsedType(value) - ), - alwaysSet: key in ctx.data - }); - } - } - if (ctx.common.async) { - return Promise.resolve().then(async () => { - const syncPairs = []; - for (const pair of pairs) { - const key = await pair.key; - const value = await pair.value; - syncPairs.push({ - key, - value, - alwaysSet: pair.alwaysSet - }); - } - return syncPairs; - }).then((syncPairs) => { - return ParseStatus.mergeObjectSync(status, syncPairs); - }); - } else { - return ParseStatus.mergeObjectSync(status, pairs); - } - } - get shape() { - return this._def.shape(); - } - strict(message) { - errorUtil.errToObj; - return new _ZodObject({ - ...this._def, - unknownKeys: "strict", - ...message !== void 0 ? { - errorMap: (issue2, ctx) => { - const defaultError = this._def.errorMap?.(issue2, ctx).message ?? ctx.defaultError; - if (issue2.code === "unrecognized_keys") - return { - message: errorUtil.errToObj(message).message ?? defaultError - }; - return { - message: defaultError - }; - } - } : {} - }); - } - strip() { - return new _ZodObject({ - ...this._def, - unknownKeys: "strip" - }); - } - passthrough() { - return new _ZodObject({ - ...this._def, - unknownKeys: "passthrough" - }); - } - // const AugmentFactory = - // (def: Def) => - // ( - // augmentation: Augmentation - // ): ZodObject< - // extendShape, Augmentation>, - // Def["unknownKeys"], - // Def["catchall"] - // > => { - // return new ZodObject({ - // ...def, - // shape: () => ({ - // ...def.shape(), - // ...augmentation, - // }), - // }) as any; - // }; - extend(augmentation) { - return new _ZodObject({ - ...this._def, - shape: () => ({ - ...this._def.shape(), - ...augmentation - }) - }); - } - /** - * Prior to zod@1.0.12 there was a bug in the - * inferred type of merged objects. Please - * upgrade if you are experiencing issues. - */ - merge(merging) { - const merged = new _ZodObject({ - unknownKeys: merging._def.unknownKeys, - catchall: merging._def.catchall, - shape: () => ({ - ...this._def.shape(), - ...merging._def.shape() - }), - typeName: ZodFirstPartyTypeKind.ZodObject - }); - return merged; - } - // merge< - // Incoming extends AnyZodObject, - // Augmentation extends Incoming["shape"], - // NewOutput extends { - // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation - // ? Augmentation[k]["_output"] - // : k extends keyof Output - // ? Output[k] - // : never; - // }, - // NewInput extends { - // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation - // ? Augmentation[k]["_input"] - // : k extends keyof Input - // ? Input[k] - // : never; - // } - // >( - // merging: Incoming - // ): ZodObject< - // extendShape>, - // Incoming["_def"]["unknownKeys"], - // Incoming["_def"]["catchall"], - // NewOutput, - // NewInput - // > { - // const merged: any = new ZodObject({ - // unknownKeys: merging._def.unknownKeys, - // catchall: merging._def.catchall, - // shape: () => - // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()), - // typeName: ZodFirstPartyTypeKind.ZodObject, - // }) as any; - // return merged; - // } - setKey(key, schema) { - return this.augment({ [key]: schema }); - } - // merge( - // merging: Incoming - // ): //ZodObject = (merging) => { - // ZodObject< - // extendShape>, - // Incoming["_def"]["unknownKeys"], - // Incoming["_def"]["catchall"] - // > { - // // const mergedShape = objectUtil.mergeShapes( - // // this._def.shape(), - // // merging._def.shape() - // // ); - // const merged: any = new ZodObject({ - // unknownKeys: merging._def.unknownKeys, - // catchall: merging._def.catchall, - // shape: () => - // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()), - // typeName: ZodFirstPartyTypeKind.ZodObject, - // }) as any; - // return merged; - // } - catchall(index) { - return new _ZodObject({ - ...this._def, - catchall: index - }); - } - pick(mask) { - const shape = {}; - for (const key of util.objectKeys(mask)) { - if (mask[key] && this.shape[key]) { - shape[key] = this.shape[key]; - } - } - return new _ZodObject({ - ...this._def, - shape: () => shape - }); - } - omit(mask) { - const shape = {}; - for (const key of util.objectKeys(this.shape)) { - if (!mask[key]) { - shape[key] = this.shape[key]; - } - } - return new _ZodObject({ - ...this._def, - shape: () => shape - }); - } - /** - * @deprecated - */ - deepPartial() { - return deepPartialify(this); - } - partial(mask) { - const newShape = {}; - for (const key of util.objectKeys(this.shape)) { - const fieldSchema = this.shape[key]; - if (mask && !mask[key]) { - newShape[key] = fieldSchema; - } else { - newShape[key] = fieldSchema.optional(); - } - } - return new _ZodObject({ - ...this._def, - shape: () => newShape - }); - } - required(mask) { - const newShape = {}; - for (const key of util.objectKeys(this.shape)) { - if (mask && !mask[key]) { - newShape[key] = this.shape[key]; - } else { - const fieldSchema = this.shape[key]; - let newField = fieldSchema; - while (newField instanceof ZodOptional) { - newField = newField._def.innerType; - } - newShape[key] = newField; - } - } - return new _ZodObject({ - ...this._def, - shape: () => newShape - }); - } - keyof() { - return createZodEnum(util.objectKeys(this.shape)); - } -}; -ZodObject.create = (shape, params) => { - return new ZodObject({ - shape: () => shape, - unknownKeys: "strip", - catchall: ZodNever.create(), - typeName: ZodFirstPartyTypeKind.ZodObject, - ...processCreateParams(params) - }); -}; -ZodObject.strictCreate = (shape, params) => { - return new ZodObject({ - shape: () => shape, - unknownKeys: "strict", - catchall: ZodNever.create(), - typeName: ZodFirstPartyTypeKind.ZodObject, - ...processCreateParams(params) - }); -}; -ZodObject.lazycreate = (shape, params) => { - return new ZodObject({ - shape, - unknownKeys: "strip", - catchall: ZodNever.create(), - typeName: ZodFirstPartyTypeKind.ZodObject, - ...processCreateParams(params) - }); -}; -var ZodUnion = class extends ZodType { - _parse(input2) { - const { ctx } = this._processInputParams(input2); - const options = this._def.options; - function handleResults(results) { - for (const result of results) { - if (result.result.status === "valid") { - return result.result; - } - } - for (const result of results) { - if (result.result.status === "dirty") { - ctx.common.issues.push(...result.ctx.common.issues); - return result.result; - } - } - const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues)); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_union, - unionErrors - }); - return INVALID; - } - if (ctx.common.async) { - return Promise.all(options.map(async (option) => { - const childCtx = { - ...ctx, - common: { - ...ctx.common, - issues: [] - }, - parent: null - }; - return { - result: await option._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: childCtx - }), - ctx: childCtx - }; - })).then(handleResults); - } else { - let dirty = void 0; - const issues = []; - for (const option of options) { - const childCtx = { - ...ctx, - common: { - ...ctx.common, - issues: [] - }, - parent: null - }; - const result = option._parseSync({ - data: ctx.data, - path: ctx.path, - parent: childCtx - }); - if (result.status === "valid") { - return result; - } else if (result.status === "dirty" && !dirty) { - dirty = { result, ctx: childCtx }; - } - if (childCtx.common.issues.length) { - issues.push(childCtx.common.issues); - } - } - if (dirty) { - ctx.common.issues.push(...dirty.ctx.common.issues); - return dirty.result; - } - const unionErrors = issues.map((issues2) => new ZodError(issues2)); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_union, - unionErrors - }); - return INVALID; - } - } - get options() { - return this._def.options; - } -}; -ZodUnion.create = (types, params) => { - return new ZodUnion({ - options: types, - typeName: ZodFirstPartyTypeKind.ZodUnion, - ...processCreateParams(params) - }); -}; -var getDiscriminator = (type) => { - if (type instanceof ZodLazy) { - return getDiscriminator(type.schema); - } else if (type instanceof ZodEffects) { - return getDiscriminator(type.innerType()); - } else if (type instanceof ZodLiteral) { - return [type.value]; - } else if (type instanceof ZodEnum) { - return type.options; - } else if (type instanceof ZodNativeEnum) { - return util.objectValues(type.enum); - } else if (type instanceof ZodDefault) { - return getDiscriminator(type._def.innerType); - } else if (type instanceof ZodUndefined) { - return [void 0]; - } else if (type instanceof ZodNull) { - return [null]; - } else if (type instanceof ZodOptional) { - return [void 0, ...getDiscriminator(type.unwrap())]; - } else if (type instanceof ZodNullable) { - return [null, ...getDiscriminator(type.unwrap())]; - } else if (type instanceof ZodBranded) { - return getDiscriminator(type.unwrap()); - } else if (type instanceof ZodReadonly) { - return getDiscriminator(type.unwrap()); - } else if (type instanceof ZodCatch) { - return getDiscriminator(type._def.innerType); - } else { - return []; - } -}; -var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType { - _parse(input2) { - const { ctx } = this._processInputParams(input2); - if (ctx.parsedType !== ZodParsedType.object) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.object, - received: ctx.parsedType - }); - return INVALID; - } - const discriminator = this.discriminator; - const discriminatorValue = ctx.data[discriminator]; - const option = this.optionsMap.get(discriminatorValue); - if (!option) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_union_discriminator, - options: Array.from(this.optionsMap.keys()), - path: [discriminator] - }); - return INVALID; - } - if (ctx.common.async) { - return option._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }); - } else { - return option._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }); - } - } - get discriminator() { - return this._def.discriminator; - } - get options() { - return this._def.options; - } - get optionsMap() { - return this._def.optionsMap; - } - /** - * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor. - * However, it only allows a union of objects, all of which need to share a discriminator property. This property must - * have a different value for each object in the union. - * @param discriminator the name of the discriminator property - * @param types an array of object schemas - * @param params - */ - static create(discriminator, options, params) { - const optionsMap = /* @__PURE__ */ new Map(); - for (const type of options) { - const discriminatorValues = getDiscriminator(type.shape[discriminator]); - if (!discriminatorValues.length) { - throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`); - } - for (const value of discriminatorValues) { - if (optionsMap.has(value)) { - throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`); - } - optionsMap.set(value, type); - } - } - return new _ZodDiscriminatedUnion({ - typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion, - discriminator, - options, - optionsMap, - ...processCreateParams(params) - }); - } -}; -function mergeValues(a, b) { - const aType = getParsedType(a); - const bType = getParsedType(b); - if (a === b) { - return { valid: true, data: a }; - } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) { - const bKeys = util.objectKeys(b); - const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1); - const newObj = { ...a, ...b }; - if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) - delete newObj.__proto__; - for (const key of sharedKeys) { - if (key === "__proto__") - continue; - const sharedValue = mergeValues(a[key], b[key]); - if (!sharedValue.valid) { - return { valid: false }; - } - newObj[key] = sharedValue.data; - } - return { valid: true, data: newObj }; - } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) { - if (a.length !== b.length) { - return { valid: false }; - } - const newArray = []; - for (let index = 0; index < a.length; index++) { - const itemA = a[index]; - const itemB = b[index]; - const sharedValue = mergeValues(itemA, itemB); - if (!sharedValue.valid) { - return { valid: false }; - } - newArray.push(sharedValue.data); - } - return { valid: true, data: newArray }; - } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) { - return { valid: true, data: a }; - } else { - return { valid: false }; - } -} -var ZodIntersection = class extends ZodType { - _parse(input2) { - const { status, ctx } = this._processInputParams(input2); - const handleParsed = (parsedLeft, parsedRight) => { - if (isAborted(parsedLeft) || isAborted(parsedRight)) { - return INVALID; - } - const merged = mergeValues(parsedLeft.value, parsedRight.value); - if (!merged.valid) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_intersection_types - }); - return INVALID; - } - if (isDirty(parsedLeft) || isDirty(parsedRight)) { - status.dirty(); - } - return { status: status.value, value: merged.data }; - }; - if (ctx.common.async) { - return Promise.all([ - this._def.left._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }), - this._def.right._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }) - ]).then(([left, right]) => handleParsed(left, right)); - } else { - return handleParsed(this._def.left._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }), this._def.right._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx - })); - } - } -}; -ZodIntersection.create = (left, right, params) => { - return new ZodIntersection({ - left, - right, - typeName: ZodFirstPartyTypeKind.ZodIntersection, - ...processCreateParams(params) - }); -}; -var ZodTuple = class _ZodTuple extends ZodType { - _parse(input2) { - const { status, ctx } = this._processInputParams(input2); - if (ctx.parsedType !== ZodParsedType.array) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.array, - received: ctx.parsedType - }); - return INVALID; - } - if (ctx.data.length < this._def.items.length) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: this._def.items.length, - inclusive: true, - exact: false, - type: "array" - }); - return INVALID; - } - const rest = this._def.rest; - if (!rest && ctx.data.length > this._def.items.length) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: this._def.items.length, - inclusive: true, - exact: false, - type: "array" - }); - status.dirty(); - } - const items = [...ctx.data].map((item, itemIndex) => { - const schema = this._def.items[itemIndex] || this._def.rest; - if (!schema) - return null; - return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex)); - }).filter((x) => !!x); - if (ctx.common.async) { - return Promise.all(items).then((results) => { - return ParseStatus.mergeArray(status, results); - }); - } else { - return ParseStatus.mergeArray(status, items); - } - } - get items() { - return this._def.items; - } - rest(rest) { - return new _ZodTuple({ - ...this._def, - rest - }); - } -}; -ZodTuple.create = (schemas, params) => { - if (!Array.isArray(schemas)) { - throw new Error("You must pass an array of schemas to z.tuple([ ... ])"); - } - return new ZodTuple({ - items: schemas, - typeName: ZodFirstPartyTypeKind.ZodTuple, - rest: null, - ...processCreateParams(params) - }); -}; -var ZodRecord = class _ZodRecord extends ZodType { - get keySchema() { - return this._def.keyType; - } - get valueSchema() { - return this._def.valueType; - } - _parse(input2) { - const { status, ctx } = this._processInputParams(input2); - if (ctx.parsedType !== ZodParsedType.object) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.object, - received: ctx.parsedType - }); - return INVALID; - } - const pairs = []; - const keyType = this._def.keyType; - const valueType = this._def.valueType; - for (const key in ctx.data) { - pairs.push({ - key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)), - value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)), - alwaysSet: key in ctx.data - }); - } - if (ctx.common.async) { - return ParseStatus.mergeObjectAsync(status, pairs); - } else { - return ParseStatus.mergeObjectSync(status, pairs); - } - } - get element() { - return this._def.valueType; - } - static create(first, second, third) { - if (second instanceof ZodType) { - return new _ZodRecord({ - keyType: first, - valueType: second, - typeName: ZodFirstPartyTypeKind.ZodRecord, - ...processCreateParams(third) - }); - } - return new _ZodRecord({ - keyType: ZodString.create(), - valueType: first, - typeName: ZodFirstPartyTypeKind.ZodRecord, - ...processCreateParams(second) - }); - } -}; -var ZodMap = class extends ZodType { - get keySchema() { - return this._def.keyType; - } - get valueSchema() { - return this._def.valueType; - } - _parse(input2) { - const { status, ctx } = this._processInputParams(input2); - if (ctx.parsedType !== ZodParsedType.map) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.map, - received: ctx.parsedType - }); - return INVALID; - } - const keyType = this._def.keyType; - const valueType = this._def.valueType; - const pairs = [...ctx.data.entries()].map(([key, value], index) => { - return { - key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])), - value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"])) - }; - }); - if (ctx.common.async) { - const finalMap = /* @__PURE__ */ new Map(); - return Promise.resolve().then(async () => { - for (const pair of pairs) { - const key = await pair.key; - const value = await pair.value; - if (key.status === "aborted" || value.status === "aborted") { - return INVALID; - } - if (key.status === "dirty" || value.status === "dirty") { - status.dirty(); - } - finalMap.set(key.value, value.value); - } - return { status: status.value, value: finalMap }; - }); - } else { - const finalMap = /* @__PURE__ */ new Map(); - for (const pair of pairs) { - const key = pair.key; - const value = pair.value; - if (key.status === "aborted" || value.status === "aborted") { - return INVALID; - } - if (key.status === "dirty" || value.status === "dirty") { - status.dirty(); - } - finalMap.set(key.value, value.value); - } - return { status: status.value, value: finalMap }; - } - } -}; -ZodMap.create = (keyType, valueType, params) => { - return new ZodMap({ - valueType, - keyType, - typeName: ZodFirstPartyTypeKind.ZodMap, - ...processCreateParams(params) - }); -}; -var ZodSet = class _ZodSet extends ZodType { - _parse(input2) { - const { status, ctx } = this._processInputParams(input2); - if (ctx.parsedType !== ZodParsedType.set) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.set, - received: ctx.parsedType - }); - return INVALID; - } - const def = this._def; - if (def.minSize !== null) { - if (ctx.data.size < def.minSize.value) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_small, - minimum: def.minSize.value, - type: "set", - inclusive: true, - exact: false, - message: def.minSize.message - }); - status.dirty(); - } - } - if (def.maxSize !== null) { - if (ctx.data.size > def.maxSize.value) { - addIssueToContext(ctx, { - code: ZodIssueCode.too_big, - maximum: def.maxSize.value, - type: "set", - inclusive: true, - exact: false, - message: def.maxSize.message - }); - status.dirty(); - } - } - const valueType = this._def.valueType; - function finalizeSet(elements2) { - const parsedSet = /* @__PURE__ */ new Set(); - for (const element of elements2) { - if (element.status === "aborted") - return INVALID; - if (element.status === "dirty") - status.dirty(); - parsedSet.add(element.value); - } - return { status: status.value, value: parsedSet }; - } - const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i))); - if (ctx.common.async) { - return Promise.all(elements).then((elements2) => finalizeSet(elements2)); - } else { - return finalizeSet(elements); - } - } - min(minSize, message) { - return new _ZodSet({ - ...this._def, - minSize: { value: minSize, message: errorUtil.toString(message) } - }); - } - max(maxSize, message) { - return new _ZodSet({ - ...this._def, - maxSize: { value: maxSize, message: errorUtil.toString(message) } - }); - } - size(size, message) { - return this.min(size, message).max(size, message); - } - nonempty(message) { - return this.min(1, message); - } -}; -ZodSet.create = (valueType, params) => { - return new ZodSet({ - valueType, - minSize: null, - maxSize: null, - typeName: ZodFirstPartyTypeKind.ZodSet, - ...processCreateParams(params) - }); -}; -var ZodFunction = class _ZodFunction extends ZodType { - constructor() { - super(...arguments); - this.validate = this.implement; - } - _parse(input2) { - const { ctx } = this._processInputParams(input2); - if (ctx.parsedType !== ZodParsedType.function) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.function, - received: ctx.parsedType - }); - return INVALID; - } - function makeArgsIssue(args, error61) { - return makeIssue({ - data: args, - path: ctx.path, - errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x), - issueData: { - code: ZodIssueCode.invalid_arguments, - argumentsError: error61 - } - }); - } - function makeReturnsIssue(returns, error61) { - return makeIssue({ - data: returns, - path: ctx.path, - errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x), - issueData: { - code: ZodIssueCode.invalid_return_type, - returnTypeError: error61 - } - }); - } - const params = { errorMap: ctx.common.contextualErrorMap }; - const fn = ctx.data; - if (this._def.returns instanceof ZodPromise) { - const me = this; - return OK(async function(...args) { - const error61 = new ZodError([]); - const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => { - error61.addIssue(makeArgsIssue(args, e)); - throw error61; - }); - const result = await Reflect.apply(fn, this, parsedArgs); - const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => { - error61.addIssue(makeReturnsIssue(result, e)); - throw error61; - }); - return parsedReturns; - }); - } else { - const me = this; - return OK(function(...args) { - const parsedArgs = me._def.args.safeParse(args, params); - if (!parsedArgs.success) { - throw new ZodError([makeArgsIssue(args, parsedArgs.error)]); - } - const result = Reflect.apply(fn, this, parsedArgs.data); - const parsedReturns = me._def.returns.safeParse(result, params); - if (!parsedReturns.success) { - throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]); - } - return parsedReturns.data; - }); - } - } - parameters() { - return this._def.args; - } - returnType() { - return this._def.returns; - } - args(...items) { - return new _ZodFunction({ - ...this._def, - args: ZodTuple.create(items).rest(ZodUnknown.create()) - }); - } - returns(returnType) { - return new _ZodFunction({ - ...this._def, - returns: returnType - }); - } - implement(func) { - const validatedFunc = this.parse(func); - return validatedFunc; - } - strictImplement(func) { - const validatedFunc = this.parse(func); - return validatedFunc; - } - static create(args, returns, params) { - return new _ZodFunction({ - args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()), - returns: returns || ZodUnknown.create(), - typeName: ZodFirstPartyTypeKind.ZodFunction, - ...processCreateParams(params) - }); - } -}; -var ZodLazy = class extends ZodType { - get schema() { - return this._def.getter(); - } - _parse(input2) { - const { ctx } = this._processInputParams(input2); - const lazySchema = this._def.getter(); - return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx }); - } -}; -ZodLazy.create = (getter, params) => { - return new ZodLazy({ - getter, - typeName: ZodFirstPartyTypeKind.ZodLazy, - ...processCreateParams(params) - }); -}; -var ZodLiteral = class extends ZodType { - _parse(input2) { - if (input2.data !== this._def.value) { - const ctx = this._getOrReturnCtx(input2); - addIssueToContext(ctx, { - received: ctx.data, - code: ZodIssueCode.invalid_literal, - expected: this._def.value - }); - return INVALID; - } - return { status: "valid", value: input2.data }; - } - get value() { - return this._def.value; - } -}; -ZodLiteral.create = (value, params) => { - return new ZodLiteral({ - value, - typeName: ZodFirstPartyTypeKind.ZodLiteral, - ...processCreateParams(params) - }); -}; -function createZodEnum(values, params) { - return new ZodEnum({ - values, - typeName: ZodFirstPartyTypeKind.ZodEnum, - ...processCreateParams(params) - }); -} -var ZodEnum = class _ZodEnum extends ZodType { - _parse(input2) { - if (typeof input2.data !== "string") { - const ctx = this._getOrReturnCtx(input2); - const expectedValues = this._def.values; - addIssueToContext(ctx, { - expected: util.joinValues(expectedValues), - received: ctx.parsedType, - code: ZodIssueCode.invalid_type - }); - return INVALID; - } - if (!this._cache) { - this._cache = new Set(this._def.values); - } - if (!this._cache.has(input2.data)) { - const ctx = this._getOrReturnCtx(input2); - const expectedValues = this._def.values; - addIssueToContext(ctx, { - received: ctx.data, - code: ZodIssueCode.invalid_enum_value, - options: expectedValues - }); - return INVALID; - } - return OK(input2.data); - } - get options() { - return this._def.values; - } - get enum() { - const enumValues = {}; - for (const val of this._def.values) { - enumValues[val] = val; - } - return enumValues; - } - get Values() { - const enumValues = {}; - for (const val of this._def.values) { - enumValues[val] = val; - } - return enumValues; - } - get Enum() { - const enumValues = {}; - for (const val of this._def.values) { - enumValues[val] = val; - } - return enumValues; - } - extract(values, newDef = this._def) { - return _ZodEnum.create(values, { - ...this._def, - ...newDef - }); - } - exclude(values, newDef = this._def) { - return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), { - ...this._def, - ...newDef - }); - } -}; -ZodEnum.create = createZodEnum; -var ZodNativeEnum = class extends ZodType { - _parse(input2) { - const nativeEnumValues = util.getValidEnumValues(this._def.values); - const ctx = this._getOrReturnCtx(input2); - if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) { - const expectedValues = util.objectValues(nativeEnumValues); - addIssueToContext(ctx, { - expected: util.joinValues(expectedValues), - received: ctx.parsedType, - code: ZodIssueCode.invalid_type - }); - return INVALID; - } - if (!this._cache) { - this._cache = new Set(util.getValidEnumValues(this._def.values)); - } - if (!this._cache.has(input2.data)) { - const expectedValues = util.objectValues(nativeEnumValues); - addIssueToContext(ctx, { - received: ctx.data, - code: ZodIssueCode.invalid_enum_value, - options: expectedValues - }); - return INVALID; - } - return OK(input2.data); - } - get enum() { - return this._def.values; - } -}; -ZodNativeEnum.create = (values, params) => { - return new ZodNativeEnum({ - values, - typeName: ZodFirstPartyTypeKind.ZodNativeEnum, - ...processCreateParams(params) - }); -}; -var ZodPromise = class extends ZodType { - unwrap() { - return this._def.type; - } - _parse(input2) { - const { ctx } = this._processInputParams(input2); - if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) { - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.promise, - received: ctx.parsedType - }); - return INVALID; - } - const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data); - return OK(promisified.then((data) => { - return this._def.type.parseAsync(data, { - path: ctx.path, - errorMap: ctx.common.contextualErrorMap - }); - })); - } -}; -ZodPromise.create = (schema, params) => { - return new ZodPromise({ - type: schema, - typeName: ZodFirstPartyTypeKind.ZodPromise, - ...processCreateParams(params) - }); -}; -var ZodEffects = class extends ZodType { - innerType() { - return this._def.schema; - } - sourceType() { - return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema; - } - _parse(input2) { - const { status, ctx } = this._processInputParams(input2); - const effect = this._def.effect || null; - const checkCtx = { - addIssue: (arg) => { - addIssueToContext(ctx, arg); - if (arg.fatal) { - status.abort(); - } else { - status.dirty(); - } - }, - get path() { - return ctx.path; - } - }; - checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx); - if (effect.type === "preprocess") { - const processed = effect.transform(ctx.data, checkCtx); - if (ctx.common.async) { - return Promise.resolve(processed).then(async (processed2) => { - if (status.value === "aborted") - return INVALID; - const result = await this._def.schema._parseAsync({ - data: processed2, - path: ctx.path, - parent: ctx - }); - if (result.status === "aborted") - return INVALID; - if (result.status === "dirty") - return DIRTY(result.value); - if (status.value === "dirty") - return DIRTY(result.value); - return result; - }); - } else { - if (status.value === "aborted") - return INVALID; - const result = this._def.schema._parseSync({ - data: processed, - path: ctx.path, - parent: ctx - }); - if (result.status === "aborted") - return INVALID; - if (result.status === "dirty") - return DIRTY(result.value); - if (status.value === "dirty") - return DIRTY(result.value); - return result; - } - } - if (effect.type === "refinement") { - const executeRefinement = (acc) => { - const result = effect.refinement(acc, checkCtx); - if (ctx.common.async) { - return Promise.resolve(result); - } - if (result instanceof Promise) { - throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead."); - } - return acc; - }; - if (ctx.common.async === false) { - const inner = this._def.schema._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }); - if (inner.status === "aborted") - return INVALID; - if (inner.status === "dirty") - status.dirty(); - executeRefinement(inner.value); - return { status: status.value, value: inner.value }; - } else { - return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => { - if (inner.status === "aborted") - return INVALID; - if (inner.status === "dirty") - status.dirty(); - return executeRefinement(inner.value).then(() => { - return { status: status.value, value: inner.value }; - }); - }); - } - } - if (effect.type === "transform") { - if (ctx.common.async === false) { - const base = this._def.schema._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }); - if (!isValid(base)) - return INVALID; - const result = effect.transform(base.value, checkCtx); - if (result instanceof Promise) { - throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`); - } - return { status: status.value, value: result }; - } else { - return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => { - if (!isValid(base)) - return INVALID; - return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ - status: status.value, - value: result - })); - }); - } - } - util.assertNever(effect); - } -}; -ZodEffects.create = (schema, effect, params) => { - return new ZodEffects({ - schema, - typeName: ZodFirstPartyTypeKind.ZodEffects, - effect, - ...processCreateParams(params) - }); -}; -ZodEffects.createWithPreprocess = (preprocess2, schema, params) => { - return new ZodEffects({ - schema, - effect: { type: "preprocess", transform: preprocess2 }, - typeName: ZodFirstPartyTypeKind.ZodEffects, - ...processCreateParams(params) - }); -}; -var ZodOptional = class extends ZodType { - _parse(input2) { - const parsedType2 = this._getType(input2); - if (parsedType2 === ZodParsedType.undefined) { - return OK(void 0); - } - return this._def.innerType._parse(input2); - } - unwrap() { - return this._def.innerType; - } -}; -ZodOptional.create = (type, params) => { - return new ZodOptional({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodOptional, - ...processCreateParams(params) - }); -}; -var ZodNullable = class extends ZodType { - _parse(input2) { - const parsedType2 = this._getType(input2); - if (parsedType2 === ZodParsedType.null) { - return OK(null); - } - return this._def.innerType._parse(input2); - } - unwrap() { - return this._def.innerType; - } -}; -ZodNullable.create = (type, params) => { - return new ZodNullable({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodNullable, - ...processCreateParams(params) - }); -}; -var ZodDefault = class extends ZodType { - _parse(input2) { - const { ctx } = this._processInputParams(input2); - let data = ctx.data; - if (ctx.parsedType === ZodParsedType.undefined) { - data = this._def.defaultValue(); - } - return this._def.innerType._parse({ - data, - path: ctx.path, - parent: ctx - }); - } - removeDefault() { - return this._def.innerType; - } -}; -ZodDefault.create = (type, params) => { - return new ZodDefault({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodDefault, - defaultValue: typeof params.default === "function" ? params.default : () => params.default, - ...processCreateParams(params) - }); -}; -var ZodCatch = class extends ZodType { - _parse(input2) { - const { ctx } = this._processInputParams(input2); - const newCtx = { - ...ctx, - common: { - ...ctx.common, - issues: [] - } - }; - const result = this._def.innerType._parse({ - data: newCtx.data, - path: newCtx.path, - parent: { - ...newCtx - } - }); - if (isAsync(result)) { - return result.then((result2) => { - return { - status: "valid", - value: result2.status === "valid" ? result2.value : this._def.catchValue({ - get error() { - return new ZodError(newCtx.common.issues); - }, - input: newCtx.data - }) - }; - }); - } else { - return { - status: "valid", - value: result.status === "valid" ? result.value : this._def.catchValue({ - get error() { - return new ZodError(newCtx.common.issues); - }, - input: newCtx.data - }) - }; - } - } - removeCatch() { - return this._def.innerType; - } -}; -ZodCatch.create = (type, params) => { - return new ZodCatch({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodCatch, - catchValue: typeof params.catch === "function" ? params.catch : () => params.catch, - ...processCreateParams(params) - }); -}; -var ZodNaN = class extends ZodType { - _parse(input2) { - const parsedType2 = this._getType(input2); - if (parsedType2 !== ZodParsedType.nan) { - const ctx = this._getOrReturnCtx(input2); - addIssueToContext(ctx, { - code: ZodIssueCode.invalid_type, - expected: ZodParsedType.nan, - received: ctx.parsedType - }); - return INVALID; - } - return { status: "valid", value: input2.data }; - } -}; -ZodNaN.create = (params) => { - return new ZodNaN({ - typeName: ZodFirstPartyTypeKind.ZodNaN, - ...processCreateParams(params) - }); -}; -var ZodBranded = class extends ZodType { - _parse(input2) { - const { ctx } = this._processInputParams(input2); - const data = ctx.data; - return this._def.type._parse({ - data, - path: ctx.path, - parent: ctx - }); - } - unwrap() { - return this._def.type; - } -}; -var ZodPipeline = class _ZodPipeline extends ZodType { - _parse(input2) { - const { status, ctx } = this._processInputParams(input2); - if (ctx.common.async) { - const handleAsync = async () => { - const inResult = await this._def.in._parseAsync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }); - if (inResult.status === "aborted") - return INVALID; - if (inResult.status === "dirty") { - status.dirty(); - return DIRTY(inResult.value); - } else { - return this._def.out._parseAsync({ - data: inResult.value, - path: ctx.path, - parent: ctx - }); - } - }; - return handleAsync(); - } else { - const inResult = this._def.in._parseSync({ - data: ctx.data, - path: ctx.path, - parent: ctx - }); - if (inResult.status === "aborted") - return INVALID; - if (inResult.status === "dirty") { - status.dirty(); - return { - status: "dirty", - value: inResult.value - }; - } else { - return this._def.out._parseSync({ - data: inResult.value, - path: ctx.path, - parent: ctx - }); - } - } - } - static create(a, b) { - return new _ZodPipeline({ - in: a, - out: b, - typeName: ZodFirstPartyTypeKind.ZodPipeline - }); - } -}; -var ZodReadonly = class extends ZodType { - _parse(input2) { - const result = this._def.innerType._parse(input2); - const freeze = (data) => { - if (isValid(data)) { - data.value = Object.freeze(data.value); - } - return data; - }; - return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result); - } - unwrap() { - return this._def.innerType; - } -}; -ZodReadonly.create = (type, params) => { - return new ZodReadonly({ - innerType: type, - typeName: ZodFirstPartyTypeKind.ZodReadonly, - ...processCreateParams(params) - }); -}; -var late = { - object: ZodObject.lazycreate -}; -var ZodFirstPartyTypeKind; -(function(ZodFirstPartyTypeKind3) { - ZodFirstPartyTypeKind3["ZodString"] = "ZodString"; - ZodFirstPartyTypeKind3["ZodNumber"] = "ZodNumber"; - ZodFirstPartyTypeKind3["ZodNaN"] = "ZodNaN"; - ZodFirstPartyTypeKind3["ZodBigInt"] = "ZodBigInt"; - ZodFirstPartyTypeKind3["ZodBoolean"] = "ZodBoolean"; - ZodFirstPartyTypeKind3["ZodDate"] = "ZodDate"; - ZodFirstPartyTypeKind3["ZodSymbol"] = "ZodSymbol"; - ZodFirstPartyTypeKind3["ZodUndefined"] = "ZodUndefined"; - ZodFirstPartyTypeKind3["ZodNull"] = "ZodNull"; - ZodFirstPartyTypeKind3["ZodAny"] = "ZodAny"; - ZodFirstPartyTypeKind3["ZodUnknown"] = "ZodUnknown"; - ZodFirstPartyTypeKind3["ZodNever"] = "ZodNever"; - ZodFirstPartyTypeKind3["ZodVoid"] = "ZodVoid"; - ZodFirstPartyTypeKind3["ZodArray"] = "ZodArray"; - ZodFirstPartyTypeKind3["ZodObject"] = "ZodObject"; - ZodFirstPartyTypeKind3["ZodUnion"] = "ZodUnion"; - ZodFirstPartyTypeKind3["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion"; - ZodFirstPartyTypeKind3["ZodIntersection"] = "ZodIntersection"; - ZodFirstPartyTypeKind3["ZodTuple"] = "ZodTuple"; - ZodFirstPartyTypeKind3["ZodRecord"] = "ZodRecord"; - ZodFirstPartyTypeKind3["ZodMap"] = "ZodMap"; - ZodFirstPartyTypeKind3["ZodSet"] = "ZodSet"; - ZodFirstPartyTypeKind3["ZodFunction"] = "ZodFunction"; - ZodFirstPartyTypeKind3["ZodLazy"] = "ZodLazy"; - ZodFirstPartyTypeKind3["ZodLiteral"] = "ZodLiteral"; - ZodFirstPartyTypeKind3["ZodEnum"] = "ZodEnum"; - ZodFirstPartyTypeKind3["ZodEffects"] = "ZodEffects"; - ZodFirstPartyTypeKind3["ZodNativeEnum"] = "ZodNativeEnum"; - ZodFirstPartyTypeKind3["ZodOptional"] = "ZodOptional"; - ZodFirstPartyTypeKind3["ZodNullable"] = "ZodNullable"; - ZodFirstPartyTypeKind3["ZodDefault"] = "ZodDefault"; - ZodFirstPartyTypeKind3["ZodCatch"] = "ZodCatch"; - ZodFirstPartyTypeKind3["ZodPromise"] = "ZodPromise"; - ZodFirstPartyTypeKind3["ZodBranded"] = "ZodBranded"; - ZodFirstPartyTypeKind3["ZodPipeline"] = "ZodPipeline"; - ZodFirstPartyTypeKind3["ZodReadonly"] = "ZodReadonly"; -})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {})); -var stringType = ZodString.create; -var numberType = ZodNumber.create; -var nanType = ZodNaN.create; -var bigIntType = ZodBigInt.create; -var booleanType = ZodBoolean.create; -var dateType = ZodDate.create; -var symbolType = ZodSymbol.create; -var undefinedType = ZodUndefined.create; -var nullType = ZodNull.create; -var anyType = ZodAny.create; -var unknownType = ZodUnknown.create; -var neverType = ZodNever.create; -var voidType = ZodVoid.create; -var arrayType = ZodArray.create; -var objectType = ZodObject.create; -var strictObjectType = ZodObject.strictCreate; -var unionType = ZodUnion.create; -var discriminatedUnionType = ZodDiscriminatedUnion.create; -var intersectionType = ZodIntersection.create; -var tupleType = ZodTuple.create; -var recordType = ZodRecord.create; -var mapType = ZodMap.create; -var setType = ZodSet.create; -var functionType = ZodFunction.create; -var lazyType = ZodLazy.create; -var literalType = ZodLiteral.create; -var enumType = ZodEnum.create; -var nativeEnumType = ZodNativeEnum.create; -var promiseType = ZodPromise.create; -var effectsType = ZodEffects.create; -var optionalType = ZodOptional.create; -var nullableType = ZodNullable.create; -var preprocessType = ZodEffects.createWithPreprocess; -var pipelineType = ZodPipeline.create; - -// node_modules/zod/v4/core/index.js -var core_exports2 = {}; -__export(core_exports2, { - $ZodAny: () => $ZodAny, - $ZodArray: () => $ZodArray, - $ZodAsyncError: () => $ZodAsyncError, - $ZodBase64: () => $ZodBase64, - $ZodBase64URL: () => $ZodBase64URL, - $ZodBigInt: () => $ZodBigInt, - $ZodBigIntFormat: () => $ZodBigIntFormat, - $ZodBoolean: () => $ZodBoolean, - $ZodCIDRv4: () => $ZodCIDRv4, - $ZodCIDRv6: () => $ZodCIDRv6, - $ZodCUID: () => $ZodCUID, - $ZodCUID2: () => $ZodCUID2, - $ZodCatch: () => $ZodCatch, - $ZodCheck: () => $ZodCheck, - $ZodCheckBigIntFormat: () => $ZodCheckBigIntFormat, - $ZodCheckEndsWith: () => $ZodCheckEndsWith, - $ZodCheckGreaterThan: () => $ZodCheckGreaterThan, - $ZodCheckIncludes: () => $ZodCheckIncludes, - $ZodCheckLengthEquals: () => $ZodCheckLengthEquals, - $ZodCheckLessThan: () => $ZodCheckLessThan, - $ZodCheckLowerCase: () => $ZodCheckLowerCase, - $ZodCheckMaxLength: () => $ZodCheckMaxLength, - $ZodCheckMaxSize: () => $ZodCheckMaxSize, - $ZodCheckMimeType: () => $ZodCheckMimeType, - $ZodCheckMinLength: () => $ZodCheckMinLength, - $ZodCheckMinSize: () => $ZodCheckMinSize, - $ZodCheckMultipleOf: () => $ZodCheckMultipleOf, - $ZodCheckNumberFormat: () => $ZodCheckNumberFormat, - $ZodCheckOverwrite: () => $ZodCheckOverwrite, - $ZodCheckProperty: () => $ZodCheckProperty, - $ZodCheckRegex: () => $ZodCheckRegex, - $ZodCheckSizeEquals: () => $ZodCheckSizeEquals, - $ZodCheckStartsWith: () => $ZodCheckStartsWith, - $ZodCheckStringFormat: () => $ZodCheckStringFormat, - $ZodCheckUpperCase: () => $ZodCheckUpperCase, - $ZodCodec: () => $ZodCodec, - $ZodCreditCard: () => $ZodCreditCard, - $ZodCustom: () => $ZodCustom, - $ZodCustomStringFormat: () => $ZodCustomStringFormat, - $ZodCyclicError: () => $ZodCyclicError, - $ZodDate: () => $ZodDate, - $ZodDefault: () => $ZodDefault, - $ZodDiscriminatedUnion: () => $ZodDiscriminatedUnion, - $ZodE164: () => $ZodE164, - $ZodEmail: () => $ZodEmail, - $ZodEmoji: () => $ZodEmoji, - $ZodEncodeError: () => $ZodEncodeError, - $ZodEnum: () => $ZodEnum, - $ZodError: () => $ZodError, - $ZodExactOptional: () => $ZodExactOptional, - $ZodFile: () => $ZodFile, - $ZodFunction: () => $ZodFunction, - $ZodGUID: () => $ZodGUID, - $ZodIPv4: () => $ZodIPv4, - $ZodIPv6: () => $ZodIPv6, - $ZodISODate: () => $ZodISODate, - $ZodISODateTime: () => $ZodISODateTime, - $ZodISODuration: () => $ZodISODuration, - $ZodISOTime: () => $ZodISOTime, - $ZodIntersection: () => $ZodIntersection, - $ZodJWT: () => $ZodJWT, - $ZodKSUID: () => $ZodKSUID, - $ZodLazy: () => $ZodLazy, - $ZodLiteral: () => $ZodLiteral, - $ZodMAC: () => $ZodMAC, - $ZodMap: () => $ZodMap, - $ZodNaN: () => $ZodNaN, - $ZodNanoID: () => $ZodNanoID, - $ZodNever: () => $ZodNever, - $ZodNonOptional: () => $ZodNonOptional, - $ZodNull: () => $ZodNull, - $ZodNullable: () => $ZodNullable, - $ZodNumber: () => $ZodNumber, - $ZodNumberFormat: () => $ZodNumberFormat, - $ZodObject: () => $ZodObject, - $ZodObjectJIT: () => $ZodObjectJIT, - $ZodOptional: () => $ZodOptional, - $ZodPipe: () => $ZodPipe, - $ZodPrefault: () => $ZodPrefault, - $ZodPreprocess: () => $ZodPreprocess, - $ZodPromise: () => $ZodPromise, - $ZodReadonly: () => $ZodReadonly, - $ZodRealError: () => $ZodRealError, - $ZodRecord: () => $ZodRecord, - $ZodRegistry: () => $ZodRegistry, - $ZodSet: () => $ZodSet, - $ZodString: () => $ZodString, - $ZodStringFormat: () => $ZodStringFormat, - $ZodSuccess: () => $ZodSuccess, - $ZodSymbol: () => $ZodSymbol, - $ZodTemplateLiteral: () => $ZodTemplateLiteral, - $ZodTransform: () => $ZodTransform, - $ZodTuple: () => $ZodTuple, - $ZodType: () => $ZodType, - $ZodULID: () => $ZodULID, - $ZodURL: () => $ZodURL, - $ZodUUID: () => $ZodUUID, - $ZodUndefined: () => $ZodUndefined, - $ZodUnion: () => $ZodUnion, - $ZodUnknown: () => $ZodUnknown, - $ZodVoid: () => $ZodVoid, - $ZodXID: () => $ZodXID, - $ZodXor: () => $ZodXor, - $brand: () => $brand, - $constructor: () => $constructor, - $input: () => $input, - $output: () => $output, - Doc: () => Doc, - INVALID: () => INVALID2, - JSONSchema: () => json_schema_exports, - JSONSchemaGenerator: () => JSONSchemaGenerator, - NEVER: () => NEVER, - TimePrecision: () => TimePrecision, - URL_BAD_FORMAT: () => URL_BAD_FORMAT, - URL_UNPARSEABLE: () => URL_UNPARSEABLE, - ZodCompileAsyncError: () => ZodCompileAsyncError, - ZodCompileUnsupportedError: () => ZodCompileUnsupportedError, - _any: () => _any, - _array: () => _array, - _base64: () => _base64, - _base64url: () => _base64url, - _bigint: () => _bigint, - _boolean: () => _boolean, - _catch: () => _catch, - _check: () => _check, - _cidrv4: () => _cidrv4, - _cidrv6: () => _cidrv6, - _coercedBigint: () => _coercedBigint, - _coercedBoolean: () => _coercedBoolean, - _coercedDate: () => _coercedDate, - _coercedNumber: () => _coercedNumber, - _coercedString: () => _coercedString, - _creditCard: () => _creditCard, - _cuid: () => _cuid, - _cuid2: () => _cuid2, - _custom: () => _custom, - _date: () => _date, - _decode: () => _decode, - _decodeAsync: () => _decodeAsync, - _default: () => _default, - _discriminatedUnion: () => _discriminatedUnion, - _e164: () => _e164, - _email: () => _email, - _emoji: () => _emoji2, - _encode: () => _encode, - _encodeAsync: () => _encodeAsync, - _endsWith: () => _endsWith, - _enum: () => _enum, - _file: () => _file, - _float32: () => _float32, - _float64: () => _float64, - _gt: () => _gt, - _gte: () => _gte, - _guid: () => _guid, - _includes: () => _includes, - _int: () => _int, - _int32: () => _int32, - _int64: () => _int64, - _intersection: () => _intersection, - _ipv4: () => _ipv4, - _ipv6: () => _ipv6, - _isoDate: () => _isoDate, - _isoDateTime: () => _isoDateTime, - _isoDuration: () => _isoDuration, - _isoTime: () => _isoTime, - _jwt: () => _jwt, - _ksuid: () => _ksuid, - _lazy: () => _lazy, - _length: () => _length, - _literal: () => _literal, - _lowercase: () => _lowercase, - _lt: () => _lt, - _lte: () => _lte, - _mac: () => _mac, - _map: () => _map, - _max: () => _lte, - _maxLength: () => _maxLength, - _maxSize: () => _maxSize, - _mime: () => _mime, - _min: () => _gte, - _minLength: () => _minLength, - _minSize: () => _minSize, - _multipleOf: () => _multipleOf, - _nan: () => _nan, - _nanoid: () => _nanoid, - _nativeEnum: () => _nativeEnum, - _negative: () => _negative, - _never: () => _never, - _nonnegative: () => _nonnegative, - _nonoptional: () => _nonoptional, - _nonpositive: () => _nonpositive, - _normalize: () => _normalize, - _null: () => _null2, - _nullable: () => _nullable, - _number: () => _number, - _optional: () => _optional, - _overwrite: () => _overwrite, - _parse: () => _parse, - _parseAsync: () => _parseAsync, - _pipe: () => _pipe, - _positive: () => _positive, - _promise: () => _promise, - _properties: () => _properties, - _property: () => _property, - _readonly: () => _readonly, - _record: () => _record, - _refine: () => _refine, - _regex: () => _regex, - _safeDecode: () => _safeDecode, - _safeDecodeAsync: () => _safeDecodeAsync, - _safeEncode: () => _safeEncode, - _safeEncodeAsync: () => _safeEncodeAsync, - _safeParse: () => _safeParse, - _safeParseAsync: () => _safeParseAsync, - _set: () => _set, - _size: () => _size, - _slugify: () => _slugify, - _startsWith: () => _startsWith, - _string: () => _string, - _stringFormat: () => _stringFormat, - _stringbool: () => _stringbool, - _success: () => _success, - _superRefine: () => _superRefine, - _symbol: () => _symbol, - _templateLiteral: () => _templateLiteral, - _toLowerCase: () => _toLowerCase, - _toUpperCase: () => _toUpperCase, - _transform: () => _transform, - _trim: () => _trim, - _tuple: () => _tuple, - _uint32: () => _uint32, - _uint64: () => _uint64, - _ulid: () => _ulid, - _undefined: () => _undefined2, - _union: () => _union, - _unknown: () => _unknown, - _uppercase: () => _uppercase, - _url: () => _url, - _uuid: () => _uuid, - _uuidv4: () => _uuidv4, - _uuidv6: () => _uuidv6, - _uuidv7: () => _uuidv7, - _void: () => _void, - _xid: () => _xid, - _xor: () => _xor, - clone: () => clone, - compile: () => compile, - compileFn: () => compileFn, - config: () => config, - createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod, - createToJSONSchemaMethod: () => createToJSONSchemaMethod, - decode: () => decode, - decodeAsync: () => decodeAsync, - describe: () => describe, - encode: () => encode, - encodeAsync: () => encodeAsync, - extractDefs: () => extractDefs, - finalize: () => finalize, - flattenError: () => flattenError, - formatError: () => formatError, - getDiscriminatedOption: () => getDiscriminatedOption, - globalConfig: () => globalConfig, - globalRegistry: () => globalRegistry, - handleUnrepresentable: () => handleUnrepresentable, - initializeContext: () => initializeContext, - isBackEdge: () => isBackEdge, - isRecursiveSchema: () => isRecursiveSchema, - isValidBase64: () => isValidBase64, - isValidBase64URL: () => isValidBase64URL, - isValidCIDRv6: () => isValidCIDRv6, - isValidCreditCard: () => isValidCreditCard, - isValidIPv6: () => isValidIPv6, - isValidJWT: () => isValidJWT2, - locales: () => locales_exports, - memoizer: () => memoizer, - mergeValues: () => mergeValues2, - meta: () => meta, - parse: () => parse, - parseAsync: () => parseAsync, - parseURLObject: () => parseURLObject, - prettifyError: () => prettifyError, - process: () => process2, - regexes: () => regexes_exports, - registry: () => registry, - safeDecode: () => safeDecode, - safeDecodeAsync: () => safeDecodeAsync, - safeEncode: () => safeEncode, - safeEncodeAsync: () => safeEncodeAsync, - safeParse: () => safeParse, - safeParseAsync: () => safeParseAsync, - standardProps: () => standardProps, - stripTabAndNewline: () => stripTabAndNewline, - toDotPath: () => toDotPath, - toJSONSchema: () => toJSONSchema, - toZod: () => toZod, - treeifyError: () => treeifyError, - urlHostnameOk: () => urlHostnameOk, - urlProtocolOk: () => urlProtocolOk, - util: () => util_exports, - validate: () => validate, - validateAsync: () => validateAsync, - version: () => version -}); - -// node_modules/zod/v4/core/util.js -var util_exports = {}; -__export(util_exports, { - BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES, - CONSTANT_CATCH: () => CONSTANT_CATCH, - Class: () => Class, - NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES, - aborted: () => aborted, - allowsEval: () => allowsEval, - assert: () => assert, - assertEqual: () => assertEqual, - assertIs: () => assertIs, - assertNever: () => assertNever, - assertNotEqual: () => assertNotEqual, - assignProp: () => assignProp, - attachSchema: () => attachSchema, - base64ToUint8Array: () => base64ToUint8Array, - base64urlToUint8Array: () => base64urlToUint8Array, - cached: () => cached, - captureStackTrace: () => captureStackTrace, - cleanEnum: () => cleanEnum, - cleanRegex: () => cleanRegex, - clone: () => clone, - cloneDef: () => cloneDef, - codePointLength: () => codePointLength, - constantCatch: () => constantCatch, - createTransparentProxy: () => createTransparentProxy, - defineLazy: () => defineLazy, - defineLazyInternal: () => defineLazyInternal, - esc: () => esc, - escapeRegex: () => escapeRegex, - explicitlyAborted: () => explicitlyAborted, - extend: () => extend, - finalizeIssue: () => finalizeIssue, - floatSafeRemainder: () => floatSafeRemainder2, - getElementAtPath: () => getElementAtPath, - getEnumValues: () => getEnumValues, - getLengthableOrigin: () => getLengthableOrigin, - getParsedType: () => getParsedType2, - getSizableOrigin: () => getSizableOrigin, - hexToUint8Array: () => hexToUint8Array, - hide: () => hide, - installLazyProp: () => installLazyProp, - isObject: () => isObject, - isPlainObject: () => isPlainObject, - issue: () => issue, - joinValues: () => joinValues, - jsonStringifyReplacer: () => jsonStringifyReplacer, - members: () => members, - merge: () => merge, - mergeDefs: () => mergeDefs, - normalizeParams: () => normalizeParams, - nullish: () => nullish, - numKeys: () => numKeys, - objectClone: () => objectClone, - omit: () => omit, - optionalKeys: () => optionalKeys, - own: () => own, - parsedType: () => parsedType, - partial: () => partial, - pick: () => pick, - prefixIssues: () => prefixIssues, - primitiveTypes: () => primitiveTypes, - promiseAllObject: () => promiseAllObject, - propertyKeyTypes: () => propertyKeyTypes, - randomString: () => randomString, - required: () => required, - safeExtend: () => safeExtend, - shallowClone: () => shallowClone, - slugify: () => slugify, - stringifyPrimitive: () => stringifyPrimitive, - toZod: () => toZod, - uint8ArrayToBase64: () => uint8ArrayToBase64, - uint8ArrayToBase64url: () => uint8ArrayToBase64url, - uint8ArrayToHex: () => uint8ArrayToHex, - unwrapMessage: () => unwrapMessage -}); -function assertEqual(val) { - return val; -} -function assertNotEqual(val) { - return val; -} -function toZod() { - return (schema) => schema; -} -function assertIs(_arg) { -} -function assertNever(_x) { - throw new Error("Unexpected value in exhaustive check"); -} -function assert(_) { -} -function getEnumValues(entries) { - const numericValues = Object.values(entries).filter((v) => typeof v === "number"); - const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v); - return values; -} -function joinValues(array2, separator = "|") { - return array2.map((val) => stringifyPrimitive(val)).join(separator); -} -function jsonStringifyReplacer(_, value) { - if (typeof value === "bigint") - return value.toString(); - return value; -} -function cached(getter) { - const set2 = false; - return { - get value() { - if (!set2) { - const value = getter(); - Object.defineProperty(this, "value", { value }); - return value; - } - throw new Error("cached value already set"); - } - }; -} -function nullish(input2) { - return input2 === null || input2 === void 0; -} -function cleanRegex(source) { - const start = source.startsWith("^") ? 1 : 0; - const end = source.endsWith("$") ? source.length - 1 : source.length; - return source.slice(start, end); -} -function floatSafeRemainder2(val, step) { - const ratio = val / step; - const roundedRatio = Math.round(ratio); - const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1); - if (Math.abs(ratio - roundedRatio) < tolerance) - return 0; - return ratio - roundedRatio; -} -var EVALUATING = /* @__PURE__ */ Symbol("evaluating"); -function defineLazy(object3, key, getter) { - let value = void 0; - Object.defineProperty(object3, key, { - get() { - if (value === EVALUATING) { - return void 0; - } - if (value === void 0) { - value = EVALUATING; - value = getter(); - } - return value; - }, - set(v) { - Object.defineProperty(object3, key, { - value: v - // configurable: true, - }); - }, - configurable: true - }); -} -function objectClone(obj) { - return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj)); -} -function assignProp(target, prop, value) { - Object.defineProperty(target, prop, { - value, - writable: true, - enumerable: true, - configurable: true - }); -} -function mergeDefs(...defs) { - const mergedDescriptors = {}; - for (const def of defs) { - const descriptors = Object.getOwnPropertyDescriptors(def); - Object.assign(mergedDescriptors, descriptors); - } - return Object.defineProperties({}, mergedDescriptors); -} -function cloneDef(schema) { - return mergeDefs(schema._zod.def); -} -function getElementAtPath(obj, path3) { - if (!path3) - return obj; - return path3.reduce((acc, key) => acc?.[key], obj); -} -function promiseAllObject(promisesObj) { - const keys = Object.keys(promisesObj); - const promises = keys.map((key) => promisesObj[key]); - return Promise.all(promises).then((results) => { - const resolvedObj = {}; - for (let i = 0; i < keys.length; i++) { - resolvedObj[keys[i]] = results[i]; - } - return resolvedObj; - }); -} -function randomString(length = 10) { - const chars = "abcdefghijklmnopqrstuvwxyz"; - let str = ""; - for (let i = 0; i < length; i++) { - str += chars[Math.floor(Math.random() * chars.length)]; - } - return str; -} -function esc(str) { - return JSON.stringify(str); -} -function slugify(input2) { - return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, ""); -} -var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => { -}; -function isObject(data) { - return typeof data === "object" && data !== null && !Array.isArray(data); -} -var allowsEval = /* @__PURE__ */ cached(() => { - if (globalConfig.jitless) { - return false; - } - if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) { - return false; - } - try { - const F = Function; - new F(""); - return true; - } catch (_) { - return false; - } -}); -function isPlainObject(o) { - if (isObject(o) === false) - return false; - const ctor = o.constructor; - if (ctor === void 0) - return true; - if (typeof ctor !== "function") - return true; - const prot = ctor.prototype; - if (isObject(prot) === false) - return false; - if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) { - return false; - } - return true; -} -function shallowClone(o) { - if (isPlainObject(o)) - return { ...o }; - if (Array.isArray(o)) - return [...o]; - if (o instanceof Map) - return new Map(o); - if (o instanceof Set) - return new Set(o); - return o; -} -function numKeys(data) { - let keyCount = 0; - for (const key in data) { - if (Object.prototype.hasOwnProperty.call(data, key)) { - keyCount++; - } - } - return keyCount; -} -var getParsedType2 = (data) => { - const t = typeof data; - switch (t) { - case "undefined": - return "undefined"; - case "string": - return "string"; - case "number": - return Number.isNaN(data) ? "nan" : "number"; - case "boolean": - return "boolean"; - case "function": - return "function"; - case "bigint": - return "bigint"; - case "symbol": - return "symbol"; - case "object": - if (Array.isArray(data)) { - return "array"; - } - if (data === null) { - return "null"; - } - if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") { - return "promise"; - } - if (typeof Map !== "undefined" && data instanceof Map) { - return "map"; - } - if (typeof Set !== "undefined" && data instanceof Set) { - return "set"; - } - if (typeof Date !== "undefined" && data instanceof Date) { - return "date"; - } - if (typeof File !== "undefined" && data instanceof File) { - return "file"; - } - return "object"; - default: - throw new Error(`Unknown data type: ${t}`); - } -}; -var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]); -var primitiveTypes = /* @__PURE__ */ new Set([ - "string", - "number", - "bigint", - "boolean", - "symbol", - "undefined" -]); -function escapeRegex(str) { - return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); -} -function clone(inst, def, params) { - const cl = new inst._zod.constr(def ?? inst._zod.def); - if (!def || params?.parent) - cl._zod.parent = inst; - return cl; -} -function normalizeParams(_params) { - const params = _params; - if (!params) - return {}; - if (typeof params === "string") - return { error: () => params }; - if (params?.message !== void 0) { - if (params?.error !== void 0) - throw new Error("Cannot specify both `message` and `error` params"); - params.error = params.message; - } - delete params.message; - if (typeof params.error === "string") - return { ...params, error: () => params.error }; - return params; -} -function createTransparentProxy(getter) { - let target; - return new Proxy({}, { - get(_, prop, receiver) { - target ?? (target = getter()); - return Reflect.get(target, prop, receiver); - }, - set(_, prop, value, receiver) { - target ?? (target = getter()); - return Reflect.set(target, prop, value, receiver); - }, - has(_, prop) { - target ?? (target = getter()); - return Reflect.has(target, prop); - }, - deleteProperty(_, prop) { - target ?? (target = getter()); - return Reflect.deleteProperty(target, prop); - }, - ownKeys(_) { - target ?? (target = getter()); - return Reflect.ownKeys(target); - }, - getOwnPropertyDescriptor(_, prop) { - target ?? (target = getter()); - return Reflect.getOwnPropertyDescriptor(target, prop); - }, - defineProperty(_, prop, descriptor) { - target ?? (target = getter()); - return Reflect.defineProperty(target, prop, descriptor); - } - }); -} -function stringifyPrimitive(value) { - if (typeof value === "bigint") - return value.toString() + "n"; - if (typeof value === "string") - return `"${value}"`; - return `${value}`; -} -function optionalKeys(shape) { - return Object.keys(shape).filter((k) => { - return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional"; - }); -} -var NUMBER_FORMAT_RANGES = /* @__PURE__ */ (() => ({ - safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER], - int32: [-2147483648, 2147483647], - uint32: [0, 4294967295], - float32: [-34028234663852886e22, 34028234663852886e22], - float64: [-Number.MAX_VALUE, Number.MAX_VALUE] -}))(); -var BIGINT_FORMAT_RANGES = { - int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")], - uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")] -}; -function pick(schema, mask) { - const currDef = schema._zod.def; - const checks = currDef.checks; - const hasChecks = checks && checks.length > 0; - if (hasChecks) { - throw new Error(".pick() cannot be used on object schemas containing refinements"); - } - const def = mergeDefs(schema._zod.def, { - get shape() { - const newShape = {}; - for (const key of Reflect.ownKeys(mask)) { - if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) { - throw new Error(`Unrecognized key: "${String(key)}"`); - } - if (!mask[key]) - continue; - assignProp(newShape, key, currDef.shape[key]); - } - assignProp(this, "shape", newShape); - return newShape; - }, - checks: [] - }); - return clone(schema, def); -} -function omit(schema, mask) { - const currDef = schema._zod.def; - const checks = currDef.checks; - const hasChecks = checks && checks.length > 0; - if (hasChecks) { - throw new Error(".omit() cannot be used on object schemas containing refinements"); - } - const def = mergeDefs(schema._zod.def, { - get shape() { - const newShape = { ...schema._zod.def.shape }; - for (const key of Reflect.ownKeys(mask)) { - if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) { - throw new Error(`Unrecognized key: "${String(key)}"`); - } - if (!mask[key]) - continue; - delete newShape[key]; - } - assignProp(this, "shape", newShape); - return newShape; - }, - checks: [] - }); - return clone(schema, def); -} -function extend(schema, shape) { - if (!isPlainObject(shape)) { - throw new Error("Invalid input to extend: expected a plain object"); - } - const checks = schema._zod.def.checks; - const hasChecks = checks && checks.length > 0; - if (hasChecks) { - const existingShape = schema._zod.def.shape; - for (const key of Reflect.ownKeys(shape)) { - if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) { - throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead."); - } - } - } - const def = mergeDefs(schema._zod.def, { - get shape() { - const _shape = { ...schema._zod.def.shape, ...shape }; - assignProp(this, "shape", _shape); - return _shape; - } - }); - return clone(schema, def); -} -function safeExtend(schema, shape) { - if (!isPlainObject(shape)) { - throw new Error("Invalid input to safeExtend: expected a plain object"); - } - const def = mergeDefs(schema._zod.def, { - get shape() { - const _shape = { ...schema._zod.def.shape, ...shape }; - assignProp(this, "shape", _shape); - return _shape; - } - }); - return clone(schema, def); -} -function merge(a, b) { - if (!b?._zod?.def) { - throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`."); - } - if (a._zod.def.checks?.length) { - throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead."); - } - const def = mergeDefs(a._zod.def, { - get shape() { - const _shape = { ...a._zod.def.shape, ...b._zod.def.shape }; - assignProp(this, "shape", _shape); - return _shape; - }, - get catchall() { - return b._zod.def.catchall; - }, - checks: b._zod.def.checks ?? [] - }); - return clone(a, def); -} -function partial(Class2, schema, mask, name = "partial") { - const currDef = schema._zod.def; - const checks = currDef.checks; - const hasChecks = checks && checks.length > 0; - if (hasChecks) { - throw new Error(`.${name}() cannot be used on object schemas containing refinements`); - } - const def = mergeDefs(schema._zod.def, { - get shape() { - const oldShape = schema._zod.def.shape; - const shape = { ...oldShape }; - if (mask) { - for (const key of Reflect.ownKeys(mask)) { - if (!Object.prototype.hasOwnProperty.call(oldShape, key)) { - throw new Error(`Unrecognized key: "${String(key)}"`); - } - if (!mask[key]) - continue; - shape[key] = Class2 ? new Class2({ - type: "optional", - innerType: oldShape[key] - }) : oldShape[key]; - } - } else { - for (const key of Reflect.ownKeys(oldShape)) { - shape[key] = Class2 ? new Class2({ - type: "optional", - innerType: oldShape[key] - }) : oldShape[key]; - } - } - assignProp(this, "shape", shape); - return shape; - }, - checks: [] - }); - return clone(schema, def); -} -function required(Class2, schema, mask) { - const def = mergeDefs(schema._zod.def, { - get shape() { - const oldShape = schema._zod.def.shape; - const shape = { ...oldShape }; - if (mask) { - for (const key of Reflect.ownKeys(mask)) { - if (!Object.prototype.hasOwnProperty.call(shape, key)) { - throw new Error(`Unrecognized key: "${String(key)}"`); - } - if (!mask[key]) - continue; - shape[key] = new Class2({ - type: "nonoptional", - innerType: oldShape[key] - }); - } - } else { - for (const key of Reflect.ownKeys(oldShape)) { - shape[key] = new Class2({ - type: "nonoptional", - innerType: oldShape[key] - }); - } - } - assignProp(this, "shape", shape); - return shape; - } - }); - return clone(schema, def); -} -function aborted(x, startIndex = 0) { - if (x.aborted === true) - return true; - for (let i = startIndex; i < x.issues.length; i++) { - if (x.issues[i]?.continue !== true) { - return true; - } - } - return false; -} -function explicitlyAborted(x, startIndex = 0) { - if (x.aborted === true) - return true; - for (let i = startIndex; i < x.issues.length; i++) { - if (x.issues[i]?.continue === false) { - return true; - } - } - return false; -} -function prefixIssues(path3, issues) { - return issues.map((iss) => { - var _a3; - (_a3 = iss).path ?? (_a3.path = []); - iss.path.unshift(path3); - return iss; - }); -} -function unwrapMessage(message) { - return typeof message === "string" ? message : message?.message; -} -function attachSchema(issues, start, inst) { - var _a3; - for (let i = start; i < issues.length; i++) { - (_a3 = issues[i]).schema ?? (_a3.schema = inst); - } -} -function finalizeIssue(iss, ctx, config2) { - var _a3; - const traits = iss.inst?._zod?.traits; - if (traits?.has("$ZodType")) { - if (traits.has("$ZodCheck")) - (_a3 = iss).schema ?? (_a3.schema = iss.inst); - else - iss.schema = iss.inst; - } - const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0; - const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input"; - const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss; - rest.path ?? (rest.path = []); - rest.message = message; - if (ctx?.reportInput) { - rest.input = _input; - } - return rest; -} -function getSizableOrigin(input2) { - if (input2 instanceof Set) - return "set"; - if (input2 instanceof Map) - return "map"; - if (input2 instanceof File) - return "file"; - return "unknown"; -} -var highSurrogate = /[\uD800-\uDBFF]/; -function codePointLength(str) { - const units = str.length; - if (!highSurrogate.test(str)) - return units; - let count = units; - for (let i = 0; i < units - 1; i++) { - if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) { - count--; - i++; - } - } - return count; -} -function getLengthableOrigin(input2) { - if (Array.isArray(input2)) - return "array"; - if (typeof input2 === "string") - return "string"; - return "unknown"; -} -function parsedType(data) { - const t = typeof data; - switch (t) { - case "number": { - return Number.isNaN(data) ? "nan" : "number"; - } - case "object": { - if (data === null) { - return "null"; - } - if (Array.isArray(data)) { - return "array"; - } - const obj = data; - if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) { - return obj.constructor.name; - } - } - } - return t; -} -function issue(...args) { - const [iss, input2, inst] = args; - if (typeof iss === "string") { - return { - message: iss, - code: "custom", - input: input2, - inst - }; - } - return { ...iss }; -} -function cleanEnum(obj) { - return Object.entries(obj).filter(([k, _]) => { - return Number.isNaN(Number.parseInt(k, 10)); - }).map((el) => el[1]); -} -function base64ToUint8Array(base643) { - const binaryString = atob(base643); - const bytes = new Uint8Array(binaryString.length); - for (let i = 0; i < binaryString.length; i++) { - bytes[i] = binaryString.charCodeAt(i); - } - return bytes; -} -function uint8ArrayToBase64(bytes) { - let binaryString = ""; - for (let i = 0; i < bytes.length; i++) { - binaryString += String.fromCharCode(bytes[i]); - } - return btoa(binaryString); -} -function base64urlToUint8Array(base64url3) { - const base643 = base64url3.replace(/-/g, "+").replace(/_/g, "/"); - const padding = "=".repeat((4 - base643.length % 4) % 4); - return base64ToUint8Array(base643 + padding); -} -function uint8ArrayToBase64url(bytes) { - return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ""); -} -function hexToUint8Array(hex3) { - const cleanHex = hex3.replace(/^0x/, ""); - if (cleanHex.length % 2 !== 0) { - throw new Error("Invalid hex string length"); - } - const bytes = new Uint8Array(cleanHex.length / 2); - for (let i = 0; i < cleanHex.length; i += 2) { - bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16); - } - return bytes; -} -function uint8ArrayToHex(bytes) { - return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join(""); -} -var Class = class { - constructor(..._args) { - } -}; -function members(proto, table) { - for (const key in table) { - const desc = Object.getOwnPropertyDescriptor(table, key); - if (desc.get) - Object.defineProperty(proto, key, { ...desc, enumerable: false }); - else - defineBound(proto, key, desc.value); - } -} -function own(inst, key, value, enumerable = true) { - Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value }); - return value; -} -function hide(inst, key, value) { - return own(inst, key, value, false); -} -function defineBound(proto, key, fn) { - Object.defineProperty(proto, key, { - configurable: true, - get() { - return this == null ? fn : own(this, key, fn.bind(this)); - }, - set(value) { - own(this, key, value); - } - }); -} -function claim(inst, sentinel) { - const proto = Object.getPrototypeOf(inst); - return sentinel in proto ? void 0 : proto; -} -var installing; -var broke = false; -var breaker = { - configurable: true, - get() { - broke = true; - return void 0; - } -}; -function defineLazyInternal(inst, key, compute) { - const proto = Object.getPrototypeOf(inst._zod); - if (key in proto && installing !== inst._zod) { - installing = void 0; - return; - } - installing = inst._zod; - Object.defineProperty(proto, key, { - configurable: true, - get() { - Object.defineProperty(this, key, breaker); - const outer = broke; - broke = false; - try { - const value = compute(this); - if (broke) - delete this[key]; - else - Object.defineProperty(this, key, { configurable: true, writable: true, value }); - broke = broke || outer; - return value; - } catch (err) { - delete this[key]; - broke = broke || outer; - throw err; - } - }, - set(value) { - Object.defineProperty(this, key, { configurable: true, writable: true, value }); - } - }); -} -function installLazyProp(inst, key, make, enumerable) { - const proto = claim(inst, key); - if (!proto) - return; - Object.defineProperty(proto, key, { - configurable: true, - get() { - const desc = { configurable: true, writable: true, enumerable, value: void 0 }; - Object.defineProperty(this, key, desc); - desc.value = make(this); - Object.defineProperty(this, key, desc); - return desc.value; - }, - set(value) { - Object.defineProperty(this, key, { configurable: true, writable: true, enumerable, value }); - } - }); -} -var CONSTANT_CATCH = "~constantCatch"; -function constantCatch(value) { - const fn = () => value; - fn[CONSTANT_CATCH] = true; - return fn; -} - -// node_modules/zod/v4/core/core.js -var _a; -var NEVER = /* @__PURE__ */ Object.freeze({ - status: "aborted" -}); -var _zodDesc = { value: void 0, enumerable: false }; -var _E = "captureStackTrace" in Error ? Error : null; -function newError(Definition) { - const E = _E; - if (E) { - const saved = E.stackTraceLimit; - if (typeof saved === "number") { - try { - E.stackTraceLimit = 0; - } catch { - _E = null; - return new Definition(); - } - try { - return new Definition(); - } finally { - E.stackTraceLimit = saved; - } - } - } - return new Definition(); -} -// @__NO_SIDE_EFFECTS__ -function $constructor(name, initializer3, proto, params) { - const zodProto = {}; - function Internals(def) { - this.def = def; - this.constr = _; - this.traits = /* @__PURE__ */ new Set(); - } - Internals.prototype = zodProto; - const protoMembers = proto; - const initialized = protoMembers && /* @__PURE__ */ new WeakSet(); - function init(inst, def) { - if (!inst._zod) { - _zodDesc.value = new Internals(def); - try { - Object.defineProperty(inst, "_zod", _zodDesc); - } finally { - _zodDesc.value = void 0; - } - } - if (inst._zod.traits.has(name)) { - return; - } - inst._zod.traits.add(name); - initializer3(inst, def); - if (initialized) { - const own2 = Object.getPrototypeOf(inst); - const ctorProto = inst._zod.constr.prototype; - let up = own2; - while (up && up !== ctorProto) - up = Object.getPrototypeOf(up); - const target = up ?? own2; - if (!initialized.has(target)) { - initialized.add(target); - members(target, protoMembers); - } - } - const proto2 = _.prototype; - for (const k in proto2) { - if (!Object.prototype.hasOwnProperty.call(proto2, k)) - continue; - if (!(k in inst)) { - inst[k] = proto2[k].bind(inst); - } - } - } - const Parent = params?.Parent ?? Object; - class Definition extends Parent { - } - Object.defineProperty(Definition, "name", { value: name }); - function _(def) { - const inst = params?.Parent ? newError(Definition) : this; - init(inst, def); - const deferred = inst._zod.deferred; - if (deferred) { - for (const fn of deferred) { - fn(); - } - inst._zod.deferred = void 0; - } - const pp = globalThis.__zod_globalConfig?.postProcessor; - if (pp) - pp(inst); - return inst; - } - Object.defineProperty(_, "init", { value: init }); - Object.defineProperty(_, Symbol.hasInstance, { - value: (inst) => { - if (params?.Parent && inst instanceof params.Parent) - return true; - return inst?._zod?.traits?.has(name); - } - }); - Object.defineProperty(_, "name", { value: name }); - return _; -} -var $brand = /* @__PURE__ */ Symbol("zod_brand"); -var $ZodAsyncError = class extends Error { - constructor() { - super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`); - } -}; -var $ZodEncodeError = class extends Error { - constructor(name) { - super(`Encountered unidirectional transform during encode: ${name}`); - this.name = "ZodEncodeError"; - } -}; -(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {}); -var globalConfig = globalThis.__zod_globalConfig; -function config(newConfig) { - if (newConfig) - Object.assign(globalConfig, newConfig); - return globalConfig; -} - -// node_modules/zod/v4/core/errors.js -function _getMessage() { - const internals = this._zod; - internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2)); - return internals.message; -} -function _setMessage(value) { - this._zod.message = value; -} -var _messageDesc = { - get: _getMessage, - set: _setMessage, - enumerable: true, - configurable: true -}; -var _zodDesc2 = { value: void 0, enumerable: false }; -var _issuesDesc = { value: void 0, enumerable: false }; -var _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]); -var initializer = (inst, def) => { - inst.name = "$ZodError"; - _zodDesc2.value = inst._zod; - Object.defineProperty(inst, "_zod", _zodDesc2); - _issuesDesc.value = def; - Object.defineProperty(inst, "issues", _issuesDesc); - _zodDesc2.value = void 0; - _issuesDesc.value = void 0; - Object.defineProperty(inst, "message", _messageDesc); - const proto = Object.getPrototypeOf(inst); - if (!_installedToString.has(proto)) { - _installedToString.add(proto); - Object.defineProperty(proto, "toString", { - configurable: true, - enumerable: false, - get() { - const value = () => this.message; - Object.defineProperty(this, "toString", { value, configurable: true, writable: true }); - return value; - }, - set(value) { - Object.defineProperty(this, "toString", { value, configurable: true, writable: true }); - } - }); - } -}; -var $ZodError = $constructor("$ZodError", initializer); -var $ZodRealError = $constructor("$ZodError", initializer, void 0, { - Parent: Error -}); -function node(obj, key, make) { - if (!Object.prototype.hasOwnProperty.call(obj, key)) { - if (key === "__proto__") { - Object.defineProperty(obj, key, { value: make(), writable: true, enumerable: true, configurable: true }); - } else { - obj[key] = make(); - } - } - return obj[key]; -} -function flattenError(error61, mapper = (issue2) => issue2.message) { - const fieldErrors = {}; - const formErrors = []; - for (const sub of error61.issues) { - if (sub.path.length > 0) { - node(fieldErrors, sub.path[0], () => []).push(mapper(sub)); - } else { - formErrors.push(mapper(sub)); - } - } - return { formErrors, fieldErrors }; -} -function formatError(error61, mapper = (issue2) => issue2.message) { - const fieldErrors = { _errors: [] }; - const processError = (error62, path3 = []) => { - for (const issue2 of error62.issues) { - if (issue2.code === "invalid_union" && issue2.errors.length) { - issue2.errors.map((issues) => processError({ issues }, [...path3, ...issue2.path])); - } else if (issue2.code === "invalid_key") { - processError({ issues: issue2.issues }, [...path3, ...issue2.path]); - } else if (issue2.code === "invalid_element") { - processError({ issues: issue2.issues }, [...path3, ...issue2.path]); - } else { - const fullpath = [...path3, ...issue2.path]; - if (fullpath.length === 0) { - fieldErrors._errors.push(mapper(issue2)); - } else { - let curr = fieldErrors; - let i = 0; - while (i < fullpath.length) { - const el = fullpath[i]; - const terminal = i === fullpath.length - 1; - if (el === "_errors") { - if (terminal) - curr._errors.push(mapper(issue2)); - i++; - continue; - } - if (!Object.prototype.hasOwnProperty.call(curr, el)) { - Object.defineProperty(curr, el, { - value: { _errors: [] }, - enumerable: true, - writable: true, - configurable: true - }); - } - const node2 = curr[el]; - if (terminal) { - node2._errors.push(mapper(issue2)); - } - curr = node2; - i++; - } - } - } - } - }; - processError(error61); - return fieldErrors; -} -function treeifyError(error61, mapper = (issue2) => issue2.message) { - const result = { errors: [] }; - const processError = (error62, path3 = []) => { - var _a3; - for (const issue2 of error62.issues) { - if (issue2.code === "invalid_union" && issue2.errors.length) { - issue2.errors.map((issues) => processError({ issues }, [...path3, ...issue2.path])); - } else if (issue2.code === "invalid_key") { - processError({ issues: issue2.issues }, [...path3, ...issue2.path]); - } else if (issue2.code === "invalid_element") { - processError({ issues: issue2.issues }, [...path3, ...issue2.path]); - } else { - const fullpath = [...path3, ...issue2.path]; - if (fullpath.length === 0) { - result.errors.push(mapper(issue2)); - continue; - } - let curr = result; - let i = 0; - while (i < fullpath.length) { - const el = fullpath[i]; - const terminal = i === fullpath.length - 1; - if (typeof el === "string") { - curr.properties ?? (curr.properties = {}); - if (!Object.prototype.hasOwnProperty.call(curr.properties, el)) { - Object.defineProperty(curr.properties, el, { - value: { errors: [] }, - enumerable: true, - writable: true, - configurable: true - }); - } - curr = curr.properties[el]; - } else { - curr.items ?? (curr.items = []); - (_a3 = curr.items)[el] ?? (_a3[el] = { errors: [] }); - curr = curr.items[el]; - } - if (terminal) { - curr.errors.push(mapper(issue2)); - } - i++; - } - } - } - }; - processError(error61); - return result; -} -function toDotPath(_path) { - const segs = []; - const path3 = _path.map((seg) => typeof seg === "object" ? seg.key : seg); - for (const seg of path3) { - if (typeof seg === "number") - segs.push(`[${seg}]`); - else if (typeof seg === "symbol") - segs.push(`[${JSON.stringify(String(seg))}]`); - else if (/[^\w$]/.test(seg)) - segs.push(`[${JSON.stringify(seg)}]`); - else { - if (segs.length) - segs.push("."); - segs.push(seg); - } - } - return segs.join(""); -} -function prettifyError(error61) { - const lines = []; - const issues = [...error61.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length); - for (const issue2 of issues) { - lines.push(`\u2716 ${issue2.message}`); - if (issue2.path?.length) - lines.push(` \u2192 at ${toDotPath(issue2.path)}`); - } - return lines.join("\n"); -} - -// node_modules/zod/v4/core/parse.js -function finalizeParams(callee, params) { - return { callee: params?.callee ?? callee, Err: params?.Err }; -} -var _parse = (_Err) => { - const fn = (schema, value, _ctx, _params) => { - const ctx = _ctx ? { ..._ctx, async: false } : { async: false }; - const result = schema._zod.run({ value, issues: [] }, ctx); - if (result instanceof Promise) { - throw new $ZodAsyncError(); - } - if (result.issues.length) { - const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); - captureStackTrace(e, _params?.callee ?? fn); - throw e; - } - return result.value; - }; - return fn; -}; -var parse = /* @__PURE__ */ _parse($ZodRealError); -var _parseAsync = (_Err) => { - const fn = async (schema, value, _ctx, params) => { - const ctx = _ctx ? { ..._ctx, async: true } : { async: true }; - let result = schema._zod.run({ value, issues: [] }, ctx); - if (result instanceof Promise) - result = await result; - if (result.issues.length) { - const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))); - captureStackTrace(e, params?.callee ?? fn); - throw e; - } - return result.value; - }; - return fn; -}; -var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError); -var _safeParse = (_Err) => (schema, value, _ctx) => { - const ctx = _ctx ? { ..._ctx, async: false } : { async: false }; - const result = schema._zod.run({ value, issues: [] }, ctx); - if (result instanceof Promise) { - throw new $ZodAsyncError(); - } - return result.issues.length ? { - success: false, - error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) - } : { success: true, data: result.value }; -}; -var safeParse = /* @__PURE__ */ _safeParse($ZodRealError); -var _safeParseAsync = (_Err) => async (schema, value, _ctx) => { - const ctx = _ctx ? { ..._ctx, async: true } : { async: true }; - let result = schema._zod.run({ value, issues: [] }, ctx); - if (result instanceof Promise) - result = await result; - return result.issues.length ? { - success: false, - error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) - } : { success: true, data: result.value }; -}; -var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError); -var COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid"); -var COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback"); -var validate = ((schema, value, _ctx) => { - const validator = schema._zod.bag.validator; - if (validator !== void 0 && validator(value) !== COMPILE_INVALID) - return true; - return validateFallback(schema, value, _ctx); -}); -function validateFallback(schema, value, _ctx) { - const ctx = _ctx ? { ..._ctx, async: false } : { async: false }; - const fallbackRun = schema._zod.bag.fallbackRun; - let result; - if (fallbackRun) { - ctx[COMPILE_FALLBACK] = true; - result = fallbackRun({ value, issues: [] }, ctx); - } else { - result = schema._zod.run({ value, issues: [] }, ctx); - } - if (result instanceof Promise) { - throw new $ZodAsyncError(); - } - return result.issues.length === 0; -} -var validateAsync = async (schema, value, _ctx) => { - const ctx = _ctx ? { ..._ctx, async: true } : { async: true }; - let result = schema._zod.run({ value, issues: [] }, ctx); - if (result instanceof Promise) - result = await result; - return result.issues.length === 0; -}; -var _encode = (_Err) => { - const parse3 = _parse(_Err); - const fn = (schema, value, _ctx, _params) => { - const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" }; - return parse3(schema, value, ctx, finalizeParams(fn, _params)); - }; - return fn; -}; -var encode = /* @__PURE__ */ _encode($ZodRealError); -var _decode = (_Err) => { - const parse3 = _parse(_Err); - const fn = (schema, value, _ctx, _params) => { - return parse3(schema, value, _ctx, finalizeParams(fn, _params)); - }; - return fn; -}; -var decode = /* @__PURE__ */ _decode($ZodRealError); -var _encodeAsync = (_Err) => { - const parseAsync3 = _parseAsync(_Err); - const fn = async (schema, value, _ctx, _params) => { - const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" }; - return await parseAsync3(schema, value, ctx, finalizeParams(fn, _params)); - }; - return fn; -}; -var encodeAsync = /* @__PURE__ */ _encodeAsync($ZodRealError); -var _decodeAsync = (_Err) => { - const parseAsync3 = _parseAsync(_Err); - const fn = async (schema, value, _ctx, _params) => { - return await parseAsync3(schema, value, _ctx, finalizeParams(fn, _params)); - }; - return fn; -}; -var decodeAsync = /* @__PURE__ */ _decodeAsync($ZodRealError); -var _safeEncode = (_Err) => (schema, value, _ctx) => { - const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" }; - return _safeParse(_Err)(schema, value, ctx); -}; -var safeEncode = /* @__PURE__ */ _safeEncode($ZodRealError); -var _safeDecode = (_Err) => (schema, value, _ctx) => { - return _safeParse(_Err)(schema, value, _ctx); -}; -var safeDecode = /* @__PURE__ */ _safeDecode($ZodRealError); -var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => { - const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" }; - return _safeParseAsync(_Err)(schema, value, ctx); -}; -var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync($ZodRealError); -var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => { - return _safeParseAsync(_Err)(schema, value, _ctx); -}; -var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError); - -// node_modules/zod/v4/core/regexes.js -var regexes_exports = {}; -__export(regexes_exports, { - base64: () => base64, - base64url: () => base64url, - bigint: () => bigint, - boolean: () => boolean, - browserEmail: () => browserEmail, - cidrv4: () => cidrv4, - cidrv6: () => cidrv6, - creditCard: () => creditCard, - cuid: () => cuid, - cuid2: () => cuid2, - date: () => date, - datetime: () => datetime, - domain: () => domain, - duration: () => duration, - e164: () => e164, - email: () => email, - emoji: () => emoji, - extendedDuration: () => extendedDuration, - guid: () => guid, - hex: () => hex, - hostname: () => hostname, - html5Email: () => html5Email, - httpProtocol: () => httpProtocol, - idnEmail: () => idnEmail, - integer: () => integer, - ipv4: () => ipv4, - ipv6: () => ipv6, - ksuid: () => ksuid, - lowercase: () => lowercase, - mac: () => mac, - md5_base64: () => md5_base64, - md5_base64url: () => md5_base64url, - md5_hex: () => md5_hex, - nanoid: () => nanoid, - nanoidOfLength: () => nanoidOfLength, - null: () => _null, - number: () => number, - rfc5322Email: () => rfc5322Email, - sha1_base64: () => sha1_base64, - sha1_base64url: () => sha1_base64url, - sha1_hex: () => sha1_hex, - sha256_base64: () => sha256_base64, - sha256_base64url: () => sha256_base64url, - sha256_hex: () => sha256_hex, - sha384_base64: () => sha384_base64, - sha384_base64url: () => sha384_base64url, - sha384_hex: () => sha384_hex, - sha512_base64: () => sha512_base64, - sha512_base64url: () => sha512_base64url, - sha512_hex: () => sha512_hex, - string: () => string, - time: () => time, - ulid: () => ulid, - undefined: () => _undefined, - unicodeEmail: () => unicodeEmail, - uppercase: () => uppercase, - uuid: () => uuid, - uuid4: () => uuid4, - uuid6: () => uuid6, - uuid7: () => uuid7, - xid: () => xid -}); -var cuid = /^[cC][0-9a-z]{6,}$/; -var cuid2 = /^[0-9a-z]+$/; -var ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/; -var xid = /^[0-9a-vA-V]{20}$/; -var ksuid = /^[A-Za-z0-9]{27}$/; -var nanoid = /^[a-zA-Z0-9_-]{21}$/; -function nanoidOfLength(length) { - return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`); -} -var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/; -var 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)?)??$/; -var 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})$/; -var uuid = (version2) => { - if (!version2) - return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/; - return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version2}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`); -}; -var uuid4 = /* @__PURE__ */ uuid(4); -var uuid6 = /* @__PURE__ */ uuid(6); -var uuid7 = /* @__PURE__ */ uuid(7); -var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/; -var 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])?)*$/; -var 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,}))$/; -var unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u; -var idnEmail = unicodeEmail; -var 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])?)*$/; -var _emoji = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`; -function emoji() { - return new RegExp(_emoji, "u"); -} -var 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])$/; -var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/; -var mac = (delimiter) => { - const escapedDelim = escapeRegex(delimiter ?? ":"); - return new RegExp(`^(?:[0-9A-F]{2}${escapedDelim}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${escapedDelim}){5}[0-9a-f]{2}$`); -}; -var 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])$/; -var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/; -var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/; -var base64url = /^[A-Za-z0-9_-]*$/; -var hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/; -var domain = /^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/; -var httpProtocol = /^https?$/; -var e164 = /^\+[1-9]\d{6,14}$/; -var creditCard = /^\d(?:[ -]?\d){11,18}$/; -var 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])))`; -function anchor(source) { - return new RegExp(`^${source}$`); -} -var date = /* @__PURE__ */ anchor(dateSource); -function timeSource(args) { - const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`; - const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`; - return regex; -} -function time(args) { - return new RegExp(`^${timeSource(args)}$`); -} -function datetime(args) { - const opts = ["Z"]; - if (args.offset) - opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`); - const qualified = `${timeSource({ precision: args.precision, seconds: true })}(?:${opts.join("|")})`; - const timeRegex2 = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified; - return new RegExp(`^${dateSource}T(?:${timeRegex2})$`); -} -var string = (params) => { - const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`; - return new RegExp(`^${regex}$`); -}; -var bigint = /^-?\d+n?$/; -var integer = /^-?\d+$/; -var number = /^-?\d+(?:\.\d+)?$/; -var boolean = /^(?:true|false)$/i; -var _null = /^null$/i; -var _undefined = /^undefined$/i; -var lowercase = /^[^A-Z]*$/; -var uppercase = /^[^a-z]*$/; -var hex = /^[0-9a-fA-F]*$/; -function fixedBase64(bodyLength, padding) { - return new RegExp(`^[A-Za-z0-9+/]{${bodyLength}}${padding}$`); -} -function fixedBase64url(length) { - return new RegExp(`^[A-Za-z0-9_-]{${length}}$`); -} -var md5_hex = /^[0-9a-fA-F]{32}$/; -var md5_base64 = /* @__PURE__ */ fixedBase64(22, "=="); -var md5_base64url = /* @__PURE__ */ fixedBase64url(22); -var sha1_hex = /^[0-9a-fA-F]{40}$/; -var sha1_base64 = /* @__PURE__ */ fixedBase64(27, "="); -var sha1_base64url = /* @__PURE__ */ fixedBase64url(27); -var sha256_hex = /^[0-9a-fA-F]{64}$/; -var sha256_base64 = /* @__PURE__ */ fixedBase64(43, "="); -var sha256_base64url = /* @__PURE__ */ fixedBase64url(43); -var sha384_hex = /^[0-9a-fA-F]{96}$/; -var sha384_base64 = /* @__PURE__ */ fixedBase64(64, ""); -var sha384_base64url = /* @__PURE__ */ fixedBase64url(64); -var sha512_hex = /^[0-9a-fA-F]{128}$/; -var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "=="); -var sha512_base64url = /* @__PURE__ */ fixedBase64url(86); - -// node_modules/zod/v4/core/checks.js -var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => { - var _a3; - inst._zod ?? (inst._zod = {}); - inst._zod.def = def; - (_a3 = inst._zod).onattach ?? (_a3.onattach = []); -}); -var _whenHasSize = (payload) => { - const val = payload.value; - return !nullish(val) && val.size !== void 0; -}; -var _whenHasLength = (payload) => { - const val = payload.value; - return !nullish(val) && val.length !== void 0; -}; -var numericOriginMap = { - number: "number", - bigint: "bigint", - object: "date" -}; -var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => { - $ZodCheck.init(inst, def); - const origin = numericOriginMap[typeof def.value]; - inst._zod.onattach.push((inst2) => { - const bag = inst2._zod.bag; - const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY; - if (def.value < curr) { - if (def.inclusive) - bag.maximum = def.value; - else - bag.exclusiveMaximum = def.value; - } - }); - inst._zod.check = (payload) => { - if (def.inclusive ? payload.value <= def.value : payload.value < def.value) { - return; - } - payload.issues.push({ - origin: numericOriginMap[typeof payload.value] ?? origin, - code: "too_big", - maximum: typeof def.value === "object" ? def.value.getTime() : def.value, - input: payload.value, - inclusive: def.inclusive, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => { - $ZodCheck.init(inst, def); - const origin = numericOriginMap[typeof def.value]; - inst._zod.onattach.push((inst2) => { - const bag = inst2._zod.bag; - const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY; - if (def.value > curr) { - if (def.inclusive) - bag.minimum = def.value; - else - bag.exclusiveMinimum = def.value; - } - }); - inst._zod.check = (payload) => { - if (def.inclusive ? payload.value >= def.value : payload.value > def.value) { - return; - } - payload.issues.push({ - origin: numericOriginMap[typeof payload.value] ?? origin, - code: "too_small", - minimum: typeof def.value === "object" ? def.value.getTime() : def.value, - input: payload.value, - inclusive: def.inclusive, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => { - $ZodCheck.init(inst, def); - inst._zod.onattach.push((inst2) => { - var _a3; - (_a3 = inst2._zod.bag).multipleOf ?? (_a3.multipleOf = def.value); - }); - inst._zod.check = (payload) => { - if (typeof payload.value !== typeof def.value) - throw new Error("Cannot mix number and bigint in multiple_of check."); - const isMultiple = typeof payload.value === "bigint" ? ( - // `value % 0n` throws, and nothing is a multiple of zero — the number branch already fails this way via NaN - def.value !== BigInt(0) && payload.value % def.value === BigInt(0) - ) : floatSafeRemainder2(payload.value, def.value) === 0; - if (isMultiple) - return; - payload.issues.push({ - origin: typeof payload.value, - code: "not_multiple_of", - divisor: def.value, - input: payload.value, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => { - $ZodCheck.init(inst, def); - def.format = def.format || "float64"; - const isInt = def.format?.includes("int"); - const origin = isInt ? "int" : "number"; - const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format]; - inst._zod.onattach.push((inst2) => { - const bag = inst2._zod.bag; - bag.format = def.format; - bag.minimum = minimum; - bag.maximum = maximum; - if (isInt) - bag.pattern = integer; - }); - inst._zod.check = (payload) => { - const input2 = payload.value; - if (isInt) { - if (!Number.isInteger(input2)) { - payload.issues.push({ - expected: origin, - format: def.format, - code: "invalid_type", - continue: false, - input: input2, - inst - }); - return; - } - if (!Number.isSafeInteger(input2)) { - if (input2 > 0) { - payload.issues.push({ - input: input2, - code: "too_big", - maximum: Number.MAX_SAFE_INTEGER, - note: "Integers must be within the safe integer range.", - inst, - origin, - inclusive: true, - continue: !def.abort - }); - } else { - payload.issues.push({ - input: input2, - code: "too_small", - minimum: Number.MIN_SAFE_INTEGER, - note: "Integers must be within the safe integer range.", - inst, - origin, - inclusive: true, - continue: !def.abort - }); - } - return; - } - } - if (input2 < minimum) { - payload.issues.push({ - origin: "number", - input: input2, - code: "too_small", - minimum, - inclusive: true, - inst, - continue: !def.abort - }); - } - if (input2 > maximum) { - payload.issues.push({ - origin: "number", - input: input2, - code: "too_big", - maximum, - inclusive: true, - inst, - continue: !def.abort - }); - } - }; -}); -var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat", (inst, def) => { - $ZodCheck.init(inst, def); - const [minimum, maximum] = BIGINT_FORMAT_RANGES[def.format]; - inst._zod.onattach.push((inst2) => { - const bag = inst2._zod.bag; - bag.format = def.format; - bag.minimum = minimum; - bag.maximum = maximum; - }); - inst._zod.check = (payload) => { - const input2 = payload.value; - if (input2 < minimum) { - payload.issues.push({ - origin: "bigint", - input: input2, - code: "too_small", - minimum, - inclusive: true, - inst, - continue: !def.abort - }); - } - if (input2 > maximum) { - payload.issues.push({ - origin: "bigint", - input: input2, - code: "too_big", - maximum, - inclusive: true, - inst, - continue: !def.abort - }); - } - }; -}); -var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, def) => { - var _a3; - $ZodCheck.init(inst, def); - (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize); - inst._zod.onattach.push((inst2) => { - const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY; - if (def.maximum < curr) - inst2._zod.bag.maximum = def.maximum; - }); - inst._zod.check = (payload) => { - const input2 = payload.value; - const size = input2.size; - if (size <= def.maximum) - return; - payload.issues.push({ - origin: getSizableOrigin(input2), - code: "too_big", - maximum: def.maximum, - inclusive: true, - input: input2, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, def) => { - var _a3; - $ZodCheck.init(inst, def); - (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize); - inst._zod.onattach.push((inst2) => { - const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY; - if (def.minimum > curr) - inst2._zod.bag.minimum = def.minimum; - }); - inst._zod.check = (payload) => { - const input2 = payload.value; - const size = input2.size; - if (size >= def.minimum) - return; - payload.issues.push({ - origin: getSizableOrigin(input2), - code: "too_small", - minimum: def.minimum, - inclusive: true, - input: input2, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (inst, def) => { - var _a3; - $ZodCheck.init(inst, def); - (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasSize); - inst._zod.onattach.push((inst2) => { - const bag = inst2._zod.bag; - bag.minimum = def.size; - bag.maximum = def.size; - bag.size = def.size; - }); - inst._zod.check = (payload) => { - const input2 = payload.value; - const size = input2.size; - if (size === def.size) - return; - const tooBig = size > def.size; - payload.issues.push({ - origin: getSizableOrigin(input2), - ...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size }, - inclusive: true, - exact: true, - input: payload.value, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => { - var _a3; - $ZodCheck.init(inst, def); - (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength); - inst._zod.onattach.push((inst2) => { - const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY; - if (def.maximum < curr) - inst2._zod.bag.maximum = def.maximum; - }); - inst._zod.check = (payload) => { - const input2 = payload.value; - const units = input2.length; - const length = typeof input2 === "string" && units > def.maximum ? codePointLength(input2) : units; - if (length <= def.maximum) - return; - const origin = getLengthableOrigin(input2); - payload.issues.push({ - origin, - code: "too_big", - maximum: def.maximum, - inclusive: true, - input: input2, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => { - var _a3; - $ZodCheck.init(inst, def); - (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength); - inst._zod.onattach.push((inst2) => { - const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY; - if (def.minimum > curr) - inst2._zod.bag.minimum = def.minimum; - }); - inst._zod.check = (payload) => { - const input2 = payload.value; - const units = input2.length; - const length = typeof input2 === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input2) : units; - if (length >= def.minimum) - return; - const origin = getLengthableOrigin(input2); - payload.issues.push({ - origin, - code: "too_small", - minimum: def.minimum, - inclusive: true, - input: input2, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => { - var _a3; - $ZodCheck.init(inst, def); - (_a3 = inst._zod.def).when ?? (_a3.when = _whenHasLength); - inst._zod.onattach.push((inst2) => { - const bag = inst2._zod.bag; - bag.minimum = def.length; - bag.maximum = def.length; - bag.length = def.length; - }); - inst._zod.check = (payload) => { - const input2 = payload.value; - const units = input2.length; - const length = typeof input2 === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input2) : units; - if (length === def.length) - return; - const origin = getLengthableOrigin(input2); - const tooBig = length > def.length; - payload.issues.push({ - origin, - ...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length }, - inclusive: true, - exact: true, - input: payload.value, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => { - var _a3, _b; - $ZodCheck.init(inst, def); - inst._zod.onattach.push((inst2) => { - const bag = inst2._zod.bag; - bag.format = def.format; - if (def.pattern) { - bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); - bag.patterns.add(def.pattern); - } - }); - if (def.pattern) - (_a3 = inst._zod).check ?? (_a3.check = (payload) => { - def.pattern.lastIndex = 0; - if (def.pattern.test(payload.value)) - return; - payload.issues.push({ - origin: "string", - code: "invalid_format", - format: def.format, - input: payload.value, - ...def.pattern ? { pattern: def.pattern.toString() } : {}, - inst, - continue: !def.abort - }); - }); - else - (_b = inst._zod).check ?? (_b.check = () => { - }); -}); -var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => { - $ZodCheckStringFormat.init(inst, def); - inst._zod.check = (payload) => { - def.pattern.lastIndex = 0; - if (def.pattern.test(payload.value)) - return; - payload.issues.push({ - origin: "string", - code: "invalid_format", - format: "regex", - input: payload.value, - pattern: def.pattern.toString(), - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => { - def.pattern ?? (def.pattern = lowercase); - $ZodCheckStringFormat.init(inst, def); -}); -var $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => { - def.pattern ?? (def.pattern = uppercase); - $ZodCheckStringFormat.init(inst, def); -}); -var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => { - $ZodCheck.init(inst, def); - const escapedRegex = escapeRegex(def.includes); - const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex); - def.pattern = pattern; - inst._zod.onattach.push((inst2) => { - const bag = inst2._zod.bag; - bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); - bag.patterns.add(pattern); - }); - inst._zod.check = (payload) => { - if (payload.value.includes(def.includes, def.position)) - return; - payload.issues.push({ - origin: "string", - code: "invalid_format", - format: "includes", - includes: def.includes, - input: payload.value, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => { - $ZodCheck.init(inst, def); - const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`); - def.pattern ?? (def.pattern = pattern); - inst._zod.onattach.push((inst2) => { - const bag = inst2._zod.bag; - bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); - bag.patterns.add(pattern); - }); - inst._zod.check = (payload) => { - if (payload.value.startsWith(def.prefix)) - return; - payload.issues.push({ - origin: "string", - code: "invalid_format", - format: "starts_with", - prefix: def.prefix, - input: payload.value, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => { - $ZodCheck.init(inst, def); - const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`); - def.pattern ?? (def.pattern = pattern); - inst._zod.onattach.push((inst2) => { - const bag = inst2._zod.bag; - bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set()); - bag.patterns.add(pattern); - }); - inst._zod.check = (payload) => { - if (payload.value.endsWith(def.suffix)) - return; - payload.issues.push({ - origin: "string", - code: "invalid_format", - format: "ends_with", - suffix: def.suffix, - input: payload.value, - inst, - continue: !def.abort - }); - }; -}); -function handleCheckPropertyResult(result, payload, property) { - if (result.issues.length) { - payload.issues.push(...prefixIssues(property, result.issues)); - } -} -var $ZodCheckProperty = /* @__PURE__ */ $constructor("$ZodCheckProperty", (inst, def) => { - $ZodCheck.init(inst, def); - inst._zod.check = (payload) => { - const result = def.schema._zod.run({ - value: payload.value[def.property], - issues: [] - }, {}); - if (result instanceof Promise) { - return result.then((result2) => handleCheckPropertyResult(result2, payload, def.property)); - } - handleCheckPropertyResult(result, payload, def.property); - return; - }; -}); -var $ZodCheckMimeType = /* @__PURE__ */ $constructor("$ZodCheckMimeType", (inst, def) => { - $ZodCheck.init(inst, def); - const mimeSet = new Set(def.mime); - inst._zod.onattach.push((inst2) => { - inst2._zod.bag.mime = def.mime; - }); - inst._zod.check = (payload) => { - if (mimeSet.has(payload.value.type)) - return; - payload.issues.push({ - code: "invalid_value", - values: def.mime, - input: payload.value.type, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => { - $ZodCheck.init(inst, def); - inst._zod.check = (payload) => { - payload.value = def.tx(payload.value); - }; -}); - -// node_modules/zod/v4/core/doc.js -var Doc = class { - constructor(args = [], closed = {}) { - this.content = []; - this.indent = 0; - this.args = args; - this.closed = closed; - } - indented(fn) { - this.indent += 1; - fn(this); - this.indent -= 1; - } - write(arg) { - if (typeof arg === "function") { - arg(this, { execution: "sync" }); - arg(this, { execution: "async" }); - return; - } - const content = arg; - const lines = content.split("\n").filter((x) => x); - const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length)); - const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x); - for (const line of dedented) { - this.content.push(line); - } - } - compile() { - const F = Function; - const content = this?.content ?? [``]; - const factory = new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) { -${content.join("\n")} -};`); - return factory(...Object.values(this.closed)); - } -}; - -// node_modules/zod/v4/core/versions.js -var version = { - major: 4, - minor: 5, - patch: 4 -}; - -// node_modules/zod/v4/core/schemas.js -var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => { - var _a3; - inst ?? (inst = {}); - inst._zod.def = def; - inst._zod.bag = inst._zod.bag || {}; - inst._zod.version = version; - const defChecks = inst._zod.def.checks; - const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : []; - for (const ch of checks) { - for (const fn of ch._zod.onattach) { - fn(inst); - } - } - if (checks.length === 0) { - (_a3 = inst._zod).deferred ?? (_a3.deferred = []); - inst._zod.deferred?.push(() => { - inst._zod.run = inst._zod.parse; - }); - } else { - const runChecks = (payload, checks2, ctx) => { - if (payload.memo) - return payload; - let isAborted2 = aborted(payload); - let asyncResult; - for (const ch of checks2) { - if (ch._zod.def.when) { - if (explicitlyAborted(payload)) - continue; - const shouldRun = ch._zod.def.when(payload); - if (!shouldRun) - continue; - } else if (isAborted2) { - continue; - } - const currLen = payload.issues.length; - const _ = ch._zod.check(payload); - if (_ instanceof Promise && ctx?.async === false) { - throw new $ZodAsyncError(); - } - if (asyncResult || _ instanceof Promise) { - asyncResult = (asyncResult ?? Promise.resolve()).then(async () => { - await _; - const nextLen = payload.issues.length; - if (nextLen === currLen) - return; - attachSchema(payload.issues, currLen, inst); - if (!isAborted2) - isAborted2 = aborted(payload, currLen); - }); - } else { - const nextLen = payload.issues.length; - if (nextLen === currLen) - continue; - attachSchema(payload.issues, currLen, inst); - if (!isAborted2) - isAborted2 = aborted(payload, currLen); - } - } - if (asyncResult) { - return asyncResult.then(() => { - return payload; - }); - } - return payload; - }; - const handleCanaryResult = (canary, payload, ctx) => { - if (aborted(canary)) { - canary.aborted = true; - return canary; - } - const checkResult = runChecks(payload, checks, ctx); - if (checkResult instanceof Promise) { - if (ctx.async === false) - throw new $ZodAsyncError(); - return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx)); - } - return inst._zod.parse(checkResult, ctx); - }; - inst._zod.run = (payload, ctx) => { - if (ctx.skipChecks) { - return inst._zod.parse(payload, ctx); - } - if (ctx.direction === "backward") { - const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true }); - if (canary instanceof Promise) { - return canary.then((canary2) => { - return handleCanaryResult(canary2, payload, ctx); - }); - } - return handleCanaryResult(canary, payload, ctx); - } - const result = inst._zod.parse(payload, ctx); - if (result instanceof Promise) { - if (ctx.async === false) - throw new $ZodAsyncError(); - return result.then((result2) => runChecks(result2, checks, ctx)); - } - return runChecks(result, checks, ctx); - }; - } -}, { - // Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness. - get "~standard"() { - return hide(this, "~standard", standardProps(this)); - }, - set "~standard"(value) { - own(this, "~standard", value); - } -}); -var toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues }; -function standardProps(inst) { - return { - validate: (value) => { - try { - return toStandardResult(safeParse(inst, value)); - } catch (_) { - return safeParseAsync(inst, value).then(toStandardResult); - } - }, - vendor: "zod", - version: 1 - }; -} -var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag); - inst._zod.parse = (payload, _) => { - if (def.coerce) - try { - payload.value = String(payload.value); - } catch (_2) { - } - if (typeof payload.value === "string") - return payload; - payload.issues.push({ - expected: "string", - code: "invalid_type", - input: payload.value, - inst - }); - return payload; - }; -}); -var $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => { - $ZodCheckStringFormat.init(inst, def); - $ZodString.init(inst, def); -}); -var $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => { - def.pattern ?? (def.pattern = guid); - $ZodStringFormat.init(inst, def); -}); -var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => { - if (def.version) { - const versionMap = { - v1: 1, - v2: 2, - v3: 3, - v4: 4, - v5: 5, - v6: 6, - v7: 7, - v8: 8 - }; - const v = versionMap[def.version]; - if (v === void 0) - throw new Error(`Invalid UUID version: "${def.version}"`); - def.pattern ?? (def.pattern = uuid(v)); - } else - def.pattern ?? (def.pattern = uuid()); - $ZodStringFormat.init(inst, def); -}); -var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => { - def.pattern ?? (def.pattern = email); - $ZodStringFormat.init(inst, def); -}); -var URL_BAD_FORMAT = 1; -var URL_UNPARSEABLE = 2; -function parseURLObject(trimmed, def) { - if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) { - return URL_BAD_FORMAT; - } - try { - return new URL(trimmed); - } catch { - return URL_UNPARSEABLE; - } -} -var asciiTabOrNewline = /[\t\n\r]/g; -function stripTabAndNewline(value) { - return value.replace(asciiTabOrNewline, ""); -} -function urlHostnameOk(url2, hostname3) { - hostname3.lastIndex = 0; - return hostname3.test(url2.hostname); -} -function urlProtocolOk(url2, protocol) { - protocol.lastIndex = 0; - return protocol.test(url2.protocol.endsWith(":") ? url2.protocol.slice(0, -1) : url2.protocol); -} -var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => { - $ZodStringFormat.init(inst, def); - inst._zod.check = (payload) => { - try { - const trimmed = payload.value.trim(); - const url2 = parseURLObject(trimmed, def); - if (url2 === URL_BAD_FORMAT) { - payload.issues.push({ - code: "invalid_format", - format: "url", - note: "Invalid URL format", - input: payload.value, - inst, - continue: !def.abort - }); - return; - } - if (url2 === URL_UNPARSEABLE) { - payload.issues.push({ - code: "invalid_format", - format: "url", - input: payload.value, - inst, - continue: !def.abort - }); - return; - } - if (def.hostname && !urlHostnameOk(url2, def.hostname)) { - payload.issues.push({ - code: "invalid_format", - format: "url", - note: "Invalid hostname", - pattern: def.hostname.source, - input: payload.value, - inst, - continue: !def.abort - }); - } - if (def.protocol && !urlProtocolOk(url2, def.protocol)) { - payload.issues.push({ - code: "invalid_format", - format: "url", - note: "Invalid protocol", - pattern: def.protocol.source, - input: payload.value, - inst, - continue: !def.abort - }); - } - payload.value = def.normalize ? url2.href : stripTabAndNewline(trimmed); - return; - } catch (_) { - payload.issues.push({ - code: "invalid_format", - format: "url", - input: payload.value, - inst, - continue: !def.abort - }); - } - }; -}); -var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => { - def.pattern ?? (def.pattern = emoji()); - $ZodStringFormat.init(inst, def); -}); -var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => { - if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) - throw new Error(`Invalid nanoid length: ${def.length}`); - def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length)); - $ZodStringFormat.init(inst, def); -}); -var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => { - def.pattern ?? (def.pattern = cuid); - $ZodStringFormat.init(inst, def); -}); -var $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => { - def.pattern ?? (def.pattern = cuid2); - $ZodStringFormat.init(inst, def); -}); -var $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => { - def.pattern ?? (def.pattern = ulid); - $ZodStringFormat.init(inst, def); -}); -var $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => { - def.pattern ?? (def.pattern = xid); - $ZodStringFormat.init(inst, def); -}); -var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => { - def.pattern ?? (def.pattern = ksuid); - $ZodStringFormat.init(inst, def); -}); -var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => { - def.pattern ?? (def.pattern = datetime(def)); - $ZodStringFormat.init(inst, def); - if (def.local || def.precision === -1) { - inst._zod.bag.laxFormat = true; - inst._zod.onattach.push((s) => { - s._zod.bag.laxFormat = true; - }); - } -}); -var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => { - def.pattern ?? (def.pattern = date); - $ZodStringFormat.init(inst, def); -}); -var $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => { - def.pattern ?? (def.pattern = time(def)); - $ZodStringFormat.init(inst, def); -}); -var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => { - def.pattern ?? (def.pattern = duration); - $ZodStringFormat.init(inst, def); -}); -var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => { - def.pattern ?? (def.pattern = ipv4); - $ZodStringFormat.init(inst, def); - inst._zod.bag.format = `ipv4`; -}); -var ipv6Alphabet = /^[0-9a-fA-F:.]+$/; -function isValidIPv6(value) { - if (!ipv6Alphabet.test(value)) - return false; - try { - new URL(`http://[${value}]`); - return true; - } catch { - return false; - } -} -var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => { - def.pattern ?? (def.pattern = ipv6); - $ZodStringFormat.init(inst, def); - inst._zod.bag.format = `ipv6`; - inst._zod.check = (payload) => { - if (!isValidIPv6(payload.value)) { - payload.issues.push({ - code: "invalid_format", - format: "ipv6", - input: payload.value, - inst, - continue: !def.abort - }); - } - }; -}); -var $ZodMAC = /* @__PURE__ */ $constructor("$ZodMAC", (inst, def) => { - def.pattern ?? (def.pattern = mac(def.delimiter)); - $ZodStringFormat.init(inst, def); - inst._zod.bag.format = `mac`; -}); -var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => { - def.pattern ?? (def.pattern = cidrv4); - $ZodStringFormat.init(inst, def); -}); -function isValidCIDRv6(value) { - const parts = value.split("/"); - if (parts.length !== 2) - return false; - const [address, prefix] = parts; - if (!prefix) - return false; - const prefixNum = Number(prefix); - if (`${prefixNum}` !== prefix) - return false; - if (prefixNum < 0 || prefixNum > 128) - return false; - return isValidIPv6(address); -} -var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => { - def.pattern ?? (def.pattern = cidrv6); - $ZodStringFormat.init(inst, def); - inst._zod.check = (payload) => { - if (!isValidCIDRv6(payload.value)) { - payload.issues.push({ - code: "invalid_format", - format: "cidrv6", - input: payload.value, - inst, - continue: !def.abort - }); - } - }; -}); -function isValidBase64(data) { - if (data === "") - return true; - if (/\s/.test(data)) - return false; - if (data.length % 4 !== 0) - return false; - try { - atob(data); - return true; - } catch { - return false; - } -} -var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => { - def.pattern ?? (def.pattern = base64); - $ZodStringFormat.init(inst, def); - inst._zod.bag.contentEncoding = "base64"; - inst._zod.check = (payload) => { - if (isValidBase64(payload.value)) - return; - payload.issues.push({ - code: "invalid_format", - format: "base64", - input: payload.value, - inst, - continue: !def.abort - }); - }; -}); -function isValidBase64URL(data) { - if (!base64url.test(data)) - return false; - const base643 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/"); - const padded = base643.padEnd(Math.ceil(base643.length / 4) * 4, "="); - return isValidBase64(padded); -} -var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => { - def.pattern ?? (def.pattern = base64url); - $ZodStringFormat.init(inst, def); - inst._zod.bag.contentEncoding = "base64url"; - inst._zod.check = (payload) => { - if (isValidBase64URL(payload.value)) - return; - payload.issues.push({ - code: "invalid_format", - format: "base64url", - input: payload.value, - inst, - continue: !def.abort - }); - }; -}); -var $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => { - def.pattern ?? (def.pattern = e164); - $ZodStringFormat.init(inst, def); -}); -var CC_SANITIZE = /[- ]/g; -function isLuhnAlgo(digits) { - let length = digits.length; - let bit = 1; - let sum = 0; - while (length) { - const value = +digits[--length]; - bit ^= 1; - sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value; - } - return sum % 10 === 0; -} -function isValidCreditCard(input2) { - if (!creditCard.test(input2)) - return false; - return isLuhnAlgo(input2.replace(CC_SANITIZE, "")); -} -var $ZodCreditCard = /* @__PURE__ */ $constructor("$ZodCreditCard", (inst, def) => { - def.pattern ?? (def.pattern = creditCard); - $ZodStringFormat.init(inst, def); - inst._zod.check = (payload) => { - if (isValidCreditCard(payload.value)) - return; - payload.issues.push({ - code: "invalid_format", - format: "credit_card", - input: payload.value, - inst, - continue: !def.abort - }); - }; -}); -function isValidJWT2(token, algorithm = null) { - try { - const tokensParts = token.split("."); - if (tokensParts.length !== 3) - return false; - const [header] = tokensParts; - if (!header) - return false; - const parsedHeader = JSON.parse(atob(header)); - if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") - return false; - if (!parsedHeader.alg) - return false; - if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) - return false; - return true; - } catch { - return false; - } -} -var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => { - $ZodStringFormat.init(inst, def); - inst._zod.check = (payload) => { - if (isValidJWT2(payload.value, def.alg)) - return; - payload.issues.push({ - code: "invalid_format", - format: "jwt", - input: payload.value, - inst, - continue: !def.abort - }); - }; -}); -var $ZodCustomStringFormat = /* @__PURE__ */ $constructor("$ZodCustomStringFormat", (inst, def) => { - $ZodStringFormat.init(inst, def); - inst._zod.check = (payload) => { - if (def.fn(payload.value)) - return; - payload.issues.push({ - code: "invalid_format", - format: def.format, - input: payload.value, - inst, - continue: !def.abort - }); - }; -}); -var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.pattern = inst._zod.bag.pattern ?? number; - inst._zod.parse = (payload, _ctx) => { - if (def.coerce) - try { - payload.value = Number(payload.value); - } catch (_) { - } - const input2 = payload.value; - if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) { - return payload; - } - const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? String(input2) : void 0 : void 0; - payload.issues.push({ - expected: "number", - code: "invalid_type", - input: input2, - inst, - ...received ? { received } : {} - }); - return payload; - }; -}); -var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => { - $ZodCheckNumberFormat.init(inst, def); - $ZodNumber.init(inst, def); -}); -var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.pattern = boolean; - inst._zod.parse = (payload, _ctx) => { - if (def.coerce) - try { - payload.value = Boolean(payload.value); - } catch (_) { - } - const input2 = payload.value; - if (typeof input2 === "boolean") - return payload; - payload.issues.push({ - expected: "boolean", - code: "invalid_type", - input: input2, - inst - }); - return payload; - }; -}); -var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.pattern = bigint; - inst._zod.parse = (payload, _ctx) => { - if (def.coerce) - try { - payload.value = BigInt(payload.value); - } catch (_) { - } - if (typeof payload.value === "bigint") - return payload; - payload.issues.push({ - expected: "bigint", - code: "invalid_type", - input: payload.value, - inst - }); - return payload; - }; -}); -var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, def) => { - $ZodCheckBigIntFormat.init(inst, def); - $ZodBigInt.init(inst, def); -}); -var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.parse = (payload, _ctx) => { - const input2 = payload.value; - if (typeof input2 === "symbol") - return payload; - payload.issues.push({ - expected: "symbol", - code: "invalid_type", - input: input2, - inst - }); - return payload; - }; -}); -var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.pattern = _undefined; - inst._zod.values = /* @__PURE__ */ new Set([void 0]); - inst._zod.parse = (payload, _ctx) => { - const input2 = payload.value; - if (typeof input2 === "undefined") - return payload; - payload.issues.push({ - expected: "undefined", - code: "invalid_type", - input: input2, - inst - }); - return payload; - }; -}); -var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.pattern = _null; - inst._zod.values = /* @__PURE__ */ new Set([null]); - inst._zod.parse = (payload, _ctx) => { - const input2 = payload.value; - if (input2 === null) - return payload; - payload.issues.push({ - expected: "null", - code: "invalid_type", - input: input2, - inst - }); - return payload; - }; -}); -var $ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.parse = (payload) => payload; -}); -var $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.parse = (payload) => payload; -}); -var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.parse = (payload, _ctx) => { - payload.issues.push({ - expected: "never", - code: "invalid_type", - input: payload.value, - inst - }); - return payload; - }; -}); -var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.parse = (payload, _ctx) => { - const input2 = payload.value; - if (typeof input2 === "undefined") - return payload; - payload.issues.push({ - expected: "void", - code: "invalid_type", - input: input2, - inst - }); - return payload; - }; -}); -var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.parse = (payload, _ctx) => { - if (def.coerce) { - try { - payload.value = new Date(payload.value); - } catch (_err) { - } - } - const input2 = payload.value; - const isDate = input2 instanceof Date; - const isValidDate = isDate && !Number.isNaN(input2.getTime()); - if (isValidDate) - return payload; - payload.issues.push({ - expected: "date", - code: "invalid_type", - input: input2, - ...isDate ? { received: "Invalid Date" } : {}, - inst - }); - return payload; - }; -}); -function handleArrayResult(result, final, index) { - if (result.issues.length) { - final.issues.push(...prefixIssues(index, result.issues)); - } - final.value[index] = result.value; -} -var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => { - $ZodType.init(inst, def); - const memo2 = globalConfig.memoizer; - memo2?.attach(inst); - inst._zod.parse = (payload, ctx) => { - const input2 = payload.value; - if (!Array.isArray(input2)) { - payload.issues.push({ - expected: "array", - code: "invalid_type", - input: input2, - inst - }); - return payload; - } - payload.value = memo2 ? memo2.alloc(inst, payload, Array(input2.length), ctx) : Array(input2.length); - const proms = []; - for (let i = 0; i < input2.length; i++) { - const item = input2[i]; - const result = def.element._zod.run({ - value: item, - issues: [] - }, ctx); - if (result instanceof Promise) { - proms.push(result.then((result2) => handleArrayResult(result2, payload, i))); - } else { - handleArrayResult(result, payload, i); - } - } - if (proms.length) { - return Promise.all(proms).then(() => payload); - } - return payload; - }; -}); -function handlePropertyResult(result, final, key, input2, optin, optout) { - const isPresent = key in input2; - const isOptionalOut = optout === "optional"; - if (!isPresent && isOptionalOut && optin === "optional") { - return; - } - if (result.issues.length) { - if (optin !== void 0 && isOptionalOut && !isPresent) { - return; - } - final.issues.push(...prefixIssues(key, result.issues)); - } - if (!isPresent && optin === void 0) { - if (!result.issues.length) { - final.issues.push({ - code: "invalid_type", - expected: "nonoptional", - input: void 0, - path: [key] - }); - } - return; - } - if (result.value === void 0) { - if (isPresent) { - final.value[key] = void 0; - } - } else { - final.value[key] = result.value; - } -} -var NO_SYMBOL_KEYS = []; -function normalizeDef(def) { - const keys = Object.keys(def.shape); - const ownSymbols = Object.getOwnPropertySymbols(def.shape); - const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS; - const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys; - for (const k of allKeys) { - if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) { - throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`); - } - } - const okeys = optionalKeys(def.shape); - return { - ...def, - allKeys, - symbolKeys, - // string-only: handleCatchall matches it against `for...in`, which never yields a symbol - keySet: new Set(keys), - numKeys: keys.length, - optionalKeys: new Set(okeys) - }; -} -function handleCatchall(proms, input2, payload, ctx, def, inst) { - const unrecognized = []; - const keySet = def.keySet; - const _catchall = def.catchall._zod; - const t = _catchall.def.type; - const optin = _catchall.optin; - const optout = _catchall.optout; - for (const key in input2) { - if (keySet.has(key)) - continue; - if (key === "__proto__") { - if (t === "never") - unrecognized.push(key); - continue; - } - if (t === "never") { - unrecognized.push(key); - continue; - } - const r = _catchall.run({ value: input2[key], issues: [] }, ctx); - if (r instanceof Promise) { - proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, optin, optout))); - } else { - handlePropertyResult(r, payload, key, input2, optin, optout); - } - } - if (unrecognized.length) { - payload.issues.push({ - code: "unrecognized_keys", - keys: unrecognized, - input: input2, - inst, - // Describes the shape of the input, not the validity of the parsed value, so it never aborts. The parse still fails; the schema's own checks just get to run first, and an enclosing intersection can reconcile the key against a sibling operand. - continue: true - }); - } - if (!proms.length) - return payload; - return Promise.all(proms).then(() => { - return payload; - }); -} -var propShapes = /* @__PURE__ */ new WeakMap(); -var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => { - $ZodType.init(inst, def); - const desc = Object.getOwnPropertyDescriptor(def, "shape"); - if (!desc?.get) { - const sh = def.shape; - propShapes.set(def, sh); - Object.defineProperty(def, "shape", { - get: () => { - const newSh = { ...sh }; - Object.defineProperty(def, "shape", { - value: newSh - }); - propShapes.set(def, newSh); - return newSh; - } - }); - } - const _normalized = cached(() => normalizeDef(def)); - defineLazyInternal(inst, "propValues", (zod) => { - const shape = zod.def.shape; - const propValues = {}; - for (const key in shape) { - const field = shape[key]._zod; - if (field.values) { - if (!Object.prototype.hasOwnProperty.call(propValues, key)) { - assignProp(propValues, key, /* @__PURE__ */ new Set()); - } - for (const v of field.values) - propValues[key].add(v); - if (field.optin !== void 0) - propValues[key].add(void 0); - } - } - return propValues; - }); - const isObject2 = isObject; - const catchall = def.catchall; - let value; - const memo2 = globalConfig.memoizer; - memo2?.attach(inst); - inst._zod.parse = (payload, ctx) => { - value ?? (value = _normalized.value); - const input2 = payload.value; - if (!isObject2(input2)) { - payload.issues.push({ - expected: "object", - code: "invalid_type", - input: input2, - inst - }); - return payload; - } - payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {}; - const proms = []; - const shape = value.shape; - for (const key of value.allKeys) { - if (key === "__proto__") - continue; - const el = shape[key]; - const optin = el._zod.optin; - const optout = el._zod.optout; - const r = el._zod.run({ value: input2[key], issues: [] }, ctx); - if (r instanceof Promise) { - proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, optin, optout))); - } else { - handlePropertyResult(r, payload, key, input2, optin, optout); - } - } - if (!catchall) { - return proms.length ? Promise.all(proms).then(() => payload) : payload; - } - return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst); - }; -}); -var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => { - $ZodObject.init(inst, def); - const superParse = inst._zod.parse; - const _normalized = cached(() => normalizeDef(def)); - const memo2 = globalConfig.memoizer; - const generateFastpass = (shape) => { - const normalized = _normalized.value; - const syms = normalized.symbolKeys; - const doc = new Doc(["payload", "ctx"], { shape, inst, memo: memo2, syms }); - const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`; - const prefixStr = (id, k) => ` - for (let i = 0; i < ${id}.issues.length; i++) { - const iss = ${id}.issues[i]; - iss.path = iss.path ? [${k}, ...iss.path] : [${k}]; - payload.issues.push(iss); - }`; - doc.write(`const input = payload.value;`); - const ids = /* @__PURE__ */ Object.create(null); - let counter = 0; - for (const key of normalized.allKeys) { - ids[key] = `key_${counter++}`; - } - doc.write(memo2 ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`); - for (const key of normalized.allKeys) { - if (key === "__proto__") - continue; - const id = ids[key]; - const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key); - const isPresent = `${k} in input`; - const schema = shape[key]; - const optin = schema?._zod?.optin; - const isOptionalIn = optin !== void 0; - const isOptionalOut = schema?._zod?.optout === "optional"; - doc.write(`const ${id} = ${parseStr(k)};`); - if (isOptionalIn && isOptionalOut) { - const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`; - doc.write(` - const ${id}_present = ${isPresent}; - if (!${id}.issues.length || ${id}_present) { - if (${id}.issues.length) {${prefixStr(id, k)} - } - - if (${assign}) { - newResult[${k}] = ${id}.value; - } - } - - `); - } else if (!isOptionalIn) { - doc.write(` - const ${id}_present = ${isPresent}; - if (${id}.issues.length) {${prefixStr(id, k)} - } - if (!${id}_present && !${id}.issues.length) { - payload.issues.push({ - code: "invalid_type", - expected: "nonoptional", - input: undefined, - path: [${k}] - }); - } - - if (${id}_present) { - newResult[${k}] = ${id}.value; - } - - `); - } else { - doc.write(` - if (${id}.issues.length) {${prefixStr(id, k)} - } - - if (${id}.value === undefined) { - if (${isPresent}) { - newResult[${k}] = undefined; - } - } else { - newResult[${k}] = ${id}.value; - } - - `); - } - } - doc.write(`payload.value = newResult;`); - doc.write(`return payload;`); - return doc.compile(); - }; - let fastpass; - const isObject2 = isObject; - const jit = !globalConfig.jitless; - const allowsEval2 = allowsEval; - const fastEnabled = jit && allowsEval2.value; - const catchall = def.catchall; - let value; - inst._zod.parse = (payload, ctx) => { - value ?? (value = _normalized.value); - const input2 = payload.value; - if (!isObject2(input2)) { - payload.issues.push({ - expected: "object", - code: "invalid_type", - input: input2, - inst - }); - return payload; - } - if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) { - if (!fastpass) - fastpass = generateFastpass(def.shape); - payload = fastpass(payload, ctx); - if (!catchall) - return payload; - return handleCatchall([], input2, payload, ctx, value, inst); - } - return superParse(payload, ctx); - }; -}); -function handleUnionResults(results, final, inst, ctx) { - for (const result of results) { - if (result.issues.length === 0) { - final.value = result.value; - return final; - } - } - const nonaborted = results.filter((r) => !aborted(r)); - if (nonaborted.length === 1) { - final.value = nonaborted[0].value; - return nonaborted[0]; - } - final.issues.push({ - code: "invalid_union", - input: final.value, - inst, - errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) - }); - return final; -} -var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => { - $ZodType.init(inst, def); - defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted") ? "defaulted" : zod.def.options.some((o) => o._zod.optin !== void 0) ? "optional" : void 0); - defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0); - defineLazyInternal(inst, "values", (zod) => { - if (zod.def.options.every((o) => o._zod.values)) { - return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values))); - } - return void 0; - }); - defineLazyInternal(inst, "pattern", (zod) => { - if (zod.def.options.every((o) => o._zod.pattern)) { - const patterns = zod.def.options.map((o) => o._zod.pattern); - return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`); - } - return void 0; - }); - const first = def.options.length === 1 ? def.options[0]._zod.run : null; - inst._zod.parse = (payload, ctx) => { - if (first) { - return first(payload, ctx); - } - let async = false; - const results = []; - for (const option of def.options) { - const result = option._zod.run({ - value: payload.value, - issues: [] - }, ctx); - if (result instanceof Promise) { - results.push(result); - async = true; - } else { - if (result.issues.length === 0) - return result; - results.push(result); - } - } - if (!async) - return handleUnionResults(results, payload, inst, ctx); - return Promise.all(results).then((results2) => { - return handleUnionResults(results2, payload, inst, ctx); - }); - }; -}); -function handleExclusiveUnionResults(results, final, inst, ctx) { - const matches = []; - for (let i = 0; i < results.length; i++) { - if (results[i].issues.length === 0) - matches.push(i); - } - if (matches.length === 1) { - final.value = results[matches[0]].value; - return final; - } - if (matches.length === 0) { - final.issues.push({ - code: "invalid_union", - input: final.value, - inst, - errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config()))) - }); - } else { - final.issues.push({ - code: "invalid_union", - input: final.value, - inst, - errors: [], - inclusive: false, - matches - }); - } - return final; -} -var $ZodXor = /* @__PURE__ */ $constructor("$ZodXor", (inst, def) => { - $ZodUnion.init(inst, def); - def.inclusive = false; - const first = def.options.length === 1 ? def.options[0]._zod.run : null; - inst._zod.parse = (payload, ctx) => { - if (first) { - return first(payload, ctx); - } - let async = false; - const results = []; - for (const option of def.options) { - const result = option._zod.run({ - value: payload.value, - issues: [] - }, ctx); - if (result instanceof Promise) { - results.push(result); - async = true; - } else { - results.push(result); - } - } - if (!async) - return handleExclusiveUnionResults(results, payload, inst, ctx); - return Promise.all(results).then((results2) => { - return handleExclusiveUnionResults(results2, payload, inst, ctx); - }); - }; -}); -function getDiscriminatedOption(union2, value) { - const internals = union2._zod; - let map2 = internals.bag.optionsMap; - if (!map2) { - map2 = /* @__PURE__ */ new Map(); - const { options, discriminator } = internals.def; - for (const option of options) { - for (const v of option._zod.propValues?.[discriminator] ?? []) - if (!map2.has(v)) - map2.set(v, option); - } - internals.bag.optionsMap = map2; - } - return map2.get(value); -} -var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => { - def.inclusive = false; - $ZodUnion.init(inst, def); - const _super = inst._zod.parse; - defineLazyInternal(inst, "propValues", (zod) => { - const propValues = {}; - for (const option of zod.def.options) { - const pv = option._zod.propValues; - if (!pv || Object.keys(pv).length === 0) - throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`); - for (const [k, v] of Object.entries(pv)) { - if (!Object.prototype.hasOwnProperty.call(propValues, k)) { - assignProp(propValues, k, /* @__PURE__ */ new Set()); - } - for (const val of v) { - propValues[k].add(val); - } - } - } - return propValues; - }); - def.options.forEach((option, i) => { - const propShape = propShapes.get(option._zod.def); - if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) { - throw new Error(`Invalid discriminated union option at index "${i}"`); - } - }); - const disc = cached(() => { - const opts = def.options; - const map2 = /* @__PURE__ */ new Map(); - for (const o of opts) { - const values = o._zod.propValues?.[def.discriminator]; - if (!values || values.size === 0) - throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`); - for (const v of values) { - if (map2.has(v)) { - throw new Error(`Duplicate discriminator value "${String(v)}"`); - } - map2.set(v, o); - } - } - return map2; - }); - inst._zod.parse = (payload, ctx) => { - const input2 = payload.value; - if (!isObject(input2)) { - payload.issues.push({ - code: "invalid_type", - expected: "object", - input: input2, - inst - }); - return payload; - } - const opt = disc.value.get(input2?.[def.discriminator]); - if (opt) { - return opt._zod.run(payload, ctx); - } - if (def.unionFallback || ctx.direction === "backward") { - return _super(payload, ctx); - } - payload.issues.push({ - code: "invalid_union", - errors: [], - note: "No matching discriminator", - discriminator: def.discriminator, - options: Array.from(disc.value.keys()), - input: input2, - path: [def.discriminator], - inst - }); - return payload; - }; -}); -var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.parse = (payload, ctx) => { - const input2 = payload.value; - const left = def.left._zod.run({ value: input2, issues: [] }, ctx); - const right = def.right._zod.run({ value: input2, issues: [] }, ctx); - const async = left instanceof Promise || right instanceof Promise; - if (async) { - return Promise.all([left, right]).then(([left2, right2]) => { - return handleIntersectionResults(payload, left2, right2); - }); - } - return handleIntersectionResults(payload, left, right); - }; -}); -function mergeValues2(a, b) { - if (a === b) { - return { valid: true, data: a }; - } - if (a instanceof Date && b instanceof Date && +a === +b) { - return { valid: true, data: a }; - } - if (isPlainObject(a) && isPlainObject(b)) { - const bKeys = Object.keys(b); - const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1); - const newObj = { ...a, ...b }; - if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) - delete newObj.__proto__; - for (const key of sharedKeys) { - if (key === "__proto__") - continue; - const sharedValue = mergeValues2(a[key], b[key]); - if (!sharedValue.valid) { - return { - valid: false, - mergeErrorPath: [key, ...sharedValue.mergeErrorPath] - }; - } - newObj[key] = sharedValue.data; - } - return { valid: true, data: newObj }; - } - if (Array.isArray(a) && Array.isArray(b)) { - if (a.length !== b.length) { - return { valid: false, mergeErrorPath: [] }; - } - const newArray = []; - for (let index = 0; index < a.length; index++) { - const itemA = a[index]; - const itemB = b[index]; - const sharedValue = mergeValues2(itemA, itemB); - if (!sharedValue.valid) { - return { - valid: false, - mergeErrorPath: [index, ...sharedValue.mergeErrorPath] - }; - } - newArray.push(sharedValue.data); - } - return { valid: true, data: newArray }; - } - return { valid: false, mergeErrorPath: [] }; -} -function handleIntersectionResults(result, left, right) { - const unrecKeys = /* @__PURE__ */ new Map(); - let unrecIssue; - const keyIssues = /* @__PURE__ */ new Map(); - const collect = (iss, side) => { - let keys; - if (iss.code === "unrecognized_keys" && !iss.path?.length) { - unrecIssue ?? (unrecIssue = iss); - keys = iss.keys; - } else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) { - const k = String(iss.path[0]); - if (!keyIssues.has(k)) - keyIssues.set(k, iss); - keys = [k]; - } else { - return false; - } - for (const k of keys) { - if (!unrecKeys.has(k)) - unrecKeys.set(k, {}); - unrecKeys.get(k)[side] = true; - } - return true; - }; - for (const iss of left.issues) { - if (!collect(iss, "l")) - result.issues.push(iss); - } - for (const iss of right.issues) { - if (!collect(iss, "r")) - result.issues.push(iss); - } - const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k); - if (bothKeys.length) { - const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : []; - if (aggregated.length) - result.issues.push({ ...unrecIssue, keys: aggregated }); - for (const k of bothKeys) { - if (!aggregated.includes(k) && keyIssues.has(k)) - result.issues.push(keyIssues.get(k)); - } - } - const merged = mergeValues2(left.value, right.value); - if (!merged.valid) { - if (aborted(result)) - return result; - throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`); - } - result.value = merged.data; - return result; -} -var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => { - $ZodType.init(inst, def); - const items = def.items; - const memo2 = globalConfig.memoizer; - memo2?.attach(inst); - inst._zod.parse = (payload, ctx) => { - const input2 = payload.value; - if (!Array.isArray(input2)) { - payload.issues.push({ - input: input2, - inst, - expected: "tuple", - code: "invalid_type" - }); - return payload; - } - payload.value = memo2 ? memo2.alloc(inst, payload, [], ctx) : []; - const proms = []; - const optinStart = getTupleOptStart(items, "optin"); - const optoutStart = getTupleOptStart(items, "optout"); - if (!def.rest) { - if (input2.length < optinStart) { - payload.issues.push({ - code: "too_small", - minimum: optinStart, - inclusive: true, - input: input2, - inst, - origin: "array" - }); - return payload; - } - if (input2.length > items.length) { - payload.issues.push({ - code: "too_big", - maximum: items.length, - inclusive: true, - input: input2, - inst, - origin: "array" - }); - } - } - const itemResults = new Array(items.length); - for (let i = 0; i < items.length; i++) { - const r = items[i]._zod.run({ value: input2[i], issues: [] }, ctx); - if (r instanceof Promise) { - proms.push(r.then((rr) => { - itemResults[i] = rr; - })); - } else { - itemResults[i] = r; - } - } - if (def.rest) { - let i = items.length - 1; - const rest = input2.slice(items.length); - for (const el of rest) { - i++; - const result = def.rest._zod.run({ value: el, issues: [] }, ctx); - if (result instanceof Promise) { - proms.push(result.then((r) => handleTupleResult(r, payload, i))); - } else { - handleTupleResult(result, payload, i); - } - } - } - if (proms.length) { - return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input2, optoutStart)); - } - return handleTupleResults(itemResults, payload, items, input2, optoutStart); - }; -}); -function getTupleOptStart(items, key) { - for (let i = items.length - 1; i >= 0; i--) { - const omittable = key === "optin" ? items[i]._zod.optin !== void 0 : items[i]._zod.optout === "optional"; - if (!omittable) - return i + 1; - } - return 0; -} -function handleTupleResult(result, final, index) { - if (result.issues.length) { - final.issues.push(...prefixIssues(index, result.issues)); - } - final.value[index] = result.value; -} -function handleTupleResults(itemResults, final, items, input2, optoutStart) { - for (let i = 0; i < items.length; i++) { - const r = itemResults[i]; - const isPresent = i < input2.length; - if (!isPresent && i >= optoutStart && items[i]._zod.optin === "optional") { - final.value.length = i; - break; - } - if (r.issues.length) { - if (!isPresent && i >= optoutStart) { - final.value.length = i; - break; - } - final.issues.push(...prefixIssues(i, r.issues)); - } - final.value[i] = r.value; - } - for (let i = final.value.length - 1; i >= input2.length; i--) { - if (items[i]._zod.optout === "optional" && final.value[i] === void 0) { - final.value.length = i; - } else { - break; - } - } - return final; -} -var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => { - $ZodType.init(inst, def); - const memo2 = globalConfig.memoizer; - memo2?.attach(inst); - inst._zod.parse = (payload, ctx) => { - const input2 = payload.value; - if (!isPlainObject(input2)) { - payload.issues.push({ - expected: "record", - code: "invalid_type", - input: input2, - inst - }); - return payload; - } - const proms = []; - const values = def.keyType._zod.values; - if (values && !def.partial) { - payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {}; - const recordKeys = /* @__PURE__ */ new Set(); - for (const key of values) { - if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") { - recordKeys.add(typeof key === "number" ? key.toString() : key); - if (key === "__proto__") - continue; - const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx); - if (keyResult instanceof Promise) { - throw new Error("Async schemas not supported in object keys currently"); - } - if (keyResult.issues.length) { - payload.issues.push({ - code: "invalid_key", - origin: "record", - issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())), - input: key, - path: [key], - inst - }); - continue; - } - const outKey = keyResult.value; - if (outKey === "__proto__") - continue; - const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx); - if (result instanceof Promise) { - proms.push(result.then((result2) => { - if (result2.issues.length) { - payload.issues.push(...prefixIssues(key, result2.issues)); - } - payload.value[outKey] = result2.value; - })); - } else { - if (result.issues.length) { - payload.issues.push(...prefixIssues(key, result.issues)); - } - payload.value[outKey] = result.value; - } - } - } - let unrecognized; - for (const key in input2) { - if (!recordKeys.has(key)) { - if (def.mode === "loose") { - if (key === "__proto__") - continue; - payload.value[key] = input2[key]; - } else { - unrecognized = unrecognized ?? []; - unrecognized.push(key); - } - } - } - if (unrecognized && unrecognized.length > 0) { - payload.issues.push({ - code: "unrecognized_keys", - input: input2, - inst, - keys: unrecognized, - continue: true - }); - } - } else { - payload.value = memo2 ? memo2.alloc(inst, payload, {}, ctx) : {}; - let unrecognized; - for (const key of Reflect.ownKeys(input2)) { - if (key === "__proto__") - continue; - if (!Object.prototype.propertyIsEnumerable.call(input2, key)) - continue; - let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx); - if (keyResult instanceof Promise) { - throw new Error("Async schemas not supported in object keys currently"); - } - const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length; - if (checkNumericKey) { - const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx); - if (retryResult instanceof Promise) { - throw new Error("Async schemas not supported in object keys currently"); - } - if (retryResult.issues.length === 0) { - keyResult = retryResult; - } - } - if (keyResult.issues.length) { - if (def.mode === "loose") { - payload.value[key] = input2[key]; - } else if (values) { - unrecognized = unrecognized ?? []; - unrecognized.push(key); - } else { - payload.issues.push({ - code: "invalid_key", - origin: "record", - issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())), - input: key, - path: [key], - inst - }); - } - continue; - } - const outKey = keyResult.value; - if (outKey === "__proto__") - continue; - const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx); - if (result instanceof Promise) { - proms.push(result.then((result2) => { - if (result2.issues.length) { - payload.issues.push(...prefixIssues(key, result2.issues)); - } - payload.value[outKey] = result2.value; - })); - } else { - if (result.issues.length) { - payload.issues.push(...prefixIssues(key, result.issues)); - } - payload.value[outKey] = result.value; - } - } - if (unrecognized && unrecognized.length > 0) { - payload.issues.push({ - code: "unrecognized_keys", - input: input2, - inst, - keys: unrecognized, - continue: true - }); - } - } - if (proms.length) { - return Promise.all(proms).then(() => payload); - } - return payload; - }; -}); -var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => { - $ZodType.init(inst, def); - const memo2 = globalConfig.memoizer; - memo2?.attach(inst); - inst._zod.parse = (payload, ctx) => { - const input2 = payload.value; - if (!(input2 instanceof Map)) { - payload.issues.push({ - expected: "map", - code: "invalid_type", - input: input2, - inst - }); - return payload; - } - const proms = []; - payload.value = memo2 ? memo2.alloc(inst, payload, /* @__PURE__ */ new Map(), ctx) : /* @__PURE__ */ new Map(); - for (const [key, value] of input2) { - const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx); - const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx); - if (keyResult instanceof Promise || valueResult instanceof Promise) { - proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => { - handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx); - })); - } else { - handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx); - } - } - if (proms.length) - return Promise.all(proms).then(() => payload); - return payload; - }; -}); -function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) { - if (keyResult.issues.length) { - if (propertyKeyTypes.has(typeof key)) { - final.issues.push(...prefixIssues(key, keyResult.issues)); - } else { - final.issues.push({ - code: "invalid_key", - origin: "map", - input: input2, - inst, - issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())) - }); - } - } - if (valueResult.issues.length) { - if (propertyKeyTypes.has(typeof key)) { - final.issues.push(...prefixIssues(key, valueResult.issues)); - } else { - final.issues.push({ - origin: "map", - code: "invalid_element", - input: input2, - inst, - key, - issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config())) - }); - } - } - final.value.set(keyResult.value, valueResult.value); -} -var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => { - $ZodType.init(inst, def); - const memo2 = globalConfig.memoizer; - memo2?.attach(inst); - inst._zod.parse = (payload, ctx) => { - const input2 = payload.value; - if (!(input2 instanceof Set)) { - payload.issues.push({ - input: input2, - inst, - expected: "set", - code: "invalid_type" - }); - return payload; - } - const proms = []; - payload.value = memo2 ? memo2.alloc(inst, payload, /* @__PURE__ */ new Set(), ctx) : /* @__PURE__ */ new Set(); - for (const item of input2) { - const result = def.valueType._zod.run({ value: item, issues: [] }, ctx); - if (result instanceof Promise) { - proms.push(result.then((result2) => handleSetResult(result2, payload))); - } else - handleSetResult(result, payload); - } - if (proms.length) - return Promise.all(proms).then(() => payload); - return payload; - }; -}); -function handleSetResult(result, final) { - if (result.issues.length) { - final.issues.push(...result.issues); - } - final.value.add(result.value); -} -var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => { - $ZodType.init(inst, def); - const values = getEnumValues(def.entries); - const valuesSet = new Set(values); - inst._zod.values = valuesSet; - const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k)); - inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$"); - inst._zod.parse = (payload, _ctx) => { - const input2 = payload.value; - if (valuesSet.has(input2)) { - return payload; - } - payload.issues.push({ - code: "invalid_value", - values, - input: input2, - inst - }); - return payload; - }; -}); -var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => { - $ZodType.init(inst, def); - const values = new Set(def.values); - inst._zod.values = values; - inst._zod.pattern = new RegExp(def.values.length ? `^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$"); - inst._zod.parse = (payload, _ctx) => { - const input2 = payload.value; - if (values.has(input2)) { - return payload; - } - payload.issues.push({ - code: "invalid_value", - values: def.values, - input: input2, - inst - }); - return payload; - }; -}); -var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.parse = (payload, _ctx) => { - const input2 = payload.value; - if (input2 instanceof File) - return payload; - payload.issues.push({ - expected: "file", - code: "invalid_type", - input: input2, - inst - }); - return payload; - }; -}); -var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.optin = "optional"; - globalConfig.memoizer?.guard(inst); - inst._zod.parse = (payload, ctx) => { - if (ctx.direction === "backward") { - throw new $ZodEncodeError(inst.constructor.name); - } - const _out = def.transform(payload.value, payload); - if (ctx.async) { - const output2 = _out instanceof Promise ? _out : Promise.resolve(_out); - return output2.then((output3) => { - payload.value = output3; - return payload; - }); - } - if (_out instanceof Promise) { - throw new $ZodAsyncError(); - } - payload.value = _out; - return payload; - }; -}); -function handleOptionalResult(payload, result) { - payload.value = result.issues.length ? void 0 : result.value; - return payload; -} -var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => { - $ZodType.init(inst, def); - defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional"); - inst._zod.optout = "optional"; - defineLazyInternal(inst, "values", (zod) => { - const values = zod.def.innerType._zod.values; - return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0; - }); - defineLazyInternal(inst, "pattern", (zod) => { - const pattern = zod.def.innerType._zod.pattern; - return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0; - }); - inst._zod.parse = (payload, ctx) => { - if (payload.value === void 0) { - if (def.innerType._zod.optin !== "defaulted") - return payload; - const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx); - if (result instanceof Promise) - return result.then((result2) => handleOptionalResult(payload, result2)); - return handleOptionalResult(payload, result); - } - return def.innerType._zod.run(payload, ctx); - }; -}); -var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => { - $ZodOptional.init(inst, def); - defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); - defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern); - inst._zod.parse = (payload, ctx) => { - return def.innerType._zod.run(payload, ctx); - }; -}); -var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => { - $ZodType.init(inst, def); - defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin); - defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout); - defineLazyInternal(inst, "pattern", (zod) => { - const pattern = zod.def.innerType._zod.pattern; - return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0; - }); - defineLazyInternal(inst, "values", (zod) => { - return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0; - }); - inst._zod.parse = (payload, ctx) => { - if (payload.value === null) - return payload; - return def.innerType._zod.run(payload, ctx); - }; -}); -var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.optin = "defaulted"; - defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); - inst._zod.parse = (payload, ctx) => { - if (ctx.direction === "backward") { - return def.innerType._zod.run(payload, ctx); - } - if (payload.value === void 0) { - payload.value = def.defaultValue; - return payload; - } - const result = def.innerType._zod.run(payload, ctx); - if (result instanceof Promise) { - return result.then((result2) => handleDefaultResult(result2, def)); - } - return handleDefaultResult(result, def); - }; -}); -function handleDefaultResult(payload, def) { - if (payload.value === void 0) { - payload.value = def.defaultValue; - } - return payload; -} -var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.optin = "defaulted"; - defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); - inst._zod.parse = (payload, ctx) => { - if (ctx.direction === "backward") { - return def.innerType._zod.run(payload, ctx); - } - if (payload.value === void 0) { - payload.value = def.defaultValue; - } - return def.innerType._zod.run(payload, ctx); - }; -}); -var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => { - $ZodType.init(inst, def); - defineLazyInternal(inst, "values", (zod) => { - const v = zod.def.innerType._zod.values; - return v ? new Set([...v].filter((x) => x !== void 0)) : void 0; - }); - inst._zod.parse = (payload, ctx) => { - const result = def.innerType._zod.run(payload, ctx); - if (result instanceof Promise) { - return result.then((result2) => handleNonOptionalResult(result2, inst)); - } - return handleNonOptionalResult(result, inst); - }; -}); -function handleNonOptionalResult(payload, inst) { - if (!payload.issues.length && payload.value === void 0) { - payload.issues.push({ - code: "invalid_type", - expected: "nonoptional", - input: payload.value, - inst - }); - } - return payload; -} -var $ZodSuccess = /* @__PURE__ */ $constructor("$ZodSuccess", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.parse = (payload, ctx) => { - if (ctx.direction === "backward") { - throw new $ZodEncodeError("ZodSuccess"); - } - const result = def.innerType._zod.run(payload, ctx); - if (result instanceof Promise) { - return result.then((result2) => { - payload.value = result2.issues.length === 0; - return payload; - }); - } - payload.value = result.issues.length === 0; - return payload; - }; -}); -function handleCatchResult(payload, result, def, ctx) { - if (!result.issues.length) { - payload.value = result.value; - if (result.memo) - payload.memo = true; - return payload; - } - payload.value = def.catchValue({ - ...result, - value: payload.value, - error: { - issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) - }, - input: payload.value - }); - return payload; -} -var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => { - $ZodType.init(inst, def); - defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional"); - defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout); - defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); - inst._zod.parse = (payload, ctx) => { - if (ctx.direction === "backward") { - return def.innerType._zod.run(payload, ctx); - } - const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx); - if (result instanceof Promise) { - return result.then((result2) => handleCatchResult(payload, result2, def, ctx)); - } - return handleCatchResult(payload, result, def, ctx); - }; -}); -var $ZodNaN = /* @__PURE__ */ $constructor("$ZodNaN", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.parse = (payload, _ctx) => { - if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) { - payload.issues.push({ - input: payload.value, - inst, - expected: "nan", - code: "invalid_type" - }); - return payload; - } - return payload; - }; -}); -var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => { - $ZodType.init(inst, def); - defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values); - defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin); - defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout); - defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues); - inst._zod.parse = (payload, ctx) => { - if (ctx.direction === "backward") { - const right = def.out._zod.run(payload, ctx); - if (right instanceof Promise) { - return right.then((right2) => handlePipeResult(right2, def.in, ctx)); - } - return handlePipeResult(right, def.in, ctx); - } - const left = def.in._zod.run(payload, ctx); - if (left instanceof Promise) { - return left.then((left2) => handlePipeResult(left2, def.out, ctx)); - } - return handlePipeResult(left, def.out, ctx); - }; -}); -function handlePipeResult(left, next, ctx) { - if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) { - left.aborted = true; - return left; - } - return next._zod.run({ value: left.value, issues: left.issues }, ctx); -} -var $ZodCodec = /* @__PURE__ */ $constructor("$ZodCodec", (inst, def) => { - $ZodType.init(inst, def); - defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values); - defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin); - defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout); - defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues); - inst._zod.parse = (payload, ctx) => { - const direction = ctx.direction || "forward"; - if (direction === "forward") { - const left = def.in._zod.run(payload, ctx); - if (left instanceof Promise) { - return left.then((left2) => handleCodecAResult(left2, def, ctx)); - } - return handleCodecAResult(left, def, ctx); - } else { - const right = def.out._zod.run(payload, ctx); - if (right instanceof Promise) { - return right.then((right2) => handleCodecAResult(right2, def, ctx)); - } - return handleCodecAResult(right, def, ctx); - } - }; -}); -function handleCodecAResult(result, def, ctx) { - if (result.issues.length) { - result.aborted = true; - return result; - } - const direction = ctx.direction || "forward"; - if (direction === "forward") { - const transformed = def.transform(result.value, result); - if (transformed instanceof Promise) { - return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx)); - } - return handleCodecTxResult(result, transformed, def.out, ctx); - } else { - const transformed = def.reverseTransform(result.value, result); - if (transformed instanceof Promise) { - return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx)); - } - return handleCodecTxResult(result, transformed, def.in, ctx); - } -} -function handleCodecTxResult(left, value, nextSchema, ctx) { - if (left.issues.length) { - left.aborted = true; - return left; - } - return nextSchema._zod.run({ value, issues: left.issues }, ctx); -} -var $ZodPreprocess = /* @__PURE__ */ $constructor("$ZodPreprocess", (inst, def) => { - $ZodPipe.init(inst, def); -}); -var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => { - $ZodType.init(inst, def); - defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues); - defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values); - defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin); - defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout); - inst._zod.parse = (payload, ctx) => { - if (ctx.direction === "backward") { - return def.innerType._zod.run(payload, ctx); - } - const result = def.innerType._zod.run(payload, ctx); - if (result instanceof Promise) { - return result.then(handleReadonlyResult); - } - return handleReadonlyResult(result); - }; -}); -function handleReadonlyResult(payload) { - if (!payload.memo) - payload.value = Object.freeze(payload.value); - return payload; -} -var $ZodTemplateLiteral = /* @__PURE__ */ $constructor("$ZodTemplateLiteral", (inst, def) => { - $ZodType.init(inst, def); - const regexParts = []; - for (const part of def.parts) { - if (typeof part === "object" && part !== null) { - if (!part._zod.pattern) { - throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`); - } - const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern; - if (!source) - throw new Error(`Invalid template literal part: ${part._zod.traits}`); - const start = source.startsWith("^") ? 1 : 0; - const end = source.endsWith("$") ? source.length - 1 : source.length; - regexParts.push(source.slice(start, end)); - } else if (part === null || primitiveTypes.has(typeof part)) { - regexParts.push(escapeRegex(`${part}`)); - } else { - throw new Error(`Invalid template literal part: ${part}`); - } - } - inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`); - inst._zod.parse = (payload, _ctx) => { - if (typeof payload.value !== "string") { - payload.issues.push({ - input: payload.value, - inst, - expected: "string", - code: "invalid_type" - }); - return payload; - } - inst._zod.pattern.lastIndex = 0; - if (!inst._zod.pattern.test(payload.value)) { - payload.issues.push({ - input: payload.value, - inst, - code: "invalid_format", - format: def.format ?? "template_literal", - pattern: inst._zod.pattern.source - }); - return payload; - } - return payload; - }; -}); -var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => { - $ZodType.init(inst, def); - Object.defineProperty(inst, "_def", { value: def }); - inst._zod.def = def; - inst.implement = (func) => { - if (typeof func !== "function") { - throw new Error("implement() must be called with a function"); - } - return Object.defineProperty(function(...args) { - const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args; - const result = Reflect.apply(func, this, parsedArgs); - if (inst._def.output) { - return parse(inst._def.output, result); - } - return result; - }, "_zod", { value: inst._zod, enumerable: false }); - }; - inst.implementAsync = (func) => { - if (typeof func !== "function") { - throw new Error("implementAsync() must be called with a function"); - } - return Object.defineProperty(async function(...args) { - const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args; - const result = await Reflect.apply(func, this, parsedArgs); - if (inst._def.output) { - return await parseAsync(inst._def.output, result); - } - return result; - }, "_zod", { value: inst._zod, enumerable: false }); - }; - inst._zod.parse = (payload, _ctx) => { - if (typeof payload.value !== "function") { - payload.issues.push({ - code: "invalid_type", - expected: "function", - input: payload.value, - inst - }); - return payload; - } - const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === "promise"; - if (hasPromiseOutput) { - payload.value = inst.implementAsync(payload.value); - } else { - payload.value = inst.implement(payload.value); - } - return payload; - }; - inst.input = (...args) => { - const F = inst.constructor; - if (Array.isArray(args[0])) { - return new F({ - type: "function", - input: new $ZodTuple({ - type: "tuple", - items: args[0], - rest: args[1] - }), - output: inst._def.output - }); - } - return new F({ - type: "function", - input: args[0], - output: inst._def.output - }); - }; - inst.output = (output2) => { - const F = inst.constructor; - return new F({ - type: "function", - input: inst._def.input, - output: output2 - }); - }; - return inst; -}); -var $ZodPromise = /* @__PURE__ */ $constructor("$ZodPromise", (inst, def) => { - $ZodType.init(inst, def); - inst._zod.parse = (payload, ctx) => { - return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx)); - }; -}); -var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => { - $ZodType.init(inst, def); - defineLazy(inst._zod, "innerType", () => { - const d = def; - if (!d._cachedInner) - d._cachedInner = def.getter(); - return d._cachedInner; - }); - defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern); - defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues); - defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? void 0); - defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? void 0); - inst._zod.parse = (payload, ctx) => { - const inner = inst._zod.innerType; - return inner._zod.run(payload, ctx); - }; -}); -var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => { - $ZodCheck.init(inst, def); - $ZodType.init(inst, def); - inst._zod.parse = (payload, _) => { - return payload; - }; - inst._zod.check = (payload) => { - const input2 = payload.value; - const r = def.fn(input2); - if (r instanceof Promise) { - return r.then((r2) => handleRefineResult(r2, payload, input2, inst)); - } - handleRefineResult(r, payload, input2, inst); - return; - }; -}); -function handleRefineResult(result, payload, input2, inst) { - if (!result) { - const _iss = { - code: "custom", - input: input2, - inst, - // incorporates params.error into issue reporting - path: [...inst._zod.def.path ?? []], - // incorporates params.error into issue reporting - continue: !inst._zod.def.abort - // params: inst._zod.def.params, - }; - if (inst._zod.def.params) - _iss.params = inst._zod.def.params; - payload.issues.push(issue(_iss)); - } -} - -// node_modules/zod/v4/core/memoizer.js -var $ZodCyclicError = class extends Error { - constructor() { - super(`Cannot parse a reference cycle that closes through a transform`); - this.name = "ZodCyclicError"; - } -}; -var STATE = "~memo"; -var NO_ISSUES = []; -function cloneIssues(issues) { - return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss }); -} -var recursive = /* @__PURE__ */ new WeakMap(); -function isRecursive(inst, stack) { - const cached2 = recursive.get(inst); - if (cached2 !== void 0) - return cached2; - if (stack.has(inst)) - return true; - stack.add(inst); - let result = false; - const check2 = (child) => { - if (!result && child?._zod && isRecursive(child, stack)) - result = true; - }; - const def = inst._zod.def; - const kind = def.type; - switch (kind) { - case "object": { - for (const key of Reflect.ownKeys(def.shape)) - check2(def.shape[key]); - check2(def.catchall); - break; - } - case "array": - check2(def.element); - break; - case "tuple": - for (const el of def.items) - check2(el); - check2(def.rest); - break; - case "record": - case "map": - check2(def.keyType); - check2(def.valueType); - break; - case "set": - check2(def.valueType); - break; - case "union": - for (const el of def.options) - check2(el); - break; - case "intersection": - check2(def.left); - check2(def.right); - break; - case "optional": - case "nullable": - case "default": - case "prefault": - case "catch": - case "readonly": - case "nonoptional": - case "promise": - case "success": - check2(def.innerType); - break; - case "pipe": - check2(def.in); - check2(def.out); - break; - case "function": - check2(def.input); - check2(def.output); - break; - // reading `_zod.innerType` resolves the getter once and caches it - case "lazy": - check2(inst._zod.innerType); - break; - // a leaf by choice: `parts` are regex fragments, not data positions - case "template_literal": - // leaves - case "string": - case "number": - case "int": - case "boolean": - case "bigint": - case "symbol": - case "undefined": - case "null": - case "void": - case "never": - case "any": - case "unknown": - case "date": - case "nan": - case "enum": - case "literal": - case "file": - case "transform": - case "custom": - break; - default: { - kind; - for (const key in def) { - const desc = Object.getOwnPropertyDescriptor(def, key); - if (!desc || desc.get) - continue; - const value = desc.value; - if (!value || typeof value !== "object") - continue; - if (value._zod) - check2(value); - else if (Array.isArray(value)) - for (const el of value) - check2(el); - } - } - } - stack.delete(inst); - recursive.set(inst, result); - return result; -} -function isRecursiveSchema(inst) { - return isRecursive(inst, /* @__PURE__ */ new Set()); -} -function bucketFor(state, inst) { - let bucket = state.buckets.get(inst); - if (!bucket) { - bucket = /* @__PURE__ */ new Map(); - state.buckets.set(inst, bucket); - } - return bucket; -} -var handoff; -var open = []; -var memo = { - alloc(_inst, payload, empty) { - const bucket = handoff; - if (!bucket) - return empty; - handoff = void 0; - const entry = { value: empty, issues: null }; - bucket.set(payload.value, entry); - open.push(entry); - return empty; - }, - guard(inst) { - var _a3; - (_a3 = inst._zod).deferred ?? (_a3.deferred = []); - inst._zod.deferred.push(() => { - const base = inst._zod.parse; - const wrapped = (payload, ctx) => { - if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) - throw new $ZodCyclicError(); - return base(payload, ctx); - }; - inst._zod.parse = wrapped; - if (inst._zod.run === base) - inst._zod.run = wrapped; - }); - }, - attach(inst) { - var _a3; - let isRecursiveInst; - let lastCtx; - let lastBucket; - (_a3 = inst._zod).deferred ?? (_a3.deferred = []); - inst._zod.deferred.push(() => { - const base = inst._zod.parse; - const wrapped = (payload, ctx) => { - if (isRecursiveInst === void 0) { - isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set()); - if (!isRecursiveInst) { - inst._zod.parse = base; - if (inst._zod.run === wrapped) - inst._zod.run = base; - return base(payload, ctx); - } - } - const input2 = payload.value; - if (input2 === null || typeof input2 !== "object") - return base(payload, ctx); - let state = ctx[STATE]; - if (!state) { - state = { buckets: /* @__PURE__ */ new Map(), backEdges: void 0 }; - ctx[STATE] = state; - } - let bucket; - if (lastCtx === ctx) { - bucket = lastBucket; - } else { - bucket = bucketFor(state, inst); - lastCtx = ctx; - lastBucket = bucket; - } - const hit = bucket.get(input2); - if (hit) { - payload.value = hit.value; - if (hit.issues) { - if (hit.issues.length) - payload.issues.push(...cloneIssues(hit.issues)); - } else { - payload.memo = true; - state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set()); - state.backEdges.add(hit.value); - } - return payload; - } - handoff = bucket; - const depth = open.length; - const result = base(payload, ctx); - handoff = void 0; - const entry = open.length > depth ? open.pop() : void 0; - if (result instanceof Promise) { - return result.then((r) => { - if (entry) - entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES; - return r; - }); - } - if (entry) - entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES; - return result; - }; - inst._zod.parse = wrapped; - if (inst._zod.run === base) - inst._zod.run = wrapped; - }); - } -}; -function memoizer() { - return memo; -} -function isBackEdge(ctx, value) { - const backEdges = ctx[STATE]?.backEdges; - return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value); -} - -// node_modules/zod/v4/locales/index.js -var locales_exports = {}; -__export(locales_exports, { - ar: () => ar_default, - az: () => az_default, - be: () => be_default, - bg: () => bg_default, - bn: () => bn_default, - ca: () => ca_default, - ckb: () => ckb_default, - cs: () => cs_default, - da: () => da_default, - de: () => de_default, - el: () => el_default, - en: () => en_default2, - eo: () => eo_default, - es: () => es_default, - fa: () => fa_default, - fi: () => fi_default, - fr: () => fr_default, - frCA: () => fr_CA_default, - gu: () => gu_default, - he: () => he_default, - hi: () => hi_default, - hr: () => hr_default, - hu: () => hu_default, - hy: () => hy_default, - id: () => id_default, - is: () => is_default, - it: () => it_default, - ja: () => ja_default, - ka: () => ka_default, - kh: () => kh_default, - km: () => km_default, - kn: () => kn_default, - ko: () => ko_default, - lt: () => lt_default, - mk: () => mk_default, - ms: () => ms_default, - ne: () => ne_default, - nl: () => nl_default, - nn: () => nn_default, - no: () => no_default, - ota: () => ota_default, - pl: () => pl_default, - ps: () => ps_default, - pt: () => pt_default, - ptBR: () => pt_BR_default, - ro: () => ro_default, - ru: () => ru_default, - sk: () => sk_default, - sl: () => sl_default, - sv: () => sv_default, - ta: () => ta_default, - th: () => th_default, - tk: () => tk_default, - tr: () => tr_default, - ua: () => ua_default, - uk: () => uk_default, - ur: () => ur_default, - uz: () => uz_default, - vi: () => vi_default, - yo: () => yo_default, - zhCN: () => zh_CN_default, - zhTW: () => zh_TW_default -}); - -// node_modules/zod/v4/locales/ar.js -var error = () => { - const Sizable = { - string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }, - file: { unit: "\u0628\u0627\u064A\u062A", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }, - array: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }, - set: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" }, - map: { unit: "\u0639\u0646\u0635\u0631", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0645\u062F\u062E\u0644", - email: "\u0628\u0631\u064A\u062F \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A", - url: "\u0631\u0627\u0628\u0637", - emoji: "\u0625\u064A\u0645\u0648\u062C\u064A", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "\u062A\u0627\u0631\u064A\u062E \u0648\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO", - date: "\u062A\u0627\u0631\u064A\u062E \u0628\u0645\u0639\u064A\u0627\u0631 ISO", - time: "\u0648\u0642\u062A \u0628\u0645\u0639\u064A\u0627\u0631 ISO", - duration: "\u0645\u062F\u0629 \u0628\u0645\u0639\u064A\u0627\u0631 ISO", - ipv4: "\u0639\u0646\u0648\u0627\u0646 IPv4", - ipv6: "\u0639\u0646\u0648\u0627\u0646 IPv6", - mac: "\u0639\u0646\u0648\u0627\u0646 MAC", - cidrv4: "\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv4", - cidrv6: "\u0645\u062F\u0649 \u0639\u0646\u0627\u0648\u064A\u0646 \u0628\u0635\u064A\u063A\u0629 IPv6", - base64: "\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64-encoded", - base64url: "\u0646\u064E\u0635 \u0628\u062A\u0631\u0645\u064A\u0632 base64url-encoded", - json_string: "\u0646\u064E\u0635 \u0639\u0644\u0649 \u0647\u064A\u0626\u0629 JSON", - e164: "\u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0628\u0645\u0639\u064A\u0627\u0631 E.164", - credit_card: "\u0631\u0642\u0645 \u0628\u0637\u0627\u0642\u0629 \u0627\u0644\u0627\u0626\u062A\u0645\u0627\u0646", - jwt: "JWT", - template_literal: "\u0645\u062F\u062E\u0644" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 instanceof ${issue2.expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${received}`; - } - return `\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${expected}\u060C \u0648\u0644\u0643\u0646 \u062A\u0645 \u0625\u062F\u062E\u0627\u0644 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u0645\u062F\u062E\u0644\u0627\u062A \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629: \u064A\u0641\u062A\u0631\u0636 \u0625\u062F\u062E\u0627\u0644 ${stringifyPrimitive(issue2.values[0])}`; - return `\u0627\u062E\u062A\u064A\u0627\u0631 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062A\u0648\u0642\u0639 \u0627\u0646\u062A\u0642\u0627\u0621 \u0623\u062D\u062F \u0647\u0630\u0647 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A: ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return ` \u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${issue2.origin ?? "\u0627\u0644\u0642\u064A\u0645\u0629"} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "\u0639\u0646\u0635\u0631"}`; - return `\u0623\u0643\u0628\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0623\u0646 \u062A\u0643\u0648\u0646 ${issue2.origin ?? "\u0627\u0644\u0642\u064A\u0645\u0629"} ${adj} ${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${issue2.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${adj} ${issue2.minimum.toString()} ${sizing.unit}`; - } - return `\u0623\u0635\u063A\u0631 \u0645\u0646 \u0627\u0644\u0644\u0627\u0632\u0645: \u064A\u0641\u062A\u0631\u0636 \u0644\u0640 ${issue2.origin} \u0623\u0646 \u064A\u0643\u0648\u0646 ${adj} ${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0628\u062F\u0623 \u0628\u0640 "${issue2.prefix}"`; - if (_issue.format === "ends_with") - return `\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0646\u062A\u0647\u064A \u0628\u0640 "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u062A\u0636\u0645\u0651\u064E\u0646 "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u0646\u064E\u0635 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0637\u0627\u0628\u0642 \u0627\u0644\u0646\u0645\u0637 ${_issue.pattern}`; - return `${FormatDictionary[_issue.format] ?? issue2.format} \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644`; - } - case "not_multiple_of": - return `\u0631\u0642\u0645 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644: \u064A\u062C\u0628 \u0623\u0646 \u064A\u0643\u0648\u0646 \u0645\u0646 \u0645\u0636\u0627\u0639\u0641\u0627\u062A ${issue2.divisor}`; - case "unrecognized_keys": - return `\u0645\u0639\u0631\u0641${issue2.keys.length > 1 ? "\u0627\u062A" : ""} \u063A\u0631\u064A\u0628${issue2.keys.length > 1 ? "\u0629" : ""}: ${joinValues(issue2.keys, "\u060C ")}`; - case "invalid_key": - return `\u0645\u0639\u0631\u0641 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${issue2.origin}`; - case "invalid_union": - return "\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"; - case "invalid_element": - return `\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644 \u0641\u064A ${issue2.origin}`; - default: - return "\u0645\u062F\u062E\u0644 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644"; - } - }; -}; -function ar_default() { - return { - localeError: error() - }; -} - -// node_modules/zod/v4/locales/az.js -var error2 = () => { - const Sizable = { - string: { unit: "simvol", verb: "olmal\u0131d\u0131r" }, - file: { unit: "bayt", verb: "olmal\u0131d\u0131r" }, - array: { unit: "element", verb: "olmal\u0131d\u0131r" }, - set: { unit: "element", verb: "olmal\u0131d\u0131r" }, - map: { unit: "element", verb: "olmal\u0131d\u0131r" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "input", - email: "email address", - url: "URL", - emoji: "emoji", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO datetime", - date: "ISO date", - time: "ISO time", - duration: "ISO duration", - ipv4: "IPv4 address", - ipv6: "IPv6 address", - mac: "MAC address", - cidrv4: "IPv4 range", - cidrv6: "IPv6 range", - base64: "base64-encoded string", - base64url: "base64url-encoded string", - json_string: "JSON string", - e164: "E.164 number", - credit_card: "kredit kart\u0131 n\xF6mr\u0259si", - jwt: "JWT", - template_literal: "input" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n instanceof ${issue2.expected}, daxil olan ${received}`; - } - return `Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${expected}, daxil olan ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Yanl\u0131\u015F d\u0259y\u0259r: g\xF6zl\u0259nil\u0259n ${stringifyPrimitive(issue2.values[0])}`; - return `Yanl\u0131\u015F se\xE7im: a\u015Fa\u011F\u0131dak\u0131lardan biri olmal\u0131d\u0131r: ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${issue2.origin ?? "d\u0259y\u0259r"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element"}`; - return `\xC7ox b\xF6y\xFCk: g\xF6zl\u0259nil\u0259n ${issue2.origin ?? "d\u0259y\u0259r"} ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - return `\xC7ox ki\xE7ik: g\xF6zl\u0259nil\u0259n ${issue2.origin} ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Yanl\u0131\u015F m\u0259tn: "${_issue.prefix}" il\u0259 ba\u015Flamal\u0131d\u0131r`; - if (_issue.format === "ends_with") - return `Yanl\u0131\u015F m\u0259tn: "${_issue.suffix}" il\u0259 bitm\u0259lidir`; - if (_issue.format === "includes") - return `Yanl\u0131\u015F m\u0259tn: "${_issue.includes}" daxil olmal\u0131d\u0131r`; - if (_issue.format === "regex") - return `Yanl\u0131\u015F m\u0259tn: ${_issue.pattern} \u015Fablonuna uy\u011Fun olmal\u0131d\u0131r`; - return `Yanl\u0131\u015F ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Yanl\u0131\u015F \u0259d\u0259d: ${issue2.divisor} il\u0259 b\xF6l\xFCn\u0259 bil\u0259n olmal\u0131d\u0131r`; - case "unrecognized_keys": - return `Tan\u0131nmayan a\xE7ar${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `${issue2.origin} daxilind\u0259 yanl\u0131\u015F a\xE7ar`; - case "invalid_union": - return "Yanl\u0131\u015F d\u0259y\u0259r"; - case "invalid_element": - return `${issue2.origin} daxilind\u0259 yanl\u0131\u015F d\u0259y\u0259r`; - default: - return `Yanl\u0131\u015F d\u0259y\u0259r`; - } - }; -}; -function az_default() { - return { - localeError: error2() - }; -} - -// node_modules/zod/v4/locales/be.js -function getBelarusianPlural(count, one, few, many) { - const absCount = Math.abs(count); - const lastDigit = absCount % 10; - const lastTwoDigits = absCount % 100; - if (lastTwoDigits >= 11 && lastTwoDigits <= 19) { - return many; - } - if (lastDigit === 1) { - return one; - } - if (lastDigit >= 2 && lastDigit <= 4) { - return few; - } - return many; -} -var error3 = () => { - const Sizable = { - string: { - unit: { - one: "\u0441\u0456\u043C\u0432\u0430\u043B", - few: "\u0441\u0456\u043C\u0432\u0430\u043B\u044B", - many: "\u0441\u0456\u043C\u0432\u0430\u043B\u0430\u045E" - }, - verb: "\u043C\u0435\u0446\u044C" - }, - array: { - unit: { - one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442", - few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B", - many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E" - }, - verb: "\u043C\u0435\u0446\u044C" - }, - set: { - unit: { - one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442", - few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B", - many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E" - }, - verb: "\u043C\u0435\u0446\u044C" - }, - map: { - unit: { - one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442", - few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B", - many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430\u045E" - }, - verb: "\u043C\u0435\u0446\u044C" - }, - file: { - unit: { - one: "\u0431\u0430\u0439\u0442", - few: "\u0431\u0430\u0439\u0442\u044B", - many: "\u0431\u0430\u0439\u0442\u0430\u045E" - }, - verb: "\u043C\u0435\u0446\u044C" - } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0443\u0432\u043E\u0434", - email: "email \u0430\u0434\u0440\u0430\u0441", - url: "URL", - emoji: "\u044D\u043C\u043E\u0434\u0437\u0456", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO \u0434\u0430\u0442\u0430 \u0456 \u0447\u0430\u0441", - date: "ISO \u0434\u0430\u0442\u0430", - time: "ISO \u0447\u0430\u0441", - duration: "ISO \u043F\u0440\u0430\u0446\u044F\u0433\u043B\u0430\u0441\u0446\u044C", - ipv4: "IPv4 \u0430\u0434\u0440\u0430\u0441", - ipv6: "IPv6 \u0430\u0434\u0440\u0430\u0441", - mac: "MAC \u0430\u0434\u0440\u0430\u0441", - cidrv4: "IPv4 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D", - cidrv6: "IPv6 \u0434\u044B\u044F\u043F\u0430\u0437\u043E\u043D", - base64: "\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64", - base64url: "\u0440\u0430\u0434\u043E\u043A \u0443 \u0444\u0430\u0440\u043C\u0430\u0446\u0435 base64url", - json_string: "JSON \u0440\u0430\u0434\u043E\u043A", - e164: "\u043D\u0443\u043C\u0430\u0440 E.164", - credit_card: "\u043D\u0443\u043C\u0430\u0440 \u043A\u0440\u044D\u0434\u044B\u0442\u043D\u0430\u0439 \u043A\u0430\u0440\u0442\u044B", - jwt: "JWT", - template_literal: "\u0443\u0432\u043E\u0434" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u043B\u0456\u043A", - array: "\u043C\u0430\u0441\u0456\u045E" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F instanceof ${issue2.expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${received}`; - } - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u045E\u0441\u044F ${expected}, \u0430\u0442\u0440\u044B\u043C\u0430\u043D\u0430 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F ${stringifyPrimitive(issue2.values[0])}`; - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0432\u0430\u0440\u044B\u044F\u043D\u0442: \u0447\u0430\u043A\u0430\u045E\u0441\u044F \u0430\u0434\u0437\u0456\u043D \u0437 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) { - const maxValue = Number(issue2.maximum); - const unit = getBelarusianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many); - return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${sizing.verb} ${adj}${issue2.maximum.toString()} ${unit}`; - } - return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - const minValue = Number(issue2.minimum); - const unit = getBelarusianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many); - return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${sizing.verb} ${adj}${issue2.minimum.toString()} ${unit}`; - } - return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u043F\u0430\u0447\u044B\u043D\u0430\u0446\u0446\u0430 \u0437 "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u0430\u043A\u0430\u043D\u0447\u0432\u0430\u0446\u0446\u0430 \u043D\u0430 "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0437\u043C\u044F\u0448\u0447\u0430\u0446\u044C "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u0440\u0430\u0434\u043E\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0430\u0434\u043F\u0430\u0432\u044F\u0434\u0430\u0446\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${_issue.pattern}`; - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043B\u0456\u043A: \u043F\u0430\u0432\u0456\u043D\u0435\u043D \u0431\u044B\u0446\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${issue2.divisor}`; - case "unrecognized_keys": - return `\u041D\u0435\u0440\u0430\u0441\u043F\u0430\u0437\u043D\u0430\u043D\u044B ${issue2.keys.length > 1 ? "\u043A\u043B\u044E\u0447\u044B" : "\u043A\u043B\u044E\u0447"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u043A\u043B\u044E\u0447 \u0443 ${issue2.origin}`; - case "invalid_union": - return "\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434"; - case "invalid_element": - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u0430\u0435 \u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435 \u045E ${issue2.origin}`; - default: - return `\u041D\u044F\u043F\u0440\u0430\u0432\u0456\u043B\u044C\u043D\u044B \u045E\u0432\u043E\u0434`; - } - }; -}; -function be_default() { - return { - localeError: error3() - }; -} - -// node_modules/zod/v4/locales/bg.js -var error4 = () => { - const Sizable = { - string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" }, - file: { unit: "\u0431\u0430\u0439\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" }, - array: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" }, - set: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" }, - map: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430", verb: "\u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0432\u0445\u043E\u0434", - email: "\u0438\u043C\u0435\u0439\u043B \u0430\u0434\u0440\u0435\u0441", - url: "URL", - emoji: "\u0435\u043C\u043E\u0434\u0436\u0438", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO \u0432\u0440\u0435\u043C\u0435", - date: "ISO \u0434\u0430\u0442\u0430", - time: "ISO \u0432\u0440\u0435\u043C\u0435", - duration: "ISO \u043F\u0440\u043E\u0434\u044A\u043B\u0436\u0438\u0442\u0435\u043B\u043D\u043E\u0441\u0442", - ipv4: "IPv4 \u0430\u0434\u0440\u0435\u0441", - ipv6: "IPv6 \u0430\u0434\u0440\u0435\u0441", - mac: "MAC \u0430\u0434\u0440\u0435\u0441", - cidrv4: "IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D", - cidrv6: "IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D", - base64: "base64-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437", - base64url: "base64url-\u043A\u043E\u0434\u0438\u0440\u0430\u043D \u043D\u0438\u0437", - json_string: "JSON \u043D\u0438\u0437", - e164: "E.164 \u043D\u043E\u043C\u0435\u0440", - credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0430", - jwt: "JWT", - template_literal: "\u0432\u0445\u043E\u0434" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u0447\u0438\u0441\u043B\u043E", - array: "\u043C\u0430\u0441\u0438\u0432" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D instanceof ${issue2.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${received}`; - } - return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434: \u043E\u0447\u0430\u043A\u0432\u0430\u043D ${stringifyPrimitive(issue2.values[0])}`; - return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u043E\u043F\u0446\u0438\u044F: \u043E\u0447\u0430\u043A\u0432\u0430\u043D\u043E \u0435\u0434\u043D\u043E \u043E\u0442 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${issue2.origin ?? "\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0430"}`; - return `\u0422\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${issue2.origin ?? "\u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442"} \u0434\u0430 \u0431\u044A\u0434\u0435 ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${issue2.origin} \u0434\u0430 \u0441\u044A\u0434\u044A\u0440\u0436\u0430 ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `\u0422\u0432\u044A\u0440\u0434\u0435 \u043C\u0430\u043B\u043A\u043E: \u043E\u0447\u0430\u043A\u0432\u0430 \u0441\u0435 ${issue2.origin} \u0434\u0430 \u0431\u044A\u0434\u0435 ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u0432\u0430 \u0441 "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0437\u0430\u0432\u044A\u0440\u0448\u0432\u0430 \u0441 "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0432\u043A\u043B\u044E\u0447\u0432\u0430 "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043D\u0438\u0437: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0441\u044A\u0432\u043F\u0430\u0434\u0430 \u0441 ${_issue.pattern}`; - let invalid_adj = "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D"; - if (_issue.format === "emoji") - invalid_adj = "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"; - if (_issue.format === "datetime") - invalid_adj = "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"; - if (_issue.format === "date") - invalid_adj = "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"; - if (_issue.format === "time") - invalid_adj = "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E"; - if (_issue.format === "duration") - invalid_adj = "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430"; - return `${invalid_adj} ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u043E \u0447\u0438\u0441\u043B\u043E: \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0440\u0430\u0442\u043D\u043E \u043D\u0430 ${issue2.divisor}`; - case "unrecognized_keys": - return `\u041D\u0435\u0440\u0430\u0437\u043F\u043E\u0437\u043D\u0430\u0442${issue2.keys.length > 1 ? "\u0438" : ""} \u043A\u043B\u044E\u0447${issue2.keys.length > 1 ? "\u043E\u0432\u0435" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u043A\u043B\u044E\u0447 \u0432 ${issue2.origin}`; - case "invalid_union": - return "\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434"; - case "invalid_element": - return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u0430 \u0441\u0442\u043E\u0439\u043D\u043E\u0441\u0442 \u0432 ${issue2.origin}`; - default: - return `\u041D\u0435\u0432\u0430\u043B\u0438\u0434\u0435\u043D \u0432\u0445\u043E\u0434`; - } - }; -}; -function bg_default() { - return { - localeError: error4() - }; -} - -// node_modules/zod/v4/locales/bn.js -var error5 = () => { - const Sizable = { - string: { unit: "\u0985\u0995\u09CD\u09B7\u09B0", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" }, - file: { unit: "\u09AC\u09BE\u0987\u099F", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" }, - array: { unit: "\u0986\u0987\u099F\u09C7\u09AE", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" }, - set: { unit: "\u0986\u0987\u099F\u09C7\u09AE", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" }, - map: { unit: "\u098F\u09A8\u09CD\u099F\u09CD\u09B0\u09BF", verb: "\u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0987\u09A8\u09AA\u09C1\u099F", - email: "\u0987\u09AE\u09C7\u0987\u09B2 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE", - url: "URL", - emoji: "\u0987\u09AE\u09CB\u099C\u09BF", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO \u09A4\u09BE\u09B0\u09BF\u0996 \u0993 \u09B8\u09AE\u09AF\u09BC", - date: "ISO \u09A4\u09BE\u09B0\u09BF\u0996", - time: "ISO \u09B8\u09AE\u09AF\u09BC", - duration: "ISO \u09B8\u09AE\u09AF\u09BC\u0995\u09BE\u09B2", - ipv4: "IPv4 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE", - ipv6: "IPv6 \u09A0\u09BF\u0995\u09BE\u09A8\u09BE", - mac: "MAC \u09A0\u09BF\u0995\u09BE\u09A8\u09BE", - cidrv4: "IPv4 \u09B0\u09C7\u099E\u09CD\u099C", - cidrv6: "IPv6 \u09B0\u09C7\u099E\u09CD\u099C", - base64: "base64-\u098F\u09A8\u0995\u09CB\u09A1\u09C7\u09A1 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982", - base64url: "base64url-\u098F\u09A8\u0995\u09CB\u09A1\u09C7\u09A1 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982", - json_string: "JSON \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982", - e164: "E.164 \u09A8\u09AE\u09CD\u09AC\u09B0", - credit_card: "\u0995\u09CD\u09B0\u09C7\u09A1\u09BF\u099F \u0995\u09BE\u09B0\u09CD\u09A1 \u09A8\u09AE\u09CD\u09AC\u09B0", - jwt: "JWT", - template_literal: "\u0987\u09A8\u09AA\u09C1\u099F" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - return `\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F: \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${expected}, \u09AA\u09CD\u09B0\u09BE\u09AA\u09CD\u09A4 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F: \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${stringifyPrimitive(issue2.values[0])}`; - return `\u0985\u09AC\u09C8\u09A7 \u0985\u09AA\u09B6\u09A8: ${joinValues(issue2.values, " | ")} \u098F\u09B0 \u09AE\u09A7\u09CD\u09AF\u09C7 \u098F\u0995\u099F\u09BF \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u0985\u09A8\u09C7\u0995 \u09AC\u09A1\u09BC: ${issue2.origin ?? "\u09AE\u09BE\u09A8"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u098F\u09B2\u09BF\u09AE\u09C7\u09A8\u09CD\u099F"} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; - return `\u0985\u09A8\u09C7\u0995 \u09AC\u09A1\u09BC: ${issue2.origin ?? "\u09AE\u09BE\u09A8"} ${adj}${issue2.maximum.toString()} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u0985\u09A8\u09C7\u0995 \u099B\u09CB\u099F: ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; - } - return `\u0985\u09A8\u09C7\u0995 \u099B\u09CB\u099F: ${issue2.origin} ${adj}${issue2.minimum.toString()} \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${_issue.prefix}" \u09A6\u09BF\u09AF\u09BC\u09C7 \u09B6\u09C1\u09B0\u09C1 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; - } - if (_issue.format === "ends_with") - return `\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${_issue.suffix}" \u09A6\u09BF\u09AF\u09BC\u09C7 \u09B6\u09C7\u09B7 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; - if (_issue.format === "includes") - return `\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: "${_issue.includes}" \u0985\u09A8\u09CD\u09A4\u09B0\u09CD\u09AD\u09C1\u0995\u09CD\u09A4 \u09A5\u09BE\u0995\u09A4\u09C7 \u09B9\u09AC\u09C7`; - if (_issue.format === "regex") - return `\u0985\u09AC\u09C8\u09A7 \u09B8\u09CD\u099F\u09CD\u09B0\u09BF\u0982: ${_issue.pattern} \u09AA\u09CD\u09AF\u09BE\u099F\u09BE\u09B0\u09CD\u09A8 \u09AE\u09BF\u09B2\u09A4\u09C7 \u09B9\u09AC\u09C7`; - return `\u0985\u09AC\u09C8\u09A7 ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u0985\u09AC\u09C8\u09A7 \u09A8\u09AE\u09CD\u09AC\u09B0: ${issue2.divisor} \u098F\u09B0 \u0997\u09C1\u09A3\u09BF\u09A4\u0995 \u09B9\u09A4\u09C7 \u09B9\u09AC\u09C7`; - case "unrecognized_keys": - return `\u0985\u099A\u09C7\u09A8\u09BE \u0995\u09C0${issue2.keys.length > 1 ? "\u0997\u09C1\u09B2\u09CB" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `${issue2.origin} \u098F \u0985\u09AC\u09C8\u09A7 \u0995\u09C0`; - case "invalid_union": - if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { - const opts = issue2.options.map((o) => `'${o}'`).join(" | "); - return `\u0985\u09AC\u09C8\u09A7 \u09A1\u09BF\u09B8\u0995\u09CD\u09B0\u09BF\u09AE\u09BF\u09A8\u09C7\u099F\u09B0 \u09AE\u09BE\u09A8\u0964 \u09AA\u09CD\u09B0\u09A4\u09CD\u09AF\u09BE\u09B6\u09BF\u09A4 ${opts}`; - } - return "\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F"; - case "invalid_element": - return `${issue2.origin} \u098F \u0985\u09AC\u09C8\u09A7 \u09AE\u09BE\u09A8`; - default: - return "\u0985\u09AC\u09C8\u09A7 \u0987\u09A8\u09AA\u09C1\u099F"; - } - }; -}; -function bn_default() { - return { - localeError: error5() - }; -} - -// node_modules/zod/v4/locales/ca.js -var error6 = () => { - const Sizable = { - string: { unit: "car\xE0cters", verb: "contenir" }, - file: { unit: "bytes", verb: "contenir" }, - array: { unit: "elements", verb: "contenir" }, - set: { unit: "elements", verb: "contenir" }, - map: { unit: "elements", verb: "contenir" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "entrada", - email: "adre\xE7a electr\xF2nica", - 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\xE7a IPv4", - ipv6: "adre\xE7a IPv6", - mac: "adre\xE7a MAC", - cidrv4: "rang IPv4", - cidrv6: "rang IPv6", - base64: "cadena codificada en base64", - base64url: "cadena codificada en base64url", - json_string: "cadena JSON", - e164: "n\xFAmero E.164", - credit_card: "n\xFAmero de targeta de cr\xE8dit", - jwt: "JWT", - template_literal: "entrada" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Tipus inv\xE0lid: s'esperava instanceof ${issue2.expected}, s'ha rebut ${received}`; - } - return `Tipus inv\xE0lid: s'esperava ${expected}, s'ha rebut ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Valor inv\xE0lid: s'esperava ${stringifyPrimitive(issue2.values[0])}`; - return `Opci\xF3 inv\xE0lida: s'esperava una de ${joinValues(issue2.values, " o ")}`; - case "too_big": { - const adj = issue2.inclusive ? "com a m\xE0xim" : "menys de"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Massa gran: s'esperava que ${issue2.origin ?? "el valor"} contingu\xE9s ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`; - return `Massa gran: s'esperava que ${issue2.origin ?? "el valor"} fos ${adj} ${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? "com a m\xEDnim" : "m\xE9s de"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Massa petit: s'esperava que ${issue2.origin} contingu\xE9s ${adj} ${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Massa petit: s'esperava que ${issue2.origin} fos ${adj} ${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `Format inv\xE0lid: ha de comen\xE7ar amb "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `Format inv\xE0lid: ha d'acabar amb "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Format inv\xE0lid: ha d'incloure "${_issue.includes}"`; - if (_issue.format === "regex") - return `Format inv\xE0lid: ha de coincidir amb el patr\xF3 ${_issue.pattern}`; - return `Format inv\xE0lid per a ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `N\xFAmero inv\xE0lid: ha de ser m\xFAltiple de ${issue2.divisor}`; - case "unrecognized_keys": - return `Clau${issue2.keys.length > 1 ? "s" : ""} no reconeguda${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Clau inv\xE0lida a ${issue2.origin}`; - case "invalid_union": - return "Entrada inv\xE0lida"; - // Could also be "Tipus d'unió invàlid" but "Entrada invàlida" is more general - case "invalid_element": - return `Element inv\xE0lid a ${issue2.origin}`; - default: - return `Entrada inv\xE0lida`; - } - }; -}; -function ca_default() { - return { - localeError: error6() - }; -} - -// node_modules/zod/v4/locales/ckb.js -var error7 = () => { - const Sizable = { - string: { unit: "\u067E\u06CC\u062A", verb: "\u0628\u06CE\u062A" }, - file: { unit: "\u0628\u0627\u06CC\u062A", verb: "\u0628\u06CE\u062A" }, - array: { unit: "\u062F\u0627\u0646\u06D5", verb: "\u0628\u06CE\u062A" }, - set: { unit: "\u062F\u0627\u0646\u06D5", verb: "\u0628\u06CE\u062A" }, - map: { unit: "\u062F\u0627\u0646\u06D5", verb: "\u0628\u06CE\u062A" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "regex", - email: "\u0626\u06CC\u0645\u06D5\u06CC\u06B5", - url: "\u0628\u06D5\u0633\u062A\u06D5\u0631 (URL)", - emoji: "\u0626\u06CC\u0645\u06C6\u062C\u06CC", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "\u0695\u06CE\u06A9\u06D5\u0648\u062A \u0648 \u06A9\u0627\u062A", - date: "\u0695\u06CE\u06A9\u06D5\u0648\u062A", - time: "\u06A9\u0627\u062A", - duration: "\u0645\u0627\u0648\u06D5", - ipv4: "\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC IPv4", - ipv6: "\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC IPv6", - mac: "\u0646\u0627\u0648\u0646\u06CC\u0634\u0627\u0646\u06CC MAC", - cidrv4: "\u0645\u06D5\u0648\u062F\u0627\u06CC IPv4", - cidrv6: "\u0645\u06D5\u0648\u062F\u0627\u06CC IPv6", - base64: "\u062F\u06D5\u0642\u06CC base64", - base64url: "\u062F\u06D5\u0642\u06CC base64url", - json_string: "\u062F\u06D5\u0642\u06CC JSON", - e164: "\u0698\u0645\u0627\u0631\u06D5\u06CC E.164", - credit_card: "\u0698\u0645\u0627\u0631\u06D5\u06CC \u06A9\u0627\u0631\u062A\u06CC \u06A9\u0631\u06CE\u062F\u06CC\u062A", - jwt: "JWT", - template_literal: "\u062A\u06CE\u06A9\u0631\u062F\u06D5" - }; - const TypeDictionary = { - nan: "NaN", - string: "\u0646\u0648\u0648\u0633\u06CC\u0646", - number: "\u0698\u0645\u0627\u0631\u06D5", - boolean: "boolean", - array: "array", - object: "object", - date: "\u0695\u06CE\u06A9\u06D5\u0648\u062A", - integer: "\u0698\u0645\u0627\u0631\u06D5", - float: "\u0698\u0645\u0627\u0631\u06D5", - null: "null", - undefined: "undefined", - function: "function", - symbol: "symbol", - unknown: "unknown", - promise: "promise", - void: "void", - never: "never", - map: "map", - set: "set" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - const postfix = ["\u0627", "\u0648", "\u06C6", "\u0648\u0648", "\u06D5", "\u06CC", "\u06CE"].some((p) => received.endsWith(p)) ? "\u06CC\u06D5" : "\u06D5"; - const isEnglish = /^[a-zA-Z]+$/.test(received); - if (receivedType === "null" || receivedType === "undefined") - return `\u062F\u0627\u0648\u0627\u06A9\u0631\u0627\u0648\u06D5`; - return `\u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 ${expected} \u0628\u06CE\u062A\u060C \u0628\u06D5\u06B5\u0627\u0645 ${received}${isEnglish ? "" : postfix}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u0628\u06D5\u0647\u0627\u06A9\u06D5 \u0646\u0627\u062F\u0631\u0648\u0648\u0633\u062A\u06D5: \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 ${stringifyPrimitive(issue2.values[0])} \u0628\u06CE\u062A`; - return `\u0647\u06D5\u06B5\u0628\u0698\u0627\u0631\u062F\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648\u06D5 \u06CC\u06D5\u06A9\u06CE\u06A9 \u0628\u06CE\u062A \u0644\u06D5 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u0632\u06C6\u0631\u06D5\u0648\u06D5 ${issue2.maximum.toString()} ${sizing.unit} ${sizing.verb}`; - return `\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u0632\u06C6\u0631\u06D5\u0648\u06D5 ${issue2.maximum.toString()} \u0628\u06CE\u062A`; - } - case "too_small": { - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u06A9\u06D5\u0645\u06D5\u0648\u06D5 ${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`; - return `\u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0628\u06D5 \u0644\u0627\u06CC\u06D5\u0646\u06CC \u06A9\u06D5\u0645\u06D5\u0648\u06D5 ${issue2.minimum.toString()} \u0628\u06CE\u062A`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u062F\u06D5\u0633\u062A\u067E\u06CE\u0628\u06A9\u0627\u062A \u0628\u06D5 "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u06A9\u06C6\u062A\u0627\u06CC\u06CC\u0628\u06CE\u062A \u0628\u06D5 "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 "${_issue.includes}" \u0644\u06D5\u062E\u06C6\u0628\u06AF\u0631\u06CE\u062A`; - if (_issue.format === "regex") - return `\u062F\u06D5\u0642\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u067E\u06CE\u0648\u06CC\u0633\u062A\u06D5 \u0644\u06D5\u06AF\u06D5\u06B5 \u067E\u0627\u062A\u06CE\u0631\u0646\u06CC ${_issue.pattern} \u0628\u06AF\u0648\u0646\u062C\u06CE\u062A`; - return `\u0628\u06D5\u0647\u0627\u06CC ${FormatDictionary[_issue.format] ?? issue2.format} \u0646\u0627\u062F\u0631\u0648\u0633\u062A\u06D5`; - } - case "not_multiple_of": - return `\u0698\u0645\u0627\u0631\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A: \u062F\u06D5\u0628\u06CE\u062A \u0686\u06D5\u0646\u062F \u0647\u06CE\u0646\u062F\u06D5 \u0628\u06CE\u062A \u0628\u06C6 ${issue2.divisor}`; - case "unrecognized_keys": - return `\u06A9\u0644\u06CC\u0644\u06CC \u0646\u06D5\u0646\u0627\u0633\u0631\u0627\u0648: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u06A9\u0644\u06CC\u0644\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A \u0644\u06D5 ${issue2.origin}`; - case "invalid_union": - if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { - const opts = issue2.options.map((o) => `'${o}'`).join(" | "); - return `\u0628\u06D5\u0647\u0627\u06CC \u0646\u06D5\u0646\u0627\u0633\u0631\u0627\u0648 \u0647\u06D5\u06CC\u06D5. \u0628\u06D5\u0647\u0627\u06CC \u0686\u0627\u0648\u06D5\u0695\u0648\u0627\u0646\u06A9\u0631\u0627\u0648: ${opts}`; - } - return "\u06CC\u06D5\u06A9\u06AF\u0631\u062A\u0646\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A"; - case "invalid_element": - return `${issue2.origin} \u0628\u06D5\u0647\u0627\u06A9\u06D5 \u0646\u0627\u062F\u0631\u0648\u0633\u062A\u06D5`; - default: - return `\u062A\u06CE\u06A9\u0631\u062F\u06D5\u06CC \u0646\u0627\u062F\u0631\u0648\u0633\u062A`; - } - }; -}; -function ckb_default() { - return { - localeError: error7() - }; -} - -// node_modules/zod/v4/locales/cs.js -var error8 = () => { - const Sizable = { - string: { unit: "znak\u016F", verb: "m\xEDt" }, - file: { unit: "bajt\u016F", verb: "m\xEDt" }, - array: { unit: "prvk\u016F", verb: "m\xEDt" }, - set: { unit: "prvk\u016F", verb: "m\xEDt" }, - map: { unit: "prvk\u016F", verb: "m\xEDt" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "regul\xE1rn\xED v\xFDraz", - email: "e-mailov\xE1 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 \u010Das ve form\xE1tu ISO", - date: "datum ve form\xE1tu ISO", - time: "\u010Das ve form\xE1tu ISO", - duration: "doba trv\xE1n\xED ISO", - ipv4: "IPv4 adresa", - ipv6: "IPv6 adresa", - mac: "MAC adresa", - cidrv4: "rozsah IPv4", - cidrv6: "rozsah IPv6", - base64: "\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64", - base64url: "\u0159et\u011Bzec zak\xF3dovan\xFD ve form\xE1tu base64url", - json_string: "\u0159et\u011Bzec ve form\xE1tu JSON", - e164: "\u010D\xEDslo E.164", - credit_card: "\u010D\xEDslo kreditn\xED karty", - jwt: "JWT", - template_literal: "vstup" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u010D\xEDslo", - string: "\u0159et\u011Bzec", - function: "funkce", - array: "pole" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no instanceof ${issue2.expected}, obdr\u017Eeno ${received}`; - } - return `Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${expected}, obdr\u017Eeno ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Neplatn\xFD vstup: o\u010Dek\xE1v\xE1no ${stringifyPrimitive(issue2.values[0])}`; - return `Neplatn\xE1 mo\u017Enost: o\u010Dek\xE1v\xE1na jedna z hodnot ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${issue2.origin ?? "hodnota"} mus\xED m\xEDt ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "prvk\u016F"}`; - } - return `Hodnota je p\u0159\xEDli\u0161 velk\xE1: ${issue2.origin ?? "hodnota"} mus\xED b\xFDt ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${issue2.origin ?? "hodnota"} mus\xED m\xEDt ${adj}${issue2.minimum.toString()} ${sizing.unit ?? "prvk\u016F"}`; - } - return `Hodnota je p\u0159\xEDli\u0161 mal\xE1: ${issue2.origin ?? "hodnota"} mus\xED b\xFDt ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Neplatn\xFD \u0159et\u011Bzec: mus\xED za\u010D\xEDnat na "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Neplatn\xFD \u0159et\u011Bzec: mus\xED kon\u010Dit na "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Neplatn\xFD \u0159et\u011Bzec: mus\xED obsahovat "${_issue.includes}"`; - if (_issue.format === "regex") - return `Neplatn\xFD \u0159et\u011Bzec: mus\xED odpov\xEDdat vzoru ${_issue.pattern}`; - return `Neplatn\xFD form\xE1t ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Neplatn\xE9 \u010D\xEDslo: mus\xED b\xFDt n\xE1sobkem ${issue2.divisor}`; - case "unrecognized_keys": - return `Nezn\xE1m\xE9 kl\xED\u010De: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Neplatn\xFD kl\xED\u010D v ${issue2.origin}`; - case "invalid_union": - return "Neplatn\xFD vstup"; - case "invalid_element": - return `Neplatn\xE1 hodnota v ${issue2.origin}`; - default: - return `Neplatn\xFD vstup`; - } - }; -}; -function cs_default() { - return { - localeError: error8() - }; -} - -// node_modules/zod/v4/locales/da.js -var error9 = () => { - const Sizable = { - string: { unit: "tegn", verb: "havde" }, - file: { unit: "bytes", verb: "havde" }, - array: { unit: "elementer", verb: "indeholdt" }, - set: { unit: "elementer", verb: "indeholdt" }, - map: { unit: "elementer", verb: "indeholdt" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "input", - email: "e-mailadresse", - 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 klokkesl\xE6t", - date: "ISO-dato", - time: "ISO-klokkesl\xE6t", - duration: "ISO-varighed", - ipv4: "IPv4-adresse", - ipv6: "IPv6-adresse", - mac: "MAC-adresse", - cidrv4: "IPv4-spektrum", - cidrv6: "IPv6-spektrum", - base64: "base64-kodet streng", - base64url: "base64url-kodet streng", - json_string: "JSON-streng", - e164: "E.164-nummer", - credit_card: "kreditkortnummer", - jwt: "JWT", - template_literal: "input" - }; - const TypeDictionary = { - nan: "NaN", - string: "streng", - number: "tal", - boolean: "boolean", - array: "liste", - object: "objekt", - set: "s\xE6t", - file: "fil" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Ugyldigt input: forventede instanceof ${issue2.expected}, fik ${received}`; - } - return `Ugyldigt input: forventede ${expected}, fik ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Ugyldig v\xE6rdi: forventede ${stringifyPrimitive(issue2.values[0])}`; - return `Ugyldigt valg: forventede en af f\xF8lgende ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - const origin = TypeDictionary[issue2.origin] ?? issue2.origin; - if (sizing) - return `For stor: forventede ${origin ?? "value"} ${sizing.verb} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elementer"}`; - return `For stor: forventede ${origin ?? "value"} havde ${adj} ${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - const origin = TypeDictionary[issue2.origin] ?? issue2.origin; - if (sizing) { - return `For lille: forventede ${origin} ${sizing.verb} ${adj} ${issue2.minimum.toString()} ${sizing.unit}`; - } - return `For lille: forventede ${origin} havde ${adj} ${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Ugyldig streng: skal starte med "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Ugyldig streng: skal ende med "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Ugyldig streng: skal indeholde "${_issue.includes}"`; - if (_issue.format === "regex") - return `Ugyldig streng: skal matche m\xF8nsteret ${_issue.pattern}`; - return `Ugyldig ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Ugyldigt tal: skal v\xE6re deleligt med ${issue2.divisor}`; - case "unrecognized_keys": - return `${issue2.keys.length > 1 ? "Ukendte n\xF8gler" : "Ukendt n\xF8gle"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Ugyldig n\xF8gle i ${issue2.origin}`; - case "invalid_union": - return "Ugyldigt input: matcher ingen af de tilladte typer"; - case "invalid_element": - return `Ugyldig v\xE6rdi i ${issue2.origin}`; - default: - return `Ugyldigt input`; - } - }; -}; -function da_default() { - return { - localeError: error9() - }; -} - -// node_modules/zod/v4/locales/de.js -var error10 = () => { - const Sizable = { - string: { unit: "Zeichen", verb: "zu haben" }, - file: { unit: "Bytes", verb: "zu haben" }, - array: { unit: "Elemente", verb: "zu haben" }, - set: { unit: "Elemente", verb: "zu haben" }, - map: { unit: "Elemente", verb: "zu haben" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - 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", - mac: "MAC-Adresse", - cidrv4: "IPv4-Bereich", - cidrv6: "IPv6-Bereich", - base64: "Base64-codierter String", - base64url: "Base64-URL-codierter String", - json_string: "JSON-String", - e164: "E.164-Nummer", - credit_card: "Kreditkartennummer", - jwt: "JWT", - template_literal: "Eingabe" - }; - const TypeDictionary = { - nan: "NaN", - number: "Zahl", - array: "Array" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Ung\xFCltige Eingabe: erwartet instanceof ${issue2.expected}, erhalten ${received}`; - } - return `Ung\xFCltige Eingabe: erwartet ${expected}, erhalten ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Ung\xFCltige Eingabe: erwartet ${stringifyPrimitive(issue2.values[0])}`; - return `Ung\xFCltige Option: erwartet eine von ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Zu gro\xDF: erwartet, dass ${issue2.origin ?? "Wert"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "Elemente"} hat`; - return `Zu gro\xDF: erwartet, dass ${issue2.origin ?? "Wert"} ${adj}${issue2.maximum.toString()} ist`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Zu klein: erwartet, dass ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} hat`; - } - return `Zu klein: erwartet, dass ${issue2.origin} ${adj}${issue2.minimum.toString()} ist`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Ung\xFCltiger String: muss mit "${_issue.prefix}" beginnen`; - if (_issue.format === "ends_with") - return `Ung\xFCltiger String: muss mit "${_issue.suffix}" enden`; - if (_issue.format === "includes") - return `Ung\xFCltiger String: muss "${_issue.includes}" enthalten`; - if (_issue.format === "regex") - return `Ung\xFCltiger String: muss dem Muster ${_issue.pattern} entsprechen`; - return `Ung\xFCltig: ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Ung\xFCltige Zahl: muss ein Vielfaches von ${issue2.divisor} sein`; - case "unrecognized_keys": - return `${issue2.keys.length > 1 ? "Unbekannte Schl\xFCssel" : "Unbekannter Schl\xFCssel"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Ung\xFCltiger Schl\xFCssel in ${issue2.origin}`; - case "invalid_union": - return "Ung\xFCltige Eingabe"; - case "invalid_element": - return `Ung\xFCltiger Wert in ${issue2.origin}`; - default: - return `Ung\xFCltige Eingabe`; - } - }; -}; -function de_default() { - return { - localeError: error10() - }; -} - -// node_modules/zod/v4/locales/el.js -var error11 = () => { - const Sizable = { - string: { unit: "\u03C7\u03B1\u03C1\u03B1\u03BA\u03C4\u03AE\u03C1\u03B5\u03C2", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" }, - file: { unit: "bytes", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" }, - array: { unit: "\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" }, - set: { unit: "\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" }, - map: { unit: "\u03BA\u03B1\u03C4\u03B1\u03C7\u03C9\u03C1\u03AE\u03C3\u03B5\u03B9\u03C2", verb: "\u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2", - email: "\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 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 \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1 \u03BA\u03B1\u03B9 \u03CE\u03C1\u03B1", - date: "ISO \u03B7\u03BC\u03B5\u03C1\u03BF\u03BC\u03B7\u03BD\u03AF\u03B1", - time: "ISO \u03CE\u03C1\u03B1", - duration: "ISO \u03B4\u03B9\u03AC\u03C1\u03BA\u03B5\u03B9\u03B1", - ipv4: "\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv4", - ipv6: "\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 IPv6", - mac: "\u03B4\u03B9\u03B5\u03CD\u03B8\u03C5\u03BD\u03C3\u03B7 MAC", - cidrv4: "\u03B5\u03CD\u03C1\u03BF\u03C2 IPv4", - cidrv6: "\u03B5\u03CD\u03C1\u03BF\u03C2 IPv6", - base64: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64", - base64url: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03C0\u03BF\u03B9\u03B7\u03BC\u03AD\u03BD\u03B7 \u03C3\u03B5 base64url", - json_string: "\u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC JSON", - e164: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 E.164", - credit_card: "\u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2 \u03C0\u03B9\u03C3\u03C4\u03C9\u03C4\u03B9\u03BA\u03AE\u03C2 \u03BA\u03AC\u03C1\u03C4\u03B1\u03C2", - jwt: "JWT", - template_literal: "\u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (typeof issue2.expected === "string" && /^[A-Z]/.test(issue2.expected)) { - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD instanceof ${issue2.expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${received}`; - } - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${expected}, \u03BB\u03AE\u03C6\u03B8\u03B7\u03BA\u03B5 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${stringifyPrimitive(issue2.values[0])}`; - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD \u03AD\u03BD\u03B1 \u03B1\u03C0\u03CC ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${issue2.origin ?? "\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"}`; - return `\u03A0\u03BF\u03BB\u03CD \u03BC\u03B5\u03B3\u03AC\u03BB\u03BF: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${issue2.origin ?? "\u03C4\u03B9\u03BC\u03AE"} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${issue2.origin} \u03BD\u03B1 \u03AD\u03C7\u03B5\u03B9 ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `\u03A0\u03BF\u03BB\u03CD \u03BC\u03B9\u03BA\u03C1\u03CC: \u03B1\u03BD\u03B1\u03BC\u03B5\u03BD\u03CC\u03C4\u03B1\u03BD ${issue2.origin} \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03BE\u03B5\u03BA\u03B9\u03BD\u03AC \u03BC\u03B5 "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B5\u03BB\u03B5\u03B9\u03CE\u03BD\u03B5\u03B9 \u03BC\u03B5 "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AD\u03C7\u03B5\u03B9 "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C3\u03C5\u03BC\u03B2\u03BF\u03BB\u03BF\u03C3\u03B5\u03B9\u03C1\u03AC: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C4\u03B1\u03B9\u03C1\u03B9\u03AC\u03B6\u03B5\u03B9 \u03BC\u03B5 \u03C4\u03BF \u03BC\u03BF\u03C4\u03AF\u03B2\u03BF ${_issue.pattern}`; - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF: ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF\u03C2 \u03B1\u03C1\u03B9\u03B8\u03BC\u03CC\u03C2: \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03C0\u03BF\u03BB\u03BB\u03B1\u03C0\u03BB\u03AC\u03C3\u03B9\u03BF \u03C4\u03BF\u03C5 ${issue2.divisor}`; - case "unrecognized_keys": - return `\u0386\u03B3\u03BD\u03C9\u03C3\u03C4${issue2.keys.length > 1 ? "\u03B1" : "\u03BF"} \u03BA\u03BB\u03B5\u03B9\u03B4${issue2.keys.length > 1 ? "\u03B9\u03AC" : "\u03AF"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03BF \u03BA\u03BB\u03B5\u03B9\u03B4\u03AF \u03C3\u03C4\u03BF ${issue2.origin}`; - case "invalid_union": - return "\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2"; - case "invalid_element": - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03C4\u03B9\u03BC\u03AE \u03C3\u03C4\u03BF ${issue2.origin}`; - default: - return `\u039C\u03B7 \u03AD\u03B3\u03BA\u03C5\u03C1\u03B7 \u03B5\u03AF\u03C3\u03BF\u03B4\u03BF\u03C2`; - } - }; -}; -function el_default() { - return { - localeError: error11() - }; -} - -// node_modules/zod/v4/locales/en.js -var error12 = () => { - const Sizable = { - string: { unit: "characters", verb: "to have" }, - file: { unit: "bytes", verb: "to have" }, - array: { unit: "items", verb: "to have" }, - set: { unit: "items", verb: "to have" }, - map: { unit: "entries", verb: "to have" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "input", - email: "email address", - url: "URL", - emoji: "emoji", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO datetime", - date: "ISO date", - time: "ISO time", - duration: "ISO duration", - ipv4: "IPv4 address", - ipv6: "IPv6 address", - mac: "MAC address", - cidrv4: "IPv4 range", - cidrv6: "IPv6 range", - base64: "base64-encoded string", - base64url: "base64url-encoded string", - json_string: "JSON string", - e164: "E.164 number", - credit_card: "credit card number", - jwt: "JWT", - template_literal: "input" - }; - const TypeDictionary = { - // Compatibility: "nan" -> "NaN" for display - nan: "NaN" - // All other type names omitted - they fall back to raw values via ?? operator - }; - function getTypeName(type, input2) { - if (type === "number" && typeof input2 === "number" && !Number.isFinite(input2)) { - return String(input2); - } - return TypeDictionary[type] ?? type; - } - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = getTypeName(issue2.expected); - const receivedType = parsedType(issue2.input); - const received = getTypeName(receivedType, issue2.input); - return `Invalid input: expected ${expected}, received ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`; - return `Invalid option: expected one of ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.exact ? "exactly " : issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Too big: expected ${issue2.origin ?? "value"} to have ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`; - return `Too big: expected ${issue2.origin ?? "value"} to be ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.exact ? "exactly " : issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Too small: expected ${issue2.origin} to have ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Too small: expected ${issue2.origin} to be ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `Invalid string: must start with "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `Invalid string: must end with "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Invalid string: must include "${_issue.includes}"`; - if (_issue.format === "regex") - return `Invalid string: must match pattern ${_issue.pattern}`; - return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Invalid number: must be a multiple of ${issue2.divisor}`; - case "unrecognized_keys": - return `Unrecognized key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Invalid key in ${issue2.origin}`; - case "invalid_union": - if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { - const opts = issue2.options.map((o) => `'${o}'`).join(" | "); - return `Invalid discriminator value. Expected ${opts}`; - } - if (issue2.inclusive === false) { - return "Invalid input: more than one option matched"; - } - return "Invalid input"; - case "invalid_element": - return `Invalid value in ${issue2.origin}`; - default: - return `Invalid input`; - } - }; -}; -function en_default2() { - return { - localeError: error12() - }; -} - -// node_modules/zod/v4/locales/eo.js -var error13 = () => { - const Sizable = { - string: { unit: "karaktrojn", verb: "havi" }, - file: { unit: "bajtojn", verb: "havi" }, - array: { unit: "elementojn", verb: "havi" }, - set: { unit: "elementojn", verb: "havi" }, - map: { unit: "elementojn", verb: "havi" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "enigo", - email: "retadreso", - url: "URL", - emoji: "emo\u011Dio", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO-datotempo", - date: "ISO-dato", - time: "ISO-tempo", - duration: "ISO-da\u016Dro", - ipv4: "IPv4-adreso", - ipv6: "IPv6-adreso", - mac: "MAC-adreso", - cidrv4: "IPv4-rango", - cidrv6: "IPv6-rango", - base64: "64-ume kodita karaktraro", - base64url: "URL-64-ume kodita karaktraro", - json_string: "JSON-karaktraro", - e164: "E.164-nombro", - credit_card: "kreditkarta numero", - jwt: "JWT", - template_literal: "enigo" - }; - const TypeDictionary = { - nan: "NaN", - number: "nombro", - array: "tabelo", - null: "senvalora" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Nevalida enigo: atendi\u011Dis instanceof ${issue2.expected}, ricevi\u011Dis ${received}`; - } - return `Nevalida enigo: atendi\u011Dis ${expected}, ricevi\u011Dis ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Nevalida enigo: atendi\u011Dis ${stringifyPrimitive(issue2.values[0])}`; - return `Nevalida opcio: atendi\u011Dis unu el ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Tro granda: atendi\u011Dis ke ${issue2.origin ?? "valoro"} havu ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementojn"}`; - return `Tro granda: atendi\u011Dis ke ${issue2.origin ?? "valoro"} havu ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Tro malgranda: atendi\u011Dis ke ${issue2.origin} havu ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Tro malgranda: atendi\u011Dis ke ${issue2.origin} estu ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Nevalida karaktraro: devas komenci\u011Di per "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Nevalida karaktraro: devas fini\u011Di per "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Nevalida karaktraro: devas inkluzivi "${_issue.includes}"`; - if (_issue.format === "regex") - return `Nevalida karaktraro: devas kongrui kun la modelo ${_issue.pattern}`; - return `Nevalida ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Nevalida nombro: devas esti oblo de ${issue2.divisor}`; - case "unrecognized_keys": - return `Nekonata${issue2.keys.length > 1 ? "j" : ""} \u015Dlosilo${issue2.keys.length > 1 ? "j" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Nevalida \u015Dlosilo en ${issue2.origin}`; - case "invalid_union": - return "Nevalida enigo"; - case "invalid_element": - return `Nevalida valoro en ${issue2.origin}`; - default: - return `Nevalida enigo`; - } - }; -}; -function eo_default() { - return { - localeError: error13() - }; -} - -// node_modules/zod/v4/locales/es.js -var error14 = () => { - const Sizable = { - string: { unit: "caracteres", verb: "tener" }, - file: { unit: "bytes", verb: "tener" }, - array: { unit: "elementos", verb: "tener" }, - set: { unit: "elementos", verb: "tener" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "entrada", - email: "direcci\xF3n de correo electr\xF3nico", - 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\xF3n ISO", - ipv4: "direcci\xF3n IPv4", - ipv6: "direcci\xF3n IPv6", - mac: "direcci\xF3n MAC", - cidrv4: "rango IPv4", - cidrv6: "rango IPv6", - base64: "cadena codificada en base64", - base64url: "URL codificada en base64", - json_string: "cadena JSON", - e164: "n\xFAmero E.164", - credit_card: "n\xFAmero de tarjeta de cr\xE9dito", - jwt: "JWT", - template_literal: "entrada" - }; - const TypeDictionary = { - nan: "NaN", - string: "texto", - number: "n\xFAmero", - boolean: "booleano", - array: "arreglo", - object: "objeto", - set: "conjunto", - file: "archivo", - date: "fecha", - bigint: "n\xFAmero grande", - symbol: "s\xEDmbolo", - undefined: "indefinido", - null: "nulo", - function: "funci\xF3n", - map: "mapa", - record: "registro", - tuple: "tupla", - enum: "enumeraci\xF3n", - union: "uni\xF3n", - literal: "literal", - promise: "promesa", - void: "vac\xEDo", - never: "nunca", - unknown: "desconocido", - any: "cualquiera" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Entrada inv\xE1lida: se esperaba instanceof ${issue2.expected}, recibido ${received}`; - } - return `Entrada inv\xE1lida: se esperaba ${expected}, recibido ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Entrada inv\xE1lida: se esperaba ${stringifyPrimitive(issue2.values[0])}`; - return `Opci\xF3n inv\xE1lida: se esperaba una de ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - const origin = TypeDictionary[issue2.origin] ?? issue2.origin; - if (sizing) - return `Demasiado grande: se esperaba que ${origin ?? "valor"} tuviera ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`; - return `Demasiado grande: se esperaba que ${origin ?? "valor"} fuera ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - const origin = TypeDictionary[issue2.origin] ?? issue2.origin; - if (sizing) { - return `Demasiado peque\xF1o: se esperaba que ${origin} tuviera ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Demasiado peque\xF1o: se esperaba que ${origin} fuera ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Cadena inv\xE1lida: debe comenzar con "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Cadena inv\xE1lida: debe terminar en "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Cadena inv\xE1lida: debe incluir "${_issue.includes}"`; - if (_issue.format === "regex") - return `Cadena inv\xE1lida: debe coincidir con el patr\xF3n ${_issue.pattern}`; - return `Inv\xE1lido ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `N\xFAmero inv\xE1lido: debe ser m\xFAltiplo de ${issue2.divisor}`; - case "unrecognized_keys": - return `Llave${issue2.keys.length > 1 ? "s" : ""} desconocida${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Llave inv\xE1lida en ${TypeDictionary[issue2.origin] ?? issue2.origin}`; - case "invalid_union": - return "Entrada inv\xE1lida"; - case "invalid_element": - return `Valor inv\xE1lido en ${TypeDictionary[issue2.origin] ?? issue2.origin}`; - default: - return `Entrada inv\xE1lida`; - } - }; -}; -function es_default() { - return { - localeError: error14() - }; -} - -// node_modules/zod/v4/locales/fa.js -var error15 = () => { - const Sizable = { - string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }, - file: { unit: "\u0628\u0627\u06CC\u062A", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }, - array: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }, - set: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" }, - map: { unit: "\u0622\u06CC\u062A\u0645", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0648\u0631\u0648\u062F\u06CC", - email: "\u0622\u062F\u0631\u0633 \u0627\u06CC\u0645\u06CC\u0644", - url: "URL", - emoji: "\u0627\u06CC\u0645\u0648\u062C\u06CC", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "\u062A\u0627\u0631\u06CC\u062E \u0648 \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648", - date: "\u062A\u0627\u0631\u06CC\u062E \u0627\u06CC\u0632\u0648", - time: "\u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648", - duration: "\u0645\u062F\u062A \u0632\u0645\u0627\u0646 \u0627\u06CC\u0632\u0648", - ipv4: "IPv4 \u0622\u062F\u0631\u0633", - ipv6: "IPv6 \u0622\u062F\u0631\u0633", - mac: "MAC \u0622\u062F\u0631\u0633", - cidrv4: "IPv4 \u062F\u0627\u0645\u0646\u0647", - cidrv6: "IPv6 \u062F\u0627\u0645\u0646\u0647", - base64: "base64-encoded \u0631\u0634\u062A\u0647", - base64url: "base64url-encoded \u0631\u0634\u062A\u0647", - json_string: "JSON \u0631\u0634\u062A\u0647", - e164: "E.164 \u0639\u062F\u062F", - credit_card: "\u0634\u0645\u0627\u0631\u0647 \u06A9\u0627\u0631\u062A \u0627\u0639\u062A\u0628\u0627\u0631\u06CC", - jwt: "JWT", - template_literal: "\u0648\u0631\u0648\u062F\u06CC" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u0639\u062F\u062F", - array: "\u0622\u0631\u0627\u06CC\u0647" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A instanceof ${issue2.expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${received} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`; - } - return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${expected} \u0645\u06CC\u200C\u0628\u0648\u062F\u060C ${received} \u062F\u0631\u06CC\u0627\u0641\u062A \u0634\u062F`; - } - case "invalid_value": - if (issue2.values.length === 1) { - return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A ${stringifyPrimitive(issue2.values[0])} \u0645\u06CC\u200C\u0628\u0648\u062F`; - } - return `\u06AF\u0632\u06CC\u0646\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0645\u06CC\u200C\u0628\u0627\u06CC\u0633\u062A \u06CC\u06A9\u06CC \u0627\u0632 ${joinValues(issue2.values, "|")} \u0645\u06CC\u200C\u0628\u0648\u062F`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${issue2.origin ?? "\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0639\u0646\u0635\u0631"} \u0628\u0627\u0634\u062F`; - } - return `\u062E\u06CC\u0644\u06CC \u0628\u0632\u0631\u06AF: ${issue2.origin ?? "\u0645\u0642\u062F\u0627\u0631"} \u0628\u0627\u06CC\u062F ${adj}${issue2.maximum.toString()} \u0628\u0627\u0634\u062F`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${issue2.origin} \u0628\u0627\u06CC\u062F ${adj}${issue2.minimum.toString()} ${sizing.unit} \u0628\u0627\u0634\u062F`; - } - return `\u062E\u06CC\u0644\u06CC \u06A9\u0648\u0686\u06A9: ${issue2.origin} \u0628\u0627\u06CC\u062F ${adj}${issue2.minimum.toString()} \u0628\u0627\u0634\u062F`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${_issue.prefix}" \u0634\u0631\u0648\u0639 \u0634\u0648\u062F`; - } - if (_issue.format === "ends_with") { - return `\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 "${_issue.suffix}" \u062A\u0645\u0627\u0645 \u0634\u0648\u062F`; - } - if (_issue.format === "includes") { - return `\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0634\u0627\u0645\u0644 "${_issue.includes}" \u0628\u0627\u0634\u062F`; - } - if (_issue.format === "regex") { - return `\u0631\u0634\u062A\u0647 \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0628\u0627 \u0627\u0644\u06AF\u0648\u06CC ${_issue.pattern} \u0645\u0637\u0627\u0628\u0642\u062A \u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F`; - } - return `${FormatDictionary[_issue.format] ?? issue2.format} \u0646\u0627\u0645\u0639\u062A\u0628\u0631`; - } - case "not_multiple_of": - return `\u0639\u062F\u062F \u0646\u0627\u0645\u0639\u062A\u0628\u0631: \u0628\u0627\u06CC\u062F \u0645\u0636\u0631\u0628 ${issue2.divisor} \u0628\u0627\u0634\u062F`; - case "unrecognized_keys": - return `\u06A9\u0644\u06CC\u062F${issue2.keys.length > 1 ? "\u0647\u0627\u06CC" : ""} \u0646\u0627\u0634\u0646\u0627\u0633: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u06A9\u0644\u06CC\u062F \u0646\u0627\u0634\u0646\u0627\u0633 \u062F\u0631 ${issue2.origin}`; - case "invalid_union": - return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631`; - case "invalid_element": - return `\u0645\u0642\u062F\u0627\u0631 \u0646\u0627\u0645\u0639\u062A\u0628\u0631 \u062F\u0631 ${issue2.origin}`; - default: - return `\u0648\u0631\u0648\u062F\u06CC \u0646\u0627\u0645\u0639\u062A\u0628\u0631`; - } - }; -}; -function fa_default() { - return { - localeError: error15() - }; -} - -// node_modules/zod/v4/locales/fi.js -var error16 = () => { - const Sizable = { - string: { unit: "merkki\xE4", subject: "merkkijonon" }, - file: { unit: "tavua", subject: "tiedoston" }, - array: { unit: "alkiota", subject: "listan" }, - set: { unit: "alkiota", subject: "joukon" }, - map: { unit: "alkiota", subject: "kuvauksen" }, - number: { unit: "", subject: "luvun" }, - bigint: { unit: "", subject: "suuren kokonaisluvun" }, - int: { unit: "", subject: "kokonaisluvun" }, - date: { unit: "", subject: "p\xE4iv\xE4m\xE4\xE4r\xE4n" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "s\xE4\xE4nn\xF6llinen lauseke", - email: "s\xE4hk\xF6postiosoite", - 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\xE4iv\xE4m\xE4\xE4r\xE4", - time: "ISO-aika", - duration: "ISO-kesto", - ipv4: "IPv4-osoite", - ipv6: "IPv6-osoite", - mac: "MAC-osoite", - cidrv4: "IPv4-alue", - cidrv6: "IPv6-alue", - base64: "base64-koodattu merkkijono", - base64url: "base64url-koodattu merkkijono", - json_string: "JSON-merkkijono", - e164: "E.164-luku", - credit_card: "luottokortin numero", - jwt: "JWT", - template_literal: "templaattimerkkijono" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Virheellinen tyyppi: odotettiin instanceof ${issue2.expected}, oli ${received}`; - } - return `Virheellinen tyyppi: odotettiin ${expected}, oli ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Virheellinen sy\xF6te: t\xE4ytyy olla ${stringifyPrimitive(issue2.values[0])}`; - return `Virheellinen valinta: t\xE4ytyy olla yksi seuraavista: ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Liian suuri: ${sizing.subject} t\xE4ytyy olla ${adj}${issue2.maximum.toString()} ${sizing.unit}`.trim(); - } - return `Liian suuri: arvon t\xE4ytyy olla ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Liian pieni: ${sizing.subject} t\xE4ytyy olla ${adj}${issue2.minimum.toString()} ${sizing.unit}`.trim(); - } - return `Liian pieni: arvon t\xE4ytyy olla ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Virheellinen sy\xF6te: t\xE4ytyy alkaa "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Virheellinen sy\xF6te: t\xE4ytyy loppua "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Virheellinen sy\xF6te: t\xE4ytyy sis\xE4lt\xE4\xE4 "${_issue.includes}"`; - if (_issue.format === "regex") { - return `Virheellinen sy\xF6te: t\xE4ytyy vastata s\xE4\xE4nn\xF6llist\xE4 lauseketta ${_issue.pattern}`; - } - return `Virheellinen ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Virheellinen luku: t\xE4ytyy olla luvun ${issue2.divisor} monikerta`; - case "unrecognized_keys": - return `${issue2.keys.length > 1 ? "Tuntemattomat avaimet" : "Tuntematon avain"}: ${joinValues(issue2.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\xF6te`; - } - }; -}; -function fi_default() { - return { - localeError: error16() - }; -} - -// node_modules/zod/v4/locales/fr.js -var error17 = () => { - const Sizable = { - string: { unit: "caract\xE8res", verb: "avoir" }, - file: { unit: "octets", verb: "avoir" }, - array: { unit: "\xE9l\xE9ments", verb: "avoir" }, - set: { unit: "\xE9l\xE9ments", verb: "avoir" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "expression r\xE9guli\xE8re", - 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\xE9e ISO", - ipv4: "adresse IPv4", - ipv6: "adresse IPv6", - mac: "adresse MAC", - cidrv4: "plage IPv4", - cidrv6: "plage IPv6", - base64: "cha\xEEne de caract\xE8res encod\xE9e en base64", - base64url: "cha\xEEne de caract\xE8res encod\xE9e en base64url", - json_string: "cha\xEEne de caract\xE8res JSON", - e164: "num\xE9ro au format E.164", - credit_card: "num\xE9ro de carte de cr\xE9dit", - jwt: "JWT", - template_literal: "entr\xE9e" - }; - const TypeDictionary = { - string: "cha\xEEne de caract\xE8res", - number: "nombre", - int: "entier", - boolean: "bool\xE9en", - bigint: "grand entier", - symbol: "symbole", - undefined: "ind\xE9fini", - null: "null", - never: "jamais", - void: "vide", - date: "date", - array: "tableau", - object: "objet", - tuple: "tuple", - record: "record", - map: "map", - set: "ensemble", - file: "fichier", - nonoptional: "non optionnel", - nan: "NaN", - function: "fonction" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Entr\xE9e invalide : instance de ${issue2.expected} attendu, ${received} re\xE7u`; - } - return `Entr\xE9e invalide : ${expected} attendu, ${received} re\xE7u`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Entr\xE9e invalide : ${stringifyPrimitive(issue2.values[0])} attendu`; - return `Option invalide : une valeur parmi ${joinValues(issue2.values, "|")} attendue`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Trop grand : ${TypeDictionary[issue2.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\xE9l\xE9ment(s)"}`; - return `Trop grand : ${TypeDictionary[issue2.origin] ?? "valeur"} doit \xEAtre ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Trop petit : ${TypeDictionary[issue2.origin] ?? "valeur"} doit ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - return `Trop petit : ${TypeDictionary[issue2.origin] ?? "valeur"} doit \xEAtre ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Cha\xEEne de caract\xE8res invalide : doit commencer par "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Cha\xEEne de caract\xE8res invalide : doit se terminer par "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Cha\xEEne de caract\xE8res invalide : doit inclure "${_issue.includes}"`; - if (_issue.format === "regex") - return `Cha\xEEne de caract\xE8res invalide : doit correspondre au motif ${_issue.pattern}`; - return `${FormatDictionary[_issue.format] ?? issue2.format} invalide`; - } - case "not_multiple_of": - return `Nombre invalide : doit \xEAtre un multiple de ${issue2.divisor}`; - case "unrecognized_keys": - return `Cl\xE9${issue2.keys.length > 1 ? "s" : ""} non reconnue${issue2.keys.length > 1 ? "s" : ""} : ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Cl\xE9 invalide dans ${issue2.origin}`; - case "invalid_union": - return "Entr\xE9e invalide"; - case "invalid_element": - return `Valeur invalide dans ${issue2.origin}`; - default: - return `Entr\xE9e invalide`; - } - }; -}; -function fr_default() { - return { - localeError: error17() - }; -} - -// node_modules/zod/v4/locales/fr-CA.js -var error18 = () => { - const Sizable = { - string: { unit: "caract\xE8res", verb: "avoir" }, - file: { unit: "octets", verb: "avoir" }, - array: { unit: "\xE9l\xE9ments", verb: "avoir" }, - set: { unit: "\xE9l\xE9ments", verb: "avoir" }, - map: { unit: "\xE9l\xE9ments", verb: "avoir" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "entr\xE9e", - 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\xE9e ISO", - ipv4: "adresse IPv4", - ipv6: "adresse IPv6", - mac: "adresse MAC", - cidrv4: "plage IPv4", - cidrv6: "plage IPv6", - base64: "cha\xEEne encod\xE9e en base64", - base64url: "cha\xEEne encod\xE9e en base64url", - json_string: "cha\xEEne JSON", - e164: "num\xE9ro E.164", - credit_card: "num\xE9ro de carte de cr\xE9dit", - jwt: "JWT", - template_literal: "entr\xE9e" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Entr\xE9e invalide : attendu instanceof ${issue2.expected}, re\xE7u ${received}`; - } - return `Entr\xE9e invalide : attendu ${expected}, re\xE7u ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Entr\xE9e invalide : attendu ${stringifyPrimitive(issue2.values[0])}`; - return `Option invalide : attendu l'une des valeurs suivantes ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "\u2264" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Trop grand : attendu que ${issue2.origin ?? "la valeur"} ait ${adj}${issue2.maximum.toString()} ${sizing.unit}`; - return `Trop grand : attendu que ${issue2.origin ?? "la valeur"} soit ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? "\u2265" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Trop petit : attendu que ${issue2.origin} ait ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Trop petit : attendu que ${issue2.origin} soit ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `Cha\xEEne invalide : doit commencer par "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `Cha\xEEne invalide : doit se terminer par "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Cha\xEEne invalide : doit inclure "${_issue.includes}"`; - if (_issue.format === "regex") - return `Cha\xEEne invalide : doit correspondre au motif ${_issue.pattern}`; - return `${FormatDictionary[_issue.format] ?? issue2.format} invalide`; - } - case "not_multiple_of": - return `Nombre invalide : doit \xEAtre un multiple de ${issue2.divisor}`; - case "unrecognized_keys": - return `Cl\xE9${issue2.keys.length > 1 ? "s" : ""} non reconnue${issue2.keys.length > 1 ? "s" : ""} : ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Cl\xE9 invalide dans ${issue2.origin}`; - case "invalid_union": - return "Entr\xE9e invalide"; - case "invalid_element": - return `Valeur invalide dans ${issue2.origin}`; - default: - return `Entr\xE9e invalide`; - } - }; -}; -function fr_CA_default() { - return { - localeError: error18() - }; -} - -// node_modules/zod/v4/locales/gu.js -var error19 = () => { - const Sizable = { - string: { unit: "\u0A85\u0A95\u0ACD\u0AB7\u0AB0", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" }, - file: { unit: "\u0AAC\u0ABE\u0AAF\u0A9F", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" }, - array: { unit: "\u0A86\u0A87\u0A9F\u0AAE", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" }, - set: { unit: "\u0A86\u0A87\u0A9F\u0AAE", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" }, - map: { unit: "\u0A8F\u0AA8\u0ACD\u0A9F\u0ACD\u0AB0\u0AC0", verb: "\u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0A87\u0AA8\u0AAA\u0AC1\u0A9F", - email: "\u0A88\u0AAE\u0AC7\u0A87\u0AB2 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8", - url: "URL", - emoji: "\u0A87\u0AAE\u0ACB\u0A9C\u0AC0", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO \u0AA4\u0ABE\u0AB0\u0AC0\u0A96 \u0A85\u0AA8\u0AC7 \u0AB8\u0AAE\u0AAF", - date: "ISO \u0AA4\u0ABE\u0AB0\u0AC0\u0A96", - time: "ISO \u0AB8\u0AAE\u0AAF", - duration: "ISO \u0A85\u0AB5\u0AA7\u0ABF", - ipv4: "IPv4 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8", - ipv6: "IPv6 \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8", - mac: "MAC \u0A8F\u0AA1\u0ACD\u0AB0\u0AC7\u0AB8", - cidrv4: "IPv4 \u0AB6\u0ACD\u0AB0\u0AC7\u0AA3\u0AC0", - cidrv6: "IPv6 \u0AB6\u0ACD\u0AB0\u0AC7\u0AA3\u0AC0", - base64: "base64-\u0A8F\u0AA8\u0ACD\u0A95\u0ACB\u0AA1\u0AC7\u0AA1 \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97", - base64url: "base64url-\u0A8F\u0AA8\u0ACD\u0A95\u0ACB\u0AA1\u0AC7\u0AA1 \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97", - json_string: "JSON \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97", - e164: "E.164 \u0AA8\u0A82\u0AAC\u0AB0", - credit_card: "\u0A95\u0ACD\u0AB0\u0AC7\u0AA1\u0ABF\u0A9F \u0A95\u0ABE\u0AB0\u0ACD\u0AA1 \u0AA8\u0A82\u0AAC\u0AB0", - jwt: "JWT", - template_literal: "\u0A87\u0AA8\u0AAA\u0AC1\u0A9F" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F: \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${expected}, \u0AAA\u0ACD\u0AB0\u0ABE\u0AAA\u0ACD\u0AA4 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F: \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${stringifyPrimitive(issue2.values[0])}`; - return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB5\u0ABF\u0A95\u0AB2\u0ACD\u0AAA: ${joinValues(issue2.values, " | ")} \u0AAE\u0ABE\u0AA7\u0ACD\u0AAF\u0AAE\u0AA5\u0AC0 \u0A8F\u0A95 \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u0A96\u0AC2\u0AAC \u0AAE\u0ACB\u0A9F\u0AC1\u0A82: ${issue2.origin ?? "\u0AAE\u0AC2\u0AB2\u0ACD\u0AAF"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0A8F\u0AB2\u0ABF\u0AAE\u0AC7\u0AA8\u0ACD\u0A9F"} \u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F`; - return `\u0A96\u0AC2\u0AAC \u0AAE\u0ACB\u0A9F\u0AC1\u0A82: ${issue2.origin ?? "\u0AAE\u0AC2\u0AB2\u0ACD\u0AAF"} ${adj}${issue2.maximum.toString()} \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u0A96\u0AC2\u0AAC \u0AA8\u0ABE\u0AA8\u0AC1\u0A82: ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} \u0AB9\u0ACB\u0AB5\u0ABE \u0A9C\u0ACB\u0A88\u0A8F`; - } - return `\u0A96\u0AC2\u0AAC \u0AA8\u0ABE\u0AA8\u0AC1\u0A82: ${issue2.origin} ${adj}${issue2.minimum.toString()} \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${_issue.prefix}" \u0AA5\u0AC0 \u0AB6\u0AB0\u0AC2 \u0AA5\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`; - } - if (_issue.format === "ends_with") - return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${_issue.suffix}" \u0AAA\u0AB0 \u0AB8\u0AAE\u0ABE\u0AAA\u0ACD\u0AA4 \u0AA5\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`; - if (_issue.format === "includes") - return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: "${_issue.includes}" \u0AB6\u0ABE\u0AAE\u0AC7\u0AB2 \u0AB9\u0ACB\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`; - if (_issue.format === "regex") - return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AB8\u0ACD\u0A9F\u0ACD\u0AB0\u0ABF\u0A82\u0A97: \u0AAA\u0AC7\u0A9F\u0AB0\u0ACD\u0AA8 ${_issue.pattern} \u0AB8\u0ABE\u0AA5\u0AC7 \u0AAE\u0AC7\u0AB3 \u0A96\u0ABE\u0AB5\u0AC1\u0A82 \u0A9C\u0ACB\u0A88\u0A8F`; - return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AA8\u0A82\u0AAC\u0AB0: ${issue2.divisor} \u0AA8\u0ACB \u0A97\u0AC1\u0AA3\u0ABE\u0A82\u0A95 \u0AB9\u0ACB\u0AB5\u0ACB \u0A9C\u0ACB\u0A88\u0A8F`; - case "unrecognized_keys": - return `\u0A93\u0AB3\u0A96\u0AC0 \u0AB6\u0A95\u0ABE\u0AA4\u0ABE \u0AA8\u0AB9\u0AC0\u0A82 \u0AA4\u0AC7 \u0A95\u0AC0${issue2.keys.length > 1 ? "\u0A93" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `${issue2.origin} \u0AAE\u0ABE\u0A82 \u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A95\u0AC0`; - case "invalid_union": - if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { - const opts = issue2.options.map((o) => `'${o}'`).join(" | "); - return `\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AA1\u0ABF\u0AB8\u0ACD\u0A95\u0ACD\u0AB0\u0ABF\u0AAE\u0ABF\u0AA8\u0AC7\u0A9F\u0AB0 \u0AAE\u0AC2\u0AB2\u0ACD\u0AAF. \u0A85\u0AAA\u0AC7\u0A95\u0ACD\u0AB7\u0ABF\u0AA4 ${opts}`; - } - return "\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F"; - case "invalid_element": - return `${issue2.origin} \u0AAE\u0ABE\u0A82 \u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0AAE\u0AC2\u0AB2\u0ACD\u0AAF`; - default: - return "\u0A85\u0AAE\u0ABE\u0AA8\u0ACD\u0AAF \u0A87\u0AA8\u0AAA\u0AC1\u0A9F"; - } - }; -}; -function gu_default() { - return { - localeError: error19() - }; -} - -// node_modules/zod/v4/locales/he.js -var error20 = () => { - const TypeNames = { - string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA", gender: "f" }, - number: { label: "\u05DE\u05E1\u05E4\u05E8", gender: "m" }, - boolean: { label: "\u05E2\u05E8\u05DA \u05D1\u05D5\u05DC\u05D9\u05D0\u05E0\u05D9", gender: "m" }, - bigint: { label: "BigInt", gender: "m" }, - date: { label: "\u05EA\u05D0\u05E8\u05D9\u05DA", gender: "m" }, - array: { label: "\u05DE\u05E2\u05E8\u05DA", gender: "m" }, - object: { label: "\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8", gender: "m" }, - null: { label: "\u05E2\u05E8\u05DA \u05E8\u05D9\u05E7 (null)", gender: "m" }, - undefined: { label: "\u05E2\u05E8\u05DA \u05DC\u05D0 \u05DE\u05D5\u05D2\u05D3\u05E8 (undefined)", gender: "m" }, - symbol: { label: "\u05E1\u05D9\u05DE\u05D1\u05D5\u05DC (Symbol)", gender: "m" }, - function: { label: "\u05E4\u05D5\u05E0\u05E7\u05E6\u05D9\u05D4", gender: "f" }, - map: { label: "\u05DE\u05E4\u05D4 (Map)", gender: "f" }, - set: { label: "\u05E7\u05D1\u05D5\u05E6\u05D4 (Set)", gender: "f" }, - file: { label: "\u05E7\u05D5\u05D1\u05E5", gender: "m" }, - promise: { label: "Promise", gender: "m" }, - NaN: { label: "NaN", gender: "m" }, - unknown: { label: "\u05E2\u05E8\u05DA \u05DC\u05D0 \u05D9\u05D3\u05D5\u05E2", gender: "m" }, - value: { label: "\u05E2\u05E8\u05DA", gender: "m" } - }; - const Sizable = { - string: { unit: "\u05EA\u05D5\u05D5\u05D9\u05DD", shortLabel: "\u05E7\u05E6\u05E8", longLabel: "\u05D0\u05E8\u05D5\u05DA" }, - file: { unit: "\u05D1\u05D9\u05D9\u05D8\u05D9\u05DD", shortLabel: "\u05E7\u05D8\u05DF", longLabel: "\u05D2\u05D3\u05D5\u05DC" }, - array: { unit: "\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD", shortLabel: "\u05E7\u05D8\u05DF", longLabel: "\u05D2\u05D3\u05D5\u05DC" }, - set: { unit: "\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD", shortLabel: "\u05E7\u05D8\u05DF", longLabel: "\u05D2\u05D3\u05D5\u05DC" }, - number: { unit: "", shortLabel: "\u05E7\u05D8\u05DF", longLabel: "\u05D2\u05D3\u05D5\u05DC" } - // no unit - }; - const typeEntry = (t) => t ? TypeNames[t] : void 0; - const typeLabel = (t) => { - const e = typeEntry(t); - if (e) - return e.label; - return t ?? TypeNames.unknown.label; - }; - const withDefinite = (t) => `\u05D4${typeLabel(t)}`; - const verbFor = (t) => { - const e = typeEntry(t); - const gender = e?.gender ?? "m"; - return gender === "f" ? "\u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05D9\u05D5\u05EA" : "\u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA"; - }; - const getSizing = (origin) => { - if (!origin) - return null; - return Sizable[origin] ?? null; - }; - const FormatDictionary = { - regex: { label: "\u05E7\u05DC\u05D8", gender: "m" }, - email: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC", gender: "f" }, - url: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA \u05E8\u05E9\u05EA", gender: "f" }, - emoji: { label: "\u05D0\u05D9\u05DE\u05D5\u05D2'\u05D9", gender: "m" }, - uuid: { label: "UUID", gender: "m" }, - uuidv4: { label: "UUIDv4", gender: "m" }, - uuidv6: { label: "UUIDv6", gender: "m" }, - nanoid: { label: "nanoid", gender: "m" }, - guid: { label: "GUID", gender: "m" }, - cuid: { label: "cuid", gender: "m" }, - cuid2: { label: "cuid2", gender: "m" }, - ulid: { label: "ULID", gender: "m" }, - xid: { label: "XID", gender: "m" }, - ksuid: { label: "KSUID", gender: "m" }, - datetime: { label: "\u05EA\u05D0\u05E8\u05D9\u05DA \u05D5\u05D6\u05DE\u05DF ISO", gender: "m" }, - date: { label: "\u05EA\u05D0\u05E8\u05D9\u05DA ISO", gender: "m" }, - time: { label: "\u05D6\u05DE\u05DF ISO", gender: "m" }, - duration: { label: "\u05DE\u05E9\u05DA \u05D6\u05DE\u05DF ISO", gender: "m" }, - ipv4: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA IPv4", gender: "f" }, - ipv6: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA IPv6", gender: "f" }, - mac: { label: "\u05DB\u05EA\u05D5\u05D1\u05EA MAC", gender: "f" }, - cidrv4: { label: "\u05D8\u05D5\u05D5\u05D7 IPv4", gender: "m" }, - cidrv6: { label: "\u05D8\u05D5\u05D5\u05D7 IPv6", gender: "m" }, - base64: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64", gender: "f" }, - base64url: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D1\u05D1\u05E1\u05D9\u05E1 64 \u05DC\u05DB\u05EA\u05D5\u05D1\u05D5\u05EA \u05E8\u05E9\u05EA", gender: "f" }, - json_string: { label: "\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA JSON", gender: "f" }, - e164: { label: "\u05DE\u05E1\u05E4\u05E8 E.164", gender: "m" }, - credit_card: { label: "\u05DE\u05E1\u05E4\u05E8 \u05DB\u05E8\u05D8\u05D9\u05E1 \u05D0\u05E9\u05E8\u05D0\u05D9", gender: "m" }, - jwt: { label: "JWT", gender: "m" }, - template_literal: { label: "\u05E7\u05DC\u05D8", gender: "m" }, - ends_with: { label: "\u05E7\u05DC\u05D8", gender: "m" }, - includes: { label: "\u05E7\u05DC\u05D8", gender: "m" }, - lowercase: { label: "\u05E7\u05DC\u05D8", gender: "m" }, - starts_with: { label: "\u05E7\u05DC\u05D8", gender: "m" }, - uppercase: { label: "\u05E7\u05DC\u05D8", gender: "m" } - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expectedKey = issue2.expected; - const expected = TypeDictionary[expectedKey ?? ""] ?? typeLabel(expectedKey); - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? TypeNames[receivedType]?.label ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA instanceof ${issue2.expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${received}`; - } - return `\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${expected}, \u05D4\u05EA\u05E7\u05D1\u05DC ${received}`; - } - case "invalid_value": { - if (issue2.values.length === 1) { - return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05E2\u05E8\u05DA \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA ${stringifyPrimitive(issue2.values[0])}`; - } - const stringified = issue2.values.map((v) => stringifyPrimitive(v)); - if (issue2.values.length === 2) { - return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${stringified[0]} \u05D0\u05D5 ${stringified[1]}`; - } - const lastValue = stringified[stringified.length - 1]; - const restValues = stringified.slice(0, -1).join(", "); - return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D4\u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA \u05D4\u05DE\u05EA\u05D0\u05D9\u05DE\u05D5\u05EA \u05D4\u05DF ${restValues} \u05D0\u05D5 ${lastValue}`; - } - case "too_big": { - const sizing = getSizing(issue2.origin); - const subject = withDefinite(issue2.origin ?? "value"); - if (issue2.origin === "string") { - return `${sizing?.longLabel ?? "\u05D0\u05E8\u05D5\u05DA"} \u05DE\u05D3\u05D9: ${subject} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${issue2.maximum.toString()} ${sizing?.unit ?? ""} ${issue2.inclusive ? "\u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA" : "\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8"}`.trim(); - } - if (issue2.origin === "number") { - const comparison = issue2.inclusive ? `\u05E7\u05D8\u05DF \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${issue2.maximum}` : `\u05E7\u05D8\u05DF \u05DE-${issue2.maximum}`; - return `\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${subject} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${comparison}`; - } - if (issue2.origin === "array" || issue2.origin === "set") { - const verb = issue2.origin === "set" ? "\u05E6\u05E8\u05D9\u05DB\u05D4" : "\u05E6\u05E8\u05D9\u05DA"; - const comparison = issue2.inclusive ? `${issue2.maximum} ${sizing?.unit ?? ""} \u05D0\u05D5 \u05E4\u05D7\u05D5\u05EA` : `\u05E4\u05D7\u05D5\u05EA \u05DE-${issue2.maximum} ${sizing?.unit ?? ""}`; - return `\u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${comparison}`.trim(); - } - const adj = issue2.inclusive ? "<=" : "<"; - const be = verbFor(issue2.origin ?? "value"); - if (sizing?.unit) { - return `${sizing.longLabel} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.maximum.toString()} ${sizing.unit}`; - } - return `${sizing?.longLabel ?? "\u05D2\u05D3\u05D5\u05DC"} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const sizing = getSizing(issue2.origin); - const subject = withDefinite(issue2.origin ?? "value"); - if (issue2.origin === "string") { - return `${sizing?.shortLabel ?? "\u05E7\u05E6\u05E8"} \u05DE\u05D3\u05D9: ${subject} \u05E6\u05E8\u05D9\u05DB\u05D4 \u05DC\u05D4\u05DB\u05D9\u05DC ${issue2.minimum.toString()} ${sizing?.unit ?? ""} ${issue2.inclusive ? "\u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8" : "\u05DC\u05E4\u05D7\u05D5\u05EA"}`.trim(); - } - if (issue2.origin === "number") { - const comparison = issue2.inclusive ? `\u05D2\u05D3\u05D5\u05DC \u05D0\u05D5 \u05E9\u05D5\u05D5\u05D4 \u05DC-${issue2.minimum}` : `\u05D2\u05D3\u05D5\u05DC \u05DE-${issue2.minimum}`; - return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject} \u05E6\u05E8\u05D9\u05DA \u05DC\u05D4\u05D9\u05D5\u05EA ${comparison}`; - } - if (issue2.origin === "array" || issue2.origin === "set") { - const verb = issue2.origin === "set" ? "\u05E6\u05E8\u05D9\u05DB\u05D4" : "\u05E6\u05E8\u05D9\u05DA"; - if (issue2.minimum === 1 && issue2.inclusive) { - const singularPhrase = issue2.origin === "set" ? "\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3" : "\u05DC\u05E4\u05D7\u05D5\u05EA \u05E4\u05E8\u05D9\u05D8 \u05D0\u05D7\u05D3"; - return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${singularPhrase}`; - } - const comparison = issue2.inclusive ? `${issue2.minimum} ${sizing?.unit ?? ""} \u05D0\u05D5 \u05D9\u05D5\u05EA\u05E8` : `\u05D9\u05D5\u05EA\u05E8 \u05DE-${issue2.minimum} ${sizing?.unit ?? ""}`; - return `\u05E7\u05D8\u05DF \u05DE\u05D3\u05D9: ${subject} ${verb} \u05DC\u05D4\u05DB\u05D9\u05DC ${comparison}`.trim(); - } - const adj = issue2.inclusive ? ">=" : ">"; - const be = verbFor(issue2.origin ?? "value"); - if (sizing?.unit) { - return `${sizing.shortLabel} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `${sizing?.shortLabel ?? "\u05E7\u05D8\u05DF"} \u05DE\u05D3\u05D9: ${subject} ${be} ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D7\u05D9\u05DC \u05D1 "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05E1\u05EA\u05D9\u05D9\u05DD \u05D1 "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05DB\u05DC\u05D5\u05DC "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u05D4\u05DE\u05D7\u05E8\u05D5\u05D6\u05EA \u05D7\u05D9\u05D9\u05D1\u05EA \u05DC\u05D4\u05EA\u05D0\u05D9\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA ${_issue.pattern}`; - const nounEntry = FormatDictionary[_issue.format]; - const noun = nounEntry?.label ?? _issue.format; - const gender = nounEntry?.gender ?? "m"; - const adjective = gender === "f" ? "\u05EA\u05E7\u05D9\u05E0\u05D4" : "\u05EA\u05E7\u05D9\u05DF"; - return `${noun} \u05DC\u05D0 ${adjective}`; - } - case "not_multiple_of": - return `\u05DE\u05E1\u05E4\u05E8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF: \u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DE\u05DB\u05E4\u05DC\u05D4 \u05E9\u05DC ${issue2.divisor}`; - case "unrecognized_keys": - return `\u05DE\u05E4\u05EA\u05D7${issue2.keys.length > 1 ? "\u05D5\u05EA" : ""} \u05DC\u05D0 \u05DE\u05D6\u05D5\u05D4${issue2.keys.length > 1 ? "\u05D9\u05DD" : "\u05D4"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": { - return `\u05E9\u05D3\u05D4 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1\u05D0\u05D5\u05D1\u05D9\u05D9\u05E7\u05D8`; - } - case "invalid_union": - return "\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF"; - case "invalid_element": { - const place = withDefinite(issue2.origin ?? "array"); - return `\u05E2\u05E8\u05DA \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF \u05D1${place}`; - } - default: - return `\u05E7\u05DC\u05D8 \u05DC\u05D0 \u05EA\u05E7\u05D9\u05DF`; - } - }; -}; -function he_default() { - return { - localeError: error20() - }; -} - -// node_modules/zod/v4/locales/hi.js -var error21 = () => { - const Sizable = { - string: { unit: "\u0905\u0915\u094D\u0937\u0930", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" }, - file: { unit: "\u092C\u093E\u0907\u091F\u094D\u0938", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" }, - array: { unit: "\u0924\u0924\u094D\u0935", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" }, - set: { unit: "\u0924\u0924\u094D\u0935", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" }, - map: { unit: "\u092A\u094D\u0930\u0935\u093F\u0937\u094D\u091F\u093F\u092F\u093E\u0901", verb: "\u0930\u0916\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0907\u0928\u092A\u0941\u091F", - email: "\u0908\u092E\u0947\u0932 \u092A\u0924\u093E", - url: "URL", - emoji: "\u0907\u092E\u094B\u091C\u0940", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO \u0924\u093F\u0925\u093F \u0914\u0930 \u0938\u092E\u092F", - date: "ISO \u0924\u093F\u0925\u093F", - time: "ISO \u0938\u092E\u092F", - duration: "ISO \u0905\u0935\u0927\u093F", - ipv4: "IPv4 \u092A\u0924\u093E", - ipv6: "IPv6 \u092A\u0924\u093E", - mac: "MAC \u092A\u0924\u093E", - cidrv4: "IPv4 \u0936\u094D\u0930\u0947\u0923\u0940", - cidrv6: "IPv6 \u0936\u094D\u0930\u0947\u0923\u0940", - base64: "Base64-\u090F\u0928\u094D\u0915\u094B\u0921\u0947\u0921 \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917", - base64url: "Base64URL-\u090F\u0928\u094D\u0915\u094B\u0921\u0947\u0921 \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917", - json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917", - e164: "E.164 \u0938\u0902\u0916\u094D\u092F\u093E", - credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0938\u0902\u0916\u094D\u092F\u093E", - jwt: "JWT", - template_literal: "\u0907\u0928\u092A\u0941\u091F" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${expected}, \u092A\u094D\u0930\u093E\u092A\u094D\u0924 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${stringifyPrimitive(issue2.values[0])}`; - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0935\u093F\u0915\u0932\u094D\u092A: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u092E\u093E\u0928\u094B\u0902 \u092E\u0947\u0902 \u0938\u0947 \u090F\u0915 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u092C\u0939\u0941\u0924 \u092C\u0921\u093C\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${issue2.origin ?? "\u092E\u093E\u0928"} \u092E\u0947\u0902 ${adj}${issue2.maximum} ${sizing.unit} \u0939\u094B\u0902`; - return `\u092C\u0939\u0941\u0924 \u092C\u0921\u093C\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${issue2.origin ?? "\u092E\u093E\u0928"} ${adj}${issue2.maximum} \u0939\u094B`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u092C\u0939\u0941\u0924 \u091B\u094B\u091F\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${issue2.origin} \u092E\u0947\u0902 ${adj}${issue2.minimum} ${sizing.unit} \u0939\u094B\u0902`; - return `\u092C\u0939\u0941\u0924 \u091B\u094B\u091F\u093E: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u0925\u093E \u0915\u093F ${issue2.origin} ${adj}${issue2.minimum} \u0939\u094B`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: "${_issue.prefix}" \u0938\u0947 \u0936\u0941\u0930\u0942 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`; - if (_issue.format === "ends_with") - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: "${_issue.suffix}" \u092A\u0930 \u0938\u092E\u093E\u092A\u094D\u0924 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`; - if (_issue.format === "includes") - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: \u0907\u0938\u092E\u0947\u0902 "${_issue.includes}" \u0936\u093E\u092E\u093F\u0932 \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`; - if (_issue.format === "regex") - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0902\u0917: \u092A\u0948\u091F\u0930\u094D\u0928 ${_issue.pattern} \u0938\u0947 \u092E\u0947\u0932 \u0916\u093E\u0928\u093E \u091A\u093E\u0939\u093F\u090F`; - return `\u0905\u092E\u093E\u0928\u094D\u092F ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u0902\u0916\u094D\u092F\u093E: \u092F\u0939 ${issue2.divisor} \u0915\u093E \u0917\u0941\u0923\u091C \u0939\u094B\u0928\u093E \u091A\u093E\u0939\u093F\u090F`; - case "unrecognized_keys": - return `\u0905\u092A\u0930\u093F\u091A\u093F\u0924 \u0915\u0941\u0902\u091C\u0940${issue2.keys.length > 1 ? "\u092F\u093E\u0901" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0915\u0941\u0902\u091C\u0940: ${issue2.origin} \u092E\u0947\u0902`; - case "invalid_union": - if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { - const opts = issue2.options.map((o) => `'${o}'`).join(" | "); - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0921\u093F\u0938\u094D\u0915\u094D\u0930\u093F\u092E\u093F\u0928\u0947\u091F\u0930 \u092E\u093E\u0928: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${opts}`; - } - return "\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F"; - case "invalid_element": - return `\u0905\u092E\u093E\u0928\u094D\u092F \u092E\u093E\u0928: ${issue2.origin} \u092E\u0947\u0902`; - default: - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F`; - } - }; -}; -function hi_default() { - return { - localeError: error21() - }; -} - -// node_modules/zod/v4/locales/hr.js -var error22 = () => { - const Sizable = { - string: { unit: "znakova", verb: "imati" }, - file: { unit: "bajtova", verb: "imati" }, - array: { unit: "stavki", verb: "imati" }, - set: { unit: "stavki", verb: "imati" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "unos", - email: "email 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: "ISO datum i vrijeme", - date: "ISO datum", - time: "ISO vrijeme", - duration: "ISO trajanje", - ipv4: "IPv4 adresa", - ipv6: "IPv6 adresa", - mac: "MAC adresa", - cidrv4: "IPv4 raspon", - cidrv6: "IPv6 raspon", - base64: "base64 kodirani tekst", - base64url: "base64url kodirani tekst", - json_string: "JSON tekst", - e164: "E.164 broj", - credit_card: "broj kreditne kartice", - jwt: "JWT", - template_literal: "unos" - }; - const TypeDictionary = { - nan: "NaN", - string: "tekst", - number: "broj", - boolean: "boolean", - array: "niz", - object: "objekt", - set: "skup", - file: "datoteka", - date: "datum", - bigint: "bigint", - symbol: "simbol", - undefined: "undefined", - null: "null", - function: "funkcija", - map: "mapa" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Neispravan unos: o\u010Dekuje se instanceof ${issue2.expected}, a primljeno je ${received}`; - } - return `Neispravan unos: o\u010Dekuje se ${expected}, a primljeno je ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Neispravna vrijednost: o\u010Dekivano ${stringifyPrimitive(issue2.values[0])}`; - return `Neispravna opcija: o\u010Dekivano jedno od ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - const origin = TypeDictionary[issue2.origin] ?? issue2.origin; - if (sizing) - return `Preveliko: o\u010Dekivano da ${origin ?? "vrijednost"} ima ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemenata"}`; - return `Preveliko: o\u010Dekivano da ${origin ?? "vrijednost"} bude ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - const origin = TypeDictionary[issue2.origin] ?? issue2.origin; - if (sizing) { - return `Premalo: o\u010Dekivano da ${origin} ima ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Premalo: o\u010Dekivano da ${origin} bude ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Neispravan tekst: mora zapo\u010Dinjati s "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Neispravan tekst: mora zavr\u0161avati s "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Neispravan tekst: mora sadr\u017Eavati "${_issue.includes}"`; - if (_issue.format === "regex") - return `Neispravan tekst: mora odgovarati uzorku ${_issue.pattern}`; - return `Neispravna ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Neispravan broj: mora biti vi\u0161ekratnik od ${issue2.divisor}`; - case "unrecognized_keys": - return `Neprepoznat${issue2.keys.length > 1 ? "i klju\u010Devi" : " klju\u010D"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Neispravan klju\u010D u ${TypeDictionary[issue2.origin] ?? issue2.origin}`; - case "invalid_union": - return "Neispravan unos"; - case "invalid_element": - return `Neispravna vrijednost u ${TypeDictionary[issue2.origin] ?? issue2.origin}`; - default: - return `Neispravan unos`; - } - }; -}; -function hr_default() { - return { - localeError: error22() - }; -} - -// node_modules/zod/v4/locales/hu.js -var error23 = () => { - const Sizable = { - string: { unit: "karakter", verb: "legyen" }, - file: { unit: "byte", verb: "legyen" }, - array: { unit: "elem", verb: "legyen" }, - set: { unit: "elem", verb: "legyen" }, - map: { unit: "elem", verb: "legyen" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "bemenet", - email: "email c\xEDm", - 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\u0151b\xE9lyeg", - date: "ISO d\xE1tum", - time: "ISO id\u0151", - duration: "ISO id\u0151intervallum", - ipv4: "IPv4 c\xEDm", - ipv6: "IPv6 c\xEDm", - mac: "MAC c\xEDm", - cidrv4: "IPv4 tartom\xE1ny", - cidrv6: "IPv6 tartom\xE1ny", - base64: "base64-k\xF3dolt string", - base64url: "base64url-k\xF3dolt string", - json_string: "JSON string", - e164: "E.164 sz\xE1m", - credit_card: "hitelk\xE1rtyasz\xE1m", - jwt: "JWT", - template_literal: "bemenet" - }; - const TypeDictionary = { - nan: "NaN", - number: "sz\xE1m", - array: "t\xF6mb" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k instanceof ${issue2.expected}, a kapott \xE9rt\xE9k ${received}`; - } - return `\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${expected}, a kapott \xE9rt\xE9k ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\xC9rv\xE9nytelen bemenet: a v\xE1rt \xE9rt\xE9k ${stringifyPrimitive(issue2.values[0])}`; - return `\xC9rv\xE9nytelen opci\xF3: valamelyik \xE9rt\xE9k v\xE1rt ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `T\xFAl nagy: ${issue2.origin ?? "\xE9rt\xE9k"} m\xE9rete t\xFAl nagy ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elem"}`; - return `T\xFAl nagy: a bemeneti \xE9rt\xE9k ${issue2.origin ?? "\xE9rt\xE9k"} t\xFAl nagy: ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${issue2.origin} m\xE9rete t\xFAl kicsi ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `T\xFAl kicsi: a bemeneti \xE9rt\xE9k ${issue2.origin} t\xFAl kicsi ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\xC9rv\xE9nytelen string: "${_issue.prefix}" \xE9rt\xE9kkel kell kezd\u0151dnie`; - if (_issue.format === "ends_with") - return `\xC9rv\xE9nytelen string: "${_issue.suffix}" \xE9rt\xE9kkel kell v\xE9gz\u0151dnie`; - if (_issue.format === "includes") - return `\xC9rv\xE9nytelen string: "${_issue.includes}" \xE9rt\xE9ket kell tartalmaznia`; - if (_issue.format === "regex") - return `\xC9rv\xE9nytelen string: ${_issue.pattern} mint\xE1nak kell megfelelnie`; - return `\xC9rv\xE9nytelen ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\xC9rv\xE9nytelen sz\xE1m: ${issue2.divisor} t\xF6bbsz\xF6r\xF6s\xE9nek kell lennie`; - case "unrecognized_keys": - return `Ismeretlen kulcs${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\xC9rv\xE9nytelen kulcs ${issue2.origin}`; - case "invalid_union": - return "\xC9rv\xE9nytelen bemenet"; - case "invalid_element": - return `\xC9rv\xE9nytelen \xE9rt\xE9k: ${issue2.origin}`; - default: - return `\xC9rv\xE9nytelen bemenet`; - } - }; -}; -function hu_default() { - return { - localeError: error23() - }; -} - -// node_modules/zod/v4/locales/hy.js -function getArmenianPlural(count, one, many) { - return Math.abs(count) === 1 ? one : many; -} -function withDefiniteArticle(word) { - if (!word) - return ""; - const vowels = ["\u0561", "\u0565", "\u0568", "\u056B", "\u0578", "\u0578\u0582", "\u0585"]; - const lastChar = word[word.length - 1]; - return word + (vowels.includes(lastChar) ? "\u0576" : "\u0568"); -} -var error24 = () => { - const Sizable = { - string: { - unit: { - one: "\u0576\u0577\u0561\u0576", - many: "\u0576\u0577\u0561\u0576\u0576\u0565\u0580" - }, - verb: "\u0578\u0582\u0576\u0565\u0576\u0561\u056C" - }, - file: { - unit: { - one: "\u0562\u0561\u0575\u0569", - many: "\u0562\u0561\u0575\u0569\u0565\u0580" - }, - verb: "\u0578\u0582\u0576\u0565\u0576\u0561\u056C" - }, - array: { - unit: { - one: "\u057F\u0561\u0580\u0580", - many: "\u057F\u0561\u0580\u0580\u0565\u0580" - }, - verb: "\u0578\u0582\u0576\u0565\u0576\u0561\u056C" - }, - set: { - unit: { - one: "\u057F\u0561\u0580\u0580", - many: "\u057F\u0561\u0580\u0580\u0565\u0580" - }, - verb: "\u0578\u0582\u0576\u0565\u0576\u0561\u056C" - }, - map: { - unit: { - one: "\u057F\u0561\u0580\u0580", - many: "\u057F\u0561\u0580\u0580\u0565\u0580" - }, - verb: "\u0578\u0582\u0576\u0565\u0576\u0561\u056C" - } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0574\u0578\u0582\u057F\u0584", - email: "\u0567\u056C. \u0570\u0561\u057D\u0581\u0565", - url: "URL", - emoji: "\u0567\u0574\u0578\u057B\u056B", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E \u0587 \u056A\u0561\u0574", - date: "ISO \u0561\u0574\u057D\u0561\u0569\u056B\u057E", - time: "ISO \u056A\u0561\u0574", - duration: "ISO \u057F\u0587\u0578\u0572\u0578\u0582\u0569\u0575\u0578\u0582\u0576", - ipv4: "IPv4 \u0570\u0561\u057D\u0581\u0565", - ipv6: "IPv6 \u0570\u0561\u057D\u0581\u0565", - mac: "MAC \u0570\u0561\u057D\u0581\u0565", - cidrv4: "IPv4 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584", - cidrv6: "IPv6 \u0574\u056B\u057B\u0561\u056F\u0561\u0575\u0584", - base64: "base64 \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572", - base64url: "base64url \u0571\u0587\u0561\u0579\u0561\u0583\u0578\u057E \u057F\u0578\u0572", - json_string: "JSON \u057F\u0578\u0572", - e164: "E.164 \u0570\u0561\u0574\u0561\u0580", - credit_card: "\u056F\u0580\u0565\u0564\u056B\u057F \u0584\u0561\u0580\u057F\u056B \u0570\u0561\u0574\u0561\u0580", - jwt: "JWT", - template_literal: "\u0574\u0578\u0582\u057F\u0584" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u0569\u056B\u057E", - array: "\u0566\u0561\u0576\u0563\u057E\u0561\u056E" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 instanceof ${issue2.expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${received}`; - } - return `\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${expected}, \u057D\u057F\u0561\u0581\u057E\u0565\u056C \u0567 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 ${stringifyPrimitive(issue2.values[1])}`; - return `\u054D\u056D\u0561\u056C \u057F\u0561\u0580\u0562\u0565\u0580\u0561\u056F\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567\u0580 \u0570\u0565\u057F\u0587\u0575\u0561\u056C\u0576\u0565\u0580\u056B\u0581 \u0574\u0565\u056F\u0568\u055D ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) { - const maxValue = Number(issue2.maximum); - const unit = getArmenianPlural(maxValue, sizing.unit.one, sizing.unit.many); - return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin ?? "\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${adj}${issue2.maximum.toString()} ${unit}`; - } - return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin ?? "\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - const minValue = Number(issue2.minimum); - const unit = getArmenianPlural(minValue, sizing.unit.one, sizing.unit.many); - return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${adj}${issue2.minimum.toString()} ${unit}`; - } - return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin)} \u056C\u056B\u0576\u056B ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057D\u056F\u057D\u057E\u056B "${_issue.prefix}"-\u0578\u057E`; - if (_issue.format === "ends_with") - return `\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0561\u057E\u0561\u0580\u057F\u057E\u056B "${_issue.suffix}"-\u0578\u057E`; - if (_issue.format === "includes") - return `\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u057A\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u056B "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u054D\u056D\u0561\u056C \u057F\u0578\u0572\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0570\u0561\u0574\u0561\u057A\u0561\u057F\u0561\u057D\u056D\u0561\u0576\u056B ${_issue.pattern} \u0571\u0587\u0561\u0579\u0561\u0583\u056B\u0576`; - return `\u054D\u056D\u0561\u056C ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u054D\u056D\u0561\u056C \u0569\u056B\u057E\u2024 \u057A\u0565\u057F\u0584 \u0567 \u0562\u0561\u0566\u0574\u0561\u057A\u0561\u057F\u056B\u056F \u056C\u056B\u0576\u056B ${issue2.divisor}-\u056B`; - case "unrecognized_keys": - return `\u0549\u0573\u0561\u0576\u0561\u0579\u057E\u0561\u056E \u0562\u0561\u0576\u0561\u056C\u056B${issue2.keys.length > 1 ? "\u0576\u0565\u0580" : ""}. ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u054D\u056D\u0561\u056C \u0562\u0561\u0576\u0561\u056C\u056B ${withDefiniteArticle(issue2.origin)}-\u0578\u0582\u0574`; - case "invalid_union": - return "\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574"; - case "invalid_element": - return `\u054D\u056D\u0561\u056C \u0561\u0580\u056A\u0565\u0584 ${withDefiniteArticle(issue2.origin)}-\u0578\u0582\u0574`; - default: - return `\u054D\u056D\u0561\u056C \u0574\u0578\u0582\u057F\u0584\u0561\u0563\u0580\u0578\u0582\u0574`; - } - }; -}; -function hy_default() { - return { - localeError: error24() - }; -} - -// node_modules/zod/v4/locales/id.js -var error25 = () => { - const Sizable = { - string: { unit: "karakter", verb: "memiliki" }, - file: { unit: "byte", verb: "memiliki" }, - array: { unit: "item", verb: "memiliki" }, - set: { unit: "item", verb: "memiliki" }, - map: { unit: "item", verb: "memiliki" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - 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", - mac: "alamat MAC", - 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", - credit_card: "nomor kartu kredit", - jwt: "JWT", - template_literal: "input" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Input tidak valid: diharapkan instanceof ${issue2.expected}, diterima ${received}`; - } - return `Input tidak valid: diharapkan ${expected}, diterima ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Input tidak valid: diharapkan ${stringifyPrimitive(issue2.values[0])}`; - return `Pilihan tidak valid: diharapkan salah satu dari ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Terlalu besar: diharapkan ${issue2.origin ?? "value"} memiliki ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemen"}`; - return `Terlalu besar: diharapkan ${issue2.origin ?? "value"} menjadi ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Terlalu kecil: diharapkan ${issue2.origin} memiliki ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Terlalu kecil: diharapkan ${issue2.origin} menjadi ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `String tidak valid: harus dimulai dengan "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `String tidak valid: harus berakhir dengan "${_issue.suffix}"`; - if (_issue.format === "includes") - return `String tidak valid: harus menyertakan "${_issue.includes}"`; - if (_issue.format === "regex") - return `String tidak valid: harus sesuai pola ${_issue.pattern}`; - return `${FormatDictionary[_issue.format] ?? issue2.format} tidak valid`; - } - case "not_multiple_of": - return `Angka tidak valid: harus kelipatan dari ${issue2.divisor}`; - case "unrecognized_keys": - return `Kunci tidak dikenali ${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Kunci tidak valid di ${issue2.origin}`; - case "invalid_union": - return "Input tidak valid"; - case "invalid_element": - return `Nilai tidak valid di ${issue2.origin}`; - default: - return `Input tidak valid`; - } - }; -}; -function id_default() { - return { - localeError: error25() - }; -} - -// node_modules/zod/v4/locales/is.js -var error26 = () => { - const Sizable = { - string: { unit: "stafi", verb: "a\xF0 hafa" }, - file: { unit: "b\xE6ti", verb: "a\xF0 hafa" }, - array: { unit: "hluti", verb: "a\xF0 hafa" }, - set: { unit: "hluti", verb: "a\xF0 hafa" }, - map: { unit: "hluti", verb: "a\xF0 hafa" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "gildi", - email: "netfang", - url: "vefsl\xF3\xF0", - emoji: "emoji", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO dagsetning og t\xEDmi", - date: "ISO dagsetning", - time: "ISO t\xEDmi", - duration: "ISO t\xEDmalengd", - ipv4: "IPv4 address", - ipv6: "IPv6 address", - mac: "MAC address", - cidrv4: "IPv4 range", - cidrv6: "IPv6 range", - base64: "base64-encoded strengur", - base64url: "base64url-encoded strengur", - json_string: "JSON strengur", - e164: "E.164 t\xF6lugildi", - credit_card: "kreditkortan\xFAmer", - jwt: "JWT", - template_literal: "gildi" - }; - const TypeDictionary = { - nan: "NaN", - number: "n\xFAmer", - array: "fylki" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Rangt gildi: \xDE\xFA sl\xF3st inn ${received} \xFEar sem \xE1 a\xF0 vera instanceof ${issue2.expected}`; - } - return `Rangt gildi: \xDE\xFA sl\xF3st inn ${received} \xFEar sem \xE1 a\xF0 vera ${expected}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Rangt gildi: gert r\xE1\xF0 fyrir ${stringifyPrimitive(issue2.values[0])}`; - return `\xD3gilt val: m\xE1 vera eitt af eftirfarandi ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${issue2.origin ?? "gildi"} hafi ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "hluti"}`; - return `Of st\xF3rt: gert er r\xE1\xF0 fyrir a\xF0 ${issue2.origin ?? "gildi"} s\xE9 ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${issue2.origin} hafi ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Of l\xEDti\xF0: gert er r\xE1\xF0 fyrir a\xF0 ${issue2.origin} s\xE9 ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\xD3gildur strengur: ver\xF0ur a\xF0 byrja \xE1 "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `\xD3gildur strengur: ver\xF0ur a\xF0 enda \xE1 "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\xD3gildur strengur: ver\xF0ur a\xF0 innihalda "${_issue.includes}"`; - if (_issue.format === "regex") - return `\xD3gildur strengur: ver\xF0ur a\xF0 fylgja mynstri ${_issue.pattern}`; - return `Rangt ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `R\xF6ng tala: ver\xF0ur a\xF0 vera margfeldi af ${issue2.divisor}`; - case "unrecognized_keys": - return `\xD3\xFEekkt ${issue2.keys.length > 1 ? "ir lyklar" : "ur lykill"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Rangur lykill \xED ${issue2.origin}`; - case "invalid_union": - return "Rangt gildi"; - case "invalid_element": - return `Rangt gildi \xED ${issue2.origin}`; - default: - return `Rangt gildi`; - } - }; -}; -function is_default() { - return { - localeError: error26() - }; -} - -// node_modules/zod/v4/locales/it.js -var error27 = () => { - const Sizable = { - string: { unit: "caratteri", verb: "avere" }, - file: { unit: "byte", verb: "avere" }, - array: { unit: "elementi", verb: "avere" }, - set: { unit: "elementi", verb: "avere" }, - map: { unit: "elementi", verb: "avere" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - 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", - mac: "indirizzo MAC", - cidrv4: "intervallo IPv4", - cidrv6: "intervallo IPv6", - base64: "stringa codificata in base64", - base64url: "URL codificata in base64", - json_string: "stringa JSON", - e164: "numero E.164", - credit_card: "numero di carta di credito", - jwt: "JWT", - template_literal: "input" - }; - const TypeDictionary = { - nan: "NaN", - number: "numero", - array: "vettore" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Input non valido: atteso instanceof ${issue2.expected}, ricevuto ${received}`; - } - return `Input non valido: atteso ${expected}, ricevuto ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Input non valido: atteso ${stringifyPrimitive(issue2.values[0])}`; - return `Opzione non valida: atteso uno tra ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Troppo grande: ${issue2.origin ?? "valore"} deve avere ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementi"}`; - return `Troppo grande: ${issue2.origin ?? "valore"} deve essere ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Troppo piccolo: ${issue2.origin} deve avere ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Troppo piccolo: ${issue2.origin} deve essere ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Stringa non valida: deve iniziare con "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Stringa non valida: deve terminare con "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Stringa non valida: deve includere "${_issue.includes}"`; - if (_issue.format === "regex") - return `Stringa non valida: deve corrispondere al pattern ${_issue.pattern}`; - return `Input non valido: ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Numero non valido: deve essere un multiplo di ${issue2.divisor}`; - case "unrecognized_keys": - return `Chiav${issue2.keys.length > 1 ? "i" : "e"} non riconosciut${issue2.keys.length > 1 ? "e" : "a"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Chiave non valida in ${issue2.origin}`; - case "invalid_union": - return "Input non valido"; - case "invalid_element": - return `Valore non valido in ${issue2.origin}`; - default: - return `Input non valido`; - } - }; -}; -function it_default() { - return { - localeError: error27() - }; -} - -// node_modules/zod/v4/locales/ja.js -var error28 = () => { - const Sizable = { - string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" }, - file: { unit: "\u30D0\u30A4\u30C8", verb: "\u3067\u3042\u308B" }, - array: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" }, - set: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" }, - map: { unit: "\u8981\u7D20", verb: "\u3067\u3042\u308B" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u5165\u529B\u5024", - email: "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9", - url: "URL", - emoji: "\u7D75\u6587\u5B57", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO\u65E5\u6642", - date: "ISO\u65E5\u4ED8", - time: "ISO\u6642\u523B", - duration: "ISO\u671F\u9593", - ipv4: "IPv4\u30A2\u30C9\u30EC\u30B9", - ipv6: "IPv6\u30A2\u30C9\u30EC\u30B9", - mac: "MAC\u30A2\u30C9\u30EC\u30B9", - cidrv4: "IPv4\u7BC4\u56F2", - cidrv6: "IPv6\u7BC4\u56F2", - base64: "base64\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217", - base64url: "base64url\u30A8\u30F3\u30B3\u30FC\u30C9\u6587\u5B57\u5217", - json_string: "JSON\u6587\u5B57\u5217", - e164: "E.164\u756A\u53F7", - credit_card: "\u30AF\u30EC\u30B8\u30C3\u30C8\u30AB\u30FC\u30C9\u756A\u53F7", - jwt: "JWT", - template_literal: "\u5165\u529B\u5024" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u6570\u5024", - array: "\u914D\u5217" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u7121\u52B9\u306A\u5165\u529B: instanceof ${issue2.expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${received}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`; - } - return `\u7121\u52B9\u306A\u5165\u529B: ${expected}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F\u304C\u3001${received}\u304C\u5165\u529B\u3055\u308C\u307E\u3057\u305F`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u7121\u52B9\u306A\u5165\u529B: ${stringifyPrimitive(issue2.values[0])}\u304C\u671F\u5F85\u3055\u308C\u307E\u3057\u305F`; - return `\u7121\u52B9\u306A\u9078\u629E: ${joinValues(issue2.values, "\u3001")}\u306E\u3044\u305A\u308C\u304B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; - case "too_big": { - const adj = issue2.inclusive ? "\u4EE5\u4E0B\u3067\u3042\u308B" : "\u3088\u308A\u5C0F\u3055\u3044"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u5927\u304D\u3059\u304E\u308B\u5024: ${issue2.origin ?? "\u5024"}\u306F${issue2.maximum.toString()}${sizing.unit ?? "\u8981\u7D20"}${adj}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; - return `\u5927\u304D\u3059\u304E\u308B\u5024: ${issue2.origin ?? "\u5024"}\u306F${issue2.maximum.toString()}${adj}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; - } - case "too_small": { - const adj = issue2.inclusive ? "\u4EE5\u4E0A\u3067\u3042\u308B" : "\u3088\u308A\u5927\u304D\u3044"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u5C0F\u3055\u3059\u304E\u308B\u5024: ${issue2.origin}\u306F${issue2.minimum.toString()}${sizing.unit}${adj}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; - return `\u5C0F\u3055\u3059\u304E\u308B\u5024: ${issue2.origin}\u306F${issue2.minimum.toString()}${adj}\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\u7121\u52B9\u306A\u6587\u5B57\u5217: "${_issue.prefix}"\u3067\u59CB\u307E\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; - if (_issue.format === "ends_with") - return `\u7121\u52B9\u306A\u6587\u5B57\u5217: "${_issue.suffix}"\u3067\u7D42\u308F\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; - if (_issue.format === "includes") - return `\u7121\u52B9\u306A\u6587\u5B57\u5217: "${_issue.includes}"\u3092\u542B\u3080\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; - if (_issue.format === "regex") - return `\u7121\u52B9\u306A\u6587\u5B57\u5217: \u30D1\u30BF\u30FC\u30F3${_issue.pattern}\u306B\u4E00\u81F4\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; - return `\u7121\u52B9\u306A${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u7121\u52B9\u306A\u6570\u5024: ${issue2.divisor}\u306E\u500D\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`; - case "unrecognized_keys": - return `\u8A8D\u8B58\u3055\u308C\u3066\u3044\u306A\u3044\u30AD\u30FC${issue2.keys.length > 1 ? "\u7FA4" : ""}: ${joinValues(issue2.keys, "\u3001")}`; - case "invalid_key": - return `${issue2.origin}\u5185\u306E\u7121\u52B9\u306A\u30AD\u30FC`; - case "invalid_union": - return "\u7121\u52B9\u306A\u5165\u529B"; - case "invalid_element": - return `${issue2.origin}\u5185\u306E\u7121\u52B9\u306A\u5024`; - default: - return `\u7121\u52B9\u306A\u5165\u529B`; - } - }; -}; -function ja_default() { - return { - localeError: error28() - }; -} - -// node_modules/zod/v4/locales/ka.js -var error29 = () => { - const Sizable = { - string: { unit: "\u10E1\u10D8\u10DB\u10D1\u10DD\u10DA\u10DD", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }, - file: { unit: "\u10D1\u10D0\u10D8\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }, - array: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }, - set: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" }, - map: { unit: "\u10D4\u10DA\u10D4\u10DB\u10D4\u10DC\u10E2\u10D8", verb: "\u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0", - email: "\u10D4\u10DA-\u10E4\u10DD\u10E1\u10E2\u10D8\u10E1 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8", - url: "URL", - emoji: "\u10D4\u10DB\u10DD\u10EF\u10D8", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8-\u10D3\u10E0\u10DD", - date: "\u10D7\u10D0\u10E0\u10D8\u10E6\u10D8", - time: "\u10D3\u10E0\u10DD", - duration: "\u10EE\u10D0\u10DC\u10D2\u10E0\u10EB\u10DA\u10D8\u10D5\u10DD\u10D1\u10D0", - ipv4: "IPv4 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8", - ipv6: "IPv6 \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8", - mac: "MAC \u10DB\u10D8\u10E1\u10D0\u10DB\u10D0\u10E0\u10D7\u10D8", - cidrv4: "IPv4 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8", - cidrv6: "IPv6 \u10D3\u10D8\u10D0\u10DE\u10D0\u10D6\u10DD\u10DC\u10D8", - base64: "base64-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8", - base64url: "base64url-\u10D9\u10DD\u10D3\u10D8\u10E0\u10D4\u10D1\u10E3\u10DA\u10D8 \u10D5\u10D4\u10DA\u10D8", - json_string: "JSON \u10D5\u10D4\u10DA\u10D8", - e164: "E.164 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8", - credit_card: "\u10E1\u10D0\u10D9\u10E0\u10D4\u10D3\u10D8\u10E2\u10DD \u10D1\u10D0\u10E0\u10D0\u10D7\u10D8\u10E1 \u10DC\u10DD\u10DB\u10D4\u10E0\u10D8", - jwt: "JWT", - template_literal: "\u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u10E0\u10D8\u10EA\u10EE\u10D5\u10D8", - string: "\u10D5\u10D4\u10DA\u10D8", - boolean: "\u10D1\u10E3\u10DA\u10D4\u10D0\u10DC\u10D8", - function: "\u10E4\u10E3\u10DC\u10E5\u10EA\u10D8\u10D0", - array: "\u10DB\u10D0\u10E1\u10D8\u10D5\u10D8" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 instanceof ${issue2.expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${received}`; - } - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${expected}, \u10DB\u10D8\u10E6\u10D4\u10D1\u10E3\u10DA\u10D8 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${stringifyPrimitive(issue2.values[0])}`; - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D0\u10E0\u10D8\u10D0\u10DC\u10E2\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8\u10D0 \u10D4\u10E0\u10D7-\u10D4\u10E0\u10D7\u10D8 ${joinValues(issue2.values, "|")}-\u10D3\u10D0\u10DC`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.origin ?? "\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit}`; - return `\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10D3\u10D8\u10D3\u10D8: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.origin ?? "\u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0"} \u10D8\u10E7\u10DD\u10E1 ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `\u10D6\u10D4\u10D3\u10DB\u10D4\u10E2\u10D0\u10D3 \u10DE\u10D0\u10E2\u10D0\u10E0\u10D0: \u10DB\u10DD\u10E1\u10D0\u10DA\u10DD\u10D3\u10DC\u10D4\u10DA\u10D8 ${issue2.origin} \u10D8\u10E7\u10DD\u10E1 ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10EC\u10E7\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${_issue.prefix}"-\u10D8\u10D7`; - } - if (_issue.format === "ends_with") - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10DB\u10D7\u10D0\u10D5\u10E0\u10D3\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 "${_issue.suffix}"-\u10D8\u10D7`; - if (_issue.format === "includes") - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D8\u10EA\u10D0\u10D5\u10D3\u10D4\u10E1 "${_issue.includes}"-\u10E1`; - if (_issue.format === "regex") - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D5\u10D4\u10DA\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10E8\u10D4\u10D4\u10E1\u10D0\u10D1\u10D0\u10DB\u10D4\u10D1\u10DD\u10D3\u10D4\u10E1 \u10E8\u10D0\u10D1\u10DA\u10DD\u10DC\u10E1 ${_issue.pattern}`; - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E0\u10D8\u10EA\u10EE\u10D5\u10D8: \u10E3\u10DC\u10D3\u10D0 \u10D8\u10E7\u10DD\u10E1 ${issue2.divisor}-\u10D8\u10E1 \u10EF\u10D4\u10E0\u10D0\u10D3\u10D8`; - case "unrecognized_keys": - return `\u10E3\u10EA\u10DC\u10DD\u10D1\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1${issue2.keys.length > 1 ? "\u10D4\u10D1\u10D8" : "\u10D8"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10D2\u10D0\u10E1\u10D0\u10E6\u10D4\u10D1\u10D8 ${issue2.origin}-\u10E8\u10D8`; - case "invalid_union": - return "\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0"; - case "invalid_element": - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10DB\u10DC\u10D8\u10E8\u10D5\u10DC\u10D4\u10DA\u10DD\u10D1\u10D0 ${issue2.origin}-\u10E8\u10D8`; - default: - return `\u10D0\u10E0\u10D0\u10E1\u10EC\u10DD\u10E0\u10D8 \u10E8\u10D4\u10E7\u10D5\u10D0\u10DC\u10D0`; - } - }; -}; -function ka_default() { - return { - localeError: error29() - }; -} - -// node_modules/zod/v4/locales/km.js -var error30 = () => { - const Sizable = { - string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }, - file: { unit: "\u1794\u17C3", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }, - array: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }, - set: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" }, - map: { unit: "\u1792\u17B6\u178F\u17BB", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B", - email: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793\u17A2\u17CA\u17B8\u1798\u17C2\u179B", - url: "URL", - emoji: "\u179F\u1789\u17D2\u1789\u17B6\u17A2\u17B6\u179A\u1798\u17D2\u1798\u178E\u17CD", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 \u1793\u17B7\u1784\u1798\u17C9\u17C4\u1784 ISO", - date: "\u1780\u17B6\u179B\u1794\u179A\u17B7\u1785\u17D2\u1786\u17C1\u1791 ISO", - time: "\u1798\u17C9\u17C4\u1784 ISO", - duration: "\u179A\u1799\u17C8\u1796\u17C1\u179B ISO", - ipv4: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4", - ipv6: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6", - mac: "\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 MAC", - cidrv4: "\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv4", - cidrv6: "\u178A\u17C2\u1793\u17A2\u17B6\u179F\u1799\u178A\u17D2\u178B\u17B6\u1793 IPv6", - base64: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64", - base64url: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u17A2\u17CA\u17B7\u1780\u17BC\u178A base64url", - json_string: "\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A JSON", - e164: "\u179B\u17C1\u1781 E.164", - credit_card: "\u179B\u17C1\u1781\u1794\u17D0\u178E\u17D2\u178E\u17A5\u178E\u1791\u17B6\u1793", - jwt: "JWT", - template_literal: "\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u179B\u17C1\u1781", - array: "\u17A2\u17B6\u179A\u17C1 (Array)", - null: "\u1782\u17D2\u1798\u17B6\u1793\u178F\u1798\u17D2\u179B\u17C3 (null)" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A instanceof ${issue2.expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${received}`; - } - return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${expected} \u1794\u17C9\u17BB\u1793\u17D2\u178F\u17C2\u1791\u1791\u17BD\u179B\u1794\u17B6\u1793 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1794\u1789\u17D2\u1785\u17BC\u179B\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${stringifyPrimitive(issue2.values[0])}`; - return `\u1787\u1798\u17D2\u179A\u17BE\u179F\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1787\u17B6\u1798\u17BD\u1799\u1780\u17D2\u1793\u17BB\u1784\u1785\u17C6\u178E\u17C4\u1798 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.origin ?? "\u178F\u1798\u17D2\u179B\u17C3"} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "\u1792\u17B6\u178F\u17BB"}`; - return `\u1792\u17C6\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.origin ?? "\u178F\u1798\u17D2\u179B\u17C3"} ${adj} ${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.origin} ${adj} ${issue2.minimum.toString()} ${sizing.unit}`; - } - return `\u178F\u17BC\u1785\u1796\u17C1\u1780\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1780\u17B6\u179A ${issue2.origin} ${adj} ${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1785\u17B6\u1794\u17CB\u1795\u17D2\u178F\u17BE\u1798\u178A\u17C4\u1799 "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1794\u1789\u17D2\u1785\u1794\u17CB\u178A\u17C4\u1799 "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u1798\u17B6\u1793 "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u1781\u17D2\u179F\u17C2\u17A2\u1780\u17D2\u179F\u179A\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1795\u17D2\u1782\u17BC\u1795\u17D2\u1782\u1784\u1793\u17B9\u1784\u1791\u1798\u17D2\u179A\u1784\u17CB\u178A\u17C2\u179B\u1794\u17B6\u1793\u1780\u17C6\u178E\u178F\u17CB ${_issue.pattern}`; - return `\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u179B\u17C1\u1781\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u17D6 \u178F\u17D2\u179A\u17BC\u179C\u178F\u17C2\u1787\u17B6\u1796\u17A0\u17BB\u1782\u17BB\u178E\u1793\u17C3 ${issue2.divisor}`; - case "unrecognized_keys": - return `\u179A\u1780\u1783\u17BE\u1789\u179F\u17C4\u1798\u17B7\u1793\u179F\u17D2\u1782\u17B6\u179B\u17CB\u17D6 ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u179F\u17C4\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${issue2.origin}`; - case "invalid_union": - return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C`; - case "invalid_element": - return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C\u1793\u17C5\u1780\u17D2\u1793\u17BB\u1784 ${issue2.origin}`; - default: - return `\u1791\u17B7\u1793\u17D2\u1793\u1793\u17D0\u1799\u1798\u17B7\u1793\u178F\u17D2\u179A\u17B9\u1798\u178F\u17D2\u179A\u17BC\u179C`; - } - }; -}; -function km_default() { - return { - localeError: error30() - }; -} - -// node_modules/zod/v4/locales/kh.js -function kh_default() { - return km_default(); -} - -// node_modules/zod/v4/locales/kn.js -var error31 = () => { - const Sizable = { - string: { unit: "\u0C85\u0C95\u0CCD\u0CB7\u0CB0\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" }, - file: { unit: "\u0CAC\u0CC8\u0C9F\u0CCD\u200C\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" }, - array: { unit: "\u0CB5\u0CB8\u0CCD\u0CA4\u0CC1\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" }, - set: { unit: "\u0CB5\u0CB8\u0CCD\u0CA4\u0CC1\u0C97\u0CB3\u0CC1", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" }, - map: { unit: "entries", verb: "\u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD", - email: "email \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8", - 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 \u0CA6\u0CBF\u0CA8\u0CBE\u0C82\u0C95\u0CA6 \u0CB8\u0CAE\u0CAF", - date: "ISO \u0CA6\u0CBF\u0CA8\u0CBE\u0C82\u0C95", - time: "ISO \u0CB8\u0CAE\u0CAF", - duration: "ISO \u0C85\u0CB5\u0CA7\u0CBF", - ipv4: "IPv4 \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8", - ipv6: "IPv6 \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8", - mac: "MAC \u0CB5\u0CBF\u0CB3\u0CBE\u0CB8", - cidrv4: "IPv4 \u0CB5\u0CCD\u0CAF\u0CBE\u0CAA\u0CCD\u0CA4\u0CBF\u0CAF", - cidrv6: "IPv6 \u0CB5\u0CCD\u0CAF\u0CBE\u0CAA\u0CCD\u0CA4\u0CBF\u0CAF", - base64: "base64-encoded\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD", - base64url: "base64url-encoded\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD", - json_string: "JSON\u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD", - e164: "E.164 \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6", - credit_card: "\u0C95\u0CCD\u0CB0\u0CC6\u0CA1\u0CBF\u0C9F\u0CCD \u0C95\u0CBE\u0CB0\u0CCD\u0CA1\u0CCD \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6", - jwt: "JWT", - template_literal: "\u0C87\u0CA8\u0CCD\u0CAA\u0CC1\u0C9F\u0CCD" - }; - const TypeDictionary = { - // Compatibility: "nan" -> "NaN" for display - nan: "NaN" - // All other type names omitted - they fall back to raw values via ?? operator - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${expected}, \u0CB8\u0CCD\u0CB5\u0CC0\u0C95\u0CB0\u0CBF\u0CB8\u0CBF\u0CA6\u0CA8\u0CC1 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${stringifyPrimitive(issue2.values[0])}`; - return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C86\u0CAF\u0CCD\u0C95\u0CC6: \u0C87\u0CB5\u0CC1\u0C97\u0CB3\u0CB2\u0CCD\u0CB2\u0CBF \u0C92\u0C82\u0CA6\u0CA8\u0CCD\u0CA8\u0CC1 \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0CA6\u0CCA\u0CA1\u0CCD\u0CA1\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${issue2.origin ?? "value"} \u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0C85\u0C82\u0CB6\u0C97\u0CB3\u0CC1"}`; - return `\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0CA6\u0CCA\u0CA1\u0CCD\u0CA1\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${issue2.origin ?? "value"} \u0C8E\u0C82\u0CA6\u0CC1 ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0C9A\u0CBF\u0C95\u0CCD\u0C95\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${issue2.origin} \u0CB9\u0CCA\u0C82\u0CA6\u0CB2\u0CC1 ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `\u0CA4\u0CC1\u0C82\u0CAC\u0CBE \u0C9A\u0CBF\u0C95\u0CCD\u0C95\u0CA6\u0CC1: \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${issue2.origin} \u0C8E\u0C82\u0CA6\u0CC1 ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C87\u0CA6\u0CB0\u0CCA\u0C82\u0CA6\u0CBF\u0C97\u0CC6 \u0CAA\u0CCD\u0CB0\u0CBE\u0CB0\u0C82\u0CAD\u0CBF\u0CB8\u0CAC\u0CC7\u0C95\u0CC1 "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C87\u0CA6\u0CB0\u0CCA\u0C82\u0CA6\u0CBF\u0C97\u0CC6 \u0C95\u0CCA\u0CA8\u0CC6\u0C97\u0CCA\u0CB3\u0CCD\u0CB3\u0CAC\u0CC7\u0C95\u0CC1 "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0C92\u0CB3\u0C97\u0CCA\u0C82\u0CA1\u0CBF\u0CB0\u0CAC\u0CC7\u0C95\u0CC1 "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0CB8\u0CCD\u0C9F\u0CCD\u0CB0\u0CBF\u0C82\u0C97\u0CCD: \u0CAE\u0CBE\u0CA6\u0CB0\u0CBF\u0C97\u0CC6 \u0CB9\u0CCA\u0C82\u0CA6\u0CBF\u0C95\u0CC6\u0CAF\u0CBE\u0C97\u0CAC\u0CC7\u0C95\u0CC1 ${_issue.pattern}`; - return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6: \u0CAC\u0CB9\u0CC1\u0CB8\u0C82\u0C96\u0CCD\u0CAF\u0CC6\u0CAF\u0CBE\u0C97\u0CBF\u0CB0\u0CAC\u0CC7\u0C95\u0CC1 ${issue2.divisor}`; - case "unrecognized_keys": - return `\u0C97\u0CC1\u0CB0\u0CC1\u0CA4\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CA6 \u0C95\u0CC0 ${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF\u0CB5\u0CBE\u0CA6 \u0C95\u0CC0 \u0C87\u0CA8\u0CCD ${issue2.origin}`; - case "invalid_union": - if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { - const opts = issue2.options.map((o) => `'${o}'`).join(" | "); - return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CA4\u0CBE\u0CB0\u0CA4\u0CAE\u0CCD\u0CAF \u0CAE\u0CCC\u0CB2\u0CCD\u0CAF. \u0CA8\u0CBF\u0CB0\u0CC0\u0C95\u0CCD\u0CB7\u0CBF\u0CB8\u0CB2\u0CBE\u0C97\u0CBF\u0CA6\u0CC6 ${opts}`; - } - return "\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD"; - case "invalid_element": - return `\u0CB0\u0CB2\u0CCD\u0CB2\u0CBF \u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0CAE\u0CCC\u0CB2\u0CCD\u0CAF ${issue2.origin}`; - default: - return `\u0C85\u0CAE\u0CBE\u0CA8\u0CCD\u0CAF \u0C87\u0CA8\u0CCD\u200C\u0CAA\u0CC1\u0C9F\u0CCD`; - } - }; -}; -function kn_default() { - return { - localeError: error31() - }; -} - -// node_modules/zod/v4/locales/ko.js -var error32 = () => { - const Sizable = { - string: { unit: "\uBB38\uC790", verb: "to have" }, - file: { unit: "\uBC14\uC774\uD2B8", verb: "to have" }, - array: { unit: "\uAC1C", verb: "to have" }, - set: { unit: "\uAC1C", verb: "to have" }, - map: { unit: "\uAC1C", verb: "to have" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\uC785\uB825", - email: "\uC774\uBA54\uC77C \uC8FC\uC18C", - url: "URL", - emoji: "\uC774\uBAA8\uC9C0", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO \uB0A0\uC9DC\uC2DC\uAC04", - date: "ISO \uB0A0\uC9DC", - time: "ISO \uC2DC\uAC04", - duration: "ISO \uAE30\uAC04", - ipv4: "IPv4 \uC8FC\uC18C", - ipv6: "IPv6 \uC8FC\uC18C", - mac: "MAC \uC8FC\uC18C", - cidrv4: "IPv4 \uBC94\uC704", - cidrv6: "IPv6 \uBC94\uC704", - base64: "base64 \uC778\uCF54\uB529 \uBB38\uC790\uC5F4", - base64url: "base64url \uC778\uCF54\uB529 \uBB38\uC790\uC5F4", - json_string: "JSON \uBB38\uC790\uC5F4", - e164: "E.164 \uBC88\uD638", - credit_card: "\uC2E0\uC6A9\uCE74\uB4DC \uBC88\uD638", - jwt: "JWT", - template_literal: "\uC785\uB825" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 instanceof ${issue2.expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${received}\uC785\uB2C8\uB2E4`; - } - return `\uC798\uBABB\uB41C \uC785\uB825: \uC608\uC0C1 \uD0C0\uC785\uC740 ${expected}, \uBC1B\uC740 \uD0C0\uC785\uC740 ${received}\uC785\uB2C8\uB2E4`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\uC798\uBABB\uB41C \uC785\uB825: \uAC12\uC740 ${stringifyPrimitive(issue2.values[0])} \uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4`; - return `\uC798\uBABB\uB41C \uC635\uC158: ${joinValues(issue2.values, "\uB610\uB294 ")} \uC911 \uD558\uB098\uC5EC\uC57C \uD569\uB2C8\uB2E4`; - case "too_big": { - const adj = issue2.inclusive ? "\uC774\uD558" : "\uBBF8\uB9CC"; - const suffix = adj === "\uBBF8\uB9CC" ? "\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4" : "\uC5EC\uC57C \uD569\uB2C8\uB2E4"; - const sizing = getSizing(issue2.origin); - const unit = sizing?.unit ?? "\uC694\uC18C"; - if (sizing) - return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${issue2.maximum.toString()}${unit} ${adj}${suffix}`; - return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${issue2.maximum.toString()} ${adj}${suffix}`; - } - case "too_small": { - const adj = issue2.inclusive ? "\uC774\uC0C1" : "\uCD08\uACFC"; - const suffix = adj === "\uC774\uC0C1" ? "\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4" : "\uC5EC\uC57C \uD569\uB2C8\uB2E4"; - const sizing = getSizing(issue2.origin); - const unit = sizing?.unit ?? "\uC694\uC18C"; - if (sizing) { - return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${issue2.minimum.toString()}${unit} ${adj}${suffix}`; - } - return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${issue2.minimum.toString()} ${adj}${suffix}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${_issue.prefix}"(\uC73C)\uB85C \uC2DC\uC791\uD574\uC57C \uD569\uB2C8\uB2E4`; - } - if (_issue.format === "ends_with") - return `\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${_issue.suffix}"(\uC73C)\uB85C \uB05D\uB098\uC57C \uD569\uB2C8\uB2E4`; - if (_issue.format === "includes") - return `\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: "${_issue.includes}"\uC744(\uB97C) \uD3EC\uD568\uD574\uC57C \uD569\uB2C8\uB2E4`; - if (_issue.format === "regex") - return `\uC798\uBABB\uB41C \uBB38\uC790\uC5F4: \uC815\uADDC\uC2DD ${_issue.pattern} \uD328\uD134\uACFC \uC77C\uCE58\uD574\uC57C \uD569\uB2C8\uB2E4`; - return `\uC798\uBABB\uB41C ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\uC798\uBABB\uB41C \uC22B\uC790: ${issue2.divisor}\uC758 \uBC30\uC218\uC5EC\uC57C \uD569\uB2C8\uB2E4`; - case "unrecognized_keys": - return `\uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uD0A4: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\uC798\uBABB\uB41C \uD0A4: ${issue2.origin}`; - case "invalid_union": - return `\uC798\uBABB\uB41C \uC785\uB825`; - case "invalid_element": - return `\uC798\uBABB\uB41C \uAC12: ${issue2.origin}`; - default: - return `\uC798\uBABB\uB41C \uC785\uB825`; - } - }; -}; -function ko_default() { - return { - localeError: error32() - }; -} - -// node_modules/zod/v4/locales/lt.js -var capitalizeFirstCharacter = (text) => { - return text.charAt(0).toUpperCase() + text.slice(1); -}; -function getUnitTypeFromNumber(number4) { - const abs = Math.abs(number4); - const last = abs % 10; - const last2 = abs % 100; - if (last2 >= 11 && last2 <= 19 || last === 0) - return "many"; - if (last === 1) - return "one"; - return "few"; -} -var error33 = () => { - const Sizable = { - string: { - unit: { - one: "simbolis", - few: "simboliai", - many: "simboli\u0173" - }, - verb: { - smaller: { - inclusive: "turi b\u016Bti ne ilgesn\u0117 kaip", - notInclusive: "turi b\u016Bti trumpesn\u0117 kaip" - }, - bigger: { - inclusive: "turi b\u016Bti ne trumpesn\u0117 kaip", - notInclusive: "turi b\u016Bti ilgesn\u0117 kaip" - } - } - }, - file: { - unit: { - one: "baitas", - few: "baitai", - many: "bait\u0173" - }, - verb: { - smaller: { - inclusive: "turi b\u016Bti ne didesnis kaip", - notInclusive: "turi b\u016Bti ma\u017Eesnis kaip" - }, - bigger: { - inclusive: "turi b\u016Bti ne ma\u017Eesnis kaip", - notInclusive: "turi b\u016Bti didesnis kaip" - } - } - }, - array: { - unit: { - one: "element\u0105", - few: "elementus", - many: "element\u0173" - }, - verb: { - smaller: { - inclusive: "turi tur\u0117ti ne daugiau kaip", - notInclusive: "turi tur\u0117ti ma\u017Eiau kaip" - }, - bigger: { - inclusive: "turi tur\u0117ti ne ma\u017Eiau kaip", - notInclusive: "turi tur\u0117ti daugiau kaip" - } - } - }, - set: { - unit: { - one: "element\u0105", - few: "elementus", - many: "element\u0173" - }, - verb: { - smaller: { - inclusive: "turi tur\u0117ti ne daugiau kaip", - notInclusive: "turi tur\u0117ti ma\u017Eiau kaip" - }, - bigger: { - inclusive: "turi tur\u0117ti ne ma\u017Eiau kaip", - notInclusive: "turi tur\u0117ti daugiau kaip" - } - } - } - }; - function getSizing(origin, unitType, inclusive, targetShouldBe) { - const result = Sizable[origin] ?? null; - if (result === null) - return result; - return { - unit: result.unit[unitType], - verb: result.verb[targetShouldBe][inclusive ? "inclusive" : "notInclusive"] - }; - } - const FormatDictionary = { - regex: "\u012Fvestis", - email: "el. pa\u0161to adresas", - url: "URL", - emoji: "jaustukas", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO data ir laikas", - date: "ISO data", - time: "ISO laikas", - duration: "ISO trukm\u0117", - ipv4: "IPv4 adresas", - ipv6: "IPv6 adresas", - mac: "MAC adresas", - cidrv4: "IPv4 tinklo prefiksas (CIDR)", - cidrv6: "IPv6 tinklo prefiksas (CIDR)", - base64: "base64 u\u017Ekoduota eilut\u0117", - base64url: "base64url u\u017Ekoduota eilut\u0117", - json_string: "JSON eilut\u0117", - e164: "E.164 numeris", - credit_card: "kredito kortel\u0117s numeris", - jwt: "JWT", - template_literal: "\u012Fvestis" - }; - const TypeDictionary = { - nan: "NaN", - number: "skai\u010Dius", - bigint: "sveikasis skai\u010Dius", - string: "eilut\u0117", - boolean: "login\u0117 reik\u0161m\u0117", - undefined: "neapibr\u0117\u017Eta reik\u0161m\u0117", - function: "funkcija", - symbol: "simbolis", - array: "masyvas", - object: "objektas", - null: "nulin\u0117 reik\u0161m\u0117" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Gautas tipas ${received}, o tik\u0117tasi - instanceof ${issue2.expected}`; - } - return `Gautas tipas ${received}, o tik\u0117tasi - ${expected}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Privalo b\u016Bti ${stringifyPrimitive(issue2.values[0])}`; - return `Privalo b\u016Bti vienas i\u0161 ${joinValues(issue2.values, "|")} pasirinkim\u0173`; - case "too_big": { - const origin = TypeDictionary[issue2.origin] ?? issue2.origin; - const sizing = getSizing(issue2.origin, getUnitTypeFromNumber(Number(issue2.maximum)), issue2.inclusive ?? false, "smaller"); - if (sizing?.verb) - return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} ${sizing.verb} ${issue2.maximum.toString()} ${sizing.unit ?? "element\u0173"}`; - const adj = issue2.inclusive ? "ne didesnis kaip" : "ma\u017Eesnis kaip"; - return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} turi b\u016Bti ${adj} ${issue2.maximum.toString()} ${sizing?.unit}`; - } - case "too_small": { - const origin = TypeDictionary[issue2.origin] ?? issue2.origin; - const sizing = getSizing(issue2.origin, getUnitTypeFromNumber(Number(issue2.minimum)), issue2.inclusive ?? false, "bigger"); - if (sizing?.verb) - return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} ${sizing.verb} ${issue2.minimum.toString()} ${sizing.unit ?? "element\u0173"}`; - const adj = issue2.inclusive ? "ne ma\u017Eesnis kaip" : "didesnis kaip"; - return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} turi b\u016Bti ${adj} ${issue2.minimum.toString()} ${sizing?.unit}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `Eilut\u0117 privalo prasid\u0117ti "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `Eilut\u0117 privalo pasibaigti "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Eilut\u0117 privalo \u012Ftraukti "${_issue.includes}"`; - if (_issue.format === "regex") - return `Eilut\u0117 privalo atitikti ${_issue.pattern}`; - return `Neteisingas ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Skai\u010Dius privalo b\u016Bti ${issue2.divisor} kartotinis.`; - case "unrecognized_keys": - return `Neatpa\u017Eint${issue2.keys.length > 1 ? "i" : "as"} rakt${issue2.keys.length > 1 ? "ai" : "as"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return "Rastas klaidingas raktas"; - case "invalid_union": - return "Klaidinga \u012Fvestis"; - case "invalid_element": { - const origin = TypeDictionary[issue2.origin] ?? issue2.origin; - return `${capitalizeFirstCharacter(origin ?? issue2.origin ?? "reik\u0161m\u0117")} turi klaiding\u0105 \u012Fvest\u012F`; - } - default: - return "Klaidinga \u012Fvestis"; - } - }; -}; -function lt_default() { - return { - localeError: error33() - }; -} - -// node_modules/zod/v4/locales/mk.js -var error34 = () => { - const Sizable = { - string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }, - file: { unit: "\u0431\u0430\u0458\u0442\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }, - array: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }, - set: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" }, - map: { unit: "\u0441\u0442\u0430\u0432\u043A\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0432\u043D\u0435\u0441", - email: "\u0430\u0434\u0440\u0435\u0441\u0430 \u043D\u0430 \u0435-\u043F\u043E\u0448\u0442\u0430", - url: "URL", - emoji: "\u0435\u043C\u043E\u045F\u0438", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO \u0434\u0430\u0442\u0443\u043C \u0438 \u0432\u0440\u0435\u043C\u0435", - date: "ISO \u0434\u0430\u0442\u0443\u043C", - time: "ISO \u0432\u0440\u0435\u043C\u0435", - duration: "ISO \u0432\u0440\u0435\u043C\u0435\u0442\u0440\u0430\u0435\u045A\u0435", - ipv4: "IPv4 \u0430\u0434\u0440\u0435\u0441\u0430", - ipv6: "IPv6 \u0430\u0434\u0440\u0435\u0441\u0430", - mac: "MAC \u0430\u0434\u0440\u0435\u0441\u0430", - cidrv4: "IPv4 \u043E\u043F\u0441\u0435\u0433", - cidrv6: "IPv6 \u043E\u043F\u0441\u0435\u0433", - base64: "base64-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430", - base64url: "base64url-\u0435\u043D\u043A\u043E\u0434\u0438\u0440\u0430\u043D\u0430 \u043D\u0438\u0437\u0430", - json_string: "JSON \u043D\u0438\u0437\u0430", - e164: "E.164 \u0431\u0440\u043E\u0458", - credit_card: "\u0431\u0440\u043E\u0458 \u043D\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u0430 \u043A\u0430\u0440\u0442\u0438\u0447\u043A\u0430", - jwt: "JWT", - template_literal: "\u0432\u043D\u0435\u0441" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u0431\u0440\u043E\u0458", - array: "\u043D\u0438\u0437\u0430" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 instanceof ${issue2.expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${received}`; - } - return `\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${expected}, \u043F\u0440\u0438\u043C\u0435\u043D\u043E ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`; - return `\u0413\u0440\u0435\u0448\u0430\u043D\u0430 \u043E\u043F\u0446\u0438\u0458\u0430: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 \u0435\u0434\u043D\u0430 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.origin ?? "\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0438\u043C\u0430 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0438"}`; - return `\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u0433\u043E\u043B\u0435\u043C: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.origin ?? "\u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442\u0430"} \u0434\u0430 \u0431\u0438\u0434\u0435 ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.origin} \u0434\u0430 \u0438\u043C\u0430 ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `\u041F\u0440\u0435\u043C\u043D\u043E\u0433\u0443 \u043C\u0430\u043B: \u0441\u0435 \u043E\u0447\u0435\u043A\u0443\u0432\u0430 ${issue2.origin} \u0434\u0430 \u0431\u0438\u0434\u0435 ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u043F\u043E\u0447\u043D\u0443\u0432\u0430 \u0441\u043E "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0437\u0430\u0432\u0440\u0448\u0443\u0432\u0430 \u0441\u043E "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0432\u043A\u043B\u0443\u0447\u0443\u0432\u0430 "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u041D\u0435\u0432\u0430\u0436\u0435\u0447\u043A\u0430 \u043D\u0438\u0437\u0430: \u043C\u043E\u0440\u0430 \u0434\u0430 \u043E\u0434\u0433\u043E\u0430\u0440\u0430 \u043D\u0430 \u043F\u0430\u0442\u0435\u0440\u043D\u043E\u0442 ${_issue.pattern}`; - return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u0413\u0440\u0435\u0448\u0435\u043D \u0431\u0440\u043E\u0458: \u043C\u043E\u0440\u0430 \u0434\u0430 \u0431\u0438\u0434\u0435 \u0434\u0435\u043B\u0438\u0432 \u0441\u043E ${issue2.divisor}`; - case "unrecognized_keys": - return `${issue2.keys.length > 1 ? "\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D\u0438 \u043A\u043B\u0443\u0447\u0435\u0432\u0438" : "\u041D\u0435\u043F\u0440\u0435\u043F\u043E\u0437\u043D\u0430\u0435\u043D \u043A\u043B\u0443\u0447"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u0413\u0440\u0435\u0448\u0435\u043D \u043A\u043B\u0443\u0447 \u0432\u043E ${issue2.origin}`; - case "invalid_union": - return "\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441"; - case "invalid_element": - return `\u0413\u0440\u0435\u0448\u043D\u0430 \u0432\u0440\u0435\u0434\u043D\u043E\u0441\u0442 \u0432\u043E ${issue2.origin}`; - default: - return `\u0413\u0440\u0435\u0448\u0435\u043D \u0432\u043D\u0435\u0441`; - } - }; -}; -function mk_default() { - return { - localeError: error34() - }; -} - -// node_modules/zod/v4/locales/ms.js -var error35 = () => { - const Sizable = { - string: { unit: "aksara", verb: "mempunyai" }, - file: { unit: "bait", verb: "mempunyai" }, - array: { unit: "elemen", verb: "mempunyai" }, - set: { unit: "elemen", verb: "mempunyai" }, - map: { unit: "elemen", verb: "mempunyai" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - 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", - mac: "alamat MAC", - cidrv4: "julat IPv4", - cidrv6: "julat IPv6", - base64: "string dikodkan base64", - base64url: "string dikodkan base64url", - json_string: "string JSON", - e164: "nombor E.164", - credit_card: "nombor kad kredit", - jwt: "JWT", - template_literal: "input" - }; - const TypeDictionary = { - nan: "NaN", - number: "nombor" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Input tidak sah: dijangka instanceof ${issue2.expected}, diterima ${received}`; - } - return `Input tidak sah: dijangka ${expected}, diterima ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Input tidak sah: dijangka ${stringifyPrimitive(issue2.values[0])}`; - return `Pilihan tidak sah: dijangka salah satu daripada ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Terlalu besar: dijangka ${issue2.origin ?? "nilai"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemen"}`; - return `Terlalu besar: dijangka ${issue2.origin ?? "nilai"} adalah ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Terlalu kecil: dijangka ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Terlalu kecil: dijangka ${issue2.origin} adalah ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `String tidak sah: mesti bermula dengan "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `String tidak sah: mesti berakhir dengan "${_issue.suffix}"`; - if (_issue.format === "includes") - return `String tidak sah: mesti mengandungi "${_issue.includes}"`; - if (_issue.format === "regex") - return `String tidak sah: mesti sepadan dengan corak ${_issue.pattern}`; - return `${FormatDictionary[_issue.format] ?? issue2.format} tidak sah`; - } - case "not_multiple_of": - return `Nombor tidak sah: perlu gandaan ${issue2.divisor}`; - case "unrecognized_keys": - return `Kunci tidak dikenali: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Kunci tidak sah dalam ${issue2.origin}`; - case "invalid_union": - return "Input tidak sah"; - case "invalid_element": - return `Nilai tidak sah dalam ${issue2.origin}`; - default: - return `Input tidak sah`; - } - }; -}; -function ms_default() { - return { - localeError: error35() - }; -} - -// node_modules/zod/v4/locales/ne.js -var error36 = () => { - const Sizable = { - string: { unit: "\u0905\u0915\u094D\u0937\u0930", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" }, - file: { unit: "\u092C\u093E\u0907\u091F", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" }, - array: { unit: "\u0924\u0924\u094D\u0935", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" }, - set: { unit: "\u0924\u0924\u094D\u0935", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" }, - map: { unit: "\u092A\u094D\u0930\u0935\u093F\u0937\u094D\u091F\u093F", verb: "\u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0907\u0928\u092A\u0941\u091F", - email: "\u0907\u092E\u0947\u0932 \u0920\u0947\u0917\u093E\u0928\u093E", - url: "URL", - emoji: "\u0907\u092E\u094B\u091C\u0940", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO \u092E\u093F\u0924\u093F \u0930 \u0938\u092E\u092F", - date: "ISO \u092E\u093F\u0924\u093F", - time: "ISO \u0938\u092E\u092F", - duration: "ISO \u0905\u0935\u0927\u093F", - ipv4: "IPv4 \u0920\u0947\u0917\u093E\u0928\u093E", - ipv6: "IPv6 \u0920\u0947\u0917\u093E\u0928\u093E", - mac: "MAC \u0920\u0947\u0917\u093E\u0928\u093E", - cidrv4: "IPv4 \u0926\u093E\u092F\u0930\u093E", - cidrv6: "IPv6 \u0926\u093E\u092F\u0930\u093E", - base64: "base64-\u0907\u0928\u094D\u0915\u094B\u0921 \u0917\u0930\u093F\u090F\u0915\u094B \u0938\u094D\u091F\u094D\u0930\u093F\u0919", - base64url: "base64url-\u0907\u0928\u094D\u0915\u094B\u0921 \u0917\u0930\u093F\u090F\u0915\u094B \u0938\u094D\u091F\u094D\u0930\u093F\u0919", - json_string: "JSON \u0938\u094D\u091F\u094D\u0930\u093F\u0919", - e164: "E.164 \u0928\u092E\u094D\u092C\u0930", - credit_card: "\u0915\u094D\u0930\u0947\u0921\u093F\u091F \u0915\u093E\u0930\u094D\u0921 \u0928\u092E\u094D\u092C\u0930", - jwt: "JWT", - template_literal: "\u0907\u0928\u092A\u0941\u091F" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${expected}, \u092A\u094D\u0930\u093E\u092A\u094D\u0924 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${stringifyPrimitive(issue2.values[0])}`; - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0935\u093F\u0915\u0932\u094D\u092A: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 \u092E\u093E\u0928\u0939\u0930\u0942 \u092E\u0927\u094D\u092F\u0947 \u090F\u0915 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u0927\u0947\u0930\u0948 \u0920\u0942\u0932\u094B: ${issue2.origin ?? "\u092E\u093E\u0928"} \u092E\u093E ${adj}${issue2.maximum.toString()} ${sizing.unit} ${sizing.verb}`; - return `\u0927\u0947\u0930\u0948 \u0920\u0942\u0932\u094B: ${issue2.origin ?? "\u092E\u093E\u0928"} ${adj}${issue2.maximum.toString()} \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u0927\u0947\u0930\u0948 \u0938\u093E\u0928\u094B: ${issue2.origin} \u092E\u093E ${adj}${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`; - return `\u0927\u0947\u0930\u0948 \u0938\u093E\u0928\u094B: ${issue2.origin} ${adj}${issue2.minimum.toString()} \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${_issue.prefix}" \u092C\u093E\u091F \u0938\u0941\u0930\u0941 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`; - if (_issue.format === "ends_with") - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${_issue.suffix}" \u092E\u093E \u0938\u092E\u093E\u092A\u094D\u0924 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`; - if (_issue.format === "includes") - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: "${_issue.includes}" \u0938\u092E\u093E\u0935\u0947\u0936 \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`; - if (_issue.format === "regex") - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u094D\u091F\u094D\u0930\u093F\u0919: \u0922\u093E\u0901\u091A\u093E ${_issue.pattern} \u0938\u0901\u0917 \u092E\u0947\u0932 \u0916\u093E\u0928\u0941\u092A\u0930\u094D\u091B`; - return `\u0905\u092E\u093E\u0928\u094D\u092F ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0938\u0902\u0916\u094D\u092F\u093E: ${issue2.divisor} \u0915\u094B \u0917\u0941\u0923\u091C \u0939\u0941\u0928\u0941\u092A\u0930\u094D\u091B`; - case "unrecognized_keys": - return `\u0905\u092A\u0930\u093F\u091A\u093F\u0924 \u0915\u0941\u091E\u094D\u091C\u0940${issue2.keys.length > 1 ? "\u0939\u0930\u0942" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0915\u0941\u091E\u094D\u091C\u0940: ${issue2.origin} \u092E\u093E`; - case "invalid_union": - if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { - const opts = issue2.options.map((o) => `'${o}'`).join(" | "); - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0921\u093F\u0938\u094D\u0915\u094D\u0930\u093F\u092E\u093F\u0928\u0947\u091F\u0930 \u092E\u093E\u0928: \u0905\u092A\u0947\u0915\u094D\u0937\u093F\u0924 ${opts}`; - } - return "\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F"; - case "invalid_element": - return `\u0905\u092E\u093E\u0928\u094D\u092F \u092E\u093E\u0928: ${issue2.origin} \u092E\u093E`; - default: - return `\u0905\u092E\u093E\u0928\u094D\u092F \u0907\u0928\u092A\u0941\u091F`; - } - }; -}; -function ne_default() { - return { - localeError: error36() - }; -} - -// node_modules/zod/v4/locales/nl.js -var error37 = () => { - const Sizable = { - string: { unit: "tekens", verb: "heeft" }, - file: { unit: "bytes", verb: "heeft" }, - array: { unit: "elementen", verb: "heeft" }, - set: { unit: "elementen", verb: "heeft" }, - map: { unit: "elementen", verb: "heeft" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - 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", - mac: "MAC-adres", - cidrv4: "IPv4-bereik", - cidrv6: "IPv6-bereik", - base64: "base64-gecodeerde tekst", - base64url: "base64 URL-gecodeerde tekst", - json_string: "JSON string", - e164: "E.164-nummer", - credit_card: "creditcardnummer", - jwt: "JWT", - template_literal: "invoer" - }; - const TypeDictionary = { - nan: "NaN", - number: "getal" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Ongeldige invoer: verwacht instanceof ${issue2.expected}, ontving ${received}`; - } - return `Ongeldige invoer: verwacht ${expected}, ontving ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Ongeldige invoer: verwacht ${stringifyPrimitive(issue2.values[0])}`; - return `Ongeldige optie: verwacht \xE9\xE9n van ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - const longName = issue2.origin === "date" ? "laat" : issue2.origin === "string" ? "lang" : "groot"; - if (sizing) - return `Te ${longName}: verwacht dat ${issue2.origin ?? "waarde"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementen"} ${sizing.verb}`; - return `Te ${longName}: verwacht dat ${issue2.origin ?? "waarde"} ${adj}${issue2.maximum.toString()} is`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - const shortName = issue2.origin === "date" ? "vroeg" : issue2.origin === "string" ? "kort" : "klein"; - if (sizing) { - return `Te ${shortName}: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`; - } - return `Te ${shortName}: verwacht dat ${issue2.origin} ${adj}${issue2.minimum.toString()} is`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `Ongeldige tekst: moet met "${_issue.prefix}" beginnen`; - } - if (_issue.format === "ends_with") - return `Ongeldige tekst: moet op "${_issue.suffix}" eindigen`; - if (_issue.format === "includes") - return `Ongeldige tekst: moet "${_issue.includes}" bevatten`; - if (_issue.format === "regex") - return `Ongeldige tekst: moet overeenkomen met patroon ${_issue.pattern}`; - return `Ongeldig: ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Ongeldig getal: moet een veelvoud van ${issue2.divisor} zijn`; - case "unrecognized_keys": - return `Onbekende key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Ongeldige key in ${issue2.origin}`; - case "invalid_union": - return "Ongeldige invoer"; - case "invalid_element": - return `Ongeldige waarde in ${issue2.origin}`; - default: - return `Ongeldige invoer`; - } - }; -}; -function nl_default() { - return { - localeError: error37() - }; -} - -// node_modules/zod/v4/locales/nn.js -var error38 = () => { - const Sizable = { - string: { unit: "teikn", verb: "\xE5 ha" }, - file: { unit: "bytes", verb: "\xE5 ha" }, - array: { unit: "element", verb: "\xE5 innehalde" }, - set: { unit: "element", verb: "\xE5 innehalde" }, - map: { unit: "element", verb: "\xE5 innehalde" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - 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-varigheit", - ipv4: "IPv4-adresse", - ipv6: "IPv6-adresse", - mac: "MAC-adresse", - cidrv4: "IPv4-spekter", - cidrv6: "IPv6-spekter", - base64: "base64-enkoda streng", - base64url: "base64url-enkoda streng", - json_string: "JSON-streng", - e164: "E.164-nummer", - credit_card: "kredittkortnummer", - jwt: "JWT", - template_literal: "input" - }; - const TypeDictionary = { - nan: "NaN", - number: "tal", - array: "liste" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Ugyldig input: forventa instanceof ${issue2.expected}, fekk ${received}`; - } - return `Ugyldig input: forventa ${expected}, fekk ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Ugyldig verdi: forventa ${stringifyPrimitive(issue2.values[0])}`; - return `Ugyldig val: forventa eitt av ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `For stor(t): forventa ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element"}`; - return `For stor(t): forventa ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `For lite(n): forventa ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `For lite(n): forventa ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Ugyldig streng: m\xE5 starte med "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Ugyldig streng: m\xE5 slutte med "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Ugyldig streng: m\xE5 innehalde "${_issue.includes}"`; - if (_issue.format === "regex") - return `Ugyldig streng: m\xE5 matche m\xF8nsteret ${_issue.pattern}`; - return `Ugyldig ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Ugyldig tal: m\xE5 vere eit multiplum av ${issue2.divisor}`; - case "unrecognized_keys": - return `${issue2.keys.length > 1 ? "Ukjende n\xF8klar" : "Ukjend n\xF8kkel"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Ugyldig n\xF8kkel i ${issue2.origin}`; - case "invalid_union": - return "Ugyldig input"; - case "invalid_element": - return `Ugyldig verdi i ${issue2.origin}`; - default: - return `Ugyldig input`; - } - }; -}; -function nn_default() { - return { - localeError: error38() - }; -} - -// node_modules/zod/v4/locales/no.js -var error39 = () => { - const Sizable = { - string: { unit: "tegn", verb: "\xE5 ha" }, - file: { unit: "bytes", verb: "\xE5 ha" }, - array: { unit: "elementer", verb: "\xE5 inneholde" }, - set: { unit: "elementer", verb: "\xE5 inneholde" }, - map: { unit: "elementer", verb: "\xE5 inneholde" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - 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-adresse", - ipv6: "IPv6-adresse", - mac: "MAC-adresse", - cidrv4: "IPv4-spekter", - cidrv6: "IPv6-spekter", - base64: "base64-enkodet streng", - base64url: "base64url-enkodet streng", - json_string: "JSON-streng", - e164: "E.164-nummer", - credit_card: "kredittkortnummer", - jwt: "JWT", - template_literal: "input" - }; - const TypeDictionary = { - nan: "NaN", - number: "tall", - array: "liste" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Ugyldig input: forventet instanceof ${issue2.expected}, fikk ${received}`; - } - return `Ugyldig input: forventet ${expected}, fikk ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Ugyldig verdi: forventet ${stringifyPrimitive(issue2.values[0])}`; - return `Ugyldig valg: forventet en av ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `For stor(t): forventet ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementer"}`; - return `For stor(t): forventet ${issue2.origin ?? "value"} til \xE5 ha ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `For lite(n): forventet ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `For lite(n): forventet ${issue2.origin} til \xE5 ha ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Ugyldig streng: m\xE5 starte med "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Ugyldig streng: m\xE5 ende med "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Ugyldig streng: m\xE5 inneholde "${_issue.includes}"`; - if (_issue.format === "regex") - return `Ugyldig streng: m\xE5 matche m\xF8nsteret ${_issue.pattern}`; - return `Ugyldig ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Ugyldig tall: m\xE5 v\xE6re et multiplum av ${issue2.divisor}`; - case "unrecognized_keys": - return `${issue2.keys.length > 1 ? "Ukjente n\xF8kler" : "Ukjent n\xF8kkel"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Ugyldig n\xF8kkel i ${issue2.origin}`; - case "invalid_union": - return "Ugyldig input"; - case "invalid_element": - return `Ugyldig verdi i ${issue2.origin}`; - default: - return `Ugyldig input`; - } - }; -}; -function no_default() { - return { - localeError: error39() - }; -} - -// node_modules/zod/v4/locales/ota.js -var error40 = () => { - const Sizable = { - string: { unit: "harf", verb: "olmal\u0131d\u0131r" }, - file: { unit: "bayt", verb: "olmal\u0131d\u0131r" }, - array: { unit: "unsur", verb: "olmal\u0131d\u0131r" }, - set: { unit: "unsur", verb: "olmal\u0131d\u0131r" }, - map: { unit: "unsur", verb: "olmal\u0131d\u0131r" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "giren", - email: "epostag\xE2h", - 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\xE2m\u0131", - date: "ISO tarihi", - time: "ISO zaman\u0131", - duration: "ISO m\xFCddeti", - ipv4: "IPv4 ni\u015F\xE2n\u0131", - ipv6: "IPv6 ni\u015F\xE2n\u0131", - mac: "MAC ni\u015F\xE2n\u0131", - cidrv4: "IPv4 menzili", - cidrv6: "IPv6 menzili", - base64: "base64-\u015Fifreli metin", - base64url: "base64url-\u015Fifreli metin", - json_string: "JSON metin", - e164: "E.164 say\u0131s\u0131", - credit_card: "i'tib\xE2r kart\u0131 numaras\u0131", - jwt: "JWT", - template_literal: "giren" - }; - const TypeDictionary = { - nan: "NaN", - number: "numara", - array: "saf", - null: "gayb" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `F\xE2sit giren: umulan instanceof ${issue2.expected}, al\u0131nan ${received}`; - } - return `F\xE2sit giren: umulan ${expected}, al\u0131nan ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `F\xE2sit giren: umulan ${stringifyPrimitive(issue2.values[0])}`; - return `F\xE2sit tercih: m\xFBteberler ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Fazla b\xFCy\xFCk: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"} sahip olmal\u0131yd\u0131.`; - return `Fazla b\xFCy\xFCk: ${issue2.origin ?? "value"}, ${adj}${issue2.maximum.toString()} olmal\u0131yd\u0131.`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Fazla k\xFC\xE7\xFCk: ${issue2.origin}, ${adj}${issue2.minimum.toString()} ${sizing.unit} sahip olmal\u0131yd\u0131.`; - } - return `Fazla k\xFC\xE7\xFCk: ${issue2.origin}, ${adj}${issue2.minimum.toString()} olmal\u0131yd\u0131.`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `F\xE2sit metin: "${_issue.prefix}" ile ba\u015Flamal\u0131.`; - if (_issue.format === "ends_with") - return `F\xE2sit metin: "${_issue.suffix}" ile bitmeli.`; - if (_issue.format === "includes") - return `F\xE2sit metin: "${_issue.includes}" ihtiv\xE2 etmeli.`; - if (_issue.format === "regex") - return `F\xE2sit metin: ${_issue.pattern} nak\u015F\u0131na uymal\u0131.`; - return `F\xE2sit ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `F\xE2sit say\u0131: ${issue2.divisor} kat\u0131 olmal\u0131yd\u0131.`; - case "unrecognized_keys": - return `Tan\u0131nmayan anahtar ${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `${issue2.origin} i\xE7in tan\u0131nmayan anahtar var.`; - case "invalid_union": - return "Giren tan\u0131namad\u0131."; - case "invalid_element": - return `${issue2.origin} i\xE7in tan\u0131nmayan k\u0131ymet var.`; - default: - return `K\u0131ymet tan\u0131namad\u0131.`; - } - }; -}; -function ota_default() { - return { - localeError: error40() - }; -} - -// node_modules/zod/v4/locales/ps.js -var error41 = () => { - const Sizable = { - string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" }, - file: { unit: "\u0628\u0627\u06CC\u067C\u0633", verb: "\u0648\u0644\u0631\u064A" }, - array: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" }, - set: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" }, - map: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0648\u0631\u0648\u062F\u064A", - email: "\u0628\u0631\u06CC\u069A\u0646\u0627\u0644\u06CC\u06A9", - url: "\u06CC\u0648 \u0622\u0631 \u0627\u0644", - emoji: "\u0627\u06CC\u0645\u0648\u062C\u064A", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "\u0646\u06CC\u067C\u0647 \u0627\u0648 \u0648\u062E\u062A", - date: "\u0646\u06D0\u067C\u0647", - time: "\u0648\u062E\u062A", - duration: "\u0645\u0648\u062F\u0647", - ipv4: "\u062F IPv4 \u067E\u062A\u0647", - ipv6: "\u062F IPv6 \u067E\u062A\u0647", - mac: "\u062F MAC \u067E\u062A\u0647", - cidrv4: "\u062F IPv4 \u0633\u0627\u062D\u0647", - cidrv6: "\u062F IPv6 \u0633\u0627\u062D\u0647", - base64: "base64-encoded \u0645\u062A\u0646", - base64url: "base64url-encoded \u0645\u062A\u0646", - json_string: "JSON \u0645\u062A\u0646", - e164: "\u062F E.164 \u0634\u0645\u06D0\u0631\u0647", - credit_card: "\u062F \u06A9\u0631\u06CC\u0689\u06CC\u067C \u06A9\u0627\u0631\u062A \u0634\u0645\u06CC\u0631\u0647", - jwt: "JWT", - template_literal: "\u0648\u0631\u0648\u062F\u064A" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u0639\u062F\u062F", - array: "\u0627\u0631\u06D0" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F instanceof ${issue2.expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${received} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`; - } - return `\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${expected} \u0648\u0627\u06CC, \u0645\u06AB\u0631 ${received} \u062A\u0631\u0644\u0627\u0633\u0647 \u0634\u0648`; - } - case "invalid_value": - if (issue2.values.length === 1) { - return `\u0646\u0627\u0633\u0645 \u0648\u0631\u0648\u062F\u064A: \u0628\u0627\u06CC\u062F ${stringifyPrimitive(issue2.values[0])} \u0648\u0627\u06CC`; - } - return `\u0646\u0627\u0633\u0645 \u0627\u0646\u062A\u062E\u0627\u0628: \u0628\u0627\u06CC\u062F \u06CC\u0648 \u0644\u0647 ${joinValues(issue2.values, "|")} \u0685\u062E\u0647 \u0648\u0627\u06CC`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${issue2.origin ?? "\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0639\u0646\u0635\u0631\u0648\u0646\u0647"} \u0648\u0644\u0631\u064A`; - } - return `\u0689\u06CC\u0631 \u0644\u0648\u06CC: ${issue2.origin ?? "\u0627\u0631\u0632\u069A\u062A"} \u0628\u0627\u06CC\u062F ${adj}${issue2.maximum.toString()} \u0648\u064A`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${issue2.origin} \u0628\u0627\u06CC\u062F ${adj}${issue2.minimum.toString()} ${sizing.unit} \u0648\u0644\u0631\u064A`; - } - return `\u0689\u06CC\u0631 \u06A9\u0648\u0686\u0646\u06CC: ${issue2.origin} \u0628\u0627\u06CC\u062F ${adj}${issue2.minimum.toString()} \u0648\u064A`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${_issue.prefix}" \u0633\u0631\u0647 \u067E\u06CC\u0644 \u0634\u064A`; - } - if (_issue.format === "ends_with") { - return `\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F "${_issue.suffix}" \u0633\u0631\u0647 \u067E\u0627\u06CC \u062A\u0647 \u0648\u0631\u0633\u064A\u0696\u064A`; - } - if (_issue.format === "includes") { - return `\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F "${_issue.includes}" \u0648\u0644\u0631\u064A`; - } - if (_issue.format === "regex") { - return `\u0646\u0627\u0633\u0645 \u0645\u062A\u0646: \u0628\u0627\u06CC\u062F \u062F ${_issue.pattern} \u0633\u0631\u0647 \u0645\u0637\u0627\u0628\u0642\u062A \u0648\u0644\u0631\u064A`; - } - return `${FormatDictionary[_issue.format] ?? issue2.format} \u0646\u0627\u0633\u0645 \u062F\u06CC`; - } - case "not_multiple_of": - return `\u0646\u0627\u0633\u0645 \u0639\u062F\u062F: \u0628\u0627\u06CC\u062F \u062F ${issue2.divisor} \u0645\u0636\u0631\u0628 \u0648\u064A`; - case "unrecognized_keys": - return `\u0646\u0627\u0633\u0645 ${issue2.keys.length > 1 ? "\u06A9\u0644\u06CC\u0689\u0648\u0646\u0647" : "\u06A9\u0644\u06CC\u0689"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u0646\u0627\u0633\u0645 \u06A9\u0644\u06CC\u0689 \u067E\u0647 ${issue2.origin} \u06A9\u06D0`; - case "invalid_union": - return `\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A`; - case "invalid_element": - return `\u0646\u0627\u0633\u0645 \u0639\u0646\u0635\u0631 \u067E\u0647 ${issue2.origin} \u06A9\u06D0`; - default: - return `\u0646\u0627\u0633\u0645\u0647 \u0648\u0631\u0648\u062F\u064A`; - } - }; -}; -function ps_default() { - return { - localeError: error41() - }; -} - -// node_modules/zod/v4/locales/pl.js -var error42 = () => { - const Sizable = { - string: { unit: "znak\xF3w", verb: "mie\u0107" }, - file: { unit: "bajt\xF3w", verb: "mie\u0107" }, - array: { unit: "element\xF3w", verb: "mie\u0107" }, - set: { unit: "element\xF3w", verb: "mie\u0107" }, - map: { unit: "element\xF3w", verb: "mie\u0107" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "wyra\u017Cenie", - 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", - mac: "adres MAC", - cidrv4: "zakres IPv4", - cidrv6: "zakres IPv6", - base64: "ci\u0105g znak\xF3w zakodowany w formacie base64", - base64url: "ci\u0105g znak\xF3w zakodowany w formacie base64url", - json_string: "ci\u0105g znak\xF3w w formacie JSON", - e164: "liczba E.164", - credit_card: "numer karty kredytowej", - jwt: "JWT", - template_literal: "wej\u015Bcie" - }; - const TypeDictionary = { - nan: "NaN", - number: "liczba", - array: "tablica" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano instanceof ${issue2.expected}, otrzymano ${received}`; - } - return `Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${expected}, otrzymano ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Nieprawid\u0142owe dane wej\u015Bciowe: oczekiwano ${stringifyPrimitive(issue2.values[0])}`; - return `Nieprawid\u0142owa opcja: oczekiwano jednej z warto\u015Bci ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Za du\u017Ca warto\u015B\u0107: oczekiwano, \u017Ce ${issue2.origin ?? "warto\u015B\u0107"} b\u0119dzie mie\u0107 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element\xF3w"}`; - } - return `Zbyt du\u017C(y/a/e): oczekiwano, \u017Ce ${issue2.origin ?? "warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Za ma\u0142a warto\u015B\u0107: oczekiwano, \u017Ce ${issue2.origin ?? "warto\u015B\u0107"} b\u0119dzie mie\u0107 ${adj}${issue2.minimum.toString()} ${sizing.unit ?? "element\xF3w"}`; - } - return `Zbyt ma\u0142(y/a/e): oczekiwano, \u017Ce ${issue2.origin ?? "warto\u015B\u0107"} b\u0119dzie wynosi\u0107 ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zaczyna\u0107 si\u0119 od "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Nieprawid\u0142owy ci\u0105g znak\xF3w: musi ko\u0144czy\u0107 si\u0119 na "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Nieprawid\u0142owy ci\u0105g znak\xF3w: musi zawiera\u0107 "${_issue.includes}"`; - if (_issue.format === "regex") - return `Nieprawid\u0142owy ci\u0105g znak\xF3w: musi odpowiada\u0107 wzorcowi ${_issue.pattern}`; - return `Nieprawid\u0142ow(y/a/e) ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Nieprawid\u0142owa liczba: musi by\u0107 wielokrotno\u015Bci\u0105 ${issue2.divisor}`; - case "unrecognized_keys": - return `Nierozpoznane klucze${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Nieprawid\u0142owy klucz w ${issue2.origin}`; - case "invalid_union": - return "Nieprawid\u0142owe dane wej\u015Bciowe"; - case "invalid_element": - return `Nieprawid\u0142owa warto\u015B\u0107 w ${issue2.origin}`; - default: - return `Nieprawid\u0142owe dane wej\u015Bciowe`; - } - }; -}; -function pl_default() { - return { - localeError: error42() - }; -} - -// node_modules/zod/v4/locales/pt.js -var error43 = () => { - const Sizable = { - string: { unit: "caracteres" }, - file: { unit: "bytes" }, - array: { unit: "elementos" }, - set: { unit: "elementos" }, - map: { unit: "entradas" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "a entrada", - email: "o endere\xE7o de e-mail", - url: "o URL", - emoji: "o emoji", - uuid: "o UUID", - uuidv4: "o UUIDv4", - uuidv6: "o UUIDv6", - nanoid: "o nanoid", - guid: "o GUID", - cuid: "o cuid", - cuid2: "o cuid2", - ulid: "o ULID", - xid: "o XID", - ksuid: "o KSUID", - datetime: "a data e hora ISO", - date: "a data ISO", - time: "a hora ISO", - duration: "a dura\xE7\xE3o ISO", - ipv4: "o endere\xE7o IPv4", - ipv6: "o endere\xE7o IPv6", - mac: "o endere\xE7o MAC", - cidrv4: "o intervalo de endere\xE7os IPv4", - cidrv6: "o intervalo de endere\xE7os IPv6", - base64: "o texto codificado em base64", - base64url: "o texto codificado em base64url", - json_string: "o texto JSON", - e164: "o n\xFAmero E.164", - credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito", - jwt: "o JWT", - template_literal: "a entrada" - }; - const Gender = { - masculine: { definite: "o", indefinite: "um" }, - feminine: { definite: "a", indefinite: "uma" } - }; - const TypeDictionary = { - string: { name: "texto", articles: Gender.masculine }, - number: { name: "n\xFAmero", articles: Gender.masculine }, - int: { name: "n\xFAmero inteiro", articles: Gender.masculine }, - boolean: { name: "valor booleano", articles: Gender.masculine }, - bigint: { name: "n\xFAmero bigint", articles: Gender.masculine }, - symbol: { name: "s\xEDmbolo", articles: Gender.masculine }, - undefined: { name: 'valor "undefined"', articles: Gender.masculine }, - null: { name: 'valor "nulo"', articles: Gender.masculine }, - never: { name: 'valor "never"', articles: Gender.masculine }, - void: { name: 'valor "void"', articles: Gender.masculine }, - date: { name: "data", articles: Gender.feminine }, - array: { name: "vetor", articles: Gender.masculine }, - object: { name: "objeto", articles: Gender.masculine }, - tuple: { name: "tuplo", articles: Gender.masculine }, - record: { name: "registo", articles: Gender.masculine }, - map: { name: "mapa", articles: Gender.masculine }, - set: { name: "conjunto", articles: Gender.masculine }, - file: { name: "ficheiro", articles: Gender.masculine }, - nonoptional: { name: "valor n\xE3o opcional", articles: Gender.masculine }, - nan: { name: 'valor "NaN"', articles: Gender.masculine }, - // Compatibility: "nan" -> "NaN" for display - function: { name: "fun\xE7\xE3o", articles: Gender.feminine } - }; - function translateOriginWithArticle(type, articleType) { - const translatedValue = TypeDictionary[type] ?? { name: `valor "${type}"`, articles: Gender.masculine }; - return `${translatedValue.articles[articleType]} ${translatedValue.name}`; - } - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = translateOriginWithArticle(issue2.expected, "indefinite"); - const receivedType = parsedType(issue2.input); - const received = translateOriginWithArticle(receivedType, "indefinite"); - return `Entrada inv\xE1lida: esperava ${expected}, recebeu ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Entrada inv\xE1lida: esperava ${stringifyPrimitive(issue2.values[0])}`; - return `Op\xE7\xE3o inv\xE1lida: esperava uma das seguintes op\xE7\xF5es: ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Demasiado grande: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} tivesse ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`; - return `Demasiado grande: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} fosse ${adj} ${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Demasiado pequeno: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} tivesse ${adj} ${issue2.minimum.toString()} ${sizing.unit ?? "elementos"}`; - } - return `Demasiado pequeno: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} fosse ${adj} ${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Texto inv\xE1lido: deve come\xE7ar por "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Texto inv\xE1lido: deve terminar em "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Texto inv\xE1lido: deve incluir "${_issue.includes}"`; - if (_issue.format === "regex") - return `Texto inv\xE1lido: deve corresponder ao padr\xE3o ${_issue.pattern}`; - return `Formato d${FormatDictionary[_issue.format] ?? issue2.format} inv\xE1lido`; - } - case "not_multiple_of": - return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`; - case "unrecognized_keys": { - const plural = issue2.keys.length > 1 ? "s" : ""; - return `Chave${plural} inv\xE1lida${plural}: ${joinValues(issue2.keys, ", ")}`; - } - case "invalid_key": - return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`; - case "invalid_union": - if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { - const opts = issue2.options.map((o) => `'${o}'`).join(" | "); - return `Valor de discrimina\xE7\xE3o inv\xE1lido. Esperava ${opts}`; - } - return "Entrada inv\xE1lida"; - case "invalid_element": - return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`; - default: - return `Entrada inv\xE1lida`; - } - }; -}; -function pt_default() { - return { - localeError: error43() - }; -} - -// node_modules/zod/v4/locales/pt-BR.js -var error44 = () => { - const Sizable = { - string: { unit: "caracteres" }, - file: { unit: "bytes" }, - array: { unit: "elementos" }, - set: { unit: "elementos" }, - map: { unit: "entradas" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "a entrada", - email: "o endere\xE7o de e-mail", - url: "o URL", - emoji: "o emoji", - uuid: "o UUID", - uuidv4: "o UUIDv4", - uuidv6: "o UUIDv6", - nanoid: "o nanoid", - guid: "o GUID", - cuid: "o cuid", - cuid2: "o cuid2", - ulid: "o ULID", - xid: "o XID", - ksuid: "o KSUID", - datetime: "a data e hora ISO", - date: "a data ISO", - time: "a hora ISO", - duration: "a dura\xE7\xE3o ISO", - ipv4: "o endere\xE7o IPv4", - ipv6: "o endere\xE7o IPv6", - mac: "o endere\xE7o MAC", - cidrv4: "a faixa de endere\xE7os IPv4", - cidrv6: "a faixa de endere\xE7os IPv6", - base64: "o texto codificado em base64", - base64url: "o texto codificado em base64url", - json_string: "o texto JSON", - e164: "o n\xFAmero E.164", - credit_card: "o n\xFAmero de cart\xE3o de cr\xE9dito", - jwt: "o JWT", - template_literal: "a entrada" - }; - const Gender = { - masculine: { definite: "o", indefinite: "um" }, - feminine: { definite: "a", indefinite: "uma" } - }; - const TypeDictionary = { - string: { name: "texto", articles: Gender.masculine }, - number: { name: "n\xFAmero", articles: Gender.masculine }, - int: { name: "n\xFAmero inteiro", articles: Gender.masculine }, - boolean: { name: "valor booleano", articles: Gender.masculine }, - bigint: { name: "n\xFAmero bigint", articles: Gender.masculine }, - symbol: { name: "s\xEDmbolo", articles: Gender.masculine }, - undefined: { name: 'valor "undefined"', articles: Gender.masculine }, - null: { name: 'valor "nulo"', articles: Gender.masculine }, - never: { name: 'valor "never"', articles: Gender.masculine }, - void: { name: 'valor "void"', articles: Gender.masculine }, - date: { name: "data", articles: Gender.feminine }, - array: { name: "vetor", articles: Gender.masculine }, - object: { name: "objeto", articles: Gender.masculine }, - tuple: { name: "tupla", articles: Gender.feminine }, - record: { name: "registro", articles: Gender.masculine }, - map: { name: "mapa", articles: Gender.masculine }, - set: { name: "conjunto", articles: Gender.masculine }, - file: { name: "arquivo", articles: Gender.masculine }, - nonoptional: { name: "valor n\xE3o opcional", articles: Gender.masculine }, - nan: { name: 'valor "NaN"', articles: Gender.masculine }, - // Compatibility: "nan" -> "NaN" for display - function: { name: "fun\xE7\xE3o", articles: Gender.feminine } - }; - function translateOriginWithArticle(type, articleType) { - const translatedValue = TypeDictionary[type] ?? { name: `valor "${type}"`, articles: Gender.masculine }; - return `${translatedValue.articles[articleType]} ${translatedValue.name}`; - } - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = translateOriginWithArticle(issue2.expected, "indefinite"); - const receivedType = parsedType(issue2.input); - const received = translateOriginWithArticle(receivedType, "indefinite"); - return `Entrada inv\xE1lida: esperava ${expected}, recebeu ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Entrada inv\xE1lida: esperava ${stringifyPrimitive(issue2.values[0])}`; - return `Op\xE7\xE3o inv\xE1lida: esperava uma das seguintes op\xE7\xF5es: ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Grande demais: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} tivesse ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "elementos"}`; - return `Grande demais: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} fosse ${adj} ${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Pequeno demais: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} tivesse ${adj} ${issue2.minimum.toString()} ${sizing.unit ?? "elementos"}`; - } - return `Pequeno demais: esperava que ${translateOriginWithArticle(issue2.origin, "definite")} fosse ${adj} ${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `Texto inv\xE1lido: deve come\xE7ar com "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `Texto inv\xE1lido: deve terminar com "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Texto inv\xE1lido: deve incluir "${_issue.includes}"`; - if (_issue.format === "regex") - return `Texto inv\xE1lido: deve corresponder ao padr\xE3o ${_issue.pattern}`; - return `Formato d${FormatDictionary[_issue.format] ?? issue2.format} inv\xE1lido`; - } - case "not_multiple_of": - return `N\xFAmero inv\xE1lido: deve ser m\xFAltiplo de ${issue2.divisor}`; - case "unrecognized_keys": { - const plural = issue2.keys.length > 1 ? "s" : ""; - return `Chave${plural} inv\xE1lida${plural}: ${joinValues(issue2.keys, ", ")}`; - } - case "invalid_key": - return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`; - case "invalid_union": - if (issue2.options && Array.isArray(issue2.options) && issue2.options.length > 0) { - const opts = issue2.options.map((o) => `'${o}'`).join(" | "); - return `Valor de discrimina\xE7\xE3o inv\xE1lido. Esperava ${opts}`; - } - return "Entrada inv\xE1lida"; - case "invalid_element": - return `Entrada inv\xE1lida n${translateOriginWithArticle(issue2.origin, "definite")}`; - default: - return `Entrada inv\xE1lida`; - } - }; -}; -function pt_BR_default() { - return { - localeError: error44() - }; -} - -// node_modules/zod/v4/locales/ro.js -var error45 = () => { - const Sizable = { - string: { unit: "caractere", verb: "s\u0103 aib\u0103" }, - file: { unit: "octe\u021Bi", verb: "s\u0103 aib\u0103" }, - array: { unit: "elemente", verb: "s\u0103 aib\u0103" }, - set: { unit: "elemente", verb: "s\u0103 aib\u0103" }, - map: { unit: "intr\u0103ri", verb: "s\u0103 aib\u0103" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "intrare", - email: "adres\u0103 de 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: "dat\u0103 \u0219i or\u0103 ISO", - date: "dat\u0103 ISO", - time: "or\u0103 ISO", - duration: "durat\u0103 ISO", - ipv4: "adres\u0103 IPv4", - ipv6: "adres\u0103 IPv6", - mac: "adres\u0103 MAC", - cidrv4: "interval IPv4", - cidrv6: "interval IPv6", - base64: "\u0219ir codat base64", - base64url: "\u0219ir codat base64url", - json_string: "\u0219ir JSON", - e164: "num\u0103r E.164", - credit_card: "num\u0103r de card de credit", - jwt: "JWT", - template_literal: "intrare" - }; - const TypeDictionary = { - nan: "NaN", - string: "\u0219ir", - number: "num\u0103r", - boolean: "boolean", - function: "func\u021Bie", - array: "matrice", - object: "obiect", - undefined: "nedefinit", - symbol: "simbol", - bigint: "num\u0103r mare", - void: "void", - never: "never", - map: "hart\u0103", - set: "set" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - return `Intrare invalid\u0103: a\u0219teptat ${expected}, primit ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Intrare invalid\u0103: a\u0219teptat ${stringifyPrimitive(issue2.values[0])}`; - return `Op\u021Biune invalid\u0103: a\u0219teptat una dintre ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Prea mare: a\u0219teptat ca ${issue2.origin ?? "valoarea"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elemente"}`; - return `Prea mare: a\u0219teptat ca ${issue2.origin ?? "valoarea"} s\u0103 fie ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Prea mic: a\u0219teptat ca ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Prea mic: a\u0219teptat ca ${issue2.origin} s\u0103 fie ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u0218ir invalid: trebuie s\u0103 \xEEnceap\u0103 cu "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `\u0218ir invalid: trebuie s\u0103 se termine cu "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u0218ir invalid: trebuie s\u0103 includ\u0103 "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u0218ir invalid: trebuie s\u0103 se potriveasc\u0103 cu modelul ${_issue.pattern}`; - return `Format invalid: ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Num\u0103r invalid: trebuie s\u0103 fie multiplu de ${issue2.divisor}`; - case "unrecognized_keys": - return `Chei nerecunoscute: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Cheie invalid\u0103 \xEEn ${issue2.origin}`; - case "invalid_union": - return "Intrare invalid\u0103"; - case "invalid_element": - return `Valoare invalid\u0103 \xEEn ${issue2.origin}`; - default: - return `Intrare invalid\u0103`; - } - }; -}; -function ro_default() { - return { - localeError: error45() - }; -} - -// node_modules/zod/v4/locales/ru.js -function getRussianPlural(count, one, few, many) { - const absCount = Math.abs(count); - const lastDigit = absCount % 10; - const lastTwoDigits = absCount % 100; - if (lastTwoDigits >= 11 && lastTwoDigits <= 19) { - return many; - } - if (lastDigit === 1) { - return one; - } - if (lastDigit >= 2 && lastDigit <= 4) { - return few; - } - return many; -} -var error46 = () => { - const Sizable = { - string: { - unit: { - one: "\u0441\u0438\u043C\u0432\u043E\u043B", - few: "\u0441\u0438\u043C\u0432\u043E\u043B\u0430", - many: "\u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432" - }, - verb: "\u0438\u043C\u0435\u0442\u044C" - }, - file: { - unit: { - one: "\u0431\u0430\u0439\u0442", - few: "\u0431\u0430\u0439\u0442\u0430", - many: "\u0431\u0430\u0439\u0442" - }, - verb: "\u0438\u043C\u0435\u0442\u044C" - }, - array: { - unit: { - one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442", - few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430", - many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432" - }, - verb: "\u0438\u043C\u0435\u0442\u044C" - }, - set: { - unit: { - one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442", - few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430", - many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432" - }, - verb: "\u0438\u043C\u0435\u0442\u044C" - }, - map: { - unit: { - one: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442", - few: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u0430", - many: "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u043E\u0432" - }, - verb: "\u0438\u043C\u0435\u0442\u044C" - } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0432\u0432\u043E\u0434", - email: "email \u0430\u0434\u0440\u0435\u0441", - url: "URL", - emoji: "\u044D\u043C\u043E\u0434\u0437\u0438", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043C\u044F", - date: "ISO \u0434\u0430\u0442\u0430", - time: "ISO \u0432\u0440\u0435\u043C\u044F", - duration: "ISO \u0434\u043B\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u044C", - ipv4: "IPv4 \u0430\u0434\u0440\u0435\u0441", - ipv6: "IPv6 \u0430\u0434\u0440\u0435\u0441", - mac: "MAC \u0430\u0434\u0440\u0435\u0441", - cidrv4: "IPv4 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D", - cidrv6: "IPv6 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D", - base64: "\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64", - base64url: "\u0441\u0442\u0440\u043E\u043A\u0430 \u0432 \u0444\u043E\u0440\u043C\u0430\u0442\u0435 base64url", - json_string: "JSON \u0441\u0442\u0440\u043E\u043A\u0430", - e164: "\u043D\u043E\u043C\u0435\u0440 E.164", - credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u044B", - jwt: "JWT", - template_literal: "\u0432\u0432\u043E\u0434" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u0447\u0438\u0441\u043B\u043E", - array: "\u043C\u0430\u0441\u0441\u0438\u0432" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C instanceof ${issue2.expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${received}`; - } - return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${expected}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0432\u043E\u0434: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C ${stringifyPrimitive(issue2.values[0])}`; - return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0432\u0430\u0440\u0438\u0430\u043D\u0442: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0434\u043D\u043E \u0438\u0437 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) { - const maxValue = Number(issue2.maximum); - const unit = getRussianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many); - return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${adj}${issue2.maximum.toString()} ${unit}`; - } - return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - const minValue = Number(issue2.minimum); - const unit = getRussianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many); - return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${adj}${issue2.minimum.toString()} ${unit}`; - } - return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin} \u0431\u0443\u0434\u0435\u0442 ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u043D\u0430\u0447\u0438\u043D\u0430\u0442\u044C\u0441\u044F \u0441 "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0437\u0430\u043A\u0430\u043D\u0447\u0438\u0432\u0430\u0442\u044C\u0441\u044F \u043D\u0430 "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u0434\u0435\u0440\u0436\u0430\u0442\u044C "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u041D\u0435\u0432\u0435\u0440\u043D\u0430\u044F \u0441\u0442\u0440\u043E\u043A\u0430: \u0434\u043E\u043B\u0436\u043D\u0430 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${_issue.pattern}`; - return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0447\u0438\u0441\u043B\u043E: \u0434\u043E\u043B\u0436\u043D\u043E \u0431\u044B\u0442\u044C \u043A\u0440\u0430\u0442\u043D\u044B\u043C ${issue2.divisor}`; - case "unrecognized_keys": - return `\u041D\u0435\u0440\u0430\u0441\u043F\u043E\u0437\u043D\u0430\u043D\u043D${issue2.keys.length > 1 ? "\u044B\u0435" : "\u044B\u0439"} \u043A\u043B\u044E\u0447${issue2.keys.length > 1 ? "\u0438" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u043A\u043B\u044E\u0447 \u0432 ${issue2.origin}`; - case "invalid_union": - return "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435"; - case "invalid_element": - return `\u041D\u0435\u0432\u0435\u0440\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0432 ${issue2.origin}`; - default: - return `\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0435 \u0432\u0445\u043E\u0434\u043D\u044B\u0435 \u0434\u0430\u043D\u043D\u044B\u0435`; - } - }; -}; -function ru_default() { - return { - localeError: error46() - }; -} - -// node_modules/zod/v4/locales/sk.js -var error47 = () => { - const Sizable = { - string: { unit: "znakov", verb: "ma\u0165" }, - file: { unit: "bajtov", verb: "ma\u0165" }, - array: { unit: "prvkov", verb: "ma\u0165" }, - set: { unit: "prvkov", verb: "ma\u0165" }, - map: { unit: "polo\u017Eiek", verb: "ma\u0165" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "regul\xE1rny v\xFDraz", - email: "e-mailov\xE1 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: "d\xE1tum a \u010Das vo form\xE1te ISO", - date: "d\xE1tum vo form\xE1te ISO", - time: "\u010Das vo form\xE1te ISO", - duration: "doba trvania ISO", - ipv4: "IPv4 adresa", - ipv6: "IPv6 adresa", - mac: "MAC adresa", - cidrv4: "rozsah IPv4", - cidrv6: "rozsah IPv6", - base64: "re\u0165azec zak\xF3dovan\xFD vo form\xE1te base64", - base64url: "re\u0165azec zak\xF3dovan\xFD vo form\xE1te base64url", - json_string: "re\u0165azec vo form\xE1te JSON", - e164: "\u010D\xEDslo E.164", - credit_card: "\u010D\xEDslo kreditnej karty", - jwt: "JWT", - template_literal: "vstup" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u010D\xEDslo", - string: "re\u0165azec", - function: "funkcia", - array: "pole" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 instanceof ${issue2.expected}, obdr\u017Ean\xE9 ${received}`; - } - return `Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 ${expected}, obdr\u017Ean\xE9 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Neplatn\xFD vstup: o\u010Dak\xE1van\xE9 ${stringifyPrimitive(issue2.values[0])}`; - return `Neplatn\xFD vstup: o\u010Dak\xE1van\xE1 jedna z hodn\xF4t ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Hodnota je pr\xEDli\u0161 ve\u013Ek\xE1: ${issue2.origin ?? "hodnota"} mus\xED ma\u0165 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "prvkov"}`; - } - return `Hodnota je pr\xEDli\u0161 ve\u013Ek\xE1: ${issue2.origin ?? "hodnota"} mus\xED by\u0165 ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Hodnota je pr\xEDli\u0161 mal\xE1: ${issue2.origin ?? "hodnota"} mus\xED ma\u0165 ${adj}${issue2.minimum.toString()} ${sizing.unit ?? "prvkov"}`; - } - return `Hodnota je pr\xEDli\u0161 mal\xE1: ${issue2.origin ?? "hodnota"} mus\xED by\u0165 ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Neplatn\xFD re\u0165azec: mus\xED za\u010D\xEDna\u0165 na "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Neplatn\xFD re\u0165azec: mus\xED kon\u010Di\u0165 na "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Neplatn\xFD re\u0165azec: mus\xED obsahova\u0165 "${_issue.includes}"`; - if (_issue.format === "regex") - return `Neplatn\xFD re\u0165azec: mus\xED zodpoveda\u0165 vzoru ${_issue.pattern}`; - return `Neplatn\xFD form\xE1t ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Neplatn\xE9 \u010D\xEDslo: mus\xED by\u0165 n\xE1sobkom ${issue2.divisor}`; - case "unrecognized_keys": - return `Nezn\xE1me kl\xFA\u010De: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Neplatn\xFD kl\xFA\u010D v ${issue2.origin}`; - case "invalid_union": - return "Neplatn\xFD vstup"; - case "invalid_element": - return `Neplatn\xE1 hodnota v ${issue2.origin}`; - default: - return `Neplatn\xFD vstup`; - } - }; -}; -function sk_default() { - return { - localeError: error47() - }; -} - -// node_modules/zod/v4/locales/sl.js -var error48 = () => { - const Sizable = { - string: { unit: "znakov", verb: "imeti" }, - file: { unit: "bajtov", verb: "imeti" }, - array: { unit: "elementov", verb: "imeti" }, - set: { unit: "elementov", verb: "imeti" }, - map: { unit: "elementov", verb: "imeti" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "vnos", - email: "e-po\u0161tni 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 \u010Das", - date: "ISO datum", - time: "ISO \u010Das", - duration: "ISO trajanje", - ipv4: "IPv4 naslov", - ipv6: "IPv6 naslov", - mac: "MAC naslov", - cidrv4: "obseg IPv4", - cidrv6: "obseg IPv6", - base64: "base64 kodiran niz", - base64url: "base64url kodiran niz", - json_string: "JSON niz", - e164: "E.164 \u0161tevilka", - credit_card: "\u0161tevilka kreditne kartice", - jwt: "JWT", - template_literal: "vnos" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u0161tevilo", - array: "tabela" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Neveljaven vnos: pri\u010Dakovano instanceof ${issue2.expected}, prejeto ${received}`; - } - return `Neveljaven vnos: pri\u010Dakovano ${expected}, prejeto ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Neveljaven vnos: pri\u010Dakovano ${stringifyPrimitive(issue2.values[0])}`; - return `Neveljavna mo\u017Enost: pri\u010Dakovano eno izmed ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Preveliko: pri\u010Dakovano, da bo ${issue2.origin ?? "vrednost"} imelo ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elementov"}`; - return `Preveliko: pri\u010Dakovano, da bo ${issue2.origin ?? "vrednost"} ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Premajhno: pri\u010Dakovano, da bo ${issue2.origin} imelo ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Premajhno: pri\u010Dakovano, da bo ${issue2.origin} ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `Neveljaven niz: mora se za\u010Deti z "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `Neveljaven niz: mora se kon\u010Dati z "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Neveljaven niz: mora vsebovati "${_issue.includes}"`; - if (_issue.format === "regex") - return `Neveljaven niz: mora ustrezati vzorcu ${_issue.pattern}`; - return `Neveljaven ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Neveljavno \u0161tevilo: mora biti ve\u010Dkratnik ${issue2.divisor}`; - case "unrecognized_keys": - return `Neprepoznan${issue2.keys.length > 1 ? "i klju\u010Di" : " klju\u010D"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Neveljaven klju\u010D v ${issue2.origin}`; - case "invalid_union": - return "Neveljaven vnos"; - case "invalid_element": - return `Neveljavna vrednost v ${issue2.origin}`; - default: - return "Neveljaven vnos"; - } - }; -}; -function sl_default() { - return { - localeError: error48() - }; -} - -// node_modules/zod/v4/locales/sv.js -var error49 = () => { - const Sizable = { - string: { unit: "tecken", verb: "att ha" }, - file: { unit: "bytes", verb: "att ha" }, - array: { unit: "objekt", verb: "att inneh\xE5lla" }, - set: { unit: "objekt", verb: "att inneh\xE5lla" }, - map: { unit: "objekt", verb: "att inneh\xE5lla" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "regulj\xE4rt 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-adress", - ipv6: "IPv6-adress", - mac: "MAC-adress", - cidrv4: "IPv4-spektrum", - cidrv6: "IPv6-spektrum", - base64: "base64-kodad str\xE4ng", - base64url: "base64url-kodad str\xE4ng", - json_string: "JSON-str\xE4ng", - e164: "E.164-nummer", - credit_card: "kreditkortsnummer", - jwt: "JWT", - template_literal: "mall-literal" - }; - const TypeDictionary = { - nan: "NaN", - number: "antal", - array: "lista" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Ogiltig inmatning: f\xF6rv\xE4ntat instanceof ${issue2.expected}, fick ${received}`; - } - return `Ogiltig inmatning: f\xF6rv\xE4ntat ${expected}, fick ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Ogiltig inmatning: f\xF6rv\xE4ntat ${stringifyPrimitive(issue2.values[0])}`; - return `Ogiltigt val: f\xF6rv\xE4ntade en av ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `F\xF6r stor(t): f\xF6rv\xE4ntade ${issue2.origin ?? "v\xE4rdet"} att ha ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "element"}`; - } - return `F\xF6r stor(t): f\xF6rv\xE4ntat ${issue2.origin ?? "v\xE4rdet"} att ha ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `F\xF6r lite(t): f\xF6rv\xE4ntade ${issue2.origin ?? "v\xE4rdet"} att ha ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `F\xF6r lite(t): f\xF6rv\xE4ntade ${issue2.origin ?? "v\xE4rdet"} att ha ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `Ogiltig str\xE4ng: m\xE5ste b\xF6rja med "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `Ogiltig str\xE4ng: m\xE5ste sluta med "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Ogiltig str\xE4ng: m\xE5ste inneh\xE5lla "${_issue.includes}"`; - if (_issue.format === "regex") - return `Ogiltig str\xE4ng: m\xE5ste matcha m\xF6nstret "${_issue.pattern}"`; - return `Ogiltig(t) ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Ogiltigt tal: m\xE5ste vara en multipel av ${issue2.divisor}`; - case "unrecognized_keys": - return `${issue2.keys.length > 1 ? "Ok\xE4nda nycklar" : "Ok\xE4nd nyckel"}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Ogiltig nyckel i ${issue2.origin ?? "v\xE4rdet"}`; - case "invalid_union": - return "Ogiltig input"; - case "invalid_element": - return `Ogiltigt v\xE4rde i ${issue2.origin ?? "v\xE4rdet"}`; - default: - return `Ogiltig input`; - } - }; -}; -function sv_default() { - return { - localeError: error49() - }; -} - -// node_modules/zod/v4/locales/ta.js -var error50 = () => { - const Sizable = { - string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }, - file: { unit: "\u0BAA\u0BC8\u0B9F\u0BCD\u0B9F\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }, - array: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }, - set: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" }, - map: { unit: "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1", - email: "\u0BAE\u0BBF\u0BA9\u0BCD\u0BA9\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF", - 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 \u0BA4\u0BC7\u0BA4\u0BBF \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD", - date: "ISO \u0BA4\u0BC7\u0BA4\u0BBF", - time: "ISO \u0BA8\u0BC7\u0BB0\u0BAE\u0BCD", - duration: "ISO \u0B95\u0BBE\u0BB2 \u0B85\u0BB3\u0BB5\u0BC1", - ipv4: "IPv4 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF", - ipv6: "IPv6 \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF", - mac: "MAC \u0BAE\u0BC1\u0B95\u0BB5\u0BB0\u0BBF", - cidrv4: "IPv4 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1", - cidrv6: "IPv6 \u0BB5\u0BB0\u0BAE\u0BCD\u0BAA\u0BC1", - base64: "base64-encoded \u0B9A\u0BB0\u0BAE\u0BCD", - base64url: "base64url-encoded \u0B9A\u0BB0\u0BAE\u0BCD", - json_string: "JSON \u0B9A\u0BB0\u0BAE\u0BCD", - e164: "E.164 \u0B8E\u0BA3\u0BCD", - credit_card: "\u0B95\u0B9F\u0BA9\u0BCD \u0B85\u0B9F\u0BCD\u0B9F\u0BC8 \u0B8E\u0BA3\u0BCD", - jwt: "JWT", - template_literal: "input" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u0B8E\u0BA3\u0BCD", - array: "\u0B85\u0BA3\u0BBF", - null: "\u0BB5\u0BC6\u0BB1\u0BC1\u0BAE\u0BC8" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 instanceof ${issue2.expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${received}`; - } - return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${expected}, \u0BAA\u0BC6\u0BB1\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${stringifyPrimitive(issue2.values[0])}`; - return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0BB0\u0BC1\u0BAA\u0BCD\u0BAA\u0BAE\u0BCD: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${joinValues(issue2.values, "|")} \u0B87\u0BB2\u0BCD \u0B92\u0BA9\u0BCD\u0BB1\u0BC1`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.origin ?? "\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0B89\u0BB1\u0BC1\u0BAA\u0BCD\u0BAA\u0BC1\u0B95\u0BB3\u0BCD"} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; - } - return `\u0BAE\u0BBF\u0B95 \u0BAA\u0BC6\u0BB0\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.origin ?? "\u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1"} ${adj}${issue2.maximum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; - } - return `\u0BAE\u0BBF\u0B95\u0B9A\u0BCD \u0B9A\u0BBF\u0BB1\u0BBF\u0BAF\u0BA4\u0BC1: \u0B8E\u0BA4\u0BBF\u0BB0\u0BCD\u0BAA\u0BBE\u0BB0\u0BCD\u0B95\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0B9F\u0BCD\u0B9F\u0BA4\u0BC1 ${issue2.origin} ${adj}${issue2.minimum.toString()} \u0B86\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${_issue.prefix}" \u0B87\u0BB2\u0BCD \u0BA4\u0BCA\u0B9F\u0B99\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; - if (_issue.format === "ends_with") - return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${_issue.suffix}" \u0B87\u0BB2\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0B9F\u0BC8\u0BAF \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; - if (_issue.format === "includes") - return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: "${_issue.includes}" \u0B90 \u0B89\u0BB3\u0BCD\u0BB3\u0B9F\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; - if (_issue.format === "regex") - return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B9A\u0BB0\u0BAE\u0BCD: ${_issue.pattern} \u0BAE\u0BC1\u0BB1\u0BC8\u0BAA\u0BBE\u0B9F\u0BCD\u0B9F\u0BC1\u0B9F\u0BA9\u0BCD \u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; - return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B8E\u0BA3\u0BCD: ${issue2.divisor} \u0B87\u0BA9\u0BCD \u0BAA\u0BB2\u0BAE\u0BBE\u0B95 \u0B87\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD`; - case "unrecognized_keys": - return `\u0B85\u0B9F\u0BC8\u0BAF\u0BBE\u0BB3\u0BAE\u0BCD \u0BA4\u0BC6\u0BB0\u0BBF\u0BAF\u0BBE\u0BA4 \u0BB5\u0BBF\u0B9A\u0BC8${issue2.keys.length > 1 ? "\u0B95\u0BB3\u0BCD" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `${issue2.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BB5\u0BBF\u0B9A\u0BC8`; - case "invalid_union": - return "\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1"; - case "invalid_element": - return `${issue2.origin} \u0B87\u0BB2\u0BCD \u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0BAE\u0BA4\u0BBF\u0BAA\u0BCD\u0BAA\u0BC1`; - default: - return `\u0BA4\u0BB5\u0BB1\u0BBE\u0BA9 \u0B89\u0BB3\u0BCD\u0BB3\u0BC0\u0B9F\u0BC1`; - } - }; -}; -function ta_default() { - return { - localeError: error50() - }; -} - -// node_modules/zod/v4/locales/th.js -var error51 = () => { - const Sizable = { - string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }, - file: { unit: "\u0E44\u0E1A\u0E15\u0E4C", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }, - array: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }, - set: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" }, - map: { unit: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19", - email: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48\u0E2D\u0E35\u0E40\u0E21\u0E25", - url: "URL", - emoji: "\u0E2D\u0E34\u0E42\u0E21\u0E08\u0E34", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO", - date: "\u0E27\u0E31\u0E19\u0E17\u0E35\u0E48\u0E41\u0E1A\u0E1A ISO", - time: "\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO", - duration: "\u0E0A\u0E48\u0E27\u0E07\u0E40\u0E27\u0E25\u0E32\u0E41\u0E1A\u0E1A ISO", - ipv4: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv4", - ipv6: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 IPv6", - mac: "\u0E17\u0E35\u0E48\u0E2D\u0E22\u0E39\u0E48 MAC", - cidrv4: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv4", - cidrv6: "\u0E0A\u0E48\u0E27\u0E07 IP \u0E41\u0E1A\u0E1A IPv6", - base64: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64", - base64url: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A Base64 \u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A URL", - json_string: "\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E41\u0E1A\u0E1A JSON", - e164: "\u0E40\u0E1A\u0E2D\u0E23\u0E4C\u0E42\u0E17\u0E23\u0E28\u0E31\u0E1E\u0E17\u0E4C\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07\u0E1B\u0E23\u0E30\u0E40\u0E17\u0E28 (E.164)", - credit_card: "\u0E2B\u0E21\u0E32\u0E22\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E40\u0E04\u0E23\u0E14\u0E34\u0E15", - jwt: "\u0E42\u0E17\u0E40\u0E04\u0E19 JWT", - template_literal: "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E17\u0E35\u0E48\u0E1B\u0E49\u0E2D\u0E19" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02", - array: "\u0E2D\u0E32\u0E23\u0E4C\u0E40\u0E23\u0E22\u0E4C (Array)", - null: "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E04\u0E48\u0E32 (null)" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 instanceof ${issue2.expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${received}`; - } - return `\u0E1B\u0E23\u0E30\u0E40\u0E20\u0E17\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${expected} \u0E41\u0E15\u0E48\u0E44\u0E14\u0E49\u0E23\u0E31\u0E1A ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u0E04\u0E48\u0E32\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19 ${stringifyPrimitive(issue2.values[0])}`; - return `\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E04\u0E27\u0E23\u0E40\u0E1B\u0E47\u0E19\u0E2B\u0E19\u0E36\u0E48\u0E07\u0E43\u0E19 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19" : "\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${issue2.origin ?? "\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23"}`; - return `\u0E40\u0E01\u0E34\u0E19\u0E01\u0E33\u0E2B\u0E19\u0E14: ${issue2.origin ?? "\u0E04\u0E48\u0E32"} \u0E04\u0E27\u0E23\u0E21\u0E35${adj} ${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? "\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E19\u0E49\u0E2D\u0E22" : "\u0E21\u0E32\u0E01\u0E01\u0E27\u0E48\u0E32"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${issue2.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${adj} ${issue2.minimum.toString()} ${sizing.unit}`; - } - return `\u0E19\u0E49\u0E2D\u0E22\u0E01\u0E27\u0E48\u0E32\u0E01\u0E33\u0E2B\u0E19\u0E14: ${issue2.origin} \u0E04\u0E27\u0E23\u0E21\u0E35${adj} ${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E02\u0E36\u0E49\u0E19\u0E15\u0E49\u0E19\u0E14\u0E49\u0E27\u0E22 "${_issue.prefix}"`; - } - if (_issue.format === "ends_with") - return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E25\u0E07\u0E17\u0E49\u0E32\u0E22\u0E14\u0E49\u0E27\u0E22 "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 "${_issue.includes}" \u0E2D\u0E22\u0E39\u0E48\u0E43\u0E19\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21`; - if (_issue.format === "regex") - return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14 ${_issue.pattern}`; - return `\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u0E15\u0E31\u0E27\u0E40\u0E25\u0E02\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E15\u0E49\u0E2D\u0E07\u0E40\u0E1B\u0E47\u0E19\u0E08\u0E33\u0E19\u0E27\u0E19\u0E17\u0E35\u0E48\u0E2B\u0E32\u0E23\u0E14\u0E49\u0E27\u0E22 ${issue2.divisor} \u0E44\u0E14\u0E49\u0E25\u0E07\u0E15\u0E31\u0E27`; - case "unrecognized_keys": - return `\u0E1E\u0E1A\u0E04\u0E35\u0E22\u0E4C\u0E17\u0E35\u0E48\u0E44\u0E21\u0E48\u0E23\u0E39\u0E49\u0E08\u0E31\u0E01: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u0E04\u0E35\u0E22\u0E4C\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${issue2.origin}`; - case "invalid_union": - return "\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07: \u0E44\u0E21\u0E48\u0E15\u0E23\u0E07\u0E01\u0E31\u0E1A\u0E23\u0E39\u0E1B\u0E41\u0E1A\u0E1A\u0E22\u0E39\u0E40\u0E19\u0E35\u0E22\u0E19\u0E17\u0E35\u0E48\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E44\u0E27\u0E49"; - case "invalid_element": - return `\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07\u0E43\u0E19 ${issue2.origin}`; - default: - return `\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07`; - } - }; -}; -function th_default() { - return { - localeError: error51() - }; -} - -// node_modules/zod/v4/locales/tk.js -var error52 = () => { - const Sizable = { - string: { unit: "simwol", verb: "bolmaly" }, - file: { unit: "ba\xFDt", verb: "bolmaly" }, - array: { unit: "elementler", verb: "bolmaly" }, - set: { unit: "elementler", verb: "bolmaly" }, - map: { unit: "elementler", verb: "bolmaly" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "giri\u015F", - email: "e-po\xE7ta salgysy", - 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 sene we wagt", - date: "ISO sene", - time: "ISO wagt", - duration: "ISO wagt aralygy", - ipv4: "IPv4 salgysy", - ipv6: "IPv6 salgysy", - mac: "MAC salgysy", - cidrv4: "IPv4 aralygy", - cidrv6: "IPv6 aralygy", - base64: "base64 bilen \u015Fifrlenen setir", - base64url: "base64url bilen \u015Fifrlenen setir", - json_string: "JSON setiri", - e164: "E.164 nomeri", - credit_card: "kredit kartyny\u0148 nomeri", - jwt: "JWT", - template_literal: "\u015Fablon" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - return `N\xE4dogry baha: gara\u015Fylan ${expected} \xFDerine ${received} alyndy`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `N\xE4dogry baha: ${stringifyPrimitive(issue2.values[0])} bolmaly`; - return `N\xE4dogry sa\xFDlaw: a\u015Fakdakylardan biri bolmaly: ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Has uly: gara\u015Fyl\xFDan ${issue2.origin ?? "baha"} ${adj} ${issue2.maximum.toString()} ${sizing.unit ?? "element"}`; - return `Has uly: gara\u015Fyl\xFDan ${issue2.origin ?? "baha"} ${adj} ${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Has ki\xE7i: gara\u015Fyl\xFDan ${issue2.origin} ${adj} ${issue2.minimum.toString()} ${sizing.unit}`; - return `Has ki\xE7i: gara\u015Fyl\xFDan ${issue2.origin} ${adj} ${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `N\xE4dogry setir: "${_issue.prefix}" bilen ba\u015Flamaly`; - if (_issue.format === "ends_with") - return `N\xE4dogry setir: "${_issue.suffix}" bilen gutarmaly`; - if (_issue.format === "includes") - return `N\xE4dogry setir: "${_issue.includes}" saklamaly`; - if (_issue.format === "regex") - return `N\xE4dogry setir: ${_issue.pattern} nusga la\xFDyk bolmaly`; - return `N\xE4dogry ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `N\xE4dogry san: ${issue2.divisor} bilen galyndysyz b\xF6l\xFCnmeli`; - case "unrecognized_keys": - return `Tanalma\xFDan a\xE7ar${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `${issue2.origin} i\xE7inde n\xE4dogry a\xE7ar`; - case "invalid_union": - return "N\xE4dogry baha"; - case "invalid_element": - return `${issue2.origin} i\xE7inde n\xE4dogry baha`; - default: - return `N\xE4dogry baha`; - } - }; -}; -function tk_default() { - return { - localeError: error52() - }; -} - -// node_modules/zod/v4/locales/tr.js -var error53 = () => { - const Sizable = { - string: { unit: "karakter", verb: "olmal\u0131" }, - file: { unit: "bayt", verb: "olmal\u0131" }, - array: { unit: "\xF6\u011Fe", verb: "olmal\u0131" }, - set: { unit: "\xF6\u011Fe", verb: "olmal\u0131" }, - map: { unit: "\xF6\u011Fe", verb: "olmal\u0131" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - 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\xFCre", - ipv4: "IPv4 adresi", - ipv6: "IPv6 adresi", - mac: "MAC adresi", - cidrv4: "IPv4 aral\u0131\u011F\u0131", - cidrv6: "IPv6 aral\u0131\u011F\u0131", - base64: "base64 ile \u015Fifrelenmi\u015F metin", - base64url: "base64url ile \u015Fifrelenmi\u015F metin", - json_string: "JSON dizesi", - e164: "E.164 say\u0131s\u0131", - credit_card: "kredi kart\u0131 numaras\u0131", - jwt: "JWT", - template_literal: "\u015Eablon dizesi" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Ge\xE7ersiz de\u011Fer: beklenen instanceof ${issue2.expected}, al\u0131nan ${received}`; - } - return `Ge\xE7ersiz de\u011Fer: beklenen ${expected}, al\u0131nan ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Ge\xE7ersiz de\u011Fer: beklenen ${stringifyPrimitive(issue2.values[0])}`; - return `Ge\xE7ersiz se\xE7enek: a\u015Fa\u011F\u0131dakilerden biri olmal\u0131: ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\xC7ok b\xFCy\xFCk: beklenen ${issue2.origin ?? "de\u011Fer"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\xF6\u011Fe"}`; - return `\xC7ok b\xFCy\xFCk: beklenen ${issue2.origin ?? "de\u011Fer"} ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\xC7ok k\xFC\xE7\xFCk: beklenen ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - return `\xC7ok k\xFC\xE7\xFCk: beklenen ${issue2.origin} ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Ge\xE7ersiz metin: "${_issue.prefix}" ile ba\u015Flamal\u0131`; - if (_issue.format === "ends_with") - return `Ge\xE7ersiz metin: "${_issue.suffix}" ile bitmeli`; - if (_issue.format === "includes") - return `Ge\xE7ersiz metin: "${_issue.includes}" i\xE7ermeli`; - if (_issue.format === "regex") - return `Ge\xE7ersiz metin: ${_issue.pattern} desenine uymal\u0131`; - return `Ge\xE7ersiz ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Ge\xE7ersiz say\u0131: ${issue2.divisor} ile tam b\xF6l\xFCnebilmeli`; - case "unrecognized_keys": - return `Tan\u0131nmayan anahtar${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `${issue2.origin} i\xE7inde ge\xE7ersiz anahtar`; - case "invalid_union": - return "Ge\xE7ersiz de\u011Fer"; - case "invalid_element": - return `${issue2.origin} i\xE7inde ge\xE7ersiz de\u011Fer`; - default: - return `Ge\xE7ersiz de\u011Fer`; - } - }; -}; -function tr_default() { - return { - localeError: error53() - }; -} - -// node_modules/zod/v4/locales/uk.js -var error54 = () => { - const Sizable = { - string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }, - file: { unit: "\u0431\u0430\u0439\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }, - array: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }, - set: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" }, - map: { unit: "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456", - email: "\u0430\u0434\u0440\u0435\u0441\u0430 \u0435\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u043E\u0457 \u043F\u043E\u0448\u0442\u0438", - url: "URL", - emoji: "\u0435\u043C\u043E\u0434\u0437\u0456", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "\u0434\u0430\u0442\u0430 \u0442\u0430 \u0447\u0430\u0441 ISO", - date: "\u0434\u0430\u0442\u0430 ISO", - time: "\u0447\u0430\u0441 ISO", - duration: "\u0442\u0440\u0438\u0432\u0430\u043B\u0456\u0441\u0442\u044C ISO", - ipv4: "\u0430\u0434\u0440\u0435\u0441\u0430 IPv4", - ipv6: "\u0430\u0434\u0440\u0435\u0441\u0430 IPv6", - mac: "\u0430\u0434\u0440\u0435\u0441\u0430 MAC", - cidrv4: "\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv4", - cidrv6: "\u0434\u0456\u0430\u043F\u0430\u0437\u043E\u043D IPv6", - base64: "\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64", - base64url: "\u0440\u044F\u0434\u043E\u043A \u0443 \u043A\u043E\u0434\u0443\u0432\u0430\u043D\u043D\u0456 base64url", - json_string: "\u0440\u044F\u0434\u043E\u043A JSON", - e164: "\u043D\u043E\u043C\u0435\u0440 E.164", - credit_card: "\u043D\u043E\u043C\u0435\u0440 \u043A\u0440\u0435\u0434\u0438\u0442\u043D\u043E\u0457 \u043A\u0430\u0440\u0442\u043A\u0438", - jwt: "JWT", - template_literal: "\u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u0447\u0438\u0441\u043B\u043E", - array: "\u043C\u0430\u0441\u0438\u0432" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F instanceof ${issue2.expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${received}`; - } - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${expected}, \u043E\u0442\u0440\u0438\u043C\u0430\u043D\u043E ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F ${stringifyPrimitive(issue2.values[0])}`; - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0430 \u043E\u043F\u0446\u0456\u044F: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F \u043E\u0434\u043D\u0435 \u0437 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0435\u043B\u0435\u043C\u0435\u043D\u0442\u0456\u0432"}`; - return `\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u0432\u0435\u043B\u0438\u043A\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F"} \u0431\u0443\u0434\u0435 ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `\u0417\u0430\u043D\u0430\u0434\u0442\u043E \u043C\u0430\u043B\u0435: \u043E\u0447\u0456\u043A\u0443\u0454\u0442\u044C\u0441\u044F, \u0449\u043E ${issue2.origin} \u0431\u0443\u0434\u0435 ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043F\u043E\u0447\u0438\u043D\u0430\u0442\u0438\u0441\u044F \u0437 "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0437\u0430\u043A\u0456\u043D\u0447\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u043D\u0430 "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u043C\u0456\u0441\u0442\u0438\u0442\u0438 "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u0440\u044F\u0434\u043E\u043A: \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0442\u0438 \u0448\u0430\u0431\u043B\u043E\u043D\u0443 ${_issue.pattern}`; - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0447\u0438\u0441\u043B\u043E: \u043F\u043E\u0432\u0438\u043D\u043D\u043E \u0431\u0443\u0442\u0438 \u043A\u0440\u0430\u0442\u043D\u0438\u043C ${issue2.divisor}`; - case "unrecognized_keys": - return `\u041D\u0435\u0440\u043E\u0437\u043F\u0456\u0437\u043D\u0430\u043D\u0438\u0439 \u043A\u043B\u044E\u0447${issue2.keys.length > 1 ? "\u0456" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0438\u0439 \u043A\u043B\u044E\u0447 \u0443 ${issue2.origin}`; - case "invalid_union": - return "\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456"; - case "invalid_element": - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F \u0443 ${issue2.origin}`; - default: - return `\u041D\u0435\u043F\u0440\u0430\u0432\u0438\u043B\u044C\u043D\u0456 \u0432\u0445\u0456\u0434\u043D\u0456 \u0434\u0430\u043D\u0456`; - } - }; -}; -function uk_default() { - return { - localeError: error54() - }; -} - -// node_modules/zod/v4/locales/ua.js -function ua_default() { - return uk_default(); -} - -// node_modules/zod/v4/locales/ur.js -var error55 = () => { - const Sizable = { - string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" }, - file: { unit: "\u0628\u0627\u0626\u0679\u0633", verb: "\u06C1\u0648\u0646\u0627" }, - array: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" }, - set: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" }, - map: { unit: "\u0622\u0626\u0679\u0645\u0632", verb: "\u06C1\u0648\u0646\u0627" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0627\u0646 \u067E\u0679", - email: "\u0627\u06CC \u0645\u06CC\u0644 \u0627\u06CC\u0688\u0631\u06CC\u0633", - url: "\u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644", - emoji: "\u0627\u06CC\u0645\u0648\u062C\u06CC", - uuid: "\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC", - uuidv4: "\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 4", - uuidv6: "\u06CC\u0648 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC \u0648\u06CC 6", - nanoid: "\u0646\u06CC\u0646\u0648 \u0622\u0626\u06CC \u0688\u06CC", - guid: "\u062C\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC", - cuid: "\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC", - cuid2: "\u0633\u06CC \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC 2", - ulid: "\u06CC\u0648 \u0627\u06CC\u0644 \u0622\u0626\u06CC \u0688\u06CC", - xid: "\u0627\u06CC\u06A9\u0633 \u0622\u0626\u06CC \u0688\u06CC", - ksuid: "\u06A9\u06D2 \u0627\u06CC\u0633 \u06CC\u0648 \u0622\u0626\u06CC \u0688\u06CC", - datetime: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0688\u06CC\u0679 \u0679\u0627\u0626\u0645", - date: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u062A\u0627\u0631\u06CC\u062E", - time: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0648\u0642\u062A", - duration: "\u0622\u0626\u06CC \u0627\u06CC\u0633 \u0627\u0648 \u0645\u062F\u062A", - ipv4: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0627\u06CC\u0688\u0631\u06CC\u0633", - ipv6: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0627\u06CC\u0688\u0631\u06CC\u0633", - mac: "\u0627\u06CC\u0645 \u0627\u06D2 \u0633\u06CC \u0627\u06CC\u0688\u0631\u06CC\u0633", - cidrv4: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 4 \u0631\u06CC\u0646\u062C", - cidrv6: "\u0622\u0626\u06CC \u067E\u06CC \u0648\u06CC 6 \u0631\u06CC\u0646\u062C", - base64: "\u0628\u06CC\u0633 64 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF", - base64url: "\u0628\u06CC\u0633 64 \u06CC\u0648 \u0622\u0631 \u0627\u06CC\u0644 \u0627\u0646 \u06A9\u0648\u0688\u0688 \u0633\u0679\u0631\u0646\u06AF", - json_string: "\u062C\u06D2 \u0627\u06CC\u0633 \u0627\u0648 \u0627\u06CC\u0646 \u0633\u0679\u0631\u0646\u06AF", - e164: "\u0627\u06CC 164 \u0646\u0645\u0628\u0631", - credit_card: "\u06A9\u0631\u06CC\u0688\u0679 \u06A9\u0627\u0631\u0688 \u0646\u0645\u0628\u0631", - jwt: "\u062C\u06D2 \u0688\u0628\u0644\u06CC\u0648 \u0679\u06CC", - template_literal: "\u0627\u0646 \u067E\u0679" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u0646\u0645\u0628\u0631", - array: "\u0622\u0631\u06D2", - null: "\u0646\u0644" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: instanceof ${issue2.expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${received} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`; - } - return `\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${expected} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627\u060C ${received} \u0645\u0648\u0635\u0648\u0644 \u06C1\u0648\u0627`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679: ${stringifyPrimitive(issue2.values[0])} \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`; - return `\u063A\u0644\u0637 \u0622\u067E\u0634\u0646: ${joinValues(issue2.values, "|")} \u0645\u06CC\u06BA \u0633\u06D2 \u0627\u06CC\u06A9 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u0628\u06C1\u062A \u0628\u0691\u0627: ${issue2.origin ?? "\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u06D2 ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u0639\u0646\u0627\u0635\u0631"} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`; - return `\u0628\u06C1\u062A \u0628\u0691\u0627: ${issue2.origin ?? "\u0648\u06CC\u0644\u06CC\u0648"} \u06A9\u0627 ${adj}${issue2.maximum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${issue2.origin} \u06A9\u06D2 ${adj}${issue2.minimum.toString()} ${sizing.unit} \u06C1\u0648\u0646\u06D2 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u06D2`; - } - return `\u0628\u06C1\u062A \u0686\u06BE\u0648\u0679\u0627: ${issue2.origin} \u06A9\u0627 ${adj}${issue2.minimum.toString()} \u06C1\u0648\u0646\u0627 \u0645\u062A\u0648\u0642\u0639 \u062A\u06BE\u0627`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${_issue.prefix}" \u0633\u06D2 \u0634\u0631\u0648\u0639 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`; - } - if (_issue.format === "ends_with") - return `\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${_issue.suffix}" \u067E\u0631 \u062E\u062A\u0645 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`; - if (_issue.format === "includes") - return `\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: "${_issue.includes}" \u0634\u0627\u0645\u0644 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`; - if (_issue.format === "regex") - return `\u063A\u0644\u0637 \u0633\u0679\u0631\u0646\u06AF: \u067E\u06CC\u0679\u0631\u0646 ${_issue.pattern} \u0633\u06D2 \u0645\u06CC\u0686 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`; - return `\u063A\u0644\u0637 ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u063A\u0644\u0637 \u0646\u0645\u0628\u0631: ${issue2.divisor} \u06A9\u0627 \u0645\u0636\u0627\u0639\u0641 \u06C1\u0648\u0646\u0627 \u0686\u0627\u06C1\u06CC\u06D2`; - case "unrecognized_keys": - return `\u063A\u06CC\u0631 \u062A\u0633\u0644\u06CC\u0645 \u0634\u062F\u06C1 \u06A9\u06CC${issue2.keys.length > 1 ? "\u0632" : ""}: ${joinValues(issue2.keys, "\u060C ")}`; - case "invalid_key": - return `${issue2.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u06A9\u06CC`; - case "invalid_union": - return "\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679"; - case "invalid_element": - return `${issue2.origin} \u0645\u06CC\u06BA \u063A\u0644\u0637 \u0648\u06CC\u0644\u06CC\u0648`; - default: - return `\u063A\u0644\u0637 \u0627\u0646 \u067E\u0679`; - } - }; -}; -function ur_default() { - return { - localeError: error55() - }; -} - -// node_modules/zod/v4/locales/uz.js -var error56 = () => { - const Sizable = { - string: { unit: "belgi", verb: "bo\u2018lishi kerak" }, - file: { unit: "bayt", verb: "bo\u2018lishi kerak" }, - array: { unit: "element", verb: "bo\u2018lishi kerak" }, - set: { unit: "element", verb: "bo\u2018lishi kerak" }, - map: { unit: "yozuv", verb: "bo\u2018lishi kerak" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "kirish", - email: "elektron pochta manzili", - 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 sana va vaqti", - date: "ISO sana", - time: "ISO vaqt", - duration: "ISO davomiylik", - ipv4: "IPv4 manzil", - ipv6: "IPv6 manzil", - mac: "MAC manzil", - cidrv4: "IPv4 diapazon", - cidrv6: "IPv6 diapazon", - base64: "base64 kodlangan satr", - base64url: "base64url kodlangan satr", - json_string: "JSON satr", - e164: "E.164 raqam", - credit_card: "kredit karta raqami", - jwt: "JWT", - template_literal: "kirish" - }; - const TypeDictionary = { - nan: "NaN", - number: "raqam", - array: "massiv" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `Noto\u2018g\u2018ri kirish: kutilgan instanceof ${issue2.expected}, qabul qilingan ${received}`; - } - return `Noto\u2018g\u2018ri kirish: kutilgan ${expected}, qabul qilingan ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `Noto\u2018g\u2018ri kirish: kutilgan ${stringifyPrimitive(issue2.values[0])}`; - return `Noto\u2018g\u2018ri variant: quyidagilardan biri kutilgan ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Juda katta: kutilgan ${issue2.origin ?? "qiymat"} ${adj}${issue2.maximum.toString()} ${sizing.unit} ${sizing.verb}`; - return `Juda katta: kutilgan ${issue2.origin ?? "qiymat"} ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Juda kichik: kutilgan ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit} ${sizing.verb}`; - } - return `Juda kichik: kutilgan ${issue2.origin} ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Noto\u2018g\u2018ri satr: "${_issue.prefix}" bilan boshlanishi kerak`; - if (_issue.format === "ends_with") - return `Noto\u2018g\u2018ri satr: "${_issue.suffix}" bilan tugashi kerak`; - if (_issue.format === "includes") - return `Noto\u2018g\u2018ri satr: "${_issue.includes}" ni o\u2018z ichiga olishi kerak`; - if (_issue.format === "regex") - return `Noto\u2018g\u2018ri satr: ${_issue.pattern} shabloniga mos kelishi kerak`; - return `Noto\u2018g\u2018ri ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `Noto\u2018g\u2018ri raqam: ${issue2.divisor} ning karralisi bo\u2018lishi kerak`; - case "unrecognized_keys": - return `Noma\u2019lum kalit${issue2.keys.length > 1 ? "lar" : ""}: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `${issue2.origin} dagi kalit noto\u2018g\u2018ri`; - case "invalid_union": - return "Noto\u2018g\u2018ri kirish"; - case "invalid_element": - return `${issue2.origin} da noto\u2018g\u2018ri qiymat`; - default: - return `Noto\u2018g\u2018ri kirish`; - } - }; -}; -function uz_default() { - return { - localeError: error56() - }; -} - -// node_modules/zod/v4/locales/vi.js -var error57 = () => { - const Sizable = { - string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" }, - file: { unit: "byte", verb: "c\xF3" }, - array: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" }, - set: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" }, - map: { unit: "ph\u1EA7n t\u1EED", verb: "c\xF3" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u0111\u1EA7u v\xE0o", - email: "\u0111\u1ECBa ch\u1EC9 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\xE0y gi\u1EDD ISO", - date: "ng\xE0y ISO", - time: "gi\u1EDD ISO", - duration: "kho\u1EA3ng th\u1EDDi gian ISO", - ipv4: "\u0111\u1ECBa ch\u1EC9 IPv4", - ipv6: "\u0111\u1ECBa ch\u1EC9 IPv6", - mac: "\u0111\u1ECBa ch\u1EC9 MAC", - cidrv4: "d\u1EA3i IPv4", - cidrv6: "d\u1EA3i IPv6", - base64: "chu\u1ED7i m\xE3 h\xF3a base64", - base64url: "chu\u1ED7i m\xE3 h\xF3a base64url", - json_string: "chu\u1ED7i JSON", - e164: "s\u1ED1 E.164", - credit_card: "s\u1ED1 th\u1EBB t\xEDn d\u1EE5ng", - jwt: "JWT", - template_literal: "\u0111\u1EA7u v\xE0o" - }; - const TypeDictionary = { - nan: "NaN", - number: "s\u1ED1", - array: "m\u1EA3ng" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i instanceof ${issue2.expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${received}`; - } - return `\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${expected}, nh\u1EADn \u0111\u01B0\u1EE3c ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i ${stringifyPrimitive(issue2.values[0])}`; - return `T\xF9y ch\u1ECDn kh\xF4ng h\u1EE3p l\u1EC7: mong \u0111\u1EE3i m\u1ED9t trong c\xE1c gi\xE1 tr\u1ECB ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${issue2.origin ?? "gi\xE1 tr\u1ECB"} ${sizing.verb} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "ph\u1EA7n t\u1EED"}`; - return `Qu\xE1 l\u1EDBn: mong \u0111\u1EE3i ${issue2.origin ?? "gi\xE1 tr\u1ECB"} ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `Qu\xE1 nh\u1ECF: mong \u0111\u1EE3i ${issue2.origin} ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i k\u1EBFt th\xFAc b\u1EB1ng "${_issue.suffix}"`; - if (_issue.format === "includes") - return `Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i bao g\u1ED3m "${_issue.includes}"`; - if (_issue.format === "regex") - return `Chu\u1ED7i kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i kh\u1EDBp v\u1EDBi m\u1EABu ${_issue.pattern}`; - return `${FormatDictionary[_issue.format] ?? issue2.format} kh\xF4ng h\u1EE3p l\u1EC7`; - } - case "not_multiple_of": - return `S\u1ED1 kh\xF4ng h\u1EE3p l\u1EC7: ph\u1EA3i l\xE0 b\u1ED9i s\u1ED1 c\u1EE7a ${issue2.divisor}`; - case "unrecognized_keys": - return `Kh\xF3a kh\xF4ng \u0111\u01B0\u1EE3c nh\u1EADn d\u1EA1ng: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `Kh\xF3a kh\xF4ng h\u1EE3p l\u1EC7 trong ${issue2.origin}`; - case "invalid_union": - return "\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7"; - case "invalid_element": - return `Gi\xE1 tr\u1ECB kh\xF4ng h\u1EE3p l\u1EC7 trong ${issue2.origin}`; - default: - return `\u0110\u1EA7u v\xE0o kh\xF4ng h\u1EE3p l\u1EC7`; - } - }; -}; -function vi_default() { - return { - localeError: error57() - }; -} - -// node_modules/zod/v4/locales/zh-CN.js -var error58 = () => { - const Sizable = { - string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" }, - file: { unit: "\u5B57\u8282", verb: "\u5305\u542B" }, - array: { unit: "\u9879", verb: "\u5305\u542B" }, - set: { unit: "\u9879", verb: "\u5305\u542B" }, - map: { unit: "\u9879", verb: "\u5305\u542B" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u8F93\u5165", - email: "\u7535\u5B50\u90AE\u4EF6", - url: "URL", - emoji: "\u8868\u60C5\u7B26\u53F7", - uuid: "UUID", - uuidv4: "UUIDv4", - uuidv6: "UUIDv6", - nanoid: "nanoid", - guid: "GUID", - cuid: "cuid", - cuid2: "cuid2", - ulid: "ULID", - xid: "XID", - ksuid: "KSUID", - datetime: "ISO\u65E5\u671F\u65F6\u95F4", - date: "ISO\u65E5\u671F", - time: "ISO\u65F6\u95F4", - duration: "ISO\u65F6\u957F", - ipv4: "IPv4\u5730\u5740", - ipv6: "IPv6\u5730\u5740", - mac: "MAC\u5730\u5740", - cidrv4: "IPv4\u7F51\u6BB5", - cidrv6: "IPv6\u7F51\u6BB5", - base64: "base64\u7F16\u7801\u5B57\u7B26\u4E32", - base64url: "base64url\u7F16\u7801\u5B57\u7B26\u4E32", - json_string: "JSON\u5B57\u7B26\u4E32", - e164: "E.164\u53F7\u7801", - credit_card: "\u4FE1\u7528\u5361\u53F7", - jwt: "JWT", - template_literal: "\u8F93\u5165" - }; - const TypeDictionary = { - nan: "NaN", - number: "\u6570\u5B57", - array: "\u6570\u7EC4", - null: "\u7A7A\u503C(null)" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B instanceof ${issue2.expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${received}`; - } - return `\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${expected}\uFF0C\u5B9E\u9645\u63A5\u6536 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u65E0\u6548\u8F93\u5165\uFF1A\u671F\u671B ${stringifyPrimitive(issue2.values[0])}`; - return `\u65E0\u6548\u9009\u9879\uFF1A\u671F\u671B\u4EE5\u4E0B\u4E4B\u4E00 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${issue2.origin ?? "\u503C"} ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u4E2A\u5143\u7D20"}`; - return `\u6570\u503C\u8FC7\u5927\uFF1A\u671F\u671B ${issue2.origin ?? "\u503C"} ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${issue2.origin} ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `\u6570\u503C\u8FC7\u5C0F\uFF1A\u671F\u671B ${issue2.origin} ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${_issue.prefix}" \u5F00\u5934`; - if (_issue.format === "ends_with") - return `\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u4EE5 "${_issue.suffix}" \u7ED3\u5C3E`; - if (_issue.format === "includes") - return `\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u5305\u542B "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u65E0\u6548\u5B57\u7B26\u4E32\uFF1A\u5FC5\u987B\u6EE1\u8DB3\u6B63\u5219\u8868\u8FBE\u5F0F ${_issue.pattern}`; - return `\u65E0\u6548${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u65E0\u6548\u6570\u5B57\uFF1A\u5FC5\u987B\u662F ${issue2.divisor} \u7684\u500D\u6570`; - case "unrecognized_keys": - return `\u51FA\u73B0\u672A\u77E5\u7684\u952E(key): ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `${issue2.origin} \u4E2D\u7684\u952E(key)\u65E0\u6548`; - case "invalid_union": - return "\u65E0\u6548\u8F93\u5165"; - case "invalid_element": - return `${issue2.origin} \u4E2D\u5305\u542B\u65E0\u6548\u503C(value)`; - default: - return `\u65E0\u6548\u8F93\u5165`; - } - }; -}; -function zh_CN_default() { - return { - localeError: error58() - }; -} - -// node_modules/zod/v4/locales/zh-TW.js -var error59 = () => { - const Sizable = { - string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" }, - file: { unit: "\u4F4D\u5143\u7D44", verb: "\u64C1\u6709" }, - array: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" }, - set: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" }, - map: { unit: "\u9805\u76EE", verb: "\u64C1\u6709" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u8F38\u5165", - email: "\u90F5\u4EF6\u5730\u5740", - 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 \u65E5\u671F\u6642\u9593", - date: "ISO \u65E5\u671F", - time: "ISO \u6642\u9593", - duration: "ISO \u671F\u9593", - ipv4: "IPv4 \u4F4D\u5740", - ipv6: "IPv6 \u4F4D\u5740", - mac: "MAC \u4F4D\u5740", - cidrv4: "IPv4 \u7BC4\u570D", - cidrv6: "IPv6 \u7BC4\u570D", - base64: "base64 \u7DE8\u78BC\u5B57\u4E32", - base64url: "base64url \u7DE8\u78BC\u5B57\u4E32", - json_string: "JSON \u5B57\u4E32", - e164: "E.164 \u6578\u503C", - credit_card: "\u4FE1\u7528\u5361\u865F", - jwt: "JWT", - template_literal: "\u8F38\u5165" - }; - const TypeDictionary = { - nan: "NaN" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA instanceof ${issue2.expected}\uFF0C\u4F46\u6536\u5230 ${received}`; - } - return `\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${expected}\uFF0C\u4F46\u6536\u5230 ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\u7121\u6548\u7684\u8F38\u5165\u503C\uFF1A\u9810\u671F\u70BA ${stringifyPrimitive(issue2.values[0])}`; - return `\u7121\u6548\u7684\u9078\u9805\uFF1A\u9810\u671F\u70BA\u4EE5\u4E0B\u5176\u4E2D\u4E4B\u4E00 ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${issue2.origin ?? "\u503C"} \u61C9\u70BA ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "\u500B\u5143\u7D20"}`; - return `\u6578\u503C\u904E\u5927\uFF1A\u9810\u671F ${issue2.origin ?? "\u503C"} \u61C9\u70BA ${adj}${issue2.maximum.toString()}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) { - return `\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${issue2.origin} \u61C9\u70BA ${adj}${issue2.minimum.toString()} ${sizing.unit}`; - } - return `\u6578\u503C\u904E\u5C0F\uFF1A\u9810\u671F ${issue2.origin} \u61C9\u70BA ${adj}${issue2.minimum.toString()}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") { - return `\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${_issue.prefix}" \u958B\u982D`; - } - if (_issue.format === "ends_with") - return `\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u4EE5 "${_issue.suffix}" \u7D50\u5C3E`; - if (_issue.format === "includes") - return `\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u5305\u542B "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u7121\u6548\u7684\u5B57\u4E32\uFF1A\u5FC5\u9808\u7B26\u5408\u683C\u5F0F ${_issue.pattern}`; - return `\u7121\u6548\u7684 ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `\u7121\u6548\u7684\u6578\u5B57\uFF1A\u5FC5\u9808\u70BA ${issue2.divisor} \u7684\u500D\u6578`; - case "unrecognized_keys": - return `\u7121\u6CD5\u8B58\u5225\u7684\u9375\u503C${issue2.keys.length > 1 ? "\u5011" : ""}\uFF1A${joinValues(issue2.keys, "\u3001")}`; - case "invalid_key": - return `${issue2.origin} \u4E2D\u6709\u7121\u6548\u7684\u9375\u503C`; - case "invalid_union": - return "\u7121\u6548\u7684\u8F38\u5165\u503C"; - case "invalid_element": - return `${issue2.origin} \u4E2D\u6709\u7121\u6548\u7684\u503C`; - default: - return `\u7121\u6548\u7684\u8F38\u5165\u503C`; - } - }; -}; -function zh_TW_default() { - return { - localeError: error59() - }; -} - -// node_modules/zod/v4/locales/yo.js -var error60 = () => { - const Sizable = { - string: { unit: "\xE0mi", verb: "n\xED" }, - file: { unit: "bytes", verb: "n\xED" }, - array: { unit: "nkan", verb: "n\xED" }, - set: { unit: "nkan", verb: "n\xED" }, - map: { unit: "nkan", verb: "n\xED" } - }; - function getSizing(origin) { - return Sizable[origin] ?? null; - } - const FormatDictionary = { - regex: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9", - email: "\xE0d\xEDr\u1EB9\u0301s\xEC \xECm\u1EB9\u0301l\xEC", - 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: "\xE0k\xF3k\xF2 ISO", - date: "\u1ECDj\u1ECD\u0301 ISO", - time: "\xE0k\xF3k\xF2 ISO", - duration: "\xE0k\xF3k\xF2 t\xF3 p\xE9 ISO", - ipv4: "\xE0d\xEDr\u1EB9\u0301s\xEC IPv4", - ipv6: "\xE0d\xEDr\u1EB9\u0301s\xEC IPv6", - mac: "\xE0d\xEDr\u1EB9\u0301s\xEC MAC", - cidrv4: "\xE0gb\xE8gb\xE8 IPv4", - cidrv6: "\xE0gb\xE8gb\xE8 IPv6", - base64: "\u1ECD\u0300r\u1ECD\u0300 t\xED a k\u1ECD\u0301 n\xED base64", - base64url: "\u1ECD\u0300r\u1ECD\u0300 base64url", - json_string: "\u1ECD\u0300r\u1ECD\u0300 JSON", - e164: "n\u1ECD\u0301mb\xE0 E.164", - credit_card: "n\u1ECDmba kaadi gbese", - jwt: "JWT", - template_literal: "\u1EB9\u0300r\u1ECD \xECb\xE1w\u1ECDl\xE9" - }; - const TypeDictionary = { - nan: "NaN", - number: "n\u1ECD\u0301mb\xE0", - array: "akop\u1ECD" - }; - return (issue2) => { - switch (issue2.code) { - case "invalid_type": { - const expected = TypeDictionary[issue2.expected] ?? issue2.expected; - const receivedType = parsedType(issue2.input); - const received = TypeDictionary[receivedType] ?? receivedType; - if (/^[A-Z]/.test(issue2.expected)) { - return `\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi instanceof ${issue2.expected}, \xE0m\u1ECD\u0300 a r\xED ${received}`; - } - return `\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${expected}, \xE0m\u1ECD\u0300 a r\xED ${received}`; - } - case "invalid_value": - if (issue2.values.length === 1) - return `\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e: a n\xED l\xE1ti fi ${stringifyPrimitive(issue2.values[0])}`; - return `\xC0\u1E63\xE0y\xE0n a\u1E63\xEC\u1E63e: yan \u1ECD\u0300kan l\xE1ra ${joinValues(issue2.values, "|")}`; - case "too_big": { - const adj = issue2.inclusive ? "<=" : "<"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${issue2.origin ?? "iye"} ${sizing.verb} ${adj}${issue2.maximum} ${sizing.unit}`; - return `T\xF3 p\u1ECD\u0300 j\xF9: a n\xED l\xE1ti j\u1EB9\u0301 ${adj}${issue2.maximum}`; - } - case "too_small": { - const adj = issue2.inclusive ? ">=" : ">"; - const sizing = getSizing(issue2.origin); - if (sizing) - return `K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 p\xE9 ${issue2.origin} ${sizing.verb} ${adj}${issue2.minimum} ${sizing.unit}`; - return `K\xE9r\xE9 ju: a n\xED l\xE1ti j\u1EB9\u0301 ${adj}${issue2.minimum}`; - } - case "invalid_format": { - const _issue = issue2; - if (_issue.format === "starts_with") - return `\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\u1EB9\u0300r\u1EB9\u0300 p\u1EB9\u0300l\xFA "${_issue.prefix}"`; - if (_issue.format === "ends_with") - return `\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 par\xED p\u1EB9\u0300l\xFA "${_issue.suffix}"`; - if (_issue.format === "includes") - return `\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 n\xED "${_issue.includes}"`; - if (_issue.format === "regex") - return `\u1ECC\u0300r\u1ECD\u0300 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 b\xE1 \xE0p\u1EB9\u1EB9r\u1EB9 mu ${_issue.pattern}`; - return `A\u1E63\xEC\u1E63e: ${FormatDictionary[_issue.format] ?? issue2.format}`; - } - case "not_multiple_of": - return `N\u1ECD\u0301mb\xE0 a\u1E63\xEC\u1E63e: gb\u1ECD\u0301d\u1ECD\u0300 j\u1EB9\u0301 \xE8y\xE0 p\xEDp\xEDn ti ${issue2.divisor}`; - case "unrecognized_keys": - return `B\u1ECDt\xECn\xEC \xE0\xECm\u1ECD\u0300: ${joinValues(issue2.keys, ", ")}`; - case "invalid_key": - return `B\u1ECDt\xECn\xEC a\u1E63\xEC\u1E63e n\xEDn\xFA ${issue2.origin}`; - case "invalid_union": - return "\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"; - case "invalid_element": - return `Iye a\u1E63\xEC\u1E63e n\xEDn\xFA ${issue2.origin}`; - default: - return "\xCCb\xE1w\u1ECDl\xE9 a\u1E63\xEC\u1E63e"; - } - }; -}; -function yo_default() { - return { - localeError: error60() - }; -} - -// node_modules/zod/v4/core/registries.js -var _a2; -var $output = /* @__PURE__ */ Symbol("ZodOutput"); -var $input = /* @__PURE__ */ Symbol("ZodInput"); -var $ZodRegistry = class { - constructor() { - this._map = /* @__PURE__ */ new WeakMap(); - this._idmap = /* @__PURE__ */ new Map(); - } - add(schema, ..._meta) { - const meta3 = _meta[0]; - this._map.set(schema, meta3); - if (meta3 && typeof meta3 === "object" && "id" in meta3) { - this._idmap.set(meta3.id, schema); - } - return this; - } - clear() { - this._map = /* @__PURE__ */ new WeakMap(); - this._idmap = /* @__PURE__ */ new Map(); - return this; - } - remove(schema) { - const meta3 = this._map.get(schema); - if (meta3 && typeof meta3 === "object" && "id" in meta3) { - this._idmap.delete(meta3.id); - } - this._map.delete(schema); - return this; - } - get(schema) { - const p = schema._zod.parent; - if (p) { - const pm = { ...this.get(p) ?? {} }; - delete pm.id; - const f = { ...pm, ...this._map.get(schema) }; - return Object.keys(f).length ? f : void 0; - } - return this._map.get(schema); - } - has(schema) { - return this._map.has(schema); - } -}; -function registry() { - return new $ZodRegistry(); -} -(_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry()); -var globalRegistry = globalThis.__zod_globalRegistry; - -// node_modules/zod/v4/core/compile.js -var INVALID2 = /* @__PURE__ */ Symbol.for("zod.compile.invalid"); -var FALLBACK_FLAG = /* @__PURE__ */ Symbol.for("zod.compile.fallback"); -var ZodCompileAsyncError = class extends Error { - constructor(message = "z.compile does not support async refinements, transforms, or checks") { - super(message); - this.name = "ZodCompileAsyncError"; - } -}; -var ZodCompileUnsupportedError = class extends Error { - constructor(feature, islandable = true) { - super(`z.compile does not support ${feature}; this schema must use the runtime parser`); - this.name = "ZodCompileUnsupportedError"; - this.islandable = islandable; - } -}; -function compileValidator(schema, parser) { - try { - return compileFn(schema, { assertOnly: true }); - } catch { - return parser; - } -} -function compile(schema, options) { - try { - const parser = compileFn(schema); - const clone2 = clone(schema); - const liveRun = schema._zod.run; - const originalRun = liveRun.__originalRun ?? liveRun; - const wrapped = (payload, ctx) => { - if (ctx?.async || ctx?.direction === "backward" || ctx?.skipChecks || ctx?.[FALLBACK_FLAG]) { - return originalRun(payload, ctx); - } - if (ctx && isBackEdge(ctx, payload.value)) { - return originalRun(payload, ctx); - } - const out = parser(payload.value); - if (out !== INVALID2) { - payload.value = out; - return payload; - } - if (ctx) - ctx[FALLBACK_FLAG] = true; - return originalRun(payload, ctx); - }; - wrapped.__originalRun = originalRun; - clone2._zod.bag.fallbackRun = originalRun; - clone2._zod.bag.validator = compileValidator(schema, parser); - clone2._zod.run = wrapped; - if (!liveRun.__originalRun) - installCompiledUserMethods(clone2, schema, parser); - return clone2; - } catch (err) { - if (options?.strict) - throw err; - return schema; - } -} -function installCompiledUserMethods(target, source, parser) { - const targetAny = target; - const sourceAny = source; - if (typeof sourceAny.safeParse === "function") { - const originalSafeParse = sourceAny.safeParse; - targetAny.safeParse = (data, params) => { - const out = parser(data); - if (out !== INVALID2) { - return { success: true, data: out }; - } - return originalSafeParse(data, params); - }; - } - if (typeof sourceAny.parse === "function") { - const originalParse = sourceAny.parse; - targetAny.parse = (data, params) => { - const out = parser(data); - if (out !== INVALID2) { - return out; - } - return originalParse(data, params); - }; - } -} -function compileFn(schema, options) { - let recursive2 = true; - try { - recursive2 = isRecursiveSchema(schema); - } catch { - } - if (recursive2) { - throw new ZodCompileUnsupportedError("a schema whose subtree contains a reference cycle"); - } - const ctx = { - constants: /* @__PURE__ */ new Map(), - constantCounter: 0, - varCounter: 0 - }; - const doc = new Doc(["input"]); - const outputAccessor = generateCheck(doc, ctx, schema, "input", !options?.assertOnly); - doc.write(outputAccessor === null ? `return true;` : `return ${outputAccessor};`); - const constantNames = ["INVALID", ...ctx.constants.keys()]; - const constantValues = [INVALID2, ...ctx.constants.values()]; - const code = doc.content.join("\n"); - const fullCode = options?.debug ? constantNames.length > 0 ? `// Constants: ${constantNames.join(", ")} -${code}` : code : ""; - const F = Function; - const factoryCode = `return (input) => { -${code} -}`; - let fn; - try { - const factory = new F(...constantNames, factoryCode); - fn = factory(...constantValues); - } catch (err) { - throw new ZodCompileUnsupportedError(`this schema (generated code failed to evaluate: ${err.message})`); - } - if (options?.debug) { - fn.code = fullCode; - } - return fn; -} -function addConstant(ctx, value) { - for (const [name2, v] of ctx.constants) { - if (v === value) - return name2; - } - const name = `c${ctx.constantCounter++}`; - ctx.constants.set(name, value); - return name; -} -function newVar(ctx) { - return `v${ctx.varCounter++}`; -} -function runtimeRun(schema, value) { - const result = schema._zod.run({ value, issues: [] }, {}); - if (result && typeof result.then === "function") - return INVALID2; - const r = result; - return r.issues.length === 0 ? r.value : INVALID2; -} -function compileChild(doc, ctx, schema, accessor, needsValue = true) { - const contentLen = doc.content.length; - const constantCount = ctx.constants.size; - const constantCounter = ctx.constantCounter; - const varCounter = ctx.varCounter; - try { - return generateCheck(doc, ctx, schema, accessor, needsValue); - } catch (err) { - if (!(err instanceof ZodCompileUnsupportedError) || !err.islandable) - throw err; - doc.content.length = contentLen; - if (ctx.constants.size > constantCount) { - const trailing = Array.from(ctx.constants.keys()).slice(constantCount); - for (const k of trailing) - ctx.constants.delete(k); - } - ctx.constantCounter = constantCounter; - ctx.varCounter = varCounter; - return emitRuntimeIsland(doc, ctx, schema, accessor); - } -} -function emitRuntimeIsland(doc, ctx, schema, accessor) { - const schemaConst = addConstant(ctx, schema); - const runConst = addConstant(ctx, runtimeRun); - const outVar = newVar(ctx); - doc.write(`const ${outVar} = ${runConst}(${schemaConst}, ${accessor});`); - doc.write(`if (${outVar} === INVALID) return INVALID;`); - return outVar; -} -var WHEN_DEFAULTED_CHECKS = /* @__PURE__ */ new Set([ - "max_size", - "min_size", - "size_equals", - "max_length", - "min_length", - "length_equals" -]); -function generateChecks(doc, ctx, schema, accessor) { - const schemaChecks = schema._zod.def.checks; - if (!schemaChecks || schemaChecks.length === 0) - return accessor; - let currentAccessor = accessor; - for (const check2 of schemaChecks) { - const def = check2._zod.def; - if (def.when && !WHEN_DEFAULTED_CHECKS.has(def.check)) { - throw new ZodCompileUnsupportedError(`check with a custom "when" condition`); - } - switch (def.check) { - case "greater_than": - generateGreaterThanCheck(doc, ctx, def, currentAccessor); - break; - case "less_than": - generateLessThanCheck(doc, ctx, def, currentAccessor); - break; - case "multiple_of": - generateMultipleOfCheck(doc, ctx, def, currentAccessor); - break; - case "number_format": - generateNumberFormatCheck(doc, def, currentAccessor); - break; - case "min_length": { - const min = numericOperand(def.minimum, "min_length"); - const len = codePointLengthVar(doc, ctx, currentAccessor, `${currentAccessor}.length >= ${min} && ${currentAccessor}.length < ${def.minimum * 2}`); - doc.write(`if (${len} < ${min}) return INVALID;`); - break; - } - case "max_length": { - const max = numericOperand(def.maximum, "max_length"); - const len = codePointLengthVar(doc, ctx, currentAccessor, `${currentAccessor}.length > ${max}`); - doc.write(`if (${len} > ${max}) return INVALID;`); - break; - } - case "length_equals": { - const exact = numericOperand(def.length, "length_equals"); - const len = codePointLengthVar(doc, ctx, currentAccessor, `${currentAccessor}.length >= ${exact} && ${currentAccessor}.length <= ${def.length * 2}`); - doc.write(`if (${len} !== ${exact}) return INVALID;`); - break; - } - case "min_size": - doc.write(`if (${currentAccessor}.size < ${numericOperand(def.minimum, "min_size")}) return INVALID;`); - break; - case "max_size": - doc.write(`if (${currentAccessor}.size > ${numericOperand(def.maximum, "max_size")}) return INVALID;`); - break; - case "size_equals": - doc.write(`if (${currentAccessor}.size !== ${numericOperand(def.size, "size_equals")}) return INVALID;`); - break; - case "string_format": - currentAccessor = generateStringFormatCheck(doc, ctx, def, currentAccessor); - break; - case "custom": - currentAccessor = generateCustomRefineCheck(doc, ctx, check2, currentAccessor); - break; - case "bigint_format": - generateBigIntFormatCheck(doc, def, currentAccessor); - break; - case "mime_type": - generateMimeTypeCheck(doc, ctx, def, currentAccessor); - break; - case "property": - generatePropertyCheck(doc, ctx, def, currentAccessor); - break; - case "overwrite": { - const newAccessor = newVar(ctx); - generateOverwriteCheck(doc, ctx, check2, currentAccessor, newAccessor); - currentAccessor = newAccessor; - break; - } - default: { - void def; - throw new ZodCompileUnsupportedError(`check type ${def.check}`); - } - } - } - return currentAccessor; -} -function codePointLengthVar(doc, ctx, accessor, inDoubt) { - const cpLen = addConstant(ctx, codePointLength); - const v = newVar(ctx); - doc.write(`const ${v} = typeof ${accessor} === "string" && ${inDoubt} ? ${cpLen}(${accessor}) : ${accessor}.length;`); - return v; -} -function numericOperand(value, label) { - if (typeof value !== "number" || !Number.isFinite(value)) { - throw new ZodCompileUnsupportedError(`${label} bound of type ${typeof value}`); - } - return `${value}`; -} -function comparisonOperand(ctx, value) { - if (typeof value === "bigint") - return `${value}n`; - if (typeof value === "number") { - if (Number.isNaN(value)) - throw new ZodCompileUnsupportedError("comparison check with NaN bound"); - return `${value}`; - } - if (value instanceof Date) { - if (Number.isNaN(value.getTime())) { - throw new ZodCompileUnsupportedError("comparison check with Invalid Date bound"); - } - return addConstant(ctx, value); - } - throw new ZodCompileUnsupportedError(`comparison check bound of type ${typeof value}`); -} -function generateGreaterThanCheck(doc, ctx, def, accessor) { - const op = def.inclusive ? "<" : "<="; - doc.write(`if (${accessor} ${op} ${comparisonOperand(ctx, def.value)}) return INVALID;`); -} -function generateLessThanCheck(doc, ctx, def, accessor) { - const op = def.inclusive ? ">" : ">="; - doc.write(`if (${accessor} ${op} ${comparisonOperand(ctx, def.value)}) return INVALID;`); -} -function generateMultipleOfCheck(doc, ctx, def, accessor) { - if (typeof def.value === "bigint") { - if (def.value === BigInt(0)) - throw new ZodCompileUnsupportedError("multiple_of check with a zero divisor"); - doc.write(`if (${accessor} % ${def.value}n !== 0n) return INVALID;`); - } else { - const remainder = addConstant(ctx, floatSafeRemainder2); - doc.write(`if (${remainder}(${accessor}, ${numericOperand(def.value, "multiple_of")}) !== 0) return INVALID;`); - } -} -function generateNumberFormatCheck(doc, def, accessor) { - const format = def.format; - switch (format) { - case "safeint": - doc.write(`if (!Number.isSafeInteger(${accessor})) return INVALID;`); - break; - case "int32": - doc.write(`if (!Number.isInteger(${accessor}) || ${accessor} < -2147483648 || ${accessor} > 2147483647) return INVALID;`); - break; - case "uint32": - doc.write(`if (!Number.isInteger(${accessor}) || ${accessor} < 0 || ${accessor} > 4294967295) return INVALID;`); - break; - case "float32": - doc.write(`if (!Number.isFinite(${accessor}) || ${accessor} < -3.4028234663852886e38 || ${accessor} > 3.4028234663852886e38) return INVALID;`); - break; - case "float64": - doc.write(`if (!Number.isFinite(${accessor})) return INVALID;`); - break; - default: { - void format; - throw new ZodCompileUnsupportedError(`number format ${format}`); - } - } -} -function generateBigIntFormatCheck(doc, def, accessor) { - const format = def.format; - if (!format) - return; - switch (format) { - case "int64": - doc.write(`if (${accessor} < -9223372036854775808n || ${accessor} > 9223372036854775807n) return INVALID;`); - break; - case "uint64": - doc.write(`if (${accessor} < 0n || ${accessor} > 18446744073709551615n) return INVALID;`); - break; - default: { - void format; - throw new ZodCompileUnsupportedError(`bigint format ${format}`); - } - } -} -function generateMimeTypeCheck(doc, ctx, def, accessor) { - const mimeTypes = def.mime; - if (mimeTypes && mimeTypes.length > 0) { - const mimeSet = addConstant(ctx, new Set(mimeTypes)); - doc.write(`if (!${mimeSet}.has(${accessor}.type)) return INVALID;`); - } -} -function generatePropertyCheck(doc, ctx, def, accessor) { - const propAccessor = `${accessor}[${JSON.stringify(def.property)}]`; - generateCheck(doc, ctx, def.schema, propAccessor); -} -function generateOverwriteCheck(doc, ctx, check2, currentAccessor, newAccessor) { - const tx = check2._zod.def.tx; - if (!tx) { - throw new ZodCompileUnsupportedError("overwrite check without a transform function"); - } - if (isAsyncFunction(tx)) { - throw new ZodCompileAsyncError("z.compile: async overwrite transforms are not supported"); - } - const txConst = addConstant(ctx, tx); - doc.write(`const ${newAccessor} = ${txConst}(${currentAccessor});`); -} -function throwAsync() { - throw new $ZodAsyncError(); -} -function pushIssue(issue2) { - this.issues.push(issue2); -} -function generateCustomRefineCheck(doc, ctx, check2, accessor) { - const def = check2._zod.def; - if (def.fn) { - if (isAsyncFunction(def.fn)) { - throw new ZodCompileAsyncError("z.compile: async .refine() predicates are not supported"); - } - const fnConst = addConstant(ctx, def.fn); - const throwAsyncConst = addConstant(ctx, throwAsync); - const resVar = newVar(ctx); - doc.write(`const ${resVar} = ${fnConst}(${accessor});`); - doc.write(`if (${resVar} instanceof Promise) ${throwAsyncConst}();`); - doc.write(`if (!${resVar}) return INVALID;`); - return accessor; - } - if (check2._zod.check) { - if (isAsyncFunction(check2._zod.check)) { - throw new ZodCompileAsyncError("z.compile: async .superRefine() / check functions are not supported"); - } - const checkFn = check2._zod.check; - const helperFn = (value) => { - const fakePayload = { value, issues: [], addIssue: pushIssue }; - const result = checkFn(fakePayload); - if (result instanceof Promise) - throwAsync(); - return fakePayload.issues.length === 0 ? fakePayload.value : INVALID2; - }; - const helperConst = addConstant(ctx, helperFn); - const outVar = newVar(ctx); - doc.write(`const ${outVar} = ${helperConst}(${accessor});`); - doc.write(`if (${outVar} === INVALID) return INVALID;`); - return outVar; - } - throw new ZodCompileUnsupportedError("custom check without a predicate or check function"); -} -var PATTERN_IS_COMPLETE = /* @__PURE__ */ new Set([ - "cidrv4", - "cuid", - "cuid2", - "date", - "datetime", - "duration", - "e164", - "email", - "emoji", - "ends_with", - "guid", - "includes", - "ipv4", - "ksuid", - "lowercase", - "mac", - "nanoid", - "regex", - "starts_with", - "time", - "ulid", - "uppercase", - "uuid", - "xid" -]); -function generateStringFormatCheck(doc, ctx, def, accessor) { - const fmt = def.format; - if (fmt === "base64") { - const validator = addConstant(ctx, isValidBase64); - doc.write(`if (!${validator}(${accessor})) return INVALID;`); - return accessor; - } - if (fmt === "base64url") { - const validator = addConstant(ctx, isValidBase64URL); - doc.write(`if (!${validator}(${accessor})) return INVALID;`); - return accessor; - } - if (fmt === "jwt") { - const validator = addConstant(ctx, isValidJWT2); - const alg = addConstant(ctx, def.alg ?? null); - doc.write(`if (!${validator}(${accessor}, ${alg})) return INVALID;`); - return accessor; - } - if (fmt === "ipv6") { - const validator = addConstant(ctx, isValidIPv6); - doc.write(`if (!${validator}(${accessor})) return INVALID;`); - return accessor; - } - if (fmt === "cidrv6") { - const validator = addConstant(ctx, isValidCIDRv6); - doc.write(`if (!${validator}(${accessor})) return INVALID;`); - return accessor; - } - if (fmt === "credit_card") { - const validator = addConstant(ctx, isValidCreditCard); - doc.write(`if (!${validator}(${accessor})) return INVALID;`); - return accessor; - } - const formatDef = def; - if (fmt === "url" || fmt === "httpurl" || formatDef.normalize || formatDef.hostname !== void 0 || formatDef.protocol !== void 0) { - const parseConst = addConstant(ctx, parseURLObject); - const defConst = addConstant(ctx, def); - const trimVar = newVar(ctx); - const urlVar = newVar(ctx); - doc.write(`const ${trimVar} = ${accessor}.trim();`); - doc.write(`const ${urlVar} = ${parseConst}(${trimVar}, ${defConst});`); - doc.write(`if (typeof ${urlVar} === "number") return INVALID;`); - if (formatDef.hostname !== void 0) { - const hostnameConst = addConstant(ctx, urlHostnameOk); - doc.write(`if (!${hostnameConst}(${urlVar}, ${defConst}.hostname)) return INVALID;`); - } - if (formatDef.protocol !== void 0) { - const protocolConst = addConstant(ctx, urlProtocolOk); - doc.write(`if (!${protocolConst}(${urlVar}, ${defConst}.protocol)) return INVALID;`); - } - const outputVar = newVar(ctx); - const outputExpr = formatDef.normalize ? `${urlVar}.href` : `${addConstant(ctx, stripTabAndNewline)}(${trimVar})`; - doc.write(`const ${outputVar} = ${outputExpr};`); - return outputVar; - } - const customFn = def.fn; - if (customFn) { - if (isAsyncFunction(customFn)) - throw new ZodCompileUnsupportedError(`async string format ${fmt}`); - const fnConst = addConstant(ctx, customFn); - doc.write(`if (!${fnConst}(${accessor})) return INVALID;`); - return accessor; - } - if (PATTERN_IS_COMPLETE.has(fmt) && def.pattern) { - const patternConst = addConstant(ctx, def.pattern); - doc.write(`${patternConst}.lastIndex = 0;`); - doc.write(`if (!${patternConst}.test(${accessor})) return INVALID;`); - return accessor; - } - const format = def.format; - switch (format) { - case "regex": - throw new ZodCompileUnsupportedError("regex format without a pattern"); - case "lowercase": - doc.write(`if (${accessor} !== ${accessor}.toLowerCase()) return INVALID;`); - break; - case "uppercase": - doc.write(`if (${accessor} !== ${accessor}.toUpperCase()) return INVALID;`); - break; - case "includes": - doc.write(`if (!${accessor}.includes(${esc(def.includes)})) return INVALID;`); - break; - case "starts_with": { - const prefix = def.prefix; - doc.write(`if (${accessor}.slice(0, ${prefix.length}) !== ${esc(prefix)}) return INVALID;`); - break; - } - case "ends_with": { - const suffix = def.suffix; - doc.write(`if (${accessor}.slice(-${suffix.length}) !== ${esc(suffix)}) return INVALID;`); - break; - } - default: { - void format; - throw new ZodCompileUnsupportedError(`string format ${format}`); - } - } - return accessor; -} -function generateCheck(doc, ctx, schema, accessor, needsValue = true) { - const def = schema._zod.def; - const type = def.type; - if (def.coerce) { - throw new ZodCompileUnsupportedError(`coercion (z.coerce.${type}())`); - } - const buildsValue = needsValue || !!def.checks?.length; - let typeAccessor; - switch (type) { - case "string": - typeAccessor = generateStringCheck(doc, ctx, schema, accessor); - break; - case "number": - typeAccessor = generateNumberCheck(doc, schema, accessor); - break; - case "boolean": - typeAccessor = generateBooleanCheck(doc, accessor); - break; - case "bigint": - typeAccessor = generateBigIntCheck(doc, schema, accessor); - break; - case "symbol": - typeAccessor = generateSymbolCheck(doc, accessor); - break; - case "undefined": - typeAccessor = generateUndefinedCheck(doc, accessor); - break; - case "null": - typeAccessor = generateNullCheck(doc, accessor); - break; - case "any": - case "unknown": - typeAccessor = accessor; - break; - case "never": - doc.write("return INVALID;"); - typeAccessor = accessor; - break; - case "void": - typeAccessor = generateVoidCheck(doc, accessor); - break; - case "nan": - typeAccessor = generateNaNCheck(doc, accessor); - break; - case "date": - typeAccessor = generateDateCheck(doc, accessor); - break; - case "object": - typeAccessor = generateObjectCheck(doc, ctx, schema, accessor, buildsValue); - break; - case "optional": - typeAccessor = generateOptionalCheck(doc, ctx, schema, accessor, buildsValue); - break; - case "nullable": - typeAccessor = generateNullableCheck(doc, ctx, schema, accessor, buildsValue); - break; - case "array": - typeAccessor = generateArrayCheck(doc, ctx, schema, accessor, buildsValue); - break; - case "literal": - typeAccessor = generateLiteralCheck(doc, ctx, schema, accessor); - break; - case "enum": - typeAccessor = generateEnumCheck(doc, ctx, schema, accessor); - break; - case "readonly": { - const innerOut = generateWrapperCheck(doc, ctx, schema, accessor); - const frozenVar = newVar(ctx); - doc.write(`const ${frozenVar} = Object.freeze(${innerOut});`); - typeAccessor = frozenVar; - break; - } - case "success": - generateWrapperCheck(doc, ctx, schema, accessor); - typeAccessor = "true"; - break; - case "default": - case "prefault": - typeAccessor = generateDefaultCheck(doc, ctx, schema, accessor); - break; - case "nonoptional": - typeAccessor = generateNonOptionalCheck(doc, ctx, schema, accessor); - break; - case "tuple": - typeAccessor = generateTupleCheck(doc, ctx, schema, accessor); - break; - case "union": - typeAccessor = generateUnionCheck(doc, ctx, schema, accessor); - break; - case "intersection": - typeAccessor = generateIntersectionCheck(doc, ctx, schema, accessor); - break; - case "record": - typeAccessor = generateRecordCheck(doc, ctx, schema, accessor); - break; - case "map": - typeAccessor = generateMapCheck(doc, ctx, schema, accessor); - break; - case "set": - typeAccessor = generateSetCheck(doc, ctx, schema, accessor); - break; - case "file": - typeAccessor = generateFileCheck(doc, accessor); - break; - case "template_literal": - typeAccessor = generateTemplateLiteralCheck(doc, ctx, schema, accessor); - break; - case "lazy": - typeAccessor = generateLazyCheck(doc, ctx, schema, accessor); - break; - case "pipe": - typeAccessor = generatePipeCheck(doc, ctx, schema, accessor); - break; - case "custom": - typeAccessor = generateCustomCheck(doc, ctx, schema, accessor); - break; - case "transform": - typeAccessor = generateTransformCheck(doc, ctx, schema, accessor); - break; - case "catch": - typeAccessor = generateCatchCheck(doc, ctx, schema, accessor); - break; - default: { - void type; - throw new ZodCompileUnsupportedError(`schema type ${type}`); - } - } - if (typeAccessor === null) - return null; - return generateChecks(doc, ctx, schema, typeAccessor); -} -function generateStringCheck(doc, ctx, schema, accessor) { - doc.write(`if (typeof ${accessor} !== "string") return INVALID;`); - const def = schema._zod.def; - if (def.format === void 0) - return accessor; - return generateStringFormatCheck(doc, ctx, def, accessor); -} -function generateNumberCheck(doc, schema, accessor) { - doc.write(`if (typeof ${accessor} !== "number" || !Number.isFinite(${accessor})) return INVALID;`); - const def = schema._zod.def; - if (def.check === "number_format" && def.format) { - generateNumberFormatCheck(doc, { format: def.format }, accessor); - } - return accessor; -} -function generateBooleanCheck(doc, accessor) { - doc.write(`if (typeof ${accessor} !== "boolean") return INVALID;`); - return accessor; -} -function generateBigIntCheck(doc, schema, accessor) { - doc.write(`if (typeof ${accessor} !== "bigint") return INVALID;`); - const def = schema._zod.def; - if (def.format) { - switch (def.format) { - case "int64": - doc.write(`if (${accessor} < -9223372036854775808n || ${accessor} > 9223372036854775807n) return INVALID;`); - break; - case "uint64": - doc.write(`if (${accessor} < 0n || ${accessor} > 18446744073709551615n) return INVALID;`); - break; - } - } - return accessor; -} -function generateSymbolCheck(doc, accessor) { - doc.write(`if (typeof ${accessor} !== "symbol") return INVALID;`); - return accessor; -} -function generateUndefinedCheck(doc, accessor) { - doc.write(`if (${accessor} !== undefined) return INVALID;`); - return accessor; -} -function generateNullCheck(doc, accessor) { - doc.write(`if (${accessor} !== null) return INVALID;`); - return accessor; -} -function generateVoidCheck(doc, accessor) { - doc.write(`if (${accessor} !== undefined) return INVALID;`); - return accessor; -} -function generateNaNCheck(doc, accessor) { - doc.write(`if (typeof ${accessor} !== "number" || !Number.isNaN(${accessor})) return INVALID;`); - return accessor; -} -function generateDateCheck(doc, accessor) { - doc.write(`if (!(${accessor} instanceof Date) || Number.isNaN(${accessor}.getTime())) return INVALID;`); - return accessor; -} -function generateObjectCheck(doc, ctx, schema, accessor, buildsValue = true) { - const def = schema._zod.def; - doc.write(`if (typeof ${accessor} !== "object" || ${accessor} === null || Array.isArray(${accessor})) return INVALID;`); - const shape = def.shape; - const keys = Object.keys(shape); - const symbolKeys = Object.getOwnPropertySymbols(shape); - const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys; - const keyExpr = (k) => typeof k === "symbol" ? addConstant(ctx, k) : esc(k); - const propKey = (k) => typeof k === "symbol" ? `[${keyExpr(k)}]` : esc(k); - const propShape = shape; - if (keys.includes("__proto__")) { - throw new ZodCompileUnsupportedError('object shape key "__proto__"'); - } - const propOutputs = /* @__PURE__ */ new Map(); - for (const key of allKeys) { - const propSchema = propShape[key]; - const kx = keyExpr(key); - const inputVar = newVar(ctx); - doc.write(`const ${inputVar} = ${accessor}[${kx}];`); - if (propSchema._zod.optin !== void 0) { - const outputVar2 = newVar(ctx); - doc.write(`let ${outputVar2} = (() => {`); - doc.indented((d) => { - const outputAccessor = compileChild(d, ctx, propSchema, inputVar); - d.write(`return ${outputAccessor};`); - }); - doc.write(`})();`); - if (propSchema._zod.optout === "optional") { - doc.write(`if (${outputVar2} === INVALID) {`); - doc.indented((d) => { - d.write(`if (${kx} in ${accessor}) return INVALID;`); - d.write(`${outputVar2} = undefined;`); - }); - doc.write(`}`); - } else { - doc.write(`if (${outputVar2} === INVALID) return INVALID;`); - } - propOutputs.set(key, outputVar2); - } else { - if (requiresPresenceCheck(propSchema)) { - doc.write(`if (!(${kx} in ${accessor})) return INVALID;`); - } - const outputAccessor = compileChild(doc, ctx, propSchema, inputVar, buildsValue); - if (outputAccessor !== null) - propOutputs.set(key, outputAccessor); - } - } - const catchall = def.catchall; - let unknownKeysMode = "none"; - if (catchall) { - const catchallType = catchall._zod.def.type; - if (catchallType === "never") { - const condition = keys.map((k) => `k !== ${esc(k)}`).join(" && ") || "true"; - doc.write(`for (const k in ${accessor}) {`); - doc.indented((d) => { - d.write(`if (${condition}) return INVALID;`); - }); - doc.write(`}`); - } else if ((catchallType === "unknown" || catchallType === "any") && !catchall._zod.def.checks?.length) { - unknownKeysMode = "passthrough"; - } else { - unknownKeysMode = "schema"; - } - } - const outputVar = newVar(ctx); - const hasConditionalKeys = allKeys.some((k) => mayOutputUndefined(propShape[k]) || dropsWhenAbsent(propShape[k])); - if (!buildsValue) { - if (unknownKeysMode === "schema") { - const knownSet = keys.length > 0 ? addConstant(ctx, new Set(keys)) : null; - doc.write(`for (const k in ${accessor}) {`); - doc.indented((d) => { - d.write(`if (k === "__proto__") continue;`); - if (knownSet) - d.write(`if (${knownSet}.has(k)) continue;`); - const valVar = newVar(ctx); - d.write(`const ${valVar} = ${accessor}[k];`); - compileChild(d, ctx, catchall, valVar, false); - }); - doc.write(`}`); - } - return null; - } - if (!hasConditionalKeys) { - const propLiterals = allKeys.map((k) => `${propKey(k)}: ${propOutputs.get(k)}`).join(", "); - doc.write(`const ${outputVar} = { ${propLiterals} };`); - } else { - doc.write(`const ${outputVar} = {};`); - for (const k of allKeys) { - const kx = keyExpr(k); - const out = propOutputs.get(k); - if (dropsWhenAbsent(propShape[k])) { - doc.write(`if (${kx} in ${accessor}) ${outputVar}[${kx}] = ${out};`); - } else if (mayOutputUndefined(propShape[k])) { - doc.write(`if (${out} !== undefined || ${kx} in ${accessor}) ${outputVar}[${kx}] = ${out};`); - } else { - doc.write(`${outputVar}[${kx}] = ${out};`); - } - } - } - if (unknownKeysMode !== "none") { - const knownSet = keys.length > 0 ? addConstant(ctx, new Set(keys)) : null; - doc.write(`for (const k in ${accessor}) {`); - doc.indented((d) => { - d.write(`if (k === "__proto__") continue;`); - if (knownSet) - d.write(`if (${knownSet}.has(k)) continue;`); - if (unknownKeysMode === "passthrough") { - d.write(`${outputVar}[k] = ${accessor}[k];`); - } else { - const valVar = newVar(ctx); - d.write(`const ${valVar} = ${accessor}[k];`); - const catchallOut = compileChild(d, ctx, catchall, valVar); - d.write(`${outputVar}[k] = ${catchallOut};`); - } - }); - doc.write(`}`); - } - return outputVar; -} -function generateOptionalCheck(doc, ctx, schema, accessor, buildsValue = true) { - const def = schema._zod.def; - if (isExactOptional(schema)) { - return generateCheck(doc, ctx, def.innerType, accessor, buildsValue); - } - if (def.innerType._zod.optin === "defaulted") { - const outputVar2 = newVar(ctx); - const branchVar = newVar(ctx); - doc.write(`let ${outputVar2};`); - doc.write(`if (${accessor} === undefined) {`); - doc.indented((d) => { - d.write(`const ${branchVar} = (() => {`); - d.indented((d2) => { - const innerOutput = generateCheck(d2, ctx, def.innerType, accessor); - d2.write(`return ${innerOutput};`); - }); - d.write(`})();`); - d.write(`if (${branchVar} !== INVALID) ${outputVar2} = ${branchVar};`); - }); - doc.write(`} else {`); - doc.indented((d) => { - const innerOutput = generateCheck(d, ctx, def.innerType, accessor); - d.write(`${outputVar2} = ${innerOutput};`); - }); - doc.write(`}`); - return outputVar2; - } - const outputVar = buildsValue ? newVar(ctx) : null; - if (outputVar) - doc.write(`let ${outputVar};`); - doc.write(`if (${accessor} !== undefined) {`); - doc.indented((d) => { - const innerOutput = generateCheck(d, ctx, def.innerType, accessor, buildsValue); - if (outputVar && innerOutput !== null) - d.write(`${outputVar} = ${innerOutput};`); - }); - doc.write(`}`); - return outputVar; -} -function isExactOptional(schema) { - return schema._zod.traits?.has("$ZodExactOptional") === true; -} -function requiresPresenceCheck(schema) { - return schema._zod.optin === void 0 && fastPathAcceptsAbsence(schema); -} -function fastPathAcceptsAbsence(schema) { - if (schema._zod.def.coerce) - return true; - const def = schema._zod.def; - switch (def.type) { - case "any": - case "unknown": - case "undefined": - case "void": - case "default": - case "prefault": - case "transform": - case "custom": - case "lazy": - return true; - case "string": - case "number": - case "boolean": - case "bigint": - case "symbol": - case "null": - case "never": - case "nan": - case "date": - case "object": - case "array": - case "tuple": - case "record": - case "map": - case "set": - case "file": - case "template_literal": - return false; - case "nonoptional": - return def.innerType ? fastPathAcceptsAbsence(def.innerType) : false; - case "literal": - return !!def.values?.includes(void 0); - case "enum": - return !!schema._zod.values?.has(void 0); - case "optional": - case "nullable": - case "readonly": - case "success": - return def.innerType ? fastPathAcceptsAbsence(def.innerType) : true; - case "catch": - return true; - case "union": - return def.options ? def.options.some(fastPathAcceptsAbsence) : true; - case "intersection": - if (!def.left || !def.right) - return true; - return fastPathAcceptsAbsence(def.left) && fastPathAcceptsAbsence(def.right); - case "pipe": - return def.in ? fastPathAcceptsAbsence(def.in) : true; - default: - return true; - } -} -function dropsWhenAbsent(schema) { - return schema._zod.optin === "optional" && schema._zod.optout === "optional"; -} -function mayOutputUndefined(schema) { - const def = schema._zod.def; - switch (def.type) { - case "string": - case "number": - case "boolean": - case "bigint": - case "symbol": - case "null": - case "nan": - case "date": - case "object": - case "array": - case "tuple": - case "record": - case "map": - case "set": - case "file": - case "template_literal": - case "never": - case "success": - return false; - case "literal": - return !!def.values?.includes(void 0); - case "enum": - return !!schema._zod.values?.has(void 0); - case "optional": - return true; - case "nullable": - case "readonly": - case "nonoptional": - return def.innerType ? mayOutputUndefined(def.innerType) : true; - case "union": - return def.options ? def.options.some(mayOutputUndefined) : true; - case "intersection": - return !def.left || !def.right || mayOutputUndefined(def.left) || mayOutputUndefined(def.right); - case "pipe": - return def.out ? mayOutputUndefined(def.out) : true; - default: - return true; - } -} -function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) { - const def = schema._zod.def; - const outputVar = buildsValue ? newVar(ctx) : null; - if (outputVar) - doc.write(`let ${outputVar} = null;`); - doc.write(`if (${accessor} !== null) {`); - doc.indented((d) => { - const innerOutput = generateCheck(d, ctx, def.innerType, accessor, buildsValue); - if (outputVar && innerOutput !== null) - d.write(`${outputVar} = ${innerOutput};`); - }); - doc.write(`}`); - return outputVar; -} -function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) { - const def = schema._zod.def; - doc.write(`if (!Array.isArray(${accessor})) return INVALID;`); - const outputVar = buildsValue ? newVar(ctx) : null; - const iVar = newVar(ctx); - const elemVar = newVar(ctx); - if (outputVar) - doc.write(`const ${outputVar} = new Array(${accessor}.length);`); - doc.write(`for (let ${iVar} = 0; ${iVar} < ${accessor}.length; ${iVar}++) {`); - doc.indented((d) => { - d.write(`const ${elemVar} = ${accessor}[${iVar}];`); - const elemOutput = compileChild(d, ctx, def.element, elemVar, buildsValue); - if (outputVar && elemOutput !== null) - d.write(`${outputVar}[${iVar}] = ${elemOutput};`); - }); - doc.write(`}`); - return outputVar; -} -function generateLiteralCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - const values = def.values; - if (values.length !== 1) { - const literalSet = addConstant(ctx, new Set(values)); - doc.write(`if (!${literalSet}.has(${accessor})) return INVALID;`); - return accessor; - } - const value = values[0]; - if (typeof value === "number" && Number.isNaN(value)) { - const literalSet = addConstant(ctx, new Set(values)); - doc.write(`if (!${literalSet}.has(${accessor})) return INVALID;`); - return accessor; - } - if (typeof value === "string") { - doc.write(`if (${accessor} !== ${esc(value)}) return INVALID;`); - } else if (typeof value === "number" || typeof value === "boolean") { - doc.write(`if (${accessor} !== ${value}) return INVALID;`); - } else if (value === null) { - doc.write(`if (${accessor} !== null) return INVALID;`); - } else if (value === void 0) { - doc.write(`if (${accessor} !== undefined) return INVALID;`); - } else if (typeof value === "bigint") { - doc.write(`if (${accessor} !== ${value}n) return INVALID;`); - } else { - throw new ZodCompileUnsupportedError(`literal type ${typeof value}`); - } - return accessor; -} -function generateEnumCheck(doc, ctx, schema, accessor) { - const values = schema._zod.values; - if (!values) { - throw new ZodCompileUnsupportedError("enum schema without enumerated values"); - } - const enumSet = addConstant(ctx, values); - doc.write(`if (!${enumSet}.has(${accessor})) return INVALID;`); - return accessor; -} -function generateWrapperCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - return generateCheck(doc, ctx, def.innerType, accessor); -} -function generateDefaultCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - const descriptor = Object.getOwnPropertyDescriptor(schema._zod.def, "defaultValue"); - const defaultGetter = descriptor ? () => schema._zod.def.defaultValue : void 0; - if (schema._zod.def.type === "prefault") { - if (!defaultGetter) { - return generateCheck(doc, ctx, def.innerType, accessor); - } - const defaultFn = addConstant(ctx, defaultGetter); - const inputVar = newVar(ctx); - doc.write(`let ${inputVar} = ${accessor};`); - doc.write(`if (${accessor} === undefined) ${inputVar} = ${defaultFn}();`); - return generateCheck(doc, ctx, def.innerType, inputVar); - } - const outputVar = newVar(ctx); - if (defaultGetter) { - const defaultFn = addConstant(ctx, defaultGetter); - const cloneFn = addConstant(ctx, shallowClone); - doc.write(`let ${outputVar};`); - doc.write(`if (${accessor} === undefined) {`); - doc.indented((d) => { - d.write(`${outputVar} = ${cloneFn}(${defaultFn}());`); - }); - doc.write(`} else {`); - doc.indented((d) => { - const innerOutput = generateCheck(d, ctx, def.innerType, accessor); - d.write(`${outputVar} = ${innerOutput} === undefined ? ${cloneFn}(${defaultFn}()) : ${innerOutput};`); - }); - doc.write(`}`); - } else { - doc.write(`let ${outputVar};`); - doc.write(`if (${accessor} !== undefined) {`); - doc.indented((d) => { - const innerOutput = generateCheck(d, ctx, def.innerType, accessor); - d.write(`${outputVar} = ${innerOutput};`); - }); - doc.write(`}`); - } - return outputVar; -} -function generateNonOptionalCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - const innerOutput = generateCheck(doc, ctx, def.innerType, accessor); - const outputVar = newVar(ctx); - doc.write(`const ${outputVar} = ${innerOutput};`); - doc.write(`if (${outputVar} === undefined) return INVALID;`); - return outputVar; -} -function generateTupleCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - const items = def.items; - const rest = def.rest; - doc.write(`if (!Array.isArray(${accessor})) return INVALID;`); - const optinStart = getTupleOptStart2(items, "optin"); - const optoutStart = getTupleOptStart2(items, "optout"); - if (rest) { - doc.write(`if (${accessor}.length < ${optinStart}) return INVALID;`); - } else { - doc.write(`if (${accessor}.length < ${optinStart} || ${accessor}.length > ${items.length}) return INVALID;`); - } - const outputVar = newVar(ctx); - doc.write(`const ${outputVar} = [];`); - for (let i = 0; i < items.length; i++) { - const itemSchema = items[i]; - if (i >= optoutStart) { - doc.write(`if (${outputVar}.length === ${i}) {`); - doc.indented((d) => { - d.write(`if (${i} < ${accessor}.length) {`); - d.indented((d2) => { - const elemVar = newVar(ctx); - d2.write(`const ${elemVar} = ${accessor}[${i}];`); - const elemOutput = compileChild(d2, ctx, itemSchema, elemVar); - d2.write(`${outputVar}[${i}] = ${elemOutput};`); - }); - d.write(`} else {`); - d.indented((d2) => { - if (dropsWhenAbsent(itemSchema)) { - d2.write(`${outputVar}.length = ${i};`); - return; - } - const elemVar = newVar(ctx); - const branchVar = newVar(ctx); - d2.write(`const ${elemVar} = undefined;`); - d2.write(`const ${branchVar} = (() => {`); - d2.indented((d3) => { - const elemOutput = compileChild(d3, ctx, itemSchema, elemVar); - d3.write(`return ${elemOutput};`); - }); - d2.write(`})();`); - d2.write(`if (${branchVar} === INVALID || ${branchVar} === undefined) ${outputVar}.length = ${i};`); - d2.write(`else ${outputVar}[${i}] = ${branchVar};`); - }); - d.write(`}`); - }); - doc.write(`}`); - } else { - const elemVar = newVar(ctx); - doc.write(`const ${elemVar} = ${accessor}[${i}];`); - const elemOutput = compileChild(doc, ctx, itemSchema, elemVar); - doc.write(`${outputVar}[${i}] = ${elemOutput};`); - } - } - if (rest) { - const iVar = newVar(ctx); - const elemVar = newVar(ctx); - doc.write(`for (let ${iVar} = ${items.length}; ${iVar} < ${accessor}.length; ${iVar}++) {`); - doc.indented((d) => { - d.write(`const ${elemVar} = ${accessor}[${iVar}];`); - const elemOutput = compileChild(d, ctx, rest, elemVar); - d.write(`${outputVar}[${iVar}] = ${elemOutput};`); - }); - doc.write(`}`); - } - return outputVar; -} -function getTupleOptStart2(items, key) { - for (let i = items.length - 1; i >= 0; i--) { - const omittable = key === "optin" ? items[i]._zod.optin !== void 0 : items[i]._zod.optout === "optional"; - if (!omittable) - return i + 1; - } - return 0; -} -function generateUnionCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - const options = def.options; - if (def.discriminator) { - return generateDiscriminatedUnionCheck(doc, ctx, def, accessor); - } - if (def.inclusive === false) { - throw new ZodCompileUnsupportedError("exclusive unions (z.xor)"); - } - if (options.length === 0) { - doc.write("return INVALID;"); - return accessor; - } - if (options.length === 1) { - return generateCheck(doc, ctx, options[0], accessor); - } - const allLiterals = options.every((opt) => opt._zod.def.type === "literal" && !opt._zod.def.checks?.length); - if (allLiterals) { - const values = new Set(options.flatMap((opt) => opt._zod.def.values)); - const valuesConst = addConstant(ctx, values); - doc.write(`if (!${valuesConst}.has(${accessor})) return INVALID;`); - return accessor; - } - const outputVar = newVar(ctx); - doc.write(`let ${outputVar};`); - for (let i = 0; i < options.length; i++) { - const opt = options[i]; - if (i === 0) { - doc.write(`${outputVar} = (() => {`); - } else { - doc.write(`if (${outputVar} === INVALID) ${outputVar} = (() => {`); - } - doc.indented((d) => { - const branchOutput = generateCheck(d, ctx, opt, accessor); - d.write(`return ${branchOutput};`); - }); - doc.write(`})();`); - } - doc.write(`if (${outputVar} === INVALID) return INVALID;`); - return outputVar; -} -function generateDiscriminatedUnionCheck(doc, ctx, def, accessor) { - if (def.unionFallback) { - throw new ZodCompileUnsupportedError("discriminated union with unionFallback"); - } - if (def.options.length === 0) { - doc.write("return INVALID;"); - return accessor; - } - const discVar = newVar(ctx); - const outputVar = newVar(ctx); - doc.write(`const ${discVar} = ${accessor}?.[${esc(def.discriminator)}];`); - doc.write(`let ${outputVar};`); - let firstBranch = true; - const claimed = /* @__PURE__ */ new Set(); - for (const option of def.options) { - const values = option._zod.propValues?.[def.discriminator]; - if (!values || values.size === 0) { - throw new ZodCompileUnsupportedError("discriminated union option without static discriminator values"); - } - for (const value of values) { - if (claimed.has(value)) { - throw new ZodCompileUnsupportedError(`duplicate discriminator value ${String(value)}`); - } - claimed.add(value); - } - const conditions = Array.from(values, (value) => literalEquality(ctx, discVar, value)); - const prefix = firstBranch ? "if" : "else if"; - doc.write(`${prefix} (${conditions.join(" || ")}) {`); - doc.indented((d) => { - const branchOutput = generateCheck(d, ctx, option, accessor); - d.write(`${outputVar} = ${branchOutput};`); - }); - doc.write(`}`); - firstBranch = false; - } - doc.write(`else { return INVALID; }`); - return outputVar; -} -function literalEquality(ctx, accessor, value) { - if (typeof value === "string") - return `${accessor} === ${esc(value)}`; - if (typeof value === "number") { - if (Number.isNaN(value)) - return `Number.isNaN(${accessor})`; - return `${accessor} === ${value}`; - } - if (typeof value === "boolean") - return `${accessor} === ${value}`; - if (value === null) - return `${accessor} === null`; - if (value === void 0) - return `${accessor} === undefined`; - if (typeof value === "bigint") - return `${accessor} === ${value}n`; - if (typeof value === "symbol") { - const symbolConst = addConstant(ctx, value); - return `${accessor} === ${symbolConst}`; - } - throw new ZodCompileUnsupportedError(`literal discriminator value ${String(value)}`); -} -function generateIntersectionCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - const leftOutput = compileChild(doc, ctx, def.left, accessor); - const rightOutput = compileChild(doc, ctx, def.right, accessor); - const mergeConst = addConstant(ctx, mergeValues2); - const mergedVar = newVar(ctx); - doc.write(`const ${mergedVar} = ${mergeConst}(${leftOutput}, ${rightOutput});`); - doc.write(`if (!${mergedVar}.valid) return INVALID;`); - return `${mergedVar}.data`; -} -function generateRecordCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - const isPlainObjectConst = addConstant(ctx, isPlainObject); - doc.write(`if (!${isPlainObjectConst}(${accessor})) return INVALID;`); - const outputVar = newVar(ctx); - const kVar = newVar(ctx); - const valVar = newVar(ctx); - doc.write(`const ${outputVar} = {};`); - const recordDef = def; - const keyValues = recordDef.partial ? void 0 : def.keyType._zod.values; - if (keyValues) { - const inputKeys = []; - for (const key of keyValues) { - if (!(typeof key === "string" || typeof key === "number" || typeof key === "symbol")) { - throw new ZodCompileUnsupportedError(`record key value ${String(key)}`); - } - const inputKey = typeof key === "number" ? key.toString() : key; - if (inputKey === "__proto__") { - throw new ZodCompileUnsupportedError('record key "__proto__"'); - } - inputKeys.push(inputKey); - const keyConst = addConstant(ctx, key); - const outKey = generateCheck(doc, ctx, def.keyType, keyConst); - const valueVar = newVar(ctx); - doc.write(`const ${valueVar} = ${accessor}[${literalPropertyKey(ctx, inputKey)}];`); - const valOutput = compileChild(doc, ctx, def.valueType, valueVar); - doc.write(`${outputVar}[${outKey}] = ${valOutput};`); - } - const knownKeysConst = addConstant(ctx, new Set(inputKeys)); - doc.write(`for (const ${kVar} in ${accessor}) {`); - doc.indented((d) => { - d.write(`if (${knownKeysConst}.has(${kVar})) continue;`); - if (recordDef.mode === "loose") { - d.write(`if (${kVar} !== "__proto__") ${outputVar}[${kVar}] = ${accessor}[${kVar}];`); - } else { - d.write(`return INVALID;`); - } - }); - doc.write(`}`); - return outputVar; - } - const keyDef = def.keyType._zod.def; - const keyIsBareString = keyDef.type === "string" && keyDef.format === void 0 && !keyDef.coerce && (keyDef.checks?.length ?? 0) === 0; - if (!keyIsBareString) { - const isLoose = def.mode === "loose"; - const keyFast = addConstant(ctx, compileFn(def.keyType)); - const numericConst = addConstant(ctx, number); - const propIsEnumerableConst = addConstant(ctx, Object.prototype.propertyIsEnumerable); - const outKeyVar = newVar(ctx); - doc.write(`for (const ${kVar} of Reflect.ownKeys(${accessor})) {`); - doc.indented((d) => { - d.write(`if (${kVar} === "__proto__") continue;`); - d.write(`if (!${propIsEnumerableConst}.call(${accessor}, ${kVar})) continue;`); - d.write(`let ${outKeyVar} = ${keyFast}(${kVar});`); - d.write(`if (${outKeyVar} === INVALID && typeof ${kVar} === "string" && ${numericConst}.test(${kVar})) ${outKeyVar} = ${keyFast}(Number(${kVar}));`); - if (isLoose) { - d.write(`if (${outKeyVar} === INVALID) { ${outputVar}[${kVar}] = ${accessor}[${kVar}]; continue; }`); - } else { - d.write(`if (${outKeyVar} === INVALID) return INVALID;`); - } - d.write(`if (${outKeyVar} === "__proto__") continue;`); - const valueVar = newVar(ctx); - d.write(`const ${valueVar} = ${accessor}[${kVar}];`); - const valOutput = compileChild(d, ctx, def.valueType, valueVar); - d.write(`${outputVar}[${outKeyVar}] = ${valOutput};`); - }); - doc.write(`}`); - return outputVar; - } - const propIsEnumerable = addConstant(ctx, Object.prototype.propertyIsEnumerable); - doc.write(`for (const ${kVar} of Reflect.ownKeys(${accessor})) {`); - doc.indented((d) => { - d.write(`if (${kVar} === "__proto__") continue;`); - d.write(`if (!${propIsEnumerable}.call(${accessor}, ${kVar})) continue;`); - d.write(`if (typeof ${kVar} !== "string") return INVALID;`); - d.write(`const ${valVar} = ${accessor}[${kVar}];`); - const valOutput = compileChild(d, ctx, def.valueType, valVar); - d.write(`${outputVar}[${kVar}] = ${valOutput};`); - }); - doc.write(`}`); - return outputVar; -} -function literalPropertyKey(ctx, key) { - if (typeof key === "string") - return esc(key); - return addConstant(ctx, key); -} -function generateMapCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`); - const outputVar = newVar(ctx); - const kVar = newVar(ctx); - const valVar = newVar(ctx); - doc.write(`const ${outputVar} = new Map();`); - doc.write(`for (const [${kVar}, ${valVar}] of ${accessor}) {`); - doc.indented((d) => { - const keyOutput = generateCheck(d, ctx, def.keyType, kVar); - const valOutput = generateCheck(d, ctx, def.valueType, valVar); - d.write(`${outputVar}.set(${keyOutput}, ${valOutput});`); - }); - doc.write(`}`); - return outputVar; -} -function generateSetCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`); - const outputVar = newVar(ctx); - const valVar = newVar(ctx); - doc.write(`const ${outputVar} = new Set();`); - doc.write(`for (const ${valVar} of ${accessor}) {`); - doc.indented((d) => { - const valOutput = generateCheck(d, ctx, def.valueType, valVar); - d.write(`${outputVar}.add(${valOutput});`); - }); - doc.write(`}`); - return outputVar; -} -function generateFileCheck(doc, accessor) { - doc.write(`if (!(${accessor} instanceof File)) return INVALID;`); - return accessor; -} -function generateTemplateLiteralCheck(doc, ctx, schema, accessor) { - doc.write(`if (typeof ${accessor} !== "string") return INVALID;`); - const pattern = schema._zod.pattern; - if (pattern) { - const patternConst = addConstant(ctx, pattern); - doc.write(`${patternConst}.lastIndex = 0;`); - doc.write(`if (!${patternConst}.test(${accessor})) return INVALID;`); - } - return accessor; -} -function generateLazyCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - const getterConst = addConstant(ctx, def.getter); - const cacheConst = addConstant(ctx, { parser: null }); - doc.write(`if (!${cacheConst}.parser) {`); - doc.indented((d) => { - d.write(`const inner = ${getterConst}();`); - d.write(`${cacheConst}.parser = function(input) {`); - d.indented((d2) => { - d2.write(`const result = inner._zod.run({ value: input, issues: [] }, {});`); - d2.write(`return result.issues.length === 0 ? result.value : INVALID;`); - }); - d.write(`};`); - }); - doc.write(`}`); - const outputVar = newVar(ctx); - doc.write(`const ${outputVar} = ${cacheConst}.parser(${accessor});`); - doc.write(`if (${outputVar} === INVALID) return INVALID;`); - return outputVar; -} -function generatePipeCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - const inputOutput = generateCheck(doc, ctx, def.in, accessor); - if (def.transform) { - if (isAsyncFunction(def.transform)) { - throw new ZodCompileAsyncError("z.compile: async transforms in pipes are not supported"); - } - const transformFn = def.transform; - const helperFn = (value) => { - const fakePayload = { value, issues: [], addIssue: pushIssue }; - const result = transformFn(value, fakePayload); - if (result instanceof Promise) - return INVALID2; - return fakePayload.issues.length === 0 ? result : INVALID2; - }; - const helperConst = addConstant(ctx, helperFn); - const transformedVar = newVar(ctx); - doc.write(`const ${transformedVar} = ${helperConst}(${inputOutput});`); - doc.write(`if (${transformedVar} === INVALID) return INVALID;`); - return generateCheck(doc, ctx, def.out, transformedVar); - } else { - return generateCheck(doc, ctx, def.out, inputOutput); - } -} -function isAsyncFunction(fn) { - return typeof fn === "function" && (fn.constructor.name === "AsyncFunction" || fn[Symbol.toStringTag] === "AsyncFunction"); -} -function generateCustomCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - if (def.fn) { - if (isAsyncFunction(def.fn)) { - throw new ZodCompileAsyncError("z.compile: async custom predicates are not supported"); - } - const fnConst = addConstant(ctx, def.fn); - const throwAsyncConst = addConstant(ctx, throwAsync); - const resVar = newVar(ctx); - doc.write(`const ${resVar} = ${fnConst}(${accessor});`); - doc.write(`if (${resVar} instanceof Promise) ${throwAsyncConst}();`); - doc.write(`if (!${resVar}) return INVALID;`); - } else { - throw new ZodCompileUnsupportedError("custom schema without a predicate function"); - } - return accessor; -} -function runtimeCatch(innerSchema, catchValue, value) { - const result = innerSchema._zod.run({ value, issues: [] }, {}); - if (result && typeof result.then === "function") - return INVALID2; - const r = result; - if (r.issues.length === 0) - return r.value; - return catchValue(); -} -function generateCatchCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - if (!def.catchValue[CONSTANT_CATCH]) { - throw new ZodCompileUnsupportedError("catch with a callback (only a constant catch value compiles)", false); - } - const outputVar = newVar(ctx); - doc.write(`let ${outputVar} = (() => {`); - doc.indented((d) => { - const innerOut = compileChild(d, ctx, def.innerType, accessor); - d.write(`return ${innerOut};`); - }); - doc.write(`})();`); - const innerConst = addConstant(ctx, def.innerType); - const catchConst = addConstant(ctx, def.catchValue); - const catchHelperConst = addConstant(ctx, runtimeCatch); - doc.write(`if (${outputVar} === INVALID) {`); - doc.indented((d) => { - d.write(`${outputVar} = ${catchHelperConst}(${innerConst}, ${catchConst}, ${accessor});`); - d.write(`if (${outputVar} === INVALID) return INVALID;`); - }); - doc.write(`}`); - return outputVar; -} -function generateTransformCheck(doc, ctx, schema, accessor) { - const def = schema._zod.def; - if (def.transform) { - if (isAsyncFunction(def.transform)) { - throw new ZodCompileAsyncError("z.compile: async transforms are not supported"); - } - const transformFn = def.transform; - const helperFn = (value) => { - const fakePayload = { value, issues: [], addIssue: pushIssue }; - const result = transformFn(value, fakePayload); - if (result instanceof Promise) - return INVALID2; - return fakePayload.issues.length === 0 ? result : INVALID2; - }; - const helperConst = addConstant(ctx, helperFn); - const outputVar = newVar(ctx); - doc.write(`const ${outputVar} = ${helperConst}(${accessor});`); - doc.write(`if (${outputVar} === INVALID) return INVALID;`); - return outputVar; - } - return accessor; -} - -// node_modules/zod/v4/core/api.js -// @__NO_SIDE_EFFECTS__ -function _string(Class2, params) { - return new Class2({ - type: "string", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _coercedString(Class2, params) { - return new Class2({ - type: "string", - coerce: true, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _email(Class2, params) { - return new Class2({ - type: "string", - format: "email", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _guid(Class2, params) { - return new Class2({ - type: "string", - format: "guid", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _uuid(Class2, params) { - return new Class2({ - type: "string", - format: "uuid", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _uuidv4(Class2, params) { - return new Class2({ - type: "string", - format: "uuid", - check: "string_format", - abort: false, - version: "v4", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _uuidv6(Class2, params) { - return new Class2({ - type: "string", - format: "uuid", - check: "string_format", - abort: false, - version: "v6", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _uuidv7(Class2, params) { - return new Class2({ - type: "string", - format: "uuid", - check: "string_format", - abort: false, - version: "v7", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _url(Class2, params) { - return new Class2({ - type: "string", - format: "url", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _emoji2(Class2, params) { - return new Class2({ - type: "string", - format: "emoji", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _nanoid(Class2, params) { - return new Class2({ - type: "string", - format: "nanoid", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _cuid(Class2, params) { - return new Class2({ - type: "string", - format: "cuid", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _cuid2(Class2, params) { - return new Class2({ - type: "string", - format: "cuid2", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _ulid(Class2, params) { - return new Class2({ - type: "string", - format: "ulid", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _xid(Class2, params) { - return new Class2({ - type: "string", - format: "xid", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _ksuid(Class2, params) { - return new Class2({ - type: "string", - format: "ksuid", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _ipv4(Class2, params) { - return new Class2({ - type: "string", - format: "ipv4", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _ipv6(Class2, params) { - return new Class2({ - type: "string", - format: "ipv6", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _mac(Class2, params) { - return new Class2({ - type: "string", - format: "mac", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _cidrv4(Class2, params) { - return new Class2({ - type: "string", - format: "cidrv4", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _cidrv6(Class2, params) { - return new Class2({ - type: "string", - format: "cidrv6", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _base64(Class2, params) { - return new Class2({ - type: "string", - format: "base64", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _base64url(Class2, params) { - return new Class2({ - type: "string", - format: "base64url", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _e164(Class2, params) { - return new Class2({ - type: "string", - format: "e164", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _creditCard(Class2, params) { - return new Class2({ - type: "string", - format: "credit_card", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _jwt(Class2, params) { - return new Class2({ - type: "string", - format: "jwt", - check: "string_format", - abort: false, - ...normalizeParams(params) - }); -} -var TimePrecision = { - Any: null, - Minute: -1, - Second: 0, - Millisecond: 3, - Microsecond: 6 -}; -// @__NO_SIDE_EFFECTS__ -function _isoDateTime(Class2, params) { - return new Class2({ - type: "string", - format: "datetime", - check: "string_format", - offset: false, - local: false, - precision: null, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _isoDate(Class2, params) { - return new Class2({ - type: "string", - format: "date", - check: "string_format", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _isoTime(Class2, params) { - return new Class2({ - type: "string", - format: "time", - check: "string_format", - precision: null, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _isoDuration(Class2, params) { - return new Class2({ - type: "string", - format: "duration", - check: "string_format", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _number(Class2, params) { - return new Class2({ - type: "number", - checks: [], - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _coercedNumber(Class2, params) { - return new Class2({ - type: "number", - coerce: true, - checks: [], - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _int(Class2, params) { - return new Class2({ - type: "number", - check: "number_format", - abort: false, - format: "safeint", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _float32(Class2, params) { - return new Class2({ - type: "number", - check: "number_format", - abort: false, - format: "float32", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _float64(Class2, params) { - return new Class2({ - type: "number", - check: "number_format", - abort: false, - format: "float64", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _int32(Class2, params) { - return new Class2({ - type: "number", - check: "number_format", - abort: false, - format: "int32", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _uint32(Class2, params) { - return new Class2({ - type: "number", - check: "number_format", - abort: false, - format: "uint32", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _boolean(Class2, params) { - return new Class2({ - type: "boolean", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _coercedBoolean(Class2, params) { - return new Class2({ - type: "boolean", - coerce: true, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _bigint(Class2, params) { - return new Class2({ - type: "bigint", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _coercedBigint(Class2, params) { - return new Class2({ - type: "bigint", - coerce: true, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _int64(Class2, params) { - return new Class2({ - type: "bigint", - check: "bigint_format", - abort: false, - format: "int64", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _uint64(Class2, params) { - return new Class2({ - type: "bigint", - check: "bigint_format", - abort: false, - format: "uint64", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _symbol(Class2, params) { - return new Class2({ - type: "symbol", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _undefined2(Class2, params) { - return new Class2({ - type: "undefined", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _null2(Class2, params) { - return new Class2({ - type: "null", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _any(Class2) { - return new Class2({ - type: "any" - }); -} -// @__NO_SIDE_EFFECTS__ -function _unknown(Class2) { - return new Class2({ - type: "unknown" - }); -} -// @__NO_SIDE_EFFECTS__ -function _never(Class2, params) { - return new Class2({ - type: "never", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _void(Class2, params) { - return new Class2({ - type: "void", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _date(Class2, params) { - return new Class2({ - type: "date", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _coercedDate(Class2, params) { - return new Class2({ - type: "date", - coerce: true, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _nan(Class2, params) { - return new Class2({ - type: "nan", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _lt(value, params) { - return new $ZodCheckLessThan({ - check: "less_than", - ...normalizeParams(params), - value, - inclusive: false - }); -} -// @__NO_SIDE_EFFECTS__ -function _lte(value, params) { - return new $ZodCheckLessThan({ - check: "less_than", - ...normalizeParams(params), - value, - inclusive: true - }); -} -// @__NO_SIDE_EFFECTS__ -function _gt(value, params) { - return new $ZodCheckGreaterThan({ - check: "greater_than", - ...normalizeParams(params), - value, - inclusive: false - }); -} -// @__NO_SIDE_EFFECTS__ -function _gte(value, params) { - return new $ZodCheckGreaterThan({ - check: "greater_than", - ...normalizeParams(params), - value, - inclusive: true - }); -} -// @__NO_SIDE_EFFECTS__ -function _positive(params) { - return /* @__PURE__ */ _gt(0, params); -} -// @__NO_SIDE_EFFECTS__ -function _negative(params) { - return /* @__PURE__ */ _lt(0, params); -} -// @__NO_SIDE_EFFECTS__ -function _nonpositive(params) { - return /* @__PURE__ */ _lte(0, params); -} -// @__NO_SIDE_EFFECTS__ -function _nonnegative(params) { - return /* @__PURE__ */ _gte(0, params); -} -// @__NO_SIDE_EFFECTS__ -function _multipleOf(value, params) { - return new $ZodCheckMultipleOf({ - check: "multiple_of", - ...normalizeParams(params), - value - }); -} -// @__NO_SIDE_EFFECTS__ -function _maxSize(maximum, params) { - return new $ZodCheckMaxSize({ - check: "max_size", - ...normalizeParams(params), - maximum - }); -} -// @__NO_SIDE_EFFECTS__ -function _minSize(minimum, params) { - return new $ZodCheckMinSize({ - check: "min_size", - ...normalizeParams(params), - minimum - }); -} -// @__NO_SIDE_EFFECTS__ -function _size(size, params) { - return new $ZodCheckSizeEquals({ - check: "size_equals", - ...normalizeParams(params), - size - }); -} -// @__NO_SIDE_EFFECTS__ -function _maxLength(maximum, params) { - const ch = new $ZodCheckMaxLength({ - check: "max_length", - ...normalizeParams(params), - maximum - }); - return ch; -} -// @__NO_SIDE_EFFECTS__ -function _minLength(minimum, params) { - return new $ZodCheckMinLength({ - check: "min_length", - ...normalizeParams(params), - minimum - }); -} -// @__NO_SIDE_EFFECTS__ -function _length(length, params) { - return new $ZodCheckLengthEquals({ - check: "length_equals", - ...normalizeParams(params), - length - }); -} -// @__NO_SIDE_EFFECTS__ -function _regex(pattern, params) { - return new $ZodCheckRegex({ - check: "string_format", - format: "regex", - ...normalizeParams(params), - pattern - }); -} -// @__NO_SIDE_EFFECTS__ -function _lowercase(params) { - return new $ZodCheckLowerCase({ - check: "string_format", - format: "lowercase", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _uppercase(params) { - return new $ZodCheckUpperCase({ - check: "string_format", - format: "uppercase", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _includes(includes, params) { - return new $ZodCheckIncludes({ - check: "string_format", - format: "includes", - ...normalizeParams(params), - includes - }); -} -// @__NO_SIDE_EFFECTS__ -function _startsWith(prefix, params) { - return new $ZodCheckStartsWith({ - check: "string_format", - format: "starts_with", - ...normalizeParams(params), - prefix - }); -} -// @__NO_SIDE_EFFECTS__ -function _endsWith(suffix, params) { - return new $ZodCheckEndsWith({ - check: "string_format", - format: "ends_with", - ...normalizeParams(params), - suffix - }); -} -// @__NO_SIDE_EFFECTS__ -function _property(property, schema, params) { - return new $ZodCheckProperty({ - check: "property", - property, - schema, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _properties(shape) { - return Object.entries(shape).map(([property, schema]) => new $ZodCheckProperty({ check: "property", property, schema })); -} -// @__NO_SIDE_EFFECTS__ -function _mime(types, params) { - return new $ZodCheckMimeType({ - check: "mime_type", - mime: types, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _overwrite(tx) { - return new $ZodCheckOverwrite({ - check: "overwrite", - tx - }); -} -// @__NO_SIDE_EFFECTS__ -function _normalize(form) { - return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form)); -} -// @__NO_SIDE_EFFECTS__ -function _trim() { - return /* @__PURE__ */ _overwrite((input2) => input2.trim()); -} -// @__NO_SIDE_EFFECTS__ -function _toLowerCase() { - return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase()); -} -// @__NO_SIDE_EFFECTS__ -function _toUpperCase() { - return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase()); -} -// @__NO_SIDE_EFFECTS__ -function _slugify() { - return /* @__PURE__ */ _overwrite((input2) => slugify(input2)); -} -// @__NO_SIDE_EFFECTS__ -function _array(Class2, element, params) { - return new Class2({ - type: "array", - element, - // get element() { - // return element; - // }, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _union(Class2, options, params) { - return new Class2({ - type: "union", - options, - ...normalizeParams(params) - }); -} -function _xor(Class2, options, params) { - return new Class2({ - type: "union", - options, - inclusive: false, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _discriminatedUnion(Class2, discriminator, options, params) { - return new Class2({ - type: "union", - options, - discriminator, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _intersection(Class2, left, right) { - return new Class2({ - type: "intersection", - left, - right - }); -} -// @__NO_SIDE_EFFECTS__ -function _tuple(Class2, items, _paramsOrRest, _params) { - const hasRest = _paramsOrRest instanceof $ZodType; - const params = hasRest ? _params : _paramsOrRest; - const rest = hasRest ? _paramsOrRest : null; - return new Class2({ - type: "tuple", - items, - rest, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _record(Class2, keyType, valueType, params) { - return new Class2({ - type: "record", - keyType, - valueType, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _map(Class2, keyType, valueType, params) { - return new Class2({ - type: "map", - keyType, - valueType, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _set(Class2, valueType, params) { - return new Class2({ - type: "set", - valueType, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _enum(Class2, values, params) { - const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values; - return new Class2({ - type: "enum", - entries, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _nativeEnum(Class2, entries, params) { - return new Class2({ - type: "enum", - entries, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _literal(Class2, value, params) { - return new Class2({ - type: "literal", - values: Array.isArray(value) ? value : [value], - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _file(Class2, params) { - return new Class2({ - type: "file", - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _transform(Class2, fn) { - return new Class2({ - type: "transform", - transform: fn - }); -} -// @__NO_SIDE_EFFECTS__ -function _optional(Class2, innerType) { - return new Class2({ - type: "optional", - innerType - }); -} -// @__NO_SIDE_EFFECTS__ -function _nullable(Class2, innerType) { - return new Class2({ - type: "nullable", - innerType - }); -} -// @__NO_SIDE_EFFECTS__ -function _default(Class2, innerType, defaultValue) { - return new Class2({ - type: "default", - innerType, - get defaultValue() { - return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue); - } - }); -} -// @__NO_SIDE_EFFECTS__ -function _nonoptional(Class2, innerType, params) { - return new Class2({ - type: "nonoptional", - innerType, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _success(Class2, innerType) { - return new Class2({ - type: "success", - innerType - }); -} -// @__NO_SIDE_EFFECTS__ -function _catch(Class2, innerType, catchValue) { - return new Class2({ - type: "catch", - innerType, - catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue) - }); -} -// @__NO_SIDE_EFFECTS__ -function _pipe(Class2, in_, out) { - return new Class2({ - type: "pipe", - in: in_, - out - }); -} -// @__NO_SIDE_EFFECTS__ -function _readonly(Class2, innerType) { - return new Class2({ - type: "readonly", - innerType - }); -} -// @__NO_SIDE_EFFECTS__ -function _templateLiteral(Class2, parts, params) { - return new Class2({ - type: "template_literal", - parts, - ...normalizeParams(params) - }); -} -// @__NO_SIDE_EFFECTS__ -function _lazy(Class2, getter) { - return new Class2({ - type: "lazy", - getter - }); -} -// @__NO_SIDE_EFFECTS__ -function _promise(Class2, innerType) { - return new Class2({ - type: "promise", - innerType - }); -} -// @__NO_SIDE_EFFECTS__ -function _custom(Class2, fn, _params) { - const norm = normalizeParams(_params); - norm.abort ?? (norm.abort = true); - const schema = new Class2({ - type: "custom", - check: "custom", - fn, - ...norm - }); - return schema; -} -// @__NO_SIDE_EFFECTS__ -function _refine(Class2, fn, _params) { - const schema = new Class2({ - type: "custom", - check: "custom", - fn, - ...normalizeParams(_params) - }); - return schema; -} -// @__NO_SIDE_EFFECTS__ -function _superRefine(fn, params) { - const ch = /* @__PURE__ */ _check((payload) => { - payload.addIssue = (issue2) => { - if (typeof issue2 === "string") { - payload.issues.push(issue(issue2, payload.value, ch._zod.def)); - } else { - const _issue = issue2; - if (_issue.fatal) - _issue.continue = false; - _issue.code ?? (_issue.code = "custom"); - if (!("input" in _issue)) - _issue.input = payload.value; - _issue.inst ?? (_issue.inst = ch); - _issue.continue ?? (_issue.continue = !ch._zod.def.abort); - payload.issues.push(issue(_issue)); - } - }; - return fn(payload.value, payload); - }, params); - return ch; -} -// @__NO_SIDE_EFFECTS__ -function _check(fn, params) { - const ch = new $ZodCheck({ - check: "custom", - ...normalizeParams(params) - }); - ch._zod.check = fn; - return ch; -} -// @__NO_SIDE_EFFECTS__ -function describe(description) { - const ch = new $ZodCheck({ check: "describe" }); - ch._zod.onattach = [ - (inst) => { - const existing = globalRegistry.get(inst) ?? {}; - globalRegistry.add(inst, { ...existing, description }); - } - ]; - ch._zod.check = () => { - }; - return ch; -} -// @__NO_SIDE_EFFECTS__ -function meta(metadata) { - const ch = new $ZodCheck({ check: "meta" }); - ch._zod.onattach = [ - (inst) => { - const existing = globalRegistry.get(inst) ?? {}; - globalRegistry.add(inst, { ...existing, ...metadata }); - } - ]; - ch._zod.check = () => { - }; - return ch; -} -// @__NO_SIDE_EFFECTS__ -function _stringbool(Classes, _params) { - const params = normalizeParams(_params); - let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"]; - let falsyArray = params.falsy ?? ["false", "0", "no", "off", "n", "disabled"]; - if (params.case !== "sensitive") { - truthyArray = truthyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v); - falsyArray = falsyArray.map((v) => typeof v === "string" ? v.toLowerCase() : v); - } - const truthySet = new Set(truthyArray); - const falsySet = new Set(falsyArray); - const _Codec = Classes.Codec ?? $ZodCodec; - const _Boolean = Classes.Boolean ?? $ZodBoolean; - const _String = Classes.String ?? $ZodString; - const stringSchema = new _String({ type: "string", error: params.error }); - const booleanSchema = new _Boolean({ type: "boolean", error: params.error }); - const codec2 = new _Codec({ - type: "pipe", - in: stringSchema, - out: booleanSchema, - transform: ((input2, payload) => { - let data = input2; - if (params.case !== "sensitive") - data = data.toLowerCase(); - if (truthySet.has(data)) { - return true; - } else if (falsySet.has(data)) { - return false; - } else { - payload.issues.push({ - code: "invalid_value", - expected: "stringbool", - values: [...truthySet, ...falsySet], - input: payload.value, - inst: codec2, - continue: false - }); - return {}; - } - }), - reverseTransform: ((input2, _payload) => { - if (input2 === true) { - return truthyArray[0] || "true"; - } else { - return falsyArray[0] || "false"; - } - }), - error: params.error - }); - codec2._zod.bag.truthy = truthyArray; - codec2._zod.bag.falsy = falsyArray; - codec2._zod.bag.case = params.case ?? "insensitive"; - return codec2; -} -// @__NO_SIDE_EFFECTS__ -function _stringFormat(Class2, format, fnOrRegex, _params = {}) { - const params = normalizeParams(_params); - const def = { - check: "string_format", - type: "string", - format, - fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val), - ...params - }; - if (fnOrRegex instanceof RegExp) { - def.pattern = fnOrRegex; - } - const inst = new Class2(def); - return inst; -} - -// node_modules/zod/v4/core/to-json-schema.js -function assignProps(target, ...sources) { - for (const source of sources) { - for (const key of Reflect.ownKeys(source)) { - if (Object.prototype.propertyIsEnumerable.call(source, key)) { - assignProp(target, key, source[key]); - } - } - } - return target; -} -function initializeContext(params) { - let target = params?.target ?? "draft-2020-12"; - if (target === "draft-4") - target = "draft-04"; - if (target === "draft-7") - target = "draft-07"; - return { - processors: params.processors ?? {}, - metadataRegistry: params?.metadata ?? globalRegistry, - target, - unrepresentable: params?.unrepresentable ?? "throw", - override: params?.override ?? (() => { - }), - io: params?.io ?? "output", - counter: 0, - seen: /* @__PURE__ */ new Map(), - sharedDefsExtractedFor: void 0, - sharedEmitDoneFor: void 0, - cycles: params?.cycles ?? "ref", - reused: params?.reused ?? "inline", - intersections: [], - deferred: [], - external: params?.external ?? void 0 - }; -} -function handleUnrepresentable(schema, ctx, json2, params, message) { - const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message }) : ctx.unrepresentable; - if (result === "any") - return false; - if (result === void 0 || result === "throw") - throw new Error(message); - Object.assign(json2, result); - return true; -} -function process2(schema, ctx, _params = { path: [], schemaPath: [] }) { - var _a3; - const def = schema._zod.def; - const seen = ctx.seen.get(schema); - if (seen) { - seen.count++; - const isCycle = _params.schemaPath.includes(schema); - if (isCycle) { - seen.cycle = _params.path; - } - return seen.schema; - } - const result = { schema: {}, count: 1, cycle: void 0, path: _params.path }; - ctx.seen.set(schema, result); - ctx.sharedDefsExtractedFor = void 0; - ctx.sharedEmitDoneFor = void 0; - const overrideSchema = schema._zod.toJSONSchema?.(); - if (overrideSchema) { - result.schema = overrideSchema; - } else { - const params = { - ..._params, - schemaPath: [..._params.schemaPath, schema], - path: _params.path - }; - if (schema._zod.processJSONSchema) { - schema._zod.processJSONSchema(ctx, result.schema, params); - } else { - const _json = result.schema; - const processor = ctx.processors[def.type]; - if (!processor) { - throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`); - } - processor(schema, ctx, _json, params); - } - const parent = schema._zod.parent; - if (parent) { - if (!result.ref) - result.ref = parent; - process2(parent, ctx, params); - ctx.seen.get(parent).isParent = true; - } - } - const meta3 = ctx.metadataRegistry.get(schema); - if (meta3) - assignProps(result.schema, meta3); - if (ctx.io === "input" && isTransforming(schema)) { - delete result.schema.examples; - delete result.schema.default; - } - if (ctx.io === "input" && "_prefault" in result.schema) - (_a3 = result.schema).default ?? (_a3.default = result.schema._prefault); - delete result.schema._prefault; - const _result = ctx.seen.get(schema); - return _result.schema; -} -function encodeJSONPointerSegment(segment) { - return segment.replace(/~/g, "~0").replace(/\//g, "~1"); -} -function extractDefs(ctx, schema) { - const root = ctx.seen.get(schema); - if (!root) - throw new Error("Unprocessed schema. This is a bug in Zod."); - if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) - return; - const idToSchema = /* @__PURE__ */ new Map(); - for (const entry of ctx.seen.entries()) { - const id = ctx.metadataRegistry.get(entry[0])?.id; - if (id) { - const existing = idToSchema.get(id); - if (existing && existing !== entry[0]) { - throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`); - } - idToSchema.set(id, entry[0]); - } - } - const makeURI = (entry) => { - const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions"; - if (ctx.external) { - const externalId = ctx.external.registry.get(entry[0])?.id; - const uriGenerator = ctx.external.uri ?? ((id2) => id2); - if (externalId) { - return { ref: uriGenerator(externalId) }; - } - const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`; - entry[1].defId = id; - return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}` }; - } - const uriPrefix = `#`; - const defUriPrefix = `${uriPrefix}/${defsSegment}/`; - if (entry[1] === root && !entry[1].schema.id) { - return { ref: uriPrefix }; - } - const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`; - return { defId, ref: defUriPrefix + encodeJSONPointerSegment(defId) }; - }; - const extractToDef = (entry) => { - if (entry[1].schema.$ref) { - return; - } - const seen = entry[1]; - const { ref, defId } = makeURI(entry); - seen.def = { ...seen.schema }; - if (defId) - seen.defId = defId; - const schema2 = seen.schema; - for (const key in schema2) { - delete schema2[key]; - } - schema2.$ref = ref; - }; - if (ctx.cycles === "throw") { - for (const entry of ctx.seen.entries()) { - const seen = entry[1]; - if (seen.cycle) { - throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/ - -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`); - } - } - } - for (const entry of ctx.seen.entries()) { - const seen = entry[1]; - if (schema === entry[0]) { - extractToDef(entry); - continue; - } - if (ctx.external) { - const ext = ctx.external.registry.get(entry[0])?.id; - if (schema !== entry[0] && ext) { - extractToDef(entry); - continue; - } - } - const id = ctx.metadataRegistry.get(entry[0])?.id; - if (id) { - extractToDef(entry); - continue; - } - if (seen.cycle) { - extractToDef(entry); - continue; - } - if (seen.count > 1) { - if (ctx.reused === "ref") { - extractToDef(entry); - continue; - } - } - } - if (ctx.external) - ctx.sharedDefsExtractedFor = ctx.external; -} -function compactTypeUnion(schema) { - const options = schema.anyOf; - if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) - return; - const types = []; - for (const option of options) { - if (!option || typeof option !== "object") - return; - compactTypeUnion(option); - const keys = Object.keys(option); - if (keys.length !== 1 || keys[0] !== "type") - return; - const type = option.type; - for (const member of Array.isArray(type) ? type : [type]) { - if (typeof member !== "string") - return; - if (!types.includes(member)) - types.push(member); - } - } - delete schema.anyOf; - schema.type = types.length === 1 ? types[0] : types; -} -var FOLDABLE_KEYS = /* @__PURE__ */ new Set(["type", "properties", "required", "additionalProperties"]); -var UNION_KEYS = ["oneOf", "anyOf"]; -function undeclaredConstraint(member) { - const extra = member.additionalProperties; - if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) - return null; - return Object.keys(extra).length ? extra : null; -} -function foldObjects(members2) { - const objects = []; - for (const member of members2) { - if (typeof member !== "object" || member.type !== "object") - return null; - for (const key in member) { - if (!FOLDABLE_KEYS.has(key)) - return null; - } - objects.push(member); - } - const properties = {}; - const required2 = /* @__PURE__ */ new Set(); - for (const object3 of objects) { - for (const key in object3.properties) { - if (Object.prototype.hasOwnProperty.call(properties, key)) - continue; - const parts = []; - for (const other of objects) { - const part = other.properties?.[key] ?? undeclaredConstraint(other); - if (part === null || part === void 0) - continue; - if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) - parts.push(part); - } - const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts }; - assignProp(properties, key, merged); - } - for (const key of object3.required ?? []) - required2.add(key); - } - const folded = { type: "object", properties }; - if (required2.size) - folded.required = [...required2]; - if (objects.every((object3) => object3.additionalProperties === false)) { - folded.additionalProperties = false; - } else { - const constraints = []; - for (const object3 of objects) { - const constraint = undeclaredConstraint(object3); - if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) - constraints.push(constraint); - } - if (constraints.length === 1) - folded.additionalProperties = constraints[0]; - else if (constraints.length > 1) - folded.additionalProperties = { allOf: constraints }; - } - return folded; -} -function foldIntersection(json2) { - const allOf = json2.allOf; - if (!Array.isArray(allOf) || allOf.length < 2) - return; - for (const key of FOLDABLE_KEYS) - if (key in json2) - return; - const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k]))); - let folded = null; - if (!unions.length) { - folded = foldObjects(allOf); - } else { - const union2 = unions[0]; - const keyword = UNION_KEYS.find((k) => Array.isArray(union2[k])); - if (Object.keys(union2).length !== 1) - return; - const rest = allOf.filter((m) => m !== union2); - const branches = union2[keyword].map((branch) => foldObjects([...rest, branch])); - if (branches.some((b) => !b)) - return; - folded = { [keyword]: branches }; - } - if (!folded) - return; - delete json2.allOf; - assignProps(json2, folded); -} -function finalize(ctx, schema) { - const root = ctx.seen.get(schema); - if (!root) - throw new Error("Unprocessed schema. This is a bug in Zod."); - const flattenRef = (zodSchema) => { - const seen = ctx.seen.get(zodSchema); - if (seen.ref === null) - return; - const schema2 = seen.def ?? seen.schema; - const _cached = { ...schema2 }; - const ref = seen.ref; - seen.ref = null; - if (ref) { - flattenRef(ref); - const refSeen = ctx.seen.get(ref); - const refSchema = refSeen.schema; - if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) { - schema2.allOf = schema2.allOf ?? []; - schema2.allOf.push(refSchema); - } else { - assignProps(schema2, refSchema); - } - assignProps(schema2, _cached); - const isParentRef = zodSchema._zod.parent === ref; - if (isParentRef) { - for (const key in schema2) { - if (key === "$ref" || key === "allOf") - continue; - if (!(key in _cached)) { - delete schema2[key]; - } - } - } - if (refSchema.$ref && refSeen.def) { - for (const key in schema2) { - if (key === "$ref" || key === "allOf") - continue; - if (key in refSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(refSeen.def[key])) { - delete schema2[key]; - } - } - } - } - const parent = zodSchema._zod.parent; - if (parent && parent !== ref) { - flattenRef(parent); - const parentSeen = ctx.seen.get(parent); - if (parentSeen?.schema.$ref) { - schema2.$ref = parentSeen.schema.$ref; - if (parentSeen.def) { - for (const key in schema2) { - if (key === "$ref" || key === "allOf") - continue; - if (key in parentSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(parentSeen.def[key])) { - delete schema2[key]; - } - } - } - } - } - ctx.override({ - zodSchema, - jsonSchema: schema2, - path: seen.path ?? [] - }); - }; - if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) { - for (const entry of [...ctx.seen.entries()].reverse()) { - flattenRef(entry[0]); - } - if (ctx.target !== "openapi-3.0") { - for (const entry of ctx.seen.entries()) { - compactTypeUnion(entry[1].def ?? entry[1].schema); - } - } - for (const rewrite of ctx.deferred) - rewrite(); - if (ctx.intersections.length) { - const carriers = /* @__PURE__ */ new Map(); - for (const seen of ctx.seen.values()) { - for (const json2 of [seen.schema, seen.def]) { - const allOf = json2?.allOf; - if (!Array.isArray(allOf)) - continue; - const existing = carriers.get(allOf); - if (existing) - existing.push(json2); - else - carriers.set(allOf, [json2]); - } - } - for (const allOf of ctx.intersections) { - for (const json2 of carriers.get(allOf) ?? []) - foldIntersection(json2); - } - } - } - const result = {}; - if (ctx.target === "draft-2020-12") { - result.$schema = "https://json-schema.org/draft/2020-12/schema"; - } else if (ctx.target === "draft-07") { - result.$schema = "http://json-schema.org/draft-07/schema#"; - } else if (ctx.target === "draft-04") { - result.$schema = "http://json-schema.org/draft-04/schema#"; - } else if (ctx.target === "openapi-3.0") { - } else { - } - if (ctx.external?.uri) { - const id = ctx.external.registry.get(schema)?.id; - if (!id) - throw new Error("Schema is missing an `id` property"); - result.$id = ctx.external.uri(id); - } - assignProps(result, root.defId ? root.schema : root.def ?? root.schema); - const rootMetaId = ctx.metadataRegistry.get(schema)?.id; - if (rootMetaId !== void 0 && result.id === rootMetaId) - delete result.id; - const defs = ctx.external?.defs ?? {}; - if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) { - for (const entry of ctx.seen.entries()) { - const seen = entry[1]; - if (seen.def && seen.defId) { - if (seen.def.id === seen.defId) - delete seen.def.id; - assignProp(defs, seen.defId, seen.def); - } - } - } - if (ctx.external) - ctx.sharedEmitDoneFor = ctx.external; - if (ctx.external) { - } else { - if (Object.keys(defs).length > 0) { - if (ctx.target === "draft-2020-12") { - result.$defs = defs; - } else { - result.definitions = defs; - } - } - } - try { - const finalized = JSON.parse(JSON.stringify(result)); - Object.defineProperty(finalized, "~standard", { - value: { - ...schema["~standard"], - jsonSchema: { - input: createStandardJSONSchemaMethod(schema, "input", ctx.processors), - output: createStandardJSONSchemaMethod(schema, "output", ctx.processors) - } - }, - enumerable: false, - writable: false - }); - return finalized; - } catch (_err) { - throw new Error("Error converting schema to JSON."); - } -} -function isTransforming(_schema, _ctx) { - const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() }; - if (ctx.seen.has(_schema)) - return false; - ctx.seen.add(_schema); - const def = _schema._zod.def; - if (def.type === "transform") - return true; - if (def.type === "array") - return isTransforming(def.element, ctx); - if (def.type === "set") - return isTransforming(def.valueType, ctx); - if (def.type === "lazy") - return isTransforming(def.getter(), ctx); - if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault" || def.type === "catch") { - return isTransforming(def.innerType, ctx); - } - if (def.type === "intersection") { - return isTransforming(def.left, ctx) || isTransforming(def.right, ctx); - } - if (def.type === "record" || def.type === "map") { - return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx); - } - if (def.type === "pipe") { - if (_schema._zod.traits.has("$ZodCodec")) - return true; - return isTransforming(def.in, ctx) || isTransforming(def.out, ctx); - } - if (def.type === "object") { - for (const key in def.shape) { - if (isTransforming(def.shape[key], ctx)) - return true; - } - return false; - } - if (def.type === "union") { - for (const option of def.options) { - if (isTransforming(option, ctx)) - return true; - } - return false; - } - if (def.type === "tuple") { - for (const item of def.items) { - if (isTransforming(item, ctx)) - return true; - } - if (def.rest && isTransforming(def.rest, ctx)) - return true; - return false; - } - return false; -} -var createToJSONSchemaMethod = (schema, processors = {}) => (params) => { - const ctx = initializeContext({ ...params, processors }); - process2(schema, ctx); - extractDefs(ctx, schema); - return finalize(ctx, schema); -}; -var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => { - const { libraryOptions, target } = params ?? {}; - const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors }); - process2(schema, ctx); - extractDefs(ctx, schema); - return finalize(ctx, schema); -}; - -// node_modules/zod/v4/core/json-schema-processors.js -var formatMap = { - guid: "uuid", - url: "uri", - datetime: "date-time", - json_string: "json-string", - regex: "" - // do not set -}; -var stringProcessor = (schema, ctx, _json, _params) => { - const json2 = _json; - json2.type = "string"; - const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag; - if (typeof minimum === "number") - json2.minLength = minimum; - if (typeof maximum === "number") - json2.maxLength = maximum; - if (format) { - json2.format = formatMap[format] ?? format; - if (json2.format === "") - delete json2.format; - if (format === "time" || laxFormat) { - delete json2.format; - } - } - if (contentEncoding) - json2.contentEncoding = contentEncoding; - if (patterns && patterns.size > 0) { - const patternList = [...patterns]; - if (patternList.length === 1) - json2.pattern = patternList[0].source; - else if (patternList.length > 1) { - json2.allOf = [ - ...patternList.map((regex) => ({ - ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {}, - pattern: regex.source - })) - ]; - } - } -}; -var numberProcessor = (schema, ctx, _json, params) => { - const json2 = _json; - const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag; - if (typeof format === "string" && format.includes("int")) - json2.type = "integer"; - else - json2.type = "number"; - const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY); - const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY); - const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0"; - if (exMin) { - if (legacy) { - json2.minimum = exclusiveMinimum; - json2.exclusiveMinimum = true; - } else { - json2.exclusiveMinimum = exclusiveMinimum; - } - } else if (typeof minimum === "number") { - json2.minimum = minimum; - } - if (exMax) { - if (legacy) { - json2.maximum = exclusiveMaximum; - json2.exclusiveMaximum = true; - } else { - json2.exclusiveMaximum = exclusiveMaximum; - } - } else if (typeof maximum === "number") { - json2.maximum = maximum; - } - if (typeof multipleOf === "number") { - if (Number.isFinite(multipleOf) && multipleOf !== 0) - json2.multipleOf = Math.abs(multipleOf); - else - handleUnrepresentable(schema, ctx, json2, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`); - } -}; -var booleanProcessor = (_schema, _ctx, json2, _params) => { - json2.type = "boolean"; -}; -var bigintProcessor = (schema, ctx, json2, params) => { - handleUnrepresentable(schema, ctx, json2, params, "BigInt cannot be represented in JSON Schema"); -}; -var symbolProcessor = (schema, ctx, json2, params) => { - handleUnrepresentable(schema, ctx, json2, params, "Symbols cannot be represented in JSON Schema"); -}; -var nullProcessor = (_schema, ctx, json2, _params) => { - if (ctx.target === "openapi-3.0") { - json2.type = "string"; - json2.nullable = true; - json2.enum = [null]; - } else { - json2.type = "null"; - } -}; -var undefinedProcessor = (schema, ctx, json2, params) => { - handleUnrepresentable(schema, ctx, json2, params, "Undefined cannot be represented in JSON Schema"); -}; -var voidProcessor = (schema, ctx, json2, params) => { - handleUnrepresentable(schema, ctx, json2, params, "Void cannot be represented in JSON Schema"); -}; -var neverProcessor = (_schema, _ctx, json2, _params) => { - json2.not = {}; -}; -var anyProcessor = (_schema, _ctx, _json, _params) => { -}; -var unknownProcessor = (_schema, _ctx, _json, _params) => { -}; -var dateProcessor = (schema, ctx, json2, params) => { - handleUnrepresentable(schema, ctx, json2, params, "Date cannot be represented in JSON Schema"); -}; -var enumProcessor = (schema, _ctx, json2, _params) => { - const def = schema._zod.def; - const values = getEnumValues(def.entries); - if (values.length === 0) { - json2.not = {}; - return; - } - if (values.every((v) => typeof v === "number")) - json2.type = "number"; - if (values.every((v) => typeof v === "string")) - json2.type = "string"; - json2.enum = values; -}; -var literalProcessor = (schema, ctx, json2, params) => { - const def = schema._zod.def; - if (def.values.length === 0) { - json2.not = {}; - return; - } - const vals = []; - for (const val of def.values) { - if (val === void 0) { - if (handleUnrepresentable(schema, ctx, json2, params, "Literal `undefined` cannot be represented in JSON Schema")) - return; - } else if (typeof val === "bigint") { - if (handleUnrepresentable(schema, ctx, json2, params, "BigInt literals cannot be represented in JSON Schema")) - return; - vals.push(Number(val)); - } else { - vals.push(val); - } - } - if (vals.length === 0) { - } else if (vals.length === 1) { - const val = vals[0]; - json2.type = val === null ? "null" : typeof val; - if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") { - json2.enum = [val]; - } else { - json2.const = val; - } - } else { - if (vals.every((v) => typeof v === "number")) - json2.type = "number"; - if (vals.every((v) => typeof v === "string")) - json2.type = "string"; - if (vals.every((v) => typeof v === "boolean")) - json2.type = "boolean"; - if (vals.every((v) => v === null)) - json2.type = "null"; - json2.enum = vals; - } -}; -var nanProcessor = (schema, ctx, json2, params) => { - handleUnrepresentable(schema, ctx, json2, params, "NaN cannot be represented in JSON Schema"); -}; -var templateLiteralProcessor = (schema, _ctx, json2, _params) => { - const _json = json2; - const pattern = schema._zod.pattern; - if (!pattern) - throw new Error("Pattern not found in template literal"); - _json.type = "string"; - _json.pattern = pattern.source; -}; -var fileProcessor = (schema, _ctx, json2, _params) => { - const _json = json2; - const file2 = { - type: "string", - format: "binary", - contentEncoding: "binary" - }; - const { minimum, maximum, mime } = schema._zod.bag; - if (minimum !== void 0) - file2.minLength = minimum; - if (maximum !== void 0) - file2.maxLength = maximum; - if (mime) { - if (mime.length === 1) { - file2.contentMediaType = mime[0]; - Object.assign(_json, file2); - } else { - Object.assign(_json, file2); - _json.anyOf = mime.map((m) => ({ contentMediaType: m })); - } - } else { - Object.assign(_json, file2); - } -}; -var successProcessor = (_schema, _ctx, json2, _params) => { - json2.type = "boolean"; -}; -var customProcessor = (schema, ctx, json2, params) => { - handleUnrepresentable(schema, ctx, json2, params, "Custom types cannot be represented in JSON Schema"); -}; -var functionProcessor = (schema, ctx, json2, params) => { - handleUnrepresentable(schema, ctx, json2, params, "Function types cannot be represented in JSON Schema"); -}; -var transformProcessor = (schema, ctx, json2, params) => { - handleUnrepresentable(schema, ctx, json2, params, "Transforms cannot be represented in JSON Schema"); -}; -var mapProcessor = (schema, ctx, json2, params) => { - handleUnrepresentable(schema, ctx, json2, params, "Map cannot be represented in JSON Schema"); -}; -var setProcessor = (schema, ctx, json2, params) => { - handleUnrepresentable(schema, ctx, json2, params, "Set cannot be represented in JSON Schema"); -}; -var arrayProcessor = (schema, ctx, _json, params) => { - const json2 = _json; - const def = schema._zod.def; - const { minimum, maximum } = schema._zod.bag; - if (typeof minimum === "number") - json2.minItems = minimum; - if (typeof maximum === "number") - json2.maxItems = maximum; - json2.type = "array"; - json2.items = process2(def.element, ctx, { - ...params, - path: [...params.path, "items"] - }); -}; -function inputOptin(schema) { - const def = schema._zod.def; - if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) { - return inputOptin(def.out); - } - if (def.type === "catch") { - return inputOptin(def.innerType); - } - return schema._zod.optin; -} -var objectProcessor = (schema, ctx, _json, params) => { - const json2 = _json; - const def = schema._zod.def; - const shape = def.shape; - const symbolKeys = Object.getOwnPropertySymbols(shape); - if (symbolKeys.length && handleUnrepresentable(schema, ctx, json2, params, "Symbol keys cannot be represented in JSON Schema")) { - return; - } - json2.type = "object"; - json2.properties = {}; - for (const key in shape) { - assignProp(json2.properties, key, process2(shape[key], ctx, { - ...params, - path: [...params.path, "properties", key] - })); - } - const allKeys = new Set(Object.keys(shape)); - const requiredKeys = new Set([...allKeys].filter((key) => { - const field = def.shape[key]; - if (ctx.io === "input") { - return inputOptin(field) === void 0; - } else { - return field._zod.optout === void 0; - } - })); - if (requiredKeys.size > 0) { - json2.required = Array.from(requiredKeys); - } - if (def.catchall?._zod.def.type === "never") { - json2.additionalProperties = false; - } else if (!def.catchall) { - if (ctx.io === "output") - json2.additionalProperties = false; - } else if (def.catchall) { - json2.additionalProperties = process2(def.catchall, ctx, { - ...params, - path: [...params.path, "additionalProperties"] - }); - } -}; -var unionProcessor = (schema, ctx, json2, params) => { - const def = schema._zod.def; - const isExclusive = def.inclusive === false; - const options = def.options.map((x, i) => process2(x, ctx, { - ...params, - path: [...params.path, isExclusive ? "oneOf" : "anyOf", i] - })); - if (isExclusive) { - json2.oneOf = options; - } else { - json2.anyOf = options; - } -}; -var intersectionProcessor = (schema, ctx, json2, params) => { - const def = schema._zod.def; - const a = process2(def.left, ctx, { - ...params, - path: [...params.path, "allOf", 0] - }); - const b = process2(def.right, ctx, { - ...params, - path: [...params.path, "allOf", 1] - }); - const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1; - const allOf = [ - ...isSimpleIntersection(a) ? a.allOf : [a], - ...isSimpleIntersection(b) ? b.allOf : [b] - ]; - json2.allOf = allOf; - ctx.intersections.push(allOf); -}; -var tupleProcessor = (schema, ctx, _json, params) => { - const json2 = _json; - const def = schema._zod.def; - json2.type = "array"; - const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items"; - const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems"; - const prefixItems = def.items.map((x, i) => process2(x, ctx, { - ...params, - path: [...params.path, prefixPath, i] - })); - const rest = def.rest ? process2(def.rest, ctx, { - ...params, - path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []] - }) : null; - let minItems = def.items.length; - while (minItems > 0) { - const item = def.items[minItems - 1]; - const optional2 = ctx.io === "input" ? inputOptin(item) !== void 0 : item._zod.optout === "optional"; - if (!optional2) - break; - minItems--; - } - const maxItems = def.items.length; - const isClosed = !def.rest; - if (ctx.target === "draft-2020-12") { - json2.prefixItems = prefixItems; - if (isClosed) { - json2.items = false; - } else if (rest) { - json2.items = rest; - } - if (minItems > 0) - json2.minItems = minItems; - if (isClosed) - json2.maxItems = maxItems; - } else if (ctx.target === "openapi-3.0") { - json2.items = { - anyOf: prefixItems - }; - if (rest) { - json2.items.anyOf.push(rest); - } - if (minItems > 0) - json2.minItems = minItems; - if (isClosed) - json2.maxItems = maxItems; - } else { - json2.items = prefixItems; - if (isClosed) { - json2.additionalItems = false; - } else if (rest) { - json2.additionalItems = rest; - } - if (minItems > 0) - json2.minItems = minItems; - if (isClosed) - json2.maxItems = maxItems; - } - const { minimum, maximum } = schema._zod.bag; - if (typeof minimum === "number") - json2.minItems = minimum; - if (typeof maximum === "number") - json2.maxItems = maximum; -}; -function stringifyKeyNames(bySchema, json2, visited) { - if (json2.$ref) { - if (visited.has(json2)) - return json2; - visited.add(json2); - const def = bySchema.get(json2)?.def; - if (!def) - return json2; - const inlined = stringifyKeyNames(bySchema, def, visited); - return inlined === def ? json2 : inlined; - } - for (const keyword of ["anyOf", "oneOf"]) { - const branches = json2[keyword]; - if (!Array.isArray(branches)) - continue; - const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited)); - if (mapped.some((branch, i) => branch !== branches[i])) - json2 = { ...json2, [keyword]: mapped }; - } - const types = Array.isArray(json2.type) ? json2.type : [json2.type]; - const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer"); - const values = json2.enum ?? (json2.const !== void 0 ? [json2.const] : void 0); - if (!numericType && !values?.some((v) => typeof v === "number")) - return json2; - const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json2; - if (rest.enum) - rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v); - else if (typeof rest.const === "number") - rest.const = String(rest.const); - if (!numericType) - return rest; - rest.type = "string"; - if (!values) - rest.pattern = (types.includes("number") ? number : integer).source; - return rest; -} -var pendingRecords = /* @__PURE__ */ new WeakMap(); -function rewriteKeyNames(ctx) { - const bySchema = /* @__PURE__ */ new Map(); - for (const entry of ctx.seen.values()) { - if (entry.def && !bySchema.has(entry.schema)) - bySchema.set(entry.schema, entry); - } - const rewrites = /* @__PURE__ */ new Map(); - for (const record2 of pendingRecords.get(ctx) ?? []) { - const seen = ctx.seen.get(record2); - const names = (seen?.def ?? seen?.schema)?.propertyNames; - if (!names || names === true || rewrites.has(names)) - continue; - const rewritten = stringifyKeyNames(bySchema, names, /* @__PURE__ */ new Set()); - if (rewritten !== names) - rewrites.set(names, rewritten); - } - if (!rewrites.size) - return; - for (const entry of ctx.seen.values()) { - for (const carrier of [entry.schema, entry.def]) { - const rewritten = carrier && rewrites.get(carrier.propertyNames); - if (rewritten) - carrier.propertyNames = rewritten; - } - } -} -var recordProcessor = (schema, ctx, _json, params) => { - const json2 = _json; - const def = schema._zod.def; - json2.type = "object"; - const keyType = def.keyType; - const keyBag = keyType._zod.bag; - const patterns = keyBag?.patterns; - if (def.mode === "loose" && patterns && patterns.size > 0) { - const valueSchema = process2(def.valueType, ctx, { - ...params, - path: [...params.path, "patternProperties", "*"] - }); - json2.patternProperties = {}; - for (const pattern of patterns) { - assignProp(json2.patternProperties, pattern.source, valueSchema); - } - } else { - if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") { - json2.propertyNames = process2(def.keyType, ctx, { - ...params, - path: [...params.path, "propertyNames"] - }); - let pending = pendingRecords.get(ctx); - if (!pending) { - pending = []; - pendingRecords.set(ctx, pending); - ctx.deferred.push(() => rewriteKeyNames(ctx)); - } - pending.push(schema); - } - json2.additionalProperties = process2(def.valueType, ctx, { - ...params, - path: [...params.path, "additionalProperties"] - }); - } - const keyValues = keyType._zod.values; - const omittableOnInput = ctx.io === "input" && inputOptin(def.valueType) !== void 0; - if (keyValues && !def.partial && !omittableOnInput) { - const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number"); - if (validKeyValues.length > 0) { - json2.required = validKeyValues.map(String); - } - } -}; -var nullableProcessor = (schema, ctx, json2, params) => { - const def = schema._zod.def; - const inner = process2(def.innerType, ctx, params); - const seen = ctx.seen.get(schema); - if (ctx.target === "openapi-3.0") { - seen.ref = def.innerType; - json2.nullable = true; - } else { - json2.anyOf = [inner, { type: "null" }]; - } -}; -var nonoptionalProcessor = (schema, ctx, _json, params) => { - const def = schema._zod.def; - process2(def.innerType, ctx, params); - const seen = ctx.seen.get(schema); - seen.ref = def.innerType; -}; -var UNREPRESENTABLE_DEFAULT = /* @__PURE__ */ Symbol(); -function serializeDefaultValue(value, schema, ctx, json2, params) { - let unrepresentable = false; - const serialized = JSON.stringify(value, (_, val) => { - if (typeof val !== "bigint") - return val; - unrepresentable = true; - return null; - }); - if (!unrepresentable) - return JSON.parse(serialized); - handleUnrepresentable(schema, ctx, json2, params, "BigInt defaults cannot be represented in JSON Schema"); - return UNREPRESENTABLE_DEFAULT; -} -var defaultProcessor = (schema, ctx, json2, params) => { - const def = schema._zod.def; - process2(def.innerType, ctx, params); - const seen = ctx.seen.get(schema); - seen.ref = def.innerType; - const value = serializeDefaultValue(def.defaultValue, schema, ctx, json2, params); - if (value !== UNREPRESENTABLE_DEFAULT) - json2.default = value; -}; -var prefaultProcessor = (schema, ctx, json2, params) => { - const def = schema._zod.def; - process2(def.innerType, ctx, params); - const seen = ctx.seen.get(schema); - seen.ref = def.innerType; - if (ctx.io !== "input") - return; - const value = serializeDefaultValue(def.defaultValue, schema, ctx, json2, params); - if (value !== UNREPRESENTABLE_DEFAULT) - json2._prefault = value; -}; -var catchProcessor = (schema, ctx, json2, params) => { - const def = schema._zod.def; - process2(def.innerType, ctx, params); - const seen = ctx.seen.get(schema); - seen.ref = def.innerType; - let catchValue; - try { - catchValue = def.catchValue(void 0); - } catch { - handleUnrepresentable(schema, ctx, json2, params, "Dynamic catch values are not supported in JSON Schema"); - return; - } - json2.default = catchValue; -}; -var pipeProcessor = (schema, ctx, _json, params) => { - const def = schema._zod.def; - const inIsTransform = def.in._zod.traits.has("$ZodTransform"); - const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out; - process2(innerType, ctx, params); - const seen = ctx.seen.get(schema); - seen.ref = innerType; -}; -var readonlyProcessor = (schema, ctx, json2, params) => { - const def = schema._zod.def; - process2(def.innerType, ctx, params); - const seen = ctx.seen.get(schema); - seen.ref = def.innerType; - json2.readOnly = true; -}; -var promiseProcessor = (schema, ctx, _json, params) => { - const def = schema._zod.def; - process2(def.innerType, ctx, params); - const seen = ctx.seen.get(schema); - seen.ref = def.innerType; -}; -var optionalProcessor = (schema, ctx, _json, params) => { - const def = schema._zod.def; - process2(def.innerType, ctx, params); - const seen = ctx.seen.get(schema); - seen.ref = def.innerType; -}; -var lazyProcessor = (schema, ctx, _json, params) => { - const innerType = schema._zod.innerType; - process2(innerType, ctx, params); - const seen = ctx.seen.get(schema); - seen.ref = innerType; -}; -var allProcessors = { - string: stringProcessor, - number: numberProcessor, - boolean: booleanProcessor, - bigint: bigintProcessor, - symbol: symbolProcessor, - null: nullProcessor, - undefined: undefinedProcessor, - void: voidProcessor, - never: neverProcessor, - any: anyProcessor, - unknown: unknownProcessor, - date: dateProcessor, - enum: enumProcessor, - literal: literalProcessor, - nan: nanProcessor, - template_literal: templateLiteralProcessor, - file: fileProcessor, - success: successProcessor, - custom: customProcessor, - function: functionProcessor, - transform: transformProcessor, - map: mapProcessor, - set: setProcessor, - array: arrayProcessor, - object: objectProcessor, - union: unionProcessor, - intersection: intersectionProcessor, - tuple: tupleProcessor, - record: recordProcessor, - nullable: nullableProcessor, - nonoptional: nonoptionalProcessor, - default: defaultProcessor, - prefault: prefaultProcessor, - catch: catchProcessor, - pipe: pipeProcessor, - readonly: readonlyProcessor, - promise: promiseProcessor, - optional: optionalProcessor, - lazy: lazyProcessor -}; -function toJSONSchema(input2, params) { - if ("_idmap" in input2) { - const registry2 = input2; - const ctx2 = initializeContext({ ...params, processors: allProcessors }); - const defs = {}; - for (const entry of registry2._idmap.entries()) { - const [_, schema] = entry; - process2(schema, ctx2); - } - const schemas = {}; - const external = { - registry: registry2, - uri: params?.uri, - defs - }; - ctx2.external = external; - for (const entry of registry2._idmap.entries()) { - const [key, schema] = entry; - extractDefs(ctx2, schema); - assignProp(schemas, key, finalize(ctx2, schema)); - } - if (Object.keys(defs).length > 0) { - const defsSegment = ctx2.target === "draft-2020-12" ? "$defs" : "definitions"; - schemas.__shared = { - [defsSegment]: defs - }; - } - return { schemas }; - } - const ctx = initializeContext({ ...params, processors: allProcessors }); - process2(input2, ctx); - extractDefs(ctx, input2); - return finalize(ctx, input2); -} - -// node_modules/zod/v4/core/json-schema-generator.js -var JSONSchemaGenerator = class { - /** @deprecated Access via ctx instead */ - get metadataRegistry() { - return this.ctx.metadataRegistry; - } - /** @deprecated Access via ctx instead */ - get target() { - return this.ctx.target; - } - // annotated so the .d.cts emits an indexed access rather than an inline `import()` of an ESM path - /** @deprecated Access via ctx instead */ - get unrepresentable() { - return this.ctx.unrepresentable; - } - /** @deprecated Access via ctx instead */ - get override() { - return this.ctx.override; - } - /** @deprecated Access via ctx instead */ - get io() { - return this.ctx.io; - } - /** @deprecated Access via ctx instead */ - get counter() { - return this.ctx.counter; - } - set counter(value) { - this.ctx.counter = value; - } - /** @deprecated Access via ctx instead */ - get seen() { - return this.ctx.seen; - } - constructor(params) { - let normalizedTarget = params?.target ?? "draft-2020-12"; - if (normalizedTarget === "draft-4") - normalizedTarget = "draft-04"; - if (normalizedTarget === "draft-7") - normalizedTarget = "draft-07"; - this.ctx = initializeContext({ - processors: allProcessors, - target: normalizedTarget, - ...params?.metadata && { metadata: params.metadata }, - ...params?.unrepresentable && { unrepresentable: params.unrepresentable }, - ...params?.override && { override: params.override }, - ...params?.io && { io: params.io } - }); - } - /** - * Process a schema to prepare it for JSON Schema generation. - * This must be called before emit(). - */ - process(schema, _params = { path: [], schemaPath: [] }) { - return process2(schema, this.ctx, _params); - } - /** - * Emit the final JSON Schema after processing. - * Must call process() first. - */ - emit(schema, _params) { - if (_params) { - if (_params.cycles) - this.ctx.cycles = _params.cycles; - if (_params.reused) - this.ctx.reused = _params.reused; - if (_params.external) - this.ctx.external = _params.external; - } - this.ctx.sharedDefsExtractedFor = void 0; - this.ctx.sharedEmitDoneFor = void 0; - extractDefs(this.ctx, schema); - const result = finalize(this.ctx, schema); - const { "~standard": _, ...plainResult } = result; - return plainResult; - } -}; - -// node_modules/zod/v4/core/json-schema.js -var json_schema_exports = {}; - -// node_modules/zod/v4/mini/schemas.js -var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => { - if (!inst._zod) - throw new Error("Uninitialized schema in ZodMiniType."); - $ZodType.init(inst, def); - inst.def = def; - inst.type = def.type; -}, { - // `with` is an alias for `check`: the same function object, not a wrapper. - get with() { - return this.check; - }, - set with(value) { - own(this, "with", value); - }, - parse(data, params) { - return parse(this, data, params, { callee: this.parse }); - }, - parseAsync(data, params) { - return parseAsync(this, data, params, { callee: this.parseAsync }); - }, - safeParse(data, params) { - return safeParse(this, data, params); - }, - safeParseAsync(data, params) { - return safeParseAsync(this, data, params); - }, - check(...checks) { - const def = this.def; - return this.clone({ - ...def, - checks: [ - ...def.checks ?? [], - ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch) - ] - }, { parent: true }); - }, - clone(_def, params) { - return clone(this, _def, params); - }, - brand() { - return this; - }, - register(reg, meta3) { - reg.add(this, meta3); - return this; - }, - apply(fn, ...args) { - return args.length === 0 ? fn(this) : fn(this, ...args); - } -}); -var ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => { - $ZodObject.init(inst, def); - ZodMiniType.init(inst, def); - installLazyProp(inst, "shape", (self) => self._zod.def.shape, false); -}); -// @__NO_SIDE_EFFECTS__ -function object(shape, params) { - const def = { - type: "object", - shape: shape ?? {}, - ...normalizeParams(params) - }; - return new ZodMiniObject(def); -} - -// node_modules/zod/v4/core/visit.js -var RESOLVING = /* @__PURE__ */ Symbol("z.visit/resolving"); -function visit(schema, fnOrHandlers) { - const fn = typeof fnOrHandlers === "function" ? fnOrHandlers : (node2, rewritten) => { - const h = fnOrHandlers[node2._zod.def.type]; - return h ? h(node2, rewritten) : node2; - }; - const cache = /* @__PURE__ */ new Map(); - function run(s) { - const cached2 = cache.get(s); - if (cached2 === RESOLVING) { - return new $ZodLazy({ - type: "lazy", - getter: () => cache.get(s) - }); - } - if (cached2 !== void 0) - return cached2; - cache.set(s, RESOLVING); - const inner = mapInner(s); - const mapped = fn(inner, inner !== s); - cache.set(s, mapped); - return mapped; - } - function mapInner(s) { - const def = s._zod.def; - const kind = def.type; - switch (kind) { - case "object": { - const oldShape = def.shape; - const keys = Object.keys(oldShape); - let changed = false; - const newShape = {}; - for (const k of keys) { - const mapped = run(oldShape[k]); - if (mapped !== oldShape[k]) - changed = true; - newShape[k] = mapped; - } - let newCatchall = def.catchall; - if (def.catchall) { - newCatchall = run(def.catchall); - if (newCatchall !== def.catchall) - changed = true; - } - return changed ? clone(s, { ...def, shape: newShape, catchall: newCatchall }) : s; - } - case "array": { - const mapped = run(def.element); - return mapped === def.element ? s : clone(s, { ...def, element: mapped }); - } - case "tuple": { - const oldItems = def.items; - let changed = false; - const newItems = []; - for (const item of oldItems) { - const mapped = run(item); - if (mapped !== item) - changed = true; - newItems.push(mapped); - } - let newRest = def.rest; - if (def.rest) { - newRest = run(def.rest); - if (newRest !== def.rest) - changed = true; - } - return changed ? clone(s, { ...def, items: newItems, rest: newRest }) : s; - } - case "record": - case "map": { - const newKey = run(def.keyType); - const newVal = run(def.valueType); - return newKey === def.keyType && newVal === def.valueType ? s : clone(s, { ...def, keyType: newKey, valueType: newVal }); - } - case "set": { - const newVal = run(def.valueType); - return newVal === def.valueType ? s : clone(s, { ...def, valueType: newVal }); - } - case "union": { - const oldOptions = def.options; - let changed = false; - const newOptions = []; - for (const opt of oldOptions) { - const mapped = run(opt); - if (mapped !== opt) - changed = true; - newOptions.push(mapped); - } - return changed ? clone(s, { ...def, options: newOptions }) : s; - } - case "intersection": { - const newLeft = run(def.left); - const newRight = run(def.right); - return newLeft === def.left && newRight === def.right ? s : clone(s, { ...def, left: newLeft, right: newRight }); - } - case "optional": - case "nullable": - case "default": - case "prefault": - case "catch": - case "readonly": - case "nonoptional": - case "promise": - case "success": { - const newInner = run(def.innerType); - return newInner === def.innerType ? s : clone(s, { ...def, innerType: newInner }); - } - case "pipe": { - const newIn = run(def.in); - const newOut = run(def.out); - return newIn === def.in && newOut === def.out ? s : clone(s, { ...def, in: newIn, out: newOut }); - } - case "function": { - const newInput = run(def.input); - const newOutput = run(def.output); - return newInput === def.input && newOutput === def.output ? s : clone(s, { ...def, input: newInput, output: newOutput }); - } - case "lazy": { - const original = def.getter; - const { _cachedInner, ...rest } = def; - return clone(s, { ...rest, getter: () => run(original()) }); - } - // A leaf by choice: `parts` are regex fragments, not data positions. - case "template_literal": - // Leaves. - case "string": - case "number": - case "int": - case "boolean": - case "bigint": - case "symbol": - case "undefined": - case "null": - case "void": - case "never": - case "any": - case "unknown": - case "date": - case "nan": - case "enum": - case "literal": - case "file": - case "transform": - case "custom": - return s; - default: { - kind; - return s; - } - } - } - return run(schema); -} - -// node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js -function isZ4Schema(s) { - const schema = s; - return !!schema._zod; -} -function objectFromShape(shape) { - const values = Object.values(shape); - if (values.length === 0) - return object({}); - const allV4 = values.every(isZ4Schema); - const allV3 = values.every((s) => !isZ4Schema(s)); - if (allV4) - return object(shape); - if (allV3) - return objectType(shape); - throw new Error("Mixed Zod versions detected in object shape."); -} -function safeParse2(schema, data) { - if (isZ4Schema(schema)) { - const result2 = safeParse(schema, data); - return result2; - } - const v3Schema = schema; - const result = v3Schema.safeParse(data); - return result; -} -async function safeParseAsync2(schema, data) { - if (isZ4Schema(schema)) { - const result2 = await safeParseAsync(schema, data); - return result2; - } - const v3Schema = schema; - const result = await v3Schema.safeParseAsync(data); - return result; -} -function getObjectShape(schema) { - if (!schema) - return void 0; - let rawShape; - if (isZ4Schema(schema)) { - const v4Schema = schema; - rawShape = v4Schema._zod?.def?.shape; - } else { - const v3Schema = schema; - rawShape = v3Schema.shape; - } - if (!rawShape) - return void 0; - if (typeof rawShape === "function") { - try { - return rawShape(); - } catch { - return void 0; - } - } - return rawShape; -} -function normalizeObjectSchema(schema) { - if (!schema) - return void 0; - if (typeof schema === "object") { - const asV3 = schema; - const asV4 = schema; - if (!asV3._def && !asV4._zod) { - const values = Object.values(schema); - if (values.length > 0 && values.every((v) => typeof v === "object" && v !== null && (v._def !== void 0 || v._zod !== void 0 || typeof v.parse === "function"))) { - return objectFromShape(schema); - } - } - } - if (isZ4Schema(schema)) { - const v4Schema = schema; - const def = v4Schema._zod?.def; - if (def && (def.type === "object" || def.shape !== void 0)) { - return schema; - } - } else { - const v3Schema = schema; - if (v3Schema.shape !== void 0) { - return schema; - } - } - return void 0; -} -function getDotPath(path3) { - if (path3.length === 0) { - return "object root"; - } - return path3.reduce((acc, seg, index) => { - if (index === 0) { - return String(seg); - } - if (typeof seg === "number") { - return `${acc}[${seg}]`; - } - return `${acc}.${seg}`; - }, ""); -} -function getParseErrorMessage(error61) { - if (error61 && typeof error61 === "object") { - if ("issues" in error61 && Array.isArray(error61.issues) && error61.issues.length > 0) { - return error61.issues.map((i) => { - if (!i.path?.length) { - return i.message; - } - return `${i.message} at ${getDotPath(i.path)}`; - }).join("\n"); - } - if ("message" in error61 && typeof error61.message === "string") { - return error61.message; - } - try { - return JSON.stringify(error61); - } catch { - return String(error61); - } - } - return String(error61); -} -function getSchemaDescription(schema) { - return schema.description; -} -function isSchemaOptional(schema) { - if (isZ4Schema(schema)) { - const v4Schema = schema; - return v4Schema._zod?.def?.type === "optional"; - } - const v3Schema = schema; - if (typeof schema.isOptional === "function") { - return schema.isOptional(); - } - return v3Schema._def?.typeName === "ZodOptional"; -} -function getLiteralValue(schema) { - if (isZ4Schema(schema)) { - const v4Schema = schema; - const def2 = v4Schema._zod?.def; - if (def2) { - if (def2.value !== void 0) - return def2.value; - if (Array.isArray(def2.values) && def2.values.length > 0) { - return def2.values[0]; - } - } - } - const v3Schema = schema; - const def = v3Schema._def; - if (def) { - if (def.value !== void 0) - return def.value; - if (Array.isArray(def.values) && def.values.length > 0) { - return def.values[0]; - } - } - const directValue = schema.value; - if (directValue !== void 0) - return directValue; - return void 0; -} - -// node_modules/zod/v4/classic/external.js -var external_exports = {}; -__export(external_exports, { - $brand: () => $brand, - $input: () => $input, - $output: () => $output, - NEVER: () => NEVER, - TimePrecision: () => TimePrecision, - ZodAny: () => ZodAny2, - ZodArray: () => ZodArray2, - ZodBase64: () => ZodBase64, - ZodBase64URL: () => ZodBase64URL, - ZodBigInt: () => ZodBigInt2, - ZodBigIntFormat: () => ZodBigIntFormat, - ZodBoolean: () => ZodBoolean2, - ZodCIDRv4: () => ZodCIDRv4, - ZodCIDRv6: () => ZodCIDRv6, - ZodCUID: () => ZodCUID, - ZodCUID2: () => ZodCUID2, - ZodCatch: () => ZodCatch2, - ZodCodec: () => ZodCodec, - ZodCompileAsyncError: () => ZodCompileAsyncError, - ZodCompileUnsupportedError: () => ZodCompileUnsupportedError, - ZodCreditCard: () => ZodCreditCard, - ZodCustom: () => ZodCustom, - ZodCustomStringFormat: () => ZodCustomStringFormat, - ZodDate: () => ZodDate2, - ZodDefault: () => ZodDefault2, - ZodDiscriminatedUnion: () => ZodDiscriminatedUnion2, - ZodE164: () => ZodE164, - ZodEmail: () => ZodEmail, - ZodEmoji: () => ZodEmoji, - ZodEnum: () => ZodEnum2, - ZodError: () => ZodError2, - ZodExactOptional: () => ZodExactOptional, - ZodFile: () => ZodFile, - ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind2, - ZodFunction: () => ZodFunction2, - ZodGUID: () => ZodGUID, - ZodIPv4: () => ZodIPv4, - ZodIPv6: () => ZodIPv6, - ZodISODate: () => ZodISODate, - ZodISODateTime: () => ZodISODateTime, - ZodISODuration: () => ZodISODuration, - ZodISOTime: () => ZodISOTime, - ZodIntersection: () => ZodIntersection2, - ZodIssueCode: () => ZodIssueCode2, - ZodJWT: () => ZodJWT, - ZodKSUID: () => ZodKSUID, - ZodLazy: () => ZodLazy2, - ZodLiteral: () => ZodLiteral2, - ZodMAC: () => ZodMAC, - ZodMap: () => ZodMap2, - ZodNaN: () => ZodNaN2, - ZodNanoID: () => ZodNanoID, - ZodNever: () => ZodNever2, - ZodNonOptional: () => ZodNonOptional, - ZodNull: () => ZodNull2, - ZodNullable: () => ZodNullable2, - ZodNumber: () => ZodNumber2, - ZodNumberFormat: () => ZodNumberFormat, - ZodObject: () => ZodObject2, - ZodOptional: () => ZodOptional2, - ZodPipe: () => ZodPipe, - ZodPrefault: () => ZodPrefault, - ZodPreprocess: () => ZodPreprocess, - ZodPromise: () => ZodPromise2, - ZodReadonly: () => ZodReadonly2, - ZodRealError: () => ZodRealError, - ZodRecord: () => ZodRecord2, - ZodSet: () => ZodSet2, - ZodString: () => ZodString2, - ZodStringFormat: () => ZodStringFormat, - ZodSuccess: () => ZodSuccess, - ZodSymbol: () => ZodSymbol2, - ZodTemplateLiteral: () => ZodTemplateLiteral, - ZodTransform: () => ZodTransform, - ZodTuple: () => ZodTuple2, - ZodType: () => ZodType2, - ZodULID: () => ZodULID, - ZodURL: () => ZodURL, - ZodUUID: () => ZodUUID, - ZodUndefined: () => ZodUndefined2, - ZodUnion: () => ZodUnion2, - ZodUnknown: () => ZodUnknown2, - ZodVoid: () => ZodVoid2, - ZodXID: () => ZodXID, - ZodXor: () => ZodXor, - _ZodString: () => _ZodString, - _default: () => _default2, - _function: () => _function, - any: () => any, - array: () => array, - base64: () => base642, - base64url: () => base64url2, - bigint: () => bigint2, - boolean: () => boolean2, - catch: () => _catch2, - check: () => check, - cidrv4: () => cidrv42, - cidrv6: () => cidrv62, - clone: () => clone, - codec: () => codec, - coerce: () => coerce_exports2, - compile: () => compile, - config: () => config, - core: () => core_exports2, - creditCard: () => creditCard2, - cuid: () => cuid3, - cuid2: () => cuid22, - custom: () => custom, - date: () => date2, - decode: () => decode2, - decodeAsync: () => decodeAsync2, - deepPartial: () => deepPartial, - describe: () => describe2, - discriminatedUnion: () => discriminatedUnion, - e164: () => e1642, - email: () => email2, - emoji: () => emoji2, - encode: () => encode2, - encodeAsync: () => encodeAsync2, - endsWith: () => _endsWith, - enum: () => _enum2, - exactOptional: () => exactOptional, - file: () => file, - flattenError: () => flattenError, - float32: () => float32, - float64: () => float64, - formatError: () => formatError, - fromJSONSchema: () => fromJSONSchema, - function: () => _function, - getDiscriminatedOption: () => getDiscriminatedOption, - getErrorMap: () => getErrorMap2, - globalRegistry: () => globalRegistry, - gt: () => _gt, - gte: () => _gte, - guid: () => guid2, - hash: () => hash, - hex: () => hex2, - hostname: () => hostname2, - httpUrl: () => httpUrl, - includes: () => _includes, - input: () => input, - instanceof: () => _instanceof, - int: () => int, - int32: () => int32, - int64: () => int64, - intersection: () => intersection, - invertCodec: () => invertCodec, - ipv4: () => ipv42, - ipv6: () => ipv62, - iso: () => iso_exports2, - json: () => json, - jwt: () => jwt, - keyof: () => keyof, - ksuid: () => ksuid2, - lazy: () => lazy, - length: () => _length, - literal: () => literal, - locales: () => locales_exports, - looseObject: () => looseObject, - looseRecord: () => looseRecord, - lowercase: () => _lowercase, - lt: () => _lt, - lte: () => _lte, - mac: () => mac2, - map: () => map, - maxLength: () => _maxLength, - maxSize: () => _maxSize, - memoizer: () => memoizer, - meta: () => meta2, - mime: () => _mime, - minLength: () => _minLength, - minSize: () => _minSize, - multipleOf: () => _multipleOf, - nan: () => nan, - nanoid: () => nanoid2, - nativeEnum: () => nativeEnum, - negative: () => _negative, - never: () => never, - nonnegative: () => _nonnegative, - nonoptional: () => nonoptional, - nonpositive: () => _nonpositive, - normalize: () => _normalize, - null: () => _null3, - nullable: () => nullable, - nullish: () => nullish2, - number: () => number2, - object: () => object2, - optional: () => optional, - output: () => output, - overwrite: () => _overwrite, - parse: () => parse2, - parseAsync: () => parseAsync2, - partialRecord: () => partialRecord, - pipe: () => pipe, - positive: () => _positive, - prefault: () => prefault, - preprocess: () => preprocess, - prettifyError: () => prettifyError, - promise: () => promise, - properties: () => _properties, - property: () => _property, - readonly: () => readonly, - record: () => record, - refine: () => refine, - regex: () => _regex, - regexes: () => regexes_exports, - registry: () => registry, - safeDecode: () => safeDecode2, - safeDecodeAsync: () => safeDecodeAsync2, - safeEncode: () => safeEncode2, - safeEncodeAsync: () => safeEncodeAsync2, - safeParse: () => safeParse3, - safeParseAsync: () => safeParseAsync3, - set: () => set, - setErrorMap: () => setErrorMap, - size: () => _size, - slugify: () => _slugify, - startsWith: () => _startsWith, - strictObject: () => strictObject, - string: () => string2, - stringFormat: () => stringFormat, - stringbool: () => stringbool, - success: () => success, - superRefine: () => superRefine, - symbol: () => symbol, - templateLiteral: () => templateLiteral, - toJSONSchema: () => toJSONSchema, - toLowerCase: () => _toLowerCase, - toUpperCase: () => _toUpperCase, - toZod: () => toZod, - transform: () => transform, - treeifyError: () => treeifyError, - trim: () => _trim, - tuple: () => tuple, - uint32: () => uint32, - uint64: () => uint64, - ulid: () => ulid2, - undefined: () => _undefined3, - union: () => union, - unknown: () => unknown, - uppercase: () => _uppercase, - url: () => url, - util: () => util_exports, - uuid: () => uuid2, - uuidv4: () => uuidv4, - uuidv6: () => uuidv6, - uuidv7: () => uuidv7, - validate: () => validate, - validateAsync: () => validateAsync, - void: () => _void2, - xid: () => xid2, - xor: () => xor -}); - -// node_modules/zod/v4/classic/schemas.js -var schemas_exports2 = {}; -__export(schemas_exports2, { - ZodAny: () => ZodAny2, - ZodArray: () => ZodArray2, - ZodBase64: () => ZodBase64, - ZodBase64URL: () => ZodBase64URL, - ZodBigInt: () => ZodBigInt2, - ZodBigIntFormat: () => ZodBigIntFormat, - ZodBoolean: () => ZodBoolean2, - ZodCIDRv4: () => ZodCIDRv4, - ZodCIDRv6: () => ZodCIDRv6, - ZodCUID: () => ZodCUID, - ZodCUID2: () => ZodCUID2, - ZodCatch: () => ZodCatch2, - ZodCodec: () => ZodCodec, - ZodCreditCard: () => ZodCreditCard, - ZodCustom: () => ZodCustom, - ZodCustomStringFormat: () => ZodCustomStringFormat, - ZodDate: () => ZodDate2, - ZodDefault: () => ZodDefault2, - ZodDiscriminatedUnion: () => ZodDiscriminatedUnion2, - ZodE164: () => ZodE164, - ZodEmail: () => ZodEmail, - ZodEmoji: () => ZodEmoji, - ZodEnum: () => ZodEnum2, - ZodExactOptional: () => ZodExactOptional, - ZodFile: () => ZodFile, - ZodFunction: () => ZodFunction2, - ZodGUID: () => ZodGUID, - ZodIPv4: () => ZodIPv4, - ZodIPv6: () => ZodIPv6, - ZodISODate: () => ZodISODate, - ZodISODateTime: () => ZodISODateTime, - ZodISODuration: () => ZodISODuration, - ZodISOTime: () => ZodISOTime, - ZodIntersection: () => ZodIntersection2, - ZodJWT: () => ZodJWT, - ZodKSUID: () => ZodKSUID, - ZodLazy: () => ZodLazy2, - ZodLiteral: () => ZodLiteral2, - ZodMAC: () => ZodMAC, - ZodMap: () => ZodMap2, - ZodNaN: () => ZodNaN2, - ZodNanoID: () => ZodNanoID, - ZodNever: () => ZodNever2, - ZodNonOptional: () => ZodNonOptional, - ZodNull: () => ZodNull2, - ZodNullable: () => ZodNullable2, - ZodNumber: () => ZodNumber2, - ZodNumberFormat: () => ZodNumberFormat, - ZodObject: () => ZodObject2, - ZodOptional: () => ZodOptional2, - ZodPipe: () => ZodPipe, - ZodPrefault: () => ZodPrefault, - ZodPreprocess: () => ZodPreprocess, - ZodPromise: () => ZodPromise2, - ZodReadonly: () => ZodReadonly2, - ZodRecord: () => ZodRecord2, - ZodSet: () => ZodSet2, - ZodString: () => ZodString2, - ZodStringFormat: () => ZodStringFormat, - ZodSuccess: () => ZodSuccess, - ZodSymbol: () => ZodSymbol2, - ZodTemplateLiteral: () => ZodTemplateLiteral, - ZodTransform: () => ZodTransform, - ZodTuple: () => ZodTuple2, - ZodType: () => ZodType2, - ZodULID: () => ZodULID, - ZodURL: () => ZodURL, - ZodUUID: () => ZodUUID, - ZodUndefined: () => ZodUndefined2, - ZodUnion: () => ZodUnion2, - ZodUnknown: () => ZodUnknown2, - ZodVoid: () => ZodVoid2, - ZodXID: () => ZodXID, - ZodXor: () => ZodXor, - _ZodString: () => _ZodString, - _default: () => _default2, - _function: () => _function, - any: () => any, - array: () => array, - base64: () => base642, - base64url: () => base64url2, - bigint: () => bigint2, - boolean: () => boolean2, - catch: () => _catch2, - check: () => check, - cidrv4: () => cidrv42, - cidrv6: () => cidrv62, - codec: () => codec, - creditCard: () => creditCard2, - cuid: () => cuid3, - cuid2: () => cuid22, - custom: () => custom, - date: () => date2, - describe: () => describe2, - discriminatedUnion: () => discriminatedUnion, - e164: () => e1642, - email: () => email2, - emoji: () => emoji2, - enum: () => _enum2, - exactOptional: () => exactOptional, - file: () => file, - float32: () => float32, - float64: () => float64, - function: () => _function, - guid: () => guid2, - hash: () => hash, - hex: () => hex2, - hostname: () => hostname2, - httpUrl: () => httpUrl, - instanceof: () => _instanceof, - int: () => int, - int32: () => int32, - int64: () => int64, - intersection: () => intersection, - invertCodec: () => invertCodec, - ipv4: () => ipv42, - ipv6: () => ipv62, - json: () => json, - jwt: () => jwt, - keyof: () => keyof, - ksuid: () => ksuid2, - lazy: () => lazy, - literal: () => literal, - looseObject: () => looseObject, - looseRecord: () => looseRecord, - mac: () => mac2, - map: () => map, - meta: () => meta2, - nan: () => nan, - nanoid: () => nanoid2, - nativeEnum: () => nativeEnum, - never: () => never, - nonoptional: () => nonoptional, - null: () => _null3, - nullable: () => nullable, - nullish: () => nullish2, - number: () => number2, - object: () => object2, - optional: () => optional, - partialRecord: () => partialRecord, - pipe: () => pipe, - prefault: () => prefault, - preprocess: () => preprocess, - promise: () => promise, - readonly: () => readonly, - record: () => record, - refine: () => refine, - set: () => set, - strictObject: () => strictObject, - string: () => string2, - stringFormat: () => stringFormat, - stringbool: () => stringbool, - success: () => success, - superRefine: () => superRefine, - symbol: () => symbol, - templateLiteral: () => templateLiteral, - transform: () => transform, - tuple: () => tuple, - uint32: () => uint32, - uint64: () => uint64, - ulid: () => ulid2, - undefined: () => _undefined3, - union: () => union, - unknown: () => unknown, - url: () => url, - uuid: () => uuid2, - uuidv4: () => uuidv4, - uuidv6: () => uuidv6, - uuidv7: () => uuidv7, - void: () => _void2, - xid: () => xid2, - xor: () => xor -}); - -// node_modules/zod/v4/classic/checks.js -var checks_exports2 = {}; -__export(checks_exports2, { - endsWith: () => _endsWith, - gt: () => _gt, - gte: () => _gte, - includes: () => _includes, - length: () => _length, - lowercase: () => _lowercase, - lt: () => _lt, - lte: () => _lte, - maxLength: () => _maxLength, - maxSize: () => _maxSize, - mime: () => _mime, - minLength: () => _minLength, - minSize: () => _minSize, - multipleOf: () => _multipleOf, - negative: () => _negative, - nonnegative: () => _nonnegative, - nonpositive: () => _nonpositive, - normalize: () => _normalize, - overwrite: () => _overwrite, - positive: () => _positive, - properties: () => _properties, - property: () => _property, - regex: () => _regex, - size: () => _size, - slugify: () => _slugify, - startsWith: () => _startsWith, - toLowerCase: () => _toLowerCase, - toUpperCase: () => _toUpperCase, - trim: () => _trim, - uppercase: () => _uppercase -}); - -// node_modules/zod/v4/classic/errors.js -var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]); -function _lazyMethod(proto, key, make) { - Object.defineProperty(proto, key, { - configurable: true, - enumerable: false, - get() { - const value = make(this); - Object.defineProperty(this, key, { value, configurable: true, writable: true }); - return value; - }, - set(value) { - Object.defineProperty(this, key, { value, configurable: true, writable: true }); - } - }); -} -var initializer2 = (inst, issues) => { - $ZodError.init(inst, issues); - inst.name = "ZodError"; - const proto = Object.getPrototypeOf(inst); - if (_installedErrorProtos.has(proto)) - return; - _installedErrorProtos.add(proto); - _lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper)); - _lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper)); - _lazyMethod(proto, "addIssue", (self) => (issue2) => { - self.issues.push(issue2); - self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2); - }); - _lazyMethod(proto, "addIssues", (self) => (issues2) => { - self.issues.push(...issues2); - self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2); - }); - Object.defineProperty(proto, "isEmpty", { - configurable: true, - enumerable: false, - get() { - return this.issues.length === 0; - } - }); -}; -var ZodError2 = /* @__PURE__ */ $constructor("ZodError", initializer2); -var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, void 0, { - Parent: Error -}); - -// node_modules/zod/v4/classic/parse.js -var parse2 = /* @__PURE__ */ _parse(ZodRealError); -var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError); -var safeParse3 = /* @__PURE__ */ _safeParse(ZodRealError); -var safeParseAsync3 = /* @__PURE__ */ _safeParseAsync(ZodRealError); -var encode2 = /* @__PURE__ */ _encode(ZodRealError); -var decode2 = /* @__PURE__ */ _decode(ZodRealError); -var encodeAsync2 = /* @__PURE__ */ _encodeAsync(ZodRealError); -var decodeAsync2 = /* @__PURE__ */ _decodeAsync(ZodRealError); -var safeEncode2 = /* @__PURE__ */ _safeEncode(ZodRealError); -var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError); -var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError); -var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError); - -// node_modules/zod/v4/classic/schemas.js -function _ensureDefaultLocale() { - if (!globalConfig.localeError) - config(en_default2()); -} -function _ensureDefaultMemoizer() { - if (!globalConfig.memoizer) - config({ memoizer: memoizer() }); -} -var ZodType2 = /* @__PURE__ */ $constructor("ZodType", (inst, def) => { - _ensureDefaultLocale(); - $ZodType.init(inst, def); - inst.def = def; - inst.type = def.type; - return inst; -}, { - check(...chks) { - const def = this.def; - return this.clone(util_exports.mergeDefs(def, { - checks: [ - ...def.checks ?? [], - ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch) - ] - }), { parent: true }); - }, - with(...chks) { - return this.check(...chks); - }, - clone(def, params) { - return clone(this, def, params); - }, - brand() { - return this; - }, - register(reg, meta3) { - reg.add(this, meta3); - return this; - }, - refine(check2, params) { - return this.check(refine(check2, params)); - }, - superRefine(refinement, params) { - return this.check(superRefine(refinement, params)); - }, - overwrite(fn) { - return this.check(_overwrite(fn)); - }, - optional() { - return optional(this); - }, - exactOptional() { - return exactOptional(this); - }, - nullable() { - return nullable(this); - }, - nullish() { - return optional(nullable(this)); - }, - nonoptional(params) { - return nonoptional(this, params); - }, - array() { - return array(this); - }, - or(arg) { - return union([this, arg]); - }, - and(arg) { - return intersection(this, arg); - }, - transform(tx) { - return pipe(this, transform(tx)); - }, - default(d) { - return _default2(this, d); - }, - prefault(d) { - return prefault(this, d); - }, - catch(params) { - return _catch2(this, params); - }, - pipe(target) { - return pipe(this, target); - }, - readonly() { - return readonly(this); - }, - describe(description) { - const cl = this.clone(); - globalRegistry.add(cl, { description }); - return cl; - }, - meta(...args) { - if (args.length === 0) - return globalRegistry.get(this); - const cl = this.clone(); - globalRegistry.add(cl, args[0]); - return cl; - }, - isOptional() { - return this.safeParse(void 0).success; - }, - isNullable() { - return this.safeParse(null).success; - }, - apply(fn, ...args) { - return args.length === 0 ? fn(this) : fn(this, ...args); - }, - // Overrides core's `~standard` to add `jsonSchema`. Must stay a prototype entry: redefining it per instance demotes instances to dictionary mode. - get "~standard"() { - return util_exports.hide(this, "~standard", { - ...standardProps(this), - jsonSchema: { - input: createStandardJSONSchemaMethod(this, "input"), - output: createStandardJSONSchemaMethod(this, "output") - } - }); - }, - set "~standard"(value) { - util_exports.own(this, "~standard", value); - }, - parse: function _parse2(data, params) { - return parse2(this, data, params, { callee: _parse2 }); - }, - parseAsync: async function _parseAsync2(data, params) { - return await parseAsync2(this, data, params, { callee: _parseAsync2 }); - }, - safeParse(data, params) { - return safeParse3(this, data, params); - }, - async safeParseAsync(data, params) { - return safeParseAsync3(this, data, params); - }, - // `spa` is an alias: same function object as `safeParseAsync`, as before. - get spa() { - return this?.safeParseAsync; - }, - set spa(value) { - util_exports.own(this, "spa", value); - }, - encode: function _encode2(data, params) { - return encode2(this, data, params, { callee: _encode2 }); - }, - decode: function _decode2(data, params) { - return decode2(this, data, params, { callee: _decode2 }); - }, - encodeAsync: async function _encodeAsync2(data, params) { - return await encodeAsync2(this, data, params, { callee: _encodeAsync2 }); - }, - decodeAsync: async function _decodeAsync2(data, params) { - return await decodeAsync2(this, data, params, { callee: _decodeAsync2 }); - }, - safeEncode(data, params) { - return safeEncode2(this, data, params); - }, - safeDecode(data, params) { - return safeDecode2(this, data, params); - }, - async safeEncodeAsync(data, params) { - return safeEncodeAsync2(this, data, params); - }, - async safeDecodeAsync(data, params) { - return safeDecodeAsync2(this, data, params); - }, - toJSONSchema(params) { - return createToJSONSchemaMethod(this, {})(params); - }, - // Reads through to the registry on every access, so it must not cache. - get description() { - return globalRegistry.get(this)?.description; - }, - // No setter: `schema._def = x` throws, as it did when `_def` was a non-writable own property. - get _def() { - return this._zod.def; - } -}); -var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => { - $ZodString.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => stringProcessor(inst, ctx, json2, params); - const bag = inst._zod.bag; - inst.format = bag.format ?? null; - inst.minLength = bag.minimum ?? null; - inst.maxLength = bag.maximum ?? null; -}, { - regex(...args) { - return this.check(_regex(...args)); - }, - includes(...args) { - return this.check(_includes(...args)); - }, - startsWith(...args) { - return this.check(_startsWith(...args)); - }, - endsWith(...args) { - return this.check(_endsWith(...args)); - }, - min(...args) { - return this.check(_minLength(...args)); - }, - max(...args) { - return this.check(_maxLength(...args)); - }, - length(...args) { - return this.check(_length(...args)); - }, - nonempty(...args) { - return this.check(_minLength(1, ...args)); - }, - lowercase(params) { - return this.check(_lowercase(params)); - }, - uppercase(params) { - return this.check(_uppercase(params)); - }, - trim() { - return this.check(_trim()); - }, - normalize(...args) { - return this.check(_normalize(...args)); - }, - toLowerCase() { - return this.check(_toLowerCase()); - }, - toUpperCase() { - return this.check(_toUpperCase()); - }, - slugify() { - return this.check(_slugify()); - } -}); -var ZodString2 = /* @__PURE__ */ $constructor("ZodString", (inst, def) => { - $ZodString.init(inst, def); - _ZodString.init(inst, def); -}, { - email(params) { - return this.check(_email(ZodEmail, params)); - }, - url(params) { - return this.check(_url(ZodURL, params)); - }, - jwt(params) { - return this.check(_jwt(ZodJWT, params)); - }, - emoji(params) { - return this.check(_emoji2(ZodEmoji, params)); - }, - guid(params) { - return this.check(_guid(ZodGUID, params)); - }, - uuid(params) { - return this.check(_uuid(ZodUUID, params)); - }, - uuidv4(params) { - return this.check(_uuidv4(ZodUUID, params)); - }, - uuidv6(params) { - return this.check(_uuidv6(ZodUUID, params)); - }, - uuidv7(params) { - return this.check(_uuidv7(ZodUUID, params)); - }, - nanoid(params) { - return this.check(_nanoid(ZodNanoID, params)); - }, - cuid(params) { - return this.check(_cuid(ZodCUID, params)); - }, - cuid2(params) { - return this.check(_cuid2(ZodCUID2, params)); - }, - ulid(params) { - return this.check(_ulid(ZodULID, params)); - }, - base64(params) { - return this.check(_base64(ZodBase64, params)); - }, - base64url(params) { - return this.check(_base64url(ZodBase64URL, params)); - }, - xid(params) { - return this.check(_xid(ZodXID, params)); - }, - ksuid(params) { - return this.check(_ksuid(ZodKSUID, params)); - }, - ipv4(params) { - return this.check(_ipv4(ZodIPv4, params)); - }, - ipv6(params) { - return this.check(_ipv6(ZodIPv6, params)); - }, - cidrv4(params) { - return this.check(_cidrv4(ZodCIDRv4, params)); - }, - cidrv6(params) { - return this.check(_cidrv6(ZodCIDRv6, params)); - }, - e164(params) { - return this.check(_e164(ZodE164, params)); - }, - datetime(params) { - return this.check(_isoDateTime(ZodISODateTime, params)); - }, - date(params) { - return this.check(_isoDate(ZodISODate, params)); - }, - time(params) { - return this.check(_isoTime(ZodISOTime, params)); - }, - duration(params) { - return this.check(_isoDuration(ZodISODuration, params)); - } -}); -function string2(params) { - return _string(ZodString2, params); -} -var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => { - $ZodStringFormat.init(inst, def); - _ZodString.init(inst, def); -}); -var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => { - $ZodISODateTime.init(inst, def); - ZodStringFormat.init(inst, def); -}); -var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => { - $ZodISODate.init(inst, def); - ZodStringFormat.init(inst, def); -}); -var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => { - $ZodISOTime.init(inst, def); - ZodStringFormat.init(inst, def); -}); -var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => { - $ZodISODuration.init(inst, def); - ZodStringFormat.init(inst, def); -}); -var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => { - $ZodEmail.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function email2(params) { - return _email(ZodEmail, params); -} -var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => { - $ZodGUID.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function guid2(params) { - return _guid(ZodGUID, params); -} -var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => { - $ZodUUID.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function uuid2(params) { - return _uuid(ZodUUID, params); -} -function uuidv4(params) { - return _uuidv4(ZodUUID, params); -} -function uuidv6(params) { - return _uuidv6(ZodUUID, params); -} -function uuidv7(params) { - return _uuidv7(ZodUUID, params); -} -var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => { - $ZodURL.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function url(params) { - return _url(ZodURL, params); -} -function httpUrl(params) { - return _url(ZodURL, { - protocol: regexes_exports.httpProtocol, - hostname: regexes_exports.domain, - ...util_exports.normalizeParams(params) - }); -} -var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => { - $ZodEmoji.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function emoji2(params) { - return _emoji2(ZodEmoji, params); -} -var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => { - $ZodNanoID.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function nanoid2(params) { - return _nanoid(ZodNanoID, params); -} -var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => { - $ZodCUID.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function cuid3(params) { - return _cuid(ZodCUID, params); -} -var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => { - $ZodCUID2.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function cuid22(params) { - return _cuid2(ZodCUID2, params); -} -var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => { - $ZodULID.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function ulid2(params) { - return _ulid(ZodULID, params); -} -var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => { - $ZodXID.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function xid2(params) { - return _xid(ZodXID, params); -} -var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => { - $ZodKSUID.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function ksuid2(params) { - return _ksuid(ZodKSUID, params); -} -var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => { - $ZodIPv4.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function ipv42(params) { - return _ipv4(ZodIPv4, params); -} -var ZodMAC = /* @__PURE__ */ $constructor("ZodMAC", (inst, def) => { - $ZodMAC.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function mac2(params) { - return _mac(ZodMAC, params); -} -var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => { - $ZodIPv6.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function ipv62(params) { - return _ipv6(ZodIPv6, params); -} -var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => { - $ZodCIDRv4.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function cidrv42(params) { - return _cidrv4(ZodCIDRv4, params); -} -var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => { - $ZodCIDRv6.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function cidrv62(params) { - return _cidrv6(ZodCIDRv6, params); -} -var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => { - $ZodBase64.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function base642(params) { - return _base64(ZodBase64, params); -} -var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => { - $ZodBase64URL.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function base64url2(params) { - return _base64url(ZodBase64URL, params); -} -var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => { - $ZodE164.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function e1642(params) { - return _e164(ZodE164, params); -} -var ZodCreditCard = /* @__PURE__ */ $constructor("ZodCreditCard", (inst, def) => { - $ZodCreditCard.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function creditCard2(params) { - return _creditCard(ZodCreditCard, params); -} -var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => { - $ZodJWT.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function jwt(params) { - return _jwt(ZodJWT, params); -} -var ZodCustomStringFormat = /* @__PURE__ */ $constructor("ZodCustomStringFormat", (inst, def) => { - $ZodCustomStringFormat.init(inst, def); - ZodStringFormat.init(inst, def); -}); -function stringFormat(format, fnOrRegex, _params = {}) { - return _stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params); -} -function hostname2(_params) { - return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params); -} -function hex2(_params) { - return _stringFormat(ZodCustomStringFormat, "hex", regexes_exports.hex, _params); -} -function hash(alg, params) { - const enc = params?.enc ?? "hex"; - const format = `${alg}_${enc}`; - const regex = regexes_exports[format]; - if (!regex) - throw new Error(`Unrecognized hash format: ${format}`); - return _stringFormat(ZodCustomStringFormat, format, regex, params); -} -var ZodNumber2 = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => { - $ZodNumber.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => numberProcessor(inst, ctx, json2, params); - const bag = inst._zod.bag; - inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null; - inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null; - inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5); - inst.isFinite = true; - inst.format = bag.format ?? null; -}, { - gt(value, params) { - return this.check(_gt(value, params)); - }, - gte(value, params) { - return this.check(_gte(value, params)); - }, - min(value, params) { - return this.check(_gte(value, params)); - }, - lt(value, params) { - return this.check(_lt(value, params)); - }, - lte(value, params) { - return this.check(_lte(value, params)); - }, - max(value, params) { - return this.check(_lte(value, params)); - }, - int(params) { - return this.check(int(params)); - }, - safe(params) { - return this.check(int(params)); - }, - positive(params) { - return this.check(_gt(0, params)); - }, - nonnegative(params) { - return this.check(_gte(0, params)); - }, - negative(params) { - return this.check(_lt(0, params)); - }, - nonpositive(params) { - return this.check(_lte(0, params)); - }, - multipleOf(value, params) { - return this.check(_multipleOf(value, params)); - }, - step(value, params) { - return this.check(_multipleOf(value, params)); - }, - finite() { - return this; - } -}); -function number2(params) { - return _number(ZodNumber2, params); -} -var ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => { - $ZodNumberFormat.init(inst, def); - ZodNumber2.init(inst, def); -}); -function int(params) { - return _int(ZodNumberFormat, params); -} -function float32(params) { - return _float32(ZodNumberFormat, params); -} -function float64(params) { - return _float64(ZodNumberFormat, params); -} -function int32(params) { - return _int32(ZodNumberFormat, params); -} -function uint32(params) { - return _uint32(ZodNumberFormat, params); -} -var ZodBoolean2 = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => { - $ZodBoolean.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => booleanProcessor(inst, ctx, json2, params); -}); -function boolean2(params) { - return _boolean(ZodBoolean2, params); -} -var ZodBigInt2 = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => { - $ZodBigInt.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => bigintProcessor(inst, ctx, json2, params); - const bag = inst._zod.bag; - inst.minValue = bag.minimum ?? null; - inst.maxValue = bag.maximum ?? null; - inst.format = bag.format ?? null; -}, { - gte(value, params) { - return this.check(_gte(value, params)); - }, - min(value, params) { - return this.check(_gte(value, params)); - }, - gt(value, params) { - return this.check(_gt(value, params)); - }, - lt(value, params) { - return this.check(_lt(value, params)); - }, - lte(value, params) { - return this.check(_lte(value, params)); - }, - max(value, params) { - return this.check(_lte(value, params)); - }, - positive(params) { - return this.check(_gt(BigInt(0), params)); - }, - negative(params) { - return this.check(_lt(BigInt(0), params)); - }, - nonpositive(params) { - return this.check(_lte(BigInt(0), params)); - }, - nonnegative(params) { - return this.check(_gte(BigInt(0), params)); - }, - multipleOf(value, params) { - return this.check(_multipleOf(value, params)); - } -}); -function bigint2(params) { - return _bigint(ZodBigInt2, params); -} -var ZodBigIntFormat = /* @__PURE__ */ $constructor("ZodBigIntFormat", (inst, def) => { - $ZodBigIntFormat.init(inst, def); - ZodBigInt2.init(inst, def); -}); -function int64(params) { - return _int64(ZodBigIntFormat, params); -} -function uint64(params) { - return _uint64(ZodBigIntFormat, params); -} -var ZodSymbol2 = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => { - $ZodSymbol.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => symbolProcessor(inst, ctx, json2, params); -}); -function symbol(params) { - return _symbol(ZodSymbol2, params); -} -var ZodUndefined2 = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => { - $ZodUndefined.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => undefinedProcessor(inst, ctx, json2, params); -}); -function _undefined3(params) { - return _undefined2(ZodUndefined2, params); -} -var ZodNull2 = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => { - $ZodNull.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => nullProcessor(inst, ctx, json2, params); -}); -function _null3(params) { - return _null2(ZodNull2, params); -} -var ZodAny2 = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => { - $ZodAny.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => anyProcessor(inst, ctx, json2, params); -}); -function any() { - return _any(ZodAny2); -} -var ZodUnknown2 = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => { - $ZodUnknown.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => unknownProcessor(inst, ctx, json2, params); -}); -function unknown() { - return _unknown(ZodUnknown2); -} -var ZodNever2 = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => { - $ZodNever.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => neverProcessor(inst, ctx, json2, params); -}); -function never(params) { - return _never(ZodNever2, params); -} -var ZodVoid2 = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => { - $ZodVoid.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => voidProcessor(inst, ctx, json2, params); -}); -function _void2(params) { - return _void(ZodVoid2, params); -} -var ZodDate2 = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => { - $ZodDate.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => dateProcessor(inst, ctx, json2, params); - inst.min = (value, params) => inst.check(_gte(value, params)); - inst.max = (value, params) => inst.check(_lte(value, params)); - const c = inst._zod.bag; - inst.minDate = c.minimum ? new Date(c.minimum) : null; - inst.maxDate = c.maximum ? new Date(c.maximum) : null; -}); -function date2(params) { - return _date(ZodDate2, params); -} -var ZodArray2 = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => { - _ensureDefaultMemoizer(); - $ZodArray.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => arrayProcessor(inst, ctx, json2, params); - inst.element = def.element; -}, { - min(n, params) { - return this.check(_minLength(n, params)); - }, - nonempty(params) { - return this.check(_minLength(1, params)); - }, - max(n, params) { - return this.check(_maxLength(n, params)); - }, - length(n, params) { - return this.check(_length(n, params)); - }, - unwrap() { - return this.element; - } -}); -function array(element, params) { - return _array(ZodArray2, element, params); -} -function keyof(schema) { - const shape = schema._zod.def.shape; - return _enum2(Object.keys(shape)); -} -var ZodObject2 = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => { - _ensureDefaultMemoizer(); - $ZodObjectJIT.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => objectProcessor(inst, ctx, json2, params); - util_exports.installLazyProp(inst, "shape", (self) => self._zod.def.shape, false); -}, { - keyof() { - return _enum2(Object.keys(this._zod.def.shape)); - }, - catchall(catchall) { - return this.clone({ ...this._zod.def, catchall }); - }, - passthrough() { - return this.clone({ ...this._zod.def, catchall: unknown() }); - }, - loose() { - return this.clone({ ...this._zod.def, catchall: unknown() }); - }, - strict() { - return this.clone({ ...this._zod.def, catchall: never() }); - }, - strip() { - return this.clone({ ...this._zod.def, catchall: void 0 }); - }, - extend(incoming) { - return util_exports.extend(this, incoming); - }, - safeExtend(incoming) { - return util_exports.safeExtend(this, incoming); - }, - merge(other) { - return util_exports.merge(this, other); - }, - pick(mask) { - return util_exports.pick(this, mask); - }, - omit(mask) { - return util_exports.omit(this, mask); - }, - partial(...args) { - return util_exports.partial(ZodOptional2, this, args[0]); - }, - exactPartial(...args) { - return util_exports.partial(ZodExactOptional, this, args[0], "exactPartial"); - }, - required(...args) { - return util_exports.required(ZodNonOptional, this, args[0]); - } -}); -function object2(shape, params) { - const def = { - type: "object", - shape: shape ?? {}, - ...util_exports.normalizeParams(params) - }; - return new ZodObject2(def); -} -function strictObject(shape, params) { - return new ZodObject2({ - type: "object", - shape, - catchall: never(), - ...util_exports.normalizeParams(params) - }); -} -function looseObject(shape, params) { - return new ZodObject2({ - type: "object", - shape, - catchall: unknown(), - ...util_exports.normalizeParams(params) - }); -} -var ZodUnion2 = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => { - $ZodUnion.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => unionProcessor(inst, ctx, json2, params); - inst.options = def.options; -}); -function union(options, params) { - return new ZodUnion2({ - type: "union", - options, - ...util_exports.normalizeParams(params) - }); -} -var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => { - ZodUnion2.init(inst, def); - $ZodXor.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => unionProcessor(inst, ctx, json2, params); - inst.options = def.options; -}); -function xor(options, params) { - return new ZodXor({ - type: "union", - options, - inclusive: false, - ...util_exports.normalizeParams(params) - }); -} -var ZodDiscriminatedUnion2 = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => { - ZodUnion2.init(inst, def); - $ZodDiscriminatedUnion.init(inst, def); -}); -function discriminatedUnion(discriminator, options, params) { - return new ZodDiscriminatedUnion2({ - type: "union", - options, - discriminator, - ...util_exports.normalizeParams(params) - }); -} -var ZodIntersection2 = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => { - $ZodIntersection.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => intersectionProcessor(inst, ctx, json2, params); -}); -function intersection(left, right) { - return new ZodIntersection2({ - type: "intersection", - left, - right - }); -} -var ZodTuple2 = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => { - _ensureDefaultMemoizer(); - $ZodTuple.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => tupleProcessor(inst, ctx, json2, params); -}, { - rest(rest) { - return this.clone({ - ...this._zod.def, - rest - }); - }, - partial() { - const def = this._zod.def; - if (def.checks?.length) - throw new Error(".partial() cannot be used on tuple schemas containing refinements"); - return this.clone({ - ...def, - items: def.items.map((item) => new ZodOptional2({ type: "optional", innerType: item })) - }); - } -}); -function tuple(items, _paramsOrRest, _params) { - const hasRest = _paramsOrRest instanceof $ZodType; - const params = hasRest ? _params : _paramsOrRest; - const rest = hasRest ? _paramsOrRest : null; - return new ZodTuple2({ - type: "tuple", - items, - rest, - ...util_exports.normalizeParams(params) - }); -} -var ZodRecord2 = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => { - _ensureDefaultMemoizer(); - $ZodRecord.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => recordProcessor(inst, ctx, json2, params); - inst.keyType = def.keyType; - inst.valueType = def.valueType; -}); -function record(keyType, valueType, params) { - if (!valueType || !valueType._zod) { - return new ZodRecord2({ - type: "record", - keyType: string2(), - valueType: keyType, - ...util_exports.normalizeParams(valueType) - }); - } - return new ZodRecord2({ - type: "record", - keyType, - valueType, - ...util_exports.normalizeParams(params) - }); -} -function partialRecord(keyType, valueType, params) { - return new ZodRecord2({ - type: "record", - keyType, - valueType, - ...util_exports.normalizeParams(params), - partial: true - }); -} -function looseRecord(keyType, valueType, params) { - return new ZodRecord2({ - type: "record", - keyType, - valueType, - mode: "loose", - ...util_exports.normalizeParams(params) - }); -} -var ZodMap2 = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => { - _ensureDefaultMemoizer(); - $ZodMap.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => mapProcessor(inst, ctx, json2, params); - inst.keyType = def.keyType; - inst.valueType = def.valueType; - inst.min = (...args) => inst.check(_minSize(...args)); - inst.nonempty = (params) => inst.check(_minSize(1, params)); - inst.max = (...args) => inst.check(_maxSize(...args)); - inst.size = (...args) => inst.check(_size(...args)); -}); -function map(keyType, valueType, params) { - return new ZodMap2({ - type: "map", - keyType, - valueType, - ...util_exports.normalizeParams(params) - }); -} -var ZodSet2 = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => { - _ensureDefaultMemoizer(); - $ZodSet.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => setProcessor(inst, ctx, json2, params); - inst.min = (...args) => inst.check(_minSize(...args)); - inst.nonempty = (params) => inst.check(_minSize(1, params)); - inst.max = (...args) => inst.check(_maxSize(...args)); - inst.size = (...args) => inst.check(_size(...args)); -}); -function set(valueType, params) { - return new ZodSet2({ - type: "set", - valueType, - ...util_exports.normalizeParams(params) - }); -} -var ZodEnum2 = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => { - $ZodEnum.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => enumProcessor(inst, ctx, json2, params); - inst.enum = def.entries; - inst.options = Object.values(def.entries); - const keys = new Set(Object.keys(def.entries)); - inst.extract = (values, params) => { - const newEntries = {}; - for (const value of values) { - if (keys.has(value)) { - newEntries[value] = def.entries[value]; - } else - throw new Error(`Key ${value} not found in enum`); - } - return new ZodEnum2({ - ...def, - checks: [], - ...util_exports.normalizeParams(params), - entries: newEntries - }); - }; - inst.exclude = (values, params) => { - const newEntries = { ...def.entries }; - for (const value of values) { - if (keys.has(value)) { - delete newEntries[value]; - } else - throw new Error(`Key ${value} not found in enum`); - } - return new ZodEnum2({ - ...def, - checks: [], - ...util_exports.normalizeParams(params), - entries: newEntries - }); - }; -}); -function _enum2(values, params) { - const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values; - return new ZodEnum2({ - type: "enum", - entries, - ...util_exports.normalizeParams(params) - }); -} -function nativeEnum(entries, params) { - return new ZodEnum2({ - type: "enum", - entries, - ...util_exports.normalizeParams(params) - }); -} -var ZodLiteral2 = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => { - $ZodLiteral.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => literalProcessor(inst, ctx, json2, params); - inst.values = new Set(def.values); - Object.defineProperty(inst, "value", { - get() { - if (def.values.length > 1) { - throw new Error("This schema contains multiple valid literal values. Use `.values` instead."); - } - return def.values[0]; - } - }); -}); -function literal(value, params) { - return new ZodLiteral2({ - type: "literal", - values: Array.isArray(value) ? value : [value], - ...util_exports.normalizeParams(params) - }); -} -var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => { - $ZodFile.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => fileProcessor(inst, ctx, json2, params); - inst.min = (size, params) => inst.check(_minSize(size, params)); - inst.max = (size, params) => inst.check(_maxSize(size, params)); - inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params)); -}); -function file(params) { - return _file(ZodFile, params); -} -var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => { - _ensureDefaultMemoizer(); - $ZodTransform.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => transformProcessor(inst, ctx, json2, params); - inst._zod.parse = (payload, _ctx) => { - if (_ctx.direction === "backward") { - throw new $ZodEncodeError(inst.constructor.name); - } - payload.addIssue = (issue2) => { - if (typeof issue2 === "string") { - payload.issues.push(util_exports.issue(issue2, payload.value, def)); - } else { - const _issue = issue2; - if (_issue.fatal) - _issue.continue = false; - _issue.code ?? (_issue.code = "custom"); - if (!("input" in _issue)) - _issue.input = payload.value; - _issue.inst ?? (_issue.inst = inst); - payload.issues.push(util_exports.issue(_issue)); - } - }; - const output2 = def.transform(payload.value, payload); - if (output2 instanceof Promise) { - return output2.then((output3) => { - payload.value = output3; - return payload; - }); - } - payload.value = output2; - return payload; - }; -}); -function transform(fn) { - return new ZodTransform({ - type: "transform", - transform: fn - }); -} -var ZodOptional2 = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => { - $ZodOptional.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params); - inst.unwrap = () => inst._zod.def.innerType; -}); -function optional(innerType) { - return new ZodOptional2({ - type: "optional", - innerType - }); -} -var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => { - $ZodExactOptional.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => optionalProcessor(inst, ctx, json2, params); - inst.unwrap = () => inst._zod.def.innerType; -}); -function exactOptional(innerType) { - return new ZodExactOptional({ - type: "optional", - innerType - }); -} -var ZodNullable2 = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => { - $ZodNullable.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => nullableProcessor(inst, ctx, json2, params); - inst.unwrap = () => inst._zod.def.innerType; -}); -function nullable(innerType) { - return new ZodNullable2({ - type: "nullable", - innerType - }); -} -function nullish2(innerType) { - return optional(nullable(innerType)); -} -var ZodDefault2 = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => { - $ZodDefault.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => defaultProcessor(inst, ctx, json2, params); - inst.unwrap = () => inst._zod.def.innerType; - inst.removeDefault = inst.unwrap; -}); -function _default2(innerType, defaultValue) { - return new ZodDefault2({ - type: "default", - innerType, - get defaultValue() { - return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue); - } - }); -} -var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => { - $ZodPrefault.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => prefaultProcessor(inst, ctx, json2, params); - inst.unwrap = () => inst._zod.def.innerType; -}); -function prefault(innerType, defaultValue) { - return new ZodPrefault({ - type: "prefault", - innerType, - get defaultValue() { - return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue); - } - }); -} -var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => { - $ZodNonOptional.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => nonoptionalProcessor(inst, ctx, json2, params); - inst.unwrap = () => inst._zod.def.innerType; -}); -function nonoptional(innerType, params) { - return new ZodNonOptional({ - type: "nonoptional", - innerType, - ...util_exports.normalizeParams(params) - }); -} -var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => { - $ZodSuccess.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => successProcessor(inst, ctx, json2, params); - inst.unwrap = () => inst._zod.def.innerType; -}); -function success(innerType) { - return new ZodSuccess({ - type: "success", - innerType - }); -} -var ZodCatch2 = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => { - $ZodCatch.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => catchProcessor(inst, ctx, json2, params); - inst.unwrap = () => inst._zod.def.innerType; - inst.removeCatch = inst.unwrap; -}); -function _catch2(innerType, catchValue) { - return new ZodCatch2({ - type: "catch", - innerType, - catchValue: typeof catchValue === "function" ? catchValue : util_exports.constantCatch(catchValue) - }); -} -var ZodNaN2 = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => { - $ZodNaN.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => nanProcessor(inst, ctx, json2, params); -}); -function nan(params) { - return _nan(ZodNaN2, params); -} -var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => { - $ZodPipe.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => pipeProcessor(inst, ctx, json2, params); - inst.in = def.in; - inst.out = def.out; -}); -function pipe(in_, out) { - return new ZodPipe({ - type: "pipe", - in: in_, - out - // ...util.normalizeParams(params), - }); -} -var ZodCodec = /* @__PURE__ */ $constructor("ZodCodec", (inst, def) => { - ZodPipe.init(inst, def); - $ZodCodec.init(inst, def); -}); -function codec(in_, out, params) { - return new ZodCodec({ - type: "pipe", - in: in_, - out, - transform: params.decode, - reverseTransform: params.encode - }); -} -function invertCodec(codec2) { - const def = codec2._zod.def; - return new ZodCodec({ - type: "pipe", - in: def.out, - out: def.in, - transform: def.reverseTransform, - reverseTransform: def.transform - }); -} -var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) => { - ZodPipe.init(inst, def); - $ZodPreprocess.init(inst, def); -}); -var ZodReadonly2 = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => { - $ZodReadonly.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => readonlyProcessor(inst, ctx, json2, params); - inst.unwrap = () => inst._zod.def.innerType; -}); -function readonly(innerType) { - return new ZodReadonly2({ - type: "readonly", - innerType - }); -} -var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => { - $ZodTemplateLiteral.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => templateLiteralProcessor(inst, ctx, json2, params); -}); -function templateLiteral(parts, params) { - return new ZodTemplateLiteral({ - type: "template_literal", - parts, - ...util_exports.normalizeParams(params) - }); -} -var ZodLazy2 = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => { - $ZodLazy.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => lazyProcessor(inst, ctx, json2, params); - inst.unwrap = () => inst._zod.def.getter(); -}); -function lazy(getter) { - return new ZodLazy2({ - type: "lazy", - getter - }); -} -var ZodPromise2 = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => { - $ZodPromise.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => promiseProcessor(inst, ctx, json2, params); - inst.unwrap = () => inst._zod.def.innerType; -}); -function promise(innerType) { - return new ZodPromise2({ - type: "promise", - innerType - }); -} -var ZodFunction2 = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => { - $ZodFunction.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => functionProcessor(inst, ctx, json2, params); -}); -function _function(params) { - return new ZodFunction2({ - type: "function", - input: Array.isArray(params?.input) ? tuple(params?.input) : params?.input ?? array(unknown()), - output: params?.output ?? unknown() - }); -} -var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => { - $ZodCustom.init(inst, def); - ZodType2.init(inst, def); - inst._zod.processJSONSchema = (ctx, json2, params) => customProcessor(inst, ctx, json2, params); -}); -function check(fn) { - const ch = new $ZodCheck({ - check: "custom" - // ...util.normalizeParams(params), - }); - ch._zod.check = fn; - return ch; -} -function custom(fn, _params) { - return _custom(ZodCustom, fn ?? (() => true), _params); -} -function refine(fn, _params = {}) { - return _refine(ZodCustom, fn, _params); -} -function superRefine(fn, params) { - return _superRefine(fn, params); -} -var describe2 = describe; -var meta2 = meta; -function _instanceof(cls, params = {}) { - const inst = new ZodCustom({ - type: "custom", - check: "custom", - fn: (data) => data instanceof cls, - abort: true, - ...util_exports.normalizeParams(params) - }); - inst._zod.bag.Class = cls; - inst._zod.check = (payload) => { - if (!(payload.value instanceof cls)) { - payload.issues.push({ - code: "invalid_type", - expected: cls.name, - input: payload.value, - inst, - path: [...inst._zod.def.path ?? []] - }); - } - }; - return inst; -} -var stringbool = (...args) => _stringbool({ - Codec: ZodCodec, - Boolean: ZodBoolean2, - String: ZodString2 -}, ...args); -function json(params) { - const jsonSchema = lazy(() => { - return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]); - }); - return jsonSchema; -} -function preprocess(fn, schema) { - return new ZodPreprocess({ - type: "pipe", - in: transform(fn), - out: schema - }); -} - -// node_modules/zod/v4/classic/compat.js -var ZodIssueCode2 = { - 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" -}; -function setErrorMap(map2) { - config({ - customError: map2 - }); -} -function getErrorMap2() { - return config().customError; -} -var ZodFirstPartyTypeKind2; -/* @__PURE__ */ (function(ZodFirstPartyTypeKind3) { -})(ZodFirstPartyTypeKind2 || (ZodFirstPartyTypeKind2 = {})); - -// node_modules/zod/v4/classic/iso.js -var iso_exports2 = {}; -__export(iso_exports2, { - ZodISODate: () => ZodISODate, - ZodISODateTime: () => ZodISODateTime, - ZodISODuration: () => ZodISODuration, - ZodISOTime: () => ZodISOTime, - date: () => date3, - datetime: () => datetime2, - duration: () => duration2, - time: () => time2 -}); -function datetime2(params) { - return _isoDateTime(ZodISODateTime, params); -} -function date3(params) { - return _isoDate(ZodISODate, params); -} -function time2(params) { - return _isoTime(ZodISOTime, params); -} -function duration2(params) { - return _isoDuration(ZodISODuration, params); -} - -// node_modules/zod/v4/classic/from-json-schema.js -var z = { - ...schemas_exports2, - ...checks_exports2, - iso: iso_exports2 -}; -var RECOGNIZED_KEYS = /* @__PURE__ */ new Set([ - // Schema identification - "$schema", - "$ref", - "$defs", - "definitions", - // Core schema keywords - "$id", - "id", - "$comment", - "$anchor", - "$vocabulary", - "$dynamicRef", - "$dynamicAnchor", - // Type - "type", - "enum", - "const", - // Composition - "anyOf", - "oneOf", - "allOf", - "not", - // Object - "properties", - "required", - "additionalProperties", - "patternProperties", - "propertyNames", - "minProperties", - "maxProperties", - // Array - "items", - "prefixItems", - "additionalItems", - "minItems", - "maxItems", - "uniqueItems", - "contains", - "minContains", - "maxContains", - // String - "minLength", - "maxLength", - "pattern", - "format", - // Number - "minimum", - "maximum", - "exclusiveMinimum", - "exclusiveMaximum", - "multipleOf", - // Already handled metadata - "description", - "default", - // Content - "contentEncoding", - "contentMediaType", - "contentSchema", - // Unsupported (error-throwing) - "unevaluatedItems", - "unevaluatedProperties", - "if", - "then", - "else", - "dependentSchemas", - "dependentRequired", - // OpenAPI - "nullable", - "readOnly" -]); -function detectVersion(schema, defaultTarget) { - const $schema = schema.$schema; - if ($schema === "https://json-schema.org/draft/2020-12/schema") { - return "draft-2020-12"; - } - if ($schema === "http://json-schema.org/draft-07/schema#") { - return "draft-7"; - } - if ($schema === "http://json-schema.org/draft-04/schema#") { - return "draft-4"; - } - return defaultTarget ?? "draft-2020-12"; -} -function applyMinItems(items, minItems) { - return items.map((item, index) => index < minItems ? item : item.optional()); -} -function decodeJSONPointerSegment(segment) { - return segment.replace(/~1/g, "/").replace(/~0/g, "~"); -} -function resolveRef(ref, ctx) { - if (!ref.startsWith("#")) { - throw new Error("External $ref is not supported, only local refs (#/...) are allowed"); - } - const path3 = ref.slice(1).split("/").filter(Boolean); - if (path3.length === 0) { - return ctx.rootSchema; - } - const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions"; - if (path3[0] === defsKey) { - const key = path3[1] === void 0 ? void 0 : decodeJSONPointerSegment(path3[1]); - if (!key || !ctx.defs[key]) { - throw new Error(`Reference not found: ${ref}`); - } - return ctx.defs[key]; - } - throw new Error(`Reference not found: ${ref}`); -} -function checkPropertyNames(objectSchema, keySchema) { - const guard = z.transform((value) => value).check((payload) => { - const value = payload.value; - if (typeof value !== "object" || value === null || Array.isArray(value)) - return; - for (const key of Object.getOwnPropertyNames(value)) { - const result = keySchema.safeParse(key); - if (result.success) - continue; - payload.issues.push({ - code: "invalid_key", - origin: "record", - issues: result.error.issues, - input: key, - path: [key], - continue: true - }); - } - }); - return guard.pipe(objectSchema); -} -function getTupleRest(restSchema, ctx) { - if (restSchema === false) { - return void 0; - } - if (restSchema === void 0 || restSchema === true) { - return z.any(); - } - return convertSchema(restSchema, ctx); -} -var fullTime = /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/; -function convertBaseSchema(schema, ctx) { - if (schema.not !== void 0) { - if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) { - return z.never(); - } - throw new Error("not is not supported in Zod (except { not: {} } for never)"); - } - if (schema.unevaluatedItems !== void 0) { - throw new Error("unevaluatedItems is not supported"); - } - if (schema.unevaluatedProperties !== void 0) { - throw new Error("unevaluatedProperties is not supported"); - } - if (schema.if !== void 0 || schema.then !== void 0 || schema.else !== void 0) { - throw new Error("Conditional schemas (if/then/else) are not supported"); - } - if (schema.dependentSchemas !== void 0 || schema.dependentRequired !== void 0) { - throw new Error("dependentSchemas and dependentRequired are not supported"); - } - if (schema.$ref) { - const refPath = schema.$ref; - if (ctx.refs.has(refPath)) { - return ctx.refs.get(refPath); - } - if (ctx.processing.has(refPath)) { - return z.lazy(() => { - if (!ctx.refs.has(refPath)) { - throw new Error(`Circular reference not resolved: ${refPath}`); - } - return ctx.refs.get(refPath); - }); - } - ctx.processing.add(refPath); - const resolved = resolveRef(refPath, ctx); - const zodSchema2 = convertSchema(resolved, ctx); - ctx.refs.set(refPath, zodSchema2); - ctx.processing.delete(refPath); - return zodSchema2; - } - if (schema.enum !== void 0) { - const enumValues = schema.enum; - if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) { - return z.null(); - } - if (enumValues.length === 0) { - return z.never(); - } - if (enumValues.length === 1) { - return z.literal(enumValues[0]); - } - if (enumValues.every((v) => typeof v === "string")) { - return z.enum(enumValues); - } - const literalSchemas = enumValues.map((v) => z.literal(v)); - if (literalSchemas.length < 2) { - return literalSchemas[0]; - } - return z.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]); - } - if (schema.const !== void 0) { - return z.literal(schema.const); - } - const type = schema.type; - if (Array.isArray(type)) { - const typeSchemas = type.map((t) => { - const typeSchema = { ...schema, type: t }; - return convertBaseSchema(typeSchema, ctx); - }); - if (typeSchemas.length === 0) { - return z.never(); - } - if (typeSchemas.length === 1) { - return typeSchemas[0]; - } - return z.union(typeSchemas); - } - if (!type) { - return z.any(); - } - let zodSchema; - switch (type) { - case "string": { - let stringSchema = z.string(); - if (schema.format) { - const format = schema.format; - if (format === "email") { - stringSchema = stringSchema.check(z.email()); - } else if (format === "uri" || format === "uri-reference") { - stringSchema = stringSchema.check(z.url()); - } else if (format === "uuid" || format === "guid") { - stringSchema = stringSchema.check(z.uuid()); - } else if (format === "date-time") { - stringSchema = stringSchema.check(z.iso.datetime({ offset: true })); - } else if (format === "date") { - stringSchema = stringSchema.check(z.iso.date()); - } else if (format === "time") { - stringSchema = stringSchema.check(z.regex(fullTime)); - } else if (format === "duration") { - stringSchema = stringSchema.check(z.iso.duration()); - } else if (format === "hostname") { - stringSchema = stringSchema.check(z.hostname()); - } else if (format === "ipv4") { - stringSchema = stringSchema.check(z.ipv4()); - } else if (format === "ipv6") { - stringSchema = stringSchema.check(z.ipv6()); - } else if (format === "mac") { - stringSchema = stringSchema.check(z.mac()); - } else if (format === "cidr") { - stringSchema = stringSchema.check(z.cidrv4()); - } else if (format === "cidr-v6") { - stringSchema = stringSchema.check(z.cidrv6()); - } else if (format === "base64") { - stringSchema = stringSchema.check(z.base64()); - } else if (format === "base64url") { - stringSchema = stringSchema.check(z.base64url()); - } else if (format === "e164") { - stringSchema = stringSchema.check(z.e164()); - } else if (format === "credit_card") { - stringSchema = stringSchema.check(z.creditCard()); - } else if (format === "jwt") { - stringSchema = stringSchema.check(z.jwt()); - } else if (format === "emoji") { - stringSchema = stringSchema.check(z.emoji()); - } else if (format === "nanoid") { - stringSchema = stringSchema.check(z.nanoid()); - } else if (format === "cuid") { - stringSchema = stringSchema.check(z.cuid()); - } else if (format === "cuid2") { - stringSchema = stringSchema.check(z.cuid2()); - } else if (format === "ulid") { - stringSchema = stringSchema.check(z.ulid()); - } else if (format === "xid") { - stringSchema = stringSchema.check(z.xid()); - } else if (format === "ksuid") { - stringSchema = stringSchema.check(z.ksuid()); - } - } - if (typeof schema.minLength === "number") { - stringSchema = stringSchema.min(schema.minLength); - } - if (typeof schema.maxLength === "number") { - stringSchema = stringSchema.max(schema.maxLength); - } - if (schema.pattern) { - stringSchema = stringSchema.regex(new RegExp(schema.pattern)); - } - zodSchema = stringSchema; - break; - } - case "number": - case "integer": { - let numberSchema = type === "integer" ? z.number().int() : z.number(); - if (typeof schema.minimum === "number" && schema.exclusiveMinimum !== true) { - numberSchema = numberSchema.min(schema.minimum); - } - if (typeof schema.maximum === "number" && schema.exclusiveMaximum !== true) { - numberSchema = numberSchema.max(schema.maximum); - } - if (typeof schema.exclusiveMinimum === "number") { - numberSchema = numberSchema.gt(schema.exclusiveMinimum); - } else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") { - numberSchema = numberSchema.gt(schema.minimum); - } - if (typeof schema.exclusiveMaximum === "number") { - numberSchema = numberSchema.lt(schema.exclusiveMaximum); - } else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") { - numberSchema = numberSchema.lt(schema.maximum); - } - if (typeof schema.multipleOf === "number") { - numberSchema = numberSchema.multipleOf(schema.multipleOf); - } - zodSchema = numberSchema; - break; - } - case "boolean": { - zodSchema = z.boolean(); - break; - } - case "null": { - zodSchema = z.null(); - break; - } - case "object": { - const shape = {}; - const properties = schema.properties || {}; - const requiredSet = new Set(schema.required || []); - const additionalSchema = typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : void 0; - for (const [key, propSchema] of Object.entries(properties)) { - const propZodSchema = convertSchema(propSchema, ctx); - assignProp(shape, key, requiredSet.has(key) ? propZodSchema : propZodSchema.optional()); - } - if (schema.patternProperties) { - const patternProps = schema.patternProperties; - const patternKeys = Object.keys(patternProps); - const looseRecords = []; - for (const pattern of patternKeys) { - const patternValue = convertSchema(patternProps[pattern], ctx); - const keySchema = z.string().regex(new RegExp(pattern)); - looseRecords.push(z.looseRecord(keySchema, patternValue)); - } - const schemasToIntersect = []; - if (Object.keys(shape).length > 0) { - schemasToIntersect.push(z.object(shape).passthrough()); - } - schemasToIntersect.push(...looseRecords); - if (schemasToIntersect.length === 0) { - zodSchema = z.object({}).passthrough(); - } else if (schemasToIntersect.length === 1) { - zodSchema = schemasToIntersect[0]; - } else { - let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]); - for (let i = 2; i < schemasToIntersect.length; i++) { - result = z.intersection(result, schemasToIntersect[i]); - } - zodSchema = result; - } - if (schema.additionalProperties === false) { - const propertyKeys = Object.keys(shape); - const patterns = patternKeys.map((p) => new RegExp(p)); - const basePatternSchema = zodSchema; - zodSchema = zodSchema.check((payload) => { - if (!isPlainObject(payload.value)) - return; - const unrecognized = []; - for (const key of Object.keys(payload.value)) { - if (propertyKeys.includes(key)) - continue; - if (patterns.some((regex) => regex.test(key))) - continue; - unrecognized.push(key); - } - if (unrecognized.length) { - payload.issues.push({ - code: "unrecognized_keys", - keys: unrecognized, - input: payload.value, - inst: basePatternSchema - }); - } - }); - } - } else { - const objectSchema = z.object(shape); - if (schema.additionalProperties === false) { - zodSchema = objectSchema.strict(); - } else if (additionalSchema) { - zodSchema = objectSchema.catchall(additionalSchema); - } else { - zodSchema = objectSchema.passthrough(); - } - } - if (schema.propertyNames !== void 0 && schema.propertyNames !== true) { - const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === void 0 ? { type: "string", ...schema.propertyNames } : schema.propertyNames; - zodSchema = checkPropertyNames(zodSchema, convertSchema(keyJSONSchema, ctx)); - } - break; - } - case "array": { - const prefixItems = schema.prefixItems; - const items = schema.items; - if (prefixItems && Array.isArray(prefixItems)) { - const minItems = typeof schema.minItems === "number" ? schema.minItems : 0; - const tupleItems = prefixItems.map((item) => convertSchema(item, ctx)); - const positionalItems = applyMinItems(tupleItems, minItems); - const rest = !Array.isArray(items) ? getTupleRest(items, ctx) : void 0; - const tupleSchema = z.tuple(positionalItems); - zodSchema = rest ? tupleSchema.rest(rest) : tupleSchema; - if (typeof schema.minItems === "number") { - zodSchema = zodSchema.check(z.minLength(schema.minItems)); - } - if (typeof schema.maxItems === "number") { - zodSchema = zodSchema.check(z.maxLength(schema.maxItems)); - } - } else if (Array.isArray(items)) { - const minItems = typeof schema.minItems === "number" ? schema.minItems : 0; - const tupleItems = items.map((item) => convertSchema(item, ctx)); - const positionalItems = applyMinItems(tupleItems, minItems); - const rest = getTupleRest(schema.additionalItems, ctx); - const tupleSchema = z.tuple(positionalItems); - zodSchema = rest ? tupleSchema.rest(rest) : tupleSchema; - if (typeof schema.minItems === "number") { - zodSchema = zodSchema.check(z.minLength(schema.minItems)); - } - if (typeof schema.maxItems === "number") { - zodSchema = zodSchema.check(z.maxLength(schema.maxItems)); - } - } else if (items !== void 0) { - const element = convertSchema(items, ctx); - let arraySchema = z.array(element); - if (typeof schema.minItems === "number") { - arraySchema = arraySchema.min(schema.minItems); - } - if (typeof schema.maxItems === "number") { - arraySchema = arraySchema.max(schema.maxItems); - } - zodSchema = arraySchema; - } else { - zodSchema = z.array(z.any()); - } - break; - } - default: - throw new Error(`Unsupported type: ${type}`); - } - return zodSchema; -} -function convertSchema(schema, ctx) { - if (typeof schema === "boolean") { - return schema ? z.any() : z.never(); - } - let baseSchema = convertBaseSchema(schema, ctx); - const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0; - if (schema.anyOf && Array.isArray(schema.anyOf)) { - const options = schema.anyOf.map((s) => convertSchema(s, ctx)); - const anyOfUnion = z.union(options); - baseSchema = hasExplicitType ? z.intersection(baseSchema, anyOfUnion) : anyOfUnion; - } - if (schema.oneOf && Array.isArray(schema.oneOf)) { - const options = schema.oneOf.map((s) => convertSchema(s, ctx)); - const oneOfUnion = z.xor(options); - baseSchema = hasExplicitType ? z.intersection(baseSchema, oneOfUnion) : oneOfUnion; - } - if (schema.allOf && Array.isArray(schema.allOf)) { - if (schema.allOf.length === 0) { - baseSchema = hasExplicitType ? baseSchema : z.any(); - } else { - let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx); - const startIdx = hasExplicitType ? 0 : 1; - for (let i = startIdx; i < schema.allOf.length; i++) { - result = z.intersection(result, convertSchema(schema.allOf[i], ctx)); - } - baseSchema = result; - } - } - if (schema.nullable === true && ctx.version === "openapi-3.0") { - baseSchema = z.nullable(baseSchema); - } - if (schema.readOnly === true) { - baseSchema = z.readonly(baseSchema); - } - if (schema.default !== void 0) { - baseSchema = baseSchema.default(schema.default); - } - const extraMeta = {}; - const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"]; - for (const key of coreMetadataKeys) { - if (key in schema) { - extraMeta[key] = schema[key]; - } - } - const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"]; - for (const key of contentMetadataKeys) { - if (key in schema) { - extraMeta[key] = schema[key]; - } - } - if (schema.propertyNames !== void 0 && schema.type === "object" && schema.$ref === void 0) { - extraMeta.propertyNames = schema.propertyNames; - } - for (const key of Object.keys(schema)) { - if (!RECOGNIZED_KEYS.has(key)) { - assignProp(extraMeta, key, schema[key]); - } - } - if (Object.keys(extraMeta).length > 0) { - ctx.registry.add(baseSchema, extraMeta); - } - if (schema.description) { - baseSchema = baseSchema.describe(schema.description); - } - return baseSchema; -} -function fromJSONSchema(schema, params) { - if (typeof schema === "boolean") { - return schema ? z.any() : z.never(); - } - let normalized; - try { - normalized = JSON.parse(JSON.stringify(schema)); - } catch { - throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas"); - } - const version2 = detectVersion(normalized, params?.defaultTarget); - const defs = normalized.$defs || normalized.definitions || {}; - const ctx = { - version: version2, - defs, - refs: /* @__PURE__ */ new Map(), - processing: /* @__PURE__ */ new Set(), - rootSchema: normalized, - registry: params?.registry ?? globalRegistry - }; - return convertSchema(normalized, ctx); -} - -// node_modules/zod/v4/classic/deep-partial.js -function deepPartial(schema) { - return visit(schema, { - object: (s) => s.partial(), - // Every partialed option now admits `undefined`, which the constructor rejects as a duplicate. - union: (s) => { - const def = s._zod.def; - return def.discriminator === void 0 ? s : union(def.options); - } - }); -} - -// node_modules/zod/v4/classic/in-out.js -function withChecks(side, checks) { - if (!checks?.length) - return side; - const def = side._zod.def; - return clone(side, mergeDefs(def, { checks: [...def.checks ?? [], ...checks] }), { parent: true }); -} -function outSide(def) { - return withChecks(def.out, def.checks); -} -function inSide(def) { - return def.in._zod.traits.has("$ZodTransform") ? outSide(def) : def.in; -} -function input(schema) { - return visit(schema, { - pipe: (s) => inSide(s._zod.def), - // A default value belongs to the output side, so a rewritten inner type leaves it stranded. `.default()` widens the declared input type with `undefined`, and `optional` is what carries that across. - default: (s, rewritten) => rewritten ? optional(s._zod.def.innerType) : s, - // A catch value is output-side too, but `.catch()` leaves the declared input type alone, so the inner schema stands on its own. - catch: (s, rewritten) => rewritten ? s._zod.def.innerType : s - }); -} -function output(schema) { - return visit(schema, { - pipe: (s) => outSide(s._zod.def), - // A prefault value is fed through the schema, which makes it input-side, so a rewritten inner type leaves it stranded. - prefault: (s, rewritten) => rewritten ? s._zod.def.innerType : s - }); -} - -// node_modules/zod/v4/classic/coerce.js -var coerce_exports2 = {}; -__export(coerce_exports2, { - bigint: () => bigint3, - boolean: () => boolean3, - date: () => date4, - number: () => number3, - string: () => string3 -}); -function string3(params) { - return _coercedString(ZodString2, params); -} -function number3(params) { - return _coercedNumber(ZodNumber2, params); -} -function boolean3(params) { - return _coercedBoolean(ZodBoolean2, params); -} -function bigint3(params) { - return _coercedBigint(ZodBigInt2, params); -} -function date4(params) { - return _coercedDate(ZodDate2, params); + const directValue = schema.value; + if (directValue !== void 0) + return directValue; + return void 0; } // node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +import * as z from "zod/v4"; var LATEST_PROTOCOL_VERSION = "2025-11-25"; var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"]; var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task"; var JSONRPC_VERSION = "2.0"; -var AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || typeof v === "function")); -var ProgressTokenSchema = union([string2(), number2().int()]); -var CursorSchema = string2(); -var TaskCreationParamsSchema = looseObject({ +var AssertObjectSchema = z.custom((v) => v !== null && (typeof v === "object" || typeof v === "function")); +var ProgressTokenSchema = z.union([z.string(), z.number().int()]); +var CursorSchema = z.string(); +var TaskCreationParamsSchema = z.looseObject({ /** * Requested duration in milliseconds to retain task from creation. */ - ttl: number2().optional(), + ttl: z.number().optional(), /** * Time in milliseconds to wait between task status requests. */ - pollInterval: number2().optional() + pollInterval: z.number().optional() }); -var TaskMetadataSchema = object2({ - ttl: number2().optional() +var TaskMetadataSchema = z.object({ + ttl: z.number().optional() }); -var RelatedTaskMetadataSchema = object2({ - taskId: string2() +var RelatedTaskMetadataSchema = z.object({ + taskId: z.string() }); -var RequestMetaSchema = looseObject({ +var RequestMetaSchema = z.looseObject({ /** * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. */ @@ -30208,7 +7380,7 @@ var RequestMetaSchema = looseObject({ */ [RELATED_TASK_META_KEY]: RelatedTaskMetadataSchema.optional() }); -var BaseRequestParamsSchema = object2({ +var BaseRequestParamsSchema = z.object({ /** * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. */ @@ -30226,42 +7398,42 @@ var TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({ task: TaskMetadataSchema.optional() }); var isTaskAugmentedRequestParams = (value) => TaskAugmentedRequestParamsSchema.safeParse(value).success; -var RequestSchema = object2({ - method: string2(), +var RequestSchema = z.object({ + method: z.string(), params: BaseRequestParamsSchema.loose().optional() }); -var NotificationsParamsSchema = object2({ +var NotificationsParamsSchema = z.object({ /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ _meta: RequestMetaSchema.optional() }); -var NotificationSchema = object2({ - method: string2(), +var NotificationSchema = z.object({ + method: z.string(), params: NotificationsParamsSchema.loose().optional() }); -var ResultSchema = looseObject({ +var ResultSchema = z.looseObject({ /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ _meta: RequestMetaSchema.optional() }); -var RequestIdSchema = union([string2(), number2().int()]); -var JSONRPCRequestSchema = object2({ - jsonrpc: literal(JSONRPC_VERSION), +var RequestIdSchema = z.union([z.string(), z.number().int()]); +var JSONRPCRequestSchema = z.object({ + jsonrpc: z.literal(JSONRPC_VERSION), id: RequestIdSchema, ...RequestSchema.shape }).strict(); var isJSONRPCRequest = (value) => JSONRPCRequestSchema.safeParse(value).success; -var JSONRPCNotificationSchema = object2({ - jsonrpc: literal(JSONRPC_VERSION), +var JSONRPCNotificationSchema = z.object({ + jsonrpc: z.literal(JSONRPC_VERSION), ...NotificationSchema.shape }).strict(); var isJSONRPCNotification = (value) => JSONRPCNotificationSchema.safeParse(value).success; -var JSONRPCResultResponseSchema = object2({ - jsonrpc: literal(JSONRPC_VERSION), +var JSONRPCResultResponseSchema = z.object({ + jsonrpc: z.literal(JSONRPC_VERSION), id: RequestIdSchema, result: ResultSchema }).strict(); @@ -30277,32 +7449,32 @@ var ErrorCode; ErrorCode2[ErrorCode2["InternalError"] = -32603] = "InternalError"; ErrorCode2[ErrorCode2["UrlElicitationRequired"] = -32042] = "UrlElicitationRequired"; })(ErrorCode || (ErrorCode = {})); -var JSONRPCErrorResponseSchema = object2({ - jsonrpc: literal(JSONRPC_VERSION), +var JSONRPCErrorResponseSchema = z.object({ + jsonrpc: z.literal(JSONRPC_VERSION), id: RequestIdSchema.optional(), - error: object2({ + error: z.object({ /** * The error type that occurred. */ - code: number2().int(), + code: z.number().int(), /** * A short description of the error. The message SHOULD be limited to a concise single sentence. */ - message: string2(), + message: z.string(), /** * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.). */ - data: unknown().optional() + data: z.unknown().optional() }) }).strict(); var isJSONRPCErrorResponse = (value) => JSONRPCErrorResponseSchema.safeParse(value).success; -var JSONRPCMessageSchema = union([ +var JSONRPCMessageSchema = z.union([ JSONRPCRequestSchema, JSONRPCNotificationSchema, JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema ]); -var JSONRPCResponseSchema = union([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]); +var JSONRPCResponseSchema = z.union([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]); var EmptyResultSchema = ResultSchema.strict(); var CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({ /** @@ -30314,28 +7486,28 @@ var CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({ /** * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user. */ - reason: string2().optional() + reason: z.string().optional() }); var CancelledNotificationSchema = NotificationSchema.extend({ - method: literal("notifications/cancelled"), + method: z.literal("notifications/cancelled"), params: CancelledNotificationParamsSchema }); -var IconSchema = object2({ +var IconSchema = z.object({ /** * URL or data URI for the icon. */ - src: string2(), + src: z.string(), /** * Optional MIME type for the icon. */ - mimeType: string2().optional(), + mimeType: z.string().optional(), /** * Optional array of strings that specify sizes at which the icon can be used. * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG. * * If not provided, the client should assume that the icon can be used at any size. */ - sizes: array(string2()).optional(), + sizes: z.array(z.string()).optional(), /** * Optional specifier for the theme this icon is designed for. `light` indicates * the icon is designed to be used with a light background, and `dark` indicates @@ -30343,9 +7515,9 @@ var IconSchema = object2({ * * If not provided, the client should assume the icon can be used with any theme. */ - theme: _enum2(["light", "dark"]).optional() + theme: z.enum(["light", "dark"]).optional() }); -var IconsSchema = object2({ +var IconsSchema = z.object({ /** * Optional set of sized icons that the client can display in a user interface. * @@ -30357,11 +7529,11 @@ var IconsSchema = object2({ * - `image/svg+xml` - SVG images (scalable but requires security precautions) * - `image/webp` - WebP images (modern, efficient format) */ - icons: array(IconSchema).optional() + icons: z.array(IconSchema).optional() }); -var BaseMetadataSchema = object2({ +var BaseMetadataSchema = z.object({ /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */ - name: string2(), + name: z.string(), /** * Intended for UI and end-user contexts — optimized to be human-readable and easily understood, * even by those unfamiliar with domain-specific terminology. @@ -30370,16 +7542,16 @@ var BaseMetadataSchema = object2({ * where `annotations.title` should be given precedence over using `name`, * if present). */ - title: string2().optional() + title: z.string().optional() }); var ImplementationSchema = BaseMetadataSchema.extend({ ...BaseMetadataSchema.shape, ...IconsSchema.shape, - version: string2(), + version: z.string(), /** * An optional URL of the website for this implementation. */ - websiteUrl: string2().optional(), + websiteUrl: z.string().optional(), /** * An optional human-readable description of what this implementation does. * @@ -30387,23 +7559,23 @@ var ImplementationSchema = BaseMetadataSchema.extend({ * and capabilities. For example, a server might describe the types of resources * or tools it provides, while a client might describe its intended use case. */ - description: string2().optional() + description: z.string().optional() }); -var FormElicitationCapabilitySchema = intersection(object2({ - applyDefaults: boolean2().optional() -}), record(string2(), unknown())); -var ElicitationCapabilitySchema = preprocess((value) => { +var FormElicitationCapabilitySchema = z.intersection(z.object({ + applyDefaults: z.boolean().optional() +}), z.record(z.string(), z.unknown())); +var ElicitationCapabilitySchema = z.preprocess((value) => { if (value && typeof value === "object" && !Array.isArray(value)) { if (Object.keys(value).length === 0) { return { form: {} }; } } return value; -}, intersection(object2({ +}, z.intersection(z.object({ form: FormElicitationCapabilitySchema.optional(), url: AssertObjectSchema.optional() -}), record(string2(), unknown()).optional())); -var ClientTasksCapabilitySchema = looseObject({ +}), z.record(z.string(), z.unknown()).optional())); +var ClientTasksCapabilitySchema = z.looseObject({ /** * Present if the client supports listing tasks. */ @@ -30415,22 +7587,22 @@ var ClientTasksCapabilitySchema = looseObject({ /** * Capabilities for task creation on specific request types. */ - requests: looseObject({ + requests: z.looseObject({ /** * Task support for sampling requests. */ - sampling: looseObject({ + sampling: z.looseObject({ createMessage: AssertObjectSchema.optional() }).optional(), /** * Task support for elicitation requests. */ - elicitation: looseObject({ + elicitation: z.looseObject({ create: AssertObjectSchema.optional() }).optional() }).optional() }); -var ServerTasksCapabilitySchema = looseObject({ +var ServerTasksCapabilitySchema = z.looseObject({ /** * Present if the server supports listing tasks. */ @@ -30442,24 +7614,24 @@ var ServerTasksCapabilitySchema = looseObject({ /** * Capabilities for task creation on specific request types. */ - requests: looseObject({ + requests: z.looseObject({ /** * Task support for tool requests. */ - tools: looseObject({ + tools: z.looseObject({ call: AssertObjectSchema.optional() }).optional() }).optional() }); -var ClientCapabilitiesSchema = object2({ +var ClientCapabilitiesSchema = z.object({ /** * Experimental, non-standard capabilities that the client supports. */ - experimental: record(string2(), AssertObjectSchema).optional(), + experimental: z.record(z.string(), AssertObjectSchema).optional(), /** * Present if the client supports sampling from an LLM. */ - sampling: object2({ + sampling: z.object({ /** * Present if the client supports context inclusion via includeContext parameter. * If not declared, servers SHOULD only use `includeContext: "none"` (or omit it). @@ -30477,11 +7649,11 @@ var ClientCapabilitiesSchema = object2({ /** * Present if the client supports listing roots. */ - roots: object2({ + roots: z.object({ /** * Whether the client supports issuing notifications for changes to the roots list. */ - listChanged: boolean2().optional() + listChanged: z.boolean().optional() }).optional(), /** * Present if the client supports task creation. @@ -30490,25 +7662,25 @@ var ClientCapabilitiesSchema = object2({ /** * Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name). */ - extensions: record(string2(), AssertObjectSchema).optional() + extensions: z.record(z.string(), AssertObjectSchema).optional() }); var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({ /** * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well. */ - protocolVersion: string2(), + protocolVersion: z.string(), capabilities: ClientCapabilitiesSchema, clientInfo: ImplementationSchema }); var InitializeRequestSchema = RequestSchema.extend({ - method: literal("initialize"), + method: z.literal("initialize"), params: InitializeRequestParamsSchema }); -var ServerCapabilitiesSchema = object2({ +var ServerCapabilitiesSchema = z.object({ /** * Experimental, non-standard capabilities that the server supports. */ - experimental: record(string2(), AssertObjectSchema).optional(), + experimental: z.record(z.string(), AssertObjectSchema).optional(), /** * Present if the server supports sending log messages to the client. */ @@ -30520,33 +7692,33 @@ var ServerCapabilitiesSchema = object2({ /** * Present if the server offers any prompt templates. */ - prompts: object2({ + prompts: z.object({ /** * Whether this server supports issuing notifications for changes to the prompt list. */ - listChanged: boolean2().optional() + listChanged: z.boolean().optional() }).optional(), /** * Present if the server offers any resources to read. */ - resources: object2({ + resources: z.object({ /** * Whether this server supports clients subscribing to resource updates. */ - subscribe: boolean2().optional(), + subscribe: z.boolean().optional(), /** * Whether this server supports issuing notifications for changes to the resource list. */ - listChanged: boolean2().optional() + listChanged: z.boolean().optional() }).optional(), /** * Present if the server offers any tools to call. */ - tools: object2({ + tools: z.object({ /** * Whether this server supports issuing notifications for changes to the tool list. */ - listChanged: boolean2().optional() + listChanged: z.boolean().optional() }).optional(), /** * Present if the server supports task creation. @@ -30555,13 +7727,13 @@ var ServerCapabilitiesSchema = object2({ /** * Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name). */ - extensions: record(string2(), AssertObjectSchema).optional() + extensions: z.record(z.string(), AssertObjectSchema).optional() }); var InitializeResultSchema = ResultSchema.extend({ /** * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect. */ - protocolVersion: string2(), + protocolVersion: z.string(), capabilities: ServerCapabilitiesSchema, serverInfo: ImplementationSchema, /** @@ -30569,31 +7741,31 @@ var InitializeResultSchema = ResultSchema.extend({ * * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt. */ - instructions: string2().optional() + instructions: z.string().optional() }); var InitializedNotificationSchema = NotificationSchema.extend({ - method: literal("notifications/initialized"), + method: z.literal("notifications/initialized"), params: NotificationsParamsSchema.optional() }); var PingRequestSchema = RequestSchema.extend({ - method: literal("ping"), + method: z.literal("ping"), params: BaseRequestParamsSchema.optional() }); -var ProgressSchema = object2({ +var ProgressSchema = z.object({ /** * The progress thus far. This should increase every time progress is made, even if the total is unknown. */ - progress: number2(), + progress: z.number(), /** * Total number of items to process (or total progress required), if known. */ - total: optional(number2()), + total: z.optional(z.number()), /** * An optional message describing the current progress. */ - message: optional(string2()) + message: z.optional(z.string()) }); -var ProgressNotificationParamsSchema = object2({ +var ProgressNotificationParamsSchema = z.object({ ...NotificationsParamsSchema.shape, ...ProgressSchema.shape, /** @@ -30602,7 +7774,7 @@ var ProgressNotificationParamsSchema = object2({ progressToken: ProgressTokenSchema }); var ProgressNotificationSchema = NotificationSchema.extend({ - method: literal("notifications/progress"), + method: z.literal("notifications/progress"), params: ProgressNotificationParamsSchema }); var PaginatedRequestParamsSchema = BaseRequestParamsSchema.extend({ @@ -30622,86 +7794,86 @@ var PaginatedResultSchema = ResultSchema.extend({ */ nextCursor: CursorSchema.optional() }); -var TaskStatusSchema = _enum2(["working", "input_required", "completed", "failed", "cancelled"]); -var TaskSchema = object2({ - taskId: string2(), +var TaskStatusSchema = z.enum(["working", "input_required", "completed", "failed", "cancelled"]); +var TaskSchema = z.object({ + taskId: z.string(), status: TaskStatusSchema, /** * Time in milliseconds to keep task results available after completion. * If null, the task has unlimited lifetime until manually cleaned up. */ - ttl: union([number2(), _null3()]), + ttl: z.union([z.number(), z.null()]), /** * ISO 8601 timestamp when the task was created. */ - createdAt: string2(), + createdAt: z.string(), /** * ISO 8601 timestamp when the task was last updated. */ - lastUpdatedAt: string2(), - pollInterval: optional(number2()), + lastUpdatedAt: z.string(), + pollInterval: z.optional(z.number()), /** * Optional diagnostic message for failed tasks or other status information. */ - statusMessage: optional(string2()) + statusMessage: z.optional(z.string()) }); var CreateTaskResultSchema = ResultSchema.extend({ task: TaskSchema }); var TaskStatusNotificationParamsSchema = NotificationsParamsSchema.merge(TaskSchema); var TaskStatusNotificationSchema = NotificationSchema.extend({ - method: literal("notifications/tasks/status"), + method: z.literal("notifications/tasks/status"), params: TaskStatusNotificationParamsSchema }); var GetTaskRequestSchema = RequestSchema.extend({ - method: literal("tasks/get"), + method: z.literal("tasks/get"), params: BaseRequestParamsSchema.extend({ - taskId: string2() + taskId: z.string() }) }); var GetTaskResultSchema = ResultSchema.merge(TaskSchema); var GetTaskPayloadRequestSchema = RequestSchema.extend({ - method: literal("tasks/result"), + method: z.literal("tasks/result"), params: BaseRequestParamsSchema.extend({ - taskId: string2() + taskId: z.string() }) }); var GetTaskPayloadResultSchema = ResultSchema.loose(); var ListTasksRequestSchema = PaginatedRequestSchema.extend({ - method: literal("tasks/list") + method: z.literal("tasks/list") }); var ListTasksResultSchema = PaginatedResultSchema.extend({ - tasks: array(TaskSchema) + tasks: z.array(TaskSchema) }); var CancelTaskRequestSchema = RequestSchema.extend({ - method: literal("tasks/cancel"), + method: z.literal("tasks/cancel"), params: BaseRequestParamsSchema.extend({ - taskId: string2() + taskId: z.string() }) }); var CancelTaskResultSchema = ResultSchema.merge(TaskSchema); -var ResourceContentsSchema = object2({ +var ResourceContentsSchema = z.object({ /** * The URI of this resource. */ - uri: string2(), + uri: z.string(), /** * The MIME type of this resource, if known. */ - mimeType: optional(string2()), + mimeType: z.optional(z.string()), /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: record(string2(), unknown()).optional() + _meta: z.record(z.string(), z.unknown()).optional() }); var TextResourceContentsSchema = ResourceContentsSchema.extend({ /** * The text of the item. This must only be set if the item can actually be represented as text (not binary data). */ - text: string2() + text: z.string() }); -var Base64Schema = string2().refine((val) => { +var Base64Schema = z.string().refine((val) => { try { atob(val); return true; @@ -30715,44 +7887,44 @@ var BlobResourceContentsSchema = ResourceContentsSchema.extend({ */ blob: Base64Schema }); -var RoleSchema = _enum2(["user", "assistant"]); -var AnnotationsSchema = object2({ +var RoleSchema = z.enum(["user", "assistant"]); +var AnnotationsSchema = z.object({ /** * Intended audience(s) for the resource. */ - audience: array(RoleSchema).optional(), + audience: z.array(RoleSchema).optional(), /** * Importance hint for the resource, from 0 (least) to 1 (most). */ - priority: number2().min(0).max(1).optional(), + priority: z.number().min(0).max(1).optional(), /** * ISO 8601 timestamp for the most recent modification. */ - lastModified: iso_exports2.datetime({ offset: true }).optional() + lastModified: z.iso.datetime({ offset: true }).optional() }); -var ResourceSchema = object2({ +var ResourceSchema = z.object({ ...BaseMetadataSchema.shape, ...IconsSchema.shape, /** * The URI of this resource. */ - uri: string2(), + uri: z.string(), /** * A description of what this resource represents. * * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model. */ - description: optional(string2()), + description: z.optional(z.string()), /** * The MIME type of this resource, if known. */ - mimeType: optional(string2()), + mimeType: z.optional(z.string()), /** * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known. * * This can be used by Hosts to display file sizes and estimate context window usage. */ - size: optional(number2()), + size: z.optional(z.number()), /** * Optional annotations for the client. */ @@ -30761,25 +7933,25 @@ var ResourceSchema = object2({ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: optional(looseObject({})) + _meta: z.optional(z.looseObject({})) }); -var ResourceTemplateSchema = object2({ +var ResourceTemplateSchema = z.object({ ...BaseMetadataSchema.shape, ...IconsSchema.shape, /** * A URI template (according to RFC 6570) that can be used to construct resource URIs. */ - uriTemplate: string2(), + uriTemplate: z.string(), /** * A description of what this template is for. * * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model. */ - description: optional(string2()), + description: z.optional(z.string()), /** * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type. */ - mimeType: optional(string2()), + mimeType: z.optional(z.string()), /** * Optional annotations for the client. */ @@ -30788,19 +7960,19 @@ var ResourceTemplateSchema = object2({ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: optional(looseObject({})) + _meta: z.optional(z.looseObject({})) }); var ListResourcesRequestSchema = PaginatedRequestSchema.extend({ - method: literal("resources/list") + method: z.literal("resources/list") }); var ListResourcesResultSchema = PaginatedResultSchema.extend({ - resources: array(ResourceSchema) + resources: z.array(ResourceSchema) }); var ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({ - method: literal("resources/templates/list") + method: z.literal("resources/templates/list") }); var ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({ - resourceTemplates: array(ResourceTemplateSchema) + resourceTemplates: z.array(ResourceTemplateSchema) }); var ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({ /** @@ -30808,97 +7980,97 @@ var ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({ * * @format uri */ - uri: string2() + uri: z.string() }); var ReadResourceRequestParamsSchema = ResourceRequestParamsSchema; var ReadResourceRequestSchema = RequestSchema.extend({ - method: literal("resources/read"), + method: z.literal("resources/read"), params: ReadResourceRequestParamsSchema }); var ReadResourceResultSchema = ResultSchema.extend({ - contents: array(union([TextResourceContentsSchema, BlobResourceContentsSchema])) + contents: z.array(z.union([TextResourceContentsSchema, BlobResourceContentsSchema])) }); var ResourceListChangedNotificationSchema = NotificationSchema.extend({ - method: literal("notifications/resources/list_changed"), + method: z.literal("notifications/resources/list_changed"), params: NotificationsParamsSchema.optional() }); var SubscribeRequestParamsSchema = ResourceRequestParamsSchema; var SubscribeRequestSchema = RequestSchema.extend({ - method: literal("resources/subscribe"), + method: z.literal("resources/subscribe"), params: SubscribeRequestParamsSchema }); var UnsubscribeRequestParamsSchema = ResourceRequestParamsSchema; var UnsubscribeRequestSchema = RequestSchema.extend({ - method: literal("resources/unsubscribe"), + method: z.literal("resources/unsubscribe"), params: UnsubscribeRequestParamsSchema }); var ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({ /** * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to. */ - uri: string2() + uri: z.string() }); var ResourceUpdatedNotificationSchema = NotificationSchema.extend({ - method: literal("notifications/resources/updated"), + method: z.literal("notifications/resources/updated"), params: ResourceUpdatedNotificationParamsSchema }); -var PromptArgumentSchema = object2({ +var PromptArgumentSchema = z.object({ /** * The name of the argument. */ - name: string2(), + name: z.string(), /** * A human-readable description of the argument. */ - description: optional(string2()), + description: z.optional(z.string()), /** * Whether this argument must be provided. */ - required: optional(boolean2()) + required: z.optional(z.boolean()) }); -var PromptSchema = object2({ +var PromptSchema = z.object({ ...BaseMetadataSchema.shape, ...IconsSchema.shape, /** * An optional description of what this prompt provides */ - description: optional(string2()), + description: z.optional(z.string()), /** * A list of arguments to use for templating the prompt. */ - arguments: optional(array(PromptArgumentSchema)), + arguments: z.optional(z.array(PromptArgumentSchema)), /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: optional(looseObject({})) + _meta: z.optional(z.looseObject({})) }); var ListPromptsRequestSchema = PaginatedRequestSchema.extend({ - method: literal("prompts/list") + method: z.literal("prompts/list") }); var ListPromptsResultSchema = PaginatedResultSchema.extend({ - prompts: array(PromptSchema) + prompts: z.array(PromptSchema) }); var GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({ /** * The name of the prompt or prompt template. */ - name: string2(), + name: z.string(), /** * Arguments to use for templating the prompt. */ - arguments: record(string2(), string2()).optional() + arguments: z.record(z.string(), z.string()).optional() }); var GetPromptRequestSchema = RequestSchema.extend({ - method: literal("prompts/get"), + method: z.literal("prompts/get"), params: GetPromptRequestParamsSchema }); -var TextContentSchema = object2({ - type: literal("text"), +var TextContentSchema = z.object({ + type: z.literal("text"), /** * The text content of the message. */ - text: string2(), + text: z.string(), /** * Optional annotations for the client. */ @@ -30907,10 +8079,10 @@ var TextContentSchema = object2({ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: record(string2(), unknown()).optional() + _meta: z.record(z.string(), z.unknown()).optional() }); -var ImageContentSchema = object2({ - type: literal("image"), +var ImageContentSchema = z.object({ + type: z.literal("image"), /** * The base64-encoded image data. */ @@ -30918,7 +8090,7 @@ var ImageContentSchema = object2({ /** * The MIME type of the image. Different providers may support different image types. */ - mimeType: string2(), + mimeType: z.string(), /** * Optional annotations for the client. */ @@ -30927,10 +8099,10 @@ var ImageContentSchema = object2({ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: record(string2(), unknown()).optional() + _meta: z.record(z.string(), z.unknown()).optional() }); -var AudioContentSchema = object2({ - type: literal("audio"), +var AudioContentSchema = z.object({ + type: z.literal("audio"), /** * The base64-encoded audio data. */ @@ -30938,7 +8110,7 @@ var AudioContentSchema = object2({ /** * The MIME type of the audio. Different providers may support different audio types. */ - mimeType: string2(), + mimeType: z.string(), /** * Optional annotations for the client. */ @@ -30947,34 +8119,34 @@ var AudioContentSchema = object2({ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: record(string2(), unknown()).optional() + _meta: z.record(z.string(), z.unknown()).optional() }); -var ToolUseContentSchema = object2({ - type: literal("tool_use"), +var ToolUseContentSchema = z.object({ + type: z.literal("tool_use"), /** * The name of the tool to invoke. * Must match a tool name from the request's tools array. */ - name: string2(), + name: z.string(), /** * Unique identifier for this tool call. * Used to correlate with ToolResultContent in subsequent messages. */ - id: string2(), + id: z.string(), /** * Arguments to pass to the tool. * Must conform to the tool's inputSchema. */ - input: record(string2(), unknown()), + input: z.record(z.string(), z.unknown()), /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: record(string2(), unknown()).optional() + _meta: z.record(z.string(), z.unknown()).optional() }); -var EmbeddedResourceSchema = object2({ - type: literal("resource"), - resource: union([TextResourceContentsSchema, BlobResourceContentsSchema]), +var EmbeddedResourceSchema = z.object({ + type: z.literal("resource"), + resource: z.union([TextResourceContentsSchema, BlobResourceContentsSchema]), /** * Optional annotations for the client. */ @@ -30983,19 +8155,19 @@ var EmbeddedResourceSchema = object2({ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: record(string2(), unknown()).optional() + _meta: z.record(z.string(), z.unknown()).optional() }); var ResourceLinkSchema = ResourceSchema.extend({ - type: literal("resource_link") + type: z.literal("resource_link") }); -var ContentBlockSchema = union([ +var ContentBlockSchema = z.union([ TextContentSchema, ImageContentSchema, AudioContentSchema, ResourceLinkSchema, EmbeddedResourceSchema ]); -var PromptMessageSchema = object2({ +var PromptMessageSchema = z.object({ role: RoleSchema, content: ContentBlockSchema }); @@ -31003,24 +8175,24 @@ var GetPromptResultSchema = ResultSchema.extend({ /** * An optional description for the prompt. */ - description: string2().optional(), - messages: array(PromptMessageSchema) + description: z.string().optional(), + messages: z.array(PromptMessageSchema) }); var PromptListChangedNotificationSchema = NotificationSchema.extend({ - method: literal("notifications/prompts/list_changed"), + method: z.literal("notifications/prompts/list_changed"), params: NotificationsParamsSchema.optional() }); -var ToolAnnotationsSchema = object2({ +var ToolAnnotationsSchema = z.object({ /** * A human-readable title for the tool. */ - title: string2().optional(), + title: z.string().optional(), /** * If true, the tool does not modify its environment. * * Default: false */ - readOnlyHint: boolean2().optional(), + readOnlyHint: z.boolean().optional(), /** * If true, the tool may perform destructive updates to its environment. * If false, the tool performs only additive updates. @@ -31029,7 +8201,7 @@ var ToolAnnotationsSchema = object2({ * * Default: true */ - destructiveHint: boolean2().optional(), + destructiveHint: z.boolean().optional(), /** * If true, calling the tool repeatedly with the same arguments * will have no additional effect on the its environment. @@ -31038,7 +8210,7 @@ var ToolAnnotationsSchema = object2({ * * Default: false */ - idempotentHint: boolean2().optional(), + idempotentHint: z.boolean().optional(), /** * If true, this tool may interact with an "open world" of external * entities. If false, the tool's domain of interaction is closed. @@ -31047,9 +8219,9 @@ var ToolAnnotationsSchema = object2({ * * Default: true */ - openWorldHint: boolean2().optional() + openWorldHint: z.boolean().optional() }); -var ToolExecutionSchema = object2({ +var ToolExecutionSchema = z.object({ /** * Indicates the tool's preference for task-augmented execution. * - "required": Clients MUST invoke the tool as a task @@ -31058,34 +8230,34 @@ var ToolExecutionSchema = object2({ * * If not present, defaults to "forbidden". */ - taskSupport: _enum2(["required", "optional", "forbidden"]).optional() + taskSupport: z.enum(["required", "optional", "forbidden"]).optional() }); -var ToolSchema = object2({ +var ToolSchema = z.object({ ...BaseMetadataSchema.shape, ...IconsSchema.shape, /** * A human-readable description of the tool. */ - description: string2().optional(), + description: z.string().optional(), /** * A JSON Schema 2020-12 object defining the expected parameters for the tool. * Must have type: 'object' at the root level per MCP spec. */ - inputSchema: object2({ - type: literal("object"), - properties: record(string2(), AssertObjectSchema).optional(), - required: array(string2()).optional() - }).catchall(unknown()), + inputSchema: z.object({ + type: z.literal("object"), + properties: z.record(z.string(), AssertObjectSchema).optional(), + required: z.array(z.string()).optional() + }).catchall(z.unknown()), /** * An optional JSON Schema 2020-12 object defining the structure of the tool's output * returned in the structuredContent field of a CallToolResult. * Must have type: 'object' at the root level per MCP spec. */ - outputSchema: object2({ - type: literal("object"), - properties: record(string2(), AssertObjectSchema).optional(), - required: array(string2()).optional() - }).catchall(unknown()).optional(), + outputSchema: z.object({ + type: z.literal("object"), + properties: z.record(z.string(), AssertObjectSchema).optional(), + required: z.array(z.string()).optional() + }).catchall(z.unknown()).optional(), /** * Optional additional tool information. */ @@ -31098,13 +8270,13 @@ var ToolSchema = object2({ * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: record(string2(), unknown()).optional() + _meta: z.record(z.string(), z.unknown()).optional() }); var ListToolsRequestSchema = PaginatedRequestSchema.extend({ - method: literal("tools/list") + method: z.literal("tools/list") }); var ListToolsResultSchema = PaginatedResultSchema.extend({ - tools: array(ToolSchema) + tools: z.array(ToolSchema) }); var CallToolResultSchema = ResultSchema.extend({ /** @@ -31113,13 +8285,13 @@ var CallToolResultSchema = ResultSchema.extend({ * If the Tool does not define an outputSchema, this field MUST be present in the result. * For backwards compatibility, this field is always present, but it may be empty. */ - content: array(ContentBlockSchema).default([]), + content: z.array(ContentBlockSchema).default([]), /** * An object containing structured tool output. * * If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema. */ - structuredContent: record(string2(), unknown()).optional(), + structuredContent: z.record(z.string(), z.unknown()).optional(), /** * Whether the tool call ended in an error. * @@ -31134,30 +8306,30 @@ var CallToolResultSchema = ResultSchema.extend({ * server does not support tool calls, or any other exceptional conditions, * should be reported as an MCP error response. */ - isError: boolean2().optional() + isError: z.boolean().optional() }); var CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.extend({ - toolResult: unknown() + toolResult: z.unknown() })); var CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({ /** * The name of the tool to call. */ - name: string2(), + name: z.string(), /** * Arguments to pass to the tool. */ - arguments: record(string2(), unknown()).optional() + arguments: z.record(z.string(), z.unknown()).optional() }); var CallToolRequestSchema = RequestSchema.extend({ - method: literal("tools/call"), + method: z.literal("tools/call"), params: CallToolRequestParamsSchema }); var ToolListChangedNotificationSchema = NotificationSchema.extend({ - method: literal("notifications/tools/list_changed"), + method: z.literal("notifications/tools/list_changed"), params: NotificationsParamsSchema.optional() }); -var ListChangedOptionsBaseSchema = object2({ +var ListChangedOptionsBaseSchema = z.object({ /** * If true, the list will be refreshed automatically when a list changed notification is received. * The callback will be called with the updated list. @@ -31166,7 +8338,7 @@ var ListChangedOptionsBaseSchema = object2({ * * @default true */ - autoRefresh: boolean2().default(true), + autoRefresh: z.boolean().default(true), /** * Debounce time in milliseconds for list changed notification processing. * @@ -31175,9 +8347,9 @@ var ListChangedOptionsBaseSchema = object2({ * * @default 300 */ - debounceMs: number2().int().nonnegative().default(300) + debounceMs: z.number().int().nonnegative().default(300) }); -var LoggingLevelSchema = _enum2(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]); +var LoggingLevelSchema = z.enum(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]); var SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({ /** * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/logging/message. @@ -31185,7 +8357,7 @@ var SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({ level: LoggingLevelSchema }); var SetLevelRequestSchema = RequestSchema.extend({ - method: literal("logging/setLevel"), + method: z.literal("logging/setLevel"), params: SetLevelRequestParamsSchema }); var LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({ @@ -31196,80 +8368,80 @@ var LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({ /** * An optional name of the logger issuing this message. */ - logger: string2().optional(), + logger: z.string().optional(), /** * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here. */ - data: unknown() + data: z.unknown() }); var LoggingMessageNotificationSchema = NotificationSchema.extend({ - method: literal("notifications/message"), + method: z.literal("notifications/message"), params: LoggingMessageNotificationParamsSchema }); -var ModelHintSchema = object2({ +var ModelHintSchema = z.object({ /** * A hint for a model name. */ - name: string2().optional() + name: z.string().optional() }); -var ModelPreferencesSchema = object2({ +var ModelPreferencesSchema = z.object({ /** * Optional hints to use for model selection. */ - hints: array(ModelHintSchema).optional(), + hints: z.array(ModelHintSchema).optional(), /** * How much to prioritize cost when selecting a model. */ - costPriority: number2().min(0).max(1).optional(), + costPriority: z.number().min(0).max(1).optional(), /** * How much to prioritize sampling speed (latency) when selecting a model. */ - speedPriority: number2().min(0).max(1).optional(), + speedPriority: z.number().min(0).max(1).optional(), /** * How much to prioritize intelligence and capabilities when selecting a model. */ - intelligencePriority: number2().min(0).max(1).optional() + intelligencePriority: z.number().min(0).max(1).optional() }); -var ToolChoiceSchema = object2({ +var ToolChoiceSchema = z.object({ /** * Controls when tools are used: * - "auto": Model decides whether to use tools (default) * - "required": Model MUST use at least one tool before completing * - "none": Model MUST NOT use any tools */ - mode: _enum2(["auto", "required", "none"]).optional() + mode: z.enum(["auto", "required", "none"]).optional() }); -var ToolResultContentSchema = object2({ - type: literal("tool_result"), - toolUseId: string2().describe("The unique identifier for the corresponding tool call."), - content: array(ContentBlockSchema).default([]), - structuredContent: object2({}).loose().optional(), - isError: boolean2().optional(), +var ToolResultContentSchema = z.object({ + type: z.literal("tool_result"), + toolUseId: z.string().describe("The unique identifier for the corresponding tool call."), + content: z.array(ContentBlockSchema).default([]), + structuredContent: z.object({}).loose().optional(), + isError: z.boolean().optional(), /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: record(string2(), unknown()).optional() + _meta: z.record(z.string(), z.unknown()).optional() }); -var SamplingContentSchema = discriminatedUnion("type", [TextContentSchema, ImageContentSchema, AudioContentSchema]); -var SamplingMessageContentBlockSchema = discriminatedUnion("type", [ +var SamplingContentSchema = z.discriminatedUnion("type", [TextContentSchema, ImageContentSchema, AudioContentSchema]); +var SamplingMessageContentBlockSchema = z.discriminatedUnion("type", [ TextContentSchema, ImageContentSchema, AudioContentSchema, ToolUseContentSchema, ToolResultContentSchema ]); -var SamplingMessageSchema = object2({ +var SamplingMessageSchema = z.object({ role: RoleSchema, - content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)]), + content: z.union([SamplingMessageContentBlockSchema, z.array(SamplingMessageContentBlockSchema)]), /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: record(string2(), unknown()).optional() + _meta: z.record(z.string(), z.unknown()).optional() }); var CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({ - messages: array(SamplingMessageSchema), + messages: z.array(SamplingMessageSchema), /** * The server's preferences for which model to select. The client MAY modify or omit this request. */ @@ -31277,7 +8449,7 @@ var CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({ /** * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt. */ - systemPrompt: string2().optional(), + systemPrompt: z.string().optional(), /** * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. * The client MAY ignore this request. @@ -31285,15 +8457,15 @@ var CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({ * Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client * declares ClientCapabilities.sampling.context. These values may be removed in future spec releases. */ - includeContext: _enum2(["none", "thisServer", "allServers"]).optional(), - temperature: number2().optional(), + includeContext: z.enum(["none", "thisServer", "allServers"]).optional(), + temperature: z.number().optional(), /** * The requested maximum number of tokens to sample (to prevent runaway completions). * * The client MAY choose to sample fewer tokens than the requested maximum. */ - maxTokens: number2().int(), - stopSequences: array(string2()).optional(), + maxTokens: z.number().int(), + stopSequences: z.array(z.string()).optional(), /** * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific. */ @@ -31302,7 +8474,7 @@ var CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({ * Tools that the model may use during generation. * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. */ - tools: array(ToolSchema).optional(), + tools: z.array(ToolSchema).optional(), /** * Controls how the model uses tools. * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. @@ -31311,14 +8483,14 @@ var CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({ toolChoice: ToolChoiceSchema.optional() }); var CreateMessageRequestSchema = RequestSchema.extend({ - method: literal("sampling/createMessage"), + method: z.literal("sampling/createMessage"), params: CreateMessageRequestParamsSchema }); var CreateMessageResultSchema = ResultSchema.extend({ /** * The name of the model that generated the message. */ - model: string2(), + model: z.string(), /** * The reason why sampling stopped, if known. * @@ -31329,7 +8501,7 @@ var CreateMessageResultSchema = ResultSchema.extend({ * * This field is an open string to allow for provider-specific stop reasons. */ - stopReason: optional(_enum2(["endTurn", "stopSequence", "maxTokens"]).or(string2())), + stopReason: z.optional(z.enum(["endTurn", "stopSequence", "maxTokens"]).or(z.string())), role: RoleSchema, /** * Response content. Single content block (text, image, or audio). @@ -31340,7 +8512,7 @@ var CreateMessageResultWithToolsSchema = ResultSchema.extend({ /** * The name of the model that generated the message. */ - model: string2(), + model: z.string(), /** * The reason why sampling stopped, if known. * @@ -31352,144 +8524,144 @@ var CreateMessageResultWithToolsSchema = ResultSchema.extend({ * * This field is an open string to allow for provider-specific stop reasons. */ - stopReason: optional(_enum2(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(string2())), + stopReason: z.optional(z.enum(["endTurn", "stopSequence", "maxTokens", "toolUse"]).or(z.string())), role: RoleSchema, /** * Response content. May be a single block or array. May include ToolUseContent if stopReason is "toolUse". */ - content: union([SamplingMessageContentBlockSchema, array(SamplingMessageContentBlockSchema)]) -}); -var BooleanSchemaSchema = object2({ - type: literal("boolean"), - title: string2().optional(), - description: string2().optional(), - default: boolean2().optional() -}); -var StringSchemaSchema = object2({ - type: literal("string"), - title: string2().optional(), - description: string2().optional(), - minLength: number2().optional(), - maxLength: number2().optional(), - format: _enum2(["email", "uri", "date", "date-time"]).optional(), - default: string2().optional() -}); -var NumberSchemaSchema = object2({ - type: _enum2(["number", "integer"]), - title: string2().optional(), - description: string2().optional(), - minimum: number2().optional(), - maximum: number2().optional(), - default: number2().optional() -}); -var UntitledSingleSelectEnumSchemaSchema = object2({ - type: literal("string"), - title: string2().optional(), - description: string2().optional(), - enum: array(string2()), - default: string2().optional() -}); -var TitledSingleSelectEnumSchemaSchema = object2({ - type: literal("string"), - title: string2().optional(), - description: string2().optional(), - oneOf: array(object2({ - const: string2(), - title: string2() + content: z.union([SamplingMessageContentBlockSchema, z.array(SamplingMessageContentBlockSchema)]) +}); +var BooleanSchemaSchema = z.object({ + type: z.literal("boolean"), + title: z.string().optional(), + description: z.string().optional(), + default: z.boolean().optional() +}); +var StringSchemaSchema = z.object({ + type: z.literal("string"), + title: z.string().optional(), + description: z.string().optional(), + minLength: z.number().optional(), + maxLength: z.number().optional(), + format: z.enum(["email", "uri", "date", "date-time"]).optional(), + default: z.string().optional() +}); +var NumberSchemaSchema = z.object({ + type: z.enum(["number", "integer"]), + title: z.string().optional(), + description: z.string().optional(), + minimum: z.number().optional(), + maximum: z.number().optional(), + default: z.number().optional() +}); +var UntitledSingleSelectEnumSchemaSchema = z.object({ + type: z.literal("string"), + title: z.string().optional(), + description: z.string().optional(), + enum: z.array(z.string()), + default: z.string().optional() +}); +var TitledSingleSelectEnumSchemaSchema = z.object({ + type: z.literal("string"), + title: z.string().optional(), + description: z.string().optional(), + oneOf: z.array(z.object({ + const: z.string(), + title: z.string() })), - default: string2().optional() -}); -var LegacyTitledEnumSchemaSchema = object2({ - type: literal("string"), - title: string2().optional(), - description: string2().optional(), - enum: array(string2()), - enumNames: array(string2()).optional(), - default: string2().optional() -}); -var SingleSelectEnumSchemaSchema = union([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]); -var UntitledMultiSelectEnumSchemaSchema = object2({ - type: literal("array"), - title: string2().optional(), - description: string2().optional(), - minItems: number2().optional(), - maxItems: number2().optional(), - items: object2({ - type: literal("string"), - enum: array(string2()) + default: z.string().optional() +}); +var LegacyTitledEnumSchemaSchema = z.object({ + type: z.literal("string"), + title: z.string().optional(), + description: z.string().optional(), + enum: z.array(z.string()), + enumNames: z.array(z.string()).optional(), + default: z.string().optional() +}); +var SingleSelectEnumSchemaSchema = z.union([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]); +var UntitledMultiSelectEnumSchemaSchema = z.object({ + type: z.literal("array"), + title: z.string().optional(), + description: z.string().optional(), + minItems: z.number().optional(), + maxItems: z.number().optional(), + items: z.object({ + type: z.literal("string"), + enum: z.array(z.string()) }), - default: array(string2()).optional() -}); -var TitledMultiSelectEnumSchemaSchema = object2({ - type: literal("array"), - title: string2().optional(), - description: string2().optional(), - minItems: number2().optional(), - maxItems: number2().optional(), - items: object2({ - anyOf: array(object2({ - const: string2(), - title: string2() + default: z.array(z.string()).optional() +}); +var TitledMultiSelectEnumSchemaSchema = z.object({ + type: z.literal("array"), + title: z.string().optional(), + description: z.string().optional(), + minItems: z.number().optional(), + maxItems: z.number().optional(), + items: z.object({ + anyOf: z.array(z.object({ + const: z.string(), + title: z.string() })) }), - default: array(string2()).optional() + default: z.array(z.string()).optional() }); -var MultiSelectEnumSchemaSchema = union([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]); -var EnumSchemaSchema = union([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]); -var PrimitiveSchemaDefinitionSchema = union([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]); +var MultiSelectEnumSchemaSchema = z.union([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]); +var EnumSchemaSchema = z.union([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]); +var PrimitiveSchemaDefinitionSchema = z.union([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]); var ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({ /** * The elicitation mode. * * Optional for backward compatibility. Clients MUST treat missing mode as "form". */ - mode: literal("form").optional(), + mode: z.literal("form").optional(), /** * The message to present to the user describing what information is being requested. */ - message: string2(), + message: z.string(), /** * A restricted subset of JSON Schema. * Only top-level properties are allowed, without nesting. */ - requestedSchema: object2({ - type: literal("object"), - properties: record(string2(), PrimitiveSchemaDefinitionSchema), - required: array(string2()).optional() + requestedSchema: z.object({ + type: z.literal("object"), + properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema), + required: z.array(z.string()).optional() }) }); var ElicitRequestURLParamsSchema = TaskAugmentedRequestParamsSchema.extend({ /** * The elicitation mode. */ - mode: literal("url"), + mode: z.literal("url"), /** * The message to present to the user explaining why the interaction is needed. */ - message: string2(), + message: z.string(), /** * The ID of the elicitation, which must be unique within the context of the server. * The client MUST treat this ID as an opaque value. */ - elicitationId: string2(), + elicitationId: z.string(), /** * The URL that the user should navigate to. */ - url: string2().url() + url: z.string().url() }); -var ElicitRequestParamsSchema = union([ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema]); +var ElicitRequestParamsSchema = z.union([ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema]); var ElicitRequestSchema = RequestSchema.extend({ - method: literal("elicitation/create"), + method: z.literal("elicitation/create"), params: ElicitRequestParamsSchema }); var ElicitationCompleteNotificationParamsSchema = NotificationsParamsSchema.extend({ /** * The ID of the elicitation that completed. */ - elicitationId: string2() + elicitationId: z.string() }); var ElicitationCompleteNotificationSchema = NotificationSchema.extend({ - method: literal("notifications/elicitation/complete"), + method: z.literal("notifications/elicitation/complete"), params: ElicitationCompleteNotificationParamsSchema }); var ElicitResultSchema = ResultSchema.extend({ @@ -31499,53 +8671,53 @@ var ElicitResultSchema = ResultSchema.extend({ * - "decline": User explicitly decline the action * - "cancel": User dismissed without making an explicit choice */ - action: _enum2(["accept", "decline", "cancel"]), + action: z.enum(["accept", "decline", "cancel"]), /** * The submitted form data, only present when action is "accept". * Contains values matching the requested schema. * Per MCP spec, content is "typically omitted" for decline/cancel actions. * We normalize null to undefined for leniency while maintaining type compatibility. */ - content: preprocess((val) => val === null ? void 0 : val, record(string2(), union([string2(), number2(), boolean2(), array(string2())])).optional()) + content: z.preprocess((val) => val === null ? void 0 : val, z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.array(z.string())])).optional()) }); -var ResourceTemplateReferenceSchema = object2({ - type: literal("ref/resource"), +var ResourceTemplateReferenceSchema = z.object({ + type: z.literal("ref/resource"), /** * The URI or URI template of the resource. */ - uri: string2() + uri: z.string() }); -var PromptReferenceSchema = object2({ - type: literal("ref/prompt"), +var PromptReferenceSchema = z.object({ + type: z.literal("ref/prompt"), /** * The name of the prompt or prompt template */ - name: string2() + name: z.string() }); var CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({ - ref: union([PromptReferenceSchema, ResourceTemplateReferenceSchema]), + ref: z.union([PromptReferenceSchema, ResourceTemplateReferenceSchema]), /** * The argument's information */ - argument: object2({ + argument: z.object({ /** * The name of the argument */ - name: string2(), + name: z.string(), /** * The value of the argument to use for completion matching. */ - value: string2() + value: z.string() }), - context: object2({ + context: z.object({ /** * Previously-resolved variables in a URI template or prompt. */ - arguments: record(string2(), string2()).optional() + arguments: z.record(z.string(), z.string()).optional() }).optional() }); var CompleteRequestSchema = RequestSchema.extend({ - method: literal("completion/complete"), + method: z.literal("completion/complete"), params: CompleteRequestParamsSchema }); function assertCompleteRequestPrompt(request) { @@ -31561,48 +8733,48 @@ function assertCompleteRequestResourceTemplate(request) { void request; } var CompleteResultSchema = ResultSchema.extend({ - completion: looseObject({ + completion: z.looseObject({ /** * An array of completion values. Must not exceed 100 items. */ - values: array(string2()).max(100), + values: z.array(z.string()).max(100), /** * The total number of completion options available. This can exceed the number of values actually sent in the response. */ - total: optional(number2().int()), + total: z.optional(z.number().int()), /** * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown. */ - hasMore: optional(boolean2()) + hasMore: z.optional(z.boolean()) }) }); -var RootSchema = object2({ +var RootSchema = z.object({ /** * The URI identifying the root. This *must* start with file:// for now. */ - uri: string2().startsWith("file://"), + uri: z.string().startsWith("file://"), /** * An optional name for the root. */ - name: string2().optional(), + name: z.string().optional(), /** * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) * for notes on _meta usage. */ - _meta: record(string2(), unknown()).optional() + _meta: z.record(z.string(), z.unknown()).optional() }); var ListRootsRequestSchema = RequestSchema.extend({ - method: literal("roots/list"), + method: z.literal("roots/list"), params: BaseRequestParamsSchema.optional() }); var ListRootsResultSchema = ResultSchema.extend({ - roots: array(RootSchema) + roots: z.array(RootSchema) }); var RootsListChangedNotificationSchema = NotificationSchema.extend({ - method: literal("notifications/roots/list_changed"), + method: z.literal("notifications/roots/list_changed"), params: NotificationsParamsSchema.optional() }); -var ClientRequestSchema = union([ +var ClientRequestSchema = z.union([ PingRequestSchema, InitializeRequestSchema, CompleteRequestSchema, @@ -31621,14 +8793,14 @@ var ClientRequestSchema = union([ ListTasksRequestSchema, CancelTaskRequestSchema ]); -var ClientNotificationSchema = union([ +var ClientNotificationSchema = z.union([ CancelledNotificationSchema, ProgressNotificationSchema, InitializedNotificationSchema, RootsListChangedNotificationSchema, TaskStatusNotificationSchema ]); -var ClientResultSchema = union([ +var ClientResultSchema = z.union([ EmptyResultSchema, CreateMessageResultSchema, CreateMessageResultWithToolsSchema, @@ -31638,7 +8810,7 @@ var ClientResultSchema = union([ ListTasksResultSchema, CreateTaskResultSchema ]); -var ServerRequestSchema = union([ +var ServerRequestSchema = z.union([ PingRequestSchema, CreateMessageRequestSchema, ElicitRequestSchema, @@ -31648,7 +8820,7 @@ var ServerRequestSchema = union([ ListTasksRequestSchema, CancelTaskRequestSchema ]); -var ServerNotificationSchema = union([ +var ServerNotificationSchema = z.union([ CancelledNotificationSchema, ProgressNotificationSchema, LoggingMessageNotificationSchema, @@ -31659,7 +8831,7 @@ var ServerNotificationSchema = union([ TaskStatusNotificationSchema, ElicitationCompleteNotificationSchema ]); -var ServerResultSchema = union([ +var ServerResultSchema = z.union([ EmptyResultSchema, InitializeResultSchema, CompleteResultSchema, @@ -31710,6 +8882,9 @@ function isTerminal(status) { return status === "completed" || status === "failed" || status === "cancelled"; } +// node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +import * as z4mini2 from "zod/v4-mini"; + // node_modules/zod-to-json-schema/dist/esm/Options.js var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use"); var defaultOptions = { @@ -31791,6 +8966,9 @@ var getRelativePath = (pathA, pathB) => { return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/"); }; +// node_modules/zod-to-json-schema/dist/esm/selectParser.js +import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind3 } from "zod/v3"; + // node_modules/zod-to-json-schema/dist/esm/parsers/any.js function parseAnyDef(refs) { if (refs.target !== "openAi") { @@ -31808,6 +8986,7 @@ function parseAnyDef(refs) { } // node_modules/zod-to-json-schema/dist/esm/parsers/array.js +import { ZodFirstPartyTypeKind } from "zod/v3"; function parseArrayDef(def, refs) { const res = { type: "array" @@ -31839,38 +9018,38 @@ function parseBigintDef(def, refs) { }; if (!def.checks) return res; - for (const check2 of def.checks) { - switch (check2.kind) { + for (const check of def.checks) { + switch (check.kind) { case "min": if (refs.target === "jsonSchema7") { - if (check2.inclusive) { - setResponseValueAndErrors(res, "minimum", check2.value, check2.message, refs); + if (check.inclusive) { + setResponseValueAndErrors(res, "minimum", check.value, check.message, refs); } else { - setResponseValueAndErrors(res, "exclusiveMinimum", check2.value, check2.message, refs); + setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs); } } else { - if (!check2.inclusive) { + if (!check.inclusive) { res.exclusiveMinimum = true; } - setResponseValueAndErrors(res, "minimum", check2.value, check2.message, refs); + setResponseValueAndErrors(res, "minimum", check.value, check.message, refs); } break; case "max": if (refs.target === "jsonSchema7") { - if (check2.inclusive) { - setResponseValueAndErrors(res, "maximum", check2.value, check2.message, refs); + if (check.inclusive) { + setResponseValueAndErrors(res, "maximum", check.value, check.message, refs); } else { - setResponseValueAndErrors(res, "exclusiveMaximum", check2.value, check2.message, refs); + setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs); } } else { - if (!check2.inclusive) { + if (!check.inclusive) { res.exclusiveMaximum = true; } - setResponseValueAndErrors(res, "maximum", check2.value, check2.message, refs); + setResponseValueAndErrors(res, "maximum", check.value, check.message, refs); } break; case "multipleOf": - setResponseValueAndErrors(res, "multipleOf", check2.value, check2.message, refs); + setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs); break; } } @@ -31926,15 +9105,15 @@ var integerDateParser = (def, refs) => { if (refs.target === "openApi3") { return res; } - for (const check2 of def.checks) { - switch (check2.kind) { + for (const check of def.checks) { + switch (check.kind) { case "min": setResponseValueAndErrors( res, "minimum", - check2.value, + check.value, // This is in milliseconds - check2.message, + check.message, refs ); break; @@ -31942,9 +9121,9 @@ var integerDateParser = (def, refs) => { setResponseValueAndErrors( res, "maximum", - check2.value, + check.value, // This is in milliseconds - check2.message, + check.message, refs ); break; @@ -32018,26 +9197,29 @@ function parseIntersectionDef(def, refs) { // node_modules/zod-to-json-schema/dist/esm/parsers/literal.js function parseLiteralDef(def, refs) { - const parsedType2 = typeof def.value; - if (parsedType2 !== "bigint" && parsedType2 !== "number" && parsedType2 !== "boolean" && parsedType2 !== "string") { + const parsedType = typeof def.value; + if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") { return { type: Array.isArray(def.value) ? "array" : "object" }; } if (refs.target === "openApi3") { return { - type: parsedType2 === "bigint" ? "integer" : parsedType2, + type: parsedType === "bigint" ? "integer" : parsedType, enum: [def.value] }; } return { - type: parsedType2 === "bigint" ? "integer" : parsedType2, + type: parsedType === "bigint" ? "integer" : parsedType, const: def.value }; } +// node_modules/zod-to-json-schema/dist/esm/parsers/record.js +import { ZodFirstPartyTypeKind as ZodFirstPartyTypeKind2 } from "zod/v3"; + // node_modules/zod-to-json-schema/dist/esm/parsers/string.js -var emojiRegex2 = void 0; +var emojiRegex = void 0; var zodPatterns = { /** * `c` was changed to `[cC]` to replicate /i flag @@ -32061,10 +9243,10 @@ var zodPatterns = { * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b */ emoji: () => { - if (emojiRegex2 === void 0) { - emojiRegex2 = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u"); + if (emojiRegex === void 0) { + emojiRegex = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u"); } - return emojiRegex2; + return emojiRegex; }, /** * Unused @@ -32090,118 +9272,118 @@ function parseStringDef(def, refs) { type: "string" }; if (def.checks) { - for (const check2 of def.checks) { - switch (check2.kind) { + for (const check of def.checks) { + switch (check.kind) { case "min": - setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check2.value) : check2.value, check2.message, refs); + setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs); break; case "max": - setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check2.value) : check2.value, check2.message, refs); + setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs); break; case "email": switch (refs.emailStrategy) { case "format:email": - addFormat(res, "email", check2.message, refs); + addFormat(res, "email", check.message, refs); break; case "format:idn-email": - addFormat(res, "idn-email", check2.message, refs); + addFormat(res, "idn-email", check.message, refs); break; case "pattern:zod": - addPattern(res, zodPatterns.email, check2.message, refs); + addPattern(res, zodPatterns.email, check.message, refs); break; } break; case "url": - addFormat(res, "uri", check2.message, refs); + addFormat(res, "uri", check.message, refs); break; case "uuid": - addFormat(res, "uuid", check2.message, refs); + addFormat(res, "uuid", check.message, refs); break; case "regex": - addPattern(res, check2.regex, check2.message, refs); + addPattern(res, check.regex, check.message, refs); break; case "cuid": - addPattern(res, zodPatterns.cuid, check2.message, refs); + addPattern(res, zodPatterns.cuid, check.message, refs); break; case "cuid2": - addPattern(res, zodPatterns.cuid2, check2.message, refs); + addPattern(res, zodPatterns.cuid2, check.message, refs); break; case "startsWith": - addPattern(res, RegExp(`^${escapeLiteralCheckValue(check2.value, refs)}`), check2.message, refs); + addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs); break; case "endsWith": - addPattern(res, RegExp(`${escapeLiteralCheckValue(check2.value, refs)}$`), check2.message, refs); + addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs); break; case "datetime": - addFormat(res, "date-time", check2.message, refs); + addFormat(res, "date-time", check.message, refs); break; case "date": - addFormat(res, "date", check2.message, refs); + addFormat(res, "date", check.message, refs); break; case "time": - addFormat(res, "time", check2.message, refs); + addFormat(res, "time", check.message, refs); break; case "duration": - addFormat(res, "duration", check2.message, refs); + addFormat(res, "duration", check.message, refs); break; case "length": - setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check2.value) : check2.value, check2.message, refs); - setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check2.value) : check2.value, check2.message, refs); + setResponseValueAndErrors(res, "minLength", typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value, check.message, refs); + setResponseValueAndErrors(res, "maxLength", typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value, check.message, refs); break; case "includes": { - addPattern(res, RegExp(escapeLiteralCheckValue(check2.value, refs)), check2.message, refs); + addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs); break; } case "ip": { - if (check2.version !== "v6") { - addFormat(res, "ipv4", check2.message, refs); + if (check.version !== "v6") { + addFormat(res, "ipv4", check.message, refs); } - if (check2.version !== "v4") { - addFormat(res, "ipv6", check2.message, refs); + if (check.version !== "v4") { + addFormat(res, "ipv6", check.message, refs); } break; } case "base64url": - addPattern(res, zodPatterns.base64url, check2.message, refs); + addPattern(res, zodPatterns.base64url, check.message, refs); break; case "jwt": - addPattern(res, zodPatterns.jwt, check2.message, refs); + addPattern(res, zodPatterns.jwt, check.message, refs); break; case "cidr": { - if (check2.version !== "v6") { - addPattern(res, zodPatterns.ipv4Cidr, check2.message, refs); + if (check.version !== "v6") { + addPattern(res, zodPatterns.ipv4Cidr, check.message, refs); } - if (check2.version !== "v4") { - addPattern(res, zodPatterns.ipv6Cidr, check2.message, refs); + if (check.version !== "v4") { + addPattern(res, zodPatterns.ipv6Cidr, check.message, refs); } break; } case "emoji": - addPattern(res, zodPatterns.emoji(), check2.message, refs); + addPattern(res, zodPatterns.emoji(), check.message, refs); break; case "ulid": { - addPattern(res, zodPatterns.ulid, check2.message, refs); + addPattern(res, zodPatterns.ulid, check.message, refs); break; } case "base64": { switch (refs.base64Strategy) { case "format:binary": { - addFormat(res, "binary", check2.message, refs); + addFormat(res, "binary", check.message, refs); break; } case "contentEncoding:base64": { - setResponseValueAndErrors(res, "contentEncoding", "base64", check2.message, refs); + setResponseValueAndErrors(res, "contentEncoding", "base64", check.message, refs); break; } case "pattern:zod": { - addPattern(res, zodPatterns.base64, check2.message, refs); + addPattern(res, zodPatterns.base64, check.message, refs); break; } } break; } case "nanoid": { - addPattern(res, zodPatterns.nanoid, check2.message, refs); + addPattern(res, zodPatterns.nanoid, check.message, refs); } case "toLowerCase": case "toUpperCase": @@ -32209,7 +9391,7 @@ function parseStringDef(def, refs) { break; default: /* @__PURE__ */ ((_) => { - })(check2); + })(check); } } } @@ -32366,7 +9548,7 @@ function parseRecordDef(def, refs) { if (refs.target === "openAi") { console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."); } - if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) { + if (refs.target === "openApi3" && def.keyType?._def.typeName === ZodFirstPartyTypeKind2.ZodEnum) { return { type: "object", required: def.keyType._def.values, @@ -32390,20 +9572,20 @@ function parseRecordDef(def, refs) { if (refs.target === "openApi3") { return schema; } - if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.checks?.length) { + if (def.keyType?._def.typeName === ZodFirstPartyTypeKind2.ZodString && def.keyType._def.checks?.length) { const { type, ...keyType } = parseStringDef(def.keyType._def, refs); return { ...schema, propertyNames: keyType }; - } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodEnum) { + } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind2.ZodEnum) { return { ...schema, propertyNames: { enum: def.keyType._def.values } }; - } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && def.keyType._def.type._def.checks?.length) { + } else if (def.keyType?._def.typeName === ZodFirstPartyTypeKind2.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind2.ZodString && def.keyType._def.type._def.checks?.length) { const { type, ...keyType } = parseBrandedDef(def.keyType._def, refs); return { ...schema, @@ -32440,11 +9622,11 @@ function parseMapDef(def, refs) { // node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js function parseNativeEnumDef(def) { - const object3 = def.values; + const object4 = def.values; const actualKeys = Object.keys(def.values).filter((key) => { - return typeof object3[object3[key]] !== "number"; + return typeof object4[object4[key]] !== "number"; }); - const actualValues = actualKeys.map((key) => object3[key]); + const actualValues = actualKeys.map((key) => object4[key]); const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values))); return { type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"], @@ -32579,42 +9761,42 @@ function parseNumberDef(def, refs) { }; if (!def.checks) return res; - for (const check2 of def.checks) { - switch (check2.kind) { + for (const check of def.checks) { + switch (check.kind) { case "int": res.type = "integer"; - addErrorMessage(res, "type", check2.message, refs); + addErrorMessage(res, "type", check.message, refs); break; case "min": if (refs.target === "jsonSchema7") { - if (check2.inclusive) { - setResponseValueAndErrors(res, "minimum", check2.value, check2.message, refs); + if (check.inclusive) { + setResponseValueAndErrors(res, "minimum", check.value, check.message, refs); } else { - setResponseValueAndErrors(res, "exclusiveMinimum", check2.value, check2.message, refs); + setResponseValueAndErrors(res, "exclusiveMinimum", check.value, check.message, refs); } } else { - if (!check2.inclusive) { + if (!check.inclusive) { res.exclusiveMinimum = true; } - setResponseValueAndErrors(res, "minimum", check2.value, check2.message, refs); + setResponseValueAndErrors(res, "minimum", check.value, check.message, refs); } break; case "max": if (refs.target === "jsonSchema7") { - if (check2.inclusive) { - setResponseValueAndErrors(res, "maximum", check2.value, check2.message, refs); + if (check.inclusive) { + setResponseValueAndErrors(res, "maximum", check.value, check.message, refs); } else { - setResponseValueAndErrors(res, "exclusiveMaximum", check2.value, check2.message, refs); + setResponseValueAndErrors(res, "exclusiveMaximum", check.value, check.message, refs); } } else { - if (!check2.inclusive) { + if (!check.inclusive) { res.exclusiveMaximum = true; } - setResponseValueAndErrors(res, "maximum", check2.value, check2.message, refs); + setResponseValueAndErrors(res, "maximum", check.value, check.message, refs); } break; case "multipleOf": - setResponseValueAndErrors(res, "multipleOf", check2.value, check2.message, refs); + setResponseValueAndErrors(res, "multipleOf", check.value, check.message, refs); break; } } @@ -32628,7 +9810,7 @@ function parseObjectDef(def, refs) { type: "object", properties: {} }; - const required2 = []; + const required = []; const shape = def.shape(); for (const propName in shape) { let propDef = shape[propName]; @@ -32655,11 +9837,11 @@ function parseObjectDef(def, refs) { } result.properties[propName] = parsedDef; if (!propOptional) { - required2.push(propName); + required.push(propName); } } - if (required2.length) { - result.required = required2; + if (required.length) { + result.required = required; } const additionalProperties = decideAdditionalProperties(def, refs); if (additionalProperties !== void 0) { @@ -32803,73 +9985,73 @@ var parseReadonlyDef = (def, refs) => { // node_modules/zod-to-json-schema/dist/esm/selectParser.js var selectParser = (def, typeName, refs) => { switch (typeName) { - case ZodFirstPartyTypeKind.ZodString: + case ZodFirstPartyTypeKind3.ZodString: return parseStringDef(def, refs); - case ZodFirstPartyTypeKind.ZodNumber: + case ZodFirstPartyTypeKind3.ZodNumber: return parseNumberDef(def, refs); - case ZodFirstPartyTypeKind.ZodObject: + case ZodFirstPartyTypeKind3.ZodObject: return parseObjectDef(def, refs); - case ZodFirstPartyTypeKind.ZodBigInt: + case ZodFirstPartyTypeKind3.ZodBigInt: return parseBigintDef(def, refs); - case ZodFirstPartyTypeKind.ZodBoolean: + case ZodFirstPartyTypeKind3.ZodBoolean: return parseBooleanDef(); - case ZodFirstPartyTypeKind.ZodDate: + case ZodFirstPartyTypeKind3.ZodDate: return parseDateDef(def, refs); - case ZodFirstPartyTypeKind.ZodUndefined: + case ZodFirstPartyTypeKind3.ZodUndefined: return parseUndefinedDef(refs); - case ZodFirstPartyTypeKind.ZodNull: + case ZodFirstPartyTypeKind3.ZodNull: return parseNullDef(refs); - case ZodFirstPartyTypeKind.ZodArray: + case ZodFirstPartyTypeKind3.ZodArray: return parseArrayDef(def, refs); - case ZodFirstPartyTypeKind.ZodUnion: - case ZodFirstPartyTypeKind.ZodDiscriminatedUnion: + case ZodFirstPartyTypeKind3.ZodUnion: + case ZodFirstPartyTypeKind3.ZodDiscriminatedUnion: return parseUnionDef(def, refs); - case ZodFirstPartyTypeKind.ZodIntersection: + case ZodFirstPartyTypeKind3.ZodIntersection: return parseIntersectionDef(def, refs); - case ZodFirstPartyTypeKind.ZodTuple: + case ZodFirstPartyTypeKind3.ZodTuple: return parseTupleDef(def, refs); - case ZodFirstPartyTypeKind.ZodRecord: + case ZodFirstPartyTypeKind3.ZodRecord: return parseRecordDef(def, refs); - case ZodFirstPartyTypeKind.ZodLiteral: + case ZodFirstPartyTypeKind3.ZodLiteral: return parseLiteralDef(def, refs); - case ZodFirstPartyTypeKind.ZodEnum: + case ZodFirstPartyTypeKind3.ZodEnum: return parseEnumDef(def); - case ZodFirstPartyTypeKind.ZodNativeEnum: + case ZodFirstPartyTypeKind3.ZodNativeEnum: return parseNativeEnumDef(def); - case ZodFirstPartyTypeKind.ZodNullable: + case ZodFirstPartyTypeKind3.ZodNullable: return parseNullableDef(def, refs); - case ZodFirstPartyTypeKind.ZodOptional: + case ZodFirstPartyTypeKind3.ZodOptional: return parseOptionalDef(def, refs); - case ZodFirstPartyTypeKind.ZodMap: + case ZodFirstPartyTypeKind3.ZodMap: return parseMapDef(def, refs); - case ZodFirstPartyTypeKind.ZodSet: + case ZodFirstPartyTypeKind3.ZodSet: return parseSetDef(def, refs); - case ZodFirstPartyTypeKind.ZodLazy: + case ZodFirstPartyTypeKind3.ZodLazy: return () => def.getter()._def; - case ZodFirstPartyTypeKind.ZodPromise: + case ZodFirstPartyTypeKind3.ZodPromise: return parsePromiseDef(def, refs); - case ZodFirstPartyTypeKind.ZodNaN: - case ZodFirstPartyTypeKind.ZodNever: + case ZodFirstPartyTypeKind3.ZodNaN: + case ZodFirstPartyTypeKind3.ZodNever: return parseNeverDef(refs); - case ZodFirstPartyTypeKind.ZodEffects: + case ZodFirstPartyTypeKind3.ZodEffects: return parseEffectsDef(def, refs); - case ZodFirstPartyTypeKind.ZodAny: + case ZodFirstPartyTypeKind3.ZodAny: return parseAnyDef(refs); - case ZodFirstPartyTypeKind.ZodUnknown: + case ZodFirstPartyTypeKind3.ZodUnknown: return parseUnknownDef(refs); - case ZodFirstPartyTypeKind.ZodDefault: + case ZodFirstPartyTypeKind3.ZodDefault: return parseDefaultDef(def, refs); - case ZodFirstPartyTypeKind.ZodBranded: + case ZodFirstPartyTypeKind3.ZodBranded: return parseBrandedDef(def, refs); - case ZodFirstPartyTypeKind.ZodReadonly: + case ZodFirstPartyTypeKind3.ZodReadonly: return parseReadonlyDef(def, refs); - case ZodFirstPartyTypeKind.ZodCatch: + case ZodFirstPartyTypeKind3.ZodCatch: return parseCatchDef(def, refs); - case ZodFirstPartyTypeKind.ZodPipeline: + case ZodFirstPartyTypeKind3.ZodPipeline: return parsePipelineDef(def, refs); - case ZodFirstPartyTypeKind.ZodFunction: - case ZodFirstPartyTypeKind.ZodVoid: - case ZodFirstPartyTypeKind.ZodSymbol: + case ZodFirstPartyTypeKind3.ZodFunction: + case ZodFirstPartyTypeKind3.ZodVoid: + case ZodFirstPartyTypeKind3.ZodSymbol: return void 0; default: return /* @__PURE__ */ ((_) => void 0)(typeName); @@ -33006,7 +10188,7 @@ function mapMiniTarget(t) { } function toJsonSchemaCompat(schema, opts) { if (isZ4Schema(schema)) { - return toJSONSchema(schema, { + return z4mini2.toJSONSchema(schema, { target: mapMiniTarget(opts?.target), io: opts?.pipeStrategy ?? "input" }); @@ -33090,8 +10272,8 @@ var Protocol = class { resolver(message); } else { const errorMessage = message; - const error61 = new McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data); - resolver(error61); + const error = new McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data); + resolver(error); } } else { const messageType = queuedMessage.type === "response" ? "Response" : "Error"; @@ -33135,8 +10317,8 @@ var Protocol = class { nextCursor, _meta: {} }; - } catch (error61) { - throw new McpError(ErrorCode.InvalidParams, `Failed to list tasks: ${error61 instanceof Error ? error61.message : String(error61)}`); + } catch (error) { + throw new McpError(ErrorCode.InvalidParams, `Failed to list tasks: ${error instanceof Error ? error.message : String(error)}`); } }); this.setRequestHandler(CancelTaskRequestSchema, async (request, extra) => { @@ -33158,11 +10340,11 @@ var Protocol = class { _meta: {}, ...cancelledTask }; - } catch (error61) { - if (error61 instanceof McpError) { - throw error61; + } catch (error) { + if (error instanceof McpError) { + throw error; } - throw new McpError(ErrorCode.InvalidRequest, `Failed to cancel task: ${error61 instanceof Error ? error61.message : String(error61)}`); + throw new McpError(ErrorCode.InvalidRequest, `Failed to cancel task: ${error instanceof Error ? error.message : String(error)}`); } }); } @@ -33223,9 +10405,9 @@ var Protocol = class { this._onclose(); }; const _onerror = this.transport?.onerror; - this._transport.onerror = (error61) => { - _onerror?.(error61); - this._onerror(error61); + this._transport.onerror = (error) => { + _onerror?.(error); + this._onerror(error); }; const _onmessage = this._transport?.onmessage; this._transport.onmessage = (message, extra) => { @@ -33256,22 +10438,22 @@ var Protocol = class { controller.abort(); } this._requestHandlerAbortControllers.clear(); - const error61 = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed"); + const error = McpError.fromError(ErrorCode.ConnectionClosed, "Connection closed"); this._transport = void 0; this.onclose?.(); for (const handler of responseHandlers.values()) { - handler(error61); + handler(error); } } - _onerror(error61) { - this.onerror?.(error61); + _onerror(error) { + this.onerror?.(error); } _onnotification(notification) { const handler = this._notificationHandlers.get(notification.method) ?? this.fallbackNotificationHandler; if (handler === void 0) { return; } - Promise.resolve().then(() => handler(notification)).catch((error61) => this._onerror(new Error(`Uncaught error in notification handler: ${error61}`))); + Promise.resolve().then(() => handler(notification)).catch((error) => this._onerror(new Error(`Uncaught error in notification handler: ${error}`))); } _onrequest(request, extra) { const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler; @@ -33291,9 +10473,9 @@ var Protocol = class { type: "error", message: errorResponse, timestamp: Date.now() - }, capturedTransport?.sessionId).catch((error61) => this._onerror(new Error(`Failed to enqueue error response: ${error61}`))); + }, capturedTransport?.sessionId).catch((error) => this._onerror(new Error(`Failed to enqueue error response: ${error}`))); } else { - capturedTransport?.send(errorResponse).catch((error61) => this._onerror(new Error(`Failed to send an error response: ${error61}`))); + capturedTransport?.send(errorResponse).catch((error) => this._onerror(new Error(`Failed to send an error response: ${error}`))); } return; } @@ -33359,7 +10541,7 @@ var Protocol = class { } else { await capturedTransport?.send(response); } - }, async (error61) => { + }, async (error) => { if (abortController.signal.aborted) { return; } @@ -33367,9 +10549,9 @@ var Protocol = class { jsonrpc: "2.0", id: request.id, error: { - code: Number.isSafeInteger(error61["code"]) ? error61["code"] : ErrorCode.InternalError, - message: error61.message ?? "Internal error", - ...error61["data"] !== void 0 && { data: error61["data"] } + code: Number.isSafeInteger(error["code"]) ? error["code"] : ErrorCode.InternalError, + message: error.message ?? "Internal error", + ...error["data"] !== void 0 && { data: error["data"] } } }; if (relatedTaskId && this._taskMessageQueue) { @@ -33381,7 +10563,7 @@ var Protocol = class { } else { await capturedTransport?.send(errorResponse); } - }).catch((error61) => this._onerror(new Error(`Failed to send response: ${error61}`))).finally(() => { + }).catch((error) => this._onerror(new Error(`Failed to send response: ${error}`))).finally(() => { if (this._requestHandlerAbortControllers.get(request.id) === abortController) { this._requestHandlerAbortControllers.delete(request.id); } @@ -33400,11 +10582,11 @@ var Protocol = class { if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) { try { this._resetTimeout(messageId); - } catch (error61) { + } catch (error) { this._responseHandlers.delete(messageId); this._progressHandlers.delete(messageId); this._cleanupTimeout(messageId); - responseHandler(error61); + responseHandler(error); return; } } @@ -33418,8 +10600,8 @@ var Protocol = class { if (isJSONRPCResultResponse(response)) { resolver(response); } else { - const error61 = new McpError(response.error.code, response.error.message, response.error.data); - resolver(error61); + const error = new McpError(response.error.code, response.error.message, response.error.data); + resolver(error); } return; } @@ -33447,8 +10629,8 @@ var Protocol = class { if (isJSONRPCResultResponse(response)) { handler(response); } else { - const error61 = McpError.fromError(response.error.code, response.error.message, response.error.data); - handler(error61); + const error = McpError.fromError(response.error.code, response.error.message, response.error.data); + handler(error); } } get transport() { @@ -33493,10 +10675,10 @@ var Protocol = class { try { const result = await this.request(request, resultSchema, options); yield { type: "result", result }; - } catch (error61) { + } catch (error) { yield { type: "error", - error: error61 instanceof McpError ? error61 : new McpError(ErrorCode.InternalError, String(error61)) + error: error instanceof McpError ? error : new McpError(ErrorCode.InternalError, String(error)) }; } return; @@ -33539,10 +10721,10 @@ var Protocol = class { await new Promise((resolve) => setTimeout(resolve, pollInterval)); options?.signal?.throwIfAborted(); } - } catch (error61) { + } catch (error) { yield { type: "error", - error: error61 instanceof McpError ? error61 : new McpError(ErrorCode.InternalError, String(error61)) + error: error instanceof McpError ? error : new McpError(ErrorCode.InternalError, String(error)) }; } } @@ -33554,8 +10736,8 @@ var Protocol = class { request(request, resultSchema, options) { const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {}; return new Promise((resolve, reject) => { - const earlyReject = (error61) => { - reject(error61); + const earlyReject = (error) => { + reject(error); }; if (!this._transport) { earlyReject(new Error("Not connected")); @@ -33615,9 +10797,9 @@ var Protocol = class { requestId: messageId, reason: String(reason) } - }, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error62) => this._onerror(new Error(`Failed to send cancellation: ${error62}`))); - const error61 = reason instanceof McpError ? reason : new McpError(ErrorCode.RequestTimeout, String(reason)); - reject(error61); + }, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error2) => this._onerror(new Error(`Failed to send cancellation: ${error2}`))); + const error = reason instanceof McpError ? reason : new McpError(ErrorCode.RequestTimeout, String(reason)); + reject(error); }; this._responseHandlers.set(messageId, (response) => { if (options?.signal?.aborted) { @@ -33633,8 +10815,8 @@ var Protocol = class { } else { resolve(parseResult.data); } - } catch (error61) { - reject(error61); + } catch (error) { + reject(error); } }); options?.signal?.addEventListener("abort", () => { @@ -33658,14 +10840,14 @@ var Protocol = class { type: "request", message: jsonrpcRequest, timestamp: Date.now() - }).catch((error61) => { + }).catch((error) => { this._cleanupTimeout(messageId); - reject(error61); + reject(error); }); } else { - this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error61) => { + this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch((error) => { this._cleanupTimeout(messageId); - reject(error61); + reject(error); }); } }); @@ -33758,7 +10940,7 @@ var Protocol = class { } }; } - this._transport?.send(jsonrpcNotification2, options).catch((error61) => this._onerror(error61)); + this._transport?.send(jsonrpcNotification2, options).catch((error) => this._onerror(error)); }); return; } @@ -33970,7 +11152,7 @@ var Protocol = class { }; } }; -function isPlainObject2(value) { +function isPlainObject(value) { return value !== null && typeof value === "object" && !Array.isArray(value); } function mergeCapabilities(base, additional) { @@ -33981,7 +11163,7 @@ function mergeCapabilities(base, additional) { if (addValue === void 0) continue; const baseValue = result[k]; - if (isPlainObject2(baseValue) && isPlainObject2(addValue)) { + if (isPlainObject(baseValue) && isPlainObject(addValue)) { result[k] = { ...baseValue, ...addValue }; } else { result[k] = addValue; @@ -34039,12 +11221,12 @@ var AjvJsonSchemaValidator = class { */ getValidator(schema) { const ajvValidator = "$id" in schema && typeof schema.$id === "string" ? this._ajv.getSchema(schema.$id) ?? this._ajv.compile(schema) : this._ajv.compile(schema); - return (input2) => { - const valid = ajvValidator(input2); + return (input) => { + const valid = ajvValidator(input); if (valid) { return { valid: true, - data: input2, + data: input, errorMessage: void 0 }; } else { @@ -34611,11 +11793,11 @@ var Server = class extends Protocol { if (!validationResult.valid) { throw new McpError(ErrorCode.InvalidParams, `Elicitation response content does not match requested schema: ${validationResult.errorMessage}`); } - } catch (error61) { - if (error61 instanceof McpError) { - throw error61; + } catch (error) { + if (error instanceof McpError) { + throw error; } - throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error61 instanceof Error ? error61.message : String(error61)}`); + throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error instanceof Error ? error.message : String(error)}`); } } return result; @@ -34683,8 +11865,8 @@ function isCompletable(schema) { return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema; } function getCompleter(schema) { - const meta3 = schema[COMPLETABLE_SYMBOL]; - return meta3?.complete; + const meta = schema[COMPLETABLE_SYMBOL]; + return meta?.complete; } var McpZodTypeKind; (function(McpZodTypeKind2) { @@ -34754,17 +11936,18 @@ var ExperimentalMcpServerTasks = class { constructor(_mcpServer) { this._mcpServer = _mcpServer; } - registerToolTask(name, config2, handler) { - const execution = { taskSupport: "required", ...config2.execution }; + registerToolTask(name, config, handler) { + const execution = { taskSupport: "required", ...config.execution }; if (execution.taskSupport === "forbidden") { throw new Error(`Cannot register task-based tool '${name}' with taskSupport 'forbidden'. Use registerTool() instead.`); } const mcpServerInternal = this._mcpServer; - return mcpServerInternal._createRegisteredTool(name, config2.title, config2.description, config2.inputSchema, config2.outputSchema, config2.annotations, execution, config2._meta, handler); + return mcpServerInternal._createRegisteredTool(name, config.title, config.description, config.inputSchema, config.outputSchema, config.annotations, execution, config._meta, handler); } }; // node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +import { ZodOptional } from "zod"; var McpServer = class { constructor(serverInfo, options) { this._registeredResources = {}; @@ -34874,13 +12057,13 @@ var McpServer = class { } await this.validateToolOutput(tool, result, request.params.name); return result; - } catch (error61) { - if (error61 instanceof McpError) { - if (error61.code === ErrorCode.UrlElicitationRequired) { - throw error61; + } catch (error) { + if (error instanceof McpError) { + if (error.code === ErrorCode.UrlElicitationRequired) { + throw error; } } - return this.createToolError(error61 instanceof Error ? error61.message : String(error61)); + return this.createToolError(error instanceof Error ? error.message : String(error)); } }); this._toolHandlersInitialized = true; @@ -34913,8 +12096,8 @@ var McpServer = class { const schemaToParse = inputObj ?? tool.inputSchema; const parseResult = await safeParseAsync2(schemaToParse, args); if (!parseResult.success) { - const error61 = "error" in parseResult ? parseResult.error : "Unknown error"; - const errorMessage = getParseErrorMessage(error61); + const error = "error" in parseResult ? parseResult.error : "Unknown error"; + const errorMessage = getParseErrorMessage(error); throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage}`); } return parseResult.data; @@ -34938,8 +12121,8 @@ var McpServer = class { const outputObj = normalizeObjectSchema(tool.outputSchema); const parseResult = await safeParseAsync2(outputObj, result.structuredContent); if (!parseResult.success) { - const error61 = "error" in parseResult ? parseResult.error : "Unknown error"; - const errorMessage = getParseErrorMessage(error61); + const error = "error" in parseResult ? parseResult.error : "Unknown error"; + const errorMessage = getParseErrorMessage(error); throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage}`); } } @@ -35151,8 +12334,8 @@ var McpServer = class { const argsObj = normalizeObjectSchema(prompt.argsSchema); const parseResult = await safeParseAsync2(argsObj, request.params.arguments); if (!parseResult.success) { - const error61 = "error" in parseResult ? parseResult.error : "Unknown error"; - const errorMessage = getParseErrorMessage(error61); + const error = "error" in parseResult ? parseResult.error : "Unknown error"; + const errorMessage = getParseErrorMessage(error); throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage}`); } const args = parseResult.data; @@ -35189,12 +12372,12 @@ var McpServer = class { return registeredResourceTemplate; } } - registerResource(name, uriOrTemplate, config2, readCallback) { + registerResource(name, uriOrTemplate, config, readCallback) { if (typeof uriOrTemplate === "string") { if (this._registeredResources[uriOrTemplate]) { throw new Error(`Resource ${uriOrTemplate} is already registered`); } - const registeredResource = this._createRegisteredResource(name, config2.title, uriOrTemplate, config2, readCallback); + const registeredResource = this._createRegisteredResource(name, config.title, uriOrTemplate, config, readCallback); this.setResourceRequestHandlers(); this.sendResourceListChanged(); return registeredResource; @@ -35202,7 +12385,7 @@ var McpServer = class { if (this._registeredResourceTemplates[name]) { throw new Error(`Resource template ${name} is already registered`); } - const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, config2.title, uriOrTemplate, config2, readCallback); + const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, config.title, uriOrTemplate, config, readCallback); this.setResourceRequestHandlers(); this.sendResourceListChanged(); return registeredResourceTemplate; @@ -35309,7 +12492,7 @@ var McpServer = class { this._registeredPrompts[name] = registeredPrompt; if (argsSchema) { const hasCompletable = Object.values(argsSchema).some((field) => { - const inner = field instanceof ZodOptional2 ? field._def?.innerType : field; + const inner = field instanceof ZodOptional ? field._def?.innerType : field; return isCompletable(inner); }); if (hasCompletable) { @@ -35400,11 +12583,11 @@ var McpServer = class { /** * Registers a tool with a config object and callback. */ - registerTool(name, config2, cb) { + registerTool(name, config, cb) { if (this._registeredTools[name]) { throw new Error(`Tool ${name} is already registered`); } - const { title, description, inputSchema, outputSchema, annotations, _meta } = config2; + const { title, description, inputSchema, outputSchema, annotations, _meta } = config; return this._createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, { taskSupport: "forbidden" }, _meta, cb); } prompt(name, ...rest) { @@ -35428,11 +12611,11 @@ var McpServer = class { /** * Registers a prompt with a config object and callback. */ - registerPrompt(name, config2, cb) { + registerPrompt(name, config, cb) { if (this._registeredPrompts[name]) { throw new Error(`Prompt ${name} is already registered`); } - const { title, description, argsSchema } = config2; + const { title, description, argsSchema } = config; const registeredPrompt = this._createRegisteredPrompt(name, title, description, argsSchema, cb); this.setPromptRequestHandlers(); this.sendPromptListChanged(); @@ -35557,7 +12740,7 @@ var EMPTY_COMPLETION_RESULT = { }; // node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js -import process3 from "node:process"; +import process2 from "node:process"; // node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024; @@ -35598,7 +12781,7 @@ function serializeMessage(message) { // node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js var StdioServerTransport = class { - constructor(_stdin = process3.stdin, _stdout = process3.stdout, options) { + constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) { this._stdin = _stdin; this._stdout = _stdout; this._started = false; @@ -35606,14 +12789,14 @@ var StdioServerTransport = class { try { this._readBuffer.append(chunk); this.processReadBuffer(); - } catch (error61) { - this.onerror?.(error61); + } catch (error) { + this.onerror?.(error); this.close().catch(() => { }); } }; - this._onerror = (error61) => { - this.onerror?.(error61); + this._onerror = (error) => { + this.onerror?.(error); }; this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize }); } @@ -35636,8 +12819,8 @@ var StdioServerTransport = class { break; } this.onmessage?.(message); - } catch (error61) { - this.onerror?.(error61); + } catch (error) { + this.onerror?.(error); } } } @@ -35653,8 +12836,8 @@ var StdioServerTransport = class { } send(message) { return new Promise((resolve) => { - const json2 = serializeMessage(message); - if (this._stdout.write(json2)) { + const json = serializeMessage(message); + if (this._stdout.write(json)) { resolve(); } else { this._stdout.once("drain", resolve); @@ -35666,36 +12849,38 @@ var StdioServerTransport = class { // src/server.ts import path2 from "node:path"; import { fileURLToPath } from "node:url"; +import { z as z3 } from "zod"; // src/filePolicy.ts import { createHash } from "node:crypto"; -import { open as open2, lstat, mkdir, opendir, readFile, realpath } from "node:fs/promises"; +import { open, lstat, mkdir, opendir, readFile, realpath } from "node:fs/promises"; import path from "node:path"; import { TextDecoder } from "node:util"; -var RootConfigSchema = external_exports.object({ - id: external_exports.string().regex(/^[a-z][a-z0-9-]{0,31}$/), - label: external_exports.string().min(1).max(80), - path: external_exports.string().min(1), - read: external_exports.boolean(), - create: external_exports.boolean(), - host_id: external_exports.string().regex(/^[a-z][a-z0-9-]{0,63}$/).optional(), - volume_id: external_exports.string().regex(/^vol-[a-f0-9]{16}$/).optional(), - current_drive_letter: external_exports.string().regex(/^[A-Z]$/).optional(), - filesystem: external_exports.string().min(1).max(32).optional(), - bus_type: external_exports.string().min(1).max(64).optional(), - online: external_exports.boolean().optional(), - auto_discovered: external_exports.boolean().optional() +import { z as z2 } from "zod"; +var RootConfigSchema = z2.object({ + id: z2.string().regex(/^[a-z][a-z0-9-]{0,31}$/), + label: z2.string().min(1).max(80), + path: z2.string().min(1), + read: z2.boolean(), + create: z2.boolean(), + host_id: z2.string().regex(/^[a-z][a-z0-9-]{0,63}$/).optional(), + volume_id: z2.string().regex(/^vol-[a-f0-9]{16}$/).optional(), + current_drive_letter: z2.string().regex(/^[A-Z]$/).optional(), + filesystem: z2.string().min(1).max(32).optional(), + bus_type: z2.string().min(1).max(64).optional(), + online: z2.boolean().optional(), + auto_discovered: z2.boolean().optional() }).strict(); -var LimitsSchema = external_exports.object({ - maxReadBytes: external_exports.number().int().min(1024).max(1024 * 1024).default(256 * 1024), - maxWriteBytes: external_exports.number().int().min(1024).max(4 * 1024 * 1024).default(1024 * 1024), - maxDirectoryEntries: external_exports.number().int().min(1).max(1e3).default(250), - maxSearchResults: external_exports.number().int().min(1).max(250).default(100), - maxSearchEntries: external_exports.number().int().min(100).max(25e3).default(5e3) +var LimitsSchema = z2.object({ + maxReadBytes: z2.number().int().min(1024).max(1024 * 1024).default(256 * 1024), + maxWriteBytes: z2.number().int().min(1024).max(4 * 1024 * 1024).default(1024 * 1024), + maxDirectoryEntries: z2.number().int().min(1).max(1e3).default(250), + maxSearchResults: z2.number().int().min(1).max(250).default(100), + maxSearchEntries: z2.number().int().min(100).max(25e3).default(5e3) }).strict(); -var FileBridgeConfigSchema = external_exports.object({ - version: external_exports.literal(1), - roots: external_exports.array(RootConfigSchema).min(1).max(26), +var FileBridgeConfigSchema = z2.object({ + version: z2.literal(1), + roots: z2.array(RootConfigSchema).min(1).max(26), limits: LimitsSchema }).strict(); var PolicyError = class extends Error { @@ -35783,8 +12968,8 @@ var FileBridgePolicy = class _FileBridgePolicy { } return _FileBridgePolicy.fromConfig(FileBridgeConfigSchema.parse(parsed), driveRootOptIn); } - static async fromConfig(config2, driveRootOptIn) { - const validated = FileBridgeConfigSchema.parse(config2); + static async fromConfig(config, driveRootOptIn) { + const validated = FileBridgeConfigSchema.parse(config); const roots = /* @__PURE__ */ new Map(); for (const configured of validated.roots) { if (roots.has(configured.id)) { @@ -35797,8 +12982,8 @@ var FileBridgePolicy = class _FileBridgePolicy { canonicalPath = authorized.target; rootInfo = authorized.info; if (!rootInfo.isDirectory() || rootInfo.isSymbolicLink()) throw new Error("not a real directory"); - } catch (error61) { - if (error61 instanceof PolicyError) throw error61; + } catch (error) { + if (error instanceof PolicyError) throw error; throw new PolicyError("CONFIG_ROOT_UNAVAILABLE", `Configured root '${configured.id}' is unavailable.`); } if (isFilesystemRoot(canonicalPath) && driveRootOptIn !== DRIVE_ROOT_OPT_IN) { @@ -35874,7 +13059,7 @@ var FileBridgePolicy = class _FileBridgePolicy { throw new PolicyError("NOT_A_REGULAR_FILE", "Only regular files can be read."); } const limit = Math.min(requestedMaxBytes ?? this.limits.maxReadBytes, this.limits.maxReadBytes); - const handle = await open2(resolved.target, "r"); + const handle = await open(resolved.target, "r"); try { const after = await handle.stat({ bigint: true }); if (!after.isFile() || !sameFileIdentity(before, after)) { @@ -35949,8 +13134,8 @@ var FileBridgePolicy = class _FileBridgePolicy { if (!resolved.normalizedRelative) throw new PolicyError("ROOT_WRITE_BLOCKED", "The configured root cannot be created or replaced."); try { await mkdir(resolved.target, { recursive: false }); - } catch (error61) { - throw translateCreateError(error61); + } catch (error) { + throw translateCreateError(error); } await assertUnchanged(resolved.parent.target, resolved.parent.info); try { @@ -35973,9 +13158,9 @@ var FileBridgePolicy = class _FileBridgePolicy { } let handle; try { - handle = await open2(resolved.target, "wx", 384); - } catch (error61) { - throw translateCreateError(error61); + handle = await open(resolved.target, "wx", 384); + } catch (error) { + throw translateCreateError(error); } try { const [opened, named] = await Promise.all([handle.stat({ bigint: true }), lstat(resolved.target, { bigint: true })]); @@ -36043,15 +13228,15 @@ var FileBridgePolicy = class _FileBridgePolicy { return { root, target, normalizedRelative, parent }; } }; -function validateRelativePath(input2) { - if (typeof input2 !== "string" || input2.includes("\0")) throw new PolicyError("INVALID_PATH", "Path is invalid."); - if (path.isAbsolute(input2) || path.win32.isAbsolute(input2) || path.posix.isAbsolute(input2)) { +function validateRelativePath(input) { + if (typeof input !== "string" || input.includes("\0")) throw new PolicyError("INVALID_PATH", "Path is invalid."); + if (path.isAbsolute(input) || path.win32.isAbsolute(input) || path.posix.isAbsolute(input)) { throw new PolicyError("ABSOLUTE_PATH_BLOCKED", "Use a configured root id and a relative path."); } - if (input2.includes("/") && input2.includes("\\") || /[\\/]{2,}/u.test(input2)) { + if (input.includes("/") && input.includes("\\") || /[\\/]{2,}/u.test(input)) { throw new PolicyError("AMBIGUOUS_PATH_BLOCKED", "Mixed or repeated path separators are not allowed."); } - const parts = input2.split(/[\\/]+/).filter(Boolean); + const parts = input.split(/[\\/]+/).filter(Boolean); for (const part of parts) { validatePathComponent(part); } @@ -36130,8 +13315,8 @@ async function authorizeStoredComponents(start, startInfo, suppliedParts, bounda let suppliedInfo; try { suppliedInfo = await lstat(suppliedTarget, { bigint: true }); - } catch (error61) { - if (isNodeError(error61) && error61.code === "ENOENT") { + } catch (error) { + if (isNodeError(error) && error.code === "ENOENT") { throw new PolicyError("PATH_NOT_FOUND", "The requested path does not exist."); } throw new PolicyError("PATH_UNAVAILABLE", "A path component is unavailable."); @@ -36262,8 +13447,8 @@ function decodeUtf8(buffer, truncated) { } throw new PolicyError("NON_TEXT_FILE", "The requested file is not valid UTF-8 text."); } -function redactSecrets(input2) { - let text = input2; +function redactSecrets(input) { + let text = input; let count = 0; const replace = (pattern, replacement) => { text = text.replace(pattern, (...values) => { @@ -36282,20 +13467,20 @@ function redactSecrets(input2) { ); return { text, count }; } -function translateCreateError(error61) { - if (isNodeError(error61) && error61.code === "EEXIST") { +function translateCreateError(error) { + if (isNodeError(error) && error.code === "EEXIST") { return new PolicyError("TARGET_EXISTS", "Target already exists. FileBridge never overwrites existing paths."); } - if (isNodeError(error61) && error61.code === "ENOENT") { + if (isNodeError(error) && error.code === "ENOENT") { return new PolicyError("PARENT_UNAVAILABLE", "The parent directory must already exist."); } - if (isNodeError(error61) && (error61.code === "EACCES" || error61.code === "EPERM")) { + if (isNodeError(error) && (error.code === "EACCES" || error.code === "EPERM")) { return new PolicyError("CREATE_DENIED", "The operating system denied creation."); } return new PolicyError("CREATE_FAILED", "The new path could not be created."); } -function isNodeError(error61) { - return error61 instanceof Error && "code" in error61; +function isNodeError(error) { + return error instanceof Error && "code" in error; } // src/server.ts @@ -36311,8 +13496,8 @@ var createAnnotations = { idempotentHint: false, openWorldHint: false }; -var rootId = external_exports.string().regex(/^[a-z][a-z0-9-]{0,31}$/); -var relativePath = external_exports.string().max(4096).default(""); +var rootId = z3.string().regex(/^[a-z][a-z0-9-]{0,31}$/); +var relativePath = z3.string().max(4096).default(""); async function main() { const moduleDirectory = path2.dirname(fileURLToPath(import.meta.url)); const pluginRoot = path2.resolve(moduleDirectory, ".."); @@ -36329,7 +13514,7 @@ async function main() { { title: "List allowed PC folders", description: "List the configured filesystem roots and whether each permits bounded reads and create-only writes.", - inputSchema: external_exports.object({}), + inputSchema: z3.object({}), annotations: readAnnotations }, async () => execute(() => ({ roots: policy.listRoots() })) @@ -36339,10 +13524,10 @@ async function main() { { title: "List a directory", description: "List entries inside an allowed root using a relative path. Sensitive names and links are omitted server-side.", - inputSchema: external_exports.object({ + inputSchema: z3.object({ root_id: rootId, relative_path: relativePath, - limit: external_exports.number().int().min(1).max(1e3).optional() + limit: z3.number().int().min(1).max(1e3).optional() }), annotations: readAnnotations }, @@ -36353,7 +13538,7 @@ async function main() { { title: "Inspect file or directory metadata", description: "Read bounded metadata for one existing relative path without opening file content.", - inputSchema: external_exports.object({ root_id: rootId, relative_path: relativePath }), + inputSchema: z3.object({ root_id: rootId, relative_path: relativePath }), annotations: readAnnotations }, async ({ root_id, relative_path }) => execute(() => policy.statPath(root_id, relative_path)) @@ -36363,10 +13548,10 @@ async function main() { { title: "Read a UTF-8 text file", description: "Read a bounded UTF-8 prefix from one allowed file. Known credential patterns are redacted and binary files are rejected.", - inputSchema: external_exports.object({ + inputSchema: z3.object({ root_id: rootId, - relative_path: external_exports.string().min(1).max(4096), - max_bytes: external_exports.number().int().min(1024).max(1024 * 1024).optional() + relative_path: z3.string().min(1).max(4096), + max_bytes: z3.number().int().min(1024).max(1024 * 1024).optional() }), annotations: readAnnotations }, @@ -36377,9 +13562,9 @@ async function main() { { title: "Search file and directory names", description: "Recursively search names, not file contents, below an allowed relative path. Results and traversal are strictly bounded.", - inputSchema: external_exports.object({ + inputSchema: z3.object({ root_id: rootId, - query: external_exports.string().min(1).max(200), + query: z3.string().min(1).max(200), start_path: relativePath }), annotations: readAnnotations @@ -36391,7 +13576,7 @@ async function main() { { title: "Create a new directory", description: "Create exactly one new directory below an allowed root. The parent must exist. Existing paths are never replaced or reused.", - inputSchema: external_exports.object({ root_id: rootId, relative_path: external_exports.string().min(1).max(4096) }), + inputSchema: z3.object({ root_id: rootId, relative_path: z3.string().min(1).max(4096) }), annotations: createAnnotations }, async ({ root_id, relative_path }) => execute(() => policy.createDirectory(root_id, relative_path)) @@ -36401,10 +13586,10 @@ async function main() { { title: "Create a new text file", description: "Create one new UTF-8 text file using OS-level exclusive create mode. If the target exists, the call fails without changing it.", - inputSchema: external_exports.object({ + inputSchema: z3.object({ root_id: rootId, - relative_path: external_exports.string().min(1).max(4096), - content: external_exports.string().max(1024 * 1024) + relative_path: z3.string().min(1).max(4096), + content: z3.string().max(1024 * 1024) }), annotations: createAnnotations }, @@ -36425,8 +13610,8 @@ async function execute(operation) { content: [{ type: "text", text: JSON.stringify(data) }], structuredContent: data }; - } catch (error61) { - const safe = safeError(error61); + } catch (error) { + const safe = safeError(error); process.stderr.write(`${JSON.stringify({ event: "tool_error", code: safe.code })} `); return { @@ -36435,13 +13620,13 @@ async function execute(operation) { }; } } -function safeError(error61) { - if (error61 instanceof PolicyError) return { code: error61.code, message: error61.message }; - if (error61 instanceof external_exports.ZodError) return { code: "INVALID_INPUT", message: "Tool input did not match the required schema." }; +function safeError(error) { + if (error instanceof PolicyError) return { code: error.code, message: error.message }; + if (error instanceof z3.ZodError) return { code: "INVALID_INPUT", message: "Tool input did not match the required schema." }; return { code: "INTERNAL_ERROR", message: "The filesystem operation failed safely." }; } -main().catch((error61) => { - const safe = safeError(error61); +main().catch((error) => { + const safe = safeError(error); process.stderr.write(`${JSON.stringify({ event: "startup_failed", code: safe.code, message: safe.message })} `); process.exitCode = 1; From 01dd811f703bf2427b799de2c4889c77531fa26a Mon Sep 17 00:00:00 2001 From: dzeusking-dev Date: Sun, 30 Aug 2026 21:39:52 +0200 Subject: [PATCH 6/7] ci: restore protected-branch compatibility checks --- .github/workflows/ci.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6f4f85..e14b632 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -132,3 +132,32 @@ jobs: sha256sum -c SHA256SUMS ) node scripts/verify-release-artifact.mjs --release-dir release-ci --tag "${tag}" + + compatibility-build-status: + name: Build, test, and security checks + needs: [verify, container-runtime, receiver-simulation] + if: ${{ always() }} + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Enforce aggregate build and security result + env: + VERIFY_RESULT: ${{ needs.verify.result }} + CONTAINER_RESULT: ${{ needs.container-runtime.result }} + RECEIVER_RESULT: ${{ needs.receiver-simulation.result }} + run: | + test "$VERIFY_RESULT" = "success" + test "$CONTAINER_RESULT" = "success" + test "$RECEIVER_RESULT" = "success" + + compatibility-windows-status: + name: Windows security checks + needs: verify + if: ${{ always() }} + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Enforce Windows matrix result + env: + VERIFY_RESULT: ${{ needs.verify.result }} + run: test "$VERIFY_RESULT" = "success" From df4a8dd1800b7bfa5339e9f6428ba7f9c3ef88fc Mon Sep 17 00:00:00 2001 From: dzeusking-dev Date: Sun, 30 Aug 2026 21:47:10 +0200 Subject: [PATCH 7/7] fix(container): ship externalized zod runtime --- deploy/docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy/docker/Dockerfile b/deploy/docker/Dockerfile index 0ad1f41..f9f3a2b 100644 --- a/deploy/docker/Dockerfile +++ b/deploy/docker/Dockerfile @@ -74,6 +74,7 @@ RUN rm -rf /usr/local/lib/node_modules/npm \ WORKDIR /app COPY --from=build --chown=10001:10001 /src/mcp/server.mjs /app/mcp/server.mjs +COPY --from=build --chown=10001:10001 /src/node_modules/zod /app/node_modules/zod COPY --chown=10001:10001 config/roots.infrastructure.example.json /app/config/roots.infrastructure.json COPY deploy/docker/entrypoint.sh /usr/local/bin/pc-filebridge-entrypoint COPY deploy/docker/healthcheck.mjs /usr/local/lib/pc-filebridge/healthcheck.mjs