@avantf/dsh-identity 0.1.0 → 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/README.md CHANGED
@@ -2,117 +2,93 @@
2
2
 
3
3
  用你自己的三个文件替换 DSH(DeepSeek Harness)系统提示词里的**身份部分**。
4
4
 
5
- 装好之后,设置面板会多出一个**「身份」页**:一个总开关、三个可编辑的文件、以及一个多语言的预设库。
6
- 打开开关,会话第一轮的系统提示词就以你的身份文件开头;关掉开关,提示词与没装这个插件时**逐字相同**。
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
7
28
 
8
- ## 它改什么、不改什么
29
+ ```bash
30
+ # 把插件装进你要用的 profile(依赖会自动装好,不用管别的)
31
+ dsh plugin --profile <PROFILE> add @avantf/dsh-identity@<version>
9
32
 
10
- 只替换两段:
33
+ # 然后重启 dsh 生效
34
+ ```
11
35
 
12
- - `harness:identity` —— `You are an AI agent powered by DeepSeek Harness.`
13
- - `deployment:persona-prefix` —— `You are a coding agent powered by the <model> model.`
36
+ 版本号可以不写,但建议指定一个明确版本。
14
37
 
15
- 其它一切原样放行:工具指引、Agent Teams、plan mode、goal、subagent、jobs、web、workflow、MCP……
16
- 所有其它插件注册的 section **一条不少、一字不改**;`tools` 与上下文快照也不受影响。
17
- `deployment:persona-suffix`(工作目录)保留——它是信息,不是身份。
38
+ **DSH Desktop**:在「插件」页里安装同一个包即可,装完重启应用;不用动命令行。
18
39
 
19
- **子代理完全不受影响**:默认只在主会话替换。被派出去的子代理(以及 Agent Teams 成员)看到的提示词与
20
- 未安装本插件时完全相同,包括 `dsh-subagent` 给它自己的 persona。
40
+ ## 怎么用
21
41
 
22
- ## 三个文件
42
+ 打开**设置 →「身份」**,先打开「启用身份」,然后在三个框里写你的身份,点保存——**新会话生效**。
23
43
 
24
- | 文件 | 写什么 |
25
- |---|---|
26
- | `IDENTITY.md` | 你是谁、叫什么、扮演什么角色 |
27
- | `SOUL.md` | 语气、价值观、行事风格、判断取舍的原则(设置页里显示为「性格」) |
28
- | `RULES.md` | 硬约束:必须做与禁止做 |
44
+ 想换个身份,就在「身份」下拉里选一个(按你当前的语言取那一套,缺该语言时退回英文)。你写过的内容不会
45
+ 因为切走而丢:下次切回该身份,恢复的是你那份;要拿回预设自带的文本,用「恢复预设原文」。手写内容还没有
46
+ 对应的身份 id 时,切走会被**拒绝**(提示先「存为新预设」),插件宁可拒绝也不静默覆盖你写的东西。
29
47
 
30
- 渲染规则:按 `IDENTITY` → `SOUL` → `RULES` 的顺序拼接**非空**正文,段间一个空行;
31
- **文件全文就是提示词**——不加 frontmatter;只有 `RULES.md` 那一段会被加上一行标题
32
- (该段正文是中文时 `**规则**`,否则 `**Rules**`),好让硬约束在一段长提示词里一眼可辨。
33
- 三个文件都不存在或都为空 ⇒ 自动回到原生提示词。
48
+ 要改某套预置的原文,直接编辑数据目录下 `presets/<id>/<locale>/*.md`;「存为新预设」则把当前生效身份
49
+ 另存成一个新的预设 id。
34
50
 
35
- 文件按 **profile** 隔离,住在你的数据目录里(默认 `~/.avantf`,可用 `AVANTF_HOME` 改):
51
+ 几个边界:
36
52
 
37
- ```
38
- <data home>/identity/
39
- profiles/<profile>/{IDENTITY,SOUL,RULES}.md # 生效身份
40
- presets/<preset>/<locale>/{…}.md # 预设库
41
- ```
53
+ - 三个文件都清空、或关掉开关 ⇒ 新会话回到原生提示词。
54
+ - **改动在新会话生效**:当前会话进行中改文件、应用预设、动开关都不影响它。
55
+ - **默认只在主会话替换**:子代理与 Agent Teams 成员的提示词与没装时逐字相同。
56
+ - `{{...}}` 默认按**字面量**保留;打开「插值」后按上游的严格插值语义处理——文件里引用了没注册的变量会让
57
+ **那一次装配失败**(默认关闭)。唯一的例外是 dsh `0.1.5` 线:那一代的 system-prompt 不认识这个开关,
58
+ **永远按严格插值处理**,所以在那上面别在文件里写完整的 `{{name}}`。
59
+ - 渲染后的身份默认上限 64 KiB,超出会截断并在末尾追加一行可见提示。
60
+
61
+ ## 配置与数据
42
62
 
43
- ## 安装
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
+ ## 升级 / 卸载
44
76
 
45
77
  ```bash
46
- dsh plugin add @avantf/dsh-identity
78
+ # 升级:换版本号重装同一个包
79
+ dsh plugin --profile <PROFILE> add @avantf/dsh-identity@<version>
80
+
81
+ # 卸载
82
+ dsh plugin --profile <PROFILE> remove @avantf/dsh-identity
47
83
  ```
48
84
 
49
- 随包声明了组合包(`dsh.bundle.patch`),`dsh plugin add` 会把它选进 profile 的 `dsh.profile.bundles`,
50
- 由 patch 插入挂载行。也可以手动装成普通依赖,再把下面这行加进 profile 的 `cordis.patch.yml`
51
- (组合包与手写行**二选一**):
85
+ 两者都要重启 dsh 生效。卸载**不动数据目录**:你写的身份文件与预设库全部保留。DSH Desktop 在「插件」
86
+ 页上卸载。
52
87
 
53
- ```yaml
54
- - insert:
55
- - id: avantf-identity
56
- name: '@avantf/dsh-identity'
57
- ```
88
+ ## 环境要求
58
89
 
