From 6160d82f35269c112b8e27d00b8f1dcb058594ca Mon Sep 17 00:00:00 2001 From: mohammed naji Date: Tue, 11 Aug 2026 07:52:41 +0400 Subject: [PATCH 1/3] chore(release): prepare v1.0.0 --- CHANGELOG.md | 14 ++++- README.md | 6 +- docs/cli.md | 2 +- docs/config.md | 2 +- docs/independent-security-review.md | 8 ++- docs/library-api.md | 6 +- docs/oauth-console-validation.md | 14 ++--- docs/plugins.md | 2 +- docs/presets-and-clients.md | 2 +- docs/threat-model.md | 6 +- docs/v1-evaluation.md | 6 +- docs/whats-new-in-0.5.md | 10 ++-- package-lock.json | 54 ++++++++--------- package.json | 15 +++-- tests/fixtures/fake-upstream-bundled.mjs | 40 ++++++------- .../oauth-console-validation-contract.test.ts | 10 ++-- tests/package-contract.test.ts | 60 +++++++++++++++++-- tests/readme-product-contract.test.ts | 7 ++- tests/release-config.test.ts | 24 ++++++-- tests/release-version.test.ts | 50 +++++++--------- tests/v050-feature-guide-contract.test.ts | 6 +- tests/v1-readiness-docs-contract.test.ts | 17 ++++-- 22 files changed, 227 insertions(+), 134 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d606c322..791ac401 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,22 @@ All notable changes to this project will be documented in this file. The format ## [Unreleased] +## [1.0.0] - 2026-08-11 + ### Changed +- [#39](https://github.com/mohanagy/miftah/issues/39) Established the stable Semantic Versioning contract for documented configuration formats, CLI and MCP names, audit records, package exports, and the plugin API. The v1 candidate preserves the tested 0.5.8 runtime surface while promoting the compatibility, migration, documentation, security, and cross-platform gates accumulated across the pre-1.0 line. - [#36](https://github.com/mohanagy/miftah/issues/36) Added a repeatable, research-only evaluation of MCP tool-description quarantine: exact descriptor drift is detected with canonical hashes, while a deliberately small heuristic corpus records both false positives and missed malicious descriptions. The published recommendation defers runtime quarantine until representative design-partner evidence shows acceptable value, approval churn, and recovery behavior; this prototype is not a production security control and does not claim protection after credentials reach an operator-approved upstream. +### Security + +- [#373](https://github.com/mohanagy/miftah/issues/373) Updated the exact transitive security resolutions to `fast-uri` 3.1.5, `ip-address` 10.3.1, `hono` 4.12.34, `brace-expansion` 5.0.9, and `nanoid` 3.3.17 after newly disclosed host-confusion, SSRF/trust-classification, ReDoS, and denial-of-service advisories. Package contracts reject stale nested copies, and both production-only and full npm audits report zero known vulnerabilities without changing Miftah's runtime API. + +### Validation + +- The maintainer reported **5/5 completed external workflows**, **3 returning participants**, **3 unaided evaluators**, and a completed security report, then authorized closure of the related v1 issues. This release record preserves that as maintainer attestation: the participant records and completed report were not independently inspected during release preparation, and no additional provider, reviewer, severity, or remediation facts are inferred here. +- Publication remains protected: the finalized candidate is promoted from `development` to the exact current `main` commit, released as `v1.0.0`, and published only through protected OIDC publication with registry provenance, fresh-install, and signature verification recorded on #39. + ## [0.5.8] - 2026-08-09 ### Fixed @@ -216,4 +228,4 @@ All notable changes to this project will be documented in this file. The format ## Release policy -Miftah is experimental and pre-1.0, so incompatible changes may occur between minor versions and must be called out here. For each release, maintainers move **Unreleased** entries into a dated version section, update `package.json` and `package-lock.json` together using npm tooling, and publish a GitHub release tagged `v`. The release workflow publishes only after the tag, ancestry, tests, build, CLI smoke test, and package contents are verified. +Miftah 1.x follows Semantic Versioning for the public compatibility surfaces documented in the library, CLI, configuration, audit, MCP-management, and plugin references. Compatible fixes use patch releases, additive compatible features use minor releases, and incompatible public changes require a new major release with an explicit **Unreleased** entry and migration guidance. For each release, maintainers move **Unreleased** entries into a dated version section, update `package.json` and `package-lock.json` together using npm tooling, and publish a GitHub release tagged `v`. The release workflow publishes only after the tag, ancestry, tests, build, CLI smoke test, and package contents are verified. diff --git a/README.md b/README.md index 7a85fa65..5f533b47 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,9 @@ Claude, Cursor, or VS Code Miftah itself has no cloud service or telemetry. It adds local profile selection, credential references, policy, approvals, redaction, diagnostics, and optional audit metadata around an upstream; it does not replace that upstream or widen what the upstream supports. -> **Status:** Miftah is experimental and pre-1.0. Interfaces and security behavior may change between minor versions. External multi-account and returning-user validation in [#25](https://github.com/mohanagy/miftah/issues/25) and [#88](https://github.com/mohanagy/miftah/issues/88) remains open. +> **Status:** Miftah 1.0 is the stable v1 release line. Documented public compatibility surfaces follow Semantic Versioning. The external workflow and security-review gates were closed by maintainer attestation in [#39](https://github.com/mohanagy/miftah/issues/39); the source participant records and completed security report are not published in this repository. -Already using Miftah? See [What is in 0.5 and how to use it](docs/whats-new-in-0.5.md) for the release's guided setup, profile-management, Console, OAuth, and upgrade paths. +Upgrading from Miftah 0.5? See [What is in 0.5 and how to use it](docs/whats-new-in-0.5.md) for the guided setup, profile-management, Console, OAuth, and upgrade paths introduced before the stable line. ## Is Miftah for you? @@ -53,7 +53,7 @@ Install Miftah, then choose the terminal wizard or the browser Console. Both use ### 1. Install the current release ```bash -npm install -g @lubab/miftah@0.5.8 +npm install -g @lubab/miftah@1.0.0 miftah version ``` diff --git a/docs/cli.md b/docs/cli.md index 1d7f9672..c664addf 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -10,7 +10,7 @@ Usage: miftah [command] [options] The root command list includes `serve`, `dashboard`, `console`, `validate`, `doctor`, `schema`, `setup`, `init`, `migrate-config`, `profile list|set-default|set-description|rename|remove|test`, `connection add|list|status|test`, `auth connect|reauth|disconnect`, `list-tools`, `test-profile`, `logs`, `audit-export`, `audit-verify`, and `version`. With no command, Miftah runs `serve`. -Documented command names, options, JSON success forms, and exit categories are compatibility contracts. An incompatible CLI removal, rename, required-option change, or semantic output change requires the pre-1.0 deprecation/removal process in the [public compatibility policy](library-api.md#compatibility-policy). +Documented command names, options, JSON success forms, and exit categories are compatibility contracts. An incompatible CLI removal, rename, required-option change, or semantic output change requires a new major release and the deprecation/removal process in the [public compatibility policy](library-api.md#compatibility-policy). `--help` and `-h` print help and exit successfully. They can appear before or after a command. Help never reads configuration, resolves secrets, or starts an upstream. diff --git a/docs/config.md b/docs/config.md index 2f718383..36e195e2 100644 --- a/docs/config.md +++ b/docs/config.md @@ -20,7 +20,7 @@ Version `"2"` is the prior canonical non-OAuth format. Version `"3"` keeps its e For version 1, the migrator changes only aliases with proven equivalent behavior: `"http"` becomes `"streamable-http"`, the plaintext opt-in moves to `secrets.allowPlaintextSecrets`, and redundant force-on redaction declarations are removed. It fails closed for conflicting plaintext options or unrelated unsupported fields rather than discarding them. A version-2 input preserves the existing configuration while changing only the format version; it never infers native OAuth from a static `Authorization` header. A version-3 input is validated and reported as unchanged; `--write` then creates no backup and performs no write. -Versions 1 and 2 will remain accepted through at least the first published pre-1.0 minor release after version 3 ships. Removing either version requires a later minor release, an **Unreleased** changelog entry, and a documented explicit migration path. Keep a byte-for-byte historical fixture for every supported released format in release CI. +Versions 1, 2, and 3 remain accepted throughout the Miftah 1.x release line. Removing version 1 or 2 requires a new major release, an **Unreleased** changelog entry, and a documented explicit migration path. Keep a byte-for-byte historical fixture for every supported released format in release CI. For strict starter configurations, use the versioned `init` catalog rather than treating generic command examples as trusted upstream recommendations. The [preset and client compatibility matrix](presets-and-clients.md) records exact pins, required inputs, upstream provenance, and the validation boundary for every catalog entry. diff --git a/docs/independent-security-review.md b/docs/independent-security-review.md index 327914f9..c0276b43 100644 --- a/docs/independent-security-review.md +++ b/docs/independent-security-review.md @@ -1,13 +1,17 @@ # Independent security review brief -This brief defines the external review required by issues #37 and #39. It turns the public [threat model](threat-model.md) into a reviewable engagement without claiming that a review has happened. +This brief defines the external review required by issues #37 and #39 and records the evidence boundary for the maintainer's completion attestation. It turns the public [threat model](threat-model.md) into a reviewable engagement without inventing report details that were not supplied to the repository. ## Target and independence -The engagement baseline is the current published release, `@lubab/miftah@0.5.8`. Before work starts, the maintainer and reviewer must record the exact commit and package version under review, the upstream dependencies or fixtures used, the operating systems exercised, and the review dates. The eventual v1 release candidate must receive either a final review at its exact commit or a reviewer-accepted delta review from the recorded baseline. +The engagement baseline is the published `@lubab/miftah@0.5.8`; the stable release candidate is `@lubab/miftah@1.0.0`. The maintainer and reviewer must record the exact commit and package version under review, the upstream dependencies or fixtures used, the operating systems exercised, and the review dates. The v1 release candidate must receive either a final review at its exact commit or a reviewer-accepted delta review from the recorded baseline. The reviewer supplies an independence declaration covering employment, contribution, financial, and other material relationships with Miftah and its maintainers. A maintainer self-review, automated scanner, dependency report, or AI-only review is useful input but does not satisfy this independent gate. +## Recorded review status + +On 2026-08-11, the maintainer reported that the security report was completed and explicitly authorized closure of #37. That statement is recorded as maintainer attestation. The completed report, reviewer attribution and independence declaration, target commit, severity counts, remediation or retest record, public completion summary, and v1 candidate delta acceptance were not supplied for this release-preparation session and therefore were not independently inspected. This status does not create or infer those missing facts; #39 must retain the exact protected-release evidence and any reviewer-approved final-candidate reconciliation used for publication. + ## Review scope Review the security claims and boundaries in [`threat-model.md`](threat-model.md), [`security.md`](security.md), and the OAuth and Console threat model. At minimum, cover: diff --git a/docs/library-api.md b/docs/library-api.md index 313c4429..f3a7ca73 100644 --- a/docs/library-api.md +++ b/docs/library-api.md @@ -31,7 +31,7 @@ The configuration contract exposes `ActiveProfileStateScope`, `AuditConfig`, `Au `MiftahConfigVersion` is the union of format versions accepted by this installed release. `CURRENT_CONFIG_VERSION` is the version generated by presets; it does not cause `loadConfig` to rewrite a legacy file. Use the explicit [configuration migration command](cli.md#migrate-config) when an on-disk upgrade is intended. -`MiftahConfig` is a version-discriminated union. A `version: "1"` value retains the documented compatibility aliases; `version: "2"` accepts the canonical static-credential surface; and `version: "3"` adds opaque `OAuthConfig` bindings. Version 3 contains no token, refresh-token, client-secret, or callback fields; an exact OAuth binding enables the internal standards-compatible remote Streamable HTTP authorization runtime. This intentional pre-1.0 type-surface change means application-side composition must use an intersection such as `type AppConfig = MiftahConfig & { readonly appMetadata: AppMetadata }`, rather than `interface AppConfig extends MiftahConfig`; strip application-only metadata before strict Miftah config validation. +`MiftahConfig` is a version-discriminated union. A `version: "1"` value retains the documented compatibility aliases; `version: "2"` accepts the canonical static-credential surface; and `version: "3"` adds opaque `OAuthConfig` bindings. Version 3 contains no token, refresh-token, client-secret, or callback fields; an exact OAuth binding enables the internal standards-compatible remote Streamable HTTP authorization runtime. The pre-1.0 version-3 type-surface change means application-side composition must use an intersection such as `type AppConfig = MiftahConfig & { readonly appMetadata: AppMetadata }`, rather than `interface AppConfig extends MiftahConfig`; strip application-only metadata before strict Miftah config validation. `AuditRotationConfig` requires `retainFiles` (maximum `2000`) plus at least one positive trigger (`maxBytes` or `maxAgeMs`). `AuditIntegrityConfig` currently exposes the explicit local `"sha256-chain"` option only. Both configure the runtime journal; journal writers, readers, and CLI export/verification implementations remain internal. @@ -55,13 +55,13 @@ Programmatic diagnostics expose `ConfigDiagnostic`, `MiftahErrorCode`, and `Mift ## Compatibility policy -Miftah is pre-1.0. The following are public compatibility surfaces. Additive behavior may ship in a patch release when it preserves existing callers; a removal, rename, semantic reinterpretation, or incompatible output change requires a minor release and an explicit **Unreleased** changelog entry. +Starting with Miftah 1.0, these public surfaces follow Semantic Versioning. Compatible fixes may ship in a patch release, and additive compatible behavior may ship in a minor release. A removal, rename, semantic reinterpretation, or incompatible output change requires a new major release, an explicit **Unreleased** changelog entry, and migration guidance. A security correction may remove unsafe behavior without preserving an exploitable contract, but its impact and safe replacement must be documented. | Surface | Contract | | --- | --- | | Configuration formats | `MiftahConfigVersion` and `CURRENT_CONFIG_VERSION` describe the installed release. Supported historical formats remain loadable for their documented window; upgrades are explicit through `miftah migrate-config`, never an implicit load-time rewrite. | | CLI | Documented command names, flags, JSON success shapes, and exit categories are public. A deprecated form remains available through the announced window and gets an actionable replacement. | -| MCP management namespace | `miftah_*` management tool names and multi-upstream `__`, resource, and prompt namespaces are public client-facing identifiers. Renaming or changing their routing meaning follows the minor-release/remediation rule. | +| MCP management namespace | `miftah_*` management tool names and multi-upstream `__`, resource, and prompt namespaces are public client-facing identifiers. Renaming or changing their routing meaning follows the major-release/remediation rule. | | Audit JSONL | Persisted records carry an immutable schema version. Existing schema versions remain readable for their announced window; incompatible record changes need a documented reader/export migration path. | | Package root | The documented runtime and type exports on this page are public; internal deep imports are not. | | Plugin subpath | `@lubab/miftah/plugin-api` is an ABI-versioned authoring surface. A new incompatible ABI uses a new `apiVersion`; it does not silently reinterpret an existing one. | diff --git a/docs/oauth-console-validation.md b/docs/oauth-console-validation.md index 4e80aa60..4674e9db 100644 --- a/docs/oauth-console-validation.md +++ b/docs/oauth-console-validation.md @@ -1,6 +1,6 @@ # OAuth and Console validation -This page records what Miftah's release gate proves for native remote OAuth and the optional local Console, what it deliberately does not prove, and which external evidence is still missing. It is an evidence record, not a claim that every OAuth provider is supported. +This page records what Miftah's release gate proves for native remote OAuth and the optional local Console, what it deliberately does not prove, and how the external-evidence status was accepted. It is an evidence record, not a claim that every OAuth provider is supported. ## Automated compatibility gate @@ -37,15 +37,15 @@ For provider-adapter-backed or upstream-owned OAuth, follow the provider's own r ## Release status and limitations -OAuth and Console are being validated for a pre-v1 feature release. Passing this automated gate is required release evidence, but it is not v1.0 readiness and does not close the demand or external-validation gates by itself. The current support classes and manual fallbacks remain defined in the [OAuth support matrix](oauth-support.md#support-matrix). +OAuth and Console are included in the stable v1 release. The automated gate remains required evidence, but it does not prove live-provider behavior, external adoption, or account intent by itself. The current support classes and manual fallbacks remain defined in the [OAuth support matrix](oauth-support.md#support-matrix). ## External design-partner evidence -Snapshot date: 2026-08-11. Evaluator target: `@lubab/miftah@0.5.8`. +Snapshot date: 2026-08-11. Evaluator baseline: `@lubab/miftah@0.5.8`. Stable release candidate: `@lubab/miftah@1.0.0`. - Interested external users: 5 -- Recorded completed external workflows: 0 -- Recorded returning external users: 0 -- Recorded unaided README evaluators: 0 +- Recorded completed external workflows: 5 +- Recorded returning external users: 3 +- Recorded unaided README evaluators: 3 -The external design-partner gate remains open. Use the [v1 external evaluation](v1-evaluation.md) protocol to define a completed real workflow, a later-session return, unaided participation, version pinning, and the deidentified public record. Never record credentials, OAuth codes, tokens, provider payloads, or personal account identifiers. +These counts are a maintainer attestation recorded on [#39](https://github.com/mohanagy/miftah/issues/39), not independently inspected participant evidence. The private participant records and public deidentified row-level rollup were not supplied during release preparation, so this page does not infer provider coverage, dates, clients, operating systems, or participant-specific outcomes beyond the three counters above. The [v1 external evaluation](v1-evaluation.md) protocol remains the definition of a completed real workflow, later-session return, unaided participation, version pinning, and safe deidentified record. Never record credentials, OAuth codes, tokens, provider payloads, or personal account identifiers. diff --git a/docs/plugins.md b/docs/plugins.md index e64d86c3..1b401834 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -49,7 +49,7 @@ Miftah starts a contained local host process to inspect the manifest before it c `@lubab/miftah/plugin-api` version `"1"` is a frozen authoring ABI: Miftah does not change the request/response meaning, manifest fields, or plugin-kind semantics under that same version. A future incompatible extension must introduce a new `apiVersion` and package API surface; it must not be accepted as version `"1"` by the host. -An accepted plugin ABI remains supported through at least the first published pre-1.0 minor release after its successor ships. Removal requires a later minor release, an **Unreleased** changelog entry, and a migration guide that names the replacement ABI. The host rejects an unsupported ABI during preflight with `PLUGIN_API_INCOMPATIBLE`, before it serves MCP traffic. The package-root [compatibility policy](library-api.md#compatibility-policy) separately covers the stable subpath and management-tool names. +Plugin ABI version `"1"` remains supported throughout the Miftah 1.x release line. Removal requires a new major release, an **Unreleased** changelog entry, and a migration guide that names the replacement ABI. The host rejects an unsupported ABI during preflight with `PLUGIN_API_INCOMPATIBLE`, before it serves MCP traffic. The package-root [compatibility policy](library-api.md#compatibility-policy) separately covers the stable subpath and management-tool names. Each invocation uses a fresh contained host process with a scrubbed environment, argument arrays, no shell, bounded input/output, a timeout, and cancellation. On Windows it uses the existing kill-on-close Job Object path. A secret provider receives only `{ reference }`; it does not receive resolved configuration values, redaction controls, or other secret references. Its successful value is immediately registered with Miftah's redactor. diff --git a/docs/presets-and-clients.md b/docs/presets-and-clients.md index d3d4325e..e11f7dcb 100644 --- a/docs/presets-and-clients.md +++ b/docs/presets-and-clients.md @@ -3,7 +3,7 @@ This is the compatibility source of truth for generated `miftah init` configurations and client snippets. - Catalog version: `3` -- Miftah package version: `0.5.8` +- Miftah package version: `1.0.0` - Last tested / validation boundary: the catalog builds strict Miftah configuration that `validateConfig` accepts. The docs contract test checks generated configuration only; it does **not** construct a runtime, start, authenticate to, or smoke-test external providers. Miftah itself requires Node.js `>=20`. That does not establish an upstream server's Node requirement. diff --git a/docs/threat-model.md b/docs/threat-model.md index 1aafe84a..01cdc4b2 100644 --- a/docs/threat-model.md +++ b/docs/threat-model.md @@ -1,6 +1,6 @@ # Threat model -> **Status:** Maintainer-authored model for the current development branch. It is not an independent security assessment. The independent review tracked by [#37](https://github.com/mohanagy/miftah/issues/37) has not yet been commissioned; see [Independent review status](#independent-review-status). +> **Status:** Maintainer-authored model for the current development branch. It is not an independent security assessment. The maintainer reports that the review tracked by [#37](https://github.com/mohanagy/miftah/issues/37) is complete; the report was not independently inspected during release preparation. See [Independent review status](#independent-review-status). Miftah is an MCP-aware credential broker. This document makes the security boundaries behind its defaults explicit: what is protected, who crosses each boundary, which controls are implemented, and which risks remain. It complements the operational [security model](security.md), implementation [architecture](architecture.md), and [security reporting policy with a private reporting channel](../SECURITY.md). @@ -125,9 +125,9 @@ These are design boundaries, not permission to ignore them. Use separate OS iden ## Independent review status -**Current project status (2026-08-11): not yet commissioned.** The [independent security review brief](independent-security-review.md) defines the target, independence, scope, deliverables, disclosure path, and closure gate. This document does not claim an independent review, an external finding count, or remediation of findings that have not been reported. The maintainer-authored controls above are implementation statements, not a substitute for external assurance. +**Current project status (2026-08-11): completed by maintainer attestation.** The [independent security review brief](independent-security-review.md) defines the target, independence, scope, deliverables, disclosure path, and closure gate. The completed report, reviewer attribution, severity counts, remediation evidence, and final-candidate delta acceptance were not independently inspected during release preparation. This document therefore records the maintainer's status without claiming report facts that were not provided; the maintainer-authored controls above remain implementation statements, not a substitute for external assurance. -The planned independent review scope is the security-critical implementation and its tests: configuration/schema parsing; secret resolution and redaction; child-process and Windows Job Object containment; profile/runtime and container isolation; local HTTP ingress/session handling; routing, policy, approval, and identity boundaries; audit confidentiality/integrity; local plugins and dependency/supply-chain controls; and denial-of-service/capacity behavior. Reviewers should test negative paths and trust-boundary crossings, not only happy-path configuration. +The defined independent review scope is the security-critical implementation and its tests: configuration/schema parsing; secret resolution and redaction; child-process and Windows Job Object containment; profile/runtime and container isolation; local HTTP ingress/session handling; routing, policy, approval, and identity boundaries; audit confidentiality/integrity; local plugins and dependency/supply-chain controls; and denial-of-service/capacity behavior. Reviewers should test negative paths and trust-boundary crossings, not only happy-path configuration. The release target in [#37](https://github.com/mohanagy/miftah/issues/37) is to publish the review completion and a high-level remediation status before `1.0`, without publishing proof-of-concept details prematurely. Any critical or high finding must be remediated or have an explicit release-blocking decision; no unresolved critical/high finding may remain at release. Vulnerability disclosure timing follows the [security policy](../SECURITY.md). diff --git a/docs/v1-evaluation.md b/docs/v1-evaluation.md index d73b1da3..ab9f3b71 100644 --- a/docs/v1-evaluation.md +++ b/docs/v1-evaluation.md @@ -2,9 +2,9 @@ This protocol turns external Miftah use into comparable, privacy-safe evidence for issues #25, #88, #202, and #290. It is the shared evidence path for the product wedge, OAuth and Console validation, first-use product contract, and README redesign. -The current evaluator target is the published `@lubab/miftah@0.5.8`. Record the exact package version, upstream MCP version or immutable image reference, client, operating system, provider class, and authentication owner for every attempt. If the target changes, do not combine results until the participant repeats the affected steps on the new target. +Evaluator baseline: `@lubab/miftah@0.5.8`. Stable release candidate: `@lubab/miftah@1.0.0`. Record the exact package version, upstream MCP version or immutable image reference, client, operating system, provider class, and authentication owner for every attempt. If the target changes, do not combine results until the participant repeats the affected steps or an explicitly documented delta assessment establishes why the result remains applicable. -This document is a protocol, not completed evidence. The gates remain open until the deidentified results are linked from the relevant GitHub issues. +This document is the evidence protocol, not participant-level completed evidence. On 2026-08-11, the maintainer reported 5 completed workflows, 3 later returns, and 3 unaided evaluators and authorized closure of the related issues. That status is a maintainer attestation; the underlying participant records were not independently inspected during release preparation, and the pending public-rollup rows below must not be presented as completed records. ## Closure gates @@ -135,4 +135,4 @@ Map the final evidence explicitly: - issue #290: three unaided participants achieve the README's safe first-use contract; - issue #39: at least three real providers are represented, the independent security review is closed, and the final v1 target is reconciled under the [independent review brief](independent-security-review.md); provider evidence alone cannot close this release gate. -Failed attempts are learning, not completion. Keep every issue open until its own acceptance criteria are supported by linked evidence. +Failed attempts are learning, not completion. Future evidence updates should replace pending rows only with consented deidentified records and should not infer participant details from the maintainer-level counters. diff --git a/docs/whats-new-in-0.5.md b/docs/whats-new-in-0.5.md index 23a7a571..a484f2f4 100644 --- a/docs/whats-new-in-0.5.md +++ b/docs/whats-new-in-0.5.md @@ -1,13 +1,13 @@ # What is in Miftah 0.5 -Install `@lubab/miftah@0.5.8` when you want Miftah to guide setup instead of assembling a multi-account configuration by hand: +Install `@lubab/miftah@1.0.0`, the current stable release, to use the guided setup and account-management capabilities introduced in 0.5 instead of assembling a multi-account configuration by hand: ```bash -npm install -g @lubab/miftah@0.5.8 +npm install -g @lubab/miftah@1.0.0 miftah version ``` -The short version of 0.5.0 compared with 0.4.0 is: Miftah now has guided and resumable setup, safer setup previews, account-profile maintenance commands, client-entry import, and an implemented multi-account Google Search Console onboarding path, with external validation still in progress. +The short version of 0.5.0 compared with 0.4.0 is: Miftah added guided and resumable setup, safer setup previews, account-profile maintenance commands, client-entry import, and an implemented multi-account Google Search Console onboarding path, with external validation still in progress at the time. Native OAuth and the optional Console first shipped in 0.4.0. 0.5.0 makes them easier to discover, configure, and maintain; it does not introduce universal OAuth support or a hosted Miftah service. @@ -162,8 +162,8 @@ If your configuration is still v1 or v2, use the dry-run-first migration path in ## What remains intentionally incomplete -- External multi-account and returning-user validation is still open in [#25](https://github.com/mohanagy/miftah/issues/25) and [#88](https://github.com/mohanagy/miftah/issues/88). -- Miftah is experimental and pre-1.0; minor releases can contain documented incompatible changes. +- External multi-account and returning-user validation was still open during 0.5 in [#25](https://github.com/mohanagy/miftah/issues/25) and [#88](https://github.com/mohanagy/miftah/issues/88), and was later closed by maintainer attestation in [#39](https://github.com/mohanagy/miftah/issues/39). The underlying participant records are not published in this repository. +- The 0.5 series described by this historical guide was experimental and pre-1.0. The current stable compatibility contract is documented in the [library API policy](library-api.md#compatibility-policy). - Native OAuth is deliberately narrow. Provider-specific and local OAuth often remains upstream-owned. - Miftah cannot prove an account identity unless the selected upstream exposes stable, bounded identity evidence. - Generated client snippets are manual handoff artifacts. Miftah does not silently edit client settings or replace a running MCP session. diff --git a/package-lock.json b/package-lock.json index c1b1b0e8..9fa134e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@lubab/miftah", - "version": "0.5.8", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@lubab/miftah", - "version": "0.5.8", + "version": "1.0.0", "license": "MIT", "dependencies": { "@modelcontextprotocol/sdk": "^1.30.0", @@ -2040,19 +2040,6 @@ "url": "https://opencollective.com/express" } }, - "node_modules/brace-expansion": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.8.tgz", - "integrity": "sha512-JZyDyq3D4AUifKTPOB7DELf6XsB3WdPuNxCtob1vFXPsSXhdAiHBWJ/tJ8HAc9aH84BK+5JFZLNkJKx3G9kzQg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^4.0.2" - }, - "engines": { - "node": "20 || >=22" - } - }, "node_modules/bundle-require": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-5.1.0.tgz", @@ -2751,9 +2738,9 @@ "license": "MIT" }, "node_modules/fast-uri": { - "version": "3.1.4", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.4.tgz", - "integrity": "sha512-8JnbkQ4juDyvYs4mgFGQqg4yCYtFDtUtmp2QIQq11ZZe5CFQ5wcqm1rqDgAh/QdMySuBnPzMUiJUNZG5N/AiQw==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.5.tgz", + "integrity": "sha512-gHwA1O9LDIcKunMKhObS/HimwtehO1nPUECKAu5TpKgaO19fcWEl4bliWe1jWxVFvIXztJjjQ4L8XQ1EU9f7Jw==", "funding": [ { "type": "github", @@ -3025,9 +3012,9 @@ } }, "node_modules/hono": { - "version": "4.12.28", - "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.28.tgz", - "integrity": "sha512-YwUvVpSF7m1yOblFPrU3Hbo8XhPheBoiyfGuII6z19LnOr6JpDnyyp7LFNrfV56wS8tpvtBFGRISHN02pDdLOA==", + "version": "4.12.34", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.34.tgz", + "integrity": "sha512-GqXJqY/xJkJmuloTrnV1ZEXG3fqte+VjkUqoRNZXcrUidiUOP4fMSIHHY4tsqZBK++kVyWmt/AAfSUuy57/eSA==", "license": "MIT", "engines": { "node": ">=16.9.0" @@ -3103,9 +3090,9 @@ "license": "ISC" }, "node_modules/ip-address": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.2.0.tgz", - "integrity": "sha512-/+S6j4E9AHvW9SWMSEY9Xfy66O5PWvVEJ08O0y5JGyEKQpojb0K0GKpz/v5HJ/G0vi3D2sjGK78119oXZeE0qA==", + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.3.1.tgz", + "integrity": "sha512-1e9d3kb97NHJTIJDZW9rKqW2h6+dFa50Dy0fpPSMQp2ADje5gvKsXmdiK6dwY5t76TaTt5+P5N1Y/LoToIxP6g==", "license": "MIT", "engines": { "node": ">= 12" @@ -3457,6 +3444,19 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/minimatch/node_modules/brace-expansion": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", + "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, "node_modules/minipass": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", @@ -3499,9 +3499,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.16", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz", - "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==", + "version": "3.3.17", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.17.tgz", + "integrity": "sha512-xQLf0A3HOMlgHq0n247/LRuAOYmB7dXJ/DvAxGvsSBij45XtBSmQycu+F8ODbHwns/XyFZagyL1+J0Offw1E0g==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index 0954a469..f08967fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lubab/miftah", - "version": "0.5.8", + "version": "1.0.0", "description": "Wrap any MCP. Use the right account without reconnecting.", "keywords": [ "mcp", @@ -86,23 +86,28 @@ "glob": { ".": "13.0.6", "minimatch": { - "brace-expansion": "5.0.8" + "brace-expansion": "5.0.9" } }, "minimatch": { - "brace-expansion": "5.0.8" + "brace-expansion": "5.0.9" } } }, + "brace-expansion": "5.0.9", "esbuild": "0.28.1", "eslint": { "minimatch": { - "brace-expansion": "5.0.8" + "brace-expansion": "5.0.9" } }, + "fast-uri": "3.1.5", + "hono": "4.12.34", + "ip-address": "10.3.1", + "nanoid": "3.3.17", "typescript-eslint": { "minimatch": { - "brace-expansion": "5.0.8" + "brace-expansion": "5.0.9" } }, "vitest": { diff --git a/tests/fixtures/fake-upstream-bundled.mjs b/tests/fixtures/fake-upstream-bundled.mjs index 3f0f3647..3b9d110b 100644 --- a/tests/fixtures/fake-upstream-bundled.mjs +++ b/tests/fixtures/fake-upstream-bundled.mjs @@ -1,13 +1,13 @@ -var dh=Object.create;var Zn=Object.defineProperty;var fh=Object.getOwnPropertyDescriptor;var mh=Object.getOwnPropertyNames;var hh=Object.getPrototypeOf,_h=Object.prototype.hasOwnProperty;var S=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},sc=(t,e)=>{for(var r in e)Zn(t,r,{get:e[r],enumerable:!0})},gh=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of mh(e))!_h.call(t,n)&&n!==r&&Zn(t,n,{get:()=>e[n],enumerable:!(o=fh(e,n))||o.enumerable});return t};var ic=(t,e,r)=>(r=t!=null?dh(hh(t)):{},gh(e||!t||!t.__esModule?Zn(r,"default",{value:t,enumerable:!0}):r,t));var Rr=S(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.regexpCode=q.getEsmExportName=q.getProperty=q.safeStringify=q.stringify=q.strConcat=q.addCodeArg=q.str=q._=q.nil=q._Code=q.Name=q.IDENTIFIER=q._CodeOrName=void 0;var kr=class{};q._CodeOrName=kr;q.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var gt=class extends kr{constructor(e){if(super(),!q.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};q.Name=gt;var Ie=class extends kr{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof gt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};q._Code=Ie;q.nil=new Ie("");function kp(t,...e){let r=[t[0]],o=0;for(;o{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.ValueScope=Te.ValueScopeName=Te.Scope=Te.varKinds=Te.UsedValueState=void 0;var be=Rr(),ei=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Do;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Do||(Te.UsedValueState=Do={}));Te.varKinds={const:new be.Name("const"),let:new be.Name("let"),var:new be.Name("var")};var Mo=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof be.Name?e:this.name(e)}name(e){return new be.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Te.Scope=Mo;var qo=class extends be.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,be._)`.${new be.Name(r)}[${o}]`}};Te.ValueScopeName=qo;var zy=(0,be._)`\n`,ti=class extends Mo{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?zy:be.nil}}get(){return this._scope}name(e){return new qo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,be._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=be.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Do.Started);let l=r(u);if(l){let p=this.opts.es5?Te.varKinds.var:Te.varKinds.const;s=(0,be._)`${s}${p} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,be._)`${s}${l}${this.opts._n}`;else throw new ei(u);c.set(u,Do.Completed)})}return s}};Te.ValueScope=ti});var O=S(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.or=N.and=N.not=N.CodeGen=N.operators=N.varKinds=N.ValueScopeName=N.ValueScope=N.Scope=N.Name=N.regexpCode=N.stringify=N.getProperty=N.nil=N.strConcat=N.str=N._=void 0;var Z=Rr(),je=ri(),it=Rr();Object.defineProperty(N,"_",{enumerable:!0,get:function(){return it._}});Object.defineProperty(N,"str",{enumerable:!0,get:function(){return it.str}});Object.defineProperty(N,"strConcat",{enumerable:!0,get:function(){return it.strConcat}});Object.defineProperty(N,"nil",{enumerable:!0,get:function(){return it.nil}});Object.defineProperty(N,"getProperty",{enumerable:!0,get:function(){return it.getProperty}});Object.defineProperty(N,"stringify",{enumerable:!0,get:function(){return it.stringify}});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:function(){return it.regexpCode}});Object.defineProperty(N,"Name",{enumerable:!0,get:function(){return it.Name}});var Vo=ri();Object.defineProperty(N,"Scope",{enumerable:!0,get:function(){return Vo.Scope}});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:function(){return Vo.ValueScope}});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:function(){return Vo.ValueScopeName}});Object.defineProperty(N,"varKinds",{enumerable:!0,get:function(){return Vo.varKinds}});N.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};var Xe=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},oi=class extends Xe{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?je.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Dt(this.rhs,e,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},Lo=class extends Xe{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Z.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Dt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return Fo(e,this.rhs)}},ni=class extends Lo{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},si=class extends Xe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},ii=class extends Xe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},ai=class extends Xe{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},ci=class extends Xe{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Dt(this.code,e,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},Ir=class extends Xe{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Ey(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>$t(e,r.names),{})}},Qe=class extends Ir{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},ui=class extends Ir{},Zt=class extends Qe{};Zt.kind="else";var yt=class t extends Qe{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new Zt(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Rp(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Dt(this.condition,e,r),this}get names(){let e=super.names;return Fo(e,this.condition),this.else&&$t(e,this.else.names),e}};yt.kind="if";var vt=class extends Qe{};vt.kind="for";var li=class extends vt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Dt(this.iteration,e,r),this}get names(){return $t(super.names,this.iteration.names)}},pi=class extends vt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?je.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=Fo(super.names,this.from);return Fo(e,this.to)}},Uo=class extends vt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Dt(this.iterable,e,r),this}get names(){return $t(super.names,this.iterable.names)}},Or=class extends Qe{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Or.kind="func";var Nr=class extends Ir{render(e){return"return "+super.render(e)}};Nr.kind="return";var di=class extends Qe{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&$t(e,this.catch.names),this.finally&&$t(e,this.finally.names),e}},Ar=class extends Qe{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Ar.kind="catch";var Cr=class extends Qe{render(e){return"finally"+super.render(e)}};Cr.kind="finally";var fi=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?` -`:""},this._extScope=e,this._scope=new je.Scope({parent:e}),this._nodes=[new ui]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new oi(e,s,o)),s}const(e,r,o){return this._def(je.varKinds.const,e,r,o)}let(e,r,o){return this._def(je.varKinds.let,e,r,o)}var(e,r,o){return this._def(je.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new Lo(e,r,o))}add(e,r){return this._leafNode(new ni(e,N.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Z.nil&&this._leafNode(new ci(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,Z.addCodeArg)(r,n));return r.push("}"),new Z._Code(r)}if(e,r,o){if(this._blockNode(new yt(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new yt(e))}else(){return this._elseNode(new Zt)}endIf(){return this._endBlockNode(yt,Zt)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new li(e),r)}forRange(e,r,o,n,s=this.opts.es5?je.varKinds.var:je.varKinds.let){let i=this._scope.toName(e);return this._for(new pi(s,i,r,o),()=>n(i))}forOf(e,r,o,n=je.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof Z.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Z._)`${i}.length`,a=>{this.var(s,(0,Z._)`${i}[${a}]`),o(s)})}return this._for(new Uo("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?je.varKinds.var:je.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Z._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new Uo("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(vt)}label(e){return this._leafNode(new si(e))}break(e){return this._leafNode(new ii(e))}return(e){let r=new Nr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Nr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new di;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new Ar(s),r(s)}return o&&(this._currNode=n.finally=new Cr,this.code(o)),this._endBlockNode(Ar,Cr)}throw(e){return this._leafNode(new ai(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Z.nil,o,n){return this._blockNode(new Or(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Or)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof yt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};N.CodeGen=fi;function $t(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Fo(t,e){return e instanceof Z._CodeOrName?$t(t,e.names):t}function Dt(t,e,r){if(t instanceof Z.Name)return o(t);if(!n(t))return t;return new Z._Code(t._items.reduce((s,i)=>(i instanceof Z.Name&&(i=o(i)),i instanceof Z._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof Z._Code&&s._items.some(i=>i instanceof Z.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Ey(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Rp(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Z._)`!${mi(t)}`}N.not=Rp;var ky=Ip(N.operators.AND);function Py(...t){return t.reduce(ky)}N.and=Py;var Ry=Ip(N.operators.OR);function Iy(...t){return t.reduce(Ry)}N.or=Iy;function Ip(t){return(e,r)=>e===Z.nil?r:r===Z.nil?e:(0,Z._)`${mi(e)} ${t} ${mi(r)}`}function mi(t){return t instanceof Z.Name?t:(0,Z._)`(${t})`}});var D=S(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.checkStrictMode=A.getErrorPath=A.Type=A.useFunc=A.setEvaluated=A.evaluatedPropsToName=A.mergeEvaluated=A.eachItem=A.unescapeJsonPointer=A.escapeJsonPointer=A.escapeFragment=A.unescapeFragment=A.schemaRefOrVal=A.schemaHasRulesButRef=A.schemaHasRules=A.checkUnknownRules=A.alwaysValidSchema=A.toHash=void 0;var V=O(),Oy=Rr();function Ny(t){let e={};for(let r of t)e[r]=!0;return e}A.toHash=Ny;function Ay(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Ap(t,e),!Cp(e,t.self.RULES.all))}A.alwaysValidSchema=Ay;function Ap(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||Dp(t,`unknown keyword: "${s}"`)}A.checkUnknownRules=Ap;function Cp(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}A.schemaHasRules=Cp;function Cy(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}A.schemaHasRulesButRef=Cy;function jy({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,V._)`${r}`}return(0,V._)`${t}${e}${(0,V.getProperty)(o)}`}A.schemaRefOrVal=jy;function Zy(t){return jp(decodeURIComponent(t))}A.unescapeFragment=Zy;function Dy(t){return encodeURIComponent(_i(t))}A.escapeFragment=Dy;function _i(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}A.escapeJsonPointer=_i;function jp(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}A.unescapeJsonPointer=jp;function My(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}A.eachItem=My;function Op({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof V.Name?(s instanceof V.Name?t(n,s,i):e(n,s,i),i):s instanceof V.Name?(e(n,i,s),s):r(s,i);return a===V.Name&&!(c instanceof V.Name)?o(n,c):c}}A.mergeEvaluated={props:Op({mergeNames:(t,e,r)=>t.if((0,V._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,V._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,V._)`${r} || {}`).code((0,V._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,V._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,V._)`${r} || {}`),gi(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Zp}),items:Op({mergeNames:(t,e,r)=>t.if((0,V._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,V._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,V._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,V._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Zp(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,V._)`{}`);return e!==void 0&&gi(t,r,e),r}A.evaluatedPropsToName=Zp;function gi(t,e,r){Object.keys(r).forEach(o=>t.assign((0,V._)`${e}${(0,V.getProperty)(o)}`,!0))}A.setEvaluated=gi;var Np={};function qy(t,e){return t.scopeValue("func",{ref:e,code:Np[e.code]||(Np[e.code]=new Oy._Code(e.code))})}A.useFunc=qy;var hi;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(hi||(A.Type=hi={}));function Ly(t,e,r){if(t instanceof V.Name){let o=e===hi.Num;return r?o?(0,V._)`"[" + ${t} + "]"`:(0,V._)`"['" + ${t} + "']"`:o?(0,V._)`"/" + ${t}`:(0,V._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,V.getProperty)(t).toString():"/"+_i(t)}A.getErrorPath=Ly;function Dp(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}A.checkStrictMode=Dp});var et=S(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});var me=O(),Uy={data:new me.Name("data"),valCxt:new me.Name("valCxt"),instancePath:new me.Name("instancePath"),parentData:new me.Name("parentData"),parentDataProperty:new me.Name("parentDataProperty"),rootData:new me.Name("rootData"),dynamicAnchors:new me.Name("dynamicAnchors"),vErrors:new me.Name("vErrors"),errors:new me.Name("errors"),this:new me.Name("this"),self:new me.Name("self"),scope:new me.Name("scope"),json:new me.Name("json"),jsonPos:new me.Name("jsonPos"),jsonLen:new me.Name("jsonLen"),jsonPart:new me.Name("jsonPart")};yi.default=Uy});var jr=S(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.extendErrors=he.resetErrorsCount=he.reportExtraError=he.reportError=he.keyword$DataError=he.keywordError=void 0;var M=O(),Ho=D(),ve=et();he.keywordError={message:({keyword:t})=>(0,M.str)`must pass "${t}" keyword validation`};he.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,M.str)`"${t}" keyword must be ${e} ($data)`:(0,M.str)`"${t}" keyword is invalid ($data)`};function Fy(t,e=he.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=Lp(t,e,r);o??(i||a)?Mp(s,c):qp(n,(0,M._)`[${c}]`)}he.reportError=Fy;function Vy(t,e=he.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=Lp(t,e,r);Mp(n,a),s||i||qp(o,ve.default.vErrors)}he.reportExtraError=Vy;function Hy(t,e){t.assign(ve.default.errors,e),t.if((0,M._)`${ve.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,M._)`${ve.default.vErrors}.length`,e),()=>t.assign(ve.default.vErrors,null)))}he.resetErrorsCount=Hy;function Ky({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ve.default.errors,a=>{t.const(i,(0,M._)`${ve.default.vErrors}[${a}]`),t.if((0,M._)`${i}.instancePath === undefined`,()=>t.assign((0,M._)`${i}.instancePath`,(0,M.strConcat)(ve.default.instancePath,s.errorPath))),t.assign((0,M._)`${i}.schemaPath`,(0,M.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,M._)`${i}.schema`,r),t.assign((0,M._)`${i}.data`,o))})}he.extendErrors=Ky;function Mp(t,e){let r=t.const("err",e);t.if((0,M._)`${ve.default.vErrors} === null`,()=>t.assign(ve.default.vErrors,(0,M._)`[${r}]`),(0,M._)`${ve.default.vErrors}.push(${r})`),t.code((0,M._)`${ve.default.errors}++`)}function qp(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,M._)`new ${t.ValidationError}(${e})`):(r.assign((0,M._)`${o}.errors`,e),r.return(!1))}var St={keyword:new M.Name("keyword"),schemaPath:new M.Name("schemaPath"),params:new M.Name("params"),propertyName:new M.Name("propertyName"),message:new M.Name("message"),schema:new M.Name("schema"),parentSchema:new M.Name("parentSchema")};function Lp(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,M._)`{}`:Gy(t,e,r)}function Gy(t,e,r={}){let{gen:o,it:n}=t,s=[By(n,r),Jy(t,r)];return Wy(t,e,s),o.object(...s)}function By({errorPath:t},{instancePath:e}){let r=e?(0,M.str)`${t}${(0,Ho.getErrorPath)(e,Ho.Type.Str)}`:t;return[ve.default.instancePath,(0,M.strConcat)(ve.default.instancePath,r)]}function Jy({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,M.str)`${e}/${t}`;return r&&(n=(0,M.str)`${n}${(0,Ho.getErrorPath)(r,Ho.Type.Str)}`),[St.schemaPath,n]}function Wy(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:p}=a;o.push([St.keyword,n],[St.params,typeof e=="function"?e(t):e||(0,M._)`{}`]),c.messages&&o.push([St.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([St.schema,i],[St.parentSchema,(0,M._)`${l}${p}`],[ve.default.data,s]),u&&o.push([St.propertyName,u])}});var Fp=S(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.boolOrEmptySchema=Mt.topBoolOrEmptySchema=void 0;var Yy=jr(),Xy=O(),Qy=et(),ev={message:"boolean schema is false"};function tv(t){let{gen:e,schema:r,validateName:o}=t;r===!1?Up(t,!1):typeof r=="object"&&r.$async===!0?e.return(Qy.default.data):(e.assign((0,Xy._)`${o}.errors`,null),e.return(!0))}Mt.topBoolOrEmptySchema=tv;function rv(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),Up(t)):r.var(e,!0)}Mt.boolOrEmptySchema=rv;function Up(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Yy.reportError)(n,ev,void 0,e)}});var vi=S(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.getRules=qt.isJSONType=void 0;var ov=["string","number","integer","boolean","null","object","array"],nv=new Set(ov);function sv(t){return typeof t=="string"&&nv.has(t)}qt.isJSONType=sv;function iv(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}qt.getRules=iv});var $i=S(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.shouldUseRule=at.shouldUseGroup=at.schemaHasRulesForType=void 0;function av({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&Vp(t,o)}at.schemaHasRulesForType=av;function Vp(t,e){return e.rules.some(r=>Hp(t,r))}at.shouldUseGroup=Vp;function Hp(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}at.shouldUseRule=Hp});var Zr=S(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.reportTypeError=_e.checkDataTypes=_e.checkDataType=_e.coerceAndCheckDataType=_e.getJSONTypes=_e.getSchemaTypes=_e.DataType=void 0;var cv=vi(),uv=$i(),lv=jr(),I=O(),Kp=D(),Lt;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Lt||(_e.DataType=Lt={}));function pv(t){let e=Gp(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}_e.getSchemaTypes=pv;function Gp(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(cv.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}_e.getJSONTypes=Gp;function dv(t,e){let{gen:r,data:o,opts:n}=t,s=fv(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,uv.schemaHasRulesForType)(t,e[0]));if(i){let a=bi(e,o,n.strictNumbers,Lt.Wrong);r.if(a,()=>{s.length?mv(t,e,s):Ti(t)})}return i}_e.coerceAndCheckDataType=dv;var Bp=new Set(["string","number","integer","boolean","null"]);function fv(t,e){return e?t.filter(r=>Bp.has(r)||e==="array"&&r==="array"):[]}function mv(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,I._)`typeof ${n}`),a=o.let("coerced",(0,I._)`undefined`);s.coerceTypes==="array"&&o.if((0,I._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,I._)`${n}[0]`).assign(i,(0,I._)`typeof ${n}`).if(bi(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,I._)`${a} !== undefined`);for(let u of r)(Bp.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Ti(t),o.endIf(),o.if((0,I._)`${a} !== undefined`,()=>{o.assign(n,a),hv(t,a)});function c(u){switch(u){case"string":o.elseIf((0,I._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,I._)`"" + ${n}`).elseIf((0,I._)`${n} === null`).assign(a,(0,I._)`""`);return;case"number":o.elseIf((0,I._)`${i} == "boolean" || ${n} === null +var dh=Object.create;var Dn=Object.defineProperty;var fh=Object.getOwnPropertyDescriptor;var mh=Object.getOwnPropertyNames;var hh=Object.getPrototypeOf,_h=Object.prototype.hasOwnProperty;var S=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},ic=(t,e)=>{for(var r in e)Dn(t,r,{get:e[r],enumerable:!0})},gh=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of mh(e))!_h.call(t,n)&&n!==r&&Dn(t,n,{get:()=>e[n],enumerable:!(o=fh(e,n))||o.enumerable});return t};var ac=(t,e,r)=>(r=t!=null?dh(hh(t)):{},gh(e||!t||!t.__esModule?Dn(r,"default",{value:t,enumerable:!0}):r,t));var Pr=S(q=>{"use strict";Object.defineProperty(q,"__esModule",{value:!0});q.regexpCode=q.getEsmExportName=q.getProperty=q.safeStringify=q.stringify=q.strConcat=q.addCodeArg=q.str=q._=q.nil=q._Code=q.Name=q.IDENTIFIER=q._CodeOrName=void 0;var Er=class{};q._CodeOrName=Er;q.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var gt=class extends Er{constructor(e){if(super(),!q.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};q.Name=gt;var Ie=class extends Er{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof gt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};q._Code=Ie;q.nil=new Ie("");function Pp(t,...e){let r=[t[0]],o=0;for(;o{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.ValueScope=Te.ValueScopeName=Te.Scope=Te.varKinds=Te.UsedValueState=void 0;var be=Pr(),ti=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Zo;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Zo||(Te.UsedValueState=Zo={}));Te.varKinds={const:new be.Name("const"),let:new be.Name("let"),var:new be.Name("var")};var Do=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof be.Name?e:this.name(e)}name(e){return new be.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Te.Scope=Do;var Mo=class extends be.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,be._)`.${new be.Name(r)}[${o}]`}};Te.ValueScopeName=Mo;var zy=(0,be._)`\n`,ri=class extends Do{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?zy:be.nil}}get(){return this._scope}name(e){return new Mo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let u=a.get(i);if(u)return u}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),l=c.length;return c[l]=r.ref,n.setValue(r,{property:s,itemIndex:l}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,be._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=be.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,Zo.Started);let u=r(l);if(u){let p=this.opts.es5?Te.varKinds.var:Te.varKinds.const;s=(0,be._)`${s}${p} ${l} = ${u};${this.opts._n}`}else if(u=n?.(l))s=(0,be._)`${s}${u}${this.opts._n}`;else throw new ti(l);c.set(l,Zo.Completed)})}return s}};Te.ValueScope=ri});var O=S(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.or=N.and=N.not=N.CodeGen=N.operators=N.varKinds=N.ValueScopeName=N.ValueScope=N.Scope=N.Name=N.regexpCode=N.stringify=N.getProperty=N.nil=N.strConcat=N.str=N._=void 0;var Z=Pr(),je=oi(),it=Pr();Object.defineProperty(N,"_",{enumerable:!0,get:function(){return it._}});Object.defineProperty(N,"str",{enumerable:!0,get:function(){return it.str}});Object.defineProperty(N,"strConcat",{enumerable:!0,get:function(){return it.strConcat}});Object.defineProperty(N,"nil",{enumerable:!0,get:function(){return it.nil}});Object.defineProperty(N,"getProperty",{enumerable:!0,get:function(){return it.getProperty}});Object.defineProperty(N,"stringify",{enumerable:!0,get:function(){return it.stringify}});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:function(){return it.regexpCode}});Object.defineProperty(N,"Name",{enumerable:!0,get:function(){return it.Name}});var Fo=oi();Object.defineProperty(N,"Scope",{enumerable:!0,get:function(){return Fo.Scope}});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:function(){return Fo.ValueScope}});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:function(){return Fo.ValueScopeName}});Object.defineProperty(N,"varKinds",{enumerable:!0,get:function(){return Fo.varKinds}});N.operators={GT:new Z._Code(">"),GTE:new Z._Code(">="),LT:new Z._Code("<"),LTE:new Z._Code("<="),EQ:new Z._Code("==="),NEQ:new Z._Code("!=="),NOT:new Z._Code("!"),OR:new Z._Code("||"),AND:new Z._Code("&&"),ADD:new Z._Code("+")};var Xe=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ni=class extends Xe{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?je.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Dt(this.rhs,e,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},qo=class extends Xe{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Z.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Dt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return Uo(e,this.rhs)}},si=class extends qo{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},ii=class extends Xe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},ai=class extends Xe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},ci=class extends Xe{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},ui=class extends Xe{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Dt(this.code,e,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},Rr=class extends Xe{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(Ey(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>$t(e,r.names),{})}},Qe=class extends Rr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},li=class extends Rr{},Zt=class extends Qe{};Zt.kind="else";var yt=class t extends Qe{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new Zt(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Ip(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Dt(this.condition,e,r),this}get names(){let e=super.names;return Uo(e,this.condition),this.else&&$t(e,this.else.names),e}};yt.kind="if";var vt=class extends Qe{};vt.kind="for";var pi=class extends vt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Dt(this.iteration,e,r),this}get names(){return $t(super.names,this.iteration.names)}},di=class extends vt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?je.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=Uo(super.names,this.from);return Uo(e,this.to)}},Lo=class extends vt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Dt(this.iterable,e,r),this}get names(){return $t(super.names,this.iterable.names)}},Ir=class extends Qe{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Ir.kind="func";var Or=class extends Rr{render(e){return"return "+super.render(e)}};Or.kind="return";var fi=class extends Qe{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&$t(e,this.catch.names),this.finally&&$t(e,this.finally.names),e}},Nr=class extends Qe{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Nr.kind="catch";var Ar=class extends Qe{render(e){return"finally"+super.render(e)}};Ar.kind="finally";var mi=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?` +`:""},this._extScope=e,this._scope=new je.Scope({parent:e}),this._nodes=[new li]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new ni(e,s,o)),s}const(e,r,o){return this._def(je.varKinds.const,e,r,o)}let(e,r,o){return this._def(je.varKinds.let,e,r,o)}var(e,r,o){return this._def(je.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new qo(e,r,o))}add(e,r){return this._leafNode(new si(e,N.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Z.nil&&this._leafNode(new ui(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,Z.addCodeArg)(r,n));return r.push("}"),new Z._Code(r)}if(e,r,o){if(this._blockNode(new yt(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new yt(e))}else(){return this._elseNode(new Zt)}endIf(){return this._endBlockNode(yt,Zt)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new pi(e),r)}forRange(e,r,o,n,s=this.opts.es5?je.varKinds.var:je.varKinds.let){let i=this._scope.toName(e);return this._for(new di(s,i,r,o),()=>n(i))}forOf(e,r,o,n=je.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof Z.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Z._)`${i}.length`,a=>{this.var(s,(0,Z._)`${i}[${a}]`),o(s)})}return this._for(new Lo("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?je.varKinds.var:je.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Z._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new Lo("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(vt)}label(e){return this._leafNode(new ii(e))}break(e){return this._leafNode(new ai(e))}return(e){let r=new Or;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Or)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new fi;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new Nr(s),r(s)}return o&&(this._currNode=n.finally=new Ar,this.code(o)),this._endBlockNode(Nr,Ar)}throw(e){return this._leafNode(new ci(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Z.nil,o,n){return this._blockNode(new Ir(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Ir)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof yt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};N.CodeGen=mi;function $t(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Uo(t,e){return e instanceof Z._CodeOrName?$t(t,e.names):t}function Dt(t,e,r){if(t instanceof Z.Name)return o(t);if(!n(t))return t;return new Z._Code(t._items.reduce((s,i)=>(i instanceof Z.Name&&(i=o(i)),i instanceof Z._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof Z._Code&&s._items.some(i=>i instanceof Z.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Ey(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Ip(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Z._)`!${hi(t)}`}N.not=Ip;var ky=Op(N.operators.AND);function Py(...t){return t.reduce(ky)}N.and=Py;var Ry=Op(N.operators.OR);function Iy(...t){return t.reduce(Ry)}N.or=Iy;function Op(t){return(e,r)=>e===Z.nil?r:r===Z.nil?e:(0,Z._)`${hi(e)} ${t} ${hi(r)}`}function hi(t){return t instanceof Z.Name?t:(0,Z._)`(${t})`}});var D=S(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.checkStrictMode=A.getErrorPath=A.Type=A.useFunc=A.setEvaluated=A.evaluatedPropsToName=A.mergeEvaluated=A.eachItem=A.unescapeJsonPointer=A.escapeJsonPointer=A.escapeFragment=A.unescapeFragment=A.schemaRefOrVal=A.schemaHasRulesButRef=A.schemaHasRules=A.checkUnknownRules=A.alwaysValidSchema=A.toHash=void 0;var V=O(),Oy=Pr();function Ny(t){let e={};for(let r of t)e[r]=!0;return e}A.toHash=Ny;function Ay(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Cp(t,e),!jp(e,t.self.RULES.all))}A.alwaysValidSchema=Ay;function Cp(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||Mp(t,`unknown keyword: "${s}"`)}A.checkUnknownRules=Cp;function jp(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}A.schemaHasRules=jp;function Cy(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}A.schemaHasRulesButRef=Cy;function jy({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,V._)`${r}`}return(0,V._)`${t}${e}${(0,V.getProperty)(o)}`}A.schemaRefOrVal=jy;function Zy(t){return Zp(decodeURIComponent(t))}A.unescapeFragment=Zy;function Dy(t){return encodeURIComponent(gi(t))}A.escapeFragment=Dy;function gi(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}A.escapeJsonPointer=gi;function Zp(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}A.unescapeJsonPointer=Zp;function My(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}A.eachItem=My;function Np({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof V.Name?(s instanceof V.Name?t(n,s,i):e(n,s,i),i):s instanceof V.Name?(e(n,i,s),s):r(s,i);return a===V.Name&&!(c instanceof V.Name)?o(n,c):c}}A.mergeEvaluated={props:Np({mergeNames:(t,e,r)=>t.if((0,V._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,V._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,V._)`${r} || {}`).code((0,V._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,V._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,V._)`${r} || {}`),yi(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Dp}),items:Np({mergeNames:(t,e,r)=>t.if((0,V._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,V._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,V._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,V._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Dp(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,V._)`{}`);return e!==void 0&&yi(t,r,e),r}A.evaluatedPropsToName=Dp;function yi(t,e,r){Object.keys(r).forEach(o=>t.assign((0,V._)`${e}${(0,V.getProperty)(o)}`,!0))}A.setEvaluated=yi;var Ap={};function qy(t,e){return t.scopeValue("func",{ref:e,code:Ap[e.code]||(Ap[e.code]=new Oy._Code(e.code))})}A.useFunc=qy;var _i;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(_i||(A.Type=_i={}));function Ly(t,e,r){if(t instanceof V.Name){let o=e===_i.Num;return r?o?(0,V._)`"[" + ${t} + "]"`:(0,V._)`"['" + ${t} + "']"`:o?(0,V._)`"/" + ${t}`:(0,V._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,V.getProperty)(t).toString():"/"+gi(t)}A.getErrorPath=Ly;function Mp(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}A.checkStrictMode=Mp});var et=S(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});var me=O(),Uy={data:new me.Name("data"),valCxt:new me.Name("valCxt"),instancePath:new me.Name("instancePath"),parentData:new me.Name("parentData"),parentDataProperty:new me.Name("parentDataProperty"),rootData:new me.Name("rootData"),dynamicAnchors:new me.Name("dynamicAnchors"),vErrors:new me.Name("vErrors"),errors:new me.Name("errors"),this:new me.Name("this"),self:new me.Name("self"),scope:new me.Name("scope"),json:new me.Name("json"),jsonPos:new me.Name("jsonPos"),jsonLen:new me.Name("jsonLen"),jsonPart:new me.Name("jsonPart")};vi.default=Uy});var Cr=S(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.extendErrors=he.resetErrorsCount=he.reportExtraError=he.reportError=he.keyword$DataError=he.keywordError=void 0;var M=O(),Vo=D(),ve=et();he.keywordError={message:({keyword:t})=>(0,M.str)`must pass "${t}" keyword validation`};he.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,M.str)`"${t}" keyword must be ${e} ($data)`:(0,M.str)`"${t}" keyword is invalid ($data)`};function Fy(t,e=he.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=Up(t,e,r);o??(i||a)?qp(s,c):Lp(n,(0,M._)`[${c}]`)}he.reportError=Fy;function Vy(t,e=he.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=Up(t,e,r);qp(n,a),s||i||Lp(o,ve.default.vErrors)}he.reportExtraError=Vy;function Hy(t,e){t.assign(ve.default.errors,e),t.if((0,M._)`${ve.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,M._)`${ve.default.vErrors}.length`,e),()=>t.assign(ve.default.vErrors,null)))}he.resetErrorsCount=Hy;function Ky({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ve.default.errors,a=>{t.const(i,(0,M._)`${ve.default.vErrors}[${a}]`),t.if((0,M._)`${i}.instancePath === undefined`,()=>t.assign((0,M._)`${i}.instancePath`,(0,M.strConcat)(ve.default.instancePath,s.errorPath))),t.assign((0,M._)`${i}.schemaPath`,(0,M.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,M._)`${i}.schema`,r),t.assign((0,M._)`${i}.data`,o))})}he.extendErrors=Ky;function qp(t,e){let r=t.const("err",e);t.if((0,M._)`${ve.default.vErrors} === null`,()=>t.assign(ve.default.vErrors,(0,M._)`[${r}]`),(0,M._)`${ve.default.vErrors}.push(${r})`),t.code((0,M._)`${ve.default.errors}++`)}function Lp(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,M._)`new ${t.ValidationError}(${e})`):(r.assign((0,M._)`${o}.errors`,e),r.return(!1))}var St={keyword:new M.Name("keyword"),schemaPath:new M.Name("schemaPath"),params:new M.Name("params"),propertyName:new M.Name("propertyName"),message:new M.Name("message"),schema:new M.Name("schema"),parentSchema:new M.Name("parentSchema")};function Up(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,M._)`{}`:Gy(t,e,r)}function Gy(t,e,r={}){let{gen:o,it:n}=t,s=[By(n,r),Jy(t,r)];return Wy(t,e,s),o.object(...s)}function By({errorPath:t},{instancePath:e}){let r=e?(0,M.str)`${t}${(0,Vo.getErrorPath)(e,Vo.Type.Str)}`:t;return[ve.default.instancePath,(0,M.strConcat)(ve.default.instancePath,r)]}function Jy({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,M.str)`${e}/${t}`;return r&&(n=(0,M.str)`${n}${(0,Vo.getErrorPath)(r,Vo.Type.Str)}`),[St.schemaPath,n]}function Wy(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:p}=a;o.push([St.keyword,n],[St.params,typeof e=="function"?e(t):e||(0,M._)`{}`]),c.messages&&o.push([St.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([St.schema,i],[St.parentSchema,(0,M._)`${u}${p}`],[ve.default.data,s]),l&&o.push([St.propertyName,l])}});var Vp=S(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.boolOrEmptySchema=Mt.topBoolOrEmptySchema=void 0;var Yy=Cr(),Xy=O(),Qy=et(),ev={message:"boolean schema is false"};function tv(t){let{gen:e,schema:r,validateName:o}=t;r===!1?Fp(t,!1):typeof r=="object"&&r.$async===!0?e.return(Qy.default.data):(e.assign((0,Xy._)`${o}.errors`,null),e.return(!0))}Mt.topBoolOrEmptySchema=tv;function rv(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),Fp(t)):r.var(e,!0)}Mt.boolOrEmptySchema=rv;function Fp(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Yy.reportError)(n,ev,void 0,e)}});var $i=S(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.getRules=qt.isJSONType=void 0;var ov=["string","number","integer","boolean","null","object","array"],nv=new Set(ov);function sv(t){return typeof t=="string"&&nv.has(t)}qt.isJSONType=sv;function iv(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}qt.getRules=iv});var Si=S(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.shouldUseRule=at.shouldUseGroup=at.schemaHasRulesForType=void 0;function av({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&Hp(t,o)}at.schemaHasRulesForType=av;function Hp(t,e){return e.rules.some(r=>Kp(t,r))}at.shouldUseGroup=Hp;function Kp(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}at.shouldUseRule=Kp});var jr=S(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.reportTypeError=_e.checkDataTypes=_e.checkDataType=_e.coerceAndCheckDataType=_e.getJSONTypes=_e.getSchemaTypes=_e.DataType=void 0;var cv=$i(),uv=Si(),lv=Cr(),I=O(),Gp=D(),Lt;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Lt||(_e.DataType=Lt={}));function pv(t){let e=Bp(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}_e.getSchemaTypes=pv;function Bp(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(cv.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}_e.getJSONTypes=Bp;function dv(t,e){let{gen:r,data:o,opts:n}=t,s=fv(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,uv.schemaHasRulesForType)(t,e[0]));if(i){let a=Ti(e,o,n.strictNumbers,Lt.Wrong);r.if(a,()=>{s.length?mv(t,e,s):wi(t)})}return i}_e.coerceAndCheckDataType=dv;var Jp=new Set(["string","number","integer","boolean","null"]);function fv(t,e){return e?t.filter(r=>Jp.has(r)||e==="array"&&r==="array"):[]}function mv(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,I._)`typeof ${n}`),a=o.let("coerced",(0,I._)`undefined`);s.coerceTypes==="array"&&o.if((0,I._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,I._)`${n}[0]`).assign(i,(0,I._)`typeof ${n}`).if(Ti(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,I._)`${a} !== undefined`);for(let l of r)(Jp.has(l)||l==="array"&&s.coerceTypes==="array")&&c(l);o.else(),wi(t),o.endIf(),o.if((0,I._)`${a} !== undefined`,()=>{o.assign(n,a),hv(t,a)});function c(l){switch(l){case"string":o.elseIf((0,I._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,I._)`"" + ${n}`).elseIf((0,I._)`${n} === null`).assign(a,(0,I._)`""`);return;case"number":o.elseIf((0,I._)`${i} == "boolean" || ${n} === null || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,I._)`+${n}`);return;case"integer":o.elseIf((0,I._)`${i} === "boolean" || ${n} === null || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,I._)`+${n}`);return;case"boolean":o.elseIf((0,I._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,I._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,I._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,I._)`${i} === "string" || ${i} === "number" - || ${i} === "boolean" || ${n} === null`).assign(a,(0,I._)`[${n}]`)}}}function hv({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,I._)`${e} !== undefined`,()=>t.assign((0,I._)`${e}[${r}]`,o))}function Si(t,e,r,o=Lt.Correct){let n=o===Lt.Correct?I.operators.EQ:I.operators.NEQ,s;switch(t){case"null":return(0,I._)`${e} ${n} null`;case"array":s=(0,I._)`Array.isArray(${e})`;break;case"object":s=(0,I._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,I._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,I._)`typeof ${e} ${n} ${t}`}return o===Lt.Correct?s:(0,I.not)(s);function i(a=I.nil){return(0,I.and)((0,I._)`typeof ${e} == "number"`,a,r?(0,I._)`isFinite(${e})`:I.nil)}}_e.checkDataType=Si;function bi(t,e,r,o){if(t.length===1)return Si(t[0],e,r,o);let n,s=(0,Kp.toHash)(t);if(s.array&&s.object){let i=(0,I._)`typeof ${e} != "object"`;n=s.null?i:(0,I._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else n=I.nil;s.number&&delete s.integer;for(let i in s)n=(0,I.and)(n,Si(i,e,r,o));return n}_e.checkDataTypes=bi;var _v={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,I._)`{type: ${t}}`:(0,I._)`{type: ${e}}`};function Ti(t){let e=gv(t);(0,lv.reportError)(e,_v)}_e.reportTypeError=Ti;function gv(t){let{gen:e,data:r,schema:o}=t,n=(0,Kp.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var Wp=S(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.assignDefaults=void 0;var Ut=O(),yv=D();function vv(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)Jp(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,s)=>Jp(t,s,n.default))}Ko.assignDefaults=vv;function Jp(t,e,r){let{gen:o,compositeRule:n,data:s,opts:i}=t;if(r===void 0)return;let a=(0,Ut._)`${s}${(0,Ut.getProperty)(e)}`;if(n){(0,yv.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Ut._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Ut._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,Ut._)`${a} = ${(0,Ut.stringify)(r)}`)}});var Oe=S(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.validateUnion=F.validateArray=F.usePattern=F.callValidateCode=F.schemaProperties=F.allSchemaProperties=F.noPropertyInData=F.propertyInData=F.isOwnProperty=F.hasPropFunc=F.reportMissingProp=F.checkMissingProp=F.checkReportMissingProp=void 0;var W=O(),wi=D(),ct=et(),$v=D();function Sv(t,e){let{gen:r,data:o,it:n}=t;r.if(zi(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,W._)`${e}`},!0),t.error()})}F.checkReportMissingProp=Sv;function bv({gen:t,data:e,it:{opts:r}},o,n){return(0,W.or)(...o.map(s=>(0,W.and)(zi(t,e,s,r.ownProperties),(0,W._)`${n} = ${s}`)))}F.checkMissingProp=bv;function Tv(t,e){t.setParams({missingProperty:e},!0),t.error()}F.reportMissingProp=Tv;function Yp(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,W._)`Object.prototype.hasOwnProperty`})}F.hasPropFunc=Yp;function xi(t,e,r){return(0,W._)`${Yp(t)}.call(${e}, ${r})`}F.isOwnProperty=xi;function wv(t,e,r,o){let n=(0,W._)`${e}${(0,W.getProperty)(r)} !== undefined`;return o?(0,W._)`${n} && ${xi(t,e,r)}`:n}F.propertyInData=wv;function zi(t,e,r,o){let n=(0,W._)`${e}${(0,W.getProperty)(r)} === undefined`;return o?(0,W.or)(n,(0,W.not)(xi(t,e,r))):n}F.noPropertyInData=zi;function Xp(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}F.allSchemaProperties=Xp;function xv(t,e){return Xp(e).filter(r=>!(0,wi.alwaysValidSchema)(t,e[r]))}F.schemaProperties=xv;function zv({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,W._)`${t}, ${e}, ${o}${n}`:e,p=[[ct.default.instancePath,(0,W.strConcat)(ct.default.instancePath,s)],[ct.default.parentData,i.parentData],[ct.default.parentDataProperty,i.parentDataProperty],[ct.default.rootData,ct.default.rootData]];i.opts.dynamicRef&&p.push([ct.default.dynamicAnchors,ct.default.dynamicAnchors]);let d=(0,W._)`${l}, ${r.object(...p)}`;return c!==W.nil?(0,W._)`${a}.call(${c}, ${d})`:(0,W._)`${a}(${d})`}F.callValidateCode=zv;var Ev=(0,W._)`new RegExp`;function kv({gen:t,it:{opts:e}},r){let o=e.unicodeRegExp?"u":"",{regExp:n}=e.code,s=n(r,o);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,W._)`${n.code==="new RegExp"?Ev:(0,$v.useFunc)(t,n)}(${r}, ${o})`})}F.usePattern=kv;function Pv(t){let{gen:e,data:r,keyword:o,it:n}=t,s=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,W._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:wi.Type.Num},s),e.if((0,W.not)(s),a)})}}F.validateArray=Pv;function Rv(t){let{gen:e,schema:r,keyword:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,wi.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,W._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,W.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}F.validateUnion=Rv});var td=S(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.validateKeywordUsage=Ve.validSchemaType=Ve.funcKeywordCode=Ve.macroKeywordCode=void 0;var $e=O(),bt=et(),Iv=Oe(),Ov=jr();function Nv(t,e){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=t,a=e.macro.call(i.self,n,s,i),c=ed(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:$e.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Ve.macroKeywordCode=Nv;function Av(t,e){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=t;jv(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=ed(o,n,u),p=o.let("valid");t.block$data(p,d),t.ok((r=e.valid)!==null&&r!==void 0?r:p);function d(){if(e.errors===!1)g(),e.modifying&&Qp(t),y(()=>t.error());else{let v=e.async?m():_();e.modifying&&Qp(t),y(()=>Cv(t,v))}}function m(){let v=o.let("ruleErrs",null);return o.try(()=>g((0,$e._)`await `),b=>o.assign(p,!1).if((0,$e._)`${b} instanceof ${c.ValidationError}`,()=>o.assign(v,(0,$e._)`${b}.errors`),()=>o.throw(b))),v}function _(){let v=(0,$e._)`${l}.errors`;return o.assign(v,null),g($e.nil),v}function g(v=e.async?(0,$e._)`await `:$e.nil){let b=c.opts.passContext?bt.default.this:bt.default.self,$=!("compile"in e&&!a||e.schema===!1);o.assign(p,(0,$e._)`${v}${(0,Iv.callValidateCode)(t,l,b,$)}`,e.modifying)}function y(v){var b;o.if((0,$e.not)((b=e.valid)!==null&&b!==void 0?b:p),v)}}Ve.funcKeywordCode=Av;function Qp(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,$e._)`${o.parentData}[${o.parentDataProperty}]`))}function Cv(t,e){let{gen:r}=t;r.if((0,$e._)`Array.isArray(${e})`,()=>{r.assign(bt.default.vErrors,(0,$e._)`${bt.default.vErrors} === null ? ${e} : ${bt.default.vErrors}.concat(${e})`).assign(bt.default.errors,(0,$e._)`${bt.default.vErrors}.length`),(0,Ov.extendErrors)(t)},()=>t.error())}function jv({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function ed(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,$e.stringify)(r)})}function Zv(t,e,r=!1){return!e.length||e.some(o=>o==="array"?Array.isArray(t):o==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==o||r&&typeof t>"u")}Ve.validSchemaType=Zv;function Dv({schema:t,opts:e,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ve.validateKeywordUsage=Dv});var od=S(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.extendSubschemaMode=ut.extendSubschemaData=ut.getSubschema=void 0;var He=O(),rd=D();function Mv(t,{keyword:e,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,He._)`${t.schemaPath}${(0,He.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,He._)`${t.schemaPath}${(0,He.getProperty)(e)}${(0,He.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,rd.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}ut.getSubschema=Mv;function qv(t,e,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:p}=e,d=a.let("data",(0,He._)`${e.data}${(0,He.getProperty)(r)}`,!0);c(d),t.errorPath=(0,He.str)`${u}${(0,rd.getErrorPath)(r,o,p.jsPropertySyntax)}`,t.parentDataProperty=(0,He._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof He.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}ut.extendSubschemaData=qv;function Lv(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(t.compositeRule=o),n!==void 0&&(t.createErrors=n),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}ut.extendSubschemaMode=Lv});var Ei=S((CP,nd)=>{"use strict";nd.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var id=S((jP,sd)=>{"use strict";var lt=sd.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Go(e,o,n,t,"",t)};lt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};lt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};lt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};lt.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Go(t,e,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){e(o,n,s,i,a,c,u);for(var l in o){var p=o[l];if(Array.isArray(p)){if(l in lt.arrayKeywords)for(var d=0;d{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.getSchemaRefs=we.resolveUrl=we.normalizeId=we._getFullPath=we.getFullPath=we.inlineRef=void 0;var Fv=D(),Vv=Ei(),Hv=id(),Kv=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Gv(t,e=!0){return typeof t=="boolean"?!0:e===!0?!ki(t):e?ad(t)<=e:!1}we.inlineRef=Gv;var Bv=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ki(t){for(let e in t){if(Bv.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(ki)||typeof r=="object"&&ki(r))return!0}return!1}function ad(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Kv.has(r)&&(typeof t[r]=="object"&&(0,Fv.eachItem)(t[r],o=>e+=ad(o)),e===1/0))return 1/0}return e}function cd(t,e="",r){r!==!1&&(e=Ft(e));let o=t.parse(e);return ud(t,o)}we.getFullPath=cd;function ud(t,e){return t.serialize(e).split("#")[0]+"#"}we._getFullPath=ud;var Jv=/#\/?$/;function Ft(t){return t?t.replace(Jv,""):""}we.normalizeId=Ft;function Wv(t,e,r){return r=Ft(r),t.resolve(e,r)}we.resolveUrl=Wv;var Yv=/^[a-z_][-a-z0-9._]*$/i;function Xv(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Ft(t[r]||e),s={"":n},i=cd(o,n,!1),a={},c=new Set;return Hv(t,{allKeys:!0},(p,d,m,_)=>{if(_===void 0)return;let g=i+d,y=s[_];typeof p[r]=="string"&&(y=v.call(this,p[r])),b.call(this,p.$anchor),b.call(this,p.$dynamicAnchor),s[d]=y;function v($){let z=this.opts.uriResolver.resolve;if($=Ft(y?z(y,$):$),c.has($))throw l($);c.add($);let k=this.refs[$];return typeof k=="string"&&(k=this.refs[k]),typeof k=="object"?u(p,k.schema,$):$!==Ft(g)&&($[0]==="#"?(u(p,a[$],$),a[$]=p):this.refs[$]=g),$}function b($){if(typeof $=="string"){if(!Yv.test($))throw new Error(`invalid anchor "${$}"`);v.call(this,`#${$}`)}}}),a;function u(p,d,m){if(d!==void 0&&!Vv(p,d))throw l(m)}function l(p){return new Error(`reference "${p}" resolves to more than one schema`)}}we.getSchemaRefs=Xv});var Lr=S(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.getData=pt.KeywordCxt=pt.validateFunctionCode=void 0;var md=Fp(),ld=Zr(),Ri=$i(),Bo=Zr(),Qv=Wp(),qr=td(),Pi=od(),x=O(),P=et(),e$=Dr(),tt=D(),Mr=jr();function t$(t){if(gd(t)&&(yd(t),_d(t))){n$(t);return}hd(t,()=>(0,md.topBoolOrEmptySchema)(t))}pt.validateFunctionCode=t$;function hd({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},s){n.code.es5?t.func(e,(0,x._)`${P.default.data}, ${P.default.valCxt}`,o.$async,()=>{t.code((0,x._)`"use strict"; ${pd(r,n)}`),o$(t,n),t.code(s)}):t.func(e,(0,x._)`${P.default.data}, ${r$(n)}`,o.$async,()=>t.code(pd(r,n)).code(s))}function r$(t){return(0,x._)`{${P.default.instancePath}="", ${P.default.parentData}, ${P.default.parentDataProperty}, ${P.default.rootData}=${P.default.data}${t.dynamicRef?(0,x._)`, ${P.default.dynamicAnchors}={}`:x.nil}}={}`}function o$(t,e){t.if(P.default.valCxt,()=>{t.var(P.default.instancePath,(0,x._)`${P.default.valCxt}.${P.default.instancePath}`),t.var(P.default.parentData,(0,x._)`${P.default.valCxt}.${P.default.parentData}`),t.var(P.default.parentDataProperty,(0,x._)`${P.default.valCxt}.${P.default.parentDataProperty}`),t.var(P.default.rootData,(0,x._)`${P.default.valCxt}.${P.default.rootData}`),e.dynamicRef&&t.var(P.default.dynamicAnchors,(0,x._)`${P.default.valCxt}.${P.default.dynamicAnchors}`)},()=>{t.var(P.default.instancePath,(0,x._)`""`),t.var(P.default.parentData,(0,x._)`undefined`),t.var(P.default.parentDataProperty,(0,x._)`undefined`),t.var(P.default.rootData,P.default.data),e.dynamicRef&&t.var(P.default.dynamicAnchors,(0,x._)`{}`)})}function n$(t){let{schema:e,opts:r,gen:o}=t;hd(t,()=>{r.$comment&&e.$comment&&$d(t),u$(t),o.let(P.default.vErrors,null),o.let(P.default.errors,0),r.unevaluated&&s$(t),vd(t),d$(t)})}function s$(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,x._)`${r}.evaluated`),e.if((0,x._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,x._)`${t.evaluated}.props`,(0,x._)`undefined`)),e.if((0,x._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,x._)`${t.evaluated}.items`,(0,x._)`undefined`))}function pd(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,x._)`/*# sourceURL=${r} */`:x.nil}function i$(t,e){if(gd(t)&&(yd(t),_d(t))){a$(t,e);return}(0,md.boolOrEmptySchema)(t,e)}function _d({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function gd(t){return typeof t.schema!="boolean"}function a$(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&$d(t),l$(t),p$(t);let s=o.const("_errs",P.default.errors);vd(t,s),o.var(e,(0,x._)`${s} === ${P.default.errors}`)}function yd(t){(0,tt.checkUnknownRules)(t),c$(t)}function vd(t,e){if(t.opts.jtd)return dd(t,[],!1,e);let r=(0,ld.getSchemaTypes)(t.schema),o=(0,ld.coerceAndCheckDataType)(t,r);dd(t,r,!o,e)}function c$(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,tt.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function u$(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,tt.checkStrictMode)(t,"default is ignored in the schema root")}function l$(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,e$.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function p$(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function $d({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)t.code((0,x._)`${P.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,x.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,x._)`${P.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function d$(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=t;r.$async?e.if((0,x._)`${P.default.errors} === 0`,()=>e.return(P.default.data),()=>e.throw((0,x._)`new ${n}(${P.default.vErrors})`)):(e.assign((0,x._)`${o}.errors`,P.default.vErrors),s.unevaluated&&f$(t),e.return((0,x._)`${P.default.errors} === 0`))}function f$({gen:t,evaluated:e,props:r,items:o}){r instanceof x.Name&&t.assign((0,x._)`${e}.props`,r),o instanceof x.Name&&t.assign((0,x._)`${e}.items`,o)}function dd(t,e,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,tt.schemaHasRulesButRef)(s,l))){n.block(()=>bd(t,"$ref",l.all.$ref.definition));return}c.jtd||m$(t,e),n.block(()=>{for(let d of l.rules)p(d);p(l.post)});function p(d){(0,Ri.shouldUseGroup)(s,d)&&(d.type?(n.if((0,Bo.checkDataType)(d.type,i,c.strictNumbers)),fd(t,d),e.length===1&&e[0]===d.type&&r&&(n.else(),(0,Bo.reportTypeError)(t)),n.endIf()):fd(t,d),a||n.if((0,x._)`${P.default.errors} === ${o||0}`))}}function fd(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,Qv.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Ri.shouldUseRule)(o,s)&&bd(t,s.keyword,s.definition,e.type)})}function m$(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(h$(t,e),t.opts.allowUnionTypes||_$(t,e),g$(t,t.dataTypes))}function h$(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Sd(t.dataTypes,r)||Ii(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),v$(t,e)}}function _$(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Ii(t,"use allowUnionTypes to allow union type keyword")}function g$(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Ri.shouldUseRule)(t.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>y$(e,i))&&Ii(t,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function y$(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Sd(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function v$(t,e){let r=[];for(let o of t.dataTypes)Sd(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function Ii(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,tt.checkStrictMode)(t,e,t.opts.strictTypes)}var Jo=class{constructor(e,r,o){if((0,qr.validateKeywordUsage)(e,r,o),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=o,this.data=e.data,this.schema=e.schema[o],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,tt.schemaRefOrVal)(e,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Td(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,qr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",P.default.errors))}result(e,r,o){this.failResult((0,x.not)(e),r,o)}failResult(e,r,o){this.gen.if(e),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,x.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,x._)`${r} !== undefined && (${(0,x.or)(this.invalid$data(),e)})`)}error(e,r,o){if(r){this.setParams(r),this._error(e,o),this.setParams({});return}this._error(e,o)}_error(e,r){(e?Mr.reportExtraError:Mr.reportError)(this,this.def.error,r)}$dataError(){(0,Mr.reportError)(this,this.def.$dataError||Mr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Mr.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,o=x.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=x.nil,r=x.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,x.or)((0,x._)`${n} === undefined`,r)),e!==x.nil&&o.assign(e,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==x.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,x.or)(i(),a());function i(){if(o.length){if(!(r instanceof x.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,x._)`${(0,Bo.checkDataTypes)(c,r,s.opts.strictNumbers,Bo.DataType.Wrong)}`}return x.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,x._)`!${c}(${r})`}return x.nil}}subschema(e,r){let o=(0,Pi.getSubschema)(this.it,e);(0,Pi.extendSubschemaData)(o,this.it,e),(0,Pi.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return i$(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=tt.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=tt.mergeEvaluated.items(n,e.items,o.items,r)))}mergeValidEvaluated(e,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,x.Name)),!0}};pt.KeywordCxt=Jo;function bd(t,e,r,o){let n=new Jo(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,qr.funcKeywordCode)(n,r):"macro"in r?(0,qr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,qr.funcKeywordCode)(n,r)}var $$=/^\/(?:[^~]|~0|~1)*$/,S$=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Td(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,s;if(t==="")return P.default.rootData;if(t[0]==="/"){if(!$$.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,s=P.default.rootData}else{let u=S$.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=e)throw new Error(c("property/index",l));return o[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,x._)`${s}${(0,x.getProperty)((0,tt.unescapeJsonPointer)(u))}`,i=(0,x._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}pt.getData=Td});var Wo=S(Ni=>{"use strict";Object.defineProperty(Ni,"__esModule",{value:!0});var Oi=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Ni.default=Oi});var Ur=S(ji=>{"use strict";Object.defineProperty(ji,"__esModule",{value:!0});var Ai=Dr(),Ci=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Ai.resolveUrl)(e,r,o),this.missingSchema=(0,Ai.normalizeId)((0,Ai.getFullPath)(e,this.missingRef))}};ji.default=Ci});var Xo=S(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.resolveSchema=Ne.getCompilingSchema=Ne.resolveRef=Ne.compileSchema=Ne.SchemaEnv=void 0;var Ze=O(),b$=Wo(),Tt=et(),De=Dr(),wd=D(),T$=Lr(),Vt=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let o;typeof e.schema=="object"&&(o=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,De.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};Ne.SchemaEnv=Vt;function Di(t){let e=xd.call(this,t);if(e)return e;let r=(0,De.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Ze.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:b$.default,code:(0,Ze._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Tt.default.data,parentData:Tt.default.parentData,parentDataProperty:Tt.default.parentDataProperty,dataNames:[Tt.default.data],dataPathArr:[Ze.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Ze.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Ze.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ze._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,T$.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let p=i.toString();l=`${i.scopeRefs(Tt.default.scope)}return ${p}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let m=new Function(`${Tt.default.self}`,`${Tt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=t.schema,m.schemaEnv=t,t.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:p,scopeValues:i._values}),this.opts.unevaluated){let{props:_,items:g}=u;m.evaluated={props:_ instanceof Ze.Name?void 0:_,items:g instanceof Ze.Name?void 0:g,dynamicProps:_ instanceof Ze.Name,dynamicItems:g instanceof Ze.Name},m.source&&(m.source.evaluated=(0,Ze.stringify)(m.evaluated))}return t.validate=m,t}catch(p){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),p}finally{this._compilations.delete(t)}}Ne.compileSchema=Di;function w$(t,e,r){var o;r=(0,De.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let s=E$.call(this,t,r);if(s===void 0){let i=(o=t.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new Vt({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=x$.call(this,s)}Ne.resolveRef=w$;function x$(t){return(0,De.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Di.call(this,t)}function xd(t){for(let e of this._compilations)if(z$(e,t))return e}Ne.getCompilingSchema=xd;function z$(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function E$(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Yo.call(this,t,e)}function Yo(t,e){let r=this.opts.uriResolver.parse(e),o=(0,De._getFullPath)(this.opts.uriResolver,r),n=(0,De.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return Zi.call(this,r,t);let s=(0,De.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Yo.call(this,t,i);return typeof a?.schema!="object"?void 0:Zi.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Di.call(this,i),s===(0,De.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,De.resolveUrl)(this.opts.uriResolver,n,u)),new Vt({schema:a,schemaId:c,root:t,baseId:n})}return Zi.call(this,r,i)}}Ne.resolveSchema=Yo;var k$=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Zi(t,{baseId:e,schema:r,root:o}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,wd.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!k$.has(a)&&u&&(e=(0,De.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,wd.schemaHasRulesButRef)(r,this.RULES)){let a=(0,De.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=Yo.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Vt({schema:r,schemaId:i,root:o,baseId:e}),s.schema!==s.root.schema)return s}});var zd=S((UP,P$)=>{P$.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Li=S((FP,Od)=>{"use strict";var R$=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),kd=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),Mi=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Pd=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),I$=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function qi(t){let e="",r=0,o=0;for(o=0;o=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o];break}for(o+=1;o=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o]}return e}var O$=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Ed(t){return t.length=0,!0}function N$(t,e,r){if(t.length){let o=qi(t);if(o!=="")e.push(o);else return r.error=!0,!1;t.length=0}return!0}function A$(t){let e=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=N$;for(let c=0;c7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=Ed}else{n.push(u);continue}}return n.length&&(a===Ed?r.zone=n.join(""):i?o.push(n.join("")):o.push(qi(n))),r.address=o.join(""),r}function Rd(t){if(C$(t,":")<2)return{host:t,isIPV6:!1};let e=A$(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,o=e.address;return e.zone&&(r+="%"+e.zone,o+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:o}}}function C$(t,e){let r=0;for(let o=0;oZ$[o])}function q$(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let o=0;o{"use strict";var{isUUID:V$}=Li(),H$=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,K$=["http","https","ws","wss","urn","urn:uuid"];function G$(t){return K$.indexOf(t)!==-1}function Ui(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function Nd(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Ad(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function B$(t){return t.secure=Ui(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function J$(t){if((t.port===(Ui(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function W$(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(H$);if(r){let o=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${o}:${e.nid||t.nid}`,s=Fi(n);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Y$(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),n=`${r}:${e.nid||o}`,s=Fi(n);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${o||e.nid}:${a}`,e.skipEscape=!0,i}function X$(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!V$(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Q$(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Cd={scheme:"http",domainHost:!0,parse:Nd,serialize:Ad},e0={scheme:"https",domainHost:Cd.domainHost,parse:Nd,serialize:Ad},Qo={scheme:"ws",domainHost:!0,parse:B$,serialize:J$},t0={scheme:"wss",domainHost:Qo.domainHost,parse:Qo.parse,serialize:Qo.serialize},r0={scheme:"urn",parse:W$,serialize:Y$,skipNormalize:!0},o0={scheme:"urn:uuid",parse:X$,serialize:Q$,skipNormalize:!0},en={http:Cd,https:e0,ws:Qo,wss:t0,urn:r0,"urn:uuid":o0};Object.setPrototypeOf(en,null);function Fi(t){return t&&(en[t]||en[t.toLowerCase()])||void 0}jd.exports={wsIsSecure:Ui,SCHEMES:en,isValidSchemeName:G$,getSchemeHandler:Fi}});var Fd=S((HP,tn)=>{"use strict";var{normalizeIPv6:n0,removeDotSegments:Fr,recomposeAuthority:s0,normalizePercentEncoding:i0,normalizePathEncoding:a0,escapePreservingEscapes:c0,reescapeHostDelimiters:u0,isIPv4:l0,nonSimpleDomain:p0}=Li(),{SCHEMES:d0,getSchemeHandler:Md}=Zd();function f0(t,e){return typeof t=="string"?t=v0(t,e):typeof t=="object"&&(t=Ht(wt(t,e),e)),t}function m0(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=qd(Ht(t,o),Ht(e,o),o,!0);return o.skipEscape=!0,wt(n,o)}function qd(t,e,r,o){let n={};return o||(t=Ht(wt(t,r),r),e=Ht(wt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Fr(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Fr(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=Fr(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=Fr(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function h0(t,e,r){let o=Dd(t,r),n=Dd(e,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function wt(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},e),n=[],s=Md(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=i0(r.path):(r.path=c0(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=s0(r);if(i!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(i),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(a=Fr(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var _0=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,g0=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/;function y0(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function Ld(t,e){let r=Object.assign({},e),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(g0);i!==null&&i[1].indexOf("\\")!==-1&&(o.error="URI authority must not contain a literal backslash.",n=!0);let a=t.match(_0);if(a){o.scheme=a[1],o.userinfo=a[3],o.host=a[4],o.port=parseInt(a[5],10),o.path=a[6]||"",o.query=a[7],o.fragment=a[8],isNaN(o.port)&&(o.port=a[5]);let c=y0(o,a);if(c!==void 0&&(o.error=o.error||c,n=!0),o.host)if(l0(o.host)===!1){let p=n0(o.host);o.host=p.host.toLowerCase(),s=p.isIPV6}else s=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let u=Md(r.scheme||o.scheme);if(!r.unicodeSupport&&(!u||!u.unicodeSupport)&&o.host&&(r.domainHost||u&&u.domainHost)&&s===!1&&p0(o.host))try{o.host=new URL("http://"+o.host).hostname}catch(l){o.error=o.error||"Host's domain name can not be converted to ASCII: "+l}if((!u||u&&!u.skipNormalize)&&(t.indexOf("%")!==-1&&(o.scheme!==void 0&&(o.scheme=unescape(o.scheme)),o.host!==void 0&&(o.host=u0(unescape(o.host),s))),o.path&&(o.path=a0(o.path)),o.fragment))try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}u&&u.parse&&u.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function Ht(t,e){return Ld(t,e).parsed}function v0(t,e){return Ud(t,e).normalized}function Ud(t,e){let{parsed:r,malformedAuthorityOrPort:o}=Ld(t,e);return{normalized:o?t:wt(r,e),malformedAuthorityOrPort:o}}function Dd(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:o}=Ud(t,e);return o?void 0:r}if(typeof t=="object")return wt(t,e)}var Vi={SCHEMES:d0,normalize:f0,resolve:m0,resolveComponent:qd,equal:h0,serialize:wt,parse:Ht};tn.exports=Vi;tn.exports.default=Vi;tn.exports.fastUri=Vi});var Hd=S(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var Vd=Fd();Vd.code='require("ajv/dist/runtime/uri").default';Hi.default=Vd});var Qd=S(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.CodeGen=le.Name=le.nil=le.stringify=le.str=le._=le.KeywordCxt=void 0;var $0=Lr();Object.defineProperty(le,"KeywordCxt",{enumerable:!0,get:function(){return $0.KeywordCxt}});var Kt=O();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return Kt._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return Kt.str}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return Kt.stringify}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return Kt.nil}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return Kt.Name}});Object.defineProperty(le,"CodeGen",{enumerable:!0,get:function(){return Kt.CodeGen}});var S0=Wo(),Wd=Ur(),b0=vi(),Vr=Xo(),T0=O(),Hr=Dr(),rn=Zr(),Gi=D(),Kd=zd(),w0=Hd(),Yd=(t,e)=>new RegExp(t,e);Yd.code="new RegExp";var x0=["removeAdditional","useDefaults","coerceTypes"],z0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),E0={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},k0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Gd=200;function P0(t){var e,r,o,n,s,i,a,c,u,l,p,d,m,_,g,y,v,b,$,z,k,ge,Ee,kt,Cn;let tr=t.strict,jn=(e=t.code)===null||e===void 0?void 0:e.optimize,oc=jn===!0||jn===void 0?1:jn||0,nc=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:Yd,ph=(n=t.uriResolver)!==null&&n!==void 0?n:w0.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:tr)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:tr)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:tr)!==null&&l!==void 0?l:"log",strictTuples:(d=(p=t.strictTuples)!==null&&p!==void 0?p:tr)!==null&&d!==void 0?d:"log",strictRequired:(_=(m=t.strictRequired)!==null&&m!==void 0?m:tr)!==null&&_!==void 0?_:!1,code:t.code?{...t.code,optimize:oc,regExp:nc}:{optimize:oc,regExp:nc},loopRequired:(g=t.loopRequired)!==null&&g!==void 0?g:Gd,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:Gd,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:($=t.inlineRefs)!==null&&$!==void 0?$:!0,schemaId:(z=t.schemaId)!==null&&z!==void 0?z:"$id",addUsedSchema:(k=t.addUsedSchema)!==null&&k!==void 0?k:!0,validateSchema:(ge=t.validateSchema)!==null&&ge!==void 0?ge:!0,validateFormats:(Ee=t.validateFormats)!==null&&Ee!==void 0?Ee:!0,unicodeRegExp:(kt=t.unicodeRegExp)!==null&&kt!==void 0?kt:!0,int32range:(Cn=t.int32range)!==null&&Cn!==void 0?Cn:!0,uriResolver:ph}}var Kr=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...P0(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new T0.ValueScope({scope:{},prefixes:z0,es5:r,lines:o}),this.logger=C0(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,b0.getRules)(),Bd.call(this,E0,e,"NOT SUPPORTED"),Bd.call(this,k0,e,"DEPRECATED","warn"),this._metaOpts=N0.call(this),e.formats&&I0.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&O0.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),R0.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=Kd;o==="id"&&(n={...Kd},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let o;if(typeof e=="string"){if(o=this.getSchema(e),!o)throw new Error(`no schema with key or ref "${e}"`)}else o=this.compile(e);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(e,r){let o=this._addSchema(e,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,e,r);async function n(l,p){await s.call(this,l.$schema);let d=this._addSchema(l,p);return d.validate||i.call(this,d)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(p){if(!(p instanceof Wd.default))throw p;return a.call(this,p),await c.call(this,p.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:p}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${p} cannot be resolved`)}async function c(l){let p=await u.call(this,l);this.refs[l]||await s.call(this,p.$schema),this.refs[l]||this.addSchema(p,l,r)}async function u(l){let p=this._loading[l];if(p)return p;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(e,r,o,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,o,n);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Hr.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,o,r,n,!0),this}addMetaSchema(e,r,o=this.opts.validateSchema){return this.addSchema(e,r,!0,o),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let o;if(o=e.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,e);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(e){let r;for(;typeof(r=Jd.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new Vr.SchemaEnv({schema:{},schemaId:o});if(r=Vr.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Jd.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let o=e[this.opts.schemaId];return o&&(o=(0,Hr.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let o;if(typeof e=="string")o=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof e=="object"&&r===void 0){if(r=e,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Z0.call(this,o,r),!r)return(0,Gi.eachItem)(o,s=>Ki.call(this,s)),this;M0.call(this,r);let n={...r,type:(0,rn.getJSONTypes)(r.type),schemaType:(0,rn.getJSONTypes)(r.schemaType)};return(0,Gi.eachItem)(o,n.type.length===0?s=>Ki.call(this,s,n):s=>n.type.forEach(i=>Ki.call(this,s,n,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===e);n>=0&&o.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(e,r){let o=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let s=n.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=Xd(l))}}return e}_removeAllSchemas(e,r){for(let o in e){let n=e[o];(!r||r.test(o))&&(typeof n=="string"?delete e[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[o]))}}_addSchema(e,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;o=(0,Hr.normalizeId)(i||o);let u=Hr.getSchemaRefs.call(this,e,o);return c=new Vr.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Vr.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Vr.compileSchema.call(this,e)}finally{this.opts=r}}};Kr.ValidationError=S0.default;Kr.MissingRefError=Wd.default;le.default=Kr;function Bd(t,e,r,o="error"){for(let n in t){let s=n;s in e&&this.logger[o](`${r}: option ${n}. ${t[s]}`)}}function Jd(t){return t=(0,Hr.normalizeId)(t),this.schemas[t]||this.refs[t]}function R0(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function I0(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function O0(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function N0(){let t={...this.opts};for(let e of x0)delete t[e];return t}var A0={log(){},warn(){},error(){}};function C0(t){if(t===!1)return A0;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var j0=/^[a-z_$][a-z0-9_$:-]*$/i;function Z0(t,e){let{RULES:r}=this;if((0,Gi.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!j0.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Ki(t,e,r){var o;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,rn.getJSONTypes)(e.type),schemaType:(0,rn.getJSONTypes)(e.schemaType)}};e.before?D0.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(o=e.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function D0(t,e,r){let o=t.rules.findIndex(n=>n.keyword===r);o>=0?t.rules.splice(o,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function M0(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Xd(e)),t.validateSchema=this.compile(e,!0))}var q0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Xd(t){return{anyOf:[t,q0]}}});var ef=S(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});var L0={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Bi.default=L0});var nf=S(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.callRef=xt.getValidate=void 0;var U0=Ur(),tf=Oe(),xe=O(),Gt=et(),rf=Xo(),on=D(),F0={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:o}=t,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return p();let l=rf.resolveRef.call(c,u,n,r);if(l===void 0)throw new U0.default(o.opts.uriResolver,n,r);if(l instanceof rf.SchemaEnv)return d(l);return m(l);function p(){if(s===u)return nn(t,i,s,s.$async);let _=e.scopeValue("root",{ref:u});return nn(t,(0,xe._)`${_}.validate`,u,u.$async)}function d(_){let g=of(t,_);nn(t,g,_,_.$async)}function m(_){let g=e.scopeValue("schema",a.code.source===!0?{ref:_,code:(0,xe.stringify)(_)}:{ref:_}),y=e.name("valid"),v=t.subschema({schema:_,dataTypes:[],schemaPath:xe.nil,topSchemaRef:g,errSchemaPath:r},y);t.mergeEvaluated(v),t.ok(y)}}};function of(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,xe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}xt.getValidate=of;function nn(t,e,r,o){let{gen:n,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Gt.default.this:xe.nil;o?l():p();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let _=n.let("valid");n.try(()=>{n.code((0,xe._)`await ${(0,tf.callValidateCode)(t,e,u)}`),m(e),i||n.assign(_,!0)},g=>{n.if((0,xe._)`!(${g} instanceof ${s.ValidationError})`,()=>n.throw(g)),d(g),i||n.assign(_,!1)}),t.ok(_)}function p(){t.result((0,tf.callValidateCode)(t,e,u),()=>m(e),()=>d(e))}function d(_){let g=(0,xe._)`${_}.errors`;n.assign(Gt.default.vErrors,(0,xe._)`${Gt.default.vErrors} === null ? ${g} : ${Gt.default.vErrors}.concat(${g})`),n.assign(Gt.default.errors,(0,xe._)`${Gt.default.vErrors}.length`)}function m(_){var g;if(!s.opts.unevaluated)return;let y=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=on.mergeEvaluated.props(n,y.props,s.props));else{let v=n.var("props",(0,xe._)`${_}.evaluated.props`);s.props=on.mergeEvaluated.props(n,v,s.props,xe.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=on.mergeEvaluated.items(n,y.items,s.items));else{let v=n.var("items",(0,xe._)`${_}.evaluated.items`);s.items=on.mergeEvaluated.items(n,v,s.items,xe.Name)}}}xt.callRef=nn;xt.default=F0});var sf=S(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});var V0=ef(),H0=nf(),K0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",V0.default,H0.default];Ji.default=K0});var af=S(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var sn=O(),dt=sn.operators,an={maximum:{okStr:"<=",ok:dt.LTE,fail:dt.GT},minimum:{okStr:">=",ok:dt.GTE,fail:dt.LT},exclusiveMaximum:{okStr:"<",ok:dt.LT,fail:dt.GTE},exclusiveMinimum:{okStr:">",ok:dt.GT,fail:dt.LTE}},G0={message:({keyword:t,schemaCode:e})=>(0,sn.str)`must be ${an[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,sn._)`{comparison: ${an[t].okStr}, limit: ${e}}`},B0={keyword:Object.keys(an),type:"number",schemaType:"number",$data:!0,error:G0,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,sn._)`${r} ${an[e].fail} ${o} || isNaN(${r})`)}};Wi.default=B0});var cf=S(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var Gr=O(),J0={message:({schemaCode:t})=>(0,Gr.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Gr._)`{multipleOf: ${t}}`},W0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:J0,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,s=n.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,Gr._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,Gr._)`${i} !== parseInt(${i})`;t.fail$data((0,Gr._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Yi.default=W0});var lf=S(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});function uf(t){let e=t.length,r=0,o=0,n;for(;o=55296&&n<=56319&&o{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});var zt=O(),Y0=D(),X0=lf(),Q0={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,zt.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,zt._)`{limit: ${t}}`},eS={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Q0,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,s=e==="maxLength"?zt.operators.GT:zt.operators.LT,i=n.opts.unicode===!1?(0,zt._)`${r}.length`:(0,zt._)`${(0,Y0.useFunc)(t.gen,X0.default)}(${r})`;t.fail$data((0,zt._)`${i} ${s} ${o}`)}};Qi.default=eS});var df=S(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});var tS=Oe(),rS=D(),Bt=O(),oS={message:({schemaCode:t})=>(0,Bt.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Bt._)`{pattern: ${t}}`},nS={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:oS,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,Bt._)`new RegExp`:(0,rS.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Bt._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Bt._)`!${l}`)}else{let c=(0,tS.usePattern)(t,n);t.fail$data((0,Bt._)`!${c}.test(${r})`)}}};ea.default=nS});var ff=S(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});var Br=O(),sS={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Br.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Br._)`{limit: ${t}}`},iS={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:sS,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?Br.operators.GT:Br.operators.LT;t.fail$data((0,Br._)`Object.keys(${r}).length ${n} ${o}`)}};ta.default=iS});var mf=S(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});var Jr=Oe(),Wr=O(),aS=D(),cS={message:({params:{missingProperty:t}})=>(0,Wr.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Wr._)`{missingProperty: ${t}}`},uS={keyword:"required",type:"object",schemaType:"array",$data:!0,error:cS,code(t){let{gen:e,schema:r,schemaCode:o,data:n,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let m=t.parentSchema.properties,{definedProperties:_}=t.it;for(let g of r)if(m?.[g]===void 0&&!_.has(g)){let y=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,aS.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(Wr.nil,p);else for(let m of r)(0,Jr.checkReportMissingProp)(t,m)}function l(){let m=e.let("missing");if(c||s){let _=e.let("valid",!0);t.block$data(_,()=>d(m,_)),t.ok(_)}else e.if((0,Jr.checkMissingProp)(t,r,m)),(0,Jr.reportMissingProp)(t,m),e.else()}function p(){e.forOf("prop",o,m=>{t.setParams({missingProperty:m}),e.if((0,Jr.noPropertyInData)(e,n,m,a.ownProperties),()=>t.error())})}function d(m,_){t.setParams({missingProperty:m}),e.forOf(m,o,()=>{e.assign(_,(0,Jr.propertyInData)(e,n,m,a.ownProperties)),e.if((0,Wr.not)(_),()=>{t.error(),e.break()})},Wr.nil)}}};ra.default=uS});var hf=S(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});var Yr=O(),lS={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Yr.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Yr._)`{limit: ${t}}`},pS={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:lS,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?Yr.operators.GT:Yr.operators.LT;t.fail$data((0,Yr._)`${r}.length ${n} ${o}`)}};oa.default=pS});var cn=S(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var _f=Ei();_f.code='require("ajv/dist/runtime/equal").default';na.default=_f});var gf=S(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});var sa=Zr(),pe=O(),dS=D(),fS=cn(),mS={message:({params:{i:t,j:e}})=>(0,pe.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,pe._)`{i: ${t}, j: ${e}}`},hS={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:mS,code(t){let{gen:e,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=t;if(!o&&!n)return;let c=e.let("valid"),u=s.items?(0,sa.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,pe._)`${i} === false`),t.ok(c);function l(){let _=e.let("i",(0,pe._)`${r}.length`),g=e.let("j");t.setParams({i:_,j:g}),e.assign(c,!0),e.if((0,pe._)`${_} > 1`,()=>(p()?d:m)(_,g))}function p(){return u.length>0&&!u.some(_=>_==="object"||_==="array")}function d(_,g){let y=e.name("item"),v=(0,sa.checkDataTypes)(u,y,a.opts.strictNumbers,sa.DataType.Wrong),b=e.const("indices",(0,pe._)`{}`);e.for((0,pe._)`;${_}--;`,()=>{e.let(y,(0,pe._)`${r}[${_}]`),e.if(v,(0,pe._)`continue`),u.length>1&&e.if((0,pe._)`typeof ${y} == "string"`,(0,pe._)`${y} += "_"`),e.if((0,pe._)`typeof ${b}[${y}] == "number"`,()=>{e.assign(g,(0,pe._)`${b}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,pe._)`${b}[${y}] = ${_}`)})}function m(_,g){let y=(0,dS.useFunc)(e,fS.default),v=e.name("outer");e.label(v).for((0,pe._)`;${_}--;`,()=>e.for((0,pe._)`${g} = ${_}; ${g}--;`,()=>e.if((0,pe._)`${y}(${r}[${_}], ${r}[${g}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};ia.default=hS});var yf=S(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var aa=O(),_S=D(),gS=cn(),yS={message:"must be equal to constant",params:({schemaCode:t})=>(0,aa._)`{allowedValue: ${t}}`},vS={keyword:"const",$data:!0,error:yS,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:s}=t;o||s&&typeof s=="object"?t.fail$data((0,aa._)`!${(0,_S.useFunc)(e,gS.default)}(${r}, ${n})`):t.fail((0,aa._)`${s} !== ${r}`)}};ca.default=vS});var vf=S(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});var Xr=O(),$S=D(),SS=cn(),bS={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Xr._)`{allowedValues: ${t}}`},TS={keyword:"enum",schemaType:"array",$data:!0,error:bS,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,$S.useFunc)(e,SS.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,p);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let m=e.const("vSchema",s);l=(0,Xr.or)(...n.map((_,g)=>d(m,g)))}t.pass(l);function p(){e.assign(l,!1),e.forOf("v",s,m=>e.if((0,Xr._)`${u()}(${r}, ${m})`,()=>e.assign(l,!0).break()))}function d(m,_){let g=n[_];return typeof g=="object"&&g!==null?(0,Xr._)`${u()}(${r}, ${m}[${_}])`:(0,Xr._)`${r} === ${g}`}}};ua.default=TS});var $f=S(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});var wS=af(),xS=cf(),zS=pf(),ES=df(),kS=ff(),PS=mf(),RS=hf(),IS=gf(),OS=yf(),NS=vf(),AS=[wS.default,xS.default,zS.default,ES.default,kS.default,PS.default,RS.default,IS.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},OS.default,NS.default];la.default=AS});var da=S(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.validateAdditionalItems=void 0;var Et=O(),pa=D(),CS={message:({params:{len:t}})=>(0,Et.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Et._)`{limit: ${t}}`},jS={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:CS,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,pa.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Sf(t,o)}};function Sf(t,e){let{gen:r,schema:o,data:n,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Et._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,Et._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,pa.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,Et._)`${a} <= ${e.length}`);r.if((0,Et.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:pa.Type.Num},u),i.allErrors||r.if((0,Et.not)(u),()=>r.break())})}}Qr.validateAdditionalItems=Sf;Qr.default=jS});var fa=S(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.validateTuple=void 0;var bf=O(),un=D(),ZS=Oe(),DS={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Tf(t,"additionalItems",e);r.items=!0,!(0,un.alwaysValidSchema)(r,e)&&t.ok((0,ZS.validateArray)(t))}};function Tf(t,e,r=t.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=t;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=un.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,bf._)`${s}.length`);r.forEach((p,d)=>{(0,un.alwaysValidSchema)(a,p)||(o.if((0,bf._)`${u} > ${d}`,()=>t.subschema({keyword:i,schemaProp:d,dataProp:d},c)),t.ok(c))});function l(p){let{opts:d,errSchemaPath:m}=a,_=r.length,g=_===p.minItems&&(_===p.maxItems||p[e]===!1);if(d.strictTuples&&!g){let y=`"${i}" is ${_}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0,un.checkStrictMode)(a,y,d.strictTuples)}}}eo.validateTuple=Tf;eo.default=DS});var wf=S(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var MS=fa(),qS={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,MS.validateTuple)(t,"items")};ma.default=qS});var zf=S(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});var xf=O(),LS=D(),US=Oe(),FS=da(),VS={message:({params:{len:t}})=>(0,xf.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,xf._)`{limit: ${t}}`},HS={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:VS,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,LS.alwaysValidSchema)(o,e)&&(n?(0,FS.validateAdditionalItems)(t,n):t.ok((0,US.validateArray)(t)))}};ha.default=HS});var Ef=S(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var Ae=O(),ln=D(),KS={message:({params:{min:t,max:e}})=>e===void 0?(0,Ae.str)`must contain at least ${t} valid item(s)`:(0,Ae.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Ae._)`{minContains: ${t}}`:(0,Ae._)`{minContains: ${t}, maxContains: ${e}}`},GS={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:KS,code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,Ae._)`${n}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,ln.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,ln.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,ln.alwaysValidSchema)(s,r)){let g=(0,Ae._)`${l} >= ${i}`;a!==void 0&&(g=(0,Ae._)`${g} && ${l} <= ${a}`),t.pass(g);return}s.items=!0;let p=e.name("valid");a===void 0&&i===1?m(p,()=>e.if(p,()=>e.break())):i===0?(e.let(p,!0),a!==void 0&&e.if((0,Ae._)`${n}.length > 0`,d)):(e.let(p,!1),d()),t.result(p,()=>t.reset());function d(){let g=e.name("_valid"),y=e.let("count",0);m(g,()=>e.if(g,()=>_(y)))}function m(g,y){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:ln.Type.Num,compositeRule:!0},g),y()})}function _(g){e.code((0,Ae._)`${g}++`),a===void 0?e.if((0,Ae._)`${g} >= ${i}`,()=>e.assign(p,!0).break()):(e.if((0,Ae._)`${g} > ${a}`,()=>e.assign(p,!1).break()),i===1?e.assign(p,!0):e.if((0,Ae._)`${g} >= ${i}`,()=>e.assign(p,!0)))}}};_a.default=GS});var Rf=S(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.validateSchemaDeps=Ke.validatePropertyDeps=Ke.error=void 0;var ga=O(),BS=D(),to=Oe();Ke.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,ga.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,ga._)`{property: ${t}, + || ${i} === "boolean" || ${n} === null`).assign(a,(0,I._)`[${n}]`)}}}function hv({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,I._)`${e} !== undefined`,()=>t.assign((0,I._)`${e}[${r}]`,o))}function bi(t,e,r,o=Lt.Correct){let n=o===Lt.Correct?I.operators.EQ:I.operators.NEQ,s;switch(t){case"null":return(0,I._)`${e} ${n} null`;case"array":s=(0,I._)`Array.isArray(${e})`;break;case"object":s=(0,I._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,I._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,I._)`typeof ${e} ${n} ${t}`}return o===Lt.Correct?s:(0,I.not)(s);function i(a=I.nil){return(0,I.and)((0,I._)`typeof ${e} == "number"`,a,r?(0,I._)`isFinite(${e})`:I.nil)}}_e.checkDataType=bi;function Ti(t,e,r,o){if(t.length===1)return bi(t[0],e,r,o);let n,s=(0,Gp.toHash)(t);if(s.array&&s.object){let i=(0,I._)`typeof ${e} != "object"`;n=s.null?i:(0,I._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else n=I.nil;s.number&&delete s.integer;for(let i in s)n=(0,I.and)(n,bi(i,e,r,o));return n}_e.checkDataTypes=Ti;var _v={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,I._)`{type: ${t}}`:(0,I._)`{type: ${e}}`};function wi(t){let e=gv(t);(0,lv.reportError)(e,_v)}_e.reportTypeError=wi;function gv(t){let{gen:e,data:r,schema:o}=t,n=(0,Gp.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var Yp=S(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.assignDefaults=void 0;var Ut=O(),yv=D();function vv(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)Wp(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,s)=>Wp(t,s,n.default))}Ho.assignDefaults=vv;function Wp(t,e,r){let{gen:o,compositeRule:n,data:s,opts:i}=t;if(r===void 0)return;let a=(0,Ut._)`${s}${(0,Ut.getProperty)(e)}`;if(n){(0,yv.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Ut._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Ut._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,Ut._)`${a} = ${(0,Ut.stringify)(r)}`)}});var Oe=S(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.validateUnion=F.validateArray=F.usePattern=F.callValidateCode=F.schemaProperties=F.allSchemaProperties=F.noPropertyInData=F.propertyInData=F.isOwnProperty=F.hasPropFunc=F.reportMissingProp=F.checkMissingProp=F.checkReportMissingProp=void 0;var W=O(),xi=D(),ct=et(),$v=D();function Sv(t,e){let{gen:r,data:o,it:n}=t;r.if(Ei(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,W._)`${e}`},!0),t.error()})}F.checkReportMissingProp=Sv;function bv({gen:t,data:e,it:{opts:r}},o,n){return(0,W.or)(...o.map(s=>(0,W.and)(Ei(t,e,s,r.ownProperties),(0,W._)`${n} = ${s}`)))}F.checkMissingProp=bv;function Tv(t,e){t.setParams({missingProperty:e},!0),t.error()}F.reportMissingProp=Tv;function Xp(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,W._)`Object.prototype.hasOwnProperty`})}F.hasPropFunc=Xp;function zi(t,e,r){return(0,W._)`${Xp(t)}.call(${e}, ${r})`}F.isOwnProperty=zi;function wv(t,e,r,o){let n=(0,W._)`${e}${(0,W.getProperty)(r)} !== undefined`;return o?(0,W._)`${n} && ${zi(t,e,r)}`:n}F.propertyInData=wv;function Ei(t,e,r,o){let n=(0,W._)`${e}${(0,W.getProperty)(r)} === undefined`;return o?(0,W.or)(n,(0,W.not)(zi(t,e,r))):n}F.noPropertyInData=Ei;function Qp(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}F.allSchemaProperties=Qp;function xv(t,e){return Qp(e).filter(r=>!(0,xi.alwaysValidSchema)(t,e[r]))}F.schemaProperties=xv;function zv({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,l){let u=l?(0,W._)`${t}, ${e}, ${o}${n}`:e,p=[[ct.default.instancePath,(0,W.strConcat)(ct.default.instancePath,s)],[ct.default.parentData,i.parentData],[ct.default.parentDataProperty,i.parentDataProperty],[ct.default.rootData,ct.default.rootData]];i.opts.dynamicRef&&p.push([ct.default.dynamicAnchors,ct.default.dynamicAnchors]);let d=(0,W._)`${u}, ${r.object(...p)}`;return c!==W.nil?(0,W._)`${a}.call(${c}, ${d})`:(0,W._)`${a}(${d})`}F.callValidateCode=zv;var Ev=(0,W._)`new RegExp`;function kv({gen:t,it:{opts:e}},r){let o=e.unicodeRegExp?"u":"",{regExp:n}=e.code,s=n(r,o);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,W._)`${n.code==="new RegExp"?Ev:(0,$v.useFunc)(t,n)}(${r}, ${o})`})}F.usePattern=kv;function Pv(t){let{gen:e,data:r,keyword:o,it:n}=t,s=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,W._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:o,dataProp:l,dataPropType:xi.Type.Num},s),e.if((0,W.not)(s),a)})}}F.validateArray=Pv;function Rv(t){let{gen:e,schema:r,keyword:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,xi.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,l)=>{let u=t.subschema({keyword:o,schemaProp:l,compositeRule:!0},a);e.assign(i,(0,W._)`${i} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,W.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}F.validateUnion=Rv});var rd=S(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.validateKeywordUsage=Ve.validSchemaType=Ve.funcKeywordCode=Ve.macroKeywordCode=void 0;var $e=O(),bt=et(),Iv=Oe(),Ov=Cr();function Nv(t,e){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=t,a=e.macro.call(i.self,n,s,i),c=td(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:$e.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}Ve.macroKeywordCode=Nv;function Av(t,e){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=t;jv(c,e);let l=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,u=td(o,n,l),p=o.let("valid");t.block$data(p,d),t.ok((r=e.valid)!==null&&r!==void 0?r:p);function d(){if(e.errors===!1)g(),e.modifying&&ed(t),y(()=>t.error());else{let v=e.async?m():_();e.modifying&&ed(t),y(()=>Cv(t,v))}}function m(){let v=o.let("ruleErrs",null);return o.try(()=>g((0,$e._)`await `),b=>o.assign(p,!1).if((0,$e._)`${b} instanceof ${c.ValidationError}`,()=>o.assign(v,(0,$e._)`${b}.errors`),()=>o.throw(b))),v}function _(){let v=(0,$e._)`${u}.errors`;return o.assign(v,null),g($e.nil),v}function g(v=e.async?(0,$e._)`await `:$e.nil){let b=c.opts.passContext?bt.default.this:bt.default.self,$=!("compile"in e&&!a||e.schema===!1);o.assign(p,(0,$e._)`${v}${(0,Iv.callValidateCode)(t,u,b,$)}`,e.modifying)}function y(v){var b;o.if((0,$e.not)((b=e.valid)!==null&&b!==void 0?b:p),v)}}Ve.funcKeywordCode=Av;function ed(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,$e._)`${o.parentData}[${o.parentDataProperty}]`))}function Cv(t,e){let{gen:r}=t;r.if((0,$e._)`Array.isArray(${e})`,()=>{r.assign(bt.default.vErrors,(0,$e._)`${bt.default.vErrors} === null ? ${e} : ${bt.default.vErrors}.concat(${e})`).assign(bt.default.errors,(0,$e._)`${bt.default.vErrors}.length`),(0,Ov.extendErrors)(t)},()=>t.error())}function jv({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function td(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,$e.stringify)(r)})}function Zv(t,e,r=!1){return!e.length||e.some(o=>o==="array"?Array.isArray(t):o==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==o||r&&typeof t>"u")}Ve.validSchemaType=Zv;function Dv({schema:t,opts:e,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ve.validateKeywordUsage=Dv});var nd=S(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.extendSubschemaMode=ut.extendSubschemaData=ut.getSubschema=void 0;var He=O(),od=D();function Mv(t,{keyword:e,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,He._)`${t.schemaPath}${(0,He.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,He._)`${t.schemaPath}${(0,He.getProperty)(e)}${(0,He.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,od.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}ut.getSubschema=Mv;function qv(t,e,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:p}=e,d=a.let("data",(0,He._)`${e.data}${(0,He.getProperty)(r)}`,!0);c(d),t.errorPath=(0,He.str)`${l}${(0,od.getErrorPath)(r,o,p.jsPropertySyntax)}`,t.parentDataProperty=(0,He._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(n!==void 0){let l=n instanceof He.Name?n:a.let("data",n,!0);c(l),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}ut.extendSubschemaData=qv;function Lv(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(t.compositeRule=o),n!==void 0&&(t.createErrors=n),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}ut.extendSubschemaMode=Lv});var ki=S((jP,sd)=>{"use strict";sd.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var ad=S((ZP,id)=>{"use strict";var lt=id.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Ko(e,o,n,t,"",t)};lt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};lt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};lt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};lt.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Ko(t,e,r,o,n,s,i,a,c,l){if(o&&typeof o=="object"&&!Array.isArray(o)){e(o,n,s,i,a,c,l);for(var u in o){var p=o[u];if(Array.isArray(p)){if(u in lt.arrayKeywords)for(var d=0;d{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.getSchemaRefs=we.resolveUrl=we.normalizeId=we._getFullPath=we.getFullPath=we.inlineRef=void 0;var Fv=D(),Vv=ki(),Hv=ad(),Kv=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Gv(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Pi(t):e?cd(t)<=e:!1}we.inlineRef=Gv;var Bv=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Pi(t){for(let e in t){if(Bv.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Pi)||typeof r=="object"&&Pi(r))return!0}return!1}function cd(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Kv.has(r)&&(typeof t[r]=="object"&&(0,Fv.eachItem)(t[r],o=>e+=cd(o)),e===1/0))return 1/0}return e}function ud(t,e="",r){r!==!1&&(e=Ft(e));let o=t.parse(e);return ld(t,o)}we.getFullPath=ud;function ld(t,e){return t.serialize(e).split("#")[0]+"#"}we._getFullPath=ld;var Jv=/#\/?$/;function Ft(t){return t?t.replace(Jv,""):""}we.normalizeId=Ft;function Wv(t,e,r){return r=Ft(r),t.resolve(e,r)}we.resolveUrl=Wv;var Yv=/^[a-z_][-a-z0-9._]*$/i;function Xv(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Ft(t[r]||e),s={"":n},i=ud(o,n,!1),a={},c=new Set;return Hv(t,{allKeys:!0},(p,d,m,_)=>{if(_===void 0)return;let g=i+d,y=s[_];typeof p[r]=="string"&&(y=v.call(this,p[r])),b.call(this,p.$anchor),b.call(this,p.$dynamicAnchor),s[d]=y;function v($){let z=this.opts.uriResolver.resolve;if($=Ft(y?z(y,$):$),c.has($))throw u($);c.add($);let k=this.refs[$];return typeof k=="string"&&(k=this.refs[k]),typeof k=="object"?l(p,k.schema,$):$!==Ft(g)&&($[0]==="#"?(l(p,a[$],$),a[$]=p):this.refs[$]=g),$}function b($){if(typeof $=="string"){if(!Yv.test($))throw new Error(`invalid anchor "${$}"`);v.call(this,`#${$}`)}}}),a;function l(p,d,m){if(d!==void 0&&!Vv(p,d))throw u(m)}function u(p){return new Error(`reference "${p}" resolves to more than one schema`)}}we.getSchemaRefs=Xv});var qr=S(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.getData=pt.KeywordCxt=pt.validateFunctionCode=void 0;var hd=Vp(),pd=jr(),Ii=Si(),Go=jr(),Qv=Yp(),Mr=rd(),Ri=nd(),x=O(),P=et(),e$=Zr(),tt=D(),Dr=Cr();function t$(t){if(yd(t)&&(vd(t),gd(t))){n$(t);return}_d(t,()=>(0,hd.topBoolOrEmptySchema)(t))}pt.validateFunctionCode=t$;function _d({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},s){n.code.es5?t.func(e,(0,x._)`${P.default.data}, ${P.default.valCxt}`,o.$async,()=>{t.code((0,x._)`"use strict"; ${dd(r,n)}`),o$(t,n),t.code(s)}):t.func(e,(0,x._)`${P.default.data}, ${r$(n)}`,o.$async,()=>t.code(dd(r,n)).code(s))}function r$(t){return(0,x._)`{${P.default.instancePath}="", ${P.default.parentData}, ${P.default.parentDataProperty}, ${P.default.rootData}=${P.default.data}${t.dynamicRef?(0,x._)`, ${P.default.dynamicAnchors}={}`:x.nil}}={}`}function o$(t,e){t.if(P.default.valCxt,()=>{t.var(P.default.instancePath,(0,x._)`${P.default.valCxt}.${P.default.instancePath}`),t.var(P.default.parentData,(0,x._)`${P.default.valCxt}.${P.default.parentData}`),t.var(P.default.parentDataProperty,(0,x._)`${P.default.valCxt}.${P.default.parentDataProperty}`),t.var(P.default.rootData,(0,x._)`${P.default.valCxt}.${P.default.rootData}`),e.dynamicRef&&t.var(P.default.dynamicAnchors,(0,x._)`${P.default.valCxt}.${P.default.dynamicAnchors}`)},()=>{t.var(P.default.instancePath,(0,x._)`""`),t.var(P.default.parentData,(0,x._)`undefined`),t.var(P.default.parentDataProperty,(0,x._)`undefined`),t.var(P.default.rootData,P.default.data),e.dynamicRef&&t.var(P.default.dynamicAnchors,(0,x._)`{}`)})}function n$(t){let{schema:e,opts:r,gen:o}=t;_d(t,()=>{r.$comment&&e.$comment&&Sd(t),u$(t),o.let(P.default.vErrors,null),o.let(P.default.errors,0),r.unevaluated&&s$(t),$d(t),d$(t)})}function s$(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,x._)`${r}.evaluated`),e.if((0,x._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,x._)`${t.evaluated}.props`,(0,x._)`undefined`)),e.if((0,x._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,x._)`${t.evaluated}.items`,(0,x._)`undefined`))}function dd(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,x._)`/*# sourceURL=${r} */`:x.nil}function i$(t,e){if(yd(t)&&(vd(t),gd(t))){a$(t,e);return}(0,hd.boolOrEmptySchema)(t,e)}function gd({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function yd(t){return typeof t.schema!="boolean"}function a$(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&Sd(t),l$(t),p$(t);let s=o.const("_errs",P.default.errors);$d(t,s),o.var(e,(0,x._)`${s} === ${P.default.errors}`)}function vd(t){(0,tt.checkUnknownRules)(t),c$(t)}function $d(t,e){if(t.opts.jtd)return fd(t,[],!1,e);let r=(0,pd.getSchemaTypes)(t.schema),o=(0,pd.coerceAndCheckDataType)(t,r);fd(t,r,!o,e)}function c$(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,tt.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function u$(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,tt.checkStrictMode)(t,"default is ignored in the schema root")}function l$(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,e$.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function p$(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Sd({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)t.code((0,x._)`${P.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,x.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,x._)`${P.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function d$(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=t;r.$async?e.if((0,x._)`${P.default.errors} === 0`,()=>e.return(P.default.data),()=>e.throw((0,x._)`new ${n}(${P.default.vErrors})`)):(e.assign((0,x._)`${o}.errors`,P.default.vErrors),s.unevaluated&&f$(t),e.return((0,x._)`${P.default.errors} === 0`))}function f$({gen:t,evaluated:e,props:r,items:o}){r instanceof x.Name&&t.assign((0,x._)`${e}.props`,r),o instanceof x.Name&&t.assign((0,x._)`${e}.items`,o)}function fd(t,e,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:l}=t,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,tt.schemaHasRulesButRef)(s,u))){n.block(()=>Td(t,"$ref",u.all.$ref.definition));return}c.jtd||m$(t,e),n.block(()=>{for(let d of u.rules)p(d);p(u.post)});function p(d){(0,Ii.shouldUseGroup)(s,d)&&(d.type?(n.if((0,Go.checkDataType)(d.type,i,c.strictNumbers)),md(t,d),e.length===1&&e[0]===d.type&&r&&(n.else(),(0,Go.reportTypeError)(t)),n.endIf()):md(t,d),a||n.if((0,x._)`${P.default.errors} === ${o||0}`))}}function md(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,Qv.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Ii.shouldUseRule)(o,s)&&Td(t,s.keyword,s.definition,e.type)})}function m$(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(h$(t,e),t.opts.allowUnionTypes||_$(t,e),g$(t,t.dataTypes))}function h$(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{bd(t.dataTypes,r)||Oi(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),v$(t,e)}}function _$(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Oi(t,"use allowUnionTypes to allow union type keyword")}function g$(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Ii.shouldUseRule)(t.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>y$(e,i))&&Oi(t,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function y$(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function bd(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function v$(t,e){let r=[];for(let o of t.dataTypes)bd(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function Oi(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,tt.checkStrictMode)(t,e,t.opts.strictTypes)}var Bo=class{constructor(e,r,o){if((0,Mr.validateKeywordUsage)(e,r,o),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=o,this.data=e.data,this.schema=e.schema[o],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,tt.schemaRefOrVal)(e,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",wd(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Mr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",P.default.errors))}result(e,r,o){this.failResult((0,x.not)(e),r,o)}failResult(e,r,o){this.gen.if(e),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,x.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,x._)`${r} !== undefined && (${(0,x.or)(this.invalid$data(),e)})`)}error(e,r,o){if(r){this.setParams(r),this._error(e,o),this.setParams({});return}this._error(e,o)}_error(e,r){(e?Dr.reportExtraError:Dr.reportError)(this,this.def.error,r)}$dataError(){(0,Dr.reportError)(this,this.def.$dataError||Dr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Dr.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,o=x.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=x.nil,r=x.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,x.or)((0,x._)`${n} === undefined`,r)),e!==x.nil&&o.assign(e,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==x.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,x.or)(i(),a());function i(){if(o.length){if(!(r instanceof x.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,x._)`${(0,Go.checkDataTypes)(c,r,s.opts.strictNumbers,Go.DataType.Wrong)}`}return x.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,x._)`!${c}(${r})`}return x.nil}}subschema(e,r){let o=(0,Ri.getSubschema)(this.it,e);(0,Ri.extendSubschemaData)(o,this.it,e),(0,Ri.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return i$(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=tt.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=tt.mergeEvaluated.items(n,e.items,o.items,r)))}mergeValidEvaluated(e,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,x.Name)),!0}};pt.KeywordCxt=Bo;function Td(t,e,r,o){let n=new Bo(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Mr.funcKeywordCode)(n,r):"macro"in r?(0,Mr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Mr.funcKeywordCode)(n,r)}var $$=/^\/(?:[^~]|~0|~1)*$/,S$=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function wd(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,s;if(t==="")return P.default.rootData;if(t[0]==="/"){if(!$$.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,s=P.default.rootData}else{let l=S$.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+l[1];if(n=l[2],n==="#"){if(u>=e)throw new Error(c("property/index",u));return o[e-u]}if(u>e)throw new Error(c("data",u));if(s=r[e-u],!n)return s}let i=s,a=n.split("/");for(let l of a)l&&(s=(0,x._)`${s}${(0,x.getProperty)((0,tt.unescapeJsonPointer)(l))}`,i=(0,x._)`${i} && ${s}`);return i;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}pt.getData=wd});var Jo=S(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});var Ni=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Ai.default=Ni});var Lr=S(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});var Ci=Zr(),ji=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Ci.resolveUrl)(e,r,o),this.missingSchema=(0,Ci.normalizeId)((0,Ci.getFullPath)(e,this.missingRef))}};Zi.default=ji});var Yo=S(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.resolveSchema=Ne.getCompilingSchema=Ne.resolveRef=Ne.compileSchema=Ne.SchemaEnv=void 0;var Ze=O(),b$=Jo(),Tt=et(),De=Zr(),xd=D(),T$=qr(),Vt=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let o;typeof e.schema=="object"&&(o=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,De.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};Ne.SchemaEnv=Vt;function Mi(t){let e=zd.call(this,t);if(e)return e;let r=(0,De.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Ze.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:b$.default,code:(0,Ze._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let l={gen:i,allErrors:this.opts.allErrors,data:Tt.default.data,parentData:Tt.default.parentData,parentDataProperty:Tt.default.parentDataProperty,dataNames:[Tt.default.data],dataPathArr:[Ze.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Ze.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Ze.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ze._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,T$.validateFunctionCode)(l),i.optimize(this.opts.code.optimize);let p=i.toString();u=`${i.scopeRefs(Tt.default.scope)}return ${p}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let m=new Function(`${Tt.default.self}`,`${Tt.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=t.schema,m.schemaEnv=t,t.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:p,scopeValues:i._values}),this.opts.unevaluated){let{props:_,items:g}=l;m.evaluated={props:_ instanceof Ze.Name?void 0:_,items:g instanceof Ze.Name?void 0:g,dynamicProps:_ instanceof Ze.Name,dynamicItems:g instanceof Ze.Name},m.source&&(m.source.evaluated=(0,Ze.stringify)(m.evaluated))}return t.validate=m,t}catch(p){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),p}finally{this._compilations.delete(t)}}Ne.compileSchema=Mi;function w$(t,e,r){var o;r=(0,De.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let s=E$.call(this,t,r);if(s===void 0){let i=(o=t.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new Vt({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=x$.call(this,s)}Ne.resolveRef=w$;function x$(t){return(0,De.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Mi.call(this,t)}function zd(t){for(let e of this._compilations)if(z$(e,t))return e}Ne.getCompilingSchema=zd;function z$(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function E$(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Wo.call(this,t,e)}function Wo(t,e){let r=this.opts.uriResolver.parse(e),o=(0,De._getFullPath)(this.opts.uriResolver,r),n=(0,De.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return Di.call(this,r,t);let s=(0,De.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Wo.call(this,t,i);return typeof a?.schema!="object"?void 0:Di.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Mi.call(this,i),s===(0,De.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,l=a[c];return l&&(n=(0,De.resolveUrl)(this.opts.uriResolver,n,l)),new Vt({schema:a,schemaId:c,root:t,baseId:n})}return Di.call(this,r,i)}}Ne.resolveSchema=Wo;var k$=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Di(t,{baseId:e,schema:r,root:o}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,xd.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!k$.has(a)&&l&&(e=(0,De.resolveUrl)(this.opts.uriResolver,e,l))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,xd.schemaHasRulesButRef)(r,this.RULES)){let a=(0,De.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=Wo.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Vt({schema:r,schemaId:i,root:o,baseId:e}),s.schema!==s.root.schema)return s}});var Ed=S((FP,P$)=>{P$.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Ui=S((VP,Nd)=>{"use strict";var R$=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Pd=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),qi=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Rd=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),I$=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Li(t){let e="",r=0,o=0;for(o=0;o=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o];break}for(o+=1;o=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o]}return e}var O$=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function kd(t){return t.length=0,!0}function N$(t,e,r){if(t.length){let o=Li(t);if(o!=="")e.push(o);else return r.error=!0,!1;t.length=0}return!0}function A$(t){let e=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=N$;for(let c=0;c7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),o.push(":");continue}else if(l==="%"){if(!a(n,o,r))break;a=kd}else{n.push(l);continue}}return n.length&&(a===kd?r.zone=n.join(""):i?o.push(n.join("")):o.push(Li(n))),r.address=o.join(""),r}function Id(t){if(C$(t,":")<2)return{host:t,isIPV6:!1};let e=A$(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,o=e.address;return e.zone&&(r+="%"+e.zone,o+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:o}}}function C$(t,e){let r=0;for(let o=0;oZ$[o])}function q$(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let o=0;o{"use strict";var{isUUID:V$}=Ui(),H$=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,K$=["http","https","ws","wss","urn","urn:uuid"];function G$(t){return K$.indexOf(t)!==-1}function Fi(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function Ad(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Cd(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function B$(t){return t.secure=Fi(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function J$(t){if((t.port===(Fi(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function W$(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(H$);if(r){let o=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${o}:${e.nid||t.nid}`,s=Vi(n);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Y$(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),n=`${r}:${e.nid||o}`,s=Vi(n);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${o||e.nid}:${a}`,e.skipEscape=!0,i}function X$(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!V$(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Q$(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var jd={scheme:"http",domainHost:!0,parse:Ad,serialize:Cd},e0={scheme:"https",domainHost:jd.domainHost,parse:Ad,serialize:Cd},Xo={scheme:"ws",domainHost:!0,parse:B$,serialize:J$},t0={scheme:"wss",domainHost:Xo.domainHost,parse:Xo.parse,serialize:Xo.serialize},r0={scheme:"urn",parse:W$,serialize:Y$,skipNormalize:!0},o0={scheme:"urn:uuid",parse:X$,serialize:Q$,skipNormalize:!0},Qo={http:jd,https:e0,ws:Xo,wss:t0,urn:r0,"urn:uuid":o0};Object.setPrototypeOf(Qo,null);function Vi(t){return t&&(Qo[t]||Qo[t.toLowerCase()])||void 0}Zd.exports={wsIsSecure:Fi,SCHEMES:Qo,isValidSchemeName:G$,getSchemeHandler:Vi}});var Fd=S((KP,rn)=>{"use strict";var{normalizeIPv6:n0,removeDotSegments:Ur,recomposeAuthority:s0,normalizePercentEncoding:i0,normalizePathEncoding:a0,escapePreservingEscapes:c0,reescapeHostDelimiters:u0,isIPv4:l0,nonSimpleDomain:p0}=Ui(),{SCHEMES:d0,getSchemeHandler:qd}=Dd();function f0(t,e){return typeof t=="string"?t=$0(t,e):typeof t=="object"&&(t=tn(wt(t,e),e)),t}function m0(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:n,malformedAuthorityOrPort:s}=en(t,o),{parsed:i,malformedAuthorityOrPort:a}=en(e,o);if(s||a)throw new Error(n.error||i.error||"URI is malformed.");let c=Ld(n,i,o,!0);return o.skipEscape=!0,wt(c,o)}function Ld(t,e,r,o){let n={};return o||(t=tn(wt(t,r),r),e=tn(wt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Ur(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Ur(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=Ur(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=Ur(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function h0(t,e,r){let o=Md(t,r),n=Md(e,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function wt(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},e),n=[],s=qd(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=i0(r.path):(r.path=c0(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=s0(r);if(i!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(i),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(a=Ur(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var _0=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,g0=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,y0=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function v0(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function en(t,e){let r=Object.assign({},e),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(g0);i!==null&&i[1].indexOf("\\")!==-1&&(o.error="URI authority must not contain a literal backslash.",n=!0);let a=t.match(y0);if(a!==null){let l=a[1],u=l.replace(/[\t\n\r]/g,"");u.length>=2&&(u.slice(0,2)!=="//"?(o.error=o.error||"URI authority must not contain a literal backslash.",n=!0):l.length!==u.length&&(o.error=o.error||"URI authority introducer must not contain whitespace.",n=!0))}let c=t.match(_0);if(c){o.scheme=c[1],o.userinfo=c[3],o.host=c[4],o.port=parseInt(c[5],10),o.path=c[6]||"",o.query=c[7],o.fragment=c[8],isNaN(o.port)&&(o.port=c[5]);let l=v0(o,c);if(l!==void 0&&(o.error=o.error||l,n=!0),o.host)if(l0(o.host)===!1){let d=n0(o.host);o.host=d.host.toLowerCase(),s=d.isIPV6}else s=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let u=qd(r.scheme||o.scheme);if(!r.unicodeSupport&&(!u||!u.unicodeSupport)&&o.host&&(r.domainHost||u&&u.domainHost)&&s===!1&&p0(o.host))try{o.host=new URL("http://"+o.host).hostname}catch(p){o.error=o.error||"Host's domain name can not be converted to ASCII: "+p}if((!u||u&&!u.skipNormalize)&&(t.indexOf("%")!==-1&&(o.scheme!==void 0&&(o.scheme=unescape(o.scheme)),o.host!==void 0&&(o.host=u0(unescape(o.host),s))),o.path&&(o.path=a0(o.path)),o.fragment))try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}u&&u.parse&&u.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function tn(t,e){return en(t,e).parsed}function $0(t,e){return Ud(t,e).normalized}function Ud(t,e){let{parsed:r,malformedAuthorityOrPort:o}=en(t,e);return{normalized:o?t:wt(r,e),malformedAuthorityOrPort:o}}function Md(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:o}=Ud(t,e);return o?void 0:r}if(typeof t=="object")return wt(t,e)}var Hi={SCHEMES:d0,normalize:f0,resolve:m0,resolveComponent:Ld,equal:h0,serialize:wt,parse:tn};rn.exports=Hi;rn.exports.default=Hi;rn.exports.fastUri=Hi});var Hd=S(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});var Vd=Fd();Vd.code='require("ajv/dist/runtime/uri").default';Ki.default=Vd});var Qd=S(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.CodeGen=le.Name=le.nil=le.stringify=le.str=le._=le.KeywordCxt=void 0;var S0=qr();Object.defineProperty(le,"KeywordCxt",{enumerable:!0,get:function(){return S0.KeywordCxt}});var Ht=O();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return Ht._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return Ht.str}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return Ht.stringify}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return Ht.nil}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return Ht.Name}});Object.defineProperty(le,"CodeGen",{enumerable:!0,get:function(){return Ht.CodeGen}});var b0=Jo(),Wd=Lr(),T0=$i(),Fr=Yo(),w0=O(),Vr=Zr(),on=jr(),Bi=D(),Kd=Ed(),x0=Hd(),Yd=(t,e)=>new RegExp(t,e);Yd.code="new RegExp";var z0=["removeAdditional","useDefaults","coerceTypes"],E0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),k0={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},P0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Gd=200;function R0(t){var e,r,o,n,s,i,a,c,l,u,p,d,m,_,g,y,v,b,$,z,k,ge,Ee,kt,jn;let er=t.strict,Zn=(e=t.code)===null||e===void 0?void 0:e.optimize,nc=Zn===!0||Zn===void 0?1:Zn||0,sc=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:Yd,ph=(n=t.uriResolver)!==null&&n!==void 0?n:x0.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:er)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:er)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:er)!==null&&u!==void 0?u:"log",strictTuples:(d=(p=t.strictTuples)!==null&&p!==void 0?p:er)!==null&&d!==void 0?d:"log",strictRequired:(_=(m=t.strictRequired)!==null&&m!==void 0?m:er)!==null&&_!==void 0?_:!1,code:t.code?{...t.code,optimize:nc,regExp:sc}:{optimize:nc,regExp:sc},loopRequired:(g=t.loopRequired)!==null&&g!==void 0?g:Gd,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:Gd,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:($=t.inlineRefs)!==null&&$!==void 0?$:!0,schemaId:(z=t.schemaId)!==null&&z!==void 0?z:"$id",addUsedSchema:(k=t.addUsedSchema)!==null&&k!==void 0?k:!0,validateSchema:(ge=t.validateSchema)!==null&&ge!==void 0?ge:!0,validateFormats:(Ee=t.validateFormats)!==null&&Ee!==void 0?Ee:!0,unicodeRegExp:(kt=t.unicodeRegExp)!==null&&kt!==void 0?kt:!0,int32range:(jn=t.int32range)!==null&&jn!==void 0?jn:!0,uriResolver:ph}}var Hr=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...R0(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new w0.ValueScope({scope:{},prefixes:E0,es5:r,lines:o}),this.logger=j0(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,T0.getRules)(),Bd.call(this,k0,e,"NOT SUPPORTED"),Bd.call(this,P0,e,"DEPRECATED","warn"),this._metaOpts=A0.call(this),e.formats&&O0.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&N0.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),I0.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=Kd;o==="id"&&(n={...Kd},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let o;if(typeof e=="string"){if(o=this.getSchema(e),!o)throw new Error(`no schema with key or ref "${e}"`)}else o=this.compile(e);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(e,r){let o=this._addSchema(e,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,e,r);async function n(u,p){await s.call(this,u.$schema);let d=this._addSchema(u,p);return d.validate||i.call(this,d)}async function s(u){u&&!this.getSchema(u)&&await n.call(this,{$ref:u},!0)}async function i(u){try{return this._compileSchemaEnv(u)}catch(p){if(!(p instanceof Wd.default))throw p;return a.call(this,p),await c.call(this,p.missingSchema),i.call(this,u)}}function a({missingSchema:u,missingRef:p}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${p} cannot be resolved`)}async function c(u){let p=await l.call(this,u);this.refs[u]||await s.call(this,p.$schema),this.refs[u]||this.addSchema(p,u,r)}async function l(u){let p=this._loading[u];if(p)return p;try{return await(this._loading[u]=o(u))}finally{delete this._loading[u]}}}addSchema(e,r,o,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,o,n);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Vr.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,o,r,n,!0),this}addMetaSchema(e,r,o=this.opts.validateSchema){return this.addSchema(e,r,!0,o),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let o;if(o=e.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,e);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(e){let r;for(;typeof(r=Jd.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new Fr.SchemaEnv({schema:{},schemaId:o});if(r=Fr.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Jd.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let o=e[this.opts.schemaId];return o&&(o=(0,Vr.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let o;if(typeof e=="string")o=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof e=="object"&&r===void 0){if(r=e,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(D0.call(this,o,r),!r)return(0,Bi.eachItem)(o,s=>Gi.call(this,s)),this;q0.call(this,r);let n={...r,type:(0,on.getJSONTypes)(r.type),schemaType:(0,on.getJSONTypes)(r.schemaType)};return(0,Bi.eachItem)(o,n.type.length===0?s=>Gi.call(this,s,n):s=>n.type.forEach(i=>Gi.call(this,s,n,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===e);n>=0&&o.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(e,r){let o=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let s=n.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=i[a];l&&u&&(i[a]=Xd(u))}}return e}_removeAllSchemas(e,r){for(let o in e){let n=e[o];(!r||r.test(o))&&(typeof n=="string"?delete e[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[o]))}}_addSchema(e,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;o=(0,Vr.normalizeId)(i||o);let l=Vr.getSchemaRefs.call(this,e,o);return c=new Fr.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:o,localRefs:l}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Fr.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Fr.compileSchema.call(this,e)}finally{this.opts=r}}};Hr.ValidationError=b0.default;Hr.MissingRefError=Wd.default;le.default=Hr;function Bd(t,e,r,o="error"){for(let n in t){let s=n;s in e&&this.logger[o](`${r}: option ${n}. ${t[s]}`)}}function Jd(t){return t=(0,Vr.normalizeId)(t),this.schemas[t]||this.refs[t]}function I0(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function O0(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function N0(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function A0(){let t={...this.opts};for(let e of z0)delete t[e];return t}var C0={log(){},warn(){},error(){}};function j0(t){if(t===!1)return C0;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Z0=/^[a-z_$][a-z0-9_$:-]*$/i;function D0(t,e){let{RULES:r}=this;if((0,Bi.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!Z0.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Gi(t,e,r){var o;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,on.getJSONTypes)(e.type),schemaType:(0,on.getJSONTypes)(e.schemaType)}};e.before?M0.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(o=e.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function M0(t,e,r){let o=t.rules.findIndex(n=>n.keyword===r);o>=0?t.rules.splice(o,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function q0(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Xd(e)),t.validateSchema=this.compile(e,!0))}var L0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Xd(t){return{anyOf:[t,L0]}}});var ef=S(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});var U0={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ji.default=U0});var nf=S(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.callRef=xt.getValidate=void 0;var F0=Lr(),tf=Oe(),xe=O(),Kt=et(),rf=Yo(),nn=D(),V0={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:o}=t,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:l}=s;if((r==="#"||r==="#/")&&n===l.baseId)return p();let u=rf.resolveRef.call(c,l,n,r);if(u===void 0)throw new F0.default(o.opts.uriResolver,n,r);if(u instanceof rf.SchemaEnv)return d(u);return m(u);function p(){if(s===l)return sn(t,i,s,s.$async);let _=e.scopeValue("root",{ref:l});return sn(t,(0,xe._)`${_}.validate`,l,l.$async)}function d(_){let g=of(t,_);sn(t,g,_,_.$async)}function m(_){let g=e.scopeValue("schema",a.code.source===!0?{ref:_,code:(0,xe.stringify)(_)}:{ref:_}),y=e.name("valid"),v=t.subschema({schema:_,dataTypes:[],schemaPath:xe.nil,topSchemaRef:g,errSchemaPath:r},y);t.mergeEvaluated(v),t.ok(y)}}};function of(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,xe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}xt.getValidate=of;function sn(t,e,r,o){let{gen:n,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,l=c.passContext?Kt.default.this:xe.nil;o?u():p();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let _=n.let("valid");n.try(()=>{n.code((0,xe._)`await ${(0,tf.callValidateCode)(t,e,l)}`),m(e),i||n.assign(_,!0)},g=>{n.if((0,xe._)`!(${g} instanceof ${s.ValidationError})`,()=>n.throw(g)),d(g),i||n.assign(_,!1)}),t.ok(_)}function p(){t.result((0,tf.callValidateCode)(t,e,l),()=>m(e),()=>d(e))}function d(_){let g=(0,xe._)`${_}.errors`;n.assign(Kt.default.vErrors,(0,xe._)`${Kt.default.vErrors} === null ? ${g} : ${Kt.default.vErrors}.concat(${g})`),n.assign(Kt.default.errors,(0,xe._)`${Kt.default.vErrors}.length`)}function m(_){var g;if(!s.opts.unevaluated)return;let y=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=nn.mergeEvaluated.props(n,y.props,s.props));else{let v=n.var("props",(0,xe._)`${_}.evaluated.props`);s.props=nn.mergeEvaluated.props(n,v,s.props,xe.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=nn.mergeEvaluated.items(n,y.items,s.items));else{let v=n.var("items",(0,xe._)`${_}.evaluated.items`);s.items=nn.mergeEvaluated.items(n,v,s.items,xe.Name)}}}xt.callRef=sn;xt.default=V0});var sf=S(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var H0=ef(),K0=nf(),G0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",H0.default,K0.default];Wi.default=G0});var af=S(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var an=O(),dt=an.operators,cn={maximum:{okStr:"<=",ok:dt.LTE,fail:dt.GT},minimum:{okStr:">=",ok:dt.GTE,fail:dt.LT},exclusiveMaximum:{okStr:"<",ok:dt.LT,fail:dt.GTE},exclusiveMinimum:{okStr:">",ok:dt.GT,fail:dt.LTE}},B0={message:({keyword:t,schemaCode:e})=>(0,an.str)`must be ${cn[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,an._)`{comparison: ${cn[t].okStr}, limit: ${e}}`},J0={keyword:Object.keys(cn),type:"number",schemaType:"number",$data:!0,error:B0,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,an._)`${r} ${cn[e].fail} ${o} || isNaN(${r})`)}};Yi.default=J0});var cf=S(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var Kr=O(),W0={message:({schemaCode:t})=>(0,Kr.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Kr._)`{multipleOf: ${t}}`},Y0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:W0,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,s=n.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,Kr._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,Kr._)`${i} !== parseInt(${i})`;t.fail$data((0,Kr._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Xi.default=Y0});var lf=S(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});function uf(t){let e=t.length,r=0,o=0,n;for(;o=55296&&n<=56319&&o{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});var zt=O(),X0=D(),Q0=lf(),eS={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,zt.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,zt._)`{limit: ${t}}`},tS={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:eS,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,s=e==="maxLength"?zt.operators.GT:zt.operators.LT,i=n.opts.unicode===!1?(0,zt._)`${r}.length`:(0,zt._)`${(0,X0.useFunc)(t.gen,Q0.default)}(${r})`;t.fail$data((0,zt._)`${i} ${s} ${o}`)}};ea.default=tS});var df=S(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});var rS=Oe(),oS=D(),Gt=O(),nS={message:({schemaCode:t})=>(0,Gt.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Gt._)`{pattern: ${t}}`},sS={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:nS,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,l=c.code==="new RegExp"?(0,Gt._)`new RegExp`:(0,oS.useFunc)(e,c),u=e.let("valid");e.try(()=>e.assign(u,(0,Gt._)`${l}(${s}, ${a}).test(${r})`),()=>e.assign(u,!1)),t.fail$data((0,Gt._)`!${u}`)}else{let c=(0,rS.usePattern)(t,n);t.fail$data((0,Gt._)`!${c}.test(${r})`)}}};ta.default=sS});var ff=S(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});var Gr=O(),iS={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Gr.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Gr._)`{limit: ${t}}`},aS={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:iS,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?Gr.operators.GT:Gr.operators.LT;t.fail$data((0,Gr._)`Object.keys(${r}).length ${n} ${o}`)}};ra.default=aS});var mf=S(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});var Br=Oe(),Jr=O(),cS=D(),uS={message:({params:{missingProperty:t}})=>(0,Jr.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Jr._)`{missingProperty: ${t}}`},lS={keyword:"required",type:"object",schemaType:"array",$data:!0,error:uS,code(t){let{gen:e,schema:r,schemaCode:o,data:n,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?l():u(),a.strictRequired){let m=t.parentSchema.properties,{definedProperties:_}=t.it;for(let g of r)if(m?.[g]===void 0&&!_.has(g)){let y=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,cS.checkStrictMode)(i,v,i.opts.strictRequired)}}function l(){if(c||s)t.block$data(Jr.nil,p);else for(let m of r)(0,Br.checkReportMissingProp)(t,m)}function u(){let m=e.let("missing");if(c||s){let _=e.let("valid",!0);t.block$data(_,()=>d(m,_)),t.ok(_)}else e.if((0,Br.checkMissingProp)(t,r,m)),(0,Br.reportMissingProp)(t,m),e.else()}function p(){e.forOf("prop",o,m=>{t.setParams({missingProperty:m}),e.if((0,Br.noPropertyInData)(e,n,m,a.ownProperties),()=>t.error())})}function d(m,_){t.setParams({missingProperty:m}),e.forOf(m,o,()=>{e.assign(_,(0,Br.propertyInData)(e,n,m,a.ownProperties)),e.if((0,Jr.not)(_),()=>{t.error(),e.break()})},Jr.nil)}}};oa.default=lS});var hf=S(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var Wr=O(),pS={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Wr.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Wr._)`{limit: ${t}}`},dS={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:pS,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?Wr.operators.GT:Wr.operators.LT;t.fail$data((0,Wr._)`${r}.length ${n} ${o}`)}};na.default=dS});var un=S(sa=>{"use strict";Object.defineProperty(sa,"__esModule",{value:!0});var _f=ki();_f.code='require("ajv/dist/runtime/equal").default';sa.default=_f});var gf=S(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});var ia=jr(),pe=O(),fS=D(),mS=un(),hS={message:({params:{i:t,j:e}})=>(0,pe.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,pe._)`{i: ${t}, j: ${e}}`},_S={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:hS,code(t){let{gen:e,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=t;if(!o&&!n)return;let c=e.let("valid"),l=s.items?(0,ia.getSchemaTypes)(s.items):[];t.block$data(c,u,(0,pe._)`${i} === false`),t.ok(c);function u(){let _=e.let("i",(0,pe._)`${r}.length`),g=e.let("j");t.setParams({i:_,j:g}),e.assign(c,!0),e.if((0,pe._)`${_} > 1`,()=>(p()?d:m)(_,g))}function p(){return l.length>0&&!l.some(_=>_==="object"||_==="array")}function d(_,g){let y=e.name("item"),v=(0,ia.checkDataTypes)(l,y,a.opts.strictNumbers,ia.DataType.Wrong),b=e.const("indices",(0,pe._)`{}`);e.for((0,pe._)`;${_}--;`,()=>{e.let(y,(0,pe._)`${r}[${_}]`),e.if(v,(0,pe._)`continue`),l.length>1&&e.if((0,pe._)`typeof ${y} == "string"`,(0,pe._)`${y} += "_"`),e.if((0,pe._)`typeof ${b}[${y}] == "number"`,()=>{e.assign(g,(0,pe._)`${b}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,pe._)`${b}[${y}] = ${_}`)})}function m(_,g){let y=(0,fS.useFunc)(e,mS.default),v=e.name("outer");e.label(v).for((0,pe._)`;${_}--;`,()=>e.for((0,pe._)`${g} = ${_}; ${g}--;`,()=>e.if((0,pe._)`${y}(${r}[${_}], ${r}[${g}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};aa.default=_S});var yf=S(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});var ca=O(),gS=D(),yS=un(),vS={message:"must be equal to constant",params:({schemaCode:t})=>(0,ca._)`{allowedValue: ${t}}`},$S={keyword:"const",$data:!0,error:vS,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:s}=t;o||s&&typeof s=="object"?t.fail$data((0,ca._)`!${(0,gS.useFunc)(e,yS.default)}(${r}, ${n})`):t.fail((0,ca._)`${s} !== ${r}`)}};ua.default=$S});var vf=S(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});var Yr=O(),SS=D(),bS=un(),TS={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Yr._)`{allowedValues: ${t}}`},wS={keyword:"enum",schemaType:"array",$data:!0,error:TS,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,l=()=>c??(c=(0,SS.useFunc)(e,bS.default)),u;if(a||o)u=e.let("valid"),t.block$data(u,p);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let m=e.const("vSchema",s);u=(0,Yr.or)(...n.map((_,g)=>d(m,g)))}t.pass(u);function p(){e.assign(u,!1),e.forOf("v",s,m=>e.if((0,Yr._)`${l()}(${r}, ${m})`,()=>e.assign(u,!0).break()))}function d(m,_){let g=n[_];return typeof g=="object"&&g!==null?(0,Yr._)`${l()}(${r}, ${m}[${_}])`:(0,Yr._)`${r} === ${g}`}}};la.default=wS});var $f=S(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var xS=af(),zS=cf(),ES=pf(),kS=df(),PS=ff(),RS=mf(),IS=hf(),OS=gf(),NS=yf(),AS=vf(),CS=[xS.default,zS.default,ES.default,kS.default,PS.default,RS.default,IS.default,OS.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},NS.default,AS.default];pa.default=CS});var fa=S(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.validateAdditionalItems=void 0;var Et=O(),da=D(),jS={message:({params:{len:t}})=>(0,Et.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Et._)`{limit: ${t}}`},ZS={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:jS,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,da.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Sf(t,o)}};function Sf(t,e){let{gen:r,schema:o,data:n,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Et._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,Et._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,da.alwaysValidSchema)(i,o)){let l=r.var("valid",(0,Et._)`${a} <= ${e.length}`);r.if((0,Et.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,a,u=>{t.subschema({keyword:s,dataProp:u,dataPropType:da.Type.Num},l),i.allErrors||r.if((0,Et.not)(l),()=>r.break())})}}Xr.validateAdditionalItems=Sf;Xr.default=ZS});var ma=S(Qr=>{"use strict";Object.defineProperty(Qr,"__esModule",{value:!0});Qr.validateTuple=void 0;var bf=O(),ln=D(),DS=Oe(),MS={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Tf(t,"additionalItems",e);r.items=!0,!(0,ln.alwaysValidSchema)(r,e)&&t.ok((0,DS.validateArray)(t))}};function Tf(t,e,r=t.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=t;u(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=ln.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),l=o.const("len",(0,bf._)`${s}.length`);r.forEach((p,d)=>{(0,ln.alwaysValidSchema)(a,p)||(o.if((0,bf._)`${l} > ${d}`,()=>t.subschema({keyword:i,schemaProp:d,dataProp:d},c)),t.ok(c))});function u(p){let{opts:d,errSchemaPath:m}=a,_=r.length,g=_===p.minItems&&(_===p.maxItems||p[e]===!1);if(d.strictTuples&&!g){let y=`"${i}" is ${_}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0,ln.checkStrictMode)(a,y,d.strictTuples)}}}Qr.validateTuple=Tf;Qr.default=MS});var wf=S(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});var qS=ma(),LS={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,qS.validateTuple)(t,"items")};ha.default=LS});var zf=S(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var xf=O(),US=D(),FS=Oe(),VS=fa(),HS={message:({params:{len:t}})=>(0,xf.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,xf._)`{limit: ${t}}`},KS={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:HS,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,US.alwaysValidSchema)(o,e)&&(n?(0,VS.validateAdditionalItems)(t,n):t.ok((0,FS.validateArray)(t)))}};_a.default=KS});var Ef=S(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var Ae=O(),pn=D(),GS={message:({params:{min:t,max:e}})=>e===void 0?(0,Ae.str)`must contain at least ${t} valid item(s)`:(0,Ae.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Ae._)`{minContains: ${t}}`:(0,Ae._)`{minContains: ${t}, maxContains: ${e}}`},BS={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:GS,code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t,i,a,{minContains:c,maxContains:l}=o;s.opts.next?(i=c===void 0?1:c,a=l):i=1;let u=e.const("len",(0,Ae._)`${n}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,pn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,pn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,pn.alwaysValidSchema)(s,r)){let g=(0,Ae._)`${u} >= ${i}`;a!==void 0&&(g=(0,Ae._)`${g} && ${u} <= ${a}`),t.pass(g);return}s.items=!0;let p=e.name("valid");a===void 0&&i===1?m(p,()=>e.if(p,()=>e.break())):i===0?(e.let(p,!0),a!==void 0&&e.if((0,Ae._)`${n}.length > 0`,d)):(e.let(p,!1),d()),t.result(p,()=>t.reset());function d(){let g=e.name("_valid"),y=e.let("count",0);m(g,()=>e.if(g,()=>_(y)))}function m(g,y){e.forRange("i",0,u,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:pn.Type.Num,compositeRule:!0},g),y()})}function _(g){e.code((0,Ae._)`${g}++`),a===void 0?e.if((0,Ae._)`${g} >= ${i}`,()=>e.assign(p,!0).break()):(e.if((0,Ae._)`${g} > ${a}`,()=>e.assign(p,!1).break()),i===1?e.assign(p,!0):e.if((0,Ae._)`${g} >= ${i}`,()=>e.assign(p,!0)))}}};ga.default=BS});var Rf=S(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.validateSchemaDeps=Ke.validatePropertyDeps=Ke.error=void 0;var ya=O(),JS=D(),eo=Oe();Ke.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,ya.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,ya._)`{property: ${t}, missingProperty: ${o}, depsCount: ${e}, - deps: ${r}}`};var JS={keyword:"dependencies",type:"object",schemaType:"object",error:Ke.error,code(t){let[e,r]=WS(t);kf(t,e),Pf(t,r)}};function WS({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function kf(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,to.propertyInData)(r,o,i,n.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,to.checkReportMissingProp)(t,u)}):(r.if((0,ga._)`${c} && (${(0,to.checkMissingProp)(t,a,s)})`),(0,to.reportMissingProp)(t,s),r.else())}}Ke.validatePropertyDeps=kf;function Pf(t,e=t.schema){let{gen:r,data:o,keyword:n,it:s}=t,i=r.name("valid");for(let a in e)(0,BS.alwaysValidSchema)(s,e[a])||(r.if((0,to.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Ke.validateSchemaDeps=Pf;Ke.default=JS});var Of=S(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});var If=O(),YS=D(),XS={message:"property name must be valid",params:({params:t})=>(0,If._)`{propertyName: ${t.propertyName}}`},QS={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:XS,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,YS.alwaysValidSchema)(n,r))return;let s=e.name("valid");e.forIn("key",o,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,If.not)(s),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(s)}};ya.default=QS});var $a=S(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var pn=Oe(),Me=O(),eb=et(),dn=D(),tb={message:"must NOT have additional properties",params:({params:t})=>(0,Me._)`{additionalProperty: ${t.additionalProperty}}`},rb={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:tb,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,dn.alwaysValidSchema)(i,r))return;let u=(0,pn.allSchemaProperties)(o.properties),l=(0,pn.allSchemaProperties)(o.patternProperties);p(),t.ok((0,Me._)`${s} === ${eb.default.errors}`);function p(){e.forIn("key",n,y=>{!u.length&&!l.length?_(y):e.if(d(y),()=>_(y))})}function d(y){let v;if(u.length>8){let b=(0,dn.schemaRefOrVal)(i,o.properties,"properties");v=(0,pn.isOwnProperty)(e,b,y)}else u.length?v=(0,Me.or)(...u.map(b=>(0,Me._)`${y} === ${b}`)):v=Me.nil;return l.length&&(v=(0,Me.or)(v,...l.map(b=>(0,Me._)`${(0,pn.usePattern)(t,b)}.test(${y})`))),(0,Me.not)(v)}function m(y){e.code((0,Me._)`delete ${n}[${y}]`)}function _(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,dn.alwaysValidSchema)(i,r)){let v=e.name("valid");c.removeAdditional==="failing"?(g(y,v,!1),e.if((0,Me.not)(v),()=>{t.reset(),m(y)})):(g(y,v),a||e.if((0,Me.not)(v),()=>e.break()))}}function g(y,v,b){let $={keyword:"additionalProperties",dataProp:y,dataPropType:dn.Type.Str};b===!1&&Object.assign($,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema($,v)}}};va.default=rb});var Cf=S(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});var ob=Lr(),Nf=Oe(),Sa=D(),Af=$a(),nb={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&Af.default.code(new ob.KeywordCxt(s,Af.default,"additionalProperties"));let i=(0,Nf.allSchemaProperties)(r);for(let p of i)s.definedProperties.add(p);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Sa.mergeEvaluated.props(e,(0,Sa.toHash)(i),s.props));let a=i.filter(p=>!(0,Sa.alwaysValidSchema)(s,r[p]));if(a.length===0)return;let c=e.name("valid");for(let p of a)u(p)?l(p):(e.if((0,Nf.propertyInData)(e,n,p,s.opts.ownProperties)),l(p),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(p),t.ok(c);function u(p){return s.opts.useDefaults&&!s.compositeRule&&r[p].default!==void 0}function l(p){t.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};ba.default=nb});var Mf=S(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});var jf=Oe(),fn=O(),Zf=D(),Df=D(),sb={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:s}=t,{opts:i}=s,a=(0,jf.allSchemaProperties)(r),c=a.filter(g=>(0,Zf.alwaysValidSchema)(s,r[g]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof fn.Name)&&(s.props=(0,Df.evaluatedPropsToName)(e,s.props));let{props:p}=s;d();function d(){for(let g of a)u&&m(g),s.allErrors?_(g):(e.var(l,!0),_(g),e.if(l))}function m(g){for(let y in u)new RegExp(g).test(y)&&(0,Zf.checkStrictMode)(s,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function _(g){e.forIn("key",o,y=>{e.if((0,fn._)`${(0,jf.usePattern)(t,g)}.test(${y})`,()=>{let v=c.includes(g);v||t.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:Df.Type.Str},l),s.opts.unevaluated&&p!==!0?e.assign((0,fn._)`${p}[${y}]`,!0):!v&&!s.allErrors&&e.if((0,fn.not)(l),()=>e.break())})})}}};Ta.default=sb});var qf=S(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var ib=D(),ab={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,ib.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};wa.default=ab});var Lf=S(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});var cb=Oe(),ub={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:cb.validateUnion,error:{message:"must match a schema in anyOf"}};xa.default=ub});var Uf=S(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});var mn=O(),lb=D(),pb={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,mn._)`{passingSchemas: ${t.passing}}`},db={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:pb,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,p)=>{let d;(0,lb.alwaysValidSchema)(n,l)?e.var(c,!0):d=t.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c),p>0&&e.if((0,mn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,mn._)`[${a}, ${p}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,p),d&&t.mergeEvaluated(d,mn.Name)})})}}};za.default=db});var Ff=S(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var fb=D(),mb={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((s,i)=>{if((0,fb.alwaysValidSchema)(o,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(a)})}};Ea.default=mb});var Kf=S(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var hn=O(),Hf=D(),hb={message:({params:t})=>(0,hn.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,hn._)`{failingKeyword: ${t.ifClause}}`},_b={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:hb,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,Hf.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=Vf(o,"then"),s=Vf(o,"else");if(!n&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else n?e.if(a,u("then")):e.if((0,hn.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,p){return()=>{let d=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(d,i),p?e.assign(p,(0,hn._)`${l}`):t.setParams({ifClause:l})}}}};function Vf(t,e){let r=t.schema[e];return r!==void 0&&!(0,Hf.alwaysValidSchema)(t,r)}ka.default=_b});var Gf=S(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var gb=D(),yb={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,gb.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Pa.default=yb});var Bf=S(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var vb=da(),$b=wf(),Sb=fa(),bb=zf(),Tb=Ef(),wb=Rf(),xb=Of(),zb=$a(),Eb=Cf(),kb=Mf(),Pb=qf(),Rb=Lf(),Ib=Uf(),Ob=Ff(),Nb=Kf(),Ab=Gf();function Cb(t=!1){let e=[Pb.default,Rb.default,Ib.default,Ob.default,Nb.default,Ab.default,xb.default,zb.default,wb.default,Eb.default,kb.default];return t?e.push($b.default,bb.default):e.push(vb.default,Sb.default),e.push(Tb.default),e}Ra.default=Cb});var Jf=S(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});var oe=O(),jb={message:({schemaCode:t})=>(0,oe.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,oe._)`{format: ${t}}`},Zb={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:jb,code(t,e){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:p}=a;if(!c.validateFormats)return;n?d():m();function d(){let _=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),g=r.const("fDef",(0,oe._)`${_}[${i}]`),y=r.let("fType"),v=r.let("format");r.if((0,oe._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,(0,oe._)`${g}.type || "string"`).assign(v,(0,oe._)`${g}.validate`),()=>r.assign(y,(0,oe._)`"string"`).assign(v,g)),t.fail$data((0,oe.or)(b(),$()));function b(){return c.strictSchema===!1?oe.nil:(0,oe._)`${i} && !${v}`}function $(){let z=l.$async?(0,oe._)`(${g}.async ? await ${v}(${o}) : ${v}(${o}))`:(0,oe._)`${v}(${o})`,k=(0,oe._)`(typeof ${v} == "function" ? ${z} : ${v}.test(${o}))`;return(0,oe._)`${v} && ${v} !== true && ${y} === ${e} && !${k}`}}function m(){let _=p.formats[s];if(!_){b();return}if(_===!0)return;let[g,y,v]=$(_);g===e&&t.pass(z());function b(){if(c.strictSchema===!1){p.logger.warn(k());return}throw new Error(k());function k(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function $(k){let ge=k instanceof RegExp?(0,oe.regexpCode)(k):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,Ee=r.scopeValue("formats",{key:s,ref:k,code:ge});return typeof k=="object"&&!(k instanceof RegExp)?[k.type||"string",k.validate,(0,oe._)`${Ee}.validate`]:["string",k,Ee]}function z(){if(typeof _=="object"&&!(_ instanceof RegExp)&&_.async){if(!l.$async)throw new Error("async format in sync schema");return(0,oe._)`await ${v}(${o})`}return typeof y=="function"?(0,oe._)`${v}(${o})`:(0,oe._)`${v}.test(${o})`}}}};Ia.default=Zb});var Wf=S(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var Db=Jf(),Mb=[Db.default];Oa.default=Mb});var Yf=S(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.contentVocabulary=Jt.metadataVocabulary=void 0;Jt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Jt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Qf=S(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var qb=sf(),Lb=$f(),Ub=Bf(),Fb=Wf(),Xf=Yf(),Vb=[qb.default,Lb.default,(0,Ub.default)(),Fb.default,Xf.metadataVocabulary,Xf.contentVocabulary];Na.default=Vb});var tm=S(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.DiscrError=void 0;var em;(function(t){t.Tag="tag",t.Mapping="mapping"})(em||(_n.DiscrError=em={}))});var om=S(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var Wt=O(),Aa=tm(),rm=Xo(),Hb=Ur(),Kb=D(),Gb={message:({params:{discrError:t,tagName:e}})=>t===Aa.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Wt._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Bb={keyword:"discriminator",type:"object",schemaType:"object",error:Gb,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:s}=t,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,Wt._)`${r}${(0,Wt.getProperty)(a)}`);e.if((0,Wt._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Aa.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let m=d();e.if(!1);for(let _ in m)e.elseIf((0,Wt._)`${u} === ${_}`),e.assign(c,p(m[_]));e.else(),t.error(!1,{discrError:Aa.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function p(m){let _=e.name("valid"),g=t.subschema({keyword:"oneOf",schemaProp:m},_);return t.mergeEvaluated(g,Wt.Name),_}function d(){var m;let _={},g=v(n),y=!0;for(let z=0;z{Jb.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Za=S((Y,ja)=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.MissingRefError=Y.ValidationError=Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=Y.Ajv=void 0;var Wb=Qd(),Yb=Qf(),Xb=om(),sm=nm(),Qb=["/properties"],gn="http://json-schema.org/draft-07/schema",Yt=class extends Wb.default{_addVocabularies(){super._addVocabularies(),Yb.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Xb.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(sm,Qb):sm;this.addMetaSchema(e,gn,!1),this.refs["http://json-schema.org/schema"]=gn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(gn)?gn:void 0)}};Y.Ajv=Yt;ja.exports=Y=Yt;ja.exports.Ajv=Yt;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=Yt;var eT=Lr();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return eT.KeywordCxt}});var Xt=O();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return Xt._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return Xt.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return Xt.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return Xt.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return Xt.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return Xt.CodeGen}});var tT=Wo();Object.defineProperty(Y,"ValidationError",{enumerable:!0,get:function(){return tT.default}});var rT=Ur();Object.defineProperty(Y,"MissingRefError",{enumerable:!0,get:function(){return rT.default}})});var fm=S(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.formatNames=Be.fastFormats=Be.fullFormats=void 0;function Ge(t,e){return{validate:t,compare:e}}Be.fullFormats={date:Ge(um,La),time:Ge(Ma(!0),Ua),"date-time":Ge(im(!0),pm),"iso-time":Ge(Ma(),lm),"iso-date-time":Ge(im(),dm),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:cT,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:hT,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:uT,int32:{type:"number",validate:dT},int64:{type:"number",validate:fT},float:{type:"number",validate:cm},double:{type:"number",validate:cm},password:!0,binary:!0};Be.fastFormats={...Be.fullFormats,date:Ge(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,La),time:Ge(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ua),"date-time":Ge(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,pm),"iso-time":Ge(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,lm),"iso-date-time":Ge(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,dm),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Be.formatNames=Object.keys(Be.fullFormats);function oT(t){return t%4===0&&(t%100!==0||t%400===0)}var nT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,sT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function um(t){let e=nT.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&oT(r)?29:sT[o])}function La(t,e){if(t&&e)return t>e?1:t23||l>59||t&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let p=s-l*c,d=n-u*c-(p<0?1:0);return(d===23||d===-1)&&(p===59||p===-1)&&i<61}}function Ua(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function lm(t,e){if(!(t&&e))return;let r=Da.exec(t),o=Da.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t=lT}function fT(t){return Number.isInteger(t)}function cm(){return!0}var mT=/[^\\]\\Z/;function hT(t){if(mT.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var mm=S(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.formatLimitDefinition=void 0;var _T=Za(),qe=O(),ft=qe.operators,yn={formatMaximum:{okStr:"<=",ok:ft.LTE,fail:ft.GT},formatMinimum:{okStr:">=",ok:ft.GTE,fail:ft.LT},formatExclusiveMaximum:{okStr:"<",ok:ft.LT,fail:ft.GTE},formatExclusiveMinimum:{okStr:">",ok:ft.GT,fail:ft.LTE}},gT={message:({keyword:t,schemaCode:e})=>(0,qe.str)`should be ${yn[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,qe._)`{comparison: ${yn[t].okStr}, limit: ${e}}`};Qt.formatLimitDefinition={keyword:Object.keys(yn),type:"string",schemaType:"string",$data:!0,error:gT,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new _T.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let d=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=e.const("fmt",(0,qe._)`${d}[${c.schemaCode}]`);t.fail$data((0,qe.or)((0,qe._)`typeof ${m} != "object"`,(0,qe._)`${m} instanceof RegExp`,(0,qe._)`typeof ${m}.compare != "function"`,p(m)))}function l(){let d=c.schema,m=a.formats[d];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${n}": format "${d}" does not define "compare" function`);let _=e.scopeValue("formats",{key:d,ref:m,code:i.code.formats?(0,qe._)`${i.code.formats}${(0,qe.getProperty)(d)}`:void 0});t.fail$data(p(_))}function p(d){return(0,qe._)`${d}.compare(${r}, ${o}) ${yn[n].fail} 0`}},dependencies:["format"]};var yT=t=>(t.addKeyword(Qt.formatLimitDefinition),t);Qt.default=yT});var ym=S((ro,gm)=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});var er=fm(),vT=mm(),Fa=O(),hm=new Fa.Name("fullFormats"),$T=new Fa.Name("fastFormats"),Va=(t,e={keywords:!0})=>{if(Array.isArray(e))return _m(t,e,er.fullFormats,hm),t;let[r,o]=e.mode==="fast"?[er.fastFormats,$T]:[er.fullFormats,hm],n=e.formats||er.formatNames;return _m(t,n,r,o),e.keywords&&(0,vT.default)(t),t};Va.get=(t,e="full")=>{let o=(e==="fast"?er.fastFormats:er.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function _m(t,e,r,o){var n,s;(n=(s=t.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,Fa._)`require("ajv-formats/dist/formats").${o}`);for(let i of e)t.addFormat(i,r[i])}gm.exports=ro=Va;Object.defineProperty(ro,"__esModule",{value:!0});ro.default=Va});var GT=Object.freeze({status:"aborted"});function h(t,e,r){function o(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(t),e(a,c);for(let l in i.prototype)l in a||Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var We=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},no={};function ke(t){return t&&Object.assign(no,t),no}var L={};sc(L,{BIGINT_FORMAT_RANGES:()=>cc,Class:()=>Mn,NUMBER_FORMAT_RANGES:()=>Gn,aborted:()=>ht,allowsEval:()=>Vn,assert:()=>bh,assertEqual:()=>yh,assertIs:()=>$h,assertNever:()=>Sh,assertNotEqual:()=>vh,assignProp:()=>Fn,cached:()=>or,captureStackTrace:()=>io,cleanEnum:()=>Ch,cleanRegex:()=>sr,clone:()=>Ue,createTransparentProxy:()=>kh,defineLazy:()=>H,esc:()=>mt,escapeRegex:()=>rt,extend:()=>Ih,finalizeIssue:()=>Ce,floatSafeRemainder:()=>Un,getElementAtPath:()=>Th,getEnumValues:()=>qn,getLengthableOrigin:()=>ir,getParsedType:()=>Eh,getSizableOrigin:()=>uc,isObject:()=>Pt,isPlainObject:()=>Rt,issue:()=>Bn,joinValues:()=>so,jsonStringifyReplacer:()=>Ln,merge:()=>Oh,normalizeParams:()=>E,nullish:()=>nr,numKeys:()=>zh,omit:()=>Rh,optionalKeys:()=>Kn,partial:()=>Nh,pick:()=>Ph,prefixIssues:()=>Fe,primitiveTypes:()=>ac,promiseAllObject:()=>wh,propertyKeyTypes:()=>Hn,randomString:()=>xh,required:()=>Ah,stringifyPrimitive:()=>ao,unwrapMessage:()=>rr});function yh(t){return t}function vh(t){return t}function $h(t){}function Sh(t){throw new Error}function bh(t){}function qn(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,n])=>e.indexOf(+o)===-1).map(([o,n])=>n)}function so(t,e="|"){return t.map(r=>ao(r)).join(e)}function Ln(t,e){return typeof e=="bigint"?e.toString():e}function or(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function nr(t){return t==null}function sr(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Un(t,e){let r=(t.toString().split(".")[1]||"").length,o=(e.toString().split(".")[1]||"").length,n=r>o?r:o,s=Number.parseInt(t.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return s%i/10**n}function H(t,e,r){Object.defineProperty(t,e,{get(){{let n=r();return t[e]=n,n}throw new Error("cached value already set")},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function Fn(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Th(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function wh(t){let e=Object.keys(t),r=e.map(o=>t[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s{};function Pt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Vn=or(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Rt(t){if(Pt(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(Pt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function zh(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var Eh=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Hn=new Set(["string","number","symbol"]),ac=new Set(["string","number","bigint","boolean","symbol","undefined"]);function rt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ue(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function E(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function kh(t){let e;return new Proxy({},{get(r,o,n){return e??(e=t()),Reflect.get(e,o,n)},set(r,o,n,s){return e??(e=t()),Reflect.set(e,o,n,s)},has(r,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(r,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(r,o,n){return e??(e=t()),Reflect.defineProperty(e,o,n)}})}function ao(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Kn(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Gn={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]},cc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ph(t,e){let r={},o=t._zod.def;for(let n in e){if(!(n in o.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=o.shape[n])}return Ue(t,{...t._zod.def,shape:r,checks:[]})}function Rh(t,e){let r={...t._zod.def.shape},o=t._zod.def;for(let n in e){if(!(n in o.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return Ue(t,{...t._zod.def,shape:r,checks:[]})}function Ih(t,e){if(!Rt(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let o={...t._zod.def.shape,...e};return Fn(this,"shape",o),o},checks:[]};return Ue(t,r)}function Oh(t,e){return Ue(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return Fn(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function Nh(t,e,r){let o=e._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=t?new t({type:"optional",innerType:o[s]}):o[s])}else for(let s in o)n[s]=t?new t({type:"optional",innerType:o[s]}):o[s];return Ue(e,{...e._zod.def,shape:n,checks:[]})}function Ah(t,e,r){let o=e._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=new t({type:"nonoptional",innerType:o[s]}))}else for(let s in o)n[s]=new t({type:"nonoptional",innerType:o[s]});return Ue(e,{...e._zod.def,shape:n,checks:[]})}function ht(t,e=0){for(let r=e;r{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function rr(t){return typeof t=="string"?t:t?.message}function Ce(t,e,r){let o={...t,path:t.path??[]};if(!t.message){let n=rr(t.inst?._zod.def?.error?.(t))??rr(e?.error?.(t))??rr(r.customError?.(t))??rr(r.localeError?.(t))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,e?.reportInput||delete o.input,o}function uc(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function ir(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Bn(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function Ch(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var Mn=class{constructor(...e){}};var lc=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,Ln,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},co=h("$ZodError",lc),Jn=h("$ZodError",lc,{Parent:Error});function pc(t,e=r=>r.message){let r={},o=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):o.push(e(n));return{formErrors:o,fieldErrors:r}}function dc(t,e){let r=e||function(s){return s.message},o={_errors:[]},n=s=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)o._errors.push(r(i));else{let a=o,c=0;for(;c(e,r,o,n)=>{let s=o?Object.assign(o,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new We;if(i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Ce(c,s,ke())));throw io(a,n?.callee),a}return i.value};var mc=t=>async(e,r,o,n)=>{let s=o?Object.assign(o,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Ce(c,s,ke())));throw io(a,n?.callee),a}return i.value};var Wn=t=>(e,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new We;return s.issues.length?{success:!1,error:new(t??co)(s.issues.map(i=>Ce(i,n,ke())))}:{success:!0,data:s.value}},ar=Wn(Jn),Yn=t=>async(e,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>Ce(i,n,ke())))}:{success:!0,data:s.value}},uo=Yn(Jn);var hc=/^[cC][^\s-]{8,}$/,_c=/^[0-9a-z]+$/,gc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,yc=/^[0-9a-vA-V]{20}$/,vc=/^[A-Za-z0-9]{27}$/,$c=/^[a-zA-Z0-9_-]{21}$/,Sc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var bc=/^([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})$/,Xn=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;var Tc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Zh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function wc(){return new RegExp(Zh,"u")}var xc=/^(?:(?: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])$/,zc=/^(([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})$/,Ec=/^((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])$/,kc=/^(([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])$/,Pc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Qn=/^[A-Za-z0-9_-]*$/,Rc=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Ic=/^\+(?:[0-9]){6,14}[0-9]$/,Oc="(?:(?:\\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])))",Nc=new RegExp(`^${Oc}$`);function Ac(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Cc(t){return new RegExp(`^${Ac(t)}$`)}function jc(t){let e=Ac({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let o=`${e}(?:${r.join("|")})`;return new RegExp(`^${Oc}T(?:${o})$`)}var Zc=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var Dc=/^\d+$/,Mc=/^-?\d+(?:\.\d+)?/i,qc=/true|false/i,Lc=/null/i;var Uc=/^[^A-Z]*$/,Fc=/^[^a-z]*$/;var fe=h("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Vc={number:"number",bigint:"bigint",object:"date"},ts=h("$ZodCheckLessThan",(t,e)=>{fe.init(t,e);let r=Vc[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,s=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?o.value<=e.value:o.value{fe.init(t,e);let r=Vc[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,s=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value>=e.value:o.value>e.value)||o.issues.push({origin:r,code:"too_small",minimum:e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Hc=h("$ZodCheckMultipleOf",(t,e)=>{fe.init(t,e),t._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Un(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Kc=h("$ZodCheckNumberFormat",(t,e)=>{fe.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),o=r?"int":"number",[n,s]=Gn[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=n,a.maximum=s,r&&(a.pattern=Dc)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:e.format,code:"invalid_type",input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,continue:!e.abort});return}}as&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:t})}});var Gc=h("$ZodCheckMaxLength",(t,e)=>{var r;fe.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!nr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let n=o.value;if(n.length<=e.maximum)return;let i=ir(n);o.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Bc=h("$ZodCheckMinLength",(t,e)=>{var r;fe.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!nr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(o._zod.bag.minimum=e.minimum)}),t._zod.check=o=>{let n=o.value;if(n.length>=e.minimum)return;let i=ir(n);o.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Jc=h("$ZodCheckLengthEquals",(t,e)=>{var r;fe.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!nr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=e.length,n.maximum=e.length,n.length=e.length}),t._zod.check=o=>{let n=o.value,s=n.length;if(s===e.length)return;let i=ir(n),a=s>e.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),cr=h("$ZodCheckStringFormat",(t,e)=>{var r,o;fe.init(t,e),t._zod.onattach.push(n=>{let s=n._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(o=t._zod).check??(o.check=()=>{})}),Wc=h("$ZodCheckRegex",(t,e)=>{cr.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Yc=h("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Uc),cr.init(t,e)}),Xc=h("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Fc),cr.init(t,e)}),Qc=h("$ZodCheckIncludes",(t,e)=>{fe.init(t,e);let r=rt(e.includes),o=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=o,t._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),eu=h("$ZodCheckStartsWith",(t,e)=>{fe.init(t,e);let r=new RegExp(`^${rt(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.startsWith(e.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:o.value,inst:t,continue:!e.abort})}}),tu=h("$ZodCheckEndsWith",(t,e)=>{fe.init(t,e);let r=new RegExp(`.*${rt(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.endsWith(e.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:o.value,inst:t,continue:!e.abort})}});var ru=h("$ZodCheckOverwrite",(t,e)=>{fe.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var lo=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(` + deps: ${r}}`};var WS={keyword:"dependencies",type:"object",schemaType:"object",error:Ke.error,code(t){let[e,r]=YS(t);kf(t,e),Pf(t,r)}};function YS({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function kf(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,eo.propertyInData)(r,o,i,n.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let l of a)(0,eo.checkReportMissingProp)(t,l)}):(r.if((0,ya._)`${c} && (${(0,eo.checkMissingProp)(t,a,s)})`),(0,eo.reportMissingProp)(t,s),r.else())}}Ke.validatePropertyDeps=kf;function Pf(t,e=t.schema){let{gen:r,data:o,keyword:n,it:s}=t,i=r.name("valid");for(let a in e)(0,JS.alwaysValidSchema)(s,e[a])||(r.if((0,eo.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Ke.validateSchemaDeps=Pf;Ke.default=WS});var Of=S(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var If=O(),XS=D(),QS={message:"property name must be valid",params:({params:t})=>(0,If._)`{propertyName: ${t.propertyName}}`},eb={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:QS,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,XS.alwaysValidSchema)(n,r))return;let s=e.name("valid");e.forIn("key",o,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,If.not)(s),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(s)}};va.default=eb});var Sa=S($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var dn=Oe(),Me=O(),tb=et(),fn=D(),rb={message:"must NOT have additional properties",params:({params:t})=>(0,Me._)`{additionalProperty: ${t.additionalProperty}}`},ob={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:rb,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,fn.alwaysValidSchema)(i,r))return;let l=(0,dn.allSchemaProperties)(o.properties),u=(0,dn.allSchemaProperties)(o.patternProperties);p(),t.ok((0,Me._)`${s} === ${tb.default.errors}`);function p(){e.forIn("key",n,y=>{!l.length&&!u.length?_(y):e.if(d(y),()=>_(y))})}function d(y){let v;if(l.length>8){let b=(0,fn.schemaRefOrVal)(i,o.properties,"properties");v=(0,dn.isOwnProperty)(e,b,y)}else l.length?v=(0,Me.or)(...l.map(b=>(0,Me._)`${y} === ${b}`)):v=Me.nil;return u.length&&(v=(0,Me.or)(v,...u.map(b=>(0,Me._)`${(0,dn.usePattern)(t,b)}.test(${y})`))),(0,Me.not)(v)}function m(y){e.code((0,Me._)`delete ${n}[${y}]`)}function _(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,fn.alwaysValidSchema)(i,r)){let v=e.name("valid");c.removeAdditional==="failing"?(g(y,v,!1),e.if((0,Me.not)(v),()=>{t.reset(),m(y)})):(g(y,v),a||e.if((0,Me.not)(v),()=>e.break()))}}function g(y,v,b){let $={keyword:"additionalProperties",dataProp:y,dataPropType:fn.Type.Str};b===!1&&Object.assign($,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema($,v)}}};$a.default=ob});var Cf=S(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});var nb=qr(),Nf=Oe(),ba=D(),Af=Sa(),sb={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&Af.default.code(new nb.KeywordCxt(s,Af.default,"additionalProperties"));let i=(0,Nf.allSchemaProperties)(r);for(let p of i)s.definedProperties.add(p);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=ba.mergeEvaluated.props(e,(0,ba.toHash)(i),s.props));let a=i.filter(p=>!(0,ba.alwaysValidSchema)(s,r[p]));if(a.length===0)return;let c=e.name("valid");for(let p of a)l(p)?u(p):(e.if((0,Nf.propertyInData)(e,n,p,s.opts.ownProperties)),u(p),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(p),t.ok(c);function l(p){return s.opts.useDefaults&&!s.compositeRule&&r[p].default!==void 0}function u(p){t.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};Ta.default=sb});var Mf=S(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var jf=Oe(),mn=O(),Zf=D(),Df=D(),ib={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:s}=t,{opts:i}=s,a=(0,jf.allSchemaProperties)(r),c=a.filter(g=>(0,Zf.alwaysValidSchema)(s,r[g]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let l=i.strictSchema&&!i.allowMatchingProperties&&n.properties,u=e.name("valid");s.props!==!0&&!(s.props instanceof mn.Name)&&(s.props=(0,Df.evaluatedPropsToName)(e,s.props));let{props:p}=s;d();function d(){for(let g of a)l&&m(g),s.allErrors?_(g):(e.var(u,!0),_(g),e.if(u))}function m(g){for(let y in l)new RegExp(g).test(y)&&(0,Zf.checkStrictMode)(s,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function _(g){e.forIn("key",o,y=>{e.if((0,mn._)`${(0,jf.usePattern)(t,g)}.test(${y})`,()=>{let v=c.includes(g);v||t.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:Df.Type.Str},u),s.opts.unevaluated&&p!==!0?e.assign((0,mn._)`${p}[${y}]`,!0):!v&&!s.allErrors&&e.if((0,mn.not)(u),()=>e.break())})})}}};wa.default=ib});var qf=S(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});var ab=D(),cb={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,ab.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};xa.default=cb});var Lf=S(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});var ub=Oe(),lb={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ub.validateUnion,error:{message:"must match a schema in anyOf"}};za.default=lb});var Uf=S(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var hn=O(),pb=D(),db={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,hn._)`{passingSchemas: ${t.passing}}`},fb={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:db,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(l),t.result(i,()=>t.reset(),()=>t.error(!0));function l(){s.forEach((u,p)=>{let d;(0,pb.alwaysValidSchema)(n,u)?e.var(c,!0):d=t.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c),p>0&&e.if((0,hn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,hn._)`[${a}, ${p}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,p),d&&t.mergeEvaluated(d,hn.Name)})})}}};Ea.default=fb});var Ff=S(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var mb=D(),hb={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((s,i)=>{if((0,mb.alwaysValidSchema)(o,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(a)})}};ka.default=hb});var Kf=S(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var _n=O(),Hf=D(),_b={message:({params:t})=>(0,_n.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,_n._)`{failingKeyword: ${t.ifClause}}`},gb={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:_b,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,Hf.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=Vf(o,"then"),s=Vf(o,"else");if(!n&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&s){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,l("then",u),l("else",u))}else n?e.if(a,l("then")):e.if((0,_n.not)(a),l("else"));t.pass(i,()=>t.error(!0));function c(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function l(u,p){return()=>{let d=t.subschema({keyword:u},a);e.assign(i,a),t.mergeValidEvaluated(d,i),p?e.assign(p,(0,_n._)`${u}`):t.setParams({ifClause:u})}}}};function Vf(t,e){let r=t.schema[e];return r!==void 0&&!(0,Hf.alwaysValidSchema)(t,r)}Pa.default=gb});var Gf=S(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var yb=D(),vb={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,yb.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Ra.default=vb});var Bf=S(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});var $b=fa(),Sb=wf(),bb=ma(),Tb=zf(),wb=Ef(),xb=Rf(),zb=Of(),Eb=Sa(),kb=Cf(),Pb=Mf(),Rb=qf(),Ib=Lf(),Ob=Uf(),Nb=Ff(),Ab=Kf(),Cb=Gf();function jb(t=!1){let e=[Rb.default,Ib.default,Ob.default,Nb.default,Ab.default,Cb.default,zb.default,Eb.default,xb.default,kb.default,Pb.default];return t?e.push(Sb.default,Tb.default):e.push($b.default,bb.default),e.push(wb.default),e}Ia.default=jb});var Jf=S(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var oe=O(),Zb={message:({schemaCode:t})=>(0,oe.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,oe._)`{format: ${t}}`},Db={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Zb,code(t,e){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:p}=a;if(!c.validateFormats)return;n?d():m();function d(){let _=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),g=r.const("fDef",(0,oe._)`${_}[${i}]`),y=r.let("fType"),v=r.let("format");r.if((0,oe._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,(0,oe._)`${g}.type || "string"`).assign(v,(0,oe._)`${g}.validate`),()=>r.assign(y,(0,oe._)`"string"`).assign(v,g)),t.fail$data((0,oe.or)(b(),$()));function b(){return c.strictSchema===!1?oe.nil:(0,oe._)`${i} && !${v}`}function $(){let z=u.$async?(0,oe._)`(${g}.async ? await ${v}(${o}) : ${v}(${o}))`:(0,oe._)`${v}(${o})`,k=(0,oe._)`(typeof ${v} == "function" ? ${z} : ${v}.test(${o}))`;return(0,oe._)`${v} && ${v} !== true && ${y} === ${e} && !${k}`}}function m(){let _=p.formats[s];if(!_){b();return}if(_===!0)return;let[g,y,v]=$(_);g===e&&t.pass(z());function b(){if(c.strictSchema===!1){p.logger.warn(k());return}throw new Error(k());function k(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function $(k){let ge=k instanceof RegExp?(0,oe.regexpCode)(k):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,Ee=r.scopeValue("formats",{key:s,ref:k,code:ge});return typeof k=="object"&&!(k instanceof RegExp)?[k.type||"string",k.validate,(0,oe._)`${Ee}.validate`]:["string",k,Ee]}function z(){if(typeof _=="object"&&!(_ instanceof RegExp)&&_.async){if(!u.$async)throw new Error("async format in sync schema");return(0,oe._)`await ${v}(${o})`}return typeof y=="function"?(0,oe._)`${v}(${o})`:(0,oe._)`${v}.test(${o})`}}}};Oa.default=Db});var Wf=S(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var Mb=Jf(),qb=[Mb.default];Na.default=qb});var Yf=S(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.contentVocabulary=Bt.metadataVocabulary=void 0;Bt.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Bt.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Qf=S(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var Lb=sf(),Ub=$f(),Fb=Bf(),Vb=Wf(),Xf=Yf(),Hb=[Lb.default,Ub.default,(0,Fb.default)(),Vb.default,Xf.metadataVocabulary,Xf.contentVocabulary];Aa.default=Hb});var tm=S(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.DiscrError=void 0;var em;(function(t){t.Tag="tag",t.Mapping="mapping"})(em||(gn.DiscrError=em={}))});var om=S(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var Jt=O(),Ca=tm(),rm=Yo(),Kb=Lr(),Gb=D(),Bb={message:({params:{discrError:t,tagName:e}})=>t===Ca.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Jt._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Jb={keyword:"discriminator",type:"object",schemaType:"object",error:Bb,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:s}=t,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),l=e.const("tag",(0,Jt._)`${r}${(0,Jt.getProperty)(a)}`);e.if((0,Jt._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:Ca.DiscrError.Tag,tag:l,tagName:a})),t.ok(c);function u(){let m=d();e.if(!1);for(let _ in m)e.elseIf((0,Jt._)`${l} === ${_}`),e.assign(c,p(m[_]));e.else(),t.error(!1,{discrError:Ca.DiscrError.Mapping,tag:l,tagName:a}),e.endIf()}function p(m){let _=e.name("valid"),g=t.subschema({keyword:"oneOf",schemaProp:m},_);return t.mergeEvaluated(g,Jt.Name),_}function d(){var m;let _={},g=v(n),y=!0;for(let z=0;z{Wb.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Da=S((Y,Za)=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.MissingRefError=Y.ValidationError=Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=Y.Ajv=void 0;var Yb=Qd(),Xb=Qf(),Qb=om(),sm=nm(),eT=["/properties"],yn="http://json-schema.org/draft-07/schema",Wt=class extends Yb.default{_addVocabularies(){super._addVocabularies(),Xb.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Qb.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(sm,eT):sm;this.addMetaSchema(e,yn,!1),this.refs["http://json-schema.org/schema"]=yn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(yn)?yn:void 0)}};Y.Ajv=Wt;Za.exports=Y=Wt;Za.exports.Ajv=Wt;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=Wt;var tT=qr();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return tT.KeywordCxt}});var Yt=O();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return Yt._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return Yt.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return Yt.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return Yt.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return Yt.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return Yt.CodeGen}});var rT=Jo();Object.defineProperty(Y,"ValidationError",{enumerable:!0,get:function(){return rT.default}});var oT=Lr();Object.defineProperty(Y,"MissingRefError",{enumerable:!0,get:function(){return oT.default}})});var fm=S(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.formatNames=Be.fastFormats=Be.fullFormats=void 0;function Ge(t,e){return{validate:t,compare:e}}Be.fullFormats={date:Ge(um,Ua),time:Ge(qa(!0),Fa),"date-time":Ge(im(!0),pm),"iso-time":Ge(qa(),lm),"iso-date-time":Ge(im(),dm),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:uT,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:_T,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:lT,int32:{type:"number",validate:fT},int64:{type:"number",validate:mT},float:{type:"number",validate:cm},double:{type:"number",validate:cm},password:!0,binary:!0};Be.fastFormats={...Be.fullFormats,date:Ge(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ua),time:Ge(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Fa),"date-time":Ge(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,pm),"iso-time":Ge(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,lm),"iso-date-time":Ge(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,dm),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Be.formatNames=Object.keys(Be.fullFormats);function nT(t){return t%4===0&&(t%100!==0||t%400===0)}var sT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,iT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function um(t){let e=sT.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&nT(r)?29:iT[o])}function Ua(t,e){if(t&&e)return t>e?1:t23||u>59||t&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let p=s-u*c,d=n-l*c-(p<0?1:0);return(d===23||d===-1)&&(p===59||p===-1)&&i<61}}function Fa(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function lm(t,e){if(!(t&&e))return;let r=Ma.exec(t),o=Ma.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t=pT}function mT(t){return Number.isInteger(t)}function cm(){return!0}var hT=/[^\\]\\Z/;function _T(t){if(hT.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var mm=S(Xt=>{"use strict";Object.defineProperty(Xt,"__esModule",{value:!0});Xt.formatLimitDefinition=void 0;var gT=Da(),qe=O(),ft=qe.operators,vn={formatMaximum:{okStr:"<=",ok:ft.LTE,fail:ft.GT},formatMinimum:{okStr:">=",ok:ft.GTE,fail:ft.LT},formatExclusiveMaximum:{okStr:"<",ok:ft.LT,fail:ft.GTE},formatExclusiveMinimum:{okStr:">",ok:ft.GT,fail:ft.LTE}},yT={message:({keyword:t,schemaCode:e})=>(0,qe.str)`should be ${vn[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,qe._)`{comparison: ${vn[t].okStr}, limit: ${e}}`};Xt.formatLimitDefinition={keyword:Object.keys(vn),type:"string",schemaType:"string",$data:!0,error:yT,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new gT.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?l():u();function l(){let d=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=e.const("fmt",(0,qe._)`${d}[${c.schemaCode}]`);t.fail$data((0,qe.or)((0,qe._)`typeof ${m} != "object"`,(0,qe._)`${m} instanceof RegExp`,(0,qe._)`typeof ${m}.compare != "function"`,p(m)))}function u(){let d=c.schema,m=a.formats[d];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${n}": format "${d}" does not define "compare" function`);let _=e.scopeValue("formats",{key:d,ref:m,code:i.code.formats?(0,qe._)`${i.code.formats}${(0,qe.getProperty)(d)}`:void 0});t.fail$data(p(_))}function p(d){return(0,qe._)`${d}.compare(${r}, ${o}) ${vn[n].fail} 0`}},dependencies:["format"]};var vT=t=>(t.addKeyword(Xt.formatLimitDefinition),t);Xt.default=vT});var ym=S((to,gm)=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});var Qt=fm(),$T=mm(),Va=O(),hm=new Va.Name("fullFormats"),ST=new Va.Name("fastFormats"),Ha=(t,e={keywords:!0})=>{if(Array.isArray(e))return _m(t,e,Qt.fullFormats,hm),t;let[r,o]=e.mode==="fast"?[Qt.fastFormats,ST]:[Qt.fullFormats,hm],n=e.formats||Qt.formatNames;return _m(t,n,r,o),e.keywords&&(0,$T.default)(t),t};Ha.get=(t,e="full")=>{let o=(e==="fast"?Qt.fastFormats:Qt.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function _m(t,e,r,o){var n,s;(n=(s=t.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,Va._)`require("ajv-formats/dist/formats").${o}`);for(let i of e)t.addFormat(i,r[i])}gm.exports=to=Ha;Object.defineProperty(to,"__esModule",{value:!0});to.default=Ha});var BT=Object.freeze({status:"aborted"});function h(t,e,r){function o(a,c){var l;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(l=a._zod).traits??(l.traits=new Set),a._zod.traits.add(t),e(a,c);for(let u in i.prototype)u in a||Object.defineProperty(a,u,{value:i.prototype[u].bind(a)});a._zod.constr=i,a._zod.def=c}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let l=r?.Parent?new s:this;o(l,a),(c=l._zod).deferred??(c.deferred=[]);for(let u of l._zod.deferred)u();return l}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var We=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},oo={};function ke(t){return t&&Object.assign(oo,t),oo}var L={};ic(L,{BIGINT_FORMAT_RANGES:()=>uc,Class:()=>qn,NUMBER_FORMAT_RANGES:()=>Bn,aborted:()=>ht,allowsEval:()=>Hn,assert:()=>bh,assertEqual:()=>yh,assertIs:()=>$h,assertNever:()=>Sh,assertNotEqual:()=>vh,assignProp:()=>Vn,cached:()=>rr,captureStackTrace:()=>so,cleanEnum:()=>Ch,cleanRegex:()=>nr,clone:()=>Ue,createTransparentProxy:()=>kh,defineLazy:()=>H,esc:()=>mt,escapeRegex:()=>rt,extend:()=>Ih,finalizeIssue:()=>Ce,floatSafeRemainder:()=>Fn,getElementAtPath:()=>Th,getEnumValues:()=>Ln,getLengthableOrigin:()=>sr,getParsedType:()=>Eh,getSizableOrigin:()=>lc,isObject:()=>Pt,isPlainObject:()=>Rt,issue:()=>Jn,joinValues:()=>no,jsonStringifyReplacer:()=>Un,merge:()=>Oh,normalizeParams:()=>E,nullish:()=>or,numKeys:()=>zh,omit:()=>Rh,optionalKeys:()=>Gn,partial:()=>Nh,pick:()=>Ph,prefixIssues:()=>Fe,primitiveTypes:()=>cc,promiseAllObject:()=>wh,propertyKeyTypes:()=>Kn,randomString:()=>xh,required:()=>Ah,stringifyPrimitive:()=>io,unwrapMessage:()=>tr});function yh(t){return t}function vh(t){return t}function $h(t){}function Sh(t){throw new Error}function bh(t){}function Ln(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,n])=>e.indexOf(+o)===-1).map(([o,n])=>n)}function no(t,e="|"){return t.map(r=>io(r)).join(e)}function Un(t,e){return typeof e=="bigint"?e.toString():e}function rr(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function or(t){return t==null}function nr(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Fn(t,e){let r=(t.toString().split(".")[1]||"").length,o=(e.toString().split(".")[1]||"").length,n=r>o?r:o,s=Number.parseInt(t.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return s%i/10**n}function H(t,e,r){Object.defineProperty(t,e,{get(){{let n=r();return t[e]=n,n}throw new Error("cached value already set")},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function Vn(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Th(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function wh(t){let e=Object.keys(t),r=e.map(o=>t[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s{};function Pt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Hn=rr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Rt(t){if(Pt(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(Pt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function zh(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var Eh=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Kn=new Set(["string","number","symbol"]),cc=new Set(["string","number","bigint","boolean","symbol","undefined"]);function rt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ue(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function E(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function kh(t){let e;return new Proxy({},{get(r,o,n){return e??(e=t()),Reflect.get(e,o,n)},set(r,o,n,s){return e??(e=t()),Reflect.set(e,o,n,s)},has(r,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(r,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(r,o,n){return e??(e=t()),Reflect.defineProperty(e,o,n)}})}function io(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Gn(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Bn={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]},uc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ph(t,e){let r={},o=t._zod.def;for(let n in e){if(!(n in o.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&(r[n]=o.shape[n])}return Ue(t,{...t._zod.def,shape:r,checks:[]})}function Rh(t,e){let r={...t._zod.def.shape},o=t._zod.def;for(let n in e){if(!(n in o.shape))throw new Error(`Unrecognized key: "${n}"`);e[n]&&delete r[n]}return Ue(t,{...t._zod.def,shape:r,checks:[]})}function Ih(t,e){if(!Rt(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let o={...t._zod.def.shape,...e};return Vn(this,"shape",o),o},checks:[]};return Ue(t,r)}function Oh(t,e){return Ue(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return Vn(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function Nh(t,e,r){let o=e._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=t?new t({type:"optional",innerType:o[s]}):o[s])}else for(let s in o)n[s]=t?new t({type:"optional",innerType:o[s]}):o[s];return Ue(e,{...e._zod.def,shape:n,checks:[]})}function Ah(t,e,r){let o=e._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(n[s]=new t({type:"nonoptional",innerType:o[s]}))}else for(let s in o)n[s]=new t({type:"nonoptional",innerType:o[s]});return Ue(e,{...e._zod.def,shape:n,checks:[]})}function ht(t,e=0){for(let r=e;r{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function tr(t){return typeof t=="string"?t:t?.message}function Ce(t,e,r){let o={...t,path:t.path??[]};if(!t.message){let n=tr(t.inst?._zod.def?.error?.(t))??tr(e?.error?.(t))??tr(r.customError?.(t))??tr(r.localeError?.(t))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,e?.reportInput||delete o.input,o}function lc(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function sr(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Jn(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function Ch(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var qn=class{constructor(...e){}};var pc=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,Un,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},ao=h("$ZodError",pc),Wn=h("$ZodError",pc,{Parent:Error});function dc(t,e=r=>r.message){let r={},o=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):o.push(e(n));return{formErrors:o,fieldErrors:r}}function fc(t,e){let r=e||function(s){return s.message},o={_errors:[]},n=s=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)o._errors.push(r(i));else{let a=o,c=0;for(;c(e,r,o,n)=>{let s=o?Object.assign(o,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new We;if(i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Ce(c,s,ke())));throw so(a,n?.callee),a}return i.value};var hc=t=>async(e,r,o,n)=>{let s=o?Object.assign(o,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Ce(c,s,ke())));throw so(a,n?.callee),a}return i.value};var Yn=t=>(e,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new We;return s.issues.length?{success:!1,error:new(t??ao)(s.issues.map(i=>Ce(i,n,ke())))}:{success:!0,data:s.value}},ir=Yn(Wn),Xn=t=>async(e,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>Ce(i,n,ke())))}:{success:!0,data:s.value}},co=Xn(Wn);var _c=/^[cC][^\s-]{8,}$/,gc=/^[0-9a-z]+$/,yc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,vc=/^[0-9a-vA-V]{20}$/,$c=/^[A-Za-z0-9]{27}$/,Sc=/^[a-zA-Z0-9_-]{21}$/,bc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Tc=/^([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})$/,Qn=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;var wc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Zh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function xc(){return new RegExp(Zh,"u")}var zc=/^(?:(?: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])$/,Ec=/^(([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})$/,kc=/^((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])$/,Pc=/^(([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])$/,Rc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,es=/^[A-Za-z0-9_-]*$/,Ic=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Oc=/^\+(?:[0-9]){6,14}[0-9]$/,Nc="(?:(?:\\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])))",Ac=new RegExp(`^${Nc}$`);function Cc(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function jc(t){return new RegExp(`^${Cc(t)}$`)}function Zc(t){let e=Cc({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let o=`${e}(?:${r.join("|")})`;return new RegExp(`^${Nc}T(?:${o})$`)}var Dc=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var Mc=/^\d+$/,qc=/^-?\d+(?:\.\d+)?/i,Lc=/true|false/i,Uc=/null/i;var Fc=/^[^A-Z]*$/,Vc=/^[^a-z]*$/;var fe=h("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Hc={number:"number",bigint:"bigint",object:"date"},rs=h("$ZodCheckLessThan",(t,e)=>{fe.init(t,e);let r=Hc[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,s=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?o.value<=e.value:o.value{fe.init(t,e);let r=Hc[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,s=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value>=e.value:o.value>e.value)||o.issues.push({origin:r,code:"too_small",minimum:e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Kc=h("$ZodCheckMultipleOf",(t,e)=>{fe.init(t,e),t._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Fn(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Gc=h("$ZodCheckNumberFormat",(t,e)=>{fe.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),o=r?"int":"number",[n,s]=Bn[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=n,a.maximum=s,r&&(a.pattern=Mc)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:e.format,code:"invalid_type",input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,continue:!e.abort});return}}as&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:t})}});var Bc=h("$ZodCheckMaxLength",(t,e)=>{var r;fe.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!or(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{let n=o.value;if(n.length<=e.maximum)return;let i=sr(n);o.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Jc=h("$ZodCheckMinLength",(t,e)=>{var r;fe.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!or(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(o._zod.bag.minimum=e.minimum)}),t._zod.check=o=>{let n=o.value;if(n.length>=e.minimum)return;let i=sr(n);o.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Wc=h("$ZodCheckLengthEquals",(t,e)=>{var r;fe.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!or(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=e.length,n.maximum=e.length,n.length=e.length}),t._zod.check=o=>{let n=o.value,s=n.length;if(s===e.length)return;let i=sr(n),a=s>e.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),ar=h("$ZodCheckStringFormat",(t,e)=>{var r,o;fe.init(t,e),t._zod.onattach.push(n=>{let s=n._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(o=t._zod).check??(o.check=()=>{})}),Yc=h("$ZodCheckRegex",(t,e)=>{ar.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Xc=h("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Fc),ar.init(t,e)}),Qc=h("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Vc),ar.init(t,e)}),eu=h("$ZodCheckIncludes",(t,e)=>{fe.init(t,e);let r=rt(e.includes),o=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=o,t._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),tu=h("$ZodCheckStartsWith",(t,e)=>{fe.init(t,e);let r=new RegExp(`^${rt(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.startsWith(e.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:o.value,inst:t,continue:!e.abort})}}),ru=h("$ZodCheckEndsWith",(t,e)=>{fe.init(t,e);let r=new RegExp(`.*${rt(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.endsWith(e.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:o.value,inst:t,continue:!e.abort})}});var ou=h("$ZodCheckOverwrite",(t,e)=>{fe.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var uo=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(` `).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let e=Function,r=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,n.join(` -`))}};var nu={major:4,minor:0,patch:0};var K=h("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=nu;let o=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&o.unshift(t);for(let n of o)for(let s of n._zod.onattach)s(t);if(o.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let n=(s,i,a)=>{let c=ht(s),u;for(let l of i){if(l._zod.def.when){if(!l._zod.def.when(s))continue}else if(c)continue;let p=s.issues.length,d=l._zod.check(s);if(d instanceof Promise&&a?.async===!1)throw new We;if(u||d instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await d,s.issues.length!==p&&(c||(c=ht(s,p)))});else{if(s.issues.length===p)continue;c||(c=ht(s,p))}}return u?u.then(()=>s):s};t._zod.run=(s,i)=>{let a=t._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new We;return a.then(c=>n(c,o,i))}return n(a,o,i)}}t["~standard"]={validate:n=>{try{let s=ar(t,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return uo(t,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),fo=h("$ZodString",(t,e)=>{K.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Zc(t._zod.bag),t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),B=h("$ZodStringFormat",(t,e)=>{cr.init(t,e),fo.init(t,e)}),mu=h("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=bc),B.init(t,e)}),hu=h("$ZodUUID",(t,e)=>{if(e.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(o===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Xn(o))}else e.pattern??(e.pattern=Xn());B.init(t,e)}),_u=h("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Tc),B.init(t,e)}),gu=h("$ZodURL",(t,e)=>{B.init(t,e),t._zod.check=r=>{try{let o=r.value,n=new URL(o),s=n.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Rc.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!o.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),yu=h("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=wc()),B.init(t,e)}),vu=h("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=$c),B.init(t,e)}),$u=h("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=hc),B.init(t,e)}),Su=h("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=_c),B.init(t,e)}),bu=h("$ZodULID",(t,e)=>{e.pattern??(e.pattern=gc),B.init(t,e)}),Tu=h("$ZodXID",(t,e)=>{e.pattern??(e.pattern=yc),B.init(t,e)}),wu=h("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=vc),B.init(t,e)}),xu=h("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=jc(e)),B.init(t,e)}),zu=h("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Nc),B.init(t,e)}),Eu=h("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Cc(e)),B.init(t,e)}),ku=h("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Sc),B.init(t,e)}),Pu=h("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=xc),B.init(t,e),t._zod.onattach.push(r=>{let o=r._zod.bag;o.format="ipv4"})}),Ru=h("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=zc),B.init(t,e),t._zod.onattach.push(r=>{let o=r._zod.bag;o.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Iu=h("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Ec),B.init(t,e)}),Ou=h("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=kc),B.init(t,e),t._zod.check=r=>{let[o,n]=r.value.split("/");try{if(!n)throw new Error;let s=Number(n);if(`${s}`!==n)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Nu(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Au=h("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Pc),B.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{Nu(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Dh(t){if(!Qn.test(t))return!1;let e=t.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Nu(r)}var Cu=h("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Qn),B.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{Dh(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),ju=h("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Ic),B.init(t,e)});function Mh(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}var Zu=h("$ZodJWT",(t,e)=>{B.init(t,e),t._zod.check=r=>{Mh(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var ns=h("$ZodNumber",(t,e)=>{K.init(t,e),t._zod.pattern=t._zod.bag.pattern??Mc,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...s?{received:s}:{}}),r}}),Du=h("$ZodNumber",(t,e)=>{Kc.init(t,e),ns.init(t,e)}),Mu=h("$ZodBoolean",(t,e)=>{K.init(t,e),t._zod.pattern=qc,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}});var qu=h("$ZodNull",(t,e)=>{K.init(t,e),t._zod.pattern=Lc,t._zod.values=new Set([null]),t._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}});var Lu=h("$ZodUnknown",(t,e)=>{K.init(t,e),t._zod.parse=r=>r}),Uu=h("$ZodNever",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function su(t,e,r){t.issues.length&&e.issues.push(...Fe(r,t.issues)),e.value[r]=t.value}var Fu=h("$ZodArray",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);let s=[];for(let i=0;isu(u,r,i))):su(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function po(t,e,r){t.issues.length&&e.issues.push(...Fe(r,t.issues)),e.value[r]=t.value}function iu(t,e,r,o){t.issues.length?o[r]===void 0?r in o?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...Fe(r,t.issues)):t.value===void 0?r in o&&(e.value[r]=void 0):e.value[r]=t.value}var Vu=h("$ZodObject",(t,e)=>{K.init(t,e);let r=or(()=>{let p=Object.keys(e.shape);for(let m of p)if(!(e.shape[m]instanceof K))throw new Error(`Invalid element at key "${m}": expected a Zod schema`);let d=Kn(e.shape);return{shape:e.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(d)}});H(t._zod,"propValues",()=>{let p=e.shape,d={};for(let m in p){let _=p[m]._zod;if(_.values){d[m]??(d[m]=new Set);for(let g of _.values)d[m].add(g)}}return d});let o=p=>{let d=new lo(["shape","payload","ctx"]),m=r.value,_=b=>{let $=mt(b);return`shape[${$}]._zod.run({ value: input[${$}], issues: [] }, ctx)`};d.write("const input = payload.value;");let g=Object.create(null),y=0;for(let b of m.keys)g[b]=`key_${y++}`;d.write("const newResult = {}");for(let b of m.keys)if(m.optionalKeys.has(b)){let $=g[b];d.write(`const ${$} = ${_(b)};`);let z=mt(b);d.write(` +`))}};var su={major:4,minor:0,patch:0};var K=h("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=su;let o=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&o.unshift(t);for(let n of o)for(let s of n._zod.onattach)s(t);if(o.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let n=(s,i,a)=>{let c=ht(s),l;for(let u of i){if(u._zod.def.when){if(!u._zod.def.when(s))continue}else if(c)continue;let p=s.issues.length,d=u._zod.check(s);if(d instanceof Promise&&a?.async===!1)throw new We;if(l||d instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await d,s.issues.length!==p&&(c||(c=ht(s,p)))});else{if(s.issues.length===p)continue;c||(c=ht(s,p))}}return l?l.then(()=>s):s};t._zod.run=(s,i)=>{let a=t._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new We;return a.then(c=>n(c,o,i))}return n(a,o,i)}}t["~standard"]={validate:n=>{try{let s=ir(t,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return co(t,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),po=h("$ZodString",(t,e)=>{K.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Dc(t._zod.bag),t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),B=h("$ZodStringFormat",(t,e)=>{ar.init(t,e),po.init(t,e)}),hu=h("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Tc),B.init(t,e)}),_u=h("$ZodUUID",(t,e)=>{if(e.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(o===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Qn(o))}else e.pattern??(e.pattern=Qn());B.init(t,e)}),gu=h("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=wc),B.init(t,e)}),yu=h("$ZodURL",(t,e)=>{B.init(t,e),t._zod.check=r=>{try{let o=r.value,n=new URL(o),s=n.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Ic.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!o.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),vu=h("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=xc()),B.init(t,e)}),$u=h("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Sc),B.init(t,e)}),Su=h("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=_c),B.init(t,e)}),bu=h("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=gc),B.init(t,e)}),Tu=h("$ZodULID",(t,e)=>{e.pattern??(e.pattern=yc),B.init(t,e)}),wu=h("$ZodXID",(t,e)=>{e.pattern??(e.pattern=vc),B.init(t,e)}),xu=h("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=$c),B.init(t,e)}),zu=h("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Zc(e)),B.init(t,e)}),Eu=h("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Ac),B.init(t,e)}),ku=h("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=jc(e)),B.init(t,e)}),Pu=h("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=bc),B.init(t,e)}),Ru=h("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=zc),B.init(t,e),t._zod.onattach.push(r=>{let o=r._zod.bag;o.format="ipv4"})}),Iu=h("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Ec),B.init(t,e),t._zod.onattach.push(r=>{let o=r._zod.bag;o.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Ou=h("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=kc),B.init(t,e)}),Nu=h("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Pc),B.init(t,e),t._zod.check=r=>{let[o,n]=r.value.split("/");try{if(!n)throw new Error;let s=Number(n);if(`${s}`!==n)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Au(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Cu=h("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Rc),B.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{Au(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Dh(t){if(!es.test(t))return!1;let e=t.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Au(r)}var ju=h("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=es),B.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{Dh(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Zu=h("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Oc),B.init(t,e)});function Mh(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}var Du=h("$ZodJWT",(t,e)=>{B.init(t,e),t._zod.check=r=>{Mh(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var ss=h("$ZodNumber",(t,e)=>{K.init(t,e),t._zod.pattern=t._zod.bag.pattern??qc,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...s?{received:s}:{}}),r}}),Mu=h("$ZodNumber",(t,e)=>{Gc.init(t,e),ss.init(t,e)}),qu=h("$ZodBoolean",(t,e)=>{K.init(t,e),t._zod.pattern=Lc,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}});var Lu=h("$ZodNull",(t,e)=>{K.init(t,e),t._zod.pattern=Uc,t._zod.values=new Set([null]),t._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}});var Uu=h("$ZodUnknown",(t,e)=>{K.init(t,e),t._zod.parse=r=>r}),Fu=h("$ZodNever",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function iu(t,e,r){t.issues.length&&e.issues.push(...Fe(r,t.issues)),e.value[r]=t.value}var Vu=h("$ZodArray",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);let s=[];for(let i=0;iiu(l,r,i))):iu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function lo(t,e,r){t.issues.length&&e.issues.push(...Fe(r,t.issues)),e.value[r]=t.value}function au(t,e,r,o){t.issues.length?o[r]===void 0?r in o?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...Fe(r,t.issues)):t.value===void 0?r in o&&(e.value[r]=void 0):e.value[r]=t.value}var Hu=h("$ZodObject",(t,e)=>{K.init(t,e);let r=rr(()=>{let p=Object.keys(e.shape);for(let m of p)if(!(e.shape[m]instanceof K))throw new Error(`Invalid element at key "${m}": expected a Zod schema`);let d=Gn(e.shape);return{shape:e.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(d)}});H(t._zod,"propValues",()=>{let p=e.shape,d={};for(let m in p){let _=p[m]._zod;if(_.values){d[m]??(d[m]=new Set);for(let g of _.values)d[m].add(g)}}return d});let o=p=>{let d=new uo(["shape","payload","ctx"]),m=r.value,_=b=>{let $=mt(b);return`shape[${$}]._zod.run({ value: input[${$}], issues: [] }, ctx)`};d.write("const input = payload.value;");let g=Object.create(null),y=0;for(let b of m.keys)g[b]=`key_${y++}`;d.write("const newResult = {}");for(let b of m.keys)if(m.optionalKeys.has(b)){let $=g[b];d.write(`const ${$} = ${_(b)};`);let z=mt(b);d.write(` if (${$}.issues.length) { if (input[${z}] === undefined) { if (${z} in input) { @@ -30,21 +30,21 @@ var dh=Object.create;var Zn=Object.defineProperty;var fh=Object.getOwnPropertyDe if (${$}.issues.length) payload.issues = payload.issues.concat(${$}.issues.map(iss => ({ ...iss, path: iss.path ? [${mt(b)}, ...iss.path] : [${mt(b)}] - })));`),d.write(`newResult[${mt(b)}] = ${$}.value`)}d.write("payload.value = newResult;"),d.write("return payload;");let v=d.compile();return(b,$)=>v(p,b,$)},n,s=Pt,i=!no.jitless,c=i&&Vn.value,u=e.catchall,l;t._zod.parse=(p,d)=>{l??(l=r.value);let m=p.value;if(!s(m))return p.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),p;let _=[];if(i&&c&&d?.async===!1&&d.jitless!==!0)n||(n=o(e.shape)),p=n(p,d);else{p.value={};let $=l.shape;for(let z of l.keys){let k=$[z],ge=k._zod.run({value:m[z],issues:[]},d),Ee=k._zod.optin==="optional"&&k._zod.optout==="optional";ge instanceof Promise?_.push(ge.then(kt=>Ee?iu(kt,p,z,m):po(kt,p,z))):Ee?iu(ge,p,z,m):po(ge,p,z)}}if(!u)return _.length?Promise.all(_).then(()=>p):p;let g=[],y=l.keySet,v=u._zod,b=v.def.type;for(let $ of Object.keys(m)){if(y.has($))continue;if(b==="never"){g.push($);continue}let z=v.run({value:m[$],issues:[]},d);z instanceof Promise?_.push(z.then(k=>po(k,p,$))):po(z,p,$)}return g.length&&p.issues.push({code:"unrecognized_keys",keys:g,input:m,inst:t}),_.length?Promise.all(_).then(()=>p):p}});function au(t,e,r,o){for(let n of t)if(n.issues.length===0)return e.value=n.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(n=>n.issues.map(s=>Ce(s,o,ke())))}),e}var ss=h("$ZodUnion",(t,e)=>{K.init(t,e),H(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),H(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),H(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),H(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>sr(o.source)).join("|")})$`)}}),t._zod.parse=(r,o)=>{let n=!1,s=[];for(let i of e.options){let a=i._zod.run({value:r.value,issues:[]},o);if(a instanceof Promise)s.push(a),n=!0;else{if(a.issues.length===0)return a;s.push(a)}}return n?Promise.all(s).then(i=>au(i,r,t,o)):au(s,r,t,o)}}),Hu=h("$ZodDiscriminatedUnion",(t,e)=>{ss.init(t,e);let r=t._zod.parse;H(t._zod,"propValues",()=>{let n={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=or(()=>{let n=e.options,s=new Map;for(let i of n){let a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(n,s)=>{let i=n.value;if(!Pt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),n;let a=o.value.get(i?.[e.discriminator]);return a?a._zod.run(n,s):e.unionFallback?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),n)}}),Ku=h("$ZodIntersection",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value,s=e.left._zod.run({value:n,issues:[]},o),i=e.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>cu(r,c,u)):cu(r,s,i)}});function os(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Rt(t)&&Rt(e)){let r=Object.keys(e),o=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(let s of o){let i=os(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!Rt(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;let s=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=e.valueType._zod.run({value:n[c],issues:[]},o);u instanceof Promise?s.push(u.then(l=>{l.issues.length&&r.issues.push(...Fe(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...Fe(c,u.issues)),r.value[c]=u.value)}let a;for(let c in n)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(n)){if(i==="__proto__")continue;let a=e.keyType._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>Ce(u,o,ke())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}let c=e.valueType._zod.run({value:n[i],issues:[]},o);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(...Fe(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...Fe(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}});var Bu=h("$ZodEnum",(t,e)=>{K.init(t,e);let r=qn(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(o=>Hn.has(typeof o)).map(o=>typeof o=="string"?rt(o):o.toString()).join("|")})$`),t._zod.parse=(o,n)=>{let s=o.value;return t._zod.values.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:t}),o}}),Ju=h("$ZodLiteral",(t,e)=>{K.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?rt(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,o)=>{let n=r.value;return t._zod.values.has(n)||r.issues.push({code:"invalid_value",values:e.values,input:n,inst:t}),r}});var Wu=h("$ZodTransform",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=e.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r));if(n instanceof Promise)throw new We;return r.value=n,r}}),Yu=h("$ZodOptional",(t,e)=>{K.init(t,e),t._zod.optin="optional",t._zod.optout="optional",H(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),H(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${sr(r.source)})?$`):void 0}),t._zod.parse=(r,o)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,o):r.value===void 0?r:e.innerType._zod.run(r,o)}),Xu=h("$ZodNullable",(t,e)=>{K.init(t,e),H(t._zod,"optin",()=>e.innerType._zod.optin),H(t._zod,"optout",()=>e.innerType._zod.optout),H(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${sr(r.source)}|null)$`):void 0}),H(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,o)=>r.value===null?r:e.innerType._zod.run(r,o)}),Qu=h("$ZodDefault",(t,e)=>{K.init(t,e),t._zod.optin="optional",H(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>uu(s,e)):uu(n,e)}});function uu(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var el=h("$ZodPrefault",(t,e)=>{K.init(t,e),t._zod.optin="optional",H(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,o))}),tl=h("$ZodNonOptional",(t,e)=>{K.init(t,e),H(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),t._zod.parse=(r,o)=>{let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>lu(s,t)):lu(n,t)}});function lu(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var rl=h("$ZodCatch",(t,e)=>{K.init(t,e),t._zod.optin="optional",H(t._zod,"optout",()=>e.innerType._zod.optout),H(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>Ce(i,o,ke()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>Ce(s,o,ke()))},input:r.value}),r.issues=[]),r)}});var ol=h("$ZodPipe",(t,e)=>{K.init(t,e),H(t._zod,"values",()=>e.in._zod.values),H(t._zod,"optin",()=>e.in._zod.optin),H(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,o)=>{let n=e.in._zod.run(r,o);return n instanceof Promise?n.then(s=>pu(s,e,o)):pu(n,e,o)}});function pu(t,e,r){return ht(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}var nl=h("$ZodReadonly",(t,e)=>{K.init(t,e),H(t._zod,"propValues",()=>e.innerType._zod.propValues),H(t._zod,"values",()=>e.innerType._zod.values),H(t._zod,"optin",()=>e.innerType._zod.optin),H(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,o)=>{let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(du):du(n)}});function du(t){return t.value=Object.freeze(t.value),t}var sl=h("$ZodCustom",(t,e)=>{fe.init(t,e),K.init(t,e),t._zod.parse=(r,o)=>r,t._zod.check=r=>{let o=r.value,n=e.fn(o);if(n instanceof Promise)return n.then(s=>fu(s,r,o,t));fu(n,r,o,t)}});function fu(t,e,r,o){if(!t){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),e.issues.push(Bn(n))}}var qh=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},Lh=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(o){return t[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${qh(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${ao(o.values[0])}`:`Invalid option: expected one of ${so(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",s=e(o.origin);return s?`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",s=e(o.origin);return s?`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${s.unit}`:`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${r[n.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${so(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function il(){return{localeError:Lh()}}var is=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){let o=r[0];if(this._map.set(e,o),o&&typeof o=="object"&&"id"in o){if(this._idmap.has(o.id))throw new Error(`ID ${o.id} already exists in the registry`);this._idmap.set(o.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let o={...this.get(r)??{}};return delete o.id,{...o,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Uh(){return new is}var ur=Uh();function al(t,e){return new t({type:"string",...E(e)})}function cl(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...E(e)})}function as(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...E(e)})}function ul(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...E(e)})}function ll(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(e)})}function pl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(e)})}function dl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(e)})}function fl(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...E(e)})}function ml(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...E(e)})}function hl(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(e)})}function _l(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...E(e)})}function gl(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(e)})}function yl(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...E(e)})}function vl(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...E(e)})}function $l(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(e)})}function Sl(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(e)})}function bl(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(e)})}function Tl(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(e)})}function wl(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(e)})}function xl(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...E(e)})}function zl(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...E(e)})}function El(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...E(e)})}function kl(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...E(e)})}function Pl(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(e)})}function Rl(t,e){return new t({type:"string",format:"date",check:"string_format",...E(e)})}function Il(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...E(e)})}function Ol(t,e){return new t({type:"string",format:"duration",check:"string_format",...E(e)})}function Nl(t,e){return new t({type:"number",checks:[],...E(e)})}function Al(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...E(e)})}function Cl(t,e){return new t({type:"boolean",...E(e)})}function jl(t,e){return new t({type:"null",...E(e)})}function Zl(t){return new t({type:"unknown"})}function Dl(t,e){return new t({type:"never",...E(e)})}function mo(t,e){return new ts({check:"less_than",...E(e),value:t,inclusive:!1})}function lr(t,e){return new ts({check:"less_than",...E(e),value:t,inclusive:!0})}function ho(t,e){return new rs({check:"greater_than",...E(e),value:t,inclusive:!1})}function pr(t,e){return new rs({check:"greater_than",...E(e),value:t,inclusive:!0})}function _o(t,e){return new Hc({check:"multiple_of",...E(e),value:t})}function go(t,e){return new Gc({check:"max_length",...E(e),maximum:t})}function It(t,e){return new Bc({check:"min_length",...E(e),minimum:t})}function yo(t,e){return new Jc({check:"length_equals",...E(e),length:t})}function cs(t,e){return new Wc({check:"string_format",format:"regex",...E(e),pattern:t})}function us(t){return new Yc({check:"string_format",format:"lowercase",...E(t)})}function ls(t){return new Xc({check:"string_format",format:"uppercase",...E(t)})}function ps(t,e){return new Qc({check:"string_format",format:"includes",...E(e),includes:t})}function ds(t,e){return new eu({check:"string_format",format:"starts_with",...E(e),prefix:t})}function fs(t,e){return new tu({check:"string_format",format:"ends_with",...E(e),suffix:t})}function _t(t){return new ru({check:"overwrite",tx:t})}function ms(t){return _t(e=>e.normalize(t))}function hs(){return _t(t=>t.trim())}function _s(){return _t(t=>t.toLowerCase())}function gs(){return _t(t=>t.toUpperCase())}function Ml(t,e,r){return new t({type:"array",element:e,...E(r)})}function ql(t,e,r){let o=E(r);return o.abort??(o.abort=!0),new t({type:"custom",check:"custom",fn:e,...o})}function Ll(t,e,r){return new t({type:"custom",check:"custom",fn:e,...E(r)})}function vo(t){return!!t._zod}function ot(t,e){return vo(t)?ar(t,e):t.safeParse(e)}function $o(t){if(!t)return;let e;if(vo(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function So(t){if(vo(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=t.value;if(o!==void 0)return o}var fr={};sc(fr,{ZodISODate:()=>Fl,ZodISODateTime:()=>Ul,ZodISODuration:()=>Hl,ZodISOTime:()=>Vl,date:()=>vs,datetime:()=>ys,duration:()=>Ss,time:()=>$s});var Ul=h("ZodISODateTime",(t,e)=>{xu.init(t,e),X.init(t,e)});function ys(t){return Pl(Ul,t)}var Fl=h("ZodISODate",(t,e)=>{zu.init(t,e),X.init(t,e)});function vs(t){return Rl(Fl,t)}var Vl=h("ZodISOTime",(t,e)=>{Eu.init(t,e),X.init(t,e)});function $s(t){return Il(Vl,t)}var Hl=h("ZodISODuration",(t,e)=>{ku.init(t,e),X.init(t,e)});function Ss(t){return Ol(Hl,t)}var Kl=(t,e)=>{co.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>dc(t,r)},flatten:{value:r=>pc(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},qw=h("ZodError",Kl),mr=h("ZodError",Kl,{Parent:Error});var Gl=fc(mr),Bl=mc(mr),Jl=Wn(mr),Wl=Yn(mr);var te=h("ZodType",(t,e)=>(K.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),t.clone=(r,o)=>Ue(t,r,o),t.brand=()=>t,t.register=((r,o)=>(r.add(t,o),t)),t.parse=(r,o)=>Gl(t,r,o,{callee:t.parse}),t.safeParse=(r,o)=>Jl(t,r,o),t.parseAsync=async(r,o)=>Bl(t,r,o,{callee:t.parseAsync}),t.safeParseAsync=async(r,o)=>Wl(t,r,o),t.spa=t.safeParseAsync,t.refine=(r,o)=>t.check(M_(r,o)),t.superRefine=r=>t.check(q_(r)),t.overwrite=r=>t.check(_t(r)),t.optional=()=>ee(t),t.nullable=()=>Ql(t),t.nullish=()=>ee(Ql(t)),t.nonoptional=r=>O_(t,r),t.array=()=>j(t),t.or=r=>J([t,r]),t.and=r=>To(t,r),t.transform=r=>Ts(t,sp(r)),t.default=r=>P_(t,r),t.prefault=r=>I_(t,r),t.catch=r=>A_(t,r),t.pipe=r=>Ts(t,r),t.readonly=()=>Z_(t),t.describe=r=>{let o=t.clone();return ur.add(o,{description:r}),o},Object.defineProperty(t,"description",{get(){return ur.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return ur.get(t);let o=t.clone();return ur.add(o,r[0]),o},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),ep=h("_ZodString",(t,e)=>{fo.init(t,e),te.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...o)=>t.check(cs(...o)),t.includes=(...o)=>t.check(ps(...o)),t.startsWith=(...o)=>t.check(ds(...o)),t.endsWith=(...o)=>t.check(fs(...o)),t.min=(...o)=>t.check(It(...o)),t.max=(...o)=>t.check(go(...o)),t.length=(...o)=>t.check(yo(...o)),t.nonempty=(...o)=>t.check(It(1,...o)),t.lowercase=o=>t.check(us(o)),t.uppercase=o=>t.check(ls(o)),t.trim=()=>t.check(hs()),t.normalize=(...o)=>t.check(ms(...o)),t.toLowerCase=()=>t.check(_s()),t.toUpperCase=()=>t.check(gs())}),Yh=h("ZodString",(t,e)=>{fo.init(t,e),ep.init(t,e),t.email=r=>t.check(cl(Xh,r)),t.url=r=>t.check(fl(Qh,r)),t.jwt=r=>t.check(kl(m_,r)),t.emoji=r=>t.check(ml(e_,r)),t.guid=r=>t.check(as(Yl,r)),t.uuid=r=>t.check(ul(bo,r)),t.uuidv4=r=>t.check(ll(bo,r)),t.uuidv6=r=>t.check(pl(bo,r)),t.uuidv7=r=>t.check(dl(bo,r)),t.nanoid=r=>t.check(hl(t_,r)),t.guid=r=>t.check(as(Yl,r)),t.cuid=r=>t.check(_l(r_,r)),t.cuid2=r=>t.check(gl(o_,r)),t.ulid=r=>t.check(yl(n_,r)),t.base64=r=>t.check(xl(p_,r)),t.base64url=r=>t.check(zl(d_,r)),t.xid=r=>t.check(vl(s_,r)),t.ksuid=r=>t.check($l(i_,r)),t.ipv4=r=>t.check(Sl(a_,r)),t.ipv6=r=>t.check(bl(c_,r)),t.cidrv4=r=>t.check(Tl(u_,r)),t.cidrv6=r=>t.check(wl(l_,r)),t.e164=r=>t.check(El(f_,r)),t.datetime=r=>t.check(ys(r)),t.date=r=>t.check(vs(r)),t.time=r=>t.check($s(r)),t.duration=r=>t.check(Ss(r))});function f(t){return al(Yh,t)}var X=h("ZodStringFormat",(t,e)=>{B.init(t,e),ep.init(t,e)}),Xh=h("ZodEmail",(t,e)=>{_u.init(t,e),X.init(t,e)});var Yl=h("ZodGUID",(t,e)=>{mu.init(t,e),X.init(t,e)});var bo=h("ZodUUID",(t,e)=>{hu.init(t,e),X.init(t,e)});var Qh=h("ZodURL",(t,e)=>{gu.init(t,e),X.init(t,e)});var e_=h("ZodEmoji",(t,e)=>{yu.init(t,e),X.init(t,e)});var t_=h("ZodNanoID",(t,e)=>{vu.init(t,e),X.init(t,e)});var r_=h("ZodCUID",(t,e)=>{$u.init(t,e),X.init(t,e)});var o_=h("ZodCUID2",(t,e)=>{Su.init(t,e),X.init(t,e)});var n_=h("ZodULID",(t,e)=>{bu.init(t,e),X.init(t,e)});var s_=h("ZodXID",(t,e)=>{Tu.init(t,e),X.init(t,e)});var i_=h("ZodKSUID",(t,e)=>{wu.init(t,e),X.init(t,e)});var a_=h("ZodIPv4",(t,e)=>{Pu.init(t,e),X.init(t,e)});var c_=h("ZodIPv6",(t,e)=>{Ru.init(t,e),X.init(t,e)});var u_=h("ZodCIDRv4",(t,e)=>{Iu.init(t,e),X.init(t,e)});var l_=h("ZodCIDRv6",(t,e)=>{Ou.init(t,e),X.init(t,e)});var p_=h("ZodBase64",(t,e)=>{Au.init(t,e),X.init(t,e)});var d_=h("ZodBase64URL",(t,e)=>{Cu.init(t,e),X.init(t,e)});var f_=h("ZodE164",(t,e)=>{ju.init(t,e),X.init(t,e)});var m_=h("ZodJWT",(t,e)=>{Zu.init(t,e),X.init(t,e)});var tp=h("ZodNumber",(t,e)=>{ns.init(t,e),te.init(t,e),t.gt=(o,n)=>t.check(ho(o,n)),t.gte=(o,n)=>t.check(pr(o,n)),t.min=(o,n)=>t.check(pr(o,n)),t.lt=(o,n)=>t.check(mo(o,n)),t.lte=(o,n)=>t.check(lr(o,n)),t.max=(o,n)=>t.check(lr(o,n)),t.int=o=>t.check(Xl(o)),t.safe=o=>t.check(Xl(o)),t.positive=o=>t.check(ho(0,o)),t.nonnegative=o=>t.check(pr(0,o)),t.negative=o=>t.check(mo(0,o)),t.nonpositive=o=>t.check(lr(0,o)),t.multipleOf=(o,n)=>t.check(_o(o,n)),t.step=(o,n)=>t.check(_o(o,n)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function U(t){return Nl(tp,t)}var h_=h("ZodNumberFormat",(t,e)=>{Du.init(t,e),tp.init(t,e)});function Xl(t){return Al(h_,t)}var __=h("ZodBoolean",(t,e)=>{Mu.init(t,e),te.init(t,e)});function ie(t){return Cl(__,t)}var g_=h("ZodNull",(t,e)=>{qu.init(t,e),te.init(t,e)});function rp(t){return jl(g_,t)}var y_=h("ZodUnknown",(t,e)=>{Lu.init(t,e),te.init(t,e)});function Q(){return Zl(y_)}var v_=h("ZodNever",(t,e)=>{Uu.init(t,e),te.init(t,e)});function $_(t){return Dl(v_,t)}var S_=h("ZodArray",(t,e)=>{Fu.init(t,e),te.init(t,e),t.element=e.element,t.min=(r,o)=>t.check(It(r,o)),t.nonempty=r=>t.check(It(1,r)),t.max=(r,o)=>t.check(go(r,o)),t.length=(r,o)=>t.check(yo(r,o)),t.unwrap=()=>t.element});function j(t,e){return Ml(S_,t,e)}var op=h("ZodObject",(t,e)=>{Vu.init(t,e),te.init(t,e),L.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Se(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Q()}),t.loose=()=>t.clone({...t._zod.def,catchall:Q()}),t.strict=()=>t.clone({...t._zod.def,catchall:$_()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>L.extend(t,r),t.merge=r=>L.merge(t,r),t.pick=r=>L.pick(t,r),t.omit=r=>L.omit(t,r),t.partial=(...r)=>L.partial(ip,t,r[0]),t.required=(...r)=>L.required(ap,t,r[0])});function T(t,e){let r={type:"object",get shape(){return L.assignProp(this,"shape",{...t}),this.shape},...L.normalizeParams(e)};return new op(r)}function ye(t,e){return new op({type:"object",get shape(){return L.assignProp(this,"shape",{...t}),this.shape},catchall:Q(),...L.normalizeParams(e)})}var np=h("ZodUnion",(t,e)=>{ss.init(t,e),te.init(t,e),t.options=e.options});function J(t,e){return new np({type:"union",options:t,...L.normalizeParams(e)})}var b_=h("ZodDiscriminatedUnion",(t,e)=>{np.init(t,e),Hu.init(t,e)});function ws(t,e,r){return new b_({type:"union",options:e,discriminator:t,...L.normalizeParams(r)})}var T_=h("ZodIntersection",(t,e)=>{Ku.init(t,e),te.init(t,e)});function To(t,e){return new T_({type:"intersection",left:t,right:e})}var w_=h("ZodRecord",(t,e)=>{Gu.init(t,e),te.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function G(t,e,r){return new w_({type:"record",keyType:t,valueType:e,...L.normalizeParams(r)})}var bs=h("ZodEnum",(t,e)=>{Bu.init(t,e),te.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new bs({...e,checks:[],...L.normalizeParams(n),entries:s})},t.exclude=(o,n)=>{let s={...e.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new bs({...e,checks:[],...L.normalizeParams(n),entries:s})}});function Se(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new bs({type:"enum",entries:r,...L.normalizeParams(e)})}var x_=h("ZodLiteral",(t,e)=>{Ju.init(t,e),te.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function w(t,e){return new x_({type:"literal",values:Array.isArray(t)?t:[t],...L.normalizeParams(e)})}var z_=h("ZodTransform",(t,e)=>{Wu.init(t,e),te.init(t,e),t._zod.parse=(r,o)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(L.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(L.issue(i))}};let n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function sp(t){return new z_({type:"transform",transform:t})}var ip=h("ZodOptional",(t,e)=>{Yu.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ee(t){return new ip({type:"optional",innerType:t})}var E_=h("ZodNullable",(t,e)=>{Xu.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ql(t){return new E_({type:"nullable",innerType:t})}var k_=h("ZodDefault",(t,e)=>{Qu.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function P_(t,e){return new k_({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var R_=h("ZodPrefault",(t,e)=>{el.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function I_(t,e){return new R_({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var ap=h("ZodNonOptional",(t,e)=>{tl.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function O_(t,e){return new ap({type:"nonoptional",innerType:t,...L.normalizeParams(e)})}var N_=h("ZodCatch",(t,e)=>{rl.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function A_(t,e){return new N_({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var C_=h("ZodPipe",(t,e)=>{ol.init(t,e),te.init(t,e),t.in=e.in,t.out=e.out});function Ts(t,e){return new C_({type:"pipe",in:t,out:e})}var j_=h("ZodReadonly",(t,e)=>{nl.init(t,e),te.init(t,e)});function Z_(t){return new j_({type:"readonly",innerType:t})}var cp=h("ZodCustom",(t,e)=>{sl.init(t,e),te.init(t,e)});function D_(t){let e=new fe({check:"custom"});return e._zod.check=t,e}function up(t,e){return ql(cp,t??(()=>!0),e)}function M_(t,e={}){return Ll(cp,t,e)}function q_(t){let e=D_(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(L.issue(o,r.value,e._zod.def));else{let n=o;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=e),n.continue??(n.continue=!e._zod.def.abort),r.issues.push(L.issue(n))}},t(r.value,r)));return e}function xs(t,e){return Ts(sp(t),e)}ke(il());var Es="2025-11-25";var lp=[Es,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],nt="io.modelcontextprotocol/related-task",xo="2.0",ne=up(t=>t!==null&&(typeof t=="object"||typeof t=="function")),pp=J([f(),U().int()]),dp=f(),Nx=ye({ttl:U().optional(),pollInterval:U().optional()}),L_=T({ttl:U().optional()}),U_=T({taskId:f()}),ks=ye({progressToken:pp.optional(),[nt]:U_.optional()}),ze=T({_meta:ks.optional()}),hr=ze.extend({task:L_.optional()}),fp=t=>hr.safeParse(t).success,ae=T({method:f(),params:ze.loose().optional()}),Pe=T({_meta:ks.optional()}),Re=T({method:f(),params:Pe.loose().optional()}),ce=ye({_meta:ks.optional()}),zo=J([f(),U().int()]),mp=T({jsonrpc:w(xo),id:zo,...ae.shape}).strict(),Ps=t=>mp.safeParse(t).success,hp=T({jsonrpc:w(xo),...Re.shape}).strict(),_p=t=>hp.safeParse(t).success,Rs=T({jsonrpc:w(xo),id:zo,result:ce}).strict(),_r=t=>Rs.safeParse(t).success;var C;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(C||(C={}));var Is=T({jsonrpc:w(xo),id:zo.optional(),error:T({code:U().int(),message:f(),data:Q().optional()})}).strict();var gp=t=>Is.safeParse(t).success;var yp=J([mp,hp,Rs,Is]),Ax=J([Rs,Is]),Eo=ce.strict(),F_=Pe.extend({requestId:zo.optional(),reason:f().optional()}),Nt=Re.extend({method:w("notifications/cancelled"),params:F_}),V_=T({src:f(),mimeType:f().optional(),sizes:j(f()).optional(),theme:Se(["light","dark"]).optional()}),gr=T({icons:j(V_).optional()}),Ot=T({name:f(),title:f().optional()}),vp=Ot.extend({...Ot.shape,...gr.shape,version:f(),websiteUrl:f().optional(),description:f().optional()}),H_=To(T({applyDefaults:ie().optional()}),G(f(),Q())),K_=xs(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,To(T({form:H_.optional(),url:ne.optional()}),G(f(),Q()).optional())),G_=ye({list:ne.optional(),cancel:ne.optional(),requests:ye({sampling:ye({createMessage:ne.optional()}).optional(),elicitation:ye({create:ne.optional()}).optional()}).optional()}),B_=ye({list:ne.optional(),cancel:ne.optional(),requests:ye({tools:ye({call:ne.optional()}).optional()}).optional()}),J_=T({experimental:G(f(),ne).optional(),sampling:T({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:K_.optional(),roots:T({listChanged:ie().optional()}).optional(),tasks:G_.optional(),extensions:G(f(),ne).optional()}),W_=ze.extend({protocolVersion:f(),capabilities:J_,clientInfo:vp}),yr=ae.extend({method:w("initialize"),params:W_});var Y_=T({experimental:G(f(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:T({listChanged:ie().optional()}).optional(),resources:T({subscribe:ie().optional(),listChanged:ie().optional()}).optional(),tools:T({listChanged:ie().optional()}).optional(),tasks:B_.optional(),extensions:G(f(),ne).optional()}),X_=ce.extend({protocolVersion:f(),capabilities:Y_,serverInfo:vp,instructions:f().optional()}),Os=Re.extend({method:w("notifications/initialized"),params:Pe.optional()});var ko=ae.extend({method:w("ping"),params:ze.optional()}),Q_=T({progress:U(),total:ee(U()),message:ee(f())}),eg=T({...Pe.shape,...Q_.shape,progressToken:pp}),Po=Re.extend({method:w("notifications/progress"),params:eg}),tg=ze.extend({cursor:dp.optional()}),vr=ae.extend({params:tg.optional()}),$r=ce.extend({nextCursor:dp.optional()}),rg=Se(["working","input_required","completed","failed","cancelled"]),Sr=T({taskId:f(),status:rg,ttl:J([U(),rp()]),createdAt:f(),lastUpdatedAt:f(),pollInterval:ee(U()),statusMessage:ee(f())}),At=ce.extend({task:Sr}),og=Pe.merge(Sr),br=Re.extend({method:w("notifications/tasks/status"),params:og}),Ro=ae.extend({method:w("tasks/get"),params:ze.extend({taskId:f()})}),Io=ce.merge(Sr),Oo=ae.extend({method:w("tasks/result"),params:ze.extend({taskId:f()})}),Cx=ce.loose(),No=vr.extend({method:w("tasks/list")}),Ao=$r.extend({tasks:j(Sr)}),Co=ae.extend({method:w("tasks/cancel"),params:ze.extend({taskId:f()})}),$p=ce.merge(Sr),Sp=T({uri:f(),mimeType:ee(f()),_meta:G(f(),Q()).optional()}),bp=Sp.extend({text:f()}),Ns=f().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Tp=Sp.extend({blob:Ns}),Tr=Se(["user","assistant"]),Ct=T({audience:j(Tr).optional(),priority:U().min(0).max(1).optional(),lastModified:fr.datetime({offset:!0}).optional()}),wp=T({...Ot.shape,...gr.shape,uri:f(),description:ee(f()),mimeType:ee(f()),size:ee(U()),annotations:Ct.optional(),_meta:ee(ye({}))}),ng=T({...Ot.shape,...gr.shape,uriTemplate:f(),description:ee(f()),mimeType:ee(f()),annotations:Ct.optional(),_meta:ee(ye({}))}),As=vr.extend({method:w("resources/list")}),sg=$r.extend({resources:j(wp)}),Cs=vr.extend({method:w("resources/templates/list")}),ig=$r.extend({resourceTemplates:j(ng)}),js=ze.extend({uri:f()}),ag=js,Zs=ae.extend({method:w("resources/read"),params:ag}),cg=ce.extend({contents:j(J([bp,Tp]))}),ug=Re.extend({method:w("notifications/resources/list_changed"),params:Pe.optional()}),lg=js,Ds=ae.extend({method:w("resources/subscribe"),params:lg}),pg=js,Ms=ae.extend({method:w("resources/unsubscribe"),params:pg}),dg=Pe.extend({uri:f()}),fg=Re.extend({method:w("notifications/resources/updated"),params:dg}),mg=T({name:f(),description:ee(f()),required:ee(ie())}),hg=T({...Ot.shape,...gr.shape,description:ee(f()),arguments:ee(j(mg)),_meta:ee(ye({}))}),qs=vr.extend({method:w("prompts/list")}),_g=$r.extend({prompts:j(hg)}),gg=ze.extend({name:f(),arguments:G(f(),f()).optional()}),Ls=ae.extend({method:w("prompts/get"),params:gg}),Us=T({type:w("text"),text:f(),annotations:Ct.optional(),_meta:G(f(),Q()).optional()}),Fs=T({type:w("image"),data:Ns,mimeType:f(),annotations:Ct.optional(),_meta:G(f(),Q()).optional()}),Vs=T({type:w("audio"),data:Ns,mimeType:f(),annotations:Ct.optional(),_meta:G(f(),Q()).optional()}),yg=T({type:w("tool_use"),name:f(),id:f(),input:G(f(),Q()),_meta:G(f(),Q()).optional()}),vg=T({type:w("resource"),resource:J([bp,Tp]),annotations:Ct.optional(),_meta:G(f(),Q()).optional()}),$g=wp.extend({type:w("resource_link")}),Hs=J([Us,Fs,Vs,$g,vg]),Sg=T({role:Tr,content:Hs}),bg=ce.extend({description:f().optional(),messages:j(Sg)}),Tg=Re.extend({method:w("notifications/prompts/list_changed"),params:Pe.optional()}),wg=T({title:f().optional(),readOnlyHint:ie().optional(),destructiveHint:ie().optional(),idempotentHint:ie().optional(),openWorldHint:ie().optional()}),xg=T({taskSupport:Se(["required","optional","forbidden"]).optional()}),xp=T({...Ot.shape,...gr.shape,description:f().optional(),inputSchema:T({type:w("object"),properties:G(f(),ne).optional(),required:j(f()).optional()}).catchall(Q()),outputSchema:T({type:w("object"),properties:G(f(),ne).optional(),required:j(f()).optional()}).catchall(Q()).optional(),annotations:wg.optional(),execution:xg.optional(),_meta:G(f(),Q()).optional()}),Ks=vr.extend({method:w("tools/list")}),zg=$r.extend({tools:j(xp)}),jo=ce.extend({content:j(Hs).default([]),structuredContent:G(f(),Q()).optional(),isError:ie().optional()}),jx=jo.or(ce.extend({toolResult:Q()})),Eg=hr.extend({name:f(),arguments:G(f(),Q()).optional()}),wr=ae.extend({method:w("tools/call"),params:Eg}),kg=Re.extend({method:w("notifications/tools/list_changed"),params:Pe.optional()}),Zx=T({autoRefresh:ie().default(!0),debounceMs:U().int().nonnegative().default(300)}),xr=Se(["debug","info","notice","warning","error","critical","alert","emergency"]),Pg=ze.extend({level:xr}),Gs=ae.extend({method:w("logging/setLevel"),params:Pg}),Rg=Pe.extend({level:xr,logger:f().optional(),data:Q()}),Ig=Re.extend({method:w("notifications/message"),params:Rg}),Og=T({name:f().optional()}),Ng=T({hints:j(Og).optional(),costPriority:U().min(0).max(1).optional(),speedPriority:U().min(0).max(1).optional(),intelligencePriority:U().min(0).max(1).optional()}),Ag=T({mode:Se(["auto","required","none"]).optional()}),Cg=T({type:w("tool_result"),toolUseId:f().describe("The unique identifier for the corresponding tool call."),content:j(Hs).default([]),structuredContent:T({}).loose().optional(),isError:ie().optional(),_meta:G(f(),Q()).optional()}),jg=ws("type",[Us,Fs,Vs]),wo=ws("type",[Us,Fs,Vs,yg,Cg]),Zg=T({role:Tr,content:J([wo,j(wo)]),_meta:G(f(),Q()).optional()}),Dg=hr.extend({messages:j(Zg),modelPreferences:Ng.optional(),systemPrompt:f().optional(),includeContext:Se(["none","thisServer","allServers"]).optional(),temperature:U().optional(),maxTokens:U().int(),stopSequences:j(f()).optional(),metadata:ne.optional(),tools:j(xp).optional(),toolChoice:Ag.optional()}),Mg=ae.extend({method:w("sampling/createMessage"),params:Dg}),zr=ce.extend({model:f(),stopReason:ee(Se(["endTurn","stopSequence","maxTokens"]).or(f())),role:Tr,content:jg}),Bs=ce.extend({model:f(),stopReason:ee(Se(["endTurn","stopSequence","maxTokens","toolUse"]).or(f())),role:Tr,content:J([wo,j(wo)])}),qg=T({type:w("boolean"),title:f().optional(),description:f().optional(),default:ie().optional()}),Lg=T({type:w("string"),title:f().optional(),description:f().optional(),minLength:U().optional(),maxLength:U().optional(),format:Se(["email","uri","date","date-time"]).optional(),default:f().optional()}),Ug=T({type:Se(["number","integer"]),title:f().optional(),description:f().optional(),minimum:U().optional(),maximum:U().optional(),default:U().optional()}),Fg=T({type:w("string"),title:f().optional(),description:f().optional(),enum:j(f()),default:f().optional()}),Vg=T({type:w("string"),title:f().optional(),description:f().optional(),oneOf:j(T({const:f(),title:f()})),default:f().optional()}),Hg=T({type:w("string"),title:f().optional(),description:f().optional(),enum:j(f()),enumNames:j(f()).optional(),default:f().optional()}),Kg=J([Fg,Vg]),Gg=T({type:w("array"),title:f().optional(),description:f().optional(),minItems:U().optional(),maxItems:U().optional(),items:T({type:w("string"),enum:j(f())}),default:j(f()).optional()}),Bg=T({type:w("array"),title:f().optional(),description:f().optional(),minItems:U().optional(),maxItems:U().optional(),items:T({anyOf:j(T({const:f(),title:f()}))}),default:j(f()).optional()}),Jg=J([Gg,Bg]),Wg=J([Hg,Kg,Jg]),Yg=J([Wg,qg,Lg,Ug]),Xg=hr.extend({mode:w("form").optional(),message:f(),requestedSchema:T({type:w("object"),properties:G(f(),Yg),required:j(f()).optional()})}),Qg=hr.extend({mode:w("url"),message:f(),elicitationId:f(),url:f().url()}),ey=J([Xg,Qg]),ty=ae.extend({method:w("elicitation/create"),params:ey}),ry=Pe.extend({elicitationId:f()}),oy=Re.extend({method:w("notifications/elicitation/complete"),params:ry}),jt=ce.extend({action:Se(["accept","decline","cancel"]),content:xs(t=>t===null?void 0:t,G(f(),J([f(),U(),ie(),j(f())])).optional())}),ny=T({type:w("ref/resource"),uri:f()});var sy=T({type:w("ref/prompt"),name:f()}),iy=ze.extend({ref:J([sy,ny]),argument:T({name:f(),value:f()}),context:T({arguments:G(f(),f()).optional()}).optional()}),ay=ae.extend({method:w("completion/complete"),params:iy});var cy=ce.extend({completion:ye({values:j(f()).max(100),total:ee(U().int()),hasMore:ee(ie())})}),uy=T({uri:f().startsWith("file://"),name:f().optional(),_meta:G(f(),Q()).optional()}),ly=ae.extend({method:w("roots/list"),params:ze.optional()}),Js=ce.extend({roots:j(uy)}),py=Re.extend({method:w("notifications/roots/list_changed"),params:Pe.optional()}),Dx=J([ko,yr,ay,Gs,Ls,qs,As,Cs,Zs,Ds,Ms,wr,Ks,Ro,Oo,No,Co]),Mx=J([Nt,Po,Os,py,br]),qx=J([Eo,zr,Bs,jt,Js,Io,Ao,At]),Lx=J([ko,Mg,ty,ly,Ro,Oo,No,Co]),Ux=J([Nt,Po,Ig,fg,ug,kg,Tg,br,oy]),Fx=J([Eo,X_,cy,bg,_g,sg,ig,cg,jo,zg,Io,Ao,At]),R=class t extends Error{constructor(e,r,o){super(`MCP error ${e}: ${r}`),this.code=e,this.data=o,this.name="McpError"}static fromError(e,r,o){if(e===C.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new zs(n.elicitations,r)}return new t(e,r,o)}},zs=class extends R{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(C.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function st(t){return t==="completed"||t==="failed"||t==="cancelled"}var bz=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ws(t){let r=$o(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=So(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function Ys(t,e){let r=ot(t,e);if(!r.success)throw r.error;return r.data}var gy=6e4,Zo=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Nt,r=>{this._oncancel(r)}),this.setNotificationHandler(Po,r=>{this._onprogress(r)}),this.setRequestHandler(ko,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ro,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(C.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Oo,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let p=c,d=new R(p.error.code,p.error.message,p.error.data);l(d)}else{let p=a.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new R(C.InvalidParams,`Task not found: ${s}`);if(!st(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(st(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[nt]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(No,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new R(C.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Co,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(C.InvalidParams,`Task not found: ${r.params.taskId}`);if(st(n.status))throw new R(C.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new R(C.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof R?n:new R(C.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,o,n,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),R.fromError(C.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),_r(s)||gp(s)?this._onresponse(s):Ps(s)?this._onrequest(s,i):_p(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(C.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of e.values())o(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){let o=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,s=e.params?._meta?.[nt]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:C.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(p=>this._onerror(new Error(`Failed to enqueue error response: ${p}`))):n?.send(l).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=fp(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let p={relatedRequestId:e.id};s&&(p.relatedTask={taskId:s}),await this.notification(l,p)},sendRequest:async(l,p,d)=>{if(i.signal.aborted)throw new R(C.ConnectionClosed,"Request was cancelled");let m={...d,relatedRequestId:e.id};s&&!m.relatedTask&&(m.relatedTask={taskId:s});let _=m.relatedTask?.taskId??s;return _&&c&&await c.updateTaskStatus(_,"input_required"),await this.request(l,p,m)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>o(e,u)).then(async l=>{if(i.signal.aborted)return;let p={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:p,timestamp:Date.now()},n?.sessionId):await n?.send(p)},async l=>{if(i.signal.aborted)return;let p={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:C.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:p,timestamp:Date.now()},n?.sessionId):await n?.send(p)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...o}=e.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(e){let r=Number(e.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),_r(e))o(e);else{let i=new R(e.error.code,e.error.message,e.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(_r(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),_r(e))n(e);else{let i=R.fromError(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(e,r,o)}}catch(i){yield{type:"error",error:i instanceof R?i:new R(C.InternalError,String(i))}}return}let s;try{let i=await this.request(e,At,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new R(C.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},st(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new R(C.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new R(C.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof R?i:new R(C.InternalError,String(i))}}}request(e,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let p=b=>{l(b)};if(!this._transport){p(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(b){p(b);return}o?.signal?.throwIfAborted();let d=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:d};o?.onprogress&&(this._progressHandlers.set(d,o.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[nt]:c}});let _=b=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(b)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(z=>this._onerror(new Error(`Failed to send cancellation: ${z}`)));let $=b instanceof R?b:new R(C.RequestTimeout,String(b));l($)};this._responseHandlers.set(d,b=>{if(!o?.signal?.aborted){if(b instanceof Error)return l(b);try{let $=ot(r,b.result);$.success?u($.data):l($.error)}catch($){l($)}}}),o?.signal?.addEventListener("abort",()=>{_(o?.signal?.reason)});let g=o?.timeout??gy,y=()=>_(R.fromError(C.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(d,g,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let b=$=>{let z=this._responseHandlers.get(d);z?z($):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,b),this._enqueueTaskMessage(v,{type:"request",message:m,timestamp:Date.now()}).catch($=>{this._cleanupTimeout(d),l($)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(b=>{this._cleanupTimeout(d),l(b)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Io,r)}async getTaskResult(e,r,o){return this.request({method:"tasks/result",params:e},r,o)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Ao,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},$p,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let o=r?.relatedTask?.taskId;if(o){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[nt]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[nt]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[nt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let o=Ws(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=Ys(e,n);return Promise.resolve(r(i,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let o=Ws(e);this._notificationHandlers.set(o,n=>{let s=Ys(e,n);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,o,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(e,r);for(let n of o)if(n.type==="request"&&Ps(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new R(C.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(e);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new R(C.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new R(C.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await o.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new R(C.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=br.parse({method:"notifications/tasks/status",params:a});await this.notification(c),st(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new R(C.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(st(a.status))throw new R(C.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=br.parse({method:"notifications/tasks/status",params:c});await this.notification(u),st(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function zp(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Ep(t,e){let r={...t};for(let o in e){let n=o,s=e[n];if(s===void 0)continue;let i=r[n];zp(i)&&zp(s)?r[n]={...i,...s}:r[n]=s}return r}var vm=ic(Za(),1),$m=ic(ym(),1);function ST(){let t=new vm.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,$m.default)(t),t}var vn=class{constructor(e){this._ajv=e??ST()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var $n=class{constructor(e){this._server=e}requestStream(e,r,o){return this._server.requestStream(e,r,o)}createMessageStream(e,r){let o=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!o?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],i=s.some(l=>l.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(d=>d.type==="tool_use").map(d=>d.id)),p=new Set(s.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(l.size!==p.size||![...l].every(d=>p.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},zr,r)}elicitInputStream(e,r){let o=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!o?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!o?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:s},jt,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,o){return this._server.getTaskResult({taskId:e},r,o)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function Sm(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function bm(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var Sn=class extends Zo{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(xr.options.map((o,n)=>[o,n])),this.isMessageIgnored=(o,n)=>{let s=this._loggingLevels.get(n);return s?this.LOG_LEVEL_SEVERITY.get(o)this._oninitialize(o)),this.setNotificationHandler(Os,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Gs,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=xr.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new $n(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ep(this._capabilities,e)}setRequestHandler(e,r){let n=$o(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let s=So(n);if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=ot(wr,c);if(!l.success){let _=l.error instanceof Error?l.error.message:String(l.error);throw new R(C.InvalidParams,`Invalid tools/call request: ${_}`)}let{params:p}=l.data,d=await Promise.resolve(r(c,u));if(p.task){let _=ot(At,d);if(!_.success){let g=_.error instanceof Error?_.error.message:String(_.error);throw new R(C.InvalidParams,`Invalid task creation result: ${g}`)}return _.data}let m=ot(jo,d);if(!m.success){let _=m.error instanceof Error?m.error.message:String(m.error);throw new R(C.InvalidParams,`Invalid tools/call result: ${_}`)}return m.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){bm(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&Sm(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:lp.includes(r)?r:Es,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Eo)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(n.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(p=>p.type==="tool_use").map(p=>p.id)),l=new Set(n.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(u.size!==l.size||![...u].every(p=>l.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Bs,r):this.request({method:"sampling/createMessage",params:e},zr,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},jt,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:n},jt,r);if(s.action==="accept"&&s.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(s.content);if(!a.valid)throw new R(C.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof R?i:new R(C.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Js,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import wm from"node:process";var bT=10*1024*1024,bn=class{constructor(e){this._maxBufferSize=e?.maxBufferSize??bT}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(` -`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),TT(r)}clear(){this._buffer=void 0}};function TT(t){return yp.parse(JSON.parse(t))}function Tm(t){return JSON.stringify(t)+` -`}var Tn=class{constructor(e=wm.stdin,r=wm.stdout,o){this._stdin=e,this._stdout=r,this._started=!1,this._ondata=n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(s){this.onerror?.(s),this.close().catch(()=>{})}},this._onerror=n=>{this.onerror?.(n)},this._readBuffer=new bn({maxBufferSize:o?.maxBufferSize})}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let o=Tm(e);this._stdout.write(o)?r():this._stdout.once("drain",r)})}};var wn=class t{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,r,o){if(e.length>r)throw new Error(`${o} exceeds maximum length of ${r} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){t.validateLength(e,1e6,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){let r=[],o="",n=0,s=0;for(;n1e4)throw new Error("Template contains too many expressions (max 10000)");let a=e.slice(n+1,i),c=this.getOperator(a),u=a.includes("*"),l=this.getNames(a),p=l[0];for(let d of l)t.validateLength(d,1e6,"Variable name");r.push({name:p,operator:c,names:l,exploded:u}),n=i+1}else o+=e[n],n++;return o&&r.push(o),r}getOperator(e){return["+","#",".","/","?","&"].find(o=>e.startsWith(o))||""}getNames(e){let r=this.getOperator(e);return e.slice(r.length).split(",").map(o=>o.replace("*","").trim()).filter(o=>o.length>0)}encodeValue(e,r){return t.validateLength(e,1e6,"Variable value"),r==="+"||r==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,r){if(e.operator==="?"||e.operator==="&"){let i=e.names.map(c=>{let u=r[c];if(u===void 0)return"";let l=Array.isArray(u)?u.map(p=>this.encodeValue(p,e.operator)).join(","):this.encodeValue(u.toString(),e.operator);return`${c}=${l}`}).filter(c=>c.length>0);return i.length===0?"":(e.operator==="?"?"?":"&")+i.join("&")}if(e.names.length>1){let i=e.names.map(a=>r[a]).filter(a=>a!==void 0);return i.length===0?"":i.map(a=>Array.isArray(a)?a[0]:a).join(",")}let o=r[e.name];if(o===void 0)return"";let s=(Array.isArray(o)?o:[o]).map(i=>this.encodeValue(i,e.operator));switch(e.operator){case"":return s.join(",");case"+":return s.join(",");case"#":return"#"+s.join(",");case".":return"."+s.join(".");case"/":return"/"+s.join("/");default:return s.join(",")}}expand(e){let r="",o=!1;for(let n of this.parts){if(typeof n=="string"){r+=n;continue}let s=this.expandPart(n,e);s&&((n.operator==="?"||n.operator==="&")&&o?r+=s.replace("?","&"):r+=s,(n.operator==="?"||n.operator==="&")&&(o=!0))}return r}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){let r=[];for(let s of e.names)t.validateLength(s,1e6,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let s=0;s0?"identity-response-secret".repeat(Wa):void 0,UT=tc===void 0?process.env.TEST_IDENTITY_RESPONSE??JSON.stringify({login:kn}):JSON.stringify({login:tc}),FT=process.env.TEST_IDENTITY_SCHEMA==="min-properties"?{type:"object",properties:{account:{type:"string"}},minProperties:1}:process.env.TEST_IDENTITY_SCHEMA==="all-of-required"?{type:"object",properties:{account:{type:"string"}},allOf:[{required:["account"]}]}:process.env.TEST_IDENTITY_SCHEMA==="additional-properties-false"?{type:"object",properties:{},additionalProperties:!1}:{type:"object",properties:{}},rc=process.env.TEST_INCLUDE_SAFE_READ_TOOL==="true"?"get_capabilities":void 0,rh=process.env.TEST_SAFE_READ_CALL_PATH,VT=process.env.TEST_SAFE_READ_RESPONSE??"safe-read",oh=lh(process.env.TEST_SAFE_READ_ANNOTATIONS,"TEST_SAFE_READ_ANNOTATIONS"),HT=process.env.TEST_SAFE_READ_SCHEMA==="required"?{type:"object",properties:{account:{type:"string"}},required:["account"]}:process.env.TEST_SAFE_READ_SCHEMA==="all-of-required"?{type:"object",properties:{},allOf:[{required:["account"]}]}:{type:"object",properties:{}},Ya=0,nh=process.env.TEST_ISOLATION_REPORT_PATH;if(nh){let t=process.env.OAUTH_CREDENTIAL_PATH;if(!t)throw new Error("test isolation fixture requires OAUTH_CREDENTIAL_PATH");let e=wT(t,"utf8");de(nh,JSON.stringify({home:process.env.HOME,xdgConfigHome:process.env.XDG_CONFIG_HOME,xdgCacheHome:process.env.XDG_CACHE_HOME,xdgDataHome:process.env.XDG_DATA_HOME,xdgStateHome:process.env.XDG_STATE_HOME,xdgRuntimeDir:process.env.XDG_RUNTIME_DIR,credentialPath:t,credential:e})),process.env.TEST_ISOLATION_EMIT_CREDENTIAL==="true"&&process.stderr.write(`test isolated credential: ${e} + })));`),d.write(`newResult[${mt(b)}] = ${$}.value`)}d.write("payload.value = newResult;"),d.write("return payload;");let v=d.compile();return(b,$)=>v(p,b,$)},n,s=Pt,i=!oo.jitless,c=i&&Hn.value,l=e.catchall,u;t._zod.parse=(p,d)=>{u??(u=r.value);let m=p.value;if(!s(m))return p.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),p;let _=[];if(i&&c&&d?.async===!1&&d.jitless!==!0)n||(n=o(e.shape)),p=n(p,d);else{p.value={};let $=u.shape;for(let z of u.keys){let k=$[z],ge=k._zod.run({value:m[z],issues:[]},d),Ee=k._zod.optin==="optional"&&k._zod.optout==="optional";ge instanceof Promise?_.push(ge.then(kt=>Ee?au(kt,p,z,m):lo(kt,p,z))):Ee?au(ge,p,z,m):lo(ge,p,z)}}if(!l)return _.length?Promise.all(_).then(()=>p):p;let g=[],y=u.keySet,v=l._zod,b=v.def.type;for(let $ of Object.keys(m)){if(y.has($))continue;if(b==="never"){g.push($);continue}let z=v.run({value:m[$],issues:[]},d);z instanceof Promise?_.push(z.then(k=>lo(k,p,$))):lo(z,p,$)}return g.length&&p.issues.push({code:"unrecognized_keys",keys:g,input:m,inst:t}),_.length?Promise.all(_).then(()=>p):p}});function cu(t,e,r,o){for(let n of t)if(n.issues.length===0)return e.value=n.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(n=>n.issues.map(s=>Ce(s,o,ke())))}),e}var is=h("$ZodUnion",(t,e)=>{K.init(t,e),H(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),H(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),H(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),H(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>nr(o.source)).join("|")})$`)}}),t._zod.parse=(r,o)=>{let n=!1,s=[];for(let i of e.options){let a=i._zod.run({value:r.value,issues:[]},o);if(a instanceof Promise)s.push(a),n=!0;else{if(a.issues.length===0)return a;s.push(a)}}return n?Promise.all(s).then(i=>cu(i,r,t,o)):cu(s,r,t,o)}}),Ku=h("$ZodDiscriminatedUnion",(t,e)=>{is.init(t,e);let r=t._zod.parse;H(t._zod,"propValues",()=>{let n={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let l of c)n[a].add(l)}}return n});let o=rr(()=>{let n=e.options,s=new Map;for(let i of n){let a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(n,s)=>{let i=n.value;if(!Pt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),n;let a=o.value.get(i?.[e.discriminator]);return a?a._zod.run(n,s):e.unionFallback?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),n)}}),Gu=h("$ZodIntersection",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value,s=e.left._zod.run({value:n,issues:[]},o),i=e.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,l])=>uu(r,c,l)):uu(r,s,i)}});function ns(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Rt(t)&&Rt(e)){let r=Object.keys(e),o=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(let s of o){let i=ns(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!Rt(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;let s=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let l=e.valueType._zod.run({value:n[c],issues:[]},o);l instanceof Promise?s.push(l.then(u=>{u.issues.length&&r.issues.push(...Fe(c,u.issues)),r.value[c]=u.value})):(l.issues.length&&r.issues.push(...Fe(c,l.issues)),r.value[c]=l.value)}let a;for(let c in n)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(n)){if(i==="__proto__")continue;let a=e.keyType._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(l=>Ce(l,o,ke())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}let c=e.valueType._zod.run({value:n[i],issues:[]},o);c instanceof Promise?s.push(c.then(l=>{l.issues.length&&r.issues.push(...Fe(i,l.issues)),r.value[a.value]=l.value})):(c.issues.length&&r.issues.push(...Fe(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}});var Ju=h("$ZodEnum",(t,e)=>{K.init(t,e);let r=Ln(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(o=>Kn.has(typeof o)).map(o=>typeof o=="string"?rt(o):o.toString()).join("|")})$`),t._zod.parse=(o,n)=>{let s=o.value;return t._zod.values.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:t}),o}}),Wu=h("$ZodLiteral",(t,e)=>{K.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?rt(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,o)=>{let n=r.value;return t._zod.values.has(n)||r.issues.push({code:"invalid_value",values:e.values,input:n,inst:t}),r}});var Yu=h("$ZodTransform",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=e.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r));if(n instanceof Promise)throw new We;return r.value=n,r}}),Xu=h("$ZodOptional",(t,e)=>{K.init(t,e),t._zod.optin="optional",t._zod.optout="optional",H(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),H(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${nr(r.source)})?$`):void 0}),t._zod.parse=(r,o)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,o):r.value===void 0?r:e.innerType._zod.run(r,o)}),Qu=h("$ZodNullable",(t,e)=>{K.init(t,e),H(t._zod,"optin",()=>e.innerType._zod.optin),H(t._zod,"optout",()=>e.innerType._zod.optout),H(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${nr(r.source)}|null)$`):void 0}),H(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,o)=>r.value===null?r:e.innerType._zod.run(r,o)}),el=h("$ZodDefault",(t,e)=>{K.init(t,e),t._zod.optin="optional",H(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>lu(s,e)):lu(n,e)}});function lu(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var tl=h("$ZodPrefault",(t,e)=>{K.init(t,e),t._zod.optin="optional",H(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,o))}),rl=h("$ZodNonOptional",(t,e)=>{K.init(t,e),H(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),t._zod.parse=(r,o)=>{let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>pu(s,t)):pu(n,t)}});function pu(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var ol=h("$ZodCatch",(t,e)=>{K.init(t,e),t._zod.optin="optional",H(t._zod,"optout",()=>e.innerType._zod.optout),H(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>Ce(i,o,ke()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>Ce(s,o,ke()))},input:r.value}),r.issues=[]),r)}});var nl=h("$ZodPipe",(t,e)=>{K.init(t,e),H(t._zod,"values",()=>e.in._zod.values),H(t._zod,"optin",()=>e.in._zod.optin),H(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,o)=>{let n=e.in._zod.run(r,o);return n instanceof Promise?n.then(s=>du(s,e,o)):du(n,e,o)}});function du(t,e,r){return ht(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}var sl=h("$ZodReadonly",(t,e)=>{K.init(t,e),H(t._zod,"propValues",()=>e.innerType._zod.propValues),H(t._zod,"values",()=>e.innerType._zod.values),H(t._zod,"optin",()=>e.innerType._zod.optin),H(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,o)=>{let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(fu):fu(n)}});function fu(t){return t.value=Object.freeze(t.value),t}var il=h("$ZodCustom",(t,e)=>{fe.init(t,e),K.init(t,e),t._zod.parse=(r,o)=>r,t._zod.check=r=>{let o=r.value,n=e.fn(o);if(n instanceof Promise)return n.then(s=>mu(s,r,o,t));mu(n,r,o,t)}});function mu(t,e,r,o){if(!t){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),e.issues.push(Jn(n))}}var qh=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},Lh=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(o){return t[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${qh(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${io(o.values[0])}`:`Invalid option: expected one of ${no(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",s=e(o.origin);return s?`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",s=e(o.origin);return s?`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${s.unit}`:`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${r[n.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${no(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function al(){return{localeError:Lh()}}var as=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){let o=r[0];if(this._map.set(e,o),o&&typeof o=="object"&&"id"in o){if(this._idmap.has(o.id))throw new Error(`ID ${o.id} already exists in the registry`);this._idmap.set(o.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let o={...this.get(r)??{}};return delete o.id,{...o,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Uh(){return new as}var cr=Uh();function cl(t,e){return new t({type:"string",...E(e)})}function ul(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...E(e)})}function cs(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...E(e)})}function ll(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...E(e)})}function pl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(e)})}function dl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(e)})}function fl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(e)})}function ml(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...E(e)})}function hl(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...E(e)})}function _l(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(e)})}function gl(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...E(e)})}function yl(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(e)})}function vl(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...E(e)})}function $l(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...E(e)})}function Sl(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(e)})}function bl(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(e)})}function Tl(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(e)})}function wl(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(e)})}function xl(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(e)})}function zl(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...E(e)})}function El(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...E(e)})}function kl(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...E(e)})}function Pl(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...E(e)})}function Rl(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(e)})}function Il(t,e){return new t({type:"string",format:"date",check:"string_format",...E(e)})}function Ol(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...E(e)})}function Nl(t,e){return new t({type:"string",format:"duration",check:"string_format",...E(e)})}function Al(t,e){return new t({type:"number",checks:[],...E(e)})}function Cl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...E(e)})}function jl(t,e){return new t({type:"boolean",...E(e)})}function Zl(t,e){return new t({type:"null",...E(e)})}function Dl(t){return new t({type:"unknown"})}function Ml(t,e){return new t({type:"never",...E(e)})}function fo(t,e){return new rs({check:"less_than",...E(e),value:t,inclusive:!1})}function ur(t,e){return new rs({check:"less_than",...E(e),value:t,inclusive:!0})}function mo(t,e){return new os({check:"greater_than",...E(e),value:t,inclusive:!1})}function lr(t,e){return new os({check:"greater_than",...E(e),value:t,inclusive:!0})}function ho(t,e){return new Kc({check:"multiple_of",...E(e),value:t})}function _o(t,e){return new Bc({check:"max_length",...E(e),maximum:t})}function It(t,e){return new Jc({check:"min_length",...E(e),minimum:t})}function go(t,e){return new Wc({check:"length_equals",...E(e),length:t})}function us(t,e){return new Yc({check:"string_format",format:"regex",...E(e),pattern:t})}function ls(t){return new Xc({check:"string_format",format:"lowercase",...E(t)})}function ps(t){return new Qc({check:"string_format",format:"uppercase",...E(t)})}function ds(t,e){return new eu({check:"string_format",format:"includes",...E(e),includes:t})}function fs(t,e){return new tu({check:"string_format",format:"starts_with",...E(e),prefix:t})}function ms(t,e){return new ru({check:"string_format",format:"ends_with",...E(e),suffix:t})}function _t(t){return new ou({check:"overwrite",tx:t})}function hs(t){return _t(e=>e.normalize(t))}function _s(){return _t(t=>t.trim())}function gs(){return _t(t=>t.toLowerCase())}function ys(){return _t(t=>t.toUpperCase())}function ql(t,e,r){return new t({type:"array",element:e,...E(r)})}function Ll(t,e,r){let o=E(r);return o.abort??(o.abort=!0),new t({type:"custom",check:"custom",fn:e,...o})}function Ul(t,e,r){return new t({type:"custom",check:"custom",fn:e,...E(r)})}function yo(t){return!!t._zod}function ot(t,e){return yo(t)?ir(t,e):t.safeParse(e)}function vo(t){if(!t)return;let e;if(yo(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function $o(t){if(yo(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=t.value;if(o!==void 0)return o}var dr={};ic(dr,{ZodISODate:()=>Vl,ZodISODateTime:()=>Fl,ZodISODuration:()=>Kl,ZodISOTime:()=>Hl,date:()=>$s,datetime:()=>vs,duration:()=>bs,time:()=>Ss});var Fl=h("ZodISODateTime",(t,e)=>{zu.init(t,e),X.init(t,e)});function vs(t){return Rl(Fl,t)}var Vl=h("ZodISODate",(t,e)=>{Eu.init(t,e),X.init(t,e)});function $s(t){return Il(Vl,t)}var Hl=h("ZodISOTime",(t,e)=>{ku.init(t,e),X.init(t,e)});function Ss(t){return Ol(Hl,t)}var Kl=h("ZodISODuration",(t,e)=>{Pu.init(t,e),X.init(t,e)});function bs(t){return Nl(Kl,t)}var Gl=(t,e)=>{ao.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>fc(t,r)},flatten:{value:r=>dc(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},Lw=h("ZodError",Gl),fr=h("ZodError",Gl,{Parent:Error});var Bl=mc(fr),Jl=hc(fr),Wl=Yn(fr),Yl=Xn(fr);var te=h("ZodType",(t,e)=>(K.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),t.clone=(r,o)=>Ue(t,r,o),t.brand=()=>t,t.register=((r,o)=>(r.add(t,o),t)),t.parse=(r,o)=>Bl(t,r,o,{callee:t.parse}),t.safeParse=(r,o)=>Wl(t,r,o),t.parseAsync=async(r,o)=>Jl(t,r,o,{callee:t.parseAsync}),t.safeParseAsync=async(r,o)=>Yl(t,r,o),t.spa=t.safeParseAsync,t.refine=(r,o)=>t.check(M_(r,o)),t.superRefine=r=>t.check(q_(r)),t.overwrite=r=>t.check(_t(r)),t.optional=()=>ee(t),t.nullable=()=>ep(t),t.nullish=()=>ee(ep(t)),t.nonoptional=r=>O_(t,r),t.array=()=>j(t),t.or=r=>J([t,r]),t.and=r=>bo(t,r),t.transform=r=>ws(t,ip(r)),t.default=r=>P_(t,r),t.prefault=r=>I_(t,r),t.catch=r=>A_(t,r),t.pipe=r=>ws(t,r),t.readonly=()=>Z_(t),t.describe=r=>{let o=t.clone();return cr.add(o,{description:r}),o},Object.defineProperty(t,"description",{get(){return cr.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return cr.get(t);let o=t.clone();return cr.add(o,r[0]),o},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),tp=h("_ZodString",(t,e)=>{po.init(t,e),te.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...o)=>t.check(us(...o)),t.includes=(...o)=>t.check(ds(...o)),t.startsWith=(...o)=>t.check(fs(...o)),t.endsWith=(...o)=>t.check(ms(...o)),t.min=(...o)=>t.check(It(...o)),t.max=(...o)=>t.check(_o(...o)),t.length=(...o)=>t.check(go(...o)),t.nonempty=(...o)=>t.check(It(1,...o)),t.lowercase=o=>t.check(ls(o)),t.uppercase=o=>t.check(ps(o)),t.trim=()=>t.check(_s()),t.normalize=(...o)=>t.check(hs(...o)),t.toLowerCase=()=>t.check(gs()),t.toUpperCase=()=>t.check(ys())}),Yh=h("ZodString",(t,e)=>{po.init(t,e),tp.init(t,e),t.email=r=>t.check(ul(Xh,r)),t.url=r=>t.check(ml(Qh,r)),t.jwt=r=>t.check(Pl(m_,r)),t.emoji=r=>t.check(hl(e_,r)),t.guid=r=>t.check(cs(Xl,r)),t.uuid=r=>t.check(ll(So,r)),t.uuidv4=r=>t.check(pl(So,r)),t.uuidv6=r=>t.check(dl(So,r)),t.uuidv7=r=>t.check(fl(So,r)),t.nanoid=r=>t.check(_l(t_,r)),t.guid=r=>t.check(cs(Xl,r)),t.cuid=r=>t.check(gl(r_,r)),t.cuid2=r=>t.check(yl(o_,r)),t.ulid=r=>t.check(vl(n_,r)),t.base64=r=>t.check(zl(p_,r)),t.base64url=r=>t.check(El(d_,r)),t.xid=r=>t.check($l(s_,r)),t.ksuid=r=>t.check(Sl(i_,r)),t.ipv4=r=>t.check(bl(a_,r)),t.ipv6=r=>t.check(Tl(c_,r)),t.cidrv4=r=>t.check(wl(u_,r)),t.cidrv6=r=>t.check(xl(l_,r)),t.e164=r=>t.check(kl(f_,r)),t.datetime=r=>t.check(vs(r)),t.date=r=>t.check($s(r)),t.time=r=>t.check(Ss(r)),t.duration=r=>t.check(bs(r))});function f(t){return cl(Yh,t)}var X=h("ZodStringFormat",(t,e)=>{B.init(t,e),tp.init(t,e)}),Xh=h("ZodEmail",(t,e)=>{gu.init(t,e),X.init(t,e)});var Xl=h("ZodGUID",(t,e)=>{hu.init(t,e),X.init(t,e)});var So=h("ZodUUID",(t,e)=>{_u.init(t,e),X.init(t,e)});var Qh=h("ZodURL",(t,e)=>{yu.init(t,e),X.init(t,e)});var e_=h("ZodEmoji",(t,e)=>{vu.init(t,e),X.init(t,e)});var t_=h("ZodNanoID",(t,e)=>{$u.init(t,e),X.init(t,e)});var r_=h("ZodCUID",(t,e)=>{Su.init(t,e),X.init(t,e)});var o_=h("ZodCUID2",(t,e)=>{bu.init(t,e),X.init(t,e)});var n_=h("ZodULID",(t,e)=>{Tu.init(t,e),X.init(t,e)});var s_=h("ZodXID",(t,e)=>{wu.init(t,e),X.init(t,e)});var i_=h("ZodKSUID",(t,e)=>{xu.init(t,e),X.init(t,e)});var a_=h("ZodIPv4",(t,e)=>{Ru.init(t,e),X.init(t,e)});var c_=h("ZodIPv6",(t,e)=>{Iu.init(t,e),X.init(t,e)});var u_=h("ZodCIDRv4",(t,e)=>{Ou.init(t,e),X.init(t,e)});var l_=h("ZodCIDRv6",(t,e)=>{Nu.init(t,e),X.init(t,e)});var p_=h("ZodBase64",(t,e)=>{Cu.init(t,e),X.init(t,e)});var d_=h("ZodBase64URL",(t,e)=>{ju.init(t,e),X.init(t,e)});var f_=h("ZodE164",(t,e)=>{Zu.init(t,e),X.init(t,e)});var m_=h("ZodJWT",(t,e)=>{Du.init(t,e),X.init(t,e)});var rp=h("ZodNumber",(t,e)=>{ss.init(t,e),te.init(t,e),t.gt=(o,n)=>t.check(mo(o,n)),t.gte=(o,n)=>t.check(lr(o,n)),t.min=(o,n)=>t.check(lr(o,n)),t.lt=(o,n)=>t.check(fo(o,n)),t.lte=(o,n)=>t.check(ur(o,n)),t.max=(o,n)=>t.check(ur(o,n)),t.int=o=>t.check(Ql(o)),t.safe=o=>t.check(Ql(o)),t.positive=o=>t.check(mo(0,o)),t.nonnegative=o=>t.check(lr(0,o)),t.negative=o=>t.check(fo(0,o)),t.nonpositive=o=>t.check(ur(0,o)),t.multipleOf=(o,n)=>t.check(ho(o,n)),t.step=(o,n)=>t.check(ho(o,n)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function U(t){return Al(rp,t)}var h_=h("ZodNumberFormat",(t,e)=>{Mu.init(t,e),rp.init(t,e)});function Ql(t){return Cl(h_,t)}var __=h("ZodBoolean",(t,e)=>{qu.init(t,e),te.init(t,e)});function ie(t){return jl(__,t)}var g_=h("ZodNull",(t,e)=>{Lu.init(t,e),te.init(t,e)});function op(t){return Zl(g_,t)}var y_=h("ZodUnknown",(t,e)=>{Uu.init(t,e),te.init(t,e)});function Q(){return Dl(y_)}var v_=h("ZodNever",(t,e)=>{Fu.init(t,e),te.init(t,e)});function $_(t){return Ml(v_,t)}var S_=h("ZodArray",(t,e)=>{Vu.init(t,e),te.init(t,e),t.element=e.element,t.min=(r,o)=>t.check(It(r,o)),t.nonempty=r=>t.check(It(1,r)),t.max=(r,o)=>t.check(_o(r,o)),t.length=(r,o)=>t.check(go(r,o)),t.unwrap=()=>t.element});function j(t,e){return ql(S_,t,e)}var np=h("ZodObject",(t,e)=>{Hu.init(t,e),te.init(t,e),L.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Se(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:Q()}),t.loose=()=>t.clone({...t._zod.def,catchall:Q()}),t.strict=()=>t.clone({...t._zod.def,catchall:$_()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>L.extend(t,r),t.merge=r=>L.merge(t,r),t.pick=r=>L.pick(t,r),t.omit=r=>L.omit(t,r),t.partial=(...r)=>L.partial(ap,t,r[0]),t.required=(...r)=>L.required(cp,t,r[0])});function T(t,e){let r={type:"object",get shape(){return L.assignProp(this,"shape",{...t}),this.shape},...L.normalizeParams(e)};return new np(r)}function ye(t,e){return new np({type:"object",get shape(){return L.assignProp(this,"shape",{...t}),this.shape},catchall:Q(),...L.normalizeParams(e)})}var sp=h("ZodUnion",(t,e)=>{is.init(t,e),te.init(t,e),t.options=e.options});function J(t,e){return new sp({type:"union",options:t,...L.normalizeParams(e)})}var b_=h("ZodDiscriminatedUnion",(t,e)=>{sp.init(t,e),Ku.init(t,e)});function xs(t,e,r){return new b_({type:"union",options:e,discriminator:t,...L.normalizeParams(r)})}var T_=h("ZodIntersection",(t,e)=>{Gu.init(t,e),te.init(t,e)});function bo(t,e){return new T_({type:"intersection",left:t,right:e})}var w_=h("ZodRecord",(t,e)=>{Bu.init(t,e),te.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function G(t,e,r){return new w_({type:"record",keyType:t,valueType:e,...L.normalizeParams(r)})}var Ts=h("ZodEnum",(t,e)=>{Ju.init(t,e),te.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ts({...e,checks:[],...L.normalizeParams(n),entries:s})},t.exclude=(o,n)=>{let s={...e.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ts({...e,checks:[],...L.normalizeParams(n),entries:s})}});function Se(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new Ts({type:"enum",entries:r,...L.normalizeParams(e)})}var x_=h("ZodLiteral",(t,e)=>{Wu.init(t,e),te.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function w(t,e){return new x_({type:"literal",values:Array.isArray(t)?t:[t],...L.normalizeParams(e)})}var z_=h("ZodTransform",(t,e)=>{Yu.init(t,e),te.init(t,e),t._zod.parse=(r,o)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(L.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(L.issue(i))}};let n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function ip(t){return new z_({type:"transform",transform:t})}var ap=h("ZodOptional",(t,e)=>{Xu.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ee(t){return new ap({type:"optional",innerType:t})}var E_=h("ZodNullable",(t,e)=>{Qu.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ep(t){return new E_({type:"nullable",innerType:t})}var k_=h("ZodDefault",(t,e)=>{el.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function P_(t,e){return new k_({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var R_=h("ZodPrefault",(t,e)=>{tl.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function I_(t,e){return new R_({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var cp=h("ZodNonOptional",(t,e)=>{rl.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType});function O_(t,e){return new cp({type:"nonoptional",innerType:t,...L.normalizeParams(e)})}var N_=h("ZodCatch",(t,e)=>{ol.init(t,e),te.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function A_(t,e){return new N_({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var C_=h("ZodPipe",(t,e)=>{nl.init(t,e),te.init(t,e),t.in=e.in,t.out=e.out});function ws(t,e){return new C_({type:"pipe",in:t,out:e})}var j_=h("ZodReadonly",(t,e)=>{sl.init(t,e),te.init(t,e)});function Z_(t){return new j_({type:"readonly",innerType:t})}var up=h("ZodCustom",(t,e)=>{il.init(t,e),te.init(t,e)});function D_(t){let e=new fe({check:"custom"});return e._zod.check=t,e}function lp(t,e){return Ll(up,t??(()=>!0),e)}function M_(t,e={}){return Ul(up,t,e)}function q_(t){let e=D_(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(L.issue(o,r.value,e._zod.def));else{let n=o;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=e),n.continue??(n.continue=!e._zod.def.abort),r.issues.push(L.issue(n))}},t(r.value,r)));return e}function zs(t,e){return ws(ip(t),e)}ke(al());var ks="2025-11-25";var pp=[ks,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],nt="io.modelcontextprotocol/related-task",wo="2.0",ne=lp(t=>t!==null&&(typeof t=="object"||typeof t=="function")),dp=J([f(),U().int()]),fp=f(),Ax=ye({ttl:U().optional(),pollInterval:U().optional()}),L_=T({ttl:U().optional()}),U_=T({taskId:f()}),Ps=ye({progressToken:dp.optional(),[nt]:U_.optional()}),ze=T({_meta:Ps.optional()}),mr=ze.extend({task:L_.optional()}),mp=t=>mr.safeParse(t).success,ae=T({method:f(),params:ze.loose().optional()}),Pe=T({_meta:Ps.optional()}),Re=T({method:f(),params:Pe.loose().optional()}),ce=ye({_meta:Ps.optional()}),xo=J([f(),U().int()]),hp=T({jsonrpc:w(wo),id:xo,...ae.shape}).strict(),Rs=t=>hp.safeParse(t).success,_p=T({jsonrpc:w(wo),...Re.shape}).strict(),gp=t=>_p.safeParse(t).success,Is=T({jsonrpc:w(wo),id:xo,result:ce}).strict(),hr=t=>Is.safeParse(t).success;var C;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(C||(C={}));var Os=T({jsonrpc:w(wo),id:xo.optional(),error:T({code:U().int(),message:f(),data:Q().optional()})}).strict();var yp=t=>Os.safeParse(t).success;var vp=J([hp,_p,Is,Os]),Cx=J([Is,Os]),zo=ce.strict(),F_=Pe.extend({requestId:xo.optional(),reason:f().optional()}),Nt=Re.extend({method:w("notifications/cancelled"),params:F_}),V_=T({src:f(),mimeType:f().optional(),sizes:j(f()).optional(),theme:Se(["light","dark"]).optional()}),_r=T({icons:j(V_).optional()}),Ot=T({name:f(),title:f().optional()}),$p=Ot.extend({...Ot.shape,..._r.shape,version:f(),websiteUrl:f().optional(),description:f().optional()}),H_=bo(T({applyDefaults:ie().optional()}),G(f(),Q())),K_=zs(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,bo(T({form:H_.optional(),url:ne.optional()}),G(f(),Q()).optional())),G_=ye({list:ne.optional(),cancel:ne.optional(),requests:ye({sampling:ye({createMessage:ne.optional()}).optional(),elicitation:ye({create:ne.optional()}).optional()}).optional()}),B_=ye({list:ne.optional(),cancel:ne.optional(),requests:ye({tools:ye({call:ne.optional()}).optional()}).optional()}),J_=T({experimental:G(f(),ne).optional(),sampling:T({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:K_.optional(),roots:T({listChanged:ie().optional()}).optional(),tasks:G_.optional(),extensions:G(f(),ne).optional()}),W_=ze.extend({protocolVersion:f(),capabilities:J_,clientInfo:$p}),gr=ae.extend({method:w("initialize"),params:W_});var Y_=T({experimental:G(f(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:T({listChanged:ie().optional()}).optional(),resources:T({subscribe:ie().optional(),listChanged:ie().optional()}).optional(),tools:T({listChanged:ie().optional()}).optional(),tasks:B_.optional(),extensions:G(f(),ne).optional()}),X_=ce.extend({protocolVersion:f(),capabilities:Y_,serverInfo:$p,instructions:f().optional()}),Ns=Re.extend({method:w("notifications/initialized"),params:Pe.optional()});var Eo=ae.extend({method:w("ping"),params:ze.optional()}),Q_=T({progress:U(),total:ee(U()),message:ee(f())}),eg=T({...Pe.shape,...Q_.shape,progressToken:dp}),ko=Re.extend({method:w("notifications/progress"),params:eg}),tg=ze.extend({cursor:fp.optional()}),yr=ae.extend({params:tg.optional()}),vr=ce.extend({nextCursor:fp.optional()}),rg=Se(["working","input_required","completed","failed","cancelled"]),$r=T({taskId:f(),status:rg,ttl:J([U(),op()]),createdAt:f(),lastUpdatedAt:f(),pollInterval:ee(U()),statusMessage:ee(f())}),At=ce.extend({task:$r}),og=Pe.merge($r),Sr=Re.extend({method:w("notifications/tasks/status"),params:og}),Po=ae.extend({method:w("tasks/get"),params:ze.extend({taskId:f()})}),Ro=ce.merge($r),Io=ae.extend({method:w("tasks/result"),params:ze.extend({taskId:f()})}),jx=ce.loose(),Oo=yr.extend({method:w("tasks/list")}),No=vr.extend({tasks:j($r)}),Ao=ae.extend({method:w("tasks/cancel"),params:ze.extend({taskId:f()})}),Sp=ce.merge($r),bp=T({uri:f(),mimeType:ee(f()),_meta:G(f(),Q()).optional()}),Tp=bp.extend({text:f()}),As=f().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),wp=bp.extend({blob:As}),br=Se(["user","assistant"]),Ct=T({audience:j(br).optional(),priority:U().min(0).max(1).optional(),lastModified:dr.datetime({offset:!0}).optional()}),xp=T({...Ot.shape,..._r.shape,uri:f(),description:ee(f()),mimeType:ee(f()),size:ee(U()),annotations:Ct.optional(),_meta:ee(ye({}))}),ng=T({...Ot.shape,..._r.shape,uriTemplate:f(),description:ee(f()),mimeType:ee(f()),annotations:Ct.optional(),_meta:ee(ye({}))}),Cs=yr.extend({method:w("resources/list")}),sg=vr.extend({resources:j(xp)}),js=yr.extend({method:w("resources/templates/list")}),ig=vr.extend({resourceTemplates:j(ng)}),Zs=ze.extend({uri:f()}),ag=Zs,Ds=ae.extend({method:w("resources/read"),params:ag}),cg=ce.extend({contents:j(J([Tp,wp]))}),ug=Re.extend({method:w("notifications/resources/list_changed"),params:Pe.optional()}),lg=Zs,Ms=ae.extend({method:w("resources/subscribe"),params:lg}),pg=Zs,qs=ae.extend({method:w("resources/unsubscribe"),params:pg}),dg=Pe.extend({uri:f()}),fg=Re.extend({method:w("notifications/resources/updated"),params:dg}),mg=T({name:f(),description:ee(f()),required:ee(ie())}),hg=T({...Ot.shape,..._r.shape,description:ee(f()),arguments:ee(j(mg)),_meta:ee(ye({}))}),Ls=yr.extend({method:w("prompts/list")}),_g=vr.extend({prompts:j(hg)}),gg=ze.extend({name:f(),arguments:G(f(),f()).optional()}),Us=ae.extend({method:w("prompts/get"),params:gg}),Fs=T({type:w("text"),text:f(),annotations:Ct.optional(),_meta:G(f(),Q()).optional()}),Vs=T({type:w("image"),data:As,mimeType:f(),annotations:Ct.optional(),_meta:G(f(),Q()).optional()}),Hs=T({type:w("audio"),data:As,mimeType:f(),annotations:Ct.optional(),_meta:G(f(),Q()).optional()}),yg=T({type:w("tool_use"),name:f(),id:f(),input:G(f(),Q()),_meta:G(f(),Q()).optional()}),vg=T({type:w("resource"),resource:J([Tp,wp]),annotations:Ct.optional(),_meta:G(f(),Q()).optional()}),$g=xp.extend({type:w("resource_link")}),Ks=J([Fs,Vs,Hs,$g,vg]),Sg=T({role:br,content:Ks}),bg=ce.extend({description:f().optional(),messages:j(Sg)}),Tg=Re.extend({method:w("notifications/prompts/list_changed"),params:Pe.optional()}),wg=T({title:f().optional(),readOnlyHint:ie().optional(),destructiveHint:ie().optional(),idempotentHint:ie().optional(),openWorldHint:ie().optional()}),xg=T({taskSupport:Se(["required","optional","forbidden"]).optional()}),zp=T({...Ot.shape,..._r.shape,description:f().optional(),inputSchema:T({type:w("object"),properties:G(f(),ne).optional(),required:j(f()).optional()}).catchall(Q()),outputSchema:T({type:w("object"),properties:G(f(),ne).optional(),required:j(f()).optional()}).catchall(Q()).optional(),annotations:wg.optional(),execution:xg.optional(),_meta:G(f(),Q()).optional()}),Gs=yr.extend({method:w("tools/list")}),zg=vr.extend({tools:j(zp)}),Co=ce.extend({content:j(Ks).default([]),structuredContent:G(f(),Q()).optional(),isError:ie().optional()}),Zx=Co.or(ce.extend({toolResult:Q()})),Eg=mr.extend({name:f(),arguments:G(f(),Q()).optional()}),Tr=ae.extend({method:w("tools/call"),params:Eg}),kg=Re.extend({method:w("notifications/tools/list_changed"),params:Pe.optional()}),Dx=T({autoRefresh:ie().default(!0),debounceMs:U().int().nonnegative().default(300)}),wr=Se(["debug","info","notice","warning","error","critical","alert","emergency"]),Pg=ze.extend({level:wr}),Bs=ae.extend({method:w("logging/setLevel"),params:Pg}),Rg=Pe.extend({level:wr,logger:f().optional(),data:Q()}),Ig=Re.extend({method:w("notifications/message"),params:Rg}),Og=T({name:f().optional()}),Ng=T({hints:j(Og).optional(),costPriority:U().min(0).max(1).optional(),speedPriority:U().min(0).max(1).optional(),intelligencePriority:U().min(0).max(1).optional()}),Ag=T({mode:Se(["auto","required","none"]).optional()}),Cg=T({type:w("tool_result"),toolUseId:f().describe("The unique identifier for the corresponding tool call."),content:j(Ks).default([]),structuredContent:T({}).loose().optional(),isError:ie().optional(),_meta:G(f(),Q()).optional()}),jg=xs("type",[Fs,Vs,Hs]),To=xs("type",[Fs,Vs,Hs,yg,Cg]),Zg=T({role:br,content:J([To,j(To)]),_meta:G(f(),Q()).optional()}),Dg=mr.extend({messages:j(Zg),modelPreferences:Ng.optional(),systemPrompt:f().optional(),includeContext:Se(["none","thisServer","allServers"]).optional(),temperature:U().optional(),maxTokens:U().int(),stopSequences:j(f()).optional(),metadata:ne.optional(),tools:j(zp).optional(),toolChoice:Ag.optional()}),Mg=ae.extend({method:w("sampling/createMessage"),params:Dg}),xr=ce.extend({model:f(),stopReason:ee(Se(["endTurn","stopSequence","maxTokens"]).or(f())),role:br,content:jg}),Js=ce.extend({model:f(),stopReason:ee(Se(["endTurn","stopSequence","maxTokens","toolUse"]).or(f())),role:br,content:J([To,j(To)])}),qg=T({type:w("boolean"),title:f().optional(),description:f().optional(),default:ie().optional()}),Lg=T({type:w("string"),title:f().optional(),description:f().optional(),minLength:U().optional(),maxLength:U().optional(),format:Se(["email","uri","date","date-time"]).optional(),default:f().optional()}),Ug=T({type:Se(["number","integer"]),title:f().optional(),description:f().optional(),minimum:U().optional(),maximum:U().optional(),default:U().optional()}),Fg=T({type:w("string"),title:f().optional(),description:f().optional(),enum:j(f()),default:f().optional()}),Vg=T({type:w("string"),title:f().optional(),description:f().optional(),oneOf:j(T({const:f(),title:f()})),default:f().optional()}),Hg=T({type:w("string"),title:f().optional(),description:f().optional(),enum:j(f()),enumNames:j(f()).optional(),default:f().optional()}),Kg=J([Fg,Vg]),Gg=T({type:w("array"),title:f().optional(),description:f().optional(),minItems:U().optional(),maxItems:U().optional(),items:T({type:w("string"),enum:j(f())}),default:j(f()).optional()}),Bg=T({type:w("array"),title:f().optional(),description:f().optional(),minItems:U().optional(),maxItems:U().optional(),items:T({anyOf:j(T({const:f(),title:f()}))}),default:j(f()).optional()}),Jg=J([Gg,Bg]),Wg=J([Hg,Kg,Jg]),Yg=J([Wg,qg,Lg,Ug]),Xg=mr.extend({mode:w("form").optional(),message:f(),requestedSchema:T({type:w("object"),properties:G(f(),Yg),required:j(f()).optional()})}),Qg=mr.extend({mode:w("url"),message:f(),elicitationId:f(),url:f().url()}),ey=J([Xg,Qg]),ty=ae.extend({method:w("elicitation/create"),params:ey}),ry=Pe.extend({elicitationId:f()}),oy=Re.extend({method:w("notifications/elicitation/complete"),params:ry}),jt=ce.extend({action:Se(["accept","decline","cancel"]),content:zs(t=>t===null?void 0:t,G(f(),J([f(),U(),ie(),j(f())])).optional())}),ny=T({type:w("ref/resource"),uri:f()});var sy=T({type:w("ref/prompt"),name:f()}),iy=ze.extend({ref:J([sy,ny]),argument:T({name:f(),value:f()}),context:T({arguments:G(f(),f()).optional()}).optional()}),ay=ae.extend({method:w("completion/complete"),params:iy});var cy=ce.extend({completion:ye({values:j(f()).max(100),total:ee(U().int()),hasMore:ee(ie())})}),uy=T({uri:f().startsWith("file://"),name:f().optional(),_meta:G(f(),Q()).optional()}),ly=ae.extend({method:w("roots/list"),params:ze.optional()}),Ws=ce.extend({roots:j(uy)}),py=Re.extend({method:w("notifications/roots/list_changed"),params:Pe.optional()}),Mx=J([Eo,gr,ay,Bs,Us,Ls,Cs,js,Ds,Ms,qs,Tr,Gs,Po,Io,Oo,Ao]),qx=J([Nt,ko,Ns,py,Sr]),Lx=J([zo,xr,Js,jt,Ws,Ro,No,At]),Ux=J([Eo,Mg,ty,ly,Po,Io,Oo,Ao]),Fx=J([Nt,ko,Ig,fg,ug,kg,Tg,Sr,oy]),Vx=J([zo,X_,cy,bg,_g,sg,ig,cg,Co,zg,Ro,No,At]),R=class t extends Error{constructor(e,r,o){super(`MCP error ${e}: ${r}`),this.code=e,this.data=o,this.name="McpError"}static fromError(e,r,o){if(e===C.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Es(n.elicitations,r)}return new t(e,r,o)}},Es=class extends R{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(C.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function st(t){return t==="completed"||t==="failed"||t==="cancelled"}var Tz=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ys(t){let r=vo(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=$o(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function Xs(t,e){let r=ot(t,e);if(!r.success)throw r.error;return r.data}var gy=6e4,jo=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Nt,r=>{this._oncancel(r)}),this.setNotificationHandler(ko,r=>{this._onprogress(r)}),this.setRequestHandler(Eo,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Po,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(C.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Io,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,l=c.id,u=this._requestResolvers.get(l);if(u)if(this._requestResolvers.delete(l),a.type==="response")u(c);else{let p=c,d=new R(p.error.code,p.error.message,p.error.data);u(d)}else{let p=a.type==="response"?"Response":"Error";this._onerror(new Error(`${p} handler missing for request ${l}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new R(C.InvalidParams,`Task not found: ${s}`);if(!st(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(st(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[nt]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(Oo,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new R(C.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Ao,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(C.InvalidParams,`Task not found: ${r.params.taskId}`);if(st(n.status))throw new R(C.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new R(C.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof R?n:new R(C.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,o,n,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),R.fromError(C.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),hr(s)||yp(s)?this._onresponse(s):Rs(s)?this._onrequest(s,i):gp(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(C.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of e.values())o(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){let o=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,s=e.params?._meta?.[nt]?.taskId;if(o===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:C.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:u,timestamp:Date.now()},n?.sessionId).catch(p=>this._onerror(new Error(`Failed to enqueue error response: ${p}`))):n?.send(u).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=mp(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,l={signal:i.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async u=>{if(i.signal.aborted)return;let p={relatedRequestId:e.id};s&&(p.relatedTask={taskId:s}),await this.notification(u,p)},sendRequest:async(u,p,d)=>{if(i.signal.aborted)throw new R(C.ConnectionClosed,"Request was cancelled");let m={...d,relatedRequestId:e.id};s&&!m.relatedTask&&(m.relatedTask={taskId:s});let _=m.relatedTask?.taskId??s;return _&&c&&await c.updateTaskStatus(_,"input_required"),await this.request(u,p,m)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>o(e,l)).then(async u=>{if(i.signal.aborted)return;let p={result:u,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:p,timestamp:Date.now()},n?.sessionId):await n?.send(p)},async u=>{if(i.signal.aborted)return;let p={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:C.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:p,timestamp:Date.now()},n?.sessionId):await n?.send(p)}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...o}=e.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(e){let r=Number(e.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),hr(e))o(e);else{let i=new R(e.error.code,e.error.message,e.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(hr(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),hr(e))n(e);else{let i=R.fromError(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(e,r,o)}}catch(i){yield{type:"error",error:i instanceof R?i:new R(C.InternalError,String(i))}}return}let s;try{let i=await this.request(e,At,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new R(C.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},st(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new R(C.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new R(C.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof R?i:new R(C.InternalError,String(i))}}}request(e,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((l,u)=>{let p=b=>{u(b)};if(!this._transport){p(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(b){p(b);return}o?.signal?.throwIfAborted();let d=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:d};o?.onprogress&&(this._progressHandlers.set(d,o.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[nt]:c}});let _=b=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(b)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(z=>this._onerror(new Error(`Failed to send cancellation: ${z}`)));let $=b instanceof R?b:new R(C.RequestTimeout,String(b));u($)};this._responseHandlers.set(d,b=>{if(!o?.signal?.aborted){if(b instanceof Error)return u(b);try{let $=ot(r,b.result);$.success?l($.data):u($.error)}catch($){u($)}}}),o?.signal?.addEventListener("abort",()=>{_(o?.signal?.reason)});let g=o?.timeout??gy,y=()=>_(R.fromError(C.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(d,g,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let b=$=>{let z=this._responseHandlers.get(d);z?z($):this._onerror(new Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,b),this._enqueueTaskMessage(v,{type:"request",message:m,timestamp:Date.now()}).catch($=>{this._cleanupTimeout(d),u($)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(b=>{this._cleanupTimeout(d),u(b)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Ro,r)}async getTaskResult(e,r,o){return this.request({method:"tasks/result",params:e},r,o)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},No,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},Sp,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let o=r?.relatedTask?.taskId;if(o){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[nt]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[nt]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[nt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let o=Ys(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=Xs(e,n);return Promise.resolve(r(i,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let o=Ys(e);this._notificationHandlers.set(o,n=>{let s=Xs(e,n);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,o,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(e,r);for(let n of o)if(n.type==="request"&&Rs(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new R(C.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(e);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new R(C.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new R(C.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await o.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new R(C.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Sr.parse({method:"notifications/tasks/status",params:a});await this.notification(c),st(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new R(C.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(st(a.status))throw new R(C.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let l=Sr.parse({method:"notifications/tasks/status",params:c});await this.notification(l),st(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function Ep(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function kp(t,e){let r={...t};for(let o in e){let n=o,s=e[n];if(s===void 0)continue;let i=r[n];Ep(i)&&Ep(s)?r[n]={...i,...s}:r[n]=s}return r}var vm=ac(Da(),1),$m=ac(ym(),1);function bT(){let t=new vm.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,$m.default)(t),t}var $n=class{constructor(e){this._ajv=e??bT()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Sn=class{constructor(e){this._server=e}requestStream(e,r,o){return this._server.requestStream(e,r,o)}createMessageStream(e,r){let o=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!o?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],i=s.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],l=c.some(u=>u.type==="tool_use");if(i){if(s.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let u=new Set(c.filter(d=>d.type==="tool_use").map(d=>d.id)),p=new Set(s.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==p.size||![...u].every(d=>p.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},xr,r)}elicitInputStream(e,r){let o=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!o?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!o?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:s},jt,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,o){return this._server.getTaskResult({taskId:e},r,o)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function Sm(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function bm(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var bn=class extends jo{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(wr.options.map((o,n)=>[o,n])),this.isMessageIgnored=(o,n)=>{let s=this._loggingLevels.get(n);return s?this.LOG_LEVEL_SEVERITY.get(o)this._oninitialize(o)),this.setNotificationHandler(Ns,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Bs,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=wr.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Sn(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=kp(this._capabilities,e)}setRequestHandler(e,r){let n=vo(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let s=$o(n);if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,l)=>{let u=ot(Tr,c);if(!u.success){let _=u.error instanceof Error?u.error.message:String(u.error);throw new R(C.InvalidParams,`Invalid tools/call request: ${_}`)}let{params:p}=u.data,d=await Promise.resolve(r(c,l));if(p.task){let _=ot(At,d);if(!_.success){let g=_.error instanceof Error?_.error.message:String(_.error);throw new R(C.InvalidParams,`Invalid task creation result: ${g}`)}return _.data}let m=ot(Co,d);if(!m.success){let _=m.error instanceof Error?m.error.message:String(m.error);throw new R(C.InvalidParams,`Invalid tools/call result: ${_}`)}return m.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){bm(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&Sm(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:pp.includes(r)?r:ks,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},zo)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some(l=>l.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(l=>l.type==="tool_use");if(s){if(n.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let l=new Set(a.filter(p=>p.type==="tool_use").map(p=>p.id)),u=new Set(n.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==u.size||![...l].every(p=>u.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Js,r):this.request({method:"sampling/createMessage",params:e},xr,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},jt,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:n},jt,r);if(s.action==="accept"&&s.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(s.content);if(!a.valid)throw new R(C.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof R?i:new R(C.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Ws,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import wm from"node:process";var TT=10*1024*1024,Tn=class{constructor(e){this._maxBufferSize=e?.maxBufferSize??TT}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(` +`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),wT(r)}clear(){this._buffer=void 0}};function wT(t){return vp.parse(JSON.parse(t))}function Tm(t){return JSON.stringify(t)+` +`}var wn=class{constructor(e=wm.stdin,r=wm.stdout,o){this._stdin=e,this._stdout=r,this._started=!1,this._ondata=n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(s){this.onerror?.(s),this.close().catch(()=>{})}},this._onerror=n=>{this.onerror?.(n)},this._readBuffer=new Tn({maxBufferSize:o?.maxBufferSize})}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let o=Tm(e);this._stdout.write(o)?r():this._stdout.once("drain",r)})}};var xn=class t{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,r,o){if(e.length>r)throw new Error(`${o} exceeds maximum length of ${r} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){t.validateLength(e,1e6,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){let r=[],o="",n=0,s=0;for(;n1e4)throw new Error("Template contains too many expressions (max 10000)");let a=e.slice(n+1,i),c=this.getOperator(a),l=a.includes("*"),u=this.getNames(a),p=u[0];for(let d of u)t.validateLength(d,1e6,"Variable name");r.push({name:p,operator:c,names:u,exploded:l}),n=i+1}else o+=e[n],n++;return o&&r.push(o),r}getOperator(e){return["+","#",".","/","?","&"].find(o=>e.startsWith(o))||""}getNames(e){let r=this.getOperator(e);return e.slice(r.length).split(",").map(o=>o.replace("*","").trim()).filter(o=>o.length>0)}encodeValue(e,r){return t.validateLength(e,1e6,"Variable value"),r==="+"||r==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,r){if(e.operator==="?"||e.operator==="&"){let i=e.names.map(c=>{let l=r[c];if(l===void 0)return"";let u=Array.isArray(l)?l.map(p=>this.encodeValue(p,e.operator)).join(","):this.encodeValue(l.toString(),e.operator);return`${c}=${u}`}).filter(c=>c.length>0);return i.length===0?"":(e.operator==="?"?"?":"&")+i.join("&")}if(e.names.length>1){let i=e.names.map(a=>r[a]).filter(a=>a!==void 0);return i.length===0?"":i.map(a=>Array.isArray(a)?a[0]:a).join(",")}let o=r[e.name];if(o===void 0)return"";let s=(Array.isArray(o)?o:[o]).map(i=>this.encodeValue(i,e.operator));switch(e.operator){case"":return s.join(",");case"+":return s.join(",");case"#":return"#"+s.join(",");case".":return"."+s.join(".");case"/":return"/"+s.join("/");default:return s.join(",")}}expand(e){let r="",o=!1;for(let n of this.parts){if(typeof n=="string"){r+=n;continue}let s=this.expandPart(n,e);s&&((n.operator==="?"||n.operator==="&")&&o?r+=s.replace("?","&"):r+=s,(n.operator==="?"||n.operator==="&")&&(o=!0))}return r}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){let r=[];for(let s of e.names)t.validateLength(s,1e6,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let s=0;s0?"identity-response-secret".repeat(Ya):void 0,FT=rc===void 0?process.env.TEST_IDENTITY_RESPONSE??JSON.stringify({login:Pn}):JSON.stringify({login:rc}),VT=process.env.TEST_IDENTITY_SCHEMA==="min-properties"?{type:"object",properties:{account:{type:"string"}},minProperties:1}:process.env.TEST_IDENTITY_SCHEMA==="all-of-required"?{type:"object",properties:{account:{type:"string"}},allOf:[{required:["account"]}]}:process.env.TEST_IDENTITY_SCHEMA==="additional-properties-false"?{type:"object",properties:{},additionalProperties:!1}:{type:"object",properties:{}},oc=process.env.TEST_INCLUDE_SAFE_READ_TOOL==="true"?"get_capabilities":void 0,rh=process.env.TEST_SAFE_READ_CALL_PATH,HT=process.env.TEST_SAFE_READ_RESPONSE??"safe-read",oh=lh(process.env.TEST_SAFE_READ_ANNOTATIONS,"TEST_SAFE_READ_ANNOTATIONS"),KT=process.env.TEST_SAFE_READ_SCHEMA==="required"?{type:"object",properties:{account:{type:"string"}},required:["account"]}:process.env.TEST_SAFE_READ_SCHEMA==="all-of-required"?{type:"object",properties:{},allOf:[{required:["account"]}]}:{type:"object",properties:{}},Xa=0,nh=process.env.TEST_ISOLATION_REPORT_PATH;if(nh){let t=process.env.OAUTH_CREDENTIAL_PATH;if(!t)throw new Error("test isolation fixture requires OAUTH_CREDENTIAL_PATH");let e=xT(t,"utf8");de(nh,JSON.stringify({home:process.env.HOME,xdgConfigHome:process.env.XDG_CONFIG_HOME,xdgCacheHome:process.env.XDG_CACHE_HOME,xdgDataHome:process.env.XDG_DATA_HOME,xdgStateHome:process.env.XDG_STATE_HOME,xdgRuntimeDir:process.env.XDG_RUNTIME_DIR,credentialPath:t,credential:e})),process.env.TEST_ISOLATION_EMIT_CREDENTIAL==="true"&&process.stderr.write(`test isolated credential: ${e} `);let r=process.env.TEST_ISOLATION_EMIT_CREDENTIAL_FIELD;if(r){let o=JSON.parse(e)[r];if(typeof o!="string")throw new Error("test isolation fixture requires a string credential field");process.stderr.write(`test isolated credential field: ${o} `)}}Jm&&Le(Jm,`1 -`);if(process.env.TEST_HANG_ON_START==="true"||zn&&Je(zn))if(th&&de(th,"ready"),zn)for(;Je(zn);)await se(5);else for(;;)await se(1e3);(Ja||Ba>0)&&process.stdin.once("end",()=>{Ja&&de(Ja,"ended"),Ba>0&&se(Ba).then(()=>process.exit(0))});process.env.TEST_IGNORE_SIGTERM==="true"&&process.on("SIGTERM",()=>{});oo&&(xn>0&&xn{Wm&&de(Wm,"initialized"),Bm&&Je(Bm)&&se(0).then(()=>process.exit(1))};function lh(t,e){if(t!==void 0)try{return JSON.parse(t)}catch{throw new Error(`${e} must contain valid JSON`)}}(eh||Ga)&&re.setRequestHandler(yr,async t=>{if(Ga&&de(Ga,JSON.stringify(t.params.clientInfo)),eh)throw new Error(`test initialize failure: ${process.env.API_TOKEN}`);return{protocolVersion:t.params.protocolVersion,capabilities:{tools:{},resources:An?{subscribe:!0}:{},prompts:{}},serverInfo:{name:"fake-upstream",version:"1.0.0"}}});re.setRequestHandler(Ks,async t=>{Ya+=1;let e=jT&&Ya>1;if(zm>0&&await se(zm),process.env.TEST_LIST_TOOLS_STARTED_PATH&&de(process.env.TEST_LIST_TOOLS_STARTED_PATH,"started"),process.env.TEST_LIST_TOOLS_COUNT_PATH&&Le(process.env.TEST_LIST_TOOLS_COUNT_PATH,`1 -`),xm>0&&await se(xm),xT&&t.params._meta?.progressToken!==void 0&&await re.notification({method:"notifications/progress",params:{progressToken:t.params._meta.progressToken,progress:1,total:2}}),process.env.TEST_FAIL_LIST_TOOLS==="true")throw new Error(`test tool list failure: ${process.env.TEST_ERROR_MESSAGE??process.env.API_TOKEN}`);(AT||CT&&Ya===1)&&await re.sendToolListChanged(),Em>0&&await se(Em);let r=Um&&t.params?.cursor==="next";return{tools:[...uh?[{name:"exec",description:"Execute a PostHog command.",inputSchema:{type:"object",properties:{command:{type:"string"},context:{type:"string"}},required:["command","context"],additionalProperties:!1}}]:r?[{name:"whoami_second",description:"Return the second injected account.",inputSchema:sh},{name:"echo_second",description:"Echo a second message.",inputSchema:{type:"object",properties:{message:{type:"string"}},required:["message"]}},{name:"create_second_item",description:"Create a second item.",inputSchema:{type:"object",properties:{name:{type:"string"}},required:["name"]}}]:[{name:e?"whoami_reloaded":"whoami",description:process.env.TEST_INCLUDE_DISCOVERY_TOKEN==="true"?`Return the injected account ${process.env.API_TOKEN}`:"Return the injected account.",inputSchema:sh},{name:e?"echo_reloaded":"echo",description:"Echo a message.",inputSchema:{type:"object",properties:{message:{type:"string"}},required:["message"]}},{name:e?"create_reloaded_item":"create_item",description:"Create an item.",inputSchema:{type:"object",properties:{name:{type:"string"}},required:["name"]},...ih===void 0?{}:{annotations:ih}}],...LT&&!r?[{name:"identity",description:"Return the configured account identity.",inputSchema:FT}]:[],...rc&&!r?[{name:rc,description:"Run the provider-declared empty-object readiness probe.",inputSchema:HT,...oh===void 0?{}:{annotations:oh}}]:[],...process.env.TEST_INCLUDE_MANAGEMENT_TOOL==="true"?[{name:"miftah_health",description:"Collides with a reserved Miftah management tool.",inputSchema:{type:"object",properties:{}}}]:[],...process.env.TEST_INCLUDE_MIFTAH_PREFIX_TOOL==="true"?[{name:"miftah_custom",description:"An upstream tool with a Miftah-looking name.",inputSchema:{type:"object",properties:{}}}]:[]],...Um&&!r?{nextCursor:"next"}:{}}});re.setRequestHandler(wr,async t=>{if(Xm&&de(Xm,"started"),Nn&&Je(Nn))return se(0).then(()=>process.exit(1)),new Promise(()=>{});if(process.env.TEST_CALL_TOOL_COUNT_PATH&&Le(process.env.TEST_CALL_TOOL_COUNT_PATH,`1 +`);if(process.env.TEST_HANG_ON_START==="true"||En&&Je(En))if(th&&de(th,"ready"),En)for(;Je(En);)await se(5);else for(;;)await se(1e3);(Wa||Ja>0)&&process.stdin.once("end",()=>{Wa&&de(Wa,"ended"),Ja>0&&se(Ja).then(()=>process.exit(0))});process.env.TEST_IGNORE_SIGTERM==="true"&&process.on("SIGTERM",()=>{});ro&&(zn>0&&zn{Wm&&de(Wm,"initialized"),Bm&&Je(Bm)&&se(0).then(()=>process.exit(1))};function lh(t,e){if(t!==void 0)try{return JSON.parse(t)}catch{throw new Error(`${e} must contain valid JSON`)}}(eh||Ba)&&re.setRequestHandler(gr,async t=>{if(Ba&&de(Ba,JSON.stringify(t.params.clientInfo)),eh)throw new Error(`test initialize failure: ${process.env.API_TOKEN}`);return{protocolVersion:t.params.protocolVersion,capabilities:{tools:{},resources:Cn?{subscribe:!0}:{},prompts:{}},serverInfo:{name:"fake-upstream",version:"1.0.0"}}});re.setRequestHandler(Gs,async t=>{Xa+=1;let e=ZT&&Xa>1;if(zm>0&&await se(zm),process.env.TEST_LIST_TOOLS_STARTED_PATH&&de(process.env.TEST_LIST_TOOLS_STARTED_PATH,"started"),process.env.TEST_LIST_TOOLS_COUNT_PATH&&Le(process.env.TEST_LIST_TOOLS_COUNT_PATH,`1 +`),xm>0&&await se(xm),zT&&t.params._meta?.progressToken!==void 0&&await re.notification({method:"notifications/progress",params:{progressToken:t.params._meta.progressToken,progress:1,total:2}}),process.env.TEST_FAIL_LIST_TOOLS==="true")throw new Error(`test tool list failure: ${process.env.TEST_ERROR_MESSAGE??process.env.API_TOKEN}`);(CT||jT&&Xa===1)&&await re.sendToolListChanged(),Em>0&&await se(Em);let r=Um&&t.params?.cursor==="next";return{tools:[...uh?[{name:"exec",description:"Execute a PostHog command.",inputSchema:{type:"object",properties:{command:{type:"string"},context:{type:"string"}},required:["command","context"],additionalProperties:!1}}]:r?[{name:"whoami_second",description:"Return the second injected account.",inputSchema:sh},{name:"echo_second",description:"Echo a second message.",inputSchema:{type:"object",properties:{message:{type:"string"}},required:["message"]}},{name:"create_second_item",description:"Create a second item.",inputSchema:{type:"object",properties:{name:{type:"string"}},required:["name"]}}]:[{name:e?"whoami_reloaded":"whoami",description:process.env.TEST_INCLUDE_DISCOVERY_TOKEN==="true"?`Return the injected account ${process.env.API_TOKEN}`:"Return the injected account.",inputSchema:sh},{name:e?"echo_reloaded":"echo",description:"Echo a message.",inputSchema:{type:"object",properties:{message:{type:"string"}},required:["message"]}},{name:e?"create_reloaded_item":"create_item",description:"Create an item.",inputSchema:{type:"object",properties:{name:{type:"string"}},required:["name"]},...ih===void 0?{}:{annotations:ih}}],...UT&&!r?[{name:"identity",description:"Return the configured account identity.",inputSchema:VT}]:[],...oc&&!r?[{name:oc,description:"Run the provider-declared empty-object readiness probe.",inputSchema:KT,...oh===void 0?{}:{annotations:oh}}]:[],...process.env.TEST_INCLUDE_MANAGEMENT_TOOL==="true"?[{name:"miftah_health",description:"Collides with a reserved Miftah management tool.",inputSchema:{type:"object",properties:{}}}]:[],...process.env.TEST_INCLUDE_MIFTAH_PREFIX_TOOL==="true"?[{name:"miftah_custom",description:"An upstream tool with a Miftah-looking name.",inputSchema:{type:"object",properties:{}}}]:[]],...Um&&!r?{nextCursor:"next"}:{}}});re.setRequestHandler(Tr,async t=>{if(Xm&&de(Xm,"started"),An&&Je(An))return se(0).then(()=>process.exit(1)),new Promise(()=>{});if(process.env.TEST_CALL_TOOL_COUNT_PATH&&Le(process.env.TEST_CALL_TOOL_COUNT_PATH,`1 `),t.params.name==="create_item"&&Ym&&Le(Ym,`1 -`),process.env.TEST_FAIL_CALL_TOOL==="true")throw new Error(`test tool call failure: ${process.env.API_TOKEN}`);return process.env.TEST_RETURN_CALL_TOOL_ERROR==="true"?{content:[{type:"text",text:"test tool returned an error result"}],isError:!0}:(PT&&t.params._meta?.progressToken!==void 0&&await re.notification({method:"notifications/progress",params:{progressToken:t.params._meta.progressToken,progress:1,total:2,...Im===void 0?{}:{message:Im}}}),ZT&&await Promise.all([re.sendToolListChanged(),re.sendResourceListChanged(),re.sendPromptListChanged()]),Rm>0&&await se(Rm),uh&&t.params.name==="exec"?{content:[{type:"text",text:`exec:${String(t.params.arguments?.command??"")}`}]}:t.params.name==="whoami"?{content:[{type:"text",text:tc??kn}]}:t.params.name==="identity"?{content:[{type:"text",text:UT}]}:t.params.name===rc?(rh&&de(rh,JSON.stringify({name:t.params.name,arguments:t.params.arguments??{}})),{content:[{type:"text",text:VT}]}):t.params.name==="echo"?{content:[{type:"text",text:String(t.params.arguments?.message??"")}]}:{content:[{type:"text",text:`created:${String(t.params.arguments?.name??"")}`}]})});re.setNotificationHandler(Nt,t=>{Qm&&Le(Qm,`${t.params.requestId} -`)});re.setRequestHandler(As,async t=>{if(process.env.TEST_LIST_RESOURCES_COUNT_PATH&&Le(process.env.TEST_LIST_RESOURCES_COUNT_PATH,`1 -`),process.env.TEST_LIST_RESOURCES_STARTED_PATH&&de(process.env.TEST_LIST_RESOURCES_STARTED_PATH,"started"),km>0&&await se(km),zT&&t.params._meta?.progressToken!==void 0&&await re.notification({method:"notifications/progress",params:{progressToken:t.params._meta.progressToken,progress:1,total:2}}),process.env.TEST_FAIL_LIST_RESOURCES==="true"||Hm&&Je(Hm))throw new Error(`test resource discovery failure: ${process.env.API_TOKEN}`);let e=In&&t.params?.cursor==="next";return{resources:[{uri:e?MT:ah,name:process.env.TEST_INCLUDE_DISCOVERY_TOKEN==="true"?`Current account ${process.env.API_TOKEN}`:e?DT:RT,mimeType:"text/plain",...Vm?{icons:[{src:Vm}]}:{}}],...In&&!e?{nextCursor:"next"}:{}}});OT||re.setRequestHandler(Cs,async t=>(ET&&t.params._meta?.progressToken!==void 0&&await re.notification({method:"notifications/progress",params:{progressToken:t.params._meta.progressToken,progress:1,total:2}}),{resourceTemplates:Rn===void 0?[]:[{uriTemplate:Rn,name:IT,mimeType:"text/plain"}]}));re.setRequestHandler(Zs,async t=>{if(process.env.TEST_READ_RESOURCE_COUNT_PATH&&Le(process.env.TEST_READ_RESOURCE_COUNT_PATH,`1 -`),process.env.TEST_READ_RESOURCE_STARTED_PATH&&de(process.env.TEST_READ_RESOURCE_STARTED_PATH,"started"),Om>0&&await se(Om),process.env.TEST_FAIL_READ_RESOURCE==="true")throw new Error(`test resource read failure: ${process.env.TEST_ERROR_URI??process.env.API_TOKEN}`);return{contents:[{uri:Rn!==void 0&&new wn(Rn).match(t.params.uri)!==null?t.params.uri:ah,text:Pn,mimeType:"text/plain"},...Fm?[{uri:Fm,text:Pn,mimeType:"text/plain"}]:[]]}});re.setRequestHandler(Ds,async()=>{if(!An)throw new Error("test upstream does not support resource subscriptions");if(jm>0&&await se(jm),Lm&&de(Lm,"started"),Mm&&Le(Mm,`1 -`),Zm>0&&await se(Zm),NT)throw new Error("test subscribe failure");let t=En?++ec:void 0;if(En&&(Qa=!0),Am){let e=async()=>{En&&(!Qa||ec!==t)||await re.sendResourceUpdated({uri:Am})};Cm>0?se(Cm).then(e):await e()}return{}});re.setRequestHandler(Ms,async()=>{if(!An)throw new Error("test upstream does not support resource subscriptions");return qm&&Le(qm,`1 -`),Dm>0&&await se(Dm),En&&(Qa=!1,ec+=1),{}});re.setRequestHandler(qs,async t=>{if(process.env.TEST_LIST_PROMPTS_COUNT_PATH&&Le(process.env.TEST_LIST_PROMPTS_COUNT_PATH,`1 -`),process.env.TEST_LIST_PROMPTS_STARTED_PATH&&de(process.env.TEST_LIST_PROMPTS_STARTED_PATH,"started"),Pm>0&&await se(Pm),kT&&t.params._meta?.progressToken!==void 0&&await re.notification({method:"notifications/progress",params:{progressToken:t.params._meta.progressToken,progress:1,total:2}}),process.env.TEST_FAIL_LIST_PROMPTS==="true"||Km&&Je(Km))throw new Error(`test prompt discovery failure: ${process.env.API_TOKEN}`);let e=In&&t.params?.cursor==="next";return{prompts:[{name:e?qT:ch,description:process.env.TEST_INCLUDE_DISCOVERY_TOKEN==="true"?`Account prompt ${process.env.API_TOKEN}`:e?"Second account prompt":"Account prompt",...On?{icons:[{src:On}]}:{}}],...In&&!e?{nextCursor:"next"}:{}}});re.setRequestHandler(Ls,async()=>{if(process.env.TEST_GET_PROMPT_COUNT_PATH&&Le(process.env.TEST_GET_PROMPT_COUNT_PATH,`1 -`),process.env.TEST_GET_PROMPT_STARTED_PATH&&de(process.env.TEST_GET_PROMPT_STARTED_PATH,"started"),Nm>0&&await se(Nm),process.env.TEST_FAIL_GET_PROMPT==="true")throw new Error(`test prompt get failure: ${process.env.TEST_ERROR_URI??process.env.API_TOKEN}`);return{description:ch,messages:[{role:"user",content:{type:"text",text:Pn}},...Ha?[{role:"assistant",content:{type:"resource_link",uri:Ha,name:"Account resource",...On?{icons:[{src:On}]}:{}}},{role:"assistant",content:{type:"resource",resource:{uri:Ha,text:Pn,mimeType:"text/plain"}}}]:[]]}});await re.connect(new Tn); +`),process.env.TEST_FAIL_CALL_TOOL==="true")throw new Error(`test tool call failure: ${process.env.API_TOKEN}`);return process.env.TEST_RETURN_CALL_TOOL_ERROR==="true"?{content:[{type:"text",text:"test tool returned an error result"}],isError:!0}:(RT&&t.params._meta?.progressToken!==void 0&&await re.notification({method:"notifications/progress",params:{progressToken:t.params._meta.progressToken,progress:1,total:2,...Im===void 0?{}:{message:Im}}}),DT&&await Promise.all([re.sendToolListChanged(),re.sendResourceListChanged(),re.sendPromptListChanged()]),Rm>0&&await se(Rm),uh&&t.params.name==="exec"?{content:[{type:"text",text:`exec:${String(t.params.arguments?.command??"")}`}]}:t.params.name==="whoami"?{content:[{type:"text",text:rc??Pn}]}:t.params.name==="identity"?{content:[{type:"text",text:FT}]}:t.params.name===oc?(rh&&de(rh,JSON.stringify({name:t.params.name,arguments:t.params.arguments??{}})),{content:[{type:"text",text:HT}]}):t.params.name==="echo"?{content:[{type:"text",text:String(t.params.arguments?.message??"")}]}:{content:[{type:"text",text:`created:${String(t.params.arguments?.name??"")}`}]})});re.setNotificationHandler(Nt,t=>{Qm&&Le(Qm,`${t.params.requestId} +`)});re.setRequestHandler(Cs,async t=>{if(process.env.TEST_LIST_RESOURCES_COUNT_PATH&&Le(process.env.TEST_LIST_RESOURCES_COUNT_PATH,`1 +`),process.env.TEST_LIST_RESOURCES_STARTED_PATH&&de(process.env.TEST_LIST_RESOURCES_STARTED_PATH,"started"),km>0&&await se(km),ET&&t.params._meta?.progressToken!==void 0&&await re.notification({method:"notifications/progress",params:{progressToken:t.params._meta.progressToken,progress:1,total:2}}),process.env.TEST_FAIL_LIST_RESOURCES==="true"||Hm&&Je(Hm))throw new Error(`test resource discovery failure: ${process.env.API_TOKEN}`);let e=On&&t.params?.cursor==="next";return{resources:[{uri:e?qT:ah,name:process.env.TEST_INCLUDE_DISCOVERY_TOKEN==="true"?`Current account ${process.env.API_TOKEN}`:e?MT:IT,mimeType:"text/plain",...Vm?{icons:[{src:Vm}]}:{}}],...On&&!e?{nextCursor:"next"}:{}}});NT||re.setRequestHandler(js,async t=>(kT&&t.params._meta?.progressToken!==void 0&&await re.notification({method:"notifications/progress",params:{progressToken:t.params._meta.progressToken,progress:1,total:2}}),{resourceTemplates:In===void 0?[]:[{uriTemplate:In,name:OT,mimeType:"text/plain"}]}));re.setRequestHandler(Ds,async t=>{if(process.env.TEST_READ_RESOURCE_COUNT_PATH&&Le(process.env.TEST_READ_RESOURCE_COUNT_PATH,`1 +`),process.env.TEST_READ_RESOURCE_STARTED_PATH&&de(process.env.TEST_READ_RESOURCE_STARTED_PATH,"started"),Om>0&&await se(Om),process.env.TEST_FAIL_READ_RESOURCE==="true")throw new Error(`test resource read failure: ${process.env.TEST_ERROR_URI??process.env.API_TOKEN}`);return{contents:[{uri:In!==void 0&&new xn(In).match(t.params.uri)!==null?t.params.uri:ah,text:Rn,mimeType:"text/plain"},...Fm?[{uri:Fm,text:Rn,mimeType:"text/plain"}]:[]]}});re.setRequestHandler(Ms,async()=>{if(!Cn)throw new Error("test upstream does not support resource subscriptions");if(jm>0&&await se(jm),Lm&&de(Lm,"started"),Mm&&Le(Mm,`1 +`),Zm>0&&await se(Zm),AT)throw new Error("test subscribe failure");let t=kn?++tc:void 0;if(kn&&(ec=!0),Am){let e=async()=>{kn&&(!ec||tc!==t)||await re.sendResourceUpdated({uri:Am})};Cm>0?se(Cm).then(e):await e()}return{}});re.setRequestHandler(qs,async()=>{if(!Cn)throw new Error("test upstream does not support resource subscriptions");return qm&&Le(qm,`1 +`),Dm>0&&await se(Dm),kn&&(ec=!1,tc+=1),{}});re.setRequestHandler(Ls,async t=>{if(process.env.TEST_LIST_PROMPTS_COUNT_PATH&&Le(process.env.TEST_LIST_PROMPTS_COUNT_PATH,`1 +`),process.env.TEST_LIST_PROMPTS_STARTED_PATH&&de(process.env.TEST_LIST_PROMPTS_STARTED_PATH,"started"),Pm>0&&await se(Pm),PT&&t.params._meta?.progressToken!==void 0&&await re.notification({method:"notifications/progress",params:{progressToken:t.params._meta.progressToken,progress:1,total:2}}),process.env.TEST_FAIL_LIST_PROMPTS==="true"||Km&&Je(Km))throw new Error(`test prompt discovery failure: ${process.env.API_TOKEN}`);let e=On&&t.params?.cursor==="next";return{prompts:[{name:e?LT:ch,description:process.env.TEST_INCLUDE_DISCOVERY_TOKEN==="true"?`Account prompt ${process.env.API_TOKEN}`:e?"Second account prompt":"Account prompt",...Nn?{icons:[{src:Nn}]}:{}}],...On&&!e?{nextCursor:"next"}:{}}});re.setRequestHandler(Us,async()=>{if(process.env.TEST_GET_PROMPT_COUNT_PATH&&Le(process.env.TEST_GET_PROMPT_COUNT_PATH,`1 +`),process.env.TEST_GET_PROMPT_STARTED_PATH&&de(process.env.TEST_GET_PROMPT_STARTED_PATH,"started"),Nm>0&&await se(Nm),process.env.TEST_FAIL_GET_PROMPT==="true")throw new Error(`test prompt get failure: ${process.env.TEST_ERROR_URI??process.env.API_TOKEN}`);return{description:ch,messages:[{role:"user",content:{type:"text",text:Rn}},...Ka?[{role:"assistant",content:{type:"resource_link",uri:Ka,name:"Account resource",...Nn?{icons:[{src:Nn}]}:{}}},{role:"assistant",content:{type:"resource",resource:{uri:Ka,text:Rn,mimeType:"text/plain"}}}]:[]]}});await re.connect(new wn); diff --git a/tests/oauth-console-validation-contract.test.ts b/tests/oauth-console-validation-contract.test.ts index 299fcf86..db270504 100644 --- a/tests/oauth-console-validation-contract.test.ts +++ b/tests/oauth-console-validation-contract.test.ts @@ -56,11 +56,13 @@ describe("OAuth and Console validation contract", () => { "Disconnect and cleanup", "Cancellation and callback timeout", "Configuration backup and recovery", - "pre-v1 feature release", + "stable v1 release", "Interested external users: 5", - "Recorded completed external workflows: 0", - "Recorded returning external users: 0", - "The external design-partner gate remains open" + "Recorded completed external workflows: 5", + "Recorded returning external users: 3", + "Recorded unaided README evaluators: 3", + "maintainer attestation", + "not independently inspected" ]) { expect(validation).toContain(requiredEvidence); } diff --git a/tests/package-contract.test.ts b/tests/package-contract.test.ts index ae111b77..f53bb429 100644 --- a/tests/package-contract.test.ts +++ b/tests/package-contract.test.ts @@ -107,7 +107,23 @@ function assertPatchedFastUriLockEntries(lock: PackageLock): void { expect(entries, "fast-uri must exist in the package lock").not.toHaveLength(0); for (const [packagePath, packageEntry] of entries) { - expect(packageEntry["version"], `${packagePath} must resolve to the patched release`).toBe("3.1.4"); + expect(packageEntry["version"], `${packagePath} must resolve to the patched release`).toBe("3.1.5"); + } +} + +function assertPatchedTransitiveLockEntries( + lock: PackageLock, + packageName: string, + expectedVersion: string +): void { + const suffix = `node_modules/${packageName}`; + const entries = Object.entries(lock.packages ?? {}).filter( + ([packagePath]) => packagePath === suffix || packagePath.endsWith(`/${suffix}`) + ); + + expect(entries, `${packageName} must exist in the package lock`).not.toHaveLength(0); + for (const [packagePath, packageEntry] of entries) { + expect(packageEntry["version"], `${packagePath} must resolve to the patched release`).toBe(expectedVersion); } } @@ -737,12 +753,30 @@ describe("package metadata contract", () => { assertPatchedEsbuildLockEntries(lock); }); - it("locks the patched fast-uri release for GHSA-v2hh-gcrm-f6hx", () => { + it("locks the patched fast-uri release for GHSA-7p8r-x3mc-p8w7", () => { + const manifest = readPackageManifest(); const lock = JSON.parse(readFileSync(new URL("../package-lock.json", import.meta.url), "utf8")) as PackageLock; + expect(manifest.overrides?.["fast-uri"]).toBe("3.1.5"); assertPatchedFastUriLockEntries(lock); }); + it("locks the patched transitive security releases tracked by #373", () => { + const manifest = readPackageManifest(); + const lock = JSON.parse(readFileSync(new URL("../package-lock.json", import.meta.url), "utf8")) as PackageLock; + const expectedVersions = { + "brace-expansion": "5.0.9", + hono: "4.12.34", + "ip-address": "10.3.1", + nanoid: "3.3.17" + } as const; + + for (const [packageName, expectedVersion] of Object.entries(expectedVersions)) { + expect(manifest.overrides?.[packageName]).toBe(expectedVersion); + assertPatchedTransitiveLockEntries(lock, packageName, expectedVersion); + } + }); + it("locks the patched MCP SDK and Hono Node server releases for GHSA-frvp-7c67-39w9", () => { const manifest = readPackageManifest(); const lock = JSON.parse(readFileSync(new URL("../package-lock.json", import.meta.url), "utf8")) as PackageLock; @@ -766,14 +800,32 @@ describe("package metadata contract", () => { it("rejects stale nested fast-uri lock entries", () => { const lock: PackageLock = { packages: { - "node_modules/fast-uri": { version: "3.1.4" }, - "node_modules/ajv/node_modules/fast-uri": { version: "3.1.3" } + "node_modules/fast-uri": { version: "3.1.5" }, + "node_modules/ajv/node_modules/fast-uri": { version: "3.1.4" } } }; expect(() => assertPatchedFastUriLockEntries(lock)).toThrow(/node_modules\/ajv\/node_modules\/fast-uri/); }); + it.each([ + ["hono", "4.12.34", "4.12.33"], + ["ip-address", "10.3.1", "10.3.0"], + ["brace-expansion", "5.0.9", "5.0.8"], + ["nanoid", "3.3.17", "3.3.16"] + ])("rejects a stale nested %s lock entry", (packageName, patchedVersion, staleVersion) => { + const lock: PackageLock = { + packages: { + [`node_modules/${packageName}`]: { version: patchedVersion }, + [`node_modules/example/node_modules/${packageName}`]: { version: staleVersion } + } + }; + + expect(() => assertPatchedTransitiveLockEntries(lock, packageName, patchedVersion)).toThrow( + new RegExp(`node_modules/example/node_modules/${packageName}`) + ); + }); + it("rejects stale nested Hono Node server lock entries", () => { const lock: PackageLock = { packages: { diff --git a/tests/readme-product-contract.test.ts b/tests/readme-product-contract.test.ts index 65f8c8f4..615ab5d7 100644 --- a/tests/readme-product-contract.test.ts +++ b/tests/readme-product-contract.test.ts @@ -61,9 +61,10 @@ describe("product README", () => { expect(firstScreen).toContain("Miftah itself has no cloud service or telemetry"); expect(firstScreen).toContain("## Is Miftah for you?"); expect(firstScreen).toContain("Keep your direct MCP entry when you use one account"); - expect(firstScreen).toContain("experimental and pre-1.0"); - expect(firstScreen).toContain("validation in [#25]"); - expect(firstScreen).toContain("[#88]"); + expect(firstScreen).toContain("stable v1 release line"); + expect(firstScreen).toContain("closed by maintainer attestation"); + expect(firstScreen).toContain("[#39]"); + expect(firstScreen).not.toContain("experimental and pre-1.0"); }); it("explains one connector with named profiles instead of duplicate entries", () => { diff --git a/tests/release-config.test.ts b/tests/release-config.test.ts index 1d81ee94..0d629c9b 100644 --- a/tests/release-config.test.ts +++ b/tests/release-config.test.ts @@ -151,24 +151,36 @@ describe("continuous integration workflow contract", () => { const lockedPackages = readLockedPackages(); expect(overrides).toMatchObject({ + "brace-expansion": "5.0.9", + "fast-uri": "3.1.5", + hono: "4.12.34", + "ip-address": "10.3.1", + nanoid: "3.3.17", "@vitest/coverage-v8": { "test-exclude": { glob: { ".": "13.0.6", - minimatch: { "brace-expansion": "5.0.8" } + minimatch: { "brace-expansion": "5.0.9" } }, - minimatch: { "brace-expansion": "5.0.8" } + minimatch: { "brace-expansion": "5.0.9" } } }, - eslint: { minimatch: { "brace-expansion": "5.0.8" } }, - "typescript-eslint": { minimatch: { "brace-expansion": "5.0.8" } }, + eslint: { minimatch: { "brace-expansion": "5.0.9" } }, + "typescript-eslint": { minimatch: { "brace-expansion": "5.0.9" } }, vitest: { vite: { postcss: "8.5.23" } } }); - for (const name of ["brace-expansion", "glob", "postcss"]) { + for (const name of ["glob", "postcss"]) { expect(overrides).not.toHaveProperty(name); } - expect(lockedPackages["node_modules/brace-expansion"]).toMatchObject({ version: "5.0.8", dev: true }); + expect(lockedPackages["node_modules/minimatch/node_modules/brace-expansion"]).toMatchObject({ + version: "5.0.9", + dev: true + }); + expect(lockedPackages["node_modules/fast-uri"]).toMatchObject({ version: "3.1.5" }); expect(lockedPackages["node_modules/glob"]).toMatchObject({ version: "13.0.6", dev: true }); + expect(lockedPackages["node_modules/hono"]).toMatchObject({ version: "4.12.34" }); + expect(lockedPackages["node_modules/ip-address"]).toMatchObject({ version: "10.3.1" }); + expect(lockedPackages["node_modules/nanoid"]).toMatchObject({ version: "3.3.17", dev: true }); expect(lockedPackages["node_modules/postcss"]).toMatchObject({ version: "8.5.23", dev: true }); }); diff --git a/tests/release-version.test.ts b/tests/release-version.test.ts index 52d7d211..740d25d5 100644 --- a/tests/release-version.test.ts +++ b/tests/release-version.test.ts @@ -1,7 +1,7 @@ import { readFileSync } from "node:fs"; import { describe, expect, it } from "vitest"; -const releaseVersion = "0.5.8"; +const releaseVersion = "1.0.0"; function readRepositoryFile(path: string): string { return readFileSync(new URL(`../${path}`, import.meta.url), "utf8"); @@ -21,15 +21,15 @@ function releaseNotes(changelog: string, version: string): string { return changelog.slice(match.index, end < 0 ? undefined : end); } -describe("v0.5.8 release artifacts", () => { +describe("v1.0.0 release artifacts", () => { it.each([ { name: "a non-zero-padded date", - changelog: "## [0.5.8] - 2026-8-9\n\n### Changed\n" + changelog: "## [1.0.0] - 2026-8-11\n\n### Changed\n" }, { name: "a heading that does not start its line", - changelog: "Release candidate: ## [0.5.8] - 2026-08-09\n\n### Changed\n" + changelog: "Release candidate: ## [1.0.0] - 2026-08-11\n\n### Changed\n" } ])("rejects $name", ({ changelog }) => { expect(() => releaseNotes(changelog, releaseVersion)).toThrow( @@ -71,39 +71,35 @@ describe("v0.5.8 release artifacts", () => { } }); - it("documents actionable startup diagnostics and the safe maintenance refresh", () => { + it("documents the stable v1 contract and its evidence boundary", () => { const changelog = readRepositoryFile("CHANGELOG.md"); const notes = releaseNotes(changelog, releaseVersion); - expect(notes).toContain("Miftah remains experimental and pre-1.0"); - expect(notes).toContain("### Fixed"); - expect(notes).toContain("[#347](https://github.com/mohanagy/miftah/issues/347)"); - expect(notes).toMatch( - /Runtime warnings remain concise and point to the exact `miftah test-profile` command/iu, - ); - expect(notes).toMatch( - /`test-profile` and `doctor` now surface a bounded, secret-redacted failure cause and remediation/iu, - ); - expect(notes).toContain("uvx"); expect(notes).toContain("### Changed"); - expect(notes).toContain("[#349](https://github.com/mohanagy/miftah/pull/349)"); - expect(notes).toContain("[#350](https://github.com/mohanagy/miftah/issues/350)"); - expect(notes).toMatch(/dependency/iu); - expect(notes).toMatch(/\bdotenv\b/iu); - expect(notes).toMatch(/TypeScript ESLint/iu); - expect(notes).toContain("Vitest 4"); - expect(notes).toContain("TypeScript 7"); - expect(notes).toContain("external validation remains incomplete under #25, #88, #202, and #290"); + expect(notes).toContain("[#39](https://github.com/mohanagy/miftah/issues/39)"); + expect(notes).toContain("[#373](https://github.com/mohanagy/miftah/issues/373)"); + expect(notes).toContain("stable Semantic Versioning contract"); + for (const dependency of ["fast-uri", "ip-address", "hono", "brace-expansion", "nanoid"]) { + expect(notes).toContain(dependency); + } + expect(notes).toContain("5/5 completed external workflows"); + expect(notes).toContain("3 returning participants"); + expect(notes).toContain("3 unaided evaluators"); + expect(notes).toContain("maintainer attestation"); + expect(notes).toContain("not independently inspected"); + expect(notes).toContain("protected OIDC publication"); const readme = readRepositoryFile("README.md"); - const featureGuide = readRepositoryFile("docs/whats-new-in-0.5.md"); const compatibilityGuide = readRepositoryFile("docs/presets-and-clients.md"); + const libraryGuide = readRepositoryFile("docs/library-api.md"); expect(readme).toContain("Use the right account with the MCP servers you already trust"); - expect(readme).toContain("experimental and pre-1.0"); + expect(readme).toContain("stable v1 release line"); + expect(readme).toContain("closed by maintainer attestation"); + expect(readme).not.toContain("experimental and pre-1.0"); expect(readme).toContain(`npm install -g @lubab/miftah@${releaseVersion}`); - expect(featureGuide).toContain(`Install \`@lubab/miftah@${releaseVersion}\``); - expect(featureGuide).toContain(`npm install -g @lubab/miftah@${releaseVersion}`); expect(compatibilityGuide).toContain(`Miftah package version: \`${releaseVersion}\``); + expect(libraryGuide).toContain("Starting with Miftah 1.0, these public surfaces follow Semantic Versioning"); + expect(libraryGuide).toContain("requires a new major release"); }); }); diff --git a/tests/v050-feature-guide-contract.test.ts b/tests/v050-feature-guide-contract.test.ts index c2357b24..3052a7ee 100644 --- a/tests/v050-feature-guide-contract.test.ts +++ b/tests/v050-feature-guide-contract.test.ts @@ -59,7 +59,7 @@ describe("Miftah 0.5 owner guide", () => { expect(guide).toContain("Native OAuth and the optional Console first shipped in 0.4.0"); expect(guide).toContain("0.5.0 makes them easier to discover, configure, and maintain"); expect(guide).toContain( - "an implemented multi-account Google Search Console onboarding path, with external validation still in progress" + "an implemented multi-account Google Search Console onboarding path, with external validation still in progress at the time" ); expect(guide).not.toContain("a complete multi-account Google Search Console onboarding path"); expect(readme.split("\n").slice(0, 80).join("\n")).toContain( @@ -102,7 +102,9 @@ describe("Miftah 0.5 owner guide", () => { expect(guide).toContain("upstream-owned OAuth"); expect(guide).toContain("API key or secret reference"); expect(guide).toContain("restart the MCP client"); - expect(guide).toContain("External multi-account and returning-user validation is still open"); + expect(guide).toContain("External multi-account and returning-user validation was still open during 0.5"); + expect(guide).toContain("later closed by maintainer attestation"); + expect(guide).toContain("[#39]"); expect(guide).toContain("[#25]"); expect(guide).toContain("[#88]"); expect(guide).toContain("[CLI reference](cli.md)"); diff --git a/tests/v1-readiness-docs-contract.test.ts b/tests/v1-readiness-docs-contract.test.ts index 38d6bd75..1e5fe247 100644 --- a/tests/v1-readiness-docs-contract.test.ts +++ b/tests/v1-readiness-docs-contract.test.ts @@ -22,6 +22,9 @@ describe("v1 readiness documentation contract", () => { const guide = read("docs/v1-evaluation.md"); expect(guide).toContain(`@lubab/miftah@${packageVersion}`); + expect(guide).toContain("Evaluator baseline: `@lubab/miftah@0.5.8`"); + expect(guide).toContain("maintainer attestation"); + expect(guide).toContain("not independently inspected"); expect(guide).toMatch(/issues? #25, #88, #202, and #290/i); expect(guide).toMatch(/five completed multi-account workflows/i); expect(guide).toMatch(/three returning users/i); @@ -57,20 +60,24 @@ describe("v1 readiness documentation contract", () => { expect(brief).toMatch(/private report/i); expect(brief).toMatch(/public completion summary/i); expect(brief).toMatch(/no unresolved critical or high-severity finding/i); + expect(brief).toContain("maintainer attestation"); + expect(brief).toContain("not independently inspected"); }); - it("keeps status pages explicit about incomplete external evidence", () => { + it("keeps status pages explicit about attested but uninspected external evidence", () => { const validation = read("docs/oauth-console-validation.md"); const threatModel = read("docs/threat-model.md"); expect(validation).toContain("[v1 external evaluation](v1-evaluation.md)"); expect(validation).toContain(`@lubab/miftah@${packageVersion}`); - expect(validation).toContain("Recorded completed external workflows: 0"); - expect(validation).toContain("Recorded returning external users: 0"); - expect(validation).toContain("Recorded unaided README evaluators: 0"); + expect(validation).toContain("Recorded completed external workflows: 5"); + expect(validation).toContain("Recorded returning external users: 3"); + expect(validation).toContain("Recorded unaided README evaluators: 3"); + expect(validation).toContain("not independently inspected"); expect(threatModel).toContain( "[independent security review brief](independent-security-review.md)", ); - expect(threatModel).toMatch(/not yet been commissioned/i); + expect(threatModel).toMatch(/maintainer attestation/i); + expect(threatModel).toMatch(/not independently inspected/i); }); }); From bb3240cac8c6226bc212a6571634cef6aebc6ac4 Mon Sep 17 00:00:00 2001 From: mohammed naji Date: Tue, 11 Aug 2026 08:06:22 +0400 Subject: [PATCH 2/3] docs: tighten v1 evidence boundaries --- docs/independent-security-review.md | 2 +- docs/oauth-console-validation.md | 4 ++-- docs/v1-evaluation.md | 4 ++-- tests/readme-product-contract.test.ts | 3 +++ tests/v050-feature-guide-contract.test.ts | 3 +++ tests/v1-readiness-docs-contract.test.ts | 21 +++++++++++++++++++++ 6 files changed, 32 insertions(+), 5 deletions(-) diff --git a/docs/independent-security-review.md b/docs/independent-security-review.md index c0276b43..dd3b7848 100644 --- a/docs/independent-security-review.md +++ b/docs/independent-security-review.md @@ -10,7 +10,7 @@ The reviewer supplies an independence declaration covering employment, contribut ## Recorded review status -On 2026-08-11, the maintainer reported that the security report was completed and explicitly authorized closure of #37. That statement is recorded as maintainer attestation. The completed report, reviewer attribution and independence declaration, target commit, severity counts, remediation or retest record, public completion summary, and v1 candidate delta acceptance were not supplied for this release-preparation session and therefore were not independently inspected. This status does not create or infer those missing facts; #39 must retain the exact protected-release evidence and any reviewer-approved final-candidate reconciliation used for publication. +On 2026-08-11, the maintainer reported that the security report was completed and explicitly authorized closure of #37. That statement is recorded as maintainer attestation. The completed report, reviewer attribution and independence declaration, target commit, severity counts, remediation or retest record, public completion summary, and v1 candidate delta acceptance were not supplied for this release-preparation session and therefore were not independently inspected. Maintainer attestation or deidentified records alone do not close the independent-review criterion in #39. This status does not create or infer the missing facts; #39 must retain the exact protected-release evidence and any reviewer-approved final-candidate reconciliation used for publication. ## Review scope diff --git a/docs/oauth-console-validation.md b/docs/oauth-console-validation.md index 4674e9db..d76313ac 100644 --- a/docs/oauth-console-validation.md +++ b/docs/oauth-console-validation.md @@ -1,6 +1,6 @@ # OAuth and Console validation -This page records what Miftah's release gate proves for native remote OAuth and the optional local Console, what it deliberately does not prove, and how the external-evidence status was accepted. It is an evidence record, not a claim that every OAuth provider is supported. +This page records what Miftah's release gate proves for native remote OAuth and the optional local Console, what it deliberately does not prove, and how maintainer-attested external evidence is recorded. It is an evidence record, not a claim that every OAuth provider is supported. ## Automated compatibility gate @@ -37,7 +37,7 @@ For provider-adapter-backed or upstream-owned OAuth, follow the provider's own r ## Release status and limitations -OAuth and Console are included in the stable v1 release. The automated gate remains required evidence, but it does not prove live-provider behavior, external adoption, or account intent by itself. The current support classes and manual fallbacks remain defined in the [OAuth support matrix](oauth-support.md#support-matrix). +OAuth and Console are included in the `@lubab/miftah@1.0.0` release candidate. They become part of the stable v1 release only after exact-main protected publication and registry verification. The automated gate remains required evidence, but it does not prove live-provider behavior, external adoption, or account intent by itself. The current support classes and manual fallbacks remain defined in the [OAuth support matrix](oauth-support.md#support-matrix). ## External design-partner evidence diff --git a/docs/v1-evaluation.md b/docs/v1-evaluation.md index ab9f3b71..4eed114e 100644 --- a/docs/v1-evaluation.md +++ b/docs/v1-evaluation.md @@ -4,7 +4,7 @@ This protocol turns external Miftah use into comparable, privacy-safe evidence f Evaluator baseline: `@lubab/miftah@0.5.8`. Stable release candidate: `@lubab/miftah@1.0.0`. Record the exact package version, upstream MCP version or immutable image reference, client, operating system, provider class, and authentication owner for every attempt. If the target changes, do not combine results until the participant repeats the affected steps or an explicitly documented delta assessment establishes why the result remains applicable. -This document is the evidence protocol, not participant-level completed evidence. On 2026-08-11, the maintainer reported 5 completed workflows, 3 later returns, and 3 unaided evaluators and authorized closure of the related issues. That status is a maintainer attestation; the underlying participant records were not independently inspected during release preparation, and the pending public-rollup rows below must not be presented as completed records. +This document is the evidence protocol, not participant-level completed evidence. On 2026-08-11, the maintainer reported 5 completed workflows, 3 later returns, and 3 unaided evaluators and authorized closure of the related issues. That status is a maintainer attestation; the underlying participant records were not independently inspected during release preparation. The attested counters apply to the 0.5.8 baseline only. Applying them to the 1.0.0 candidate requires complete linked records plus repeated affected steps or an accepted, documented delta assessment. ## Closure gates @@ -135,4 +135,4 @@ Map the final evidence explicitly: - issue #290: three unaided participants achieve the README's safe first-use contract; - issue #39: at least three real providers are represented, the independent security review is closed, and the final v1 target is reconciled under the [independent review brief](independent-security-review.md); provider evidence alone cannot close this release gate. -Failed attempts are learning, not completion. Future evidence updates should replace pending rows only with consented deidentified records and should not infer participant details from the maintainer-level counters. +Failed attempts are learning, not completion. Complete linked records and accepted closure gates are required before replacing pending rows with completion evidence. Future evidence updates should not infer participant details from the maintainer-level counters. diff --git a/tests/readme-product-contract.test.ts b/tests/readme-product-contract.test.ts index 615ab5d7..91e1c6be 100644 --- a/tests/readme-product-contract.test.ts +++ b/tests/readme-product-contract.test.ts @@ -63,6 +63,9 @@ describe("product README", () => { expect(firstScreen).toContain("Keep your direct MCP entry when you use one account"); expect(firstScreen).toContain("stable v1 release line"); expect(firstScreen).toContain("closed by maintainer attestation"); + expect(firstScreen).toContain( + "source participant records and completed security report are not published", + ); expect(firstScreen).toContain("[#39]"); expect(firstScreen).not.toContain("experimental and pre-1.0"); }); diff --git a/tests/v050-feature-guide-contract.test.ts b/tests/v050-feature-guide-contract.test.ts index 3052a7ee..6c0ba00f 100644 --- a/tests/v050-feature-guide-contract.test.ts +++ b/tests/v050-feature-guide-contract.test.ts @@ -104,6 +104,9 @@ describe("Miftah 0.5 owner guide", () => { expect(guide).toContain("restart the MCP client"); expect(guide).toContain("External multi-account and returning-user validation was still open during 0.5"); expect(guide).toContain("later closed by maintainer attestation"); + expect(guide).toContain( + "underlying participant records are not published in this repository", + ); expect(guide).toContain("[#39]"); expect(guide).toContain("[#25]"); expect(guide).toContain("[#88]"); diff --git a/tests/v1-readiness-docs-contract.test.ts b/tests/v1-readiness-docs-contract.test.ts index 1e5fe247..a3cac2eb 100644 --- a/tests/v1-readiness-docs-contract.test.ts +++ b/tests/v1-readiness-docs-contract.test.ts @@ -23,6 +23,15 @@ describe("v1 readiness documentation contract", () => { expect(guide).toContain(`@lubab/miftah@${packageVersion}`); expect(guide).toContain("Evaluator baseline: `@lubab/miftah@0.5.8`"); + expect(guide).toContain( + `Stable release candidate: \`@lubab/miftah@${packageVersion}\``, + ); + expect(guide).toContain( + "The attested counters apply to the 0.5.8 baseline only", + ); + expect(guide).toContain( + "Complete linked records and accepted closure gates are required before replacing pending rows", + ); expect(guide).toContain("maintainer attestation"); expect(guide).toContain("not independently inspected"); expect(guide).toMatch(/issues? #25, #88, #202, and #290/i); @@ -62,6 +71,9 @@ describe("v1 readiness documentation contract", () => { expect(brief).toMatch(/no unresolved critical or high-severity finding/i); expect(brief).toContain("maintainer attestation"); expect(brief).toContain("not independently inspected"); + expect(brief).toContain( + "Maintainer attestation or deidentified records alone do not close the independent-review criterion in #39", + ); }); it("keeps status pages explicit about attested but uninspected external evidence", () => { @@ -74,6 +86,15 @@ describe("v1 readiness documentation contract", () => { expect(validation).toContain("Recorded returning external users: 3"); expect(validation).toContain("Recorded unaided README evaluators: 3"); expect(validation).toContain("not independently inspected"); + expect(validation).toContain( + "OAuth and Console are included in the `@lubab/miftah@1.0.0` release candidate", + ); + expect(validation).toContain( + "how maintainer-attested external evidence is recorded", + ); + expect(validation).not.toContain( + "OAuth and Console are included in the stable v1 release", + ); expect(threatModel).toContain( "[independent security review brief](independent-security-review.md)", ); From b4d942c207ac50fb9feb49b8290b08a806c8b74c Mon Sep 17 00:00:00 2001 From: mohammed naji Date: Tue, 11 Aug 2026 08:15:02 +0400 Subject: [PATCH 3/3] docs: bind attested counts to baseline --- docs/oauth-console-validation.md | 2 +- tests/readme-product-contract.test.ts | 2 +- tests/v1-readiness-docs-contract.test.ts | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/oauth-console-validation.md b/docs/oauth-console-validation.md index d76313ac..62cc411c 100644 --- a/docs/oauth-console-validation.md +++ b/docs/oauth-console-validation.md @@ -48,4 +48,4 @@ Snapshot date: 2026-08-11. Evaluator baseline: `@lubab/miftah@0.5.8`. Stable rel - Recorded returning external users: 3 - Recorded unaided README evaluators: 3 -These counts are a maintainer attestation recorded on [#39](https://github.com/mohanagy/miftah/issues/39), not independently inspected participant evidence. The private participant records and public deidentified row-level rollup were not supplied during release preparation, so this page does not infer provider coverage, dates, clients, operating systems, or participant-specific outcomes beyond the three counters above. The [v1 external evaluation](v1-evaluation.md) protocol remains the definition of a completed real workflow, later-session return, unaided participation, version pinning, and safe deidentified record. Never record credentials, OAuth codes, tokens, provider payloads, or personal account identifiers. +These counts are a maintainer attestation recorded on [#39](https://github.com/mohanagy/miftah/issues/39), not independently inspected participant evidence. The 5/3/3 attested counters apply only to the `@lubab/miftah@0.5.8` evaluator baseline, not to the 1.0.0 release candidate. The private participant records and public deidentified row-level rollup were not supplied during release preparation, so this page does not infer provider coverage, dates, clients, operating systems, or participant-specific outcomes beyond the three counters above. The [v1 external evaluation](v1-evaluation.md) protocol remains the definition of a completed real workflow, later-session return, unaided participation, version pinning, and safe deidentified record. Never record credentials, OAuth codes, tokens, provider payloads, or personal account identifiers. diff --git a/tests/readme-product-contract.test.ts b/tests/readme-product-contract.test.ts index 91e1c6be..a0fcdd11 100644 --- a/tests/readme-product-contract.test.ts +++ b/tests/readme-product-contract.test.ts @@ -64,7 +64,7 @@ describe("product README", () => { expect(firstScreen).toContain("stable v1 release line"); expect(firstScreen).toContain("closed by maintainer attestation"); expect(firstScreen).toContain( - "source participant records and completed security report are not published", + "source participant records and completed security report are not published in this repository", ); expect(firstScreen).toContain("[#39]"); expect(firstScreen).not.toContain("experimental and pre-1.0"); diff --git a/tests/v1-readiness-docs-contract.test.ts b/tests/v1-readiness-docs-contract.test.ts index a3cac2eb..40fd657f 100644 --- a/tests/v1-readiness-docs-contract.test.ts +++ b/tests/v1-readiness-docs-contract.test.ts @@ -85,6 +85,9 @@ describe("v1 readiness documentation contract", () => { expect(validation).toContain("Recorded completed external workflows: 5"); expect(validation).toContain("Recorded returning external users: 3"); expect(validation).toContain("Recorded unaided README evaluators: 3"); + expect(validation).toContain( + "The 5/3/3 attested counters apply only to the `@lubab/miftah@0.5.8` evaluator baseline, not to the 1.0.0 release candidate", + ); expect(validation).toContain("not independently inspected"); expect(validation).toContain( "OAuth and Console are included in the `@lubab/miftah@1.0.0` release candidate",