@softspark/confluence-mcp 1.14.3 → 1.14.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +564 -0
- package/README.md +6 -5
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@softspark/jira-mcp` are documented here.
|
|
4
|
+
|
|
5
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
|
+
Versioning follows [Semantic Versioning](https://semver.org/).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## v1.14.5 -- Build and packaging documented (2026-09-10)
|
|
11
|
+
|
|
12
|
+
No code change in either package. The one thing a consumer gets that 1.14.4 did
|
|
13
|
+
not give them is this changelog entry, since 1.14.4 is what made `CHANGELOG.md`
|
|
14
|
+
reach the tarball in the first place.
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- **`kb/reference/build-and-packaging.md`**, covering the two npm behaviours that
|
|
19
|
+
fail without an error message here and cost a release each. `ignore-scripts` in
|
|
20
|
+
`.npmrc` disables every lifecycle script, not only install hooks, so a
|
|
21
|
+
`prebuild`, `pretest` or `prepack` in package.json looks right and never runs;
|
|
22
|
+
both were confirmed by adding a hook and watching nothing happen. And a `files`
|
|
23
|
+
pattern is matched inside the package directory, with anything matching nothing
|
|
24
|
+
dropped silently, which is what hid the missing changelog through six releases.
|
|
25
|
+
|
|
26
|
+
## v1.14.4 -- The changelog actually ships (2026-09-09)
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **Both packages now contain the `CHANGELOG.md` their `files` list has promised
|
|
31
|
+
since 1.12.0.** npm resolves `files` patterns inside the package directory,
|
|
32
|
+
the changelog lives at the repository root, and a pattern matching nothing is
|
|
33
|
+
dropped without a warning. Every release since the workspace split shipped
|
|
34
|
+
without it, and the README version badge linked to a file the tarball did not
|
|
35
|
+
contain. A symlink does not help, because `npm pack` skips it; each package's
|
|
36
|
+
tsup config copies the root file in instead, so the root stays the one place
|
|
37
|
+
anybody edits.
|
|
38
|
+
- **Changelog links in both READMEs pointed outside the package.**
|
|
39
|
+
`../../CHANGELOG.md` resolves within the repository but not within a published
|
|
40
|
+
tarball, so on npmjs.com those links were dead for the same reason.
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
|
|
44
|
+
- **A packaging test over both published packages.** It asserts that every
|
|
45
|
+
`files` entry matches at least one real file, and that each package's copied
|
|
46
|
+
changelog is identical to the root one. The first catches a manifest promising
|
|
47
|
+
what it does not deliver; the second catches a release built before the
|
|
48
|
+
changelog was edited, which would ship stale history.
|
|
49
|
+
|
|
50
|
+
## v1.14.3 -- Knowledge base only (2026-09-09)
|
|
51
|
+
|
|
52
|
+
**Behaviourally identical to 1.14.2.** Everything below lives in `kb/`, which no
|
|
53
|
+
tarball carries, so upgrading from 1.14.2 gains nothing at runtime. The version
|
|
54
|
+
exists to give the documentation below a release to sit against.
|
|
55
|
+
|
|
56
|
+
Diffing the two published tarballs, what actually differs is the version and
|
|
57
|
+
nothing else: the `version` field in package.json, the version string tsup bakes
|
|
58
|
+
into `dist/cli.js` and `dist/index.js`, and the badge and "What's New" heading in
|
|
59
|
+
README. `templates-system/` and `hooks/` are byte-identical.
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
|
|
63
|
+
- **A troubleshooting entry for an npm 404 on a version that was just
|
|
64
|
+
published.** 1.14.2 was discoverable and uninstallable for about seven minutes:
|
|
65
|
+
`npm view` reported the version with a correct `fileCount`, `shasum`,
|
|
66
|
+
`integrity`, registry signature and SLSA provenance, `dist-tags.latest` already
|
|
67
|
+
pointed at it, and the tarball URL from that same metadata returned
|
|
68
|
+
`{"error":"Not found"}`. Both packages. It is CDN propagation, and the entry
|
|
69
|
+
says to poll rather than deprecate and re-release, which is the instinctive and
|
|
70
|
+
wrong response. It also records that a `curl` of the tarball returns a JSON
|
|
71
|
+
error body, which `tar` reports as `Unrecognized archive format`, looking like
|
|
72
|
+
a corrupt package when nothing is corrupt.
|
|
73
|
+
- **The executed record of the 1.14.0, 1.14.1 and 1.14.2 releases**, including
|
|
74
|
+
the post-release runs against KAN and the DevOps space.
|
|
75
|
+
|
|
76
|
+
### Fixed
|
|
77
|
+
|
|
78
|
+
- **Closed a stale note.** The 1.12.0/1.13.0 verification record still listed
|
|
79
|
+
localised comment templates as unstarted with no decision taken. They shipped
|
|
80
|
+
in 1.14.0, and by a different design than that note guessed at.
|
|
81
|
+
|
|
82
|
+
## v1.14.2 -- Drift guard on the Confluence help listing (2026-09-09)
|
|
83
|
+
|
|
84
|
+
No behaviour change in either package. It ships the guard that the 1.14.1 fix
|
|
85
|
+
left missing on the other half of the workspace.
|
|
86
|
+
|
|
87
|
+
### Added
|
|
88
|
+
|
|
89
|
+
- **A test that fails when `confluence-mcp --help` stops naming a registered
|
|
90
|
+
command.** The listing under "All commands" is a hand-written epilogue in
|
|
91
|
+
`packages/confluence-mcp/src/cli/program.ts`, the same construction that let
|
|
92
|
+
1.14.0 ship with two Jira commands missing from the help. The test walks the
|
|
93
|
+
registered command tree, renders the help through Commander and fails on
|
|
94
|
+
anything absent. Unlike the Jira one it needs no exclusion list: every command
|
|
95
|
+
the Confluence CLI registers is meant to be listed.
|
|
96
|
+
|
|
97
|
+
### Fixed
|
|
98
|
+
|
|
99
|
+
- **Corrected the Confluence tool count in the docs.** `CLAUDE.md` and the
|
|
100
|
+
package README said 30 while the server registers 31; the count went stale when
|
|
101
|
+
`list_page_templates` landed in 1.13.0.
|
|
102
|
+
|
|
103
|
+
## v1.14.1 -- Help text lists the new commands (2026-09-09)
|
|
104
|
+
|
|
105
|
+
### Fixed
|
|
106
|
+
|
|
107
|
+
- **`jira-mcp --help` did not list `template list-locales` or
|
|
108
|
+
`template install-locale`.** The command listing under "All commands" is
|
|
109
|
+
hand-written, so the two commands added in 1.14.0 were invisible to anyone
|
|
110
|
+
reading the help. A test now walks the registered command tree and fails when
|
|
111
|
+
the listing misses one, which is what should have caught this.
|
|
112
|
+
|
|
113
|
+
## v1.14.0 -- Translated comment templates (2026-09-09)
|
|
114
|
+
|
|
115
|
+
Both packages are released together under one version.
|
|
116
|
+
`@softspark/confluence-mcp` has no behaviour change in this release.
|
|
117
|
+
|
|
118
|
+
### Added
|
|
119
|
+
|
|
120
|
+
- **Translated comment templates** -- the package now ships Polish versions of all
|
|
121
|
+
eight built-in comment templates under `templates-system/locales/pl/comments/`,
|
|
122
|
+
installed with `jira-mcp template install-locale pl`. A template cannot pick a
|
|
123
|
+
language at render time, because its headings are fixed text in the body, so on
|
|
124
|
+
a project configured for another language `add_templated_comment` posted English
|
|
125
|
+
and broke the language-first rule.
|
|
126
|
+
- **`jira-mcp template list-locales`** -- lists the languages with shipped
|
|
127
|
+
translations.
|
|
128
|
+
- **`jira-mcp template install-locale <lang> [--keep-english]`** -- installs them as
|
|
129
|
+
overrides. Each translation keeps the English `id` and variable names of the
|
|
130
|
+
template it replaces, so nothing that calls `add_templated_comment` breaks.
|
|
131
|
+
`--keep-english` also installs the originals as `<id>-en`, for an install whose
|
|
132
|
+
projects are not all in one language.
|
|
133
|
+
|
|
134
|
+
### Fixed
|
|
135
|
+
|
|
136
|
+
- **Documented that the template catalog is read once, at server startup.**
|
|
137
|
+
`template add` and `install-locale` change what the CLI reports immediately, but
|
|
138
|
+
a running MCP server keeps serving the catalog it loaded, and the next templated
|
|
139
|
+
comment silently renders the old version. Both commands now say to restart the
|
|
140
|
+
client, and it is stated in the rules and the templates reference.
|
|
141
|
+
|
|
142
|
+
## v1.13.0 -- Page templates and real space keys (2026-09-09)
|
|
143
|
+
|
|
144
|
+
Both packages are released together under one version. `@softspark/jira-mcp` has
|
|
145
|
+
no behaviour change in this release; it ships because the shared template engine
|
|
146
|
+
moved into the package both servers bundle.
|
|
147
|
+
|
|
148
|
+
### Added
|
|
149
|
+
|
|
150
|
+
- **Confluence page templates** -- `list_page_templates` lists what is usable in a
|
|
151
|
+
space, filtered to its body format, and `create_page` accepts `template_id` plus
|
|
152
|
+
`variables`. Three ship with the package: `runbook` and `incident-review` in
|
|
153
|
+
markdown, `decision-record` in storage using Confluence status and info macros.
|
|
154
|
+
User templates in `~/.softspark/jira-mcp/templates/pages/*.md` override a shipped
|
|
155
|
+
one by id; a malformed file is skipped rather than breaking startup.
|
|
156
|
+
- **`rules/confluence-mcp.md`** -- agent rules for the Confluence server, registrable
|
|
157
|
+
with `ai-toolkit add-rule`, matching how `rules/jira-mcp.md` works.
|
|
158
|
+
|
|
159
|
+
### Changed
|
|
160
|
+
|
|
161
|
+
- **`renderTemplate` moved to the shared core package** -- the `{{variable}}` engine is
|
|
162
|
+
plain text substitution and is now used by Jira comment and task templates and by
|
|
163
|
+
Confluence page templates alike.
|
|
164
|
+
|
|
165
|
+
### Fixed
|
|
166
|
+
|
|
167
|
+
- **Confluence space keys are no longer forced to uppercase** -- the validator applied
|
|
168
|
+
Jira's project-key rule, which rejected real spaces: Confluence keeps the case a
|
|
169
|
+
space was created with (`DevOps`, `Puccini`, `MTPapp`) and personal space keys start
|
|
170
|
+
with `~`. Every one of those was rejected by `space add`.
|
|
171
|
+
|
|
172
|
+
## v1.12.0 -- Confluence support, split into two packages (2026-09-09)
|
|
173
|
+
|
|
174
|
+
This release turns the repository into an npm workspace. `@softspark/jira-mcp`
|
|
175
|
+
keeps its name, contents and CLI; Confluence ships as its own package. Both are
|
|
176
|
+
released together under one version.
|
|
177
|
+
|
|
178
|
+
### Added
|
|
179
|
+
|
|
180
|
+
- **`@softspark/confluence-mcp`** -- a second published package and stdio MCP server
|
|
181
|
+
covering Confluence Cloud. It reads the same `config.json` and `credentials.json`
|
|
182
|
+
as the Jira server, because one Atlassian site serves both products from the same
|
|
183
|
+
host with the same API token. The tool lists stay separate: merging them would put
|
|
184
|
+
`search_tasks` beside `search_pages` and `get_task_details` beside `get_page`, and
|
|
185
|
+
near-homonyms in one list make tool selection worse. A workspace test asserts the
|
|
186
|
+
two lists never share a name.
|
|
187
|
+
- **`@softspark/atlassian-mcp-core`** -- private, unpublished workspace package holding
|
|
188
|
+
the configuration loader, ADF conversion, HTTP transport, error hierarchy and MCP
|
|
189
|
+
response envelope. Both servers bundle it at build time, so it never reaches a
|
|
190
|
+
consumer as a separate dependency.
|
|
191
|
+
- **Per-space body format** -- `format: "markdown" | "storage"` on a space in config.json,
|
|
192
|
+
with `default_format` as the global fallback and
|
|
193
|
+
`confluence-mcp space set-format <KEY> <format>` to set it. A `storage` space reads and
|
|
194
|
+
writes Confluence XHTML and refuses markdown writes; a `markdown` space accepts both,
|
|
195
|
+
because storage never loses anything. `get_space_language` reports the format alongside
|
|
196
|
+
the language, and `list_spaces` reports it per configured space.
|
|
197
|
+
- **Storage-format support for Confluence pages** -- `get_page` accepts
|
|
198
|
+
`body_format: "storage"` and reports `has_storage_markup`; `create_page` and
|
|
199
|
+
`update_page` accept a `storage` body. Confluence stores macros, page links and
|
|
200
|
+
attachment references as XHTML that markdown cannot express, and a markdown round-trip
|
|
201
|
+
would keep the prose and silently delete the rest.
|
|
202
|
+
- **`spaces` section in config.json** -- maps a Confluence space key to a site URL and
|
|
203
|
+
an optional content language, mirroring how `projects` maps Jira. Both keys are
|
|
204
|
+
optional, so a config written before this release still validates.
|
|
205
|
+
- **`confluence-mcp space` commands** -- `add`, `remove`, `list`, `set-default`,
|
|
206
|
+
`set-language`, `set-format`. Credentials stay on `jira-mcp config set-credentials`.
|
|
207
|
+
- **Pages** -- `search_pages` (plain text or raw CQL), `get_page`, `list_space_pages`,
|
|
208
|
+
`get_page_children`, `create_page`, `update_page`, `move_page`, `delete_page`.
|
|
209
|
+
- **Comments** -- `get_page_comments`, `add_page_comment`, `delete_page_comment`,
|
|
210
|
+
plus `get_page_inline_comments` and `add_page_inline_comment` for anchored review
|
|
211
|
+
threads. An inline comment verifies its anchor text exists in the page before
|
|
212
|
+
writing, because a wrong occurrence count silently anchors to the wrong passage.
|
|
213
|
+
- **Blog posts** -- `list_blog_posts`, `get_blog_post`, `create_blog_post`,
|
|
214
|
+
`update_blog_post`, `delete_blog_post`.
|
|
215
|
+
- **Restrictions** -- `get_page_restrictions` and `set_page_restrictions`. Reads report
|
|
216
|
+
`inherits_space_permissions` so an empty result is not misread as "nobody has
|
|
217
|
+
access". Writes replace rather than merge and require `user_approved`, because
|
|
218
|
+
clearing restrictions exposes a page that was deliberately private.
|
|
219
|
+
- **Whiteboards** -- `get_whiteboard`, `create_whiteboard`, `delete_whiteboard`.
|
|
220
|
+
Metadata only: whiteboard drawing content has no REST representation, and the tool
|
|
221
|
+
descriptions and results say so.
|
|
222
|
+
- **Labels and attachments** -- `get_page_labels`, `add_page_labels`,
|
|
223
|
+
`remove_page_label`, `list_attachments`, `upload_attachment` (25 MB cap).
|
|
224
|
+
- **Confluence error classes** -- `ConfluenceConnectionError`,
|
|
225
|
+
`ConfluenceAuthenticationError`, `ConfluencePermissionError`, `PageNotFoundError`,
|
|
226
|
+
`VersionConflictError` and `MarkupLossError`, each with its own code.
|
|
227
|
+
|
|
228
|
+
### Changed
|
|
229
|
+
|
|
230
|
+
- **Repository is an npm workspace** -- sources moved to `packages/core`,
|
|
231
|
+
`packages/jira-mcp` and `packages/confluence-mcp`. Typecheck, lint, tests and
|
|
232
|
+
coverage run once across all three; each published package builds its own bundle.
|
|
233
|
+
Nothing changes for consumers of `@softspark/jira-mcp`: same name, same binary,
|
|
234
|
+
same config path.
|
|
235
|
+
- **Shared HTTP transport** -- auth, retry, exponential backoff, `Retry-After` and
|
|
236
|
+
empty-body handling now live in one client used by both products. Connectors inject
|
|
237
|
+
only a status-to-error mapper, removing a duplicated fetch loop.
|
|
238
|
+
- **`update_page` no longer rewrites a body it was not asked to change** -- a
|
|
239
|
+
title-only rename or a re-parent writes the existing body back verbatim instead of
|
|
240
|
+
round-tripping it through markdown.
|
|
241
|
+
- **`update_page` refuses a markdown body that would destroy markup** -- when the page
|
|
242
|
+
contains Confluence macros, page links or attachment references, the call fails with
|
|
243
|
+
`MARKUP_LOSS_REFUSED` and says to send `storage` instead. `allow_markup_loss: true`
|
|
244
|
+
overrides it after the user agrees.
|
|
245
|
+
|
|
246
|
+
### Fixed
|
|
247
|
+
|
|
248
|
+
- **`config add-project` and `config remove-project` no longer drop config fields** --
|
|
249
|
+
both rebuilt config.json from the fields they knew about, which already discarded
|
|
250
|
+
`default_language` and would have deleted the entire Confluence `spaces` section.
|
|
251
|
+
Both now spread the loaded object.
|
|
252
|
+
- **Confluence links resolve against the `/wiki` context path** -- page, search-result
|
|
253
|
+
and attachment URLs are returned relative to `/wiki`, and resolving them against the
|
|
254
|
+
site origin dropped that segment and produced links that 404.
|
|
255
|
+
|
|
256
|
+
## v1.11.0 -- Local audits and private configuration (2026-09-06)
|
|
257
|
+
|
|
258
|
+
- Add text, JSON and SARIF audits for local filesystem permissions and shipped hook ownership.
|
|
259
|
+
- Create new configuration/cache directories with mode 0700 and state files with mode 0600.
|
|
260
|
+
- Complete third-party attribution in NOTICE and require the full applicable module and SOP artifact set in CI.
|
|
261
|
+
- Require behavior, tests and documentation in the same pull request; correct the lockfile-based signature verification procedure.
|
|
262
|
+
|
|
263
|
+
## v1.10.0 -- Remaining Estimate (2026-09-01)
|
|
264
|
+
|
|
265
|
+
### Added
|
|
266
|
+
|
|
267
|
+
- **`remaining_estimate` in `update_task`** -- writes `timetracking.remainingEstimate`.
|
|
268
|
+
Jira keeps the two estimates independent: setting `original_estimate` on a parent
|
|
269
|
+
issue leaves its remaining estimate at the old value, so a report that sums
|
|
270
|
+
remaining still showed the pre-edit total. Setting one field does not disturb
|
|
271
|
+
the other, and both can be sent in a single call. Same format and day rejection
|
|
272
|
+
as `original_estimate`.
|
|
273
|
+
|
|
274
|
+
## v1.9.0 -- Sub-tasks and Estimates (2026-09-01)
|
|
275
|
+
|
|
276
|
+
### Added
|
|
277
|
+
|
|
278
|
+
- **`parent_key` in `create_task`** -- sets the Jira `parent` field so sub-tasks can be
|
|
279
|
+
created at all. `epic_key` resolves the Epic Link custom field, which is a different
|
|
280
|
+
field, so passing it for a sub-task made Jira answer with
|
|
281
|
+
`Issue type is a sub-task but parent issue key or id not specified`.
|
|
282
|
+
- **`original_estimate` in `create_task` and `update_task`** -- writes
|
|
283
|
+
`timetracking.originalEstimate`. Estimates could only be set by hand in the Jira UI
|
|
284
|
+
before; `log_task_time` logs work already done, which is a different field.
|
|
285
|
+
Accepts the same `"2h"` / `"30m"` / `"2h 30m"` format as `log_task_time` and rejects
|
|
286
|
+
days through the same parser.
|
|
287
|
+
|
|
288
|
+
## v1.8.1 -- Duplicate Detection (2026-08-03)
|
|
289
|
+
|
|
290
|
+
### Fixed
|
|
291
|
+
|
|
292
|
+
- **Duplicate detection never matched anything.** `findExistingTask` searched with
|
|
293
|
+
`summary = "..."`, but `summary` is a text field and JQL only supports `~` on it.
|
|
294
|
+
Jira answers `=` with an empty result set instead of an error, so every lookup
|
|
295
|
+
reported "not found": `update_existing` never updated, and re-running a bulk config
|
|
296
|
+
created a second copy of every task. The lookup now uses a quoted `~` phrase and
|
|
297
|
+
compares the returned summary exactly, since `~` is a fuzzy match. Found by running
|
|
298
|
+
a config twice against a live instance and getting a duplicate issue.
|
|
299
|
+
|
|
300
|
+
## v1.8.0 -- Status Paths (2026-08-03)
|
|
301
|
+
|
|
302
|
+
### Added
|
|
303
|
+
|
|
304
|
+
- **`status` accepts an ordered path** in bulk task configs -- `"status": ["On hold", "Open"]`
|
|
305
|
+
walks the transitions one at a time. Jira only exposes the transitions available from an
|
|
306
|
+
issue's *current* status, so a target that is not directly reachable from the initial
|
|
307
|
+
status could not be set at all before. A plain string still means a single transition.
|
|
308
|
+
- **`warnings` in `create_monthly_tasks` output** -- per-task problems that did not stop the
|
|
309
|
+
issue from being written now surface in the tool response instead of being dropped by the
|
|
310
|
+
counters-only summary.
|
|
311
|
+
|
|
312
|
+
### Fixed
|
|
313
|
+
|
|
314
|
+
- **A rejected status transition is no longer silent.** `setStatus` swallowed every failure,
|
|
315
|
+
including the ordinary case of the requested status simply not being reachable: the issue
|
|
316
|
+
was created, the status was ignored, and the run reported `failed: 0`. Eleven monthly admin
|
|
317
|
+
tasks sat in the wrong status for months because of this. The transition is now reported as
|
|
318
|
+
a `warning` on the task result, naming the status that failed and listing the ones that were
|
|
319
|
+
reachable at that point. The issue itself is still created -- the transition stays non-fatal.
|
|
320
|
+
|
|
321
|
+
### Changed
|
|
322
|
+
|
|
323
|
+
- **`TaskResult` gains a `warning` field** (`string | null`). `formatBulkResult` prints it
|
|
324
|
+
indented under the task line. Consumers destructuring `TaskResult` are unaffected; anyone
|
|
325
|
+
constructing one now has to supply the field.
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
### Changed -- licence: MIT to Apache-2.0
|
|
330
|
+
|
|
331
|
+
The project is now licensed under the Apache License 2.0. It stays permissive:
|
|
332
|
+
fork it, modify it, ship it commercially. What changes is what a redistributor
|
|
333
|
+
owes back.
|
|
334
|
+
|
|
335
|
+
- **`NOTICE` is the point.** MIT already required keeping the copyright notice, so
|
|
336
|
+
attribution is not new. Apache-2.0 adds section 4(d): a redistributor must carry
|
|
337
|
+
the contents of `NOTICE` -- project name, copyright, source URL -- into their
|
|
338
|
+
distribution. `NOTICE` is in `package.json` `files`, so it ships with the package.
|
|
339
|
+
- **Modified files must say so** (section 4b), an express patent grant with
|
|
340
|
+
retaliation (section 3), and no rights to the project or company names
|
|
341
|
+
(section 6). None of these existed under MIT.
|
|
342
|
+
- **Attribution reaches the published bundles through a build banner.** This is
|
|
343
|
+
the part specific to this package: npm ships `dist/`, not `src/`, and the build
|
|
344
|
+
runs with `minify: true`, which strips every comment. SPDX headers in `src/`
|
|
345
|
+
are for whoever clones the repository; consumers see the tsup `banner`, now
|
|
346
|
+
present in both `dist/index.js` and `dist/cli.js`.
|
|
347
|
+
- **SPDX headers on 165 source files**, placed after any shebang.
|
|
348
|
+
- **Nothing is revoked.** Releases up to and including v1.6.0 were published under
|
|
349
|
+
MIT and remain available under MIT. All contributions were made by the
|
|
350
|
+
copyright holder, so no third-party permission was required.
|
|
351
|
+
|
|
352
|
+
`LICENSE` holds the verbatim Apache-2.0 text, cross-verified against two
|
|
353
|
+
independent published copies before being written.
|
|
354
|
+
|
|
355
|
+
### Tests
|
|
356
|
+
|
|
357
|
+
- `tests/licensing.test.ts`, 8 assertions run by `npm test`: SPDX headers present
|
|
358
|
+
and naming Apache-2.0, `LICENSE` complete, `NOTICE` carrying attribution and
|
|
359
|
+
section 4(d), both files in `package.json` `files`, `package.json` declaring
|
|
360
|
+
Apache-2.0, and **both build entries carrying the licence banner**. The banner
|
|
361
|
+
assertion exists because losing it would strip attribution from the published
|
|
362
|
+
artifact while every other check stayed green.
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## v1.6.0 -- ADF Nested Lists, Task Lists & Doc-Parity Gates (2026-06-10)
|
|
367
|
+
|
|
368
|
+
### Added
|
|
369
|
+
- **Nested list support in ADF conversion** -- indented markdown lists (2 spaces or tab) now produce properly nested `bulletList`/`orderedList` ADF nodes instead of being flattened, in both write and read directions. Read direction renders nesting with 2-space indentation.
|
|
370
|
+
- **Task list (checkbox) support** -- `- [ ]` / `- [x]` markdown converts to ADF `taskList`/`taskItem` nodes (Jira checkboxes) with document-unique `localId`s, and renders back to markdown checkboxes including nesting. Nested bullet/ordered lists under a task item are lifted to siblings after the task list to keep the ADF valid.
|
|
371
|
+
- **Image degradation** -- `` markdown converts to a link (alt text as label, URL as fallback) instead of leaking a stray `!` into the text. ADF media nodes require uploaded attachments, so a link is the lossless-enough fallback.
|
|
372
|
+
- **`date` node rendering on read** -- ADF date nodes now render as `YYYY-MM-DD` instead of disappearing from task descriptions and comments.
|
|
373
|
+
- **Doc-parity checks in `validate_counts.py`** -- the validator now also verifies the README version badge against `package.json`, and that every MCP tool from `definitions.ts` is documented in `kb/reference/api.md` and named in `rules/jira-mcp.md`.
|
|
374
|
+
|
|
375
|
+
### Changed
|
|
376
|
+
- **CI enforces the coverage gate** -- the test job runs `npm run test:coverage`, so the 70% thresholds (lines, branches, functions) actually block merges. Branch coverage raised from 64.5% to above the threshold with new CLI and ADF edge-case tests.
|
|
377
|
+
|
|
378
|
+
### Fixed
|
|
379
|
+
- **README version badge drift** (1.4.3 -> 1.5.0) and stale test counts.
|
|
380
|
+
- **`kb/reference/api.md`** now documents `search_tasks`, `delete_task`, and `delete_comment`, which were missing despite the "complete reference" claim.
|
|
381
|
+
- **`rules/jira-mcp.md` / `AGENTS.md`** tool list extended to all 19 tools (was 17) and the CLI table extended to all 20 commands (was 14).
|
|
382
|
+
- **Dev dependency vulnerabilities** -- `npm audit fix` applied (7 advisories: fast-uri, brace-expansion, hono, ip-address chains). Runtime dependencies were and remain clean.
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## v1.5.0 -- Bulk Template Management & Monthly Tasks Tool (2026-05-04)
|
|
387
|
+
|
|
388
|
+
### Added
|
|
389
|
+
- **`template add bulk` CLI command** -- new third template kind alongside `comment` and `task`. Validates the source JSON against `BulkConfigSchema` and installs it under `~/.softspark/jira-mcp/templates/tasks/<KEY>/monthly_admin.json`. `template list/show/remove` also support the `bulk` kind, keyed by project. Prunes the empty project subdirectory on remove.
|
|
390
|
+
- **`create_monthly_tasks` MCP tool** -- exposes the existing `create-monthly` CLI handler over the protocol. Inputs: `{ execute?: boolean, project?: string }`. Returns a structured result with per-project status (success/error), summary counts, and the resolved config path. Lets MCP clients run monthly bulk task creation without dropping to the CLI.
|
|
391
|
+
|
|
392
|
+
## v1.4.3 -- JQL Escape & Cache Recovery (2026-04-18)
|
|
393
|
+
|
|
394
|
+
### Fixed
|
|
395
|
+
- **`sync_tasks` default JQL parse error** -- `escapeJql` was over-escaping JQL operators (`-`, `+`, `&`, `|`, etc.) inside double-quoted string literals. Jira rejected the resulting query with `'\-' jest niedozwoloną sekwencją modyfikacji JQL`. The escape now only handles `\` and `"` (the only sequences valid inside a quoted JQL string), so `sync_tasks` works without an explicit `jql` argument when the username contains a hyphen.
|
|
396
|
+
- **`reassign_task` / `update_task_status` cache miss after Jira mutation** -- both operations now recover from a cache miss by fetching the task from Jira via `connector.getIssue` and upserting it into the local cache. Previously, calling either tool right after `create_task` (cache not populated) or `log_task_time` (cache invalidated) failed with `TASK_NOT_FOUND` even though the Jira mutation succeeded.
|
|
397
|
+
|
|
398
|
+
### Added
|
|
399
|
+
- **`CacheManager.upsertTask(task)`** -- inserts a task or replaces it by key, tolerating a missing cache file. Used by the new mutation-recovery path.
|
|
400
|
+
|
|
401
|
+
## v1.4.2 -- Supply-Chain Hardening (2026-04-18)
|
|
402
|
+
|
|
403
|
+
### Added
|
|
404
|
+
- **npm provenance attestation** -- `publish.yml` now publishes with `--provenance` and `id-token: write`, producing a SLSA v1 attestation on every release. Consumers can verify via `npm audit signatures` or the Provenance badge on npmjs.com.
|
|
405
|
+
- **Supply-chain gates in release SOP** -- `kb/procedures/sop-release.md` adds a pre-tag check for `--provenance` and `id-token: write` in `publish.yml`, plus a post-publish step that asserts `predicateType == https://slsa.dev/provenance/v1`.
|
|
406
|
+
- **Provenance verification in post-release SOP** -- `kb/procedures/sop-post-release-testing.md` adds Phase 5 covering the SLSA attestation check, `npm audit signatures`, and the npmjs.com Provenance badge.
|
|
407
|
+
- **Version-sync step in pre-commit SOP** -- `kb/procedures/sop-pre-commit.md` adds Step 6 verifying `package.json` and `package-lock.json` agree on the `version` field.
|
|
408
|
+
|
|
409
|
+
### Changed
|
|
410
|
+
- **Release workflow permissions** -- `packages: write` and `id-token: write` added to `.github/workflows/publish.yml` for OIDC attestation.
|
|
411
|
+
- **Release commit now stages the lockfile** -- SOP Phase 5 stages `package.json`, `package-lock.json`, `CHANGELOG.md`, and `README.md`. Prevents lockfile drift between tags.
|
|
412
|
+
|
|
413
|
+
### Fixed
|
|
414
|
+
- **`package-lock.json` top-level version drift** -- lockfile root `version` was stuck at `1.0.0` across prior releases. Regenerated via `npm install --package-lock-only` and now matches `package.json` on every release commit.
|
|
415
|
+
|
|
416
|
+
## v1.4.1 -- Template Loading Fix (2026-04-15)
|
|
417
|
+
|
|
418
|
+
### Fixed
|
|
419
|
+
- **File-backed templates missing after install** -- `PACKAGE_ROOT_DIR` used a hardcoded `../..` relative depth that resolved correctly in the source layout but overshot by one level after tsup bundling. Replaced with `findPackageRoot()` that walks up looking for `package.json`. All 8 built-in comment templates now load correctly from global installs.
|
|
420
|
+
|
|
421
|
+
## v1.4.0 -- Delete Tools & Error Hardening (2026-04-15)
|
|
422
|
+
|
|
423
|
+
### Added
|
|
424
|
+
- **`delete_task` tool** -- delete a Jira issue with ownership enforcement (creator only) and explicit user approval guard.
|
|
425
|
+
- **`delete_comment` tool** -- delete a comment with ownership enforcement (author only) and explicit user approval guard.
|
|
426
|
+
- **Markdown table support in ADF** -- `markdownToAdf()` now converts markdown tables to ADF table nodes.
|
|
427
|
+
|
|
428
|
+
### Changed
|
|
429
|
+
- **Narrowed cache cleanup catch blocks** -- `deleteTask()` and `logTime()` now catch only `TaskNotFoundError` and `CacheNotFoundError` instead of swallowing all exceptions. Unexpected I/O or corruption errors propagate.
|
|
430
|
+
|
|
431
|
+
### Fixed
|
|
432
|
+
- **Silent cache errors** -- cache I/O failures during post-delete and post-worklog cleanup were silently ignored, leaving stale entries without any signal.
|
|
433
|
+
|
|
434
|
+
## v1.3.0 -- File-Backed Templates & Approval Hooks (2026-04-15)
|
|
435
|
+
|
|
436
|
+
### Added
|
|
437
|
+
- **File-backed template catalog** -- ship built-in comment and single-task templates as physical markdown files under `templates-system/`.
|
|
438
|
+
- **Template management CLI** -- add `jira-mcp template add/list/show/remove` for global user overrides in `~/.softspark/jira-mcp/templates/`.
|
|
439
|
+
- **Task templates for `create_task`** -- add `list_task_templates` and template-based issue creation with variable rendering.
|
|
440
|
+
- **Comment approval hook manifest** -- ship `hooks/jira-mcp-hooks.json` for ai-toolkit `inject-hook` flows that preview and gate Jira comment writes.
|
|
441
|
+
|
|
442
|
+
### Changed
|
|
443
|
+
- **Template loading model** -- resolve active templates from system files plus global user overrides, with user files winning on `id` collisions.
|
|
444
|
+
- **Configuration init** -- create dedicated template directories for comments, single-task templates, and bulk task configs.
|
|
445
|
+
- **README validation** -- exclude internal tool helpers from MCP tool counts and refresh counts to match the current source tree.
|
|
446
|
+
|
|
447
|
+
### Fixed
|
|
448
|
+
- **Comment write safety** -- require explicit `user_approved=true` before `add_task_comment` and `add_templated_comment` can mutate Jira.
|
|
449
|
+
- **Comment preview flow** -- render templated comment previews before execution so approval can target the exact outgoing markdown.
|
|
450
|
+
|
|
451
|
+
## v1.2.0 -- Per-Instance Credentials & Jira API Migration (2026-04-14)
|
|
452
|
+
|
|
453
|
+
### Added
|
|
454
|
+
- **Per-instance credentials** -- `set-credentials --url` flag allows different API tokens per Jira instance. Auto-migrates legacy Format A to Format B on first use.
|
|
455
|
+
- **Live Jira API smoke tests** -- post-release SOP now includes Phase 4 with 15 steps testing all MCP tools against the KAN sandbox project.
|
|
456
|
+
- **`validate_counts.py` in pre-commit SOP** -- added as Step 5 to catch README count drift before commit.
|
|
457
|
+
|
|
458
|
+
### Changed
|
|
459
|
+
- **Search endpoint migrated** -- `/rest/api/3/search` → `/rest/api/3/search/jql` (Jira Cloud deprecated the old endpoint with HTTP 410).
|
|
460
|
+
- **`set-credentials` CLI** -- read-modify-write instead of overwrite. Preserves existing credentials when adding instance overrides.
|
|
461
|
+
|
|
462
|
+
### Fixed
|
|
463
|
+
- **Jira Cloud 410 on sync/search** -- `sync_tasks` and `search_tasks` failed on instances where Jira had removed the legacy search endpoint.
|
|
464
|
+
|
|
465
|
+
---
|
|
466
|
+
|
|
467
|
+
## v1.1.0 -- Hardening & Market Readiness (2026-04-14)
|
|
468
|
+
|
|
469
|
+
### Added
|
|
470
|
+
- **Boundary test suite** -- 96 new tests covering `server.ts` (25), `cli/index.ts` (27), and `JiraConnector` (44). Total: 509 tests across 51 files.
|
|
471
|
+
- **Retry/backoff for transient failures** -- `JiraConnector` retries 429 and 503 responses up to 3 times with exponential backoff (1s/2s/4s). Respects `Retry-After` header.
|
|
472
|
+
- **Count validation script** -- `scripts/validate_counts.py` verifies README counts match source code. Enforced in CI via `validate-counts` job.
|
|
473
|
+
- **Count validation in CI** -- new `validate-counts` job in `ci.yml` catches README drift before merge.
|
|
474
|
+
- **ADR-0001** -- documented "hardening before refactor" decision with alternatives and guardrails.
|
|
475
|
+
- **Hardening plan** -- full plan with success criteria and pre-mortem in `kb/planning/`.
|
|
476
|
+
|
|
477
|
+
### Changed
|
|
478
|
+
- **server.ts refactored** -- 719 → 324 lines (-55%). Tool definitions extracted to `src/tools/definitions.ts`, argument helpers to `src/tools/args.ts`.
|
|
479
|
+
- **Major dependency upgrades** -- TypeScript 5 → 6, ESLint 9 → 10, zod 3 → 4, vitest 3 → 4, @types/node 22 → 25.
|
|
480
|
+
- **TypeScript 6 migration** -- added `types: ["node"]` and `ignoreDeprecations: "6.0"` to tsconfig.
|
|
481
|
+
- **zod 4 migration** -- `.default({})` replaced with factory function in `BulkOptionsSchema`.
|
|
482
|
+
- **vitest 4 migration** -- arrow function mocks replaced with regular function syntax for constructor compatibility.
|
|
483
|
+
- **Bundle size** -- 325KB → 520KB (due to zod 4, which is significantly larger).
|
|
484
|
+
- **README** -- "Zero runtime dependencies" corrected to "Minimal runtime dependencies". Test counts updated.
|
|
485
|
+
- **CONTRIBUTING.md** -- full CI workflow documented, `validate:counts` noted as maintainer-managed.
|
|
486
|
+
- **Coverage exclusions reduced** -- `server.ts` and `jira-connector.ts` removed from vitest exclusion list.
|
|
487
|
+
|
|
488
|
+
### Security
|
|
489
|
+
- **Cache file permissions** -- all cache writes use `mode: 0o600` (owner-only). Prevents local privilege escalation on shared machines.
|
|
490
|
+
- **CWD config loading warning** -- stderr warning when `config.json` or `credentials.json` loaded from working directory instead of global config.
|
|
491
|
+
- **Error message truncation** -- Jira API error responses truncated to 200 characters to prevent information leakage.
|
|
492
|
+
- **`saveJsonFile` JSDoc** -- `@security` annotation warns against use for sensitive data.
|
|
493
|
+
|
|
494
|
+
### Documentation
|
|
495
|
+
- **Hardcoded counts removed** from secondary docs (CLAUDE.md, kb/, rules/, copilot-instructions). Counts live only in README (single source of truth pattern from ai-toolkit).
|
|
496
|
+
- **KB docs updated** -- caching.md, architecture.md, configuration.md, troubleshooting/common-issues.md reflect security changes.
|
|
497
|
+
- **Release SOP updated** -- Step 4.5 (validate counts) and Step 3.2 (README "What's New" update) added.
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## v1.0.0 -- Initial Public Release (2026-04-14)
|
|
502
|
+
|
|
503
|
+
### MCP Tools (15)
|
|
504
|
+
|
|
505
|
+
- **`sync_tasks`** -- sync Jira tasks to local cache with optional JQL filter
|
|
506
|
+
- **`read_cached_tasks`** -- read tasks from local cache without hitting Jira
|
|
507
|
+
- **`update_task_status`** -- change task status via workflow transition
|
|
508
|
+
- **`update_task`** -- update existing issue fields (summary, description, priority, labels) with ADF conversion
|
|
509
|
+
- **`add_task_comment`** -- add markdown comment (auto-converted to ADF)
|
|
510
|
+
- **`reassign_task`** -- reassign or unassign a task by email
|
|
511
|
+
- **`get_task_statuses`** -- get valid workflow transitions for a task
|
|
512
|
+
- **`get_task_details`** -- get full details with description, comments, and project language
|
|
513
|
+
- **`get_project_language`** -- get configured language for a project (for AI assistants)
|
|
514
|
+
- **`log_task_time`** -- log work time in `"2h 30m"` format
|
|
515
|
+
- **`get_task_time_tracking`** -- get time tracking info (estimate, spent, remaining)
|
|
516
|
+
- **`list_comment_templates`** -- list available comment templates by category
|
|
517
|
+
- **`add_templated_comment`** -- add comment using a template with variable interpolation
|
|
518
|
+
- **`create_task`** -- create a new Jira issue with ADF description, assignee, labels, epic link
|
|
519
|
+
- **`search_tasks`** -- search Jira issues with raw JQL (no caching)
|
|
520
|
+
|
|
521
|
+
### CLI Commands (16)
|
|
522
|
+
|
|
523
|
+
- **`jira-mcp`** / **`jira-mcp serve`** -- start MCP server (stdio transport)
|
|
524
|
+
- **`jira-mcp config init`** -- initialize global config at `~/.softspark/jira-mcp/`
|
|
525
|
+
- **`jira-mcp config add-project <key> <url>`** -- add a Jira project mapping
|
|
526
|
+
- **`jira-mcp config remove-project <key>`** -- remove a project
|
|
527
|
+
- **`jira-mcp config list-projects`** -- show configured projects with language column
|
|
528
|
+
- **`jira-mcp config set-credentials`** -- set API credentials
|
|
529
|
+
- **`jira-mcp config set-default <key>`** -- set default project
|
|
530
|
+
- **`jira-mcp config set-language <lang>`** -- set global default language
|
|
531
|
+
- **`jira-mcp config set-project-language <key> <lang>`** -- set language for a specific project
|
|
532
|
+
- **`jira-mcp create <path>`** -- create tasks from bulk config file (dry-run by default)
|
|
533
|
+
- **`jira-mcp create-monthly`** -- run monthly admin task templates
|
|
534
|
+
- **`jira-mcp cache sync-workflows`** -- sync workflow status transitions
|
|
535
|
+
- **`jira-mcp cache sync-users`** -- sync user list for reassignment
|
|
536
|
+
- **`jira-mcp cache list-workflows`** -- show cached workflows
|
|
537
|
+
- **`jira-mcp cache list-users`** -- show cached users
|
|
538
|
+
|
|
539
|
+
### Features
|
|
540
|
+
|
|
541
|
+
- **Multi-instance routing** -- single server manages multiple Jira Cloud/Server instances. Project key determines routing. Connectors deduplicated by URL via InstancePool.
|
|
542
|
+
- **Language configuration** -- global `default_language` with per-project override. Supports: pl, en, de, es, fr, pt, it, nl. AI assistants check language before writing content.
|
|
543
|
+
- **ADF round-trip** -- bidirectional Markdown ↔ Atlassian Document Format conversion. Zero-dependency built-in parsers (~330 lines each). Literal `\n` normalization for MCP tool parameters.
|
|
544
|
+
- **Local caching** -- tasks synced to `~/.softspark/jira-mcp/cache/` with atomic writes. Workflow and user caches for offline status validation and assignee resolution.
|
|
545
|
+
- **Comment templates** -- 8 built-in templates with `{{variable}}` interpolation and `{{#var}}...{{/var}}` conditional blocks.
|
|
546
|
+
- **Bulk task creation** -- JSON config templates with dry-run default, rate limiting, epic link discovery, bilingual support (8 languages), idempotent updates.
|
|
547
|
+
- **Per-instance credentials** -- Format A (single credential) and Format B (per-URL credentials with default fallback). Backward compatible.
|
|
548
|
+
- **Supply chain protection** -- `ignore-scripts=true`, no axios, no dynamic requires. Self-contained 325KB bundle, 1 runtime dep (commander).
|
|
549
|
+
- **Strict TypeScript** -- `strict: true`, no `any`, `readonly` interfaces, Zod validation at all boundaries. 413 tests across 47 test files.
|
|
550
|
+
- **Typed error hierarchy** -- 15 error classes with machine-readable codes. Structured `{ success, error, code }` responses.
|
|
551
|
+
|
|
552
|
+
### Architecture
|
|
553
|
+
|
|
554
|
+
Four layers -- each depends only on layers below:
|
|
555
|
+
|
|
556
|
+
1. **Types & Config** (`config/`, `errors/`, `*/types.ts`) -- pure data, zero runtime deps
|
|
557
|
+
2. **Infrastructure** (`connector/`, `cache/`, `adf/`, `templates/`) -- I/O and external APIs
|
|
558
|
+
3. **Business Logic** (`operations/`, `bulk/`) -- orchestrates infrastructure
|
|
559
|
+
4. **Entry Points** (`tools/`, `cli/`, `server.ts`) -- thin dispatchers
|
|
560
|
+
|
|
561
|
+
### AI Toolkit Integration
|
|
562
|
+
|
|
563
|
+
- **Rules file** (`rules/jira-mcp.md`) -- register with `ai-toolkit add-rule` for automatic language checks, sync-first workflow, and tool reference injection.
|
|
564
|
+
- **GitHub Copilot** (`.github/copilot-instructions.md`) -- full project context for Copilot-assisted development.
|
package/README.md
CHANGED
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
> MCP server for Confluence Cloud -- pages, blog posts, comments, labels, attachments, restrictions and whiteboards via the Model Context Protocol.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@softspark/confluence-mcp)
|
|
6
|
-
[](CHANGELOG.md)
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
|
|
9
9
|
Part of the [SoftSpark Atlassian MCP workspace](https://github.com/softspark/jira-mcp), alongside [`@softspark/jira-mcp`](../jira-mcp).
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
## What's New in v1.14.
|
|
13
|
+
## What's New in v1.14.5
|
|
14
14
|
|
|
15
|
-
- No
|
|
15
|
+
- No code change since 1.14.4; this release carries documentation of how the workspace builds and packages.
|
|
16
|
+
- 1.14.4 is where this package started actually containing the `CHANGELOG.md` it had been listing in `files` since 1.12.0, and where the link to it in this README stopped pointing outside the tarball.
|
|
17
|
+
- No tool or CLI change: same 31 tools, same commands, same config path.
|
|
16
18
|
- `confluence-mcp --help` now has a test behind it: the command listing is hand-written, and a registered command missing from it fails the build.
|
|
17
|
-
- 1.14.3 changes nothing in the package itself; it carries knowledge base work only.
|
|
18
19
|
- The rest of the work is in [`@softspark/jira-mcp`](../jira-mcp): translated comment templates and a command that installs them.
|
|
19
20
|
|
|
20
21
|
---
|
|
@@ -185,7 +186,7 @@ Drop your own templates in `~/.softspark/jira-mcp/templates/pages/*.md`; one wit
|
|
|
185
186
|
## Documentation
|
|
186
187
|
|
|
187
188
|
- [Confluence reference](../../kb/reference/confluence.md) -- architecture, API split, ADF and storage formats, restrictions, version conflicts.
|
|
188
|
-
- [Changelog](
|
|
189
|
+
- [Changelog](CHANGELOG.md) -- shared with `@softspark/jira-mcp`; both packages are released together under one version.
|
|
189
190
|
|
|
190
191
|
## License
|
|
191
192
|
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {readFile,writeFile,access}from'fs/promises';import {homedir}from'os';import {dirname,join,resolve,basename}from'path';import n0 from'process';import {existsSync,readdirSync,readFileSync}from'fs';import {fileURLToPath}from'url';import {Command}from'commander';/*! confluence-mcp | Apache-2.0 | Copyright 2024-2026 Lukasz Krzemien (biuro@softspark.eu) | https://github.com/softspark/jira-mcp */
|
|
3
|
-
var sz=Object.create;var up=Object.defineProperty;var cz=Object.getOwnPropertyDescriptor;var uz=Object.getOwnPropertyNames;var lz=Object.getPrototypeOf,dz=Object.prototype.hasOwnProperty;var g=(t,e)=>()=>(t&&(e=t(t=0)),e);var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ft=(t,e)=>{for(var n in e)up(t,n,{get:e[n],enumerable:true});},pz=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of uz(e))!dz.call(t,r)&&r!==n&&up(t,r,{get:()=>e[r],enumerable:!(o=cz(e,r))||o.enumerable});return t};var W_=(t,e,n)=>(n=t!=null?sz(lz(t)):{},pz(up(n,"default",{value:t,enumerable:true}),t));var vs,lp=g(()=>{vs="1.14.3";});async function ri(t){try{return await access(t),!0}catch{return false}}async function gr(t){let e=await readFile(t,"utf-8");return JSON.parse(e)}async function Wr(t,e){await writeFile(t,JSON.stringify(e,null,2),"utf-8");}var dp=g(()=>{});function m(t,e,n){function o(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:false}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s));}}let r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:t});function a(s){var c;let u=n?.Parent?new i:this;o(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>n?.Parent&&s instanceof n.Parent?true:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function Ie(t){return t&&Object.assign(ni,t),ni}var bs,oi,Pt,hr,ni,Tn=g(()=>{bs=Object.freeze({status:"aborted"});oi=Symbol("zod_brand"),Pt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");}},hr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError";}},ni={};});var $={};Ft($,{BIGINT_FORMAT_RANGES:()=>bp,Class:()=>fp,NUMBER_FORMAT_RANGES:()=>vp,aborted:()=>br,allowsEval:()=>hp,assert:()=>bz,assertEqual:()=>hz,assertIs:()=>_z,assertNever:()=>vz,assertNotEqual:()=>yz,assignProp:()=>_r,base64ToUint8Array:()=>nv,base64urlToUint8Array:()=>Oz,cached:()=>On,captureStackTrace:()=>xs,cleanEnum:()=>Ez,cleanRegex:()=>si,clone:()=>je,cloneDef:()=>xz,createTransparentProxy:()=>Pz,defineLazy:()=>H,esc:()=>$s,escapeRegex:()=>gt,extend:()=>Q_,finalizeIssue:()=>et,floatSafeRemainder:()=>mp,getElementAtPath:()=>kz,getEnumValues:()=>ai,getLengthableOrigin:()=>li,getParsedType:()=>zz,getSizableOrigin:()=>ui,hexToUint8Array:()=>Cz,isObject:()=>Hr,isPlainObject:()=>vr,issue:()=>Rn,joinValues:()=>y,jsonStringifyReplacer:()=>En,merge:()=>Tz,mergeDefs:()=>tr,normalizeParams:()=>w,nullish:()=>yr,numKeys:()=>Iz,objectClone:()=>$z,omit:()=>Y_,optionalKeys:()=>_p,parsedType:()=>k,partial:()=>tv,pick:()=>X_,prefixIssues:()=>lt,primitiveTypes:()=>yp,promiseAllObject:()=>wz,propertyKeyTypes:()=>ci,randomString:()=>Sz,required:()=>rv,safeExtend:()=>ev,shallowClone:()=>ks,slugify:()=>gp,stringifyPrimitive:()=>b,uint8ArrayToBase64:()=>ov,uint8ArrayToBase64url:()=>Rz,uint8ArrayToHex:()=>jz,unwrapMessage:()=>ii});function hz(t){return t}function yz(t){return t}function _z(t){}function vz(t){throw new Error("Unexpected value in exhaustive check")}function bz(t){}function ai(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,r])=>e.indexOf(+o)===-1).map(([o,r])=>r)}function y(t,e="|"){return t.map(n=>b(n)).join(e)}function En(t,e){return typeof e=="bigint"?e.toString():e}function On(t){return {get value(){{let n=t();return Object.defineProperty(this,"value",{value:n}),n}}}}function yr(t){return t==null}function si(t){let e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function mp(t,e){let n=(t.toString().split(".")[1]||"").length,o=e.toString(),r=(o.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(o)){let c=o.match(/\d?e-(\d?)/);c?.[1]&&(r=Number.parseInt(c[1]));}let i=n>r?n:r,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}function H(t,e,n){let o;Object.defineProperty(t,e,{get(){if(o!==H_)return o===void 0&&(o=H_,o=n()),o},set(r){Object.defineProperty(t,e,{value:r});},configurable:true});}function $z(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function _r(t,e,n){Object.defineProperty(t,e,{value:n,writable:true,enumerable:true,configurable:true});}function tr(...t){let e={};for(let n of t){let o=Object.getOwnPropertyDescriptors(n);Object.assign(e,o);}return Object.defineProperties({},e)}function xz(t){return tr(t._zod.def)}function kz(t,e){return e?e.reduce((n,o)=>n?.[o],t):t}function wz(t){let e=Object.keys(t),n=e.map(o=>t[o]);return Promise.all(n).then(o=>{let r={};for(let i=0;i<e.length;i++)r[e[i]]=o[i];return r})}function Sz(t=10){let e="abcdefghijklmnopqrstuvwxyz",n="";for(let o=0;o<t;o++)n+=e[Math.floor(Math.random()*e.length)];return n}function $s(t){return JSON.stringify(t)}function gp(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Hr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function vr(t){if(Hr(t)===false)return false;let e=t.constructor;if(e===void 0||typeof e!="function")return true;let n=e.prototype;return !(Hr(n)===false||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===false)}function ks(t){return vr(t)?{...t}:Array.isArray(t)?[...t]:t}function Iz(t){let e=0;for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function gt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function je(t,e,n){let o=new t._zod.constr(e??t._zod.def);return (!e||n?.parent)&&(o._zod.parent=t),o}function w(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 Pz(t){let e;return new Proxy({},{get(n,o,r){return e??(e=t()),Reflect.get(e,o,r)},set(n,o,r,i){return e??(e=t()),Reflect.set(e,o,r,i)},has(n,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(n,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(n){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(n,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(n,o,r){return e??(e=t()),Reflect.defineProperty(e,o,r)}})}function b(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function _p(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function X_(t,e){let n=t._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=tr(t._zod.def,{get shape(){let a={};for(let s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(a[s]=n.shape[s]);}return _r(this,"shape",a),a},checks:[]});return je(t,i)}function Y_(t,e){let n=t._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=tr(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete a[s];}return _r(this,"shape",a),a},checks:[]});return je(t,i)}function Q_(t,e){if(!vr(e))throw new Error("Invalid input to extend: expected a plain object");let n=t._zod.def.checks;if(n&&n.length>0){let i=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=tr(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return _r(this,"shape",i),i}});return je(t,r)}function ev(t,e){if(!vr(e))throw new Error("Invalid input to safeExtend: expected a plain object");let n=tr(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return _r(this,"shape",o),o}});return je(t,n)}function Tz(t,e){let n=tr(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e._zod.def.shape};return _r(this,"shape",o),o},get catchall(){return e._zod.def.catchall},checks:[]});return je(t,n)}function tv(t,e,n){let r=e._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=tr(e._zod.def,{get shape(){let s=e._zod.def.shape,c={...s};if(n)for(let u in n){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=t?new t({type:"optional",innerType:s[u]}):s[u]);}else for(let u in s)c[u]=t?new t({type:"optional",innerType:s[u]}):s[u];return _r(this,"shape",c),c},checks:[]});return je(e,a)}function rv(t,e,n){let o=tr(e._zod.def,{get shape(){let r=e._zod.def.shape,i={...r};if(n)for(let a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new t({type:"nonoptional",innerType:r[a]}));}else for(let a in r)i[a]=new t({type:"nonoptional",innerType:r[a]});return _r(this,"shape",i),i}});return je(e,o)}function br(t,e=0){if(t.aborted===true)return true;for(let n=e;n<t.issues.length;n++)if(t.issues[n]?.continue!==true)return true;return false}function lt(t,e){return e.map(n=>{var o;return (o=n).path??(o.path=[]),n.path.unshift(t),n})}function ii(t){return typeof t=="string"?t:t?.message}function et(t,e,n){let o={...t,path:t.path??[]};if(!t.message){let r=ii(t.inst?._zod.def?.error?.(t))??ii(e?.error?.(t))??ii(n.customError?.(t))??ii(n.localeError?.(t))??"Invalid input";o.message=r;}return delete o.inst,delete o.continue,e?.reportInput||delete o.input,o}function ui(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function li(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function k(t){let e=typeof t;switch(e){case "number":return Number.isNaN(t)?"nan":"number";case "object":{if(t===null)return "null";if(Array.isArray(t))return "array";let n=t;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return e}function Rn(...t){let[e,n,o]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:o}:{...e}}function Ez(t){return Object.entries(t).filter(([e,n])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function nv(t){let e=atob(t),n=new Uint8Array(e.length);for(let o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return n}function ov(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function Oz(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-e.length%4)%4);return nv(e+n)}function Rz(t){return ov(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Cz(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)n[o/2]=Number.parseInt(e.slice(o,o+2),16);return n}function jz(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var H_,xs,hp,zz,ci,yp,vp,bp,fp,N=g(()=>{H_=Symbol("evaluating");xs="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};hp=On(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return false;try{let t=Function;return new t(""),!0}catch{return false}});zz=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}`)}},ci=new Set(["string","number","symbol"]),yp=new Set(["string","number","bigint","boolean","symbol","undefined"]);vp={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]},bp={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};fp=class{constructor(...e){}};});function Cn(t,e=n=>n.message){let n={},o=[];for(let r of t.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(e(r))):o.push(e(r));return {formErrors:o,fieldErrors:n}}function jn(t,e=n=>n.message){let n={_errors:[]},o=r=>{for(let i of r.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(e(i));else {let a=n,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++;}}};return o(t),n}function ws(t,e=n=>n.message){let n={errors:[]},o=(r,i=[])=>{var a,s;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>o({issues:u},c.path));else if(c.code==="invalid_key")o({issues:c.issues},c.path);else if(c.code==="invalid_element")o({issues:c.issues},c.path);else {let u=[...i,...c.path];if(u.length===0){n.errors.push(e(c));continue}let l=n,d=0;for(;d<u.length;){let p=u[d],f=d===u.length-1;typeof p=="string"?(l.properties??(l.properties={}),(a=l.properties)[p]??(a[p]={errors:[]}),l=l.properties[p]):(l.items??(l.items=[]),(s=l.items)[p]??(s[p]={errors:[]}),l=l.items[p]),f&&l.errors.push(e(c)),d++;}}};return o(t),n}function av(t){let e=[],n=t.map(o=>typeof o=="object"?o.key:o);for(let o of n)typeof o=="number"?e.push(`[${o}]`):typeof o=="symbol"?e.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?e.push(`[${JSON.stringify(o)}]`):(e.length&&e.push("."),e.push(o));return e.join("")}function Ss(t){let e=[],n=[...t.issues].sort((o,r)=>(o.path??[]).length-(r.path??[]).length);for(let o of n)e.push(`\u2716 ${o.message}`),o.path?.length&&e.push(` \u2192 at ${av(o.path)}`);return e.join(`
|
|
3
|
+
var sz=Object.create;var up=Object.defineProperty;var cz=Object.getOwnPropertyDescriptor;var uz=Object.getOwnPropertyNames;var lz=Object.getPrototypeOf,dz=Object.prototype.hasOwnProperty;var g=(t,e)=>()=>(t&&(e=t(t=0)),e);var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ft=(t,e)=>{for(var n in e)up(t,n,{get:e[n],enumerable:true});},pz=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of uz(e))!dz.call(t,r)&&r!==n&&up(t,r,{get:()=>e[r],enumerable:!(o=cz(e,r))||o.enumerable});return t};var W_=(t,e,n)=>(n=t!=null?sz(lz(t)):{},pz(up(n,"default",{value:t,enumerable:true}),t));var vs,lp=g(()=>{vs="1.14.5";});async function ri(t){try{return await access(t),!0}catch{return false}}async function gr(t){let e=await readFile(t,"utf-8");return JSON.parse(e)}async function Wr(t,e){await writeFile(t,JSON.stringify(e,null,2),"utf-8");}var dp=g(()=>{});function m(t,e,n){function o(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:false}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s));}}let r=n?.Parent??Object;class i extends r{}Object.defineProperty(i,"name",{value:t});function a(s){var c;let u=n?.Parent?new i:this;o(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>n?.Parent&&s instanceof n.Parent?true:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}function Ie(t){return t&&Object.assign(ni,t),ni}var bs,oi,Pt,hr,ni,Tn=g(()=>{bs=Object.freeze({status:"aborted"});oi=Symbol("zod_brand"),Pt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");}},hr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError";}},ni={};});var $={};Ft($,{BIGINT_FORMAT_RANGES:()=>bp,Class:()=>fp,NUMBER_FORMAT_RANGES:()=>vp,aborted:()=>br,allowsEval:()=>hp,assert:()=>bz,assertEqual:()=>hz,assertIs:()=>_z,assertNever:()=>vz,assertNotEqual:()=>yz,assignProp:()=>_r,base64ToUint8Array:()=>nv,base64urlToUint8Array:()=>Oz,cached:()=>On,captureStackTrace:()=>xs,cleanEnum:()=>Ez,cleanRegex:()=>si,clone:()=>je,cloneDef:()=>xz,createTransparentProxy:()=>Pz,defineLazy:()=>H,esc:()=>$s,escapeRegex:()=>gt,extend:()=>Q_,finalizeIssue:()=>et,floatSafeRemainder:()=>mp,getElementAtPath:()=>kz,getEnumValues:()=>ai,getLengthableOrigin:()=>li,getParsedType:()=>zz,getSizableOrigin:()=>ui,hexToUint8Array:()=>Cz,isObject:()=>Hr,isPlainObject:()=>vr,issue:()=>Rn,joinValues:()=>y,jsonStringifyReplacer:()=>En,merge:()=>Tz,mergeDefs:()=>tr,normalizeParams:()=>w,nullish:()=>yr,numKeys:()=>Iz,objectClone:()=>$z,omit:()=>Y_,optionalKeys:()=>_p,parsedType:()=>k,partial:()=>tv,pick:()=>X_,prefixIssues:()=>lt,primitiveTypes:()=>yp,promiseAllObject:()=>wz,propertyKeyTypes:()=>ci,randomString:()=>Sz,required:()=>rv,safeExtend:()=>ev,shallowClone:()=>ks,slugify:()=>gp,stringifyPrimitive:()=>b,uint8ArrayToBase64:()=>ov,uint8ArrayToBase64url:()=>Rz,uint8ArrayToHex:()=>jz,unwrapMessage:()=>ii});function hz(t){return t}function yz(t){return t}function _z(t){}function vz(t){throw new Error("Unexpected value in exhaustive check")}function bz(t){}function ai(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,r])=>e.indexOf(+o)===-1).map(([o,r])=>r)}function y(t,e="|"){return t.map(n=>b(n)).join(e)}function En(t,e){return typeof e=="bigint"?e.toString():e}function On(t){return {get value(){{let n=t();return Object.defineProperty(this,"value",{value:n}),n}}}}function yr(t){return t==null}function si(t){let e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function mp(t,e){let n=(t.toString().split(".")[1]||"").length,o=e.toString(),r=(o.split(".")[1]||"").length;if(r===0&&/\d?e-\d?/.test(o)){let c=o.match(/\d?e-(\d?)/);c?.[1]&&(r=Number.parseInt(c[1]));}let i=n>r?n:r,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}function H(t,e,n){let o;Object.defineProperty(t,e,{get(){if(o!==H_)return o===void 0&&(o=H_,o=n()),o},set(r){Object.defineProperty(t,e,{value:r});},configurable:true});}function $z(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function _r(t,e,n){Object.defineProperty(t,e,{value:n,writable:true,enumerable:true,configurable:true});}function tr(...t){let e={};for(let n of t){let o=Object.getOwnPropertyDescriptors(n);Object.assign(e,o);}return Object.defineProperties({},e)}function xz(t){return tr(t._zod.def)}function kz(t,e){return e?e.reduce((n,o)=>n?.[o],t):t}function wz(t){let e=Object.keys(t),n=e.map(o=>t[o]);return Promise.all(n).then(o=>{let r={};for(let i=0;i<e.length;i++)r[e[i]]=o[i];return r})}function Sz(t=10){let e="abcdefghijklmnopqrstuvwxyz",n="";for(let o=0;o<t;o++)n+=e[Math.floor(Math.random()*e.length)];return n}function $s(t){return JSON.stringify(t)}function gp(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Hr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function vr(t){if(Hr(t)===false)return false;let e=t.constructor;if(e===void 0||typeof e!="function")return true;let n=e.prototype;return !(Hr(n)===false||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===false)}function ks(t){return vr(t)?{...t}:Array.isArray(t)?[...t]:t}function Iz(t){let e=0;for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function gt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function je(t,e,n){let o=new t._zod.constr(e??t._zod.def);return (!e||n?.parent)&&(o._zod.parent=t),o}function w(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 Pz(t){let e;return new Proxy({},{get(n,o,r){return e??(e=t()),Reflect.get(e,o,r)},set(n,o,r,i){return e??(e=t()),Reflect.set(e,o,r,i)},has(n,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(n,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(n){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(n,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(n,o,r){return e??(e=t()),Reflect.defineProperty(e,o,r)}})}function b(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function _p(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function X_(t,e){let n=t._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=tr(t._zod.def,{get shape(){let a={};for(let s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&(a[s]=n.shape[s]);}return _r(this,"shape",a),a},checks:[]});return je(t,i)}function Y_(t,e){let n=t._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=tr(t._zod.def,{get shape(){let a={...t._zod.def.shape};for(let s in e){if(!(s in n.shape))throw new Error(`Unrecognized key: "${s}"`);e[s]&&delete a[s];}return _r(this,"shape",a),a},checks:[]});return je(t,i)}function Q_(t,e){if(!vr(e))throw new Error("Invalid input to extend: expected a plain object");let n=t._zod.def.checks;if(n&&n.length>0){let i=t._zod.def.shape;for(let a in e)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let r=tr(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return _r(this,"shape",i),i}});return je(t,r)}function ev(t,e){if(!vr(e))throw new Error("Invalid input to safeExtend: expected a plain object");let n=tr(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return _r(this,"shape",o),o}});return je(t,n)}function Tz(t,e){let n=tr(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e._zod.def.shape};return _r(this,"shape",o),o},get catchall(){return e._zod.def.catchall},checks:[]});return je(t,n)}function tv(t,e,n){let r=e._zod.def.checks;if(r&&r.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=tr(e._zod.def,{get shape(){let s=e._zod.def.shape,c={...s};if(n)for(let u in n){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=t?new t({type:"optional",innerType:s[u]}):s[u]);}else for(let u in s)c[u]=t?new t({type:"optional",innerType:s[u]}):s[u];return _r(this,"shape",c),c},checks:[]});return je(e,a)}function rv(t,e,n){let o=tr(e._zod.def,{get shape(){let r=e._zod.def.shape,i={...r};if(n)for(let a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new t({type:"nonoptional",innerType:r[a]}));}else for(let a in r)i[a]=new t({type:"nonoptional",innerType:r[a]});return _r(this,"shape",i),i}});return je(e,o)}function br(t,e=0){if(t.aborted===true)return true;for(let n=e;n<t.issues.length;n++)if(t.issues[n]?.continue!==true)return true;return false}function lt(t,e){return e.map(n=>{var o;return (o=n).path??(o.path=[]),n.path.unshift(t),n})}function ii(t){return typeof t=="string"?t:t?.message}function et(t,e,n){let o={...t,path:t.path??[]};if(!t.message){let r=ii(t.inst?._zod.def?.error?.(t))??ii(e?.error?.(t))??ii(n.customError?.(t))??ii(n.localeError?.(t))??"Invalid input";o.message=r;}return delete o.inst,delete o.continue,e?.reportInput||delete o.input,o}function ui(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function li(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function k(t){let e=typeof t;switch(e){case "number":return Number.isNaN(t)?"nan":"number";case "object":{if(t===null)return "null";if(Array.isArray(t))return "array";let n=t;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return e}function Rn(...t){let[e,n,o]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:o}:{...e}}function Ez(t){return Object.entries(t).filter(([e,n])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function nv(t){let e=atob(t),n=new Uint8Array(e.length);for(let o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return n}function ov(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function Oz(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-e.length%4)%4);return nv(e+n)}function Rz(t){return ov(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Cz(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)n[o/2]=Number.parseInt(e.slice(o,o+2),16);return n}function jz(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var H_,xs,hp,zz,ci,yp,vp,bp,fp,N=g(()=>{H_=Symbol("evaluating");xs="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};hp=On(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return false;try{let t=Function;return new t(""),!0}catch{return false}});zz=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}`)}},ci=new Set(["string","number","symbol"]),yp=new Set(["string","number","bigint","boolean","symbol","undefined"]);vp={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]},bp={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};fp=class{constructor(...e){}};});function Cn(t,e=n=>n.message){let n={},o=[];for(let r of t.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(e(r))):o.push(e(r));return {formErrors:o,fieldErrors:n}}function jn(t,e=n=>n.message){let n={_errors:[]},o=r=>{for(let i of r.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(e(i));else {let a=n,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++;}}};return o(t),n}function ws(t,e=n=>n.message){let n={errors:[]},o=(r,i=[])=>{var a,s;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>o({issues:u},c.path));else if(c.code==="invalid_key")o({issues:c.issues},c.path);else if(c.code==="invalid_element")o({issues:c.issues},c.path);else {let u=[...i,...c.path];if(u.length===0){n.errors.push(e(c));continue}let l=n,d=0;for(;d<u.length;){let p=u[d],f=d===u.length-1;typeof p=="string"?(l.properties??(l.properties={}),(a=l.properties)[p]??(a[p]={errors:[]}),l=l.properties[p]):(l.items??(l.items=[]),(s=l.items)[p]??(s[p]={errors:[]}),l=l.items[p]),f&&l.errors.push(e(c)),d++;}}};return o(t),n}function av(t){let e=[],n=t.map(o=>typeof o=="object"?o.key:o);for(let o of n)typeof o=="number"?e.push(`[${o}]`):typeof o=="symbol"?e.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?e.push(`[${JSON.stringify(o)}]`):(e.length&&e.push("."),e.push(o));return e.join("")}function Ss(t){let e=[],n=[...t.issues].sort((o,r)=>(o.path??[]).length-(r.path??[]).length);for(let o of n)e.push(`\u2716 ${o.message}`),o.path?.length&&e.push(` \u2192 at ${av(o.path)}`);return e.join(`
|
|
4
4
|
`)}var iv,di,tt,$p=g(()=>{Tn();N();iv=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:false}),Object.defineProperty(t,"issues",{value:e,enumerable:false}),t.message=JSON.stringify(e,En,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:false});},di=m("$ZodError",iv),tt=m("$ZodError",iv,{Parent:Error});});var Nn,An,Dn,Un,Zn,Xr,Mn,Ln,Is,sv,zs,cv,Ps,uv,Ts,lv,Es,dv,Os,pv,Rs,fv,Cs,mv,xp=g(()=>{Tn();$p();N();Nn=t=>(e,n,o,r)=>{let i=o?Object.assign(o,{async:false}):{async:false},a=e._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Pt;if(a.issues.length){let s=new(r?.Err??t)(a.issues.map(c=>et(c,i,Ie())));throw xs(s,r?.callee),s}return a.value},An=Nn(tt),Dn=t=>async(e,n,o,r)=>{let i=o?Object.assign(o,{async:true}):{async:true},a=e._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(r?.Err??t)(a.issues.map(c=>et(c,i,Ie())));throw xs(s,r?.callee),s}return a.value},Un=Dn(tt),Zn=t=>(e,n,o)=>{let r=o?{...o,async:false}:{async:false},i=e._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new Pt;return i.issues.length?{success:false,error:new(t??di)(i.issues.map(a=>et(a,r,Ie())))}:{success:true,data:i.value}},Xr=Zn(tt),Mn=t=>async(e,n,o)=>{let r=o?Object.assign(o,{async:true}):{async:true},i=e._zod.run({value:n,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length?{success:false,error:new t(i.issues.map(a=>et(a,r,Ie())))}:{success:true,data:i.value}},Ln=Mn(tt),Is=t=>(e,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Nn(t)(e,n,r)},sv=Is(tt),zs=t=>(e,n,o)=>Nn(t)(e,n,o),cv=zs(tt),Ps=t=>async(e,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Dn(t)(e,n,r)},uv=Ps(tt),Ts=t=>async(e,n,o)=>Dn(t)(e,n,o),lv=Ts(tt),Es=t=>(e,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Zn(t)(e,n,r)},dv=Es(tt),Os=t=>(e,n,o)=>Zn(t)(e,n,o),pv=Os(tt),Rs=t=>async(e,n,o)=>{let r=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Mn(t)(e,n,r)},fv=Rs(tt),Cs=t=>async(e,n,o)=>Mn(t)(e,n,o),mv=Cs(tt);});var rt={};Ft(rt,{base64:()=>Up,base64url:()=>js,bigint:()=>Vp,boolean:()=>Jp,browserEmail:()=>Fz,cidrv4:()=>Ap,cidrv6:()=>Dp,cuid:()=>kp,cuid2:()=>wp,date:()=>Mp,datetime:()=>qp,domain:()=>Jz,duration:()=>Tp,e164:()=>Zp,email:()=>Op,emoji:()=>Rp,extendedDuration:()=>Az,guid:()=>Ep,hex:()=>Gz,hostname:()=>Bz,html5Email:()=>Mz,idnEmail:()=>qz,integer:()=>Bp,ipv4:()=>Cp,ipv6:()=>jp,ksuid:()=>zp,lowercase:()=>Wp,mac:()=>Np,md5_base64:()=>Wz,md5_base64url:()=>Hz,md5_hex:()=>Kz,nanoid:()=>Pp,null:()=>Gp,number:()=>Ns,rfc5322Email:()=>Lz,sha1_base64:()=>Yz,sha1_base64url:()=>Qz,sha1_hex:()=>Xz,sha256_base64:()=>tP,sha256_base64url:()=>rP,sha256_hex:()=>eP,sha384_base64:()=>oP,sha384_base64url:()=>iP,sha384_hex:()=>nP,sha512_base64:()=>sP,sha512_base64url:()=>cP,sha512_hex:()=>aP,string:()=>Fp,time:()=>Lp,ulid:()=>Sp,undefined:()=>Kp,unicodeEmail:()=>gv,uppercase:()=>Hp,uuid:()=>Yr,uuid4:()=>Dz,uuid6:()=>Uz,uuid7:()=>Zz,xid:()=>Ip});function Rp(){return new RegExp(Vz,"u")}function yv(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 Lp(t){return new RegExp(`^${yv(t)}$`)}function qp(t){let e=yv({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${e}(?:${n.join("|")})`;return new RegExp(`^${hv}T(?:${o})$`)}function pi(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function fi(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var kp,wp,Sp,Ip,zp,Pp,Tp,Az,Ep,Yr,Dz,Uz,Zz,Op,Mz,Lz,gv,qz,Fz,Vz,Cp,jp,Np,Ap,Dp,Up,js,Bz,Jz,Zp,hv,Mp,Fp,Vp,Bp,Ns,Jp,Gp,Kp,Wp,Hp,Gz,Kz,Wz,Hz,Xz,Yz,Qz,eP,tP,rP,nP,oP,iP,aP,sP,cP,As=g(()=>{N();kp=/^[cC][^\s-]{8,}$/,wp=/^[0-9a-z]+$/,Sp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ip=/^[0-9a-vA-V]{20}$/,zp=/^[A-Za-z0-9]{27}$/,Pp=/^[a-zA-Z0-9_-]{21}$/,Tp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Az=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ep=/^([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})$/,Yr=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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Dz=Yr(4),Uz=Yr(6),Zz=Yr(7),Op=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Mz=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Lz=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,gv=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,qz=gv,Fz=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Vz="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";Cp=/^(?:(?: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])$/,jp=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Np=t=>{let e=gt(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},Ap=/^((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])$/,Dp=/^(([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])$/,Up=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,js=/^[A-Za-z0-9_-]*$/,Bz=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Jz=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Zp=/^\+[1-9]\d{6,14}$/,hv="(?:(?:\\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])))",Mp=new RegExp(`^${hv}$`);Fp=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Vp=/^-?\d+n?$/,Bp=/^-?\d+$/,Ns=/^-?\d+(?:\.\d+)?$/,Jp=/^(?:true|false)$/i,Gp=/^null$/i,Kp=/^undefined$/i,Wp=/^[^A-Z]*$/,Hp=/^[^a-z]*$/,Gz=/^[0-9a-fA-F]*$/;Kz=/^[0-9a-fA-F]{32}$/,Wz=pi(22,"=="),Hz=fi(22),Xz=/^[0-9a-fA-F]{40}$/,Yz=pi(27,"="),Qz=fi(27),eP=/^[0-9a-fA-F]{64}$/,tP=pi(43,"="),rP=fi(43),nP=/^[0-9a-fA-F]{96}$/,oP=pi(64,""),iP=fi(64),aP=/^[0-9a-fA-F]{128}$/,sP=pi(86,"=="),cP=fi(86);});function _v(t,e,n){t.issues.length&&e.issues.push(...lt(n,t.issues));}var ye,vv,Ds,Us,Xp,Yp,Qp,ef,tf,rf,nf,of,af,qn,sf,cf,uf,lf,df,pf,ff,mf,gf,Zs=g(()=>{Tn();As();N();ye=m("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[]);}),vv={number:"number",bigint:"bigint",object:"date"},Ds=m("$ZodCheckLessThan",(t,e)=>{ye.init(t,e);let n=vv[typeof e.value];t._zod.onattach.push(o=>{let r=o._zod.bag,i=(e.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?r.maximum=e.value:r.exclusiveMaximum=e.value);}),t._zod.check=o=>{(e.inclusive?o.value<=e.value:o.value<e.value)||o.issues.push({origin:n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort});};}),Us=m("$ZodCheckGreaterThan",(t,e)=>{ye.init(t,e);let n=vv[typeof e.value];t._zod.onattach.push(o=>{let r=o._zod.bag,i=(e.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?r.minimum=e.value:r.exclusiveMinimum=e.value);}),t._zod.check=o=>{(e.inclusive?o.value>=e.value:o.value>e.value)||o.issues.push({origin:n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort});};}),Xp=m("$ZodCheckMultipleOf",(t,e)=>{ye.init(t,e),t._zod.onattach.push(n=>{var o;(o=n._zod.bag).multipleOf??(o.multipleOf=e.value);}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):mp(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort});};}),Yp=m("$ZodCheckNumberFormat",(t,e)=>{ye.init(t,e),e.format=e.format||"float64";let n=e.format?.includes("int"),o=n?"int":"number",[r,i]=vp[e.format];t._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=r,s.maximum=i,n&&(s.pattern=Bp);}),t._zod.check=a=>{let s=a.value;if(n){if(!Number.isInteger(s)){a.issues.push({expected:o,format:e.format,code:"invalid_type",continue:false,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:true,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:true,continue:!e.abort});return}}s<r&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:r,inclusive:true,inst:t,continue:!e.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:true,inst:t,continue:!e.abort});};}),Qp=m("$ZodCheckBigIntFormat",(t,e)=>{ye.init(t,e);let[n,o]=bp[e.format];t._zod.onattach.push(r=>{let i=r._zod.bag;i.format=e.format,i.minimum=n,i.maximum=o;}),t._zod.check=r=>{let i=r.value;i<n&&r.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:true,inst:t,continue:!e.abort}),i>o&&r.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:true,inst:t,continue:!e.abort});};}),ef=m("$ZodCheckMaxSize",(t,e)=>{var n;ye.init(t,e),(n=t._zod.def).when??(n.when=o=>{let r=o.value;return !yr(r)&&r.size!==void 0}),t._zod.onattach.push(o=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<r&&(o._zod.bag.maximum=e.maximum);}),t._zod.check=o=>{let r=o.value;r.size<=e.maximum||o.issues.push({origin:ui(r),code:"too_big",maximum:e.maximum,inclusive:true,input:r,inst:t,continue:!e.abort});};}),tf=m("$ZodCheckMinSize",(t,e)=>{var n;ye.init(t,e),(n=t._zod.def).when??(n.when=o=>{let r=o.value;return !yr(r)&&r.size!==void 0}),t._zod.onattach.push(o=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>r&&(o._zod.bag.minimum=e.minimum);}),t._zod.check=o=>{let r=o.value;r.size>=e.minimum||o.issues.push({origin:ui(r),code:"too_small",minimum:e.minimum,inclusive:true,input:r,inst:t,continue:!e.abort});};}),rf=m("$ZodCheckSizeEquals",(t,e)=>{var n;ye.init(t,e),(n=t._zod.def).when??(n.when=o=>{let r=o.value;return !yr(r)&&r.size!==void 0}),t._zod.onattach.push(o=>{let r=o._zod.bag;r.minimum=e.size,r.maximum=e.size,r.size=e.size;}),t._zod.check=o=>{let r=o.value,i=r.size;if(i===e.size)return;let a=i>e.size;o.issues.push({origin:ui(r),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:true,exact:true,input:o.value,inst:t,continue:!e.abort});};}),nf=m("$ZodCheckMaxLength",(t,e)=>{var n;ye.init(t,e),(n=t._zod.def).when??(n.when=o=>{let r=o.value;return !yr(r)&&r.length!==void 0}),t._zod.onattach.push(o=>{let r=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<r&&(o._zod.bag.maximum=e.maximum);}),t._zod.check=o=>{let r=o.value;if(r.length<=e.maximum)return;let a=li(r);o.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:true,input:r,inst:t,continue:!e.abort});};}),of=m("$ZodCheckMinLength",(t,e)=>{var n;ye.init(t,e),(n=t._zod.def).when??(n.when=o=>{let r=o.value;return !yr(r)&&r.length!==void 0}),t._zod.onattach.push(o=>{let r=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>r&&(o._zod.bag.minimum=e.minimum);}),t._zod.check=o=>{let r=o.value;if(r.length>=e.minimum)return;let a=li(r);o.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:true,input:r,inst:t,continue:!e.abort});};}),af=m("$ZodCheckLengthEquals",(t,e)=>{var n;ye.init(t,e),(n=t._zod.def).when??(n.when=o=>{let r=o.value;return !yr(r)&&r.length!==void 0}),t._zod.onattach.push(o=>{let r=o._zod.bag;r.minimum=e.length,r.maximum=e.length,r.length=e.length;}),t._zod.check=o=>{let r=o.value,i=r.length;if(i===e.length)return;let a=li(r),s=i>e.length;o.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:true,exact:true,input:o.value,inst:t,continue:!e.abort});};}),qn=m("$ZodCheckStringFormat",(t,e)=>{var n,o;ye.init(t,e),t._zod.onattach.push(r=>{let i=r._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern));}),e.pattern?(n=t._zod).check??(n.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:e.format,input:r.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort});}):(o=t._zod).check??(o.check=()=>{});}),sf=m("$ZodCheckRegex",(t,e)=>{qn.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort});};}),cf=m("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Wp),qn.init(t,e);}),uf=m("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Hp),qn.init(t,e);}),lf=m("$ZodCheckIncludes",(t,e)=>{ye.init(t,e);let n=gt(e.includes),o=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=o,t._zod.onattach.push(r=>{let i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o);}),t._zod.check=r=>{r.value.includes(e.includes,e.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:r.value,inst:t,continue:!e.abort});};}),df=m("$ZodCheckStartsWith",(t,e)=>{ye.init(t,e);let n=new RegExp(`^${gt(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(o=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n);}),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});};}),pf=m("$ZodCheckEndsWith",(t,e)=>{ye.init(t,e);let n=new RegExp(`.*${gt(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(o=>{let r=o._zod.bag;r.patterns??(r.patterns=new Set),r.patterns.add(n);}),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});};});ff=m("$ZodCheckProperty",(t,e)=>{ye.init(t,e),t._zod.check=n=>{let o=e.schema._zod.run({value:n.value[e.property],issues:[]},{});if(o instanceof Promise)return o.then(r=>_v(r,n,e.property));_v(o,n,e.property);};}),mf=m("$ZodCheckMimeType",(t,e)=>{ye.init(t,e);let n=new Set(e.mime);t._zod.onattach.push(o=>{o._zod.bag.mime=e.mime;}),t._zod.check=o=>{n.has(o.value.type)||o.issues.push({code:"invalid_value",values:e.mime,input:o.value.type,inst:t,continue:!e.abort});};}),gf=m("$ZodCheckOverwrite",(t,e)=>{ye.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value);};});});var mi,hf=g(()=>{mi=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(`
|
|
5
5
|
`).filter(a=>a),r=Math.min(...o.map(a=>a.length-a.trimStart().length)),i=o.map(a=>a.slice(r)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a);}compile(){let e=Function,n=this?.args,r=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...n,r.join(`
|
|
6
6
|
`))}};});var yf,_f=g(()=>{yf={major:4,minor:3,patch:6};});function bf(t){if(t==="")return true;if(t.length%4!==0)return false;try{return atob(t),!0}catch{return false}}function Rv(t){if(!js.test(t))return false;let e=t.replace(/[-_]/g,o=>o==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return bf(n)}function Cv(t,e=null){try{let n=t.split(".");if(n.length!==3)return !1;let[o]=n;if(!o)return !1;let r=JSON.parse(atob(o));return !("typ"in r&&r?.typ!=="JWT"||!r.alg||e&&(!("alg"in r)||r.alg!==e))}catch{return false}}function $v(t,e,n){t.issues.length&&e.issues.push(...lt(n,t.issues)),e.value[n]=t.value;}function Vs(t,e,n,o,r){if(t.issues.length){if(r&&!(n in o))return;e.issues.push(...lt(n,t.issues));}t.value===void 0?n in o&&(e.value[n]=void 0):e.value[n]=t.value;}function jv(t){let e=Object.keys(t.shape);for(let o of e)if(!t.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let n=_p(t.shape);return {...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function Nv(t,e,n,o,r,i){let a=[],s=r.keySet,c=r.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in e){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let p=c.run({value:e[d],issues:[]},o);p instanceof Promise?t.push(p.then(f=>Vs(f,n,d,e,l))):Vs(p,n,d,e,l);}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),t.length?Promise.all(t).then(()=>n):n}function xv(t,e,n,o){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let r=t.filter(i=>!br(i));return r.length===1?(e.value=r[0].value,r[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(i=>i.issues.map(a=>et(a,o,Ie())))}),e)}function kv(t,e,n,o){let r=t.filter(i=>i.issues.length===0);return r.length===1?(e.value=r[0].value,e):(r.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(i=>i.issues.map(a=>et(a,o,Ie())))}):e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:[],inclusive:false}),e)}function vf(t,e){if(t===e)return {valid:true,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return {valid:true,data:t};if(vr(t)&&vr(e)){let n=Object.keys(e),o=Object.keys(t).filter(i=>n.indexOf(i)!==-1),r={...t,...e};for(let i of o){let a=vf(t[i],e[i]);if(!a.valid)return {valid:false,mergeErrorPath:[i,...a.mergeErrorPath]};r[i]=a.data;}return {valid:true,data:r}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return {valid:false,mergeErrorPath:[]};let n=[];for(let o=0;o<t.length;o++){let r=t[o],i=e[o],a=vf(r,i);if(!a.valid)return {valid:false,mergeErrorPath:[o,...a.mergeErrorPath]};n.push(a.data);}return {valid:true,data:n}}return {valid:false,mergeErrorPath:[]}}function wv(t,e,n){let o=new Map,r;for(let s of e.issues)if(s.code==="unrecognized_keys"){r??(r=s);for(let c of s.keys)o.has(c)||o.set(c,{}),o.get(c).l=true;}else t.issues.push(s);for(let s of n.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)o.has(c)||o.set(c,{}),o.get(c).r=true;else t.issues.push(s);let i=[...o].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&r&&t.issues.push({...r,keys:i}),br(t))return t;let a=vf(e.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}function Ms(t,e,n){t.issues.length&&e.issues.push(...lt(n,t.issues)),e.value[n]=t.value;}function Sv(t,e,n,o,r,i,a){t.issues.length&&(ci.has(typeof o)?n.issues.push(...lt(o,t.issues)):n.issues.push({code:"invalid_key",origin:"map",input:r,inst:i,issues:t.issues.map(s=>et(s,a,Ie()))})),e.issues.length&&(ci.has(typeof o)?n.issues.push(...lt(o,e.issues)):n.issues.push({origin:"map",code:"invalid_element",input:r,inst:i,key:o,issues:e.issues.map(s=>et(s,a,Ie()))})),n.value.set(t.value,e.value);}function Iv(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value);}function zv(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}function Pv(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function Tv(t,e){return !t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function Ls(t,e,n){return t.issues.length?(t.aborted=true,t):e._zod.run({value:t.value,issues:t.issues},n)}function qs(t,e,n){if(t.issues.length)return t.aborted=true,t;if((n.direction||"forward")==="forward"){let r=e.transform(t.value,t);return r instanceof Promise?r.then(i=>Fs(t,i,e.out,n)):Fs(t,r,e.out,n)}else {let r=e.reverseTransform(t.value,t);return r instanceof Promise?r.then(i=>Fs(t,i,e.in,n)):Fs(t,r,e.in,n)}}function Fs(t,e,n,o){return t.issues.length?(t.aborted=true,t):n._zod.run({value:e,issues:t.issues},o)}function Ev(t){return t.value=Object.freeze(t.value),t}function Ov(t,e,n,o){if(!t){let r={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(r.params=o._zod.def.params),e.issues.push(Rn(r));}}var F,$r,ge,Bs,Js,Gs,Ks,Ws,Hs,Xs,Ys,Qs,ec,tc,rc,nc,oc,ic,ac,sc,cc,uc,lc,dc,pc,fc,mc,gc,gi,hc,Fn,hi,yc,_c,vc,bc,$c,xc,kc,wc,Sc,Ic,$f,xf,Vn,zc,Pc,Tc,yi,Ec,Oc,Rc,Cc,jc,Nc,Ac,_i,Dc,Uc,Zc,Mc,Lc,qc,Fc,Vc,Bc,Bn,Jc,Gc,Kc,Wc,Hc,Xc,kf=g(()=>{Zs();Tn();hf();xp();As();N();_f();N();F=m("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=yf;let o=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&o.unshift(t);for(let r of o)for(let i of r._zod.onattach)i(t);if(o.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse;});else {let r=(a,s,c)=>{let u=br(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&c?.async===false)throw new Pt;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(u||(u=br(a,p)));});else {if(a.issues.length===p)continue;u||(u=br(a,p));}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(br(a))return a.aborted=true,a;let u=r(s,o,c);if(u instanceof Promise){if(c.async===false)throw new Pt;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(a,s)=>{if(s.skipChecks)return t._zod.parse(a,s);if(s.direction==="backward"){let u=t._zod.parse({value:a.value,issues:[]},{...s,skipChecks:true});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=t._zod.parse(a,s);if(c instanceof Promise){if(s.async===false)throw new Pt;return c.then(u=>r(u,o,s))}return r(c,o,s)};}H(t,"~standard",()=>({validate:r=>{try{let i=Xr(t,r);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Ln(t,r).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}));}),$r=m("$ZodString",(t,e)=>{F.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Fp(t._zod.bag),t._zod.parse=(n,o)=>{if(e.coerce)try{n.value=String(n.value);}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n};}),ge=m("$ZodStringFormat",(t,e)=>{qn.init(t,e),$r.init(t,e);}),Bs=m("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Ep),ge.init(t,e);}),Js=m("$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=Yr(o));}else e.pattern??(e.pattern=Yr());ge.init(t,e);}),Gs=m("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Op),ge.init(t,e);}),Ks=m("$ZodURL",(t,e)=>{ge.init(t,e),t._zod.check=n=>{try{let o=n.value.trim(),r=new URL(o);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(r.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(r.protocol.endsWith(":")?r.protocol.slice(0,-1):r.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=r.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort});}};}),Ws=m("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Rp()),ge.init(t,e);}),Hs=m("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Pp),ge.init(t,e);}),Xs=m("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=kp),ge.init(t,e);}),Ys=m("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=wp),ge.init(t,e);}),Qs=m("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Sp),ge.init(t,e);}),ec=m("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Ip),ge.init(t,e);}),tc=m("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=zp),ge.init(t,e);}),rc=m("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=qp(e)),ge.init(t,e);}),nc=m("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Mp),ge.init(t,e);}),oc=m("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Lp(e)),ge.init(t,e);}),ic=m("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Tp),ge.init(t,e);}),ac=m("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Cp),ge.init(t,e),t._zod.bag.format="ipv4";}),sc=m("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=jp),ge.init(t,e),t._zod.bag.format="ipv6",t._zod.check=n=>{try{new URL(`http://[${n.value}]`);}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort});}};}),cc=m("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=Np(e.delimiter)),ge.init(t,e),t._zod.bag.format="mac";}),uc=m("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Ap),ge.init(t,e);}),lc=m("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Dp),ge.init(t,e),t._zod.check=n=>{let o=n.value.split("/");try{if(o.length!==2)throw new Error;let[r,i]=o;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${r}]`);}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort});}};});dc=m("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Up),ge.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{bf(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort});};});pc=m("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=js),ge.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{Rv(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort});};}),fc=m("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Zp),ge.init(t,e);});mc=m("$ZodJWT",(t,e)=>{ge.init(t,e),t._zod.check=n=>{Cv(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort});};}),gc=m("$ZodCustomStringFormat",(t,e)=>{ge.init(t,e),t._zod.check=n=>{e.fn(n.value)||n.issues.push({code:"invalid_format",format:e.format,input:n.value,inst:t,continue:!e.abort});};}),gi=m("$ZodNumber",(t,e)=>{F.init(t,e),t._zod.pattern=t._zod.bag.pattern??Ns,t._zod.parse=(n,o)=>{if(e.coerce)try{n.value=Number(n.value);}catch{}let r=n.value;if(typeof r=="number"&&!Number.isNaN(r)&&Number.isFinite(r))return n;let i=typeof r=="number"?Number.isNaN(r)?"NaN":Number.isFinite(r)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:r,inst:t,...i?{received:i}:{}}),n};}),hc=m("$ZodNumberFormat",(t,e)=>{Yp.init(t,e),gi.init(t,e);}),Fn=m("$ZodBoolean",(t,e)=>{F.init(t,e),t._zod.pattern=Jp,t._zod.parse=(n,o)=>{if(e.coerce)try{n.value=!!n.value;}catch{}let r=n.value;return typeof r=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:r,inst:t}),n};}),hi=m("$ZodBigInt",(t,e)=>{F.init(t,e),t._zod.pattern=Vp,t._zod.parse=(n,o)=>{if(e.coerce)try{n.value=BigInt(n.value);}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:t}),n};}),yc=m("$ZodBigIntFormat",(t,e)=>{Qp.init(t,e),hi.init(t,e);}),_c=m("$ZodSymbol",(t,e)=>{F.init(t,e),t._zod.parse=(n,o)=>{let r=n.value;return typeof r=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:r,inst:t}),n};}),vc=m("$ZodUndefined",(t,e)=>{F.init(t,e),t._zod.pattern=Kp,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(n,o)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:r,inst:t}),n};}),bc=m("$ZodNull",(t,e)=>{F.init(t,e),t._zod.pattern=Gp,t._zod.values=new Set([null]),t._zod.parse=(n,o)=>{let r=n.value;return r===null||n.issues.push({expected:"null",code:"invalid_type",input:r,inst:t}),n};}),$c=m("$ZodAny",(t,e)=>{F.init(t,e),t._zod.parse=n=>n;}),xc=m("$ZodUnknown",(t,e)=>{F.init(t,e),t._zod.parse=n=>n;}),kc=m("$ZodNever",(t,e)=>{F.init(t,e),t._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n);}),wc=m("$ZodVoid",(t,e)=>{F.init(t,e),t._zod.parse=(n,o)=>{let r=n.value;return typeof r>"u"||n.issues.push({expected:"void",code:"invalid_type",input:r,inst:t}),n};}),Sc=m("$ZodDate",(t,e)=>{F.init(t,e),t._zod.parse=(n,o)=>{if(e.coerce)try{n.value=new Date(n.value);}catch{}let r=n.value,i=r instanceof Date;return i&&!Number.isNaN(r.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:r,...i?{received:"Invalid Date"}:{},inst:t}),n};});Ic=m("$ZodArray",(t,e)=>{F.init(t,e),t._zod.parse=(n,o)=>{let r=n.value;if(!Array.isArray(r))return n.issues.push({expected:"array",code:"invalid_type",input:r,inst:t}),n;n.value=Array(r.length);let i=[];for(let a=0;a<r.length;a++){let s=r[a],c=e.element._zod.run({value:s,issues:[]},o);c instanceof Promise?i.push(c.then(u=>$v(u,n,a))):$v(c,n,a);}return i.length?Promise.all(i).then(()=>n):n};});$f=m("$ZodObject",(t,e)=>{if(F.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...s};return Object.defineProperty(e,"shape",{value:c}),c}});}let o=On(()=>jv(e));H(t._zod,"propValues",()=>{let s=e.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d);}}return c});let r=Hr,i=e.catchall,a;t._zod.parse=(s,c)=>{a??(a=o.value);let u=s.value;if(!r(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let f=d[p],h=f._zod.optout==="optional",v=f._zod.run({value:u[p],issues:[]},c);v instanceof Promise?l.push(v.then(S=>Vs(S,s,p,u,h))):Vs(v,s,p,u,h);}return i?Nv(l,u,s,c,o.value,t):l.length?Promise.all(l).then(()=>s):s};}),xf=m("$ZodObjectJIT",(t,e)=>{$f.init(t,e);let n=t._zod.parse,o=On(()=>jv(e)),r=p=>{let f=new mi(["shape","payload","ctx"]),h=o.value,v=j=>{let V=$s(j);return `shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`};f.write("const input = payload.value;");let S=Object.create(null),P=0;for(let j of h.keys)S[j]=`key_${P++}`;f.write("const newResult = {};");for(let j of h.keys){let V=S[j],Z=$s(j),zt=p[j]?._zod?.optout==="optional";f.write(`const ${V} = ${v(j)};`),zt?f.write(`
|
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ var Rw=Object.create;var $d=Object.defineProperty;var Cw=Object.getOwnPropertyDe
|
|
|
47
47
|
|
|
48
48
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of t.seen.entries()){let s=a[1];if(e===a[0]){i(a);continue}if(t.external){let u=t.external.registry.get(a[0])?.id;if(e!==a[0]&&u){i(a);continue}}if(t.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&t.reused==="ref"){i(a);continue}}}function br(t,e){let n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let s=t.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){o(l);let p=t.seen.get(l),m=p.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(m)):Object.assign(c,m),Object.assign(c,u),a._zod.parent===l)for(let _ in c)_==="$ref"||_==="allOf"||_ in u||delete c[_];if(m.$ref&&p.def)for(let _ in c)_==="$ref"||_==="allOf"||_ in p.def&&JSON.stringify(c[_])===JSON.stringify(p.def[_])&&delete c[_];}let d=a._zod.parent;if(d&&d!==l){o(d);let p=t.seen.get(d);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let m in c)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(c[m])===JSON.stringify(p.def[m])&&delete c[m];}t.override({zodSchema:a,jsonSchema:c,path:s.path??[]});};for(let a of [...t.seen.entries()].reverse())o(a[0]);let r={};if(t.target==="draft-2020-12"?r.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?r.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?r.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");r.$id=t.external.uri(a);}Object.assign(r,n.def??n.schema);let i=t.external?.defs??{};for(let a of t.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def);}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?r.$defs=i:r.definitions=i);try{let a=JSON.parse(JSON.stringify(r));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Yn(e,"input",t.processors),output:Yn(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Je(t,e){let n=e??{seen:new Set};if(n.seen.has(t))return false;n.seen.add(t);let o=t._zod.def;if(o.type==="transform")return true;if(o.type==="array")return Je(o.element,n);if(o.type==="set")return Je(o.valueType,n);if(o.type==="lazy")return Je(o.getter(),n);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return Je(o.innerType,n);if(o.type==="intersection")return Je(o.left,n)||Je(o.right,n);if(o.type==="record"||o.type==="map")return Je(o.keyType,n)||Je(o.valueType,n);if(o.type==="pipe")return Je(o.in,n)||Je(o.out,n);if(o.type==="object"){for(let r in o.shape)if(Je(o.shape[r],n))return true;return false}if(o.type==="union"){for(let r of o.options)if(Je(r,n))return true;return false}if(o.type==="tuple"){for(let r of o.items)if(Je(r,n))return true;return !!(o.rest&&Je(o.rest,n))}return false}var Ap=(t,e={})=>n=>{let o=_r({...n,processors:e});return pe(t,o),vr(o,t),br(o,t)},Yn=(t,e,n={})=>o=>{let{libraryOptions:r,target:i}=o??{},a=_r({...r??{},target:i,io:e,processors:n});return pe(t,a),vr(a,t),br(a,t)};var k0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Dp=(t,e,n,o)=>{let r=n;r.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof i=="number"&&(r.minLength=i),typeof a=="number"&&(r.maxLength=a),s&&(r.format=k0[s]??s,r.format===""&&delete r.format,s==="time"&&delete r.format),u&&(r.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?r.pattern=l[0].source:l.length>1&&(r.allOf=[...l.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]);}},Up=(t,e,n,o)=>{let r=n,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof s=="string"&&s.includes("int")?r.type="integer":r.type="number",typeof l=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(r.minimum=l,r.exclusiveMinimum=true):r.exclusiveMinimum=l),typeof i=="number"&&(r.minimum=i,typeof l=="number"&&e.target!=="draft-04"&&(l>=i?delete r.minimum:delete r.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(r.maximum=u,r.exclusiveMaximum=true):r.exclusiveMaximum=u),typeof a=="number"&&(r.maximum=a,typeof u=="number"&&e.target!=="draft-04"&&(u<=a?delete r.maximum:delete r.exclusiveMaximum)),typeof c=="number"&&(r.multipleOf=c);},Zp=(t,e,n,o)=>{n.type="boolean";},Mp=(t,e,n,o)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Lp=(t,e,n,o)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},qp=(t,e,n,o)=>{e.target==="openapi-3.0"?(n.type="string",n.nullable=true,n.enum=[null]):n.type="null";},Fp=(t,e,n,o)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Vp=(t,e,n,o)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Bp=(t,e,n,o)=>{n.not={};},Jp=(t,e,n,o)=>{},Gp=(t,e,n,o)=>{},Kp=(t,e,n,o)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Wp=(t,e,n,o)=>{let r=t._zod.def,i=Yo(r.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i;},Hp=(t,e,n,o)=>{let r=t._zod.def,i=[];for(let a of r.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a));}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];n.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[a]:n.const=a;}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i;},Xp=(t,e,n,o)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Yp=(t,e,n,o)=>{let r=n,i=t._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");r.type="string",r.pattern=i.source;},Qp=(t,e,n,o)=>{let r=n,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=t._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(r,i);},em=(t,e,n,o)=>{n.type="boolean";},tm=(t,e,n,o)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},rm=(t,e,n,o)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},nm=(t,e,n,o)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},om=(t,e,n,o)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},im=(t,e,n,o)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},am=(t,e,n,o)=>{let r=n,i=t._zod.def,{minimum:a,maximum:s}=t._zod.bag;typeof a=="number"&&(r.minItems=a),typeof s=="number"&&(r.maxItems=s),r.type="array",r.items=pe(i.element,e,{...o,path:[...o.path,"items"]});},sm=(t,e,n,o)=>{let r=n,i=t._zod.def;r.type="object",r.properties={};let a=i.shape;for(let u in a)r.properties[u]=pe(a[u],e,{...o,path:[...o.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(r.required=Array.from(c)),i.catchall?._zod.def.type==="never"?r.additionalProperties=false:i.catchall?i.catchall&&(r.additionalProperties=pe(i.catchall,e,{...o,path:[...o.path,"additionalProperties"]})):e.io==="output"&&(r.additionalProperties=false);},hu=(t,e,n,o)=>{let r=t._zod.def,i=r.inclusive===false,a=r.options.map((s,c)=>pe(s,e,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=a:n.anyOf=a;},cm=(t,e,n,o)=>{let r=t._zod.def,i=pe(r.left,e,{...o,path:[...o.path,"allOf",0]}),a=pe(r.right,e,{...o,path:[...o.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];n.allOf=c;},um=(t,e,n,o)=>{let r=n,i=t._zod.def;r.type="array";let a=e.target==="draft-2020-12"?"prefixItems":"items",s=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,m)=>pe(p,e,{...o,path:[...o.path,a,m]})),u=i.rest?pe(i.rest,e,{...o,path:[...o.path,s,...e.target==="openapi-3.0"?[i.items.length]:[]]}):null;e.target==="draft-2020-12"?(r.prefixItems=c,u&&(r.items=u)):e.target==="openapi-3.0"?(r.items={anyOf:c},u&&r.items.anyOf.push(u),r.minItems=c.length,u||(r.maxItems=c.length)):(r.items=c,u&&(r.additionalItems=u));let{minimum:l,maximum:d}=t._zod.bag;typeof l=="number"&&(r.minItems=l),typeof d=="number"&&(r.maxItems=d);},lm=(t,e,n,o)=>{let r=n,i=t._zod.def;r.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=pe(i.valueType,e,{...o,path:[...o.path,"patternProperties","*"]});r.patternProperties={};for(let d of c)r.patternProperties[d.source]=l;}else (e.target==="draft-07"||e.target==="draft-2020-12")&&(r.propertyNames=pe(i.keyType,e,{...o,path:[...o.path,"propertyNames"]})),r.additionalProperties=pe(i.valueType,e,{...o,path:[...o.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(r.required=l);}},dm=(t,e,n,o)=>{let r=t._zod.def,i=pe(r.innerType,e,o),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=r.innerType,n.nullable=true):n.anyOf=[i,{type:"null"}];},pm=(t,e,n,o)=>{let r=t._zod.def;pe(r.innerType,e,o);let i=e.seen.get(t);i.ref=r.innerType;},mm=(t,e,n,o)=>{let r=t._zod.def;pe(r.innerType,e,o);let i=e.seen.get(t);i.ref=r.innerType,n.default=JSON.parse(JSON.stringify(r.defaultValue));},fm=(t,e,n,o)=>{let r=t._zod.def;pe(r.innerType,e,o);let i=e.seen.get(t);i.ref=r.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(r.defaultValue)));},gm=(t,e,n,o)=>{let r=t._zod.def;pe(r.innerType,e,o);let i=e.seen.get(t);i.ref=r.innerType;let a;try{a=r.catchValue(void 0);}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a;},hm=(t,e,n,o)=>{let r=t._zod.def,i=e.io==="input"?r.in._zod.def.type==="transform"?r.out:r.in:r.out;pe(i,e,o);let a=e.seen.get(t);a.ref=i;},ym=(t,e,n,o)=>{let r=t._zod.def;pe(r.innerType,e,o);let i=e.seen.get(t);i.ref=r.innerType,n.readOnly=true;},_m=(t,e,n,o)=>{let r=t._zod.def;pe(r.innerType,e,o);let i=e.seen.get(t);i.ref=r.innerType;},yu=(t,e,n,o)=>{let r=t._zod.def;pe(r.innerType,e,o);let i=e.seen.get(t);i.ref=r.innerType;},vm=(t,e,n,o)=>{let r=t._zod.innerType;pe(r,e,o);let i=e.seen.get(t);i.ref=r;},gu={string:Dp,number:Up,boolean:Zp,bigint:Mp,symbol:Lp,null:qp,undefined:Fp,void:Vp,never:Bp,any:Jp,unknown:Gp,date:Kp,enum:Wp,literal:Hp,nan:Xp,template_literal:Yp,file:Qp,success:em,custom:tm,function:rm,transform:nm,map:om,set:im,array:am,object:sm,union:hu,intersection:cm,tuple:um,record:lm,nullable:dm,nonoptional:pm,default:mm,prefault:fm,catch:gm,pipe:hm,readonly:ym,promise:_m,optional:yu,lazy:vm};function Qn(t,e){if("_idmap"in t){let o=t,r=_r({...e,processors:gu}),i={};for(let c of o._idmap.entries()){let[u,l]=c;pe(l,r);}let a={},s={registry:o,uri:e?.uri,defs:i};r.external=s;for(let c of o._idmap.entries()){let[u,l]=c;vr(r,l),a[u]=br(r,l);}if(Object.keys(i).length>0){let c=r.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[c]:i};}return {schemas:a}}let n=_r({...e,processors:gu});return pe(t,n),vr(n,t),br(n,t)}var _u=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e;}get seen(){return this.ctx.seen}constructor(e){let n=e?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=_r({processors:gu,target:n,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}});}process(e,n={path:[],schemaPath:[]}){return pe(e,this.ctx,n)}emit(e,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),vr(this.ctx,e);let o=br(this.ctx,e),{"~standard":r,...i}=o;return i}};var H_={};function eo(t){return !!t._zod}function $r(t,e){return eo(t)?Mr(t,e):t.safeParse(e)}function vu(t){if(!t)return;let e;if(eo(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Q_(t){if(eo(t)){let i=t._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let o=t.value;if(o!==void 0)return o}var C={};Bt(C,{$brand:()=>Ho,$input:()=>Ec,$output:()=>Tc,NEVER:()=>Wa,TimePrecision:()=>Cc,ZodAny:()=>Mm,ZodArray:()=>Vm,ZodBase64:()=>Zu,ZodBase64URL:()=>Mu,ZodBigInt:()=>ao,ZodBigIntFormat:()=>Fu,ZodBoolean:()=>io,ZodCIDRv4:()=>Du,ZodCIDRv6:()=>Uu,ZodCUID:()=>Eu,ZodCUID2:()=>Ou,ZodCatch:()=>df,ZodCodec:()=>Wu,ZodCustom:()=>Wi,ZodCustomStringFormat:()=>no,ZodDate:()=>Vi,ZodDefault:()=>of,ZodDiscriminatedUnion:()=>Jm,ZodE164:()=>Lu,ZodEmail:()=>zu,ZodEmoji:()=>Pu,ZodEnum:()=>to,ZodError:()=>T0,ZodExactOptional:()=>tf,ZodFile:()=>Qm,ZodFirstPartyTypeKind:()=>kf,ZodFunction:()=>bf,ZodGUID:()=>Zi,ZodIPv4:()=>Nu,ZodIPv6:()=>Au,ZodISODate:()=>xu,ZodISODateTime:()=>$u,ZodISODuration:()=>wu,ZodISOTime:()=>ku,ZodIntersection:()=>Gm,ZodIssueCode:()=>O0,ZodJWT:()=>qu,ZodKSUID:()=>Cu,ZodLazy:()=>yf,ZodLiteral:()=>Ym,ZodMAC:()=>Am,ZodMap:()=>Hm,ZodNaN:()=>mf,ZodNanoID:()=>Tu,ZodNever:()=>qm,ZodNonOptional:()=>Gu,ZodNull:()=>Zm,ZodNullable:()=>nf,ZodNumber:()=>oo,ZodNumberFormat:()=>en,ZodObject:()=>Bi,ZodOptional:()=>Ju,ZodPipe:()=>Ku,ZodPrefault:()=>sf,ZodPromise:()=>vf,ZodReadonly:()=>ff,ZodRealError:()=>Ye,ZodRecord:()=>Ki,ZodSet:()=>Xm,ZodString:()=>ro,ZodStringFormat:()=>he,ZodSuccess:()=>lf,ZodSymbol:()=>Dm,ZodTemplateLiteral:()=>hf,ZodTransform:()=>ef,ZodTuple:()=>Km,ZodType:()=>G,ZodULID:()=>ju,ZodURL:()=>qi,ZodUUID:()=>Ut,ZodUndefined:()=>Um,ZodUnion:()=>Ji,ZodUnknown:()=>Lm,ZodVoid:()=>Fm,ZodXID:()=>Ru,ZodXor:()=>Bm,_ZodString:()=>Iu,_default:()=>af,_function:()=>rb,any:()=>Uv,array:()=>Q,base64:()=>$v,base64url:()=>xv,bigint:()=>Rv,boolean:()=>Se,catch:()=>pf,check:()=>nb,cidrv4:()=>vv,cidrv6:()=>bv,clone:()=>Te,codec:()=>Qv,coerce:()=>wf,config:()=>we,core:()=>st,cuid:()=>dv,cuid2:()=>pv,custom:()=>Hu,date:()=>Mv,decode:()=>Tm,decodeAsync:()=>Om,describe:()=>ob,discriminatedUnion:()=>Gi,e164:()=>kv,email:()=>tv,emoji:()=>uv,encode:()=>Pm,encodeAsync:()=>Em,endsWith:()=>Gr,enum:()=>je,exactOptional:()=>rf,file:()=>Wv,flattenError:()=>Cn,float32:()=>Tv,float64:()=>Ev,formatError:()=>Nn,fromJSONSchema:()=>lb,function:()=>rb,getErrorMap:()=>R0,globalRegistry:()=>Pe,gt:()=>St,gte:()=>Ee,guid:()=>rv,hash:()=>Pv,hex:()=>zv,hostname:()=>Iv,httpUrl:()=>cv,includes:()=>Br,instanceof:()=>ab,int:()=>Su,int32:()=>Ov,int64:()=>Cv,intersection:()=>so,ipv4:()=>hv,ipv6:()=>_v,iso:()=>xr,json:()=>cb,jwt:()=>wv,keyof:()=>Lv,ksuid:()=>gv,lazy:()=>_f,length:()=>yr,literal:()=>j,locales:()=>Kn,looseObject:()=>Oe,looseRecord:()=>Bv,lowercase:()=>Fr,lt:()=>wt,lte:()=>Be,mac:()=>yv,map:()=>Jv,maxLength:()=>hr,maxSize:()=>Yt,meta:()=>ib,mime:()=>Kr,minLength:()=>Dt,minSize:()=>It,multipleOf:()=>Xt,nan:()=>Yv,nanoid:()=>lv,nativeEnum:()=>Kv,negative:()=>Ci,never:()=>Vu,nonnegative:()=>Ai,nonoptional:()=>uf,nonpositive:()=>Ni,normalize:()=>Wr,null:()=>Fi,nullable:()=>Mi,nullish:()=>Hv,number:()=>ce,object:()=>T,optional:()=>be,overwrite:()=>dt,parse:()=>wm,parseAsync:()=>Sm,partialRecord:()=>Vv,pipe:()=>Li,positive:()=>Ri,prefault:()=>cf,preprocess:()=>Hi,prettifyError:()=>es,promise:()=>tb,property:()=>Di,readonly:()=>gf,record:()=>fe,refine:()=>$f,regex:()=>qr,regexes:()=>Xe,registry:()=>pi,safeDecode:()=>Rm,safeDecodeAsync:()=>Nm,safeEncode:()=>jm,safeEncodeAsync:()=>Cm,safeParse:()=>Im,safeParseAsync:()=>zm,set:()=>Gv,setErrorMap:()=>j0,size:()=>gr,slugify:()=>Xn,startsWith:()=>Jr,strictObject:()=>qv,string:()=>y,stringFormat:()=>Sv,stringbool:()=>sb,success:()=>Xv,superRefine:()=>xf,symbol:()=>Av,templateLiteral:()=>eb,toJSONSchema:()=>Qn,toLowerCase:()=>Xr,toUpperCase:()=>Yr,transform:()=>Bu,treeifyError:()=>Qa,trim:()=>Hr,tuple:()=>Wm,uint32:()=>jv,uint64:()=>Nv,ulid:()=>mv,undefined:()=>Dv,union:()=>_e,unknown:()=>ye,uppercase:()=>Vr,url:()=>sv,util:()=>$,uuid:()=>nv,uuidv4:()=>ov,uuidv6:()=>iv,uuidv7:()=>av,void:()=>Zv,xid:()=>fv,xor:()=>Fv});var Ui={};Bt(Ui,{ZodAny:()=>Mm,ZodArray:()=>Vm,ZodBase64:()=>Zu,ZodBase64URL:()=>Mu,ZodBigInt:()=>ao,ZodBigIntFormat:()=>Fu,ZodBoolean:()=>io,ZodCIDRv4:()=>Du,ZodCIDRv6:()=>Uu,ZodCUID:()=>Eu,ZodCUID2:()=>Ou,ZodCatch:()=>df,ZodCodec:()=>Wu,ZodCustom:()=>Wi,ZodCustomStringFormat:()=>no,ZodDate:()=>Vi,ZodDefault:()=>of,ZodDiscriminatedUnion:()=>Jm,ZodE164:()=>Lu,ZodEmail:()=>zu,ZodEmoji:()=>Pu,ZodEnum:()=>to,ZodExactOptional:()=>tf,ZodFile:()=>Qm,ZodFunction:()=>bf,ZodGUID:()=>Zi,ZodIPv4:()=>Nu,ZodIPv6:()=>Au,ZodIntersection:()=>Gm,ZodJWT:()=>qu,ZodKSUID:()=>Cu,ZodLazy:()=>yf,ZodLiteral:()=>Ym,ZodMAC:()=>Am,ZodMap:()=>Hm,ZodNaN:()=>mf,ZodNanoID:()=>Tu,ZodNever:()=>qm,ZodNonOptional:()=>Gu,ZodNull:()=>Zm,ZodNullable:()=>nf,ZodNumber:()=>oo,ZodNumberFormat:()=>en,ZodObject:()=>Bi,ZodOptional:()=>Ju,ZodPipe:()=>Ku,ZodPrefault:()=>sf,ZodPromise:()=>vf,ZodReadonly:()=>ff,ZodRecord:()=>Ki,ZodSet:()=>Xm,ZodString:()=>ro,ZodStringFormat:()=>he,ZodSuccess:()=>lf,ZodSymbol:()=>Dm,ZodTemplateLiteral:()=>hf,ZodTransform:()=>ef,ZodTuple:()=>Km,ZodType:()=>G,ZodULID:()=>ju,ZodURL:()=>qi,ZodUUID:()=>Ut,ZodUndefined:()=>Um,ZodUnion:()=>Ji,ZodUnknown:()=>Lm,ZodVoid:()=>Fm,ZodXID:()=>Ru,ZodXor:()=>Bm,_ZodString:()=>Iu,_default:()=>af,_function:()=>rb,any:()=>Uv,array:()=>Q,base64:()=>$v,base64url:()=>xv,bigint:()=>Rv,boolean:()=>Se,catch:()=>pf,check:()=>nb,cidrv4:()=>vv,cidrv6:()=>bv,codec:()=>Qv,cuid:()=>dv,cuid2:()=>pv,custom:()=>Hu,date:()=>Mv,describe:()=>ob,discriminatedUnion:()=>Gi,e164:()=>kv,email:()=>tv,emoji:()=>uv,enum:()=>je,exactOptional:()=>rf,file:()=>Wv,float32:()=>Tv,float64:()=>Ev,function:()=>rb,guid:()=>rv,hash:()=>Pv,hex:()=>zv,hostname:()=>Iv,httpUrl:()=>cv,instanceof:()=>ab,int:()=>Su,int32:()=>Ov,int64:()=>Cv,intersection:()=>so,ipv4:()=>hv,ipv6:()=>_v,json:()=>cb,jwt:()=>wv,keyof:()=>Lv,ksuid:()=>gv,lazy:()=>_f,literal:()=>j,looseObject:()=>Oe,looseRecord:()=>Bv,mac:()=>yv,map:()=>Jv,meta:()=>ib,nan:()=>Yv,nanoid:()=>lv,nativeEnum:()=>Kv,never:()=>Vu,nonoptional:()=>uf,null:()=>Fi,nullable:()=>Mi,nullish:()=>Hv,number:()=>ce,object:()=>T,optional:()=>be,partialRecord:()=>Vv,pipe:()=>Li,prefault:()=>cf,preprocess:()=>Hi,promise:()=>tb,readonly:()=>gf,record:()=>fe,refine:()=>$f,set:()=>Gv,strictObject:()=>qv,string:()=>y,stringFormat:()=>Sv,stringbool:()=>sb,success:()=>Xv,superRefine:()=>xf,symbol:()=>Av,templateLiteral:()=>eb,transform:()=>Bu,tuple:()=>Wm,uint32:()=>jv,uint64:()=>Nv,ulid:()=>mv,undefined:()=>Dv,union:()=>_e,unknown:()=>ye,url:()=>sv,uuid:()=>nv,uuidv4:()=>ov,uuidv6:()=>iv,uuidv7:()=>av,void:()=>Zv,xid:()=>fv,xor:()=>Fv});var bu={};Bt(bu,{endsWith:()=>Gr,gt:()=>St,gte:()=>Ee,includes:()=>Br,length:()=>yr,lowercase:()=>Fr,lt:()=>wt,lte:()=>Be,maxLength:()=>hr,maxSize:()=>Yt,mime:()=>Kr,minLength:()=>Dt,minSize:()=>It,multipleOf:()=>Xt,negative:()=>Ci,nonnegative:()=>Ai,nonpositive:()=>Ni,normalize:()=>Wr,overwrite:()=>dt,positive:()=>Ri,property:()=>Di,regex:()=>qr,size:()=>gr,slugify:()=>Xn,startsWith:()=>Jr,toLowerCase:()=>Xr,toUpperCase:()=>Yr,trim:()=>Hr,uppercase:()=>Vr});var xr={};Bt(xr,{ZodISODate:()=>xu,ZodISODateTime:()=>$u,ZodISODuration:()=>wu,ZodISOTime:()=>ku,date:()=>$m,datetime:()=>bm,duration:()=>km,time:()=>xm});var $u=f("ZodISODateTime",(t,e)=>{Ts.init(t,e),he.init(t,e);});function bm(t){return Nc($u,t)}var xu=f("ZodISODate",(t,e)=>{Es.init(t,e),he.init(t,e);});function $m(t){return Ac(xu,t)}var ku=f("ZodISOTime",(t,e)=>{Os.init(t,e),he.init(t,e);});function xm(t){return Dc(ku,t)}var wu=f("ZodISODuration",(t,e)=>{js.init(t,e),he.init(t,e);});function km(t){return Uc(wu,t)}var ev=(t,e)=>{ni.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>Nn(t,n)},flatten:{value:n=>Cn(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,On,2);}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,On,2);}},isEmpty:{get(){return t.issues.length===0}}});},T0=f("ZodError",ev),Ye=f("ZodError",ev,{Parent:Error});var wm=An(Ye),Sm=Un(Ye),Im=Mn(Ye),zm=Ln(Ye),Pm=ts(Ye),Tm=rs(Ye),Em=ns(Ye),Om=os(Ye),jm=is(Ye),Rm=as(Ye),Cm=ss(Ye),Nm=cs(Ye);var G=f("ZodType",(t,e)=>(L.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Yn(t,"input"),output:Yn(t,"output")}}),t.toJSONSchema=Ap(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...n)=>t.clone($.mergeDefs(e,{checks:[...e.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:true}),t.with=t.check,t.clone=(n,o)=>Te(t,n,o),t.brand=()=>t,t.register=((n,o)=>(n.add(t,o),t)),t.parse=(n,o)=>wm(t,n,o,{callee:t.parse}),t.safeParse=(n,o)=>Im(t,n,o),t.parseAsync=async(n,o)=>Sm(t,n,o,{callee:t.parseAsync}),t.safeParseAsync=async(n,o)=>zm(t,n,o),t.spa=t.safeParseAsync,t.encode=(n,o)=>Pm(t,n,o),t.decode=(n,o)=>Tm(t,n,o),t.encodeAsync=async(n,o)=>Em(t,n,o),t.decodeAsync=async(n,o)=>Om(t,n,o),t.safeEncode=(n,o)=>jm(t,n,o),t.safeDecode=(n,o)=>Rm(t,n,o),t.safeEncodeAsync=async(n,o)=>Cm(t,n,o),t.safeDecodeAsync=async(n,o)=>Nm(t,n,o),t.refine=(n,o)=>t.check($f(n,o)),t.superRefine=n=>t.check(xf(n)),t.overwrite=n=>t.check(dt(n)),t.optional=()=>be(t),t.exactOptional=()=>rf(t),t.nullable=()=>Mi(t),t.nullish=()=>be(Mi(t)),t.nonoptional=n=>uf(t,n),t.array=()=>Q(t),t.or=n=>_e([t,n]),t.and=n=>so(t,n),t.transform=n=>Li(t,Bu(n)),t.default=n=>af(t,n),t.prefault=n=>cf(t,n),t.catch=n=>pf(t,n),t.pipe=n=>Li(t,n),t.readonly=()=>gf(t),t.describe=n=>{let o=t.clone();return Pe.add(o,{description:n}),o},Object.defineProperty(t,"description",{get(){return Pe.get(t)?.description},configurable:true}),t.meta=(...n)=>{if(n.length===0)return Pe.get(t);let o=t.clone();return Pe.add(o,n[0]),o},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t.apply=n=>n(t),t)),Iu=f("_ZodString",(t,e)=>{fr.init(t,e),G.init(t,e),t._zod.processJSONSchema=(o,r,i)=>Dp(t,o,r);let n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,t.regex=(...o)=>t.check(qr(...o)),t.includes=(...o)=>t.check(Br(...o)),t.startsWith=(...o)=>t.check(Jr(...o)),t.endsWith=(...o)=>t.check(Gr(...o)),t.min=(...o)=>t.check(Dt(...o)),t.max=(...o)=>t.check(hr(...o)),t.length=(...o)=>t.check(yr(...o)),t.nonempty=(...o)=>t.check(Dt(1,...o)),t.lowercase=o=>t.check(Fr(o)),t.uppercase=o=>t.check(Vr(o)),t.trim=()=>t.check(Hr()),t.normalize=(...o)=>t.check(Wr(...o)),t.toLowerCase=()=>t.check(Xr()),t.toUpperCase=()=>t.check(Yr()),t.slugify=()=>t.check(Xn());}),ro=f("ZodString",(t,e)=>{fr.init(t,e),Iu.init(t,e),t.email=n=>t.check(mi(zu,n)),t.url=n=>t.check(Hn(qi,n)),t.jwt=n=>t.check(ji(qu,n)),t.emoji=n=>t.check(_i(Pu,n)),t.guid=n=>t.check(Wn(Zi,n)),t.uuid=n=>t.check(fi(Ut,n)),t.uuidv4=n=>t.check(gi(Ut,n)),t.uuidv6=n=>t.check(hi(Ut,n)),t.uuidv7=n=>t.check(yi(Ut,n)),t.nanoid=n=>t.check(vi(Tu,n)),t.guid=n=>t.check(Wn(Zi,n)),t.cuid=n=>t.check(bi(Eu,n)),t.cuid2=n=>t.check($i(Ou,n)),t.ulid=n=>t.check(xi(ju,n)),t.base64=n=>t.check(Ti(Zu,n)),t.base64url=n=>t.check(Ei(Mu,n)),t.xid=n=>t.check(ki(Ru,n)),t.ksuid=n=>t.check(wi(Cu,n)),t.ipv4=n=>t.check(Si(Nu,n)),t.ipv6=n=>t.check(Ii(Au,n)),t.cidrv4=n=>t.check(zi(Du,n)),t.cidrv6=n=>t.check(Pi(Uu,n)),t.e164=n=>t.check(Oi(Lu,n)),t.datetime=n=>t.check(bm(n)),t.date=n=>t.check($m(n)),t.time=n=>t.check(xm(n)),t.duration=n=>t.check(km(n));});function y(t){return Oc(ro,t)}var he=f("ZodStringFormat",(t,e)=>{me.init(t,e),Iu.init(t,e);}),zu=f("ZodEmail",(t,e)=>{bs.init(t,e),he.init(t,e);});function tv(t){return mi(zu,t)}var Zi=f("ZodGUID",(t,e)=>{_s.init(t,e),he.init(t,e);});function rv(t){return Wn(Zi,t)}var Ut=f("ZodUUID",(t,e)=>{vs.init(t,e),he.init(t,e);});function nv(t){return fi(Ut,t)}function ov(t){return gi(Ut,t)}function iv(t){return hi(Ut,t)}function av(t){return yi(Ut,t)}var qi=f("ZodURL",(t,e)=>{$s.init(t,e),he.init(t,e);});function sv(t){return Hn(qi,t)}function cv(t){return Hn(qi,{protocol:/^https?$/,hostname:Xe.domain,...$.normalizeParams(t)})}var Pu=f("ZodEmoji",(t,e)=>{xs.init(t,e),he.init(t,e);});function uv(t){return _i(Pu,t)}var Tu=f("ZodNanoID",(t,e)=>{ks.init(t,e),he.init(t,e);});function lv(t){return vi(Tu,t)}var Eu=f("ZodCUID",(t,e)=>{ws.init(t,e),he.init(t,e);});function dv(t){return bi(Eu,t)}var Ou=f("ZodCUID2",(t,e)=>{Ss.init(t,e),he.init(t,e);});function pv(t){return $i(Ou,t)}var ju=f("ZodULID",(t,e)=>{Is.init(t,e),he.init(t,e);});function mv(t){return xi(ju,t)}var Ru=f("ZodXID",(t,e)=>{zs.init(t,e),he.init(t,e);});function fv(t){return ki(Ru,t)}var Cu=f("ZodKSUID",(t,e)=>{Ps.init(t,e),he.init(t,e);});function gv(t){return wi(Cu,t)}var Nu=f("ZodIPv4",(t,e)=>{Rs.init(t,e),he.init(t,e);});function hv(t){return Si(Nu,t)}var Am=f("ZodMAC",(t,e)=>{Ns.init(t,e),he.init(t,e);});function yv(t){return Rc(Am,t)}var Au=f("ZodIPv6",(t,e)=>{Cs.init(t,e),he.init(t,e);});function _v(t){return Ii(Au,t)}var Du=f("ZodCIDRv4",(t,e)=>{As.init(t,e),he.init(t,e);});function vv(t){return zi(Du,t)}var Uu=f("ZodCIDRv6",(t,e)=>{Ds.init(t,e),he.init(t,e);});function bv(t){return Pi(Uu,t)}var Zu=f("ZodBase64",(t,e)=>{Us.init(t,e),he.init(t,e);});function $v(t){return Ti(Zu,t)}var Mu=f("ZodBase64URL",(t,e)=>{Zs.init(t,e),he.init(t,e);});function xv(t){return Ei(Mu,t)}var Lu=f("ZodE164",(t,e)=>{Ms.init(t,e),he.init(t,e);});function kv(t){return Oi(Lu,t)}var qu=f("ZodJWT",(t,e)=>{Ls.init(t,e),he.init(t,e);});function wv(t){return ji(qu,t)}var no=f("ZodCustomStringFormat",(t,e)=>{qs.init(t,e),he.init(t,e);});function Sv(t,e,n={}){return Qr(no,t,e,n)}function Iv(t){return Qr(no,"hostname",Xe.hostname,t)}function zv(t){return Qr(no,"hex",Xe.hex,t)}function Pv(t,e){let n=e?.enc??"hex",o=`${t}_${n}`,r=Xe[o];if(!r)throw new Error(`Unrecognized hash format: ${o}`);return Qr(no,o,r,e)}var oo=f("ZodNumber",(t,e)=>{si.init(t,e),G.init(t,e),t._zod.processJSONSchema=(o,r,i)=>Up(t,o,r),t.gt=(o,r)=>t.check(St(o,r)),t.gte=(o,r)=>t.check(Ee(o,r)),t.min=(o,r)=>t.check(Ee(o,r)),t.lt=(o,r)=>t.check(wt(o,r)),t.lte=(o,r)=>t.check(Be(o,r)),t.max=(o,r)=>t.check(Be(o,r)),t.int=o=>t.check(Su(o)),t.safe=o=>t.check(Su(o)),t.positive=o=>t.check(St(0,o)),t.nonnegative=o=>t.check(Ee(0,o)),t.negative=o=>t.check(wt(0,o)),t.nonpositive=o=>t.check(Be(0,o)),t.multipleOf=(o,r)=>t.check(Xt(o,r)),t.step=(o,r)=>t.check(Xt(o,r)),t.finite=()=>t;let n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=true,t.format=n.format??null;});function ce(t){return Zc(oo,t)}var en=f("ZodNumberFormat",(t,e)=>{Fs.init(t,e),oo.init(t,e);});function Su(t){return Lc(en,t)}function Tv(t){return qc(en,t)}function Ev(t){return Fc(en,t)}function Ov(t){return Vc(en,t)}function jv(t){return Bc(en,t)}var io=f("ZodBoolean",(t,e)=>{Vn.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>Zp(t,n,o);});function Se(t){return Jc(io,t)}var ao=f("ZodBigInt",(t,e)=>{ci.init(t,e),G.init(t,e),t._zod.processJSONSchema=(o,r,i)=>Mp(t,o),t.gte=(o,r)=>t.check(Ee(o,r)),t.min=(o,r)=>t.check(Ee(o,r)),t.gt=(o,r)=>t.check(St(o,r)),t.gte=(o,r)=>t.check(Ee(o,r)),t.min=(o,r)=>t.check(Ee(o,r)),t.lt=(o,r)=>t.check(wt(o,r)),t.lte=(o,r)=>t.check(Be(o,r)),t.max=(o,r)=>t.check(Be(o,r)),t.positive=o=>t.check(St(BigInt(0),o)),t.negative=o=>t.check(wt(BigInt(0),o)),t.nonpositive=o=>t.check(Be(BigInt(0),o)),t.nonnegative=o=>t.check(Ee(BigInt(0),o)),t.multipleOf=(o,r)=>t.check(Xt(o,r));let n=t._zod.bag;t.minValue=n.minimum??null,t.maxValue=n.maximum??null,t.format=n.format??null;});function Rv(t){return Kc(ao,t)}var Fu=f("ZodBigIntFormat",(t,e)=>{Vs.init(t,e),ao.init(t,e);});function Cv(t){return Hc(Fu,t)}function Nv(t){return Xc(Fu,t)}var Dm=f("ZodSymbol",(t,e)=>{Bs.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>Lp(t,n);});function Av(t){return Yc(Dm,t)}var Um=f("ZodUndefined",(t,e)=>{Js.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>Fp(t,n);});function Dv(t){return Qc(Um,t)}var Zm=f("ZodNull",(t,e)=>{Gs.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>qp(t,n,o);});function Fi(t){return eu(Zm,t)}var Mm=f("ZodAny",(t,e)=>{Ks.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>Jp();});function Uv(){return tu(Mm)}var Lm=f("ZodUnknown",(t,e)=>{Ws.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>Gp();});function ye(){return ru(Lm)}var qm=f("ZodNever",(t,e)=>{Hs.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>Bp(t,n,o);});function Vu(t){return nu(qm,t)}var Fm=f("ZodVoid",(t,e)=>{Xs.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>Vp(t,n);});function Zv(t){return ou(Fm,t)}var Vi=f("ZodDate",(t,e)=>{Ys.init(t,e),G.init(t,e),t._zod.processJSONSchema=(o,r,i)=>Kp(t,o),t.min=(o,r)=>t.check(Ee(o,r)),t.max=(o,r)=>t.check(Be(o,r));let n=t._zod.bag;t.minDate=n.minimum?new Date(n.minimum):null,t.maxDate=n.maximum?new Date(n.maximum):null;});function Mv(t){return iu(Vi,t)}var Vm=f("ZodArray",(t,e)=>{Qs.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>am(t,n,o,r),t.element=e.element,t.min=(n,o)=>t.check(Dt(n,o)),t.nonempty=n=>t.check(Dt(1,n)),t.max=(n,o)=>t.check(hr(n,o)),t.length=(n,o)=>t.check(yr(n,o)),t.unwrap=()=>t.element;});function Q(t,e){return Np(Vm,t,e)}function Lv(t){let e=t._zod.def.shape;return je(Object.keys(e))}var Bi=f("ZodObject",(t,e)=>{Cp.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>sm(t,n,o,r),$.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>je(Object.keys(t._zod.def.shape)),t.catchall=n=>t.clone({...t._zod.def,catchall:n}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ye()}),t.loose=()=>t.clone({...t._zod.def,catchall:ye()}),t.strict=()=>t.clone({...t._zod.def,catchall:Vu()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=n=>$.extend(t,n),t.safeExtend=n=>$.safeExtend(t,n),t.merge=n=>$.merge(t,n),t.pick=n=>$.pick(t,n),t.omit=n=>$.omit(t,n),t.partial=(...n)=>$.partial(Ju,t,n[0]),t.required=(...n)=>$.required(Gu,t,n[0]);});function T(t,e){let n={type:"object",shape:t??{},...$.normalizeParams(e)};return new Bi(n)}function qv(t,e){return new Bi({type:"object",shape:t,catchall:Vu(),...$.normalizeParams(e)})}function Oe(t,e){return new Bi({type:"object",shape:t,catchall:ye(),...$.normalizeParams(e)})}var Ji=f("ZodUnion",(t,e)=>{Bn.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>hu(t,n,o,r),t.options=e.options;});function _e(t,e){return new Ji({type:"union",options:t,...$.normalizeParams(e)})}var Bm=f("ZodXor",(t,e)=>{Ji.init(t,e),ec.init(t,e),t._zod.processJSONSchema=(n,o,r)=>hu(t,n,o,r),t.options=e.options;});function Fv(t,e){return new Bm({type:"union",options:t,inclusive:false,...$.normalizeParams(e)})}var Jm=f("ZodDiscriminatedUnion",(t,e)=>{Ji.init(t,e),tc.init(t,e);});function Gi(t,e,n){return new Jm({type:"union",options:e,discriminator:t,...$.normalizeParams(n)})}var Gm=f("ZodIntersection",(t,e)=>{rc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>cm(t,n,o,r);});function so(t,e){return new Gm({type:"intersection",left:t,right:e})}var Km=f("ZodTuple",(t,e)=>{ui.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>um(t,n,o,r),t.rest=n=>t.clone({...t._zod.def,rest:n});});function Wm(t,e,n){let o=e instanceof L,r=o?n:e,i=o?e:null;return new Km({type:"tuple",items:t,rest:i,...$.normalizeParams(r)})}var Ki=f("ZodRecord",(t,e)=>{nc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>lm(t,n,o,r),t.keyType=e.keyType,t.valueType=e.valueType;});function fe(t,e,n){return new Ki({type:"record",keyType:t,valueType:e,...$.normalizeParams(n)})}function Vv(t,e,n){let o=Te(t);return o._zod.values=void 0,new Ki({type:"record",keyType:o,valueType:e,...$.normalizeParams(n)})}function Bv(t,e,n){return new Ki({type:"record",keyType:t,valueType:e,mode:"loose",...$.normalizeParams(n)})}var Hm=f("ZodMap",(t,e)=>{oc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>om(t,n),t.keyType=e.keyType,t.valueType=e.valueType,t.min=(...n)=>t.check(It(...n)),t.nonempty=n=>t.check(It(1,n)),t.max=(...n)=>t.check(Yt(...n)),t.size=(...n)=>t.check(gr(...n));});function Jv(t,e,n){return new Hm({type:"map",keyType:t,valueType:e,...$.normalizeParams(n)})}var Xm=f("ZodSet",(t,e)=>{ic.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>im(t,n),t.min=(...n)=>t.check(It(...n)),t.nonempty=n=>t.check(It(1,n)),t.max=(...n)=>t.check(Yt(...n)),t.size=(...n)=>t.check(gr(...n));});function Gv(t,e){return new Xm({type:"set",valueType:t,...$.normalizeParams(e)})}var to=f("ZodEnum",(t,e)=>{ac.init(t,e),G.init(t,e),t._zod.processJSONSchema=(o,r,i)=>Wp(t,o,r),t.enum=e.entries,t.options=Object.values(e.entries);let n=new Set(Object.keys(e.entries));t.extract=(o,r)=>{let i={};for(let a of o)if(n.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new to({...e,checks:[],...$.normalizeParams(r),entries:i})},t.exclude=(o,r)=>{let i={...e.entries};for(let a of o)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new to({...e,checks:[],...$.normalizeParams(r),entries:i})};});function je(t,e){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new to({type:"enum",entries:n,...$.normalizeParams(e)})}function Kv(t,e){return new to({type:"enum",entries:t,...$.normalizeParams(e)})}var Ym=f("ZodLiteral",(t,e)=>{sc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>Hp(t,n,o),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 j(t,e){return new Ym({type:"literal",values:Array.isArray(t)?t:[t],...$.normalizeParams(e)})}var Qm=f("ZodFile",(t,e)=>{cc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>Qp(t,n,o),t.min=(n,o)=>t.check(It(n,o)),t.max=(n,o)=>t.check(Yt(n,o)),t.mime=(n,o)=>t.check(Kr(Array.isArray(n)?n:[n],o));});function Wv(t){return cu(Qm,t)}var ef=f("ZodTransform",(t,e)=>{uc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>nm(t,n),t._zod.parse=(n,o)=>{if(o.direction==="backward")throw new ur(t.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push($.issue(i,n.value,e));else {let a=i;a.fatal&&(a.continue=false),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=t),n.issues.push($.issue(a));}};let r=e.transform(n.value,n);return r instanceof Promise?r.then(i=>(n.value=i,n)):(n.value=r,n)};});function Bu(t){return new ef({type:"transform",transform:t})}var Ju=f("ZodOptional",(t,e)=>{li.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>yu(t,n,o,r),t.unwrap=()=>t._zod.def.innerType;});function be(t){return new Ju({type:"optional",innerType:t})}var tf=f("ZodExactOptional",(t,e)=>{lc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>yu(t,n,o,r),t.unwrap=()=>t._zod.def.innerType;});function rf(t){return new tf({type:"optional",innerType:t})}var nf=f("ZodNullable",(t,e)=>{dc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>dm(t,n,o,r),t.unwrap=()=>t._zod.def.innerType;});function Mi(t){return new nf({type:"nullable",innerType:t})}function Hv(t){return be(Mi(t))}var of=f("ZodDefault",(t,e)=>{pc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>mm(t,n,o,r),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap;});function af(t,e){return new of({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():$.shallowClone(e)}})}var sf=f("ZodPrefault",(t,e)=>{mc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>fm(t,n,o,r),t.unwrap=()=>t._zod.def.innerType;});function cf(t,e){return new sf({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():$.shallowClone(e)}})}var Gu=f("ZodNonOptional",(t,e)=>{fc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>pm(t,n,o,r),t.unwrap=()=>t._zod.def.innerType;});function uf(t,e){return new Gu({type:"nonoptional",innerType:t,...$.normalizeParams(e)})}var lf=f("ZodSuccess",(t,e)=>{gc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>em(t,n,o),t.unwrap=()=>t._zod.def.innerType;});function Xv(t){return new lf({type:"success",innerType:t})}var df=f("ZodCatch",(t,e)=>{hc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>gm(t,n,o,r),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap;});function pf(t,e){return new df({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var mf=f("ZodNaN",(t,e)=>{yc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>Xp(t,n);});function Yv(t){return su(mf,t)}var Ku=f("ZodPipe",(t,e)=>{_c.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>hm(t,n,o,r),t.in=e.in,t.out=e.out;});function Li(t,e){return new Ku({type:"pipe",in:t,out:e})}var Wu=f("ZodCodec",(t,e)=>{Ku.init(t,e),Jn.init(t,e);});function Qv(t,e,n){return new Wu({type:"pipe",in:t,out:e,transform:n.decode,reverseTransform:n.encode})}var ff=f("ZodReadonly",(t,e)=>{vc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>ym(t,n,o,r),t.unwrap=()=>t._zod.def.innerType;});function gf(t){return new ff({type:"readonly",innerType:t})}var hf=f("ZodTemplateLiteral",(t,e)=>{bc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>Yp(t,n,o);});function eb(t,e){return new hf({type:"template_literal",parts:t,...$.normalizeParams(e)})}var yf=f("ZodLazy",(t,e)=>{kc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>vm(t,n,o,r),t.unwrap=()=>t._zod.def.getter();});function _f(t){return new yf({type:"lazy",getter:t})}var vf=f("ZodPromise",(t,e)=>{xc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>_m(t,n,o,r),t.unwrap=()=>t._zod.def.innerType;});function tb(t){return new vf({type:"promise",innerType:t})}var bf=f("ZodFunction",(t,e)=>{$c.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>rm(t,n);});function rb(t){return new bf({type:"function",input:Array.isArray(t?.input)?Wm(t?.input):t?.input??Q(ye()),output:t?.output??ye()})}var Wi=f("ZodCustom",(t,e)=>{wc.init(t,e),G.init(t,e),t._zod.processJSONSchema=(n,o,r)=>tm(t,n);});function nb(t){let e=new ge({check:"custom"});return e._zod.check=t,e}function Hu(t,e){return uu(Wi,t??(()=>true),e)}function $f(t,e={}){return lu(Wi,t,e)}function xf(t){return du(t)}var ob=pu,ib=mu;function ab(t,e={}){let n=new Wi({type:"custom",check:"custom",fn:o=>o instanceof t,abort:true,...$.normalizeParams(e)});return n._zod.bag.Class=t,n._zod.check=o=>{o.value instanceof t||o.issues.push({code:"invalid_type",expected:t.name,input:o.value,inst:n,path:[...n._zod.def.path??[]]});},n}var sb=(...t)=>fu({Codec:Wu,Boolean:io,String:ro},...t);function cb(t){let e=_f(()=>_e([y(t),ce(),Se(),Fi(),Q(e),fe(y(),e)]));return e}function Hi(t,e){return Li(Bu(t),e)}var O0={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function j0(t){we({customError:t});}function R0(){return we().customError}var kf;kf||(kf={});var I={...Ui,...bu,iso:xr},C0=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function N0(t,e){let n=t.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":e??"draft-2020-12"}function A0(t,e){if(!t.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=t.slice(1).split("/").filter(Boolean);if(n.length===0)return e.rootSchema;let o=e.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===o){let r=n[1];if(!r||!e.defs[r])throw new Error(`Reference not found: ${t}`);return e.defs[r]}throw new Error(`Reference not found: ${t}`)}function ub(t,e){if(t.not!==void 0){if(typeof t.not=="object"&&Object.keys(t.not).length===0)return I.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(t.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(t.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(t.if!==void 0||t.then!==void 0||t.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(t.dependentSchemas!==void 0||t.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(t.$ref){let r=t.$ref;if(e.refs.has(r))return e.refs.get(r);if(e.processing.has(r))return I.lazy(()=>{if(!e.refs.has(r))throw new Error(`Circular reference not resolved: ${r}`);return e.refs.get(r)});e.processing.add(r);let i=A0(r,e),a=Ze(i,e);return e.refs.set(r,a),e.processing.delete(r),a}if(t.enum!==void 0){let r=t.enum;if(e.version==="openapi-3.0"&&t.nullable===true&&r.length===1&&r[0]===null)return I.null();if(r.length===0)return I.never();if(r.length===1)return I.literal(r[0]);if(r.every(a=>typeof a=="string"))return I.enum(r);let i=r.map(a=>I.literal(a));return i.length<2?i[0]:I.union([i[0],i[1],...i.slice(2)])}if(t.const!==void 0)return I.literal(t.const);let n=t.type;if(Array.isArray(n)){let r=n.map(i=>{let a={...t,type:i};return ub(a,e)});return r.length===0?I.never():r.length===1?r[0]:I.union(r)}if(!n)return I.any();let o;switch(n){case "string":{let r=I.string();if(t.format){let i=t.format;i==="email"?r=r.check(I.email()):i==="uri"||i==="uri-reference"?r=r.check(I.url()):i==="uuid"||i==="guid"?r=r.check(I.uuid()):i==="date-time"?r=r.check(I.iso.datetime()):i==="date"?r=r.check(I.iso.date()):i==="time"?r=r.check(I.iso.time()):i==="duration"?r=r.check(I.iso.duration()):i==="ipv4"?r=r.check(I.ipv4()):i==="ipv6"?r=r.check(I.ipv6()):i==="mac"?r=r.check(I.mac()):i==="cidr"?r=r.check(I.cidrv4()):i==="cidr-v6"?r=r.check(I.cidrv6()):i==="base64"?r=r.check(I.base64()):i==="base64url"?r=r.check(I.base64url()):i==="e164"?r=r.check(I.e164()):i==="jwt"?r=r.check(I.jwt()):i==="emoji"?r=r.check(I.emoji()):i==="nanoid"?r=r.check(I.nanoid()):i==="cuid"?r=r.check(I.cuid()):i==="cuid2"?r=r.check(I.cuid2()):i==="ulid"?r=r.check(I.ulid()):i==="xid"?r=r.check(I.xid()):i==="ksuid"&&(r=r.check(I.ksuid()));}typeof t.minLength=="number"&&(r=r.min(t.minLength)),typeof t.maxLength=="number"&&(r=r.max(t.maxLength)),t.pattern&&(r=r.regex(new RegExp(t.pattern))),o=r;break}case "number":case "integer":{let r=n==="integer"?I.number().int():I.number();typeof t.minimum=="number"&&(r=r.min(t.minimum)),typeof t.maximum=="number"&&(r=r.max(t.maximum)),typeof t.exclusiveMinimum=="number"?r=r.gt(t.exclusiveMinimum):t.exclusiveMinimum===true&&typeof t.minimum=="number"&&(r=r.gt(t.minimum)),typeof t.exclusiveMaximum=="number"?r=r.lt(t.exclusiveMaximum):t.exclusiveMaximum===true&&typeof t.maximum=="number"&&(r=r.lt(t.maximum)),typeof t.multipleOf=="number"&&(r=r.multipleOf(t.multipleOf)),o=r;break}case "boolean":{o=I.boolean();break}case "null":{o=I.null();break}case "object":{let r={},i=t.properties||{},a=new Set(t.required||[]);for(let[c,u]of Object.entries(i)){let l=Ze(u,e);r[c]=a.has(c)?l:l.optional();}if(t.propertyNames){let c=Ze(t.propertyNames,e),u=t.additionalProperties&&typeof t.additionalProperties=="object"?Ze(t.additionalProperties,e):I.any();if(Object.keys(r).length===0){o=I.record(c,u);break}let l=I.object(r).passthrough(),d=I.looseRecord(c,u);o=I.intersection(l,d);break}if(t.patternProperties){let c=t.patternProperties,u=Object.keys(c),l=[];for(let p of u){let m=Ze(c[p],e),g=I.string().regex(new RegExp(p));l.push(I.looseRecord(g,m));}let d=[];if(Object.keys(r).length>0&&d.push(I.object(r).passthrough()),d.push(...l),d.length===0)o=I.object({}).passthrough();else if(d.length===1)o=d[0];else {let p=I.intersection(d[0],d[1]);for(let m=2;m<d.length;m++)p=I.intersection(p,d[m]);o=p;}break}let s=I.object(r);t.additionalProperties===false?o=s.strict():typeof t.additionalProperties=="object"?o=s.catchall(Ze(t.additionalProperties,e)):o=s.passthrough();break}case "array":{let r=t.prefixItems,i=t.items;if(r&&Array.isArray(r)){let a=r.map(c=>Ze(c,e)),s=i&&typeof i=="object"&&!Array.isArray(i)?Ze(i,e):void 0;s?o=I.tuple(a).rest(s):o=I.tuple(a),typeof t.minItems=="number"&&(o=o.check(I.minLength(t.minItems))),typeof t.maxItems=="number"&&(o=o.check(I.maxLength(t.maxItems)));}else if(Array.isArray(i)){let a=i.map(c=>Ze(c,e)),s=t.additionalItems&&typeof t.additionalItems=="object"?Ze(t.additionalItems,e):void 0;s?o=I.tuple(a).rest(s):o=I.tuple(a),typeof t.minItems=="number"&&(o=o.check(I.minLength(t.minItems))),typeof t.maxItems=="number"&&(o=o.check(I.maxLength(t.maxItems)));}else if(i!==void 0){let a=Ze(i,e),s=I.array(a);typeof t.minItems=="number"&&(s=s.min(t.minItems)),typeof t.maxItems=="number"&&(s=s.max(t.maxItems)),o=s;}else o=I.array(I.any());break}default:throw new Error(`Unsupported type: ${n}`)}return t.description&&(o=o.describe(t.description)),t.default!==void 0&&(o=o.default(t.default)),o}function Ze(t,e){if(typeof t=="boolean")return t?I.any():I.never();let n=ub(t,e),o=t.type||t.enum!==void 0||t.const!==void 0;if(t.anyOf&&Array.isArray(t.anyOf)){let s=t.anyOf.map(u=>Ze(u,e)),c=I.union(s);n=o?I.intersection(n,c):c;}if(t.oneOf&&Array.isArray(t.oneOf)){let s=t.oneOf.map(u=>Ze(u,e)),c=I.xor(s);n=o?I.intersection(n,c):c;}if(t.allOf&&Array.isArray(t.allOf))if(t.allOf.length===0)n=o?n:I.any();else {let s=o?n:Ze(t.allOf[0],e),c=o?0:1;for(let u=c;u<t.allOf.length;u++)s=I.intersection(s,Ze(t.allOf[u],e));n=s;}t.nullable===true&&e.version==="openapi-3.0"&&(n=I.nullable(n)),t.readOnly===true&&(n=I.readonly(n));let r={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of i)s in t&&(r[s]=t[s]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let s of a)s in t&&(r[s]=t[s]);for(let s of Object.keys(t))C0.has(s)||(r[s]=t[s]);return Object.keys(r).length>0&&e.registry.add(n,r),n}function lb(t,e){if(typeof t=="boolean")return t?I.any():I.never();let n=N0(t,e?.defaultTarget),o=t.$defs||t.definitions||{},r={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:t,registry:e?.registry??Pe};return Ze(t,r)}var wf={};Bt(wf,{bigint:()=>M0,boolean:()=>Z0,date:()=>L0,number:()=>U0,string:()=>D0});function D0(t){return jc(ro,t)}function U0(t){return Mc(oo,t)}function Z0(t){return Gc(io,t)}function M0(t){return Wc(ao,t)}function L0(t){return au(Vi,t)}we(Sc());var If="2025-11-25";var db=[If,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],kr="io.modelcontextprotocol/related-task",Yu="2.0",ze=Hu(t=>t!==null&&(typeof t=="object"||typeof t=="function")),pb=_e([y(),ce().int()]),mb=y();Oe({ttl:ce().optional(),pollInterval:ce().optional()});var F0=T({ttl:ce().optional()}),V0=T({taskId:y()}),zf=Oe({progressToken:pb.optional(),[kr]:V0.optional()}),ct=T({_meta:zf.optional()}),Xi=ct.extend({task:F0.optional()}),fb=t=>Xi.safeParse(t).success,Re=T({method:y(),params:ct.loose().optional()}),pt=T({_meta:zf.optional()}),mt=T({method:y(),params:pt.loose().optional()}),Ce=Oe({_meta:zf.optional()}),Qu=_e([y(),ce().int()]),gb=T({jsonrpc:j(Yu),id:Qu,...Re.shape}).strict(),Pf=t=>gb.safeParse(t).success,hb=T({jsonrpc:j(Yu),...mt.shape}).strict(),yb=t=>hb.safeParse(t).success,Tf=T({jsonrpc:j(Yu),id:Qu,result:Ce}).strict(),Yi=t=>Tf.safeParse(t).success;var oe;(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";})(oe||(oe={}));var Ef=T({jsonrpc:j(Yu),id:Qu.optional(),error:T({code:ce().int(),message:y(),data:ye().optional()})}).strict();var _b=t=>Ef.safeParse(t).success;var vb=_e([gb,hb,Tf,Ef]);_e([Tf,Ef]);var el=Ce.strict(),B0=pt.extend({requestId:Qu.optional(),reason:y().optional()}),tl=mt.extend({method:j("notifications/cancelled"),params:B0}),J0=T({src:y(),mimeType:y().optional(),sizes:Q(y()).optional(),theme:je(["light","dark"]).optional()}),Qi=T({icons:Q(J0).optional()}),co=T({name:y(),title:y().optional()}),bb=co.extend({...co.shape,...Qi.shape,version:y(),websiteUrl:y().optional(),description:y().optional()}),G0=so(T({applyDefaults:Se().optional()}),fe(y(),ye())),K0=Hi(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,so(T({form:G0.optional(),url:ze.optional()}),fe(y(),ye()).optional())),W0=Oe({list:ze.optional(),cancel:ze.optional(),requests:Oe({sampling:Oe({createMessage:ze.optional()}).optional(),elicitation:Oe({create:ze.optional()}).optional()}).optional()}),H0=Oe({list:ze.optional(),cancel:ze.optional(),requests:Oe({tools:Oe({call:ze.optional()}).optional()}).optional()}),X0=T({experimental:fe(y(),ze).optional(),sampling:T({context:ze.optional(),tools:ze.optional()}).optional(),elicitation:K0.optional(),roots:T({listChanged:Se().optional()}).optional(),tasks:W0.optional(),extensions:fe(y(),ze).optional()}),Y0=ct.extend({protocolVersion:y(),capabilities:X0,clientInfo:bb}),Of=Re.extend({method:j("initialize"),params:Y0});var Q0=T({experimental:fe(y(),ze).optional(),logging:ze.optional(),completions:ze.optional(),prompts:T({listChanged:Se().optional()}).optional(),resources:T({subscribe:Se().optional(),listChanged:Se().optional()}).optional(),tools:T({listChanged:Se().optional()}).optional(),tasks:H0.optional(),extensions:fe(y(),ze).optional()}),ez=Ce.extend({protocolVersion:y(),capabilities:Q0,serverInfo:bb,instructions:y().optional()}),jf=mt.extend({method:j("notifications/initialized"),params:pt.optional()});var rl=Re.extend({method:j("ping"),params:ct.optional()}),tz=T({progress:ce(),total:be(ce()),message:be(y())}),rz=T({...pt.shape,...tz.shape,progressToken:pb}),nl=mt.extend({method:j("notifications/progress"),params:rz}),nz=ct.extend({cursor:mb.optional()}),ea=Re.extend({params:nz.optional()}),ta=Ce.extend({nextCursor:mb.optional()}),oz=je(["working","input_required","completed","failed","cancelled"]),ra=T({taskId:y(),status:oz,ttl:_e([ce(),Fi()]),createdAt:y(),lastUpdatedAt:y(),pollInterval:be(ce()),statusMessage:be(y())}),uo=Ce.extend({task:ra}),iz=pt.merge(ra),na=mt.extend({method:j("notifications/tasks/status"),params:iz}),ol=Re.extend({method:j("tasks/get"),params:ct.extend({taskId:y()})}),il=Ce.merge(ra),al=Re.extend({method:j("tasks/result"),params:ct.extend({taskId:y()})});Ce.loose();var sl=ea.extend({method:j("tasks/list")}),cl=ta.extend({tasks:Q(ra)}),ul=Re.extend({method:j("tasks/cancel"),params:ct.extend({taskId:y()})}),$b=Ce.merge(ra),xb=T({uri:y(),mimeType:be(y()),_meta:fe(y(),ye()).optional()}),kb=xb.extend({text:y()}),Rf=y().refine(t=>{try{return atob(t),!0}catch{return false}},{message:"Invalid Base64 string"}),wb=xb.extend({blob:Rf}),oa=je(["user","assistant"]),lo=T({audience:Q(oa).optional(),priority:ce().min(0).max(1).optional(),lastModified:xr.datetime({offset:true}).optional()}),Sb=T({...co.shape,...Qi.shape,uri:y(),description:be(y()),mimeType:be(y()),size:be(ce()),annotations:lo.optional(),_meta:be(Oe({}))}),az=T({...co.shape,...Qi.shape,uriTemplate:y(),description:be(y()),mimeType:be(y()),annotations:lo.optional(),_meta:be(Oe({}))}),sz=ea.extend({method:j("resources/list")}),cz=ta.extend({resources:Q(Sb)}),uz=ea.extend({method:j("resources/templates/list")}),lz=ta.extend({resourceTemplates:Q(az)}),Cf=ct.extend({uri:y()}),dz=Cf,pz=Re.extend({method:j("resources/read"),params:dz}),mz=Ce.extend({contents:Q(_e([kb,wb]))}),fz=mt.extend({method:j("notifications/resources/list_changed"),params:pt.optional()}),gz=Cf,hz=Re.extend({method:j("resources/subscribe"),params:gz}),yz=Cf,_z=Re.extend({method:j("resources/unsubscribe"),params:yz}),vz=pt.extend({uri:y()}),bz=mt.extend({method:j("notifications/resources/updated"),params:vz}),$z=T({name:y(),description:be(y()),required:be(Se())}),xz=T({...co.shape,...Qi.shape,description:be(y()),arguments:be(Q($z)),_meta:be(Oe({}))}),kz=ea.extend({method:j("prompts/list")}),wz=ta.extend({prompts:Q(xz)}),Sz=ct.extend({name:y(),arguments:fe(y(),y()).optional()}),Iz=Re.extend({method:j("prompts/get"),params:Sz}),Nf=T({type:j("text"),text:y(),annotations:lo.optional(),_meta:fe(y(),ye()).optional()}),Af=T({type:j("image"),data:Rf,mimeType:y(),annotations:lo.optional(),_meta:fe(y(),ye()).optional()}),Df=T({type:j("audio"),data:Rf,mimeType:y(),annotations:lo.optional(),_meta:fe(y(),ye()).optional()}),zz=T({type:j("tool_use"),name:y(),id:y(),input:fe(y(),ye()),_meta:fe(y(),ye()).optional()}),Pz=T({type:j("resource"),resource:_e([kb,wb]),annotations:lo.optional(),_meta:fe(y(),ye()).optional()}),Tz=Sb.extend({type:j("resource_link")}),Uf=_e([Nf,Af,Df,Tz,Pz]),Ez=T({role:oa,content:Uf}),Oz=Ce.extend({description:y().optional(),messages:Q(Ez)}),jz=mt.extend({method:j("notifications/prompts/list_changed"),params:pt.optional()}),Rz=T({title:y().optional(),readOnlyHint:Se().optional(),destructiveHint:Se().optional(),idempotentHint:Se().optional(),openWorldHint:Se().optional()}),Cz=T({taskSupport:je(["required","optional","forbidden"]).optional()}),Ib=T({...co.shape,...Qi.shape,description:y().optional(),inputSchema:T({type:j("object"),properties:fe(y(),ze).optional(),required:Q(y()).optional()}).catchall(ye()),outputSchema:T({type:j("object"),properties:fe(y(),ze).optional(),required:Q(y()).optional()}).catchall(ye()).optional(),annotations:Rz.optional(),execution:Cz.optional(),_meta:fe(y(),ye()).optional()}),Zf=ea.extend({method:j("tools/list")}),Nz=ta.extend({tools:Q(Ib)}),ll=Ce.extend({content:Q(Uf).default([]),structuredContent:fe(y(),ye()).optional(),isError:Se().optional()});ll.or(Ce.extend({toolResult:ye()}));var Az=Xi.extend({name:y(),arguments:fe(y(),ye()).optional()}),ia=Re.extend({method:j("tools/call"),params:Az}),Dz=mt.extend({method:j("notifications/tools/list_changed"),params:pt.optional()});T({autoRefresh:Se().default(true),debounceMs:ce().int().nonnegative().default(300)});var aa=je(["debug","info","notice","warning","error","critical","alert","emergency"]),Uz=ct.extend({level:aa}),Mf=Re.extend({method:j("logging/setLevel"),params:Uz}),Zz=pt.extend({level:aa,logger:y().optional(),data:ye()}),Mz=mt.extend({method:j("notifications/message"),params:Zz}),Lz=T({name:y().optional()}),qz=T({hints:Q(Lz).optional(),costPriority:ce().min(0).max(1).optional(),speedPriority:ce().min(0).max(1).optional(),intelligencePriority:ce().min(0).max(1).optional()}),Fz=T({mode:je(["auto","required","none"]).optional()}),Vz=T({type:j("tool_result"),toolUseId:y().describe("The unique identifier for the corresponding tool call."),content:Q(Uf).default([]),structuredContent:T({}).loose().optional(),isError:Se().optional(),_meta:fe(y(),ye()).optional()}),Bz=Gi("type",[Nf,Af,Df]),Xu=Gi("type",[Nf,Af,Df,zz,Vz]),Jz=T({role:oa,content:_e([Xu,Q(Xu)]),_meta:fe(y(),ye()).optional()}),Gz=Xi.extend({messages:Q(Jz),modelPreferences:qz.optional(),systemPrompt:y().optional(),includeContext:je(["none","thisServer","allServers"]).optional(),temperature:ce().optional(),maxTokens:ce().int(),stopSequences:Q(y()).optional(),metadata:ze.optional(),tools:Q(Ib).optional(),toolChoice:Fz.optional()}),Kz=Re.extend({method:j("sampling/createMessage"),params:Gz}),sa=Ce.extend({model:y(),stopReason:be(je(["endTurn","stopSequence","maxTokens"]).or(y())),role:oa,content:Bz}),Lf=Ce.extend({model:y(),stopReason:be(je(["endTurn","stopSequence","maxTokens","toolUse"]).or(y())),role:oa,content:_e([Xu,Q(Xu)])}),Wz=T({type:j("boolean"),title:y().optional(),description:y().optional(),default:Se().optional()}),Hz=T({type:j("string"),title:y().optional(),description:y().optional(),minLength:ce().optional(),maxLength:ce().optional(),format:je(["email","uri","date","date-time"]).optional(),default:y().optional()}),Xz=T({type:je(["number","integer"]),title:y().optional(),description:y().optional(),minimum:ce().optional(),maximum:ce().optional(),default:ce().optional()}),Yz=T({type:j("string"),title:y().optional(),description:y().optional(),enum:Q(y()),default:y().optional()}),Qz=T({type:j("string"),title:y().optional(),description:y().optional(),oneOf:Q(T({const:y(),title:y()})),default:y().optional()}),eP=T({type:j("string"),title:y().optional(),description:y().optional(),enum:Q(y()),enumNames:Q(y()).optional(),default:y().optional()}),tP=_e([Yz,Qz]),rP=T({type:j("array"),title:y().optional(),description:y().optional(),minItems:ce().optional(),maxItems:ce().optional(),items:T({type:j("string"),enum:Q(y())}),default:Q(y()).optional()}),nP=T({type:j("array"),title:y().optional(),description:y().optional(),minItems:ce().optional(),maxItems:ce().optional(),items:T({anyOf:Q(T({const:y(),title:y()}))}),default:Q(y()).optional()}),oP=_e([rP,nP]),iP=_e([eP,tP,oP]),aP=_e([iP,Wz,Hz,Xz]),sP=Xi.extend({mode:j("form").optional(),message:y(),requestedSchema:T({type:j("object"),properties:fe(y(),aP),required:Q(y()).optional()})}),cP=Xi.extend({mode:j("url"),message:y(),elicitationId:y(),url:y().url()}),uP=_e([sP,cP]),lP=Re.extend({method:j("elicitation/create"),params:uP}),dP=pt.extend({elicitationId:y()}),pP=mt.extend({method:j("notifications/elicitation/complete"),params:dP}),po=Ce.extend({action:je(["accept","decline","cancel"]),content:Hi(t=>t===null?void 0:t,fe(y(),_e([y(),ce(),Se(),Q(y())])).optional())}),mP=T({type:j("ref/resource"),uri:y()});var fP=T({type:j("ref/prompt"),name:y()}),gP=ct.extend({ref:_e([fP,mP]),argument:T({name:y(),value:y()}),context:T({arguments:fe(y(),y()).optional()}).optional()}),hP=Re.extend({method:j("completion/complete"),params:gP});var yP=Ce.extend({completion:Oe({values:Q(y()).max(100),total:be(ce().int()),hasMore:be(Se())})}),_P=T({uri:y().startsWith("file://"),name:y().optional(),_meta:fe(y(),ye()).optional()}),vP=Re.extend({method:j("roots/list"),params:ct.optional()}),qf=Ce.extend({roots:Q(_P)}),bP=mt.extend({method:j("notifications/roots/list_changed"),params:pt.optional()});_e([rl,Of,hP,Mf,Iz,kz,sz,uz,pz,hz,_z,ia,Zf,ol,al,sl,ul]);_e([tl,nl,jf,bP,na]);_e([el,sa,Lf,po,qf,il,cl,uo]);_e([rl,Kz,lP,vP,ol,al,sl,ul]);_e([tl,nl,Mz,bz,fz,Dz,jz,na,pP]);_e([el,ez,yP,Oz,wz,cz,lz,mz,ll,Nz,il,cl,uo]);var W=class t extends Error{constructor(e,n,o){super(`MCP error ${e}: ${n}`),this.code=e,this.data=o,this.name="McpError";}static fromError(e,n,o){if(e===oe.UrlElicitationRequired&&o){let r=o;if(r.elicitations)return new Sf(r.elicitations,n)}return new t(e,n,o)}},Sf=class extends W{constructor(e,n=`URL elicitation${e.length>1?"s":""} required`){super(oe.UrlElicitationRequired,n,{elicitations:e});}get elicitations(){return this.data?.elicitations??[]}};function wr(t){return t==="completed"||t==="failed"||t==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ff(t){let n=vu(t)?.method;if(!n)throw new Error("Schema is missing a method literal");let o=Q_(n);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function Vf(t,e){let n=$r(t,e);if(!n.success)throw n.error;return n.data}var IP=6e4,dl=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(tl,n=>{this._oncancel(n);}),this.setNotificationHandler(nl,n=>{this._onprogress(n);}),this.setRequestHandler(rl,n=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ol,async(n,o)=>{let r=await this._taskStore.getTask(n.params.taskId,o.sessionId);if(!r)throw new W(oe.InvalidParams,"Failed to retrieve task: Task not found");return {...r}}),this.setRequestHandler(al,async(n,o)=>{let r=async()=>{let i=n.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,o.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else {let d=c,p=new W(d.error.code,d.error.message,d.error.data);l(p);}else {let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`));}continue}await this._transport?.send(s.message,{relatedRequestId:o.requestId});}}let a=await this._taskStore.getTask(i,o.sessionId);if(!a)throw new W(oe.InvalidParams,`Task not found: ${i}`);if(!wr(a.status))return await this._waitForTaskUpdate(i,o.signal),await r();if(wr(a.status)){let s=await this._taskStore.getTaskResult(i,o.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[kr]:{taskId:i}}}}return await r()};return await r()}),this.setRequestHandler(sl,async(n,o)=>{try{let{tasks:r,nextCursor:i}=await this._taskStore.listTasks(n.params?.cursor,o.sessionId);return {tasks:r,nextCursor:i,_meta:{}}}catch(r){throw new W(oe.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(ul,async(n,o)=>{try{let r=await this._taskStore.getTask(n.params.taskId,o.sessionId);if(!r)throw new W(oe.InvalidParams,`Task not found: ${n.params.taskId}`);if(wr(r.status))throw new W(oe.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(n.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(n.params.taskId);let i=await this._taskStore.getTask(n.params.taskId,o.sessionId);if(!i)throw new W(oe.InvalidParams,`Task not found after cancellation: ${n.params.taskId}`);return {_meta:{},...i}}catch(r){throw r instanceof W?r:new W(oe.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}));}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason);}_setupTimeout(e,n,o,r,i=false){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,n),startTime:Date.now(),timeout:n,maxTotalTimeout:o,resetTimeoutOnProgress:i,onTimeout:r});}_resetTimeout(e){let n=this._timeoutInfo.get(e);if(!n)return false;let o=Date.now()-n.startTime;if(n.maxTotalTimeout&&o>=n.maxTotalTimeout)throw this._timeoutInfo.delete(e),W.fromError(oe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:n.maxTotalTimeout,totalElapsed:o});return clearTimeout(n.timeoutId),n.timeoutId=setTimeout(n.onTimeout,n.timeout),true}_cleanupTimeout(e){let n=this._timeoutInfo.get(e);n&&(clearTimeout(n.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 n=this.transport?.onclose;this._transport.onclose=()=>{n?.(),this._onclose();};let o=this.transport?.onerror;this._transport.onerror=i=>{o?.(i),this._onerror(i);};let r=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{r?.(i,a),Yi(i)||_b(i)?this._onresponse(i):Pf(i)?this._onrequest(i,a):yb(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`));},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 n=W.fromError(oe.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of e.values())o(n);}_onerror(e){this.onerror?.(e);}_onnotification(e){let n=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)));}_onrequest(e,n){let o=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[kr]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:oe.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},r?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):r?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let s=fb(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,u={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:e.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d);},sendRequest:async(l,d,p)=>{if(a.signal.aborted)throw new W(oe.ConnectionClosed,"Request was cancelled");let m={...p,relatedRequestId:e.id};i&&!m.relatedTask&&(m.relatedTask={taskId:i});let g=m.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,d,m)},authInfo:n?.authInfo,requestId:e.id,requestInfo:n?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:n?.closeSSEStream,closeStandaloneSSEStream:n?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method);}).then(()=>o(e,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},r?.sessionId):await r?.send(d);},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:oe.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},r?.sessionId):await r?.send(d);}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===a&&this._requestHandlerAbortControllers.delete(e.id);});}_onprogress(e){let{progressToken:n,...o}=e.params,r=Number(n),i=this._progressHandlers.get(r);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),s=this._timeoutInfo.get(r);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(r);}catch(c){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(c);return}i(o);}_onresponse(e){let n=Number(e.id),o=this._requestResolvers.get(n);if(o){if(this._requestResolvers.delete(n),Yi(e))o(e);else {let a=new W(e.error.code,e.error.message,e.error.data);o(a);}return}let r=this._responseHandlers.get(n);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(n),this._cleanupTimeout(n);let i=false;if(Yi(e)&&e.result&&typeof e.result=="object"){let a=e.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=true,this._taskProgressTokens.set(s.taskId,n));}}if(i||this._progressHandlers.delete(n),Yi(e))r(e);else {let a=W.fromError(e.error.code,e.error.message,e.error.data);r(a);}}get transport(){return this._transport}async close(){await this._transport?.close();}async*requestStream(e,n,o){let{task:r}=o??{};if(!r){try{yield {type:"result",result:await this.request(e,n,o)};}catch(a){yield {type:"error",error:a instanceof W?a:new W(oe.InternalError,String(a))};}return}let i;try{let a=await this.request(e,uo,o);if(a.task)i=a.task.taskId,yield {type:"taskCreated",task:a.task};else throw new W(oe.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},o);if(yield {type:"taskStatus",task:s},wr(s.status)){s.status==="completed"?yield {type:"result",result:await this.getTaskResult({taskId:i},n,o)}:s.status==="failed"?yield {type:"error",error:new W(oe.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield {type:"error",error:new W(oe.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield {type:"result",result:await this.getTaskResult({taskId:i},n,o)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted();}}catch(a){yield {type:"error",error:a instanceof W?a:new W(oe.InternalError,String(a))};}}request(e,n,o){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=o??{};return new Promise((u,l)=>{let d=U=>{l(U);};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===true)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method);}catch(U){d(U);return}o?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};o?.onprogress&&(this._progressHandlers.set(p,o.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),s&&(m.params={...m.params,task:s}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[kr]:c}});let g=U=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(U)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(q=>this._onerror(new Error(`Failed to send cancellation: ${q}`)));let R=U instanceof W?U:new W(oe.RequestTimeout,String(U));l(R);};this._responseHandlers.set(p,U=>{if(!o?.signal?.aborted){if(U instanceof Error)return l(U);try{let R=$r(n,U.result);R.success?u(R.data):l(R.error);}catch(R){l(R);}}}),o?.signal?.addEventListener("abort",()=>{g(o?.signal?.reason);});let _=o?.timeout??IP,w=()=>g(W.fromError(oe.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(p,_,o?.maxTotalTimeout,w,o?.resetTimeoutOnProgress??false);let z=c?.taskId;if(z){let U=R=>{let q=this._responseHandlers.get(p);q?q(R):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`));};this._requestResolvers.set(p,U),this._enqueueTaskMessage(z,{type:"request",message:m,timestamp:Date.now()}).catch(R=>{this._cleanupTimeout(p),l(R);});}else this._transport.send(m,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(U=>{this._cleanupTimeout(p),l(U);});})}async getTask(e,n){return this.request({method:"tasks/get",params:e},il,n)}async getTaskResult(e,n,o){return this.request({method:"tasks/result",params:e},n,o)}async listTasks(e,n){return this.request({method:"tasks/list",params:e},cl,n)}async cancelTask(e,n){return this.request({method:"tasks/cancel",params:e},$b,n)}async notification(e,n){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let o=n?.relatedTask?.taskId;if(o){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[kr]:n.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!n?.relatedRequestId&&!n?.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 s={...e,jsonrpc:"2.0"};n?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[kr]:n.relatedTask}}}),this._transport?.send(s,n).catch(c=>this._onerror(c));});return}let a={...e,jsonrpc:"2.0"};n?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[kr]:n.relatedTask}}}),await this._transport.send(a,n);}setRequestHandler(e,n){let o=Ff(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(r,i)=>{let a=Vf(e,r);return Promise.resolve(n(a,i))});}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,n){let o=Ff(e);this._notificationHandlers.set(o,r=>{let i=Vf(e,r);return Promise.resolve(n(i))});}removeNotificationHandler(e){this._notificationHandlers.delete(e);}_cleanupTaskProgressHandler(e){let n=this._taskProgressTokens.get(e);n!==void 0&&(this._progressHandlers.delete(n),this._taskProgressTokens.delete(e));}async _enqueueTaskMessage(e,n,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,n,o,r);}async _clearTaskQueue(e,n){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(e,n);for(let r of o)if(r.type==="request"&&Pf(r.message)){let i=r.message.id,a=this._requestResolvers.get(i);a?(a(new W(oe.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`));}}}async _waitForTaskUpdate(e,n){let o=this._options?.defaultTaskPollInterval??1e3;try{let r=await this._taskStore?.getTask(e);r?.pollInterval&&(o=r.pollInterval);}catch{}return new Promise((r,i)=>{if(n.aborted){i(new W(oe.InvalidRequest,"Request cancelled"));return}let a=setTimeout(r,o);n.addEventListener("abort",()=>{clearTimeout(a),i(new W(oe.InvalidRequest,"Request cancelled"));},{once:true});})}requestTaskStore(e,n){let o=this._taskStore;if(!o)throw new Error("No task store configured");return {createTask:async r=>{if(!e)throw new Error("No request provided");return await o.createTask(r,e.id,{method:e.method,params:e.params},n)},getTask:async r=>{let i=await o.getTask(r,n);if(!i)throw new W(oe.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(r,i,a)=>{await o.storeTaskResult(r,i,a,n);let s=await o.getTask(r,n);if(s){let c=na.parse({method:"notifications/tasks/status",params:s});await this.notification(c),wr(s.status)&&this._cleanupTaskProgressHandler(r);}},getTaskResult:r=>o.getTaskResult(r,n),updateTaskStatus:async(r,i,a)=>{let s=await o.getTask(r,n);if(!s)throw new W(oe.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(wr(s.status))throw new W(oe.InvalidParams,`Cannot update task "${r}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(r,i,a,n);let c=await o.getTask(r,n);if(c){let u=na.parse({method:"notifications/tasks/status",params:c});await this.notification(u),wr(c.status)&&this._cleanupTaskProgressHandler(r);}},listTasks:r=>o.listTasks(r,n)}}};function zb(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Pb(t,e){let n={...t};for(let o in e){let r=o,i=e[r];if(i===void 0)continue;let a=n[r];zb(a)&&zb(i)?n[r]={...a,...i}:n[r]=i;}return n}var vk=ay(Eh()),bk=ay(_k());function TC(){let t=new vk.default({strict:false,validateFormats:true,validateSchema:false,allErrors:true});return (0, bk.default)(t),t}var Jl=class{constructor(e){this._ajv=e??TC();}getValidator(e){let n="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return o=>n(o)?{valid:true,data:o,errorMessage:void 0}:{valid:false,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Gl=class{constructor(e){this._server=e;}requestStream(e,n,o){return this._server.requestStream(e,n,o)}createMessageStream(e,n){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 r=e.messages[e.messages.length-1],i=Array.isArray(r.content)?r.content:[r.content],a=i.some(l=>l.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=s?Array.isArray(s.content)?s.content:[s.content]:[],u=c.some(l=>l.type==="tool_use");if(a){if(i.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(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(i.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))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},sa,n)}elicitInputStream(e,n){let o=this._server.getClientCapabilities(),r=e.mode??"form";switch(r){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 i=r==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:i},po,n)}async getTask(e,n){return this._server.getTask({taskId:e},n)}async getTaskResult(e,n,o){return this._server.getTaskResult({taskId:e},n,o)}async listTasks(e,n){return this._server.listTasks(e?{cursor:e}:void 0,n)}async cancelTask(e,n){return this._server.cancelTask({taskId:e},n)}};function $k(t,e,n){if(!t)throw new Error(`${n} does not support task creation (required for ${e})`);switch(e){case "tools/call":if(!t.tools?.call)throw new Error(`${n} does not support task creation for tools/call (required for ${e})`);break;}}function xk(t,e,n){if(!t)throw new Error(`${n} does not support task creation (required for ${e})`);switch(e){case "sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${n} does not support task creation for sampling/createMessage (required for ${e})`);break;case "elicitation/create":if(!t.elicitation?.create)throw new Error(`${n} does not support task creation for elicitation/create (required for ${e})`);break;}}var Kl=class extends dl{constructor(e,n){super(n),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(aa.options.map((o,r)=>[o,r])),this.isMessageIgnored=(o,r)=>{let i=this._loggingLevels.get(r);return i?this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(i):false},this._capabilities=n?.capabilities??{},this._instructions=n?.instructions,this._jsonSchemaValidator=n?.jsonSchemaValidator??new Jl,this.setRequestHandler(Of,o=>this._oninitialize(o)),this.setNotificationHandler(jf,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Mf,async(o,r)=>{let i=r.sessionId||r.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=o.params,s=aa.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}});}get experimental(){return this._experimental||(this._experimental={tasks:new Gl(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Pb(this._capabilities,e);}setRequestHandler(e,n){let r=vu(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let i;if(eo(r)){let s=r;i=s._zod?.def?.value??s.value;}else {let s=r;i=s._def?.value??s.value;}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=$r(ia,c);if(!l.success){let g=l.error instanceof Error?l.error.message:String(l.error);throw new W(oe.InvalidParams,`Invalid tools/call request: ${g}`)}let{params:d}=l.data,p=await Promise.resolve(n(c,u));if(d.task){let g=$r(uo,p);if(!g.success){let _=g.error instanceof Error?g.error.message:String(g.error);throw new W(oe.InvalidParams,`Invalid task creation result: ${_}`)}return g.data}let m=$r(ll,p);if(!m.success){let g=m.error instanceof Error?m.error.message:String(m.error);throw new W(oe.InvalidParams,`Invalid tools/call result: ${g}`)}return m.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,n)}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;}}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;}}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;}}assertTaskCapability(e){xk(this._clientCapabilities?.tasks?.requests,e,"Client");}assertTaskHandlerCapability(e){this._capabilities&&$k(this._capabilities.tasks?.requests,e,"Server");}async _oninitialize(e){let n=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:db.includes(n)?n:If,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"},el)}async createMessage(e,n){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],r=Array.isArray(o.content)?o.content:[o.content],i=r.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(r.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(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(r.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))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},Lf,n):this.request({method:"sampling/createMessage",params:e},sa,n)}async elicitInput(e,n){switch(e.mode??"form"){case "url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let r=e;return this.request({method:"elicitation/create",params:r},po,n)}case "form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let r=e.mode==="form"?e:{...e,mode:"form"},i=await this.request({method:"elicitation/create",params:r},po,n);if(i.action==="accept"&&i.content&&r.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(r.requestedSchema)(i.content);if(!s.valid)throw new W(oe.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof W?a:new W(oe.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(e,n){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}},n)}async listRoots(e,n){return this.request({method:"roots/list",params:e},qf,n)}async sendLoggingMessage(e,n){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,n))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"})}};var Wl=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e;}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
49
49
|
`);if(e===-1)return null;let n=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),EC(n)}clear(){this._buffer=void 0;}};function EC(t){return vb.parse(JSON.parse(t))}function kk(t){return JSON.stringify(t)+`
|
|
50
|
-
`}var Hl=class{constructor(e=wk.stdin,n=wk.stdout){this._stdin=e,this._stdout=n,this._readBuffer=new Wl,this._started=false,this._ondata=o=>{this._readBuffer.append(o),this.processReadBuffer();},this._onerror=o=>{this.onerror?.(o);};}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=true,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(n=>{let o=kk(e);this._stdout.write(o)?n():this._stdout.once("drain",n);})}};var Sk="1.14.
|
|
50
|
+
`}var Hl=class{constructor(e=wk.stdin,n=wk.stdout){this._stdin=e,this._stdout=n,this._readBuffer=new Wl,this._started=false,this._ondata=o=>{this._readBuffer.append(o),this.processReadBuffer();},this._onerror=o=>{this.onerror?.(o);};}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=true,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(n=>{let o=kk(e);this._stdout.write(o)?n():this._stdout.once("drain",n);})}};var Sk="1.14.5";async function Ua(t){try{return await access(t),!0}catch{return false}}var Ik=["pl","en","de","es","fr","pt","it","nl"],Cr=C.enum(Ik),Uh="pl",zk=C.object({url:C.string().url(),language:Cr.optional()}),Pk=["markdown","storage"],Za=C.enum(Pk),Zh="markdown",Tk=C.object({url:C.string().url(),language:Cr.optional(),format:Za.optional()}),Mh=C.object({projects:C.record(C.string(),zk),default_project:C.string(),default_language:Cr.optional(),spaces:C.record(C.string(),Tk).optional(),default_space:C.string().optional(),default_format:Za.optional()}).refine(t=>t.default_project in t.projects,{message:"default_project must reference a configured project"}).refine(t=>t.default_space===void 0||t.default_space in(t.spaces??{}),{message:"default_space must reference a configured space"}),Rr=C.object({username:C.string().email(),api_token:C.string().min(1)}),Xl=C.object({default:Rr,instances:C.record(C.string().url(),Rr).optional()}),Lh=C.union([Rr,Xl]),qh=C.object({url:C.string().url(),username:C.string().email(),api_token:C.string().min(1),language:Cr});C.object({projects:C.record(C.string(),qh),default_project:C.string(),default_language:Cr,credentials:Rr});var Yl=C.object({url:C.string().url(),username:C.string().email(),api_token:C.string().min(1),language:Cr,format:Za});C.object({spaces:C.record(C.string(),Yl),default_space:C.string().optional(),default_language:Cr,default_format:Za,credentials:Rr});var jt=class extends Error{code;constructor(e,n){super(e),this.name="JiraMcpError",this.code=n;}},Ql=class extends jt{constructor(e,n="CONFIG_ERROR"){super(e,n),this.name="ConfigError";}},Ma=class extends Ql{constructor(e){super(e,"CONFIG_NOT_FOUND"),this.name="ConfigNotFoundError";}},_t=class extends Ql{constructor(e){super(e,"CONFIG_VALIDATION"),this.name="ConfigValidationError";}};var mn=class extends jt{constructor(e,n="CONFLUENCE_CONNECTION"){super(e,n),this.name="ConfluenceConnectionError";}},ed=class extends mn{constructor(e){super(e,"CONFLUENCE_AUTH"),this.name="ConfluenceAuthenticationError";}},td=class extends mn{constructor(e){super(e,"CONFLUENCE_PERMISSION"),this.name="ConfluencePermissionError";}},Oo=class extends jt{constructor(e){super(e,"MARKUP_LOSS_REFUSED"),this.name="MarkupLossError";}},La=class extends jt{constructor(e){super(e,"PAGE_NOT_FOUND"),this.name="PageNotFoundError";}},rd=class extends jt{constructor(e){super(e,"VERSION_CONFLICT"),this.name="VersionConflictError";}};var Fh=class extends jt{constructor(e,n="TEMPLATE_ERROR"){super(e,n),this.name="TemplateError";}},nd=class extends Fh{constructor(e){super(e,"TEMPLATE_NOT_FOUND"),this.name="TemplateNotFoundError";}};var od=class extends jt{constructor(e,n="APPROVAL_ERROR"){super(e,n),this.name="ApprovalError";}},id=class extends od{constructor(e){super(e,"COMMENT_APPROVAL_REQUIRED"),this.name="CommentApprovalRequiredError";}},ad=class extends od{constructor(e){super(e,"DELETION_APPROVAL_REQUIRED"),this.name="DeletionApprovalRequiredError";}};var fn=join(homedir(),".softspark","jira-mcp"),sd=join(fn,"config.json"),cd=join(fn,"credentials.json");join(fn,"cache");join(fn,"state.json");async function DC(t){let e=process.env.JIRA_CONFIG_PATH;if(e)return resolve(e);let n=resolve(process.cwd(),"config.json");return await Ua(n)?(console.warn(`[jira-mcp] WARNING: Loading config.json from working directory (${n}) instead of global config. This may be a security risk if running from an untrusted directory.`),n):sd}async function UC(t){let e=process.env.JIRA_CREDENTIALS_PATH;if(e)return resolve(e);let n=resolve(process.cwd(),"credentials.json");return await Ua(n)?(console.warn(`[jira-mcp] WARNING: Loading credentials.json from working directory (${n}) instead of global config. This may be a security risk if running from an untrusted directory.`),n):cd}async function Ok(t,e){if(!await Ua(t))throw new Ma(`${e} not found: ${t}`);let n;try{n=await readFile(t,"utf-8");}catch(o){let r=o instanceof Error?o.message:String(o);throw new Ma(`Failed to read ${e}: ${r}`)}try{return JSON.parse(n)}catch(o){let r=o instanceof Error?o.message:String(o);throw new _t(`Invalid JSON in ${e}: ${r}`)}}function ZC(t){let e=Rr.safeParse(t);if(e.success&&!("default"in t))return {default:e.data,instances:{}};let n=Xl.safeParse(t);if(n.success)return {default:n.data.default,instances:n.data.instances??{}};throw new _t("Credentials file format not recognized. Expected { username, api_token } or { default: { username, api_token }, instances?: {} }.")}function MC(t,e){return t.instances[e]??t.default}async function LC(t){let e=await DC(),n=await UC(),o=await Ok(e,"configuration file"),r=Mh.safeParse(o);if(!r.success)throw new _t(`Configuration validation failed: ${r.error.message}`);let i=await Ok(n,"credentials file"),a=Lh.safeParse(i);if(!a.success)throw new _t(`Credentials validation failed: ${a.error.message}`);let s=r.data;return {config:s,normalized:ZC(a.data),globalLanguage:s.default_language??Uh}}async function Vh(t){let{config:e,normalized:n,globalLanguage:o}=await LC(),r=e.spaces??{};if(Object.keys(r).length===0)throw new _t("No Confluence spaces configured. Add one with: confluence-mcp space add <SPACE_KEY> <https://your-site.atlassian.net>");let i=e.default_format??Zh,a={};for(let[s,c]of Object.entries(r)){let u=MC(n,c.url),l={url:c.url,username:u.username,api_token:u.api_token,language:c.language??o,format:c.format??i},d=Yl.safeParse(l);if(!d.success)throw new _t(`Space '${s}' validation failed: ${d.error.message}`);a[s]=d.data;}return {spaces:a,default_space:e.default_space,default_language:o,default_format:i,credentials:n.default}}function Bh(t){return {version:1,type:"doc",content:[{type:"paragraph",content:[{type:"text",text:t}]}]}}function Rt(t){let e=t.replace(/\\n/g,`
|
|
51
51
|
`);if(e.trim().length===0)return Bh(e);try{let n=Dk(e,{nextTaskId:1});return n.length===0?Bh(e):{version:1,type:"doc",content:n}}catch{return Bh(e)}}function qC(t){return {lines:t.split(`
|
|
52
52
|
`),pos:0}}function Ro(t){return t.lines[t.pos]}function nt(t){let e=t.lines[t.pos]??"";return t.pos++,e}function Co(t){return t.pos<t.lines.length}var Ck=/^(#{1,6})\s+(.+)$/,Xh=/^(\s*)[-*+]\s+(.*)$/,Yh=/^(\s*)\d+\.\s+(.*)$/,FC=/^(\s*)[-*+]\s+\[([ xX])\]\s+(.*)$/,Nk=/^```(\w*)$/,Qh=/^>\s?(.*)$/,Ak=/^(?:---+|\*\*\*+|___+)\s*$/,VC=/^:?-{3,}:?$/;function Dk(t,e){let n=qC(t),o=[];for(;Co(n);){let r=Ro(n);if(r===void 0)break;if(r.trim()===""){nt(n);continue}let i=Nk.exec(r);if(i){o.push(BC(n,i[1]??""));continue}if(Ak.test(r)){nt(n),o.push({type:"rule"});continue}let a=Ck.exec(r);if(a){nt(n);let s=(a[1]??"#").length,c=a[2]??"";o.push({type:"heading",attrs:{level:s},content:Hh(c)});continue}if(Qh.test(r)){o.push(JC(n,e));continue}if(Xh.test(r)||Yh.test(r)){o.push(...Wh(GC(n),e));continue}if(Uk(n)){o.push(HC(n));continue}o.push(WC(n));}return o}function BC(t,e){nt(t);let n=[];for(;Co(t);){let r=Ro(t);if(r!==void 0&&/^```\s*$/.test(r)){nt(t);break}n.push(nt(t));}let o=n.join(`
|
|
53
53
|
`);return {type:"codeBlock",attrs:{language:e||"text"},content:o.length>0?[{type:"text",text:o}]:[]}}function JC(t,e){let n=[];for(;Co(t);){let i=Ro(t);if(i===void 0)break;let a=Qh.exec(i);if(!a)break;nt(t),n.push(a[1]??"");}let o=n.join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softspark/confluence-mcp",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.5",
|
|
4
4
|
"description": "MCP server for Confluence Cloud \u2014 pages, blog posts, comments, labels, attachments, restrictions and whiteboards via the Model Context Protocol.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|