59
- 安装请**钉版本号**:pnpm ≥ 10 的 `minimumReleaseAge` 会避开刚发布的版本,解析到的旧版本可能不认当前宿主。
60
-
61
- 装好后**重启 `dsh web`**(宿主半边只在启动时加载),刷新页面即可在设置里看到「身份」页。
62
-
63
- ## 用起来
64
-
65
- 1. 打开设置 →「身份」,先打开「启用身份」。**第一次打开开关时,如果这个 profile 还没有任何身份文件,
66
- 插件会用内置的 `assistant` 预设落地一份身份**(三个文件写进生效目录,并把 `assistant` 记为当前预设)——
67
- 所以打开开关后看到的是可编辑的内容,而不是三个空框。已经有内容时这一步什么都不做,**永不覆盖**。
68
- 2. 三个框里写你的身份;点保存 → **新会话生效**:当前正在进行的会话提示词**保持不变**(会话中途换人既突然,
69
- 又会让该会话的 prompt 缓存全部作废),开一个新会话就用新内容。
70
- 3. 想换一个身份:在「身份」下拉里选一个——按你当前的语言取该预设的那一套,缺该语言时退回英文(有二次确认)。
71
- **切走不会丢掉你写的内容**:离开某个身份时,它当前的内容会存成「你在本 profile 的该身份版本」;下次切回
72
- 这个身份,恢复的是**你那份**,而不是预设自带的那份。下拉右侧的「删除」删掉选中的预设(你在本 profile 保存的
73
- 该身份版本也一起删除);预设全删光时下拉自然为空。
74
- 4. 想回到预设自带的内容:当选中的身份显示「已修改(本 profile)」时,旁边有「恢复预设原文」——它丢掉你那份,
75
- 把预设自带的内容放回生效位置(有二次确认)。
76
- 5. 「存为新预设」把当前生效身份存成一个新的预设 id(小写字母、数字与连字符)。预设库本身**不会被你的编辑改写**:
77
- 要改某套预置的原文,直接编辑数据根下 `presets/<id>/<locale>/*.md`。
78
- 6. 身份文件都清空、或关掉开关 → 同样在**新会话**里回到原生提示词。
79
-
80
- ## 几个要知道的语义
81
-
82
- - **一个会话用哪个身份,取决于这个会话开始时磁盘上是什么**。会话进行中改文件、应用预设、动开关,都不影响
83
- 这个会话;下一个会话才读到新内容。这样身份不会在读者眼皮底下换人,也不会中途作废该会话的 prompt 缓存。
84
- - **切换身份是可逆的**:你改过的身份,就是你在这个 profile 里该身份的内容。离开它时内容被存下来,切回来恢复的是
85
- 你那份;要拿回预设自带的文本,用「恢复预设原文」。这份版本**按 profile 存**(`<data home>/identity/profiles/<profile>/.edits/<id>/`),
86
- 不会污染预设库,也不会影响别的 profile。
87
- - **手写内容没有对应的身份 id 时,切走会被拒绝**(提示先「存为新预设」):此时切换无处可回退,插件宁可拒绝也
88
- 不静默覆盖你写的东西。
89
- - **`{{...}}` 默认按字面量保留**。打开「插值」后按上游的严格插值语义处理:文件里引用了没注册的变量会让
90
- **那一次装配失败**(因此默认关闭)。唯一的例外是 dsh `0.1.5` 线:那一代的 system-prompt 还不认识这个
91
- 开关,**永远按严格插值处理**——在它上面 `{{...}}` 无法保持字面量,文件里就不要写完整的 `{{name}}`。
92
- - **预算**:渲染后的身份默认上限 64 KiB。超了会整体截断并在末尾追加一行可见提示,同时日志里点出哪个文件超了
93
- (不按文件丢弃,因为 `RULES.md` 往往最要紧)。
94
- - **缓存**:插件按 `(mtimeMs, size)` 缓存文件读取;在 UI 里保存会立即失效,用外部编辑器改动则在下一次装配时
95
- 被感知——但如上一条,**新读到的内容只在下一个会话生效**。
96
- - **KV cache**:会话内提示词不变 ⇒ 前缀缓存不动;改动在新会话生效,那时才重建一次前缀。
97
- - 与 `dsh-persona` 的 `complete: true` **不再冲突**(本插件不用 `complete`);两者同时开启时仍是 persona 的
98
- `complete` 生效。
99
- - 环境故障(数据目录只读、预设资源缺失)只写一条 WARNING,插件照常挂载——**绝不因为环境问题拒绝加载或杀掉宿主**。
100
-
101
- ## 内置预设
102
-
103
- | id | 身份 | 语言 |
104
- |---|---|---|
105
- | `coder` | 程序员 | `zh` / `en` |
106
- | `assistant` | 助理 | `zh` / `en` |
107
- | `analyst` | 分析师 | `zh` / `en` |
108
-
109
- 首次运行时整棵语言目录树被释放到 `<data home>/identity/presets/`;**只补缺失、永不覆盖**,你删掉的预设
110
- 不会被重建。
111
-
112
- 这份**预设库**和**生效身份**是两回事:首次运行只释放预设库,不会替你写生效身份。所以第一次打开「启用身份」
113
- 时,如果你的生效身份还是空的,插件会用 `assistant` 这套预设给你落地一份(见「用起来」第 1 步)——你删掉了
114
- `assistant` 时,则用预设库里剩下的第一个;预设库被删空时会明确报错,而不是凭空编一份身份给你。
90
+ - **Node `>=22.15.0 <23 || >=23.11.0`**、**pnpm**
115
91
 
116
92
  ## 许可
117
93
 
