@halcyonlabs/app 0.47.0-halcyon.680 → 0.47.0-halcyon.682
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/dist/index.d.ts +7 -7
- package/package.json +2 -2
- package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/fixed-runner/linux-x64/manifest.json +4 -4
- package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/revision +1 -1
- package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/source.json +1 -1
- package/server/dist/builtin-plugins/orbit/dist/host.js +2 -2
- package/server/dist/builtin-plugins/orbit/dist/host.meta.json +1 -1
- package/server/dist/builtin-plugins/orbit/dist/server.js +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -5772,9 +5772,9 @@ declare const hostDaemonCommandRegistry: {
|
|
|
5772
5772
|
}, z$1.core.$strict>, z$1.ZodDiscriminatedUnion<[z$1.ZodObject<{
|
|
5773
5773
|
kind: z$1.ZodLiteral<"wording">;
|
|
5774
5774
|
status: z$1.ZodEnum<{
|
|
5775
|
-
unavailable: "unavailable";
|
|
5776
5775
|
pass: "pass";
|
|
5777
5776
|
revise: "revise";
|
|
5777
|
+
unavailable: "unavailable";
|
|
5778
5778
|
}>;
|
|
5779
5779
|
}, z$1.core.$strict>, z$1.ZodObject<{
|
|
5780
5780
|
kind: z$1.ZodLiteral<"review">;
|
|
@@ -6135,8 +6135,8 @@ declare const hostDaemonCommandRegistry: {
|
|
|
6135
6135
|
skillFilePath: z$1.ZodString;
|
|
6136
6136
|
}, z$1.core.$strict>], "kind">>;
|
|
6137
6137
|
instructionMode: z$1.ZodEnum<{
|
|
6138
|
-
replace: "replace";
|
|
6139
6138
|
append: "append";
|
|
6139
|
+
replace: "replace";
|
|
6140
6140
|
}>;
|
|
6141
6141
|
type: z$1.ZodLiteral<"thread.rewind.prepare">;
|
|
6142
6142
|
leaseId: z$1.ZodString;
|
|
@@ -6284,8 +6284,8 @@ declare const hostDaemonCommandRegistry: {
|
|
|
6284
6284
|
skillFilePath: z$1.ZodString;
|
|
6285
6285
|
}, z$1.core.$strict>], "kind">>;
|
|
6286
6286
|
instructionMode: z$1.ZodEnum<{
|
|
6287
|
-
replace: "replace";
|
|
6288
6287
|
append: "append";
|
|
6288
|
+
replace: "replace";
|
|
6289
6289
|
}>;
|
|
6290
6290
|
type: z$1.ZodLiteral<"thread.start">;
|
|
6291
6291
|
requestId: z$1.ZodString;
|
|
@@ -6748,8 +6748,8 @@ declare const hostDaemonCommandRegistry: {
|
|
|
6748
6748
|
envPassthrough: z$1.ZodArray<z$1.ZodString>;
|
|
6749
6749
|
}, z$1.core.$strict>;
|
|
6750
6750
|
instructionMode: z$1.ZodEnum<{
|
|
6751
|
-
replace: "replace";
|
|
6752
6751
|
append: "append";
|
|
6752
|
+
replace: "replace";
|
|
6753
6753
|
}>;
|
|
6754
6754
|
projectId: z$1.ZodString;
|
|
6755
6755
|
providerId: z$1.ZodString;
|
|
@@ -6964,8 +6964,8 @@ declare const hostDaemonCommandRegistry: {
|
|
|
6964
6964
|
envPassthrough: z$1.ZodArray<z$1.ZodString>;
|
|
6965
6965
|
}, z$1.core.$strict>;
|
|
6966
6966
|
instructionMode: z$1.ZodEnum<{
|
|
6967
|
-
replace: "replace";
|
|
6968
6967
|
append: "append";
|
|
6968
|
+
replace: "replace";
|
|
6969
6969
|
}>;
|
|
6970
6970
|
projectId: z$1.ZodString;
|
|
6971
6971
|
providerId: z$1.ZodString;
|
|
@@ -8221,9 +8221,9 @@ declare const hostDaemonCommandRegistry: {
|
|
|
8221
8221
|
executablePath: z$1.ZodNullable<z$1.ZodString>;
|
|
8222
8222
|
installed: z$1.ZodBoolean;
|
|
8223
8223
|
installSource: z$1.ZodEnum<{
|
|
8224
|
+
external: "external";
|
|
8224
8225
|
notInstalled: "notInstalled";
|
|
8225
8226
|
npmGlobal: "npmGlobal";
|
|
8226
|
-
external: "external";
|
|
8227
8227
|
}>;
|
|
8228
8228
|
currentVersion: z$1.ZodNullable<z$1.ZodString>;
|
|
8229
8229
|
latestVersion: z$1.ZodNullable<z$1.ZodString>;
|
|
@@ -8772,9 +8772,9 @@ declare const providerCliStatusResponseSchema: z$1.ZodRecord<z$1.ZodString, z$1.
|
|
|
8772
8772
|
executablePath: z$1.ZodNullable<z$1.ZodString>;
|
|
8773
8773
|
installed: z$1.ZodBoolean;
|
|
8774
8774
|
installSource: z$1.ZodEnum<{
|
|
8775
|
+
external: "external";
|
|
8775
8776
|
notInstalled: "notInstalled";
|
|
8776
8777
|
npmGlobal: "npmGlobal";
|
|
8777
|
-
external: "external";
|
|
8778
8778
|
}>;
|
|
8779
8779
|
currentVersion: z$1.ZodNullable<z$1.ZodString>;
|
|
8780
8780
|
latestVersion: z$1.ZodNullable<z$1.ZodString>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@halcyonlabs/app",
|
|
3
|
-
"version": "0.47.0-halcyon.
|
|
3
|
+
"version": "0.47.0-halcyon.682",
|
|
4
4
|
"description": "Moonlet app launcher for npx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bb",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"node": "^22.19.0 || ^24.0.0 || ^26.0.0"
|
|
109
109
|
},
|
|
110
110
|
"moonletRelease": {
|
|
111
|
-
"summary": "Core change: a station
|
|
111
|
+
"summary": "Core change: a libvirt station's disk is snapshotted for each install, merged back when it succeeds and put back when it fails (#723)"
|
|
112
112
|
},
|
|
113
113
|
"license": "SEE LICENSE IN LICENSE"
|
|
114
114
|
}
|
package/server/dist/builtin-plugins/orbit/dist/assets/moonlet/fixed-runner/linux-x64/manifest.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commit": "
|
|
2
|
+
"commit": "d023979dd27b3b0a5723c09abd2313cd5269842e",
|
|
3
3
|
"file": "orbit-deploy",
|
|
4
4
|
"platform": "linux-x64",
|
|
5
5
|
"provenance": {
|
|
6
|
-
"artifactId":
|
|
7
|
-
"artifactName": "linux-bundle-
|
|
6
|
+
"artifactId": 15621392533,
|
|
7
|
+
"artifactName": "linux-bundle-d023979dd27b3b0a5723c09abd2313cd5269842e",
|
|
8
8
|
"repository": "matt0x6F/personalassistant",
|
|
9
|
-
"runId":
|
|
9
|
+
"runId": 46905720817,
|
|
10
10
|
"workflow": ".github/workflows/moonlet-linux-bundle.yml"
|
|
11
11
|
},
|
|
12
12
|
"schema": 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d023979dd27b3b0a5723c09abd2313cd5269842e
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"repository":"matt0x6F/personalassistant","revision":"
|
|
1
|
+
{"repository":"matt0x6F/personalassistant","revision":"d023979dd27b3b0a5723c09abd2313cd5269842e"}
|
|
@@ -66,7 +66,7 @@ ${u}
|
|
|
66
66
|
}`,m;try{m=new f(...a,p)(...c)}catch(d){throw new D(`this schema (generated code failed to evaluate: ${d.message})`)}return t?.debug&&(m.code=l),m.definite=n.definite,m}function O(e,t){for(let[n,o]of e.constants)if(o===t)return n;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}function _t(e,t){return e.definite=!1,O(e,t)}function P(e){return`v${e.varCounter++}`}function qw(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return ie;let n=r;return n.issues.length===0?n.value:ie}function te(e,t,r,n,o=!0){let i=e.content.length,a=t.constants.size,c=t.constantCounter,u=t.varCounter;try{return B(e,t,r,n,o)}catch(l){if(!(l instanceof D)||!l.islandable)throw l;if(e.content.length=i,t.constants.size>a){let f=Array.from(t.constants.keys()).slice(a);for(let p of f)t.constants.delete(p)}return t.constantCounter=c,t.varCounter=u,Hw(e,t,r,n)}}function Hw(e,t,r,n){t.definite=!1;let o=O(t,r),i=O(t,qw),a=P(t);return e.write(`const ${a} = ${i}(${o}, ${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function Yw(e,t,r,n){let o=r._zod.def.checks;if(!o||o.length===0)return n;let i=n;for(let a of o){let c=a._zod.def;if(c.when&&!Xw.has(c.check))throw new D('check with a custom "when" condition');switch(c.check){case"greater_than":Qw(e,t,c,i);break;case"less_than":ev(e,t,c,i);break;case"multiple_of":tv(e,t,c,i);break;case"number_format":ym(e,c,i);break;case"min_length":{let u=wt(c.minimum,"min_length"),l=Cu(e,t,i,`${i}.length >= ${u} && ${i}.length < ${c.minimum*2}`);e.write(`if (${l} < ${u}) return INVALID;`);break}case"max_length":{let u=wt(c.maximum,"max_length"),l=Cu(e,t,i,`${i}.length > ${u}`);e.write(`if (${l} > ${u}) return INVALID;`);break}case"length_equals":{let u=wt(c.length,"length_equals"),l=Cu(e,t,i,`${i}.length >= ${u} && ${i}.length <= ${c.length*2}`);e.write(`if (${l} !== ${u}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${wt(c.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${wt(c.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${wt(c.size,"size_equals")}) return INVALID;`);break;case"string_format":i=$m(e,t,c,i);break;case"custom":i=av(e,t,a,i);break;case"bigint_format":rv(e,c,i);break;case"mime_type":nv(e,t,c,i);break;case"property":iv(e,t,c,i);break;case"properties":ov(e,t,c,i);break;case"overwrite":{let u=P(t);sv(e,t,a,i,u),i=u;break}default:throw new D(`check type ${c.check}`)}}return i}function Cu(e,t,r,n){let o=O(t,ht),i=P(t);return e.write(`const ${i} = typeof ${r} === "string" && ${n} ? ${o}(${r}) : ${r}.length;`),i}function wt(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new D(`${t} bound of type ${typeof e}`);return`${e}`}function gm(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new D("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new D("comparison check with Invalid Date bound");return O(e,t)}throw new D(`comparison check bound of type ${typeof t}`)}function Qw(e,t,r,n){let o=r.inclusive?"<":"<=";e.write(`if (${n} ${o} ${gm(t,r.value)}) return INVALID;`)}function ev(e,t,r,n){let o=r.inclusive?">":">=";e.write(`if (${n} ${o} ${gm(t,r.value)}) return INVALID;`)}function tv(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new D("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let o=O(t,Rr);e.write(`if (${o}(${n}, ${wt(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function ym(e,t,r){let n=t.format;switch(n){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new D(`number format ${n}`)}}function rv(e,t,r){let n=t.format;if(n)switch(n){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new D(`bigint format ${n}`)}}function nv(e,t,r,n){let o=r.mime;if(o&&o.length>0){let i=O(t,new Set(o));e.write(`if (!${i}.has(${n}.type)) return INVALID;`)}}function ov(e,t,r,n){if(r.when)throw new D('check with a custom "when" condition');e.write(`if (${n} == null) return INVALID;`);let o=r.shape;for(let i of Reflect.ownKeys(o)){let a=typeof i=="symbol"?O(t,i):ne(i),c=P(t);e.write(`const ${c} = ${n}[${a}];`),te(e,t,o[i],c,!1)}}function iv(e,t,r,n){let o=`${n}[${JSON.stringify(r.property)}]`;B(e,t,r.schema,o)}function sv(e,t,r,n,o){let i=r._zod.def.tx;if(!i)throw new D("overwrite check without a transform function");if(xt(i))throw new ze("z.compile: async overwrite transforms are not supported");let a=O(t,i);e.write(`const ${o} = ${a}(${n});`)}function Tu(){throw new de}function Zu(e){this.issues.push(e)}function av(e,t,r,n){let o=r._zod.def;if(o.fn){if(xt(o.fn))throw new ze("z.compile: async .refine() predicates are not supported");let i=_t(t,o.fn),a=O(t,Tu),c=P(t);return e.write(`const ${c} = ${i}(${n});`),e.write(`if (${c} instanceof Promise) ${a}();`),e.write(`if (!${c}) return INVALID;`),n}if(r._zod.check){if(xt(r._zod.check))throw new ze("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,c=_t(t,s(l=>{let f={value:l,issues:[],addIssue:Zu};return i(f)instanceof Promise&&Tu(),f.issues.length===0?f.value:ie},"helperFn")),u=P(t);return e.write(`const ${u} = ${c}(${n});`),e.write(`if (${u} === INVALID) return INVALID;`),u}throw new D("custom check without a predicate or check function")}function $m(e,t,r,n,o=!0){let i=r.format;if(i==="base64"){let l=O(t,en);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="base64url"){let l=O(t,Mo);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="jwt"){let l=O(t,Uo),f=O(t,r.alg??null);return e.write(`if (!${l}(${n}, ${f})) return INVALID;`),n}if(i==="ipv6"){let l=O(t,Qr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="cidrv6"){let l=O(t,Lo);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="credit_card"){let l=O(t,Fo);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="iban"){let l=O(t,Vo);return e.write(`if (!${l}(${n})) return INVALID;`),n}let a=r;if(i==="url"||i==="httpurl"||a.normalize||a.hostname!==void 0||a.protocol!==void 0){let l=O(t,Ro),f=O(t,r),p=P(t),m=P(t);if(e.write(`const ${p} = ${n}.trim();`),e.write(`const ${m} = ${l}(${p}, ${f});`),e.write(`if (typeof ${m} === "number") return INVALID;`),a.hostname!==void 0){let $=O(t,Zo);e.write(`if (!${$}(${m}, ${f}.hostname)) return INVALID;`)}if(a.protocol!==void 0){let $=O(t,Do);e.write(`if (!${$}(${m}, ${f}.protocol)) return INVALID;`)}if(!o)return null;let d=P(t),g=a.normalize?`${m}.href`:`${O(t,Yr)}(${p})`;return e.write(`const ${d} = ${g};`),d}let c=r.fn;if(c){if(xt(c))throw new D(`async string format ${i}`);let l=O(t,c);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(cv.has(i)&&r.pattern){let l=O(t,r.pattern);return e.write(`${l}.lastIndex = 0;`),e.write(`if (!${l}.test(${n})) return INVALID;`),n}let u=r.format;switch(u){case"regex":throw new D("regex format without a pattern");case"lowercase":e.write(`if (${n} !== ${n}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${n} !== ${n}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${n}.includes(${ne(r.includes)})) return INVALID;`);break;case"starts_with":{let l=r.prefix;e.write(`if (${n}.slice(0, ${l.length}) !== ${ne(l)}) return INVALID;`);break}case"ends_with":{let l=r.suffix;e.write(`if (${n}.slice(-${l.length}) !== ${ne(l)}) return INVALID;`);break}default:throw new D(`string format ${u}`)}return n}function B(e,t,r,n,o=!0){let i=r._zod.def,a=i.type;if(i.coerce)throw new D(`coercion (z.coerce.${a}())`);let c=o||!!i.checks?.length,u;switch(a){case"string":u=uv(e,t,r,n,c);break;case"number":u=lv(e,r,n);break;case"boolean":u=fv(e,n);break;case"bigint":u=pv(e,r,n);break;case"symbol":u=dv(e,n);break;case"undefined":u=mv(e,n);break;case"null":u=hv(e,n);break;case"any":case"unknown":u=n;break;case"never":e.write("return INVALID;"),u=n;break;case"void":u=gv(e,n);break;case"nan":u=yv(e,n);break;case"date":u=$v(e,n);break;case"object":u=bv(e,t,r,n,c);break;case"optional":u=wv(e,t,r,n,c);break;case"nullable":u=xv(e,t,r,n,c);break;case"array":u=kv(e,t,r,n,c);break;case"literal":u=Sv(e,t,r,n);break;case"enum":u=Iv(e,t,r,n);break;case"readonly":{let l=dm(e,t,r,n),f=P(t);e.write(`const ${f} = Object.freeze(${l});`),u=f;break}case"success":dm(e,t,r,n),u="true";break;case"default":case"prefault":u=zv(e,t,r,n);break;case"nonoptional":u=Pv(e,t,r,n);break;case"tuple":u=Av(e,t,r,n);break;case"union":u=Ov(e,t,r,n);break;case"intersection":u=Tv(e,t,r,n);break;case"record":u=Nv(e,t,r,n);break;case"map":u=Zv(e,t,r,n);break;case"set":u=Dv(e,t,r,n);break;case"file":u=Lv(e,n);break;case"template_literal":u=jv(e,t,r,n);break;case"lazy":u=Mv(e,t,r,n);break;case"pipe":u=Fv(e,t,r,n);break;case"custom":u=Vv(e,t,r,n);break;case"transform":u=Kv(e,t,r,n);break;case"catch":u=Bv(e,t,r,n);break;default:throw new D(`schema type ${a}`)}return u===null?null:Yw(e,t,r,u)}function uv(e,t,r,n,o=!0){e.write(`if (typeof ${n} !== "string") return INVALID;`);let i=r._zod.def;return i.format===void 0?n:$m(e,t,i,n,o)}function lv(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let n=t._zod.def;return n.check==="number_format"&&n.format&&ym(e,{format:n.format},r),r}function fv(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function pv(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let n=t._zod.def;if(n.format)switch(n.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}function dv(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function mv(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function hv(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function gv(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function yv(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function $v(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function bv(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (typeof ${n} !== "object" || ${n} === null || Array.isArray(${n})) return INVALID;`);let a=i.shape,c=Object.keys(a),u=Object.getOwnPropertySymbols(a),l=u.length?[...c,...u]:c,f=s(x=>typeof x=="symbol"?O(t,x):ne(x),"keyExpr"),p=s(x=>typeof x=="symbol"?`[${f(x)}]`:ne(x),"propKey"),m=a;if(c.includes("__proto__"))throw new D('object shape key "__proto__"');let d=new Map;for(let x of l){let A=m[x],R=f(x),L=P(t);if(e.write(`const ${L} = ${n}[${R}];`),A._zod.optin!==void 0){let Z=P(t);e.write(`let ${Z} = (() => {`),e.indented(J=>{let Tr=te(J,t,A,L);J.write(`return ${Tr};`)}),e.write("})();"),A._zod.optout==="optional"?(e.write(`if (${Z} === INVALID) {`),e.indented(J=>{J.write(`if (${R} in ${n}) return INVALID;`),J.write(`${Z} = undefined;`)}),e.write("}")):e.write(`if (${Z} === INVALID) return INVALID;`),d.set(x,Z)}else{_v(A)&&e.write(`if (!(${R} in ${n})) return INVALID;`);let Z=te(e,t,A,L,o);Z!==null&&d.set(x,Z)}}let g=i.catchall,$="none";if(g){let x=g._zod.def.type;if(x==="never"){let A=c.map(R=>`k !== ${ne(R)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(R=>{R.write(`if (${A}) return INVALID;`)}),e.write("}")}else(x==="unknown"||x==="any")&&!g._zod.def.checks?.length?$="passthrough":$="schema"}let w=P(t),v=l.some(x=>pm(m[x])||Nu(m[x]));if(!o){if($==="schema"){let x=c.length>0?O(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(A=>{A.write('if (k === "__proto__") continue;'),x&&A.write(`if (${x}.has(k)) continue;`);let R=P(t);A.write(`const ${R} = ${n}[k];`),te(A,t,g,R,!1)}),e.write("}")}return null}if(v){e.write(`const ${w} = {};`);for(let x of l){let A=f(x),R=d.get(x);Nu(m[x])?e.write(`if (${A} in ${n}) ${w}[${A}] = ${R};`):pm(m[x])?e.write(`if (${R} !== undefined || ${A} in ${n}) ${w}[${A}] = ${R};`):e.write(`${w}[${A}] = ${R};`)}}else{let x=l.map(A=>`${p(A)}: ${d.get(A)}`).join(", ");e.write(`const ${w} = { ${x} };`)}if($!=="none"){let x=c.length>0?O(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(A=>{if(A.write('if (k === "__proto__") continue;'),x&&A.write(`if (${x}.has(k)) continue;`),$==="passthrough")A.write(`${w}[k] = ${n}[k];`);else{let R=P(t);A.write(`const ${R} = ${n}[k];`);let L=te(A,t,g,R);A.write(`${w}[k] = ${L};`)}}),e.write("}")}return w}function wv(e,t,r,n,o=!0){let i=r._zod.def;if(vv(r))return B(e,t,i.innerType,n,o);if(i.innerType._zod.optin==="defaulted"){let c=P(t),u=P(t);return e.write(`let ${c};`),e.write(`if (${n} === undefined) {`),e.indented(l=>{l.write(`const ${u} = (() => {`),l.indented(f=>{let p=B(f,t,i.innerType,n);f.write(`return ${p};`)}),l.write("})();"),l.write(`if (${u} !== INVALID) ${c} = ${u};`)}),e.write("} else {"),e.indented(l=>{let f=B(l,t,i.innerType,n);l.write(`${c} = ${f};`)}),e.write("}"),c}let a=o?P(t):null;return a&&e.write(`let ${a};`),e.write(`if (${n} !== undefined) {`),e.indented(c=>{let u=B(c,t,i.innerType,n,o);a&&u!==null&&c.write(`${a} = ${u};`)}),e.write("}"),a}function vv(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function _v(e){return e._zod.optin===void 0&&vt(e)}function vt(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?vt(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?vt(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(vt):!0;case"intersection":return!t.left||!t.right?!0:vt(t.left)&&vt(t.right);case"pipe":return t.in?vt(t.in):!0;default:return!0}}function Nu(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function pm(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&tr(e)}function tr(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?tr(t.innerType):!0;case"union":return t.options?t.options.some(tr):!0;case"intersection":return!t.left||!t.right||tr(t.left)||tr(t.right);case"pipe":return t.out?tr(t.out):!0;default:return!0}}function xv(e,t,r,n,o=!0){let i=r._zod.def,a=o?P(t):null;return a&&e.write(`let ${a} = null;`),e.write(`if (${n} !== null) {`),e.indented(c=>{let u=B(c,t,i.innerType,n,o);a&&u!==null&&c.write(`${a} = ${u};`)}),e.write("}"),a}function kv(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${n})) return INVALID;`);let a=o?P(t):null,c=P(t),u=P(t);return a&&e.write(`const ${a} = new Array(${n}.length);`),e.write(`for (let ${c} = 0; ${c} < ${n}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${u} = ${n}[${c}];`);let f=te(l,t,i.element,u,o);a&&f!==null&&l.write(`${a}[${c}] = ${f};`)}),e.write("}"),a}function Sv(e,t,r,n){let i=r._zod.def.values;if(i.length!==1){let c=O(t,new Set(i));return e.write(`if (!${c}.has(${n})) return INVALID;`),n}let a=i[0];if(typeof a=="number"&&Number.isNaN(a)){let c=O(t,new Set(i));return e.write(`if (!${c}.has(${n})) return INVALID;`),n}if(typeof a=="string")e.write(`if (${n} !== ${ne(a)}) return INVALID;`);else if(typeof a=="number"||typeof a=="boolean")e.write(`if (${n} !== ${a}) return INVALID;`);else if(a===null)e.write(`if (${n} !== null) return INVALID;`);else if(a===void 0)e.write(`if (${n} !== undefined) return INVALID;`);else if(typeof a=="bigint")e.write(`if (${n} !== ${a}n) return INVALID;`);else throw new D(`literal type ${typeof a}`);return n}function Iv(e,t,r,n){let o=r._zod.values;if(!o)throw new D("enum schema without enumerated values");let i=O(t,o);return e.write(`if (!${i}.has(${n})) return INVALID;`),n}function dm(e,t,r,n){let o=r._zod.def;return B(e,t,o.innerType,n)}function zv(e,t,r,n){let o=r._zod.def,a=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!a)return B(e,t,o.innerType,n);let u=O(t,a),l=P(t);return e.write(`let ${l} = ${n};`),e.write(`if (${n} === undefined) ${l} = ${u}();`),B(e,t,o.innerType,l)}let c=P(t);if(a){let u=O(t,a),l=O(t,Zr);e.write(`let ${c};`),e.write(`if (${n} === undefined) {`),e.indented(f=>{f.write(`${c} = ${l}(${u}());`)}),e.write("} else {"),e.indented(f=>{let p=B(f,t,o.innerType,n);f.write(`${c} = ${p} === undefined ? ${l}(${u}()) : ${p};`)}),e.write("}")}else e.write(`let ${c};`),e.write(`if (${n} !== undefined) {`),e.indented(u=>{let l=B(u,t,o.innerType,n);u.write(`${c} = ${l};`)}),e.write("}");return c}function Pv(e,t,r,n){let o=r._zod.def,i=B(e,t,o.innerType,n),a=P(t);return e.write(`const ${a} = ${i};`),e.write(`if (${a} === undefined) return INVALID;`),a}function Av(e,t,r,n){let o=r._zod.def,i=o.items,a=o.rest;e.write(`if (!Array.isArray(${n})) return INVALID;`);let c=mm(i,"optin"),u=mm(i,"optout");a?e.write(`if (${n}.length < ${c}) return INVALID;`):e.write(`if (${n}.length < ${c} || ${n}.length > ${i.length}) return INVALID;`);let l=P(t);e.write(`const ${l} = [];`);for(let f=0;f<i.length;f++){let p=i[f];if(f>=u)e.write(`if (${l}.length === ${f}) {`),e.indented(m=>{m.write(`if (${f} < ${n}.length) {`),m.indented(d=>{let g=P(t);d.write(`const ${g} = ${n}[${f}];`);let $=te(d,t,p,g);d.write(`${l}[${f}] = ${$};`)}),m.write("} else {"),m.indented(d=>{if(Nu(p)){d.write(`${l}.length = ${f};`);return}let g=P(t),$=P(t);d.write(`const ${g} = undefined;`),d.write(`const ${$} = (() => {`),d.indented(w=>{let v=te(w,t,p,g);w.write(`return ${v};`)}),d.write("})();"),d.write(`if (${$} === INVALID || ${$} === undefined) ${l}.length = ${f};`),d.write(`else ${l}[${f}] = ${$};`)}),m.write("}")}),e.write("}");else{let m=P(t);e.write(`const ${m} = ${n}[${f}];`);let d=te(e,t,p,m);e.write(`${l}[${f}] = ${d};`)}}if(a){let f=P(t),p=P(t);e.write(`for (let ${f} = ${i.length}; ${f} < ${n}.length; ${f}++) {`),e.indented(m=>{m.write(`const ${p} = ${n}[${f}];`);let d=te(m,t,a,p);m.write(`${l}[${f}] = ${d};`)}),e.write("}")}return l}function mm(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function Ov(e,t,r,n){let o=r._zod.def,i=o.options;if(o.discriminator)return Ev(e,t,o,n);if(o.inclusive===!1)throw new D("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),n;if(i.length===1)return B(e,t,i[0],n);if(i.every(u=>u._zod.def.type==="literal"&&!u._zod.def.checks?.length)){let u=new Set(i.flatMap(f=>f._zod.def.values)),l=O(t,u);return e.write(`if (!${l}.has(${n})) return INVALID;`),n}let c=P(t);e.write(`let ${c};`);for(let u=0;u<i.length;u++){let l=i[u];u===0?e.write(`${c} = (() => {`):e.write(`if (${c} === INVALID) ${c} = (() => {`),e.indented(f=>{let p=B(f,t,l,n);f.write(`return ${p};`)}),e.write("})();")}return e.write(`if (${c} === INVALID) return INVALID;`),c}function Ev(e,t,r,n){if(r.unionFallback)throw new D("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),n;let o=P(t),i=P(t);e.write(`const ${o} = ${n}?.[${ne(r.discriminator)}];`),e.write(`let ${i};`);let a=!0,c=new Set;for(let u of r.options){let l=u._zod.propValues?.[r.discriminator];if(!l||l.size===0)throw new D("discriminated union option without static discriminator values");for(let m of l){if(c.has(m))throw new D(`duplicate discriminator value ${String(m)}`);c.add(m)}let f=Array.from(l,m=>Cv(t,o,m)),p=a?"if":"else if";e.write(`${p} (${f.join(" || ")}) {`),e.indented(m=>{let d=B(m,t,u,n);m.write(`${i} = ${d};`)}),e.write("}"),a=!1}return e.write("else { return INVALID; }"),i}function Cv(e,t,r){if(typeof r=="string")return`${t} === ${ne(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let n=O(e,r);return`${t} === ${n}`}throw new D(`literal discriminator value ${String(r)}`)}function Tv(e,t,r,n){let o=r._zod.def;t.definite=!1;let i=te(e,t,o.left,n),a=te(e,t,o.right,n),c=O(t,Yt),u=P(t);return e.write(`const ${u} = ${c}(${i}, ${a});`),e.write(`if (!${u}.valid) return INVALID;`),`${u}.data`}function Nv(e,t,r,n){let o=r._zod.def,i=O(t,xe);e.write(`if (!${i}(${n})) return INVALID;`);let a=P(t),c=P(t),u=P(t);e.write(`const ${a} = {};`);let l=o,f=l.partial?void 0:o.keyType._zod.values;if(f){let d=[];for(let $ of f){if(!(typeof $=="string"||typeof $=="number"||typeof $=="symbol"))throw new D(`record key value ${String($)}`);let w=typeof $=="number"?$.toString():$;if(w==="__proto__")throw new D('record key "__proto__"');d.push(w);let v=O(t,$),x=B(e,t,o.keyType,v),A=P(t);e.write(`const ${A} = ${n}[${Rv(t,w)}];`);let R=te(e,t,o.valueType,A);e.write(`${a}[${x}] = ${R};`)}let g=O(t,new Set(d));return e.write(`for (const ${c} in ${n}) {`),e.indented($=>{$.write(`if (${g}.has(${c})) continue;`),l.mode==="loose"?$.write(`if (${c} !== "__proto__") ${a}[${c}] = ${n}[${c}];`):$.write("return INVALID;")}),e.write("}"),a}let p=o.keyType._zod.def;if(!(p.type==="string"&&p.format===void 0&&!p.coerce&&(p.checks?.length??0)===0)){let d=o.mode==="loose",g=oi(o.keyType);g.definite===!1&&(t.definite=!1);let $=O(t,g),w=O(t,Me),v=P(t);return hm(e,t,n,c,x=>{x.write(`let ${v} = ${$}(${c});`),x.write(`if (${v} === INVALID && typeof ${c} === "string" && ${w}.test(${c})) ${v} = ${$}(Number(${c}));`),d?x.write(`if (${v} === INVALID) { ${a}[${c}] = ${n}[${c}]; continue; }`):x.write(`if (${v} === INVALID) return INVALID;`),x.write(`if (${v} === "__proto__") continue;`);let A=P(t);x.write(`const ${A} = ${n}[${c}];`);let R=te(x,t,o.valueType,A);x.write(`${a}[${v}] = ${R};`)}),a}return hm(e,t,n,c,d=>{d.write(`const ${u} = ${n}[${c}];`);let g=te(d,t,o.valueType,u);d.write(`${a}[${c}] = ${g};`)},"return INVALID;"),a}function hm(e,t,r,n,o,i){let a=O(t,Object.prototype.propertyIsEnumerable),c=P(t),u=P(t),l=P(t);e.write(`const ${c} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${u} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${l} = 0; ${l} < ${u}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${n} = ${u}[${l}];`),f.write(`if (${n} === "__proto__" || !${a}.call(${r}, ${n})) continue;`),o(f)}),e.write("}"),e.write(`for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${n} = ${c}[${l}];`),f.write(`if (!${a}.call(${r}, ${n})) continue;`),i?f.write(i):o(f)}),e.write("}")}function Rv(e,t){return typeof t=="string"?ne(t):O(e,t)}function Zv(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Map)) return INVALID;`);let i=P(t),a=P(t),c=P(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${a}, ${c}] of ${n}) {`),e.indented(u=>{let l=B(u,t,o.keyType,a),f=B(u,t,o.valueType,c);u.write(`${i}.set(${l}, ${f});`)}),e.write("}"),i}function Dv(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Set)) return INVALID;`);let i=P(t),a=P(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${a} of ${n}) {`),e.indented(c=>{let u=B(c,t,o.valueType,a);c.write(`${i}.add(${u});`)}),e.write("}"),i}function Lv(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function jv(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let o=r._zod.pattern;if(o){let i=O(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${n})) return INVALID;`)}return n}function Mv(e,t,r,n){let o=r._zod.def,i=_t(t,o.getter),a=O(t,{parser:null});e.write(`if (!${a}.parser) {`),e.indented(u=>{u.write(`const inner = ${i}();`),u.write(`${a}.parser = function(input) {`),u.indented(l=>{l.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),l.write("return result.issues.length === 0 ? result.value : INVALID;")}),u.write("};")}),e.write("}");let c=P(t);return e.write(`const ${c} = ${a}.parser(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}function Fv(e,t,r,n){let o=r._zod.def,i=B(e,t,o.in,n);if(o.transform){if(xt(o.transform))throw new ze("z.compile: async transforms in pipes are not supported");let a=o.transform,u=_t(t,s(f=>{let p={value:f,issues:[],addIssue:Zu},m=a(f,p);return m instanceof Promise?ie:p.issues.length===0?m:ie},"helperFn")),l=P(t);return e.write(`const ${l} = ${u}(${i});`),e.write(`if (${l} === INVALID) return INVALID;`),B(e,t,o.out,l)}else return B(e,t,o.out,i)}function xt(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function Vv(e,t,r,n){let o=r._zod.def;if(o.fn){if(xt(o.fn))throw new ze("z.compile: async custom predicates are not supported");let i=_t(t,o.fn),a=O(t,Tu),c=P(t);e.write(`const ${c} = ${i}(${n});`),e.write(`if (${c} instanceof Promise) ${a}();`),e.write(`if (!${c}) return INVALID;`)}else throw new D("custom schema without a predicate function");return n}function Uv(e,t,r){let n=e._zod.run({value:r,issues:[]},{});if(n&&typeof n.then=="function")return ie;let o=n;return o.issues.length===0?o.value:t()}function Bv(e,t,r,n){let o=r._zod.def;if(!o.catchValue[uo])throw new D("catch with a callback (only a constant catch value compiles)",!1);let i=P(t);e.write(`let ${i} = (() => {`),e.indented(l=>{let f=te(l,t,o.innerType,n);l.write(`return ${f};`)}),e.write("})();");let a=O(t,o.innerType),c=_t(t,o.catchValue),u=O(t,Uv);return e.write(`if (${i} === INVALID) {`),e.indented(l=>{l.write(`${i} = ${u}(${a}, ${c}, ${n});`),l.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function Kv(e,t,r,n){let o=r._zod.def;if(o.transform){if(xt(o.transform))throw new ze("z.compile: async transforms are not supported");let i=o.transform,c=_t(t,s(l=>{let f={value:l,issues:[],addIssue:Zu},p=i(l,f);return p instanceof Promise?ie:f.issues.length===0?p:ie},"helperFn")),u=P(t);return e.write(`const ${u} = ${c}(${n});`),e.write(`if (${u} === INVALID) return INVALID;`),u}return n}var ie,fm,ze,D,Xw,cv,bm=I(()=>{He();Ao();zu();yt();Qt();q();ie=Symbol.for("zod.compile.invalid"),fm=Symbol.for("zod.compile.fallback"),ze=class extends Error{static{s(this,"ZodCompileAsyncError")}constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},D=class extends Error{static{s(this,"ZodCompileUnsupportedError")}constructor(t,r=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=r}};s(Gw,"compileValidator");s(Ru,"compile");s(ni,"withParser");s(Ww,"installCompiledUserMethods");s(oi,"compileFn");s(O,"addConstant");s(_t,"addUserConstant");s(P,"newVar");s(qw,"runtimeRun");s(te,"compileChild");s(Hw,"emitRuntimeIsland");Xw=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);s(Yw,"generateChecks");s(Cu,"codePointLengthVar");s(wt,"numericOperand");s(gm,"comparisonOperand");s(Qw,"generateGreaterThanCheck");s(ev,"generateLessThanCheck");s(tv,"generateMultipleOfCheck");s(ym,"generateNumberFormatCheck");s(rv,"generateBigIntFormatCheck");s(nv,"generateMimeTypeCheck");s(ov,"generatePropertiesChecks");s(iv,"generatePropertyCheck");s(sv,"generateOverwriteCheck");s(Tu,"throwAsync");s(Zu,"pushIssue");s(av,"generateCustomRefineCheck");cv=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);s($m,"generateStringFormatCheck");s(B,"generateCheck");s(uv,"generateStringCheck");s(lv,"generateNumberCheck");s(fv,"generateBooleanCheck");s(pv,"generateBigIntCheck");s(dv,"generateSymbolCheck");s(mv,"generateUndefinedCheck");s(hv,"generateNullCheck");s(gv,"generateVoidCheck");s(yv,"generateNaNCheck");s($v,"generateDateCheck");s(bv,"generateObjectCheck");s(wv,"generateOptionalCheck");s(vv,"isExactOptional");s(_v,"requiresPresenceCheck");s(vt,"fastPathAcceptsAbsence");s(Nu,"dropsWhenAbsent");s(pm,"mayOmitUndefined");s(tr,"mayOutputUndefined");s(xv,"generateNullableCheck");s(kv,"generateArrayCheck");s(Sv,"generateLiteralCheck");s(Iv,"generateEnumCheck");s(dm,"generateWrapperCheck");s(zv,"generateDefaultCheck");s(Pv,"generateNonOptionalCheck");s(Av,"generateTupleCheck");s(mm,"getTupleOptStart");s(Ov,"generateUnionCheck");s(Ev,"generateDiscriminatedUnionCheck");s(Cv,"literalEquality");s(Tv,"generateIntersectionCheck");s(Nv,"generateRecordCheck");s(hm,"emitOwnKeys");s(Rv,"literalPropertyKey");s(Zv,"generateMapCheck");s(Dv,"generateSetCheck");s(Lv,"generateFileCheck");s(jv,"generateTemplateLiteralCheck");s(Mv,"generateLazyCheck");s(Fv,"generatePipeCheck");s(xt,"isAsyncFunction");s(Vv,"generateCustomCheck");s(Uv,"runtimeCatch");s(Bv,"generateCatchCheck");s(Kv,"generateTransformCheck")});function ii(e){return e.checks&&(e.checks=[...e.checks]),e}function Du(e,t){return new e(ii({type:"string",...b(t)}))}function Lu(e,t){return new e(ii({type:"string",coerce:!0,...b(t)}))}function si(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...b(t)})}function ai(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...b(t)})}function ci(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...b(t)})}function ui(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(t)})}function li(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(t)})}function fi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(t)})}function dn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...b(t)})}function pi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...b(t)})}function di(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(t)})}function mi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...b(t)})}function hi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(t)})}function gi(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...b(t)})}function yi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...b(t)})}function $i(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(t)})}function bi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(t)})}function wi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(t)})}function ju(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...b(t)})}function vi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(t)})}function _i(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(t)})}function xi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...b(t)})}function ki(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...b(t)})}function Si(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...b(t)})}function Mu(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...b(t)})}function Fu(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...b(t)})}function Ii(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...b(t)})}function mn(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(t)})}function hn(e,t){return new e({type:"string",format:"date",check:"string_format",...b(t)})}function gn(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...b(t)})}function yn(e,t){return new e({type:"string",format:"duration",check:"string_format",...b(t)})}function Uu(e,t){return new e(ii({type:"number",checks:[],...b(t)}))}function Bu(e,t){return new e(ii({type:"number",coerce:!0,checks:[],...b(t)}))}function Ku(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...b(t)})}function Ju(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...b(t)})}function Gu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...b(t)})}function Wu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...b(t)})}function qu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...b(t)})}function Hu(e,t){return new e({type:"boolean",...b(t)})}function Xu(e,t){return new e({type:"boolean",coerce:!0,...b(t)})}function Yu(e,t){return new e({type:"bigint",...b(t)})}function Qu(e,t){return new e({type:"bigint",coerce:!0,...b(t)})}function el(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...b(t)})}function tl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...b(t)})}function rl(e,t){return new e({type:"symbol",...b(t)})}function nl(e,t){return new e({type:"undefined",...b(t)})}function ol(e,t){return new e({type:"null",...b(t)})}function il(e){return new e({type:"any"})}function sl(e){return new e({type:"unknown"})}function al(e,t){return new e({type:"never",...b(t)})}function cl(e,t){return new e({type:"void",...b(t)})}function ul(e,t){return new e({type:"date",...b(t)})}function ll(e,t){return new e({type:"date",coerce:!0,...b(t)})}function fl(e,t){return new e({type:"nan",...b(t)})}function Ce(e,t){return new Io({check:"less_than",...b(t),value:e,inclusive:!1})}function $e(e,t){return new Io({check:"less_than",...b(t),value:e,inclusive:!0})}function Te(e,t){return new zo({check:"greater_than",...b(t),value:e,inclusive:!1})}function be(e,t){return new zo({check:"greater_than",...b(t),value:e,inclusive:!0})}function zi(e){return Te(0,e)}function Pi(e){return Ce(0,e)}function Ai(e){return $e(0,e)}function Oi(e){return be(0,e)}function Ye(e,t){return new Ka({check:"multiple_of",...b(t),value:e})}function Qe(e,t){return new Wa({check:"max_size",...b(t),maximum:e})}function Ne(e,t){return new qa({check:"min_size",...b(t),minimum:e})}function kt(e,t){return new Ha({check:"size_equals",...b(t),size:e})}function St(e,t){return new Xa({check:"max_length",...b(t),maximum:e})}function Fe(e,t){return new Ya({check:"min_length",...b(t),minimum:e})}function It(e,t){return new Qa({check:"length_equals",...b(t),length:e})}function rr(e,t){return new ec({check:"string_format",format:"regex",...b(t),pattern:e})}function nr(e){return new tc({check:"string_format",format:"lowercase",...b(e)})}function or(e){return new rc({check:"string_format",format:"uppercase",...b(e)})}function ir(e,t){return new nc({check:"string_format",format:"includes",...b(t),includes:e})}function sr(e,t){return new oc({check:"string_format",format:"starts_with",...b(t),prefix:e})}function ar(e,t){return new ic({check:"string_format",format:"ends_with",...b(t),suffix:e})}function Ei(e,t,r){return new sc({check:"property",property:e,schema:t,...b(r)})}function cr(e,t){return new ac({check:"properties",shape:e,...b(t)})}function ur(e,t){return new cc({check:"mime_type",mime:e,...b(t)})}function Pe(e){return new uc({check:"overwrite",tx:e})}function lr(e){return Pe(t=>t.normalize(e))}function fr(){return Pe(e=>e.trim())}function pr(){return Pe(e=>e.toLowerCase())}function dr(){return Pe(e=>e.toUpperCase())}function mr(){return Pe(e=>Bs(e))}function pl(e,t,r){return new e({type:"array",element:t,...b(r)})}function Jv(e,t,r){return new e({type:"union",options:t,...b(r)})}function Gv(e,t,r){return new e({type:"union",options:t,inclusive:!1,...b(r)})}function Wv(e,t,r,n){return new e({type:"union",options:r,discriminator:t,...b(n)})}function qv(e,t,r){return new e({type:"intersection",left:t,right:r})}function Hv(e,t,r,n){let o=r instanceof C,i=o?n:r,a=o?r:null;return new e({type:"tuple",items:t,rest:a,...b(i)})}function Xv(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,...b(n)})}function Yv(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,...b(n)})}function Qv(e,t,r){return new e({type:"set",valueType:t,...b(r)})}function e_(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:n,...b(r)})}function t_(e,t,r){return new e({type:"enum",entries:t,...b(r)})}function r_(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...b(r)})}function dl(e,t){return new e({type:"file",...b(t)})}function n_(e,t){return new e({type:"transform",transform:t})}function o_(e,t){return new e({type:"optional",innerType:t})}function i_(e,t){return new e({type:"nullable",innerType:t})}function s_(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Zr(r)}})}function a_(e,t,r){return new e({type:"nonoptional",innerType:t,...b(r)})}function c_(e,t){return new e({type:"success",innerType:t})}function u_(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:Xs(r)})}function l_(e,t,r){return new e({type:"pipe",in:t,out:r})}function f_(e,t){return new e({type:"readonly",innerType:t})}function p_(e,t,r){return new e({type:"template_literal",parts:t,...b(r)})}function d_(e,t){return new e({type:"lazy",getter:t})}function m_(e,t){return new e({type:"promise",innerType:t})}function ml(e,t,r){let n=b(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function hl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...b(r)})}function gl(e,t){let r=wm(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Jt(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(Jt(i))}},e(n.value,n)),t);return r}function wm(e,t){let r=new U({check:"custom",...b(t)});return r._zod.check=e,r}function yl(e){let t=new U({check:"describe"});return t._zod.onattach=[r=>{let n=ee.get(r)??{};ee.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function $l(e){let t=new U({check:"meta"});return t._zod.onattach=[r=>{let n=ee.get(r)??{};ee.add(r,{...n,...e})}],t._zod.check=()=>{},t}function bl(e,t){let r=b(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(d=>typeof d=="string"?d.toLowerCase():d),o=o.map(d=>typeof d=="string"?d.toLowerCase():d));let i=new Set(n),a=new Set(o),c=e.Codec??on,u=e.Boolean??rn,l=e.String??bt,f=new l({type:"string",error:r.error}),p=new u({type:"boolean",error:r.error}),m=new c({type:"pipe",in:f,out:p,transform:s(((d,g)=>{let $=d;return r.case!=="sensitive"&&($=$.toLowerCase()),i.has($)?!0:a.has($)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:m,continue:!1}),{})}),"transform"),reverseTransform:s(((d,g)=>d===!0?n[0]||"true":o[0]||"false"),"reverseTransform"),error:r.error});return m._zod.bag.truthy=n,m._zod.bag.falsy=o,m._zod.bag.case=r.case??"insensitive",m}function zt(e,t,r,n={}){let o=b(n),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:c=>r.test(c),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}var Vu,vm=I(()=>{Po();pn();Qt();q();s(ii,"snapshotChecks");s(Du,"_string");s(Lu,"_coercedString");s(si,"_email");s(ai,"_guid");s(ci,"_uuid");s(ui,"_uuidv4");s(li,"_uuidv6");s(fi,"_uuidv7");s(dn,"_url");s(pi,"_emoji");s(di,"_nanoid");s(mi,"_cuid");s(hi,"_cuid2");s(gi,"_ulid");s(yi,"_xid");s($i,"_ksuid");s(bi,"_ipv4");s(wi,"_ipv6");s(ju,"_mac");s(vi,"_cidrv4");s(_i,"_cidrv6");s(xi,"_base64");s(ki,"_base64url");s(Si,"_e164");s(Mu,"_creditCard");s(Fu,"_iban");s(Ii,"_jwt");Vu={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};s(mn,"_isoDateTime");s(hn,"_isoDate");s(gn,"_isoTime");s(yn,"_isoDuration");s(Uu,"_number");s(Bu,"_coercedNumber");s(Ku,"_int");s(Ju,"_float32");s(Gu,"_float64");s(Wu,"_int32");s(qu,"_uint32");s(Hu,"_boolean");s(Xu,"_coercedBoolean");s(Yu,"_bigint");s(Qu,"_coercedBigint");s(el,"_int64");s(tl,"_uint64");s(rl,"_symbol");s(nl,"_undefined");s(ol,"_null");s(il,"_any");s(sl,"_unknown");s(al,"_never");s(cl,"_void");s(ul,"_date");s(ll,"_coercedDate");s(fl,"_nan");s(Ce,"_lt");s($e,"_lte");s(Te,"_gt");s(be,"_gte");s(zi,"_positive");s(Pi,"_negative");s(Ai,"_nonpositive");s(Oi,"_nonnegative");s(Ye,"_multipleOf");s(Qe,"_maxSize");s(Ne,"_minSize");s(kt,"_size");s(St,"_maxLength");s(Fe,"_minLength");s(It,"_length");s(rr,"_regex");s(nr,"_lowercase");s(or,"_uppercase");s(ir,"_includes");s(sr,"_startsWith");s(ar,"_endsWith");s(Ei,"_property");s(cr,"_properties");s(ur,"_mime");s(Pe,"_overwrite");s(lr,"_normalize");s(fr,"_trim");s(pr,"_toLowerCase");s(dr,"_toUpperCase");s(mr,"_slugify");s(pl,"_array");s(Jv,"_union");s(Gv,"_xor");s(Wv,"_discriminatedUnion");s(qv,"_intersection");s(Hv,"_tuple");s(Xv,"_record");s(Yv,"_map");s(Qv,"_set");s(e_,"_enum");s(t_,"_nativeEnum");s(r_,"_literal");s(dl,"_file");s(n_,"_transform");s(o_,"_optional");s(i_,"_nullable");s(s_,"_default");s(a_,"_nonoptional");s(c_,"_success");s(u_,"_catch");s(l_,"_pipe");s(f_,"_readonly");s(p_,"_templateLiteral");s(d_,"_lazy");s(m_,"_promise");s(ml,"_custom");s(hl,"_refine");s(gl,"_superRefine");s(wm,"_check");s(yl,"describe");s($l,"meta");s(bl,"_stringbool");s(zt,"_stringFormat")});function $n(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&Q(e,n,r[n]);return e}function et(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??ee,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 H(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 F(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 a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let f={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,f);else{let m=a.schema,d=t.processors[o.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,m,f)}let p=e._zod.parent;p&&(a.ref||(a.ref=p),F(p,t,f),t.seen.get(p).isParent=!0)}let u=t.metadataRegistry.get(e);return u&&$n(a.schema,u),t.io==="input"&&se(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function _m(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function tt(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 a of e.seen.entries()){let c=e.metadataRegistry.get(a[0])?.id;if(c){let u=n.get(c);if(u&&u!==a[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,a[0])}}let o=s(a=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(a[0])?.id,m=e.external.uri??(g=>g);if(p)return{ref:m(p)};let d=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=d,{defId:d,ref:`${m("__shared")}#/${c}/${_m(d)}`}}let u="#",l=`${u}/${c}/`;if(a[1]===r&&!a[1].schema.id)return{ref:u};let f=a[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:l+_m(f)}},"makeURI"),i=s(a=>{if(a[1].schema.$ref)return;let c=a[1],{ref:u,defId:l}=o(a);c.def={...c.schema},l&&(c.defId=l);let f=c.schema;for(let p in f)delete f[p];f.$ref=u},"extractToDef");if(e.cycles==="throw")for(let a of e.seen.entries()){let c=a[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
67
67
|
|
|
68
68
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let c=a[1];if(t===a[0]){i(a);continue}if(e.external){let l=e.external.registry.get(a[0])?.id;if(t!==a[0]&&l){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(c.cycle){i(a);continue}c.count>1&&e.reused==="ref"&&i(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Sm(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;Sm(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let a of Array.isArray(i)?i:[i]){if(typeof a!="string")return;r.includes(a)||r.push(a)}}delete e.anyOf,e.type=r.length===1?r[0]:r}function km(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function wl(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let a in i)if(!Im.has(a))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let a in i.properties){if(Object.prototype.hasOwnProperty.call(r,a))continue;let c=[];for(let l of t){let f=l.properties?.[a]??km(l);f!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(f))||c.push(f))}let u=c.length===1?c[0]:wl(c)??{allOf:c};Q(r,a,u)}for(let a of i.required??[])n.add(a)}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 a of t){let c=km(a);c&&!i.some(u=>JSON.stringify(u)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function h_(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Im)if(o in e)return;let r=t.filter(o=>xm.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=wl(t);else{let o=r[0],i=xm.find(u=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let a=t.filter(u=>u!==o),c=o[i].map(u=>wl([...a,u]));if(c.some(u=>!u))return;n={[i]:c}}n&&(delete e.allOf,$n(e,n))}function rt(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=s(c=>{let u=e.seen.get(c);if(u.ref===null)return;let l=u.def??u.schema,f={...l},p=u.ref;if(u.ref=null,p){n(p);let d=e.seen.get(p),g=d.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(g)):$n(l,g),$n(l,f),c._zod.parent===p)for(let w in l)w==="$ref"||w==="allOf"||w in f||delete l[w];if(g.$ref&&d.def)for(let w in l)w==="$ref"||w==="allOf"||w in d.def&&JSON.stringify(l[w])===JSON.stringify(d.def[w])&&delete l[w]}let m=c._zod.parent;if(m&&m!==p){n(m);let d=e.seen.get(m);if(d?.schema.$ref&&(l.$ref=d.schema.$ref,d.def))for(let g in l)g==="$ref"||g==="allOf"||g in d.def&&JSON.stringify(l[g])===JSON.stringify(d.def[g])&&delete l[g]}e.override({zodSchema:c,jsonSchema:l,path:u.path??[]})},"flattenRef");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())Sm(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let u of e.seen.values())for(let l of[u.schema,u.def]){let f=l?.allOf;if(!Array.isArray(f))continue;let p=c.get(f);p?p.push(l):c.set(f,[l])}for(let u of e.intersections)for(let l of c.get(u)??[])h_(l)}}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)}$n(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 a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let u=c[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,Q(a,u.defId,u.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?o.$defs=a:o.definitions=a);try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:hr(t,"input",e.processors),output:hr(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function se(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 se(n.element,r);if(n.type==="set")return se(n.valueType,r);if(n.type==="lazy")return se(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 se(n.innerType,r);if(n.type==="intersection")return se(n.left,r)||se(n.right,r);if(n.type==="record"||n.type==="map")return se(n.keyType,r)||se(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:se(n.in,r)||se(n.out,r);if(n.type==="object"){for(let o in n.shape)if(se(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(se(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(se(o,r))return!0;return!!(n.rest&&se(n.rest,r))}return!1}var Im,xm,vl,hr,bn=I(()=>{pn();q();s($n,"assignProps");s(et,"initializeContext");s(H,"handleUnrepresentable");s(F,"processSchema");s(_m,"encodeJSONPointerSegment");s(tt,"extractDefs");s(Sm,"compactTypeUnion");Im=new Set(["type","properties","required","additionalProperties"]),xm=["oneOf","anyOf"];s(km,"undeclaredConstraint");s(wl,"foldObjects");s(h_,"foldIntersection");s(rt,"finalize");s(se,"isTransforming");vl=s((e,t={})=>r=>{let n=et({...r,processors:t});return F(e,n),tt(n,e),rt(n,e)},"createToJSONSchemaMethod"),hr=s((e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=et({...o??{},target:i,io:t,processors:r});return F(e,a),tt(a,e),rt(a,e)},"createStandardJSONSchemaMethod")});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)g_[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&gr(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&gr(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&yr(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&yr(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Em(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&Tm(t,o.mime);for(let i of o.patterns??[])Cm(t,i);return t}function wn(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?wn(t.out):t.type==="catch"?wn(t.innerType):e._zod.optin}function _l(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let $=_l(e,g,r);return $===g?t:$}for(let g of["anyOf","oneOf"]){let $=t[g];if(!Array.isArray($))continue;let w=$.map(v=>_l(e,v,r));w.some((v,x)=>v!==$[x])&&(t={...t,[g]:w})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(g=>typeof g=="number"))return t;let{minimum:a,maximum:c,exclusiveMinimum:u,exclusiveMaximum:l,multipleOf:f,format:p,id:m,...d}=t;return d.enum?d.enum=d.enum.map(g=>typeof g=="number"?String(g):g):typeof d.const=="number"&&(d.const=String(d.const)),o&&(d.type="string",i||(d.pattern=(n.includes("number")?Me:Wr).source)),d}function b_(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of xl.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let a=_l(t,i,new Set);a!==i&&r.set(i,a)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}function Zm(e,t,r,n,o){let i=!1,a=JSON.stringify(e,(c,u)=>typeof u!="bigint"?u:(i=!0,null));return i?(H(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ef):JSON.parse(a)}function Ri(e,t){if("_idmap"in e){let n=e,o=et({...t,processors:Ci}),i={};for(let u of n._idmap.entries()){let[l,f]=u;F(f,o)}let a={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let u of n._idmap.entries()){let[l,f]=u;tt(o,f),Q(a,l,rt(o,f))}if(Object.keys(i).length>0){let u=o.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[u]:i}}return{schemas:a}}let r=et({...t,processors:Ci});return F(e,r),tt(r,e),rt(r,e)}var gr,yr,zm,Em,Cm,Tm,Nm,Pm,Am,Om,g_,y_,$_,Rm,kl,Sl,Il,zl,Pl,Al,Ol,El,Cl,Tl,Nl,Rl,Zl,Dl,Ll,jl,Ml,Fl,Vl,Ul,Bl,Kl,Jl,Gl,Wl,Ti,ql,Hl,xl,Xl,Yl,Ql,ef,tf,rf,nf,of,sf,af,Ni,cf,Ci,vn=I(()=>{yt();Qt();bn();q();gr=s((e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},"narrowMin"),yr=s((e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},"narrowMax"),zm=s((e,t)=>{gr(e,"minimum",t),yr(e,"maximum",t)},"narrowBoth"),Em=s((e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},"addDivisor"),Cm=s((e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},"addPattern"),Tm=s((e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},"intersectMime"),Nm=s((e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},"setFormat"),Pm=s((e,t)=>gr(e,"minimum",t.minimum),"minContributor"),Am=s((e,t)=>yr(e,"maximum",t.maximum),"maxContributor"),Om=s(e=>(t,r)=>{Nm(t,r.format);let[n,o]=e[r.format];gr(t,"minimum",n),yr(t,"maximum",o)},"formatContributor"),g_={greater_than:s((e,t)=>gr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),"greater_than"),less_than:s((e,t)=>yr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),"less_than"),multiple_of:s((e,t)=>Em(e,t.value),"multiple_of"),number_format:Om(Lr),bigint_format:Om(jr),min_length:Pm,max_length:Am,length_equals:s((e,t)=>zm(e,t.length),"length_equals"),min_size:Pm,max_size:Am,size_equals:s((e,t)=>zm(e,t.size),"size_equals"),string_format:s((e,t)=>{Nm(e,t.format),t.pattern&&Cm(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},"string_format"),mime_type:s((e,t)=>Tm(e,t.mime),"mime_type")};s(X,"aggregateChecks");y_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},$_=new Map([[jo,Sa],[tn,Ia]]),Rm=s(e=>$_.get(e)??e,"exactPattern"),kl=s((e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:c,patterns:u,contentEncoding:l,laxFormat:f}=X(e);if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),c&&(o.format=y_[c]??c,o.format===""&&delete o.format,(c==="time"||f)&&delete o.format),l&&(o.contentEncoding=l),u&&u.size>0){let p=[...u].map(Rm);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},"stringProcessor"),Sl=s((e,t,r,n)=>{let o=r,{minimum:i,maximum:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l,isInt:f}=X(e);o.type=f?"integer":"number";let p=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),m=typeof u=="number"&&u<=(a??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(p?d?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof i=="number"&&(o.minimum=i),m?d?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof a=="number"&&(o.maximum=a),c){let g=new Set;for(let v of c)Number.isFinite(v)&&v!==0?g.add(Math.abs(v)):H(e,t,o,n,`A multipleOf divisor of ${v} cannot be represented in JSON Schema`);let[$,...w]=g;$!==void 0&&(o.multipleOf=$),w.length&&(o.allOf=[...o.allOf??[],...w.map(v=>({multipleOf:v}))])}},"numberProcessor"),Il=s((e,t,r,n)=>{r.type="boolean"},"booleanProcessor"),zl=s((e,t,r,n)=>{H(e,t,r,n,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),Pl=s((e,t,r,n)=>{H(e,t,r,n,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),Al=s((e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},"nullProcessor"),Ol=s((e,t,r,n)=>{H(e,t,r,n,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),El=s((e,t,r,n)=>{H(e,t,r,n,"Void cannot be represented in JSON Schema")},"voidProcessor"),Cl=s((e,t,r,n)=>{r.not={}},"neverProcessor"),Tl=s((e,t,r,n)=>{},"anyProcessor"),Nl=s((e,t,r,n)=>{},"unknownProcessor"),Rl=s((e,t,r,n)=>{H(e,t,r,n,"Date cannot be represented in JSON Schema")},"dateProcessor"),Zl=s((e,t,r,n)=>{let o=e._zod.def,i=Vt(o.entries);if(i.length===0){r.not={};return}i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},"enumProcessor"),Dl=s((e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let a of o.values)if(a===void 0){if(H(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(H(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},"literalProcessor"),Ll=s((e,t,r,n)=>{H(e,t,r,n,"NaN cannot be represented in JSON Schema")},"nanProcessor"),jl=s((e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},"templateLiteralProcessor"),Ml=s((e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:a,mime:c}=X(e);i!==void 0&&(o.minLength=i),a!==void 0&&(o.maxLength=a),c&&(c.length===0?o.not={}:c.length===1?o.contentMediaType=c[0]:o.anyOf=c.map(u=>({contentMediaType:u})))},"fileProcessor"),Fl=s((e,t,r,n)=>{r.type="boolean"},"successProcessor"),Vl=s((e,t,r,n)=>{H(e,t,r,n,"Custom types cannot be represented in JSON Schema")},"customProcessor"),Ul=s((e,t,r,n)=>{H(e,t,r,n,"Function types cannot be represented in JSON Schema")},"functionProcessor"),Bl=s((e,t,r,n)=>{H(e,t,r,n,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),Kl=s((e,t,r,n)=>{H(e,t,r,n,"Map cannot be represented in JSON Schema")},"mapProcessor"),Jl=s((e,t,r,n)=>{H(e,t,r,n,"Set cannot be represented in JSON Schema")},"setProcessor"),Gl=s((e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:c}=X(e);typeof a=="number"&&(o.minItems=a),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=F(i.element,t,{...n,path:[...n.path,"items"]})},"arrayProcessor");s(wn,"inputOptin");Wl=s((e,t,r,n)=>{let o=r,i=e._zod.def,a=i.shape;if(Object.getOwnPropertySymbols(a).length&&H(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in a)Q(o.properties,l,F(a[l],t,{...n,path:[...n.path,"properties",l]}));let u=[];for(let l of Object.keys(a)){let f=i.shape[l];(t.io==="input"?wn(f)===void 0:f._zod.optout===void 0)&&u.push(l)}u.length>0&&(o.required=u),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=F(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},"objectProcessor"),Ti=s((e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((c,u)=>F(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));i?r.oneOf=a:r.anyOf=a},"unionProcessor"),ql=s((e,t,r,n)=>{let o=e._zod.def,i=F(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=F(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=s(l=>"allOf"in l&&Object.keys(l).length===1,"isSimpleIntersection"),u=[...c(i)?i.allOf:[i],...c(a)?a.allOf:[a]];r.allOf=u,t.intersections.push(u)},"intersectionProcessor"),Hl=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=i.items.map(($,w)=>F($,t,{...n,path:[...n.path,a,w]})),l=i.rest?F(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,f=i.items.length;for(;f>0;){let $=i.items[f-1];if(!(t.io==="input"?wn($)!==void 0:$._zod.optout==="optional"))break;f--}let p=i.items.length,m=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=u,m?o.items=!1:l&&(o.items=l),f>0&&(o.minItems=f),m&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:u},l&&o.items.anyOf.push(l),f>0&&(o.minItems=f),m&&(o.maxItems=p)):(o.items=u,m?o.additionalItems=!1:l&&(o.additionalItems=l),f>0&&(o.minItems=f),m&&(o.maxItems=p));let{minimum:d,maximum:g}=X(e);typeof d=="number"&&(o.minItems=d),typeof g=="number"&&(o.maxItems=g)},"tupleProcessor");s(_l,"stringifyKeyNames");xl=new WeakMap;s(b_,"rewriteKeyNames");Xl=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=X(a).patterns;if(i.mode==="loose"&&c&&c.size>0){let f=F(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of c)Q(o.patternProperties,Rm(p).source,f)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=F(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let f=xl.get(t);f||(f=[],xl.set(t,f),t.deferred.push(()=>b_(t))),f.push(e)}o.additionalProperties=F(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=a._zod.values,l=t.io==="input"&&wn(i.valueType)!==void 0;if(u&&!i.partial&&!l){let f=[...u].filter(p=>typeof p=="string"||typeof p=="number");f.length>0&&(o.required=f.map(String))}},"recordProcessor"),Yl=s((e,t,r,n)=>{let o=e._zod.def,i=F(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},"nullableProcessor"),Ql=s((e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"nonoptionalProcessor"),ef=Symbol();s(Zm,"serializeDefaultValue");tf=s((e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a=Zm(o.defaultValue,e,t,r,n);a!==ef&&(r.default=a)},"defaultProcessor"),rf=s((e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let a=Zm(o.defaultValue,e,t,r,n);a!==ef&&(r._prefault=a)},"prefaultProcessor"),nf=s((e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{H(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=a},"catchProcessor"),of=s((e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?o.out:o.in:o.out;F(a,t,n);let c=t.seen.get(e);c.ref=a},"pipeProcessor"),sf=s((e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},"readonlyProcessor"),af=s((e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"promiseProcessor"),Ni=s((e,t,r,n)=>{let o=e._zod.def;F(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"optionalProcessor"),cf=s((e,t,r,n)=>{let o=e._zod.innerType;F(o,t,n);let i=t.seen.get(e);i.ref=o},"lazyProcessor"),Ci={string:kl,number:Sl,boolean:Il,bigint:zl,symbol:Pl,null:Al,undefined:Ol,void:El,never:Cl,any:Tl,unknown:Nl,date:Rl,enum:Zl,literal:Dl,nan:Ll,template_literal:jl,file:Ml,success:Fl,custom:Vl,function:Ul,transform:Bl,map:Kl,set:Jl,array:Gl,object:Wl,union:Ti,intersection:ql,tuple:Hl,record:Xl,nullable:Yl,nonoptional:Ql,default:tf,prefault:rf,catch:nf,pipe:of,readonly:sf,promise:af,optional:Ni,lazy:cf};s(Ri,"toJSONSchema")});var Zi,Dm=I(()=>{vn();bn();Zi=class{static{s(this,"JSONSchemaGenerator")}get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=et({processors:Ci,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return F(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,tt(this.ctx,t);let n=rt(this.ctx,t),{"~standard":o,...i}=n;return i}}});var Lm={};var jm=I(()=>{});var Ve={};le(Ve,{$ZodAny:()=>Gc,$ZodArray:()=>Yc,$ZodAsyncError:()=>de,$ZodBase64:()=>Rc,$ZodBase64URL:()=>Zc,$ZodBigInt:()=>Ko,$ZodBigIntFormat:()=>Uc,$ZodBoolean:()=>rn,$ZodCIDRv4:()=>Tc,$ZodCIDRv6:()=>Nc,$ZodCUID:()=>vc,$ZodCUID2:()=>_c,$ZodCatch:()=>yu,$ZodCheck:()=>U,$ZodCheckBigIntFormat:()=>Ga,$ZodCheckEndsWith:()=>ic,$ZodCheckGreaterThan:()=>zo,$ZodCheckIncludes:()=>nc,$ZodCheckLengthEquals:()=>Qa,$ZodCheckLessThan:()=>Io,$ZodCheckLowerCase:()=>tc,$ZodCheckMaxLength:()=>Xa,$ZodCheckMaxSize:()=>Wa,$ZodCheckMimeType:()=>cc,$ZodCheckMinLength:()=>Ya,$ZodCheckMinSize:()=>qa,$ZodCheckMultipleOf:()=>Ka,$ZodCheckNumberFormat:()=>Ja,$ZodCheckOverwrite:()=>uc,$ZodCheckProperties:()=>ac,$ZodCheckProperty:()=>sc,$ZodCheckRegex:()=>ec,$ZodCheckSizeEquals:()=>Ha,$ZodCheckStartsWith:()=>oc,$ZodCheckStringFormat:()=>Xt,$ZodCheckUpperCase:()=>rc,$ZodCodec:()=>on,$ZodCreditCard:()=>Lc,$ZodCustom:()=>ku,$ZodCustomStringFormat:()=>Fc,$ZodCyclicError:()=>Yo,$ZodDate:()=>Xc,$ZodDefault:()=>du,$ZodDiscriminatedUnion:()=>ru,$ZodE164:()=>Dc,$ZodEmail:()=>hc,$ZodEmoji:()=>bc,$ZodEncodeError:()=>Xe,$ZodEnum:()=>au,$ZodError:()=>na,$ZodExactOptional:()=>fu,$ZodFile:()=>uu,$ZodFunction:()=>_u,$ZodGUID:()=>dc,$ZodIBAN:()=>jc,$ZodIPv4:()=>Oc,$ZodIPv6:()=>Ec,$ZodISODate:()=>zc,$ZodISODateTime:()=>Ic,$ZodISODuration:()=>Ac,$ZodISOTime:()=>Pc,$ZodIntersection:()=>nu,$ZodJWT:()=>Mc,$ZodKSUID:()=>Sc,$ZodLazy:()=>sn,$ZodLiteral:()=>cu,$ZodMAC:()=>Cc,$ZodMap:()=>iu,$ZodNaN:()=>$u,$ZodNanoID:()=>wc,$ZodNever:()=>qc,$ZodNonOptional:()=>hu,$ZodNull:()=>Jc,$ZodNullable:()=>pu,$ZodNumber:()=>Bo,$ZodNumberFormat:()=>Vc,$ZodObject:()=>om,$ZodObjectJIT:()=>Qc,$ZodOptional:()=>Go,$ZodPipe:()=>Wo,$ZodPrefault:()=>mu,$ZodPreprocess:()=>bu,$ZodPromise:()=>xu,$ZodReadonly:()=>wu,$ZodRealError:()=>me,$ZodRecord:()=>ou,$ZodRegistry:()=>ti,$ZodSet:()=>su,$ZodString:()=>bt,$ZodStringFormat:()=>M,$ZodSuccess:()=>gu,$ZodSymbol:()=>Bc,$ZodTemplateLiteral:()=>vu,$ZodTransform:()=>lu,$ZodTuple:()=>Jo,$ZodType:()=>C,$ZodULID:()=>xc,$ZodURL:()=>$c,$ZodUUID:()=>mc,$ZodUndefined:()=>Kc,$ZodUnion:()=>nn,$ZodUnknown:()=>Wc,$ZodVoid:()=>Hc,$ZodXID:()=>kc,$ZodXor:()=>eu,$brand:()=>ea,$constructor:()=>h,$input:()=>Eu,$output:()=>Ou,Doc:()=>$t,INVALID:()=>ie,JSONSchema:()=>Lm,JSONSchemaGenerator:()=>Zi,NEVER:()=>Qs,TimePrecision:()=>Vu,URL_BAD_FORMAT:()=>gc,URL_UNPARSEABLE:()=>Xr,ZodCompileAsyncError:()=>ze,ZodCompileUnsupportedError:()=>D,_any:()=>il,_array:()=>pl,_base64:()=>xi,_base64url:()=>ki,_bigint:()=>Yu,_boolean:()=>Hu,_catch:()=>u_,_check:()=>wm,_cidrv4:()=>vi,_cidrv6:()=>_i,_coercedBigint:()=>Qu,_coercedBoolean:()=>Xu,_coercedDate:()=>ll,_coercedNumber:()=>Bu,_coercedString:()=>Lu,_creditCard:()=>Mu,_cuid:()=>mi,_cuid2:()=>hi,_custom:()=>ml,_date:()=>ul,_decode:()=>ho,_decodeAsync:()=>yo,_default:()=>s_,_discriminatedUnion:()=>Wv,_e164:()=>Si,_email:()=>si,_emoji:()=>pi,_encode:()=>mo,_encodeAsync:()=>go,_endsWith:()=>ar,_enum:()=>e_,_file:()=>dl,_float32:()=>Ju,_float64:()=>Gu,_gt:()=>Te,_gte:()=>be,_guid:()=>ai,_iban:()=>Fu,_includes:()=>ir,_int:()=>Ku,_int32:()=>Wu,_int64:()=>el,_intersection:()=>qv,_ipv4:()=>bi,_ipv6:()=>wi,_isoDate:()=>hn,_isoDateTime:()=>mn,_isoDuration:()=>yn,_isoTime:()=>gn,_jwt:()=>Ii,_ksuid:()=>$i,_lazy:()=>d_,_length:()=>It,_literal:()=>r_,_lowercase:()=>nr,_lt:()=>Ce,_lte:()=>$e,_mac:()=>ju,_map:()=>Yv,_max:()=>$e,_maxLength:()=>St,_maxSize:()=>Qe,_mime:()=>ur,_min:()=>be,_minLength:()=>Fe,_minSize:()=>Ne,_multipleOf:()=>Ye,_nan:()=>fl,_nanoid:()=>di,_nativeEnum:()=>t_,_negative:()=>Pi,_never:()=>al,_nonnegative:()=>Oi,_nonoptional:()=>a_,_nonpositive:()=>Ai,_normalize:()=>lr,_null:()=>ol,_nullable:()=>i_,_number:()=>Uu,_optional:()=>o_,_overwrite:()=>Pe,_parse:()=>Gt,_parseAsync:()=>Wt,_pipe:()=>l_,_positive:()=>zi,_promise:()=>m_,_properties:()=>cr,_property:()=>Ei,_readonly:()=>f_,_record:()=>Xv,_refine:()=>hl,_regex:()=>rr,_safeDecode:()=>bo,_safeDecodeAsync:()=>vo,_safeEncode:()=>$o,_safeEncodeAsync:()=>wo,_safeParse:()=>qt,_safeParseAsync:()=>Ht,_set:()=>Qv,_size:()=>kt,_slugify:()=>mr,_startsWith:()=>sr,_string:()=>Du,_stringFormat:()=>zt,_stringbool:()=>bl,_success:()=>c_,_superRefine:()=>gl,_symbol:()=>rl,_templateLiteral:()=>p_,_toLowerCase:()=>pr,_toUpperCase:()=>dr,_transform:()=>n_,_trim:()=>fr,_tuple:()=>Hv,_uint32:()=>qu,_uint64:()=>tl,_ulid:()=>gi,_undefined:()=>nl,_union:()=>Jv,_unknown:()=>sl,_uppercase:()=>or,_url:()=>dn,_uuid:()=>ci,_uuidv4:()=>ui,_uuidv6:()=>li,_uuidv7:()=>fi,_void:()=>cl,_xid:()=>yi,_xor:()=>Gv,base64Charset:()=>jo,base64urlCharset:()=>tn,canParseURL:()=>yc,clone:()=>j,compile:()=>Ru,compileFn:()=>oi,config:()=>G,createStandardJSONSchemaMethod:()=>hr,createToJSONSchemaMethod:()=>vl,decode:()=>rw,decodeAsync:()=>ow,describe:()=>yl,encode:()=>tw,encodeAsync:()=>nw,extractDefs:()=>tt,finalize:()=>rt,flattenError:()=>Ur,formatError:()=>Br,getDiscriminatedOption:()=>tu,globalConfig:()=>Y,globalRegistry:()=>ee,handleUnrepresentable:()=>H,initializeContext:()=>et,isBackEdge:()=>ei,isRecursiveSchema:()=>Qo,isValidBase64:()=>en,isValidBase64URL:()=>Mo,isValidCIDRv6:()=>Lo,isValidCreditCard:()=>Fo,isValidIBAN:()=>Vo,isValidIPv6:()=>Qr,isValidJWT:()=>Uo,locales:()=>fn,memoizer:()=>un,mergeValues:()=>Yt,meta:()=>$l,parse:()=>fo,parseAsync:()=>po,parseURLObject:()=>tm,prettifyError:()=>ia,process:()=>F,processSchema:()=>F,regexes:()=>Se,registry:()=>ri,safeDecode:()=>sw,safeDecodeAsync:()=>cw,safeEncode:()=>iw,safeEncodeAsync:()=>aw,safeParse:()=>Hb,safeParseAsync:()=>Xb,standardProps:()=>No,stripTabAndNewline:()=>Yr,toDotPath:()=>Nd,toJSONSchema:()=>Ri,toZod:()=>Nr,treeifyError:()=>oa,urlHostnameOk:()=>Zo,urlProtocolOk:()=>Do,util:()=>k,validate:()=>Kr,validateAsync:()=>Jr,validateURL:()=>Ro,version:()=>lc,withParser:()=>ni});var we=I(()=>{He();aa();sa();Qt();zu();Po();fc();q();q();yt();Au();pn();Ao();bm();vm();bn();vn();Dm();jm()});var Di={};le(Di,{endsWith:()=>ar,gt:()=>Te,gte:()=>be,includes:()=>ir,length:()=>It,lowercase:()=>nr,lt:()=>Ce,lte:()=>$e,maxLength:()=>St,maxSize:()=>Qe,mime:()=>ur,minLength:()=>Fe,minSize:()=>Ne,multipleOf:()=>Ye,negative:()=>Pi,nonnegative:()=>Oi,nonpositive:()=>Ai,normalize:()=>lr,overwrite:()=>Pe,positive:()=>zi,properties:()=>cr,property:()=>Ei,regex:()=>rr,size:()=>kt,slugify:()=>mr,startsWith:()=>sr,toLowerCase:()=>pr,toUpperCase:()=>dr,trim:()=>fr,uppercase:()=>or});var Li=I(()=>{we()});function ji(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 Mm,Fm,v_,he,uf=I(()=>{we();we();q();Mm=new WeakSet([Object.prototype,Error.prototype]);s(ji,"_lazyMethod");Fm=s((e,t)=>{na.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Mm.has(r)||(Mm.add(r),ji(r,"format",n=>o=>Br(n,o)),ji(r,"flatten",n=>o=>Ur(n,o)),ji(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Ut,2)}),ji(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Ut,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),v_=h("ZodError",Fm),he=h("ZodError",Fm,void 0,{Parent:Error})});var lf,ff,pf,df,mf,hf,gf,yf,$f,bf,wf,vf,_f=I(()=>{we();uf();we();lf=Gt(he),ff=Wt(he),pf=qt(he),df=Ht(he),mf=mo(he),hf=ho(he),gf=go(he),yf=yo(he),$f=$o(he),bf=bo(he),wf=wo(he),vf=vo(he)});var Sr={};le(Sr,{ZodAny:()=>Cf,ZodArray:()=>Zf,ZodBase64:()=>rs,ZodBase64URL:()=>ns,ZodBigInt:()=>xr,ZodBigIntFormat:()=>ss,ZodBoolean:()=>_r,ZodCIDRv4:()=>es,ZodCIDRv6:()=>ts,ZodCUID:()=>Gi,ZodCUID2:()=>Wi,ZodCatch:()=>np,ZodCodec:()=>En,ZodCreditCard:()=>kf,ZodCustom:()=>Cn,ZodCustomStringFormat:()=>Et,ZodDate:()=>Sn,ZodDefault:()=>Xf,ZodDiscriminatedUnion:()=>Lf,ZodE164:()=>os,ZodEmail:()=>Ui,ZodEmoji:()=>Ki,ZodEnum:()=>br,ZodExactOptional:()=>ls,ZodFile:()=>Gf,ZodFunction:()=>dp,ZodGUID:()=>Bi,ZodIBAN:()=>Sf,ZodIPv4:()=>Yi,ZodIPv6:()=>Qi,ZodISODate:()=>ot,ZodISODateTime:()=>nt,ZodISODuration:()=>st,ZodISOTime:()=>it,ZodInstanceOf:()=>gp,ZodIntersection:()=>jf,ZodJWT:()=>is,ZodKSUID:()=>Xi,ZodLazy:()=>lp,ZodLiteral:()=>Jf,ZodMAC:()=>xf,ZodMap:()=>Bf,ZodNaN:()=>ip,ZodNanoID:()=>Ji,ZodNever:()=>Nf,ZodNonOptional:()=>fs,ZodNull:()=>Of,ZodNullable:()=>Hf,ZodNumber:()=>vr,ZodNumberFormat:()=>Ct,ZodObject:()=>zn,ZodOptional:()=>An,ZodPipe:()=>On,ZodPrefault:()=>Qf,ZodPreprocess:()=>sp,ZodPromise:()=>pp,ZodReadonly:()=>ap,ZodRecord:()=>$r,ZodSet:()=>Kf,ZodString:()=>wr,ZodStringFormat:()=>V,ZodSuccess:()=>rp,ZodSymbol:()=>Pf,ZodTemplateLiteral:()=>up,ZodTransform:()=>Wf,ZodTuple:()=>Ff,ZodType:()=>T,ZodULID:()=>qi,ZodURL:()=>kn,ZodUUID:()=>Re,ZodUndefined:()=>Af,ZodUnion:()=>Pn,ZodUnknown:()=>Tf,ZodVoid:()=>Rf,ZodXID:()=>Hi,ZodXor:()=>Df,_ZodString:()=>Vi,_default:()=>Yf,_function:()=>Xh,any:()=>Ph,array:()=>In,base64:()=>ch,base64url:()=>uh,bigint:()=>xh,boolean:()=>zf,catch:()=>op,check:()=>Yh,cidrv4:()=>sh,cidrv6:()=>ah,codec:()=>Gh,creditCard:()=>fh,cuid:()=>Ym,cuid2:()=>Qm,currencyCode:()=>yh,custom:()=>Qh,date:()=>Oh,describe:()=>eg,discriminatedUnion:()=>Zh,e164:()=>lh,email:()=>Vm,emoji:()=>Hm,enum:()=>cs,exactOptional:()=>qf,file:()=>Uh,float32:()=>bh,float64:()=>wh,function:()=>Xh,guid:()=>Um,hash:()=>$h,hex:()=>gh,hostname:()=>hh,httpUrl:()=>qm,iban:()=>ph,instanceof:()=>rg,int:()=>Mi,int32:()=>vh,int64:()=>kh,intersection:()=>Mf,invertCodec:()=>Wh,ipv4:()=>nh,ipv6:()=>ih,json:()=>og,jwt:()=>dh,keyof:()=>Eh,ksuid:()=>rh,lazy:()=>fp,literal:()=>Vh,looseObject:()=>Nh,looseRecord:()=>Lh,mac:()=>oh,map:()=>jh,meta:()=>tg,nan:()=>Jh,nanoid:()=>Xm,nativeEnum:()=>Fh,never:()=>as,nonoptional:()=>tp,null:()=>Ef,nullable:()=>xn,nullish:()=>Bh,number:()=>If,object:()=>Ch,optional:()=>At,partialRecord:()=>Dh,pipe:()=>Fi,prefault:()=>ep,preprocess:()=>ig,promise:()=>Hh,readonly:()=>cp,record:()=>Uf,refine:()=>mp,set:()=>Mh,strictObject:()=>Th,string:()=>_n,stringFormat:()=>mh,stringbool:()=>ng,success:()=>Kh,superRefine:()=>hp,symbol:()=>Ih,templateLiteral:()=>qh,transform:()=>us,tuple:()=>Vf,uint32:()=>_h,uint64:()=>Sh,ulid:()=>eh,undefined:()=>zh,union:()=>kr,unknown:()=>Pt,url:()=>Wm,uuid:()=>Bm,uuidv4:()=>Km,uuidv6:()=>Jm,uuidv7:()=>Gm,void:()=>Ah,xid:()=>th,xor:()=>Rh});function x_(){Y.localeError||G(ln())}function Ot(){Y.memoizer||G({memoizer:un()})}function _n(e){return Du(wr,e)}function Vm(e){return si(Ui,e)}function Um(e){return ai(Bi,e)}function Bm(e){return ci(Re,e)}function Km(e){return ui(Re,e)}function Jm(e){return li(Re,e)}function Gm(e){return fi(Re,e)}function Wm(e){return dn(kn,e)}function qm(e){return dn(kn,{protocol:Gr,hostname:Pa,...k.normalizeParams(e)})}function Hm(e){return pi(Ki,e)}function Xm(e){return di(Ji,e)}function Ym(e){return mi(Gi,e)}function Qm(e){return hi(Wi,e)}function eh(e){return gi(qi,e)}function th(e){return yi(Hi,e)}function rh(e){return $i(Xi,e)}function nh(e){return bi(Yi,e)}function oh(e){return ju(xf,e)}function ih(e){return wi(Qi,e)}function sh(e){return vi(es,e)}function ah(e){return _i(ts,e)}function ch(e){return xi(rs,e)}function uh(e){return ki(ns,e)}function lh(e){return Si(os,e)}function fh(e){return Mu(kf,e)}function ph(e){return Fu(Sf,e)}function dh(e){return Ii(is,e)}function mh(e,t,r={}){return zt(Et,e,t,r)}function hh(e){return zt(Et,"hostname",za,e)}function gh(e){return zt(Et,"hex",Va,e)}function yh(e){return zt(Et,"currency_code",Oa,e)}function $h(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=Se[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return zt(Et,n,o,t)}function If(e){return Uu(vr,e)}function Mi(e){return Ku(Ct,e)}function bh(e){return Ju(Ct,e)}function wh(e){return Gu(Ct,e)}function vh(e){return Wu(Ct,e)}function _h(e){return qu(Ct,e)}function zf(e){return Hu(_r,e)}function xh(e){return Yu(xr,e)}function kh(e){return el(ss,e)}function Sh(e){return tl(ss,e)}function Ih(e){return rl(Pf,e)}function zh(e){return nl(Af,e)}function Ef(e){return ol(Of,e)}function Ph(){return il(Cf)}function Pt(){return sl(Tf)}function as(e){return al(Nf,e)}function Ah(e){return cl(Rf,e)}function Oh(e){return ul(Sn,e)}function In(e,t){return pl(Zf,e,t)}function Eh(e){let t=e._zod.def.shape;return cs(Object.keys(t))}function Ch(e,t){let r={type:"object",shape:e??{},...k.normalizeParams(t)};return new zn(r)}function Th(e,t){return new zn({type:"object",shape:e,catchall:as(),...k.normalizeParams(t)})}function Nh(e,t){return new zn({type:"object",shape:e,catchall:Pt(),...k.normalizeParams(t)})}function kr(e,t){return new Pn({type:"union",options:e,...k.normalizeParams(t)})}function Rh(e,t){return new Df({type:"union",options:e,inclusive:!1,...k.normalizeParams(t)})}function Zh(e,t,r){return new Lf({type:"union",options:t,discriminator:e,...k.normalizeParams(r)})}function Mf(e,t){return new jf({type:"intersection",left:e,right:t})}function Vf(e,t,r){let n=t instanceof C,o=n?r:t,i=n?t:null;return new Ff({type:"tuple",items:e,rest:i,...k.normalizeParams(o)})}function Uf(e,t,r){return!t||!t._zod?new $r({type:"record",keyType:_n(),valueType:e,...k.normalizeParams(t)}):new $r({type:"record",keyType:e,valueType:t,...k.normalizeParams(r)})}function Dh(e,t,r){return new $r({type:"record",keyType:e,valueType:t,...k.normalizeParams(r),partial:!0})}function Lh(e,t,r){return new $r({type:"record",keyType:e,valueType:t,mode:"loose",...k.normalizeParams(r)})}function jh(e,t,r){return new Bf({type:"map",keyType:e,valueType:t,...k.normalizeParams(r)})}function Mh(e,t){return new Kf({type:"set",valueType:e,...k.normalizeParams(t)})}function cs(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new br({type:"enum",entries:r,...k.normalizeParams(t)})}function Fh(e,t){return new br({type:"enum",entries:e,...k.normalizeParams(t)})}function Vh(e,t){return new Jf({type:"literal",values:Array.isArray(e)?e:[e],...k.normalizeParams(t)})}function Uh(e){return dl(Gf,e)}function us(e){return new Wf({type:"transform",transform:e})}function At(e){return new An({type:"optional",innerType:e})}function qf(e){return new ls({type:"optional",innerType:e})}function xn(e){return new Hf({type:"nullable",innerType:e})}function Bh(e){return At(xn(e))}function Yf(e,t){return new Xf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}function ep(e,t){return new Qf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}function tp(e,t){return new fs({type:"nonoptional",innerType:e,...k.normalizeParams(t)})}function Kh(e){return new rp({type:"success",innerType:e})}function op(e,t){return new np({type:"catch",innerType:e,catchValue:typeof t=="function"?t:k.constantCatch(t)})}function Jh(e){return fl(ip,e)}function Fi(e,t){return new On({type:"pipe",in:e,out:t})}function Gh(e,t,r){return new En({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function Wh(e){let t=e._zod.def;return new En({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function cp(e){return new ap({type:"readonly",innerType:e})}function qh(e,t){return new up({type:"template_literal",parts:e,...k.normalizeParams(t)})}function fp(e){return new lp({type:"lazy",getter:e})}function Hh(e){return new pp({type:"promise",innerType:e})}function Xh(e){return new dp({type:"function",input:Array.isArray(e?.input)?Vf(e?.input):e?.input??In(Pt()),output:e?.output??Pt()})}function Yh(e){let t=new U({check:"custom"});return t._zod.check=e,t}function Qh(e,t){return ml(Cn,e??(()=>!0),t)}function mp(e,t={}){return hl(Cn,e,t)}function hp(e,t){return gl(e,t)}function rg(e,t={}){let r=new gp({type:"custom",check:"custom",fn:s(n=>n instanceof e,"fn"),abort:!0,...k.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}function og(e){let t=fp(()=>kr([_n(e),If(),zf(),Ef(),In(t),Uf(_n(),t)]));return t}function ig(e,t){return new sp({type:"pipe",in:us(e),out:t})}var T,Vi,wr,V,nt,ot,it,st,Ui,Bi,Re,kn,Ki,Ji,Gi,Wi,qi,Hi,Xi,Yi,xf,Qi,es,ts,rs,ns,os,kf,Sf,is,Et,vr,Ct,_r,xr,ss,Pf,Af,Of,Cf,Tf,Nf,Rf,Sn,Zf,zn,Pn,Df,Lf,jf,Ff,$r,Bf,Kf,br,Jf,Gf,Wf,An,ls,Hf,Xf,Qf,fs,rp,np,ip,On,En,sp,ap,up,lp,pp,dp,Cn,eg,tg,gp,ng,at=I(()=>{we();we();vn();yt();bn();Pu();Li();_f();s(x_,"_ensureDefaultLocale");s(Ot,"_ensureDefaultMemoizer");T=h("ZodType",(e,t)=>(x_(),C.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(k.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 j(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(mp(e,t))},superRefine(e,t){return this.check(hp(e,t))},overwrite(e){return this.check(Pe(e))},optional(){return At(this)},exactOptional(){return qf(this)},nullable(){return xn(this)},nullish(){return At(xn(this))},nonoptional(e){return tp(this,e)},array(){return In(this)},or(e){return kr([this,e])},and(e){return Mf(this,e)},transform(e){return Fi(this,us(e))},default(e){return Yf(this,e)},prefault(e){return ep(this,e)},catch(e){return op(this,e)},pipe(e){return Fi(this,e)},readonly(){return cp(this)},describe(e){let t=this.clone();return ee.add(t,{description:e}),t},meta(...e){if(e.length===0)return ee.get(this);let t=this.clone();return ee.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 k.hide(this,"~standard",{...No(this),jsonSchema:{input:hr(this,"input"),output:hr(this,"output")}})},set"~standard"(e){k.own(this,"~standard",e)},parse:s(function e(t,r){return lf(this,t,r,{callee:e})},"_parse"),parseAsync:s(async function e(t,r){return await ff(this,t,r,{callee:e})},"_parseAsync"),safeParse(e,t){return pf(this,e,t)},async safeParseAsync(e,t){return df(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){k.own(this,"spa",e)},validate(e,t){return Kr(this,e,t)},validateAsync(e,t){return Jr(this,e,t)},encode:s(function e(t,r){return mf(this,t,r,{callee:e})},"_encode"),decode:s(function e(t,r){return hf(this,t,r,{callee:e})},"_decode"),encodeAsync:s(async function e(t,r){return await gf(this,t,r,{callee:e})},"_encodeAsync"),decodeAsync:s(async function e(t,r){return await yf(this,t,r,{callee:e})},"_decodeAsync"),safeEncode(e,t){return $f(this,e,t)},safeDecode(e,t){return bf(this,e,t)},async safeEncodeAsync(e,t){return wf(this,e,t)},async safeDecodeAsync(e,t){return vf(this,e,t)},toJSONSchema(e){return vl(this,{})(e)},get description(){return ee.get(this)?.description},get _def(){return this._zod.def}}),Vi=h("_ZodString",(e,t)=>{bt.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kl(e,r,n,o)},k.derived({format:s(e=>X(e).format??null,"format"),minLength:s(e=>X(e).minimum??null,"minLength"),maxLength:s(e=>X(e).maximum??null,"maxLength")},{regex(...e){return this.check(rr(...e))},includes(...e){return this.check(ir(...e))},startsWith(...e){return this.check(sr(...e))},endsWith(...e){return this.check(ar(...e))},min(...e){return this.check(Fe(...e))},max(...e){return this.check(St(...e))},length(...e){return this.check(It(...e))},nonempty(...e){return this.check(Fe(1,...e))},lowercase(e){return this.check(nr(e))},uppercase(e){return this.check(or(e))},trim(){return this.check(fr())},normalize(...e){return this.check(lr(...e))},toLowerCase(){return this.check(pr())},toUpperCase(){return this.check(dr())},slugify(){return this.check(mr())}})),wr=h("ZodString",(e,t)=>{bt.init(e,t),Vi.init(e,t)},{email(e){return this.check(si(Ui,e))},url(e){return this.check(dn(kn,e))},jwt(e){return this.check(Ii(is,e))},emoji(e){return this.check(pi(Ki,e))},guid(e){return this.check(ai(Bi,e))},uuid(e){return this.check(ci(Re,e))},uuidv4(e){return this.check(ui(Re,e))},uuidv6(e){return this.check(li(Re,e))},uuidv7(e){return this.check(fi(Re,e))},nanoid(e){return this.check(di(Ji,e))},cuid(e){return this.check(mi(Gi,e))},cuid2(e){return this.check(hi(Wi,e))},ulid(e){return this.check(gi(qi,e))},base64(e){return this.check(xi(rs,e))},base64url(e){return this.check(ki(ns,e))},xid(e){return this.check(yi(Hi,e))},ksuid(e){return this.check($i(Xi,e))},ipv4(e){return this.check(bi(Yi,e))},ipv6(e){return this.check(wi(Qi,e))},cidrv4(e){return this.check(vi(es,e))},cidrv6(e){return this.check(_i(ts,e))},e164(e){return this.check(Si(os,e))},datetime(e){return this.check(mn(nt,e))},date(e){return this.check(hn(ot,e))},time(e){return this.check(gn(it,e))},duration(e){return this.check(yn(st,e))}});s(_n,"string");V=h("ZodStringFormat",(e,t)=>{M.init(e,t),Vi.init(e,t)}),nt=h("ZodISODateTime",(e,t)=>{Ic.init(e,t),V.init(e,t)}),ot=h("ZodISODate",(e,t)=>{zc.init(e,t),V.init(e,t)}),it=h("ZodISOTime",(e,t)=>{Pc.init(e,t),V.init(e,t)}),st=h("ZodISODuration",(e,t)=>{Ac.init(e,t),V.init(e,t)}),Ui=h("ZodEmail",(e,t)=>{hc.init(e,t),V.init(e,t)});s(Vm,"email");Bi=h("ZodGUID",(e,t)=>{dc.init(e,t),V.init(e,t)});s(Um,"guid");Re=h("ZodUUID",(e,t)=>{mc.init(e,t),V.init(e,t)});s(Bm,"uuid");s(Km,"uuidv4");s(Jm,"uuidv6");s(Gm,"uuidv7");kn=h("ZodURL",(e,t)=>{$c.init(e,t),V.init(e,t)});s(Wm,"url");s(qm,"httpUrl");Ki=h("ZodEmoji",(e,t)=>{bc.init(e,t),V.init(e,t)});s(Hm,"emoji");Ji=h("ZodNanoID",(e,t)=>{wc.init(e,t),V.init(e,t)});s(Xm,"nanoid");Gi=h("ZodCUID",(e,t)=>{vc.init(e,t),V.init(e,t)});s(Ym,"cuid");Wi=h("ZodCUID2",(e,t)=>{_c.init(e,t),V.init(e,t)});s(Qm,"cuid2");qi=h("ZodULID",(e,t)=>{xc.init(e,t),V.init(e,t)});s(eh,"ulid");Hi=h("ZodXID",(e,t)=>{kc.init(e,t),V.init(e,t)});s(th,"xid");Xi=h("ZodKSUID",(e,t)=>{Sc.init(e,t),V.init(e,t)});s(rh,"ksuid");Yi=h("ZodIPv4",(e,t)=>{Oc.init(e,t),V.init(e,t)});s(nh,"ipv4");xf=h("ZodMAC",(e,t)=>{Cc.init(e,t),V.init(e,t)});s(oh,"mac");Qi=h("ZodIPv6",(e,t)=>{Ec.init(e,t),V.init(e,t)});s(ih,"ipv6");es=h("ZodCIDRv4",(e,t)=>{Tc.init(e,t),V.init(e,t)});s(sh,"cidrv4");ts=h("ZodCIDRv6",(e,t)=>{Nc.init(e,t),V.init(e,t)});s(ah,"cidrv6");rs=h("ZodBase64",(e,t)=>{Rc.init(e,t),V.init(e,t)});s(ch,"base64");ns=h("ZodBase64URL",(e,t)=>{Zc.init(e,t),V.init(e,t)});s(uh,"base64url");os=h("ZodE164",(e,t)=>{Dc.init(e,t),V.init(e,t)});s(lh,"e164");kf=h("ZodCreditCard",(e,t)=>{Lc.init(e,t),V.init(e,t)});s(fh,"creditCard");Sf=h("ZodIBAN",(e,t)=>{jc.init(e,t),V.init(e,t)});s(ph,"iban");is=h("ZodJWT",(e,t)=>{Mc.init(e,t),V.init(e,t)});s(dh,"jwt");Et=h("ZodCustomStringFormat",(e,t)=>{Fc.init(e,t),V.init(e,t)});s(mh,"stringFormat");s(hh,"hostname");s(gh,"hex");s(yh,"currencyCode");s($h,"hash");vr=h("ZodNumber",(e,t)=>{Bo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sl(e,r,n,o),e.isFinite=!0},k.derived({minValue:s(e=>{let{minimum:t,exclusiveMinimum:r}=X(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},"minValue"),maxValue:s(e=>{let{maximum:t,exclusiveMaximum:r}=X(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},"maxValue"),isInt:s(e=>{let{isInt:t,multipleOf:r}=X(e);return!!t||!!r?.some(Number.isSafeInteger)},"isInt"),format:s(e=>X(e).format??null,"format")},{gt(e,t){return this.check(Te(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(Ce(e,t))},lte(e,t){return this.check($e(e,t))},max(e,t){return this.check($e(e,t))},int(e){return this.check(Mi(e))},safe(e){return this.check(Mi(e))},positive(e){return this.check(Te(0,e))},nonnegative(e){return this.check(be(0,e))},negative(e){return this.check(Ce(0,e))},nonpositive(e){return this.check($e(0,e))},multipleOf(e,t){return this.check(Ye(e,t))},step(e,t){return this.check(Ye(e,t))},finite(){return this}}));s(If,"number");Ct=h("ZodNumberFormat",(e,t)=>{Vc.init(e,t),vr.init(e,t)});s(Mi,"int");s(bh,"float32");s(wh,"float64");s(vh,"int32");s(_h,"uint32");_r=h("ZodBoolean",(e,t)=>{rn.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Il(e,r,n,o)});s(zf,"boolean");xr=h("ZodBigInt",(e,t)=>{Ko.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zl(e,r,n,o)},k.derived({minValue:s(e=>X(e).minimum??null,"minValue"),maxValue:s(e=>X(e).maximum??null,"maxValue"),format:s(e=>X(e).format??null,"format")},{gte(e,t){return this.check(be(e,t))},min(e,t){return this.check(be(e,t))},gt(e,t){return this.check(Te(e,t))},lt(e,t){return this.check(Ce(e,t))},lte(e,t){return this.check($e(e,t))},max(e,t){return this.check($e(e,t))},positive(e){return this.check(Te(BigInt(0),e))},negative(e){return this.check(Ce(BigInt(0),e))},nonpositive(e){return this.check($e(BigInt(0),e))},nonnegative(e){return this.check(be(BigInt(0),e))},multipleOf(e,t){return this.check(Ye(e,t))}}));s(xh,"bigint");ss=h("ZodBigIntFormat",(e,t)=>{Uc.init(e,t),xr.init(e,t)});s(kh,"int64");s(Sh,"uint64");Pf=h("ZodSymbol",(e,t)=>{Bc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pl(e,r,n,o)});s(Ih,"symbol");Af=h("ZodUndefined",(e,t)=>{Kc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ol(e,r,n,o)});s(zh,"_undefined");Of=h("ZodNull",(e,t)=>{Jc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Al(e,r,n,o)});s(Ef,"_null");Cf=h("ZodAny",(e,t)=>{Gc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tl(e,r,n,o)});s(Ph,"any");Tf=h("ZodUnknown",(e,t)=>{Wc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nl(e,r,n,o)});s(Pt,"unknown");Nf=h("ZodNever",(e,t)=>{qc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cl(e,r,n,o)});s(as,"never");Rf=h("ZodVoid",(e,t)=>{Hc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>El(e,r,n,o)});s(Ah,"_void");Sn=h("ZodDate",(e,t)=>{Xc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rl(e,r,n,o),e.min=(r,n)=>e.check(be(r,n)),e.max=(r,n)=>e.check($e(r,n))},k.derived({minDate:s(e=>{let{minimum:t}=X(e);return t?new Date(t):null},"minDate"),maxDate:s(e=>{let{maximum:t}=X(e);return t?new Date(t):null},"maxDate")},{}));s(Oh,"date");Zf=h("ZodArray",(e,t)=>{Ot(),Yc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gl(e,r,n,o),e.element=t.element},{min(e,t){return this.check(Fe(e,t))},nonempty(e){return this.check(Fe(1,e))},max(e,t){return this.check(St(e,t))},length(e,t){return this.check(It(e,t))},unwrap(){return this.element}});s(In,"array");s(Eh,"keyof");zn=h("ZodObject",(e,t)=>{Ot(),Qc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wl(e,r,n,o),k.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return cs(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(k.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(k.mergeDefs(this._zod.def,{catchall:Pt()}))},loose(){return this.clone(k.mergeDefs(this._zod.def,{catchall:Pt()}))},strict(){return this.clone(k.mergeDefs(this._zod.def,{catchall:as()}))},strip(){return this.clone(k.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return k.extend(this,e)},safeExtend(e){return k.safeExtend(this,e)},merge(e){return k.merge(this,e)},pick(e){return k.pick(this,e)},omit(e){return k.omit(this,e)},partial(...e){return k.partial(An,this,e[0])},exactPartial(...e){return k.partial(ls,this,e[0],"exactPartial")},required(...e){return k.required(fs,this,e[0])}});s(Ch,"object");s(Th,"strictObject");s(Nh,"looseObject");Pn=h("ZodUnion",(e,t)=>{nn.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ti(e,r,n,o),e.options=t.options});s(kr,"union");Df=h("ZodXor",(e,t)=>{Pn.init(e,t),eu.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ti(e,r,n,o),e.options=t.options});s(Rh,"xor");Lf=h("ZodDiscriminatedUnion",(e,t)=>{Pn.init(e,t),ru.init(e,t)});s(Zh,"discriminatedUnion");jf=h("ZodIntersection",(e,t)=>{nu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ql(e,r,n,o)});s(Mf,"intersection");Ff=h("ZodTuple",(e,t)=>{Ot(),Jo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hl(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new An({type:"optional",innerType:t}))})}});s(Vf,"tuple");$r=h("ZodRecord",(e,t)=>{Ot(),ou.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xl(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});s(Uf,"record");s(Dh,"partialRecord");s(Lh,"looseRecord");Bf=h("ZodMap",(e,t)=>{Ot(),iu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kl(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Ne(...r)),e.nonempty=r=>e.check(Ne(1,r)),e.max=(...r)=>e.check(Qe(...r)),e.size=(...r)=>e.check(kt(...r))});s(jh,"map");Kf=h("ZodSet",(e,t)=>{Ot(),su.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jl(e,r,n,o),e.min=(...r)=>e.check(Ne(...r)),e.nonempty=r=>e.check(Ne(1,r)),e.max=(...r)=>e.check(Qe(...r)),e.size=(...r)=>e.check(kt(...r))});s(Mh,"set");br=h("ZodEnum",(e,t)=>{au.init(e,t),T.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Zl(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 a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new br({...t,checks:[],...k.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new br({...t,checks:[],...k.normalizeParams(o),entries:i})}});s(cs,"_enum");s(Fh,"nativeEnum");Jf=h("ZodLiteral",(e,t)=>{cu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dl(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});s(Vh,"literal");Gf=h("ZodFile",(e,t)=>{uu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ml(e,r,n,o),e.min=(r,n)=>e.check(Ne(r,n)),e.max=(r,n)=>e.check(Qe(r,n)),e.mime=(r,n)=>e.check(ur(Array.isArray(r)?r:[r],n))});s(Uh,"file");Wf=h("ZodTransform",(e,t)=>{Ot(),lu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bl(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Xe(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(k.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=r.value),a.inst??(a.inst=e),r.issues.push(k.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});s(us,"transform");An=h("ZodOptional",(e,t)=>{Go.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ni(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(At,"optional");ls=h("ZodExactOptional",(e,t)=>{fu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ni(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(qf,"exactOptional");Hf=h("ZodNullable",(e,t)=>{pu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(xn,"nullable");s(Bh,"nullish");Xf=h("ZodDefault",(e,t)=>{du.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});s(Yf,"_default");Qf=h("ZodPrefault",(e,t)=>{mu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(ep,"prefault");fs=h("ZodNonOptional",(e,t)=>{hu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ql(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(tp,"nonoptional");rp=h("ZodSuccess",(e,t)=>{gu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(Kh,"success");np=h("ZodCatch",(e,t)=>{yu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});s(op,"_catch");ip=h("ZodNaN",(e,t)=>{$u.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ll(e,r,n,o)});s(Jh,"nan");On=h("ZodPipe",(e,t)=>{Wo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>of(e,r,n,o),e.in=t.in,e.out=t.out});s(Fi,"pipe");En=h("ZodCodec",(e,t)=>{On.init(e,t),on.init(e,t)});s(Gh,"codec");s(Wh,"invertCodec");sp=h("ZodPreprocess",(e,t)=>{On.init(e,t),bu.init(e,t)}),ap=h("ZodReadonly",(e,t)=>{wu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(cp,"readonly");up=h("ZodTemplateLiteral",(e,t)=>{vu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jl(e,r,n,o)});s(qh,"templateLiteral");lp=h("ZodLazy",(e,t)=>{sn.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cf(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});s(fp,"lazy");pp=h("ZodPromise",(e,t)=>{xu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>af(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(Hh,"promise");dp=h("ZodFunction",(e,t)=>{_u.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ul(e,r,n,o)});s(Xh,"_function");Cn=h("ZodCustom",(e,t)=>{ku.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vl(e,r,n,o)});s(Yh,"check");s(Qh,"custom");s(mp,"refine");s(hp,"superRefine");eg=yl,tg=$l,gp=h("ZodInstanceOf",(e,t)=>{Cn.init(e,t)},{properties(e,t){return this.check(cr(e,t))}});s(rg,"_instanceof");ng=s((...e)=>bl({Codec:En,Boolean:_r,String:wr},...e),"stringbool");s(og,"json");s(ig,"preprocess")});function S_(e){G({customError:e})}function I_(){return G().customError}var k_,yp,sg=I(()=>{we();k_={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};s(S_,"setErrorMap");s(I_,"getErrorMap");yp||(yp={})});var Tn={};le(Tn,{ZodISODate:()=>ot,ZodISODateTime:()=>nt,ZodISODuration:()=>st,ZodISOTime:()=>it,date:()=>P_,datetime:()=>z_,duration:()=>O_,time:()=>A_});function z_(e){return mn(nt,e)}function P_(e){return hn(ot,e)}function A_(e){return gn(it,e)}function O_(e){return yn(st,e)}var ps=I(()=>{we();at();at();s(z_,"datetime");s(P_,"date");s(A_,"time");s(O_,"duration")});function C_(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function ag(e,t){return e.map((r,n)=>n<t?r:r.optional())}function T_(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function N_(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let o=r[1]===void 0?void 0:T_(r[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}function R_(e,t){return _.transform(n=>n).check(n=>{let o=n.value;if(typeof o!="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties&&n.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&n.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0}),t.keySchema)for(let a of i){let c=t.keySchema.safeParse(a);c.success||n.issues.push({code:"invalid_key",origin:"record",issues:c.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}function $p(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let n=String(e);return`${r[0]}${n.length}:${n}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let a of e){let c=$p(a,t);if(c===null)return null;i.push(c)}return`a${i.length}:[${i.join(",")}]`}let n=Object.keys(e).sort(),o=[];for(let i of n){let a=$p(e[i],t);if(a===null)return null;o.push(`${i.length}:${i}=${a}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}function Nn(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Nn):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>Z_.has(t)?Nn(r):!D_.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(Nn))}function cg(e){return e===1?"element":"elements"}function L_(e,t){return _.transform(n=>n).check(n=>{let o=n.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let a=0;a<o.length;a++){let c=$p(o[a],new Set);if(c===null)continue;let u=i.get(c);if(u===void 0){i.set(c,a);continue}n.issues.push({code:"custom",message:`Array items must be unique: element at index ${a} duplicates the one at index ${u}`,input:o,path:[a],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,a=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,c=0;for(let u of o)if(t.containsSchema.safeParse(u).success&&++c>=a)break;c<i&&n.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${cg(i)}; found ${c}`,input:o,continue:!0}),t.maxContains!==void 0&&c>t.maxContains&&n.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${cg(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function ug(e,t){if(e!==!1)return e===void 0||e===!0?_.any():ae(e,t)}function lg(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return _.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let o=e.$ref;if(t.refs.has(o))return t.refs.get(o);if(t.processing.has(o))return _.lazy(()=>{if(!t.refs.has(o))throw new Error(`Circular reference not resolved: ${o}`);return t.refs.get(o)});t.processing.add(o);let i=N_(o,t),a=ae(i,t);return t.refs.set(o,a),t.processing.delete(o),a}if(e.enum!==void 0){let o=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return _.null();if(o.length===0)return _.never();if(o.length===1)return _.literal(o[0]);if(o.every(a=>typeof a=="string"))return _.enum(o);let i=o.map(a=>_.literal(a));return i.length<2?i[0]:_.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return _.literal(e.const);let r=e.type;if(Array.isArray(r)){let o=r.map(i=>{let a={...e,type:i};return lg(a,t)});return o.length===0?_.never():o.length===1?o[0]:_.union(o)}if(!r)return _.any();let n;switch(r){case"string":{let o=_.string();if(e.format){let i=e.format;i==="email"?o=o.check(_.email()):i==="uri"||i==="uri-reference"?o=o.check(_.url()):i==="uuid"||i==="guid"?o=o.check(_.uuid()):i==="date-time"?o=o.check(_.iso.datetime({offset:!0})):i==="date"?o=o.check(_.iso.date()):i==="time"?o=o.check(_.regex(j_)):i==="duration"?o=o.check(_.iso.duration()):i==="hostname"?o=o.check(_.hostname()):i==="ipv4"?o=o.check(_.ipv4()):i==="ipv6"?o=o.check(_.ipv6()):i==="mac"?o=o.check(_.mac()):i==="cidr"?o=o.check(_.cidrv4()):i==="cidr-v6"?o=o.check(_.cidrv6()):i==="base64"?o=o.check(_.base64()):i==="base64url"?o=o.check(_.base64url()):i==="e164"?o=o.check(_.e164()):i==="credit_card"?o=o.check(_.creditCard()):i==="iban"?o=o.check(_.iban()):i==="jwt"?o=o.check(_.jwt()):i==="emoji"?o=o.check(_.emoji()):i==="nanoid"?o=o.check(_.nanoid()):i==="cuid"?o=o.check(_.cuid()):i==="cuid2"?o=o.check(_.cuid2()):i==="ulid"?o=o.check(_.ulid()):i==="xid"?o=o.check(_.xid()):i==="ksuid"&&(o=o.check(_.ksuid()))}typeof e.minLength=="number"&&(o=o.min(e.minLength)),typeof e.maxLength=="number"&&(o=o.max(e.maxLength)),e.pattern&&(o=o.regex(new RegExp(e.pattern))),n=o;break}case"number":case"integer":{let o=r==="integer"?_.number().int():_.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(o=o.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(o=o.max(e.maximum)),typeof e.exclusiveMinimum=="number"?o=o.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(o=o.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?o=o.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(o=o.lt(e.maximum)),typeof e.multipleOf=="number"&&(o=o.multipleOf(e.multipleOf)),n=o;break}case"boolean":{n=_.boolean();break}case"null":{n=_.null();break}case"object":{let o={},i=e.properties||{},a=new Set(e.required||[]),c=typeof e.additionalProperties=="object"?ae(e.additionalProperties,t):void 0;for(let[p,m]of Object.entries(i)){let d=ae(m,t);Q(o,p,a.has(p)?d:d.optional())}if(e.patternProperties){let p=e.patternProperties,m=Object.keys(p),d=[];for(let $ of m){let w=ae(p[$],t),v=_.string().regex(new RegExp($));d.push(_.looseRecord(v,w))}let g=[];if(Object.keys(o).length>0&&g.push(_.object(o).passthrough()),g.push(...d),g.length===0)n=_.object({}).passthrough();else if(g.length===1)n=g[0];else{let $=_.intersection(g[0],g[1]);for(let w=2;w<g.length;w++)$=_.intersection($,g[w]);n=$}if(e.additionalProperties===!1){let $=Object.keys(o),w=m.map(x=>new RegExp(x)),v=n;n=n.check(x=>{if(!xe(x.value))return;let A=[];for(let R of Object.keys(x.value))$.includes(R)||w.some(L=>L.test(R))||A.push(R);A.length&&x.issues.push({code:"unrecognized_keys",keys:A,input:x.value,inst:v})})}}else{let p=_.object(o);e.additionalProperties===!1?n=p.strict():c?n=p.catchall(c):n=p.passthrough()}let u=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties=="number"?e.minProperties:void 0,f=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(u||l!==void 0||f!==void 0){let p;if(u){let m=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;p=ae(m,t)}n=R_(n,{keySchema:p,minProperties:l,maxProperties:f})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let a=typeof e.minItems=="number"?e.minItems:0,c=o.map(p=>ae(p,t)),u=ag(c,a),l=Array.isArray(i)?void 0:ug(i,t),f=_.tuple(u);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(_.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(_.maxLength(e.maxItems)))}else if(Array.isArray(i)){let a=typeof e.minItems=="number"?e.minItems:0,c=i.map(p=>ae(p,t)),u=ag(c,a),l=ug(e.additionalItems,t),f=_.tuple(u);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(_.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(_.maxLength(e.maxItems)))}else if(i!==void 0){let a=ae(i,t),c=_.array(a);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),n=c}else n=_.array(_.any());(e.uniqueItems===!0||e.contains!==void 0)&&(n=L_(n,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ae(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return n}function ae(e,t){if(typeof e=="boolean")return e?_.any():_.never();let r=lg(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(l=>ae(l,t)),u=_.union(c);r=n?_.intersection(r,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(l=>ae(l,t)),u=_.xor(c);r=n?_.intersection(r,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:_.any();else{let c=n?r:ae(e.allOf[0],t),u=n?0:1;for(let l=u;l<e.allOf.length;l++)c=_.intersection(c,ae(e.allOf[l],t));r=c}e.nullable===!0&&t.version==="openapi-3.0"&&(r=_.nullable(r)),e.readOnly===!0&&(r=_.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of i)c in e&&(o[c]=e[c]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let c of a)c in e&&(o[c]=e[c]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Nn(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let c of["minProperties","maxProperties"])e[c]!==void 0&&(o[c]=e[c])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Nn(e.contains)&&(o.contains=e.contains);for(let c of["uniqueItems","minContains","maxContains"])e[c]!==void 0&&(o[c]=e[c])}for(let c of Object.keys(e))E_.has(c)||Q(o,c,e[c]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}function fg(e,t){if(typeof e=="boolean")return e?_.any():_.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=C_(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??ee};return ae(r,i)}var _,E_,Z_,D_,j_,pg=I(()=>{pn();q();Li();ps();at();_={...Sr,...Di,iso:Tn},E_=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);s(C_,"detectVersion");s(ag,"applyMinItems");s(T_,"decodeJSONPointerSegment");s(N_,"resolveRef");s(R_,"checkObjectGuards");s($p,"canonicalKey");Z_=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),D_=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);s(Nn,"containsRef");s(cg,"plural");s(L_,"checkArrayGuards");s(ug,"getTupleRest");j_=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;s(lg,"convertBaseSchema");s(ae,"convertSchema");s(fg,"fromJSONSchema")});function Rn(e,t){let r=typeof t=="function"?t:(a,c)=>{let u=t[a._zod.def.type];return u?u(a,c):a},n=new Map;function o(a){let c=n.get(a);if(c===dg)return new sn({type:"lazy",getter:s(()=>n.get(a),"getter")});if(c!==void 0)return c;n.set(a,dg);let u=i(a),l=r(u,u!==a);return n.set(a,l),l}s(o,"run");function i(a){let c=a._zod.def,u=c.type;switch(u){case"object":{let l=c.shape,f=Object.keys(l),p=!1,m={};for(let g of f){let $=o(l[g]);$!==l[g]&&(p=!0),m[g]=$}let d=c.catchall;return c.catchall&&(d=o(c.catchall),d!==c.catchall&&(p=!0)),p?j(a,{...c,shape:m,catchall:d}):a}case"array":{let l=o(c.element);return l===c.element?a:j(a,{...c,element:l})}case"tuple":{let l=c.items,f=!1,p=[];for(let d of l){let g=o(d);g!==d&&(f=!0),p.push(g)}let m=c.rest;return c.rest&&(m=o(c.rest),m!==c.rest&&(f=!0)),f?j(a,{...c,items:p,rest:m}):a}case"record":case"map":{let l=o(c.keyType),f=o(c.valueType);return l===c.keyType&&f===c.valueType?a:j(a,{...c,keyType:l,valueType:f})}case"set":{let l=o(c.valueType);return l===c.valueType?a:j(a,{...c,valueType:l})}case"union":{let l=c.options,f=!1,p=[];for(let m of l){let d=o(m);d!==m&&(f=!0),p.push(d)}return f?j(a,{...c,options:p}):a}case"intersection":{let l=o(c.left),f=o(c.right);return l===c.left&&f===c.right?a:j(a,{...c,left:l,right:f})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=o(c.innerType);return l===c.innerType?a:j(a,{...c,innerType:l})}case"pipe":{let l=o(c.in),f=o(c.out);return l===c.in&&f===c.out?a:j(a,{...c,in:l,out:f})}case"function":{let l=o(c.input),f=o(c.output);return l===c.input&&f===c.output?a:j(a,{...c,input:l,output:f})}case"lazy":{let l=c.getter,{_cachedInner:f,...p}=c;return j(a,{...p,getter:s(()=>o(l()),"getter")})}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":return a;default:return a}}return s(i,"mapInner"),o(e)}var dg,bp=I(()=>{Qt();q();dg=Symbol("z.visit/resolving");s(Rn,"visit")});function mg(e){return Rn(e,{object:s(t=>t.partial(),"object"),union:s(t=>{let r=t._zod.def;return r.discriminator===void 0?t:kr(r.options)},"union")})}var hg=I(()=>{bp();at();s(mg,"deepPartial")});function M_(e,t){if(!t?.length)return e;let r=e._zod.def;return j(e,Ie(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function gg(e){return M_(e.out,e.checks)}function F_(e){return e.in._zod.traits.has("$ZodTransform")?gg(e):e.in}function yg(e){return Rn(e,{pipe:s(t=>F_(t._zod.def),"pipe"),default:s((t,r)=>r?At(t._zod.def.innerType):t,"default"),catch:s((t,r)=>r?t._zod.def.innerType:t,"catch")})}function $g(e){return Rn(e,{pipe:s(t=>gg(t._zod.def),"pipe"),prefault:s((t,r)=>r?t._zod.def.innerType:t,"prefault")})}var bg=I(()=>{q();bp();at();s(M_,"withChecks");s(gg,"outSide");s(F_,"inSide");s(yg,"input");s($g,"output")});var wp={};le(wp,{bigint:()=>K_,boolean:()=>B_,date:()=>J_,number:()=>U_,string:()=>V_});function V_(e){return Lu(wr,e)}function U_(e){return Bu(vr,e)}function B_(e){return Xu(_r,e)}function K_(e){return Qu(xr,e)}function J_(e){return ll(Sn,e)}var wg=I(()=>{we();at();s(V_,"string");s(U_,"number");s(B_,"boolean");s(K_,"bigint");s(J_,"date")});var y={};le(y,{$brand:()=>ea,$input:()=>Eu,$output:()=>Ou,INVALID:()=>ie,NEVER:()=>Qs,TimePrecision:()=>Vu,ZodAny:()=>Cf,ZodArray:()=>Zf,ZodBase64:()=>rs,ZodBase64URL:()=>ns,ZodBigInt:()=>xr,ZodBigIntFormat:()=>ss,ZodBoolean:()=>_r,ZodCIDRv4:()=>es,ZodCIDRv6:()=>ts,ZodCUID:()=>Gi,ZodCUID2:()=>Wi,ZodCatch:()=>np,ZodCodec:()=>En,ZodCompileAsyncError:()=>ze,ZodCompileUnsupportedError:()=>D,ZodCreditCard:()=>kf,ZodCustom:()=>Cn,ZodCustomStringFormat:()=>Et,ZodDate:()=>Sn,ZodDefault:()=>Xf,ZodDiscriminatedUnion:()=>Lf,ZodE164:()=>os,ZodEmail:()=>Ui,ZodEmoji:()=>Ki,ZodEnum:()=>br,ZodError:()=>v_,ZodExactOptional:()=>ls,ZodFile:()=>Gf,ZodFirstPartyTypeKind:()=>yp,ZodFunction:()=>dp,ZodGUID:()=>Bi,ZodIBAN:()=>Sf,ZodIPv4:()=>Yi,ZodIPv6:()=>Qi,ZodISODate:()=>ot,ZodISODateTime:()=>nt,ZodISODuration:()=>st,ZodISOTime:()=>it,ZodInstanceOf:()=>gp,ZodIntersection:()=>jf,ZodIssueCode:()=>k_,ZodJWT:()=>is,ZodKSUID:()=>Xi,ZodLazy:()=>lp,ZodLiteral:()=>Jf,ZodMAC:()=>xf,ZodMap:()=>Bf,ZodNaN:()=>ip,ZodNanoID:()=>Ji,ZodNever:()=>Nf,ZodNonOptional:()=>fs,ZodNull:()=>Of,ZodNullable:()=>Hf,ZodNumber:()=>vr,ZodNumberFormat:()=>Ct,ZodObject:()=>zn,ZodOptional:()=>An,ZodPipe:()=>On,ZodPrefault:()=>Qf,ZodPreprocess:()=>sp,ZodPromise:()=>pp,ZodReadonly:()=>ap,ZodRealError:()=>he,ZodRecord:()=>$r,ZodSet:()=>Kf,ZodString:()=>wr,ZodStringFormat:()=>V,ZodSuccess:()=>rp,ZodSymbol:()=>Pf,ZodTemplateLiteral:()=>up,ZodTransform:()=>Wf,ZodTuple:()=>Ff,ZodType:()=>T,ZodULID:()=>qi,ZodURL:()=>kn,ZodUUID:()=>Re,ZodUndefined:()=>Af,ZodUnion:()=>Pn,ZodUnknown:()=>Tf,ZodVoid:()=>Rf,ZodXID:()=>Hi,ZodXor:()=>Df,_ZodString:()=>Vi,_default:()=>Yf,_function:()=>Xh,any:()=>Ph,array:()=>In,base64:()=>ch,base64url:()=>uh,bigint:()=>xh,boolean:()=>zf,catch:()=>op,check:()=>Yh,cidrv4:()=>sh,cidrv6:()=>ah,clone:()=>j,codec:()=>Gh,coerce:()=>wp,compile:()=>Ru,config:()=>G,core:()=>Ve,creditCard:()=>fh,cuid:()=>Ym,cuid2:()=>Qm,currencyCode:()=>yh,custom:()=>Qh,date:()=>Oh,decode:()=>hf,decodeAsync:()=>yf,deepPartial:()=>mg,describe:()=>eg,discriminatedUnion:()=>Zh,e164:()=>lh,email:()=>Vm,emoji:()=>Hm,encode:()=>mf,encodeAsync:()=>gf,endsWith:()=>ar,enum:()=>cs,exactOptional:()=>qf,file:()=>Uh,flattenError:()=>Ur,float32:()=>bh,float64:()=>wh,formatError:()=>Br,fromJSONSchema:()=>fg,function:()=>Xh,getDiscriminatedOption:()=>tu,getErrorMap:()=>I_,globalRegistry:()=>ee,gt:()=>Te,gte:()=>be,guid:()=>Um,hash:()=>$h,hex:()=>gh,hostname:()=>hh,httpUrl:()=>qm,iban:()=>ph,includes:()=>ir,input:()=>yg,instanceof:()=>rg,int:()=>Mi,int32:()=>vh,int64:()=>kh,intersection:()=>Mf,invertCodec:()=>Wh,ipv4:()=>nh,ipv6:()=>ih,iso:()=>Tn,json:()=>og,jwt:()=>dh,keyof:()=>Eh,ksuid:()=>rh,lazy:()=>fp,length:()=>It,literal:()=>Vh,locales:()=>fn,looseObject:()=>Nh,looseRecord:()=>Lh,lowercase:()=>nr,lt:()=>Ce,lte:()=>$e,mac:()=>oh,map:()=>jh,maxLength:()=>St,maxSize:()=>Qe,memoizer:()=>un,meta:()=>tg,mime:()=>ur,minLength:()=>Fe,minSize:()=>Ne,multipleOf:()=>Ye,nan:()=>Jh,nanoid:()=>Xm,nativeEnum:()=>Fh,negative:()=>Pi,never:()=>as,nonnegative:()=>Oi,nonoptional:()=>tp,nonpositive:()=>Ai,normalize:()=>lr,null:()=>Ef,nullable:()=>xn,nullish:()=>Bh,number:()=>If,object:()=>Ch,optional:()=>At,output:()=>$g,overwrite:()=>Pe,parse:()=>lf,parseAsync:()=>ff,partialRecord:()=>Dh,pipe:()=>Fi,positive:()=>zi,prefault:()=>ep,preprocess:()=>ig,prettifyError:()=>ia,promise:()=>Hh,properties:()=>cr,property:()=>Ei,readonly:()=>cp,record:()=>Uf,refine:()=>mp,regex:()=>rr,regexes:()=>Se,registry:()=>ri,safeDecode:()=>bf,safeDecodeAsync:()=>vf,safeEncode:()=>$f,safeEncodeAsync:()=>wf,safeParse:()=>pf,safeParseAsync:()=>df,set:()=>Mh,setErrorMap:()=>S_,size:()=>kt,slugify:()=>mr,startsWith:()=>sr,strictObject:()=>Th,string:()=>_n,stringFormat:()=>mh,stringbool:()=>ng,success:()=>Kh,superRefine:()=>hp,symbol:()=>Ih,templateLiteral:()=>qh,toJSONSchema:()=>Ri,toLowerCase:()=>pr,toUpperCase:()=>dr,toZod:()=>Nr,transform:()=>us,treeifyError:()=>oa,trim:()=>fr,tuple:()=>Vf,uint32:()=>_h,uint64:()=>Sh,ulid:()=>eh,undefined:()=>zh,union:()=>kr,unknown:()=>Pt,uppercase:()=>or,url:()=>Wm,util:()=>k,uuid:()=>Bm,uuidv4:()=>Km,uuidv6:()=>Jm,uuidv7:()=>Gm,validate:()=>Kr,validateAsync:()=>Jr,void:()=>Ah,withParser:()=>ni,xid:()=>th,xor:()=>Rh});var vp=I(()=>{we();at();Li();uf();_f();sg();we();vn();pg();hg();bg();Au();ps();ps();wg()});var Ue=I(()=>{vp();vp()});function vg(e){return e==="exception"?"operation":e==="transport-unavailable"?"transport":e==="manager-receipt-unavailable"?"compatibility":null}function ds(e,t,r=Date.now){let n=Zn.safeParse(e),o=s((i,a,c=null)=>{if(n.success)try{let u=Dn.safeParse({attempt:n.data,step:i,observedAt:r(),code:c,errorClass:vg(a),reason:a});u.success&&t(u.data)}catch{}},"observe");return{observe:o,async run(i,a,c=()=>0){o(i,"started");try{let u=await a();try{o(i,"returned",c(u))}catch{}return u}catch(u){throw o(i,"exception"),u}}}}function _g(e,t){let r="";return n=>{for(let o of n.split(/(?<=\n)/))if(r+=o,r.length>1024&&(r="discarded"),!!o.endsWith(`
|
|
69
|
-
`)){if(r.startsWith(Ir))try{let i=Dn.safeParse(JSON.parse(r.slice(Ir.length)));i.success&&i.data.attempt===e&&t(i.data)}catch{}r=""}}}var Zn,G_,Dn,Ir,Ln=I(()=>{"use strict";Ue();Zn=y.uuid(),G_=y.enum(["managed-source","work-drain","policy-apply","activation-completion","installation-pin-readback"]),Dn=y.object({attempt:Zn,step:G_,observedAt:y.number().int().min(0).max(864e13),errorClass:y.enum(["operation","transport","compatibility"]).nullable(),code:y.number().int().min(-2147483648).max(2147483647).nullable(),reason:y.enum(["started","returned","exception","transport-unavailable","manager-receipt-unavailable"])}).strict().refine(e=>e.reason==="returned"?e.code!==null:e.code===null).refine(e=>e.errorClass===vg(e.reason)),Ir="ORBIT_INSTALLER_RECEIPT_V1 ";s(vg,"installerErrorClass");s(ds,"installerObserver");s(_g,"installerReceiptStream")});var zg=ye((GI,Ig)=>{Ig.exports=Sg;Sg.sync=q_;var xg=Ge("fs");function W_(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o)return!0}return!1}s(W_,"checkPathExt");function kg(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:W_(t,r)}s(kg,"checkStat");function Sg(e,t,r){xg.stat(e,function(n,o){r(n,n?!1:kg(o,e,t))})}s(Sg,"isexe");function q_(e,t){return kg(xg.statSync(e),e,t)}s(q_,"sync")});var Cg=ye((qI,Eg)=>{Eg.exports=Ag;Ag.sync=H_;var Pg=Ge("fs");function Ag(e,t,r){Pg.stat(e,function(n,o){r(n,n?!1:Og(o,t))})}s(Ag,"isexe");function H_(e,t){return Og(Pg.statSync(e),t)}s(H_,"sync");function Og(e,t){return e.isFile()&&X_(e,t)}s(Og,"checkStat");function X_(e,t){var r=e.mode,n=e.uid,o=e.gid,i=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),a=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),c=parseInt("100",8),u=parseInt("010",8),l=parseInt("001",8),f=c|u,p=r&l||r&u&&o===a||r&c&&n===i||r&f&&i===0;return p}s(X_,"checkMode")});var Ng=ye((YI,Tg)=>{var XI=Ge("fs"),ms;process.platform==="win32"||global.TESTING_WINDOWS?ms=zg():ms=Cg();Tg.exports=_p;_p.sync=Y_;function _p(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){_p(e,t||{},function(i,a){i?o(i):n(a)})})}ms(e,t||{},function(n,o){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}s(_p,"isexe");function Y_(e,t){try{return ms.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}s(Y_,"sync")});var Fg=ye((ez,Mg)=>{var zr=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Rg=Ge("path"),Q_=zr?";":":",Zg=Ng(),Dg=s(e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),"getNotFoundError"),Lg=s((e,t)=>{let r=t.colon||Q_,n=e.match(/\//)||zr&&e.match(/\\/)?[""]:[...zr?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=zr?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=zr?o.split(r):[""];return zr&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},"getPathInfo"),jg=s((e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,pathExtExe:i}=Lg(e,t),a=[],c=s(l=>new Promise((f,p)=>{if(l===n.length)return t.all&&a.length?f(a):p(Dg(e));let m=n[l],d=/^".*"$/.test(m)?m.slice(1,-1):m,g=Rg.join(d,e),$=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;f(u($,l,0))}),"step"),u=s((l,f,p)=>new Promise((m,d)=>{if(p===o.length)return m(c(f+1));let g=o[p];Zg(l+g,{pathExt:i},($,w)=>{if(!$&&w)if(t.all)a.push(l+g);else return m(l+g);return m(u(l,f,p+1))})}),"subStep");return r?c(0).then(l=>r(null,l),r):c(0)},"which"),ex=s((e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=Lg(e,t),i=[];for(let a=0;a<r.length;a++){let c=r[a],u=/^".*"$/.test(c)?c.slice(1,-1):c,l=Rg.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let p=0;p<n.length;p++){let m=f+n[p];try{if(Zg.sync(m,{pathExt:o}))if(t.all)i.push(m);else return m}catch{}}}if(t.all&&i.length)return i;if(t.nothrow)return null;throw Dg(e)},"whichSync");Mg.exports=jg;jg.sync=ex});var Ug=ye((rz,xp)=>{"use strict";var Vg=s((e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"},"pathKey");xp.exports=Vg;xp.exports.default=Vg});var Gg=ye((oz,Jg)=>{"use strict";var Bg=Ge("path"),tx=Fg(),rx=Ug();function Kg(e,t){let r=e.options.env||process.env,n=process.cwd(),o=e.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(e.options.cwd)}catch{}let a;try{a=tx.sync(e.command,{path:r[rx({env:r})],pathExt:t?Bg.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return a&&(a=Bg.resolve(o?e.options.cwd:"",a)),a}s(Kg,"resolveCommandAttempt");function nx(e){return Kg(e)||Kg(e,!0)}s(nx,"resolveCommand");Jg.exports=nx});var Wg=ye((sz,Sp)=>{"use strict";var kp=/([()\][%!^"`<>&|;, *?])/g;function ox(e){return e=e.replace(kp,"^$1"),e}s(ox,"escapeCommand");function ix(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(kp,"^$1"),t&&(e=e.replace(kp,"^$1")),e}s(ix,"escapeArgument");Sp.exports.command=ox;Sp.exports.argument=ix});var Hg=ye((cz,qg)=>{"use strict";qg.exports=/^#!(.*)/});var Yg=ye((uz,Xg)=>{"use strict";var sx=Hg();Xg.exports=(e="")=>{let t=e.match(sx);if(!t)return null;let[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var ey=ye((lz,Qg)=>{"use strict";var Ip=Ge("fs"),ax=Yg();function cx(e){let r=Buffer.alloc(150),n;try{n=Ip.openSync(e,"r"),Ip.readSync(n,r,0,150,0),Ip.closeSync(n)}catch{}return ax(r.toString())}s(cx,"readShebang");Qg.exports=cx});var oy=ye((pz,ny)=>{"use strict";var ux=Ge("path"),ty=Gg(),ry=Wg(),lx=ey(),fx=process.platform==="win32",px=/\.(?:com|exe)$/i,dx=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function mx(e){e.file=ty(e);let t=e.file&&lx(e.file);return t?(e.args.unshift(e.file),e.command=t,ty(e)):e.file}s(mx,"detectShebang");function hx(e){if(!fx)return e;let t=mx(e),r=!px.test(t);if(e.options.forceShell||r){let n=dx.test(t);e.command=ux.normalize(e.command),e.command=ry.command(e.command),e.args=e.args.map(i=>ry.argument(i,n));let o=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}s(hx,"parseNonShell");function gx(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:hx(n)}s(gx,"parse");ny.exports=gx});var ay=ye((mz,sy)=>{"use strict";var zp=process.platform==="win32";function Pp(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}s(Pp,"notFoundError");function yx(e,t){if(!zp)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=iy(o,t);if(i)return r.call(e,"error",i)}return r.apply(e,arguments)}}s(yx,"hookChildProcess");function iy(e,t){return zp&&e===1&&!t.file?Pp(t.original,"spawn"):null}s(iy,"verifyENOENT");function $x(e,t){return zp&&e===1&&!t.file?Pp(t.original,"spawnSync"):null}s($x,"verifyENOENTSync");sy.exports={hookChildProcess:yx,verifyENOENT:iy,verifyENOENTSync:$x,notFoundError:Pp}});var ly=ye((gz,Pr)=>{"use strict";var cy=Ge("child_process"),Ap=oy(),Op=ay();function uy(e,t,r){let n=Ap(e,t,r),o=cy.spawn(n.command,n.args,n.options);return Op.hookChildProcess(o,n),o}s(uy,"spawn");function bx(e,t,r){let n=Ap(e,t,r),o=cy.spawnSync(n.command,n.args,n.options);return o.error=o.error||Op.verifyENOENTSync(o.status,n),o}s(bx,"spawnSync");Pr.exports=uy;Pr.exports.spawn=uy;Pr.exports.sync=bx;Pr.exports._parse=Ap;Pr.exports._enoent=Op});import{statSync as ck}from"node:fs";function gs(e){try{return ck(e),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}}var Ty=I(()=>{"use strict";s(gs,"filePresent")});function uk(e,t){let r=e.slice(0,t).split(/\r?\n/);return[r.length,r.pop().length+1]}function lk(e,t,r){let n=e.split(/\r?\n/),o="",i=(Math.log10(t+1)|0)+1;for(let a=t-1;a<=t+1;a++){let c=n[a-1];c&&(o+=a.toString().padEnd(i," "),o+=": ",o+=c,o+=`
|
|
69
|
+
`)){if(r.startsWith(Ir))try{let i=Dn.safeParse(JSON.parse(r.slice(Ir.length)));i.success&&i.data.attempt===e&&t(i.data)}catch{}r=""}}}var Zn,G_,Dn,Ir,Ln=I(()=>{"use strict";Ue();Zn=y.uuid(),G_=y.enum(["managed-source","work-drain","policy-apply","snapshot-restore","activation-completion","installation-pin-readback"]),Dn=y.object({attempt:Zn,step:G_,observedAt:y.number().int().min(0).max(864e13),errorClass:y.enum(["operation","transport","compatibility"]).nullable(),code:y.number().int().min(-2147483648).max(2147483647).nullable(),reason:y.enum(["started","returned","exception","transport-unavailable","manager-receipt-unavailable"])}).strict().refine(e=>e.reason==="returned"?e.code!==null:e.code===null).refine(e=>e.errorClass===vg(e.reason)),Ir="ORBIT_INSTALLER_RECEIPT_V1 ";s(vg,"installerErrorClass");s(ds,"installerObserver");s(_g,"installerReceiptStream")});var zg=ye((GI,Ig)=>{Ig.exports=Sg;Sg.sync=q_;var xg=Ge("fs");function W_(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o)return!0}return!1}s(W_,"checkPathExt");function kg(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:W_(t,r)}s(kg,"checkStat");function Sg(e,t,r){xg.stat(e,function(n,o){r(n,n?!1:kg(o,e,t))})}s(Sg,"isexe");function q_(e,t){return kg(xg.statSync(e),e,t)}s(q_,"sync")});var Cg=ye((qI,Eg)=>{Eg.exports=Ag;Ag.sync=H_;var Pg=Ge("fs");function Ag(e,t,r){Pg.stat(e,function(n,o){r(n,n?!1:Og(o,t))})}s(Ag,"isexe");function H_(e,t){return Og(Pg.statSync(e),t)}s(H_,"sync");function Og(e,t){return e.isFile()&&X_(e,t)}s(Og,"checkStat");function X_(e,t){var r=e.mode,n=e.uid,o=e.gid,i=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),a=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),c=parseInt("100",8),u=parseInt("010",8),l=parseInt("001",8),f=c|u,p=r&l||r&u&&o===a||r&c&&n===i||r&f&&i===0;return p}s(X_,"checkMode")});var Ng=ye((YI,Tg)=>{var XI=Ge("fs"),ms;process.platform==="win32"||global.TESTING_WINDOWS?ms=zg():ms=Cg();Tg.exports=_p;_p.sync=Y_;function _p(e,t,r){if(typeof t=="function"&&(r=t,t={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){_p(e,t||{},function(i,a){i?o(i):n(a)})})}ms(e,t||{},function(n,o){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}s(_p,"isexe");function Y_(e,t){try{return ms.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}s(Y_,"sync")});var Fg=ye((ez,Mg)=>{var zr=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Rg=Ge("path"),Q_=zr?";":":",Zg=Ng(),Dg=s(e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),"getNotFoundError"),Lg=s((e,t)=>{let r=t.colon||Q_,n=e.match(/\//)||zr&&e.match(/\\/)?[""]:[...zr?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=zr?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=zr?o.split(r):[""];return zr&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},"getPathInfo"),jg=s((e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,pathExtExe:i}=Lg(e,t),a=[],c=s(l=>new Promise((f,p)=>{if(l===n.length)return t.all&&a.length?f(a):p(Dg(e));let m=n[l],d=/^".*"$/.test(m)?m.slice(1,-1):m,g=Rg.join(d,e),$=!d&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;f(u($,l,0))}),"step"),u=s((l,f,p)=>new Promise((m,d)=>{if(p===o.length)return m(c(f+1));let g=o[p];Zg(l+g,{pathExt:i},($,w)=>{if(!$&&w)if(t.all)a.push(l+g);else return m(l+g);return m(u(l,f,p+1))})}),"subStep");return r?c(0).then(l=>r(null,l),r):c(0)},"which"),ex=s((e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=Lg(e,t),i=[];for(let a=0;a<r.length;a++){let c=r[a],u=/^".*"$/.test(c)?c.slice(1,-1):c,l=Rg.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let p=0;p<n.length;p++){let m=f+n[p];try{if(Zg.sync(m,{pathExt:o}))if(t.all)i.push(m);else return m}catch{}}}if(t.all&&i.length)return i;if(t.nothrow)return null;throw Dg(e)},"whichSync");Mg.exports=jg;jg.sync=ex});var Ug=ye((rz,xp)=>{"use strict";var Vg=s((e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"},"pathKey");xp.exports=Vg;xp.exports.default=Vg});var Gg=ye((oz,Jg)=>{"use strict";var Bg=Ge("path"),tx=Fg(),rx=Ug();function Kg(e,t){let r=e.options.env||process.env,n=process.cwd(),o=e.options.cwd!=null,i=o&&process.chdir!==void 0&&!process.chdir.disabled;if(i)try{process.chdir(e.options.cwd)}catch{}let a;try{a=tx.sync(e.command,{path:r[rx({env:r})],pathExt:t?Bg.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return a&&(a=Bg.resolve(o?e.options.cwd:"",a)),a}s(Kg,"resolveCommandAttempt");function nx(e){return Kg(e)||Kg(e,!0)}s(nx,"resolveCommand");Jg.exports=nx});var Wg=ye((sz,Sp)=>{"use strict";var kp=/([()\][%!^"`<>&|;, *?])/g;function ox(e){return e=e.replace(kp,"^$1"),e}s(ox,"escapeCommand");function ix(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(kp,"^$1"),t&&(e=e.replace(kp,"^$1")),e}s(ix,"escapeArgument");Sp.exports.command=ox;Sp.exports.argument=ix});var Hg=ye((cz,qg)=>{"use strict";qg.exports=/^#!(.*)/});var Yg=ye((uz,Xg)=>{"use strict";var sx=Hg();Xg.exports=(e="")=>{let t=e.match(sx);if(!t)return null;let[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var ey=ye((lz,Qg)=>{"use strict";var Ip=Ge("fs"),ax=Yg();function cx(e){let r=Buffer.alloc(150),n;try{n=Ip.openSync(e,"r"),Ip.readSync(n,r,0,150,0),Ip.closeSync(n)}catch{}return ax(r.toString())}s(cx,"readShebang");Qg.exports=cx});var oy=ye((pz,ny)=>{"use strict";var ux=Ge("path"),ty=Gg(),ry=Wg(),lx=ey(),fx=process.platform==="win32",px=/\.(?:com|exe)$/i,dx=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function mx(e){e.file=ty(e);let t=e.file&&lx(e.file);return t?(e.args.unshift(e.file),e.command=t,ty(e)):e.file}s(mx,"detectShebang");function hx(e){if(!fx)return e;let t=mx(e),r=!px.test(t);if(e.options.forceShell||r){let n=dx.test(t);e.command=ux.normalize(e.command),e.command=ry.command(e.command),e.args=e.args.map(i=>ry.argument(i,n));let o=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${o}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}s(hx,"parseNonShell");function gx(e,t,r){t&&!Array.isArray(t)&&(r=t,t=null),t=t?t.slice(0):[],r=Object.assign({},r);let n={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?n:hx(n)}s(gx,"parse");ny.exports=gx});var ay=ye((mz,sy)=>{"use strict";var zp=process.platform==="win32";function Pp(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}s(Pp,"notFoundError");function yx(e,t){if(!zp)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=iy(o,t);if(i)return r.call(e,"error",i)}return r.apply(e,arguments)}}s(yx,"hookChildProcess");function iy(e,t){return zp&&e===1&&!t.file?Pp(t.original,"spawn"):null}s(iy,"verifyENOENT");function $x(e,t){return zp&&e===1&&!t.file?Pp(t.original,"spawnSync"):null}s($x,"verifyENOENTSync");sy.exports={hookChildProcess:yx,verifyENOENT:iy,verifyENOENTSync:$x,notFoundError:Pp}});var ly=ye((gz,Pr)=>{"use strict";var cy=Ge("child_process"),Ap=oy(),Op=ay();function uy(e,t,r){let n=Ap(e,t,r),o=cy.spawn(n.command,n.args,n.options);return Op.hookChildProcess(o,n),o}s(uy,"spawn");function bx(e,t,r){let n=Ap(e,t,r),o=cy.spawnSync(n.command,n.args,n.options);return o.error=o.error||Op.verifyENOENTSync(o.status,n),o}s(bx,"spawnSync");Pr.exports=uy;Pr.exports.spawn=uy;Pr.exports.sync=bx;Pr.exports._parse=Ap;Pr.exports._enoent=Op});import{statSync as ck}from"node:fs";function gs(e){try{return ck(e),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}}var Ty=I(()=>{"use strict";s(gs,"filePresent")});function uk(e,t){let r=e.slice(0,t).split(/\r?\n/);return[r.length,r.pop().length+1]}function lk(e,t,r){let n=e.split(/\r?\n/),o="",i=(Math.log10(t+1)|0)+1;for(let a=t-1;a<=t+1;a++){let c=n[a-1];c&&(o+=a.toString().padEnd(i," "),o+=": ",o+=c,o+=`
|
|
70
70
|
`,a===t&&(o+=" ".repeat(i+r+2),o+=`^
|
|
71
71
|
`))}return o}var E,Tt=I(()=>{s(uk,"getLineColFromPtr");s(lk,"makeCodeBlock");E=class e extends Error{static{s(this,"TomlError")}line;column;codeblock;constructor(t,r){let[n,o]=uk(r.toml,r.ptr),i=lk(r.toml,n,o);super(`Invalid TOML document: ${t}
|
|
72
72
|
|
|
@@ -208,7 +208,7 @@ passwd -l "$n" >/dev/null`}]}}function Nk(e){return o$(e)}function Be(e){return[
|
|
|
208
208
|
`)})});async function c$(e,t){let r=await e.exec(t.probe);if(r.code!==0)throw new z(`${t.id}: probe failed: ${r.stderr.trim()}`);return t.plan(s$(r.stdout))}function Zk(e){return ce(e).trim().split(`
|
|
209
209
|
`).map(t=>` ${t}`).join(`
|
|
210
210
|
`)}async function Ke(e,t,r){W.log(`${e.name} (${e.host})${r?": dry run":""}`);let n=0;for(let i of t){let a=await c$(e,i);if(a.length===0){W.log(` \u2713 ${i.id}${i.id.startsWith("script ")?": skip (applied)":""}`);continue}n++;for(let u of a)W.log(ce(` \u2192 ${i.id}: ${u}`));if(r)continue;for(let u of i.apply){let l=await e.exec(u);if(l.code!==0)return W.log(` \u2717 ${i.id} failed
|
|
211
|
-
${Zk(l.stderr||l.stdout)}`),1}let c=await c$(e,i);if(c.length>0)return W.log(` \u2717 ${i.id}: applied, but still differs: ${ce(c.join("; "))}`),1;W.log(` \u2713 ${i.id}`)}let o=t.length-n;return n===0?W.log("Nothing to change."):r?W.log(`${n} to change, ${o} already done. Run without --dry-run to apply.`):W.log(`Applied ${n}, ${o} already done.`),0}var Ss=I(()=>{"use strict";a$();Ee();Ee();De();Ze();s(c$,"probe");s(Zk,"indent");s(Ke,"applySteps")});var h$={};le(h$,{BASE_IMAGE:()=>ct,SHARE_EDIT:()=>Hp,buildLinux:()=>Fk,cloudInit:()=>f$,ensureLibvirtStation:()=>d$,libvirtInfo:()=>l$,onServer:()=>Je,pinLease:()=>m$,serverName:()=>Is});import{readFile as Dk}from"node:fs/promises";function u$(e){if(!e.hypervisor)throw new z(`${e.name}: a libvirt station needs \`hypervisor\` (user@server) or \`server\` (a host in moonlet/config/servers/)`);return e.hypervisor}function Is(e){return e.server??u$(e)}async function Je(e,t,r=""){return e.server?Wn(await Gn(e),t,r):ge("ssh",["-o","BatchMode=yes","-o","ConnectTimeout=10",u$(e),`bash -c ${S(t)}`],r)}async function l$(e){let t=await Je(e,`n=${S(e.name)}
|
|
211
|
+
${Zk(l.stderr||l.stdout)}`),1}let c=await c$(e,i);if(c.length>0)return W.log(` \u2717 ${i.id}: applied, but still differs: ${ce(c.join("; "))}`),1;W.log(` \u2713 ${i.id}`)}let o=t.length-n;return n===0?W.log("Nothing to change."):r?W.log(`${n} to change, ${o} already done. Run without --dry-run to apply.`):W.log(`Applied ${n}, ${o} already done.`),0}var Ss=I(()=>{"use strict";a$();Ee();Ee();De();Ze();s(c$,"probe");s(Zk,"indent");s(Ke,"applySteps")});var h$={};le(h$,{BASE_IMAGE:()=>ct,SHARE_EDIT:()=>Hp,VIRSH:()=>K,buildLinux:()=>Fk,cloudInit:()=>f$,ensureLibvirtStation:()=>d$,libvirtInfo:()=>l$,onServer:()=>Je,pinLease:()=>m$,serverName:()=>Is});import{readFile as Dk}from"node:fs/promises";function u$(e){if(!e.hypervisor)throw new z(`${e.name}: a libvirt station needs \`hypervisor\` (user@server) or \`server\` (a host in moonlet/config/servers/)`);return e.hypervisor}function Is(e){return e.server??u$(e)}async function Je(e,t,r=""){return e.server?Wn(await Gn(e),t,r):ge("ssh",["-o","BatchMode=yes","-o","ConnectTimeout=10",u$(e),`bash -c ${S(t)}`],r)}async function l$(e){let t=await Je(e,`n=${S(e.name)}
|
|
212
212
|
state=$(${K} domstate "$n" 2>/dev/null) || { echo state=none; exit 0; }
|
|
213
213
|
echo "state=$state"
|
|
214
214
|
${K} domifaddr "$n" --source lease 2>/dev/null | awk '/ipv4/ {split($4, a, "/"); print "ip=" a[1]; exit}'`);if(t.code!==0)throw new z(`asking ${Is(e)} about ${e.name} failed: ${t.stderr.trim()}`);let r=t.stdout.match(/^state=(.*)$/m)?.[1]?.trim();if(!r||r==="none")return;let n=t.stdout.match(/^ip=(.*)$/m)?.[1]?.trim();return{status:r==="running"?"running":r,ipAddress:n||void 0}}async function Lk(e,t){if((await Je(e,`${K} vol-info --pool ${ut} ${S(ct.name)} >/dev/null 2>&1 && echo yes || true`)).stdout.trim()==="yes")return;t(`downloading ${ct.url}`);let n=await Je(e,`set -euo pipefail
|
|
@@ -470,7 +470,7 @@ ${i?`(umask 077; printf '%s firewall-dns-refresh applied sha256=${i}
|
|
|
470
470
|
`+Oi({client_user:t,vault:e.vault,capability:e.capability.map(({reach:s,...i})=>{let a=r.get(i.name);return{...i,ports:a?.ports??[],...a?.address?{address:a.address}:{}}}),login:e.login,...e.deploy?{deploy:e.deploy}:{},...e.builder?{builder:e.builder}:{},...e.secret_use?{secret_use:e.secret_use}:{},...e.connector.length?{connector:e.connector}:{}})+`
|
|
471
471
|
`}function CM(e){let t=[],r=null,n=o(()=>{if(!r)return;let s=r.length;for(;s>0&&Kwe.test(r[s-1]);)s--;let i=r.slice(s);i[0]?.trim()===""&&(t.length===0||t[t.length-1].trim()==="")&&i.shift(),t.push(...i),r=null},"closeSkill");for(let s of e.split(`
|
|
472
472
|
`)){if(zwe.test(s)&&(n(),Gwe.test(s))){for(;t.length>0&&Vwe.test(t[t.length-1]);)t.pop();r=[];continue}r?r.push(s):t.push(s)}return n(),t.join(`
|
|
473
|
-
`)}async function Ywe(e){return vo(ou(e)?await Rwe(e,"utf8"):"",e)}function vo(e,t="policy"){let r;try{r=ws(e)}catch{throw new Po(`${t}: invalid policy TOML (file contents withheld)`)}let n=Wwe.safeParse(r);if(!n.success)throw new Po(`${t}: ${n.error.issues.map(s=>`${s.path.join(".")}: ${s.message}`).join("; ")}`);return n.data}var $M,Iwe,Nwe,$we,y8,w8,Pwe,Uk,NM,Lwe,Dwe,PM,Mwe,jwe,Bwe,b8,k8,Uwe,qwe,Fwe,Wwe,Po,zwe,Gwe,Vwe,Kwe,mi=hr(()=>{"use strict";ME();iu();Dk();WY();Vx();EM();AM();i8();l8();Bk();g8();EM();$M=Ze.string().regex(/^[A-Za-z0-9.-]+(\/\d{1,2})?(:\d{1,5})?$/,'a host or address, optionally with /prefix and :port, like "10.0.0.5:6443"'),Iwe=Ze.object({level:Ze.enum(["internet","allowlist","open"]).default("allowlist"),allow:Ze.array($M).default([])}).strict().refine(e=>e.level==="allowlist"||e.allow.length===0,{message:'`allow` only applies to level = "allowlist"'}),Nwe=Ze.enum(["read","act","never"]),$we=/^(LD_|DYLD_|GIT_|GH_|NODE_|PYTHON|PERL5|RUBY)|^(BASH_ENV|ENV)$/,y8=1024,w8=Ze.record(Ze.string().regex(/^[A-Z][A-Z0-9_]*$/,"an upper-case name").refine(e=>!["PATH","HOME","ORBIT_EXCHANGE"].includes(e)&&!$we.test(e),"a name the broker or git sets, or one that loads code"),Ze.string().refine(e=>Buffer.byteLength(e,"utf8")<=y8,`up to ${y8} bytes`).regex(/^[^\p{Cc}]*$/u,"one line, no control characters")).default({}),Pwe=Ze.object({name:Ze.string().regex(/^[a-z][a-z0-9-]*$/,"a lowercase name, like kube"),kind:Ze.enum(["cli","ssh"]),program:Ze.string().min(1).optional(),host:Ze.string().regex(/^[A-Za-z0-9.-]+$/).optional(),user:Ze.string().regex(/^[A-Za-z0-9._-]+$/).optional(),host_key:Ze.string().regex(/^(ssh-ed25519|ecdsa-sha2-nistp(256|384|521)|ssh-rsa) [A-Za-z0-9+/=]{16,}$/,'a public key, like "ssh-ed25519 AAAA\u2026"').optional(),secret:Ze.object({item:Ze.string().min(1),field:Ze.string().min(1),as:Ze.string().regex(/^(file:[A-Z_][A-Z0-9_]*|ssh-key)$/),orbit_made:Ze.boolean().optional()}).strict(),read:Ze.array(Ze.string()).default([]),act:Ze.array(Ze.string()).default([]),never:Ze.array(Ze.string()).default([]),default:Nwe.default("act"),value_flags:Ze.array(Ze.string()).default([]),forbid_flags:Ze.array(Ze.string().regex(/^-/)).default([]),reach:Ze.array($M.regex(/:\d+$/,'a capability destination needs a port, like "10.0.0.5:6443"')).default([]),allow_urls:Ze.boolean().default(!1),exchange:Ze.boolean().default(!1),env:w8}).strict().refine(e=>e.name!=="github"||Gx(e.env),{message:"ORBIT_GITHUB_AUTO_APPROVE must list watched repositories with valid authors and protected_paths"}).refine(e=>e.name!=="github"||Gx(e.env,"ORBIT_GITHUB_AUTO_MERGE"),{message:"ORBIT_GITHUB_AUTO_MERGE must list watched repositories with valid authors and protected_paths"}).refine(e=>e.kind==="cli"?!!e.program&&e.secret.as.startsWith("file:"):!!e.host&&!!e.user&&!!e.host_key&&e.secret.as==="ssh-key",{message:'cli needs `program` and secret as "file:VAR"; ssh needs `host`, `user`, `host_key` and secret as "ssh-key"'}).refine(e=>Object.keys(e.env).length===0||e.kind==="cli"&&!(e.secret.as.slice(5)in e.env),{message:"env is for a cli program's settings, and can't be its secret's variable"}),Uk=Ze.string().min(1).regex(/^[^/?]+$/,'a 1Password name, without "/" or "?"');o(Cwe,"withoutMacosFields");NM=o(e=>t=>Array.isArray(t)?t.flatMap(r=>Cwe(r,e)):t,"earlierEntries"),Lwe=Ze.object({name:Ze.string().regex(/^[a-z][a-z0-9-]*$/,"a lowercase name, like proton"),item:Uk,bridge:Ze.boolean().default(!1),unit:Ze.string().regex(/^[A-Za-z0-9@._-]+$/,"a systemd unit name, like orbit-app-proton-mail").optional(),url:Ze.string().regex(/^https:\/\/[A-Za-z0-9.-]+(:\d+)?\/[^\s?#]*$/,`the sign-in page's https address, without a query, like "https://account.proton.me/mail"`).optional(),username:Uk.default("username"),password:Uk.default("password"),otp:Uk.optional(),mailbox_password:Uk.optional()}).strict().refine(e=>e.bridge?!e.unit&&!e.url:!!e.unit&&!!e.url&&!e.mailbox_password,{message:"a login is an app's (unit and url) or Bridge's (bridge = true, with no unit or url; a mailbox_password only here)"}),Dwe=Ze.object({name:Ze.string().min(1).regex(/^[^\u0000-\u001f\u007f]+$/,"the Moonlet machine's name, as bb shows it"),folder:Ze.string().regex(/^\/[^\0\n]*$/,"an absolute path on that machine")}).strict(),PM=["python*","pypy*","node","nodejs","bun","perl*","ruby*","php*","lua*","java","osascript","sh","bash","dash","zsh","ksh","fish","env","npx","npm","pnpm","yarn","uv","uvx","pipx","busybox","tclsh*"],Mwe=new RegExp(`(^|/)(${PM.map(e=>e.replace("*",".*")).join("|")})$`),jwe=Ze.object({name:Ze.string().regex(/^[a-z][a-z0-9-]*$/,"a lowercase name, like notes"),kind:Ze.enum(["local"]).default("local"),command:Ze.string().regex(/^\/[^\0\n]+$/,"an absolute path on the station, like /usr/local/lib/notes-mcp/server").refine(e=>!Mwe.test(e),"the server itself, not an interpreter (install a script server as its own executable)"),args:Ze.array(Ze.string().max(1024).regex(/^[^\p{Cc}]*$/u,"one line, no control characters")).default([]),env:w8,description:Ze.string().min(1).max(300).regex(/^[^\p{Cc}]*$/u,"one line, no control characters"),reach:Ze.array($M).default([])}).strict(),Bwe=Ze.object({name:Ze.string().regex(/^[a-z][a-z0-9-]*$/,"a lowercase name, like dossier"),description:Ze.string().min(1).max(300).regex(/^[^\p{Cc}]*$/u,"one line, no control characters")}).strict(),b8=/^[a-z][a-z0-9_]*$/;o(v8,"libraryOptionRefused");k8=Ze.object({type:Ze.enum(jk,{message:`one of rclone's remote backends: ${jk.join(", ")}`}),path:Ze.string().min(1).max(500).regex(/^[^\0\r\n]*$/,"one line"),options:Ze.record(Ze.string(),Ze.string().max(2e3).regex(/^[^\r\n]*$/,"one line")).default({}).superRefine((e,t)=>{for(let r of Object.keys(e)){let n=v8(r);n&&t.addIssue({code:"custom",message:n})}}),item:Ze.string().min(1).max(200).regex(/^[^\p{Cc}]*$/u,"one line").optional()}).strict(),Uwe=Ze.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$/,"a GitHub login, like octocat"),qwe=Ze.object({repo:Ze.string().regex(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/,"owner/name").refine(e=>![".",".."].includes(e.split("/")[1]),"owner/name"),approvers:Ze.array(Uwe).min(1,"one GitHub login or more")}).strict(),Fwe=k8.extend({recipient:Ze.string().max(2e4).regex(/^-----BEGIN PGP PUBLIC KEY BLOCK-----\r?\n[\s\S]+\r?\n-----END PGP PUBLIC KEY BLOCK-----\s*$/,"the owner's OpenPGP public key, armored (gpg --armor --export <you>)")}).strict(),Wwe=Ze.object({vault:Ze.string().min(1).default("Orbit"),library:k8.optional(),backup:Fwe.optional(),network:Iwe.default({level:"allowlist",allow:[]}),capability:Ze.array(Pwe).default([]),login:Ze.preprocess(NM("app"),Ze.array(Lwe).default([])),machine:Ze.array(Dwe).default([]),mcp:Ze.preprocess(NM("os"),Ze.array(jwe).default([])),skill:Ze.preprocess(NM("os"),Ze.array(Bwe).default([])),deploy:qwe.optional(),builder:FY.optional(),secret_use:KY.optional(),connector:YY.default([])}).strict().refine(e=>new Set(e.skill.map(t=>t.name)).size===e.skill.length,{message:"skill names must be unique"}).refine(e=>new Set(e.capability.map(t=>t.name)).size===e.capability.length,{message:"capability names must be unique"}).refine(e=>new Set([...e.capability.map(t=>t.name),...e.login.map(t=>t.name),"route","check","vault","deploy","change","builder","model","bb","model-peer","policy","front-check","scratch-clean","work-clean","work-usage","secret-use-send","files","programs"]).size===e.capability.length+e.login.length+17,{message:"login names must be unique, and not a capability's or a fixed broker operation's"}).refine(e=>new Set([...e.capability.map(t=>t.name),...e.login.map(t=>t.name),...e.mcp.map(t=>t.name),"cua"]).size===e.capability.length+e.login.length+e.mcp.length+1,{message:"mcp names must be unique, and not a capability's or login's (or cua)"}).refine(e=>e.network.level==="allowlist"||e.mcp.every(t=>t.reach.length===0),{message:'an mcp server\'s `reach` only applies to network level = "allowlist"'});o(_8,"librarySourceConfig");o(Hwe,"renderCapabilities");Po=class extends Error{static{o(this,"PolicyError")}},zwe=/^\s*\[/,Gwe=/^\s*\[\[\s*skill\s*\]\]\s*(?:#.*)?$/,Vwe=/^\s*#/,Kwe=/^\s*(?:#.*)?$/;o(CM,"withoutStationSkills");o(Ywe,"loadPolicy");o(vo,"parsePolicy")});import{z as gf}from"zod";function LJ(e){return e==="exception"?"operation":e==="transport-unavailable"?"transport":e==="manager-receipt-unavailable"?"compatibility":null}function DJ(e,t,r=Date.now){let n=cl.safeParse(e),s=o((i,a,c=null)=>{if(n.success)try{let l=yf.safeParse({attempt:n.data,step:i,observedAt:r(),code:c,errorClass:LJ(a),reason:a});l.success&&t(l.data)}catch{}},"observe");return{observe:s,async run(i,a,c=()=>0){s(i,"started");try{let l=await a();try{s(i,"returned",c(l))}catch{}return l}catch(l){throw s(i,"exception"),l}}}}var cl,yke,yf,CJ,Qk=hr(()=>{"use strict";cl=gf.uuid(),yke=gf.enum(["managed-source","work-drain","policy-apply","activation-completion","installation-pin-readback"]),yf=gf.object({attempt:cl,step:yke,observedAt:gf.number().int().min(0).max(864e13),errorClass:gf.enum(["operation","transport","compatibility"]).nullable(),code:gf.number().int().min(-2147483648).max(2147483647).nullable(),reason:gf.enum(["started","returned","exception","transport-unavailable","manager-receipt-unavailable"])}).strict().refine(e=>e.reason==="returned"?e.code!==null:e.code===null).refine(e=>e.errorClass===LJ(e.reason)),CJ="ORBIT_INSTALLER_RECEIPT_V1 ";o(LJ,"installerErrorClass");o(DJ,"installerObserver")});function B_(e,...t){e.server.internal_DO_NOT_USE_stationSettingsJob(...t)}o(B_,"preparedBackgroundSettings");function U_(e){return e.sdk.system.config().then(({generalSettings:t})=>t)}o(U_,"foregroundSettings");import{randomUUID as W_}from"node:crypto";import{z as Zt}from"zod";var mR=[`CREATE TABLE userland_artifacts (id TEXT PRIMARY KEY, kind TEXT NOT NULL, name TEXT NOT NULL, active INTEGER, candidate INTEGER,
|
|
473
|
+
`)}async function Ywe(e){return vo(ou(e)?await Rwe(e,"utf8"):"",e)}function vo(e,t="policy"){let r;try{r=ws(e)}catch{throw new Po(`${t}: invalid policy TOML (file contents withheld)`)}let n=Wwe.safeParse(r);if(!n.success)throw new Po(`${t}: ${n.error.issues.map(s=>`${s.path.join(".")}: ${s.message}`).join("; ")}`);return n.data}var $M,Iwe,Nwe,$we,y8,w8,Pwe,Uk,NM,Lwe,Dwe,PM,Mwe,jwe,Bwe,b8,k8,Uwe,qwe,Fwe,Wwe,Po,zwe,Gwe,Vwe,Kwe,mi=hr(()=>{"use strict";ME();iu();Dk();WY();Vx();EM();AM();i8();l8();Bk();g8();EM();$M=Ze.string().regex(/^[A-Za-z0-9.-]+(\/\d{1,2})?(:\d{1,5})?$/,'a host or address, optionally with /prefix and :port, like "10.0.0.5:6443"'),Iwe=Ze.object({level:Ze.enum(["internet","allowlist","open"]).default("allowlist"),allow:Ze.array($M).default([])}).strict().refine(e=>e.level==="allowlist"||e.allow.length===0,{message:'`allow` only applies to level = "allowlist"'}),Nwe=Ze.enum(["read","act","never"]),$we=/^(LD_|DYLD_|GIT_|GH_|NODE_|PYTHON|PERL5|RUBY)|^(BASH_ENV|ENV)$/,y8=1024,w8=Ze.record(Ze.string().regex(/^[A-Z][A-Z0-9_]*$/,"an upper-case name").refine(e=>!["PATH","HOME","ORBIT_EXCHANGE"].includes(e)&&!$we.test(e),"a name the broker or git sets, or one that loads code"),Ze.string().refine(e=>Buffer.byteLength(e,"utf8")<=y8,`up to ${y8} bytes`).regex(/^[^\p{Cc}]*$/u,"one line, no control characters")).default({}),Pwe=Ze.object({name:Ze.string().regex(/^[a-z][a-z0-9-]*$/,"a lowercase name, like kube"),kind:Ze.enum(["cli","ssh"]),program:Ze.string().min(1).optional(),host:Ze.string().regex(/^[A-Za-z0-9.-]+$/).optional(),user:Ze.string().regex(/^[A-Za-z0-9._-]+$/).optional(),host_key:Ze.string().regex(/^(ssh-ed25519|ecdsa-sha2-nistp(256|384|521)|ssh-rsa) [A-Za-z0-9+/=]{16,}$/,'a public key, like "ssh-ed25519 AAAA\u2026"').optional(),secret:Ze.object({item:Ze.string().min(1),field:Ze.string().min(1),as:Ze.string().regex(/^(file:[A-Z_][A-Z0-9_]*|ssh-key)$/),orbit_made:Ze.boolean().optional()}).strict(),read:Ze.array(Ze.string()).default([]),act:Ze.array(Ze.string()).default([]),never:Ze.array(Ze.string()).default([]),default:Nwe.default("act"),value_flags:Ze.array(Ze.string()).default([]),forbid_flags:Ze.array(Ze.string().regex(/^-/)).default([]),reach:Ze.array($M.regex(/:\d+$/,'a capability destination needs a port, like "10.0.0.5:6443"')).default([]),allow_urls:Ze.boolean().default(!1),exchange:Ze.boolean().default(!1),env:w8}).strict().refine(e=>e.name!=="github"||Gx(e.env),{message:"ORBIT_GITHUB_AUTO_APPROVE must list watched repositories with valid authors and protected_paths"}).refine(e=>e.name!=="github"||Gx(e.env,"ORBIT_GITHUB_AUTO_MERGE"),{message:"ORBIT_GITHUB_AUTO_MERGE must list watched repositories with valid authors and protected_paths"}).refine(e=>e.kind==="cli"?!!e.program&&e.secret.as.startsWith("file:"):!!e.host&&!!e.user&&!!e.host_key&&e.secret.as==="ssh-key",{message:'cli needs `program` and secret as "file:VAR"; ssh needs `host`, `user`, `host_key` and secret as "ssh-key"'}).refine(e=>Object.keys(e.env).length===0||e.kind==="cli"&&!(e.secret.as.slice(5)in e.env),{message:"env is for a cli program's settings, and can't be its secret's variable"}),Uk=Ze.string().min(1).regex(/^[^/?]+$/,'a 1Password name, without "/" or "?"');o(Cwe,"withoutMacosFields");NM=o(e=>t=>Array.isArray(t)?t.flatMap(r=>Cwe(r,e)):t,"earlierEntries"),Lwe=Ze.object({name:Ze.string().regex(/^[a-z][a-z0-9-]*$/,"a lowercase name, like proton"),item:Uk,bridge:Ze.boolean().default(!1),unit:Ze.string().regex(/^[A-Za-z0-9@._-]+$/,"a systemd unit name, like orbit-app-proton-mail").optional(),url:Ze.string().regex(/^https:\/\/[A-Za-z0-9.-]+(:\d+)?\/[^\s?#]*$/,`the sign-in page's https address, without a query, like "https://account.proton.me/mail"`).optional(),username:Uk.default("username"),password:Uk.default("password"),otp:Uk.optional(),mailbox_password:Uk.optional()}).strict().refine(e=>e.bridge?!e.unit&&!e.url:!!e.unit&&!!e.url&&!e.mailbox_password,{message:"a login is an app's (unit and url) or Bridge's (bridge = true, with no unit or url; a mailbox_password only here)"}),Dwe=Ze.object({name:Ze.string().min(1).regex(/^[^\u0000-\u001f\u007f]+$/,"the Moonlet machine's name, as bb shows it"),folder:Ze.string().regex(/^\/[^\0\n]*$/,"an absolute path on that machine")}).strict(),PM=["python*","pypy*","node","nodejs","bun","perl*","ruby*","php*","lua*","java","osascript","sh","bash","dash","zsh","ksh","fish","env","npx","npm","pnpm","yarn","uv","uvx","pipx","busybox","tclsh*"],Mwe=new RegExp(`(^|/)(${PM.map(e=>e.replace("*",".*")).join("|")})$`),jwe=Ze.object({name:Ze.string().regex(/^[a-z][a-z0-9-]*$/,"a lowercase name, like notes"),kind:Ze.enum(["local"]).default("local"),command:Ze.string().regex(/^\/[^\0\n]+$/,"an absolute path on the station, like /usr/local/lib/notes-mcp/server").refine(e=>!Mwe.test(e),"the server itself, not an interpreter (install a script server as its own executable)"),args:Ze.array(Ze.string().max(1024).regex(/^[^\p{Cc}]*$/u,"one line, no control characters")).default([]),env:w8,description:Ze.string().min(1).max(300).regex(/^[^\p{Cc}]*$/u,"one line, no control characters"),reach:Ze.array($M).default([])}).strict(),Bwe=Ze.object({name:Ze.string().regex(/^[a-z][a-z0-9-]*$/,"a lowercase name, like dossier"),description:Ze.string().min(1).max(300).regex(/^[^\p{Cc}]*$/u,"one line, no control characters")}).strict(),b8=/^[a-z][a-z0-9_]*$/;o(v8,"libraryOptionRefused");k8=Ze.object({type:Ze.enum(jk,{message:`one of rclone's remote backends: ${jk.join(", ")}`}),path:Ze.string().min(1).max(500).regex(/^[^\0\r\n]*$/,"one line"),options:Ze.record(Ze.string(),Ze.string().max(2e3).regex(/^[^\r\n]*$/,"one line")).default({}).superRefine((e,t)=>{for(let r of Object.keys(e)){let n=v8(r);n&&t.addIssue({code:"custom",message:n})}}),item:Ze.string().min(1).max(200).regex(/^[^\p{Cc}]*$/u,"one line").optional()}).strict(),Uwe=Ze.string().regex(/^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$/,"a GitHub login, like octocat"),qwe=Ze.object({repo:Ze.string().regex(/^[A-Za-z0-9-]+\/[A-Za-z0-9._-]+$/,"owner/name").refine(e=>![".",".."].includes(e.split("/")[1]),"owner/name"),approvers:Ze.array(Uwe).min(1,"one GitHub login or more")}).strict(),Fwe=k8.extend({recipient:Ze.string().max(2e4).regex(/^-----BEGIN PGP PUBLIC KEY BLOCK-----\r?\n[\s\S]+\r?\n-----END PGP PUBLIC KEY BLOCK-----\s*$/,"the owner's OpenPGP public key, armored (gpg --armor --export <you>)")}).strict(),Wwe=Ze.object({vault:Ze.string().min(1).default("Orbit"),library:k8.optional(),backup:Fwe.optional(),network:Iwe.default({level:"allowlist",allow:[]}),capability:Ze.array(Pwe).default([]),login:Ze.preprocess(NM("app"),Ze.array(Lwe).default([])),machine:Ze.array(Dwe).default([]),mcp:Ze.preprocess(NM("os"),Ze.array(jwe).default([])),skill:Ze.preprocess(NM("os"),Ze.array(Bwe).default([])),deploy:qwe.optional(),builder:FY.optional(),secret_use:KY.optional(),connector:YY.default([])}).strict().refine(e=>new Set(e.skill.map(t=>t.name)).size===e.skill.length,{message:"skill names must be unique"}).refine(e=>new Set(e.capability.map(t=>t.name)).size===e.capability.length,{message:"capability names must be unique"}).refine(e=>new Set([...e.capability.map(t=>t.name),...e.login.map(t=>t.name),"route","check","vault","deploy","change","builder","model","bb","model-peer","policy","front-check","scratch-clean","work-clean","work-usage","secret-use-send","files","programs"]).size===e.capability.length+e.login.length+17,{message:"login names must be unique, and not a capability's or a fixed broker operation's"}).refine(e=>new Set([...e.capability.map(t=>t.name),...e.login.map(t=>t.name),...e.mcp.map(t=>t.name),"cua"]).size===e.capability.length+e.login.length+e.mcp.length+1,{message:"mcp names must be unique, and not a capability's or login's (or cua)"}).refine(e=>e.network.level==="allowlist"||e.mcp.every(t=>t.reach.length===0),{message:'an mcp server\'s `reach` only applies to network level = "allowlist"'});o(_8,"librarySourceConfig");o(Hwe,"renderCapabilities");Po=class extends Error{static{o(this,"PolicyError")}},zwe=/^\s*\[/,Gwe=/^\s*\[\[\s*skill\s*\]\]\s*(?:#.*)?$/,Vwe=/^\s*#/,Kwe=/^\s*(?:#.*)?$/;o(CM,"withoutStationSkills");o(Ywe,"loadPolicy");o(vo,"parsePolicy")});import{z as gf}from"zod";function LJ(e){return e==="exception"?"operation":e==="transport-unavailable"?"transport":e==="manager-receipt-unavailable"?"compatibility":null}function DJ(e,t,r=Date.now){let n=cl.safeParse(e),s=o((i,a,c=null)=>{if(n.success)try{let l=yf.safeParse({attempt:n.data,step:i,observedAt:r(),code:c,errorClass:LJ(a),reason:a});l.success&&t(l.data)}catch{}},"observe");return{observe:s,async run(i,a,c=()=>0){s(i,"started");try{let l=await a();try{s(i,"returned",c(l))}catch{}return l}catch(l){throw s(i,"exception"),l}}}}var cl,yke,yf,CJ,Qk=hr(()=>{"use strict";cl=gf.uuid(),yke=gf.enum(["managed-source","work-drain","policy-apply","snapshot-restore","activation-completion","installation-pin-readback"]),yf=gf.object({attempt:cl,step:yke,observedAt:gf.number().int().min(0).max(864e13),errorClass:gf.enum(["operation","transport","compatibility"]).nullable(),code:gf.number().int().min(-2147483648).max(2147483647).nullable(),reason:gf.enum(["started","returned","exception","transport-unavailable","manager-receipt-unavailable"])}).strict().refine(e=>e.reason==="returned"?e.code!==null:e.code===null).refine(e=>e.errorClass===LJ(e.reason)),CJ="ORBIT_INSTALLER_RECEIPT_V1 ";o(LJ,"installerErrorClass");o(DJ,"installerObserver")});function B_(e,...t){e.server.internal_DO_NOT_USE_stationSettingsJob(...t)}o(B_,"preparedBackgroundSettings");function U_(e){return e.sdk.system.config().then(({generalSettings:t})=>t)}o(U_,"foregroundSettings");import{randomUUID as W_}from"node:crypto";import{z as Zt}from"zod";var mR=[`CREATE TABLE userland_artifacts (id TEXT PRIMARY KEY, kind TEXT NOT NULL, name TEXT NOT NULL, active INTEGER, candidate INTEGER,
|
|
474
474
|
retired_at INTEGER, trimmed_through INTEGER NOT NULL DEFAULT 0, created_at INTEGER NOT NULL, created_by TEXT NOT NULL, UNIQUE (kind, name))`,`CREATE TABLE userland_switches (artifact TEXT NOT NULL, holder TEXT NOT NULL CHECK (holder IN ('owner', 'breaker', 'orbit')),
|
|
475
475
|
at INTEGER NOT NULL, by TEXT NOT NULL, why TEXT NOT NULL, PRIMARY KEY (artifact, holder))`,`CREATE TABLE userland_versions (artifact TEXT NOT NULL, n INTEGER NOT NULL, body TEXT, sha256 TEXT NOT NULL, size INTEGER NOT NULL,
|
|
476
476
|
stage TEXT NOT NULL CHECK (stage IN ('refused', 'trial', 'failed', 'replaced', 'active', 'superseded')),
|
|
@@ -1680,7 +1680,7 @@ ${f.tags.join(" ")}`.toLowerCase().includes(c)||p?.lower.includes(c)){l.push({..
|
|
|
1680
1680
|
UNION ALL SELECT MIN(at) FROM messages WHERE status = 'delivered' UNION ALL SELECT MIN(at) FROM relay_log WHERE outcome = 'sent')`).get(..._f);return{capabilities:f,messages:Number(h.n),since:p.at??null}},permissionUse(l){return n(`SELECT capability, SUM(decision = 'allow') AS uses, SUM(decision = 'allow' AND level = 'act') AS changes,
|
|
1681
1681
|
SUM(decision = 'allow' AND how LIKE 'user:%') AS asked, SUM(decision = 'deny') AS refused, MAX(at) AS last
|
|
1682
1682
|
FROM log WHERE at >= ? GROUP BY capability ORDER BY uses DESC, refused DESC, capability`,[l]).map(d=>({capability:String(d.capability),uses:Number(d.uses),changes:Number(d.changes),asked:Number(d.asked),refused:Number(d.refused),last:Number(d.last)}))},lastVisitEnd(l){let[d,u]=e.prepare("SELECT last_at FROM owner_visits ORDER BY last_at DESC, id DESC LIMIT 2").all();return d?d.last_at>l-gE?u?.last_at??null:d.last_at:null}}}o(kTe,"activityFeed");var _Te=Ge.object({capabilities:Ge.array(Ge.object({capability:Ge.string(),count:Ge.number()})),messages:Ge.number(),since:Ge.number().nullable()}),ETe=Ge.object({capability:Ge.string(),uses:Ge.number(),changes:Ge.number(),asked:Ge.number(),refused:Ge.number(),last:Ge.number()}),CO=Ge.object({from:Ge.number().int(),to:Ge.number().int(),kinds:Ge.array(Ge.enum(cs)).min(1).optional(),project:Ge.string().trim().toUpperCase().min(1).nullable().optional(),before:Ge.string().nullable().optional(),limit:Ge.number().int().min(1).max(Ef.max).optional(),overlap:Ge.boolean().optional(),behalf:yTe.nullable().optional()}).strict().refine(e=>e.from<e.to,{message:"from must be before to"});function LO(e,t){let r=[...new Set(e.kinds??cs)].filter(n=>t.includes(n)&&(!e.behalf||gTe.includes(n)));return{from:e.from,to:e.to,kinds:r,project:e.project??null,before:e.before?aTe(e.before):null,limit:e.limit??Ef.default,only:null,overlap:e.overlap??!1,behalf:e.behalf??null}}o(LO,"activityQuery");var TTe=nTe({"activity.feed":{input:CO,output:Ge.object({entries:Ge.array(mQ),next:Ge.string().nullable()})},"activity.behalfCounts":{input:Ge.object({from:Ge.number().int().nullable()}).strict(),output:_Te},"activity.permissionUse":{input:Ge.object({from:Ge.number().int()}).strict(),output:Ge.array(ETe)},"activity.since":{input:Ge.null(),output:Ge.object({from:Ge.number().nullable(),note:Ge.object({at:Ge.number(),body:Ge.string()}).nullable()})},"activity.entry":{input:Ge.object({kind:Ge.enum(cs),id:Ge.string().min(1).max(500)}).strict(),output:mQ.nullable()}}),bQ=new WeakMap;function vQ(e,t,r){let n=kTe(t,r);return e.rpc.register(TTe,{async"activity.feed"(s,i){if(i?.experimental_caller.kind==="plugin")throw new Error("Activity is for Moonlet's own app.");try{return n.page(LO(s,cs))}catch(a){throw a instanceof kn?new Error(a.message):a}},async"activity.behalfCounts"(s,i){if(i?.experimental_caller.kind==="plugin")throw new Error("Activity is for Moonlet's own app.");return n.behalfCounts(s.from)},async"activity.permissionUse"(s,i){if(i?.experimental_caller.kind==="plugin")throw new Error("Activity is for Moonlet's own app.");return n.permissionUse(s.from)},async"activity.since"(s,i){if(i?.experimental_caller.kind==="plugin")throw new Error("Activity is for Moonlet's own app.");let a=n.lastVisitEnd(Date.now());return{from:a,note:n.notes.since(a)}},async"activity.entry"(s,i){if(i?.experimental_caller.kind==="plugin")throw new Error("Activity is for Moonlet's own app.");return n.entry(s.kind,s.id)}}),bQ.set(e,n),n}o(vQ,"setupActivity");function b_(e){let t=bQ.get(e);if(!t)throw new Error("Activity isn't ready yet");return t}o(b_,"activityFor");Qk();import{randomUUID as CTe}from"node:crypto";import{defineRpcContract as LTe}from"@get-bb/plugin-sdk";import{z as Wt}from"zod";import{z as Cr}from"zod";var ma=6e4,Dd=["release","drain","install","activate","confirm"],DO=Cr.enum(Dd),TB={release:{label:"Get the release ready",usualMs:10*ma},drain:{label:"Wait for the station's work to finish",usualMs:15*ma},install:{label:"Install programs",usualMs:10*ma},activate:{label:"Turn the pieces back on",usualMs:5*ma},confirm:{label:"Confirm the installed version",usualMs:2*ma}},STe=10*ma,SB=5,ATe=2*ma,xTe=3*ma,AB=300,xB=500,OTe=Cr.enum(["running","slow","stuck","interrupted","failed","succeeded"]),RTe=Cr.enum(["done","running","failed","stopped","waiting"]),OB=Cr.object({station:Cr.string(),attempt:Cr.string().nullable(),revision:Cr.string().nullable(),from:Cr.string().nullable(),back:Cr.boolean(),startedAt:Cr.number().int(),endedAt:Cr.number().int().nullable(),lastActivityAt:Cr.number().int(),awaySince:Cr.number().int().nullable(),state:OTe,headline:Cr.string(),reasons:Cr.array(Cr.string()),steps:Cr.array(Cr.object({id:DO,label:Cr.string(),state:RTe,startedAt:Cr.number().int().nullable(),endedAt:Cr.number().int().nullable(),usualMs:Cr.number().int(),usualFrom:Cr.number().int(),detail:Cr.string().nullable()}).strict())}).strict(),MO=Cr.object({at:Cr.number().int(),text:Cr.string().max(xB)}).strict();function v_(e,t,r){let n=e.at(-1);return n&&Dd.indexOf(t)<=Dd.indexOf(n.step)?e:[...e,{step:t,at:r}]}o(v_,"markAfter");function EQ(e,t){let r={};return e.forEach((n,s)=>{r[n.step]=Math.max(0,(e[s+1]?.at??t)-n.at)}),r}o(EQ,"stepDurations");function kQ(e,t){let r=t[e]??[];if(!r.length)return{usualMs:TB[e].usualMs,usualFrom:0};let n=Math.max(...r);return{usualMs:Math.max(ATe,Math.ceil(n*1.5/ma)*ma),usualFrom:r.length}}o(kQ,"usualTime");function wi(e){let t=Math.floor(Math.max(0,e)/ma);if(t<1)return"under a minute";if(t<60)return`${t} min`;let r=Math.floor(t/60),n=t%60;return n?`${r} h ${n} min`:`${r} h`}o(wi,"durationText");var _Q=o(e=>e?e.slice(0,12):null,"short");function ITe(e){let t=0,r=new Set;for(let{text:n}of e){/^\s*✓ (.+?)(?::.*)?$/.exec(n)&&t++;let i=/^\s*→ ([^:]+):/.exec(n);i&&!i[1].startsWith("activation ")&&r.add(i[1])}return!t&&!r.size?null:`${t} step${t===1?"":"s"} checked, ${r.size} changed`}o(ITe,"installCounts");function NTe(e){let t=[],r=[];for(let{text:n}of e){if(/^\s*activation: not run;/.test(n))return"Not run: going back leaves every piece as it is";let s=/^\s*activation ([a-z][a-z ]*?): (.+)$/.exec(n);if(!s||s[1]==="protected conversation")continue;let[,i,a]=s;a.startsWith("on;")||a==="on"?t.push(i):a.startsWith("excluded")||r.push(`${i} ${a.split(";")[0]}`)}return!t.length&&!r.length?null:[t.length?`on: ${t.join(", ")}`:null,...r].filter(Boolean).join(" \xB7 ")}o(NTe,"pieceStates");function $Te(e,t){let r=e.receipt;if(r?.reason==="transport-unavailable")return`The managing machine lost touch with the installer during "${t}".`;if(r?.reason==="exception")return`The installer hit an error during "${t}".`;switch(e.error){case"manager":return"The machine that installs station programs couldn't be reached.";case"installer":return`The installer stopped during "${t}"${r?.code?` (exit code ${r.code})`:""}.`;case"stamp":return"The installer finished, but the station didn't report the new version.";case"readiness":return"Checking that the station is ready failed.";default:return"The install didn't complete."}}o($Te,"failureReason");function TQ(e,t){let{attempt:r,station:n}=e,s=r.marks.length?r.marks:[{step:"release",at:r.startedAt}],i=s.at(-1),a=Dd.indexOf(i.step),c=r.endedAt!==null,l=!c&&!e.live,d=e.connected?null:e.lastSeenAt??null,u=Math.max(r.lastActivityAt,i.at,e.output.at(-1)?.at??0),f=ITe(e.output),h=NTe(e.output),p=Dd.map((_,b)=>{let A=s.findIndex(x=>x.step===_),S=A>=0?s[A]:null,O=S?.at??null,T=S?s[A+1]?.at??r.endedAt:null,E;r.outcome==="succeeded"||b<a?E="done":b>a?E="waiting":r.outcome==="failed"?E="failed":E=l?"stopped":"running";let v=null;return _==="drain"&&b===a&&e.drain&&!c&&(v=`Waiting on ${e.drain.running} work item${e.drain.running===1?"":"s"}${e.drain.threads.length?`: ${e.drain.threads.join(", ")}`:""}`),_==="install"&&b<=a&&(v=f),_==="activate"&&b<=a&&(v=h),{id:_,label:TB[_].label,state:E,startedAt:O,endedAt:T,...kQ(_,e.timings),detail:v}}),g={label:TB[i.step].label,...kQ(i.step,e.timings)},m=`usually takes under ${wi(g.usualMs)}${g.usualFrom?` (${n}'s last ${g.usualFrom===1?"update":`${g.usualFrom} updates`})`:""}`,w=[],y;if(r.outcome==="succeeded")y="succeeded";else if(r.outcome==="failed")y="failed",w.push($Te(r,g.label));else if(l)y="interrupted",w.push("Moonlet restarted while this update ran and lost track of it. Update now tries again at once; otherwise a later check does, after the wait a failed try gets.");else{let _=t-i.at,b=t-u,A=i.step==="drain"&&(e.drain?.running??0)>0;d!==null&&t-d>=xTe?(y="stuck",w.push(`${n} stopped answering ${wi(t-d)} ago and hasn't come back. The update can't finish until it does.`)):A&&_>2*g.usualMs?(y="stuck",w.push(`It has waited ${wi(_)} for the station's running work to finish, and that ${m}.`)):_>2*g.usualMs&&b>=STe?(y="stuck",w.push(`Nothing new for ${wi(b)}, and "${g.label}" ${m}.`)):_>g.usualMs?(y="slow",w.push(A?`It's waiting for the station's running work to finish before it installs; that ${m}.`:`"${g.label}" is taking longer than usual: it ${m}.`)):y="running",d!==null&&y!=="stuck"&&w.push(i.step==="activate"?`${n} isn't connected right now; it restarts its host program while the pieces turn back on.`:`${n} isn't connected right now.`)}let k={running:r.back?"Going back":"Updating",slow:"Taking longer than usual",stuck:"Looks stuck",interrupted:"Interrupted",failed:r.back?"Going back failed":"Update failed",succeeded:r.back?"Went back":"Updated"}[y];return{station:n,attempt:r.attempt,revision:r.revision,from:r.from,back:r.back,startedAt:r.startedAt,endedAt:r.endedAt,lastActivityAt:u,awaySince:d,state:y,headline:k,reasons:w,steps:p}}o(TQ,"updateView");var PTe={done:"\u2713",running:"\u2026",failed:"\u2717",stopped:"\u25A0",waiting:"\xB7"};function RB(e,t,r){if(!e)return[`Update on ${t}: none recorded yet.`];let n=e.revision?` to ${_Q(e.revision)}${e.from?` from ${_Q(e.from)}`:""}`:"",s=e.endedAt===null?`started ${wi(r-e.startedAt)} ago`:`ended ${wi(r-e.endedAt)} ago, took ${wi(e.endedAt-e.startedAt)}`,i=[`${e.back?"Going back":"Update"} on ${t}${n}: ${e.headline.toLowerCase()}; ${s}.`];for(let a of e.reasons)i.push(` ${a}`);for(let a of e.steps){let c=a.startedAt===null?"":a.state==="running"||a.state==="stopped"?` (${wi((a.state==="stopped"?e.lastActivityAt:r)-a.startedAt)} so far)`:a.endedAt!==null?` (${wi(a.endedAt-a.startedAt)})`:"";i.push(` ${PTe[a.state]} ${a.label}${c}${a.detail?` \u2014 ${a.detail}`:""}`)}return i}o(RB,"updateLines");var Yg=Wt.number().int().min(0).max(864e13),IB=Wt.string().regex(/^[0-9a-f]{40}$/),DTe=Wt.enum(["queued","manager","installer","installed","stamp","readiness","done"]),MTe=Wt.enum(["manager","installer","application","stamp","readiness"]),NB=Wt.object({piece:Wt.enum(["build","outbound","secrets","launcher","builder","people","events","deploy"]),reason:Wt.enum(["healthy-on","desired-off","failed-revision-held","recovered-off","unverified-off","record-unavailable","recovery-not-quiet","state-unsettled","shutdown-unverified","dependency-recovery-pending","result-unavailable"])}).strict(),jTe=Wt.array(NB).max(8).refine(e=>new Set(e.map(t=>t.piece)).size===e.length),RQ=Wt.object({attempt:cl.nullable().optional(),installer:yf.nullable().optional(),recovery:jTe.optional(),stage:DTe,startedAt:Yg,stageStartedAt:Yg,endedAt:Yg.nullable(),outcome:Wt.enum(["running","pending","succeeded","failed"]),error:MTe.nullable(),revision:IB.nullable().optional(),from:IB.nullable().optional(),back:Wt.boolean().default(!1),marks:Wt.array(Wt.object({step:DO,at:Yg}).strict()).max(Dd.length).optional(),activeAt:Yg.optional()}).strict(),BTe=Wt.object({attempt:cl,lines:Wt.array(MO).max(AB)}).strict(),UTe=Wt.object({samples:Wt.array(Wt.partialRecord(DO,Yg)).max(SB)}).strict(),qTe=Wt.object({name:Wt.string(),summary:Wt.string(),update:OB.nullable()}).strict(),SQ=Wt.object({installing:Wt.boolean(),stations:Wt.array(qTe)}).strict(),IQ=LTe({"delivery.status":{input:Wt.object({station:Wt.string().min(1).max(128)}).strict(),output:Wt.object({record:RQ.nullable(),update:OB.nullable(),lines:Wt.array(Wt.string()),output:Wt.array(MO)}).strict()},"delivery.stations":{input:Wt.null(),output:SQ},"delivery.now":{input:Wt.null(),output:SQ},"delivery.output":{input:Wt.object({station:Wt.string().min(1).max(128)}).strict(),output:Wt.object({attempt:cl.nullable(),lines:Wt.array(MO)}).strict()}}),AQ=o(e=>`station-delivery:last:${e}`,"key"),xQ=o(e=>`station-delivery:output:${e}`,"outputKey"),OQ=o(e=>`station-delivery:timings:${e}`,"timingsKey"),FTe={installed:"confirm",stamp:"confirm"},WTe={"managed-source":"release","work-drain":"drain","activation-completion":"activate","installation-pin-readback":"confirm"};function HTe(e,t,r){if(t.reason!=="started")return e;if(t.step==="policy-apply")return e.at(-1)?.step==="drain"?v_(e,"install",r):e;let n=WTe[t.step];return n?v_(e,n,r):e}o(HTe,"receiptMarks");var zTe={queued:"release",manager:"release",installer:"install",installed:"confirm",stamp:"confirm",readiness:"confirm",done:"confirm"};function NQ(e){let t=e.marks?.length?e.marks:v_([{step:"release",at:e.startedAt}],zTe[e.stage],e.stageStartedAt);return{attempt:e.attempt??null,revision:e.revision??null,from:e.from??null,back:e.back,marks:t,startedAt:e.startedAt,endedAt:e.endedAt,outcome:e.outcome==="pending"?"succeeded":e.outcome,error:e.error,lastActivityAt:Math.max(e.startedAt,e.stageStartedAt,e.activeAt??0),receipt:e.installer?{step:e.installer.step,reason:e.installer.reason,code:e.installer.code}:null}}o(NQ,"updateAttempt");function GTe(e){return e.replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g,"").replace(/[\x00-\x08\x0b-\x1f\x7f]/g,"").trimEnd().slice(0,xB)}o(GTe,"cleanLine");function $Q(e,t=Date.now,r=()=>{}){let n=new Map,s=Promise.resolve(),i=0,a=o(f=>{let h=t();if(!(!f&&h-i<1e3)){i=h;try{r()}catch{}}},"notify"),c=o((f,h)=>{s=s.then(()=>e.kv.set(AQ(f),h)).catch(()=>{})},"save"),l=o(async f=>{let h=UTe.safeParse(await e.kv.get(OQ(f)).catch(()=>null));return h.success?h.data.samples:[]},"readTimings"),d=o((f,h)=>{if(h.outcome!=="succeeded"||h.endedAt===null||!h.marks?.length)return;let p=EQ(h.marks,h.endedAt);s=s.then(async()=>e.kv.set(OQ(f),{samples:[...await l(f),p].slice(-SB)})).catch(()=>{})},"saveTimings"),u=o((f,h,p)=>{s=s.then(()=>e.kv.set(xQ(f),{attempt:h,lines:p})).catch(()=>{})},"saveOutput");return{begin(f,h){let p=new Map;for(let m of f){let w=t(),y=h?.installed[m]??null,k={record:{attempt:CTe(),installer:null,stage:"queued",startedAt:w,stageStartedAt:w,endedAt:null,outcome:"running",error:null,revision:h?.revision??null,from:y&&IB.safeParse(y).success?y:null,back:h?.back??!1,marks:[{step:"release",at:w}],activeAt:w},output:[]};p.set(m,k),n.set(m,k),c(m,k.record),u(m,k.record.attempt,[])}a(!0);let g=o((m,w)=>{let y=p.get(m);if(!y||n.get(m)!==y||y.record.endedAt!==null)return;let k=t();y.record={...w(y.record,k),activeAt:k},c(m,y.record),a(!0)},"update");return{attempt(m){return p.get(m)?.record.attempt??void 0},installer(m,w){let y=yf.safeParse(w);y.success&&g(m,(k,_)=>k.attempt!==y.data.attempt?k:{...k,installer:y.data,marks:HTe(k.marks??[],y.data,_)})},output(m,w,y){let k=p.get(m);if(!k||n.get(m)!==k||k.record.endedAt!==null||k.record.attempt!==w)return;let _=t(),b=y.flatMap(A=>{let S=GTe(A.text);return S?[{at:Math.min(A.at,_),text:S}]:[]});b.length&&(k.output=[...k.output,...b].slice(-AB),k.record={...k.record,activeAt:_},c(m,k.record),u(m,w,k.output),a(!1))},recovery(m,w){let y=new Map;for(let k of w.split(`
|
|
1683
|
-
`)){let _=/^\s*ORBIT_RECOVERY_V1 (\S+) (.*)$/.exec(k);if(!_)continue;let b=NB.safeParse({piece:_[1],reason:_[2]}),A=NB.safeParse({piece:_[1],reason:"result-unavailable"});b.success?y.set(b.data.piece,b.data):A.success&&y.set(A.data.piece,A.data)}y.size&&g(m,k=>({...k,recovery:[...y.values()]}))},stage(m,w){g(m,(y,k)=>{let _=FTe[w],b=_?v_(y.marks??[],_,k):y.marks;return y.stage===w?{...y,marks:b}:{...y,stage:w,stageStartedAt:k,marks:b}})},finish(m){g(m,(y,k)=>({...y,stage:"done",stageStartedAt:k,endedAt:k,outcome:"succeeded",error:null}));let w=p.get(m);w&&n.get(m)===w&&d(m,w.record)},fail(m,w){g(m,(y,k)=>({...y,endedAt:k,outcome:"failed",error:w}))}}},async read(f){await s;let h=RQ.safeParse(await e.kv.get(AQ(f)).catch(()=>null));return h.success&&(!h.data.installer||h.data.installer.attempt===h.data.attempt)?h.data:null},async timings(f){await s;let h={};for(let p of await l(f))for(let g of Dd){let m=p[g];m!==void 0&&(h[g]=[...h[g]??[],m])}return h},async output(f){await s;let h=BTe.safeParse(await e.kv.get(xQ(f)).catch(()=>null));return h.success?h.data:{attempt:null,lines:[]}},live(f,h){let p=n.get(f);return!!h&&!!p&&p.record.attempt===h&&p.record.endedAt===null}}}o($Q,"deliveryRecords");function PQ(e){return e.recovery?.length?`Recovery: ${e.recovery.map(({piece:t,reason:r})=>`${t}: ${r}`).join("; ")}.`:"Recovery: unavailable (older record or incomplete activation)."}o(PQ,"deliveryRecoveryLine");import{z as jo}from"zod";var jO="station-delivery:attempts",CQ="station-delivery:last",VTe=30*6e4,KTe=240*6e4,YTe="it runs when the app starts, when a station connects and every 10 minutes";function $B(e){return Math.min(VTe*2**Math.max(0,e-1),KTe)}o($B,"retryDelay");var XTe=jo.object({revision:jo.string(),at:jo.number().int(),failures:jo.number().int().min(0).default(1)}),JTe=jo.object({action:jo.enum(["off","folder","offline","unknown","current","tried","applying","pending","failed","server"]),revision:jo.string().nullable(),installed:jo.string().nullable(),readAt:jo.number().int().nullable(),at:jo.number().int(),attempted:jo.number().int().nullable(),error:jo.string().nullable(),retryAt:jo.number().int().nullable().default(null)}).strict();function __(e){return/^commit=([0-9a-f]{40})$/m.exec(e)?.[1]??null}o(__,"installedCommit");function BO(e){return(e instanceof Error?e.message:String(e)).replace(/\s+/g," ").trim()}o(BO,"errorText");async function UO(e){let t=jo.record(jo.string(),JTe).safeParse(await e.kv.get(CQ));return t.success?t.data:{}}o(UO,"lastDelivery");var k_=o(e=>e.slice(0,12),"short");function ZTe(e,t){let r=e.revision?`the app's commit ${k_(e.revision)}`:"the app's commit",n=e.error?`; last error: ${e.error}`:"",s=e.retryAt===null?"":`; it tries again ${e.retryAt>t?`in ${wi(e.retryAt-t)}`:"at the next check"}, or now with moonlet station update`;switch(e.action){case"current":case"pending":return"current: it runs the app's commit";case"applying":return`installing ${r}, started ${Mf(e.attempted??e.at,t)}`;case"tried":return`waiting to install ${r}: the last try, ${Mf(e.attempted??e.at,t)}, failed${s}${n}`;case"failed":return`installing ${r} failed ${Mf(e.attempted??e.at,t)}: ${e.error??"no reason recorded"}${s}`;case"server":return`waiting to install ${r}: the server is updating itself, so the station waits for the next check`;case"off":return"automatic updates are off (Settings \u2192 Updates), so nothing is installed by itself";case"folder":return"this app is a folder install with no commit, so there is nothing to deliver";case"offline":return"the station isn't connected";case"unknown":return"its bundle-source names no commit"}}o(ZTe,"deliveryPhrase");function LQ(e,t){return`${e.installed&&e.readAt!==null?`built from commit ${e.installed} (read ${Mf(e.readAt,t)})`:"commit not read"}; delivery, checked ${Mf(e.at,t)}: ${ZTe(e,t)}`}o(LQ,"deliverySummary");function DQ(e,t,r){let n=[`App (Moonlet, which runs every assistant command, userland, schedule and script): ${e.version??"version unknown"}, ${e.revision?`built from commit ${e.revision}`:"a folder install with no commit"}`],s=Object.keys(t).sort();s.length||n.push(`Station programs: no delivery check recorded yet; ${YTe}`);for(let i of s)n.push(`Station programs on ${i} (the broker, guard, launcher and check runner): ${LQ(t[i],r)}`);return n}o(DQ,"partsLines");function MQ(e){if(!e.stations.length)return["There's no station to update."];let t=e.stations.map(r=>`${r.name}: ${r.summary}`);return e.installing&&t.push("It drains the station's work before it installs; moonlet station progress shows each step and the installer's output."),t}o(MQ,"deliveryNowLines");function jQ(e,t){let r=t.now??Date.now,n=Promise.resolve(),s=!1;function i(y){let k=n.then(y);return n=k.catch(()=>{}),k}o(i,"serial");async function a(y){if(t.repair)try{await t.repair(y)==="reinstalled"&&e.log.info(`${y.name}: its daemon couldn't start because its install was incomplete; Moonlet's installer reinstalled it and it reconnected`)}catch(k){e.log.warn(`${y.name} is offline and repairing its daemon didn't work: ${BO(k)}`)}}o(a,"repairOffline");async function c(y){await e.storage.kv.set(CQ,y),t.changed?.()}o(c,"saveLast");async function l(){let y=await t.stations(),k=t.revision();return _=>i(()=>p(y,k,_))}o(l,"prepareTick");async function d(){let y=await e.storage.kv.get(jO),k={};if(y&&typeof y=="object"&&!Array.isArray(y))for(let[_,b]of Object.entries(y)){let A=XTe.safeParse(b);A.success&&(k[_]=A.data)}return k}o(d,"savedAttempts");let u=o((y,k)=>!!y&&y.failures>0&&k-y.at>=0&&k-y.at<$B(y.failures),"waiting");async function f(y){return t.records?!!(await t.records.read(y))?.marks?.some(_=>_.step==="install"||_.step==="activate"):!0}o(f,"reachedInstall");async function h(y,k,_,b,A){if(!b||b===k||!await f(y.name))return null;let S=t.records?.begin([y.name],{revision:b,installed:{[y.name]:k},back:!0}),O=null;try{await t.apply([y.name],S,b,!1)}catch(v){O=v??new Error("Automatic station installation did not complete.")}S?.stage(y.name,"stamp");let T=__(await t.bundleSource(y).catch(()=>""));if(A[y.name]={installed:T,at:r()},!O&&T===b)return S?.finish(y.name),`it went back to ${k_(b)}, the last version that worked`;S?.fail(y.name,O?"application":"stamp");let E=O?BO(O).replace(/\.$/,""):"the station didn't confirm it";return E===_?`going back to ${k_(b)} failed the same way`:`going back to ${k_(b)} didn't work either: ${E}`}o(h,"goBack");async function p(y,k,_){let b={},A=await d(),S=await UO(e.storage),O={},T=r(),E=[],v=!1;for(let R of y)if(!_.owner&&!_.automatic)b[R.name]="off";else if(!k)b[R.name]="folder";else if(!R.connected)b[R.name]="offline",await a(R);else{let P=__(await t.bundleSource(R).catch(()=>""));if(O[R.name]={installed:P,at:T},P===null)b[R.name]="unknown";else if(P===k){b[R.name]="current";let N=A[R.name];N&&N.failures>0&&(A[R.name]={...N,failures:0},v=!0)}else!_.owner&&u(A[R.name],T)?b[R.name]="tried":(b[R.name]="applying",E.push(R.name))}let x={},$=o((R,P,N=null)=>{let M=S[R],j=O[R],G=A[R];x[R]={action:P,revision:k,installed:j?j.installed:M?.installed??null,readAt:j?j.at:M?.readAt??null,at:T,attempted:G?.at??null,error:N??(P==="tried"?M?.error??null:null),retryAt:(P==="tried"||P==="failed")&&G?G.at+$B(G.failures):null}},"record");v&&await e.storage.kv.set(jO,A);for(let R of y)$(R.name,b[R.name]);let L=E.length>0&&k&&t.holdServerUpdate?t.holdServerUpdate():()=>{};if(L===null){for(let R of E)b[R]="server",$(R,"server");e.log.info(`station-delivery: the server is updating itself, so ${E.join(", ")} waits for the next check`)}else if(E.length>0&&k){let R=Object.fromEntries(E.map(P=>[P,O[P]?.installed??null]));for(let P of E)A[P]={revision:k,at:T,failures:(A[P]?.failures??0)+1};for(let P of E)$(P,"applying");await e.storage.kv.set(jO,A),await c(x),s=!0;try{_.started?.();let P=t.records?.begin(E,{revision:k,installed:R,back:!1}),N=null;try{await t.apply(E,P,k,!0)}catch(G){N=G??new Error("Automatic station installation did not complete.")}let M=[];for(let G of y.filter(ee=>E.includes(ee.name))){P?.stage(G.name,"stamp");let ee=__(await t.bundleSource(G).catch(()=>""));if(O[G.name]={installed:ee,at:r()},ee!==k){M.push(G),P?.fail(G.name,N?"application":"stamp");continue}P?.finish(G.name),A[G.name]={revision:k,at:T,failures:0},b[G.name]="current",$(G.name,"current")}let j=N??(M.length>0?new Error(`Automatic station delivery did not confirm the expected bundle for ${M.map(G=>G.name).join(", ")}.`):null);for(let G of M){let ee=BO(j).replace(/\.$/,""),H=await h(G,k,ee,R[G.name]??null,O);$(G.name,"failed",H?`${ee}; ${H}`:ee),e.log.warn(`station-delivery: installing ${k_(k)} on ${G.name} failed: ${ee}${H?`; ${H}`:""}; it tries again in ${wi($B(A[G.name].failures))}`)}if(await e.storage.kv.set(jO,A),j)throw await c(x),j;e.log.info(`Confirmed station revision ${k.slice(0,12)} on ${E.join(", ")} through the deploy hold-and-resume path.`);try{t.delivered?.(E)}catch{}}finally{s=!1,L(),t.changed?.()}}return await c(x),b}o(p,"deliver");async function g(){let y=await UO(e.storage),k=r();return{installing:s,stations:Object.keys(y).sort().map(_=>({name:_,summary:LQ(y[_],k)}))}}o(g,"overview");function m(y){return s?g():new Promise((k,_)=>{i(async()=>p(await t.stations(),t.revision(),{automatic:y||await t.automatic(),owner:y,started:k})).then(()=>k(),b=>{e.log.warn(`station-delivery: ${BO(b)}`),_(b)})}).then(g)}o(m,"requestDelivery");async function w(){return(await l())({automatic:await t.automatic(),owner:!1})}return o(w,"tick"),t.backgroundTick?t.backgroundTick(async()=>{let y=await l();return async k=>{await y({automatic:k,owner:!1})}}):pt(e,"station-delivery","*/10 * * * *",w),{tick:w,deliverNow:o(()=>m(!0),"deliverNow"),checkNow:o(()=>m(!1),"checkNow"),overview:g}}o(jQ,"setupStationDelivery");function QTe(e,t){let r=[t.avatars,t.pages].filter(l=>l!==null),n=r.map(l=>l.dir).join(" or ")||"(none: the Moonlet thread's station isn't connected)",s=e.lastIndexOf("/"),i=e.slice(0,s),a=e.slice(s+1);if(!e.startsWith("/")||e.split("/").slice(1).some(l=>l===""||l==="."||l===".."))return{problem:`give the picture's full path, a file directly in ${n}`};if(!V4.test(a))return{problem:`${a} isn't a picture's name: letters, digits, . _ and -, ending .png, .jpg, .jpeg, .webp or .svg`};let c=r.find(l=>l.dir===i);return c?{hostId:c.hostId,dir:i,name:a}:{problem:`an avatar is read only from a file directly in ${n}`}}o(QTe,"avatarSource");async function BQ(e,t,r){let n=await e.orbitStation(),s=await e.storage(t),i={avatars:n?{hostId:n.hostId,dir:`${n.dataDir}/avatars`}:null,pages:s?.storageRootPath.startsWith("/")?{hostId:s.hostId,dir:LE(s.storageRootPath,t)}:null},a=QTe(r,i);if("problem"in a)throw new Error(a.problem);let c;try{c=await e.read(a.hostId,a.dir,`${a.dir}/${a.name}`)}catch(l){throw new Error(`couldn't read ${r}: ${l instanceof Error?l.message:String(l)}`)}if(c.sizeBytes>131072)throw new Error(`an avatar is at most ${131072/1024} KB (${a.name} is ${Math.ceil(c.sizeBytes/1024)} KB): save a copy at most 256 pixels square and propose that, or ask the owner to choose it in Settings \u2192 Moonlet \u2192 Preferences, which shrinks it`);return FT(c.content,a.name)}o(BQ,"readAvatarFile");import{defineRpcContract as e0e}from"@get-bb/plugin-sdk";import{z as Xg}from"zod";var t0e=e0e({"avatar.forThread":{input:Xg.object({threadId:Xg.string().regex(/^thr_[a-z0-9]+$/)}).strict(),output:Xg.object({url:Xg.string().nullable(),isOrbitThread:Xg.boolean(),name:Xg.string().nullable()})}});function r0e(e){return{async"avatar.forThread"({threadId:t},r){if(r?.experimental_caller.kind==="plugin")return{url:null,isOrbitThread:!1,name:null};let{avatar:n,identity:s}=e.prefs(),i=await e.orbitThread();return i?t===i?{url:n.orbit??null,isOrbitThread:!0,name:Zr(s)}:n.work?{url:await e.startedByOrbit(i,t)?n.work:null,isOrbitThread:!1,name:null}:{url:null,isOrbitThread:!1,name:null}:{url:null,isOrbitThread:!1,name:null}}}}o(r0e,"chatAvatarHandlers");function UQ(e,t){e.rpc.register(t0e,r0e(t))}o(UQ,"setupChatAvatar");var n0e=1500,WQ=280,o0e=3,s0e=2,i0e=8,a0e=/\b(threads?|stations?|queues?|queued|workers?|agents?|jobs?|intake|slots?)\b/i,E_=o(e=>e.replace(/\s+/g," ").trim(),"oneLine"),c0e=o(e=>e<=0?"it's next and starts once there's room":e===1?"one other thing goes first":`${e} other things go first`,"placeFact"),qQ=o(e=>e.length?e.map(t=>`- ${E_(t).slice(0,WQ)}`).join(`
|
|
1683
|
+
`)){let _=/^\s*ORBIT_RECOVERY_V1 (\S+) (.*)$/.exec(k);if(!_)continue;let b=NB.safeParse({piece:_[1],reason:_[2]}),A=NB.safeParse({piece:_[1],reason:"result-unavailable"});b.success?y.set(b.data.piece,b.data):A.success&&y.set(A.data.piece,A.data)}y.size&&g(m,k=>({...k,recovery:[...y.values()]}))},stage(m,w){g(m,(y,k)=>{let _=FTe[w],b=_?v_(y.marks??[],_,k):y.marks;return y.stage===w?{...y,marks:b}:{...y,stage:w,stageStartedAt:k,marks:b}})},finish(m){g(m,(y,k)=>({...y,stage:"done",stageStartedAt:k,endedAt:k,outcome:"succeeded",error:null}));let w=p.get(m);w&&n.get(m)===w&&d(m,w.record)},fail(m,w){g(m,(y,k)=>({...y,endedAt:k,outcome:"failed",error:w}))}}},async read(f){await s;let h=RQ.safeParse(await e.kv.get(AQ(f)).catch(()=>null));return h.success&&(!h.data.installer||h.data.installer.attempt===h.data.attempt)?h.data:null},async timings(f){await s;let h={};for(let p of await l(f))for(let g of Dd){let m=p[g];m!==void 0&&(h[g]=[...h[g]??[],m])}return h},async output(f){await s;let h=BTe.safeParse(await e.kv.get(xQ(f)).catch(()=>null));return h.success?h.data:{attempt:null,lines:[]}},live(f,h){let p=n.get(f);return!!h&&!!p&&p.record.attempt===h&&p.record.endedAt===null}}}o($Q,"deliveryRecords");function PQ(e){return e.recovery?.length?`Recovery: ${e.recovery.map(({piece:t,reason:r})=>`${t}: ${r}`).join("; ")}.`:"Recovery: unavailable (older record or incomplete activation)."}o(PQ,"deliveryRecoveryLine");import{z as jo}from"zod";var jO="station-delivery:attempts",CQ="station-delivery:last",VTe=30*6e4,KTe=240*6e4,YTe="it runs when the app starts, when a station connects and every 10 minutes";function $B(e){return Math.min(VTe*2**Math.max(0,e-1),KTe)}o($B,"retryDelay");var XTe=jo.object({revision:jo.string(),at:jo.number().int(),failures:jo.number().int().min(0).default(1)}),JTe=jo.object({action:jo.enum(["off","folder","offline","unknown","current","tried","applying","pending","failed","server"]),revision:jo.string().nullable(),installed:jo.string().nullable(),readAt:jo.number().int().nullable(),at:jo.number().int(),attempted:jo.number().int().nullable(),error:jo.string().nullable(),retryAt:jo.number().int().nullable().default(null)}).strict();function __(e){return/^commit=([0-9a-f]{40})$/m.exec(e)?.[1]??null}o(__,"installedCommit");function BO(e){return(e instanceof Error?e.message:String(e)).replace(/\s+/g," ").trim()}o(BO,"errorText");async function UO(e){let t=jo.record(jo.string(),JTe).safeParse(await e.kv.get(CQ));return t.success?t.data:{}}o(UO,"lastDelivery");var k_=o(e=>e.slice(0,12),"short");function ZTe(e,t){let r=e.revision?`the app's commit ${k_(e.revision)}`:"the app's commit",n=e.error?`; last error: ${e.error}`:"",s=e.retryAt===null?"":`; it tries again ${e.retryAt>t?`in ${wi(e.retryAt-t)}`:"at the next check"}, or now with moonlet station update`;switch(e.action){case"current":case"pending":return"current: it runs the app's commit";case"applying":return`installing ${r}, started ${Mf(e.attempted??e.at,t)}`;case"tried":return`waiting to install ${r}: the last try, ${Mf(e.attempted??e.at,t)}, failed${s}${n}`;case"failed":return`installing ${r} failed ${Mf(e.attempted??e.at,t)}: ${e.error??"no reason recorded"}${s}`;case"server":return`waiting to install ${r}: the server is updating itself, so the station waits for the next check`;case"off":return"automatic updates are off (Settings \u2192 Updates), so nothing is installed by itself";case"folder":return"this app is a folder install with no commit, so there is nothing to deliver";case"offline":return"the station isn't connected";case"unknown":return"its bundle-source names no commit"}}o(ZTe,"deliveryPhrase");function LQ(e,t){return`${e.installed&&e.readAt!==null?`built from commit ${e.installed} (read ${Mf(e.readAt,t)})`:"commit not read"}; delivery, checked ${Mf(e.at,t)}: ${ZTe(e,t)}`}o(LQ,"deliverySummary");function DQ(e,t,r){let n=[`App (Moonlet, which runs every assistant command, userland, schedule and script): ${e.version??"version unknown"}, ${e.revision?`built from commit ${e.revision}`:"a folder install with no commit"}`],s=Object.keys(t).sort();s.length||n.push(`Station programs: no delivery check recorded yet; ${YTe}`);for(let i of s)n.push(`Station programs on ${i} (the broker, guard, launcher and check runner): ${LQ(t[i],r)}`);return n}o(DQ,"partsLines");function MQ(e){if(!e.stations.length)return["There's no station to update."];let t=e.stations.map(r=>`${r.name}: ${r.summary}`);return e.installing&&t.push("It drains the station's work before it installs; moonlet station progress shows each step and the installer's output."),t}o(MQ,"deliveryNowLines");function jQ(e,t){let r=t.now??Date.now,n=Promise.resolve(),s=!1;function i(y){let k=n.then(y);return n=k.catch(()=>{}),k}o(i,"serial");async function a(y){if(t.repair)try{await t.repair(y)==="reinstalled"&&e.log.info(`${y.name}: its daemon couldn't start because its install was incomplete; Moonlet's installer reinstalled it and it reconnected`)}catch(k){e.log.warn(`${y.name} is offline and repairing its daemon didn't work: ${BO(k)}`)}}o(a,"repairOffline");async function c(y){await e.storage.kv.set(CQ,y),t.changed?.()}o(c,"saveLast");async function l(){let y=await t.stations(),k=t.revision();return _=>i(()=>p(y,k,_))}o(l,"prepareTick");async function d(){let y=await e.storage.kv.get(jO),k={};if(y&&typeof y=="object"&&!Array.isArray(y))for(let[_,b]of Object.entries(y)){let A=XTe.safeParse(b);A.success&&(k[_]=A.data)}return k}o(d,"savedAttempts");let u=o((y,k)=>!!y&&y.failures>0&&k-y.at>=0&&k-y.at<$B(y.failures),"waiting");async function f(y){if(!t.records)return"changed";let k=await t.records.read(y),_=k?.installer;return _?.step==="snapshot-restore"&&_.reason==="returned"&&_.code===0?"restored":k?.marks?.some(b=>b.step==="install"||b.step==="activate")?"changed":"not reached"}o(f,"installOutcome");async function h(y,k,_,b,A){let S=await f(y.name);if(S==="restored")return"its disk went back to the snapshot taken just before the install, so it is as it was";if(!b||b===k||S==="not reached")return null;let O=t.records?.begin([y.name],{revision:b,installed:{[y.name]:k},back:!0}),T=null;try{await t.apply([y.name],O,b,!1)}catch(x){T=x??new Error("Automatic station installation did not complete.")}O?.stage(y.name,"stamp");let E=__(await t.bundleSource(y).catch(()=>""));if(A[y.name]={installed:E,at:r()},!T&&E===b)return O?.finish(y.name),`it went back to ${k_(b)}, the last version that worked`;O?.fail(y.name,T?"application":"stamp");let v=T?BO(T).replace(/\.$/,""):"the station didn't confirm it";return v===_?`going back to ${k_(b)} failed the same way`:`going back to ${k_(b)} didn't work either: ${v}`}o(h,"goBack");async function p(y,k,_){let b={},A=await d(),S=await UO(e.storage),O={},T=r(),E=[],v=!1;for(let R of y)if(!_.owner&&!_.automatic)b[R.name]="off";else if(!k)b[R.name]="folder";else if(!R.connected)b[R.name]="offline",await a(R);else{let P=__(await t.bundleSource(R).catch(()=>""));if(O[R.name]={installed:P,at:T},P===null)b[R.name]="unknown";else if(P===k){b[R.name]="current";let N=A[R.name];N&&N.failures>0&&(A[R.name]={...N,failures:0},v=!0)}else!_.owner&&u(A[R.name],T)?b[R.name]="tried":(b[R.name]="applying",E.push(R.name))}let x={},$=o((R,P,N=null)=>{let M=S[R],j=O[R],G=A[R];x[R]={action:P,revision:k,installed:j?j.installed:M?.installed??null,readAt:j?j.at:M?.readAt??null,at:T,attempted:G?.at??null,error:N??(P==="tried"?M?.error??null:null),retryAt:(P==="tried"||P==="failed")&&G?G.at+$B(G.failures):null}},"record");v&&await e.storage.kv.set(jO,A);for(let R of y)$(R.name,b[R.name]);let L=E.length>0&&k&&t.holdServerUpdate?t.holdServerUpdate():()=>{};if(L===null){for(let R of E)b[R]="server",$(R,"server");e.log.info(`station-delivery: the server is updating itself, so ${E.join(", ")} waits for the next check`)}else if(E.length>0&&k){let R=Object.fromEntries(E.map(P=>[P,O[P]?.installed??null]));for(let P of E)A[P]={revision:k,at:T,failures:(A[P]?.failures??0)+1};for(let P of E)$(P,"applying");await e.storage.kv.set(jO,A),await c(x),s=!0;try{_.started?.();let P=t.records?.begin(E,{revision:k,installed:R,back:!1}),N=null;try{await t.apply(E,P,k,!0)}catch(G){N=G??new Error("Automatic station installation did not complete.")}let M=[];for(let G of y.filter(ee=>E.includes(ee.name))){P?.stage(G.name,"stamp");let ee=__(await t.bundleSource(G).catch(()=>""));if(O[G.name]={installed:ee,at:r()},ee!==k){M.push(G),P?.fail(G.name,N?"application":"stamp");continue}P?.finish(G.name),A[G.name]={revision:k,at:T,failures:0},b[G.name]="current",$(G.name,"current")}let j=N??(M.length>0?new Error(`Automatic station delivery did not confirm the expected bundle for ${M.map(G=>G.name).join(", ")}.`):null);for(let G of M){let ee=BO(j).replace(/\.$/,""),H=await h(G,k,ee,R[G.name]??null,O);$(G.name,"failed",H?`${ee}; ${H}`:ee),e.log.warn(`station-delivery: installing ${k_(k)} on ${G.name} failed: ${ee}${H?`; ${H}`:""}; it tries again in ${wi($B(A[G.name].failures))}`)}if(await e.storage.kv.set(jO,A),j)throw await c(x),j;e.log.info(`Confirmed station revision ${k.slice(0,12)} on ${E.join(", ")} through the deploy hold-and-resume path.`);try{t.delivered?.(E)}catch{}}finally{s=!1,L(),t.changed?.()}}return await c(x),b}o(p,"deliver");async function g(){let y=await UO(e.storage),k=r();return{installing:s,stations:Object.keys(y).sort().map(_=>({name:_,summary:LQ(y[_],k)}))}}o(g,"overview");function m(y){return s?g():new Promise((k,_)=>{i(async()=>p(await t.stations(),t.revision(),{automatic:y||await t.automatic(),owner:y,started:k})).then(()=>k(),b=>{e.log.warn(`station-delivery: ${BO(b)}`),_(b)})}).then(g)}o(m,"requestDelivery");async function w(){return(await l())({automatic:await t.automatic(),owner:!1})}return o(w,"tick"),t.backgroundTick?t.backgroundTick(async()=>{let y=await l();return async k=>{await y({automatic:k,owner:!1})}}):pt(e,"station-delivery","*/10 * * * *",w),{tick:w,deliverNow:o(()=>m(!0),"deliverNow"),checkNow:o(()=>m(!1),"checkNow"),overview:g}}o(jQ,"setupStationDelivery");function QTe(e,t){let r=[t.avatars,t.pages].filter(l=>l!==null),n=r.map(l=>l.dir).join(" or ")||"(none: the Moonlet thread's station isn't connected)",s=e.lastIndexOf("/"),i=e.slice(0,s),a=e.slice(s+1);if(!e.startsWith("/")||e.split("/").slice(1).some(l=>l===""||l==="."||l===".."))return{problem:`give the picture's full path, a file directly in ${n}`};if(!V4.test(a))return{problem:`${a} isn't a picture's name: letters, digits, . _ and -, ending .png, .jpg, .jpeg, .webp or .svg`};let c=r.find(l=>l.dir===i);return c?{hostId:c.hostId,dir:i,name:a}:{problem:`an avatar is read only from a file directly in ${n}`}}o(QTe,"avatarSource");async function BQ(e,t,r){let n=await e.orbitStation(),s=await e.storage(t),i={avatars:n?{hostId:n.hostId,dir:`${n.dataDir}/avatars`}:null,pages:s?.storageRootPath.startsWith("/")?{hostId:s.hostId,dir:LE(s.storageRootPath,t)}:null},a=QTe(r,i);if("problem"in a)throw new Error(a.problem);let c;try{c=await e.read(a.hostId,a.dir,`${a.dir}/${a.name}`)}catch(l){throw new Error(`couldn't read ${r}: ${l instanceof Error?l.message:String(l)}`)}if(c.sizeBytes>131072)throw new Error(`an avatar is at most ${131072/1024} KB (${a.name} is ${Math.ceil(c.sizeBytes/1024)} KB): save a copy at most 256 pixels square and propose that, or ask the owner to choose it in Settings \u2192 Moonlet \u2192 Preferences, which shrinks it`);return FT(c.content,a.name)}o(BQ,"readAvatarFile");import{defineRpcContract as e0e}from"@get-bb/plugin-sdk";import{z as Xg}from"zod";var t0e=e0e({"avatar.forThread":{input:Xg.object({threadId:Xg.string().regex(/^thr_[a-z0-9]+$/)}).strict(),output:Xg.object({url:Xg.string().nullable(),isOrbitThread:Xg.boolean(),name:Xg.string().nullable()})}});function r0e(e){return{async"avatar.forThread"({threadId:t},r){if(r?.experimental_caller.kind==="plugin")return{url:null,isOrbitThread:!1,name:null};let{avatar:n,identity:s}=e.prefs(),i=await e.orbitThread();return i?t===i?{url:n.orbit??null,isOrbitThread:!0,name:Zr(s)}:n.work?{url:await e.startedByOrbit(i,t)?n.work:null,isOrbitThread:!1,name:null}:{url:null,isOrbitThread:!1,name:null}:{url:null,isOrbitThread:!1,name:null}}}}o(r0e,"chatAvatarHandlers");function UQ(e,t){e.rpc.register(t0e,r0e(t))}o(UQ,"setupChatAvatar");var n0e=1500,WQ=280,o0e=3,s0e=2,i0e=8,a0e=/\b(threads?|stations?|queues?|queued|workers?|agents?|jobs?|intake|slots?)\b/i,E_=o(e=>e.replace(/\s+/g," ").trim(),"oneLine"),c0e=o(e=>e<=0?"it's next and starts once there's room":e===1?"one other thing goes first":`${e} other things go first`,"placeFact"),qQ=o(e=>e.length?e.map(t=>`- ${E_(t).slice(0,WQ)}`).join(`
|
|
1684
1684
|
`):"none","listed");function l0e(e,t){let r={name:E_(t.name),tone:E_(t.tone),what:E_(t.what),place:c0e(t.ahead),recent:qQ(t.recent),refused:qQ(t.refused),drafts:String(o0e)};return e.replace(/\{\{(name|tone|what|place|recent|refused|drafts)\}\}/g,(n,s)=>r[s])}o(l0e,"waitPrompt");function d0e(e){let t=E_(e).replace(/^["“]|["”]$/g,"");return!t||t.length>WQ||a0e.test(t)||/https?:|www\.|`/i.test(t)?null:t}o(d0e,"acceptBridge");function FQ(e){let t=o(n=>n.toLowerCase().replace(/[^a-z0-9' ]+/g," ").split(" ").filter(Boolean),"words"),r=t(e.split(/[,:!—–-]/,1)[0]??"");return[t(e).slice(0,2).join(" "),...r.length>0&&r.length<=3?[r.join(" ")]:[]]}o(FQ,"openings");function u0e(e,t){let r=new Set(t.flatMap(FQ)),n=[];for(let s of e.split(`
|
|
1685
1685
|
`)){let i=s.trim().replace(/^(?:[-*•]|\d+[.)])\s*/,"");if(!i)continue;let a=d0e(i);if(a&&!FQ(a).some(c=>r.has(c)))return{line:a,refused:n};n.push(i)}return{line:null,refused:n}}o(u0e,"pickBridge");var p0e="claude-haiku-5-5";function HQ(e,t){let r=`BRIDGE_${t}`;if(!/^[A-Za-z0-9]+$/.test(t)||e.split(`
|
|
1686
1686
|
`).includes(r))throw new Error("That text can't be passed on safely.");return["set -u",'dir="$HOME/OrbitData/model-requests"','mkdir -p "$dir" || exit 70','file=$(mktemp "$dir/bridge-XXXXXXXX") || exit 70',`cat > "$file" <<'${r}'`,e,r,'cd /usr/local/orbit/front || { rm -f "$file"; exit 70; }',`/usr/local/orbit/bin/orbit-cap model ask ${p0e} --prompt-file "$file"`,"code=$?",'rm -f "$file"',"exit $code"].join(`
|