@halcyonlabs/app 0.47.0-halcyon.509 → 0.47.0-halcyon.511
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 +55 -55
- package/package.json +4 -1
- 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 +34 -34
- package/server/dist/builtin-plugins/orbit/dist/host.meta.json +1 -1
- package/server/dist/builtin-plugins/orbit/dist/server.js +410 -406
|
@@ -4,45 +4,45 @@ import { fileURLToPath as __fileURLToPath } from "node:url";
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
var Ry=Object.create;var Gn=Object.defineProperty;var Zy=Object.getOwnPropertyDescriptor;var Dy=Object.getOwnPropertyNames;var Ly=Object.getPrototypeOf,jy=Object.prototype.hasOwnProperty;var s=(e,t)=>Gn(e,"name",{value:t,configurable:!0}),Be=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var z=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var he=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ge=(e,t)=>{for(var r in t)Gn(e,r,{get:t[r],enumerable:!0})},My=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Dy(t))!jy.call(e,o)&&o!==r&&Gn(e,o,{get:()=>t[o],enumerable:!(n=Zy(t,o))||n.enumerable});return e};var Fy=(e,t,r)=>(r=e!=null?Ry(Ly(e)):{},My(t||!e||!e.__esModule?Gn(r,"default",{value:e,enumerable:!0}):r,e));var S={};ge(S,{BIGINT_FORMAT_RANGES:()=>Lr,CONSTANT_CATCH:()=>no,Class:()=>Zs,NUMBER_FORMAT_RANGES:()=>Dr,aborted:()=>oe,allowsEval:()=>js,assert:()=>Jy,assertEqual:()=>Vy,assertIs:()=>By,assertNever:()=>Ky,assertNotEqual:()=>Uy,assignProp:()=>Y,attachSchema:()=>ro,base64ToUint8Array:()=>gd,base64urlToUint8Array:()=>fb,cached:()=>Vt,captureStackTrace:()=>Qn,cleanEnum:()=>lb,cleanRegex:()=>De,clone:()=>L,cloneDef:()=>Hy,codePointLength:()=>ht,constantCatch:()=>Ks,createTransparentProxy:()=>tb,defineLazy:()=>Ds,defineLazyInternal:()=>N,derived:()=>hb,esc:()=>ne,escapeRegex:()=>xe,explicitlyAborted:()=>Vs,extend:()=>ob,finalizeIssue:()=>fe,floatSafeRemainder:()=>Nr,getElementAtPath:()=>Gy,getEnumValues:()=>Mt,getLengthableOrigin:()=>Mr,getParsedType:()=>eb,getSizableOrigin:()=>jr,hexToUint8Array:()=>db,hide:()=>Fr,installLazyProp:()=>bb,isObject:()=>mt,isPlainObject:()=>ke,issue:()=>Bt,joinValues:()=>Xn,jsonStringifyReplacer:()=>Ft,members:()=>Bs,merge:()=>sb,mergeDefs:()=>ze,normalizeParams:()=>w,nullish:()=>Yn,numKeys:()=>Qy,objectClone:()=>Wy,omit:()=>nb,optionalKeys:()=>Fs,own:()=>Je,parsedType:()=>Us,partial:()=>ab,pick:()=>rb,prefixIssues:()=>le,primitiveTypes:()=>Ms,promiseAllObject:()=>Xy,propertyKeyTypes:()=>Zr,randomString:()=>Yy,rawShape:()=>Ut,required:()=>cb,safeExtend:()=>ib,shallowClone:()=>Rr,slugify:()=>Ls,stringifyPrimitive:()=>eo,toZod:()=>Tr,uint8ArrayToBase64:()=>$d,uint8ArrayToBase64url:()=>pb,uint8ArrayToHex:()=>mb,unwrapMessage:()=>jt});function Vy(e){return e}function Uy(e){return e}function Tr(){return e=>e}function By(e){}function Ky(e){throw new Error("Unexpected value in exhaustive check")}function Jy(e){}function Mt(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Xn(e,t="|"){return e.map(r=>eo(r)).join(t)}function Ft(e,t){return typeof t=="bigint"?t.toString():t}function Vt(e){return new Rs(e)}function Yn(e){return e==null}function De(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Nr(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}function Ds(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==pd)return n===void 0&&(n=pd,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Wy(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Y(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ut(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Ze(e){return Ut(e._zod.def)??e._zod.def.shape}function dd(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Y(this,t,n),n},enumerable:!0,configurable:!0})}function md(e,t,r){t in e?Y(e,t,r):e[t]=r}function dt(e,t,r,n){let o=Ze(t);for(let i of r){let a=Object.getOwnPropertyDescriptor(o,i);a.enumerable&&(a.get?dd(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):md(e,i,n?n(a.value,i):a.value))}}function qy(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?dd(e,r,()=>t[r]):md(e,r,n.value))}}function ze(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Hy(e){return ze(e._zod.def)}function Gy(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Xy(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function Yy(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function ne(e){return JSON.stringify(e)}function Ls(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ke(e){if(mt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(mt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Rr(e){return ke(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Qy(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function w(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:s(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:s(()=>t.error,"error")}:t}function tb(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function eo(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Fs(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}function rb(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return dt(i,e,to(e,t)),L(e,ze(r,{shape:i,checks:[]}))}function to(e,t){let r=Ze(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function nb(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(to(e,t)),a={};return dt(a,e,Reflect.ownKeys(Ze(e)).filter(c=>!i.has(c))),L(e,ze(r,{shape:a,checks:[]}))}function ob(e,t){if(!ke(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Ze(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return L(e,ze(e._zod.def,{shape:hd(e,t)}))}function hd(e,t){let r={};return dt(r,e,Reflect.ownKeys(Ze(e))),qy(r,t),r}function ib(e,t){if(!ke(t))throw new Error("Invalid input to safeExtend: expected a plain object");return L(e,ze(e._zod.def,{shape:hd(e,t)}))}function sb(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};dt(r,e,Reflect.ownKeys(Ze(e))),dt(r,t,Reflect.ownKeys(Ze(t)));let n=ze(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return L(e,n)}function ab(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(to(t,r)):void 0,u={};return dt(u,t,Reflect.ownKeys(Ze(t)),e&&((l,f)=>c&&!c.has(f)?l:new e({type:"optional",innerType:l}))),L(t,ze(t._zod.def,{shape:u,checks:[]}))}function cb(e,t,r){let n=r?new Set(to(t,r)):void 0,o={};return dt(o,t,Reflect.ownKeys(Ze(t)),(i,a)=>n&&!n.has(a)?i:new e({type:"nonoptional",innerType:i})),L(t,ze(t._zod.def,{shape:o}))}function oe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Vs(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function le(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function jt(e){return typeof e=="string"?e:e?.message}function ro(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function fe(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:jt(e.inst?._zod.def?.error?.(e))??jt(i?.(e))??jt(t?.error?.(e))??jt(r.customError?.(e))??jt(r.localeError?.(e))??"Invalid input",c={};for(let u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(c[u]=e[u]);return c.path??(c.path=[]),c.message=a,t?.reportInput&&(c.input=e.input),c}function jr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function ht(e){let t=e.length;if(!ub.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Mr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Us(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Bt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function lb(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function gd(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function $d(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function fb(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return gd(t+r)}function pb(e){return $d(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function db(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function mb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Bs(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):gb(e,r,n.value)}}function Je(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Fr(e,t,r){return Je(e,t,r,!1)}function hb(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Je(this,r,n(this))},set(o){Je(this,r,o)}})}return t}function gb(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Je(this,t,r.bind(this))},set(n){Je(this,t,n)}})}function $b(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}function N(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Ns!==e._zod){Ns=void 0;return}Ns=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,yb);let o=Ke;Ke=!1;try{let i=r(this);return Ke?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Ke=Ke||o,i}catch(i){throw delete this[t],Ke=Ke||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function bb(e,t,r,n){let o=$b(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}function Ks(e){let t=s(()=>e,"fn");return t[no]=!0,t}var Rs,pd,Qn,js,eb,Zr,Ms,Dr,Lr,ub,Zs,Ns,Ke,yb,no,W=z(()=>{We();s(Vy,"assertEqual");s(Uy,"assertNotEqual");s(Tr,"toZod");s(By,"assertIs");s(Ky,"assertNever");s(Jy,"assert");s(Mt,"getEnumValues");s(Xn,"joinValues");s(Ft,"jsonStringifyReplacer");Rs=class{static{s(this,"Cached")}constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};s(Vt,"cached");s(Yn,"nullish");s(De,"cleanRegex");s(Nr,"floatSafeRemainder");pd=Symbol("evaluating");s(Ds,"defineLazy");s(Wy,"objectClone");s(Y,"assignProp");s(Ut,"rawShape");s(Ze,"sourceShape");s(dd,"deferProp");s(md,"putProp");s(dt,"mirrorShape");s(qy,"mirrorProps");s(ze,"mergeDefs");s(Hy,"cloneDef");s(Gy,"getElementAtPath");s(Xy,"promiseAllObject");s(Yy,"randomString");s(ne,"esc");s(Ls,"slugify");Qn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};s(mt,"isObject");js=Vt(()=>{if(X.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});s(ke,"isPlainObject");s(Rr,"shallowClone");s(Qy,"numKeys");eb=s(e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},"getParsedType"),Zr=new Set(["string","number","symbol"]),Ms=new Set(["string","number","bigint","boolean","symbol","undefined"]);s(xe,"escapeRegex");s(L,"clone");s(w,"normalizeParams");s(tb,"createTransparentProxy");s(eo,"stringifyPrimitive");s(Fs,"optionalKeys");Dr={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Lr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};s(rb,"pick");s(to,"maskedKeys");s(nb,"omit");s(ob,"extend");s(hd,"extended");s(ib,"safeExtend");s(sb,"merge");s(ab,"partial");s(cb,"required");s(oe,"aborted");s(Vs,"explicitlyAborted");s(le,"prefixIssues");s(jt,"unwrapMessage");s(ro,"attachSchema");s(fe,"finalizeIssue");s(jr,"getSizableOrigin");ub=/[\uD800-\uDBFF]/;s(ht,"codePointLength");s(Mr,"getLengthableOrigin");s(Us,"parsedType");s(Bt,"issue");s(lb,"cleanEnum");s(gd,"base64ToUint8Array");s($d,"uint8ArrayToBase64");s(fb,"base64urlToUint8Array");s(pb,"uint8ArrayToBase64url");s(db,"hexToUint8Array");s(mb,"uint8ArrayToHex");Zs=class{static{s(this,"Class")}constructor(...t){}};s(Bs,"members");s(Je,"own");s(Fr,"hide");s(hb,"derived");s(gb,"defineBound");s($b,"claim");Ke=!1,yb={configurable:!0,get(){Ke=!0}};s(N,"defineLazyInternal");s(bb,"installLazyProp");no="~constantCatch";s(Ks,"constantCatch")});function wb(e){let t=bd;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return bd=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function h(e,t,r,n){let o={};function i(d){this.def=d,this.constr=p,this.traits=new Set}s(i,"Internals"),i.prototype=o;let a=r,c=a&&new WeakSet;function u(d,m){if(d._zod){if(d._zod.traits.has(e))return}else{Js.value=new i(m);try{Object.defineProperty(d,"_zod",Js)}finally{Js.value=void 0}}if(d._zod.traits.add(e),t(d,m),c){let y=Object.getPrototypeOf(d),b=d._zod.constr.prototype,x=y;for(;x&&x!==b;)x=Object.getPrototypeOf(x);let k=x??y;c.has(k)||(c.add(k),Bs(k,a))}let g=p.prototype;for(let y in g)Object.prototype.hasOwnProperty.call(g,y)&&(y in d||(d[y]=g[y].bind(d)))}s(u,"init");let l=n?.Parent??Object;class f extends l{static{s(this,"Definition")}}Object.defineProperty(f,"name",{value:e});function p(d){let m=n?.Parent?wb(f):this;u(m,d);let g=m._zod.deferred;if(g){for(let b of g)b();m._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;return y&&y(m),m}return s(p,"_"),Object.defineProperty(p,"init",{value:u}),Object.defineProperty(p,Symbol.hasInstance,{value:s(d=>n?.Parent&&d instanceof n.Parent?!0:d?._zod?.traits?.has(e),"value")}),Object.defineProperty(p,"name",{value:e}),p}function J(e){return e&&Object.assign(X,e),X}var yd,Ws,Js,bd,qs,pe,qe,X,We=z(()=>{W();Ws=Object.freeze({status:"aborted"}),Js={value:void 0,enumerable:!1},bd="captureStackTrace"in Error?Error:null;s(wb,"newError");s(h,"$constructor");qs=Symbol("zod_brand"),pe=class extends Error{static{s(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},qe=class extends Error{static{s(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(yd=globalThis).__zod_globalConfig??(yd.__zod_globalConfig={});X=globalThis.__zod_globalConfig;s(J,"config")});function _b(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Ft,2)),e.message}function vb(e){this._zod.message=e}function xb(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function Vr(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?xb(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Ur(e,t=r=>r.message){let r={_errors:[]},n=s((o,i=[])=>{for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>n({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")n({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")n({issues:a.issues},[...i,...a.path]);else{let c=[...i,...a.path];if(c.length===0)r._errors.push(t(a));else{let u=r,l=0;for(;l<c.length;){let f=c[l],p=l===c.length-1;if(f==="_errors"){p&&u._errors.push(t(a)),l++;continue}Object.prototype.hasOwnProperty.call(u,f)||Object.defineProperty(u,f,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=u[f];p&&d._errors.push(t(a)),u=d,l++}}}},"processError");return n(e),r}function Ys(e,t=r=>r.message){let r={errors:[]},n=s((o,i=[])=>{var a;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>n({issues:u},[...i,...c.path]));else if(c.code==="invalid_key")n({issues:c.issues},[...i,...c.path]);else if(c.code==="invalid_element")n({issues:c.issues},[...i,...c.path]);else{let u=[...i,...c.path];if(u.length===0){r.errors.push(t(c));continue}let l=r,f=0;for(;f<u.length;){let p=u[f],d=f===u.length-1;typeof p=="string"?(l.properties??(l.properties={}),Object.prototype.hasOwnProperty.call(l.properties,p)||Object.defineProperty(l.properties,p,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),l=l.properties[p]):(l.items??(l.items=[]),(a=l.items)[p]??(a[p]={errors:[]}),l=l.items[p]),d&&l.errors.push(t(c)),f++}}},"processError");return n(e),r}function vd(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function Qs(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${vd(n.path)}`);return t.join(`
|
|
7
|
+
var Ry=Object.create;var Gn=Object.defineProperty;var Zy=Object.getOwnPropertyDescriptor;var Dy=Object.getOwnPropertyNames;var Ly=Object.getPrototypeOf,jy=Object.prototype.hasOwnProperty;var s=(e,t)=>Gn(e,"name",{value:t,configurable:!0}),Be=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var z=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var he=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},ge=(e,t)=>{for(var r in t)Gn(e,r,{get:t[r],enumerable:!0})},My=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Dy(t))!jy.call(e,o)&&o!==r&&Gn(e,o,{get:()=>t[o],enumerable:!(n=Zy(t,o))||n.enumerable});return e};var Fy=(e,t,r)=>(r=e!=null?Ry(Ly(e)):{},My(t||!e||!e.__esModule?Gn(r,"default",{value:e,enumerable:!0}):r,e));var S={};ge(S,{BIGINT_FORMAT_RANGES:()=>Lr,CONSTANT_CATCH:()=>no,Class:()=>Zs,NUMBER_FORMAT_RANGES:()=>Dr,aborted:()=>oe,allowsEval:()=>js,assert:()=>Jy,assertEqual:()=>Vy,assertIs:()=>By,assertNever:()=>Ky,assertNotEqual:()=>Uy,assignProp:()=>Y,attachSchema:()=>ro,base64ToUint8Array:()=>gd,base64urlToUint8Array:()=>fb,cached:()=>Vt,captureStackTrace:()=>Qn,cleanEnum:()=>lb,cleanRegex:()=>De,clone:()=>j,cloneDef:()=>Hy,codePointLength:()=>ht,constantCatch:()=>Ks,createTransparentProxy:()=>tb,defineLazy:()=>Ds,defineLazyInternal:()=>N,derived:()=>hb,esc:()=>ne,escapeRegex:()=>xe,explicitlyAborted:()=>Vs,extend:()=>ob,finalizeIssue:()=>fe,floatSafeRemainder:()=>Nr,getElementAtPath:()=>Gy,getEnumValues:()=>Mt,getLengthableOrigin:()=>Mr,getParsedType:()=>eb,getSizableOrigin:()=>jr,hexToUint8Array:()=>db,hide:()=>Fr,installLazyProp:()=>bb,isObject:()=>mt,isPlainObject:()=>ke,issue:()=>Bt,joinValues:()=>Xn,jsonStringifyReplacer:()=>Ft,members:()=>Bs,merge:()=>sb,mergeDefs:()=>ze,normalizeParams:()=>w,nullish:()=>Yn,numKeys:()=>Qy,objectClone:()=>Wy,omit:()=>nb,optionalKeys:()=>Fs,own:()=>Je,parsedType:()=>Us,partial:()=>ab,pick:()=>rb,prefixIssues:()=>le,primitiveTypes:()=>Ms,promiseAllObject:()=>Xy,propertyKeyTypes:()=>Zr,randomString:()=>Yy,rawShape:()=>Ut,required:()=>cb,safeExtend:()=>ib,shallowClone:()=>Rr,slugify:()=>Ls,stringifyPrimitive:()=>eo,toZod:()=>Tr,uint8ArrayToBase64:()=>$d,uint8ArrayToBase64url:()=>pb,uint8ArrayToHex:()=>mb,unwrapMessage:()=>jt});function Vy(e){return e}function Uy(e){return e}function Tr(){return e=>e}function By(e){}function Ky(e){throw new Error("Unexpected value in exhaustive check")}function Jy(e){}function Mt(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Xn(e,t="|"){return e.map(r=>eo(r)).join(t)}function Ft(e,t){return typeof t=="bigint"?t.toString():t}function Vt(e){return new Rs(e)}function Yn(e){return e==null}function De(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Nr(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}function Ds(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==pd)return n===void 0&&(n=pd,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Wy(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Y(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ut(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Ze(e){return Ut(e._zod.def)??e._zod.def.shape}function dd(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Y(this,t,n),n},enumerable:!0,configurable:!0})}function md(e,t,r){t in e?Y(e,t,r):e[t]=r}function dt(e,t,r,n){let o=Ze(t);for(let i of r){let a=Object.getOwnPropertyDescriptor(o,i);a.enumerable&&(a.get?dd(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):md(e,i,n?n(a.value,i):a.value))}}function qy(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?dd(e,r,()=>t[r]):md(e,r,n.value))}}function ze(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Hy(e){return ze(e._zod.def)}function Gy(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Xy(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function Yy(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function ne(e){return JSON.stringify(e)}function Ls(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function mt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ke(e){if(mt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(mt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Rr(e){return ke(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Qy(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function j(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function w(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:s(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:s(()=>t.error,"error")}:t}function tb(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function eo(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Fs(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}function rb(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return dt(i,e,to(e,t)),j(e,ze(r,{shape:i,checks:[]}))}function to(e,t){let r=Ze(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function nb(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(to(e,t)),a={};return dt(a,e,Reflect.ownKeys(Ze(e)).filter(c=>!i.has(c))),j(e,ze(r,{shape:a,checks:[]}))}function ob(e,t){if(!ke(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Ze(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return j(e,ze(e._zod.def,{shape:hd(e,t)}))}function hd(e,t){let r={};return dt(r,e,Reflect.ownKeys(Ze(e))),qy(r,t),r}function ib(e,t){if(!ke(t))throw new Error("Invalid input to safeExtend: expected a plain object");return j(e,ze(e._zod.def,{shape:hd(e,t)}))}function sb(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};dt(r,e,Reflect.ownKeys(Ze(e))),dt(r,t,Reflect.ownKeys(Ze(t)));let n=ze(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return j(e,n)}function ab(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(to(t,r)):void 0,u={};return dt(u,t,Reflect.ownKeys(Ze(t)),e&&((l,f)=>c&&!c.has(f)?l:new e({type:"optional",innerType:l}))),j(t,ze(t._zod.def,{shape:u,checks:[]}))}function cb(e,t,r){let n=r?new Set(to(t,r)):void 0,o={};return dt(o,t,Reflect.ownKeys(Ze(t)),(i,a)=>n&&!n.has(a)?i:new e({type:"nonoptional",innerType:i})),j(t,ze(t._zod.def,{shape:o}))}function oe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Vs(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function le(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function jt(e){return typeof e=="string"?e:e?.message}function ro(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function fe(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:jt(e.inst?._zod.def?.error?.(e))??jt(i?.(e))??jt(t?.error?.(e))??jt(r.customError?.(e))??jt(r.localeError?.(e))??"Invalid input",c={};for(let u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(c[u]=e[u]);return c.path??(c.path=[]),c.message=a,t?.reportInput&&(c.input=e.input),c}function jr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function ht(e){let t=e.length;if(!ub.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Mr(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Us(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Bt(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function lb(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function gd(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function $d(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function fb(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return gd(t+r)}function pb(e){return $d(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function db(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function mb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}function Bs(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):gb(e,r,n.value)}}function Je(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Fr(e,t,r){return Je(e,t,r,!1)}function hb(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Je(this,r,n(this))},set(o){Je(this,r,o)}})}return t}function gb(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Je(this,t,r.bind(this))},set(n){Je(this,t,n)}})}function $b(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}function N(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Ns!==e._zod){Ns=void 0;return}Ns=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,yb);let o=Ke;Ke=!1;try{let i=r(this);return Ke?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Ke=Ke||o,i}catch(i){throw delete this[t],Ke=Ke||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function bb(e,t,r,n){let o=$b(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}function Ks(e){let t=s(()=>e,"fn");return t[no]=!0,t}var Rs,pd,Qn,js,eb,Zr,Ms,Dr,Lr,ub,Zs,Ns,Ke,yb,no,W=z(()=>{We();s(Vy,"assertEqual");s(Uy,"assertNotEqual");s(Tr,"toZod");s(By,"assertIs");s(Ky,"assertNever");s(Jy,"assert");s(Mt,"getEnumValues");s(Xn,"joinValues");s(Ft,"jsonStringifyReplacer");Rs=class{static{s(this,"Cached")}constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};s(Vt,"cached");s(Yn,"nullish");s(De,"cleanRegex");s(Nr,"floatSafeRemainder");pd=Symbol("evaluating");s(Ds,"defineLazy");s(Wy,"objectClone");s(Y,"assignProp");s(Ut,"rawShape");s(Ze,"sourceShape");s(dd,"deferProp");s(md,"putProp");s(dt,"mirrorShape");s(qy,"mirrorProps");s(ze,"mergeDefs");s(Hy,"cloneDef");s(Gy,"getElementAtPath");s(Xy,"promiseAllObject");s(Yy,"randomString");s(ne,"esc");s(Ls,"slugify");Qn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};s(mt,"isObject");js=Vt(()=>{if(X.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});s(ke,"isPlainObject");s(Rr,"shallowClone");s(Qy,"numKeys");eb=s(e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},"getParsedType"),Zr=new Set(["string","number","symbol"]),Ms=new Set(["string","number","bigint","boolean","symbol","undefined"]);s(xe,"escapeRegex");s(j,"clone");s(w,"normalizeParams");s(tb,"createTransparentProxy");s(eo,"stringifyPrimitive");s(Fs,"optionalKeys");Dr={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Lr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};s(rb,"pick");s(to,"maskedKeys");s(nb,"omit");s(ob,"extend");s(hd,"extended");s(ib,"safeExtend");s(sb,"merge");s(ab,"partial");s(cb,"required");s(oe,"aborted");s(Vs,"explicitlyAborted");s(le,"prefixIssues");s(jt,"unwrapMessage");s(ro,"attachSchema");s(fe,"finalizeIssue");s(jr,"getSizableOrigin");ub=/[\uD800-\uDBFF]/;s(ht,"codePointLength");s(Mr,"getLengthableOrigin");s(Us,"parsedType");s(Bt,"issue");s(lb,"cleanEnum");s(gd,"base64ToUint8Array");s($d,"uint8ArrayToBase64");s(fb,"base64urlToUint8Array");s(pb,"uint8ArrayToBase64url");s(db,"hexToUint8Array");s(mb,"uint8ArrayToHex");Zs=class{static{s(this,"Class")}constructor(...t){}};s(Bs,"members");s(Je,"own");s(Fr,"hide");s(hb,"derived");s(gb,"defineBound");s($b,"claim");Ke=!1,yb={configurable:!0,get(){Ke=!0}};s(N,"defineLazyInternal");s(bb,"installLazyProp");no="~constantCatch";s(Ks,"constantCatch")});function wb(e){let t=bd;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return bd=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function h(e,t,r,n){let o={};function i(d){this.def=d,this.constr=p,this.traits=new Set}s(i,"Internals"),i.prototype=o;let a=r,c=a&&new WeakSet;function u(d,m){if(d._zod){if(d._zod.traits.has(e))return}else{Js.value=new i(m);try{Object.defineProperty(d,"_zod",Js)}finally{Js.value=void 0}}if(d._zod.traits.add(e),t(d,m),c){let y=Object.getPrototypeOf(d),b=d._zod.constr.prototype,x=y;for(;x&&x!==b;)x=Object.getPrototypeOf(x);let k=x??y;c.has(k)||(c.add(k),Bs(k,a))}let g=p.prototype;for(let y in g)Object.prototype.hasOwnProperty.call(g,y)&&(y in d||(d[y]=g[y].bind(d)))}s(u,"init");let l=n?.Parent??Object;class f extends l{static{s(this,"Definition")}}Object.defineProperty(f,"name",{value:e});function p(d){let m=n?.Parent?wb(f):this;u(m,d);let g=m._zod.deferred;if(g){for(let b of g)b();m._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;return y&&y(m),m}return s(p,"_"),Object.defineProperty(p,"init",{value:u}),Object.defineProperty(p,Symbol.hasInstance,{value:s(d=>n?.Parent&&d instanceof n.Parent?!0:d?._zod?.traits?.has(e),"value")}),Object.defineProperty(p,"name",{value:e}),p}function J(e){return e&&Object.assign(X,e),X}var yd,Ws,Js,bd,qs,pe,qe,X,We=z(()=>{W();Ws=Object.freeze({status:"aborted"}),Js={value:void 0,enumerable:!1},bd="captureStackTrace"in Error?Error:null;s(wb,"newError");s(h,"$constructor");qs=Symbol("zod_brand"),pe=class extends Error{static{s(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},qe=class extends Error{static{s(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(yd=globalThis).__zod_globalConfig??(yd.__zod_globalConfig={});X=globalThis.__zod_globalConfig;s(J,"config")});function _b(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Ft,2)),e.message}function vb(e){this._zod.message=e}function xb(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function Vr(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?xb(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Ur(e,t=r=>r.message){let r={_errors:[]},n=s((o,i=[])=>{for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>n({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")n({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")n({issues:a.issues},[...i,...a.path]);else{let c=[...i,...a.path];if(c.length===0)r._errors.push(t(a));else{let u=r,l=0;for(;l<c.length;){let f=c[l],p=l===c.length-1;if(f==="_errors"){p&&u._errors.push(t(a)),l++;continue}Object.prototype.hasOwnProperty.call(u,f)||Object.defineProperty(u,f,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=u[f];p&&d._errors.push(t(a)),u=d,l++}}}},"processError");return n(e),r}function Ys(e,t=r=>r.message){let r={errors:[]},n=s((o,i=[])=>{var a;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>n({issues:u},[...i,...c.path]));else if(c.code==="invalid_key")n({issues:c.issues},[...i,...c.path]);else if(c.code==="invalid_element")n({issues:c.issues},[...i,...c.path]);else{let u=[...i,...c.path];if(u.length===0){r.errors.push(t(c));continue}let l=r,f=0;for(;f<u.length;){let p=u[f],d=f===u.length-1;typeof p=="string"?(l.properties??(l.properties={}),Object.prototype.hasOwnProperty.call(l.properties,p)||Object.defineProperty(l.properties,p,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),l=l.properties[p]):(l.items??(l.items=[]),(a=l.items)[p]??(a[p]={errors:[]}),l=l.items[p]),d&&l.errors.push(t(c)),f++}}},"processError");return n(e),r}function vd(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function Qs(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${vd(n.path)}`);return t.join(`
|
|
8
8
|
`)}var kb,Gs,wd,_d,Xs,de,ea=z(()=>{We();W();s(_b,"_getMessage");s(vb,"_setMessage");kb={get:_b,set:vb,enumerable:!0,configurable:!0},Gs={value:void 0,enumerable:!1},wd=new WeakSet([Object.prototype,Error.prototype]),_d=s((e,t)=>{e.name="$ZodError",Gs.value=t,Object.defineProperty(e,"issues",Gs),Gs.value=void 0,Object.defineProperty(e,"message",kb);let r=Object.getPrototypeOf(e);wd.has(r)||(wd.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=s(()=>this.message,"value");return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},"initializer"),Xs=h("$ZodError",_d),de=h("$ZodError",_d,void 0,{Parent:Error});s(xb,"node");s(Vr,"flattenError");s(Ur,"formatError");s(Ys,"treeifyError");s(vd,"toDotPath");s(Qs,"prettifyError")});function oo(e,t){return{callee:t?.callee??e,Err:t?.Err}}function kd(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>fe(o,r,J()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}function Ob(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[Ab]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new pe;return i.issues.length===0}var Kt,io,Jt,so,Wt,zb,qt,Pb,Ib,Ab,Br,Kr,ao,Cb,co,Eb,uo,Tb,lo,Nb,fo,Rb,po,Zb,mo,Db,ho,Lb,ta=z(()=>{We();ea();W();s(oo,"finalizeParams");Kt=s(e=>{let t=s((r,n,o,i)=>{let a=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},a);if(c instanceof Promise)throw new pe;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map(l=>fe(l,a,J())));throw Qn(u,i?.callee??t),u}return c.value},"fn");return t},"_parse"),io=Kt(de),Jt=s(e=>{let t=s(async(r,n,o,i)=>{let a=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},a);if(c instanceof Promise&&(c=await c),c.issues.length){let u=new(i?.Err??e)(c.issues.map(l=>fe(l,a,J())));throw Qn(u,i?.callee??t),u}return c.value},"fn");return t},"_parseAsync"),so=Jt(de),Wt=s(e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new pe;return i.issues.length?kd(e,i.issues,o):{success:!0,data:i.value}},"_safeParse"),zb=Wt(de);s(kd,"failure");qt=s(e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?kd(e,i.issues,o):{success:!0,data:i.value}},"_safeParseAsync"),Pb=qt(de),Ib=Symbol.for("zod.compile.invalid"),Ab=Symbol.for("zod.compile.fallback"),Br=s(((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Ib)return!0;if(n.definite===!0&&r===void 0)return!1}return Ob(e,t,r)}),"validate");s(Ob,"validateFallback");Kr=s(async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},"validateAsync"),ao=s(e=>{let t=Kt(e),r=s((n,o,i,a)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,oo(r,a))},"fn");return r},"_encode"),Cb=ao(de),co=s(e=>{let t=Kt(e),r=s((n,o,i,a)=>t(n,o,i,oo(r,a)),"fn");return r},"_decode"),Eb=co(de),uo=s(e=>{let t=Jt(e),r=s(async(n,o,i,a)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,oo(r,a))},"fn");return r},"_encodeAsync"),Tb=uo(de),lo=s(e=>{let t=Jt(e),r=s(async(n,o,i,a)=>await t(n,o,i,oo(r,a)),"fn");return r},"_decodeAsync"),Nb=lo(de),fo=s(e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Wt(e)(t,r,o)},"_safeEncode"),Rb=fo(de),po=s(e=>(t,r,n)=>Wt(e)(t,r,n),"_safeDecode"),Zb=po(de),mo=s(e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return qt(e)(t,r,o)},"_safeEncodeAsync"),Db=mo(de),ho=s(e=>async(t,r,n)=>qt(e)(t,r,n),"_safeDecodeAsync"),Lb=ho(de)});var Se={};ge(Se,{anyString:()=>Ia,base64:()=>ba,base64url:()=>wa,bigint:()=>Oa,boolean:()=>Ca,browserEmail:()=>Jb,cidrv4:()=>$a,cidrv6:()=>ya,creditCard:()=>go,cuid:()=>na,cuid2:()=>oa,currencyCode:()=>xa,date:()=>Sa,datetime:()=>Pa,domain:()=>va,duration:()=>la,e164:()=>ka,email:()=>pa,emoji:()=>da,extendedDuration:()=>jb,guid:()=>fa,hex:()=>Za,hostname:()=>_a,html5Email:()=>Ub,httpProtocol:()=>Jr,iban:()=>$o,idnEmail:()=>Kb,integer:()=>Wr,ipv4:()=>ma,ipv6:()=>ha,ksuid:()=>aa,lowercase:()=>Na,mac:()=>ga,md5_base64:()=>Gb,md5_base64url:()=>Xb,md5_hex:()=>Hb,nanoid:()=>ca,nanoidOfLength:()=>ua,null:()=>Ea,number:()=>Le,rfc5322Email:()=>Bb,sha1_base64:()=>Qb,sha1_base64url:()=>ew,sha1_hex:()=>Yb,sha256_base64:()=>rw,sha256_base64url:()=>nw,sha256_hex:()=>tw,sha384_base64:()=>iw,sha384_base64url:()=>sw,sha384_hex:()=>ow,sha512_base64:()=>cw,sha512_base64url:()=>uw,sha512_hex:()=>aw,string:()=>Aa,time:()=>za,ulid:()=>ia,undefined:()=>Ta,unicodeEmail:()=>xd,uppercase:()=>Ra,uuid:()=>gt,uuid4:()=>Mb,uuid6:()=>Fb,uuid7:()=>Vb,xid:()=>sa});function ua(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}function da(){return new RegExp(Wb,"u")}function qb(e){return new RegExp(`^${e}$`)}function ra(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function za(e){return new RegExp(`^${ra(e)}$`)}function Pa(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${ra({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${ra({precision:e.precision})}`:r;return new RegExp(`^${Sd}T(?:${n})$`)}function qr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Hr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var na,oa,ia,sa,aa,ca,la,jb,fa,gt,Mb,Fb,Vb,pa,Ub,Bb,xd,Kb,Jb,Wb,ma,ha,ga,$a,ya,ba,wa,_a,va,Jr,ka,go,xa,$o,Sd,Sa,Ia,Aa,Oa,Wr,Le,Ca,Ea,Ta,Na,Ra,Za,Hb,Gb,Xb,Yb,Qb,ew,tw,rw,nw,ow,iw,sw,aw,cw,uw,$t=z(()=>{W();na=/^[cC][0-9a-z]{6,}$/,oa=/^[0-9a-z]+$/,ia=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,sa=/^[0-9a-vA-V]{20}$/,aa=/^[A-Za-z0-9]{27}$/,ca=/^[a-zA-Z0-9_-]{21}$/;s(ua,"nanoidOfLength");la=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,jb=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,fa=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,gt=s(e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,"uuid"),Mb=gt(4),Fb=gt(6),Vb=gt(7),pa=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ub=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Bb=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,xd=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Kb=xd,Jb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Wb="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";s(da,"emoji");ma=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ha=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ga=s(e=>{let t=xe(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},"mac"),$a=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ya=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ba=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wa=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,_a=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,va=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Jr=/^https?$/,ka=/^\+[1-9]\d{6,14}$/,go=/^\d(?:[ -]?\d){11,18}$/,xa=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,$o=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,Sd="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";s(qb,"anchor");Sa=qb(Sd);s(ra,"timeSource");s(za,"time");s(Pa,"datetime");Ia=/^[\s\S]{0,}$/,Aa=s(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),Oa=/^-?\d+n?$/,Wr=/^-?\d+$/,Le=/^-?\d+(?:\.\d+)?$/,Ca=/^(?:true|false)$/i,Ea=/^null$/i,Ta=/^undefined$/i,Na=/^[^A-Z]*$/,Ra=/^[^a-z]*$/,Za=/^[0-9a-fA-F]*$/;s(qr,"fixedBase64");s(Hr,"fixedBase64url");Hb=/^[0-9a-fA-F]{32}$/,Gb=qr(22,"=="),Xb=Hr(22),Yb=/^[0-9a-fA-F]{40}$/,Qb=qr(27,"="),ew=Hr(27),tw=/^[0-9a-fA-F]{64}$/,rw=qr(43,"="),nw=Hr(43),ow=/^[0-9a-fA-F]{96}$/,iw=qr(64,""),sw=Hr(64),aw=/^[0-9a-fA-F]{128}$/,cw=qr(86,"=="),uw=Hr(86)});function bo(e,t,r){e.issues.length&&t.issues.push(...le(r,e.issues))}var U,Da,La,yo,wo,_o,ja,Ma,Fa,Va,Ua,Ba,Ka,Ja,Wa,Ht,qa,Ha,Ga,Xa,Ya,Qa,ec,tc,rc,nc,vo=z(()=>{We();$t();W();U=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Da=s(e=>{let t=e.value;return!Yn(t)&&t.size!==void 0},"_whenHasSize"),La=s(e=>{let t=e.value;return!Yn(t)&&t.length!==void 0},"_whenHasLength"),yo={number:"number",bigint:"bigint",object:"date"},wo=h("$ZodCheckLessThan",(e,t)=>{U.init(e,t);let r=yo[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:yo[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_o=h("$ZodCheckGreaterThan",(e,t)=>{U.init(e,t);let r=yo[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:yo[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ja=h("$ZodCheckMultipleOf",(e,t)=>{U.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Nr(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Ma=h("$ZodCheckNumberFormat",(e,t)=>{U.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Dr[t.format];e._zod.check=a=>{let c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<o&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Fa=h("$ZodCheckBigIntFormat",(e,t)=>{U.init(e,t);let[r,n]=Lr[t.format];e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Va=h("$ZodCheckMaxSize",(e,t)=>{var r;U.init(e,t),(r=e._zod.def).when??(r.when=Da),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:jr(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ua=h("$ZodCheckMinSize",(e,t)=>{var r;U.init(e,t),(r=e._zod.def).when??(r.when=Da),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:jr(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ba=h("$ZodCheckSizeEquals",(e,t)=>{var r;U.init(e,t),(r=e._zod.def).when??(r.when=Da),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:jr(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ka=h("$ZodCheckMaxLength",(e,t)=>{var r;U.init(e,t),(r=e._zod.def).when??(r.when=La),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?ht(o):i)<=t.maximum)return;let c=Mr(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ja=h("$ZodCheckMinLength",(e,t)=>{var r;U.init(e,t),(r=e._zod.def).when??(r.when=La),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?ht(o):i)>=t.minimum)return;let c=Mr(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Wa=h("$ZodCheckLengthEquals",(e,t)=>{var r;U.init(e,t),(r=e._zod.def).when??(r.when=La),e._zod.check=n=>{let o=n.value,i=o.length,a=typeof o=="string"&&i>=t.length&&i<=t.length*2?ht(o):i;if(a===t.length)return;let c=Mr(o),u=a>t.length;n.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ht=h("$ZodCheckStringFormat",(e,t)=>{var r,n;U.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),qa=h("$ZodCheckRegex",(e,t)=>{Ht.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ha=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Na),Ht.init(e,t)}),Ga=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ra),Ht.init(e,t)}),Xa=h("$ZodCheckIncludes",(e,t)=>{U.init(e,t);let r=xe(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Ya=h("$ZodCheckStartsWith",(e,t)=>{U.init(e,t);let r=new RegExp(`^${xe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Qa=h("$ZodCheckEndsWith",(e,t)=>{U.init(e,t);let r=new RegExp(`.*${xe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});s(bo,"handleCheckPropertyResult");ec=h("$ZodCheckProperty",(e,t)=>{U.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>bo(o,r,t.property));bo(n,r,t.property)}}),tc=h("$ZodCheckProperties",(e,t)=>{U.init(e,t),Fr(e,Symbol.iterator,function*(){yield e});let r;e._zod.check=n=>{if(n.value==null){n.issues.push({expected:"object",code:"invalid_type",input:n.value,inst:e});return}r??(r=Reflect.ownKeys(t.shape).map(a=>[a,t.shape[a]]));let o=n.value,i;for(let[a,c]of r){let u=c._zod.run({value:o[a],issues:[]},{});u instanceof Promise?(i??(i=[]),i.push(u.then(l=>bo(l,n,a)))):bo(u,n,a)}if(i)return Promise.all(i).then(()=>{})}}),rc=h("$ZodCheckMimeType",(e,t)=>{U.init(e,t);let r=new Set(t.mime);e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),nc=h("$ZodCheckOverwrite",(e,t)=>{U.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}})});var yt,ko=z(()=>{yt=class{static{s(this,"Doc")}constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
9
9
|
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
10
10
|
${r.join(`
|
|
11
11
|
`)}
|
|
12
|
-
};`)(...Object.values(this.closed))}}});var oc,ic=z(()=>{oc={major:4,minor:6,patch:5}});async function lw(e,t){let r={async:!0};return Vd(await e._zod.run({value:t,issues:[]},r),r)}function Io(e){return{validate:s(t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Vd(n,r)}catch{}return lw(e,t)},"validate"),vendor:"zod",version:1}}function fc(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Ao(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?fc(e)||Gr:Ud(e,t)}function Ud(e,t){if(!t.normalize&&t.protocol?.source===Jr.source&&!/^https?:\/\//i.test(e))return lc;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??Gr}return new URL(e)}catch{return Gr}}function Xr(e){return e.replace(fw,"")}function Oo(e,t){return t.lastIndex=0,t.test(e.hostname)}function Co(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}function Yr(e){return pw.test(e)?fc(`http://[${e}]`):!1}function Eo(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:Yr(r)}function Qr(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function No(e){if(!en.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Qr(r)}function mw(e){let t=e.length,r=1,n=0;for(;t;){let o=e.charCodeAt(--t)-48;r^=1,n+=r?[0,2,4,6,8,1,3,5,7,9][o]:o}return n%10===0}function Ro(e){return go.test(e)?mw(e.replace(dw,"")):!1}function hw(e){let t=0,r=e.length;for(let n=4;n<r;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let n=0;n<4;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function Zo(e){return $o.test(e)?hw(e):!1}function Do(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}function Pd(e,t,r){e.issues.length&&t.issues.push(...le(r,e.issues)),t.value[r]=e.value}function Po(e,t,r,n,o,i){let a=r in n,c=i==="optional";if(!(!a&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!a)return;t.issues.push(...le(r,e.issues))}if(!a&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(a||o==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}function Bd(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:gw,o=n.length?[...t,...n]:t;for(let a of o)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(a)}": expected a Zod schema`);let i=Fs(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Kd(e,t,r,n,o,i,a){let c=[],u=o.keySet,l=o.catchall._zod,f=l.def.type,p=l.optin,d=l.optout,m=0;for(let g in t){if(a&&r.issues.length!==m){if(oe(r,m))break;m=r.issues.length}if(u.has(g))continue;if(g==="__proto__"){f==="never"&&c.push(g);continue}if(f==="never"){c.push(g);continue}let y=l.run({value:t[g],issues:[]},n);y instanceof Promise?e.push(y.then(b=>Po(b,r,g,t,p,d))):Po(y,r,g,t,p,d)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}function Id(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!oe(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>fe(a,n,J())))}),t)}function Ad(e,t,r,n){let o=[];for(let i=0;i<e.length;i++)e[i].issues.length===0&&o.push(i);return o.length===1?(t.value=e[o[0]].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>fe(a,n,J())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:o}),t)}function Hc(e,t){let r=e._zod,n=r.bag.optionsMap;n||(n=Wd(r.def),r.bag.optionsMap=n);let o=n.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}function Wd(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}function Gt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ke(e)&&ke(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let a=Gt(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],a=Gt(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Od(e,t,r){let n=new Map,o,i=new Map,a=s((l,f)=>{let p;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),p=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let d=String(l.path[0]);i.has(d)||i.set(d,l),p=[d]}else return!1;for(let d of p)n.has(d)||n.set(d,{}),n.get(d)[f]=!0;return!0},"collect");for(let l of t.issues)a(l,"l")||e.issues.push(l);for(let l of r.issues)a(l,"r")||e.issues.push(l);let c=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(c.length){let l=o?c.filter(f=>o.keys.includes(f)):[];l.length&&e.issues.push({...o,keys:l});for(let f of c)!l.includes(f)&&i.has(f)&&e.issues.push(i.get(f))}let u=Gt(t.value,r.value);if(!u.valid){if(oe(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}function Cd(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 Ed(e,t,r){e.issues.length&&t.issues.push(...le(r,e.issues)),t.value[r]=e.value}function Td(e,t,r,n,o){for(let i=0;i<r.length;i++){let a=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(a.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...le(i,a.issues))}t.value[i]=a.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}function Nd(e,t,r,n,o,i,a){e.issues.length&&(Zr.has(typeof n)?r.issues.push(...le(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(c=>fe(c,a,J()))})),t.issues.length&&(Zr.has(typeof n)?r.issues.push(...le(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(c=>fe(c,a,J()))})),r.value.set(e.value,t.value)}function Rd(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function Zd(e,t){return e.value=t.issues.length?void 0:t.value,e}function Dd(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function Ld(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function jd(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>fe(o,n,J()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}function xo(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}function So(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>zo(e,i,t.out,r)):zo(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>zo(e,i,t.in,r)):zo(e,o,t.in,r)}}function zo(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}function Md(e){return e.memo||(e.value=Object.freeze(e.value)),e}function $w(e){let t=e._zod.def,r=t.pattern,n=!!t.format?.includes("int"),o,i;for(let c of t.checks??[]){let u=c._zod.def;u.pattern&&(r=u.pattern),n||(n=!!u.format?.includes("int"));let l=u.minimum??u.length,f=u.maximum??u.length;l!==void 0&&(o===void 0||l>o)&&(o=l),f!==void 0&&(i===void 0||f<i)&&(i=f)}if(r)return r.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Aa({minimum:o,maximum:i}).source;let a=e._zod.pattern;return(n&&a===Le?Wr:a)?.source}function sc(e){let t=e._zod.def,r=e._zod.pattern?.source,n=t.innerType??e._zod.innerType;if(n){let o=n._zod.pattern?.source,i=sc(n);return r&&o&&i&&i!==o?r.replace(De(o),()=>De(i)):r}if(t.options){let o=t.options.map(sc);if(o.every(Boolean))return`^(${o.map(i=>De(i)).join("|")})$`}return $w(e)}function Fd(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Bt(o))}}var E,Vd,bt,j,ac,cc,uc,lc,Gr,fw,pc,dc,mc,hc,gc,$c,yc,bc,wc,_c,vc,kc,xc,pw,Sc,zc,Pc,Ic,To,Ac,en,Oc,Cc,dw,Ec,Tc,Nc,Rc,Lo,Zc,tn,jo,Dc,Lc,jc,Mc,Fc,Vc,Uc,Bc,Kc,Jc,gw,Jd,Wc,rn,qc,Gc,Xc,Mo,Yc,Qc,eu,tu,ru,nu,ou,Fo,iu,su,au,cu,uu,lu,fu,pu,Vo,nn,du,mu,hu,gu,$u,on,yu,Xt=z(()=>{vo();We();ko();ta();$t();W();ic();W();E=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=oc;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let a of i._zod.onattach)a(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=s((c,u,l)=>{if(c.memo)return c;let f=oe(c),p;for(let d of u){if(d._zod.def.when){if(Vs(c)||!d._zod.def.when(c))continue}else if(f)continue;let m=c.issues.length,g=d._zod.check(c);if(g instanceof Promise&&l?.async===!1)throw new pe;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,c.issues.length!==m&&(ro(c.issues,m,e),f||(f=oe(c,m)))});else{if(c.issues.length===m)continue;ro(c.issues,m,e),f||(f=oe(c,m))}}return p?p.then(()=>c):c},"runChecks"),a=s((c,u,l)=>{if(oe(c))return c.aborted=!0,c;let f=i(u,o,l);if(f instanceof Promise){if(l.async===!1)throw new pe;return f.then(p=>e._zod.parse(p,l))}return e._zod.parse(f,l)},"handleCanaryResult");e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){let f=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});return f instanceof Promise?f.then(p=>a(p,c,u)):a(f,c,u)}let l=e._zod.parse(c,u);if(l instanceof Promise){if(u.async===!1)throw new pe;return l.then(f=>i(f,o,u))}return i(l,o,u)}}},{get"~standard"(){return Fr(this,"~standard",Io(this))},set"~standard"(e){Je(this,"~standard",e)}}),Vd=s((e,t)=>e.issues.length?{issues:e.issues.map(r=>fe(r,t,J()))}:{value:e.value},"toStandardResult");s(lw,"validateAsync");s(Io,"standardProps");bt=h("$ZodString",(e,t)=>{E.init(e,t),e._zod.pattern=t.pattern??Ia,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),j=h("$ZodStringFormat",(e,t)=>{Ht.init(e,t),bt.init(e,t)}),ac=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=fa),j.init(e,t)}),cc=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gt(n))}else t.pattern??(t.pattern=gt());j.init(e,t)}),uc=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=pa),j.init(e,t)}),lc=1,Gr=2;s(fc,"canParseURL");s(Ao,"validateURL");s(Ud,"parseURLObject");fw=/[\t\n\r]/g;s(Xr,"stripTabAndNewline");s(Oo,"urlHostnameOk");s(Co,"urlProtocolOk");pc=h("$ZodURL",(e,t)=>{j.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=Ao(n,t);if(o===lc){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Gr){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Xr(n);return}t.hostname&&!Oo(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!Co(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:Xr(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),dc=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=da()),j.init(e,t)}),mc=h("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?ca:ua(t.length)),j.init(e,t)}),hc=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=na),j.init(e,t)}),gc=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=oa),j.init(e,t)}),$c=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ia),j.init(e,t)}),yc=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=sa),j.init(e,t)}),bc=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=aa),j.init(e,t)}),wc=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Pa(t)),j.init(e,t)}),_c=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Sa),j.init(e,t)}),vc=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=za(t)),j.init(e,t)}),kc=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=la),j.init(e,t)}),xc=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ma),j.init(e,t)}),pw=/^[0-9a-fA-F:.]+$/;s(Yr,"isValidIPv6");Sc=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ha),j.init(e,t),e._zod.check=r=>{Yr(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),zc=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=ga(t.delimiter)),j.init(e,t)}),Pc=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=$a),j.init(e,t)});s(Eo,"isValidCIDRv6");Ic=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ya),j.init(e,t),e._zod.check=r=>{Eo(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});s(Qr,"isValidBase64");To=/^[0-9a-zA-Z+/]*={0,2}$/,Ac=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=To),j.init(e,t),e._zod.check=r=>{Qr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),en=/^[A-Za-z0-9_-]*$/;s(No,"isValidBase64URL");Oc=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=en),j.init(e,t),e._zod.check=r=>{No(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Cc=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ka),j.init(e,t)}),dw=/[- ]/g;s(mw,"isLuhnAlgo");s(Ro,"isValidCreditCard");Ec=h("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=go),j.init(e,t),e._zod.check=r=>{Ro(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});s(hw,"isIso7064Mod97");s(Zo,"isValidIBAN");Tc=h("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=$o),j.init(e,t),e._zod.check=r=>{Zo(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});s(Do,"isValidJWT");Nc=h("$ZodJWT",(e,t)=>{j.init(e,t),e._zod.check=r=>{Do(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Rc=h("$ZodCustomStringFormat",(e,t)=>{j.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Lo=h("$ZodNumber",(e,t)=>{E.init(e,t),e._zod.pattern=Le,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Zc=h("$ZodNumberFormat",(e,t)=>{Ma.init(e,t),Lo.init(e,t)}),tn=h("$ZodBoolean",(e,t)=>{E.init(e,t),e._zod.pattern=Ca,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),jo=h("$ZodBigInt",(e,t)=>{E.init(e,t),e._zod.pattern=Oa,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Dc=h("$ZodBigIntFormat",(e,t)=>{Fa.init(e,t),jo.init(e,t)}),Lc=h("$ZodSymbol",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),jc=h("$ZodUndefined",(e,t)=>{E.init(e,t),e._zod.pattern=Ta,e._zod.values=new Set([void 0]),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),Mc=h("$ZodNull",(e,t)=>{E.init(e,t),e._zod.pattern=Ea,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Fc=h("$ZodAny",(e,t)=>{E.init(e,t),e._zod.parse=r=>r}),Vc=h("$ZodUnknown",(e,t)=>{E.init(e,t),e._zod.parse=r=>r}),Uc=h("$ZodNever",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Bc=h("$ZodVoid",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Kc=h("$ZodDate",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});s(Pd,"handleArrayResult");Jc=h("$ZodArray",(e,t)=>{E.init(e,t);let r=X.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let a=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let l=i[u],f=t.element._zod.run({value:l,issues:[]},o);if(f instanceof Promise)a.push(f.then(p=>Pd(p,n,u)));else if(Pd(f,n,u),c&&f.issues.length!==0&&oe(f))break}return a.length?Promise.all(a).then(()=>n):n}});s(Po,"handlePropertyResult");gw=[];s(Bd,"normalizeDef");s(Kd,"handleCatchall");Jd=h("$ZodObject",(e,t)=>{E.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let l=s(()=>{let f={...n};return Object.defineProperty(t,"shape",{value:f}),l.raw=f,f},"get");l.raw=n,Object.defineProperty(t,"shape",{get:l})}let o=Vt(()=>Bd(t));N(e,"propValues",l=>{let f=l.def.shape,p={};for(let d in f){let m=f[d]._zod;if(m.values){Object.prototype.hasOwnProperty.call(p,d)||Y(p,d,new Set);for(let g of m.values)p[d].add(g);m.optin!==void 0&&p[d].add(void 0)}}return p});let i=mt,a=t.catchall,c,u=X.memoizer;u?.attach(e),e._zod.parse=(l,f)=>{c??(c=o.value);let p=l.value;if(!i(p))return l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l;l.value=u?u.alloc(e,l,{},f):{};let d=[],m=c.shape,g=f?.abortEarly,y=l.issues.length;for(let b of c.allKeys){if(g&&l.issues.length!==y){if(oe(l,y))break;y=l.issues.length}if(b==="__proto__")continue;let x=m[b],k=x._zod.optin,O=x._zod.optout,D=x._zod.run({value:p[b],issues:[]},f);D instanceof Promise?d.push(D.then(F=>Po(F,l,b,p,k,O))):Po(D,l,b,p,k,O)}return a?Kd(d,p,l,f,o.value,e,g===!0):d.length?Promise.all(d).then(()=>l):l}}),Wc=h("$ZodObjectJIT",(e,t)=>{Jd.init(e,t);let r=e._zod.parse,n=Vt(()=>Bd(t)),o=X.memoizer,i=s(m=>{let g=n.value,y=g.symbolKeys,b=new yt(["payload","ctx"],{shape:m,inst:e,memo:o,syms:y}),x=s(F=>`shape[${F}]._zod.run({ value: input[${F}], issues: [] }, ctx)`,"parseStr"),k=s((F,R)=>`
|
|
13
|
-
let ${
|
|
14
|
-
for (let i = 0; i < ${
|
|
15
|
-
const iss = ${
|
|
16
|
-
iss.path = iss.path ? [${
|
|
12
|
+
};`)(...Object.values(this.closed))}}});var oc,ic=z(()=>{oc={major:4,minor:6,patch:5}});async function lw(e,t){let r={async:!0};return Vd(await e._zod.run({value:t,issues:[]},r),r)}function Io(e){return{validate:s(t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Vd(n,r)}catch{}return lw(e,t)},"validate"),vendor:"zod",version:1}}function fc(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Ao(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?fc(e)||Gr:Ud(e,t)}function Ud(e,t){if(!t.normalize&&t.protocol?.source===Jr.source&&!/^https?:\/\//i.test(e))return lc;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??Gr}return new URL(e)}catch{return Gr}}function Xr(e){return e.replace(fw,"")}function Oo(e,t){return t.lastIndex=0,t.test(e.hostname)}function Co(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}function Yr(e){return pw.test(e)?fc(`http://[${e}]`):!1}function Eo(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:Yr(r)}function Qr(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function No(e){if(!en.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Qr(r)}function mw(e){let t=e.length,r=1,n=0;for(;t;){let o=e.charCodeAt(--t)-48;r^=1,n+=r?[0,2,4,6,8,1,3,5,7,9][o]:o}return n%10===0}function Ro(e){return go.test(e)?mw(e.replace(dw,"")):!1}function hw(e){let t=0,r=e.length;for(let n=4;n<r;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let n=0;n<4;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function Zo(e){return $o.test(e)?hw(e):!1}function Do(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}function Pd(e,t,r){e.issues.length&&t.issues.push(...le(r,e.issues)),t.value[r]=e.value}function Po(e,t,r,n,o,i){let a=r in n,c=i==="optional";if(!(!a&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!a)return;t.issues.push(...le(r,e.issues))}if(!a&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(a||o==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}function Bd(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:gw,o=n.length?[...t,...n]:t;for(let a of o)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(a)}": expected a Zod schema`);let i=Fs(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Kd(e,t,r,n,o,i,a){let c=[],u=o.keySet,l=o.catchall._zod,f=l.def.type,p=l.optin,d=l.optout,m=0;for(let g in t){if(a&&r.issues.length!==m){if(oe(r,m))break;m=r.issues.length}if(u.has(g))continue;if(g==="__proto__"){f==="never"&&c.push(g);continue}if(f==="never"){c.push(g);continue}let y=l.run({value:t[g],issues:[]},n);y instanceof Promise?e.push(y.then(b=>Po(b,r,g,t,p,d))):Po(y,r,g,t,p,d)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}function Id(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!oe(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>fe(a,n,J())))}),t)}function Ad(e,t,r,n){let o=[];for(let i=0;i<e.length;i++)e[i].issues.length===0&&o.push(i);return o.length===1?(t.value=e[o[0]].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>fe(a,n,J())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:o}),t)}function Hc(e,t){let r=e._zod,n=r.bag.optionsMap;n||(n=Wd(r.def),r.bag.optionsMap=n);let o=n.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}function Wd(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}function Gt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ke(e)&&ke(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let a=Gt(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],a=Gt(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Od(e,t,r){let n=new Map,o,i=new Map,a=s((l,f)=>{let p;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),p=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let d=String(l.path[0]);i.has(d)||i.set(d,l),p=[d]}else return!1;for(let d of p)n.has(d)||n.set(d,{}),n.get(d)[f]=!0;return!0},"collect");for(let l of t.issues)a(l,"l")||e.issues.push(l);for(let l of r.issues)a(l,"r")||e.issues.push(l);let c=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(c.length){let l=o?c.filter(f=>o.keys.includes(f)):[];l.length&&e.issues.push({...o,keys:l});for(let f of c)!l.includes(f)&&i.has(f)&&e.issues.push(i.get(f))}let u=Gt(t.value,r.value);if(!u.valid){if(oe(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}function Cd(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 Ed(e,t,r){e.issues.length&&t.issues.push(...le(r,e.issues)),t.value[r]=e.value}function Td(e,t,r,n,o){for(let i=0;i<r.length;i++){let a=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(a.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...le(i,a.issues))}t.value[i]=a.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}function Nd(e,t,r,n,o,i,a){e.issues.length&&(Zr.has(typeof n)?r.issues.push(...le(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(c=>fe(c,a,J()))})),t.issues.length&&(Zr.has(typeof n)?r.issues.push(...le(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(c=>fe(c,a,J()))})),r.value.set(e.value,t.value)}function Rd(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}function Zd(e,t){return e.value=t.issues.length?void 0:t.value,e}function Dd(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function Ld(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function jd(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>fe(o,n,J()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}function xo(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}function So(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>zo(e,i,t.out,r)):zo(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>zo(e,i,t.in,r)):zo(e,o,t.in,r)}}function zo(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}function Md(e){return e.memo||(e.value=Object.freeze(e.value)),e}function $w(e){let t=e._zod.def,r=t.pattern,n=!!t.format?.includes("int"),o,i;for(let c of t.checks??[]){let u=c._zod.def;u.pattern&&(r=u.pattern),n||(n=!!u.format?.includes("int"));let l=u.minimum??u.length,f=u.maximum??u.length;l!==void 0&&(o===void 0||l>o)&&(o=l),f!==void 0&&(i===void 0||f<i)&&(i=f)}if(r)return r.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Aa({minimum:o,maximum:i}).source;let a=e._zod.pattern;return(n&&a===Le?Wr:a)?.source}function sc(e){let t=e._zod.def,r=e._zod.pattern?.source,n=t.innerType??e._zod.innerType;if(n){let o=n._zod.pattern?.source,i=sc(n);return r&&o&&i&&i!==o?r.replace(De(o),()=>De(i)):r}if(t.options){let o=t.options.map(sc);if(o.every(Boolean))return`^(${o.map(i=>De(i)).join("|")})$`}return $w(e)}function Fd(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Bt(o))}}var E,Vd,bt,M,ac,cc,uc,lc,Gr,fw,pc,dc,mc,hc,gc,$c,yc,bc,wc,_c,vc,kc,xc,pw,Sc,zc,Pc,Ic,To,Ac,en,Oc,Cc,dw,Ec,Tc,Nc,Rc,Lo,Zc,tn,jo,Dc,Lc,jc,Mc,Fc,Vc,Uc,Bc,Kc,Jc,gw,Jd,Wc,rn,qc,Gc,Xc,Mo,Yc,Qc,eu,tu,ru,nu,ou,Fo,iu,su,au,cu,uu,lu,fu,pu,Vo,nn,du,mu,hu,gu,$u,on,yu,Xt=z(()=>{vo();We();ko();ta();$t();W();ic();W();E=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=oc;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let a of i._zod.onattach)a(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=s((c,u,l)=>{if(c.memo)return c;let f=oe(c),p;for(let d of u){if(d._zod.def.when){if(Vs(c)||!d._zod.def.when(c))continue}else if(f)continue;let m=c.issues.length,g=d._zod.check(c);if(g instanceof Promise&&l?.async===!1)throw new pe;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,c.issues.length!==m&&(ro(c.issues,m,e),f||(f=oe(c,m)))});else{if(c.issues.length===m)continue;ro(c.issues,m,e),f||(f=oe(c,m))}}return p?p.then(()=>c):c},"runChecks"),a=s((c,u,l)=>{if(oe(c))return c.aborted=!0,c;let f=i(u,o,l);if(f instanceof Promise){if(l.async===!1)throw new pe;return f.then(p=>e._zod.parse(p,l))}return e._zod.parse(f,l)},"handleCanaryResult");e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){let f=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});return f instanceof Promise?f.then(p=>a(p,c,u)):a(f,c,u)}let l=e._zod.parse(c,u);if(l instanceof Promise){if(u.async===!1)throw new pe;return l.then(f=>i(f,o,u))}return i(l,o,u)}}},{get"~standard"(){return Fr(this,"~standard",Io(this))},set"~standard"(e){Je(this,"~standard",e)}}),Vd=s((e,t)=>e.issues.length?{issues:e.issues.map(r=>fe(r,t,J()))}:{value:e.value},"toStandardResult");s(lw,"validateAsync");s(Io,"standardProps");bt=h("$ZodString",(e,t)=>{E.init(e,t),e._zod.pattern=t.pattern??Ia,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),M=h("$ZodStringFormat",(e,t)=>{Ht.init(e,t),bt.init(e,t)}),ac=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=fa),M.init(e,t)}),cc=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gt(n))}else t.pattern??(t.pattern=gt());M.init(e,t)}),uc=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=pa),M.init(e,t)}),lc=1,Gr=2;s(fc,"canParseURL");s(Ao,"validateURL");s(Ud,"parseURLObject");fw=/[\t\n\r]/g;s(Xr,"stripTabAndNewline");s(Oo,"urlHostnameOk");s(Co,"urlProtocolOk");pc=h("$ZodURL",(e,t)=>{M.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=Ao(n,t);if(o===lc){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Gr){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=Xr(n);return}t.hostname&&!Oo(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!Co(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:Xr(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),dc=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=da()),M.init(e,t)}),mc=h("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?ca:ua(t.length)),M.init(e,t)}),hc=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=na),M.init(e,t)}),gc=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=oa),M.init(e,t)}),$c=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ia),M.init(e,t)}),yc=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=sa),M.init(e,t)}),bc=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=aa),M.init(e,t)}),wc=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Pa(t)),M.init(e,t)}),_c=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Sa),M.init(e,t)}),vc=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=za(t)),M.init(e,t)}),kc=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=la),M.init(e,t)}),xc=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ma),M.init(e,t)}),pw=/^[0-9a-fA-F:.]+$/;s(Yr,"isValidIPv6");Sc=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ha),M.init(e,t),e._zod.check=r=>{Yr(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),zc=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=ga(t.delimiter)),M.init(e,t)}),Pc=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=$a),M.init(e,t)});s(Eo,"isValidCIDRv6");Ic=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ya),M.init(e,t),e._zod.check=r=>{Eo(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});s(Qr,"isValidBase64");To=/^[0-9a-zA-Z+/]*={0,2}$/,Ac=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=To),M.init(e,t),e._zod.check=r=>{Qr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),en=/^[A-Za-z0-9_-]*$/;s(No,"isValidBase64URL");Oc=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=en),M.init(e,t),e._zod.check=r=>{No(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Cc=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ka),M.init(e,t)}),dw=/[- ]/g;s(mw,"isLuhnAlgo");s(Ro,"isValidCreditCard");Ec=h("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=go),M.init(e,t),e._zod.check=r=>{Ro(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});s(hw,"isIso7064Mod97");s(Zo,"isValidIBAN");Tc=h("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=$o),M.init(e,t),e._zod.check=r=>{Zo(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});s(Do,"isValidJWT");Nc=h("$ZodJWT",(e,t)=>{M.init(e,t),e._zod.check=r=>{Do(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Rc=h("$ZodCustomStringFormat",(e,t)=>{M.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Lo=h("$ZodNumber",(e,t)=>{E.init(e,t),e._zod.pattern=Le,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Zc=h("$ZodNumberFormat",(e,t)=>{Ma.init(e,t),Lo.init(e,t)}),tn=h("$ZodBoolean",(e,t)=>{E.init(e,t),e._zod.pattern=Ca,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),jo=h("$ZodBigInt",(e,t)=>{E.init(e,t),e._zod.pattern=Oa,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Dc=h("$ZodBigIntFormat",(e,t)=>{Fa.init(e,t),jo.init(e,t)}),Lc=h("$ZodSymbol",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),jc=h("$ZodUndefined",(e,t)=>{E.init(e,t),e._zod.pattern=Ta,e._zod.values=new Set([void 0]),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),Mc=h("$ZodNull",(e,t)=>{E.init(e,t),e._zod.pattern=Ea,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Fc=h("$ZodAny",(e,t)=>{E.init(e,t),e._zod.parse=r=>r}),Vc=h("$ZodUnknown",(e,t)=>{E.init(e,t),e._zod.parse=r=>r}),Uc=h("$ZodNever",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Bc=h("$ZodVoid",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Kc=h("$ZodDate",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});s(Pd,"handleArrayResult");Jc=h("$ZodArray",(e,t)=>{E.init(e,t);let r=X.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let a=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let l=i[u],f=t.element._zod.run({value:l,issues:[]},o);if(f instanceof Promise)a.push(f.then(p=>Pd(p,n,u)));else if(Pd(f,n,u),c&&f.issues.length!==0&&oe(f))break}return a.length?Promise.all(a).then(()=>n):n}});s(Po,"handlePropertyResult");gw=[];s(Bd,"normalizeDef");s(Kd,"handleCatchall");Jd=h("$ZodObject",(e,t)=>{E.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let l=s(()=>{let f={...n};return Object.defineProperty(t,"shape",{value:f}),l.raw=f,f},"get");l.raw=n,Object.defineProperty(t,"shape",{get:l})}let o=Vt(()=>Bd(t));N(e,"propValues",l=>{let f=l.def.shape,p={};for(let d in f){let m=f[d]._zod;if(m.values){Object.prototype.hasOwnProperty.call(p,d)||Y(p,d,new Set);for(let g of m.values)p[d].add(g);m.optin!==void 0&&p[d].add(void 0)}}return p});let i=mt,a=t.catchall,c,u=X.memoizer;u?.attach(e),e._zod.parse=(l,f)=>{c??(c=o.value);let p=l.value;if(!i(p))return l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l;l.value=u?u.alloc(e,l,{},f):{};let d=[],m=c.shape,g=f?.abortEarly,y=l.issues.length;for(let b of c.allKeys){if(g&&l.issues.length!==y){if(oe(l,y))break;y=l.issues.length}if(b==="__proto__")continue;let x=m[b],k=x._zod.optin,O=x._zod.optout,Z=x._zod.run({value:p[b],issues:[]},f);Z instanceof Promise?d.push(Z.then(L=>Po(L,l,b,p,k,O))):Po(Z,l,b,p,k,O)}return a?Kd(d,p,l,f,o.value,e,g===!0):d.length?Promise.all(d).then(()=>l):l}}),Wc=h("$ZodObjectJIT",(e,t)=>{Jd.init(e,t);let r=e._zod.parse,n=Vt(()=>Bd(t)),o=X.memoizer,i=s(m=>{let g=n.value,y=g.symbolKeys,b=new yt(["payload","ctx"],{shape:m,inst:e,memo:o,syms:y}),x=s(L=>`shape[${L}]._zod.run({ value: input[${L}], issues: [] }, ctx)`,"parseStr"),k=s((L,D)=>`
|
|
13
|
+
let ${L}_ab = false;
|
|
14
|
+
for (let i = 0; i < ${L}.issues.length; i++) {
|
|
15
|
+
const iss = ${L}.issues[i];
|
|
16
|
+
iss.path = iss.path ? [${D}, ...iss.path] : [${D}];
|
|
17
17
|
payload.issues.push(iss);
|
|
18
|
-
if (iss.continue !== true) ${
|
|
18
|
+
if (iss.continue !== true) ${L}_ab = true;
|
|
19
19
|
}
|
|
20
|
-
if (${
|
|
20
|
+
if (${L}_ab && ctx && ctx.abortEarly) {
|
|
21
21
|
payload.value = newResult;
|
|
22
22
|
return payload;
|
|
23
|
-
}`,"prefixStr");b.write("const input = payload.value;");let O=Object.create(null),
|
|
24
|
-
const ${
|
|
25
|
-
if (!${
|
|
26
|
-
if (${
|
|
23
|
+
}`,"prefixStr");b.write("const input = payload.value;");let O=Object.create(null),Z=0;for(let L of g.allKeys)O[L]=`key_${Z++}`;b.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let L of g.allKeys){if(L==="__proto__")continue;let D=O[L],ee=typeof L=="symbol"?`syms[${y.indexOf(L)}]`:ne(L),Er=`${ee} in input`,ld=m[L],Ts=ld?._zod?.optin,fd=Ts!==void 0,Ty=ld?._zod?.optout==="optional";if(b.write(`const ${D} = ${x(ee)};`),fd&&Ty){let Ny=Ts==="optional"?`${D}_present`:`${D}.value !== undefined || ${D}_present`;b.write(`
|
|
24
|
+
const ${D}_present = ${Er};
|
|
25
|
+
if (!${D}.issues.length || ${D}_present) {
|
|
26
|
+
if (${D}.issues.length) {${k(D,ee)}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
if (${Ny}) {
|
|
30
|
-
newResult[${ee}] = ${
|
|
30
|
+
newResult[${ee}] = ${D}.value;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
`)}else fd?(b.write(`
|
|
35
|
-
if (${
|
|
35
|
+
if (${D}.issues.length) {${k(D,ee)}
|
|
36
36
|
}
|
|
37
|
-
`),Ts==="defaulted"?b.write(`newResult[${ee}] = ${
|
|
38
|
-
if (${
|
|
39
|
-
newResult[${ee}] = ${
|
|
37
|
+
`),Ts==="defaulted"?b.write(`newResult[${ee}] = ${D}.value;`):b.write(`
|
|
38
|
+
if (${D}.value !== undefined || ${Er}) {
|
|
39
|
+
newResult[${ee}] = ${D}.value;
|
|
40
40
|
}
|
|
41
41
|
`)):b.write(`
|
|
42
|
-
const ${
|
|
43
|
-
if (${
|
|
42
|
+
const ${D}_present = ${Er};
|
|
43
|
+
if (${D}.issues.length) {${k(D,ee)}
|
|
44
44
|
}
|
|
45
|
-
if (!${
|
|
45
|
+
if (!${D}_present && !${D}.issues.length) {
|
|
46
46
|
payload.issues.push({
|
|
47
47
|
code: "invalid_type",
|
|
48
48
|
expected: "nonoptional",
|
|
@@ -55,22 +55,22 @@ ${r.join(`
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
if (${
|
|
59
|
-
newResult[${ee}] = ${
|
|
58
|
+
if (${D}_present) {
|
|
59
|
+
newResult[${ee}] = ${D}.value;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
`)}return b.write("payload.value = newResult;"),b.write("return payload;"),b.compile()},"generateFastpass"),a,c=mt,u=!X.jitless,f=u&&js.value,p=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=n.value);let y=m.value;return c(y)?u&&f&&g?.async===!1&&g.jitless!==!0?(a||(a=i(t.shape)),m=a(m,g),p?Kd([],y,m,g,d,e,g?.abortEarly===!0):m):r(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});s(Id,"handleUnionResults");rn=h("$ZodUnion",(e,t)=>{E.init(e,t),N(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),N(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),N(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),N(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>De(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,a=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>Id(c,n,e,o)):Id(a,n,e,o)}});s(Ad,"handleExclusiveUnionResults");qc=h("$ZodXor",(e,t)=>{rn.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,a=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},o);u instanceof Promise?(a.push(u),i=!0):a.push(u)}return i?Promise.all(a).then(c=>Ad(c,n,e,o)):Ad(a,n,e,o)}});s(Hc,"getDiscriminatedOption");s(Wd,"discriminatorMap");Gc=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,rn.init(e,t);let r=e._zod.parse;N(e,"propValues",o=>{let i={},a=0;for(let c of o.def.options){let u=c._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);u[o.def.discriminator]?.has(void 0)&&a++;for(let[l,f]of Object.entries(u)){Object.prototype.hasOwnProperty.call(i,l)||Y(i,l,new Set);for(let p of f)i[l].add(p)}}return!o.def.unionFallback&&a>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let a=Ut(o._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=Vt(()=>Wd(t));e._zod.parse=(o,i)=>{let a=o.value;if(!mt(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let c=a?.[t.discriminator],u=n.value.get(c);return u&&(c!==void 0||i.direction!=="backward")?u._zod.run(o,i):t.unionFallback||i.direction==="backward"?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(l=>n.value.get(l)!==null),input:a,path:[t.discriminator],inst:e}),o)}}),Xc=h("$ZodIntersection",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,l])=>Od(r,u,l)):Od(r,i,a)}});s(Gt,"mergeValues");s(Od,"handleIntersectionResults");Mo=h("$ZodTuple",(e,t)=>{E.init(e,t);let r=t.items,n=X.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let a=o.value;if(!Array.isArray(a))return o.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],u=Cd(r,"optin"),l=Cd(r,"optout");if(!t.rest){if(a.length<u)return o.issues.push({code:"too_small",minimum:u,inclusive:!0,input:a,inst:e,origin:"array"}),o;a.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:a,inst:e,origin:"array"})}let f=new Array(r.length),p=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<r.length;m++){let g=r[m]._zod.run({value:a[m],issues:[]},i);g instanceof Promise?c.push(g.then(y=>{f[m]=y})):(f[m]=g,p&&!d&&g.issues.length&&(d=oe(g)))}if(t.rest&&!d){let m=r.length-1,g=a.slice(r.length),y=o.issues.length;for(let b of g){if(p&&o.issues.length!==y){if(oe(o,y))break;y=o.issues.length}m++;let x=t.rest._zod.run({value:b,issues:[]},i);x instanceof Promise?c.push(x.then(k=>Ed(k,o,m))):Ed(x,o,m)}}return c.length?Promise.all(c).then(()=>Td(f,o,r,a,l)):Td(f,o,r,a,l)}});s(Cd,"getTupleOptStart");s(Ed,"handleTupleResult");s(Td,"handleTupleResults");Yc=h("$ZodRecord",(e,t)=>{E.init(e,t);let r=X.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!ke(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let a=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let u=new Set;for(let f of c)if(typeof f=="string"||typeof f=="number"||typeof f=="symbol"){if(u.add(typeof f=="number"?f.toString():f),f==="__proto__")continue;let p=t.keyType._zod.run({value:f,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(g=>fe(g,o,J())),input:f,path:[f],inst:e});continue}let d=p.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[f],issues:[]},o);m instanceof Promise?a.push(m.then(g=>{g.issues.length&&n.issues.push(...le(f,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...le(f,m.issues)),n.value[d]=m.value)}let l;for(let f in i)if(!u.has(f))if(t.mode==="loose"){if(f==="__proto__")continue;n.value[f]=i[f]}else l=l??[],l.push(f);l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let u;for(let l of Reflect.ownKeys(i)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,l))continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Le.test(l)&&f.issues.length){let g=t.keyType._zod.run({value:Number(l),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(f=g)}if(f.issues.length){t.mode==="loose"?n.value[l]=i[l]:c?(u=u??[],u.push(l)):n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>fe(g,o,J())),input:l,path:[l],inst:e});continue}let d=f.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},o);m instanceof Promise?a.push(m.then(g=>{g.issues.length&&n.issues.push(...le(l,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...le(l,m.issues)),n.value[d]=m.value)}u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}return a.length?Promise.all(a).then(()=>n):n}}),Qc=h("$ZodMap",(e,t)=>{E.init(e,t);let r=X.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),n;let a=[];n.value=r?r.alloc(e,n,new Map,o):new Map;let c=o?.abortEarly,u=n.issues.length;for(let[l,f]of i){if(c&&n.issues.length!==u){if(oe(n,u))break;u=n.issues.length}let p=t.keyType._zod.run({value:l,issues:[]},o),d=t.valueType._zod.run({value:f,issues:[]},o);p instanceof Promise||d instanceof Promise?a.push(Promise.all([p,d]).then(([m,g])=>{Nd(m,g,n,l,i,e,o)})):Nd(p,d,n,l,i,e,o)}return a.length?Promise.all(a).then(()=>n):n}});s(Nd,"handleMapResult");eu=h("$ZodSet",(e,t)=>{E.init(e,t);let r=X.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),n;let a=[];n.value=r?r.alloc(e,n,new Set,o):new Set;let c=o?.abortEarly,u=n.issues.length;for(let l of i){if(c&&n.issues.length!==u){if(oe(n,u))break;u=n.issues.length}let f=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise?a.push(f.then(p=>Rd(p,n))):Rd(f,n)}return a.length?Promise.all(a).then(()=>n):n}});s(Rd,"handleSetResult");tu=h("$ZodEnum",(e,t)=>{E.init(e,t);let r=Mt(t.entries),n=new Set(r);e._zod.values=n,N(e,"pattern",o=>{let i=Mt(o.def.entries).filter(a=>Zr.has(typeof a));return new RegExp(i.length?`^(${i.map(a=>xe(a.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),ru=h("$ZodLiteral",(e,t)=>{E.init(e,t);let r=new Set(t.values);e._zod.values=r,N(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?xe(i):i?xe(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),nu=h("$ZodFile",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),ou=h("$ZodTransform",(e,t)=>{E.init(e,t),e._zod.optin="optional",X.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new qe(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new pe;return r.value=o,r}});s(Zd,"handleOptionalResult");Fo=h("$ZodOptional",(e,t)=>{E.init(e,t),N(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",N(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),N(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${De(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>Zd(r,i)):Zd(r,o)}return t.innerType._zod.run(r,n)}}),iu=h("$ZodExactOptional",(e,t)=>{Fo.init(e,t),N(e,"values",r=>r.def.innerType._zod.values),N(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),su=h("$ZodNullable",(e,t)=>{E.init(e,t),N(e,"optin",r=>r.def.innerType._zod.optin),N(e,"optout",r=>r.def.innerType._zod.optout),N(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${De(n.source)}|null)$`):void 0}),N(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),au=h("$ZodDefault",(e,t)=>{E.init(e,t),e._zod.optin="defaulted",N(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Dd(i,t)):Dd(o,t)}});s(Dd,"handleDefaultResult");cu=h("$ZodPrefault",(e,t)=>{E.init(e,t),e._zod.optin="defaulted",N(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),uu=h("$ZodNonOptional",(e,t)=>{E.init(e,t),N(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Ld(i,e)):Ld(o,e)}});s(Ld,"handleNonOptionalResult");lu=h("$ZodSuccess",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new qe("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}});s(jd,"handleCatchResult");fu=h("$ZodCatch",(e,t)=>{E.init(e,t),N(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),N(e,"optout",r=>r.def.innerType._zod.optout),N(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>jd(r,i,t,n)):jd(r,o,t,n)}}),pu=h("$ZodNaN",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Vo=h("$ZodPipe",(e,t)=>{E.init(e,t),N(e,"values",r=>r.def.in._zod.values),N(e,"optin",r=>r.def.in._zod.optin),N(e,"optout",r=>r.def.out._zod.optout),N(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>xo(a,t.in,n)):xo(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>xo(i,t.out,n)):xo(o,t.out,n)}});s(xo,"handlePipeResult");nn=h("$ZodCodec",(e,t)=>{E.init(e,t),N(e,"values",r=>r.def.in._zod.values),N(e,"optin",r=>r.def.in._zod.optin),N(e,"optout",r=>r.def.out._zod.optout),N(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>So(a,t,n)):So(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>So(a,t,n)):So(i,t,n)}}});s(So,"handleCodecAResult");s(zo,"handleCodecTxResult");du=h("$ZodPreprocess",(e,t)=>{Vo.init(e,t)}),mu=h("$ZodReadonly",(e,t)=>{E.init(e,t),N(e,"propValues",r=>r.def.innerType._zod.propValues),N(e,"values",r=>r.def.innerType._zod.values),N(e,"optin",r=>r.def.innerType?._zod?.optin),N(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Md):Md(o)}});s(Md,"handleReadonlyResult");s($w,"leafPattern");s(sc,"partPattern");hu=h("$ZodTemplateLiteral",(e,t)=>{E.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){let o=sc(n);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);r.push(De(o))}else if(n===null||Ms.has(typeof n))r.push(xe(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),gu=h("$ZodFunction",(e,t)=>(E.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?io(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?io(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await so(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await so(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Mo({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),$u=h("$ZodPromise",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),on=h("$ZodLazy",(e,t)=>{E.init(e,t),Ds(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),N(e,"pattern",r=>r.innerType?._zod?.pattern),N(e,"propValues",r=>r.innerType?._zod?.propValues),N(e,"optin",r=>r.innerType?._zod?.optin??void 0),N(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),yu=h("$ZodCustom",(e,t)=>{U.init(e,t),E.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Fd(i,r,n,e));Fd(o,r,n,e)}});s(Fd,"handleRefineResult")});function Gd(e){return e!==null&&typeof e=="object"}function bu(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}function an(e,t,r){let n=Xd.get(e);if(n!==void 0)return n?sn:Yt;if(t.has(e))return sn;t.add(e);let o=Yt,i=s(f=>{if(o!==sn&&f?._zod){let p=an(f,t,r);p>o&&(o=p)}},"check"),a=s((f,p)=>{let d=Yt;for(let m of Reflect.ownKeys(f)){let g=Object.getOwnPropertyDescriptor(f,m);if(p&&!g.enumerable)continue;let y=g.get?Ko:g.value?._zod?an(g.value,t,r):Yt;y>d&&(d=y)}return d},"shape"),c=s(f=>{f>o&&(o=f)},"merge"),u=e._zod.def,l=u.type;switch(l){case"object":{let f=Ut(u);c(f?a(f,!0):Ko),i(u.catchall);break}case"array":i(u.element);break;case"tuple":for(let f of u.items)i(f);i(u.rest);break;case"record":case"map":i(u.keyType),i(u.valueType);break;case"set":i(u.valueType);break;case"union":for(let f of u.options)i(f);break;case"intersection":i(u.left),i(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(u.innerType);break;case"pipe":i(u.in),i(u.out);break;case"function":i(u.input),i(u.output);break;case"lazy":{let f=u._cachedInner??(r?e._zod.innerType:void 0);c(f?an(f,t,!1):Ko);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let f in u){let p=Object.getOwnPropertyDescriptor(u,f);if(!p||p.get)continue;let d=p.value;if(!(!d||typeof d!="object")){if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}}return t.delete(e),yw(e,o)}function yw(e,t){return t!==Ko&&Xd.set(e,t===sn),t}function Wo(e){return an(e,new Set,!0)!==Yt}function bw(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}function cn(){return ww}function qo(e,t){let r=e[wu]?.backEdges;return r!==void 0&&Gd(t)&&r.has(t)}var Jo,wu,Hd,Xd,Yt,Ko,sn,Uo,Bo,ww,_u=z(()=>{W();Jo=class extends Error{static{s(this,"$ZodCyclicError")}constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},wu="~memo",Hd=[];s(Gd,"isRef");s(bu,"cloneIssues");Xd=new WeakMap,Yt=0,Ko=1,sn=2;s(an,"isRecursive");s(yw,"settle");s(Wo,"isRecursiveSchema");s(bw,"bucketFor");Bo=[],ww={alloc(e,t,r){let n=Uo;if(!n)return r;Uo=void 0;let o={value:r,issues:null};return n.set(t.value,o),Bo.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=s((o,i)=>{if(i.direction!=="backward"&&qo(i,o.value))throw new Jo;return r(o,i)},"wrapped");e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let a=e._zod.parse,c=s((u,l)=>{if(r===void 0){let x=an(e,new Set,!1);if(x===Yt)return e._zod.parse=a,e._zod.run===c&&(e._zod.run=a),a(u,l);x===sn||n?r=!0:n=!0}let f=u.value;if(!Gd(f))return a(u,l);let p=l[wu];p||(p={buckets:new WeakMap,backEdges:void 0},l[wu]=p);let d;o===l?d=i:(d=bw(p,e),o=l,i=d);let m=d.get(f);if(m)return u.value=m.value,m.issues?m.issues.length&&u.issues.push(...bu(m.issues)):(u.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(m.value)),u;Uo=d;let g=Bo.length,y=a(u,l);Uo=void 0;let b=Bo.length>g?Bo.pop():void 0;return y instanceof Promise?y.then(x=>(b&&(b.issues=x.issues.length?bu(x.issues):Hd),x)):(b&&(b.issues=y.issues.length?bu(y.issues):Hd),y)},"wrapped");e._zod.parse=c,e._zod.run===a&&(e._zod.run=c)})}};s(cn,"memoizer");s(qo,"isBackEdge")});function un(){return{localeError:_w()}}var _w,vu=z(()=>{W();_w=s(()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}s(t,"getSizing");let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,a){return i==="number"&&typeof a=="number"&&!Number.isFinite(a)?String(a):n[i]??i}return s(o,"getTypeName"),i=>{switch(i.code){case"invalid_type":{let a=o(i.expected),c=Us(i.input),u=o(c,i.input);return`Invalid input: expected ${a}, received ${u}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${eo(i.values[0])}`:`Invalid option: expected one of ${Xn(i.values,"|")}`;case"too_big":{let a=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${a}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${a}${i.maximum.toString()}`}case"too_small":{let a=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${a}${i.minimum.toString()} ${c.unit}`:`Too small: expected ${i.origin} to be ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Invalid string: must start with "${a.prefix}"`:a.format==="ends_with"?`Invalid string: must end with "${a.suffix}"`:a.format==="includes"?`Invalid string: must include "${a.includes}"`:a.format==="regex"?`Invalid string: must match pattern ${a.pattern}`:`Invalid ${r[a.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Xn(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(c=>`'${c}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}},"error");s(un,"default")});var ln={};ge(ln,{en:()=>un});var ku=z(()=>{vu()});function Go(){return new Ho}var Yd,xu,Su,Ho,Q,fn=z(()=>{xu=Symbol("ZodOutput"),Su=Symbol("ZodInput"),Ho=class{static{s(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};s(Go,"registry");(Yd=globalThis).__zod_globalRegistry??(Yd.__zod_globalRegistry=Go());Q=globalThis.__zod_globalRegistry});function kw(e,t){try{return Yo(e,{assertOnly:!0})}catch{return t}}function Au(e,t){try{let r=Yo(e),n=Xo(e,r);return n._zod.bag.validator=kw(e,r),n}catch(r){if(t?.strict)throw r;return e}}function Xo(e,t){if(Wo(e))throw new Z("a schema whose subtree contains a reference cycle");let r=L(e),n=e._zod.run,o=n.__originalRun??n,i=s((a,c)=>{if(c?.async||c?.direction==="backward"||c?.skipChecks||c?.[Qd]||c&&qo(c,a.value))return o(a,c);let u=t(a.value);return u!==ie?(a.value=u,a):(c&&(c[Qd]=!0),o(a,c))},"wrapped");return i.__originalRun=o,r._zod.bag.fallbackRun=o,r._zod.bag.validator=t,r._zod.run=i,n.__originalRun||xw(r,e,t),r}function xw(e,t,r){let n=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;n.safeParse=(a,c)=>{let u=r(a);return u!==ie?{success:!0,data:u}:i(a,c)}}if(typeof o.parse=="function"){let i=o.parse;n.parse=(a,c)=>{let u=r(a);return u!==ie?u:i(a,c)}}}function Yo(e,t){let r=!0;try{r=Wo(e)}catch{}if(r)throw new Z("a schema whose subtree contains a reference cycle");let n={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new yt(["input"]),i=B(o,n,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let a=["INVALID",...n.constants.keys()],c=[ie,...n.constants.values()],u=o.content.join(`
|
|
62
|
+
`)}return b.write("payload.value = newResult;"),b.write("return payload;"),b.compile()},"generateFastpass"),a,c=mt,u=!X.jitless,f=u&&js.value,p=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=n.value);let y=m.value;return c(y)?u&&f&&g?.async===!1&&g.jitless!==!0?(a||(a=i(t.shape)),m=a(m,g),p?Kd([],y,m,g,d,e,g?.abortEarly===!0):m):r(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});s(Id,"handleUnionResults");rn=h("$ZodUnion",(e,t)=>{E.init(e,t),N(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),N(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),N(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),N(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>De(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,a=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>Id(c,n,e,o)):Id(a,n,e,o)}});s(Ad,"handleExclusiveUnionResults");qc=h("$ZodXor",(e,t)=>{rn.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,a=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},o);u instanceof Promise?(a.push(u),i=!0):a.push(u)}return i?Promise.all(a).then(c=>Ad(c,n,e,o)):Ad(a,n,e,o)}});s(Hc,"getDiscriminatedOption");s(Wd,"discriminatorMap");Gc=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,rn.init(e,t);let r=e._zod.parse;N(e,"propValues",o=>{let i={},a=0;for(let c of o.def.options){let u=c._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);u[o.def.discriminator]?.has(void 0)&&a++;for(let[l,f]of Object.entries(u)){Object.prototype.hasOwnProperty.call(i,l)||Y(i,l,new Set);for(let p of f)i[l].add(p)}}return!o.def.unionFallback&&a>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let a=Ut(o._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=Vt(()=>Wd(t));e._zod.parse=(o,i)=>{let a=o.value;if(!mt(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let c=a?.[t.discriminator],u=n.value.get(c);return u&&(c!==void 0||i.direction!=="backward")?u._zod.run(o,i):t.unionFallback||i.direction==="backward"?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(l=>n.value.get(l)!==null),input:a,path:[t.discriminator],inst:e}),o)}}),Xc=h("$ZodIntersection",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,l])=>Od(r,u,l)):Od(r,i,a)}});s(Gt,"mergeValues");s(Od,"handleIntersectionResults");Mo=h("$ZodTuple",(e,t)=>{E.init(e,t);let r=t.items,n=X.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let a=o.value;if(!Array.isArray(a))return o.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],u=Cd(r,"optin"),l=Cd(r,"optout");if(!t.rest){if(a.length<u)return o.issues.push({code:"too_small",minimum:u,inclusive:!0,input:a,inst:e,origin:"array"}),o;a.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:a,inst:e,origin:"array"})}let f=new Array(r.length),p=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<r.length;m++){let g=r[m]._zod.run({value:a[m],issues:[]},i);g instanceof Promise?c.push(g.then(y=>{f[m]=y})):(f[m]=g,p&&!d&&g.issues.length&&(d=oe(g)))}if(t.rest&&!d){let m=r.length-1,g=a.slice(r.length),y=o.issues.length;for(let b of g){if(p&&o.issues.length!==y){if(oe(o,y))break;y=o.issues.length}m++;let x=t.rest._zod.run({value:b,issues:[]},i);x instanceof Promise?c.push(x.then(k=>Ed(k,o,m))):Ed(x,o,m)}}return c.length?Promise.all(c).then(()=>Td(f,o,r,a,l)):Td(f,o,r,a,l)}});s(Cd,"getTupleOptStart");s(Ed,"handleTupleResult");s(Td,"handleTupleResults");Yc=h("$ZodRecord",(e,t)=>{E.init(e,t);let r=X.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!ke(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let a=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let u=new Set;for(let f of c)if(typeof f=="string"||typeof f=="number"||typeof f=="symbol"){if(u.add(typeof f=="number"?f.toString():f),f==="__proto__")continue;let p=t.keyType._zod.run({value:f,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(g=>fe(g,o,J())),input:f,path:[f],inst:e});continue}let d=p.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[f],issues:[]},o);m instanceof Promise?a.push(m.then(g=>{g.issues.length&&n.issues.push(...le(f,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...le(f,m.issues)),n.value[d]=m.value)}let l;for(let f in i)if(!u.has(f))if(t.mode==="loose"){if(f==="__proto__")continue;n.value[f]=i[f]}else l=l??[],l.push(f);l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let u;for(let l of Reflect.ownKeys(i)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,l))continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Le.test(l)&&f.issues.length){let g=t.keyType._zod.run({value:Number(l),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(f=g)}if(f.issues.length){t.mode==="loose"?n.value[l]=i[l]:c?(u=u??[],u.push(l)):n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>fe(g,o,J())),input:l,path:[l],inst:e});continue}let d=f.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},o);m instanceof Promise?a.push(m.then(g=>{g.issues.length&&n.issues.push(...le(l,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...le(l,m.issues)),n.value[d]=m.value)}u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}return a.length?Promise.all(a).then(()=>n):n}}),Qc=h("$ZodMap",(e,t)=>{E.init(e,t);let r=X.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),n;let a=[];n.value=r?r.alloc(e,n,new Map,o):new Map;let c=o?.abortEarly,u=n.issues.length;for(let[l,f]of i){if(c&&n.issues.length!==u){if(oe(n,u))break;u=n.issues.length}let p=t.keyType._zod.run({value:l,issues:[]},o),d=t.valueType._zod.run({value:f,issues:[]},o);p instanceof Promise||d instanceof Promise?a.push(Promise.all([p,d]).then(([m,g])=>{Nd(m,g,n,l,i,e,o)})):Nd(p,d,n,l,i,e,o)}return a.length?Promise.all(a).then(()=>n):n}});s(Nd,"handleMapResult");eu=h("$ZodSet",(e,t)=>{E.init(e,t);let r=X.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),n;let a=[];n.value=r?r.alloc(e,n,new Set,o):new Set;let c=o?.abortEarly,u=n.issues.length;for(let l of i){if(c&&n.issues.length!==u){if(oe(n,u))break;u=n.issues.length}let f=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise?a.push(f.then(p=>Rd(p,n))):Rd(f,n)}return a.length?Promise.all(a).then(()=>n):n}});s(Rd,"handleSetResult");tu=h("$ZodEnum",(e,t)=>{E.init(e,t);let r=Mt(t.entries),n=new Set(r);e._zod.values=n,N(e,"pattern",o=>{let i=Mt(o.def.entries).filter(a=>Zr.has(typeof a));return new RegExp(i.length?`^(${i.map(a=>xe(a.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),ru=h("$ZodLiteral",(e,t)=>{E.init(e,t);let r=new Set(t.values);e._zod.values=r,N(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?xe(i):i?xe(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),nu=h("$ZodFile",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),ou=h("$ZodTransform",(e,t)=>{E.init(e,t),e._zod.optin="optional",X.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new qe(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new pe;return r.value=o,r}});s(Zd,"handleOptionalResult");Fo=h("$ZodOptional",(e,t)=>{E.init(e,t),N(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",N(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),N(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${De(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>Zd(r,i)):Zd(r,o)}return t.innerType._zod.run(r,n)}}),iu=h("$ZodExactOptional",(e,t)=>{Fo.init(e,t),N(e,"values",r=>r.def.innerType._zod.values),N(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),su=h("$ZodNullable",(e,t)=>{E.init(e,t),N(e,"optin",r=>r.def.innerType._zod.optin),N(e,"optout",r=>r.def.innerType._zod.optout),N(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${De(n.source)}|null)$`):void 0}),N(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),au=h("$ZodDefault",(e,t)=>{E.init(e,t),e._zod.optin="defaulted",N(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Dd(i,t)):Dd(o,t)}});s(Dd,"handleDefaultResult");cu=h("$ZodPrefault",(e,t)=>{E.init(e,t),e._zod.optin="defaulted",N(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),uu=h("$ZodNonOptional",(e,t)=>{E.init(e,t),N(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Ld(i,e)):Ld(o,e)}});s(Ld,"handleNonOptionalResult");lu=h("$ZodSuccess",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new qe("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}});s(jd,"handleCatchResult");fu=h("$ZodCatch",(e,t)=>{E.init(e,t),N(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),N(e,"optout",r=>r.def.innerType._zod.optout),N(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>jd(r,i,t,n)):jd(r,o,t,n)}}),pu=h("$ZodNaN",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Vo=h("$ZodPipe",(e,t)=>{E.init(e,t),N(e,"values",r=>r.def.in._zod.values),N(e,"optin",r=>r.def.in._zod.optin),N(e,"optout",r=>r.def.out._zod.optout),N(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>xo(a,t.in,n)):xo(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>xo(i,t.out,n)):xo(o,t.out,n)}});s(xo,"handlePipeResult");nn=h("$ZodCodec",(e,t)=>{E.init(e,t),N(e,"values",r=>r.def.in._zod.values),N(e,"optin",r=>r.def.in._zod.optin),N(e,"optout",r=>r.def.out._zod.optout),N(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>So(a,t,n)):So(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>So(a,t,n)):So(i,t,n)}}});s(So,"handleCodecAResult");s(zo,"handleCodecTxResult");du=h("$ZodPreprocess",(e,t)=>{Vo.init(e,t)}),mu=h("$ZodReadonly",(e,t)=>{E.init(e,t),N(e,"propValues",r=>r.def.innerType._zod.propValues),N(e,"values",r=>r.def.innerType._zod.values),N(e,"optin",r=>r.def.innerType?._zod?.optin),N(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Md):Md(o)}});s(Md,"handleReadonlyResult");s($w,"leafPattern");s(sc,"partPattern");hu=h("$ZodTemplateLiteral",(e,t)=>{E.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){let o=sc(n);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);r.push(De(o))}else if(n===null||Ms.has(typeof n))r.push(xe(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),gu=h("$ZodFunction",(e,t)=>(E.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?io(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?io(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await so(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await so(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Mo({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),$u=h("$ZodPromise",(e,t)=>{E.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),on=h("$ZodLazy",(e,t)=>{E.init(e,t),Ds(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),N(e,"pattern",r=>r.innerType?._zod?.pattern),N(e,"propValues",r=>r.innerType?._zod?.propValues),N(e,"optin",r=>r.innerType?._zod?.optin??void 0),N(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),yu=h("$ZodCustom",(e,t)=>{U.init(e,t),E.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Fd(i,r,n,e));Fd(o,r,n,e)}});s(Fd,"handleRefineResult")});function Gd(e){return e!==null&&typeof e=="object"}function bu(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}function an(e,t,r){let n=Xd.get(e);if(n!==void 0)return n?sn:Yt;if(t.has(e))return sn;t.add(e);let o=Yt,i=s(f=>{if(o!==sn&&f?._zod){let p=an(f,t,r);p>o&&(o=p)}},"check"),a=s((f,p)=>{let d=Yt;for(let m of Reflect.ownKeys(f)){let g=Object.getOwnPropertyDescriptor(f,m);if(p&&!g.enumerable)continue;let y=g.get?Ko:g.value?._zod?an(g.value,t,r):Yt;y>d&&(d=y)}return d},"shape"),c=s(f=>{f>o&&(o=f)},"merge"),u=e._zod.def,l=u.type;switch(l){case"object":{let f=Ut(u);c(f?a(f,!0):Ko),i(u.catchall);break}case"array":i(u.element);break;case"tuple":for(let f of u.items)i(f);i(u.rest);break;case"record":case"map":i(u.keyType),i(u.valueType);break;case"set":i(u.valueType);break;case"union":for(let f of u.options)i(f);break;case"intersection":i(u.left),i(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(u.innerType);break;case"pipe":i(u.in),i(u.out);break;case"function":i(u.input),i(u.output);break;case"lazy":{let f=u._cachedInner??(r?e._zod.innerType:void 0);c(f?an(f,t,!1):Ko);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let f in u){let p=Object.getOwnPropertyDescriptor(u,f);if(!p||p.get)continue;let d=p.value;if(!(!d||typeof d!="object")){if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}}return t.delete(e),yw(e,o)}function yw(e,t){return t!==Ko&&Xd.set(e,t===sn),t}function Wo(e){return an(e,new Set,!0)!==Yt}function bw(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}function cn(){return ww}function qo(e,t){let r=e[wu]?.backEdges;return r!==void 0&&Gd(t)&&r.has(t)}var Jo,wu,Hd,Xd,Yt,Ko,sn,Uo,Bo,ww,_u=z(()=>{W();Jo=class extends Error{static{s(this,"$ZodCyclicError")}constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},wu="~memo",Hd=[];s(Gd,"isRef");s(bu,"cloneIssues");Xd=new WeakMap,Yt=0,Ko=1,sn=2;s(an,"isRecursive");s(yw,"settle");s(Wo,"isRecursiveSchema");s(bw,"bucketFor");Bo=[],ww={alloc(e,t,r){let n=Uo;if(!n)return r;Uo=void 0;let o={value:r,issues:null};return n.set(t.value,o),Bo.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=s((o,i)=>{if(i.direction!=="backward"&&qo(i,o.value))throw new Jo;return r(o,i)},"wrapped");e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let a=e._zod.parse,c=s((u,l)=>{if(r===void 0){let x=an(e,new Set,!1);if(x===Yt)return e._zod.parse=a,e._zod.run===c&&(e._zod.run=a),a(u,l);x===sn||n?r=!0:n=!0}let f=u.value;if(!Gd(f))return a(u,l);let p=l[wu];p||(p={buckets:new WeakMap,backEdges:void 0},l[wu]=p);let d;o===l?d=i:(d=bw(p,e),o=l,i=d);let m=d.get(f);if(m)return u.value=m.value,m.issues?m.issues.length&&u.issues.push(...bu(m.issues)):(u.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(m.value)),u;Uo=d;let g=Bo.length,y=a(u,l);Uo=void 0;let b=Bo.length>g?Bo.pop():void 0;return y instanceof Promise?y.then(x=>(b&&(b.issues=x.issues.length?bu(x.issues):Hd),x)):(b&&(b.issues=y.issues.length?bu(y.issues):Hd),y)},"wrapped");e._zod.parse=c,e._zod.run===a&&(e._zod.run=c)})}};s(cn,"memoizer");s(qo,"isBackEdge")});function un(){return{localeError:_w()}}var _w,vu=z(()=>{W();_w=s(()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}s(t,"getSizing");let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,a){return i==="number"&&typeof a=="number"&&!Number.isFinite(a)?String(a):n[i]??i}return s(o,"getTypeName"),i=>{switch(i.code){case"invalid_type":{let a=o(i.expected),c=Us(i.input),u=o(c,i.input);return`Invalid input: expected ${a}, received ${u}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${eo(i.values[0])}`:`Invalid option: expected one of ${Xn(i.values,"|")}`;case"too_big":{let a=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${a}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${a}${i.maximum.toString()}`}case"too_small":{let a=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${a}${i.minimum.toString()} ${c.unit}`:`Too small: expected ${i.origin} to be ${a}${i.minimum.toString()}`}case"invalid_format":{let a=i;return a.format==="starts_with"?`Invalid string: must start with "${a.prefix}"`:a.format==="ends_with"?`Invalid string: must end with "${a.suffix}"`:a.format==="includes"?`Invalid string: must include "${a.includes}"`:a.format==="regex"?`Invalid string: must match pattern ${a.pattern}`:`Invalid ${r[a.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Xn(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(c=>`'${c}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}},"error");s(un,"default")});var ln={};ge(ln,{en:()=>un});var ku=z(()=>{vu()});function Go(){return new Ho}var Yd,xu,Su,Ho,Q,fn=z(()=>{xu=Symbol("ZodOutput"),Su=Symbol("ZodInput"),Ho=class{static{s(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};s(Go,"registry");(Yd=globalThis).__zod_globalRegistry??(Yd.__zod_globalRegistry=Go());Q=globalThis.__zod_globalRegistry});function kw(e,t){try{return Yo(e,{assertOnly:!0})}catch{return t}}function Au(e,t){try{let r=Yo(e),n=Xo(e,r);return n._zod.bag.validator=kw(e,r),n}catch(r){if(t?.strict)throw r;return e}}function Xo(e,t){if(Wo(e))throw new R("a schema whose subtree contains a reference cycle");let r=j(e),n=e._zod.run,o=n.__originalRun??n,i=s((a,c)=>{if(c?.async||c?.direction==="backward"||c?.skipChecks||c?.[Qd]||c&&qo(c,a.value))return o(a,c);let u=t(a.value);return u!==ie?(a.value=u,a):(c&&(c[Qd]=!0),o(a,c))},"wrapped");return i.__originalRun=o,r._zod.bag.fallbackRun=o,r._zod.bag.validator=t,r._zod.run=i,n.__originalRun||xw(r,e,t),r}function xw(e,t,r){let n=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;n.safeParse=(a,c)=>{let u=r(a);return u!==ie?{success:!0,data:u}:i(a,c)}}if(typeof o.parse=="function"){let i=o.parse;n.parse=(a,c)=>{let u=r(a);return u!==ie?u:i(a,c)}}}function Yo(e,t){let r=!0;try{r=Wo(e)}catch{}if(r)throw new R("a schema whose subtree contains a reference cycle");let n={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new yt(["input"]),i=B(o,n,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let a=["INVALID",...n.constants.keys()],c=[ie,...n.constants.values()],u=o.content.join(`
|
|
63
63
|
`),l=t?.debug?a.length>0?`// Constants: ${a.join(", ")}
|
|
64
64
|
${u}`:u:"",f=Function,p=`return (input) => {
|
|
65
65
|
${u}
|
|
66
|
-
}`,d;try{d=new f(...a,p)(...c)}catch(m){throw new Z(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=l),d.definite=n.definite,d}function A(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 vt(e,t){return e.definite=!1,A(e,t)}function P(e){return`v${e.varCounter++}`}function Sw(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 Z)||!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,zw(e,t,r,n)}}function zw(e,t,r,n){t.definite=!1;let o=A(t,r),i=A(t,Sw),a=P(t);return e.write(`const ${a} = ${i}(${o}, ${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function Iw(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&&!Pw.has(c.check))throw new Z('check with a custom "when" condition');switch(c.check){case"greater_than":Aw(e,t,c,i);break;case"less_than":Ow(e,t,c,i);break;case"multiple_of":Cw(e,t,c,i);break;case"number_format":im(e,c,i);break;case"min_length":{let u=wt(c.minimum,"min_length"),l=zu(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=zu(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=zu(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=sm(e,t,c,i);break;case"custom":i=Dw(e,t,a,i);break;case"bigint_format":Ew(e,c,i);break;case"mime_type":Tw(e,t,c,i);break;case"property":Rw(e,t,c,i);break;case"properties":Nw(e,t,c,i);break;case"overwrite":{let u=P(t);Zw(e,t,a,i,u),i=u;break}default:throw new Z(`check type ${c.check}`)}}return i}function zu(e,t,r,n){let o=A(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 Z(`${t} bound of type ${typeof e}`);return`${e}`}function om(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new Z("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new Z("comparison check with Invalid Date bound");return A(e,t)}throw new Z(`comparison check bound of type ${typeof t}`)}function Aw(e,t,r,n){let o=r.inclusive?"<":"<=";e.write(`if (${n} ${o} ${om(t,r.value)}) return INVALID;`)}function Ow(e,t,r,n){let o=r.inclusive?">":">=";e.write(`if (${n} ${o} ${om(t,r.value)}) return INVALID;`)}function Cw(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new Z("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let o=A(t,Nr);e.write(`if (${o}(${n}, ${wt(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function im(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 Z(`number format ${n}`)}}function Ew(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 Z(`bigint format ${n}`)}}function Tw(e,t,r,n){let o=r.mime;if(o&&o.length>0){let i=A(t,new Set(o));e.write(`if (!${i}.has(${n}.type)) return INVALID;`)}}function Nw(e,t,r,n){if(r.when)throw new Z('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"?A(t,i):ne(i),c=P(t);e.write(`const ${c} = ${n}[${a}];`),te(e,t,o[i],c,!1)}}function Rw(e,t,r,n){let o=`${n}[${JSON.stringify(r.property)}]`;B(e,t,r.schema,o)}function Zw(e,t,r,n,o){let i=r._zod.def.tx;if(!i)throw new Z("overwrite check without a transform function");if(kt(i))throw new Pe("z.compile: async overwrite transforms are not supported");let a=A(t,i);e.write(`const ${o} = ${a}(${n});`)}function Pu(){throw new pe}function Ou(e){this.issues.push(e)}function Dw(e,t,r,n){let o=r._zod.def;if(o.fn){if(kt(o.fn))throw new Pe("z.compile: async .refine() predicates are not supported");let i=vt(t,o.fn),a=A(t,Pu),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(kt(r._zod.check))throw new Pe("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,c=vt(t,s(l=>{let f={value:l,issues:[],addIssue:Ou};return i(f)instanceof Promise&&Pu(),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 Z("custom check without a predicate or check function")}function sm(e,t,r,n,o=!0){let i=r.format;if(i==="base64"){let l=A(t,Qr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="base64url"){let l=A(t,No);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="jwt"){let l=A(t,Do),f=A(t,r.alg??null);return e.write(`if (!${l}(${n}, ${f})) return INVALID;`),n}if(i==="ipv6"){let l=A(t,Yr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="cidrv6"){let l=A(t,Eo);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="credit_card"){let l=A(t,Ro);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="iban"){let l=A(t,Zo);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=A(t,Ao),f=A(t,r),p=P(t),d=P(t);if(e.write(`const ${p} = ${n}.trim();`),e.write(`const ${d} = ${l}(${p}, ${f});`),e.write(`if (typeof ${d} === "number") return INVALID;`),a.hostname!==void 0){let y=A(t,Oo);e.write(`if (!${y}(${d}, ${f}.hostname)) return INVALID;`)}if(a.protocol!==void 0){let y=A(t,Co);e.write(`if (!${y}(${d}, ${f}.protocol)) return INVALID;`)}if(!o)return null;let m=P(t),g=a.normalize?`${d}.href`:`${A(t,Xr)}(${p})`;return e.write(`const ${m} = ${g};`),m}let c=r.fn;if(c){if(kt(c))throw new Z(`async string format ${i}`);let l=A(t,c);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(Lw.has(i)&&r.pattern){let l=A(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 Z("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 Z(`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 Z(`coercion (z.coerce.${a}())`);let c=o||!!i.checks?.length,u;switch(a){case"string":u=jw(e,t,r,n,c);break;case"number":u=Mw(e,r,n);break;case"boolean":u=Fw(e,n);break;case"bigint":u=Vw(e,r,n);break;case"symbol":u=Uw(e,n);break;case"undefined":u=Bw(e,n);break;case"null":u=Kw(e,n);break;case"any":case"unknown":u=n;break;case"never":e.write("return INVALID;"),u=n;break;case"void":u=Jw(e,n);break;case"nan":u=Ww(e,n);break;case"date":u=qw(e,n);break;case"object":u=Hw(e,t,r,n,c);break;case"optional":u=Gw(e,t,r,n,c);break;case"nullable":u=Qw(e,t,r,n,c);break;case"array":u=e_(e,t,r,n,c);break;case"literal":u=t_(e,t,r,n);break;case"enum":u=r_(e,t,r,n);break;case"readonly":{let l=tm(e,t,r,n),f=P(t);e.write(`const ${f} = Object.freeze(${l});`),u=f;break}case"success":tm(e,t,r,n),u="true";break;case"default":case"prefault":u=n_(e,t,r,n);break;case"nonoptional":u=o_(e,t,r,n);break;case"tuple":u=i_(e,t,r,n);break;case"union":u=s_(e,t,r,n);break;case"intersection":u=u_(e,t,r,n);break;case"record":u=l_(e,t,r,n);break;case"map":u=p_(e,t,r,n);break;case"set":u=d_(e,t,r,n);break;case"file":u=m_(e,n);break;case"template_literal":u=h_(e,t,r,n);break;case"lazy":u=g_(e,t,r,n);break;case"pipe":u=$_(e,t,r,n);break;case"custom":u=y_(e,t,r,n);break;case"transform":u=__(e,t,r,n);break;case"catch":u=w_(e,t,r,n);break;default:throw new Z(`schema type ${a}`)}return u===null?null:Iw(e,t,r,u)}function jw(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:sm(e,t,i,n,o)}function Mw(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&&im(e,{format:n.format},r),r}function Fw(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function Vw(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 Uw(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function Bw(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function Kw(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function Jw(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function Ww(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function qw(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function Hw(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(k=>typeof k=="symbol"?A(t,k):ne(k),"keyExpr"),p=s(k=>typeof k=="symbol"?`[${f(k)}]`:ne(k),"propKey"),d=a;if(c.includes("__proto__"))throw new Z('object shape key "__proto__"');let m=new Map;for(let k of l){let O=d[k],D=f(k),F=P(t);if(e.write(`const ${F} = ${n}[${D}];`),O._zod.optin!==void 0){let R=P(t);e.write(`let ${R} = (() => {`),e.indented(ee=>{let Er=te(ee,t,O,F);ee.write(`return ${Er};`)}),e.write("})();"),O._zod.optout==="optional"?(e.write(`if (${R} === INVALID) {`),e.indented(ee=>{ee.write(`if (${D} in ${n}) return INVALID;`),ee.write(`${R} = undefined;`)}),e.write("}")):e.write(`if (${R} === INVALID) return INVALID;`),m.set(k,R)}else{Yw(O)&&e.write(`if (!(${D} in ${n})) return INVALID;`);let R=te(e,t,O,F,o);R!==null&&m.set(k,R)}}let g=i.catchall,y="none";if(g){let k=g._zod.def.type;if(k==="never"){let O=c.map(D=>`k !== ${ne(D)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(D=>{D.write(`if (${O}) return INVALID;`)}),e.write("}")}else(k==="unknown"||k==="any")&&!g._zod.def.checks?.length?y="passthrough":y="schema"}let b=P(t),x=l.some(k=>em(d[k])||Iu(d[k]));if(!o){if(y==="schema"){let k=c.length>0?A(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(O=>{O.write('if (k === "__proto__") continue;'),k&&O.write(`if (${k}.has(k)) continue;`);let D=P(t);O.write(`const ${D} = ${n}[k];`),te(O,t,g,D,!1)}),e.write("}")}return null}if(x){e.write(`const ${b} = {};`);for(let k of l){let O=f(k),D=m.get(k);Iu(d[k])?e.write(`if (${O} in ${n}) ${b}[${O}] = ${D};`):em(d[k])?e.write(`if (${D} !== undefined || ${O} in ${n}) ${b}[${O}] = ${D};`):e.write(`${b}[${O}] = ${D};`)}}else{let k=l.map(O=>`${p(O)}: ${m.get(O)}`).join(", ");e.write(`const ${b} = { ${k} };`)}if(y!=="none"){let k=c.length>0?A(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(O=>{if(O.write('if (k === "__proto__") continue;'),k&&O.write(`if (${k}.has(k)) continue;`),y==="passthrough")O.write(`${b}[k] = ${n}[k];`);else{let D=P(t);O.write(`const ${D} = ${n}[k];`);let F=te(O,t,g,D);O.write(`${b}[k] = ${F};`)}}),e.write("}")}return b}function Gw(e,t,r,n,o=!0){let i=r._zod.def;if(Xw(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 Xw(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function Yw(e){return e._zod.optin===void 0&&_t(e)}function _t(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?_t(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?_t(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(_t):!0;case"intersection":return!t.left||!t.right?!0:_t(t.left)&&_t(t.right);case"pipe":return t.in?_t(t.in):!0;default:return!0}}function Iu(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function em(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Qt(e)}function Qt(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?Qt(t.innerType):!0;case"union":return t.options?t.options.some(Qt):!0;case"intersection":return!t.left||!t.right||Qt(t.left)||Qt(t.right);case"pipe":return t.out?Qt(t.out):!0;default:return!0}}function Qw(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 e_(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 t_(e,t,r,n){let i=r._zod.def.values;if(i.length!==1){let c=A(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=A(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 Z(`literal type ${typeof a}`);return n}function r_(e,t,r,n){let o=r._zod.values;if(!o)throw new Z("enum schema without enumerated values");let i=A(t,o);return e.write(`if (!${i}.has(${n})) return INVALID;`),n}function tm(e,t,r,n){let o=r._zod.def;return B(e,t,o.innerType,n)}function n_(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=A(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=A(t,a),l=A(t,Rr);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 o_(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 i_(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=rm(i,"optin"),u=rm(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(d=>{d.write(`if (${f} < ${n}.length) {`),d.indented(m=>{let g=P(t);m.write(`const ${g} = ${n}[${f}];`);let y=te(m,t,p,g);m.write(`${l}[${f}] = ${y};`)}),d.write("} else {"),d.indented(m=>{if(Iu(p)){m.write(`${l}.length = ${f};`);return}let g=P(t),y=P(t);m.write(`const ${g} = undefined;`),m.write(`const ${y} = (() => {`),m.indented(b=>{let x=te(b,t,p,g);b.write(`return ${x};`)}),m.write("})();"),m.write(`if (${y} === INVALID || ${y} === undefined) ${l}.length = ${f};`),m.write(`else ${l}[${f}] = ${y};`)}),d.write("}")}),e.write("}");else{let d=P(t);e.write(`const ${d} = ${n}[${f}];`);let m=te(e,t,p,d);e.write(`${l}[${f}] = ${m};`)}}if(a){let f=P(t),p=P(t);e.write(`for (let ${f} = ${i.length}; ${f} < ${n}.length; ${f}++) {`),e.indented(d=>{d.write(`const ${p} = ${n}[${f}];`);let m=te(d,t,a,p);d.write(`${l}[${f}] = ${m};`)}),e.write("}")}return l}function rm(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 s_(e,t,r,n){let o=r._zod.def,i=o.options;if(o.discriminator)return a_(e,t,o,n);if(o.inclusive===!1)throw new Z("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=A(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 a_(e,t,r,n){if(r.unionFallback)throw new Z("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 Z("discriminated union option without static discriminator values");for(let d of l){if(c.has(d))throw new Z(`duplicate discriminator value ${String(d)}`);c.add(d)}let f=Array.from(l,d=>c_(t,o,d)),p=a?"if":"else if";e.write(`${p} (${f.join(" || ")}) {`),e.indented(d=>{let m=B(d,t,u,n);d.write(`${i} = ${m};`)}),e.write("}"),a=!1}return e.write("else { return INVALID; }"),i}function c_(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=A(e,r);return`${t} === ${n}`}throw new Z(`literal discriminator value ${String(r)}`)}function u_(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=A(t,Gt),u=P(t);return e.write(`const ${u} = ${c}(${i}, ${a});`),e.write(`if (!${u}.valid) return INVALID;`),`${u}.data`}function l_(e,t,r,n){let o=r._zod.def,i=A(t,ke);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 m=[];for(let y of f){if(!(typeof y=="string"||typeof y=="number"||typeof y=="symbol"))throw new Z(`record key value ${String(y)}`);let b=typeof y=="number"?y.toString():y;if(b==="__proto__")throw new Z('record key "__proto__"');m.push(b);let x=A(t,y),k=B(e,t,o.keyType,x),O=P(t);e.write(`const ${O} = ${n}[${f_(t,b)}];`);let D=te(e,t,o.valueType,O);e.write(`${a}[${k}] = ${D};`)}let g=A(t,new Set(m));return e.write(`for (const ${c} in ${n}) {`),e.indented(y=>{y.write(`if (${g}.has(${c})) continue;`),l.mode==="loose"?y.write(`if (${c} !== "__proto__") ${a}[${c}] = ${n}[${c}];`):y.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 m=o.mode==="loose",g=Yo(o.keyType);g.definite===!1&&(t.definite=!1);let y=A(t,g),b=A(t,Le),x=P(t);return nm(e,t,n,c,k=>{k.write(`let ${x} = ${y}(${c});`),k.write(`if (${x} === INVALID && typeof ${c} === "string" && ${b}.test(${c})) ${x} = ${y}(Number(${c}));`),m?k.write(`if (${x} === INVALID) { ${a}[${c}] = ${n}[${c}]; continue; }`):k.write(`if (${x} === INVALID) return INVALID;`),k.write(`if (${x} === "__proto__") continue;`);let O=P(t);k.write(`const ${O} = ${n}[${c}];`);let D=te(k,t,o.valueType,O);k.write(`${a}[${x}] = ${D};`)}),a}return nm(e,t,n,c,m=>{m.write(`const ${u} = ${n}[${c}];`);let g=te(m,t,o.valueType,u);m.write(`${a}[${c}] = ${g};`)},"return INVALID;"),a}function nm(e,t,r,n,o,i){let a=A(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 f_(e,t){return typeof t=="string"?ne(t):A(e,t)}function p_(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 d_(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 m_(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function h_(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let o=r._zod.pattern;if(o){let i=A(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${n})) return INVALID;`)}return n}function g_(e,t,r,n){let o=r._zod.def,i=vt(t,o.getter),a=A(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 $_(e,t,r,n){let o=r._zod.def,i=B(e,t,o.in,n);if(o.transform){if(kt(o.transform))throw new Pe("z.compile: async transforms in pipes are not supported");let a=o.transform,u=vt(t,s(f=>{let p={value:f,issues:[],addIssue:Ou},d=a(f,p);return d instanceof Promise?ie:p.issues.length===0?d: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 kt(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function y_(e,t,r,n){let o=r._zod.def;if(o.fn){if(kt(o.fn))throw new Pe("z.compile: async custom predicates are not supported");let i=vt(t,o.fn),a=A(t,Pu),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 Z("custom schema without a predicate function");return n}function b_(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 w_(e,t,r,n){let o=r._zod.def;if(!o.catchValue[no])throw new Z("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=A(t,o.innerType),c=vt(t,o.catchValue),u=A(t,b_);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 __(e,t,r,n){let o=r._zod.def;if(o.transform){if(kt(o.transform))throw new Pe("z.compile: async transforms are not supported");let i=o.transform,c=vt(t,s(l=>{let f={value:l,issues:[],addIssue:Ou},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,Qd,Pe,Z,Pw,Lw,am=z(()=>{We();ko();_u();$t();Xt();W();ie=Symbol.for("zod.compile.invalid"),Qd=Symbol.for("zod.compile.fallback"),Pe=class extends Error{static{s(this,"ZodCompileAsyncError")}constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},Z=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(kw,"compileValidator");s(Au,"compile");s(Xo,"withParser");s(xw,"installCompiledUserMethods");s(Yo,"compileFn");s(A,"addConstant");s(vt,"addUserConstant");s(P,"newVar");s(Sw,"runtimeRun");s(te,"compileChild");s(zw,"emitRuntimeIsland");Pw=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);s(Iw,"generateChecks");s(zu,"codePointLengthVar");s(wt,"numericOperand");s(om,"comparisonOperand");s(Aw,"generateGreaterThanCheck");s(Ow,"generateLessThanCheck");s(Cw,"generateMultipleOfCheck");s(im,"generateNumberFormatCheck");s(Ew,"generateBigIntFormatCheck");s(Tw,"generateMimeTypeCheck");s(Nw,"generatePropertiesChecks");s(Rw,"generatePropertyCheck");s(Zw,"generateOverwriteCheck");s(Pu,"throwAsync");s(Ou,"pushIssue");s(Dw,"generateCustomRefineCheck");Lw=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(sm,"generateStringFormatCheck");s(B,"generateCheck");s(jw,"generateStringCheck");s(Mw,"generateNumberCheck");s(Fw,"generateBooleanCheck");s(Vw,"generateBigIntCheck");s(Uw,"generateSymbolCheck");s(Bw,"generateUndefinedCheck");s(Kw,"generateNullCheck");s(Jw,"generateVoidCheck");s(Ww,"generateNaNCheck");s(qw,"generateDateCheck");s(Hw,"generateObjectCheck");s(Gw,"generateOptionalCheck");s(Xw,"isExactOptional");s(Yw,"requiresPresenceCheck");s(_t,"fastPathAcceptsAbsence");s(Iu,"dropsWhenAbsent");s(em,"mayOmitUndefined");s(Qt,"mayOutputUndefined");s(Qw,"generateNullableCheck");s(e_,"generateArrayCheck");s(t_,"generateLiteralCheck");s(r_,"generateEnumCheck");s(tm,"generateWrapperCheck");s(n_,"generateDefaultCheck");s(o_,"generateNonOptionalCheck");s(i_,"generateTupleCheck");s(rm,"getTupleOptStart");s(s_,"generateUnionCheck");s(a_,"generateDiscriminatedUnionCheck");s(c_,"literalEquality");s(u_,"generateIntersectionCheck");s(l_,"generateRecordCheck");s(nm,"emitOwnKeys");s(f_,"literalPropertyKey");s(p_,"generateMapCheck");s(d_,"generateSetCheck");s(m_,"generateFileCheck");s(h_,"generateTemplateLiteralCheck");s(g_,"generateLazyCheck");s($_,"generatePipeCheck");s(kt,"isAsyncFunction");s(y_,"generateCustomCheck");s(b_,"runtimeCatch");s(w_,"generateCatchCheck");s(__,"generateTransformCheck")});function Qo(e){return e.checks&&(e.checks=[...e.checks]),e}function Cu(e,t){return new e(Qo({type:"string",...w(t)}))}function Eu(e,t){return new e(Qo({type:"string",coerce:!0,...w(t)}))}function ei(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}function ti(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function ri(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}function ni(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}function oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}function ii(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}function pn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function si(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function ai(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function ci(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function ui(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function li(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}function fi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}function pi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}function di(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function mi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function Tu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...w(t)})}function hi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}function gi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}function $i(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}function yi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}function bi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}function Nu(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...w(t)})}function Ru(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...w(t)})}function wi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}function dn(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function mn(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}function hn(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}function gn(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}function Du(e,t){return new e(Qo({type:"number",checks:[],...w(t)}))}function Lu(e,t){return new e(Qo({type:"number",coerce:!0,checks:[],...w(t)}))}function ju(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}function Mu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...w(t)})}function Fu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...w(t)})}function Vu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...w(t)})}function Uu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...w(t)})}function Bu(e,t){return new e({type:"boolean",...w(t)})}function Ku(e,t){return new e({type:"boolean",coerce:!0,...w(t)})}function Ju(e,t){return new e({type:"bigint",...w(t)})}function Wu(e,t){return new e({type:"bigint",coerce:!0,...w(t)})}function qu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...w(t)})}function Hu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...w(t)})}function Gu(e,t){return new e({type:"symbol",...w(t)})}function Xu(e,t){return new e({type:"undefined",...w(t)})}function Yu(e,t){return new e({type:"null",...w(t)})}function Qu(e){return new e({type:"any"})}function el(e){return new e({type:"unknown"})}function tl(e,t){return new e({type:"never",...w(t)})}function rl(e,t){return new e({type:"void",...w(t)})}function nl(e,t){return new e({type:"date",...w(t)})}function ol(e,t){return new e({type:"date",coerce:!0,...w(t)})}function il(e,t){return new e({type:"nan",...w(t)})}function Ee(e,t){return new wo({check:"less_than",...w(t),value:e,inclusive:!1})}function $e(e,t){return new wo({check:"less_than",...w(t),value:e,inclusive:!0})}function Te(e,t){return new _o({check:"greater_than",...w(t),value:e,inclusive:!1})}function ye(e,t){return new _o({check:"greater_than",...w(t),value:e,inclusive:!0})}function _i(e){return Te(0,e)}function vi(e){return Ee(0,e)}function ki(e){return $e(0,e)}function xi(e){return ye(0,e)}function He(e,t){return new ja({check:"multiple_of",...w(t),value:e})}function Ge(e,t){return new Va({check:"max_size",...w(t),maximum:e})}function Ne(e,t){return new Ua({check:"min_size",...w(t),minimum:e})}function xt(e,t){return new Ba({check:"size_equals",...w(t),size:e})}function St(e,t){return new Ka({check:"max_length",...w(t),maximum:e})}function je(e,t){return new Ja({check:"min_length",...w(t),minimum:e})}function zt(e,t){return new Wa({check:"length_equals",...w(t),length:e})}function er(e,t){return new qa({check:"string_format",format:"regex",...w(t),pattern:e})}function tr(e){return new Ha({check:"string_format",format:"lowercase",...w(e)})}function rr(e){return new Ga({check:"string_format",format:"uppercase",...w(e)})}function nr(e,t){return new Xa({check:"string_format",format:"includes",...w(t),includes:e})}function or(e,t){return new Ya({check:"string_format",format:"starts_with",...w(t),prefix:e})}function ir(e,t){return new Qa({check:"string_format",format:"ends_with",...w(t),suffix:e})}function Si(e,t,r){return new ec({check:"property",property:e,schema:t,...w(r)})}function sr(e,t){return new tc({check:"properties",shape:e,...w(t)})}function ar(e,t){return new rc({check:"mime_type",mime:e,...w(t)})}function Ie(e){return new nc({check:"overwrite",tx:e})}function cr(e){return Ie(t=>t.normalize(e))}function ur(){return Ie(e=>e.trim())}function lr(){return Ie(e=>e.toLowerCase())}function fr(){return Ie(e=>e.toUpperCase())}function pr(){return Ie(e=>Ls(e))}function sl(e,t,r){return new e({type:"array",element:t,...w(r)})}function v_(e,t,r){return new e({type:"union",options:t,...w(r)})}function k_(e,t,r){return new e({type:"union",options:t,inclusive:!1,...w(r)})}function x_(e,t,r,n){return new e({type:"union",options:r,discriminator:t,...w(n)})}function S_(e,t,r){return new e({type:"intersection",left:t,right:r})}function z_(e,t,r,n){let o=r instanceof E,i=o?n:r,a=o?r:null;return new e({type:"tuple",items:t,rest:a,...w(i)})}function P_(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,...w(n)})}function I_(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,...w(n)})}function A_(e,t,r){return new e({type:"set",valueType:t,...w(r)})}function O_(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:n,...w(r)})}function C_(e,t,r){return new e({type:"enum",entries:t,...w(r)})}function E_(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...w(r)})}function al(e,t){return new e({type:"file",...w(t)})}function T_(e,t){return new e({type:"transform",transform:t})}function N_(e,t){return new e({type:"optional",innerType:t})}function R_(e,t){return new e({type:"nullable",innerType:t})}function Z_(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Rr(r)}})}function D_(e,t,r){return new e({type:"nonoptional",innerType:t,...w(r)})}function L_(e,t){return new e({type:"success",innerType:t})}function j_(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:Ks(r)})}function M_(e,t,r){return new e({type:"pipe",in:t,out:r})}function F_(e,t){return new e({type:"readonly",innerType:t})}function V_(e,t,r){return new e({type:"template_literal",parts:t,...w(r)})}function U_(e,t){return new e({type:"lazy",getter:t})}function B_(e,t){return new e({type:"promise",innerType:t})}function cl(e,t,r){let n=w(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function ul(e,t,r){return new e({type:"custom",check:"custom",fn:t,...w(r)})}function ll(e,t){let r=cm(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Bt(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(Bt(i))}},e(n.value,n)),t);return r}function cm(e,t){let r=new U({check:"custom",...w(t)});return r._zod.check=e,r}function fl(e){let t=new U({check:"describe"});return t._zod.onattach=[r=>{let n=Q.get(r)??{};Q.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function pl(e){let t=new U({check:"meta"});return t._zod.onattach=[r=>{let n=Q.get(r)??{};Q.add(r,{...n,...e})}],t._zod.check=()=>{},t}function dl(e,t){let r=w(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(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),a=new Set(o),c=e.Codec??nn,u=e.Boolean??tn,l=e.String??bt,f=new l({type:"string",error:r.error}),p=new u({type:"boolean",error:r.error}),d=new c({type:"pipe",in:f,out:p,transform:s(((m,g)=>{let y=m;return r.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:a.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:d,continue:!1}),{})}),"transform"),reverseTransform:s(((m,g)=>m===!0?n[0]||"true":o[0]||"false"),"reverseTransform"),error:r.error});return d._zod.bag.truthy=n,d._zod.bag.falsy=o,d._zod.bag.case=r.case??"insensitive",d}function Pt(e,t,r,n={}){let o=w(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 Zu,um=z(()=>{vo();fn();Xt();W();s(Qo,"snapshotChecks");s(Cu,"_string");s(Eu,"_coercedString");s(ei,"_email");s(ti,"_guid");s(ri,"_uuid");s(ni,"_uuidv4");s(oi,"_uuidv6");s(ii,"_uuidv7");s(pn,"_url");s(si,"_emoji");s(ai,"_nanoid");s(ci,"_cuid");s(ui,"_cuid2");s(li,"_ulid");s(fi,"_xid");s(pi,"_ksuid");s(di,"_ipv4");s(mi,"_ipv6");s(Tu,"_mac");s(hi,"_cidrv4");s(gi,"_cidrv6");s($i,"_base64");s(yi,"_base64url");s(bi,"_e164");s(Nu,"_creditCard");s(Ru,"_iban");s(wi,"_jwt");Zu={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};s(dn,"_isoDateTime");s(mn,"_isoDate");s(hn,"_isoTime");s(gn,"_isoDuration");s(Du,"_number");s(Lu,"_coercedNumber");s(ju,"_int");s(Mu,"_float32");s(Fu,"_float64");s(Vu,"_int32");s(Uu,"_uint32");s(Bu,"_boolean");s(Ku,"_coercedBoolean");s(Ju,"_bigint");s(Wu,"_coercedBigint");s(qu,"_int64");s(Hu,"_uint64");s(Gu,"_symbol");s(Xu,"_undefined");s(Yu,"_null");s(Qu,"_any");s(el,"_unknown");s(tl,"_never");s(rl,"_void");s(nl,"_date");s(ol,"_coercedDate");s(il,"_nan");s(Ee,"_lt");s($e,"_lte");s(Te,"_gt");s(ye,"_gte");s(_i,"_positive");s(vi,"_negative");s(ki,"_nonpositive");s(xi,"_nonnegative");s(He,"_multipleOf");s(Ge,"_maxSize");s(Ne,"_minSize");s(xt,"_size");s(St,"_maxLength");s(je,"_minLength");s(zt,"_length");s(er,"_regex");s(tr,"_lowercase");s(rr,"_uppercase");s(nr,"_includes");s(or,"_startsWith");s(ir,"_endsWith");s(Si,"_property");s(sr,"_properties");s(ar,"_mime");s(Ie,"_overwrite");s(cr,"_normalize");s(ur,"_trim");s(lr,"_toLowerCase");s(fr,"_toUpperCase");s(pr,"_slugify");s(sl,"_array");s(v_,"_union");s(k_,"_xor");s(x_,"_discriminatedUnion");s(S_,"_intersection");s(z_,"_tuple");s(P_,"_record");s(I_,"_map");s(A_,"_set");s(O_,"_enum");s(C_,"_nativeEnum");s(E_,"_literal");s(al,"_file");s(T_,"_transform");s(N_,"_optional");s(R_,"_nullable");s(Z_,"_default");s(D_,"_nonoptional");s(L_,"_success");s(j_,"_catch");s(M_,"_pipe");s(F_,"_readonly");s(V_,"_templateLiteral");s(U_,"_lazy");s(B_,"_promise");s(cl,"_custom");s(ul,"_refine");s(ll,"_superRefine");s(cm,"_check");s(fl,"describe");s(pl,"meta");s(dl,"_stringbool");s(Pt,"_stringFormat")});function $n(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&Y(e,n,r[n]);return e}function Xe(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??Q,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 q(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 M(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 d=a.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,f)}let p=e._zod.parent;p&&(a.ref||(a.ref=p),M(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 lm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ye(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,d=e.external.uri??(g=>g);if(p)return{ref:d(p)};let m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${lm(m)}`}}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+lm(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>
|
|
66
|
+
}`,d;try{d=new f(...a,p)(...c)}catch(m){throw new R(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=l),d.definite=n.definite,d}function A(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 vt(e,t){return e.definite=!1,A(e,t)}function P(e){return`v${e.varCounter++}`}function Sw(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 R)||!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,zw(e,t,r,n)}}function zw(e,t,r,n){t.definite=!1;let o=A(t,r),i=A(t,Sw),a=P(t);return e.write(`const ${a} = ${i}(${o}, ${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function Iw(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&&!Pw.has(c.check))throw new R('check with a custom "when" condition');switch(c.check){case"greater_than":Aw(e,t,c,i);break;case"less_than":Ow(e,t,c,i);break;case"multiple_of":Cw(e,t,c,i);break;case"number_format":im(e,c,i);break;case"min_length":{let u=wt(c.minimum,"min_length"),l=zu(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=zu(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=zu(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=sm(e,t,c,i);break;case"custom":i=Dw(e,t,a,i);break;case"bigint_format":Ew(e,c,i);break;case"mime_type":Tw(e,t,c,i);break;case"property":Rw(e,t,c,i);break;case"properties":Nw(e,t,c,i);break;case"overwrite":{let u=P(t);Zw(e,t,a,i,u),i=u;break}default:throw new R(`check type ${c.check}`)}}return i}function zu(e,t,r,n){let o=A(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 R(`${t} bound of type ${typeof e}`);return`${e}`}function om(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new R("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new R("comparison check with Invalid Date bound");return A(e,t)}throw new R(`comparison check bound of type ${typeof t}`)}function Aw(e,t,r,n){let o=r.inclusive?"<":"<=";e.write(`if (${n} ${o} ${om(t,r.value)}) return INVALID;`)}function Ow(e,t,r,n){let o=r.inclusive?">":">=";e.write(`if (${n} ${o} ${om(t,r.value)}) return INVALID;`)}function Cw(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new R("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let o=A(t,Nr);e.write(`if (${o}(${n}, ${wt(r.value,"multiple_of")}) !== 0) return INVALID;`)}}function im(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 R(`number format ${n}`)}}function Ew(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 R(`bigint format ${n}`)}}function Tw(e,t,r,n){let o=r.mime;if(o&&o.length>0){let i=A(t,new Set(o));e.write(`if (!${i}.has(${n}.type)) return INVALID;`)}}function Nw(e,t,r,n){if(r.when)throw new R('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"?A(t,i):ne(i),c=P(t);e.write(`const ${c} = ${n}[${a}];`),te(e,t,o[i],c,!1)}}function Rw(e,t,r,n){let o=`${n}[${JSON.stringify(r.property)}]`;B(e,t,r.schema,o)}function Zw(e,t,r,n,o){let i=r._zod.def.tx;if(!i)throw new R("overwrite check without a transform function");if(kt(i))throw new Pe("z.compile: async overwrite transforms are not supported");let a=A(t,i);e.write(`const ${o} = ${a}(${n});`)}function Pu(){throw new pe}function Ou(e){this.issues.push(e)}function Dw(e,t,r,n){let o=r._zod.def;if(o.fn){if(kt(o.fn))throw new Pe("z.compile: async .refine() predicates are not supported");let i=vt(t,o.fn),a=A(t,Pu),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(kt(r._zod.check))throw new Pe("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,c=vt(t,s(l=>{let f={value:l,issues:[],addIssue:Ou};return i(f)instanceof Promise&&Pu(),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 R("custom check without a predicate or check function")}function sm(e,t,r,n,o=!0){let i=r.format;if(i==="base64"){let l=A(t,Qr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="base64url"){let l=A(t,No);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="jwt"){let l=A(t,Do),f=A(t,r.alg??null);return e.write(`if (!${l}(${n}, ${f})) return INVALID;`),n}if(i==="ipv6"){let l=A(t,Yr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="cidrv6"){let l=A(t,Eo);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="credit_card"){let l=A(t,Ro);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="iban"){let l=A(t,Zo);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=A(t,Ao),f=A(t,r),p=P(t),d=P(t);if(e.write(`const ${p} = ${n}.trim();`),e.write(`const ${d} = ${l}(${p}, ${f});`),e.write(`if (typeof ${d} === "number") return INVALID;`),a.hostname!==void 0){let y=A(t,Oo);e.write(`if (!${y}(${d}, ${f}.hostname)) return INVALID;`)}if(a.protocol!==void 0){let y=A(t,Co);e.write(`if (!${y}(${d}, ${f}.protocol)) return INVALID;`)}if(!o)return null;let m=P(t),g=a.normalize?`${d}.href`:`${A(t,Xr)}(${p})`;return e.write(`const ${m} = ${g};`),m}let c=r.fn;if(c){if(kt(c))throw new R(`async string format ${i}`);let l=A(t,c);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(Lw.has(i)&&r.pattern){let l=A(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 R("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 R(`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 R(`coercion (z.coerce.${a}())`);let c=o||!!i.checks?.length,u;switch(a){case"string":u=jw(e,t,r,n,c);break;case"number":u=Mw(e,r,n);break;case"boolean":u=Fw(e,n);break;case"bigint":u=Vw(e,r,n);break;case"symbol":u=Uw(e,n);break;case"undefined":u=Bw(e,n);break;case"null":u=Kw(e,n);break;case"any":case"unknown":u=n;break;case"never":e.write("return INVALID;"),u=n;break;case"void":u=Jw(e,n);break;case"nan":u=Ww(e,n);break;case"date":u=qw(e,n);break;case"object":u=Hw(e,t,r,n,c);break;case"optional":u=Gw(e,t,r,n,c);break;case"nullable":u=Qw(e,t,r,n,c);break;case"array":u=e_(e,t,r,n,c);break;case"literal":u=t_(e,t,r,n);break;case"enum":u=r_(e,t,r,n);break;case"readonly":{let l=tm(e,t,r,n),f=P(t);e.write(`const ${f} = Object.freeze(${l});`),u=f;break}case"success":tm(e,t,r,n),u="true";break;case"default":case"prefault":u=n_(e,t,r,n);break;case"nonoptional":u=o_(e,t,r,n);break;case"tuple":u=i_(e,t,r,n);break;case"union":u=s_(e,t,r,n);break;case"intersection":u=u_(e,t,r,n);break;case"record":u=l_(e,t,r,n);break;case"map":u=p_(e,t,r,n);break;case"set":u=d_(e,t,r,n);break;case"file":u=m_(e,n);break;case"template_literal":u=h_(e,t,r,n);break;case"lazy":u=g_(e,t,r,n);break;case"pipe":u=$_(e,t,r,n);break;case"custom":u=y_(e,t,r,n);break;case"transform":u=__(e,t,r,n);break;case"catch":u=w_(e,t,r,n);break;default:throw new R(`schema type ${a}`)}return u===null?null:Iw(e,t,r,u)}function jw(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:sm(e,t,i,n,o)}function Mw(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&&im(e,{format:n.format},r),r}function Fw(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function Vw(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 Uw(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function Bw(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function Kw(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function Jw(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function Ww(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function qw(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function Hw(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(k=>typeof k=="symbol"?A(t,k):ne(k),"keyExpr"),p=s(k=>typeof k=="symbol"?`[${f(k)}]`:ne(k),"propKey"),d=a;if(c.includes("__proto__"))throw new R('object shape key "__proto__"');let m=new Map;for(let k of l){let O=d[k],Z=f(k),L=P(t);if(e.write(`const ${L} = ${n}[${Z}];`),O._zod.optin!==void 0){let D=P(t);e.write(`let ${D} = (() => {`),e.indented(ee=>{let Er=te(ee,t,O,L);ee.write(`return ${Er};`)}),e.write("})();"),O._zod.optout==="optional"?(e.write(`if (${D} === INVALID) {`),e.indented(ee=>{ee.write(`if (${Z} in ${n}) return INVALID;`),ee.write(`${D} = undefined;`)}),e.write("}")):e.write(`if (${D} === INVALID) return INVALID;`),m.set(k,D)}else{Yw(O)&&e.write(`if (!(${Z} in ${n})) return INVALID;`);let D=te(e,t,O,L,o);D!==null&&m.set(k,D)}}let g=i.catchall,y="none";if(g){let k=g._zod.def.type;if(k==="never"){let O=c.map(Z=>`k !== ${ne(Z)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(Z=>{Z.write(`if (${O}) return INVALID;`)}),e.write("}")}else(k==="unknown"||k==="any")&&!g._zod.def.checks?.length?y="passthrough":y="schema"}let b=P(t),x=l.some(k=>em(d[k])||Iu(d[k]));if(!o){if(y==="schema"){let k=c.length>0?A(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(O=>{O.write('if (k === "__proto__") continue;'),k&&O.write(`if (${k}.has(k)) continue;`);let Z=P(t);O.write(`const ${Z} = ${n}[k];`),te(O,t,g,Z,!1)}),e.write("}")}return null}if(x){e.write(`const ${b} = {};`);for(let k of l){let O=f(k),Z=m.get(k);Iu(d[k])?e.write(`if (${O} in ${n}) ${b}[${O}] = ${Z};`):em(d[k])?e.write(`if (${Z} !== undefined || ${O} in ${n}) ${b}[${O}] = ${Z};`):e.write(`${b}[${O}] = ${Z};`)}}else{let k=l.map(O=>`${p(O)}: ${m.get(O)}`).join(", ");e.write(`const ${b} = { ${k} };`)}if(y!=="none"){let k=c.length>0?A(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(O=>{if(O.write('if (k === "__proto__") continue;'),k&&O.write(`if (${k}.has(k)) continue;`),y==="passthrough")O.write(`${b}[k] = ${n}[k];`);else{let Z=P(t);O.write(`const ${Z} = ${n}[k];`);let L=te(O,t,g,Z);O.write(`${b}[k] = ${L};`)}}),e.write("}")}return b}function Gw(e,t,r,n,o=!0){let i=r._zod.def;if(Xw(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 Xw(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function Yw(e){return e._zod.optin===void 0&&_t(e)}function _t(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?_t(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?_t(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(_t):!0;case"intersection":return!t.left||!t.right?!0:_t(t.left)&&_t(t.right);case"pipe":return t.in?_t(t.in):!0;default:return!0}}function Iu(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function em(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Qt(e)}function Qt(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?Qt(t.innerType):!0;case"union":return t.options?t.options.some(Qt):!0;case"intersection":return!t.left||!t.right||Qt(t.left)||Qt(t.right);case"pipe":return t.out?Qt(t.out):!0;default:return!0}}function Qw(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 e_(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 t_(e,t,r,n){let i=r._zod.def.values;if(i.length!==1){let c=A(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=A(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 R(`literal type ${typeof a}`);return n}function r_(e,t,r,n){let o=r._zod.values;if(!o)throw new R("enum schema without enumerated values");let i=A(t,o);return e.write(`if (!${i}.has(${n})) return INVALID;`),n}function tm(e,t,r,n){let o=r._zod.def;return B(e,t,o.innerType,n)}function n_(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=A(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=A(t,a),l=A(t,Rr);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 o_(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 i_(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=rm(i,"optin"),u=rm(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(d=>{d.write(`if (${f} < ${n}.length) {`),d.indented(m=>{let g=P(t);m.write(`const ${g} = ${n}[${f}];`);let y=te(m,t,p,g);m.write(`${l}[${f}] = ${y};`)}),d.write("} else {"),d.indented(m=>{if(Iu(p)){m.write(`${l}.length = ${f};`);return}let g=P(t),y=P(t);m.write(`const ${g} = undefined;`),m.write(`const ${y} = (() => {`),m.indented(b=>{let x=te(b,t,p,g);b.write(`return ${x};`)}),m.write("})();"),m.write(`if (${y} === INVALID || ${y} === undefined) ${l}.length = ${f};`),m.write(`else ${l}[${f}] = ${y};`)}),d.write("}")}),e.write("}");else{let d=P(t);e.write(`const ${d} = ${n}[${f}];`);let m=te(e,t,p,d);e.write(`${l}[${f}] = ${m};`)}}if(a){let f=P(t),p=P(t);e.write(`for (let ${f} = ${i.length}; ${f} < ${n}.length; ${f}++) {`),e.indented(d=>{d.write(`const ${p} = ${n}[${f}];`);let m=te(d,t,a,p);d.write(`${l}[${f}] = ${m};`)}),e.write("}")}return l}function rm(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 s_(e,t,r,n){let o=r._zod.def,i=o.options;if(o.discriminator)return a_(e,t,o,n);if(o.inclusive===!1)throw new R("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=A(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 a_(e,t,r,n){if(r.unionFallback)throw new R("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 R("discriminated union option without static discriminator values");for(let d of l){if(c.has(d))throw new R(`duplicate discriminator value ${String(d)}`);c.add(d)}let f=Array.from(l,d=>c_(t,o,d)),p=a?"if":"else if";e.write(`${p} (${f.join(" || ")}) {`),e.indented(d=>{let m=B(d,t,u,n);d.write(`${i} = ${m};`)}),e.write("}"),a=!1}return e.write("else { return INVALID; }"),i}function c_(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=A(e,r);return`${t} === ${n}`}throw new R(`literal discriminator value ${String(r)}`)}function u_(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=A(t,Gt),u=P(t);return e.write(`const ${u} = ${c}(${i}, ${a});`),e.write(`if (!${u}.valid) return INVALID;`),`${u}.data`}function l_(e,t,r,n){let o=r._zod.def,i=A(t,ke);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 m=[];for(let y of f){if(!(typeof y=="string"||typeof y=="number"||typeof y=="symbol"))throw new R(`record key value ${String(y)}`);let b=typeof y=="number"?y.toString():y;if(b==="__proto__")throw new R('record key "__proto__"');m.push(b);let x=A(t,y),k=B(e,t,o.keyType,x),O=P(t);e.write(`const ${O} = ${n}[${f_(t,b)}];`);let Z=te(e,t,o.valueType,O);e.write(`${a}[${k}] = ${Z};`)}let g=A(t,new Set(m));return e.write(`for (const ${c} in ${n}) {`),e.indented(y=>{y.write(`if (${g}.has(${c})) continue;`),l.mode==="loose"?y.write(`if (${c} !== "__proto__") ${a}[${c}] = ${n}[${c}];`):y.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 m=o.mode==="loose",g=Yo(o.keyType);g.definite===!1&&(t.definite=!1);let y=A(t,g),b=A(t,Le),x=P(t);return nm(e,t,n,c,k=>{k.write(`let ${x} = ${y}(${c});`),k.write(`if (${x} === INVALID && typeof ${c} === "string" && ${b}.test(${c})) ${x} = ${y}(Number(${c}));`),m?k.write(`if (${x} === INVALID) { ${a}[${c}] = ${n}[${c}]; continue; }`):k.write(`if (${x} === INVALID) return INVALID;`),k.write(`if (${x} === "__proto__") continue;`);let O=P(t);k.write(`const ${O} = ${n}[${c}];`);let Z=te(k,t,o.valueType,O);k.write(`${a}[${x}] = ${Z};`)}),a}return nm(e,t,n,c,m=>{m.write(`const ${u} = ${n}[${c}];`);let g=te(m,t,o.valueType,u);m.write(`${a}[${c}] = ${g};`)},"return INVALID;"),a}function nm(e,t,r,n,o,i){let a=A(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 f_(e,t){return typeof t=="string"?ne(t):A(e,t)}function p_(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 d_(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 m_(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function h_(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let o=r._zod.pattern;if(o){let i=A(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${n})) return INVALID;`)}return n}function g_(e,t,r,n){let o=r._zod.def,i=vt(t,o.getter),a=A(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 $_(e,t,r,n){let o=r._zod.def,i=B(e,t,o.in,n);if(o.transform){if(kt(o.transform))throw new Pe("z.compile: async transforms in pipes are not supported");let a=o.transform,u=vt(t,s(f=>{let p={value:f,issues:[],addIssue:Ou},d=a(f,p);return d instanceof Promise?ie:p.issues.length===0?d: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 kt(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function y_(e,t,r,n){let o=r._zod.def;if(o.fn){if(kt(o.fn))throw new Pe("z.compile: async custom predicates are not supported");let i=vt(t,o.fn),a=A(t,Pu),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 R("custom schema without a predicate function");return n}function b_(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 w_(e,t,r,n){let o=r._zod.def;if(!o.catchValue[no])throw new R("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=A(t,o.innerType),c=vt(t,o.catchValue),u=A(t,b_);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 __(e,t,r,n){let o=r._zod.def;if(o.transform){if(kt(o.transform))throw new Pe("z.compile: async transforms are not supported");let i=o.transform,c=vt(t,s(l=>{let f={value:l,issues:[],addIssue:Ou},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,Qd,Pe,R,Pw,Lw,am=z(()=>{We();ko();_u();$t();Xt();W();ie=Symbol.for("zod.compile.invalid"),Qd=Symbol.for("zod.compile.fallback"),Pe=class extends Error{static{s(this,"ZodCompileAsyncError")}constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},R=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(kw,"compileValidator");s(Au,"compile");s(Xo,"withParser");s(xw,"installCompiledUserMethods");s(Yo,"compileFn");s(A,"addConstant");s(vt,"addUserConstant");s(P,"newVar");s(Sw,"runtimeRun");s(te,"compileChild");s(zw,"emitRuntimeIsland");Pw=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);s(Iw,"generateChecks");s(zu,"codePointLengthVar");s(wt,"numericOperand");s(om,"comparisonOperand");s(Aw,"generateGreaterThanCheck");s(Ow,"generateLessThanCheck");s(Cw,"generateMultipleOfCheck");s(im,"generateNumberFormatCheck");s(Ew,"generateBigIntFormatCheck");s(Tw,"generateMimeTypeCheck");s(Nw,"generatePropertiesChecks");s(Rw,"generatePropertyCheck");s(Zw,"generateOverwriteCheck");s(Pu,"throwAsync");s(Ou,"pushIssue");s(Dw,"generateCustomRefineCheck");Lw=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(sm,"generateStringFormatCheck");s(B,"generateCheck");s(jw,"generateStringCheck");s(Mw,"generateNumberCheck");s(Fw,"generateBooleanCheck");s(Vw,"generateBigIntCheck");s(Uw,"generateSymbolCheck");s(Bw,"generateUndefinedCheck");s(Kw,"generateNullCheck");s(Jw,"generateVoidCheck");s(Ww,"generateNaNCheck");s(qw,"generateDateCheck");s(Hw,"generateObjectCheck");s(Gw,"generateOptionalCheck");s(Xw,"isExactOptional");s(Yw,"requiresPresenceCheck");s(_t,"fastPathAcceptsAbsence");s(Iu,"dropsWhenAbsent");s(em,"mayOmitUndefined");s(Qt,"mayOutputUndefined");s(Qw,"generateNullableCheck");s(e_,"generateArrayCheck");s(t_,"generateLiteralCheck");s(r_,"generateEnumCheck");s(tm,"generateWrapperCheck");s(n_,"generateDefaultCheck");s(o_,"generateNonOptionalCheck");s(i_,"generateTupleCheck");s(rm,"getTupleOptStart");s(s_,"generateUnionCheck");s(a_,"generateDiscriminatedUnionCheck");s(c_,"literalEquality");s(u_,"generateIntersectionCheck");s(l_,"generateRecordCheck");s(nm,"emitOwnKeys");s(f_,"literalPropertyKey");s(p_,"generateMapCheck");s(d_,"generateSetCheck");s(m_,"generateFileCheck");s(h_,"generateTemplateLiteralCheck");s(g_,"generateLazyCheck");s($_,"generatePipeCheck");s(kt,"isAsyncFunction");s(y_,"generateCustomCheck");s(b_,"runtimeCatch");s(w_,"generateCatchCheck");s(__,"generateTransformCheck")});function Qo(e){return e.checks&&(e.checks=[...e.checks]),e}function Cu(e,t){return new e(Qo({type:"string",...w(t)}))}function Eu(e,t){return new e(Qo({type:"string",coerce:!0,...w(t)}))}function ei(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}function ti(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}function ri(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}function ni(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}function oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}function ii(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}function pn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}function si(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}function ai(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}function ci(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}function ui(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}function li(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}function fi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}function pi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}function di(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}function mi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}function Tu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...w(t)})}function hi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}function gi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}function $i(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}function yi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}function bi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}function Nu(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...w(t)})}function Ru(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...w(t)})}function wi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}function dn(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}function mn(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}function hn(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}function gn(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}function Du(e,t){return new e(Qo({type:"number",checks:[],...w(t)}))}function Lu(e,t){return new e(Qo({type:"number",coerce:!0,checks:[],...w(t)}))}function ju(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}function Mu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...w(t)})}function Fu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...w(t)})}function Vu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...w(t)})}function Uu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...w(t)})}function Bu(e,t){return new e({type:"boolean",...w(t)})}function Ku(e,t){return new e({type:"boolean",coerce:!0,...w(t)})}function Ju(e,t){return new e({type:"bigint",...w(t)})}function Wu(e,t){return new e({type:"bigint",coerce:!0,...w(t)})}function qu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...w(t)})}function Hu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...w(t)})}function Gu(e,t){return new e({type:"symbol",...w(t)})}function Xu(e,t){return new e({type:"undefined",...w(t)})}function Yu(e,t){return new e({type:"null",...w(t)})}function Qu(e){return new e({type:"any"})}function el(e){return new e({type:"unknown"})}function tl(e,t){return new e({type:"never",...w(t)})}function rl(e,t){return new e({type:"void",...w(t)})}function nl(e,t){return new e({type:"date",...w(t)})}function ol(e,t){return new e({type:"date",coerce:!0,...w(t)})}function il(e,t){return new e({type:"nan",...w(t)})}function Ee(e,t){return new wo({check:"less_than",...w(t),value:e,inclusive:!1})}function $e(e,t){return new wo({check:"less_than",...w(t),value:e,inclusive:!0})}function Te(e,t){return new _o({check:"greater_than",...w(t),value:e,inclusive:!1})}function ye(e,t){return new _o({check:"greater_than",...w(t),value:e,inclusive:!0})}function _i(e){return Te(0,e)}function vi(e){return Ee(0,e)}function ki(e){return $e(0,e)}function xi(e){return ye(0,e)}function He(e,t){return new ja({check:"multiple_of",...w(t),value:e})}function Ge(e,t){return new Va({check:"max_size",...w(t),maximum:e})}function Ne(e,t){return new Ua({check:"min_size",...w(t),minimum:e})}function xt(e,t){return new Ba({check:"size_equals",...w(t),size:e})}function St(e,t){return new Ka({check:"max_length",...w(t),maximum:e})}function je(e,t){return new Ja({check:"min_length",...w(t),minimum:e})}function zt(e,t){return new Wa({check:"length_equals",...w(t),length:e})}function er(e,t){return new qa({check:"string_format",format:"regex",...w(t),pattern:e})}function tr(e){return new Ha({check:"string_format",format:"lowercase",...w(e)})}function rr(e){return new Ga({check:"string_format",format:"uppercase",...w(e)})}function nr(e,t){return new Xa({check:"string_format",format:"includes",...w(t),includes:e})}function or(e,t){return new Ya({check:"string_format",format:"starts_with",...w(t),prefix:e})}function ir(e,t){return new Qa({check:"string_format",format:"ends_with",...w(t),suffix:e})}function Si(e,t,r){return new ec({check:"property",property:e,schema:t,...w(r)})}function sr(e,t){return new tc({check:"properties",shape:e,...w(t)})}function ar(e,t){return new rc({check:"mime_type",mime:e,...w(t)})}function Ie(e){return new nc({check:"overwrite",tx:e})}function cr(e){return Ie(t=>t.normalize(e))}function ur(){return Ie(e=>e.trim())}function lr(){return Ie(e=>e.toLowerCase())}function fr(){return Ie(e=>e.toUpperCase())}function pr(){return Ie(e=>Ls(e))}function sl(e,t,r){return new e({type:"array",element:t,...w(r)})}function v_(e,t,r){return new e({type:"union",options:t,...w(r)})}function k_(e,t,r){return new e({type:"union",options:t,inclusive:!1,...w(r)})}function x_(e,t,r,n){return new e({type:"union",options:r,discriminator:t,...w(n)})}function S_(e,t,r){return new e({type:"intersection",left:t,right:r})}function z_(e,t,r,n){let o=r instanceof E,i=o?n:r,a=o?r:null;return new e({type:"tuple",items:t,rest:a,...w(i)})}function P_(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,...w(n)})}function I_(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,...w(n)})}function A_(e,t,r){return new e({type:"set",valueType:t,...w(r)})}function O_(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:n,...w(r)})}function C_(e,t,r){return new e({type:"enum",entries:t,...w(r)})}function E_(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...w(r)})}function al(e,t){return new e({type:"file",...w(t)})}function T_(e,t){return new e({type:"transform",transform:t})}function N_(e,t){return new e({type:"optional",innerType:t})}function R_(e,t){return new e({type:"nullable",innerType:t})}function Z_(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Rr(r)}})}function D_(e,t,r){return new e({type:"nonoptional",innerType:t,...w(r)})}function L_(e,t){return new e({type:"success",innerType:t})}function j_(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:Ks(r)})}function M_(e,t,r){return new e({type:"pipe",in:t,out:r})}function F_(e,t){return new e({type:"readonly",innerType:t})}function V_(e,t,r){return new e({type:"template_literal",parts:t,...w(r)})}function U_(e,t){return new e({type:"lazy",getter:t})}function B_(e,t){return new e({type:"promise",innerType:t})}function cl(e,t,r){let n=w(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function ul(e,t,r){return new e({type:"custom",check:"custom",fn:t,...w(r)})}function ll(e,t){let r=cm(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Bt(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(Bt(i))}},e(n.value,n)),t);return r}function cm(e,t){let r=new U({check:"custom",...w(t)});return r._zod.check=e,r}function fl(e){let t=new U({check:"describe"});return t._zod.onattach=[r=>{let n=Q.get(r)??{};Q.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function pl(e){let t=new U({check:"meta"});return t._zod.onattach=[r=>{let n=Q.get(r)??{};Q.add(r,{...n,...e})}],t._zod.check=()=>{},t}function dl(e,t){let r=w(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(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),a=new Set(o),c=e.Codec??nn,u=e.Boolean??tn,l=e.String??bt,f=new l({type:"string",error:r.error}),p=new u({type:"boolean",error:r.error}),d=new c({type:"pipe",in:f,out:p,transform:s(((m,g)=>{let y=m;return r.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:a.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:d,continue:!1}),{})}),"transform"),reverseTransform:s(((m,g)=>m===!0?n[0]||"true":o[0]||"false"),"reverseTransform"),error:r.error});return d._zod.bag.truthy=n,d._zod.bag.falsy=o,d._zod.bag.case=r.case??"insensitive",d}function Pt(e,t,r,n={}){let o=w(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 Zu,um=z(()=>{vo();fn();Xt();W();s(Qo,"snapshotChecks");s(Cu,"_string");s(Eu,"_coercedString");s(ei,"_email");s(ti,"_guid");s(ri,"_uuid");s(ni,"_uuidv4");s(oi,"_uuidv6");s(ii,"_uuidv7");s(pn,"_url");s(si,"_emoji");s(ai,"_nanoid");s(ci,"_cuid");s(ui,"_cuid2");s(li,"_ulid");s(fi,"_xid");s(pi,"_ksuid");s(di,"_ipv4");s(mi,"_ipv6");s(Tu,"_mac");s(hi,"_cidrv4");s(gi,"_cidrv6");s($i,"_base64");s(yi,"_base64url");s(bi,"_e164");s(Nu,"_creditCard");s(Ru,"_iban");s(wi,"_jwt");Zu={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};s(dn,"_isoDateTime");s(mn,"_isoDate");s(hn,"_isoTime");s(gn,"_isoDuration");s(Du,"_number");s(Lu,"_coercedNumber");s(ju,"_int");s(Mu,"_float32");s(Fu,"_float64");s(Vu,"_int32");s(Uu,"_uint32");s(Bu,"_boolean");s(Ku,"_coercedBoolean");s(Ju,"_bigint");s(Wu,"_coercedBigint");s(qu,"_int64");s(Hu,"_uint64");s(Gu,"_symbol");s(Xu,"_undefined");s(Yu,"_null");s(Qu,"_any");s(el,"_unknown");s(tl,"_never");s(rl,"_void");s(nl,"_date");s(ol,"_coercedDate");s(il,"_nan");s(Ee,"_lt");s($e,"_lte");s(Te,"_gt");s(ye,"_gte");s(_i,"_positive");s(vi,"_negative");s(ki,"_nonpositive");s(xi,"_nonnegative");s(He,"_multipleOf");s(Ge,"_maxSize");s(Ne,"_minSize");s(xt,"_size");s(St,"_maxLength");s(je,"_minLength");s(zt,"_length");s(er,"_regex");s(tr,"_lowercase");s(rr,"_uppercase");s(nr,"_includes");s(or,"_startsWith");s(ir,"_endsWith");s(Si,"_property");s(sr,"_properties");s(ar,"_mime");s(Ie,"_overwrite");s(cr,"_normalize");s(ur,"_trim");s(lr,"_toLowerCase");s(fr,"_toUpperCase");s(pr,"_slugify");s(sl,"_array");s(v_,"_union");s(k_,"_xor");s(x_,"_discriminatedUnion");s(S_,"_intersection");s(z_,"_tuple");s(P_,"_record");s(I_,"_map");s(A_,"_set");s(O_,"_enum");s(C_,"_nativeEnum");s(E_,"_literal");s(al,"_file");s(T_,"_transform");s(N_,"_optional");s(R_,"_nullable");s(Z_,"_default");s(D_,"_nonoptional");s(L_,"_success");s(j_,"_catch");s(M_,"_pipe");s(F_,"_readonly");s(V_,"_templateLiteral");s(U_,"_lazy");s(B_,"_promise");s(cl,"_custom");s(ul,"_refine");s(ll,"_superRefine");s(cm,"_check");s(fl,"describe");s(pl,"meta");s(dl,"_stringbool");s(Pt,"_stringFormat")});function $n(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&Y(e,n,r[n]);return e}function Xe(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??Q,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 q(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 d=a.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,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 lm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ye(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,d=e.external.uri??(g=>g);if(p)return{ref:d(p)};let m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${lm(m)}`}}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+lm(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
|
-
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 dm(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;dm(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 pm(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function ml(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let a in i)if(!mm.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]??pm(l);f!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(f))||c.push(f))}let u=c.length===1?c[0]:ml(c)??{allOf:c};Y(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=pm(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 K_(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of mm)if(o in e)return;let r=t.filter(o=>fm.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=ml(t);else{let o=r[0],i=fm.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=>ml([...a,u]));if(c.some(u=>!u))return;n={[i]:c}}n&&(delete e.allOf,$n(e,n))}function Qe(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 m=e.seen.get(p),g=m.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 b in l)b==="$ref"||b==="allOf"||b in f||delete l[b];if(g.$ref&&m.def)for(let b in l)b==="$ref"||b==="allOf"||b in m.def&&JSON.stringify(l[b])===JSON.stringify(m.def[b])&&delete l[b]}let d=c._zod.parent;if(d&&d!==p){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(l.$ref=m.schema.$ref,m.def))for(let g in l)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(l[g])===JSON.stringify(m.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())dm(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)??[])K_(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,Y(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:dr(t,"input",e.processors),output:dr(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 mm,fm,hl,dr,yn=z(()=>{fn();W();s($n,"assignProps");s(Xe,"initializeContext");s(q,"handleUnrepresentable");s(M,"processSchema");s(lm,"encodeJSONPointerSegment");s(Ye,"extractDefs");s(dm,"compactTypeUnion");mm=new Set(["type","properties","required","additionalProperties"]),fm=["oneOf","anyOf"];s(pm,"undeclaredConstraint");s(ml,"foldObjects");s(K_,"foldIntersection");s(Qe,"finalize");s(se,"isTransforming");hl=s((e,t={})=>r=>{let n=Xe({...r,processors:t});return M(e,n),Ye(n,e),Qe(n,e)},"createToJSONSchemaMethod"),dr=s((e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=Xe({...o??{},target:i,io:t,processors:r});return M(e,a),Ye(a,e),Qe(a,e)},"createStandardJSONSchemaMethod")});function H(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)J_[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&mr(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&mr(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&hr(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&hr(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&bm(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&_m(t,o.mime);for(let i of o.patterns??[])wm(t,i);return t}function bn(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?bn(t.out):t.type==="catch"?bn(t.innerType):e._zod.optin}function gl(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 y=gl(e,g,r);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let b=y.map(x=>gl(e,x,r));b.some((x,k)=>x!==y[k])&&(t={...t,[g]:b})}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:d,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(n.includes("number")?Le:Wr).source)),m}function H_(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 $l.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let a=gl(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 xm(e,t,r,n,o){let i=!1,a=JSON.stringify(e,(c,u)=>typeof u!="bigint"?u:(i=!0,null));return i?(q(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ql):JSON.parse(a)}function Ai(e,t){if("_idmap"in e){let n=e,o=Xe({...t,processors:zi}),i={};for(let u of n._idmap.entries()){let[l,f]=u;M(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;Ye(o,f),Y(a,l,Qe(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=Xe({...t,processors:zi});return M(e,r),Ye(r,e),Qe(r,e)}var mr,hr,hm,bm,wm,_m,vm,gm,$m,ym,J_,W_,q_,km,yl,bl,wl,_l,vl,kl,xl,Sl,zl,Pl,Il,Al,Ol,Cl,El,Tl,Nl,Rl,Zl,Dl,Ll,jl,Ml,Fl,Vl,Pi,Ul,Bl,$l,Kl,Jl,Wl,ql,Hl,Gl,Xl,Yl,Ql,ef,Ii,tf,zi,wn=z(()=>{$t();Xt();yn();W();mr=s((e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},"narrowMin"),hr=s((e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},"narrowMax"),hm=s((e,t)=>{mr(e,"minimum",t),hr(e,"maximum",t)},"narrowBoth"),bm=s((e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},"addDivisor"),wm=s((e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},"addPattern"),_m=s((e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},"intersectMime"),vm=s((e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},"setFormat"),gm=s((e,t)=>mr(e,"minimum",t.minimum),"minContributor"),$m=s((e,t)=>hr(e,"maximum",t.maximum),"maxContributor"),ym=s(e=>(t,r)=>{vm(t,r.format);let[n,o]=e[r.format];mr(t,"minimum",n),hr(t,"maximum",o)},"formatContributor"),J_={greater_than:s((e,t)=>mr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),"greater_than"),less_than:s((e,t)=>hr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),"less_than"),multiple_of:s((e,t)=>bm(e,t.value),"multiple_of"),number_format:ym(Dr),bigint_format:ym(Lr),min_length:gm,max_length:$m,length_equals:s((e,t)=>hm(e,t.length),"length_equals"),min_size:gm,max_size:$m,size_equals:s((e,t)=>hm(e,t.size),"size_equals"),string_format:s((e,t)=>{vm(e,t.format),t.pattern&&wm(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)=>_m(e,t.mime),"mime_type")};s(H,"aggregateChecks");W_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},q_=new Map([[To,ba],[en,wa]]),km=s(e=>q_.get(e)??e,"exactPattern"),yl=s((e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:c,patterns:u,contentEncoding:l,laxFormat:f}=H(e);if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),c&&(o.format=W_[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(km);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},"stringProcessor"),bl=s((e,t,r,n)=>{let o=r,{minimum:i,maximum:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l,isInt:f}=H(e);o.type=f?"integer":"number";let p=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),d=typeof u=="number"&&u<=(a??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(p?m?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof i=="number"&&(o.minimum=i),d?m?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof a=="number"&&(o.maximum=a),c){let g=new Set;for(let x of c)Number.isFinite(x)&&x!==0?g.add(Math.abs(x)):q(e,t,o,n,`A multipleOf divisor of ${x} cannot be represented in JSON Schema`);let[y,...b]=g;y!==void 0&&(o.multipleOf=y),b.length&&(o.allOf=[...o.allOf??[],...b.map(x=>({multipleOf:x}))])}},"numberProcessor"),wl=s((e,t,r,n)=>{r.type="boolean"},"booleanProcessor"),_l=s((e,t,r,n)=>{q(e,t,r,n,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),vl=s((e,t,r,n)=>{q(e,t,r,n,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),kl=s((e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},"nullProcessor"),xl=s((e,t,r,n)=>{q(e,t,r,n,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),Sl=s((e,t,r,n)=>{q(e,t,r,n,"Void cannot be represented in JSON Schema")},"voidProcessor"),zl=s((e,t,r,n)=>{r.not={}},"neverProcessor"),Pl=s((e,t,r,n)=>{},"anyProcessor"),Il=s((e,t,r,n)=>{},"unknownProcessor"),Al=s((e,t,r,n)=>{q(e,t,r,n,"Date cannot be represented in JSON Schema")},"dateProcessor"),Ol=s((e,t,r,n)=>{let o=e._zod.def,i=Mt(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"),Cl=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(q(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(q(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"),El=s((e,t,r,n)=>{q(e,t,r,n,"NaN cannot be represented in JSON Schema")},"nanProcessor"),Tl=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"),Nl=s((e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:a,mime:c}=H(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"),Rl=s((e,t,r,n)=>{r.type="boolean"},"successProcessor"),Zl=s((e,t,r,n)=>{q(e,t,r,n,"Custom types cannot be represented in JSON Schema")},"customProcessor"),Dl=s((e,t,r,n)=>{q(e,t,r,n,"Function types cannot be represented in JSON Schema")},"functionProcessor"),Ll=s((e,t,r,n)=>{q(e,t,r,n,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),jl=s((e,t,r,n)=>{q(e,t,r,n,"Map cannot be represented in JSON Schema")},"mapProcessor"),Ml=s((e,t,r,n)=>{q(e,t,r,n,"Set cannot be represented in JSON Schema")},"setProcessor"),Fl=s((e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:c}=H(e);typeof a=="number"&&(o.minItems=a),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=M(i.element,t,{...n,path:[...n.path,"items"]})},"arrayProcessor");s(bn,"inputOptin");Vl=s((e,t,r,n)=>{let o=r,i=e._zod.def,a=i.shape;if(Object.getOwnPropertySymbols(a).length&&q(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in a)Y(o.properties,l,M(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"?bn(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=M(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},"objectProcessor"),Pi=s((e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((c,u)=>M(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));i?r.oneOf=a:r.anyOf=a},"unionProcessor"),Ul=s((e,t,r,n)=>{let o=e._zod.def,i=M(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=M(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"),Bl=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((y,b)=>M(y,t,{...n,path:[...n.path,a,b]})),l=i.rest?M(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 y=i.items[f-1];if(!(t.io==="input"?bn(y)!==void 0:y._zod.optout==="optional"))break;f--}let p=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=u,d?o.items=!1:l&&(o.items=l),f>0&&(o.minItems=f),d&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:u},l&&o.items.anyOf.push(l),f>0&&(o.minItems=f),d&&(o.maxItems=p)):(o.items=u,d?o.additionalItems=!1:l&&(o.additionalItems=l),f>0&&(o.minItems=f),d&&(o.maxItems=p));let{minimum:m,maximum:g}=H(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)},"tupleProcessor");s(gl,"stringifyKeyNames");$l=new WeakMap;s(H_,"rewriteKeyNames");Kl=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=H(a).patterns;if(i.mode==="loose"&&c&&c.size>0){let f=M(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of c)Y(o.patternProperties,km(p).source,f)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=M(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let f=$l.get(t);f||(f=[],$l.set(t,f),t.deferred.push(()=>H_(t))),f.push(e)}o.additionalProperties=M(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=a._zod.values,l=t.io==="input"&&bn(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"),Jl=s((e,t,r,n)=>{let o=e._zod.def,i=M(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"),Wl=s((e,t,r,n)=>{let o=e._zod.def;M(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"nonoptionalProcessor"),ql=Symbol();s(xm,"serializeDefaultValue");Hl=s((e,t,r,n)=>{let o=e._zod.def;M(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a=xm(o.defaultValue,e,t,r,n);a!==ql&&(r.default=a)},"defaultProcessor"),Gl=s((e,t,r,n)=>{let o=e._zod.def;M(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let a=xm(o.defaultValue,e,t,r,n);a!==ql&&(r._prefault=a)},"prefaultProcessor"),Xl=s((e,t,r,n)=>{let o=e._zod.def;M(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{q(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=a},"catchProcessor"),Yl=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;M(a,t,n);let c=t.seen.get(e);c.ref=a},"pipeProcessor"),Ql=s((e,t,r,n)=>{let o=e._zod.def;M(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},"readonlyProcessor"),ef=s((e,t,r,n)=>{let o=e._zod.def;M(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"promiseProcessor"),Ii=s((e,t,r,n)=>{let o=e._zod.def;M(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"optionalProcessor"),tf=s((e,t,r,n)=>{let o=e._zod.innerType;M(o,t,n);let i=t.seen.get(e);i.ref=o},"lazyProcessor"),zi={string:yl,number:bl,boolean:wl,bigint:_l,symbol:vl,null:kl,undefined:xl,void:Sl,never:zl,any:Pl,unknown:Il,date:Al,enum:Ol,literal:Cl,nan:El,template_literal:Tl,file:Nl,success:Rl,custom:Zl,function:Dl,transform:Ll,map:jl,set:Ml,array:Fl,object:Vl,union:Pi,intersection:Ul,tuple:Bl,record:Kl,nullable:Jl,nonoptional:Wl,default:Hl,prefault:Gl,catch:Xl,pipe:Yl,readonly:Ql,promise:ef,optional:Ii,lazy:tf};s(Ai,"toJSONSchema")});var Oi,Sm=z(()=>{wn();yn();Oi=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=Xe({processors:zi,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 M(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,Ye(this.ctx,t);let n=Qe(this.ctx,t),{"~standard":o,...i}=n;return i}}});var zm={};var Pm=z(()=>{});var Me={};ge(Me,{$ZodAny:()=>Fc,$ZodArray:()=>Jc,$ZodAsyncError:()=>pe,$ZodBase64:()=>Ac,$ZodBase64URL:()=>Oc,$ZodBigInt:()=>jo,$ZodBigIntFormat:()=>Dc,$ZodBoolean:()=>tn,$ZodCIDRv4:()=>Pc,$ZodCIDRv6:()=>Ic,$ZodCUID:()=>hc,$ZodCUID2:()=>gc,$ZodCatch:()=>fu,$ZodCheck:()=>U,$ZodCheckBigIntFormat:()=>Fa,$ZodCheckEndsWith:()=>Qa,$ZodCheckGreaterThan:()=>_o,$ZodCheckIncludes:()=>Xa,$ZodCheckLengthEquals:()=>Wa,$ZodCheckLessThan:()=>wo,$ZodCheckLowerCase:()=>Ha,$ZodCheckMaxLength:()=>Ka,$ZodCheckMaxSize:()=>Va,$ZodCheckMimeType:()=>rc,$ZodCheckMinLength:()=>Ja,$ZodCheckMinSize:()=>Ua,$ZodCheckMultipleOf:()=>ja,$ZodCheckNumberFormat:()=>Ma,$ZodCheckOverwrite:()=>nc,$ZodCheckProperties:()=>tc,$ZodCheckProperty:()=>ec,$ZodCheckRegex:()=>qa,$ZodCheckSizeEquals:()=>Ba,$ZodCheckStartsWith:()=>Ya,$ZodCheckStringFormat:()=>Ht,$ZodCheckUpperCase:()=>Ga,$ZodCodec:()=>nn,$ZodCreditCard:()=>Ec,$ZodCustom:()=>yu,$ZodCustomStringFormat:()=>Rc,$ZodCyclicError:()=>Jo,$ZodDate:()=>Kc,$ZodDefault:()=>au,$ZodDiscriminatedUnion:()=>Gc,$ZodE164:()=>Cc,$ZodEmail:()=>uc,$ZodEmoji:()=>dc,$ZodEncodeError:()=>qe,$ZodEnum:()=>tu,$ZodError:()=>Xs,$ZodExactOptional:()=>iu,$ZodFile:()=>nu,$ZodFunction:()=>gu,$ZodGUID:()=>ac,$ZodIBAN:()=>Tc,$ZodIPv4:()=>xc,$ZodIPv6:()=>Sc,$ZodISODate:()=>_c,$ZodISODateTime:()=>wc,$ZodISODuration:()=>kc,$ZodISOTime:()=>vc,$ZodIntersection:()=>Xc,$ZodJWT:()=>Nc,$ZodKSUID:()=>bc,$ZodLazy:()=>on,$ZodLiteral:()=>ru,$ZodMAC:()=>zc,$ZodMap:()=>Qc,$ZodNaN:()=>pu,$ZodNanoID:()=>mc,$ZodNever:()=>Uc,$ZodNonOptional:()=>uu,$ZodNull:()=>Mc,$ZodNullable:()=>su,$ZodNumber:()=>Lo,$ZodNumberFormat:()=>Zc,$ZodObject:()=>Jd,$ZodObjectJIT:()=>Wc,$ZodOptional:()=>Fo,$ZodPipe:()=>Vo,$ZodPrefault:()=>cu,$ZodPreprocess:()=>du,$ZodPromise:()=>$u,$ZodReadonly:()=>mu,$ZodRealError:()=>de,$ZodRecord:()=>Yc,$ZodRegistry:()=>Ho,$ZodSet:()=>eu,$ZodString:()=>bt,$ZodStringFormat:()=>j,$ZodSuccess:()=>lu,$ZodSymbol:()=>Lc,$ZodTemplateLiteral:()=>hu,$ZodTransform:()=>ou,$ZodTuple:()=>Mo,$ZodType:()=>E,$ZodULID:()=>$c,$ZodURL:()=>pc,$ZodUUID:()=>cc,$ZodUndefined:()=>jc,$ZodUnion:()=>rn,$ZodUnknown:()=>Vc,$ZodVoid:()=>Bc,$ZodXID:()=>yc,$ZodXor:()=>qc,$brand:()=>qs,$constructor:()=>h,$input:()=>Su,$output:()=>xu,Doc:()=>yt,INVALID:()=>ie,JSONSchema:()=>zm,JSONSchemaGenerator:()=>Oi,NEVER:()=>Ws,TimePrecision:()=>Zu,URL_BAD_FORMAT:()=>lc,URL_UNPARSEABLE:()=>Gr,ZodCompileAsyncError:()=>Pe,ZodCompileUnsupportedError:()=>Z,_any:()=>Qu,_array:()=>sl,_base64:()=>$i,_base64url:()=>yi,_bigint:()=>Ju,_boolean:()=>Bu,_catch:()=>j_,_check:()=>cm,_cidrv4:()=>hi,_cidrv6:()=>gi,_coercedBigint:()=>Wu,_coercedBoolean:()=>Ku,_coercedDate:()=>ol,_coercedNumber:()=>Lu,_coercedString:()=>Eu,_creditCard:()=>Nu,_cuid:()=>ci,_cuid2:()=>ui,_custom:()=>cl,_date:()=>nl,_decode:()=>co,_decodeAsync:()=>lo,_default:()=>Z_,_discriminatedUnion:()=>x_,_e164:()=>bi,_email:()=>ei,_emoji:()=>si,_encode:()=>ao,_encodeAsync:()=>uo,_endsWith:()=>ir,_enum:()=>O_,_file:()=>al,_float32:()=>Mu,_float64:()=>Fu,_gt:()=>Te,_gte:()=>ye,_guid:()=>ti,_iban:()=>Ru,_includes:()=>nr,_int:()=>ju,_int32:()=>Vu,_int64:()=>qu,_intersection:()=>S_,_ipv4:()=>di,_ipv6:()=>mi,_isoDate:()=>mn,_isoDateTime:()=>dn,_isoDuration:()=>gn,_isoTime:()=>hn,_jwt:()=>wi,_ksuid:()=>pi,_lazy:()=>U_,_length:()=>zt,_literal:()=>E_,_lowercase:()=>tr,_lt:()=>Ee,_lte:()=>$e,_mac:()=>Tu,_map:()=>I_,_max:()=>$e,_maxLength:()=>St,_maxSize:()=>Ge,_mime:()=>ar,_min:()=>ye,_minLength:()=>je,_minSize:()=>Ne,_multipleOf:()=>He,_nan:()=>il,_nanoid:()=>ai,_nativeEnum:()=>C_,_negative:()=>vi,_never:()=>tl,_nonnegative:()=>xi,_nonoptional:()=>D_,_nonpositive:()=>ki,_normalize:()=>cr,_null:()=>Yu,_nullable:()=>R_,_number:()=>Du,_optional:()=>N_,_overwrite:()=>Ie,_parse:()=>Kt,_parseAsync:()=>Jt,_pipe:()=>M_,_positive:()=>_i,_promise:()=>B_,_properties:()=>sr,_property:()=>Si,_readonly:()=>F_,_record:()=>P_,_refine:()=>ul,_regex:()=>er,_safeDecode:()=>po,_safeDecodeAsync:()=>ho,_safeEncode:()=>fo,_safeEncodeAsync:()=>mo,_safeParse:()=>Wt,_safeParseAsync:()=>qt,_set:()=>A_,_size:()=>xt,_slugify:()=>pr,_startsWith:()=>or,_string:()=>Cu,_stringFormat:()=>Pt,_stringbool:()=>dl,_success:()=>L_,_superRefine:()=>ll,_symbol:()=>Gu,_templateLiteral:()=>V_,_toLowerCase:()=>lr,_toUpperCase:()=>fr,_transform:()=>T_,_trim:()=>ur,_tuple:()=>z_,_uint32:()=>Uu,_uint64:()=>Hu,_ulid:()=>li,_undefined:()=>Xu,_union:()=>v_,_unknown:()=>el,_uppercase:()=>rr,_url:()=>pn,_uuid:()=>ri,_uuidv4:()=>ni,_uuidv6:()=>oi,_uuidv7:()=>ii,_void:()=>rl,_xid:()=>fi,_xor:()=>k_,base64Charset:()=>To,base64urlCharset:()=>en,canParseURL:()=>fc,clone:()=>L,compile:()=>Au,compileFn:()=>Yo,config:()=>J,createStandardJSONSchemaMethod:()=>dr,createToJSONSchemaMethod:()=>hl,decode:()=>Eb,decodeAsync:()=>Nb,describe:()=>fl,encode:()=>Cb,encodeAsync:()=>Tb,extractDefs:()=>Ye,finalize:()=>Qe,flattenError:()=>Vr,formatError:()=>Ur,getDiscriminatedOption:()=>Hc,globalConfig:()=>X,globalRegistry:()=>Q,handleUnrepresentable:()=>q,initializeContext:()=>Xe,isBackEdge:()=>qo,isRecursiveSchema:()=>Wo,isValidBase64:()=>Qr,isValidBase64URL:()=>No,isValidCIDRv6:()=>Eo,isValidCreditCard:()=>Ro,isValidIBAN:()=>Zo,isValidIPv6:()=>Yr,isValidJWT:()=>Do,locales:()=>ln,memoizer:()=>cn,mergeValues:()=>Gt,meta:()=>pl,parse:()=>io,parseAsync:()=>so,parseURLObject:()=>Ud,prettifyError:()=>Qs,process:()=>M,processSchema:()=>M,regexes:()=>Se,registry:()=>Go,safeDecode:()=>Zb,safeDecodeAsync:()=>Lb,safeEncode:()=>Rb,safeEncodeAsync:()=>Db,safeParse:()=>zb,safeParseAsync:()=>Pb,standardProps:()=>Io,stripTabAndNewline:()=>Xr,toDotPath:()=>vd,toJSONSchema:()=>Ai,toZod:()=>Tr,treeifyError:()=>Ys,urlHostnameOk:()=>Oo,urlProtocolOk:()=>Co,util:()=>S,validate:()=>Br,validateAsync:()=>Kr,validateURL:()=>Ao,version:()=>oc,withParser:()=>Xo});var be=z(()=>{We();ta();ea();Xt();_u();vo();ic();W();W();$t();ku();fn();ko();am();um();yn();wn();Sm();Pm()});var Ci={};ge(Ci,{endsWith:()=>ir,gt:()=>Te,gte:()=>ye,includes:()=>nr,length:()=>zt,lowercase:()=>tr,lt:()=>Ee,lte:()=>$e,maxLength:()=>St,maxSize:()=>Ge,mime:()=>ar,minLength:()=>je,minSize:()=>Ne,multipleOf:()=>He,negative:()=>vi,nonnegative:()=>xi,nonpositive:()=>ki,normalize:()=>cr,overwrite:()=>Ie,positive:()=>_i,properties:()=>sr,property:()=>Si,regex:()=>er,size:()=>xt,slugify:()=>pr,startsWith:()=>or,toLowerCase:()=>lr,toUpperCase:()=>fr,trim:()=>ur,uppercase:()=>rr});var Ei=z(()=>{be()});function Ti(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 Im,Am,X_,me,rf=z(()=>{be();be();W();Im=new WeakSet([Object.prototype,Error.prototype]);s(Ti,"_lazyMethod");Am=s((e,t)=>{Xs.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Im.has(r)||(Im.add(r),Ti(r,"format",n=>o=>Ur(n,o)),Ti(r,"flatten",n=>o=>Vr(n,o)),Ti(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Ft,2)}),Ti(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Ft,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),X_=h("ZodError",Am),me=h("ZodError",Am,void 0,{Parent:Error})});var nf,of,sf,af,cf,uf,lf,ff,pf,df,mf,hf,gf=z(()=>{be();rf();be();nf=Kt(me),of=Jt(me),sf=Wt(me),af=qt(me),cf=ao(me),uf=co(me),lf=uo(me),ff=lo(me),pf=fo(me),df=po(me),mf=mo(me),hf=ho(me)});var kr={};ge(kr,{ZodAny:()=>zf,ZodArray:()=>Of,ZodBase64:()=>Gi,ZodBase64URL:()=>Xi,ZodBigInt:()=>_r,ZodBigIntFormat:()=>es,ZodBoolean:()=>wr,ZodCIDRv4:()=>qi,ZodCIDRv6:()=>Hi,ZodCUID:()=>Fi,ZodCUID2:()=>Vi,ZodCatch:()=>Xf,ZodCodec:()=>On,ZodCreditCard:()=>yf,ZodCustom:()=>Cn,ZodCustomStringFormat:()=>Ct,ZodDate:()=>xn,ZodDefault:()=>Kf,ZodDiscriminatedUnion:()=>Ef,ZodE164:()=>Yi,ZodEmail:()=>Di,ZodEmoji:()=>ji,ZodEnum:()=>$r,ZodExactOptional:()=>os,ZodFile:()=>Ff,ZodFunction:()=>ap,ZodGUID:()=>Li,ZodIBAN:()=>bf,ZodIPv4:()=>Ji,ZodIPv6:()=>Wi,ZodISODate:()=>tt,ZodISODateTime:()=>et,ZodISODuration:()=>nt,ZodISOTime:()=>rt,ZodInstanceOf:()=>lp,ZodIntersection:()=>Tf,ZodJWT:()=>Qi,ZodKSUID:()=>Ki,ZodLazy:()=>op,ZodLiteral:()=>Mf,ZodMAC:()=>$f,ZodMap:()=>Lf,ZodNaN:()=>Qf,ZodNanoID:()=>Mi,ZodNever:()=>If,ZodNonOptional:()=>is,ZodNull:()=>xf,ZodNullable:()=>Bf,ZodNumber:()=>br,ZodNumberFormat:()=>Et,ZodObject:()=>zn,ZodOptional:()=>In,ZodPipe:()=>An,ZodPrefault:()=>Wf,ZodPreprocess:()=>ep,ZodPromise:()=>sp,ZodReadonly:()=>tp,ZodRecord:()=>gr,ZodSet:()=>jf,ZodString:()=>yr,ZodStringFormat:()=>V,ZodSuccess:()=>Gf,ZodSymbol:()=>vf,ZodTemplateLiteral:()=>np,ZodTransform:()=>Vf,ZodTuple:()=>Rf,ZodType:()=>T,ZodULID:()=>Ui,ZodURL:()=>kn,ZodUUID:()=>Re,ZodUndefined:()=>kf,ZodUnion:()=>Pn,ZodUnknown:()=>Pf,ZodVoid:()=>Af,ZodXID:()=>Bi,ZodXor:()=>Cf,_ZodString:()=>Zi,_default:()=>Jf,_function:()=>jh,any:()=>gh,array:()=>Sn,base64:()=>Gm,base64url:()=>Xm,bigint:()=>fh,boolean:()=>_f,catch:()=>Yf,check:()=>Mh,cidrv4:()=>qm,cidrv6:()=>Hm,codec:()=>Rh,creditCard:()=>Qm,cuid:()=>Mm,cuid2:()=>Fm,currencyCode:()=>ih,custom:()=>Fh,date:()=>yh,describe:()=>Vh,discriminatedUnion:()=>xh,e164:()=>Ym,email:()=>Om,emoji:()=>Lm,enum:()=>rs,exactOptional:()=>Uf,file:()=>Ch,float32:()=>ah,float64:()=>ch,function:()=>jh,guid:()=>Cm,hash:()=>sh,hex:()=>oh,hostname:()=>nh,httpUrl:()=>Dm,iban:()=>eh,instanceof:()=>Bh,int:()=>Ni,int32:()=>uh,int64:()=>ph,intersection:()=>Nf,invertCodec:()=>Zh,ipv4:()=>Km,ipv6:()=>Wm,json:()=>Jh,jwt:()=>th,keyof:()=>bh,ksuid:()=>Bm,lazy:()=>ip,literal:()=>Oh,looseObject:()=>vh,looseRecord:()=>zh,mac:()=>Jm,map:()=>Ph,meta:()=>Uh,nan:()=>Nh,nanoid:()=>jm,nativeEnum:()=>Ah,never:()=>ts,nonoptional:()=>Hf,null:()=>Sf,nullable:()=>vn,nullish:()=>Eh,number:()=>wf,object:()=>wh,optional:()=>At,partialRecord:()=>Sh,pipe:()=>Ri,prefault:()=>qf,preprocess:()=>Wh,promise:()=>Lh,readonly:()=>rp,record:()=>Df,refine:()=>cp,set:()=>Ih,strictObject:()=>_h,string:()=>_n,stringFormat:()=>rh,stringbool:()=>Kh,success:()=>Th,superRefine:()=>up,symbol:()=>mh,templateLiteral:()=>Dh,transform:()=>ns,tuple:()=>Zf,uint32:()=>lh,uint64:()=>dh,ulid:()=>Vm,undefined:()=>hh,union:()=>vr,unknown:()=>It,url:()=>Zm,uuid:()=>Em,uuidv4:()=>Tm,uuidv6:()=>Nm,uuidv7:()=>Rm,void:()=>$h,xid:()=>Um,xor:()=>kh});function Q_(){X.localeError||J(un())}function Ot(){X.memoizer||J({memoizer:cn()})}function _n(e){return Cu(yr,e)}function Om(e){return ei(Di,e)}function Cm(e){return ti(Li,e)}function Em(e){return ri(Re,e)}function Tm(e){return ni(Re,e)}function Nm(e){return oi(Re,e)}function Rm(e){return ii(Re,e)}function Zm(e){return pn(kn,e)}function Dm(e){return pn(kn,{protocol:Jr,hostname:va,...S.normalizeParams(e)})}function Lm(e){return si(ji,e)}function jm(e){return ai(Mi,e)}function Mm(e){return ci(Fi,e)}function Fm(e){return ui(Vi,e)}function Vm(e){return li(Ui,e)}function Um(e){return fi(Bi,e)}function Bm(e){return pi(Ki,e)}function Km(e){return di(Ji,e)}function Jm(e){return Tu($f,e)}function Wm(e){return mi(Wi,e)}function qm(e){return hi(qi,e)}function Hm(e){return gi(Hi,e)}function Gm(e){return $i(Gi,e)}function Xm(e){return yi(Xi,e)}function Ym(e){return bi(Yi,e)}function Qm(e){return Nu(yf,e)}function eh(e){return Ru(bf,e)}function th(e){return wi(Qi,e)}function rh(e,t,r={}){return Pt(Ct,e,t,r)}function nh(e){return Pt(Ct,"hostname",_a,e)}function oh(e){return Pt(Ct,"hex",Za,e)}function ih(e){return Pt(Ct,"currency_code",xa,e)}function sh(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=Se[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Pt(Ct,n,o,t)}function wf(e){return Du(br,e)}function Ni(e){return ju(Et,e)}function ah(e){return Mu(Et,e)}function ch(e){return Fu(Et,e)}function uh(e){return Vu(Et,e)}function lh(e){return Uu(Et,e)}function _f(e){return Bu(wr,e)}function fh(e){return Ju(_r,e)}function ph(e){return qu(es,e)}function dh(e){return Hu(es,e)}function mh(e){return Gu(vf,e)}function hh(e){return Xu(kf,e)}function Sf(e){return Yu(xf,e)}function gh(){return Qu(zf)}function It(){return el(Pf)}function ts(e){return tl(If,e)}function $h(e){return rl(Af,e)}function yh(e){return nl(xn,e)}function Sn(e,t){return sl(Of,e,t)}function bh(e){let t=e._zod.def.shape;return rs(Object.keys(t))}function wh(e,t){let r={type:"object",shape:e??{},...S.normalizeParams(t)};return new zn(r)}function _h(e,t){return new zn({type:"object",shape:e,catchall:ts(),...S.normalizeParams(t)})}function vh(e,t){return new zn({type:"object",shape:e,catchall:It(),...S.normalizeParams(t)})}function vr(e,t){return new Pn({type:"union",options:e,...S.normalizeParams(t)})}function kh(e,t){return new Cf({type:"union",options:e,inclusive:!1,...S.normalizeParams(t)})}function xh(e,t,r){return new Ef({type:"union",options:t,discriminator:e,...S.normalizeParams(r)})}function Nf(e,t){return new Tf({type:"intersection",left:e,right:t})}function Zf(e,t,r){let n=t instanceof E,o=n?r:t,i=n?t:null;return new Rf({type:"tuple",items:e,rest:i,...S.normalizeParams(o)})}function Df(e,t,r){return!t||!t._zod?new gr({type:"record",keyType:_n(),valueType:e,...S.normalizeParams(t)}):new gr({type:"record",keyType:e,valueType:t,...S.normalizeParams(r)})}function Sh(e,t,r){return new gr({type:"record",keyType:e,valueType:t,...S.normalizeParams(r),partial:!0})}function zh(e,t,r){return new gr({type:"record",keyType:e,valueType:t,mode:"loose",...S.normalizeParams(r)})}function Ph(e,t,r){return new Lf({type:"map",keyType:e,valueType:t,...S.normalizeParams(r)})}function Ih(e,t){return new jf({type:"set",valueType:e,...S.normalizeParams(t)})}function rs(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new $r({type:"enum",entries:r,...S.normalizeParams(t)})}function Ah(e,t){return new $r({type:"enum",entries:e,...S.normalizeParams(t)})}function Oh(e,t){return new Mf({type:"literal",values:Array.isArray(e)?e:[e],...S.normalizeParams(t)})}function Ch(e){return al(Ff,e)}function ns(e){return new Vf({type:"transform",transform:e})}function At(e){return new In({type:"optional",innerType:e})}function Uf(e){return new os({type:"optional",innerType:e})}function vn(e){return new Bf({type:"nullable",innerType:e})}function Eh(e){return At(vn(e))}function Jf(e,t){return new Kf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():S.shallowClone(t)}})}function qf(e,t){return new Wf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():S.shallowClone(t)}})}function Hf(e,t){return new is({type:"nonoptional",innerType:e,...S.normalizeParams(t)})}function Th(e){return new Gf({type:"success",innerType:e})}function Yf(e,t){return new Xf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:S.constantCatch(t)})}function Nh(e){return il(Qf,e)}function Ri(e,t){return new An({type:"pipe",in:e,out:t})}function Rh(e,t,r){return new On({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function Zh(e){let t=e._zod.def;return new On({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function rp(e){return new tp({type:"readonly",innerType:e})}function Dh(e,t){return new np({type:"template_literal",parts:e,...S.normalizeParams(t)})}function ip(e){return new op({type:"lazy",getter:e})}function Lh(e){return new sp({type:"promise",innerType:e})}function jh(e){return new ap({type:"function",input:Array.isArray(e?.input)?Zf(e?.input):e?.input??Sn(It()),output:e?.output??It()})}function Mh(e){let t=new U({check:"custom"});return t._zod.check=e,t}function Fh(e,t){return cl(Cn,e??(()=>!0),t)}function cp(e,t={}){return ul(Cn,e,t)}function up(e,t){return ll(e,t)}function Bh(e,t={}){let r=new lp({type:"custom",check:"custom",fn:s(n=>n instanceof e,"fn"),abort:!0,...S.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 Jh(e){let t=ip(()=>vr([_n(e),wf(),_f(),Sf(),Sn(t),Df(_n(),t)]));return t}function Wh(e,t){return new ep({type:"pipe",in:ns(e),out:t})}var T,Zi,yr,V,et,tt,rt,nt,Di,Li,Re,kn,ji,Mi,Fi,Vi,Ui,Bi,Ki,Ji,$f,Wi,qi,Hi,Gi,Xi,Yi,yf,bf,Qi,Ct,br,Et,wr,_r,es,vf,kf,xf,zf,Pf,If,Af,xn,Of,zn,Pn,Cf,Ef,Tf,Rf,gr,Lf,jf,$r,Mf,Ff,Vf,In,os,Bf,Kf,Wf,is,Gf,Xf,Qf,An,On,ep,tp,np,op,sp,ap,Cn,Vh,Uh,lp,Kh,ot=z(()=>{be();be();wn();$t();yn();vu();Ei();gf();s(Q_,"_ensureDefaultLocale");s(Ot,"_ensureDefaultMemoizer");T=h("ZodType",(e,t)=>(Q_(),E.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(S.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 L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(cp(e,t))},superRefine(e,t){return this.check(up(e,t))},overwrite(e){return this.check(Ie(e))},optional(){return At(this)},exactOptional(){return Uf(this)},nullable(){return vn(this)},nullish(){return At(vn(this))},nonoptional(e){return Hf(this,e)},array(){return Sn(this)},or(e){return vr([this,e])},and(e){return Nf(this,e)},transform(e){return Ri(this,ns(e))},default(e){return Jf(this,e)},prefault(e){return qf(this,e)},catch(e){return Yf(this,e)},pipe(e){return Ri(this,e)},readonly(){return rp(this)},describe(e){let t=this.clone();return Q.add(t,{description:e}),t},meta(...e){if(e.length===0)return Q.get(this);let t=this.clone();return Q.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 S.hide(this,"~standard",{...Io(this),jsonSchema:{input:dr(this,"input"),output:dr(this,"output")}})},set"~standard"(e){S.own(this,"~standard",e)},parse:s(function e(t,r){return nf(this,t,r,{callee:e})},"_parse"),parseAsync:s(async function e(t,r){return await of(this,t,r,{callee:e})},"_parseAsync"),safeParse(e,t){return sf(this,e,t)},async safeParseAsync(e,t){return af(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){S.own(this,"spa",e)},validate(e,t){return Br(this,e,t)},validateAsync(e,t){return Kr(this,e,t)},encode:s(function e(t,r){return cf(this,t,r,{callee:e})},"_encode"),decode:s(function e(t,r){return uf(this,t,r,{callee:e})},"_decode"),encodeAsync:s(async function e(t,r){return await lf(this,t,r,{callee:e})},"_encodeAsync"),decodeAsync:s(async function e(t,r){return await ff(this,t,r,{callee:e})},"_decodeAsync"),safeEncode(e,t){return pf(this,e,t)},safeDecode(e,t){return df(this,e,t)},async safeEncodeAsync(e,t){return mf(this,e,t)},async safeDecodeAsync(e,t){return hf(this,e,t)},toJSONSchema(e){return hl(this,{})(e)},get description(){return Q.get(this)?.description},get _def(){return this._zod.def}}),Zi=h("_ZodString",(e,t)=>{bt.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yl(e,r,n,o)},S.derived({format:s(e=>H(e).format??null,"format"),minLength:s(e=>H(e).minimum??null,"minLength"),maxLength:s(e=>H(e).maximum??null,"maxLength")},{regex(...e){return this.check(er(...e))},includes(...e){return this.check(nr(...e))},startsWith(...e){return this.check(or(...e))},endsWith(...e){return this.check(ir(...e))},min(...e){return this.check(je(...e))},max(...e){return this.check(St(...e))},length(...e){return this.check(zt(...e))},nonempty(...e){return this.check(je(1,...e))},lowercase(e){return this.check(tr(e))},uppercase(e){return this.check(rr(e))},trim(){return this.check(ur())},normalize(...e){return this.check(cr(...e))},toLowerCase(){return this.check(lr())},toUpperCase(){return this.check(fr())},slugify(){return this.check(pr())}})),yr=h("ZodString",(e,t)=>{bt.init(e,t),Zi.init(e,t)},{email(e){return this.check(ei(Di,e))},url(e){return this.check(pn(kn,e))},jwt(e){return this.check(wi(Qi,e))},emoji(e){return this.check(si(ji,e))},guid(e){return this.check(ti(Li,e))},uuid(e){return this.check(ri(Re,e))},uuidv4(e){return this.check(ni(Re,e))},uuidv6(e){return this.check(oi(Re,e))},uuidv7(e){return this.check(ii(Re,e))},nanoid(e){return this.check(ai(Mi,e))},cuid(e){return this.check(ci(Fi,e))},cuid2(e){return this.check(ui(Vi,e))},ulid(e){return this.check(li(Ui,e))},base64(e){return this.check($i(Gi,e))},base64url(e){return this.check(yi(Xi,e))},xid(e){return this.check(fi(Bi,e))},ksuid(e){return this.check(pi(Ki,e))},ipv4(e){return this.check(di(Ji,e))},ipv6(e){return this.check(mi(Wi,e))},cidrv4(e){return this.check(hi(qi,e))},cidrv6(e){return this.check(gi(Hi,e))},e164(e){return this.check(bi(Yi,e))},datetime(e){return this.check(dn(et,e))},date(e){return this.check(mn(tt,e))},time(e){return this.check(hn(rt,e))},duration(e){return this.check(gn(nt,e))}});s(_n,"string");V=h("ZodStringFormat",(e,t)=>{j.init(e,t),Zi.init(e,t)}),et=h("ZodISODateTime",(e,t)=>{wc.init(e,t),V.init(e,t)}),tt=h("ZodISODate",(e,t)=>{_c.init(e,t),V.init(e,t)}),rt=h("ZodISOTime",(e,t)=>{vc.init(e,t),V.init(e,t)}),nt=h("ZodISODuration",(e,t)=>{kc.init(e,t),V.init(e,t)}),Di=h("ZodEmail",(e,t)=>{uc.init(e,t),V.init(e,t)});s(Om,"email");Li=h("ZodGUID",(e,t)=>{ac.init(e,t),V.init(e,t)});s(Cm,"guid");Re=h("ZodUUID",(e,t)=>{cc.init(e,t),V.init(e,t)});s(Em,"uuid");s(Tm,"uuidv4");s(Nm,"uuidv6");s(Rm,"uuidv7");kn=h("ZodURL",(e,t)=>{pc.init(e,t),V.init(e,t)});s(Zm,"url");s(Dm,"httpUrl");ji=h("ZodEmoji",(e,t)=>{dc.init(e,t),V.init(e,t)});s(Lm,"emoji");Mi=h("ZodNanoID",(e,t)=>{mc.init(e,t),V.init(e,t)});s(jm,"nanoid");Fi=h("ZodCUID",(e,t)=>{hc.init(e,t),V.init(e,t)});s(Mm,"cuid");Vi=h("ZodCUID2",(e,t)=>{gc.init(e,t),V.init(e,t)});s(Fm,"cuid2");Ui=h("ZodULID",(e,t)=>{$c.init(e,t),V.init(e,t)});s(Vm,"ulid");Bi=h("ZodXID",(e,t)=>{yc.init(e,t),V.init(e,t)});s(Um,"xid");Ki=h("ZodKSUID",(e,t)=>{bc.init(e,t),V.init(e,t)});s(Bm,"ksuid");Ji=h("ZodIPv4",(e,t)=>{xc.init(e,t),V.init(e,t)});s(Km,"ipv4");$f=h("ZodMAC",(e,t)=>{zc.init(e,t),V.init(e,t)});s(Jm,"mac");Wi=h("ZodIPv6",(e,t)=>{Sc.init(e,t),V.init(e,t)});s(Wm,"ipv6");qi=h("ZodCIDRv4",(e,t)=>{Pc.init(e,t),V.init(e,t)});s(qm,"cidrv4");Hi=h("ZodCIDRv6",(e,t)=>{Ic.init(e,t),V.init(e,t)});s(Hm,"cidrv6");Gi=h("ZodBase64",(e,t)=>{Ac.init(e,t),V.init(e,t)});s(Gm,"base64");Xi=h("ZodBase64URL",(e,t)=>{Oc.init(e,t),V.init(e,t)});s(Xm,"base64url");Yi=h("ZodE164",(e,t)=>{Cc.init(e,t),V.init(e,t)});s(Ym,"e164");yf=h("ZodCreditCard",(e,t)=>{Ec.init(e,t),V.init(e,t)});s(Qm,"creditCard");bf=h("ZodIBAN",(e,t)=>{Tc.init(e,t),V.init(e,t)});s(eh,"iban");Qi=h("ZodJWT",(e,t)=>{Nc.init(e,t),V.init(e,t)});s(th,"jwt");Ct=h("ZodCustomStringFormat",(e,t)=>{Rc.init(e,t),V.init(e,t)});s(rh,"stringFormat");s(nh,"hostname");s(oh,"hex");s(ih,"currencyCode");s(sh,"hash");br=h("ZodNumber",(e,t)=>{Lo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bl(e,r,n,o),e.isFinite=!0},S.derived({minValue:s(e=>{let{minimum:t,exclusiveMinimum:r}=H(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},"minValue"),maxValue:s(e=>{let{maximum:t,exclusiveMaximum:r}=H(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},"maxValue"),isInt:s(e=>{let{isInt:t,multipleOf:r}=H(e);return!!t||!!r?.some(Number.isSafeInteger)},"isInt"),format:s(e=>H(e).format??null,"format")},{gt(e,t){return this.check(Te(e,t))},gte(e,t){return this.check(ye(e,t))},min(e,t){return this.check(ye(e,t))},lt(e,t){return this.check(Ee(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(Ni(e))},safe(e){return this.check(Ni(e))},positive(e){return this.check(Te(0,e))},nonnegative(e){return this.check(ye(0,e))},negative(e){return this.check(Ee(0,e))},nonpositive(e){return this.check($e(0,e))},multipleOf(e,t){return this.check(He(e,t))},step(e,t){return this.check(He(e,t))},finite(){return this}}));s(wf,"number");Et=h("ZodNumberFormat",(e,t)=>{Zc.init(e,t),br.init(e,t)});s(Ni,"int");s(ah,"float32");s(ch,"float64");s(uh,"int32");s(lh,"uint32");wr=h("ZodBoolean",(e,t)=>{tn.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wl(e,r,n,o)});s(_f,"boolean");_r=h("ZodBigInt",(e,t)=>{jo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_l(e,r,n,o)},S.derived({minValue:s(e=>H(e).minimum??null,"minValue"),maxValue:s(e=>H(e).maximum??null,"maxValue"),format:s(e=>H(e).format??null,"format")},{gte(e,t){return this.check(ye(e,t))},min(e,t){return this.check(ye(e,t))},gt(e,t){return this.check(Te(e,t))},lt(e,t){return this.check(Ee(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(Ee(BigInt(0),e))},nonpositive(e){return this.check($e(BigInt(0),e))},nonnegative(e){return this.check(ye(BigInt(0),e))},multipleOf(e,t){return this.check(He(e,t))}}));s(fh,"bigint");es=h("ZodBigIntFormat",(e,t)=>{Dc.init(e,t),_r.init(e,t)});s(ph,"int64");s(dh,"uint64");vf=h("ZodSymbol",(e,t)=>{Lc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vl(e,r,n,o)});s(mh,"symbol");kf=h("ZodUndefined",(e,t)=>{jc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xl(e,r,n,o)});s(hh,"_undefined");xf=h("ZodNull",(e,t)=>{Mc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kl(e,r,n,o)});s(Sf,"_null");zf=h("ZodAny",(e,t)=>{Fc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pl(e,r,n,o)});s(gh,"any");Pf=h("ZodUnknown",(e,t)=>{Vc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Il(e,r,n,o)});s(It,"unknown");If=h("ZodNever",(e,t)=>{Uc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zl(e,r,n,o)});s(ts,"never");Af=h("ZodVoid",(e,t)=>{Bc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sl(e,r,n,o)});s($h,"_void");xn=h("ZodDate",(e,t)=>{Kc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Al(e,r,n,o),e.min=(r,n)=>e.check(ye(r,n)),e.max=(r,n)=>e.check($e(r,n))},S.derived({minDate:s(e=>{let{minimum:t}=H(e);return t?new Date(t):null},"minDate"),maxDate:s(e=>{let{maximum:t}=H(e);return t?new Date(t):null},"maxDate")},{}));s(yh,"date");Of=h("ZodArray",(e,t)=>{Ot(),Jc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fl(e,r,n,o),e.element=t.element},{min(e,t){return this.check(je(e,t))},nonempty(e){return this.check(je(1,e))},max(e,t){return this.check(St(e,t))},length(e,t){return this.check(zt(e,t))},unwrap(){return this.element}});s(Sn,"array");s(bh,"keyof");zn=h("ZodObject",(e,t)=>{Ot(),Wc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vl(e,r,n,o),S.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return rs(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(S.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(S.mergeDefs(this._zod.def,{catchall:It()}))},loose(){return this.clone(S.mergeDefs(this._zod.def,{catchall:It()}))},strict(){return this.clone(S.mergeDefs(this._zod.def,{catchall:ts()}))},strip(){return this.clone(S.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return S.extend(this,e)},safeExtend(e){return S.safeExtend(this,e)},merge(e){return S.merge(this,e)},pick(e){return S.pick(this,e)},omit(e){return S.omit(this,e)},partial(...e){return S.partial(In,this,e[0])},exactPartial(...e){return S.partial(os,this,e[0],"exactPartial")},required(...e){return S.required(is,this,e[0])}});s(wh,"object");s(_h,"strictObject");s(vh,"looseObject");Pn=h("ZodUnion",(e,t)=>{rn.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pi(e,r,n,o),e.options=t.options});s(vr,"union");Cf=h("ZodXor",(e,t)=>{Pn.init(e,t),qc.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pi(e,r,n,o),e.options=t.options});s(kh,"xor");Ef=h("ZodDiscriminatedUnion",(e,t)=>{Pn.init(e,t),Gc.init(e,t)});s(xh,"discriminatedUnion");Tf=h("ZodIntersection",(e,t)=>{Xc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ul(e,r,n,o)});s(Nf,"intersection");Rf=h("ZodTuple",(e,t)=>{Ot(),Mo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bl(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 In({type:"optional",innerType:t}))})}});s(Zf,"tuple");gr=h("ZodRecord",(e,t)=>{Ot(),Yc.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});s(Df,"record");s(Sh,"partialRecord");s(zh,"looseRecord");Lf=h("ZodMap",(e,t)=>{Ot(),Qc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jl(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(Ge(...r)),e.size=(...r)=>e.check(xt(...r))});s(Ph,"map");jf=h("ZodSet",(e,t)=>{Ot(),eu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ml(e,r,n,o),e.min=(...r)=>e.check(Ne(...r)),e.nonempty=r=>e.check(Ne(1,r)),e.max=(...r)=>e.check(Ge(...r)),e.size=(...r)=>e.check(xt(...r))});s(Ih,"set");$r=h("ZodEnum",(e,t)=>{tu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ol(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 $r({...t,checks:[],...S.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 $r({...t,checks:[],...S.normalizeParams(o),entries:i})}});s(rs,"_enum");s(Ah,"nativeEnum");Mf=h("ZodLiteral",(e,t)=>{ru.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cl(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(Oh,"literal");Ff=h("ZodFile",(e,t)=>{nu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nl(e,r,n,o),e.min=(r,n)=>e.check(Ne(r,n)),e.max=(r,n)=>e.check(Ge(r,n)),e.mime=(r,n)=>e.check(ar(Array.isArray(r)?r:[r],n))});s(Ch,"file");Vf=h("ZodTransform",(e,t)=>{Ot(),ou.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ll(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new qe(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(S.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(S.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(ns,"transform");In=h("ZodOptional",(e,t)=>{Fo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ii(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(At,"optional");os=h("ZodExactOptional",(e,t)=>{iu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ii(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(Uf,"exactOptional");Bf=h("ZodNullable",(e,t)=>{su.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(vn,"nullable");s(Eh,"nullish");Kf=h("ZodDefault",(e,t)=>{au.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});s(Jf,"_default");Wf=h("ZodPrefault",(e,t)=>{cu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(qf,"prefault");is=h("ZodNonOptional",(e,t)=>{uu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(Hf,"nonoptional");Gf=h("ZodSuccess",(e,t)=>{lu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(Th,"success");Xf=h("ZodCatch",(e,t)=>{fu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});s(Yf,"_catch");Qf=h("ZodNaN",(e,t)=>{pu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>El(e,r,n,o)});s(Nh,"nan");An=h("ZodPipe",(e,t)=>{Vo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yl(e,r,n,o),e.in=t.in,e.out=t.out});s(Ri,"pipe");On=h("ZodCodec",(e,t)=>{An.init(e,t),nn.init(e,t)});s(Rh,"codec");s(Zh,"invertCodec");ep=h("ZodPreprocess",(e,t)=>{An.init(e,t),du.init(e,t)}),tp=h("ZodReadonly",(e,t)=>{mu.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(rp,"readonly");np=h("ZodTemplateLiteral",(e,t)=>{hu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tl(e,r,n,o)});s(Dh,"templateLiteral");op=h("ZodLazy",(e,t)=>{on.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tf(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});s(ip,"lazy");sp=h("ZodPromise",(e,t)=>{$u.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ef(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(Lh,"promise");ap=h("ZodFunction",(e,t)=>{gu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dl(e,r,n,o)});s(jh,"_function");Cn=h("ZodCustom",(e,t)=>{yu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zl(e,r,n,o)});s(Mh,"check");s(Fh,"custom");s(cp,"refine");s(up,"superRefine");Vh=fl,Uh=pl,lp=h("ZodInstanceOf",(e,t)=>{Cn.init(e,t)},{properties(e,t){return this.check(sr(e,t))}});s(Bh,"_instanceof");Kh=s((...e)=>dl({Codec:On,Boolean:wr,String:yr},...e),"stringbool");s(Jh,"json");s(Wh,"preprocess")});function tv(e){J({customError:e})}function rv(){return J().customError}var ev,fp,qh=z(()=>{be();ev={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(tv,"setErrorMap");s(rv,"getErrorMap");fp||(fp={})});var En={};ge(En,{ZodISODate:()=>tt,ZodISODateTime:()=>et,ZodISODuration:()=>nt,ZodISOTime:()=>rt,date:()=>ov,datetime:()=>nv,duration:()=>sv,time:()=>iv});function nv(e){return dn(et,e)}function ov(e){return mn(tt,e)}function iv(e){return hn(rt,e)}function sv(e){return gn(nt,e)}var ss=z(()=>{be();ot();ot();s(nv,"datetime");s(ov,"date");s(iv,"time");s(sv,"duration")});function cv(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 Hh(e,t){return e.map((r,n)=>n<t?r:r.optional())}function uv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function lv(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:uv(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 fv(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 pp(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=pp(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=pp(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 Tn(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Tn):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>pv.has(t)?Tn(r):!dv.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(Tn))}function Gh(e){return e===1?"element":"elements"}function mv(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=pp(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 ${Gh(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 ${Gh(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function Xh(e,t){if(e!==!1)return e===void 0||e===!0?_.any():ae(e,t)}function Yh(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=lv(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 Yh(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(hv)):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,d]of Object.entries(i)){let m=ae(d,t);Y(o,p,a.has(p)?m:m.optional())}if(e.patternProperties){let p=e.patternProperties,d=Object.keys(p),m=[];for(let y of d){let b=ae(p[y],t),x=_.string().regex(new RegExp(y));m.push(_.looseRecord(x,b))}let g=[];if(Object.keys(o).length>0&&g.push(_.object(o).passthrough()),g.push(...m),g.length===0)n=_.object({}).passthrough();else if(g.length===1)n=g[0];else{let y=_.intersection(g[0],g[1]);for(let b=2;b<g.length;b++)y=_.intersection(y,g[b]);n=y}if(e.additionalProperties===!1){let y=Object.keys(o),b=d.map(k=>new RegExp(k)),x=n;n=n.check(k=>{if(!ke(k.value))return;let O=[];for(let D of Object.keys(k.value))y.includes(D)||b.some(F=>F.test(D))||O.push(D);O.length&&k.issues.push({code:"unrecognized_keys",keys:O,input:k.value,inst:x})})}}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 d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;p=ae(d,t)}n=fv(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=Hh(c,a),l=Array.isArray(i)?void 0:Xh(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=Hh(c,a),l=Xh(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=mv(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=Yh(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&&!Tn(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&&!Tn(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))av.has(c)||Y(o,c,e[c]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}function Qh(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=cv(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Q};return ae(r,i)}var _,av,pv,dv,hv,eg=z(()=>{fn();W();Ei();ss();ot();_={...kr,...Ci,iso:En},av=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(cv,"detectVersion");s(Hh,"applyMinItems");s(uv,"decodeJSONPointerSegment");s(lv,"resolveRef");s(fv,"checkObjectGuards");s(pp,"canonicalKey");pv=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),dv=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);s(Tn,"containsRef");s(Gh,"plural");s(mv,"checkArrayGuards");s(Xh,"getTupleRest");hv=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;s(Yh,"convertBaseSchema");s(ae,"convertSchema");s(Qh,"fromJSONSchema")});function Nn(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===tg)return new on({type:"lazy",getter:s(()=>n.get(a),"getter")});if(c!==void 0)return c;n.set(a,tg);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,d={};for(let g of f){let y=o(l[g]);y!==l[g]&&(p=!0),d[g]=y}let m=c.catchall;return c.catchall&&(m=o(c.catchall),m!==c.catchall&&(p=!0)),p?L(a,{...c,shape:d,catchall:m}):a}case"array":{let l=o(c.element);return l===c.element?a:L(a,{...c,element:l})}case"tuple":{let l=c.items,f=!1,p=[];for(let m of l){let g=o(m);g!==m&&(f=!0),p.push(g)}let d=c.rest;return c.rest&&(d=o(c.rest),d!==c.rest&&(f=!0)),f?L(a,{...c,items:p,rest:d}):a}case"record":case"map":{let l=o(c.keyType),f=o(c.valueType);return l===c.keyType&&f===c.valueType?a:L(a,{...c,keyType:l,valueType:f})}case"set":{let l=o(c.valueType);return l===c.valueType?a:L(a,{...c,valueType:l})}case"union":{let l=c.options,f=!1,p=[];for(let d of l){let m=o(d);m!==d&&(f=!0),p.push(m)}return f?L(a,{...c,options:p}):a}case"intersection":{let l=o(c.left),f=o(c.right);return l===c.left&&f===c.right?a:L(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:L(a,{...c,innerType:l})}case"pipe":{let l=o(c.in),f=o(c.out);return l===c.in&&f===c.out?a:L(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:L(a,{...c,input:l,output:f})}case"lazy":{let l=c.getter,{_cachedInner:f,...p}=c;return L(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 tg,dp=z(()=>{Xt();W();tg=Symbol("z.visit/resolving");s(Nn,"visit")});function rg(e){return Nn(e,{object:s(t=>t.partial(),"object"),union:s(t=>{let r=t._zod.def;return r.discriminator===void 0?t:vr(r.options)},"union")})}var ng=z(()=>{dp();ot();s(rg,"deepPartial")});function gv(e,t){if(!t?.length)return e;let r=e._zod.def;return L(e,ze(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function og(e){return gv(e.out,e.checks)}function $v(e){return e.in._zod.traits.has("$ZodTransform")?og(e):e.in}function ig(e){return Nn(e,{pipe:s(t=>$v(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 sg(e){return Nn(e,{pipe:s(t=>og(t._zod.def),"pipe"),prefault:s((t,r)=>r?t._zod.def.innerType:t,"prefault")})}var ag=z(()=>{W();dp();ot();s(gv,"withChecks");s(og,"outSide");s($v,"inSide");s(ig,"input");s(sg,"output")});var mp={};ge(mp,{bigint:()=>_v,boolean:()=>wv,date:()=>vv,number:()=>bv,string:()=>yv});function yv(e){return Eu(yr,e)}function bv(e){return Lu(br,e)}function wv(e){return Ku(wr,e)}function _v(e){return Wu(_r,e)}function vv(e){return ol(xn,e)}var cg=z(()=>{be();ot();s(yv,"string");s(bv,"number");s(wv,"boolean");s(_v,"bigint");s(vv,"date")});var $={};ge($,{$brand:()=>qs,$input:()=>Su,$output:()=>xu,INVALID:()=>ie,NEVER:()=>Ws,TimePrecision:()=>Zu,ZodAny:()=>zf,ZodArray:()=>Of,ZodBase64:()=>Gi,ZodBase64URL:()=>Xi,ZodBigInt:()=>_r,ZodBigIntFormat:()=>es,ZodBoolean:()=>wr,ZodCIDRv4:()=>qi,ZodCIDRv6:()=>Hi,ZodCUID:()=>Fi,ZodCUID2:()=>Vi,ZodCatch:()=>Xf,ZodCodec:()=>On,ZodCompileAsyncError:()=>Pe,ZodCompileUnsupportedError:()=>Z,ZodCreditCard:()=>yf,ZodCustom:()=>Cn,ZodCustomStringFormat:()=>Ct,ZodDate:()=>xn,ZodDefault:()=>Kf,ZodDiscriminatedUnion:()=>Ef,ZodE164:()=>Yi,ZodEmail:()=>Di,ZodEmoji:()=>ji,ZodEnum:()=>$r,ZodError:()=>X_,ZodExactOptional:()=>os,ZodFile:()=>Ff,ZodFirstPartyTypeKind:()=>fp,ZodFunction:()=>ap,ZodGUID:()=>Li,ZodIBAN:()=>bf,ZodIPv4:()=>Ji,ZodIPv6:()=>Wi,ZodISODate:()=>tt,ZodISODateTime:()=>et,ZodISODuration:()=>nt,ZodISOTime:()=>rt,ZodInstanceOf:()=>lp,ZodIntersection:()=>Tf,ZodIssueCode:()=>ev,ZodJWT:()=>Qi,ZodKSUID:()=>Ki,ZodLazy:()=>op,ZodLiteral:()=>Mf,ZodMAC:()=>$f,ZodMap:()=>Lf,ZodNaN:()=>Qf,ZodNanoID:()=>Mi,ZodNever:()=>If,ZodNonOptional:()=>is,ZodNull:()=>xf,ZodNullable:()=>Bf,ZodNumber:()=>br,ZodNumberFormat:()=>Et,ZodObject:()=>zn,ZodOptional:()=>In,ZodPipe:()=>An,ZodPrefault:()=>Wf,ZodPreprocess:()=>ep,ZodPromise:()=>sp,ZodReadonly:()=>tp,ZodRealError:()=>me,ZodRecord:()=>gr,ZodSet:()=>jf,ZodString:()=>yr,ZodStringFormat:()=>V,ZodSuccess:()=>Gf,ZodSymbol:()=>vf,ZodTemplateLiteral:()=>np,ZodTransform:()=>Vf,ZodTuple:()=>Rf,ZodType:()=>T,ZodULID:()=>Ui,ZodURL:()=>kn,ZodUUID:()=>Re,ZodUndefined:()=>kf,ZodUnion:()=>Pn,ZodUnknown:()=>Pf,ZodVoid:()=>Af,ZodXID:()=>Bi,ZodXor:()=>Cf,_ZodString:()=>Zi,_default:()=>Jf,_function:()=>jh,any:()=>gh,array:()=>Sn,base64:()=>Gm,base64url:()=>Xm,bigint:()=>fh,boolean:()=>_f,catch:()=>Yf,check:()=>Mh,cidrv4:()=>qm,cidrv6:()=>Hm,clone:()=>L,codec:()=>Rh,coerce:()=>mp,compile:()=>Au,config:()=>J,core:()=>Me,creditCard:()=>Qm,cuid:()=>Mm,cuid2:()=>Fm,currencyCode:()=>ih,custom:()=>Fh,date:()=>yh,decode:()=>uf,decodeAsync:()=>ff,deepPartial:()=>rg,describe:()=>Vh,discriminatedUnion:()=>xh,e164:()=>Ym,email:()=>Om,emoji:()=>Lm,encode:()=>cf,encodeAsync:()=>lf,endsWith:()=>ir,enum:()=>rs,exactOptional:()=>Uf,file:()=>Ch,flattenError:()=>Vr,float32:()=>ah,float64:()=>ch,formatError:()=>Ur,fromJSONSchema:()=>Qh,function:()=>jh,getDiscriminatedOption:()=>Hc,getErrorMap:()=>rv,globalRegistry:()=>Q,gt:()=>Te,gte:()=>ye,guid:()=>Cm,hash:()=>sh,hex:()=>oh,hostname:()=>nh,httpUrl:()=>Dm,iban:()=>eh,includes:()=>nr,input:()=>ig,instanceof:()=>Bh,int:()=>Ni,int32:()=>uh,int64:()=>ph,intersection:()=>Nf,invertCodec:()=>Zh,ipv4:()=>Km,ipv6:()=>Wm,iso:()=>En,json:()=>Jh,jwt:()=>th,keyof:()=>bh,ksuid:()=>Bm,lazy:()=>ip,length:()=>zt,literal:()=>Oh,locales:()=>ln,looseObject:()=>vh,looseRecord:()=>zh,lowercase:()=>tr,lt:()=>Ee,lte:()=>$e,mac:()=>Jm,map:()=>Ph,maxLength:()=>St,maxSize:()=>Ge,memoizer:()=>cn,meta:()=>Uh,mime:()=>ar,minLength:()=>je,minSize:()=>Ne,multipleOf:()=>He,nan:()=>Nh,nanoid:()=>jm,nativeEnum:()=>Ah,negative:()=>vi,never:()=>ts,nonnegative:()=>xi,nonoptional:()=>Hf,nonpositive:()=>ki,normalize:()=>cr,null:()=>Sf,nullable:()=>vn,nullish:()=>Eh,number:()=>wf,object:()=>wh,optional:()=>At,output:()=>sg,overwrite:()=>Ie,parse:()=>nf,parseAsync:()=>of,partialRecord:()=>Sh,pipe:()=>Ri,positive:()=>_i,prefault:()=>qf,preprocess:()=>Wh,prettifyError:()=>Qs,promise:()=>Lh,properties:()=>sr,property:()=>Si,readonly:()=>rp,record:()=>Df,refine:()=>cp,regex:()=>er,regexes:()=>Se,registry:()=>Go,safeDecode:()=>df,safeDecodeAsync:()=>hf,safeEncode:()=>pf,safeEncodeAsync:()=>mf,safeParse:()=>sf,safeParseAsync:()=>af,set:()=>Ih,setErrorMap:()=>tv,size:()=>xt,slugify:()=>pr,startsWith:()=>or,strictObject:()=>_h,string:()=>_n,stringFormat:()=>rh,stringbool:()=>Kh,success:()=>Th,superRefine:()=>up,symbol:()=>mh,templateLiteral:()=>Dh,toJSONSchema:()=>Ai,toLowerCase:()=>lr,toUpperCase:()=>fr,toZod:()=>Tr,transform:()=>ns,treeifyError:()=>Ys,trim:()=>ur,tuple:()=>Zf,uint32:()=>lh,uint64:()=>dh,ulid:()=>Vm,undefined:()=>hh,union:()=>vr,unknown:()=>It,uppercase:()=>rr,url:()=>Zm,util:()=>S,uuid:()=>Em,uuidv4:()=>Tm,uuidv6:()=>Nm,uuidv7:()=>Rm,validate:()=>Br,validateAsync:()=>Kr,void:()=>$h,withParser:()=>Xo,xid:()=>Um,xor:()=>kh});var hp=z(()=>{be();ot();Ei();rf();gf();qh();be();wn();eg();ng();ag();ku();ss();ss();cg()});var it=z(()=>{hp();hp()});var dg=he((mz,pg)=>{pg.exports=fg;fg.sync=xv;var ug=Be("fs");function kv(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(kv,"checkPathExt");function lg(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:kv(t,r)}s(lg,"checkStat");function fg(e,t,r){ug.stat(e,function(n,o){r(n,n?!1:lg(o,e,t))})}s(fg,"isexe");function xv(e,t){return lg(ug.statSync(e),e,t)}s(xv,"sync")});var yg=he((gz,$g)=>{$g.exports=hg;hg.sync=Sv;var mg=Be("fs");function hg(e,t,r){mg.stat(e,function(n,o){r(n,n?!1:gg(o,t))})}s(hg,"isexe");function Sv(e,t){return gg(mg.statSync(e),t)}s(Sv,"sync");function gg(e,t){return e.isFile()&&zv(e,t)}s(gg,"checkStat");function zv(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(zv,"checkMode")});var wg=he((bz,bg)=>{var yz=Be("fs"),as;process.platform==="win32"||global.TESTING_WINDOWS?as=dg():as=yg();bg.exports=gp;gp.sync=Pv;function gp(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){gp(e,t||{},function(i,a){i?o(i):n(a)})})}as(e,t||{},function(n,o){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}s(gp,"isexe");function Pv(e,t){try{return as.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}s(Pv,"sync")});var Pg=he((_z,zg)=>{var xr=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",_g=Be("path"),Iv=xr?";":":",vg=wg(),kg=s(e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),"getNotFoundError"),xg=s((e,t)=>{let r=t.colon||Iv,n=e.match(/\//)||xr&&e.match(/\\/)?[""]:[...xr?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=xr?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=xr?o.split(r):[""];return xr&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},"getPathInfo"),Sg=s((e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,pathExtExe:i}=xg(e,t),a=[],c=s(l=>new Promise((f,p)=>{if(l===n.length)return t.all&&a.length?f(a):p(kg(e));let d=n[l],m=/^".*"$/.test(d)?d.slice(1,-1):d,g=_g.join(m,e),y=!m&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;f(u(y,l,0))}),"step"),u=s((l,f,p)=>new Promise((d,m)=>{if(p===o.length)return d(c(f+1));let g=o[p];vg(l+g,{pathExt:i},(y,b)=>{if(!y&&b)if(t.all)a.push(l+g);else return d(l+g);return d(u(l,f,p+1))})}),"subStep");return r?c(0).then(l=>r(null,l),r):c(0)},"which"),Av=s((e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=xg(e,t),i=[];for(let a=0;a<r.length;a++){let c=r[a],u=/^".*"$/.test(c)?c.slice(1,-1):c,l=_g.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let p=0;p<n.length;p++){let d=f+n[p];try{if(vg.sync(d,{pathExt:o}))if(t.all)i.push(d);else return d}catch{}}}if(t.all&&i.length)return i;if(t.nothrow)return null;throw kg(e)},"whichSync");zg.exports=Sg;Sg.sync=Av});var Ag=he((kz,$p)=>{"use strict";var Ig=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");$p.exports=Ig;$p.exports.default=Ig});var Tg=he((Sz,Eg)=>{"use strict";var Og=Be("path"),Ov=Pg(),Cv=Ag();function Cg(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=Ov.sync(e.command,{path:r[Cv({env:r})],pathExt:t?Og.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return a&&(a=Og.resolve(o?e.options.cwd:"",a)),a}s(Cg,"resolveCommandAttempt");function Ev(e){return Cg(e)||Cg(e,!0)}s(Ev,"resolveCommand");Eg.exports=Ev});var Ng=he((Pz,bp)=>{"use strict";var yp=/([()\][%!^"`<>&|;, *?])/g;function Tv(e){return e=e.replace(yp,"^$1"),e}s(Tv,"escapeCommand");function Nv(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(yp,"^$1"),t&&(e=e.replace(yp,"^$1")),e}s(Nv,"escapeArgument");bp.exports.command=Tv;bp.exports.argument=Nv});var Zg=he((Az,Rg)=>{"use strict";Rg.exports=/^#!(.*)/});var Lg=he((Oz,Dg)=>{"use strict";var Rv=Zg();Dg.exports=(e="")=>{let t=e.match(Rv);if(!t)return null;let[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var Mg=he((Cz,jg)=>{"use strict";var wp=Be("fs"),Zv=Lg();function Dv(e){let r=Buffer.alloc(150),n;try{n=wp.openSync(e,"r"),wp.readSync(n,r,0,150,0),wp.closeSync(n)}catch{}return Zv(r.toString())}s(Dv,"readShebang");jg.exports=Dv});var Bg=he((Tz,Ug)=>{"use strict";var Lv=Be("path"),Fg=Tg(),Vg=Ng(),jv=Mg(),Mv=process.platform==="win32",Fv=/\.(?:com|exe)$/i,Vv=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Uv(e){e.file=Fg(e);let t=e.file&&jv(e.file);return t?(e.args.unshift(e.file),e.command=t,Fg(e)):e.file}s(Uv,"detectShebang");function Bv(e){if(!Mv)return e;let t=Uv(e),r=!Fv.test(t);if(e.options.forceShell||r){let n=Vv.test(t);e.command=Lv.normalize(e.command),e.command=Vg.command(e.command),e.args=e.args.map(i=>Vg.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(Bv,"parseNonShell");function Kv(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:Bv(n)}s(Kv,"parse");Ug.exports=Kv});var Wg=he((Rz,Jg)=>{"use strict";var _p=process.platform==="win32";function vp(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(vp,"notFoundError");function Jv(e,t){if(!_p)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=Kg(o,t);if(i)return r.call(e,"error",i)}return r.apply(e,arguments)}}s(Jv,"hookChildProcess");function Kg(e,t){return _p&&e===1&&!t.file?vp(t.original,"spawn"):null}s(Kg,"verifyENOENT");function Wv(e,t){return _p&&e===1&&!t.file?vp(t.original,"spawnSync"):null}s(Wv,"verifyENOENTSync");Jg.exports={hookChildProcess:Jv,verifyENOENT:Kg,verifyENOENTSync:Wv,notFoundError:vp}});var Gg=he((Dz,Sr)=>{"use strict";var qg=Be("child_process"),kp=Bg(),xp=Wg();function Hg(e,t,r){let n=kp(e,t,r),o=qg.spawn(n.command,n.args,n.options);return xp.hookChildProcess(o,n),o}s(Hg,"spawn");function qv(e,t,r){let n=kp(e,t,r),o=qg.spawnSync(n.command,n.args,n.options);return o.error=o.error||xp.verifyENOENTSync(o.status,n),o}s(qv,"spawnSync");Sr.exports=Hg;Sr.exports.spawn=Hg;Sr.exports.sync=qv;Sr.exports._parse=kp;Sr.exports._enoent=xp});import{statSync as Dk}from"node:fs";function us(e){try{return Dk(e),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}}var b$=z(()=>{"use strict";s(us,"filePresent")});function Lk(e,t){let r=e.slice(0,t).split(/\r?\n/);return[r.length,r.pop().length+1]}function jk(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+=`
|
|
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 dm(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;dm(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 pm(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function ml(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let a in i)if(!mm.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]??pm(l);f!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(f))||c.push(f))}let u=c.length===1?c[0]:ml(c)??{allOf:c};Y(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=pm(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 K_(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of mm)if(o in e)return;let r=t.filter(o=>fm.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=ml(t);else{let o=r[0],i=fm.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=>ml([...a,u]));if(c.some(u=>!u))return;n={[i]:c}}n&&(delete e.allOf,$n(e,n))}function Qe(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 m=e.seen.get(p),g=m.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 b in l)b==="$ref"||b==="allOf"||b in f||delete l[b];if(g.$ref&&m.def)for(let b in l)b==="$ref"||b==="allOf"||b in m.def&&JSON.stringify(l[b])===JSON.stringify(m.def[b])&&delete l[b]}let d=c._zod.parent;if(d&&d!==p){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(l.$ref=m.schema.$ref,m.def))for(let g in l)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(l[g])===JSON.stringify(m.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())dm(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)??[])K_(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,Y(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:dr(t,"input",e.processors),output:dr(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 mm,fm,hl,dr,yn=z(()=>{fn();W();s($n,"assignProps");s(Xe,"initializeContext");s(q,"handleUnrepresentable");s(F,"processSchema");s(lm,"encodeJSONPointerSegment");s(Ye,"extractDefs");s(dm,"compactTypeUnion");mm=new Set(["type","properties","required","additionalProperties"]),fm=["oneOf","anyOf"];s(pm,"undeclaredConstraint");s(ml,"foldObjects");s(K_,"foldIntersection");s(Qe,"finalize");s(se,"isTransforming");hl=s((e,t={})=>r=>{let n=Xe({...r,processors:t});return F(e,n),Ye(n,e),Qe(n,e)},"createToJSONSchemaMethod"),dr=s((e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=Xe({...o??{},target:i,io:t,processors:r});return F(e,a),Ye(a,e),Qe(a,e)},"createStandardJSONSchemaMethod")});function H(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)J_[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&mr(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&mr(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&hr(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&hr(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&bm(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&_m(t,o.mime);for(let i of o.patterns??[])wm(t,i);return t}function bn(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?bn(t.out):t.type==="catch"?bn(t.innerType):e._zod.optin}function gl(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 y=gl(e,g,r);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let b=y.map(x=>gl(e,x,r));b.some((x,k)=>x!==y[k])&&(t={...t,[g]:b})}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:d,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(n.includes("number")?Le:Wr).source)),m}function H_(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 $l.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let a=gl(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 xm(e,t,r,n,o){let i=!1,a=JSON.stringify(e,(c,u)=>typeof u!="bigint"?u:(i=!0,null));return i?(q(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ql):JSON.parse(a)}function Ai(e,t){if("_idmap"in e){let n=e,o=Xe({...t,processors:zi}),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;Ye(o,f),Y(a,l,Qe(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=Xe({...t,processors:zi});return F(e,r),Ye(r,e),Qe(r,e)}var mr,hr,hm,bm,wm,_m,vm,gm,$m,ym,J_,W_,q_,km,yl,bl,wl,_l,vl,kl,xl,Sl,zl,Pl,Il,Al,Ol,Cl,El,Tl,Nl,Rl,Zl,Dl,Ll,jl,Ml,Fl,Vl,Pi,Ul,Bl,$l,Kl,Jl,Wl,ql,Hl,Gl,Xl,Yl,Ql,ef,Ii,tf,zi,wn=z(()=>{$t();Xt();yn();W();mr=s((e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},"narrowMin"),hr=s((e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},"narrowMax"),hm=s((e,t)=>{mr(e,"minimum",t),hr(e,"maximum",t)},"narrowBoth"),bm=s((e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},"addDivisor"),wm=s((e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},"addPattern"),_m=s((e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},"intersectMime"),vm=s((e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},"setFormat"),gm=s((e,t)=>mr(e,"minimum",t.minimum),"minContributor"),$m=s((e,t)=>hr(e,"maximum",t.maximum),"maxContributor"),ym=s(e=>(t,r)=>{vm(t,r.format);let[n,o]=e[r.format];mr(t,"minimum",n),hr(t,"maximum",o)},"formatContributor"),J_={greater_than:s((e,t)=>mr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),"greater_than"),less_than:s((e,t)=>hr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),"less_than"),multiple_of:s((e,t)=>bm(e,t.value),"multiple_of"),number_format:ym(Dr),bigint_format:ym(Lr),min_length:gm,max_length:$m,length_equals:s((e,t)=>hm(e,t.length),"length_equals"),min_size:gm,max_size:$m,size_equals:s((e,t)=>hm(e,t.size),"size_equals"),string_format:s((e,t)=>{vm(e,t.format),t.pattern&&wm(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)=>_m(e,t.mime),"mime_type")};s(H,"aggregateChecks");W_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},q_=new Map([[To,ba],[en,wa]]),km=s(e=>q_.get(e)??e,"exactPattern"),yl=s((e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:c,patterns:u,contentEncoding:l,laxFormat:f}=H(e);if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),c&&(o.format=W_[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(km);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},"stringProcessor"),bl=s((e,t,r,n)=>{let o=r,{minimum:i,maximum:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l,isInt:f}=H(e);o.type=f?"integer":"number";let p=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),d=typeof u=="number"&&u<=(a??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(p?m?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof i=="number"&&(o.minimum=i),d?m?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof a=="number"&&(o.maximum=a),c){let g=new Set;for(let x of c)Number.isFinite(x)&&x!==0?g.add(Math.abs(x)):q(e,t,o,n,`A multipleOf divisor of ${x} cannot be represented in JSON Schema`);let[y,...b]=g;y!==void 0&&(o.multipleOf=y),b.length&&(o.allOf=[...o.allOf??[],...b.map(x=>({multipleOf:x}))])}},"numberProcessor"),wl=s((e,t,r,n)=>{r.type="boolean"},"booleanProcessor"),_l=s((e,t,r,n)=>{q(e,t,r,n,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),vl=s((e,t,r,n)=>{q(e,t,r,n,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),kl=s((e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},"nullProcessor"),xl=s((e,t,r,n)=>{q(e,t,r,n,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),Sl=s((e,t,r,n)=>{q(e,t,r,n,"Void cannot be represented in JSON Schema")},"voidProcessor"),zl=s((e,t,r,n)=>{r.not={}},"neverProcessor"),Pl=s((e,t,r,n)=>{},"anyProcessor"),Il=s((e,t,r,n)=>{},"unknownProcessor"),Al=s((e,t,r,n)=>{q(e,t,r,n,"Date cannot be represented in JSON Schema")},"dateProcessor"),Ol=s((e,t,r,n)=>{let o=e._zod.def,i=Mt(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"),Cl=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(q(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(q(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"),El=s((e,t,r,n)=>{q(e,t,r,n,"NaN cannot be represented in JSON Schema")},"nanProcessor"),Tl=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"),Nl=s((e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:a,mime:c}=H(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"),Rl=s((e,t,r,n)=>{r.type="boolean"},"successProcessor"),Zl=s((e,t,r,n)=>{q(e,t,r,n,"Custom types cannot be represented in JSON Schema")},"customProcessor"),Dl=s((e,t,r,n)=>{q(e,t,r,n,"Function types cannot be represented in JSON Schema")},"functionProcessor"),Ll=s((e,t,r,n)=>{q(e,t,r,n,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),jl=s((e,t,r,n)=>{q(e,t,r,n,"Map cannot be represented in JSON Schema")},"mapProcessor"),Ml=s((e,t,r,n)=>{q(e,t,r,n,"Set cannot be represented in JSON Schema")},"setProcessor"),Fl=s((e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:c}=H(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(bn,"inputOptin");Vl=s((e,t,r,n)=>{let o=r,i=e._zod.def,a=i.shape;if(Object.getOwnPropertySymbols(a).length&&q(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in a)Y(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"?bn(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"),Pi=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"),Ul=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"),Bl=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((y,b)=>F(y,t,{...n,path:[...n.path,a,b]})),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 y=i.items[f-1];if(!(t.io==="input"?bn(y)!==void 0:y._zod.optout==="optional"))break;f--}let p=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=u,d?o.items=!1:l&&(o.items=l),f>0&&(o.minItems=f),d&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:u},l&&o.items.anyOf.push(l),f>0&&(o.minItems=f),d&&(o.maxItems=p)):(o.items=u,d?o.additionalItems=!1:l&&(o.additionalItems=l),f>0&&(o.minItems=f),d&&(o.maxItems=p));let{minimum:m,maximum:g}=H(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)},"tupleProcessor");s(gl,"stringifyKeyNames");$l=new WeakMap;s(H_,"rewriteKeyNames");Kl=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=H(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)Y(o.patternProperties,km(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=$l.get(t);f||(f=[],$l.set(t,f),t.deferred.push(()=>H_(t))),f.push(e)}o.additionalProperties=F(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=a._zod.values,l=t.io==="input"&&bn(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"),Jl=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"),Wl=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"),ql=Symbol();s(xm,"serializeDefaultValue");Hl=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=xm(o.defaultValue,e,t,r,n);a!==ql&&(r.default=a)},"defaultProcessor"),Gl=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=xm(o.defaultValue,e,t,r,n);a!==ql&&(r._prefault=a)},"prefaultProcessor"),Xl=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{q(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=a},"catchProcessor"),Yl=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"),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,r.readOnly=!0},"readonlyProcessor"),ef=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"),Ii=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"),tf=s((e,t,r,n)=>{let o=e._zod.innerType;F(o,t,n);let i=t.seen.get(e);i.ref=o},"lazyProcessor"),zi={string:yl,number:bl,boolean:wl,bigint:_l,symbol:vl,null:kl,undefined:xl,void:Sl,never:zl,any:Pl,unknown:Il,date:Al,enum:Ol,literal:Cl,nan:El,template_literal:Tl,file:Nl,success:Rl,custom:Zl,function:Dl,transform:Ll,map:jl,set:Ml,array:Fl,object:Vl,union:Pi,intersection:Ul,tuple:Bl,record:Kl,nullable:Jl,nonoptional:Wl,default:Hl,prefault:Gl,catch:Xl,pipe:Yl,readonly:Ql,promise:ef,optional:Ii,lazy:tf};s(Ai,"toJSONSchema")});var Oi,Sm=z(()=>{wn();yn();Oi=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=Xe({processors:zi,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,Ye(this.ctx,t);let n=Qe(this.ctx,t),{"~standard":o,...i}=n;return i}}});var zm={};var Pm=z(()=>{});var Me={};ge(Me,{$ZodAny:()=>Fc,$ZodArray:()=>Jc,$ZodAsyncError:()=>pe,$ZodBase64:()=>Ac,$ZodBase64URL:()=>Oc,$ZodBigInt:()=>jo,$ZodBigIntFormat:()=>Dc,$ZodBoolean:()=>tn,$ZodCIDRv4:()=>Pc,$ZodCIDRv6:()=>Ic,$ZodCUID:()=>hc,$ZodCUID2:()=>gc,$ZodCatch:()=>fu,$ZodCheck:()=>U,$ZodCheckBigIntFormat:()=>Fa,$ZodCheckEndsWith:()=>Qa,$ZodCheckGreaterThan:()=>_o,$ZodCheckIncludes:()=>Xa,$ZodCheckLengthEquals:()=>Wa,$ZodCheckLessThan:()=>wo,$ZodCheckLowerCase:()=>Ha,$ZodCheckMaxLength:()=>Ka,$ZodCheckMaxSize:()=>Va,$ZodCheckMimeType:()=>rc,$ZodCheckMinLength:()=>Ja,$ZodCheckMinSize:()=>Ua,$ZodCheckMultipleOf:()=>ja,$ZodCheckNumberFormat:()=>Ma,$ZodCheckOverwrite:()=>nc,$ZodCheckProperties:()=>tc,$ZodCheckProperty:()=>ec,$ZodCheckRegex:()=>qa,$ZodCheckSizeEquals:()=>Ba,$ZodCheckStartsWith:()=>Ya,$ZodCheckStringFormat:()=>Ht,$ZodCheckUpperCase:()=>Ga,$ZodCodec:()=>nn,$ZodCreditCard:()=>Ec,$ZodCustom:()=>yu,$ZodCustomStringFormat:()=>Rc,$ZodCyclicError:()=>Jo,$ZodDate:()=>Kc,$ZodDefault:()=>au,$ZodDiscriminatedUnion:()=>Gc,$ZodE164:()=>Cc,$ZodEmail:()=>uc,$ZodEmoji:()=>dc,$ZodEncodeError:()=>qe,$ZodEnum:()=>tu,$ZodError:()=>Xs,$ZodExactOptional:()=>iu,$ZodFile:()=>nu,$ZodFunction:()=>gu,$ZodGUID:()=>ac,$ZodIBAN:()=>Tc,$ZodIPv4:()=>xc,$ZodIPv6:()=>Sc,$ZodISODate:()=>_c,$ZodISODateTime:()=>wc,$ZodISODuration:()=>kc,$ZodISOTime:()=>vc,$ZodIntersection:()=>Xc,$ZodJWT:()=>Nc,$ZodKSUID:()=>bc,$ZodLazy:()=>on,$ZodLiteral:()=>ru,$ZodMAC:()=>zc,$ZodMap:()=>Qc,$ZodNaN:()=>pu,$ZodNanoID:()=>mc,$ZodNever:()=>Uc,$ZodNonOptional:()=>uu,$ZodNull:()=>Mc,$ZodNullable:()=>su,$ZodNumber:()=>Lo,$ZodNumberFormat:()=>Zc,$ZodObject:()=>Jd,$ZodObjectJIT:()=>Wc,$ZodOptional:()=>Fo,$ZodPipe:()=>Vo,$ZodPrefault:()=>cu,$ZodPreprocess:()=>du,$ZodPromise:()=>$u,$ZodReadonly:()=>mu,$ZodRealError:()=>de,$ZodRecord:()=>Yc,$ZodRegistry:()=>Ho,$ZodSet:()=>eu,$ZodString:()=>bt,$ZodStringFormat:()=>M,$ZodSuccess:()=>lu,$ZodSymbol:()=>Lc,$ZodTemplateLiteral:()=>hu,$ZodTransform:()=>ou,$ZodTuple:()=>Mo,$ZodType:()=>E,$ZodULID:()=>$c,$ZodURL:()=>pc,$ZodUUID:()=>cc,$ZodUndefined:()=>jc,$ZodUnion:()=>rn,$ZodUnknown:()=>Vc,$ZodVoid:()=>Bc,$ZodXID:()=>yc,$ZodXor:()=>qc,$brand:()=>qs,$constructor:()=>h,$input:()=>Su,$output:()=>xu,Doc:()=>yt,INVALID:()=>ie,JSONSchema:()=>zm,JSONSchemaGenerator:()=>Oi,NEVER:()=>Ws,TimePrecision:()=>Zu,URL_BAD_FORMAT:()=>lc,URL_UNPARSEABLE:()=>Gr,ZodCompileAsyncError:()=>Pe,ZodCompileUnsupportedError:()=>R,_any:()=>Qu,_array:()=>sl,_base64:()=>$i,_base64url:()=>yi,_bigint:()=>Ju,_boolean:()=>Bu,_catch:()=>j_,_check:()=>cm,_cidrv4:()=>hi,_cidrv6:()=>gi,_coercedBigint:()=>Wu,_coercedBoolean:()=>Ku,_coercedDate:()=>ol,_coercedNumber:()=>Lu,_coercedString:()=>Eu,_creditCard:()=>Nu,_cuid:()=>ci,_cuid2:()=>ui,_custom:()=>cl,_date:()=>nl,_decode:()=>co,_decodeAsync:()=>lo,_default:()=>Z_,_discriminatedUnion:()=>x_,_e164:()=>bi,_email:()=>ei,_emoji:()=>si,_encode:()=>ao,_encodeAsync:()=>uo,_endsWith:()=>ir,_enum:()=>O_,_file:()=>al,_float32:()=>Mu,_float64:()=>Fu,_gt:()=>Te,_gte:()=>ye,_guid:()=>ti,_iban:()=>Ru,_includes:()=>nr,_int:()=>ju,_int32:()=>Vu,_int64:()=>qu,_intersection:()=>S_,_ipv4:()=>di,_ipv6:()=>mi,_isoDate:()=>mn,_isoDateTime:()=>dn,_isoDuration:()=>gn,_isoTime:()=>hn,_jwt:()=>wi,_ksuid:()=>pi,_lazy:()=>U_,_length:()=>zt,_literal:()=>E_,_lowercase:()=>tr,_lt:()=>Ee,_lte:()=>$e,_mac:()=>Tu,_map:()=>I_,_max:()=>$e,_maxLength:()=>St,_maxSize:()=>Ge,_mime:()=>ar,_min:()=>ye,_minLength:()=>je,_minSize:()=>Ne,_multipleOf:()=>He,_nan:()=>il,_nanoid:()=>ai,_nativeEnum:()=>C_,_negative:()=>vi,_never:()=>tl,_nonnegative:()=>xi,_nonoptional:()=>D_,_nonpositive:()=>ki,_normalize:()=>cr,_null:()=>Yu,_nullable:()=>R_,_number:()=>Du,_optional:()=>N_,_overwrite:()=>Ie,_parse:()=>Kt,_parseAsync:()=>Jt,_pipe:()=>M_,_positive:()=>_i,_promise:()=>B_,_properties:()=>sr,_property:()=>Si,_readonly:()=>F_,_record:()=>P_,_refine:()=>ul,_regex:()=>er,_safeDecode:()=>po,_safeDecodeAsync:()=>ho,_safeEncode:()=>fo,_safeEncodeAsync:()=>mo,_safeParse:()=>Wt,_safeParseAsync:()=>qt,_set:()=>A_,_size:()=>xt,_slugify:()=>pr,_startsWith:()=>or,_string:()=>Cu,_stringFormat:()=>Pt,_stringbool:()=>dl,_success:()=>L_,_superRefine:()=>ll,_symbol:()=>Gu,_templateLiteral:()=>V_,_toLowerCase:()=>lr,_toUpperCase:()=>fr,_transform:()=>T_,_trim:()=>ur,_tuple:()=>z_,_uint32:()=>Uu,_uint64:()=>Hu,_ulid:()=>li,_undefined:()=>Xu,_union:()=>v_,_unknown:()=>el,_uppercase:()=>rr,_url:()=>pn,_uuid:()=>ri,_uuidv4:()=>ni,_uuidv6:()=>oi,_uuidv7:()=>ii,_void:()=>rl,_xid:()=>fi,_xor:()=>k_,base64Charset:()=>To,base64urlCharset:()=>en,canParseURL:()=>fc,clone:()=>j,compile:()=>Au,compileFn:()=>Yo,config:()=>J,createStandardJSONSchemaMethod:()=>dr,createToJSONSchemaMethod:()=>hl,decode:()=>Eb,decodeAsync:()=>Nb,describe:()=>fl,encode:()=>Cb,encodeAsync:()=>Tb,extractDefs:()=>Ye,finalize:()=>Qe,flattenError:()=>Vr,formatError:()=>Ur,getDiscriminatedOption:()=>Hc,globalConfig:()=>X,globalRegistry:()=>Q,handleUnrepresentable:()=>q,initializeContext:()=>Xe,isBackEdge:()=>qo,isRecursiveSchema:()=>Wo,isValidBase64:()=>Qr,isValidBase64URL:()=>No,isValidCIDRv6:()=>Eo,isValidCreditCard:()=>Ro,isValidIBAN:()=>Zo,isValidIPv6:()=>Yr,isValidJWT:()=>Do,locales:()=>ln,memoizer:()=>cn,mergeValues:()=>Gt,meta:()=>pl,parse:()=>io,parseAsync:()=>so,parseURLObject:()=>Ud,prettifyError:()=>Qs,process:()=>F,processSchema:()=>F,regexes:()=>Se,registry:()=>Go,safeDecode:()=>Zb,safeDecodeAsync:()=>Lb,safeEncode:()=>Rb,safeEncodeAsync:()=>Db,safeParse:()=>zb,safeParseAsync:()=>Pb,standardProps:()=>Io,stripTabAndNewline:()=>Xr,toDotPath:()=>vd,toJSONSchema:()=>Ai,toZod:()=>Tr,treeifyError:()=>Ys,urlHostnameOk:()=>Oo,urlProtocolOk:()=>Co,util:()=>S,validate:()=>Br,validateAsync:()=>Kr,validateURL:()=>Ao,version:()=>oc,withParser:()=>Xo});var be=z(()=>{We();ta();ea();Xt();_u();vo();ic();W();W();$t();ku();fn();ko();am();um();yn();wn();Sm();Pm()});var Ci={};ge(Ci,{endsWith:()=>ir,gt:()=>Te,gte:()=>ye,includes:()=>nr,length:()=>zt,lowercase:()=>tr,lt:()=>Ee,lte:()=>$e,maxLength:()=>St,maxSize:()=>Ge,mime:()=>ar,minLength:()=>je,minSize:()=>Ne,multipleOf:()=>He,negative:()=>vi,nonnegative:()=>xi,nonpositive:()=>ki,normalize:()=>cr,overwrite:()=>Ie,positive:()=>_i,properties:()=>sr,property:()=>Si,regex:()=>er,size:()=>xt,slugify:()=>pr,startsWith:()=>or,toLowerCase:()=>lr,toUpperCase:()=>fr,trim:()=>ur,uppercase:()=>rr});var Ei=z(()=>{be()});function Ti(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 Im,Am,X_,me,rf=z(()=>{be();be();W();Im=new WeakSet([Object.prototype,Error.prototype]);s(Ti,"_lazyMethod");Am=s((e,t)=>{Xs.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Im.has(r)||(Im.add(r),Ti(r,"format",n=>o=>Ur(n,o)),Ti(r,"flatten",n=>o=>Vr(n,o)),Ti(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Ft,2)}),Ti(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Ft,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),X_=h("ZodError",Am),me=h("ZodError",Am,void 0,{Parent:Error})});var nf,of,sf,af,cf,uf,lf,ff,pf,df,mf,hf,gf=z(()=>{be();rf();be();nf=Kt(me),of=Jt(me),sf=Wt(me),af=qt(me),cf=ao(me),uf=co(me),lf=uo(me),ff=lo(me),pf=fo(me),df=po(me),mf=mo(me),hf=ho(me)});var kr={};ge(kr,{ZodAny:()=>zf,ZodArray:()=>Of,ZodBase64:()=>Gi,ZodBase64URL:()=>Xi,ZodBigInt:()=>_r,ZodBigIntFormat:()=>es,ZodBoolean:()=>wr,ZodCIDRv4:()=>qi,ZodCIDRv6:()=>Hi,ZodCUID:()=>Fi,ZodCUID2:()=>Vi,ZodCatch:()=>Xf,ZodCodec:()=>On,ZodCreditCard:()=>yf,ZodCustom:()=>Cn,ZodCustomStringFormat:()=>Ct,ZodDate:()=>xn,ZodDefault:()=>Kf,ZodDiscriminatedUnion:()=>Ef,ZodE164:()=>Yi,ZodEmail:()=>Di,ZodEmoji:()=>ji,ZodEnum:()=>$r,ZodExactOptional:()=>os,ZodFile:()=>Ff,ZodFunction:()=>ap,ZodGUID:()=>Li,ZodIBAN:()=>bf,ZodIPv4:()=>Ji,ZodIPv6:()=>Wi,ZodISODate:()=>tt,ZodISODateTime:()=>et,ZodISODuration:()=>nt,ZodISOTime:()=>rt,ZodInstanceOf:()=>lp,ZodIntersection:()=>Tf,ZodJWT:()=>Qi,ZodKSUID:()=>Ki,ZodLazy:()=>op,ZodLiteral:()=>Mf,ZodMAC:()=>$f,ZodMap:()=>Lf,ZodNaN:()=>Qf,ZodNanoID:()=>Mi,ZodNever:()=>If,ZodNonOptional:()=>is,ZodNull:()=>xf,ZodNullable:()=>Bf,ZodNumber:()=>br,ZodNumberFormat:()=>Et,ZodObject:()=>zn,ZodOptional:()=>In,ZodPipe:()=>An,ZodPrefault:()=>Wf,ZodPreprocess:()=>ep,ZodPromise:()=>sp,ZodReadonly:()=>tp,ZodRecord:()=>gr,ZodSet:()=>jf,ZodString:()=>yr,ZodStringFormat:()=>V,ZodSuccess:()=>Gf,ZodSymbol:()=>vf,ZodTemplateLiteral:()=>np,ZodTransform:()=>Vf,ZodTuple:()=>Rf,ZodType:()=>T,ZodULID:()=>Ui,ZodURL:()=>kn,ZodUUID:()=>Re,ZodUndefined:()=>kf,ZodUnion:()=>Pn,ZodUnknown:()=>Pf,ZodVoid:()=>Af,ZodXID:()=>Bi,ZodXor:()=>Cf,_ZodString:()=>Zi,_default:()=>Jf,_function:()=>jh,any:()=>gh,array:()=>Sn,base64:()=>Gm,base64url:()=>Xm,bigint:()=>fh,boolean:()=>_f,catch:()=>Yf,check:()=>Mh,cidrv4:()=>qm,cidrv6:()=>Hm,codec:()=>Rh,creditCard:()=>Qm,cuid:()=>Mm,cuid2:()=>Fm,currencyCode:()=>ih,custom:()=>Fh,date:()=>yh,describe:()=>Vh,discriminatedUnion:()=>xh,e164:()=>Ym,email:()=>Om,emoji:()=>Lm,enum:()=>rs,exactOptional:()=>Uf,file:()=>Ch,float32:()=>ah,float64:()=>ch,function:()=>jh,guid:()=>Cm,hash:()=>sh,hex:()=>oh,hostname:()=>nh,httpUrl:()=>Dm,iban:()=>eh,instanceof:()=>Bh,int:()=>Ni,int32:()=>uh,int64:()=>ph,intersection:()=>Nf,invertCodec:()=>Zh,ipv4:()=>Km,ipv6:()=>Wm,json:()=>Jh,jwt:()=>th,keyof:()=>bh,ksuid:()=>Bm,lazy:()=>ip,literal:()=>Oh,looseObject:()=>vh,looseRecord:()=>zh,mac:()=>Jm,map:()=>Ph,meta:()=>Uh,nan:()=>Nh,nanoid:()=>jm,nativeEnum:()=>Ah,never:()=>ts,nonoptional:()=>Hf,null:()=>Sf,nullable:()=>vn,nullish:()=>Eh,number:()=>wf,object:()=>wh,optional:()=>At,partialRecord:()=>Sh,pipe:()=>Ri,prefault:()=>qf,preprocess:()=>Wh,promise:()=>Lh,readonly:()=>rp,record:()=>Df,refine:()=>cp,set:()=>Ih,strictObject:()=>_h,string:()=>_n,stringFormat:()=>rh,stringbool:()=>Kh,success:()=>Th,superRefine:()=>up,symbol:()=>mh,templateLiteral:()=>Dh,transform:()=>ns,tuple:()=>Zf,uint32:()=>lh,uint64:()=>dh,ulid:()=>Vm,undefined:()=>hh,union:()=>vr,unknown:()=>It,url:()=>Zm,uuid:()=>Em,uuidv4:()=>Tm,uuidv6:()=>Nm,uuidv7:()=>Rm,void:()=>$h,xid:()=>Um,xor:()=>kh});function Q_(){X.localeError||J(un())}function Ot(){X.memoizer||J({memoizer:cn()})}function _n(e){return Cu(yr,e)}function Om(e){return ei(Di,e)}function Cm(e){return ti(Li,e)}function Em(e){return ri(Re,e)}function Tm(e){return ni(Re,e)}function Nm(e){return oi(Re,e)}function Rm(e){return ii(Re,e)}function Zm(e){return pn(kn,e)}function Dm(e){return pn(kn,{protocol:Jr,hostname:va,...S.normalizeParams(e)})}function Lm(e){return si(ji,e)}function jm(e){return ai(Mi,e)}function Mm(e){return ci(Fi,e)}function Fm(e){return ui(Vi,e)}function Vm(e){return li(Ui,e)}function Um(e){return fi(Bi,e)}function Bm(e){return pi(Ki,e)}function Km(e){return di(Ji,e)}function Jm(e){return Tu($f,e)}function Wm(e){return mi(Wi,e)}function qm(e){return hi(qi,e)}function Hm(e){return gi(Hi,e)}function Gm(e){return $i(Gi,e)}function Xm(e){return yi(Xi,e)}function Ym(e){return bi(Yi,e)}function Qm(e){return Nu(yf,e)}function eh(e){return Ru(bf,e)}function th(e){return wi(Qi,e)}function rh(e,t,r={}){return Pt(Ct,e,t,r)}function nh(e){return Pt(Ct,"hostname",_a,e)}function oh(e){return Pt(Ct,"hex",Za,e)}function ih(e){return Pt(Ct,"currency_code",xa,e)}function sh(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=Se[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Pt(Ct,n,o,t)}function wf(e){return Du(br,e)}function Ni(e){return ju(Et,e)}function ah(e){return Mu(Et,e)}function ch(e){return Fu(Et,e)}function uh(e){return Vu(Et,e)}function lh(e){return Uu(Et,e)}function _f(e){return Bu(wr,e)}function fh(e){return Ju(_r,e)}function ph(e){return qu(es,e)}function dh(e){return Hu(es,e)}function mh(e){return Gu(vf,e)}function hh(e){return Xu(kf,e)}function Sf(e){return Yu(xf,e)}function gh(){return Qu(zf)}function It(){return el(Pf)}function ts(e){return tl(If,e)}function $h(e){return rl(Af,e)}function yh(e){return nl(xn,e)}function Sn(e,t){return sl(Of,e,t)}function bh(e){let t=e._zod.def.shape;return rs(Object.keys(t))}function wh(e,t){let r={type:"object",shape:e??{},...S.normalizeParams(t)};return new zn(r)}function _h(e,t){return new zn({type:"object",shape:e,catchall:ts(),...S.normalizeParams(t)})}function vh(e,t){return new zn({type:"object",shape:e,catchall:It(),...S.normalizeParams(t)})}function vr(e,t){return new Pn({type:"union",options:e,...S.normalizeParams(t)})}function kh(e,t){return new Cf({type:"union",options:e,inclusive:!1,...S.normalizeParams(t)})}function xh(e,t,r){return new Ef({type:"union",options:t,discriminator:e,...S.normalizeParams(r)})}function Nf(e,t){return new Tf({type:"intersection",left:e,right:t})}function Zf(e,t,r){let n=t instanceof E,o=n?r:t,i=n?t:null;return new Rf({type:"tuple",items:e,rest:i,...S.normalizeParams(o)})}function Df(e,t,r){return!t||!t._zod?new gr({type:"record",keyType:_n(),valueType:e,...S.normalizeParams(t)}):new gr({type:"record",keyType:e,valueType:t,...S.normalizeParams(r)})}function Sh(e,t,r){return new gr({type:"record",keyType:e,valueType:t,...S.normalizeParams(r),partial:!0})}function zh(e,t,r){return new gr({type:"record",keyType:e,valueType:t,mode:"loose",...S.normalizeParams(r)})}function Ph(e,t,r){return new Lf({type:"map",keyType:e,valueType:t,...S.normalizeParams(r)})}function Ih(e,t){return new jf({type:"set",valueType:e,...S.normalizeParams(t)})}function rs(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new $r({type:"enum",entries:r,...S.normalizeParams(t)})}function Ah(e,t){return new $r({type:"enum",entries:e,...S.normalizeParams(t)})}function Oh(e,t){return new Mf({type:"literal",values:Array.isArray(e)?e:[e],...S.normalizeParams(t)})}function Ch(e){return al(Ff,e)}function ns(e){return new Vf({type:"transform",transform:e})}function At(e){return new In({type:"optional",innerType:e})}function Uf(e){return new os({type:"optional",innerType:e})}function vn(e){return new Bf({type:"nullable",innerType:e})}function Eh(e){return At(vn(e))}function Jf(e,t){return new Kf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():S.shallowClone(t)}})}function qf(e,t){return new Wf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():S.shallowClone(t)}})}function Hf(e,t){return new is({type:"nonoptional",innerType:e,...S.normalizeParams(t)})}function Th(e){return new Gf({type:"success",innerType:e})}function Yf(e,t){return new Xf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:S.constantCatch(t)})}function Nh(e){return il(Qf,e)}function Ri(e,t){return new An({type:"pipe",in:e,out:t})}function Rh(e,t,r){return new On({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function Zh(e){let t=e._zod.def;return new On({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}function rp(e){return new tp({type:"readonly",innerType:e})}function Dh(e,t){return new np({type:"template_literal",parts:e,...S.normalizeParams(t)})}function ip(e){return new op({type:"lazy",getter:e})}function Lh(e){return new sp({type:"promise",innerType:e})}function jh(e){return new ap({type:"function",input:Array.isArray(e?.input)?Zf(e?.input):e?.input??Sn(It()),output:e?.output??It()})}function Mh(e){let t=new U({check:"custom"});return t._zod.check=e,t}function Fh(e,t){return cl(Cn,e??(()=>!0),t)}function cp(e,t={}){return ul(Cn,e,t)}function up(e,t){return ll(e,t)}function Bh(e,t={}){let r=new lp({type:"custom",check:"custom",fn:s(n=>n instanceof e,"fn"),abort:!0,...S.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 Jh(e){let t=ip(()=>vr([_n(e),wf(),_f(),Sf(),Sn(t),Df(_n(),t)]));return t}function Wh(e,t){return new ep({type:"pipe",in:ns(e),out:t})}var T,Zi,yr,V,et,tt,rt,nt,Di,Li,Re,kn,ji,Mi,Fi,Vi,Ui,Bi,Ki,Ji,$f,Wi,qi,Hi,Gi,Xi,Yi,yf,bf,Qi,Ct,br,Et,wr,_r,es,vf,kf,xf,zf,Pf,If,Af,xn,Of,zn,Pn,Cf,Ef,Tf,Rf,gr,Lf,jf,$r,Mf,Ff,Vf,In,os,Bf,Kf,Wf,is,Gf,Xf,Qf,An,On,ep,tp,np,op,sp,ap,Cn,Vh,Uh,lp,Kh,ot=z(()=>{be();be();wn();$t();yn();vu();Ei();gf();s(Q_,"_ensureDefaultLocale");s(Ot,"_ensureDefaultMemoizer");T=h("ZodType",(e,t)=>(Q_(),E.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(S.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(cp(e,t))},superRefine(e,t){return this.check(up(e,t))},overwrite(e){return this.check(Ie(e))},optional(){return At(this)},exactOptional(){return Uf(this)},nullable(){return vn(this)},nullish(){return At(vn(this))},nonoptional(e){return Hf(this,e)},array(){return Sn(this)},or(e){return vr([this,e])},and(e){return Nf(this,e)},transform(e){return Ri(this,ns(e))},default(e){return Jf(this,e)},prefault(e){return qf(this,e)},catch(e){return Yf(this,e)},pipe(e){return Ri(this,e)},readonly(){return rp(this)},describe(e){let t=this.clone();return Q.add(t,{description:e}),t},meta(...e){if(e.length===0)return Q.get(this);let t=this.clone();return Q.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 S.hide(this,"~standard",{...Io(this),jsonSchema:{input:dr(this,"input"),output:dr(this,"output")}})},set"~standard"(e){S.own(this,"~standard",e)},parse:s(function e(t,r){return nf(this,t,r,{callee:e})},"_parse"),parseAsync:s(async function e(t,r){return await of(this,t,r,{callee:e})},"_parseAsync"),safeParse(e,t){return sf(this,e,t)},async safeParseAsync(e,t){return af(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){S.own(this,"spa",e)},validate(e,t){return Br(this,e,t)},validateAsync(e,t){return Kr(this,e,t)},encode:s(function e(t,r){return cf(this,t,r,{callee:e})},"_encode"),decode:s(function e(t,r){return uf(this,t,r,{callee:e})},"_decode"),encodeAsync:s(async function e(t,r){return await lf(this,t,r,{callee:e})},"_encodeAsync"),decodeAsync:s(async function e(t,r){return await ff(this,t,r,{callee:e})},"_decodeAsync"),safeEncode(e,t){return pf(this,e,t)},safeDecode(e,t){return df(this,e,t)},async safeEncodeAsync(e,t){return mf(this,e,t)},async safeDecodeAsync(e,t){return hf(this,e,t)},toJSONSchema(e){return hl(this,{})(e)},get description(){return Q.get(this)?.description},get _def(){return this._zod.def}}),Zi=h("_ZodString",(e,t)=>{bt.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yl(e,r,n,o)},S.derived({format:s(e=>H(e).format??null,"format"),minLength:s(e=>H(e).minimum??null,"minLength"),maxLength:s(e=>H(e).maximum??null,"maxLength")},{regex(...e){return this.check(er(...e))},includes(...e){return this.check(nr(...e))},startsWith(...e){return this.check(or(...e))},endsWith(...e){return this.check(ir(...e))},min(...e){return this.check(je(...e))},max(...e){return this.check(St(...e))},length(...e){return this.check(zt(...e))},nonempty(...e){return this.check(je(1,...e))},lowercase(e){return this.check(tr(e))},uppercase(e){return this.check(rr(e))},trim(){return this.check(ur())},normalize(...e){return this.check(cr(...e))},toLowerCase(){return this.check(lr())},toUpperCase(){return this.check(fr())},slugify(){return this.check(pr())}})),yr=h("ZodString",(e,t)=>{bt.init(e,t),Zi.init(e,t)},{email(e){return this.check(ei(Di,e))},url(e){return this.check(pn(kn,e))},jwt(e){return this.check(wi(Qi,e))},emoji(e){return this.check(si(ji,e))},guid(e){return this.check(ti(Li,e))},uuid(e){return this.check(ri(Re,e))},uuidv4(e){return this.check(ni(Re,e))},uuidv6(e){return this.check(oi(Re,e))},uuidv7(e){return this.check(ii(Re,e))},nanoid(e){return this.check(ai(Mi,e))},cuid(e){return this.check(ci(Fi,e))},cuid2(e){return this.check(ui(Vi,e))},ulid(e){return this.check(li(Ui,e))},base64(e){return this.check($i(Gi,e))},base64url(e){return this.check(yi(Xi,e))},xid(e){return this.check(fi(Bi,e))},ksuid(e){return this.check(pi(Ki,e))},ipv4(e){return this.check(di(Ji,e))},ipv6(e){return this.check(mi(Wi,e))},cidrv4(e){return this.check(hi(qi,e))},cidrv6(e){return this.check(gi(Hi,e))},e164(e){return this.check(bi(Yi,e))},datetime(e){return this.check(dn(et,e))},date(e){return this.check(mn(tt,e))},time(e){return this.check(hn(rt,e))},duration(e){return this.check(gn(nt,e))}});s(_n,"string");V=h("ZodStringFormat",(e,t)=>{M.init(e,t),Zi.init(e,t)}),et=h("ZodISODateTime",(e,t)=>{wc.init(e,t),V.init(e,t)}),tt=h("ZodISODate",(e,t)=>{_c.init(e,t),V.init(e,t)}),rt=h("ZodISOTime",(e,t)=>{vc.init(e,t),V.init(e,t)}),nt=h("ZodISODuration",(e,t)=>{kc.init(e,t),V.init(e,t)}),Di=h("ZodEmail",(e,t)=>{uc.init(e,t),V.init(e,t)});s(Om,"email");Li=h("ZodGUID",(e,t)=>{ac.init(e,t),V.init(e,t)});s(Cm,"guid");Re=h("ZodUUID",(e,t)=>{cc.init(e,t),V.init(e,t)});s(Em,"uuid");s(Tm,"uuidv4");s(Nm,"uuidv6");s(Rm,"uuidv7");kn=h("ZodURL",(e,t)=>{pc.init(e,t),V.init(e,t)});s(Zm,"url");s(Dm,"httpUrl");ji=h("ZodEmoji",(e,t)=>{dc.init(e,t),V.init(e,t)});s(Lm,"emoji");Mi=h("ZodNanoID",(e,t)=>{mc.init(e,t),V.init(e,t)});s(jm,"nanoid");Fi=h("ZodCUID",(e,t)=>{hc.init(e,t),V.init(e,t)});s(Mm,"cuid");Vi=h("ZodCUID2",(e,t)=>{gc.init(e,t),V.init(e,t)});s(Fm,"cuid2");Ui=h("ZodULID",(e,t)=>{$c.init(e,t),V.init(e,t)});s(Vm,"ulid");Bi=h("ZodXID",(e,t)=>{yc.init(e,t),V.init(e,t)});s(Um,"xid");Ki=h("ZodKSUID",(e,t)=>{bc.init(e,t),V.init(e,t)});s(Bm,"ksuid");Ji=h("ZodIPv4",(e,t)=>{xc.init(e,t),V.init(e,t)});s(Km,"ipv4");$f=h("ZodMAC",(e,t)=>{zc.init(e,t),V.init(e,t)});s(Jm,"mac");Wi=h("ZodIPv6",(e,t)=>{Sc.init(e,t),V.init(e,t)});s(Wm,"ipv6");qi=h("ZodCIDRv4",(e,t)=>{Pc.init(e,t),V.init(e,t)});s(qm,"cidrv4");Hi=h("ZodCIDRv6",(e,t)=>{Ic.init(e,t),V.init(e,t)});s(Hm,"cidrv6");Gi=h("ZodBase64",(e,t)=>{Ac.init(e,t),V.init(e,t)});s(Gm,"base64");Xi=h("ZodBase64URL",(e,t)=>{Oc.init(e,t),V.init(e,t)});s(Xm,"base64url");Yi=h("ZodE164",(e,t)=>{Cc.init(e,t),V.init(e,t)});s(Ym,"e164");yf=h("ZodCreditCard",(e,t)=>{Ec.init(e,t),V.init(e,t)});s(Qm,"creditCard");bf=h("ZodIBAN",(e,t)=>{Tc.init(e,t),V.init(e,t)});s(eh,"iban");Qi=h("ZodJWT",(e,t)=>{Nc.init(e,t),V.init(e,t)});s(th,"jwt");Ct=h("ZodCustomStringFormat",(e,t)=>{Rc.init(e,t),V.init(e,t)});s(rh,"stringFormat");s(nh,"hostname");s(oh,"hex");s(ih,"currencyCode");s(sh,"hash");br=h("ZodNumber",(e,t)=>{Lo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bl(e,r,n,o),e.isFinite=!0},S.derived({minValue:s(e=>{let{minimum:t,exclusiveMinimum:r}=H(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},"minValue"),maxValue:s(e=>{let{maximum:t,exclusiveMaximum:r}=H(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},"maxValue"),isInt:s(e=>{let{isInt:t,multipleOf:r}=H(e);return!!t||!!r?.some(Number.isSafeInteger)},"isInt"),format:s(e=>H(e).format??null,"format")},{gt(e,t){return this.check(Te(e,t))},gte(e,t){return this.check(ye(e,t))},min(e,t){return this.check(ye(e,t))},lt(e,t){return this.check(Ee(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(Ni(e))},safe(e){return this.check(Ni(e))},positive(e){return this.check(Te(0,e))},nonnegative(e){return this.check(ye(0,e))},negative(e){return this.check(Ee(0,e))},nonpositive(e){return this.check($e(0,e))},multipleOf(e,t){return this.check(He(e,t))},step(e,t){return this.check(He(e,t))},finite(){return this}}));s(wf,"number");Et=h("ZodNumberFormat",(e,t)=>{Zc.init(e,t),br.init(e,t)});s(Ni,"int");s(ah,"float32");s(ch,"float64");s(uh,"int32");s(lh,"uint32");wr=h("ZodBoolean",(e,t)=>{tn.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wl(e,r,n,o)});s(_f,"boolean");_r=h("ZodBigInt",(e,t)=>{jo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_l(e,r,n,o)},S.derived({minValue:s(e=>H(e).minimum??null,"minValue"),maxValue:s(e=>H(e).maximum??null,"maxValue"),format:s(e=>H(e).format??null,"format")},{gte(e,t){return this.check(ye(e,t))},min(e,t){return this.check(ye(e,t))},gt(e,t){return this.check(Te(e,t))},lt(e,t){return this.check(Ee(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(Ee(BigInt(0),e))},nonpositive(e){return this.check($e(BigInt(0),e))},nonnegative(e){return this.check(ye(BigInt(0),e))},multipleOf(e,t){return this.check(He(e,t))}}));s(fh,"bigint");es=h("ZodBigIntFormat",(e,t)=>{Dc.init(e,t),_r.init(e,t)});s(ph,"int64");s(dh,"uint64");vf=h("ZodSymbol",(e,t)=>{Lc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vl(e,r,n,o)});s(mh,"symbol");kf=h("ZodUndefined",(e,t)=>{jc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xl(e,r,n,o)});s(hh,"_undefined");xf=h("ZodNull",(e,t)=>{Mc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kl(e,r,n,o)});s(Sf,"_null");zf=h("ZodAny",(e,t)=>{Fc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pl(e,r,n,o)});s(gh,"any");Pf=h("ZodUnknown",(e,t)=>{Vc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Il(e,r,n,o)});s(It,"unknown");If=h("ZodNever",(e,t)=>{Uc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zl(e,r,n,o)});s(ts,"never");Af=h("ZodVoid",(e,t)=>{Bc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sl(e,r,n,o)});s($h,"_void");xn=h("ZodDate",(e,t)=>{Kc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Al(e,r,n,o),e.min=(r,n)=>e.check(ye(r,n)),e.max=(r,n)=>e.check($e(r,n))},S.derived({minDate:s(e=>{let{minimum:t}=H(e);return t?new Date(t):null},"minDate"),maxDate:s(e=>{let{maximum:t}=H(e);return t?new Date(t):null},"maxDate")},{}));s(yh,"date");Of=h("ZodArray",(e,t)=>{Ot(),Jc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fl(e,r,n,o),e.element=t.element},{min(e,t){return this.check(je(e,t))},nonempty(e){return this.check(je(1,e))},max(e,t){return this.check(St(e,t))},length(e,t){return this.check(zt(e,t))},unwrap(){return this.element}});s(Sn,"array");s(bh,"keyof");zn=h("ZodObject",(e,t)=>{Ot(),Wc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vl(e,r,n,o),S.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return rs(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(S.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(S.mergeDefs(this._zod.def,{catchall:It()}))},loose(){return this.clone(S.mergeDefs(this._zod.def,{catchall:It()}))},strict(){return this.clone(S.mergeDefs(this._zod.def,{catchall:ts()}))},strip(){return this.clone(S.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return S.extend(this,e)},safeExtend(e){return S.safeExtend(this,e)},merge(e){return S.merge(this,e)},pick(e){return S.pick(this,e)},omit(e){return S.omit(this,e)},partial(...e){return S.partial(In,this,e[0])},exactPartial(...e){return S.partial(os,this,e[0],"exactPartial")},required(...e){return S.required(is,this,e[0])}});s(wh,"object");s(_h,"strictObject");s(vh,"looseObject");Pn=h("ZodUnion",(e,t)=>{rn.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pi(e,r,n,o),e.options=t.options});s(vr,"union");Cf=h("ZodXor",(e,t)=>{Pn.init(e,t),qc.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pi(e,r,n,o),e.options=t.options});s(kh,"xor");Ef=h("ZodDiscriminatedUnion",(e,t)=>{Pn.init(e,t),Gc.init(e,t)});s(xh,"discriminatedUnion");Tf=h("ZodIntersection",(e,t)=>{Xc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ul(e,r,n,o)});s(Nf,"intersection");Rf=h("ZodTuple",(e,t)=>{Ot(),Mo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bl(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 In({type:"optional",innerType:t}))})}});s(Zf,"tuple");gr=h("ZodRecord",(e,t)=>{Ot(),Yc.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});s(Df,"record");s(Sh,"partialRecord");s(zh,"looseRecord");Lf=h("ZodMap",(e,t)=>{Ot(),Qc.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jl(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(Ge(...r)),e.size=(...r)=>e.check(xt(...r))});s(Ph,"map");jf=h("ZodSet",(e,t)=>{Ot(),eu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ml(e,r,n,o),e.min=(...r)=>e.check(Ne(...r)),e.nonempty=r=>e.check(Ne(1,r)),e.max=(...r)=>e.check(Ge(...r)),e.size=(...r)=>e.check(xt(...r))});s(Ih,"set");$r=h("ZodEnum",(e,t)=>{tu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Ol(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 $r({...t,checks:[],...S.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 $r({...t,checks:[],...S.normalizeParams(o),entries:i})}});s(rs,"_enum");s(Ah,"nativeEnum");Mf=h("ZodLiteral",(e,t)=>{ru.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cl(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(Oh,"literal");Ff=h("ZodFile",(e,t)=>{nu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nl(e,r,n,o),e.min=(r,n)=>e.check(Ne(r,n)),e.max=(r,n)=>e.check(Ge(r,n)),e.mime=(r,n)=>e.check(ar(Array.isArray(r)?r:[r],n))});s(Ch,"file");Vf=h("ZodTransform",(e,t)=>{Ot(),ou.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ll(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new qe(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(S.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(S.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(ns,"transform");In=h("ZodOptional",(e,t)=>{Fo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ii(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(At,"optional");os=h("ZodExactOptional",(e,t)=>{iu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ii(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(Uf,"exactOptional");Bf=h("ZodNullable",(e,t)=>{su.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(vn,"nullable");s(Eh,"nullish");Kf=h("ZodDefault",(e,t)=>{au.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});s(Jf,"_default");Wf=h("ZodPrefault",(e,t)=>{cu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(qf,"prefault");is=h("ZodNonOptional",(e,t)=>{uu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(Hf,"nonoptional");Gf=h("ZodSuccess",(e,t)=>{lu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(Th,"success");Xf=h("ZodCatch",(e,t)=>{fu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});s(Yf,"_catch");Qf=h("ZodNaN",(e,t)=>{pu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>El(e,r,n,o)});s(Nh,"nan");An=h("ZodPipe",(e,t)=>{Vo.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yl(e,r,n,o),e.in=t.in,e.out=t.out});s(Ri,"pipe");On=h("ZodCodec",(e,t)=>{An.init(e,t),nn.init(e,t)});s(Rh,"codec");s(Zh,"invertCodec");ep=h("ZodPreprocess",(e,t)=>{An.init(e,t),du.init(e,t)}),tp=h("ZodReadonly",(e,t)=>{mu.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(rp,"readonly");np=h("ZodTemplateLiteral",(e,t)=>{hu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tl(e,r,n,o)});s(Dh,"templateLiteral");op=h("ZodLazy",(e,t)=>{on.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>tf(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});s(ip,"lazy");sp=h("ZodPromise",(e,t)=>{$u.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ef(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});s(Lh,"promise");ap=h("ZodFunction",(e,t)=>{gu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dl(e,r,n,o)});s(jh,"_function");Cn=h("ZodCustom",(e,t)=>{yu.init(e,t),T.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zl(e,r,n,o)});s(Mh,"check");s(Fh,"custom");s(cp,"refine");s(up,"superRefine");Vh=fl,Uh=pl,lp=h("ZodInstanceOf",(e,t)=>{Cn.init(e,t)},{properties(e,t){return this.check(sr(e,t))}});s(Bh,"_instanceof");Kh=s((...e)=>dl({Codec:On,Boolean:wr,String:yr},...e),"stringbool");s(Jh,"json");s(Wh,"preprocess")});function tv(e){J({customError:e})}function rv(){return J().customError}var ev,fp,qh=z(()=>{be();ev={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(tv,"setErrorMap");s(rv,"getErrorMap");fp||(fp={})});var En={};ge(En,{ZodISODate:()=>tt,ZodISODateTime:()=>et,ZodISODuration:()=>nt,ZodISOTime:()=>rt,date:()=>ov,datetime:()=>nv,duration:()=>sv,time:()=>iv});function nv(e){return dn(et,e)}function ov(e){return mn(tt,e)}function iv(e){return hn(rt,e)}function sv(e){return gn(nt,e)}var ss=z(()=>{be();ot();ot();s(nv,"datetime");s(ov,"date");s(iv,"time");s(sv,"duration")});function cv(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 Hh(e,t){return e.map((r,n)=>n<t?r:r.optional())}function uv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function lv(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:uv(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 fv(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 pp(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=pp(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=pp(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 Tn(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Tn):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>pv.has(t)?Tn(r):!dv.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(Tn))}function Gh(e){return e===1?"element":"elements"}function mv(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=pp(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 ${Gh(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 ${Gh(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function Xh(e,t){if(e!==!1)return e===void 0||e===!0?_.any():ae(e,t)}function Yh(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=lv(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 Yh(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(hv)):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,d]of Object.entries(i)){let m=ae(d,t);Y(o,p,a.has(p)?m:m.optional())}if(e.patternProperties){let p=e.patternProperties,d=Object.keys(p),m=[];for(let y of d){let b=ae(p[y],t),x=_.string().regex(new RegExp(y));m.push(_.looseRecord(x,b))}let g=[];if(Object.keys(o).length>0&&g.push(_.object(o).passthrough()),g.push(...m),g.length===0)n=_.object({}).passthrough();else if(g.length===1)n=g[0];else{let y=_.intersection(g[0],g[1]);for(let b=2;b<g.length;b++)y=_.intersection(y,g[b]);n=y}if(e.additionalProperties===!1){let y=Object.keys(o),b=d.map(k=>new RegExp(k)),x=n;n=n.check(k=>{if(!ke(k.value))return;let O=[];for(let Z of Object.keys(k.value))y.includes(Z)||b.some(L=>L.test(Z))||O.push(Z);O.length&&k.issues.push({code:"unrecognized_keys",keys:O,input:k.value,inst:x})})}}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 d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;p=ae(d,t)}n=fv(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=Hh(c,a),l=Array.isArray(i)?void 0:Xh(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=Hh(c,a),l=Xh(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=mv(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=Yh(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&&!Tn(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&&!Tn(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))av.has(c)||Y(o,c,e[c]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}function Qh(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=cv(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Q};return ae(r,i)}var _,av,pv,dv,hv,eg=z(()=>{fn();W();Ei();ss();ot();_={...kr,...Ci,iso:En},av=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(cv,"detectVersion");s(Hh,"applyMinItems");s(uv,"decodeJSONPointerSegment");s(lv,"resolveRef");s(fv,"checkObjectGuards");s(pp,"canonicalKey");pv=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),dv=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);s(Tn,"containsRef");s(Gh,"plural");s(mv,"checkArrayGuards");s(Xh,"getTupleRest");hv=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;s(Yh,"convertBaseSchema");s(ae,"convertSchema");s(Qh,"fromJSONSchema")});function Nn(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===tg)return new on({type:"lazy",getter:s(()=>n.get(a),"getter")});if(c!==void 0)return c;n.set(a,tg);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,d={};for(let g of f){let y=o(l[g]);y!==l[g]&&(p=!0),d[g]=y}let m=c.catchall;return c.catchall&&(m=o(c.catchall),m!==c.catchall&&(p=!0)),p?j(a,{...c,shape:d,catchall:m}):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 m of l){let g=o(m);g!==m&&(f=!0),p.push(g)}let d=c.rest;return c.rest&&(d=o(c.rest),d!==c.rest&&(f=!0)),f?j(a,{...c,items:p,rest:d}):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 d of l){let m=o(d);m!==d&&(f=!0),p.push(m)}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 tg,dp=z(()=>{Xt();W();tg=Symbol("z.visit/resolving");s(Nn,"visit")});function rg(e){return Nn(e,{object:s(t=>t.partial(),"object"),union:s(t=>{let r=t._zod.def;return r.discriminator===void 0?t:vr(r.options)},"union")})}var ng=z(()=>{dp();ot();s(rg,"deepPartial")});function gv(e,t){if(!t?.length)return e;let r=e._zod.def;return j(e,ze(r,{checks:[...r.checks??[],...t]}),{parent:!0})}function og(e){return gv(e.out,e.checks)}function $v(e){return e.in._zod.traits.has("$ZodTransform")?og(e):e.in}function ig(e){return Nn(e,{pipe:s(t=>$v(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 sg(e){return Nn(e,{pipe:s(t=>og(t._zod.def),"pipe"),prefault:s((t,r)=>r?t._zod.def.innerType:t,"prefault")})}var ag=z(()=>{W();dp();ot();s(gv,"withChecks");s(og,"outSide");s($v,"inSide");s(ig,"input");s(sg,"output")});var mp={};ge(mp,{bigint:()=>_v,boolean:()=>wv,date:()=>vv,number:()=>bv,string:()=>yv});function yv(e){return Eu(yr,e)}function bv(e){return Lu(br,e)}function wv(e){return Ku(wr,e)}function _v(e){return Wu(_r,e)}function vv(e){return ol(xn,e)}var cg=z(()=>{be();ot();s(yv,"string");s(bv,"number");s(wv,"boolean");s(_v,"bigint");s(vv,"date")});var $={};ge($,{$brand:()=>qs,$input:()=>Su,$output:()=>xu,INVALID:()=>ie,NEVER:()=>Ws,TimePrecision:()=>Zu,ZodAny:()=>zf,ZodArray:()=>Of,ZodBase64:()=>Gi,ZodBase64URL:()=>Xi,ZodBigInt:()=>_r,ZodBigIntFormat:()=>es,ZodBoolean:()=>wr,ZodCIDRv4:()=>qi,ZodCIDRv6:()=>Hi,ZodCUID:()=>Fi,ZodCUID2:()=>Vi,ZodCatch:()=>Xf,ZodCodec:()=>On,ZodCompileAsyncError:()=>Pe,ZodCompileUnsupportedError:()=>R,ZodCreditCard:()=>yf,ZodCustom:()=>Cn,ZodCustomStringFormat:()=>Ct,ZodDate:()=>xn,ZodDefault:()=>Kf,ZodDiscriminatedUnion:()=>Ef,ZodE164:()=>Yi,ZodEmail:()=>Di,ZodEmoji:()=>ji,ZodEnum:()=>$r,ZodError:()=>X_,ZodExactOptional:()=>os,ZodFile:()=>Ff,ZodFirstPartyTypeKind:()=>fp,ZodFunction:()=>ap,ZodGUID:()=>Li,ZodIBAN:()=>bf,ZodIPv4:()=>Ji,ZodIPv6:()=>Wi,ZodISODate:()=>tt,ZodISODateTime:()=>et,ZodISODuration:()=>nt,ZodISOTime:()=>rt,ZodInstanceOf:()=>lp,ZodIntersection:()=>Tf,ZodIssueCode:()=>ev,ZodJWT:()=>Qi,ZodKSUID:()=>Ki,ZodLazy:()=>op,ZodLiteral:()=>Mf,ZodMAC:()=>$f,ZodMap:()=>Lf,ZodNaN:()=>Qf,ZodNanoID:()=>Mi,ZodNever:()=>If,ZodNonOptional:()=>is,ZodNull:()=>xf,ZodNullable:()=>Bf,ZodNumber:()=>br,ZodNumberFormat:()=>Et,ZodObject:()=>zn,ZodOptional:()=>In,ZodPipe:()=>An,ZodPrefault:()=>Wf,ZodPreprocess:()=>ep,ZodPromise:()=>sp,ZodReadonly:()=>tp,ZodRealError:()=>me,ZodRecord:()=>gr,ZodSet:()=>jf,ZodString:()=>yr,ZodStringFormat:()=>V,ZodSuccess:()=>Gf,ZodSymbol:()=>vf,ZodTemplateLiteral:()=>np,ZodTransform:()=>Vf,ZodTuple:()=>Rf,ZodType:()=>T,ZodULID:()=>Ui,ZodURL:()=>kn,ZodUUID:()=>Re,ZodUndefined:()=>kf,ZodUnion:()=>Pn,ZodUnknown:()=>Pf,ZodVoid:()=>Af,ZodXID:()=>Bi,ZodXor:()=>Cf,_ZodString:()=>Zi,_default:()=>Jf,_function:()=>jh,any:()=>gh,array:()=>Sn,base64:()=>Gm,base64url:()=>Xm,bigint:()=>fh,boolean:()=>_f,catch:()=>Yf,check:()=>Mh,cidrv4:()=>qm,cidrv6:()=>Hm,clone:()=>j,codec:()=>Rh,coerce:()=>mp,compile:()=>Au,config:()=>J,core:()=>Me,creditCard:()=>Qm,cuid:()=>Mm,cuid2:()=>Fm,currencyCode:()=>ih,custom:()=>Fh,date:()=>yh,decode:()=>uf,decodeAsync:()=>ff,deepPartial:()=>rg,describe:()=>Vh,discriminatedUnion:()=>xh,e164:()=>Ym,email:()=>Om,emoji:()=>Lm,encode:()=>cf,encodeAsync:()=>lf,endsWith:()=>ir,enum:()=>rs,exactOptional:()=>Uf,file:()=>Ch,flattenError:()=>Vr,float32:()=>ah,float64:()=>ch,formatError:()=>Ur,fromJSONSchema:()=>Qh,function:()=>jh,getDiscriminatedOption:()=>Hc,getErrorMap:()=>rv,globalRegistry:()=>Q,gt:()=>Te,gte:()=>ye,guid:()=>Cm,hash:()=>sh,hex:()=>oh,hostname:()=>nh,httpUrl:()=>Dm,iban:()=>eh,includes:()=>nr,input:()=>ig,instanceof:()=>Bh,int:()=>Ni,int32:()=>uh,int64:()=>ph,intersection:()=>Nf,invertCodec:()=>Zh,ipv4:()=>Km,ipv6:()=>Wm,iso:()=>En,json:()=>Jh,jwt:()=>th,keyof:()=>bh,ksuid:()=>Bm,lazy:()=>ip,length:()=>zt,literal:()=>Oh,locales:()=>ln,looseObject:()=>vh,looseRecord:()=>zh,lowercase:()=>tr,lt:()=>Ee,lte:()=>$e,mac:()=>Jm,map:()=>Ph,maxLength:()=>St,maxSize:()=>Ge,memoizer:()=>cn,meta:()=>Uh,mime:()=>ar,minLength:()=>je,minSize:()=>Ne,multipleOf:()=>He,nan:()=>Nh,nanoid:()=>jm,nativeEnum:()=>Ah,negative:()=>vi,never:()=>ts,nonnegative:()=>xi,nonoptional:()=>Hf,nonpositive:()=>ki,normalize:()=>cr,null:()=>Sf,nullable:()=>vn,nullish:()=>Eh,number:()=>wf,object:()=>wh,optional:()=>At,output:()=>sg,overwrite:()=>Ie,parse:()=>nf,parseAsync:()=>of,partialRecord:()=>Sh,pipe:()=>Ri,positive:()=>_i,prefault:()=>qf,preprocess:()=>Wh,prettifyError:()=>Qs,promise:()=>Lh,properties:()=>sr,property:()=>Si,readonly:()=>rp,record:()=>Df,refine:()=>cp,regex:()=>er,regexes:()=>Se,registry:()=>Go,safeDecode:()=>df,safeDecodeAsync:()=>hf,safeEncode:()=>pf,safeEncodeAsync:()=>mf,safeParse:()=>sf,safeParseAsync:()=>af,set:()=>Ih,setErrorMap:()=>tv,size:()=>xt,slugify:()=>pr,startsWith:()=>or,strictObject:()=>_h,string:()=>_n,stringFormat:()=>rh,stringbool:()=>Kh,success:()=>Th,superRefine:()=>up,symbol:()=>mh,templateLiteral:()=>Dh,toJSONSchema:()=>Ai,toLowerCase:()=>lr,toUpperCase:()=>fr,toZod:()=>Tr,transform:()=>ns,treeifyError:()=>Ys,trim:()=>ur,tuple:()=>Zf,uint32:()=>lh,uint64:()=>dh,ulid:()=>Vm,undefined:()=>hh,union:()=>vr,unknown:()=>It,uppercase:()=>rr,url:()=>Zm,util:()=>S,uuid:()=>Em,uuidv4:()=>Tm,uuidv6:()=>Nm,uuidv7:()=>Rm,validate:()=>Br,validateAsync:()=>Kr,void:()=>$h,withParser:()=>Xo,xid:()=>Um,xor:()=>kh});var hp=z(()=>{be();ot();Ei();rf();gf();qh();be();wn();eg();ng();ag();ku();ss();ss();cg()});var it=z(()=>{hp();hp()});var dg=he((hz,pg)=>{pg.exports=fg;fg.sync=xv;var ug=Be("fs");function kv(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(kv,"checkPathExt");function lg(e,t,r){return!e.isSymbolicLink()&&!e.isFile()?!1:kv(t,r)}s(lg,"checkStat");function fg(e,t,r){ug.stat(e,function(n,o){r(n,n?!1:lg(o,e,t))})}s(fg,"isexe");function xv(e,t){return lg(ug.statSync(e),e,t)}s(xv,"sync")});var yg=he(($z,$g)=>{$g.exports=hg;hg.sync=Sv;var mg=Be("fs");function hg(e,t,r){mg.stat(e,function(n,o){r(n,n?!1:gg(o,t))})}s(hg,"isexe");function Sv(e,t){return gg(mg.statSync(e),t)}s(Sv,"sync");function gg(e,t){return e.isFile()&&zv(e,t)}s(gg,"checkStat");function zv(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(zv,"checkMode")});var wg=he((wz,bg)=>{var bz=Be("fs"),as;process.platform==="win32"||global.TESTING_WINDOWS?as=dg():as=yg();bg.exports=gp;gp.sync=Pv;function gp(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){gp(e,t||{},function(i,a){i?o(i):n(a)})})}as(e,t||{},function(n,o){n&&(n.code==="EACCES"||t&&t.ignoreErrors)&&(n=null,o=!1),r(n,o)})}s(gp,"isexe");function Pv(e,t){try{return as.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;throw r}}s(Pv,"sync")});var Pg=he((vz,zg)=>{var xr=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",_g=Be("path"),Iv=xr?";":":",vg=wg(),kg=s(e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),"getNotFoundError"),xg=s((e,t)=>{let r=t.colon||Iv,n=e.match(/\//)||xr&&e.match(/\\/)?[""]:[...xr?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],o=xr?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=xr?o.split(r):[""];return xr&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:n,pathExt:i,pathExtExe:o}},"getPathInfo"),Sg=s((e,t,r)=>{typeof t=="function"&&(r=t,t={}),t||(t={});let{pathEnv:n,pathExt:o,pathExtExe:i}=xg(e,t),a=[],c=s(l=>new Promise((f,p)=>{if(l===n.length)return t.all&&a.length?f(a):p(kg(e));let d=n[l],m=/^".*"$/.test(d)?d.slice(1,-1):d,g=_g.join(m,e),y=!m&&/^\.[\\\/]/.test(e)?e.slice(0,2)+g:g;f(u(y,l,0))}),"step"),u=s((l,f,p)=>new Promise((d,m)=>{if(p===o.length)return d(c(f+1));let g=o[p];vg(l+g,{pathExt:i},(y,b)=>{if(!y&&b)if(t.all)a.push(l+g);else return d(l+g);return d(u(l,f,p+1))})}),"subStep");return r?c(0).then(l=>r(null,l),r):c(0)},"which"),Av=s((e,t)=>{t=t||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=xg(e,t),i=[];for(let a=0;a<r.length;a++){let c=r[a],u=/^".*"$/.test(c)?c.slice(1,-1):c,l=_g.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let p=0;p<n.length;p++){let d=f+n[p];try{if(vg.sync(d,{pathExt:o}))if(t.all)i.push(d);else return d}catch{}}}if(t.all&&i.length)return i;if(t.nothrow)return null;throw kg(e)},"whichSync");zg.exports=Sg;Sg.sync=Av});var Ag=he((xz,$p)=>{"use strict";var Ig=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");$p.exports=Ig;$p.exports.default=Ig});var Tg=he((zz,Eg)=>{"use strict";var Og=Be("path"),Ov=Pg(),Cv=Ag();function Cg(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=Ov.sync(e.command,{path:r[Cv({env:r})],pathExt:t?Og.delimiter:void 0})}catch{}finally{i&&process.chdir(n)}return a&&(a=Og.resolve(o?e.options.cwd:"",a)),a}s(Cg,"resolveCommandAttempt");function Ev(e){return Cg(e)||Cg(e,!0)}s(Ev,"resolveCommand");Eg.exports=Ev});var Ng=he((Iz,bp)=>{"use strict";var yp=/([()\][%!^"`<>&|;, *?])/g;function Tv(e){return e=e.replace(yp,"^$1"),e}s(Tv,"escapeCommand");function Nv(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(yp,"^$1"),t&&(e=e.replace(yp,"^$1")),e}s(Nv,"escapeArgument");bp.exports.command=Tv;bp.exports.argument=Nv});var Zg=he((Oz,Rg)=>{"use strict";Rg.exports=/^#!(.*)/});var Lg=he((Cz,Dg)=>{"use strict";var Rv=Zg();Dg.exports=(e="")=>{let t=e.match(Rv);if(!t)return null;let[r,n]=t[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var Mg=he((Ez,jg)=>{"use strict";var wp=Be("fs"),Zv=Lg();function Dv(e){let r=Buffer.alloc(150),n;try{n=wp.openSync(e,"r"),wp.readSync(n,r,0,150,0),wp.closeSync(n)}catch{}return Zv(r.toString())}s(Dv,"readShebang");jg.exports=Dv});var Bg=he((Nz,Ug)=>{"use strict";var Lv=Be("path"),Fg=Tg(),Vg=Ng(),jv=Mg(),Mv=process.platform==="win32",Fv=/\.(?:com|exe)$/i,Vv=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Uv(e){e.file=Fg(e);let t=e.file&&jv(e.file);return t?(e.args.unshift(e.file),e.command=t,Fg(e)):e.file}s(Uv,"detectShebang");function Bv(e){if(!Mv)return e;let t=Uv(e),r=!Fv.test(t);if(e.options.forceShell||r){let n=Vv.test(t);e.command=Lv.normalize(e.command),e.command=Vg.command(e.command),e.args=e.args.map(i=>Vg.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(Bv,"parseNonShell");function Kv(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:Bv(n)}s(Kv,"parse");Ug.exports=Kv});var Wg=he((Zz,Jg)=>{"use strict";var _p=process.platform==="win32";function vp(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(vp,"notFoundError");function Jv(e,t){if(!_p)return;let r=e.emit;e.emit=function(n,o){if(n==="exit"){let i=Kg(o,t);if(i)return r.call(e,"error",i)}return r.apply(e,arguments)}}s(Jv,"hookChildProcess");function Kg(e,t){return _p&&e===1&&!t.file?vp(t.original,"spawn"):null}s(Kg,"verifyENOENT");function Wv(e,t){return _p&&e===1&&!t.file?vp(t.original,"spawnSync"):null}s(Wv,"verifyENOENTSync");Jg.exports={hookChildProcess:Jv,verifyENOENT:Kg,verifyENOENTSync:Wv,notFoundError:vp}});var Gg=he((Lz,Sr)=>{"use strict";var qg=Be("child_process"),kp=Bg(),xp=Wg();function Hg(e,t,r){let n=kp(e,t,r),o=qg.spawn(n.command,n.args,n.options);return xp.hookChildProcess(o,n),o}s(Hg,"spawn");function qv(e,t,r){let n=kp(e,t,r),o=qg.spawnSync(n.command,n.args,n.options);return o.error=o.error||xp.verifyENOENTSync(o.status,n),o}s(qv,"spawnSync");Sr.exports=Hg;Sr.exports.spawn=Hg;Sr.exports.sync=qv;Sr.exports._parse=kp;Sr.exports._enoent=xp});import{statSync as Dk}from"node:fs";function us(e){try{return Dk(e),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ENOENT")return!1;throw t}}var b$=z(()=>{"use strict";s(us,"filePresent")});function Lk(e,t){let r=e.slice(0,t).split(/\r?\n/);return[r.length,r.pop().length+1]}function jk(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
69
|
`,a===t&&(o+=" ".repeat(i+r+2),o+=`^
|
|
70
70
|
`))}return o}var C,Tt=z(()=>{s(Lk,"getLineColFromPtr");s(jk,"makeCodeBlock");C=class e extends Error{static{s(this,"TomlError")}line;column;codeblock;constructor(t,r){let[n,o]=Lk(r.toml,r.ptr),i=jk(r.toml,n,o);super(`Invalid TOML document: ${t}
|
|
71
71
|
|
|
72
72
|
${i}`,r),this.line=n,this.column=o,this.codeblock=i}static x(t,r,n){throw new e(t,{toml:r.s,ptr:n??r.p})}}});function ls(e){let t=e.p,r=e.s.charCodeAt(e.p++),n=r,o=r===39,i=r===e.s.charCodeAt(e.p)&&r===e.s.charCodeAt(e.p+1);i&&((r=e.s.charCodeAt(e.p+=2))===10?e.p++:r===13&&e.s.charCodeAt(e.p+1)===10&&(e.p+=2));let a="",c=e.p,u=0;for(;e.p<e.s.length;e.p++)if(r=e.s.charCodeAt(e.p),i&&(r===10||r===13&&e.s.charCodeAt(e.p+1)===10))u=u&&3;else if(r<32&&r!==9||r===127)C.x("control characters are not allowed in strings",e);else if((!u||u===3)&&r===n&&(!i||e.s.charCodeAt(e.p+1)===n&&e.s.charCodeAt(e.p+2)===n)){if(i&&(e.s.charCodeAt(e.p+3)===n&&e.p++,e.s.charCodeAt(e.p+3)===n&&e.p++),!u){let l=e.s.slice(c,e.p);a=a?a+l:l}return e.p+=i?3:1,a}else if(!u)!o&&r===92&&(a+=e.s.slice(c,c=e.p),u=1);else if(u===1)if(r===120||r===117||r===85){let l=e.p++-1,f=0,p=r===120?2:r===117?4:8;for(let d=0;d<p;d++,e.p++){let m=e.s.charCodeAt(e.p),g=m>=48&&m<=57?m-48:m>=65&&m<=70?m-65+10:m>=97&&m<=102?m-97+10:-1;g<0&&C.x("invalid non-hex character in unicode escape",e),f=f<<4|g}(f<0||f>1114111||f>=55296&&f<=57343)&&C.x("invalid unicode escape",e,l),a+=String.fromCodePoint(f),c=e.p--,u=0}else i&&(r===32||r===9)?u=2:(r===98?a+="\b":r===116?a+=" ":r===110?a+=`
|
|
73
|
-
`:r===102?a+="\f":r===114?a+="\r":r===101?a+="\x1B":r===34?a+='"':r===92?a+="\\":C.x("unrecognised escape sequence",e),c=e.p+1,u=0);else r!==32&&r!==9&&(u===2&&C.x("invalid escape: only line-ending whitespace may be escaped",e,c),u=!o&&r===92?1:0,c=e.p);C.x("unfinished string",e,t)}var Ip=z(()=>{Tt();s(ls,"parseString")});var Mk,Rn,Ap=z(()=>{Mk=/^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i,Rn=class e extends Date{static{s(this,"TomlDate")}#t=!1;#r=!1;#e=null;constructor(t,r,n){let o=!0,i=!0,a="Z",c;if(typeof t=="string")if(r)e:{if(r<3){if(+t.slice(11,13)>23){t="";break e}r===2?(a=null,t+="Z"):(c=t.charCodeAt(t.length-1))!==90&&c!==122&&(a=t.slice(t.length-6)),n&&(t=t.slice(0,10)+"T"+t.slice(11))}else r===4&&(t=+t.slice(0,2)>23?"":`0000-01-01T${t}Z`);o=r!==4,i=r!==3}else{let u=t.match(Mk);u?(u[1]||(o=!1,t=`0000-01-01T${t}`),i=!!u[2],i&&t[10]===" "&&(t=t.replace(" ","T")),u[2]&&+u[2]>23?t="":(a=u[3]||null,!a&&i&&(t+="Z"))):t=""}super(t),isNaN(this.getTime())||(this.#t=o,this.#r=i,this.#e=a)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z"||this.#e==="z")return t;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(t,r="Z"){let n=new e(t);return n.#e=r,n}static wrapAsLocalDateTime(t){let r=new e(t);return r.#e=null,r}static wrapAsLocalDate(t){let r=new e(t);return r.#r=!1,r.#e=null,r}static wrapAsLocalTime(t){let r=new e(t);return r.#t=!1,r.#e=null,r}}});function we(e,t=10){return t===16?e>47&&e<58||e>64&&e<71||e>96&&e<103:e>47&&e<48+t}function Cp(e,t){return e===32||e===9||e===10||e===13||t&&(e===t||e===44)||e===35}function Dn(e,t){let r=e.p,n=e.s.charCodeAt(e.p);if(n===91||n===123){e.d--||C.x("document contains excessively nested structures. aborting.",e);let o=n===91?v$(e):_$(e);return e.d++,o}return n===34||n===39?ls(e):n===116?((e.s.charCodeAt(++e.p)!==114||e.s.charCodeAt(++e.p)!==117||e.s.charCodeAt(++e.p)!==101)&&C.x("invalid value",e,r),e.p++,!0):n===102?((e.s.charCodeAt(++e.p)!==97||e.s.charCodeAt(++e.p)!==108||e.s.charCodeAt(++e.p)!==115||e.s.charCodeAt(++e.p)!==101)&&C.x("invalid value",e,r),e.p++,!1):n===43||n===45?fs(e,e.p,e.s.charCodeAt(++e.p),44-n,t):e.s.charCodeAt(e.p+4)===45&&e.s.charCodeAt(e.p+7)===45?Fk(e,n,t):e.s.charCodeAt(e.p+2)===58?Vk(e,n,t):fs(e,e.p,n,0,t)}function fs(e,t,r,n,o){let i=r,a=0,c=!1;if(i===105)return(e.s.charCodeAt(++e.p)!==110||e.s.charCodeAt(++e.p)!==102)&&C.x("invalid value",e,t),e.p++,(n||1)/0;if(i===110)return(e.s.charCodeAt(++e.p)!==97||e.s.charCodeAt(++e.p)!==110)&&C.x("invalid value",e,t),e.p++,NaN;if(i===48){if(++e.p>=e.s.length||Cp(i=e.s.charCodeAt(e.p),o))return e.bi===!0?0n:0;if(!n){if(i===120)return Op(e,t,16,o);if(i===98)return Op(e,t,2,o);if(i===111)return Op(e,t,8,o)}i===46?a=2:i===101||i===69?a=4:C.x("illegal leading zero",e,t)}else we(i)||C.x("invalid value",e,t);for(;++e.p<e.s.length&&(i=e.s.charCodeAt(e.p),!Cp(i,o));)a||(a=1),i===95?(a&1||C.x("illegal underscore",e),a+=11,c=!0):a===1&&i===46?a=2:(a===1||a===3)&&(i===101||i===69)?a=4:a===4&&(i===43||i===45)?a=6:we(i)?a>9?a-=11:a&1||a++:C.x("illegal character in numeric literal",e);if(!a){let l=(r-48)*(n||1);return e.bi===!0?BigInt(l):l}a&1||C.x("unfinished numeric value",e,t);let u=e.s.slice(t,e.p);return c&&(u=u.replaceAll("_","")),a>1?parseFloat(u):w$(e,u,10,t)}function Op(e,t,r,n){let o,i=1;for(;++e.p<e.s.length&&(o=e.s.charCodeAt(e.p),!Cp(o,n));)o===95?(i&1&&C.x("illegal underscore",e),i=3):we(o,r)?i&1&&i--:C.x("illegal character in numeric literal",e);i&1&&C.x("unfinished numeric value",e);let a=e.s.slice(t+2,e.p);return i&&(a=a.replaceAll("_","")),w$(e,a,r,t)}function w$(e,t,r,n){if(e.bi!==!0)e:{let o=parseInt(t,r);if(!Number.isSafeInteger(o)){if(e.bi)break e;C.x("integer value cannot be represented losslessly",e,n)}return o}return BigInt(r===10?t:(r===2?"0b":r===8?"0o":"0x")+t)}function Fk(e,t,r){let n=e.p++,o;if(!we(t)||!we(e.s.charCodeAt(e.p++))||!we(e.s.charCodeAt(e.p++))||!we(e.s.charCodeAt(e.p++)))return fs(e,e.p=n,t,0,r);if(e.p+=5,we(e.s.charCodeAt(e.p++))||C.x("invalid date-time: date part is malformed",e,n),e.p>=e.s.length||((t=e.s.charCodeAt(e.p))!==32||(o=!0,!we(e.s.charCodeAt(e.p+1))))&&t!==84&&t!==116){let a=e.s.slice(n,e.p);return Zn(e,a,3,!1,n)}if(e.s.charCodeAt(e.p+=3)!==58&&C.x("invalid date-time: time part is malformed",e,n),e.s.charCodeAt(e.p+=3)===58&&(e.p+=3),e.s.charCodeAt(e.p)===46)for(;we(e.s.charCodeAt(++e.p)););if(t=e.s.charCodeAt(e.p)){if(t===90||t===122){let a=e.s.slice(n,++e.p);return Zn(e,a,1,o,n,"[+00:00]")}if(t===43||t===45){let a=e.s.slice(n,e.p+=6);return Zn(e,a,1,o,n,!e.ld&&"["+e.s.slice(e.p-6,e.p)+"]")}}let i=e.s.slice(n,e.p);return Zn(e,i,2,o,n)}function Vk(e,t,r){let n=e.p;if(!we(t)||!we(e.s.charCodeAt(++e.p)))return fs(e,--e.p,t,0,r);if(e.s.charCodeAt(e.p+=4)===58&&(e.p+=3),e.s.charCodeAt(e.p)===46)for(;we(e.s.charCodeAt(++e.p)););let o=e.s.slice(n,e.p);return Zn(e,o,4,!1,n)}function Zn(e,t,r,n,o,i){if(e.ld){let a=new Rn(t,r,n);return a.isValid()||C.x("invalid date",e,o),a}try{switch(i&&(t+=i),r){case 1:return Temporal.ZonedDateTime.from(t);case 2:return Temporal.PlainDateTime.from(t);case 3:return Temporal.PlainDate.from(t);case 4:return Temporal.PlainTime.from(t)}}catch(a){C.x(a instanceof Error?a.message:""+a,e,o)}}var Ep=z(()=>{Ip();Tp();Tt();Ap();s(we,"isDigit");s(Cp,"isEndOfValue");s(Dn,"extractValue");s(fs,"parseNumber");s(Op,"parseIntegerBaseN");s(w$,"parseInteger");s(Fk,"parseDate");s(Vk,"parseTime");s(Zn,"readDate")});function Uk(e){for(;e.p<e.s.length;e.p++){let t=e.s.charCodeAt(e.p);if(t===10)break;if(t===13&&e.s.charCodeAt(e.p+1)===10){e.p++;break}(t<32&&t!==9||t===127)&&C.x("control characters are not allowed in comments",e)}}function Ae(e,t,r){let n;for(;e.p<e.s.length;){for(;e.p<e.s.length&&((n=e.s.charCodeAt(e.p))===32||n===9||!t&&(n===10||n===13&&e.s.charCodeAt(e.p+1)===10));)e.p++;if(r||n!==35)break;Uk(e)}}var Np=z(()=>{Tt();s(Uk,"skipComment");s(Ae,"skipVoid")});function ps(e,t=61){let r,n=0,o=[],i,a=e.s.charCodeAt(r=e.p);do{if(a===t)return n||C.x("unexpected end of key",e),n===1&&o.push(e.s.slice(i,e.p)),e.p++,o;a===46?(n||C.x("illegal empty bare key",e),n===1&&o.push(e.s.slice(i,e.p)),n=0):!n&&(a===34||a===39)?(a===e.s.charCodeAt(e.p+1)&&a===e.s.charCodeAt(e.p+2)&&C.x("illegal quoted key: multiline strings are not allowed",e),o.push(ls(e)),n=2,e.p--):a===32||a===9?n===1&&(o.push(e.s.slice(i,e.p)),n=2):n===2||a<48&&a!==45||a>57&&a<65||a>90&&a<97&&a!==95||a>122?C.x("illegal character in key",e):n||(n=1,i=e.p)}while(a=e.s.charCodeAt(++e.p));C.x("incomplete key-value: cannot find end of key",e,r)}function _$(e){let t=e.p++,r=Object.create(null),n=new Set,o;for(;e.p<e.s.length;){if(Ae(e),(o=e.s.charCodeAt(e.p))===125)return e.p++,r;let i,a=r,c=!1,u=e.p,l=ps(e);for(let p=0;p<l.length;p++){p&&(a=c?a[i]:a[i]=Object.create(null)),i=l[p],(c=Object.hasOwn(a,i))&&(typeof a[i]!="object"||n.has(a[i]))&&C.x("trying to redefine an already defined value",e,u);let d=i==="__proto__";if(e.uk&&(d||i==="constructor")){a=e.uk!==1&&C.x("document contains an unsafe property",e,u);break}!c&&d&&Object.defineProperty(a,i,{enumerable:!0,configurable:!0,writable:!0})}c&&C.x("trying to redefine an already defined value",e,u),Ae(e,!0,!0);let f=Dn(e,125);if(a&&typeof(a[i]=f)=="object"&&n.add(f),Ae(e),(o=e.s.charCodeAt(e.p++))===125)return r;o!==44&&C.x("expected comma or end of structure",e,e.p-1)}C.x("unfinished table",e,t)}function v$(e){let t=e.p++,r=[],n;for(;e.p<e.s.length;){if(Ae(e),(n=e.s.charCodeAt(e.p))===93)return e.p++,r;if(r.push(Dn(e,93)),Ae(e),(n=e.s.charCodeAt(e.p++))===93)return r;n!==44&&C.x("expected comma or end of structure",e,e.p-1)}C.x("unfinished array",e,t)}var Tp=z(()=>{Ip();Ep();Np();Tt();s(ps,"parseKey");s(_$,"parseInlineTable");s(v$,"parseArray")});function k$(e,t,r,n,o){let i=r,a=n,c,u=!1,l;for(let f=0;f<t.length;f++){if(f){if(i=u?i[c]:i[c]=Object.create(null),a=(l=a[c]).c,o===0&&(l.t===1||l.t===2))return null;if(l.t===2){let p=i.length-1;i=i[p],a=a[p].c}}if(c=t[f],(u=Object.hasOwn(i,c))&&a[c]?.t===0&&a[c]?.d)return null;if(!u){let p=c==="__proto__";if(e.uk&&(p||c==="constructor"))return!1;p&&(Object.defineProperty(i,c,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,c,{enumerable:!0,configurable:!0,writable:!0})),a[c]={t:f<t.length-1&&o===2?3:o,d:!1,i:0,c:Object.create(null)}}}if(l=a[c],l.t!==o&&!(o===1&&l.t===3)||(o===2&&(l.d||(l.d=!0,i[c]=[]),i[c].push(i=Object.create(null)),l.c[l.i++]=l={t:1,d:!1,i:0,c:Object.create(null)}),l.d))return null;if(l.d=!0,o===1)i=u?i[c]:i[c]=Object.create(null);else if(o===0&&u)return null;return[c,i,l.c]}function x$(e,t,r){(t===null||e.uk===2)&&C.x(t===null?"trying to redefine an already defined table or value":"document contains an unsafe property",e,r)}function Rp(e,t={}){let r={s:e,p:0,d:t.maxDepth??1e3,bi:t.integersAsBigInt??!1,ld:t.useLegacyDate??!0,uk:t.unsafeKeyBehaviour==="throw"?2:t.unsafeKeyBehaviour==="drop"?1:0},n=Object.create(null),o=Object.create(null),i,a=!1,c=n,u=o;for(e.charCodeAt(0)===65279&&r.p++,Ae(r);r.p<e.length;){if(e.charCodeAt(r.p)===91){let l=e.charCodeAt(++r.p)===91;i=r.p+=+l,a=!1;let f=ps(r,93);l&&(e.charCodeAt(r.p)!==93&&C.x("expected end of table array declaration",r),r.p++);let p=k$(r,f,n,o,l?2:1);p?(u=p[2],c=p[1]):(x$(r,p,i),a=!0)}else{i=r.p;let l=ps(r),f=k$(r,l,c,u,0);!f&&!a&&x$(r,f,i),Ae(r,!0,!0);let p=Dn(r,void 0);f&&!a&&(f[1][f[0]]=p)}Ae(r,!0),r.p<e.length&&(i=e.charCodeAt(r.p))!==10&&(i!==13||e.charCodeAt(r.p+1)!==10)&&C.x("each key-value declaration must be followed by an end-of-line",r),Ae(r)}return n}var S$=z(()=>{Tp();Ep();Np();Tt();s(k$,"peekTable");s(x$,"validateTablePeek");s(Rp,"parse")});var VP,z$=z(()=>{VP=!!"".isWellFormed});var P$=z(()=>{S$();z$();Ap();Tt();});import{readFile as I$}from"node:fs/promises";import{dirname as Kk,join as Ln,relative as Jk,resolve as Wk}from"node:path";function ex(e){if(!e||typeof e!="object"||Array.isArray(e))return e;let{containers:t,...r}=e,n=t===!0?{vms:!0,...r}:r;return n.driver==="container"?{...n,driver:"libvirt"}:n}function T$(){return{station:{name:"station",os:"macos",admin_user:"lume",desktop_user:"orbit"},user:[],app:[],defaults:[],script:[]}}function tx(e){return e.mail!==!1}function rx(e){return e.vms===!0}function nx(e){return e.codex===!0}function N$(e){let t=new Set([...tx(e.station)?[]:["mail"],...rx(e.station)?[]:["vms"],...nx(e.station)?[]:["codex"]]);if(t.size===0)return e;let r=s(o=>o.filter(i=>!i.needs||!t.has(i.needs)),"kept"),n=new Set(e.app.filter(o=>o.needs&&t.has(o.needs)).map(o=>o.name));return{...e,user:r(e.user),app:r(e.app),dock:e.dock&&{...e.dock,apps:e.dock.apps.filter(o=>!n.has(o))},script:r(e.script)}}function ds(e,t,r){let n=[...e];for(let o of t){let i=n.findIndex(a=>r(a)===r(o));i>=0?n[i]=o:n.push(o)}return n}function ox(e,t,r){return{station:{...e.station,...t.station},user:ds(e.user,t.user??[],n=>n.name),app:ds(e.app,t.app??[],n=>n.name),dock:t.dock??e.dock,defaults:ds(e.defaults,t.defaults??[],n=>`${n.domain}\0${n.key}\0${n.as}`),script:ds(e.script,r,n=>n.path)}}function ix(e,t){let r;try{r=Rp(e)}catch{throw new Oe(`${t}: invalid recipe TOML (file contents withheld)`)}let n=Qk.safeParse(r);if(!n.success){let o=n.error.issues.map(i=>` ${i.path.join(".")||"(top)"}: ${i.message}`);throw new Oe(`${t}:
|
|
73
|
+
`:r===102?a+="\f":r===114?a+="\r":r===101?a+="\x1B":r===34?a+='"':r===92?a+="\\":C.x("unrecognised escape sequence",e),c=e.p+1,u=0);else r!==32&&r!==9&&(u===2&&C.x("invalid escape: only line-ending whitespace may be escaped",e,c),u=!o&&r===92?1:0,c=e.p);C.x("unfinished string",e,t)}var Ip=z(()=>{Tt();s(ls,"parseString")});var Mk,Rn,Ap=z(()=>{Mk=/^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i,Rn=class e extends Date{static{s(this,"TomlDate")}#t=!1;#r=!1;#e=null;constructor(t,r,n){let o=!0,i=!0,a="Z",c;if(typeof t=="string")if(r)e:{if(r<3){if(+t.slice(11,13)>23){t="";break e}r===2?(a=null,t+="Z"):(c=t.charCodeAt(t.length-1))!==90&&c!==122&&(a=t.slice(t.length-6)),n&&(t=t.slice(0,10)+"T"+t.slice(11))}else r===4&&(t=+t.slice(0,2)>23?"":`0000-01-01T${t}Z`);o=r!==4,i=r!==3}else{let u=t.match(Mk);u?(u[1]||(o=!1,t=`0000-01-01T${t}`),i=!!u[2],i&&t[10]===" "&&(t=t.replace(" ","T")),u[2]&&+u[2]>23?t="":(a=u[3]||null,!a&&i&&(t+="Z"))):t=""}super(t),isNaN(this.getTime())||(this.#t=o,this.#r=i,this.#e=a)}isDateTime(){return this.#t&&this.#r}isLocal(){return!this.#t||!this.#r||!this.#e}isDate(){return this.#t&&!this.#r}isTime(){return this.#r&&!this.#t}isValid(){return this.#t||this.#r}toISOString(){let t=super.toISOString();if(this.isDate())return t.slice(0,10);if(this.isTime())return t.slice(11,23);if(this.#e===null)return t.slice(0,-1);if(this.#e==="Z"||this.#e==="z")return t;let r=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return r=this.#e[0]==="-"?r:-r,new Date(this.getTime()-r*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(t,r="Z"){let n=new e(t);return n.#e=r,n}static wrapAsLocalDateTime(t){let r=new e(t);return r.#e=null,r}static wrapAsLocalDate(t){let r=new e(t);return r.#r=!1,r.#e=null,r}static wrapAsLocalTime(t){let r=new e(t);return r.#t=!1,r.#e=null,r}}});function we(e,t=10){return t===16?e>47&&e<58||e>64&&e<71||e>96&&e<103:e>47&&e<48+t}function Cp(e,t){return e===32||e===9||e===10||e===13||t&&(e===t||e===44)||e===35}function Dn(e,t){let r=e.p,n=e.s.charCodeAt(e.p);if(n===91||n===123){e.d--||C.x("document contains excessively nested structures. aborting.",e);let o=n===91?v$(e):_$(e);return e.d++,o}return n===34||n===39?ls(e):n===116?((e.s.charCodeAt(++e.p)!==114||e.s.charCodeAt(++e.p)!==117||e.s.charCodeAt(++e.p)!==101)&&C.x("invalid value",e,r),e.p++,!0):n===102?((e.s.charCodeAt(++e.p)!==97||e.s.charCodeAt(++e.p)!==108||e.s.charCodeAt(++e.p)!==115||e.s.charCodeAt(++e.p)!==101)&&C.x("invalid value",e,r),e.p++,!1):n===43||n===45?fs(e,e.p,e.s.charCodeAt(++e.p),44-n,t):e.s.charCodeAt(e.p+4)===45&&e.s.charCodeAt(e.p+7)===45?Fk(e,n,t):e.s.charCodeAt(e.p+2)===58?Vk(e,n,t):fs(e,e.p,n,0,t)}function fs(e,t,r,n,o){let i=r,a=0,c=!1;if(i===105)return(e.s.charCodeAt(++e.p)!==110||e.s.charCodeAt(++e.p)!==102)&&C.x("invalid value",e,t),e.p++,(n||1)/0;if(i===110)return(e.s.charCodeAt(++e.p)!==97||e.s.charCodeAt(++e.p)!==110)&&C.x("invalid value",e,t),e.p++,NaN;if(i===48){if(++e.p>=e.s.length||Cp(i=e.s.charCodeAt(e.p),o))return e.bi===!0?0n:0;if(!n){if(i===120)return Op(e,t,16,o);if(i===98)return Op(e,t,2,o);if(i===111)return Op(e,t,8,o)}i===46?a=2:i===101||i===69?a=4:C.x("illegal leading zero",e,t)}else we(i)||C.x("invalid value",e,t);for(;++e.p<e.s.length&&(i=e.s.charCodeAt(e.p),!Cp(i,o));)a||(a=1),i===95?(a&1||C.x("illegal underscore",e),a+=11,c=!0):a===1&&i===46?a=2:(a===1||a===3)&&(i===101||i===69)?a=4:a===4&&(i===43||i===45)?a=6:we(i)?a>9?a-=11:a&1||a++:C.x("illegal character in numeric literal",e);if(!a){let l=(r-48)*(n||1);return e.bi===!0?BigInt(l):l}a&1||C.x("unfinished numeric value",e,t);let u=e.s.slice(t,e.p);return c&&(u=u.replaceAll("_","")),a>1?parseFloat(u):w$(e,u,10,t)}function Op(e,t,r,n){let o,i=1;for(;++e.p<e.s.length&&(o=e.s.charCodeAt(e.p),!Cp(o,n));)o===95?(i&1&&C.x("illegal underscore",e),i=3):we(o,r)?i&1&&i--:C.x("illegal character in numeric literal",e);i&1&&C.x("unfinished numeric value",e);let a=e.s.slice(t+2,e.p);return i&&(a=a.replaceAll("_","")),w$(e,a,r,t)}function w$(e,t,r,n){if(e.bi!==!0)e:{let o=parseInt(t,r);if(!Number.isSafeInteger(o)){if(e.bi)break e;C.x("integer value cannot be represented losslessly",e,n)}return o}return BigInt(r===10?t:(r===2?"0b":r===8?"0o":"0x")+t)}function Fk(e,t,r){let n=e.p++,o;if(!we(t)||!we(e.s.charCodeAt(e.p++))||!we(e.s.charCodeAt(e.p++))||!we(e.s.charCodeAt(e.p++)))return fs(e,e.p=n,t,0,r);if(e.p+=5,we(e.s.charCodeAt(e.p++))||C.x("invalid date-time: date part is malformed",e,n),e.p>=e.s.length||((t=e.s.charCodeAt(e.p))!==32||(o=!0,!we(e.s.charCodeAt(e.p+1))))&&t!==84&&t!==116){let a=e.s.slice(n,e.p);return Zn(e,a,3,!1,n)}if(e.s.charCodeAt(e.p+=3)!==58&&C.x("invalid date-time: time part is malformed",e,n),e.s.charCodeAt(e.p+=3)===58&&(e.p+=3),e.s.charCodeAt(e.p)===46)for(;we(e.s.charCodeAt(++e.p)););if(t=e.s.charCodeAt(e.p)){if(t===90||t===122){let a=e.s.slice(n,++e.p);return Zn(e,a,1,o,n,"[+00:00]")}if(t===43||t===45){let a=e.s.slice(n,e.p+=6);return Zn(e,a,1,o,n,!e.ld&&"["+e.s.slice(e.p-6,e.p)+"]")}}let i=e.s.slice(n,e.p);return Zn(e,i,2,o,n)}function Vk(e,t,r){let n=e.p;if(!we(t)||!we(e.s.charCodeAt(++e.p)))return fs(e,--e.p,t,0,r);if(e.s.charCodeAt(e.p+=4)===58&&(e.p+=3),e.s.charCodeAt(e.p)===46)for(;we(e.s.charCodeAt(++e.p)););let o=e.s.slice(n,e.p);return Zn(e,o,4,!1,n)}function Zn(e,t,r,n,o,i){if(e.ld){let a=new Rn(t,r,n);return a.isValid()||C.x("invalid date",e,o),a}try{switch(i&&(t+=i),r){case 1:return Temporal.ZonedDateTime.from(t);case 2:return Temporal.PlainDateTime.from(t);case 3:return Temporal.PlainDate.from(t);case 4:return Temporal.PlainTime.from(t)}}catch(a){C.x(a instanceof Error?a.message:""+a,e,o)}}var Ep=z(()=>{Ip();Tp();Tt();Ap();s(we,"isDigit");s(Cp,"isEndOfValue");s(Dn,"extractValue");s(fs,"parseNumber");s(Op,"parseIntegerBaseN");s(w$,"parseInteger");s(Fk,"parseDate");s(Vk,"parseTime");s(Zn,"readDate")});function Uk(e){for(;e.p<e.s.length;e.p++){let t=e.s.charCodeAt(e.p);if(t===10)break;if(t===13&&e.s.charCodeAt(e.p+1)===10){e.p++;break}(t<32&&t!==9||t===127)&&C.x("control characters are not allowed in comments",e)}}function Ae(e,t,r){let n;for(;e.p<e.s.length;){for(;e.p<e.s.length&&((n=e.s.charCodeAt(e.p))===32||n===9||!t&&(n===10||n===13&&e.s.charCodeAt(e.p+1)===10));)e.p++;if(r||n!==35)break;Uk(e)}}var Np=z(()=>{Tt();s(Uk,"skipComment");s(Ae,"skipVoid")});function ps(e,t=61){let r,n=0,o=[],i,a=e.s.charCodeAt(r=e.p);do{if(a===t)return n||C.x("unexpected end of key",e),n===1&&o.push(e.s.slice(i,e.p)),e.p++,o;a===46?(n||C.x("illegal empty bare key",e),n===1&&o.push(e.s.slice(i,e.p)),n=0):!n&&(a===34||a===39)?(a===e.s.charCodeAt(e.p+1)&&a===e.s.charCodeAt(e.p+2)&&C.x("illegal quoted key: multiline strings are not allowed",e),o.push(ls(e)),n=2,e.p--):a===32||a===9?n===1&&(o.push(e.s.slice(i,e.p)),n=2):n===2||a<48&&a!==45||a>57&&a<65||a>90&&a<97&&a!==95||a>122?C.x("illegal character in key",e):n||(n=1,i=e.p)}while(a=e.s.charCodeAt(++e.p));C.x("incomplete key-value: cannot find end of key",e,r)}function _$(e){let t=e.p++,r=Object.create(null),n=new Set,o;for(;e.p<e.s.length;){if(Ae(e),(o=e.s.charCodeAt(e.p))===125)return e.p++,r;let i,a=r,c=!1,u=e.p,l=ps(e);for(let p=0;p<l.length;p++){p&&(a=c?a[i]:a[i]=Object.create(null)),i=l[p],(c=Object.hasOwn(a,i))&&(typeof a[i]!="object"||n.has(a[i]))&&C.x("trying to redefine an already defined value",e,u);let d=i==="__proto__";if(e.uk&&(d||i==="constructor")){a=e.uk!==1&&C.x("document contains an unsafe property",e,u);break}!c&&d&&Object.defineProperty(a,i,{enumerable:!0,configurable:!0,writable:!0})}c&&C.x("trying to redefine an already defined value",e,u),Ae(e,!0,!0);let f=Dn(e,125);if(a&&typeof(a[i]=f)=="object"&&n.add(f),Ae(e),(o=e.s.charCodeAt(e.p++))===125)return r;o!==44&&C.x("expected comma or end of structure",e,e.p-1)}C.x("unfinished table",e,t)}function v$(e){let t=e.p++,r=[],n;for(;e.p<e.s.length;){if(Ae(e),(n=e.s.charCodeAt(e.p))===93)return e.p++,r;if(r.push(Dn(e,93)),Ae(e),(n=e.s.charCodeAt(e.p++))===93)return r;n!==44&&C.x("expected comma or end of structure",e,e.p-1)}C.x("unfinished array",e,t)}var Tp=z(()=>{Ip();Ep();Np();Tt();s(ps,"parseKey");s(_$,"parseInlineTable");s(v$,"parseArray")});function k$(e,t,r,n,o){let i=r,a=n,c,u=!1,l;for(let f=0;f<t.length;f++){if(f){if(i=u?i[c]:i[c]=Object.create(null),a=(l=a[c]).c,o===0&&(l.t===1||l.t===2))return null;if(l.t===2){let p=i.length-1;i=i[p],a=a[p].c}}if(c=t[f],(u=Object.hasOwn(i,c))&&a[c]?.t===0&&a[c]?.d)return null;if(!u){let p=c==="__proto__";if(e.uk&&(p||c==="constructor"))return!1;p&&(Object.defineProperty(i,c,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,c,{enumerable:!0,configurable:!0,writable:!0})),a[c]={t:f<t.length-1&&o===2?3:o,d:!1,i:0,c:Object.create(null)}}}if(l=a[c],l.t!==o&&!(o===1&&l.t===3)||(o===2&&(l.d||(l.d=!0,i[c]=[]),i[c].push(i=Object.create(null)),l.c[l.i++]=l={t:1,d:!1,i:0,c:Object.create(null)}),l.d))return null;if(l.d=!0,o===1)i=u?i[c]:i[c]=Object.create(null);else if(o===0&&u)return null;return[c,i,l.c]}function x$(e,t,r){(t===null||e.uk===2)&&C.x(t===null?"trying to redefine an already defined table or value":"document contains an unsafe property",e,r)}function Rp(e,t={}){let r={s:e,p:0,d:t.maxDepth??1e3,bi:t.integersAsBigInt??!1,ld:t.useLegacyDate??!0,uk:t.unsafeKeyBehaviour==="throw"?2:t.unsafeKeyBehaviour==="drop"?1:0},n=Object.create(null),o=Object.create(null),i,a=!1,c=n,u=o;for(e.charCodeAt(0)===65279&&r.p++,Ae(r);r.p<e.length;){if(e.charCodeAt(r.p)===91){let l=e.charCodeAt(++r.p)===91;i=r.p+=+l,a=!1;let f=ps(r,93);l&&(e.charCodeAt(r.p)!==93&&C.x("expected end of table array declaration",r),r.p++);let p=k$(r,f,n,o,l?2:1);p?(u=p[2],c=p[1]):(x$(r,p,i),a=!0)}else{i=r.p;let l=ps(r),f=k$(r,l,c,u,0);!f&&!a&&x$(r,f,i),Ae(r,!0,!0);let p=Dn(r,void 0);f&&!a&&(f[1][f[0]]=p)}Ae(r,!0),r.p<e.length&&(i=e.charCodeAt(r.p))!==10&&(i!==13||e.charCodeAt(r.p+1)!==10)&&C.x("each key-value declaration must be followed by an end-of-line",r),Ae(r)}return n}var S$=z(()=>{Tp();Ep();Np();Tt();s(k$,"peekTable");s(x$,"validateTablePeek");s(Rp,"parse")});var UP,z$=z(()=>{UP=!!"".isWellFormed});var P$=z(()=>{S$();z$();Ap();Tt();});import{readFile as I$}from"node:fs/promises";import{dirname as Kk,join as Ln,relative as Jk,resolve as Wk}from"node:path";function ex(e){if(!e||typeof e!="object"||Array.isArray(e))return e;let{containers:t,...r}=e,n=t===!0?{vms:!0,...r}:r;return n.driver==="container"?{...n,driver:"libvirt"}:n}function T$(){return{station:{name:"station",os:"macos",admin_user:"lume",desktop_user:"orbit"},user:[],app:[],defaults:[],script:[]}}function tx(e){return e.mail!==!1}function rx(e){return e.vms===!0}function nx(e){return e.codex===!0}function N$(e){let t=new Set([...tx(e.station)?[]:["mail"],...rx(e.station)?[]:["vms"],...nx(e.station)?[]:["codex"]]);if(t.size===0)return e;let r=s(o=>o.filter(i=>!i.needs||!t.has(i.needs)),"kept"),n=new Set(e.app.filter(o=>o.needs&&t.has(o.needs)).map(o=>o.name));return{...e,user:r(e.user),app:r(e.app),dock:e.dock&&{...e.dock,apps:e.dock.apps.filter(o=>!n.has(o))},script:r(e.script)}}function ds(e,t,r){let n=[...e];for(let o of t){let i=n.findIndex(a=>r(a)===r(o));i>=0?n[i]=o:n.push(o)}return n}function ox(e,t,r){return{station:{...e.station,...t.station},user:ds(e.user,t.user??[],n=>n.name),app:ds(e.app,t.app??[],n=>n.name),dock:t.dock??e.dock,defaults:ds(e.defaults,t.defaults??[],n=>`${n.domain}\0${n.key}\0${n.as}`),script:ds(e.script,r,n=>n.path)}}function ix(e,t){let r;try{r=Rp(e)}catch{throw new Oe(`${t}: invalid recipe TOML (file contents withheld)`)}let n=Qk.safeParse(r);if(!n.success){let o=n.error.issues.map(i=>` ${i.path.join(".")||"(top)"}: ${i.message}`);throw new Oe(`${t}:
|
|
74
74
|
${o.join(`
|
|
75
75
|
`)}`)}return n.data}async function ms(e,t=T$()){let r=t;for(let n of e){let o=ix(await I$(n,"utf8"),n),i=[];for(let a of o.script??[]){let c=Wk(Kk(n),a.path),u=await I$(c,"utf8").catch(()=>{throw new Oe(`${n}: script ${a.path} not found at ${c}`)});i.push({...a,path:c,content:u})}r=ox(r,o,i)}return r}async function Lp(e,t,r=[],n,o){let i=n&&!o?Ln(e,"moonlet","config","stations",`${n}.toml`):void 0,a=i&&us(i)?[i]:[],c=o?Nt.parse(o):void 0,u=(c??(await ms(a)).station).os==="linux",l=t==="base"?u?"base-linux.toml":"base-macos.toml":u?"default-linux.toml":"default.toml",f=Ln(e,"moonlet","config","station",t==="base"?"base.toml":"recipe.toml"),p=T$();t==="custom"&&(p.station=(await Lp(e,"base",[],n,c)).station);let d=await ms([Ln(e,"moonlet","recipes",l),...us(f)?[f]:[],...a],p);return c&&(d={...d,station:{...d.station,...c}}),d=await ms(r,d),n&&(d.station.name=n),d.station.tunnel&&(d.station.gate=`127.0.0.1:${d.station.tunnel.slice(d.station.tunnel.lastIndexOf(":")+1)}`),N$({...d,script:d.script.map(m=>({...m,recordName:Jk(e,m.path)}))})}async function hs(e,t="bb-server",r){let n=Ln(e,"moonlet","config","servers",`${t}.toml`);if(!r&&!us(n))throw new Oe(`no record of the server ${t}: Orbit's server record says where its VM runs (bb orbit station show ${t} --server)`);let o=await ms([Ln(e,"moonlet","recipes","server-linux.toml"),...r?[]:[n]]);return r&&(o={...o,station:{...o.station,...Nt.parse(r)}}),o.station.name=t,o.station.role="server",N$(o)}var C$,E$,Zp,qk,Hk,Gk,Xk,Yk,A$,O$,Dp,Qk,Nt,zr,Oe,Rt=z(()=>{"use strict";b$();P$();it();C$=$.enum(["macos","linux"]),E$=$.enum(["root","admin","orbit"]),Zp=$.enum(["mail","vms","codex"]),qk=$.object({name:$.string().min(1),url:$.url(),sha256:$.string().regex(/^[0-9a-f]{64}$/,"sha256 must be 64 lowercase hex characters").optional(),team_id:$.string().regex(/^[A-Z0-9]{10}$/,"team_id is a 10-character Apple team ID").optional(),needs:Zp.optional()}).strict().refine(e=>e.sha256===void 0!=(e.team_id===void 0),{message:"give exactly one of sha256 (a pinned download) or team_id (an always-latest download)"}),Hk=$.object({apps:$.array($.string().min(1)),autohide:$.boolean().optional(),show_recents:$.boolean().optional()}).strict(),Gk=$.object({domain:$.string().min(1),key:$.string().min(1),value:$.union([$.boolean(),$.number(),$.string()]),as:E$.default("orbit")}).strict(),Xk=$.object({path:$.string().min(1),as:E$.default("root"),os:C$.optional(),needs:Zp.optional()}).strict(),Yk=$.object({name:$.string().regex(/^[a-z_][a-z0-9_-]*$/,"a lowercase short name"),hidden:$.boolean().default(!1),login:$.boolean().default(!0),autologin:$.boolean().default(!1),needs:Zp.optional()}).strict(),A$=$.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/,"letters, digits, . _ -, starting with a letter or digit"),O$=$.string().regex(/^[a-z_][a-z0-9_-]{0,31}$/,"a lowercase account name"),Dp=$.object({name:A$.optional(),os:C$.optional(),admin_user:O$.optional(),desktop_user:O$.optional(),driver:$.enum(["lume","libvirt","aws"]).optional(),hypervisor:$.string().regex(/^[A-Za-z0-9_][A-Za-z0-9._-]*@[A-Za-z0-9][A-Za-z0-9.-]*$/,"user@host").optional(),server:A$.optional(),role:$.enum(["station","server"]).optional(),region:$.string().regex(/^[a-z]{2}(-[a-z]+)+-\d$/,"an AWS region, like us-west-2").optional(),profile:$.string().regex(/^[A-Za-z0-9_.-]+$/,"a profile name").optional(),instance_type:$.string().regex(/^[a-z0-9-]+\.[a-z0-9]+$/,"an instance type, like t3.large").optional(),cpus:$.number().int().min(1).max(64).optional(),memory_gb:$.number().int().min(2).max(256).optional(),disk_gb:$.number().int().min(20).max(2e3).optional(),gate:$.string().regex(/^[0-9.]+:\d+$/,"address:port").optional(),tunnel:$.string().regex(/^[0-9.]+:\d+$/,"address:port").optional(),orbit_thread:$.boolean().optional(),mail:$.boolean().optional(),vms:$.boolean().optional(),codex:$.boolean().optional(),events:$.object({owner_label:$.string().min(1).optional(),reviewers:$.array($.string().min(1)).optional(),owner_email:$.string().min(3).optional(),never_email:$.array($.string().min(3)).optional()}).strict().optional()}).strict(),Qk=$.object({station:Dp.optional(),user:$.array(Yk).optional(),app:$.array(qk).optional(),dock:Hk.optional(),defaults:$.array(Gk).optional(),script:$.array(Xk).optional()}).strict();s(ex,"fromContainers");Nt=$.preprocess(ex,Dp),zr=Dp.required({name:!0,os:!0,admin_user:!0,desktop_user:!0}).strict();s(T$,"emptyRecipe");s(tx,"mailOn");s(rx,"vmsOn");s(nx,"codexOn");s(N$,"withoutUnneeded");s(ds,"upsert");s(ox,"layer");Oe=class extends Error{static{s(this,"RecipeError")}};s(ix,"parseRecipe");s(ms,"loadRecipe");s(Lp,"stationRecipe");s(hs,"serverRecipe")});import{StringDecoder as sx}from"node:string_decoder";import{format as R$}from"node:util";function st(e){if(!e)return e;for(let t of[e,e.trim(),JSON.stringify(e).slice(1,-1),e.replaceAll("'","'\\''"),encodeURIComponent(e),Buffer.from(e).toString("base64")])t&&$s.add(t);for(let t of e.split(/\r?\n/))e.includes(`
|
|
76
76
|
`)&&/[A-Za-z0-9]/.test(t)&&$s.add(t);return e}function jn(e,t=!1){if(typeof e=="string"&&t)st(e);else if(Array.isArray(e))for(let r of e)jn(r,t);else if(e&&typeof e=="object")for(let[r,n]of Object.entries(e))jn(n,t||Z$.test(r)&&!/(?:file|path|dir)$/i.test(r))}function _e(e){e=e.replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g,""),jn(process.env);try{jn(JSON.parse(e))}catch{}for(let t of e.split(/\r?\n/)){let r=t.match(/^\s*(?:export\s+)?([\w.-]+)\s*=\s*(.*?)\s*$/);if(!r||!Z$.test(r[1])||/(?:file|path|dir)$/i.test(r[1]))continue;let n=r[2].replace(/^(["'])(.*)\1$/,"$2");/^[A-Za-z0-9_./+=:@-]+$/.test(n)&&st(n)}e=e.replace(/-----BEGIN (?:[A-Z0-9]+ )*PRIVATE KEY-----[\s\S]*?-----END (?:[A-Z0-9]+ )*PRIVATE KEY-----/g,gs).replace(/\b(?:tskey-|sk-ant-|gh[pousr]_|github_pat_)[A-Za-z0-9_?=&.-]+/g,gs);for(let t of[...$s].sort((r,n)=>n.length-r.length))e=e.split(t).join(gs);return e}function Mn(e){let t=new sx("utf8"),r="",n=!1,o=s(i=>{/-----BEGIN (?:[A-Z0-9]+ )*PRIVATE KEY-----/.test(i)&&(n=!0),n?(/-----END (?:[A-Z0-9]+ )*PRIVATE KEY-----/.test(i)&&(n=!1),e(`${gs}
|
|
@@ -100,7 +100,7 @@ printf '%s,"applied_at":"%s"}\\n' ${v(n.slice(0,-1))} "$(date -u +%Y-%m-%dT%H:%M
|
|
|
100
100
|
mv -f "$t" "$f"`}}function V$(e,t){let r=e.recordName??e.path,n=cx(r),o=Mp("sha256").update(e.content).digest("hex"),i=n?`
|
|
101
101
|
${j$(t,jp(n))}
|
|
102
102
|
if [ -f "$f" ]; then printf 'before=%s\\n' "$(cat "$f")"; fi`:"";return{id:`script ${r}${e.as==="root"?"":` (as ${e.as})`}`,probe:{as:"root",script:`${M$(t,!1,jp(r))}
|
|
103
|
-
if [ -f "$f" ]; then printf 'record=%s\\n' "$(cat "$f")"; fi${i}`},plan(a){let c=a.get("record"),u=c===void 0&&n?a.get("before"):void 0,l=c??u,f=c===void 0?n:r;if(l===void 0||f===void 0)return["run (new)"];let p;try{p=JSON.parse(l)}catch{throw new Oe(`${r}: recipe record is invalid; inspect it before applying or explicitly adopt this script`)}let d=ax.safeParse(p);if(!d.success||d.data.name!==f)throw new Oe(`${r}: recipe record is invalid; inspect it before applying or explicitly adopt this script`);return d.data.sha256===o&&d.data.as===e.as?[]:["run (changed)"]},apply:[{as:e.as,script:e.content},F$(e,t,"executed")]}}var ws,ax,Fp=z(()=>{"use strict";it();Rt();Fe();ws="/var/db/orbit/recipe-applied",ax=$.object({name:$.string(),sha256:$.string().regex(/^[a-f0-9]{64}$/),as:$.enum(["root","admin","orbit"]),applied_at:$.iso.datetime(),method:$.enum(["executed","adopted"])}).strict();s(jp,"recordPath");s(cx,"nameBeforeRename");s(L$,"statCommand");s(j$,"recordFileCheck");s(M$,"guard");s(F$,"scriptRecord");s(V$,"recipeScriptStep")});var
|
|
103
|
+
if [ -f "$f" ]; then printf 'record=%s\\n' "$(cat "$f")"; fi${i}`},plan(a){let c=a.get("record"),u=c===void 0&&n?a.get("before"):void 0,l=c??u,f=c===void 0?n:r;if(l===void 0||f===void 0)return["run (new)"];let p;try{p=JSON.parse(l)}catch{throw new Oe(`${r}: recipe record is invalid; inspect it before applying or explicitly adopt this script`)}let d=ax.safeParse(p);if(!d.success||d.data.name!==f)throw new Oe(`${r}: recipe record is invalid; inspect it before applying or explicitly adopt this script`);return d.data.sha256===o&&d.data.as===e.as?[]:["run (changed)"]},apply:[{as:e.as,script:e.content},F$(e,t,"executed")]}}var ws,ax,Fp=z(()=>{"use strict";it();Rt();Fe();ws="/var/db/orbit/recipe-applied",ax=$.object({name:$.string(),sha256:$.string().regex(/^[a-f0-9]{64}$/),as:$.enum(["root","admin","orbit"]),applied_at:$.iso.datetime(),method:$.enum(["executed","adopted"])}).strict();s(jp,"recordPath");s(cx,"nameBeforeRename");s(L$,"statCommand");s(j$,"recordFileCheck");s(M$,"guard");s(F$,"scriptRecord");s(V$,"recipeScriptStep")});var hI,U$=z(()=>{"use strict";Fe();hI=String.raw`
|
|
104
104
|
import base64,difflib,hashlib,ipaddress,json,os,re,stat,subprocess
|
|
105
105
|
from pathlib import Path
|
|
106
106
|
|
|
@@ -377,8 +377,8 @@ line=${v(`${Zt} ${Ar} virtiofs ro,nodev,nosuid,noexec,nofail 0 0`)}
|
|
|
377
377
|
grep -qxF "$line" /etc/fstab || { sed -i '\\#^${Zt} #d' /etc/fstab; printf '%s\\n' "$line" >> /etc/fstab; }
|
|
378
378
|
mountpoint -q ${Ar} || { systemctl daemon-reload; mount ${Ar}; }
|
|
379
379
|
findmnt -no OPTIONS ${Ar} | grep -qw ro`});if(c.code!==0)throw new I(`mounting the host's library folder on ${r.name} failed: ${(c.stderr||c.stdout).trim()}`)}return 0}var at,ct,Fn,K,Up,Bp,ry=z(()=>{"use strict";Ce();Vp();vs();Ve();Fe();at={name:"ubuntu-24.04-20260926.qcow2",url:"https://cloud-images.ubuntu.com/releases/24.04/release-20260926/ubuntu-24.04-server-cloudimg-amd64.img",sha256:"6a81c37564db9b1ee84e141922625e1d7c5b389b99bb3c572e0243607d5bb4d2"},ct="orbit",Fn="orbit",K="virsh -c qemu:///system",Up="org.qemu.guest_agent.0";s(H$,"hypervisor");s(_s,"serverName");s(Ue,"onServer");s(G$,"libvirtInfo");s(vx,"ensureBaseImage");s(X$,"cloudInit");s(kx,"ensureAgentChannel");Bp=["import io, sys","import xml.etree.ElementTree as ET","view, tag = sys.argv[1], sys.argv[2]","text = sys.stdin.read()","for _, (prefix, uri) in ET.iterparse(io.StringIO(text), events=('start-ns',)):"," ET.register_namespace(prefix, uri)","domain = ET.fromstring(text)","devices = domain.find('devices')","backing = domain.find('memoryBacking')","def attr(parent, child, name):"," found = None if parent is None else parent.find(child)"," return None if found is None else found.get(name)","shares = [f for f in devices.findall('filesystem') if attr(f, 'target', 'dir') == tag]","memory_ok = attr(backing, 'source', 'type') == 'memfd' and attr(backing, 'access', 'mode') == 'shared'","share_ok = len(shares) == 1 and attr(shares[0], 'source', 'dir') == view and attr(shares[0], 'driver', 'type') == 'virtiofs'","if memory_ok and share_ok:"," sys.exit(3)","if backing is None:"," backing = ET.SubElement(domain, 'memoryBacking')","for old in [c for c in backing if c.tag in ('source', 'access')]:"," backing.remove(old)","ET.SubElement(backing, 'source', type='memfd')","ET.SubElement(backing, 'access', mode='shared')","for old in shares:"," devices.remove(old)","share = ET.SubElement(devices, 'filesystem', type='mount', accessmode='passthrough')","ET.SubElement(share, 'driver', type='virtiofs')","ET.SubElement(share, 'source', dir=view)","ET.SubElement(share, 'target', dir=tag)","sys.stdout.write(ET.tostring(domain, encoding='unicode'))"].join(`
|
|
380
|
-
`);s(Y$,"libraryShare");s(xx,"ensureLibraryShare");s(Q$,"ensureLibvirtStation");s(ey,"pinLease");s(Sx,"buildLinux")});import{dirname as
|
|
381
|
-
`))}var
|
|
380
|
+
`);s(Y$,"libraryShare");s(xx,"ensureLibraryShare");s(Q$,"ensureLibvirtStation");s(ey,"pinLease");s(Sx,"buildLinux")});import{dirname as BI,join as zx}from"node:path";function Ix(e,t,r){return e.find(n=>n.kind===t&&n.name===r)}function Ax(e){return e.filter(t=>t.kind==="station"&&t.table.server!==void 0&&!Ix(e,"server",t.table.server)).map(t=>`station ${t.name} runs on server ${t.table.server}, but Orbit has no server record ${t.table.server}: add it with bb orbit station set ${t.table.server} --server --set driver=aws --set region=\u2026 --set vms=true (or correct the station's server with bb orbit station set ${t.name} --set server=<name>)`)}function ny(e){let t=Ax(e);if(t.length)throw new Oe(t.join(`
|
|
381
|
+
`))}var WI,Px,qI,oy=z(()=>{"use strict";Rt();Ve();WI=zx(re,"machine-records.json"),Px=["moonlet/config","orbit/config"],qI=Px.flatMap(e=>[`${e}/stations/*.toml`,`${e}/servers/*.toml`]);s(Ix,"findRecord");s(Ax,"missingServerRecords");s(ny,"checkServerRecords")});var dy={};ge(dy,{EARLIER_TERRAFORM_DIR:()=>Kn,TERRAFORM_DIR:()=>ut,TFVARS_FILE:()=>cy,awsArgs:()=>uy,awsFirewallRules:()=>Mx,awsInfo:()=>ly,awsTfvars:()=>fy,buildAws:()=>Dx,carryEarlierTerraformState:()=>py,provisionAws:()=>jx});import{spawn as Ox}from"node:child_process";import{existsSync as ks}from"node:fs";import{mkdir as ay,readdir as Cx,readFile as Ex,rename as Tx,writeFile as Nx}from"node:fs/promises";import{join as Dt}from"node:path";function uy(e){return[...e.region?["--region",e.region]:[],...e.profile?["--profile",e.profile]:[]]}async function Jp(e,t){let r=await ue("aws",[...uy(e),...t,"--output","json"]);if(r.code!==0)throw new I(`aws ${t.slice(0,2).join(" ")} failed: ${r.stderr.trim()||r.stdout.trim()}`);return r.stdout.trim()?bs(r.stdout,"AWS response"):void 0}async function Rx(e){let r=(await Jp(e,["ec2","describe-instances","--filters",`Name=tag:Name,Values=${e.name}`,`Name=tag:orbit,Values=${e.role??"station"}`,"Name=instance-state-name,Values=pending,running,stopping,stopped"])).Reservations.flatMap(n=>n.Instances);if(r.length>1)throw new I(`${e.name}: ${r.length} instances in AWS carry its name; expected one (${r.map(n=>n.InstanceId).join(", ")})`);return r[0]}async function ly(e){let t=await Rx(e);if(t)return{status:t.State.Name,ipAddress:t.PrivateIpAddress,id:t.InstanceId}}async function Zx(e,t){return(await Jp(e,["ssm","describe-instance-information","--filters",`Key=InstanceIds,Values=${t}`])).InstanceInformationList.some(n=>n.PingStatus==="Online")}async function Dx(e,t){let r=e.station,n=s(u=>G.log(` ${u}`),"log");if(G.log(`${r.name} (${r.role==="server"?"host, ":""}EC2${r.region?`, ${r.region}`:""})`),await ay(re,{recursive:!0,mode:448}),!ks(ce)){let u=await ue("ssh-keygen",["-q","-t","ed25519","-N","","-C","orbit station admin","-f",ce]);if(u.code!==0)throw new I(`ssh-keygen failed: ${u.stderr.trim()}`);n(`made Orbit's station key (${ce}); Terraform puts its public half on new instances`)}let o=await ly(r);if(!o?.id)throw new I(`${r.name} has no instance in AWS; make it first: pnpm orbit station provision (its record: bb orbit station show ${r.name}${r.role==="server"?" --server":""})`);(o.status==="stopped"||o.status==="stopping")&&(n(`starting ${r.name} (${o.id})`),await Jp(r,["ec2","start-instances","--instance-ids",o.id])),n(`waiting for Session Manager to reach ${o.id}`);let i=Date.now()+6e5;for(;!await Zx(r,o.id);){if(Date.now()>i)throw new I(`${r.name}'s SSM agent didn't check in within 10 minutes (is its instance profile orbit-${r.name}, and was the agent restarted after a role change?)`);await new Promise(u=>setTimeout(u,5e3))}n("waiting for ssh");let a=await ve.waitFor(r,600);if(!a)throw new I(`${r.name} didn't answer ssh through Session Manager within 10 minutes`);await a.exec({as:"root",script:"cloud-init status --wait >/dev/null 2>&1 || true"});let c=await Ir(a,Pr(e),!1);return c!==0?c:Ir(a,Pr(t),!1)}function fy(e,t,r){let n=[...e,...t].filter(p=>p.driver==="aws"),o=new Set(e.filter(p=>p.driver==="aws").map(p=>p.name)),i=t.filter(p=>p.driver==="aws"&&o.has(p.name)).map(p=>p.name);if(i.length>0)throw new I(`a station and a server in AWS can't share a name: each box's security group, role and instance profile are orbit-<name> (${i.join(", ")} is both)`);if(n.some(p=>p.name==="station"))throw new I("a station or server in AWS can't be named station: orbit-station is the shared security group, role and instance profile an account from before each box had its own still has, and the box's own would collide with them");let a=n[0];if(!a)throw new I('no station or server record in Orbit says driver = "aws"; nothing to provision');let c=s(p=>{if(new Set(n.map(m=>m[p]??"")).size>1)throw new I(`the stations in AWS must share one ${p} (${ut} is one account and region): ${n.map(m=>`${m.name}: ${m[p]??"unset"}`).join(", ")}`);return a[p]},"one"),u=c("region"),l=c("profile"),f=s(p=>({...p.instance_type?{instance_type:p.instance_type}:{},...p.disk_gb?{disk_gb:p.disk_gb}:{},...p.vms?{nested_virtualization:!0}:{}}),"size");return{...u?{region:u}:{},...l?{profile:l}:{},admin_user:a.admin_user,admin_public_key:r.trim(),stations:Object.fromEntries(e.filter(p=>p.driver==="aws").map(p=>[p.name,f(p)])),servers:Object.fromEntries(t.filter(p=>p.driver==="aws").map(p=>{let d=e.filter(m=>m.server===p.name).map(m=>m.name);return[p.name,{...f(p),...d.length?{stations:d}:{}}]}))}}function iy(e,t){return new Promise((r,n)=>{let o=Ox("terraform",[`-chdir=${e}`,...t],{stdio:["inherit","pipe","pipe"]});D$(o),o.on("error",i=>n(new I(`terraform: ${i.message} (is Terraform installed?)`))),o.on("close",i=>r(i??1))})}async function sy(e){return ks(e)?(await Cx(e)).filter(t=>Lx.test(t)).sort():[]}async function py(e){let t=Dt(e,Kn),r=Dt(e,ut),n=await sy(t);if(!n.length)return[];let o=await sy(r);if(o.length)throw new I(`Terraform state is in both ${Kn} (${n.join(", ")}) and ${ut} (${o.join(", ")}). Keep the one that describes what's in AWS in ${ut} and remove the other from ${Kn}, then provision again`);for(let i of n)await Tx(Dt(t,i),Dt(r,i));return n}async function jx(e,t,r){ny(r);let n=await Promise.all(r.filter(f=>f.kind==="station").map(async f=>(await Lp(e,"base",[],f.name,f.table)).station)),o=await Promise.all(r.filter(f=>f.kind==="server").map(async f=>(await hs(e,f.name,f.table)).station));if(await ay(re,{recursive:!0,mode:448}),!ks(ce)){let f=await ue("ssh-keygen",["-q","-t","ed25519","-N","","-C","orbit station admin","-f",ce]);if(f.code!==0)throw new I(`ssh-keygen failed: ${f.stderr.trim()}`);G.log(` made Orbit's station key (${ce}); new instances get its public half`)}let i=fy(n,o,await Ex(`${ce}.pub`,"utf8")),a=Dt(e,ut),c=await py(e);c.length&&G.log(` moved Terraform's state (${c.join(", ")}) from ${Kn} to ${ut}`),await Nx(Dt(a,cy),`${JSON.stringify(i,null,2)}
|
|
382
382
|
`);let u=Object.keys(i.stations),l=Object.keys(i.servers);if(G.log(`${ut}: ${u.length===1?"1 station":`${u.length} stations`} from Orbit's station records (${u.join(", ")||"none"}), ${l.length===1?"1 host":`${l.length} hosts`} from its server records (${l.join(", ")||"none"})`),!ks(Dt(a,".terraform"))){let f=await iy(a,["init","-input=false"]);if(f!==0)return f}return iy(a,t?["plan","-input=false"]:["apply"])}function Mx(e){return[`ip daddr { ${e.replace(/\.0\/24$/,".2")}, 169.254.169.253 } meta l4proto { tcp, udp } th dport 53 accept`,'ip daddr 169.254.169.254 meta skuid "root" accept',"ip daddr 169.254.169.123 udp dport 123 accept",'meta skuid "root" tcp dport 443 accept']}var ut,Kn,cy,Lx,my=z(()=>{"use strict";Ce();Ce();Ce();Vp();Rt();oy();Ve();Fe();ut="moonlet/infra/aws",Kn="orbit/infra/aws",cy="stations.auto.tfvars.json";s(uy,"awsArgs");s(Jp,"aws");s(Rx,"instanceOf");s(ly,"awsInfo");s(Zx,"ssmOnline");s(Dx,"buildAws");s(fy,"awsTfvars");s(iy,"terraform");Lx=/^terraform\.tfstate(\..+)?$/;s(sy,"stateFiles");s(py,"carryEarlierTerraformState");s(jx,"provisionAws");s(Mx,"awsFirewallRules")});var hy={};ge(hy,{stationUpdateCommand:()=>Bx,stationUpdateSteps:()=>Jx,withUpdateSession:()=>Kx});import{readFileSync as Fx}from"node:fs";import{createInterface as Vx}from"node:readline";function Bx(e){if(!/^[a-f0-9]{40}$/.test(e))throw new I("The update target must be a full commit");return{as:"root",script:`exec python3 -I -B -c ${v(Ux)} ${v(e)} /usr/local/orbit/etc/bundle-source /usr/local/orbit/etc/station-updates /usr/local/orbit/bin/orbit-events`}}async function Kx(e,t,r){let n=Vx({input:e.stdout}),o=[],i,a,c="";e.stderr.on("data",p=>c+=p);let u=s(p=>{a=p,i?.reject(p),i=void 0},"stop"),l=new Promise(p=>e.once("close",()=>{u(new I(`The update session stopped: ${c.trim()}`)),p()}));e.on("error",u),e.stdin.on("error",u),n.on("line",p=>{try{let d=JSON.parse(p);if(!d||typeof d!="object"||!("code"in d)||typeof d.code!="number"||!("stdout"in d)||typeof d.stdout!="string"||!("stderr"in d)||typeof d.stderr!="string")throw new Error("Invalid update session response");let m={code:d.code,stdout:d.stdout,stderr:d.stderr};i?(i.resolve(m),i=void 0):o.push(m)}catch(d){u(new I(d instanceof Error?d.message:"Invalid update session response")),e.stdin.end()}});let f=s(()=>new Promise((p,d)=>{let m=o.shift();m?p(m):a?d(a):i={resolve:p,reject:d}}),"next");try{let p=await f();if(p.code!==0)throw new I(p.stderr);let d=await r(async m=>{if(a)throw a;return e.stdin.write(JSON.stringify({shell:t(m),script:m.script})+`
|
|
383
383
|
`),f()});if(d===0){e.stdin.write(JSON.stringify({operation:"complete"})+`
|
|
384
384
|
`);let m=await f();if(m.code!==0)throw new I(`The station was updated, but its update event needs a retry: ${m.stderr.trim()}`)}return d}finally{e.stdin.end(),await l,n.close()}}function Jx(e,t){let r=e.filter(n=>n.id==="disk pressure monitoring");return e.filter(n=>n.id!=="disk pressure monitoring").flatMap(n=>n.id==="broker daemon"?[t,...r,n]:[n])}var Ux,gy=z(()=>{"use strict";Fe();Ve();Ux=Fx(new URL("./station-update.py",import.meta.url),"utf8");s(Bx,"stationUpdateCommand");s(Kx,"withUpdateSession");s(Jx,"stationUpdateSteps")});import{spawn as qp}from"node:child_process";import{existsSync as Wx}from"node:fs";import{homedir as $y}from"node:os";import{join as Ss}from"node:path";function ue(e,t,r="",n){if(ys(t))throw new I("refusing to put a secret in command arguments");return new Promise((o,i)=>{let a=e==="ssh"&&Hp?["-o","StrictHostKeyChecking=yes","-o","UpdateHostKeys=no","-o","ControlMaster=no","-o","ControlPath=none",...t]:t,c=qp(e,a,{stdio:["pipe","pipe","pipe"],env:n??process.env}),u="",l="";c.stdout.on("data",f=>u+=f),c.stderr.on("data",f=>l+=f),c.on("error",i),c.on("close",f=>o({code:f??1,stdout:u,stderr:l})),c.stdin.on("error",()=>{}),c.stdin.end(r)})}function qx(){let e=Ss($y(),".local","bin","lume");return process.env.LUME??(Wx(e)?e:"lume")}async function Hx(e){let t=await ue(qx(),["get",e,"--format","json"]);if(t.code!==0){if(/not found|does not exist/i.test(t.stderr+t.stdout))return;throw new I(`lume get ${e} failed (exit ${t.code}); VM output is withheld because it may contain credentials`)}let r=t.stdout.search(/^[[{]/m),n=bs(r>=0?t.stdout.slice(r):t.stdout,`lume get ${e}`),o=Array.isArray(n)?n[0]:n;if(o?.vncUrl){st(o.vncUrl);let i;try{i=new URL(o.vncUrl)}catch{throw new I(`lume get ${e} returned an invalid VNC address; contents withheld`)}st(decodeURIComponent(i.password))}return o}async function Or(e){if(e.driver==="libvirt"){let{libvirtInfo:t}=await Promise.resolve().then(()=>(ry(),ty));return t(e)}if(e.driver==="aws"){let{awsInfo:t}=await Promise.resolve().then(()=>(my(),dy));return t(e)}return Hx(e.name)}async function Gx(e){let t=await Or(e);if(t?.status!=="running"||!t.ipAddress){let r={libvirt:`virsh -c qemu:///system start ${e.name} (on ${e.server??e.hypervisor})`,aws:`orbit station build --station ${e.name}`,lume:`lume run ${e.name} --detach --display none`}[e.driver??"lume"];throw new I(`${e.name} isn't running (status: ${t?.status??"no such VM"}). Start it with: ${r}`)}return{host:t.id??t.ipAddress,address:t.ipAddress}}function Xx(e){return["aws",...[...e.region?["--region",e.region]:[],...e.profile?["--profile",e.profile]:[]],"ssm","start-session","--target","%h","--document-name","AWS-StartSSHSession","--parameters","portNumber=%p"].join(" ")}function Gp(e){return e.driver==="libvirt"&&!e.server?{jump:e.hypervisor}:e.driver==="aws"?{proxyCommand:Xx(e)}:{}}async function xs(e){if(e.driver!=="libvirt"||!e.server)return Gp(e);let{serverProxyCommand:t}=await Promise.resolve().then(()=>(vs(),yy)),r=await t(e);return r?{proxyCommand:r}:{}}function Wp(e){return`/usr/bin/env XDG_RUNTIME_DIR=/run/user/$(id -u ${e}) DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u ${e})/bus`}function lt(e={},t=Hp){return[...e.jump?["-o",`ProxyJump=${e.jump}`]:[],...e.proxyCommand?["-o",`ProxyCommand=${e.proxyCommand}`]:[],"-i",ce,"-o","IdentitiesOnly=yes","-o","BatchMode=yes","-o","ConnectTimeout=10","-o",t?"StrictHostKeyChecking=yes":"StrictHostKeyChecking=accept-new",...t?["-o","UpdateHostKeys=no","-o","ControlMaster=no","-o","ControlPath=none"]:[],"-o",`UserKnownHostsFile=${Ss(re,"known_hosts")}`]}var re,ce,I,Hp,ve,Ve=z(()=>{"use strict";Ce();Ce();Fe();re=Ss($y(),".config","orbit"),ce=Ss(re,"station_ed25519"),I=class extends Error{static{s(this,"StationError")}constructor(t){super(_e(t))}},Hp=!1;s(ue,"run");s(qx,"lume");s(Hx,"vmInfo");s(Or,"vmInfoFor");s(Gx,"address_");s(Xx,"ssmProxyCommand");s(Gp,"sshVia");s(xs,"sshViaFor");ve=class e{static{s(this,"Station")}name;host;address;admin;desktopUser;os;via;readOnly=!1;constructor(t,r,n,o){this.name=t.name,this.host=r,this.address=n,this.admin=t.admin_user,this.desktopUser=t.desktop_user,this.os=t.os,this.via=o}static async connect(t,r=!1){let{host:n,address:o}=await Gx(t),i=new e(t,n,o,await xs(t));return i.readOnly=r,i}static async waitFor(t,r=180){let n=Date.now()+r*1e3;for(;Date.now()<n;){let o=await Or(t);if(o?.status==="running"&&o.ipAddress){let i=new e(t,o.id??o.ipAddress,o.ipAddress,await xs(t));if((await i.exec({as:"root",script:"id -u"})).stdout.trim()==="0")return i}await new Promise(i=>setTimeout(i,3e3))}}async exec(t){let r=v(this.desktopUser),n={root:"sudo -n /bin/bash -s",admin:"/bin/bash -l -s",orbit:this.os==="linux"?`sudo -n -u ${r} -H ${Wp(r)} /bin/bash -s`:`if [ "$(stat -f %Su /dev/console)" = ${r} ]; then sudo -n launchctl asuser "$(id -u ${r})" sudo -n -u ${r} -H /bin/bash -s; else sudo -n -u ${r} -H /bin/bash -s; fi`}[t.as],o=t.as==="orbit"&&this.os==="linux"?`if [ -f /etc/profile.d/orbit-outbound.sh ]; then . /etc/profile.d/orbit-outbound.sh || exit $?; fi
|
|
@@ -388,12 +388,12 @@ ${f.script}`}:f),"exec")}))}run(t){if(ys(t.argv))throw new I("refusing to put a
|
|
|
388
388
|
${t.config}`,a=await Bn(r,`set -euo pipefail
|
|
389
389
|
${o} install -d -o root -g root -m 700 ${ed}
|
|
390
390
|
printf %s ${v(i)} | ${o} tee ${v(n)} >/dev/null
|
|
391
|
-
${o} chmod 600 ${v(n)}`);if(a.code!==0)throw new I(`writing ${e.name}'s library source on ${r.name} failed: ${(a.stderr||a.stdout).trim()}`);return`library source: ${r.name} mirrors ${t.type}: ${t.path} for ${e.name} (every minute)`}var Yp,Qp,Kp,Vn,Ar,Zt,ed,vs=z(()=>{"use strict";Rt();Ve();Fe();Yp="/etc/orbit/server";s(_y,"repoDir");Qp=new Map;s(td,"useServerRecord");s(Un,"serverOf");s(zs,"onHostItself");s(Bn,"onHost");s(Yx,"serverProxyCommand");Kp="/var/lib/orbit/library",Vn="/var/lib/orbit/shares",Ar="/home/orbit/OrbitData/bucket",Zt="orbit-library",ed="/var/lib/orbit/library-sources";s(Qx,"hostLibrarySource")});import{spawn as
|
|
392
|
-
`))o.startsWith("p")?n=Number(o.slice(1)):o.startsWith("n")&&n!==null&&r.push({pid:n,cwd:o.slice(1)});return r}s(Ck,"listLsofProcessCwds");async function Ek(e){let t=Pk(e),r=c$(t),n=[a$(t)];for(;;){try{r=await Sk(r);break}catch{}let i=c$(r);if(i===r)break;n.unshift(a$(r)),r=i}let o=zk(r,...n);try{if((await vk(o)).isSymbolicLink())return null}catch{}return o}s(Ek,"resolveSweepDirectory");async function u$(e){if(process.platform==="win32")return[];let t=(await Promise.all(e.directories.map(Ek))).filter(n=>n!==null);return t.length===0?[]:(process.platform==="linux"?await Ok():await Ck()).filter(n=>n.pid!==process.pid&&t.some(o=>Ak(n.cwd,o)))}s(u$,"listProcessesWithCwdUnder");function Tk(e){try{return process.kill(e,0),!0}catch{return!1}}s(Tk,"isProcessAlive");async function l$(e){await new Promise(t=>setTimeout(t,e))}s(l$,"delay");var Nk=5;function f$(e,t,r){for(let n of e)try{process.kill(n.pid,t),r.set(n.pid,n)}catch{}}s(f$,"signalProcesses");async function p$(e){let t=e.graceMs??2e3,r=new Map;for(let n=0;n<Nk;n+=1){let o=await u$({directories:e.directories});if(o.length===0)break;f$(o,"SIGTERM",r);let i=Date.now()+t;for(;Date.now()<i&&o.some(c=>Tk(c.pid));)await l$(50);let a=await u$({directories:e.directories});if(a.length===0)break;f$(a,"SIGKILL",r),await l$(50)}return Array.from(r.values())}s(p$,"killProcessesWithCwdUnder");var
|
|
391
|
+
${o} chmod 600 ${v(n)}`);if(a.code!==0)throw new I(`writing ${e.name}'s library source on ${r.name} failed: ${(a.stderr||a.stdout).trim()}`);return`library source: ${r.name} mirrors ${t.type}: ${t.path} for ${e.name} (every minute)`}var Yp,Qp,Kp,Vn,Ar,Zt,ed,vs=z(()=>{"use strict";Rt();Ve();Fe();Yp="/etc/orbit/server";s(_y,"repoDir");Qp=new Map;s(td,"useServerRecord");s(Un,"serverOf");s(zs,"onHostItself");s(Bn,"onHost");s(Yx,"serverProxyCommand");Kp="/var/lib/orbit/library",Vn="/var/lib/orbit/shares",Ar="/home/orbit/OrbitData/bucket",Zt="orbit-library",ed="/var/lib/orbit/library-sources";s(Qx,"hostLibrarySource")});import{spawn as m0}from"node:child_process";import{existsSync as ud,readFileSync as h0}from"node:fs";import{mkdir as g0,rm as id,writeFile as sd}from"node:fs/promises";import{dirname as ad,join as Cr}from"node:path";it();it();it();var $$=Fy(Gg());import ck from"node:path";import{AsyncLocalStorage as o$}from"node:async_hooks";import{availableParallelism as mk}from"node:os";import{lstat as vk,readdir as kk,readlink as xk,realpath as Sk}from"node:fs/promises";import{basename as a$,dirname as c$,join as zk,resolve as Pk,sep as Ik}from"node:path";import{execFile as Rk}from"node:child_process";import{promisify as Zk}from"node:util";function d$(e){return{experimental_apiVersion:1,contract:e.contract,handlers:e.handlers,...e.experimental_signals===void 0?{}:{experimental_signals:e.experimental_signals},...e.dispose===void 0?{}:{dispose:e.dispose}}}s(d$,"experimental_defineHostEntry");function Hv(e){if(e.length===0)return!1;let t=e.replaceAll("\\","/"),r=/^[a-zA-Z]:\//u.exec(t),n=r?t.slice(r[0].length):t.slice(1);return!r&&!t.startsWith("/")?!1:n.split("/").every(o=>o!==""&&o!=="."&&o!=="..")}s(Hv,"isAbsoluteProviderSkillRootPath");function m$(e){if(e.length===0)return!1;let t=e.replaceAll("\\","/");return!t.startsWith("/")&&!/^[a-zA-Z]:\//u.test(t)&&t.split("/").every(r=>r!==""&&r!=="."&&r!=="..")}s(m$,"isRelativeProviderSkillRootPath");var Gv=32,Xv=/^[A-Za-z0-9][A-Za-z0-9._-]{0,62}:$/u,zp=$.string().refine(e=>e===""||Xv.test(e),"A root name prefix is a plugin-name-like token ending in ':'"),Pp=$.string().min(1).refine(m$,"A manifest marker is a relative path without dot segments"),Yv=$.string().min(1).refine(m$,"Roots must be relative paths without dot segments"),Qv=$.string().min(1).refine(Hv,"Absolute roots must be absolute paths without dot segments"),Xg=$.union([$.string().min(1),$.object({path:$.string().min(1),recursive:$.boolean().optional(),ancestors:$.boolean().optional(),namePrefix:zp.optional(),skipIfManifest:Pp.optional()}).strict()]),Vz=$.object({user:$.array(Xg).optional(),project:$.array(Xg).optional()}).strict(),ek=$.object({path:$.string().min(1),recursive:$.boolean(),ancestors:$.boolean(),namePrefix:zp,skipIfManifest:Pp.optional()}).strict();function tk(e){return new Set(e.map(t=>t.path)).size===e.length}s(tk,"uniqueByPath");function Yg(e){return $.array(ek.extend({path:Yv}).superRefine((t,r)=>{t.ancestors&&e!=="project"&&r.addIssue({code:"custom",message:"Only project roots may walk ancestors"})})).max(Gv).refine(tk,"Roots must not repeat a path")}s(Yg,"nativeRootSideSchema");var Qg=$.object({user:Yg("user"),project:Yg("project")}).strict(),Uz=Object.freeze({user:Object.freeze([]),project:Object.freeze([])}),rk=$.enum(["skills","skill","skill-file","commands","command-file"]),h$=$.object({path:Qv,origin:$.enum(["user","project"]),recursive:$.boolean(),ancestors:$.boolean(),namePrefix:zp,shape:rk,fallbackName:$.string().min(1).optional(),skipIfManifest:Pp.optional()}).strict(),e$=h$.superRefine((e,t)=>{e.skipIfManifest!==void 0&&e.shape!=="skills"&&t.addIssue({code:"custom",message:"Only a skills root carries a manifest marker"}),e.ancestors&&e.origin!=="project"&&t.addIssue({code:"custom",message:"Only project roots may walk ancestors"}),e.fallbackName!==void 0&&e.shape!=="skill-file"&&t.addIssue({code:"custom",message:"Only a skill-file root carries a fallback name"})}),t$=h$.partial({recursive:!0,ancestors:!0,namePrefix:!0,shape:!0});function r$(e,t){return{path:e.path,origin:e.origin,recursive:e.recursive??!1,ancestors:e.ancestors??!1,namePrefix:e.namePrefix??"",shape:e.shape??(t==="skills"?"skills":"commands"),...e.fallbackName===void 0?{}:{fallbackName:e.fallbackName},...t==="skills"&&e.skipIfManifest!==void 0?{skipIfManifest:e.skipIfManifest}:{}}}s(r$,"normalizeProviderResolvedNativeRoot");var nk=new Set(["skills","skill","skill-file"]),ok=new Set(["commands","command-file"]),cs=256,g$=$.object({skills:$.array(e$.refine(e=>nk.has(e.shape),"A skills root needs a skill shape")).max(cs),commands:$.array(e$.refine(e=>ok.has(e.shape),"A commands root needs a command shape")).max(cs)}).strict(),Bz=Object.freeze({skills:Object.freeze([]),commands:Object.freeze([])}),Kz=$.object({skills:Qg,commands:Qg,resolved:g$}).strict(),ik=Symbol.for("@get-bb/plugin-sdk/rpc-refusal"),Jz=class extends Error{static{s(this,"experimental_PluginRpcRefusal")}[ik]=!0;code;issues;constructor(e){super(e.message),this.name="experimental_PluginRpcRefusal",this.code=e.code,this.issues=e.issues}};var sk=$.object({providerId:$.string().min(1),cwd:$.string().min(1).nullable()}).strict(),ak=$.object({skills:$.array(t$).optional(),commands:$.array(t$).optional()}).strict().transform(e=>({skills:(e.skills??[]).slice(0,cs).map(t=>r$(t,"skills")),commands:(e.commands??[]).slice(0,cs).map(t=>r$(t,"commands"))})).pipe(g$);var Wz={resolveNativeRoots:{input:sk,output:ak}};var Gz=ck.join(".claude-plugin","plugin.json");var uk=$.enum(["managed","project","local","user"]),Xz=$.object({enabledPlugins:$.record($.string(),$.boolean()).optional()}).passthrough(),lk=$.object({gitCommitSha:$.string().nullable().optional(),installPath:$.string().min(1),scope:uk}).passthrough(),Yz=$.object({plugins:$.record($.string(),$.array(lk))}).passthrough(),n$=$.union([$.string(),$.array($.string())]),Qz=$.object({name:$.string().min(1).optional(),defaultEnabled:$.boolean().optional(),skills:n$.optional(),commands:n$.optional()}).passthrough();function fk(e){return(0,$$.default)(e.command,e.args,{cwd:e.cwd,detached:e.detached,env:e.env,stdio:e.stdio,windowsHide:!0})}s(fk,"spawnPortableProcess");function pk(e){if(e.stdin||!e.stdout||!e.stderr)throw new Error("Portable child process did not attach output-only stdio")}s(pk,"assertPortableOutputProcess");function dk(e){let t=fk({...e,stdio:["ignore","pipe","pipe"]});return pk(t),t}s(dk,"spawnPortableOutputProcess");var i$={interactive:0,status:1,background:2};function hk(e){let t=Math.min(6,Math.max(4,e-2));return[t,t-1,t-2]}s(hk,"localProcessCapacities");var s$={local:hk(mk()),network:[4,3,2]},gk=2,Sp=15e3,$k=new Set(["fetch","pull","push","clone","ls-remote"]),yk=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--config-env"]);function bk(e){let t=0;for(;t<e.length&&e[t].startsWith("-");)t+=yk.has(e[t])?2:1;let r=e[t];if(r===void 0)return!1;if($k.has(r))return!0;let n=e.slice(t+1).find(o=>!o.startsWith("-"));return(r==="submodule"||r==="remote")&&n==="update"}s(bk,"isNetworkGitCommand");var wk=class{static{s(this,"VcsProcessScheduler")}priority=new o$;admitted=new o$;active={local:0,network:0};githubActive=0;queue=[];timer;acquire(e,t,r){let n=e==="gh"||bk(t)?"network":"local",o=r.slots??1;return!Number.isInteger(o)||o<1||o>s$[n][i$.background]?Promise.reject(new Error("Invalid VCS process slot count")):r.signal?.aborted?Promise.reject(this.abortError(r.signal)):new Promise((i,a)=>{let c={command:e,pool:n,priority:r.priority??this.priority.getStore()??"status",slots:o,queuedAt:performance.now(),signal:r.signal,grant:i,onAbort:s(()=>{let u=this.queue.indexOf(c);u!==-1&&(this.queue.splice(u,1),a(this.abortError(r.signal)),this.drain())},"onAbort")};this.queue.push(c),r.signal?.addEventListener("abort",c.onAbort,{once:!0}),this.drain()})}abortError(e){return Object.assign(new Error("The operation was aborted",{cause:e?.reason}),{name:"AbortError",code:"ABORT_ERR"})}rank(e){return Math.max(0,i$[e.priority]-Math.floor((performance.now()-e.queuedAt)/Sp))}drain(){clearTimeout(this.timer),this.queue.sort((t,r)=>this.rank(t)-this.rank(r)||t.queuedAt-r.queuedAt);let e=new Set;for(let t=0;t<this.queue.length;){let r=this.queue[t];if(e.has(r.pool)||r.command==="gh"&&this.githubActive+r.slots>gk){t+=1;continue}if(this.active[r.pool]+r.slots>s$[r.pool][this.rank(r)]){e.add(r.pool),t+=1;continue}this.queue.splice(t,1),r.signal?.removeEventListener("abort",r.onAbort),this.active[r.pool]+=r.slots,r.command==="gh"&&(this.githubActive+=r.slots);let n=!1;r.grant(()=>{n||(n=!0,this.active[r.pool]-=r.slots,r.command==="gh"&&(this.githubActive-=r.slots),this.drain())})}if(this.queue.length>0){let t=Math.min(...this.queue.map(r=>Sp-(performance.now()-r.queuedAt)%Sp));this.timer=setTimeout(()=>this.drain(),t)}}},_k=globalThis,rP=_k.__bbVcsProcessScheduler??=new wk;function Ak(e,t){let r=e.endsWith(" (deleted)")?e.slice(0,-10):e;return r===t||r.startsWith(`${t}${Ik}`)}s(Ak,"isPathUnderDirectory");async function Ok(){let e=await kk("/proc"),t=[];return await Promise.all(e.map(async r=>{if(/^\d+$/.test(r))try{let n=await xk(`/proc/${r}/cwd`);t.push({pid:Number(r),cwd:n})}catch{}})),t}s(Ok,"listLinuxProcessCwds");async function Ck(){let e=dk({command:"lsof",args:["-a","-d","cwd","-F","pn","-w","-n"]}),t=[];e.stdout.on("data",o=>t.push(Buffer.from(o))),e.stderr.resume(),await new Promise(o=>{e.once("error",()=>o()),e.once("exit",()=>o())});let r=[],n=null;for(let o of Buffer.concat(t).toString("utf8").split(`
|
|
392
|
+
`))o.startsWith("p")?n=Number(o.slice(1)):o.startsWith("n")&&n!==null&&r.push({pid:n,cwd:o.slice(1)});return r}s(Ck,"listLsofProcessCwds");async function Ek(e){let t=Pk(e),r=c$(t),n=[a$(t)];for(;;){try{r=await Sk(r);break}catch{}let i=c$(r);if(i===r)break;n.unshift(a$(r)),r=i}let o=zk(r,...n);try{if((await vk(o)).isSymbolicLink())return null}catch{}return o}s(Ek,"resolveSweepDirectory");async function u$(e){if(process.platform==="win32")return[];let t=(await Promise.all(e.directories.map(Ek))).filter(n=>n!==null);return t.length===0?[]:(process.platform==="linux"?await Ok():await Ck()).filter(n=>n.pid!==process.pid&&t.some(o=>Ak(n.cwd,o)))}s(u$,"listProcessesWithCwdUnder");function Tk(e){try{return process.kill(e,0),!0}catch{return!1}}s(Tk,"isProcessAlive");async function l$(e){await new Promise(t=>setTimeout(t,e))}s(l$,"delay");var Nk=5;function f$(e,t,r){for(let n of e)try{process.kill(n.pid,t),r.set(n.pid,n)}catch{}}s(f$,"signalProcesses");async function p$(e){let t=e.graceMs??2e3,r=new Map;for(let n=0;n<Nk;n+=1){let o=await u$({directories:e.directories});if(o.length===0)break;f$(o,"SIGTERM",r);let i=Date.now()+t;for(;Date.now()<i&&o.some(c=>Tk(c.pid));)await l$(50);let a=await u$({directories:e.directories});if(a.length===0)break;f$(a,"SIGKILL",r),await l$(50)}return Array.from(r.values())}s(p$,"killProcessesWithCwdUnder");var aP=Zk(Rk);function y$(e){return"directory"in e&&typeof e.directory=="string"?p$({...e,directories:[e.directory]}):p$(e)}s(y$,"experimental_killProcessesWithCwdUnder");Rt();vs();Ve();Ce();Ve();import{spawn as e0}from"node:child_process";import{existsSync as t0}from"node:fs";import{mkdir as r0,readFile as n0,rm as ky,writeFile as o0}from"node:fs/promises";import{join as Is}from"node:path";var xy="orbit-tunnel-up",vy=[2e3,5e3,15e3,3e4,6e4];function Sy(e){if(!e.tunnel)throw new I(`${e.name} has no \`tunnel\` in its file: the gate's address from this machine`);let t=Number(e.tunnel.slice(e.tunnel.lastIndexOf(":")+1));return{gate:e.tunnel,port:t}}s(Sy,"tunnelEnds");function i0(e,t,r=Gp(e)){let{gate:n,port:o}=Sy(e);return["-N","-o","ExitOnForwardFailure=yes","-o","ServerAliveInterval=15","-o","ServerAliveCountMax=3","-o","PermitLocalCommand=yes","-o",`LocalCommand=echo ${xy}`,"-R",`127.0.0.1:${o}:${n}`,...lt(r),`${e.admin_user}@${t}`]}s(i0,"tunnelArgs");var Ps=Is(re,"tunnels");async function s0(e){let t=Is(Ps,`${e.name}.pid`);if(!t0(t))return;let r=Number((await n0(t,"utf8")).trim());if(await ky(t,{force:!0}),!Number.isInteger(r)||r<=1)return;let n=await ue("ps",["-o","command=","-p",String(r)]);if(!(n.code!==0||!n.stdout.includes(`-R 127.0.0.1:${Sy(e).port}:`)))try{process.kill(r,"SIGTERM")}catch{}}s(s0,"endStale");var As=class{static{s(this,"Tunnel")}config;log;child;wanted=!1;failures=0;timer;current={state:"off",since:Date.now(),detail:""};constructor(t,r=()=>{}){this.config=t,this.log=n=>r(_e(n))}get status(){return this.current}set(t,r){(this.current.state!==t||this.current.detail!==r)&&(this.current={state:t,since:Date.now(),detail:_e(r)})}start(){this.wanted||(this.wanted=!0,this.attempt())}async stop(){this.wanted=!1,clearTimeout(this.timer);let t=this.child;this.child=void 0,t&&t.exitCode===null&&await new Promise(r=>{t.once("close",()=>r()),t.kill("SIGTERM")}),await ky(Is(Ps,`${this.config.name}.pid`),{force:!0}),this.set("off","")}retry(t){if(!this.wanted)return;this.set("down",t);let r=vy[Math.min(this.failures,vy.length-1)];this.failures+=1,this.log(`${this.config.name}: tunnel down (${t}); again in ${Math.round(r/1e3)} s`),this.timer=setTimeout(()=>{this.attempt()},r)}async attempt(){if(!this.wanted)return;this.set("connecting","");let t,r;try{let i=await Or(this.config);if(!i)return this.retry(`${this.config.name} has no VM`);if(i.status!=="running")return this.retry(`${this.config.name} is ${i.status}`);if(t=i.id??i.ipAddress??"",!t)return this.retry(`${this.config.name} has no address yet`);r=await xs(this.config)}catch(i){return this.retry(i.message)}await s0(this.config),await r0(Ps,{recursive:!0,mode:448});let n=e0("ssh",i0(this.config,t,r),{stdio:["ignore","pipe","pipe"]});this.child=n,n.pid&&await o0(Is(Ps,`${this.config.name}.pid`),`${n.pid}
|
|
393
393
|
`,{mode:384});let o="";n.stdout?.on("data",i=>{i.toString().includes(xy)&&(this.failures=0,this.set("up",t),this.log(`${this.config.name}: tunnel up through ${t}`))}),n.stderr?.on("data",i=>o=o+i.toString()),n.on("error",i=>{this.child===n&&(this.child=void 0),this.retry(i.message)}),n.on("close",(i,a)=>{if(this.child!==n)return;this.child=void 0;let u=_e(o).slice(-2e3).trim().split(`
|
|
394
|
-
`).filter(l=>!/^Warning: Permanently added/.test(l)).pop()??"";this.retry(u||`ssh exited ${a??i}`)})}};Rt();it();it();var Os=$.object({repository:$.string().regex(/^[A-Za-z0-9_-][A-Za-z0-9_.-]*\/[A-Za-z0-9_-][A-Za-z0-9_.-]*$/),revision:$.string().regex(/^[0-9a-f]{40}$/)}).strict();var Jn=zr,Wn=Nt.optional(),a0=$.object({code:$.number(),stdout:$.string(),stderr:$.string()}),rd=$.object({config:Jn,server:Wn,policy:$.string().max(1e6),dryRun:$.boolean(),owner:$.string().max(60).optional(),revision:$.string().regex(/^[0-9a-f]{40}$/).optional()}),nd=$.object({code:$.number(),output:$.string()}),zy={"job.stop":{input:$.object({path:$.string().regex(/^\/(?:home|Users)\/[A-Za-z_][A-Za-z0-9_-]*\/OrbitData\/workspaces\/job-[a-f0-9]{32}$/)}).strict(),output:$.null()},"station.ready":{input:$.null(),output:$.object({hasKey:$.boolean()})},"station.vm":{input:$.object({config:Jn,server:Wn}),output:$.object({status:$.string(),ipAddress:$.string().optional()}).nullable()},"station.exec":{input:$.object({config:Jn,server:Wn,as:$.enum(["root","admin","orbit"]),script:$.string(),waitSeconds:$.number().int().min(0).max(900).optional()}),output:a0},"station.applyPolicy":{input:rd,output:nd},"station.applyPolicyDrained":{input:rd,output:nd},"station.applyPolicyManaged":{input:rd.omit({revision:!0}).extend({source:Os}),output:nd},"station.tunnel":{input:$.object({config:Jn,server:Wn,up:$.boolean()}),output:$.object({state:$.enum(["off","connecting","up","down"]),since:$.number(),detail:$.string()})},"station.run":{input:$.object({config:Jn,server:Wn,argv:$.array($.string()).min(1),stdin:$.string(),timeoutMs:$.number().int().positive()}),output:$.object({code:$.number(),output:$.string()})}};var qn="/usr/local/orbit",
|
|
395
|
-
`),"orbit-release",e,t,r]}s(
|
|
396
|
-
`).at(-1)??"":b}))});if(d.code!==0)return{code:d.code,output:`couldn't prepare a checkout at ${a}: ${d.output}`};p=d.output}return Ey(p,{config:t,server:r,policy:n,dryRun:o,owner:i,revision:a},c,e)}}s(Oy,"policyHandler");async function Ey(e,{config:t,server:r,policy:n,dryRun:o,owner:i,revision:a},c,u,l){let f=Lt(t,r),p=process.env.SHELL||"/bin/zsh",d=`${process.pid}-${Date.now()}`,m=Cr(l?ad(e):c.experimental_paths.tempDir,`policy-${d}.toml`),g=Cr(l?ad(e):c.experimental_paths.tempDir,`station-${d}.json`);await sd(m,n,{mode:384}),await sd(g,JSON.stringify(f),{mode:384});let y=r!==void 0&&f.server?Cr(l?ad(e):c.experimental_paths.tempDir,`server-${d}.json`):void 0;y&&await sd(y,JSON.stringify(r),{mode:384});try{let b
|
|
394
|
+
`).filter(l=>!/^Warning: Permanently added/.test(l)).pop()??"";this.retry(u||`ssh exited ${a??i}`)})}};Rt();it();it();var Os=$.object({repository:$.string().regex(/^[A-Za-z0-9_-][A-Za-z0-9_.-]*\/[A-Za-z0-9_-][A-Za-z0-9_.-]*$/),revision:$.string().regex(/^[0-9a-f]{40}$/)}).strict();var Jn=zr,Wn=Nt.optional(),a0=$.object({code:$.number(),stdout:$.string(),stderr:$.string()}),rd=$.object({config:Jn,server:Wn,policy:$.string().max(1e6),dryRun:$.boolean(),owner:$.string().max(60).optional(),revision:$.string().regex(/^[0-9a-f]{40}$/).optional()}),nd=$.object({code:$.number(),output:$.string()}),zy={"job.stop":{input:$.object({path:$.string().regex(/^\/(?:home|Users)\/[A-Za-z_][A-Za-z0-9_-]*\/OrbitData\/workspaces\/job-[a-f0-9]{32}$/)}).strict(),output:$.null()},"station.ready":{input:$.null(),output:$.object({hasKey:$.boolean()})},"station.vm":{input:$.object({config:Jn,server:Wn}),output:$.object({status:$.string(),ipAddress:$.string().optional()}).nullable()},"station.exec":{input:$.object({config:Jn,server:Wn,as:$.enum(["root","admin","orbit"]),script:$.string(),waitSeconds:$.number().int().min(0).max(900).optional()}),output:a0},"station.applyPolicy":{input:rd,output:nd},"station.applyPolicyDrained":{input:rd,output:nd},"station.applyPolicyManaged":{input:rd.omit({revision:!0}).extend({source:Os}),output:nd},"station.tunnel":{input:$.object({config:Jn,server:Wn,up:$.boolean()}),output:$.object({state:$.enum(["off","connecting","up","down"]),since:$.number(),detail:$.string()})},"station.run":{input:$.object({config:Jn,server:Wn,argv:$.array($.string()).min(1),stdin:$.string(),timeoutMs:$.number().int().positive()}),output:$.object({code:$.number(),output:$.string()})}};var qn="/usr/local/orbit",qA=`${qn}/bin`,Cs=`${qn}/etc`,HA=`${qn}/sbin`,GA=`${Cs}/capabilities.toml`,XA=`${Cs}/policy`,YA=`${Cs}/policy-applied`,QA=`${Cs}/identity.json`,eO=`${qn}/front`,tO=`${qn}/back`,ft="/var/db/orbit",rO=`${ft}/broker/broker.sock`,nO=`${ft}/keys`,oO=`${ft}/exchange`,iO=`${ft}/signin`,sO=`${ft}/bridge-signin`,aO=`${ft}/relay`,cO=`${ft}/desklink`;var uO=`${ft}/deploy`;var od={usage:64,dataErr:65,unavailable:69,software:70,refused:77};import{spawn as c0}from"node:child_process";import{mkdir as u0,mkdtemp as l0,rm as f0}from"node:fs/promises";import{join as Py}from"node:path";import{Readable as p0}from"node:stream";import{setTimeout as Iy}from"node:timers/promises";var pt=class extends Error{static{s(this,"SourceStillInUse")}};function Hn(e){try{return process.kill(-e,0),!0}catch(t){if(t instanceof Error&&"code"in t&&t.code==="ESRCH")return!1;throw new pt("The source checkout is still in use; its files were kept.")}}s(Hn,"groupExists");function Es(e,t){try{process.kill(-e,t)}catch(r){if(!(r instanceof Error&&"code"in r&&r.code==="ESRCH"))throw new pt("The source checkout is still in use; its files were kept.")}}s(Es,"stopGroup");var d0=s(async(e,t,r,n)=>{n.throwIfAborted();let o=process.env.SHELL||(process.platform==="linux"?"/bin/bash":"/bin/zsh"),i=c0(o,["-lc",'exec "$@" >&3 3>&-',"station-source",e,...t],{cwd:r,detached:!0,stdio:["ignore","ignore","pipe","pipe"],env:{...process.env,GIT_TERMINAL_PROMPT:"0",GH_PROMPT_DISABLED:"1",GH_DEBUG:"",GIT_TRACE:"0",GIT_TRACE_CURL:"0",GIT_TRACE_PACKET:"0",GIT_TRACE_REDACT:"1",GIT_CURL_VERBOSE:"0",ORBIT_FIXED_GIT_CREDENTIAL_COMMAND:"!gh auth git-credential"}}),a="",c="",u="",l=!1;i.once("error",b=>{l=!0,c=b.message,u=b.message});let f=i.stdio[3];if(!(f instanceof p0)||!i.stderr)throw i.pid&&Es(i.pid,"SIGKILL"),new pt("The source command could not be attached; its files were kept.");f.on("data",b=>{a=(a+b.toString("utf8")).slice(-1e5),u=(u+b.toString("utf8")).slice(-1e5)}),i.stderr.on("data",b=>{c=(c+b.toString("utf8")).slice(-1e5),u=(u+b.toString("utf8")).slice(-1e5)});let p,d,m=s(b=>{if(i.pid)try{Es(i.pid,b)}catch{d=new pt("The source checkout is still in use; its files were kept.")}},"stopSafely"),g=s(()=>{i.pid&&(m("SIGTERM"),p=setTimeout(()=>m("SIGKILL"),5e3))},"stop");n.addEventListener("abort",g,{once:!0}),n.aborted&&g();let y=await new Promise(b=>{i.once("close",x=>b(l?127:x??1))});if(n.removeEventListener("abort",g),p&&clearTimeout(p),d)throw d;if(i.pid&&Hn(i.pid)){Es(i.pid,"SIGTERM");for(let b=0;b<50&&Hn(i.pid);b++)await Iy(100);if(Hn(i.pid)){Es(i.pid,"SIGKILL");for(let b=0;b<50&&Hn(i.pid);b++)await Iy(100)}if(Hn(i.pid))throw new pt("The source checkout is still in use; its files were kept.")}return n.throwIfAborted(),{code:y,stdout:a,stderr:c,output:u}},"runManagedSourceCommand");async function Ay(e,t,r,n,o=d0){let i=Os.parse(t);r.throwIfAborted();let a=await l0(Py(e,"station-source-")),c=Py(a,"checkout"),u=!0;try{await u0(c,{mode:448});let l=s(async p=>{r.throwIfAborted();let d=await o("git",["-c","core.hooksPath=/dev/null",...p],c,r);if(d.code!==0){let m=p.find(g=>["init","remote","fetch","checkout","rev-parse","status"].includes(g))??"prepare";throw new Error(`Automatic delivery couldn't prepare its source: git ${m} exited ${d.code}.`)}return d.stdout.trim()},"checked");if(await l(["init","--quiet","--template="]),await l(["remote","add","origin",`https://github.com/${i.repository}.git`]),await l(["-c","credential.helper=","--config-env=credential.helper=ORBIT_FIXED_GIT_CREDENTIAL_COMMAND","-c","credential.useHttpPath=true","-c","protocol.file.allow=never","fetch","--quiet","--depth=1","--no-tags","origin",i.revision]),await l(["checkout","--quiet","--detach","FETCH_HEAD"]),await l(["rev-parse","HEAD"])!==i.revision)throw new Error("Automatic delivery's source revision changed.");if(await l(["status","--porcelain"]))throw new Error("Automatic delivery's source checkout changed.");let f=await o("pnpm",["install","--frozen-lockfile","--ignore-scripts"],c,r);if(f.code!==0)throw new Error(`Automatic delivery couldn't prepare its dependencies: pnpm exited ${f.code}.`);if(await l(["rev-parse","HEAD"])!==i.revision||await l(["status","--porcelain"]))throw new Error("Automatic delivery's prepared source changed.");if(await l(["remote","get-url","origin"])!==`https://github.com/${i.repository}.git`)throw new Error("Automatic delivery's source repository changed.");return r.throwIfAborted(),await n(c,o)}catch(l){throw l instanceof pt&&(u=!1),l}finally{u&&await f0(a,{recursive:!0,force:!0})}}s(Ay,"withManagedSource");function $0(e){return["-lc",'cd "$1" && exec pnpm -s orbit station policy --station "$2" --policy-file "$3" --station-record "$4" ${5:+"$5"} ${6:+--owner="$6"} ${7:+--expect-commit="$7"} ${8:+--bundle="$8"} ${9:+--server-record="$9"} ${10:+--require-drain} ${11:+--transient-checkout}',"orbit",e.repo,e.station,e.policyFile,e.recordFile,e.dryRun?"--dry-run":"",e.owner??"",e.revision??"",e.os==="linux"?"ci":"",e.serverRecordFile??"",e.requireDrain?"required":"",e.transientCheckout?"transient":""]}s($0,"policyApplyArgs");function y0(e,t,r){return["-lc",["set -eu",'repo="$(dirname "$(git -C "$1" rev-parse --path-format=absolute --git-common-dir)")"; root="$2"; rev="$3"; dir="$root/$rev"','mkdir -p "$root"','if [ -d "$dir" ] && [ "$(git -C "$dir" rev-parse HEAD 2>/dev/null)" = "$rev" ] && [ -z "$(git -C "$dir" status --porcelain 2>/dev/null)" ] && [ -f "$root/.ready-$rev" ]; then echo "$dir"; exit 0; fi','rm -f "$root/.ready-$rev"','if [ -d "$dir" ]; then git -C "$repo" worktree remove --force "$dir" >/dev/null 2>&1 || rm -rf "$dir"; fi','git -C "$repo" worktree prune','git -C "$repo" cat-file -e "$rev^{commit}" 2>/dev/null || git -C "$repo" fetch --quiet origin "$rev"','git -C "$repo" worktree add --quiet --detach "$dir" "$rev" >&2','(cd "$dir" && pnpm install --frozen-lockfile --ignore-scripts >&2)','touch "$root/.ready-$rev"','for old in $(ls -1t "$root" | grep -v "^\\." | tail -n +3); do git -C "$repo" worktree remove --force "$root/$old" >/dev/null 2>&1 || rm -rf "$root/$old"; rm -f "$root/.ready-$old"; done','echo "$dir"'].join(`
|
|
395
|
+
`),"orbit-release",e,t,r]}s(y0,"releaseCheckoutArgs");var cd=new Map;function Cy(e,t,r){let n=m0(e,t,{detached:!0,stdio:["ignore","pipe","pipe"]}),o=s(a=>{if(n.pid!==void 0)try{process.kill(-n.pid,a)}catch{return}},"stopGroup"),i=s(()=>{o("SIGTERM"),setTimeout(()=>o("SIGKILL"),5e3).unref()},"stop");return r.addEventListener("abort",i,{once:!0}),r.aborted&&i(),n}s(Cy,"spawnStoppable");function Lt(e,t){let r=zr.parse(e);return r.server&&td(r.server,t===void 0?void 0:Nt.parse(t)),r}s(Lt,"stationFrom");function Oy(e){return async({config:t,server:r,policy:n,dryRun:o,owner:i,revision:a},c)=>{Lt(t,r);let u=Cr(re,"repo"),l=ud(u)?h0(u,"utf8").trim():"";if(!l||!["moonlet-cli","orbit-cli"].some(d=>ud(Cr(l,"packages",d))))return{code:od.unavailable,output:"this machine has no Orbit repository on record: run any `pnpm orbit \u2026` command in it once"};let f=process.env.SHELL||"/bin/zsh",p=l;if(a){let d=await new Promise(m=>{let g=Cy(f,y0(l,Cr(re,"releases"),a),c.signal),y="",b="";g.stdout.on("data",x=>y+=x.toString("utf8")),g.stderr.on("data",x=>b=(b+x.toString("utf8")).slice(-2e4)),g.on("error",x=>m({code:127,output:x.message})),g.on("close",x=>m({code:x??1,output:x===0?y.trim().split(`
|
|
396
|
+
`).at(-1)??"":b}))});if(d.code!==0)return{code:d.code,output:`couldn't prepare a checkout at ${a}: ${d.output}`};p=d.output}return Ey(p,{config:t,server:r,policy:n,dryRun:o,owner:i,revision:a},c,e)}}s(Oy,"policyHandler");async function Ey(e,{config:t,server:r,policy:n,dryRun:o,owner:i,revision:a},c,u,l){let f=Lt(t,r),p=process.env.SHELL||"/bin/zsh",d=`${process.pid}-${Date.now()}`,m=Cr(l?ad(e):c.experimental_paths.tempDir,`policy-${d}.toml`),g=Cr(l?ad(e):c.experimental_paths.tempDir,`station-${d}.json`);await sd(m,n,{mode:384}),await sd(g,JSON.stringify(f),{mode:384});let y=r!==void 0&&f.server?Cr(l?ad(e):c.experimental_paths.tempDir,`server-${d}.json`):void 0;y&&await sd(y,JSON.stringify(r),{mode:384});try{let b=$0({repo:e,station:f.name,policyFile:m,recordFile:g,...y?{serverRecordFile:y}:{},dryRun:o,owner:i,revision:a,os:f.os,requireDrain:u,transientCheckout:!!l});if(l){let x=await l(p,b,e,c.signal);return{code:x.code,output:x.output}}return await new Promise(x=>{let k=Cy(p,b,c.signal),O="",Z=s(L=>O=(O+L.toString("utf8")).slice(-1e5),"keep");k.stdout.on("data",Z),k.stderr.on("data",Z),k.on("error",L=>x({code:127,output:L.message})),k.on("close",L=>x({code:L??1,output:O}))})}finally{l||(await id(m,{force:!0}),await id(g,{force:!0}),y&&await id(y,{force:!0}))}}s(Ey,"applyPreparedPolicy");var b0=s(async({source:e,...t},r)=>{Lt(t.config,t.server);try{return await g0(r.experimental_paths.dataDir,{recursive:!0,mode:448}),await Ay(r.experimental_paths.dataDir,e,r.signal,(n,o)=>Ey(n,{...t,revision:e.revision},r,!0,o))}catch(n){return{code:od.unavailable,output:n instanceof Error?n.message:"Automatic station delivery couldn't prepare its source."}}},"managedPolicyHandler"),CO=d$({contract:zy,handlers:{"job.stop":s(async({path:e})=>(await y$({directories:[e]}),null),"job.stop"),"station.ready":s(()=>({hasKey:ud(ce)}),"station.ready"),"station.vm":s(async e=>{let t=Lt(e.config,e.server),r=await Or(t);return r?{status:r.status,...r.ipAddress?{ipAddress:r.ipAddress}:{}}:null},"station.vm"),"station.exec":s(async({config:e,server:t,as:r,script:n,waitSeconds:o})=>{let i=Lt(e,t),a=o?await ve.waitFor(i,o):await ve.connect(i);return a?a.exec({as:r,script:n}):{code:255,stdout:"",stderr:`${i.name} didn't answer ssh within ${o} s`}},"station.exec"),"station.applyPolicy":Oy(!1),"station.applyPolicyDrained":Oy(!0),"station.applyPolicyManaged":b0,"station.tunnel":s(async({config:e,server:t,up:r})=>{let n=Lt(e,t),o=cd.get(n.name);return r?(o&&o.config.tunnel!==n.tunnel&&(await o.stop(),o=void 0),o||(o=new As(n,i=>console.error(`orbit tunnel: ${i}`)),cd.set(n.name,o),o.start()),o.status):(o&&(await o.stop(),cd.delete(n.name)),{state:"off",since:Date.now(),detail:""})},"station.tunnel"),"station.run":s(async({config:e,server:t,argv:r,stdin:n,timeoutMs:o},i)=>{let a=Lt(e,t),c=await ve.connect(a),u="";return{code:await c.run({argv:r,stdin:n,timeoutMs:o,signal:i.signal,onOutput:s(f=>u+=f,"onOutput")}),output:u.slice(-2e5)}},"station.run")}});export{CO as default,b0 as managedPolicyHandler,$0 as policyApplyArgs,y0 as releaseCheckoutArgs,Cy as spawnStoppable,Lt as stationFrom};
|
|
397
397
|
/*! Bundled license information:
|
|
398
398
|
|
|
399
399
|
smol-toml/dist/error.js:
|