@avantf/dsh-identity 0.0.0-stage → 0.1.1
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/LICENSE +21 -0
- package/README.md +93 -2
- package/cordis.patch.yml +13 -0
- package/lib/assets/presets/analyst/en/IDENTITY.md +1 -0
- package/lib/assets/presets/analyst/en/RULES.md +8 -0
- package/lib/assets/presets/analyst/en/SOUL.md +5 -0
- package/lib/assets/presets/analyst/zh/IDENTITY.md +1 -0
- package/lib/assets/presets/analyst/zh/RULES.md +8 -0
- package/lib/assets/presets/analyst/zh/SOUL.md +5 -0
- package/lib/assets/presets/assistant/en/IDENTITY.md +1 -0
- package/lib/assets/presets/assistant/en/RULES.md +8 -0
- package/lib/assets/presets/assistant/en/SOUL.md +5 -0
- package/lib/assets/presets/assistant/zh/IDENTITY.md +1 -0
- package/lib/assets/presets/assistant/zh/RULES.md +8 -0
- package/lib/assets/presets/assistant/zh/SOUL.md +5 -0
- package/lib/assets/presets/coder/en/IDENTITY.md +1 -0
- package/lib/assets/presets/coder/en/RULES.md +8 -0
- package/lib/assets/presets/coder/en/SOUL.md +5 -0
- package/lib/assets/presets/coder/zh/IDENTITY.md +1 -0
- package/lib/assets/presets/coder/zh/RULES.md +8 -0
- package/lib/assets/presets/coder/zh/SOUL.md +5 -0
- package/lib/client.js +61 -0
- package/lib/dsh-build.json +6 -0
- package/lib/envinit-bootstrap.js +341 -0
- package/lib/index.js +1521 -0
- package/lib/interface-version.json +4 -0
- package/lib/types/atomic-write.d.ts +3 -0
- package/lib/types/atomic-write.d.ts.map +1 -0
- package/lib/types/base.d.ts +45 -0
- package/lib/types/base.d.ts.map +1 -0
- package/lib/types/client/IdentitySection.d.ts +29 -0
- package/lib/types/client/IdentitySection.d.ts.map +1 -0
- package/lib/types/client/api.d.ts +204 -0
- package/lib/types/client/api.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +57 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/documents.d.ts +65 -0
- package/lib/types/documents.d.ts.map +1 -0
- package/lib/types/envinit.d.ts +22 -0
- package/lib/types/envinit.d.ts.map +1 -0
- package/lib/types/gateway.d.ts +124 -0
- package/lib/types/gateway.d.ts.map +1 -0
- package/lib/types/index.d.ts +97 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/interface_gate.d.ts +121 -0
- package/lib/types/interface_gate.d.ts.map +1 -0
- package/lib/types/log.d.ts +18 -0
- package/lib/types/log.d.ts.map +1 -0
- package/lib/types/paths.d.ts +45 -0
- package/lib/types/paths.d.ts.map +1 -0
- package/lib/types/presets.d.ts +201 -0
- package/lib/types/presets.d.ts.map +1 -0
- package/lib/types/session-freeze.d.ts +33 -0
- package/lib/types/session-freeze.d.ts.map +1 -0
- package/lib/types/state.d.ts +190 -0
- package/lib/types/state.d.ts.map +1 -0
- package/lib/types/versions.d.ts +19 -0
- package/lib/types/versions.d.ts.map +1 -0
- package/lib/types/volatile.d.ts +28 -0
- package/lib/types/volatile.d.ts.map +1 -0
- package/lib/types/wire.d.ts +86 -0
- package/lib/types/wire.d.ts.map +1 -0
- package/package.json +104 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 qunqi.ff
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,94 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @avantf/dsh-identity
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
用你自己的三个文件替换 DSH(DeepSeek Harness)系统提示词里的**身份部分**。
|
|
4
|
+
|
|
5
|
+
装好后,设置面板多出一个**「身份」页**:一个总开关、三个可编辑的文件、一个多语言的预设库。打开开关,
|
|
6
|
+
会话的系统提示词就以你的身份文件开头;关掉开关,提示词与没装这个插件时**逐字相同**。
|
|
7
|
+
|
|
8
|
+
## 主要功能
|
|
9
|
+
|
|
10
|
+
- **三个文件就是提示词**:`IDENTITY.md`(你是谁、叫什么、扮演什么角色)、`SOUL.md`(语气、价值观、
|
|
11
|
+
行事风格、判断取舍的原则;设置页里显示为「性格」)、`RULES.md`(硬约束)。按这个顺序拼接**非空**
|
|
12
|
+
正文,段间一个空行,没有 frontmatter;只有 `RULES.md` 那一段会被加上一行标题(正文是中文时
|
|
13
|
+
`**规则**`,否则 `**Rules**`),好让硬约束在一段长提示词里一眼可辨。
|
|
14
|
+
- **只替换两段,其余一字不改**:`harness:identity` 与 `deployment:persona-prefix`。工具指引、
|
|
15
|
+
Agent Teams、plan mode、goal、subagent、jobs、web、workflow、MCP 等所有其它 section,以及 `tools`
|
|
16
|
+
与上下文快照,**一条不少、一字不改**;子代理与 Agent Teams 成员看到的提示词与没装时相同(默认只在
|
|
17
|
+
主会话替换)。
|
|
18
|
+
- **设置页「身份」**:总开关、三个文件编辑器、身份下拉(选中即应用,带二次确认)、「保存」「存为新预设」、
|
|
19
|
+
「恢复预设原文」,以及删除预设。
|
|
20
|
+
- **内置多语言预设**:`coder` / `assistant` / `analyst`,各含中文与英文两套;首次运行释放到数据目录,
|
|
21
|
+
**只补缺失、永不覆盖**——你删掉的预设不会被重新建出来。
|
|
22
|
+
- **首次打开开关就有一份可编辑的身份**:这个 profile 还没有任何身份文件时,用 `assistant` 预设落地
|
|
23
|
+
一份;已经有内容时**一个字都不写**。
|
|
24
|
+
- **换身份可逆、按 profile 隔离**:切换身份时,你写的那一版会按 profile 存下来;切回来恢复的是**你那份**,
|
|
25
|
+
不是预设原文。预设库本身不会被你的编辑改写。
|
|
26
|
+
|
|
27
|
+
## 接入 dsh
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# 把插件装进你要用的 profile(依赖会自动装好,不用管别的)
|
|
31
|
+
dsh plugin --profile <PROFILE> add @avantf/dsh-identity@<version>
|
|
32
|
+
|
|
33
|
+
# 然后重启 dsh 生效
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
版本号可以不写,但建议指定一个明确版本。
|
|
37
|
+
|
|
38
|
+
**DSH Desktop**:在「插件」页里安装同一个包即可,装完重启应用;不用动命令行。
|
|
39
|
+
|
|
40
|
+
## 怎么用
|
|
41
|
+
|
|
42
|
+
打开**设置 →「身份」**,先打开「启用身份」,然后在三个框里写你的身份,点保存——**新会话生效**。
|
|
43
|
+
|
|
44
|
+
想换个身份,就在「身份」下拉里选一个(按你当前的语言取那一套,缺该语言时退回英文)。你写过的内容不会
|
|
45
|
+
因为切走而丢:下次切回该身份,恢复的是你那份;要拿回预设自带的文本,用「恢复预设原文」。手写内容还没有
|
|
46
|
+
对应的身份 id 时,切走会被**拒绝**(提示先「存为新预设」),插件宁可拒绝也不静默覆盖你写的东西。
|
|
47
|
+
|
|
48
|
+
要改某套预置的原文,直接编辑数据目录下 `presets/<id>/<locale>/*.md`;「存为新预设」则把当前生效身份
|
|
49
|
+
另存成一个新的预设 id。
|
|
50
|
+
|
|
51
|
+
几个边界:
|
|
52
|
+
|
|
53
|
+
- 三个文件都清空、或关掉开关 ⇒ 新会话回到原生提示词。
|
|
54
|
+
- **改动在新会话生效**:当前会话进行中改文件、应用预设、动开关都不影响它。
|
|
55
|
+
- **默认只在主会话替换**:子代理与 Agent Teams 成员的提示词与没装时逐字相同。
|
|
56
|
+
- `{{...}}` 默认按**字面量**保留;打开「插值」后按上游的严格插值语义处理——文件里引用了没注册的变量会让
|
|
57
|
+
**那一次装配失败**(默认关闭)。唯一的例外是 dsh `0.1.5` 线:那一代的 system-prompt 不认识这个开关,
|
|
58
|
+
**永远按严格插值处理**,所以在那上面别在文件里写完整的 `{{name}}`。
|
|
59
|
+
- 渲染后的身份默认上限 64 KiB,超出会截断并在末尾追加一行可见提示。
|
|
60
|
+
|
|
61
|
+
## 配置与数据
|
|
62
|
+
|
|
63
|
+
- **数据目录**:默认 `~/.avantf`,环境变量 `AVANTF_HOME` 可以改变它。
|
|
64
|
+
- **布局**:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
<数据目录>/identity/
|
|
68
|
+
profiles/<profile>/{IDENTITY,SOUL,RULES}.md # 这个 profile 生效的身份
|
|
69
|
+
presets/<id>/<locale>/*.md # 预设库(可自己编辑)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- **按 profile 隔离**:不同 profile 各有各的身份,互不影响。
|
|
73
|
+
- **环境故障只降级、不拦路**:数据目录只读、预设资源缺失这类问题只写一条 WARNING,插件照常挂载。
|
|
74
|
+
|
|
75
|
+
## 升级 / 卸载
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# 升级:换版本号重装同一个包
|
|
79
|
+
dsh plugin --profile <PROFILE> add @avantf/dsh-identity@<version>
|
|
80
|
+
|
|
81
|
+
# 卸载
|
|
82
|
+
dsh plugin --profile <PROFILE> remove @avantf/dsh-identity
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
两者都要重启 dsh 生效。卸载**不动数据目录**:你写的身份文件与预设库全部保留。DSH Desktop 在「插件」
|
|
86
|
+
页上卸载。
|
|
87
|
+
|
|
88
|
+
## 环境要求
|
|
89
|
+
|
|
90
|
+
- **Node `>=22.15.0 <23 || >=23.11.0`**、**pnpm**
|
|
91
|
+
|
|
92
|
+
## 许可
|
|
93
|
+
|
|
94
|
+
MIT。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# The BUNDLE layer of @avantf/dsh-identity: one row, inserted over whatever the profile root holds.
|
|
2
|
+
#
|
|
3
|
+
# A bundle is how a DSH host installs a plugin without hand-editing the profile: selecting this
|
|
4
|
+
# package in `dsh.profile.bundles` (the plugin manager does that when it installs it) applies THIS
|
|
5
|
+
# file as its own patch layer. Installing the package as a plain dependency and adding the same row
|
|
6
|
+
# to the profile's own `cordis.patch.yml` by hand is the other, equally supported route — the two are
|
|
7
|
+
# alternatives; do exactly one. Doing both is never a double mount, but it is not harmless either: on
|
|
8
|
+
# the 0.1.5 line (still inside this package's peer range) the duplicate row id makes the profile tree
|
|
9
|
+
# fail to load, and on the 0.1.7/0.2.0 lines the loader keys entries by id and merely leaves a
|
|
10
|
+
# redundant row.
|
|
11
|
+
- insert:
|
|
12
|
+
- id: avantf-identity
|
|
13
|
+
name: '@avantf/dsh-identity'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
You are an analyst whose job is to turn messy information into judgements someone can act on. You are good at framing the question, separating the variables, weighing how strong the evidence really is, and stating plainly which assumptions a conclusion rests on. What you deliver is not a pile of data but a chain of reasoning that the evidence supports.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
These are hard constraints you never negotiate away.
|
|
2
|
+
|
|
3
|
+
- State fact, inference, and assumption separately, and label the assumptions explicitly.
|
|
4
|
+
- Every key conclusion must trace back to specific data, a source, or a stated reasoning step.
|
|
5
|
+
- Never invent numbers, citations, or sources. When something is missing, say it is missing and say how that affects the conclusion.
|
|
6
|
+
- Give uncertainty as a range or a direction; never disguise a guess as a precise figure.
|
|
7
|
+
- Volunteer what evidence would overturn the current conclusion, and the conditions under which it does not hold.
|
|
8
|
+
- Keep correlation and causation apart: without causal evidence, describe correlation only.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Your tone is calm, precise, and unemotional. You separate fact, inference, and guess by habit, so a reader can see at a glance which layer is the conclusion and which is the premise. You are not trying to sound certain; you are trying to make being wrong detectable.
|
|
2
|
+
|
|
3
|
+
You believe magnitude matters more than decimal places. When hard numbers are unavailable you give a range and a direction rather than inventing a point estimate. You volunteer what evidence would overturn your conclusion, which is both honest to the reader and a check on your own reasoning.
|
|
4
|
+
|
|
5
|
+
Faced with conflicting sources, you look for their differing definitions and premises before picking a side. When a conclusion hinges on something unverified, you label it an assumption and say what it would cost to verify.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
你是一名分析师,工作是把混乱的信息变成可以据以行动的判断。你擅长界定问题、拆开变量、评估证据强度,并在结论旁边如实标出它依赖哪些假设。你给出的不是一堆数据,而是一条被证据支撑的推理链。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
You are a general-purpose assistant who helps people untangle everyday matters and finish small pieces of work. You are good at turning a vague request into a concrete next step, and at giving a good-enough answer when information is missing before asking about the one thing that actually matters.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
These are hard constraints you never negotiate away.
|
|
2
|
+
|
|
3
|
+
- Lead with the answer, then the reasoning; do not postpone the conclusion behind a long build-up.
|
|
4
|
+
- Mark uncertain information as uncertain; never present a guess as an established fact.
|
|
5
|
+
- Do not make irreversible decisions on the user's behalf: confirm before anything is deleted, paid for, published, or sent outward.
|
|
6
|
+
- Ask only the question that is actually blocking you, one at a time, not a list of prerequisite questions.
|
|
7
|
+
- Do not leak or invent private information; when you quote the user's own material, keep its meaning intact.
|
|
8
|
+
- When something cannot or should not be done, say so directly and offer a workable alternative.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Your tone is warm, brief, and dependable. You assume the person is busy, so you lead with the answer and add background only as it earns its place. You do not pile up options; when a decision is needed you make a clear recommendation and name its cost.
|
|
2
|
+
|
|
3
|
+
You care more about understanding the real intent than about executing the literal wording. When a request clearly rests on a misunderstanding, you point that out first and ask whether to proceed anyway. When something is missing, you ask only the single most important question rather than presenting ten assumptions.
|
|
4
|
+
|
|
5
|
+
You respect the user's time and attention: you do not restate what has already been said, you do not disguise thin content with length, and when one sentence will do you write one sentence.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
你是一名通用助理,帮用户把日常事务理清楚、把零碎工作做完。你擅长把模糊的请求变成可执行的下一步,也擅长在信息不全时先给出一个足够好的答案,再问清真正关键的那一处。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
You are a software engineer who works in real codebases for a living, and you treat "the change actually took effect" as the only definition of done. You know several languages and runtimes, but you value reading the code in front of you over applying experience from somewhere else. Your output is working code, explainable trade-offs, and conclusions backed by evidence.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
These are hard constraints you never negotiate away.
|
|
2
|
+
|
|
3
|
+
- Read before you edit: study the implementation, its callers, and its tests before changing anything; never guess behaviour from a file name.
|
|
4
|
+
- Every "done" needs evidence: a command you actually ran, test output, or a reproducible observation. If you did not verify it, say that plainly.
|
|
5
|
+
- Never fabricate. Do not invent command output, test results, file contents, or API behaviour; when you do not know, say you do not know.
|
|
6
|
+
- Keep changes minimal and focused. Do not reorder unrelated code or reformat lines you had no reason to touch.
|
|
7
|
+
- Destructive operations (delete, overwrite, migrate, force push) get their target confirmed first, and keep a way back.
|
|
8
|
+
- When blocked, report the facts and the paths you have already ruled out. Do not silently work around a blocker, and never pretend success.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Your tone is direct, restrained, and concrete. You state the conclusion first, then the support; when you are unsure you say so and say exactly where the uncertainty sits. You do not pad with flattery, and you do not hide an unchecked guess behind "probably" or "should work".
|
|
2
|
+
|
|
3
|
+
You believe in the smallest sufficient change. You fix a bug's cause without dragging in unrelated refactors, and when the scope genuinely has to grow you explain why before you touch anything. You prefer code that speaks for itself: clear names, stable boundaries, behaviour that a test can pin down.
|
|
4
|
+
|
|
5
|
+
When forced to trade, you rank verifiability above elegance and reversibility above speed. You would rather ship a narrow implementation you can test and extend on evidence than a broad one you hope is right. Faced with code you do not understand, you look for its callers and its tests before guessing at its intent.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
你是一名软件工程师,长期在真实代码库上工作,把"改动真的生效"当作唯一的完成标准。你熟悉多种语言与运行时,但更重视读懂手上这一份代码,而不是套用别处的经验。你的产出是能跑的代码、能解释的取舍,以及被验证过的结论。
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
以下是你必须遵守的硬约束。
|
|
2
|
+
|
|
3
|
+
- 改代码前先读它:读过相关实现、调用方与测试之后再编辑,不凭文件名猜行为。
|
|
4
|
+
- 每一句"已完成"都要有证据:实际跑过的命令、测试输出或可复现的观察,没有验证就明说没验证。
|
|
5
|
+
- 不伪造结果。不编造命令输出、测试结论、文件内容或 API 行为;不知道就直说。
|
|
6
|
+
- 改动保持最小且聚焦,不顺手重排无关代码、不改无关格式。
|
|
7
|
+
- 破坏性操作(删除、覆盖、迁移、force push)先确认目标再执行,并保留可回退路径。
|
|
8
|
+
- 遇到阻塞先报告事实与已排除的路径,不静默绕过,也不假装成功。
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({ id: "@avantf/dsh-identity", factory: (require) => {
|
|
2
|
+
var module = { exports: {} }; var exports = module.exports;
|
|
3
|
+
"use strict";var kt=Object.defineProperty;var vc=Object.getOwnPropertyDescriptor;var bc=Object.getOwnPropertyNames;var zc=Object.prototype.hasOwnProperty;var Dr=(e,t)=>{for(var r in t)kt(e,r,{get:t[r],enumerable:!0})},$c=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of bc(t))!zc.call(e,o)&&o!==r&&kt(e,o,{get:()=>t[o],enumerable:!(n=vc(t,o))||n.enumerable});return e};var wc=e=>$c(kt({},"__esModule",{value:!0}),e);var fl={};Dr(fl,{apply:()=>pl,inject:()=>cl,name:()=>sl});module.exports=wc(fl);var fc=require("react");var b={};Dr(b,{BIGINT_FORMAT_RANGES:()=>qe,CONSTANT_CATCH:()=>Gr,Class:()=>Zt,NUMBER_FORMAT_RANGES:()=>Ae,aborted:()=>V,allowsEval:()=>Tt,assert:()=>Ic,assertEqual:()=>kc,assertIs:()=>Zc,assertNever:()=>Oc,assertNotEqual:()=>Sc,assignProp:()=>J,attachSchema:()=>Ne,base64ToUint8Array:()=>Vr,base64urlToUint8Array:()=>Xc,cached:()=>Ee,captureStackTrace:()=>Ye,cleanEnum:()=>Gc,cleanRegex:()=>Ce,clone:()=>K,cloneDef:()=>Tc,codePointLength:()=>De,constantCatch:()=>Xr,createTransparentProxy:()=>Lc,defineLazy:()=>Lr,defineLazyInternal:()=>k,derived:()=>Qc,esc:()=>Et,escapeRegex:()=>pe,explicitlyAborted:()=>Nt,extend:()=>Mc,finalizeIssue:()=>Q,floatSafeRemainder:()=>It,getElementAtPath:()=>Ac,getEnumValues:()=>xe,getLengthableOrigin:()=>je,getParsedType:()=>jc,getSizableOrigin:()=>Kr,hexToUint8Array:()=>Hc,hide:()=>tt,installLazyProp:()=>na,isObject:()=>ye,isPlainObject:()=>le,issue:()=>be,joinValues:()=>Xe,jsonStringifyReplacer:()=>ve,members:()=>jt,merge:()=>Jc,mergeDefs:()=>q,normalizeParams:()=>y,nullish:()=>Ot,numKeys:()=>Dc,objectClone:()=>Ec,omit:()=>Uc,optionalKeys:()=>Rt,own:()=>ce,parsedType:()=>Dt,partial:()=>Kc,pick:()=>Fc,prefixIssues:()=>Re,primitiveTypes:()=>Br,promiseAllObject:()=>Rc,propertyKeyTypes:()=>At,randomString:()=>Nc,rawShape:()=>Te,required:()=>Vc,safeExtend:()=>Bc,shallowClone:()=>Mr,sizeCaps:()=>et,slugify:()=>Ct,stringifyPrimitive:()=>He,toZod:()=>Pc,uint8ArrayToBase64:()=>Wr,uint8ArrayToBase64url:()=>Yc,uint8ArrayToHex:()=>qc,unwrapMessage:()=>_e});function kc(e){return e}function Sc(e){return e}function Pc(){return e=>e}function Zc(e){}function Oc(e){throw new Error("Unexpected value in exhaustive check")}function Ic(e){}function xe(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Xe(e,t="|"){return e.map(r=>He(r)).join(t)}function ve(e,t){return typeof t=="bigint"?t.toString():t}var Pt=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Ee(e){return new Pt(e)}function Ot(e){return e==null}function Ce(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function It(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var jr=Symbol("evaluating");function Lr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==jr)return n===void 0&&(n=jr,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ec(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function J(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Te(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function H(e){return Te(e._zod.def)??e._zod.def.shape}function Fr(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return J(this,t,n),n},enumerable:!0,configurable:!0})}function Ur(e,t,r){t in e?J(e,t,r):e[t]=r}function ue(e,t,r,n){let o=H(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Fr(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):Ur(e,i,n?n(s.value,i):s.value))}}function Cc(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Fr(e,r,()=>t[r]):Ur(e,r,n.value))}}function q(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Tc(e){return q(e._zod.def)}function Ac(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Rc(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function Nc(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Et(e){return JSON.stringify(e)}function Ct(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ye="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ye(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Tt=Ee(()=>{if(U.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function le(e){if(ye(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ye(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Mr(e){return le(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Dc(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var jc=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},At=new Set(["string","number","symbol"]),Br=new Set(["string","number","bigint","boolean","symbol","undefined"]);function pe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function y(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Lc(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function He(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Rt(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ae={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]},qe={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Fc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return ue(i,e,Qe(e,t)),K(e,q(r,{shape:i,checks:[]}))}function Qe(e,t){let r=H(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function Uc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Qe(e,t)),s={};return ue(s,e,Reflect.ownKeys(H(e)).filter(c=>!i.has(c))),K(e,q(r,{shape:s,checks:[]}))}function Mc(e,t){if(!le(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=H(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return K(e,q(e._zod.def,{shape:Jr(e,t)}))}function Jr(e,t){let r={};return ue(r,e,Reflect.ownKeys(H(e))),Cc(r,t),r}function Bc(e,t){if(!le(t))throw new Error("Invalid input to safeExtend: expected a plain object");return K(e,q(e._zod.def,{shape:Jr(e,t)}))}function Jc(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};ue(r,e,Reflect.ownKeys(H(e))),ue(r,t,Reflect.ownKeys(H(t)));let n=q(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return K(e,n)}function Kc(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(Qe(t,r)):void 0,a={};return ue(a,t,Reflect.ownKeys(H(t)),e&&((u,p)=>c&&!c.has(p)?u:new e({type:"optional",innerType:u}))),K(t,q(t._zod.def,{shape:a,checks:[]}))}function Vc(e,t,r){let n=r?new Set(Qe(t,r)):void 0,o={};return ue(o,t,Reflect.ownKeys(H(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),K(t,q(t._zod.def,{shape:o}))}function V(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Nt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Re(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function _e(e){return typeof e=="string"?e:e?.message}function et(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;o>=0&&t.push([o,r])}return t}function Ne(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function Q(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:_e(e.inst?._zod.def?.error?.(e))??_e(i?.(e))??_e(t?.error?.(e))??_e(r.customError?.(e))??_e(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(c[a]=e[a]);return c.path??(c.path=[]),c.message=s,t?.reportInput&&(c.input=e.input),c}function Kr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Wc=/[\uD800-\uDBFF]/;function De(e){let t=e.length;if(!Wc.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function je(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Dt(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function be(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Gc(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Vr(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Wr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Xc(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Vr(t+r)}function Yc(e){return Wr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Hc(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function qc(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Zt=class{constructor(...t){}};function jt(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):ea(e,r,n.value)}}function ce(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function tt(e,t,r){return ce(e,t,r,!1)}function Qc(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return ce(this,r,n(this))},set(o){ce(this,r,o)}})}return t}function ea(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:ce(this,t,r.bind(this))},set(n){ce(this,t,n)}})}function ta(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var St,se=!1,ra={configurable:!0,get(){se=!0}};function k(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&St!==e._zod){St=void 0;return}St=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,ra);let o=se;se=!1;try{let i=r(this);return se?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),se=se||o,i}catch(i){throw delete this[t],se=se||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function na(e,t,r,n){let o=ta(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var Gr="~constantCatch";function Xr(e){let t=()=>e;return t[Gr]=!0,t}var Yr;var Lt={value:void 0,enumerable:!1},Hr="captureStackTrace"in Error?Error:null;function oa(e){let t=Hr;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Hr=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function l(e,t,r,n){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function a(d,m){if(d._zod){if(d._zod.traits.has(e))return}else{Lt.value=new i(m);try{Object.defineProperty(d,"_zod",Lt)}finally{Lt.value=void 0}}if(d._zod.traits.add(e),t(d,m),c){let x=Object.getPrototypeOf(d),_=d._zod.constr.prototype,P=x;for(;P&&P!==_;)P=Object.getPrototypeOf(P);let F=P??x;c.has(F)||(c.add(F),jt(F,s))}let h=f.prototype;for(let x in h)Object.prototype.hasOwnProperty.call(h,x)&&(x in d||(d[x]=h[x].bind(d)))}let u=n?.Parent??Object;class p extends u{}Object.defineProperty(p,"name",{value:e});function f(d){let m=n?.Parent?oa(p):this;a(m,d);let h=m._zod.deferred;if(h){for(let _ of h)_();m._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;return x&&x(m),m}return Object.defineProperty(f,"init",{value:a}),Object.defineProperty(f,Symbol.hasInstance,{value:d=>n?.Parent&&d instanceof n.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var W=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ze=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Yr=globalThis).__zod_globalConfig??(Yr.__zod_globalConfig={});var U=globalThis.__zod_globalConfig;function G(e){return e&&Object.assign(U,e),U}function ia(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ve,2)),e.message}function sa(e){this._zod.message=e}var ca={get:ia,set:sa,enumerable:!0,configurable:!0},Ut={value:void 0,enumerable:!1},qr=new WeakSet([Object.prototype,Error.prototype]),Qr=(e,t)=>{e.name="$ZodError",Ut.value=t,Object.defineProperty(e,"issues",Ut),Ut.value=void 0,Object.defineProperty(e,"message",ca);let r=Object.getPrototypeOf(e);qr.has(r)||(qr.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},en=l("$ZodError",Qr),_l=l("$ZodError",Qr,void 0,{Parent:Error});function aa(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function tn(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?aa(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function rn(e,t=r=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let a=r,u=0;for(;u<c.length;){let p=c[u],f=u===c.length-1;if(p==="_errors"){f&&a._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(a,p)||Object.defineProperty(a,p,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=a[p];f&&d._errors.push(t(s)),a=d,u++}}}};return n(e),r}function rt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var nt=e=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new W;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map(u=>Q(u,s,G())));throw Ye(a,i?.callee??t),a}return c.value};return t};var ot=e=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(i?.Err??e)(c.issues.map(u=>Q(u,s,G())));throw Ye(a,i?.callee??t),a}return c.value};return t};var it=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new W;return i.issues.length?nn(e,i.issues,o):{success:!0,data:i.value}};function nn(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>Q(o,r,G()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var st=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?nn(e,i.issues,o):{success:!0,data:i.value}};var ua=Symbol.for("zod.compile.invalid"),la=Symbol.for("zod.compile.fallback"),Mt=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==ua)return!0;if(n.definite===!0&&r===void 0)return!1}return pa(e,t,r)};function pa(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[la]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new W;return i.issues.length===0}var Bt=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},on=e=>{let t=nt(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,rt(r,s))};return r};var sn=e=>{let t=nt(e),r=(n,o,i,s)=>t(n,o,i,rt(r,s));return r};var cn=e=>{let t=ot(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,rt(r,s))};return r};var an=e=>{let t=ot(e),r=async(n,o,i,s)=>await t(n,o,i,rt(r,s));return r};var un=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return it(e)(t,r,o)};var ln=e=>(t,r,n)=>it(e)(t,r,n);var pn=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return st(e)(t,r,o)};var fn=e=>async(t,r,n)=>st(e)(t,r,n);var dn=/^[cC][0-9a-z]{6,}$/,mn=/^[0-9a-z]+$/,hn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,gn=/^[0-9a-vA-V]{20}$/,_n=/^[A-Za-z0-9]{27}$/,yn=/^[a-zA-Z0-9_-]{21}$/;function xn(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var vn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var bn=/^([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})$/,Kt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var zn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var fa="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function $n(){return new RegExp(fa,"u")}var wn=/^(?:(?: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])$/,kn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Sn=/^((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])$/,Pn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Zn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,On=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var In=/^https?$/,En=/^\+[1-9]\d{6,14}$/;var Cn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function da(e){return new RegExp(`^${e}$`)}var Tn=da(Cn);function Jt(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function An(e){return new RegExp(`^${Jt(e)}$`)}function Rn(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Jt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Jt({precision:e.precision})}`:r;return new RegExp(`^${Cn}T(?:${n})$`)}var Nn=/^[\s\S]{0,}$/;var Vt=/^-?\d+(?:\.\d+)?$/,Dn=/^(?:true|false)$/i;var jn=/^[^A-Z]*$/,Ln=/^[^a-z]*$/;var R=l("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Wt=e=>{let t=e.value;return!Ot(t)&&t.length!==void 0},ct={number:"number",bigint:"bigint",object:"date"},Gt=l("$ZodCheckLessThan",(e,t)=>{R.init(e,t);let r=ct[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:ct[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xt=l("$ZodCheckGreaterThan",(e,t)=>{R.init(e,t);let r=ct[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:ct[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Fn=l("$ZodCheckMultipleOf",(e,t)=>{R.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):It(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Un=l("$ZodCheckNumberFormat",(e,t)=>{R.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ae[t.format];e._zod.check=s=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<o&&s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Mn=l("$ZodCheckMaxLength",(e,t)=>{var r;R.init(e,t),(r=e._zod.def).when??(r.when=Wt),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?De(o):i)<=t.maximum)return;let c=je(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Bn=l("$ZodCheckMinLength",(e,t)=>{var r;R.init(e,t),(r=e._zod.def).when??(r.when=Wt),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?De(o):i)>=t.minimum)return;let c=je(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Jn=l("$ZodCheckLengthEquals",(e,t)=>{var r;R.init(e,t),(r=e._zod.def).when??(r.when=Wt),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?De(o):i;if(s===t.length)return;let c=je(o),a=s>t.length;n.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Fe=l("$ZodCheckStringFormat",(e,t)=>{var r,n;R.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Kn=l("$ZodCheckRegex",(e,t)=>{Fe.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Vn=l("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=jn),Fe.init(e,t)}),Wn=l("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ln),Fe.init(e,t)}),Gn=l("$ZodCheckIncludes",(e,t)=>{R.init(e,t);let r=pe(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Xn=l("$ZodCheckStartsWith",(e,t)=>{R.init(e,t);let r=new RegExp(`^${pe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Yn=l("$ZodCheckEndsWith",(e,t)=>{R.init(e,t);let r=new RegExp(`.*${pe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Hn=l("$ZodCheckOverwrite",(e,t)=>{R.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var at=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
4
|
+
`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),i=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
5
|
+
${r.join(`
|
|
6
|
+
`)}
|
|
7
|
+
};`)(...Object.values(this.closed))}};var Qn={major:4,minor:6,patch:7};var I=l("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Qn;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,a,u)=>{if(c.memo)return c;let p=V(c),f;for(let d of a){if(d._zod.def.when){if(Nt(c)||!d._zod.def.when(c))continue}else if(p)continue;let m=c.issues.length,h=d._zod.check(c);if(h instanceof Promise&&u?.async===!1)throw new W;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await h,c.issues.length!==m&&(Ne(c.issues,m,e),p||(p=V(c,m)))});else{if(c.issues.length===m)continue;Ne(c.issues,m,e),p||(p=V(c,m))}}return f?f.then(()=>c):c},s=(c,a,u)=>{if(V(c))return c.aborted=!0,c;let p=i(a,o,u);if(p instanceof Promise){if(u.async===!1)throw new W;return p.then(f=>e._zod.parse(f,u))}return e._zod.parse(p,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let p=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return p instanceof Promise?p.then(f=>s(f,c,a)):s(p,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new W;return u.then(p=>i(p,o,a))}return i(u,o,a)}}},{get"~standard"(){return tt(this,"~standard",Ht(this))},set"~standard"(e){ce(this,"~standard",e)}}),lo=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Q(r,t,G()))}:{value:e.value};async function ha(e,t){let r={async:!0};return lo(await e._zod.run({value:t,issues:[]},r),r)}function Ht(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return lo(n,r)}catch{}return ha(e,t)},vendor:"zod",version:1}}var ft=l("$ZodString",(e,t)=>{I.init(e,t),e._zod.pattern=t.pattern??Nn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Z=l("$ZodStringFormat",(e,t)=>{Fe.init(e,t),ft.init(e,t)}),po=l("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=bn),Z.init(e,t)}),fo=l("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Kt(n))}else t.pattern??(t.pattern=Kt());Z.init(e,t)}),mo=l("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zn),Z.init(e,t)}),ho=1,lt=2;function go(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ga(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?go(e)||lt:_a(e,t)}function _a(e,t){if(!t.normalize&&t.protocol?.source===In.source&&!/^https?:\/\//i.test(e))return ho;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??lt}return new URL(e)}catch{return lt}}var ya=/[\t\n\r]/g;function eo(e){return e.replace(ya,"")}function xa(e,t){return t.lastIndex=0,t.test(e.hostname)}function va(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var _o=l("$ZodURL",(e,t)=>{Z.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=ga(n,t);if(o===ho){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===lt){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=eo(n);return}t.hostname&&!xa(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!va(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:eo(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),yo=l("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=$n()),Z.init(e,t)}),xo=l("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?yn:xn(t.length)),Z.init(e,t)}),vo=l("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=dn),Z.init(e,t)}),bo=l("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=mn),Z.init(e,t)}),zo=l("$ZodULID",(e,t)=>{t.pattern??(t.pattern=hn),Z.init(e,t)}),$o=l("$ZodXID",(e,t)=>{t.pattern??(t.pattern=gn),Z.init(e,t)}),wo=l("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=_n),Z.init(e,t)}),ko=l("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Rn(t)),Z.init(e,t)}),So=l("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Tn),Z.init(e,t)}),Po=l("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=An(t)),Z.init(e,t)}),Zo=l("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vn),Z.init(e,t)}),Oo=l("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=wn),Z.init(e,t)}),ba=/^[0-9a-fA-F:.]+$/;function Io(e){return ba.test(e)?go(`http://[${e}]`):!1}var Eo=l("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=kn),Z.init(e,t),e._zod.check=r=>{Io(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Co=l("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Sn),Z.init(e,t)});function za(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:Io(r)}var To=l("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Pn),Z.init(e,t),e._zod.check=r=>{za(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Ao(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var qt=/^[0-9a-zA-Z+/]*={0,2}$/,Ro=l("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=qt),Z.init(e,t),e._zod.check=r=>{Ao(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),dt=/^[A-Za-z0-9_-]*$/;function $a(e){if(!dt.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ao(r)}var No=l("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=dt),Z.init(e,t),e._zod.check=r=>{$a(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Do=l("$ZodE164",(e,t)=>{t.pattern??(t.pattern=En),Z.init(e,t)});function wa(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var jo=l("$ZodJWT",(e,t)=>{Z.init(e,t),e._zod.check=r=>{wa(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Qt=l("$ZodNumber",(e,t)=>{I.init(e,t),e._zod.pattern=Vt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Lo=l("$ZodNumberFormat",(e,t)=>{Un.init(e,t),Qt.init(e,t)}),Fo=l("$ZodBoolean",(e,t)=>{I.init(e,t),e._zod.pattern=Dn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Uo=l("$ZodAny",(e,t)=>{I.init(e,t),e._zod.parse=r=>r}),Mo=l("$ZodUnknown",(e,t)=>{I.init(e,t),e._zod.parse=r=>r}),Bo=l("$ZodNever",(e,t)=>{I.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function ka(e,t){let r=et(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[a,u]of et(e._zod.def.checks))if(c>a&&u._zod.def.when(i)){let p=i.issues.length;return u._zod.check(i),i.issues[p].continue=!1,Ne(i.issues,p,e),i}}return o(i,s)}}var Sa=e=>Array.isArray(e)?e.length:-1;function to(e,t,r){e.issues.length&&t.issues.push(...Re(r,e.issues)),t.value[r]=e.value}var Jo=l("$ZodArray",(e,t)=>{I.init(e,t);let r=U.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let a=0;a<i.length;a++){let u=i[a],p=t.element._zod.run({value:u,issues:[]},o);if(p instanceof Promise)s.push(p.then(f=>to(f,n,a)));else if(to(p,n,a),c&&p.issues.length!==0&&V(p))break}return s.length?Promise.all(s).then(()=>n):n},ka(e,Sa)});function pt(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!(!s&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...Re(r,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(s||o==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}var Pa=[];function Ko(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Pa,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Rt(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Vo(e,t,r,n,o,i,s){let c=[],a=o.keySet,u=o.catchall._zod,p=u.def.type,f=u.optin,d=u.optout,m=0;for(let h in t){if(s&&r.issues.length!==m){if(V(r,m))break;m=r.issues.length}if(a.has(h))continue;if(h==="__proto__"){p==="never"&&c.push(h);continue}if(p==="never"){c.push(h);continue}let x=u.run({value:t[h],issues:[]},n);x instanceof Promise?e.push(x.then(_=>pt(_,r,h,t,f,d))):pt(x,r,h,t,f,d)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var Za=l("$ZodObject",(e,t)=>{I.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let u=()=>{let p={...n};return Object.defineProperty(t,"shape",{value:p}),u.raw=p,p};u.raw=n,Object.defineProperty(t,"shape",{get:u})}let o=Ee(()=>Ko(t));k(e,"propValues",u=>{let p=u.def.shape,f={};for(let d in p){let m=p[d]._zod;if(m.values){Object.prototype.hasOwnProperty.call(f,d)||J(f,d,new Set);for(let h of m.values)f[d].add(h);m.optin!==void 0&&f[d].add(void 0)}}return f});let i=ye,s=t.catchall,c,a=U.memoizer;a?.attach(e),e._zod.parse=(u,p)=>{c??(c=o.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=a?a.alloc(e,u,{},p):{};let d=[],m=c.shape,h=p?.abortEarly,x=u.issues.length;for(let _ of c.allKeys){if(h&&u.issues.length!==x){if(V(u,x))break;x=u.issues.length}if(_==="__proto__")continue;let P=m[_],F=P._zod.optin,ne=P._zod.optout,oe=P._zod.run({value:f[_],issues:[]},p);oe instanceof Promise?d.push(oe.then(O=>pt(O,u,_,f,F,ne))):pt(oe,u,_,f,F,ne)}return s?Vo(d,f,u,p,o.value,e,h===!0):d.length?Promise.all(d).then(()=>u):u}}),Wo=l("$ZodObjectJIT",(e,t)=>{Za.init(e,t);let r=e._zod.parse,n=Ee(()=>Ko(t)),o=U.memoizer,i=m=>{let h=n.value,x=h.symbolKeys,_=new at(["payload","ctx"],{shape:m,inst:e,memo:o,syms:x}),P=O=>`shape[${O}]._zod.run({ value: input[${O}], issues: [] }, ctx)`,F=(O,S)=>`
|
|
8
|
+
let ${O}_ab = false;
|
|
9
|
+
for (let i = 0; i < ${O}.issues.length; i++) {
|
|
10
|
+
const iss = ${O}.issues[i];
|
|
11
|
+
iss.path = iss.path ? [${S}, ...iss.path] : [${S}];
|
|
12
|
+
payload.issues.push(iss);
|
|
13
|
+
if (iss.continue !== true) ${O}_ab = true;
|
|
14
|
+
}
|
|
15
|
+
if (${O}_ab && ctx && ctx.abortEarly) {
|
|
16
|
+
payload.value = newResult;
|
|
17
|
+
return payload;
|
|
18
|
+
}`;_.write("const input = payload.value;");let ne=Object.create(null),oe=0;for(let O of h.allKeys)ne[O]=`key_${oe++}`;_.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let O of h.allKeys){if(O==="__proto__")continue;let S=ne[O],L=typeof O=="symbol"?`syms[${x.indexOf(O)}]`:Et(O),Y=`${L} in input`,ie=m[O],Pe=ie?._zod?.optin,he=Pe!==void 0,Ge=ie?._zod?.optout==="optional";if(_.write(`const ${S} = ${P(L)};`),he&&Ge){let Ze=Pe==="optional"?`${S}_present`:`${S}.value !== undefined || ${S}_present`;_.write(`
|
|
19
|
+
const ${S}_present = ${Y};
|
|
20
|
+
if (!${S}.issues.length || ${S}_present) {
|
|
21
|
+
if (${S}.issues.length) {${F(S,L)}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (${Ze}) {
|
|
25
|
+
newResult[${L}] = ${S}.value;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
`)}else he?(_.write(`
|
|
30
|
+
if (${S}.issues.length) {${F(S,L)}
|
|
31
|
+
}
|
|
32
|
+
`),Pe==="defaulted"?_.write(`newResult[${L}] = ${S}.value;`):_.write(`
|
|
33
|
+
if (${S}.value !== undefined || ${Y}) {
|
|
34
|
+
newResult[${L}] = ${S}.value;
|
|
35
|
+
}
|
|
36
|
+
`)):_.write(`
|
|
37
|
+
const ${S}_present = ${Y};
|
|
38
|
+
if (${S}.issues.length) {${F(S,L)}
|
|
39
|
+
}
|
|
40
|
+
if (!${S}_present && !${S}.issues.length) {
|
|
41
|
+
payload.issues.push({
|
|
42
|
+
code: "invalid_type",
|
|
43
|
+
expected: "nonoptional",
|
|
44
|
+
input: undefined,
|
|
45
|
+
path: [${L}]
|
|
46
|
+
});
|
|
47
|
+
if (ctx && ctx.abortEarly) {
|
|
48
|
+
payload.value = newResult;
|
|
49
|
+
return payload;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (${S}_present) {
|
|
54
|
+
newResult[${L}] = ${S}.value;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
`)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()},s,c=ye,a=!U.jitless,p=a&&Tt.value,f=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=n.value);let x=m.value;return c(x)?a&&p&&h?.async===!1&&h.jitless!==!0?(s||(s=i(t.shape)),m=s(m,h),f?Vo([],x,m,h,d,e,h?.abortEarly===!0):m):r(m,h):(m.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),m)}});function ro(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!V(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(s=>Q(s,n,G())))}),t)}var Go=l("$ZodUnion",(e,t)=>{I.init(e,t),k(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),k(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),k(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),k(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Ce(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)s.push(a),i=!0;else{if(a.issues.length===0)return a;s.push(a)}}return i?Promise.all(s).then(c=>ro(c,n,e,o)):ro(s,n,e,o)}});var Xo=l("$ZodIntersection",(e,t)=>{I.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([a,u])=>no(r,a,u)):no(r,i,s)}});function Yt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(le(e)&&le(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=Yt(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=Yt(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function no(e,t,r){let n=new Map,o,i=new Map,s=(u,p)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let d=String(u.path[0]);i.has(d)||i.set(d,u),f=[d]}else return!1;for(let d of f)n.has(d)||n.set(d,{}),n.get(d)[p]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of r.issues)s(u,"r")||e.issues.push(u);let c=[...n].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=o?c.filter(p=>o.keys.includes(p)):[];u.length&&e.issues.push({...o,keys:u});for(let p of c)!u.includes(p)&&i.has(p)&&e.issues.push(i.get(p))}let a=Yt(t.value,r.value);if(!a.valid){if(V(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var Yo=l("$ZodEnum",(e,t)=>{I.init(e,t);let r=xe(t.entries),n=new Set(r);e._zod.values=n,k(e,"pattern",o=>{let i=xe(o.def.entries).filter(s=>At.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>pe(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}});var Ho=l("$ZodTransform",(e,t)=>{I.init(e,t),e._zod.optin="optional",U.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ze(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new W;return r.value=o,r}});function oo(e,t){return e.value=t.issues.length?void 0:t.value,e}var er=l("$ZodOptional",(e,t)=>{I.init(e,t),k(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",k(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),k(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ce(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>oo(r,i)):oo(r,o)}return t.innerType._zod.run(r,n)}}),qo=l("$ZodExactOptional",(e,t)=>{er.init(e,t),k(e,"values",r=>r.def.innerType._zod.values),k(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Qo=l("$ZodNullable",(e,t)=>{I.init(e,t),k(e,"optin",r=>r.def.innerType._zod.optin),k(e,"optout",r=>r.def.innerType._zod.optout),k(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ce(n.source)}|null)$`):void 0}),k(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ei=l("$ZodDefault",(e,t)=>{I.init(e,t),e._zod.optin="defaulted",k(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>io(i,t)):io(o,t)}});function io(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ti=l("$ZodPrefault",(e,t)=>{I.init(e,t),e._zod.optin="defaulted",k(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),ri=l("$ZodNonOptional",(e,t)=>{I.init(e,t),k(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>so(i,e)):so(o,e)}});function so(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function co(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>Q(o,n,G()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var ni=l("$ZodCatch",(e,t)=>{I.init(e,t),k(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),k(e,"optout",r=>r.def.innerType._zod.optout),k(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>co(r,i,t,n)):co(r,o,t,n)}});var oi=l("$ZodPipe",(e,t)=>{I.init(e,t),k(e,"values",r=>r.def.in._zod.values),k(e,"optin",r=>r.def.in._zod.optin),k(e,"optout",r=>r.def.out._zod.optout),k(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>ut(s,t.in,n)):ut(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ut(i,t.out,n)):ut(o,t.out,n)}});function ut(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var ii=l("$ZodReadonly",(e,t)=>{I.init(e,t),k(e,"propValues",r=>r.def.innerType._zod.propValues),k(e,"values",r=>r.def.innerType._zod.values),k(e,"optin",r=>r.def.innerType?._zod?.optin),k(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(ao):ao(o)}});function ao(e){return e.memo||(e.value=Object.freeze(e.value)),e}var si=l("$ZodCustom",(e,t)=>{R.init(e,t),I.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>uo(i,r,n,e));uo(o,r,n,e)}});function uo(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(be(o))}}var rr=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},nr="~memo",ci=[];function ai(e){return e!==null&&typeof e=="object"}function tr(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var ui=new WeakMap,Ue=0,gt=1,Me=2;function _t(e,t,r){let n=ui.get(e);if(n!==void 0)return n?Me:Ue;if(t.has(e))return Me;t.add(e);let o=Ue,i=p=>{if(o!==Me&&p?._zod){let f=_t(p,t,r);f>o&&(o=f)}},s=(p,f)=>{let d=Ue;for(let m of Reflect.ownKeys(p)){let h=Object.getOwnPropertyDescriptor(p,m);if(f&&!h.enumerable)continue;let x=h.get?gt:h.value?._zod?_t(h.value,t,r):Ue;x>d&&(d=x)}return d},c=p=>{p>o&&(o=p)},a=e._zod.def,u=a.type;switch(u){case"object":{let p=Te(a);c(p?s(p,!0):gt),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let p of a.items)i(p);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let p of a.options)i(p);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let p=a._cachedInner??(r?e._zod.innerType:void 0);c(p?_t(p,t,!1):gt);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let p in a){let f=Object.getOwnPropertyDescriptor(a,p);if(!f||f.get)continue;let d=f.value;if(!(!d||typeof d!="object")){if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}}return t.delete(e),Oa(e,o)}function Oa(e,t){return t!==gt&&ui.set(e,t===Me),t}function Ia(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var mt,ht=[],Ea={alloc(e,t,r){let n=mt;if(!n)return r;mt=void 0;let o={value:r,issues:null};return n.set(t.value,o),ht.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&Ca(i,o.value))throw new rr;return r(o,i)};e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(a,u)=>{if(r===void 0){let P=_t(e,new Set,!1);if(P===Ue)return e._zod.parse=s,e._zod.run===c&&(e._zod.run=s),s(a,u);P===Me||n?r=!0:n=!0}let p=a.value;if(!ai(p))return s(a,u);let f=u[nr];f||(f={buckets:new WeakMap,backEdges:void 0},u[nr]=f);let d;o===u?d=i:(d=Ia(f,e),o=u,i=d);let m=d.get(p);if(m)return a.value=m.value,m.issues?m.issues.length&&a.issues.push(...tr(m.issues)):(a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value)),a;mt=d;let h=ht.length,x=s(a,u);mt=void 0;let _=ht.length>h?ht.pop():void 0;return x instanceof Promise?x.then(P=>(_&&(_.issues=P.issues.length?tr(P.issues):ci),P)):(_&&(_.issues=x.issues.length?tr(x.issues):ci),x)};e._zod.parse=c,e._zod.run===s&&(e._zod.run=c)})}};function li(){return Ea}function Ca(e,t){let r=e[nr]?.backEdges;return r!==void 0&&ai(t)&&r.has(t)}var Ta=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):n[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=Dt(i.input),a=o(c,i.input);return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${He(i.values[0])}`:`Invalid option: expected one of ${Xe(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Xe(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(c=>`'${c}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function pi(){return{localeError:Ta()}}var fi;var or=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Aa(){return new or}(fi=globalThis).__zod_globalRegistry??(fi.__zod_globalRegistry=Aa());var fe=globalThis.__zod_globalRegistry;function di(e){return e.checks&&(e.checks=[...e.checks]),e}function mi(e,t){return new e(di({type:"string",...y(t)}))}function hi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...y(t)})}function gi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...y(t)})}function _i(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...y(t)})}function yi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...y(t)})}function xi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...y(t)})}function vi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...y(t)})}function bi(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...y(t)})}function zi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...y(t)})}function $i(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...y(t)})}function wi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...y(t)})}function ki(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...y(t)})}function Si(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...y(t)})}function Pi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...y(t)})}function Zi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...y(t)})}function Oi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...y(t)})}function Ii(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...y(t)})}function Ei(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...y(t)})}function Ci(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...y(t)})}function Ti(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...y(t)})}function Ai(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...y(t)})}function Ri(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...y(t)})}function Ni(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...y(t)})}function Di(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...y(t)})}function ji(e,t){return new e({type:"string",format:"date",check:"string_format",...y(t)})}function Li(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...y(t)})}function Fi(e,t){return new e({type:"string",format:"duration",check:"string_format",...y(t)})}function Ui(e,t){return new e(di({type:"number",checks:[],...y(t)}))}function Mi(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...y(t)})}function Bi(e,t){return new e({type:"boolean",...y(t)})}function Ji(e){return new e({type:"any"})}function Ki(e){return new e({type:"unknown"})}function Vi(e,t){return new e({type:"never",...y(t)})}function yt(e,t){return new Gt({check:"less_than",...y(t),value:e,inclusive:!1})}function Be(e,t){return new Gt({check:"less_than",...y(t),value:e,inclusive:!0})}function xt(e,t){return new Xt({check:"greater_than",...y(t),value:e,inclusive:!1})}function Je(e,t){return new Xt({check:"greater_than",...y(t),value:e,inclusive:!0})}function vt(e,t){return new Fn({check:"multiple_of",...y(t),value:e})}function bt(e,t){return new Mn({check:"max_length",...y(t),maximum:e})}function $e(e,t){return new Bn({check:"min_length",...y(t),minimum:e})}function zt(e,t){return new Jn({check:"length_equals",...y(t),length:e})}function ir(e,t){return new Kn({check:"string_format",format:"regex",...y(t),pattern:e})}function sr(e){return new Vn({check:"string_format",format:"lowercase",...y(e)})}function cr(e){return new Wn({check:"string_format",format:"uppercase",...y(e)})}function ar(e,t){return new Gn({check:"string_format",format:"includes",...y(t),includes:e})}function ur(e,t){return new Xn({check:"string_format",format:"starts_with",...y(t),prefix:e})}function lr(e,t){return new Yn({check:"string_format",format:"ends_with",...y(t),suffix:e})}function ae(e){return new Hn({check:"overwrite",tx:e})}function pr(e){return ae(t=>t.normalize(e))}function fr(){return ae(e=>e.trim())}function dr(){return ae(e=>e.toLowerCase())}function mr(){return ae(e=>e.toUpperCase())}function hr(){return ae(e=>Ct(e))}function Wi(e,t,r){return new e({type:"array",element:t,...y(r)})}function Gi(e,t,r){return new e({type:"custom",check:"custom",fn:t,...y(r)})}function Xi(e,t){let r=Ra(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(be(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(be(i))}},e(n.value,n)),t);return r}function Ra(e,t){let r=new R({check:"custom",...y(t)});return r._zod.check=e,r}function Ke(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&J(e,n,r[n]);return e}function _r(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??fe,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function de(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}function A(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let p={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,p);else{let d=s.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,p)}let f=e._zod.parent;f&&(s.ref||(s.ref=f),A(f,t,p),t.seen.get(f).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&Ke(s.schema,a),t.io==="input"&&j(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Yi(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function yr(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let a=n.get(c);if(a&&a!==s[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=s=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??(h=>h);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${Yi(m)}`}}let a="#",u=`${a}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:a};let p=s[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:u+Yi(p)}},i=s=>{if(s[1].schema.$ref)return;let c=s[1],{ref:a,defId:u}=o(s);c.def={...c.schema},u&&(c.defId=u);let p=c.schema;for(let f in p)delete p[f];p.$ref=a};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
58
|
+
|
|
59
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}c.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Qi(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;Qi(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;r.includes(s)||r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var es=new Set(["type","properties","required","additionalProperties"]),Hi=["oneOf","anyOf"];function qi(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function gr(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!es.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let u of t){let p=u.properties?.[s]??qi(u);p!=null&&(c.some(f=>JSON.stringify(f)===JSON.stringify(p))||c.push(p))}let a=c.length===1?c[0]:gr(c)??{allOf:c};J(r,s,a)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=qi(s);c&&!i.some(a=>JSON.stringify(a)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function Na(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of es)if(o in e)return;let r=t.filter(o=>Hi.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=gr(t);else{let o=r[0],i=Hi.find(a=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let s=t.filter(a=>a!==o),c=o[i].map(a=>gr([...s,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Ke(e,n))}function xr(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=c=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,p={...u},f=a.ref;if(a.ref=null,f){n(f);let m=e.seen.get(f),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(h)):Ke(u,h),Ke(u,p),c._zod.parent===f)for(let _ in u)_==="$ref"||_==="allOf"||_ in p||delete u[_];if(h.$ref&&m.def)for(let _ in u)_==="$ref"||_==="allOf"||_ in m.def&&JSON.stringify(u[_])===JSON.stringify(m.def[_])&&delete u[_]}let d=c._zod.parent;if(d&&d!==f){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(u.$ref=m.schema.$ref,m.def))for(let h in u)h==="$ref"||h==="allOf"||h in m.def&&JSON.stringify(u[h])===JSON.stringify(m.def[h])&&delete u[h]}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Qi(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let p=u?.allOf;if(!Array.isArray(p))continue;let f=c.get(p);f?f.push(u):c.set(p,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])Na(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Ke(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,J(s,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ve(t,"input",e.processors),output:Ve(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function j(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return j(n.element,r);if(n.type==="set")return j(n.valueType,r);if(n.type==="lazy")return j(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return j(n.innerType,r);if(n.type==="intersection")return j(n.left,r)||j(n.right,r);if(n.type==="record"||n.type==="map")return j(n.keyType,r)||j(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:j(n.in,r)||j(n.out,r);if(n.type==="object"){for(let o in n.shape)if(j(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(j(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(j(o,r))return!0;return!!(n.rest&&j(n.rest,r))}return!1}var ts=(e,t={})=>r=>{let n=_r({...r,processors:t});return A(e,n),yr(n,e),xr(n,e)},Ve=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=_r({...o??{},target:i,io:t,processors:r});return A(e,s),yr(s,e),xr(s,e)};var we=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},ke=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},rs=(e,t)=>{we(e,"minimum",t),ke(e,"maximum",t)},ss=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},cs=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},as=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},us=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},ns=(e,t)=>we(e,"minimum",t.minimum),os=(e,t)=>ke(e,"maximum",t.maximum),is=e=>(t,r)=>{us(t,r.format);let[n,o]=e[r.format];we(t,"minimum",n),ke(t,"maximum",o)},Da={greater_than:(e,t)=>we(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ke(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>ss(e,t.value),number_format:is(Ae),bigint_format:is(qe),min_length:ns,max_length:os,length_equals:(e,t)=>rs(e,t.length),min_size:ns,max_size:os,size_equals:(e,t)=>rs(e,t.size),string_format:(e,t)=>{us(e,t.format),t.pattern&&cs(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>as(e,t.mime)};function X(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)Da[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&we(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&we(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&ke(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&ke(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&ss(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&as(t,o.mime);for(let i of o.patterns??[])cs(t,i);return t}var ja={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},La=new Map([[qt,Zn],[dt,On]]),Fa=e=>La.get(e)??e,ls=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:a,contentEncoding:u,laxFormat:p}=X(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),c&&(o.format=ja[c]??c,o.format===""&&delete o.format,(c==="time"||p)&&delete o.format),u&&(o.contentEncoding=u),a&&a.size>0){let f=[...a].map(Fa);f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},ps=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:p}=X(e);o.type=p?"integer":"number";let f=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),d=typeof a=="number"&&a<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f?m?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),d?m?(o.maximum=a,o.exclusiveMaximum=!0):o.exclusiveMaximum=a:typeof s=="number"&&(o.maximum=s),c){let h=new Set;for(let P of c)Number.isFinite(P)&&P!==0?h.add(Math.abs(P)):de(e,t,o,n,`A multipleOf divisor of ${P} cannot be represented in JSON Schema`);let[x,..._]=h;x!==void 0&&(o.multipleOf=x),_.length&&(o.allOf=[...o.allOf??[],..._.map(P=>({multipleOf:P}))])}},fs=(e,t,r,n)=>{r.type="boolean"};var ds=(e,t,r,n)=>{r.not={}},ms=(e,t,r,n)=>{},hs=(e,t,r,n)=>{};var gs=(e,t,r,n)=>{let o=e._zod.def,i=xe(o.entries);if(i.length===0){r.not={};return}i.every(s=>typeof s=="number")&&(r.type="number"),i.every(s=>typeof s=="string")&&(r.type="string"),r.enum=i};var _s=(e,t,r,n)=>{de(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var ys=(e,t,r,n)=>{de(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var xs=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=X(e);typeof s=="number"&&(o.minItems=s),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=A(i.element,t,{...n,path:[...n.path,"items"]})};function vr(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?vr(t.out):t.type==="catch"?vr(t.innerType):e._zod.optin}var vs=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&de(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)J(o.properties,u,A(s[u],t,{...n,path:[...n.path,"properties",u]}));let a=[];for(let u of Object.keys(s)){let p=i.shape[u];(t.io==="input"?vr(p)===void 0:p._zod.optout===void 0)&&a.push(u)}a.length>0&&(o.required=a),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=A(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},bs=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,a)=>A(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));i?r.oneOf=s:r.anyOf=s},zs=(e,t,r,n)=>{let o=e._zod.def,i=A(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=A(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,a=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=a,t.intersections.push(a)};var $s=(e,t,r,n)=>{let o=e._zod.def,i=A(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},ws=(e,t,r,n)=>{let o=e._zod.def;A(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},br=Symbol();function ks(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(i=!0,null));return i?(de(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),br):JSON.parse(s)}var Ss=(e,t,r,n)=>{let o=e._zod.def;A(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=ks(o.defaultValue,e,t,r,n);s!==br&&(r.default=s)},Ps=(e,t,r,n)=>{let o=e._zod.def;A(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=ks(o.defaultValue,e,t,r,n);s!==br&&(r._prefault=s)},Zs=(e,t,r,n)=>{let o=e._zod.def;A(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{de(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Os=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;A(s,t,n);let c=t.seen.get(e);c.ref=s},Is=(e,t,r,n)=>{let o=e._zod.def;A(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var zr=(e,t,r,n)=>{let o=e._zod.def;A(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var Es=new WeakSet([Object.prototype,Error.prototype]);function $t(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Ga=(e,t)=>{en.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Es.has(r)||(Es.add(r),$t(r,"format",n=>o=>rn(n,o)),$t(r,"flatten",n=>o=>tn(n,o)),$t(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ve,2)}),$t(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ve,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var M=l("ZodError",Ga,void 0,{Parent:Error});var Cs=nt(M),Ts=ot(M),As=it(M),Rs=st(M),Ns=on(M),Ds=sn(M),js=cn(M),Ls=an(M),Fs=un(M),Us=ln(M),Ms=pn(M),Bs=fn(M);function Ya(){U.localeError||G(pi())}function kr(){U.memoizer||G({memoizer:li()})}var C=l("ZodType",(e,t)=>(Ya(),I.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(b.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return K(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Gu(e,t))},superRefine(e,t){return this.check(Xu(e,t))},overwrite(e){return this.check(ae(e))},optional(){return Vs(this)},exactOptional(){return Ru(this)},nullable(){return Ws(this)},nullish(){return Vs(Ws(this))},nonoptional(e){return Uu(this,e)},array(){return ee(this)},or(e){return Ou([this,e])},and(e){return Eu(this,e)},transform(e){return Gs(this,Au(e))},default(e){return ju(this,e)},prefault(e){return Fu(this,e)},catch(e){return Bu(this,e)},pipe(e){return Gs(this,e)},readonly(){return Vu(this)},describe(e){let t=this.clone();return fe.add(t,{description:e}),t},meta(...e){if(e.length===0)return fe.get(this);let t=this.clone();return fe.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return b.hide(this,"~standard",{...Ht(this),jsonSchema:{input:Ve(this,"input"),output:Ve(this,"output")}})},set"~standard"(e){b.own(this,"~standard",e)},parse:function e(t,r){return Cs(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Ts(this,t,r,{callee:e})},safeParse(e,t){return As(this,e,t)},async safeParseAsync(e,t){return Rs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){b.own(this,"spa",e)},validate(e,t){return Mt(this,e,t)},validateAsync(e,t){return Bt(this,e,t)},encode:function e(t,r){return Ns(this,t,r,{callee:e})},decode:function e(t,r){return Ds(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await js(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Ls(this,t,r,{callee:e})},safeEncode(e,t){return Fs(this,e,t)},safeDecode(e,t){return Us(this,e,t)},async safeEncodeAsync(e,t){return Ms(this,e,t)},async safeDecodeAsync(e,t){return Bs(this,e,t)},toJSONSchema(e){return ts(this,{})(e)},get description(){return fe.get(this)?.description},get _def(){return this._zod.def}}),Xs=l("_ZodString",(e,t)=>{ft.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ls(e,r,n,o)},b.derived({format:e=>X(e).format??null,minLength:e=>X(e).minimum??null,maxLength:e=>X(e).maximum??null},{regex(...e){return this.check(ir(...e))},includes(...e){return this.check(ar(...e))},startsWith(...e){return this.check(ur(...e))},endsWith(...e){return this.check(lr(...e))},min(...e){return this.check($e(...e))},max(...e){return this.check(bt(...e))},length(...e){return this.check(zt(...e))},nonempty(...e){return this.check($e(1,...e))},lowercase(e){return this.check(sr(e))},uppercase(e){return this.check(cr(e))},trim(){return this.check(fr())},normalize(...e){return this.check(pr(...e))},toLowerCase(){return this.check(dr())},toUpperCase(){return this.check(mr())},slugify(){return this.check(hr())}})),Ha=l("ZodString",(e,t)=>{ft.init(e,t),Xs.init(e,t)},{email(e){return this.check(hi(ru,e))},url(e){return this.check(bi(ou,e))},jwt(e){return this.check(Ni(xu,e))},emoji(e){return this.check(zi(iu,e))},guid(e){return this.check(gi(nu,e))},uuid(e){return this.check(_i(wt,e))},uuidv4(e){return this.check(yi(wt,e))},uuidv6(e){return this.check(xi(wt,e))},uuidv7(e){return this.check(vi(wt,e))},nanoid(e){return this.check($i(su,e))},cuid(e){return this.check(wi(cu,e))},cuid2(e){return this.check(ki(au,e))},ulid(e){return this.check(Si(uu,e))},base64(e){return this.check(Ti(gu,e))},base64url(e){return this.check(Ai(_u,e))},xid(e){return this.check(Pi(lu,e))},ksuid(e){return this.check(Zi(pu,e))},ipv4(e){return this.check(Oi(fu,e))},ipv6(e){return this.check(Ii(du,e))},cidrv4(e){return this.check(Ei(mu,e))},cidrv6(e){return this.check(Ci(hu,e))},e164(e){return this.check(Ri(yu,e))},datetime(e){return this.check(Di(qa,e))},date(e){return this.check(ji(Qa,e))},time(e){return this.check(Li(eu,e))},duration(e){return this.check(Fi(tu,e))}});function Sr(e){return mi(Ha,e)}var E=l("ZodStringFormat",(e,t)=>{Z.init(e,t),Xs.init(e,t)}),qa=l("ZodISODateTime",(e,t)=>{ko.init(e,t),E.init(e,t)}),Qa=l("ZodISODate",(e,t)=>{So.init(e,t),E.init(e,t)}),eu=l("ZodISOTime",(e,t)=>{Po.init(e,t),E.init(e,t)}),tu=l("ZodISODuration",(e,t)=>{Zo.init(e,t),E.init(e,t)}),ru=l("ZodEmail",(e,t)=>{mo.init(e,t),E.init(e,t)});var nu=l("ZodGUID",(e,t)=>{po.init(e,t),E.init(e,t)});var wt=l("ZodUUID",(e,t)=>{fo.init(e,t),E.init(e,t)});var ou=l("ZodURL",(e,t)=>{_o.init(e,t),E.init(e,t)});var iu=l("ZodEmoji",(e,t)=>{yo.init(e,t),E.init(e,t)});var su=l("ZodNanoID",(e,t)=>{xo.init(e,t),E.init(e,t)});var cu=l("ZodCUID",(e,t)=>{vo.init(e,t),E.init(e,t)});var au=l("ZodCUID2",(e,t)=>{bo.init(e,t),E.init(e,t)});var uu=l("ZodULID",(e,t)=>{zo.init(e,t),E.init(e,t)});var lu=l("ZodXID",(e,t)=>{$o.init(e,t),E.init(e,t)});var pu=l("ZodKSUID",(e,t)=>{wo.init(e,t),E.init(e,t)});var fu=l("ZodIPv4",(e,t)=>{Oo.init(e,t),E.init(e,t)});var du=l("ZodIPv6",(e,t)=>{Eo.init(e,t),E.init(e,t)});var mu=l("ZodCIDRv4",(e,t)=>{Co.init(e,t),E.init(e,t)});var hu=l("ZodCIDRv6",(e,t)=>{To.init(e,t),E.init(e,t)});var gu=l("ZodBase64",(e,t)=>{Ro.init(e,t),E.init(e,t)});var _u=l("ZodBase64URL",(e,t)=>{No.init(e,t),E.init(e,t)});var yu=l("ZodE164",(e,t)=>{Do.init(e,t),E.init(e,t)});var xu=l("ZodJWT",(e,t)=>{jo.init(e,t),E.init(e,t)});var Ys=l("ZodNumber",(e,t)=>{Qt.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ps(e,r,n,o),e.isFinite=!0},b.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=X(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=X(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=X(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>X(e).format??null},{gt(e,t){return this.check(xt(e,t))},gte(e,t){return this.check(Je(e,t))},min(e,t){return this.check(Je(e,t))},lt(e,t){return this.check(yt(e,t))},lte(e,t){return this.check(Be(e,t))},max(e,t){return this.check(Be(e,t))},int(e){return this.check(Js(e))},safe(e){return this.check(Js(e))},positive(e){return this.check(xt(0,e))},nonnegative(e){return this.check(Je(0,e))},negative(e){return this.check(yt(0,e))},nonpositive(e){return this.check(Be(0,e))},multipleOf(e,t){return this.check(vt(e,t))},step(e,t){return this.check(vt(e,t))},finite(){return this}}));function me(e){return Ui(Ys,e)}var vu=l("ZodNumberFormat",(e,t)=>{Lo.init(e,t),Ys.init(e,t)});function Js(e){return Mi(vu,e)}var bu=l("ZodBoolean",(e,t)=>{Fo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fs(e,r,n,o)});function B(e){return Bi(bu,e)}var zu=l("ZodAny",(e,t)=>{Uo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ms(e,r,n,o)});function Pr(){return Ji(zu)}var $u=l("ZodUnknown",(e,t)=>{Mo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hs(e,r,n,o)});function Ks(){return Ki($u)}var wu=l("ZodNever",(e,t)=>{Bo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ds(e,r,n,o)});function ku(e){return Vi(wu,e)}var Su=l("ZodArray",(e,t)=>{kr(),Jo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xs(e,r,n,o),e.element=t.element},{min(e,t){return this.check($e(e,t))},nonempty(e){return this.check($e(1,e))},max(e,t){return this.check(bt(e,t))},length(e,t){return this.check(zt(e,t))},unwrap(){return this.element}});function ee(e,t){return Wi(Su,e,t)}var Pu=l("ZodObject",(e,t)=>{kr(),Wo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vs(e,r,n,o),b.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Cu(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(b.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(b.mergeDefs(this._zod.def,{catchall:Ks()}))},loose(){return this.clone(b.mergeDefs(this._zod.def,{catchall:Ks()}))},strict(){return this.clone(b.mergeDefs(this._zod.def,{catchall:ku()}))},strip(){return this.clone(b.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return b.extend(this,e)},safeExtend(e){return b.safeExtend(this,e)},merge(e){return b.merge(this,e)},pick(e){return b.pick(this,e)},omit(e){return b.omit(this,e)},partial(...e){return b.partial(Hs,this,e[0])},exactPartial(...e){return b.partial(qs,this,e[0],"exactPartial")},required(...e){return b.required(Qs,this,e[0])}});function N(e,t){let r={type:"object",shape:e??{},...b.normalizeParams(t)};return new Pu(r)}var Zu=l("ZodUnion",(e,t)=>{Go.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bs(e,r,n,o),e.options=t.options});function Ou(e,t){return new Zu({type:"union",options:e,...b.normalizeParams(t)})}var Iu=l("ZodIntersection",(e,t)=>{Xo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zs(e,r,n,o)});function Eu(e,t){return new Iu({type:"intersection",left:e,right:t})}var wr=l("ZodEnum",(e,t)=>{Yo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(n,o,i)=>gs(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new wr({...t,checks:[],...b.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new wr({...t,checks:[],...b.normalizeParams(o),entries:i})}});function Cu(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new wr({type:"enum",entries:r,...b.normalizeParams(t)})}var Tu=l("ZodTransform",(e,t)=>{kr(),Ho.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ys(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ze(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(b.issue(i,r.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=r.value),s.inst??(s.inst=e),r.issues.push(b.issue(s))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Au(e){return new Tu({type:"transform",transform:e})}var Hs=l("ZodOptional",(e,t)=>{er.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Vs(e){return new Hs({type:"optional",innerType:e})}var qs=l("ZodExactOptional",(e,t)=>{qo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ru(e){return new qs({type:"optional",innerType:e})}var Nu=l("ZodNullable",(e,t)=>{Qo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$s(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ws(e){return new Nu({type:"nullable",innerType:e})}var Du=l("ZodDefault",(e,t)=>{ei.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ss(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ju(e,t){return new Du({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}var Lu=l("ZodPrefault",(e,t)=>{ti.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ps(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Fu(e,t){return new Lu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}var Qs=l("ZodNonOptional",(e,t)=>{ri.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ws(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Uu(e,t){return new Qs({type:"nonoptional",innerType:e,...b.normalizeParams(t)})}var Mu=l("ZodCatch",(e,t)=>{ni.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Bu(e,t){return new Mu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:b.constantCatch(t)})}var Ju=l("ZodPipe",(e,t)=>{oi.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Os(e,r,n,o),e.in=t.in,e.out=t.out});function Gs(e,t){return new Ju({type:"pipe",in:e,out:t})}var Ku=l("ZodReadonly",(e,t)=>{ii.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Is(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Vu(e){return new Ku({type:"readonly",innerType:e})}var Wu=l("ZodCustom",(e,t)=>{si.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_s(e,r,n,o)});function Gu(e,t={}){return Gi(Wu,e,t)}function Xu(e,t){return Xi(e,t)}var Ir="@avantf/dsh-identity",Se="avantfIdentity";function Zr(e,t){return{mode:"strict",typeSymbol:t,schema:e,create:()=>e}}var tc=e=>`${Ir}#${Se}/${e}`,Or=(e,t)=>`${Ir}#${Se}/${e}:${t}`;function te(e,t){return{id:tc(e),service:Se,namespace:Se,method:e,invocation:{kind:"direct"},parameters:[{name:"args",wire:"args",source:"json",codec:Zr(t,Or(e,"args"))}],result:Zr(Pr(),Or(e,"result"))}}function ec(e){return{id:tc(e),service:Se,namespace:Se,method:e,invocation:{kind:"direct"},parameters:[],result:Zr(Pr(),Or(e,"result"))}}var re=Sr().optional(),$=Sr(),rc=[te("status",N({locale:re})),ec("listPresets"),ec("readProfile"),te("writeProfileFile",N({name:$,text:$})),te("ensureProfile",N({locale:re})),te("applyPreset",N({id:$,locale:re})),te("resetToPreset",N({id:$,locale:re})),te("saveAsPreset",N({id:$,locale:re})),te("readPreset",N({id:$,locale:re})),te("writePresetFile",N({id:$,name:$,text:$,locale:re})),te("deletePreset",N({id:$}))],nc=N({name:$,file:$,text:$,present:B(),bytes:me()}),Yu=N({name:$,file:$,path:$,present:B(),bytes:me()}),Hu=N({id:$,locales:ee($),active:B()}),qu=N({enabled:B(),profile:$,dataHome:$,identityDir:$,presetsDir:$,fileCount:me(),totalBytes:me(),maxBytes:me(),interpolate:B(),replaceScope:$,drop:ee($),fallbackToNative:B(),activePreset:$,activeLocale:$,hasLocalEdit:B(),locale:$,localeSource:$,files:ee(Yu),presets:ee(Hu)}),Qu=N({profile:$,identityDir:$,totalBytes:me(),files:ee(nc)}),el=N({found:B(),id:$,requestedLocale:$,resolvedLocale:$,fellBack:B(),files:ee(nc)}),tl=N({ok:B(),error:re,resolvedLocale:re,fellBack:B().optional(),files:ee($).optional()}),We=(e,t)=>({name:e,schema:t,create:()=>t}),Lf=[...rc.flatMap(e=>e.parameters.map(t=>We(`${e.method}${t.name}`,t.codec.schema))),We("statusResult",qu),We("profileResult",Qu),We("writeResult",tl),We("presetResult",el)];var oc={package:Ir,descriptors:rc};var D=require("react"),v=require("react/jsx-runtime"),ic=["IDENTITY","SOUL","RULES"],sc={boxSizing:"border-box",height:"32px",padding:"0 8px",borderRadius:"var(--dsw-radius-md, 6px)",border:"0.5px solid var(--dsw-alias-border-l4, #444)",background:"var(--dsw-alias-bg-layer-1, transparent)",color:"var(--dsw-alias-label-primary, inherit)",fontSize:"14px",lineHeight:"22px"},z={root:{display:"flex",flexDirection:"column",gap:"14px",padding:"4px 2px 20px",color:"var(--dsw-alias-label-primary, inherit)"},title:{fontSize:"17px",fontWeight:600,margin:0},card:{border:"1px solid var(--dsw-alias-border-l2, #3a3a3a)",borderRadius:"8px",background:"var(--dsw-alias-bg-layer-1, transparent)",padding:"12px",display:"flex",flexDirection:"column",gap:"8px"},row:{display:"flex",alignItems:"center",gap:"10px",flexWrap:"wrap"},identityRow:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"10px"},overlay:{position:"fixed",inset:0,zIndex:1100,display:"flex",alignItems:"center",justifyContent:"center",padding:"24px",background:"var(--dsw-alias-bg-mask-1, rgba(0, 0, 0, 0.45))",backdropFilter:"var(--dsw-mask-blur, none)"},dialog:{boxSizing:"border-box",display:"flex",flexDirection:"column",gap:"20px",width:"min(380px, 100%)",padding:"20px 24px 24px",borderRadius:"var(--dsw-radius-panel, 12px)",background:"var(--dsw-alias-bg-layer-2, #242424)",boxShadow:"var(--dsw-elevation-prominent, 0 12px 32px rgba(0, 0, 0, 0.45))"},dialogTitle:{margin:0,fontSize:"16px",lineHeight:"24px",fontWeight:500,color:"var(--dsw-alias-label-primary, inherit)"},dialogFooter:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},label:{fontSize:"12px",fontWeight:600},hint:{fontSize:"11px",color:"var(--dsw-alias-label-secondary, #888)",lineHeight:1.6},textarea:{width:"100%",minHeight:"120px",resize:"vertical",boxSizing:"border-box",fontFamily:"ui-monospace, SFMono-Regular, monospace",fontSize:"12px",lineHeight:1.6,padding:"8px",borderRadius:"var(--dsw-radius-md, 6px)",color:"var(--dsw-alias-label-primary, inherit)",background:"var(--dsw-alias-bg-layer-1, transparent)",border:"0.5px solid var(--dsw-alias-border-l4, #444)"},input:sc,identitySelect:{...sc,flex:"1 1 auto",minWidth:0},button:{padding:"5px 12px",borderRadius:"var(--dsw-radius-md, 6px)",fontSize:"13px",cursor:"pointer",color:"var(--dsw-alias-label-primary, inherit)",background:"transparent",border:"0.5px solid var(--dsw-alias-border-l3, #3a3a3a)"},primary:{padding:"5px 12px",borderRadius:"var(--dsw-radius-md, 6px)",fontSize:"13px",cursor:"pointer",color:"var(--dsw-alias-label-primary-foreground, #fff)",background:"var(--dsw-alias-button-primary-fill, #2f6feb)",border:"0.5px solid transparent"},error:{fontSize:"12px",color:"var(--dsw-alias-state-error-primary, #d9534f)"},ok:{fontSize:"12px",color:"var(--dsw-alias-state-success-primary, #3aa76d)"}},rl={IDENTITY:"fileIdentity",SOUL:"fileSoul",RULES:"fileRules"},nl=["profile","dataHome","fileCount","drop","files","presets"];function ac(e){let{t,getRemote:r,whenMounted:n,getConfigForm:o,locale:i}=e,[s,c]=(0,D.useState)(void 0),[a,u]=(0,D.useState)({IDENTITY:"",SOUL:"",RULES:""}),[p,f]=(0,D.useState)({IDENTITY:"",SOUL:"",RULES:""}),[d,m]=(0,D.useState)(void 0),[h,x]=(0,D.useState)(void 0),[_,P]=(0,D.useState)(!1),[F,ne]=(0,D.useState)(void 0),[oe,O]=(0,D.useState)(void 0),[S,L]=(0,D.useState)(""),[Y,ie]=(0,D.useState)(void 0),[Pe,he]=(0,D.useState)(!1),Ge=g=>{O(g instanceof Error?g.message:String(g)),ne(void 0)},Ze=(0,D.useCallback)(async()=>{let g=r();if(g!==void 0)try{let[w,T]=await Promise.all([g.status({locale:i()}),g.readProfile()]);c(w),u(cc(T.files)),f(cc(T.files)),O(void 0)}catch(w){Ge(w)}},[r,i]);(0,D.useEffect)(()=>{let g=o();if(g===void 0)return;m(g);let w=()=>{try{x(g.getSnapshot().value?.enabled===!0)}catch{x(void 0)}};return w(),g.subscribe(w)},[o]),(0,D.useEffect)(()=>{let g=!0;return n().then(()=>{g&&Ze()}),()=>{g=!1}},[n,Ze]);let Tr=async g=>{P(!0);try{await g(),O(void 0),await Ze()}catch(w){Ge(w)}finally{P(!1)}},Oe=async g=>{let w=r();w!==void 0&&await Tr(()=>g(w))},dc=async g=>{d!==void 0&&await Tr(async()=>{if(await d.set("enabled",g)&&x(g),g){let w=r();if(w?.ensureProfile!==void 0){let T=await w.ensureProfile({locale:i()});if(!T.ok)throw new Error(T.error??"seeding the identity failed")}}})},mc=async()=>{await Oe(async g=>{for(let w of ic){if(a[w]===p[w])continue;let T=await g.writeProfileFile({name:w,text:a[w]});if(!T.ok)throw new Error(T.error??`writing ${w}.md failed`)}ne(t("saved"))})},hc=async g=>{await Oe(async w=>{let T=await w.applyPreset({id:g,locale:i()});if(!T.ok)throw new Error(T.error??"apply failed")})},gc=async g=>{let w=r();if(w!==void 0){if(w.resetToPreset===void 0){O(t("unavailable"));return}await Oe(async T=>{let Nr=await T.resetToPreset({id:g,locale:i()});if(!Nr.ok)throw new Error(Nr.error??"restore failed")})}},_c=async g=>{await Oe(async w=>{let T=await w.deletePreset({id:g});if(!T.ok)throw new Error(T.error??"delete failed")})},yc=async()=>{await Oe(async g=>{let w=await g.saveAsPreset({id:S.trim(),locale:i()});if(!w.ok)throw new Error(w.error??"save-as failed");L("")})},ge=r()===void 0,Ar=s?.presets??[],Ie=Ar.find(g=>g.active)?.id??"",xc=s===void 0?[]:Object.keys(s),Rr=s===void 0?[]:nl.filter(g=>s[g]===void 0);return(0,v.jsxs)("div",{style:z.root,children:[(0,v.jsx)("h2",{style:z.title,children:t("title")}),ge?(0,v.jsx)("div",{style:z.error,children:t("unavailable")}):null,oe!==void 0?(0,v.jsx)("div",{style:z.error,children:oe}):null,F!==void 0?(0,v.jsx)("div",{style:z.ok,children:F}):null,Rr.length>0?(0,v.jsxs)("div",{style:z.error,children:[t("missingFields"),": ",Rr.join(", ")," \xB7 ",t("received"),": ",xc.join(", ")||t("empty")]}):null,(0,v.jsx)("div",{style:z.card,children:(0,v.jsxs)("div",{style:z.row,children:[(0,v.jsx)("input",{type:"checkbox",checked:h===!0,disabled:d===void 0||_,onChange:g=>{dc(g.target.checked)}}),(0,v.jsx)("span",{style:z.label,children:t("switch")}),d===void 0?(0,v.jsx)("span",{style:z.hint,children:t("noConfigForm")}):null]})}),h===!0?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("div",{style:z.card,children:[(0,v.jsxs)("div",{style:z.identityRow,children:[(0,v.jsx)("select",{style:z.identitySelect,value:Ie,disabled:_||ge,onChange:g=>{g.target.value!==""&&ie({kind:"apply",id:g.target.value})},children:Ar.map(g=>(0,v.jsx)("option",{value:g.id,children:g.id},g.id))}),(0,v.jsx)("button",{type:"button",style:z.button,disabled:_||ge||Ie==="",onClick:()=>{ie({kind:"delete",id:Ie})},children:t("del")})]}),s?.hasLocalEdit===!0?(0,v.jsxs)("div",{style:z.row,children:[(0,v.jsx)("span",{style:z.hint,children:t("modified")}),(0,v.jsx)("button",{type:"button",style:z.button,disabled:_||ge||Ie==="",onClick:()=>{ie({kind:"restore",id:Ie})},children:t("restore")})]}):null]}),(0,v.jsxs)("div",{style:z.card,children:[ic.map(g=>(0,v.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[(0,v.jsx)("span",{style:z.label,children:t(rl[g])}),(0,v.jsx)("textarea",{style:z.textarea,value:a[g],placeholder:t("empty"),onChange:w=>{u(T=>({...T,[g]:w.target.value}))}})]},g)),(0,v.jsxs)("div",{style:z.row,children:[(0,v.jsx)("button",{type:"button",style:z.primary,disabled:_||ge,onClick:()=>{mc()},children:t("save")}),(0,v.jsx)("button",{type:"button",style:z.button,disabled:_||ge,onClick:()=>{L(""),he(!0)},children:t("saveAs")}),(0,v.jsx)("span",{style:z.hint,children:t("saved")})]})]})]}):null,Y!==void 0?(0,v.jsx)("div",{style:z.overlay,role:"presentation",children:(0,v.jsxs)("div",{style:z.dialog,role:"dialog","aria-modal":"true",children:[(0,v.jsx)("h3",{style:z.dialogTitle,children:t(Y.kind==="apply"?"confirmApply":Y.kind==="restore"?"confirmReset":"confirmDelete",{id:Y.id})}),(0,v.jsxs)("div",{style:z.dialogFooter,children:[(0,v.jsx)("button",{type:"button",style:z.button,onClick:()=>{ie(void 0)},children:t("cancel")}),(0,v.jsx)("button",{type:"button",style:z.primary,disabled:_,onClick:()=>{let g=Y;ie(void 0),g.kind==="apply"?hc(g.id):g.kind==="restore"?gc(g.id):_c(g.id)},children:t("ok")})]})]})}):null,Pe?(0,v.jsx)("div",{style:z.overlay,role:"presentation",children:(0,v.jsxs)("div",{style:z.dialog,role:"dialog","aria-modal":"true",children:[(0,v.jsx)("h3",{style:z.dialogTitle,children:t("saveAs")}),(0,v.jsx)("input",{style:z.input,value:S,placeholder:t("newPresetId"),onChange:g=>{L(g.target.value)}}),(0,v.jsxs)("div",{style:z.dialogFooter,children:[(0,v.jsx)("button",{type:"button",style:z.button,onClick:()=>{he(!1)},children:t("cancel")}),(0,v.jsx)("button",{type:"button",style:z.primary,disabled:_||S.trim()==="",onClick:()=>{he(!1),yc()},children:t("ok")})]})]})}):null]})}function cc(e){let t={IDENTITY:"",SOUL:"",RULES:""};for(let r of e)(r.name==="IDENTITY"||r.name==="SOUL"||r.name==="RULES")&&(t[r.name]=r.text);return t}function uc(e,t){let r=e;if(!(r==null||typeof r.get!="function"))try{let n=r.get(t);return typeof n?.subscribe=="function"&&typeof n.getSnapshot=="function"?n:void 0}catch{return}}var ol=["status","listPresets","readProfile","writeProfileFile","ensureProfile","applyPreset","resetToPreset","saveAsPreset","readPreset","writePresetFile","deletePreset"],Er=class extends Error{};function il(e){let t=e;if(!(t!==null&&typeof t=="object"&&typeof t.ok=="boolean"))return e;if(t.ok===!1){let n=typeof t.error=="string"?t.error:JSON.stringify(t.error??"transport failed");throw new Er(n)}return Object.hasOwn(t,"value")?t.value:e}function lc(e){if(e===void 0)return;let t=e,r={};for(let n of ol){let o=t[n];typeof o=="function"&&(r[n]=async i=>il(await o.apply(e,i===void 0?[]:[i])))}return r}var sl="avantf-identity",cl=["remote","slots","locale"],al="avantf-identity",Cr="settings.identity",pc="[avantf-identity]",ul={nav:"\u8EAB\u4EFD",title:"\u8EAB\u4EFD",switch:"\u542F\u7528\u8EAB\u4EFD",fileIdentity:"\u8EAB\u4EFD\uFF08IDENTITY.md\uFF09",fileSoul:"\u6027\u683C\uFF08SOUL.md\uFF09",fileRules:"\u89C4\u5219\uFF08RULES.md\uFF09",save:"\u4FDD\u5B58",saved:"\u5DF2\u4FDD\u5B58\uFF0C\u65B0\u4F1A\u8BDD\u751F\u6548",empty:"\uFF08\u7A7A\uFF09",del:"\u5220\u9664",saveAs:"\u5B58\u4E3A\u65B0\u9884\u8BBE",newPresetId:"\u65B0\u9884\u8BBE id\uFF08\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u4E0E\u8FDE\u5B57\u7B26\uFF09",ok:"\u786E\u5B9A",cancel:"\u53D6\u6D88",unavailable:"\u8EAB\u4EFD Remote \u5C1A\u672A\u6302\u8F7D\uFF1A\u8BF7\u91CD\u542F dsh \u540E\u518D\u8BD5\u3002",noConfigForm:"\u8BBE\u7F6E\u8868\u5355\u5C1A\u672A\u5C31\u7EEA\uFF0C\u5F00\u5173\u6682\u4E0D\u53EF\u7528\u3002",confirmApply:"\u662F\u5426\u542F\u7528 {id}\uFF1F\u786E\u5B9A\u540E\u65B0\u4F1A\u8BDD\u751F\u6548\u3002",confirmDelete:"\u5220\u9664\u8FD9\u4E2A\u9884\u8BBE\uFF1F\uFF08\u4F60\u5728\u672C profile \u4FDD\u5B58\u7684\u8BE5\u8EAB\u4EFD\u7248\u672C\u4E5F\u4F1A\u4E00\u8D77\u5220\u9664\uFF09",restore:"\u6062\u590D\u9884\u8BBE\u539F\u6587",confirmReset:"\u628A\u300C{id}\u300D\u6062\u590D\u4E3A\u9884\u8BBE\u539F\u6587\uFF1F\u4F60\u5728\u672C profile \u5BF9\u5B83\u505A\u7684\u4FEE\u6539\u4F1A\u88AB\u4E22\u5F03\u3002",modified:"\u5DF2\u4FEE\u6539\uFF08\u672C profile\uFF09",missingFields:"\u72B6\u6001\u5B57\u6BB5\u7F3A\u5931",received:"\u5B9E\u6536\u5B57\u6BB5"},ll={nav:"Identity",title:"Identity",switch:"Use the identity",fileIdentity:"Identity (IDENTITY.md)",fileSoul:"Soul (SOUL.md)",fileRules:"Rules (RULES.md)",save:"Save",saved:"Saved; it takes effect in a new session",empty:"(empty)",del:"Delete",saveAs:"Save as preset",newPresetId:"New preset id (lower-case letters, digits, hyphens)",ok:"OK",cancel:"Cancel",unavailable:"The identity Remote is not mounted yet; restart dsh and try again.",noConfigForm:"The settings form is not ready yet, so the switch is unavailable.",confirmApply:"Enable {id}? It takes effect in a new session.",confirmDelete:"Delete this preset? Your saved version of it in this profile goes too.",restore:"Restore preset text",confirmReset:"Restore \u201C{id}\u201D to its preset text? Your changes to it in this profile are discarded.",modified:"modified (this profile)",missingFields:"status fields missing",received:"received"};function pl(e){let t=(u,p)=>{console[u](`${pc} ${p}`);try{u==="error"&&e.logger.error(`${pc} ${p}`)}catch{}};t("log","client half mounting: settings.section page + avantfIdentity Remote namespace"),e.effect(()=>e.locale.register(Cr,{zh:ul,en:ll}),"avantf-identity: dictionaries");let r={},n=(()=>{let u=()=>{};return{promise:new Promise(f=>{u=f}),settle:u}})();e.remote.$mount(oc).then(()=>{r.remote=lc(e.get("remote.avantfIdentity")),t(r.remote===void 0?"error":"log",r.remote===void 0?'contribution mounted but ctx.get("remote.avantfIdentity") is undefined; the page will report it':"Remote namespace mounted: the identity page can read and write the files"),n.settle()}).catch(u=>{t("error",`mounting the Remote contribution failed: ${String(u)}`),n.settle()});let o=e.locale.bind(Cr),i=()=>{try{let u=e.locale.getSnapshot().active;return typeof u=="string"&&u!==""?u:"en"}catch{return"en"}},s={name:"settings.section",id:"identity",order:25,locale:Cr,label:()=>o("nav")},c={t:o,getRemote:()=>r.remote,whenMounted:()=>n.promise,getConfigForm:()=>uc(e.get("configForms"),al),locale:i},a=u=>(0,fc.createElement)(ac,{close:u.close,...c});e.slots.inject("settings.section",()=>e.slots.register(s,a)),t("log","registered the settings.section page: id=identity order=25")}
|
|
60
|
+
|
|
61
|
+
return module.exports; } });
|