bb-plugin-svaib-workplace 0.5.5 → 0.5.6

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/host.js CHANGED
@@ -4,12 +4,12 @@ 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 Tg=Object.create;var dr=Object.defineProperty;var Zg=Object.getOwnPropertyDescriptor;var Dg=Object.getOwnPropertyNames;var Rg=Object.getPrototypeOf,Lg=Object.prototype.hasOwnProperty;var s=(e,t)=>dr(e,"name",{value:t,configurable:!0}),Ce=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ue=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},ke=(e,t)=>{for(var n in t)dr(e,n,{get:t[n],enumerable:!0})},jg=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Dg(t))!Lg.call(e,o)&&o!==n&&dr(e,o,{get:()=>t[o],enumerable:!(r=Zg(t,o))||r.enumerable});return e};var mr=(e,t,n)=>(n=e!=null?Tg(Rg(e)):{},jg(t||!e||!e.__esModule?dr(n,"default",{value:e,enumerable:!0}):n,e));var jm=ue((PS,Lm)=>{Lm.exports=Rm;Rm.sync=Sb;var Zm=Ce("fs");function kb(e,t){var n=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!n||(n=n.split(";"),n.indexOf("")!==-1))return!0;for(var r=0;r<n.length;r++){var o=n[r].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o)return!0}return!1}s(kb,"checkPathExt");function Dm(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:kb(t,n)}s(Dm,"checkStat");function Rm(e,t,n){Zm.stat(e,function(r,o){n(r,r?!1:Dm(o,e,t))})}s(Rm,"isexe");function Sb(e,t){return Dm(Zm.statSync(e),e,t)}s(Sb,"sync")});var Km=ue((OS,Um)=>{Um.exports=Fm;Fm.sync=Pb;var Mm=Ce("fs");function Fm(e,t,n){Mm.stat(e,function(r,o){n(r,r?!1:Vm(o,t))})}s(Fm,"isexe");function Pb(e,t){return Vm(Mm.statSync(e),t)}s(Pb,"sync");function Vm(e,t){return e.isFile()&&zb(e,t)}s(Vm,"checkStat");function zb(e,t){var n=e.mode,r=e.uid,o=e.gid,i=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),c=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),l=parseInt("001",8),f=a|u,p=n&l||n&u&&o===c||n&a&&r===i||n&f&&i===0;return p}s(zb,"checkMode")});var Bm=ue((AS,Hm)=>{var ES=Ce("fs"),bi;process.platform==="win32"||global.TESTING_WINDOWS?bi=jm():bi=Km();Hm.exports=lf;lf.sync=Ob;function lf(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,o){lf(e,t||{},function(i,c){i?o(i):r(c)})})}bi(e,t||{},function(r,o){r&&(r.code==="EACCES"||t&&t.ignoreErrors)&&(r=null,o=!1),n(r,o)})}s(lf,"isexe");function Ob(e,t){try{return bi.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}s(Ob,"sync")});var Qm=ue((CS,Ym)=>{var rn=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Jm=Ce("path"),Ib=rn?";":":",Wm=Bm(),qm=s(e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),"getNotFoundError"),Gm=s((e,t)=>{let n=t.colon||Ib,r=e.match(/\//)||rn&&e.match(/\\/)?[""]:[...rn?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],o=rn?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=rn?o.split(n):[""];return rn&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:r,pathExt:i,pathExtExe:o}},"getPathInfo"),Xm=s((e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});let{pathEnv:r,pathExt:o,pathExtExe:i}=Gm(e,t),c=[],a=s(l=>new Promise((f,p)=>{if(l===r.length)return t.all&&c.length?f(c):p(qm(e));let d=r[l],m=/^".*"$/.test(d)?d.slice(1,-1):d,g=Jm.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(a(f+1));let g=o[p];Wm(l+g,{pathExt:i},(y,b)=>{if(!y&&b)if(t.all)c.push(l+g);else return d(l+g);return d(u(l,f,p+1))})}),"subStep");return n?a(0).then(l=>n(null,l),n):a(0)},"which"),Eb=s((e,t)=>{t=t||{};let{pathEnv:n,pathExt:r,pathExtExe:o}=Gm(e,t),i=[];for(let c=0;c<n.length;c++){let a=n[c],u=/^".*"$/.test(a)?a.slice(1,-1):a,l=Jm.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let p=0;p<r.length;p++){let d=f+r[p];try{if(Wm.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 qm(e)},"whichSync");Ym.exports=Xm;Xm.sync=Eb});var th=ue((ZS,ff)=>{"use strict";var eh=s((e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"},"pathKey");ff.exports=eh;ff.exports.default=eh});var ih=ue((RS,oh)=>{"use strict";var nh=Ce("path"),Ab=Qm(),Nb=th();function rh(e,t){let n=e.options.env||process.env,r=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 c;try{c=Ab.sync(e.command,{path:n[Nb({env:n})],pathExt:t?nh.delimiter:void 0})}catch{}finally{i&&process.chdir(r)}return c&&(c=nh.resolve(o?e.options.cwd:"",c)),c}s(rh,"resolveCommandAttempt");function Cb(e){return rh(e)||rh(e,!0)}s(Cb,"resolveCommand");oh.exports=Cb});var sh=ue((jS,df)=>{"use strict";var pf=/([()\][%!^"`<>&|;, *?])/g;function Tb(e){return e=e.replace(pf,"^$1"),e}s(Tb,"escapeCommand");function Zb(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(pf,"^$1"),t&&(e=e.replace(pf,"^$1")),e}s(Zb,"escapeArgument");df.exports.command=Tb;df.exports.argument=Zb});var ah=ue((FS,ch)=>{"use strict";ch.exports=/^#!(.*)/});var lh=ue((VS,uh)=>{"use strict";var Db=ah();uh.exports=(e="")=>{let t=e.match(Db);if(!t)return null;let[n,r]=t[0].replace(/#! ?/,"").split(" "),o=n.split("/").pop();return o==="env"?r:r?`${o} ${r}`:o}});var ph=ue((US,fh)=>{"use strict";var mf=Ce("fs"),Rb=lh();function Lb(e){let n=Buffer.alloc(150),r;try{r=mf.openSync(e,"r"),mf.readSync(r,n,0,150,0),mf.closeSync(r)}catch{}return Rb(n.toString())}s(Lb,"readShebang");fh.exports=Lb});var vi=ue((HS,hh)=>{"use strict";var jb=Ce("path"),dh=ih(),mh=sh(),Mb=ph(),Fb=process.platform==="win32",Vb=/\.(?:com|exe)$/i,Ub=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Kb(e){e.file=dh(e);let t=e.file&&Mb(e.file);return t?(e.args.unshift(e.file),e.command=t,dh(e)):e.file}s(Kb,"detectShebang");function Hb(e){if(!Fb)return e;let t=Kb(e),n=!Vb.test(t);if(e.options.forceShell||n){let r=Ub.test(t);e.command=jb.normalize(e.command),e.command=mh.command(e.command),e.args=e.args.map(i=>mh.argument(i,r));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(Hb,"parseNonShell");function Bb(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:Hb(r)}s(Bb,"parse");hh.exports=Bb});var yh=ue((JS,_h)=>{"use strict";var hf=process.platform==="win32";function gf(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(gf,"notFoundError");function Jb(e,t){if(!hf)return;let n=e.emit;e.emit=function(r,o){if(r==="exit"){let i=gh(o,t);if(i)return n.call(e,"error",i)}return n.apply(e,arguments)}}s(Jb,"hookChildProcess");function gh(e,t){return hf&&e===1&&!t.file?gf(t.original,"spawn"):null}s(gh,"verifyENOENT");function Wb(e,t){return hf&&e===1&&!t.file?gf(t.original,"spawnSync"):null}s(Wb,"verifyENOENTSync");_h.exports={hookChildProcess:Jb,verifyENOENT:gh,verifyENOENTSync:Wb,notFoundError:gf}});var wf=ue((qS,on)=>{"use strict";var wh=Ce("child_process"),_f=vi(),yf=yh();function bh(e,t,n){let r=_f(e,t,n),o=wh.spawn(r.command,r.args,r.options);return yf.hookChildProcess(o,r),o}s(bh,"spawn");function qb(e,t,n){let r=_f(e,t,n),o=wh.spawnSync(r.command,r.args,r.options);return o.error=o.error||yf.verifyENOENTSync(o.status,r),o}s(qb,"spawnSync");on.exports=bh;on.exports.spawn=bh;on.exports.sync=qb;on.exports._parse=_f;on.exports._enoent=yf});import{spawn as Ix}from"node:child_process";var _={};ke(_,{$brand:()=>Gi,$input:()=>$a,$output:()=>va,INVALID:()=>Q,NEVER:()=>qi,TimePrecision:()=>Ta,ZodAny:()=>vl,ZodArray:()=>Sl,ZodBase64:()=>li,ZodBase64URL:()=>fi,ZodBigInt:()=>en,ZodBigIntFormat:()=>mi,ZodBoolean:()=>Qt,ZodCIDRv4:()=>ai,ZodCIDRv6:()=>ui,ZodCUID:()=>ti,ZodCUID2:()=>ni,ZodCatch:()=>Bl,ZodCodec:()=>or,ZodCompileAsyncError:()=>ge,ZodCompileUnsupportedError:()=>A,ZodCreditCard:()=>dl,ZodCustom:()=>ir,ZodCustomStringFormat:()=>ft,ZodDate:()=>Yn,ZodDefault:()=>Ml,ZodDiscriminatedUnion:()=>zl,ZodE164:()=>pi,ZodEmail:()=>Xo,ZodEmoji:()=>Qo,ZodEnum:()=>Gt,ZodError:()=>Yw,ZodExactOptional:()=>yi,ZodFile:()=>Dl,ZodFirstPartyTypeKind:()=>cf,ZodFunction:()=>nf,ZodGUID:()=>Yo,ZodIBAN:()=>ml,ZodIPv4:()=>si,ZodIPv6:()=>ci,ZodISODate:()=>Ke,ZodISODateTime:()=>Ue,ZodISODuration:()=>Be,ZodISOTime:()=>He,ZodInstanceOf:()=>sf,ZodIntersection:()=>Ol,ZodIssueCode:()=>tb,ZodJWT:()=>di,ZodKSUID:()=>ii,ZodLazy:()=>Ql,ZodLiteral:()=>Zl,ZodMAC:()=>pl,ZodMap:()=>Cl,ZodNaN:()=>Wl,ZodNanoID:()=>ei,ZodNever:()=>xl,ZodNonOptional:()=>wi,ZodNull:()=>wl,ZodNullable:()=>jl,ZodNumber:()=>Yt,ZodNumberFormat:()=>pt,ZodObject:()=>er,ZodOptional:()=>nr,ZodPipe:()=>rr,ZodPrefault:()=>Vl,ZodPreprocess:()=>ql,ZodPromise:()=>tf,ZodReadonly:()=>Gl,ZodRealError:()=>ae,ZodRecord:()=>qt,ZodSet:()=>Tl,ZodString:()=>Xt,ZodStringFormat:()=>R,ZodSuccess:()=>Hl,ZodSymbol:()=>_l,ZodTemplateLiteral:()=>Yl,ZodTransform:()=>Rl,ZodTuple:()=>El,ZodType:()=>I,ZodULID:()=>ri,ZodURL:()=>Xn,ZodUUID:()=>ve,ZodUndefined:()=>yl,ZodUnion:()=>tr,ZodUnknown:()=>$l,ZodVoid:()=>kl,ZodXID:()=>oi,ZodXor:()=>Pl,_ZodString:()=>Go,_default:()=>Fl,_function:()=>gm,any:()=>Jd,array:()=>Qn,base64:()=>zd,base64url:()=>Od,bigint:()=>Vd,boolean:()=>gl,catch:()=>Jl,check:()=>_m,cidrv4:()=>Sd,cidrv6:()=>Pd,clone:()=>T,codec:()=>pm,coerce:()=>uf,compile:()=>Pa,config:()=>F,core:()=>Ie,creditCard:()=>Ed,cuid:()=>_d,cuid2:()=>yd,currencyCode:()=>Dd,custom:()=>ym,date:()=>qd,decode:()=>il,decodeAsync:()=>cl,deepPartial:()=>Am,describe:()=>wm,discriminatedUnion:()=>tm,e164:()=>Id,email:()=>cd,emoji:()=>hd,encode:()=>ol,encodeAsync:()=>sl,endsWith:()=>Lt,enum:()=>gi,exactOptional:()=>Ll,file:()=>am,flattenError:()=>bn,float32:()=>Ld,float64:()=>jd,formatError:()=>vn,fromJSONSchema:()=>Im,function:()=>gm,getDiscriminatedOption:()=>qc,getErrorMap:()=>rb,globalRegistry:()=>W,gt:()=>we,gte:()=>fe,guid:()=>ad,hash:()=>Rd,hex:()=>Zd,hostname:()=>Td,httpUrl:()=>md,iban:()=>Ad,includes:()=>Dt,input:()=>Cm,instanceof:()=>vm,int:()=>Wo,int32:()=>Md,int64:()=>Ud,intersection:()=>Il,invertCodec:()=>dm,ipv4:()=>$d,ipv6:()=>kd,iso:()=>sr,json:()=>xm,jwt:()=>Nd,keyof:()=>Gd,ksuid:()=>vd,lazy:()=>ef,length:()=>st,literal:()=>cm,locales:()=>Fn,looseObject:()=>Qd,looseRecord:()=>rm,lowercase:()=>Tt,lt:()=>ye,lte:()=>le,mac:()=>xd,map:()=>om,maxLength:()=>it,maxSize:()=>je,memoizer:()=>jn,meta:()=>bm,mime:()=>Mt,minLength:()=>Oe,minSize:()=>be,multipleOf:()=>Le,nan:()=>fm,nanoid:()=>gd,nativeEnum:()=>sm,negative:()=>Ro,never:()=>hi,nonnegative:()=>jo,nonoptional:()=>Kl,nonpositive:()=>Lo,normalize:()=>Ft,null:()=>bl,nullable:()=>Gn,nullish:()=>um,number:()=>hl,object:()=>Xd,optional:()=>ut,output:()=>Tm,overwrite:()=>_e,parse:()=>el,parseAsync:()=>tl,partialRecord:()=>nm,pipe:()=>qo,positive:()=>Do,prefault:()=>Ul,preprocess:()=>km,prettifyError:()=>ts,promise:()=>hm,properties:()=>jt,property:()=>Mo,readonly:()=>Xl,record:()=>Nl,refine:()=>rf,regex:()=>Ct,regexes:()=>me,registry:()=>lo,safeDecode:()=>ul,safeDecodeAsync:()=>fl,safeEncode:()=>al,safeEncodeAsync:()=>ll,safeParse:()=>nl,safeParseAsync:()=>rl,set:()=>im,setErrorMap:()=>nb,size:()=>ot,slugify:()=>Ht,startsWith:()=>Rt,strictObject:()=>Yd,string:()=>qn,stringFormat:()=>Cd,stringbool:()=>$m,success:()=>lm,superRefine:()=>of,symbol:()=>Hd,templateLiteral:()=>mm,toJSONSchema:()=>Ko,toLowerCase:()=>Ut,toUpperCase:()=>Kt,toZod:()=>ln,transform:()=>_i,treeifyError:()=>es,trim:()=>Vt,tuple:()=>Al,uint32:()=>Fd,uint64:()=>Kd,ulid:()=>wd,undefined:()=>Bd,union:()=>tn,unknown:()=>at,uppercase:()=>Zt,url:()=>dd,util:()=>x,uuid:()=>ud,uuidv4:()=>ld,uuidv6:()=>fd,uuidv7:()=>pd,validate:()=>$n,validateAsync:()=>xn,void:()=>Wd,withParser:()=>fo,xid:()=>bd,xor:()=>em});var Ie={};ke(Ie,{$ZodAny:()=>Mc,$ZodArray:()=>Bc,$ZodAsyncError:()=>se,$ZodBase64:()=>Oc,$ZodBase64URL:()=>Ic,$ZodBigInt:()=>Qr,$ZodBigIntFormat:()=>Dc,$ZodBoolean:()=>Cn,$ZodCIDRv4:()=>Pc,$ZodCIDRv6:()=>zc,$ZodCUID:()=>mc,$ZodCUID2:()=>hc,$ZodCatch:()=>fa,$ZodCheck:()=>L,$ZodCheckBigIntFormat:()=>Fs,$ZodCheckEndsWith:()=>Qs,$ZodCheckGreaterThan:()=>Rr,$ZodCheckIncludes:()=>Xs,$ZodCheckLengthEquals:()=>Js,$ZodCheckLessThan:()=>Dr,$ZodCheckLowerCase:()=>qs,$ZodCheckMaxLength:()=>Hs,$ZodCheckMaxSize:()=>Vs,$ZodCheckMimeType:()=>nc,$ZodCheckMinLength:()=>Bs,$ZodCheckMinSize:()=>Us,$ZodCheckMultipleOf:()=>js,$ZodCheckNumberFormat:()=>Ms,$ZodCheckOverwrite:()=>rc,$ZodCheckProperties:()=>tc,$ZodCheckProperty:()=>ec,$ZodCheckRegex:()=>Ws,$ZodCheckSizeEquals:()=>Ks,$ZodCheckStartsWith:()=>Ys,$ZodCheckStringFormat:()=>It,$ZodCheckUpperCase:()=>Gs,$ZodCodec:()=>Zn,$ZodCreditCard:()=>Ac,$ZodCustom:()=>ya,$ZodCustomStringFormat:()=>Tc,$ZodCyclicError:()=>so,$ZodDate:()=>Kc,$ZodDefault:()=>ca,$ZodDiscriminatedUnion:()=>Gc,$ZodE164:()=>Ec,$ZodEmail:()=>ac,$ZodEmoji:()=>pc,$ZodEncodeError:()=>De,$ZodEnum:()=>ta,$ZodError:()=>Qi,$ZodExactOptional:()=>ia,$ZodFile:()=>ra,$ZodFunction:()=>ga,$ZodGUID:()=>sc,$ZodIBAN:()=>Nc,$ZodIPv4:()=>xc,$ZodIPv6:()=>kc,$ZodISODate:()=>bc,$ZodISODateTime:()=>wc,$ZodISODuration:()=>$c,$ZodISOTime:()=>vc,$ZodIntersection:()=>Xc,$ZodJWT:()=>Cc,$ZodKSUID:()=>yc,$ZodLazy:()=>Dn,$ZodLiteral:()=>na,$ZodMAC:()=>Sc,$ZodMap:()=>Qc,$ZodNaN:()=>pa,$ZodNanoID:()=>dc,$ZodNever:()=>Vc,$ZodNonOptional:()=>ua,$ZodNull:()=>jc,$ZodNullable:()=>sa,$ZodNumber:()=>Yr,$ZodNumberFormat:()=>Zc,$ZodObject:()=>zp,$ZodObjectJIT:()=>Jc,$ZodOptional:()=>to,$ZodPipe:()=>no,$ZodPrefault:()=>aa,$ZodPreprocess:()=>da,$ZodPromise:()=>_a,$ZodReadonly:()=>ma,$ZodRealError:()=>ce,$ZodRecord:()=>Yc,$ZodRegistry:()=>uo,$ZodSet:()=>ea,$ZodString:()=>et,$ZodStringFormat:()=>Z,$ZodSuccess:()=>la,$ZodSymbol:()=>Rc,$ZodTemplateLiteral:()=>ha,$ZodTransform:()=>oa,$ZodTuple:()=>eo,$ZodType:()=>z,$ZodULID:()=>gc,$ZodURL:()=>fc,$ZodUUID:()=>cc,$ZodUndefined:()=>Lc,$ZodUnion:()=>Tn,$ZodUnknown:()=>Fc,$ZodVoid:()=>Uc,$ZodXID:()=>_c,$ZodXor:()=>Wc,$brand:()=>Gi,$constructor:()=>h,$input:()=>$a,$output:()=>va,Doc:()=>Qe,INVALID:()=>Q,JSONSchema:()=>od,JSONSchemaGenerator:()=>Ho,NEVER:()=>qi,TimePrecision:()=>Ta,URL_BAD_FORMAT:()=>uc,URL_UNPARSEABLE:()=>On,ZodCompileAsyncError:()=>ge,ZodCompileUnsupportedError:()=>A,_any:()=>Xa,_array:()=>ou,_base64:()=>No,_base64url:()=>Co,_bigint:()=>Ka,_boolean:()=>Va,_catch:()=>Mw,_check:()=>Vp,_cidrv4:()=>Eo,_cidrv6:()=>Ao,_coercedBigint:()=>Ha,_coercedBoolean:()=>Ua,_coercedDate:()=>nu,_coercedNumber:()=>Da,_coercedString:()=>Ea,_creditCard:()=>Na,_cuid:()=>xo,_cuid2:()=>ko,_custom:()=>su,_date:()=>tu,_decode:()=>Sr,_decodeAsync:()=>zr,_default:()=>Rw,_discriminatedUnion:()=>Sw,_e164:()=>To,_email:()=>ho,_emoji:()=>vo,_encode:()=>kr,_encodeAsync:()=>Pr,_endsWith:()=>Lt,_enum:()=>Aw,_file:()=>iu,_float32:()=>La,_float64:()=>ja,_gt:()=>we,_gte:()=>fe,_guid:()=>go,_iban:()=>Ca,_includes:()=>Dt,_int:()=>Ra,_int32:()=>Ma,_int64:()=>Ba,_intersection:()=>Pw,_ipv4:()=>Oo,_ipv6:()=>Io,_isoDate:()=>Kn,_isoDateTime:()=>Un,_isoDuration:()=>Bn,_isoTime:()=>Hn,_jwt:()=>Zo,_ksuid:()=>zo,_lazy:()=>Kw,_length:()=>st,_literal:()=>Cw,_lowercase:()=>Tt,_lt:()=>ye,_lte:()=>le,_mac:()=>Aa,_map:()=>Iw,_max:()=>le,_maxLength:()=>it,_maxSize:()=>je,_mime:()=>Mt,_min:()=>fe,_minLength:()=>Oe,_minSize:()=>be,_multipleOf:()=>Le,_nan:()=>ru,_nanoid:()=>$o,_nativeEnum:()=>Nw,_negative:()=>Ro,_never:()=>Qa,_nonnegative:()=>jo,_nonoptional:()=>Lw,_nonpositive:()=>Lo,_normalize:()=>Ft,_null:()=>Ga,_nullable:()=>Dw,_number:()=>Za,_optional:()=>Zw,_overwrite:()=>_e,_parse:()=>St,_parseAsync:()=>Pt,_pipe:()=>Fw,_positive:()=>Do,_promise:()=>Hw,_properties:()=>jt,_property:()=>Mo,_readonly:()=>Vw,_record:()=>Ow,_refine:()=>cu,_regex:()=>Ct,_safeDecode:()=>Ir,_safeDecodeAsync:()=>Ar,_safeEncode:()=>Or,_safeEncodeAsync:()=>Er,_safeParse:()=>zt,_safeParseAsync:()=>Ot,_set:()=>Ew,_size:()=>ot,_slugify:()=>Ht,_startsWith:()=>Rt,_string:()=>Ia,_stringFormat:()=>ct,_stringbool:()=>fu,_success:()=>jw,_superRefine:()=>au,_symbol:()=>Wa,_templateLiteral:()=>Uw,_toLowerCase:()=>Ut,_toUpperCase:()=>Kt,_transform:()=>Tw,_trim:()=>Vt,_tuple:()=>zw,_uint32:()=>Fa,_uint64:()=>Ja,_ulid:()=>So,_undefined:()=>qa,_union:()=>xw,_unknown:()=>Ya,_uppercase:()=>Zt,_url:()=>Vn,_uuid:()=>_o,_uuidv4:()=>yo,_uuidv6:()=>wo,_uuidv7:()=>bo,_void:()=>eu,_xid:()=>Po,_xor:()=>kw,base64Charset:()=>Jr,base64urlCharset:()=>Nn,canParseURL:()=>lc,clone:()=>T,compile:()=>Pa,compileFn:()=>po,config:()=>F,createStandardJSONSchemaMethod:()=>Bt,createToJSONSchemaMethod:()=>du,decode:()=>E_,decodeAsync:()=>N_,describe:()=>uu,encode:()=>I_,encodeAsync:()=>A_,extractDefs:()=>Fe,finalize:()=>Ve,flattenError:()=>bn,formatError:()=>vn,getDiscriminatedOption:()=>qc,globalConfig:()=>B,globalRegistry:()=>W,handleUnrepresentable:()=>U,initializeContext:()=>Me,isBackEdge:()=>ao,isRecursiveSchema:()=>co,isValidBase64:()=>An,isValidBase64URL:()=>Wr,isValidCIDRv6:()=>Br,isValidCreditCard:()=>qr,isValidIBAN:()=>Gr,isValidIPv6:()=>En,isValidJWT:()=>Xr,locales:()=>Fn,memoizer:()=>jn,mergeValues:()=>Et,meta:()=>lu,parse:()=>$r,parseAsync:()=>xr,parseURLObject:()=>kp,prettifyError:()=>ts,process:()=>D,processSchema:()=>D,regexes:()=>me,registry:()=>lo,safeDecode:()=>T_,safeDecodeAsync:()=>D_,safeEncode:()=>C_,safeEncodeAsync:()=>Z_,safeParse:()=>k_,safeParseAsync:()=>S_,standardProps:()=>Vr,stripTabAndNewline:()=>In,toDotPath:()=>rp,toJSONSchema:()=>Ko,toZod:()=>ln,treeifyError:()=>es,urlHostnameOk:()=>Kr,urlProtocolOk:()=>Hr,util:()=>x,validate:()=>$n,validateAsync:()=>xn,validateURL:()=>Ur,version:()=>oc,withParser:()=>fo});var x={};ke(x,{BIGINT_FORMAT_RANGES:()=>hn,CONSTANT_CATCH:()=>br,Class:()=>Li,NUMBER_FORMAT_RANGES:()=>mn,aborted:()=>Y,allowsEval:()=>Fi,assert:()=>Kg,assertEqual:()=>Mg,assertIs:()=>Vg,assertNever:()=>Ug,assertNotEqual:()=>Fg,assignProp:()=>J,attachSchema:()=>gn,base64ToUint8Array:()=>Xf,base64urlToUint8Array:()=>u_,cached:()=>vt,captureStackTrace:()=>_r,cleanEnum:()=>a_,cleanRegex:()=>Pe,clone:()=>T,cloneDef:()=>Jg,codePointLength:()=>Xe,constantCatch:()=>Ji,createTransparentProxy:()=>Qg,defineLazy:()=>ji,defineLazyInternal:()=>E,derived:()=>d_,esc:()=>X,escapeRegex:()=>de,explicitlyAborted:()=>Ki,extend:()=>n_,finalizeIssue:()=>ie,floatSafeRemainder:()=>fn,getElementAtPath:()=>Wg,getEnumValues:()=>wt,getLengthableOrigin:()=>yn,getParsedType:()=>Yg,getSizableOrigin:()=>_n,hexToUint8Array:()=>f_,hide:()=>wn,installLazyProp:()=>__,isObject:()=>Ge,isPlainObject:()=>pe,issue:()=>kt,joinValues:()=>hr,jsonStringifyReplacer:()=>bt,members:()=>Bi,merge:()=>o_,mergeDefs:()=>he,normalizeParams:()=>w,nullish:()=>gr,numKeys:()=>Xg,objectClone:()=>Hg,omit:()=>t_,optionalKeys:()=>Ui,own:()=>Ze,parsedType:()=>Hi,partial:()=>i_,pick:()=>e_,prefixIssues:()=>oe,primitiveTypes:()=>Vi,promiseAllObject:()=>qg,propertyKeyTypes:()=>dn,randomString:()=>Gg,rawShape:()=>$t,required:()=>s_,safeExtend:()=>r_,shallowClone:()=>pn,sizeCaps:()=>xt,slugify:()=>Mi,stringifyPrimitive:()=>yr,toZod:()=>ln,uint8ArrayToBase64:()=>Yf,uint8ArrayToBase64url:()=>l_,uint8ArrayToHex:()=>p_,unwrapMessage:()=>yt});function Mg(e){return e}s(Mg,"assertEqual");function Fg(e){return e}s(Fg,"assertNotEqual");function ln(){return e=>e}s(ln,"toZod");function Vg(e){}s(Vg,"assertIs");function Ug(e){throw new Error("Unexpected value in exhaustive check")}s(Ug,"assertNever");function Kg(e){}s(Kg,"assert");function wt(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}s(wt,"getEnumValues");function hr(e,t="|"){return e.map(n=>yr(n)).join(t)}s(hr,"joinValues");function bt(e,t){return typeof t=="bigint"?t.toString():t}s(bt,"jsonStringifyReplacer");var Ri=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}};function vt(e){return new Ri(e)}s(vt,"cached");function gr(e){return e==null}s(gr,"nullish");function Pe(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}s(Pe,"cleanRegex");function fn(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}s(fn,"floatSafeRemainder");var Jf=Symbol("evaluating");function ji(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Jf)return r===void 0&&(r=Jf,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}s(ji,"defineLazy");function Hg(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}s(Hg,"objectClone");function J(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}s(J,"assignProp");function $t(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}s($t,"rawShape");function Se(e){return $t(e._zod.def)??e._zod.def.shape}s(Se,"sourceShape");function Wf(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return J(this,t,r),r},enumerable:!0,configurable:!0})}s(Wf,"deferProp");function qf(e,t,n){t in e?J(e,t,n):e[t]=n}s(qf,"putProp");function qe(e,t,n,r){let o=Se(t);for(let i of n){let c=Object.getOwnPropertyDescriptor(o,i);c.enumerable&&(c.get?Wf(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a}):qf(e,i,r?r(c.value,i):c.value))}}s(qe,"mirrorShape");function Bg(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Wf(e,n,()=>t[n]):qf(e,n,r.value))}}s(Bg,"mirrorProps");function he(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}s(he,"mergeDefs");function Jg(e){return he(e._zod.def)}s(Jg,"cloneDef");function Wg(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}s(Wg,"getElementAtPath");function qg(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=r[i];return o})}s(qg,"promiseAllObject");function Gg(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}s(Gg,"randomString");function X(e){return JSON.stringify(e)}s(X,"esc");function Mi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}s(Mi,"slugify");var _r="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ge(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ge,"isObject");var Fi=vt(()=>{if(B.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function pe(e){if(Ge(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Ge(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}s(pe,"isPlainObject");function pn(e){return pe(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}s(pn,"shallowClone");function Xg(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}s(Xg,"numKeys");var Yg=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"),dn=new Set(["string","number","symbol"]),Vi=new Set(["string","number","bigint","boolean","symbol","undefined"]);function de(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(de,"escapeRegex");function T(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}s(T,"clone");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}s(w,"normalizeParams");function Qg(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,i){return t??(t=e()),Reflect.set(t,r,o,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}s(Qg,"createTransparentProxy");function yr(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}s(yr,"stringifyPrimitive");function Ui(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}s(Ui,"optionalKeys");var mn={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]},hn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function e_(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return qe(i,e,wr(e,t)),T(e,he(n,{shape:i,checks:[]}))}s(e_,"pick");function wr(e,t){let n=Se(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&r.push(o)}return r}s(wr,"maskedKeys");function t_(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(wr(e,t)),c={};return qe(c,e,Reflect.ownKeys(Se(e)).filter(a=>!i.has(a))),T(e,he(n,{shape:c,checks:[]}))}s(t_,"omit");function n_(e,t){if(!pe(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=Se(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 T(e,he(e._zod.def,{shape:Gf(e,t)}))}s(n_,"extend");function Gf(e,t){let n={};return qe(n,e,Reflect.ownKeys(Se(e))),Bg(n,t),n}s(Gf,"extended");function r_(e,t){if(!pe(t))throw new Error("Invalid input to safeExtend: expected a plain object");return T(e,he(e._zod.def,{shape:Gf(e,t)}))}s(r_,"safeExtend");function o_(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 n={};qe(n,e,Reflect.ownKeys(Se(e))),qe(n,t,Reflect.ownKeys(Se(t)));let r=he(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return T(e,r)}s(o_,"merge");function i_(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(wr(t,n)):void 0,u={};return qe(u,t,Reflect.ownKeys(Se(t)),e&&((l,f)=>a&&!a.has(f)?l:new e({type:"optional",innerType:l}))),T(t,he(t._zod.def,{shape:u,checks:[]}))}s(i_,"partial");function s_(e,t,n){let r=n?new Set(wr(t,n)):void 0,o={};return qe(o,t,Reflect.ownKeys(Se(t)),(i,c)=>r&&!r.has(c)?i:new e({type:"nonoptional",innerType:i})),T(t,he(t._zod.def,{shape:o}))}s(s_,"required");function Y(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}s(Y,"aborted");function Ki(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}s(Ki,"explicitlyAborted");function oe(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}s(oe,"prefixIssues");function yt(e){return typeof e=="string"?e:e?.message}s(yt,"unwrapMessage");function xt(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;o>=0&&t.push([o,n])}return t}s(xt,"sizeCaps");function gn(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}s(gn,"attachSchema");function ie(e,t,n){var r;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,c=e.message?e.message:yt(e.inst?._zod.def?.error?.(e))??yt(i?.(e))??yt(t?.error?.(e))??yt(n.customError?.(e))??yt(n.localeError?.(e))??"Invalid input",a={};for(let u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(a[u]=e[u]);return a.path??(a.path=[]),a.message=c,t?.reportInput&&(a.input=e.input),a}s(ie,"finalizeIssue");function _n(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}s(_n,"getSizableOrigin");var c_=/[\uD800-\uDBFF]/;function Xe(e){let t=e.length;if(!c_.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}s(Xe,"codePointLength");function yn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}s(yn,"getLengthableOrigin");function Hi(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 n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}s(Hi,"parsedType");function kt(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}s(kt,"issue");function a_(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}s(a_,"cleanEnum");function Xf(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}s(Xf,"base64ToUint8Array");function Yf(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}s(Yf,"uint8ArrayToBase64");function u_(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return Xf(t+n)}s(u_,"base64urlToUint8Array");function l_(e){return Yf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s(l_,"uint8ArrayToBase64url");function f_(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}s(f_,"hexToUint8Array");function p_(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}s(p_,"uint8ArrayToHex");var Li=class{static{s(this,"Class")}constructor(...t){}};function Bi(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):m_(e,n,r.value)}}s(Bi,"members");function Ze(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}s(Ze,"own");function wn(e,t,n){return Ze(e,t,n,!1)}s(wn,"hide");function d_(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Ze(this,n,r(this))},set(o){Ze(this,n,o)}})}return t}s(d_,"derived");function m_(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ze(this,t,n.bind(this))},set(r){Ze(this,t,r)}})}s(m_,"defineBound");function h_(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}s(h_,"claim");var Di,Te=!1,g_={configurable:!0,get(){Te=!0}};function E(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Di!==e._zod){Di=void 0;return}Di=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,g_);let o=Te;Te=!1;try{let i=n(this);return Te?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Te=Te||o,i}catch(i){throw delete this[t],Te=Te||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}s(E,"defineLazyInternal");function __(e,t,n,r){let o=h_(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}s(__,"installLazyProp");var br="~constantCatch";function Ji(e){let t=s(()=>e,"fn");return t[br]=!0,t}s(Ji,"constantCatch");var Qf,qi=Object.freeze({status:"aborted"}),Wi={value:void 0,enumerable:!1},ep="captureStackTrace"in Error?Error:null;function y_(e){let t=ep;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return ep=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}s(y_,"newError");function h(e,t,n,r){let o={};function i(d){this.def=d,this.constr=p,this.traits=new Set}s(i,"Internals"),i.prototype=o;let c=n,a=c&&new WeakSet;function u(d,m){if(d._zod){if(d._zod.traits.has(e))return}else{Wi.value=new i(m);try{Object.defineProperty(d,"_zod",Wi)}finally{Wi.value=void 0}}if(d._zod.traits.add(e),t(d,m),a){let y=Object.getPrototypeOf(d),b=d._zod.constr.prototype,k=y;for(;k&&k!==b;)k=Object.getPrototypeOf(k);let $=k??y;a.has($)||(a.add($),Bi($,c))}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=r?.Parent??Object;class f extends l{static{s(this,"Definition")}}Object.defineProperty(f,"name",{value:e});function p(d){let m=r?.Parent?y_(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=>r?.Parent&&d instanceof r.Parent?!0:d?._zod?.traits?.has(e),"value")}),Object.defineProperty(p,"name",{value:e}),p}s(h,"$constructor");var Gi=Symbol("zod_brand"),se=class extends Error{static{s(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},De=class extends Error{static{s(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Qf=globalThis).__zod_globalConfig??(Qf.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function F(e){return e&&Object.assign(B,e),B}s(F,"config");function w_(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,bt,2)),e.message}s(w_,"_getMessage");function b_(e){this._zod.message=e}s(b_,"_setMessage");var v_={get:w_,set:b_,enumerable:!0,configurable:!0},Yi={value:void 0,enumerable:!1},tp=new WeakSet([Object.prototype,Error.prototype]),np=s((e,t)=>{e.name="$ZodError",Yi.value=t,Object.defineProperty(e,"issues",Yi),Yi.value=void 0,Object.defineProperty(e,"message",v_);let n=Object.getPrototypeOf(e);tp.has(n)||(tp.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=s(()=>this.message,"value");return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},"initializer"),Qi=h("$ZodError",np),ce=h("$ZodError",np,void 0,{Parent:Error});function $_(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}s($_,"node");function bn(e,t=n=>n.message){let n={},r=[];for(let o of e.issues)o.path.length>0?$_(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}s(bn,"flattenError");function vn(e,t=n=>n.message){let n={_errors:[]},r=s((o,i=[])=>{for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(a=>r({issues:a},[...i,...c.path]));else if(c.code==="invalid_key")r({issues:c.issues},[...i,...c.path]);else if(c.code==="invalid_element")r({issues:c.issues},[...i,...c.path]);else{let a=[...i,...c.path];if(a.length===0)n._errors.push(t(c));else{let u=n,l=0;for(;l<a.length;){let f=a[l],p=l===a.length-1;if(f==="_errors"){p&&u._errors.push(t(c)),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(c)),u=d,l++}}}},"processError");return r(e),n}s(vn,"formatError");function es(e,t=n=>n.message){let n={errors:[]},r=s((o,i=[])=>{var c;for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(u=>r({issues:u},[...i,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...i,...a.path]);else{let u=[...i,...a.path];if(u.length===0){n.errors.push(t(a));continue}let l=n,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=[]),(c=l.items)[p]??(c[p]={errors:[]}),l=l.items[p]),d&&l.errors.push(t(a)),f++}}},"processError");return r(e),n}s(es,"treeifyError");function rp(e){let t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(let r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}s(rp,"toDotPath");function ts(e){let t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(let r of n)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${rp(r.path)}`);return t.join(`
8
- `)}s(ts,"prettifyError");function vr(e,t){return{callee:t?.callee??e,Err:t?.Err}}s(vr,"finalizeParams");var St=s(e=>{let t=s((n,r,o,i)=>{let c=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},c);if(a instanceof Promise)throw new se;if(a.issues.length){let u=new(i?.Err??e)(a.issues.map(l=>ie(l,c,F())));throw _r(u,i?.callee??t),u}return a.value},"fn");return t},"_parse"),$r=St(ce),Pt=s(e=>{let t=s(async(n,r,o,i)=>{let c=o?{...o,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},c);if(a instanceof Promise&&(a=await a),a.issues.length){let u=new(i?.Err??e)(a.issues.map(l=>ie(l,c,F())));throw _r(u,i?.callee??t),u}return a.value},"fn");return t},"_parseAsync"),xr=Pt(ce),zt=s(e=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new se;return i.issues.length?op(e,i.issues,o):{success:!0,data:i.value}},"_safeParse"),k_=zt(ce);function op(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>ie(o,n,F()))),t=void 0,n=void 0),r},set error(o){r=o,t=void 0,n=void 0}}}s(op,"failure");var Ot=s(e=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?op(e,i.issues,o):{success:!0,data:i.value}},"_safeParseAsync"),S_=Ot(ce),P_=Symbol.for("zod.compile.invalid"),z_=Symbol.for("zod.compile.fallback"),$n=s(((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==P_)return!0;if(r.definite===!0&&n===void 0)return!1}return O_(e,t,n)}),"validate");function O_(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(r[z_]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new se;return i.issues.length===0}s(O_,"validateFallback");var xn=s(async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},"validateAsync"),kr=s(e=>{let t=St(e),n=s((r,o,i,c)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,vr(n,c))},"fn");return n},"_encode"),I_=kr(ce),Sr=s(e=>{let t=St(e),n=s((r,o,i,c)=>t(r,o,i,vr(n,c)),"fn");return n},"_decode"),E_=Sr(ce),Pr=s(e=>{let t=Pt(e),n=s(async(r,o,i,c)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,vr(n,c))},"fn");return n},"_encodeAsync"),A_=Pr(ce),zr=s(e=>{let t=Pt(e),n=s(async(r,o,i,c)=>await t(r,o,i,vr(n,c)),"fn");return n},"_decodeAsync"),N_=zr(ce),Or=s(e=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return zt(e)(t,n,o)},"_safeEncode"),C_=Or(ce),Ir=s(e=>(t,n,r)=>zt(e)(t,n,r),"_safeDecode"),T_=Ir(ce),Er=s(e=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Ot(e)(t,n,o)},"_safeEncodeAsync"),Z_=Er(ce),Ar=s(e=>async(t,n,r)=>Ot(e)(t,n,r),"_safeDecodeAsync"),D_=Ar(ce);var me={};ke(me,{anyString:()=>Os,base64:()=>ws,base64url:()=>bs,bigint:()=>Es,boolean:()=>As,browserEmail:()=>K_,cidrv4:()=>_s,cidrv6:()=>ys,creditCard:()=>Nr,cuid:()=>rs,cuid2:()=>os,currencyCode:()=>ks,date:()=>Ss,datetime:()=>zs,domain:()=>$s,duration:()=>ls,e164:()=>xs,email:()=>ps,emoji:()=>ds,extendedDuration:()=>R_,guid:()=>fs,hex:()=>Ds,hostname:()=>vs,html5Email:()=>F_,httpProtocol:()=>kn,iban:()=>Cr,idnEmail:()=>U_,integer:()=>Sn,ipv4:()=>ms,ipv6:()=>hs,ksuid:()=>cs,lowercase:()=>Ts,mac:()=>gs,md5_base64:()=>W_,md5_base64url:()=>q_,md5_hex:()=>J_,nanoid:()=>as,nanoidOfLength:()=>us,null:()=>Ns,number:()=>ze,rfc5322Email:()=>V_,sha1_base64:()=>X_,sha1_base64url:()=>Y_,sha1_hex:()=>G_,sha256_base64:()=>ey,sha256_base64url:()=>ty,sha256_hex:()=>Q_,sha384_base64:()=>ry,sha384_base64url:()=>oy,sha384_hex:()=>ny,sha512_base64:()=>sy,sha512_base64url:()=>cy,sha512_hex:()=>iy,string:()=>Is,time:()=>Ps,ulid:()=>is,undefined:()=>Cs,unicodeEmail:()=>ip,uppercase:()=>Zs,uuid:()=>Ye,uuid4:()=>L_,uuid6:()=>j_,uuid7:()=>M_,xid:()=>ss});var rs=/^[cC][0-9a-z]{6,}$/,os=/^[0-9a-z]+$/,is=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ss=/^[0-9a-vA-V]{20}$/,cs=/^[A-Za-z0-9]{27}$/,as=/^[a-zA-Z0-9_-]{21}$/;function us(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}s(us,"nanoidOfLength");var ls=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,R_=/^[-+]?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)?)??$/,fs=/^([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})$/,Ye=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"),L_=Ye(4),j_=Ye(6),M_=Ye(7),ps=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,F_=/^[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])?)*$/,V_=/^(([^<>()\[\]\\.,;:\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,}))$/,ip=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,U_=ip,K_=/^[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])?)*$/,H_="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function ds(){return new RegExp(H_,"u")}s(ds,"emoji");var ms=/^(?:(?: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])$/,hs=/^(([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}|:))$/,gs=s(e=>{let t=de(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"),_s=/^((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])$/,ys=/^(([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])$/,ws=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,bs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,vs=/^(?=.{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])?)*\.?$/,$s=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,kn=/^https?$/,xs=/^\+[1-9]\d{6,14}$/,Nr=/^\d(?:[ -]?\d){11,18}$/,ks=/^(?: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)$/,Cr=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,sp="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function B_(e){return new RegExp(`^${e}$`)}s(B_,"anchor");var Ss=B_(sp);function ns(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+)?)?`}s(ns,"timeSource");function Ps(e){return new RegExp(`^${ns(e)}$`)}s(Ps,"time");function zs(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${ns({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${ns({precision:e.precision})}`:n;return new RegExp(`^${sp}T(?:${r})$`)}s(zs,"datetime");var Os=/^[\s\S]{0,}$/,Is=s(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),Es=/^-?\d+n?$/,Sn=/^-?\d+$/,ze=/^-?\d+(?:\.\d+)?$/,As=/^(?:true|false)$/i,Ns=/^null$/i;var Cs=/^undefined$/i;var Ts=/^[^A-Z]*$/,Zs=/^[^a-z]*$/,Ds=/^[0-9a-fA-F]*$/;function Pn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}s(Pn,"fixedBase64");function zn(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}s(zn,"fixedBase64url");var J_=/^[0-9a-fA-F]{32}$/,W_=Pn(22,"=="),q_=zn(22),G_=/^[0-9a-fA-F]{40}$/,X_=Pn(27,"="),Y_=zn(27),Q_=/^[0-9a-fA-F]{64}$/,ey=Pn(43,"="),ty=zn(43),ny=/^[0-9a-fA-F]{96}$/,ry=Pn(64,""),oy=zn(64),iy=/^[0-9a-fA-F]{128}$/,sy=Pn(86,"=="),cy=zn(86);var L=h("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Rs=s(e=>{let t=e.value;return!gr(t)&&t.size!==void 0},"_whenHasSize"),Ls=s(e=>{let t=e.value;return!gr(t)&&t.length!==void 0},"_whenHasLength"),Tr={number:"number",bigint:"bigint",object:"date"},Dr=h("$ZodCheckLessThan",(e,t)=>{L.init(e,t);let n=Tr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Tr[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Rr=h("$ZodCheckGreaterThan",(e,t)=>{L.init(e,t);let n=Tr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Tr[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),js=h("$ZodCheckMultipleOf",(e,t)=>{L.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):fn(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ms=h("$ZodCheckNumberFormat",(e,t)=>{L.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=mn[t.format];e._zod.check=c=>{let a=c.value;if(n){if(!Number.isInteger(a)){c.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?c.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):c.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&c.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&c.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Fs=h("$ZodCheckBigIntFormat",(e,t)=>{L.init(e,t);let[n,r]=hn[t.format];e._zod.check=o=>{let i=o.value;i<n&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>r&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),Vs=h("$ZodCheckMaxSize",(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=Rs),e._zod.check=r=>{let o=r.value;o.size<=t.maximum||r.issues.push({origin:_n(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Us=h("$ZodCheckMinSize",(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=Rs),e._zod.check=r=>{let o=r.value;o.size>=t.minimum||r.issues.push({origin:_n(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ks=h("$ZodCheckSizeEquals",(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=Rs),e._zod.check=r=>{let o=r.value,i=o.size;if(i===t.size)return;let c=i>t.size;r.issues.push({origin:_n(o),...c?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Hs=h("$ZodCheckMaxLength",(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=Ls),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Xe(o):i)<=t.maximum)return;let a=yn(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Bs=h("$ZodCheckMinLength",(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=Ls),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Xe(o):i)>=t.minimum)return;let a=yn(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Js=h("$ZodCheckLengthEquals",(e,t)=>{var n;L.init(e,t),(n=e._zod.def).when??(n.when=Ls),e._zod.check=r=>{let o=r.value,i=o.length,c=typeof o=="string"&&i>=t.length&&i<=t.length*2?Xe(o):i;if(c===t.length)return;let a=yn(o),u=c>t.length;r.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),It=h("$ZodCheckStringFormat",(e,t)=>{var n,r;L.init(e,t),t.pattern?(n=e._zod).check??(n.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})}):(r=e._zod).check??(r.check=()=>{})}),Ws=h("$ZodCheckRegex",(e,t)=>{It.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qs=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ts),It.init(e,t)}),Gs=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Zs),It.init(e,t)}),Xs=h("$ZodCheckIncludes",(e,t)=>{L.init(e,t);let n=de(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,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})}}),Ys=h("$ZodCheckStartsWith",(e,t)=>{L.init(e,t);let n=new RegExp(`^${de(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Qs=h("$ZodCheckEndsWith",(e,t)=>{L.init(e,t);let n=new RegExp(`.*${de(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function Zr(e,t,n){e.issues.length&&t.issues.push(...oe(n,e.issues))}s(Zr,"handleCheckPropertyResult");var ec=h("$ZodCheckProperty",(e,t)=>{L.init(e,t),e._zod.check=n=>{let r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(o=>Zr(o,n,t.property));Zr(r,n,t.property)}}),tc=h("$ZodCheckProperties",(e,t)=>{L.init(e,t),wn(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=r=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(c=>[c,t.shape[c]]));let o=r.value,i;for(let[c,a]of n){let u=a._zod.run({value:o[c],issues:[]},{});u instanceof Promise?(i??(i=[]),i.push(u.then(l=>Zr(l,r,c)))):Zr(u,r,c)}if(i)return Promise.all(i).then(()=>{})}}),nc=h("$ZodCheckMimeType",(e,t)=>{L.init(e,t);let n=new Set(t.mime);e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),rc=h("$ZodCheckOverwrite",(e,t)=>{L.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var Qe=class{static{s(this,"Doc")}constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}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 r=t.split(`
7
+ var Bg=Object.create;var br=Object.defineProperty;var Jg=Object.getOwnPropertyDescriptor;var Wg=Object.getOwnPropertyNames;var Xg=Object.getPrototypeOf,qg=Object.prototype.hasOwnProperty;var s=(e,t)=>br(e,"name",{value:t,configurable:!0}),Te=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var le=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}},Pe=(e,t)=>{for(var n in t)br(e,n,{get:t[n],enumerable:!0})},Gg=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Wg(t))!qg.call(e,o)&&o!==n&&br(e,o,{get:()=>t[o],enumerable:!(r=Jg(t,o))||r.enumerable});return e};var vr=(e,t,n)=>(n=e!=null?Bg(Xg(e)):{},Gg(t||!e||!e.__esModule?br(n,"default",{value:e,enumerable:!0}):n,e));var Jm=le((XS,Bm)=>{Bm.exports=Hm;Hm.sync=Lb;var Vm=Te("fs");function Zb(e,t){var n=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!n||(n=n.split(";"),n.indexOf("")!==-1))return!0;for(var r=0;r<n.length;r++){var o=n[r].toLowerCase();if(o&&e.substr(-o.length).toLowerCase()===o)return!0}return!1}s(Zb,"checkPathExt");function Km(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:Zb(t,n)}s(Km,"checkStat");function Hm(e,t,n){Vm.stat(e,function(r,o){n(r,r?!1:Km(o,e,t))})}s(Hm,"isexe");function Lb(e,t){return Km(Vm.statSync(e),e,t)}s(Lb,"sync")});var Ym=le((GS,Gm)=>{Gm.exports=Xm;Xm.sync=Rb;var Wm=Te("fs");function Xm(e,t,n){Wm.stat(e,function(r,o){n(r,r?!1:qm(o,t))})}s(Xm,"isexe");function Rb(e,t){return qm(Wm.statSync(e),t)}s(Rb,"sync");function qm(e,t){return e.isFile()&&jb(e,t)}s(qm,"checkStat");function jb(e,t){var n=e.mode,r=e.uid,o=e.gid,i=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),c=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),l=parseInt("001",8),f=a|u,p=n&l||n&u&&o===c||n&a&&r===i||n&f&&i===0;return p}s(jb,"checkMode")});var eh=le((eP,Qm)=>{var QS=Te("fs"),zi;process.platform==="win32"||global.TESTING_WINDOWS?zi=Jm():zi=Ym();Qm.exports=yf;yf.sync=Mb;function yf(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,o){yf(e,t||{},function(i,c){i?o(i):r(c)})})}zi(e,t||{},function(r,o){r&&(r.code==="EACCES"||t&&t.ignoreErrors)&&(r=null,o=!1),n(r,o)})}s(yf,"isexe");function Mb(e,t){try{return zi.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}s(Mb,"sync")});var ch=le((nP,sh)=>{var cn=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",th=Te("path"),Fb=cn?";":":",nh=eh(),rh=s(e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),"getNotFoundError"),oh=s((e,t)=>{let n=t.colon||Fb,r=e.match(/\//)||cn&&e.match(/\\/)?[""]:[...cn?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],o=cn?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",i=cn?o.split(n):[""];return cn&&e.indexOf(".")!==-1&&i[0]!==""&&i.unshift(""),{pathEnv:r,pathExt:i,pathExtExe:o}},"getPathInfo"),ih=s((e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});let{pathEnv:r,pathExt:o,pathExtExe:i}=oh(e,t),c=[],a=s(l=>new Promise((f,p)=>{if(l===r.length)return t.all&&c.length?f(c):p(rh(e));let d=r[l],m=/^".*"$/.test(d)?d.slice(1,-1):d,g=th.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(a(f+1));let g=o[p];nh(l+g,{pathExt:i},(y,b)=>{if(!y&&b)if(t.all)c.push(l+g);else return d(l+g);return d(u(l,f,p+1))})}),"subStep");return n?a(0).then(l=>n(null,l),n):a(0)},"which"),Ub=s((e,t)=>{t=t||{};let{pathEnv:n,pathExt:r,pathExtExe:o}=oh(e,t),i=[];for(let c=0;c<n.length;c++){let a=n[c],u=/^".*"$/.test(a)?a.slice(1,-1):a,l=th.join(u,e),f=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+l:l;for(let p=0;p<r.length;p++){let d=f+r[p];try{if(nh.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 rh(e)},"whichSync");sh.exports=ih;ih.sync=Ub});var uh=le((oP,wf)=>{"use strict";var ah=s((e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"},"pathKey");wf.exports=ah;wf.exports.default=ah});var dh=le((sP,ph)=>{"use strict";var lh=Te("path"),Vb=ch(),Kb=uh();function fh(e,t){let n=e.options.env||process.env,r=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 c;try{c=Vb.sync(e.command,{path:n[Kb({env:n})],pathExt:t?lh.delimiter:void 0})}catch{}finally{i&&process.chdir(r)}return c&&(c=lh.resolve(o?e.options.cwd:"",c)),c}s(fh,"resolveCommandAttempt");function Hb(e){return fh(e)||fh(e,!0)}s(Hb,"resolveCommand");ph.exports=Hb});var mh=le((aP,vf)=>{"use strict";var bf=/([()\][%!^"`<>&|;, *?])/g;function Bb(e){return e=e.replace(bf,"^$1"),e}s(Bb,"escapeCommand");function Jb(e,t){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(bf,"^$1"),t&&(e=e.replace(bf,"^$1")),e}s(Jb,"escapeArgument");vf.exports.command=Bb;vf.exports.argument=Jb});var gh=le((lP,hh)=>{"use strict";hh.exports=/^#!(.*)/});var yh=le((fP,_h)=>{"use strict";var Wb=gh();_h.exports=(e="")=>{let t=e.match(Wb);if(!t)return null;let[n,r]=t[0].replace(/#! ?/,"").split(" "),o=n.split("/").pop();return o==="env"?r:r?`${o} ${r}`:o}});var bh=le((pP,wh)=>{"use strict";var $f=Te("fs"),Xb=yh();function qb(e){let n=Buffer.alloc(150),r;try{r=$f.openSync(e,"r"),$f.readSync(r,n,0,150,0),$f.closeSync(r)}catch{}return Xb(n.toString())}s(qb,"readShebang");wh.exports=qb});var Oi=le((mP,xh)=>{"use strict";var Gb=Te("path"),vh=dh(),$h=mh(),Yb=bh(),Qb=process.platform==="win32",ev=/\.(?:com|exe)$/i,tv=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function nv(e){e.file=vh(e);let t=e.file&&Yb(e.file);return t?(e.args.unshift(e.file),e.command=t,vh(e)):e.file}s(nv,"detectShebang");function rv(e){if(!Qb)return e;let t=nv(e),n=!ev.test(t);if(e.options.forceShell||n){let r=tv.test(t);e.command=Gb.normalize(e.command),e.command=$h.command(e.command),e.args=e.args.map(i=>$h.argument(i,r));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(rv,"parseNonShell");function ov(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:rv(r)}s(ov,"parse");xh.exports=ov});var Ph=le((gP,Sh)=>{"use strict";var xf=process.platform==="win32";function kf(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(kf,"notFoundError");function iv(e,t){if(!xf)return;let n=e.emit;e.emit=function(r,o){if(r==="exit"){let i=kh(o,t);if(i)return n.call(e,"error",i)}return n.apply(e,arguments)}}s(iv,"hookChildProcess");function kh(e,t){return xf&&e===1&&!t.file?kf(t.original,"spawn"):null}s(kh,"verifyENOENT");function sv(e,t){return xf&&e===1&&!t.file?kf(t.original,"spawnSync"):null}s(sv,"verifyENOENTSync");Sh.exports={hookChildProcess:iv,verifyENOENT:kh,verifyENOENTSync:sv,notFoundError:kf}});var zf=le((yP,an)=>{"use strict";var zh=Te("child_process"),Sf=Oi(),Pf=Ph();function Oh(e,t,n){let r=Sf(e,t,n),o=zh.spawn(r.command,r.args,r.options);return Pf.hookChildProcess(o,r),o}s(Oh,"spawn");function cv(e,t,n){let r=Sf(e,t,n),o=zh.spawnSync(r.command,r.args,r.options);return o.error=o.error||Pf.verifyENOENTSync(o.status,r),o}s(cv,"spawnSync");an.exports=Oh;an.exports.spawn=Oh;an.exports.sync=cv;an.exports._parse=Sf;an.exports._enoent=Pf});import{spawn as Yx}from"node:child_process";var _={};Pe(_,{$brand:()=>os,$input:()=>Ia,$output:()=>Ea,INVALID:()=>ee,NEVER:()=>rs,TimePrecision:()=>Ua,ZodAny:()=>El,ZodArray:()=>Cl,ZodBase64:()=>_i,ZodBase64URL:()=>yi,ZodBigInt:()=>rn,ZodBigIntFormat:()=>vi,ZodBoolean:()=>nn,ZodCIDRv4:()=>hi,ZodCIDRv6:()=>gi,ZodCUID:()=>ai,ZodCUID2:()=>ui,ZodCatch:()=>ef,ZodCodec:()=>ur,ZodCompileAsyncError:()=>_e,ZodCompileUnsupportedError:()=>A,ZodCreditCard:()=>vl,ZodCustom:()=>lr,ZodCustomStringFormat:()=>mt,ZodDate:()=>rr,ZodDefault:()=>Wl,ZodDiscriminatedUnion:()=>Dl,ZodE164:()=>wi,ZodEmail:()=>oi,ZodEmoji:()=>si,ZodEnum:()=>Qt,ZodError:()=>lb,ZodExactOptional:()=>Si,ZodFile:()=>Kl,ZodFirstPartyTypeKind:()=>hf,ZodFunction:()=>ff,ZodGUID:()=>ii,ZodIBAN:()=>$l,ZodIPv4:()=>di,ZodIPv6:()=>mi,ZodISODate:()=>He,ZodISODateTime:()=>Ke,ZodISODuration:()=>Je,ZodISOTime:()=>Be,ZodInstanceOf:()=>mf,ZodIntersection:()=>Zl,ZodIssueCode:()=>db,ZodJWT:()=>bi,ZodKSUID:()=>pi,ZodLazy:()=>af,ZodLiteral:()=>Vl,ZodMAC:()=>bl,ZodMap:()=>Fl,ZodNaN:()=>nf,ZodNanoID:()=>ci,ZodNever:()=>Al,ZodNonOptional:()=>Pi,ZodNull:()=>zl,ZodNullable:()=>Jl,ZodNumber:()=>tn,ZodNumberFormat:()=>ht,ZodObject:()=>ir,ZodOptional:()=>cr,ZodPipe:()=>ar,ZodPrefault:()=>ql,ZodPreprocess:()=>rf,ZodPromise:()=>lf,ZodReadonly:()=>of,ZodRealError:()=>ue,ZodRecord:()=>Yt,ZodSet:()=>Ul,ZodString:()=>en,ZodStringFormat:()=>L,ZodSuccess:()=>Ql,ZodSymbol:()=>Sl,ZodTemplateLiteral:()=>cf,ZodTransform:()=>Hl,ZodTuple:()=>Rl,ZodType:()=>E,ZodULID:()=>li,ZodURL:()=>nr,ZodUUID:()=>$e,ZodUndefined:()=>Pl,ZodUnion:()=>sr,ZodUnknown:()=>Il,ZodVoid:()=>Nl,ZodXID:()=>fi,ZodXor:()=>Tl,_ZodString:()=>ri,_default:()=>Xl,_function:()=>km,any:()=>tm,array:()=>or,base64:()=>Dd,base64url:()=>Zd,bigint:()=>qd,boolean:()=>kl,catch:()=>tf,check:()=>Sm,cidrv4:()=>Cd,cidrv6:()=>Td,clone:()=>T,codec:()=>bm,coerce:()=>_f,compile:()=>Ta,config:()=>U,core:()=>Ae,creditCard:()=>Rd,cuid:()=>Sd,cuid2:()=>Pd,currencyCode:()=>Kd,custom:()=>Pm,date:()=>rm,decode:()=>dl,decodeAsync:()=>hl,deepPartial:()=>jm,describe:()=>zm,discriminatedUnion:()=>um,e164:()=>Ld,email:()=>hd,emoji:()=>xd,encode:()=>pl,encodeAsync:()=>ml,endsWith:()=>Ft,enum:()=>xi,exactOptional:()=>Bl,file:()=>gm,flattenError:()=>Sn,float32:()=>Bd,float64:()=>Jd,formatError:()=>Pn,fromJSONSchema:()=>Lm,function:()=>km,getDiscriminatedOption:()=>ra,getErrorMap:()=>hb,globalRegistry:()=>W,gt:()=>be,gte:()=>pe,guid:()=>gd,hash:()=>Hd,hex:()=>Vd,hostname:()=>Ud,httpUrl:()=>$d,iban:()=>jd,includes:()=>jt,input:()=>Fm,instanceof:()=>Em,int:()=>ti,int32:()=>Wd,int64:()=>Gd,intersection:()=>Ll,invertCodec:()=>vm,ipv4:()=>Id,ipv6:()=>Nd,iso:()=>fr,json:()=>Am,jwt:()=>Md,keyof:()=>om,ksuid:()=>Ed,lazy:()=>uf,length:()=>ut,literal:()=>hm,locales:()=>Bn,looseObject:()=>cm,looseRecord:()=>fm,lowercase:()=>Lt,lt:()=>we,lte:()=>fe,mac:()=>Ad,map:()=>pm,maxLength:()=>at,maxSize:()=>Me,memoizer:()=>Kn,meta:()=>Om,mime:()=>Vt,minLength:()=>Ie,minSize:()=>ve,multipleOf:()=>je,nan:()=>wm,nanoid:()=>kd,nativeEnum:()=>mm,negative:()=>Ko,never:()=>$i,nonnegative:()=>Bo,nonoptional:()=>Yl,nonpositive:()=>Ho,normalize:()=>Kt,null:()=>Ol,nullable:()=>tr,nullish:()=>_m,number:()=>xl,object:()=>im,optional:()=>pt,output:()=>Um,overwrite:()=>ye,parse:()=>al,parseAsync:()=>ul,partialRecord:()=>lm,pipe:()=>ni,positive:()=>Vo,prefault:()=>Gl,preprocess:()=>Nm,prettifyError:()=>us,promise:()=>xm,properties:()=>Ut,property:()=>Jo,readonly:()=>sf,record:()=>Ml,refine:()=>pf,regex:()=>Zt,regexes:()=>he,registry:()=>yo,safeDecode:()=>_l,safeDecodeAsync:()=>wl,safeEncode:()=>gl,safeEncodeAsync:()=>yl,safeParse:()=>ll,safeParseAsync:()=>fl,set:()=>dm,setErrorMap:()=>mb,size:()=>ct,slugify:()=>Wt,startsWith:()=>Mt,strictObject:()=>sm,string:()=>er,stringFormat:()=>Fd,stringbool:()=>Im,success:()=>ym,superRefine:()=>df,symbol:()=>Qd,templateLiteral:()=>$m,toJSONSchema:()=>Go,toLowerCase:()=>Bt,toUpperCase:()=>Jt,toZod:()=>hn,transform:()=>ki,treeifyError:()=>as,trim:()=>Ht,tuple:()=>jl,uint32:()=>Xd,uint64:()=>Yd,ulid:()=>zd,undefined:()=>em,union:()=>on,unknown:()=>ft,uppercase:()=>Rt,url:()=>vd,util:()=>x,uuid:()=>_d,uuidv4:()=>yd,uuidv6:()=>wd,uuidv7:()=>bd,validate:()=>zn,validateAsync:()=>On,void:()=>nm,withParser:()=>wo,xid:()=>Od,xor:()=>am});var Ae={};Pe(Ae,{$ZodAny:()=>Wc,$ZodArray:()=>ea,$ZodAsyncError:()=>ce,$ZodBase64:()=>Zc,$ZodBase64URL:()=>Lc,$ZodBigInt:()=>so,$ZodBigIntFormat:()=>Kc,$ZodBoolean:()=>Rn,$ZodCIDRv4:()=>Tc,$ZodCIDRv6:()=>Dc,$ZodCUID:()=>$c,$ZodCUID2:()=>xc,$ZodCatch:()=>wa,$ZodCheck:()=>R,$ZodCheckBigIntFormat:()=>Xs,$ZodCheckEndsWith:()=>cc,$ZodCheckGreaterThan:()=>Kr,$ZodCheckIncludes:()=>ic,$ZodCheckLengthEquals:()=>tc,$ZodCheckLessThan:()=>Vr,$ZodCheckLowerCase:()=>rc,$ZodCheckMaxLength:()=>Qs,$ZodCheckMaxSize:()=>qs,$ZodCheckMimeType:()=>lc,$ZodCheckMinLength:()=>ec,$ZodCheckMinSize:()=>Gs,$ZodCheckMultipleOf:()=>Js,$ZodCheckNumberFormat:()=>Ws,$ZodCheckOverwrite:()=>fc,$ZodCheckProperties:()=>uc,$ZodCheckProperty:()=>ac,$ZodCheckRegex:()=>nc,$ZodCheckSizeEquals:()=>Ys,$ZodCheckStartsWith:()=>sc,$ZodCheckStringFormat:()=>Nt,$ZodCheckUpperCase:()=>oc,$ZodCodec:()=>Mn,$ZodCreditCard:()=>jc,$ZodCustom:()=>Pa,$ZodCustomStringFormat:()=>Uc,$ZodCyclicError:()=>mo,$ZodDate:()=>Yc,$ZodDefault:()=>ha,$ZodDiscriminatedUnion:()=>oa,$ZodE164:()=>Rc,$ZodEmail:()=>gc,$ZodEmoji:()=>bc,$ZodEncodeError:()=>Le,$ZodEnum:()=>ua,$ZodError:()=>cs,$ZodExactOptional:()=>da,$ZodFile:()=>fa,$ZodFunction:()=>ka,$ZodGUID:()=>mc,$ZodIBAN:()=>Mc,$ZodIPv4:()=>Ac,$ZodIPv6:()=>Nc,$ZodISODate:()=>Oc,$ZodISODateTime:()=>zc,$ZodISODuration:()=>Ic,$ZodISOTime:()=>Ec,$ZodIntersection:()=>ia,$ZodJWT:()=>Fc,$ZodKSUID:()=>Pc,$ZodLazy:()=>Fn,$ZodLiteral:()=>la,$ZodMAC:()=>Cc,$ZodMap:()=>ca,$ZodNaN:()=>ba,$ZodNanoID:()=>vc,$ZodNever:()=>qc,$ZodNonOptional:()=>_a,$ZodNull:()=>Jc,$ZodNullable:()=>ma,$ZodNumber:()=>io,$ZodNumberFormat:()=>Vc,$ZodObject:()=>Dp,$ZodObjectJIT:()=>ta,$ZodOptional:()=>ao,$ZodPipe:()=>uo,$ZodPrefault:()=>ga,$ZodPreprocess:()=>va,$ZodPromise:()=>Sa,$ZodReadonly:()=>$a,$ZodRealError:()=>ae,$ZodRecord:()=>sa,$ZodRegistry:()=>_o,$ZodSet:()=>aa,$ZodString:()=>rt,$ZodStringFormat:()=>D,$ZodSuccess:()=>ya,$ZodSymbol:()=>Hc,$ZodTemplateLiteral:()=>xa,$ZodTransform:()=>pa,$ZodTuple:()=>co,$ZodType:()=>z,$ZodULID:()=>kc,$ZodURL:()=>wc,$ZodUUID:()=>hc,$ZodUndefined:()=>Bc,$ZodUnion:()=>jn,$ZodUnknown:()=>Xc,$ZodVoid:()=>Gc,$ZodXID:()=>Sc,$ZodXor:()=>na,$brand:()=>os,$constructor:()=>h,$input:()=>Ia,$output:()=>Ea,Doc:()=>nt,INVALID:()=>ee,JSONSchema:()=>pd,JSONSchemaGenerator:()=>Yo,NEVER:()=>rs,TimePrecision:()=>Ua,URL_BAD_FORMAT:()=>_c,URL_UNPARSEABLE:()=>Cn,ZodCompileAsyncError:()=>_e,ZodCompileUnsupportedError:()=>A,_any:()=>iu,_array:()=>pu,_base64:()=>jo,_base64url:()=>Mo,_bigint:()=>Ya,_boolean:()=>qa,_catch:()=>Yw,_check:()=>qp,_cidrv4:()=>Lo,_cidrv6:()=>Ro,_coercedBigint:()=>Qa,_coercedBoolean:()=>Ga,_coercedDate:()=>lu,_coercedNumber:()=>Ka,_coercedString:()=>Ra,_creditCard:()=>Ma,_cuid:()=>Io,_cuid2:()=>Ao,_custom:()=>mu,_date:()=>uu,_decode:()=>Nr,_decodeAsync:()=>Tr,_default:()=>Xw,_discriminatedUnion:()=>Lw,_e164:()=>Fo,_email:()=>$o,_emoji:()=>Oo,_encode:()=>Ar,_encodeAsync:()=>Cr,_endsWith:()=>Ft,_enum:()=>Vw,_file:()=>du,_float32:()=>Ba,_float64:()=>Ja,_gt:()=>be,_gte:()=>pe,_guid:()=>xo,_iban:()=>Fa,_includes:()=>jt,_int:()=>Ha,_int32:()=>Wa,_int64:()=>eu,_intersection:()=>Rw,_ipv4:()=>Do,_ipv6:()=>Zo,_isoDate:()=>Xn,_isoDateTime:()=>Wn,_isoDuration:()=>Gn,_isoTime:()=>qn,_jwt:()=>Uo,_ksuid:()=>To,_lazy:()=>nb,_length:()=>ut,_literal:()=>Hw,_lowercase:()=>Lt,_lt:()=>we,_lte:()=>fe,_mac:()=>ja,_map:()=>Fw,_max:()=>fe,_maxLength:()=>at,_maxSize:()=>Me,_mime:()=>Vt,_min:()=>pe,_minLength:()=>Ie,_minSize:()=>ve,_multipleOf:()=>je,_nan:()=>fu,_nanoid:()=>Eo,_nativeEnum:()=>Kw,_negative:()=>Ko,_never:()=>cu,_nonnegative:()=>Bo,_nonoptional:()=>qw,_nonpositive:()=>Ho,_normalize:()=>Kt,_null:()=>ou,_nullable:()=>Ww,_number:()=>Va,_optional:()=>Jw,_overwrite:()=>ye,_parse:()=>Ot,_parseAsync:()=>Et,_pipe:()=>Qw,_positive:()=>Vo,_promise:()=>rb,_properties:()=>Ut,_property:()=>Jo,_readonly:()=>eb,_record:()=>Mw,_refine:()=>hu,_regex:()=>Zt,_safeDecode:()=>Zr,_safeDecodeAsync:()=>Rr,_safeEncode:()=>Dr,_safeEncodeAsync:()=>Lr,_safeParse:()=>It,_safeParseAsync:()=>At,_set:()=>Uw,_size:()=>ct,_slugify:()=>Wt,_startsWith:()=>Mt,_string:()=>La,_stringFormat:()=>lt,_stringbool:()=>wu,_success:()=>Gw,_superRefine:()=>gu,_symbol:()=>nu,_templateLiteral:()=>tb,_toLowerCase:()=>Bt,_toUpperCase:()=>Jt,_transform:()=>Bw,_trim:()=>Ht,_tuple:()=>jw,_uint32:()=>Xa,_uint64:()=>tu,_ulid:()=>No,_undefined:()=>ru,_union:()=>Dw,_unknown:()=>su,_uppercase:()=>Rt,_url:()=>Jn,_uuid:()=>ko,_uuidv4:()=>So,_uuidv6:()=>Po,_uuidv7:()=>zo,_void:()=>au,_xid:()=>Co,_xor:()=>Zw,base64Charset:()=>eo,base64urlCharset:()=>Ln,canParseURL:()=>yc,clone:()=>T,compile:()=>Ta,compileFn:()=>bo,config:()=>U,createStandardJSONSchemaMethod:()=>Xt,createToJSONSchemaMethod:()=>vu,decode:()=>U_,decodeAsync:()=>K_,describe:()=>_u,encode:()=>F_,encodeAsync:()=>V_,extractDefs:()=>Ue,finalize:()=>Ve,flattenError:()=>Sn,formatError:()=>Pn,getDiscriminatedOption:()=>ra,globalConfig:()=>B,globalRegistry:()=>W,handleUnrepresentable:()=>V,initializeContext:()=>Fe,isBackEdge:()=>go,isRecursiveSchema:()=>ho,isValidBase64:()=>Zn,isValidBase64URL:()=>to,isValidCIDRv6:()=>Qr,isValidCreditCard:()=>no,isValidIBAN:()=>ro,isValidIPv6:()=>Dn,isValidJWT:()=>oo,locales:()=>Bn,memoizer:()=>Kn,mergeValues:()=>Ct,meta:()=>yu,parse:()=>Er,parseAsync:()=>Ir,parseURLObject:()=>Np,prettifyError:()=>us,process:()=>Z,processSchema:()=>Z,regexes:()=>he,registry:()=>yo,safeDecode:()=>B_,safeDecodeAsync:()=>W_,safeEncode:()=>H_,safeEncodeAsync:()=>J_,safeParse:()=>Z_,safeParseAsync:()=>L_,standardProps:()=>Xr,stripTabAndNewline:()=>Tn,toDotPath:()=>fp,toJSONSchema:()=>Go,toZod:()=>hn,treeifyError:()=>as,urlHostnameOk:()=>Gr,urlProtocolOk:()=>Yr,util:()=>x,validate:()=>zn,validateAsync:()=>On,validateURL:()=>qr,version:()=>pc,withParser:()=>wo});var x={};Pe(x,{BIGINT_FORMAT_RANGES:()=>bn,CONSTANT_CATCH:()=>zr,Class:()=>Bi,NUMBER_FORMAT_RANGES:()=>wn,aborted:()=>Q,allowsEval:()=>Xi,assert:()=>n_,assertEqual:()=>Yg,assertIs:()=>e_,assertNever:()=>t_,assertNotEqual:()=>Qg,assignProp:()=>J,attachSchema:()=>vn,base64ToUint8Array:()=>ip,base64urlToUint8Array:()=>v_,cached:()=>kt,captureStackTrace:()=>kr,cleanEnum:()=>b_,cleanRegex:()=>Oe,clone:()=>T,cloneDef:()=>i_,codePointLength:()=>et,constantCatch:()=>ts,createTransparentProxy:()=>f_,defineLazy:()=>Ji,defineLazyInternal:()=>I,derived:()=>S_,esc:()=>Y,escapeRegex:()=>me,explicitlyAborted:()=>Yi,extend:()=>m_,finalizeIssue:()=>se,floatSafeRemainder:()=>gn,getElementAtPath:()=>s_,getEnumValues:()=>$t,getLengthableOrigin:()=>xn,getParsedType:()=>l_,getSizableOrigin:()=>$n,hexToUint8Array:()=>x_,hide:()=>kn,installLazyProp:()=>E_,isObject:()=>Qe,isPlainObject:()=>de,issue:()=>zt,joinValues:()=>$r,jsonStringifyReplacer:()=>xt,members:()=>es,merge:()=>g_,mergeDefs:()=>ge,normalizeParams:()=>w,nullish:()=>xr,numKeys:()=>u_,objectClone:()=>r_,omit:()=>d_,optionalKeys:()=>Gi,own:()=>Ze,parsedType:()=>Qi,partial:()=>__,pick:()=>p_,prefixIssues:()=>ie,primitiveTypes:()=>qi,promiseAllObject:()=>c_,propertyKeyTypes:()=>yn,randomString:()=>a_,rawShape:()=>St,required:()=>y_,safeExtend:()=>h_,shallowClone:()=>_n,sizeCaps:()=>Pt,slugify:()=>Wi,stringifyPrimitive:()=>Sr,toZod:()=>hn,uint8ArrayToBase64:()=>sp,uint8ArrayToBase64url:()=>$_,uint8ArrayToHex:()=>k_,unwrapMessage:()=>vt});function Yg(e){return e}s(Yg,"assertEqual");function Qg(e){return e}s(Qg,"assertNotEqual");function hn(){return e=>e}s(hn,"toZod");function e_(e){}s(e_,"assertIs");function t_(e){throw new Error("Unexpected value in exhaustive check")}s(t_,"assertNever");function n_(e){}s(n_,"assert");function $t(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}s($t,"getEnumValues");function $r(e,t="|"){return e.map(n=>Sr(n)).join(t)}s($r,"joinValues");function xt(e,t){return typeof t=="bigint"?t.toString():t}s(xt,"jsonStringifyReplacer");var Hi=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}};function kt(e){return new Hi(e)}s(kt,"cached");function xr(e){return e==null}s(xr,"nullish");function Oe(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}s(Oe,"cleanRegex");function gn(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}s(gn,"floatSafeRemainder");var tp=Symbol("evaluating");function Ji(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==tp)return r===void 0&&(r=tp,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}s(Ji,"defineLazy");function r_(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}s(r_,"objectClone");function J(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}s(J,"assignProp");function St(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}s(St,"rawShape");function ze(e){return St(e._zod.def)??e._zod.def.shape}s(ze,"sourceShape");function np(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return J(this,t,r),r},enumerable:!0,configurable:!0})}s(np,"deferProp");function rp(e,t,n){t in e?J(e,t,n):e[t]=n}s(rp,"putProp");function Ye(e,t,n,r){let o=ze(t);for(let i of n){let c=Object.getOwnPropertyDescriptor(o,i);c.enumerable&&(c.get?np(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a}):rp(e,i,r?r(c.value,i):c.value))}}s(Ye,"mirrorShape");function o_(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?np(e,n,()=>t[n]):rp(e,n,r.value))}}s(o_,"mirrorProps");function ge(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}s(ge,"mergeDefs");function i_(e){return ge(e._zod.def)}s(i_,"cloneDef");function s_(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}s(s_,"getElementAtPath");function c_(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=r[i];return o})}s(c_,"promiseAllObject");function a_(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}s(a_,"randomString");function Y(e){return JSON.stringify(e)}s(Y,"esc");function Wi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}s(Wi,"slugify");var kr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Qe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Qe,"isObject");var Xi=kt(()=>{if(B.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function de(e){if(Qe(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Qe(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}s(de,"isPlainObject");function _n(e){return de(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}s(_n,"shallowClone");function u_(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}s(u_,"numKeys");var l_=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"),yn=new Set(["string","number","symbol"]),qi=new Set(["string","number","bigint","boolean","symbol","undefined"]);function me(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(me,"escapeRegex");function T(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}s(T,"clone");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}s(w,"normalizeParams");function f_(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,i){return t??(t=e()),Reflect.set(t,r,o,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}s(f_,"createTransparentProxy");function Sr(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}s(Sr,"stringifyPrimitive");function Gi(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}s(Gi,"optionalKeys");var wn={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]},bn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function p_(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return Ye(i,e,Pr(e,t)),T(e,ge(n,{shape:i,checks:[]}))}s(p_,"pick");function Pr(e,t){let n=ze(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&r.push(o)}return r}s(Pr,"maskedKeys");function d_(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Pr(e,t)),c={};return Ye(c,e,Reflect.ownKeys(ze(e)).filter(a=>!i.has(a))),T(e,ge(n,{shape:c,checks:[]}))}s(d_,"omit");function m_(e,t){if(!de(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.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 T(e,ge(e._zod.def,{shape:op(e,t)}))}s(m_,"extend");function op(e,t){let n={};return Ye(n,e,Reflect.ownKeys(ze(e))),o_(n,t),n}s(op,"extended");function h_(e,t){if(!de(t))throw new Error("Invalid input to safeExtend: expected a plain object");return T(e,ge(e._zod.def,{shape:op(e,t)}))}s(h_,"safeExtend");function g_(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 n={};Ye(n,e,Reflect.ownKeys(ze(e))),Ye(n,t,Reflect.ownKeys(ze(t)));let r=ge(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return T(e,r)}s(g_,"merge");function __(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Pr(t,n)):void 0,u={};return Ye(u,t,Reflect.ownKeys(ze(t)),e&&((l,f)=>a&&!a.has(f)?l:new e({type:"optional",innerType:l}))),T(t,ge(t._zod.def,{shape:u,checks:[]}))}s(__,"partial");function y_(e,t,n){let r=n?new Set(Pr(t,n)):void 0,o={};return Ye(o,t,Reflect.ownKeys(ze(t)),(i,c)=>r&&!r.has(c)?i:new e({type:"nonoptional",innerType:i})),T(t,ge(t._zod.def,{shape:o}))}s(y_,"required");function Q(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}s(Q,"aborted");function Yi(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}s(Yi,"explicitlyAborted");function ie(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}s(ie,"prefixIssues");function vt(e){return typeof e=="string"?e:e?.message}s(vt,"unwrapMessage");function Pt(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;o>=0&&t.push([o,n])}return t}s(Pt,"sizeCaps");function vn(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}s(vn,"attachSchema");function se(e,t,n){var r;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,c=e.message?e.message:vt(e.inst?._zod.def?.error?.(e))??vt(i?.(e))??vt(t?.error?.(e))??vt(n.customError?.(e))??vt(n.localeError?.(e))??"Invalid input",a={};for(let u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(a[u]=e[u]);return a.path??(a.path=[]),a.message=c,t?.reportInput&&(a.input=e.input),a}s(se,"finalizeIssue");function $n(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}s($n,"getSizableOrigin");var w_=/[\uD800-\uDBFF]/;function et(e){let t=e.length;if(!w_.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}s(et,"codePointLength");function xn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}s(xn,"getLengthableOrigin");function Qi(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 n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}s(Qi,"parsedType");function zt(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}s(zt,"issue");function b_(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}s(b_,"cleanEnum");function ip(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}s(ip,"base64ToUint8Array");function sp(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}s(sp,"uint8ArrayToBase64");function v_(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return ip(t+n)}s(v_,"base64urlToUint8Array");function $_(e){return sp(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s($_,"uint8ArrayToBase64url");function x_(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}s(x_,"hexToUint8Array");function k_(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}s(k_,"uint8ArrayToHex");var Bi=class{static{s(this,"Class")}constructor(...t){}};function es(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):P_(e,n,r.value)}}s(es,"members");function Ze(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}s(Ze,"own");function kn(e,t,n){return Ze(e,t,n,!1)}s(kn,"hide");function S_(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Ze(this,n,r(this))},set(o){Ze(this,n,o)}})}return t}s(S_,"derived");function P_(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ze(this,t,n.bind(this))},set(r){Ze(this,t,r)}})}s(P_,"defineBound");function z_(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}s(z_,"claim");var Ki,De=!1,O_={configurable:!0,get(){De=!0}};function I(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ki!==e._zod){Ki=void 0;return}Ki=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,O_);let o=De;De=!1;try{let i=n(this);return De?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),De=De||o,i}catch(i){throw delete this[t],De=De||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}s(I,"defineLazyInternal");function E_(e,t,n,r){let o=z_(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}s(E_,"installLazyProp");var zr="~constantCatch";function ts(e){let t=s(()=>e,"fn");return t[zr]=!0,t}s(ts,"constantCatch");var cp,rs=Object.freeze({status:"aborted"}),ns={value:void 0,enumerable:!1},ap="captureStackTrace"in Error?Error:null;function I_(e){let t=ap;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return ap=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}s(I_,"newError");function h(e,t,n,r){let o={};function i(d){this.def=d,this.constr=p,this.traits=new Set}s(i,"Internals"),i.prototype=o;let c=n,a=c&&new WeakSet;function u(d,m){if(d._zod){if(d._zod.traits.has(e))return}else{ns.value=new i(m);try{Object.defineProperty(d,"_zod",ns)}finally{ns.value=void 0}}if(d._zod.traits.add(e),t(d,m),a){let y=Object.getPrototypeOf(d),b=d._zod.constr.prototype,k=y;for(;k&&k!==b;)k=Object.getPrototypeOf(k);let $=k??y;a.has($)||(a.add($),es($,c))}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=r?.Parent??Object;class f extends l{static{s(this,"Definition")}}Object.defineProperty(f,"name",{value:e});function p(d){let m=r?.Parent?I_(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=>r?.Parent&&d instanceof r.Parent?!0:d?._zod?.traits?.has(e),"value")}),Object.defineProperty(p,"name",{value:e}),p}s(h,"$constructor");var os=Symbol("zod_brand"),ce=class extends Error{static{s(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Le=class extends Error{static{s(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(cp=globalThis).__zod_globalConfig??(cp.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function U(e){return e&&Object.assign(B,e),B}s(U,"config");function A_(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,xt,2)),e.message}s(A_,"_getMessage");function N_(e){this._zod.message=e}s(N_,"_setMessage");var C_={get:A_,set:N_,enumerable:!0,configurable:!0},ss={value:void 0,enumerable:!1},up=new WeakSet([Object.prototype,Error.prototype]),lp=s((e,t)=>{e.name="$ZodError",ss.value=t,Object.defineProperty(e,"issues",ss),ss.value=void 0,Object.defineProperty(e,"message",C_);let n=Object.getPrototypeOf(e);up.has(n)||(up.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=s(()=>this.message,"value");return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},"initializer"),cs=h("$ZodError",lp),ae=h("$ZodError",lp,void 0,{Parent:Error});function T_(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}s(T_,"node");function Sn(e,t=n=>n.message){let n={},r=[];for(let o of e.issues)o.path.length>0?T_(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}s(Sn,"flattenError");function Pn(e,t=n=>n.message){let n={_errors:[]},r=s((o,i=[])=>{for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(a=>r({issues:a},[...i,...c.path]));else if(c.code==="invalid_key")r({issues:c.issues},[...i,...c.path]);else if(c.code==="invalid_element")r({issues:c.issues},[...i,...c.path]);else{let a=[...i,...c.path];if(a.length===0)n._errors.push(t(c));else{let u=n,l=0;for(;l<a.length;){let f=a[l],p=l===a.length-1;if(f==="_errors"){p&&u._errors.push(t(c)),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(c)),u=d,l++}}}},"processError");return r(e),n}s(Pn,"formatError");function as(e,t=n=>n.message){let n={errors:[]},r=s((o,i=[])=>{var c;for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(u=>r({issues:u},[...i,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...i,...a.path]);else{let u=[...i,...a.path];if(u.length===0){n.errors.push(t(a));continue}let l=n,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=[]),(c=l.items)[p]??(c[p]={errors:[]}),l=l.items[p]),d&&l.errors.push(t(a)),f++}}},"processError");return r(e),n}s(as,"treeifyError");function fp(e){let t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(let r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}s(fp,"toDotPath");function us(e){let t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(let r of n)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${fp(r.path)}`);return t.join(`
8
+ `)}s(us,"prettifyError");function Or(e,t){return{callee:t?.callee??e,Err:t?.Err}}s(Or,"finalizeParams");var Ot=s(e=>{let t=s((n,r,o,i)=>{let c=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},c);if(a instanceof Promise)throw new ce;if(a.issues.length){let u=new(i?.Err??e)(a.issues.map(l=>se(l,c,U())));throw kr(u,i?.callee??t),u}return a.value},"fn");return t},"_parse"),Er=Ot(ae),Et=s(e=>{let t=s(async(n,r,o,i)=>{let c=o?{...o,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},c);if(a instanceof Promise&&(a=await a),a.issues.length){let u=new(i?.Err??e)(a.issues.map(l=>se(l,c,U())));throw kr(u,i?.callee??t),u}return a.value},"fn");return t},"_parseAsync"),Ir=Et(ae),It=s(e=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new ce;return i.issues.length?pp(e,i.issues,o):{success:!0,data:i.value}},"_safeParse"),Z_=It(ae);function pp(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>se(o,n,U()))),t=void 0,n=void 0),r},set error(o){r=o,t=void 0,n=void 0}}}s(pp,"failure");var At=s(e=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?pp(e,i.issues,o):{success:!0,data:i.value}},"_safeParseAsync"),L_=At(ae),R_=Symbol.for("zod.compile.invalid"),j_=Symbol.for("zod.compile.fallback"),zn=s(((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==R_)return!0;if(r.definite===!0&&n===void 0)return!1}return M_(e,t,n)}),"validate");function M_(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(r[j_]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new ce;return i.issues.length===0}s(M_,"validateFallback");var On=s(async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},"validateAsync"),Ar=s(e=>{let t=Ot(e),n=s((r,o,i,c)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,Or(n,c))},"fn");return n},"_encode"),F_=Ar(ae),Nr=s(e=>{let t=Ot(e),n=s((r,o,i,c)=>t(r,o,i,Or(n,c)),"fn");return n},"_decode"),U_=Nr(ae),Cr=s(e=>{let t=Et(e),n=s(async(r,o,i,c)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,Or(n,c))},"fn");return n},"_encodeAsync"),V_=Cr(ae),Tr=s(e=>{let t=Et(e),n=s(async(r,o,i,c)=>await t(r,o,i,Or(n,c)),"fn");return n},"_decodeAsync"),K_=Tr(ae),Dr=s(e=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return It(e)(t,n,o)},"_safeEncode"),H_=Dr(ae),Zr=s(e=>(t,n,r)=>It(e)(t,n,r),"_safeDecode"),B_=Zr(ae),Lr=s(e=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return At(e)(t,n,o)},"_safeEncodeAsync"),J_=Lr(ae),Rr=s(e=>async(t,n,r)=>At(e)(t,n,r),"_safeDecodeAsync"),W_=Rr(ae);var he={};Pe(he,{anyString:()=>Zs,base64:()=>zs,base64url:()=>Os,bigint:()=>Rs,boolean:()=>js,browserEmail:()=>ny,cidrv4:()=>Ss,cidrv6:()=>Ps,creditCard:()=>jr,cuid:()=>fs,cuid2:()=>ps,currencyCode:()=>Ns,date:()=>Cs,datetime:()=>Ds,domain:()=>Is,duration:()=>ys,e164:()=>As,email:()=>bs,emoji:()=>vs,extendedDuration:()=>X_,guid:()=>ws,hex:()=>Ks,hostname:()=>Es,html5Email:()=>Q_,httpProtocol:()=>En,iban:()=>Mr,idnEmail:()=>ty,integer:()=>In,ipv4:()=>$s,ipv6:()=>xs,ksuid:()=>hs,lowercase:()=>Us,mac:()=>ks,md5_base64:()=>sy,md5_base64url:()=>cy,md5_hex:()=>iy,nanoid:()=>gs,nanoidOfLength:()=>_s,null:()=>Ms,number:()=>Ee,rfc5322Email:()=>ey,sha1_base64:()=>uy,sha1_base64url:()=>ly,sha1_hex:()=>ay,sha256_base64:()=>py,sha256_base64url:()=>dy,sha256_hex:()=>fy,sha384_base64:()=>hy,sha384_base64url:()=>gy,sha384_hex:()=>my,sha512_base64:()=>yy,sha512_base64url:()=>wy,sha512_hex:()=>_y,string:()=>Ls,time:()=>Ts,ulid:()=>ds,undefined:()=>Fs,unicodeEmail:()=>dp,uppercase:()=>Vs,uuid:()=>tt,uuid4:()=>q_,uuid6:()=>G_,uuid7:()=>Y_,xid:()=>ms});var fs=/^[cC][0-9a-z]{6,}$/,ps=/^[0-9a-z]+$/,ds=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ms=/^[0-9a-vA-V]{20}$/,hs=/^[A-Za-z0-9]{27}$/,gs=/^[a-zA-Z0-9_-]{21}$/;function _s(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}s(_s,"nanoidOfLength");var ys=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,X_=/^[-+]?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)?)??$/,ws=/^([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})$/,tt=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"),q_=tt(4),G_=tt(6),Y_=tt(7),bs=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Q_=/^[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])?)*$/,ey=/^(([^<>()\[\]\\.,;:\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,}))$/,dp=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,ty=dp,ny=/^[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])?)*$/,ry="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function vs(){return new RegExp(ry,"u")}s(vs,"emoji");var $s=/^(?:(?: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])$/,xs=/^(([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}|:))$/,ks=s(e=>{let t=me(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"),Ss=/^((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])$/,Ps=/^(([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])$/,zs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Os=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Es=/^(?=.{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])?)*\.?$/,Is=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,En=/^https?$/,As=/^\+[1-9]\d{6,14}$/,jr=/^\d(?:[ -]?\d){11,18}$/,Ns=/^(?: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)$/,Mr=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,mp="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function oy(e){return new RegExp(`^${e}$`)}s(oy,"anchor");var Cs=oy(mp);function ls(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+)?)?`}s(ls,"timeSource");function Ts(e){return new RegExp(`^${ls(e)}$`)}s(Ts,"time");function Ds(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${ls({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${ls({precision:e.precision})}`:n;return new RegExp(`^${mp}T(?:${r})$`)}s(Ds,"datetime");var Zs=/^[\s\S]{0,}$/,Ls=s(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),Rs=/^-?\d+n?$/,In=/^-?\d+$/,Ee=/^-?\d+(?:\.\d+)?$/,js=/^(?:true|false)$/i,Ms=/^null$/i;var Fs=/^undefined$/i;var Us=/^[^A-Z]*$/,Vs=/^[^a-z]*$/,Ks=/^[0-9a-fA-F]*$/;function An(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}s(An,"fixedBase64");function Nn(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}s(Nn,"fixedBase64url");var iy=/^[0-9a-fA-F]{32}$/,sy=An(22,"=="),cy=Nn(22),ay=/^[0-9a-fA-F]{40}$/,uy=An(27,"="),ly=Nn(27),fy=/^[0-9a-fA-F]{64}$/,py=An(43,"="),dy=Nn(43),my=/^[0-9a-fA-F]{96}$/,hy=An(64,""),gy=Nn(64),_y=/^[0-9a-fA-F]{128}$/,yy=An(86,"=="),wy=Nn(86);var R=h("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Hs=s(e=>{let t=e.value;return!xr(t)&&t.size!==void 0},"_whenHasSize"),Bs=s(e=>{let t=e.value;return!xr(t)&&t.length!==void 0},"_whenHasLength"),Fr={number:"number",bigint:"bigint",object:"date"},Vr=h("$ZodCheckLessThan",(e,t)=>{R.init(e,t);let n=Fr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Fr[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Kr=h("$ZodCheckGreaterThan",(e,t)=>{R.init(e,t);let n=Fr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Fr[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Js=h("$ZodCheckMultipleOf",(e,t)=>{R.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):gn(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ws=h("$ZodCheckNumberFormat",(e,t)=>{R.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=wn[t.format];e._zod.check=c=>{let a=c.value;if(n){if(!Number.isInteger(a)){c.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?c.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):c.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&c.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&c.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Xs=h("$ZodCheckBigIntFormat",(e,t)=>{R.init(e,t);let[n,r]=bn[t.format];e._zod.check=o=>{let i=o.value;i<n&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>r&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),qs=h("$ZodCheckMaxSize",(e,t)=>{var n;R.init(e,t),(n=e._zod.def).when??(n.when=Hs),e._zod.check=r=>{let o=r.value;o.size<=t.maximum||r.issues.push({origin:$n(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Gs=h("$ZodCheckMinSize",(e,t)=>{var n;R.init(e,t),(n=e._zod.def).when??(n.when=Hs),e._zod.check=r=>{let o=r.value;o.size>=t.minimum||r.issues.push({origin:$n(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ys=h("$ZodCheckSizeEquals",(e,t)=>{var n;R.init(e,t),(n=e._zod.def).when??(n.when=Hs),e._zod.check=r=>{let o=r.value,i=o.size;if(i===t.size)return;let c=i>t.size;r.issues.push({origin:$n(o),...c?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Qs=h("$ZodCheckMaxLength",(e,t)=>{var n;R.init(e,t),(n=e._zod.def).when??(n.when=Bs),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?et(o):i)<=t.maximum)return;let a=xn(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ec=h("$ZodCheckMinLength",(e,t)=>{var n;R.init(e,t),(n=e._zod.def).when??(n.when=Bs),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?et(o):i)>=t.minimum)return;let a=xn(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),tc=h("$ZodCheckLengthEquals",(e,t)=>{var n;R.init(e,t),(n=e._zod.def).when??(n.when=Bs),e._zod.check=r=>{let o=r.value,i=o.length,c=typeof o=="string"&&i>=t.length&&i<=t.length*2?et(o):i;if(c===t.length)return;let a=xn(o),u=c>t.length;r.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Nt=h("$ZodCheckStringFormat",(e,t)=>{var n,r;R.init(e,t),t.pattern?(n=e._zod).check??(n.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})}):(r=e._zod).check??(r.check=()=>{})}),nc=h("$ZodCheckRegex",(e,t)=>{Nt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),rc=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Us),Nt.init(e,t)}),oc=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Vs),Nt.init(e,t)}),ic=h("$ZodCheckIncludes",(e,t)=>{R.init(e,t);let n=me(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,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})}}),sc=h("$ZodCheckStartsWith",(e,t)=>{R.init(e,t);let n=new RegExp(`^${me(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),cc=h("$ZodCheckEndsWith",(e,t)=>{R.init(e,t);let n=new RegExp(`.*${me(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function Ur(e,t,n){e.issues.length&&t.issues.push(...ie(n,e.issues))}s(Ur,"handleCheckPropertyResult");var ac=h("$ZodCheckProperty",(e,t)=>{R.init(e,t),e._zod.check=n=>{let r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(o=>Ur(o,n,t.property));Ur(r,n,t.property)}}),uc=h("$ZodCheckProperties",(e,t)=>{R.init(e,t),kn(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=r=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(c=>[c,t.shape[c]]));let o=r.value,i;for(let[c,a]of n){let u=a._zod.run({value:o[c],issues:[]},{});u instanceof Promise?(i??(i=[]),i.push(u.then(l=>Ur(l,r,c)))):Ur(u,r,c)}if(i)return Promise.all(i).then(()=>{})}}),lc=h("$ZodCheckMimeType",(e,t)=>{R.init(e,t);let n=new Set(t.mime);e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),fc=h("$ZodCheckOverwrite",(e,t)=>{R.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var nt=class{static{s(this,"Doc")}constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}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 r=t.split(`
9
9
  `).filter(c=>c),o=Math.min(...r.map(c=>c.length-c.trimStart().length)),i=r.map(c=>c.slice(o)).map(c=>" ".repeat(this.indent*2)+c);for(let c of i)this.content.push(c)}compile(){let t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
10
10
  ${n.join(`
11
11
  `)}
12
- };`)(...Object.values(this.closed))}};var oc={major:4,minor:6,patch:7};var z=h("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=oc;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let c of i._zod.onattach)c(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=s((a,u,l)=>{if(a.memo)return a;let f=Y(a),p;for(let d of u){if(d._zod.def.when){if(Ki(a)||!d._zod.def.when(a))continue}else if(f)continue;let m=a.issues.length,g=d._zod.check(a);if(g instanceof Promise&&l?.async===!1)throw new se;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,a.issues.length!==m&&(gn(a.issues,m,e),f||(f=Y(a,m)))});else{if(a.issues.length===m)continue;gn(a.issues,m,e),f||(f=Y(a,m))}}return p?p.then(()=>a):a},"runChecks"),c=s((a,u,l)=>{if(Y(a))return a.aborted=!0,a;let f=i(u,o,l);if(f instanceof Promise){if(l.async===!1)throw new se;return f.then(p=>e._zod.parse(p,l))}return e._zod.parse(f,l)},"handleCanaryResult");e._zod.run=(a,u)=>{if(u.skipChecks)return e._zod.parse(a,u);if(u.direction==="backward"){let f=e._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});return f instanceof Promise?f.then(p=>c(p,a,u)):c(f,a,u)}let l=e._zod.parse(a,u);if(l instanceof Promise){if(u.async===!1)throw new se;return l.then(f=>i(f,o,u))}return i(l,o,u)}}},{get"~standard"(){return wn(this,"~standard",Vr(this))},set"~standard"(e){Ze(this,"~standard",e)}}),xp=s((e,t)=>e.issues.length?{issues:e.issues.map(n=>ie(n,t,F()))}:{value:e.value},"toStandardResult");async function ay(e,t){let n={async:!0};return xp(await e._zod.run({value:t,issues:[]},n),n)}s(ay,"validateAsync");function Vr(e){return{validate:s(t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return xp(r,n)}catch{}return ay(e,t)},"validate"),vendor:"zod",version:1}}s(Vr,"standardProps");var et=h("$ZodString",(e,t)=>{z.init(e,t),e._zod.pattern=t.pattern??Os,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Z=h("$ZodStringFormat",(e,t)=>{It.init(e,t),et.init(e,t)}),sc=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=fs),Z.init(e,t)}),cc=h("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ye(r))}else t.pattern??(t.pattern=Ye());Z.init(e,t)}),ac=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ps),Z.init(e,t)}),uc=1,On=2;function lc(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}s(lc,"canParseURL");function Ur(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?lc(e)||On:kp(e,t)}s(Ur,"validateURL");function kp(e,t){if(!t.normalize&&t.protocol?.source===kn.source&&!/^https?:\/\//i.test(e))return uc;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse=="function")return n.parse(e)??On}return new URL(e)}catch{return On}}s(kp,"parseURLObject");var uy=/[\t\n\r]/g;function In(e){return e.replace(uy,"")}s(In,"stripTabAndNewline");function Kr(e,t){return t.lastIndex=0,t.test(e.hostname)}s(Kr,"urlHostnameOk");function Hr(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}s(Hr,"urlProtocolOk");var fc=h("$ZodURL",(e,t)=>{Z.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),o=Ur(r,t);if(o===uc){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===On){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=In(r);return}t.hostname&&!Kr(o,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Hr(o,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?o.href:In(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),pc=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ds()),Z.init(e,t)}),dc=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?as:us(t.length)),Z.init(e,t)}),mc=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=rs),Z.init(e,t)}),hc=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=os),Z.init(e,t)}),gc=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=is),Z.init(e,t)}),_c=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ss),Z.init(e,t)}),yc=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=cs),Z.init(e,t)}),wc=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=zs(t)),Z.init(e,t)}),bc=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ss),Z.init(e,t)}),vc=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ps(t)),Z.init(e,t)}),$c=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ls),Z.init(e,t)}),xc=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ms),Z.init(e,t)}),ly=/^[0-9a-fA-F:.]+$/;function En(e){return ly.test(e)?lc(`http://[${e}]`):!1}s(En,"isValidIPv6");var kc=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=hs),Z.init(e,t),e._zod.check=n=>{En(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Sc=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=gs(t.delimiter)),Z.init(e,t)}),Pc=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=_s),Z.init(e,t)});function Br(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);return`${o}`!==r||o<0||o>128?!1:En(n)}s(Br,"isValidCIDRv6");var zc=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ys),Z.init(e,t),e._zod.check=n=>{Br(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function An(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}s(An,"isValidBase64");var Jr=/^[0-9a-zA-Z+/]*={0,2}$/,Oc=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Jr),Z.init(e,t),e._zod.check=n=>{An(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Nn=/^[A-Za-z0-9_-]*$/;function Wr(e){if(!Nn.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return An(n)}s(Wr,"isValidBase64URL");var Ic=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Nn),Z.init(e,t),e._zod.check=n=>{Wr(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Ec=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=xs),Z.init(e,t)}),fy=/[- ]/g;function py(e){let t=e.length,n=1,r=0;for(;t;){let o=e.charCodeAt(--t)-48;n^=1,r+=n?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}s(py,"isLuhnAlgo");function qr(e){return Nr.test(e)?py(e.replace(fy,"")):!1}s(qr,"isValidCreditCard");var Ac=h("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Nr),Z.init(e,t),e._zod.check=n=>{qr(n.value)||n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});function dy(e){let t=0,n=e.length;for(let r=4;r<n;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}s(dy,"isIso7064Mod97");function Gr(e){return Cr.test(e)?dy(e):!1}s(Gr,"isValidIBAN");var Nc=h("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Cr),Z.init(e,t),e._zod.check=n=>{Gr(n.value)||n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});function Xr(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}s(Xr,"isValidJWT");var Cc=h("$ZodJWT",(e,t)=>{Z.init(e,t),e._zod.check=n=>{Xr(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Tc=h("$ZodCustomStringFormat",(e,t)=>{Z.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),Yr=h("$ZodNumber",(e,t)=>{z.init(e,t),e._zod.pattern=ze,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Zc=h("$ZodNumberFormat",(e,t)=>{Ms.init(e,t),Yr.init(e,t)}),Cn=h("$ZodBoolean",(e,t)=>{z.init(e,t),e._zod.pattern=As,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Qr=h("$ZodBigInt",(e,t)=>{z.init(e,t),e._zod.pattern=Es,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Dc=h("$ZodBigIntFormat",(e,t)=>{Fs.init(e,t),Qr.init(e,t)}),Rc=h("$ZodSymbol",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),n}}),Lc=h("$ZodUndefined",(e,t)=>{z.init(e,t),e._zod.pattern=Cs,e._zod.values=new Set([void 0]),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),jc=h("$ZodNull",(e,t)=>{z.init(e,t),e._zod.pattern=Ns,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Mc=h("$ZodAny",(e,t)=>{z.init(e,t),e._zod.parse=n=>n}),Fc=h("$ZodUnknown",(e,t)=>{z.init(e,t),e._zod.parse=n=>n}),Vc=h("$ZodNever",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),Uc=h("$ZodVoid",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),Kc=h("$ZodDate",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function Hc(e,t){let n=xt(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,c)=>{let a=t(i.value);if(a>r&&!c?.skipChecks&&c?.direction!=="backward"){for(let[u,l]of xt(e._zod.def.checks))if(a>u&&l._zod.def.when(i)){let f=i.issues.length;return l._zod.check(i),i.issues[f].continue=!1,gn(i.issues,f,e),i}}return o(i,c)}}s(Hc,"capSize");var my=s(e=>Array.isArray(e)?e.length:-1,"arraySize"),hy=s(e=>e instanceof Map?e.size:-1,"mapSize"),gy=s(e=>e instanceof Set?e.size:-1,"setSize");function ap(e,t,n){e.issues.length&&t.issues.push(...oe(n,e.issues)),t.value[n]=e.value}s(ap,"handleArrayResult");var Bc=h("$ZodArray",(e,t)=>{z.init(e,t);let n=B.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);let c=[],a=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)c.push(f.then(p=>ap(p,r,u)));else if(ap(f,r,u),a&&f.issues.length!==0&&Y(f))break}return c.length?Promise.all(c).then(()=>r):r},Hc(e,my)});function Fr(e,t,n,r,o,i){let c=n in r,a=i==="optional";if(!(!c&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!c)return;t.issues.push(...oe(n,e.issues))}if(!c&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(c||o==="defaulted"&&!a)&&(t.value[n]=void 0):t.value[n]=e.value}}s(Fr,"handlePropertyResult");var _y=[];function Sp(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:_y,o=r.length?[...t,...r]:t;for(let c of o)if(!e.shape?.[c]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(c)}": expected a Zod schema`);let i=Ui(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}s(Sp,"normalizeDef");function Pp(e,t,n,r,o,i,c){let a=[],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(c&&n.issues.length!==m){if(Y(n,m))break;m=n.issues.length}if(u.has(g))continue;if(g==="__proto__"){f==="never"&&a.push(g);continue}if(f==="never"){a.push(g);continue}let y=l.run({value:t[g],issues:[]},r);y instanceof Promise?e.push(y.then(b=>Fr(b,n,g,t,p,d))):Fr(y,n,g,t,p,d)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>n):n}s(Pp,"handleCatchall");var zp=h("$ZodObject",(e,t)=>{z.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let l=s(()=>{let f={...r};return Object.defineProperty(t,"shape",{value:f}),l.raw=f,f},"get");l.raw=r,Object.defineProperty(t,"shape",{get:l})}let o=vt(()=>Sp(t));E(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)||J(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=Ge,c=t.catchall,a,u=B.memoizer;u?.attach(e),e._zod.parse=(l,f)=>{a??(a=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=a.shape,g=f?.abortEarly,y=l.issues.length;for(let b of a.allKeys){if(g&&l.issues.length!==y){if(Y(l,y))break;y=l.issues.length}if(b==="__proto__")continue;let k=m[b],$=k._zod.optin,O=k._zod.optout,C=k._zod.run({value:p[b],issues:[]},f);C instanceof Promise?d.push(C.then(j=>Fr(j,l,b,p,$,O))):Fr(C,l,b,p,$,O)}return c?Pp(d,p,l,f,o.value,e,g===!0):d.length?Promise.all(d).then(()=>l):l}}),Jc=h("$ZodObjectJIT",(e,t)=>{zp.init(e,t);let n=e._zod.parse,r=vt(()=>Sp(t)),o=B.memoizer,i=s(m=>{let g=r.value,y=g.symbolKeys,b=new Qe(["payload","ctx"],{shape:m,inst:e,memo:o,syms:y}),k=s(j=>`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`,"parseStr"),$=s((j,N)=>`
12
+ };`)(...Object.values(this.closed))}};var pc={major:4,minor:6,patch:7};var z=h("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=pc;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let c of i._zod.onattach)c(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=s((a,u,l)=>{if(a.memo)return a;let f=Q(a),p;for(let d of u){if(d._zod.def.when){if(Yi(a)||!d._zod.def.when(a))continue}else if(f)continue;let m=a.issues.length,g=d._zod.check(a);if(g instanceof Promise&&l?.async===!1)throw new ce;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,a.issues.length!==m&&(vn(a.issues,m,e),f||(f=Q(a,m)))});else{if(a.issues.length===m)continue;vn(a.issues,m,e),f||(f=Q(a,m))}}return p?p.then(()=>a):a},"runChecks"),c=s((a,u,l)=>{if(Q(a))return a.aborted=!0,a;let f=i(u,o,l);if(f instanceof Promise){if(l.async===!1)throw new ce;return f.then(p=>e._zod.parse(p,l))}return e._zod.parse(f,l)},"handleCanaryResult");e._zod.run=(a,u)=>{if(u.skipChecks)return e._zod.parse(a,u);if(u.direction==="backward"){let f=e._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});return f instanceof Promise?f.then(p=>c(p,a,u)):c(f,a,u)}let l=e._zod.parse(a,u);if(l instanceof Promise){if(u.async===!1)throw new ce;return l.then(f=>i(f,o,u))}return i(l,o,u)}}},{get"~standard"(){return kn(this,"~standard",Xr(this))},set"~standard"(e){Ze(this,"~standard",e)}}),Ap=s((e,t)=>e.issues.length?{issues:e.issues.map(n=>se(n,t,U()))}:{value:e.value},"toStandardResult");async function by(e,t){let n={async:!0};return Ap(await e._zod.run({value:t,issues:[]},n),n)}s(by,"validateAsync");function Xr(e){return{validate:s(t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Ap(r,n)}catch{}return by(e,t)},"validate"),vendor:"zod",version:1}}s(Xr,"standardProps");var rt=h("$ZodString",(e,t)=>{z.init(e,t),e._zod.pattern=t.pattern??Zs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),D=h("$ZodStringFormat",(e,t)=>{Nt.init(e,t),rt.init(e,t)}),mc=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ws),D.init(e,t)}),hc=h("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tt(r))}else t.pattern??(t.pattern=tt());D.init(e,t)}),gc=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=bs),D.init(e,t)}),_c=1,Cn=2;function yc(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}s(yc,"canParseURL");function qr(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?yc(e)||Cn:Np(e,t)}s(qr,"validateURL");function Np(e,t){if(!t.normalize&&t.protocol?.source===En.source&&!/^https?:\/\//i.test(e))return _c;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse=="function")return n.parse(e)??Cn}return new URL(e)}catch{return Cn}}s(Np,"parseURLObject");var vy=/[\t\n\r]/g;function Tn(e){return e.replace(vy,"")}s(Tn,"stripTabAndNewline");function Gr(e,t){return t.lastIndex=0,t.test(e.hostname)}s(Gr,"urlHostnameOk");function Yr(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}s(Yr,"urlProtocolOk");var wc=h("$ZodURL",(e,t)=>{D.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),o=qr(r,t);if(o===_c){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===Cn){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=Tn(r);return}t.hostname&&!Gr(o,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Yr(o,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?o.href:Tn(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),bc=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=vs()),D.init(e,t)}),vc=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?gs:_s(t.length)),D.init(e,t)}),$c=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=fs),D.init(e,t)}),xc=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ps),D.init(e,t)}),kc=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ds),D.init(e,t)}),Sc=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ms),D.init(e,t)}),Pc=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hs),D.init(e,t)}),zc=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ds(t)),D.init(e,t)}),Oc=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Cs),D.init(e,t)}),Ec=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ts(t)),D.init(e,t)}),Ic=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ys),D.init(e,t)}),Ac=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=$s),D.init(e,t)}),$y=/^[0-9a-fA-F:.]+$/;function Dn(e){return $y.test(e)?yc(`http://[${e}]`):!1}s(Dn,"isValidIPv6");var Nc=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=xs),D.init(e,t),e._zod.check=n=>{Dn(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Cc=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=ks(t.delimiter)),D.init(e,t)}),Tc=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ss),D.init(e,t)});function Qr(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);return`${o}`!==r||o<0||o>128?!1:Dn(n)}s(Qr,"isValidCIDRv6");var Dc=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ps),D.init(e,t),e._zod.check=n=>{Qr(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Zn(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}s(Zn,"isValidBase64");var eo=/^[0-9a-zA-Z+/]*={0,2}$/,Zc=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=eo),D.init(e,t),e._zod.check=n=>{Zn(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Ln=/^[A-Za-z0-9_-]*$/;function to(e){if(!Ln.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Zn(n)}s(to,"isValidBase64URL");var Lc=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ln),D.init(e,t),e._zod.check=n=>{to(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Rc=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=As),D.init(e,t)}),xy=/[- ]/g;function ky(e){let t=e.length,n=1,r=0;for(;t;){let o=e.charCodeAt(--t)-48;n^=1,r+=n?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}s(ky,"isLuhnAlgo");function no(e){return jr.test(e)?ky(e.replace(xy,"")):!1}s(no,"isValidCreditCard");var jc=h("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=jr),D.init(e,t),e._zod.check=n=>{no(n.value)||n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});function Sy(e){let t=0,n=e.length;for(let r=4;r<n;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}s(Sy,"isIso7064Mod97");function ro(e){return Mr.test(e)?Sy(e):!1}s(ro,"isValidIBAN");var Mc=h("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Mr),D.init(e,t),e._zod.check=n=>{ro(n.value)||n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});function oo(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}s(oo,"isValidJWT");var Fc=h("$ZodJWT",(e,t)=>{D.init(e,t),e._zod.check=n=>{oo(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Uc=h("$ZodCustomStringFormat",(e,t)=>{D.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),io=h("$ZodNumber",(e,t)=>{z.init(e,t),e._zod.pattern=Ee,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Vc=h("$ZodNumberFormat",(e,t)=>{Ws.init(e,t),io.init(e,t)}),Rn=h("$ZodBoolean",(e,t)=>{z.init(e,t),e._zod.pattern=js,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),so=h("$ZodBigInt",(e,t)=>{z.init(e,t),e._zod.pattern=Rs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Kc=h("$ZodBigIntFormat",(e,t)=>{Xs.init(e,t),so.init(e,t)}),Hc=h("$ZodSymbol",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),n}}),Bc=h("$ZodUndefined",(e,t)=>{z.init(e,t),e._zod.pattern=Fs,e._zod.values=new Set([void 0]),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),Jc=h("$ZodNull",(e,t)=>{z.init(e,t),e._zod.pattern=Ms,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Wc=h("$ZodAny",(e,t)=>{z.init(e,t),e._zod.parse=n=>n}),Xc=h("$ZodUnknown",(e,t)=>{z.init(e,t),e._zod.parse=n=>n}),qc=h("$ZodNever",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),Gc=h("$ZodVoid",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),Yc=h("$ZodDate",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function Qc(e,t){let n=Pt(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,c)=>{let a=t(i.value);if(a>r&&!c?.skipChecks&&c?.direction!=="backward"){for(let[u,l]of Pt(e._zod.def.checks))if(a>u&&l._zod.def.when(i)){let f=i.issues.length;return l._zod.check(i),i.issues[f].continue=!1,vn(i.issues,f,e),i}}return o(i,c)}}s(Qc,"capSize");var Py=s(e=>Array.isArray(e)?e.length:-1,"arraySize"),zy=s(e=>e instanceof Map?e.size:-1,"mapSize"),Oy=s(e=>e instanceof Set?e.size:-1,"setSize");function gp(e,t,n){e.issues.length&&t.issues.push(...ie(n,e.issues)),t.value[n]=e.value}s(gp,"handleArrayResult");var ea=h("$ZodArray",(e,t)=>{z.init(e,t);let n=B.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);let c=[],a=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)c.push(f.then(p=>gp(p,r,u)));else if(gp(f,r,u),a&&f.issues.length!==0&&Q(f))break}return c.length?Promise.all(c).then(()=>r):r},Qc(e,Py)});function Wr(e,t,n,r,o,i){let c=n in r,a=i==="optional";if(!(!c&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!c)return;t.issues.push(...ie(n,e.issues))}if(!c&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(c||o==="defaulted"&&!a)&&(t.value[n]=void 0):t.value[n]=e.value}}s(Wr,"handlePropertyResult");var Ey=[];function Cp(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Ey,o=r.length?[...t,...r]:t;for(let c of o)if(!e.shape?.[c]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(c)}": expected a Zod schema`);let i=Gi(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}s(Cp,"normalizeDef");function Tp(e,t,n,r,o,i,c){let a=[],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(c&&n.issues.length!==m){if(Q(n,m))break;m=n.issues.length}if(u.has(g))continue;if(g==="__proto__"){f==="never"&&a.push(g);continue}if(f==="never"){a.push(g);continue}let y=l.run({value:t[g],issues:[]},r);y instanceof Promise?e.push(y.then(b=>Wr(b,n,g,t,p,d))):Wr(y,n,g,t,p,d)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>n):n}s(Tp,"handleCatchall");var Dp=h("$ZodObject",(e,t)=>{z.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let l=s(()=>{let f={...r};return Object.defineProperty(t,"shape",{value:f}),l.raw=f,f},"get");l.raw=r,Object.defineProperty(t,"shape",{get:l})}let o=kt(()=>Cp(t));I(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)||J(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=Qe,c=t.catchall,a,u=B.memoizer;u?.attach(e),e._zod.parse=(l,f)=>{a??(a=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=a.shape,g=f?.abortEarly,y=l.issues.length;for(let b of a.allKeys){if(g&&l.issues.length!==y){if(Q(l,y))break;y=l.issues.length}if(b==="__proto__")continue;let k=m[b],$=k._zod.optin,O=k._zod.optout,C=k._zod.run({value:p[b],issues:[]},f);C instanceof Promise?d.push(C.then(j=>Wr(j,l,b,p,$,O))):Wr(C,l,b,p,$,O)}return c?Tp(d,p,l,f,o.value,e,g===!0):d.length?Promise.all(d).then(()=>l):l}}),ta=h("$ZodObjectJIT",(e,t)=>{Dp.init(e,t);let n=e._zod.parse,r=kt(()=>Cp(t)),o=B.memoizer,i=s(m=>{let g=r.value,y=g.symbolKeys,b=new nt(["payload","ctx"],{shape:m,inst:e,memo:o,syms:y}),k=s(j=>`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`,"parseStr"),$=s((j,N)=>`
13
13
  let ${j}_ab = false;
14
14
  for (let i = 0; i < ${j}.issues.length; i++) {
15
15
  const iss = ${j}.issues[i];
@@ -20,26 +20,26 @@ ${n.join(`
20
20
  if (${j}_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),C=0;for(let j of g.allKeys)O[j]=`key_${C++}`;b.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let j of g.allKeys){if(j==="__proto__")continue;let N=O[j],q=typeof j=="symbol"?`syms[${y.indexOf(j)}]`:X(j),un=`${q} in input`,Hf=m[j],Zi=Hf?._zod?.optin,Bf=Zi!==void 0,Ng=Hf?._zod?.optout==="optional";if(b.write(`const ${N} = ${k(q)};`),Bf&&Ng){let Cg=Zi==="optional"?`${N}_present`:`${N}.value !== undefined || ${N}_present`;b.write(`
24
- const ${N}_present = ${un};
23
+ }`,"prefixStr");b.write("const input = payload.value;");let O=Object.create(null),C=0;for(let j of g.allKeys)O[j]=`key_${C++}`;b.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let j of g.allKeys){if(j==="__proto__")continue;let N=O[j],q=typeof j=="symbol"?`syms[${y.indexOf(j)}]`:Y(j),mn=`${q} in input`,Qf=m[j],Vi=Qf?._zod?.optin,ep=Vi!==void 0,Kg=Qf?._zod?.optout==="optional";if(b.write(`const ${N} = ${k(q)};`),ep&&Kg){let Hg=Vi==="optional"?`${N}_present`:`${N}.value !== undefined || ${N}_present`;b.write(`
24
+ const ${N}_present = ${mn};
25
25
  if (!${N}.issues.length || ${N}_present) {
26
26
  if (${N}.issues.length) {${$(N,q)}
27
27
  }
28
28
 
29
- if (${Cg}) {
29
+ if (${Hg}) {
30
30
  newResult[${q}] = ${N}.value;
31
31
  }
32
32
  }
33
33
 
34
- `)}else Bf?(b.write(`
34
+ `)}else ep?(b.write(`
35
35
  if (${N}.issues.length) {${$(N,q)}
36
36
  }
37
- `),Zi==="defaulted"?b.write(`newResult[${q}] = ${N}.value;`):b.write(`
38
- if (${N}.value !== undefined || ${un}) {
37
+ `),Vi==="defaulted"?b.write(`newResult[${q}] = ${N}.value;`):b.write(`
38
+ if (${N}.value !== undefined || ${mn}) {
39
39
  newResult[${q}] = ${N}.value;
40
40
  }
41
41
  `)):b.write(`
42
- const ${N}_present = ${un};
42
+ const ${N}_present = ${mn};
43
43
  if (${N}.issues.length) {${$(N,q)}
44
44
  }
45
45
  if (!${N}_present && !${N}.issues.length) {
@@ -59,19 +59,19 @@ ${n.join(`
59
59
  newResult[${q}] = ${N}.value;
60
60
  }
61
61
 
62
- `)}return b.write("payload.value = newResult;"),b.write("return payload;"),b.compile()},"generateFastpass"),c,a=Ge,u=!B.jitless,f=u&&Fi.value,p=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=r.value);let y=m.value;return a(y)?u&&f&&g?.async===!1&&g.jitless!==!0?(c||(c=i(t.shape)),m=c(m,g),p?Pp([],y,m,g,d,e,g?.abortEarly===!0):m):n(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function up(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!Y(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(c=>ie(c,r,F())))}),t)}s(up,"handleUnionResults");var Tn=h("$ZodUnion",(e,t)=>{z.init(e,t),E(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),E(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),E(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),E(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){let o=r.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Pe(i.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,c=[];for(let a of t.options){let u=a._zod.run({value:r.value,issues:[]},o);if(u instanceof Promise)c.push(u),i=!0;else{if(u.issues.length===0)return u;c.push(u)}}return i?Promise.all(c).then(a=>up(a,r,e,o)):up(c,r,e,o)}});function lp(e,t,n,r){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:n,errors:e.map(i=>i.issues.map(c=>ie(c,r,F())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1,matches:o}),t)}s(lp,"handleExclusiveUnionResults");var Wc=h("$ZodXor",(e,t)=>{Tn.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,c=[];for(let a of t.options){let u=a._zod.run({value:r.value,issues:[]},o);u instanceof Promise?(c.push(u),i=!0):c.push(u)}return i?Promise.all(c).then(a=>lp(a,r,e,o)):lp(c,r,e,o)}});function qc(e,t){let n=e._zod,r=n.bag.optionsMap;r||(r=Op(n.def),n.bag.optionsMap=r);let o=r.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}s(qc,"getDiscriminatedOption");function Op(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let o of r)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}s(Op,"discriminatorMap");var Gc=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Tn.init(e,t);let n=e._zod.parse;E(e,"propValues",o=>{let i={},c=0;for(let a of o.def.options){let u=a._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);u[o.def.discriminator]?.has(void 0)&&c++;for(let[l,f]of Object.entries(u)){Object.prototype.hasOwnProperty.call(i,l)||J(i,l,new Set);for(let p of f)i[l].add(p)}}return!o.def.unionFallback&&c>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let c=$t(o._zod.def);if(c&&!Object.prototype.hasOwnProperty.call(c,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let r=vt(()=>Op(t));e._zod.parse=(o,i)=>{let c=o.value;if(!Ge(c))return o.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),o;let a=c?.[t.discriminator],u=r.value.get(a);return u&&(a!==void 0||i.direction!=="backward")?u._zod.run(o,i):t.unionFallback||i.direction==="backward"?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(l=>r.value.get(l)!==null),input:c,path:[t.discriminator],inst:e}),o)}}),Xc=h("$ZodIntersection",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),c=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||c instanceof Promise?Promise.all([i,c]).then(([u,l])=>fp(n,u,l)):fp(n,i,c)}});function Et(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(pe(e)&&pe(t)){let n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let c=Et(e[i],t[i]);if(!c.valid)return{valid:!1,mergeErrorPath:[i,...c.mergeErrorPath]};o[i]=c.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t[r],c=Et(o,i);if(!c.valid)return{valid:!1,mergeErrorPath:[r,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}s(Et,"mergeValues");function fp(e,t,n){let r=new Map,o,i=new Map,c=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)r.has(d)||r.set(d,{}),r.get(d)[f]=!0;return!0},"collect");for(let l of t.issues)c(l,"l")||e.issues.push(l);for(let l of n.issues)c(l,"r")||e.issues.push(l);let a=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter(f=>o.keys.includes(f)):[];l.length&&e.issues.push({...o,keys:l});for(let f of a)!l.includes(f)&&i.has(f)&&e.issues.push(i.get(f))}let u=Et(t.value,n.value);if(!u.valid){if(Y(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}s(fp,"handleIntersectionResults");var eo=h("$ZodTuple",(e,t)=>{z.init(e,t);let n=t.items,r=B.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let c=o.value;if(!Array.isArray(c))return o.issues.push({input:c,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],u=pp(n,"optin"),l=pp(n,"optout");if(!t.rest){if(c.length<u)return o.issues.push({code:"too_small",minimum:u,inclusive:!0,input:c,inst:e,origin:"array"}),o;c.length>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:c,inst:e,origin:"array"})}let f=new Array(n.length),p=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<n.length;m++){let g=n[m]._zod.run({value:c[m],issues:[]},i);g instanceof Promise?a.push(g.then(y=>{f[m]=y})):(f[m]=g,p&&!d&&g.issues.length&&(d=Y(g)))}if(t.rest&&!d){let m=n.length-1,g=c.slice(n.length),y=o.issues.length;for(let b of g){if(p&&o.issues.length!==y){if(Y(o,y))break;y=o.issues.length}m++;let k=t.rest._zod.run({value:b,issues:[]},i);k instanceof Promise?a.push(k.then($=>dp($,o,m))):dp(k,o,m)}}return a.length?Promise.all(a).then(()=>mp(f,o,n,c,l)):mp(f,o,n,c,l)}});function pp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}s(pp,"getTupleOptStart");function dp(e,t,n){e.issues.length&&t.issues.push(...oe(n,e.issues)),t.value[n]=e.value}s(dp,"handleTupleResult");function mp(e,t,n,r,o){for(let i=0;i<n.length;i++){let c=e[i],a=i<r.length;if(!a&&i>=o&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(c.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...oe(i,c.issues))}t.value[i]=c.value}for(let i=t.value.length-1;i>=r.length&&(n[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}s(mp,"handleTupleResults");var Yc=h("$ZodRecord",(e,t)=>{z.init(e,t);let n=B.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!pe(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let c=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};let u=new Set;for(let f of a)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){r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(g=>ie(g,o,F())),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?c.push(m.then(g=>{g.issues.length&&r.issues.push(...oe(f,g.issues)),r.value[d]=g.value})):(m.issues.length&&r.issues.push(...oe(f,m.issues)),r.value[d]=m.value)}let l;for(let f in i)if(!u.has(f))if(t.mode==="loose"){if(f==="__proto__")continue;r.value[f]=i[f]}else l=l??[],l.push(f);l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},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"&&ze.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"?r.value[l]=i[l]:a?(u=u??[],u.push(l)):r.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>ie(g,o,F())),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?c.push(m.then(g=>{g.issues.length&&r.issues.push(...oe(l,g.issues)),r.value[d]=g.value})):(m.issues.length&&r.issues.push(...oe(l,m.issues)),r.value[d]=m.value)}u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}return c.length?Promise.all(c).then(()=>r):r}}),Qc=h("$ZodMap",(e,t)=>{z.init(e,t);let n=B.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let c=[];r.value=n?n.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,u=r.issues.length;for(let[l,f]of i){if(a&&r.issues.length!==u){if(Y(r,u))break;u=r.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?c.push(Promise.all([p,d]).then(([m,g])=>{hp(m,g,r,l,i,e,o)})):hp(p,d,r,l,i,e,o)}return c.length?Promise.all(c).then(()=>r):r},Hc(e,hy)});function hp(e,t,n,r,o,i,c){e.issues.length&&(dn.has(typeof r)?n.issues.push(...oe(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(a=>ie(a,c,F()))})),t.issues.length&&(dn.has(typeof r)?n.issues.push(...oe(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:t.issues.map(a=>ie(a,c,F()))})),n.value.set(e.value,t.value)}s(hp,"handleMapResult");var ea=h("$ZodSet",(e,t)=>{z.init(e,t);let n=B.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let c=[];r.value=n?n.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,u=r.issues.length;for(let l of i){if(a&&r.issues.length!==u){if(Y(r,u))break;u=r.issues.length}let f=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise?c.push(f.then(p=>gp(p,r))):gp(f,r)}return c.length?Promise.all(c).then(()=>r):r},Hc(e,gy)});function gp(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}s(gp,"handleSetResult");var ta=h("$ZodEnum",(e,t)=>{z.init(e,t);let n=wt(t.entries),r=new Set(n);e._zod.values=r,E(e,"pattern",o=>{let i=wt(o.def.entries).filter(c=>dn.has(typeof c));return new RegExp(i.length?`^(${i.map(c=>de(c.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let c=o.value;return r.has(c)||o.issues.push({code:"invalid_value",values:n,input:c,inst:e}),o}}),na=h("$ZodLiteral",(e,t)=>{z.init(e,t);let n=new Set(t.values);e._zod.values=n,E(e,"pattern",r=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?de(i):i?de(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),ra=h("$ZodFile",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return o instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),n}}),oa=h("$ZodTransform",(e,t)=>{z.init(e,t),e._zod.optin="optional",B.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new De(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(c=>(n.value=c,n));if(o instanceof Promise)throw new se;return n.value=o,n}});function _p(e,t){return e.value=t.issues.length?void 0:t.value,e}s(_p,"handleOptionalResult");var to=h("$ZodOptional",(e,t)=>{z.init(e,t),E(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",E(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),E(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Pe(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>_p(n,i)):_p(n,o)}return t.innerType._zod.run(n,r)}}),ia=h("$ZodExactOptional",(e,t)=>{to.init(e,t),E(e,"values",n=>n.def.innerType._zod.values),E(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),sa=h("$ZodNullable",(e,t)=>{z.init(e,t),E(e,"optin",n=>n.def.innerType._zod.optin),E(e,"optout",n=>n.def.innerType._zod.optout),E(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Pe(r.source)}|null)$`):void 0}),E(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),ca=h("$ZodDefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",E(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>yp(i,t)):yp(o,t)}});function yp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}s(yp,"handleDefaultResult");var aa=h("$ZodPrefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",E(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),ua=h("$ZodNonOptional",(e,t)=>{z.init(e,t),E(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>wp(i,e)):wp(o,e)}});function wp(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}s(wp,"handleNonOptionalResult");var la=h("$ZodSuccess",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new De("ZodSuccess");let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.issues.length===0,n)):(n.value=o.issues.length===0,n)}});function bp(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>ie(o,r,F()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}s(bp,"handleCatchResult");var fa=h("$ZodCatch",(e,t)=>{z.init(e,t),E(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),E(e,"optout",n=>n.def.innerType._zod.optout),E(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>bp(n,i,t,r)):bp(n,o,t,r)}}),pa=h("$ZodNaN",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),no=h("$ZodPipe",(e,t)=>{z.init(e,t),E(e,"values",n=>n.def.in._zod.values),E(e,"optin",n=>n.def.in._zod.optin),E(e,"optout",n=>n.def.out._zod.optout),E(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(c=>Lr(c,t.in,r)):Lr(i,t.in,r)}let o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Lr(i,t.out,r)):Lr(o,t.out,r)}});function Lr(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}s(Lr,"handlePipeResult");var Zn=h("$ZodCodec",(e,t)=>{z.init(e,t),E(e,"values",n=>n.def.in._zod.values),E(e,"optin",n=>n.def.in._zod.optin),E(e,"optout",n=>n.def.out._zod.optout),E(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){let i=t.in._zod.run(n,r);return i instanceof Promise?i.then(c=>jr(c,t,r)):jr(i,t,r)}else{let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(c=>jr(c,t,r)):jr(i,t,r)}}});function jr(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Mr(e,i,t.out,n)):Mr(e,o,t.out,n)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Mr(e,i,t.in,n)):Mr(e,o,t.in,n)}}s(jr,"handleCodecAResult");function Mr(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}s(Mr,"handleCodecTxResult");var da=h("$ZodPreprocess",(e,t)=>{no.init(e,t)}),ma=h("$ZodReadonly",(e,t)=>{z.init(e,t),E(e,"propValues",n=>n.def.innerType._zod.propValues),E(e,"values",n=>n.def.innerType._zod.values),E(e,"optin",n=>n.def.innerType?._zod?.optin),E(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(vp):vp(o)}});function vp(e){return e.memo||(e.value=Object.freeze(e.value)),e}s(vp,"handleReadonlyResult");function yy(e){let t=e._zod.def,n=t.pattern,r=!!t.format?.includes("int"),o,i;for(let a of t.checks??[]){let u=a._zod.def;u.pattern&&(n=u.pattern),r||(r=!!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(n)return n.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Is({minimum:o,maximum:i}).source;let c=e._zod.pattern;return(r&&c===ze?Sn:c)?.source}s(yy,"leafPattern");function ic(e){let t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=ic(r);return n&&o&&i&&i!==o?n.replace(Pe(o),()=>Pe(i)):n}if(t.options){let o=t.options.map(ic);if(o.every(Boolean))return`^(${o.map(i=>Pe(i)).join("|")})$`}return yy(e)}s(ic,"partPattern");var ha=h("$ZodTemplateLiteral",(e,t)=>{z.init(e,t);let n=[];for(let r of t.parts)if(typeof r=="object"&&r!==null){let o=ic(r);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);n.push(Pe(o))}else if(r===null||Vi.has(typeof r))n.push(de(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(r,o)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),ga=h("$ZodFunction",(e,t)=>(z.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?$r(e._def.input,r):r,i=Reflect.apply(n,this,o);return e._def.output?$r(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await xr(e._def.input,r):r,i=await Reflect.apply(n,this,o);return e._def.output?await xr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let r=e.constructor;return Array.isArray(n[0])?new r({type:"function",input:new eo({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new r({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let r=e.constructor;return new r({type:"function",input:e._def.input,output:n})},e)),_a=h("$ZodPromise",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then(o=>t.innerType._zod.run({value:o,issues:[]},r))}),Dn=h("$ZodLazy",(e,t)=>{z.init(e,t),ji(e._zod,"innerType",()=>{let n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),E(e,"pattern",n=>n.innerType?._zod?.pattern),E(e,"propValues",n=>n.innerType?._zod?.propValues),E(e,"optin",n=>n.innerType?._zod?.optin??void 0),E(e,"optout",n=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),ya=h("$ZodCustom",(e,t)=>{L.init(e,t),z.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>$p(i,n,r,e));$p(o,n,r,e)}});function $p(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(kt(o))}}s($p,"handleRefineResult");var so=class extends Error{static{s(this,"$ZodCyclicError")}constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},ba="~memo",Ep=[];function Ap(e){return e!==null&&typeof e=="object"}s(Ap,"isRef");function wa(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}s(wa,"cloneIssues");var Np=new WeakMap,At=0,io=1,Rn=2;function Ln(e,t,n){let r=Np.get(e);if(r!==void 0)return r?Rn:At;if(t.has(e))return Rn;t.add(e);let o=At,i=s(f=>{if(o!==Rn&&f?._zod){let p=Ln(f,t,n);p>o&&(o=p)}},"check"),c=s((f,p)=>{let d=At;for(let m of Reflect.ownKeys(f)){let g=Object.getOwnPropertyDescriptor(f,m);if(p&&!g.enumerable)continue;let y=g.get?io:g.value?._zod?Ln(g.value,t,n):At;y>d&&(d=y)}return d},"shape"),a=s(f=>{f>o&&(o=f)},"merge"),u=e._zod.def,l=u.type;switch(l){case"object":{let f=$t(u);a(f?c(f,!0):io),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??(n?e._zod.innerType:void 0);a(f?Ln(f,t,!1):io);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),wy(e,o)}s(Ln,"isRecursive");function wy(e,t){return t!==io&&Np.set(e,t===Rn),t}s(wy,"settle");function co(e){return Ln(e,new Set,!0)!==At}s(co,"isRecursiveSchema");function by(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}s(by,"bucketFor");var ro,oo=[],vy={alloc(e,t,n){let r=ro;if(!r)return n;ro=void 0;let o={value:n,issues:null};return r.set(t.value,o),oo.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=s((o,i)=>{if(i.direction!=="backward"&&ao(i,o.value))throw new so;return n(o,i)},"wrapped");e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let c=e._zod.parse,a=s((u,l)=>{if(n===void 0){let k=Ln(e,new Set,!1);if(k===At)return e._zod.parse=c,e._zod.run===a&&(e._zod.run=c),c(u,l);k===Rn||r?n=!0:r=!0}let f=u.value;if(!Ap(f))return c(u,l);let p=l[ba];p||(p={buckets:new WeakMap,backEdges:void 0},l[ba]=p);let d;o===l?d=i:(d=by(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(...wa(m.issues)):(u.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(m.value)),u;ro=d;let g=oo.length,y=c(u,l);ro=void 0;let b=oo.length>g?oo.pop():void 0;return y instanceof Promise?y.then(k=>(b&&(b.issues=k.issues.length?wa(k.issues):Ep),k)):(b&&(b.issues=y.issues.length?wa(y.issues):Ep),y)},"wrapped");e._zod.parse=a,e._zod.run===c&&(e._zod.run=a)})}};function jn(){return vy}s(jn,"memoizer");function ao(e,t){let n=e[ba]?.backEdges;return n!==void 0&&Ap(t)&&n.has(t)}s(ao,"isBackEdge");var Fn={};ke(Fn,{en:()=>Mn});var $y=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 n={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"},r={nan:"NaN"};function o(i,c){return i==="number"&&typeof c=="number"&&!Number.isFinite(c)?String(c):r[i]??i}return s(o,"getTypeName"),i=>{switch(i.code){case"invalid_type":{let c=o(i.expected),a=Hi(i.input),u=o(a,i.input);return`Invalid input: expected ${c}, received ${u}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${yr(i.values[0])}`:`Invalid option: expected one of ${hr(i.values,"|")}`;case"too_big":{let c=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${c}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${c}${i.maximum.toString()}`}case"too_small":{let c=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${c}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${c}${i.minimum.toString()}`}case"invalid_format":{let c=i;return c.format==="starts_with"?`Invalid string: must start with "${c.prefix}"`:c.format==="ends_with"?`Invalid string: must end with "${c.suffix}"`:c.format==="includes"?`Invalid string: must include "${c.includes}"`:c.format==="regex"?`Invalid string: must match pattern ${c.pattern}`:`Invalid ${n[c.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":""}: ${hr(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(a=>`'${a}'`).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");function Mn(){return{localeError:$y()}}s(Mn,"default");var Cp,va=Symbol("ZodOutput"),$a=Symbol("ZodInput"),uo=class{static{s(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let r={...this.get(n)??{}};delete r.id;let o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function lo(){return new uo}s(lo,"registry");(Cp=globalThis).__zod_globalRegistry??(Cp.__zod_globalRegistry=lo());var W=globalThis.__zod_globalRegistry;var Q=Symbol.for("zod.compile.invalid"),Tp=Symbol.for("zod.compile.fallback"),ge=class extends Error{static{s(this,"ZodCompileAsyncError")}constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},A=class extends Error{static{s(this,"ZodCompileUnsupportedError")}constructor(t,n=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=n}};function ky(e,t){try{return po(e,{assertOnly:!0})}catch{return t}}s(ky,"compileValidator");function Pa(e,t){try{let n=po(e),r=fo(e,n);return r._zod.bag.validator=ky(e,n),r}catch(n){if(t?.strict)throw n;return e}}s(Pa,"compile");function fo(e,t){if(co(e))throw new A("a schema whose subtree contains a reference cycle");let n=T(e),r=e._zod.run,o=r.__originalRun??r,i=s((c,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[Tp]||a&&ao(a,c.value))return o(c,a);let u=t(c.value);return u!==Q?(c.value=u,c):(a&&(a[Tp]=!0),o(c,a))},"wrapped");return i.__originalRun=o,n._zod.bag.fallbackRun=o,n._zod.bag.validator=t,n._zod.run=i,r.__originalRun||Sy(n,e,t),n}s(fo,"withParser");function Sy(e,t,n){let r=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;r.safeParse=(c,a)=>{let u=n(c);return u!==Q?{success:!0,data:u}:i(c,a)}}if(typeof o.parse=="function"){let i=o.parse;r.parse=(c,a)=>{let u=n(c);return u!==Q?u:i(c,a)}}}s(Sy,"installCompiledUserMethods");function po(e,t){let n=!0;try{n=co(e)}catch{}if(n)throw new A("a schema whose subtree contains a reference cycle");let r={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new Qe(["input"]),i=M(o,r,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let c=["INVALID",...r.constants.keys()],a=[Q,...r.constants.values()],u=o.content.join(`
62
+ `)}return b.write("payload.value = newResult;"),b.write("return payload;"),b.compile()},"generateFastpass"),c,a=Qe,u=!B.jitless,f=u&&Xi.value,p=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=r.value);let y=m.value;return a(y)?u&&f&&g?.async===!1&&g.jitless!==!0?(c||(c=i(t.shape)),m=c(m,g),p?Tp([],y,m,g,d,e,g?.abortEarly===!0):m):n(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function _p(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!Q(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(c=>se(c,r,U())))}),t)}s(_p,"handleUnionResults");var jn=h("$ZodUnion",(e,t)=>{z.init(e,t),I(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),I(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),I(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),I(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){let o=r.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Oe(i.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,c=[];for(let a of t.options){let u=a._zod.run({value:r.value,issues:[]},o);if(u instanceof Promise)c.push(u),i=!0;else{if(u.issues.length===0)return u;c.push(u)}}return i?Promise.all(c).then(a=>_p(a,r,e,o)):_p(c,r,e,o)}});function yp(e,t,n,r){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:n,errors:e.map(i=>i.issues.map(c=>se(c,r,U())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1,matches:o}),t)}s(yp,"handleExclusiveUnionResults");var na=h("$ZodXor",(e,t)=>{jn.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,c=[];for(let a of t.options){let u=a._zod.run({value:r.value,issues:[]},o);u instanceof Promise?(c.push(u),i=!0):c.push(u)}return i?Promise.all(c).then(a=>yp(a,r,e,o)):yp(c,r,e,o)}});function ra(e,t){let n=e._zod,r=n.bag.optionsMap;r||(r=Zp(n.def),n.bag.optionsMap=r);let o=r.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}s(ra,"getDiscriminatedOption");function Zp(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let o of r)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}s(Zp,"discriminatorMap");var oa=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,jn.init(e,t);let n=e._zod.parse;I(e,"propValues",o=>{let i={},c=0;for(let a of o.def.options){let u=a._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);u[o.def.discriminator]?.has(void 0)&&c++;for(let[l,f]of Object.entries(u)){Object.prototype.hasOwnProperty.call(i,l)||J(i,l,new Set);for(let p of f)i[l].add(p)}}return!o.def.unionFallback&&c>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let c=St(o._zod.def);if(c&&!Object.prototype.hasOwnProperty.call(c,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let r=kt(()=>Zp(t));e._zod.parse=(o,i)=>{let c=o.value;if(!Qe(c))return o.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),o;let a=c?.[t.discriminator],u=r.value.get(a);return u&&(a!==void 0||i.direction!=="backward")?u._zod.run(o,i):t.unionFallback||i.direction==="backward"?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(l=>r.value.get(l)!==null),input:c,path:[t.discriminator],inst:e}),o)}}),ia=h("$ZodIntersection",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),c=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||c instanceof Promise?Promise.all([i,c]).then(([u,l])=>wp(n,u,l)):wp(n,i,c)}});function Ct(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(de(e)&&de(t)){let n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let c=Ct(e[i],t[i]);if(!c.valid)return{valid:!1,mergeErrorPath:[i,...c.mergeErrorPath]};o[i]=c.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t[r],c=Ct(o,i);if(!c.valid)return{valid:!1,mergeErrorPath:[r,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}s(Ct,"mergeValues");function wp(e,t,n){let r=new Map,o,i=new Map,c=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)r.has(d)||r.set(d,{}),r.get(d)[f]=!0;return!0},"collect");for(let l of t.issues)c(l,"l")||e.issues.push(l);for(let l of n.issues)c(l,"r")||e.issues.push(l);let a=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter(f=>o.keys.includes(f)):[];l.length&&e.issues.push({...o,keys:l});for(let f of a)!l.includes(f)&&i.has(f)&&e.issues.push(i.get(f))}let u=Ct(t.value,n.value);if(!u.valid){if(Q(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}s(wp,"handleIntersectionResults");var co=h("$ZodTuple",(e,t)=>{z.init(e,t);let n=t.items,r=B.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let c=o.value;if(!Array.isArray(c))return o.issues.push({input:c,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],u=bp(n,"optin"),l=bp(n,"optout");if(!t.rest){if(c.length<u)return o.issues.push({code:"too_small",minimum:u,inclusive:!0,input:c,inst:e,origin:"array"}),o;c.length>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:c,inst:e,origin:"array"})}let f=new Array(n.length),p=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<n.length;m++){let g=n[m]._zod.run({value:c[m],issues:[]},i);g instanceof Promise?a.push(g.then(y=>{f[m]=y})):(f[m]=g,p&&!d&&g.issues.length&&(d=Q(g)))}if(t.rest&&!d){let m=n.length-1,g=c.slice(n.length),y=o.issues.length;for(let b of g){if(p&&o.issues.length!==y){if(Q(o,y))break;y=o.issues.length}m++;let k=t.rest._zod.run({value:b,issues:[]},i);k instanceof Promise?a.push(k.then($=>vp($,o,m))):vp(k,o,m)}}return a.length?Promise.all(a).then(()=>$p(f,o,n,c,l)):$p(f,o,n,c,l)}});function bp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}s(bp,"getTupleOptStart");function vp(e,t,n){e.issues.length&&t.issues.push(...ie(n,e.issues)),t.value[n]=e.value}s(vp,"handleTupleResult");function $p(e,t,n,r,o){for(let i=0;i<n.length;i++){let c=e[i],a=i<r.length;if(!a&&i>=o&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(c.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...ie(i,c.issues))}t.value[i]=c.value}for(let i=t.value.length-1;i>=r.length&&(n[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}s($p,"handleTupleResults");var sa=h("$ZodRecord",(e,t)=>{z.init(e,t);let n=B.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!de(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let c=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};let u=new Set;for(let f of a)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){r.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(g=>se(g,o,U())),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?c.push(m.then(g=>{g.issues.length&&r.issues.push(...ie(f,g.issues)),r.value[d]=g.value})):(m.issues.length&&r.issues.push(...ie(f,m.issues)),r.value[d]=m.value)}let l;for(let f in i)if(!u.has(f))if(t.mode==="loose"){if(f==="__proto__")continue;r.value[f]=i[f]}else l=l??[],l.push(f);l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},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"&&Ee.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"?r.value[l]=i[l]:a?(u=u??[],u.push(l)):r.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>se(g,o,U())),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?c.push(m.then(g=>{g.issues.length&&r.issues.push(...ie(l,g.issues)),r.value[d]=g.value})):(m.issues.length&&r.issues.push(...ie(l,m.issues)),r.value[d]=m.value)}u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}return c.length?Promise.all(c).then(()=>r):r}}),ca=h("$ZodMap",(e,t)=>{z.init(e,t);let n=B.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let c=[];r.value=n?n.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,u=r.issues.length;for(let[l,f]of i){if(a&&r.issues.length!==u){if(Q(r,u))break;u=r.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?c.push(Promise.all([p,d]).then(([m,g])=>{xp(m,g,r,l,i,e,o)})):xp(p,d,r,l,i,e,o)}return c.length?Promise.all(c).then(()=>r):r},Qc(e,zy)});function xp(e,t,n,r,o,i,c){e.issues.length&&(yn.has(typeof r)?n.issues.push(...ie(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(a=>se(a,c,U()))})),t.issues.length&&(yn.has(typeof r)?n.issues.push(...ie(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:t.issues.map(a=>se(a,c,U()))})),n.value.set(e.value,t.value)}s(xp,"handleMapResult");var aa=h("$ZodSet",(e,t)=>{z.init(e,t);let n=B.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let c=[];r.value=n?n.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,u=r.issues.length;for(let l of i){if(a&&r.issues.length!==u){if(Q(r,u))break;u=r.issues.length}let f=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise?c.push(f.then(p=>kp(p,r))):kp(f,r)}return c.length?Promise.all(c).then(()=>r):r},Qc(e,Oy)});function kp(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}s(kp,"handleSetResult");var ua=h("$ZodEnum",(e,t)=>{z.init(e,t);let n=$t(t.entries),r=new Set(n);e._zod.values=r,I(e,"pattern",o=>{let i=$t(o.def.entries).filter(c=>yn.has(typeof c));return new RegExp(i.length?`^(${i.map(c=>me(c.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let c=o.value;return r.has(c)||o.issues.push({code:"invalid_value",values:n,input:c,inst:e}),o}}),la=h("$ZodLiteral",(e,t)=>{z.init(e,t);let n=new Set(t.values);e._zod.values=n,I(e,"pattern",r=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?me(i):i?me(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),fa=h("$ZodFile",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return o instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),n}}),pa=h("$ZodTransform",(e,t)=>{z.init(e,t),e._zod.optin="optional",B.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Le(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(c=>(n.value=c,n));if(o instanceof Promise)throw new ce;return n.value=o,n}});function Sp(e,t){return e.value=t.issues.length?void 0:t.value,e}s(Sp,"handleOptionalResult");var ao=h("$ZodOptional",(e,t)=>{z.init(e,t),I(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",I(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),I(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Oe(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>Sp(n,i)):Sp(n,o)}return t.innerType._zod.run(n,r)}}),da=h("$ZodExactOptional",(e,t)=>{ao.init(e,t),I(e,"values",n=>n.def.innerType._zod.values),I(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),ma=h("$ZodNullable",(e,t)=>{z.init(e,t),I(e,"optin",n=>n.def.innerType._zod.optin),I(e,"optout",n=>n.def.innerType._zod.optout),I(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Oe(r.source)}|null)$`):void 0}),I(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),ha=h("$ZodDefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",I(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Pp(i,t)):Pp(o,t)}});function Pp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}s(Pp,"handleDefaultResult");var ga=h("$ZodPrefault",(e,t)=>{z.init(e,t),e._zod.optin="defaulted",I(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),_a=h("$ZodNonOptional",(e,t)=>{z.init(e,t),I(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>zp(i,e)):zp(o,e)}});function zp(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}s(zp,"handleNonOptionalResult");var ya=h("$ZodSuccess",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Le("ZodSuccess");let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.issues.length===0,n)):(n.value=o.issues.length===0,n)}});function Op(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>se(o,r,U()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}s(Op,"handleCatchResult");var wa=h("$ZodCatch",(e,t)=>{z.init(e,t),I(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),I(e,"optout",n=>n.def.innerType._zod.optout),I(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>Op(n,i,t,r)):Op(n,o,t,r)}}),ba=h("$ZodNaN",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),uo=h("$ZodPipe",(e,t)=>{z.init(e,t),I(e,"values",n=>n.def.in._zod.values),I(e,"optin",n=>n.def.in._zod.optin),I(e,"optout",n=>n.def.out._zod.optout),I(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(c=>Hr(c,t.in,r)):Hr(i,t.in,r)}let o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Hr(i,t.out,r)):Hr(o,t.out,r)}});function Hr(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}s(Hr,"handlePipeResult");var Mn=h("$ZodCodec",(e,t)=>{z.init(e,t),I(e,"values",n=>n.def.in._zod.values),I(e,"optin",n=>n.def.in._zod.optin),I(e,"optout",n=>n.def.out._zod.optout),I(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){let i=t.in._zod.run(n,r);return i instanceof Promise?i.then(c=>Br(c,t,r)):Br(i,t,r)}else{let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(c=>Br(c,t,r)):Br(i,t,r)}}});function Br(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Jr(e,i,t.out,n)):Jr(e,o,t.out,n)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Jr(e,i,t.in,n)):Jr(e,o,t.in,n)}}s(Br,"handleCodecAResult");function Jr(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}s(Jr,"handleCodecTxResult");var va=h("$ZodPreprocess",(e,t)=>{uo.init(e,t)}),$a=h("$ZodReadonly",(e,t)=>{z.init(e,t),I(e,"propValues",n=>n.def.innerType._zod.propValues),I(e,"values",n=>n.def.innerType._zod.values),I(e,"optin",n=>n.def.innerType?._zod?.optin),I(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Ep):Ep(o)}});function Ep(e){return e.memo||(e.value=Object.freeze(e.value)),e}s(Ep,"handleReadonlyResult");function Iy(e){let t=e._zod.def,n=t.pattern,r=!!t.format?.includes("int"),o,i;for(let a of t.checks??[]){let u=a._zod.def;u.pattern&&(n=u.pattern),r||(r=!!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(n)return n.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Ls({minimum:o,maximum:i}).source;let c=e._zod.pattern;return(r&&c===Ee?In:c)?.source}s(Iy,"leafPattern");function dc(e){let t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=dc(r);return n&&o&&i&&i!==o?n.replace(Oe(o),()=>Oe(i)):n}if(t.options){let o=t.options.map(dc);if(o.every(Boolean))return`^(${o.map(i=>Oe(i)).join("|")})$`}return Iy(e)}s(dc,"partPattern");var xa=h("$ZodTemplateLiteral",(e,t)=>{z.init(e,t);let n=[];for(let r of t.parts)if(typeof r=="object"&&r!==null){let o=dc(r);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);n.push(Oe(o))}else if(r===null||qi.has(typeof r))n.push(me(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(r,o)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),ka=h("$ZodFunction",(e,t)=>(z.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?Er(e._def.input,r):r,i=Reflect.apply(n,this,o);return e._def.output?Er(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await Ir(e._def.input,r):r,i=await Reflect.apply(n,this,o);return e._def.output?await Ir(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let r=e.constructor;return Array.isArray(n[0])?new r({type:"function",input:new co({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new r({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let r=e.constructor;return new r({type:"function",input:e._def.input,output:n})},e)),Sa=h("$ZodPromise",(e,t)=>{z.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then(o=>t.innerType._zod.run({value:o,issues:[]},r))}),Fn=h("$ZodLazy",(e,t)=>{z.init(e,t),Ji(e._zod,"innerType",()=>{let n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),I(e,"pattern",n=>n.innerType?._zod?.pattern),I(e,"propValues",n=>n.innerType?._zod?.propValues),I(e,"optin",n=>n.innerType?._zod?.optin??void 0),I(e,"optout",n=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Pa=h("$ZodCustom",(e,t)=>{R.init(e,t),z.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Ip(i,n,r,e));Ip(o,n,r,e)}});function Ip(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(zt(o))}}s(Ip,"handleRefineResult");var mo=class extends Error{static{s(this,"$ZodCyclicError")}constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Oa="~memo",Rp=[];function jp(e){return e!==null&&typeof e=="object"}s(jp,"isRef");function za(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}s(za,"cloneIssues");var Mp=new WeakMap,Tt=0,po=1,Un=2;function Vn(e,t,n){let r=Mp.get(e);if(r!==void 0)return r?Un:Tt;if(t.has(e))return Un;t.add(e);let o=Tt,i=s(f=>{if(o!==Un&&f?._zod){let p=Vn(f,t,n);p>o&&(o=p)}},"check"),c=s((f,p)=>{let d=Tt;for(let m of Reflect.ownKeys(f)){let g=Object.getOwnPropertyDescriptor(f,m);if(p&&!g.enumerable)continue;let y=g.get?po:g.value?._zod?Vn(g.value,t,n):Tt;y>d&&(d=y)}return d},"shape"),a=s(f=>{f>o&&(o=f)},"merge"),u=e._zod.def,l=u.type;switch(l){case"object":{let f=St(u);a(f?c(f,!0):po),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??(n?e._zod.innerType:void 0);a(f?Vn(f,t,!1):po);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),Ay(e,o)}s(Vn,"isRecursive");function Ay(e,t){return t!==po&&Mp.set(e,t===Un),t}s(Ay,"settle");function ho(e){return Vn(e,new Set,!0)!==Tt}s(ho,"isRecursiveSchema");function Ny(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}s(Ny,"bucketFor");var lo,fo=[],Cy={alloc(e,t,n){let r=lo;if(!r)return n;lo=void 0;let o={value:n,issues:null};return r.set(t.value,o),fo.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=s((o,i)=>{if(i.direction!=="backward"&&go(i,o.value))throw new mo;return n(o,i)},"wrapped");e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let c=e._zod.parse,a=s((u,l)=>{if(n===void 0){let k=Vn(e,new Set,!1);if(k===Tt)return e._zod.parse=c,e._zod.run===a&&(e._zod.run=c),c(u,l);k===Un||r?n=!0:r=!0}let f=u.value;if(!jp(f))return c(u,l);let p=l[Oa];p||(p={buckets:new WeakMap,backEdges:void 0},l[Oa]=p);let d;o===l?d=i:(d=Ny(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(...za(m.issues)):(u.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(m.value)),u;lo=d;let g=fo.length,y=c(u,l);lo=void 0;let b=fo.length>g?fo.pop():void 0;return y instanceof Promise?y.then(k=>(b&&(b.issues=k.issues.length?za(k.issues):Rp),k)):(b&&(b.issues=y.issues.length?za(y.issues):Rp),y)},"wrapped");e._zod.parse=a,e._zod.run===c&&(e._zod.run=a)})}};function Kn(){return Cy}s(Kn,"memoizer");function go(e,t){let n=e[Oa]?.backEdges;return n!==void 0&&jp(t)&&n.has(t)}s(go,"isBackEdge");var Bn={};Pe(Bn,{en:()=>Hn});var Ty=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 n={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"},r={nan:"NaN"};function o(i,c){return i==="number"&&typeof c=="number"&&!Number.isFinite(c)?String(c):r[i]??i}return s(o,"getTypeName"),i=>{switch(i.code){case"invalid_type":{let c=o(i.expected),a=Qi(i.input),u=o(a,i.input);return`Invalid input: expected ${c}, received ${u}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Sr(i.values[0])}`:`Invalid option: expected one of ${$r(i.values,"|")}`;case"too_big":{let c=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${c}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${c}${i.maximum.toString()}`}case"too_small":{let c=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${c}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${c}${i.minimum.toString()}`}case"invalid_format":{let c=i;return c.format==="starts_with"?`Invalid string: must start with "${c.prefix}"`:c.format==="ends_with"?`Invalid string: must end with "${c.suffix}"`:c.format==="includes"?`Invalid string: must include "${c.includes}"`:c.format==="regex"?`Invalid string: must match pattern ${c.pattern}`:`Invalid ${n[c.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":""}: ${$r(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(a=>`'${a}'`).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");function Hn(){return{localeError:Ty()}}s(Hn,"default");var Fp,Ea=Symbol("ZodOutput"),Ia=Symbol("ZodInput"),_o=class{static{s(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let r={...this.get(n)??{}};delete r.id;let o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function yo(){return new _o}s(yo,"registry");(Fp=globalThis).__zod_globalRegistry??(Fp.__zod_globalRegistry=yo());var W=globalThis.__zod_globalRegistry;var ee=Symbol.for("zod.compile.invalid"),Up=Symbol.for("zod.compile.fallback"),_e=class extends Error{static{s(this,"ZodCompileAsyncError")}constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},A=class extends Error{static{s(this,"ZodCompileUnsupportedError")}constructor(t,n=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=n}};function Zy(e,t){try{return bo(e,{assertOnly:!0})}catch{return t}}s(Zy,"compileValidator");function Ta(e,t){try{let n=bo(e),r=wo(e,n);return r._zod.bag.validator=Zy(e,n),r}catch(n){if(t?.strict)throw n;return e}}s(Ta,"compile");function wo(e,t){if(ho(e))throw new A("a schema whose subtree contains a reference cycle");let n=T(e),r=e._zod.run,o=r.__originalRun??r,i=s((c,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[Up]||a&&go(a,c.value))return o(c,a);let u=t(c.value);return u!==ee?(c.value=u,c):(a&&(a[Up]=!0),o(c,a))},"wrapped");return i.__originalRun=o,n._zod.bag.fallbackRun=o,n._zod.bag.validator=t,n._zod.run=i,r.__originalRun||Ly(n,e,t),n}s(wo,"withParser");function Ly(e,t,n){let r=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;r.safeParse=(c,a)=>{let u=n(c);return u!==ee?{success:!0,data:u}:i(c,a)}}if(typeof o.parse=="function"){let i=o.parse;r.parse=(c,a)=>{let u=n(c);return u!==ee?u:i(c,a)}}}s(Ly,"installCompiledUserMethods");function bo(e,t){let n=!0;try{n=ho(e)}catch{}if(n)throw new A("a schema whose subtree contains a reference cycle");let r={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new nt(["input"]),i=M(o,r,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let c=["INVALID",...r.constants.keys()],a=[ee,...r.constants.values()],u=o.content.join(`
63
63
  `),l=t?.debug?c.length>0?`// Constants: ${c.join(", ")}
64
64
  ${u}`:u:"",f=Function,p=`return (input) => {
65
65
  ${u}
66
- }`,d;try{d=new f(...c,p)(...a)}catch(m){throw new A(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=l),d.definite=r.definite,d}s(po,"compileFn");function P(e,t){for(let[r,o]of e.constants)if(o===t)return r;let n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}s(P,"addConstant");function nt(e,t){return e.definite=!1,P(e,t)}s(nt,"addUserConstant");function S(e){return`v${e.varCounter++}`}s(S,"newVar");function Py(e,t){let n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return Q;let r=n;return r.issues.length===0?r.value:Q}s(Py,"runtimeRun");function G(e,t,n,r,o=!0){let i=e.content.length,c=t.constants.size,a=t.constantCounter,u=t.varCounter;try{return M(e,t,n,r,o)}catch(l){if(!(l instanceof A)||!l.islandable)throw l;if(e.content.length=i,t.constants.size>c){let f=Array.from(t.constants.keys()).slice(c);for(let p of f)t.constants.delete(p)}return t.constantCounter=a,t.varCounter=u,zy(e,t,n,r)}}s(G,"compileChild");function zy(e,t,n,r){t.definite=!1;let o=P(t,n),i=P(t,Py),c=S(t);return e.write(`const ${c} = ${i}(${o}, ${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}s(zy,"emitRuntimeIsland");var Oy=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function Iy(e,t,n,r){let o=n._zod.def.checks;if(!o||o.length===0)return r;let i=r;for(let c of o){let a=c._zod.def;if(a.when&&!Oy.has(a.check))throw new A('check with a custom "when" condition');switch(a.check){case"greater_than":Ey(e,t,a,i);break;case"less_than":Ay(e,t,a,i);break;case"multiple_of":Ny(e,t,a,i);break;case"number_format":Mp(e,a,i);break;case"min_length":{let u=Re(a.minimum,"min_length"),l=xa(e,t,i,`${i}.length >= ${u} && ${i}.length < ${a.minimum*2}`);e.write(`if (${l} < ${u}) return INVALID;`);break}case"max_length":{let u=Re(a.maximum,"max_length"),l=xa(e,t,i,`${i}.length > ${u}`);e.write(`if (${l} > ${u}) return INVALID;`);break}case"length_equals":{let u=Re(a.length,"length_equals"),l=xa(e,t,i,`${i}.length >= ${u} && ${i}.length <= ${a.length*2}`);e.write(`if (${l} !== ${u}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${Re(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${Re(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${Re(a.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Fp(e,t,a,i);break;case"custom":i=Ly(e,t,c,i);break;case"bigint_format":Cy(e,a,i);break;case"mime_type":Ty(e,t,a,i);break;case"property":Dy(e,t,a,i);break;case"properties":Zy(e,t,a,i);break;case"overwrite":{let u=S(t);Ry(e,t,c,i,u),i=u;break}default:throw new A(`check type ${a.check}`)}}return i}s(Iy,"generateChecks");function xa(e,t,n,r){let o=P(t,Xe),i=S(t);return e.write(`const ${i} = typeof ${n} === "string" && ${r} ? ${o}(${n}) : ${n}.length;`),i}s(xa,"codePointLengthVar");function Re(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new A(`${t} bound of type ${typeof e}`);return`${e}`}s(Re,"numericOperand");function jp(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new A("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new A("comparison check with Invalid Date bound");return P(e,t)}throw new A(`comparison check bound of type ${typeof t}`)}s(jp,"comparisonOperand");function Ey(e,t,n,r){let o=n.inclusive?"<":"<=";e.write(`if (${r} ${o} ${jp(t,n.value)}) return INVALID;`)}s(Ey,"generateGreaterThanCheck");function Ay(e,t,n,r){let o=n.inclusive?">":">=";e.write(`if (${r} ${o} ${jp(t,n.value)}) return INVALID;`)}s(Ay,"generateLessThanCheck");function Ny(e,t,n,r){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new A("multiple_of check with a zero divisor");e.write(`if (${r} % ${n.value}n !== 0n) return INVALID;`)}else{let o=P(t,fn);e.write(`if (${o}(${r}, ${Re(n.value,"multiple_of")}) !== 0) return INVALID;`)}}s(Ny,"generateMultipleOfCheck");function Mp(e,t,n){let r=t.format;switch(r){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new A(`number format ${r}`)}}s(Mp,"generateNumberFormatCheck");function Cy(e,t,n){let r=t.format;if(r)switch(r){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new A(`bigint format ${r}`)}}s(Cy,"generateBigIntFormatCheck");function Ty(e,t,n,r){let o=n.mime;if(o&&o.length>0){let i=P(t,new Set(o));e.write(`if (!${i}.has(${r}.type)) return INVALID;`)}}s(Ty,"generateMimeTypeCheck");function Zy(e,t,n,r){if(n.when)throw new A('check with a custom "when" condition');e.write(`if (${r} == null) return INVALID;`);let o=n.shape;for(let i of Reflect.ownKeys(o)){let c=typeof i=="symbol"?P(t,i):X(i),a=S(t);e.write(`const ${a} = ${r}[${c}];`),G(e,t,o[i],a,!1)}}s(Zy,"generatePropertiesChecks");function Dy(e,t,n,r){let o=`${r}[${JSON.stringify(n.property)}]`;M(e,t,n.schema,o)}s(Dy,"generatePropertyCheck");function Ry(e,t,n,r,o){let i=n._zod.def.tx;if(!i)throw new A("overwrite check without a transform function");if(rt(i))throw new ge("z.compile: async overwrite transforms are not supported");let c=P(t,i);e.write(`const ${o} = ${c}(${r});`)}s(Ry,"generateOverwriteCheck");function ka(){throw new se}s(ka,"throwAsync");function za(e){this.issues.push(e)}s(za,"pushIssue");function Ly(e,t,n,r){let o=n._zod.def;if(o.fn){if(rt(o.fn))throw new ge("z.compile: async .refine() predicates are not supported");let i=nt(t,o.fn),c=P(t,ka),a=S(t);return e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${c}();`),e.write(`if (!${a}) return INVALID;`),r}if(n._zod.check){if(rt(n._zod.check))throw new ge("z.compile: async .superRefine() / check functions are not supported");let i=n._zod.check,a=nt(t,s(l=>{let f={value:l,issues:[],addIssue:za};return i(f)instanceof Promise&&ka(),f.issues.length===0?f.value:Q},"helperFn")),u=S(t);return e.write(`const ${u} = ${a}(${r});`),e.write(`if (${u} === INVALID) return INVALID;`),u}throw new A("custom check without a predicate or check function")}s(Ly,"generateCustomRefineCheck");var jy=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"]);function Fp(e,t,n,r,o=!0){let i=n.format;if(i==="base64"){let l=P(t,An);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="base64url"){let l=P(t,Wr);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="jwt"){let l=P(t,Xr),f=P(t,n.alg??null);return e.write(`if (!${l}(${r}, ${f})) return INVALID;`),r}if(i==="ipv6"){let l=P(t,En);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="cidrv6"){let l=P(t,Br);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="credit_card"){let l=P(t,qr);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="iban"){let l=P(t,Gr);return e.write(`if (!${l}(${r})) return INVALID;`),r}let c=n;if(i==="url"||i==="httpurl"||c.normalize||c.hostname!==void 0||c.protocol!==void 0){let l=P(t,Ur),f=P(t,n),p=S(t),d=S(t);if(e.write(`const ${p} = ${r}.trim();`),e.write(`const ${d} = ${l}(${p}, ${f});`),e.write(`if (typeof ${d} === "number") return INVALID;`),c.hostname!==void 0){let y=P(t,Kr);e.write(`if (!${y}(${d}, ${f}.hostname)) return INVALID;`)}if(c.protocol!==void 0){let y=P(t,Hr);e.write(`if (!${y}(${d}, ${f}.protocol)) return INVALID;`)}if(!o)return null;let m=S(t),g=c.normalize?`${d}.href`:`${P(t,In)}(${p})`;return e.write(`const ${m} = ${g};`),m}let a=n.fn;if(a){if(rt(a))throw new A(`async string format ${i}`);let l=P(t,a);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(jy.has(i)&&n.pattern){let l=P(t,n.pattern);return e.write(`${l}.lastIndex = 0;`),e.write(`if (!${l}.test(${r})) return INVALID;`),r}let u=n.format;switch(u){case"regex":throw new A("regex format without a pattern");case"lowercase":e.write(`if (${r} !== ${r}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${r} !== ${r}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${r}.includes(${X(n.includes)})) return INVALID;`);break;case"starts_with":{let l=n.prefix;e.write(`if (${r}.slice(0, ${l.length}) !== ${X(l)}) return INVALID;`);break}case"ends_with":{let l=n.suffix;e.write(`if (${r}.slice(-${l.length}) !== ${X(l)}) return INVALID;`);break}default:throw new A(`string format ${u}`)}return r}s(Fp,"generateStringFormatCheck");function M(e,t,n,r,o=!0){let i=n._zod.def,c=i.type;if(i.coerce)throw new A(`coercion (z.coerce.${c}())`);let a=o||!!i.checks?.length,u;switch(c){case"string":u=My(e,t,n,r,a);break;case"number":u=Fy(e,n,r);break;case"boolean":u=Vy(e,r);break;case"bigint":u=Uy(e,n,r);break;case"symbol":u=Ky(e,r);break;case"undefined":u=Hy(e,r);break;case"null":u=By(e,r);break;case"any":case"unknown":u=r;break;case"never":e.write("return INVALID;"),u=r;break;case"void":u=Jy(e,r);break;case"nan":u=Wy(e,r);break;case"date":u=qy(e,r);break;case"object":u=Gy(e,t,n,r,a);break;case"optional":u=Xy(e,t,n,r,a);break;case"nullable":u=ew(e,t,n,r,a);break;case"array":u=tw(e,t,n,r,a);break;case"literal":u=nw(e,t,n,r);break;case"enum":u=rw(e,t,n,r);break;case"readonly":{let l=Dp(e,t,n,r),f=S(t);e.write(`const ${f} = Object.freeze(${l});`),u=f;break}case"success":Dp(e,t,n,r),u="true";break;case"default":case"prefault":u=ow(e,t,n,r);break;case"nonoptional":u=iw(e,t,n,r);break;case"tuple":u=sw(e,t,n,r);break;case"union":u=cw(e,t,n,r);break;case"intersection":u=lw(e,t,n,r);break;case"record":u=fw(e,t,n,r);break;case"map":u=dw(e,t,n,r);break;case"set":u=mw(e,t,n,r);break;case"file":u=hw(e,r);break;case"template_literal":u=gw(e,t,n,r);break;case"lazy":u=_w(e,t,n,r);break;case"pipe":u=yw(e,t,n,r);break;case"custom":u=ww(e,t,n,r);break;case"transform":u=$w(e,t,n,r);break;case"catch":u=vw(e,t,n,r);break;default:throw new A(`schema type ${c}`)}return u===null?null:Iy(e,t,n,u)}s(M,"generateCheck");function My(e,t,n,r,o=!0){e.write(`if (typeof ${r} !== "string") return INVALID;`);let i=n._zod.def;return i.format===void 0?r:Fp(e,t,i,r,o)}s(My,"generateStringCheck");function Fy(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);let r=t._zod.def;return r.check==="number_format"&&r.format&&Mp(e,{format:r.format},n),n}s(Fy,"generateNumberCheck");function Vy(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}s(Vy,"generateBooleanCheck");function Uy(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);let r=t._zod.def;if(r.format)switch(r.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}s(Uy,"generateBigIntCheck");function Ky(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}s(Ky,"generateSymbolCheck");function Hy(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(Hy,"generateUndefinedCheck");function By(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}s(By,"generateNullCheck");function Jy(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(Jy,"generateVoidCheck");function Wy(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}s(Wy,"generateNaNCheck");function qy(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}s(qy,"generateDateCheck");function Gy(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`);let c=i.shape,a=Object.keys(c),u=Object.getOwnPropertySymbols(c),l=u.length?[...a,...u]:a,f=s($=>typeof $=="symbol"?P(t,$):X($),"keyExpr"),p=s($=>typeof $=="symbol"?`[${f($)}]`:X($),"propKey"),d=c;if(a.includes("__proto__"))throw new A('object shape key "__proto__"');let m=new Map;for(let $ of l){let O=d[$],C=f($),j=S(t);if(e.write(`const ${j} = ${r}[${C}];`),O._zod.optin!==void 0){let N=S(t);e.write(`let ${N} = (() => {`),e.indented(q=>{let un=G(q,t,O,j);q.write(`return ${un};`)}),e.write("})();"),O._zod.optout==="optional"?(e.write(`if (${N} === INVALID) {`),e.indented(q=>{q.write(`if (${C} in ${r}) return INVALID;`),q.write(`${N} = undefined;`)}),e.write("}")):e.write(`if (${N} === INVALID) return INVALID;`),m.set($,N)}else{Qy(O)&&e.write(`if (!(${C} in ${r})) return INVALID;`);let N=G(e,t,O,j,o);N!==null&&m.set($,N)}}let g=i.catchall,y="none";if(g){let $=g._zod.def.type;if($==="never"){let O=a.map(C=>`k !== ${X(C)}`).join(" && ")||"true";e.write(`for (const k in ${r}) {`),e.indented(C=>{C.write(`if (${O}) return INVALID;`)}),e.write("}")}else($==="unknown"||$==="any")&&!g._zod.def.checks?.length?y="passthrough":y="schema"}let b=S(t),k=l.some($=>Zp(d[$])||Sa(d[$]));if(!o){if(y==="schema"){let $=a.length>0?P(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(O=>{O.write('if (k === "__proto__") continue;'),$&&O.write(`if (${$}.has(k)) continue;`);let C=S(t);O.write(`const ${C} = ${r}[k];`),G(O,t,g,C,!1)}),e.write("}")}return null}if(k){e.write(`const ${b} = {};`);for(let $ of l){let O=f($),C=m.get($);Sa(d[$])?e.write(`if (${O} in ${r}) ${b}[${O}] = ${C};`):Zp(d[$])?e.write(`if (${C} !== undefined || ${O} in ${r}) ${b}[${O}] = ${C};`):e.write(`${b}[${O}] = ${C};`)}}else{let $=l.map(O=>`${p(O)}: ${m.get(O)}`).join(", ");e.write(`const ${b} = { ${$} };`)}if(y!=="none"){let $=a.length>0?P(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(O=>{if(O.write('if (k === "__proto__") continue;'),$&&O.write(`if (${$}.has(k)) continue;`),y==="passthrough")O.write(`${b}[k] = ${r}[k];`);else{let C=S(t);O.write(`const ${C} = ${r}[k];`);let j=G(O,t,g,C);O.write(`${b}[k] = ${j};`)}}),e.write("}")}return b}s(Gy,"generateObjectCheck");function Xy(e,t,n,r,o=!0){let i=n._zod.def;if(Yy(n))return M(e,t,i.innerType,r,o);if(i.innerType._zod.optin==="defaulted"){let a=S(t),u=S(t);return e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(l=>{l.write(`const ${u} = (() => {`),l.indented(f=>{let p=M(f,t,i.innerType,r);f.write(`return ${p};`)}),l.write("})();"),l.write(`if (${u} !== INVALID) ${a} = ${u};`)}),e.write("} else {"),e.indented(l=>{let f=M(l,t,i.innerType,r);l.write(`${a} = ${f};`)}),e.write("}"),a}let c=o?S(t):null;return c&&e.write(`let ${c};`),e.write(`if (${r} !== undefined) {`),e.indented(a=>{let u=M(a,t,i.innerType,r,o);c&&u!==null&&a.write(`${c} = ${u};`)}),e.write("}"),c}s(Xy,"generateOptionalCheck");function Yy(e){return e._zod.traits?.has("$ZodExactOptional")===!0}s(Yy,"isExactOptional");function Qy(e){return e._zod.optin===void 0&&tt(e)}s(Qy,"requiresPresenceCheck");function tt(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?tt(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?tt(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(tt):!0;case"intersection":return!t.left||!t.right?!0:tt(t.left)&&tt(t.right);case"pipe":return t.in?tt(t.in):!0;default:return!0}}s(tt,"fastPathAcceptsAbsence");function Sa(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}s(Sa,"dropsWhenAbsent");function Zp(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Nt(e)}s(Zp,"mayOmitUndefined");function Nt(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?Nt(t.innerType):!0;case"union":return t.options?t.options.some(Nt):!0;case"intersection":return!t.left||!t.right||Nt(t.left)||Nt(t.right);case"pipe":return t.out?Nt(t.out):!0;default:return!0}}s(Nt,"mayOutputUndefined");function ew(e,t,n,r,o=!0){let i=n._zod.def,c=o?S(t):null;return c&&e.write(`let ${c} = null;`),e.write(`if (${r} !== null) {`),e.indented(a=>{let u=M(a,t,i.innerType,r,o);c&&u!==null&&a.write(`${c} = ${u};`)}),e.write("}"),c}s(ew,"generateNullableCheck");function Oa(e,t,n){for(let[r,o]of xt(t._zod.def.checks))e.write(`if (${n} > ${Re(r,o._zod.def.check)}) return INVALID;`)}s(Oa,"generateSizeGate");function tw(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (!Array.isArray(${r})) return INVALID;`),Oa(e,n,`${r}.length`);let c=o?S(t):null,a=S(t),u=S(t);return c&&e.write(`const ${c} = new Array(${r}.length);`),e.write(`for (let ${a} = 0; ${a} < ${r}.length; ${a}++) {`),e.indented(l=>{l.write(`const ${u} = ${r}[${a}];`);let f=G(l,t,i.element,u,o);c&&f!==null&&l.write(`${c}[${a}] = ${f};`)}),e.write("}"),c}s(tw,"generateArrayCheck");function nw(e,t,n,r){let i=n._zod.def.values;if(i.length!==1){let a=P(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}let c=i[0];if(typeof c=="number"&&Number.isNaN(c)){let a=P(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}if(typeof c=="string")e.write(`if (${r} !== ${X(c)}) return INVALID;`);else if(typeof c=="number"||typeof c=="boolean")e.write(`if (${r} !== ${c}) return INVALID;`);else if(c===null)e.write(`if (${r} !== null) return INVALID;`);else if(c===void 0)e.write(`if (${r} !== undefined) return INVALID;`);else if(typeof c=="bigint")e.write(`if (${r} !== ${c}n) return INVALID;`);else throw new A(`literal type ${typeof c}`);return r}s(nw,"generateLiteralCheck");function rw(e,t,n,r){let o=n._zod.values;if(!o)throw new A("enum schema without enumerated values");let i=P(t,o);return e.write(`if (!${i}.has(${r})) return INVALID;`),r}s(rw,"generateEnumCheck");function Dp(e,t,n,r){let o=n._zod.def;return M(e,t,o.innerType,r)}s(Dp,"generateWrapperCheck");function ow(e,t,n,r){let o=n._zod.def,c=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!c)return M(e,t,o.innerType,r);let u=P(t,c),l=S(t);return e.write(`let ${l} = ${r};`),e.write(`if (${r} === undefined) ${l} = ${u}();`),M(e,t,o.innerType,l)}let a=S(t);if(c){let u=P(t,c),l=P(t,pn);e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(f=>{f.write(`${a} = ${l}(${u}());`)}),e.write("} else {"),e.indented(f=>{let p=M(f,t,o.innerType,r);f.write(`${a} = ${p} === undefined ? ${l}(${u}()) : ${p};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${r} !== undefined) {`),e.indented(u=>{let l=M(u,t,o.innerType,r);u.write(`${a} = ${l};`)}),e.write("}");return a}s(ow,"generateDefaultCheck");function iw(e,t,n,r){let o=n._zod.def,i=M(e,t,o.innerType,r),c=S(t);return e.write(`const ${c} = ${i};`),e.write(`if (${c} === undefined) return INVALID;`),c}s(iw,"generateNonOptionalCheck");function sw(e,t,n,r){let o=n._zod.def,i=o.items,c=o.rest;e.write(`if (!Array.isArray(${r})) return INVALID;`);let a=Rp(i,"optin"),u=Rp(i,"optout");c?e.write(`if (${r}.length < ${a}) return INVALID;`):e.write(`if (${r}.length < ${a} || ${r}.length > ${i.length}) return INVALID;`);let l=S(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} < ${r}.length) {`),d.indented(m=>{let g=S(t);m.write(`const ${g} = ${r}[${f}];`);let y=G(m,t,p,g);m.write(`${l}[${f}] = ${y};`)}),d.write("} else {"),d.indented(m=>{if(Sa(p)){m.write(`${l}.length = ${f};`);return}let g=S(t),y=S(t);m.write(`const ${g} = undefined;`),m.write(`const ${y} = (() => {`),m.indented(b=>{let k=G(b,t,p,g);b.write(`return ${k};`)}),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=S(t);e.write(`const ${d} = ${r}[${f}];`);let m=G(e,t,p,d);e.write(`${l}[${f}] = ${m};`)}}if(c){let f=S(t),p=S(t);e.write(`for (let ${f} = ${i.length}; ${f} < ${r}.length; ${f}++) {`),e.indented(d=>{d.write(`const ${p} = ${r}[${f}];`);let m=G(d,t,c,p);d.write(`${l}[${f}] = ${m};`)}),e.write("}")}return l}s(sw,"generateTupleCheck");function Rp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}s(Rp,"getTupleOptStart");function cw(e,t,n,r){let o=n._zod.def,i=o.options;if(o.discriminator)return aw(e,t,o,r);if(o.inclusive===!1)throw new A("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),r;if(i.length===1)return M(e,t,i[0],r);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=P(t,u);return e.write(`if (!${l}.has(${r})) return INVALID;`),r}let a=S(t);e.write(`let ${a};`);for(let u=0;u<i.length;u++){let l=i[u];u===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(f=>{let p=M(f,t,l,r);f.write(`return ${p};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}s(cw,"generateUnionCheck");function aw(e,t,n,r){if(n.unionFallback)throw new A("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),r;let o=S(t),i=S(t);e.write(`const ${o} = ${r}?.[${X(n.discriminator)}];`),e.write(`let ${i};`);let c=!0,a=new Set;for(let u of n.options){let l=u._zod.propValues?.[n.discriminator];if(!l||l.size===0)throw new A("discriminated union option without static discriminator values");for(let d of l){if(a.has(d))throw new A(`duplicate discriminator value ${String(d)}`);a.add(d)}let f=Array.from(l,d=>uw(t,o,d)),p=c?"if":"else if";e.write(`${p} (${f.join(" || ")}) {`),e.indented(d=>{let m=M(d,t,u,r);d.write(`${i} = ${m};`)}),e.write("}"),c=!1}return e.write("else { return INVALID; }"),i}s(aw,"generateDiscriminatedUnionCheck");function uw(e,t,n){if(typeof n=="string")return`${t} === ${X(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){let r=P(e,n);return`${t} === ${r}`}throw new A(`literal discriminator value ${String(n)}`)}s(uw,"literalEquality");function lw(e,t,n,r){let o=n._zod.def;t.definite=!1;let i=G(e,t,o.left,r),c=G(e,t,o.right,r),a=P(t,Et),u=S(t);return e.write(`const ${u} = ${a}(${i}, ${c});`),e.write(`if (!${u}.valid) return INVALID;`),`${u}.data`}s(lw,"generateIntersectionCheck");function fw(e,t,n,r){let o=n._zod.def,i=P(t,pe);e.write(`if (!${i}(${r})) return INVALID;`);let c=S(t),a=S(t),u=S(t);e.write(`const ${c} = {};`);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 A(`record key value ${String(y)}`);let b=typeof y=="number"?y.toString():y;if(b==="__proto__")throw new A('record key "__proto__"');m.push(b);let k=P(t,y),$=M(e,t,o.keyType,k),O=S(t);e.write(`const ${O} = ${r}[${pw(t,b)}];`);let C=G(e,t,o.valueType,O);e.write(`${c}[${$}] = ${C};`)}let g=P(t,new Set(m));return e.write(`for (const ${a} in ${r}) {`),e.indented(y=>{y.write(`if (${g}.has(${a})) continue;`),l.mode==="loose"?y.write(`if (${a} !== "__proto__") ${c}[${a}] = ${r}[${a}];`):y.write("return INVALID;")}),e.write("}"),c}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=po(o.keyType);g.definite===!1&&(t.definite=!1);let y=P(t,g),b=P(t,ze),k=S(t);return Lp(e,t,r,a,$=>{$.write(`let ${k} = ${y}(${a});`),$.write(`if (${k} === INVALID && typeof ${a} === "string" && ${b}.test(${a})) ${k} = ${y}(Number(${a}));`),m?$.write(`if (${k} === INVALID) { ${c}[${a}] = ${r}[${a}]; continue; }`):$.write(`if (${k} === INVALID) return INVALID;`),$.write(`if (${k} === "__proto__") continue;`);let O=S(t);$.write(`const ${O} = ${r}[${a}];`);let C=G($,t,o.valueType,O);$.write(`${c}[${k}] = ${C};`)}),c}return Lp(e,t,r,a,m=>{m.write(`const ${u} = ${r}[${a}];`);let g=G(m,t,o.valueType,u);m.write(`${c}[${a}] = ${g};`)},"return INVALID;"),c}s(fw,"generateRecordCheck");function Lp(e,t,n,r,o,i){let c=P(t,Object.prototype.propertyIsEnumerable),a=S(t),u=S(t),l=S(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${u} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${l} = 0; ${l} < ${u}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${r} = ${u}[${l}];`),f.write(`if (${r} === "__proto__" || !${c}.call(${n}, ${r})) continue;`),o(f)}),e.write("}"),e.write(`for (let ${l} = 0; ${l} < ${a}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${r} = ${a}[${l}];`),f.write(`if (!${c}.call(${n}, ${r})) continue;`),i?f.write(i):o(f)}),e.write("}")}s(Lp,"emitOwnKeys");function pw(e,t){return typeof t=="string"?X(t):P(e,t)}s(pw,"literalPropertyKey");function dw(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Map)) return INVALID;`),Oa(e,n,`${r}.size`);let i=S(t),c=S(t),a=S(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${c}, ${a}] of ${r}) {`),e.indented(u=>{let l=M(u,t,o.keyType,c),f=M(u,t,o.valueType,a);u.write(`${i}.set(${l}, ${f});`)}),e.write("}"),i}s(dw,"generateMapCheck");function mw(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Set)) return INVALID;`),Oa(e,n,`${r}.size`);let i=S(t),c=S(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${c} of ${r}) {`),e.indented(a=>{let u=M(a,t,o.valueType,c);a.write(`${i}.add(${u});`)}),e.write("}"),i}s(mw,"generateSetCheck");function hw(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}s(hw,"generateFileCheck");function gw(e,t,n,r){e.write(`if (typeof ${r} !== "string") return INVALID;`);let o=n._zod.pattern;if(o){let i=P(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${r})) return INVALID;`)}return r}s(gw,"generateTemplateLiteralCheck");function _w(e,t,n,r){let o=n._zod.def,i=nt(t,o.getter),c=P(t,{parser:null});e.write(`if (!${c}.parser) {`),e.indented(u=>{u.write(`const inner = ${i}();`),u.write(`${c}.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 a=S(t);return e.write(`const ${a} = ${c}.parser(${r});`),e.write(`if (${a} === INVALID) return INVALID;`),a}s(_w,"generateLazyCheck");function yw(e,t,n,r){let o=n._zod.def,i=M(e,t,o.in,r);if(o.transform){if(rt(o.transform))throw new ge("z.compile: async transforms in pipes are not supported");let c=o.transform,u=nt(t,s(f=>{let p={value:f,issues:[],addIssue:za},d=c(f,p);return d instanceof Promise?Q:p.issues.length===0?d:Q},"helperFn")),l=S(t);return e.write(`const ${l} = ${u}(${i});`),e.write(`if (${l} === INVALID) return INVALID;`),M(e,t,o.out,l)}else return M(e,t,o.out,i)}s(yw,"generatePipeCheck");function rt(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}s(rt,"isAsyncFunction");function ww(e,t,n,r){let o=n._zod.def;if(o.fn){if(rt(o.fn))throw new ge("z.compile: async custom predicates are not supported");let i=nt(t,o.fn),c=P(t,ka),a=S(t);e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${c}();`),e.write(`if (!${a}) return INVALID;`)}else throw new A("custom schema without a predicate function");return r}s(ww,"generateCustomCheck");function bw(e,t,n){let r=e._zod.run({value:n,issues:[]},{});if(r&&typeof r.then=="function")return Q;let o=r;return o.issues.length===0?o.value:t()}s(bw,"runtimeCatch");function vw(e,t,n,r){let o=n._zod.def;if(!o.catchValue[br])throw new A("catch with a callback (only a constant catch value compiles)",!1);let i=S(t);e.write(`let ${i} = (() => {`),e.indented(l=>{let f=G(l,t,o.innerType,r);l.write(`return ${f};`)}),e.write("})();");let c=P(t,o.innerType),a=nt(t,o.catchValue),u=P(t,bw);return e.write(`if (${i} === INVALID) {`),e.indented(l=>{l.write(`${i} = ${u}(${c}, ${a}, ${r});`),l.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}s(vw,"generateCatchCheck");function $w(e,t,n,r){let o=n._zod.def;if(o.transform){if(rt(o.transform))throw new ge("z.compile: async transforms are not supported");let i=o.transform,a=nt(t,s(l=>{let f={value:l,issues:[],addIssue:za},p=i(l,f);return p instanceof Promise?Q:f.issues.length===0?p:Q},"helperFn")),u=S(t);return e.write(`const ${u} = ${a}(${r});`),e.write(`if (${u} === INVALID) return INVALID;`),u}return r}s($w,"generateTransformCheck");function mo(e){return e.checks&&(e.checks=[...e.checks]),e}s(mo,"snapshotChecks");function Ia(e,t){return new e(mo({type:"string",...w(t)}))}s(Ia,"_string");function Ea(e,t){return new e(mo({type:"string",coerce:!0,...w(t)}))}s(Ea,"_coercedString");function ho(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}s(ho,"_email");function go(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}s(go,"_guid");function _o(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}s(_o,"_uuid");function yo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}s(yo,"_uuidv4");function wo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}s(wo,"_uuidv6");function bo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}s(bo,"_uuidv7");function Vn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}s(Vn,"_url");function vo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}s(vo,"_emoji");function $o(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}s($o,"_nanoid");function xo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}s(xo,"_cuid");function ko(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}s(ko,"_cuid2");function So(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}s(So,"_ulid");function Po(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}s(Po,"_xid");function zo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}s(zo,"_ksuid");function Oo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}s(Oo,"_ipv4");function Io(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}s(Io,"_ipv6");function Aa(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...w(t)})}s(Aa,"_mac");function Eo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}s(Eo,"_cidrv4");function Ao(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}s(Ao,"_cidrv6");function No(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}s(No,"_base64");function Co(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}s(Co,"_base64url");function To(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}s(To,"_e164");function Na(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...w(t)})}s(Na,"_creditCard");function Ca(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...w(t)})}s(Ca,"_iban");function Zo(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}s(Zo,"_jwt");var Ta={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Un(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}s(Un,"_isoDateTime");function Kn(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}s(Kn,"_isoDate");function Hn(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}s(Hn,"_isoTime");function Bn(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}s(Bn,"_isoDuration");function Za(e,t){return new e(mo({type:"number",checks:[],...w(t)}))}s(Za,"_number");function Da(e,t){return new e(mo({type:"number",coerce:!0,checks:[],...w(t)}))}s(Da,"_coercedNumber");function Ra(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}s(Ra,"_int");function La(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...w(t)})}s(La,"_float32");function ja(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...w(t)})}s(ja,"_float64");function Ma(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...w(t)})}s(Ma,"_int32");function Fa(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...w(t)})}s(Fa,"_uint32");function Va(e,t){return new e({type:"boolean",...w(t)})}s(Va,"_boolean");function Ua(e,t){return new e({type:"boolean",coerce:!0,...w(t)})}s(Ua,"_coercedBoolean");function Ka(e,t){return new e({type:"bigint",...w(t)})}s(Ka,"_bigint");function Ha(e,t){return new e({type:"bigint",coerce:!0,...w(t)})}s(Ha,"_coercedBigint");function Ba(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...w(t)})}s(Ba,"_int64");function Ja(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...w(t)})}s(Ja,"_uint64");function Wa(e,t){return new e({type:"symbol",...w(t)})}s(Wa,"_symbol");function qa(e,t){return new e({type:"undefined",...w(t)})}s(qa,"_undefined");function Ga(e,t){return new e({type:"null",...w(t)})}s(Ga,"_null");function Xa(e){return new e({type:"any"})}s(Xa,"_any");function Ya(e){return new e({type:"unknown"})}s(Ya,"_unknown");function Qa(e,t){return new e({type:"never",...w(t)})}s(Qa,"_never");function eu(e,t){return new e({type:"void",...w(t)})}s(eu,"_void");function tu(e,t){return new e({type:"date",...w(t)})}s(tu,"_date");function nu(e,t){return new e({type:"date",coerce:!0,...w(t)})}s(nu,"_coercedDate");function ru(e,t){return new e({type:"nan",...w(t)})}s(ru,"_nan");function ye(e,t){return new Dr({check:"less_than",...w(t),value:e,inclusive:!1})}s(ye,"_lt");function le(e,t){return new Dr({check:"less_than",...w(t),value:e,inclusive:!0})}s(le,"_lte");function we(e,t){return new Rr({check:"greater_than",...w(t),value:e,inclusive:!1})}s(we,"_gt");function fe(e,t){return new Rr({check:"greater_than",...w(t),value:e,inclusive:!0})}s(fe,"_gte");function Do(e){return we(0,e)}s(Do,"_positive");function Ro(e){return ye(0,e)}s(Ro,"_negative");function Lo(e){return le(0,e)}s(Lo,"_nonpositive");function jo(e){return fe(0,e)}s(jo,"_nonnegative");function Le(e,t){return new js({check:"multiple_of",...w(t),value:e})}s(Le,"_multipleOf");function je(e,t){return new Vs({check:"max_size",...w(t),maximum:e})}s(je,"_maxSize");function be(e,t){return new Us({check:"min_size",...w(t),minimum:e})}s(be,"_minSize");function ot(e,t){return new Ks({check:"size_equals",...w(t),size:e})}s(ot,"_size");function it(e,t){return new Hs({check:"max_length",...w(t),maximum:e})}s(it,"_maxLength");function Oe(e,t){return new Bs({check:"min_length",...w(t),minimum:e})}s(Oe,"_minLength");function st(e,t){return new Js({check:"length_equals",...w(t),length:e})}s(st,"_length");function Ct(e,t){return new Ws({check:"string_format",format:"regex",...w(t),pattern:e})}s(Ct,"_regex");function Tt(e){return new qs({check:"string_format",format:"lowercase",...w(e)})}s(Tt,"_lowercase");function Zt(e){return new Gs({check:"string_format",format:"uppercase",...w(e)})}s(Zt,"_uppercase");function Dt(e,t){return new Xs({check:"string_format",format:"includes",...w(t),includes:e})}s(Dt,"_includes");function Rt(e,t){return new Ys({check:"string_format",format:"starts_with",...w(t),prefix:e})}s(Rt,"_startsWith");function Lt(e,t){return new Qs({check:"string_format",format:"ends_with",...w(t),suffix:e})}s(Lt,"_endsWith");function Mo(e,t,n){return new ec({check:"property",property:e,schema:t,...w(n)})}s(Mo,"_property");function jt(e,t){return new tc({check:"properties",shape:e,...w(t)})}s(jt,"_properties");function Mt(e,t){return new nc({check:"mime_type",mime:e,...w(t)})}s(Mt,"_mime");function _e(e){return new rc({check:"overwrite",tx:e})}s(_e,"_overwrite");function Ft(e){return _e(t=>t.normalize(e))}s(Ft,"_normalize");function Vt(){return _e(e=>e.trim())}s(Vt,"_trim");function Ut(){return _e(e=>e.toLowerCase())}s(Ut,"_toLowerCase");function Kt(){return _e(e=>e.toUpperCase())}s(Kt,"_toUpperCase");function Ht(){return _e(e=>Mi(e))}s(Ht,"_slugify");function ou(e,t,n){return new e({type:"array",element:t,...w(n)})}s(ou,"_array");function xw(e,t,n){return new e({type:"union",options:t,...w(n)})}s(xw,"_union");function kw(e,t,n){return new e({type:"union",options:t,inclusive:!1,...w(n)})}s(kw,"_xor");function Sw(e,t,n,r){return new e({type:"union",options:n,discriminator:t,...w(r)})}s(Sw,"_discriminatedUnion");function Pw(e,t,n){return new e({type:"intersection",left:t,right:n})}s(Pw,"_intersection");function zw(e,t,n,r){let o=n instanceof z,i=o?r:n,c=o?n:null;return new e({type:"tuple",items:t,rest:c,...w(i)})}s(zw,"_tuple");function Ow(e,t,n,r){return new e({type:"record",keyType:t,valueType:n,...w(r)})}s(Ow,"_record");function Iw(e,t,n,r){return new e({type:"map",keyType:t,valueType:n,...w(r)})}s(Iw,"_map");function Ew(e,t,n){return new e({type:"set",valueType:t,...w(n)})}s(Ew,"_set");function Aw(e,t,n){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:r,...w(n)})}s(Aw,"_enum");function Nw(e,t,n){return new e({type:"enum",entries:t,...w(n)})}s(Nw,"_nativeEnum");function Cw(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...w(n)})}s(Cw,"_literal");function iu(e,t){return new e({type:"file",...w(t)})}s(iu,"_file");function Tw(e,t){return new e({type:"transform",transform:t})}s(Tw,"_transform");function Zw(e,t){return new e({type:"optional",innerType:t})}s(Zw,"_optional");function Dw(e,t){return new e({type:"nullable",innerType:t})}s(Dw,"_nullable");function Rw(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():pn(n)}})}s(Rw,"_default");function Lw(e,t,n){return new e({type:"nonoptional",innerType:t,...w(n)})}s(Lw,"_nonoptional");function jw(e,t){return new e({type:"success",innerType:t})}s(jw,"_success");function Mw(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:Ji(n)})}s(Mw,"_catch");function Fw(e,t,n){return new e({type:"pipe",in:t,out:n})}s(Fw,"_pipe");function Vw(e,t){return new e({type:"readonly",innerType:t})}s(Vw,"_readonly");function Uw(e,t,n){return new e({type:"template_literal",parts:t,...w(n)})}s(Uw,"_templateLiteral");function Kw(e,t){return new e({type:"lazy",getter:t})}s(Kw,"_lazy");function Hw(e,t){return new e({type:"promise",innerType:t})}s(Hw,"_promise");function su(e,t,n){let r=w(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}s(su,"_custom");function cu(e,t,n){return new e({type:"custom",check:"custom",fn:t,...w(n)})}s(cu,"_refine");function au(e,t){let n=Vp(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(kt(o,r.value,n._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(kt(i))}},e(r.value,r)),t);return n}s(au,"_superRefine");function Vp(e,t){let n=new L({check:"custom",...w(t)});return n._zod.check=e,n}s(Vp,"_check");function uu(e){let t=new L({check:"describe"});return t._zod.onattach=[n=>{let r=W.get(n)??{};W.add(n,{...r,description:e})}],t._zod.check=()=>{},t}s(uu,"describe");function lu(e){let t=new L({check:"meta"});return t._zod.onattach=[n=>{let r=W.get(n)??{};W.add(n,{...r,...e})}],t._zod.check=()=>{},t}s(lu,"meta");function fu(e,t){let n=w(t),r=n.truthy??["true","1","yes","on","y","enabled"],o=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(r=r.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(r),c=new Set(o),a=e.Codec??Zn,u=e.Boolean??Cn,l=e.String??et,f=new l({type:"string",error:n.error}),p=new u({type:"boolean",error:n.error}),d=new a({type:"pipe",in:f,out:p,transform:s(((m,g)=>{let y=m;return n.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:c.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...c],input:g.value,inst:d,continue:!1}),{})}),"transform"),reverseTransform:s(((m,g)=>m===!0?r[0]||"true":o[0]||"false"),"reverseTransform"),error:n.error});return d._zod.bag.truthy=r,d._zod.bag.falsy=o,d._zod.bag.case=n.case??"insensitive",d}s(fu,"_stringbool");function ct(e,t,n,r={}){let o=w(r),i={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...o};return n instanceof RegExp&&(i.pattern=n),new e(i)}s(ct,"_stringFormat");function Jn(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&J(e,r,n[r]);return e}s(Jn,"assignProps");function Me(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??W,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}}s(Me,"initializeContext");function U(e,t,n,r,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(n,i),!0}s(U,"handleUnrepresentable");function D(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;let c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)c.schema=a;else{let f={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,f);else{let d=c.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&&(c.ref||(c.ref=p),D(p,t,f),t.seen.get(p).isParent=!0)}let u=t.metadataRegistry.get(e);return u&&Jn(c.schema,u),t.io==="input"&&ee(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&"_prefault"in c.schema&&((r=c.schema).default??(r.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}s(D,"processSchema");function Up(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}s(Up,"encodeJSONPointerSegment");function Fe(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let c of e.seen.entries()){let a=e.metadataRegistry.get(c[0])?.id;if(a){let u=r.get(a);if(u&&u!==c[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,c[0])}}let o=s(c=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(c[0])?.id,d=e.external.uri??(g=>g);if(p)return{ref:d(p)};let m=c[1].defId??c[1].schema.id??`schema${e.counter++}`;return c[1].defId=m,{defId:m,ref:`${d("__shared")}#/${a}/${Up(m)}`}}let u="#",l=`${u}/${a}/`;if(c[1]===n&&!c[1].schema.id)return{ref:u};let f=c[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:l+Up(f)}},"makeURI"),i=s(c=>{if(c[1].schema.$ref)return;let a=c[1],{ref:u,defId:l}=o(c);a.def={...a.schema},l&&(a.defId=l);let f=a.schema;for(let p in f)delete f[p];f.$ref=u},"extractToDef");if(e.cycles==="throw")for(let c of e.seen.entries()){let a=c[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
66
+ }`,d;try{d=new f(...c,p)(...a)}catch(m){throw new A(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=l),d.definite=r.definite,d}s(bo,"compileFn");function P(e,t){for(let[r,o]of e.constants)if(o===t)return r;let n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}s(P,"addConstant");function it(e,t){return e.definite=!1,P(e,t)}s(it,"addUserConstant");function S(e){return`v${e.varCounter++}`}s(S,"newVar");function Ry(e,t){let n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return ee;let r=n;return r.issues.length===0?r.value:ee}s(Ry,"runtimeRun");function G(e,t,n,r,o=!0){let i=e.content.length,c=t.constants.size,a=t.constantCounter,u=t.varCounter;try{return M(e,t,n,r,o)}catch(l){if(!(l instanceof A)||!l.islandable)throw l;if(e.content.length=i,t.constants.size>c){let f=Array.from(t.constants.keys()).slice(c);for(let p of f)t.constants.delete(p)}return t.constantCounter=a,t.varCounter=u,jy(e,t,n,r)}}s(G,"compileChild");function jy(e,t,n,r){t.definite=!1;let o=P(t,n),i=P(t,Ry),c=S(t);return e.write(`const ${c} = ${i}(${o}, ${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}s(jy,"emitRuntimeIsland");var My=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function Fy(e,t,n,r){let o=n._zod.def.checks;if(!o||o.length===0)return r;let i=r;for(let c of o){let a=c._zod.def;if(a.when&&!My.has(a.check))throw new A('check with a custom "when" condition');switch(a.check){case"greater_than":Uy(e,t,a,i);break;case"less_than":Vy(e,t,a,i);break;case"multiple_of":Ky(e,t,a,i);break;case"number_format":Wp(e,a,i);break;case"min_length":{let u=Re(a.minimum,"min_length"),l=Aa(e,t,i,`${i}.length >= ${u} && ${i}.length < ${a.minimum*2}`);e.write(`if (${l} < ${u}) return INVALID;`);break}case"max_length":{let u=Re(a.maximum,"max_length"),l=Aa(e,t,i,`${i}.length > ${u}`);e.write(`if (${l} > ${u}) return INVALID;`);break}case"length_equals":{let u=Re(a.length,"length_equals"),l=Aa(e,t,i,`${i}.length >= ${u} && ${i}.length <= ${a.length*2}`);e.write(`if (${l} !== ${u}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${Re(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${Re(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${Re(a.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Xp(e,t,a,i);break;case"custom":i=qy(e,t,c,i);break;case"bigint_format":Hy(e,a,i);break;case"mime_type":By(e,t,a,i);break;case"property":Wy(e,t,a,i);break;case"properties":Jy(e,t,a,i);break;case"overwrite":{let u=S(t);Xy(e,t,c,i,u),i=u;break}default:throw new A(`check type ${a.check}`)}}return i}s(Fy,"generateChecks");function Aa(e,t,n,r){let o=P(t,et),i=S(t);return e.write(`const ${i} = typeof ${n} === "string" && ${r} ? ${o}(${n}) : ${n}.length;`),i}s(Aa,"codePointLengthVar");function Re(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new A(`${t} bound of type ${typeof e}`);return`${e}`}s(Re,"numericOperand");function Jp(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new A("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new A("comparison check with Invalid Date bound");return P(e,t)}throw new A(`comparison check bound of type ${typeof t}`)}s(Jp,"comparisonOperand");function Uy(e,t,n,r){let o=n.inclusive?"<":"<=";e.write(`if (${r} ${o} ${Jp(t,n.value)}) return INVALID;`)}s(Uy,"generateGreaterThanCheck");function Vy(e,t,n,r){let o=n.inclusive?">":">=";e.write(`if (${r} ${o} ${Jp(t,n.value)}) return INVALID;`)}s(Vy,"generateLessThanCheck");function Ky(e,t,n,r){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new A("multiple_of check with a zero divisor");e.write(`if (${r} % ${n.value}n !== 0n) return INVALID;`)}else{let o=P(t,gn);e.write(`if (${o}(${r}, ${Re(n.value,"multiple_of")}) !== 0) return INVALID;`)}}s(Ky,"generateMultipleOfCheck");function Wp(e,t,n){let r=t.format;switch(r){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new A(`number format ${r}`)}}s(Wp,"generateNumberFormatCheck");function Hy(e,t,n){let r=t.format;if(r)switch(r){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new A(`bigint format ${r}`)}}s(Hy,"generateBigIntFormatCheck");function By(e,t,n,r){let o=n.mime;if(o&&o.length>0){let i=P(t,new Set(o));e.write(`if (!${i}.has(${r}.type)) return INVALID;`)}}s(By,"generateMimeTypeCheck");function Jy(e,t,n,r){if(n.when)throw new A('check with a custom "when" condition');e.write(`if (${r} == null) return INVALID;`);let o=n.shape;for(let i of Reflect.ownKeys(o)){let c=typeof i=="symbol"?P(t,i):Y(i),a=S(t);e.write(`const ${a} = ${r}[${c}];`),G(e,t,o[i],a,!1)}}s(Jy,"generatePropertiesChecks");function Wy(e,t,n,r){let o=`${r}[${JSON.stringify(n.property)}]`;M(e,t,n.schema,o)}s(Wy,"generatePropertyCheck");function Xy(e,t,n,r,o){let i=n._zod.def.tx;if(!i)throw new A("overwrite check without a transform function");if(st(i))throw new _e("z.compile: async overwrite transforms are not supported");let c=P(t,i);e.write(`const ${o} = ${c}(${r});`)}s(Xy,"generateOverwriteCheck");function Na(){throw new ce}s(Na,"throwAsync");function Da(e){this.issues.push(e)}s(Da,"pushIssue");function qy(e,t,n,r){let o=n._zod.def;if(o.fn){if(st(o.fn))throw new _e("z.compile: async .refine() predicates are not supported");let i=it(t,o.fn),c=P(t,Na),a=S(t);return e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${c}();`),e.write(`if (!${a}) return INVALID;`),r}if(n._zod.check){if(st(n._zod.check))throw new _e("z.compile: async .superRefine() / check functions are not supported");let i=n._zod.check,a=it(t,s(l=>{let f={value:l,issues:[],addIssue:Da};return i(f)instanceof Promise&&Na(),f.issues.length===0?f.value:ee},"helperFn")),u=S(t);return e.write(`const ${u} = ${a}(${r});`),e.write(`if (${u} === INVALID) return INVALID;`),u}throw new A("custom check without a predicate or check function")}s(qy,"generateCustomRefineCheck");var Gy=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"]);function Xp(e,t,n,r,o=!0){let i=n.format;if(i==="base64"){let l=P(t,Zn);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="base64url"){let l=P(t,to);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="jwt"){let l=P(t,oo),f=P(t,n.alg??null);return e.write(`if (!${l}(${r}, ${f})) return INVALID;`),r}if(i==="ipv6"){let l=P(t,Dn);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="cidrv6"){let l=P(t,Qr);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="credit_card"){let l=P(t,no);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(i==="iban"){let l=P(t,ro);return e.write(`if (!${l}(${r})) return INVALID;`),r}let c=n;if(i==="url"||i==="httpurl"||c.normalize||c.hostname!==void 0||c.protocol!==void 0){let l=P(t,qr),f=P(t,n),p=S(t),d=S(t);if(e.write(`const ${p} = ${r}.trim();`),e.write(`const ${d} = ${l}(${p}, ${f});`),e.write(`if (typeof ${d} === "number") return INVALID;`),c.hostname!==void 0){let y=P(t,Gr);e.write(`if (!${y}(${d}, ${f}.hostname)) return INVALID;`)}if(c.protocol!==void 0){let y=P(t,Yr);e.write(`if (!${y}(${d}, ${f}.protocol)) return INVALID;`)}if(!o)return null;let m=S(t),g=c.normalize?`${d}.href`:`${P(t,Tn)}(${p})`;return e.write(`const ${m} = ${g};`),m}let a=n.fn;if(a){if(st(a))throw new A(`async string format ${i}`);let l=P(t,a);return e.write(`if (!${l}(${r})) return INVALID;`),r}if(Gy.has(i)&&n.pattern){let l=P(t,n.pattern);return e.write(`${l}.lastIndex = 0;`),e.write(`if (!${l}.test(${r})) return INVALID;`),r}let u=n.format;switch(u){case"regex":throw new A("regex format without a pattern");case"lowercase":e.write(`if (${r} !== ${r}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${r} !== ${r}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${r}.includes(${Y(n.includes)})) return INVALID;`);break;case"starts_with":{let l=n.prefix;e.write(`if (${r}.slice(0, ${l.length}) !== ${Y(l)}) return INVALID;`);break}case"ends_with":{let l=n.suffix;e.write(`if (${r}.slice(-${l.length}) !== ${Y(l)}) return INVALID;`);break}default:throw new A(`string format ${u}`)}return r}s(Xp,"generateStringFormatCheck");function M(e,t,n,r,o=!0){let i=n._zod.def,c=i.type;if(i.coerce)throw new A(`coercion (z.coerce.${c}())`);let a=o||!!i.checks?.length,u;switch(c){case"string":u=Yy(e,t,n,r,a);break;case"number":u=Qy(e,n,r);break;case"boolean":u=ew(e,r);break;case"bigint":u=tw(e,n,r);break;case"symbol":u=nw(e,r);break;case"undefined":u=rw(e,r);break;case"null":u=ow(e,r);break;case"any":case"unknown":u=r;break;case"never":e.write("return INVALID;"),u=r;break;case"void":u=iw(e,r);break;case"nan":u=sw(e,r);break;case"date":u=cw(e,r);break;case"object":u=aw(e,t,n,r,a);break;case"optional":u=uw(e,t,n,r,a);break;case"nullable":u=pw(e,t,n,r,a);break;case"array":u=dw(e,t,n,r,a);break;case"literal":u=mw(e,t,n,r);break;case"enum":u=hw(e,t,n,r);break;case"readonly":{let l=Kp(e,t,n,r),f=S(t);e.write(`const ${f} = Object.freeze(${l});`),u=f;break}case"success":Kp(e,t,n,r),u="true";break;case"default":case"prefault":u=gw(e,t,n,r);break;case"nonoptional":u=_w(e,t,n,r);break;case"tuple":u=yw(e,t,n,r);break;case"union":u=ww(e,t,n,r);break;case"intersection":u=$w(e,t,n,r);break;case"record":u=xw(e,t,n,r);break;case"map":u=Sw(e,t,n,r);break;case"set":u=Pw(e,t,n,r);break;case"file":u=zw(e,r);break;case"template_literal":u=Ow(e,t,n,r);break;case"lazy":u=Ew(e,t,n,r);break;case"pipe":u=Iw(e,t,n,r);break;case"custom":u=Aw(e,t,n,r);break;case"transform":u=Tw(e,t,n,r);break;case"catch":u=Cw(e,t,n,r);break;default:throw new A(`schema type ${c}`)}return u===null?null:Fy(e,t,n,u)}s(M,"generateCheck");function Yy(e,t,n,r,o=!0){e.write(`if (typeof ${r} !== "string") return INVALID;`);let i=n._zod.def;return i.format===void 0?r:Xp(e,t,i,r,o)}s(Yy,"generateStringCheck");function Qy(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);let r=t._zod.def;return r.check==="number_format"&&r.format&&Wp(e,{format:r.format},n),n}s(Qy,"generateNumberCheck");function ew(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}s(ew,"generateBooleanCheck");function tw(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);let r=t._zod.def;if(r.format)switch(r.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}s(tw,"generateBigIntCheck");function nw(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}s(nw,"generateSymbolCheck");function rw(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(rw,"generateUndefinedCheck");function ow(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}s(ow,"generateNullCheck");function iw(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(iw,"generateVoidCheck");function sw(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}s(sw,"generateNaNCheck");function cw(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}s(cw,"generateDateCheck");function aw(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`);let c=i.shape,a=Object.keys(c),u=Object.getOwnPropertySymbols(c),l=u.length?[...a,...u]:a,f=s($=>typeof $=="symbol"?P(t,$):Y($),"keyExpr"),p=s($=>typeof $=="symbol"?`[${f($)}]`:Y($),"propKey"),d=c;if(a.includes("__proto__"))throw new A('object shape key "__proto__"');let m=new Map;for(let $ of l){let O=d[$],C=f($),j=S(t);if(e.write(`const ${j} = ${r}[${C}];`),O._zod.optin!==void 0){let N=S(t);e.write(`let ${N} = (() => {`),e.indented(q=>{let mn=G(q,t,O,j);q.write(`return ${mn};`)}),e.write("})();"),O._zod.optout==="optional"?(e.write(`if (${N} === INVALID) {`),e.indented(q=>{q.write(`if (${C} in ${r}) return INVALID;`),q.write(`${N} = undefined;`)}),e.write("}")):e.write(`if (${N} === INVALID) return INVALID;`),m.set($,N)}else{fw(O)&&e.write(`if (!(${C} in ${r})) return INVALID;`);let N=G(e,t,O,j,o);N!==null&&m.set($,N)}}let g=i.catchall,y="none";if(g){let $=g._zod.def.type;if($==="never"){let O=a.map(C=>`k !== ${Y(C)}`).join(" && ")||"true";e.write(`for (const k in ${r}) {`),e.indented(C=>{C.write(`if (${O}) return INVALID;`)}),e.write("}")}else($==="unknown"||$==="any")&&!g._zod.def.checks?.length?y="passthrough":y="schema"}let b=S(t),k=l.some($=>Vp(d[$])||Ca(d[$]));if(!o){if(y==="schema"){let $=a.length>0?P(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(O=>{O.write('if (k === "__proto__") continue;'),$&&O.write(`if (${$}.has(k)) continue;`);let C=S(t);O.write(`const ${C} = ${r}[k];`),G(O,t,g,C,!1)}),e.write("}")}return null}if(k){e.write(`const ${b} = {};`);for(let $ of l){let O=f($),C=m.get($);Ca(d[$])?e.write(`if (${O} in ${r}) ${b}[${O}] = ${C};`):Vp(d[$])?e.write(`if (${C} !== undefined || ${O} in ${r}) ${b}[${O}] = ${C};`):e.write(`${b}[${O}] = ${C};`)}}else{let $=l.map(O=>`${p(O)}: ${m.get(O)}`).join(", ");e.write(`const ${b} = { ${$} };`)}if(y!=="none"){let $=a.length>0?P(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(O=>{if(O.write('if (k === "__proto__") continue;'),$&&O.write(`if (${$}.has(k)) continue;`),y==="passthrough")O.write(`${b}[k] = ${r}[k];`);else{let C=S(t);O.write(`const ${C} = ${r}[k];`);let j=G(O,t,g,C);O.write(`${b}[k] = ${j};`)}}),e.write("}")}return b}s(aw,"generateObjectCheck");function uw(e,t,n,r,o=!0){let i=n._zod.def;if(lw(n))return M(e,t,i.innerType,r,o);if(i.innerType._zod.optin==="defaulted"){let a=S(t),u=S(t);return e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(l=>{l.write(`const ${u} = (() => {`),l.indented(f=>{let p=M(f,t,i.innerType,r);f.write(`return ${p};`)}),l.write("})();"),l.write(`if (${u} !== INVALID) ${a} = ${u};`)}),e.write("} else {"),e.indented(l=>{let f=M(l,t,i.innerType,r);l.write(`${a} = ${f};`)}),e.write("}"),a}let c=o?S(t):null;return c&&e.write(`let ${c};`),e.write(`if (${r} !== undefined) {`),e.indented(a=>{let u=M(a,t,i.innerType,r,o);c&&u!==null&&a.write(`${c} = ${u};`)}),e.write("}"),c}s(uw,"generateOptionalCheck");function lw(e){return e._zod.traits?.has("$ZodExactOptional")===!0}s(lw,"isExactOptional");function fw(e){return e._zod.optin===void 0&&ot(e)}s(fw,"requiresPresenceCheck");function ot(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?ot(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?ot(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(ot):!0;case"intersection":return!t.left||!t.right?!0:ot(t.left)&&ot(t.right);case"pipe":return t.in?ot(t.in):!0;default:return!0}}s(ot,"fastPathAcceptsAbsence");function Ca(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}s(Ca,"dropsWhenAbsent");function Vp(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Dt(e)}s(Vp,"mayOmitUndefined");function Dt(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?Dt(t.innerType):!0;case"union":return t.options?t.options.some(Dt):!0;case"intersection":return!t.left||!t.right||Dt(t.left)||Dt(t.right);case"pipe":return t.out?Dt(t.out):!0;default:return!0}}s(Dt,"mayOutputUndefined");function pw(e,t,n,r,o=!0){let i=n._zod.def,c=o?S(t):null;return c&&e.write(`let ${c} = null;`),e.write(`if (${r} !== null) {`),e.indented(a=>{let u=M(a,t,i.innerType,r,o);c&&u!==null&&a.write(`${c} = ${u};`)}),e.write("}"),c}s(pw,"generateNullableCheck");function Za(e,t,n){for(let[r,o]of Pt(t._zod.def.checks))e.write(`if (${n} > ${Re(r,o._zod.def.check)}) return INVALID;`)}s(Za,"generateSizeGate");function dw(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (!Array.isArray(${r})) return INVALID;`),Za(e,n,`${r}.length`);let c=o?S(t):null,a=S(t),u=S(t);return c&&e.write(`const ${c} = new Array(${r}.length);`),e.write(`for (let ${a} = 0; ${a} < ${r}.length; ${a}++) {`),e.indented(l=>{l.write(`const ${u} = ${r}[${a}];`);let f=G(l,t,i.element,u,o);c&&f!==null&&l.write(`${c}[${a}] = ${f};`)}),e.write("}"),c}s(dw,"generateArrayCheck");function mw(e,t,n,r){let i=n._zod.def.values;if(i.length!==1){let a=P(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}let c=i[0];if(typeof c=="number"&&Number.isNaN(c)){let a=P(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}if(typeof c=="string")e.write(`if (${r} !== ${Y(c)}) return INVALID;`);else if(typeof c=="number"||typeof c=="boolean")e.write(`if (${r} !== ${c}) return INVALID;`);else if(c===null)e.write(`if (${r} !== null) return INVALID;`);else if(c===void 0)e.write(`if (${r} !== undefined) return INVALID;`);else if(typeof c=="bigint")e.write(`if (${r} !== ${c}n) return INVALID;`);else throw new A(`literal type ${typeof c}`);return r}s(mw,"generateLiteralCheck");function hw(e,t,n,r){let o=n._zod.values;if(!o)throw new A("enum schema without enumerated values");let i=P(t,o);return e.write(`if (!${i}.has(${r})) return INVALID;`),r}s(hw,"generateEnumCheck");function Kp(e,t,n,r){let o=n._zod.def;return M(e,t,o.innerType,r)}s(Kp,"generateWrapperCheck");function gw(e,t,n,r){let o=n._zod.def,c=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!c)return M(e,t,o.innerType,r);let u=P(t,c),l=S(t);return e.write(`let ${l} = ${r};`),e.write(`if (${r} === undefined) ${l} = ${u}();`),M(e,t,o.innerType,l)}let a=S(t);if(c){let u=P(t,c),l=P(t,_n);e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(f=>{f.write(`${a} = ${l}(${u}());`)}),e.write("} else {"),e.indented(f=>{let p=M(f,t,o.innerType,r);f.write(`${a} = ${p} === undefined ? ${l}(${u}()) : ${p};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${r} !== undefined) {`),e.indented(u=>{let l=M(u,t,o.innerType,r);u.write(`${a} = ${l};`)}),e.write("}");return a}s(gw,"generateDefaultCheck");function _w(e,t,n,r){let o=n._zod.def,i=M(e,t,o.innerType,r),c=S(t);return e.write(`const ${c} = ${i};`),e.write(`if (${c} === undefined) return INVALID;`),c}s(_w,"generateNonOptionalCheck");function yw(e,t,n,r){let o=n._zod.def,i=o.items,c=o.rest;e.write(`if (!Array.isArray(${r})) return INVALID;`);let a=Hp(i,"optin"),u=Hp(i,"optout");c?e.write(`if (${r}.length < ${a}) return INVALID;`):e.write(`if (${r}.length < ${a} || ${r}.length > ${i.length}) return INVALID;`);let l=S(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} < ${r}.length) {`),d.indented(m=>{let g=S(t);m.write(`const ${g} = ${r}[${f}];`);let y=G(m,t,p,g);m.write(`${l}[${f}] = ${y};`)}),d.write("} else {"),d.indented(m=>{if(Ca(p)){m.write(`${l}.length = ${f};`);return}let g=S(t),y=S(t);m.write(`const ${g} = undefined;`),m.write(`const ${y} = (() => {`),m.indented(b=>{let k=G(b,t,p,g);b.write(`return ${k};`)}),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=S(t);e.write(`const ${d} = ${r}[${f}];`);let m=G(e,t,p,d);e.write(`${l}[${f}] = ${m};`)}}if(c){let f=S(t),p=S(t);e.write(`for (let ${f} = ${i.length}; ${f} < ${r}.length; ${f}++) {`),e.indented(d=>{d.write(`const ${p} = ${r}[${f}];`);let m=G(d,t,c,p);d.write(`${l}[${f}] = ${m};`)}),e.write("}")}return l}s(yw,"generateTupleCheck");function Hp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}s(Hp,"getTupleOptStart");function ww(e,t,n,r){let o=n._zod.def,i=o.options;if(o.discriminator)return bw(e,t,o,r);if(o.inclusive===!1)throw new A("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),r;if(i.length===1)return M(e,t,i[0],r);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=P(t,u);return e.write(`if (!${l}.has(${r})) return INVALID;`),r}let a=S(t);e.write(`let ${a};`);for(let u=0;u<i.length;u++){let l=i[u];u===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(f=>{let p=M(f,t,l,r);f.write(`return ${p};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}s(ww,"generateUnionCheck");function bw(e,t,n,r){if(n.unionFallback)throw new A("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),r;let o=S(t),i=S(t);e.write(`const ${o} = ${r}?.[${Y(n.discriminator)}];`),e.write(`let ${i};`);let c=!0,a=new Set;for(let u of n.options){let l=u._zod.propValues?.[n.discriminator];if(!l||l.size===0)throw new A("discriminated union option without static discriminator values");for(let d of l){if(a.has(d))throw new A(`duplicate discriminator value ${String(d)}`);a.add(d)}let f=Array.from(l,d=>vw(t,o,d)),p=c?"if":"else if";e.write(`${p} (${f.join(" || ")}) {`),e.indented(d=>{let m=M(d,t,u,r);d.write(`${i} = ${m};`)}),e.write("}"),c=!1}return e.write("else { return INVALID; }"),i}s(bw,"generateDiscriminatedUnionCheck");function vw(e,t,n){if(typeof n=="string")return`${t} === ${Y(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){let r=P(e,n);return`${t} === ${r}`}throw new A(`literal discriminator value ${String(n)}`)}s(vw,"literalEquality");function $w(e,t,n,r){let o=n._zod.def;t.definite=!1;let i=G(e,t,o.left,r),c=G(e,t,o.right,r),a=P(t,Ct),u=S(t);return e.write(`const ${u} = ${a}(${i}, ${c});`),e.write(`if (!${u}.valid) return INVALID;`),`${u}.data`}s($w,"generateIntersectionCheck");function xw(e,t,n,r){let o=n._zod.def,i=P(t,de);e.write(`if (!${i}(${r})) return INVALID;`);let c=S(t),a=S(t),u=S(t);e.write(`const ${c} = {};`);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 A(`record key value ${String(y)}`);let b=typeof y=="number"?y.toString():y;if(b==="__proto__")throw new A('record key "__proto__"');m.push(b);let k=P(t,y),$=M(e,t,o.keyType,k),O=S(t);e.write(`const ${O} = ${r}[${kw(t,b)}];`);let C=G(e,t,o.valueType,O);e.write(`${c}[${$}] = ${C};`)}let g=P(t,new Set(m));return e.write(`for (const ${a} in ${r}) {`),e.indented(y=>{y.write(`if (${g}.has(${a})) continue;`),l.mode==="loose"?y.write(`if (${a} !== "__proto__") ${c}[${a}] = ${r}[${a}];`):y.write("return INVALID;")}),e.write("}"),c}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=bo(o.keyType);g.definite===!1&&(t.definite=!1);let y=P(t,g),b=P(t,Ee),k=S(t);return Bp(e,t,r,a,$=>{$.write(`let ${k} = ${y}(${a});`),$.write(`if (${k} === INVALID && typeof ${a} === "string" && ${b}.test(${a})) ${k} = ${y}(Number(${a}));`),m?$.write(`if (${k} === INVALID) { ${c}[${a}] = ${r}[${a}]; continue; }`):$.write(`if (${k} === INVALID) return INVALID;`),$.write(`if (${k} === "__proto__") continue;`);let O=S(t);$.write(`const ${O} = ${r}[${a}];`);let C=G($,t,o.valueType,O);$.write(`${c}[${k}] = ${C};`)}),c}return Bp(e,t,r,a,m=>{m.write(`const ${u} = ${r}[${a}];`);let g=G(m,t,o.valueType,u);m.write(`${c}[${a}] = ${g};`)},"return INVALID;"),c}s(xw,"generateRecordCheck");function Bp(e,t,n,r,o,i){let c=P(t,Object.prototype.propertyIsEnumerable),a=S(t),u=S(t),l=S(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${u} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${l} = 0; ${l} < ${u}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${r} = ${u}[${l}];`),f.write(`if (${r} === "__proto__" || !${c}.call(${n}, ${r})) continue;`),o(f)}),e.write("}"),e.write(`for (let ${l} = 0; ${l} < ${a}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${r} = ${a}[${l}];`),f.write(`if (!${c}.call(${n}, ${r})) continue;`),i?f.write(i):o(f)}),e.write("}")}s(Bp,"emitOwnKeys");function kw(e,t){return typeof t=="string"?Y(t):P(e,t)}s(kw,"literalPropertyKey");function Sw(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Map)) return INVALID;`),Za(e,n,`${r}.size`);let i=S(t),c=S(t),a=S(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${c}, ${a}] of ${r}) {`),e.indented(u=>{let l=M(u,t,o.keyType,c),f=M(u,t,o.valueType,a);u.write(`${i}.set(${l}, ${f});`)}),e.write("}"),i}s(Sw,"generateMapCheck");function Pw(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Set)) return INVALID;`),Za(e,n,`${r}.size`);let i=S(t),c=S(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${c} of ${r}) {`),e.indented(a=>{let u=M(a,t,o.valueType,c);a.write(`${i}.add(${u});`)}),e.write("}"),i}s(Pw,"generateSetCheck");function zw(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}s(zw,"generateFileCheck");function Ow(e,t,n,r){e.write(`if (typeof ${r} !== "string") return INVALID;`);let o=n._zod.pattern;if(o){let i=P(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${r})) return INVALID;`)}return r}s(Ow,"generateTemplateLiteralCheck");function Ew(e,t,n,r){let o=n._zod.def,i=it(t,o.getter),c=P(t,{parser:null});e.write(`if (!${c}.parser) {`),e.indented(u=>{u.write(`const inner = ${i}();`),u.write(`${c}.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 a=S(t);return e.write(`const ${a} = ${c}.parser(${r});`),e.write(`if (${a} === INVALID) return INVALID;`),a}s(Ew,"generateLazyCheck");function Iw(e,t,n,r){let o=n._zod.def,i=M(e,t,o.in,r);if(o.transform){if(st(o.transform))throw new _e("z.compile: async transforms in pipes are not supported");let c=o.transform,u=it(t,s(f=>{let p={value:f,issues:[],addIssue:Da},d=c(f,p);return d instanceof Promise?ee:p.issues.length===0?d:ee},"helperFn")),l=S(t);return e.write(`const ${l} = ${u}(${i});`),e.write(`if (${l} === INVALID) return INVALID;`),M(e,t,o.out,l)}else return M(e,t,o.out,i)}s(Iw,"generatePipeCheck");function st(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}s(st,"isAsyncFunction");function Aw(e,t,n,r){let o=n._zod.def;if(o.fn){if(st(o.fn))throw new _e("z.compile: async custom predicates are not supported");let i=it(t,o.fn),c=P(t,Na),a=S(t);e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${c}();`),e.write(`if (!${a}) return INVALID;`)}else throw new A("custom schema without a predicate function");return r}s(Aw,"generateCustomCheck");function Nw(e,t,n){let r=e._zod.run({value:n,issues:[]},{});if(r&&typeof r.then=="function")return ee;let o=r;return o.issues.length===0?o.value:t()}s(Nw,"runtimeCatch");function Cw(e,t,n,r){let o=n._zod.def;if(!o.catchValue[zr])throw new A("catch with a callback (only a constant catch value compiles)",!1);let i=S(t);e.write(`let ${i} = (() => {`),e.indented(l=>{let f=G(l,t,o.innerType,r);l.write(`return ${f};`)}),e.write("})();");let c=P(t,o.innerType),a=it(t,o.catchValue),u=P(t,Nw);return e.write(`if (${i} === INVALID) {`),e.indented(l=>{l.write(`${i} = ${u}(${c}, ${a}, ${r});`),l.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}s(Cw,"generateCatchCheck");function Tw(e,t,n,r){let o=n._zod.def;if(o.transform){if(st(o.transform))throw new _e("z.compile: async transforms are not supported");let i=o.transform,a=it(t,s(l=>{let f={value:l,issues:[],addIssue:Da},p=i(l,f);return p instanceof Promise?ee:f.issues.length===0?p:ee},"helperFn")),u=S(t);return e.write(`const ${u} = ${a}(${r});`),e.write(`if (${u} === INVALID) return INVALID;`),u}return r}s(Tw,"generateTransformCheck");function vo(e){return e.checks&&(e.checks=[...e.checks]),e}s(vo,"snapshotChecks");function La(e,t){return new e(vo({type:"string",...w(t)}))}s(La,"_string");function Ra(e,t){return new e(vo({type:"string",coerce:!0,...w(t)}))}s(Ra,"_coercedString");function $o(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}s($o,"_email");function xo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}s(xo,"_guid");function ko(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}s(ko,"_uuid");function So(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}s(So,"_uuidv4");function Po(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}s(Po,"_uuidv6");function zo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}s(zo,"_uuidv7");function Jn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}s(Jn,"_url");function Oo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}s(Oo,"_emoji");function Eo(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}s(Eo,"_nanoid");function Io(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}s(Io,"_cuid");function Ao(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}s(Ao,"_cuid2");function No(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}s(No,"_ulid");function Co(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}s(Co,"_xid");function To(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}s(To,"_ksuid");function Do(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}s(Do,"_ipv4");function Zo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}s(Zo,"_ipv6");function ja(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...w(t)})}s(ja,"_mac");function Lo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}s(Lo,"_cidrv4");function Ro(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}s(Ro,"_cidrv6");function jo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}s(jo,"_base64");function Mo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}s(Mo,"_base64url");function Fo(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}s(Fo,"_e164");function Ma(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...w(t)})}s(Ma,"_creditCard");function Fa(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...w(t)})}s(Fa,"_iban");function Uo(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}s(Uo,"_jwt");var Ua={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Wn(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}s(Wn,"_isoDateTime");function Xn(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}s(Xn,"_isoDate");function qn(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}s(qn,"_isoTime");function Gn(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}s(Gn,"_isoDuration");function Va(e,t){return new e(vo({type:"number",checks:[],...w(t)}))}s(Va,"_number");function Ka(e,t){return new e(vo({type:"number",coerce:!0,checks:[],...w(t)}))}s(Ka,"_coercedNumber");function Ha(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}s(Ha,"_int");function Ba(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...w(t)})}s(Ba,"_float32");function Ja(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...w(t)})}s(Ja,"_float64");function Wa(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...w(t)})}s(Wa,"_int32");function Xa(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...w(t)})}s(Xa,"_uint32");function qa(e,t){return new e({type:"boolean",...w(t)})}s(qa,"_boolean");function Ga(e,t){return new e({type:"boolean",coerce:!0,...w(t)})}s(Ga,"_coercedBoolean");function Ya(e,t){return new e({type:"bigint",...w(t)})}s(Ya,"_bigint");function Qa(e,t){return new e({type:"bigint",coerce:!0,...w(t)})}s(Qa,"_coercedBigint");function eu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...w(t)})}s(eu,"_int64");function tu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...w(t)})}s(tu,"_uint64");function nu(e,t){return new e({type:"symbol",...w(t)})}s(nu,"_symbol");function ru(e,t){return new e({type:"undefined",...w(t)})}s(ru,"_undefined");function ou(e,t){return new e({type:"null",...w(t)})}s(ou,"_null");function iu(e){return new e({type:"any"})}s(iu,"_any");function su(e){return new e({type:"unknown"})}s(su,"_unknown");function cu(e,t){return new e({type:"never",...w(t)})}s(cu,"_never");function au(e,t){return new e({type:"void",...w(t)})}s(au,"_void");function uu(e,t){return new e({type:"date",...w(t)})}s(uu,"_date");function lu(e,t){return new e({type:"date",coerce:!0,...w(t)})}s(lu,"_coercedDate");function fu(e,t){return new e({type:"nan",...w(t)})}s(fu,"_nan");function we(e,t){return new Vr({check:"less_than",...w(t),value:e,inclusive:!1})}s(we,"_lt");function fe(e,t){return new Vr({check:"less_than",...w(t),value:e,inclusive:!0})}s(fe,"_lte");function be(e,t){return new Kr({check:"greater_than",...w(t),value:e,inclusive:!1})}s(be,"_gt");function pe(e,t){return new Kr({check:"greater_than",...w(t),value:e,inclusive:!0})}s(pe,"_gte");function Vo(e){return be(0,e)}s(Vo,"_positive");function Ko(e){return we(0,e)}s(Ko,"_negative");function Ho(e){return fe(0,e)}s(Ho,"_nonpositive");function Bo(e){return pe(0,e)}s(Bo,"_nonnegative");function je(e,t){return new Js({check:"multiple_of",...w(t),value:e})}s(je,"_multipleOf");function Me(e,t){return new qs({check:"max_size",...w(t),maximum:e})}s(Me,"_maxSize");function ve(e,t){return new Gs({check:"min_size",...w(t),minimum:e})}s(ve,"_minSize");function ct(e,t){return new Ys({check:"size_equals",...w(t),size:e})}s(ct,"_size");function at(e,t){return new Qs({check:"max_length",...w(t),maximum:e})}s(at,"_maxLength");function Ie(e,t){return new ec({check:"min_length",...w(t),minimum:e})}s(Ie,"_minLength");function ut(e,t){return new tc({check:"length_equals",...w(t),length:e})}s(ut,"_length");function Zt(e,t){return new nc({check:"string_format",format:"regex",...w(t),pattern:e})}s(Zt,"_regex");function Lt(e){return new rc({check:"string_format",format:"lowercase",...w(e)})}s(Lt,"_lowercase");function Rt(e){return new oc({check:"string_format",format:"uppercase",...w(e)})}s(Rt,"_uppercase");function jt(e,t){return new ic({check:"string_format",format:"includes",...w(t),includes:e})}s(jt,"_includes");function Mt(e,t){return new sc({check:"string_format",format:"starts_with",...w(t),prefix:e})}s(Mt,"_startsWith");function Ft(e,t){return new cc({check:"string_format",format:"ends_with",...w(t),suffix:e})}s(Ft,"_endsWith");function Jo(e,t,n){return new ac({check:"property",property:e,schema:t,...w(n)})}s(Jo,"_property");function Ut(e,t){return new uc({check:"properties",shape:e,...w(t)})}s(Ut,"_properties");function Vt(e,t){return new lc({check:"mime_type",mime:e,...w(t)})}s(Vt,"_mime");function ye(e){return new fc({check:"overwrite",tx:e})}s(ye,"_overwrite");function Kt(e){return ye(t=>t.normalize(e))}s(Kt,"_normalize");function Ht(){return ye(e=>e.trim())}s(Ht,"_trim");function Bt(){return ye(e=>e.toLowerCase())}s(Bt,"_toLowerCase");function Jt(){return ye(e=>e.toUpperCase())}s(Jt,"_toUpperCase");function Wt(){return ye(e=>Wi(e))}s(Wt,"_slugify");function pu(e,t,n){return new e({type:"array",element:t,...w(n)})}s(pu,"_array");function Dw(e,t,n){return new e({type:"union",options:t,...w(n)})}s(Dw,"_union");function Zw(e,t,n){return new e({type:"union",options:t,inclusive:!1,...w(n)})}s(Zw,"_xor");function Lw(e,t,n,r){return new e({type:"union",options:n,discriminator:t,...w(r)})}s(Lw,"_discriminatedUnion");function Rw(e,t,n){return new e({type:"intersection",left:t,right:n})}s(Rw,"_intersection");function jw(e,t,n,r){let o=n instanceof z,i=o?r:n,c=o?n:null;return new e({type:"tuple",items:t,rest:c,...w(i)})}s(jw,"_tuple");function Mw(e,t,n,r){return new e({type:"record",keyType:t,valueType:n,...w(r)})}s(Mw,"_record");function Fw(e,t,n,r){return new e({type:"map",keyType:t,valueType:n,...w(r)})}s(Fw,"_map");function Uw(e,t,n){return new e({type:"set",valueType:t,...w(n)})}s(Uw,"_set");function Vw(e,t,n){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:r,...w(n)})}s(Vw,"_enum");function Kw(e,t,n){return new e({type:"enum",entries:t,...w(n)})}s(Kw,"_nativeEnum");function Hw(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],...w(n)})}s(Hw,"_literal");function du(e,t){return new e({type:"file",...w(t)})}s(du,"_file");function Bw(e,t){return new e({type:"transform",transform:t})}s(Bw,"_transform");function Jw(e,t){return new e({type:"optional",innerType:t})}s(Jw,"_optional");function Ww(e,t){return new e({type:"nullable",innerType:t})}s(Ww,"_nullable");function Xw(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():_n(n)}})}s(Xw,"_default");function qw(e,t,n){return new e({type:"nonoptional",innerType:t,...w(n)})}s(qw,"_nonoptional");function Gw(e,t){return new e({type:"success",innerType:t})}s(Gw,"_success");function Yw(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:ts(n)})}s(Yw,"_catch");function Qw(e,t,n){return new e({type:"pipe",in:t,out:n})}s(Qw,"_pipe");function eb(e,t){return new e({type:"readonly",innerType:t})}s(eb,"_readonly");function tb(e,t,n){return new e({type:"template_literal",parts:t,...w(n)})}s(tb,"_templateLiteral");function nb(e,t){return new e({type:"lazy",getter:t})}s(nb,"_lazy");function rb(e,t){return new e({type:"promise",innerType:t})}s(rb,"_promise");function mu(e,t,n){let r=w(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}s(mu,"_custom");function hu(e,t,n){return new e({type:"custom",check:"custom",fn:t,...w(n)})}s(hu,"_refine");function gu(e,t){let n=qp(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(zt(o,r.value,n._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(zt(i))}},e(r.value,r)),t);return n}s(gu,"_superRefine");function qp(e,t){let n=new R({check:"custom",...w(t)});return n._zod.check=e,n}s(qp,"_check");function _u(e){let t=new R({check:"describe"});return t._zod.onattach=[n=>{let r=W.get(n)??{};W.add(n,{...r,description:e})}],t._zod.check=()=>{},t}s(_u,"describe");function yu(e){let t=new R({check:"meta"});return t._zod.onattach=[n=>{let r=W.get(n)??{};W.add(n,{...r,...e})}],t._zod.check=()=>{},t}s(yu,"meta");function wu(e,t){let n=w(t),r=n.truthy??["true","1","yes","on","y","enabled"],o=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(r=r.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(r),c=new Set(o),a=e.Codec??Mn,u=e.Boolean??Rn,l=e.String??rt,f=new l({type:"string",error:n.error}),p=new u({type:"boolean",error:n.error}),d=new a({type:"pipe",in:f,out:p,transform:s(((m,g)=>{let y=m;return n.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:c.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...c],input:g.value,inst:d,continue:!1}),{})}),"transform"),reverseTransform:s(((m,g)=>m===!0?r[0]||"true":o[0]||"false"),"reverseTransform"),error:n.error});return d._zod.bag.truthy=r,d._zod.bag.falsy=o,d._zod.bag.case=n.case??"insensitive",d}s(wu,"_stringbool");function lt(e,t,n,r={}){let o=w(r),i={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...o};return n instanceof RegExp&&(i.pattern=n),new e(i)}s(lt,"_stringFormat");function Yn(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&J(e,r,n[r]);return e}s(Yn,"assignProps");function Fe(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??W,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}}s(Fe,"initializeContext");function V(e,t,n,r,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(n,i),!0}s(V,"handleUnrepresentable");function Z(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;let c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)c.schema=a;else{let f={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,f);else{let d=c.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&&(c.ref||(c.ref=p),Z(p,t,f),t.seen.get(p).isParent=!0)}let u=t.metadataRegistry.get(e);return u&&Yn(c.schema,u),t.io==="input"&&te(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&"_prefault"in c.schema&&((r=c.schema).default??(r.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}s(Z,"processSchema");function Gp(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}s(Gp,"encodeJSONPointerSegment");function Ue(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let c of e.seen.entries()){let a=e.metadataRegistry.get(c[0])?.id;if(a){let u=r.get(a);if(u&&u!==c[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,c[0])}}let o=s(c=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(c[0])?.id,d=e.external.uri??(g=>g);if(p)return{ref:d(p)};let m=c[1].defId??c[1].schema.id??`schema${e.counter++}`;return c[1].defId=m,{defId:m,ref:`${d("__shared")}#/${a}/${Gp(m)}`}}let u="#",l=`${u}/${a}/`;if(c[1]===n&&!c[1].schema.id)return{ref:u};let f=c[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:l+Gp(f)}},"makeURI"),i=s(c=>{if(c[1].schema.$ref)return;let a=c[1],{ref:u,defId:l}=o(c);a.def={...a.schema},l&&(a.defId=l);let f=a.schema;for(let p in f)delete f[p];f.$ref=u},"extractToDef");if(e.cycles==="throw")for(let c of e.seen.entries()){let a=c[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
67
67
 
68
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of e.seen.entries()){let a=c[1];if(t===c[0]){i(c);continue}if(e.external){let l=e.external.registry.get(c[0])?.id;if(t!==c[0]&&l){i(c);continue}}if(e.metadataRegistry.get(c[0])?.id){i(c);continue}if(a.cycle){i(c);continue}a.count>1&&e.reused==="ref"&&i(c)}e.external&&(e.sharedDefsExtractedFor=e.external)}s(Fe,"extractDefs");function Bp(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!="object")return;Bp(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let c of Array.isArray(i)?i:[i]){if(typeof c!="string")return;n.includes(c)||n.push(c)}}delete e.anyOf,e.type=n.length===1?n[0]:n}s(Bp,"compactTypeUnion");var Jp=new Set(["type","properties","required","additionalProperties"]),Kp=["oneOf","anyOf"];function Hp(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}s(Hp,"undeclaredConstraint");function pu(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let c in i)if(!Jp.has(c))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let c in i.properties){if(Object.prototype.hasOwnProperty.call(n,c))continue;let a=[];for(let l of t){let f=l.properties?.[c]??Hp(l);f!=null&&(a.some(p=>JSON.stringify(p)===JSON.stringify(f))||a.push(f))}let u=a.length===1?a[0]:pu(a)??{allOf:a};J(n,c,u)}for(let c of i.required??[])r.add(c)}let o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let c of t){let a=Hp(c);a&&!i.some(u=>JSON.stringify(u)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}s(pu,"foldObjects");function Bw(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Jp)if(o in e)return;let n=t.filter(o=>Kp.some(i=>Array.isArray(o[i]))),r=null;if(!n.length)r=pu(t);else{let o=n[0],i=Kp.find(u=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let c=t.filter(u=>u!==o),a=o[i].map(u=>pu([...c,u]));if(a.some(u=>!u))return;r={[i]:a}}r&&(delete e.allOf,Jn(e,r))}s(Bw,"foldIntersection");function Ve(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=s(a=>{let u=e.seen.get(a);if(u.ref===null)return;let l=u.def??u.schema,f={...l},p=u.ref;if(u.ref=null,p){r(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)):Jn(l,g),Jn(l,f),a._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=a._zod.parent;if(d&&d!==p){r(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:a,jsonSchema:l,path:u.path??[]})},"flattenRef");if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Bp(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=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=a.get(f);p?p.push(l):a.set(f,[l])}for(let u of e.intersections)for(let l of a.get(u)??[])Bw(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 a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Jn(o,n.defId?n.schema:n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let c=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let u=a[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,J(c,u.defId,u.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?o.$defs=c:o.definitions=c);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Bt(t,"input",e.processors),output:Bt(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}s(Ve,"finalize");function ee(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return ee(r.element,n);if(r.type==="set")return ee(r.valueType,n);if(r.type==="lazy")return ee(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return ee(r.innerType,n);if(r.type==="intersection")return ee(r.left,n)||ee(r.right,n);if(r.type==="record"||r.type==="map")return ee(r.keyType,n)||ee(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ee(r.in,n)||ee(r.out,n);if(r.type==="object"){for(let o in r.shape)if(ee(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(ee(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(ee(o,n))return!0;return!!(r.rest&&ee(r.rest,n))}return!1}s(ee,"isTransforming");var du=s((e,t={})=>n=>{let r=Me({...n,processors:t});return D(e,r),Fe(r,e),Ve(r,e)},"createToJSONSchemaMethod"),Bt=s((e,t,n={})=>r=>{let{libraryOptions:o,target:i}=r??{},c=Me({...o??{},target:i,io:t,processors:n});return D(e,c),Fe(c,e),Ve(c,e)},"createStandardJSONSchemaMethod");var Jt=s((e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},"narrowMin"),Wt=s((e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},"narrowMax"),Wp=s((e,t)=>{Jt(e,"minimum",t),Wt(e,"maximum",t)},"narrowBoth"),Yp=s((e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},"addDivisor"),Qp=s((e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},"addPattern"),ed=s((e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},"intersectMime"),td=s((e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},"setFormat"),qp=s((e,t)=>Jt(e,"minimum",t.minimum),"minContributor"),Gp=s((e,t)=>Wt(e,"maximum",t.maximum),"maxContributor"),Xp=s(e=>(t,n)=>{td(t,n.format);let[r,o]=e[n.format];Jt(t,"minimum",r),Wt(t,"maximum",o)},"formatContributor"),Jw={greater_than:s((e,t)=>Jt(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),"greater_than"),less_than:s((e,t)=>Wt(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),"less_than"),multiple_of:s((e,t)=>Yp(e,t.value),"multiple_of"),number_format:Xp(mn),bigint_format:Xp(hn),min_length:qp,max_length:Gp,length_equals:s((e,t)=>Wp(e,t.length),"length_equals"),min_size:qp,max_size:Gp,size_equals:s((e,t)=>Wp(e,t.size),"size_equals"),string_format:s((e,t)=>{td(e,t.format),t.pattern&&Qp(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)=>ed(e,t.mime),"mime_type")};function K(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)Jw[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Jt(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Jt(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Wt(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Wt(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Yp(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&ed(t,o.mime);for(let i of o.patterns??[])Qp(t,i);return t}s(K,"aggregateChecks");var Ww={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},qw=new Map([[Jr,ws],[Nn,bs]]),nd=s(e=>qw.get(e)??e,"exactPattern"),gu=s((e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:c,format:a,patterns:u,contentEncoding:l,laxFormat:f}=K(e);if(typeof i=="number"&&(o.minLength=i),typeof c=="number"&&(o.maxLength=c),a&&(o.format=Ww[a]??a,o.format===""&&delete o.format,(a==="time"||f)&&delete o.format),l&&(o.contentEncoding=l),u&&u.size>0){let p=[...u].map(nd);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"),_u=s((e,t,n,r)=>{let o=n,{minimum:i,maximum:c,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:l,isInt:f}=K(e);o.type=f?"integer":"number";let p=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),d=typeof u=="number"&&u<=(c??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 c=="number"&&(o.maximum=c),a){let g=new Set;for(let k of a)Number.isFinite(k)&&k!==0?g.add(Math.abs(k)):U(e,t,o,r,`A multipleOf divisor of ${k} cannot be represented in JSON Schema`);let[y,...b]=g;y!==void 0&&(o.multipleOf=y),b.length&&(o.allOf=[...o.allOf??[],...b.map(k=>({multipleOf:k}))])}},"numberProcessor"),yu=s((e,t,n,r)=>{n.type="boolean"},"booleanProcessor"),wu=s((e,t,n,r)=>{U(e,t,n,r,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),bu=s((e,t,n,r)=>{U(e,t,n,r,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),vu=s((e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},"nullProcessor"),$u=s((e,t,n,r)=>{U(e,t,n,r,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),xu=s((e,t,n,r)=>{U(e,t,n,r,"Void cannot be represented in JSON Schema")},"voidProcessor"),ku=s((e,t,n,r)=>{n.not={}},"neverProcessor"),Su=s((e,t,n,r)=>{},"anyProcessor"),Pu=s((e,t,n,r)=>{},"unknownProcessor"),zu=s((e,t,n,r)=>{U(e,t,n,r,"Date cannot be represented in JSON Schema")},"dateProcessor"),Ou=s((e,t,n,r)=>{let o=e._zod.def,i=wt(o.entries);if(i.length===0){n.not={};return}i.every(c=>typeof c=="number")&&(n.type="number"),i.every(c=>typeof c=="string")&&(n.type="string"),n.enum=i},"enumProcessor"),Iu=s((e,t,n,r)=>{let o=e._zod.def;if(o.values.length===0){n.not={};return}let i=[];for(let c of o.values)if(c===void 0){if(U(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof c=="bigint"){if(U(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(c))}else i.push(c);if(i.length!==0)if(i.length===1){let c=i[0];n.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[c]:n.const=c}else i.every(c=>typeof c=="number")&&(n.type="number"),i.every(c=>typeof c=="string")&&(n.type="string"),i.every(c=>typeof c=="boolean")&&(n.type="boolean"),i.every(c=>c===null)&&(n.type="null"),n.enum=i},"literalProcessor"),Eu=s((e,t,n,r)=>{U(e,t,n,r,"NaN cannot be represented in JSON Schema")},"nanProcessor"),Au=s((e,t,n,r)=>{let o=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},"templateLiteralProcessor"),Nu=s((e,t,n,r)=>{let o=n;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:c,mime:a}=K(e);i!==void 0&&(o.minLength=i),c!==void 0&&(o.maxLength=c),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(u=>({contentMediaType:u})))},"fileProcessor"),Cu=s((e,t,n,r)=>{n.type="boolean"},"successProcessor"),Tu=s((e,t,n,r)=>{U(e,t,n,r,"Custom types cannot be represented in JSON Schema")},"customProcessor"),Zu=s((e,t,n,r)=>{U(e,t,n,r,"Function types cannot be represented in JSON Schema")},"functionProcessor"),Du=s((e,t,n,r)=>{U(e,t,n,r,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),Ru=s((e,t,n,r)=>{U(e,t,n,r,"Map cannot be represented in JSON Schema")},"mapProcessor"),Lu=s((e,t,n,r)=>{U(e,t,n,r,"Set cannot be represented in JSON Schema")},"setProcessor"),ju=s((e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:c,maximum:a}=K(e);typeof c=="number"&&(o.minItems=c),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=D(i.element,t,{...r,path:[...r.path,"items"]})},"arrayProcessor");function Wn(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Wn(t.out):t.type==="catch"?Wn(t.innerType):e._zod.optin}s(Wn,"inputOptin");var Mu=s((e,t,n,r)=>{let o=n,i=e._zod.def,c=i.shape;if(Object.getOwnPropertySymbols(c).length&&U(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in c)J(o.properties,l,D(c[l],t,{...r,path:[...r.path,"properties",l]}));let u=[];for(let l of Object.keys(c)){let f=i.shape[l];(t.io==="input"?Wn(f)===void 0:f._zod.optout===void 0)&&u.push(l)}u.length>0&&(o.required=u),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=D(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},"objectProcessor"),Vo=s((e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,c=o.options.map((a,u)=>D(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",u]}));i?n.oneOf=c:n.anyOf=c},"unionProcessor"),Fu=s((e,t,n,r)=>{let o=e._zod.def,i=D(o.left,t,{...r,path:[...r.path,"allOf",0]}),c=D(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=s(l=>"allOf"in l&&Object.keys(l).length===1,"isSimpleIntersection"),u=[...a(i)?i.allOf:[i],...a(c)?c.allOf:[c]];n.allOf=u,t.intersections.push(u)},"intersectionProcessor"),Vu=s((e,t,n,r)=>{let o=n,i=e._zod.def;o.type="array";let c=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=i.items.map((y,b)=>D(y,t,{...r,path:[...r.path,c,b]})),l=i.rest?D(i.rest,t,{...r,path:[...r.path,a,...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"?Wn(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}=K(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)},"tupleProcessor");function mu(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let g=e.get(t)?.def;if(!g)return t;let y=mu(e,g,n);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let b=y.map(k=>mu(e,k,n));b.some((k,$)=>k!==y[$])&&(t={...t,[g]:b})}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.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:c,maximum:a,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=(r.includes("number")?ze:Sn).source)),m}s(mu,"stringifyKeyNames");var hu=new WeakMap;function Gw(e){let t=new Map;for(let r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);let n=new Map;for(let r of hu.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let c=mu(t,i,new Set);c!==i&&n.set(i,c)}if(n.size)for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);i&&(o.propertyNames=i)}}s(Gw,"rewriteKeyNames");var Uu=s((e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let c=i.keyType,a=K(c).patterns;if(i.mode==="loose"&&a&&a.size>0){let f=D(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let p of a)J(o.patternProperties,nd(p).source,f)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let f=hu.get(t);f||(f=[],hu.set(t,f),t.deferred.push(()=>Gw(t))),f.push(e)}o.additionalProperties=D(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let u=c._zod.values,l=t.io==="input"&&Wn(i.valueType)!==void 0;if(u&&!i.partial&&!l){let f=[...u].filter(p=>typeof p=="string"||typeof p=="number");f.length>0&&(o.required=f.map(String))}},"recordProcessor"),Ku=s((e,t,n,r)=>{let o=e._zod.def,i=D(o.innerType,t,r),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},"nullableProcessor"),Hu=s((e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},"nonoptionalProcessor"),Bu=Symbol();function rd(e,t,n,r,o){let i=!1,c=JSON.stringify(e,(a,u)=>typeof u!="bigint"?u:(i=!0,null));return i?(U(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),Bu):JSON.parse(c)}s(rd,"serializeDefaultValue");var Ju=s((e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let c=rd(o.defaultValue,e,t,n,r);c!==Bu&&(n.default=c)},"defaultProcessor"),Wu=s((e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let c=rd(o.defaultValue,e,t,n,r);c!==Bu&&(n._prefault=c)},"prefaultProcessor"),qu=s((e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let c;try{c=o.catchValue(void 0)}catch{U(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=c},"catchProcessor"),Gu=s((e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),c=t.io==="input"?i?o.out:o.in:o.out;D(c,t,r);let a=t.seen.get(e);a.ref=c},"pipeProcessor"),Xu=s((e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},"readonlyProcessor"),Yu=s((e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},"promiseProcessor"),Uo=s((e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},"optionalProcessor"),Qu=s((e,t,n,r)=>{let o=e._zod.innerType;D(o,t,r);let i=t.seen.get(e);i.ref=o},"lazyProcessor"),Fo={string:gu,number:_u,boolean:yu,bigint:wu,symbol:bu,null:vu,undefined:$u,void:xu,never:ku,any:Su,unknown:Pu,date:zu,enum:Ou,literal:Iu,nan:Eu,template_literal:Au,file:Nu,success:Cu,custom:Tu,function:Zu,transform:Du,map:Ru,set:Lu,array:ju,object:Mu,union:Vo,intersection:Fu,tuple:Vu,record:Uu,nullable:Ku,nonoptional:Hu,default:Ju,prefault:Wu,catch:qu,pipe:Gu,readonly:Xu,promise:Yu,optional:Uo,lazy:Qu};function Ko(e,t){if("_idmap"in e){let r=e,o=Me({...t,processors:Fo}),i={};for(let u of r._idmap.entries()){let[l,f]=u;D(f,o)}let c={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(let u of r._idmap.entries()){let[l,f]=u;Fe(o,f),J(c,l,Ve(o,f))}if(Object.keys(i).length>0){let u=o.target==="draft-2020-12"?"$defs":"definitions";c.__shared={[u]:i}}return{schemas:c}}let n=Me({...t,processors:Fo});return D(e,n),Fe(n,e),Ve(n,e)}s(Ko,"toJSONSchema");var Ho=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 n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Me({processors:Fo,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return D(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Fe(this.ctx,t);let r=Ve(this.ctx,t),{"~standard":o,...i}=r;return i}};var od={};var nn={};ke(nn,{ZodAny:()=>vl,ZodArray:()=>Sl,ZodBase64:()=>li,ZodBase64URL:()=>fi,ZodBigInt:()=>en,ZodBigIntFormat:()=>mi,ZodBoolean:()=>Qt,ZodCIDRv4:()=>ai,ZodCIDRv6:()=>ui,ZodCUID:()=>ti,ZodCUID2:()=>ni,ZodCatch:()=>Bl,ZodCodec:()=>or,ZodCreditCard:()=>dl,ZodCustom:()=>ir,ZodCustomStringFormat:()=>ft,ZodDate:()=>Yn,ZodDefault:()=>Ml,ZodDiscriminatedUnion:()=>zl,ZodE164:()=>pi,ZodEmail:()=>Xo,ZodEmoji:()=>Qo,ZodEnum:()=>Gt,ZodExactOptional:()=>yi,ZodFile:()=>Dl,ZodFunction:()=>nf,ZodGUID:()=>Yo,ZodIBAN:()=>ml,ZodIPv4:()=>si,ZodIPv6:()=>ci,ZodISODate:()=>Ke,ZodISODateTime:()=>Ue,ZodISODuration:()=>Be,ZodISOTime:()=>He,ZodInstanceOf:()=>sf,ZodIntersection:()=>Ol,ZodJWT:()=>di,ZodKSUID:()=>ii,ZodLazy:()=>Ql,ZodLiteral:()=>Zl,ZodMAC:()=>pl,ZodMap:()=>Cl,ZodNaN:()=>Wl,ZodNanoID:()=>ei,ZodNever:()=>xl,ZodNonOptional:()=>wi,ZodNull:()=>wl,ZodNullable:()=>jl,ZodNumber:()=>Yt,ZodNumberFormat:()=>pt,ZodObject:()=>er,ZodOptional:()=>nr,ZodPipe:()=>rr,ZodPrefault:()=>Vl,ZodPreprocess:()=>ql,ZodPromise:()=>tf,ZodReadonly:()=>Gl,ZodRecord:()=>qt,ZodSet:()=>Tl,ZodString:()=>Xt,ZodStringFormat:()=>R,ZodSuccess:()=>Hl,ZodSymbol:()=>_l,ZodTemplateLiteral:()=>Yl,ZodTransform:()=>Rl,ZodTuple:()=>El,ZodType:()=>I,ZodULID:()=>ri,ZodURL:()=>Xn,ZodUUID:()=>ve,ZodUndefined:()=>yl,ZodUnion:()=>tr,ZodUnknown:()=>$l,ZodVoid:()=>kl,ZodXID:()=>oi,ZodXor:()=>Pl,_ZodString:()=>Go,_default:()=>Fl,_function:()=>gm,any:()=>Jd,array:()=>Qn,base64:()=>zd,base64url:()=>Od,bigint:()=>Vd,boolean:()=>gl,catch:()=>Jl,check:()=>_m,cidrv4:()=>Sd,cidrv6:()=>Pd,codec:()=>pm,creditCard:()=>Ed,cuid:()=>_d,cuid2:()=>yd,currencyCode:()=>Dd,custom:()=>ym,date:()=>qd,describe:()=>wm,discriminatedUnion:()=>tm,e164:()=>Id,email:()=>cd,emoji:()=>hd,enum:()=>gi,exactOptional:()=>Ll,file:()=>am,float32:()=>Ld,float64:()=>jd,function:()=>gm,guid:()=>ad,hash:()=>Rd,hex:()=>Zd,hostname:()=>Td,httpUrl:()=>md,iban:()=>Ad,instanceof:()=>vm,int:()=>Wo,int32:()=>Md,int64:()=>Ud,intersection:()=>Il,invertCodec:()=>dm,ipv4:()=>$d,ipv6:()=>kd,json:()=>xm,jwt:()=>Nd,keyof:()=>Gd,ksuid:()=>vd,lazy:()=>ef,literal:()=>cm,looseObject:()=>Qd,looseRecord:()=>rm,mac:()=>xd,map:()=>om,meta:()=>bm,nan:()=>fm,nanoid:()=>gd,nativeEnum:()=>sm,never:()=>hi,nonoptional:()=>Kl,null:()=>bl,nullable:()=>Gn,nullish:()=>um,number:()=>hl,object:()=>Xd,optional:()=>ut,partialRecord:()=>nm,pipe:()=>qo,prefault:()=>Ul,preprocess:()=>km,promise:()=>hm,readonly:()=>Xl,record:()=>Nl,refine:()=>rf,set:()=>im,strictObject:()=>Yd,string:()=>qn,stringFormat:()=>Cd,stringbool:()=>$m,success:()=>lm,superRefine:()=>of,symbol:()=>Hd,templateLiteral:()=>mm,transform:()=>_i,tuple:()=>Al,uint32:()=>Fd,uint64:()=>Kd,ulid:()=>wd,undefined:()=>Bd,union:()=>tn,unknown:()=>at,url:()=>dd,uuid:()=>ud,uuidv4:()=>ld,uuidv6:()=>fd,uuidv7:()=>pd,void:()=>Wd,xid:()=>bd,xor:()=>em});var Bo={};ke(Bo,{endsWith:()=>Lt,gt:()=>we,gte:()=>fe,includes:()=>Dt,length:()=>st,lowercase:()=>Tt,lt:()=>ye,lte:()=>le,maxLength:()=>it,maxSize:()=>je,mime:()=>Mt,minLength:()=>Oe,minSize:()=>be,multipleOf:()=>Le,negative:()=>Ro,nonnegative:()=>jo,nonpositive:()=>Lo,normalize:()=>Ft,overwrite:()=>_e,positive:()=>Do,properties:()=>jt,property:()=>Mo,regex:()=>Ct,size:()=>ot,slugify:()=>Ht,startsWith:()=>Rt,toLowerCase:()=>Ut,toUpperCase:()=>Kt,trim:()=>Vt,uppercase:()=>Zt});var id=new WeakSet([Object.prototype,Error.prototype]);function Jo(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}s(Jo,"_lazyMethod");var sd=s((e,t)=>{Qi.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);id.has(n)||(id.add(n),Jo(n,"format",r=>o=>vn(r,o)),Jo(n,"flatten",r=>o=>bn(r,o)),Jo(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,bt,2)}),Jo(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,bt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),Yw=h("ZodError",sd),ae=h("ZodError",sd,void 0,{Parent:Error});var el=St(ae),tl=Pt(ae),nl=zt(ae),rl=Ot(ae),ol=kr(ae),il=Sr(ae),sl=Pr(ae),cl=zr(ae),al=Or(ae),ul=Ir(ae),ll=Er(ae),fl=Ar(ae);function eb(){B.localeError||F(Mn())}s(eb,"_ensureDefaultLocale");function lt(){B.memoizer||F({memoizer:jn()})}s(lt,"_ensureDefaultMemoizer");var I=h("ZodType",(e,t)=>(eb(),z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(x.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return T(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(rf(e,t))},superRefine(e,t){return this.check(of(e,t))},overwrite(e){return this.check(_e(e))},optional(){return ut(this)},exactOptional(){return Ll(this)},nullable(){return Gn(this)},nullish(){return ut(Gn(this))},nonoptional(e){return Kl(this,e)},array(){return Qn(this)},or(e){return tn([this,e])},and(e){return Il(this,e)},transform(e){return qo(this,_i(e))},default(e){return Fl(this,e)},prefault(e){return Ul(this,e)},catch(e){return Jl(this,e)},pipe(e){return qo(this,e)},readonly(){return Xl(this)},describe(e){let t=this.clone();return W.add(t,{description:e}),t},meta(...e){if(e.length===0)return W.get(this);let t=this.clone();return W.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 x.hide(this,"~standard",{...Vr(this),jsonSchema:{input:Bt(this,"input"),output:Bt(this,"output")}})},set"~standard"(e){x.own(this,"~standard",e)},parse:s(function e(t,n){return el(this,t,n,{callee:e})},"_parse"),parseAsync:s(async function e(t,n){return await tl(this,t,n,{callee:e})},"_parseAsync"),safeParse(e,t){return nl(this,e,t)},async safeParseAsync(e,t){return rl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){x.own(this,"spa",e)},validate(e,t){return $n(this,e,t)},validateAsync(e,t){return xn(this,e,t)},encode:s(function e(t,n){return ol(this,t,n,{callee:e})},"_encode"),decode:s(function e(t,n){return il(this,t,n,{callee:e})},"_decode"),encodeAsync:s(async function e(t,n){return await sl(this,t,n,{callee:e})},"_encodeAsync"),decodeAsync:s(async function e(t,n){return await cl(this,t,n,{callee:e})},"_decodeAsync"),safeEncode(e,t){return al(this,e,t)},safeDecode(e,t){return ul(this,e,t)},async safeEncodeAsync(e,t){return ll(this,e,t)},async safeDecodeAsync(e,t){return fl(this,e,t)},toJSONSchema(e){return du(this,{})(e)},get description(){return W.get(this)?.description},get _def(){return this._zod.def}}),Go=h("_ZodString",(e,t)=>{et.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gu(e,n,r,o)},x.derived({format:s(e=>K(e).format??null,"format"),minLength:s(e=>K(e).minimum??null,"minLength"),maxLength:s(e=>K(e).maximum??null,"maxLength")},{regex(...e){return this.check(Ct(...e))},includes(...e){return this.check(Dt(...e))},startsWith(...e){return this.check(Rt(...e))},endsWith(...e){return this.check(Lt(...e))},min(...e){return this.check(Oe(...e))},max(...e){return this.check(it(...e))},length(...e){return this.check(st(...e))},nonempty(...e){return this.check(Oe(1,...e))},lowercase(e){return this.check(Tt(e))},uppercase(e){return this.check(Zt(e))},trim(){return this.check(Vt())},normalize(...e){return this.check(Ft(...e))},toLowerCase(){return this.check(Ut())},toUpperCase(){return this.check(Kt())},slugify(){return this.check(Ht())}})),Xt=h("ZodString",(e,t)=>{et.init(e,t),Go.init(e,t)},{email(e){return this.check(ho(Xo,e))},url(e){return this.check(Vn(Xn,e))},jwt(e){return this.check(Zo(di,e))},emoji(e){return this.check(vo(Qo,e))},guid(e){return this.check(go(Yo,e))},uuid(e){return this.check(_o(ve,e))},uuidv4(e){return this.check(yo(ve,e))},uuidv6(e){return this.check(wo(ve,e))},uuidv7(e){return this.check(bo(ve,e))},nanoid(e){return this.check($o(ei,e))},cuid(e){return this.check(xo(ti,e))},cuid2(e){return this.check(ko(ni,e))},ulid(e){return this.check(So(ri,e))},base64(e){return this.check(No(li,e))},base64url(e){return this.check(Co(fi,e))},xid(e){return this.check(Po(oi,e))},ksuid(e){return this.check(zo(ii,e))},ipv4(e){return this.check(Oo(si,e))},ipv6(e){return this.check(Io(ci,e))},cidrv4(e){return this.check(Eo(ai,e))},cidrv6(e){return this.check(Ao(ui,e))},e164(e){return this.check(To(pi,e))},datetime(e){return this.check(Un(Ue,e))},date(e){return this.check(Kn(Ke,e))},time(e){return this.check(Hn(He,e))},duration(e){return this.check(Bn(Be,e))}});function qn(e){return Ia(Xt,e)}s(qn,"string");var R=h("ZodStringFormat",(e,t)=>{Z.init(e,t),Go.init(e,t)}),Ue=h("ZodISODateTime",(e,t)=>{wc.init(e,t),R.init(e,t)}),Ke=h("ZodISODate",(e,t)=>{bc.init(e,t),R.init(e,t)}),He=h("ZodISOTime",(e,t)=>{vc.init(e,t),R.init(e,t)}),Be=h("ZodISODuration",(e,t)=>{$c.init(e,t),R.init(e,t)}),Xo=h("ZodEmail",(e,t)=>{ac.init(e,t),R.init(e,t)});function cd(e){return ho(Xo,e)}s(cd,"email");var Yo=h("ZodGUID",(e,t)=>{sc.init(e,t),R.init(e,t)});function ad(e){return go(Yo,e)}s(ad,"guid");var ve=h("ZodUUID",(e,t)=>{cc.init(e,t),R.init(e,t)});function ud(e){return _o(ve,e)}s(ud,"uuid");function ld(e){return yo(ve,e)}s(ld,"uuidv4");function fd(e){return wo(ve,e)}s(fd,"uuidv6");function pd(e){return bo(ve,e)}s(pd,"uuidv7");var Xn=h("ZodURL",(e,t)=>{fc.init(e,t),R.init(e,t)});function dd(e){return Vn(Xn,e)}s(dd,"url");function md(e){return Vn(Xn,{protocol:kn,hostname:$s,...x.normalizeParams(e)})}s(md,"httpUrl");var Qo=h("ZodEmoji",(e,t)=>{pc.init(e,t),R.init(e,t)});function hd(e){return vo(Qo,e)}s(hd,"emoji");var ei=h("ZodNanoID",(e,t)=>{dc.init(e,t),R.init(e,t)});function gd(e){return $o(ei,e)}s(gd,"nanoid");var ti=h("ZodCUID",(e,t)=>{mc.init(e,t),R.init(e,t)});function _d(e){return xo(ti,e)}s(_d,"cuid");var ni=h("ZodCUID2",(e,t)=>{hc.init(e,t),R.init(e,t)});function yd(e){return ko(ni,e)}s(yd,"cuid2");var ri=h("ZodULID",(e,t)=>{gc.init(e,t),R.init(e,t)});function wd(e){return So(ri,e)}s(wd,"ulid");var oi=h("ZodXID",(e,t)=>{_c.init(e,t),R.init(e,t)});function bd(e){return Po(oi,e)}s(bd,"xid");var ii=h("ZodKSUID",(e,t)=>{yc.init(e,t),R.init(e,t)});function vd(e){return zo(ii,e)}s(vd,"ksuid");var si=h("ZodIPv4",(e,t)=>{xc.init(e,t),R.init(e,t)});function $d(e){return Oo(si,e)}s($d,"ipv4");var pl=h("ZodMAC",(e,t)=>{Sc.init(e,t),R.init(e,t)});function xd(e){return Aa(pl,e)}s(xd,"mac");var ci=h("ZodIPv6",(e,t)=>{kc.init(e,t),R.init(e,t)});function kd(e){return Io(ci,e)}s(kd,"ipv6");var ai=h("ZodCIDRv4",(e,t)=>{Pc.init(e,t),R.init(e,t)});function Sd(e){return Eo(ai,e)}s(Sd,"cidrv4");var ui=h("ZodCIDRv6",(e,t)=>{zc.init(e,t),R.init(e,t)});function Pd(e){return Ao(ui,e)}s(Pd,"cidrv6");var li=h("ZodBase64",(e,t)=>{Oc.init(e,t),R.init(e,t)});function zd(e){return No(li,e)}s(zd,"base64");var fi=h("ZodBase64URL",(e,t)=>{Ic.init(e,t),R.init(e,t)});function Od(e){return Co(fi,e)}s(Od,"base64url");var pi=h("ZodE164",(e,t)=>{Ec.init(e,t),R.init(e,t)});function Id(e){return To(pi,e)}s(Id,"e164");var dl=h("ZodCreditCard",(e,t)=>{Ac.init(e,t),R.init(e,t)});function Ed(e){return Na(dl,e)}s(Ed,"creditCard");var ml=h("ZodIBAN",(e,t)=>{Nc.init(e,t),R.init(e,t)});function Ad(e){return Ca(ml,e)}s(Ad,"iban");var di=h("ZodJWT",(e,t)=>{Cc.init(e,t),R.init(e,t)});function Nd(e){return Zo(di,e)}s(Nd,"jwt");var ft=h("ZodCustomStringFormat",(e,t)=>{Tc.init(e,t),R.init(e,t)});function Cd(e,t,n={}){return ct(ft,e,t,n)}s(Cd,"stringFormat");function Td(e){return ct(ft,"hostname",vs,e)}s(Td,"hostname");function Zd(e){return ct(ft,"hex",Ds,e)}s(Zd,"hex");function Dd(e){return ct(ft,"currency_code",ks,e)}s(Dd,"currencyCode");function Rd(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,o=me[r];if(!o)throw new Error(`Unrecognized hash format: ${r}`);return ct(ft,r,o,t)}s(Rd,"hash");var Yt=h("ZodNumber",(e,t)=>{Yr.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_u(e,n,r,o),e.isFinite=!0},x.derived({minValue:s(e=>{let{minimum:t,exclusiveMinimum:n}=K(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},"minValue"),maxValue:s(e=>{let{maximum:t,exclusiveMaximum:n}=K(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},"maxValue"),isInt:s(e=>{let{isInt:t,multipleOf:n}=K(e);return!!t||!!n?.some(Number.isSafeInteger)},"isInt"),format:s(e=>K(e).format??null,"format")},{gt(e,t){return this.check(we(e,t))},gte(e,t){return this.check(fe(e,t))},min(e,t){return this.check(fe(e,t))},lt(e,t){return this.check(ye(e,t))},lte(e,t){return this.check(le(e,t))},max(e,t){return this.check(le(e,t))},int(e){return this.check(Wo(e))},safe(e){return this.check(Wo(e))},positive(e){return this.check(we(0,e))},nonnegative(e){return this.check(fe(0,e))},negative(e){return this.check(ye(0,e))},nonpositive(e){return this.check(le(0,e))},multipleOf(e,t){return this.check(Le(e,t))},step(e,t){return this.check(Le(e,t))},finite(){return this}}));function hl(e){return Za(Yt,e)}s(hl,"number");var pt=h("ZodNumberFormat",(e,t)=>{Zc.init(e,t),Yt.init(e,t)});function Wo(e){return Ra(pt,e)}s(Wo,"int");function Ld(e){return La(pt,e)}s(Ld,"float32");function jd(e){return ja(pt,e)}s(jd,"float64");function Md(e){return Ma(pt,e)}s(Md,"int32");function Fd(e){return Fa(pt,e)}s(Fd,"uint32");var Qt=h("ZodBoolean",(e,t)=>{Cn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yu(e,n,r,o)});function gl(e){return Va(Qt,e)}s(gl,"boolean");var en=h("ZodBigInt",(e,t)=>{Qr.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wu(e,n,r,o)},x.derived({minValue:s(e=>K(e).minimum??null,"minValue"),maxValue:s(e=>K(e).maximum??null,"maxValue"),format:s(e=>K(e).format??null,"format")},{gte(e,t){return this.check(fe(e,t))},min(e,t){return this.check(fe(e,t))},gt(e,t){return this.check(we(e,t))},lt(e,t){return this.check(ye(e,t))},lte(e,t){return this.check(le(e,t))},max(e,t){return this.check(le(e,t))},positive(e){return this.check(we(BigInt(0),e))},negative(e){return this.check(ye(BigInt(0),e))},nonpositive(e){return this.check(le(BigInt(0),e))},nonnegative(e){return this.check(fe(BigInt(0),e))},multipleOf(e,t){return this.check(Le(e,t))}}));function Vd(e){return Ka(en,e)}s(Vd,"bigint");var mi=h("ZodBigIntFormat",(e,t)=>{Dc.init(e,t),en.init(e,t)});function Ud(e){return Ba(mi,e)}s(Ud,"int64");function Kd(e){return Ja(mi,e)}s(Kd,"uint64");var _l=h("ZodSymbol",(e,t)=>{Rc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bu(e,n,r,o)});function Hd(e){return Wa(_l,e)}s(Hd,"symbol");var yl=h("ZodUndefined",(e,t)=>{Lc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$u(e,n,r,o)});function Bd(e){return qa(yl,e)}s(Bd,"_undefined");var wl=h("ZodNull",(e,t)=>{jc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vu(e,n,r,o)});function bl(e){return Ga(wl,e)}s(bl,"_null");var vl=h("ZodAny",(e,t)=>{Mc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Su(e,n,r,o)});function Jd(){return Xa(vl)}s(Jd,"any");var $l=h("ZodUnknown",(e,t)=>{Fc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pu(e,n,r,o)});function at(){return Ya($l)}s(at,"unknown");var xl=h("ZodNever",(e,t)=>{Vc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ku(e,n,r,o)});function hi(e){return Qa(xl,e)}s(hi,"never");var kl=h("ZodVoid",(e,t)=>{Uc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xu(e,n,r,o)});function Wd(e){return eu(kl,e)}s(Wd,"_void");var Yn=h("ZodDate",(e,t)=>{Kc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zu(e,n,r,o),e.min=(n,r)=>e.check(fe(n,r)),e.max=(n,r)=>e.check(le(n,r))},x.derived({minDate:s(e=>{let{minimum:t}=K(e);return t?new Date(t):null},"minDate"),maxDate:s(e=>{let{maximum:t}=K(e);return t?new Date(t):null},"maxDate")},{}));function qd(e){return tu(Yn,e)}s(qd,"date");var Sl=h("ZodArray",(e,t)=>{lt(),Bc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ju(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Oe(e,t))},nonempty(e){return this.check(Oe(1,e))},max(e,t){return this.check(it(e,t))},length(e,t){return this.check(st(e,t))},unwrap(){return this.element}});function Qn(e,t){return ou(Sl,e,t)}s(Qn,"array");function Gd(e){let t=e._zod.def.shape;return gi(Object.keys(t))}s(Gd,"keyof");var er=h("ZodObject",(e,t)=>{lt(),Jc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mu(e,n,r,o),x.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return gi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(x.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(x.mergeDefs(this._zod.def,{catchall:at()}))},loose(){return this.clone(x.mergeDefs(this._zod.def,{catchall:at()}))},strict(){return this.clone(x.mergeDefs(this._zod.def,{catchall:hi()}))},strip(){return this.clone(x.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return x.extend(this,e)},safeExtend(e){return x.safeExtend(this,e)},merge(e){return x.merge(this,e)},pick(e){return x.pick(this,e)},omit(e){return x.omit(this,e)},partial(...e){return x.partial(nr,this,e[0])},exactPartial(...e){return x.partial(yi,this,e[0],"exactPartial")},required(...e){return x.required(wi,this,e[0])}});function Xd(e,t){let n={type:"object",shape:e??{},...x.normalizeParams(t)};return new er(n)}s(Xd,"object");function Yd(e,t){return new er({type:"object",shape:e,catchall:hi(),...x.normalizeParams(t)})}s(Yd,"strictObject");function Qd(e,t){return new er({type:"object",shape:e,catchall:at(),...x.normalizeParams(t)})}s(Qd,"looseObject");var tr=h("ZodUnion",(e,t)=>{Tn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vo(e,n,r,o),e.options=t.options});function tn(e,t){return new tr({type:"union",options:e,...x.normalizeParams(t)})}s(tn,"union");var Pl=h("ZodXor",(e,t)=>{tr.init(e,t),Wc.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vo(e,n,r,o),e.options=t.options});function em(e,t){return new Pl({type:"union",options:e,inclusive:!1,...x.normalizeParams(t)})}s(em,"xor");var zl=h("ZodDiscriminatedUnion",(e,t)=>{tr.init(e,t),Gc.init(e,t)});function tm(e,t,n){return new zl({type:"union",options:t,discriminator:e,...x.normalizeParams(n)})}s(tm,"discriminatedUnion");var Ol=h("ZodIntersection",(e,t)=>{Xc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fu(e,n,r,o)});function Il(e,t){return new Ol({type:"intersection",left:e,right:t})}s(Il,"intersection");var El=h("ZodTuple",(e,t)=>{lt(),eo.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vu(e,n,r,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 nr({type:"optional",innerType:t}))})}});function Al(e,t,n){let r=t instanceof z,o=r?n:t,i=r?t:null;return new El({type:"tuple",items:e,rest:i,...x.normalizeParams(o)})}s(Al,"tuple");var qt=h("ZodRecord",(e,t)=>{lt(),Yc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uu(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Nl(e,t,n){return!t||!t._zod?new qt({type:"record",keyType:qn(),valueType:e,...x.normalizeParams(t)}):new qt({type:"record",keyType:e,valueType:t,...x.normalizeParams(n)})}s(Nl,"record");function nm(e,t,n){return new qt({type:"record",keyType:e,valueType:t,...x.normalizeParams(n),partial:!0})}s(nm,"partialRecord");function rm(e,t,n){return new qt({type:"record",keyType:e,valueType:t,mode:"loose",...x.normalizeParams(n)})}s(rm,"looseRecord");var Cl=h("ZodMap",(e,t)=>{lt(),Qc.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ru(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(be(...n)),e.nonempty=n=>e.check(be(1,n)),e.max=(...n)=>e.check(je(...n)),e.size=(...n)=>e.check(ot(...n))});function om(e,t,n){return new Cl({type:"map",keyType:e,valueType:t,...x.normalizeParams(n)})}s(om,"map");var Tl=h("ZodSet",(e,t)=>{lt(),ea.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lu(e,n,r,o),e.min=(...n)=>e.check(be(...n)),e.nonempty=n=>e.check(be(1,n)),e.max=(...n)=>e.check(je(...n)),e.size=(...n)=>e.check(ot(...n))});function im(e,t){return new Tl({type:"set",valueType:e,...x.normalizeParams(t)})}s(im,"set");var Gt=h("ZodEnum",(e,t)=>{ta.init(e,t),I.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Ou(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let c of r)if(n.has(c))i[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new Gt({...t,checks:[],...x.normalizeParams(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let c of r)if(n.has(c))delete i[c];else throw new Error(`Key ${c} not found in enum`);return new Gt({...t,checks:[],...x.normalizeParams(o),entries:i})}});function gi(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Gt({type:"enum",entries:n,...x.normalizeParams(t)})}s(gi,"_enum");function sm(e,t){return new Gt({type:"enum",entries:e,...x.normalizeParams(t)})}s(sm,"nativeEnum");var Zl=h("ZodLiteral",(e,t)=>{na.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Iu(e,n,r,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]}})});function cm(e,t){return new Zl({type:"literal",values:Array.isArray(e)?e:[e],...x.normalizeParams(t)})}s(cm,"literal");var Dl=h("ZodFile",(e,t)=>{ra.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nu(e,n,r,o),e.min=(n,r)=>e.check(be(n,r)),e.max=(n,r)=>e.check(je(n,r)),e.mime=(n,r)=>e.check(Mt(Array.isArray(n)?n:[n],r))});function am(e){return iu(Dl,e)}s(am,"file");var Rl=h("ZodTransform",(e,t)=>{lt(),oa.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Du(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new De(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(x.issue(i,n.value,t));else{let c=i;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),"input"in c||(c.input=n.value),c.inst??(c.inst=e),n.issues.push(x.issue(c))}};let o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function _i(e){return new Rl({type:"transform",transform:e})}s(_i,"transform");var nr=h("ZodOptional",(e,t)=>{to.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uo(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ut(e){return new nr({type:"optional",innerType:e})}s(ut,"optional");var yi=h("ZodExactOptional",(e,t)=>{ia.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uo(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ll(e){return new yi({type:"optional",innerType:e})}s(Ll,"exactOptional");var jl=h("ZodNullable",(e,t)=>{sa.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ku(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gn(e){return new jl({type:"nullable",innerType:e})}s(Gn,"nullable");function um(e){return ut(Gn(e))}s(um,"nullish");var Ml=h("ZodDefault",(e,t)=>{ca.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ju(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Fl(e,t){return new Ml({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():x.shallowClone(t)}})}s(Fl,"_default");var Vl=h("ZodPrefault",(e,t)=>{aa.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ul(e,t){return new Vl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():x.shallowClone(t)}})}s(Ul,"prefault");var wi=h("ZodNonOptional",(e,t)=>{ua.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Kl(e,t){return new wi({type:"nonoptional",innerType:e,...x.normalizeParams(t)})}s(Kl,"nonoptional");var Hl=h("ZodSuccess",(e,t)=>{la.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lm(e){return new Hl({type:"success",innerType:e})}s(lm,"success");var Bl=h("ZodCatch",(e,t)=>{fa.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Jl(e,t){return new Bl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:x.constantCatch(t)})}s(Jl,"_catch");var Wl=h("ZodNaN",(e,t)=>{pa.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eu(e,n,r,o)});function fm(e){return ru(Wl,e)}s(fm,"nan");var rr=h("ZodPipe",(e,t)=>{no.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gu(e,n,r,o),e.in=t.in,e.out=t.out});function qo(e,t){return new rr({type:"pipe",in:e,out:t})}s(qo,"pipe");var or=h("ZodCodec",(e,t)=>{rr.init(e,t),Zn.init(e,t)});function pm(e,t,n){return new or({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}s(pm,"codec");function dm(e){let t=e._zod.def;return new or({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}s(dm,"invertCodec");var ql=h("ZodPreprocess",(e,t)=>{rr.init(e,t),da.init(e,t)}),Gl=h("ZodReadonly",(e,t)=>{ma.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Xl(e){return new Gl({type:"readonly",innerType:e})}s(Xl,"readonly");var Yl=h("ZodTemplateLiteral",(e,t)=>{ha.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Au(e,n,r,o)});function mm(e,t){return new Yl({type:"template_literal",parts:e,...x.normalizeParams(t)})}s(mm,"templateLiteral");var Ql=h("ZodLazy",(e,t)=>{Dn.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qu(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function ef(e){return new Ql({type:"lazy",getter:e})}s(ef,"lazy");var tf=h("ZodPromise",(e,t)=>{_a.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function hm(e){return new tf({type:"promise",innerType:e})}s(hm,"promise");var nf=h("ZodFunction",(e,t)=>{ga.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zu(e,n,r,o)});function gm(e){return new nf({type:"function",input:Array.isArray(e?.input)?Al(e?.input):e?.input??Qn(at()),output:e?.output??at()})}s(gm,"_function");var ir=h("ZodCustom",(e,t)=>{ya.init(e,t),I.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tu(e,n,r,o)});function _m(e){let t=new L({check:"custom"});return t._zod.check=e,t}s(_m,"check");function ym(e,t){return su(ir,e??(()=>!0),t)}s(ym,"custom");function rf(e,t={}){return cu(ir,e,t)}s(rf,"refine");function of(e,t){return au(e,t)}s(of,"superRefine");var wm=uu,bm=lu,sf=h("ZodInstanceOf",(e,t)=>{ir.init(e,t)},{properties(e,t){return this.check(jt(e,t))}});function vm(e,t={}){let n=new sf({type:"custom",check:"custom",fn:s(r=>r instanceof e,"fn"),abort:!0,...x.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}s(vm,"_instanceof");var $m=s((...e)=>fu({Codec:or,Boolean:Qt,String:Xt},...e),"stringbool");function xm(e){let t=ef(()=>tn([qn(e),hl(),gl(),bl(),Qn(t),Nl(qn(),t)]));return t}s(xm,"json");function km(e,t){return new ql({type:"pipe",in:_i(e),out:t})}s(km,"preprocess");var tb={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function nb(e){F({customError:e})}s(nb,"setErrorMap");function rb(){return F().customError}s(rb,"getErrorMap");var cf;cf||(cf={});var sr={};ke(sr,{ZodISODate:()=>Ke,ZodISODateTime:()=>Ue,ZodISODuration:()=>Be,ZodISOTime:()=>He,date:()=>ib,datetime:()=>ob,duration:()=>cb,time:()=>sb});function ob(e){return Un(Ue,e)}s(ob,"datetime");function ib(e){return Kn(Ke,e)}s(ib,"date");function sb(e){return Hn(He,e)}s(sb,"time");function cb(e){return Bn(Be,e)}s(cb,"duration");var v={...nn,...Bo,iso:sr},ab=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function ub(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}s(ub,"detectVersion");function Sm(e,t){return e.map((n,r)=>r<t?n:n.optional())}s(Sm,"applyMinItems");function lb(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}s(lb,"decodeJSONPointerSegment");function fb(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let o=n[1]===void 0?void 0:lb(n[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}s(fb,"resolveRef");function pb(e,t){return v.transform(r=>r).check(r=>{let o=r.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&&r.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&&r.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 c of i){let a=t.keySchema.safeParse(c);a.success||r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:c,path:[c],continue:!0})}}).pipe(e)}s(pb,"checkObjectGuards");function af(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let r=String(e);return`${n[0]}${r.length}:${r}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let c of e){let a=af(c,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let c=af(e[i],t);if(c===null)return null;o.push(`${i.length}:${i}=${c}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}s(af,"canonicalKey");var db=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),mb=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function cr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(cr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>db.has(t)?cr(n):!mb.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(cr))}s(cr,"containsRef");function Pm(e){return e===1?"element":"elements"}s(Pm,"plural");function hb(e,t){return v.transform(r=>r).check(r=>{let o=r.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let c=0;c<o.length;c++){let a=af(o[c],new Set);if(a===null)continue;let u=i.get(a);if(u===void 0){i.set(a,c);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${c} duplicates the one at index ${u}`,input:o,path:[c],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,c=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let u of o)if(t.containsSchema.safeParse(u).success&&++a>=c)break;a<i&&r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Pm(i)}; found ${a}`,input:o,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&r.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Pm(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}s(hb,"checkArrayGuards");function zm(e,t){if(e!==!1)return e===void 0||e===!0?v.any():te(e,t)}s(zm,"getTupleRest");var gb=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Om(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return v.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 v.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=fb(o,t),c=te(i,t);return t.refs.set(o,c),t.processing.delete(o),c}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 v.null();if(o.length===0)return v.never();if(o.length===1)return v.literal(o[0]);if(o.every(c=>typeof c=="string"))return v.enum(o);let i=o.map(c=>v.literal(c));return i.length<2?i[0]:v.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return v.literal(e.const);let n=e.type;if(Array.isArray(n)){let o=n.map(i=>{let c={...e,type:i};return Om(c,t)});return o.length===0?v.never():o.length===1?o[0]:v.union(o)}if(!n)return v.any();let r;switch(n){case"string":{let o=v.string();if(e.format){let i=e.format;i==="email"?o=o.check(v.email()):i==="uri"||i==="uri-reference"?o=o.check(v.url()):i==="uuid"||i==="guid"?o=o.check(v.uuid()):i==="date-time"?o=o.check(v.iso.datetime({offset:!0})):i==="date"?o=o.check(v.iso.date()):i==="time"?o=o.check(v.regex(gb)):i==="duration"?o=o.check(v.iso.duration()):i==="hostname"?o=o.check(v.hostname()):i==="ipv4"?o=o.check(v.ipv4()):i==="ipv6"?o=o.check(v.ipv6()):i==="mac"?o=o.check(v.mac()):i==="cidr"?o=o.check(v.cidrv4()):i==="cidr-v6"?o=o.check(v.cidrv6()):i==="base64"?o=o.check(v.base64()):i==="base64url"?o=o.check(v.base64url()):i==="e164"?o=o.check(v.e164()):i==="credit_card"?o=o.check(v.creditCard()):i==="iban"?o=o.check(v.iban()):i==="jwt"?o=o.check(v.jwt()):i==="emoji"?o=o.check(v.emoji()):i==="nanoid"?o=o.check(v.nanoid()):i==="cuid"?o=o.check(v.cuid()):i==="cuid2"?o=o.check(v.cuid2()):i==="ulid"?o=o.check(v.ulid()):i==="xid"?o=o.check(v.xid()):i==="ksuid"&&(o=o.check(v.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))),r=o;break}case"number":case"integer":{let o=n==="integer"?v.number().int():v.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)),r=o;break}case"boolean":{r=v.boolean();break}case"null":{r=v.null();break}case"object":{let o={},i=e.properties||{},c=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?te(e.additionalProperties,t):void 0;for(let[p,d]of Object.entries(i)){let m=te(d,t);J(o,p,c.has(p)?m:m.optional())}if(e.patternProperties){let p=e.patternProperties,d=Object.keys(p),m=[];for(let y of d){let b=te(p[y],t),k=v.string().regex(new RegExp(y));m.push(v.looseRecord(k,b))}let g=[];if(Object.keys(o).length>0&&g.push(v.object(o).passthrough()),g.push(...m),g.length===0)r=v.object({}).passthrough();else if(g.length===1)r=g[0];else{let y=v.intersection(g[0],g[1]);for(let b=2;b<g.length;b++)y=v.intersection(y,g[b]);r=y}if(e.additionalProperties===!1){let y=Object.keys(o),b=d.map($=>new RegExp($)),k=r;r=r.check($=>{if(!pe($.value))return;let O=[];for(let C of Object.keys($.value))y.includes(C)||b.some(j=>j.test(C))||O.push(C);O.length&&$.issues.push({code:"unrecognized_keys",keys:O,input:$.value,inst:k})})}}else{let p=v.object(o);e.additionalProperties===!1?r=p.strict():a?r=p.catchall(a):r=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=te(d,t)}r=pb(r,{keySchema:p,minProperties:l,maxProperties:f})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let c=typeof e.minItems=="number"?e.minItems:0,a=o.map(p=>te(p,t)),u=Sm(a,c),l=Array.isArray(i)?void 0:zm(i,t),f=v.tuple(u);r=l?f.rest(l):f,typeof e.minItems=="number"&&(r=r.check(v.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(v.maxLength(e.maxItems)))}else if(Array.isArray(i)){let c=typeof e.minItems=="number"?e.minItems:0,a=i.map(p=>te(p,t)),u=Sm(a,c),l=zm(e.additionalItems,t),f=v.tuple(u);r=l?f.rest(l):f,typeof e.minItems=="number"&&(r=r.check(v.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(v.maxLength(e.maxItems)))}else if(i!==void 0){let c=te(i,t),a=v.array(c);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),r=a}else r=v.array(v.any());(e.uniqueItems===!0||e.contains!==void 0)&&(r=hb(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?te(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: ${n}`)}return r}s(Om,"convertBaseSchema");function te(e,t){if(typeof e=="boolean")return e?v.any():v.never();let n=Om(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(l=>te(l,t)),u=v.union(a);n=r?v.intersection(n,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(l=>te(l,t)),u=v.xor(a);n=r?v.intersection(n,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:v.any();else{let a=r?n:te(e.allOf[0],t),u=r?0:1;for(let l=u;l<e.allOf.length;l++)a=v.intersection(a,te(e.allOf[l],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=v.nullable(n)),e.readOnly===!0&&(n=v.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in e&&(o[a]=e[a]);let c=["contentEncoding","contentMediaType","contentSchema"];for(let a of c)a in e&&(o[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!cr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(o[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!cr(e.contains)&&(o.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(o[a]=e[a])}for(let a of Object.keys(e))ab.has(a)||J(o,a,e[a]);return Object.keys(o).length>0&&t.registry.add(n,o),e.description&&(n=n.describe(e.description)),n}s(te,"convertSchema");function Im(e,t){if(typeof e=="boolean")return e?v.any():v.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=ub(n,t?.defaultTarget),o=n.$defs||n.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??W};return te(n,i)}s(Im,"fromJSONSchema");var Em=Symbol("z.visit/resolving");function ar(e,t){let n=typeof t=="function"?t:(c,a)=>{let u=t[c._zod.def.type];return u?u(c,a):c},r=new Map;function o(c){let a=r.get(c);if(a===Em)return new Dn({type:"lazy",getter:s(()=>r.get(c),"getter")});if(a!==void 0)return a;r.set(c,Em);let u=i(c),l=n(u,u!==c);return r.set(c,l),l}s(o,"run");function i(c){let a=c._zod.def,u=a.type;switch(u){case"object":{let l=a.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=a.catchall;return a.catchall&&(m=o(a.catchall),m!==a.catchall&&(p=!0)),p?T(c,{...a,shape:d,catchall:m}):c}case"array":{let l=o(a.element);return l===a.element?c:T(c,{...a,element:l})}case"tuple":{let l=a.items,f=!1,p=[];for(let m of l){let g=o(m);g!==m&&(f=!0),p.push(g)}let d=a.rest;return a.rest&&(d=o(a.rest),d!==a.rest&&(f=!0)),f?T(c,{...a,items:p,rest:d}):c}case"record":case"map":{let l=o(a.keyType),f=o(a.valueType);return l===a.keyType&&f===a.valueType?c:T(c,{...a,keyType:l,valueType:f})}case"set":{let l=o(a.valueType);return l===a.valueType?c:T(c,{...a,valueType:l})}case"union":{let l=a.options,f=!1,p=[];for(let d of l){let m=o(d);m!==d&&(f=!0),p.push(m)}return f?T(c,{...a,options:p}):c}case"intersection":{let l=o(a.left),f=o(a.right);return l===a.left&&f===a.right?c:T(c,{...a,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(a.innerType);return l===a.innerType?c:T(c,{...a,innerType:l})}case"pipe":{let l=o(a.in),f=o(a.out);return l===a.in&&f===a.out?c:T(c,{...a,in:l,out:f})}case"function":{let l=o(a.input),f=o(a.output);return l===a.input&&f===a.output?c:T(c,{...a,input:l,output:f})}case"lazy":{let l=a.getter,{_cachedInner:f,...p}=a;return T(c,{...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 c;default:return c}}return s(i,"mapInner"),o(e)}s(ar,"visit");function Am(e){return ar(e,{object:s(t=>t.partial(),"object"),union:s(t=>{let n=t._zod.def;return n.discriminator===void 0?t:tn(n.options)},"union")})}s(Am,"deepPartial");function _b(e,t){if(!t?.length)return e;let n=e._zod.def;return T(e,he(n,{checks:[...n.checks??[],...t]}),{parent:!0})}s(_b,"withChecks");function Nm(e){return _b(e.out,e.checks)}s(Nm,"outSide");function yb(e){return e.in._zod.traits.has("$ZodTransform")?Nm(e):e.in}s(yb,"inSide");function Cm(e){return ar(e,{pipe:s(t=>yb(t._zod.def),"pipe"),default:s((t,n)=>n?ut(t._zod.def.innerType):t,"default"),catch:s((t,n)=>n?t._zod.def.innerType:t,"catch")})}s(Cm,"input");function Tm(e){return ar(e,{pipe:s(t=>Nm(t._zod.def),"pipe"),prefault:s((t,n)=>n?t._zod.def.innerType:t,"prefault")})}s(Tm,"output");var uf={};ke(uf,{bigint:()=>$b,boolean:()=>vb,date:()=>xb,number:()=>bb,string:()=>wb});function wb(e){return Ea(Xt,e)}s(wb,"string");function bb(e){return Da(Yt,e)}s(bb,"number");function vb(e){return Ua(Qt,e)}s(vb,"boolean");function $b(e){return Ha(en,e)}s($b,"bigint");function xb(e){return nu(Yn,e)}s(xb,"date");import uv from"node:path";var pv=mr(vi());var dv=mr(wf());import{spawn as mv,spawnSync as hv}from"node:child_process";import{accessSync as gv,constants as Oh,existsSync as _v,readdirSync as yv,realpathSync as Ih,statSync as wv}from"node:fs";import{createRequire as bv}from"node:module";import{homedir as Uh}from"node:os";import{basename as ki,delimiter as xf,dirname as $e,extname as vv,isAbsolute as $i,join as ne}from"node:path";import{fileURLToPath as $v}from"node:url";import bf from"node:fs";import lr from"node:path";import ur from"node:process";import{AsyncLocalStorage as Dh}from"node:async_hooks";import{availableParallelism as Hv}from"node:os";function jh(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(jh,"experimental_defineHostEntry");function Gb(e){if(e.length===0)return!1;let t=e.replaceAll("\\","/"),n=/^[a-zA-Z]:\//u.exec(t),r=n?t.slice(n[0].length):t.slice(1);return!n&&!t.startsWith("/")?!1:r.split("/").every(o=>o!==""&&o!=="."&&o!=="..")}s(Gb,"isAbsoluteProviderSkillRootPath");function Mh(e){if(e.length===0)return!1;let t=e.replaceAll("\\","/");return!t.startsWith("/")&&!/^[a-zA-Z]:\//u.test(t)&&t.split("/").every(n=>n!==""&&n!=="."&&n!=="..")}s(Mh,"isRelativeProviderSkillRootPath");var Xb=32,Yb=/^[A-Za-z0-9][A-Za-z0-9._-]{0,62}:$/u,Sf=_.string().refine(e=>e===""||Yb.test(e),"A root name prefix is a plugin-name-like token ending in ':'"),Pf=_.string().min(1).refine(Mh,"A manifest marker is a relative path without dot segments"),Qb=_.string().min(1).refine(Mh,"Roots must be relative paths without dot segments"),ev=_.string().min(1).refine(Gb,"Absolute roots must be absolute paths without dot segments"),vh=_.union([_.string().min(1),_.object({path:_.string().min(1),recursive:_.boolean().optional(),ancestors:_.boolean().optional(),namePrefix:Sf.optional(),skipIfManifest:Pf.optional()}).strict()]),QS=_.object({user:_.array(vh).optional(),project:_.array(vh).optional()}).strict(),tv=_.object({path:_.string().min(1),recursive:_.boolean(),ancestors:_.boolean(),namePrefix:Sf,skipIfManifest:Pf.optional()}).strict();function nv(e){return new Set(e.map(t=>t.path)).size===e.length}s(nv,"uniqueByPath");function $h(e){return _.array(tv.extend({path:Qb}).superRefine((t,n)=>{t.ancestors&&e!=="project"&&n.addIssue({code:"custom",message:"Only project roots may walk ancestors"})})).max(Xb).refine(nv,"Roots must not repeat a path")}s($h,"nativeRootSideSchema");var xh=_.object({user:$h("user"),project:$h("project")}).strict(),eP=Object.freeze({user:Object.freeze([]),project:Object.freeze([])}),rv=_.enum(["skills","skill","skill-file","commands","command-file"]),Fh=_.object({path:ev,origin:_.enum(["user","project"]),recursive:_.boolean(),ancestors:_.boolean(),namePrefix:Sf,shape:rv,fallbackName:_.string().min(1).optional(),skipIfManifest:Pf.optional()}).strict(),kh=Fh.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"})}),Sh=Fh.partial({recursive:!0,ancestors:!0,namePrefix:!0,shape:!0});function Ph(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(Ph,"normalizeProviderResolvedNativeRoot");var ov=new Set(["skills","skill","skill-file"]),iv=new Set(["commands","command-file"]),xi=256,Vh=_.object({skills:_.array(kh.refine(e=>ov.has(e.shape),"A skills root needs a skill shape")).max(xi),commands:_.array(kh.refine(e=>iv.has(e.shape),"A commands root needs a command shape")).max(xi)}).strict(),tP=Object.freeze({skills:Object.freeze([]),commands:Object.freeze([])}),nP=_.object({skills:xh,commands:xh,resolved:Vh}).strict(),sv=Symbol.for("@get-bb/plugin-sdk/rpc-refusal"),rP=class extends Error{static{s(this,"experimental_PluginRpcRefusal")}[sv]=!0;code;issues;constructor(e){super(e.message),this.name="experimental_PluginRpcRefusal",this.code=e.code,this.issues=e.issues}};var cv=_.object({providerId:_.string().min(1),cwd:_.string().min(1).nullable()}).strict(),av=_.object({skills:_.array(Sh).optional(),commands:_.array(Sh).optional()}).strict().transform(e=>({skills:(e.skills??[]).slice(0,xi).map(t=>Ph(t,"skills")),commands:(e.commands??[]).slice(0,xi).map(t=>Ph(t,"commands"))})).pipe(Vh);var oP={resolveNativeRoots:{input:cv,output:av}};var cP=uv.join(".claude-plugin","plugin.json");var lv=_.enum(["managed","project","local","user"]),aP=_.object({enabledPlugins:_.record(_.string(),_.boolean()).optional()}).passthrough(),fv=_.object({gitCommitSha:_.string().nullable().optional(),installPath:_.string().min(1),scope:lv}).passthrough(),uP=_.object({plugins:_.record(_.string(),_.array(fv))}).passthrough(),zh=_.union([_.string(),_.array(_.string())]),lP=_.object({name:_.string().min(1).optional(),defaultEnabled:_.boolean().optional(),skills:zh.optional(),commands:zh.optional()}).passthrough();var dt=ur.platform==="win32",xv=dt?new RegExp("[\\/\\\\]","v"):new RegExp("\\/","v"),kv=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC";function Sv(e,t){if(typeof e!="string"||e.length===0)throw new TypeError("Expected a non-empty string.");let{cwd:n=ur.cwd(),path:r=ur.env.PATH??(dt?ur.env.Path:void 0)??"",pathExt:o=ur.env.PATHEXT||kv}=t;return{cwd:n,searchPath:r,pathExt:o}}s(Sv,"resolveOptions");function Pv(e,t){let n=t.split(lr.delimiter).filter(Boolean),r=lr.extname(e).toLowerCase();return r!==""&&n.some(o=>o.toLowerCase()===r)?["",...n]:n}s(Pv,"windowsExtensions");function*zv(e,{cwd:t,searchPath:n,pathExt:r}){let o=dt?Pv(e,r):[""];if(xv.test(e)){let c=lr.resolve(t,e);for(let a of o)yield c+a;return}let i=[...dt?[t]:[],...n.split(lr.delimiter)];for(let c of i){let a=dt&&c.length>1&&c.startsWith('"')&&c.endsWith('"')?c.slice(1,-1):c;if(a==="")continue;let u=lr.resolve(t,a,e);for(let l of o)yield u+l}}s(zv,"candidatePaths");function Ov(e){let t;try{t=bf.statSync(e)}catch(n){return dt&&n.code==="EACCES"}if(!t.isFile())return!1;if(dt)return!0;try{return bf.accessSync(e,bf.constants.X_OK),!0}catch{return!1}}s(Ov,"isExecutableSync");function Eh(e,t={}){let n=Sv(e,t);for(let r of zv(e,n))if(Ov(r))return r}s(Eh,"whichCommandSync");var Kh={"--use-system-ca":"NODE_USE_SYSTEM_CA","--use-env-proxy":"NODE_USE_ENV_PROXY"},Ah="--use-env-proxy",Iv=new Set(["HTTP_PROXY","HTTPS_PROXY"]),Nh="NO_PROXY",Ev=["localhost","127.0.0.1","::1","[::1]"];function Av(e){return Object.hasOwn(Kh,e)}s(Av,"isNodeNetworkFlag");function Nv(e){if(/[\r\n]/u.test(e))return!1;try{let t=new URL(e);return(t.protocol==="http:"||t.protocol==="https:")&&t.hostname!==""}catch{return!1}}s(Nv,"isHttpProxyUrl");function Cv(e){return Object.entries(e).filter(t=>Iv.has(t[0].toUpperCase())&&t[1]!==void 0&&t[1]!=="")}s(Cv,"proxyEntries");function Tv(e){let t=e.split(/[\s,]+/u).filter(Boolean);if(t.includes("*"))return e;let n=new Set(t.map(r=>r.toLowerCase()));return[...t,...Ev.filter(r=>!n.has(r))].join(",")}s(Tv,"appendLoopback");function Zv(e){let t={...e},n=Object.keys(t).filter(r=>r.toUpperCase()===Nh&&t[r]!==void 0);for(let r of n.length>0?n:[Nh])t[r]=Tv(t[r]??"");return t}s(Zv,"withLoopbackNoProxy");function Dv(e,t){let n=e.filter(i=>!Av(i)||t[Kh[i]]!=="0");if(!n.includes(Ah))return{nodeArgs:n,env:t,rejectedProxyKeys:[]};let r=Cv(t),o=r.filter(([,i])=>!Nv(i)).map(([i])=>i);return o.length>0?{nodeArgs:n.filter(i=>i!==Ah),env:t,rejectedProxyKeys:o}:{nodeArgs:n,env:r.length>0?Zv(t):t,rejectedProxyKeys:[]}}s(Dv,"nodeNetworkLaunch");var Ch=new Set;function Rv(e,t){let n=Dv(e,t),r=n.rejectedProxyKeys.filter(o=>!Ch.has(o));if(r.length>0){for(let o of r)Ch.add(o);process.emitWarning(`bb started a Node process without --use-env-proxy because ${r.join(", ")} is not an http:// or https:// URL. Add the scheme, for example http://proxy.example:3128, so bb uses the proxy.`,{code:"BB_INVALID_PROXY_ENV"})}return{nodeArgs:n.nodeArgs,env:n.env}}s(Rv,"prepareNodeNetworkLaunch");function Lv(e,t){let n=e.findIndex(i=>i==="--"||!i.startsWith("-")),r=n<0?e.length:n,o=Rv(e.slice(0,r),t);return{args:[...o.nodeArgs,...e.slice(r)],env:o.env}}s(Lv,"prepareNodeNetworkCommand");var Hh=["HTTP_PROXY","HTTPS_PROXY","NO_PROXY","http_proxy","https_proxy","no_proxy","NODE_EXTRA_CA_CERTS","SSL_CERT_FILE","SSL_CERT_DIR"],vf="__BB_SHELL_ENV_START__",Th="__BB_SHELL_ENV_END__",Bh=3e3,jv=1024*1024;function sn(e){try{return gv(e,process.platform==="win32"?Oh.F_OK:Oh.X_OK),wv(e).isFile()}catch{return!1}}s(sn,"executable");function Ee(e,t){return process.platform!=="win32"?e[t]:e[Object.keys(e).find(n=>n.toUpperCase()===t.toUpperCase())??t]}s(Ee,"envValue");function kf(...e){let t=new Set;return e.flatMap(n=>(n??"").split(xf)).filter(n=>{if(!n)return!1;let r=process.platform==="win32"?n.replace(/[\\/]+$/u,"").toLowerCase():n;return t.has(r)?!1:(t.add(r),!0)}).join(xf)}s(kf,"mergePath");function Mv(e){if(process.platform!=="win32")return e;try{let t=ki(e).toLowerCase(),n=yv($e(e)).find(r=>r.toLowerCase()===t);return n===void 0?e:ne($e(e),n)}catch{return e}}s(Mv,"onDiskName");function Zh(e,t,n){return new Promise(r=>{let o="",i=!1,c,a=s(l=>{i||(i=!0,clearTimeout(c),r({status:l,stdout:o}))},"finish"),u;try{u=mv(e,t,{cwd:Uh(),env:n,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{a(null);return}c=setTimeout(()=>{u.kill("SIGKILL"),a(null)},Bh),u.stdout?.setEncoding("utf8"),u.stdout?.on("data",l=>{o.length<jv&&(o+=l)}),u.once("error",()=>a(null)),u.once("close",l=>a(l))})}s(Zh,"runProbe");async function Fv(e,t){if(process.platform==="win32"){let i=ne(Ee(e,"SystemRoot")??"C:\\Windows","System32","reg.exe"),c={...e},a=[];for(let l of["HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment","HKCU\\Environment"]){let f=await Zh(i,["query",l],e);if(f.status===0)for(let p of f.stdout.matchAll(/^ {4}(.+?) {4}REG_[A-Z_]+ {4}(.*)$/gmu)){let d=p[1]?.trim();if(!d)continue;let m=(p[2]??"").trim();if(d.toUpperCase()==="PATH")a.push(m);else{let g=Object.keys(c).find(y=>y.toUpperCase()===d.toUpperCase());c[g??d]=m}}}let u=s(l=>{for(let f=0;f<10;f+=1){let p=l.replace(/%([^%;\\/]+)%/gu,(d,m)=>Ee(c,m)??d);if(p===l)break;l=p}return l},"expand");return a.length===0?null:{PATH:kf(...a.map(u),Ee(e,"PATH"))}}let n=e.SHELL?.trim()||(process.platform==="darwin"?"/bin/zsh":"/bin/sh"),r=`printf '%s\\n' ${vf}; /usr/bin/env; printf '%s\\n' ${Th}`,o=["sh","dash"].includes(ki(n))?["-lc"]:["-ilc","-lc"];for(let i of o){let c=await Zh(n,[i,r],e);if(c.status!==0){if(t)return null;continue}let a=c.stdout.indexOf(`${vf}
68
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of e.seen.entries()){let a=c[1];if(t===c[0]){i(c);continue}if(e.external){let l=e.external.registry.get(c[0])?.id;if(t!==c[0]&&l){i(c);continue}}if(e.metadataRegistry.get(c[0])?.id){i(c);continue}if(a.cycle){i(c);continue}a.count>1&&e.reused==="ref"&&i(c)}e.external&&(e.sharedDefsExtractedFor=e.external)}s(Ue,"extractDefs");function ed(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!="object")return;ed(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let c of Array.isArray(i)?i:[i]){if(typeof c!="string")return;n.includes(c)||n.push(c)}}delete e.anyOf,e.type=n.length===1?n[0]:n}s(ed,"compactTypeUnion");var td=new Set(["type","properties","required","additionalProperties"]),Yp=["oneOf","anyOf"];function Qp(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}s(Qp,"undeclaredConstraint");function bu(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let c in i)if(!td.has(c))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let c in i.properties){if(Object.prototype.hasOwnProperty.call(n,c))continue;let a=[];for(let l of t){let f=l.properties?.[c]??Qp(l);f!=null&&(a.some(p=>JSON.stringify(p)===JSON.stringify(f))||a.push(f))}let u=a.length===1?a[0]:bu(a)??{allOf:a};J(n,c,u)}for(let c of i.required??[])r.add(c)}let o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let c of t){let a=Qp(c);a&&!i.some(u=>JSON.stringify(u)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}s(bu,"foldObjects");function ob(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of td)if(o in e)return;let n=t.filter(o=>Yp.some(i=>Array.isArray(o[i]))),r=null;if(!n.length)r=bu(t);else{let o=n[0],i=Yp.find(u=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let c=t.filter(u=>u!==o),a=o[i].map(u=>bu([...c,u]));if(a.some(u=>!u))return;r={[i]:a}}r&&(delete e.allOf,Yn(e,r))}s(ob,"foldIntersection");function Ve(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=s(a=>{let u=e.seen.get(a);if(u.ref===null)return;let l=u.def??u.schema,f={...l},p=u.ref;if(u.ref=null,p){r(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)):Yn(l,g),Yn(l,f),a._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=a._zod.parent;if(d&&d!==p){r(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:a,jsonSchema:l,path:u.path??[]})},"flattenRef");if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())ed(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=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=a.get(f);p?p.push(l):a.set(f,[l])}for(let u of e.intersections)for(let l of a.get(u)??[])ob(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 a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Yn(o,n.defId?n.schema:n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let c=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let u=a[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,J(c,u.defId,u.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?o.$defs=c:o.definitions=c);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Xt(t,"input",e.processors),output:Xt(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}s(Ve,"finalize");function te(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return te(r.element,n);if(r.type==="set")return te(r.valueType,n);if(r.type==="lazy")return te(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return te(r.innerType,n);if(r.type==="intersection")return te(r.left,n)||te(r.right,n);if(r.type==="record"||r.type==="map")return te(r.keyType,n)||te(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:te(r.in,n)||te(r.out,n);if(r.type==="object"){for(let o in r.shape)if(te(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(te(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(te(o,n))return!0;return!!(r.rest&&te(r.rest,n))}return!1}s(te,"isTransforming");var vu=s((e,t={})=>n=>{let r=Fe({...n,processors:t});return Z(e,r),Ue(r,e),Ve(r,e)},"createToJSONSchemaMethod"),Xt=s((e,t,n={})=>r=>{let{libraryOptions:o,target:i}=r??{},c=Fe({...o??{},target:i,io:t,processors:n});return Z(e,c),Ue(c,e),Ve(c,e)},"createStandardJSONSchemaMethod");var qt=s((e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},"narrowMin"),Gt=s((e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},"narrowMax"),nd=s((e,t)=>{qt(e,"minimum",t),Gt(e,"maximum",t)},"narrowBoth"),sd=s((e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},"addDivisor"),cd=s((e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},"addPattern"),ad=s((e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},"intersectMime"),ud=s((e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},"setFormat"),rd=s((e,t)=>qt(e,"minimum",t.minimum),"minContributor"),od=s((e,t)=>Gt(e,"maximum",t.maximum),"maxContributor"),id=s(e=>(t,n)=>{ud(t,n.format);let[r,o]=e[n.format];qt(t,"minimum",r),Gt(t,"maximum",o)},"formatContributor"),ib={greater_than:s((e,t)=>qt(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),"greater_than"),less_than:s((e,t)=>Gt(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),"less_than"),multiple_of:s((e,t)=>sd(e,t.value),"multiple_of"),number_format:id(wn),bigint_format:id(bn),min_length:rd,max_length:od,length_equals:s((e,t)=>nd(e,t.length),"length_equals"),min_size:rd,max_size:od,size_equals:s((e,t)=>nd(e,t.size),"size_equals"),string_format:s((e,t)=>{ud(e,t.format),t.pattern&&cd(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)=>ad(e,t.mime),"mime_type")};function K(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)ib[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&qt(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&qt(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Gt(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Gt(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&sd(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&ad(t,o.mime);for(let i of o.patterns??[])cd(t,i);return t}s(K,"aggregateChecks");var sb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},cb=new Map([[eo,zs],[Ln,Os]]),ld=s(e=>cb.get(e)??e,"exactPattern"),ku=s((e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:c,format:a,patterns:u,contentEncoding:l,laxFormat:f}=K(e);if(typeof i=="number"&&(o.minLength=i),typeof c=="number"&&(o.maxLength=c),a&&(o.format=sb[a]??a,o.format===""&&delete o.format,(a==="time"||f)&&delete o.format),l&&(o.contentEncoding=l),u&&u.size>0){let p=[...u].map(ld);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"),Su=s((e,t,n,r)=>{let o=n,{minimum:i,maximum:c,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:l,isInt:f}=K(e);o.type=f?"integer":"number";let p=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),d=typeof u=="number"&&u<=(c??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 c=="number"&&(o.maximum=c),a){let g=new Set;for(let k of a)Number.isFinite(k)&&k!==0?g.add(Math.abs(k)):V(e,t,o,r,`A multipleOf divisor of ${k} cannot be represented in JSON Schema`);let[y,...b]=g;y!==void 0&&(o.multipleOf=y),b.length&&(o.allOf=[...o.allOf??[],...b.map(k=>({multipleOf:k}))])}},"numberProcessor"),Pu=s((e,t,n,r)=>{n.type="boolean"},"booleanProcessor"),zu=s((e,t,n,r)=>{V(e,t,n,r,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),Ou=s((e,t,n,r)=>{V(e,t,n,r,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),Eu=s((e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},"nullProcessor"),Iu=s((e,t,n,r)=>{V(e,t,n,r,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),Au=s((e,t,n,r)=>{V(e,t,n,r,"Void cannot be represented in JSON Schema")},"voidProcessor"),Nu=s((e,t,n,r)=>{n.not={}},"neverProcessor"),Cu=s((e,t,n,r)=>{},"anyProcessor"),Tu=s((e,t,n,r)=>{},"unknownProcessor"),Du=s((e,t,n,r)=>{V(e,t,n,r,"Date cannot be represented in JSON Schema")},"dateProcessor"),Zu=s((e,t,n,r)=>{let o=e._zod.def,i=$t(o.entries);if(i.length===0){n.not={};return}i.every(c=>typeof c=="number")&&(n.type="number"),i.every(c=>typeof c=="string")&&(n.type="string"),n.enum=i},"enumProcessor"),Lu=s((e,t,n,r)=>{let o=e._zod.def;if(o.values.length===0){n.not={};return}let i=[];for(let c of o.values)if(c===void 0){if(V(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof c=="bigint"){if(V(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(c))}else i.push(c);if(i.length!==0)if(i.length===1){let c=i[0];n.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[c]:n.const=c}else i.every(c=>typeof c=="number")&&(n.type="number"),i.every(c=>typeof c=="string")&&(n.type="string"),i.every(c=>typeof c=="boolean")&&(n.type="boolean"),i.every(c=>c===null)&&(n.type="null"),n.enum=i},"literalProcessor"),Ru=s((e,t,n,r)=>{V(e,t,n,r,"NaN cannot be represented in JSON Schema")},"nanProcessor"),ju=s((e,t,n,r)=>{let o=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},"templateLiteralProcessor"),Mu=s((e,t,n,r)=>{let o=n;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:c,mime:a}=K(e);i!==void 0&&(o.minLength=i),c!==void 0&&(o.maxLength=c),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(u=>({contentMediaType:u})))},"fileProcessor"),Fu=s((e,t,n,r)=>{n.type="boolean"},"successProcessor"),Uu=s((e,t,n,r)=>{V(e,t,n,r,"Custom types cannot be represented in JSON Schema")},"customProcessor"),Vu=s((e,t,n,r)=>{V(e,t,n,r,"Function types cannot be represented in JSON Schema")},"functionProcessor"),Ku=s((e,t,n,r)=>{V(e,t,n,r,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),Hu=s((e,t,n,r)=>{V(e,t,n,r,"Map cannot be represented in JSON Schema")},"mapProcessor"),Bu=s((e,t,n,r)=>{V(e,t,n,r,"Set cannot be represented in JSON Schema")},"setProcessor"),Ju=s((e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:c,maximum:a}=K(e);typeof c=="number"&&(o.minItems=c),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=Z(i.element,t,{...r,path:[...r.path,"items"]})},"arrayProcessor");function Qn(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Qn(t.out):t.type==="catch"?Qn(t.innerType):e._zod.optin}s(Qn,"inputOptin");var Wu=s((e,t,n,r)=>{let o=n,i=e._zod.def,c=i.shape;if(Object.getOwnPropertySymbols(c).length&&V(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in c)J(o.properties,l,Z(c[l],t,{...r,path:[...r.path,"properties",l]}));let u=[];for(let l of Object.keys(c)){let f=i.shape[l];(t.io==="input"?Qn(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=Z(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},"objectProcessor"),Xo=s((e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,c=o.options.map((a,u)=>Z(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",u]}));i?n.oneOf=c:n.anyOf=c},"unionProcessor"),Xu=s((e,t,n,r)=>{let o=e._zod.def,i=Z(o.left,t,{...r,path:[...r.path,"allOf",0]}),c=Z(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=s(l=>"allOf"in l&&Object.keys(l).length===1,"isSimpleIntersection"),u=[...a(i)?i.allOf:[i],...a(c)?c.allOf:[c]];n.allOf=u,t.intersections.push(u)},"intersectionProcessor"),qu=s((e,t,n,r)=>{let o=n,i=e._zod.def;o.type="array";let c=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=i.items.map((y,b)=>Z(y,t,{...r,path:[...r.path,c,b]})),l=i.rest?Z(i.rest,t,{...r,path:[...r.path,a,...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"?Qn(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}=K(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)},"tupleProcessor");function $u(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let g=e.get(t)?.def;if(!g)return t;let y=$u(e,g,n);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let b=y.map(k=>$u(e,k,n));b.some((k,$)=>k!==y[$])&&(t={...t,[g]:b})}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.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:c,maximum:a,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=(r.includes("number")?Ee:In).source)),m}s($u,"stringifyKeyNames");var xu=new WeakMap;function ab(e){let t=new Map;for(let r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);let n=new Map;for(let r of xu.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let c=$u(t,i,new Set);c!==i&&n.set(i,c)}if(n.size)for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);i&&(o.propertyNames=i)}}s(ab,"rewriteKeyNames");var Gu=s((e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let c=i.keyType,a=K(c).patterns;if(i.mode==="loose"&&a&&a.size>0){let f=Z(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let p of a)J(o.patternProperties,ld(p).source,f)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=Z(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let f=xu.get(t);f||(f=[],xu.set(t,f),t.deferred.push(()=>ab(t))),f.push(e)}o.additionalProperties=Z(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let u=c._zod.values,l=t.io==="input"&&Qn(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"),Yu=s((e,t,n,r)=>{let o=e._zod.def,i=Z(o.innerType,t,r),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},"nullableProcessor"),Qu=s((e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},"nonoptionalProcessor"),el=Symbol();function fd(e,t,n,r,o){let i=!1,c=JSON.stringify(e,(a,u)=>typeof u!="bigint"?u:(i=!0,null));return i?(V(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),el):JSON.parse(c)}s(fd,"serializeDefaultValue");var tl=s((e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let c=fd(o.defaultValue,e,t,n,r);c!==el&&(n.default=c)},"defaultProcessor"),nl=s((e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let c=fd(o.defaultValue,e,t,n,r);c!==el&&(n._prefault=c)},"prefaultProcessor"),rl=s((e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let c;try{c=o.catchValue(void 0)}catch{V(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=c},"catchProcessor"),ol=s((e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),c=t.io==="input"?i?o.out:o.in:o.out;Z(c,t,r);let a=t.seen.get(e);a.ref=c},"pipeProcessor"),il=s((e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},"readonlyProcessor"),sl=s((e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},"promiseProcessor"),qo=s((e,t,n,r)=>{let o=e._zod.def;Z(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},"optionalProcessor"),cl=s((e,t,n,r)=>{let o=e._zod.innerType;Z(o,t,r);let i=t.seen.get(e);i.ref=o},"lazyProcessor"),Wo={string:ku,number:Su,boolean:Pu,bigint:zu,symbol:Ou,null:Eu,undefined:Iu,void:Au,never:Nu,any:Cu,unknown:Tu,date:Du,enum:Zu,literal:Lu,nan:Ru,template_literal:ju,file:Mu,success:Fu,custom:Uu,function:Vu,transform:Ku,map:Hu,set:Bu,array:Ju,object:Wu,union:Xo,intersection:Xu,tuple:qu,record:Gu,nullable:Yu,nonoptional:Qu,default:tl,prefault:nl,catch:rl,pipe:ol,readonly:il,promise:sl,optional:qo,lazy:cl};function Go(e,t){if("_idmap"in e){let r=e,o=Fe({...t,processors:Wo}),i={};for(let u of r._idmap.entries()){let[l,f]=u;Z(f,o)}let c={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(let u of r._idmap.entries()){let[l,f]=u;Ue(o,f),J(c,l,Ve(o,f))}if(Object.keys(i).length>0){let u=o.target==="draft-2020-12"?"$defs":"definitions";c.__shared={[u]:i}}return{schemas:c}}let n=Fe({...t,processors:Wo});return Z(e,n),Ue(n,e),Ve(n,e)}s(Go,"toJSONSchema");var Yo=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 n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Fe({processors:Wo,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return Z(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Ue(this.ctx,t);let r=Ve(this.ctx,t),{"~standard":o,...i}=r;return i}};var pd={};var sn={};Pe(sn,{ZodAny:()=>El,ZodArray:()=>Cl,ZodBase64:()=>_i,ZodBase64URL:()=>yi,ZodBigInt:()=>rn,ZodBigIntFormat:()=>vi,ZodBoolean:()=>nn,ZodCIDRv4:()=>hi,ZodCIDRv6:()=>gi,ZodCUID:()=>ai,ZodCUID2:()=>ui,ZodCatch:()=>ef,ZodCodec:()=>ur,ZodCreditCard:()=>vl,ZodCustom:()=>lr,ZodCustomStringFormat:()=>mt,ZodDate:()=>rr,ZodDefault:()=>Wl,ZodDiscriminatedUnion:()=>Dl,ZodE164:()=>wi,ZodEmail:()=>oi,ZodEmoji:()=>si,ZodEnum:()=>Qt,ZodExactOptional:()=>Si,ZodFile:()=>Kl,ZodFunction:()=>ff,ZodGUID:()=>ii,ZodIBAN:()=>$l,ZodIPv4:()=>di,ZodIPv6:()=>mi,ZodISODate:()=>He,ZodISODateTime:()=>Ke,ZodISODuration:()=>Je,ZodISOTime:()=>Be,ZodInstanceOf:()=>mf,ZodIntersection:()=>Zl,ZodJWT:()=>bi,ZodKSUID:()=>pi,ZodLazy:()=>af,ZodLiteral:()=>Vl,ZodMAC:()=>bl,ZodMap:()=>Fl,ZodNaN:()=>nf,ZodNanoID:()=>ci,ZodNever:()=>Al,ZodNonOptional:()=>Pi,ZodNull:()=>zl,ZodNullable:()=>Jl,ZodNumber:()=>tn,ZodNumberFormat:()=>ht,ZodObject:()=>ir,ZodOptional:()=>cr,ZodPipe:()=>ar,ZodPrefault:()=>ql,ZodPreprocess:()=>rf,ZodPromise:()=>lf,ZodReadonly:()=>of,ZodRecord:()=>Yt,ZodSet:()=>Ul,ZodString:()=>en,ZodStringFormat:()=>L,ZodSuccess:()=>Ql,ZodSymbol:()=>Sl,ZodTemplateLiteral:()=>cf,ZodTransform:()=>Hl,ZodTuple:()=>Rl,ZodType:()=>E,ZodULID:()=>li,ZodURL:()=>nr,ZodUUID:()=>$e,ZodUndefined:()=>Pl,ZodUnion:()=>sr,ZodUnknown:()=>Il,ZodVoid:()=>Nl,ZodXID:()=>fi,ZodXor:()=>Tl,_ZodString:()=>ri,_default:()=>Xl,_function:()=>km,any:()=>tm,array:()=>or,base64:()=>Dd,base64url:()=>Zd,bigint:()=>qd,boolean:()=>kl,catch:()=>tf,check:()=>Sm,cidrv4:()=>Cd,cidrv6:()=>Td,codec:()=>bm,creditCard:()=>Rd,cuid:()=>Sd,cuid2:()=>Pd,currencyCode:()=>Kd,custom:()=>Pm,date:()=>rm,describe:()=>zm,discriminatedUnion:()=>um,e164:()=>Ld,email:()=>hd,emoji:()=>xd,enum:()=>xi,exactOptional:()=>Bl,file:()=>gm,float32:()=>Bd,float64:()=>Jd,function:()=>km,guid:()=>gd,hash:()=>Hd,hex:()=>Vd,hostname:()=>Ud,httpUrl:()=>$d,iban:()=>jd,instanceof:()=>Em,int:()=>ti,int32:()=>Wd,int64:()=>Gd,intersection:()=>Ll,invertCodec:()=>vm,ipv4:()=>Id,ipv6:()=>Nd,json:()=>Am,jwt:()=>Md,keyof:()=>om,ksuid:()=>Ed,lazy:()=>uf,literal:()=>hm,looseObject:()=>cm,looseRecord:()=>fm,mac:()=>Ad,map:()=>pm,meta:()=>Om,nan:()=>wm,nanoid:()=>kd,nativeEnum:()=>mm,never:()=>$i,nonoptional:()=>Yl,null:()=>Ol,nullable:()=>tr,nullish:()=>_m,number:()=>xl,object:()=>im,optional:()=>pt,partialRecord:()=>lm,pipe:()=>ni,prefault:()=>Gl,preprocess:()=>Nm,promise:()=>xm,readonly:()=>sf,record:()=>Ml,refine:()=>pf,set:()=>dm,strictObject:()=>sm,string:()=>er,stringFormat:()=>Fd,stringbool:()=>Im,success:()=>ym,superRefine:()=>df,symbol:()=>Qd,templateLiteral:()=>$m,transform:()=>ki,tuple:()=>jl,uint32:()=>Xd,uint64:()=>Yd,ulid:()=>zd,undefined:()=>em,union:()=>on,unknown:()=>ft,url:()=>vd,uuid:()=>_d,uuidv4:()=>yd,uuidv6:()=>wd,uuidv7:()=>bd,void:()=>nm,xid:()=>Od,xor:()=>am});var Qo={};Pe(Qo,{endsWith:()=>Ft,gt:()=>be,gte:()=>pe,includes:()=>jt,length:()=>ut,lowercase:()=>Lt,lt:()=>we,lte:()=>fe,maxLength:()=>at,maxSize:()=>Me,mime:()=>Vt,minLength:()=>Ie,minSize:()=>ve,multipleOf:()=>je,negative:()=>Ko,nonnegative:()=>Bo,nonpositive:()=>Ho,normalize:()=>Kt,overwrite:()=>ye,positive:()=>Vo,properties:()=>Ut,property:()=>Jo,regex:()=>Zt,size:()=>ct,slugify:()=>Wt,startsWith:()=>Mt,toLowerCase:()=>Bt,toUpperCase:()=>Jt,trim:()=>Ht,uppercase:()=>Rt});var dd=new WeakSet([Object.prototype,Error.prototype]);function ei(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}s(ei,"_lazyMethod");var md=s((e,t)=>{cs.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);dd.has(n)||(dd.add(n),ei(n,"format",r=>o=>Pn(r,o)),ei(n,"flatten",r=>o=>Sn(r,o)),ei(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,xt,2)}),ei(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,xt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),lb=h("ZodError",md),ue=h("ZodError",md,void 0,{Parent:Error});var al=Ot(ue),ul=Et(ue),ll=It(ue),fl=At(ue),pl=Ar(ue),dl=Nr(ue),ml=Cr(ue),hl=Tr(ue),gl=Dr(ue),_l=Zr(ue),yl=Lr(ue),wl=Rr(ue);function pb(){B.localeError||U(Hn())}s(pb,"_ensureDefaultLocale");function dt(){B.memoizer||U({memoizer:Kn()})}s(dt,"_ensureDefaultMemoizer");var E=h("ZodType",(e,t)=>(pb(),z.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(x.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return T(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(pf(e,t))},superRefine(e,t){return this.check(df(e,t))},overwrite(e){return this.check(ye(e))},optional(){return pt(this)},exactOptional(){return Bl(this)},nullable(){return tr(this)},nullish(){return pt(tr(this))},nonoptional(e){return Yl(this,e)},array(){return or(this)},or(e){return on([this,e])},and(e){return Ll(this,e)},transform(e){return ni(this,ki(e))},default(e){return Xl(this,e)},prefault(e){return Gl(this,e)},catch(e){return tf(this,e)},pipe(e){return ni(this,e)},readonly(){return sf(this)},describe(e){let t=this.clone();return W.add(t,{description:e}),t},meta(...e){if(e.length===0)return W.get(this);let t=this.clone();return W.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 x.hide(this,"~standard",{...Xr(this),jsonSchema:{input:Xt(this,"input"),output:Xt(this,"output")}})},set"~standard"(e){x.own(this,"~standard",e)},parse:s(function e(t,n){return al(this,t,n,{callee:e})},"_parse"),parseAsync:s(async function e(t,n){return await ul(this,t,n,{callee:e})},"_parseAsync"),safeParse(e,t){return ll(this,e,t)},async safeParseAsync(e,t){return fl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){x.own(this,"spa",e)},validate(e,t){return zn(this,e,t)},validateAsync(e,t){return On(this,e,t)},encode:s(function e(t,n){return pl(this,t,n,{callee:e})},"_encode"),decode:s(function e(t,n){return dl(this,t,n,{callee:e})},"_decode"),encodeAsync:s(async function e(t,n){return await ml(this,t,n,{callee:e})},"_encodeAsync"),decodeAsync:s(async function e(t,n){return await hl(this,t,n,{callee:e})},"_decodeAsync"),safeEncode(e,t){return gl(this,e,t)},safeDecode(e,t){return _l(this,e,t)},async safeEncodeAsync(e,t){return yl(this,e,t)},async safeDecodeAsync(e,t){return wl(this,e,t)},toJSONSchema(e){return vu(this,{})(e)},get description(){return W.get(this)?.description},get _def(){return this._zod.def}}),ri=h("_ZodString",(e,t)=>{rt.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ku(e,n,r,o)},x.derived({format:s(e=>K(e).format??null,"format"),minLength:s(e=>K(e).minimum??null,"minLength"),maxLength:s(e=>K(e).maximum??null,"maxLength")},{regex(...e){return this.check(Zt(...e))},includes(...e){return this.check(jt(...e))},startsWith(...e){return this.check(Mt(...e))},endsWith(...e){return this.check(Ft(...e))},min(...e){return this.check(Ie(...e))},max(...e){return this.check(at(...e))},length(...e){return this.check(ut(...e))},nonempty(...e){return this.check(Ie(1,...e))},lowercase(e){return this.check(Lt(e))},uppercase(e){return this.check(Rt(e))},trim(){return this.check(Ht())},normalize(...e){return this.check(Kt(...e))},toLowerCase(){return this.check(Bt())},toUpperCase(){return this.check(Jt())},slugify(){return this.check(Wt())}})),en=h("ZodString",(e,t)=>{rt.init(e,t),ri.init(e,t)},{email(e){return this.check($o(oi,e))},url(e){return this.check(Jn(nr,e))},jwt(e){return this.check(Uo(bi,e))},emoji(e){return this.check(Oo(si,e))},guid(e){return this.check(xo(ii,e))},uuid(e){return this.check(ko($e,e))},uuidv4(e){return this.check(So($e,e))},uuidv6(e){return this.check(Po($e,e))},uuidv7(e){return this.check(zo($e,e))},nanoid(e){return this.check(Eo(ci,e))},cuid(e){return this.check(Io(ai,e))},cuid2(e){return this.check(Ao(ui,e))},ulid(e){return this.check(No(li,e))},base64(e){return this.check(jo(_i,e))},base64url(e){return this.check(Mo(yi,e))},xid(e){return this.check(Co(fi,e))},ksuid(e){return this.check(To(pi,e))},ipv4(e){return this.check(Do(di,e))},ipv6(e){return this.check(Zo(mi,e))},cidrv4(e){return this.check(Lo(hi,e))},cidrv6(e){return this.check(Ro(gi,e))},e164(e){return this.check(Fo(wi,e))},datetime(e){return this.check(Wn(Ke,e))},date(e){return this.check(Xn(He,e))},time(e){return this.check(qn(Be,e))},duration(e){return this.check(Gn(Je,e))}});function er(e){return La(en,e)}s(er,"string");var L=h("ZodStringFormat",(e,t)=>{D.init(e,t),ri.init(e,t)}),Ke=h("ZodISODateTime",(e,t)=>{zc.init(e,t),L.init(e,t)}),He=h("ZodISODate",(e,t)=>{Oc.init(e,t),L.init(e,t)}),Be=h("ZodISOTime",(e,t)=>{Ec.init(e,t),L.init(e,t)}),Je=h("ZodISODuration",(e,t)=>{Ic.init(e,t),L.init(e,t)}),oi=h("ZodEmail",(e,t)=>{gc.init(e,t),L.init(e,t)});function hd(e){return $o(oi,e)}s(hd,"email");var ii=h("ZodGUID",(e,t)=>{mc.init(e,t),L.init(e,t)});function gd(e){return xo(ii,e)}s(gd,"guid");var $e=h("ZodUUID",(e,t)=>{hc.init(e,t),L.init(e,t)});function _d(e){return ko($e,e)}s(_d,"uuid");function yd(e){return So($e,e)}s(yd,"uuidv4");function wd(e){return Po($e,e)}s(wd,"uuidv6");function bd(e){return zo($e,e)}s(bd,"uuidv7");var nr=h("ZodURL",(e,t)=>{wc.init(e,t),L.init(e,t)});function vd(e){return Jn(nr,e)}s(vd,"url");function $d(e){return Jn(nr,{protocol:En,hostname:Is,...x.normalizeParams(e)})}s($d,"httpUrl");var si=h("ZodEmoji",(e,t)=>{bc.init(e,t),L.init(e,t)});function xd(e){return Oo(si,e)}s(xd,"emoji");var ci=h("ZodNanoID",(e,t)=>{vc.init(e,t),L.init(e,t)});function kd(e){return Eo(ci,e)}s(kd,"nanoid");var ai=h("ZodCUID",(e,t)=>{$c.init(e,t),L.init(e,t)});function Sd(e){return Io(ai,e)}s(Sd,"cuid");var ui=h("ZodCUID2",(e,t)=>{xc.init(e,t),L.init(e,t)});function Pd(e){return Ao(ui,e)}s(Pd,"cuid2");var li=h("ZodULID",(e,t)=>{kc.init(e,t),L.init(e,t)});function zd(e){return No(li,e)}s(zd,"ulid");var fi=h("ZodXID",(e,t)=>{Sc.init(e,t),L.init(e,t)});function Od(e){return Co(fi,e)}s(Od,"xid");var pi=h("ZodKSUID",(e,t)=>{Pc.init(e,t),L.init(e,t)});function Ed(e){return To(pi,e)}s(Ed,"ksuid");var di=h("ZodIPv4",(e,t)=>{Ac.init(e,t),L.init(e,t)});function Id(e){return Do(di,e)}s(Id,"ipv4");var bl=h("ZodMAC",(e,t)=>{Cc.init(e,t),L.init(e,t)});function Ad(e){return ja(bl,e)}s(Ad,"mac");var mi=h("ZodIPv6",(e,t)=>{Nc.init(e,t),L.init(e,t)});function Nd(e){return Zo(mi,e)}s(Nd,"ipv6");var hi=h("ZodCIDRv4",(e,t)=>{Tc.init(e,t),L.init(e,t)});function Cd(e){return Lo(hi,e)}s(Cd,"cidrv4");var gi=h("ZodCIDRv6",(e,t)=>{Dc.init(e,t),L.init(e,t)});function Td(e){return Ro(gi,e)}s(Td,"cidrv6");var _i=h("ZodBase64",(e,t)=>{Zc.init(e,t),L.init(e,t)});function Dd(e){return jo(_i,e)}s(Dd,"base64");var yi=h("ZodBase64URL",(e,t)=>{Lc.init(e,t),L.init(e,t)});function Zd(e){return Mo(yi,e)}s(Zd,"base64url");var wi=h("ZodE164",(e,t)=>{Rc.init(e,t),L.init(e,t)});function Ld(e){return Fo(wi,e)}s(Ld,"e164");var vl=h("ZodCreditCard",(e,t)=>{jc.init(e,t),L.init(e,t)});function Rd(e){return Ma(vl,e)}s(Rd,"creditCard");var $l=h("ZodIBAN",(e,t)=>{Mc.init(e,t),L.init(e,t)});function jd(e){return Fa($l,e)}s(jd,"iban");var bi=h("ZodJWT",(e,t)=>{Fc.init(e,t),L.init(e,t)});function Md(e){return Uo(bi,e)}s(Md,"jwt");var mt=h("ZodCustomStringFormat",(e,t)=>{Uc.init(e,t),L.init(e,t)});function Fd(e,t,n={}){return lt(mt,e,t,n)}s(Fd,"stringFormat");function Ud(e){return lt(mt,"hostname",Es,e)}s(Ud,"hostname");function Vd(e){return lt(mt,"hex",Ks,e)}s(Vd,"hex");function Kd(e){return lt(mt,"currency_code",Ns,e)}s(Kd,"currencyCode");function Hd(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,o=he[r];if(!o)throw new Error(`Unrecognized hash format: ${r}`);return lt(mt,r,o,t)}s(Hd,"hash");var tn=h("ZodNumber",(e,t)=>{io.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Su(e,n,r,o),e.isFinite=!0},x.derived({minValue:s(e=>{let{minimum:t,exclusiveMinimum:n}=K(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},"minValue"),maxValue:s(e=>{let{maximum:t,exclusiveMaximum:n}=K(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},"maxValue"),isInt:s(e=>{let{isInt:t,multipleOf:n}=K(e);return!!t||!!n?.some(Number.isSafeInteger)},"isInt"),format:s(e=>K(e).format??null,"format")},{gt(e,t){return this.check(be(e,t))},gte(e,t){return this.check(pe(e,t))},min(e,t){return this.check(pe(e,t))},lt(e,t){return this.check(we(e,t))},lte(e,t){return this.check(fe(e,t))},max(e,t){return this.check(fe(e,t))},int(e){return this.check(ti(e))},safe(e){return this.check(ti(e))},positive(e){return this.check(be(0,e))},nonnegative(e){return this.check(pe(0,e))},negative(e){return this.check(we(0,e))},nonpositive(e){return this.check(fe(0,e))},multipleOf(e,t){return this.check(je(e,t))},step(e,t){return this.check(je(e,t))},finite(){return this}}));function xl(e){return Va(tn,e)}s(xl,"number");var ht=h("ZodNumberFormat",(e,t)=>{Vc.init(e,t),tn.init(e,t)});function ti(e){return Ha(ht,e)}s(ti,"int");function Bd(e){return Ba(ht,e)}s(Bd,"float32");function Jd(e){return Ja(ht,e)}s(Jd,"float64");function Wd(e){return Wa(ht,e)}s(Wd,"int32");function Xd(e){return Xa(ht,e)}s(Xd,"uint32");var nn=h("ZodBoolean",(e,t)=>{Rn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pu(e,n,r,o)});function kl(e){return qa(nn,e)}s(kl,"boolean");var rn=h("ZodBigInt",(e,t)=>{so.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zu(e,n,r,o)},x.derived({minValue:s(e=>K(e).minimum??null,"minValue"),maxValue:s(e=>K(e).maximum??null,"maxValue"),format:s(e=>K(e).format??null,"format")},{gte(e,t){return this.check(pe(e,t))},min(e,t){return this.check(pe(e,t))},gt(e,t){return this.check(be(e,t))},lt(e,t){return this.check(we(e,t))},lte(e,t){return this.check(fe(e,t))},max(e,t){return this.check(fe(e,t))},positive(e){return this.check(be(BigInt(0),e))},negative(e){return this.check(we(BigInt(0),e))},nonpositive(e){return this.check(fe(BigInt(0),e))},nonnegative(e){return this.check(pe(BigInt(0),e))},multipleOf(e,t){return this.check(je(e,t))}}));function qd(e){return Ya(rn,e)}s(qd,"bigint");var vi=h("ZodBigIntFormat",(e,t)=>{Kc.init(e,t),rn.init(e,t)});function Gd(e){return eu(vi,e)}s(Gd,"int64");function Yd(e){return tu(vi,e)}s(Yd,"uint64");var Sl=h("ZodSymbol",(e,t)=>{Hc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ou(e,n,r,o)});function Qd(e){return nu(Sl,e)}s(Qd,"symbol");var Pl=h("ZodUndefined",(e,t)=>{Bc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Iu(e,n,r,o)});function em(e){return ru(Pl,e)}s(em,"_undefined");var zl=h("ZodNull",(e,t)=>{Jc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eu(e,n,r,o)});function Ol(e){return ou(zl,e)}s(Ol,"_null");var El=h("ZodAny",(e,t)=>{Wc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cu(e,n,r,o)});function tm(){return iu(El)}s(tm,"any");var Il=h("ZodUnknown",(e,t)=>{Xc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tu(e,n,r,o)});function ft(){return su(Il)}s(ft,"unknown");var Al=h("ZodNever",(e,t)=>{qc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nu(e,n,r,o)});function $i(e){return cu(Al,e)}s($i,"never");var Nl=h("ZodVoid",(e,t)=>{Gc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Au(e,n,r,o)});function nm(e){return au(Nl,e)}s(nm,"_void");var rr=h("ZodDate",(e,t)=>{Yc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Du(e,n,r,o),e.min=(n,r)=>e.check(pe(n,r)),e.max=(n,r)=>e.check(fe(n,r))},x.derived({minDate:s(e=>{let{minimum:t}=K(e);return t?new Date(t):null},"minDate"),maxDate:s(e=>{let{maximum:t}=K(e);return t?new Date(t):null},"maxDate")},{}));function rm(e){return uu(rr,e)}s(rm,"date");var Cl=h("ZodArray",(e,t)=>{dt(),ea.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ju(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Ie(e,t))},nonempty(e){return this.check(Ie(1,e))},max(e,t){return this.check(at(e,t))},length(e,t){return this.check(ut(e,t))},unwrap(){return this.element}});function or(e,t){return pu(Cl,e,t)}s(or,"array");function om(e){let t=e._zod.def.shape;return xi(Object.keys(t))}s(om,"keyof");var ir=h("ZodObject",(e,t)=>{dt(),ta.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wu(e,n,r,o),x.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return xi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(x.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(x.mergeDefs(this._zod.def,{catchall:ft()}))},loose(){return this.clone(x.mergeDefs(this._zod.def,{catchall:ft()}))},strict(){return this.clone(x.mergeDefs(this._zod.def,{catchall:$i()}))},strip(){return this.clone(x.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return x.extend(this,e)},safeExtend(e){return x.safeExtend(this,e)},merge(e){return x.merge(this,e)},pick(e){return x.pick(this,e)},omit(e){return x.omit(this,e)},partial(...e){return x.partial(cr,this,e[0])},exactPartial(...e){return x.partial(Si,this,e[0],"exactPartial")},required(...e){return x.required(Pi,this,e[0])}});function im(e,t){let n={type:"object",shape:e??{},...x.normalizeParams(t)};return new ir(n)}s(im,"object");function sm(e,t){return new ir({type:"object",shape:e,catchall:$i(),...x.normalizeParams(t)})}s(sm,"strictObject");function cm(e,t){return new ir({type:"object",shape:e,catchall:ft(),...x.normalizeParams(t)})}s(cm,"looseObject");var sr=h("ZodUnion",(e,t)=>{jn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xo(e,n,r,o),e.options=t.options});function on(e,t){return new sr({type:"union",options:e,...x.normalizeParams(t)})}s(on,"union");var Tl=h("ZodXor",(e,t)=>{sr.init(e,t),na.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xo(e,n,r,o),e.options=t.options});function am(e,t){return new Tl({type:"union",options:e,inclusive:!1,...x.normalizeParams(t)})}s(am,"xor");var Dl=h("ZodDiscriminatedUnion",(e,t)=>{sr.init(e,t),oa.init(e,t)});function um(e,t,n){return new Dl({type:"union",options:t,discriminator:e,...x.normalizeParams(n)})}s(um,"discriminatedUnion");var Zl=h("ZodIntersection",(e,t)=>{ia.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xu(e,n,r,o)});function Ll(e,t){return new Zl({type:"intersection",left:e,right:t})}s(Ll,"intersection");var Rl=h("ZodTuple",(e,t)=>{dt(),co.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qu(e,n,r,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 cr({type:"optional",innerType:t}))})}});function jl(e,t,n){let r=t instanceof z,o=r?n:t,i=r?t:null;return new Rl({type:"tuple",items:e,rest:i,...x.normalizeParams(o)})}s(jl,"tuple");var Yt=h("ZodRecord",(e,t)=>{dt(),sa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gu(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ml(e,t,n){return!t||!t._zod?new Yt({type:"record",keyType:er(),valueType:e,...x.normalizeParams(t)}):new Yt({type:"record",keyType:e,valueType:t,...x.normalizeParams(n)})}s(Ml,"record");function lm(e,t,n){return new Yt({type:"record",keyType:e,valueType:t,...x.normalizeParams(n),partial:!0})}s(lm,"partialRecord");function fm(e,t,n){return new Yt({type:"record",keyType:e,valueType:t,mode:"loose",...x.normalizeParams(n)})}s(fm,"looseRecord");var Fl=h("ZodMap",(e,t)=>{dt(),ca.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hu(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(ve(...n)),e.nonempty=n=>e.check(ve(1,n)),e.max=(...n)=>e.check(Me(...n)),e.size=(...n)=>e.check(ct(...n))});function pm(e,t,n){return new Fl({type:"map",keyType:e,valueType:t,...x.normalizeParams(n)})}s(pm,"map");var Ul=h("ZodSet",(e,t)=>{dt(),aa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bu(e,n,r,o),e.min=(...n)=>e.check(ve(...n)),e.nonempty=n=>e.check(ve(1,n)),e.max=(...n)=>e.check(Me(...n)),e.size=(...n)=>e.check(ct(...n))});function dm(e,t){return new Ul({type:"set",valueType:e,...x.normalizeParams(t)})}s(dm,"set");var Qt=h("ZodEnum",(e,t)=>{ua.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Zu(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let c of r)if(n.has(c))i[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new Qt({...t,checks:[],...x.normalizeParams(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let c of r)if(n.has(c))delete i[c];else throw new Error(`Key ${c} not found in enum`);return new Qt({...t,checks:[],...x.normalizeParams(o),entries:i})}});function xi(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Qt({type:"enum",entries:n,...x.normalizeParams(t)})}s(xi,"_enum");function mm(e,t){return new Qt({type:"enum",entries:e,...x.normalizeParams(t)})}s(mm,"nativeEnum");var Vl=h("ZodLiteral",(e,t)=>{la.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lu(e,n,r,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]}})});function hm(e,t){return new Vl({type:"literal",values:Array.isArray(e)?e:[e],...x.normalizeParams(t)})}s(hm,"literal");var Kl=h("ZodFile",(e,t)=>{fa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mu(e,n,r,o),e.min=(n,r)=>e.check(ve(n,r)),e.max=(n,r)=>e.check(Me(n,r)),e.mime=(n,r)=>e.check(Vt(Array.isArray(n)?n:[n],r))});function gm(e){return du(Kl,e)}s(gm,"file");var Hl=h("ZodTransform",(e,t)=>{dt(),pa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ku(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Le(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(x.issue(i,n.value,t));else{let c=i;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),"input"in c||(c.input=n.value),c.inst??(c.inst=e),n.issues.push(x.issue(c))}};let o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function ki(e){return new Hl({type:"transform",transform:e})}s(ki,"transform");var cr=h("ZodOptional",(e,t)=>{ao.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qo(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function pt(e){return new cr({type:"optional",innerType:e})}s(pt,"optional");var Si=h("ZodExactOptional",(e,t)=>{da.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qo(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Bl(e){return new Si({type:"optional",innerType:e})}s(Bl,"exactOptional");var Jl=h("ZodNullable",(e,t)=>{ma.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function tr(e){return new Jl({type:"nullable",innerType:e})}s(tr,"nullable");function _m(e){return pt(tr(e))}s(_m,"nullish");var Wl=h("ZodDefault",(e,t)=>{ha.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Xl(e,t){return new Wl({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():x.shallowClone(t)}})}s(Xl,"_default");var ql=h("ZodPrefault",(e,t)=>{ga.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gl(e,t){return new ql({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():x.shallowClone(t)}})}s(Gl,"prefault");var Pi=h("ZodNonOptional",(e,t)=>{_a.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Yl(e,t){return new Pi({type:"nonoptional",innerType:e,...x.normalizeParams(t)})}s(Yl,"nonoptional");var Ql=h("ZodSuccess",(e,t)=>{ya.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ym(e){return new Ql({type:"success",innerType:e})}s(ym,"success");var ef=h("ZodCatch",(e,t)=>{wa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function tf(e,t){return new ef({type:"catch",innerType:e,catchValue:typeof t=="function"?t:x.constantCatch(t)})}s(tf,"_catch");var nf=h("ZodNaN",(e,t)=>{ba.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ru(e,n,r,o)});function wm(e){return fu(nf,e)}s(wm,"nan");var ar=h("ZodPipe",(e,t)=>{uo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ol(e,n,r,o),e.in=t.in,e.out=t.out});function ni(e,t){return new ar({type:"pipe",in:e,out:t})}s(ni,"pipe");var ur=h("ZodCodec",(e,t)=>{ar.init(e,t),Mn.init(e,t)});function bm(e,t,n){return new ur({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}s(bm,"codec");function vm(e){let t=e._zod.def;return new ur({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}s(vm,"invertCodec");var rf=h("ZodPreprocess",(e,t)=>{ar.init(e,t),va.init(e,t)}),of=h("ZodReadonly",(e,t)=>{$a.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>il(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sf(e){return new of({type:"readonly",innerType:e})}s(sf,"readonly");var cf=h("ZodTemplateLiteral",(e,t)=>{xa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ju(e,n,r,o)});function $m(e,t){return new cf({type:"template_literal",parts:e,...x.normalizeParams(t)})}s($m,"templateLiteral");var af=h("ZodLazy",(e,t)=>{Fn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cl(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function uf(e){return new af({type:"lazy",getter:e})}s(uf,"lazy");var lf=h("ZodPromise",(e,t)=>{Sa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function xm(e){return new lf({type:"promise",innerType:e})}s(xm,"promise");var ff=h("ZodFunction",(e,t)=>{ka.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vu(e,n,r,o)});function km(e){return new ff({type:"function",input:Array.isArray(e?.input)?jl(e?.input):e?.input??or(ft()),output:e?.output??ft()})}s(km,"_function");var lr=h("ZodCustom",(e,t)=>{Pa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uu(e,n,r,o)});function Sm(e){let t=new R({check:"custom"});return t._zod.check=e,t}s(Sm,"check");function Pm(e,t){return mu(lr,e??(()=>!0),t)}s(Pm,"custom");function pf(e,t={}){return hu(lr,e,t)}s(pf,"refine");function df(e,t){return gu(e,t)}s(df,"superRefine");var zm=_u,Om=yu,mf=h("ZodInstanceOf",(e,t)=>{lr.init(e,t)},{properties(e,t){return this.check(Ut(e,t))}});function Em(e,t={}){let n=new mf({type:"custom",check:"custom",fn:s(r=>r instanceof e,"fn"),abort:!0,...x.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}s(Em,"_instanceof");var Im=s((...e)=>wu({Codec:ur,Boolean:nn,String:en},...e),"stringbool");function Am(e){let t=uf(()=>on([er(e),xl(),kl(),Ol(),or(t),Ml(er(),t)]));return t}s(Am,"json");function Nm(e,t){return new rf({type:"pipe",in:ki(e),out:t})}s(Nm,"preprocess");var db={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function mb(e){U({customError:e})}s(mb,"setErrorMap");function hb(){return U().customError}s(hb,"getErrorMap");var hf;hf||(hf={});var fr={};Pe(fr,{ZodISODate:()=>He,ZodISODateTime:()=>Ke,ZodISODuration:()=>Je,ZodISOTime:()=>Be,date:()=>_b,datetime:()=>gb,duration:()=>wb,time:()=>yb});function gb(e){return Wn(Ke,e)}s(gb,"datetime");function _b(e){return Xn(He,e)}s(_b,"date");function yb(e){return qn(Be,e)}s(yb,"time");function wb(e){return Gn(Je,e)}s(wb,"duration");var v={...sn,...Qo,iso:fr},bb=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function vb(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}s(vb,"detectVersion");function Cm(e,t){return e.map((n,r)=>r<t?n:n.optional())}s(Cm,"applyMinItems");function $b(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}s($b,"decodeJSONPointerSegment");function xb(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let o=n[1]===void 0?void 0:$b(n[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}s(xb,"resolveRef");function kb(e,t){return v.transform(r=>r).check(r=>{let o=r.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&&r.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&&r.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 c of i){let a=t.keySchema.safeParse(c);a.success||r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:c,path:[c],continue:!0})}}).pipe(e)}s(kb,"checkObjectGuards");function gf(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let r=String(e);return`${n[0]}${r.length}:${r}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let c of e){let a=gf(c,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let c=gf(e[i],t);if(c===null)return null;o.push(`${i.length}:${i}=${c}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}s(gf,"canonicalKey");var Sb=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Pb=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function pr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(pr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>Sb.has(t)?pr(n):!Pb.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(pr))}s(pr,"containsRef");function Tm(e){return e===1?"element":"elements"}s(Tm,"plural");function zb(e,t){return v.transform(r=>r).check(r=>{let o=r.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let c=0;c<o.length;c++){let a=gf(o[c],new Set);if(a===null)continue;let u=i.get(a);if(u===void 0){i.set(a,c);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${c} duplicates the one at index ${u}`,input:o,path:[c],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,c=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let u of o)if(t.containsSchema.safeParse(u).success&&++a>=c)break;a<i&&r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Tm(i)}; found ${a}`,input:o,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&r.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Tm(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}s(zb,"checkArrayGuards");function Dm(e,t){if(e!==!1)return e===void 0||e===!0?v.any():ne(e,t)}s(Dm,"getTupleRest");var Ob=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Zm(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return v.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 v.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=xb(o,t),c=ne(i,t);return t.refs.set(o,c),t.processing.delete(o),c}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 v.null();if(o.length===0)return v.never();if(o.length===1)return v.literal(o[0]);if(o.every(c=>typeof c=="string"))return v.enum(o);let i=o.map(c=>v.literal(c));return i.length<2?i[0]:v.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return v.literal(e.const);let n=e.type;if(Array.isArray(n)){let o=n.map(i=>{let c={...e,type:i};return Zm(c,t)});return o.length===0?v.never():o.length===1?o[0]:v.union(o)}if(!n)return v.any();let r;switch(n){case"string":{let o=v.string();if(e.format){let i=e.format;i==="email"?o=o.check(v.email()):i==="uri"||i==="uri-reference"?o=o.check(v.url()):i==="uuid"||i==="guid"?o=o.check(v.uuid()):i==="date-time"?o=o.check(v.iso.datetime({offset:!0})):i==="date"?o=o.check(v.iso.date()):i==="time"?o=o.check(v.regex(Ob)):i==="duration"?o=o.check(v.iso.duration()):i==="hostname"?o=o.check(v.hostname()):i==="ipv4"?o=o.check(v.ipv4()):i==="ipv6"?o=o.check(v.ipv6()):i==="mac"?o=o.check(v.mac()):i==="cidr"?o=o.check(v.cidrv4()):i==="cidr-v6"?o=o.check(v.cidrv6()):i==="base64"?o=o.check(v.base64()):i==="base64url"?o=o.check(v.base64url()):i==="e164"?o=o.check(v.e164()):i==="credit_card"?o=o.check(v.creditCard()):i==="iban"?o=o.check(v.iban()):i==="jwt"?o=o.check(v.jwt()):i==="emoji"?o=o.check(v.emoji()):i==="nanoid"?o=o.check(v.nanoid()):i==="cuid"?o=o.check(v.cuid()):i==="cuid2"?o=o.check(v.cuid2()):i==="ulid"?o=o.check(v.ulid()):i==="xid"?o=o.check(v.xid()):i==="ksuid"&&(o=o.check(v.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))),r=o;break}case"number":case"integer":{let o=n==="integer"?v.number().int():v.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)),r=o;break}case"boolean":{r=v.boolean();break}case"null":{r=v.null();break}case"object":{let o={},i=e.properties||{},c=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?ne(e.additionalProperties,t):void 0;for(let[p,d]of Object.entries(i)){let m=ne(d,t);J(o,p,c.has(p)?m:m.optional())}if(e.patternProperties){let p=e.patternProperties,d=Object.keys(p),m=[];for(let y of d){let b=ne(p[y],t),k=v.string().regex(new RegExp(y));m.push(v.looseRecord(k,b))}let g=[];if(Object.keys(o).length>0&&g.push(v.object(o).passthrough()),g.push(...m),g.length===0)r=v.object({}).passthrough();else if(g.length===1)r=g[0];else{let y=v.intersection(g[0],g[1]);for(let b=2;b<g.length;b++)y=v.intersection(y,g[b]);r=y}if(e.additionalProperties===!1){let y=Object.keys(o),b=d.map($=>new RegExp($)),k=r;r=r.check($=>{if(!de($.value))return;let O=[];for(let C of Object.keys($.value))y.includes(C)||b.some(j=>j.test(C))||O.push(C);O.length&&$.issues.push({code:"unrecognized_keys",keys:O,input:$.value,inst:k})})}}else{let p=v.object(o);e.additionalProperties===!1?r=p.strict():a?r=p.catchall(a):r=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=ne(d,t)}r=kb(r,{keySchema:p,minProperties:l,maxProperties:f})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let c=typeof e.minItems=="number"?e.minItems:0,a=o.map(p=>ne(p,t)),u=Cm(a,c),l=Array.isArray(i)?void 0:Dm(i,t),f=v.tuple(u);r=l?f.rest(l):f,typeof e.minItems=="number"&&(r=r.check(v.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(v.maxLength(e.maxItems)))}else if(Array.isArray(i)){let c=typeof e.minItems=="number"?e.minItems:0,a=i.map(p=>ne(p,t)),u=Cm(a,c),l=Dm(e.additionalItems,t),f=v.tuple(u);r=l?f.rest(l):f,typeof e.minItems=="number"&&(r=r.check(v.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(v.maxLength(e.maxItems)))}else if(i!==void 0){let c=ne(i,t),a=v.array(c);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),r=a}else r=v.array(v.any());(e.uniqueItems===!0||e.contains!==void 0)&&(r=zb(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ne(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: ${n}`)}return r}s(Zm,"convertBaseSchema");function ne(e,t){if(typeof e=="boolean")return e?v.any():v.never();let n=Zm(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(l=>ne(l,t)),u=v.union(a);n=r?v.intersection(n,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(l=>ne(l,t)),u=v.xor(a);n=r?v.intersection(n,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:v.any();else{let a=r?n:ne(e.allOf[0],t),u=r?0:1;for(let l=u;l<e.allOf.length;l++)a=v.intersection(a,ne(e.allOf[l],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=v.nullable(n)),e.readOnly===!0&&(n=v.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in e&&(o[a]=e[a]);let c=["contentEncoding","contentMediaType","contentSchema"];for(let a of c)a in e&&(o[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!pr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(o[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!pr(e.contains)&&(o.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(o[a]=e[a])}for(let a of Object.keys(e))bb.has(a)||J(o,a,e[a]);return Object.keys(o).length>0&&t.registry.add(n,o),e.description&&(n=n.describe(e.description)),n}s(ne,"convertSchema");function Lm(e,t){if(typeof e=="boolean")return e?v.any():v.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=vb(n,t?.defaultTarget),o=n.$defs||n.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??W};return ne(n,i)}s(Lm,"fromJSONSchema");var Rm=Symbol("z.visit/resolving");function dr(e,t){let n=typeof t=="function"?t:(c,a)=>{let u=t[c._zod.def.type];return u?u(c,a):c},r=new Map;function o(c){let a=r.get(c);if(a===Rm)return new Fn({type:"lazy",getter:s(()=>r.get(c),"getter")});if(a!==void 0)return a;r.set(c,Rm);let u=i(c),l=n(u,u!==c);return r.set(c,l),l}s(o,"run");function i(c){let a=c._zod.def,u=a.type;switch(u){case"object":{let l=a.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=a.catchall;return a.catchall&&(m=o(a.catchall),m!==a.catchall&&(p=!0)),p?T(c,{...a,shape:d,catchall:m}):c}case"array":{let l=o(a.element);return l===a.element?c:T(c,{...a,element:l})}case"tuple":{let l=a.items,f=!1,p=[];for(let m of l){let g=o(m);g!==m&&(f=!0),p.push(g)}let d=a.rest;return a.rest&&(d=o(a.rest),d!==a.rest&&(f=!0)),f?T(c,{...a,items:p,rest:d}):c}case"record":case"map":{let l=o(a.keyType),f=o(a.valueType);return l===a.keyType&&f===a.valueType?c:T(c,{...a,keyType:l,valueType:f})}case"set":{let l=o(a.valueType);return l===a.valueType?c:T(c,{...a,valueType:l})}case"union":{let l=a.options,f=!1,p=[];for(let d of l){let m=o(d);m!==d&&(f=!0),p.push(m)}return f?T(c,{...a,options:p}):c}case"intersection":{let l=o(a.left),f=o(a.right);return l===a.left&&f===a.right?c:T(c,{...a,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(a.innerType);return l===a.innerType?c:T(c,{...a,innerType:l})}case"pipe":{let l=o(a.in),f=o(a.out);return l===a.in&&f===a.out?c:T(c,{...a,in:l,out:f})}case"function":{let l=o(a.input),f=o(a.output);return l===a.input&&f===a.output?c:T(c,{...a,input:l,output:f})}case"lazy":{let l=a.getter,{_cachedInner:f,...p}=a;return T(c,{...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 c;default:return c}}return s(i,"mapInner"),o(e)}s(dr,"visit");function jm(e){return dr(e,{object:s(t=>t.partial(),"object"),union:s(t=>{let n=t._zod.def;return n.discriminator===void 0?t:on(n.options)},"union")})}s(jm,"deepPartial");function Eb(e,t){if(!t?.length)return e;let n=e._zod.def;return T(e,ge(n,{checks:[...n.checks??[],...t]}),{parent:!0})}s(Eb,"withChecks");function Mm(e){return Eb(e.out,e.checks)}s(Mm,"outSide");function Ib(e){return e.in._zod.traits.has("$ZodTransform")?Mm(e):e.in}s(Ib,"inSide");function Fm(e){return dr(e,{pipe:s(t=>Ib(t._zod.def),"pipe"),default:s((t,n)=>n?pt(t._zod.def.innerType):t,"default"),catch:s((t,n)=>n?t._zod.def.innerType:t,"catch")})}s(Fm,"input");function Um(e){return dr(e,{pipe:s(t=>Mm(t._zod.def),"pipe"),prefault:s((t,n)=>n?t._zod.def.innerType:t,"prefault")})}s(Um,"output");var _f={};Pe(_f,{bigint:()=>Tb,boolean:()=>Cb,date:()=>Db,number:()=>Nb,string:()=>Ab});function Ab(e){return Ra(en,e)}s(Ab,"string");function Nb(e){return Ka(tn,e)}s(Nb,"number");function Cb(e){return Ga(nn,e)}s(Cb,"boolean");function Tb(e){return Qa(rn,e)}s(Tb,"bigint");function Db(e){return lu(rr,e)}s(Db,"date");import vv from"node:path";var kv=vr(Oi());var Sv=vr(zf());import{spawn as Pv,spawnSync as zv}from"node:child_process";import{accessSync as Ov,constants as Zh,existsSync as Ev,readdirSync as Iv,realpathSync as Lh,statSync as Av}from"node:fs";import{createRequire as Nv}from"node:module";import{homedir as Gh}from"node:os";import{basename as Ai,delimiter as Af,dirname as xe,extname as Cv,isAbsolute as Ei,join as re}from"node:path";import{fileURLToPath as Tv}from"node:url";import Of from"node:fs";import hr from"node:path";import mr from"node:process";import{AsyncLocalStorage as Kh}from"node:async_hooks";import{availableParallelism as r$}from"node:os";function Jh(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(Jh,"experimental_defineHostEntry");function av(e){if(e.length===0)return!1;let t=e.replaceAll("\\","/"),n=/^[a-zA-Z]:\//u.exec(t),r=n?t.slice(n[0].length):t.slice(1);return!n&&!t.startsWith("/")?!1:r.split("/").every(o=>o!==""&&o!=="."&&o!=="..")}s(av,"isAbsoluteProviderSkillRootPath");function Wh(e){if(e.length===0)return!1;let t=e.replaceAll("\\","/");return!t.startsWith("/")&&!/^[a-zA-Z]:\//u.test(t)&&t.split("/").every(n=>n!==""&&n!=="."&&n!=="..")}s(Wh,"isRelativeProviderSkillRootPath");var uv=32,lv=/^[A-Za-z0-9][A-Za-z0-9._-]{0,62}:$/u,Cf=_.string().refine(e=>e===""||lv.test(e),"A root name prefix is a plugin-name-like token ending in ':'"),Tf=_.string().min(1).refine(Wh,"A manifest marker is a relative path without dot segments"),fv=_.string().min(1).refine(Wh,"Roots must be relative paths without dot segments"),pv=_.string().min(1).refine(av,"Absolute roots must be absolute paths without dot segments"),Eh=_.union([_.string().min(1),_.object({path:_.string().min(1),recursive:_.boolean().optional(),ancestors:_.boolean().optional(),namePrefix:Cf.optional(),skipIfManifest:Tf.optional()}).strict()]),$P=_.object({user:_.array(Eh).optional(),project:_.array(Eh).optional()}).strict(),dv=_.object({path:_.string().min(1),recursive:_.boolean(),ancestors:_.boolean(),namePrefix:Cf,skipIfManifest:Tf.optional()}).strict();function mv(e){return new Set(e.map(t=>t.path)).size===e.length}s(mv,"uniqueByPath");function Ih(e){return _.array(dv.extend({path:fv}).superRefine((t,n)=>{t.ancestors&&e!=="project"&&n.addIssue({code:"custom",message:"Only project roots may walk ancestors"})})).max(uv).refine(mv,"Roots must not repeat a path")}s(Ih,"nativeRootSideSchema");var Ah=_.object({user:Ih("user"),project:Ih("project")}).strict(),xP=Object.freeze({user:Object.freeze([]),project:Object.freeze([])}),hv=_.enum(["skills","skill","skill-file","commands","command-file"]),Xh=_.object({path:pv,origin:_.enum(["user","project"]),recursive:_.boolean(),ancestors:_.boolean(),namePrefix:Cf,shape:hv,fallbackName:_.string().min(1).optional(),skipIfManifest:Tf.optional()}).strict(),Nh=Xh.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"})}),Ch=Xh.partial({recursive:!0,ancestors:!0,namePrefix:!0,shape:!0});function Th(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(Th,"normalizeProviderResolvedNativeRoot");var gv=new Set(["skills","skill","skill-file"]),_v=new Set(["commands","command-file"]),Ii=256,qh=_.object({skills:_.array(Nh.refine(e=>gv.has(e.shape),"A skills root needs a skill shape")).max(Ii),commands:_.array(Nh.refine(e=>_v.has(e.shape),"A commands root needs a command shape")).max(Ii)}).strict(),kP=Object.freeze({skills:Object.freeze([]),commands:Object.freeze([])}),SP=_.object({skills:Ah,commands:Ah,resolved:qh}).strict(),yv=Symbol.for("@get-bb/plugin-sdk/rpc-refusal"),PP=class extends Error{static{s(this,"experimental_PluginRpcRefusal")}[yv]=!0;code;issues;constructor(e){super(e.message),this.name="experimental_PluginRpcRefusal",this.code=e.code,this.issues=e.issues}};var wv=_.object({providerId:_.string().min(1),cwd:_.string().min(1).nullable()}).strict(),bv=_.object({skills:_.array(Ch).optional(),commands:_.array(Ch).optional()}).strict().transform(e=>({skills:(e.skills??[]).slice(0,Ii).map(t=>Th(t,"skills")),commands:(e.commands??[]).slice(0,Ii).map(t=>Th(t,"commands"))})).pipe(qh);var zP={resolveNativeRoots:{input:wv,output:bv}};var IP=vv.join(".claude-plugin","plugin.json");var $v=_.enum(["managed","project","local","user"]),AP=_.object({enabledPlugins:_.record(_.string(),_.boolean()).optional()}).passthrough(),xv=_.object({gitCommitSha:_.string().nullable().optional(),installPath:_.string().min(1),scope:$v}).passthrough(),NP=_.object({plugins:_.record(_.string(),_.array(xv))}).passthrough(),Dh=_.union([_.string(),_.array(_.string())]),CP=_.object({name:_.string().min(1).optional(),defaultEnabled:_.boolean().optional(),skills:Dh.optional(),commands:Dh.optional()}).passthrough();var gt=mr.platform==="win32",Dv=gt?new RegExp("[\\/\\\\]","v"):new RegExp("\\/","v"),Zv=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC";function Lv(e,t){if(typeof e!="string"||e.length===0)throw new TypeError("Expected a non-empty string.");let{cwd:n=mr.cwd(),path:r=mr.env.PATH??(gt?mr.env.Path:void 0)??"",pathExt:o=mr.env.PATHEXT||Zv}=t;return{cwd:n,searchPath:r,pathExt:o}}s(Lv,"resolveOptions");function Rv(e,t){let n=t.split(hr.delimiter).filter(Boolean),r=hr.extname(e).toLowerCase();return r!==""&&n.some(o=>o.toLowerCase()===r)?["",...n]:n}s(Rv,"windowsExtensions");function*jv(e,{cwd:t,searchPath:n,pathExt:r}){let o=gt?Rv(e,r):[""];if(Dv.test(e)){let c=hr.resolve(t,e);for(let a of o)yield c+a;return}let i=[...gt?[t]:[],...n.split(hr.delimiter)];for(let c of i){let a=gt&&c.length>1&&c.startsWith('"')&&c.endsWith('"')?c.slice(1,-1):c;if(a==="")continue;let u=hr.resolve(t,a,e);for(let l of o)yield u+l}}s(jv,"candidatePaths");function Mv(e){let t;try{t=Of.statSync(e)}catch(n){return gt&&n.code==="EACCES"}if(!t.isFile())return!1;if(gt)return!0;try{return Of.accessSync(e,Of.constants.X_OK),!0}catch{return!1}}s(Mv,"isExecutableSync");function Rh(e,t={}){let n=Lv(e,t);for(let r of jv(e,n))if(Mv(r))return r}s(Rh,"whichCommandSync");var Yh={"--use-system-ca":"NODE_USE_SYSTEM_CA","--use-env-proxy":"NODE_USE_ENV_PROXY"},jh="--use-env-proxy",Fv=new Set(["HTTP_PROXY","HTTPS_PROXY"]),Mh="NO_PROXY",Uv=["localhost","127.0.0.1","::1","[::1]"];function Vv(e){return Object.hasOwn(Yh,e)}s(Vv,"isNodeNetworkFlag");function Kv(e){if(/[\r\n]/u.test(e))return!1;try{let t=new URL(e);return(t.protocol==="http:"||t.protocol==="https:")&&t.hostname!==""}catch{return!1}}s(Kv,"isHttpProxyUrl");function Hv(e){return Object.entries(e).filter(t=>Fv.has(t[0].toUpperCase())&&t[1]!==void 0&&t[1]!=="")}s(Hv,"proxyEntries");function Bv(e){let t=e.split(/[\s,]+/u).filter(Boolean);if(t.includes("*"))return e;let n=new Set(t.map(r=>r.toLowerCase()));return[...t,...Uv.filter(r=>!n.has(r))].join(",")}s(Bv,"appendLoopback");function Jv(e){let t={...e},n=Object.keys(t).filter(r=>r.toUpperCase()===Mh&&t[r]!==void 0);for(let r of n.length>0?n:[Mh])t[r]=Bv(t[r]??"");return t}s(Jv,"withLoopbackNoProxy");function Wv(e,t){let n=e.filter(i=>!Vv(i)||t[Yh[i]]!=="0");if(!n.includes(jh))return{nodeArgs:n,env:t,rejectedProxyKeys:[]};let r=Hv(t),o=r.filter(([,i])=>!Kv(i)).map(([i])=>i);return o.length>0?{nodeArgs:n.filter(i=>i!==jh),env:t,rejectedProxyKeys:o}:{nodeArgs:n,env:r.length>0?Jv(t):t,rejectedProxyKeys:[]}}s(Wv,"nodeNetworkLaunch");var Fh=new Set;function Xv(e,t){let n=Wv(e,t),r=n.rejectedProxyKeys.filter(o=>!Fh.has(o));if(r.length>0){for(let o of r)Fh.add(o);process.emitWarning(`bb started a Node process without --use-env-proxy because ${r.join(", ")} is not an http:// or https:// URL. Add the scheme, for example http://proxy.example:3128, so bb uses the proxy.`,{code:"BB_INVALID_PROXY_ENV"})}return{nodeArgs:n.nodeArgs,env:n.env}}s(Xv,"prepareNodeNetworkLaunch");function qv(e,t){let n=e.findIndex(i=>i==="--"||!i.startsWith("-")),r=n<0?e.length:n,o=Xv(e.slice(0,r),t);return{args:[...o.nodeArgs,...e.slice(r)],env:o.env}}s(qv,"prepareNodeNetworkCommand");var Qh=["HTTP_PROXY","HTTPS_PROXY","NO_PROXY","http_proxy","https_proxy","no_proxy","NODE_EXTRA_CA_CERTS","SSL_CERT_FILE","SSL_CERT_DIR"],Ef="__BB_SHELL_ENV_START__",Uh="__BB_SHELL_ENV_END__",eg=3e3,Gv=1024*1024;function un(e){try{return Ov(e,process.platform==="win32"?Zh.F_OK:Zh.X_OK),Av(e).isFile()}catch{return!1}}s(un,"executable");function Ne(e,t){return process.platform!=="win32"?e[t]:e[Object.keys(e).find(n=>n.toUpperCase()===t.toUpperCase())??t]}s(Ne,"envValue");function Nf(...e){let t=new Set;return e.flatMap(n=>(n??"").split(Af)).filter(n=>{if(!n)return!1;let r=process.platform==="win32"?n.replace(/[\\/]+$/u,"").toLowerCase():n;return t.has(r)?!1:(t.add(r),!0)}).join(Af)}s(Nf,"mergePath");function Yv(e){if(process.platform!=="win32")return e;try{let t=Ai(e).toLowerCase(),n=Iv(xe(e)).find(r=>r.toLowerCase()===t);return n===void 0?e:re(xe(e),n)}catch{return e}}s(Yv,"onDiskName");function Vh(e,t,n){return new Promise(r=>{let o="",i=!1,c,a=s(l=>{i||(i=!0,clearTimeout(c),r({status:l,stdout:o}))},"finish"),u;try{u=Pv(e,t,{cwd:Gh(),env:n,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{a(null);return}c=setTimeout(()=>{u.kill("SIGKILL"),a(null)},eg),u.stdout?.setEncoding("utf8"),u.stdout?.on("data",l=>{o.length<Gv&&(o+=l)}),u.once("error",()=>a(null)),u.once("close",l=>a(l))})}s(Vh,"runProbe");async function Qv(e,t){if(process.platform==="win32"){let i=re(Ne(e,"SystemRoot")??"C:\\Windows","System32","reg.exe"),c={...e},a=[];for(let l of["HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment","HKCU\\Environment"]){let f=await Vh(i,["query",l],e);if(f.status===0)for(let p of f.stdout.matchAll(/^ {4}(.+?) {4}REG_[A-Z_]+ {4}(.*)$/gmu)){let d=p[1]?.trim();if(!d)continue;let m=(p[2]??"").trim();if(d.toUpperCase()==="PATH")a.push(m);else{let g=Object.keys(c).find(y=>y.toUpperCase()===d.toUpperCase());c[g??d]=m}}}let u=s(l=>{for(let f=0;f<10;f+=1){let p=l.replace(/%([^%;\\/]+)%/gu,(d,m)=>Ne(c,m)??d);if(p===l)break;l=p}return l},"expand");return a.length===0?null:{PATH:Nf(...a.map(u),Ne(e,"PATH"))}}let n=e.SHELL?.trim()||(process.platform==="darwin"?"/bin/zsh":"/bin/sh"),r=`printf '%s\\n' ${Ef}; /usr/bin/env; printf '%s\\n' ${Uh}`,o=["sh","dash"].includes(Ai(n))?["-lc"]:["-ilc","-lc"];for(let i of o){let c=await Vh(n,[i,r],e);if(c.status!==0){if(t)return null;continue}let a=c.stdout.indexOf(`${Ef}
69
69
  `),u=c.stdout.indexOf(`
70
- ${Th}`,a);if(a<0||u<0){if(t)return null;continue}let l={};for(let f of c.stdout.slice(a+vf.length+1,u).split(`
71
- `)){let p=f.indexOf("="),d=f.slice(0,p);(d==="PATH"||Hh.includes(d))&&(l[d]=f.slice(p+1))}if(l.PATH)return l}return null}s(Fv,"readShellEnvironment");var Vv=class{static{s(this,"HostToolchain")}constructor(e=process.env,t=process.execPath){this.baseEnv=e,this.runtimePath=t,this.inheritedPath=Ee(e,"PATH"),this.nodePath=t}baseEnv;runtimePath;shellEnv={};inheritedPath;misses=new Set;nodePath;refreshing=null;refreshedAt=0;refresh(){if(this.refreshing!==null)return this.refreshing;this.misses.clear(),this.refreshedAt=Date.now();let e=this.shellEnv.PATH!==void 0;return this.refreshing=Fv(this.baseEnv,e).then(t=>{t!==null&&(this.shellEnv=t)}).finally(()=>{this.refreshing=null}),this.refreshing}invalidateFailure(e){let t=typeof e=="object"&&e!==null&&"code"in e?e.code:e;(t==="ENOENT"||t===127)&&this.refresh()}searchPath(e){let t=Ee(e,"PATH"),n=Ee(e,process.platform==="win32"?"USERPROFILE":"HOME")??Uh(),r=[ne(n,".local","bin"),ne(n,".local","share","mise","shims"),ne(n,".asdf","shims"),ne(n,".asdf","bin"),ne(n,".volta","bin")];process.platform==="darwin"&&r.push("/opt/homebrew/bin"),process.platform!=="win32"&&r.push("/usr/local/bin","/usr/bin","/bin");let[o,i]=t===void 0||t===this.inheritedPath?[this.shellEnv.PATH,t]:[t,this.shellEnv.PATH];return kf(o,i,sn(this.nodePath)&&/^node(?:\.exe)?$/iu.test(ki(this.nodePath))?$e(this.nodePath):void 0,...r)}environment(e=this.baseEnv){let t=this.searchPath(e),n={...e};if(process.platform==="win32")for(let o of Object.keys(n))o!=="PATH"&&o.toUpperCase()==="PATH"&&delete n[o];t!==""&&(n.PATH=t);let r=new Set(Object.keys(e).filter(o=>e[o]!==void 0).map(o=>o.toUpperCase()));for(let o of Hh)!r.has(o.toUpperCase())&&this.shellEnv[o]!==void 0&&(n[o]=this.shellEnv[o]);return n}lookup(e,t){let n=this.environment(t.env),r=t.cwd instanceof URL?$v(t.cwd):t.cwd??process.cwd();if(e==="bb"){for(let l of[n.BB_CLI_LAUNCHER,n.BB_CLI,n.BB_CLI_DIR?ne(n.BB_CLI_DIR,"bb"):void 0])if(l?.trim()&&$i(l.trim())&&sn(l.trim()))return l.trim()}let o=vv(e),i=Ee(n,"PATHEXT"),c=Ee(n,"PATH")??"",a={cwd:r,path:c,pathExt:o?`${o};${i??".EXE;.COM;.CMD;.BAT"}`:i},u=e==="bb"?c.split(xf).filter($i).map(l=>Eh(ne(l,e),a)).find(Boolean):Eh(e,a);return u?Mv(u):null}resolve(e,t={}){let n=this.lookup(e,t);if(n!==null)return n;let r=`${e}\0${String(t.cwd??"")}\0${Ee(t.env??this.baseEnv,"PATH")??""}`,o=Date.now()-this.refreshedAt;return!(this.misses.has(r)&&o<3e4)&&(this.misses.size===0||o>=1e3)&&this.refresh(),this.misses.add(r),null}node(e={}){if(sn(this.nodePath))return this.nodePath;let n=[this.runtimePath.replace(/\/Cellar\/([^/]+)\/[^/]+\//u,"/opt/$1/"),process.argv0,this.lookup(process.platform==="win32"?"node.exe":"node",e)];for(let r of n){if(!r||!$i(r)||!sn(r))continue;let o=hv(r,["-p","JSON.stringify({path:process.execPath,abi:process.versions.modules,electron:!!process.versions.electron})"],{env:this.environment(e.env),cwd:e.cwd,encoding:"utf8",timeout:Bh,killSignal:"SIGKILL",windowsHide:!0});if(o.status===0)try{let i=JSON.parse(o.stdout.trim());if(typeof i!="object"||i===null||!("path"in i)||typeof i.path!="string"||!("abi"in i)||i.abi!==process.versions.modules||!("electron"in i)||i.electron!==!!process.versions.electron)continue;if($i(i.path)&&sn(i.path))return this.nodePath=i.path,i.path}catch{}}throw Object.assign(new Error("The Node runtime was removed and no replacement was found. Reinstall Node or restart bb with an available runtime."),{code:"ENOENT"})}bundledNpmCli(e="npm"){let t=bv(import.meta.url);return ne($e(t.resolve("npm/package.json")),"bin",`${e}-cli.js`)}npmCli(e="npm",t={}){let n=`${e}-cli.js`,r=process.versions.electron?null:this.node(t),o=[];if(r!==null)for(let c of[ne($e(r),"..","lib","node_modules","npm","bin",n),ne($e(r),"node_modules","npm","bin",n)])o.push({node:r,cli:c});let i=this.resolve(e,t);if(i)try{let c=Ih(i),a=$e($e(c)),u=[ne(a,"..","..","..","bin","node"),ne(a,"..","..","node.exe"),ne($e(i),"node")].find(sn);ki(c)===n&&u!==void 0&&o.push({node:Ih(u),cli:c})}catch{}if(r!==null)try{o.push({node:r,cli:this.bundledNpmCli(e)})}catch{}return o.find(c=>_v(c.cli))??null}command(e,t=[],n={}){let r=e===this.runtimePath?this.node(n):this.resolve(e,n)??e,o=this.environment(n.env);/(?:^|[\\/])(?:npm|npx)-cli\.js$/u.test(t[0]??"")&&(o.PATH=kf($e(r),o.PATH));let i=Lv(t,o);return{command:r,args:i.args,env:i.env}}},Uv=Symbol.for("@bb/process-utils/host-toolchain"),Kv=globalThis,bP=Kv[Uv]??=new Vv;var Rh={interactive:0,status:1,background:2};function Bv(e){let t=Math.min(6,Math.max(4,e-2));return[t,t-1,t-2]}s(Bv,"localProcessCapacities");var Lh={local:Bv(Hv()),network:[4,3,2]},Jv=2,$f=15e3,Wv=new Set(["fetch","pull","push","clone","ls-remote"]),qv=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--config-env"]);function Gv(e){let t=0;for(;t<e.length&&e[t].startsWith("-");)t+=qv.has(e[t])?2:1;let n=e[t];if(n===void 0)return!1;if(Wv.has(n))return!0;let r=e.slice(t+1).find(o=>!o.startsWith("-"));return(n==="submodule"||n==="remote")&&r==="update"}s(Gv,"isNetworkGitCommand");var Xv=class{static{s(this,"VcsProcessScheduler")}priority=new Dh;admitted=new Dh;active={local:0,network:0};githubActive=0;queue=[];timer;acquire(e,t,n){let r=e==="gh"||Gv(t)?"network":"local",o=n.slots??1;return!Number.isInteger(o)||o<1||o>Lh[r][Rh.background]?Promise.reject(new Error("Invalid VCS process slot count")):n.signal?.aborted?Promise.reject(this.abortError(n.signal)):new Promise((i,c)=>{let a={command:e,pool:r,priority:n.priority??this.priority.getStore()??"status",slots:o,queuedAt:performance.now(),signal:n.signal,grant:i,onAbort:s(()=>{let u=this.queue.indexOf(a);u!==-1&&(this.queue.splice(u,1),c(this.abortError(n.signal)),this.drain())},"onAbort")};this.queue.push(a),n.signal?.addEventListener("abort",a.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,Rh[e.priority]-Math.floor((performance.now()-e.queuedAt)/$f))}drain(){clearTimeout(this.timer),this.queue.sort((t,n)=>this.rank(t)-this.rank(n)||t.queuedAt-n.queuedAt);let e=new Set;for(let t=0;t<this.queue.length;){let n=this.queue[t];if(e.has(n.pool)||n.command==="gh"&&this.githubActive+n.slots>Jv){t+=1;continue}if(this.active[n.pool]+n.slots>Lh[n.pool][this.rank(n)]){e.add(n.pool),t+=1;continue}this.queue.splice(t,1),n.signal?.removeEventListener("abort",n.onAbort),this.active[n.pool]+=n.slots,n.command==="gh"&&(this.githubActive+=n.slots);let r=!1;n.grant(()=>{r||(r=!0,this.active[n.pool]-=n.slots,n.command==="gh"&&(this.githubActive-=n.slots),this.drain())})}if(this.queue.length>0){let t=Math.min(...this.queue.map(n=>$f-(performance.now()-n.queuedAt)%$f));this.timer=setTimeout(()=>this.drain(),t)}}},Yv=globalThis,xP=Yv.__bbVcsProcessScheduler??=new Xv;var CP=_.object({kimiSetup:_.literal(1),kimiCheck:_.uuid().optional()}).strict(),Pi=_.object({id:_.literal("claude-kimi"),displayName:_.literal("Kimi (CC)"),command:_.string().min(1),args:_.array(_.string()).length(1),modelCli:_.object({listArgs:_.array(_.string()).length(2),primaryModels:_.array(_.enum(["k3.1-pro","k3.1-pro[1m]"])).length(1)}).strict().optional(),nativeSkillRoots:_.object({user:_.array(_.string()),project:_.array(_.object({path:_.string(),recursive:_.literal(!0),ancestors:_.literal(!0)}).strict())}).strict()}).strict(),Si=_.string().max(512).regex(/^sk-kimi-[A-Za-z0-9_-]+$/,"\u041D\u0443\u0436\u0435\u043D \u043A\u043B\u044E\u0447 \u0438\u0437 \u043A\u043E\u043D\u0441\u043E\u043B\u0438 Kimi Code."),e$=_.object({nodeReady:_.boolean(),nodeVersion:_.string().nullable(),profile:_.enum(["absent","partial","ready","blocked"]),agent:Pi.nullable()}).strict(),Jh={kimiInspect:{input:_.null(),output:e$,experimental_retryable:!0},kimiPrepare:{input:_.object({apiKey:Si.optional()}).strict(),output:Pi},kimiReplaceKey:{input:_.object({apiKey:Si}).strict(),output:_.null()}},Je=_.object({revision:_.number().int().nonnegative(),canReplaceKey:_.boolean(),hidden:_.boolean(),stage:_.enum(["intro","node","key","installing","registration","verify","complete","blocked"]),message:_.string(),hostId:_.string(),testThreadId:_.string().nullable(),verifyModel:_.string().nullable().default(null),manualRegistration:_.string().nullable(),keyChangedAt:_.number().nullable().default(null),phase:_.enum(["components","access","check"]).nullable().default(null),startedAt:_.number().nullable().default(null),checkToken:_.string().nullable().default(null),checkStartedAt:_.number().nullable().default(null),catalogVersion:_.number().int().nonnegative().default(0),automatic:_.boolean().default(!1),ownedTestThreadId:_.string().nullable().default(null)}).strict(),TP={kimiStatus:{input:_.null(),output:Je},kimiOpen:{input:_.null(),output:Je},kimiStart:{input:_.object({apiKey:Si.optional()}).strict(),output:Je},kimiDismiss:{input:_.object({reason:_.enum(["declined","other-agent"])}).strict(),output:Je},kimiTestStarted:{input:_.object({threadId:_.string().min(1).max(100)}).strict(),output:Je},kimiCheckResponse:{input:_.null(),output:Je},kimiRecheck:{input:_.null(),output:Je},kimiReplaceKey:{input:_.object({apiKey:Si}).strict(),output:Je}};var t$=_.object({executable:_.string().min(1),cwd:_.string().min(1)}).strict(),n$=_.object({fingerprint:_.string().regex(/^[0-9a-f]{64}$/),hooks:_.array(_.object({key:_.string(),currentHash:_.string(),trustStatus:_.string(),command:_.string(),statusMessage:_.string().nullable(),sourcePath:_.string()}).strict()).min(1).max(128)}).strict(),Wh={...Jh,automaticHooks:{input:t$,output:n$.extend({changed:_.boolean()}).strict()},openLogin:{input:_.object({url:_.string().url().refine(e=>{let t=new URL(e);return t.origin==="https://auth.svaib.com"&&!t.username&&!t.password})}).strict(),output:_.null()}};import{spawn as o$}from"node:child_process";import{createInterface as i$}from"node:readline";import{homedir as Yh}from"node:os";import{isAbsolute as Xh,join as Qh,resolve as s$}from"node:path";import{createHash as r$}from"node:crypto";var zf="svaib@svaib";var qh=s(e=>e.pluginId===zf,"isSvaibHook");async function zi(e,t){let r=(await e("hooks/list",{cwds:[t]}))?.data?.find(c=>c.cwd===t);if(!r||r.errors?.length||r.warnings?.length||!Array.isArray(r.hooks))throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u0445\u0443\u043A\u0438 Codex.");let o=r.hooks.filter(qh).map(c=>{if(c.source!=="plugin"||c.isManaged||typeof c.key!="string"||!c.key.startsWith(`${zf}:`)||!/^sha256:[0-9a-f]{64}\/sha256:[0-9a-f]{64}$/.test(c.currentHash)||!["trusted","untrusted","modified"].includes(c.trustStatus)||typeof c.command!="string"||typeof c.sourcePath!="string")throw new Error("\u0421\u043E\u0441\u0442\u0430\u0432 \u0445\u0443\u043A\u043E\u0432 \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C.");return{key:c.key,currentHash:c.currentHash,trustStatus:c.trustStatus,command:c.command,statusMessage:c.statusMessage??null,sourcePath:c.sourcePath}}).sort((c,a)=>c.key.localeCompare(a.key));if(!o.length||o.length>128||new Set(o.map(c=>c.key)).size!==o.length)throw new Error("\u0425\u0443\u043A\u0438 svaib \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0438\u043B\u0438 \u0438\u0445 \u0441\u043E\u0441\u0442\u0430\u0432 \u043D\u0435\u043E\u0434\u043D\u043E\u0437\u043D\u0430\u0447\u0435\u043D.");let i=r$("sha256").update(JSON.stringify(o)).digest("hex");return{hooks:o,fingerprint:i}}s(zi,"inspectHooks");async function Gh(e,t,n){let o=(await e("config/read",{includeLayers:!0,cwd:t}))?.layers?.filter(l=>l.name?.type==="user");if(!Array.isArray(o)||o.length!==1||typeof o[0].version!="string")throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 Codex.");let i=await zi(e,t);if(i.fingerprint!==n)throw new Error("\u0425\u0443\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0438\u043B\u0438\u0441\u044C \u0432\u043E \u0432\u0440\u0435\u043C\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438. \u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435 \u0435\u0451.");let c=i.hooks.filter(l=>l.trustStatus!=="trusted");if(!c.length)return i;let a=c.map(l=>({keyPath:`hooks.state.${JSON.stringify(l.key)}`,value:{trusted_hash:l.currentHash},mergeStrategy:"upsert"}));await e("config/batchWrite",{edits:a,expectedVersion:o[0].version,reloadUserConfig:!0});let u=await zi(e,t);if(u.hooks.some(l=>l.trustStatus!=="trusted")||JSON.stringify(u.hooks.map(({key:l,currentHash:f})=>({key:l,currentHash:f})))!==JSON.stringify(i.hooks.map(({key:l,currentHash:f})=>({key:l,currentHash:f}))))throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0434\u043E\u0432\u0435\u0440\u0438\u0435 \u0442\u0435\u043A\u0443\u0449\u0438\u043C \u0445\u0443\u043A\u0430\u043C.");return u}s(Gh,"approveHooks");async function c$(e,t,n,r=Qh(Yh(),".codex")){if(!Xh(e.executable)||!Xh(e.cwd))throw new Error("\u041D\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E \u0440\u0430\u0431\u043E\u0447\u0435\u0435 \u043C\u0435\u0441\u0442\u043E Codex.");if(process.env.CODEX_HOME&&s$(process.env.CODEX_HOME)!==r)throw new Error("\u041D\u0435\u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u043D\u044B\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C Codex \u043F\u043E\u043A\u0430 \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F.");t.throwIfAborted();let o=o$(e.executable,["app-server","--stdio"],{cwd:e.cwd,env:{...process.env,CODEX_HOME:r},stdio:["pipe","pipe","ignore"],shell:!1}),i=i$({input:o.stdout}),c=new Map,a=0,u=!1,l=s(()=>{for(let m of c.values())m.reject(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u0432\u044F\u0437\u0430\u0442\u044C\u0441\u044F \u0441 Codex."));c.clear()},"fail"),f=s(()=>{l(),o.kill()},"stop");t.addEventListener("abort",f,{once:!0}),o.once("error",l),o.stdin.on("error",l),o.stdout.on("error",l),o.once("exit",()=>{u=!0,l()}),i.on("line",m=>{if(m.length>2e6){f();return}let g;try{g=JSON.parse(m)}catch{f();return}if(g.method&&g.id!=null){o.stdin.write(JSON.stringify({id:g.id,error:{code:-32601,message:"unsupported"}})+`
70
+ ${Uh}`,a);if(a<0||u<0){if(t)return null;continue}let l={};for(let f of c.stdout.slice(a+Ef.length+1,u).split(`
71
+ `)){let p=f.indexOf("="),d=f.slice(0,p);(d==="PATH"||Qh.includes(d))&&(l[d]=f.slice(p+1))}if(l.PATH)return l}return null}s(Qv,"readShellEnvironment");var e$=class{static{s(this,"HostToolchain")}constructor(e=process.env,t=process.execPath){this.baseEnv=e,this.runtimePath=t,this.inheritedPath=Ne(e,"PATH"),this.nodePath=t}baseEnv;runtimePath;shellEnv={};inheritedPath;misses=new Set;nodePath;refreshing=null;refreshedAt=0;refresh(){if(this.refreshing!==null)return this.refreshing;this.misses.clear(),this.refreshedAt=Date.now();let e=this.shellEnv.PATH!==void 0;return this.refreshing=Qv(this.baseEnv,e).then(t=>{t!==null&&(this.shellEnv=t)}).finally(()=>{this.refreshing=null}),this.refreshing}invalidateFailure(e){let t=typeof e=="object"&&e!==null&&"code"in e?e.code:e;(t==="ENOENT"||t===127)&&this.refresh()}searchPath(e){let t=Ne(e,"PATH"),n=Ne(e,process.platform==="win32"?"USERPROFILE":"HOME")??Gh(),r=[re(n,".local","bin"),re(n,".local","share","mise","shims"),re(n,".asdf","shims"),re(n,".asdf","bin"),re(n,".volta","bin")];process.platform==="darwin"&&r.push("/opt/homebrew/bin"),process.platform!=="win32"&&r.push("/usr/local/bin","/usr/bin","/bin");let[o,i]=t===void 0||t===this.inheritedPath?[this.shellEnv.PATH,t]:[t,this.shellEnv.PATH];return Nf(o,i,un(this.nodePath)&&/^node(?:\.exe)?$/iu.test(Ai(this.nodePath))?xe(this.nodePath):void 0,...r)}environment(e=this.baseEnv){let t=this.searchPath(e),n={...e};if(process.platform==="win32")for(let o of Object.keys(n))o!=="PATH"&&o.toUpperCase()==="PATH"&&delete n[o];t!==""&&(n.PATH=t);let r=new Set(Object.keys(e).filter(o=>e[o]!==void 0).map(o=>o.toUpperCase()));for(let o of Qh)!r.has(o.toUpperCase())&&this.shellEnv[o]!==void 0&&(n[o]=this.shellEnv[o]);return n}lookup(e,t){let n=this.environment(t.env),r=t.cwd instanceof URL?Tv(t.cwd):t.cwd??process.cwd();if(e==="bb"){for(let l of[n.BB_CLI_LAUNCHER,n.BB_CLI,n.BB_CLI_DIR?re(n.BB_CLI_DIR,"bb"):void 0])if(l?.trim()&&Ei(l.trim())&&un(l.trim()))return l.trim()}let o=Cv(e),i=Ne(n,"PATHEXT"),c=Ne(n,"PATH")??"",a={cwd:r,path:c,pathExt:o?`${o};${i??".EXE;.COM;.CMD;.BAT"}`:i},u=e==="bb"?c.split(Af).filter(Ei).map(l=>Rh(re(l,e),a)).find(Boolean):Rh(e,a);return u?Yv(u):null}resolve(e,t={}){let n=this.lookup(e,t);if(n!==null)return n;let r=`${e}\0${String(t.cwd??"")}\0${Ne(t.env??this.baseEnv,"PATH")??""}`,o=Date.now()-this.refreshedAt;return!(this.misses.has(r)&&o<3e4)&&(this.misses.size===0||o>=1e3)&&this.refresh(),this.misses.add(r),null}node(e={}){if(un(this.nodePath))return this.nodePath;let n=[this.runtimePath.replace(/\/Cellar\/([^/]+)\/[^/]+\//u,"/opt/$1/"),process.argv0,this.lookup(process.platform==="win32"?"node.exe":"node",e)];for(let r of n){if(!r||!Ei(r)||!un(r))continue;let o=zv(r,["-p","JSON.stringify({path:process.execPath,abi:process.versions.modules,electron:!!process.versions.electron})"],{env:this.environment(e.env),cwd:e.cwd,encoding:"utf8",timeout:eg,killSignal:"SIGKILL",windowsHide:!0});if(o.status===0)try{let i=JSON.parse(o.stdout.trim());if(typeof i!="object"||i===null||!("path"in i)||typeof i.path!="string"||!("abi"in i)||i.abi!==process.versions.modules||!("electron"in i)||i.electron!==!!process.versions.electron)continue;if(Ei(i.path)&&un(i.path))return this.nodePath=i.path,i.path}catch{}}throw Object.assign(new Error("The Node runtime was removed and no replacement was found. Reinstall Node or restart bb with an available runtime."),{code:"ENOENT"})}bundledNpmCli(e="npm"){let t=Nv(import.meta.url);return re(xe(t.resolve("npm/package.json")),"bin",`${e}-cli.js`)}npmCli(e="npm",t={}){let n=`${e}-cli.js`,r=process.versions.electron?null:this.node(t),o=[];if(r!==null)for(let c of[re(xe(r),"..","lib","node_modules","npm","bin",n),re(xe(r),"node_modules","npm","bin",n)])o.push({node:r,cli:c});let i=this.resolve(e,t);if(i)try{let c=Lh(i),a=xe(xe(c)),u=[re(a,"..","..","..","bin","node"),re(a,"..","..","node.exe"),re(xe(i),"node")].find(un);Ai(c)===n&&u!==void 0&&o.push({node:Lh(u),cli:c})}catch{}if(r!==null)try{o.push({node:r,cli:this.bundledNpmCli(e)})}catch{}return o.find(c=>Ev(c.cli))??null}command(e,t=[],n={}){let r=e===this.runtimePath?this.node(n):this.resolve(e,n)??e,o=this.environment(n.env);/(?:^|[\\/])(?:npm|npx)-cli\.js$/u.test(t[0]??"")&&(o.PATH=Nf(xe(r),o.PATH));let i=qv(t,o);return{command:r,args:i.args,env:i.env}}},t$=Symbol.for("@bb/process-utils/host-toolchain"),n$=globalThis,VP=n$[t$]??=new e$;var Hh={interactive:0,status:1,background:2};function o$(e){let t=Math.min(6,Math.max(4,e-2));return[t,t-1,t-2]}s(o$,"localProcessCapacities");var Bh={local:o$(r$()),network:[4,3,2]},i$=2,If=15e3,s$=new Set(["fetch","pull","push","clone","ls-remote"]),c$=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--config-env"]);function a$(e){let t=0;for(;t<e.length&&e[t].startsWith("-");)t+=c$.has(e[t])?2:1;let n=e[t];if(n===void 0)return!1;if(s$.has(n))return!0;let r=e.slice(t+1).find(o=>!o.startsWith("-"));return(n==="submodule"||n==="remote")&&r==="update"}s(a$,"isNetworkGitCommand");var u$=class{static{s(this,"VcsProcessScheduler")}priority=new Kh;admitted=new Kh;active={local:0,network:0};githubActive=0;queue=[];timer;acquire(e,t,n){let r=e==="gh"||a$(t)?"network":"local",o=n.slots??1;return!Number.isInteger(o)||o<1||o>Bh[r][Hh.background]?Promise.reject(new Error("Invalid VCS process slot count")):n.signal?.aborted?Promise.reject(this.abortError(n.signal)):new Promise((i,c)=>{let a={command:e,pool:r,priority:n.priority??this.priority.getStore()??"status",slots:o,queuedAt:performance.now(),signal:n.signal,grant:i,onAbort:s(()=>{let u=this.queue.indexOf(a);u!==-1&&(this.queue.splice(u,1),c(this.abortError(n.signal)),this.drain())},"onAbort")};this.queue.push(a),n.signal?.addEventListener("abort",a.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,Hh[e.priority]-Math.floor((performance.now()-e.queuedAt)/If))}drain(){clearTimeout(this.timer),this.queue.sort((t,n)=>this.rank(t)-this.rank(n)||t.queuedAt-n.queuedAt);let e=new Set;for(let t=0;t<this.queue.length;){let n=this.queue[t];if(e.has(n.pool)||n.command==="gh"&&this.githubActive+n.slots>i$){t+=1;continue}if(this.active[n.pool]+n.slots>Bh[n.pool][this.rank(n)]){e.add(n.pool),t+=1;continue}this.queue.splice(t,1),n.signal?.removeEventListener("abort",n.onAbort),this.active[n.pool]+=n.slots,n.command==="gh"&&(this.githubActive+=n.slots);let r=!1;n.grant(()=>{r||(r=!0,this.active[n.pool]-=n.slots,n.command==="gh"&&(this.githubActive-=n.slots),this.drain())})}if(this.queue.length>0){let t=Math.min(...this.queue.map(n=>If-(performance.now()-n.queuedAt)%If));this.timer=setTimeout(()=>this.drain(),t)}}},l$=globalThis,BP=l$.__bbVcsProcessScheduler??=new u$;var nz=_.object({kimiSetup:_.literal(1),kimiCheck:_.uuid().optional()}).strict(),Ci=_.object({id:_.literal("claude-kimi"),displayName:_.literal("Kimi (CC)"),command:_.string().min(1),args:_.array(_.string()).length(1),modelCli:_.object({listArgs:_.array(_.string()).length(2),primaryModels:_.array(_.enum(["k3.1-pro","k3.1-pro[1m]"])).length(1)}).strict().optional(),nativeSkillRoots:_.object({user:_.array(_.string()),project:_.array(_.object({path:_.string(),recursive:_.literal(!0),ancestors:_.literal(!0)}).strict())}).strict()}).strict(),Ni=_.string().max(512).regex(/^sk-kimi-[A-Za-z0-9_-]+$/,"\u041D\u0443\u0436\u0435\u043D \u043A\u043B\u044E\u0447 \u0438\u0437 \u043A\u043E\u043D\u0441\u043E\u043B\u0438 Kimi Code."),p$=_.object({nodeReady:_.boolean(),nodeVersion:_.string().nullable(),profile:_.enum(["absent","partial","ready","blocked"]),agent:Ci.nullable(),verifyModels:_.array(_.string()).optional()}).strict(),tg={kimiInspect:{input:_.null(),output:p$,experimental_retryable:!0},kimiPrepare:{input:_.object({apiKey:Ni.optional(),diagnosticId:_.uuid().optional()}).strict(),output:Ci},kimiReplaceKey:{input:_.object({apiKey:Ni,diagnosticId:_.uuid().optional()}).strict(),output:_.null()}},We=_.object({revision:_.number().int().nonnegative(),canReplaceKey:_.boolean(),hidden:_.boolean(),stage:_.enum(["intro","node","key","installing","registration","verify","complete","blocked"]),message:_.string(),hostId:_.string(),testThreadId:_.string().nullable(),verifyModel:_.string().nullable().default(null),manualRegistration:_.string().nullable(),keyChangedAt:_.number().nullable().default(null),phase:_.enum(["components","access","check"]).nullable().default(null),startedAt:_.number().nullable().default(null),checkToken:_.string().nullable().default(null),checkStartedAt:_.number().nullable().default(null),catalogVersion:_.number().int().nonnegative().default(0),catalogCheckedAt:_.number().nullable().default(null),automatic:_.boolean().default(!1),ownedTestThreadId:_.string().nullable().default(null)}).strict(),rz={kimiStatus:{input:_.null(),output:We},kimiOpen:{input:_.null(),output:We},kimiStart:{input:_.object({apiKey:Ni.optional()}).strict(),output:We},kimiDismiss:{input:_.object({reason:_.enum(["declined","other-agent"])}).strict(),output:We},kimiTestStarted:{input:_.object({threadId:_.string().min(1).max(100)}).strict(),output:We},kimiCheckResponse:{input:_.null(),output:We},kimiRecheck:{input:_.null(),output:We},kimiReplaceKey:{input:_.object({apiKey:Ni}).strict(),output:We}};var d$=_.object({executable:_.string().min(1),cwd:_.string().min(1)}).strict(),m$=_.object({fingerprint:_.string().regex(/^[0-9a-f]{64}$/),hooks:_.array(_.object({key:_.string(),currentHash:_.string(),trustStatus:_.string(),command:_.string(),statusMessage:_.string().nullable(),sourcePath:_.string()}).strict()).min(1).max(128)}).strict(),ng={...tg,automaticHooks:{input:d$,output:m$.extend({changed:_.boolean()}).strict()},openLogin:{input:_.object({url:_.string().url().refine(e=>{let t=new URL(e);return t.origin==="https://auth.svaib.com"&&!t.username&&!t.password})}).strict(),output:_.null()}};import{spawn as g$}from"node:child_process";import{createInterface as _$}from"node:readline";import{homedir as sg}from"node:os";import{isAbsolute as ig,join as cg,resolve as y$}from"node:path";import{createHash as h$}from"node:crypto";var Df="svaib@svaib";var rg=s(e=>e.pluginId===Df,"isSvaibHook");async function Ti(e,t){let r=(await e("hooks/list",{cwds:[t]}))?.data?.find(c=>c.cwd===t);if(!r||r.errors?.length||r.warnings?.length||!Array.isArray(r.hooks))throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u0445\u0443\u043A\u0438 Codex.");let o=r.hooks.filter(rg).map(c=>{if(c.source!=="plugin"||c.isManaged||typeof c.key!="string"||!c.key.startsWith(`${Df}:`)||!/^sha256:[0-9a-f]{64}\/sha256:[0-9a-f]{64}$/.test(c.currentHash)||!["trusted","untrusted","modified"].includes(c.trustStatus)||typeof c.command!="string"||typeof c.sourcePath!="string")throw new Error("\u0421\u043E\u0441\u0442\u0430\u0432 \u0445\u0443\u043A\u043E\u0432 \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C.");return{key:c.key,currentHash:c.currentHash,trustStatus:c.trustStatus,command:c.command,statusMessage:c.statusMessage??null,sourcePath:c.sourcePath}}).sort((c,a)=>c.key.localeCompare(a.key));if(!o.length||o.length>128||new Set(o.map(c=>c.key)).size!==o.length)throw new Error("\u0425\u0443\u043A\u0438 svaib \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u044B \u0438\u043B\u0438 \u0438\u0445 \u0441\u043E\u0441\u0442\u0430\u0432 \u043D\u0435\u043E\u0434\u043D\u043E\u0437\u043D\u0430\u0447\u0435\u043D.");let i=h$("sha256").update(JSON.stringify(o)).digest("hex");return{hooks:o,fingerprint:i}}s(Ti,"inspectHooks");async function og(e,t,n){let o=(await e("config/read",{includeLayers:!0,cwd:t}))?.layers?.filter(l=>l.name?.type==="user");if(!Array.isArray(o)||o.length!==1||typeof o[0].version!="string")throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 Codex.");let i=await Ti(e,t);if(i.fingerprint!==n)throw new Error("\u0425\u0443\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0438\u043B\u0438\u0441\u044C \u0432\u043E \u0432\u0440\u0435\u043C\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438. \u041F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0435 \u0435\u0451.");let c=i.hooks.filter(l=>l.trustStatus!=="trusted");if(!c.length)return i;let a=c.map(l=>({keyPath:`hooks.state.${JSON.stringify(l.key)}`,value:{trusted_hash:l.currentHash},mergeStrategy:"upsert"}));await e("config/batchWrite",{edits:a,expectedVersion:o[0].version,reloadUserConfig:!0});let u=await Ti(e,t);if(u.hooks.some(l=>l.trustStatus!=="trusted")||JSON.stringify(u.hooks.map(({key:l,currentHash:f})=>({key:l,currentHash:f})))!==JSON.stringify(i.hooks.map(({key:l,currentHash:f})=>({key:l,currentHash:f}))))throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0434\u043E\u0432\u0435\u0440\u0438\u0435 \u0442\u0435\u043A\u0443\u0449\u0438\u043C \u0445\u0443\u043A\u0430\u043C.");return u}s(og,"approveHooks");async function w$(e,t,n,r=cg(sg(),".codex")){if(!ig(e.executable)||!ig(e.cwd))throw new Error("\u041D\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043E \u0440\u0430\u0431\u043E\u0447\u0435\u0435 \u043C\u0435\u0441\u0442\u043E Codex.");if(process.env.CODEX_HOME&&y$(process.env.CODEX_HOME)!==r)throw new Error("\u041D\u0435\u0441\u0442\u0430\u043D\u0434\u0430\u0440\u0442\u043D\u044B\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C Codex \u043F\u043E\u043A\u0430 \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F.");t.throwIfAborted();let o=g$(e.executable,["app-server","--stdio"],{cwd:e.cwd,env:{...process.env,CODEX_HOME:r},stdio:["pipe","pipe","ignore"],shell:!1}),i=_$({input:o.stdout}),c=new Map,a=0,u=!1,l=s(()=>{for(let m of c.values())m.reject(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u0432\u044F\u0437\u0430\u0442\u044C\u0441\u044F \u0441 Codex."));c.clear()},"fail"),f=s(()=>{l(),o.kill()},"stop");t.addEventListener("abort",f,{once:!0}),o.once("error",l),o.stdin.on("error",l),o.stdout.on("error",l),o.once("exit",()=>{u=!0,l()}),i.on("line",m=>{if(m.length>2e6){f();return}let g;try{g=JSON.parse(m)}catch{f();return}if(g.method&&g.id!=null){o.stdin.write(JSON.stringify({id:g.id,error:{code:-32601,message:"unsupported"}})+`
72
72
  `);return}let y=c.get(g.id);y&&(c.delete(g.id),g.error?y.reject(new Error("Codex \u043D\u0435 \u0432\u044B\u043F\u043E\u043B\u043D\u0438\u043B \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0443 \u0445\u0443\u043A\u043E\u0432.")):y.resolve(g.result))});let p=s((m,g)=>new Promise((y,b)=>{if(u||t.aborted){b(new Error("\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430 \u0445\u0443\u043A\u043E\u0432 \u043E\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u0430."));return}let k=++a;c.set(k,{resolve:y,reject:b}),o.stdin.write(JSON.stringify({id:k,method:m,params:g})+`
73
73
  `,$=>{$&&(c.delete(k),b(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u0432\u044F\u0437\u0430\u0442\u044C\u0441\u044F \u0441 Codex.")))})}),"rpc"),d=setTimeout(f,3e4);try{return await p("initialize",{clientInfo:{name:"svaib-hook-review",version:"1"},capabilities:{experimentalApi:!0}}),o.stdin.write(`{"method":"initialized"}
74
- `),await n(p)}finally{clearTimeout(d),t.removeEventListener("abort",f),l(),i.close(),o.stdin.end(),u||o.kill()}}s(c$,"withCodexHooks");var a$=s((e,t,n)=>c$(e,t,async r=>{let o=await zi(r,e.cwd);return t.throwIfAborted(),{...await Gh(r,e.cwd,o.fingerprint),changed:o.hooks.some(c=>c.trustStatus!=="trusted")}},n),"nativeHookAutomaticForProfile"),eg=s((e,t)=>a$(e,t,Qh(Yh(),".codex")),"nativeHookAutomatic");import{join as Kf}from"node:path";import{spawn as yx}from"node:child_process";import{lstat as wx,readFile as Ig,writeFile as bx,rename as vx,rm as $x}from"node:fs/promises";import{randomUUID as xx}from"node:crypto";import{join as _t,posix as kx,win32 as Sx}from"node:path";import{access as u$,chmod as l$,lstat as Ii,mkdir as Of,readFile as Oi,writeFile as mt,rename as rg}from"node:fs/promises";import{homedir as f$,userInfo as p$}from"node:os";import{dirname as og,join as V,relative as d$,resolve as ig,sep as m$,win32 as h$}from"node:path";import{spawn as g$}from"node:child_process";var cn="@agentclientprotocol/claude-agent-acp@0.100.0",Ae="k3.1-pro",If=[[Ae,"Kimi K3.1 Pro"],["k3.1-pro-highspeed","Kimi K3.1 Pro Highspeed (\u0431\u043E\u043B\u044C\u0448\u0435 \u043A\u0432\u043E\u0442\u044B)"],["k3","Kimi K3"],["k3-256k","Kimi K3 256K"],["kimi-for-coding","Kimi K2.8 Preview"],["kimi-for-coding-highspeed","Kimi K2.7 Code Highspeed (\u0431\u043E\u043B\u044C\u0448\u0435 \u043A\u0432\u043E\u0442\u044B)"]];function Ef(e=!1){return e?{env:_$()}:{model:Ae,effortLevel:"high",availableModels:If.map(([t])=>t),modelPicker:{replaceBuiltInOptions:!0,options:If.map(([t,n])=>({model:t,label:n}))},env:{ANTHROPIC_BASE_URL:"https://api.kimi.ai/coding/",ANTHROPIC_MODEL:Ae,ANTHROPIC_DEFAULT_FABLE_MODEL:Ae,ANTHROPIC_DEFAULT_OPUS_MODEL:Ae,ANTHROPIC_DEFAULT_SONNET_MODEL:Ae,ANTHROPIC_DEFAULT_HAIKU_MODEL:Ae,CLAUDE_CODE_SUBAGENT_MODEL:Ae,CLAUDE_CODE_MODEL_CAPABILITIES:"k3*=effort,max_effort,-xhigh_effort;kimi-for-coding=effort,max_effort,-xhigh_effort;kimi-for-coding-highspeed=-effort,-max_effort,-xhigh_effort"}}}s(Ef,"settings");function _$(){let e="k3.1-pro[1m]";return{ANTHROPIC_BASE_URL:"https://api.kimi.ai/coding/",ANTHROPIC_MODEL:e,ANTHROPIC_CUSTOM_MODEL_OPTION:e,ANTHROPIC_CUSTOM_MODEL_OPTION_NAME:"Kimi K3.1 Pro (1M)",CLAUDE_MODEL_CONFIG:JSON.stringify({availableModels:[e]}),ANTHROPIC_DEFAULT_FABLE_MODEL:e,ANTHROPIC_DEFAULT_OPUS_MODEL:e,ANTHROPIC_DEFAULT_SONNET_MODEL:e,ANTHROPIC_DEFAULT_HAIKU_MODEL:e,CLAUDE_CODE_SUBAGENT_MODEL:e,CLAUDE_CODE_EFFORT_LEVEL:"high",MAX_THINKING_TOKENS:"16384",CLAUDE_CODE_AUTO_COMPACT_WINDOW:"1048576",CLAUDE_CODE_MAX_CONTEXT_TOKENS:"1048576"}}s(_$,"legacyEnv");function Nf(e,t,n={}){return new Promise((r,o)=>{let i=g$(e,t,{stdio:"inherit",...n});i.once("error",()=>o(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443. \u041F\u0440\u043E\u0432\u0435\u0440\u044C Node.js 22+ \u0438 npm."))),i.once("exit",c=>c===0?r():o(new Error(`\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0430\u0441\u044C \u0441 \u043A\u043E\u0434\u043E\u043C ${c}. \u0421\u043E\u0445\u0440\u0430\u043D\u0438 \u0442\u0435\u043A\u0443\u0449\u0438\u0439 \u0448\u0430\u0433 \u0438 \u043F\u0435\u0440\u0435\u0434\u0430\u0439 \u043F\u043E\u043C\u043E\u0449\u043D\u0438\u043A\u0443 \u0442\u0435\u043A\u0441\u0442 \u043E\u0448\u0438\u0431\u043A\u0438 \u0431\u0435\u0437 \u043A\u043B\u044E\u0447\u0430.`)))})}s(Nf,"command");async function tg(e){if(await Of(e,{recursive:!0,mode:448}),(await Ii(e)).isSymbolicLink())throw new Error("\u041F\u0430\u043F\u043A\u0430 \u043F\u0440\u043E\u0444\u0438\u043B\u044F \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u0441\u0438\u043C\u0432\u043E\u043B\u0438\u0447\u0435\u0441\u043A\u043E\u0439 \u0441\u0441\u044B\u043B\u043A\u043E\u0439.");if(process.platform==="win32"){let t=Object.entries(process.env).find(([n])=>n.toLowerCase()==="systemroot")?.[1]??"C:\\Windows";await Nf(h$.join(t,"System32","icacls.exe"),[e,"/inheritance:r","/grant:r",`${p$().username}:(OI)(CI)F`],{stdio:"ignore"})}else await l$(e,448)}s(tg,"privateDirectory");function ht(e,t=process.execPath,n=!1){let r=V(e,"launch.mjs"),o=d$(f$(),V(e,"claude","skills"));return{id:"claude-kimi",displayName:"Kimi (CC)",command:t,args:[r],...n?{modelCli:{listArgs:[r,"--list-models"],primaryModels:[n===!0?"k3.1-pro[1m]":Ae]}}:{},nativeSkillRoots:{user:o.startsWith("..")?[]:[o.split(m$).join("/")],project:[".claude/skills",".agents/skills"].map(i=>({path:i,recursive:!0,ancestors:!0}))}}}s(ht,"registration");async function y$(e=process.execPath){let t=og(e);for(let n of[V(t,"node_modules/npm/bin/npm-cli.js"),ig(t,"../lib/node_modules/npm/bin/npm-cli.js"),"/usr/share/nodejs/npm/bin/npm-cli.js"])try{return await u$(n),n}catch{}throw new Error("npm \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D \u0440\u044F\u0434\u043E\u043C \u0441 Node.js. \u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438 Node.js 22+ \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u043C \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0449\u0438\u043A\u043E\u043C \u0441 npm.")}s(y$,"npmCliPath");async function sg({root:e,apiKey:t,install:n=Nf,npmCli:r=null,nodeExecutable:o=process.execPath}){if(!/^sk-kimi-[A-Za-z0-9_-]+$/.test(t))throw new Error("\u041E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F \u043A\u043B\u044E\u0447 Kimi Code \u0432\u0438\u0434\u0430 sk-kimi-\u2026; \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u043E.");e=ig(e),await Of(og(e),{recursive:!0}),await Of(e,{mode:448}),await tg(e);let i=V(e,"claude");return await tg(i),await mt(V(e,"credentials.json"),JSON.stringify({apiKey:t}),{mode:384,flag:"wx"}),await mt(V(i,"settings.json"),JSON.stringify(Ef(),null,2),{mode:384,flag:"wx"}),await mt(V(i,".claude.json"),JSON.stringify({hasCompletedOnboarding:!0,penguinModeOrgEnabled:!0}),{mode:384,flag:"wx"}),await mt(V(e,"setup-owner.json"),JSON.stringify({schema:1,adapter:cn,nodeExecutable:o}),{mode:384,flag:"wx"}),ag({root:e,install:n,npmCli:r,nodeExecutable:o})}s(sg,"provision");async function cg({root:e,install:t=Nf,npmCli:n=null,nodeExecutable:r=null}){for(let c of["","setup-owner.json","credentials.json","claude","claude/settings.json"])if((await Ii(V(e,c))).isSymbolicLink())throw new Error("\u041F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0451\u043D. \u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0438\u0441\u0430\u043D\u043E.");let o=JSON.parse(await Oi(V(e,"setup-owner.json"),"utf8"));if(o.schema!==1||o.adapter!==cn||typeof o.nodeExecutable!="string")throw new Error("\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438.");if(r&&r!==o.nodeExecutable){o.nodeExecutable=r;let c=V(e,"setup-owner.json.resume");await mt(c,JSON.stringify(o),{flag:"wx",mode:384}),await rg(c,V(e,"setup-owner.json"))}let i=await ag({root:e,install:t,npmCli:n,nodeExecutable:o.nodeExecutable});return Cf(e).then(()=>i)}s(cg,"resumeProvision");async function ag({root:e,install:t,npmCli:n,nodeExecutable:r}){let o=V(e,"runtime");await t(r,[n??await y$(r),"install","--prefix",o,"--no-audit","--no-fund",cn]);let i=Af(e);await ng(V(e,"launch.mjs"),i);let c=ht(e,r);return await ng(V(e,"bb-agent.json"),JSON.stringify(c,null,2)),c}s(ag,"finishProvision");async function ng(e,t){try{await mt(e,t,{mode:384,flag:"wx"})}catch(n){if(n.code!=="EEXIST"||(await Ii(e)).isSymbolicLink()||await Oi(e,"utf8")!==t)throw n}}s(ng,"sameOrNew");function Af(e,t=!1){let n=V(e,"runtime","node_modules","@agentclientprotocol","claude-agent-acp","dist");return`import { readFileSync } from 'node:fs';
74
+ `),await n(p)}finally{clearTimeout(d),t.removeEventListener("abort",f),l(),i.close(),o.stdin.end(),u||o.kill()}}s(w$,"withCodexHooks");var b$=s((e,t,n)=>w$(e,t,async r=>{let o=await Ti(r,e.cwd);return t.throwIfAborted(),{...await og(r,e.cwd,o.fingerprint),changed:o.hooks.some(c=>c.trustStatus!=="trusted")}},n),"nativeHookAutomaticForProfile"),ag=s((e,t)=>b$(e,t,cg(sg(),".codex")),"nativeHookAutomatic");import{join as Yf}from"node:path";import{spawn as Fx}from"node:child_process";import{lstat as Ux,readFile as Mg,writeFile as Vx,rename as Kx,rm as Hx}from"node:fs/promises";import{randomUUID as Bx}from"node:crypto";import{join as bt,posix as Jx,win32 as Wx}from"node:path";import{access as v$,chmod as $$,lstat as Li,mkdir as Lf,readFile as ln,writeFile as _t,rename as fg,rm as x$}from"node:fs/promises";import{randomUUID as k$}from"node:crypto";import{homedir as S$,userInfo as P$}from"node:os";import{dirname as pg,join as F,relative as z$,resolve as dg,sep as O$,win32 as E$}from"node:path";import{spawn as I$}from"node:child_process";var fn="@agentclientprotocol/claude-agent-acp@0.100.0",X="k3.1-pro",Xe=[[X,"Kimi K3.1 Pro"],["k3.1-pro-highspeed","Kimi K3.1 Pro Highspeed (\u0431\u043E\u043B\u044C\u0448\u0435 \u043A\u0432\u043E\u0442\u044B)"],["k3","Kimi K3"],["k3-256k","Kimi K3 256K"],["kimi-for-coding","Kimi K2.8 Preview"],["kimi-for-coding-highspeed","Kimi K2.7 Code Highspeed (\u0431\u043E\u043B\u044C\u0448\u0435 \u043A\u0432\u043E\u0442\u044B)"]];function Zi(e=!1){return e?{env:M$()}:{model:X,effortLevel:"high",availableModels:Xe.map(([t])=>t),modelPicker:{replaceBuiltInOptions:!0,options:Xe.map(([t,n])=>({model:t,label:n}))},env:{ANTHROPIC_BASE_URL:"https://api.kimi.ai/coding/",ANTHROPIC_MODEL:X,ANTHROPIC_DEFAULT_FABLE_MODEL:X,ANTHROPIC_DEFAULT_OPUS_MODEL:X,ANTHROPIC_DEFAULT_SONNET_MODEL:X,ANTHROPIC_DEFAULT_HAIKU_MODEL:X,CLAUDE_CODE_SUBAGENT_MODEL:X,CLAUDE_CODE_MODEL_CAPABILITIES:"k3*=effort,max_effort,-xhigh_effort;kimi-for-coding=effort,max_effort,-xhigh_effort;kimi-for-coding-highspeed=-effort,-max_effort,-xhigh_effort"}}}s(Zi,"catalogSettings");var qe=262144,ke=1e6,A$=s(()=>({shortWindow:qe,longModels:[]}),"safePolicy");async function N$(e,{fetchImpl:t=fetch,signal:n,log:r=s(()=>{},"log")}={}){let o=Date.now(),i=AbortSignal.timeout(8e3);r("catalog-fetch","start");try{n?.throwIfAborted();let c=await t("https://api.kimi.ai/coding/v1/models",{headers:{Authorization:`Bearer ${e}`,"User-Agent":"svaib-workplace/kimi-setup"},redirect:"error",signal:n?AbortSignal.any([n,i]):i});if(!c.ok)return r("catalog-fetch","fallback",{reason:"http-error",httpStatus:c.status,elapsedMs:Date.now()-o}),await c.body?.cancel(),null;let a="",u=0,l=new TextDecoder;for await(let p of c.body){if(u+=p.byteLength,u>262144)return r("catalog-fetch","fallback",{reason:"oversized",elapsedMs:Date.now()-o}),null;a+=l.decode(p,{stream:!0})}a+=l.decode();let f=JSON.parse(a);return r("catalog-fetch","success",{byteCount:u,elapsedMs:Date.now()-o}),f}catch(c){return r("catalog-fetch",n?.aborted?"failure":"fallback",{reason:n?.aborted?"cancelled":i.aborted?"timeout":c instanceof SyntaxError?"invalid-json":"network-error",elapsedMs:Date.now()-o}),n?.throwIfAborted(),null}}s(N$,"fetchCatalog");var C$=/^[a-z0-9][a-z0-9._/-]{0,127}$/,T$=new Set(["default","opus","sonnet","haiku","best","opusplan","__proto__","constructor","prototype"]);function mg(e){return typeof e=="string"&&C$.test(e)&&!T$.has(e)}s(mg,"validId");function Rf(){return{defaultModel:X,models:Xe.map(([e,t])=>({id:e,label:t,context:qe,effort:e!=="kimi-for-coding-highspeed",maxEffort:e!=="kimi-for-coding-highspeed",retired:!1}))}}s(Rf,"seedCatalog");function D$(e){if(!Array.isArray(e?.data)||!e.data.length||e.data.length>128)return null;let t=[],n=new Set;for(let r of e.data){if(!mg(r?.id)||n.has(r.id))return null;n.add(r.id);let o=typeof r.display_name=="string"?r.display_name.replace(/[\u0000-\u001f\u007f]/g,"").trim().slice(0,120):r.id,i=r.id==="k3-256k"||r.id==="kimi-for-coding-highspeed",c=[r.context_length,r.limit?.context].filter(f=>Number.isSafeInteger(f)&&f>0),a=c.length?Math.min(...c,i?qe:ke):qe,u=r.think_efforts?.support===!1?[]:r.think_efforts?.valid_efforts??r.reasoning?.effort?.valid,l=r.supports_reasoning!==!1&&Array.isArray(u)&&u.includes("low")&&u.includes("high");t.push({id:r.id,label:o||r.id,context:a,effort:l,maxEffort:l&&u.includes("max"),retired:!1})}return t}s(D$,"parseCatalog");function Z$(e){return e&&Array.isArray(e.models)&&e.models.length>0&&e.models.length<=129&&e.models.some(t=>t.id===e.defaultModel)&&new Set(e.models.map(t=>t.id)).size===e.models.length&&e.models.every(t=>mg(t.id)&&typeof t.label=="string"&&t.label.length<=120&&Number.isSafeInteger(t.context)&&t.context>0&&t.context<=ke&&typeof t.effort=="boolean"&&typeof t.maxEffort=="boolean"&&typeof t.retired=="boolean")}s(Z$,"validCatalog");async function L$(e,t=Rf(),n={}){let r=await N$(e,n),o=D$(r),i=s(a=>({...a,context:Math.min(qe,a.context)}),"fallback");if(!o)return n.log?.("catalog-normalize","fallback",{reason:r===null?"cached":"invalid-catalog",modelCount:t.models.length,longModelCount:0}),{...t,models:t.models.map(i)};if(n.log?.("catalog-normalize","success",{modelCount:o.length,longModelCount:o.filter(a=>a.context>=ke).length}),n.initial)return{defaultModel:o.some(a=>a.id===t.defaultModel)?t.defaultModel:o[0].id,models:o};let c=t.models.find(a=>a.id===t.defaultModel);return c&&!o.some(a=>a.id===c.id)&&o.push({...i(c),retired:!0}),{defaultModel:t.defaultModel,models:o}}s(L$,"discoverCatalog");function jf(e){let t=Zi(),n=Math.min(qe,...e.models.filter(c=>c.context<ke).map(c=>c.context)),r=s(c=>e.models.find(a=>a.id===c)?.context>=ke?`${c}[1m]`:c,"modelId"),o=s(c=>c.context>=ke?ke:n,"window"),i=r(e.defaultModel);return{...t,model:i,availableModels:e.models.map(c=>r(c.id)),availableModelsMatch:"exact",modelPicker:{replaceBuiltInOptions:!0,options:e.models.map(c=>({model:r(c.id),label:`${c.label} (${o(c)===ke?"1M":Math.floor(o(c)/1024)+"K"})`,...c.retired?{description:"\u041C\u043E\u0434\u0435\u043B\u044C \u0431\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0432 \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u0435 Kimi. \u0412\u044B\u0431\u0435\u0440\u0438 \u0434\u0440\u0443\u0433\u0443\u044E \u043C\u043E\u0434\u0435\u043B\u044C \u0434\u043B\u044F \u043D\u043E\u0432\u043E\u0433\u043E \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u0430."}:{}}))},modelSettings:Object.fromEntries(e.models.map(c=>[c.id,{autoCompactWindow:Math.max(1e5,o(c))}])),env:{...t.env,ANTHROPIC_MODEL:i,ANTHROPIC_DEFAULT_FABLE_MODEL:i,ANTHROPIC_DEFAULT_OPUS_MODEL:i,ANTHROPIC_DEFAULT_SONNET_MODEL:i,ANTHROPIC_DEFAULT_HAIKU_MODEL:i,CLAUDE_CODE_SUBAGENT_MODEL:i,CLAUDE_CODE_MAX_CONTEXT_TOKENS:String(n),CLAUDE_CODE_MODEL_CAPABILITIES:e.models.map(c=>`${c.id}=${c.effort?"":"-"}effort,${c.maxEffort?"":"-"}max_effort,-xhigh_effort`).join(";")}}}s(jf,"dynamicSettings");function R$(e=A$()){let t=Zi(),n=s(o=>e.longModels.includes(o)?`${o}[1m]`:o,"modelId"),r=s(o=>e.longModels.includes(o)?ke:e.shortWindow,"window");return{...t,model:n(X),availableModels:Xe.map(([o])=>n(o)),availableModelsMatch:"exact",modelPicker:{replaceBuiltInOptions:!0,options:Xe.map(([o,i])=>({model:n(o),label:`${i} (${r(o)===ke?"1M":Math.floor(r(o)/1024)+"K"})`}))},modelSettings:Object.fromEntries(Xe.map(([o])=>[o,{autoCompactWindow:Math.max(1e5,r(o))}])),env:{...t.env,ANTHROPIC_MODEL:n(X),ANTHROPIC_DEFAULT_FABLE_MODEL:n(X),ANTHROPIC_DEFAULT_OPUS_MODEL:n(X),ANTHROPIC_DEFAULT_SONNET_MODEL:n(X),ANTHROPIC_DEFAULT_HAIKU_MODEL:n(X),CLAUDE_CODE_SUBAGENT_MODEL:n(X),CLAUDE_CODE_MAX_CONTEXT_TOKENS:String(e.shortWindow)}}}s(R$,"contextSettingsV2");function j$(e){if([Zi(),Zi(!0)].some(t=>e===JSON.stringify(t,null,2)))return!0;try{let t=JSON.parse(e),n=Number(t.env?.CLAUDE_CODE_MAX_CONTEXT_TOKENS);if(!Number.isSafeInteger(n)||n<=0||n>qe)return!1;let r=Xe.filter(([o])=>t.availableModels?.includes(`${o}[1m]`)).map(([o])=>o);return e===JSON.stringify(R$({shortWindow:n,longModels:r}),null,2)}catch{return!1}}s(j$,"generatedSettings");function M$(){let e="k3.1-pro[1m]";return{ANTHROPIC_BASE_URL:"https://api.kimi.ai/coding/",ANTHROPIC_MODEL:e,ANTHROPIC_CUSTOM_MODEL_OPTION:e,ANTHROPIC_CUSTOM_MODEL_OPTION_NAME:"Kimi K3.1 Pro (1M)",CLAUDE_MODEL_CONFIG:JSON.stringify({availableModels:[e]}),ANTHROPIC_DEFAULT_FABLE_MODEL:e,ANTHROPIC_DEFAULT_OPUS_MODEL:e,ANTHROPIC_DEFAULT_SONNET_MODEL:e,ANTHROPIC_DEFAULT_HAIKU_MODEL:e,CLAUDE_CODE_SUBAGENT_MODEL:e,CLAUDE_CODE_EFFORT_LEVEL:"high",MAX_THINKING_TOKENS:"16384",CLAUDE_CODE_AUTO_COMPACT_WINDOW:"1048576",CLAUDE_CODE_MAX_CONTEXT_TOKENS:"1048576"}}s(M$,"legacyEnv");function Mf(e,t,n={}){return new Promise((r,o)=>{let i=I$(e,t,{stdio:"inherit",...n});i.once("error",()=>o(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443. \u041F\u0440\u043E\u0432\u0435\u0440\u044C Node.js 22+ \u0438 npm."))),i.once("exit",c=>c===0?r():o(new Error(`\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0430\u0441\u044C \u0441 \u043A\u043E\u0434\u043E\u043C ${c}. \u0421\u043E\u0445\u0440\u0430\u043D\u0438 \u0442\u0435\u043A\u0443\u0449\u0438\u0439 \u0448\u0430\u0433 \u0438 \u043F\u0435\u0440\u0435\u0434\u0430\u0439 \u043F\u043E\u043C\u043E\u0449\u043D\u0438\u043A\u0443 \u0442\u0435\u043A\u0441\u0442 \u043E\u0448\u0438\u0431\u043A\u0438 \u0431\u0435\u0437 \u043A\u043B\u044E\u0447\u0430.`)))})}s(Mf,"command");async function ug(e){if(await Lf(e,{recursive:!0,mode:448}),(await Li(e)).isSymbolicLink())throw new Error("\u041F\u0430\u043F\u043A\u0430 \u043F\u0440\u043E\u0444\u0438\u043B\u044F \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u0430 \u0431\u044B\u0442\u044C \u0441\u0438\u043C\u0432\u043E\u043B\u0438\u0447\u0435\u0441\u043A\u043E\u0439 \u0441\u0441\u044B\u043B\u043A\u043E\u0439.");if(process.platform==="win32"){let t=Object.entries(process.env).find(([n])=>n.toLowerCase()==="systemroot")?.[1]??"C:\\Windows";await Mf(E$.join(t,"System32","icacls.exe"),[e,"/inheritance:r","/grant:r",`${P$().username}:(OI)(CI)F`],{stdio:"ignore"})}else await $$(e,448)}s(ug,"privateDirectory");function yt(e,t=process.execPath,n=!1){let r=F(e,"launch.mjs"),o=z$(S$(),F(e,"claude","skills"));return{id:"claude-kimi",displayName:"Kimi (CC)",command:t,args:[r],...n?{modelCli:{listArgs:[r,"--list-models"],primaryModels:[n===!0?"k3.1-pro[1m]":X]}}:{},nativeSkillRoots:{user:o.startsWith("..")?[]:[o.split(O$).join("/")],project:[".claude/skills",".agents/skills"].map(i=>({path:i,recursive:!0,ancestors:!0}))}}}s(yt,"registration");async function F$(e=process.execPath){let t=pg(e);for(let n of[F(t,"node_modules/npm/bin/npm-cli.js"),dg(t,"../lib/node_modules/npm/bin/npm-cli.js"),"/usr/share/nodejs/npm/bin/npm-cli.js"])try{return await v$(n),n}catch{}throw new Error("npm \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D \u0440\u044F\u0434\u043E\u043C \u0441 Node.js. \u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438 Node.js 22+ \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u043C \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0449\u0438\u043A\u043E\u043C \u0441 npm.")}s(F$,"npmCliPath");async function hg({root:e,apiKey:t,install:n=Mf,npmCli:r=null,nodeExecutable:o=process.execPath,fetchImpl:i=fetch,signal:c,log:a=s(()=>{},"log")}){if(!/^sk-kimi-[A-Za-z0-9_-]+$/.test(t))throw new Error("\u041E\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044F \u043A\u043B\u044E\u0447 Kimi Code \u0432\u0438\u0434\u0430 sk-kimi-\u2026; \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u043D\u0435 \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u043E.");e=dg(e),await Lf(pg(e),{recursive:!0}),await Lf(e,{mode:448}),await ug(e);let u=F(e,"claude");await ug(u),await _t(F(e,"credentials.json"),JSON.stringify({apiKey:t}),{mode:384,flag:"wx"});let l=Rf();return await _t(F(u,"settings.json"),JSON.stringify(jf(l),null,2),{mode:384,flag:"wx"}),await _t(F(u,".claude.json"),JSON.stringify({hasCompletedOnboarding:!0,penguinModeOrgEnabled:!0}),{mode:384,flag:"wx"}),await _t(F(e,"setup-owner.json"),JSON.stringify({schema:1,adapter:fn,nodeExecutable:o,catalogs:[l]}),{mode:384,flag:"wx"}),await _g({root:e,install:n,npmCli:r,nodeExecutable:o,log:a}),pn(e,{fetchImpl:i,signal:c,initial:!0,log:a})}s(hg,"provision");async function gg({root:e,install:t=Mf,npmCli:n=null,nodeExecutable:r=null,fetchImpl:o=fetch,signal:i,log:c=s(()=>{},"log")}){for(let u of["","setup-owner.json","credentials.json","claude","claude/settings.json"])if((await Li(F(e,u))).isSymbolicLink())throw new Error("\u041F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0451\u043D. \u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0438\u0441\u0430\u043D\u043E.");let a=JSON.parse(await ln(F(e,"setup-owner.json"),"utf8"));if(a.schema!==1||a.adapter!==fn||typeof a.nodeExecutable!="string")throw new Error("\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438.");if(r&&r!==a.nodeExecutable){a.nodeExecutable=r;let u=F(e,"setup-owner.json.resume");await _t(u,JSON.stringify(a),{flag:"wx",mode:384}),await fg(u,F(e,"setup-owner.json"))}return await _g({root:e,install:t,npmCli:n,nodeExecutable:a.nodeExecutable,log:c}),pn(e,{fetchImpl:o,signal:i,initial:!0,log:c})}s(gg,"resumeProvision");async function _g({root:e,install:t,npmCli:n,nodeExecutable:r,log:o}){let i=F(e,"runtime"),c=Date.now();o("adapter-install","start");try{await t(r,[n??await F$(r),"install","--prefix",i,"--no-audit","--no-fund",fn]),o("adapter-install","success",{elapsedMs:Date.now()-c})}catch(l){throw o("adapter-install","failure",{reason:"failed",elapsedMs:Date.now()-c}),l}let a=Di(e);await lg(F(e,"launch.mjs"),a);let u=yt(e,r);return await lg(F(e,"bb-agent.json"),JSON.stringify(u,null,2)),u}s(_g,"finishProvision");async function lg(e,t){try{await _t(e,t,{mode:384,flag:"wx"})}catch(n){if(n.code!=="EEXIST"||(await Li(e)).isSymbolicLink()||await ln(e,"utf8")!==t)throw n}}s(lg,"sameOrNew");function Di(e,t=!1,n=!1){let r=F(e,"runtime","node_modules","@agentclientprotocol","claude-agent-acp","dist");return`import { readFileSync } from 'node:fs';
75
75
  import { dirname, join } from 'node:path';
76
76
  import { fileURLToPath, pathToFileURL } from 'node:url';
77
77
  import { spawn } from 'node:child_process';
@@ -88,20 +88,25 @@ function run(command, args, env) {
88
88
  });
89
89
  }
90
90
  if (process.argv.includes('--list-models')) {
91
- ${t?"console.log('k3.1-pro[1m] - Kimi K3.1 Pro (1M)');":If.map(([r,o])=>`console.log(${JSON.stringify(r+" - "+o)});`).join(`
92
- `)}
91
+ ${t?"console.log('k3.1-pro[1m] - Kimi K3.1 Pro (1M)');":n?Xe.map(([o,i])=>`console.log(${JSON.stringify(o+" - "+i)});`).join(`
92
+ `):`const settings = JSON.parse(readFileSync(join(root, 'claude', 'settings.json'), 'utf8'));
93
+ for (const model of settings.modelPicker.options) console.log(model.model + ' - ' + model.label);`}
93
94
  } else {
94
95
  const apiKey = JSON.parse(readFileSync(join(root, 'credentials.json'), 'utf8')).apiKey;
95
96
  const settings = JSON.parse(readFileSync(join(root, 'claude', 'settings.json'), 'utf8'));
96
97
  const env = { ...process.env, ...settings.env, ANTHROPIC_API_KEY: apiKey, CLAUDE_CONFIG_DIR: join(root, 'claude') };
97
98
  ${t?"":`for (const name of ['ANTHROPIC_CUSTOM_MODEL_OPTION', 'ANTHROPIC_CUSTOM_MODEL_OPTION_NAME', 'ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION', 'ANTHROPIC_CUSTOM_MODEL_OPTION_SUPPORTED_CAPABILITIES', 'CLAUDE_CODE_EFFORT_LEVEL', 'CLAUDE_MODEL_CONFIG', 'MAX_THINKING_TOKENS', 'CLAUDE_CODE_AUTO_COMPACT_WINDOW', 'CLAUDE_CODE_MAX_CONTEXT_TOKENS']) delete env[name];
98
99
  `}delete env.ANTHROPIC_AUTH_TOKEN;
99
- delete env.CLAUDE_CODE_EXECUTABLE;
100
+ ${t||n===!0?"":`// The 256K ceiling applies to plain IDs; [1m] is selected per model from the catalog.
101
+ env.CLAUDE_CODE_MAX_CONTEXT_TOKENS = settings.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS;
102
+ delete env.DISABLE_COMPACT;
103
+ delete env.CLAUDE_CODE_DISABLE_1M_CONTEXT;
104
+ `}delete env.CLAUDE_CODE_EXECUTABLE;
100
105
  delete env.CLAUDE_CODE_OAUTH_TOKEN;
101
106
  delete env.CLAUDE_CODE_USE_BEDROCK;
102
107
  delete env.CLAUDE_CODE_USE_VERTEX;
103
108
  delete env.CLAUDE_CODE_USE_FOUNDRY;
104
- const adapterDir = ${JSON.stringify(n)};
109
+ const adapterDir = ${JSON.stringify(r)};
105
110
  if (process.argv[2] === '--claude') {
106
111
  delete process.env.CLAUDE_CODE_EXECUTABLE;
107
112
  Object.assign(process.env, env);
@@ -112,8 +117,8 @@ if (process.argv.includes('--list-models')) {
112
117
  run(process.execPath, [join(adapterDir, 'index.js'), ...process.argv.slice(2)], env);
113
118
  }
114
119
  }
115
- `}s(Af,"launcherSource");async function Cf(e){for(let o of["","setup-owner.json","claude","claude/settings.json","launch.mjs","bb-agent.json"])if((await Ii(V(e,o))).isSymbolicLink())throw new Error("\u041F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0451\u043D. \u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0438\u0441\u0430\u043D\u043E.");let t=JSON.parse(await Oi(V(e,"setup-owner.json"),"utf8"));if(t.schema!==1||t.adapter!==cn)throw new Error("\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438.");let n=[["claude/settings.json",JSON.stringify(Ef(!0),null,2),JSON.stringify(Ef(),null,2)],["launch.mjs",Af(e,!0),Af(e)],["bb-agent.json",JSON.stringify(ht(e,t.nodeExecutable,!0),null,2),JSON.stringify(ht(e,t.nodeExecutable),null,2)]],r=[];for(let[o,i,c]of n){let a=await Oi(V(e,o),"utf8"),u=o==="bb-agent.json"?JSON.stringify(ht(e,t.nodeExecutable,"catalog"),null,2):null;if(a!==i&&a!==c&&a!==u)throw new Error("\u041F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0451\u043D. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B.");a!==c&&r.push([o,c])}for(let[o,i]of r){let c=V(e,o+".upgrade");await mt(c,i,{mode:384,flag:"wx"}),await rg(c,V(e,o))}return ht(e,t.nodeExecutable)}s(Cf,"upgradeProvision");import{createHash as Ff}from"node:crypto";import{spawn as zg}from"node:child_process";import{chmod as sx,lstat as cx,mkdir as ax,mkdtemp as ux,readFile as jf,rename as lx,rm as fx,writeFile as Sg}from"node:fs/promises";import{dirname as px,join as H,win32 as dx}from"node:path";var w$=mr(vi(),1);var b$=mr(wf(),1);import{spawn as v$,spawnSync as $$}from"node:child_process";import{accessSync as x$,constants as ug,existsSync as k$,readdirSync as S$,realpathSync as lg,statSync as P$}from"node:fs";import{createRequire as z$}from"node:module";import{homedir as bg}from"node:os";import{basename as Ai,delimiter as Rf,dirname as xe,extname as O$,isAbsolute as Ei,join as re}from"node:path";import{fileURLToPath as I$}from"node:url";import Tf from"node:fs";import pr from"node:path";import fr from"node:process";import{AsyncLocalStorage as _g}from"node:async_hooks";import{availableParallelism as Y$}from"node:os";var gt=fr.platform==="win32",E$=gt?new RegExp("[\\/\\\\]","v"):new RegExp("\\/","v"),A$=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC";function N$(e,t){if(typeof e!="string"||e.length===0)throw new TypeError("Expected a non-empty string.");let{cwd:n=fr.cwd(),path:r=fr.env.PATH??(gt?fr.env.Path:void 0)??"",pathExt:o=fr.env.PATHEXT||A$}=t;return{cwd:n,searchPath:r,pathExt:o}}s(N$,"resolveOptions");function C$(e,t){let n=t.split(pr.delimiter).filter(Boolean),r=pr.extname(e).toLowerCase();return r!==""&&n.some(o=>o.toLowerCase()===r)?["",...n]:n}s(C$,"windowsExtensions");function*T$(e,{cwd:t,searchPath:n,pathExt:r}){let o=gt?C$(e,r):[""];if(E$.test(e)){let c=pr.resolve(t,e);for(let a of o)yield c+a;return}let i=[...gt?[t]:[],...n.split(pr.delimiter)];for(let c of i){let a=gt&&c.length>1&&c.startsWith('"')&&c.endsWith('"')?c.slice(1,-1):c;if(a==="")continue;let u=pr.resolve(t,a,e);for(let l of o)yield u+l}}s(T$,"candidatePaths");function Z$(e){let t;try{t=Tf.statSync(e)}catch(n){return gt&&n.code==="EACCES"}if(!t.isFile())return!1;if(gt)return!0;try{return Tf.accessSync(e,Tf.constants.X_OK),!0}catch{return!1}}s(Z$,"isExecutableSync");function fg(e,t={}){let n=N$(e,t);for(let r of T$(e,n))if(Z$(r))return r}s(fg,"whichCommandSync");var vg={"--use-system-ca":"NODE_USE_SYSTEM_CA","--use-env-proxy":"NODE_USE_ENV_PROXY"},pg="--use-env-proxy",D$=new Set(["HTTP_PROXY","HTTPS_PROXY"]),dg="NO_PROXY",R$=["localhost","127.0.0.1","::1","[::1]"];function L$(e){return Object.hasOwn(vg,e)}s(L$,"isNodeNetworkFlag");function j$(e){if(/[\r\n]/u.test(e))return!1;try{let t=new URL(e);return(t.protocol==="http:"||t.protocol==="https:")&&t.hostname!==""}catch{return!1}}s(j$,"isHttpProxyUrl");function M$(e){return Object.entries(e).filter(t=>D$.has(t[0].toUpperCase())&&t[1]!==void 0&&t[1]!=="")}s(M$,"proxyEntries");function F$(e){let t=e.split(/[\s,]+/u).filter(Boolean);if(t.includes("*"))return e;let n=new Set(t.map(r=>r.toLowerCase()));return[...t,...R$.filter(r=>!n.has(r))].join(",")}s(F$,"appendLoopback");function V$(e){let t={...e},n=Object.keys(t).filter(r=>r.toUpperCase()===dg&&t[r]!==void 0);for(let r of n.length>0?n:[dg])t[r]=F$(t[r]??"");return t}s(V$,"withLoopbackNoProxy");function U$(e,t){let n=e.filter(i=>!L$(i)||t[vg[i]]!=="0");if(!n.includes(pg))return{nodeArgs:n,env:t,rejectedProxyKeys:[]};let r=M$(t),o=r.filter(([,i])=>!j$(i)).map(([i])=>i);return o.length>0?{nodeArgs:n.filter(i=>i!==pg),env:t,rejectedProxyKeys:o}:{nodeArgs:n,env:r.length>0?V$(t):t,rejectedProxyKeys:[]}}s(U$,"nodeNetworkLaunch");var mg=new Set;function K$(e,t){let n=U$(e,t),r=n.rejectedProxyKeys.filter(o=>!mg.has(o));if(r.length>0){for(let o of r)mg.add(o);process.emitWarning(`bb started a Node process without --use-env-proxy because ${r.join(", ")} is not an http:// or https:// URL. Add the scheme, for example http://proxy.example:3128, so bb uses the proxy.`,{code:"BB_INVALID_PROXY_ENV"})}return{nodeArgs:n.nodeArgs,env:n.env}}s(K$,"prepareNodeNetworkLaunch");function H$(e,t){let n=e.findIndex(i=>i==="--"||!i.startsWith("-")),r=n<0?e.length:n,o=K$(e.slice(0,r),t);return{args:[...o.nodeArgs,...e.slice(r)],env:o.env}}s(H$,"prepareNodeNetworkCommand");var $g=["HTTP_PROXY","HTTPS_PROXY","NO_PROXY","http_proxy","https_proxy","no_proxy","NODE_EXTRA_CA_CERTS","SSL_CERT_FILE","SSL_CERT_DIR"],Zf="__BB_SHELL_ENV_START__",hg="__BB_SHELL_ENV_END__",xg=3e3,B$=1024*1024;function an(e){try{return x$(e,process.platform==="win32"?ug.F_OK:ug.X_OK),P$(e).isFile()}catch{return!1}}s(an,"executable");function Ne(e,t){return process.platform!=="win32"?e[t]:e[Object.keys(e).find(n=>n.toUpperCase()===t.toUpperCase())??t]}s(Ne,"envValue");function Lf(...e){let t=new Set;return e.flatMap(n=>(n??"").split(Rf)).filter(n=>{if(!n)return!1;let r=process.platform==="win32"?n.replace(/[\\/]+$/u,"").toLowerCase():n;return t.has(r)?!1:(t.add(r),!0)}).join(Rf)}s(Lf,"mergePath");function J$(e){if(process.platform!=="win32")return e;try{let t=Ai(e).toLowerCase(),n=S$(xe(e)).find(r=>r.toLowerCase()===t);return n===void 0?e:re(xe(e),n)}catch{return e}}s(J$,"onDiskName");function gg(e,t,n){return new Promise(r=>{let o="",i=!1,c,a=s(l=>{i||(i=!0,clearTimeout(c),r({status:l,stdout:o}))},"finish"),u;try{u=v$(e,t,{cwd:bg(),env:n,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{a(null);return}c=setTimeout(()=>{u.kill("SIGKILL"),a(null)},xg),u.stdout?.setEncoding("utf8"),u.stdout?.on("data",l=>{o.length<B$&&(o+=l)}),u.once("error",()=>a(null)),u.once("close",l=>a(l))})}s(gg,"runProbe");async function W$(e,t){if(process.platform==="win32"){let i=re(Ne(e,"SystemRoot")??"C:\\Windows","System32","reg.exe"),c={...e},a=[];for(let l of["HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment","HKCU\\Environment"]){let f=await gg(i,["query",l],e);if(f.status===0)for(let p of f.stdout.matchAll(/^ {4}(.+?) {4}REG_[A-Z_]+ {4}(.*)$/gmu)){let d=p[1]?.trim();if(!d)continue;let m=(p[2]??"").trim();if(d.toUpperCase()==="PATH")a.push(m);else{let g=Object.keys(c).find(y=>y.toUpperCase()===d.toUpperCase());c[g??d]=m}}}let u=s(l=>{for(let f=0;f<10;f+=1){let p=l.replace(/%([^%;\\/]+)%/gu,(d,m)=>Ne(c,m)??d);if(p===l)break;l=p}return l},"expand");return a.length===0?null:{PATH:Lf(...a.map(u),Ne(e,"PATH"))}}let n=e.SHELL?.trim()||(process.platform==="darwin"?"/bin/zsh":"/bin/sh"),r=`printf '%s\\n' ${Zf}; /usr/bin/env; printf '%s\\n' ${hg}`,o=["sh","dash"].includes(Ai(n))?["-lc"]:["-ilc","-lc"];for(let i of o){let c=await gg(n,[i,r],e);if(c.status!==0){if(t)return null;continue}let a=c.stdout.indexOf(`${Zf}
120
+ `}s(Di,"launcherSource");async function gr(e){for(let a of["","setup-owner.json","credentials.json","claude","claude/settings.json","launch.mjs","bb-agent.json"])if((await Li(F(e,a))).isSymbolicLink())throw new Error("\u041F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0451\u043D. \u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0438\u0441\u0430\u043D\u043E.");let t=await ln(F(e,"setup-owner.json"),"utf8"),n=JSON.parse(t);if(n.schema!==1||n.adapter!==fn)throw new Error("\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438.");if(n.catalogs!==void 0&&(!Array.isArray(n.catalogs)||n.catalogs.length>2||!n.catalogs.every(Z$)))throw new Error("\u041F\u043E\u0432\u0440\u0435\u0436\u0434\u0451\u043D \u043A\u0430\u0442\u0430\u043B\u043E\u0433 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438.");let r=[["claude/settings.json",null,null],["launch.mjs",Di(e,!0),Di(e)],["bb-agent.json",JSON.stringify(yt(e,n.nodeExecutable,!0),null,2),JSON.stringify(yt(e,n.nodeExecutable),null,2)]],o=[],i=[["setup-owner.json",t]],c;for(let[a,u,l]of r){let f=await ln(F(e,a),"utf8");i.push([a,f]);let p=a==="bb-agent.json"?JSON.stringify(yt(e,n.nodeExecutable,"catalog"),null,2):null;if(a==="claude/settings.json"&&(c=n.catalogs?.find(m=>f===JSON.stringify(jf(m),null,2))),!(a==="claude/settings.json"?!!c||j$(f):f===u||f===l||f===p||a==="launch.mjs"&&[!0,"context"].some(m=>f===Di(e,!1,m))))throw new Error("\u041F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0451\u043D. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B.");a!=="claude/settings.json"&&f!==l&&o.push([a,l])}return{pending:o,owner:n,snapshots:i,catalog:c??Rf()}}s(gr,"validateProvision");async function Zf(e,t){let n=e+".upgrade-"+k$();try{await _t(n,t,{mode:384,flag:"wx"}),await fg(n,e)}finally{await x$(n,{force:!0})}}s(Zf,"atomicWrite");async function pn(e,{fetchImpl:t=fetch,signal:n,initial:r=!1,restrictContext:o=!1,log:i=s(()=>{},"log")}={}){i("profile-validate","start");let c;try{c=await gr(e)}catch(y){throw i("profile-validate","failure",{reason:"failed"}),y}let{pending:a,owner:u,snapshots:l,catalog:f}=c;i("profile-validate","success");let p=await ln(F(e,"credentials.json"),"utf8"),{apiKey:d}=JSON.parse(p),m=o?{...f,models:f.models.map(y=>({...y,context:Math.min(qe,y.context)}))}:await L$(d,f,{fetchImpl:t,signal:n,initial:r,log:i});o&&i("catalog-normalize","fallback",{reason:"conservative",modelCount:m.models.length,longModelCount:0}),n?.throwIfAborted();let g=Date.now();i("profile-write","start");try{await gr(e);for(let[b,k]of[...l,["credentials.json",p]])if(await ln(F(e,b),"utf8")!==k)throw new Error("\u041F\u0440\u043E\u0444\u0438\u043B\u044C \u0438\u0437\u043C\u0435\u043D\u0438\u043B\u0441\u044F \u0432\u043E \u0432\u0440\u0435\u043C\u044F \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438 \u043A\u043E\u043D\u0442\u0435\u043A\u0441\u0442\u0430. \u041F\u043E\u0432\u0442\u043E\u0440\u0438 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0443.");let y=F(e,"setup-owner.json");await Zf(y,JSON.stringify({...u,catalogs:[m,f]})),a.push(["claude/settings.json",JSON.stringify(jf(m),null,2)]);for(let[b,k]of a)await Zf(F(e,b),k);await Zf(y,JSON.stringify({...u,catalogs:[m]})),i("profile-write","success",{elapsedMs:Date.now()-g})}catch(y){throw i("profile-write","failure",{reason:"failed",elapsedMs:Date.now()-g}),y}return yt(e,u.nodeExecutable)}s(pn,"upgradeProvision");import{createHash as Wf}from"node:crypto";import{spawn as Zg}from"node:child_process";import{chmod as Ex,lstat as Ix,mkdir as Ax,mkdtemp as Nx,readFile as Bf,rename as Cx,rm as Tx,writeFile as Tg}from"node:fs/promises";import{dirname as Dx,join as H,win32 as Zx}from"node:path";var U$=vr(Oi(),1);var V$=vr(zf(),1);import{spawn as K$,spawnSync as H$}from"node:child_process";import{accessSync as B$,constants as yg,existsSync as J$,readdirSync as W$,realpathSync as wg,statSync as X$}from"node:fs";import{createRequire as q$}from"node:module";import{homedir as Eg}from"node:os";import{basename as ji,delimiter as Kf,dirname as Se,extname as G$,isAbsolute as Ri,join as oe}from"node:path";import{fileURLToPath as Y$}from"node:url";import Ff from"node:fs";import yr from"node:path";import _r from"node:process";import{AsyncLocalStorage as Pg}from"node:async_hooks";import{availableParallelism as vx}from"node:os";var wt=_r.platform==="win32",Q$=wt?new RegExp("[\\/\\\\]","v"):new RegExp("\\/","v"),ex=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC";function tx(e,t){if(typeof e!="string"||e.length===0)throw new TypeError("Expected a non-empty string.");let{cwd:n=_r.cwd(),path:r=_r.env.PATH??(wt?_r.env.Path:void 0)??"",pathExt:o=_r.env.PATHEXT||ex}=t;return{cwd:n,searchPath:r,pathExt:o}}s(tx,"resolveOptions");function nx(e,t){let n=t.split(yr.delimiter).filter(Boolean),r=yr.extname(e).toLowerCase();return r!==""&&n.some(o=>o.toLowerCase()===r)?["",...n]:n}s(nx,"windowsExtensions");function*rx(e,{cwd:t,searchPath:n,pathExt:r}){let o=wt?nx(e,r):[""];if(Q$.test(e)){let c=yr.resolve(t,e);for(let a of o)yield c+a;return}let i=[...wt?[t]:[],...n.split(yr.delimiter)];for(let c of i){let a=wt&&c.length>1&&c.startsWith('"')&&c.endsWith('"')?c.slice(1,-1):c;if(a==="")continue;let u=yr.resolve(t,a,e);for(let l of o)yield u+l}}s(rx,"candidatePaths");function ox(e){let t;try{t=Ff.statSync(e)}catch(n){return wt&&n.code==="EACCES"}if(!t.isFile())return!1;if(wt)return!0;try{return Ff.accessSync(e,Ff.constants.X_OK),!0}catch{return!1}}s(ox,"isExecutableSync");function bg(e,t={}){let n=tx(e,t);for(let r of rx(e,n))if(ox(r))return r}s(bg,"whichCommandSync");var Ig={"--use-system-ca":"NODE_USE_SYSTEM_CA","--use-env-proxy":"NODE_USE_ENV_PROXY"},vg="--use-env-proxy",ix=new Set(["HTTP_PROXY","HTTPS_PROXY"]),$g="NO_PROXY",sx=["localhost","127.0.0.1","::1","[::1]"];function cx(e){return Object.hasOwn(Ig,e)}s(cx,"isNodeNetworkFlag");function ax(e){if(/[\r\n]/u.test(e))return!1;try{let t=new URL(e);return(t.protocol==="http:"||t.protocol==="https:")&&t.hostname!==""}catch{return!1}}s(ax,"isHttpProxyUrl");function ux(e){return Object.entries(e).filter(t=>ix.has(t[0].toUpperCase())&&t[1]!==void 0&&t[1]!=="")}s(ux,"proxyEntries");function lx(e){let t=e.split(/[\s,]+/u).filter(Boolean);if(t.includes("*"))return e;let n=new Set(t.map(r=>r.toLowerCase()));return[...t,...sx.filter(r=>!n.has(r))].join(",")}s(lx,"appendLoopback");function fx(e){let t={...e},n=Object.keys(t).filter(r=>r.toUpperCase()===$g&&t[r]!==void 0);for(let r of n.length>0?n:[$g])t[r]=lx(t[r]??"");return t}s(fx,"withLoopbackNoProxy");function px(e,t){let n=e.filter(i=>!cx(i)||t[Ig[i]]!=="0");if(!n.includes(vg))return{nodeArgs:n,env:t,rejectedProxyKeys:[]};let r=ux(t),o=r.filter(([,i])=>!ax(i)).map(([i])=>i);return o.length>0?{nodeArgs:n.filter(i=>i!==vg),env:t,rejectedProxyKeys:o}:{nodeArgs:n,env:r.length>0?fx(t):t,rejectedProxyKeys:[]}}s(px,"nodeNetworkLaunch");var xg=new Set;function dx(e,t){let n=px(e,t),r=n.rejectedProxyKeys.filter(o=>!xg.has(o));if(r.length>0){for(let o of r)xg.add(o);process.emitWarning(`bb started a Node process without --use-env-proxy because ${r.join(", ")} is not an http:// or https:// URL. Add the scheme, for example http://proxy.example:3128, so bb uses the proxy.`,{code:"BB_INVALID_PROXY_ENV"})}return{nodeArgs:n.nodeArgs,env:n.env}}s(dx,"prepareNodeNetworkLaunch");function mx(e,t){let n=e.findIndex(i=>i==="--"||!i.startsWith("-")),r=n<0?e.length:n,o=dx(e.slice(0,r),t);return{args:[...o.nodeArgs,...e.slice(r)],env:o.env}}s(mx,"prepareNodeNetworkCommand");var Ag=["HTTP_PROXY","HTTPS_PROXY","NO_PROXY","http_proxy","https_proxy","no_proxy","NODE_EXTRA_CA_CERTS","SSL_CERT_FILE","SSL_CERT_DIR"],Uf="__BB_SHELL_ENV_START__",kg="__BB_SHELL_ENV_END__",Ng=3e3,hx=1024*1024;function dn(e){try{return B$(e,process.platform==="win32"?yg.F_OK:yg.X_OK),X$(e).isFile()}catch{return!1}}s(dn,"executable");function Ce(e,t){return process.platform!=="win32"?e[t]:e[Object.keys(e).find(n=>n.toUpperCase()===t.toUpperCase())??t]}s(Ce,"envValue");function Hf(...e){let t=new Set;return e.flatMap(n=>(n??"").split(Kf)).filter(n=>{if(!n)return!1;let r=process.platform==="win32"?n.replace(/[\\/]+$/u,"").toLowerCase():n;return t.has(r)?!1:(t.add(r),!0)}).join(Kf)}s(Hf,"mergePath");function gx(e){if(process.platform!=="win32")return e;try{let t=ji(e).toLowerCase(),n=W$(Se(e)).find(r=>r.toLowerCase()===t);return n===void 0?e:oe(Se(e),n)}catch{return e}}s(gx,"onDiskName");function Sg(e,t,n){return new Promise(r=>{let o="",i=!1,c,a=s(l=>{i||(i=!0,clearTimeout(c),r({status:l,stdout:o}))},"finish"),u;try{u=K$(e,t,{cwd:Eg(),env:n,stdio:["ignore","pipe","ignore"],windowsHide:!0})}catch{a(null);return}c=setTimeout(()=>{u.kill("SIGKILL"),a(null)},Ng),u.stdout?.setEncoding("utf8"),u.stdout?.on("data",l=>{o.length<hx&&(o+=l)}),u.once("error",()=>a(null)),u.once("close",l=>a(l))})}s(Sg,"runProbe");async function _x(e,t){if(process.platform==="win32"){let i=oe(Ce(e,"SystemRoot")??"C:\\Windows","System32","reg.exe"),c={...e},a=[];for(let l of["HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment","HKCU\\Environment"]){let f=await Sg(i,["query",l],e);if(f.status===0)for(let p of f.stdout.matchAll(/^ {4}(.+?) {4}REG_[A-Z_]+ {4}(.*)$/gmu)){let d=p[1]?.trim();if(!d)continue;let m=(p[2]??"").trim();if(d.toUpperCase()==="PATH")a.push(m);else{let g=Object.keys(c).find(y=>y.toUpperCase()===d.toUpperCase());c[g??d]=m}}}let u=s(l=>{for(let f=0;f<10;f+=1){let p=l.replace(/%([^%;\\/]+)%/gu,(d,m)=>Ce(c,m)??d);if(p===l)break;l=p}return l},"expand");return a.length===0?null:{PATH:Hf(...a.map(u),Ce(e,"PATH"))}}let n=e.SHELL?.trim()||(process.platform==="darwin"?"/bin/zsh":"/bin/sh"),r=`printf '%s\\n' ${Uf}; /usr/bin/env; printf '%s\\n' ${kg}`,o=["sh","dash"].includes(ji(n))?["-lc"]:["-ilc","-lc"];for(let i of o){let c=await Sg(n,[i,r],e);if(c.status!==0){if(t)return null;continue}let a=c.stdout.indexOf(`${Uf}
116
121
  `),u=c.stdout.indexOf(`
117
- ${hg}`,a);if(a<0||u<0){if(t)return null;continue}let l={};for(let f of c.stdout.slice(a+Zf.length+1,u).split(`
118
- `)){let p=f.indexOf("="),d=f.slice(0,p);(d==="PATH"||$g.includes(d))&&(l[d]=f.slice(p+1))}if(l.PATH)return l}return null}s(W$,"readShellEnvironment");var q$=class{static{s(this,"HostToolchain")}constructor(e=process.env,t=process.execPath){this.baseEnv=e,this.runtimePath=t,this.inheritedPath=Ne(e,"PATH"),this.nodePath=t}baseEnv;runtimePath;shellEnv={};inheritedPath;misses=new Set;nodePath;refreshing=null;refreshedAt=0;refresh(){if(this.refreshing!==null)return this.refreshing;this.misses.clear(),this.refreshedAt=Date.now();let e=this.shellEnv.PATH!==void 0;return this.refreshing=W$(this.baseEnv,e).then(t=>{t!==null&&(this.shellEnv=t)}).finally(()=>{this.refreshing=null}),this.refreshing}invalidateFailure(e){let t=typeof e=="object"&&e!==null&&"code"in e?e.code:e;(t==="ENOENT"||t===127)&&this.refresh()}searchPath(e){let t=Ne(e,"PATH"),n=Ne(e,process.platform==="win32"?"USERPROFILE":"HOME")??bg(),r=[re(n,".local","bin"),re(n,".local","share","mise","shims"),re(n,".asdf","shims"),re(n,".asdf","bin"),re(n,".volta","bin")];process.platform==="darwin"&&r.push("/opt/homebrew/bin"),process.platform!=="win32"&&r.push("/usr/local/bin","/usr/bin","/bin");let[o,i]=t===void 0||t===this.inheritedPath?[this.shellEnv.PATH,t]:[t,this.shellEnv.PATH];return Lf(o,i,an(this.nodePath)&&/^node(?:\.exe)?$/iu.test(Ai(this.nodePath))?xe(this.nodePath):void 0,...r)}environment(e=this.baseEnv){let t=this.searchPath(e),n={...e};if(process.platform==="win32")for(let o of Object.keys(n))o!=="PATH"&&o.toUpperCase()==="PATH"&&delete n[o];t!==""&&(n.PATH=t);let r=new Set(Object.keys(e).filter(o=>e[o]!==void 0).map(o=>o.toUpperCase()));for(let o of $g)!r.has(o.toUpperCase())&&this.shellEnv[o]!==void 0&&(n[o]=this.shellEnv[o]);return n}lookup(e,t){let n=this.environment(t.env),r=t.cwd instanceof URL?I$(t.cwd):t.cwd??process.cwd();if(e==="bb"){for(let l of[n.BB_CLI_LAUNCHER,n.BB_CLI,n.BB_CLI_DIR?re(n.BB_CLI_DIR,"bb"):void 0])if(l?.trim()&&Ei(l.trim())&&an(l.trim()))return l.trim()}let o=O$(e),i=Ne(n,"PATHEXT"),c=Ne(n,"PATH")??"",a={cwd:r,path:c,pathExt:o?`${o};${i??".EXE;.COM;.CMD;.BAT"}`:i},u=e==="bb"?c.split(Rf).filter(Ei).map(l=>fg(re(l,e),a)).find(Boolean):fg(e,a);return u?J$(u):null}resolve(e,t={}){let n=this.lookup(e,t);if(n!==null)return n;let r=`${e}\0${String(t.cwd??"")}\0${Ne(t.env??this.baseEnv,"PATH")??""}`,o=Date.now()-this.refreshedAt;return!(this.misses.has(r)&&o<3e4)&&(this.misses.size===0||o>=1e3)&&this.refresh(),this.misses.add(r),null}node(e={}){if(an(this.nodePath))return this.nodePath;let n=[this.runtimePath.replace(/\/Cellar\/([^/]+)\/[^/]+\//u,"/opt/$1/"),process.argv0,this.lookup(process.platform==="win32"?"node.exe":"node",e)];for(let r of n){if(!r||!Ei(r)||!an(r))continue;let o=$$(r,["-p","JSON.stringify({path:process.execPath,abi:process.versions.modules,electron:!!process.versions.electron})"],{env:this.environment(e.env),cwd:e.cwd,encoding:"utf8",timeout:xg,killSignal:"SIGKILL",windowsHide:!0});if(o.status===0)try{let i=JSON.parse(o.stdout.trim());if(typeof i!="object"||i===null||!("path"in i)||typeof i.path!="string"||!("abi"in i)||i.abi!==process.versions.modules||!("electron"in i)||i.electron!==!!process.versions.electron)continue;if(Ei(i.path)&&an(i.path))return this.nodePath=i.path,i.path}catch{}}throw Object.assign(new Error("The Node runtime was removed and no replacement was found. Reinstall Node or restart bb with an available runtime."),{code:"ENOENT"})}bundledNpmCli(e="npm"){let t=z$(import.meta.url);return re(xe(t.resolve("npm/package.json")),"bin",`${e}-cli.js`)}npmCli(e="npm",t={}){let n=`${e}-cli.js`,r=process.versions.electron?null:this.node(t),o=[];if(r!==null)for(let c of[re(xe(r),"..","lib","node_modules","npm","bin",n),re(xe(r),"node_modules","npm","bin",n)])o.push({node:r,cli:c});let i=this.resolve(e,t);if(i)try{let c=lg(i),a=xe(xe(c)),u=[re(a,"..","..","..","bin","node"),re(a,"..","..","node.exe"),re(xe(i),"node")].find(an);Ai(c)===n&&u!==void 0&&o.push({node:lg(u),cli:c})}catch{}if(r!==null)try{o.push({node:r,cli:this.bundledNpmCli(e)})}catch{}return o.find(c=>k$(c.cli))??null}command(e,t=[],n={}){let r=e===this.runtimePath?this.node(n):this.resolve(e,n)??e,o=this.environment(n.env);/(?:^|[\\/])(?:npm|npx)-cli\.js$/u.test(t[0]??"")&&(o.PATH=Lf(xe(r),o.PATH));let i=H$(t,o);return{command:r,args:i.args,env:i.env}}},G$=Symbol.for("@bb/process-utils/host-toolchain"),X$=globalThis,kg=X$[G$]??=new q$;var yg={interactive:0,status:1,background:2};function Q$(e){let t=Math.min(6,Math.max(4,e-2));return[t,t-1,t-2]}s(Q$,"localProcessCapacities");var wg={local:Q$(Y$()),network:[4,3,2]},ex=2,Df=15e3,tx=new Set(["fetch","pull","push","clone","ls-remote"]),nx=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--config-env"]);function rx(e){let t=0;for(;t<e.length&&e[t].startsWith("-");)t+=nx.has(e[t])?2:1;let n=e[t];if(n===void 0)return!1;if(tx.has(n))return!0;let r=e.slice(t+1).find(o=>!o.startsWith("-"));return(n==="submodule"||n==="remote")&&r==="update"}s(rx,"isNetworkGitCommand");var ox=class{static{s(this,"VcsProcessScheduler")}priority=new _g;admitted=new _g;active={local:0,network:0};githubActive=0;queue=[];timer;acquire(e,t,n){let r=e==="gh"||rx(t)?"network":"local",o=n.slots??1;return!Number.isInteger(o)||o<1||o>wg[r][yg.background]?Promise.reject(new Error("Invalid VCS process slot count")):n.signal?.aborted?Promise.reject(this.abortError(n.signal)):new Promise((i,c)=>{let a={command:e,pool:r,priority:n.priority??this.priority.getStore()??"status",slots:o,queuedAt:performance.now(),signal:n.signal,grant:i,onAbort:s(()=>{let u=this.queue.indexOf(a);u!==-1&&(this.queue.splice(u,1),c(this.abortError(n.signal)),this.drain())},"onAbort")};this.queue.push(a),n.signal?.addEventListener("abort",a.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,yg[e.priority]-Math.floor((performance.now()-e.queuedAt)/Df))}drain(){clearTimeout(this.timer),this.queue.sort((t,n)=>this.rank(t)-this.rank(n)||t.queuedAt-n.queuedAt);let e=new Set;for(let t=0;t<this.queue.length;){let n=this.queue[t];if(e.has(n.pool)||n.command==="gh"&&this.githubActive+n.slots>ex){t+=1;continue}if(this.active[n.pool]+n.slots>wg[n.pool][this.rank(n)]){e.add(n.pool),t+=1;continue}this.queue.splice(t,1),n.signal?.removeEventListener("abort",n.onAbort),this.active[n.pool]+=n.slots,n.command==="gh"&&(this.githubActive+=n.slots);let r=!1;n.grant(()=>{r||(r=!0,this.active[n.pool]-=n.slots,n.command==="gh"&&(this.githubActive-=n.slots),this.drain())})}if(this.queue.length>0){let t=Math.min(...this.queue.map(n=>Df-(performance.now()-n.queuedAt)%Df));this.timer=setTimeout(()=>this.drain(),t)}}},ix=globalThis,gz=ix.__bbVcsProcessScheduler??=new ox;var Ni="22.23.4",Mf=new Map;async function Vf(e,t){return new Promise(n=>{let r=zg(e,["-p","JSON.stringify({version:process.versions.node,electron:!!process.versions.electron})"],{signal:t,shell:!1,windowsHide:!0,stdio:["ignore","pipe","ignore"]}),o="",i=setTimeout(()=>{r.kill(),n(null)},5e3);r.stdout.on("data",c=>{o+=String(c),o.length>4096&&r.kill()}),r.once("error",()=>{clearTimeout(i),n(null)}),r.once("close",c=>{clearTimeout(i);try{let a=JSON.parse(o);n(c===0&&!a.electron&&Number(a.version?.split(".")[0])>=22?a.version:null)}catch{n(null)}})})}s(Vf,"probe");async function Uf(e){try{let t=kg.npmCli();if(t){let n=await Vf(t.node,e);if(n)return{executable:t.node,npmCli:t.cli,version:n}}}catch{}return null}s(Uf,"existingKimiRuntime");function mx(e,t){let n=e==="win32"?"win":e;if(!["win","darwin","linux"].includes(n)||!["x64","arm64"].includes(t))throw new Error("\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 Node.js \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0434\u043B\u044F \u044D\u0442\u043E\u0439 \u0441\u0438\u0441\u0442\u0435\u043C\u044B. \u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438 Node.js 22+ \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438.");let r=`node-v${Ni}-${n}-${t}`;return{directory:r,file:r+(n==="win"?".zip":".tar.gz"),executable:n==="win"?"node.exe":"bin/node",npm:n==="win"?"node_modules/npm/bin/npm-cli.js":"lib/node_modules/npm/bin/npm-cli.js"}}s(mx,"nodeArchive");function hx(e,t,n,r=process.env){if(e==="win32"){let o=Object.entries(r).find(([i])=>i.toLowerCase()==="systemroot")?.[1]??"C:\\Windows";return{executable:dx.join(o,"System32","WindowsPowerShell","v1.0","powershell.exe"),args:["-NoProfile","-NonInteractive","-Command",'$ErrorActionPreference = "Stop"; Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory($env:SVAIB_NODE_ARCHIVE, $env:SVAIB_NODE_DESTINATION)'],env:{...r,SVAIB_NODE_ARCHIVE:t,SVAIB_NODE_DESTINATION:n}}}return{executable:"tar",args:["-xf",t,"-C",n],env:r}}s(hx,"nodeExtractCommand");function gx(e,t,n){let o=t.split(/\r?\n/).find(i=>i.trim().split(/\s+/)[1]===n)?.trim().split(/\s+/)[0];if(!o||!/^[a-f0-9]{64}$/.test(o)||Ff("sha256").update(e).digest("hex")!==o)throw new Error("\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 Node.js \u043F\u043E\u0432\u0440\u0435\u0436\u0434\u0435\u043D\u0430. \u041F\u043E\u0432\u0442\u043E\u0440\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443.")}s(gx,"checkedNodeArchive");async function We(e,t=!1){let n=await cx(e);if(n.isSymbolicLink()||(t?!n.isDirectory():!n.isFile()))throw new Error("\u041F\u0430\u043F\u043A\u0430 runtime \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0430. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B.")}s(We,"regular");async function Pg(e,t,n){let r=await fetch(e,{signal:AbortSignal.any([t,AbortSignal.timeout(9e4)]),redirect:"error"});if(!r.ok||!r.body)throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043A\u0430\u0447\u0430\u0442\u044C \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u044B Node.js. \u041F\u0440\u043E\u0432\u0435\u0440\u044C \u0438\u043D\u0442\u0435\u0440\u043D\u0435\u0442 \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438.");let o=r.body.getReader(),i=[],c=0;try{for(;;){let{value:a,done:u}=await o.read();if(u)break;if(c+=a.byteLength,c>n)throw new Error("\u0420\u0430\u0437\u043C\u0435\u0440 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 Node.js \u043F\u0440\u0435\u0432\u044B\u0448\u0430\u0435\u0442 \u043E\u0436\u0438\u0434\u0430\u0435\u043C\u044B\u0439.");i.push(a)}return Buffer.concat(i)}finally{await o.cancel().catch(()=>{})}}s(Pg,"download");async function _x(e,t){let n=mx(process.platform,process.arch),r=H(e,"node-runtime");await ax(r,{recursive:!0,mode:448}),await We(r,!0);let o=H(r,n.directory);async function i(){try{await We(o,!0)}catch(f){if(f.code==="ENOENT")return null;throw f}await We(H(o,"runtime-owner.json")),await We(H(o,n.executable)),await We(H(o,n.npm));let u=JSON.parse(await jf(H(o,"runtime-owner.json"),"utf8"));if(u.version!==Ni||u.archive!==n.file||u.nodeSha256!==Ff("sha256").update(await jf(H(o,n.executable))).digest("hex"))throw new Error("\u0421\u043E\u0431\u0441\u0442\u0432\u0435\u043D\u043D\u044B\u0439 runtime Node.js \u0438\u0437\u043C\u0435\u043D\u0451\u043D. \u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0438\u0441\u0430\u043D\u043E.");let l=await Vf(H(o,n.executable),t);if(!l)throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u043F\u043E\u0434\u0433\u043E\u0442\u043E\u0432\u043B\u0435\u043D\u043D\u044B\u0439 Node.js. \u041F\u043E\u0432\u0442\u043E\u0440\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443.");return{executable:H(o,n.executable),npmCli:H(o,n.npm),version:l}}s(i,"saved");let c=await i();if(c)return c;let a=await ux(H(r,".prepare-"));try{let u=`https://nodejs.org/dist/v${Ni}/`,l=await Pg(u+"SHASUMS256.txt",t,128e3),f=await Pg(u+n.file,t,150*1024*1024);gx(f,l.toString("utf8"),n.file);let p=H(a,n.file);await Sg(p,f);let d=hx(process.platform,p,a);await new Promise((g,y)=>{let b=zg(d.executable,d.args,{env:d.env,signal:t,shell:!1,windowsHide:!0,stdio:"ignore"}),k=setTimeout(()=>{b.kill(),y(new Error("\u0420\u0430\u0441\u043F\u0430\u043A\u043E\u0432\u043A\u0430 Node.js \u043D\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0430\u0441\u044C. \u041F\u043E\u0432\u0442\u043E\u0440\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443."))},18e4);b.once("error",()=>{clearTimeout(k),y(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0441\u043F\u0430\u043A\u043E\u0432\u0430\u0442\u044C Node.js. \u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438 Node.js 22+ \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438."))}),b.once("close",$=>{clearTimeout(k),$===0?g():y(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0441\u043F\u0430\u043A\u043E\u0432\u0430\u0442\u044C Node.js. \u041F\u043E\u0432\u0442\u043E\u0440\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443."))})});let m=H(a,n.directory);if(await We(m,!0),await We(H(m,n.executable)),await We(H(m,n.npm)),process.platform!=="win32"&&await sx(H(m,n.executable),448),!await Vf(H(m,n.executable),t))throw new Error("\u0421\u043A\u0430\u0447\u0430\u043D\u043D\u044B\u0439 Node.js \u043D\u0435 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442\u0441\u044F \u043D\u0430 \u044D\u0442\u043E\u043C \u043A\u043E\u043C\u043F\u044C\u044E\u0442\u0435\u0440\u0435.");return await Sg(H(m,"runtime-owner.json"),JSON.stringify({version:Ni,archive:n.file,nodeSha256:Ff("sha256").update(await jf(H(m,n.executable))).digest("hex")}),{flag:"wx",mode:384}),await lx(m,o),await i()}finally{await fx(a,{recursive:!0,force:!0})}}s(_x,"managedRuntime");async function Og(e,t,n={}){if(!n.forceManaged){let c=await Uf(t);if(c)return c}let r=px(e),o=Mf.get(r);if(o)return o;let i=_x(r,t).finally(()=>Mf.delete(r));return Mf.set(r,i),i}s(Og,"ensureKimiRuntime");function Px(e,t=process.env,n=process.platform){let r={...t},o=n==="win32"?Sx:kx,i=Object.keys(r).filter(a=>n==="win32"?a.toLowerCase()==="path":a==="PATH"),c=i.map(a=>r[a]).filter(Boolean).join(o.delimiter);for(let a of i)delete r[a];return r[n==="win32"?"Path":"PATH"]=o.dirname(e)+o.delimiter+c,r}s(Px,"kimiCommandEnvironment");function zx(e,t,n,r=!1){return new Promise((o,i)=>{let c=yx(e,t,{signal:n,shell:!1,windowsHide:!0,env:Px(e),stdio:["ignore",r?"pipe":"ignore","ignore"]}),a="",u=setTimeout(()=>{c.kill(),i(new Error("\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 \u043D\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0430\u0441\u044C. \u041F\u0440\u043E\u0432\u0435\u0440\u044C \u0438\u043D\u0442\u0435\u0440\u043D\u0435\u0442 \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438 \u044D\u0442\u043E\u0442 \u0448\u0430\u0433."))},r?5e3:18e4);c.stdout?.on("data",l=>{a+=String(l),a.length>4096&&(c.kill(),i(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C Node.js.")))}),c.once("error",()=>{clearTimeout(u),i(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C Node.js \u0438\u043B\u0438 npm."))}),c.once("close",l=>{clearTimeout(u),l===0?o(a):i(new Error("\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 \u043D\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0430\u0441\u044C. \u041F\u0440\u043E\u0432\u0435\u0440\u044C \u0438\u043D\u0442\u0435\u0440\u043D\u0435\u0442 \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438 \u044D\u0442\u043E\u0442 \u0448\u0430\u0433."))})})}s(zx,"kimiCommand");async function Ox(e){return Uf(e)}s(Ox,"node");async function Ci(e,t=!1){let n=await wx(e);if(n.isSymbolicLink()||(t?!n.isDirectory():!n.isFile()||n.size>32768))throw new Error("\u041F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0451\u043D. \u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0438\u0441\u0430\u043D\u043E.")}s(Ci,"regular");async function Ti(e,t){let n=await Ox(t),r={nodeReady:!!n,nodeVersion:n?.version??null};try{await Ci(e,!0)}catch(o){return{...r,profile:o.code==="ENOENT"?"absent":"blocked",agent:null}}try{await Ci(_t(e,"setup-owner.json"));let o=JSON.parse(await Ig(_t(e,"setup-owner.json"),"utf8"));if(o.schema!==1||o.adapter!==cn||typeof o.nodeExecutable!="string")throw new Error;try{await Ci(_t(e,"bb-agent.json"))}catch(c){if(c.code==="ENOENT")return{...r,profile:"partial",agent:null};throw c}let i=Pi.parse(JSON.parse(await Ig(_t(e,"bb-agent.json"),"utf8")));if(![!1,!0,"catalog"].some(c=>JSON.stringify(i)===JSON.stringify(ht(e,o.nodeExecutable,c))))throw new Error;return{...r,profile:"ready",agent:i}}catch{return{...r,profile:"blocked",agent:null}}}s(Ti,"inspectKimi");async function Eg(e,t,n){n.throwIfAborted();let r=await Ti(e,n);if(r.profile==="ready")return Cf(e);if(r.profile==="blocked")throw new Error("\u041F\u0430\u043F\u043A\u0430 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0430. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B; \u043D\u0443\u0436\u043D\u0430 \u043F\u043E\u043C\u043E\u0449\u044C \u043F\u0430\u0440\u0442\u043D\u0451\u0440\u0430.");let o=s(async(c,a)=>{await zx(c,a,n)},"install"),i=await Og(e,n);if(r.profile==="partial")return cg({root:e,install:o,npmCli:i.npmCli,nodeExecutable:i.executable});if(!t)throw new Error("\u0412\u0432\u0435\u0434\u0438 \u043A\u043B\u044E\u0447 \u0438\u0437 \u043A\u043E\u043D\u0441\u043E\u043B\u0438 Kimi Code.");return sg({root:e,apiKey:t,install:o,nodeExecutable:i.executable,npmCli:i.npmCli})}s(Eg,"prepareKimi");async function Ag(e,t,n){if(n.throwIfAborted(),!/^sk-kimi-[A-Za-z0-9_-]+$/.test(t))throw new Error("\u041D\u0443\u0436\u0435\u043D \u043A\u043B\u044E\u0447 \u0438\u0437 \u043A\u043E\u043D\u0441\u043E\u043B\u0438 Kimi Code.");if((await Ti(e,n)).profile!=="ready")throw new Error("\u0421\u043E\u0431\u0441\u0442\u0432\u0435\u043D\u043D\u044B\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u0449\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D.");await Ci(_t(e,"credentials.json")),n.throwIfAborted();let o=_t(e,".key-"+xx());try{await bx(o,JSON.stringify({apiKey:t}),{mode:384,flag:"wx"}),n.throwIfAborted(),await vx(o,_t(e,"credentials.json"))}finally{await $x(o,{force:!0})}}s(Ag,"replaceKimiKey");var Ex=jh({contract:Wh,handlers:{async kimiInspect(e,t){return Ti(Kf(t.experimental_paths.dataDir,"kimi-cc"),t.signal)},async kimiPrepare({apiKey:e},t){return Eg(Kf(t.experimental_paths.dataDir,"kimi-cc"),e,t.signal)},async kimiReplaceKey({apiKey:e},t){return await Ag(Kf(t.experimental_paths.dataDir,"kimi-cc"),e,t.signal),null},async automaticHooks(e,t){return eg(e,t.signal)},async openLogin({url:e}){let t=process.env.BROWSER,n=t&&!/\s/.test(t)?t:process.platform==="darwin"?"/usr/bin/open":process.platform==="win32"?"rundll32.exe":"xdg-open",r=process.platform==="win32"&&n==="rundll32.exe"?["url.dll,FileProtocolHandler",e]:[e];return await new Promise((o,i)=>{let c=Ix(n,r,{detached:!0,stdio:"ignore",shell:!1});c.once("error",()=>i(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0434\u043B\u044F \u0432\u0445\u043E\u0434\u0430."))),c.once("spawn",()=>{c.unref(),o()})}),null}}});export{Ex as default};
122
+ ${kg}`,a);if(a<0||u<0){if(t)return null;continue}let l={};for(let f of c.stdout.slice(a+Uf.length+1,u).split(`
123
+ `)){let p=f.indexOf("="),d=f.slice(0,p);(d==="PATH"||Ag.includes(d))&&(l[d]=f.slice(p+1))}if(l.PATH)return l}return null}s(_x,"readShellEnvironment");var yx=class{static{s(this,"HostToolchain")}constructor(e=process.env,t=process.execPath){this.baseEnv=e,this.runtimePath=t,this.inheritedPath=Ce(e,"PATH"),this.nodePath=t}baseEnv;runtimePath;shellEnv={};inheritedPath;misses=new Set;nodePath;refreshing=null;refreshedAt=0;refresh(){if(this.refreshing!==null)return this.refreshing;this.misses.clear(),this.refreshedAt=Date.now();let e=this.shellEnv.PATH!==void 0;return this.refreshing=_x(this.baseEnv,e).then(t=>{t!==null&&(this.shellEnv=t)}).finally(()=>{this.refreshing=null}),this.refreshing}invalidateFailure(e){let t=typeof e=="object"&&e!==null&&"code"in e?e.code:e;(t==="ENOENT"||t===127)&&this.refresh()}searchPath(e){let t=Ce(e,"PATH"),n=Ce(e,process.platform==="win32"?"USERPROFILE":"HOME")??Eg(),r=[oe(n,".local","bin"),oe(n,".local","share","mise","shims"),oe(n,".asdf","shims"),oe(n,".asdf","bin"),oe(n,".volta","bin")];process.platform==="darwin"&&r.push("/opt/homebrew/bin"),process.platform!=="win32"&&r.push("/usr/local/bin","/usr/bin","/bin");let[o,i]=t===void 0||t===this.inheritedPath?[this.shellEnv.PATH,t]:[t,this.shellEnv.PATH];return Hf(o,i,dn(this.nodePath)&&/^node(?:\.exe)?$/iu.test(ji(this.nodePath))?Se(this.nodePath):void 0,...r)}environment(e=this.baseEnv){let t=this.searchPath(e),n={...e};if(process.platform==="win32")for(let o of Object.keys(n))o!=="PATH"&&o.toUpperCase()==="PATH"&&delete n[o];t!==""&&(n.PATH=t);let r=new Set(Object.keys(e).filter(o=>e[o]!==void 0).map(o=>o.toUpperCase()));for(let o of Ag)!r.has(o.toUpperCase())&&this.shellEnv[o]!==void 0&&(n[o]=this.shellEnv[o]);return n}lookup(e,t){let n=this.environment(t.env),r=t.cwd instanceof URL?Y$(t.cwd):t.cwd??process.cwd();if(e==="bb"){for(let l of[n.BB_CLI_LAUNCHER,n.BB_CLI,n.BB_CLI_DIR?oe(n.BB_CLI_DIR,"bb"):void 0])if(l?.trim()&&Ri(l.trim())&&dn(l.trim()))return l.trim()}let o=G$(e),i=Ce(n,"PATHEXT"),c=Ce(n,"PATH")??"",a={cwd:r,path:c,pathExt:o?`${o};${i??".EXE;.COM;.CMD;.BAT"}`:i},u=e==="bb"?c.split(Kf).filter(Ri).map(l=>bg(oe(l,e),a)).find(Boolean):bg(e,a);return u?gx(u):null}resolve(e,t={}){let n=this.lookup(e,t);if(n!==null)return n;let r=`${e}\0${String(t.cwd??"")}\0${Ce(t.env??this.baseEnv,"PATH")??""}`,o=Date.now()-this.refreshedAt;return!(this.misses.has(r)&&o<3e4)&&(this.misses.size===0||o>=1e3)&&this.refresh(),this.misses.add(r),null}node(e={}){if(dn(this.nodePath))return this.nodePath;let n=[this.runtimePath.replace(/\/Cellar\/([^/]+)\/[^/]+\//u,"/opt/$1/"),process.argv0,this.lookup(process.platform==="win32"?"node.exe":"node",e)];for(let r of n){if(!r||!Ri(r)||!dn(r))continue;let o=H$(r,["-p","JSON.stringify({path:process.execPath,abi:process.versions.modules,electron:!!process.versions.electron})"],{env:this.environment(e.env),cwd:e.cwd,encoding:"utf8",timeout:Ng,killSignal:"SIGKILL",windowsHide:!0});if(o.status===0)try{let i=JSON.parse(o.stdout.trim());if(typeof i!="object"||i===null||!("path"in i)||typeof i.path!="string"||!("abi"in i)||i.abi!==process.versions.modules||!("electron"in i)||i.electron!==!!process.versions.electron)continue;if(Ri(i.path)&&dn(i.path))return this.nodePath=i.path,i.path}catch{}}throw Object.assign(new Error("The Node runtime was removed and no replacement was found. Reinstall Node or restart bb with an available runtime."),{code:"ENOENT"})}bundledNpmCli(e="npm"){let t=q$(import.meta.url);return oe(Se(t.resolve("npm/package.json")),"bin",`${e}-cli.js`)}npmCli(e="npm",t={}){let n=`${e}-cli.js`,r=process.versions.electron?null:this.node(t),o=[];if(r!==null)for(let c of[oe(Se(r),"..","lib","node_modules","npm","bin",n),oe(Se(r),"node_modules","npm","bin",n)])o.push({node:r,cli:c});let i=this.resolve(e,t);if(i)try{let c=wg(i),a=Se(Se(c)),u=[oe(a,"..","..","..","bin","node"),oe(a,"..","..","node.exe"),oe(Se(i),"node")].find(dn);ji(c)===n&&u!==void 0&&o.push({node:wg(u),cli:c})}catch{}if(r!==null)try{o.push({node:r,cli:this.bundledNpmCli(e)})}catch{}return o.find(c=>J$(c.cli))??null}command(e,t=[],n={}){let r=e===this.runtimePath?this.node(n):this.resolve(e,n)??e,o=this.environment(n.env);/(?:^|[\\/])(?:npm|npx)-cli\.js$/u.test(t[0]??"")&&(o.PATH=Hf(Se(r),o.PATH));let i=mx(t,o);return{command:r,args:i.args,env:i.env}}},wx=Symbol.for("@bb/process-utils/host-toolchain"),bx=globalThis,Cg=bx[wx]??=new yx;var zg={interactive:0,status:1,background:2};function $x(e){let t=Math.min(6,Math.max(4,e-2));return[t,t-1,t-2]}s($x,"localProcessCapacities");var Og={local:$x(vx()),network:[4,3,2]},xx=2,Vf=15e3,kx=new Set(["fetch","pull","push","clone","ls-remote"]),Sx=new Set(["-C","-c","--git-dir","--work-tree","--namespace","--config-env"]);function Px(e){let t=0;for(;t<e.length&&e[t].startsWith("-");)t+=Sx.has(e[t])?2:1;let n=e[t];if(n===void 0)return!1;if(kx.has(n))return!0;let r=e.slice(t+1).find(o=>!o.startsWith("-"));return(n==="submodule"||n==="remote")&&r==="update"}s(Px,"isNetworkGitCommand");var zx=class{static{s(this,"VcsProcessScheduler")}priority=new Pg;admitted=new Pg;active={local:0,network:0};githubActive=0;queue=[];timer;acquire(e,t,n){let r=e==="gh"||Px(t)?"network":"local",o=n.slots??1;return!Number.isInteger(o)||o<1||o>Og[r][zg.background]?Promise.reject(new Error("Invalid VCS process slot count")):n.signal?.aborted?Promise.reject(this.abortError(n.signal)):new Promise((i,c)=>{let a={command:e,pool:r,priority:n.priority??this.priority.getStore()??"status",slots:o,queuedAt:performance.now(),signal:n.signal,grant:i,onAbort:s(()=>{let u=this.queue.indexOf(a);u!==-1&&(this.queue.splice(u,1),c(this.abortError(n.signal)),this.drain())},"onAbort")};this.queue.push(a),n.signal?.addEventListener("abort",a.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,zg[e.priority]-Math.floor((performance.now()-e.queuedAt)/Vf))}drain(){clearTimeout(this.timer),this.queue.sort((t,n)=>this.rank(t)-this.rank(n)||t.queuedAt-n.queuedAt);let e=new Set;for(let t=0;t<this.queue.length;){let n=this.queue[t];if(e.has(n.pool)||n.command==="gh"&&this.githubActive+n.slots>xx){t+=1;continue}if(this.active[n.pool]+n.slots>Og[n.pool][this.rank(n)]){e.add(n.pool),t+=1;continue}this.queue.splice(t,1),n.signal?.removeEventListener("abort",n.onAbort),this.active[n.pool]+=n.slots,n.command==="gh"&&(this.githubActive+=n.slots);let r=!1;n.grant(()=>{r||(r=!0,this.active[n.pool]-=n.slots,n.command==="gh"&&(this.githubActive-=n.slots),this.drain())})}if(this.queue.length>0){let t=Math.min(...this.queue.map(n=>Vf-(performance.now()-n.queuedAt)%Vf));this.timer=setTimeout(()=>this.drain(),t)}}},Ox=globalThis,Mz=Ox.__bbVcsProcessScheduler??=new zx;var Mi="22.23.4",Jf=new Map;async function Xf(e,t){return new Promise(n=>{let r=Zg(e,["-p","JSON.stringify({version:process.versions.node,electron:!!process.versions.electron})"],{signal:t,shell:!1,windowsHide:!0,stdio:["ignore","pipe","ignore"]}),o="",i=setTimeout(()=>{r.kill(),n(null)},5e3);r.stdout.on("data",c=>{o+=String(c),o.length>4096&&r.kill()}),r.once("error",()=>{clearTimeout(i),n(null)}),r.once("close",c=>{clearTimeout(i);try{let a=JSON.parse(o);n(c===0&&!a.electron&&Number(a.version?.split(".")[0])>=22?a.version:null)}catch{n(null)}})})}s(Xf,"probe");async function qf(e){try{let t=Cg.npmCli();if(t){let n=await Xf(t.node,e);if(n)return{executable:t.node,npmCli:t.cli,version:n}}}catch{}return null}s(qf,"existingKimiRuntime");function Lx(e,t){let n=e==="win32"?"win":e;if(!["win","darwin","linux"].includes(n)||!["x64","arm64"].includes(t))throw new Error("\u0410\u0432\u0442\u043E\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 Node.js \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0434\u043B\u044F \u044D\u0442\u043E\u0439 \u0441\u0438\u0441\u0442\u0435\u043C\u044B. \u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438 Node.js 22+ \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438.");let r=`node-v${Mi}-${n}-${t}`;return{directory:r,file:r+(n==="win"?".zip":".tar.gz"),executable:n==="win"?"node.exe":"bin/node",npm:n==="win"?"node_modules/npm/bin/npm-cli.js":"lib/node_modules/npm/bin/npm-cli.js"}}s(Lx,"nodeArchive");function Rx(e,t,n,r=process.env){if(e==="win32"){let o=Object.entries(r).find(([i])=>i.toLowerCase()==="systemroot")?.[1]??"C:\\Windows";return{executable:Zx.join(o,"System32","WindowsPowerShell","v1.0","powershell.exe"),args:["-NoProfile","-NonInteractive","-Command",'$ErrorActionPreference = "Stop"; Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory($env:SVAIB_NODE_ARCHIVE, $env:SVAIB_NODE_DESTINATION)'],env:{...r,SVAIB_NODE_ARCHIVE:t,SVAIB_NODE_DESTINATION:n}}}return{executable:"tar",args:["-xf",t,"-C",n],env:r}}s(Rx,"nodeExtractCommand");function jx(e,t,n){let o=t.split(/\r?\n/).find(i=>i.trim().split(/\s+/)[1]===n)?.trim().split(/\s+/)[0];if(!o||!/^[a-f0-9]{64}$/.test(o)||Wf("sha256").update(e).digest("hex")!==o)throw new Error("\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 Node.js \u043F\u043E\u0432\u0440\u0435\u0436\u0434\u0435\u043D\u0430. \u041F\u043E\u0432\u0442\u043E\u0440\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443.")}s(jx,"checkedNodeArchive");async function Ge(e,t=!1){let n=await Ix(e);if(n.isSymbolicLink()||(t?!n.isDirectory():!n.isFile()))throw new Error("\u041F\u0430\u043F\u043A\u0430 runtime \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0430. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B.")}s(Ge,"regular");async function Dg(e,t,n){let r=await fetch(e,{signal:AbortSignal.any([t,AbortSignal.timeout(9e4)]),redirect:"error"});if(!r.ok||!r.body)throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043A\u0430\u0447\u0430\u0442\u044C \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u044B Node.js. \u041F\u0440\u043E\u0432\u0435\u0440\u044C \u0438\u043D\u0442\u0435\u0440\u043D\u0435\u0442 \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438.");let o=r.body.getReader(),i=[],c=0;try{for(;;){let{value:a,done:u}=await o.read();if(u)break;if(c+=a.byteLength,c>n)throw new Error("\u0420\u0430\u0437\u043C\u0435\u0440 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 Node.js \u043F\u0440\u0435\u0432\u044B\u0448\u0430\u0435\u0442 \u043E\u0436\u0438\u0434\u0430\u0435\u043C\u044B\u0439.");i.push(a)}return Buffer.concat(i)}finally{await o.cancel().catch(()=>{})}}s(Dg,"download");async function Mx(e,t){let n=Lx(process.platform,process.arch),r=H(e,"node-runtime");await Ax(r,{recursive:!0,mode:448}),await Ge(r,!0);let o=H(r,n.directory);async function i(){try{await Ge(o,!0)}catch(f){if(f.code==="ENOENT")return null;throw f}await Ge(H(o,"runtime-owner.json")),await Ge(H(o,n.executable)),await Ge(H(o,n.npm));let u=JSON.parse(await Bf(H(o,"runtime-owner.json"),"utf8"));if(u.version!==Mi||u.archive!==n.file||u.nodeSha256!==Wf("sha256").update(await Bf(H(o,n.executable))).digest("hex"))throw new Error("\u0421\u043E\u0431\u0441\u0442\u0432\u0435\u043D\u043D\u044B\u0439 runtime Node.js \u0438\u0437\u043C\u0435\u043D\u0451\u043D. \u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0438\u0441\u0430\u043D\u043E.");let l=await Xf(H(o,n.executable),t);if(!l)throw new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u043F\u043E\u0434\u0433\u043E\u0442\u043E\u0432\u043B\u0435\u043D\u043D\u044B\u0439 Node.js. \u041F\u043E\u0432\u0442\u043E\u0440\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443.");return{executable:H(o,n.executable),npmCli:H(o,n.npm),version:l}}s(i,"saved");let c=await i();if(c)return c;let a=await Nx(H(r,".prepare-"));try{let u=`https://nodejs.org/dist/v${Mi}/`,l=await Dg(u+"SHASUMS256.txt",t,128e3),f=await Dg(u+n.file,t,150*1024*1024);jx(f,l.toString("utf8"),n.file);let p=H(a,n.file);await Tg(p,f);let d=Rx(process.platform,p,a);await new Promise((g,y)=>{let b=Zg(d.executable,d.args,{env:d.env,signal:t,shell:!1,windowsHide:!0,stdio:"ignore"}),k=setTimeout(()=>{b.kill(),y(new Error("\u0420\u0430\u0441\u043F\u0430\u043A\u043E\u0432\u043A\u0430 Node.js \u043D\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0430\u0441\u044C. \u041F\u043E\u0432\u0442\u043E\u0440\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443."))},18e4);b.once("error",()=>{clearTimeout(k),y(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0441\u043F\u0430\u043A\u043E\u0432\u0430\u0442\u044C Node.js. \u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438 Node.js 22+ \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438."))}),b.once("close",$=>{clearTimeout(k),$===0?g():y(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0440\u0430\u0441\u043F\u0430\u043A\u043E\u0432\u0430\u0442\u044C Node.js. \u041F\u043E\u0432\u0442\u043E\u0440\u0438 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443."))})});let m=H(a,n.directory);if(await Ge(m,!0),await Ge(H(m,n.executable)),await Ge(H(m,n.npm)),process.platform!=="win32"&&await Ex(H(m,n.executable),448),!await Xf(H(m,n.executable),t))throw new Error("\u0421\u043A\u0430\u0447\u0430\u043D\u043D\u044B\u0439 Node.js \u043D\u0435 \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442\u0441\u044F \u043D\u0430 \u044D\u0442\u043E\u043C \u043A\u043E\u043C\u043F\u044C\u044E\u0442\u0435\u0440\u0435.");return await Tg(H(m,"runtime-owner.json"),JSON.stringify({version:Mi,archive:n.file,nodeSha256:Wf("sha256").update(await Bf(H(m,n.executable))).digest("hex")}),{flag:"wx",mode:384}),await Cx(m,o),await i()}finally{await Tx(a,{recursive:!0,force:!0})}}s(Mx,"managedRuntime");async function Lg(e,t,n={}){if(!n.forceManaged){let c=await qf(t);if(c)return c}let r=Dx(e),o=Jf.get(r);if(o)return o;let i=Mx(r,t).finally(()=>Jf.delete(r));return Jf.set(r,i),i}s(Lg,"ensureKimiRuntime");var Rg=_.object({diagnosticId:_.uuid(),source:_.enum(["backend","host"]),step:_.enum(["prepare","key-replace","key-commit","runtime","adapter-install","profile-inspect","profile-validate","profile-write","catalog-fetch","catalog-normalize","bb-discovery","registration","verification","refresh","migration","state","cleanup"]),outcome:_.enum(["start","success","failure","fallback","skipped"]),reason:_.enum(["setup","recheck","key-change","scheduled","startup","migration","cancelled","timeout","failed","http-error","network-error","invalid-json","oversized","invalid-catalog","cached","conservative","unavailable","foreign-profile","wrong-response"]).optional(),elapsedMs:_.number().int().nonnegative().optional(),httpStatus:_.number().int().min(100).max(599).optional(),byteCount:_.number().int().nonnegative().max(262144).optional(),modelCount:_.number().int().nonnegative().max(129).optional(),longModelCount:_.number().int().nonnegative().max(129).optional(),profile:_.enum(["absent","partial","ready","blocked"]).optional(),stage:_.enum(["intro","node","key","installing","registration","verify","complete","blocked"]).optional(),phase:_.enum(["components","access","check"]).nullable().optional()}).strict(),jg={kimiDiagnostic:{payload:Rg}};function Gf(e,t,n){return(r,o,i={})=>{let c=Rg.safeParse({diagnosticId:e,source:t,step:r,outcome:o,...i});if(c.success)try{Promise.resolve(n(c.data)).catch(()=>{})}catch{}}}s(Gf,"kimiDiagnostics");async function wr(e,t,n){let r=Date.now();e(t,"start");try{let o=await n();return e(t,"success",{elapsedMs:Date.now()-r}),o}catch(o){throw e(t,"failure",{elapsedMs:Date.now()-r,reason:o instanceof Error&&o.name==="AbortError"?"cancelled":"failed"}),o}}s(wr,"kimiStep");function Xx(e,t=process.env,n=process.platform){let r={...t},o=n==="win32"?Wx:Jx,i=Object.keys(r).filter(a=>n==="win32"?a.toLowerCase()==="path":a==="PATH"),c=i.map(a=>r[a]).filter(Boolean).join(o.delimiter);for(let a of i)delete r[a];return r[n==="win32"?"Path":"PATH"]=o.dirname(e)+o.delimiter+c,r}s(Xx,"kimiCommandEnvironment");function qx(e,t,n,r=!1){return new Promise((o,i)=>{let c=Fx(e,t,{signal:n,shell:!1,windowsHide:!0,env:Xx(e),stdio:["ignore",r?"pipe":"ignore","ignore"]}),a="",u=setTimeout(()=>{c.kill(),i(new Error("\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 \u043D\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0430\u0441\u044C. \u041F\u0440\u043E\u0432\u0435\u0440\u044C \u0438\u043D\u0442\u0435\u0440\u043D\u0435\u0442 \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438 \u044D\u0442\u043E\u0442 \u0448\u0430\u0433."))},r?5e3:18e4);c.stdout?.on("data",l=>{a+=String(l),a.length>4096&&(c.kill(),i(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0432\u0435\u0440\u0438\u0442\u044C Node.js.")))}),c.once("error",()=>{clearTimeout(u),i(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C Node.js \u0438\u043B\u0438 npm."))}),c.once("close",l=>{clearTimeout(u),l===0?o(a):i(new Error("\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0430 \u043D\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0430\u0441\u044C. \u041F\u0440\u043E\u0432\u0435\u0440\u044C \u0438\u043D\u0442\u0435\u0440\u043D\u0435\u0442 \u0438 \u043F\u043E\u0432\u0442\u043E\u0440\u0438 \u044D\u0442\u043E\u0442 \u0448\u0430\u0433."))})})}s(qx,"kimiCommand");async function Gx(e){return qf(e)}s(Gx,"node");async function Fi(e,t=!1,n=32768){let r=await Ux(e);if(r.isSymbolicLink()||(t?!r.isDirectory():!r.isFile()||r.size>n))throw new Error("\u041F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0451\u043D. \u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0438\u0441\u0430\u043D\u043E.")}s(Fi,"regular");async function Ui(e,t){let n=await Gx(t),r={nodeReady:!!n,nodeVersion:n?.version??null};try{await Fi(e,!0)}catch(o){return{...r,profile:o.code==="ENOENT"?"absent":"blocked",agent:null}}try{await Fi(bt(e,"setup-owner.json"),!1,262144);let o=JSON.parse(await Mg(bt(e,"setup-owner.json"),"utf8"));if(o.schema!==1||o.adapter!==fn||typeof o.nodeExecutable!="string")throw new Error;try{await Fi(bt(e,"bb-agent.json"))}catch(a){if(a.code==="ENOENT")return{...r,profile:"partial",agent:null};throw a}let i=Ci.parse(JSON.parse(await Mg(bt(e,"bb-agent.json"),"utf8")));if(![!1,!0,"catalog"].some(a=>JSON.stringify(i)===JSON.stringify(yt(e,o.nodeExecutable,a))))throw new Error;let c=[];try{let{catalog:a}=await gr(e);c=a.models.filter(u=>!u.retired).map(u=>u.id+(u.context>=1e6?"[1m]":""))}catch{}return{...r,profile:"ready",agent:i,verifyModels:c}}catch{return{...r,profile:"blocked",agent:null}}}s(Ui,"inspectKimi");async function Fg(e,t,n,r=()=>{}){n.throwIfAborted();let o=await Ui(e,n);if(r("profile-inspect","success",{profile:o.profile}),o.profile==="ready")return pn(e,{signal:n,log:r});if(o.profile==="blocked")throw new Error("\u041F\u0430\u043F\u043A\u0430 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0430. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044E\u0449\u0438\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u044B; \u043D\u0443\u0436\u043D\u0430 \u043F\u043E\u043C\u043E\u0449\u044C \u043F\u0430\u0440\u0442\u043D\u0451\u0440\u0430.");let i=s(async(a,u)=>{await qx(a,u,n)},"install"),c=await wr(r,"runtime",()=>Lg(e,n));if(o.profile==="partial")return gg({root:e,install:i,npmCli:c.npmCli,nodeExecutable:c.executable,signal:n,log:r});if(!t)throw new Error("\u0412\u0432\u0435\u0434\u0438 \u043A\u043B\u044E\u0447 \u0438\u0437 \u043A\u043E\u043D\u0441\u043E\u043B\u0438 Kimi Code.");return hg({root:e,apiKey:t,install:i,nodeExecutable:c.executable,npmCli:c.npmCli,signal:n,log:r})}s(Fg,"prepareKimi");async function Ug(e,t,n,r=fetch,o=()=>{}){if(n.throwIfAborted(),!/^sk-kimi-[A-Za-z0-9_-]+$/.test(t))throw new Error("\u041D\u0443\u0436\u0435\u043D \u043A\u043B\u044E\u0447 \u0438\u0437 \u043A\u043E\u043D\u0441\u043E\u043B\u0438 Kimi Code.");if((await Ui(e,n)).profile!=="ready")throw new Error("\u0421\u043E\u0431\u0441\u0442\u0432\u0435\u043D\u043D\u044B\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u0449\u0438\u043A\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D.");await gr(e),await Fi(bt(e,"credentials.json")),await pn(e,{signal:n,restrictContext:!0,log:o}),n.throwIfAborted();let c=bt(e,".key-"+Bx());try{await Vx(c,JSON.stringify({apiKey:t}),{mode:384,flag:"wx"}),n.throwIfAborted(),await Kx(c,bt(e,"credentials.json")),o("key-commit","success")}finally{await Hx(c,{force:!0})}await pn(e,{signal:n,fetchImpl:r,log:o})}s(Ug,"replaceKimiKey");import{randomUUID as Vg}from"node:crypto";var Qx=Jh({contract:ng,experimental_signals:jg,handlers:{async kimiInspect(e,t){return Ui(Yf(t.experimental_paths.dataDir,"kimi-cc"),t.signal)},async kimiPrepare({apiKey:e,diagnosticId:t},n){let r=Gf(t??Vg(),"host",o=>n.experimental_emitSignal("kimiDiagnostic",o));return wr(r,"prepare",()=>Fg(Yf(n.experimental_paths.dataDir,"kimi-cc"),e,n.signal,r))},async kimiReplaceKey({apiKey:e,diagnosticId:t},n){let r=Gf(t??Vg(),"host",o=>n.experimental_emitSignal("kimiDiagnostic",o));return await wr(r,"key-replace",()=>Ug(Yf(n.experimental_paths.dataDir,"kimi-cc"),e,n.signal,fetch,r)),null},async automaticHooks(e,t){return ag(e,t.signal)},async openLogin({url:e}){let t=process.env.BROWSER,n=t&&!/\s/.test(t)?t:process.platform==="darwin"?"/usr/bin/open":process.platform==="win32"?"rundll32.exe":"xdg-open",r=process.platform==="win32"&&n==="rundll32.exe"?["url.dll,FileProtocolHandler",e]:[e];return await new Promise((o,i)=>{let c=Yx(n,r,{detached:!0,stdio:"ignore",shell:!1});c.once("error",()=>i(new Error("\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0434\u043B\u044F \u0432\u0445\u043E\u0434\u0430."))),c.once("spawn",()=>{c.unref(),o()})}),null}}});export{Qx as default};
119
124
  //# sourceMappingURL=host.js.map