118
- MIT
94
+ MIT。
package/lib/client.js CHANGED
@@ -1,10 +1,10 @@
1
1
  window.__ModuleLoader__.load({ id: "@avantf/dsh-identity", factory: (require) => {
2
2
  var module = { exports: {} }; var exports = module.exports;
3
- "use strict";var wt=Object.defineProperty;var xc=Object.getOwnPropertyDescriptor;var vc=Object.getOwnPropertyNames;var bc=Object.prototype.hasOwnProperty;var Nr=(e,t)=>{for(var r in t)wt(e,r,{get:t[r],enumerable:!0})},zc=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of vc(t))!bc.call(e,o)&&o!==r&&wt(e,o,{get:()=>t[o],enumerable:!(n=xc(t,o))||n.enumerable});return e};var $c=e=>zc(wt({},"__esModule",{value:!0}),e);var ul={};Nr(ul,{apply:()=>al,inject:()=>ol,name:()=>nl});module.exports=$c(ul);var pc=require("react");var b={};Nr(b,{BIGINT_FORMAT_RANGES:()=>He,CONSTANT_CATCH:()=>Wr,Class:()=>Pt,NUMBER_FORMAT_RANGES:()=>Ae,aborted:()=>V,allowsEval:()=>Ct,assert:()=>Oc,assertEqual:()=>wc,assertIs:()=>Pc,assertNever:()=>Zc,assertNotEqual:()=>kc,assignProp:()=>J,attachSchema:()=>Qe,base64ToUint8Array:()=>Kr,base64urlToUint8Array:()=>Gc,cached:()=>Ee,captureStackTrace:()=>Xe,cleanEnum:()=>Wc,cleanRegex:()=>Ce,clone:()=>K,cloneDef:()=>Cc,codePointLength:()=>Ne,constantCatch:()=>Gr,createTransparentProxy:()=>jc,defineLazy:()=>jr,defineLazyInternal:()=>k,derived:()=>qc,esc:()=>It,escapeRegex:()=>pe,explicitlyAborted:()=>Rt,extend:()=>Uc,finalizeIssue:()=>Q,floatSafeRemainder:()=>Ot,getElementAtPath:()=>Tc,getEnumValues:()=>xe,getLengthableOrigin:()=>De,getParsedType:()=>Dc,getSizableOrigin:()=>Jr,hexToUint8Array:()=>Yc,hide:()=>et,installLazyProp:()=>ra,isObject:()=>_e,isPlainObject:()=>le,issue:()=>be,joinValues:()=>Ge,jsonStringifyReplacer:()=>ve,members:()=>Dt,merge:()=>Bc,mergeDefs:()=>q,normalizeParams:()=>_,nullish:()=>Zt,numKeys:()=>Nc,objectClone:()=>Ic,omit:()=>Fc,optionalKeys:()=>At,own:()=>ce,parsedType:()=>Nt,partial:()=>Jc,pick:()=>Lc,prefixIssues:()=>Re,primitiveTypes:()=>Mr,promiseAllObject:()=>Ac,propertyKeyTypes:()=>Tt,randomString:()=>Rc,rawShape:()=>Te,required:()=>Kc,safeExtend:()=>Mc,shallowClone:()=>Ur,slugify:()=>Et,stringifyPrimitive:()=>Ye,toZod:()=>Sc,uint8ArrayToBase64:()=>Vr,uint8ArrayToBase64url:()=>Xc,uint8ArrayToHex:()=>Hc,unwrapMessage:()=>ye});function wc(e){return e}function kc(e){return e}function Sc(){return e=>e}function Pc(e){}function Zc(e){throw new Error("Unexpected value in exhaustive check")}function Oc(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 Ge(e,t="|"){return e.map(r=>Ye(r)).join(t)}function ve(e,t){return typeof t=="bigint"?t.toString():t}var St=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 St(e)}function Zt(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 Ot(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 Dr=Symbol("evaluating");function jr(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Dr)return n===void 0&&(n=Dr,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ic(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 Lr(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return J(this,t,n),n},enumerable:!0,configurable:!0})}function Fr(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?Lr(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):Fr(e,i,n?n(s.value,i):s.value))}}function Ec(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Lr(e,r,()=>t[r]):Fr(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 Cc(e){return q(e._zod.def)}function Tc(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Ac(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 Rc(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function It(e){return JSON.stringify(e)}function Et(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Xe="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function _e(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ct=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(_e(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(_e(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ur(e){return le(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Nc(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Dc=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}`)}},Tt=new Set(["string","number","symbol"]),Mr=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 _(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 jc(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 Ye(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function At(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]},He={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Lc(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 Fc(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 Uc(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:Br(e,t)}))}function Br(e,t){let r={};return ue(r,e,Reflect.ownKeys(H(e))),Ec(r,t),r}function Mc(e,t){if(!le(t))throw new Error("Invalid input to safeExtend: expected a plain object");return K(e,q(e._zod.def,{shape:Br(e,t)}))}function Bc(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 Jc(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 Kc(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 Rt(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 ye(e){return typeof e=="string"?e:e?.message}function Qe(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:ye(e.inst?._zod.def?.error?.(e))??ye(i?.(e))??ye(t?.error?.(e))??ye(r.customError?.(e))??ye(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 Jr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Vc=/[\uD800-\uDBFF]/;function Ne(e){let t=e.length;if(!Vc.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 De(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Nt(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 Wc(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Kr(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 Vr(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Gc(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Kr(t+r)}function Xc(e){return Vr(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Yc(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 Hc(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Pt=class{constructor(...t){}};function Dt(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Qc(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 et(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 Qc(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 ea(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var kt,se=!1,ta={configurable:!0,get(){se=!0}};function k(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&kt!==e._zod){kt=void 0;return}kt=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,ta);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 ra(e,t,r,n){let o=ea(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 Wr="~constantCatch";function Gr(e){let t=()=>e;return t[Wr]=!0,t}var Xr;var jt={value:void 0,enumerable:!1},Yr="captureStackTrace"in Error?Error:null;function na(e){let t=Yr;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Yr=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{jt.value=new i(m);try{Object.defineProperty(d,"_zod",jt)}finally{jt.value=void 0}}if(d._zod.traits.add(e),t(d,m),c){let x=Object.getPrototypeOf(d),y=d._zod.constr.prototype,P=x;for(;P&&P!==y;)P=Object.getPrototypeOf(P);let F=P??x;c.has(F)||(c.add(F),Dt(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?na(p):this;a(m,d);let h=m._zod.deferred;if(h){for(let y of h)y();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"}};(Xr=globalThis).__zod_globalConfig??(Xr.__zod_globalConfig={});var U=globalThis.__zod_globalConfig;function G(e){return e&&Object.assign(U,e),U}function oa(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ve,2)),e.message}function ia(e){this._zod.message=e}var sa={get:oa,set:ia,enumerable:!0,configurable:!0},Ft={value:void 0,enumerable:!1},Hr=new WeakSet([Object.prototype,Error.prototype]),qr=(e,t)=>{e.name="$ZodError",Ft.value=t,Object.defineProperty(e,"issues",Ft),Ft.value=void 0,Object.defineProperty(e,"message",sa);let r=Object.getPrototypeOf(e);Hr.has(r)||(Hr.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})}}))},Qr=l("$ZodError",qr),ml=l("$ZodError",qr,void 0,{Parent:Error});function ca(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 en(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?ca(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function tn(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 tt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var rt=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 Xe(a,i?.callee??t),a}return c.value};return t};var nt=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 Xe(a,i?.callee??t),a}return c.value};return t};var ot=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?rn(e,i.issues,o):{success:!0,data:i.value}};function rn(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 it=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?rn(e,i.issues,o):{success:!0,data:i.value}};var aa=Symbol.for("zod.compile.invalid"),ua=Symbol.for("zod.compile.fallback"),Ut=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==aa)return!0;if(n.definite===!0&&r===void 0)return!1}return la(e,t,r)};function la(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[ua]=!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 Mt=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},nn=e=>{let t=rt(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,tt(r,s))};return r};var on=e=>{let t=rt(e),r=(n,o,i,s)=>t(n,o,i,tt(r,s));return r};var sn=e=>{let t=nt(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,tt(r,s))};return r};var cn=e=>{let t=nt(e),r=async(n,o,i,s)=>await t(n,o,i,tt(r,s));return r};var an=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ot(e)(t,r,o)};var un=e=>(t,r,n)=>ot(e)(t,r,n);var ln=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return it(e)(t,r,o)};var pn=e=>async(t,r,n)=>it(e)(t,r,n);var fn=/^[cC][0-9a-z]{6,}$/,dn=/^[0-9a-z]+$/,mn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,hn=/^[0-9a-vA-V]{20}$/,gn=/^[A-Za-z0-9]{27}$/,yn=/^[a-zA-Z0-9_-]{21}$/;function _n(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var xn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var vn=/^([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})$/,Jt=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 bn=/^(?:[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 pa="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function zn(){return new RegExp(pa,"u")}var $n=/^(?:(?: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])$/,wn=/^(([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 kn=/^((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])$/,Sn=/^(([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])$/,Pn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var On=/^https?$/,In=/^\+[1-9]\d{6,14}$/;var En="(?:(?:\\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 fa(e){return new RegExp(`^${e}$`)}var Cn=fa(En);function Bt(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 Tn(e){return new RegExp(`^${Bt(e)}$`)}function An(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Bt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Bt({precision:e.precision})}`:r;return new RegExp(`^${En}T(?:${n})$`)}var Rn=/^[\s\S]{0,}$/;var Kt=/^-?\d+(?:\.\d+)?$/,Nn=/^(?:true|false)$/i;var Dn=/^[^A-Z]*$/,jn=/^[^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 Vt=e=>{let t=e.value;return!Zt(t)&&t.length!==void 0},st={number:"number",bigint:"bigint",object:"date"},Wt=l("$ZodCheckLessThan",(e,t)=>{R.init(e,t);let r=st[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:st[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})}}),Gt=l("$ZodCheckGreaterThan",(e,t)=>{R.init(e,t);let r=st[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:st[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})}}),Ln=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):Ot(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})}}),Fn=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 Un=l("$ZodCheckMaxLength",(e,t)=>{var r;R.init(e,t),(r=e._zod.def).when??(r.when=Vt),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Ne(o):i)<=t.maximum)return;let c=De(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Mn=l("$ZodCheckMinLength",(e,t)=>{var r;R.init(e,t),(r=e._zod.def).when??(r.when=Vt),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Ne(o):i)>=t.minimum)return;let c=De(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Bn=l("$ZodCheckLengthEquals",(e,t)=>{var r;R.init(e,t),(r=e._zod.def).when??(r.when=Vt),e._zod.check=n=>{let o=n.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?Ne(o):i;if(s===t.length)return;let c=De(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})}}),Le=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=()=>{})}),Jn=l("$ZodCheckRegex",(e,t)=>{Le.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})}}),Kn=l("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Dn),Le.init(e,t)}),Vn=l("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=jn),Le.init(e,t)}),Wn=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})}}),Gn=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})}}),Xn=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 Yn=l("$ZodCheckOverwrite",(e,t)=>{R.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var ct=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(`
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
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
5
  ${r.join(`
6
6
  `)}
7
- };`)(...Object.values(this.closed))}};var qn={major:4,minor:6,patch:5};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(Rt(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&&(Qe(c.issues,m,e),p||(p=V(c,m)))});else{if(c.issues.length===m)continue;Qe(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 et(this,"~standard",Yt(this))},set"~standard"(e){ce(this,"~standard",e)}}),uo=(e,t)=>e.issues.length?{issues:e.issues.map(r=>Q(r,t,G()))}:{value:e.value};async function ma(e,t){let r={async:!0};return uo(await e._zod.run({value:t,issues:[]},r),r)}function Yt(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return uo(n,r)}catch{}return ma(e,t)},vendor:"zod",version:1}}var pt=l("$ZodString",(e,t)=>{I.init(e,t),e._zod.pattern=t.pattern??Rn,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)=>{Le.init(e,t),pt.init(e,t)}),lo=l("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=vn),Z.init(e,t)}),po=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=Jt(n))}else t.pattern??(t.pattern=Jt());Z.init(e,t)}),fo=l("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=bn),Z.init(e,t)}),mo=1,ut=2;function ho(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ha(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?ho(e)||ut:ga(e,t)}function ga(e,t){if(!t.normalize&&t.protocol?.source===On.source&&!/^https?:\/\//i.test(e))return mo;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??ut}return new URL(e)}catch{return ut}}var ya=/[\t\n\r]/g;function Qn(e){return e.replace(ya,"")}function _a(e,t){return t.lastIndex=0,t.test(e.hostname)}function xa(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var go=l("$ZodURL",(e,t)=>{Z.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=ha(n,t);if(o===mo){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===ut){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Qn(n);return}t.hostname&&!_a(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&&!xa(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:Qn(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=zn()),Z.init(e,t)}),_o=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:_n(t.length)),Z.init(e,t)}),xo=l("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=fn),Z.init(e,t)}),vo=l("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=dn),Z.init(e,t)}),bo=l("$ZodULID",(e,t)=>{t.pattern??(t.pattern=mn),Z.init(e,t)}),zo=l("$ZodXID",(e,t)=>{t.pattern??(t.pattern=hn),Z.init(e,t)}),$o=l("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=gn),Z.init(e,t)}),wo=l("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=An(t)),Z.init(e,t)}),ko=l("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Cn),Z.init(e,t)}),So=l("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Tn(t)),Z.init(e,t)}),Po=l("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=xn),Z.init(e,t)}),Zo=l("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$n),Z.init(e,t)}),va=/^[0-9a-fA-F:.]+$/;function Oo(e){return va.test(e)?ho(`http://[${e}]`):!1}var Io=l("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=wn),Z.init(e,t),e._zod.check=r=>{Oo(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Eo=l("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=kn),Z.init(e,t)});function ba(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:Oo(r)}var Co=l("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Sn),Z.init(e,t),e._zod.check=r=>{ba(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function To(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ht=/^[0-9a-zA-Z+/]*={0,2}$/,Ao=l("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ht),Z.init(e,t),e._zod.check=r=>{To(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),ft=/^[A-Za-z0-9_-]*$/;function za(e){if(!ft.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return To(r)}var Ro=l("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ft),Z.init(e,t),e._zod.check=r=>{za(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),No=l("$ZodE164",(e,t)=>{t.pattern??(t.pattern=In),Z.init(e,t)});function $a(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 Do=l("$ZodJWT",(e,t)=>{Z.init(e,t),e._zod.check=r=>{$a(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=Kt,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}}),jo=l("$ZodNumberFormat",(e,t)=>{Fn.init(e,t),qt.init(e,t)}),Lo=l("$ZodBoolean",(e,t)=>{I.init(e,t),e._zod.pattern=Nn,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 Fo=l("$ZodAny",(e,t)=>{I.init(e,t),e._zod.parse=r=>r}),Uo=l("$ZodUnknown",(e,t)=>{I.init(e,t),e._zod.parse=r=>r}),Mo=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 eo(e,t,r){e.issues.length&&t.issues.push(...Re(r,e.issues)),t.value[r]=e.value}var Bo=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=>eo(f,n,a)));else if(eo(p,n,a),c&&p.issues.length!==0&&V(p))break}return s.length?Promise.all(s).then(()=>n):n}});function lt(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 wa=[];function Jo(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:wa,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=At(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Ko(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(y=>lt(y,r,h,t,f,d))):lt(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 ka=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(()=>Jo(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=_e,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 y of c.allKeys){if(h&&u.issues.length!==x){if(V(u,x))break;x=u.issues.length}if(y==="__proto__")continue;let P=m[y],F=P._zod.optin,ne=P._zod.optout,oe=P._zod.run({value:f[y],issues:[]},p);oe instanceof Promise?d.push(oe.then(O=>lt(O,u,y,f,F,ne))):lt(oe,u,y,f,F,ne)}return s?Ko(d,f,u,p,o.value,e,h===!0):d.length?Promise.all(d).then(()=>u):u}}),Vo=l("$ZodObjectJIT",(e,t)=>{ka.init(e,t);let r=e._zod.parse,n=Ee(()=>Jo(t)),o=U.memoizer,i=m=>{let h=n.value,x=h.symbolKeys,y=new ct(["payload","ctx"],{shape:m,inst:e,memo:o,syms:x}),P=O=>`shape[${O}]._zod.run({ value: input[${O}], issues: [] }, ctx)`,F=(O,S)=>`
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
8
  let ${O}_ab = false;
9
9
  for (let i = 0; i < ${O}.issues.length; i++) {
10
10
  const iss = ${O}.issues[i];
@@ -15,7 +15,7 @@ ${r.join(`
15
15
  if (${O}_ab && ctx && ctx.abortEarly) {
16
16
  payload.value = newResult;
17
17
  return payload;
18
- }`;y.write("const input = payload.value;");let ne=Object.create(null),oe=0;for(let O of h.allKeys)ne[O]=`key_${oe++}`;y.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)}]`:It(O),Y=`${L} in input`,ie=m[O],Pe=ie?._zod?.optin,he=Pe!==void 0,We=ie?._zod?.optout==="optional";if(y.write(`const ${S} = ${P(L)};`),he&&We){let Ze=Pe==="optional"?`${S}_present`:`${S}.value !== undefined || ${S}_present`;y.write(`
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
19
  const ${S}_present = ${Y};
20
20
  if (!${S}.issues.length || ${S}_present) {
21
21
  if (${S}.issues.length) {${F(S,L)}
@@ -26,14 +26,14 @@ ${r.join(`
26
26
  }
27
27
  }
28
28
 
29
- `)}else he?(y.write(`
29
+ `)}else he?(_.write(`
30
30
  if (${S}.issues.length) {${F(S,L)}
31
31
  }
32
- `),Pe==="defaulted"?y.write(`newResult[${L}] = ${S}.value;`):y.write(`
32
+ `),Pe==="defaulted"?_.write(`newResult[${L}] = ${S}.value;`):_.write(`
33
33
  if (${S}.value !== undefined || ${Y}) {
34
34
  newResult[${L}] = ${S}.value;
35
35
  }
36
- `)):y.write(`
36
+ `)):_.write(`
37
37
  const ${S}_present = ${Y};
38
38
  if (${S}.issues.length) {${F(S,L)}
39
39
  }
@@ -54,8 +54,8 @@ ${r.join(`
54
54
  newResult[${L}] = ${S}.value;
55
55
  }
56
56
 
57
- `)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,c=_e,a=!U.jitless,p=a&&Ct.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?Ko([],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 to(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 Wo=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=>to(c,n,e,o)):to(s,n,e,o)}});var Go=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])=>ro(r,a,u)):ro(r,i,s)}});function Xt(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=Xt(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=Xt(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 ro(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=Xt(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 Xo=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=>Tt.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 Yo=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 no(e,t){return e.value=t.issues.length?void 0:t.value,e}var Qt=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=>no(r,i)):no(r,o)}return t.innerType._zod.run(r,n)}}),Ho=l("$ZodExactOptional",(e,t)=>{Qt.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)}),Qo=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=>oo(i,t)):oo(o,t)}});function oo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ei=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))}),ti=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=>io(i,e)):io(o,e)}});function io(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 so(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 ri=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=>so(r,i,t,n)):so(r,o,t,n)}});var ni=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=>at(s,t.in,n)):at(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>at(i,t.out,n)):at(o,t.out,n)}});function at(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 oi=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(co):co(o)}});function co(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ii=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=>ao(i,r,n,e));ao(o,r,n,e)}});function ao(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 tr=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},rr="~memo",si=[];function ci(e){return e!==null&&typeof e=="object"}function er(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var ai=new WeakMap,Fe=0,ht=1,Ue=2;function gt(e,t,r){let n=ai.get(e);if(n!==void 0)return n?Ue:Fe;if(t.has(e))return Ue;t.add(e);let o=Fe,i=p=>{if(o!==Ue&&p?._zod){let f=gt(p,t,r);f>o&&(o=f)}},s=(p,f)=>{let d=Fe;for(let m of Reflect.ownKeys(p)){let h=Object.getOwnPropertyDescriptor(p,m);if(f&&!h.enumerable)continue;let x=h.get?ht:h.value?._zod?gt(h.value,t,r):Fe;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):ht),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?gt(p,t,!1):ht);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),Sa(e,o)}function Sa(e,t){return t!==ht&&ai.set(e,t===Ue),t}function Pa(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var dt,mt=[],Za={alloc(e,t,r){let n=dt;if(!n)return r;dt=void 0;let o={value:r,issues:null};return n.set(t.value,o),mt.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"&&Oa(i,o.value))throw new tr;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=gt(e,new Set,!1);if(P===Fe)return e._zod.parse=s,e._zod.run===c&&(e._zod.run=s),s(a,u);P===Ue||n?r=!0:n=!0}let p=a.value;if(!ci(p))return s(a,u);let f=u[rr];f||(f={buckets:new WeakMap,backEdges:void 0},u[rr]=f);let d;o===u?d=i:(d=Pa(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(...er(m.issues)):(a.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value)),a;dt=d;let h=mt.length,x=s(a,u);dt=void 0;let y=mt.length>h?mt.pop():void 0;return x instanceof Promise?x.then(P=>(y&&(y.issues=P.issues.length?er(P.issues):si),P)):(y&&(y.issues=x.issues.length?er(x.issues):si),x)};e._zod.parse=c,e._zod.run===s&&(e._zod.run=c)})}};function ui(){return Za}function Oa(e,t){let r=e[rr]?.backEdges;return r!==void 0&&ci(t)&&r.has(t)}var Ia=()=>{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=Nt(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 ${Ye(i.values[0])}`:`Invalid option: expected one of ${Ge(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":""}: ${Ge(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 li(){return{localeError:Ia()}}var pi;var nr=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 Ea(){return new nr}(pi=globalThis).__zod_globalRegistry??(pi.__zod_globalRegistry=Ea());var fe=globalThis.__zod_globalRegistry;function fi(e){return e.checks&&(e.checks=[...e.checks]),e}function di(e,t){return new e(fi({type:"string",..._(t)}))}function mi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function hi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function gi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function yi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function _i(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function xi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function vi(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function bi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function zi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function $i(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function wi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function ki(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function Si(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function Pi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function Zi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Oi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Ii(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function Ei(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Ci(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Ti(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Ai(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Ri(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}function Ni(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Di(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function ji(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function Li(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function Fi(e,t){return new e(fi({type:"number",checks:[],..._(t)}))}function Ui(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Mi(e,t){return new e({type:"boolean",..._(t)})}function Bi(e){return new e({type:"any"})}function Ji(e){return new e({type:"unknown"})}function Ki(e,t){return new e({type:"never",..._(t)})}function yt(e,t){return new Wt({check:"less_than",..._(t),value:e,inclusive:!1})}function Me(e,t){return new Wt({check:"less_than",..._(t),value:e,inclusive:!0})}function _t(e,t){return new Gt({check:"greater_than",..._(t),value:e,inclusive:!1})}function Be(e,t){return new Gt({check:"greater_than",..._(t),value:e,inclusive:!0})}function xt(e,t){return new Ln({check:"multiple_of",..._(t),value:e})}function vt(e,t){return new Un({check:"max_length",..._(t),maximum:e})}function $e(e,t){return new Mn({check:"min_length",..._(t),minimum:e})}function bt(e,t){return new Bn({check:"length_equals",..._(t),length:e})}function or(e,t){return new Jn({check:"string_format",format:"regex",..._(t),pattern:e})}function ir(e){return new Kn({check:"string_format",format:"lowercase",..._(e)})}function sr(e){return new Vn({check:"string_format",format:"uppercase",..._(e)})}function cr(e,t){return new Wn({check:"string_format",format:"includes",..._(t),includes:e})}function ar(e,t){return new Gn({check:"string_format",format:"starts_with",..._(t),prefix:e})}function ur(e,t){return new Xn({check:"string_format",format:"ends_with",..._(t),suffix:e})}function ae(e){return new Yn({check:"overwrite",tx:e})}function lr(e){return ae(t=>t.normalize(e))}function pr(){return ae(e=>e.trim())}function fr(){return ae(e=>e.toLowerCase())}function dr(){return ae(e=>e.toUpperCase())}function mr(){return ae(e=>Et(e))}function Vi(e,t,r){return new e({type:"array",element:t,..._(r)})}function Wi(e,t,r){return new e({type:"custom",check:"custom",fn:t,..._(r)})}function Gi(e,t){let r=Ca(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 Ca(e,t){let r=new R({check:"custom",..._(t)});return r._zod.check=e,r}function Je(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 gr(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&&Je(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 Xi(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}/${Xi(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+Xi(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>
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
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 Qi=new Set(["type","properties","required","additionalProperties"]),Yi=["oneOf","anyOf"];function Hi(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function hr(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!Qi.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]??Hi(u);p!=null&&(c.some(f=>JSON.stringify(f)===JSON.stringify(p))||c.push(p))}let a=c.length===1?c[0]:hr(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=Hi(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 Ta(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Qi)if(o in e)return;let r=t.filter(o=>Yi.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=hr(t);else{let o=r[0],i=Yi.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=>hr([...s,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Je(e,n))}function _r(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)):Je(u,h),Je(u,p),c._zod.parent===f)for(let y in u)y==="$ref"||y==="allOf"||y in p||delete u[y];if(h.$ref&&m.def)for(let y in u)y==="$ref"||y==="allOf"||y in m.def&&JSON.stringify(u[y])===JSON.stringify(m.def[y])&&delete u[y]}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)??[])Ta(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)}Je(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:Ke(t,"input",e.processors),output:Ke(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 es=(e,t={})=>r=>{let n=gr({...r,processors:t});return A(e,n),yr(n,e),_r(n,e)},Ke=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},s=gr({...o??{},target:i,io:t,processors:r});return A(e,s),yr(s,e),_r(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)},ts=(e,t)=>{we(e,"minimum",t),ke(e,"maximum",t)},is=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},ss=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},cs=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},as=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},rs=(e,t)=>we(e,"minimum",t.minimum),ns=(e,t)=>ke(e,"maximum",t.maximum),os=e=>(t,r)=>{as(t,r.format);let[n,o]=e[r.format];we(t,"minimum",n),ke(t,"maximum",o)},Aa={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)=>is(e,t.value),number_format:os(Ae),bigint_format:os(He),min_length:rs,max_length:ns,length_equals:(e,t)=>ts(e,t.length),min_size:rs,max_size:ns,size_equals:(e,t)=>ts(e,t.size),string_format:(e,t)=>{as(e,t.format),t.pattern&&ss(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)=>cs(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)Aa[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&&is(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&cs(t,o.mime);for(let i of o.patterns??[])ss(t,i);return t}var Ra={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Na=new Map([[Ht,Pn],[ft,Zn]]),Da=e=>Na.get(e)??e,us=(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=Ra[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(Da);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}))])}},ls=(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,...y]=h;x!==void 0&&(o.multipleOf=x),y.length&&(o.allOf=[...o.allOf??[],...y.map(P=>({multipleOf:P}))])}},ps=(e,t,r,n)=>{r.type="boolean"};var fs=(e,t,r,n)=>{r.not={}},ds=(e,t,r,n)=>{},ms=(e,t,r,n)=>{};var hs=(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 gs=(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 _s=(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 xr(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?xr(t.out):t.type==="catch"?xr(t.innerType):e._zod.optin}var xs=(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"?xr(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)},vs=(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},bs=(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 zs=(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"}]},$s=(e,t,r,n)=>{let o=e._zod.def;A(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},vr=Symbol();function ws(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"),vr):JSON.parse(s)}var ks=(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=ws(o.defaultValue,e,t,r,n);s!==vr&&(r.default=s)},Ss=(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=ws(o.defaultValue,e,t,r,n);s!==vr&&(r._prefault=s)},Ps=(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},Zs=(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},Os=(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 br=(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 Is=new WeakSet([Object.prototype,Error.prototype]);function zt(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 Ka=(e,t)=>{Qr.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Is.has(r)||(Is.add(r),zt(r,"format",n=>o=>tn(n,o)),zt(r,"flatten",n=>o=>en(n,o)),zt(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ve,2)}),zt(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",Ka,void 0,{Parent:Error});var Es=rt(M),Cs=nt(M),Ts=ot(M),As=it(M),Rs=nn(M),Ns=on(M),Ds=sn(M),js=cn(M),Ls=an(M),Fs=un(M),Us=ln(M),Ms=pn(M);function Wa(){U.localeError||G(li())}function wr(){U.memoizer||G({memoizer:ui()})}var C=l("ZodType",(e,t)=>(Wa(),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(Ku(e,t))},superRefine(e,t){return this.check(Vu(e,t))},overwrite(e){return this.check(ae(e))},optional(){return Ks(this)},exactOptional(){return Cu(this)},nullable(){return Vs(this)},nullish(){return Ks(Vs(this))},nonoptional(e){return ju(this,e)},array(){return ee(this)},or(e){return Su([this,e])},and(e){return Zu(this,e)},transform(e){return Ws(this,Eu(e))},default(e){return Ru(this,e)},prefault(e){return Du(this,e)},catch(e){return Fu(this,e)},pipe(e){return Ws(this,e)},readonly(){return Bu(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",{...Yt(this),jsonSchema:{input:Ke(this,"input"),output:Ke(this,"output")}})},set"~standard"(e){b.own(this,"~standard",e)},parse:function e(t,r){return Es(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Cs(this,t,r,{callee:e})},safeParse(e,t){return Ts(this,e,t)},async safeParseAsync(e,t){return As(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){b.own(this,"spa",e)},validate(e,t){return Ut(this,e,t)},validateAsync(e,t){return Mt(this,e,t)},encode:function e(t,r){return Rs(this,t,r,{callee:e})},decode:function e(t,r){return Ns(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Ds(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await js(this,t,r,{callee:e})},safeEncode(e,t){return Ls(this,e,t)},safeDecode(e,t){return Fs(this,e,t)},async safeEncodeAsync(e,t){return Us(this,e,t)},async safeDecodeAsync(e,t){return Ms(this,e,t)},toJSONSchema(e){return es(this,{})(e)},get description(){return fe.get(this)?.description},get _def(){return this._zod.def}}),Gs=l("_ZodString",(e,t)=>{pt.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>us(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(or(...e))},includes(...e){return this.check(cr(...e))},startsWith(...e){return this.check(ar(...e))},endsWith(...e){return this.check(ur(...e))},min(...e){return this.check($e(...e))},max(...e){return this.check(vt(...e))},length(...e){return this.check(bt(...e))},nonempty(...e){return this.check($e(1,...e))},lowercase(e){return this.check(ir(e))},uppercase(e){return this.check(sr(e))},trim(){return this.check(pr())},normalize(...e){return this.check(lr(...e))},toLowerCase(){return this.check(fr())},toUpperCase(){return this.check(dr())},slugify(){return this.check(mr())}})),Ga=l("ZodString",(e,t)=>{pt.init(e,t),Gs.init(e,t)},{email(e){return this.check(mi(Qa,e))},url(e){return this.check(vi(tu,e))},jwt(e){return this.check(Ri(gu,e))},emoji(e){return this.check(bi(ru,e))},guid(e){return this.check(hi(eu,e))},uuid(e){return this.check(gi($t,e))},uuidv4(e){return this.check(yi($t,e))},uuidv6(e){return this.check(_i($t,e))},uuidv7(e){return this.check(xi($t,e))},nanoid(e){return this.check(zi(nu,e))},cuid(e){return this.check($i(ou,e))},cuid2(e){return this.check(wi(iu,e))},ulid(e){return this.check(ki(su,e))},base64(e){return this.check(Ci(du,e))},base64url(e){return this.check(Ti(mu,e))},xid(e){return this.check(Si(cu,e))},ksuid(e){return this.check(Pi(au,e))},ipv4(e){return this.check(Zi(uu,e))},ipv6(e){return this.check(Oi(lu,e))},cidrv4(e){return this.check(Ii(pu,e))},cidrv6(e){return this.check(Ei(fu,e))},e164(e){return this.check(Ai(hu,e))},datetime(e){return this.check(Ni(Xa,e))},date(e){return this.check(Di(Ya,e))},time(e){return this.check(ji(Ha,e))},duration(e){return this.check(Li(qa,e))}});function kr(e){return di(Ga,e)}var E=l("ZodStringFormat",(e,t)=>{Z.init(e,t),Gs.init(e,t)}),Xa=l("ZodISODateTime",(e,t)=>{wo.init(e,t),E.init(e,t)}),Ya=l("ZodISODate",(e,t)=>{ko.init(e,t),E.init(e,t)}),Ha=l("ZodISOTime",(e,t)=>{So.init(e,t),E.init(e,t)}),qa=l("ZodISODuration",(e,t)=>{Po.init(e,t),E.init(e,t)}),Qa=l("ZodEmail",(e,t)=>{fo.init(e,t),E.init(e,t)});var eu=l("ZodGUID",(e,t)=>{lo.init(e,t),E.init(e,t)});var $t=l("ZodUUID",(e,t)=>{po.init(e,t),E.init(e,t)});var tu=l("ZodURL",(e,t)=>{go.init(e,t),E.init(e,t)});var ru=l("ZodEmoji",(e,t)=>{yo.init(e,t),E.init(e,t)});var nu=l("ZodNanoID",(e,t)=>{_o.init(e,t),E.init(e,t)});var ou=l("ZodCUID",(e,t)=>{xo.init(e,t),E.init(e,t)});var iu=l("ZodCUID2",(e,t)=>{vo.init(e,t),E.init(e,t)});var su=l("ZodULID",(e,t)=>{bo.init(e,t),E.init(e,t)});var cu=l("ZodXID",(e,t)=>{zo.init(e,t),E.init(e,t)});var au=l("ZodKSUID",(e,t)=>{$o.init(e,t),E.init(e,t)});var uu=l("ZodIPv4",(e,t)=>{Zo.init(e,t),E.init(e,t)});var lu=l("ZodIPv6",(e,t)=>{Io.init(e,t),E.init(e,t)});var pu=l("ZodCIDRv4",(e,t)=>{Eo.init(e,t),E.init(e,t)});var fu=l("ZodCIDRv6",(e,t)=>{Co.init(e,t),E.init(e,t)});var du=l("ZodBase64",(e,t)=>{Ao.init(e,t),E.init(e,t)});var mu=l("ZodBase64URL",(e,t)=>{Ro.init(e,t),E.init(e,t)});var hu=l("ZodE164",(e,t)=>{No.init(e,t),E.init(e,t)});var gu=l("ZodJWT",(e,t)=>{Do.init(e,t),E.init(e,t)});var Xs=l("ZodNumber",(e,t)=>{qt.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ls(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(_t(e,t))},gte(e,t){return this.check(Be(e,t))},min(e,t){return this.check(Be(e,t))},lt(e,t){return this.check(yt(e,t))},lte(e,t){return this.check(Me(e,t))},max(e,t){return this.check(Me(e,t))},int(e){return this.check(Bs(e))},safe(e){return this.check(Bs(e))},positive(e){return this.check(_t(0,e))},nonnegative(e){return this.check(Be(0,e))},negative(e){return this.check(yt(0,e))},nonpositive(e){return this.check(Me(0,e))},multipleOf(e,t){return this.check(xt(e,t))},step(e,t){return this.check(xt(e,t))},finite(){return this}}));function me(e){return Fi(Xs,e)}var yu=l("ZodNumberFormat",(e,t)=>{jo.init(e,t),Xs.init(e,t)});function Bs(e){return Ui(yu,e)}var _u=l("ZodBoolean",(e,t)=>{Lo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ps(e,r,n,o)});function B(e){return Mi(_u,e)}var xu=l("ZodAny",(e,t)=>{Fo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ds(e,r,n,o)});function Sr(){return Bi(xu)}var vu=l("ZodUnknown",(e,t)=>{Uo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ms(e,r,n,o)});function Js(){return Ji(vu)}var bu=l("ZodNever",(e,t)=>{Mo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fs(e,r,n,o)});function zu(e){return Ki(bu,e)}var $u=l("ZodArray",(e,t)=>{wr(),Bo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_s(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(vt(e,t))},length(e,t){return this.check(bt(e,t))},unwrap(){return this.element}});function ee(e,t){return Vi($u,e,t)}var wu=l("ZodObject",(e,t)=>{wr(),Vo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xs(e,r,n,o),b.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ou(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:Js()}))},loose(){return this.clone(b.mergeDefs(this._zod.def,{catchall:Js()}))},strict(){return this.clone(b.mergeDefs(this._zod.def,{catchall:zu()}))},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(Ys,this,e[0])},exactPartial(...e){return b.partial(Hs,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 wu(r)}var ku=l("ZodUnion",(e,t)=>{Wo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vs(e,r,n,o),e.options=t.options});function Su(e,t){return new ku({type:"union",options:e,...b.normalizeParams(t)})}var Pu=l("ZodIntersection",(e,t)=>{Go.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bs(e,r,n,o)});function Zu(e,t){return new Pu({type:"intersection",left:e,right:t})}var $r=l("ZodEnum",(e,t)=>{Xo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(n,o,i)=>hs(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 $r({...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 $r({...t,checks:[],...b.normalizeParams(o),entries:i})}});function Ou(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new $r({type:"enum",entries:r,...b.normalizeParams(t)})}var Iu=l("ZodTransform",(e,t)=>{wr(),Yo.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 Eu(e){return new Iu({type:"transform",transform:e})}var Ys=l("ZodOptional",(e,t)=>{Qt.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>br(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ks(e){return new Ys({type:"optional",innerType:e})}var Hs=l("ZodExactOptional",(e,t)=>{Ho.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>br(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Cu(e){return new Hs({type:"optional",innerType:e})}var Tu=l("ZodNullable",(e,t)=>{qo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zs(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Vs(e){return new Tu({type:"nullable",innerType:e})}var Au=l("ZodDefault",(e,t)=>{Qo.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ks(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ru(e,t){return new Au({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}var Nu=l("ZodPrefault",(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});function Du(e,t){return new Nu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}var qs=l("ZodNonOptional",(e,t)=>{ti.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 ju(e,t){return new qs({type:"nonoptional",innerType:e,...b.normalizeParams(t)})}var Lu=l("ZodCatch",(e,t)=>{ri.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ps(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Fu(e,t){return new Lu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:b.constantCatch(t)})}var Uu=l("ZodPipe",(e,t)=>{ni.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zs(e,r,n,o),e.in=t.in,e.out=t.out});function Ws(e,t){return new Uu({type:"pipe",in:e,out:t})}var Mu=l("ZodReadonly",(e,t)=>{oi.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Os(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Bu(e){return new Mu({type:"readonly",innerType:e})}var Ju=l("ZodCustom",(e,t)=>{ii.init(e,t),C.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gs(e,r,n,o)});function Ku(e,t={}){return Wi(Ju,e,t)}function Vu(e,t){return Gi(e,t)}var Or="@avantf/dsh-identity",Se="avantfIdentity";function Pr(e,t){return{mode:"strict",typeSymbol:t,schema:e,create:()=>e}}var ec=e=>`${Or}#${Se}/${e}`,Zr=(e,t)=>`${Or}#${Se}/${e}:${t}`;function te(e,t){return{id:ec(e),service:Se,namespace:Se,method:e,invocation:{kind:"direct"},parameters:[{name:"args",wire:"args",source:"json",codec:Pr(t,Zr(e,"args"))}],result:Pr(Sr(),Zr(e,"result"))}}function Qs(e){return{id:ec(e),service:Se,namespace:Se,method:e,invocation:{kind:"direct"},parameters:[],result:Pr(Sr(),Zr(e,"result"))}}var re=kr().optional(),$=kr(),tc=[te("status",N({locale:re})),Qs("listPresets"),Qs("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:$}))],rc=N({name:$,file:$,text:$,present:B(),bytes:me()}),Wu=N({name:$,file:$,path:$,present:B(),bytes:me()}),Gu=N({id:$,locales:ee($),active:B()}),Xu=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(Wu),presets:ee(Gu)}),Yu=N({profile:$,identityDir:$,totalBytes:me(),files:ee(rc)}),Hu=N({found:B(),id:$,requestedLocale:$,resolvedLocale:$,fellBack:B(),files:ee(rc)}),qu=N({ok:B(),error:re,resolvedLocale:re,fellBack:B().optional(),files:ee($).optional()}),Ve=(e,t)=>({name:e,schema:t,create:()=>t}),Nf=[...tc.flatMap(e=>e.parameters.map(t=>Ve(`${e.method}${t.name}`,t.codec.schema))),Ve("statusResult",Xu),Ve("profileResult",Yu),Ve("writeResult",qu),Ve("presetResult",Hu)];var nc={package:Or,descriptors:tc};var D=require("react"),v=require("react/jsx-runtime"),oc=["IDENTITY","SOUL","RULES"],ic={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:ic,identitySelect:{...ic,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)"}},Qu={IDENTITY:"fileIdentity",SOUL:"fileSoul",RULES:"fileRules"},el=["profile","dataHome","fileCount","drop","files","presets"];function cc(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),[y,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),We=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(sc(T.files)),f(sc(T.files)),O(void 0)}catch(w){We(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 Cr=async g=>{P(!0);try{await g(),O(void 0),await Ze()}catch(w){We(w)}finally{P(!1)}},Oe=async g=>{let w=r();w!==void 0&&await Cr(()=>g(w))},fc=async g=>{d!==void 0&&await Cr(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")}}})},dc=async()=>{await Oe(async g=>{for(let w of oc){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"))})},mc=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")})},hc=async g=>{let w=r();if(w!==void 0){if(w.resetToPreset===void 0){O(t("unavailable"));return}await Oe(async T=>{let Rr=await T.resetToPreset({id:g,locale:i()});if(!Rr.ok)throw new Error(Rr.error??"restore failed")})}},gc=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,Tr=s?.presets??[],Ie=Tr.find(g=>g.active)?.id??"",_c=s===void 0?[]:Object.keys(s),Ar=s===void 0?[]:el.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,Ar.length>0?(0,v.jsxs)("div",{style:z.error,children:[t("missingFields"),": ",Ar.join(", ")," \xB7 ",t("received"),": ",_c.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||y,onChange:g=>{fc(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:y||ge,onChange:g=>{g.target.value!==""&&ie({kind:"apply",id:g.target.value})},children:Tr.map(g=>(0,v.jsx)("option",{value:g.id,children:g.id},g.id))}),(0,v.jsx)("button",{type:"button",style:z.button,disabled:y||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:y||ge||Ie==="",onClick:()=>{ie({kind:"restore",id:Ie})},children:t("restore")})]}):null]}),(0,v.jsxs)("div",{style:z.card,children:[oc.map(g=>(0,v.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[(0,v.jsx)("span",{style:z.label,children:t(Qu[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:y||ge,onClick:()=>{dc()},children:t("save")}),(0,v.jsx)("button",{type:"button",style:z.button,disabled:y||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:y,onClick:()=>{let g=Y;ie(void 0),g.kind==="apply"?mc(g.id):g.kind==="restore"?hc(g.id):gc(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:y||S.trim()==="",onClick:()=>{he(!1),yc()},children:t("ok")})]})]})}):null]})}function sc(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 ac(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 tl=["status","listPresets","readProfile","writeProfileFile","ensureProfile","applyPreset","resetToPreset","saveAsPreset","readPreset","writePresetFile","deletePreset"],Ir=class extends Error{};function rl(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 Ir(n)}return Object.hasOwn(t,"value")?t.value:e}function uc(e){if(e===void 0)return;let t=e,r={};for(let n of tl){let o=t[n];typeof o=="function"&&(r[n]=async i=>rl(await o.apply(e,i===void 0?[]:[i])))}return r}var nl="avantf-identity",ol=["remote","slots","locale"],il="avantf-identity",Er="settings.identity",lc="[avantf-identity]",sl={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"},cl={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 al(e){let t=(u,p)=>{console[u](`${lc} ${p}`);try{u==="error"&&e.logger.error(`${lc} ${p}`)}catch{}};t("log","client half mounting: settings.section page + avantfIdentity Remote namespace"),e.effect(()=>e.locale.register(Er,{zh:sl,en:cl}),"avantf-identity: dictionaries");let r={},n=(()=>{let u=()=>{};return{promise:new Promise(f=>{u=f}),settle:u}})();e.remote.$mount(nc).then(()=>{r.remote=uc(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(Er),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:Er,label:()=>o("nav")},c={t:o,getRemote:()=>r.remote,whenMounted:()=>n.promise,getConfigForm:()=>ac(e.get("configForms"),il),locale:i},a=u=>(0,pc.createElement)(cc,{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")}
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
60
 
61
61
  return module.exports; } });
package/lib/index.js CHANGED
@@ -1482,17 +1482,21 @@ async function apply(ctx, config) {
1482
1482
  return sections.length === out.sections.length ? out : { ...out, sections };
1483
1483
  });
1484
1484
  new IdentityGateway(ctx, state, settings, log);
1485
- const typert = ctx.get("typert");
1486
- if (typert === void 0 || typeof typert.register !== "function") {
1487
- log.warn("no typert registry mounted; the settings page will report it instead of reading the identity files");
1488
- } else {
1489
- try {
1490
- typert.register(hostContribution);
1491
- log.info(`typert host face registered (namespace avantfIdentity, ${String(hostContribution.invocations?.length ?? 0)} invocations)`);
1492
- } catch (error) {
1493
- log.error(`typert host face FAILED to register: the settings page will report it; the prompt mechanism mounts anyway — ${reasonOf5(error)}`);
1494
- }
1495
- }
1485
+ ctx.inject(["typert"], (child) => {
1486
+ child.effect(() => {
1487
+ const typert = child.get("typert");
1488
+ if (typert === void 0 || typeof typert.register !== "function")
1489
+ return () => void 0;
1490
+ try {
1491
+ const dispose = typert.register(hostContribution);
1492
+ log.info(`typert host face registered (namespace avantfIdentity, ${String(hostContribution.invocations?.length ?? 0)} invocations)`);
1493
+ return typeof dispose === "function" ? dispose : () => void 0;
1494
+ } catch (error) {
1495
+ log.error(`typert host face FAILED to register: the settings page will report it; the prompt mechanism mounts anyway — ${reasonOf5(error)}`);
1496
+ return () => void 0;
1497
+ }
1498
+ }, "avantf-identity:typert-face");
1499
+ });
1496
1500
  ctx.inject(["settings"], (child) => {
1497
1501
  child.effect(() => {
1498
1502
  const forms = child.get("settings");
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAA0B,KAAK,eAAe,EAAuB,MAAM,gCAAgC,CAAA;AAClH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAaxC,wFAAwF;AACxF,eAAO,MAAM,IAAI,oBAAoB,CAAA;AAErC;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAmB,CAAA;AAEtC,+EAA+E;AAC/E,eAAO,MAAM,WAAW,oBAAoB,CAAA;AAC5C,wHAAwH;AACxH,eAAO,MAAM,wBAAwB,qBAAqB,CAAA;AAC1D,8GAA8G;AAC9G,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAAuD,CAAA;AACjG,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,QAAQ,CAAA;AAEtC,MAAM,WAAW,MAAM;IACrB,uGAAuG;IACvG,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IACvC,iHAAiH;IACjH,WAAW,CAAC,EAAE,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IAC3C,6GAA6G;IAC7G,YAAY,CAAC,EAAE,QAAQ,CAAC,SAAS,GAAG,KAAK,GAAG,SAAS,CAAC,CAAA;IACtD,qEAAqE;IACrE,IAAI,CAAC,EAAE,QAAQ,CAAC,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;IAC9C,mGAAmG;IACnG,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACvC,4HAA4H;IAC5H,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACtC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACvC,0FAA0F;IAC1F,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC3C,wFAAwF;IACxF,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAC5C;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;aAUjB,CAAA;AAQF;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAM7D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAIzE;AAiED,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgHvE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAA0B,KAAK,eAAe,EAAuB,MAAM,gCAAgC,CAAA;AAClH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAaxC,wFAAwF;AACxF,eAAO,MAAM,IAAI,oBAAoB,CAAA;AAErC;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAmB,CAAA;AAEtC,+EAA+E;AAC/E,eAAO,MAAM,WAAW,oBAAoB,CAAA;AAC5C,wHAAwH;AACxH,eAAO,MAAM,wBAAwB,qBAAqB,CAAA;AAC1D,8GAA8G;AAC9G,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAAuD,CAAA;AACjG,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,QAAQ,CAAA;AAEtC,MAAM,WAAW,MAAM;IACrB,uGAAuG;IACvG,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IACvC,iHAAiH;IACjH,WAAW,CAAC,EAAE,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IAC3C,6GAA6G;IAC7G,YAAY,CAAC,EAAE,QAAQ,CAAC,SAAS,GAAG,KAAK,GAAG,SAAS,CAAC,CAAA;IACtD,qEAAqE;IACrE,IAAI,CAAC,EAAE,QAAQ,CAAC,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;IAC9C,mGAAmG;IACnG,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACvC,4HAA4H;IAC5H,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACtC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACvC,0FAA0F;IAC1F,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC3C,wFAAwF;IACxF,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAC5C;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;aAUjB,CAAA;AAQF;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAM7D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS,CAIzE;AAiED,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyHvE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avantf/dsh-identity",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "DSH native Cordis plugin: the harness identity section of the system prompt is replaced by three editable profile files (IDENTITY / SOUL / RULES), with multi-lingual built-in presets and a settings page",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -73,7 +73,7 @@
73
73
  "react-dom": "18.3.1",
74
74
  "typescript": "^5.5.0",
75
75
  "vitest": "^2.1.0",
76
- "zod": "4.6.5"
76
+ "zod": "4.6.7"
77
77
  },
78
78
  "license": "MIT",
79
79
  "publishConfig": {