@gperezmz/bb-plugin-thread-glance 0.4.1 → 0.5.0
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/app.css +1 -1
- package/dist/app.js +30 -30
- package/dist/app.meta.json +1 -1
- package/dist/server.js +10 -10
- package/dist/server.js.map +3 -3
- package/dist/server.meta.json +1 -1
- package/features/thread-list/components/FoldRows.tsx +3 -3
- package/features/thread-list/components/GroupSection.tsx +10 -7
- package/features/thread-list/components/ListHeader.tsx +9 -4
- package/features/thread-list/components/ProviderBadge.tsx +1 -1
- package/features/thread-list/components/PullRequestBadge.tsx +1 -1
- package/features/thread-list/components/ThreadList.tsx +34 -13
- package/features/thread-list/components/ThreadRowView.tsx +9 -10
- package/features/thread-list/components/controller.ts +1 -1
- package/features/thread-list/components/glyphs.tsx +7 -4
- package/features/thread-list/components/input-modality.ts +51 -0
- package/features/thread-list/components/row-card.ts +1 -1
- package/features/thread-list/data/useIdleSince.ts +27 -0
- package/features/thread-list/data/useNow.ts +4 -3
- package/features/thread-list/data/useStamps.ts +19 -4
- package/features/thread-list/model/attention.ts +71 -7
- package/features/thread-list/model/expansion.ts +1 -1
- package/features/thread-list/model/settled.ts +1 -1
- package/features/thread-list/model/state.ts +18 -5
- package/features/thread-list/model/toggles.ts +3 -3
- package/features/thread-list/model/trees.ts +46 -9
- package/features/thread-list/model/view.ts +11 -5
- package/features/thread-list/testing/browser.css +7 -0
- package/features/thread-list/testing/fixtures.ts +10 -0
- package/package.json +1 -1
- package/server/stamps.ts +21 -3
- package/server.ts +5 -0
- package/shared/contract.ts +8 -0
- package/shared/signals.ts +2 -0
- package/skills/thread-glance/SKILL.md +1 -1
package/dist/server.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 Jl=Object.defineProperty;var s=(e,t)=>Jl(e,"name",{value:t,configurable:!0});var $e=(e,t)=>{for(var r in t)Jl(e,r,{get:t[r],enumerable:!0})};import{defineRpcContract as Qy}from"@get-bb/plugin-sdk";var b={};$e(b,{$brand:()=>vi,$input:()=>Gu,$output:()=>Ju,INVALID:()=>Y,NEVER:()=>bi,TimePrecision:()=>oc,ZodAny:()=>Ba,ZodArray:()=>Wa,ZodBase64:()=>Bo,ZodBase64URL:()=>Jo,ZodBigInt:()=>Mt,ZodBigIntFormat:()=>Wo,ZodBoolean:()=>Vt,ZodCIDRv4:()=>Ko,ZodCIDRv6:()=>Uo,ZodCUID:()=>Do,ZodCUID2:()=>Ro,ZodCatch:()=>gl,ZodCodec:()=>Vr,ZodCompileAsyncError:()=>pe,ZodCompileUnsupportedError:()=>Z,ZodCreditCard:()=>Ra,ZodCustom:()=>Mr,ZodCustomStringFormat:()=>nt,ZodDate:()=>Cr,ZodDefault:()=>ll,ZodDiscriminatedUnion:()=>Ha,ZodE164:()=>Go,ZodEmail:()=>No,ZodEmoji:()=>Co,ZodEnum:()=>Rt,ZodError:()=>wy,ZodExactOptional:()=>Qo,ZodFile:()=>sl,ZodFirstPartyTypeKind:()=>Ol,ZodFunction:()=>Sl,ZodGUID:()=>Eo,ZodIBAN:()=>La,ZodIPv4:()=>Mo,ZodIPv6:()=>Fo,ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,ZodInstanceOf:()=>Al,ZodIntersection:()=>Ya,ZodIssueCode:()=>xy,ZodJWT:()=>qo,ZodKSUID:()=>Vo,ZodLazy:()=>xl,ZodLiteral:()=>il,ZodMAC:()=>Da,ZodMap:()=>nl,ZodNaN:()=>_l,ZodNanoID:()=>To,ZodNever:()=>Ga,ZodNonOptional:()=>ei,ZodNull:()=>Ka,ZodNullable:()=>al,ZodNumber:()=>jt,ZodNumberFormat:()=>ot,ZodObject:()=>Dr,ZodOptional:()=>Lr,ZodPipe:()=>jr,ZodPrefault:()=>pl,ZodPreprocess:()=>$l,ZodPromise:()=>zl,ZodReadonly:()=>wl,ZodRealError:()=>ie,ZodRecord:()=>Dt,ZodSet:()=>ol,ZodString:()=>Lt,ZodStringFormat:()=>R,ZodSuccess:()=>hl,ZodSymbol:()=>Ma,ZodTemplateLiteral:()=>vl,ZodTransform:()=>ul,ZodTuple:()=>el,ZodType:()=>A,ZodULID:()=>Lo,ZodURL:()=>Er,ZodUUID:()=>ye,ZodUndefined:()=>Fa,ZodUnion:()=>Rr,ZodUnknown:()=>Ja,ZodVoid:()=>qa,ZodXID:()=>jo,ZodXor:()=>Xa,_ZodString:()=>Zo,_default:()=>fl,_function:()=>yd,any:()=>qp,array:()=>Tr,base64:()=>Ip,base64url:()=>Ap,bigint:()=>Kp,boolean:()=>Va,catch:()=>yl,check:()=>_d,cidrv4:()=>Sp,cidrv6:()=>Pp,clone:()=>C,codec:()=>dd,coerce:()=>Nl,compile:()=>Hu,config:()=>M,core:()=>ke,creditCard:()=>Zp,cuid:()=>_p,cuid2:()=>$p,currencyCode:()=>Rp,custom:()=>$d,date:()=>Xp,decode:()=>Aa,decodeAsync:()=>Za,deepPartial:()=>Nd,describe:()=>wd,discriminatedUnion:()=>rd,e164:()=>Op,email:()=>cp,emoji:()=>gp,encode:()=>Ia,encodeAsync:()=>Oa,endsWith:()=>zt,enum:()=>Ho,exactOptional:()=>cl,file:()=>ad,flattenError:()=>rr,float32:()=>jp,float64:()=>Vp,formatError:()=>nr,fromJSONSchema:()=>Od,function:()=>yd,getDiscriminatedOption:()=>wu,getErrorMap:()=>zy,globalRegistry:()=>G,gt:()=>he,gte:()=>ue,guid:()=>ap,hash:()=>Lp,hex:()=>Dp,hostname:()=>Tp,httpUrl:()=>hp,iban:()=>Np,includes:()=>xt,input:()=>Cd,instanceof:()=>vd,int:()=>Ao,int32:()=>Mp,int64:()=>Up,intersection:()=>Qa,invertCodec:()=>md,ipv4:()=>xp,ipv6:()=>zp,iso:()=>Fr,json:()=>kd,jwt:()=>Ep,keyof:()=>Hp,ksuid:()=>vp,lazy:()=>kl,length:()=>Ye,literal:()=>cd,locales:()=>xr,looseObject:()=>ed,looseRecord:()=>od,lowercase:()=>bt,lt:()=>me,lte:()=>se,mac:()=>kp,map:()=>id,maxLength:()=>He,maxSize:()=>Oe,memoizer:()=>br,meta:()=>bd,mime:()=>Pt,minLength:()=>xe,minSize:()=>ge,multipleOf:()=>Ae,nan:()=>pd,nanoid:()=>yp,nativeEnum:()=>ud,negative:()=>_o,never:()=>Xo,nonnegative:()=>wo,nonoptional:()=>ml,nonpositive:()=>$o,normalize:()=>It,null:()=>Ua,nullable:()=>Nr,nullish:()=>ld,number:()=>ja,object:()=>Yp,optional:()=>tt,output:()=>Td,overwrite:()=>de,parse:()=>ka,parseAsync:()=>za,partialRecord:()=>nd,pipe:()=>Oo,positive:()=>yo,prefault:()=>dl,preprocess:()=>zd,prettifyError:()=>Pi,promise:()=>gd,properties:()=>St,property:()=>bo,readonly:()=>bl,record:()=>rl,refine:()=>Pl,regex:()=>wt,regexes:()=>le,registry:()=>Bn,safeDecode:()=>Ea,safeDecodeAsync:()=>Ta,safeEncode:()=>Na,safeEncodeAsync:()=>Ca,safeParse:()=>Sa,safeParseAsync:()=>Pa,set:()=>sd,setErrorMap:()=>ky,size:()=>Xe,slugify:()=>Nt,startsWith:()=>kt,strictObject:()=>Qp,string:()=>Zr,stringFormat:()=>Cp,stringbool:()=>xd,success:()=>fd,superRefine:()=>Il,symbol:()=>Jp,templateLiteral:()=>hd,toJSONSchema:()=>zo,toLowerCase:()=>Ot,toUpperCase:()=>Zt,toZod:()=>Gt,transform:()=>Yo,treeifyError:()=>Si,trim:()=>At,tuple:()=>tl,uint32:()=>Fp,uint64:()=>Bp,ulid:()=>wp,undefined:()=>Gp,union:()=>Ft,unknown:()=>et,uppercase:()=>vt,url:()=>mp,util:()=>v,uuid:()=>lp,uuidv4:()=>fp,uuidv6:()=>pp,uuidv7:()=>dp,validate:()=>or,validateAsync:()=>ir,void:()=>Wp,withParser:()=>Jn,xid:()=>bp,xor:()=>td});var ke={};$e(ke,{$ZodAny:()=>pu,$ZodArray:()=>yu,$ZodAsyncError:()=>ne,$ZodBase64:()=>eu,$ZodBase64URL:()=>tu,$ZodBigInt:()=>Cn,$ZodBigIntFormat:()=>cu,$ZodBoolean:()=>hr,$ZodCIDRv4:()=>Ys,$ZodCIDRv6:()=>Qs,$ZodCUID:()=>Vs,$ZodCUID2:()=>Ms,$ZodCatch:()=>Du,$ZodCheck:()=>L,$ZodCheckBigIntFormat:()=>ds,$ZodCheckEndsWith:()=>zs,$ZodCheckGreaterThan:()=>_n,$ZodCheckIncludes:()=>xs,$ZodCheckLengthEquals:()=>$s,$ZodCheckLessThan:()=>yn,$ZodCheckLowerCase:()=>bs,$ZodCheckMaxLength:()=>ys,$ZodCheckMaxSize:()=>ms,$ZodCheckMimeType:()=>Is,$ZodCheckMinLength:()=>_s,$ZodCheckMinSize:()=>hs,$ZodCheckMultipleOf:()=>fs,$ZodCheckNumberFormat:()=>ps,$ZodCheckOverwrite:()=>As,$ZodCheckProperties:()=>Ps,$ZodCheckProperty:()=>Ss,$ZodCheckRegex:()=>ws,$ZodCheckSizeEquals:()=>gs,$ZodCheckStartsWith:()=>ks,$ZodCheckStringFormat:()=>gt,$ZodCheckUpperCase:()=>vs,$ZodCodec:()=>yr,$ZodCreditCard:()=>nu,$ZodCustom:()=>Ku,$ZodCustomStringFormat:()=>su,$ZodCyclicError:()=>Mn,$ZodDate:()=>gu,$ZodDefault:()=>Nu,$ZodDiscriminatedUnion:()=>bu,$ZodE164:()=>ru,$ZodEmail:()=>Cs,$ZodEmoji:()=>Ls,$ZodEncodeError:()=>Ie,$ZodEnum:()=>Su,$ZodError:()=>zi,$ZodExactOptional:()=>Ou,$ZodFile:()=>Iu,$ZodFunction:()=>Mu,$ZodGUID:()=>Ns,$ZodIBAN:()=>ou,$ZodIPv4:()=>Ws,$ZodIPv6:()=>Xs,$ZodISODate:()=>Js,$ZodISODateTime:()=>Bs,$ZodISODuration:()=>qs,$ZodISOTime:()=>Gs,$ZodIntersection:()=>vu,$ZodJWT:()=>iu,$ZodKSUID:()=>Us,$ZodLazy:()=>_r,$ZodLiteral:()=>Pu,$ZodMAC:()=>Hs,$ZodMap:()=>ku,$ZodNaN:()=>Ru,$ZodNanoID:()=>js,$ZodNever:()=>mu,$ZodNonOptional:()=>Cu,$ZodNull:()=>fu,$ZodNullable:()=>Zu,$ZodNumber:()=>En,$ZodNumberFormat:()=>uu,$ZodObject:()=>If,$ZodObjectJIT:()=>_u,$ZodOptional:()=>Dn,$ZodPipe:()=>Rn,$ZodPrefault:()=>Eu,$ZodPreprocess:()=>Lu,$ZodPromise:()=>Fu,$ZodReadonly:()=>ju,$ZodRealError:()=>oe,$ZodRecord:()=>xu,$ZodRegistry:()=>Un,$ZodSet:()=>zu,$ZodString:()=>Be,$ZodStringFormat:()=>T,$ZodSuccess:()=>Tu,$ZodSymbol:()=>au,$ZodTemplateLiteral:()=>Vu,$ZodTransform:()=>Au,$ZodTuple:()=>Tn,$ZodType:()=>P,$ZodULID:()=>Fs,$ZodURL:()=>Rs,$ZodUUID:()=>Es,$ZodUndefined:()=>lu,$ZodUnion:()=>gr,$ZodUnknown:()=>du,$ZodVoid:()=>hu,$ZodXID:()=>Ks,$ZodXor:()=>$u,$brand:()=>vi,$constructor:()=>h,$input:()=>Gu,$output:()=>Ju,Doc:()=>Ue,INVALID:()=>Y,JSONSchema:()=>ip,JSONSchemaGenerator:()=>So,NEVER:()=>bi,TimePrecision:()=>oc,URL_BAD_FORMAT:()=>Ts,URL_UNPARSEABLE:()=>lr,ZodCompileAsyncError:()=>pe,ZodCompileUnsupportedError:()=>Z,_any:()=>bc,_array:()=>Ic,_base64:()=>po,_base64url:()=>mo,_bigint:()=>mc,_boolean:()=>pc,_catch:()=>cy,_check:()=>Kf,_cidrv4:()=>lo,_cidrv6:()=>fo,_coercedBigint:()=>hc,_coercedBoolean:()=>dc,_coercedDate:()=>Sc,_coercedNumber:()=>sc,_coercedString:()=>ec,_creditCard:()=>rc,_cuid:()=>no,_cuid2:()=>oo,_custom:()=>Oc,_date:()=>zc,_decode:()=>sn,_decodeAsync:()=>cn,_default:()=>iy,_discriminatedUnion:()=>Gg,_e164:()=>ho,_email:()=>Wn,_emoji:()=>to,_encode:()=>on,_encodeAsync:()=>un,_endsWith:()=>zt,_enum:()=>Qg,_file:()=>Ac,_float32:()=>cc,_float64:()=>ac,_gt:()=>he,_gte:()=>ue,_guid:()=>Xn,_iban:()=>nc,_includes:()=>xt,_int:()=>uc,_int32:()=>lc,_int64:()=>gc,_intersection:()=>qg,_ipv4:()=>co,_ipv6:()=>ao,_isoDate:()=>Sr,_isoDateTime:()=>zr,_isoDuration:()=>Ir,_isoTime:()=>Pr,_jwt:()=>go,_ksuid:()=>uo,_lazy:()=>py,_length:()=>Ye,_literal:()=>ty,_lowercase:()=>bt,_lt:()=>me,_lte:()=>se,_mac:()=>tc,_map:()=>Hg,_max:()=>se,_maxLength:()=>He,_maxSize:()=>Oe,_mime:()=>Pt,_min:()=>ue,_minLength:()=>xe,_minSize:()=>ge,_multipleOf:()=>Ae,_nan:()=>Pc,_nanoid:()=>ro,_nativeEnum:()=>ey,_negative:()=>_o,_never:()=>xc,_nonnegative:()=>wo,_nonoptional:()=>sy,_nonpositive:()=>$o,_normalize:()=>It,_null:()=>wc,_nullable:()=>oy,_number:()=>ic,_optional:()=>ny,_overwrite:()=>de,_parse:()=>pt,_parseAsync:()=>dt,_pipe:()=>ay,_positive:()=>yo,_promise:()=>dy,_properties:()=>St,_property:()=>bo,_readonly:()=>ly,_record:()=>Xg,_refine:()=>Zc,_regex:()=>wt,_safeDecode:()=>ln,_safeDecodeAsync:()=>pn,_safeEncode:()=>an,_safeEncodeAsync:()=>fn,_safeParse:()=>mt,_safeParseAsync:()=>ht,_set:()=>Yg,_size:()=>Xe,_slugify:()=>Nt,_startsWith:()=>kt,_string:()=>Qu,_stringFormat:()=>Qe,_stringbool:()=>Tc,_success:()=>uy,_superRefine:()=>Nc,_symbol:()=>_c,_templateLiteral:()=>fy,_toLowerCase:()=>Ot,_toUpperCase:()=>Zt,_transform:()=>ry,_trim:()=>At,_tuple:()=>Wg,_uint32:()=>fc,_uint64:()=>yc,_ulid:()=>io,_undefined:()=>$c,_union:()=>Bg,_unknown:()=>vc,_uppercase:()=>vt,_url:()=>kr,_uuid:()=>Hn,_uuidv4:()=>Yn,_uuidv6:()=>Qn,_uuidv7:()=>eo,_void:()=>kc,_xid:()=>so,_xor:()=>Jg,base64Charset:()=>In,base64urlCharset:()=>mr,canParseURL:()=>Ds,clone:()=>C,compile:()=>Hu,compileFn:()=>Gn,config:()=>M,createStandardJSONSchemaMethod:()=>Et,createToJSONSchemaMethod:()=>Rc,decode:()=>th,decodeAsync:()=>nh,describe:()=>Ec,encode:()=>eh,encodeAsync:()=>rh,extractDefs:()=>Ne,finalize:()=>Ee,flattenError:()=>rr,formatError:()=>nr,getDiscriminatedOption:()=>wu,globalConfig:()=>B,globalRegistry:()=>G,handleUnrepresentable:()=>K,initializeContext:()=>Ze,isBackEdge:()=>Kn,isRecursiveSchema:()=>Fn,isValidBase64:()=>dr,isValidBase64URL:()=>An,isValidCIDRv6:()=>Pn,isValidCreditCard:()=>On,isValidIBAN:()=>Zn,isValidIPv6:()=>pr,isValidJWT:()=>Nn,locales:()=>xr,memoizer:()=>br,mergeValues:()=>yt,meta:()=>Cc,parse:()=>rn,parseAsync:()=>nn,parseURLObject:()=>zf,prettifyError:()=>Pi,process:()=>D,processSchema:()=>D,regexes:()=>le,registry:()=>Bn,safeDecode:()=>ih,safeDecodeAsync:()=>uh,safeEncode:()=>oh,safeEncodeAsync:()=>sh,safeParse:()=>Wm,safeParseAsync:()=>Xm,standardProps:()=>xn,stripTabAndNewline:()=>fr,toDotPath:()=>nf,toJSONSchema:()=>zo,toZod:()=>Gt,treeifyError:()=>Si,urlHostnameOk:()=>zn,urlProtocolOk:()=>Sn,util:()=>v,validate:()=>or,validateAsync:()=>ir,validateURL:()=>kn,version:()=>Os,withParser:()=>Jn});var v={};$e(v,{BIGINT_FORMAT_RANGES:()=>Yt,CONSTANT_CATCH:()=>en,Class:()=>li,NUMBER_FORMAT_RANGES:()=>Ht,aborted:()=>H,allowsEval:()=>di,assert:()=>hm,assertEqual:()=>fm,assertIs:()=>dm,assertNever:()=>mm,assertNotEqual:()=>pm,assignProp:()=>J,attachSchema:()=>Qr,base64ToUint8Array:()=>Hl,base64urlToUint8Array:()=>Cm,cached:()=>at,captureStackTrace:()=>Xr,cleanEnum:()=>Em,cleanRegex:()=>be,clone:()=>C,cloneDef:()=>_m,codePointLength:()=>Fe,constantCatch:()=>$i,createTransparentProxy:()=>km,defineLazy:()=>fi,defineLazyInternal:()=>O,derived:()=>Lm,esc:()=>X,escapeRegex:()=>ae,explicitlyAborted:()=>gi,extend:()=>Pm,finalizeIssue:()=>re,floatSafeRemainder:()=>qt,getElementAtPath:()=>$m,getEnumValues:()=>ut,getLengthableOrigin:()=>er,getParsedType:()=>xm,getSizableOrigin:()=>Qt,hexToUint8Array:()=>Dm,hide:()=>tr,installLazyProp:()=>Fm,isObject:()=>Me,isPlainObject:()=>ce,issue:()=>ft,joinValues:()=>qr,jsonStringifyReplacer:()=>ct,members:()=>_i,merge:()=>Am,mergeDefs:()=>fe,normalizeParams:()=>_,nullish:()=>Wr,numKeys:()=>vm,objectClone:()=>gm,omit:()=>Sm,optionalKeys:()=>hi,own:()=>Pe,parsedType:()=>yi,partial:()=>Om,pick:()=>zm,prefixIssues:()=>te,primitiveTypes:()=>mi,promiseAllObject:()=>wm,propertyKeyTypes:()=>Xt,randomString:()=>bm,rawShape:()=>lt,required:()=>Zm,safeExtend:()=>Im,shallowClone:()=>Wt,slugify:()=>pi,stringifyPrimitive:()=>Hr,toZod:()=>Gt,uint8ArrayToBase64:()=>Yl,uint8ArrayToBase64url:()=>Tm,uint8ArrayToHex:()=>Rm,unwrapMessage:()=>st});function fm(e){return e}s(fm,"assertEqual");function pm(e){return e}s(pm,"assertNotEqual");function Gt(){return e=>e}s(Gt,"toZod");function dm(e){}s(dm,"assertIs");function mm(e){throw new Error("Unexpected value in exhaustive check")}s(mm,"assertNever");function hm(e){}s(hm,"assert");function ut(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}s(ut,"getEnumValues");function qr(e,t="|"){return e.map(r=>Hr(r)).join(t)}s(qr,"joinValues");function ct(e,t){return typeof t=="bigint"?t.toString():t}s(ct,"jsonStringifyReplacer");var ai=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 at(e){return new ai(e)}s(at,"cached");function Wr(e){return e==null}s(Wr,"nullish");function be(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}s(be,"cleanRegex");function qt(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}s(qt,"floatSafeRemainder");var Gl=Symbol("evaluating");function fi(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Gl)return n===void 0&&(n=Gl,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}s(fi,"defineLazy");function gm(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}s(gm,"objectClone");function J(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}s(J,"assignProp");function lt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}s(lt,"rawShape");function we(e){return lt(e._zod.def)??e._zod.def.shape}s(we,"sourceShape");function ql(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return J(this,t,n),n},enumerable:!0,configurable:!0})}s(ql,"deferProp");function Wl(e,t,r){t in e?J(e,t,r):e[t]=r}s(Wl,"putProp");function Ve(e,t,r,n){let o=we(t);for(let i of r){let u=Object.getOwnPropertyDescriptor(o,i);u.enumerable&&(u.get?ql(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):Wl(e,i,n?n(u.value,i):u.value))}}s(Ve,"mirrorShape");function ym(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?ql(e,r,()=>t[r]):Wl(e,r,n.value))}}s(ym,"mirrorProps");function fe(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}s(fe,"mergeDefs");function _m(e){return fe(e._zod.def)}s(_m,"cloneDef");function $m(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}s($m,"getElementAtPath");function wm(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}s(wm,"promiseAllObject");function bm(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}s(bm,"randomString");function X(e){return JSON.stringify(e)}s(X,"esc");function pi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}s(pi,"slugify");var Xr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Me(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Me,"isObject");var di=at(()=>{if(B.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ce(e){if(Me(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Me(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}s(ce,"isPlainObject");function Wt(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}s(Wt,"shallowClone");function vm(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}s(vm,"numKeys");var xm=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"),Xt=new Set(["string","number","symbol"]),mi=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(ae,"escapeRegex");function C(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}s(C,"clone");function _(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(_,"normalizeParams");function km(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}s(km,"createTransparentProxy");function Hr(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}s(Hr,"stringifyPrimitive");function hi(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}s(hi,"optionalKeys");var Ht={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]},Yt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zm(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return Ve(i,e,Yr(e,t)),C(e,fe(r,{shape:i,checks:[]}))}s(zm,"pick");function Yr(e,t){let r=we(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}s(Yr,"maskedKeys");function Sm(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Yr(e,t)),u={};return Ve(u,e,Reflect.ownKeys(we(e)).filter(c=>!i.has(c))),C(e,fe(r,{shape:u,checks:[]}))}s(Sm,"omit");function Pm(e,t){if(!ce(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=we(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 C(e,fe(e._zod.def,{shape:Xl(e,t)}))}s(Pm,"extend");function Xl(e,t){let r={};return Ve(r,e,Reflect.ownKeys(we(e))),ym(r,t),r}s(Xl,"extended");function Im(e,t){if(!ce(t))throw new Error("Invalid input to safeExtend: expected a plain object");return C(e,fe(e._zod.def,{shape:Xl(e,t)}))}s(Im,"safeExtend");function Am(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Ve(r,e,Reflect.ownKeys(we(e))),Ve(r,t,Reflect.ownKeys(we(t)));let n=fe(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return C(e,n)}s(Am,"merge");function Om(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(Yr(t,r)):void 0,a={};return Ve(a,t,Reflect.ownKeys(we(t)),e&&((l,f)=>c&&!c.has(f)?l:new e({type:"optional",innerType:l}))),C(t,fe(t._zod.def,{shape:a,checks:[]}))}s(Om,"partial");function Zm(e,t,r){let n=r?new Set(Yr(t,r)):void 0,o={};return Ve(o,t,Reflect.ownKeys(we(t)),(i,u)=>n&&!n.has(u)?i:new e({type:"nonoptional",innerType:i})),C(t,fe(t._zod.def,{shape:o}))}s(Zm,"required");function H(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}s(H,"aborted");function gi(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}s(gi,"explicitlyAborted");function te(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}s(te,"prefixIssues");function st(e){return typeof e=="string"?e:e?.message}s(st,"unwrapMessage");function Qr(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}s(Qr,"attachSchema");function re(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,u=e.message?e.message:st(e.inst?._zod.def?.error?.(e))??st(i?.(e))??st(t?.error?.(e))??st(r.customError?.(e))??st(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(c[a]=e[a]);return c.path??(c.path=[]),c.message=u,t?.reportInput&&(c.input=e.input),c}s(re,"finalizeIssue");function Qt(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}s(Qt,"getSizableOrigin");var Nm=/[\uD800-\uDBFF]/;function Fe(e){let t=e.length;if(!Nm.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}s(Fe,"codePointLength");function er(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}s(er,"getLengthableOrigin");function yi(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}s(yi,"parsedType");function ft(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}s(ft,"issue");function Em(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}s(Em,"cleanEnum");function Hl(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}s(Hl,"base64ToUint8Array");function Yl(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}s(Yl,"uint8ArrayToBase64");function Cm(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Hl(t+r)}s(Cm,"base64urlToUint8Array");function Tm(e){return Yl(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s(Tm,"uint8ArrayToBase64url");function Dm(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}s(Dm,"hexToUint8Array");function Rm(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}s(Rm,"uint8ArrayToHex");var li=class{static{s(this,"Class")}constructor(...t){}};function _i(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):jm(e,r,n.value)}}s(_i,"members");function Pe(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}s(Pe,"own");function tr(e,t,r){return Pe(e,t,r,!1)}s(tr,"hide");function Lm(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Pe(this,r,n(this))},set(o){Pe(this,r,o)}})}return t}s(Lm,"derived");function jm(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Pe(this,t,r.bind(this))},set(n){Pe(this,t,n)}})}s(jm,"defineBound");function Vm(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}s(Vm,"claim");var ci,Se=!1,Mm={configurable:!0,get(){Se=!0}};function O(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&ci!==e._zod){ci=void 0;return}ci=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Mm);let o=Se;Se=!1;try{let i=r(this);return Se?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Se=Se||o,i}catch(i){throw delete this[t],Se=Se||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}s(O,"defineLazyInternal");function Fm(e,t,r,n){let o=Vm(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}s(Fm,"installLazyProp");var en="~constantCatch";function $i(e){let t=s(()=>e,"fn");return t[en]=!0,t}s($i,"constantCatch");var Ql,bi=Object.freeze({status:"aborted"}),wi={value:void 0,enumerable:!1},ef="captureStackTrace"in Error?Error:null;function Km(e){let t=ef;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return ef=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}s(Km,"newError");function h(e,t,r,n){let o={};function i(d){this.def=d,this.constr=p,this.traits=new Set}s(i,"Internals"),i.prototype=o;let u=r,c=u&&new WeakSet;function a(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),c){let y=Object.getPrototypeOf(d),$=d._zod.constr.prototype,z=y;for(;z&&z!==$;)z=Object.getPrototypeOf(z);let x=z??y;c.has(x)||(c.add(x),_i(x,u))}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(a,"init");let l=n?.Parent??Object;class f extends l{static{s(this,"Definition")}}Object.defineProperty(f,"name",{value:e});function p(d){let m=n?.Parent?Km(f):this;a(m,d);let g=m._zod.deferred;if(g){for(let $ of g)$();m._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;return y&&y(m),m}return s(p,"_"),Object.defineProperty(p,"init",{value:a}),Object.defineProperty(p,Symbol.hasInstance,{value:s(d=>n?.Parent&&d instanceof n.Parent?!0:d?._zod?.traits?.has(e),"value")}),Object.defineProperty(p,"name",{value:e}),p}s(h,"$constructor");var vi=Symbol("zod_brand"),ne=class extends Error{static{s(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ie=class extends Error{static{s(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Ql=globalThis).__zod_globalConfig??(Ql.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function M(e){return e&&Object.assign(B,e),B}s(M,"config");function Um(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ct,2)),e.message}s(Um,"_getMessage");function Bm(e){this._zod.message=e}s(Bm,"_setMessage");var Jm={get:Um,set:Bm,enumerable:!0,configurable:!0},ki={value:void 0,enumerable:!1},tf=new WeakSet([Object.prototype,Error.prototype]),rf=s((e,t)=>{e.name="$ZodError",ki.value=t,Object.defineProperty(e,"issues",ki),ki.value=void 0,Object.defineProperty(e,"message",Jm);let r=Object.getPrototypeOf(e);tf.has(r)||(tf.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=s(()=>this.message,"value");return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},"initializer"),zi=h("$ZodError",rf),oe=h("$ZodError",rf,void 0,{Parent:Error});function Gm(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}s(Gm,"node");function rr(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?Gm(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}s(rr,"flattenError");function nr(e,t=r=>r.message){let r={_errors:[]},n=s((o,i=[])=>{for(let u of o.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(c=>n({issues:c},[...i,...u.path]));else if(u.code==="invalid_key")n({issues:u.issues},[...i,...u.path]);else if(u.code==="invalid_element")n({issues:u.issues},[...i,...u.path]);else{let c=[...i,...u.path];if(c.length===0)r._errors.push(t(u));else{let a=r,l=0;for(;l<c.length;){let f=c[l],p=l===c.length-1;if(f==="_errors"){p&&a._errors.push(t(u)),l++;continue}Object.prototype.hasOwnProperty.call(a,f)||Object.defineProperty(a,f,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=a[f];p&&d._errors.push(t(u)),a=d,l++}}}},"processError");return n(e),r}s(nr,"formatError");function Si(e,t=r=>r.message){let r={errors:[]},n=s((o,i=[])=>{var u;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(a=>n({issues:a},[...i,...c.path]));else if(c.code==="invalid_key")n({issues:c.issues},[...i,...c.path]);else if(c.code==="invalid_element")n({issues:c.issues},[...i,...c.path]);else{let a=[...i,...c.path];if(a.length===0){r.errors.push(t(c));continue}let l=r,f=0;for(;f<a.length;){let p=a[f],d=f===a.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=[]),(u=l.items)[p]??(u[p]={errors:[]}),l=l.items[p]),d&&l.errors.push(t(c)),f++}}},"processError");return n(e),r}s(Si,"treeifyError");function nf(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}s(nf,"toDotPath");function Pi(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${nf(n.path)}`);return t.join(`
|
|
8
|
-
`)}s(Pi,"prettifyError");function tn(e,t){return{callee:t?.callee??e,Err:t?.Err}}s(tn,"finalizeParams");var pt=s(e=>{let t=s((r,n,o,i)=>{let u=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},u);if(c instanceof Promise)throw new ne;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map(l=>re(l,u,M())));throw Xr(a,i?.callee??t),a}return c.value},"fn");return t},"_parse"),rn=pt(oe),dt=s(e=>{let t=s(async(r,n,o,i)=>{let u=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},u);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(i?.Err??e)(c.issues.map(l=>re(l,u,M())));throw Xr(a,i?.callee??t),a}return c.value},"fn");return t},"_parseAsync"),nn=dt(oe),mt=s(e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ne;return i.issues.length?of(e,i.issues,o):{success:!0,data:i.value}},"_safeParse"),Wm=mt(oe);function of(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>re(o,r,M()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}s(of,"failure");var ht=s(e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?of(e,i.issues,o):{success:!0,data:i.value}},"_safeParseAsync"),Xm=ht(oe),Hm=Symbol.for("zod.compile.invalid"),Ym=Symbol.for("zod.compile.fallback"),or=s(((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Hm)return!0;if(n.definite===!0&&r===void 0)return!1}return Qm(e,t,r)}),"validate");function Qm(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[Ym]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new ne;return i.issues.length===0}s(Qm,"validateFallback");var ir=s(async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},"validateAsync"),on=s(e=>{let t=pt(e),r=s((n,o,i,u)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,tn(r,u))},"fn");return r},"_encode"),eh=on(oe),sn=s(e=>{let t=pt(e),r=s((n,o,i,u)=>t(n,o,i,tn(r,u)),"fn");return r},"_decode"),th=sn(oe),un=s(e=>{let t=dt(e),r=s(async(n,o,i,u)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,tn(r,u))},"fn");return r},"_encodeAsync"),rh=un(oe),cn=s(e=>{let t=dt(e),r=s(async(n,o,i,u)=>await t(n,o,i,tn(r,u)),"fn");return r},"_decodeAsync"),nh=cn(oe),an=s(e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return mt(e)(t,r,o)},"_safeEncode"),oh=an(oe),ln=s(e=>(t,r,n)=>mt(e)(t,r,n),"_safeDecode"),ih=ln(oe),fn=s(e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ht(e)(t,r,o)},"_safeEncodeAsync"),sh=fn(oe),pn=s(e=>async(t,r,n)=>ht(e)(t,r,n),"_safeDecodeAsync"),uh=pn(oe);var le={};$e(le,{anyString:()=>es,base64:()=>Bi,base64url:()=>Ji,bigint:()=>rs,boolean:()=>ns,browserEmail:()=>hh,cidrv4:()=>Ki,cidrv6:()=>Ui,creditCard:()=>dn,cuid:()=>Ai,cuid2:()=>Oi,currencyCode:()=>Xi,date:()=>Hi,datetime:()=>Qi,domain:()=>qi,duration:()=>Di,e164:()=>Wi,email:()=>Li,emoji:()=>ji,extendedDuration:()=>ch,guid:()=>Ri,hex:()=>cs,hostname:()=>Gi,html5Email:()=>ph,httpProtocol:()=>sr,iban:()=>mn,idnEmail:()=>mh,integer:()=>ur,ipv4:()=>Vi,ipv6:()=>Mi,ksuid:()=>Ei,lowercase:()=>ss,mac:()=>Fi,md5_base64:()=>$h,md5_base64url:()=>wh,md5_hex:()=>_h,nanoid:()=>Ci,nanoidOfLength:()=>Ti,null:()=>os,number:()=>ve,rfc5322Email:()=>dh,sha1_base64:()=>vh,sha1_base64url:()=>xh,sha1_hex:()=>bh,sha256_base64:()=>zh,sha256_base64url:()=>Sh,sha256_hex:()=>kh,sha384_base64:()=>Ih,sha384_base64url:()=>Ah,sha384_hex:()=>Ph,sha512_base64:()=>Zh,sha512_base64url:()=>Nh,sha512_hex:()=>Oh,string:()=>ts,time:()=>Yi,ulid:()=>Zi,undefined:()=>is,unicodeEmail:()=>sf,uppercase:()=>us,uuid:()=>Ke,uuid4:()=>ah,uuid6:()=>lh,uuid7:()=>fh,xid:()=>Ni});var Ai=/^[cC][0-9a-z]{6,}$/,Oi=/^[0-9a-z]+$/,Zi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ni=/^[0-9a-vA-V]{20}$/,Ei=/^[A-Za-z0-9]{27}$/,Ci=/^[a-zA-Z0-9_-]{21}$/;function Ti(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}s(Ti,"nanoidOfLength");var Di=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ch=/^[-+]?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)?)??$/,Ri=/^([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})$/,Ke=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"),ah=Ke(4),lh=Ke(6),fh=Ke(7),Li=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ph=/^[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])?)*$/,dh=/^(([^<>()\[\]\\.,;:\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,}))$/,sf=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,mh=sf,hh=/^[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])?)*$/,gh="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function ji(){return new RegExp(gh,"u")}s(ji,"emoji");var Vi=/^(?:(?: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])$/,Mi=/^(([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}|:))$/,Fi=s(e=>{let t=ae(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"),Ki=/^((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])$/,Ui=/^(([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])$/,Bi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ji=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Gi=/^(?=.{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])?)*\.?$/,qi=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,sr=/^https?$/,Wi=/^\+[1-9]\d{6,14}$/,dn=/^\d(?:[ -]?\d){11,18}$/,Xi=/^(?: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)$/,mn=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,uf="(?:(?:\\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 yh(e){return new RegExp(`^${e}$`)}s(yh,"anchor");var Hi=yh(uf);function Ii(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(Ii,"timeSource");function Yi(e){return new RegExp(`^${Ii(e)}$`)}s(Yi,"time");function Qi(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Ii({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Ii({precision:e.precision})}`:r;return new RegExp(`^${uf}T(?:${n})$`)}s(Qi,"datetime");var es=/^[\s\S]{0,}$/,ts=s(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),rs=/^-?\d+n?$/,ur=/^-?\d+$/,ve=/^-?\d+(?:\.\d+)?$/,ns=/^(?:true|false)$/i,os=/^null$/i;var is=/^undefined$/i;var ss=/^[^A-Z]*$/,us=/^[^a-z]*$/,cs=/^[0-9a-fA-F]*$/;function cr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}s(cr,"fixedBase64");function ar(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}s(ar,"fixedBase64url");var _h=/^[0-9a-fA-F]{32}$/,$h=cr(22,"=="),wh=ar(22),bh=/^[0-9a-fA-F]{40}$/,vh=cr(27,"="),xh=ar(27),kh=/^[0-9a-fA-F]{64}$/,zh=cr(43,"="),Sh=ar(43),Ph=/^[0-9a-fA-F]{96}$/,Ih=cr(64,""),Ah=ar(64),Oh=/^[0-9a-fA-F]{128}$/,Zh=cr(86,"=="),Nh=ar(86);var L=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),as=s(e=>{let t=e.value;return!Wr(t)&&t.size!==void 0},"_whenHasSize"),ls=s(e=>{let t=e.value;return!Wr(t)&&t.length!==void 0},"_whenHasLength"),hn={number:"number",bigint:"bigint",object:"date"},yn=h("$ZodCheckLessThan",(e,t)=>{L.init(e,t);let r=hn[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:hn[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_n=h("$ZodCheckGreaterThan",(e,t)=>{L.init(e,t);let r=hn[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:hn[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fs=h("$ZodCheckMultipleOf",(e,t)=>{L.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):qt(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ps=h("$ZodCheckNumberFormat",(e,t)=>{L.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ht[t.format];e._zod.check=u=>{let c=u.value;if(r){if(!Number.isInteger(c)){u.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?u.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):u.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<o&&u.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&u.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),ds=h("$ZodCheckBigIntFormat",(e,t)=>{L.init(e,t);let[r,n]=Yt[t.format];e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),ms=h("$ZodCheckMaxSize",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=as),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Qt(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),hs=h("$ZodCheckMinSize",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=as),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Qt(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),gs=h("$ZodCheckSizeEquals",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=as),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let u=i>t.size;n.issues.push({origin:Qt(o),...u?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ys=h("$ZodCheckMaxLength",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=ls),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Fe(o):i)<=t.maximum)return;let c=er(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_s=h("$ZodCheckMinLength",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=ls),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Fe(o):i)>=t.minimum)return;let c=er(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$s=h("$ZodCheckLengthEquals",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=ls),e._zod.check=n=>{let o=n.value,i=o.length,u=typeof o=="string"&&i>=t.length&&i<=t.length*2?Fe(o):i;if(u===t.length)return;let c=er(o),a=u>t.length;n.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),gt=h("$ZodCheckStringFormat",(e,t)=>{var r,n;L.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ws=h("$ZodCheckRegex",(e,t)=>{gt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),bs=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ss),gt.init(e,t)}),vs=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=us),gt.init(e,t)}),xs=h("$ZodCheckIncludes",(e,t)=>{L.init(e,t);let r=ae(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),ks=h("$ZodCheckStartsWith",(e,t)=>{L.init(e,t);let r=new RegExp(`^${ae(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),zs=h("$ZodCheckEndsWith",(e,t)=>{L.init(e,t);let r=new RegExp(`.*${ae(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function gn(e,t,r){e.issues.length&&t.issues.push(...te(r,e.issues))}s(gn,"handleCheckPropertyResult");var Ss=h("$ZodCheckProperty",(e,t)=>{L.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>gn(o,r,t.property));gn(n,r,t.property)}}),Ps=h("$ZodCheckProperties",(e,t)=>{L.init(e,t),tr(e,Symbol.iterator,function*(){yield e});let r;e._zod.check=n=>{if(n.value==null){n.issues.push({expected:"object",code:"invalid_type",input:n.value,inst:e});return}r??(r=Reflect.ownKeys(t.shape).map(u=>[u,t.shape[u]]));let o=n.value,i;for(let[u,c]of r){let a=c._zod.run({value:o[u],issues:[]},{});a instanceof Promise?(i??(i=[]),i.push(a.then(l=>gn(l,n,u)))):gn(a,n,u)}if(i)return Promise.all(i).then(()=>{})}}),Is=h("$ZodCheckMimeType",(e,t)=>{L.init(e,t);let r=new Set(t.mime);e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),As=h("$ZodCheckOverwrite",(e,t)=>{L.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ue=class{static{s(this,"Doc")}constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
7
|
+
var Gl=Object.defineProperty;var s=(e,t)=>Gl(e,"name",{value:t,configurable:!0});var $e=(e,t)=>{for(var r in t)Gl(e,r,{get:t[r],enumerable:!0})};import{defineRpcContract as Qy}from"@get-bb/plugin-sdk";var b={};$e(b,{$brand:()=>vi,$input:()=>Gu,$output:()=>Ju,INVALID:()=>Y,NEVER:()=>bi,TimePrecision:()=>oc,ZodAny:()=>Ba,ZodArray:()=>Wa,ZodBase64:()=>Jo,ZodBase64URL:()=>Go,ZodBigInt:()=>Mt,ZodBigIntFormat:()=>Xo,ZodBoolean:()=>Vt,ZodCIDRv4:()=>Uo,ZodCIDRv6:()=>Bo,ZodCUID:()=>Ro,ZodCUID2:()=>Lo,ZodCatch:()=>gl,ZodCodec:()=>Vr,ZodCompileAsyncError:()=>pe,ZodCompileUnsupportedError:()=>Z,ZodCreditCard:()=>Ra,ZodCustom:()=>Mr,ZodCustomStringFormat:()=>nt,ZodDate:()=>Cr,ZodDefault:()=>ll,ZodDiscriminatedUnion:()=>Ha,ZodE164:()=>qo,ZodEmail:()=>Eo,ZodEmoji:()=>To,ZodEnum:()=>Rt,ZodError:()=>wy,ZodExactOptional:()=>ei,ZodFile:()=>sl,ZodFirstPartyTypeKind:()=>Ol,ZodFunction:()=>Sl,ZodGUID:()=>Co,ZodIBAN:()=>La,ZodIPv4:()=>Fo,ZodIPv6:()=>Ko,ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,ZodInstanceOf:()=>Al,ZodIntersection:()=>Ya,ZodIssueCode:()=>xy,ZodJWT:()=>Wo,ZodKSUID:()=>Mo,ZodLazy:()=>xl,ZodLiteral:()=>il,ZodMAC:()=>Da,ZodMap:()=>nl,ZodNaN:()=>_l,ZodNanoID:()=>Do,ZodNever:()=>Ga,ZodNonOptional:()=>ti,ZodNull:()=>Ka,ZodNullable:()=>al,ZodNumber:()=>jt,ZodNumberFormat:()=>ot,ZodObject:()=>Dr,ZodOptional:()=>Lr,ZodPipe:()=>jr,ZodPrefault:()=>pl,ZodPreprocess:()=>$l,ZodPromise:()=>zl,ZodReadonly:()=>wl,ZodRealError:()=>ie,ZodRecord:()=>Dt,ZodSet:()=>ol,ZodString:()=>Lt,ZodStringFormat:()=>R,ZodSuccess:()=>hl,ZodSymbol:()=>Ma,ZodTemplateLiteral:()=>vl,ZodTransform:()=>ul,ZodTuple:()=>el,ZodType:()=>A,ZodULID:()=>jo,ZodURL:()=>Er,ZodUUID:()=>ye,ZodUndefined:()=>Fa,ZodUnion:()=>Rr,ZodUnknown:()=>Ja,ZodVoid:()=>qa,ZodXID:()=>Vo,ZodXor:()=>Xa,_ZodString:()=>No,_default:()=>fl,_function:()=>_d,any:()=>Wp,array:()=>Tr,base64:()=>Ap,base64url:()=>Op,bigint:()=>Up,boolean:()=>Va,catch:()=>yl,check:()=>$d,cidrv4:()=>Pp,cidrv6:()=>Ip,clone:()=>C,codec:()=>md,coerce:()=>Nl,compile:()=>Hu,config:()=>M,core:()=>ke,creditCard:()=>Np,cuid:()=>$p,cuid2:()=>wp,currencyCode:()=>Lp,custom:()=>wd,date:()=>Hp,decode:()=>Aa,decodeAsync:()=>Za,deepPartial:()=>Ed,describe:()=>bd,discriminatedUnion:()=>nd,e164:()=>Zp,email:()=>ap,emoji:()=>yp,encode:()=>Ia,encodeAsync:()=>Oa,endsWith:()=>zt,enum:()=>Yo,exactOptional:()=>cl,file:()=>ld,flattenError:()=>rr,float32:()=>Vp,float64:()=>Mp,formatError:()=>nr,fromJSONSchema:()=>Zd,function:()=>_d,getDiscriminatedOption:()=>wu,getErrorMap:()=>zy,globalRegistry:()=>G,gt:()=>he,gte:()=>ue,guid:()=>lp,hash:()=>jp,hex:()=>Rp,hostname:()=>Dp,httpUrl:()=>gp,iban:()=>Ep,includes:()=>xt,input:()=>Td,instanceof:()=>xd,int:()=>Oo,int32:()=>Fp,int64:()=>Bp,intersection:()=>Qa,invertCodec:()=>hd,ipv4:()=>kp,ipv6:()=>Sp,iso:()=>Fr,json:()=>zd,jwt:()=>Cp,keyof:()=>Yp,ksuid:()=>xp,lazy:()=>kl,length:()=>Ye,literal:()=>ad,locales:()=>xr,looseObject:()=>td,looseRecord:()=>id,lowercase:()=>bt,lt:()=>me,lte:()=>se,mac:()=>zp,map:()=>sd,maxLength:()=>He,maxSize:()=>Oe,memoizer:()=>br,meta:()=>vd,mime:()=>Pt,minLength:()=>xe,minSize:()=>ge,multipleOf:()=>Ae,nan:()=>dd,nanoid:()=>_p,nativeEnum:()=>cd,negative:()=>$o,never:()=>Ho,nonnegative:()=>bo,nonoptional:()=>ml,nonpositive:()=>wo,normalize:()=>It,null:()=>Ua,nullable:()=>Nr,nullish:()=>fd,number:()=>ja,object:()=>Qp,optional:()=>tt,output:()=>Dd,overwrite:()=>de,parse:()=>ka,parseAsync:()=>za,partialRecord:()=>od,pipe:()=>Zo,positive:()=>_o,prefault:()=>dl,preprocess:()=>Sd,prettifyError:()=>Pi,promise:()=>yd,properties:()=>St,property:()=>vo,readonly:()=>bl,record:()=>rl,refine:()=>Pl,regex:()=>wt,regexes:()=>le,registry:()=>Jn,safeDecode:()=>Ea,safeDecodeAsync:()=>Ta,safeEncode:()=>Na,safeEncodeAsync:()=>Ca,safeParse:()=>Sa,safeParseAsync:()=>Pa,set:()=>ud,setErrorMap:()=>ky,size:()=>Xe,slugify:()=>Nt,startsWith:()=>kt,strictObject:()=>ed,string:()=>Zr,stringFormat:()=>Tp,stringbool:()=>kd,success:()=>pd,superRefine:()=>Il,symbol:()=>Gp,templateLiteral:()=>gd,toJSONSchema:()=>So,toLowerCase:()=>Ot,toUpperCase:()=>Zt,toZod:()=>Gt,transform:()=>Qo,treeifyError:()=>Si,trim:()=>At,tuple:()=>tl,uint32:()=>Kp,uint64:()=>Jp,ulid:()=>bp,undefined:()=>qp,union:()=>Ft,unknown:()=>et,uppercase:()=>vt,url:()=>hp,util:()=>v,uuid:()=>fp,uuidv4:()=>pp,uuidv6:()=>dp,uuidv7:()=>mp,validate:()=>or,validateAsync:()=>ir,void:()=>Xp,withParser:()=>Gn,xid:()=>vp,xor:()=>rd});var ke={};$e(ke,{$ZodAny:()=>pu,$ZodArray:()=>yu,$ZodAsyncError:()=>ne,$ZodBase64:()=>eu,$ZodBase64URL:()=>tu,$ZodBigInt:()=>Tn,$ZodBigIntFormat:()=>cu,$ZodBoolean:()=>hr,$ZodCIDRv4:()=>Ys,$ZodCIDRv6:()=>Qs,$ZodCUID:()=>Vs,$ZodCUID2:()=>Ms,$ZodCatch:()=>Du,$ZodCheck:()=>L,$ZodCheckBigIntFormat:()=>ds,$ZodCheckEndsWith:()=>zs,$ZodCheckGreaterThan:()=>$n,$ZodCheckIncludes:()=>xs,$ZodCheckLengthEquals:()=>$s,$ZodCheckLessThan:()=>_n,$ZodCheckLowerCase:()=>bs,$ZodCheckMaxLength:()=>ys,$ZodCheckMaxSize:()=>ms,$ZodCheckMimeType:()=>Is,$ZodCheckMinLength:()=>_s,$ZodCheckMinSize:()=>hs,$ZodCheckMultipleOf:()=>fs,$ZodCheckNumberFormat:()=>ps,$ZodCheckOverwrite:()=>As,$ZodCheckProperties:()=>Ps,$ZodCheckProperty:()=>Ss,$ZodCheckRegex:()=>ws,$ZodCheckSizeEquals:()=>gs,$ZodCheckStartsWith:()=>ks,$ZodCheckStringFormat:()=>gt,$ZodCheckUpperCase:()=>vs,$ZodCodec:()=>yr,$ZodCreditCard:()=>nu,$ZodCustom:()=>Ku,$ZodCustomStringFormat:()=>su,$ZodCyclicError:()=>Fn,$ZodDate:()=>gu,$ZodDefault:()=>Nu,$ZodDiscriminatedUnion:()=>bu,$ZodE164:()=>ru,$ZodEmail:()=>Cs,$ZodEmoji:()=>Ls,$ZodEncodeError:()=>Ie,$ZodEnum:()=>Su,$ZodError:()=>zi,$ZodExactOptional:()=>Ou,$ZodFile:()=>Iu,$ZodFunction:()=>Mu,$ZodGUID:()=>Ns,$ZodIBAN:()=>ou,$ZodIPv4:()=>Ws,$ZodIPv6:()=>Xs,$ZodISODate:()=>Js,$ZodISODateTime:()=>Bs,$ZodISODuration:()=>qs,$ZodISOTime:()=>Gs,$ZodIntersection:()=>vu,$ZodJWT:()=>iu,$ZodKSUID:()=>Us,$ZodLazy:()=>_r,$ZodLiteral:()=>Pu,$ZodMAC:()=>Hs,$ZodMap:()=>ku,$ZodNaN:()=>Ru,$ZodNanoID:()=>js,$ZodNever:()=>mu,$ZodNonOptional:()=>Cu,$ZodNull:()=>fu,$ZodNullable:()=>Zu,$ZodNumber:()=>Cn,$ZodNumberFormat:()=>uu,$ZodObject:()=>Af,$ZodObjectJIT:()=>_u,$ZodOptional:()=>Rn,$ZodPipe:()=>Ln,$ZodPrefault:()=>Eu,$ZodPreprocess:()=>Lu,$ZodPromise:()=>Fu,$ZodReadonly:()=>ju,$ZodRealError:()=>oe,$ZodRecord:()=>xu,$ZodRegistry:()=>Bn,$ZodSet:()=>zu,$ZodString:()=>Be,$ZodStringFormat:()=>T,$ZodSuccess:()=>Tu,$ZodSymbol:()=>au,$ZodTemplateLiteral:()=>Vu,$ZodTransform:()=>Au,$ZodTuple:()=>Dn,$ZodType:()=>P,$ZodULID:()=>Fs,$ZodURL:()=>Rs,$ZodUUID:()=>Es,$ZodUndefined:()=>lu,$ZodUnion:()=>gr,$ZodUnknown:()=>du,$ZodVoid:()=>hu,$ZodXID:()=>Ks,$ZodXor:()=>$u,$brand:()=>vi,$constructor:()=>h,$input:()=>Gu,$output:()=>Ju,Doc:()=>Ue,INVALID:()=>Y,JSONSchema:()=>sp,JSONSchemaGenerator:()=>Po,NEVER:()=>bi,TimePrecision:()=>oc,URL_BAD_FORMAT:()=>Ts,URL_UNPARSEABLE:()=>lr,ZodCompileAsyncError:()=>pe,ZodCompileUnsupportedError:()=>Z,_any:()=>bc,_array:()=>Ic,_base64:()=>mo,_base64url:()=>ho,_bigint:()=>mc,_boolean:()=>pc,_catch:()=>cy,_check:()=>Uf,_cidrv4:()=>fo,_cidrv6:()=>po,_coercedBigint:()=>hc,_coercedBoolean:()=>dc,_coercedDate:()=>Sc,_coercedNumber:()=>sc,_coercedString:()=>ec,_creditCard:()=>rc,_cuid:()=>oo,_cuid2:()=>io,_custom:()=>Oc,_date:()=>zc,_decode:()=>un,_decodeAsync:()=>an,_default:()=>iy,_discriminatedUnion:()=>Gg,_e164:()=>go,_email:()=>Xn,_emoji:()=>ro,_encode:()=>sn,_encodeAsync:()=>cn,_endsWith:()=>zt,_enum:()=>Qg,_file:()=>Ac,_float32:()=>cc,_float64:()=>ac,_gt:()=>he,_gte:()=>ue,_guid:()=>Hn,_iban:()=>nc,_includes:()=>xt,_int:()=>uc,_int32:()=>lc,_int64:()=>gc,_intersection:()=>qg,_ipv4:()=>ao,_ipv6:()=>lo,_isoDate:()=>Sr,_isoDateTime:()=>zr,_isoDuration:()=>Ir,_isoTime:()=>Pr,_jwt:()=>yo,_ksuid:()=>co,_lazy:()=>py,_length:()=>Ye,_literal:()=>ty,_lowercase:()=>bt,_lt:()=>me,_lte:()=>se,_mac:()=>tc,_map:()=>Hg,_max:()=>se,_maxLength:()=>He,_maxSize:()=>Oe,_mime:()=>Pt,_min:()=>ue,_minLength:()=>xe,_minSize:()=>ge,_multipleOf:()=>Ae,_nan:()=>Pc,_nanoid:()=>no,_nativeEnum:()=>ey,_negative:()=>$o,_never:()=>xc,_nonnegative:()=>bo,_nonoptional:()=>sy,_nonpositive:()=>wo,_normalize:()=>It,_null:()=>wc,_nullable:()=>oy,_number:()=>ic,_optional:()=>ny,_overwrite:()=>de,_parse:()=>pt,_parseAsync:()=>dt,_pipe:()=>ay,_positive:()=>_o,_promise:()=>dy,_properties:()=>St,_property:()=>vo,_readonly:()=>ly,_record:()=>Xg,_refine:()=>Zc,_regex:()=>wt,_safeDecode:()=>fn,_safeDecodeAsync:()=>dn,_safeEncode:()=>ln,_safeEncodeAsync:()=>pn,_safeParse:()=>mt,_safeParseAsync:()=>ht,_set:()=>Yg,_size:()=>Xe,_slugify:()=>Nt,_startsWith:()=>kt,_string:()=>Qu,_stringFormat:()=>Qe,_stringbool:()=>Tc,_success:()=>uy,_superRefine:()=>Nc,_symbol:()=>_c,_templateLiteral:()=>fy,_toLowerCase:()=>Ot,_toUpperCase:()=>Zt,_transform:()=>ry,_trim:()=>At,_tuple:()=>Wg,_uint32:()=>fc,_uint64:()=>yc,_ulid:()=>so,_undefined:()=>$c,_union:()=>Bg,_unknown:()=>vc,_uppercase:()=>vt,_url:()=>kr,_uuid:()=>Yn,_uuidv4:()=>Qn,_uuidv6:()=>eo,_uuidv7:()=>to,_void:()=>kc,_xid:()=>uo,_xor:()=>Jg,base64Charset:()=>An,base64urlCharset:()=>mr,canParseURL:()=>Ds,clone:()=>C,compile:()=>Hu,compileFn:()=>qn,config:()=>M,createStandardJSONSchemaMethod:()=>Et,createToJSONSchemaMethod:()=>Rc,decode:()=>th,decodeAsync:()=>nh,describe:()=>Ec,encode:()=>eh,encodeAsync:()=>rh,extractDefs:()=>Ne,finalize:()=>Ee,flattenError:()=>rr,formatError:()=>nr,getDiscriminatedOption:()=>wu,globalConfig:()=>B,globalRegistry:()=>G,handleUnrepresentable:()=>K,initializeContext:()=>Ze,isBackEdge:()=>Un,isRecursiveSchema:()=>Kn,isValidBase64:()=>dr,isValidBase64URL:()=>On,isValidCIDRv6:()=>In,isValidCreditCard:()=>Zn,isValidIBAN:()=>Nn,isValidIPv6:()=>pr,isValidJWT:()=>En,locales:()=>xr,memoizer:()=>br,mergeValues:()=>yt,meta:()=>Cc,parse:()=>nn,parseAsync:()=>on,parseURLObject:()=>Sf,prettifyError:()=>Pi,process:()=>D,processSchema:()=>D,regexes:()=>le,registry:()=>Jn,safeDecode:()=>ih,safeDecodeAsync:()=>uh,safeEncode:()=>oh,safeEncodeAsync:()=>sh,safeParse:()=>Wm,safeParseAsync:()=>Xm,standardProps:()=>kn,stripTabAndNewline:()=>fr,toDotPath:()=>of,toJSONSchema:()=>So,toZod:()=>Gt,treeifyError:()=>Si,urlHostnameOk:()=>Sn,urlProtocolOk:()=>Pn,util:()=>v,validate:()=>or,validateAsync:()=>ir,validateURL:()=>zn,version:()=>Os,withParser:()=>Gn});var v={};$e(v,{BIGINT_FORMAT_RANGES:()=>Yt,CONSTANT_CATCH:()=>tn,Class:()=>li,NUMBER_FORMAT_RANGES:()=>Ht,aborted:()=>H,allowsEval:()=>di,assert:()=>hm,assertEqual:()=>fm,assertIs:()=>dm,assertNever:()=>mm,assertNotEqual:()=>pm,assignProp:()=>J,attachSchema:()=>en,base64ToUint8Array:()=>Yl,base64urlToUint8Array:()=>Cm,cached:()=>at,captureStackTrace:()=>Hr,cleanEnum:()=>Em,cleanRegex:()=>be,clone:()=>C,cloneDef:()=>_m,codePointLength:()=>Fe,constantCatch:()=>$i,createTransparentProxy:()=>km,defineLazy:()=>fi,defineLazyInternal:()=>O,derived:()=>Lm,esc:()=>X,escapeRegex:()=>ae,explicitlyAborted:()=>gi,extend:()=>Pm,finalizeIssue:()=>re,floatSafeRemainder:()=>qt,getElementAtPath:()=>$m,getEnumValues:()=>ut,getLengthableOrigin:()=>er,getParsedType:()=>xm,getSizableOrigin:()=>Qt,hexToUint8Array:()=>Dm,hide:()=>tr,installLazyProp:()=>Fm,isObject:()=>Me,isPlainObject:()=>ce,issue:()=>ft,joinValues:()=>Wr,jsonStringifyReplacer:()=>ct,members:()=>_i,merge:()=>Am,mergeDefs:()=>fe,normalizeParams:()=>_,nullish:()=>Xr,numKeys:()=>vm,objectClone:()=>gm,omit:()=>Sm,optionalKeys:()=>hi,own:()=>Pe,parsedType:()=>yi,partial:()=>Om,pick:()=>zm,prefixIssues:()=>te,primitiveTypes:()=>mi,promiseAllObject:()=>wm,propertyKeyTypes:()=>Xt,randomString:()=>bm,rawShape:()=>lt,required:()=>Zm,safeExtend:()=>Im,shallowClone:()=>Wt,slugify:()=>pi,stringifyPrimitive:()=>Yr,toZod:()=>Gt,uint8ArrayToBase64:()=>Ql,uint8ArrayToBase64url:()=>Tm,uint8ArrayToHex:()=>Rm,unwrapMessage:()=>st});function fm(e){return e}s(fm,"assertEqual");function pm(e){return e}s(pm,"assertNotEqual");function Gt(){return e=>e}s(Gt,"toZod");function dm(e){}s(dm,"assertIs");function mm(e){throw new Error("Unexpected value in exhaustive check")}s(mm,"assertNever");function hm(e){}s(hm,"assert");function ut(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}s(ut,"getEnumValues");function Wr(e,t="|"){return e.map(r=>Yr(r)).join(t)}s(Wr,"joinValues");function ct(e,t){return typeof t=="bigint"?t.toString():t}s(ct,"jsonStringifyReplacer");var ai=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 at(e){return new ai(e)}s(at,"cached");function Xr(e){return e==null}s(Xr,"nullish");function be(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}s(be,"cleanRegex");function qt(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}s(qt,"floatSafeRemainder");var ql=Symbol("evaluating");function fi(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ql)return n===void 0&&(n=ql,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}s(fi,"defineLazy");function gm(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}s(gm,"objectClone");function J(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}s(J,"assignProp");function lt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}s(lt,"rawShape");function we(e){return lt(e._zod.def)??e._zod.def.shape}s(we,"sourceShape");function Wl(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return J(this,t,n),n},enumerable:!0,configurable:!0})}s(Wl,"deferProp");function Xl(e,t,r){t in e?J(e,t,r):e[t]=r}s(Xl,"putProp");function Ve(e,t,r,n){let o=we(t);for(let i of r){let u=Object.getOwnPropertyDescriptor(o,i);u.enumerable&&(u.get?Wl(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):Xl(e,i,n?n(u.value,i):u.value))}}s(Ve,"mirrorShape");function ym(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Wl(e,r,()=>t[r]):Xl(e,r,n.value))}}s(ym,"mirrorProps");function fe(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}s(fe,"mergeDefs");function _m(e){return fe(e._zod.def)}s(_m,"cloneDef");function $m(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}s($m,"getElementAtPath");function wm(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}s(wm,"promiseAllObject");function bm(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}s(bm,"randomString");function X(e){return JSON.stringify(e)}s(X,"esc");function pi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}s(pi,"slugify");var Hr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Me(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Me,"isObject");var di=at(()=>{if(B.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ce(e){if(Me(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Me(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}s(ce,"isPlainObject");function Wt(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}s(Wt,"shallowClone");function vm(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}s(vm,"numKeys");var xm=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"),Xt=new Set(["string","number","symbol"]),mi=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(ae,"escapeRegex");function C(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}s(C,"clone");function _(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(_,"normalizeParams");function km(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}s(km,"createTransparentProxy");function Yr(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}s(Yr,"stringifyPrimitive");function hi(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}s(hi,"optionalKeys");var Ht={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]},Yt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zm(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return Ve(i,e,Qr(e,t)),C(e,fe(r,{shape:i,checks:[]}))}s(zm,"pick");function Qr(e,t){let r=we(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}s(Qr,"maskedKeys");function Sm(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Qr(e,t)),u={};return Ve(u,e,Reflect.ownKeys(we(e)).filter(c=>!i.has(c))),C(e,fe(r,{shape:u,checks:[]}))}s(Sm,"omit");function Pm(e,t){if(!ce(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=we(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 C(e,fe(e._zod.def,{shape:Hl(e,t)}))}s(Pm,"extend");function Hl(e,t){let r={};return Ve(r,e,Reflect.ownKeys(we(e))),ym(r,t),r}s(Hl,"extended");function Im(e,t){if(!ce(t))throw new Error("Invalid input to safeExtend: expected a plain object");return C(e,fe(e._zod.def,{shape:Hl(e,t)}))}s(Im,"safeExtend");function Am(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Ve(r,e,Reflect.ownKeys(we(e))),Ve(r,t,Reflect.ownKeys(we(t)));let n=fe(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return C(e,n)}s(Am,"merge");function Om(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(Qr(t,r)):void 0,a={};return Ve(a,t,Reflect.ownKeys(we(t)),e&&((l,f)=>c&&!c.has(f)?l:new e({type:"optional",innerType:l}))),C(t,fe(t._zod.def,{shape:a,checks:[]}))}s(Om,"partial");function Zm(e,t,r){let n=r?new Set(Qr(t,r)):void 0,o={};return Ve(o,t,Reflect.ownKeys(we(t)),(i,u)=>n&&!n.has(u)?i:new e({type:"nonoptional",innerType:i})),C(t,fe(t._zod.def,{shape:o}))}s(Zm,"required");function H(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}s(H,"aborted");function gi(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}s(gi,"explicitlyAborted");function te(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}s(te,"prefixIssues");function st(e){return typeof e=="string"?e:e?.message}s(st,"unwrapMessage");function en(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}s(en,"attachSchema");function re(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,u=e.message?e.message:st(e.inst?._zod.def?.error?.(e))??st(i?.(e))??st(t?.error?.(e))??st(r.customError?.(e))??st(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(c[a]=e[a]);return c.path??(c.path=[]),c.message=u,t?.reportInput&&(c.input=e.input),c}s(re,"finalizeIssue");function Qt(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}s(Qt,"getSizableOrigin");var Nm=/[\uD800-\uDBFF]/;function Fe(e){let t=e.length;if(!Nm.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}s(Fe,"codePointLength");function er(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}s(er,"getLengthableOrigin");function yi(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}s(yi,"parsedType");function ft(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}s(ft,"issue");function Em(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}s(Em,"cleanEnum");function Yl(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}s(Yl,"base64ToUint8Array");function Ql(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}s(Ql,"uint8ArrayToBase64");function Cm(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Yl(t+r)}s(Cm,"base64urlToUint8Array");function Tm(e){return Ql(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s(Tm,"uint8ArrayToBase64url");function Dm(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}s(Dm,"hexToUint8Array");function Rm(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}s(Rm,"uint8ArrayToHex");var li=class{static{s(this,"Class")}constructor(...t){}};function _i(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):jm(e,r,n.value)}}s(_i,"members");function Pe(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}s(Pe,"own");function tr(e,t,r){return Pe(e,t,r,!1)}s(tr,"hide");function Lm(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Pe(this,r,n(this))},set(o){Pe(this,r,o)}})}return t}s(Lm,"derived");function jm(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Pe(this,t,r.bind(this))},set(n){Pe(this,t,n)}})}s(jm,"defineBound");function Vm(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}s(Vm,"claim");var ci,Se=!1,Mm={configurable:!0,get(){Se=!0}};function O(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&ci!==e._zod){ci=void 0;return}ci=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Mm);let o=Se;Se=!1;try{let i=r(this);return Se?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Se=Se||o,i}catch(i){throw delete this[t],Se=Se||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}s(O,"defineLazyInternal");function Fm(e,t,r,n){let o=Vm(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}s(Fm,"installLazyProp");var tn="~constantCatch";function $i(e){let t=s(()=>e,"fn");return t[tn]=!0,t}s($i,"constantCatch");var ef,bi=Object.freeze({status:"aborted"}),wi={value:void 0,enumerable:!1},tf="captureStackTrace"in Error?Error:null;function Km(e){let t=tf;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return tf=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}s(Km,"newError");function h(e,t,r,n){let o={};function i(d){this.def=d,this.constr=p,this.traits=new Set}s(i,"Internals"),i.prototype=o;let u=r,c=u&&new WeakSet;function a(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),c){let y=Object.getPrototypeOf(d),$=d._zod.constr.prototype,z=y;for(;z&&z!==$;)z=Object.getPrototypeOf(z);let x=z??y;c.has(x)||(c.add(x),_i(x,u))}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(a,"init");let l=n?.Parent??Object;class f extends l{static{s(this,"Definition")}}Object.defineProperty(f,"name",{value:e});function p(d){let m=n?.Parent?Km(f):this;a(m,d);let g=m._zod.deferred;if(g){for(let $ of g)$();m._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;return y&&y(m),m}return s(p,"_"),Object.defineProperty(p,"init",{value:a}),Object.defineProperty(p,Symbol.hasInstance,{value:s(d=>n?.Parent&&d instanceof n.Parent?!0:d?._zod?.traits?.has(e),"value")}),Object.defineProperty(p,"name",{value:e}),p}s(h,"$constructor");var vi=Symbol("zod_brand"),ne=class extends Error{static{s(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ie=class extends Error{static{s(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(ef=globalThis).__zod_globalConfig??(ef.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function M(e){return e&&Object.assign(B,e),B}s(M,"config");function Um(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ct,2)),e.message}s(Um,"_getMessage");function Bm(e){this._zod.message=e}s(Bm,"_setMessage");var Jm={get:Um,set:Bm,enumerable:!0,configurable:!0},ki={value:void 0,enumerable:!1},rf=new WeakSet([Object.prototype,Error.prototype]),nf=s((e,t)=>{e.name="$ZodError",ki.value=t,Object.defineProperty(e,"issues",ki),ki.value=void 0,Object.defineProperty(e,"message",Jm);let r=Object.getPrototypeOf(e);rf.has(r)||(rf.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=s(()=>this.message,"value");return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},"initializer"),zi=h("$ZodError",nf),oe=h("$ZodError",nf,void 0,{Parent:Error});function Gm(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}s(Gm,"node");function rr(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?Gm(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}s(rr,"flattenError");function nr(e,t=r=>r.message){let r={_errors:[]},n=s((o,i=[])=>{for(let u of o.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(c=>n({issues:c},[...i,...u.path]));else if(u.code==="invalid_key")n({issues:u.issues},[...i,...u.path]);else if(u.code==="invalid_element")n({issues:u.issues},[...i,...u.path]);else{let c=[...i,...u.path];if(c.length===0)r._errors.push(t(u));else{let a=r,l=0;for(;l<c.length;){let f=c[l],p=l===c.length-1;if(f==="_errors"){p&&a._errors.push(t(u)),l++;continue}Object.prototype.hasOwnProperty.call(a,f)||Object.defineProperty(a,f,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=a[f];p&&d._errors.push(t(u)),a=d,l++}}}},"processError");return n(e),r}s(nr,"formatError");function Si(e,t=r=>r.message){let r={errors:[]},n=s((o,i=[])=>{var u;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(a=>n({issues:a},[...i,...c.path]));else if(c.code==="invalid_key")n({issues:c.issues},[...i,...c.path]);else if(c.code==="invalid_element")n({issues:c.issues},[...i,...c.path]);else{let a=[...i,...c.path];if(a.length===0){r.errors.push(t(c));continue}let l=r,f=0;for(;f<a.length;){let p=a[f],d=f===a.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=[]),(u=l.items)[p]??(u[p]={errors:[]}),l=l.items[p]),d&&l.errors.push(t(c)),f++}}},"processError");return n(e),r}s(Si,"treeifyError");function of(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}s(of,"toDotPath");function Pi(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${of(n.path)}`);return t.join(`
|
|
8
|
+
`)}s(Pi,"prettifyError");function rn(e,t){return{callee:t?.callee??e,Err:t?.Err}}s(rn,"finalizeParams");var pt=s(e=>{let t=s((r,n,o,i)=>{let u=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},u);if(c instanceof Promise)throw new ne;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map(l=>re(l,u,M())));throw Hr(a,i?.callee??t),a}return c.value},"fn");return t},"_parse"),nn=pt(oe),dt=s(e=>{let t=s(async(r,n,o,i)=>{let u=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},u);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(i?.Err??e)(c.issues.map(l=>re(l,u,M())));throw Hr(a,i?.callee??t),a}return c.value},"fn");return t},"_parseAsync"),on=dt(oe),mt=s(e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new ne;return i.issues.length?sf(e,i.issues,o):{success:!0,data:i.value}},"_safeParse"),Wm=mt(oe);function sf(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>re(o,r,M()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}s(sf,"failure");var ht=s(e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?sf(e,i.issues,o):{success:!0,data:i.value}},"_safeParseAsync"),Xm=ht(oe),Hm=Symbol.for("zod.compile.invalid"),Ym=Symbol.for("zod.compile.fallback"),or=s(((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Hm)return!0;if(n.definite===!0&&r===void 0)return!1}return Qm(e,t,r)}),"validate");function Qm(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[Ym]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new ne;return i.issues.length===0}s(Qm,"validateFallback");var ir=s(async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},"validateAsync"),sn=s(e=>{let t=pt(e),r=s((n,o,i,u)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,rn(r,u))},"fn");return r},"_encode"),eh=sn(oe),un=s(e=>{let t=pt(e),r=s((n,o,i,u)=>t(n,o,i,rn(r,u)),"fn");return r},"_decode"),th=un(oe),cn=s(e=>{let t=dt(e),r=s(async(n,o,i,u)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,rn(r,u))},"fn");return r},"_encodeAsync"),rh=cn(oe),an=s(e=>{let t=dt(e),r=s(async(n,o,i,u)=>await t(n,o,i,rn(r,u)),"fn");return r},"_decodeAsync"),nh=an(oe),ln=s(e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return mt(e)(t,r,o)},"_safeEncode"),oh=ln(oe),fn=s(e=>(t,r,n)=>mt(e)(t,r,n),"_safeDecode"),ih=fn(oe),pn=s(e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ht(e)(t,r,o)},"_safeEncodeAsync"),sh=pn(oe),dn=s(e=>async(t,r,n)=>ht(e)(t,r,n),"_safeDecodeAsync"),uh=dn(oe);var le={};$e(le,{anyString:()=>es,base64:()=>Bi,base64url:()=>Ji,bigint:()=>rs,boolean:()=>ns,browserEmail:()=>hh,cidrv4:()=>Ki,cidrv6:()=>Ui,creditCard:()=>mn,cuid:()=>Ai,cuid2:()=>Oi,currencyCode:()=>Xi,date:()=>Hi,datetime:()=>Qi,domain:()=>qi,duration:()=>Di,e164:()=>Wi,email:()=>Li,emoji:()=>ji,extendedDuration:()=>ch,guid:()=>Ri,hex:()=>cs,hostname:()=>Gi,html5Email:()=>ph,httpProtocol:()=>sr,iban:()=>hn,idnEmail:()=>mh,integer:()=>ur,ipv4:()=>Vi,ipv6:()=>Mi,ksuid:()=>Ei,lowercase:()=>ss,mac:()=>Fi,md5_base64:()=>$h,md5_base64url:()=>wh,md5_hex:()=>_h,nanoid:()=>Ci,nanoidOfLength:()=>Ti,null:()=>os,number:()=>ve,rfc5322Email:()=>dh,sha1_base64:()=>vh,sha1_base64url:()=>xh,sha1_hex:()=>bh,sha256_base64:()=>zh,sha256_base64url:()=>Sh,sha256_hex:()=>kh,sha384_base64:()=>Ih,sha384_base64url:()=>Ah,sha384_hex:()=>Ph,sha512_base64:()=>Zh,sha512_base64url:()=>Nh,sha512_hex:()=>Oh,string:()=>ts,time:()=>Yi,ulid:()=>Zi,undefined:()=>is,unicodeEmail:()=>uf,uppercase:()=>us,uuid:()=>Ke,uuid4:()=>ah,uuid6:()=>lh,uuid7:()=>fh,xid:()=>Ni});var Ai=/^[cC][0-9a-z]{6,}$/,Oi=/^[0-9a-z]+$/,Zi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ni=/^[0-9a-vA-V]{20}$/,Ei=/^[A-Za-z0-9]{27}$/,Ci=/^[a-zA-Z0-9_-]{21}$/;function Ti(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}s(Ti,"nanoidOfLength");var Di=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ch=/^[-+]?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)?)??$/,Ri=/^([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})$/,Ke=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"),ah=Ke(4),lh=Ke(6),fh=Ke(7),Li=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ph=/^[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])?)*$/,dh=/^(([^<>()\[\]\\.,;:\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,}))$/,uf=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,mh=uf,hh=/^[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])?)*$/,gh="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function ji(){return new RegExp(gh,"u")}s(ji,"emoji");var Vi=/^(?:(?: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])$/,Mi=/^(([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}|:))$/,Fi=s(e=>{let t=ae(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"),Ki=/^((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])$/,Ui=/^(([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])$/,Bi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ji=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Gi=/^(?=.{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])?)*\.?$/,qi=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,sr=/^https?$/,Wi=/^\+[1-9]\d{6,14}$/,mn=/^\d(?:[ -]?\d){11,18}$/,Xi=/^(?: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)$/,hn=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,cf="(?:(?:\\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 yh(e){return new RegExp(`^${e}$`)}s(yh,"anchor");var Hi=yh(cf);function Ii(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(Ii,"timeSource");function Yi(e){return new RegExp(`^${Ii(e)}$`)}s(Yi,"time");function Qi(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Ii({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Ii({precision:e.precision})}`:r;return new RegExp(`^${cf}T(?:${n})$`)}s(Qi,"datetime");var es=/^[\s\S]{0,}$/,ts=s(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),rs=/^-?\d+n?$/,ur=/^-?\d+$/,ve=/^-?\d+(?:\.\d+)?$/,ns=/^(?:true|false)$/i,os=/^null$/i;var is=/^undefined$/i;var ss=/^[^A-Z]*$/,us=/^[^a-z]*$/,cs=/^[0-9a-fA-F]*$/;function cr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}s(cr,"fixedBase64");function ar(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}s(ar,"fixedBase64url");var _h=/^[0-9a-fA-F]{32}$/,$h=cr(22,"=="),wh=ar(22),bh=/^[0-9a-fA-F]{40}$/,vh=cr(27,"="),xh=ar(27),kh=/^[0-9a-fA-F]{64}$/,zh=cr(43,"="),Sh=ar(43),Ph=/^[0-9a-fA-F]{96}$/,Ih=cr(64,""),Ah=ar(64),Oh=/^[0-9a-fA-F]{128}$/,Zh=cr(86,"=="),Nh=ar(86);var L=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),as=s(e=>{let t=e.value;return!Xr(t)&&t.size!==void 0},"_whenHasSize"),ls=s(e=>{let t=e.value;return!Xr(t)&&t.length!==void 0},"_whenHasLength"),gn={number:"number",bigint:"bigint",object:"date"},_n=h("$ZodCheckLessThan",(e,t)=>{L.init(e,t);let r=gn[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:gn[typeof n.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$n=h("$ZodCheckGreaterThan",(e,t)=>{L.init(e,t);let r=gn[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:gn[typeof n.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fs=h("$ZodCheckMultipleOf",(e,t)=>{L.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):qt(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),ps=h("$ZodCheckNumberFormat",(e,t)=>{L.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ht[t.format];e._zod.check=u=>{let c=u.value;if(r){if(!Number.isInteger(c)){u.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?u.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):u.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<o&&u.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&u.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),ds=h("$ZodCheckBigIntFormat",(e,t)=>{L.init(e,t);let[r,n]=Yt[t.format];e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),ms=h("$ZodCheckMaxSize",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=as),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Qt(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),hs=h("$ZodCheckMinSize",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=as),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Qt(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),gs=h("$ZodCheckSizeEquals",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=as),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let u=i>t.size;n.issues.push({origin:Qt(o),...u?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ys=h("$ZodCheckMaxLength",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=ls),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Fe(o):i)<=t.maximum)return;let c=er(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_s=h("$ZodCheckMinLength",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=ls),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Fe(o):i)>=t.minimum)return;let c=er(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$s=h("$ZodCheckLengthEquals",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=ls),e._zod.check=n=>{let o=n.value,i=o.length,u=typeof o=="string"&&i>=t.length&&i<=t.length*2?Fe(o):i;if(u===t.length)return;let c=er(o),a=u>t.length;n.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),gt=h("$ZodCheckStringFormat",(e,t)=>{var r,n;L.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),ws=h("$ZodCheckRegex",(e,t)=>{gt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),bs=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ss),gt.init(e,t)}),vs=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=us),gt.init(e,t)}),xs=h("$ZodCheckIncludes",(e,t)=>{L.init(e,t);let r=ae(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),ks=h("$ZodCheckStartsWith",(e,t)=>{L.init(e,t);let r=new RegExp(`^${ae(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),zs=h("$ZodCheckEndsWith",(e,t)=>{L.init(e,t);let r=new RegExp(`.*${ae(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function yn(e,t,r){e.issues.length&&t.issues.push(...te(r,e.issues))}s(yn,"handleCheckPropertyResult");var Ss=h("$ZodCheckProperty",(e,t)=>{L.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>yn(o,r,t.property));yn(n,r,t.property)}}),Ps=h("$ZodCheckProperties",(e,t)=>{L.init(e,t),tr(e,Symbol.iterator,function*(){yield e});let r;e._zod.check=n=>{if(n.value==null){n.issues.push({expected:"object",code:"invalid_type",input:n.value,inst:e});return}r??(r=Reflect.ownKeys(t.shape).map(u=>[u,t.shape[u]]));let o=n.value,i;for(let[u,c]of r){let a=c._zod.run({value:o[u],issues:[]},{});a instanceof Promise?(i??(i=[]),i.push(a.then(l=>yn(l,n,u)))):yn(a,n,u)}if(i)return Promise.all(i).then(()=>{})}}),Is=h("$ZodCheckMimeType",(e,t)=>{L.init(e,t);let r=new Set(t.mime);e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),As=h("$ZodCheckOverwrite",(e,t)=>{L.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ue=class{static{s(this,"Doc")}constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
9
9
|
`).filter(u=>u),o=Math.min(...n.map(u=>u.length-u.trimStart().length)),i=n.map(u=>u.slice(o)).map(u=>" ".repeat(this.indent*2)+u);for(let u of i)this.content.push(u)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
10
10
|
${r.join(`
|
|
11
11
|
`)}
|
|
12
|
-
};`)(...Object.values(this.closed))}};var Os={major:4,minor:6,patch:5};var P=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Os;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let u of i._zod.onattach)u(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=s((c,a,l)=>{if(c.memo)return c;let f=H(c),p;for(let d of a){if(d._zod.def.when){if(gi(c)||!d._zod.def.when(c))continue}else if(f)continue;let m=c.issues.length,g=d._zod.check(c);if(g instanceof Promise&&l?.async===!1)throw new ne;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,c.issues.length!==m&&(Qr(c.issues,m,e),f||(f=H(c,m)))});else{if(c.issues.length===m)continue;Qr(c.issues,m,e),f||(f=H(c,m))}}return p?p.then(()=>c):c},"runChecks"),u=s((c,a,l)=>{if(H(c))return c.aborted=!0,c;let f=i(a,o,l);if(f instanceof Promise){if(l.async===!1)throw new ne;return f.then(p=>e._zod.parse(p,l))}return e._zod.parse(f,l)},"handleCanaryResult");e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let f=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return f instanceof Promise?f.then(p=>u(p,c,a)):u(f,c,a)}let l=e._zod.parse(c,a);if(l instanceof Promise){if(a.async===!1)throw new ne;return l.then(f=>i(f,o,a))}return i(l,o,a)}}},{get"~standard"(){return tr(this,"~standard",xn(this))},set"~standard"(e){Pe(this,"~standard",e)}}),kf=s((e,t)=>e.issues.length?{issues:e.issues.map(r=>re(r,t,M()))}:{value:e.value},"toStandardResult");async function Eh(e,t){let r={async:!0};return kf(await e._zod.run({value:t,issues:[]},r),r)}s(Eh,"validateAsync");function xn(e){return{validate:s(t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return kf(n,r)}catch{}return Eh(e,t)},"validate"),vendor:"zod",version:1}}s(xn,"standardProps");var Be=h("$ZodString",(e,t)=>{P.init(e,t),e._zod.pattern=t.pattern??es,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),T=h("$ZodStringFormat",(e,t)=>{gt.init(e,t),Be.init(e,t)}),Ns=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ri),T.init(e,t)}),Es=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ke(n))}else t.pattern??(t.pattern=Ke());T.init(e,t)}),Cs=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Li),T.init(e,t)}),Ts=1,lr=2;function Ds(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}s(Ds,"canParseURL");function kn(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Ds(e)||lr:zf(e,t)}s(kn,"validateURL");function zf(e,t){if(!t.normalize&&t.protocol?.source===sr.source&&!/^https?:\/\//i.test(e))return Ts;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??lr}return new URL(e)}catch{return lr}}s(zf,"parseURLObject");var Ch=/[\t\n\r]/g;function fr(e){return e.replace(Ch,"")}s(fr,"stripTabAndNewline");function zn(e,t){return t.lastIndex=0,t.test(e.hostname)}s(zn,"urlHostnameOk");function Sn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}s(Sn,"urlProtocolOk");var Rs=h("$ZodURL",(e,t)=>{T.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=kn(n,t);if(o===Ts){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===lr){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=fr(n);return}t.hostname&&!zn(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!Sn(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:fr(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ls=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ji()),T.init(e,t)}),js=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?Ci:Ti(t.length)),T.init(e,t)}),Vs=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ai),T.init(e,t)}),Ms=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Oi),T.init(e,t)}),Fs=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Zi),T.init(e,t)}),Ks=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ni),T.init(e,t)}),Us=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ei),T.init(e,t)}),Bs=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Qi(t)),T.init(e,t)}),Js=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Hi),T.init(e,t)}),Gs=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Yi(t)),T.init(e,t)}),qs=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Di),T.init(e,t)}),Ws=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Vi),T.init(e,t)}),Th=/^[0-9a-fA-F:.]+$/;function pr(e){return Th.test(e)?Ds(`http://[${e}]`):!1}s(pr,"isValidIPv6");var Xs=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Mi),T.init(e,t),e._zod.check=r=>{pr(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),Hs=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Fi(t.delimiter)),T.init(e,t)}),Ys=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ki),T.init(e,t)});function Pn(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:pr(r)}s(Pn,"isValidCIDRv6");var Qs=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ui),T.init(e,t),e._zod.check=r=>{Pn(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function dr(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}s(dr,"isValidBase64");var In=/^[0-9a-zA-Z+/]*={0,2}$/,eu=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=In),T.init(e,t),e._zod.check=r=>{dr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),mr=/^[A-Za-z0-9_-]*$/;function An(e){if(!mr.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return dr(r)}s(An,"isValidBase64URL");var tu=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=mr),T.init(e,t),e._zod.check=r=>{An(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ru=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Wi),T.init(e,t)}),Dh=/[- ]/g;function Rh(e){let t=e.length,r=1,n=0;for(;t;){let o=e.charCodeAt(--t)-48;r^=1,n+=r?[0,2,4,6,8,1,3,5,7,9][o]:o}return n%10===0}s(Rh,"isLuhnAlgo");function On(e){return dn.test(e)?Rh(e.replace(Dh,"")):!1}s(On,"isValidCreditCard");var nu=h("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=dn),T.init(e,t),e._zod.check=r=>{On(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});function Lh(e){let t=0,r=e.length;for(let n=4;n<r;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let n=0;n<4;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}s(Lh,"isIso7064Mod97");function Zn(e){return mn.test(e)?Lh(e):!1}s(Zn,"isValidIBAN");var ou=h("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=mn),T.init(e,t),e._zod.check=r=>{Zn(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});function Nn(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}s(Nn,"isValidJWT");var iu=h("$ZodJWT",(e,t)=>{T.init(e,t),e._zod.check=r=>{Nn(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),su=h("$ZodCustomStringFormat",(e,t)=>{T.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),En=h("$ZodNumber",(e,t)=>{P.init(e,t),e._zod.pattern=ve,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),uu=h("$ZodNumberFormat",(e,t)=>{ps.init(e,t),En.init(e,t)}),hr=h("$ZodBoolean",(e,t)=>{P.init(e,t),e._zod.pattern=ns,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),Cn=h("$ZodBigInt",(e,t)=>{P.init(e,t),e._zod.pattern=rs,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),cu=h("$ZodBigIntFormat",(e,t)=>{ds.init(e,t),Cn.init(e,t)}),au=h("$ZodSymbol",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),lu=h("$ZodUndefined",(e,t)=>{P.init(e,t),e._zod.pattern=is,e._zod.values=new Set([void 0]),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),fu=h("$ZodNull",(e,t)=>{P.init(e,t),e._zod.pattern=os,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),pu=h("$ZodAny",(e,t)=>{P.init(e,t),e._zod.parse=r=>r}),du=h("$ZodUnknown",(e,t)=>{P.init(e,t),e._zod.parse=r=>r}),mu=h("$ZodNever",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),hu=h("$ZodVoid",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),gu=h("$ZodDate",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function af(e,t,r){e.issues.length&&t.issues.push(...te(r,e.issues)),t.value[r]=e.value}s(af,"handleArrayResult");var yu=h("$ZodArray",(e,t)=>{P.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let u=[],c=o?.abortEarly;for(let a=0;a<i.length;a++){let l=i[a],f=t.element._zod.run({value:l,issues:[]},o);if(f instanceof Promise)u.push(f.then(p=>af(p,n,a)));else if(af(f,n,a),c&&f.issues.length!==0&&H(f))break}return u.length?Promise.all(u).then(()=>n):n}});function vn(e,t,r,n,o,i){let u=r in n,c=i==="optional";if(!(!u&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!u)return;t.issues.push(...te(r,e.issues))}if(!u&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(u||o==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}s(vn,"handlePropertyResult");var jh=[];function Sf(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:jh,o=n.length?[...t,...n]:t;for(let u of o)if(!e.shape?.[u]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(u)}": expected a Zod schema`);let i=hi(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}s(Sf,"normalizeDef");function Pf(e,t,r,n,o,i,u){let c=[],a=o.keySet,l=o.catchall._zod,f=l.def.type,p=l.optin,d=l.optout,m=0;for(let g in t){if(u&&r.issues.length!==m){if(H(r,m))break;m=r.issues.length}if(a.has(g))continue;if(g==="__proto__"){f==="never"&&c.push(g);continue}if(f==="never"){c.push(g);continue}let y=l.run({value:t[g],issues:[]},n);y instanceof Promise?e.push(y.then($=>vn($,r,g,t,p,d))):vn(y,r,g,t,p,d)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}s(Pf,"handleCatchall");var If=h("$ZodObject",(e,t)=>{P.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let l=s(()=>{let f={...n};return Object.defineProperty(t,"shape",{value:f}),l.raw=f,f},"get");l.raw=n,Object.defineProperty(t,"shape",{get:l})}let o=at(()=>Sf(t));O(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=Me,u=t.catchall,c,a=B.memoizer;a?.attach(e),e._zod.parse=(l,f)=>{c??(c=o.value);let p=l.value;if(!i(p))return l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l;l.value=a?a.alloc(e,l,{},f):{};let d=[],m=c.shape,g=f?.abortEarly,y=l.issues.length;for(let $ of c.allKeys){if(g&&l.issues.length!==y){if(H(l,y))break;y=l.issues.length}if($==="__proto__")continue;let z=m[$],x=z._zod.optin,I=z._zod.optout,E=z._zod.run({value:p[$],issues:[]},f);E instanceof Promise?d.push(E.then(j=>vn(j,l,$,p,x,I))):vn(E,l,$,p,x,I)}return u?Pf(d,p,l,f,o.value,e,g===!0):d.length?Promise.all(d).then(()=>l):l}}),_u=h("$ZodObjectJIT",(e,t)=>{If.init(e,t);let r=e._zod.parse,n=at(()=>Sf(t)),o=B.memoizer,i=s(m=>{let g=n.value,y=g.symbolKeys,$=new Ue(["payload","ctx"],{shape:m,inst:e,memo:o,syms:y}),z=s(j=>`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`,"parseStr"),x=s((j,N)=>`
|
|
12
|
+
};`)(...Object.values(this.closed))}};var Os={major:4,minor:6,patch:5};var P=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Os;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let u of i._zod.onattach)u(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=s((c,a,l)=>{if(c.memo)return c;let f=H(c),p;for(let d of a){if(d._zod.def.when){if(gi(c)||!d._zod.def.when(c))continue}else if(f)continue;let m=c.issues.length,g=d._zod.check(c);if(g instanceof Promise&&l?.async===!1)throw new ne;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,c.issues.length!==m&&(en(c.issues,m,e),f||(f=H(c,m)))});else{if(c.issues.length===m)continue;en(c.issues,m,e),f||(f=H(c,m))}}return p?p.then(()=>c):c},"runChecks"),u=s((c,a,l)=>{if(H(c))return c.aborted=!0,c;let f=i(a,o,l);if(f instanceof Promise){if(l.async===!1)throw new ne;return f.then(p=>e._zod.parse(p,l))}return e._zod.parse(f,l)},"handleCanaryResult");e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let f=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return f instanceof Promise?f.then(p=>u(p,c,a)):u(f,c,a)}let l=e._zod.parse(c,a);if(l instanceof Promise){if(a.async===!1)throw new ne;return l.then(f=>i(f,o,a))}return i(l,o,a)}}},{get"~standard"(){return tr(this,"~standard",kn(this))},set"~standard"(e){Pe(this,"~standard",e)}}),zf=s((e,t)=>e.issues.length?{issues:e.issues.map(r=>re(r,t,M()))}:{value:e.value},"toStandardResult");async function Eh(e,t){let r={async:!0};return zf(await e._zod.run({value:t,issues:[]},r),r)}s(Eh,"validateAsync");function kn(e){return{validate:s(t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return zf(n,r)}catch{}return Eh(e,t)},"validate"),vendor:"zod",version:1}}s(kn,"standardProps");var Be=h("$ZodString",(e,t)=>{P.init(e,t),e._zod.pattern=t.pattern??es,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),T=h("$ZodStringFormat",(e,t)=>{gt.init(e,t),Be.init(e,t)}),Ns=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ri),T.init(e,t)}),Es=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ke(n))}else t.pattern??(t.pattern=Ke());T.init(e,t)}),Cs=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Li),T.init(e,t)}),Ts=1,lr=2;function Ds(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}s(Ds,"canParseURL");function zn(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Ds(e)||lr:Sf(e,t)}s(zn,"validateURL");function Sf(e,t){if(!t.normalize&&t.protocol?.source===sr.source&&!/^https?:\/\//i.test(e))return Ts;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??lr}return new URL(e)}catch{return lr}}s(Sf,"parseURLObject");var Ch=/[\t\n\r]/g;function fr(e){return e.replace(Ch,"")}s(fr,"stripTabAndNewline");function Sn(e,t){return t.lastIndex=0,t.test(e.hostname)}s(Sn,"urlHostnameOk");function Pn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}s(Pn,"urlProtocolOk");var Rs=h("$ZodURL",(e,t)=>{T.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=zn(n,t);if(o===Ts){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===lr){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=fr(n);return}t.hostname&&!Sn(o,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!Pn(o,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?o.href:fr(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ls=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ji()),T.init(e,t)}),js=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?Ci:Ti(t.length)),T.init(e,t)}),Vs=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ai),T.init(e,t)}),Ms=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Oi),T.init(e,t)}),Fs=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Zi),T.init(e,t)}),Ks=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ni),T.init(e,t)}),Us=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ei),T.init(e,t)}),Bs=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Qi(t)),T.init(e,t)}),Js=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Hi),T.init(e,t)}),Gs=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Yi(t)),T.init(e,t)}),qs=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Di),T.init(e,t)}),Ws=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Vi),T.init(e,t)}),Th=/^[0-9a-fA-F:.]+$/;function pr(e){return Th.test(e)?Ds(`http://[${e}]`):!1}s(pr,"isValidIPv6");var Xs=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Mi),T.init(e,t),e._zod.check=r=>{pr(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),Hs=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Fi(t.delimiter)),T.init(e,t)}),Ys=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ki),T.init(e,t)});function In(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:pr(r)}s(In,"isValidCIDRv6");var Qs=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ui),T.init(e,t),e._zod.check=r=>{In(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function dr(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}s(dr,"isValidBase64");var An=/^[0-9a-zA-Z+/]*={0,2}$/,eu=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=An),T.init(e,t),e._zod.check=r=>{dr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),mr=/^[A-Za-z0-9_-]*$/;function On(e){if(!mr.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return dr(r)}s(On,"isValidBase64URL");var tu=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=mr),T.init(e,t),e._zod.check=r=>{On(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ru=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Wi),T.init(e,t)}),Dh=/[- ]/g;function Rh(e){let t=e.length,r=1,n=0;for(;t;){let o=e.charCodeAt(--t)-48;r^=1,n+=r?[0,2,4,6,8,1,3,5,7,9][o]:o}return n%10===0}s(Rh,"isLuhnAlgo");function Zn(e){return mn.test(e)?Rh(e.replace(Dh,"")):!1}s(Zn,"isValidCreditCard");var nu=h("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=mn),T.init(e,t),e._zod.check=r=>{Zn(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});function Lh(e){let t=0,r=e.length;for(let n=4;n<r;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let n=0;n<4;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}s(Lh,"isIso7064Mod97");function Nn(e){return hn.test(e)?Lh(e):!1}s(Nn,"isValidIBAN");var ou=h("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=hn),T.init(e,t),e._zod.check=r=>{Nn(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});function En(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}s(En,"isValidJWT");var iu=h("$ZodJWT",(e,t)=>{T.init(e,t),e._zod.check=r=>{En(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),su=h("$ZodCustomStringFormat",(e,t)=>{T.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Cn=h("$ZodNumber",(e,t)=>{P.init(e,t),e._zod.pattern=ve,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),uu=h("$ZodNumberFormat",(e,t)=>{ps.init(e,t),Cn.init(e,t)}),hr=h("$ZodBoolean",(e,t)=>{P.init(e,t),e._zod.pattern=ns,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),Tn=h("$ZodBigInt",(e,t)=>{P.init(e,t),e._zod.pattern=rs,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),cu=h("$ZodBigIntFormat",(e,t)=>{ds.init(e,t),Tn.init(e,t)}),au=h("$ZodSymbol",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),lu=h("$ZodUndefined",(e,t)=>{P.init(e,t),e._zod.pattern=is,e._zod.values=new Set([void 0]),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),fu=h("$ZodNull",(e,t)=>{P.init(e,t),e._zod.pattern=os,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),pu=h("$ZodAny",(e,t)=>{P.init(e,t),e._zod.parse=r=>r}),du=h("$ZodUnknown",(e,t)=>{P.init(e,t),e._zod.parse=r=>r}),mu=h("$ZodNever",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),hu=h("$ZodVoid",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),gu=h("$ZodDate",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function lf(e,t,r){e.issues.length&&t.issues.push(...te(r,e.issues)),t.value[r]=e.value}s(lf,"handleArrayResult");var yu=h("$ZodArray",(e,t)=>{P.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let u=[],c=o?.abortEarly;for(let a=0;a<i.length;a++){let l=i[a],f=t.element._zod.run({value:l,issues:[]},o);if(f instanceof Promise)u.push(f.then(p=>lf(p,n,a)));else if(lf(f,n,a),c&&f.issues.length!==0&&H(f))break}return u.length?Promise.all(u).then(()=>n):n}});function xn(e,t,r,n,o,i){let u=r in n,c=i==="optional";if(!(!u&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!u)return;t.issues.push(...te(r,e.issues))}if(!u&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(u||o==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}s(xn,"handlePropertyResult");var jh=[];function Pf(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:jh,o=n.length?[...t,...n]:t;for(let u of o)if(!e.shape?.[u]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(u)}": expected a Zod schema`);let i=hi(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}s(Pf,"normalizeDef");function If(e,t,r,n,o,i,u){let c=[],a=o.keySet,l=o.catchall._zod,f=l.def.type,p=l.optin,d=l.optout,m=0;for(let g in t){if(u&&r.issues.length!==m){if(H(r,m))break;m=r.issues.length}if(a.has(g))continue;if(g==="__proto__"){f==="never"&&c.push(g);continue}if(f==="never"){c.push(g);continue}let y=l.run({value:t[g],issues:[]},n);y instanceof Promise?e.push(y.then($=>xn($,r,g,t,p,d))):xn(y,r,g,t,p,d)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}s(If,"handleCatchall");var Af=h("$ZodObject",(e,t)=>{P.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let l=s(()=>{let f={...n};return Object.defineProperty(t,"shape",{value:f}),l.raw=f,f},"get");l.raw=n,Object.defineProperty(t,"shape",{get:l})}let o=at(()=>Pf(t));O(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=Me,u=t.catchall,c,a=B.memoizer;a?.attach(e),e._zod.parse=(l,f)=>{c??(c=o.value);let p=l.value;if(!i(p))return l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l;l.value=a?a.alloc(e,l,{},f):{};let d=[],m=c.shape,g=f?.abortEarly,y=l.issues.length;for(let $ of c.allKeys){if(g&&l.issues.length!==y){if(H(l,y))break;y=l.issues.length}if($==="__proto__")continue;let z=m[$],x=z._zod.optin,I=z._zod.optout,E=z._zod.run({value:p[$],issues:[]},f);E instanceof Promise?d.push(E.then(j=>xn(j,l,$,p,x,I))):xn(E,l,$,p,x,I)}return u?If(d,p,l,f,o.value,e,g===!0):d.length?Promise.all(d).then(()=>l):l}}),_u=h("$ZodObjectJIT",(e,t)=>{Af.init(e,t);let r=e._zod.parse,n=at(()=>Pf(t)),o=B.memoizer,i=s(m=>{let g=n.value,y=g.symbolKeys,$=new Ue(["payload","ctx"],{shape:m,inst:e,memo:o,syms:y}),z=s(j=>`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`,"parseStr"),x=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,7 +20,7 @@ ${r.join(`
|
|
|
20
20
|
if (${j}_ab && ctx && ctx.abortEarly) {
|
|
21
21
|
payload.value = newResult;
|
|
22
22
|
return payload;
|
|
23
|
-
}`,"prefixStr");$.write("const input = payload.value;");let I=Object.create(null),E=0;for(let j of g.allKeys)I[j]=`key_${E++}`;$.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let j of g.allKeys){if(j==="__proto__")continue;let N=I[j],q=typeof j=="symbol"?`syms[${y.indexOf(j)}]`:X(j),Jt=`${q} in input`,
|
|
23
|
+
}`,"prefixStr");$.write("const input = payload.value;");let I=Object.create(null),E=0;for(let j of g.allKeys)I[j]=`key_${E++}`;$.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let j of g.allKeys){if(j==="__proto__")continue;let N=I[j],q=typeof j=="symbol"?`syms[${y.indexOf(j)}]`:X(j),Jt=`${q} in input`,Bl=m[j],ui=Bl?._zod?.optin,Jl=ui!==void 0,am=Bl?._zod?.optout==="optional";if($.write(`const ${N} = ${z(q)};`),Jl&&am){let lm=ui==="optional"?`${N}_present`:`${N}.value !== undefined || ${N}_present`;$.write(`
|
|
24
24
|
const ${N}_present = ${Jt};
|
|
25
25
|
if (!${N}.issues.length || ${N}_present) {
|
|
26
26
|
if (${N}.issues.length) {${x(N,q)}
|
|
@@ -31,7 +31,7 @@ ${r.join(`
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
`)}else
|
|
34
|
+
`)}else Jl?($.write(`
|
|
35
35
|
if (${N}.issues.length) {${x(N,q)}
|
|
36
36
|
}
|
|
37
37
|
`),ui==="defaulted"?$.write(`newResult[${q}] = ${N}.value;`):$.write(`
|
|
@@ -59,13 +59,13 @@ ${r.join(`
|
|
|
59
59
|
newResult[${q}] = ${N}.value;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
`)}return $.write("payload.value = newResult;"),$.write("return payload;"),$.compile()},"generateFastpass"),u,c=Me,a=!B.jitless,f=a&&di.value,p=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=n.value);let y=m.value;return c(y)?a&&f&&g?.async===!1&&g.jitless!==!0?(u||(u=i(t.shape)),m=u(m,g),p?Pf([],y,m,g,d,e,g?.abortEarly===!0):m):r(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function lf(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!H(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(u=>re(u,n,M())))}),t)}s(lf,"handleUnionResults");var gr=h("$ZodUnion",(e,t)=>{P.init(e,t),O(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),O(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),O(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),O(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>be(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,u=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)u.push(a),i=!0;else{if(a.issues.length===0)return a;u.push(a)}}return i?Promise.all(u).then(c=>lf(c,n,e,o)):lf(u,n,e,o)}});function ff(e,t,r,n){let o=[];for(let i=0;i<e.length;i++)e[i].issues.length===0&&o.push(i);return o.length===1?(t.value=e[o[0]].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(u=>re(u,n,M())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:o}),t)}s(ff,"handleExclusiveUnionResults");var $u=h("$ZodXor",(e,t)=>{gr.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,u=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);a instanceof Promise?(u.push(a),i=!0):u.push(a)}return i?Promise.all(u).then(c=>ff(c,n,e,o)):ff(u,n,e,o)}});function wu(e,t){let r=e._zod,n=r.bag.optionsMap;n||(n=Af(r.def),r.bag.optionsMap=n);let o=n.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}s(wu,"getDiscriminatedOption");function Af(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}s(Af,"discriminatorMap");var bu=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,gr.init(e,t);let r=e._zod.parse;O(e,"propValues",o=>{let i={},u=0;for(let c of o.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);a[o.def.discriminator]?.has(void 0)&&u++;for(let[l,f]of Object.entries(a)){Object.prototype.hasOwnProperty.call(i,l)||J(i,l,new Set);for(let p of f)i[l].add(p)}}return!o.def.unionFallback&&u>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let u=lt(o._zod.def);if(u&&!Object.prototype.hasOwnProperty.call(u,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=at(()=>Af(t));e._zod.parse=(o,i)=>{let u=o.value;if(!Me(u))return o.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),o;let c=u?.[t.discriminator],a=n.value.get(c);return a&&(c!==void 0||i.direction!=="backward")?a._zod.run(o,i):t.unionFallback||i.direction==="backward"?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(l=>n.value.get(l)!==null),input:u,path:[t.discriminator],inst:e}),o)}}),vu=h("$ZodIntersection",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),u=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||u instanceof Promise?Promise.all([i,u]).then(([a,l])=>pf(r,a,l)):pf(r,i,u)}});function yt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ce(e)&&ce(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let u=yt(e[i],t[i]);if(!u.valid)return{valid:!1,mergeErrorPath:[i,...u.mergeErrorPath]};o[i]=u.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],u=yt(o,i);if(!u.valid)return{valid:!1,mergeErrorPath:[n,...u.mergeErrorPath]};r.push(u.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}s(yt,"mergeValues");function pf(e,t,r){let n=new Map,o,i=new Map,u=s((l,f)=>{let p;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),p=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let d=String(l.path[0]);i.has(d)||i.set(d,l),p=[d]}else return!1;for(let d of p)n.has(d)||n.set(d,{}),n.get(d)[f]=!0;return!0},"collect");for(let l of t.issues)u(l,"l")||e.issues.push(l);for(let l of r.issues)u(l,"r")||e.issues.push(l);let c=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(c.length){let l=o?c.filter(f=>o.keys.includes(f)):[];l.length&&e.issues.push({...o,keys:l});for(let f of c)!l.includes(f)&&i.has(f)&&e.issues.push(i.get(f))}let a=yt(t.value,r.value);if(!a.valid){if(H(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}s(pf,"handleIntersectionResults");var Tn=h("$ZodTuple",(e,t)=>{P.init(e,t);let r=t.items,n=B.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let u=o.value;if(!Array.isArray(u))return o.issues.push({input:u,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],a=df(r,"optin"),l=df(r,"optout");if(!t.rest){if(u.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:u,inst:e,origin:"array"}),o;u.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:u,inst:e,origin:"array"})}let f=new Array(r.length),p=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<r.length;m++){let g=r[m]._zod.run({value:u[m],issues:[]},i);g instanceof Promise?c.push(g.then(y=>{f[m]=y})):(f[m]=g,p&&!d&&g.issues.length&&(d=H(g)))}if(t.rest&&!d){let m=r.length-1,g=u.slice(r.length),y=o.issues.length;for(let $ of g){if(p&&o.issues.length!==y){if(H(o,y))break;y=o.issues.length}m++;let z=t.rest._zod.run({value:$,issues:[]},i);z instanceof Promise?c.push(z.then(x=>mf(x,o,m))):mf(z,o,m)}}return c.length?Promise.all(c).then(()=>hf(f,o,r,u,l)):hf(f,o,r,u,l)}});function df(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}s(df,"getTupleOptStart");function mf(e,t,r){e.issues.length&&t.issues.push(...te(r,e.issues)),t.value[r]=e.value}s(mf,"handleTupleResult");function hf(e,t,r,n,o){for(let i=0;i<r.length;i++){let u=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(u.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...te(i,u.issues))}t.value[i]=u.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}s(hf,"handleTupleResults");var xu=h("$ZodRecord",(e,t)=>{P.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!ce(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let u=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let f of c)if(typeof f=="string"||typeof f=="number"||typeof f=="symbol"){if(a.add(typeof f=="number"?f.toString():f),f==="__proto__")continue;let p=t.keyType._zod.run({value:f,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(g=>re(g,o,M())),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?u.push(m.then(g=>{g.issues.length&&n.issues.push(...te(f,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...te(f,m.issues)),n.value[d]=m.value)}let l;for(let f in i)if(!a.has(f))if(t.mode==="loose"){if(f==="__proto__")continue;n.value[f]=i[f]}else l=l??[],l.push(f);l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let a;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"&&ve.test(l)&&f.issues.length){let g=t.keyType._zod.run({value:Number(l),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(f=g)}if(f.issues.length){t.mode==="loose"?n.value[l]=i[l]:c?(a=a??[],a.push(l)):n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>re(g,o,M())),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?u.push(m.then(g=>{g.issues.length&&n.issues.push(...te(l,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...te(l,m.issues)),n.value[d]=m.value)}a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}return u.length?Promise.all(u).then(()=>n):n}}),ku=h("$ZodMap",(e,t)=>{P.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),n;let u=[];n.value=r?r.alloc(e,n,new Map,o):new Map;let c=o?.abortEarly,a=n.issues.length;for(let[l,f]of i){if(c&&n.issues.length!==a){if(H(n,a))break;a=n.issues.length}let p=t.keyType._zod.run({value:l,issues:[]},o),d=t.valueType._zod.run({value:f,issues:[]},o);p instanceof Promise||d instanceof Promise?u.push(Promise.all([p,d]).then(([m,g])=>{gf(m,g,n,l,i,e,o)})):gf(p,d,n,l,i,e,o)}return u.length?Promise.all(u).then(()=>n):n}});function gf(e,t,r,n,o,i,u){e.issues.length&&(Xt.has(typeof n)?r.issues.push(...te(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(c=>re(c,u,M()))})),t.issues.length&&(Xt.has(typeof n)?r.issues.push(...te(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(c=>re(c,u,M()))})),r.value.set(e.value,t.value)}s(gf,"handleMapResult");var zu=h("$ZodSet",(e,t)=>{P.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),n;let u=[];n.value=r?r.alloc(e,n,new Set,o):new Set;let c=o?.abortEarly,a=n.issues.length;for(let l of i){if(c&&n.issues.length!==a){if(H(n,a))break;a=n.issues.length}let f=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise?u.push(f.then(p=>yf(p,n))):yf(f,n)}return u.length?Promise.all(u).then(()=>n):n}});function yf(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}s(yf,"handleSetResult");var Su=h("$ZodEnum",(e,t)=>{P.init(e,t);let r=ut(t.entries),n=new Set(r);e._zod.values=n,O(e,"pattern",o=>{let i=ut(o.def.entries).filter(u=>Xt.has(typeof u));return new RegExp(i.length?`^(${i.map(u=>ae(u.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let u=o.value;return n.has(u)||o.issues.push({code:"invalid_value",values:r,input:u,inst:e}),o}}),Pu=h("$ZodLiteral",(e,t)=>{P.init(e,t);let r=new Set(t.values);e._zod.values=r,O(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?ae(i):i?ae(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),Iu=h("$ZodFile",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),Au=h("$ZodTransform",(e,t)=>{P.init(e,t),e._zod.optin="optional",B.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(r.value=u,r));if(o instanceof Promise)throw new ne;return r.value=o,r}});function _f(e,t){return e.value=t.issues.length?void 0:t.value,e}s(_f,"handleOptionalResult");var Dn=h("$ZodOptional",(e,t)=>{P.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",O(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),O(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${be(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>_f(r,i)):_f(r,o)}return t.innerType._zod.run(r,n)}}),Ou=h("$ZodExactOptional",(e,t)=>{Dn.init(e,t),O(e,"values",r=>r.def.innerType._zod.values),O(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Zu=h("$ZodNullable",(e,t)=>{P.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin),O(e,"optout",r=>r.def.innerType._zod.optout),O(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${be(n.source)}|null)$`):void 0}),O(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Nu=h("$ZodDefault",(e,t)=>{P.init(e,t),e._zod.optin="defaulted",O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>$f(i,t)):$f(o,t)}});function $f(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}s($f,"handleDefaultResult");var Eu=h("$ZodPrefault",(e,t)=>{P.init(e,t),e._zod.optin="defaulted",O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Cu=h("$ZodNonOptional",(e,t)=>{P.init(e,t),O(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>wf(i,e)):wf(o,e)}});function wf(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(wf,"handleNonOptionalResult");var Tu=h("$ZodSuccess",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}});function bf(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>re(o,n,M()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}s(bf,"handleCatchResult");var Du=h("$ZodCatch",(e,t)=>{P.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),O(e,"optout",r=>r.def.innerType._zod.optout),O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>bf(r,i,t,n)):bf(r,o,t,n)}}),Ru=h("$ZodNaN",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Rn=h("$ZodPipe",(e,t)=>{P.init(e,t),O(e,"values",r=>r.def.in._zod.values),O(e,"optin",r=>r.def.in._zod.optin),O(e,"optout",r=>r.def.out._zod.optout),O(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(u=>$n(u,t.in,n)):$n(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>$n(i,t.out,n)):$n(o,t.out,n)}});function $n(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}s($n,"handlePipeResult");var yr=h("$ZodCodec",(e,t)=>{P.init(e,t),O(e,"values",r=>r.def.in._zod.values),O(e,"optin",r=>r.def.in._zod.optin),O(e,"optout",r=>r.def.out._zod.optout),O(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(u=>wn(u,t,n)):wn(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(u=>wn(u,t,n)):wn(i,t,n)}}});function wn(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>bn(e,i,t.out,r)):bn(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>bn(e,i,t.in,r)):bn(e,o,t.in,r)}}s(wn,"handleCodecAResult");function bn(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}s(bn,"handleCodecTxResult");var Lu=h("$ZodPreprocess",(e,t)=>{Rn.init(e,t)}),ju=h("$ZodReadonly",(e,t)=>{P.init(e,t),O(e,"propValues",r=>r.def.innerType._zod.propValues),O(e,"values",r=>r.def.innerType._zod.values),O(e,"optin",r=>r.def.innerType?._zod?.optin),O(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(vf):vf(o)}});function vf(e){return e.memo||(e.value=Object.freeze(e.value)),e}s(vf,"handleReadonlyResult");function Vh(e){let t=e._zod.def,r=t.pattern,n=!!t.format?.includes("int"),o,i;for(let c of t.checks??[]){let a=c._zod.def;a.pattern&&(r=a.pattern),n||(n=!!a.format?.includes("int"));let l=a.minimum??a.length,f=a.maximum??a.length;l!==void 0&&(o===void 0||l>o)&&(o=l),f!==void 0&&(i===void 0||f<i)&&(i=f)}if(r)return r.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return ts({minimum:o,maximum:i}).source;let u=e._zod.pattern;return(n&&u===ve?ur:u)?.source}s(Vh,"leafPattern");function Zs(e){let t=e._zod.def,r=e._zod.pattern?.source,n=t.innerType??e._zod.innerType;if(n){let o=n._zod.pattern?.source,i=Zs(n);return r&&o&&i&&i!==o?r.replace(be(o),()=>be(i)):r}if(t.options){let o=t.options.map(Zs);if(o.every(Boolean))return`^(${o.map(i=>be(i)).join("|")})$`}return Vh(e)}s(Zs,"partPattern");var Vu=h("$ZodTemplateLiteral",(e,t)=>{P.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){let o=Zs(n);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);r.push(be(o))}else if(n===null||mi.has(typeof n))r.push(ae(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Mu=h("$ZodFunction",(e,t)=>(P.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?rn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?rn(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await nn(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await nn(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Tn({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Fu=h("$ZodPromise",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),_r=h("$ZodLazy",(e,t)=>{P.init(e,t),fi(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),O(e,"pattern",r=>r.innerType?._zod?.pattern),O(e,"propValues",r=>r.innerType?._zod?.propValues),O(e,"optin",r=>r.innerType?._zod?.optin??void 0),O(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Ku=h("$ZodCustom",(e,t)=>{L.init(e,t),P.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>xf(i,r,n,e));xf(o,r,n,e)}});function xf(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(ft(o))}}s(xf,"handleRefineResult");var Mn=class extends Error{static{s(this,"$ZodCyclicError")}constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Bu="~memo",Zf=[];function Nf(e){return e!==null&&typeof e=="object"}s(Nf,"isRef");function Uu(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}s(Uu,"cloneIssues");var Ef=new WeakMap,_t=0,Vn=1,$r=2;function wr(e,t,r){let n=Ef.get(e);if(n!==void 0)return n?$r:_t;if(t.has(e))return $r;t.add(e);let o=_t,i=s(f=>{if(o!==$r&&f?._zod){let p=wr(f,t,r);p>o&&(o=p)}},"check"),u=s((f,p)=>{let d=_t;for(let m of Reflect.ownKeys(f)){let g=Object.getOwnPropertyDescriptor(f,m);if(p&&!g.enumerable)continue;let y=g.get?Vn:g.value?._zod?wr(g.value,t,r):_t;y>d&&(d=y)}return d},"shape"),c=s(f=>{f>o&&(o=f)},"merge"),a=e._zod.def,l=a.type;switch(l){case"object":{let f=lt(a);c(f?u(f,!0):Vn),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let f of a.items)i(f);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let f of a.options)i(f);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let f=a._cachedInner??(r?e._zod.innerType:void 0);c(f?wr(f,t,!1):Vn);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 a){let p=Object.getOwnPropertyDescriptor(a,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),Mh(e,o)}s(wr,"isRecursive");function Mh(e,t){return t!==Vn&&Ef.set(e,t===$r),t}s(Mh,"settle");function Fn(e){return wr(e,new Set,!0)!==_t}s(Fn,"isRecursiveSchema");function Fh(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}s(Fh,"bucketFor");var Ln,jn=[],Kh={alloc(e,t,r){let n=Ln;if(!n)return r;Ln=void 0;let o={value:r,issues:null};return n.set(t.value,o),jn.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=s((o,i)=>{if(i.direction!=="backward"&&Kn(i,o.value))throw new Mn;return r(o,i)},"wrapped");e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let u=e._zod.parse,c=s((a,l)=>{if(r===void 0){let z=wr(e,new Set,!1);if(z===_t)return e._zod.parse=u,e._zod.run===c&&(e._zod.run=u),u(a,l);z===$r||n?r=!0:n=!0}let f=a.value;if(!Nf(f))return u(a,l);let p=l[Bu];p||(p={buckets:new WeakMap,backEdges:void 0},l[Bu]=p);let d;o===l?d=i:(d=Fh(p,e),o=l,i=d);let m=d.get(f);if(m)return a.value=m.value,m.issues?m.issues.length&&a.issues.push(...Uu(m.issues)):(a.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(m.value)),a;Ln=d;let g=jn.length,y=u(a,l);Ln=void 0;let $=jn.length>g?jn.pop():void 0;return y instanceof Promise?y.then(z=>($&&($.issues=z.issues.length?Uu(z.issues):Zf),z)):($&&($.issues=y.issues.length?Uu(y.issues):Zf),y)},"wrapped");e._zod.parse=c,e._zod.run===u&&(e._zod.run=c)})}};function br(){return Kh}s(br,"memoizer");function Kn(e,t){let r=e[Bu]?.backEdges;return r!==void 0&&Nf(t)&&r.has(t)}s(Kn,"isBackEdge");var xr={};$e(xr,{en:()=>vr});var Uh=s(()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}s(t,"getSizing");let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,u){return i==="number"&&typeof u=="number"&&!Number.isFinite(u)?String(u):n[i]??i}return s(o,"getTypeName"),i=>{switch(i.code){case"invalid_type":{let u=o(i.expected),c=yi(i.input),a=o(c,i.input);return`Invalid input: expected ${u}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Hr(i.values[0])}`:`Invalid option: expected one of ${qr(i.values,"|")}`;case"too_big":{let u=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${u}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${u}${i.maximum.toString()}`}case"too_small":{let u=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${u}${i.minimum.toString()} ${c.unit}`:`Too small: expected ${i.origin} to be ${u}${i.minimum.toString()}`}case"invalid_format":{let u=i;return u.format==="starts_with"?`Invalid string: must start with "${u.prefix}"`:u.format==="ends_with"?`Invalid string: must end with "${u.suffix}"`:u.format==="includes"?`Invalid string: must include "${u.includes}"`:u.format==="regex"?`Invalid string: must match pattern ${u.pattern}`:`Invalid ${r[u.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":""}: ${qr(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(c=>`'${c}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}},"error");function vr(){return{localeError:Uh()}}s(vr,"default");var Cf,Ju=Symbol("ZodOutput"),Gu=Symbol("ZodInput"),Un=class{static{s(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Bn(){return new Un}s(Bn,"registry");(Cf=globalThis).__zod_globalRegistry??(Cf.__zod_globalRegistry=Bn());var G=globalThis.__zod_globalRegistry;var Y=Symbol.for("zod.compile.invalid"),Tf=Symbol.for("zod.compile.fallback"),pe=class extends Error{static{s(this,"ZodCompileAsyncError")}constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},Z=class extends Error{static{s(this,"ZodCompileUnsupportedError")}constructor(t,r=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=r}};function Jh(e,t){try{return Gn(e,{assertOnly:!0})}catch{return t}}s(Jh,"compileValidator");function Hu(e,t){try{let r=Gn(e),n=Jn(e,r);return n._zod.bag.validator=Jh(e,r),n}catch(r){if(t?.strict)throw r;return e}}s(Hu,"compile");function Jn(e,t){if(Fn(e))throw new Z("a schema whose subtree contains a reference cycle");let r=C(e),n=e._zod.run,o=n.__originalRun??n,i=s((u,c)=>{if(c?.async||c?.direction==="backward"||c?.skipChecks||c?.[Tf]||c&&Kn(c,u.value))return o(u,c);let a=t(u.value);return a!==Y?(u.value=a,u):(c&&(c[Tf]=!0),o(u,c))},"wrapped");return i.__originalRun=o,r._zod.bag.fallbackRun=o,r._zod.bag.validator=t,r._zod.run=i,n.__originalRun||Gh(r,e,t),r}s(Jn,"withParser");function Gh(e,t,r){let n=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;n.safeParse=(u,c)=>{let a=r(u);return a!==Y?{success:!0,data:a}:i(u,c)}}if(typeof o.parse=="function"){let i=o.parse;n.parse=(u,c)=>{let a=r(u);return a!==Y?a:i(u,c)}}}s(Gh,"installCompiledUserMethods");function Gn(e,t){let r=!0;try{r=Fn(e)}catch{}if(r)throw new Z("a schema whose subtree contains a reference cycle");let n={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new Ue(["input"]),i=V(o,n,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let u=["INVALID",...n.constants.keys()],c=[Y,...n.constants.values()],a=o.content.join(`
|
|
62
|
+
`)}return $.write("payload.value = newResult;"),$.write("return payload;"),$.compile()},"generateFastpass"),u,c=Me,a=!B.jitless,f=a&&di.value,p=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=n.value);let y=m.value;return c(y)?a&&f&&g?.async===!1&&g.jitless!==!0?(u||(u=i(t.shape)),m=u(m,g),p?If([],y,m,g,d,e,g?.abortEarly===!0):m):r(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function ff(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!H(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(u=>re(u,n,M())))}),t)}s(ff,"handleUnionResults");var gr=h("$ZodUnion",(e,t)=>{P.init(e,t),O(e,"optin",n=>n.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),O(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),O(e,"values",n=>{if(n.def.options.every(o=>o._zod.values))return new Set(n.def.options.flatMap(o=>Array.from(o._zod.values)))}),O(e,"pattern",n=>{if(n.def.options.every(o=>o._zod.pattern)){let o=n.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>be(i.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,u=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)u.push(a),i=!0;else{if(a.issues.length===0)return a;u.push(a)}}return i?Promise.all(u).then(c=>ff(c,n,e,o)):ff(u,n,e,o)}});function pf(e,t,r,n){let o=[];for(let i=0;i<e.length;i++)e[i].issues.length===0&&o.push(i);return o.length===1?(t.value=e[o[0]].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(u=>re(u,n,M())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:o}),t)}s(pf,"handleExclusiveUnionResults");var $u=h("$ZodXor",(e,t)=>{gr.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,u=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);a instanceof Promise?(u.push(a),i=!0):u.push(a)}return i?Promise.all(u).then(c=>pf(c,n,e,o)):pf(u,n,e,o)}});function wu(e,t){let r=e._zod,n=r.bag.optionsMap;n||(n=Of(r.def),r.bag.optionsMap=n);let o=n.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}s(wu,"getDiscriminatedOption");function Of(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}s(Of,"discriminatorMap");var bu=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,gr.init(e,t);let r=e._zod.parse;O(e,"propValues",o=>{let i={},u=0;for(let c of o.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);a[o.def.discriminator]?.has(void 0)&&u++;for(let[l,f]of Object.entries(a)){Object.prototype.hasOwnProperty.call(i,l)||J(i,l,new Set);for(let p of f)i[l].add(p)}}return!o.def.unionFallback&&u>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let u=lt(o._zod.def);if(u&&!Object.prototype.hasOwnProperty.call(u,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=at(()=>Of(t));e._zod.parse=(o,i)=>{let u=o.value;if(!Me(u))return o.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),o;let c=u?.[t.discriminator],a=n.value.get(c);return a&&(c!==void 0||i.direction!=="backward")?a._zod.run(o,i):t.unionFallback||i.direction==="backward"?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(l=>n.value.get(l)!==null),input:u,path:[t.discriminator],inst:e}),o)}}),vu=h("$ZodIntersection",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),u=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||u instanceof Promise?Promise.all([i,u]).then(([a,l])=>df(r,a,l)):df(r,i,u)}});function yt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ce(e)&&ce(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let u=yt(e[i],t[i]);if(!u.valid)return{valid:!1,mergeErrorPath:[i,...u.mergeErrorPath]};o[i]=u.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],u=yt(o,i);if(!u.valid)return{valid:!1,mergeErrorPath:[n,...u.mergeErrorPath]};r.push(u.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}s(yt,"mergeValues");function df(e,t,r){let n=new Map,o,i=new Map,u=s((l,f)=>{let p;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),p=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let d=String(l.path[0]);i.has(d)||i.set(d,l),p=[d]}else return!1;for(let d of p)n.has(d)||n.set(d,{}),n.get(d)[f]=!0;return!0},"collect");for(let l of t.issues)u(l,"l")||e.issues.push(l);for(let l of r.issues)u(l,"r")||e.issues.push(l);let c=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(c.length){let l=o?c.filter(f=>o.keys.includes(f)):[];l.length&&e.issues.push({...o,keys:l});for(let f of c)!l.includes(f)&&i.has(f)&&e.issues.push(i.get(f))}let a=yt(t.value,r.value);if(!a.valid){if(H(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}s(df,"handleIntersectionResults");var Dn=h("$ZodTuple",(e,t)=>{P.init(e,t);let r=t.items,n=B.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let u=o.value;if(!Array.isArray(u))return o.issues.push({input:u,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],a=mf(r,"optin"),l=mf(r,"optout");if(!t.rest){if(u.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:u,inst:e,origin:"array"}),o;u.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:u,inst:e,origin:"array"})}let f=new Array(r.length),p=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<r.length;m++){let g=r[m]._zod.run({value:u[m],issues:[]},i);g instanceof Promise?c.push(g.then(y=>{f[m]=y})):(f[m]=g,p&&!d&&g.issues.length&&(d=H(g)))}if(t.rest&&!d){let m=r.length-1,g=u.slice(r.length),y=o.issues.length;for(let $ of g){if(p&&o.issues.length!==y){if(H(o,y))break;y=o.issues.length}m++;let z=t.rest._zod.run({value:$,issues:[]},i);z instanceof Promise?c.push(z.then(x=>hf(x,o,m))):hf(z,o,m)}}return c.length?Promise.all(c).then(()=>gf(f,o,r,u,l)):gf(f,o,r,u,l)}});function mf(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}s(mf,"getTupleOptStart");function hf(e,t,r){e.issues.length&&t.issues.push(...te(r,e.issues)),t.value[r]=e.value}s(hf,"handleTupleResult");function gf(e,t,r,n,o){for(let i=0;i<r.length;i++){let u=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(u.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...te(i,u.issues))}t.value[i]=u.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}s(gf,"handleTupleResults");var xu=h("$ZodRecord",(e,t)=>{P.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!ce(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let u=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let f of c)if(typeof f=="string"||typeof f=="number"||typeof f=="symbol"){if(a.add(typeof f=="number"?f.toString():f),f==="__proto__")continue;let p=t.keyType._zod.run({value:f,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(g=>re(g,o,M())),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?u.push(m.then(g=>{g.issues.length&&n.issues.push(...te(f,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...te(f,m.issues)),n.value[d]=m.value)}let l;for(let f in i)if(!a.has(f))if(t.mode==="loose"){if(f==="__proto__")continue;n.value[f]=i[f]}else l=l??[],l.push(f);l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let a;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"&&ve.test(l)&&f.issues.length){let g=t.keyType._zod.run({value:Number(l),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(f=g)}if(f.issues.length){t.mode==="loose"?n.value[l]=i[l]:c?(a=a??[],a.push(l)):n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>re(g,o,M())),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?u.push(m.then(g=>{g.issues.length&&n.issues.push(...te(l,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...te(l,m.issues)),n.value[d]=m.value)}a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}return u.length?Promise.all(u).then(()=>n):n}}),ku=h("$ZodMap",(e,t)=>{P.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),n;let u=[];n.value=r?r.alloc(e,n,new Map,o):new Map;let c=o?.abortEarly,a=n.issues.length;for(let[l,f]of i){if(c&&n.issues.length!==a){if(H(n,a))break;a=n.issues.length}let p=t.keyType._zod.run({value:l,issues:[]},o),d=t.valueType._zod.run({value:f,issues:[]},o);p instanceof Promise||d instanceof Promise?u.push(Promise.all([p,d]).then(([m,g])=>{yf(m,g,n,l,i,e,o)})):yf(p,d,n,l,i,e,o)}return u.length?Promise.all(u).then(()=>n):n}});function yf(e,t,r,n,o,i,u){e.issues.length&&(Xt.has(typeof n)?r.issues.push(...te(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(c=>re(c,u,M()))})),t.issues.length&&(Xt.has(typeof n)?r.issues.push(...te(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(c=>re(c,u,M()))})),r.value.set(e.value,t.value)}s(yf,"handleMapResult");var zu=h("$ZodSet",(e,t)=>{P.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),n;let u=[];n.value=r?r.alloc(e,n,new Set,o):new Set;let c=o?.abortEarly,a=n.issues.length;for(let l of i){if(c&&n.issues.length!==a){if(H(n,a))break;a=n.issues.length}let f=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise?u.push(f.then(p=>_f(p,n))):_f(f,n)}return u.length?Promise.all(u).then(()=>n):n}});function _f(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}s(_f,"handleSetResult");var Su=h("$ZodEnum",(e,t)=>{P.init(e,t);let r=ut(t.entries),n=new Set(r);e._zod.values=n,O(e,"pattern",o=>{let i=ut(o.def.entries).filter(u=>Xt.has(typeof u));return new RegExp(i.length?`^(${i.map(u=>ae(u.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let u=o.value;return n.has(u)||o.issues.push({code:"invalid_value",values:r,input:u,inst:e}),o}}),Pu=h("$ZodLiteral",(e,t)=>{P.init(e,t);let r=new Set(t.values);e._zod.values=r,O(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?ae(i):i?ae(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),Iu=h("$ZodFile",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),Au=h("$ZodTransform",(e,t)=>{P.init(e,t),e._zod.optin="optional",B.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(r.value=u,r));if(o instanceof Promise)throw new ne;return r.value=o,r}});function $f(e,t){return e.value=t.issues.length?void 0:t.value,e}s($f,"handleOptionalResult");var Rn=h("$ZodOptional",(e,t)=>{P.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",O(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),O(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${be(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>$f(r,i)):$f(r,o)}return t.innerType._zod.run(r,n)}}),Ou=h("$ZodExactOptional",(e,t)=>{Rn.init(e,t),O(e,"values",r=>r.def.innerType._zod.values),O(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Zu=h("$ZodNullable",(e,t)=>{P.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin),O(e,"optout",r=>r.def.innerType._zod.optout),O(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${be(n.source)}|null)$`):void 0}),O(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Nu=h("$ZodDefault",(e,t)=>{P.init(e,t),e._zod.optin="defaulted",O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>wf(i,t)):wf(o,t)}});function wf(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}s(wf,"handleDefaultResult");var Eu=h("$ZodPrefault",(e,t)=>{P.init(e,t),e._zod.optin="defaulted",O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Cu=h("$ZodNonOptional",(e,t)=>{P.init(e,t),O(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>bf(i,e)):bf(o,e)}});function bf(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(bf,"handleNonOptionalResult");var Tu=h("$ZodSuccess",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}});function vf(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>re(o,n,M()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}s(vf,"handleCatchResult");var Du=h("$ZodCatch",(e,t)=>{P.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),O(e,"optout",r=>r.def.innerType._zod.optout),O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>vf(r,i,t,n)):vf(r,o,t,n)}}),Ru=h("$ZodNaN",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Ln=h("$ZodPipe",(e,t)=>{P.init(e,t),O(e,"values",r=>r.def.in._zod.values),O(e,"optin",r=>r.def.in._zod.optin),O(e,"optout",r=>r.def.out._zod.optout),O(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(u=>wn(u,t.in,n)):wn(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>wn(i,t.out,n)):wn(o,t.out,n)}});function wn(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}s(wn,"handlePipeResult");var yr=h("$ZodCodec",(e,t)=>{P.init(e,t),O(e,"values",r=>r.def.in._zod.values),O(e,"optin",r=>r.def.in._zod.optin),O(e,"optout",r=>r.def.out._zod.optout),O(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(u=>bn(u,t,n)):bn(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(u=>bn(u,t,n)):bn(i,t,n)}}});function bn(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>vn(e,i,t.out,r)):vn(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>vn(e,i,t.in,r)):vn(e,o,t.in,r)}}s(bn,"handleCodecAResult");function vn(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}s(vn,"handleCodecTxResult");var Lu=h("$ZodPreprocess",(e,t)=>{Ln.init(e,t)}),ju=h("$ZodReadonly",(e,t)=>{P.init(e,t),O(e,"propValues",r=>r.def.innerType._zod.propValues),O(e,"values",r=>r.def.innerType._zod.values),O(e,"optin",r=>r.def.innerType?._zod?.optin),O(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(xf):xf(o)}});function xf(e){return e.memo||(e.value=Object.freeze(e.value)),e}s(xf,"handleReadonlyResult");function Vh(e){let t=e._zod.def,r=t.pattern,n=!!t.format?.includes("int"),o,i;for(let c of t.checks??[]){let a=c._zod.def;a.pattern&&(r=a.pattern),n||(n=!!a.format?.includes("int"));let l=a.minimum??a.length,f=a.maximum??a.length;l!==void 0&&(o===void 0||l>o)&&(o=l),f!==void 0&&(i===void 0||f<i)&&(i=f)}if(r)return r.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return ts({minimum:o,maximum:i}).source;let u=e._zod.pattern;return(n&&u===ve?ur:u)?.source}s(Vh,"leafPattern");function Zs(e){let t=e._zod.def,r=e._zod.pattern?.source,n=t.innerType??e._zod.innerType;if(n){let o=n._zod.pattern?.source,i=Zs(n);return r&&o&&i&&i!==o?r.replace(be(o),()=>be(i)):r}if(t.options){let o=t.options.map(Zs);if(o.every(Boolean))return`^(${o.map(i=>be(i)).join("|")})$`}return Vh(e)}s(Zs,"partPattern");var Vu=h("$ZodTemplateLiteral",(e,t)=>{P.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){let o=Zs(n);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);r.push(be(o))}else if(n===null||mi.has(typeof n))r.push(ae(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Mu=h("$ZodFunction",(e,t)=>(P.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?nn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?nn(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await on(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await on(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Dn({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Fu=h("$ZodPromise",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),_r=h("$ZodLazy",(e,t)=>{P.init(e,t),fi(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),O(e,"pattern",r=>r.innerType?._zod?.pattern),O(e,"propValues",r=>r.innerType?._zod?.propValues),O(e,"optin",r=>r.innerType?._zod?.optin??void 0),O(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Ku=h("$ZodCustom",(e,t)=>{L.init(e,t),P.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>kf(i,r,n,e));kf(o,r,n,e)}});function kf(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(ft(o))}}s(kf,"handleRefineResult");var Fn=class extends Error{static{s(this,"$ZodCyclicError")}constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Bu="~memo",Nf=[];function Ef(e){return e!==null&&typeof e=="object"}s(Ef,"isRef");function Uu(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}s(Uu,"cloneIssues");var Cf=new WeakMap,_t=0,Mn=1,$r=2;function wr(e,t,r){let n=Cf.get(e);if(n!==void 0)return n?$r:_t;if(t.has(e))return $r;t.add(e);let o=_t,i=s(f=>{if(o!==$r&&f?._zod){let p=wr(f,t,r);p>o&&(o=p)}},"check"),u=s((f,p)=>{let d=_t;for(let m of Reflect.ownKeys(f)){let g=Object.getOwnPropertyDescriptor(f,m);if(p&&!g.enumerable)continue;let y=g.get?Mn:g.value?._zod?wr(g.value,t,r):_t;y>d&&(d=y)}return d},"shape"),c=s(f=>{f>o&&(o=f)},"merge"),a=e._zod.def,l=a.type;switch(l){case"object":{let f=lt(a);c(f?u(f,!0):Mn),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let f of a.items)i(f);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let f of a.options)i(f);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let f=a._cachedInner??(r?e._zod.innerType:void 0);c(f?wr(f,t,!1):Mn);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 a){let p=Object.getOwnPropertyDescriptor(a,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),Mh(e,o)}s(wr,"isRecursive");function Mh(e,t){return t!==Mn&&Cf.set(e,t===$r),t}s(Mh,"settle");function Kn(e){return wr(e,new Set,!0)!==_t}s(Kn,"isRecursiveSchema");function Fh(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}s(Fh,"bucketFor");var jn,Vn=[],Kh={alloc(e,t,r){let n=jn;if(!n)return r;jn=void 0;let o={value:r,issues:null};return n.set(t.value,o),Vn.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=s((o,i)=>{if(i.direction!=="backward"&&Un(i,o.value))throw new Fn;return r(o,i)},"wrapped");e._zod.parse=n,e._zod.run===r&&(e._zod.run=n)})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let u=e._zod.parse,c=s((a,l)=>{if(r===void 0){let z=wr(e,new Set,!1);if(z===_t)return e._zod.parse=u,e._zod.run===c&&(e._zod.run=u),u(a,l);z===$r||n?r=!0:n=!0}let f=a.value;if(!Ef(f))return u(a,l);let p=l[Bu];p||(p={buckets:new WeakMap,backEdges:void 0},l[Bu]=p);let d;o===l?d=i:(d=Fh(p,e),o=l,i=d);let m=d.get(f);if(m)return a.value=m.value,m.issues?m.issues.length&&a.issues.push(...Uu(m.issues)):(a.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(m.value)),a;jn=d;let g=Vn.length,y=u(a,l);jn=void 0;let $=Vn.length>g?Vn.pop():void 0;return y instanceof Promise?y.then(z=>($&&($.issues=z.issues.length?Uu(z.issues):Nf),z)):($&&($.issues=y.issues.length?Uu(y.issues):Nf),y)},"wrapped");e._zod.parse=c,e._zod.run===u&&(e._zod.run=c)})}};function br(){return Kh}s(br,"memoizer");function Un(e,t){let r=e[Bu]?.backEdges;return r!==void 0&&Ef(t)&&r.has(t)}s(Un,"isBackEdge");var xr={};$e(xr,{en:()=>vr});var Uh=s(()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}s(t,"getSizing");let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,u){return i==="number"&&typeof u=="number"&&!Number.isFinite(u)?String(u):n[i]??i}return s(o,"getTypeName"),i=>{switch(i.code){case"invalid_type":{let u=o(i.expected),c=yi(i.input),a=o(c,i.input);return`Invalid input: expected ${u}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Yr(i.values[0])}`:`Invalid option: expected one of ${Wr(i.values,"|")}`;case"too_big":{let u=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${u}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${u}${i.maximum.toString()}`}case"too_small":{let u=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${u}${i.minimum.toString()} ${c.unit}`:`Too small: expected ${i.origin} to be ${u}${i.minimum.toString()}`}case"invalid_format":{let u=i;return u.format==="starts_with"?`Invalid string: must start with "${u.prefix}"`:u.format==="ends_with"?`Invalid string: must end with "${u.suffix}"`:u.format==="includes"?`Invalid string: must include "${u.includes}"`:u.format==="regex"?`Invalid string: must match pattern ${u.pattern}`:`Invalid ${r[u.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":""}: ${Wr(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(c=>`'${c}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}},"error");function vr(){return{localeError:Uh()}}s(vr,"default");var Tf,Ju=Symbol("ZodOutput"),Gu=Symbol("ZodInput"),Bn=class{static{s(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Jn(){return new Bn}s(Jn,"registry");(Tf=globalThis).__zod_globalRegistry??(Tf.__zod_globalRegistry=Jn());var G=globalThis.__zod_globalRegistry;var Y=Symbol.for("zod.compile.invalid"),Df=Symbol.for("zod.compile.fallback"),pe=class extends Error{static{s(this,"ZodCompileAsyncError")}constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},Z=class extends Error{static{s(this,"ZodCompileUnsupportedError")}constructor(t,r=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=r}};function Jh(e,t){try{return qn(e,{assertOnly:!0})}catch{return t}}s(Jh,"compileValidator");function Hu(e,t){try{let r=qn(e),n=Gn(e,r);return n._zod.bag.validator=Jh(e,r),n}catch(r){if(t?.strict)throw r;return e}}s(Hu,"compile");function Gn(e,t){if(Kn(e))throw new Z("a schema whose subtree contains a reference cycle");let r=C(e),n=e._zod.run,o=n.__originalRun??n,i=s((u,c)=>{if(c?.async||c?.direction==="backward"||c?.skipChecks||c?.[Df]||c&&Un(c,u.value))return o(u,c);let a=t(u.value);return a!==Y?(u.value=a,u):(c&&(c[Df]=!0),o(u,c))},"wrapped");return i.__originalRun=o,r._zod.bag.fallbackRun=o,r._zod.bag.validator=t,r._zod.run=i,n.__originalRun||Gh(r,e,t),r}s(Gn,"withParser");function Gh(e,t,r){let n=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;n.safeParse=(u,c)=>{let a=r(u);return a!==Y?{success:!0,data:a}:i(u,c)}}if(typeof o.parse=="function"){let i=o.parse;n.parse=(u,c)=>{let a=r(u);return a!==Y?a:i(u,c)}}}s(Gh,"installCompiledUserMethods");function qn(e,t){let r=!0;try{r=Kn(e)}catch{}if(r)throw new Z("a schema whose subtree contains a reference cycle");let n={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new Ue(["input"]),i=V(o,n,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let u=["INVALID",...n.constants.keys()],c=[Y,...n.constants.values()],a=o.content.join(`
|
|
63
63
|
`),l=t?.debug?u.length>0?`// Constants: ${u.join(", ")}
|
|
64
64
|
${a}`:a:"",f=Function,p=`return (input) => {
|
|
65
65
|
${a}
|
|
66
|
-
}`,d;try{d=new f(...u,p)(...c)}catch(m){throw new Z(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=l),d.definite=n.definite,d}s(Gn,"compileFn");function S(e,t){for(let[n,o]of e.constants)if(o===t)return n;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}s(S,"addConstant");function qe(e,t){return e.definite=!1,S(e,t)}s(qe,"addUserConstant");function k(e){return`v${e.varCounter++}`}s(k,"newVar");function qh(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return Y;let n=r;return n.issues.length===0?n.value:Y}s(qh,"runtimeRun");function W(e,t,r,n,o=!0){let i=e.content.length,u=t.constants.size,c=t.constantCounter,a=t.varCounter;try{return V(e,t,r,n,o)}catch(l){if(!(l instanceof Z)||!l.islandable)throw l;if(e.content.length=i,t.constants.size>u){let f=Array.from(t.constants.keys()).slice(u);for(let p of f)t.constants.delete(p)}return t.constantCounter=c,t.varCounter=a,Wh(e,t,r,n)}}s(W,"compileChild");function Wh(e,t,r,n){t.definite=!1;let o=S(t,r),i=S(t,qh),u=k(t);return e.write(`const ${u} = ${i}(${o}, ${n});`),e.write(`if (${u} === INVALID) return INVALID;`),u}s(Wh,"emitRuntimeIsland");var Xh=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function Hh(e,t,r,n){let o=r._zod.def.checks;if(!o||o.length===0)return n;let i=n;for(let u of o){let c=u._zod.def;if(c.when&&!Xh.has(c.check))throw new Z('check with a custom "when" condition');switch(c.check){case"greater_than":Yh(e,t,c,i);break;case"less_than":Qh(e,t,c,i);break;case"multiple_of":eg(e,t,c,i);break;case"number_format":Mf(e,c,i);break;case"min_length":{let a=Je(c.minimum,"min_length"),l=qu(e,t,i,`${i}.length >= ${a} && ${i}.length < ${c.minimum*2}`);e.write(`if (${l} < ${a}) return INVALID;`);break}case"max_length":{let a=Je(c.maximum,"max_length"),l=qu(e,t,i,`${i}.length > ${a}`);e.write(`if (${l} > ${a}) return INVALID;`);break}case"length_equals":{let a=Je(c.length,"length_equals"),l=qu(e,t,i,`${i}.length >= ${a} && ${i}.length <= ${c.length*2}`);e.write(`if (${l} !== ${a}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${Je(c.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${Je(c.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${Je(c.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Ff(e,t,c,i);break;case"custom":i=sg(e,t,u,i);break;case"bigint_format":tg(e,c,i);break;case"mime_type":rg(e,t,c,i);break;case"property":og(e,t,c,i);break;case"properties":ng(e,t,c,i);break;case"overwrite":{let a=k(t);ig(e,t,u,i,a),i=a;break}default:throw new Z(`check type ${c.check}`)}}return i}s(Hh,"generateChecks");function qu(e,t,r,n){let o=S(t,Fe),i=k(t);return e.write(`const ${i} = typeof ${r} === "string" && ${n} ? ${o}(${r}) : ${r}.length;`),i}s(qu,"codePointLengthVar");function Je(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new Z(`${t} bound of type ${typeof e}`);return`${e}`}s(Je,"numericOperand");function Vf(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new Z("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new Z("comparison check with Invalid Date bound");return S(e,t)}throw new Z(`comparison check bound of type ${typeof t}`)}s(Vf,"comparisonOperand");function Yh(e,t,r,n){let o=r.inclusive?"<":"<=";e.write(`if (${n} ${o} ${Vf(t,r.value)}) return INVALID;`)}s(Yh,"generateGreaterThanCheck");function Qh(e,t,r,n){let o=r.inclusive?">":">=";e.write(`if (${n} ${o} ${Vf(t,r.value)}) return INVALID;`)}s(Qh,"generateLessThanCheck");function eg(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new Z("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let o=S(t,qt);e.write(`if (${o}(${n}, ${Je(r.value,"multiple_of")}) !== 0) return INVALID;`)}}s(eg,"generateMultipleOfCheck");function Mf(e,t,r){let n=t.format;switch(n){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new Z(`number format ${n}`)}}s(Mf,"generateNumberFormatCheck");function tg(e,t,r){let n=t.format;if(n)switch(n){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new Z(`bigint format ${n}`)}}s(tg,"generateBigIntFormatCheck");function rg(e,t,r,n){let o=r.mime;if(o&&o.length>0){let i=S(t,new Set(o));e.write(`if (!${i}.has(${n}.type)) return INVALID;`)}}s(rg,"generateMimeTypeCheck");function ng(e,t,r,n){if(r.when)throw new Z('check with a custom "when" condition');e.write(`if (${n} == null) return INVALID;`);let o=r.shape;for(let i of Reflect.ownKeys(o)){let u=typeof i=="symbol"?S(t,i):X(i),c=k(t);e.write(`const ${c} = ${n}[${u}];`),W(e,t,o[i],c,!1)}}s(ng,"generatePropertiesChecks");function og(e,t,r,n){let o=`${n}[${JSON.stringify(r.property)}]`;V(e,t,r.schema,o)}s(og,"generatePropertyCheck");function ig(e,t,r,n,o){let i=r._zod.def.tx;if(!i)throw new Z("overwrite check without a transform function");if(We(i))throw new pe("z.compile: async overwrite transforms are not supported");let u=S(t,i);e.write(`const ${o} = ${u}(${n});`)}s(ig,"generateOverwriteCheck");function Wu(){throw new ne}s(Wu,"throwAsync");function Yu(e){this.issues.push(e)}s(Yu,"pushIssue");function sg(e,t,r,n){let o=r._zod.def;if(o.fn){if(We(o.fn))throw new pe("z.compile: async .refine() predicates are not supported");let i=qe(t,o.fn),u=S(t,Wu),c=k(t);return e.write(`const ${c} = ${i}(${n});`),e.write(`if (${c} instanceof Promise) ${u}();`),e.write(`if (!${c}) return INVALID;`),n}if(r._zod.check){if(We(r._zod.check))throw new pe("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,c=qe(t,s(l=>{let f={value:l,issues:[],addIssue:Yu};return i(f)instanceof Promise&&Wu(),f.issues.length===0?f.value:Y},"helperFn")),a=k(t);return e.write(`const ${a} = ${c}(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}throw new Z("custom check without a predicate or check function")}s(sg,"generateCustomRefineCheck");var ug=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 Ff(e,t,r,n,o=!0){let i=r.format;if(i==="base64"){let l=S(t,dr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="base64url"){let l=S(t,An);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="jwt"){let l=S(t,Nn),f=S(t,r.alg??null);return e.write(`if (!${l}(${n}, ${f})) return INVALID;`),n}if(i==="ipv6"){let l=S(t,pr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="cidrv6"){let l=S(t,Pn);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="credit_card"){let l=S(t,On);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="iban"){let l=S(t,Zn);return e.write(`if (!${l}(${n})) return INVALID;`),n}let u=r;if(i==="url"||i==="httpurl"||u.normalize||u.hostname!==void 0||u.protocol!==void 0){let l=S(t,kn),f=S(t,r),p=k(t),d=k(t);if(e.write(`const ${p} = ${n}.trim();`),e.write(`const ${d} = ${l}(${p}, ${f});`),e.write(`if (typeof ${d} === "number") return INVALID;`),u.hostname!==void 0){let y=S(t,zn);e.write(`if (!${y}(${d}, ${f}.hostname)) return INVALID;`)}if(u.protocol!==void 0){let y=S(t,Sn);e.write(`if (!${y}(${d}, ${f}.protocol)) return INVALID;`)}if(!o)return null;let m=k(t),g=u.normalize?`${d}.href`:`${S(t,fr)}(${p})`;return e.write(`const ${m} = ${g};`),m}let c=r.fn;if(c){if(We(c))throw new Z(`async string format ${i}`);let l=S(t,c);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(ug.has(i)&&r.pattern){let l=S(t,r.pattern);return e.write(`${l}.lastIndex = 0;`),e.write(`if (!${l}.test(${n})) return INVALID;`),n}let a=r.format;switch(a){case"regex":throw new Z("regex format without a pattern");case"lowercase":e.write(`if (${n} !== ${n}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${n} !== ${n}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${n}.includes(${X(r.includes)})) return INVALID;`);break;case"starts_with":{let l=r.prefix;e.write(`if (${n}.slice(0, ${l.length}) !== ${X(l)}) return INVALID;`);break}case"ends_with":{let l=r.suffix;e.write(`if (${n}.slice(-${l.length}) !== ${X(l)}) return INVALID;`);break}default:throw new Z(`string format ${a}`)}return n}s(Ff,"generateStringFormatCheck");function V(e,t,r,n,o=!0){let i=r._zod.def,u=i.type;if(i.coerce)throw new Z(`coercion (z.coerce.${u}())`);let c=o||!!i.checks?.length,a;switch(u){case"string":a=cg(e,t,r,n,c);break;case"number":a=ag(e,r,n);break;case"boolean":a=lg(e,n);break;case"bigint":a=fg(e,r,n);break;case"symbol":a=pg(e,n);break;case"undefined":a=dg(e,n);break;case"null":a=mg(e,n);break;case"any":case"unknown":a=n;break;case"never":e.write("return INVALID;"),a=n;break;case"void":a=hg(e,n);break;case"nan":a=gg(e,n);break;case"date":a=yg(e,n);break;case"object":a=_g(e,t,r,n,c);break;case"optional":a=$g(e,t,r,n,c);break;case"nullable":a=vg(e,t,r,n,c);break;case"array":a=xg(e,t,r,n,c);break;case"literal":a=kg(e,t,r,n);break;case"enum":a=zg(e,t,r,n);break;case"readonly":{let l=Rf(e,t,r,n),f=k(t);e.write(`const ${f} = Object.freeze(${l});`),a=f;break}case"success":Rf(e,t,r,n),a="true";break;case"default":case"prefault":a=Sg(e,t,r,n);break;case"nonoptional":a=Pg(e,t,r,n);break;case"tuple":a=Ig(e,t,r,n);break;case"union":a=Ag(e,t,r,n);break;case"intersection":a=Ng(e,t,r,n);break;case"record":a=Eg(e,t,r,n);break;case"map":a=Tg(e,t,r,n);break;case"set":a=Dg(e,t,r,n);break;case"file":a=Rg(e,n);break;case"template_literal":a=Lg(e,t,r,n);break;case"lazy":a=jg(e,t,r,n);break;case"pipe":a=Vg(e,t,r,n);break;case"custom":a=Mg(e,t,r,n);break;case"transform":a=Ug(e,t,r,n);break;case"catch":a=Kg(e,t,r,n);break;default:throw new Z(`schema type ${u}`)}return a===null?null:Hh(e,t,r,a)}s(V,"generateCheck");function cg(e,t,r,n,o=!0){e.write(`if (typeof ${n} !== "string") return INVALID;`);let i=r._zod.def;return i.format===void 0?n:Ff(e,t,i,n,o)}s(cg,"generateStringCheck");function ag(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let n=t._zod.def;return n.check==="number_format"&&n.format&&Mf(e,{format:n.format},r),r}s(ag,"generateNumberCheck");function lg(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}s(lg,"generateBooleanCheck");function fg(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let n=t._zod.def;if(n.format)switch(n.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}s(fg,"generateBigIntCheck");function pg(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}s(pg,"generateSymbolCheck");function dg(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(dg,"generateUndefinedCheck");function mg(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}s(mg,"generateNullCheck");function hg(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(hg,"generateVoidCheck");function gg(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}s(gg,"generateNaNCheck");function yg(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}s(yg,"generateDateCheck");function _g(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (typeof ${n} !== "object" || ${n} === null || Array.isArray(${n})) return INVALID;`);let u=i.shape,c=Object.keys(u),a=Object.getOwnPropertySymbols(u),l=a.length?[...c,...a]:c,f=s(x=>typeof x=="symbol"?S(t,x):X(x),"keyExpr"),p=s(x=>typeof x=="symbol"?`[${f(x)}]`:X(x),"propKey"),d=u;if(c.includes("__proto__"))throw new Z('object shape key "__proto__"');let m=new Map;for(let x of l){let I=d[x],E=f(x),j=k(t);if(e.write(`const ${j} = ${n}[${E}];`),I._zod.optin!==void 0){let N=k(t);e.write(`let ${N} = (() => {`),e.indented(q=>{let Jt=W(q,t,I,j);q.write(`return ${Jt};`)}),e.write("})();"),I._zod.optout==="optional"?(e.write(`if (${N} === INVALID) {`),e.indented(q=>{q.write(`if (${E} in ${n}) return INVALID;`),q.write(`${N} = undefined;`)}),e.write("}")):e.write(`if (${N} === INVALID) return INVALID;`),m.set(x,N)}else{bg(I)&&e.write(`if (!(${E} in ${n})) return INVALID;`);let N=W(e,t,I,j,o);N!==null&&m.set(x,N)}}let g=i.catchall,y="none";if(g){let x=g._zod.def.type;if(x==="never"){let I=c.map(E=>`k !== ${X(E)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(E=>{E.write(`if (${I}) return INVALID;`)}),e.write("}")}else(x==="unknown"||x==="any")&&!g._zod.def.checks?.length?y="passthrough":y="schema"}let $=k(t),z=l.some(x=>Df(d[x])||Xu(d[x]));if(!o){if(y==="schema"){let x=c.length>0?S(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(I=>{I.write('if (k === "__proto__") continue;'),x&&I.write(`if (${x}.has(k)) continue;`);let E=k(t);I.write(`const ${E} = ${n}[k];`),W(I,t,g,E,!1)}),e.write("}")}return null}if(z){e.write(`const ${$} = {};`);for(let x of l){let I=f(x),E=m.get(x);Xu(d[x])?e.write(`if (${I} in ${n}) ${$}[${I}] = ${E};`):Df(d[x])?e.write(`if (${E} !== undefined || ${I} in ${n}) ${$}[${I}] = ${E};`):e.write(`${$}[${I}] = ${E};`)}}else{let x=l.map(I=>`${p(I)}: ${m.get(I)}`).join(", ");e.write(`const ${$} = { ${x} };`)}if(y!=="none"){let x=c.length>0?S(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(I=>{if(I.write('if (k === "__proto__") continue;'),x&&I.write(`if (${x}.has(k)) continue;`),y==="passthrough")I.write(`${$}[k] = ${n}[k];`);else{let E=k(t);I.write(`const ${E} = ${n}[k];`);let j=W(I,t,g,E);I.write(`${$}[k] = ${j};`)}}),e.write("}")}return $}s(_g,"generateObjectCheck");function $g(e,t,r,n,o=!0){let i=r._zod.def;if(wg(r))return V(e,t,i.innerType,n,o);if(i.innerType._zod.optin==="defaulted"){let c=k(t),a=k(t);return e.write(`let ${c};`),e.write(`if (${n} === undefined) {`),e.indented(l=>{l.write(`const ${a} = (() => {`),l.indented(f=>{let p=V(f,t,i.innerType,n);f.write(`return ${p};`)}),l.write("})();"),l.write(`if (${a} !== INVALID) ${c} = ${a};`)}),e.write("} else {"),e.indented(l=>{let f=V(l,t,i.innerType,n);l.write(`${c} = ${f};`)}),e.write("}"),c}let u=o?k(t):null;return u&&e.write(`let ${u};`),e.write(`if (${n} !== undefined) {`),e.indented(c=>{let a=V(c,t,i.innerType,n,o);u&&a!==null&&c.write(`${u} = ${a};`)}),e.write("}"),u}s($g,"generateOptionalCheck");function wg(e){return e._zod.traits?.has("$ZodExactOptional")===!0}s(wg,"isExactOptional");function bg(e){return e._zod.optin===void 0&&Ge(e)}s(bg,"requiresPresenceCheck");function Ge(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?Ge(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?Ge(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Ge):!0;case"intersection":return!t.left||!t.right?!0:Ge(t.left)&&Ge(t.right);case"pipe":return t.in?Ge(t.in):!0;default:return!0}}s(Ge,"fastPathAcceptsAbsence");function Xu(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}s(Xu,"dropsWhenAbsent");function Df(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&$t(e)}s(Df,"mayOmitUndefined");function $t(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?$t(t.innerType):!0;case"union":return t.options?t.options.some($t):!0;case"intersection":return!t.left||!t.right||$t(t.left)||$t(t.right);case"pipe":return t.out?$t(t.out):!0;default:return!0}}s($t,"mayOutputUndefined");function vg(e,t,r,n,o=!0){let i=r._zod.def,u=o?k(t):null;return u&&e.write(`let ${u} = null;`),e.write(`if (${n} !== null) {`),e.indented(c=>{let a=V(c,t,i.innerType,n,o);u&&a!==null&&c.write(`${u} = ${a};`)}),e.write("}"),u}s(vg,"generateNullableCheck");function xg(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${n})) return INVALID;`);let u=o?k(t):null,c=k(t),a=k(t);return u&&e.write(`const ${u} = new Array(${n}.length);`),e.write(`for (let ${c} = 0; ${c} < ${n}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${a} = ${n}[${c}];`);let f=W(l,t,i.element,a,o);u&&f!==null&&l.write(`${u}[${c}] = ${f};`)}),e.write("}"),u}s(xg,"generateArrayCheck");function kg(e,t,r,n){let i=r._zod.def.values;if(i.length!==1){let c=S(t,new Set(i));return e.write(`if (!${c}.has(${n})) return INVALID;`),n}let u=i[0];if(typeof u=="number"&&Number.isNaN(u)){let c=S(t,new Set(i));return e.write(`if (!${c}.has(${n})) return INVALID;`),n}if(typeof u=="string")e.write(`if (${n} !== ${X(u)}) return INVALID;`);else if(typeof u=="number"||typeof u=="boolean")e.write(`if (${n} !== ${u}) return INVALID;`);else if(u===null)e.write(`if (${n} !== null) return INVALID;`);else if(u===void 0)e.write(`if (${n} !== undefined) return INVALID;`);else if(typeof u=="bigint")e.write(`if (${n} !== ${u}n) return INVALID;`);else throw new Z(`literal type ${typeof u}`);return n}s(kg,"generateLiteralCheck");function zg(e,t,r,n){let o=r._zod.values;if(!o)throw new Z("enum schema without enumerated values");let i=S(t,o);return e.write(`if (!${i}.has(${n})) return INVALID;`),n}s(zg,"generateEnumCheck");function Rf(e,t,r,n){let o=r._zod.def;return V(e,t,o.innerType,n)}s(Rf,"generateWrapperCheck");function Sg(e,t,r,n){let o=r._zod.def,u=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!u)return V(e,t,o.innerType,n);let a=S(t,u),l=k(t);return e.write(`let ${l} = ${n};`),e.write(`if (${n} === undefined) ${l} = ${a}();`),V(e,t,o.innerType,l)}let c=k(t);if(u){let a=S(t,u),l=S(t,Wt);e.write(`let ${c};`),e.write(`if (${n} === undefined) {`),e.indented(f=>{f.write(`${c} = ${l}(${a}());`)}),e.write("} else {"),e.indented(f=>{let p=V(f,t,o.innerType,n);f.write(`${c} = ${p} === undefined ? ${l}(${a}()) : ${p};`)}),e.write("}")}else e.write(`let ${c};`),e.write(`if (${n} !== undefined) {`),e.indented(a=>{let l=V(a,t,o.innerType,n);a.write(`${c} = ${l};`)}),e.write("}");return c}s(Sg,"generateDefaultCheck");function Pg(e,t,r,n){let o=r._zod.def,i=V(e,t,o.innerType,n),u=k(t);return e.write(`const ${u} = ${i};`),e.write(`if (${u} === undefined) return INVALID;`),u}s(Pg,"generateNonOptionalCheck");function Ig(e,t,r,n){let o=r._zod.def,i=o.items,u=o.rest;e.write(`if (!Array.isArray(${n})) return INVALID;`);let c=Lf(i,"optin"),a=Lf(i,"optout");u?e.write(`if (${n}.length < ${c}) return INVALID;`):e.write(`if (${n}.length < ${c} || ${n}.length > ${i.length}) return INVALID;`);let l=k(t);e.write(`const ${l} = [];`);for(let f=0;f<i.length;f++){let p=i[f];if(f>=a)e.write(`if (${l}.length === ${f}) {`),e.indented(d=>{d.write(`if (${f} < ${n}.length) {`),d.indented(m=>{let g=k(t);m.write(`const ${g} = ${n}[${f}];`);let y=W(m,t,p,g);m.write(`${l}[${f}] = ${y};`)}),d.write("} else {"),d.indented(m=>{if(Xu(p)){m.write(`${l}.length = ${f};`);return}let g=k(t),y=k(t);m.write(`const ${g} = undefined;`),m.write(`const ${y} = (() => {`),m.indented($=>{let z=W($,t,p,g);$.write(`return ${z};`)}),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=k(t);e.write(`const ${d} = ${n}[${f}];`);let m=W(e,t,p,d);e.write(`${l}[${f}] = ${m};`)}}if(u){let f=k(t),p=k(t);e.write(`for (let ${f} = ${i.length}; ${f} < ${n}.length; ${f}++) {`),e.indented(d=>{d.write(`const ${p} = ${n}[${f}];`);let m=W(d,t,u,p);d.write(`${l}[${f}] = ${m};`)}),e.write("}")}return l}s(Ig,"generateTupleCheck");function Lf(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}s(Lf,"getTupleOptStart");function Ag(e,t,r,n){let o=r._zod.def,i=o.options;if(o.discriminator)return Og(e,t,o,n);if(o.inclusive===!1)throw new Z("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),n;if(i.length===1)return V(e,t,i[0],n);if(i.every(a=>a._zod.def.type==="literal"&&!a._zod.def.checks?.length)){let a=new Set(i.flatMap(f=>f._zod.def.values)),l=S(t,a);return e.write(`if (!${l}.has(${n})) return INVALID;`),n}let c=k(t);e.write(`let ${c};`);for(let a=0;a<i.length;a++){let l=i[a];a===0?e.write(`${c} = (() => {`):e.write(`if (${c} === INVALID) ${c} = (() => {`),e.indented(f=>{let p=V(f,t,l,n);f.write(`return ${p};`)}),e.write("})();")}return e.write(`if (${c} === INVALID) return INVALID;`),c}s(Ag,"generateUnionCheck");function Og(e,t,r,n){if(r.unionFallback)throw new Z("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),n;let o=k(t),i=k(t);e.write(`const ${o} = ${n}?.[${X(r.discriminator)}];`),e.write(`let ${i};`);let u=!0,c=new Set;for(let a of r.options){let l=a._zod.propValues?.[r.discriminator];if(!l||l.size===0)throw new Z("discriminated union option without static discriminator values");for(let d of l){if(c.has(d))throw new Z(`duplicate discriminator value ${String(d)}`);c.add(d)}let f=Array.from(l,d=>Zg(t,o,d)),p=u?"if":"else if";e.write(`${p} (${f.join(" || ")}) {`),e.indented(d=>{let m=V(d,t,a,n);d.write(`${i} = ${m};`)}),e.write("}"),u=!1}return e.write("else { return INVALID; }"),i}s(Og,"generateDiscriminatedUnionCheck");function Zg(e,t,r){if(typeof r=="string")return`${t} === ${X(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let n=S(e,r);return`${t} === ${n}`}throw new Z(`literal discriminator value ${String(r)}`)}s(Zg,"literalEquality");function Ng(e,t,r,n){let o=r._zod.def;t.definite=!1;let i=W(e,t,o.left,n),u=W(e,t,o.right,n),c=S(t,yt),a=k(t);return e.write(`const ${a} = ${c}(${i}, ${u});`),e.write(`if (!${a}.valid) return INVALID;`),`${a}.data`}s(Ng,"generateIntersectionCheck");function Eg(e,t,r,n){let o=r._zod.def,i=S(t,ce);e.write(`if (!${i}(${n})) return INVALID;`);let u=k(t),c=k(t),a=k(t);e.write(`const ${u} = {};`);let l=o,f=l.partial?void 0:o.keyType._zod.values;if(f){let m=[];for(let y of f){if(!(typeof y=="string"||typeof y=="number"||typeof y=="symbol"))throw new Z(`record key value ${String(y)}`);let $=typeof y=="number"?y.toString():y;if($==="__proto__")throw new Z('record key "__proto__"');m.push($);let z=S(t,y),x=V(e,t,o.keyType,z),I=k(t);e.write(`const ${I} = ${n}[${Cg(t,$)}];`);let E=W(e,t,o.valueType,I);e.write(`${u}[${x}] = ${E};`)}let g=S(t,new Set(m));return e.write(`for (const ${c} in ${n}) {`),e.indented(y=>{y.write(`if (${g}.has(${c})) continue;`),l.mode==="loose"?y.write(`if (${c} !== "__proto__") ${u}[${c}] = ${n}[${c}];`):y.write("return INVALID;")}),e.write("}"),u}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=Gn(o.keyType);g.definite===!1&&(t.definite=!1);let y=S(t,g),$=S(t,ve),z=k(t);return jf(e,t,n,c,x=>{x.write(`let ${z} = ${y}(${c});`),x.write(`if (${z} === INVALID && typeof ${c} === "string" && ${$}.test(${c})) ${z} = ${y}(Number(${c}));`),m?x.write(`if (${z} === INVALID) { ${u}[${c}] = ${n}[${c}]; continue; }`):x.write(`if (${z} === INVALID) return INVALID;`),x.write(`if (${z} === "__proto__") continue;`);let I=k(t);x.write(`const ${I} = ${n}[${c}];`);let E=W(x,t,o.valueType,I);x.write(`${u}[${z}] = ${E};`)}),u}return jf(e,t,n,c,m=>{m.write(`const ${a} = ${n}[${c}];`);let g=W(m,t,o.valueType,a);m.write(`${u}[${c}] = ${g};`)},"return INVALID;"),u}s(Eg,"generateRecordCheck");function jf(e,t,r,n,o,i){let u=S(t,Object.prototype.propertyIsEnumerable),c=k(t),a=k(t),l=k(t);e.write(`const ${c} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${a} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${l} = 0; ${l} < ${a}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${n} = ${a}[${l}];`),f.write(`if (${n} === "__proto__" || !${u}.call(${r}, ${n})) continue;`),o(f)}),e.write("}"),e.write(`for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${n} = ${c}[${l}];`),f.write(`if (!${u}.call(${r}, ${n})) continue;`),i?f.write(i):o(f)}),e.write("}")}s(jf,"emitOwnKeys");function Cg(e,t){return typeof t=="string"?X(t):S(e,t)}s(Cg,"literalPropertyKey");function Tg(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Map)) return INVALID;`);let i=k(t),u=k(t),c=k(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${u}, ${c}] of ${n}) {`),e.indented(a=>{let l=V(a,t,o.keyType,u),f=V(a,t,o.valueType,c);a.write(`${i}.set(${l}, ${f});`)}),e.write("}"),i}s(Tg,"generateMapCheck");function Dg(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Set)) return INVALID;`);let i=k(t),u=k(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${u} of ${n}) {`),e.indented(c=>{let a=V(c,t,o.valueType,u);c.write(`${i}.add(${a});`)}),e.write("}"),i}s(Dg,"generateSetCheck");function Rg(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}s(Rg,"generateFileCheck");function Lg(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let o=r._zod.pattern;if(o){let i=S(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${n})) return INVALID;`)}return n}s(Lg,"generateTemplateLiteralCheck");function jg(e,t,r,n){let o=r._zod.def,i=qe(t,o.getter),u=S(t,{parser:null});e.write(`if (!${u}.parser) {`),e.indented(a=>{a.write(`const inner = ${i}();`),a.write(`${u}.parser = function(input) {`),a.indented(l=>{l.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),l.write("return result.issues.length === 0 ? result.value : INVALID;")}),a.write("};")}),e.write("}");let c=k(t);return e.write(`const ${c} = ${u}.parser(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}s(jg,"generateLazyCheck");function Vg(e,t,r,n){let o=r._zod.def,i=V(e,t,o.in,n);if(o.transform){if(We(o.transform))throw new pe("z.compile: async transforms in pipes are not supported");let u=o.transform,a=qe(t,s(f=>{let p={value:f,issues:[],addIssue:Yu},d=u(f,p);return d instanceof Promise?Y:p.issues.length===0?d:Y},"helperFn")),l=k(t);return e.write(`const ${l} = ${a}(${i});`),e.write(`if (${l} === INVALID) return INVALID;`),V(e,t,o.out,l)}else return V(e,t,o.out,i)}s(Vg,"generatePipeCheck");function We(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}s(We,"isAsyncFunction");function Mg(e,t,r,n){let o=r._zod.def;if(o.fn){if(We(o.fn))throw new pe("z.compile: async custom predicates are not supported");let i=qe(t,o.fn),u=S(t,Wu),c=k(t);e.write(`const ${c} = ${i}(${n});`),e.write(`if (${c} instanceof Promise) ${u}();`),e.write(`if (!${c}) return INVALID;`)}else throw new Z("custom schema without a predicate function");return n}s(Mg,"generateCustomCheck");function Fg(e,t,r){let n=e._zod.run({value:r,issues:[]},{});if(n&&typeof n.then=="function")return Y;let o=n;return o.issues.length===0?o.value:t()}s(Fg,"runtimeCatch");function Kg(e,t,r,n){let o=r._zod.def;if(!o.catchValue[en])throw new Z("catch with a callback (only a constant catch value compiles)",!1);let i=k(t);e.write(`let ${i} = (() => {`),e.indented(l=>{let f=W(l,t,o.innerType,n);l.write(`return ${f};`)}),e.write("})();");let u=S(t,o.innerType),c=qe(t,o.catchValue),a=S(t,Fg);return e.write(`if (${i} === INVALID) {`),e.indented(l=>{l.write(`${i} = ${a}(${u}, ${c}, ${n});`),l.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}s(Kg,"generateCatchCheck");function Ug(e,t,r,n){let o=r._zod.def;if(o.transform){if(We(o.transform))throw new pe("z.compile: async transforms are not supported");let i=o.transform,c=qe(t,s(l=>{let f={value:l,issues:[],addIssue:Yu},p=i(l,f);return p instanceof Promise?Y:f.issues.length===0?p:Y},"helperFn")),a=k(t);return e.write(`const ${a} = ${c}(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}return n}s(Ug,"generateTransformCheck");function qn(e){return e.checks&&(e.checks=[...e.checks]),e}s(qn,"snapshotChecks");function Qu(e,t){return new e(qn({type:"string",..._(t)}))}s(Qu,"_string");function ec(e,t){return new e(qn({type:"string",coerce:!0,..._(t)}))}s(ec,"_coercedString");function Wn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}s(Wn,"_email");function Xn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}s(Xn,"_guid");function Hn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}s(Hn,"_uuid");function Yn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}s(Yn,"_uuidv4");function Qn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}s(Qn,"_uuidv6");function eo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}s(eo,"_uuidv7");function kr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}s(kr,"_url");function to(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}s(to,"_emoji");function ro(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}s(ro,"_nanoid");function no(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}s(no,"_cuid");function oo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}s(oo,"_cuid2");function io(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}s(io,"_ulid");function so(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}s(so,"_xid");function uo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}s(uo,"_ksuid");function co(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}s(co,"_ipv4");function ao(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}s(ao,"_ipv6");function tc(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,..._(t)})}s(tc,"_mac");function lo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}s(lo,"_cidrv4");function fo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}s(fo,"_cidrv6");function po(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}s(po,"_base64");function mo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}s(mo,"_base64url");function ho(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}s(ho,"_e164");function rc(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,..._(t)})}s(rc,"_creditCard");function nc(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,..._(t)})}s(nc,"_iban");function go(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}s(go,"_jwt");var oc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function zr(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}s(zr,"_isoDateTime");function Sr(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}s(Sr,"_isoDate");function Pr(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}s(Pr,"_isoTime");function Ir(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}s(Ir,"_isoDuration");function ic(e,t){return new e(qn({type:"number",checks:[],..._(t)}))}s(ic,"_number");function sc(e,t){return new e(qn({type:"number",coerce:!0,checks:[],..._(t)}))}s(sc,"_coercedNumber");function uc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}s(uc,"_int");function cc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",..._(t)})}s(cc,"_float32");function ac(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",..._(t)})}s(ac,"_float64");function lc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",..._(t)})}s(lc,"_int32");function fc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",..._(t)})}s(fc,"_uint32");function pc(e,t){return new e({type:"boolean",..._(t)})}s(pc,"_boolean");function dc(e,t){return new e({type:"boolean",coerce:!0,..._(t)})}s(dc,"_coercedBoolean");function mc(e,t){return new e({type:"bigint",..._(t)})}s(mc,"_bigint");function hc(e,t){return new e({type:"bigint",coerce:!0,..._(t)})}s(hc,"_coercedBigint");function gc(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",..._(t)})}s(gc,"_int64");function yc(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",..._(t)})}s(yc,"_uint64");function _c(e,t){return new e({type:"symbol",..._(t)})}s(_c,"_symbol");function $c(e,t){return new e({type:"undefined",..._(t)})}s($c,"_undefined");function wc(e,t){return new e({type:"null",..._(t)})}s(wc,"_null");function bc(e){return new e({type:"any"})}s(bc,"_any");function vc(e){return new e({type:"unknown"})}s(vc,"_unknown");function xc(e,t){return new e({type:"never",..._(t)})}s(xc,"_never");function kc(e,t){return new e({type:"void",..._(t)})}s(kc,"_void");function zc(e,t){return new e({type:"date",..._(t)})}s(zc,"_date");function Sc(e,t){return new e({type:"date",coerce:!0,..._(t)})}s(Sc,"_coercedDate");function Pc(e,t){return new e({type:"nan",..._(t)})}s(Pc,"_nan");function me(e,t){return new yn({check:"less_than",..._(t),value:e,inclusive:!1})}s(me,"_lt");function se(e,t){return new yn({check:"less_than",..._(t),value:e,inclusive:!0})}s(se,"_lte");function he(e,t){return new _n({check:"greater_than",..._(t),value:e,inclusive:!1})}s(he,"_gt");function ue(e,t){return new _n({check:"greater_than",..._(t),value:e,inclusive:!0})}s(ue,"_gte");function yo(e){return he(0,e)}s(yo,"_positive");function _o(e){return me(0,e)}s(_o,"_negative");function $o(e){return se(0,e)}s($o,"_nonpositive");function wo(e){return ue(0,e)}s(wo,"_nonnegative");function Ae(e,t){return new fs({check:"multiple_of",..._(t),value:e})}s(Ae,"_multipleOf");function Oe(e,t){return new ms({check:"max_size",..._(t),maximum:e})}s(Oe,"_maxSize");function ge(e,t){return new hs({check:"min_size",..._(t),minimum:e})}s(ge,"_minSize");function Xe(e,t){return new gs({check:"size_equals",..._(t),size:e})}s(Xe,"_size");function He(e,t){return new ys({check:"max_length",..._(t),maximum:e})}s(He,"_maxLength");function xe(e,t){return new _s({check:"min_length",..._(t),minimum:e})}s(xe,"_minLength");function Ye(e,t){return new $s({check:"length_equals",..._(t),length:e})}s(Ye,"_length");function wt(e,t){return new ws({check:"string_format",format:"regex",..._(t),pattern:e})}s(wt,"_regex");function bt(e){return new bs({check:"string_format",format:"lowercase",..._(e)})}s(bt,"_lowercase");function vt(e){return new vs({check:"string_format",format:"uppercase",..._(e)})}s(vt,"_uppercase");function xt(e,t){return new xs({check:"string_format",format:"includes",..._(t),includes:e})}s(xt,"_includes");function kt(e,t){return new ks({check:"string_format",format:"starts_with",..._(t),prefix:e})}s(kt,"_startsWith");function zt(e,t){return new zs({check:"string_format",format:"ends_with",..._(t),suffix:e})}s(zt,"_endsWith");function bo(e,t,r){return new Ss({check:"property",property:e,schema:t,..._(r)})}s(bo,"_property");function St(e,t){return new Ps({check:"properties",shape:e,..._(t)})}s(St,"_properties");function Pt(e,t){return new Is({check:"mime_type",mime:e,..._(t)})}s(Pt,"_mime");function de(e){return new As({check:"overwrite",tx:e})}s(de,"_overwrite");function It(e){return de(t=>t.normalize(e))}s(It,"_normalize");function At(){return de(e=>e.trim())}s(At,"_trim");function Ot(){return de(e=>e.toLowerCase())}s(Ot,"_toLowerCase");function Zt(){return de(e=>e.toUpperCase())}s(Zt,"_toUpperCase");function Nt(){return de(e=>pi(e))}s(Nt,"_slugify");function Ic(e,t,r){return new e({type:"array",element:t,..._(r)})}s(Ic,"_array");function Bg(e,t,r){return new e({type:"union",options:t,..._(r)})}s(Bg,"_union");function Jg(e,t,r){return new e({type:"union",options:t,inclusive:!1,..._(r)})}s(Jg,"_xor");function Gg(e,t,r,n){return new e({type:"union",options:r,discriminator:t,..._(n)})}s(Gg,"_discriminatedUnion");function qg(e,t,r){return new e({type:"intersection",left:t,right:r})}s(qg,"_intersection");function Wg(e,t,r,n){let o=r instanceof P,i=o?n:r,u=o?r:null;return new e({type:"tuple",items:t,rest:u,..._(i)})}s(Wg,"_tuple");function Xg(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,..._(n)})}s(Xg,"_record");function Hg(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,..._(n)})}s(Hg,"_map");function Yg(e,t,r){return new e({type:"set",valueType:t,..._(r)})}s(Yg,"_set");function Qg(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:n,..._(r)})}s(Qg,"_enum");function ey(e,t,r){return new e({type:"enum",entries:t,..._(r)})}s(ey,"_nativeEnum");function ty(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],..._(r)})}s(ty,"_literal");function Ac(e,t){return new e({type:"file",..._(t)})}s(Ac,"_file");function ry(e,t){return new e({type:"transform",transform:t})}s(ry,"_transform");function ny(e,t){return new e({type:"optional",innerType:t})}s(ny,"_optional");function oy(e,t){return new e({type:"nullable",innerType:t})}s(oy,"_nullable");function iy(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Wt(r)}})}s(iy,"_default");function sy(e,t,r){return new e({type:"nonoptional",innerType:t,..._(r)})}s(sy,"_nonoptional");function uy(e,t){return new e({type:"success",innerType:t})}s(uy,"_success");function cy(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:$i(r)})}s(cy,"_catch");function ay(e,t,r){return new e({type:"pipe",in:t,out:r})}s(ay,"_pipe");function ly(e,t){return new e({type:"readonly",innerType:t})}s(ly,"_readonly");function fy(e,t,r){return new e({type:"template_literal",parts:t,..._(r)})}s(fy,"_templateLiteral");function py(e,t){return new e({type:"lazy",getter:t})}s(py,"_lazy");function dy(e,t){return new e({type:"promise",innerType:t})}s(dy,"_promise");function Oc(e,t,r){let n=_(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}s(Oc,"_custom");function Zc(e,t,r){return new e({type:"custom",check:"custom",fn:t,..._(r)})}s(Zc,"_refine");function Nc(e,t){let r=Kf(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(ft(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ft(i))}},e(n.value,n)),t);return r}s(Nc,"_superRefine");function Kf(e,t){let r=new L({check:"custom",..._(t)});return r._zod.check=e,r}s(Kf,"_check");function Ec(e){let t=new L({check:"describe"});return t._zod.onattach=[r=>{let n=G.get(r)??{};G.add(r,{...n,description:e})}],t._zod.check=()=>{},t}s(Ec,"describe");function Cc(e){let t=new L({check:"meta"});return t._zod.onattach=[r=>{let n=G.get(r)??{};G.add(r,{...n,...e})}],t._zod.check=()=>{},t}s(Cc,"meta");function Tc(e,t){let r=_(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),u=new Set(o),c=e.Codec??yr,a=e.Boolean??hr,l=e.String??Be,f=new l({type:"string",error:r.error}),p=new a({type:"boolean",error:r.error}),d=new c({type:"pipe",in:f,out:p,transform:s(((m,g)=>{let y=m;return r.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:u.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...u],input:g.value,inst:d,continue:!1}),{})}),"transform"),reverseTransform:s(((m,g)=>m===!0?n[0]||"true":o[0]||"false"),"reverseTransform"),error:r.error});return d._zod.bag.truthy=n,d._zod.bag.falsy=o,d._zod.bag.case=r.case??"insensitive",d}s(Tc,"_stringbool");function Qe(e,t,r,n={}){let o=_(n),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:c=>r.test(c),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}s(Qe,"_stringFormat");function Ar(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&J(e,n,r[n]);return e}s(Ar,"assignProps");function Ze(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??G,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(Ze,"initializeContext");function K(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}s(K,"handleUnrepresentable");function D(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let u={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,u),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)u.schema=c;else{let f={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,f);else{let d=u.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&&(u.ref||(u.ref=p),D(p,t,f),t.seen.get(p).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&Ar(u.schema,a),t.io==="input"&&Q(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&"_prefault"in u.schema&&((n=u.schema).default??(n.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}s(D,"processSchema");function Uf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}s(Uf,"encodeJSONPointerSegment");function Ne(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let u of e.seen.entries()){let c=e.metadataRegistry.get(u[0])?.id;if(c){let a=n.get(c);if(a&&a!==u[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,u[0])}}let o=s(u=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(u[0])?.id,d=e.external.uri??(g=>g);if(p)return{ref:d(p)};let m=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${Uf(m)}`}}let a="#",l=`${a}/${c}/`;if(u[1]===r&&!u[1].schema.id)return{ref:a};let f=u[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:l+Uf(f)}},"makeURI"),i=s(u=>{if(u[1].schema.$ref)return;let c=u[1],{ref:a,defId:l}=o(u);c.def={...c.schema},l&&(c.defId=l);let f=c.schema;for(let p in f)delete f[p];f.$ref=a},"extractToDef");if(e.cycles==="throw")for(let u of e.seen.entries()){let c=u[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
66
|
+
}`,d;try{d=new f(...u,p)(...c)}catch(m){throw new Z(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=l),d.definite=n.definite,d}s(qn,"compileFn");function S(e,t){for(let[n,o]of e.constants)if(o===t)return n;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}s(S,"addConstant");function qe(e,t){return e.definite=!1,S(e,t)}s(qe,"addUserConstant");function k(e){return`v${e.varCounter++}`}s(k,"newVar");function qh(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return Y;let n=r;return n.issues.length===0?n.value:Y}s(qh,"runtimeRun");function W(e,t,r,n,o=!0){let i=e.content.length,u=t.constants.size,c=t.constantCounter,a=t.varCounter;try{return V(e,t,r,n,o)}catch(l){if(!(l instanceof Z)||!l.islandable)throw l;if(e.content.length=i,t.constants.size>u){let f=Array.from(t.constants.keys()).slice(u);for(let p of f)t.constants.delete(p)}return t.constantCounter=c,t.varCounter=a,Wh(e,t,r,n)}}s(W,"compileChild");function Wh(e,t,r,n){t.definite=!1;let o=S(t,r),i=S(t,qh),u=k(t);return e.write(`const ${u} = ${i}(${o}, ${n});`),e.write(`if (${u} === INVALID) return INVALID;`),u}s(Wh,"emitRuntimeIsland");var Xh=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function Hh(e,t,r,n){let o=r._zod.def.checks;if(!o||o.length===0)return n;let i=n;for(let u of o){let c=u._zod.def;if(c.when&&!Xh.has(c.check))throw new Z('check with a custom "when" condition');switch(c.check){case"greater_than":Yh(e,t,c,i);break;case"less_than":Qh(e,t,c,i);break;case"multiple_of":eg(e,t,c,i);break;case"number_format":Ff(e,c,i);break;case"min_length":{let a=Je(c.minimum,"min_length"),l=qu(e,t,i,`${i}.length >= ${a} && ${i}.length < ${c.minimum*2}`);e.write(`if (${l} < ${a}) return INVALID;`);break}case"max_length":{let a=Je(c.maximum,"max_length"),l=qu(e,t,i,`${i}.length > ${a}`);e.write(`if (${l} > ${a}) return INVALID;`);break}case"length_equals":{let a=Je(c.length,"length_equals"),l=qu(e,t,i,`${i}.length >= ${a} && ${i}.length <= ${c.length*2}`);e.write(`if (${l} !== ${a}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${Je(c.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${Je(c.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${Je(c.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Kf(e,t,c,i);break;case"custom":i=sg(e,t,u,i);break;case"bigint_format":tg(e,c,i);break;case"mime_type":rg(e,t,c,i);break;case"property":og(e,t,c,i);break;case"properties":ng(e,t,c,i);break;case"overwrite":{let a=k(t);ig(e,t,u,i,a),i=a;break}default:throw new Z(`check type ${c.check}`)}}return i}s(Hh,"generateChecks");function qu(e,t,r,n){let o=S(t,Fe),i=k(t);return e.write(`const ${i} = typeof ${r} === "string" && ${n} ? ${o}(${r}) : ${r}.length;`),i}s(qu,"codePointLengthVar");function Je(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new Z(`${t} bound of type ${typeof e}`);return`${e}`}s(Je,"numericOperand");function Mf(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new Z("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new Z("comparison check with Invalid Date bound");return S(e,t)}throw new Z(`comparison check bound of type ${typeof t}`)}s(Mf,"comparisonOperand");function Yh(e,t,r,n){let o=r.inclusive?"<":"<=";e.write(`if (${n} ${o} ${Mf(t,r.value)}) return INVALID;`)}s(Yh,"generateGreaterThanCheck");function Qh(e,t,r,n){let o=r.inclusive?">":">=";e.write(`if (${n} ${o} ${Mf(t,r.value)}) return INVALID;`)}s(Qh,"generateLessThanCheck");function eg(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new Z("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let o=S(t,qt);e.write(`if (${o}(${n}, ${Je(r.value,"multiple_of")}) !== 0) return INVALID;`)}}s(eg,"generateMultipleOfCheck");function Ff(e,t,r){let n=t.format;switch(n){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new Z(`number format ${n}`)}}s(Ff,"generateNumberFormatCheck");function tg(e,t,r){let n=t.format;if(n)switch(n){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new Z(`bigint format ${n}`)}}s(tg,"generateBigIntFormatCheck");function rg(e,t,r,n){let o=r.mime;if(o&&o.length>0){let i=S(t,new Set(o));e.write(`if (!${i}.has(${n}.type)) return INVALID;`)}}s(rg,"generateMimeTypeCheck");function ng(e,t,r,n){if(r.when)throw new Z('check with a custom "when" condition');e.write(`if (${n} == null) return INVALID;`);let o=r.shape;for(let i of Reflect.ownKeys(o)){let u=typeof i=="symbol"?S(t,i):X(i),c=k(t);e.write(`const ${c} = ${n}[${u}];`),W(e,t,o[i],c,!1)}}s(ng,"generatePropertiesChecks");function og(e,t,r,n){let o=`${n}[${JSON.stringify(r.property)}]`;V(e,t,r.schema,o)}s(og,"generatePropertyCheck");function ig(e,t,r,n,o){let i=r._zod.def.tx;if(!i)throw new Z("overwrite check without a transform function");if(We(i))throw new pe("z.compile: async overwrite transforms are not supported");let u=S(t,i);e.write(`const ${o} = ${u}(${n});`)}s(ig,"generateOverwriteCheck");function Wu(){throw new ne}s(Wu,"throwAsync");function Yu(e){this.issues.push(e)}s(Yu,"pushIssue");function sg(e,t,r,n){let o=r._zod.def;if(o.fn){if(We(o.fn))throw new pe("z.compile: async .refine() predicates are not supported");let i=qe(t,o.fn),u=S(t,Wu),c=k(t);return e.write(`const ${c} = ${i}(${n});`),e.write(`if (${c} instanceof Promise) ${u}();`),e.write(`if (!${c}) return INVALID;`),n}if(r._zod.check){if(We(r._zod.check))throw new pe("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,c=qe(t,s(l=>{let f={value:l,issues:[],addIssue:Yu};return i(f)instanceof Promise&&Wu(),f.issues.length===0?f.value:Y},"helperFn")),a=k(t);return e.write(`const ${a} = ${c}(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}throw new Z("custom check without a predicate or check function")}s(sg,"generateCustomRefineCheck");var ug=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 Kf(e,t,r,n,o=!0){let i=r.format;if(i==="base64"){let l=S(t,dr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="base64url"){let l=S(t,On);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="jwt"){let l=S(t,En),f=S(t,r.alg??null);return e.write(`if (!${l}(${n}, ${f})) return INVALID;`),n}if(i==="ipv6"){let l=S(t,pr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="cidrv6"){let l=S(t,In);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="credit_card"){let l=S(t,Zn);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="iban"){let l=S(t,Nn);return e.write(`if (!${l}(${n})) return INVALID;`),n}let u=r;if(i==="url"||i==="httpurl"||u.normalize||u.hostname!==void 0||u.protocol!==void 0){let l=S(t,zn),f=S(t,r),p=k(t),d=k(t);if(e.write(`const ${p} = ${n}.trim();`),e.write(`const ${d} = ${l}(${p}, ${f});`),e.write(`if (typeof ${d} === "number") return INVALID;`),u.hostname!==void 0){let y=S(t,Sn);e.write(`if (!${y}(${d}, ${f}.hostname)) return INVALID;`)}if(u.protocol!==void 0){let y=S(t,Pn);e.write(`if (!${y}(${d}, ${f}.protocol)) return INVALID;`)}if(!o)return null;let m=k(t),g=u.normalize?`${d}.href`:`${S(t,fr)}(${p})`;return e.write(`const ${m} = ${g};`),m}let c=r.fn;if(c){if(We(c))throw new Z(`async string format ${i}`);let l=S(t,c);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(ug.has(i)&&r.pattern){let l=S(t,r.pattern);return e.write(`${l}.lastIndex = 0;`),e.write(`if (!${l}.test(${n})) return INVALID;`),n}let a=r.format;switch(a){case"regex":throw new Z("regex format without a pattern");case"lowercase":e.write(`if (${n} !== ${n}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${n} !== ${n}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${n}.includes(${X(r.includes)})) return INVALID;`);break;case"starts_with":{let l=r.prefix;e.write(`if (${n}.slice(0, ${l.length}) !== ${X(l)}) return INVALID;`);break}case"ends_with":{let l=r.suffix;e.write(`if (${n}.slice(-${l.length}) !== ${X(l)}) return INVALID;`);break}default:throw new Z(`string format ${a}`)}return n}s(Kf,"generateStringFormatCheck");function V(e,t,r,n,o=!0){let i=r._zod.def,u=i.type;if(i.coerce)throw new Z(`coercion (z.coerce.${u}())`);let c=o||!!i.checks?.length,a;switch(u){case"string":a=cg(e,t,r,n,c);break;case"number":a=ag(e,r,n);break;case"boolean":a=lg(e,n);break;case"bigint":a=fg(e,r,n);break;case"symbol":a=pg(e,n);break;case"undefined":a=dg(e,n);break;case"null":a=mg(e,n);break;case"any":case"unknown":a=n;break;case"never":e.write("return INVALID;"),a=n;break;case"void":a=hg(e,n);break;case"nan":a=gg(e,n);break;case"date":a=yg(e,n);break;case"object":a=_g(e,t,r,n,c);break;case"optional":a=$g(e,t,r,n,c);break;case"nullable":a=vg(e,t,r,n,c);break;case"array":a=xg(e,t,r,n,c);break;case"literal":a=kg(e,t,r,n);break;case"enum":a=zg(e,t,r,n);break;case"readonly":{let l=Lf(e,t,r,n),f=k(t);e.write(`const ${f} = Object.freeze(${l});`),a=f;break}case"success":Lf(e,t,r,n),a="true";break;case"default":case"prefault":a=Sg(e,t,r,n);break;case"nonoptional":a=Pg(e,t,r,n);break;case"tuple":a=Ig(e,t,r,n);break;case"union":a=Ag(e,t,r,n);break;case"intersection":a=Ng(e,t,r,n);break;case"record":a=Eg(e,t,r,n);break;case"map":a=Tg(e,t,r,n);break;case"set":a=Dg(e,t,r,n);break;case"file":a=Rg(e,n);break;case"template_literal":a=Lg(e,t,r,n);break;case"lazy":a=jg(e,t,r,n);break;case"pipe":a=Vg(e,t,r,n);break;case"custom":a=Mg(e,t,r,n);break;case"transform":a=Ug(e,t,r,n);break;case"catch":a=Kg(e,t,r,n);break;default:throw new Z(`schema type ${u}`)}return a===null?null:Hh(e,t,r,a)}s(V,"generateCheck");function cg(e,t,r,n,o=!0){e.write(`if (typeof ${n} !== "string") return INVALID;`);let i=r._zod.def;return i.format===void 0?n:Kf(e,t,i,n,o)}s(cg,"generateStringCheck");function ag(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let n=t._zod.def;return n.check==="number_format"&&n.format&&Ff(e,{format:n.format},r),r}s(ag,"generateNumberCheck");function lg(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}s(lg,"generateBooleanCheck");function fg(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let n=t._zod.def;if(n.format)switch(n.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}s(fg,"generateBigIntCheck");function pg(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}s(pg,"generateSymbolCheck");function dg(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(dg,"generateUndefinedCheck");function mg(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}s(mg,"generateNullCheck");function hg(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(hg,"generateVoidCheck");function gg(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}s(gg,"generateNaNCheck");function yg(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}s(yg,"generateDateCheck");function _g(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (typeof ${n} !== "object" || ${n} === null || Array.isArray(${n})) return INVALID;`);let u=i.shape,c=Object.keys(u),a=Object.getOwnPropertySymbols(u),l=a.length?[...c,...a]:c,f=s(x=>typeof x=="symbol"?S(t,x):X(x),"keyExpr"),p=s(x=>typeof x=="symbol"?`[${f(x)}]`:X(x),"propKey"),d=u;if(c.includes("__proto__"))throw new Z('object shape key "__proto__"');let m=new Map;for(let x of l){let I=d[x],E=f(x),j=k(t);if(e.write(`const ${j} = ${n}[${E}];`),I._zod.optin!==void 0){let N=k(t);e.write(`let ${N} = (() => {`),e.indented(q=>{let Jt=W(q,t,I,j);q.write(`return ${Jt};`)}),e.write("})();"),I._zod.optout==="optional"?(e.write(`if (${N} === INVALID) {`),e.indented(q=>{q.write(`if (${E} in ${n}) return INVALID;`),q.write(`${N} = undefined;`)}),e.write("}")):e.write(`if (${N} === INVALID) return INVALID;`),m.set(x,N)}else{bg(I)&&e.write(`if (!(${E} in ${n})) return INVALID;`);let N=W(e,t,I,j,o);N!==null&&m.set(x,N)}}let g=i.catchall,y="none";if(g){let x=g._zod.def.type;if(x==="never"){let I=c.map(E=>`k !== ${X(E)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(E=>{E.write(`if (${I}) return INVALID;`)}),e.write("}")}else(x==="unknown"||x==="any")&&!g._zod.def.checks?.length?y="passthrough":y="schema"}let $=k(t),z=l.some(x=>Rf(d[x])||Xu(d[x]));if(!o){if(y==="schema"){let x=c.length>0?S(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(I=>{I.write('if (k === "__proto__") continue;'),x&&I.write(`if (${x}.has(k)) continue;`);let E=k(t);I.write(`const ${E} = ${n}[k];`),W(I,t,g,E,!1)}),e.write("}")}return null}if(z){e.write(`const ${$} = {};`);for(let x of l){let I=f(x),E=m.get(x);Xu(d[x])?e.write(`if (${I} in ${n}) ${$}[${I}] = ${E};`):Rf(d[x])?e.write(`if (${E} !== undefined || ${I} in ${n}) ${$}[${I}] = ${E};`):e.write(`${$}[${I}] = ${E};`)}}else{let x=l.map(I=>`${p(I)}: ${m.get(I)}`).join(", ");e.write(`const ${$} = { ${x} };`)}if(y!=="none"){let x=c.length>0?S(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(I=>{if(I.write('if (k === "__proto__") continue;'),x&&I.write(`if (${x}.has(k)) continue;`),y==="passthrough")I.write(`${$}[k] = ${n}[k];`);else{let E=k(t);I.write(`const ${E} = ${n}[k];`);let j=W(I,t,g,E);I.write(`${$}[k] = ${j};`)}}),e.write("}")}return $}s(_g,"generateObjectCheck");function $g(e,t,r,n,o=!0){let i=r._zod.def;if(wg(r))return V(e,t,i.innerType,n,o);if(i.innerType._zod.optin==="defaulted"){let c=k(t),a=k(t);return e.write(`let ${c};`),e.write(`if (${n} === undefined) {`),e.indented(l=>{l.write(`const ${a} = (() => {`),l.indented(f=>{let p=V(f,t,i.innerType,n);f.write(`return ${p};`)}),l.write("})();"),l.write(`if (${a} !== INVALID) ${c} = ${a};`)}),e.write("} else {"),e.indented(l=>{let f=V(l,t,i.innerType,n);l.write(`${c} = ${f};`)}),e.write("}"),c}let u=o?k(t):null;return u&&e.write(`let ${u};`),e.write(`if (${n} !== undefined) {`),e.indented(c=>{let a=V(c,t,i.innerType,n,o);u&&a!==null&&c.write(`${u} = ${a};`)}),e.write("}"),u}s($g,"generateOptionalCheck");function wg(e){return e._zod.traits?.has("$ZodExactOptional")===!0}s(wg,"isExactOptional");function bg(e){return e._zod.optin===void 0&&Ge(e)}s(bg,"requiresPresenceCheck");function Ge(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?Ge(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?Ge(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Ge):!0;case"intersection":return!t.left||!t.right?!0:Ge(t.left)&&Ge(t.right);case"pipe":return t.in?Ge(t.in):!0;default:return!0}}s(Ge,"fastPathAcceptsAbsence");function Xu(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}s(Xu,"dropsWhenAbsent");function Rf(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&$t(e)}s(Rf,"mayOmitUndefined");function $t(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?$t(t.innerType):!0;case"union":return t.options?t.options.some($t):!0;case"intersection":return!t.left||!t.right||$t(t.left)||$t(t.right);case"pipe":return t.out?$t(t.out):!0;default:return!0}}s($t,"mayOutputUndefined");function vg(e,t,r,n,o=!0){let i=r._zod.def,u=o?k(t):null;return u&&e.write(`let ${u} = null;`),e.write(`if (${n} !== null) {`),e.indented(c=>{let a=V(c,t,i.innerType,n,o);u&&a!==null&&c.write(`${u} = ${a};`)}),e.write("}"),u}s(vg,"generateNullableCheck");function xg(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${n})) return INVALID;`);let u=o?k(t):null,c=k(t),a=k(t);return u&&e.write(`const ${u} = new Array(${n}.length);`),e.write(`for (let ${c} = 0; ${c} < ${n}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${a} = ${n}[${c}];`);let f=W(l,t,i.element,a,o);u&&f!==null&&l.write(`${u}[${c}] = ${f};`)}),e.write("}"),u}s(xg,"generateArrayCheck");function kg(e,t,r,n){let i=r._zod.def.values;if(i.length!==1){let c=S(t,new Set(i));return e.write(`if (!${c}.has(${n})) return INVALID;`),n}let u=i[0];if(typeof u=="number"&&Number.isNaN(u)){let c=S(t,new Set(i));return e.write(`if (!${c}.has(${n})) return INVALID;`),n}if(typeof u=="string")e.write(`if (${n} !== ${X(u)}) return INVALID;`);else if(typeof u=="number"||typeof u=="boolean")e.write(`if (${n} !== ${u}) return INVALID;`);else if(u===null)e.write(`if (${n} !== null) return INVALID;`);else if(u===void 0)e.write(`if (${n} !== undefined) return INVALID;`);else if(typeof u=="bigint")e.write(`if (${n} !== ${u}n) return INVALID;`);else throw new Z(`literal type ${typeof u}`);return n}s(kg,"generateLiteralCheck");function zg(e,t,r,n){let o=r._zod.values;if(!o)throw new Z("enum schema without enumerated values");let i=S(t,o);return e.write(`if (!${i}.has(${n})) return INVALID;`),n}s(zg,"generateEnumCheck");function Lf(e,t,r,n){let o=r._zod.def;return V(e,t,o.innerType,n)}s(Lf,"generateWrapperCheck");function Sg(e,t,r,n){let o=r._zod.def,u=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!u)return V(e,t,o.innerType,n);let a=S(t,u),l=k(t);return e.write(`let ${l} = ${n};`),e.write(`if (${n} === undefined) ${l} = ${a}();`),V(e,t,o.innerType,l)}let c=k(t);if(u){let a=S(t,u),l=S(t,Wt);e.write(`let ${c};`),e.write(`if (${n} === undefined) {`),e.indented(f=>{f.write(`${c} = ${l}(${a}());`)}),e.write("} else {"),e.indented(f=>{let p=V(f,t,o.innerType,n);f.write(`${c} = ${p} === undefined ? ${l}(${a}()) : ${p};`)}),e.write("}")}else e.write(`let ${c};`),e.write(`if (${n} !== undefined) {`),e.indented(a=>{let l=V(a,t,o.innerType,n);a.write(`${c} = ${l};`)}),e.write("}");return c}s(Sg,"generateDefaultCheck");function Pg(e,t,r,n){let o=r._zod.def,i=V(e,t,o.innerType,n),u=k(t);return e.write(`const ${u} = ${i};`),e.write(`if (${u} === undefined) return INVALID;`),u}s(Pg,"generateNonOptionalCheck");function Ig(e,t,r,n){let o=r._zod.def,i=o.items,u=o.rest;e.write(`if (!Array.isArray(${n})) return INVALID;`);let c=jf(i,"optin"),a=jf(i,"optout");u?e.write(`if (${n}.length < ${c}) return INVALID;`):e.write(`if (${n}.length < ${c} || ${n}.length > ${i.length}) return INVALID;`);let l=k(t);e.write(`const ${l} = [];`);for(let f=0;f<i.length;f++){let p=i[f];if(f>=a)e.write(`if (${l}.length === ${f}) {`),e.indented(d=>{d.write(`if (${f} < ${n}.length) {`),d.indented(m=>{let g=k(t);m.write(`const ${g} = ${n}[${f}];`);let y=W(m,t,p,g);m.write(`${l}[${f}] = ${y};`)}),d.write("} else {"),d.indented(m=>{if(Xu(p)){m.write(`${l}.length = ${f};`);return}let g=k(t),y=k(t);m.write(`const ${g} = undefined;`),m.write(`const ${y} = (() => {`),m.indented($=>{let z=W($,t,p,g);$.write(`return ${z};`)}),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=k(t);e.write(`const ${d} = ${n}[${f}];`);let m=W(e,t,p,d);e.write(`${l}[${f}] = ${m};`)}}if(u){let f=k(t),p=k(t);e.write(`for (let ${f} = ${i.length}; ${f} < ${n}.length; ${f}++) {`),e.indented(d=>{d.write(`const ${p} = ${n}[${f}];`);let m=W(d,t,u,p);d.write(`${l}[${f}] = ${m};`)}),e.write("}")}return l}s(Ig,"generateTupleCheck");function jf(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}s(jf,"getTupleOptStart");function Ag(e,t,r,n){let o=r._zod.def,i=o.options;if(o.discriminator)return Og(e,t,o,n);if(o.inclusive===!1)throw new Z("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),n;if(i.length===1)return V(e,t,i[0],n);if(i.every(a=>a._zod.def.type==="literal"&&!a._zod.def.checks?.length)){let a=new Set(i.flatMap(f=>f._zod.def.values)),l=S(t,a);return e.write(`if (!${l}.has(${n})) return INVALID;`),n}let c=k(t);e.write(`let ${c};`);for(let a=0;a<i.length;a++){let l=i[a];a===0?e.write(`${c} = (() => {`):e.write(`if (${c} === INVALID) ${c} = (() => {`),e.indented(f=>{let p=V(f,t,l,n);f.write(`return ${p};`)}),e.write("})();")}return e.write(`if (${c} === INVALID) return INVALID;`),c}s(Ag,"generateUnionCheck");function Og(e,t,r,n){if(r.unionFallback)throw new Z("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),n;let o=k(t),i=k(t);e.write(`const ${o} = ${n}?.[${X(r.discriminator)}];`),e.write(`let ${i};`);let u=!0,c=new Set;for(let a of r.options){let l=a._zod.propValues?.[r.discriminator];if(!l||l.size===0)throw new Z("discriminated union option without static discriminator values");for(let d of l){if(c.has(d))throw new Z(`duplicate discriminator value ${String(d)}`);c.add(d)}let f=Array.from(l,d=>Zg(t,o,d)),p=u?"if":"else if";e.write(`${p} (${f.join(" || ")}) {`),e.indented(d=>{let m=V(d,t,a,n);d.write(`${i} = ${m};`)}),e.write("}"),u=!1}return e.write("else { return INVALID; }"),i}s(Og,"generateDiscriminatedUnionCheck");function Zg(e,t,r){if(typeof r=="string")return`${t} === ${X(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let n=S(e,r);return`${t} === ${n}`}throw new Z(`literal discriminator value ${String(r)}`)}s(Zg,"literalEquality");function Ng(e,t,r,n){let o=r._zod.def;t.definite=!1;let i=W(e,t,o.left,n),u=W(e,t,o.right,n),c=S(t,yt),a=k(t);return e.write(`const ${a} = ${c}(${i}, ${u});`),e.write(`if (!${a}.valid) return INVALID;`),`${a}.data`}s(Ng,"generateIntersectionCheck");function Eg(e,t,r,n){let o=r._zod.def,i=S(t,ce);e.write(`if (!${i}(${n})) return INVALID;`);let u=k(t),c=k(t),a=k(t);e.write(`const ${u} = {};`);let l=o,f=l.partial?void 0:o.keyType._zod.values;if(f){let m=[];for(let y of f){if(!(typeof y=="string"||typeof y=="number"||typeof y=="symbol"))throw new Z(`record key value ${String(y)}`);let $=typeof y=="number"?y.toString():y;if($==="__proto__")throw new Z('record key "__proto__"');m.push($);let z=S(t,y),x=V(e,t,o.keyType,z),I=k(t);e.write(`const ${I} = ${n}[${Cg(t,$)}];`);let E=W(e,t,o.valueType,I);e.write(`${u}[${x}] = ${E};`)}let g=S(t,new Set(m));return e.write(`for (const ${c} in ${n}) {`),e.indented(y=>{y.write(`if (${g}.has(${c})) continue;`),l.mode==="loose"?y.write(`if (${c} !== "__proto__") ${u}[${c}] = ${n}[${c}];`):y.write("return INVALID;")}),e.write("}"),u}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=qn(o.keyType);g.definite===!1&&(t.definite=!1);let y=S(t,g),$=S(t,ve),z=k(t);return Vf(e,t,n,c,x=>{x.write(`let ${z} = ${y}(${c});`),x.write(`if (${z} === INVALID && typeof ${c} === "string" && ${$}.test(${c})) ${z} = ${y}(Number(${c}));`),m?x.write(`if (${z} === INVALID) { ${u}[${c}] = ${n}[${c}]; continue; }`):x.write(`if (${z} === INVALID) return INVALID;`),x.write(`if (${z} === "__proto__") continue;`);let I=k(t);x.write(`const ${I} = ${n}[${c}];`);let E=W(x,t,o.valueType,I);x.write(`${u}[${z}] = ${E};`)}),u}return Vf(e,t,n,c,m=>{m.write(`const ${a} = ${n}[${c}];`);let g=W(m,t,o.valueType,a);m.write(`${u}[${c}] = ${g};`)},"return INVALID;"),u}s(Eg,"generateRecordCheck");function Vf(e,t,r,n,o,i){let u=S(t,Object.prototype.propertyIsEnumerable),c=k(t),a=k(t),l=k(t);e.write(`const ${c} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${a} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${l} = 0; ${l} < ${a}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${n} = ${a}[${l}];`),f.write(`if (${n} === "__proto__" || !${u}.call(${r}, ${n})) continue;`),o(f)}),e.write("}"),e.write(`for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${n} = ${c}[${l}];`),f.write(`if (!${u}.call(${r}, ${n})) continue;`),i?f.write(i):o(f)}),e.write("}")}s(Vf,"emitOwnKeys");function Cg(e,t){return typeof t=="string"?X(t):S(e,t)}s(Cg,"literalPropertyKey");function Tg(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Map)) return INVALID;`);let i=k(t),u=k(t),c=k(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${u}, ${c}] of ${n}) {`),e.indented(a=>{let l=V(a,t,o.keyType,u),f=V(a,t,o.valueType,c);a.write(`${i}.set(${l}, ${f});`)}),e.write("}"),i}s(Tg,"generateMapCheck");function Dg(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Set)) return INVALID;`);let i=k(t),u=k(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${u} of ${n}) {`),e.indented(c=>{let a=V(c,t,o.valueType,u);c.write(`${i}.add(${a});`)}),e.write("}"),i}s(Dg,"generateSetCheck");function Rg(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}s(Rg,"generateFileCheck");function Lg(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let o=r._zod.pattern;if(o){let i=S(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${n})) return INVALID;`)}return n}s(Lg,"generateTemplateLiteralCheck");function jg(e,t,r,n){let o=r._zod.def,i=qe(t,o.getter),u=S(t,{parser:null});e.write(`if (!${u}.parser) {`),e.indented(a=>{a.write(`const inner = ${i}();`),a.write(`${u}.parser = function(input) {`),a.indented(l=>{l.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),l.write("return result.issues.length === 0 ? result.value : INVALID;")}),a.write("};")}),e.write("}");let c=k(t);return e.write(`const ${c} = ${u}.parser(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}s(jg,"generateLazyCheck");function Vg(e,t,r,n){let o=r._zod.def,i=V(e,t,o.in,n);if(o.transform){if(We(o.transform))throw new pe("z.compile: async transforms in pipes are not supported");let u=o.transform,a=qe(t,s(f=>{let p={value:f,issues:[],addIssue:Yu},d=u(f,p);return d instanceof Promise?Y:p.issues.length===0?d:Y},"helperFn")),l=k(t);return e.write(`const ${l} = ${a}(${i});`),e.write(`if (${l} === INVALID) return INVALID;`),V(e,t,o.out,l)}else return V(e,t,o.out,i)}s(Vg,"generatePipeCheck");function We(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}s(We,"isAsyncFunction");function Mg(e,t,r,n){let o=r._zod.def;if(o.fn){if(We(o.fn))throw new pe("z.compile: async custom predicates are not supported");let i=qe(t,o.fn),u=S(t,Wu),c=k(t);e.write(`const ${c} = ${i}(${n});`),e.write(`if (${c} instanceof Promise) ${u}();`),e.write(`if (!${c}) return INVALID;`)}else throw new Z("custom schema without a predicate function");return n}s(Mg,"generateCustomCheck");function Fg(e,t,r){let n=e._zod.run({value:r,issues:[]},{});if(n&&typeof n.then=="function")return Y;let o=n;return o.issues.length===0?o.value:t()}s(Fg,"runtimeCatch");function Kg(e,t,r,n){let o=r._zod.def;if(!o.catchValue[tn])throw new Z("catch with a callback (only a constant catch value compiles)",!1);let i=k(t);e.write(`let ${i} = (() => {`),e.indented(l=>{let f=W(l,t,o.innerType,n);l.write(`return ${f};`)}),e.write("})();");let u=S(t,o.innerType),c=qe(t,o.catchValue),a=S(t,Fg);return e.write(`if (${i} === INVALID) {`),e.indented(l=>{l.write(`${i} = ${a}(${u}, ${c}, ${n});`),l.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}s(Kg,"generateCatchCheck");function Ug(e,t,r,n){let o=r._zod.def;if(o.transform){if(We(o.transform))throw new pe("z.compile: async transforms are not supported");let i=o.transform,c=qe(t,s(l=>{let f={value:l,issues:[],addIssue:Yu},p=i(l,f);return p instanceof Promise?Y:f.issues.length===0?p:Y},"helperFn")),a=k(t);return e.write(`const ${a} = ${c}(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}return n}s(Ug,"generateTransformCheck");function Wn(e){return e.checks&&(e.checks=[...e.checks]),e}s(Wn,"snapshotChecks");function Qu(e,t){return new e(Wn({type:"string",..._(t)}))}s(Qu,"_string");function ec(e,t){return new e(Wn({type:"string",coerce:!0,..._(t)}))}s(ec,"_coercedString");function Xn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}s(Xn,"_email");function Hn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}s(Hn,"_guid");function Yn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}s(Yn,"_uuid");function Qn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}s(Qn,"_uuidv4");function eo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}s(eo,"_uuidv6");function to(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}s(to,"_uuidv7");function kr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}s(kr,"_url");function ro(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}s(ro,"_emoji");function no(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}s(no,"_nanoid");function oo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}s(oo,"_cuid");function io(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}s(io,"_cuid2");function so(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}s(so,"_ulid");function uo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}s(uo,"_xid");function co(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}s(co,"_ksuid");function ao(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}s(ao,"_ipv4");function lo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}s(lo,"_ipv6");function tc(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,..._(t)})}s(tc,"_mac");function fo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}s(fo,"_cidrv4");function po(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}s(po,"_cidrv6");function mo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}s(mo,"_base64");function ho(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}s(ho,"_base64url");function go(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}s(go,"_e164");function rc(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,..._(t)})}s(rc,"_creditCard");function nc(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,..._(t)})}s(nc,"_iban");function yo(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}s(yo,"_jwt");var oc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function zr(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}s(zr,"_isoDateTime");function Sr(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}s(Sr,"_isoDate");function Pr(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}s(Pr,"_isoTime");function Ir(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}s(Ir,"_isoDuration");function ic(e,t){return new e(Wn({type:"number",checks:[],..._(t)}))}s(ic,"_number");function sc(e,t){return new e(Wn({type:"number",coerce:!0,checks:[],..._(t)}))}s(sc,"_coercedNumber");function uc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}s(uc,"_int");function cc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",..._(t)})}s(cc,"_float32");function ac(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",..._(t)})}s(ac,"_float64");function lc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",..._(t)})}s(lc,"_int32");function fc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",..._(t)})}s(fc,"_uint32");function pc(e,t){return new e({type:"boolean",..._(t)})}s(pc,"_boolean");function dc(e,t){return new e({type:"boolean",coerce:!0,..._(t)})}s(dc,"_coercedBoolean");function mc(e,t){return new e({type:"bigint",..._(t)})}s(mc,"_bigint");function hc(e,t){return new e({type:"bigint",coerce:!0,..._(t)})}s(hc,"_coercedBigint");function gc(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",..._(t)})}s(gc,"_int64");function yc(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",..._(t)})}s(yc,"_uint64");function _c(e,t){return new e({type:"symbol",..._(t)})}s(_c,"_symbol");function $c(e,t){return new e({type:"undefined",..._(t)})}s($c,"_undefined");function wc(e,t){return new e({type:"null",..._(t)})}s(wc,"_null");function bc(e){return new e({type:"any"})}s(bc,"_any");function vc(e){return new e({type:"unknown"})}s(vc,"_unknown");function xc(e,t){return new e({type:"never",..._(t)})}s(xc,"_never");function kc(e,t){return new e({type:"void",..._(t)})}s(kc,"_void");function zc(e,t){return new e({type:"date",..._(t)})}s(zc,"_date");function Sc(e,t){return new e({type:"date",coerce:!0,..._(t)})}s(Sc,"_coercedDate");function Pc(e,t){return new e({type:"nan",..._(t)})}s(Pc,"_nan");function me(e,t){return new _n({check:"less_than",..._(t),value:e,inclusive:!1})}s(me,"_lt");function se(e,t){return new _n({check:"less_than",..._(t),value:e,inclusive:!0})}s(se,"_lte");function he(e,t){return new $n({check:"greater_than",..._(t),value:e,inclusive:!1})}s(he,"_gt");function ue(e,t){return new $n({check:"greater_than",..._(t),value:e,inclusive:!0})}s(ue,"_gte");function _o(e){return he(0,e)}s(_o,"_positive");function $o(e){return me(0,e)}s($o,"_negative");function wo(e){return se(0,e)}s(wo,"_nonpositive");function bo(e){return ue(0,e)}s(bo,"_nonnegative");function Ae(e,t){return new fs({check:"multiple_of",..._(t),value:e})}s(Ae,"_multipleOf");function Oe(e,t){return new ms({check:"max_size",..._(t),maximum:e})}s(Oe,"_maxSize");function ge(e,t){return new hs({check:"min_size",..._(t),minimum:e})}s(ge,"_minSize");function Xe(e,t){return new gs({check:"size_equals",..._(t),size:e})}s(Xe,"_size");function He(e,t){return new ys({check:"max_length",..._(t),maximum:e})}s(He,"_maxLength");function xe(e,t){return new _s({check:"min_length",..._(t),minimum:e})}s(xe,"_minLength");function Ye(e,t){return new $s({check:"length_equals",..._(t),length:e})}s(Ye,"_length");function wt(e,t){return new ws({check:"string_format",format:"regex",..._(t),pattern:e})}s(wt,"_regex");function bt(e){return new bs({check:"string_format",format:"lowercase",..._(e)})}s(bt,"_lowercase");function vt(e){return new vs({check:"string_format",format:"uppercase",..._(e)})}s(vt,"_uppercase");function xt(e,t){return new xs({check:"string_format",format:"includes",..._(t),includes:e})}s(xt,"_includes");function kt(e,t){return new ks({check:"string_format",format:"starts_with",..._(t),prefix:e})}s(kt,"_startsWith");function zt(e,t){return new zs({check:"string_format",format:"ends_with",..._(t),suffix:e})}s(zt,"_endsWith");function vo(e,t,r){return new Ss({check:"property",property:e,schema:t,..._(r)})}s(vo,"_property");function St(e,t){return new Ps({check:"properties",shape:e,..._(t)})}s(St,"_properties");function Pt(e,t){return new Is({check:"mime_type",mime:e,..._(t)})}s(Pt,"_mime");function de(e){return new As({check:"overwrite",tx:e})}s(de,"_overwrite");function It(e){return de(t=>t.normalize(e))}s(It,"_normalize");function At(){return de(e=>e.trim())}s(At,"_trim");function Ot(){return de(e=>e.toLowerCase())}s(Ot,"_toLowerCase");function Zt(){return de(e=>e.toUpperCase())}s(Zt,"_toUpperCase");function Nt(){return de(e=>pi(e))}s(Nt,"_slugify");function Ic(e,t,r){return new e({type:"array",element:t,..._(r)})}s(Ic,"_array");function Bg(e,t,r){return new e({type:"union",options:t,..._(r)})}s(Bg,"_union");function Jg(e,t,r){return new e({type:"union",options:t,inclusive:!1,..._(r)})}s(Jg,"_xor");function Gg(e,t,r,n){return new e({type:"union",options:r,discriminator:t,..._(n)})}s(Gg,"_discriminatedUnion");function qg(e,t,r){return new e({type:"intersection",left:t,right:r})}s(qg,"_intersection");function Wg(e,t,r,n){let o=r instanceof P,i=o?n:r,u=o?r:null;return new e({type:"tuple",items:t,rest:u,..._(i)})}s(Wg,"_tuple");function Xg(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,..._(n)})}s(Xg,"_record");function Hg(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,..._(n)})}s(Hg,"_map");function Yg(e,t,r){return new e({type:"set",valueType:t,..._(r)})}s(Yg,"_set");function Qg(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:n,..._(r)})}s(Qg,"_enum");function ey(e,t,r){return new e({type:"enum",entries:t,..._(r)})}s(ey,"_nativeEnum");function ty(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],..._(r)})}s(ty,"_literal");function Ac(e,t){return new e({type:"file",..._(t)})}s(Ac,"_file");function ry(e,t){return new e({type:"transform",transform:t})}s(ry,"_transform");function ny(e,t){return new e({type:"optional",innerType:t})}s(ny,"_optional");function oy(e,t){return new e({type:"nullable",innerType:t})}s(oy,"_nullable");function iy(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Wt(r)}})}s(iy,"_default");function sy(e,t,r){return new e({type:"nonoptional",innerType:t,..._(r)})}s(sy,"_nonoptional");function uy(e,t){return new e({type:"success",innerType:t})}s(uy,"_success");function cy(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:$i(r)})}s(cy,"_catch");function ay(e,t,r){return new e({type:"pipe",in:t,out:r})}s(ay,"_pipe");function ly(e,t){return new e({type:"readonly",innerType:t})}s(ly,"_readonly");function fy(e,t,r){return new e({type:"template_literal",parts:t,..._(r)})}s(fy,"_templateLiteral");function py(e,t){return new e({type:"lazy",getter:t})}s(py,"_lazy");function dy(e,t){return new e({type:"promise",innerType:t})}s(dy,"_promise");function Oc(e,t,r){let n=_(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}s(Oc,"_custom");function Zc(e,t,r){return new e({type:"custom",check:"custom",fn:t,..._(r)})}s(Zc,"_refine");function Nc(e,t){let r=Uf(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(ft(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=n.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ft(i))}},e(n.value,n)),t);return r}s(Nc,"_superRefine");function Uf(e,t){let r=new L({check:"custom",..._(t)});return r._zod.check=e,r}s(Uf,"_check");function Ec(e){let t=new L({check:"describe"});return t._zod.onattach=[r=>{let n=G.get(r)??{};G.add(r,{...n,description:e})}],t._zod.check=()=>{},t}s(Ec,"describe");function Cc(e){let t=new L({check:"meta"});return t._zod.onattach=[r=>{let n=G.get(r)??{};G.add(r,{...n,...e})}],t._zod.check=()=>{},t}s(Cc,"meta");function Tc(e,t){let r=_(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),u=new Set(o),c=e.Codec??yr,a=e.Boolean??hr,l=e.String??Be,f=new l({type:"string",error:r.error}),p=new a({type:"boolean",error:r.error}),d=new c({type:"pipe",in:f,out:p,transform:s(((m,g)=>{let y=m;return r.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:u.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...u],input:g.value,inst:d,continue:!1}),{})}),"transform"),reverseTransform:s(((m,g)=>m===!0?n[0]||"true":o[0]||"false"),"reverseTransform"),error:r.error});return d._zod.bag.truthy=n,d._zod.bag.falsy=o,d._zod.bag.case=r.case??"insensitive",d}s(Tc,"_stringbool");function Qe(e,t,r,n={}){let o=_(n),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:c=>r.test(c),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}s(Qe,"_stringFormat");function Ar(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&J(e,n,r[n]);return e}s(Ar,"assignProps");function Ze(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??G,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(Ze,"initializeContext");function K(e,t,r,n,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(r,i),!0}s(K,"handleUnrepresentable");function D(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let u={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,u),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)u.schema=c;else{let f={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,f);else{let d=u.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&&(u.ref||(u.ref=p),D(p,t,f),t.seen.get(p).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&Ar(u.schema,a),t.io==="input"&&Q(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&"_prefault"in u.schema&&((n=u.schema).default??(n.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}s(D,"processSchema");function Bf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}s(Bf,"encodeJSONPointerSegment");function Ne(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let u of e.seen.entries()){let c=e.metadataRegistry.get(u[0])?.id;if(c){let a=n.get(c);if(a&&a!==u[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,u[0])}}let o=s(u=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(u[0])?.id,d=e.external.uri??(g=>g);if(p)return{ref:d(p)};let m=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${Bf(m)}`}}let a="#",l=`${a}/${c}/`;if(u[1]===r&&!u[1].schema.id)return{ref:a};let f=u[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:l+Bf(f)}},"makeURI"),i=s(u=>{if(u[1].schema.$ref)return;let c=u[1],{ref:a,defId:l}=o(u);c.def={...c.schema},l&&(c.defId=l);let f=c.schema;for(let p in f)delete f[p];f.$ref=a},"extractToDef");if(e.cycles==="throw")for(let u of e.seen.entries()){let c=u[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
67
67
|
|
|
68
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let u of e.seen.entries()){let c=u[1];if(t===u[0]){i(u);continue}if(e.external){let l=e.external.registry.get(u[0])?.id;if(t!==u[0]&&l){i(u);continue}}if(e.metadataRegistry.get(u[0])?.id){i(u);continue}if(c.cycle){i(u);continue}c.count>1&&e.reused==="ref"&&i(u)}e.external&&(e.sharedDefsExtractedFor=e.external)}s(Ne,"extractDefs");function Gf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;Gf(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let u of Array.isArray(i)?i:[i]){if(typeof u!="string")return;r.includes(u)||r.push(u)}}delete e.anyOf,e.type=r.length===1?r[0]:r}s(Gf,"compactTypeUnion");var qf=new Set(["type","properties","required","additionalProperties"]),Bf=["oneOf","anyOf"];function Jf(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}s(Jf,"undeclaredConstraint");function Dc(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let u in i)if(!qf.has(u))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let u in i.properties){if(Object.prototype.hasOwnProperty.call(r,u))continue;let c=[];for(let l of t){let f=l.properties?.[u]??Jf(l);f!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(f))||c.push(f))}let a=c.length===1?c[0]:Dc(c)??{allOf:c};J(r,u,a)}for(let u of i.required??[])n.add(u)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let u of t){let c=Jf(u);c&&!i.some(a=>JSON.stringify(a)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}s(Dc,"foldObjects");function my(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of qf)if(o in e)return;let r=t.filter(o=>Bf.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=Dc(t);else{let o=r[0],i=Bf.find(a=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let u=t.filter(a=>a!==o),c=o[i].map(a=>Dc([...u,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Ar(e,n))}s(my,"foldIntersection");function Ee(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=s(c=>{let a=e.seen.get(c);if(a.ref===null)return;let l=a.def??a.schema,f={...l},p=a.ref;if(a.ref=null,p){n(p);let m=e.seen.get(p),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(g)):Ar(l,g),Ar(l,f),c._zod.parent===p)for(let $ in l)$==="$ref"||$==="allOf"||$ in f||delete l[$];if(g.$ref&&m.def)for(let $ in l)$==="$ref"||$==="allOf"||$ in m.def&&JSON.stringify(l[$])===JSON.stringify(m.def[$])&&delete l[$]}let d=c._zod.parent;if(d&&d!==p){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(l.$ref=m.schema.$ref,m.def))for(let g in l)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(l[g])===JSON.stringify(m.def[g])&&delete l[g]}e.override({zodSchema:c,jsonSchema:l,path:a.path??[]})},"flattenRef");if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Gf(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let l of[a.schema,a.def]){let f=l?.allOf;if(!Array.isArray(f))continue;let p=c.get(f);p?p.push(l):c.set(f,[l])}for(let a of e.intersections)for(let l of c.get(a)??[])my(l)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Ar(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let u=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,J(u,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?o.$defs=u:o.definitions=u);try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Et(t,"input",e.processors),output:Et(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}s(Ee,"finalize");function Q(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Q(n.element,r);if(n.type==="set")return Q(n.valueType,r);if(n.type==="lazy")return Q(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return Q(n.innerType,r);if(n.type==="intersection")return Q(n.left,r)||Q(n.right,r);if(n.type==="record"||n.type==="map")return Q(n.keyType,r)||Q(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Q(n.in,r)||Q(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Q(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Q(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Q(o,r))return!0;return!!(n.rest&&Q(n.rest,r))}return!1}s(Q,"isTransforming");var Rc=s((e,t={})=>r=>{let n=Ze({...r,processors:t});return D(e,n),Ne(n,e),Ee(n,e)},"createToJSONSchemaMethod"),Et=s((e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},u=Ze({...o??{},target:i,io:t,processors:r});return D(e,u),Ne(u,e),Ee(u,e)},"createStandardJSONSchemaMethod");var Ct=s((e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},"narrowMin"),Tt=s((e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},"narrowMax"),Wf=s((e,t)=>{Ct(e,"minimum",t),Tt(e,"maximum",t)},"narrowBoth"),Qf=s((e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},"addDivisor"),ep=s((e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},"addPattern"),tp=s((e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},"intersectMime"),rp=s((e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},"setFormat"),Xf=s((e,t)=>Ct(e,"minimum",t.minimum),"minContributor"),Hf=s((e,t)=>Tt(e,"maximum",t.maximum),"maxContributor"),Yf=s(e=>(t,r)=>{rp(t,r.format);let[n,o]=e[r.format];Ct(t,"minimum",n),Tt(t,"maximum",o)},"formatContributor"),hy={greater_than:s((e,t)=>Ct(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),"greater_than"),less_than:s((e,t)=>Tt(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),"less_than"),multiple_of:s((e,t)=>Qf(e,t.value),"multiple_of"),number_format:Yf(Ht),bigint_format:Yf(Yt),min_length:Xf,max_length:Hf,length_equals:s((e,t)=>Wf(e,t.length),"length_equals"),min_size:Xf,max_size:Hf,size_equals:s((e,t)=>Wf(e,t.size),"size_equals"),string_format:s((e,t)=>{rp(e,t.format),t.pattern&&ep(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)=>tp(e,t.mime),"mime_type")};function U(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)hy[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Ct(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Ct(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Tt(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Tt(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Qf(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&tp(t,o.mime);for(let i of o.patterns??[])ep(t,i);return t}s(U,"aggregateChecks");var gy={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yy=new Map([[In,Bi],[mr,Ji]]),np=s(e=>yy.get(e)??e,"exactPattern"),Vc=s((e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:u,format:c,patterns:a,contentEncoding:l,laxFormat:f}=U(e);if(typeof i=="number"&&(o.minLength=i),typeof u=="number"&&(o.maxLength=u),c&&(o.format=gy[c]??c,o.format===""&&delete o.format,(c==="time"||f)&&delete o.format),l&&(o.contentEncoding=l),a&&a.size>0){let p=[...a].map(np);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"),Mc=s((e,t,r,n)=>{let o=r,{minimum:i,maximum:u,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:l,isInt:f}=U(e);o.type=f?"integer":"number";let p=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),d=typeof a=="number"&&a<=(u??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=a,o.exclusiveMaximum=!0):o.exclusiveMaximum=a:typeof u=="number"&&(o.maximum=u),c){let g=new Set;for(let z of c)Number.isFinite(z)&&z!==0?g.add(Math.abs(z)):K(e,t,o,n,`A multipleOf divisor of ${z} cannot be represented in JSON Schema`);let[y,...$]=g;y!==void 0&&(o.multipleOf=y),$.length&&(o.allOf=[...o.allOf??[],...$.map(z=>({multipleOf:z}))])}},"numberProcessor"),Fc=s((e,t,r,n)=>{r.type="boolean"},"booleanProcessor"),Kc=s((e,t,r,n)=>{K(e,t,r,n,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),Uc=s((e,t,r,n)=>{K(e,t,r,n,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),Bc=s((e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},"nullProcessor"),Jc=s((e,t,r,n)=>{K(e,t,r,n,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),Gc=s((e,t,r,n)=>{K(e,t,r,n,"Void cannot be represented in JSON Schema")},"voidProcessor"),qc=s((e,t,r,n)=>{r.not={}},"neverProcessor"),Wc=s((e,t,r,n)=>{},"anyProcessor"),Xc=s((e,t,r,n)=>{},"unknownProcessor"),Hc=s((e,t,r,n)=>{K(e,t,r,n,"Date cannot be represented in JSON Schema")},"dateProcessor"),Yc=s((e,t,r,n)=>{let o=e._zod.def,i=ut(o.entries);if(i.length===0){r.not={};return}i.every(u=>typeof u=="number")&&(r.type="number"),i.every(u=>typeof u=="string")&&(r.type="string"),r.enum=i},"enumProcessor"),Qc=s((e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let u of o.values)if(u===void 0){if(K(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof u=="bigint"){if(K(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(u))}else i.push(u);if(i.length!==0)if(i.length===1){let u=i[0];r.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[u]:r.const=u}else i.every(u=>typeof u=="number")&&(r.type="number"),i.every(u=>typeof u=="string")&&(r.type="string"),i.every(u=>typeof u=="boolean")&&(r.type="boolean"),i.every(u=>u===null)&&(r.type="null"),r.enum=i},"literalProcessor"),ea=s((e,t,r,n)=>{K(e,t,r,n,"NaN cannot be represented in JSON Schema")},"nanProcessor"),ta=s((e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},"templateLiteralProcessor"),ra=s((e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:u,mime:c}=U(e);i!==void 0&&(o.minLength=i),u!==void 0&&(o.maxLength=u),c&&(c.length===0?o.not={}:c.length===1?o.contentMediaType=c[0]:o.anyOf=c.map(a=>({contentMediaType:a})))},"fileProcessor"),na=s((e,t,r,n)=>{r.type="boolean"},"successProcessor"),oa=s((e,t,r,n)=>{K(e,t,r,n,"Custom types cannot be represented in JSON Schema")},"customProcessor"),ia=s((e,t,r,n)=>{K(e,t,r,n,"Function types cannot be represented in JSON Schema")},"functionProcessor"),sa=s((e,t,r,n)=>{K(e,t,r,n,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),ua=s((e,t,r,n)=>{K(e,t,r,n,"Map cannot be represented in JSON Schema")},"mapProcessor"),ca=s((e,t,r,n)=>{K(e,t,r,n,"Set cannot be represented in JSON Schema")},"setProcessor"),aa=s((e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:u,maximum:c}=U(e);typeof u=="number"&&(o.minItems=u),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=D(i.element,t,{...n,path:[...n.path,"items"]})},"arrayProcessor");function Or(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Or(t.out):t.type==="catch"?Or(t.innerType):e._zod.optin}s(Or,"inputOptin");var la=s((e,t,r,n)=>{let o=r,i=e._zod.def,u=i.shape;if(Object.getOwnPropertySymbols(u).length&&K(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in u)J(o.properties,l,D(u[l],t,{...n,path:[...n.path,"properties",l]}));let a=[];for(let l of Object.keys(u)){let f=i.shape[l];(t.io==="input"?Or(f)===void 0:f._zod.optout===void 0)&&a.push(l)}a.length>0&&(o.required=a),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=D(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},"objectProcessor"),xo=s((e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,u=o.options.map((c,a)=>D(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));i?r.oneOf=u:r.anyOf=u},"unionProcessor"),fa=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.left,t,{...n,path:[...n.path,"allOf",0]}),u=D(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=s(l=>"allOf"in l&&Object.keys(l).length===1,"isSimpleIntersection"),a=[...c(i)?i.allOf:[i],...c(u)?u.allOf:[u]];r.allOf=a,t.intersections.push(a)},"intersectionProcessor"),pa=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let u=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((y,$)=>D(y,t,{...n,path:[...n.path,u,$]})),l=i.rest?D(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,f=i.items.length;for(;f>0;){let y=i.items[f-1];if(!(t.io==="input"?Or(y)!==void 0:y._zod.optout==="optional"))break;f--}let p=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=a,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:a},l&&o.items.anyOf.push(l),f>0&&(o.minItems=f),d&&(o.maxItems=p)):(o.items=a,d?o.additionalItems=!1:l&&(o.additionalItems=l),f>0&&(o.minItems=f),d&&(o.maxItems=p));let{minimum:m,maximum:g}=U(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)},"tupleProcessor");function Lc(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let y=Lc(e,g,r);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let $=y.map(z=>Lc(e,z,r));$.some((z,x)=>z!==y[x])&&(t={...t,[g]:$})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(g=>typeof g=="number"))return t;let{minimum:u,maximum:c,exclusiveMinimum:a,exclusiveMaximum:l,multipleOf:f,format:p,id:d,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(n.includes("number")?ve:ur).source)),m}s(Lc,"stringifyKeyNames");var jc=new WeakMap;function _y(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of jc.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let u=Lc(t,i,new Set);u!==i&&r.set(i,u)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}s(_y,"rewriteKeyNames");var da=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let u=i.keyType,c=U(u).patterns;if(i.mode==="loose"&&c&&c.size>0){let f=D(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of c)J(o.patternProperties,np(p).source,f)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let f=jc.get(t);f||(f=[],jc.set(t,f),t.deferred.push(()=>_y(t))),f.push(e)}o.additionalProperties=D(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=u._zod.values,l=t.io==="input"&&Or(i.valueType)!==void 0;if(a&&!i.partial&&!l){let f=[...a].filter(p=>typeof p=="string"||typeof p=="number");f.length>0&&(o.required=f.map(String))}},"recordProcessor"),ma=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.innerType,t,n),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},"nullableProcessor"),ha=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"nonoptionalProcessor"),ga=Symbol();function op(e,t,r,n,o){let i=!1,u=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(i=!0,null));return i?(K(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ga):JSON.parse(u)}s(op,"serializeDefaultValue");var ya=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let u=op(o.defaultValue,e,t,r,n);u!==ga&&(r.default=u)},"defaultProcessor"),_a=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let u=op(o.defaultValue,e,t,r,n);u!==ga&&(r._prefault=u)},"prefaultProcessor"),$a=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{K(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=u},"catchProcessor"),wa=s((e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),u=t.io==="input"?i?o.out:o.in:o.out;D(u,t,n);let c=t.seen.get(e);c.ref=u},"pipeProcessor"),ba=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},"readonlyProcessor"),va=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"promiseProcessor"),ko=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"optionalProcessor"),xa=s((e,t,r,n)=>{let o=e._zod.innerType;D(o,t,n);let i=t.seen.get(e);i.ref=o},"lazyProcessor"),vo={string:Vc,number:Mc,boolean:Fc,bigint:Kc,symbol:Uc,null:Bc,undefined:Jc,void:Gc,never:qc,any:Wc,unknown:Xc,date:Hc,enum:Yc,literal:Qc,nan:ea,template_literal:ta,file:ra,success:na,custom:oa,function:ia,transform:sa,map:ua,set:ca,array:aa,object:la,union:xo,intersection:fa,tuple:pa,record:da,nullable:ma,nonoptional:ha,default:ya,prefault:_a,catch:$a,pipe:wa,readonly:ba,promise:va,optional:ko,lazy:xa};function zo(e,t){if("_idmap"in e){let n=e,o=Ze({...t,processors:vo}),i={};for(let a of n._idmap.entries()){let[l,f]=a;D(f,o)}let u={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let a of n._idmap.entries()){let[l,f]=a;Ne(o,f),J(u,l,Ee(o,f))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";u.__shared={[a]:i}}return{schemas:u}}let r=Ze({...t,processors:vo});return D(e,r),Ne(r,e),Ee(r,e)}s(zo,"toJSONSchema");var So=class{static{s(this,"JSONSchemaGenerator")}get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Ze({processors:vo,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return D(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Ne(this.ctx,t);let n=Ee(this.ctx,t),{"~standard":o,...i}=n;return i}};var ip={};var Kt={};$e(Kt,{ZodAny:()=>Ba,ZodArray:()=>Wa,ZodBase64:()=>Bo,ZodBase64URL:()=>Jo,ZodBigInt:()=>Mt,ZodBigIntFormat:()=>Wo,ZodBoolean:()=>Vt,ZodCIDRv4:()=>Ko,ZodCIDRv6:()=>Uo,ZodCUID:()=>Do,ZodCUID2:()=>Ro,ZodCatch:()=>gl,ZodCodec:()=>Vr,ZodCreditCard:()=>Ra,ZodCustom:()=>Mr,ZodCustomStringFormat:()=>nt,ZodDate:()=>Cr,ZodDefault:()=>ll,ZodDiscriminatedUnion:()=>Ha,ZodE164:()=>Go,ZodEmail:()=>No,ZodEmoji:()=>Co,ZodEnum:()=>Rt,ZodExactOptional:()=>Qo,ZodFile:()=>sl,ZodFunction:()=>Sl,ZodGUID:()=>Eo,ZodIBAN:()=>La,ZodIPv4:()=>Mo,ZodIPv6:()=>Fo,ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,ZodInstanceOf:()=>Al,ZodIntersection:()=>Ya,ZodJWT:()=>qo,ZodKSUID:()=>Vo,ZodLazy:()=>xl,ZodLiteral:()=>il,ZodMAC:()=>Da,ZodMap:()=>nl,ZodNaN:()=>_l,ZodNanoID:()=>To,ZodNever:()=>Ga,ZodNonOptional:()=>ei,ZodNull:()=>Ka,ZodNullable:()=>al,ZodNumber:()=>jt,ZodNumberFormat:()=>ot,ZodObject:()=>Dr,ZodOptional:()=>Lr,ZodPipe:()=>jr,ZodPrefault:()=>pl,ZodPreprocess:()=>$l,ZodPromise:()=>zl,ZodReadonly:()=>wl,ZodRecord:()=>Dt,ZodSet:()=>ol,ZodString:()=>Lt,ZodStringFormat:()=>R,ZodSuccess:()=>hl,ZodSymbol:()=>Ma,ZodTemplateLiteral:()=>vl,ZodTransform:()=>ul,ZodTuple:()=>el,ZodType:()=>A,ZodULID:()=>Lo,ZodURL:()=>Er,ZodUUID:()=>ye,ZodUndefined:()=>Fa,ZodUnion:()=>Rr,ZodUnknown:()=>Ja,ZodVoid:()=>qa,ZodXID:()=>jo,ZodXor:()=>Xa,_ZodString:()=>Zo,_default:()=>fl,_function:()=>yd,any:()=>qp,array:()=>Tr,base64:()=>Ip,base64url:()=>Ap,bigint:()=>Kp,boolean:()=>Va,catch:()=>yl,check:()=>_d,cidrv4:()=>Sp,cidrv6:()=>Pp,codec:()=>dd,creditCard:()=>Zp,cuid:()=>_p,cuid2:()=>$p,currencyCode:()=>Rp,custom:()=>$d,date:()=>Xp,describe:()=>wd,discriminatedUnion:()=>rd,e164:()=>Op,email:()=>cp,emoji:()=>gp,enum:()=>Ho,exactOptional:()=>cl,file:()=>ad,float32:()=>jp,float64:()=>Vp,function:()=>yd,guid:()=>ap,hash:()=>Lp,hex:()=>Dp,hostname:()=>Tp,httpUrl:()=>hp,iban:()=>Np,instanceof:()=>vd,int:()=>Ao,int32:()=>Mp,int64:()=>Up,intersection:()=>Qa,invertCodec:()=>md,ipv4:()=>xp,ipv6:()=>zp,json:()=>kd,jwt:()=>Ep,keyof:()=>Hp,ksuid:()=>vp,lazy:()=>kl,literal:()=>cd,looseObject:()=>ed,looseRecord:()=>od,mac:()=>kp,map:()=>id,meta:()=>bd,nan:()=>pd,nanoid:()=>yp,nativeEnum:()=>ud,never:()=>Xo,nonoptional:()=>ml,null:()=>Ua,nullable:()=>Nr,nullish:()=>ld,number:()=>ja,object:()=>Yp,optional:()=>tt,partialRecord:()=>nd,pipe:()=>Oo,prefault:()=>dl,preprocess:()=>zd,promise:()=>gd,readonly:()=>bl,record:()=>rl,refine:()=>Pl,set:()=>sd,strictObject:()=>Qp,string:()=>Zr,stringFormat:()=>Cp,stringbool:()=>xd,success:()=>fd,superRefine:()=>Il,symbol:()=>Jp,templateLiteral:()=>hd,transform:()=>Yo,tuple:()=>tl,uint32:()=>Fp,uint64:()=>Bp,ulid:()=>wp,undefined:()=>Gp,union:()=>Ft,unknown:()=>et,url:()=>mp,uuid:()=>lp,uuidv4:()=>fp,uuidv6:()=>pp,uuidv7:()=>dp,void:()=>Wp,xid:()=>bp,xor:()=>td});var Po={};$e(Po,{endsWith:()=>zt,gt:()=>he,gte:()=>ue,includes:()=>xt,length:()=>Ye,lowercase:()=>bt,lt:()=>me,lte:()=>se,maxLength:()=>He,maxSize:()=>Oe,mime:()=>Pt,minLength:()=>xe,minSize:()=>ge,multipleOf:()=>Ae,negative:()=>_o,nonnegative:()=>wo,nonpositive:()=>$o,normalize:()=>It,overwrite:()=>de,positive:()=>yo,properties:()=>St,property:()=>bo,regex:()=>wt,size:()=>Xe,slugify:()=>Nt,startsWith:()=>kt,toLowerCase:()=>Ot,toUpperCase:()=>Zt,trim:()=>At,uppercase:()=>vt});var sp=new WeakSet([Object.prototype,Error.prototype]);function Io(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}s(Io,"_lazyMethod");var up=s((e,t)=>{zi.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);sp.has(r)||(sp.add(r),Io(r,"format",n=>o=>nr(n,o)),Io(r,"flatten",n=>o=>rr(n,o)),Io(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ct,2)}),Io(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ct,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),wy=h("ZodError",up),ie=h("ZodError",up,void 0,{Parent:Error});var ka=pt(ie),za=dt(ie),Sa=mt(ie),Pa=ht(ie),Ia=on(ie),Aa=sn(ie),Oa=un(ie),Za=cn(ie),Na=an(ie),Ea=ln(ie),Ca=fn(ie),Ta=pn(ie);function vy(){B.localeError||M(vr())}s(vy,"_ensureDefaultLocale");function rt(){B.memoizer||M({memoizer:br()})}s(rt,"_ensureDefaultMemoizer");var A=h("ZodType",(e,t)=>(vy(),P.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(v.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return C(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Pl(e,t))},superRefine(e,t){return this.check(Il(e,t))},overwrite(e){return this.check(de(e))},optional(){return tt(this)},exactOptional(){return cl(this)},nullable(){return Nr(this)},nullish(){return tt(Nr(this))},nonoptional(e){return ml(this,e)},array(){return Tr(this)},or(e){return Ft([this,e])},and(e){return Qa(this,e)},transform(e){return Oo(this,Yo(e))},default(e){return fl(this,e)},prefault(e){return dl(this,e)},catch(e){return yl(this,e)},pipe(e){return Oo(this,e)},readonly(){return bl(this)},describe(e){let t=this.clone();return G.add(t,{description:e}),t},meta(...e){if(e.length===0)return G.get(this);let t=this.clone();return G.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 v.hide(this,"~standard",{...xn(this),jsonSchema:{input:Et(this,"input"),output:Et(this,"output")}})},set"~standard"(e){v.own(this,"~standard",e)},parse:s(function e(t,r){return ka(this,t,r,{callee:e})},"_parse"),parseAsync:s(async function e(t,r){return await za(this,t,r,{callee:e})},"_parseAsync"),safeParse(e,t){return Sa(this,e,t)},async safeParseAsync(e,t){return Pa(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){v.own(this,"spa",e)},validate(e,t){return or(this,e,t)},validateAsync(e,t){return ir(this,e,t)},encode:s(function e(t,r){return Ia(this,t,r,{callee:e})},"_encode"),decode:s(function e(t,r){return Aa(this,t,r,{callee:e})},"_decode"),encodeAsync:s(async function e(t,r){return await Oa(this,t,r,{callee:e})},"_encodeAsync"),decodeAsync:s(async function e(t,r){return await Za(this,t,r,{callee:e})},"_decodeAsync"),safeEncode(e,t){return Na(this,e,t)},safeDecode(e,t){return Ea(this,e,t)},async safeEncodeAsync(e,t){return Ca(this,e,t)},async safeDecodeAsync(e,t){return Ta(this,e,t)},toJSONSchema(e){return Rc(this,{})(e)},get description(){return G.get(this)?.description},get _def(){return this._zod.def}}),Zo=h("_ZodString",(e,t)=>{Be.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vc(e,r,n,o)},v.derived({format:s(e=>U(e).format??null,"format"),minLength:s(e=>U(e).minimum??null,"minLength"),maxLength:s(e=>U(e).maximum??null,"maxLength")},{regex(...e){return this.check(wt(...e))},includes(...e){return this.check(xt(...e))},startsWith(...e){return this.check(kt(...e))},endsWith(...e){return this.check(zt(...e))},min(...e){return this.check(xe(...e))},max(...e){return this.check(He(...e))},length(...e){return this.check(Ye(...e))},nonempty(...e){return this.check(xe(1,...e))},lowercase(e){return this.check(bt(e))},uppercase(e){return this.check(vt(e))},trim(){return this.check(At())},normalize(...e){return this.check(It(...e))},toLowerCase(){return this.check(Ot())},toUpperCase(){return this.check(Zt())},slugify(){return this.check(Nt())}})),Lt=h("ZodString",(e,t)=>{Be.init(e,t),Zo.init(e,t)},{email(e){return this.check(Wn(No,e))},url(e){return this.check(kr(Er,e))},jwt(e){return this.check(go(qo,e))},emoji(e){return this.check(to(Co,e))},guid(e){return this.check(Xn(Eo,e))},uuid(e){return this.check(Hn(ye,e))},uuidv4(e){return this.check(Yn(ye,e))},uuidv6(e){return this.check(Qn(ye,e))},uuidv7(e){return this.check(eo(ye,e))},nanoid(e){return this.check(ro(To,e))},cuid(e){return this.check(no(Do,e))},cuid2(e){return this.check(oo(Ro,e))},ulid(e){return this.check(io(Lo,e))},base64(e){return this.check(po(Bo,e))},base64url(e){return this.check(mo(Jo,e))},xid(e){return this.check(so(jo,e))},ksuid(e){return this.check(uo(Vo,e))},ipv4(e){return this.check(co(Mo,e))},ipv6(e){return this.check(ao(Fo,e))},cidrv4(e){return this.check(lo(Ko,e))},cidrv6(e){return this.check(fo(Uo,e))},e164(e){return this.check(ho(Go,e))},datetime(e){return this.check(zr(Ce,e))},date(e){return this.check(Sr(Te,e))},time(e){return this.check(Pr(De,e))},duration(e){return this.check(Ir(Re,e))}});function Zr(e){return Qu(Lt,e)}s(Zr,"string");var R=h("ZodStringFormat",(e,t)=>{T.init(e,t),Zo.init(e,t)}),Ce=h("ZodISODateTime",(e,t)=>{Bs.init(e,t),R.init(e,t)}),Te=h("ZodISODate",(e,t)=>{Js.init(e,t),R.init(e,t)}),De=h("ZodISOTime",(e,t)=>{Gs.init(e,t),R.init(e,t)}),Re=h("ZodISODuration",(e,t)=>{qs.init(e,t),R.init(e,t)}),No=h("ZodEmail",(e,t)=>{Cs.init(e,t),R.init(e,t)});function cp(e){return Wn(No,e)}s(cp,"email");var Eo=h("ZodGUID",(e,t)=>{Ns.init(e,t),R.init(e,t)});function ap(e){return Xn(Eo,e)}s(ap,"guid");var ye=h("ZodUUID",(e,t)=>{Es.init(e,t),R.init(e,t)});function lp(e){return Hn(ye,e)}s(lp,"uuid");function fp(e){return Yn(ye,e)}s(fp,"uuidv4");function pp(e){return Qn(ye,e)}s(pp,"uuidv6");function dp(e){return eo(ye,e)}s(dp,"uuidv7");var Er=h("ZodURL",(e,t)=>{Rs.init(e,t),R.init(e,t)});function mp(e){return kr(Er,e)}s(mp,"url");function hp(e){return kr(Er,{protocol:sr,hostname:qi,...v.normalizeParams(e)})}s(hp,"httpUrl");var Co=h("ZodEmoji",(e,t)=>{Ls.init(e,t),R.init(e,t)});function gp(e){return to(Co,e)}s(gp,"emoji");var To=h("ZodNanoID",(e,t)=>{js.init(e,t),R.init(e,t)});function yp(e){return ro(To,e)}s(yp,"nanoid");var Do=h("ZodCUID",(e,t)=>{Vs.init(e,t),R.init(e,t)});function _p(e){return no(Do,e)}s(_p,"cuid");var Ro=h("ZodCUID2",(e,t)=>{Ms.init(e,t),R.init(e,t)});function $p(e){return oo(Ro,e)}s($p,"cuid2");var Lo=h("ZodULID",(e,t)=>{Fs.init(e,t),R.init(e,t)});function wp(e){return io(Lo,e)}s(wp,"ulid");var jo=h("ZodXID",(e,t)=>{Ks.init(e,t),R.init(e,t)});function bp(e){return so(jo,e)}s(bp,"xid");var Vo=h("ZodKSUID",(e,t)=>{Us.init(e,t),R.init(e,t)});function vp(e){return uo(Vo,e)}s(vp,"ksuid");var Mo=h("ZodIPv4",(e,t)=>{Ws.init(e,t),R.init(e,t)});function xp(e){return co(Mo,e)}s(xp,"ipv4");var Da=h("ZodMAC",(e,t)=>{Hs.init(e,t),R.init(e,t)});function kp(e){return tc(Da,e)}s(kp,"mac");var Fo=h("ZodIPv6",(e,t)=>{Xs.init(e,t),R.init(e,t)});function zp(e){return ao(Fo,e)}s(zp,"ipv6");var Ko=h("ZodCIDRv4",(e,t)=>{Ys.init(e,t),R.init(e,t)});function Sp(e){return lo(Ko,e)}s(Sp,"cidrv4");var Uo=h("ZodCIDRv6",(e,t)=>{Qs.init(e,t),R.init(e,t)});function Pp(e){return fo(Uo,e)}s(Pp,"cidrv6");var Bo=h("ZodBase64",(e,t)=>{eu.init(e,t),R.init(e,t)});function Ip(e){return po(Bo,e)}s(Ip,"base64");var Jo=h("ZodBase64URL",(e,t)=>{tu.init(e,t),R.init(e,t)});function Ap(e){return mo(Jo,e)}s(Ap,"base64url");var Go=h("ZodE164",(e,t)=>{ru.init(e,t),R.init(e,t)});function Op(e){return ho(Go,e)}s(Op,"e164");var Ra=h("ZodCreditCard",(e,t)=>{nu.init(e,t),R.init(e,t)});function Zp(e){return rc(Ra,e)}s(Zp,"creditCard");var La=h("ZodIBAN",(e,t)=>{ou.init(e,t),R.init(e,t)});function Np(e){return nc(La,e)}s(Np,"iban");var qo=h("ZodJWT",(e,t)=>{iu.init(e,t),R.init(e,t)});function Ep(e){return go(qo,e)}s(Ep,"jwt");var nt=h("ZodCustomStringFormat",(e,t)=>{su.init(e,t),R.init(e,t)});function Cp(e,t,r={}){return Qe(nt,e,t,r)}s(Cp,"stringFormat");function Tp(e){return Qe(nt,"hostname",Gi,e)}s(Tp,"hostname");function Dp(e){return Qe(nt,"hex",cs,e)}s(Dp,"hex");function Rp(e){return Qe(nt,"currency_code",Xi,e)}s(Rp,"currencyCode");function Lp(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=le[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Qe(nt,n,o,t)}s(Lp,"hash");var jt=h("ZodNumber",(e,t)=>{En.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mc(e,r,n,o),e.isFinite=!0},v.derived({minValue:s(e=>{let{minimum:t,exclusiveMinimum:r}=U(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},"minValue"),maxValue:s(e=>{let{maximum:t,exclusiveMaximum:r}=U(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},"maxValue"),isInt:s(e=>{let{isInt:t,multipleOf:r}=U(e);return!!t||!!r?.some(Number.isSafeInteger)},"isInt"),format:s(e=>U(e).format??null,"format")},{gt(e,t){return this.check(he(e,t))},gte(e,t){return this.check(ue(e,t))},min(e,t){return this.check(ue(e,t))},lt(e,t){return this.check(me(e,t))},lte(e,t){return this.check(se(e,t))},max(e,t){return this.check(se(e,t))},int(e){return this.check(Ao(e))},safe(e){return this.check(Ao(e))},positive(e){return this.check(he(0,e))},nonnegative(e){return this.check(ue(0,e))},negative(e){return this.check(me(0,e))},nonpositive(e){return this.check(se(0,e))},multipleOf(e,t){return this.check(Ae(e,t))},step(e,t){return this.check(Ae(e,t))},finite(){return this}}));function ja(e){return ic(jt,e)}s(ja,"number");var ot=h("ZodNumberFormat",(e,t)=>{uu.init(e,t),jt.init(e,t)});function Ao(e){return uc(ot,e)}s(Ao,"int");function jp(e){return cc(ot,e)}s(jp,"float32");function Vp(e){return ac(ot,e)}s(Vp,"float64");function Mp(e){return lc(ot,e)}s(Mp,"int32");function Fp(e){return fc(ot,e)}s(Fp,"uint32");var Vt=h("ZodBoolean",(e,t)=>{hr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fc(e,r,n,o)});function Va(e){return pc(Vt,e)}s(Va,"boolean");var Mt=h("ZodBigInt",(e,t)=>{Cn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kc(e,r,n,o)},v.derived({minValue:s(e=>U(e).minimum??null,"minValue"),maxValue:s(e=>U(e).maximum??null,"maxValue"),format:s(e=>U(e).format??null,"format")},{gte(e,t){return this.check(ue(e,t))},min(e,t){return this.check(ue(e,t))},gt(e,t){return this.check(he(e,t))},lt(e,t){return this.check(me(e,t))},lte(e,t){return this.check(se(e,t))},max(e,t){return this.check(se(e,t))},positive(e){return this.check(he(BigInt(0),e))},negative(e){return this.check(me(BigInt(0),e))},nonpositive(e){return this.check(se(BigInt(0),e))},nonnegative(e){return this.check(ue(BigInt(0),e))},multipleOf(e,t){return this.check(Ae(e,t))}}));function Kp(e){return mc(Mt,e)}s(Kp,"bigint");var Wo=h("ZodBigIntFormat",(e,t)=>{cu.init(e,t),Mt.init(e,t)});function Up(e){return gc(Wo,e)}s(Up,"int64");function Bp(e){return yc(Wo,e)}s(Bp,"uint64");var Ma=h("ZodSymbol",(e,t)=>{au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uc(e,r,n,o)});function Jp(e){return _c(Ma,e)}s(Jp,"symbol");var Fa=h("ZodUndefined",(e,t)=>{lu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jc(e,r,n,o)});function Gp(e){return $c(Fa,e)}s(Gp,"_undefined");var Ka=h("ZodNull",(e,t)=>{fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bc(e,r,n,o)});function Ua(e){return wc(Ka,e)}s(Ua,"_null");var Ba=h("ZodAny",(e,t)=>{pu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wc(e,r,n,o)});function qp(){return bc(Ba)}s(qp,"any");var Ja=h("ZodUnknown",(e,t)=>{du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xc(e,r,n,o)});function et(){return vc(Ja)}s(et,"unknown");var Ga=h("ZodNever",(e,t)=>{mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qc(e,r,n,o)});function Xo(e){return xc(Ga,e)}s(Xo,"never");var qa=h("ZodVoid",(e,t)=>{hu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gc(e,r,n,o)});function Wp(e){return kc(qa,e)}s(Wp,"_void");var Cr=h("ZodDate",(e,t)=>{gu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hc(e,r,n,o),e.min=(r,n)=>e.check(ue(r,n)),e.max=(r,n)=>e.check(se(r,n))},v.derived({minDate:s(e=>{let{minimum:t}=U(e);return t?new Date(t):null},"minDate"),maxDate:s(e=>{let{maximum:t}=U(e);return t?new Date(t):null},"maxDate")},{}));function Xp(e){return zc(Cr,e)}s(Xp,"date");var Wa=h("ZodArray",(e,t)=>{rt(),yu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>aa(e,r,n,o),e.element=t.element},{min(e,t){return this.check(xe(e,t))},nonempty(e){return this.check(xe(1,e))},max(e,t){return this.check(He(e,t))},length(e,t){return this.check(Ye(e,t))},unwrap(){return this.element}});function Tr(e,t){return Ic(Wa,e,t)}s(Tr,"array");function Hp(e){let t=e._zod.def.shape;return Ho(Object.keys(t))}s(Hp,"keyof");var Dr=h("ZodObject",(e,t)=>{rt(),_u.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>la(e,r,n,o),v.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ho(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(v.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(v.mergeDefs(this._zod.def,{catchall:et()}))},loose(){return this.clone(v.mergeDefs(this._zod.def,{catchall:et()}))},strict(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Xo()}))},strip(){return this.clone(v.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return v.extend(this,e)},safeExtend(e){return v.safeExtend(this,e)},merge(e){return v.merge(this,e)},pick(e){return v.pick(this,e)},omit(e){return v.omit(this,e)},partial(...e){return v.partial(Lr,this,e[0])},exactPartial(...e){return v.partial(Qo,this,e[0],"exactPartial")},required(...e){return v.required(ei,this,e[0])}});function Yp(e,t){let r={type:"object",shape:e??{},...v.normalizeParams(t)};return new Dr(r)}s(Yp,"object");function Qp(e,t){return new Dr({type:"object",shape:e,catchall:Xo(),...v.normalizeParams(t)})}s(Qp,"strictObject");function ed(e,t){return new Dr({type:"object",shape:e,catchall:et(),...v.normalizeParams(t)})}s(ed,"looseObject");var Rr=h("ZodUnion",(e,t)=>{gr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xo(e,r,n,o),e.options=t.options});function Ft(e,t){return new Rr({type:"union",options:e,...v.normalizeParams(t)})}s(Ft,"union");var Xa=h("ZodXor",(e,t)=>{Rr.init(e,t),$u.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xo(e,r,n,o),e.options=t.options});function td(e,t){return new Xa({type:"union",options:e,inclusive:!1,...v.normalizeParams(t)})}s(td,"xor");var Ha=h("ZodDiscriminatedUnion",(e,t)=>{Rr.init(e,t),bu.init(e,t)});function rd(e,t,r){return new Ha({type:"union",options:t,discriminator:e,...v.normalizeParams(r)})}s(rd,"discriminatedUnion");var Ya=h("ZodIntersection",(e,t)=>{vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fa(e,r,n,o)});function Qa(e,t){return new Ya({type:"intersection",left:e,right:t})}s(Qa,"intersection");var el=h("ZodTuple",(e,t)=>{rt(),Tn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pa(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Lr({type:"optional",innerType:t}))})}});function tl(e,t,r){let n=t instanceof P,o=n?r:t,i=n?t:null;return new el({type:"tuple",items:e,rest:i,...v.normalizeParams(o)})}s(tl,"tuple");var Dt=h("ZodRecord",(e,t)=>{rt(),xu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>da(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function rl(e,t,r){return!t||!t._zod?new Dt({type:"record",keyType:Zr(),valueType:e,...v.normalizeParams(t)}):new Dt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r)})}s(rl,"record");function nd(e,t,r){return new Dt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r),partial:!0})}s(nd,"partialRecord");function od(e,t,r){return new Dt({type:"record",keyType:e,valueType:t,mode:"loose",...v.normalizeParams(r)})}s(od,"looseRecord");var nl=h("ZodMap",(e,t)=>{rt(),ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ua(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(ge(...r)),e.nonempty=r=>e.check(ge(1,r)),e.max=(...r)=>e.check(Oe(...r)),e.size=(...r)=>e.check(Xe(...r))});function id(e,t,r){return new nl({type:"map",keyType:e,valueType:t,...v.normalizeParams(r)})}s(id,"map");var ol=h("ZodSet",(e,t)=>{rt(),zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ca(e,r,n,o),e.min=(...r)=>e.check(ge(...r)),e.nonempty=r=>e.check(ge(1,r)),e.max=(...r)=>e.check(Oe(...r)),e.size=(...r)=>e.check(Xe(...r))});function sd(e,t){return new ol({type:"set",valueType:e,...v.normalizeParams(t)})}s(sd,"set");var Rt=h("ZodEnum",(e,t)=>{Su.init(e,t),A.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Yc(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let u of n)if(r.has(u))i[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Rt({...t,checks:[],...v.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let u of n)if(r.has(u))delete i[u];else throw new Error(`Key ${u} not found in enum`);return new Rt({...t,checks:[],...v.normalizeParams(o),entries:i})}});function Ho(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Rt({type:"enum",entries:r,...v.normalizeParams(t)})}s(Ho,"_enum");function ud(e,t){return new Rt({type:"enum",entries:e,...v.normalizeParams(t)})}s(ud,"nativeEnum");var il=h("ZodLiteral",(e,t)=>{Pu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qc(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function cd(e,t){return new il({type:"literal",values:Array.isArray(e)?e:[e],...v.normalizeParams(t)})}s(cd,"literal");var sl=h("ZodFile",(e,t)=>{Iu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ra(e,r,n,o),e.min=(r,n)=>e.check(ge(r,n)),e.max=(r,n)=>e.check(Oe(r,n)),e.mime=(r,n)=>e.check(Pt(Array.isArray(r)?r:[r],n))});function ad(e){return Ac(sl,e)}s(ad,"file");var ul=h("ZodTransform",(e,t)=>{rt(),Au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sa(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(v.issue(i,r.value,t));else{let u=i;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),"input"in u||(u.input=r.value),u.inst??(u.inst=e),r.issues.push(v.issue(u))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Yo(e){return new ul({type:"transform",transform:e})}s(Yo,"transform");var Lr=h("ZodOptional",(e,t)=>{Dn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function tt(e){return new Lr({type:"optional",innerType:e})}s(tt,"optional");var Qo=h("ZodExactOptional",(e,t)=>{Ou.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cl(e){return new Qo({type:"optional",innerType:e})}s(cl,"exactOptional");var al=h("ZodNullable",(e,t)=>{Zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ma(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Nr(e){return new al({type:"nullable",innerType:e})}s(Nr,"nullable");function ld(e){return tt(Nr(e))}s(ld,"nullish");var ll=h("ZodDefault",(e,t)=>{Nu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ya(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fl(e,t){return new ll({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}s(fl,"_default");var pl=h("ZodPrefault",(e,t)=>{Eu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function dl(e,t){return new pl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}s(dl,"prefault");var ei=h("ZodNonOptional",(e,t)=>{Cu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ha(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ml(e,t){return new ei({type:"nonoptional",innerType:e,...v.normalizeParams(t)})}s(ml,"nonoptional");var hl=h("ZodSuccess",(e,t)=>{Tu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>na(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fd(e){return new hl({type:"success",innerType:e})}s(fd,"success");var gl=h("ZodCatch",(e,t)=>{Du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yl(e,t){return new gl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:v.constantCatch(t)})}s(yl,"_catch");var _l=h("ZodNaN",(e,t)=>{Ru.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ea(e,r,n,o)});function pd(e){return Pc(_l,e)}s(pd,"nan");var jr=h("ZodPipe",(e,t)=>{Rn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wa(e,r,n,o),e.in=t.in,e.out=t.out});function Oo(e,t){return new jr({type:"pipe",in:e,out:t})}s(Oo,"pipe");var Vr=h("ZodCodec",(e,t)=>{jr.init(e,t),yr.init(e,t)});function dd(e,t,r){return new Vr({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}s(dd,"codec");function md(e){let t=e._zod.def;return new Vr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}s(md,"invertCodec");var $l=h("ZodPreprocess",(e,t)=>{jr.init(e,t),Lu.init(e,t)}),wl=h("ZodReadonly",(e,t)=>{ju.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ba(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bl(e){return new wl({type:"readonly",innerType:e})}s(bl,"readonly");var vl=h("ZodTemplateLiteral",(e,t)=>{Vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ta(e,r,n,o)});function hd(e,t){return new vl({type:"template_literal",parts:e,...v.normalizeParams(t)})}s(hd,"templateLiteral");var xl=h("ZodLazy",(e,t)=>{_r.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xa(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function kl(e){return new xl({type:"lazy",getter:e})}s(kl,"lazy");var zl=h("ZodPromise",(e,t)=>{Fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>va(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gd(e){return new zl({type:"promise",innerType:e})}s(gd,"promise");var Sl=h("ZodFunction",(e,t)=>{Mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ia(e,r,n,o)});function yd(e){return new Sl({type:"function",input:Array.isArray(e?.input)?tl(e?.input):e?.input??Tr(et()),output:e?.output??et()})}s(yd,"_function");var Mr=h("ZodCustom",(e,t)=>{Ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oa(e,r,n,o)});function _d(e){let t=new L({check:"custom"});return t._zod.check=e,t}s(_d,"check");function $d(e,t){return Oc(Mr,e??(()=>!0),t)}s($d,"custom");function Pl(e,t={}){return Zc(Mr,e,t)}s(Pl,"refine");function Il(e,t){return Nc(e,t)}s(Il,"superRefine");var wd=Ec,bd=Cc,Al=h("ZodInstanceOf",(e,t)=>{Mr.init(e,t)},{properties(e,t){return this.check(St(e,t))}});function vd(e,t={}){let r=new Al({type:"custom",check:"custom",fn:s(n=>n instanceof e,"fn"),abort:!0,...v.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}s(vd,"_instanceof");var xd=s((...e)=>Tc({Codec:Vr,Boolean:Vt,String:Lt},...e),"stringbool");function kd(e){let t=kl(()=>Ft([Zr(e),ja(),Va(),Ua(),Tr(t),rl(Zr(),t)]));return t}s(kd,"json");function zd(e,t){return new $l({type:"pipe",in:Yo(e),out:t})}s(zd,"preprocess");var xy={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 ky(e){M({customError:e})}s(ky,"setErrorMap");function zy(){return M().customError}s(zy,"getErrorMap");var Ol;Ol||(Ol={});var Fr={};$e(Fr,{ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,date:()=>Py,datetime:()=>Sy,duration:()=>Ay,time:()=>Iy});function Sy(e){return zr(Ce,e)}s(Sy,"datetime");function Py(e){return Sr(Te,e)}s(Py,"date");function Iy(e){return Pr(De,e)}s(Iy,"time");function Ay(e){return Ir(Re,e)}s(Ay,"duration");var w={...Kt,...Po,iso:Fr},Oy=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 Zy(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}s(Zy,"detectVersion");function Sd(e,t){return e.map((r,n)=>n<t?r:r.optional())}s(Sd,"applyMinItems");function Ny(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}s(Ny,"decodeJSONPointerSegment");function Ey(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let o=r[1]===void 0?void 0:Ny(r[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}s(Ey,"resolveRef");function Cy(e,t){return w.transform(n=>n).check(n=>{let o=n.value;if(typeof o!="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties&&n.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&n.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0}),t.keySchema)for(let u of i){let c=t.keySchema.safeParse(u);c.success||n.issues.push({code:"invalid_key",origin:"record",issues:c.error.issues,input:u,path:[u],continue:!0})}}).pipe(e)}s(Cy,"checkObjectGuards");function Zl(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let n=String(e);return`${r[0]}${n.length}:${n}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let u of e){let c=Zl(u,t);if(c===null)return null;i.push(c)}return`a${i.length}:[${i.join(",")}]`}let n=Object.keys(e).sort(),o=[];for(let i of n){let u=Zl(e[i],t);if(u===null)return null;o.push(`${i.length}:${i}=${u}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}s(Zl,"canonicalKey");var Ty=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Dy=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Kr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Kr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>Ty.has(t)?Kr(r):!Dy.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(Kr))}s(Kr,"containsRef");function Pd(e){return e===1?"element":"elements"}s(Pd,"plural");function Ry(e,t){return w.transform(n=>n).check(n=>{let o=n.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let u=0;u<o.length;u++){let c=Zl(o[u],new Set);if(c===null)continue;let a=i.get(c);if(a===void 0){i.set(c,u);continue}n.issues.push({code:"custom",message:`Array items must be unique: element at index ${u} duplicates the one at index ${a}`,input:o,path:[u],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,u=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,c=0;for(let a of o)if(t.containsSchema.safeParse(a).success&&++c>=u)break;c<i&&n.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Pd(i)}; found ${c}`,input:o,continue:!0}),t.maxContains!==void 0&&c>t.maxContains&&n.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Pd(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}s(Ry,"checkArrayGuards");function Id(e,t){if(e!==!1)return e===void 0||e===!0?w.any():ee(e,t)}s(Id,"getTupleRest");var Ly=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Ad(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return w.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 w.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=Ey(o,t),u=ee(i,t);return t.refs.set(o,u),t.processing.delete(o),u}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 w.null();if(o.length===0)return w.never();if(o.length===1)return w.literal(o[0]);if(o.every(u=>typeof u=="string"))return w.enum(o);let i=o.map(u=>w.literal(u));return i.length<2?i[0]:w.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return w.literal(e.const);let r=e.type;if(Array.isArray(r)){let o=r.map(i=>{let u={...e,type:i};return Ad(u,t)});return o.length===0?w.never():o.length===1?o[0]:w.union(o)}if(!r)return w.any();let n;switch(r){case"string":{let o=w.string();if(e.format){let i=e.format;i==="email"?o=o.check(w.email()):i==="uri"||i==="uri-reference"?o=o.check(w.url()):i==="uuid"||i==="guid"?o=o.check(w.uuid()):i==="date-time"?o=o.check(w.iso.datetime({offset:!0})):i==="date"?o=o.check(w.iso.date()):i==="time"?o=o.check(w.regex(Ly)):i==="duration"?o=o.check(w.iso.duration()):i==="hostname"?o=o.check(w.hostname()):i==="ipv4"?o=o.check(w.ipv4()):i==="ipv6"?o=o.check(w.ipv6()):i==="mac"?o=o.check(w.mac()):i==="cidr"?o=o.check(w.cidrv4()):i==="cidr-v6"?o=o.check(w.cidrv6()):i==="base64"?o=o.check(w.base64()):i==="base64url"?o=o.check(w.base64url()):i==="e164"?o=o.check(w.e164()):i==="credit_card"?o=o.check(w.creditCard()):i==="iban"?o=o.check(w.iban()):i==="jwt"?o=o.check(w.jwt()):i==="emoji"?o=o.check(w.emoji()):i==="nanoid"?o=o.check(w.nanoid()):i==="cuid"?o=o.check(w.cuid()):i==="cuid2"?o=o.check(w.cuid2()):i==="ulid"?o=o.check(w.ulid()):i==="xid"?o=o.check(w.xid()):i==="ksuid"&&(o=o.check(w.ksuid()))}typeof e.minLength=="number"&&(o=o.min(e.minLength)),typeof e.maxLength=="number"&&(o=o.max(e.maxLength)),e.pattern&&(o=o.regex(new RegExp(e.pattern))),n=o;break}case"number":case"integer":{let o=r==="integer"?w.number().int():w.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(o=o.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(o=o.max(e.maximum)),typeof e.exclusiveMinimum=="number"?o=o.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(o=o.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?o=o.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(o=o.lt(e.maximum)),typeof e.multipleOf=="number"&&(o=o.multipleOf(e.multipleOf)),n=o;break}case"boolean":{n=w.boolean();break}case"null":{n=w.null();break}case"object":{let o={},i=e.properties||{},u=new Set(e.required||[]),c=typeof e.additionalProperties=="object"?ee(e.additionalProperties,t):void 0;for(let[p,d]of Object.entries(i)){let m=ee(d,t);J(o,p,u.has(p)?m:m.optional())}if(e.patternProperties){let p=e.patternProperties,d=Object.keys(p),m=[];for(let y of d){let $=ee(p[y],t),z=w.string().regex(new RegExp(y));m.push(w.looseRecord(z,$))}let g=[];if(Object.keys(o).length>0&&g.push(w.object(o).passthrough()),g.push(...m),g.length===0)n=w.object({}).passthrough();else if(g.length===1)n=g[0];else{let y=w.intersection(g[0],g[1]);for(let $=2;$<g.length;$++)y=w.intersection(y,g[$]);n=y}if(e.additionalProperties===!1){let y=Object.keys(o),$=d.map(x=>new RegExp(x)),z=n;n=n.check(x=>{if(!ce(x.value))return;let I=[];for(let E of Object.keys(x.value))y.includes(E)||$.some(j=>j.test(E))||I.push(E);I.length&&x.issues.push({code:"unrecognized_keys",keys:I,input:x.value,inst:z})})}}else{let p=w.object(o);e.additionalProperties===!1?n=p.strict():c?n=p.catchall(c):n=p.passthrough()}let a=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(a||l!==void 0||f!==void 0){let p;if(a){let d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;p=ee(d,t)}n=Cy(n,{keySchema:p,minProperties:l,maxProperties:f})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let u=typeof e.minItems=="number"?e.minItems:0,c=o.map(p=>ee(p,t)),a=Sd(c,u),l=Array.isArray(i)?void 0:Id(i,t),f=w.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(Array.isArray(i)){let u=typeof e.minItems=="number"?e.minItems:0,c=i.map(p=>ee(p,t)),a=Sd(c,u),l=Id(e.additionalItems,t),f=w.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(i!==void 0){let u=ee(i,t),c=w.array(u);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),n=c}else n=w.array(w.any());(e.uniqueItems===!0||e.contains!==void 0)&&(n=Ry(n,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ee(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return n}s(Ad,"convertBaseSchema");function ee(e,t){if(typeof e=="boolean")return e?w.any():w.never();let r=Ad(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(l=>ee(l,t)),a=w.union(c);r=n?w.intersection(r,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(l=>ee(l,t)),a=w.xor(c);r=n?w.intersection(r,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:w.any();else{let c=n?r:ee(e.allOf[0],t),a=n?0:1;for(let l=a;l<e.allOf.length;l++)c=w.intersection(c,ee(e.allOf[l],t));r=c}e.nullable===!0&&t.version==="openapi-3.0"&&(r=w.nullable(r)),e.readOnly===!0&&(r=w.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of i)c in e&&(o[c]=e[c]);let u=["contentEncoding","contentMediaType","contentSchema"];for(let c of u)c in e&&(o[c]=e[c]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Kr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let c of["minProperties","maxProperties"])e[c]!==void 0&&(o[c]=e[c])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Kr(e.contains)&&(o.contains=e.contains);for(let c of["uniqueItems","minContains","maxContains"])e[c]!==void 0&&(o[c]=e[c])}for(let c of Object.keys(e))Oy.has(c)||J(o,c,e[c]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}s(ee,"convertSchema");function Od(e,t){if(typeof e=="boolean")return e?w.any():w.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=Zy(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??G};return ee(r,i)}s(Od,"fromJSONSchema");var Zd=Symbol("z.visit/resolving");function Ur(e,t){let r=typeof t=="function"?t:(u,c)=>{let a=t[u._zod.def.type];return a?a(u,c):u},n=new Map;function o(u){let c=n.get(u);if(c===Zd)return new _r({type:"lazy",getter:s(()=>n.get(u),"getter")});if(c!==void 0)return c;n.set(u,Zd);let a=i(u),l=r(a,a!==u);return n.set(u,l),l}s(o,"run");function i(u){let c=u._zod.def,a=c.type;switch(a){case"object":{let l=c.shape,f=Object.keys(l),p=!1,d={};for(let g of f){let y=o(l[g]);y!==l[g]&&(p=!0),d[g]=y}let m=c.catchall;return c.catchall&&(m=o(c.catchall),m!==c.catchall&&(p=!0)),p?C(u,{...c,shape:d,catchall:m}):u}case"array":{let l=o(c.element);return l===c.element?u:C(u,{...c,element:l})}case"tuple":{let l=c.items,f=!1,p=[];for(let m of l){let g=o(m);g!==m&&(f=!0),p.push(g)}let d=c.rest;return c.rest&&(d=o(c.rest),d!==c.rest&&(f=!0)),f?C(u,{...c,items:p,rest:d}):u}case"record":case"map":{let l=o(c.keyType),f=o(c.valueType);return l===c.keyType&&f===c.valueType?u:C(u,{...c,keyType:l,valueType:f})}case"set":{let l=o(c.valueType);return l===c.valueType?u:C(u,{...c,valueType:l})}case"union":{let l=c.options,f=!1,p=[];for(let d of l){let m=o(d);m!==d&&(f=!0),p.push(m)}return f?C(u,{...c,options:p}):u}case"intersection":{let l=o(c.left),f=o(c.right);return l===c.left&&f===c.right?u:C(u,{...c,left:l,right:f})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=o(c.innerType);return l===c.innerType?u:C(u,{...c,innerType:l})}case"pipe":{let l=o(c.in),f=o(c.out);return l===c.in&&f===c.out?u:C(u,{...c,in:l,out:f})}case"function":{let l=o(c.input),f=o(c.output);return l===c.input&&f===c.output?u:C(u,{...c,input:l,output:f})}case"lazy":{let l=c.getter,{_cachedInner:f,...p}=c;return C(u,{...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 u;default:return u}}return s(i,"mapInner"),o(e)}s(Ur,"visit");function Nd(e){return Ur(e,{object:s(t=>t.partial(),"object"),union:s(t=>{let r=t._zod.def;return r.discriminator===void 0?t:Ft(r.options)},"union")})}s(Nd,"deepPartial");function jy(e,t){if(!t?.length)return e;let r=e._zod.def;return C(e,fe(r,{checks:[...r.checks??[],...t]}),{parent:!0})}s(jy,"withChecks");function Ed(e){return jy(e.out,e.checks)}s(Ed,"outSide");function Vy(e){return e.in._zod.traits.has("$ZodTransform")?Ed(e):e.in}s(Vy,"inSide");function Cd(e){return Ur(e,{pipe:s(t=>Vy(t._zod.def),"pipe"),default:s((t,r)=>r?tt(t._zod.def.innerType):t,"default"),catch:s((t,r)=>r?t._zod.def.innerType:t,"catch")})}s(Cd,"input");function Td(e){return Ur(e,{pipe:s(t=>Ed(t._zod.def),"pipe"),prefault:s((t,r)=>r?t._zod.def.innerType:t,"prefault")})}s(Td,"output");var Nl={};$e(Nl,{bigint:()=>Uy,boolean:()=>Ky,date:()=>By,number:()=>Fy,string:()=>My});function My(e){return ec(Lt,e)}s(My,"string");function Fy(e){return sc(jt,e)}s(Fy,"number");function Ky(e){return dc(Vt,e)}s(Ky,"boolean");function Uy(e){return hc(Mt,e)}s(Uy,"bigint");function By(e){return Sc(Cr,e)}s(By,"date");var El=1e4,Dd=b.string().min(1).max(1024),_e=b.array(Dd).max(El),Jy=b.enum(["project","chronological","machine"]),Gy=b.enum(["updated","created","alpha","none"]),qy=b.enum(["default","ascending","descending"]),Wy=b.enum(["muted","colour"]),Xy=b.enum(["12h","1d","3d","1w","never"]),Hy=b.enum(["blocked","everything"]),Yy=b.array(b.union([b.literal("threads"),Dd.regex(/^(project|section|machine):\S+$/)])).max(El).transform(e=>[...new Set(e)]);function F(e,t,r,n){return{schema:e,defaultValue:t,description:r,...n?{readStored:n}:{}}}s(F,"define");var Le={showArchived:F(b.boolean(),!1,"Show archived threads: whether every group also lists archived threads, as each group's menu toggles."),organizationMode:F(Jy,"project","How top-level groups are formed: project, chronological (custom sections) or machine."),environmentGrouping:F(b.boolean(),!1,"Worktrees as folders: whether sibling threads sharing a worktree environment fold into a folder row."),chronologicalSort:F(Gy,"updated","Sort field inside a group: updated, created or alpha. none is read as updated."),sortDirection:F(qy,"default","Sort direction: ascending or descending. A saved default reads as the field's own direction (descending for dates, ascending for alpha)."),sectionOrder:F(_e,["pinned","projects","threads"],"Top-level group order when organized by project."),manualSectionOrder:F(_e,["pinned","sections","threads"],"Top-level group order when organized chronologically."),machineSectionOrder:F(_e,["pinned","machines","threads"],"Top-level group order when organized by machine."),hiddenGroups:F(Yy,[],"Groups moved into More: threads, project:<id>, section:<id> or machine:<id>."),collapsedSections:F(b.array(b.enum(["pinned","threads"])).max(El),[],"Built-in groups (pinned, threads) that are collapsed."),collapsedProjects:F(_e,[],"Project ids whose group is collapsed."),collapsedThreadSections:F(_e,[],"Custom section keys (section:<id>) whose group is collapsed."),collapsedMachines:F(_e,[],"Machine ids whose group is collapsed."),collapsedEnvironments:F(_e,[],"Environment ids whose folder row is collapsed."),expandedOlder:F(_e,[],`Parent thread ids whose "N more child threads" row the user opened, once that tree's children chip was open.`),openSettledFolds:F(_e,[],"Group ids whose settled fold the user opened."),settleAfter:F(Xy,"1d","Settle after: how long a quiet thread goes without activity before it settles into its group's settled fold: 12h, 1d, 3d, 1w or never."),expandedChildren:F(_e,[],"Parent thread ids whose chip the user opened."),childAttention:F(Hy,"blocked","Needs attention counts every child: blocked counts a child thread that waits on you, is offline or has an orphaned failure; everything also counts every failed or finished-unread child. The same children stay out of an open tree's N more child threads fold, as running ones do."),harnessIcon:F(Wy,"muted","How rows draw the harness logo, where a row draws one: muted (monochrome) or colour (the provider's tint). A stored hidden reads as muted.",e=>e==="hidden"?"muted":e)},ze=Object.keys(Le);function Cl(e){return Object.hasOwn(Le,e)}s(Cl,"isPreferenceKey");function it(e){return structuredClone(Le[e].defaultValue)}s(it,"preferenceDefault");function Rd(){return Object.fromEntries(ze.map(e=>[e,it(e)]))}s(Rd,"defaultPreferences");function Tl(e){return Le[e].description}s(Tl,"describePreference");function ti(e,t){let r=Le[e].schema.safeParse(t);return r.success?{success:!0,value:r.data}:{success:!1,message:r.error.issues.map(n=>n.message).join("; ")}}s(ti,"parsePreference");function Ld(e,t){let r=Le[e];return ti(e,r.readStored?r.readStored(t):t)}s(Ld,"parseStoredPreference");function Dl(e){if(e===null||typeof e!="object"||Array.isArray(e))return{};let t=e,r={};for(let[n,o]of Object.entries(t)){if(n==="collapsedThreads"||!Cl(n))continue;let u=ti(n,n==="environmentGrouping"&&o==="auto"?!1:o);u.success&&(r[n]=u.value)}return r}s(Dl,"mapBbPreferences");var bw=b.object({density:b.enum(["compact","comfortable"]).catch("compact")});var ri=b.record(b.string(),b.number()),jd=b.object({startedAt:ri,finishedAt:ri,pendingAt:ri,seenAt:ri}),Br=140,Rl=b.object({kind:b.enum(["question","approval","plan","input","failed","done"]),text:b.string().max(Br),at:b.number()}),ni=b.object({pending:Rl.optional(),failed:Rl.optional(),done:Rl.optional()}),je={preferences:"preferences",stamps:"stamps",scheduled:"scheduled",notes:"notes"};var Jr=b.enum(ze),e_=b.object(Object.fromEntries(ze.map(e=>[e,Le[e].schema]))),t_=b.record(b.string(),b.number()),Vd=b.array(b.string().min(1).max(1024)).max(1e4),Md=Qy({listPreferences:{input:b.null(),output:b.object({preferences:e_}).strict()},setPreference:{input:b.object({key:Jr,value:b.unknown()}).strict(),output:b.object({key:Jr,value:b.unknown()}).strict()},resetPreference:{input:b.object({key:Jr}).strict(),output:b.object({key:Jr,value:b.unknown()}).strict()},importPreferences:{input:b.object({bbMirror:b.unknown().nullable()}).strict(),output:b.object({status:b.enum(["already-imported","imported","defaults"]),source:b.enum(["local-storage","cli","none"]).nullable(),keys:b.array(Jr)}).strict()},listStamps:{input:b.null(),output:b.object({stamps:jd}).strict()},markSeen:{input:b.object({threadIds:Vd}).strict(),output:b.object({at:b.number()}).strict()},clearSeen:{input:b.object({threadIds:Vd}).strict(),output:b.object({ok:b.literal(!0)}).strict()},listNotes:{input:b.null(),output:b.object({notes:b.record(b.string(),ni)}).strict()},listScheduled:{input:b.null(),output:b.object({status:b.enum(["ready","error"]),scheduled:t_}).strict()}});import{PluginCliError as Kd,cliCommand as ii,defineCli as n_}from"@get-bb/plugin-sdk";var r_="preference:";function oi(e){return`${r_}${e}`}s(oi,"preferenceKvKey");var Gr=class extends Error{static{s(this,"PreferenceValidationError")}key;detail;constructor(t,r){super(`Invalid value for ${t}: ${r}`),this.name="PreferenceValidationError",this.key=t,this.detail=r}};function Fd(e){let{kv:t}=e.storage;function r(o,i){let u={key:o,value:i};e.realtime.publish(je.preferences,u)}s(r,"publish");async function n(o){let i=await t.get(oi(o));if(i===void 0)return it(o);let u=Ld(o,i);return u.success?u.value:(e.log.warn(`stored preference ${o} is invalid (${u.message}); using the default`),it(o))}return s(n,"read"),{read:n,async readAll(){let o=Rd();return await Promise.all(ze.map(async i=>{o[i]=await n(i)})),o},async isStored(o){return await t.get(oi(o))!==void 0},async write(o,i){let u=ti(o,i);if(!u.success)throw new Gr(o,u.message);return await t.set(oi(o),u.value),r(o,u.value),u.value},async reset(o){await t.delete(oi(o));let i=it(o);return r(o,i),i}}}s(Fd,"createPreferenceStore");function o_(e){try{return JSON.parse(e)}catch{return e}}s(o_,"parseCliValue");function Ll(e){if(Cl(e))return e;throw new Kd(`Unknown preference: ${e}`,{code:"unknown_preference",hint:`Known preferences: ${ze.join(", ")}.`})}s(Ll,"requirePreferenceKey");var si={type:"boolean",description:"Emit machine-readable JSON"},jl={name:"key",description:"Preference name",required:!0};function Ud(e){function t(r,n,o){return o?JSON.stringify({key:r,value:n}):`${r} = ${JSON.stringify(n)}`}return s(t,"keyValueOutput"),n_({name:"thread-glance",summary:"Inspect and change the Thread Glance sidebar's layout preferences",description:"Organization, sort, group order, hidden and collapsed groups, child-thread folding, settling and which child threads Needs attention counts, for the Thread Glance sidebar. Values are JSON; a bare word is read as a string.",commands:{"prefs list":ii({summary:"List every preference and its current value",options:{json:si},async run(r){let n=await e.readAll();return r.options.json?{exitCode:0,stdout:JSON.stringify(n)}:{exitCode:0,stdout:ze.map(i=>`${i} ${JSON.stringify(n[i])} ${Tl(i)}`).join(`
|
|
69
|
-
`)}}}),"prefs get":ii({summary:"Print one preference",positionals:[
|
|
70
|
-
`)){let r=t.replace(/^\s*#+/,"").trim();if(r!=="")return r}return""}s(s_,"firstNonEmptyLine");function Gd(e,t){return t>1?`${e} (+${t-1} more)`:e}s(Gd,"withMore");function u_(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e.questions;if(!Array.isArray(t)||t.length===0)return null;let r=t[0]?.prompt;return typeof r=="string"&&r.trim()!==""?Gd(r,t.length):null}s(u_,"questionsText");function c_(e,t){return e.trim()===""&&t?t:e}s(c_,"approvalText");function a_(e){let t=e.payload;switch(e.payload.kind){case"user_question":{let{questions:r}=e.payload,n=r[0]?.prompt??"";return{kind:"question",text:Gd(n,r.length)}}case"approval":{let{subject:r,reason:n}=e.payload;switch(r.kind){case"command":return{kind:"approval",text:c_(r.command,n)};case"file_change":return{kind:"approval",text:`File changes${r.writeScope?` in ${r.writeScope}`:""}`};case"permission_grant":return{kind:"approval",text:`Permissions${r.toolName?` for ${r.toolName}`:""}`};case"tool_use":return{kind:"approval",text:r.presentation.title??r.tool};case"plan":return{kind:"plan",text:s_(r.plan)};default:return{kind:"approval",text:n??""}}}case"plugin":{if(e.origin?.kind!=="plugin")break;let{title:r,presentation:n,data:o}=e.payload;if(e.origin.pluginId===i_)return{kind:"question",text:u_(o)??r};let i=n?.detail?Bt(n.detail):"",u=`${r}: ${i}`;return{kind:"input",text:i!==""&&u.length<=Br?u:r}}}return"title"in t&&typeof t.title=="string"?{kind:"input",text:t.title}:{kind:"input",text:Jd}}s(a_,"describeRaw");function qd(e){let t=a_(e),r=Bt(t.text);return{kind:t.kind,text:r===""?Jd:r}}s(qd,"describeInteraction");function Ml(e){let t=e===null?"":Bt(e);return{kind:"failed",text:t===""?"Failed":t}}s(Ml,"describeFailure");function Wd(e){let t=e===null?"":Bt(e);return t===""?null:{kind:"done",text:t}}s(Wd,"describeDone");function Xd(e){let{kv:t}=e.storage,r=Ut(),n=null;async function o(){if(n!==null)return n;let u=new Map;for(let c of await t.list(Vl)){let a=c.slice(Vl.length),l=ni.safeParse(await t.get(c));if(!l.success||Object.keys(l.data).length===0){e.log.warn(`stored notes for ${a} are invalid; dropping them`),await t.delete(c);continue}u.set(a,l.data)}return n=u,u}s(o,"load");async function i(u,c,a){let l=Object.keys(a).length===0;l?(u.delete(c),await t.delete(Bd(c))):(u.set(c,a),await t.set(Bd(c),a));let f={threadId:c,notes:l?null:a};e.realtime.publish(je.notes,f)}return s(i,"save"),{list:s(()=>r(async()=>Object.fromEntries(await o())),"list"),get:s(u=>r(async()=>(await o()).get(u)),"get"),update:s((u,c)=>r(async()=>{let a=await o(),l=a.get(u)??{},f={...l};for(let[p,d]of Object.entries(c))d===null?delete f[p]:f[p]=d;JSON.stringify(f)!==JSON.stringify(l)&&await i(a,u,f)}),"update"),forget:s(u=>r(async()=>{let c=await o();for(let a of u)c.has(a)&&await i(c,a,{})}),"forget"),prune:s((u,c)=>r(async()=>{let a=await o(),l=[];for(let[f,p]of[...a])u.has(f)||Math.max(...Object.values(p).map(m=>m.at))>=c||(await i(a,f,{}),l.push(f));return l}),"prune")}}s(Xd,"createNoteStore");var l_=20,f_=new Set(["error","failed","provider error","turn failed","unknown error"]);function Hd(e){if(e==null)return!0;let t=e.trim().toLowerCase().replace(/[.!]+$/,"");return t===""||f_.has(t)||/^command [\w./:-]+ failed$/.test(t)}s(Hd,"isGenericError");function p_(e){if(!e)return null;let t=e.httpStatusCode===null?"":` (${e.httpStatusCode})`;switch(e.category){case"rate-limit":return`Rate limited${t}`;case"unauthorized":return"Not signed in";case"billing":case"budget-exceeded":return"Out of credits";case"context-window-exceeded":return"Context window full";case"unknown":return t===""?null:`Error${t}`;default:{let r=e.category.replace(/-/g," ");return`${r.charAt(0).toUpperCase()}${r.slice(1)}${t}`}}}s(p_,"errorInfoLabel");function d_(e,t){for(let r of e){if(r.type==="turn/started"&&t===null)return null;if(!(r.type!=="provider/error"&&r.type!=="system/error")&&!(t!==null&&r.scope?.turnId!==void 0&&r.scope.turnId!==t))return r.data??{}}return null}s(d_,"latestProviderError");function m_(e){let t=[e.error,e.providerError?.detail,e.providerError?.message,p_(e.errorInfo??e.providerError?.errorInfo)];for(let r of t)if(!Hd(r)){let n=Bt(r);if(n!=="")return n}return null}s(m_,"failureText");async function Fl(e,t){let r=null;if(Hd(t.error))try{let n=await e.sdk.threads.events.list({threadId:t.threadId,types:["provider/error","system/error","turn/started"],order:"desc",limit:String(l_)});r=d_(n,t.turnId)}catch(n){e.log.warn(`could not read events of ${t.threadId} for its failure: ${n instanceof Error?n.message:String(n)}`)}return m_({error:t.error,providerError:r,errorInfo:t.errorInfo})}s(Fl,"resolveFailureText");import{execFile as h_}from"node:child_process";var Yd="migration:import:v1",g_=5e3,y_=4*1024*1024;function Qd(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return null}if(t===null||typeof t!="object"||Array.isArray(t))return null;let r=t,n=r.preferences;return n!==null&&typeof n=="object"&&!Array.isArray(n)?n:r}s(Qd,"unwrapBbPreferences");function __(e=process.env){let t=e.BB_CLI?.trim();return t||"bb"}s(__,"bbCliPath");function em(e,t,r=process.env){return()=>new Promise(n=>{let o="",i="it has no URL";try{o=t().trim()}catch(c){i=c instanceof Error?c.message:String(c)}if(!o){e.warn(`could not tell which bb server Thread Glance runs in (${i}); importing nothing from bb's CLI and asking no other server`),n(null);return}let u=__(r);h_(u,["thread-list","prefs","list","--json"],{env:{...r,BB_SERVER_URL:o},timeout:g_,maxBuffer:y_,encoding:"utf8"},(c,a)=>{if(c){e.warn(`could not run ${u} thread-list prefs list against ${o}: ${c.message}`),n(null);return}try{n(JSON.parse(a))}catch{e.warn(`${u} thread-list prefs list against ${o} printed output that is not JSON`),n(null)}})})}s(em,"createBbCliReader");async function tm(e,t){if(await e.kv.get(Yd)!==void 0)return{status:"already-imported",source:null,keys:[]};let r="none",n={},o=t===null?null:Qd(t),i=o===null?{}:Dl(o);if(Object.keys(i).length>0)r="local-storage",n=i;else{let c=Qd(await e.readBbCli()),a=c===null?{}:Dl(c);Object.keys(a).length>0&&(r="cli",n=a)}let u=[];for(let[c,a]of Object.entries(n))await e.store.isStored(c)||JSON.stringify(a)!==JSON.stringify(it(c))&&(await e.store.write(c,a),u.push(c));return await e.kv.set(Yd,{source:r,keys:u,at:Date.now()}),e.log.info(r==="none"?"no bb thread-list preferences found; using the defaults":`imported bb thread-list preferences from ${r}: ${u.join(", ")||"none differ from the defaults"}`),{status:r==="none"?"defaults":"imported",source:r,keys:u}}s(tm,"importPreferences");function rm(e){let t=e.now??Date.now,r=new Map,n="error",o=null,i=null,u=JSON.stringify({status:n,scheduled:{}});function c(d){switch(d.type){case"upsert":{let{id:m,threadId:g,sendAt:y}=d.row;y!==null&&y>t()?r.set(m,{threadId:g,sendAt:y}):r.delete(m);break}case"remove":r.delete(d.rowId);break;case"remove-thread":for(let[m,g]of r)g.threadId===d.threadId&&r.delete(m);break}}s(c,"apply");function a(){let d=t(),m={};for(let[g,y]of r){if(y.sendAt<=d){r.delete(g);continue}let $=m[y.threadId];($===void 0||y.sendAt<$)&&(m[y.threadId]=y.sendAt)}return{status:n,scheduled:m}}s(a,"current");function l(){let d=a(),m=JSON.stringify(d);m!==u&&(u=m,e.publish(d))}s(l,"publishIfChanged");function f(d){o?.push(d),c(d),l()}s(f,"change");async function p(d){o=[];try{let m=await d(),g=o;r=new Map;for(let y of m)c({type:"upsert",row:y});for(let y of g)c(y);return n="ready",!0}catch{return n="error",!1}finally{o=null,l()}}return s(p,"runSeed"),{queued:s(d=>f({type:"upsert",row:d}),"queued"),removed:s(d=>f({type:"remove",rowId:d}),"removed"),threadGone:s(d=>f({type:"remove-thread",threadId:d}),"threadGone"),seed(d){let m=p(d).finally(()=>{i===m&&(i=null)});return i=m,m},async snapshot(){return i!==null&&await i,a()}}}s(rm,"createScheduledTracker");var Kl="stamp:",om=["startedAt","finishedAt","pendingAt","seenAt"];function nm(e){return`${Kl}${e}`}s(nm,"stampKvKey");function $_(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let n of om){let o=t[n];typeof o=="number"&&Number.isFinite(o)&&(r[n]=o)}return Object.keys(r).length>0?r:null}s($_,"parseThreadStamps");function im(e){let{kv:t}=e.storage,r=Ut(),n=null;async function o(){if(n!==null)return n;let c=new Map;for(let a of await t.list(Kl)){let l=a.slice(Kl.length),f=$_(await t.get(a));if(f===null){e.log.warn(`stored stamps for ${l} are invalid; dropping them`),await t.delete(a);continue}c.set(l,f)}return n=c,c}s(o,"load");async function i(c,a,l){if(Object.keys(l).length===0){c.delete(a),await t.delete(nm(a));return}c.set(a,l),await t.set(nm(a),l)}s(i,"save");function u(c){e.realtime.publish(je.stamps,c)}return s(u,"publish"),{list:s(()=>r(async()=>{let c={startedAt:{},finishedAt:{},pendingAt:{},seenAt:{}};for(let[a,l]of await o())for(let f of om){let p=l[f];p!==void 0&&(c[f][a]=p)}return c}),"list"),stamp:s((c,a,l)=>r(async()=>{if(a.length===0)return;let f=await o();for(let p of new Set(a))await i(f,p,{...f.get(p),[c]:l});u({kind:c,threadIds:[...a],value:l})}),"stamp"),clear:s((c,a)=>r(async()=>{if(a.length===0)return;let l=await o();for(let f of new Set(a)){let p=l.get(f);if(p?.[c]===void 0)continue;let{[c]:d,...m}=p;await i(l,f,m)}u({kind:c,threadIds:[...a],value:null})}),"clear"),forget:s(c=>r(async()=>{let a=await o();for(let l of c)a.has(l)&&await i(a,l,{})}),"forget"),prune:s((c,a)=>r(async()=>{let l=await o(),f=[];for(let[p,d]of[...l])c.has(p)||Math.max(...Object.values(d))>=a||(await i(l,p,{}),f.push(p));return f}),"prune")}}s(im,"createStampStore");function um(e){return e instanceof Error?e.message:String(e)}s(um,"errorMessage");async function w_(e,t){let r=new Set;for(let n of[!1,!0])for(let o=0;;o+=500){let i=await e.threads.list({archived:n,includeHidden:!0,limit:500,offset:o,signal:t});for(let u of i)r.add(u.id);if(i.length<500)break}return r}s(w_,"listAllThreadIds");async function b_(e,t,r){let n=Date.now(),o;try{o=await w_(e.sdk,r)}catch(i){e.log.warn(`could not list threads to prune deleted ones: ${um(i)}`);return}for(let i of t){let u=await i.prune(o,n);u.length>0&&e.log.info(`pruned ${i.name} of ${u.length} deleted threads`)}}s(b_,"pruneDeletedThreads");function sm(e,t,r){return t.seed(async()=>{try{return await e.sdk.threads.queue.list({signal:r})}catch(n){throw e.log.warn(`could not list queued messages: ${um(n)}`),n}})}s(sm,"seedScheduled");function v_(e,t){return new Promise(r=>{let n=setTimeout(o,e);function o(){clearTimeout(n),t.removeEventListener("abort",o),r()}s(o,"done"),t.addEventListener("abort",o,{once:!0})})}s(v_,"sleep");function x_(e){return e.aborted?Promise.resolve():new Promise(t=>e.addEventListener("abort",()=>t(),{once:!0}))}s(x_,"waitForAbort");async function cm(e,t,r,n,o=6e4){let i=sm(e,r,n);await b_(e,t,n);let u=await i;for(;!u&&!n.aborted&&(await v_(o,n),!n.aborted);)u=await sm(e,r,n);await x_(n)}s(cm,"runStartup");function k_(e){let t=Fd(e),r=im(e),n=Xd(e),o=rm({publish:s(a=>e.realtime.publish(je.scheduled,a),"publish")}),i=em(e.log,()=>e.server.loopbackBaseUrl),u=Ut();e.rpc.register(Md,{async listPreferences(){return{preferences:await t.readAll()}},async setPreference({key:a,value:l}){return{key:a,value:await t.write(a,l)}},async resetPreference({key:a}){return{key:a,value:await t.reset(a)}},importPreferences({bbMirror:a}){return u(()=>tm({kv:e.storage.kv,log:e.log,store:t,readBbCli:i},a))},async listStamps(){return{stamps:await r.list()}},async markSeen({threadIds:a}){let l=Date.now();return await r.stamp("seenAt",a,l),{at:l}},async clearSeen({threadIds:a}){return await r.clear("seenAt",a),{ok:!0}},async listNotes(){return{notes:await n.list()}},listScheduled(){return o.snapshot()}}),e.cli.register(Ud(t));let c=s((a,l=Date.now())=>({...a,at:l}),"note");e.events.on("thread.active",async({thread:a})=>{await r.stamp("startedAt",[a.id],Date.now()),await n.update(a.id,{pending:null,failed:null})}),e.events.on("thread.idle",async({thread:a,lastAssistantText:l})=>{await r.stamp("finishedAt",[a.id],Date.now());let f=Wd(l);await n.update(a.id,{pending:null,...f?{done:c(f)}:{}})}),e.events.on("thread.failed",async({thread:a,error:l})=>{await r.stamp("finishedAt",[a.id],Date.now());let f=await Fl(e,{threadId:a.id,error:l,errorInfo:null,turnId:null});f===null&&(await n.get(a.id))?.failed||await n.update(a.id,{failed:c(Ml(f))})}),e.events.on("turn.failed",async({threadId:a,errorInfo:l,turnId:f})=>{let p=await Fl(e,{threadId:a,error:null,errorInfo:l,turnId:f});p!==null&&await n.update(a,{failed:c(Ml(p))})}),e.events.on("interaction.pending",async({thread:a,interaction:l})=>{await r.stamp("pendingAt",[a.id],Date.now()),await n.update(a.id,{pending:c(qd(l),l.createdAt)})}),e.events.on("thread.deleted",async({thread:a})=>{o.threadGone(a.id),await r.forget([a.id]),await n.forget([a.id])}),e.events.on("thread.archived",({thread:a})=>o.threadGone(a.id)),e.events.on("message.queued",({entry:a})=>o.queued(a)),e.events.on("message.dispatched",({entry:a})=>o.removed(a.id)),e.events.on("message.cancelled",({entry:a})=>o.removed(a.id)),e.background.service("startup",{start:s(a=>cm(e,[{name:"stamps",prune:r.prune},{name:"notes",prune:n.prune}],o,a),"start")})}s(k_,"threadGlance");export{k_ as default};
|
|
68
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let u of e.seen.entries()){let c=u[1];if(t===u[0]){i(u);continue}if(e.external){let l=e.external.registry.get(u[0])?.id;if(t!==u[0]&&l){i(u);continue}}if(e.metadataRegistry.get(u[0])?.id){i(u);continue}if(c.cycle){i(u);continue}c.count>1&&e.reused==="ref"&&i(u)}e.external&&(e.sharedDefsExtractedFor=e.external)}s(Ne,"extractDefs");function qf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!="object")return;qf(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let u of Array.isArray(i)?i:[i]){if(typeof u!="string")return;r.includes(u)||r.push(u)}}delete e.anyOf,e.type=r.length===1?r[0]:r}s(qf,"compactTypeUnion");var Wf=new Set(["type","properties","required","additionalProperties"]),Jf=["oneOf","anyOf"];function Gf(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}s(Gf,"undeclaredConstraint");function Dc(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let u in i)if(!Wf.has(u))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let u in i.properties){if(Object.prototype.hasOwnProperty.call(r,u))continue;let c=[];for(let l of t){let f=l.properties?.[u]??Gf(l);f!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(f))||c.push(f))}let a=c.length===1?c[0]:Dc(c)??{allOf:c};J(r,u,a)}for(let u of i.required??[])n.add(u)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let u of t){let c=Gf(u);c&&!i.some(a=>JSON.stringify(a)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}s(Dc,"foldObjects");function my(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Wf)if(o in e)return;let r=t.filter(o=>Jf.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=Dc(t);else{let o=r[0],i=Jf.find(a=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let u=t.filter(a=>a!==o),c=o[i].map(a=>Dc([...u,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Ar(e,n))}s(my,"foldIntersection");function Ee(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=s(c=>{let a=e.seen.get(c);if(a.ref===null)return;let l=a.def??a.schema,f={...l},p=a.ref;if(a.ref=null,p){n(p);let m=e.seen.get(p),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(g)):Ar(l,g),Ar(l,f),c._zod.parent===p)for(let $ in l)$==="$ref"||$==="allOf"||$ in f||delete l[$];if(g.$ref&&m.def)for(let $ in l)$==="$ref"||$==="allOf"||$ in m.def&&JSON.stringify(l[$])===JSON.stringify(m.def[$])&&delete l[$]}let d=c._zod.parent;if(d&&d!==p){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(l.$ref=m.schema.$ref,m.def))for(let g in l)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(l[g])===JSON.stringify(m.def[g])&&delete l[g]}e.override({zodSchema:c,jsonSchema:l,path:a.path??[]})},"flattenRef");if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())qf(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let l of[a.schema,a.def]){let f=l?.allOf;if(!Array.isArray(f))continue;let p=c.get(f);p?p.push(l):c.set(f,[l])}for(let a of e.intersections)for(let l of c.get(a)??[])my(l)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Ar(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let u=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,J(u,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?o.$defs=u:o.definitions=u);try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Et(t,"input",e.processors),output:Et(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}s(Ee,"finalize");function Q(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Q(n.element,r);if(n.type==="set")return Q(n.valueType,r);if(n.type==="lazy")return Q(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return Q(n.innerType,r);if(n.type==="intersection")return Q(n.left,r)||Q(n.right,r);if(n.type==="record"||n.type==="map")return Q(n.keyType,r)||Q(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Q(n.in,r)||Q(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Q(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Q(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Q(o,r))return!0;return!!(n.rest&&Q(n.rest,r))}return!1}s(Q,"isTransforming");var Rc=s((e,t={})=>r=>{let n=Ze({...r,processors:t});return D(e,n),Ne(n,e),Ee(n,e)},"createToJSONSchemaMethod"),Et=s((e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},u=Ze({...o??{},target:i,io:t,processors:r});return D(e,u),Ne(u,e),Ee(u,e)},"createStandardJSONSchemaMethod");var Ct=s((e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},"narrowMin"),Tt=s((e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},"narrowMax"),Xf=s((e,t)=>{Ct(e,"minimum",t),Tt(e,"maximum",t)},"narrowBoth"),ep=s((e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},"addDivisor"),tp=s((e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},"addPattern"),rp=s((e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},"intersectMime"),np=s((e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},"setFormat"),Hf=s((e,t)=>Ct(e,"minimum",t.minimum),"minContributor"),Yf=s((e,t)=>Tt(e,"maximum",t.maximum),"maxContributor"),Qf=s(e=>(t,r)=>{np(t,r.format);let[n,o]=e[r.format];Ct(t,"minimum",n),Tt(t,"maximum",o)},"formatContributor"),hy={greater_than:s((e,t)=>Ct(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),"greater_than"),less_than:s((e,t)=>Tt(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),"less_than"),multiple_of:s((e,t)=>ep(e,t.value),"multiple_of"),number_format:Qf(Ht),bigint_format:Qf(Yt),min_length:Hf,max_length:Yf,length_equals:s((e,t)=>Xf(e,t.length),"length_equals"),min_size:Hf,max_size:Yf,size_equals:s((e,t)=>Xf(e,t.size),"size_equals"),string_format:s((e,t)=>{np(e,t.format),t.pattern&&tp(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)=>rp(e,t.mime),"mime_type")};function U(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)hy[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Ct(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Ct(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Tt(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Tt(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&ep(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&rp(t,o.mime);for(let i of o.patterns??[])tp(t,i);return t}s(U,"aggregateChecks");var gy={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yy=new Map([[An,Bi],[mr,Ji]]),op=s(e=>yy.get(e)??e,"exactPattern"),Vc=s((e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:u,format:c,patterns:a,contentEncoding:l,laxFormat:f}=U(e);if(typeof i=="number"&&(o.minLength=i),typeof u=="number"&&(o.maxLength=u),c&&(o.format=gy[c]??c,o.format===""&&delete o.format,(c==="time"||f)&&delete o.format),l&&(o.contentEncoding=l),a&&a.size>0){let p=[...a].map(op);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"),Mc=s((e,t,r,n)=>{let o=r,{minimum:i,maximum:u,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:l,isInt:f}=U(e);o.type=f?"integer":"number";let p=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),d=typeof a=="number"&&a<=(u??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=a,o.exclusiveMaximum=!0):o.exclusiveMaximum=a:typeof u=="number"&&(o.maximum=u),c){let g=new Set;for(let z of c)Number.isFinite(z)&&z!==0?g.add(Math.abs(z)):K(e,t,o,n,`A multipleOf divisor of ${z} cannot be represented in JSON Schema`);let[y,...$]=g;y!==void 0&&(o.multipleOf=y),$.length&&(o.allOf=[...o.allOf??[],...$.map(z=>({multipleOf:z}))])}},"numberProcessor"),Fc=s((e,t,r,n)=>{r.type="boolean"},"booleanProcessor"),Kc=s((e,t,r,n)=>{K(e,t,r,n,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),Uc=s((e,t,r,n)=>{K(e,t,r,n,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),Bc=s((e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},"nullProcessor"),Jc=s((e,t,r,n)=>{K(e,t,r,n,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),Gc=s((e,t,r,n)=>{K(e,t,r,n,"Void cannot be represented in JSON Schema")},"voidProcessor"),qc=s((e,t,r,n)=>{r.not={}},"neverProcessor"),Wc=s((e,t,r,n)=>{},"anyProcessor"),Xc=s((e,t,r,n)=>{},"unknownProcessor"),Hc=s((e,t,r,n)=>{K(e,t,r,n,"Date cannot be represented in JSON Schema")},"dateProcessor"),Yc=s((e,t,r,n)=>{let o=e._zod.def,i=ut(o.entries);if(i.length===0){r.not={};return}i.every(u=>typeof u=="number")&&(r.type="number"),i.every(u=>typeof u=="string")&&(r.type="string"),r.enum=i},"enumProcessor"),Qc=s((e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let u of o.values)if(u===void 0){if(K(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof u=="bigint"){if(K(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(u))}else i.push(u);if(i.length!==0)if(i.length===1){let u=i[0];r.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[u]:r.const=u}else i.every(u=>typeof u=="number")&&(r.type="number"),i.every(u=>typeof u=="string")&&(r.type="string"),i.every(u=>typeof u=="boolean")&&(r.type="boolean"),i.every(u=>u===null)&&(r.type="null"),r.enum=i},"literalProcessor"),ea=s((e,t,r,n)=>{K(e,t,r,n,"NaN cannot be represented in JSON Schema")},"nanProcessor"),ta=s((e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},"templateLiteralProcessor"),ra=s((e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:u,mime:c}=U(e);i!==void 0&&(o.minLength=i),u!==void 0&&(o.maxLength=u),c&&(c.length===0?o.not={}:c.length===1?o.contentMediaType=c[0]:o.anyOf=c.map(a=>({contentMediaType:a})))},"fileProcessor"),na=s((e,t,r,n)=>{r.type="boolean"},"successProcessor"),oa=s((e,t,r,n)=>{K(e,t,r,n,"Custom types cannot be represented in JSON Schema")},"customProcessor"),ia=s((e,t,r,n)=>{K(e,t,r,n,"Function types cannot be represented in JSON Schema")},"functionProcessor"),sa=s((e,t,r,n)=>{K(e,t,r,n,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),ua=s((e,t,r,n)=>{K(e,t,r,n,"Map cannot be represented in JSON Schema")},"mapProcessor"),ca=s((e,t,r,n)=>{K(e,t,r,n,"Set cannot be represented in JSON Schema")},"setProcessor"),aa=s((e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:u,maximum:c}=U(e);typeof u=="number"&&(o.minItems=u),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=D(i.element,t,{...n,path:[...n.path,"items"]})},"arrayProcessor");function Or(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Or(t.out):t.type==="catch"?Or(t.innerType):e._zod.optin}s(Or,"inputOptin");var la=s((e,t,r,n)=>{let o=r,i=e._zod.def,u=i.shape;if(Object.getOwnPropertySymbols(u).length&&K(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in u)J(o.properties,l,D(u[l],t,{...n,path:[...n.path,"properties",l]}));let a=[];for(let l of Object.keys(u)){let f=i.shape[l];(t.io==="input"?Or(f)===void 0:f._zod.optout===void 0)&&a.push(l)}a.length>0&&(o.required=a),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=D(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},"objectProcessor"),ko=s((e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,u=o.options.map((c,a)=>D(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));i?r.oneOf=u:r.anyOf=u},"unionProcessor"),fa=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.left,t,{...n,path:[...n.path,"allOf",0]}),u=D(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=s(l=>"allOf"in l&&Object.keys(l).length===1,"isSimpleIntersection"),a=[...c(i)?i.allOf:[i],...c(u)?u.allOf:[u]];r.allOf=a,t.intersections.push(a)},"intersectionProcessor"),pa=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let u=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((y,$)=>D(y,t,{...n,path:[...n.path,u,$]})),l=i.rest?D(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,f=i.items.length;for(;f>0;){let y=i.items[f-1];if(!(t.io==="input"?Or(y)!==void 0:y._zod.optout==="optional"))break;f--}let p=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=a,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:a},l&&o.items.anyOf.push(l),f>0&&(o.minItems=f),d&&(o.maxItems=p)):(o.items=a,d?o.additionalItems=!1:l&&(o.additionalItems=l),f>0&&(o.minItems=f),d&&(o.maxItems=p));let{minimum:m,maximum:g}=U(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)},"tupleProcessor");function Lc(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let y=Lc(e,g,r);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let $=y.map(z=>Lc(e,z,r));$.some((z,x)=>z!==y[x])&&(t={...t,[g]:$})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(g=>typeof g=="number"))return t;let{minimum:u,maximum:c,exclusiveMinimum:a,exclusiveMaximum:l,multipleOf:f,format:p,id:d,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(n.includes("number")?ve:ur).source)),m}s(Lc,"stringifyKeyNames");var jc=new WeakMap;function _y(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of jc.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let u=Lc(t,i,new Set);u!==i&&r.set(i,u)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}s(_y,"rewriteKeyNames");var da=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let u=i.keyType,c=U(u).patterns;if(i.mode==="loose"&&c&&c.size>0){let f=D(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of c)J(o.patternProperties,op(p).source,f)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let f=jc.get(t);f||(f=[],jc.set(t,f),t.deferred.push(()=>_y(t))),f.push(e)}o.additionalProperties=D(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=u._zod.values,l=t.io==="input"&&Or(i.valueType)!==void 0;if(a&&!i.partial&&!l){let f=[...a].filter(p=>typeof p=="string"||typeof p=="number");f.length>0&&(o.required=f.map(String))}},"recordProcessor"),ma=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.innerType,t,n),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},"nullableProcessor"),ha=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"nonoptionalProcessor"),ga=Symbol();function ip(e,t,r,n,o){let i=!1,u=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(i=!0,null));return i?(K(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ga):JSON.parse(u)}s(ip,"serializeDefaultValue");var ya=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let u=ip(o.defaultValue,e,t,r,n);u!==ga&&(r.default=u)},"defaultProcessor"),_a=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let u=ip(o.defaultValue,e,t,r,n);u!==ga&&(r._prefault=u)},"prefaultProcessor"),$a=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{K(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=u},"catchProcessor"),wa=s((e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),u=t.io==="input"?i?o.out:o.in:o.out;D(u,t,n);let c=t.seen.get(e);c.ref=u},"pipeProcessor"),ba=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},"readonlyProcessor"),va=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"promiseProcessor"),zo=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"optionalProcessor"),xa=s((e,t,r,n)=>{let o=e._zod.innerType;D(o,t,n);let i=t.seen.get(e);i.ref=o},"lazyProcessor"),xo={string:Vc,number:Mc,boolean:Fc,bigint:Kc,symbol:Uc,null:Bc,undefined:Jc,void:Gc,never:qc,any:Wc,unknown:Xc,date:Hc,enum:Yc,literal:Qc,nan:ea,template_literal:ta,file:ra,success:na,custom:oa,function:ia,transform:sa,map:ua,set:ca,array:aa,object:la,union:ko,intersection:fa,tuple:pa,record:da,nullable:ma,nonoptional:ha,default:ya,prefault:_a,catch:$a,pipe:wa,readonly:ba,promise:va,optional:zo,lazy:xa};function So(e,t){if("_idmap"in e){let n=e,o=Ze({...t,processors:xo}),i={};for(let a of n._idmap.entries()){let[l,f]=a;D(f,o)}let u={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let a of n._idmap.entries()){let[l,f]=a;Ne(o,f),J(u,l,Ee(o,f))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";u.__shared={[a]:i}}return{schemas:u}}let r=Ze({...t,processors:xo});return D(e,r),Ne(r,e),Ee(r,e)}s(So,"toJSONSchema");var Po=class{static{s(this,"JSONSchemaGenerator")}get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Ze({processors:xo,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return D(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Ne(this.ctx,t);let n=Ee(this.ctx,t),{"~standard":o,...i}=n;return i}};var sp={};var Kt={};$e(Kt,{ZodAny:()=>Ba,ZodArray:()=>Wa,ZodBase64:()=>Jo,ZodBase64URL:()=>Go,ZodBigInt:()=>Mt,ZodBigIntFormat:()=>Xo,ZodBoolean:()=>Vt,ZodCIDRv4:()=>Uo,ZodCIDRv6:()=>Bo,ZodCUID:()=>Ro,ZodCUID2:()=>Lo,ZodCatch:()=>gl,ZodCodec:()=>Vr,ZodCreditCard:()=>Ra,ZodCustom:()=>Mr,ZodCustomStringFormat:()=>nt,ZodDate:()=>Cr,ZodDefault:()=>ll,ZodDiscriminatedUnion:()=>Ha,ZodE164:()=>qo,ZodEmail:()=>Eo,ZodEmoji:()=>To,ZodEnum:()=>Rt,ZodExactOptional:()=>ei,ZodFile:()=>sl,ZodFunction:()=>Sl,ZodGUID:()=>Co,ZodIBAN:()=>La,ZodIPv4:()=>Fo,ZodIPv6:()=>Ko,ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,ZodInstanceOf:()=>Al,ZodIntersection:()=>Ya,ZodJWT:()=>Wo,ZodKSUID:()=>Mo,ZodLazy:()=>xl,ZodLiteral:()=>il,ZodMAC:()=>Da,ZodMap:()=>nl,ZodNaN:()=>_l,ZodNanoID:()=>Do,ZodNever:()=>Ga,ZodNonOptional:()=>ti,ZodNull:()=>Ka,ZodNullable:()=>al,ZodNumber:()=>jt,ZodNumberFormat:()=>ot,ZodObject:()=>Dr,ZodOptional:()=>Lr,ZodPipe:()=>jr,ZodPrefault:()=>pl,ZodPreprocess:()=>$l,ZodPromise:()=>zl,ZodReadonly:()=>wl,ZodRecord:()=>Dt,ZodSet:()=>ol,ZodString:()=>Lt,ZodStringFormat:()=>R,ZodSuccess:()=>hl,ZodSymbol:()=>Ma,ZodTemplateLiteral:()=>vl,ZodTransform:()=>ul,ZodTuple:()=>el,ZodType:()=>A,ZodULID:()=>jo,ZodURL:()=>Er,ZodUUID:()=>ye,ZodUndefined:()=>Fa,ZodUnion:()=>Rr,ZodUnknown:()=>Ja,ZodVoid:()=>qa,ZodXID:()=>Vo,ZodXor:()=>Xa,_ZodString:()=>No,_default:()=>fl,_function:()=>_d,any:()=>Wp,array:()=>Tr,base64:()=>Ap,base64url:()=>Op,bigint:()=>Up,boolean:()=>Va,catch:()=>yl,check:()=>$d,cidrv4:()=>Pp,cidrv6:()=>Ip,codec:()=>md,creditCard:()=>Np,cuid:()=>$p,cuid2:()=>wp,currencyCode:()=>Lp,custom:()=>wd,date:()=>Hp,describe:()=>bd,discriminatedUnion:()=>nd,e164:()=>Zp,email:()=>ap,emoji:()=>yp,enum:()=>Yo,exactOptional:()=>cl,file:()=>ld,float32:()=>Vp,float64:()=>Mp,function:()=>_d,guid:()=>lp,hash:()=>jp,hex:()=>Rp,hostname:()=>Dp,httpUrl:()=>gp,iban:()=>Ep,instanceof:()=>xd,int:()=>Oo,int32:()=>Fp,int64:()=>Bp,intersection:()=>Qa,invertCodec:()=>hd,ipv4:()=>kp,ipv6:()=>Sp,json:()=>zd,jwt:()=>Cp,keyof:()=>Yp,ksuid:()=>xp,lazy:()=>kl,literal:()=>ad,looseObject:()=>td,looseRecord:()=>id,mac:()=>zp,map:()=>sd,meta:()=>vd,nan:()=>dd,nanoid:()=>_p,nativeEnum:()=>cd,never:()=>Ho,nonoptional:()=>ml,null:()=>Ua,nullable:()=>Nr,nullish:()=>fd,number:()=>ja,object:()=>Qp,optional:()=>tt,partialRecord:()=>od,pipe:()=>Zo,prefault:()=>dl,preprocess:()=>Sd,promise:()=>yd,readonly:()=>bl,record:()=>rl,refine:()=>Pl,set:()=>ud,strictObject:()=>ed,string:()=>Zr,stringFormat:()=>Tp,stringbool:()=>kd,success:()=>pd,superRefine:()=>Il,symbol:()=>Gp,templateLiteral:()=>gd,transform:()=>Qo,tuple:()=>tl,uint32:()=>Kp,uint64:()=>Jp,ulid:()=>bp,undefined:()=>qp,union:()=>Ft,unknown:()=>et,url:()=>hp,uuid:()=>fp,uuidv4:()=>pp,uuidv6:()=>dp,uuidv7:()=>mp,void:()=>Xp,xid:()=>vp,xor:()=>rd});var Io={};$e(Io,{endsWith:()=>zt,gt:()=>he,gte:()=>ue,includes:()=>xt,length:()=>Ye,lowercase:()=>bt,lt:()=>me,lte:()=>se,maxLength:()=>He,maxSize:()=>Oe,mime:()=>Pt,minLength:()=>xe,minSize:()=>ge,multipleOf:()=>Ae,negative:()=>$o,nonnegative:()=>bo,nonpositive:()=>wo,normalize:()=>It,overwrite:()=>de,positive:()=>_o,properties:()=>St,property:()=>vo,regex:()=>wt,size:()=>Xe,slugify:()=>Nt,startsWith:()=>kt,toLowerCase:()=>Ot,toUpperCase:()=>Zt,trim:()=>At,uppercase:()=>vt});var up=new WeakSet([Object.prototype,Error.prototype]);function Ao(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}s(Ao,"_lazyMethod");var cp=s((e,t)=>{zi.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);up.has(r)||(up.add(r),Ao(r,"format",n=>o=>nr(n,o)),Ao(r,"flatten",n=>o=>rr(n,o)),Ao(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ct,2)}),Ao(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ct,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),wy=h("ZodError",cp),ie=h("ZodError",cp,void 0,{Parent:Error});var ka=pt(ie),za=dt(ie),Sa=mt(ie),Pa=ht(ie),Ia=sn(ie),Aa=un(ie),Oa=cn(ie),Za=an(ie),Na=ln(ie),Ea=fn(ie),Ca=pn(ie),Ta=dn(ie);function vy(){B.localeError||M(vr())}s(vy,"_ensureDefaultLocale");function rt(){B.memoizer||M({memoizer:br()})}s(rt,"_ensureDefaultMemoizer");var A=h("ZodType",(e,t)=>(vy(),P.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(v.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return C(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Pl(e,t))},superRefine(e,t){return this.check(Il(e,t))},overwrite(e){return this.check(de(e))},optional(){return tt(this)},exactOptional(){return cl(this)},nullable(){return Nr(this)},nullish(){return tt(Nr(this))},nonoptional(e){return ml(this,e)},array(){return Tr(this)},or(e){return Ft([this,e])},and(e){return Qa(this,e)},transform(e){return Zo(this,Qo(e))},default(e){return fl(this,e)},prefault(e){return dl(this,e)},catch(e){return yl(this,e)},pipe(e){return Zo(this,e)},readonly(){return bl(this)},describe(e){let t=this.clone();return G.add(t,{description:e}),t},meta(...e){if(e.length===0)return G.get(this);let t=this.clone();return G.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 v.hide(this,"~standard",{...kn(this),jsonSchema:{input:Et(this,"input"),output:Et(this,"output")}})},set"~standard"(e){v.own(this,"~standard",e)},parse:s(function e(t,r){return ka(this,t,r,{callee:e})},"_parse"),parseAsync:s(async function e(t,r){return await za(this,t,r,{callee:e})},"_parseAsync"),safeParse(e,t){return Sa(this,e,t)},async safeParseAsync(e,t){return Pa(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){v.own(this,"spa",e)},validate(e,t){return or(this,e,t)},validateAsync(e,t){return ir(this,e,t)},encode:s(function e(t,r){return Ia(this,t,r,{callee:e})},"_encode"),decode:s(function e(t,r){return Aa(this,t,r,{callee:e})},"_decode"),encodeAsync:s(async function e(t,r){return await Oa(this,t,r,{callee:e})},"_encodeAsync"),decodeAsync:s(async function e(t,r){return await Za(this,t,r,{callee:e})},"_decodeAsync"),safeEncode(e,t){return Na(this,e,t)},safeDecode(e,t){return Ea(this,e,t)},async safeEncodeAsync(e,t){return Ca(this,e,t)},async safeDecodeAsync(e,t){return Ta(this,e,t)},toJSONSchema(e){return Rc(this,{})(e)},get description(){return G.get(this)?.description},get _def(){return this._zod.def}}),No=h("_ZodString",(e,t)=>{Be.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vc(e,r,n,o)},v.derived({format:s(e=>U(e).format??null,"format"),minLength:s(e=>U(e).minimum??null,"minLength"),maxLength:s(e=>U(e).maximum??null,"maxLength")},{regex(...e){return this.check(wt(...e))},includes(...e){return this.check(xt(...e))},startsWith(...e){return this.check(kt(...e))},endsWith(...e){return this.check(zt(...e))},min(...e){return this.check(xe(...e))},max(...e){return this.check(He(...e))},length(...e){return this.check(Ye(...e))},nonempty(...e){return this.check(xe(1,...e))},lowercase(e){return this.check(bt(e))},uppercase(e){return this.check(vt(e))},trim(){return this.check(At())},normalize(...e){return this.check(It(...e))},toLowerCase(){return this.check(Ot())},toUpperCase(){return this.check(Zt())},slugify(){return this.check(Nt())}})),Lt=h("ZodString",(e,t)=>{Be.init(e,t),No.init(e,t)},{email(e){return this.check(Xn(Eo,e))},url(e){return this.check(kr(Er,e))},jwt(e){return this.check(yo(Wo,e))},emoji(e){return this.check(ro(To,e))},guid(e){return this.check(Hn(Co,e))},uuid(e){return this.check(Yn(ye,e))},uuidv4(e){return this.check(Qn(ye,e))},uuidv6(e){return this.check(eo(ye,e))},uuidv7(e){return this.check(to(ye,e))},nanoid(e){return this.check(no(Do,e))},cuid(e){return this.check(oo(Ro,e))},cuid2(e){return this.check(io(Lo,e))},ulid(e){return this.check(so(jo,e))},base64(e){return this.check(mo(Jo,e))},base64url(e){return this.check(ho(Go,e))},xid(e){return this.check(uo(Vo,e))},ksuid(e){return this.check(co(Mo,e))},ipv4(e){return this.check(ao(Fo,e))},ipv6(e){return this.check(lo(Ko,e))},cidrv4(e){return this.check(fo(Uo,e))},cidrv6(e){return this.check(po(Bo,e))},e164(e){return this.check(go(qo,e))},datetime(e){return this.check(zr(Ce,e))},date(e){return this.check(Sr(Te,e))},time(e){return this.check(Pr(De,e))},duration(e){return this.check(Ir(Re,e))}});function Zr(e){return Qu(Lt,e)}s(Zr,"string");var R=h("ZodStringFormat",(e,t)=>{T.init(e,t),No.init(e,t)}),Ce=h("ZodISODateTime",(e,t)=>{Bs.init(e,t),R.init(e,t)}),Te=h("ZodISODate",(e,t)=>{Js.init(e,t),R.init(e,t)}),De=h("ZodISOTime",(e,t)=>{Gs.init(e,t),R.init(e,t)}),Re=h("ZodISODuration",(e,t)=>{qs.init(e,t),R.init(e,t)}),Eo=h("ZodEmail",(e,t)=>{Cs.init(e,t),R.init(e,t)});function ap(e){return Xn(Eo,e)}s(ap,"email");var Co=h("ZodGUID",(e,t)=>{Ns.init(e,t),R.init(e,t)});function lp(e){return Hn(Co,e)}s(lp,"guid");var ye=h("ZodUUID",(e,t)=>{Es.init(e,t),R.init(e,t)});function fp(e){return Yn(ye,e)}s(fp,"uuid");function pp(e){return Qn(ye,e)}s(pp,"uuidv4");function dp(e){return eo(ye,e)}s(dp,"uuidv6");function mp(e){return to(ye,e)}s(mp,"uuidv7");var Er=h("ZodURL",(e,t)=>{Rs.init(e,t),R.init(e,t)});function hp(e){return kr(Er,e)}s(hp,"url");function gp(e){return kr(Er,{protocol:sr,hostname:qi,...v.normalizeParams(e)})}s(gp,"httpUrl");var To=h("ZodEmoji",(e,t)=>{Ls.init(e,t),R.init(e,t)});function yp(e){return ro(To,e)}s(yp,"emoji");var Do=h("ZodNanoID",(e,t)=>{js.init(e,t),R.init(e,t)});function _p(e){return no(Do,e)}s(_p,"nanoid");var Ro=h("ZodCUID",(e,t)=>{Vs.init(e,t),R.init(e,t)});function $p(e){return oo(Ro,e)}s($p,"cuid");var Lo=h("ZodCUID2",(e,t)=>{Ms.init(e,t),R.init(e,t)});function wp(e){return io(Lo,e)}s(wp,"cuid2");var jo=h("ZodULID",(e,t)=>{Fs.init(e,t),R.init(e,t)});function bp(e){return so(jo,e)}s(bp,"ulid");var Vo=h("ZodXID",(e,t)=>{Ks.init(e,t),R.init(e,t)});function vp(e){return uo(Vo,e)}s(vp,"xid");var Mo=h("ZodKSUID",(e,t)=>{Us.init(e,t),R.init(e,t)});function xp(e){return co(Mo,e)}s(xp,"ksuid");var Fo=h("ZodIPv4",(e,t)=>{Ws.init(e,t),R.init(e,t)});function kp(e){return ao(Fo,e)}s(kp,"ipv4");var Da=h("ZodMAC",(e,t)=>{Hs.init(e,t),R.init(e,t)});function zp(e){return tc(Da,e)}s(zp,"mac");var Ko=h("ZodIPv6",(e,t)=>{Xs.init(e,t),R.init(e,t)});function Sp(e){return lo(Ko,e)}s(Sp,"ipv6");var Uo=h("ZodCIDRv4",(e,t)=>{Ys.init(e,t),R.init(e,t)});function Pp(e){return fo(Uo,e)}s(Pp,"cidrv4");var Bo=h("ZodCIDRv6",(e,t)=>{Qs.init(e,t),R.init(e,t)});function Ip(e){return po(Bo,e)}s(Ip,"cidrv6");var Jo=h("ZodBase64",(e,t)=>{eu.init(e,t),R.init(e,t)});function Ap(e){return mo(Jo,e)}s(Ap,"base64");var Go=h("ZodBase64URL",(e,t)=>{tu.init(e,t),R.init(e,t)});function Op(e){return ho(Go,e)}s(Op,"base64url");var qo=h("ZodE164",(e,t)=>{ru.init(e,t),R.init(e,t)});function Zp(e){return go(qo,e)}s(Zp,"e164");var Ra=h("ZodCreditCard",(e,t)=>{nu.init(e,t),R.init(e,t)});function Np(e){return rc(Ra,e)}s(Np,"creditCard");var La=h("ZodIBAN",(e,t)=>{ou.init(e,t),R.init(e,t)});function Ep(e){return nc(La,e)}s(Ep,"iban");var Wo=h("ZodJWT",(e,t)=>{iu.init(e,t),R.init(e,t)});function Cp(e){return yo(Wo,e)}s(Cp,"jwt");var nt=h("ZodCustomStringFormat",(e,t)=>{su.init(e,t),R.init(e,t)});function Tp(e,t,r={}){return Qe(nt,e,t,r)}s(Tp,"stringFormat");function Dp(e){return Qe(nt,"hostname",Gi,e)}s(Dp,"hostname");function Rp(e){return Qe(nt,"hex",cs,e)}s(Rp,"hex");function Lp(e){return Qe(nt,"currency_code",Xi,e)}s(Lp,"currencyCode");function jp(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=le[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Qe(nt,n,o,t)}s(jp,"hash");var jt=h("ZodNumber",(e,t)=>{Cn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mc(e,r,n,o),e.isFinite=!0},v.derived({minValue:s(e=>{let{minimum:t,exclusiveMinimum:r}=U(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},"minValue"),maxValue:s(e=>{let{maximum:t,exclusiveMaximum:r}=U(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},"maxValue"),isInt:s(e=>{let{isInt:t,multipleOf:r}=U(e);return!!t||!!r?.some(Number.isSafeInteger)},"isInt"),format:s(e=>U(e).format??null,"format")},{gt(e,t){return this.check(he(e,t))},gte(e,t){return this.check(ue(e,t))},min(e,t){return this.check(ue(e,t))},lt(e,t){return this.check(me(e,t))},lte(e,t){return this.check(se(e,t))},max(e,t){return this.check(se(e,t))},int(e){return this.check(Oo(e))},safe(e){return this.check(Oo(e))},positive(e){return this.check(he(0,e))},nonnegative(e){return this.check(ue(0,e))},negative(e){return this.check(me(0,e))},nonpositive(e){return this.check(se(0,e))},multipleOf(e,t){return this.check(Ae(e,t))},step(e,t){return this.check(Ae(e,t))},finite(){return this}}));function ja(e){return ic(jt,e)}s(ja,"number");var ot=h("ZodNumberFormat",(e,t)=>{uu.init(e,t),jt.init(e,t)});function Oo(e){return uc(ot,e)}s(Oo,"int");function Vp(e){return cc(ot,e)}s(Vp,"float32");function Mp(e){return ac(ot,e)}s(Mp,"float64");function Fp(e){return lc(ot,e)}s(Fp,"int32");function Kp(e){return fc(ot,e)}s(Kp,"uint32");var Vt=h("ZodBoolean",(e,t)=>{hr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fc(e,r,n,o)});function Va(e){return pc(Vt,e)}s(Va,"boolean");var Mt=h("ZodBigInt",(e,t)=>{Tn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kc(e,r,n,o)},v.derived({minValue:s(e=>U(e).minimum??null,"minValue"),maxValue:s(e=>U(e).maximum??null,"maxValue"),format:s(e=>U(e).format??null,"format")},{gte(e,t){return this.check(ue(e,t))},min(e,t){return this.check(ue(e,t))},gt(e,t){return this.check(he(e,t))},lt(e,t){return this.check(me(e,t))},lte(e,t){return this.check(se(e,t))},max(e,t){return this.check(se(e,t))},positive(e){return this.check(he(BigInt(0),e))},negative(e){return this.check(me(BigInt(0),e))},nonpositive(e){return this.check(se(BigInt(0),e))},nonnegative(e){return this.check(ue(BigInt(0),e))},multipleOf(e,t){return this.check(Ae(e,t))}}));function Up(e){return mc(Mt,e)}s(Up,"bigint");var Xo=h("ZodBigIntFormat",(e,t)=>{cu.init(e,t),Mt.init(e,t)});function Bp(e){return gc(Xo,e)}s(Bp,"int64");function Jp(e){return yc(Xo,e)}s(Jp,"uint64");var Ma=h("ZodSymbol",(e,t)=>{au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uc(e,r,n,o)});function Gp(e){return _c(Ma,e)}s(Gp,"symbol");var Fa=h("ZodUndefined",(e,t)=>{lu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jc(e,r,n,o)});function qp(e){return $c(Fa,e)}s(qp,"_undefined");var Ka=h("ZodNull",(e,t)=>{fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bc(e,r,n,o)});function Ua(e){return wc(Ka,e)}s(Ua,"_null");var Ba=h("ZodAny",(e,t)=>{pu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wc(e,r,n,o)});function Wp(){return bc(Ba)}s(Wp,"any");var Ja=h("ZodUnknown",(e,t)=>{du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xc(e,r,n,o)});function et(){return vc(Ja)}s(et,"unknown");var Ga=h("ZodNever",(e,t)=>{mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qc(e,r,n,o)});function Ho(e){return xc(Ga,e)}s(Ho,"never");var qa=h("ZodVoid",(e,t)=>{hu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gc(e,r,n,o)});function Xp(e){return kc(qa,e)}s(Xp,"_void");var Cr=h("ZodDate",(e,t)=>{gu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hc(e,r,n,o),e.min=(r,n)=>e.check(ue(r,n)),e.max=(r,n)=>e.check(se(r,n))},v.derived({minDate:s(e=>{let{minimum:t}=U(e);return t?new Date(t):null},"minDate"),maxDate:s(e=>{let{maximum:t}=U(e);return t?new Date(t):null},"maxDate")},{}));function Hp(e){return zc(Cr,e)}s(Hp,"date");var Wa=h("ZodArray",(e,t)=>{rt(),yu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>aa(e,r,n,o),e.element=t.element},{min(e,t){return this.check(xe(e,t))},nonempty(e){return this.check(xe(1,e))},max(e,t){return this.check(He(e,t))},length(e,t){return this.check(Ye(e,t))},unwrap(){return this.element}});function Tr(e,t){return Ic(Wa,e,t)}s(Tr,"array");function Yp(e){let t=e._zod.def.shape;return Yo(Object.keys(t))}s(Yp,"keyof");var Dr=h("ZodObject",(e,t)=>{rt(),_u.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>la(e,r,n,o),v.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Yo(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(v.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(v.mergeDefs(this._zod.def,{catchall:et()}))},loose(){return this.clone(v.mergeDefs(this._zod.def,{catchall:et()}))},strict(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Ho()}))},strip(){return this.clone(v.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return v.extend(this,e)},safeExtend(e){return v.safeExtend(this,e)},merge(e){return v.merge(this,e)},pick(e){return v.pick(this,e)},omit(e){return v.omit(this,e)},partial(...e){return v.partial(Lr,this,e[0])},exactPartial(...e){return v.partial(ei,this,e[0],"exactPartial")},required(...e){return v.required(ti,this,e[0])}});function Qp(e,t){let r={type:"object",shape:e??{},...v.normalizeParams(t)};return new Dr(r)}s(Qp,"object");function ed(e,t){return new Dr({type:"object",shape:e,catchall:Ho(),...v.normalizeParams(t)})}s(ed,"strictObject");function td(e,t){return new Dr({type:"object",shape:e,catchall:et(),...v.normalizeParams(t)})}s(td,"looseObject");var Rr=h("ZodUnion",(e,t)=>{gr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.options=t.options});function Ft(e,t){return new Rr({type:"union",options:e,...v.normalizeParams(t)})}s(Ft,"union");var Xa=h("ZodXor",(e,t)=>{Rr.init(e,t),$u.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.options=t.options});function rd(e,t){return new Xa({type:"union",options:e,inclusive:!1,...v.normalizeParams(t)})}s(rd,"xor");var Ha=h("ZodDiscriminatedUnion",(e,t)=>{Rr.init(e,t),bu.init(e,t)});function nd(e,t,r){return new Ha({type:"union",options:t,discriminator:e,...v.normalizeParams(r)})}s(nd,"discriminatedUnion");var Ya=h("ZodIntersection",(e,t)=>{vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fa(e,r,n,o)});function Qa(e,t){return new Ya({type:"intersection",left:e,right:t})}s(Qa,"intersection");var el=h("ZodTuple",(e,t)=>{rt(),Dn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pa(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Lr({type:"optional",innerType:t}))})}});function tl(e,t,r){let n=t instanceof P,o=n?r:t,i=n?t:null;return new el({type:"tuple",items:e,rest:i,...v.normalizeParams(o)})}s(tl,"tuple");var Dt=h("ZodRecord",(e,t)=>{rt(),xu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>da(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function rl(e,t,r){return!t||!t._zod?new Dt({type:"record",keyType:Zr(),valueType:e,...v.normalizeParams(t)}):new Dt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r)})}s(rl,"record");function od(e,t,r){return new Dt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r),partial:!0})}s(od,"partialRecord");function id(e,t,r){return new Dt({type:"record",keyType:e,valueType:t,mode:"loose",...v.normalizeParams(r)})}s(id,"looseRecord");var nl=h("ZodMap",(e,t)=>{rt(),ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ua(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(ge(...r)),e.nonempty=r=>e.check(ge(1,r)),e.max=(...r)=>e.check(Oe(...r)),e.size=(...r)=>e.check(Xe(...r))});function sd(e,t,r){return new nl({type:"map",keyType:e,valueType:t,...v.normalizeParams(r)})}s(sd,"map");var ol=h("ZodSet",(e,t)=>{rt(),zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ca(e,r,n,o),e.min=(...r)=>e.check(ge(...r)),e.nonempty=r=>e.check(ge(1,r)),e.max=(...r)=>e.check(Oe(...r)),e.size=(...r)=>e.check(Xe(...r))});function ud(e,t){return new ol({type:"set",valueType:e,...v.normalizeParams(t)})}s(ud,"set");var Rt=h("ZodEnum",(e,t)=>{Su.init(e,t),A.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Yc(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let u of n)if(r.has(u))i[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Rt({...t,checks:[],...v.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let u of n)if(r.has(u))delete i[u];else throw new Error(`Key ${u} not found in enum`);return new Rt({...t,checks:[],...v.normalizeParams(o),entries:i})}});function Yo(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Rt({type:"enum",entries:r,...v.normalizeParams(t)})}s(Yo,"_enum");function cd(e,t){return new Rt({type:"enum",entries:e,...v.normalizeParams(t)})}s(cd,"nativeEnum");var il=h("ZodLiteral",(e,t)=>{Pu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qc(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ad(e,t){return new il({type:"literal",values:Array.isArray(e)?e:[e],...v.normalizeParams(t)})}s(ad,"literal");var sl=h("ZodFile",(e,t)=>{Iu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ra(e,r,n,o),e.min=(r,n)=>e.check(ge(r,n)),e.max=(r,n)=>e.check(Oe(r,n)),e.mime=(r,n)=>e.check(Pt(Array.isArray(r)?r:[r],n))});function ld(e){return Ac(sl,e)}s(ld,"file");var ul=h("ZodTransform",(e,t)=>{rt(),Au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sa(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(v.issue(i,r.value,t));else{let u=i;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),"input"in u||(u.input=r.value),u.inst??(u.inst=e),r.issues.push(v.issue(u))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Qo(e){return new ul({type:"transform",transform:e})}s(Qo,"transform");var Lr=h("ZodOptional",(e,t)=>{Rn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function tt(e){return new Lr({type:"optional",innerType:e})}s(tt,"optional");var ei=h("ZodExactOptional",(e,t)=>{Ou.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zo(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cl(e){return new ei({type:"optional",innerType:e})}s(cl,"exactOptional");var al=h("ZodNullable",(e,t)=>{Zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ma(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Nr(e){return new al({type:"nullable",innerType:e})}s(Nr,"nullable");function fd(e){return tt(Nr(e))}s(fd,"nullish");var ll=h("ZodDefault",(e,t)=>{Nu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ya(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fl(e,t){return new ll({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}s(fl,"_default");var pl=h("ZodPrefault",(e,t)=>{Eu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function dl(e,t){return new pl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}s(dl,"prefault");var ti=h("ZodNonOptional",(e,t)=>{Cu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ha(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ml(e,t){return new ti({type:"nonoptional",innerType:e,...v.normalizeParams(t)})}s(ml,"nonoptional");var hl=h("ZodSuccess",(e,t)=>{Tu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>na(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function pd(e){return new hl({type:"success",innerType:e})}s(pd,"success");var gl=h("ZodCatch",(e,t)=>{Du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yl(e,t){return new gl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:v.constantCatch(t)})}s(yl,"_catch");var _l=h("ZodNaN",(e,t)=>{Ru.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ea(e,r,n,o)});function dd(e){return Pc(_l,e)}s(dd,"nan");var jr=h("ZodPipe",(e,t)=>{Ln.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wa(e,r,n,o),e.in=t.in,e.out=t.out});function Zo(e,t){return new jr({type:"pipe",in:e,out:t})}s(Zo,"pipe");var Vr=h("ZodCodec",(e,t)=>{jr.init(e,t),yr.init(e,t)});function md(e,t,r){return new Vr({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}s(md,"codec");function hd(e){let t=e._zod.def;return new Vr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}s(hd,"invertCodec");var $l=h("ZodPreprocess",(e,t)=>{jr.init(e,t),Lu.init(e,t)}),wl=h("ZodReadonly",(e,t)=>{ju.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ba(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bl(e){return new wl({type:"readonly",innerType:e})}s(bl,"readonly");var vl=h("ZodTemplateLiteral",(e,t)=>{Vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ta(e,r,n,o)});function gd(e,t){return new vl({type:"template_literal",parts:e,...v.normalizeParams(t)})}s(gd,"templateLiteral");var xl=h("ZodLazy",(e,t)=>{_r.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xa(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function kl(e){return new xl({type:"lazy",getter:e})}s(kl,"lazy");var zl=h("ZodPromise",(e,t)=>{Fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>va(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function yd(e){return new zl({type:"promise",innerType:e})}s(yd,"promise");var Sl=h("ZodFunction",(e,t)=>{Mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ia(e,r,n,o)});function _d(e){return new Sl({type:"function",input:Array.isArray(e?.input)?tl(e?.input):e?.input??Tr(et()),output:e?.output??et()})}s(_d,"_function");var Mr=h("ZodCustom",(e,t)=>{Ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oa(e,r,n,o)});function $d(e){let t=new L({check:"custom"});return t._zod.check=e,t}s($d,"check");function wd(e,t){return Oc(Mr,e??(()=>!0),t)}s(wd,"custom");function Pl(e,t={}){return Zc(Mr,e,t)}s(Pl,"refine");function Il(e,t){return Nc(e,t)}s(Il,"superRefine");var bd=Ec,vd=Cc,Al=h("ZodInstanceOf",(e,t)=>{Mr.init(e,t)},{properties(e,t){return this.check(St(e,t))}});function xd(e,t={}){let r=new Al({type:"custom",check:"custom",fn:s(n=>n instanceof e,"fn"),abort:!0,...v.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}s(xd,"_instanceof");var kd=s((...e)=>Tc({Codec:Vr,Boolean:Vt,String:Lt},...e),"stringbool");function zd(e){let t=kl(()=>Ft([Zr(e),ja(),Va(),Ua(),Tr(t),rl(Zr(),t)]));return t}s(zd,"json");function Sd(e,t){return new $l({type:"pipe",in:Qo(e),out:t})}s(Sd,"preprocess");var xy={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 ky(e){M({customError:e})}s(ky,"setErrorMap");function zy(){return M().customError}s(zy,"getErrorMap");var Ol;Ol||(Ol={});var Fr={};$e(Fr,{ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,date:()=>Py,datetime:()=>Sy,duration:()=>Ay,time:()=>Iy});function Sy(e){return zr(Ce,e)}s(Sy,"datetime");function Py(e){return Sr(Te,e)}s(Py,"date");function Iy(e){return Pr(De,e)}s(Iy,"time");function Ay(e){return Ir(Re,e)}s(Ay,"duration");var w={...Kt,...Io,iso:Fr},Oy=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 Zy(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}s(Zy,"detectVersion");function Pd(e,t){return e.map((r,n)=>n<t?r:r.optional())}s(Pd,"applyMinItems");function Ny(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}s(Ny,"decodeJSONPointerSegment");function Ey(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let o=r[1]===void 0?void 0:Ny(r[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}s(Ey,"resolveRef");function Cy(e,t){return w.transform(n=>n).check(n=>{let o=n.value;if(typeof o!="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties&&n.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&n.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0}),t.keySchema)for(let u of i){let c=t.keySchema.safeParse(u);c.success||n.issues.push({code:"invalid_key",origin:"record",issues:c.error.issues,input:u,path:[u],continue:!0})}}).pipe(e)}s(Cy,"checkObjectGuards");function Zl(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let n=String(e);return`${r[0]}${n.length}:${n}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let u of e){let c=Zl(u,t);if(c===null)return null;i.push(c)}return`a${i.length}:[${i.join(",")}]`}let n=Object.keys(e).sort(),o=[];for(let i of n){let u=Zl(e[i],t);if(u===null)return null;o.push(`${i.length}:${i}=${u}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}s(Zl,"canonicalKey");var Ty=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Dy=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Kr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Kr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>Ty.has(t)?Kr(r):!Dy.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(Kr))}s(Kr,"containsRef");function Id(e){return e===1?"element":"elements"}s(Id,"plural");function Ry(e,t){return w.transform(n=>n).check(n=>{let o=n.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let u=0;u<o.length;u++){let c=Zl(o[u],new Set);if(c===null)continue;let a=i.get(c);if(a===void 0){i.set(c,u);continue}n.issues.push({code:"custom",message:`Array items must be unique: element at index ${u} duplicates the one at index ${a}`,input:o,path:[u],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,u=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,c=0;for(let a of o)if(t.containsSchema.safeParse(a).success&&++c>=u)break;c<i&&n.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Id(i)}; found ${c}`,input:o,continue:!0}),t.maxContains!==void 0&&c>t.maxContains&&n.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Id(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}s(Ry,"checkArrayGuards");function Ad(e,t){if(e!==!1)return e===void 0||e===!0?w.any():ee(e,t)}s(Ad,"getTupleRest");var Ly=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Od(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return w.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 w.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=Ey(o,t),u=ee(i,t);return t.refs.set(o,u),t.processing.delete(o),u}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 w.null();if(o.length===0)return w.never();if(o.length===1)return w.literal(o[0]);if(o.every(u=>typeof u=="string"))return w.enum(o);let i=o.map(u=>w.literal(u));return i.length<2?i[0]:w.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return w.literal(e.const);let r=e.type;if(Array.isArray(r)){let o=r.map(i=>{let u={...e,type:i};return Od(u,t)});return o.length===0?w.never():o.length===1?o[0]:w.union(o)}if(!r)return w.any();let n;switch(r){case"string":{let o=w.string();if(e.format){let i=e.format;i==="email"?o=o.check(w.email()):i==="uri"||i==="uri-reference"?o=o.check(w.url()):i==="uuid"||i==="guid"?o=o.check(w.uuid()):i==="date-time"?o=o.check(w.iso.datetime({offset:!0})):i==="date"?o=o.check(w.iso.date()):i==="time"?o=o.check(w.regex(Ly)):i==="duration"?o=o.check(w.iso.duration()):i==="hostname"?o=o.check(w.hostname()):i==="ipv4"?o=o.check(w.ipv4()):i==="ipv6"?o=o.check(w.ipv6()):i==="mac"?o=o.check(w.mac()):i==="cidr"?o=o.check(w.cidrv4()):i==="cidr-v6"?o=o.check(w.cidrv6()):i==="base64"?o=o.check(w.base64()):i==="base64url"?o=o.check(w.base64url()):i==="e164"?o=o.check(w.e164()):i==="credit_card"?o=o.check(w.creditCard()):i==="iban"?o=o.check(w.iban()):i==="jwt"?o=o.check(w.jwt()):i==="emoji"?o=o.check(w.emoji()):i==="nanoid"?o=o.check(w.nanoid()):i==="cuid"?o=o.check(w.cuid()):i==="cuid2"?o=o.check(w.cuid2()):i==="ulid"?o=o.check(w.ulid()):i==="xid"?o=o.check(w.xid()):i==="ksuid"&&(o=o.check(w.ksuid()))}typeof e.minLength=="number"&&(o=o.min(e.minLength)),typeof e.maxLength=="number"&&(o=o.max(e.maxLength)),e.pattern&&(o=o.regex(new RegExp(e.pattern))),n=o;break}case"number":case"integer":{let o=r==="integer"?w.number().int():w.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(o=o.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(o=o.max(e.maximum)),typeof e.exclusiveMinimum=="number"?o=o.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(o=o.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?o=o.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(o=o.lt(e.maximum)),typeof e.multipleOf=="number"&&(o=o.multipleOf(e.multipleOf)),n=o;break}case"boolean":{n=w.boolean();break}case"null":{n=w.null();break}case"object":{let o={},i=e.properties||{},u=new Set(e.required||[]),c=typeof e.additionalProperties=="object"?ee(e.additionalProperties,t):void 0;for(let[p,d]of Object.entries(i)){let m=ee(d,t);J(o,p,u.has(p)?m:m.optional())}if(e.patternProperties){let p=e.patternProperties,d=Object.keys(p),m=[];for(let y of d){let $=ee(p[y],t),z=w.string().regex(new RegExp(y));m.push(w.looseRecord(z,$))}let g=[];if(Object.keys(o).length>0&&g.push(w.object(o).passthrough()),g.push(...m),g.length===0)n=w.object({}).passthrough();else if(g.length===1)n=g[0];else{let y=w.intersection(g[0],g[1]);for(let $=2;$<g.length;$++)y=w.intersection(y,g[$]);n=y}if(e.additionalProperties===!1){let y=Object.keys(o),$=d.map(x=>new RegExp(x)),z=n;n=n.check(x=>{if(!ce(x.value))return;let I=[];for(let E of Object.keys(x.value))y.includes(E)||$.some(j=>j.test(E))||I.push(E);I.length&&x.issues.push({code:"unrecognized_keys",keys:I,input:x.value,inst:z})})}}else{let p=w.object(o);e.additionalProperties===!1?n=p.strict():c?n=p.catchall(c):n=p.passthrough()}let a=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(a||l!==void 0||f!==void 0){let p;if(a){let d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;p=ee(d,t)}n=Cy(n,{keySchema:p,minProperties:l,maxProperties:f})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let u=typeof e.minItems=="number"?e.minItems:0,c=o.map(p=>ee(p,t)),a=Pd(c,u),l=Array.isArray(i)?void 0:Ad(i,t),f=w.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(Array.isArray(i)){let u=typeof e.minItems=="number"?e.minItems:0,c=i.map(p=>ee(p,t)),a=Pd(c,u),l=Ad(e.additionalItems,t),f=w.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(i!==void 0){let u=ee(i,t),c=w.array(u);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),n=c}else n=w.array(w.any());(e.uniqueItems===!0||e.contains!==void 0)&&(n=Ry(n,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ee(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return n}s(Od,"convertBaseSchema");function ee(e,t){if(typeof e=="boolean")return e?w.any():w.never();let r=Od(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(l=>ee(l,t)),a=w.union(c);r=n?w.intersection(r,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(l=>ee(l,t)),a=w.xor(c);r=n?w.intersection(r,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:w.any();else{let c=n?r:ee(e.allOf[0],t),a=n?0:1;for(let l=a;l<e.allOf.length;l++)c=w.intersection(c,ee(e.allOf[l],t));r=c}e.nullable===!0&&t.version==="openapi-3.0"&&(r=w.nullable(r)),e.readOnly===!0&&(r=w.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of i)c in e&&(o[c]=e[c]);let u=["contentEncoding","contentMediaType","contentSchema"];for(let c of u)c in e&&(o[c]=e[c]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Kr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let c of["minProperties","maxProperties"])e[c]!==void 0&&(o[c]=e[c])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Kr(e.contains)&&(o.contains=e.contains);for(let c of["uniqueItems","minContains","maxContains"])e[c]!==void 0&&(o[c]=e[c])}for(let c of Object.keys(e))Oy.has(c)||J(o,c,e[c]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}s(ee,"convertSchema");function Zd(e,t){if(typeof e=="boolean")return e?w.any():w.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=Zy(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??G};return ee(r,i)}s(Zd,"fromJSONSchema");var Nd=Symbol("z.visit/resolving");function Ur(e,t){let r=typeof t=="function"?t:(u,c)=>{let a=t[u._zod.def.type];return a?a(u,c):u},n=new Map;function o(u){let c=n.get(u);if(c===Nd)return new _r({type:"lazy",getter:s(()=>n.get(u),"getter")});if(c!==void 0)return c;n.set(u,Nd);let a=i(u),l=r(a,a!==u);return n.set(u,l),l}s(o,"run");function i(u){let c=u._zod.def,a=c.type;switch(a){case"object":{let l=c.shape,f=Object.keys(l),p=!1,d={};for(let g of f){let y=o(l[g]);y!==l[g]&&(p=!0),d[g]=y}let m=c.catchall;return c.catchall&&(m=o(c.catchall),m!==c.catchall&&(p=!0)),p?C(u,{...c,shape:d,catchall:m}):u}case"array":{let l=o(c.element);return l===c.element?u:C(u,{...c,element:l})}case"tuple":{let l=c.items,f=!1,p=[];for(let m of l){let g=o(m);g!==m&&(f=!0),p.push(g)}let d=c.rest;return c.rest&&(d=o(c.rest),d!==c.rest&&(f=!0)),f?C(u,{...c,items:p,rest:d}):u}case"record":case"map":{let l=o(c.keyType),f=o(c.valueType);return l===c.keyType&&f===c.valueType?u:C(u,{...c,keyType:l,valueType:f})}case"set":{let l=o(c.valueType);return l===c.valueType?u:C(u,{...c,valueType:l})}case"union":{let l=c.options,f=!1,p=[];for(let d of l){let m=o(d);m!==d&&(f=!0),p.push(m)}return f?C(u,{...c,options:p}):u}case"intersection":{let l=o(c.left),f=o(c.right);return l===c.left&&f===c.right?u:C(u,{...c,left:l,right:f})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=o(c.innerType);return l===c.innerType?u:C(u,{...c,innerType:l})}case"pipe":{let l=o(c.in),f=o(c.out);return l===c.in&&f===c.out?u:C(u,{...c,in:l,out:f})}case"function":{let l=o(c.input),f=o(c.output);return l===c.input&&f===c.output?u:C(u,{...c,input:l,output:f})}case"lazy":{let l=c.getter,{_cachedInner:f,...p}=c;return C(u,{...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 u;default:return u}}return s(i,"mapInner"),o(e)}s(Ur,"visit");function Ed(e){return Ur(e,{object:s(t=>t.partial(),"object"),union:s(t=>{let r=t._zod.def;return r.discriminator===void 0?t:Ft(r.options)},"union")})}s(Ed,"deepPartial");function jy(e,t){if(!t?.length)return e;let r=e._zod.def;return C(e,fe(r,{checks:[...r.checks??[],...t]}),{parent:!0})}s(jy,"withChecks");function Cd(e){return jy(e.out,e.checks)}s(Cd,"outSide");function Vy(e){return e.in._zod.traits.has("$ZodTransform")?Cd(e):e.in}s(Vy,"inSide");function Td(e){return Ur(e,{pipe:s(t=>Vy(t._zod.def),"pipe"),default:s((t,r)=>r?tt(t._zod.def.innerType):t,"default"),catch:s((t,r)=>r?t._zod.def.innerType:t,"catch")})}s(Td,"input");function Dd(e){return Ur(e,{pipe:s(t=>Cd(t._zod.def),"pipe"),prefault:s((t,r)=>r?t._zod.def.innerType:t,"prefault")})}s(Dd,"output");var Nl={};$e(Nl,{bigint:()=>Uy,boolean:()=>Ky,date:()=>By,number:()=>Fy,string:()=>My});function My(e){return ec(Lt,e)}s(My,"string");function Fy(e){return sc(jt,e)}s(Fy,"number");function Ky(e){return dc(Vt,e)}s(Ky,"boolean");function Uy(e){return hc(Mt,e)}s(Uy,"bigint");function By(e){return Sc(Cr,e)}s(By,"date");var El=1e4,Rd=b.string().min(1).max(1024),_e=b.array(Rd).max(El),Jy=b.enum(["project","chronological","machine"]),Gy=b.enum(["updated","created","alpha","none"]),qy=b.enum(["default","ascending","descending"]),Wy=b.enum(["muted","colour"]),Xy=b.enum(["12h","1d","3d","1w","never"]),Hy=b.enum(["blocked","everything"]),Yy=b.array(b.union([b.literal("threads"),Rd.regex(/^(project|section|machine):\S+$/)])).max(El).transform(e=>[...new Set(e)]);function F(e,t,r,n){return{schema:e,defaultValue:t,description:r,...n?{readStored:n}:{}}}s(F,"define");var Le={showArchived:F(b.boolean(),!1,"Show archived threads: whether every group also lists archived threads, as each group's menu toggles."),organizationMode:F(Jy,"project","How top-level groups are formed: project, chronological (custom sections) or machine."),environmentGrouping:F(b.boolean(),!1,"Worktrees as folders: whether sibling threads sharing a worktree environment fold into a folder row."),chronologicalSort:F(Gy,"updated","Sort field inside a group: updated, created or alpha. none is read as updated."),sortDirection:F(qy,"default","Sort direction: ascending or descending. A saved default reads as the field's own direction (descending for dates, ascending for alpha)."),sectionOrder:F(_e,["pinned","projects","threads"],"Top-level group order when organized by project."),manualSectionOrder:F(_e,["pinned","sections","threads"],"Top-level group order when organized chronologically."),machineSectionOrder:F(_e,["pinned","machines","threads"],"Top-level group order when organized by machine."),hiddenGroups:F(Yy,[],"Groups moved into More: threads, project:<id>, section:<id> or machine:<id>."),collapsedSections:F(b.array(b.enum(["pinned","threads"])).max(El),[],"Built-in groups (pinned, threads) that are collapsed."),collapsedProjects:F(_e,[],"Project ids whose group is collapsed."),collapsedThreadSections:F(_e,[],"Custom section keys (section:<id>) whose group is collapsed."),collapsedMachines:F(_e,[],"Machine ids whose group is collapsed."),collapsedEnvironments:F(_e,[],"Environment ids whose folder row is collapsed."),expandedOlder:F(_e,[],`Parent thread ids whose "N more child threads" row the user opened, once that tree's children chip was open.`),openSettledFolds:F(_e,[],"Group ids whose settled fold the user opened."),settleAfter:F(Xy,"1d","Settle after: how long a quiet thread goes without activity before it settles into its group's settled fold: 12h, 1d, 3d, 1w or never."),expandedChildren:F(_e,[],"Parent thread ids whose chip the user opened."),childAttention:F(Hy,"blocked","Needs attention counts every child: blocked counts a child thread that waits on you, is offline or has an orphaned failure; everything also counts every failed or finished-unread child. The same children stay out of an open tree's N more child threads fold, as running ones do."),harnessIcon:F(Wy,"muted","How rows draw the harness logo, where a row draws one: muted (monochrome) or colour (the provider's tint). A stored hidden reads as muted.",e=>e==="hidden"?"muted":e)},ze=Object.keys(Le);function Cl(e){return Object.hasOwn(Le,e)}s(Cl,"isPreferenceKey");function it(e){return structuredClone(Le[e].defaultValue)}s(it,"preferenceDefault");function Ld(){return Object.fromEntries(ze.map(e=>[e,it(e)]))}s(Ld,"defaultPreferences");function Tl(e){return Le[e].description}s(Tl,"describePreference");function ri(e,t){let r=Le[e].schema.safeParse(t);return r.success?{success:!0,value:r.data}:{success:!1,message:r.error.issues.map(n=>n.message).join("; ")}}s(ri,"parsePreference");function jd(e,t){let r=Le[e];return ri(e,r.readStored?r.readStored(t):t)}s(jd,"parseStoredPreference");function Dl(e){if(e===null||typeof e!="object"||Array.isArray(e))return{};let t=e,r={};for(let[n,o]of Object.entries(t)){if(n==="collapsedThreads"||!Cl(n))continue;let u=ri(n,n==="environmentGrouping"&&o==="auto"?!1:o);u.success&&(r[n]=u.value)}return r}s(Dl,"mapBbPreferences");var bw=b.object({density:b.enum(["compact","comfortable"]).catch("compact")});var Br=b.record(b.string(),b.number()),Vd=b.object({startedAt:Br,finishedAt:Br,pendingAt:Br,seenAt:Br,idleAt:Br}),Jr=140,Rl=b.object({kind:b.enum(["question","approval","plan","input","failed","done"]),text:b.string().max(Jr),at:b.number()}),ni=b.object({pending:Rl.optional(),failed:Rl.optional(),done:Rl.optional()}),je={preferences:"preferences",stamps:"stamps",scheduled:"scheduled",notes:"notes"};var Gr=b.enum(ze),e_=b.object(Object.fromEntries(ze.map(e=>[e,Le[e].schema]))),t_=b.record(b.string(),b.number()),Ll=b.array(b.string().min(1).max(1024)).max(1e4),Md=Qy({listPreferences:{input:b.null(),output:b.object({preferences:e_}).strict()},setPreference:{input:b.object({key:Gr,value:b.unknown()}).strict(),output:b.object({key:Gr,value:b.unknown()}).strict()},resetPreference:{input:b.object({key:Gr}).strict(),output:b.object({key:Gr,value:b.unknown()}).strict()},importPreferences:{input:b.object({bbMirror:b.unknown().nullable()}).strict(),output:b.object({status:b.enum(["already-imported","imported","defaults"]),source:b.enum(["local-storage","cli","none"]).nullable(),keys:b.array(Gr)}).strict()},listStamps:{input:b.null(),output:b.object({stamps:Vd}).strict()},markSeen:{input:b.object({threadIds:Ll}).strict(),output:b.object({at:b.number()}).strict()},clearSeen:{input:b.object({threadIds:Ll}).strict(),output:b.object({ok:b.literal(!0)}).strict()},markIdle:{input:b.object({threadIds:Ll}).strict(),output:b.object({at:b.number()}).strict()},listNotes:{input:b.null(),output:b.object({notes:b.record(b.string(),ni)}).strict()},listScheduled:{input:b.null(),output:b.object({status:b.enum(["ready","error"]),scheduled:t_}).strict()}});import{PluginCliError as Kd,cliCommand as ii,defineCli as n_}from"@get-bb/plugin-sdk";var r_="preference:";function oi(e){return`${r_}${e}`}s(oi,"preferenceKvKey");var qr=class extends Error{static{s(this,"PreferenceValidationError")}key;detail;constructor(t,r){super(`Invalid value for ${t}: ${r}`),this.name="PreferenceValidationError",this.key=t,this.detail=r}};function Fd(e){let{kv:t}=e.storage;function r(o,i){let u={key:o,value:i};e.realtime.publish(je.preferences,u)}s(r,"publish");async function n(o){let i=await t.get(oi(o));if(i===void 0)return it(o);let u=jd(o,i);return u.success?u.value:(e.log.warn(`stored preference ${o} is invalid (${u.message}); using the default`),it(o))}return s(n,"read"),{read:n,async readAll(){let o=Ld();return await Promise.all(ze.map(async i=>{o[i]=await n(i)})),o},async isStored(o){return await t.get(oi(o))!==void 0},async write(o,i){let u=ri(o,i);if(!u.success)throw new qr(o,u.message);return await t.set(oi(o),u.value),r(o,u.value),u.value},async reset(o){await t.delete(oi(o));let i=it(o);return r(o,i),i}}}s(Fd,"createPreferenceStore");function o_(e){try{return JSON.parse(e)}catch{return e}}s(o_,"parseCliValue");function jl(e){if(Cl(e))return e;throw new Kd(`Unknown preference: ${e}`,{code:"unknown_preference",hint:`Known preferences: ${ze.join(", ")}.`})}s(jl,"requirePreferenceKey");var si={type:"boolean",description:"Emit machine-readable JSON"},Vl={name:"key",description:"Preference name",required:!0};function Ud(e){function t(r,n,o){return o?JSON.stringify({key:r,value:n}):`${r} = ${JSON.stringify(n)}`}return s(t,"keyValueOutput"),n_({name:"thread-glance",summary:"Inspect and change the Thread Glance sidebar's layout preferences",description:"Organization, sort, group order, hidden and collapsed groups, child-thread folding, settling and which child threads Needs attention counts, for the Thread Glance sidebar. Values are JSON; a bare word is read as a string.",commands:{"prefs list":ii({summary:"List every preference and its current value",options:{json:si},async run(r){let n=await e.readAll();return r.options.json?{exitCode:0,stdout:JSON.stringify(n)}:{exitCode:0,stdout:ze.map(i=>`${i} ${JSON.stringify(n[i])} ${Tl(i)}`).join(`
|
|
69
|
+
`)}}}),"prefs get":ii({summary:"Print one preference",positionals:[Vl],options:{json:si},async run(r){let n=jl(r.positionals.key),o=await e.read(n);return{exitCode:0,stdout:r.options.json?JSON.stringify({key:n,value:o}):JSON.stringify(o)}}}),"prefs set":ii({summary:"Set one preference",positionals:[Vl,{name:"value",description:`JSON value, e.g. '"machine"' or '["pinned","threads"]'`,required:!0}],options:{json:si},async run(r){let n=jl(r.positionals.key);try{let o=await e.write(n,o_(r.positionals.value));return{exitCode:0,stdout:t(n,o,r.options.json===!0)}}catch(o){throw o instanceof qr?new Kd(o.message,{code:"invalid_preference_value",hint:Tl(n)}):o}}}),"prefs reset":ii({summary:"Restore one preference to its default",positionals:[Vl],options:{json:si},async run(r){let n=jl(r.positionals.key),o=await e.reset(n);return{exitCode:0,stdout:t(n,o,r.options.json===!0)}}})}})}s(Ud,"createCli");function Ut(){let e=Promise.resolve();return t=>{let r=e.then(t,t);return e=r.catch(()=>{}),r}}s(Ut,"createSerialQueue");var Ml="note:",i_="ask-user-question",Jd="Needs your input";function Bd(e){return`${Ml}${e}`}s(Bd,"noteKvKey");function Bt(e){let t=e.replace(/\s+/g," ").trim();for(;;){let r=t.replace(/^(?:#{1,6}|[-*+>]|\d+[.)])\s+/,"");if(r===t)break;t=r}return t.length<=Jr?t:`${t.slice(0,Jr-1).trimEnd()}\u2026`}s(Bt,"noteText");function s_(e){for(let t of e.split(`
|
|
70
|
+
`)){let r=t.replace(/^\s*#+/,"").trim();if(r!=="")return r}return""}s(s_,"firstNonEmptyLine");function Gd(e,t){return t>1?`${e} (+${t-1} more)`:e}s(Gd,"withMore");function u_(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e.questions;if(!Array.isArray(t)||t.length===0)return null;let r=t[0]?.prompt;return typeof r=="string"&&r.trim()!==""?Gd(r,t.length):null}s(u_,"questionsText");function c_(e,t){return e.trim()===""&&t?t:e}s(c_,"approvalText");function a_(e){let t=e.payload;switch(e.payload.kind){case"user_question":{let{questions:r}=e.payload,n=r[0]?.prompt??"";return{kind:"question",text:Gd(n,r.length)}}case"approval":{let{subject:r,reason:n}=e.payload;switch(r.kind){case"command":return{kind:"approval",text:c_(r.command,n)};case"file_change":return{kind:"approval",text:`File changes${r.writeScope?` in ${r.writeScope}`:""}`};case"permission_grant":return{kind:"approval",text:`Permissions${r.toolName?` for ${r.toolName}`:""}`};case"tool_use":return{kind:"approval",text:r.presentation.title??r.tool};case"plan":return{kind:"plan",text:s_(r.plan)};default:return{kind:"approval",text:n??""}}}case"plugin":{if(e.origin?.kind!=="plugin")break;let{title:r,presentation:n,data:o}=e.payload;if(e.origin.pluginId===i_)return{kind:"question",text:u_(o)??r};let i=n?.detail?Bt(n.detail):"",u=`${r}: ${i}`;return{kind:"input",text:i!==""&&u.length<=Jr?u:r}}}return"title"in t&&typeof t.title=="string"?{kind:"input",text:t.title}:{kind:"input",text:Jd}}s(a_,"describeRaw");function qd(e){let t=a_(e),r=Bt(t.text);return{kind:t.kind,text:r===""?Jd:r}}s(qd,"describeInteraction");function Fl(e){let t=e===null?"":Bt(e);return{kind:"failed",text:t===""?"Failed":t}}s(Fl,"describeFailure");function Wd(e){let t=e===null?"":Bt(e);return t===""?null:{kind:"done",text:t}}s(Wd,"describeDone");function Xd(e){let{kv:t}=e.storage,r=Ut(),n=null;async function o(){if(n!==null)return n;let u=new Map;for(let c of await t.list(Ml)){let a=c.slice(Ml.length),l=ni.safeParse(await t.get(c));if(!l.success||Object.keys(l.data).length===0){e.log.warn(`stored notes for ${a} are invalid; dropping them`),await t.delete(c);continue}u.set(a,l.data)}return n=u,u}s(o,"load");async function i(u,c,a){let l=Object.keys(a).length===0;l?(u.delete(c),await t.delete(Bd(c))):(u.set(c,a),await t.set(Bd(c),a));let f={threadId:c,notes:l?null:a};e.realtime.publish(je.notes,f)}return s(i,"save"),{list:s(()=>r(async()=>Object.fromEntries(await o())),"list"),get:s(u=>r(async()=>(await o()).get(u)),"get"),update:s((u,c)=>r(async()=>{let a=await o(),l=a.get(u)??{},f={...l};for(let[p,d]of Object.entries(c))d===null?delete f[p]:f[p]=d;JSON.stringify(f)!==JSON.stringify(l)&&await i(a,u,f)}),"update"),forget:s(u=>r(async()=>{let c=await o();for(let a of u)c.has(a)&&await i(c,a,{})}),"forget"),prune:s((u,c)=>r(async()=>{let a=await o(),l=[];for(let[f,p]of[...a])u.has(f)||Math.max(...Object.values(p).map(m=>m.at))>=c||(await i(a,f,{}),l.push(f));return l}),"prune")}}s(Xd,"createNoteStore");var l_=20,f_=new Set(["error","failed","provider error","turn failed","unknown error"]);function Hd(e){if(e==null)return!0;let t=e.trim().toLowerCase().replace(/[.!]+$/,"");return t===""||f_.has(t)||/^command [\w./:-]+ failed$/.test(t)}s(Hd,"isGenericError");function p_(e){if(!e)return null;let t=e.httpStatusCode===null?"":` (${e.httpStatusCode})`;switch(e.category){case"rate-limit":return`Rate limited${t}`;case"unauthorized":return"Not signed in";case"billing":case"budget-exceeded":return"Out of credits";case"context-window-exceeded":return"Context window full";case"unknown":return t===""?null:`Error${t}`;default:{let r=e.category.replace(/-/g," ");return`${r.charAt(0).toUpperCase()}${r.slice(1)}${t}`}}}s(p_,"errorInfoLabel");function d_(e,t){for(let r of e){if(r.type==="turn/started"&&t===null)return null;if(!(r.type!=="provider/error"&&r.type!=="system/error")&&!(t!==null&&r.scope?.turnId!==void 0&&r.scope.turnId!==t))return r.data??{}}return null}s(d_,"latestProviderError");function m_(e){let t=[e.error,e.providerError?.detail,e.providerError?.message,p_(e.errorInfo??e.providerError?.errorInfo)];for(let r of t)if(!Hd(r)){let n=Bt(r);if(n!=="")return n}return null}s(m_,"failureText");async function Kl(e,t){let r=null;if(Hd(t.error))try{let n=await e.sdk.threads.events.list({threadId:t.threadId,types:["provider/error","system/error","turn/started"],order:"desc",limit:String(l_)});r=d_(n,t.turnId)}catch(n){e.log.warn(`could not read events of ${t.threadId} for its failure: ${n instanceof Error?n.message:String(n)}`)}return m_({error:t.error,providerError:r,errorInfo:t.errorInfo})}s(Kl,"resolveFailureText");import{execFile as h_}from"node:child_process";var Yd="migration:import:v1",g_=5e3,y_=4*1024*1024;function Qd(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return null}if(t===null||typeof t!="object"||Array.isArray(t))return null;let r=t,n=r.preferences;return n!==null&&typeof n=="object"&&!Array.isArray(n)?n:r}s(Qd,"unwrapBbPreferences");function __(e=process.env){let t=e.BB_CLI?.trim();return t||"bb"}s(__,"bbCliPath");function em(e,t,r=process.env){return()=>new Promise(n=>{let o="",i="it has no URL";try{o=t().trim()}catch(c){i=c instanceof Error?c.message:String(c)}if(!o){e.warn(`could not tell which bb server Thread Glance runs in (${i}); importing nothing from bb's CLI and asking no other server`),n(null);return}let u=__(r);h_(u,["thread-list","prefs","list","--json"],{env:{...r,BB_SERVER_URL:o},timeout:g_,maxBuffer:y_,encoding:"utf8"},(c,a)=>{if(c){e.warn(`could not run ${u} thread-list prefs list against ${o}: ${c.message}`),n(null);return}try{n(JSON.parse(a))}catch{e.warn(`${u} thread-list prefs list against ${o} printed output that is not JSON`),n(null)}})})}s(em,"createBbCliReader");async function tm(e,t){if(await e.kv.get(Yd)!==void 0)return{status:"already-imported",source:null,keys:[]};let r="none",n={},o=t===null?null:Qd(t),i=o===null?{}:Dl(o);if(Object.keys(i).length>0)r="local-storage",n=i;else{let c=Qd(await e.readBbCli()),a=c===null?{}:Dl(c);Object.keys(a).length>0&&(r="cli",n=a)}let u=[];for(let[c,a]of Object.entries(n))await e.store.isStored(c)||JSON.stringify(a)!==JSON.stringify(it(c))&&(await e.store.write(c,a),u.push(c));return await e.kv.set(Yd,{source:r,keys:u,at:Date.now()}),e.log.info(r==="none"?"no bb thread-list preferences found; using the defaults":`imported bb thread-list preferences from ${r}: ${u.join(", ")||"none differ from the defaults"}`),{status:r==="none"?"defaults":"imported",source:r,keys:u}}s(tm,"importPreferences");function rm(e){let t=e.now??Date.now,r=new Map,n="error",o=null,i=null,u=JSON.stringify({status:n,scheduled:{}});function c(d){switch(d.type){case"upsert":{let{id:m,threadId:g,sendAt:y}=d.row;y!==null&&y>t()?r.set(m,{threadId:g,sendAt:y}):r.delete(m);break}case"remove":r.delete(d.rowId);break;case"remove-thread":for(let[m,g]of r)g.threadId===d.threadId&&r.delete(m);break}}s(c,"apply");function a(){let d=t(),m={};for(let[g,y]of r){if(y.sendAt<=d){r.delete(g);continue}let $=m[y.threadId];($===void 0||y.sendAt<$)&&(m[y.threadId]=y.sendAt)}return{status:n,scheduled:m}}s(a,"current");function l(){let d=a(),m=JSON.stringify(d);m!==u&&(u=m,e.publish(d))}s(l,"publishIfChanged");function f(d){o?.push(d),c(d),l()}s(f,"change");async function p(d){o=[];try{let m=await d(),g=o;r=new Map;for(let y of m)c({type:"upsert",row:y});for(let y of g)c(y);return n="ready",!0}catch{return n="error",!1}finally{o=null,l()}}return s(p,"runSeed"),{queued:s(d=>f({type:"upsert",row:d}),"queued"),removed:s(d=>f({type:"remove",rowId:d}),"removed"),threadGone:s(d=>f({type:"remove-thread",threadId:d}),"threadGone"),seed(d){let m=p(d).finally(()=>{i===m&&(i=null)});return i=m,m},async snapshot(){return i!==null&&await i,a()}}}s(rm,"createScheduledTracker");var Ul="stamp:",om=["startedAt","finishedAt","pendingAt","seenAt","idleAt"];function nm(e){return`${Ul}${e}`}s(nm,"stampKvKey");function $_(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let n of om){let o=t[n];typeof o=="number"&&Number.isFinite(o)&&(r[n]=o)}return Object.keys(r).length>0?r:null}s($_,"parseThreadStamps");function im(e){let{kv:t}=e.storage,r=Ut(),n=null;async function o(){if(n!==null)return n;let c=new Map;for(let a of await t.list(Ul)){let l=a.slice(Ul.length),f=$_(await t.get(a));if(f===null){e.log.warn(`stored stamps for ${l} are invalid; dropping them`),await t.delete(a);continue}c.set(l,f)}return n=c,c}s(o,"load");async function i(c,a,l){if(Object.keys(l).length===0){c.delete(a),await t.delete(nm(a));return}c.set(a,l),await t.set(nm(a),l)}s(i,"save");function u(c){e.realtime.publish(je.stamps,c)}return s(u,"publish"),{list:s(()=>r(async()=>{let c={startedAt:{},finishedAt:{},pendingAt:{},seenAt:{},idleAt:{}};for(let[a,l]of await o())for(let f of om){let p=l[f];p!==void 0&&(c[f][a]=p)}return c}),"list"),stamp:s((c,a,l)=>r(async()=>{if(a.length===0)return;let f=await o();for(let p of new Set(a))await i(f,p,{...f.get(p),[c]:l});u({kind:c,threadIds:[...a],value:l})}),"stamp"),advance:s((c,a,l)=>r(async()=>{let f=await o(),p=[];for(let d of new Set(a)){let m=f.get(d);(m?.[c]??-1/0)>=l||(await i(f,d,{...m,[c]:l}),p.push(d))}p.length>0&&u({kind:c,threadIds:p,value:l})}),"advance"),clear:s((c,a)=>r(async()=>{if(a.length===0)return;let l=await o();for(let f of new Set(a)){let p=l.get(f);if(p?.[c]===void 0)continue;let{[c]:d,...m}=p;await i(l,f,m)}u({kind:c,threadIds:[...a],value:null})}),"clear"),forget:s(c=>r(async()=>{let a=await o();for(let l of c)a.has(l)&&await i(a,l,{})}),"forget"),prune:s((c,a)=>r(async()=>{let l=await o(),f=[];for(let[p,d]of[...l])c.has(p)||Math.max(...Object.values(d))>=a||(await i(l,p,{}),f.push(p));return f}),"prune")}}s(im,"createStampStore");function um(e){return e instanceof Error?e.message:String(e)}s(um,"errorMessage");async function w_(e,t){let r=new Set;for(let n of[!1,!0])for(let o=0;;o+=500){let i=await e.threads.list({archived:n,includeHidden:!0,limit:500,offset:o,signal:t});for(let u of i)r.add(u.id);if(i.length<500)break}return r}s(w_,"listAllThreadIds");async function b_(e,t,r){let n=Date.now(),o;try{o=await w_(e.sdk,r)}catch(i){e.log.warn(`could not list threads to prune deleted ones: ${um(i)}`);return}for(let i of t){let u=await i.prune(o,n);u.length>0&&e.log.info(`pruned ${i.name} of ${u.length} deleted threads`)}}s(b_,"pruneDeletedThreads");function sm(e,t,r){return t.seed(async()=>{try{return await e.sdk.threads.queue.list({signal:r})}catch(n){throw e.log.warn(`could not list queued messages: ${um(n)}`),n}})}s(sm,"seedScheduled");function v_(e,t){return new Promise(r=>{let n=setTimeout(o,e);function o(){clearTimeout(n),t.removeEventListener("abort",o),r()}s(o,"done"),t.addEventListener("abort",o,{once:!0})})}s(v_,"sleep");function x_(e){return e.aborted?Promise.resolve():new Promise(t=>e.addEventListener("abort",()=>t(),{once:!0}))}s(x_,"waitForAbort");async function cm(e,t,r,n,o=6e4){let i=sm(e,r,n);await b_(e,t,n);let u=await i;for(;!u&&!n.aborted&&(await v_(o,n),!n.aborted);)u=await sm(e,r,n);await x_(n)}s(cm,"runStartup");function k_(e){let t=Fd(e),r=im(e),n=Xd(e),o=rm({publish:s(a=>e.realtime.publish(je.scheduled,a),"publish")}),i=em(e.log,()=>e.server.loopbackBaseUrl),u=Ut();e.rpc.register(Md,{async listPreferences(){return{preferences:await t.readAll()}},async setPreference({key:a,value:l}){return{key:a,value:await t.write(a,l)}},async resetPreference({key:a}){return{key:a,value:await t.reset(a)}},importPreferences({bbMirror:a}){return u(()=>tm({kv:e.storage.kv,log:e.log,store:t,readBbCli:i},a))},async listStamps(){return{stamps:await r.list()}},async markSeen({threadIds:a}){let l=Date.now();return await r.stamp("seenAt",a,l),{at:l}},async markIdle({threadIds:a}){let l=Date.now();return await r.advance("idleAt",a,l),{at:l}},async clearSeen({threadIds:a}){return await r.clear("seenAt",a),{ok:!0}},async listNotes(){return{notes:await n.list()}},listScheduled(){return o.snapshot()}}),e.cli.register(Ud(t));let c=s((a,l=Date.now())=>({...a,at:l}),"note");e.events.on("thread.active",async({thread:a})=>{await r.stamp("startedAt",[a.id],Date.now()),await n.update(a.id,{pending:null,failed:null})}),e.events.on("thread.idle",async({thread:a,lastAssistantText:l})=>{await r.stamp("finishedAt",[a.id],Date.now());let f=Wd(l);await n.update(a.id,{pending:null,...f?{done:c(f)}:{}})}),e.events.on("thread.failed",async({thread:a,error:l})=>{await r.stamp("finishedAt",[a.id],Date.now());let f=await Kl(e,{threadId:a.id,error:l,errorInfo:null,turnId:null});f===null&&(await n.get(a.id))?.failed||await n.update(a.id,{failed:c(Fl(f))})}),e.events.on("turn.failed",async({threadId:a,errorInfo:l,turnId:f})=>{let p=await Kl(e,{threadId:a,error:null,errorInfo:l,turnId:f});p!==null&&await n.update(a,{failed:c(Fl(p))})}),e.events.on("interaction.pending",async({thread:a,interaction:l})=>{await r.stamp("pendingAt",[a.id],Date.now()),await n.update(a.id,{pending:c(qd(l),l.createdAt)})}),e.events.on("thread.deleted",async({thread:a})=>{o.threadGone(a.id),await r.forget([a.id]),await n.forget([a.id])}),e.events.on("thread.archived",({thread:a})=>o.threadGone(a.id)),e.events.on("message.queued",({entry:a})=>o.queued(a)),e.events.on("message.dispatched",({entry:a})=>o.removed(a.id)),e.events.on("message.cancelled",({entry:a})=>o.removed(a.id)),e.background.service("startup",{start:s(a=>cm(e,[{name:"stamps",prune:r.prune},{name:"notes",prune:n.prune}],o,a),"start")})}s(k_,"threadGlance");export{k_ as default};
|
|
71
71
|
//# sourceMappingURL=server.js.map
|