austere-axi 0.10.2 → 0.10.4

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.
@@ -1,9 +1,9 @@
1
- (()=>{var Jf=Object.defineProperty;var dh=(e,t,n)=>t in e?Jf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ne=(e,t)=>{for(var n in t)Jf(e,n,{get:t[n],enumerable:!0})};var Je=(e,t,n)=>dh(e,typeof t!="symbol"?t+"":t,n);var y={};Ne(y,{$brand:()=>cs,$input:()=>Tc,$output:()=>Nc,INVALID:()=>ne,NEVER:()=>as,TimePrecision:()=>Kc,ZodAny:()=>Nl,ZodArray:()=>Rl,ZodBase64:()=>wi,ZodBase64URL:()=>vi,ZodBigInt:()=>dn,ZodBigIntFormat:()=>zi,ZodBoolean:()=>pn,ZodCIDRv4:()=>_i,ZodCIDRv6:()=>$i,ZodCUID:()=>pi,ZodCUID2:()=>di,ZodCatch:()=>of,ZodCodec:()=>dr,ZodCompileAsyncError:()=>ve,ZodCompileUnsupportedError:()=>N,ZodCreditCard:()=>zl,ZodCustom:()=>mr,ZodCustomStringFormat:()=>St,ZodDate:()=>ar,ZodDefault:()=>Xl,ZodDiscriminatedUnion:()=>jl,ZodE164:()=>ki,ZodEmail:()=>ci,ZodEmoji:()=>li,ZodEnum:()=>un,ZodError:()=>Sb,ZodExactOptional:()=>Oi,ZodFile:()=>Wl,ZodFirstPartyTypeKind:()=>_f,ZodFunction:()=>hf,ZodGUID:()=>ui,ZodIBAN:()=>Sl,ZodIPv4:()=>yi,ZodIPv6:()=>bi,ZodISODate:()=>nt,ZodISODateTime:()=>tt,ZodISODuration:()=>ot,ZodISOTime:()=>rt,ZodInstanceOf:()=>bf,ZodIntersection:()=>Ml,ZodIssueCode:()=>Ob,ZodJWT:()=>xi,ZodKSUID:()=>gi,ZodLazy:()=>pf,ZodLiteral:()=>ql,ZodMAC:()=>xl,ZodMap:()=>Jl,ZodNaN:()=>af,ZodNanoID:()=>fi,ZodNever:()=>Cl,ZodNonOptional:()=>Ai,ZodNull:()=>El,ZodNullable:()=>Yl,ZodNumber:()=>fn,ZodNumberFormat:()=>It,ZodObject:()=>ur,ZodOptional:()=>fr,ZodPipe:()=>pr,ZodPrefault:()=>ef,ZodPreprocess:()=>cf,ZodPromise:()=>mf,ZodReadonly:()=>uf,ZodRealError:()=>le,ZodRecord:()=>cn,ZodSet:()=>Kl,ZodString:()=>ln,ZodStringFormat:()=>j,ZodSuccess:()=>rf,ZodSymbol:()=>Ol,ZodTemplateLiteral:()=>ff,ZodTransform:()=>Hl,ZodTuple:()=>Fl,ZodType:()=>E,ZodULID:()=>mi,ZodURL:()=>sr,ZodUUID:()=>Ae,ZodUndefined:()=>Al,ZodUnion:()=>lr,ZodUnknown:()=>Tl,ZodVoid:()=>Ll,ZodXID:()=>hi,ZodXor:()=>Dl,_ZodString:()=>ai,_default:()=>Ql,_function:()=>hm,any:()=>Kd,array:()=>cr,base64:()=>Sd,base64url:()=>Id,bigint:()=>Vd,boolean:()=>Pl,catch:()=>sf,check:()=>gm,cidrv4:()=>xd,cidrv6:()=>zd,clone:()=>L,codec:()=>fm,coerce:()=>wf,compile:()=>Dc,config:()=>F,core:()=>De,creditCard:()=>Od,cuid:()=>gd,cuid2:()=>yd,currencyCode:()=>Cd,custom:()=>ym,date:()=>Wd,decode:()=>yl,decodeAsync:()=>_l,deepPartial:()=>Am,describe:()=>bm,discriminatedUnion:()=>em,e164:()=>Pd,email:()=>sd,emoji:()=>md,encode:()=>gl,encodeAsync:()=>bl,endsWith:()=>Gt,enum:()=>Ii,exactOptional:()=>Gl,file:()=>am,flattenError:()=>An,float32:()=>Rd,float64:()=>Dd,formatError:()=>En,fromJSONSchema:()=>Pm,function:()=>hm,getDiscriminatedOption:()=>ac,getErrorMap:()=>Eb,globalRegistry:()=>Y,gt:()=>Pe,gte:()=>me,guid:()=>ad,hash:()=>Ld,hex:()=>Td,hostname:()=>Nd,httpUrl:()=>dd,iban:()=>Ad,includes:()=>Wt,input:()=>Zm,instanceof:()=>$m,int:()=>ii,int32:()=>jd,int64:()=>Fd,intersection:()=>Vl,invertCodec:()=>pm,ipv4:()=>wd,ipv6:()=>kd,iso:()=>hr,json:()=>vm,jwt:()=>Ed,keyof:()=>Hd,ksuid:()=>$d,lazy:()=>df,length:()=>wt,literal:()=>sm,locales:()=>Gn,looseObject:()=>Xd,looseRecord:()=>nm,lowercase:()=>Kt,lt:()=>Ie,lte:()=>de,mac:()=>vd,map:()=>rm,maxLength:()=>$t,maxSize:()=>Ye,memoizer:()=>Hn,meta:()=>_m,mime:()=>Xt,minLength:()=>Re,minSize:()=>Oe,multipleOf:()=>Ge,nan:()=>lm,nanoid:()=>hd,nativeEnum:()=>im,negative:()=>Wo,never:()=>Si,nonnegative:()=>Go,nonoptional:()=>nf,nonpositive:()=>Ho,normalize:()=>Qt,null:()=>Zl,nullable:()=>ir,nullish:()=>cm,number:()=>Il,object:()=>Gd,optional:()=>xt,output:()=>Nm,overwrite:()=>ke,parse:()=>pl,parseAsync:()=>dl,partialRecord:()=>tm,pipe:()=>si,positive:()=>qo,prefault:()=>tf,preprocess:()=>km,prettifyError:()=>ds,promise:()=>mm,properties:()=>Yt,property:()=>Yo,readonly:()=>lf,record:()=>Bl,refine:()=>gf,regex:()=>Jt,regexes:()=>_e,registry:()=>vo,safeDecode:()=>wl,safeDecodeAsync:()=>kl,safeEncode:()=>$l,safeEncodeAsync:()=>vl,safeParse:()=>ml,safeParseAsync:()=>hl,set:()=>om,setErrorMap:()=>Ab,size:()=>_t,slugify:()=>rn,startsWith:()=>Ht,strictObject:()=>Yd,string:()=>or,stringFormat:()=>Zd,stringbool:()=>wm,success:()=>um,superRefine:()=>yf,symbol:()=>Bd,templateLiteral:()=>dm,toJSONSchema:()=>ti,toLowerCase:()=>tn,toUpperCase:()=>nn,toZod:()=>$n,transform:()=>Pi,treeifyError:()=>ps,trim:()=>en,tuple:()=>Ul,uint32:()=>Md,uint64:()=>Ud,ulid:()=>bd,undefined:()=>Jd,union:()=>mn,unknown:()=>kt,uppercase:()=>qt,url:()=>pd,util:()=>k,uuid:()=>cd,uuidv4:()=>ud,uuidv6:()=>ld,uuidv7:()=>fd,validate:()=>Zn,validateAsync:()=>Nn,void:()=>qd,withParser:()=>ko,xid:()=>_d,xor:()=>Qd});var De={};Ne(De,{$ZodAny:()=>Xa,$ZodArray:()=>oc,$ZodAsyncError:()=>ce,$ZodBase64:()=>Ma,$ZodBase64URL:()=>Va,$ZodBigInt:()=>uo,$ZodBigIntFormat:()=>Wa,$ZodBoolean:()=>Un,$ZodCIDRv4:()=>Da,$ZodCIDRv6:()=>ja,$ZodCUID:()=>Sa,$ZodCUID2:()=>Ia,$ZodCatch:()=>kc,$ZodCheck:()=>M,$ZodCheckBigIntFormat:()=>Qs,$ZodCheckEndsWith:()=>fa,$ZodCheckGreaterThan:()=>qr,$ZodCheckIncludes:()=>ua,$ZodCheckLengthEquals:()=>ia,$ZodCheckLessThan:()=>Kr,$ZodCheckLowerCase:()=>aa,$ZodCheckMaxLength:()=>ra,$ZodCheckMaxSize:()=>ea,$ZodCheckMimeType:()=>ma,$ZodCheckMinLength:()=>oa,$ZodCheckMinSize:()=>ta,$ZodCheckMultipleOf:()=>Ys,$ZodCheckNumberFormat:()=>Xs,$ZodCheckOverwrite:()=>ha,$ZodCheckProperties:()=>da,$ZodCheckProperty:()=>pa,$ZodCheckRegex:()=>sa,$ZodCheckSizeEquals:()=>na,$ZodCheckStartsWith:()=>la,$ZodCheckStringFormat:()=>Vt,$ZodCheckUpperCase:()=>ca,$ZodCodec:()=>Jn,$ZodCreditCard:()=>Ua,$ZodCustom:()=>Ac,$ZodCustomStringFormat:()=>Ka,$ZodCyclicError:()=>yo,$ZodDate:()=>nc,$ZodDefault:()=>_c,$ZodDiscriminatedUnion:()=>cc,$ZodE164:()=>Fa,$ZodEmail:()=>$a,$ZodEmoji:()=>xa,$ZodEncodeError:()=>We,$ZodEnum:()=>dc,$ZodError:()=>fs,$ZodExactOptional:()=>yc,$ZodFile:()=>hc,$ZodFunction:()=>Pc,$ZodGUID:()=>ba,$ZodIBAN:()=>Ba,$ZodIPv4:()=>Ca,$ZodIPv6:()=>La,$ZodISODate:()=>Za,$ZodISODateTime:()=>Ea,$ZodISODuration:()=>Ta,$ZodISOTime:()=>Na,$ZodIntersection:()=>uc,$ZodJWT:()=>Ja,$ZodKSUID:()=>Aa,$ZodLazy:()=>Kn,$ZodLiteral:()=>mc,$ZodMAC:()=>Ra,$ZodMap:()=>fc,$ZodNaN:()=>xc,$ZodNanoID:()=>za,$ZodNever:()=>ec,$ZodNonOptional:()=>wc,$ZodNull:()=>Ya,$ZodNullable:()=>bc,$ZodNumber:()=>co,$ZodNumberFormat:()=>qa,$ZodObject:()=>Sp,$ZodObjectJIT:()=>ic,$ZodOptional:()=>fo,$ZodPipe:()=>po,$ZodPrefault:()=>$c,$ZodPreprocess:()=>zc,$ZodPromise:()=>Oc,$ZodReadonly:()=>Sc,$ZodRealError:()=>ue,$ZodRecord:()=>lc,$ZodRegistry:()=>wo,$ZodSet:()=>pc,$ZodString:()=>ht,$ZodStringFormat:()=>R,$ZodSuccess:()=>vc,$ZodSymbol:()=>Ha,$ZodTemplateLiteral:()=>Ic,$ZodTransform:()=>gc,$ZodTuple:()=>lo,$ZodType:()=>O,$ZodULID:()=>Pa,$ZodURL:()=>ka,$ZodUUID:()=>_a,$ZodUndefined:()=>Ga,$ZodUnion:()=>Bn,$ZodUnknown:()=>Qa,$ZodVoid:()=>tc,$ZodXID:()=>Oa,$ZodXor:()=>sc,$brand:()=>cs,$constructor:()=>p,$input:()=>Tc,$output:()=>Nc,Doc:()=>mt,INVALID:()=>ne,JSONSchema:()=>rd,JSONSchemaGenerator:()=>ni,NEVER:()=>as,TimePrecision:()=>Kc,URL_BAD_FORMAT:()=>wa,URL_UNPARSEABLE:()=>Dn,ZodCompileAsyncError:()=>ve,ZodCompileUnsupportedError:()=>N,_any:()=>uu,_array:()=>gu,_base64:()=>Uo,_base64url:()=>Bo,_bigint:()=>nu,_boolean:()=>eu,_catch:()=>mb,_check:()=>Vp,_cidrv4:()=>Vo,_cidrv6:()=>Fo,_coercedBigint:()=>ru,_coercedBoolean:()=>tu,_coercedDate:()=>mu,_coercedNumber:()=>Wc,_coercedString:()=>Fc,_creditCard:()=>Bc,_cuid:()=>To,_cuid2:()=>Co,_custom:()=>bu,_date:()=>du,_decode:()=>Cr,_decodeAsync:()=>Rr,_default:()=>fb,_discriminatedUnion:()=>Qy,_e164:()=>Jo,_email:()=>So,_emoji:()=>Zo,_encode:()=>Tr,_encodeAsync:()=>Lr,_endsWith:()=>Gt,_enum:()=>ib,_file:()=>yu,_float32:()=>Gc,_float64:()=>Yc,_gt:()=>Pe,_gte:()=>me,_guid:()=>Io,_iban:()=>Jc,_includes:()=>Wt,_int:()=>Hc,_int32:()=>Xc,_int64:()=>ou,_intersection:()=>eb,_ipv4:()=>jo,_ipv6:()=>Mo,_isoDate:()=>Qn,_isoDateTime:()=>Xn,_isoDuration:()=>tr,_isoTime:()=>er,_jwt:()=>Ko,_ksuid:()=>Do,_lazy:()=>bb,_length:()=>wt,_literal:()=>ab,_lowercase:()=>Kt,_lt:()=>Ie,_lte:()=>de,_mac:()=>Uc,_map:()=>rb,_max:()=>de,_maxLength:()=>$t,_maxSize:()=>Ye,_mime:()=>Xt,_min:()=>me,_minLength:()=>Re,_minSize:()=>Oe,_multipleOf:()=>Ge,_nan:()=>hu,_nanoid:()=>No,_nativeEnum:()=>sb,_negative:()=>Wo,_never:()=>fu,_nonnegative:()=>Go,_nonoptional:()=>pb,_nonpositive:()=>Ho,_normalize:()=>Qt,_null:()=>cu,_nullable:()=>lb,_number:()=>qc,_optional:()=>ub,_overwrite:()=>ke,_parse:()=>Rt,_parseAsync:()=>Dt,_pipe:()=>hb,_positive:()=>qo,_promise:()=>_b,_properties:()=>Yt,_property:()=>Yo,_readonly:()=>gb,_record:()=>nb,_refine:()=>_u,_regex:()=>Jt,_safeDecode:()=>jr,_safeDecodeAsync:()=>Vr,_safeEncode:()=>Dr,_safeEncodeAsync:()=>Mr,_safeParse:()=>jt,_safeParseAsync:()=>Mt,_set:()=>ob,_size:()=>_t,_slugify:()=>rn,_startsWith:()=>Ht,_string:()=>Vc,_stringFormat:()=>vt,_stringbool:()=>ku,_success:()=>db,_superRefine:()=>$u,_symbol:()=>su,_templateLiteral:()=>yb,_toLowerCase:()=>tn,_toUpperCase:()=>nn,_transform:()=>cb,_trim:()=>en,_tuple:()=>tb,_uint32:()=>Qc,_uint64:()=>iu,_ulid:()=>Lo,_undefined:()=>au,_union:()=>Yy,_unknown:()=>lu,_uppercase:()=>qt,_url:()=>Yn,_uuid:()=>Po,_uuidv4:()=>Oo,_uuidv6:()=>Ao,_uuidv7:()=>Eo,_void:()=>pu,_xid:()=>Ro,_xor:()=>Xy,base64Charset:()=>ro,base64urlCharset:()=>Fn,canParseURL:()=>va,clone:()=>L,compile:()=>Dc,compileFn:()=>xo,config:()=>F,createStandardJSONSchemaMethod:()=>on,createToJSONSchemaMethod:()=>zu,decode:()=>og,decodeAsync:()=>sg,describe:()=>wu,encode:()=>rg,encodeAsync:()=>ig,extractDefs:()=>Qe,finalize:()=>et,flattenError:()=>An,formatError:()=>En,getDiscriminatedOption:()=>ac,globalConfig:()=>W,globalRegistry:()=>Y,handleUnrepresentable:()=>J,initializeContext:()=>Xe,isBackEdge:()=>_o,isRecursiveSchema:()=>bo,isValidBase64:()=>Vn,isValidBase64URL:()=>oo,isValidCIDRv6:()=>no,isValidCreditCard:()=>io,isValidIBAN:()=>so,isValidIPv6:()=>Mn,isValidJWT:()=>ao,locales:()=>Gn,memoizer:()=>Hn,mergeValues:()=>Ft,meta:()=>vu,parse:()=>Zr,parseAsync:()=>Nr,parseURLObject:()=>kp,prettifyError:()=>ds,process:()=>D,processSchema:()=>D,regexes:()=>_e,registry:()=>vo,safeDecode:()=>cg,safeDecodeAsync:()=>lg,safeEncode:()=>ag,safeEncodeAsync:()=>ug,safeParse:()=>Xh,safeParseAsync:()=>Qh,standardProps:()=>Xr,stripTabAndNewline:()=>jn,toDotPath:()=>np,toJSONSchema:()=>ti,toZod:()=>$n,treeifyError:()=>ps,urlHostnameOk:()=>eo,urlProtocolOk:()=>to,util:()=>k,validate:()=>Zn,validateAsync:()=>Nn,validateURL:()=>Qr,version:()=>ga,withParser:()=>ko});var k={};Ne(k,{BIGINT_FORMAT_RANGES:()=>zn,CONSTANT_CATCH:()=>Ar,Class:()=>Gi,NUMBER_FORMAT_RANGES:()=>xn,aborted:()=>te,allowsEval:()=>Qi,assert:()=>bh,assertEqual:()=>mh,assertIs:()=>gh,assertNever:()=>yh,assertNotEqual:()=>hh,assignProp:()=>G,attachSchema:()=>Sn,base64ToUint8Array:()=>Gf,base64urlToUint8Array:()=>Rh,cached:()=>Nt,captureStackTrace:()=>Ir,cleanEnum:()=>Lh,cleanRegex:()=>Ce,clone:()=>L,cloneDef:()=>wh,codePointLength:()=>pt,constantCatch:()=>is,createTransparentProxy:()=>Ih,defineLazy:()=>Yi,defineLazyInternal:()=>Z,derived:()=>Vh,esc:()=>ee,escapeRegex:()=>be,explicitlyAborted:()=>ns,extend:()=>Ah,finalizeIssue:()=>ae,floatSafeRemainder:()=>wn,getElementAtPath:()=>vh,getEnumValues:()=>Et,getLengthableOrigin:()=>Pn,getParsedType:()=>Sh,getSizableOrigin:()=>In,hexToUint8Array:()=>jh,hide:()=>On,installLazyProp:()=>Jh,isObject:()=>ft,isPlainObject:()=>ye,issue:()=>Lt,joinValues:()=>zr,jsonStringifyReplacer:()=>Zt,members:()=>os,merge:()=>Zh,mergeDefs:()=>we,normalizeParams:()=>_,nullish:()=>Sr,numKeys:()=>zh,objectClone:()=>_h,omit:()=>Oh,optionalKeys:()=>ts,own:()=>qe,parsedType:()=>rs,partial:()=>Nh,pick:()=>Ph,prefixIssues:()=>se,primitiveTypes:()=>es,promiseAllObject:()=>kh,propertyKeyTypes:()=>kn,randomString:()=>xh,rawShape:()=>Tt,required:()=>Th,safeExtend:()=>Eh,shallowClone:()=>vn,sizeCaps:()=>Ct,slugify:()=>Xi,stringifyPrimitive:()=>Pr,toZod:()=>$n,uint8ArrayToBase64:()=>Yf,uint8ArrayToBase64url:()=>Dh,uint8ArrayToHex:()=>Mh,unwrapMessage:()=>At});function mh(e){return e}function hh(e){return e}function $n(){return e=>e}function gh(e){}function yh(e){throw new Error("Unexpected value in exhaustive check")}function bh(e){}function Et(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function zr(e,t="|"){return e.map(n=>Pr(n)).join(t)}function Zt(e,t){return typeof t=="bigint"?t.toString():t}var Hi=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Nt(e){return new Hi(e)}function Sr(e){return e==null}function Ce(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function wn(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}var Kf=Symbol("evaluating");function Yi(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Kf)return r===void 0&&(r=Kf,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function _h(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function G(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Tt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Te(e){return Tt(e._zod.def)??e._zod.def.shape}function qf(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return G(this,t,r),r},enumerable:!0,configurable:!0})}function Wf(e,t,n){t in e?G(e,t,n):e[t]=n}function lt(e,t,n,r){let o=Te(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?qf(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a}):Wf(e,i,r?r(s.value,i):s.value))}}function $h(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?qf(e,n,()=>t[n]):Wf(e,n,r.value))}}function we(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function wh(e){return we(e._zod.def)}function vh(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function kh(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=r[i];return o})}function xh(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function ee(e){return JSON.stringify(e)}function Xi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ir="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ft(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Qi=Nt(()=>{if(W.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ye(e){if(ft(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(ft(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function vn(e){return ye(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function zh(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var Sh=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}`)}},kn=new Set(["string","number","symbol"]),es=new Set(["string","number","bigint","boolean","symbol","undefined"]);function be(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Ih(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,i){return t??(t=e()),Reflect.set(t,r,o,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function Pr(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function ts(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var xn={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]},zn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ph(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return lt(i,e,Or(e,t)),L(e,we(n,{shape:i,checks:[]}))}function Or(e,t){let n=Te(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&r.push(o)}return r}function Oh(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Or(e,t)),s={};return lt(s,e,Reflect.ownKeys(Te(e)).filter(a=>!i.has(a))),L(e,we(n,{shape:s,checks:[]}))}function Ah(e,t){if(!ye(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=Te(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return L(e,we(e._zod.def,{shape:Hf(e,t)}))}function Hf(e,t){let n={};return lt(n,e,Reflect.ownKeys(Te(e))),$h(n,t),n}function Eh(e,t){if(!ye(t))throw new Error("Invalid input to safeExtend: expected a plain object");return L(e,we(e._zod.def,{shape:Hf(e,t)}))}function Zh(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};lt(n,e,Reflect.ownKeys(Te(e))),lt(n,t,Reflect.ownKeys(Te(t)));let r=we(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return L(e,r)}function Nh(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Or(t,n)):void 0,c={};return lt(c,t,Reflect.ownKeys(Te(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),L(t,we(t._zod.def,{shape:c,checks:[]}))}function Th(e,t,n){let r=n?new Set(Or(t,n)):void 0,o={};return lt(o,t,Reflect.ownKeys(Te(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),L(t,we(t._zod.def,{shape:o}))}function te(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ns(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function se(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function At(e){return typeof e=="string"?e:e?.message}function Ct(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;o>=0&&t.push([o,n])}return t}function Sn(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function ae(e,t,n){var r;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:At(e.inst?._zod.def?.error?.(e))??At(i?.(e))??At(t?.error?.(e))??At(n.customError?.(e))??At(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function In(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Ch=/[\uD800-\uDBFF]/;function pt(e){let t=e.length;if(!Ch.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function Pn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function rs(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Lt(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function Lh(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Gf(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function Yf(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Rh(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return Gf(t+n)}function Dh(e){return Yf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function jh(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function Mh(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Gi=class{constructor(...t){}};function os(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Fh(e,n,r.value)}}function qe(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function On(e,t,n){return qe(e,t,n,!1)}function Vh(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return qe(this,n,r(this))},set(o){qe(this,n,o)}})}return t}function Fh(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:qe(this,t,n.bind(this))},set(r){qe(this,t,r)}})}function Uh(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Wi,Ke=!1,Bh={configurable:!0,get(){Ke=!0}};function Z(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Wi!==e._zod){Wi=void 0;return}Wi=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Bh);let o=Ke;Ke=!1;try{let i=n(this);return Ke?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Ke=Ke||o,i}catch(i){throw delete this[t],Ke=Ke||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Jh(e,t,n,r){let o=Uh(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var Ar="~constantCatch";function is(e){let t=()=>e;return t[Ar]=!0,t}var Xf,as=Object.freeze({status:"aborted"}),ss={value:void 0,enumerable:!1},Qf="captureStackTrace"in Error?Error:null;function Kh(e){let t=Qf;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return Qf=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function p(e,t,n,r){let o={};function i(m){this.def=m,this.constr=f,this.traits=new Set}i.prototype=o;let s=n,a=s&&new WeakSet;function c(m,d){if(m._zod){if(m._zod.traits.has(e))return}else{ss.value=new i(d);try{Object.defineProperty(m,"_zod",ss)}finally{ss.value=void 0}}if(m._zod.traits.add(e),t(m,d),a){let b=Object.getPrototypeOf(m),$=m._zod.constr.prototype,S=b;for(;S&&S!==$;)S=Object.getPrototypeOf(S);let x=S??b;a.has(x)||(a.add(x),os(x,s))}let g=f.prototype;for(let b in g)Object.prototype.hasOwnProperty.call(g,b)&&(b in m||(m[b]=g[b].bind(m)))}let u=r?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(m){let d=r?.Parent?Kh(l):this;c(d,m);let g=d._zod.deferred;if(g){for(let $ of g)$();d._zod.deferred=void 0}let b=globalThis.__zod_globalConfig?.postProcessor;return b&&b(d),d}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:m=>r?.Parent&&m instanceof r.Parent?!0:m?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var cs=Symbol("zod_brand"),ce=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},We=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Xf=globalThis).__zod_globalConfig??(Xf.__zod_globalConfig={});var W=globalThis.__zod_globalConfig;function F(e){return e&&Object.assign(W,e),W}function qh(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Zt,2)),e.message}function Wh(e){this._zod.message=e}var Hh={get:qh,set:Wh,enumerable:!0,configurable:!0},ls={value:void 0,enumerable:!1},ep=new WeakSet([Object.prototype,Error.prototype]),tp=(e,t)=>{e.name="$ZodError",ls.value=t,Object.defineProperty(e,"issues",ls),ls.value=void 0,Object.defineProperty(e,"message",Hh);let n=Object.getPrototypeOf(e);ep.has(n)||(ep.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},fs=p("$ZodError",tp),ue=p("$ZodError",tp,void 0,{Parent:Error});function Gh(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function An(e,t=n=>n.message){let n={},r=[];for(let o of e.issues)o.path.length>0?Gh(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}function En(e,t=n=>n.message){let n={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,u=0;for(;u<a.length;){let l=a[u],f=u===a.length-1;if(l==="_errors"){f&&c._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[l];f&&m._errors.push(t(s)),c=m,u++}}}};return r(e),n}function ps(e,t=n=>n.message){let n={errors:[]},r=(o,i=[])=>{var s;for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...i,...a.path]);else{let c=[...i,...a.path];if(c.length===0){n.errors.push(t(a));continue}let u=n,l=0;for(;l<c.length;){let f=c[l],m=l===c.length-1;typeof f=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,f)||Object.defineProperty(u.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[f]):(u.items??(u.items=[]),(s=u.items)[f]??(s[f]={errors:[]}),u=u.items[f]),m&&u.errors.push(t(a)),l++}}};return r(e),n}function np(e){let t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(let r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function ds(e){let t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(let r of n)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${np(r.path)}`);return t.join(`
2
- `)}function Er(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Rt=e=>{let t=(n,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new ce;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>ae(u,s,F())));throw Ir(c,i?.callee??t),c}return a.value};return t},Zr=Rt(ue),Dt=e=>{let t=async(n,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>ae(u,s,F())));throw Ir(c,i?.callee??t),c}return a.value};return t},Nr=Dt(ue),jt=e=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new ce;return i.issues.length?rp(e,i.issues,o):{success:!0,data:i.value}},Xh=jt(ue);function rp(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>ae(o,n,F()))),t=void 0,n=void 0),r},set error(o){r=o,t=void 0,n=void 0}}}var Mt=e=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?rp(e,i.issues,o):{success:!0,data:i.value}},Qh=Mt(ue),eg=Symbol.for("zod.compile.invalid"),tg=Symbol.for("zod.compile.fallback"),Zn=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==eg)return!0;if(r.definite===!0&&n===void 0)return!1}return ng(e,t,n)});function ng(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(r[tg]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new ce;return i.issues.length===0}var Nn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},Tr=e=>{let t=Rt(e),n=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,Er(n,s))};return n},rg=Tr(ue),Cr=e=>{let t=Rt(e),n=(r,o,i,s)=>t(r,o,i,Er(n,s));return n},og=Cr(ue),Lr=e=>{let t=Dt(e),n=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,Er(n,s))};return n},ig=Lr(ue),Rr=e=>{let t=Dt(e),n=async(r,o,i,s)=>await t(r,o,i,Er(n,s));return n},sg=Rr(ue),Dr=e=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return jt(e)(t,n,o)},ag=Dr(ue),jr=e=>(t,n,r)=>jt(e)(t,n,r),cg=jr(ue),Mr=e=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Mt(e)(t,n,o)},ug=Mr(ue),Vr=e=>async(t,n,r)=>Mt(e)(t,n,r),lg=Vr(ue);var _e={};Ne(_e,{anyString:()=>Ms,base64:()=>Es,base64url:()=>Zs,bigint:()=>Fs,boolean:()=>Us,browserEmail:()=>bg,cidrv4:()=>Os,cidrv6:()=>As,creditCard:()=>Fr,cuid:()=>hs,cuid2:()=>gs,currencyCode:()=>Ls,date:()=>Rs,datetime:()=>js,domain:()=>Ts,duration:()=>vs,e164:()=>Cs,email:()=>xs,emoji:()=>zs,extendedDuration:()=>fg,guid:()=>ks,hex:()=>Ws,hostname:()=>Ns,html5Email:()=>hg,httpProtocol:()=>Tn,iban:()=>Ur,idnEmail:()=>yg,integer:()=>Cn,ipv4:()=>Ss,ipv6:()=>Is,ksuid:()=>_s,lowercase:()=>Ks,mac:()=>Ps,md5_base64:()=>vg,md5_base64url:()=>kg,md5_hex:()=>wg,nanoid:()=>$s,nanoidOfLength:()=>ws,null:()=>Bs,number:()=>Le,rfc5322Email:()=>gg,sha1_base64:()=>zg,sha1_base64url:()=>Sg,sha1_hex:()=>xg,sha256_base64:()=>Pg,sha256_base64url:()=>Og,sha256_hex:()=>Ig,sha384_base64:()=>Eg,sha384_base64url:()=>Zg,sha384_hex:()=>Ag,sha512_base64:()=>Tg,sha512_base64url:()=>Cg,sha512_hex:()=>Ng,string:()=>Vs,time:()=>Ds,ulid:()=>ys,undefined:()=>Js,unicodeEmail:()=>op,uppercase:()=>qs,uuid:()=>dt,uuid4:()=>pg,uuid6:()=>dg,uuid7:()=>mg,xid:()=>bs});var hs=/^[cC][0-9a-z]{6,}$/,gs=/^[0-9a-z]+$/,ys=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,bs=/^[0-9a-vA-V]{20}$/,_s=/^[A-Za-z0-9]{27}$/,$s=/^[a-zA-Z0-9_-]{21}$/;function ws(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var vs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fg=/^[-+]?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)?)??$/,ks=/^([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})$/,dt=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)$/,pg=dt(4),dg=dt(6),mg=dt(7),xs=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,hg=/^[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])?)*$/,gg=/^(([^<>()\[\]\\.,;:\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,}))$/,op=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,yg=op,bg=/^[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])?)*$/,_g="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function zs(){return new RegExp(_g,"u")}var Ss=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Is=/^(([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}|:))$/,Ps=e=>{let t=be(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Os=/^((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])$/,As=/^(([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])$/,Es=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ns=/^(?=.{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])?)*\.?$/,Ts=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Tn=/^https?$/,Cs=/^\+[1-9]\d{6,14}$/,Fr=/^\d(?:[ -]?\d){11,18}$/,Ls=/^(?: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)$/,Ur=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,ip="(?:(?:\\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 $g(e){return new RegExp(`^${e}$`)}var Rs=$g(ip);function ms(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ds(e){return new RegExp(`^${ms(e)}$`)}function js(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${ms({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${ms({precision:e.precision})}`:n;return new RegExp(`^${ip}T(?:${r})$`)}var Ms=/^[\s\S]{0,}$/,Vs=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Fs=/^-?\d+n?$/,Cn=/^-?\d+$/,Le=/^-?\d+(?:\.\d+)?$/,Us=/^(?:true|false)$/i,Bs=/^null$/i;var Js=/^undefined$/i;var Ks=/^[^A-Z]*$/,qs=/^[^a-z]*$/,Ws=/^[0-9a-fA-F]*$/;function Ln(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Rn(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var wg=/^[0-9a-fA-F]{32}$/,vg=Ln(22,"=="),kg=Rn(22),xg=/^[0-9a-fA-F]{40}$/,zg=Ln(27,"="),Sg=Rn(27),Ig=/^[0-9a-fA-F]{64}$/,Pg=Ln(43,"="),Og=Rn(43),Ag=/^[0-9a-fA-F]{96}$/,Eg=Ln(64,""),Zg=Rn(64),Ng=/^[0-9a-fA-F]{128}$/,Tg=Ln(86,"=="),Cg=Rn(86);var M=p("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Hs=e=>{let t=e.value;return!Sr(t)&&t.size!==void 0},Gs=e=>{let t=e.value;return!Sr(t)&&t.length!==void 0},Br={number:"number",bigint:"bigint",object:"date"},Kr=p("$ZodCheckLessThan",(e,t)=>{M.init(e,t);let n=Br[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Br[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qr=p("$ZodCheckGreaterThan",(e,t)=>{M.init(e,t);let n=Br[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Br[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ys=p("$ZodCheckMultipleOf",(e,t)=>{M.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):wn(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Xs=p("$ZodCheckNumberFormat",(e,t)=>{M.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=xn[t.format];e._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Qs=p("$ZodCheckBigIntFormat",(e,t)=>{M.init(e,t);let[n,r]=zn[t.format];e._zod.check=o=>{let i=o.value;i<n&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>r&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),ea=p("$ZodCheckMaxSize",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Hs),e._zod.check=r=>{let o=r.value;o.size<=t.maximum||r.issues.push({origin:In(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ta=p("$ZodCheckMinSize",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Hs),e._zod.check=r=>{let o=r.value;o.size>=t.minimum||r.issues.push({origin:In(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),na=p("$ZodCheckSizeEquals",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Hs),e._zod.check=r=>{let o=r.value,i=o.size;if(i===t.size)return;let s=i>t.size;r.issues.push({origin:In(o),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ra=p("$ZodCheckMaxLength",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Gs),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?pt(o):i)<=t.maximum)return;let a=Pn(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),oa=p("$ZodCheckMinLength",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Gs),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?pt(o):i)>=t.minimum)return;let a=Pn(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ia=p("$ZodCheckLengthEquals",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Gs),e._zod.check=r=>{let o=r.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?pt(o):i;if(s===t.length)return;let a=Pn(o),c=s>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Vt=p("$ZodCheckStringFormat",(e,t)=>{var n,r;M.init(e,t),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),sa=p("$ZodCheckRegex",(e,t)=>{Vt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),aa=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ks),Vt.init(e,t)}),ca=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=qs),Vt.init(e,t)}),ua=p("$ZodCheckIncludes",(e,t)=>{M.init(e,t);let n=be(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),la=p("$ZodCheckStartsWith",(e,t)=>{M.init(e,t);let n=new RegExp(`^${be(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),fa=p("$ZodCheckEndsWith",(e,t)=>{M.init(e,t);let n=new RegExp(`.*${be(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function Jr(e,t,n){e.issues.length&&t.issues.push(...se(n,e.issues))}var pa=p("$ZodCheckProperty",(e,t)=>{M.init(e,t),e._zod.check=n=>{let r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(o=>Jr(o,n,t.property));Jr(r,n,t.property)}}),da=p("$ZodCheckProperties",(e,t)=>{M.init(e,t),On(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=r=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));let o=r.value,i;for(let[s,a]of n){let c=a._zod.run({value:o[s],issues:[]},{});c instanceof Promise?(i??(i=[]),i.push(c.then(u=>Jr(u,r,s)))):Jr(c,r,s)}if(i)return Promise.all(i).then(()=>{})}}),ma=p("$ZodCheckMimeType",(e,t)=>{M.init(e,t);let n=new Set(t.mime);e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),ha=p("$ZodCheckOverwrite",(e,t)=>{M.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var mt=class{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split(`
1
+ (()=>{var Wf=Object.defineProperty;var vh=(e,t,n)=>t in e?Wf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Te=(e,t)=>{for(var n in t)Wf(e,n,{get:t[n],enumerable:!0})};var Je=(e,t,n)=>vh(e,typeof t!="symbol"?t+"":t,n);var y={};Te(y,{$brand:()=>cs,$input:()=>Tc,$output:()=>Zc,INVALID:()=>re,NEVER:()=>as,TimePrecision:()=>Kc,ZodAny:()=>Zl,ZodArray:()=>Rl,ZodBase64:()=>ki,ZodBase64URL:()=>xi,ZodBigInt:()=>dn,ZodBigIntFormat:()=>Ii,ZodBoolean:()=>pn,ZodCIDRv4:()=>wi,ZodCIDRv6:()=>vi,ZodCUID:()=>mi,ZodCUID2:()=>hi,ZodCatch:()=>of,ZodCodec:()=>mr,ZodCompileAsyncError:()=>ke,ZodCompileUnsupportedError:()=>Z,ZodCreditCard:()=>zl,ZodCustom:()=>hr,ZodCustomStringFormat:()=>St,ZodDate:()=>cr,ZodDefault:()=>Xl,ZodDiscriminatedUnion:()=>jl,ZodE164:()=>zi,ZodEmail:()=>li,ZodEmoji:()=>pi,ZodEnum:()=>un,ZodError:()=>Cb,ZodExactOptional:()=>Ei,ZodFile:()=>Hl,ZodFirstPartyTypeKind:()=>_f,ZodFunction:()=>hf,ZodGUID:()=>fi,ZodIBAN:()=>Sl,ZodIPv4:()=>_i,ZodIPv6:()=>$i,ZodISODate:()=>nt,ZodISODateTime:()=>tt,ZodISODuration:()=>ot,ZodISOTime:()=>rt,ZodInstanceOf:()=>bf,ZodIntersection:()=>Ml,ZodIssueCode:()=>Db,ZodJWT:()=>Si,ZodKSUID:()=>bi,ZodLazy:()=>pf,ZodLiteral:()=>ql,ZodMAC:()=>xl,ZodMap:()=>Jl,ZodNaN:()=>af,ZodNanoID:()=>di,ZodNever:()=>Cl,ZodNonOptional:()=>Ni,ZodNull:()=>El,ZodNullable:()=>Yl,ZodNumber:()=>fn,ZodNumberFormat:()=>It,ZodObject:()=>lr,ZodOptional:()=>pr,ZodPipe:()=>dr,ZodPrefault:()=>ef,ZodPreprocess:()=>cf,ZodPromise:()=>mf,ZodReadonly:()=>uf,ZodRealError:()=>fe,ZodRecord:()=>cn,ZodSet:()=>Kl,ZodString:()=>ln,ZodStringFormat:()=>j,ZodSuccess:()=>rf,ZodSymbol:()=>Ol,ZodTemplateLiteral:()=>ff,ZodTransform:()=>Wl,ZodTuple:()=>Fl,ZodType:()=>E,ZodULID:()=>gi,ZodURL:()=>ar,ZodUUID:()=>Ee,ZodUndefined:()=>Al,ZodUnion:()=>fr,ZodUnknown:()=>Tl,ZodVoid:()=>Ll,ZodXID:()=>yi,ZodXor:()=>Dl,_ZodString:()=>ui,_default:()=>Ql,_function:()=>_m,any:()=>Gd,array:()=>ur,base64:()=>Ad,base64url:()=>Ed,bigint:()=>Jd,boolean:()=>Pl,catch:()=>sf,check:()=>$m,cidrv4:()=>Pd,cidrv6:()=>Od,clone:()=>L,codec:()=>hm,coerce:()=>wf,compile:()=>Dc,config:()=>U,core:()=>je,creditCard:()=>Zd,cuid:()=>$d,cuid2:()=>wd,currencyCode:()=>jd,custom:()=>wm,date:()=>Xd,decode:()=>yl,decodeAsync:()=>_l,deepPartial:()=>Tm,describe:()=>vm,discriminatedUnion:()=>om,e164:()=>Nd,email:()=>ld,emoji:()=>bd,encode:()=>gl,encodeAsync:()=>bl,endsWith:()=>Gt,enum:()=>Oi,exactOptional:()=>Gl,file:()=>fm,flattenError:()=>En,float32:()=>Vd,float64:()=>Fd,formatError:()=>Nn,fromJSONSchema:()=>Nm,function:()=>_m,getDiscriminatedOption:()=>ac,getErrorMap:()=>Mb,globalRegistry:()=>Y,gt:()=>Oe,gte:()=>he,guid:()=>fd,hash:()=>Md,hex:()=>Dd,hostname:()=>Rd,httpUrl:()=>yd,iban:()=>Td,includes:()=>Ht,input:()=>Lm,instanceof:()=>xm,int:()=>ai,int32:()=>Ud,int64:()=>Kd,intersection:()=>Vl,invertCodec:()=>gm,ipv4:()=>zd,ipv6:()=>Id,iso:()=>gr,json:()=>Sm,jwt:()=>Cd,keyof:()=>Qd,ksuid:()=>xd,lazy:()=>df,length:()=>wt,literal:()=>lm,locales:()=>Yn,looseObject:()=>nm,looseRecord:()=>sm,lowercase:()=>Kt,lt:()=>Pe,lte:()=>me,mac:()=>Sd,map:()=>am,maxLength:()=>$t,maxSize:()=>Ye,memoizer:()=>Gn,meta:()=>km,mime:()=>Xt,minLength:()=>De,minSize:()=>Ae,multipleOf:()=>Ge,nan:()=>mm,nanoid:()=>_d,nativeEnum:()=>um,negative:()=>Go,never:()=>Pi,nonnegative:()=>Xo,nonoptional:()=>nf,nonpositive:()=>Yo,normalize:()=>Qt,null:()=>Nl,nullable:()=>sr,nullish:()=>pm,number:()=>Il,object:()=>em,optional:()=>xt,output:()=>Rm,overwrite:()=>xe,parse:()=>pl,parseAsync:()=>dl,partialRecord:()=>im,pipe:()=>ci,positive:()=>Wo,prefault:()=>tf,preprocess:()=>Im,prettifyError:()=>ds,promise:()=>bm,properties:()=>Yt,property:()=>Qo,readonly:()=>lf,record:()=>Bl,refine:()=>gf,regex:()=>Jt,regexes:()=>we,registry:()=>xo,safeDecode:()=>wl,safeDecodeAsync:()=>kl,safeEncode:()=>$l,safeEncodeAsync:()=>vl,safeParse:()=>ml,safeParseAsync:()=>hl,set:()=>cm,setErrorMap:()=>jb,size:()=>_t,slugify:()=>rn,startsWith:()=>Wt,strictObject:()=>tm,string:()=>ir,stringFormat:()=>Ld,stringbool:()=>zm,success:()=>dm,superRefine:()=>yf,symbol:()=>Hd,templateLiteral:()=>ym,toJSONSchema:()=>ri,toLowerCase:()=>tn,toUpperCase:()=>nn,toZod:()=>wn,transform:()=>Ai,treeifyError:()=>ps,trim:()=>en,tuple:()=>Ul,uint32:()=>Bd,uint64:()=>qd,ulid:()=>vd,undefined:()=>Wd,union:()=>mn,unknown:()=>kt,uppercase:()=>qt,url:()=>gd,util:()=>k,uuid:()=>pd,uuidv4:()=>dd,uuidv6:()=>md,uuidv7:()=>hd,validate:()=>Zn,validateAsync:()=>Tn,void:()=>Yd,withParser:()=>zo,xid:()=>kd,xor:()=>rm});var je={};Te(je,{$ZodAny:()=>Xa,$ZodArray:()=>oc,$ZodAsyncError:()=>ue,$ZodBase64:()=>Ma,$ZodBase64URL:()=>Va,$ZodBigInt:()=>fo,$ZodBigIntFormat:()=>Ha,$ZodBoolean:()=>Bn,$ZodCIDRv4:()=>Da,$ZodCIDRv6:()=>ja,$ZodCUID:()=>Sa,$ZodCUID2:()=>Ia,$ZodCatch:()=>kc,$ZodCheck:()=>M,$ZodCheckBigIntFormat:()=>Qs,$ZodCheckEndsWith:()=>fa,$ZodCheckGreaterThan:()=>Wr,$ZodCheckIncludes:()=>ua,$ZodCheckLengthEquals:()=>ia,$ZodCheckLessThan:()=>Hr,$ZodCheckLowerCase:()=>aa,$ZodCheckMaxLength:()=>ra,$ZodCheckMaxSize:()=>ea,$ZodCheckMimeType:()=>ma,$ZodCheckMinLength:()=>oa,$ZodCheckMinSize:()=>ta,$ZodCheckMultipleOf:()=>Ys,$ZodCheckNumberFormat:()=>Xs,$ZodCheckOverwrite:()=>ha,$ZodCheckProperties:()=>da,$ZodCheckProperty:()=>pa,$ZodCheckRegex:()=>sa,$ZodCheckSizeEquals:()=>na,$ZodCheckStartsWith:()=>la,$ZodCheckStringFormat:()=>Vt,$ZodCheckUpperCase:()=>ca,$ZodCodec:()=>Kn,$ZodCreditCard:()=>Ua,$ZodCustom:()=>Ac,$ZodCustomStringFormat:()=>Ka,$ZodCyclicError:()=>_o,$ZodDate:()=>nc,$ZodDefault:()=>_c,$ZodDiscriminatedUnion:()=>cc,$ZodE164:()=>Fa,$ZodEmail:()=>$a,$ZodEmoji:()=>xa,$ZodEncodeError:()=>He,$ZodEnum:()=>dc,$ZodError:()=>fs,$ZodExactOptional:()=>yc,$ZodFile:()=>hc,$ZodFunction:()=>Pc,$ZodGUID:()=>ba,$ZodIBAN:()=>Ba,$ZodIPv4:()=>Ca,$ZodIPv6:()=>La,$ZodISODate:()=>Na,$ZodISODateTime:()=>Ea,$ZodISODuration:()=>Ta,$ZodISOTime:()=>Za,$ZodIntersection:()=>uc,$ZodJWT:()=>Ja,$ZodKSUID:()=>Aa,$ZodLazy:()=>qn,$ZodLiteral:()=>mc,$ZodMAC:()=>Ra,$ZodMap:()=>fc,$ZodNaN:()=>xc,$ZodNanoID:()=>za,$ZodNever:()=>ec,$ZodNonOptional:()=>wc,$ZodNull:()=>Ya,$ZodNullable:()=>bc,$ZodNumber:()=>lo,$ZodNumberFormat:()=>qa,$ZodObject:()=>Ap,$ZodObjectJIT:()=>ic,$ZodOptional:()=>mo,$ZodPipe:()=>ho,$ZodPrefault:()=>$c,$ZodPreprocess:()=>zc,$ZodPromise:()=>Oc,$ZodReadonly:()=>Sc,$ZodRealError:()=>le,$ZodRecord:()=>lc,$ZodRegistry:()=>ko,$ZodSet:()=>pc,$ZodString:()=>ht,$ZodStringFormat:()=>R,$ZodSuccess:()=>vc,$ZodSymbol:()=>Wa,$ZodTemplateLiteral:()=>Ic,$ZodTransform:()=>gc,$ZodTuple:()=>po,$ZodType:()=>O,$ZodULID:()=>Pa,$ZodURL:()=>ka,$ZodUUID:()=>_a,$ZodUndefined:()=>Ga,$ZodUnion:()=>Jn,$ZodUnknown:()=>Qa,$ZodVoid:()=>tc,$ZodXID:()=>Oa,$ZodXor:()=>sc,$brand:()=>cs,$constructor:()=>p,$input:()=>Tc,$output:()=>Zc,Doc:()=>mt,INVALID:()=>re,JSONSchema:()=>ad,JSONSchemaGenerator:()=>oi,NEVER:()=>as,TimePrecision:()=>Kc,URL_BAD_FORMAT:()=>wa,URL_UNPARSEABLE:()=>jn,ZodCompileAsyncError:()=>ke,ZodCompileUnsupportedError:()=>Z,_any:()=>uu,_array:()=>gu,_base64:()=>Jo,_base64url:()=>Ko,_bigint:()=>nu,_boolean:()=>eu,_catch:()=>kb,_check:()=>Jp,_cidrv4:()=>Uo,_cidrv6:()=>Bo,_coercedBigint:()=>ru,_coercedBoolean:()=>tu,_coercedDate:()=>mu,_coercedNumber:()=>Hc,_coercedString:()=>Fc,_creditCard:()=>Bc,_cuid:()=>Lo,_cuid2:()=>Ro,_custom:()=>bu,_date:()=>du,_decode:()=>Rr,_decodeAsync:()=>jr,_default:()=>$b,_discriminatedUnion:()=>cb,_e164:()=>qo,_email:()=>Po,_emoji:()=>To,_encode:()=>Lr,_encodeAsync:()=>Dr,_endsWith:()=>Gt,_enum:()=>mb,_file:()=>yu,_float32:()=>Gc,_float64:()=>Yc,_gt:()=>Oe,_gte:()=>he,_guid:()=>Oo,_iban:()=>Jc,_includes:()=>Ht,_int:()=>Wc,_int32:()=>Xc,_int64:()=>ou,_intersection:()=>ub,_ipv4:()=>Vo,_ipv6:()=>Fo,_isoDate:()=>er,_isoDateTime:()=>Qn,_isoDuration:()=>nr,_isoTime:()=>tr,_jwt:()=>Ho,_ksuid:()=>Mo,_lazy:()=>Ib,_length:()=>wt,_literal:()=>gb,_lowercase:()=>Kt,_lt:()=>Pe,_lte:()=>me,_mac:()=>Uc,_map:()=>pb,_max:()=>me,_maxLength:()=>$t,_maxSize:()=>Ye,_mime:()=>Xt,_min:()=>he,_minLength:()=>De,_minSize:()=>Ae,_multipleOf:()=>Ge,_nan:()=>hu,_nanoid:()=>Co,_nativeEnum:()=>hb,_negative:()=>Go,_never:()=>fu,_nonnegative:()=>Xo,_nonoptional:()=>wb,_nonpositive:()=>Yo,_normalize:()=>Qt,_null:()=>cu,_nullable:()=>_b,_number:()=>qc,_optional:()=>bb,_overwrite:()=>xe,_parse:()=>Rt,_parseAsync:()=>Dt,_pipe:()=>xb,_positive:()=>Wo,_promise:()=>Pb,_properties:()=>Yt,_property:()=>Qo,_readonly:()=>zb,_record:()=>fb,_refine:()=>_u,_regex:()=>Jt,_safeDecode:()=>Vr,_safeDecodeAsync:()=>Ur,_safeEncode:()=>Mr,_safeEncodeAsync:()=>Fr,_safeParse:()=>jt,_safeParseAsync:()=>Mt,_set:()=>db,_size:()=>_t,_slugify:()=>rn,_startsWith:()=>Wt,_string:()=>Vc,_stringFormat:()=>vt,_stringbool:()=>ku,_success:()=>vb,_superRefine:()=>$u,_symbol:()=>su,_templateLiteral:()=>Sb,_toLowerCase:()=>tn,_toUpperCase:()=>nn,_transform:()=>yb,_trim:()=>en,_tuple:()=>lb,_uint32:()=>Qc,_uint64:()=>iu,_ulid:()=>Do,_undefined:()=>au,_union:()=>sb,_unknown:()=>lu,_uppercase:()=>qt,_url:()=>Xn,_uuid:()=>Ao,_uuidv4:()=>Eo,_uuidv6:()=>No,_uuidv7:()=>Zo,_void:()=>pu,_xid:()=>jo,_xor:()=>ab,base64Charset:()=>io,base64urlCharset:()=>Un,canParseURL:()=>va,clone:()=>L,compile:()=>Dc,compileFn:()=>So,config:()=>U,createStandardJSONSchemaMethod:()=>on,createToJSONSchemaMethod:()=>zu,decode:()=>dg,decodeAsync:()=>hg,describe:()=>wu,encode:()=>pg,encodeAsync:()=>mg,extractDefs:()=>Qe,finalize:()=>et,flattenError:()=>En,formatError:()=>Nn,getDiscriminatedOption:()=>ac,globalConfig:()=>W,globalRegistry:()=>Y,handleUnrepresentable:()=>K,initializeContext:()=>Xe,isBackEdge:()=>wo,isRecursiveSchema:()=>$o,isValidBase64:()=>Fn,isValidBase64URL:()=>so,isValidCIDRv6:()=>oo,isValidCreditCard:()=>ao,isValidIBAN:()=>co,isValidIPv6:()=>Vn,isValidJWT:()=>uo,locales:()=>Yn,memoizer:()=>Gn,mergeValues:()=>Ft,meta:()=>vu,parse:()=>Tr,parseAsync:()=>Cr,parseURLObject:()=>Ip,prettifyError:()=>ds,process:()=>D,processSchema:()=>D,regexes:()=>we,registry:()=>xo,safeDecode:()=>yg,safeDecodeAsync:()=>_g,safeEncode:()=>gg,safeEncodeAsync:()=>bg,safeParse:()=>ag,safeParseAsync:()=>cg,standardProps:()=>eo,stripTabAndNewline:()=>Mn,toDotPath:()=>sp,toJSONSchema:()=>ri,toZod:()=>wn,treeifyError:()=>ps,urlHostnameOk:()=>no,urlProtocolOk:()=>ro,util:()=>k,validate:()=>Zn,validateAsync:()=>Tn,validateURL:()=>to,version:()=>ga,withParser:()=>zo});var k={};Te(k,{BIGINT_FORMAT_RANGES:()=>Sn,CONSTANT_CATCH:()=>Nr,Class:()=>Gi,NUMBER_FORMAT_RANGES:()=>zn,aborted:()=>ne,allowsEval:()=>Qi,assert:()=>Ih,assertEqual:()=>kh,assertIs:()=>zh,assertNever:()=>Sh,assertNotEqual:()=>xh,assignProp:()=>G,attachSchema:()=>In,base64ToUint8Array:()=>ep,base64urlToUint8Array:()=>Kh,cached:()=>Zt,captureStackTrace:()=>Or,cleanEnum:()=>Jh,cleanRegex:()=>Le,clone:()=>L,cloneDef:()=>Ah,codePointLength:()=>pt,constantCatch:()=>is,createTransparentProxy:()=>Lh,defineLazy:()=>Yi,defineLazyInternal:()=>N,derived:()=>Gh,esc:()=>te,escapeRegex:()=>$e,explicitlyAborted:()=>ns,extend:()=>jh,finalizeIssue:()=>ce,floatSafeRemainder:()=>vn,getElementAtPath:()=>Eh,getEnumValues:()=>Et,getLengthableOrigin:()=>On,getParsedType:()=>Ch,getSizableOrigin:()=>Pn,hexToUint8Array:()=>Hh,hide:()=>An,installLazyProp:()=>eg,isObject:()=>ft,isPlainObject:()=>_e,issue:()=>Lt,joinValues:()=>Ir,jsonStringifyReplacer:()=>Nt,members:()=>os,merge:()=>Vh,mergeDefs:()=>ve,normalizeParams:()=>_,nullish:()=>Pr,numKeys:()=>Th,objectClone:()=>Ph,omit:()=>Dh,optionalKeys:()=>ts,own:()=>qe,parsedType:()=>rs,partial:()=>Fh,pick:()=>Rh,prefixIssues:()=>ae,primitiveTypes:()=>es,promiseAllObject:()=>Nh,propertyKeyTypes:()=>xn,randomString:()=>Zh,rawShape:()=>Tt,required:()=>Uh,safeExtend:()=>Mh,shallowClone:()=>kn,sizeCaps:()=>Ct,slugify:()=>Xi,stringifyPrimitive:()=>Ar,toZod:()=>wn,uint8ArrayToBase64:()=>tp,uint8ArrayToBase64url:()=>qh,uint8ArrayToHex:()=>Wh,unwrapMessage:()=>At});function kh(e){return e}function xh(e){return e}function wn(){return e=>e}function zh(e){}function Sh(e){throw new Error("Unexpected value in exhaustive check")}function Ih(e){}function Et(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Ir(e,t="|"){return e.map(n=>Ar(n)).join(t)}function Nt(e,t){return typeof t=="bigint"?t.toString():t}var Wi=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Zt(e){return new Wi(e)}function Pr(e){return e==null}function Le(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function vn(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}var Gf=Symbol("evaluating");function Yi(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Gf)return r===void 0&&(r=Gf,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ph(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function G(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Tt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Ce(e){return Tt(e._zod.def)??e._zod.def.shape}function Yf(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return G(this,t,r),r},enumerable:!0,configurable:!0})}function Xf(e,t,n){t in e?G(e,t,n):e[t]=n}function lt(e,t,n,r){let o=Ce(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Yf(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a}):Xf(e,i,r?r(s.value,i):s.value))}}function Oh(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Yf(e,n,()=>t[n]):Xf(e,n,r.value))}}function ve(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ah(e){return ve(e._zod.def)}function Eh(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function Nh(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=r[i];return o})}function Zh(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function te(e){return JSON.stringify(e)}function Xi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Or="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ft(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Qi=Zt(()=>{if(W.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function _e(e){if(ft(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(ft(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function kn(e){return _e(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Th(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var Ch=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}`)}},xn=new Set(["string","number","symbol"]),es=new Set(["string","number","bigint","boolean","symbol","undefined"]);function $e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Lh(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,i){return t??(t=e()),Reflect.set(t,r,o,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function Ar(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function ts(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var zn={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]},Sn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Rh(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return lt(i,e,Er(e,t)),L(e,ve(n,{shape:i,checks:[]}))}function Er(e,t){let n=Ce(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&r.push(o)}return r}function Dh(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Er(e,t)),s={};return lt(s,e,Reflect.ownKeys(Ce(e)).filter(a=>!i.has(a))),L(e,ve(n,{shape:s,checks:[]}))}function jh(e,t){if(!_e(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=Ce(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return L(e,ve(e._zod.def,{shape:Qf(e,t)}))}function Qf(e,t){let n={};return lt(n,e,Reflect.ownKeys(Ce(e))),Oh(n,t),n}function Mh(e,t){if(!_e(t))throw new Error("Invalid input to safeExtend: expected a plain object");return L(e,ve(e._zod.def,{shape:Qf(e,t)}))}function Vh(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};lt(n,e,Reflect.ownKeys(Ce(e))),lt(n,t,Reflect.ownKeys(Ce(t)));let r=ve(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return L(e,r)}function Fh(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Er(t,n)):void 0,c={};return lt(c,t,Reflect.ownKeys(Ce(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),L(t,ve(t._zod.def,{shape:c,checks:[]}))}function Uh(e,t,n){let r=n?new Set(Er(t,n)):void 0,o={};return lt(o,t,Reflect.ownKeys(Ce(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),L(t,ve(t._zod.def,{shape:o}))}function ne(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ns(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ae(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function At(e){return typeof e=="string"?e:e?.message}function Ct(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;o>=0&&t.push([o,n])}return t}function In(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function ce(e,t,n){var r;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:At(e.inst?._zod.def?.error?.(e))??At(i?.(e))??At(t?.error?.(e))??At(n.customError?.(e))??At(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function Pn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Bh=/[\uD800-\uDBFF]/;function pt(e){let t=e.length;if(!Bh.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function On(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function rs(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Lt(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function Jh(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function ep(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function tp(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Kh(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return ep(t+n)}function qh(e){return tp(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Hh(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function Wh(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Gi=class{constructor(...t){}};function os(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Yh(e,n,r.value)}}function qe(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function An(e,t,n){return qe(e,t,n,!1)}function Gh(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return qe(this,n,r(this))},set(o){qe(this,n,o)}})}return t}function Yh(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:qe(this,t,n.bind(this))},set(r){qe(this,t,r)}})}function Xh(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Hi,Ke=!1,Qh={configurable:!0,get(){Ke=!0}};function N(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Hi!==e._zod){Hi=void 0;return}Hi=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Qh);let o=Ke;Ke=!1;try{let i=n(this);return Ke?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Ke=Ke||o,i}catch(i){throw delete this[t],Ke=Ke||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function eg(e,t,n,r){let o=Xh(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var Nr="~constantCatch";function is(e){let t=()=>e;return t[Nr]=!0,t}var np,as=Object.freeze({status:"aborted"}),ss={value:void 0,enumerable:!1},rp="captureStackTrace"in Error?Error:null;function tg(e){let t=rp;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return rp=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function p(e,t,n,r){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=n,a=s&&new WeakSet;function c(d,m){if(d._zod){if(d._zod.traits.has(e))return}else{ss.value=new i(m);try{Object.defineProperty(d,"_zod",ss)}finally{ss.value=void 0}}if(d._zod.traits.add(e),t(d,m),a){let b=Object.getPrototypeOf(d),$=d._zod.constr.prototype,I=b;for(;I&&I!==$;)I=Object.getPrototypeOf(I);let x=I??b;a.has(x)||(a.add(x),os(x,s))}let g=f.prototype;for(let b in g)Object.prototype.hasOwnProperty.call(g,b)&&(b in d||(d[b]=g[b].bind(d)))}let u=r?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(d){let m=r?.Parent?tg(l):this;c(m,d);let g=m._zod.deferred;if(g){for(let $ of g)$();m._zod.deferred=void 0}let b=globalThis.__zod_globalConfig?.postProcessor;return b&&b(m),m}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:d=>r?.Parent&&d instanceof r.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var cs=Symbol("zod_brand"),ue=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},He=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(np=globalThis).__zod_globalConfig??(np.__zod_globalConfig={});var W=globalThis.__zod_globalConfig;function U(e){return e&&Object.assign(W,e),W}function ng(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Nt,2)),e.message}function rg(e){this._zod.message=e}var og={get:ng,set:rg,enumerable:!0,configurable:!0},ls={value:void 0,enumerable:!1},op=new WeakSet([Object.prototype,Error.prototype]),ip=(e,t)=>{e.name="$ZodError",ls.value=t,Object.defineProperty(e,"issues",ls),ls.value=void 0,Object.defineProperty(e,"message",og);let n=Object.getPrototypeOf(e);op.has(n)||(op.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},fs=p("$ZodError",ip),le=p("$ZodError",ip,void 0,{Parent:Error});function ig(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function En(e,t=n=>n.message){let n={},r=[];for(let o of e.issues)o.path.length>0?ig(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Nn(e,t=n=>n.message){let n={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,u=0;for(;u<a.length;){let l=a[u],f=u===a.length-1;if(l==="_errors"){f&&c._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=c[l];f&&d._errors.push(t(s)),c=d,u++}}}};return r(e),n}function ps(e,t=n=>n.message){let n={errors:[]},r=(o,i=[])=>{var s;for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...i,...a.path]);else{let c=[...i,...a.path];if(c.length===0){n.errors.push(t(a));continue}let u=n,l=0;for(;l<c.length;){let f=c[l],d=l===c.length-1;typeof f=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,f)||Object.defineProperty(u.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[f]):(u.items??(u.items=[]),(s=u.items)[f]??(s[f]={errors:[]}),u=u.items[f]),d&&u.errors.push(t(a)),l++}}};return r(e),n}function sp(e){let t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(let r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function ds(e){let t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(let r of n)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${sp(r.path)}`);return t.join(`
2
+ `)}function Zr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Rt=e=>{let t=(n,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new ue;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>ce(u,s,U())));throw Or(c,i?.callee??t),c}return a.value};return t},Tr=Rt(le),Dt=e=>{let t=async(n,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>ce(u,s,U())));throw Or(c,i?.callee??t),c}return a.value};return t},Cr=Dt(le),jt=e=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new ue;return i.issues.length?ap(e,i.issues,o):{success:!0,data:i.value}},ag=jt(le);function ap(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>ce(o,n,U()))),t=void 0,n=void 0),r},set error(o){r=o,t=void 0,n=void 0}}}var Mt=e=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?ap(e,i.issues,o):{success:!0,data:i.value}},cg=Mt(le),ug=Symbol.for("zod.compile.invalid"),lg=Symbol.for("zod.compile.fallback"),Zn=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==ug)return!0;if(r.definite===!0&&n===void 0)return!1}return fg(e,t,n)});function fg(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(r[lg]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new ue;return i.issues.length===0}var Tn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},Lr=e=>{let t=Rt(e),n=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,Zr(n,s))};return n},pg=Lr(le),Rr=e=>{let t=Rt(e),n=(r,o,i,s)=>t(r,o,i,Zr(n,s));return n},dg=Rr(le),Dr=e=>{let t=Dt(e),n=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,Zr(n,s))};return n},mg=Dr(le),jr=e=>{let t=Dt(e),n=async(r,o,i,s)=>await t(r,o,i,Zr(n,s));return n},hg=jr(le),Mr=e=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return jt(e)(t,n,o)},gg=Mr(le),Vr=e=>(t,n,r)=>jt(e)(t,n,r),yg=Vr(le),Fr=e=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Mt(e)(t,n,o)},bg=Fr(le),Ur=e=>async(t,n,r)=>Mt(e)(t,n,r),_g=Ur(le);var we={};Te(we,{anyString:()=>Ms,base64:()=>Es,base64url:()=>Ns,bigint:()=>Fs,boolean:()=>Us,browserEmail:()=>Ig,cidrv4:()=>Os,cidrv6:()=>As,creditCard:()=>Br,cuid:()=>hs,cuid2:()=>gs,currencyCode:()=>Ls,date:()=>Rs,datetime:()=>js,domain:()=>Ts,duration:()=>vs,e164:()=>Cs,email:()=>xs,emoji:()=>zs,extendedDuration:()=>$g,guid:()=>ks,hex:()=>Hs,hostname:()=>Zs,html5Email:()=>xg,httpProtocol:()=>Cn,iban:()=>Jr,idnEmail:()=>Sg,integer:()=>Ln,ipv4:()=>Ss,ipv6:()=>Is,ksuid:()=>_s,lowercase:()=>Ks,mac:()=>Ps,md5_base64:()=>Eg,md5_base64url:()=>Ng,md5_hex:()=>Ag,nanoid:()=>$s,nanoidOfLength:()=>ws,null:()=>Bs,number:()=>Re,rfc5322Email:()=>zg,sha1_base64:()=>Tg,sha1_base64url:()=>Cg,sha1_hex:()=>Zg,sha256_base64:()=>Rg,sha256_base64url:()=>Dg,sha256_hex:()=>Lg,sha384_base64:()=>Mg,sha384_base64url:()=>Vg,sha384_hex:()=>jg,sha512_base64:()=>Ug,sha512_base64url:()=>Bg,sha512_hex:()=>Fg,string:()=>Vs,time:()=>Ds,ulid:()=>ys,undefined:()=>Js,unicodeEmail:()=>cp,uppercase:()=>qs,uuid:()=>dt,uuid4:()=>wg,uuid6:()=>vg,uuid7:()=>kg,xid:()=>bs});var hs=/^[cC][0-9a-z]{6,}$/,gs=/^[0-9a-z]+$/,ys=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,bs=/^[0-9a-vA-V]{20}$/,_s=/^[A-Za-z0-9]{27}$/,$s=/^[a-zA-Z0-9_-]{21}$/;function ws(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var vs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$g=/^[-+]?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)?)??$/,ks=/^([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})$/,dt=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)$/,wg=dt(4),vg=dt(6),kg=dt(7),xs=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,xg=/^[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])?)*$/,zg=/^(([^<>()\[\]\\.,;:\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,}))$/,cp=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Sg=cp,Ig=/^[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])?)*$/,Pg="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function zs(){return new RegExp(Pg,"u")}var Ss=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Is=/^(([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}|:))$/,Ps=e=>{let t=$e(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Os=/^((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])$/,As=/^(([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])$/,Es=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ns=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Zs=/^(?=.{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])?)*\.?$/,Ts=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Cn=/^https?$/,Cs=/^\+[1-9]\d{6,14}$/,Br=/^\d(?:[ -]?\d){11,18}$/,Ls=/^(?: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)$/,Jr=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,up="(?:(?:\\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 Og(e){return new RegExp(`^${e}$`)}var Rs=Og(up);function ms(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ds(e){return new RegExp(`^${ms(e)}$`)}function js(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${ms({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${ms({precision:e.precision})}`:n;return new RegExp(`^${up}T(?:${r})$`)}var Ms=/^[\s\S]{0,}$/,Vs=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Fs=/^-?\d+n?$/,Ln=/^-?\d+$/,Re=/^-?\d+(?:\.\d+)?$/,Us=/^(?:true|false)$/i,Bs=/^null$/i;var Js=/^undefined$/i;var Ks=/^[^A-Z]*$/,qs=/^[^a-z]*$/,Hs=/^[0-9a-fA-F]*$/;function Rn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Dn(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Ag=/^[0-9a-fA-F]{32}$/,Eg=Rn(22,"=="),Ng=Dn(22),Zg=/^[0-9a-fA-F]{40}$/,Tg=Rn(27,"="),Cg=Dn(27),Lg=/^[0-9a-fA-F]{64}$/,Rg=Rn(43,"="),Dg=Dn(43),jg=/^[0-9a-fA-F]{96}$/,Mg=Rn(64,""),Vg=Dn(64),Fg=/^[0-9a-fA-F]{128}$/,Ug=Rn(86,"=="),Bg=Dn(86);var M=p("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ws=e=>{let t=e.value;return!Pr(t)&&t.size!==void 0},Gs=e=>{let t=e.value;return!Pr(t)&&t.length!==void 0},Kr={number:"number",bigint:"bigint",object:"date"},Hr=p("$ZodCheckLessThan",(e,t)=>{M.init(e,t);let n=Kr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Kr[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Wr=p("$ZodCheckGreaterThan",(e,t)=>{M.init(e,t);let n=Kr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Kr[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ys=p("$ZodCheckMultipleOf",(e,t)=>{M.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):vn(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Xs=p("$ZodCheckNumberFormat",(e,t)=>{M.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=zn[t.format];e._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Qs=p("$ZodCheckBigIntFormat",(e,t)=>{M.init(e,t);let[n,r]=Sn[t.format];e._zod.check=o=>{let i=o.value;i<n&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>r&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),ea=p("$ZodCheckMaxSize",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Ws),e._zod.check=r=>{let o=r.value;o.size<=t.maximum||r.issues.push({origin:Pn(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ta=p("$ZodCheckMinSize",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Ws),e._zod.check=r=>{let o=r.value;o.size>=t.minimum||r.issues.push({origin:Pn(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),na=p("$ZodCheckSizeEquals",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Ws),e._zod.check=r=>{let o=r.value,i=o.size;if(i===t.size)return;let s=i>t.size;r.issues.push({origin:Pn(o),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ra=p("$ZodCheckMaxLength",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Gs),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?pt(o):i)<=t.maximum)return;let a=On(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),oa=p("$ZodCheckMinLength",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Gs),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?pt(o):i)>=t.minimum)return;let a=On(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ia=p("$ZodCheckLengthEquals",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Gs),e._zod.check=r=>{let o=r.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?pt(o):i;if(s===t.length)return;let a=On(o),c=s>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Vt=p("$ZodCheckStringFormat",(e,t)=>{var n,r;M.init(e,t),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),sa=p("$ZodCheckRegex",(e,t)=>{Vt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),aa=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ks),Vt.init(e,t)}),ca=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=qs),Vt.init(e,t)}),ua=p("$ZodCheckIncludes",(e,t)=>{M.init(e,t);let n=$e(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),la=p("$ZodCheckStartsWith",(e,t)=>{M.init(e,t);let n=new RegExp(`^${$e(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),fa=p("$ZodCheckEndsWith",(e,t)=>{M.init(e,t);let n=new RegExp(`.*${$e(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function qr(e,t,n){e.issues.length&&t.issues.push(...ae(n,e.issues))}var pa=p("$ZodCheckProperty",(e,t)=>{M.init(e,t),e._zod.check=n=>{let r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(o=>qr(o,n,t.property));qr(r,n,t.property)}}),da=p("$ZodCheckProperties",(e,t)=>{M.init(e,t),An(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=r=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));let o=r.value,i;for(let[s,a]of n){let c=a._zod.run({value:o[s],issues:[]},{});c instanceof Promise?(i??(i=[]),i.push(c.then(u=>qr(u,r,s)))):qr(c,r,s)}if(i)return Promise.all(i).then(()=>{})}}),ma=p("$ZodCheckMimeType",(e,t)=>{M.init(e,t);let n=new Set(t.mime);e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),ha=p("$ZodCheckOverwrite",(e,t)=>{M.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var mt=class{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split(`
3
3
  `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
4
4
  ${n.join(`
5
5
  `)}
6
- };`)(...Object.values(this.closed))}};var ga={major:4,minor:6,patch:7};var O=p("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ga;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,u)=>{if(a.memo)return a;let l=te(a),f;for(let m of c){if(m._zod.def.when){if(ns(a)||!m._zod.def.when(a))continue}else if(l)continue;let d=a.issues.length,g=m._zod.check(a);if(g instanceof Promise&&u?.async===!1)throw new ce;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,a.issues.length!==d&&(Sn(a.issues,d,e),l||(l=te(a,d)))});else{if(a.issues.length===d)continue;Sn(a.issues,d,e),l||(l=te(a,d))}}return f?f.then(()=>a):a},s=(a,c,u)=>{if(te(a))return a.aborted=!0,a;let l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new ce;return l.then(f=>e._zod.parse(f,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(f=>s(f,a,c)):s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new ce;return u.then(l=>i(l,o,c))}return i(u,o,c)}}},{get"~standard"(){return On(this,"~standard",Xr(this))},set"~standard"(e){qe(this,"~standard",e)}}),vp=(e,t)=>e.issues.length?{issues:e.issues.map(n=>ae(n,t,F()))}:{value:e.value};async function Lg(e,t){let n={async:!0};return vp(await e._zod.run({value:t,issues:[]},n),n)}function Xr(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return vp(r,n)}catch{}return Lg(e,t)},vendor:"zod",version:1}}var ht=p("$ZodString",(e,t)=>{O.init(e,t),e._zod.pattern=t.pattern??Ms,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),R=p("$ZodStringFormat",(e,t)=>{Vt.init(e,t),ht.init(e,t)}),ba=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ks),R.init(e,t)}),_a=p("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=dt(r))}else t.pattern??(t.pattern=dt());R.init(e,t)}),$a=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=xs),R.init(e,t)}),wa=1,Dn=2;function va(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Qr(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?va(e)||Dn:kp(e,t)}function kp(e,t){if(!t.normalize&&t.protocol?.source===Tn.source&&!/^https?:\/\//i.test(e))return wa;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse=="function")return n.parse(e)??Dn}return new URL(e)}catch{return Dn}}var Rg=/[\t\n\r]/g;function jn(e){return e.replace(Rg,"")}function eo(e,t){return t.lastIndex=0,t.test(e.hostname)}function to(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ka=p("$ZodURL",(e,t)=>{R.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),o=Qr(r,t);if(o===wa){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===Dn){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=jn(r);return}t.hostname&&!eo(o,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!to(o,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?o.href:jn(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),xa=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zs()),R.init(e,t)}),za=p("$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?$s:ws(t.length)),R.init(e,t)}),Sa=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hs),R.init(e,t)}),Ia=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gs),R.init(e,t)}),Pa=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ys),R.init(e,t)}),Oa=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=bs),R.init(e,t)}),Aa=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=_s),R.init(e,t)}),Ea=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=js(t)),R.init(e,t)}),Za=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Rs),R.init(e,t)}),Na=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ds(t)),R.init(e,t)}),Ta=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vs),R.init(e,t)}),Ca=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ss),R.init(e,t)}),Dg=/^[0-9a-fA-F:.]+$/;function Mn(e){return Dg.test(e)?va(`http://[${e}]`):!1}var La=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Is),R.init(e,t),e._zod.check=n=>{Mn(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Ra=p("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Ps(t.delimiter)),R.init(e,t)}),Da=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Os),R.init(e,t)});function no(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);return`${o}`!==r||o<0||o>128?!1:Mn(n)}var ja=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=As),R.init(e,t),e._zod.check=n=>{no(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Vn(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var ro=/^[0-9a-zA-Z+/]*={0,2}$/,Ma=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ro),R.init(e,t),e._zod.check=n=>{Vn(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Fn=/^[A-Za-z0-9_-]*$/;function oo(e){if(!Fn.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Vn(n)}var Va=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fn),R.init(e,t),e._zod.check=n=>{oo(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Fa=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Cs),R.init(e,t)}),jg=/[- ]/g;function Mg(e){let t=e.length,n=1,r=0;for(;t;){let o=e.charCodeAt(--t)-48;n^=1,r+=n?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function io(e){return Fr.test(e)?Mg(e.replace(jg,"")):!1}var Ua=p("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Fr),R.init(e,t),e._zod.check=n=>{io(n.value)||n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});function Vg(e){let t=0,n=e.length;for(let r=4;r<n;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function so(e){return Ur.test(e)?Vg(e):!1}var Ba=p("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Ur),R.init(e,t),e._zod.check=n=>{so(n.value)||n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});function ao(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Ja=p("$ZodJWT",(e,t)=>{R.init(e,t),e._zod.check=n=>{ao(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ka=p("$ZodCustomStringFormat",(e,t)=>{R.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),co=p("$ZodNumber",(e,t)=>{O.init(e,t),e._zod.pattern=Le,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),qa=p("$ZodNumberFormat",(e,t)=>{Xs.init(e,t),co.init(e,t)}),Un=p("$ZodBoolean",(e,t)=>{O.init(e,t),e._zod.pattern=Us,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),uo=p("$ZodBigInt",(e,t)=>{O.init(e,t),e._zod.pattern=Fs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Wa=p("$ZodBigIntFormat",(e,t)=>{Qs.init(e,t),uo.init(e,t)}),Ha=p("$ZodSymbol",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),n}}),Ga=p("$ZodUndefined",(e,t)=>{O.init(e,t),e._zod.pattern=Js,e._zod.values=new Set([void 0]),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),Ya=p("$ZodNull",(e,t)=>{O.init(e,t),e._zod.pattern=Bs,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Xa=p("$ZodAny",(e,t)=>{O.init(e,t),e._zod.parse=n=>n}),Qa=p("$ZodUnknown",(e,t)=>{O.init(e,t),e._zod.parse=n=>n}),ec=p("$ZodNever",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),tc=p("$ZodVoid",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),nc=p("$ZodDate",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function rc(e,t){let n=Ct(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let a=t(i.value);if(a>r&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,u]of Ct(e._zod.def.checks))if(a>c&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,Sn(i.issues,l,e),i}}return o(i,s)}}var Fg=e=>Array.isArray(e)?e.length:-1,Ug=e=>e instanceof Map?e.size:-1,Bg=e=>e instanceof Set?e.size:-1;function ap(e,t,n){e.issues.length&&t.issues.push(...se(n,e.issues)),t.value[n]=e.value}var oc=p("$ZodArray",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(f=>ap(f,r,c)));else if(ap(l,r,c),a&&l.issues.length!==0&&te(l))break}return s.length?Promise.all(s).then(()=>r):r},rc(e,Fg)});function Yr(e,t,n,r,o,i){let s=n in r,a=i==="optional";if(!(!s&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...se(n,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(s||o==="defaulted"&&!a)&&(t.value[n]=void 0):t.value[n]=e.value}}var Jg=[];function xp(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Jg,o=r.length?[...t,...r]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=ts(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function zp(e,t,n,r,o,i,s){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,f=u.optin,m=u.optout,d=0;for(let g in t){if(s&&n.issues.length!==d){if(te(n,d))break;d=n.issues.length}if(c.has(g))continue;if(g==="__proto__"){l==="never"&&a.push(g);continue}if(l==="never"){a.push(g);continue}let b=u.run({value:t[g],issues:[]},r);b instanceof Promise?e.push(b.then($=>Yr($,n,g,t,f,m))):Yr(b,n,g,t,f,m)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Sp=p("$ZodObject",(e,t)=>{O.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let u=()=>{let l={...r};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=r,Object.defineProperty(t,"shape",{get:u})}let o=Nt(()=>xp(t));Z(e,"propValues",u=>{let l=u.def.shape,f={};for(let m in l){let d=l[m]._zod;if(d.values){Object.prototype.hasOwnProperty.call(f,m)||G(f,m,new Set);for(let g of d.values)f[m].add(g);d.optin!==void 0&&f[m].add(void 0)}}return f});let i=ft,s=t.catchall,a,c=W.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let m=[],d=a.shape,g=l?.abortEarly,b=u.issues.length;for(let $ of a.allKeys){if(g&&u.issues.length!==b){if(te(u,b))break;b=u.issues.length}if($==="__proto__")continue;let S=d[$],x=S._zod.optin,A=S._zod.optout,C=S._zod.run({value:f[$],issues:[]},l);C instanceof Promise?m.push(C.then(V=>Yr(V,u,$,f,x,A))):Yr(C,u,$,f,x,A)}return s?zp(m,f,u,l,o.value,e,g===!0):m.length?Promise.all(m).then(()=>u):u}}),ic=p("$ZodObjectJIT",(e,t)=>{Sp.init(e,t);let n=e._zod.parse,r=Nt(()=>xp(t)),o=W.memoizer,i=d=>{let g=r.value,b=g.symbolKeys,$=new mt(["payload","ctx"],{shape:d,inst:e,memo:o,syms:b}),S=V=>`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`,x=(V,T)=>`
6
+ };`)(...Object.values(this.closed))}};var ga={major:4,minor:6,patch:7};var O=p("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ga;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,u)=>{if(a.memo)return a;let l=ne(a),f;for(let d of c){if(d._zod.def.when){if(ns(a)||!d._zod.def.when(a))continue}else if(l)continue;let m=a.issues.length,g=d._zod.check(a);if(g instanceof Promise&&u?.async===!1)throw new ue;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,a.issues.length!==m&&(In(a.issues,m,e),l||(l=ne(a,m)))});else{if(a.issues.length===m)continue;In(a.issues,m,e),l||(l=ne(a,m))}}return f?f.then(()=>a):a},s=(a,c,u)=>{if(ne(a))return a.aborted=!0,a;let l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new ue;return l.then(f=>e._zod.parse(f,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(f=>s(f,a,c)):s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new ue;return u.then(l=>i(l,o,c))}return i(u,o,c)}}},{get"~standard"(){return An(this,"~standard",eo(this))},set"~standard"(e){qe(this,"~standard",e)}}),Sp=(e,t)=>e.issues.length?{issues:e.issues.map(n=>ce(n,t,U()))}:{value:e.value};async function Jg(e,t){let n={async:!0};return Sp(await e._zod.run({value:t,issues:[]},n),n)}function eo(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Sp(r,n)}catch{}return Jg(e,t)},vendor:"zod",version:1}}var ht=p("$ZodString",(e,t)=>{O.init(e,t),e._zod.pattern=t.pattern??Ms,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),R=p("$ZodStringFormat",(e,t)=>{Vt.init(e,t),ht.init(e,t)}),ba=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ks),R.init(e,t)}),_a=p("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=dt(r))}else t.pattern??(t.pattern=dt());R.init(e,t)}),$a=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=xs),R.init(e,t)}),wa=1,jn=2;function va(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function to(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?va(e)||jn:Ip(e,t)}function Ip(e,t){if(!t.normalize&&t.protocol?.source===Cn.source&&!/^https?:\/\//i.test(e))return wa;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse=="function")return n.parse(e)??jn}return new URL(e)}catch{return jn}}var Kg=/[\t\n\r]/g;function Mn(e){return e.replace(Kg,"")}function no(e,t){return t.lastIndex=0,t.test(e.hostname)}function ro(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ka=p("$ZodURL",(e,t)=>{R.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),o=to(r,t);if(o===wa){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===jn){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=Mn(r);return}t.hostname&&!no(o,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!ro(o,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?o.href:Mn(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),xa=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zs()),R.init(e,t)}),za=p("$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?$s:ws(t.length)),R.init(e,t)}),Sa=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hs),R.init(e,t)}),Ia=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gs),R.init(e,t)}),Pa=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ys),R.init(e,t)}),Oa=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=bs),R.init(e,t)}),Aa=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=_s),R.init(e,t)}),Ea=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=js(t)),R.init(e,t)}),Na=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Rs),R.init(e,t)}),Za=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ds(t)),R.init(e,t)}),Ta=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vs),R.init(e,t)}),Ca=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ss),R.init(e,t)}),qg=/^[0-9a-fA-F:.]+$/;function Vn(e){return qg.test(e)?va(`http://[${e}]`):!1}var La=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Is),R.init(e,t),e._zod.check=n=>{Vn(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Ra=p("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Ps(t.delimiter)),R.init(e,t)}),Da=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Os),R.init(e,t)});function oo(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);return`${o}`!==r||o<0||o>128?!1:Vn(n)}var ja=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=As),R.init(e,t),e._zod.check=n=>{oo(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Fn(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var io=/^[0-9a-zA-Z+/]*={0,2}$/,Ma=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=io),R.init(e,t),e._zod.check=n=>{Fn(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Un=/^[A-Za-z0-9_-]*$/;function so(e){if(!Un.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Fn(n)}var Va=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Un),R.init(e,t),e._zod.check=n=>{so(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Fa=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Cs),R.init(e,t)}),Hg=/[- ]/g;function Wg(e){let t=e.length,n=1,r=0;for(;t;){let o=e.charCodeAt(--t)-48;n^=1,r+=n?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function ao(e){return Br.test(e)?Wg(e.replace(Hg,"")):!1}var Ua=p("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Br),R.init(e,t),e._zod.check=n=>{ao(n.value)||n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});function Gg(e){let t=0,n=e.length;for(let r=4;r<n;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function co(e){return Jr.test(e)?Gg(e):!1}var Ba=p("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Jr),R.init(e,t),e._zod.check=n=>{co(n.value)||n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});function uo(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Ja=p("$ZodJWT",(e,t)=>{R.init(e,t),e._zod.check=n=>{uo(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ka=p("$ZodCustomStringFormat",(e,t)=>{R.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),lo=p("$ZodNumber",(e,t)=>{O.init(e,t),e._zod.pattern=Re,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),qa=p("$ZodNumberFormat",(e,t)=>{Xs.init(e,t),lo.init(e,t)}),Bn=p("$ZodBoolean",(e,t)=>{O.init(e,t),e._zod.pattern=Us,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),fo=p("$ZodBigInt",(e,t)=>{O.init(e,t),e._zod.pattern=Fs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Ha=p("$ZodBigIntFormat",(e,t)=>{Qs.init(e,t),fo.init(e,t)}),Wa=p("$ZodSymbol",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),n}}),Ga=p("$ZodUndefined",(e,t)=>{O.init(e,t),e._zod.pattern=Js,e._zod.values=new Set([void 0]),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),Ya=p("$ZodNull",(e,t)=>{O.init(e,t),e._zod.pattern=Bs,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Xa=p("$ZodAny",(e,t)=>{O.init(e,t),e._zod.parse=n=>n}),Qa=p("$ZodUnknown",(e,t)=>{O.init(e,t),e._zod.parse=n=>n}),ec=p("$ZodNever",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),tc=p("$ZodVoid",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),nc=p("$ZodDate",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function rc(e,t){let n=Ct(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let a=t(i.value);if(a>r&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,u]of Ct(e._zod.def.checks))if(a>c&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,In(i.issues,l,e),i}}return o(i,s)}}var Yg=e=>Array.isArray(e)?e.length:-1,Xg=e=>e instanceof Map?e.size:-1,Qg=e=>e instanceof Set?e.size:-1;function fp(e,t,n){e.issues.length&&t.issues.push(...ae(n,e.issues)),t.value[n]=e.value}var oc=p("$ZodArray",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(f=>fp(f,r,c)));else if(fp(l,r,c),a&&l.issues.length!==0&&ne(l))break}return s.length?Promise.all(s).then(()=>r):r},rc(e,Yg)});function Qr(e,t,n,r,o,i){let s=n in r,a=i==="optional";if(!(!s&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...ae(n,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(s||o==="defaulted"&&!a)&&(t.value[n]=void 0):t.value[n]=e.value}}var ey=[];function Pp(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ey,o=r.length?[...t,...r]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=ts(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Op(e,t,n,r,o,i,s){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,f=u.optin,d=u.optout,m=0;for(let g in t){if(s&&n.issues.length!==m){if(ne(n,m))break;m=n.issues.length}if(c.has(g))continue;if(g==="__proto__"){l==="never"&&a.push(g);continue}if(l==="never"){a.push(g);continue}let b=u.run({value:t[g],issues:[]},r);b instanceof Promise?e.push(b.then($=>Qr($,n,g,t,f,d))):Qr(b,n,g,t,f,d)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Ap=p("$ZodObject",(e,t)=>{O.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let u=()=>{let l={...r};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=r,Object.defineProperty(t,"shape",{get:u})}let o=Zt(()=>Pp(t));N(e,"propValues",u=>{let l=u.def.shape,f={};for(let d in l){let m=l[d]._zod;if(m.values){Object.prototype.hasOwnProperty.call(f,d)||G(f,d,new Set);for(let g of m.values)f[d].add(g);m.optin!==void 0&&f[d].add(void 0)}}return f});let i=ft,s=t.catchall,a,c=W.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let d=[],m=a.shape,g=l?.abortEarly,b=u.issues.length;for(let $ of a.allKeys){if(g&&u.issues.length!==b){if(ne(u,b))break;b=u.issues.length}if($==="__proto__")continue;let I=m[$],x=I._zod.optin,A=I._zod.optout,C=I._zod.run({value:f[$],issues:[]},l);C instanceof Promise?d.push(C.then(V=>Qr(V,u,$,f,x,A))):Qr(C,u,$,f,x,A)}return s?Op(d,f,u,l,o.value,e,g===!0):d.length?Promise.all(d).then(()=>u):u}}),ic=p("$ZodObjectJIT",(e,t)=>{Ap.init(e,t);let n=e._zod.parse,r=Zt(()=>Pp(t)),o=W.memoizer,i=m=>{let g=r.value,b=g.symbolKeys,$=new mt(["payload","ctx"],{shape:m,inst:e,memo:o,syms:b}),I=V=>`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`,x=(V,T)=>`
7
7
  let ${V}_ab = false;
8
8
  for (let i = 0; i < ${V}.issues.length; i++) {
9
9
  const iss = ${V}.issues[i];
@@ -14,34 +14,34 @@ ${n.join(`
14
14
  if (${V}_ab && ctx && ctx.abortEarly) {
15
15
  payload.value = newResult;
16
16
  return payload;
17
- }`;$.write("const input = payload.value;");let A=Object.create(null),C=0;for(let V of g.allKeys)A[V]=`key_${C++}`;$.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let V of g.allKeys){if(V==="__proto__")continue;let T=A[V],X=typeof V=="symbol"?`syms[${b.indexOf(V)}]`:ee(V),_n=`${X} in input`,Uf=d[V],qi=Uf?._zod?.optin,Bf=qi!==void 0,fh=Uf?._zod?.optout==="optional";if($.write(`const ${T} = ${S(X)};`),Bf&&fh){let ph=qi==="optional"?`${T}_present`:`${T}.value !== undefined || ${T}_present`;$.write(`
18
- const ${T}_present = ${_n};
17
+ }`;$.write("const input = payload.value;");let A=Object.create(null),C=0;for(let V of g.allKeys)A[V]=`key_${C++}`;$.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let V of g.allKeys){if(V==="__proto__")continue;let T=A[V],Q=typeof V=="symbol"?`syms[${b.indexOf(V)}]`:te(V),$n=`${Q} in input`,qf=m[V],qi=qf?._zod?.optin,Hf=qi!==void 0,$h=qf?._zod?.optout==="optional";if($.write(`const ${T} = ${I(Q)};`),Hf&&$h){let wh=qi==="optional"?`${T}_present`:`${T}.value !== undefined || ${T}_present`;$.write(`
18
+ const ${T}_present = ${$n};
19
19
  if (!${T}.issues.length || ${T}_present) {
20
- if (${T}.issues.length) {${x(T,X)}
20
+ if (${T}.issues.length) {${x(T,Q)}
21
21
  }
22
22
 
23
- if (${ph}) {
24
- newResult[${X}] = ${T}.value;
23
+ if (${wh}) {
24
+ newResult[${Q}] = ${T}.value;
25
25
  }
26
26
  }
27
27
 
28
- `)}else Bf?($.write(`
29
- if (${T}.issues.length) {${x(T,X)}
28
+ `)}else Hf?($.write(`
29
+ if (${T}.issues.length) {${x(T,Q)}
30
30
  }
31
- `),qi==="defaulted"?$.write(`newResult[${X}] = ${T}.value;`):$.write(`
32
- if (${T}.value !== undefined || ${_n}) {
33
- newResult[${X}] = ${T}.value;
31
+ `),qi==="defaulted"?$.write(`newResult[${Q}] = ${T}.value;`):$.write(`
32
+ if (${T}.value !== undefined || ${$n}) {
33
+ newResult[${Q}] = ${T}.value;
34
34
  }
35
35
  `)):$.write(`
36
- const ${T}_present = ${_n};
37
- if (${T}.issues.length) {${x(T,X)}
36
+ const ${T}_present = ${$n};
37
+ if (${T}.issues.length) {${x(T,Q)}
38
38
  }
39
39
  if (!${T}_present && !${T}.issues.length) {
40
40
  payload.issues.push({
41
41
  code: "invalid_type",
42
42
  expected: "nonoptional",
43
43
  input: undefined,
44
- path: [${X}]
44
+ path: [${Q}]
45
45
  });
46
46
  if (ctx && ctx.abortEarly) {
47
47
  payload.value = newResult;
@@ -50,16 +50,16 @@ ${n.join(`
50
50
  }
51
51
 
52
52
  if (${T}_present) {
53
- newResult[${X}] = ${T}.value;
53
+ newResult[${Q}] = ${T}.value;
54
54
  }
55
55
 
56
- `)}return $.write("payload.value = newResult;"),$.write("return payload;"),$.compile()},s,a=ft,c=!W.jitless,l=c&&Qi.value,f=t.catchall,m;e._zod.parse=(d,g)=>{m??(m=r.value);let b=d.value;return a(b)?c&&l&&g?.async===!1&&g.jitless!==!0?(s||(s=i(t.shape)),d=s(d,g),f?zp([],b,d,g,m,e,g?.abortEarly===!0):d):n(d,g):(d.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),d)}});function cp(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!te(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>ae(s,r,F())))}),t)}var Bn=p("$ZodUnion",(e,t)=>{O.init(e,t),Z(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),Z(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Z(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),Z(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){let o=r.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Ce(i.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}return i?Promise.all(s).then(a=>cp(a,r,e,o)):cp(s,r,e,o)}});function up(e,t,n,r){let o=[];for(let i=0;i<e.length;i++)e[i].issues.length===0&&o.push(i);return o.length===1?(t.value=e[o[0]].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>ae(s,r,F())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1,matches:o}),t)}var sc=p("$ZodXor",(e,t)=>{Bn.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);c instanceof Promise?(s.push(c),i=!0):s.push(c)}return i?Promise.all(s).then(a=>up(a,r,e,o)):up(s,r,e,o)}});function ac(e,t){let n=e._zod,r=n.bag.optionsMap;r||(r=Ip(n.def),n.bag.optionsMap=r);let o=r.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}function Ip(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let o of r)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}var cc=p("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Bn.init(e,t);let n=e._zod.parse;Z(e,"propValues",o=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&s++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(i,u)||G(i,u,new Set);for(let f of l)i[u].add(f)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=Tt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let r=Nt(()=>Ip(t));e._zod.parse=(o,i)=>{let s=o.value;if(!ft(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=r.value.get(a);return c&&(a!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(u=>r.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),uc=p("$ZodIntersection",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>lp(n,c,u)):lp(n,i,s)}});function Ft(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(ye(e)&&ye(t)){let n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=Ft(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t[r],s=Ft(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function lp(e,t,n){let r=new Map,o,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);i.has(m)||i.set(m,u),f=[m]}else return!1;for(let m of f)r.has(m)||r.set(m,{}),r.get(m)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of n.issues)s(u,"r")||e.issues.push(u);let a=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let c=Ft(t.value,n.value);if(!c.valid){if(te(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var lo=p("$ZodTuple",(e,t)=>{O.init(e,t);let n=t.items,r=W.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],c=fp(n,"optin"),u=fp(n,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(n.length),f=t.rest?i?.abortEarly:void 0,m=!1;for(let d=0;d<n.length;d++){let g=n[d]._zod.run({value:s[d],issues:[]},i);g instanceof Promise?a.push(g.then(b=>{l[d]=b})):(l[d]=g,f&&!m&&g.issues.length&&(m=te(g)))}if(t.rest&&!m){let d=n.length-1,g=s.slice(n.length),b=o.issues.length;for(let $ of g){if(f&&o.issues.length!==b){if(te(o,b))break;b=o.issues.length}d++;let S=t.rest._zod.run({value:$,issues:[]},i);S instanceof Promise?a.push(S.then(x=>pp(x,o,d))):pp(S,o,d)}}return a.length?Promise.all(a).then(()=>dp(l,o,n,s,u)):dp(l,o,n,s,u)}});function fp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function pp(e,t,n){e.issues.length&&t.issues.push(...se(n,e.issues)),t.value[n]=e.value}function dp(e,t,n,r,o){for(let i=0;i<n.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...se(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length&&(n[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var lc=p("$ZodRecord",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!ye(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")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(f.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>ae(g,o,F())),input:l,path:[l],inst:e});continue}let m=f.value;if(m==="__proto__")continue;let d=t.valueType._zod.run({value:i[l],issues:[]},o);d instanceof Promise?s.push(d.then(g=>{g.issues.length&&r.issues.push(...se(l,g.issues)),r.value[m]=g.value})):(d.issues.length&&r.issues.push(...se(l,d.issues)),r.value[m]=d.value)}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let c;for(let u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Le.test(u)&&l.issues.length){let g=t.keyType._zod.run({value:Number(u),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?r.value[u]=i[u]:a?(c=c??[],c.push(u)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>ae(g,o,F())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let d=t.valueType._zod.run({value:i[u],issues:[]},o);d instanceof Promise?s.push(d.then(g=>{g.issues.length&&r.issues.push(...se(u,g.issues)),r.value[m]=g.value})):(d.issues.length&&r.issues.push(...se(u,d.issues)),r.value[m]=d.value)}c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>r):r}}),fc=p("$ZodMap",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let s=[];r.value=n?n.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,c=r.issues.length;for(let[u,l]of i){if(a&&r.issues.length!==c){if(te(r,c))break;c=r.issues.length}let f=t.keyType._zod.run({value:u,issues:[]},o),m=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise||m instanceof Promise?s.push(Promise.all([f,m]).then(([d,g])=>{mp(d,g,r,u,i,e,o)})):mp(f,m,r,u,i,e,o)}return s.length?Promise.all(s).then(()=>r):r},rc(e,Ug)});function mp(e,t,n,r,o,i,s){e.issues.length&&(kn.has(typeof r)?n.issues.push(...se(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(a=>ae(a,s,F()))})),t.issues.length&&(kn.has(typeof r)?n.issues.push(...se(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:t.issues.map(a=>ae(a,s,F()))})),n.value.set(e.value,t.value)}var pc=p("$ZodSet",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let s=[];r.value=n?n.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,c=r.issues.length;for(let u of i){if(a&&r.issues.length!==c){if(te(r,c))break;c=r.issues.length}let l=t.valueType._zod.run({value:u,issues:[]},o);l instanceof Promise?s.push(l.then(f=>hp(f,r))):hp(l,r)}return s.length?Promise.all(s).then(()=>r):r},rc(e,Bg)});function hp(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var dc=p("$ZodEnum",(e,t)=>{O.init(e,t);let n=Et(t.entries),r=new Set(n);e._zod.values=r,Z(e,"pattern",o=>{let i=Et(o.def.entries).filter(s=>kn.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>be(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),mc=p("$ZodLiteral",(e,t)=>{O.init(e,t);let n=new Set(t.values);e._zod.values=n,Z(e,"pattern",r=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?be(i):i?be(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),hc=p("$ZodFile",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return o instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),n}}),gc=p("$ZodTransform",(e,t)=>{O.init(e,t),e._zod.optin="optional",W.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new We(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new ce;return n.value=o,n}});function gp(e,t){return e.value=t.issues.length?void 0:t.value,e}var fo=p("$ZodOptional",(e,t)=>{O.init(e,t),Z(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Z(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),Z(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Ce(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>gp(n,i)):gp(n,o)}return t.innerType._zod.run(n,r)}}),yc=p("$ZodExactOptional",(e,t)=>{fo.init(e,t),Z(e,"values",n=>n.def.innerType._zod.values),Z(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),bc=p("$ZodNullable",(e,t)=>{O.init(e,t),Z(e,"optin",n=>n.def.innerType._zod.optin),Z(e,"optout",n=>n.def.innerType._zod.optout),Z(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Ce(r.source)}|null)$`):void 0}),Z(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),_c=p("$ZodDefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",Z(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>yp(i,t)):yp(o,t)}});function yp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var $c=p("$ZodPrefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",Z(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),wc=p("$ZodNonOptional",(e,t)=>{O.init(e,t),Z(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>bp(i,e)):bp(o,e)}});function bp(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var vc=p("$ZodSuccess",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new We("ZodSuccess");let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.issues.length===0,n)):(n.value=o.issues.length===0,n)}});function _p(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>ae(o,r,F()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var kc=p("$ZodCatch",(e,t)=>{O.init(e,t),Z(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Z(e,"optout",n=>n.def.innerType._zod.optout),Z(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>_p(n,i,t,r)):_p(n,o,t,r)}}),xc=p("$ZodNaN",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),po=p("$ZodPipe",(e,t)=>{O.init(e,t),Z(e,"values",n=>n.def.in._zod.values),Z(e,"optin",n=>n.def.in._zod.optin),Z(e,"optout",n=>n.def.out._zod.optout),Z(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Wr(s,t.in,r)):Wr(i,t.in,r)}let o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Wr(i,t.out,r)):Wr(o,t.out,r)}});function Wr(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Jn=p("$ZodCodec",(e,t)=>{O.init(e,t),Z(e,"values",n=>n.def.in._zod.values),Z(e,"optin",n=>n.def.in._zod.optin),Z(e,"optout",n=>n.def.out._zod.optout),Z(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){let i=t.in._zod.run(n,r);return i instanceof Promise?i.then(s=>Hr(s,t,r)):Hr(i,t,r)}else{let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Hr(s,t,r)):Hr(i,t,r)}}});function Hr(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Gr(e,i,t.out,n)):Gr(e,o,t.out,n)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Gr(e,i,t.in,n)):Gr(e,o,t.in,n)}}function Gr(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}var zc=p("$ZodPreprocess",(e,t)=>{po.init(e,t)}),Sc=p("$ZodReadonly",(e,t)=>{O.init(e,t),Z(e,"propValues",n=>n.def.innerType._zod.propValues),Z(e,"values",n=>n.def.innerType._zod.values),Z(e,"optin",n=>n.def.innerType?._zod?.optin),Z(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then($p):$p(o)}});function $p(e){return e.memo||(e.value=Object.freeze(e.value)),e}function Kg(e){let t=e._zod.def,n=t.pattern,r=!!t.format?.includes("int"),o,i;for(let a of t.checks??[]){let c=a._zod.def;c.pattern&&(n=c.pattern),r||(r=!!c.format?.includes("int"));let u=c.minimum??c.length,l=c.maximum??c.length;u!==void 0&&(o===void 0||u>o)&&(o=u),l!==void 0&&(i===void 0||l<i)&&(i=l)}if(n)return n.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Vs({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(r&&s===Le?Cn:s)?.source}function ya(e){let t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=ya(r);return n&&o&&i&&i!==o?n.replace(Ce(o),()=>Ce(i)):n}if(t.options){let o=t.options.map(ya);if(o.every(Boolean))return`^(${o.map(i=>Ce(i)).join("|")})$`}return Kg(e)}var Ic=p("$ZodTemplateLiteral",(e,t)=>{O.init(e,t);let n=[];for(let r of t.parts)if(typeof r=="object"&&r!==null){let o=ya(r);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);n.push(Ce(o))}else if(r===null||es.has(typeof r))n.push(be(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(r,o)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),Pc=p("$ZodFunction",(e,t)=>(O.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?Zr(e._def.input,r):r,i=Reflect.apply(n,this,o);return e._def.output?Zr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await Nr(e._def.input,r):r,i=await Reflect.apply(n,this,o);return e._def.output?await Nr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let r=e.constructor;return Array.isArray(n[0])?new r({type:"function",input:new lo({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new r({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let r=e.constructor;return new r({type:"function",input:e._def.input,output:n})},e)),Oc=p("$ZodPromise",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then(o=>t.innerType._zod.run({value:o,issues:[]},r))}),Kn=p("$ZodLazy",(e,t)=>{O.init(e,t),Yi(e._zod,"innerType",()=>{let n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),Z(e,"pattern",n=>n.innerType?._zod?.pattern),Z(e,"propValues",n=>n.innerType?._zod?.propValues),Z(e,"optin",n=>n.innerType?._zod?.optin??void 0),Z(e,"optout",n=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Ac=p("$ZodCustom",(e,t)=>{M.init(e,t),O.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>wp(i,n,r,e));wp(o,n,r,e)}});function wp(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Lt(o))}}var yo=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Zc="~memo",Op=[];function Ap(e){return e!==null&&typeof e=="object"}function Ec(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var Ep=new WeakMap,Ut=0,go=1,qn=2;function Wn(e,t,n){let r=Ep.get(e);if(r!==void 0)return r?qn:Ut;if(t.has(e))return qn;t.add(e);let o=Ut,i=l=>{if(o!==qn&&l?._zod){let f=Wn(l,t,n);f>o&&(o=f)}},s=(l,f)=>{let m=Ut;for(let d of Reflect.ownKeys(l)){let g=Object.getOwnPropertyDescriptor(l,d);if(f&&!g.enumerable)continue;let b=g.get?go:g.value?._zod?Wn(g.value,t,n):Ut;b>m&&(m=b)}return m},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=Tt(c);a(l?s(l,!0):go),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let l of c.items)i(l);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let l of c.options)i(l);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let l=c._cachedInner??(n?e._zod.innerType:void 0);a(l?Wn(l,t,!1):go);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 l in c){let f=Object.getOwnPropertyDescriptor(c,l);if(!f||f.get)continue;let m=f.value;if(!(!m||typeof m!="object")){if(m._zod)i(m);else if(Array.isArray(m))for(let d of m)i(d)}}}return t.delete(e),qg(e,o)}function qg(e,t){return t!==go&&Ep.set(e,t===qn),t}function bo(e){return Wn(e,new Set,!0)!==Ut}function Wg(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var mo,ho=[],Hg={alloc(e,t,n){let r=mo;if(!r)return n;mo=void 0;let o={value:n,issues:null};return r.set(t.value,o),ho.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&_o(i,o.value))throw new yo;return n(o,i)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,u)=>{if(n===void 0){let S=Wn(e,new Set,!1);if(S===Ut)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,u);S===qn||r?n=!0:r=!0}let l=c.value;if(!Ap(l))return s(c,u);let f=u[Zc];f||(f={buckets:new WeakMap,backEdges:void 0},u[Zc]=f);let m;o===u?m=i:(m=Wg(f,e),o=u,i=m);let d=m.get(l);if(d)return c.value=d.value,d.issues?d.issues.length&&c.issues.push(...Ec(d.issues)):(c.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value)),c;mo=m;let g=ho.length,b=s(c,u);mo=void 0;let $=ho.length>g?ho.pop():void 0;return b instanceof Promise?b.then(S=>($&&($.issues=S.issues.length?Ec(S.issues):Op),S)):($&&($.issues=b.issues.length?Ec(b.issues):Op),b)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}};function Hn(){return Hg}function _o(e,t){let n=e[Zc]?.backEdges;return n!==void 0&&Ap(t)&&n.has(t)}var Gn={};Ne(Gn,{en:()=>$o});var Gg=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):r[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=rs(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Pr(i.values[0])}`:`Invalid option: expected one of ${zr(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${zr(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(a=>`'${a}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function $o(){return{localeError:Gg()}}var Zp,Nc=Symbol("ZodOutput"),Tc=Symbol("ZodInput"),wo=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let r={...this.get(n)??{}};delete r.id;let o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function vo(){return new wo}(Zp=globalThis).__zod_globalRegistry??(Zp.__zod_globalRegistry=vo());var Y=globalThis.__zod_globalRegistry;var ne=Symbol.for("zod.compile.invalid"),Np=Symbol.for("zod.compile.fallback"),ve=class extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},N=class extends Error{constructor(t,n=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=n}};function Xg(e,t){try{return xo(e,{assertOnly:!0})}catch{return t}}function Dc(e,t){try{let n=xo(e),r=ko(e,n);return r._zod.bag.validator=Xg(e,n),r}catch(n){if(t?.strict)throw n;return e}}function ko(e,t){if(bo(e))throw new N("a schema whose subtree contains a reference cycle");let n=L(e),r=e._zod.run,o=r.__originalRun??r,i=(s,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[Np]||a&&_o(a,s.value))return o(s,a);let c=t(s.value);return c!==ne?(s.value=c,s):(a&&(a[Np]=!0),o(s,a))};return i.__originalRun=o,n._zod.bag.fallbackRun=o,n._zod.bag.validator=t,n._zod.run=i,r.__originalRun||Qg(n,e,t),n}function Qg(e,t,n){let r=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;r.safeParse=(s,a)=>{let c=n(s);return c!==ne?{success:!0,data:c}:i(s,a)}}if(typeof o.parse=="function"){let i=o.parse;r.parse=(s,a)=>{let c=n(s);return c!==ne?c:i(s,a)}}}function xo(e,t){let n=!0;try{n=bo(e)}catch{}if(n)throw new N("a schema whose subtree contains a reference cycle");let r={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new mt(["input"]),i=U(o,r,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let s=["INVALID",...r.constants.keys()],a=[ne,...r.constants.values()],c=o.content.join(`
56
+ `)}return $.write("payload.value = newResult;"),$.write("return payload;"),$.compile()},s,a=ft,c=!W.jitless,l=c&&Qi.value,f=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=r.value);let b=m.value;return a(b)?c&&l&&g?.async===!1&&g.jitless!==!0?(s||(s=i(t.shape)),m=s(m,g),f?Op([],b,m,g,d,e,g?.abortEarly===!0):m):n(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m)}});function pp(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!ne(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>ce(s,r,U())))}),t)}var Jn=p("$ZodUnion",(e,t)=>{O.init(e,t),N(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),N(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),N(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),N(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){let o=r.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Le(i.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}return i?Promise.all(s).then(a=>pp(a,r,e,o)):pp(s,r,e,o)}});function dp(e,t,n,r){let o=[];for(let i=0;i<e.length;i++)e[i].issues.length===0&&o.push(i);return o.length===1?(t.value=e[o[0]].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>ce(s,r,U())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1,matches:o}),t)}var sc=p("$ZodXor",(e,t)=>{Jn.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);c instanceof Promise?(s.push(c),i=!0):s.push(c)}return i?Promise.all(s).then(a=>dp(a,r,e,o)):dp(s,r,e,o)}});function ac(e,t){let n=e._zod,r=n.bag.optionsMap;r||(r=Ep(n.def),n.bag.optionsMap=r);let o=r.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}function Ep(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let o of r)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}var cc=p("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Jn.init(e,t);let n=e._zod.parse;N(e,"propValues",o=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&s++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(i,u)||G(i,u,new Set);for(let f of l)i[u].add(f)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=Tt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let r=Zt(()=>Ep(t));e._zod.parse=(o,i)=>{let s=o.value;if(!ft(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=r.value.get(a);return c&&(a!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(u=>r.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),uc=p("$ZodIntersection",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>mp(n,c,u)):mp(n,i,s)}});function Ft(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(_e(e)&&_e(t)){let n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=Ft(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t[r],s=Ft(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function mp(e,t,n){let r=new Map,o,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let d=String(u.path[0]);i.has(d)||i.set(d,u),f=[d]}else return!1;for(let d of f)r.has(d)||r.set(d,{}),r.get(d)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of n.issues)s(u,"r")||e.issues.push(u);let a=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let c=Ft(t.value,n.value);if(!c.valid){if(ne(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var po=p("$ZodTuple",(e,t)=>{O.init(e,t);let n=t.items,r=W.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],c=hp(n,"optin"),u=hp(n,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(n.length),f=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<n.length;m++){let g=n[m]._zod.run({value:s[m],issues:[]},i);g instanceof Promise?a.push(g.then(b=>{l[m]=b})):(l[m]=g,f&&!d&&g.issues.length&&(d=ne(g)))}if(t.rest&&!d){let m=n.length-1,g=s.slice(n.length),b=o.issues.length;for(let $ of g){if(f&&o.issues.length!==b){if(ne(o,b))break;b=o.issues.length}m++;let I=t.rest._zod.run({value:$,issues:[]},i);I instanceof Promise?a.push(I.then(x=>gp(x,o,m))):gp(I,o,m)}}return a.length?Promise.all(a).then(()=>yp(l,o,n,s,u)):yp(l,o,n,s,u)}});function hp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function gp(e,t,n){e.issues.length&&t.issues.push(...ae(n,e.issues)),t.value[n]=e.value}function yp(e,t,n,r,o){for(let i=0;i<n.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...ae(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length&&(n[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var lc=p("$ZodRecord",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!_e(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")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(f.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>ce(g,o,U())),input:l,path:[l],inst:e});continue}let d=f.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},o);m instanceof Promise?s.push(m.then(g=>{g.issues.length&&r.issues.push(...ae(l,g.issues)),r.value[d]=g.value})):(m.issues.length&&r.issues.push(...ae(l,m.issues)),r.value[d]=m.value)}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let c;for(let u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Re.test(u)&&l.issues.length){let g=t.keyType._zod.run({value:Number(u),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?r.value[u]=i[u]:a?(c=c??[],c.push(u)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>ce(g,o,U())),input:u,path:[u],inst:e});continue}let d=l.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[u],issues:[]},o);m instanceof Promise?s.push(m.then(g=>{g.issues.length&&r.issues.push(...ae(u,g.issues)),r.value[d]=g.value})):(m.issues.length&&r.issues.push(...ae(u,m.issues)),r.value[d]=m.value)}c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>r):r}}),fc=p("$ZodMap",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let s=[];r.value=n?n.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,c=r.issues.length;for(let[u,l]of i){if(a&&r.issues.length!==c){if(ne(r,c))break;c=r.issues.length}let f=t.keyType._zod.run({value:u,issues:[]},o),d=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise||d instanceof Promise?s.push(Promise.all([f,d]).then(([m,g])=>{bp(m,g,r,u,i,e,o)})):bp(f,d,r,u,i,e,o)}return s.length?Promise.all(s).then(()=>r):r},rc(e,Xg)});function bp(e,t,n,r,o,i,s){e.issues.length&&(xn.has(typeof r)?n.issues.push(...ae(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(a=>ce(a,s,U()))})),t.issues.length&&(xn.has(typeof r)?n.issues.push(...ae(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:t.issues.map(a=>ce(a,s,U()))})),n.value.set(e.value,t.value)}var pc=p("$ZodSet",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let s=[];r.value=n?n.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,c=r.issues.length;for(let u of i){if(a&&r.issues.length!==c){if(ne(r,c))break;c=r.issues.length}let l=t.valueType._zod.run({value:u,issues:[]},o);l instanceof Promise?s.push(l.then(f=>_p(f,r))):_p(l,r)}return s.length?Promise.all(s).then(()=>r):r},rc(e,Qg)});function _p(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var dc=p("$ZodEnum",(e,t)=>{O.init(e,t);let n=Et(t.entries),r=new Set(n);e._zod.values=r,N(e,"pattern",o=>{let i=Et(o.def.entries).filter(s=>xn.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>$e(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),mc=p("$ZodLiteral",(e,t)=>{O.init(e,t);let n=new Set(t.values);e._zod.values=n,N(e,"pattern",r=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?$e(i):i?$e(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),hc=p("$ZodFile",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return o instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),n}}),gc=p("$ZodTransform",(e,t)=>{O.init(e,t),e._zod.optin="optional",W.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new He(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new ue;return n.value=o,n}});function $p(e,t){return e.value=t.issues.length?void 0:t.value,e}var mo=p("$ZodOptional",(e,t)=>{O.init(e,t),N(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",N(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),N(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Le(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>$p(n,i)):$p(n,o)}return t.innerType._zod.run(n,r)}}),yc=p("$ZodExactOptional",(e,t)=>{mo.init(e,t),N(e,"values",n=>n.def.innerType._zod.values),N(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),bc=p("$ZodNullable",(e,t)=>{O.init(e,t),N(e,"optin",n=>n.def.innerType._zod.optin),N(e,"optout",n=>n.def.innerType._zod.optout),N(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Le(r.source)}|null)$`):void 0}),N(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),_c=p("$ZodDefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",N(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>wp(i,t)):wp(o,t)}});function wp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var $c=p("$ZodPrefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",N(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),wc=p("$ZodNonOptional",(e,t)=>{O.init(e,t),N(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>vp(i,e)):vp(o,e)}});function vp(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var vc=p("$ZodSuccess",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new He("ZodSuccess");let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.issues.length===0,n)):(n.value=o.issues.length===0,n)}});function kp(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>ce(o,r,U()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var kc=p("$ZodCatch",(e,t)=>{O.init(e,t),N(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),N(e,"optout",n=>n.def.innerType._zod.optout),N(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>kp(n,i,t,r)):kp(n,o,t,r)}}),xc=p("$ZodNaN",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),ho=p("$ZodPipe",(e,t)=>{O.init(e,t),N(e,"values",n=>n.def.in._zod.values),N(e,"optin",n=>n.def.in._zod.optin),N(e,"optout",n=>n.def.out._zod.optout),N(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Gr(s,t.in,r)):Gr(i,t.in,r)}let o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Gr(i,t.out,r)):Gr(o,t.out,r)}});function Gr(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Kn=p("$ZodCodec",(e,t)=>{O.init(e,t),N(e,"values",n=>n.def.in._zod.values),N(e,"optin",n=>n.def.in._zod.optin),N(e,"optout",n=>n.def.out._zod.optout),N(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){let i=t.in._zod.run(n,r);return i instanceof Promise?i.then(s=>Yr(s,t,r)):Yr(i,t,r)}else{let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Yr(s,t,r)):Yr(i,t,r)}}});function Yr(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Xr(e,i,t.out,n)):Xr(e,o,t.out,n)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Xr(e,i,t.in,n)):Xr(e,o,t.in,n)}}function Xr(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}var zc=p("$ZodPreprocess",(e,t)=>{ho.init(e,t)}),Sc=p("$ZodReadonly",(e,t)=>{O.init(e,t),N(e,"propValues",n=>n.def.innerType._zod.propValues),N(e,"values",n=>n.def.innerType._zod.values),N(e,"optin",n=>n.def.innerType?._zod?.optin),N(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(xp):xp(o)}});function xp(e){return e.memo||(e.value=Object.freeze(e.value)),e}function ty(e){let t=e._zod.def,n=t.pattern,r=!!t.format?.includes("int"),o,i;for(let a of t.checks??[]){let c=a._zod.def;c.pattern&&(n=c.pattern),r||(r=!!c.format?.includes("int"));let u=c.minimum??c.length,l=c.maximum??c.length;u!==void 0&&(o===void 0||u>o)&&(o=u),l!==void 0&&(i===void 0||l<i)&&(i=l)}if(n)return n.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Vs({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(r&&s===Re?Ln:s)?.source}function ya(e){let t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=ya(r);return n&&o&&i&&i!==o?n.replace(Le(o),()=>Le(i)):n}if(t.options){let o=t.options.map(ya);if(o.every(Boolean))return`^(${o.map(i=>Le(i)).join("|")})$`}return ty(e)}var Ic=p("$ZodTemplateLiteral",(e,t)=>{O.init(e,t);let n=[];for(let r of t.parts)if(typeof r=="object"&&r!==null){let o=ya(r);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);n.push(Le(o))}else if(r===null||es.has(typeof r))n.push($e(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(r,o)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),Pc=p("$ZodFunction",(e,t)=>(O.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?Tr(e._def.input,r):r,i=Reflect.apply(n,this,o);return e._def.output?Tr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await Cr(e._def.input,r):r,i=await Reflect.apply(n,this,o);return e._def.output?await Cr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let r=e.constructor;return Array.isArray(n[0])?new r({type:"function",input:new po({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new r({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let r=e.constructor;return new r({type:"function",input:e._def.input,output:n})},e)),Oc=p("$ZodPromise",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then(o=>t.innerType._zod.run({value:o,issues:[]},r))}),qn=p("$ZodLazy",(e,t)=>{O.init(e,t),Yi(e._zod,"innerType",()=>{let n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),N(e,"pattern",n=>n.innerType?._zod?.pattern),N(e,"propValues",n=>n.innerType?._zod?.propValues),N(e,"optin",n=>n.innerType?._zod?.optin??void 0),N(e,"optout",n=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Ac=p("$ZodCustom",(e,t)=>{M.init(e,t),O.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>zp(i,n,r,e));zp(o,n,r,e)}});function zp(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Lt(o))}}var _o=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Nc="~memo",Zp=[];function Tp(e){return e!==null&&typeof e=="object"}function Ec(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var Cp=new WeakMap,Ut=0,bo=1,Hn=2;function Wn(e,t,n){let r=Cp.get(e);if(r!==void 0)return r?Hn:Ut;if(t.has(e))return Hn;t.add(e);let o=Ut,i=l=>{if(o!==Hn&&l?._zod){let f=Wn(l,t,n);f>o&&(o=f)}},s=(l,f)=>{let d=Ut;for(let m of Reflect.ownKeys(l)){let g=Object.getOwnPropertyDescriptor(l,m);if(f&&!g.enumerable)continue;let b=g.get?bo:g.value?._zod?Wn(g.value,t,n):Ut;b>d&&(d=b)}return d},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=Tt(c);a(l?s(l,!0):bo),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let l of c.items)i(l);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let l of c.options)i(l);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let l=c._cachedInner??(n?e._zod.innerType:void 0);a(l?Wn(l,t,!1):bo);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 l in c){let f=Object.getOwnPropertyDescriptor(c,l);if(!f||f.get)continue;let d=f.value;if(!(!d||typeof d!="object")){if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}}return t.delete(e),ny(e,o)}function ny(e,t){return t!==bo&&Cp.set(e,t===Hn),t}function $o(e){return Wn(e,new Set,!0)!==Ut}function ry(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var go,yo=[],oy={alloc(e,t,n){let r=go;if(!r)return n;go=void 0;let o={value:n,issues:null};return r.set(t.value,o),yo.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&wo(i,o.value))throw new _o;return n(o,i)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,u)=>{if(n===void 0){let I=Wn(e,new Set,!1);if(I===Ut)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,u);I===Hn||r?n=!0:r=!0}let l=c.value;if(!Tp(l))return s(c,u);let f=u[Nc];f||(f={buckets:new WeakMap,backEdges:void 0},u[Nc]=f);let d;o===u?d=i:(d=ry(f,e),o=u,i=d);let m=d.get(l);if(m)return c.value=m.value,m.issues?m.issues.length&&c.issues.push(...Ec(m.issues)):(c.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value)),c;go=d;let g=yo.length,b=s(c,u);go=void 0;let $=yo.length>g?yo.pop():void 0;return b instanceof Promise?b.then(I=>($&&($.issues=I.issues.length?Ec(I.issues):Zp),I)):($&&($.issues=b.issues.length?Ec(b.issues):Zp),b)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}};function Gn(){return oy}function wo(e,t){let n=e[Nc]?.backEdges;return n!==void 0&&Tp(t)&&n.has(t)}var Yn={};Te(Yn,{en:()=>vo});var iy=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):r[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=rs(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Ar(i.values[0])}`:`Invalid option: expected one of ${Ir(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Ir(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(a=>`'${a}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function vo(){return{localeError:iy()}}var Lp,Zc=Symbol("ZodOutput"),Tc=Symbol("ZodInput"),ko=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let r={...this.get(n)??{}};delete r.id;let o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function xo(){return new ko}(Lp=globalThis).__zod_globalRegistry??(Lp.__zod_globalRegistry=xo());var Y=globalThis.__zod_globalRegistry;var re=Symbol.for("zod.compile.invalid"),Rp=Symbol.for("zod.compile.fallback"),ke=class extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},Z=class extends Error{constructor(t,n=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=n}};function ay(e,t){try{return So(e,{assertOnly:!0})}catch{return t}}function Dc(e,t){try{let n=So(e),r=zo(e,n);return r._zod.bag.validator=ay(e,n),r}catch(n){if(t?.strict)throw n;return e}}function zo(e,t){if($o(e))throw new Z("a schema whose subtree contains a reference cycle");let n=L(e),r=e._zod.run,o=r.__originalRun??r,i=(s,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[Rp]||a&&wo(a,s.value))return o(s,a);let c=t(s.value);return c!==re?(s.value=c,s):(a&&(a[Rp]=!0),o(s,a))};return i.__originalRun=o,n._zod.bag.fallbackRun=o,n._zod.bag.validator=t,n._zod.run=i,r.__originalRun||cy(n,e,t),n}function cy(e,t,n){let r=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;r.safeParse=(s,a)=>{let c=n(s);return c!==re?{success:!0,data:c}:i(s,a)}}if(typeof o.parse=="function"){let i=o.parse;r.parse=(s,a)=>{let c=n(s);return c!==re?c:i(s,a)}}}function So(e,t){let n=!0;try{n=$o(e)}catch{}if(n)throw new Z("a schema whose subtree contains a reference cycle");let r={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new mt(["input"]),i=B(o,r,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let s=["INVALID",...r.constants.keys()],a=[re,...r.constants.values()],c=o.content.join(`
57
57
  `),u=t?.debug?s.length>0?`// Constants: ${s.join(", ")}
58
58
  ${c}`:c:"",l=Function,f=`return (input) => {
59
59
  ${c}
60
- }`,m;try{m=new l(...s,f)(...a)}catch(d){throw new N(`this schema (generated code failed to evaluate: ${d.message})`)}return t?.debug&&(m.code=u),m.definite=r.definite,m}function P(e,t){for(let[r,o]of e.constants)if(o===t)return r;let n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}function yt(e,t){return e.definite=!1,P(e,t)}function z(e){return`v${e.varCounter++}`}function ey(e,t){let n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return ne;let r=n;return r.issues.length===0?r.value:ne}function Q(e,t,n,r,o=!0){let i=e.content.length,s=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return U(e,t,n,r,o)}catch(u){if(!(u instanceof N)||!u.islandable)throw u;if(e.content.length=i,t.constants.size>s){let l=Array.from(t.constants.keys()).slice(s);for(let f of l)t.constants.delete(f)}return t.constantCounter=a,t.varCounter=c,ty(e,t,n,r)}}function ty(e,t,n,r){t.definite=!1;let o=P(t,n),i=P(t,ey),s=z(t);return e.write(`const ${s} = ${i}(${o}, ${r});`),e.write(`if (${s} === INVALID) return INVALID;`),s}var ny=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function ry(e,t,n,r){let o=n._zod.def.checks;if(!o||o.length===0)return r;let i=r;for(let s of o){let a=s._zod.def;if(a.when&&!ny.has(a.check))throw new N('check with a custom "when" condition');switch(a.check){case"greater_than":oy(e,t,a,i);break;case"less_than":iy(e,t,a,i);break;case"multiple_of":sy(e,t,a,i);break;case"number_format":jp(e,a,i);break;case"min_length":{let c=He(a.minimum,"min_length"),u=Cc(e,t,i,`${i}.length >= ${c} && ${i}.length < ${a.minimum*2}`);e.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{let c=He(a.maximum,"max_length"),u=Cc(e,t,i,`${i}.length > ${c}`);e.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{let c=He(a.length,"length_equals"),u=Cc(e,t,i,`${i}.length >= ${c} && ${i}.length <= ${a.length*2}`);e.write(`if (${u} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${He(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${He(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${He(a.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Mp(e,t,a,i);break;case"custom":i=py(e,t,s,i);break;case"bigint_format":ay(e,a,i);break;case"mime_type":cy(e,t,a,i);break;case"property":ly(e,t,a,i);break;case"properties":uy(e,t,a,i);break;case"overwrite":{let c=z(t);fy(e,t,s,i,c),i=c;break}default:throw new N(`check type ${a.check}`)}}return i}function Cc(e,t,n,r){let o=P(t,pt),i=z(t);return e.write(`const ${i} = typeof ${n} === "string" && ${r} ? ${o}(${n}) : ${n}.length;`),i}function He(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new N(`${t} bound of type ${typeof e}`);return`${e}`}function Dp(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new N("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new N("comparison check with Invalid Date bound");return P(e,t)}throw new N(`comparison check bound of type ${typeof t}`)}function oy(e,t,n,r){let o=n.inclusive?"<":"<=";e.write(`if (${r} ${o} ${Dp(t,n.value)}) return INVALID;`)}function iy(e,t,n,r){let o=n.inclusive?">":">=";e.write(`if (${r} ${o} ${Dp(t,n.value)}) return INVALID;`)}function sy(e,t,n,r){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new N("multiple_of check with a zero divisor");e.write(`if (${r} % ${n.value}n !== 0n) return INVALID;`)}else{let o=P(t,wn);e.write(`if (${o}(${r}, ${He(n.value,"multiple_of")}) !== 0) return INVALID;`)}}function jp(e,t,n){let r=t.format;switch(r){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new N(`number format ${r}`)}}function ay(e,t,n){let r=t.format;if(r)switch(r){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new N(`bigint format ${r}`)}}function cy(e,t,n,r){let o=n.mime;if(o&&o.length>0){let i=P(t,new Set(o));e.write(`if (!${i}.has(${r}.type)) return INVALID;`)}}function uy(e,t,n,r){if(n.when)throw new N('check with a custom "when" condition');e.write(`if (${r} == null) return INVALID;`);let o=n.shape;for(let i of Reflect.ownKeys(o)){let s=typeof i=="symbol"?P(t,i):ee(i),a=z(t);e.write(`const ${a} = ${r}[${s}];`),Q(e,t,o[i],a,!1)}}function ly(e,t,n,r){let o=`${r}[${JSON.stringify(n.property)}]`;U(e,t,n.schema,o)}function fy(e,t,n,r,o){let i=n._zod.def.tx;if(!i)throw new N("overwrite check without a transform function");if(bt(i))throw new ve("z.compile: async overwrite transforms are not supported");let s=P(t,i);e.write(`const ${o} = ${s}(${r});`)}function Lc(){throw new ce}function jc(e){this.issues.push(e)}function py(e,t,n,r){let o=n._zod.def;if(o.fn){if(bt(o.fn))throw new ve("z.compile: async .refine() predicates are not supported");let i=yt(t,o.fn),s=P(t,Lc),a=z(t);return e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),r}if(n._zod.check){if(bt(n._zod.check))throw new ve("z.compile: async .superRefine() / check functions are not supported");let i=n._zod.check,a=yt(t,u=>{let l={value:u,issues:[],addIssue:jc};return i(l)instanceof Promise&&Lc(),l.issues.length===0?l.value:ne}),c=z(t);return e.write(`const ${c} = ${a}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new N("custom check without a predicate or check function")}var dy=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 Mp(e,t,n,r,o=!0){let i=n.format;if(i==="base64"){let u=P(t,Vn);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="base64url"){let u=P(t,oo);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="jwt"){let u=P(t,ao),l=P(t,n.alg??null);return e.write(`if (!${u}(${r}, ${l})) return INVALID;`),r}if(i==="ipv6"){let u=P(t,Mn);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="cidrv6"){let u=P(t,no);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="credit_card"){let u=P(t,io);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="iban"){let u=P(t,so);return e.write(`if (!${u}(${r})) return INVALID;`),r}let s=n;if(i==="url"||i==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let u=P(t,Qr),l=P(t,n),f=z(t),m=z(t);if(e.write(`const ${f} = ${r}.trim();`),e.write(`const ${m} = ${u}(${f}, ${l});`),e.write(`if (typeof ${m} === "number") return INVALID;`),s.hostname!==void 0){let b=P(t,eo);e.write(`if (!${b}(${m}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let b=P(t,to);e.write(`if (!${b}(${m}, ${l}.protocol)) return INVALID;`)}if(!o)return null;let d=z(t),g=s.normalize?`${m}.href`:`${P(t,jn)}(${f})`;return e.write(`const ${d} = ${g};`),d}let a=n.fn;if(a){if(bt(a))throw new N(`async string format ${i}`);let u=P(t,a);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(dy.has(i)&&n.pattern){let u=P(t,n.pattern);return e.write(`${u}.lastIndex = 0;`),e.write(`if (!${u}.test(${r})) return INVALID;`),r}let c=n.format;switch(c){case"regex":throw new N("regex format without a pattern");case"lowercase":e.write(`if (${r} !== ${r}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${r} !== ${r}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${r}.includes(${ee(n.includes)})) return INVALID;`);break;case"starts_with":{let u=n.prefix;e.write(`if (${r}.slice(0, ${u.length}) !== ${ee(u)}) return INVALID;`);break}case"ends_with":{let u=n.suffix;e.write(`if (${r}.slice(-${u.length}) !== ${ee(u)}) return INVALID;`);break}default:throw new N(`string format ${c}`)}return r}function U(e,t,n,r,o=!0){let i=n._zod.def,s=i.type;if(i.coerce)throw new N(`coercion (z.coerce.${s}())`);let a=o||!!i.checks?.length,c;switch(s){case"string":c=my(e,t,n,r,a);break;case"number":c=hy(e,n,r);break;case"boolean":c=gy(e,r);break;case"bigint":c=yy(e,n,r);break;case"symbol":c=by(e,r);break;case"undefined":c=_y(e,r);break;case"null":c=$y(e,r);break;case"any":case"unknown":c=r;break;case"never":e.write("return INVALID;"),c=r;break;case"void":c=wy(e,r);break;case"nan":c=vy(e,r);break;case"date":c=ky(e,r);break;case"object":c=xy(e,t,n,r,a);break;case"optional":c=zy(e,t,n,r,a);break;case"nullable":c=Py(e,t,n,r,a);break;case"array":c=Oy(e,t,n,r,a);break;case"literal":c=Ay(e,t,n,r);break;case"enum":c=Ey(e,t,n,r);break;case"readonly":{let u=Cp(e,t,n,r),l=z(t);e.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":Cp(e,t,n,r),c="true";break;case"default":case"prefault":c=Zy(e,t,n,r);break;case"nonoptional":c=Ny(e,t,n,r);break;case"tuple":c=Ty(e,t,n,r);break;case"union":c=Cy(e,t,n,r);break;case"intersection":c=Dy(e,t,n,r);break;case"record":c=jy(e,t,n,r);break;case"map":c=Vy(e,t,n,r);break;case"set":c=Fy(e,t,n,r);break;case"file":c=Uy(e,r);break;case"template_literal":c=By(e,t,n,r);break;case"lazy":c=Jy(e,t,n,r);break;case"pipe":c=Ky(e,t,n,r);break;case"custom":c=qy(e,t,n,r);break;case"transform":c=Gy(e,t,n,r);break;case"catch":c=Hy(e,t,n,r);break;default:throw new N(`schema type ${s}`)}return c===null?null:ry(e,t,n,c)}function my(e,t,n,r,o=!0){e.write(`if (typeof ${r} !== "string") return INVALID;`);let i=n._zod.def;return i.format===void 0?r:Mp(e,t,i,r,o)}function hy(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);let r=t._zod.def;return r.check==="number_format"&&r.format&&jp(e,{format:r.format},n),n}function gy(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function yy(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);let r=t._zod.def;if(r.format)switch(r.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}function by(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function _y(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function $y(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function wy(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function vy(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function ky(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function xy(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`);let s=i.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),u=c.length?[...a,...c]:a,l=x=>typeof x=="symbol"?P(t,x):ee(x),f=x=>typeof x=="symbol"?`[${l(x)}]`:ee(x),m=s;if(a.includes("__proto__"))throw new N('object shape key "__proto__"');let d=new Map;for(let x of u){let A=m[x],C=l(x),V=z(t);if(e.write(`const ${V} = ${r}[${C}];`),A._zod.optin!==void 0){let T=z(t);e.write(`let ${T} = (() => {`),e.indented(X=>{let _n=Q(X,t,A,V);X.write(`return ${_n};`)}),e.write("})();"),A._zod.optout==="optional"?(e.write(`if (${T} === INVALID) {`),e.indented(X=>{X.write(`if (${C} in ${r}) return INVALID;`),X.write(`${T} = undefined;`)}),e.write("}")):e.write(`if (${T} === INVALID) return INVALID;`),d.set(x,T)}else{Iy(A)&&e.write(`if (!(${C} in ${r})) return INVALID;`);let T=Q(e,t,A,V,o);T!==null&&d.set(x,T)}}let g=i.catchall,b="none";if(g){let x=g._zod.def.type;if(x==="never"){let A=a.map(C=>`k !== ${ee(C)}`).join(" && ")||"true";e.write(`for (const k in ${r}) {`),e.indented(C=>{C.write(`if (${A}) return INVALID;`)}),e.write("}")}else(x==="unknown"||x==="any")&&!g._zod.def.checks?.length?b="passthrough":b="schema"}let $=z(t),S=u.some(x=>Tp(m[x])||Rc(m[x]));if(!o){if(b==="schema"){let x=a.length>0?P(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(A=>{A.write('if (k === "__proto__") continue;'),x&&A.write(`if (${x}.has(k)) continue;`);let C=z(t);A.write(`const ${C} = ${r}[k];`),Q(A,t,g,C,!1)}),e.write("}")}return null}if(S){e.write(`const ${$} = {};`);for(let x of u){let A=l(x),C=d.get(x);Rc(m[x])?e.write(`if (${A} in ${r}) ${$}[${A}] = ${C};`):Tp(m[x])?e.write(`if (${C} !== undefined || ${A} in ${r}) ${$}[${A}] = ${C};`):e.write(`${$}[${A}] = ${C};`)}}else{let x=u.map(A=>`${f(A)}: ${d.get(A)}`).join(", ");e.write(`const ${$} = { ${x} };`)}if(b!=="none"){let x=a.length>0?P(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(A=>{if(A.write('if (k === "__proto__") continue;'),x&&A.write(`if (${x}.has(k)) continue;`),b==="passthrough")A.write(`${$}[k] = ${r}[k];`);else{let C=z(t);A.write(`const ${C} = ${r}[k];`);let V=Q(A,t,g,C);A.write(`${$}[k] = ${V};`)}}),e.write("}")}return $}function zy(e,t,n,r,o=!0){let i=n._zod.def;if(Sy(n))return U(e,t,i.innerType,r,o);if(i.innerType._zod.optin==="defaulted"){let a=z(t),c=z(t);return e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{let f=U(l,t,i.innerType,r);l.write(`return ${f};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(u=>{let l=U(u,t,i.innerType,r);u.write(`${a} = ${l};`)}),e.write("}"),a}let s=o?z(t):null;return s&&e.write(`let ${s};`),e.write(`if (${r} !== undefined) {`),e.indented(a=>{let c=U(a,t,i.innerType,r,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function Sy(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function Iy(e){return e._zod.optin===void 0&&gt(e)}function gt(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?gt(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?gt(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(gt):!0;case"intersection":return!t.left||!t.right?!0:gt(t.left)&&gt(t.right);case"pipe":return t.in?gt(t.in):!0;default:return!0}}function Rc(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function Tp(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Bt(e)}function Bt(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?Bt(t.innerType):!0;case"union":return t.options?t.options.some(Bt):!0;case"intersection":return!t.left||!t.right||Bt(t.left)||Bt(t.right);case"pipe":return t.out?Bt(t.out):!0;default:return!0}}function Py(e,t,n,r,o=!0){let i=n._zod.def,s=o?z(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${r} !== null) {`),e.indented(a=>{let c=U(a,t,i.innerType,r,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function Mc(e,t,n){for(let[r,o]of Ct(t._zod.def.checks))e.write(`if (${n} > ${He(r,o._zod.def.check)}) return INVALID;`)}function Oy(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (!Array.isArray(${r})) return INVALID;`),Mc(e,n,`${r}.length`);let s=o?z(t):null,a=z(t),c=z(t);return s&&e.write(`const ${s} = new Array(${r}.length);`),e.write(`for (let ${a} = 0; ${a} < ${r}.length; ${a}++) {`),e.indented(u=>{u.write(`const ${c} = ${r}[${a}];`);let l=Q(u,t,i.element,c,o);s&&l!==null&&u.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function Ay(e,t,n,r){let i=n._zod.def.values;if(i.length!==1){let a=P(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}let s=i[0];if(typeof s=="number"&&Number.isNaN(s)){let a=P(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}if(typeof s=="string")e.write(`if (${r} !== ${ee(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${r} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${r} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${r} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${r} !== ${s}n) return INVALID;`);else throw new N(`literal type ${typeof s}`);return r}function Ey(e,t,n,r){let o=n._zod.values;if(!o)throw new N("enum schema without enumerated values");let i=P(t,o);return e.write(`if (!${i}.has(${r})) return INVALID;`),r}function Cp(e,t,n,r){let o=n._zod.def;return U(e,t,o.innerType,r)}function Zy(e,t,n,r){let o=n._zod.def,s=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!s)return U(e,t,o.innerType,r);let c=P(t,s),u=z(t);return e.write(`let ${u} = ${r};`),e.write(`if (${r} === undefined) ${u} = ${c}();`),U(e,t,o.innerType,u)}let a=z(t);if(s){let c=P(t,s),u=P(t,vn);e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(l=>{l.write(`${a} = ${u}(${c}());`)}),e.write("} else {"),e.indented(l=>{let f=U(l,t,o.innerType,r);l.write(`${a} = ${f} === undefined ? ${u}(${c}()) : ${f};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${r} !== undefined) {`),e.indented(c=>{let u=U(c,t,o.innerType,r);c.write(`${a} = ${u};`)}),e.write("}");return a}function Ny(e,t,n,r){let o=n._zod.def,i=U(e,t,o.innerType,r),s=z(t);return e.write(`const ${s} = ${i};`),e.write(`if (${s} === undefined) return INVALID;`),s}function Ty(e,t,n,r){let o=n._zod.def,i=o.items,s=o.rest;e.write(`if (!Array.isArray(${r})) return INVALID;`);let a=Lp(i,"optin"),c=Lp(i,"optout");s?e.write(`if (${r}.length < ${a}) return INVALID;`):e.write(`if (${r}.length < ${a} || ${r}.length > ${i.length}) return INVALID;`);let u=z(t);e.write(`const ${u} = [];`);for(let l=0;l<i.length;l++){let f=i[l];if(l>=c)e.write(`if (${u}.length === ${l}) {`),e.indented(m=>{m.write(`if (${l} < ${r}.length) {`),m.indented(d=>{let g=z(t);d.write(`const ${g} = ${r}[${l}];`);let b=Q(d,t,f,g);d.write(`${u}[${l}] = ${b};`)}),m.write("} else {"),m.indented(d=>{if(Rc(f)){d.write(`${u}.length = ${l};`);return}let g=z(t),b=z(t);d.write(`const ${g} = undefined;`),d.write(`const ${b} = (() => {`),d.indented($=>{let S=Q($,t,f,g);$.write(`return ${S};`)}),d.write("})();"),d.write(`if (${b} === INVALID || ${b} === undefined) ${u}.length = ${l};`),d.write(`else ${u}[${l}] = ${b};`)}),m.write("}")}),e.write("}");else{let m=z(t);e.write(`const ${m} = ${r}[${l}];`);let d=Q(e,t,f,m);e.write(`${u}[${l}] = ${d};`)}}if(s){let l=z(t),f=z(t);e.write(`for (let ${l} = ${i.length}; ${l} < ${r}.length; ${l}++) {`),e.indented(m=>{m.write(`const ${f} = ${r}[${l}];`);let d=Q(m,t,s,f);m.write(`${u}[${l}] = ${d};`)}),e.write("}")}return u}function Lp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function Cy(e,t,n,r){let o=n._zod.def,i=o.options;if(o.discriminator)return Ly(e,t,o,r);if(o.inclusive===!1)throw new N("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),r;if(i.length===1)return U(e,t,i[0],r);if(i.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(i.flatMap(l=>l._zod.def.values)),u=P(t,c);return e.write(`if (!${u}.has(${r})) return INVALID;`),r}let a=z(t);e.write(`let ${a};`);for(let c=0;c<i.length;c++){let u=i[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{let f=U(l,t,u,r);l.write(`return ${f};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function Ly(e,t,n,r){if(n.unionFallback)throw new N("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),r;let o=z(t),i=z(t);e.write(`const ${o} = ${r}?.[${ee(n.discriminator)}];`),e.write(`let ${i};`);let s=!0,a=new Set;for(let c of n.options){let u=c._zod.propValues?.[n.discriminator];if(!u||u.size===0)throw new N("discriminated union option without static discriminator values");for(let m of u){if(a.has(m))throw new N(`duplicate discriminator value ${String(m)}`);a.add(m)}let l=Array.from(u,m=>Ry(t,o,m)),f=s?"if":"else if";e.write(`${f} (${l.join(" || ")}) {`),e.indented(m=>{let d=U(m,t,c,r);m.write(`${i} = ${d};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),i}function Ry(e,t,n){if(typeof n=="string")return`${t} === ${ee(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){let r=P(e,n);return`${t} === ${r}`}throw new N(`literal discriminator value ${String(n)}`)}function Dy(e,t,n,r){let o=n._zod.def;t.definite=!1;let i=Q(e,t,o.left,r),s=Q(e,t,o.right,r),a=P(t,Ft),c=z(t);return e.write(`const ${c} = ${a}(${i}, ${s});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function jy(e,t,n,r){let o=n._zod.def,i=P(t,ye);e.write(`if (!${i}(${r})) return INVALID;`);let s=z(t),a=z(t),c=z(t);e.write(`const ${s} = {};`);let u=o,l=u.partial?void 0:o.keyType._zod.values;if(l){let d=[];for(let b of l){if(!(typeof b=="string"||typeof b=="number"||typeof b=="symbol"))throw new N(`record key value ${String(b)}`);let $=typeof b=="number"?b.toString():b;if($==="__proto__")throw new N('record key "__proto__"');d.push($);let S=P(t,b),x=U(e,t,o.keyType,S),A=z(t);e.write(`const ${A} = ${r}[${My(t,$)}];`);let C=Q(e,t,o.valueType,A);e.write(`${s}[${x}] = ${C};`)}let g=P(t,new Set(d));return e.write(`for (const ${a} in ${r}) {`),e.indented(b=>{b.write(`if (${g}.has(${a})) continue;`),u.mode==="loose"?b.write(`if (${a} !== "__proto__") ${s}[${a}] = ${r}[${a}];`):b.write("return INVALID;")}),e.write("}"),s}let f=o.keyType._zod.def;if(!(f.type==="string"&&f.format===void 0&&!f.coerce&&(f.checks?.length??0)===0)){let d=o.mode==="loose",g=xo(o.keyType);g.definite===!1&&(t.definite=!1);let b=P(t,g),$=P(t,Le),S=z(t);return Rp(e,t,r,a,x=>{x.write(`let ${S} = ${b}(${a});`),x.write(`if (${S} === INVALID && typeof ${a} === "string" && ${$}.test(${a})) ${S} = ${b}(Number(${a}));`),d?x.write(`if (${S} === INVALID) { ${s}[${a}] = ${r}[${a}]; continue; }`):x.write(`if (${S} === INVALID) return INVALID;`),x.write(`if (${S} === "__proto__") continue;`);let A=z(t);x.write(`const ${A} = ${r}[${a}];`);let C=Q(x,t,o.valueType,A);x.write(`${s}[${S}] = ${C};`)}),s}return Rp(e,t,r,a,d=>{d.write(`const ${c} = ${r}[${a}];`);let g=Q(d,t,o.valueType,c);d.write(`${s}[${a}] = ${g};`)},"return INVALID;"),s}function Rp(e,t,n,r,o,i){let s=P(t,Object.prototype.propertyIsEnumerable),a=z(t),c=z(t),u=z(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${c} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${u} = 0; ${u} < ${c}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${r} = ${c}[${u}];`),l.write(`if (${r} === "__proto__" || !${s}.call(${n}, ${r})) continue;`),o(l)}),e.write("}"),e.write(`for (let ${u} = 0; ${u} < ${a}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${r} = ${a}[${u}];`),l.write(`if (!${s}.call(${n}, ${r})) continue;`),i?l.write(i):o(l)}),e.write("}")}function My(e,t){return typeof t=="string"?ee(t):P(e,t)}function Vy(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Map)) return INVALID;`),Mc(e,n,`${r}.size`);let i=z(t),s=z(t),a=z(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${s}, ${a}] of ${r}) {`),e.indented(c=>{let u=U(c,t,o.keyType,s),l=U(c,t,o.valueType,a);c.write(`${i}.set(${u}, ${l});`)}),e.write("}"),i}function Fy(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Set)) return INVALID;`),Mc(e,n,`${r}.size`);let i=z(t),s=z(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${s} of ${r}) {`),e.indented(a=>{let c=U(a,t,o.valueType,s);a.write(`${i}.add(${c});`)}),e.write("}"),i}function Uy(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function By(e,t,n,r){e.write(`if (typeof ${r} !== "string") return INVALID;`);let o=n._zod.pattern;if(o){let i=P(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${r})) return INVALID;`)}return r}function Jy(e,t,n,r){let o=n._zod.def,i=yt(t,o.getter),s=P(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(c=>{c.write(`const inner = ${i}();`),c.write(`${s}.parser = function(input) {`),c.indented(u=>{u.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),u.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");let a=z(t);return e.write(`const ${a} = ${s}.parser(${r});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function Ky(e,t,n,r){let o=n._zod.def,i=U(e,t,o.in,r);if(o.transform){if(bt(o.transform))throw new ve("z.compile: async transforms in pipes are not supported");let s=o.transform,c=yt(t,l=>{let f={value:l,issues:[],addIssue:jc},m=s(l,f);return m instanceof Promise?ne:f.issues.length===0?m:ne}),u=z(t);return e.write(`const ${u} = ${c}(${i});`),e.write(`if (${u} === INVALID) return INVALID;`),U(e,t,o.out,u)}else return U(e,t,o.out,i)}function bt(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function qy(e,t,n,r){let o=n._zod.def;if(o.fn){if(bt(o.fn))throw new ve("z.compile: async custom predicates are not supported");let i=yt(t,o.fn),s=P(t,Lc),a=z(t);e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new N("custom schema without a predicate function");return r}function Wy(e,t,n){let r=e._zod.run({value:n,issues:[]},{});if(r&&typeof r.then=="function")return ne;let o=r;return o.issues.length===0?o.value:t()}function Hy(e,t,n,r){let o=n._zod.def;if(!o.catchValue[Ar])throw new N("catch with a callback (only a constant catch value compiles)",!1);let i=z(t);e.write(`let ${i} = (() => {`),e.indented(u=>{let l=Q(u,t,o.innerType,r);u.write(`return ${l};`)}),e.write("})();");let s=P(t,o.innerType),a=yt(t,o.catchValue),c=P(t,Wy);return e.write(`if (${i} === INVALID) {`),e.indented(u=>{u.write(`${i} = ${c}(${s}, ${a}, ${r});`),u.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function Gy(e,t,n,r){let o=n._zod.def;if(o.transform){if(bt(o.transform))throw new ve("z.compile: async transforms are not supported");let i=o.transform,a=yt(t,u=>{let l={value:u,issues:[],addIssue:jc},f=i(u,l);return f instanceof Promise?ne:l.issues.length===0?f:ne}),c=z(t);return e.write(`const ${c} = ${a}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return r}function zo(e){return e.checks&&(e.checks=[...e.checks]),e}function Vc(e,t){return new e(zo({type:"string",..._(t)}))}function Fc(e,t){return new e(zo({type:"string",coerce:!0,..._(t)}))}function So(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function Io(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function Po(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function Oo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function Ao(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function Eo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function Yn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function Zo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function No(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function To(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function Co(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function Lo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function Ro(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function Do(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function jo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Mo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Uc(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,..._(t)})}function Vo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function Fo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Uo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Bo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Jo(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Bc(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,..._(t)})}function Jc(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,..._(t)})}function Ko(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}var Kc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Xn(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Qn(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function er(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function tr(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function qc(e,t){return new e(zo({type:"number",checks:[],..._(t)}))}function Wc(e,t){return new e(zo({type:"number",coerce:!0,checks:[],..._(t)}))}function Hc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Gc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",..._(t)})}function Yc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",..._(t)})}function Xc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",..._(t)})}function Qc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",..._(t)})}function eu(e,t){return new e({type:"boolean",..._(t)})}function tu(e,t){return new e({type:"boolean",coerce:!0,..._(t)})}function nu(e,t){return new e({type:"bigint",..._(t)})}function ru(e,t){return new e({type:"bigint",coerce:!0,..._(t)})}function ou(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",..._(t)})}function iu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",..._(t)})}function su(e,t){return new e({type:"symbol",..._(t)})}function au(e,t){return new e({type:"undefined",..._(t)})}function cu(e,t){return new e({type:"null",..._(t)})}function uu(e){return new e({type:"any"})}function lu(e){return new e({type:"unknown"})}function fu(e,t){return new e({type:"never",..._(t)})}function pu(e,t){return new e({type:"void",..._(t)})}function du(e,t){return new e({type:"date",..._(t)})}function mu(e,t){return new e({type:"date",coerce:!0,..._(t)})}function hu(e,t){return new e({type:"nan",..._(t)})}function Ie(e,t){return new Kr({check:"less_than",..._(t),value:e,inclusive:!1})}function de(e,t){return new Kr({check:"less_than",..._(t),value:e,inclusive:!0})}function Pe(e,t){return new qr({check:"greater_than",..._(t),value:e,inclusive:!1})}function me(e,t){return new qr({check:"greater_than",..._(t),value:e,inclusive:!0})}function qo(e){return Pe(0,e)}function Wo(e){return Ie(0,e)}function Ho(e){return de(0,e)}function Go(e){return me(0,e)}function Ge(e,t){return new Ys({check:"multiple_of",..._(t),value:e})}function Ye(e,t){return new ea({check:"max_size",..._(t),maximum:e})}function Oe(e,t){return new ta({check:"min_size",..._(t),minimum:e})}function _t(e,t){return new na({check:"size_equals",..._(t),size:e})}function $t(e,t){return new ra({check:"max_length",..._(t),maximum:e})}function Re(e,t){return new oa({check:"min_length",..._(t),minimum:e})}function wt(e,t){return new ia({check:"length_equals",..._(t),length:e})}function Jt(e,t){return new sa({check:"string_format",format:"regex",..._(t),pattern:e})}function Kt(e){return new aa({check:"string_format",format:"lowercase",..._(e)})}function qt(e){return new ca({check:"string_format",format:"uppercase",..._(e)})}function Wt(e,t){return new ua({check:"string_format",format:"includes",..._(t),includes:e})}function Ht(e,t){return new la({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Gt(e,t){return new fa({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Yo(e,t,n){return new pa({check:"property",property:e,schema:t,..._(n)})}function Yt(e,t){return new da({check:"properties",shape:e,..._(t)})}function Xt(e,t){return new ma({check:"mime_type",mime:e,..._(t)})}function ke(e){return new ha({check:"overwrite",tx:e})}function Qt(e){return ke(t=>t.normalize(e))}function en(){return ke(e=>e.trim())}function tn(){return ke(e=>e.toLowerCase())}function nn(){return ke(e=>e.toUpperCase())}function rn(){return ke(e=>Xi(e))}function gu(e,t,n){return new e({type:"array",element:t,..._(n)})}function Yy(e,t,n){return new e({type:"union",options:t,..._(n)})}function Xy(e,t,n){return new e({type:"union",options:t,inclusive:!1,..._(n)})}function Qy(e,t,n,r){return new e({type:"union",options:n,discriminator:t,..._(r)})}function eb(e,t,n){return new e({type:"intersection",left:t,right:n})}function tb(e,t,n,r){let o=n instanceof O,i=o?r:n,s=o?n:null;return new e({type:"tuple",items:t,rest:s,..._(i)})}function nb(e,t,n,r){return new e({type:"record",keyType:t,valueType:n,..._(r)})}function rb(e,t,n,r){return new e({type:"map",keyType:t,valueType:n,..._(r)})}function ob(e,t,n){return new e({type:"set",valueType:t,..._(n)})}function ib(e,t,n){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:r,..._(n)})}function sb(e,t,n){return new e({type:"enum",entries:t,..._(n)})}function ab(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],..._(n)})}function yu(e,t){return new e({type:"file",..._(t)})}function cb(e,t){return new e({type:"transform",transform:t})}function ub(e,t){return new e({type:"optional",innerType:t})}function lb(e,t){return new e({type:"nullable",innerType:t})}function fb(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():vn(n)}})}function pb(e,t,n){return new e({type:"nonoptional",innerType:t,..._(n)})}function db(e,t){return new e({type:"success",innerType:t})}function mb(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:is(n)})}function hb(e,t,n){return new e({type:"pipe",in:t,out:n})}function gb(e,t){return new e({type:"readonly",innerType:t})}function yb(e,t,n){return new e({type:"template_literal",parts:t,..._(n)})}function bb(e,t){return new e({type:"lazy",getter:t})}function _b(e,t){return new e({type:"promise",innerType:t})}function bu(e,t,n){let r=_(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function _u(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function $u(e,t){let n=Vp(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Lt(o,r.value,n._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Lt(i))}},e(r.value,r)),t);return n}function Vp(e,t){let n=new M({check:"custom",..._(t)});return n._zod.check=e,n}function wu(e){let t=new M({check:"describe"});return t._zod.onattach=[n=>{let r=Y.get(n)??{};Y.add(n,{...r,description:e})}],t._zod.check=()=>{},t}function vu(e){let t=new M({check:"meta"});return t._zod.onattach=[n=>{let r=Y.get(n)??{};Y.add(n,{...r,...e})}],t._zod.check=()=>{},t}function ku(e,t){let n=_(t),r=n.truthy??["true","1","yes","on","y","enabled"],o=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(r=r.map(d=>typeof d=="string"?d.toLowerCase():d),o=o.map(d=>typeof d=="string"?d.toLowerCase():d));let i=new Set(r),s=new Set(o),a=e.Codec??Jn,c=e.Boolean??Un,u=e.String??ht,l=new u({type:"string",error:n.error}),f=new c({type:"boolean",error:n.error}),m=new a({type:"pipe",in:l,out:f,transform:((d,g)=>{let b=d;return n.case!=="sensitive"&&(b=b.toLowerCase()),i.has(b)?!0:s.has(b)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:g.value,inst:m,continue:!1}),{})}),reverseTransform:((d,g)=>d===!0?r[0]||"true":o[0]||"false"),error:n.error});return m._zod.bag.truthy=r,m._zod.bag.falsy=o,m._zod.bag.case=n.case??"insensitive",m}function vt(e,t,n,r={}){let o=_(r),i={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...o};return n instanceof RegExp&&(i.pattern=n),new e(i)}function nr(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&G(e,r,n[r]);return e}function Xe(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Y,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function J(e,t,n,r,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(n,i),!0}function D(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let m=s.schema,d=t.processors[o.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,m,l)}let f=e._zod.parent;f&&(s.ref||(s.ref=f),D(f,t,l),t.seen.get(f).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&nr(s.schema,c),t.io==="input"&&re(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Fp(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Qe(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,m=e.external.uri??(g=>g);if(f)return{ref:m(f)};let d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${m("__shared")}#/${a}/${Fp(d)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Fp(l)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
60
+ }`,d;try{d=new l(...s,f)(...a)}catch(m){throw new Z(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=u),d.definite=r.definite,d}function P(e,t){for(let[r,o]of e.constants)if(o===t)return r;let n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}function yt(e,t){return e.definite=!1,P(e,t)}function z(e){return`v${e.varCounter++}`}function uy(e,t){let n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return re;let r=n;return r.issues.length===0?r.value:re}function ee(e,t,n,r,o=!0){let i=e.content.length,s=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return B(e,t,n,r,o)}catch(u){if(!(u instanceof Z)||!u.islandable)throw u;if(e.content.length=i,t.constants.size>s){let l=Array.from(t.constants.keys()).slice(s);for(let f of l)t.constants.delete(f)}return t.constantCounter=a,t.varCounter=c,ly(e,t,n,r)}}function ly(e,t,n,r){t.definite=!1;let o=P(t,n),i=P(t,uy),s=z(t);return e.write(`const ${s} = ${i}(${o}, ${r});`),e.write(`if (${s} === INVALID) return INVALID;`),s}var fy=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function py(e,t,n,r){let o=n._zod.def.checks;if(!o||o.length===0)return r;let i=r;for(let s of o){let a=s._zod.def;if(a.when&&!fy.has(a.check))throw new Z('check with a custom "when" condition');switch(a.check){case"greater_than":dy(e,t,a,i);break;case"less_than":my(e,t,a,i);break;case"multiple_of":hy(e,t,a,i);break;case"number_format":Up(e,a,i);break;case"min_length":{let c=We(a.minimum,"min_length"),u=Cc(e,t,i,`${i}.length >= ${c} && ${i}.length < ${a.minimum*2}`);e.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{let c=We(a.maximum,"max_length"),u=Cc(e,t,i,`${i}.length > ${c}`);e.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{let c=We(a.length,"length_equals"),u=Cc(e,t,i,`${i}.length >= ${c} && ${i}.length <= ${a.length*2}`);e.write(`if (${u} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${We(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${We(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${We(a.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Bp(e,t,a,i);break;case"custom":i=wy(e,t,s,i);break;case"bigint_format":gy(e,a,i);break;case"mime_type":yy(e,t,a,i);break;case"property":_y(e,t,a,i);break;case"properties":by(e,t,a,i);break;case"overwrite":{let c=z(t);$y(e,t,s,i,c),i=c;break}default:throw new Z(`check type ${a.check}`)}}return i}function Cc(e,t,n,r){let o=P(t,pt),i=z(t);return e.write(`const ${i} = typeof ${n} === "string" && ${r} ? ${o}(${n}) : ${n}.length;`),i}function We(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new Z(`${t} bound of type ${typeof e}`);return`${e}`}function Fp(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 P(e,t)}throw new Z(`comparison check bound of type ${typeof t}`)}function dy(e,t,n,r){let o=n.inclusive?"<":"<=";e.write(`if (${r} ${o} ${Fp(t,n.value)}) return INVALID;`)}function my(e,t,n,r){let o=n.inclusive?">":">=";e.write(`if (${r} ${o} ${Fp(t,n.value)}) return INVALID;`)}function hy(e,t,n,r){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new Z("multiple_of check with a zero divisor");e.write(`if (${r} % ${n.value}n !== 0n) return INVALID;`)}else{let o=P(t,vn);e.write(`if (${o}(${r}, ${We(n.value,"multiple_of")}) !== 0) return INVALID;`)}}function Up(e,t,n){let r=t.format;switch(r){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new Z(`number format ${r}`)}}function gy(e,t,n){let r=t.format;if(r)switch(r){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new Z(`bigint format ${r}`)}}function yy(e,t,n,r){let o=n.mime;if(o&&o.length>0){let i=P(t,new Set(o));e.write(`if (!${i}.has(${r}.type)) return INVALID;`)}}function by(e,t,n,r){if(n.when)throw new Z('check with a custom "when" condition');e.write(`if (${r} == null) return INVALID;`);let o=n.shape;for(let i of Reflect.ownKeys(o)){let s=typeof i=="symbol"?P(t,i):te(i),a=z(t);e.write(`const ${a} = ${r}[${s}];`),ee(e,t,o[i],a,!1)}}function _y(e,t,n,r){let o=`${r}[${JSON.stringify(n.property)}]`;B(e,t,n.schema,o)}function $y(e,t,n,r,o){let i=n._zod.def.tx;if(!i)throw new Z("overwrite check without a transform function");if(bt(i))throw new ke("z.compile: async overwrite transforms are not supported");let s=P(t,i);e.write(`const ${o} = ${s}(${r});`)}function Lc(){throw new ue}function jc(e){this.issues.push(e)}function wy(e,t,n,r){let o=n._zod.def;if(o.fn){if(bt(o.fn))throw new ke("z.compile: async .refine() predicates are not supported");let i=yt(t,o.fn),s=P(t,Lc),a=z(t);return e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),r}if(n._zod.check){if(bt(n._zod.check))throw new ke("z.compile: async .superRefine() / check functions are not supported");let i=n._zod.check,a=yt(t,u=>{let l={value:u,issues:[],addIssue:jc};return i(l)instanceof Promise&&Lc(),l.issues.length===0?l.value:re}),c=z(t);return e.write(`const ${c} = ${a}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new Z("custom check without a predicate or check function")}var vy=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 Bp(e,t,n,r,o=!0){let i=n.format;if(i==="base64"){let u=P(t,Fn);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="base64url"){let u=P(t,so);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="jwt"){let u=P(t,uo),l=P(t,n.alg??null);return e.write(`if (!${u}(${r}, ${l})) return INVALID;`),r}if(i==="ipv6"){let u=P(t,Vn);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="cidrv6"){let u=P(t,oo);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="credit_card"){let u=P(t,ao);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="iban"){let u=P(t,co);return e.write(`if (!${u}(${r})) return INVALID;`),r}let s=n;if(i==="url"||i==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let u=P(t,to),l=P(t,n),f=z(t),d=z(t);if(e.write(`const ${f} = ${r}.trim();`),e.write(`const ${d} = ${u}(${f}, ${l});`),e.write(`if (typeof ${d} === "number") return INVALID;`),s.hostname!==void 0){let b=P(t,no);e.write(`if (!${b}(${d}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let b=P(t,ro);e.write(`if (!${b}(${d}, ${l}.protocol)) return INVALID;`)}if(!o)return null;let m=z(t),g=s.normalize?`${d}.href`:`${P(t,Mn)}(${f})`;return e.write(`const ${m} = ${g};`),m}let a=n.fn;if(a){if(bt(a))throw new Z(`async string format ${i}`);let u=P(t,a);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(vy.has(i)&&n.pattern){let u=P(t,n.pattern);return e.write(`${u}.lastIndex = 0;`),e.write(`if (!${u}.test(${r})) return INVALID;`),r}let c=n.format;switch(c){case"regex":throw new Z("regex format without a pattern");case"lowercase":e.write(`if (${r} !== ${r}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${r} !== ${r}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${r}.includes(${te(n.includes)})) return INVALID;`);break;case"starts_with":{let u=n.prefix;e.write(`if (${r}.slice(0, ${u.length}) !== ${te(u)}) return INVALID;`);break}case"ends_with":{let u=n.suffix;e.write(`if (${r}.slice(-${u.length}) !== ${te(u)}) return INVALID;`);break}default:throw new Z(`string format ${c}`)}return r}function B(e,t,n,r,o=!0){let i=n._zod.def,s=i.type;if(i.coerce)throw new Z(`coercion (z.coerce.${s}())`);let a=o||!!i.checks?.length,c;switch(s){case"string":c=ky(e,t,n,r,a);break;case"number":c=xy(e,n,r);break;case"boolean":c=zy(e,r);break;case"bigint":c=Sy(e,n,r);break;case"symbol":c=Iy(e,r);break;case"undefined":c=Py(e,r);break;case"null":c=Oy(e,r);break;case"any":case"unknown":c=r;break;case"never":e.write("return INVALID;"),c=r;break;case"void":c=Ay(e,r);break;case"nan":c=Ey(e,r);break;case"date":c=Ny(e,r);break;case"object":c=Zy(e,t,n,r,a);break;case"optional":c=Ty(e,t,n,r,a);break;case"nullable":c=Ry(e,t,n,r,a);break;case"array":c=Dy(e,t,n,r,a);break;case"literal":c=jy(e,t,n,r);break;case"enum":c=My(e,t,n,r);break;case"readonly":{let u=jp(e,t,n,r),l=z(t);e.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":jp(e,t,n,r),c="true";break;case"default":case"prefault":c=Vy(e,t,n,r);break;case"nonoptional":c=Fy(e,t,n,r);break;case"tuple":c=Uy(e,t,n,r);break;case"union":c=By(e,t,n,r);break;case"intersection":c=qy(e,t,n,r);break;case"record":c=Hy(e,t,n,r);break;case"map":c=Gy(e,t,n,r);break;case"set":c=Yy(e,t,n,r);break;case"file":c=Xy(e,r);break;case"template_literal":c=Qy(e,t,n,r);break;case"lazy":c=eb(e,t,n,r);break;case"pipe":c=tb(e,t,n,r);break;case"custom":c=nb(e,t,n,r);break;case"transform":c=ib(e,t,n,r);break;case"catch":c=ob(e,t,n,r);break;default:throw new Z(`schema type ${s}`)}return c===null?null:py(e,t,n,c)}function ky(e,t,n,r,o=!0){e.write(`if (typeof ${r} !== "string") return INVALID;`);let i=n._zod.def;return i.format===void 0?r:Bp(e,t,i,r,o)}function xy(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);let r=t._zod.def;return r.check==="number_format"&&r.format&&Up(e,{format:r.format},n),n}function zy(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function Sy(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);let r=t._zod.def;if(r.format)switch(r.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}function Iy(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function Py(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function Oy(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function Ay(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function Ey(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function Ny(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function Zy(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`);let s=i.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),u=c.length?[...a,...c]:a,l=x=>typeof x=="symbol"?P(t,x):te(x),f=x=>typeof x=="symbol"?`[${l(x)}]`:te(x),d=s;if(a.includes("__proto__"))throw new Z('object shape key "__proto__"');let m=new Map;for(let x of u){let A=d[x],C=l(x),V=z(t);if(e.write(`const ${V} = ${r}[${C}];`),A._zod.optin!==void 0){let T=z(t);e.write(`let ${T} = (() => {`),e.indented(Q=>{let $n=ee(Q,t,A,V);Q.write(`return ${$n};`)}),e.write("})();"),A._zod.optout==="optional"?(e.write(`if (${T} === INVALID) {`),e.indented(Q=>{Q.write(`if (${C} in ${r}) return INVALID;`),Q.write(`${T} = undefined;`)}),e.write("}")):e.write(`if (${T} === INVALID) return INVALID;`),m.set(x,T)}else{Ly(A)&&e.write(`if (!(${C} in ${r})) return INVALID;`);let T=ee(e,t,A,V,o);T!==null&&m.set(x,T)}}let g=i.catchall,b="none";if(g){let x=g._zod.def.type;if(x==="never"){let A=a.map(C=>`k !== ${te(C)}`).join(" && ")||"true";e.write(`for (const k in ${r}) {`),e.indented(C=>{C.write(`if (${A}) return INVALID;`)}),e.write("}")}else(x==="unknown"||x==="any")&&!g._zod.def.checks?.length?b="passthrough":b="schema"}let $=z(t),I=u.some(x=>Dp(d[x])||Rc(d[x]));if(!o){if(b==="schema"){let x=a.length>0?P(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(A=>{A.write('if (k === "__proto__") continue;'),x&&A.write(`if (${x}.has(k)) continue;`);let C=z(t);A.write(`const ${C} = ${r}[k];`),ee(A,t,g,C,!1)}),e.write("}")}return null}if(I){e.write(`const ${$} = {};`);for(let x of u){let A=l(x),C=m.get(x);Rc(d[x])?e.write(`if (${A} in ${r}) ${$}[${A}] = ${C};`):Dp(d[x])?e.write(`if (${C} !== undefined || ${A} in ${r}) ${$}[${A}] = ${C};`):e.write(`${$}[${A}] = ${C};`)}}else{let x=u.map(A=>`${f(A)}: ${m.get(A)}`).join(", ");e.write(`const ${$} = { ${x} };`)}if(b!=="none"){let x=a.length>0?P(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(A=>{if(A.write('if (k === "__proto__") continue;'),x&&A.write(`if (${x}.has(k)) continue;`),b==="passthrough")A.write(`${$}[k] = ${r}[k];`);else{let C=z(t);A.write(`const ${C} = ${r}[k];`);let V=ee(A,t,g,C);A.write(`${$}[k] = ${V};`)}}),e.write("}")}return $}function Ty(e,t,n,r,o=!0){let i=n._zod.def;if(Cy(n))return B(e,t,i.innerType,r,o);if(i.innerType._zod.optin==="defaulted"){let a=z(t),c=z(t);return e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{let f=B(l,t,i.innerType,r);l.write(`return ${f};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(u=>{let l=B(u,t,i.innerType,r);u.write(`${a} = ${l};`)}),e.write("}"),a}let s=o?z(t):null;return s&&e.write(`let ${s};`),e.write(`if (${r} !== undefined) {`),e.indented(a=>{let c=B(a,t,i.innerType,r,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function Cy(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function Ly(e){return e._zod.optin===void 0&&gt(e)}function gt(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?gt(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?gt(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(gt):!0;case"intersection":return!t.left||!t.right?!0:gt(t.left)&&gt(t.right);case"pipe":return t.in?gt(t.in):!0;default:return!0}}function Rc(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function Dp(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Bt(e)}function Bt(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?Bt(t.innerType):!0;case"union":return t.options?t.options.some(Bt):!0;case"intersection":return!t.left||!t.right||Bt(t.left)||Bt(t.right);case"pipe":return t.out?Bt(t.out):!0;default:return!0}}function Ry(e,t,n,r,o=!0){let i=n._zod.def,s=o?z(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${r} !== null) {`),e.indented(a=>{let c=B(a,t,i.innerType,r,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function Mc(e,t,n){for(let[r,o]of Ct(t._zod.def.checks))e.write(`if (${n} > ${We(r,o._zod.def.check)}) return INVALID;`)}function Dy(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (!Array.isArray(${r})) return INVALID;`),Mc(e,n,`${r}.length`);let s=o?z(t):null,a=z(t),c=z(t);return s&&e.write(`const ${s} = new Array(${r}.length);`),e.write(`for (let ${a} = 0; ${a} < ${r}.length; ${a}++) {`),e.indented(u=>{u.write(`const ${c} = ${r}[${a}];`);let l=ee(u,t,i.element,c,o);s&&l!==null&&u.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function jy(e,t,n,r){let i=n._zod.def.values;if(i.length!==1){let a=P(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}let s=i[0];if(typeof s=="number"&&Number.isNaN(s)){let a=P(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}if(typeof s=="string")e.write(`if (${r} !== ${te(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${r} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${r} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${r} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${r} !== ${s}n) return INVALID;`);else throw new Z(`literal type ${typeof s}`);return r}function My(e,t,n,r){let o=n._zod.values;if(!o)throw new Z("enum schema without enumerated values");let i=P(t,o);return e.write(`if (!${i}.has(${r})) return INVALID;`),r}function jp(e,t,n,r){let o=n._zod.def;return B(e,t,o.innerType,r)}function Vy(e,t,n,r){let o=n._zod.def,s=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!s)return B(e,t,o.innerType,r);let c=P(t,s),u=z(t);return e.write(`let ${u} = ${r};`),e.write(`if (${r} === undefined) ${u} = ${c}();`),B(e,t,o.innerType,u)}let a=z(t);if(s){let c=P(t,s),u=P(t,kn);e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(l=>{l.write(`${a} = ${u}(${c}());`)}),e.write("} else {"),e.indented(l=>{let f=B(l,t,o.innerType,r);l.write(`${a} = ${f} === undefined ? ${u}(${c}()) : ${f};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${r} !== undefined) {`),e.indented(c=>{let u=B(c,t,o.innerType,r);c.write(`${a} = ${u};`)}),e.write("}");return a}function Fy(e,t,n,r){let o=n._zod.def,i=B(e,t,o.innerType,r),s=z(t);return e.write(`const ${s} = ${i};`),e.write(`if (${s} === undefined) return INVALID;`),s}function Uy(e,t,n,r){let o=n._zod.def,i=o.items,s=o.rest;e.write(`if (!Array.isArray(${r})) return INVALID;`);let a=Mp(i,"optin"),c=Mp(i,"optout");s?e.write(`if (${r}.length < ${a}) return INVALID;`):e.write(`if (${r}.length < ${a} || ${r}.length > ${i.length}) return INVALID;`);let u=z(t);e.write(`const ${u} = [];`);for(let l=0;l<i.length;l++){let f=i[l];if(l>=c)e.write(`if (${u}.length === ${l}) {`),e.indented(d=>{d.write(`if (${l} < ${r}.length) {`),d.indented(m=>{let g=z(t);m.write(`const ${g} = ${r}[${l}];`);let b=ee(m,t,f,g);m.write(`${u}[${l}] = ${b};`)}),d.write("} else {"),d.indented(m=>{if(Rc(f)){m.write(`${u}.length = ${l};`);return}let g=z(t),b=z(t);m.write(`const ${g} = undefined;`),m.write(`const ${b} = (() => {`),m.indented($=>{let I=ee($,t,f,g);$.write(`return ${I};`)}),m.write("})();"),m.write(`if (${b} === INVALID || ${b} === undefined) ${u}.length = ${l};`),m.write(`else ${u}[${l}] = ${b};`)}),d.write("}")}),e.write("}");else{let d=z(t);e.write(`const ${d} = ${r}[${l}];`);let m=ee(e,t,f,d);e.write(`${u}[${l}] = ${m};`)}}if(s){let l=z(t),f=z(t);e.write(`for (let ${l} = ${i.length}; ${l} < ${r}.length; ${l}++) {`),e.indented(d=>{d.write(`const ${f} = ${r}[${l}];`);let m=ee(d,t,s,f);d.write(`${u}[${l}] = ${m};`)}),e.write("}")}return u}function Mp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function By(e,t,n,r){let o=n._zod.def,i=o.options;if(o.discriminator)return Jy(e,t,o,r);if(o.inclusive===!1)throw new Z("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),r;if(i.length===1)return B(e,t,i[0],r);if(i.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(i.flatMap(l=>l._zod.def.values)),u=P(t,c);return e.write(`if (!${u}.has(${r})) return INVALID;`),r}let a=z(t);e.write(`let ${a};`);for(let c=0;c<i.length;c++){let u=i[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{let f=B(l,t,u,r);l.write(`return ${f};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function Jy(e,t,n,r){if(n.unionFallback)throw new Z("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),r;let o=z(t),i=z(t);e.write(`const ${o} = ${r}?.[${te(n.discriminator)}];`),e.write(`let ${i};`);let s=!0,a=new Set;for(let c of n.options){let u=c._zod.propValues?.[n.discriminator];if(!u||u.size===0)throw new Z("discriminated union option without static discriminator values");for(let d of u){if(a.has(d))throw new Z(`duplicate discriminator value ${String(d)}`);a.add(d)}let l=Array.from(u,d=>Ky(t,o,d)),f=s?"if":"else if";e.write(`${f} (${l.join(" || ")}) {`),e.indented(d=>{let m=B(d,t,c,r);d.write(`${i} = ${m};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),i}function Ky(e,t,n){if(typeof n=="string")return`${t} === ${te(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){let r=P(e,n);return`${t} === ${r}`}throw new Z(`literal discriminator value ${String(n)}`)}function qy(e,t,n,r){let o=n._zod.def;t.definite=!1;let i=ee(e,t,o.left,r),s=ee(e,t,o.right,r),a=P(t,Ft),c=z(t);return e.write(`const ${c} = ${a}(${i}, ${s});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function Hy(e,t,n,r){let o=n._zod.def,i=P(t,_e);e.write(`if (!${i}(${r})) return INVALID;`);let s=z(t),a=z(t),c=z(t);e.write(`const ${s} = {};`);let u=o,l=u.partial?void 0:o.keyType._zod.values;if(l){let m=[];for(let b of l){if(!(typeof b=="string"||typeof b=="number"||typeof b=="symbol"))throw new Z(`record key value ${String(b)}`);let $=typeof b=="number"?b.toString():b;if($==="__proto__")throw new Z('record key "__proto__"');m.push($);let I=P(t,b),x=B(e,t,o.keyType,I),A=z(t);e.write(`const ${A} = ${r}[${Wy(t,$)}];`);let C=ee(e,t,o.valueType,A);e.write(`${s}[${x}] = ${C};`)}let g=P(t,new Set(m));return e.write(`for (const ${a} in ${r}) {`),e.indented(b=>{b.write(`if (${g}.has(${a})) continue;`),u.mode==="loose"?b.write(`if (${a} !== "__proto__") ${s}[${a}] = ${r}[${a}];`):b.write("return INVALID;")}),e.write("}"),s}let f=o.keyType._zod.def;if(!(f.type==="string"&&f.format===void 0&&!f.coerce&&(f.checks?.length??0)===0)){let m=o.mode==="loose",g=So(o.keyType);g.definite===!1&&(t.definite=!1);let b=P(t,g),$=P(t,Re),I=z(t);return Vp(e,t,r,a,x=>{x.write(`let ${I} = ${b}(${a});`),x.write(`if (${I} === INVALID && typeof ${a} === "string" && ${$}.test(${a})) ${I} = ${b}(Number(${a}));`),m?x.write(`if (${I} === INVALID) { ${s}[${a}] = ${r}[${a}]; continue; }`):x.write(`if (${I} === INVALID) return INVALID;`),x.write(`if (${I} === "__proto__") continue;`);let A=z(t);x.write(`const ${A} = ${r}[${a}];`);let C=ee(x,t,o.valueType,A);x.write(`${s}[${I}] = ${C};`)}),s}return Vp(e,t,r,a,m=>{m.write(`const ${c} = ${r}[${a}];`);let g=ee(m,t,o.valueType,c);m.write(`${s}[${a}] = ${g};`)},"return INVALID;"),s}function Vp(e,t,n,r,o,i){let s=P(t,Object.prototype.propertyIsEnumerable),a=z(t),c=z(t),u=z(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${c} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${u} = 0; ${u} < ${c}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${r} = ${c}[${u}];`),l.write(`if (${r} === "__proto__" || !${s}.call(${n}, ${r})) continue;`),o(l)}),e.write("}"),e.write(`for (let ${u} = 0; ${u} < ${a}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${r} = ${a}[${u}];`),l.write(`if (!${s}.call(${n}, ${r})) continue;`),i?l.write(i):o(l)}),e.write("}")}function Wy(e,t){return typeof t=="string"?te(t):P(e,t)}function Gy(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Map)) return INVALID;`),Mc(e,n,`${r}.size`);let i=z(t),s=z(t),a=z(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${s}, ${a}] of ${r}) {`),e.indented(c=>{let u=B(c,t,o.keyType,s),l=B(c,t,o.valueType,a);c.write(`${i}.set(${u}, ${l});`)}),e.write("}"),i}function Yy(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Set)) return INVALID;`),Mc(e,n,`${r}.size`);let i=z(t),s=z(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${s} of ${r}) {`),e.indented(a=>{let c=B(a,t,o.valueType,s);a.write(`${i}.add(${c});`)}),e.write("}"),i}function Xy(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function Qy(e,t,n,r){e.write(`if (typeof ${r} !== "string") return INVALID;`);let o=n._zod.pattern;if(o){let i=P(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${r})) return INVALID;`)}return r}function eb(e,t,n,r){let o=n._zod.def,i=yt(t,o.getter),s=P(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(c=>{c.write(`const inner = ${i}();`),c.write(`${s}.parser = function(input) {`),c.indented(u=>{u.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),u.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");let a=z(t);return e.write(`const ${a} = ${s}.parser(${r});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function tb(e,t,n,r){let o=n._zod.def,i=B(e,t,o.in,r);if(o.transform){if(bt(o.transform))throw new ke("z.compile: async transforms in pipes are not supported");let s=o.transform,c=yt(t,l=>{let f={value:l,issues:[],addIssue:jc},d=s(l,f);return d instanceof Promise?re:f.issues.length===0?d:re}),u=z(t);return e.write(`const ${u} = ${c}(${i});`),e.write(`if (${u} === INVALID) return INVALID;`),B(e,t,o.out,u)}else return B(e,t,o.out,i)}function bt(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function nb(e,t,n,r){let o=n._zod.def;if(o.fn){if(bt(o.fn))throw new ke("z.compile: async custom predicates are not supported");let i=yt(t,o.fn),s=P(t,Lc),a=z(t);e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new Z("custom schema without a predicate function");return r}function rb(e,t,n){let r=e._zod.run({value:n,issues:[]},{});if(r&&typeof r.then=="function")return re;let o=r;return o.issues.length===0?o.value:t()}function ob(e,t,n,r){let o=n._zod.def;if(!o.catchValue[Nr])throw new Z("catch with a callback (only a constant catch value compiles)",!1);let i=z(t);e.write(`let ${i} = (() => {`),e.indented(u=>{let l=ee(u,t,o.innerType,r);u.write(`return ${l};`)}),e.write("})();");let s=P(t,o.innerType),a=yt(t,o.catchValue),c=P(t,rb);return e.write(`if (${i} === INVALID) {`),e.indented(u=>{u.write(`${i} = ${c}(${s}, ${a}, ${r});`),u.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function ib(e,t,n,r){let o=n._zod.def;if(o.transform){if(bt(o.transform))throw new ke("z.compile: async transforms are not supported");let i=o.transform,a=yt(t,u=>{let l={value:u,issues:[],addIssue:jc},f=i(u,l);return f instanceof Promise?re:l.issues.length===0?f:re}),c=z(t);return e.write(`const ${c} = ${a}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return r}function Io(e){return e.checks&&(e.checks=[...e.checks]),e}function Vc(e,t){return new e(Io({type:"string",..._(t)}))}function Fc(e,t){return new e(Io({type:"string",coerce:!0,..._(t)}))}function Po(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function Oo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function Ao(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function Eo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function No(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function Zo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function Xn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function To(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function Co(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function Lo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function Ro(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function Do(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function jo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function Mo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function Vo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Fo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Uc(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,..._(t)})}function Uo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function Bo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Jo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Ko(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function qo(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Bc(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,..._(t)})}function Jc(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,..._(t)})}function Ho(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}var Kc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Qn(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function er(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function tr(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function nr(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function qc(e,t){return new e(Io({type:"number",checks:[],..._(t)}))}function Hc(e,t){return new e(Io({type:"number",coerce:!0,checks:[],..._(t)}))}function Wc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Gc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",..._(t)})}function Yc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",..._(t)})}function Xc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",..._(t)})}function Qc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",..._(t)})}function eu(e,t){return new e({type:"boolean",..._(t)})}function tu(e,t){return new e({type:"boolean",coerce:!0,..._(t)})}function nu(e,t){return new e({type:"bigint",..._(t)})}function ru(e,t){return new e({type:"bigint",coerce:!0,..._(t)})}function ou(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",..._(t)})}function iu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",..._(t)})}function su(e,t){return new e({type:"symbol",..._(t)})}function au(e,t){return new e({type:"undefined",..._(t)})}function cu(e,t){return new e({type:"null",..._(t)})}function uu(e){return new e({type:"any"})}function lu(e){return new e({type:"unknown"})}function fu(e,t){return new e({type:"never",..._(t)})}function pu(e,t){return new e({type:"void",..._(t)})}function du(e,t){return new e({type:"date",..._(t)})}function mu(e,t){return new e({type:"date",coerce:!0,..._(t)})}function hu(e,t){return new e({type:"nan",..._(t)})}function Pe(e,t){return new Hr({check:"less_than",..._(t),value:e,inclusive:!1})}function me(e,t){return new Hr({check:"less_than",..._(t),value:e,inclusive:!0})}function Oe(e,t){return new Wr({check:"greater_than",..._(t),value:e,inclusive:!1})}function he(e,t){return new Wr({check:"greater_than",..._(t),value:e,inclusive:!0})}function Wo(e){return Oe(0,e)}function Go(e){return Pe(0,e)}function Yo(e){return me(0,e)}function Xo(e){return he(0,e)}function Ge(e,t){return new Ys({check:"multiple_of",..._(t),value:e})}function Ye(e,t){return new ea({check:"max_size",..._(t),maximum:e})}function Ae(e,t){return new ta({check:"min_size",..._(t),minimum:e})}function _t(e,t){return new na({check:"size_equals",..._(t),size:e})}function $t(e,t){return new ra({check:"max_length",..._(t),maximum:e})}function De(e,t){return new oa({check:"min_length",..._(t),minimum:e})}function wt(e,t){return new ia({check:"length_equals",..._(t),length:e})}function Jt(e,t){return new sa({check:"string_format",format:"regex",..._(t),pattern:e})}function Kt(e){return new aa({check:"string_format",format:"lowercase",..._(e)})}function qt(e){return new ca({check:"string_format",format:"uppercase",..._(e)})}function Ht(e,t){return new ua({check:"string_format",format:"includes",..._(t),includes:e})}function Wt(e,t){return new la({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Gt(e,t){return new fa({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Qo(e,t,n){return new pa({check:"property",property:e,schema:t,..._(n)})}function Yt(e,t){return new da({check:"properties",shape:e,..._(t)})}function Xt(e,t){return new ma({check:"mime_type",mime:e,..._(t)})}function xe(e){return new ha({check:"overwrite",tx:e})}function Qt(e){return xe(t=>t.normalize(e))}function en(){return xe(e=>e.trim())}function tn(){return xe(e=>e.toLowerCase())}function nn(){return xe(e=>e.toUpperCase())}function rn(){return xe(e=>Xi(e))}function gu(e,t,n){return new e({type:"array",element:t,..._(n)})}function sb(e,t,n){return new e({type:"union",options:t,..._(n)})}function ab(e,t,n){return new e({type:"union",options:t,inclusive:!1,..._(n)})}function cb(e,t,n,r){return new e({type:"union",options:n,discriminator:t,..._(r)})}function ub(e,t,n){return new e({type:"intersection",left:t,right:n})}function lb(e,t,n,r){let o=n instanceof O,i=o?r:n,s=o?n:null;return new e({type:"tuple",items:t,rest:s,..._(i)})}function fb(e,t,n,r){return new e({type:"record",keyType:t,valueType:n,..._(r)})}function pb(e,t,n,r){return new e({type:"map",keyType:t,valueType:n,..._(r)})}function db(e,t,n){return new e({type:"set",valueType:t,..._(n)})}function mb(e,t,n){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:r,..._(n)})}function hb(e,t,n){return new e({type:"enum",entries:t,..._(n)})}function gb(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],..._(n)})}function yu(e,t){return new e({type:"file",..._(t)})}function yb(e,t){return new e({type:"transform",transform:t})}function bb(e,t){return new e({type:"optional",innerType:t})}function _b(e,t){return new e({type:"nullable",innerType:t})}function $b(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():kn(n)}})}function wb(e,t,n){return new e({type:"nonoptional",innerType:t,..._(n)})}function vb(e,t){return new e({type:"success",innerType:t})}function kb(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:is(n)})}function xb(e,t,n){return new e({type:"pipe",in:t,out:n})}function zb(e,t){return new e({type:"readonly",innerType:t})}function Sb(e,t,n){return new e({type:"template_literal",parts:t,..._(n)})}function Ib(e,t){return new e({type:"lazy",getter:t})}function Pb(e,t){return new e({type:"promise",innerType:t})}function bu(e,t,n){let r=_(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function _u(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function $u(e,t){let n=Jp(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Lt(o,r.value,n._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Lt(i))}},e(r.value,r)),t);return n}function Jp(e,t){let n=new M({check:"custom",..._(t)});return n._zod.check=e,n}function wu(e){let t=new M({check:"describe"});return t._zod.onattach=[n=>{let r=Y.get(n)??{};Y.add(n,{...r,description:e})}],t._zod.check=()=>{},t}function vu(e){let t=new M({check:"meta"});return t._zod.onattach=[n=>{let r=Y.get(n)??{};Y.add(n,{...r,...e})}],t._zod.check=()=>{},t}function ku(e,t){let n=_(t),r=n.truthy??["true","1","yes","on","y","enabled"],o=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(r=r.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(r),s=new Set(o),a=e.Codec??Kn,c=e.Boolean??Bn,u=e.String??ht,l=new u({type:"string",error:n.error}),f=new c({type:"boolean",error:n.error}),d=new a({type:"pipe",in:l,out:f,transform:((m,g)=>{let b=m;return n.case!=="sensitive"&&(b=b.toLowerCase()),i.has(b)?!0:s.has(b)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:g.value,inst:d,continue:!1}),{})}),reverseTransform:((m,g)=>m===!0?r[0]||"true":o[0]||"false"),error:n.error});return d._zod.bag.truthy=r,d._zod.bag.falsy=o,d._zod.bag.case=n.case??"insensitive",d}function vt(e,t,n,r={}){let o=_(r),i={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...o};return n instanceof RegExp&&(i.pattern=n),new e(i)}function rr(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&G(e,r,n[r]);return e}function Xe(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Y,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function K(e,t,n,r,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(n,i),!0}function D(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let d=s.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,l)}let f=e._zod.parent;f&&(s.ref||(s.ref=f),D(f,t,l),t.seen.get(f).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&rr(s.schema,c),t.io==="input"&&oe(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Kp(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Qe(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??(g=>g);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${a}/${Kp(m)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Kp(l)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
61
61
 
62
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}a.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Jp(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!="object")return;Jp(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Kp=new Set(["type","properties","required","additionalProperties"]),Up=["oneOf","anyOf"];function Bp(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function xu(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!Kp.has(s))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??Bp(u);l!=null&&(a.some(f=>JSON.stringify(f)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:xu(a)??{allOf:a};G(n,s,c)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=Bp(s);a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function $b(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Kp)if(o in e)return;let n=t.filter(o=>Up.some(i=>Array.isArray(o[i]))),r=null;if(!n.length)r=xu(t);else{let o=n[0],i=Up.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter(c=>c!==o),a=o[i].map(c=>xu([...s,c]));if(a.some(c=>!c))return;r={[i]:a}}r&&(delete e.allOf,nr(e,r))}function et(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},f=c.ref;if(c.ref=null,f){r(f);let d=e.seen.get(f),g=d.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):nr(u,g),nr(u,l),a._zod.parent===f)for(let $ in u)$==="$ref"||$==="allOf"||$ in l||delete u[$];if(g.$ref&&d.def)for(let $ in u)$==="$ref"||$==="allOf"||$ in d.def&&JSON.stringify(u[$])===JSON.stringify(d.def[$])&&delete u[$]}let m=a._zod.parent;if(m&&m!==f){r(m);let d=e.seen.get(m);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(let g in u)g==="$ref"||g==="allOf"||g in d.def&&JSON.stringify(u[g])===JSON.stringify(d.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Jp(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=a.get(l);f?f.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])$b(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}nr(o,n.defId?n.schema:n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,G(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:on(t,"input",e.processors),output:on(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function re(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return re(r.element,n);if(r.type==="set")return re(r.valueType,n);if(r.type==="lazy")return re(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return re(r.innerType,n);if(r.type==="intersection")return re(r.left,n)||re(r.right,n);if(r.type==="record"||r.type==="map")return re(r.keyType,n)||re(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:re(r.in,n)||re(r.out,n);if(r.type==="object"){for(let o in r.shape)if(re(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(re(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(re(o,n))return!0;return!!(r.rest&&re(r.rest,n))}return!1}var zu=(e,t={})=>n=>{let r=Xe({...n,processors:t});return D(e,r),Qe(r,e),et(r,e)},on=(e,t,n={})=>r=>{let{libraryOptions:o,target:i}=r??{},s=Xe({...o??{},target:i,io:t,processors:n});return D(e,s),Qe(s,e),et(s,e)};var sn=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},an=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},qp=(e,t)=>{sn(e,"minimum",t),an(e,"maximum",t)},Yp=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Xp=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Qp=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},ed=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Wp=(e,t)=>sn(e,"minimum",t.minimum),Hp=(e,t)=>an(e,"maximum",t.maximum),Gp=e=>(t,n)=>{ed(t,n.format);let[r,o]=e[n.format];sn(t,"minimum",r),an(t,"maximum",o)},wb={greater_than:(e,t)=>sn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>an(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Yp(e,t.value),number_format:Gp(xn),bigint_format:Gp(zn),min_length:Wp,max_length:Hp,length_equals:(e,t)=>qp(e,t.length),min_size:Wp,max_size:Hp,size_equals:(e,t)=>qp(e,t.size),string_format:(e,t)=>{ed(e,t.format),t.pattern&&Xp(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Qp(e,t.mime)};function K(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)wb[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&sn(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&sn(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&an(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&an(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Yp(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&Qp(t,o.mime);for(let i of o.patterns??[])Xp(t,i);return t}var vb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},kb=new Map([[ro,Es],[Fn,Zs]]),td=e=>kb.get(e)??e,Pu=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=K(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=vb[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let f=[...c].map(td);f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Ou=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=K(e);o.type=l?"integer":"number";let f=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f?d?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),m?d?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),a){let g=new Set;for(let S of a)Number.isFinite(S)&&S!==0?g.add(Math.abs(S)):J(e,t,o,r,`A multipleOf divisor of ${S} cannot be represented in JSON Schema`);let[b,...$]=g;b!==void 0&&(o.multipleOf=b),$.length&&(o.allOf=[...o.allOf??[],...$.map(S=>({multipleOf:S}))])}},Au=(e,t,n,r)=>{n.type="boolean"},Eu=(e,t,n,r)=>{J(e,t,n,r,"BigInt cannot be represented in JSON Schema")},Zu=(e,t,n,r)=>{J(e,t,n,r,"Symbols cannot be represented in JSON Schema")},Nu=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Tu=(e,t,n,r)=>{J(e,t,n,r,"Undefined cannot be represented in JSON Schema")},Cu=(e,t,n,r)=>{J(e,t,n,r,"Void cannot be represented in JSON Schema")},Lu=(e,t,n,r)=>{n.not={}},Ru=(e,t,n,r)=>{},Du=(e,t,n,r)=>{},ju=(e,t,n,r)=>{J(e,t,n,r,"Date cannot be represented in JSON Schema")},Mu=(e,t,n,r)=>{let o=e._zod.def,i=Et(o.entries);if(i.length===0){n.not={};return}i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},Vu=(e,t,n,r)=>{let o=e._zod.def;if(o.values.length===0){n.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(J(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(J(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},Fu=(e,t,n,r)=>{J(e,t,n,r,"NaN cannot be represented in JSON Schema")},Uu=(e,t,n,r)=>{let o=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Bu=(e,t,n,r)=>{let o=n;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=K(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(c=>({contentMediaType:c})))},Ju=(e,t,n,r)=>{n.type="boolean"},Ku=(e,t,n,r)=>{J(e,t,n,r,"Custom types cannot be represented in JSON Schema")},qu=(e,t,n,r)=>{J(e,t,n,r,"Function types cannot be represented in JSON Schema")},Wu=(e,t,n,r)=>{J(e,t,n,r,"Transforms cannot be represented in JSON Schema")},Hu=(e,t,n,r)=>{J(e,t,n,r,"Map cannot be represented in JSON Schema")},Gu=(e,t,n,r)=>{J(e,t,n,r,"Set cannot be represented in JSON Schema")},Yu=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:a}=K(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=D(i.element,t,{...r,path:[...r.path,"items"]})};function rr(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?rr(t.out):t.type==="catch"?rr(t.innerType):e._zod.optin}var Xu=(e,t,n,r)=>{let o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&J(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)G(o.properties,u,D(s[u],t,{...r,path:[...r.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?rr(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=D(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Qo=(e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>D(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=s:n.anyOf=s},Qu=(e,t,n,r)=>{let o=e._zod.def,i=D(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=D(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},el=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((b,$)=>D(b,t,{...r,path:[...r.path,s,$]})),u=i.rest?D(i.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let b=i.items[l-1];if(!(t.io==="input"?rr(b)!==void 0:b._zod.optout==="optional"))break;l--}let f=i.items.length,m=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,m?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),m&&(o.maxItems=f)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),m&&(o.maxItems=f)):(o.items=c,m?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),m&&(o.maxItems=f));let{minimum:d,maximum:g}=K(e);typeof d=="number"&&(o.minItems=d),typeof g=="number"&&(o.maxItems=g)};function Su(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let g=e.get(t)?.def;if(!g)return t;let b=Su(e,g,n);return b===g?t:b}for(let g of["anyOf","oneOf"]){let b=t[g];if(!Array.isArray(b))continue;let $=b.map(S=>Su(e,S,n));$.some((S,x)=>S!==b[x])&&(t={...t,[g]:$})}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(g=>typeof g=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:f,id:m,...d}=t;return d.enum?d.enum=d.enum.map(g=>typeof g=="number"?String(g):g):typeof d.const=="number"&&(d.const=String(d.const)),o&&(d.type="string",i||(d.pattern=(r.includes("number")?Le:Cn).source)),d}var Iu=new WeakMap;function xb(e){let t=new Map;for(let r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);let n=new Map;for(let r of Iu.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Su(t,i,new Set);s!==i&&n.set(i,s)}if(n.size)for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);i&&(o.propertyNames=i)}}var tl=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let s=i.keyType,a=K(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=D(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let f of a)G(o.patternProperties,td(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=Iu.get(t);l||(l=[],Iu.set(t,l),t.deferred.push(()=>xb(t))),l.push(e)}o.additionalProperties=D(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&rr(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(f=>typeof f=="string"||typeof f=="number");l.length>0&&(o.required=l.map(String))}},nl=(e,t,n,r)=>{let o=e._zod.def,i=D(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},rl=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},ol=Symbol();function nd(e,t,n,r,o){let i=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(J(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),ol):JSON.parse(s)}var il=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s=nd(o.defaultValue,e,t,n,r);s!==ol&&(n.default=s)},sl=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=nd(o.defaultValue,e,t,n,r);s!==ol&&(n._prefault=s)},al=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{J(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},cl=(e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;D(s,t,r);let a=t.seen.get(e);a.ref=s},ul=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ll=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},ei=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},fl=(e,t,n,r)=>{let o=e._zod.innerType;D(o,t,r);let i=t.seen.get(e);i.ref=o},Xo={string:Pu,number:Ou,boolean:Au,bigint:Eu,symbol:Zu,null:Nu,undefined:Tu,void:Cu,never:Lu,any:Ru,unknown:Du,date:ju,enum:Mu,literal:Vu,nan:Fu,template_literal:Uu,file:Bu,success:Ju,custom:Ku,function:qu,transform:Wu,map:Hu,set:Gu,array:Yu,object:Xu,union:Qo,intersection:Qu,tuple:el,record:tl,nullable:nl,nonoptional:rl,default:il,prefault:sl,catch:al,pipe:cl,readonly:ul,promise:ll,optional:ei,lazy:fl};function ti(e,t){if("_idmap"in e){let r=e,o=Xe({...t,processors:Xo}),i={};for(let c of r._idmap.entries()){let[u,l]=c;D(l,o)}let s={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[u,l]=c;Qe(o,l),G(s,u,et(o,l))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let n=Xe({...t,processors:Xo});return D(e,n),Qe(n,e),et(n,e)}var ni=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Xe({processors:Xo,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return D(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Qe(this.ctx,t);let r=et(this.ctx,t),{"~standard":o,...i}=r;return i}};var rd={};var hn={};Ne(hn,{ZodAny:()=>Nl,ZodArray:()=>Rl,ZodBase64:()=>wi,ZodBase64URL:()=>vi,ZodBigInt:()=>dn,ZodBigIntFormat:()=>zi,ZodBoolean:()=>pn,ZodCIDRv4:()=>_i,ZodCIDRv6:()=>$i,ZodCUID:()=>pi,ZodCUID2:()=>di,ZodCatch:()=>of,ZodCodec:()=>dr,ZodCreditCard:()=>zl,ZodCustom:()=>mr,ZodCustomStringFormat:()=>St,ZodDate:()=>ar,ZodDefault:()=>Xl,ZodDiscriminatedUnion:()=>jl,ZodE164:()=>ki,ZodEmail:()=>ci,ZodEmoji:()=>li,ZodEnum:()=>un,ZodExactOptional:()=>Oi,ZodFile:()=>Wl,ZodFunction:()=>hf,ZodGUID:()=>ui,ZodIBAN:()=>Sl,ZodIPv4:()=>yi,ZodIPv6:()=>bi,ZodISODate:()=>nt,ZodISODateTime:()=>tt,ZodISODuration:()=>ot,ZodISOTime:()=>rt,ZodInstanceOf:()=>bf,ZodIntersection:()=>Ml,ZodJWT:()=>xi,ZodKSUID:()=>gi,ZodLazy:()=>pf,ZodLiteral:()=>ql,ZodMAC:()=>xl,ZodMap:()=>Jl,ZodNaN:()=>af,ZodNanoID:()=>fi,ZodNever:()=>Cl,ZodNonOptional:()=>Ai,ZodNull:()=>El,ZodNullable:()=>Yl,ZodNumber:()=>fn,ZodNumberFormat:()=>It,ZodObject:()=>ur,ZodOptional:()=>fr,ZodPipe:()=>pr,ZodPrefault:()=>ef,ZodPreprocess:()=>cf,ZodPromise:()=>mf,ZodReadonly:()=>uf,ZodRecord:()=>cn,ZodSet:()=>Kl,ZodString:()=>ln,ZodStringFormat:()=>j,ZodSuccess:()=>rf,ZodSymbol:()=>Ol,ZodTemplateLiteral:()=>ff,ZodTransform:()=>Hl,ZodTuple:()=>Fl,ZodType:()=>E,ZodULID:()=>mi,ZodURL:()=>sr,ZodUUID:()=>Ae,ZodUndefined:()=>Al,ZodUnion:()=>lr,ZodUnknown:()=>Tl,ZodVoid:()=>Ll,ZodXID:()=>hi,ZodXor:()=>Dl,_ZodString:()=>ai,_default:()=>Ql,_function:()=>hm,any:()=>Kd,array:()=>cr,base64:()=>Sd,base64url:()=>Id,bigint:()=>Vd,boolean:()=>Pl,catch:()=>sf,check:()=>gm,cidrv4:()=>xd,cidrv6:()=>zd,codec:()=>fm,creditCard:()=>Od,cuid:()=>gd,cuid2:()=>yd,currencyCode:()=>Cd,custom:()=>ym,date:()=>Wd,describe:()=>bm,discriminatedUnion:()=>em,e164:()=>Pd,email:()=>sd,emoji:()=>md,enum:()=>Ii,exactOptional:()=>Gl,file:()=>am,float32:()=>Rd,float64:()=>Dd,function:()=>hm,guid:()=>ad,hash:()=>Ld,hex:()=>Td,hostname:()=>Nd,httpUrl:()=>dd,iban:()=>Ad,instanceof:()=>$m,int:()=>ii,int32:()=>jd,int64:()=>Fd,intersection:()=>Vl,invertCodec:()=>pm,ipv4:()=>wd,ipv6:()=>kd,json:()=>vm,jwt:()=>Ed,keyof:()=>Hd,ksuid:()=>$d,lazy:()=>df,literal:()=>sm,looseObject:()=>Xd,looseRecord:()=>nm,mac:()=>vd,map:()=>rm,meta:()=>_m,nan:()=>lm,nanoid:()=>hd,nativeEnum:()=>im,never:()=>Si,nonoptional:()=>nf,null:()=>Zl,nullable:()=>ir,nullish:()=>cm,number:()=>Il,object:()=>Gd,optional:()=>xt,partialRecord:()=>tm,pipe:()=>si,prefault:()=>tf,preprocess:()=>km,promise:()=>mm,readonly:()=>lf,record:()=>Bl,refine:()=>gf,set:()=>om,strictObject:()=>Yd,string:()=>or,stringFormat:()=>Zd,stringbool:()=>wm,success:()=>um,superRefine:()=>yf,symbol:()=>Bd,templateLiteral:()=>dm,transform:()=>Pi,tuple:()=>Ul,uint32:()=>Md,uint64:()=>Ud,ulid:()=>bd,undefined:()=>Jd,union:()=>mn,unknown:()=>kt,url:()=>pd,uuid:()=>cd,uuidv4:()=>ud,uuidv6:()=>ld,uuidv7:()=>fd,void:()=>qd,xid:()=>_d,xor:()=>Qd});var ri={};Ne(ri,{endsWith:()=>Gt,gt:()=>Pe,gte:()=>me,includes:()=>Wt,length:()=>wt,lowercase:()=>Kt,lt:()=>Ie,lte:()=>de,maxLength:()=>$t,maxSize:()=>Ye,mime:()=>Xt,minLength:()=>Re,minSize:()=>Oe,multipleOf:()=>Ge,negative:()=>Wo,nonnegative:()=>Go,nonpositive:()=>Ho,normalize:()=>Qt,overwrite:()=>ke,positive:()=>qo,properties:()=>Yt,property:()=>Yo,regex:()=>Jt,size:()=>_t,slugify:()=>rn,startsWith:()=>Ht,toLowerCase:()=>tn,toUpperCase:()=>nn,trim:()=>en,uppercase:()=>qt});var od=new WeakSet([Object.prototype,Error.prototype]);function oi(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var id=(e,t)=>{fs.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);od.has(n)||(od.add(n),oi(n,"format",r=>o=>En(r,o)),oi(n,"flatten",r=>o=>An(r,o)),oi(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Zt,2)}),oi(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Zt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Sb=p("ZodError",id),le=p("ZodError",id,void 0,{Parent:Error});var pl=Rt(le),dl=Dt(le),ml=jt(le),hl=Mt(le),gl=Tr(le),yl=Cr(le),bl=Lr(le),_l=Rr(le),$l=Dr(le),wl=jr(le),vl=Mr(le),kl=Vr(le);function Pb(){W.localeError||F($o())}function zt(){W.memoizer||F({memoizer:Hn()})}var E=p("ZodType",(e,t)=>(Pb(),O.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(k.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(gf(e,t))},superRefine(e,t){return this.check(yf(e,t))},overwrite(e){return this.check(ke(e))},optional(){return xt(this)},exactOptional(){return Gl(this)},nullable(){return ir(this)},nullish(){return xt(ir(this))},nonoptional(e){return nf(this,e)},array(){return cr(this)},or(e){return mn([this,e])},and(e){return Vl(this,e)},transform(e){return si(this,Pi(e))},default(e){return Ql(this,e)},prefault(e){return tf(this,e)},catch(e){return sf(this,e)},pipe(e){return si(this,e)},readonly(){return lf(this)},describe(e){let t=this.clone();return Y.add(t,{description:e}),t},meta(...e){if(e.length===0)return Y.get(this);let t=this.clone();return Y.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return k.hide(this,"~standard",{...Xr(this),jsonSchema:{input:on(this,"input"),output:on(this,"output")}})},set"~standard"(e){k.own(this,"~standard",e)},parse:function e(t,n){return pl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await dl(this,t,n,{callee:e})},safeParse(e,t){return ml(this,e,t)},async safeParseAsync(e,t){return hl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){k.own(this,"spa",e)},validate(e,t){return Zn(this,e,t)},validateAsync(e,t){return Nn(this,e,t)},encode:function e(t,n){return gl(this,t,n,{callee:e})},decode:function e(t,n){return yl(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await bl(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await _l(this,t,n,{callee:e})},safeEncode(e,t){return $l(this,e,t)},safeDecode(e,t){return wl(this,e,t)},async safeEncodeAsync(e,t){return vl(this,e,t)},async safeDecodeAsync(e,t){return kl(this,e,t)},toJSONSchema(e){return zu(this,{})(e)},get description(){return Y.get(this)?.description},get _def(){return this._zod.def}}),ai=p("_ZodString",(e,t)=>{ht.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pu(e,n,r,o)},k.derived({format:e=>K(e).format??null,minLength:e=>K(e).minimum??null,maxLength:e=>K(e).maximum??null},{regex(...e){return this.check(Jt(...e))},includes(...e){return this.check(Wt(...e))},startsWith(...e){return this.check(Ht(...e))},endsWith(...e){return this.check(Gt(...e))},min(...e){return this.check(Re(...e))},max(...e){return this.check($t(...e))},length(...e){return this.check(wt(...e))},nonempty(...e){return this.check(Re(1,...e))},lowercase(e){return this.check(Kt(e))},uppercase(e){return this.check(qt(e))},trim(){return this.check(en())},normalize(...e){return this.check(Qt(...e))},toLowerCase(){return this.check(tn())},toUpperCase(){return this.check(nn())},slugify(){return this.check(rn())}})),ln=p("ZodString",(e,t)=>{ht.init(e,t),ai.init(e,t)},{email(e){return this.check(So(ci,e))},url(e){return this.check(Yn(sr,e))},jwt(e){return this.check(Ko(xi,e))},emoji(e){return this.check(Zo(li,e))},guid(e){return this.check(Io(ui,e))},uuid(e){return this.check(Po(Ae,e))},uuidv4(e){return this.check(Oo(Ae,e))},uuidv6(e){return this.check(Ao(Ae,e))},uuidv7(e){return this.check(Eo(Ae,e))},nanoid(e){return this.check(No(fi,e))},cuid(e){return this.check(To(pi,e))},cuid2(e){return this.check(Co(di,e))},ulid(e){return this.check(Lo(mi,e))},base64(e){return this.check(Uo(wi,e))},base64url(e){return this.check(Bo(vi,e))},xid(e){return this.check(Ro(hi,e))},ksuid(e){return this.check(Do(gi,e))},ipv4(e){return this.check(jo(yi,e))},ipv6(e){return this.check(Mo(bi,e))},cidrv4(e){return this.check(Vo(_i,e))},cidrv6(e){return this.check(Fo($i,e))},e164(e){return this.check(Jo(ki,e))},datetime(e){return this.check(Xn(tt,e))},date(e){return this.check(Qn(nt,e))},time(e){return this.check(er(rt,e))},duration(e){return this.check(tr(ot,e))}});function or(e){return Vc(ln,e)}var j=p("ZodStringFormat",(e,t)=>{R.init(e,t),ai.init(e,t)}),tt=p("ZodISODateTime",(e,t)=>{Ea.init(e,t),j.init(e,t)}),nt=p("ZodISODate",(e,t)=>{Za.init(e,t),j.init(e,t)}),rt=p("ZodISOTime",(e,t)=>{Na.init(e,t),j.init(e,t)}),ot=p("ZodISODuration",(e,t)=>{Ta.init(e,t),j.init(e,t)}),ci=p("ZodEmail",(e,t)=>{$a.init(e,t),j.init(e,t)});function sd(e){return So(ci,e)}var ui=p("ZodGUID",(e,t)=>{ba.init(e,t),j.init(e,t)});function ad(e){return Io(ui,e)}var Ae=p("ZodUUID",(e,t)=>{_a.init(e,t),j.init(e,t)});function cd(e){return Po(Ae,e)}function ud(e){return Oo(Ae,e)}function ld(e){return Ao(Ae,e)}function fd(e){return Eo(Ae,e)}var sr=p("ZodURL",(e,t)=>{ka.init(e,t),j.init(e,t)});function pd(e){return Yn(sr,e)}function dd(e){return Yn(sr,{protocol:Tn,hostname:Ts,...k.normalizeParams(e)})}var li=p("ZodEmoji",(e,t)=>{xa.init(e,t),j.init(e,t)});function md(e){return Zo(li,e)}var fi=p("ZodNanoID",(e,t)=>{za.init(e,t),j.init(e,t)});function hd(e){return No(fi,e)}var pi=p("ZodCUID",(e,t)=>{Sa.init(e,t),j.init(e,t)});function gd(e){return To(pi,e)}var di=p("ZodCUID2",(e,t)=>{Ia.init(e,t),j.init(e,t)});function yd(e){return Co(di,e)}var mi=p("ZodULID",(e,t)=>{Pa.init(e,t),j.init(e,t)});function bd(e){return Lo(mi,e)}var hi=p("ZodXID",(e,t)=>{Oa.init(e,t),j.init(e,t)});function _d(e){return Ro(hi,e)}var gi=p("ZodKSUID",(e,t)=>{Aa.init(e,t),j.init(e,t)});function $d(e){return Do(gi,e)}var yi=p("ZodIPv4",(e,t)=>{Ca.init(e,t),j.init(e,t)});function wd(e){return jo(yi,e)}var xl=p("ZodMAC",(e,t)=>{Ra.init(e,t),j.init(e,t)});function vd(e){return Uc(xl,e)}var bi=p("ZodIPv6",(e,t)=>{La.init(e,t),j.init(e,t)});function kd(e){return Mo(bi,e)}var _i=p("ZodCIDRv4",(e,t)=>{Da.init(e,t),j.init(e,t)});function xd(e){return Vo(_i,e)}var $i=p("ZodCIDRv6",(e,t)=>{ja.init(e,t),j.init(e,t)});function zd(e){return Fo($i,e)}var wi=p("ZodBase64",(e,t)=>{Ma.init(e,t),j.init(e,t)});function Sd(e){return Uo(wi,e)}var vi=p("ZodBase64URL",(e,t)=>{Va.init(e,t),j.init(e,t)});function Id(e){return Bo(vi,e)}var ki=p("ZodE164",(e,t)=>{Fa.init(e,t),j.init(e,t)});function Pd(e){return Jo(ki,e)}var zl=p("ZodCreditCard",(e,t)=>{Ua.init(e,t),j.init(e,t)});function Od(e){return Bc(zl,e)}var Sl=p("ZodIBAN",(e,t)=>{Ba.init(e,t),j.init(e,t)});function Ad(e){return Jc(Sl,e)}var xi=p("ZodJWT",(e,t)=>{Ja.init(e,t),j.init(e,t)});function Ed(e){return Ko(xi,e)}var St=p("ZodCustomStringFormat",(e,t)=>{Ka.init(e,t),j.init(e,t)});function Zd(e,t,n={}){return vt(St,e,t,n)}function Nd(e){return vt(St,"hostname",Ns,e)}function Td(e){return vt(St,"hex",Ws,e)}function Cd(e){return vt(St,"currency_code",Ls,e)}function Ld(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,o=_e[r];if(!o)throw new Error(`Unrecognized hash format: ${r}`);return vt(St,r,o,t)}var fn=p("ZodNumber",(e,t)=>{co.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ou(e,n,r,o),e.isFinite=!0},k.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=K(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=K(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:n}=K(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>K(e).format??null},{gt(e,t){return this.check(Pe(e,t))},gte(e,t){return this.check(me(e,t))},min(e,t){return this.check(me(e,t))},lt(e,t){return this.check(Ie(e,t))},lte(e,t){return this.check(de(e,t))},max(e,t){return this.check(de(e,t))},int(e){return this.check(ii(e))},safe(e){return this.check(ii(e))},positive(e){return this.check(Pe(0,e))},nonnegative(e){return this.check(me(0,e))},negative(e){return this.check(Ie(0,e))},nonpositive(e){return this.check(de(0,e))},multipleOf(e,t){return this.check(Ge(e,t))},step(e,t){return this.check(Ge(e,t))},finite(){return this}}));function Il(e){return qc(fn,e)}var It=p("ZodNumberFormat",(e,t)=>{qa.init(e,t),fn.init(e,t)});function ii(e){return Hc(It,e)}function Rd(e){return Gc(It,e)}function Dd(e){return Yc(It,e)}function jd(e){return Xc(It,e)}function Md(e){return Qc(It,e)}var pn=p("ZodBoolean",(e,t)=>{Un.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Au(e,n,r,o)});function Pl(e){return eu(pn,e)}var dn=p("ZodBigInt",(e,t)=>{uo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eu(e,n,r,o)},k.derived({minValue:e=>K(e).minimum??null,maxValue:e=>K(e).maximum??null,format:e=>K(e).format??null},{gte(e,t){return this.check(me(e,t))},min(e,t){return this.check(me(e,t))},gt(e,t){return this.check(Pe(e,t))},lt(e,t){return this.check(Ie(e,t))},lte(e,t){return this.check(de(e,t))},max(e,t){return this.check(de(e,t))},positive(e){return this.check(Pe(BigInt(0),e))},negative(e){return this.check(Ie(BigInt(0),e))},nonpositive(e){return this.check(de(BigInt(0),e))},nonnegative(e){return this.check(me(BigInt(0),e))},multipleOf(e,t){return this.check(Ge(e,t))}}));function Vd(e){return nu(dn,e)}var zi=p("ZodBigIntFormat",(e,t)=>{Wa.init(e,t),dn.init(e,t)});function Fd(e){return ou(zi,e)}function Ud(e){return iu(zi,e)}var Ol=p("ZodSymbol",(e,t)=>{Ha.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zu(e,n,r,o)});function Bd(e){return su(Ol,e)}var Al=p("ZodUndefined",(e,t)=>{Ga.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tu(e,n,r,o)});function Jd(e){return au(Al,e)}var El=p("ZodNull",(e,t)=>{Ya.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nu(e,n,r,o)});function Zl(e){return cu(El,e)}var Nl=p("ZodAny",(e,t)=>{Xa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ru(e,n,r,o)});function Kd(){return uu(Nl)}var Tl=p("ZodUnknown",(e,t)=>{Qa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Du(e,n,r,o)});function kt(){return lu(Tl)}var Cl=p("ZodNever",(e,t)=>{ec.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lu(e,n,r,o)});function Si(e){return fu(Cl,e)}var Ll=p("ZodVoid",(e,t)=>{tc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cu(e,n,r,o)});function qd(e){return pu(Ll,e)}var ar=p("ZodDate",(e,t)=>{nc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ju(e,n,r,o),e.min=(n,r)=>e.check(me(n,r)),e.max=(n,r)=>e.check(de(n,r))},k.derived({minDate:e=>{let{minimum:t}=K(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=K(e);return t?new Date(t):null}},{}));function Wd(e){return du(ar,e)}var Rl=p("ZodArray",(e,t)=>{zt(),oc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yu(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Re(e,t))},nonempty(e){return this.check(Re(1,e))},max(e,t){return this.check($t(e,t))},length(e,t){return this.check(wt(e,t))},unwrap(){return this.element}});function cr(e,t){return gu(Rl,e,t)}function Hd(e){let t=e._zod.def.shape;return Ii(Object.keys(t))}var ur=p("ZodObject",(e,t)=>{zt(),ic.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xu(e,n,r,o),k.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Ii(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(k.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(k.mergeDefs(this._zod.def,{catchall:kt()}))},loose(){return this.clone(k.mergeDefs(this._zod.def,{catchall:kt()}))},strict(){return this.clone(k.mergeDefs(this._zod.def,{catchall:Si()}))},strip(){return this.clone(k.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return k.extend(this,e)},safeExtend(e){return k.safeExtend(this,e)},merge(e){return k.merge(this,e)},pick(e){return k.pick(this,e)},omit(e){return k.omit(this,e)},partial(...e){return k.partial(fr,this,e[0])},exactPartial(...e){return k.partial(Oi,this,e[0],"exactPartial")},required(...e){return k.required(Ai,this,e[0])}});function Gd(e,t){let n={type:"object",shape:e??{},...k.normalizeParams(t)};return new ur(n)}function Yd(e,t){return new ur({type:"object",shape:e,catchall:Si(),...k.normalizeParams(t)})}function Xd(e,t){return new ur({type:"object",shape:e,catchall:kt(),...k.normalizeParams(t)})}var lr=p("ZodUnion",(e,t)=>{Bn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qo(e,n,r,o),e.options=t.options});function mn(e,t){return new lr({type:"union",options:e,...k.normalizeParams(t)})}var Dl=p("ZodXor",(e,t)=>{lr.init(e,t),sc.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qo(e,n,r,o),e.options=t.options});function Qd(e,t){return new Dl({type:"union",options:e,inclusive:!1,...k.normalizeParams(t)})}var jl=p("ZodDiscriminatedUnion",(e,t)=>{lr.init(e,t),cc.init(e,t)});function em(e,t,n){return new jl({type:"union",options:t,discriminator:e,...k.normalizeParams(n)})}var Ml=p("ZodIntersection",(e,t)=>{uc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qu(e,n,r,o)});function Vl(e,t){return new Ml({type:"intersection",left:e,right:t})}var Fl=p("ZodTuple",(e,t)=>{zt(),lo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>el(e,n,r,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new fr({type:"optional",innerType:t}))})}});function Ul(e,t,n){let r=t instanceof O,o=r?n:t,i=r?t:null;return new Fl({type:"tuple",items:e,rest:i,...k.normalizeParams(o)})}var cn=p("ZodRecord",(e,t)=>{zt(),lc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tl(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Bl(e,t,n){return!t||!t._zod?new cn({type:"record",keyType:or(),valueType:e,...k.normalizeParams(t)}):new cn({type:"record",keyType:e,valueType:t,...k.normalizeParams(n)})}function tm(e,t,n){return new cn({type:"record",keyType:e,valueType:t,...k.normalizeParams(n),partial:!0})}function nm(e,t,n){return new cn({type:"record",keyType:e,valueType:t,mode:"loose",...k.normalizeParams(n)})}var Jl=p("ZodMap",(e,t)=>{zt(),fc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hu(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Oe(...n)),e.nonempty=n=>e.check(Oe(1,n)),e.max=(...n)=>e.check(Ye(...n)),e.size=(...n)=>e.check(_t(...n))});function rm(e,t,n){return new Jl({type:"map",keyType:e,valueType:t,...k.normalizeParams(n)})}var Kl=p("ZodSet",(e,t)=>{zt(),pc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gu(e,n,r,o),e.min=(...n)=>e.check(Oe(...n)),e.nonempty=n=>e.check(Oe(1,n)),e.max=(...n)=>e.check(Ye(...n)),e.size=(...n)=>e.check(_t(...n))});function om(e,t){return new Kl({type:"set",valueType:e,...k.normalizeParams(t)})}var un=p("ZodEnum",(e,t)=>{dc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Mu(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new un({...t,checks:[],...k.normalizeParams(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new un({...t,checks:[],...k.normalizeParams(o),entries:i})}});function Ii(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new un({type:"enum",entries:n,...k.normalizeParams(t)})}function im(e,t){return new un({type:"enum",entries:e,...k.normalizeParams(t)})}var ql=p("ZodLiteral",(e,t)=>{mc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vu(e,n,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function sm(e,t){return new ql({type:"literal",values:Array.isArray(e)?e:[e],...k.normalizeParams(t)})}var Wl=p("ZodFile",(e,t)=>{hc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bu(e,n,r,o),e.min=(n,r)=>e.check(Oe(n,r)),e.max=(n,r)=>e.check(Ye(n,r)),e.mime=(n,r)=>e.check(Xt(Array.isArray(n)?n:[n],r))});function am(e){return yu(Wl,e)}var Hl=p("ZodTransform",(e,t)=>{zt(),gc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wu(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new We(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(k.issue(i,n.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(k.issue(s))}};let o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Pi(e){return new Hl({type:"transform",transform:e})}var fr=p("ZodOptional",(e,t)=>{fo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ei(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function xt(e){return new fr({type:"optional",innerType:e})}var Oi=p("ZodExactOptional",(e,t)=>{yc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ei(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gl(e){return new Oi({type:"optional",innerType:e})}var Yl=p("ZodNullable",(e,t)=>{bc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ir(e){return new Yl({type:"nullable",innerType:e})}function cm(e){return xt(ir(e))}var Xl=p("ZodDefault",(e,t)=>{_c.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>il(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ql(e,t){return new Xl({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var ef=p("ZodPrefault",(e,t)=>{$c.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function tf(e,t){return new ef({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var Ai=p("ZodNonOptional",(e,t)=>{wc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function nf(e,t){return new Ai({type:"nonoptional",innerType:e,...k.normalizeParams(t)})}var rf=p("ZodSuccess",(e,t)=>{vc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ju(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function um(e){return new rf({type:"success",innerType:e})}var of=p("ZodCatch",(e,t)=>{kc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>al(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function sf(e,t){return new of({type:"catch",innerType:e,catchValue:typeof t=="function"?t:k.constantCatch(t)})}var af=p("ZodNaN",(e,t)=>{xc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fu(e,n,r,o)});function lm(e){return hu(af,e)}var pr=p("ZodPipe",(e,t)=>{po.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cl(e,n,r,o),e.in=t.in,e.out=t.out});function si(e,t){return new pr({type:"pipe",in:e,out:t})}var dr=p("ZodCodec",(e,t)=>{pr.init(e,t),Jn.init(e,t)});function fm(e,t,n){return new dr({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function pm(e){let t=e._zod.def;return new dr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var cf=p("ZodPreprocess",(e,t)=>{pr.init(e,t),zc.init(e,t)}),uf=p("ZodReadonly",(e,t)=>{Sc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ul(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lf(e){return new uf({type:"readonly",innerType:e})}var ff=p("ZodTemplateLiteral",(e,t)=>{Ic.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uu(e,n,r,o)});function dm(e,t){return new ff({type:"template_literal",parts:e,...k.normalizeParams(t)})}var pf=p("ZodLazy",(e,t)=>{Kn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fl(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function df(e){return new pf({type:"lazy",getter:e})}var mf=p("ZodPromise",(e,t)=>{Oc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ll(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function mm(e){return new mf({type:"promise",innerType:e})}var hf=p("ZodFunction",(e,t)=>{Pc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qu(e,n,r,o)});function hm(e){return new hf({type:"function",input:Array.isArray(e?.input)?Ul(e?.input):e?.input??cr(kt()),output:e?.output??kt()})}var mr=p("ZodCustom",(e,t)=>{Ac.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ku(e,n,r,o)});function gm(e){let t=new M({check:"custom"});return t._zod.check=e,t}function ym(e,t){return bu(mr,e??(()=>!0),t)}function gf(e,t={}){return _u(mr,e,t)}function yf(e,t){return $u(e,t)}var bm=wu,_m=vu,bf=p("ZodInstanceOf",(e,t)=>{mr.init(e,t)},{properties(e,t){return this.check(Yt(e,t))}});function $m(e,t={}){let n=new bf({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...k.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}var wm=(...e)=>ku({Codec:dr,Boolean:pn,String:ln},...e);function vm(e){let t=df(()=>mn([or(e),Il(),Pl(),Zl(),cr(t),Bl(or(),t)]));return t}function km(e,t){return new cf({type:"pipe",in:Pi(e),out:t})}var Ob={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 Ab(e){F({customError:e})}function Eb(){return F().customError}var _f;_f||(_f={});var hr={};Ne(hr,{ZodISODate:()=>nt,ZodISODateTime:()=>tt,ZodISODuration:()=>ot,ZodISOTime:()=>rt,date:()=>Nb,datetime:()=>Zb,duration:()=>Cb,time:()=>Tb});function Zb(e){return Xn(tt,e)}function Nb(e){return Qn(nt,e)}function Tb(e){return er(rt,e)}function Cb(e){return tr(ot,e)}var w={...hn,...ri,iso:hr},Lb=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 Rb(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function xm(e,t){return e.map((n,r)=>r<t?n:n.optional())}function Db(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function jb(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let o=n[1]===void 0?void 0:Db(n[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}function Mb(e,t){return w.transform(r=>r).check(r=>{let o=r.value;if(typeof o!="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties&&r.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&r.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0}),t.keySchema)for(let s of i){let a=t.keySchema.safeParse(s);a.success||r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function $f(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let r=String(e);return`${n[0]}${r.length}:${r}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=$f(s,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let s=$f(e[i],t);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}var Vb=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Fb=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function gr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(gr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>Vb.has(t)?gr(n):!Fb.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(gr))}function zm(e){return e===1?"element":"elements"}function Ub(e,t){return w.transform(r=>r).check(r=>{let o=r.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=$f(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:o,path:[s],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(t.containsSchema.safeParse(c).success&&++a>=s)break;a<i&&r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${zm(i)}; found ${a}`,input:o,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&r.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${zm(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function Sm(e,t){if(e!==!1)return e===void 0||e===!0?w.any():oe(e,t)}var Bb=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Im(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=jb(o,t),s=oe(i,t);return t.refs.set(o,s),t.processing.delete(o),s}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(s=>typeof s=="string"))return w.enum(o);let i=o.map(s=>w.literal(s));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 n=e.type;if(Array.isArray(n)){let o=n.map(i=>{let s={...e,type:i};return Im(s,t)});return o.length===0?w.never():o.length===1?o[0]:w.union(o)}if(!n)return w.any();let r;switch(n){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(Bb)):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))),r=o;break}case"number":case"integer":{let o=n==="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)),r=o;break}case"boolean":{r=w.boolean();break}case"null":{r=w.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?oe(e.additionalProperties,t):void 0;for(let[f,m]of Object.entries(i)){let d=oe(m,t);G(o,f,s.has(f)?d:d.optional())}if(e.patternProperties){let f=e.patternProperties,m=Object.keys(f),d=[];for(let b of m){let $=oe(f[b],t),S=w.string().regex(new RegExp(b));d.push(w.looseRecord(S,$))}let g=[];if(Object.keys(o).length>0&&g.push(w.object(o).passthrough()),g.push(...d),g.length===0)r=w.object({}).passthrough();else if(g.length===1)r=g[0];else{let b=w.intersection(g[0],g[1]);for(let $=2;$<g.length;$++)b=w.intersection(b,g[$]);r=b}if(e.additionalProperties===!1){let b=Object.keys(o),$=m.map(x=>new RegExp(x)),S=r;r=r.check(x=>{if(!ye(x.value))return;let A=[];for(let C of Object.keys(x.value))b.includes(C)||$.some(V=>V.test(C))||A.push(C);A.length&&x.issues.push({code:"unrecognized_keys",keys:A,input:x.value,inst:S})})}}else{let f=w.object(o);e.additionalProperties===!1?r=f.strict():a?r=f.catchall(a):r=f.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,u=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||u!==void 0||l!==void 0){let f;if(c){let m=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;f=oe(m,t)}r=Mb(r,{keySchema:f,minProperties:u,maxProperties:l})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(f=>oe(f,t)),c=xm(a,s),u=Array.isArray(i)?void 0:Sm(i,t),l=w.tuple(c);r=u?l.rest(u):l,typeof e.minItems=="number"&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(w.maxLength(e.maxItems)))}else if(Array.isArray(i)){let s=typeof e.minItems=="number"?e.minItems:0,a=i.map(f=>oe(f,t)),c=xm(a,s),u=Sm(e.additionalItems,t),l=w.tuple(c);r=u?l.rest(u):l,typeof e.minItems=="number"&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(w.maxLength(e.maxItems)))}else if(i!==void 0){let s=oe(i,t),a=w.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),r=a}else r=w.array(w.any());(e.uniqueItems===!0||e.contains!==void 0)&&(r=Ub(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?oe(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${n}`)}return r}function oe(e,t){if(typeof e=="boolean")return e?w.any():w.never();let n=Im(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>oe(u,t)),c=w.union(a);n=r?w.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>oe(u,t)),c=w.xor(a);n=r?w.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:w.any();else{let a=r?n:oe(e.allOf[0],t),c=r?0:1;for(let u=c;u<e.allOf.length;u++)a=w.intersection(a,oe(e.allOf[u],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=w.nullable(n)),e.readOnly===!0&&(n=w.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in e&&(o[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(o[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!gr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(o[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!gr(e.contains)&&(o.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(o[a]=e[a])}for(let a of Object.keys(e))Lb.has(a)||G(o,a,e[a]);return Object.keys(o).length>0&&t.registry.add(n,o),e.description&&(n=n.describe(e.description)),n}function Pm(e,t){if(typeof e=="boolean")return e?w.any():w.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=Rb(n,t?.defaultTarget),o=n.$defs||n.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??Y};return oe(n,i)}var Om=Symbol("z.visit/resolving");function yr(e,t){let n=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},r=new Map;function o(s){let a=r.get(s);if(a===Om)return new Kn({type:"lazy",getter:()=>r.get(s)});if(a!==void 0)return a;r.set(s,Om);let c=i(s),u=n(c,c!==s);return r.set(s,u),u}function i(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let u=a.shape,l=Object.keys(u),f=!1,m={};for(let g of l){let b=o(u[g]);b!==u[g]&&(f=!0),m[g]=b}let d=a.catchall;return a.catchall&&(d=o(a.catchall),d!==a.catchall&&(f=!0)),f?L(s,{...a,shape:m,catchall:d}):s}case"array":{let u=o(a.element);return u===a.element?s:L(s,{...a,element:u})}case"tuple":{let u=a.items,l=!1,f=[];for(let d of u){let g=o(d);g!==d&&(l=!0),f.push(g)}let m=a.rest;return a.rest&&(m=o(a.rest),m!==a.rest&&(l=!0)),l?L(s,{...a,items:f,rest:m}):s}case"record":case"map":{let u=o(a.keyType),l=o(a.valueType);return u===a.keyType&&l===a.valueType?s:L(s,{...a,keyType:u,valueType:l})}case"set":{let u=o(a.valueType);return u===a.valueType?s:L(s,{...a,valueType:u})}case"union":{let u=a.options,l=!1,f=[];for(let m of u){let d=o(m);d!==m&&(l=!0),f.push(d)}return l?L(s,{...a,options:f}):s}case"intersection":{let u=o(a.left),l=o(a.right);return u===a.left&&l===a.right?s:L(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=o(a.innerType);return u===a.innerType?s:L(s,{...a,innerType:u})}case"pipe":{let u=o(a.in),l=o(a.out);return u===a.in&&l===a.out?s:L(s,{...a,in:u,out:l})}case"function":{let u=o(a.input),l=o(a.output);return u===a.input&&l===a.output?s:L(s,{...a,input:u,output:l})}case"lazy":{let u=a.getter,{_cachedInner:l,...f}=a;return L(s,{...f,getter:()=>o(u())})}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 s;default:return s}}return o(e)}function Am(e){return yr(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:mn(n.options)}})}function Jb(e,t){if(!t?.length)return e;let n=e._zod.def;return L(e,we(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function Em(e){return Jb(e.out,e.checks)}function Kb(e){return e.in._zod.traits.has("$ZodTransform")?Em(e):e.in}function Zm(e){return yr(e,{pipe:t=>Kb(t._zod.def),default:(t,n)=>n?xt(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function Nm(e){return yr(e,{pipe:t=>Em(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var wf={};Ne(wf,{bigint:()=>Gb,boolean:()=>Hb,date:()=>Yb,number:()=>Wb,string:()=>qb});function qb(e){return Fc(ln,e)}function Wb(e){return Wc(fn,e)}function Hb(e){return tu(pn,e)}function Gb(e){return ru(dn,e)}function Yb(e){return mu(ar,e)}F({jitless:!0});var kf=1,Tm=1,Xb="austere-sync.1",Ot={frameBytes:65536,noteItemsBytes:4096,nameChars:40},Qb=["upgrade_required","forbidden","rate_limited","too_large","invalid"];var e_=["publish","addNote","releaseNote","discardNote","addReply","grant","revoke","delete"];var t_=/^[A-Za-z_$][\w$]{0,99}$/,n_=/^[0-9a-f]{64}$/,r_=/^[A-Za-z0-9_-]{43}$/,o_=/^[A-Za-z0-9_-]{8,64}$/,i_=/^[A-Za-z0-9_-]{16,256}$/,Mm=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,s_=/^#[0-9a-f]{6}$/,a_=/^[A-Za-z0-9_-]{16}$/,xf=y.int().positive(),Vm=y.int().nonnegative(),Pt=y.int().nonnegative(),Cm=y.string().min(1).max(Ot.nameChars),Fm=y.string().regex(n_),vf=y.string().regex(t_).nullable(),Ti=y.enum(["viewing","away","writing"]),c_=y.enum(["owner","reviewer"]),Lm={code:y.enum(Qb),message:y.string(),retryAfter:y.int().nonnegative().optional()},Um=y.discriminatedUnion("kind",[y.looseObject({kind:y.literal("message"),text:y.string()}),y.looseObject({kind:y.literal("annotation"),target:y.string().optional(),component:y.string().optional(),path:y.array(y.string()).optional(),selection:y.string().optional(),excerpt:y.string().optional(),note:y.string().optional(),detail:y.looseObject({part:y.string().optional(),row:y.string().optional(),column:y.string().optional(),rowIndex:y.int().optional()}).optional()})]),Bm=y.looseObject({sha256:Fm,name:y.string().min(1),version:y.string().min(1)}),lw={publish:y.looseObject({title:y.string(),cliVersion:y.string().regex(Mm),html:Fm,packs:y.array(Bm),auto:y.boolean(),unlisted:y.boolean(),presence:y.boolean()}),addNote:y.looseObject({items:y.array(Um).min(1),name:y.string().optional()}),releaseNote:y.looseObject({note:y.string().min(1)}),discardNote:y.looseObject({note:y.string().min(1)}),addReply:y.looseObject({text:y.string().min(1)}),grant:y.looseObject({name:Cm,tokenHash:y.string().regex(r_),expiresAt:Pt.nullable()}),revoke:y.looseObject({name:Cm}),delete:y.looseObject({})},u_=y.looseObject({clientId:y.string().regex(o_),n:xf}),fw=u_.extend({v:y.int(),t:y.literal("mutation"),name:y.enum(e_),args:y.unknown()}),br={v:y.int(),id:y.string().min(1),seq:xf},l_=y.looseObject({...br,type:y.string()}),Rm={page:y.looseObject({...br,type:y.literal("page"),title:y.string(),cliVersion:y.string().regex(Mm),html:y.string(),packs:y.array(Bm),auto:y.boolean(),unlisted:y.boolean(),presence:y.boolean(),publishedAt:Pt,expiresAt:Pt,deleted:y.boolean()}),note:y.looseObject({...br,type:y.literal("note"),author:y.string(),items:y.array(Um),at:Pt,state:y.enum(["held","released","discarded"])}),reply:y.looseObject({...br,type:y.literal("reply"),text:y.string(),at:Pt}),acl:y.looseObject({...br,type:y.literal("acl"),name:y.string(),grantedAt:Pt,expiresAt:Pt.nullable(),revoked:y.boolean(),grant:y.string().regex(a_).optional()})},pw={pull:y.looseObject({v:y.int(),t:y.literal("pull"),after:Vm}),hello:y.looseObject({v:y.int(),t:y.literal("hello"),status:Ti,name:y.string().optional()}),status:y.looseObject({v:y.int(),t:y.literal("status"),status:Ti}),focus:y.looseObject({v:y.int(),t:y.literal("focus"),statement:vf}),bye:y.looseObject({v:y.int(),t:y.literal("bye")})},f_=y.looseObject({v:y.int(),t:y.literal("changes"),rows:y.array(y.unknown()),cursor:Vm,more:y.boolean().optional(),reset:y.boolean().optional()}),Ei=y.string().min(1),Dm={ack:y.looseObject({v:y.int(),t:y.literal("ack"),clientId:y.string(),n:xf,error:y.looseObject(Lm).optional()}),error:y.looseObject({v:y.int(),t:y.literal("error"),...Lm}),hello:y.looseObject({v:y.int(),t:y.literal("hello"),viewer:y.looseObject({id:Ei,name:y.string(),colour:y.string().regex(s_),role:c_}),status:Ti,focus:vf,self:y.boolean()}),status:y.looseObject({v:y.int(),t:y.literal("status"),viewer:Ei,status:Ti}),focus:y.looseObject({v:y.int(),t:y.literal("focus"),viewer:Ei,statement:vf}),bye:y.looseObject({v:y.int(),t:y.literal("bye"),viewer:Ei})},Ni=e=>({ok:!0,value:e}),_r=(e,t)=>({ok:!1,error:{code:e,message:t}}),jm=(e,t)=>typeof t=="string"&&Object.hasOwn(e,t);function p_(e){return new TextEncoder().encode(e).length}function Zi(e,t){let n=t.issues[0],r=n&&n.path.length?`${e}.${n.path.join(".")}`:e;return _r("invalid",`${r}: ${n?n.message:"invalid"}`)}function Jm(e,t){if(e.length*3<=t)return;let n=p_(e);return n>t?n:void 0}function d_(e,t){let n;try{n=typeof e=="string"?e:JSON.stringify(e)}catch{}if(n===void 0)return _r("invalid","frame is not JSON");let r=t===null?void 0:Jm(n,t);if(r!==void 0)return _r("too_large",`frame is ${r} bytes; the limit is ${t}`);let o;try{o=JSON.parse(n)}catch{return _r("invalid","frame is not JSON")}if(!o||typeof o!="object"||Array.isArray(o))return _r("invalid","frame is not a JSON object");let i=o,s=Km(i.v,"frame");return s?{ok:!1,error:s}:Ni(i)}function Km(e,t){if(typeof e!="number"||!Number.isInteger(e))return{code:"invalid",message:`${t}.v: expected an integer protocol version`};if(e<Tm)return{code:"upgrade_required",message:`${t} speaks sync v${e}; v${Tm} or later is required`}}function Ci(e){let t=d_(e,null);if(!t.ok)return t;let n=t.value;if(n.t==="changes"){let o=f_.safeParse(n);if(!o.success)return Zi("changes",o.error);let i=[],s=[];for(let[a,c]of o.data.rows.entries()){let u=l_.safeParse(c);if(!u.success)return Zi(`changes.rows.${a}`,u.error);let l=Km(u.data.v,`changes.rows.${a}`);if(l)return{ok:!1,error:l};if(!jm(Rm,u.data.type)){s.push(u.data);continue}let f=Rm[u.data.type].safeParse(c);if(!f.success)return Zi(`changes.rows.${a}`,f.error);i.push(f.data)}return Ni({...o.data,rows:i,skipped:s})}if(!jm(Dm,n.t))return Ni(null);let r=Dm[n.t].safeParse(n);return r.success?Ni(r.data):Zi(n.t,r.error)}function qm(e,t,n){let r={v:kf,t:"mutation",clientId:n.clientId,n:n.n,name:e,args:t},o=Jm(JSON.stringify(r),Ot.frameBytes);if(o!==void 0)throw new RangeError(`${e} is ${o} bytes; a frame may be at most ${Ot.frameBytes}`);return r}var m_="austere-owner.",h_="austere-invite.";function Wm(e){let t=[Xb];for(let[n,r]of[[m_,e.owner],[h_,e.invite]])if(r!==void 0){if(!i_.test(r))throw new Error("sync token must be 16-256 base64url characters");t.push(n+r)}return t}var g_={viewing:"viewing",away:"away",writing:"writing a note"},Li=class{constructor(t){Je(this,"roster",new Map);Je(this,"self",null);Je(this,"send",null);Je(this,"heartbeat");Je(this,"writing",new Set);Je(this,"focus",null);Je(this,"host");this.host=t,document.addEventListener("visibilitychange",()=>this.sendStatus())}status(){return document.visibilityState==="hidden"?"away":this.writing.size?"writing":"viewing"}connect(t){this.send=t,this.hello(),this.focus&&t({v:1,t:"focus",statement:this.focus}),window.clearInterval(this.heartbeat),this.heartbeat=window.setInterval(()=>this.send?.({v:1,t:"status",status:this.status()}),25e3)}disconnect(){this.send=null,window.clearInterval(this.heartbeat),this.self=null,this.roster.clear(),this.render()}rename(){this.send&&this.hello()}leave(){this.send?.({v:1,t:"bye"})}hello(){let t=this.host.name();this.send?.(t?{v:1,t:"hello",status:this.status(),name:t}:{v:1,t:"hello",status:this.status()})}handle(t){if(t.t==="hello")this.roster.set(t.viewer.id,{viewer:t.viewer,status:t.status,focus:t.focus}),t.self&&(this.self=t.viewer.id);else if(t.t==="bye")this.roster.delete(t.viewer),t.viewer===this.self&&(this.self=null);else{let n=this.roster.get(t.viewer);if(!n)return;t.t==="status"?n.status=t.status:n.focus=t.statement}this.render()}setFocus(t){t!==this.focus&&(this.focus=t,this.send?.({v:1,t:"focus",statement:t}))}setWriting(t,n){let r=this.status();n?this.writing.add(t):this.writing.delete(t),this.status()!==r&&this.sendStatus()}redraw(){this.host.showFocus(this.marks())}sendStatus(){this.send?.({v:1,t:"status",status:this.status()})}others(){return[...this.roster.values()].filter(t=>t.viewer.id!==this.self)}marks(){return this.others().flatMap(t=>t.focus?[{statement:t.focus,name:t.viewer.name,colour:t.viewer.colour}]:[])}selfChip(t){let n=document.createElement("span");n.dataset.viewer=t.viewer.id,n.className="viewer self",n.style.setProperty("--viewer",t.viewer.colour),n.textContent=[...t.viewer.name][0]?.toUpperCase()??"?";let r=`You \xB7 ${t.viewer.name}`;return n.title=r,n.setAttribute("role","img"),n.setAttribute("aria-label",r),n}render(){let t=document.activeElement,n=t instanceof HTMLElement&&this.host.chips.contains(t)?t.dataset.viewer:void 0,r=this.others().map(i=>{let s=document.createElement("button");s.dataset.viewer=i.viewer.id,s.type="button",s.className=`viewer ${i.status}`,s.style.setProperty("--viewer",i.viewer.colour),s.textContent=[...i.viewer.name][0]?.toUpperCase()??"?";let a=`${i.viewer.name} \xB7 ${g_[i.status]}${i.focus?" \xB7 click to see where":""}`;return s.title=a,s.setAttribute("aria-label",a),s.disabled=!i.focus,s.addEventListener("click",()=>i.focus&&this.host.reveal(i.focus)),s}),o=this.self?this.roster.get(this.self):void 0;this.host.chips.replaceChildren(...o?[this.selfChip(o)]:[],...r),r.find(i=>i.dataset.viewer===n)?.focus(),this.host.chips.hidden=!o&&!r.length,this.redraw()}};var Hm=1e3,y_=3e4;function Gm(e){let t=[],n=[],r=[],o=null,i=!1,s=Hm,a;function c(){if(a=void 0,i)return;let u=!1,l=null,f=new WebSocket(e.url,e.protocols());o=f,f.addEventListener("open",()=>{u=!0;for(let m of t)m()}),f.addEventListener("message",m=>{let d=Ci(m.data);if(!d.ok){console.warn(`austere: skipped a sync frame: ${d.error.message}`);return}if(d.value){s=Hm,d.value.t==="error"&&(l=d.value);for(let g of n)g(d.value)}}),f.addEventListener("close",async m=>{o===f&&(o=null);let d={code:m.code,opened:u,error:l},g=m.code===1e3||m.code===1008||l?.code==="forbidden"||l?.code==="upgrade_required",b=!i&&!g;b&&e.mayRetry&&(b=await e.mayRetry(d)&&!i),b&&(a=setTimeout(c,s),s=Math.min(s*2,y_));for(let $ of r)$(d,b)})}return c(),{get connected(){return o?.readyState===WebSocket.OPEN},send(u){return o?.readyState!==WebSocket.OPEN?!1:(o.send(JSON.stringify(u)),!0)},onOpen:u=>{t.push(u)},onFrame:u=>{n.push(u)},onClose:u=>{r.push(u)},stop(){i=!0,clearTimeout(a),o?.close(1e3),o=null}}}var $e=window.__AUSTERE__??JSON.parse(document.getElementById("austere-boot")?.textContent||"{}"),ze=$e.id,H=$e.hosted||null,ie=$e.hosted?.base??`/s/${ze}`,Cf=$e.viewer||{role:"owner",name:""},fe=!H&&Cf.role==="owner",vr=Ot.nameChars,Be={get(e,t){try{let n=localStorage.getItem(e);return n==null?t:JSON.parse(n)}catch{return t}},set(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}},remove(e){try{localStorage.removeItem(e)}catch{}}},Ee={get(e){try{return JSON.parse(sessionStorage.getItem(e)||"null")}catch{return null}},set(e,t){try{return sessionStorage.setItem(e,JSON.stringify(t)),!0}catch{return!1}}},Pf=`austere:invite:${ze}`,Ym=/^[A-Za-z0-9_-]{16,256}$/,Se=null;if(H){let e=new URLSearchParams(location.hash.slice(1)).get("i");if(e!==null&&history.replaceState(null,"",location.pathname+location.search),e!==null&&Ym.test(e))Se=e,Be.set(Pf,e);else{let t=Be.get(Pf,null);Se=typeof t=="string"&&Ym.test(t)?t:null}window.addEventListener("hashchange",()=>{new URLSearchParams(location.hash.slice(1)).has("i")&&location.reload()})}var Ve,ge=H?"":Cf.name,rh="";if(H){let e=crypto.getRandomValues(new Uint8Array(16));rh=btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var ji=`austere:outbox:${ze}`,Xm=Ee.get(ji),xe=Array.isArray(Xm)?Xm.filter(e=>e?.m?.name==="addNote"&&typeof e.as=="string"&&typeof e.m.clientId=="string"&&/^[A-Za-z0-9_-]{8,64}$/.test(e.m.clientId)&&Number.isInteger(e.m.n)&&e.m.n>0&&(e.retryAt===void 0||typeof e.retryAt=="number")):[];function Lf(){return Ve?`invite:${Ve}`:"open"}function oh(){let e=Lf();return xe.filter(t=>t.as===e)}var b_=0,$r=!1,Of=null,zf=new Map,wr=null,at=null,h={mode:Be.get("austere:mode","annotate"),queue:Be.get(`austere:queue:${ze}`,[]),transcript:[],presence:"idle",status:"open",endedBy:null,closed:!1,unread:0,more:!1,program:null,revision:0,errorsRevision:0,renderReport:null,thirdParty:!1,frameReady:!1,scrollY:0,parserErrors:[],runtimeErrors:[],changes:[],highlight:!1,sheetOpen:Ee.get(`austere:sheet:${ze}`)===!0,sending:!1,connected:!1,editing:null,links:null},I=(e,t=document)=>t.querySelector(e);function v(e,t={},...n){let r=document.createElement(e);for(let[o,i]of Object.entries(t))i==null||i===!1||(o==="class"?r.className=String(i):o.startsWith("on")?typeof i=="function"&&r.addEventListener(o.slice(2),i):o==="text"?r.textContent=String(i):o==="html"?r.innerHTML=String(i):r.setAttribute(o,i===!0?"":String(i)));for(let o of n.flat())o!=null&&o!==!1&&r.append(o instanceof Node?o:document.createTextNode(String(o)));return r}document.body.innerHTML=`
62
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}a.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Wp(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!="object")return;Wp(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Gp=new Set(["type","properties","required","additionalProperties"]),qp=["oneOf","anyOf"];function Hp(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function xu(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!Gp.has(s))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??Hp(u);l!=null&&(a.some(f=>JSON.stringify(f)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:xu(a)??{allOf:a};G(n,s,c)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=Hp(s);a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function Ob(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Gp)if(o in e)return;let n=t.filter(o=>qp.some(i=>Array.isArray(o[i]))),r=null;if(!n.length)r=xu(t);else{let o=n[0],i=qp.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter(c=>c!==o),a=o[i].map(c=>xu([...s,c]));if(a.some(c=>!c))return;r={[i]:a}}r&&(delete e.allOf,rr(e,r))}function et(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},f=c.ref;if(c.ref=null,f){r(f);let m=e.seen.get(f),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):rr(u,g),rr(u,l),a._zod.parent===f)for(let $ in u)$==="$ref"||$==="allOf"||$ in l||delete u[$];if(g.$ref&&m.def)for(let $ in u)$==="$ref"||$==="allOf"||$ in m.def&&JSON.stringify(u[$])===JSON.stringify(m.def[$])&&delete u[$]}let d=a._zod.parent;if(d&&d!==f){r(d);let m=e.seen.get(d);if(m?.schema.$ref&&(u.$ref=m.schema.$ref,m.def))for(let g in u)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(u[g])===JSON.stringify(m.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Wp(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=a.get(l);f?f.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])Ob(u)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}rr(o,n.defId?n.schema:n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,G(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:on(t,"input",e.processors),output:on(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function oe(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return oe(r.element,n);if(r.type==="set")return oe(r.valueType,n);if(r.type==="lazy")return oe(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return oe(r.innerType,n);if(r.type==="intersection")return oe(r.left,n)||oe(r.right,n);if(r.type==="record"||r.type==="map")return oe(r.keyType,n)||oe(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:oe(r.in,n)||oe(r.out,n);if(r.type==="object"){for(let o in r.shape)if(oe(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(oe(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(oe(o,n))return!0;return!!(r.rest&&oe(r.rest,n))}return!1}var zu=(e,t={})=>n=>{let r=Xe({...n,processors:t});return D(e,r),Qe(r,e),et(r,e)},on=(e,t,n={})=>r=>{let{libraryOptions:o,target:i}=r??{},s=Xe({...o??{},target:i,io:t,processors:n});return D(e,s),Qe(s,e),et(s,e)};var sn=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},an=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Yp=(e,t)=>{sn(e,"minimum",t),an(e,"maximum",t)},td=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},nd=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},rd=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},od=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Xp=(e,t)=>sn(e,"minimum",t.minimum),Qp=(e,t)=>an(e,"maximum",t.maximum),ed=e=>(t,n)=>{od(t,n.format);let[r,o]=e[n.format];sn(t,"minimum",r),an(t,"maximum",o)},Ab={greater_than:(e,t)=>sn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>an(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>td(e,t.value),number_format:ed(zn),bigint_format:ed(Sn),min_length:Xp,max_length:Qp,length_equals:(e,t)=>Yp(e,t.length),min_size:Xp,max_size:Qp,size_equals:(e,t)=>Yp(e,t.size),string_format:(e,t)=>{od(e,t.format),t.pattern&&nd(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>rd(e,t.mime)};function q(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)Ab[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&sn(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&sn(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&an(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&an(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&td(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&rd(t,o.mime);for(let i of o.patterns??[])nd(t,i);return t}var Eb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Nb=new Map([[io,Es],[Un,Ns]]),id=e=>Nb.get(e)??e,Pu=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=q(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=Eb[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let f=[...c].map(id);f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Ou=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=q(e);o.type=l?"integer":"number";let f=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),d=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f?m?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),d?m?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),a){let g=new Set;for(let I of a)Number.isFinite(I)&&I!==0?g.add(Math.abs(I)):K(e,t,o,r,`A multipleOf divisor of ${I} cannot be represented in JSON Schema`);let[b,...$]=g;b!==void 0&&(o.multipleOf=b),$.length&&(o.allOf=[...o.allOf??[],...$.map(I=>({multipleOf:I}))])}},Au=(e,t,n,r)=>{n.type="boolean"},Eu=(e,t,n,r)=>{K(e,t,n,r,"BigInt cannot be represented in JSON Schema")},Nu=(e,t,n,r)=>{K(e,t,n,r,"Symbols cannot be represented in JSON Schema")},Zu=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Tu=(e,t,n,r)=>{K(e,t,n,r,"Undefined cannot be represented in JSON Schema")},Cu=(e,t,n,r)=>{K(e,t,n,r,"Void cannot be represented in JSON Schema")},Lu=(e,t,n,r)=>{n.not={}},Ru=(e,t,n,r)=>{},Du=(e,t,n,r)=>{},ju=(e,t,n,r)=>{K(e,t,n,r,"Date cannot be represented in JSON Schema")},Mu=(e,t,n,r)=>{let o=e._zod.def,i=Et(o.entries);if(i.length===0){n.not={};return}i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},Vu=(e,t,n,r)=>{let o=e._zod.def;if(o.values.length===0){n.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(K(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(K(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},Fu=(e,t,n,r)=>{K(e,t,n,r,"NaN cannot be represented in JSON Schema")},Uu=(e,t,n,r)=>{let o=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Bu=(e,t,n,r)=>{let o=n;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=q(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(c=>({contentMediaType:c})))},Ju=(e,t,n,r)=>{n.type="boolean"},Ku=(e,t,n,r)=>{K(e,t,n,r,"Custom types cannot be represented in JSON Schema")},qu=(e,t,n,r)=>{K(e,t,n,r,"Function types cannot be represented in JSON Schema")},Hu=(e,t,n,r)=>{K(e,t,n,r,"Transforms cannot be represented in JSON Schema")},Wu=(e,t,n,r)=>{K(e,t,n,r,"Map cannot be represented in JSON Schema")},Gu=(e,t,n,r)=>{K(e,t,n,r,"Set cannot be represented in JSON Schema")},Yu=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:a}=q(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=D(i.element,t,{...r,path:[...r.path,"items"]})};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}var Xu=(e,t,n,r)=>{let o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&K(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)G(o.properties,u,D(s[u],t,{...r,path:[...r.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?or(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=D(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},ti=(e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>D(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=s:n.anyOf=s},Qu=(e,t,n,r)=>{let o=e._zod.def,i=D(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=D(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},el=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((b,$)=>D(b,t,{...r,path:[...r.path,s,$]})),u=i.rest?D(i.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let b=i.items[l-1];if(!(t.io==="input"?or(b)!==void 0:b._zod.optout==="optional"))break;l--}let f=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,d?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),d&&(o.maxItems=f)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),d&&(o.maxItems=f)):(o.items=c,d?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),d&&(o.maxItems=f));let{minimum:m,maximum:g}=q(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)};function Su(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let g=e.get(t)?.def;if(!g)return t;let b=Su(e,g,n);return b===g?t:b}for(let g of["anyOf","oneOf"]){let b=t[g];if(!Array.isArray(b))continue;let $=b.map(I=>Su(e,I,n));$.some((I,x)=>I!==b[x])&&(t={...t,[g]:$})}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(g=>typeof g=="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:f,id:d,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(r.includes("number")?Re:Ln).source)),m}var Iu=new WeakMap;function Zb(e){let t=new Map;for(let r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);let n=new Map;for(let r of Iu.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Su(t,i,new Set);s!==i&&n.set(i,s)}if(n.size)for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);i&&(o.propertyNames=i)}}var tl=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let s=i.keyType,a=q(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=D(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let f of a)G(o.patternProperties,id(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=Iu.get(t);l||(l=[],Iu.set(t,l),t.deferred.push(()=>Zb(t))),l.push(e)}o.additionalProperties=D(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&or(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(f=>typeof f=="string"||typeof f=="number");l.length>0&&(o.required=l.map(String))}},nl=(e,t,n,r)=>{let o=e._zod.def,i=D(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},rl=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},ol=Symbol();function sd(e,t,n,r,o){let i=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(K(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),ol):JSON.parse(s)}var il=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s=sd(o.defaultValue,e,t,n,r);s!==ol&&(n.default=s)},sl=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=sd(o.defaultValue,e,t,n,r);s!==ol&&(n._prefault=s)},al=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{K(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},cl=(e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;D(s,t,r);let a=t.seen.get(e);a.ref=s},ul=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ll=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},ni=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},fl=(e,t,n,r)=>{let o=e._zod.innerType;D(o,t,r);let i=t.seen.get(e);i.ref=o},ei={string:Pu,number:Ou,boolean:Au,bigint:Eu,symbol:Nu,null:Zu,undefined:Tu,void:Cu,never:Lu,any:Ru,unknown:Du,date:ju,enum:Mu,literal:Vu,nan:Fu,template_literal:Uu,file:Bu,success:Ju,custom:Ku,function:qu,transform:Hu,map:Wu,set:Gu,array:Yu,object:Xu,union:ti,intersection:Qu,tuple:el,record:tl,nullable:nl,nonoptional:rl,default:il,prefault:sl,catch:al,pipe:cl,readonly:ul,promise:ll,optional:ni,lazy:fl};function ri(e,t){if("_idmap"in e){let r=e,o=Xe({...t,processors:ei}),i={};for(let c of r._idmap.entries()){let[u,l]=c;D(l,o)}let s={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[u,l]=c;Qe(o,l),G(s,u,et(o,l))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let n=Xe({...t,processors:ei});return D(e,n),Qe(n,e),et(n,e)}var oi=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Xe({processors:ei,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return D(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Qe(this.ctx,t);let r=et(this.ctx,t),{"~standard":o,...i}=r;return i}};var ad={};var hn={};Te(hn,{ZodAny:()=>Zl,ZodArray:()=>Rl,ZodBase64:()=>ki,ZodBase64URL:()=>xi,ZodBigInt:()=>dn,ZodBigIntFormat:()=>Ii,ZodBoolean:()=>pn,ZodCIDRv4:()=>wi,ZodCIDRv6:()=>vi,ZodCUID:()=>mi,ZodCUID2:()=>hi,ZodCatch:()=>of,ZodCodec:()=>mr,ZodCreditCard:()=>zl,ZodCustom:()=>hr,ZodCustomStringFormat:()=>St,ZodDate:()=>cr,ZodDefault:()=>Xl,ZodDiscriminatedUnion:()=>jl,ZodE164:()=>zi,ZodEmail:()=>li,ZodEmoji:()=>pi,ZodEnum:()=>un,ZodExactOptional:()=>Ei,ZodFile:()=>Hl,ZodFunction:()=>hf,ZodGUID:()=>fi,ZodIBAN:()=>Sl,ZodIPv4:()=>_i,ZodIPv6:()=>$i,ZodISODate:()=>nt,ZodISODateTime:()=>tt,ZodISODuration:()=>ot,ZodISOTime:()=>rt,ZodInstanceOf:()=>bf,ZodIntersection:()=>Ml,ZodJWT:()=>Si,ZodKSUID:()=>bi,ZodLazy:()=>pf,ZodLiteral:()=>ql,ZodMAC:()=>xl,ZodMap:()=>Jl,ZodNaN:()=>af,ZodNanoID:()=>di,ZodNever:()=>Cl,ZodNonOptional:()=>Ni,ZodNull:()=>El,ZodNullable:()=>Yl,ZodNumber:()=>fn,ZodNumberFormat:()=>It,ZodObject:()=>lr,ZodOptional:()=>pr,ZodPipe:()=>dr,ZodPrefault:()=>ef,ZodPreprocess:()=>cf,ZodPromise:()=>mf,ZodReadonly:()=>uf,ZodRecord:()=>cn,ZodSet:()=>Kl,ZodString:()=>ln,ZodStringFormat:()=>j,ZodSuccess:()=>rf,ZodSymbol:()=>Ol,ZodTemplateLiteral:()=>ff,ZodTransform:()=>Wl,ZodTuple:()=>Fl,ZodType:()=>E,ZodULID:()=>gi,ZodURL:()=>ar,ZodUUID:()=>Ee,ZodUndefined:()=>Al,ZodUnion:()=>fr,ZodUnknown:()=>Tl,ZodVoid:()=>Ll,ZodXID:()=>yi,ZodXor:()=>Dl,_ZodString:()=>ui,_default:()=>Ql,_function:()=>_m,any:()=>Gd,array:()=>ur,base64:()=>Ad,base64url:()=>Ed,bigint:()=>Jd,boolean:()=>Pl,catch:()=>sf,check:()=>$m,cidrv4:()=>Pd,cidrv6:()=>Od,codec:()=>hm,creditCard:()=>Zd,cuid:()=>$d,cuid2:()=>wd,currencyCode:()=>jd,custom:()=>wm,date:()=>Xd,describe:()=>vm,discriminatedUnion:()=>om,e164:()=>Nd,email:()=>ld,emoji:()=>bd,enum:()=>Oi,exactOptional:()=>Gl,file:()=>fm,float32:()=>Vd,float64:()=>Fd,function:()=>_m,guid:()=>fd,hash:()=>Md,hex:()=>Dd,hostname:()=>Rd,httpUrl:()=>yd,iban:()=>Td,instanceof:()=>xm,int:()=>ai,int32:()=>Ud,int64:()=>Kd,intersection:()=>Vl,invertCodec:()=>gm,ipv4:()=>zd,ipv6:()=>Id,json:()=>Sm,jwt:()=>Cd,keyof:()=>Qd,ksuid:()=>xd,lazy:()=>df,literal:()=>lm,looseObject:()=>nm,looseRecord:()=>sm,mac:()=>Sd,map:()=>am,meta:()=>km,nan:()=>mm,nanoid:()=>_d,nativeEnum:()=>um,never:()=>Pi,nonoptional:()=>nf,null:()=>Nl,nullable:()=>sr,nullish:()=>pm,number:()=>Il,object:()=>em,optional:()=>xt,partialRecord:()=>im,pipe:()=>ci,prefault:()=>tf,preprocess:()=>Im,promise:()=>bm,readonly:()=>lf,record:()=>Bl,refine:()=>gf,set:()=>cm,strictObject:()=>tm,string:()=>ir,stringFormat:()=>Ld,stringbool:()=>zm,success:()=>dm,superRefine:()=>yf,symbol:()=>Hd,templateLiteral:()=>ym,transform:()=>Ai,tuple:()=>Ul,uint32:()=>Bd,uint64:()=>qd,ulid:()=>vd,undefined:()=>Wd,union:()=>mn,unknown:()=>kt,url:()=>gd,uuid:()=>pd,uuidv4:()=>dd,uuidv6:()=>md,uuidv7:()=>hd,void:()=>Yd,xid:()=>kd,xor:()=>rm});var ii={};Te(ii,{endsWith:()=>Gt,gt:()=>Oe,gte:()=>he,includes:()=>Ht,length:()=>wt,lowercase:()=>Kt,lt:()=>Pe,lte:()=>me,maxLength:()=>$t,maxSize:()=>Ye,mime:()=>Xt,minLength:()=>De,minSize:()=>Ae,multipleOf:()=>Ge,negative:()=>Go,nonnegative:()=>Xo,nonpositive:()=>Yo,normalize:()=>Qt,overwrite:()=>xe,positive:()=>Wo,properties:()=>Yt,property:()=>Qo,regex:()=>Jt,size:()=>_t,slugify:()=>rn,startsWith:()=>Wt,toLowerCase:()=>tn,toUpperCase:()=>nn,trim:()=>en,uppercase:()=>qt});var cd=new WeakSet([Object.prototype,Error.prototype]);function si(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var ud=(e,t)=>{fs.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);cd.has(n)||(cd.add(n),si(n,"format",r=>o=>Nn(r,o)),si(n,"flatten",r=>o=>En(r,o)),si(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Nt,2)}),si(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Nt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Cb=p("ZodError",ud),fe=p("ZodError",ud,void 0,{Parent:Error});var pl=Rt(fe),dl=Dt(fe),ml=jt(fe),hl=Mt(fe),gl=Lr(fe),yl=Rr(fe),bl=Dr(fe),_l=jr(fe),$l=Mr(fe),wl=Vr(fe),vl=Fr(fe),kl=Ur(fe);function Rb(){W.localeError||U(vo())}function zt(){W.memoizer||U({memoizer:Gn()})}var E=p("ZodType",(e,t)=>(Rb(),O.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(k.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(gf(e,t))},superRefine(e,t){return this.check(yf(e,t))},overwrite(e){return this.check(xe(e))},optional(){return xt(this)},exactOptional(){return Gl(this)},nullable(){return sr(this)},nullish(){return xt(sr(this))},nonoptional(e){return nf(this,e)},array(){return ur(this)},or(e){return mn([this,e])},and(e){return Vl(this,e)},transform(e){return ci(this,Ai(e))},default(e){return Ql(this,e)},prefault(e){return tf(this,e)},catch(e){return sf(this,e)},pipe(e){return ci(this,e)},readonly(){return lf(this)},describe(e){let t=this.clone();return Y.add(t,{description:e}),t},meta(...e){if(e.length===0)return Y.get(this);let t=this.clone();return Y.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return k.hide(this,"~standard",{...eo(this),jsonSchema:{input:on(this,"input"),output:on(this,"output")}})},set"~standard"(e){k.own(this,"~standard",e)},parse:function e(t,n){return pl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await dl(this,t,n,{callee:e})},safeParse(e,t){return ml(this,e,t)},async safeParseAsync(e,t){return hl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){k.own(this,"spa",e)},validate(e,t){return Zn(this,e,t)},validateAsync(e,t){return Tn(this,e,t)},encode:function e(t,n){return gl(this,t,n,{callee:e})},decode:function e(t,n){return yl(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await bl(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await _l(this,t,n,{callee:e})},safeEncode(e,t){return $l(this,e,t)},safeDecode(e,t){return wl(this,e,t)},async safeEncodeAsync(e,t){return vl(this,e,t)},async safeDecodeAsync(e,t){return kl(this,e,t)},toJSONSchema(e){return zu(this,{})(e)},get description(){return Y.get(this)?.description},get _def(){return this._zod.def}}),ui=p("_ZodString",(e,t)=>{ht.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pu(e,n,r,o)},k.derived({format:e=>q(e).format??null,minLength:e=>q(e).minimum??null,maxLength:e=>q(e).maximum??null},{regex(...e){return this.check(Jt(...e))},includes(...e){return this.check(Ht(...e))},startsWith(...e){return this.check(Wt(...e))},endsWith(...e){return this.check(Gt(...e))},min(...e){return this.check(De(...e))},max(...e){return this.check($t(...e))},length(...e){return this.check(wt(...e))},nonempty(...e){return this.check(De(1,...e))},lowercase(e){return this.check(Kt(e))},uppercase(e){return this.check(qt(e))},trim(){return this.check(en())},normalize(...e){return this.check(Qt(...e))},toLowerCase(){return this.check(tn())},toUpperCase(){return this.check(nn())},slugify(){return this.check(rn())}})),ln=p("ZodString",(e,t)=>{ht.init(e,t),ui.init(e,t)},{email(e){return this.check(Po(li,e))},url(e){return this.check(Xn(ar,e))},jwt(e){return this.check(Ho(Si,e))},emoji(e){return this.check(To(pi,e))},guid(e){return this.check(Oo(fi,e))},uuid(e){return this.check(Ao(Ee,e))},uuidv4(e){return this.check(Eo(Ee,e))},uuidv6(e){return this.check(No(Ee,e))},uuidv7(e){return this.check(Zo(Ee,e))},nanoid(e){return this.check(Co(di,e))},cuid(e){return this.check(Lo(mi,e))},cuid2(e){return this.check(Ro(hi,e))},ulid(e){return this.check(Do(gi,e))},base64(e){return this.check(Jo(ki,e))},base64url(e){return this.check(Ko(xi,e))},xid(e){return this.check(jo(yi,e))},ksuid(e){return this.check(Mo(bi,e))},ipv4(e){return this.check(Vo(_i,e))},ipv6(e){return this.check(Fo($i,e))},cidrv4(e){return this.check(Uo(wi,e))},cidrv6(e){return this.check(Bo(vi,e))},e164(e){return this.check(qo(zi,e))},datetime(e){return this.check(Qn(tt,e))},date(e){return this.check(er(nt,e))},time(e){return this.check(tr(rt,e))},duration(e){return this.check(nr(ot,e))}});function ir(e){return Vc(ln,e)}var j=p("ZodStringFormat",(e,t)=>{R.init(e,t),ui.init(e,t)}),tt=p("ZodISODateTime",(e,t)=>{Ea.init(e,t),j.init(e,t)}),nt=p("ZodISODate",(e,t)=>{Na.init(e,t),j.init(e,t)}),rt=p("ZodISOTime",(e,t)=>{Za.init(e,t),j.init(e,t)}),ot=p("ZodISODuration",(e,t)=>{Ta.init(e,t),j.init(e,t)}),li=p("ZodEmail",(e,t)=>{$a.init(e,t),j.init(e,t)});function ld(e){return Po(li,e)}var fi=p("ZodGUID",(e,t)=>{ba.init(e,t),j.init(e,t)});function fd(e){return Oo(fi,e)}var Ee=p("ZodUUID",(e,t)=>{_a.init(e,t),j.init(e,t)});function pd(e){return Ao(Ee,e)}function dd(e){return Eo(Ee,e)}function md(e){return No(Ee,e)}function hd(e){return Zo(Ee,e)}var ar=p("ZodURL",(e,t)=>{ka.init(e,t),j.init(e,t)});function gd(e){return Xn(ar,e)}function yd(e){return Xn(ar,{protocol:Cn,hostname:Ts,...k.normalizeParams(e)})}var pi=p("ZodEmoji",(e,t)=>{xa.init(e,t),j.init(e,t)});function bd(e){return To(pi,e)}var di=p("ZodNanoID",(e,t)=>{za.init(e,t),j.init(e,t)});function _d(e){return Co(di,e)}var mi=p("ZodCUID",(e,t)=>{Sa.init(e,t),j.init(e,t)});function $d(e){return Lo(mi,e)}var hi=p("ZodCUID2",(e,t)=>{Ia.init(e,t),j.init(e,t)});function wd(e){return Ro(hi,e)}var gi=p("ZodULID",(e,t)=>{Pa.init(e,t),j.init(e,t)});function vd(e){return Do(gi,e)}var yi=p("ZodXID",(e,t)=>{Oa.init(e,t),j.init(e,t)});function kd(e){return jo(yi,e)}var bi=p("ZodKSUID",(e,t)=>{Aa.init(e,t),j.init(e,t)});function xd(e){return Mo(bi,e)}var _i=p("ZodIPv4",(e,t)=>{Ca.init(e,t),j.init(e,t)});function zd(e){return Vo(_i,e)}var xl=p("ZodMAC",(e,t)=>{Ra.init(e,t),j.init(e,t)});function Sd(e){return Uc(xl,e)}var $i=p("ZodIPv6",(e,t)=>{La.init(e,t),j.init(e,t)});function Id(e){return Fo($i,e)}var wi=p("ZodCIDRv4",(e,t)=>{Da.init(e,t),j.init(e,t)});function Pd(e){return Uo(wi,e)}var vi=p("ZodCIDRv6",(e,t)=>{ja.init(e,t),j.init(e,t)});function Od(e){return Bo(vi,e)}var ki=p("ZodBase64",(e,t)=>{Ma.init(e,t),j.init(e,t)});function Ad(e){return Jo(ki,e)}var xi=p("ZodBase64URL",(e,t)=>{Va.init(e,t),j.init(e,t)});function Ed(e){return Ko(xi,e)}var zi=p("ZodE164",(e,t)=>{Fa.init(e,t),j.init(e,t)});function Nd(e){return qo(zi,e)}var zl=p("ZodCreditCard",(e,t)=>{Ua.init(e,t),j.init(e,t)});function Zd(e){return Bc(zl,e)}var Sl=p("ZodIBAN",(e,t)=>{Ba.init(e,t),j.init(e,t)});function Td(e){return Jc(Sl,e)}var Si=p("ZodJWT",(e,t)=>{Ja.init(e,t),j.init(e,t)});function Cd(e){return Ho(Si,e)}var St=p("ZodCustomStringFormat",(e,t)=>{Ka.init(e,t),j.init(e,t)});function Ld(e,t,n={}){return vt(St,e,t,n)}function Rd(e){return vt(St,"hostname",Zs,e)}function Dd(e){return vt(St,"hex",Hs,e)}function jd(e){return vt(St,"currency_code",Ls,e)}function Md(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,o=we[r];if(!o)throw new Error(`Unrecognized hash format: ${r}`);return vt(St,r,o,t)}var fn=p("ZodNumber",(e,t)=>{lo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ou(e,n,r,o),e.isFinite=!0},k.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=q(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=q(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:n}=q(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>q(e).format??null},{gt(e,t){return this.check(Oe(e,t))},gte(e,t){return this.check(he(e,t))},min(e,t){return this.check(he(e,t))},lt(e,t){return this.check(Pe(e,t))},lte(e,t){return this.check(me(e,t))},max(e,t){return this.check(me(e,t))},int(e){return this.check(ai(e))},safe(e){return this.check(ai(e))},positive(e){return this.check(Oe(0,e))},nonnegative(e){return this.check(he(0,e))},negative(e){return this.check(Pe(0,e))},nonpositive(e){return this.check(me(0,e))},multipleOf(e,t){return this.check(Ge(e,t))},step(e,t){return this.check(Ge(e,t))},finite(){return this}}));function Il(e){return qc(fn,e)}var It=p("ZodNumberFormat",(e,t)=>{qa.init(e,t),fn.init(e,t)});function ai(e){return Wc(It,e)}function Vd(e){return Gc(It,e)}function Fd(e){return Yc(It,e)}function Ud(e){return Xc(It,e)}function Bd(e){return Qc(It,e)}var pn=p("ZodBoolean",(e,t)=>{Bn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Au(e,n,r,o)});function Pl(e){return eu(pn,e)}var dn=p("ZodBigInt",(e,t)=>{fo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eu(e,n,r,o)},k.derived({minValue:e=>q(e).minimum??null,maxValue:e=>q(e).maximum??null,format:e=>q(e).format??null},{gte(e,t){return this.check(he(e,t))},min(e,t){return this.check(he(e,t))},gt(e,t){return this.check(Oe(e,t))},lt(e,t){return this.check(Pe(e,t))},lte(e,t){return this.check(me(e,t))},max(e,t){return this.check(me(e,t))},positive(e){return this.check(Oe(BigInt(0),e))},negative(e){return this.check(Pe(BigInt(0),e))},nonpositive(e){return this.check(me(BigInt(0),e))},nonnegative(e){return this.check(he(BigInt(0),e))},multipleOf(e,t){return this.check(Ge(e,t))}}));function Jd(e){return nu(dn,e)}var Ii=p("ZodBigIntFormat",(e,t)=>{Ha.init(e,t),dn.init(e,t)});function Kd(e){return ou(Ii,e)}function qd(e){return iu(Ii,e)}var Ol=p("ZodSymbol",(e,t)=>{Wa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nu(e,n,r,o)});function Hd(e){return su(Ol,e)}var Al=p("ZodUndefined",(e,t)=>{Ga.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tu(e,n,r,o)});function Wd(e){return au(Al,e)}var El=p("ZodNull",(e,t)=>{Ya.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zu(e,n,r,o)});function Nl(e){return cu(El,e)}var Zl=p("ZodAny",(e,t)=>{Xa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ru(e,n,r,o)});function Gd(){return uu(Zl)}var Tl=p("ZodUnknown",(e,t)=>{Qa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Du(e,n,r,o)});function kt(){return lu(Tl)}var Cl=p("ZodNever",(e,t)=>{ec.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lu(e,n,r,o)});function Pi(e){return fu(Cl,e)}var Ll=p("ZodVoid",(e,t)=>{tc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cu(e,n,r,o)});function Yd(e){return pu(Ll,e)}var cr=p("ZodDate",(e,t)=>{nc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ju(e,n,r,o),e.min=(n,r)=>e.check(he(n,r)),e.max=(n,r)=>e.check(me(n,r))},k.derived({minDate:e=>{let{minimum:t}=q(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=q(e);return t?new Date(t):null}},{}));function Xd(e){return du(cr,e)}var Rl=p("ZodArray",(e,t)=>{zt(),oc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yu(e,n,r,o),e.element=t.element},{min(e,t){return this.check(De(e,t))},nonempty(e){return this.check(De(1,e))},max(e,t){return this.check($t(e,t))},length(e,t){return this.check(wt(e,t))},unwrap(){return this.element}});function ur(e,t){return gu(Rl,e,t)}function Qd(e){let t=e._zod.def.shape;return Oi(Object.keys(t))}var lr=p("ZodObject",(e,t)=>{zt(),ic.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xu(e,n,r,o),k.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Oi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(k.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(k.mergeDefs(this._zod.def,{catchall:kt()}))},loose(){return this.clone(k.mergeDefs(this._zod.def,{catchall:kt()}))},strict(){return this.clone(k.mergeDefs(this._zod.def,{catchall:Pi()}))},strip(){return this.clone(k.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return k.extend(this,e)},safeExtend(e){return k.safeExtend(this,e)},merge(e){return k.merge(this,e)},pick(e){return k.pick(this,e)},omit(e){return k.omit(this,e)},partial(...e){return k.partial(pr,this,e[0])},exactPartial(...e){return k.partial(Ei,this,e[0],"exactPartial")},required(...e){return k.required(Ni,this,e[0])}});function em(e,t){let n={type:"object",shape:e??{},...k.normalizeParams(t)};return new lr(n)}function tm(e,t){return new lr({type:"object",shape:e,catchall:Pi(),...k.normalizeParams(t)})}function nm(e,t){return new lr({type:"object",shape:e,catchall:kt(),...k.normalizeParams(t)})}var fr=p("ZodUnion",(e,t)=>{Jn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ti(e,n,r,o),e.options=t.options});function mn(e,t){return new fr({type:"union",options:e,...k.normalizeParams(t)})}var Dl=p("ZodXor",(e,t)=>{fr.init(e,t),sc.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ti(e,n,r,o),e.options=t.options});function rm(e,t){return new Dl({type:"union",options:e,inclusive:!1,...k.normalizeParams(t)})}var jl=p("ZodDiscriminatedUnion",(e,t)=>{fr.init(e,t),cc.init(e,t)});function om(e,t,n){return new jl({type:"union",options:t,discriminator:e,...k.normalizeParams(n)})}var Ml=p("ZodIntersection",(e,t)=>{uc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qu(e,n,r,o)});function Vl(e,t){return new Ml({type:"intersection",left:e,right:t})}var Fl=p("ZodTuple",(e,t)=>{zt(),po.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>el(e,n,r,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new pr({type:"optional",innerType:t}))})}});function Ul(e,t,n){let r=t instanceof O,o=r?n:t,i=r?t:null;return new Fl({type:"tuple",items:e,rest:i,...k.normalizeParams(o)})}var cn=p("ZodRecord",(e,t)=>{zt(),lc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tl(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Bl(e,t,n){return!t||!t._zod?new cn({type:"record",keyType:ir(),valueType:e,...k.normalizeParams(t)}):new cn({type:"record",keyType:e,valueType:t,...k.normalizeParams(n)})}function im(e,t,n){return new cn({type:"record",keyType:e,valueType:t,...k.normalizeParams(n),partial:!0})}function sm(e,t,n){return new cn({type:"record",keyType:e,valueType:t,mode:"loose",...k.normalizeParams(n)})}var Jl=p("ZodMap",(e,t)=>{zt(),fc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wu(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Ae(...n)),e.nonempty=n=>e.check(Ae(1,n)),e.max=(...n)=>e.check(Ye(...n)),e.size=(...n)=>e.check(_t(...n))});function am(e,t,n){return new Jl({type:"map",keyType:e,valueType:t,...k.normalizeParams(n)})}var Kl=p("ZodSet",(e,t)=>{zt(),pc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gu(e,n,r,o),e.min=(...n)=>e.check(Ae(...n)),e.nonempty=n=>e.check(Ae(1,n)),e.max=(...n)=>e.check(Ye(...n)),e.size=(...n)=>e.check(_t(...n))});function cm(e,t){return new Kl({type:"set",valueType:e,...k.normalizeParams(t)})}var un=p("ZodEnum",(e,t)=>{dc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Mu(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new un({...t,checks:[],...k.normalizeParams(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new un({...t,checks:[],...k.normalizeParams(o),entries:i})}});function Oi(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new un({type:"enum",entries:n,...k.normalizeParams(t)})}function um(e,t){return new un({type:"enum",entries:e,...k.normalizeParams(t)})}var ql=p("ZodLiteral",(e,t)=>{mc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vu(e,n,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function lm(e,t){return new ql({type:"literal",values:Array.isArray(e)?e:[e],...k.normalizeParams(t)})}var Hl=p("ZodFile",(e,t)=>{hc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bu(e,n,r,o),e.min=(n,r)=>e.check(Ae(n,r)),e.max=(n,r)=>e.check(Ye(n,r)),e.mime=(n,r)=>e.check(Xt(Array.isArray(n)?n:[n],r))});function fm(e){return yu(Hl,e)}var Wl=p("ZodTransform",(e,t)=>{zt(),gc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hu(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new He(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(k.issue(i,n.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(k.issue(s))}};let o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Ai(e){return new Wl({type:"transform",transform:e})}var pr=p("ZodOptional",(e,t)=>{mo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ni(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function xt(e){return new pr({type:"optional",innerType:e})}var Ei=p("ZodExactOptional",(e,t)=>{yc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ni(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gl(e){return new Ei({type:"optional",innerType:e})}var Yl=p("ZodNullable",(e,t)=>{bc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sr(e){return new Yl({type:"nullable",innerType:e})}function pm(e){return xt(sr(e))}var Xl=p("ZodDefault",(e,t)=>{_c.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>il(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ql(e,t){return new Xl({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var ef=p("ZodPrefault",(e,t)=>{$c.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function tf(e,t){return new ef({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var Ni=p("ZodNonOptional",(e,t)=>{wc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function nf(e,t){return new Ni({type:"nonoptional",innerType:e,...k.normalizeParams(t)})}var rf=p("ZodSuccess",(e,t)=>{vc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ju(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function dm(e){return new rf({type:"success",innerType:e})}var of=p("ZodCatch",(e,t)=>{kc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>al(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function sf(e,t){return new of({type:"catch",innerType:e,catchValue:typeof t=="function"?t:k.constantCatch(t)})}var af=p("ZodNaN",(e,t)=>{xc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fu(e,n,r,o)});function mm(e){return hu(af,e)}var dr=p("ZodPipe",(e,t)=>{ho.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cl(e,n,r,o),e.in=t.in,e.out=t.out});function ci(e,t){return new dr({type:"pipe",in:e,out:t})}var mr=p("ZodCodec",(e,t)=>{dr.init(e,t),Kn.init(e,t)});function hm(e,t,n){return new mr({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function gm(e){let t=e._zod.def;return new mr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var cf=p("ZodPreprocess",(e,t)=>{dr.init(e,t),zc.init(e,t)}),uf=p("ZodReadonly",(e,t)=>{Sc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ul(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lf(e){return new uf({type:"readonly",innerType:e})}var ff=p("ZodTemplateLiteral",(e,t)=>{Ic.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uu(e,n,r,o)});function ym(e,t){return new ff({type:"template_literal",parts:e,...k.normalizeParams(t)})}var pf=p("ZodLazy",(e,t)=>{qn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fl(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function df(e){return new pf({type:"lazy",getter:e})}var mf=p("ZodPromise",(e,t)=>{Oc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ll(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function bm(e){return new mf({type:"promise",innerType:e})}var hf=p("ZodFunction",(e,t)=>{Pc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qu(e,n,r,o)});function _m(e){return new hf({type:"function",input:Array.isArray(e?.input)?Ul(e?.input):e?.input??ur(kt()),output:e?.output??kt()})}var hr=p("ZodCustom",(e,t)=>{Ac.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ku(e,n,r,o)});function $m(e){let t=new M({check:"custom"});return t._zod.check=e,t}function wm(e,t){return bu(hr,e??(()=>!0),t)}function gf(e,t={}){return _u(hr,e,t)}function yf(e,t){return $u(e,t)}var vm=wu,km=vu,bf=p("ZodInstanceOf",(e,t)=>{hr.init(e,t)},{properties(e,t){return this.check(Yt(e,t))}});function xm(e,t={}){let n=new bf({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...k.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}var zm=(...e)=>ku({Codec:mr,Boolean:pn,String:ln},...e);function Sm(e){let t=df(()=>mn([ir(e),Il(),Pl(),Nl(),ur(t),Bl(ir(),t)]));return t}function Im(e,t){return new cf({type:"pipe",in:Ai(e),out:t})}var Db={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function jb(e){U({customError:e})}function Mb(){return U().customError}var _f;_f||(_f={});var gr={};Te(gr,{ZodISODate:()=>nt,ZodISODateTime:()=>tt,ZodISODuration:()=>ot,ZodISOTime:()=>rt,date:()=>Fb,datetime:()=>Vb,duration:()=>Bb,time:()=>Ub});function Vb(e){return Qn(tt,e)}function Fb(e){return er(nt,e)}function Ub(e){return tr(rt,e)}function Bb(e){return nr(ot,e)}var w={...hn,...ii,iso:gr},Jb=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 Kb(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function Pm(e,t){return e.map((n,r)=>r<t?n:n.optional())}function qb(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Hb(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let o=n[1]===void 0?void 0:qb(n[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}function Wb(e,t){return w.transform(r=>r).check(r=>{let o=r.value;if(typeof o!="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties&&r.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&r.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0}),t.keySchema)for(let s of i){let a=t.keySchema.safeParse(s);a.success||r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function $f(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let r=String(e);return`${n[0]}${r.length}:${r}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=$f(s,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let s=$f(e[i],t);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}var Gb=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Yb=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function yr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(yr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>Gb.has(t)?yr(n):!Yb.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(yr))}function Om(e){return e===1?"element":"elements"}function Xb(e,t){return w.transform(r=>r).check(r=>{let o=r.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=$f(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:o,path:[s],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(t.containsSchema.safeParse(c).success&&++a>=s)break;a<i&&r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Om(i)}; found ${a}`,input:o,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&r.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Om(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function Am(e,t){if(e!==!1)return e===void 0||e===!0?w.any():ie(e,t)}var Qb=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Em(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=Hb(o,t),s=ie(i,t);return t.refs.set(o,s),t.processing.delete(o),s}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(s=>typeof s=="string"))return w.enum(o);let i=o.map(s=>w.literal(s));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 n=e.type;if(Array.isArray(n)){let o=n.map(i=>{let s={...e,type:i};return Em(s,t)});return o.length===0?w.never():o.length===1?o[0]:w.union(o)}if(!n)return w.any();let r;switch(n){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(Qb)):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))),r=o;break}case"number":case"integer":{let o=n==="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)),r=o;break}case"boolean":{r=w.boolean();break}case"null":{r=w.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?ie(e.additionalProperties,t):void 0;for(let[f,d]of Object.entries(i)){let m=ie(d,t);G(o,f,s.has(f)?m:m.optional())}if(e.patternProperties){let f=e.patternProperties,d=Object.keys(f),m=[];for(let b of d){let $=ie(f[b],t),I=w.string().regex(new RegExp(b));m.push(w.looseRecord(I,$))}let g=[];if(Object.keys(o).length>0&&g.push(w.object(o).passthrough()),g.push(...m),g.length===0)r=w.object({}).passthrough();else if(g.length===1)r=g[0];else{let b=w.intersection(g[0],g[1]);for(let $=2;$<g.length;$++)b=w.intersection(b,g[$]);r=b}if(e.additionalProperties===!1){let b=Object.keys(o),$=d.map(x=>new RegExp(x)),I=r;r=r.check(x=>{if(!_e(x.value))return;let A=[];for(let C of Object.keys(x.value))b.includes(C)||$.some(V=>V.test(C))||A.push(C);A.length&&x.issues.push({code:"unrecognized_keys",keys:A,input:x.value,inst:I})})}}else{let f=w.object(o);e.additionalProperties===!1?r=f.strict():a?r=f.catchall(a):r=f.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,u=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||u!==void 0||l!==void 0){let f;if(c){let d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;f=ie(d,t)}r=Wb(r,{keySchema:f,minProperties:u,maxProperties:l})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(f=>ie(f,t)),c=Pm(a,s),u=Array.isArray(i)?void 0:Am(i,t),l=w.tuple(c);r=u?l.rest(u):l,typeof e.minItems=="number"&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(w.maxLength(e.maxItems)))}else if(Array.isArray(i)){let s=typeof e.minItems=="number"?e.minItems:0,a=i.map(f=>ie(f,t)),c=Pm(a,s),u=Am(e.additionalItems,t),l=w.tuple(c);r=u?l.rest(u):l,typeof e.minItems=="number"&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(w.maxLength(e.maxItems)))}else if(i!==void 0){let s=ie(i,t),a=w.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),r=a}else r=w.array(w.any());(e.uniqueItems===!0||e.contains!==void 0)&&(r=Xb(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ie(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${n}`)}return r}function ie(e,t){if(typeof e=="boolean")return e?w.any():w.never();let n=Em(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>ie(u,t)),c=w.union(a);n=r?w.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>ie(u,t)),c=w.xor(a);n=r?w.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:w.any();else{let a=r?n:ie(e.allOf[0],t),c=r?0:1;for(let u=c;u<e.allOf.length;u++)a=w.intersection(a,ie(e.allOf[u],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=w.nullable(n)),e.readOnly===!0&&(n=w.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in e&&(o[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(o[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!yr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(o[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!yr(e.contains)&&(o.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(o[a]=e[a])}for(let a of Object.keys(e))Jb.has(a)||G(o,a,e[a]);return Object.keys(o).length>0&&t.registry.add(n,o),e.description&&(n=n.describe(e.description)),n}function Nm(e,t){if(typeof e=="boolean")return e?w.any():w.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=Kb(n,t?.defaultTarget),o=n.$defs||n.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??Y};return ie(n,i)}var Zm=Symbol("z.visit/resolving");function br(e,t){let n=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},r=new Map;function o(s){let a=r.get(s);if(a===Zm)return new qn({type:"lazy",getter:()=>r.get(s)});if(a!==void 0)return a;r.set(s,Zm);let c=i(s),u=n(c,c!==s);return r.set(s,u),u}function i(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let u=a.shape,l=Object.keys(u),f=!1,d={};for(let g of l){let b=o(u[g]);b!==u[g]&&(f=!0),d[g]=b}let m=a.catchall;return a.catchall&&(m=o(a.catchall),m!==a.catchall&&(f=!0)),f?L(s,{...a,shape:d,catchall:m}):s}case"array":{let u=o(a.element);return u===a.element?s:L(s,{...a,element:u})}case"tuple":{let u=a.items,l=!1,f=[];for(let m of u){let g=o(m);g!==m&&(l=!0),f.push(g)}let d=a.rest;return a.rest&&(d=o(a.rest),d!==a.rest&&(l=!0)),l?L(s,{...a,items:f,rest:d}):s}case"record":case"map":{let u=o(a.keyType),l=o(a.valueType);return u===a.keyType&&l===a.valueType?s:L(s,{...a,keyType:u,valueType:l})}case"set":{let u=o(a.valueType);return u===a.valueType?s:L(s,{...a,valueType:u})}case"union":{let u=a.options,l=!1,f=[];for(let d of u){let m=o(d);m!==d&&(l=!0),f.push(m)}return l?L(s,{...a,options:f}):s}case"intersection":{let u=o(a.left),l=o(a.right);return u===a.left&&l===a.right?s:L(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=o(a.innerType);return u===a.innerType?s:L(s,{...a,innerType:u})}case"pipe":{let u=o(a.in),l=o(a.out);return u===a.in&&l===a.out?s:L(s,{...a,in:u,out:l})}case"function":{let u=o(a.input),l=o(a.output);return u===a.input&&l===a.output?s:L(s,{...a,input:u,output:l})}case"lazy":{let u=a.getter,{_cachedInner:l,...f}=a;return L(s,{...f,getter:()=>o(u())})}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 s;default:return s}}return o(e)}function Tm(e){return br(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:mn(n.options)}})}function e_(e,t){if(!t?.length)return e;let n=e._zod.def;return L(e,ve(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function Cm(e){return e_(e.out,e.checks)}function t_(e){return e.in._zod.traits.has("$ZodTransform")?Cm(e):e.in}function Lm(e){return br(e,{pipe:t=>t_(t._zod.def),default:(t,n)=>n?xt(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function Rm(e){return br(e,{pipe:t=>Cm(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var wf={};Te(wf,{bigint:()=>i_,boolean:()=>o_,date:()=>s_,number:()=>r_,string:()=>n_});function n_(e){return Fc(ln,e)}function r_(e){return Hc(fn,e)}function o_(e){return tu(pn,e)}function i_(e){return ru(dn,e)}function s_(e){return mu(cr,e)}U({jitless:!0});var kf=1,Dm=1,a_="austere-sync.1",Ot={frameBytes:65536,noteItemsBytes:4096,nameChars:40},c_=["upgrade_required","forbidden","rate_limited","too_large","invalid"];var u_=["publish","addNote","releaseNote","discardNote","addReply","grant","revoke","delete"];var l_=/^[A-Za-z_$][\w$]{0,99}$/,f_=/^[0-9a-f]{64}$/,p_=/^[A-Za-z0-9_-]{43}$/,d_=/^[A-Za-z0-9_-]{8,64}$/,m_=/^[A-Za-z0-9_-]{16,256}$/,Bm=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,h_=/^#[0-9a-f]{6}$/,g_=/^[A-Za-z0-9_-]{16}$/,xf=y.int().positive(),Jm=y.int().nonnegative(),Pt=y.int().nonnegative(),jm=y.string().min(1).max(Ot.nameChars),Km=y.string().regex(f_),vf=y.string().regex(l_).nullable(),Li=y.enum(["viewing","away","writing"]),y_=y.enum(["owner","reviewer"]),Mm={code:y.enum(c_),message:y.string(),retryAfter:y.int().nonnegative().optional()},qm=y.discriminatedUnion("kind",[y.looseObject({kind:y.literal("message"),text:y.string()}),y.looseObject({kind:y.literal("annotation"),target:y.string().optional(),component:y.string().optional(),path:y.array(y.string()).optional(),selection:y.string().optional(),excerpt:y.string().optional(),note:y.string().optional(),detail:y.looseObject({part:y.string().optional(),row:y.string().optional(),column:y.string().optional(),rowIndex:y.int().optional()}).optional()})]),Hm=y.looseObject({sha256:Km,name:y.string().min(1),version:y.string().min(1)}),Iw={publish:y.looseObject({title:y.string(),cliVersion:y.string().regex(Bm),html:Km,packs:y.array(Hm),auto:y.boolean(),unlisted:y.boolean(),presence:y.boolean()}),addNote:y.looseObject({items:y.array(qm).min(1),name:y.string().optional()}),releaseNote:y.looseObject({note:y.string().min(1)}),discardNote:y.looseObject({note:y.string().min(1)}),addReply:y.looseObject({text:y.string().min(1)}),grant:y.looseObject({name:jm,tokenHash:y.string().regex(p_),expiresAt:Pt.nullable()}),revoke:y.looseObject({name:jm}),delete:y.looseObject({})},b_=y.looseObject({clientId:y.string().regex(d_),n:xf}),Pw=b_.extend({v:y.int(),t:y.literal("mutation"),name:y.enum(u_),args:y.unknown()}),_r={v:y.int(),id:y.string().min(1),seq:xf},__=y.looseObject({..._r,type:y.string()}),Vm={page:y.looseObject({..._r,type:y.literal("page"),title:y.string(),cliVersion:y.string().regex(Bm),html:y.string(),packs:y.array(Hm),auto:y.boolean(),unlisted:y.boolean(),presence:y.boolean(),publishedAt:Pt,expiresAt:Pt,deleted:y.boolean()}),note:y.looseObject({..._r,type:y.literal("note"),author:y.string(),items:y.array(qm),at:Pt,state:y.enum(["held","released","discarded"])}),reply:y.looseObject({..._r,type:y.literal("reply"),text:y.string(),at:Pt}),acl:y.looseObject({..._r,type:y.literal("acl"),name:y.string(),grantedAt:Pt,expiresAt:Pt.nullable(),revoked:y.boolean(),grant:y.string().regex(g_).optional()})},Ow={pull:y.looseObject({v:y.int(),t:y.literal("pull"),after:Jm}),hello:y.looseObject({v:y.int(),t:y.literal("hello"),status:Li,name:y.string().optional()}),status:y.looseObject({v:y.int(),t:y.literal("status"),status:Li}),focus:y.looseObject({v:y.int(),t:y.literal("focus"),statement:vf}),bye:y.looseObject({v:y.int(),t:y.literal("bye")})},$_=y.looseObject({v:y.int(),t:y.literal("changes"),rows:y.array(y.unknown()),cursor:Jm,more:y.boolean().optional(),reset:y.boolean().optional()}),Zi=y.string().min(1),Fm={ack:y.looseObject({v:y.int(),t:y.literal("ack"),clientId:y.string(),n:xf,error:y.looseObject(Mm).optional()}),error:y.looseObject({v:y.int(),t:y.literal("error"),...Mm}),hello:y.looseObject({v:y.int(),t:y.literal("hello"),viewer:y.looseObject({id:Zi,name:y.string(),colour:y.string().regex(h_),role:y_}),status:Li,focus:vf,self:y.boolean()}),status:y.looseObject({v:y.int(),t:y.literal("status"),viewer:Zi,status:Li}),focus:y.looseObject({v:y.int(),t:y.literal("focus"),viewer:Zi,statement:vf}),bye:y.looseObject({v:y.int(),t:y.literal("bye"),viewer:Zi})},Ci=e=>({ok:!0,value:e}),$r=(e,t)=>({ok:!1,error:{code:e,message:t}}),Um=(e,t)=>typeof t=="string"&&Object.hasOwn(e,t);function w_(e){return new TextEncoder().encode(e).length}function Ti(e,t){let n=t.issues[0],r=n&&n.path.length?`${e}.${n.path.join(".")}`:e;return $r("invalid",`${r}: ${n?n.message:"invalid"}`)}function Wm(e,t){if(e.length*3<=t)return;let n=w_(e);return n>t?n:void 0}function v_(e,t){let n;try{n=typeof e=="string"?e:JSON.stringify(e)}catch{}if(n===void 0)return $r("invalid","frame is not JSON");let r=t===null?void 0:Wm(n,t);if(r!==void 0)return $r("too_large",`frame is ${r} bytes; the limit is ${t}`);let o;try{o=JSON.parse(n)}catch{return $r("invalid","frame is not JSON")}if(!o||typeof o!="object"||Array.isArray(o))return $r("invalid","frame is not a JSON object");let i=o,s=Gm(i.v,"frame");return s?{ok:!1,error:s}:Ci(i)}function Gm(e,t){if(typeof e!="number"||!Number.isInteger(e))return{code:"invalid",message:`${t}.v: expected an integer protocol version`};if(e<Dm)return{code:"upgrade_required",message:`${t} speaks sync v${e}; v${Dm} or later is required`}}function Ri(e){let t=v_(e,null);if(!t.ok)return t;let n=t.value;if(n.t==="changes"){let o=$_.safeParse(n);if(!o.success)return Ti("changes",o.error);let i=[],s=[];for(let[a,c]of o.data.rows.entries()){let u=__.safeParse(c);if(!u.success)return Ti(`changes.rows.${a}`,u.error);let l=Gm(u.data.v,`changes.rows.${a}`);if(l)return{ok:!1,error:l};if(!Um(Vm,u.data.type)){s.push(u.data);continue}let f=Vm[u.data.type].safeParse(c);if(!f.success)return Ti(`changes.rows.${a}`,f.error);i.push(f.data)}return Ci({...o.data,rows:i,skipped:s})}if(!Um(Fm,n.t))return Ci(null);let r=Fm[n.t].safeParse(n);return r.success?Ci(r.data):Ti(n.t,r.error)}function Ym(e,t,n){let r={v:kf,t:"mutation",clientId:n.clientId,n:n.n,name:e,args:t},o=Wm(JSON.stringify(r),Ot.frameBytes);if(o!==void 0)throw new RangeError(`${e} is ${o} bytes; a frame may be at most ${Ot.frameBytes}`);return r}var k_="austere-owner.",x_="austere-invite.";function Xm(e){let t=[a_];for(let[n,r]of[[k_,e.owner],[x_,e.invite]])if(r!==void 0){if(!m_.test(r))throw new Error("sync token must be 16-256 base64url characters");t.push(n+r)}return t}var z_={viewing:"viewing",away:"away",writing:"writing a note"},Di=class{constructor(t){Je(this,"roster",new Map);Je(this,"self",null);Je(this,"send",null);Je(this,"heartbeat");Je(this,"writing",new Set);Je(this,"focus",null);Je(this,"host");this.host=t,document.addEventListener("visibilitychange",()=>this.sendStatus())}status(){return document.visibilityState==="hidden"?"away":this.writing.size?"writing":"viewing"}connect(t){this.send=t,this.hello(),this.focus&&t({v:1,t:"focus",statement:this.focus}),window.clearInterval(this.heartbeat),this.heartbeat=window.setInterval(()=>this.send?.({v:1,t:"status",status:this.status()}),25e3)}disconnect(){this.send=null,window.clearInterval(this.heartbeat),this.self=null,this.roster.clear(),this.render()}rename(){this.send&&this.hello()}leave(){this.send?.({v:1,t:"bye"})}hello(){let t=this.host.name();this.send?.(t?{v:1,t:"hello",status:this.status(),name:t}:{v:1,t:"hello",status:this.status()})}handle(t){if(t.t==="hello")this.roster.set(t.viewer.id,{viewer:t.viewer,status:t.status,focus:t.focus}),t.self&&(this.self=t.viewer.id);else if(t.t==="bye")this.roster.delete(t.viewer),t.viewer===this.self&&(this.self=null);else{let n=this.roster.get(t.viewer);if(!n)return;t.t==="status"?n.status=t.status:n.focus=t.statement}this.render()}setFocus(t){t!==this.focus&&(this.focus=t,this.send?.({v:1,t:"focus",statement:t}))}setWriting(t,n){let r=this.status();n?this.writing.add(t):this.writing.delete(t),this.status()!==r&&this.sendStatus()}redraw(){this.host.showFocus(this.marks())}sendStatus(){this.send?.({v:1,t:"status",status:this.status()})}others(){return[...this.roster.values()].filter(t=>t.viewer.id!==this.self)}marks(){return this.others().flatMap(t=>t.focus?[{statement:t.focus,name:t.viewer.name,colour:t.viewer.colour}]:[])}selfChip(t){let n=document.createElement("span");n.dataset.viewer=t.viewer.id,n.className="viewer self",n.style.setProperty("--viewer",t.viewer.colour),n.textContent=[...t.viewer.name][0]?.toUpperCase()??"?";let r=`You \xB7 ${t.viewer.name}`;return n.title=r,n.setAttribute("role","img"),n.setAttribute("aria-label",r),n}render(){let t=document.activeElement,n=t instanceof HTMLElement&&this.host.chips.contains(t)?t.dataset.viewer:void 0,r=this.others().map(i=>{let s=document.createElement("button");s.dataset.viewer=i.viewer.id,s.type="button",s.className=`viewer ${i.status}`,s.style.setProperty("--viewer",i.viewer.colour),s.textContent=[...i.viewer.name][0]?.toUpperCase()??"?";let a=`${i.viewer.name} \xB7 ${z_[i.status]}${i.focus?" \xB7 click to see where":""}`;return s.title=a,s.setAttribute("aria-label",a),s.disabled=!i.focus,s.addEventListener("click",()=>i.focus&&this.host.reveal(i.focus)),s}),o=this.self?this.roster.get(this.self):void 0;this.host.chips.replaceChildren(...o?[this.selfChip(o)]:[],...r),r.find(i=>i.dataset.viewer===n)?.focus(),this.host.chips.hidden=!o&&!r.length,this.redraw()}};var Qm=1e3,S_=3e4;function eh(e){let t=[],n=[],r=[],o=null,i=!1,s=Qm,a;function c(){if(a=void 0,i)return;let u=!1,l=null,f=new WebSocket(e.url,e.protocols());o=f,f.addEventListener("open",()=>{u=!0;for(let d of t)d()}),f.addEventListener("message",d=>{let m=Ri(d.data);if(!m.ok){console.warn(`austere: skipped a sync frame: ${m.error.message}`);return}if(m.value){s=Qm,m.value.t==="error"&&(l=m.value);for(let g of n)g(m.value)}}),f.addEventListener("close",async d=>{o===f&&(o=null);let m={code:d.code,opened:u,error:l},g=d.code===1e3||d.code===1008||l?.code==="forbidden"||l?.code==="upgrade_required",b=!i&&!g;b&&e.mayRetry&&(b=await e.mayRetry(m)&&!i),b&&(a=setTimeout(c,s),s=Math.min(s*2,S_));for(let $ of r)$(m,b)})}return c(),{get connected(){return o?.readyState===WebSocket.OPEN},send(u){return o?.readyState!==WebSocket.OPEN?!1:(o.send(JSON.stringify(u)),!0)},onOpen:u=>{t.push(u)},onFrame:u=>{n.push(u)},onClose:u=>{r.push(u)},stop(){i=!0,clearTimeout(a),o?.close(1e3),o=null}}}var th="data-austere-inline",nh="application/x-austere-gzip";async function I_(e){try{if(typeof DecompressionStream!="function")throw new Error("this browser cannot unpack the page (no DecompressionStream)");let t=Array.from(document.querySelectorAll(`script[type="${e}"]`)),n=await Promise.all(t.map(r=>{let o=atob((r.textContent??"").trim()),i=Uint8Array.from(o,s=>s.charCodeAt(0));return new Response(new Blob([i]).stream().pipeThrough(new DecompressionStream("gzip"))).text()}));for(let r of n){let o=document.createElement("script");o.textContent=r,document.head.appendChild(o)}}catch(t){document.documentElement.textContent=`This page could not start: ${t instanceof Error?t.message:String(t)}`}}var rh=`<script ${th}="loader">(${I_})(${JSON.stringify(nh)})<\/script>`;function oh(e,t){return`<script type="${nh}" ${th}="${e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}">${t}<\/script>`}var de=window.__AUSTERE__??JSON.parse(document.getElementById("austere-boot")?.textContent||"{}"),Se=de.id,F=de.hosted||null,X=de.hosted?.base??`/s/${Se}`,Df=de.viewer||{role:"owner",name:""},se=!F&&Df.role==="owner",xr=Ot.nameChars,Be={get(e,t){try{let n=localStorage.getItem(e);return n==null?t:JSON.parse(n)}catch{return t}},set(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}},remove(e){try{localStorage.removeItem(e)}catch{}}},Ne={get(e){try{return JSON.parse(sessionStorage.getItem(e)||"null")}catch{return null}},set(e,t){try{return sessionStorage.setItem(e,JSON.stringify(t)),!0}catch{return!1}}},Pf=`austere:invite:${Se}`,ih=/^[A-Za-z0-9_-]{16,256}$/,Ie=null;if(F){let e=new URLSearchParams(location.hash.slice(1)).get("i");if(e!==null&&history.replaceState(null,"",location.pathname+location.search),e!==null&&ih.test(e))Ie=e,Be.set(Pf,e);else{let t=Be.get(Pf,null);Ie=typeof t=="string"&&ih.test(t)?t:null}window.addEventListener("hashchange",()=>{new URLSearchParams(location.hash.slice(1)).has("i")&&location.reload()})}var Ve,be=F?"":Df.name,ph="";if(F){let e=crypto.getRandomValues(new Uint8Array(16));ph=btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var Mi=`austere:outbox:${Se}`,sh=Ne.get(Mi),ze=Array.isArray(sh)?sh.filter(e=>e?.m?.name==="addNote"&&typeof e.as=="string"&&typeof e.m.clientId=="string"&&/^[A-Za-z0-9_-]{8,64}$/.test(e.m.clientId)&&Number.isInteger(e.m.n)&&e.m.n>0&&(e.retryAt===void 0||typeof e.retryAt=="number")):[];function jf(){return Ve?`invite:${Ve}`:"open"}function dh(){let e=jf();return ze.filter(t=>t.as===e)}var P_=0,vr=!1,Of=null,zf=new Map,kr=null,at=null,h={mode:Be.get("austere:mode","annotate"),queue:Be.get(`austere:queue:${Se}`,[]),transcript:[],presence:"idle",status:"open",endedBy:null,closed:!1,unread:0,more:!1,program:null,revision:0,errorsRevision:0,renderReport:null,thirdParty:!1,frameReady:!1,scrollY:0,parserErrors:[],runtimeErrors:[],changes:[],highlight:!1,sheetOpen:Ne.get(`austere:sheet:${Se}`)===!0,sending:!1,connected:!1,editing:null,links:null},S=(e,t=document)=>t.querySelector(e);function v(e,t={},...n){let r=document.createElement(e);for(let[o,i]of Object.entries(t))i==null||i===!1||(o==="class"?r.className=String(i):o.startsWith("on")?typeof i=="function"&&r.addEventListener(o.slice(2),i):o==="text"?r.textContent=String(i):o==="html"?r.innerHTML=String(i):r.setAttribute(o,i===!0?"":String(i)));for(let o of n.flat())o!=null&&o!==!1&&r.append(o instanceof Node?o:document.createTextNode(String(o)));return r}document.body.innerHTML=`
63
63
  <div class="app">
64
64
  <header class="bar">
65
65
  <div class="bar-title"><span class="title"></span><span class="file"></span></div>
@@ -77,9 +77,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
77
77
  <button type="button" class="icon-btn menu-btn" aria-label="More">\u22EF</button>
78
78
  <div class="menu-pop" hidden>
79
79
  <button type="button" data-cmd="copy-path">Copy file path</button>
80
- <button type="button" data-cmd="copy-link">Copy review link</button>
80
+ <button type="button" data-cmd="copy-link"${F?" hidden":""}>${F?"Copy page link":"Copy review link"}</button>
81
+ <button type="button" data-cmd="copy-agent-prompt" title="A prompt that tells your agent to poll this page for feedback">Copy agent prompt</button>
82
+ ${F?'<div class="menu-note" data-share-note hidden>Only the owner can share this page. To invite someone, they run<code>austere-axi publish &lt;file&gt; --invite "Name"</code>which prints a link for that person.</div>':""}
81
83
  <button type="button" data-cmd="reload">Reload artifact</button>
82
- <a data-cmd="export" href="${ie}/export">Download standalone HTML</a>
84
+ ${F?'<button type="button" data-cmd="export">Download standalone HTML</button>':`<a data-cmd="export" href="${X}/export">Download standalone HTML</a>`}
83
85
  <button type="button" data-cmd="end" class="danger">End review</button>
84
86
  <button type="button" data-cmd="close" class="danger">Close review</button>
85
87
  <button type="button" data-cmd="reopen">Reopen review</button>
@@ -114,7 +116,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
114
116
  </aside>
115
117
  </div>
116
118
  <button type="button" class="dock"></button>
117
- </div>`;if(!fe)for(let e of['[data-cmd="copy-path"]','[data-cmd="copy-link"]','[data-cmd="export"]','[data-cmd="end"]','[data-cmd="close"]','[data-cmd="reopen"]',".send-end"])I(e)?.remove();function Rf(){if(fe)return;I(".file").textContent=ge?`reviewing as ${ge}`:"";let e=H||Cf.auto?"Enter sends":"the owner sends your notes on \xB7 Enter sends";I(".composer-hint").textContent=ge?`Posting as ${ge} \xB7 ${e}`:e}var it=H?v("form",{class:"name-ask",hidden:!0},v("label",{for:"austere-name",text:"Your name, shown with your notes"}),v("div",{class:"name-row"},v("input",{id:"austere-name",maxlength:String(vr),autocomplete:"name",placeholder:"Name"}),v("button",{type:"submit",class:"btn primary",text:"Continue"}))):null;it&&(I(".composer").before(it),it.addEventListener("submit",e=>{e.preventDefault();let t=I("input",it),n=t.value.trim().slice(0,vr);if(!n)return t.focus();ge=n,Be.set("austere:name",n),it.hidden=!0,Rf(),pe.rename(),xr(!1)}));var he=H?.report?v("form",{class:"report-box",hidden:!0},v("label",{for:"austere-report",text:"What is wrong with this page?"}),v("textarea",{id:"austere-report",rows:"3",maxlength:"1000"}),v("div",{class:"report-row"},v("span",{class:"report-status"}),v("button",{type:"button",class:"btn tiny ghost",text:"Cancel",onclick:()=>{he&&(he.hidden=!0)}}),v("button",{type:"submit",class:"btn tiny primary",text:"Send report"}))):null;if(H){let e=v("footer",{class:"hosted-foot"},v("a",{href:"https://github.com/MandalorianBatman/austere-axi",target:"_blank",rel:"noopener noreferrer",text:"Made with austere-axi"}));he&&(e.append(v("span",{"aria-hidden":"true",text:"\xB7"}),v("button",{type:"button",class:"link-btn report-open",text:"Report",onclick:()=>{he.hidden=!1,I(".report-status",he).textContent="",I("textarea",he).focus()}})),I(".panel").append(he),he.addEventListener("submit",async t=>{t.preventDefault();let n=I("textarea",he).value.trim(),r=I(".report-status",he);if(!n)return I("textarea",he).focus();r.textContent="Sending\u2026";try{let o={"content-type":"application/json",...Se?{"X-Austere-Invite":Se}:{}},i=await fetch(H.report,{method:"POST",headers:o,body:JSON.stringify({reason:n})});if(!i.ok)throw new Error(`HTTP ${i.status}`);I("textarea",he).value="",he.hidden=!0,I(".report-open",e).replaceWith(v("span",{class:"report-done",text:"Reported. Thank you."}))}catch(o){r.textContent=`Not sent: ${o.message}`}})),I(".panel").append(e)}var Bi=I(".frame"),B=I(".log"),Fe=I(".composer textarea"),Ri=I(".banner");I(".title").textContent=$e.title;fe&&(I(".file").textContent=$e.name);Rf();var pe=new Li({chips:I(".viewers"),showFocus:e=>Ue({type:"presence",marks:e}),reveal:e=>Ue({type:"reveal",id:e}),name:()=>ge||void 0});Fe.addEventListener("focus",()=>pe.setWriting("composer",!0));Fe.addEventListener("blur",()=>pe.setWriting("composer",!1));window.addEventListener("pagehide",()=>pe.leave());I(".file").title=$e.file||"";document.title=`${$e.title} \xB7 austere`;function Mi(e){return String(e).replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function Sf(e){return Mi(e).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>").replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,'<a href="$2" target="_blank" rel="noopener">$1</a>')}function __(e){let t=String(e).replace(/\r\n/g,`
119
+ </div>`;if(!se){let e=['[data-cmd="copy-path"]','[data-cmd="copy-agent-prompt"]','[data-cmd="end"]','[data-cmd="close"]','[data-cmd="reopen"]',".send-end"];F||e.push('[data-cmd="copy-link"]','[data-cmd="export"]');for(let t of e)S(t)?.remove()}function Mf(){if(se)return;S(".file").textContent=be?`reviewing as ${be}`:"";let e=F||Df.auto?"Enter sends":"the owner sends your notes on \xB7 Enter sends";S(".composer-hint").textContent=be?`Posting as ${be} \xB7 ${e}`:e}var it=F?v("form",{class:"name-ask",hidden:!0},v("label",{for:"austere-name",text:"Your name, shown with your notes"}),v("div",{class:"name-row"},v("input",{id:"austere-name",maxlength:String(xr),autocomplete:"name",placeholder:"Name"}),v("button",{type:"submit",class:"btn primary",text:"Continue"}))):null;it&&(S(".composer").before(it),it.addEventListener("submit",e=>{e.preventDefault();let t=S("input",it),n=t.value.trim().slice(0,xr);if(!n)return t.focus();be=n,Be.set("austere:name",n),it.hidden=!0,Mf(),pe.rename(),Sr(!1)}));var ge=F?.report?v("form",{class:"report-box",hidden:!0},v("label",{for:"austere-report",text:"What is wrong with this page?"}),v("textarea",{id:"austere-report",rows:"3",maxlength:"1000"}),v("div",{class:"report-row"},v("span",{class:"report-status"}),v("button",{type:"button",class:"btn tiny ghost",text:"Cancel",onclick:()=>{ge&&(ge.hidden=!0)}}),v("button",{type:"submit",class:"btn tiny primary",text:"Send report"}))):null;if(F){let e=v("footer",{class:"hosted-foot"},v("a",{href:"https://github.com/MandalorianBatman/austere-axi",target:"_blank",rel:"noopener noreferrer",text:"Made with austere-axi"}));ge&&(e.append(v("span",{"aria-hidden":"true",text:"\xB7"}),v("button",{type:"button",class:"link-btn report-open",text:"Report",onclick:()=>{ge.hidden=!1,S(".report-status",ge).textContent="",S("textarea",ge).focus()}})),S(".panel").append(ge),ge.addEventListener("submit",async t=>{t.preventDefault();let n=S("textarea",ge).value.trim(),r=S(".report-status",ge);if(!n)return S("textarea",ge).focus();r.textContent="Sending\u2026";try{let o={"content-type":"application/json",...Ie?{"X-Austere-Invite":Ie}:{}},i=await fetch(F.report,{method:"POST",headers:o,body:JSON.stringify({reason:n})});if(!i.ok)throw new Error(`HTTP ${i.status}`);S("textarea",ge).value="",ge.hidden=!0,S(".report-open",e).replaceWith(v("span",{class:"report-done",text:"Reported. Thank you."}))}catch(o){r.textContent=`Not sent: ${o.message}`}})),S(".panel").append(e)}var Bi=S(".frame"),J=S(".log"),Fe=S(".composer textarea"),wr=S(".banner");S(".title").textContent=de.title;se&&(S(".file").textContent=de.name);Mf();var pe=new Di({chips:S(".viewers"),showFocus:e=>Ue({type:"presence",marks:e}),reveal:e=>Ue({type:"reveal",id:e}),name:()=>be||void 0});Fe.addEventListener("focus",()=>pe.setWriting("composer",!0));Fe.addEventListener("blur",()=>pe.setWriting("composer",!1));window.addEventListener("pagehide",()=>pe.leave());S(".file").title=de.file||"";document.title=`${de.title} \xB7 austere`;function Vi(e){return String(e).replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function Sf(e){return Vi(e).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>").replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,'<a href="$2" target="_blank" rel="noopener">$1</a>')}function O_(e){let t=String(e).replace(/\r\n/g,`
118
120
  `).split(`
119
- `),n=[],r=0;for(;r<t.length;){let o=t[r];if(/^```/.test(o)){let s=[];for(r++;r<t.length&&!/^```/.test(t[r]);)s.push(t[r++]);r++,n.push(`<pre><code>${Mi(s.join(`
120
- `))}</code></pre>`);continue}if(/^\s*([-*]|\d+\.)\s+/.test(o)){let s=/^\s*\d+\./.test(o),a=[];for(;r<t.length&&/^\s*([-*]|\d+\.)\s+/.test(t[r]);)a.push(t[r++].replace(/^\s*([-*]|\d+\.)\s+/,""));n.push(`<${s?"ol":"ul"}>${a.map(c=>`<li>${Sf(c)}</li>`).join("")}</${s?"ol":"ul"}>`);continue}if(/^#{1,6}\s+/.test(o)){n.push(`<p><strong>${Sf(o.replace(/^#+\s+/,""))}</strong></p>`),r++;continue}if(!o.trim()){r++;continue}let i=[];for(;r<t.length&&t[r].trim()&&!/^```|^\s*([-*]|\d+\.)\s+|^#{1,6}\s/.test(t[r]);)i.push(t[r++]);n.push(`<p>${i.map(Sf).join("<br>")}</p>`)}return n.join("")}function Ue(e){Bi.contentWindow?.postMessage({austere:1,...e},"*")}function Df(){h.frameReady=!1,H?uh():Bi.src=`${$e.artifactUrl??`${ie}/a/`}?r=${Date.now()}`}window.addEventListener("message",e=>{if(e.source!==Bi.contentWindow)return;let t=e.data;if(!(!t||t.austere!==1))switch(t.type){case"hello":Ue({type:"init",mode:h.closed?"explore":h.mode,state:Ee.get(`austere:form:${ze}`),scrollY:h.scrollY});break;case"ready":h.frameReady=!0,t.title&&(I(".title").textContent=t.title,document.title=`${t.title} \xB7 austere`),h.highlight&&Nf(!1),pe.redraw(),pe.setWriting("note",!1);break;case"annotate":Vi(t.item);break;case"focus":typeof t.id=="string"&&pe.setFocus(t.id);break;case"writing":pe.setWriting("note",t.on===!0);break;case"action":Vi(t.item),O_();break;case"errors":h.parserErrors=(t.errors||[]).filter(r=>r.severity!=="warning"),h.errorsRevision=h.revision,q(),Af();break;case"runtime-error":let n=t.error;n&&!h.runtimeErrors.some(r=>r.statementId===n.statementId&&r.message===n.message)&&(h.runtimeErrors.push(n),h.errorsRevision=h.revision,q(),Af());break;case"state":Ee.set(`austere:form:${ze}`,t.state);break;case"scroll":h.scrollY=t.y||0;break;case"changes":h.changes=Array.isArray(t.ids)?t.ids.filter(r=>typeof r=="string").slice(0,50):[],Mf(),h.highlight&&Nf(!1);break;case"toggle-mode":bn(h.mode==="annotate"?"explore":"annotate");break;case"open-url":$_(t.url);break}});function $_(e){let t;try{t=new URL(String(e))}catch{return}!/^(https?|mailto):$/.test(t.protocol)||t.origin===location.origin||window.open(t.href,"_blank","noopener")}function kr(){Be.set(`austere:queue:${ze}`,h.queue)}function Vi(e){if(h.closed||!e||typeof e!="object"||typeof e.kind!="string")return;let t=e;for(let r of["target","component","note","text","selection","excerpt","message","statement"])r in t&&(t[r]=yn(t[r]));let n=e;n.qid=`q${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,h.queue.push(n),kr(),q(!0),Ze()}var Qm;function Af(){!fe||h.closed||h.thirdParty||(clearTimeout(Qm),Qm=setTimeout(async()=>{let e=[...h.parserErrors,...h.runtimeErrors].map(n=>({statement:yn(n.statementId),message:yn(n.message)}));if(!e.length)return;let t=await fetch(`${ie}/render-errors`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({revision:h.errorsRevision,errors:e})}).then(async n=>n.ok?await n.json():null,()=>null);h.renderReport=t&&!t.stale?"sent":t?null:"failed",q()},500))}function ih(e){h.queue=h.queue.filter(t=>t.qid!==e),kr(),q(),Ze()}function w_(e){return e.kind==="annotation"?{icon:"\u270E",text:e.target,sub:e.component}:e.kind==="action"?{icon:"\u2197",text:e.message,sub:"button"}:e.kind==="render-error"?{icon:"!",text:e.statement||"page",sub:"render issue"}:{icon:"",text:"",sub:""}}function Ji(e,t=""){let n=[];for(let[r,o]of Object.entries(e||{}))o&&typeof o=="object"&&!Array.isArray(o)?n.push(...Ji(o,"")):n.push(`${t}${r}: ${Array.isArray(o)?o.join(", "):o}`);return n}var yn=e=>typeof e=="string"?e:e==null?"":String(e);function v_(e){if(e.selection)return e.selection;if(e.detail?.part)return e.excerpt?`${e.detail.part} ${e.excerpt}`:e.detail.part;if(e.detail?.column){let t=[e.detail.row&&`row ${e.detail.row}`,`column ${e.detail.column}`].filter(Boolean).join(", ");return e.excerpt?`${e.excerpt} (${t})`:t}return e.kind==="action"&&e.form?Ji(e.form).join(" \xB7 "):e.kind==="render-error"?e.message:e.excerpt||""}function eh(e,t={}){try{return k_(e,t)}catch{return v("div",{class:"item"},v("div",{class:"note",text:"This note could not be displayed."}))}}function k_(e,{queued:t,held:n}={}){let r=w_(e),o=v("div",{class:`item kind-${e.kind}`});if(r.text){let a=v("button",{type:"button",class:"anchor",title:e.kind==="annotation"?"Show in the page":"",onclick:()=>{(e.kind==="annotation"||e.kind==="render-error")&&(Ue({type:"reveal",id:e.target||e.statement}),Vf()&&ut(!1))}},v("span",{class:"anchor-icon",text:r.icon}),v("span",{class:"anchor-text",text:r.text}),r.sub?v("span",{class:"anchor-sub",text:r.sub}):null);o.append(a)}if(n&&e.kind==="annotation"){let a=(Array.isArray(e.path)?e.path:[]).slice(0,-1).filter(c=>typeof c=="string"&&c!=="root");a.length&&o.append(v("div",{class:"anchor-sub",text:`within ${a.join(" > ")}`})),e.detail&&typeof e.detail=="object"&&o.append(v("div",{class:"anchor-sub",text:Ji(e.detail).join(" \xB7 ")}))}let i=yn(v_(e));i&&o.append(v("blockquote",{text:n||i.length<=260?i:i.slice(0,259)+"\u2026"}));let s=e.kind==="message"?e.text:e.note;if(t&&h.editing===e.qid){let a=v("textarea",{class:"edit",rows:"2"});a.value=s||"";let c=()=>{let u=a.value.trim();if(e.kind==="message"){if(!u)return ih(e.qid);e.text=u}else e.note=u;h.editing=null,kr(),q()};a.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey?(u.preventDefault(),c()):u.key==="Escape"&&(h.editing=null,q())}),a.addEventListener("blur",c),o.append(a),setTimeout(()=>a.focus(),0)}else s&&o.append(v("div",{class:"note",text:s}));return o}function Ef(e){return e?new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):""}function x_(e){return fe?e.author||"You":e.author===ge?"You":e.author||"Owner"}async function Fi(e,t){try{await fetch(`${ie}/${e}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{ids:t}:{all:!0})})}catch{ct("Could not reach the server. Try again.")}}function z_(e){if(H)return e.pending?v("div",{class:"receipt"},v("em",{text:"Sending\u2026"})):e.author===ge?v("div",{class:"receipt"},v("em",{text:"Sent to the page owner"})):null;if(e.held){let r=v("div",{class:"receipt held"},v("span",{class:"held-label",text:fe?"Held \xB7 not sent to the agent":"Waiting for the owner to send it on"}));return fe&&r.append(v("button",{type:"button",class:"btn tiny primary",text:"Send",onclick:()=>Fi("release",[e.id])}),v("button",{type:"button",class:"btn tiny ghost",text:"Discard",onclick:()=>Fi("discard",[e.id])})),r}let t=[["Seen",e.seenAt],["Working",e.workAt],["Done",e.doneAt]],n=v("div",{class:"receipt"});for(let[r,o]of t)n.append(v("span",{class:o?"on":"",title:o?`${r} ${Ef(o)}`:`Not ${r.toLowerCase()} yet`,text:r}));return e.seenAt||n.append(v("em",{text:h.presence==="listening"?"":h.unread?`waiting for the agent (${h.unread} unread)`:"waiting for the agent"})),n}var th=0;function q(e=!1){let t=B.scrollHeight-B.scrollTop-B.clientHeight<40;B.textContent="";let n=[...h.parserErrors,...h.runtimeErrors];if(n.length){let a=fe&&h.renderReport==="sent",c=`Render issues (${n.length})${a?" \xB7 sent to the agent":""}`,u=v("div",{class:"issues"},v("div",{class:"issues-head",text:c}));for(let l of n.slice(0,8))u.append(v("div",{class:"issue"},v("div",{class:"issue-text"},l.statementId?v("code",{text:l.statementId}):null," ",l.message),h.closed||a?null:v("button",{type:"button",class:"btn tiny",text:"Queue fix",onclick:()=>Vi({kind:"render-error",statement:l.statementId,target:l.statementId,message:l.message,note:"Fix this render error."})})));B.append(u)}h.more&&B.append(v("button",{type:"button",class:"btn tiny ghost load-earlier",text:"Load earlier messages",onclick:A_}));let r=oh().map(a=>({id:`out:${a.m.clientId}:${a.m.n}`,role:"user",author:ge,items:a.m.args.items,at:a.at,pending:!0})),o=r.length?[...h.transcript,...r]:h.transcript;!o.length&&!h.queue.length&&B.append(v("div",{class:"empty"},v("p",{html:"<strong>Point at anything to comment on it.</strong>"}),v("p",{text:`In Annotate mode, click a section, table cell, diagram node or diff line, or select text. Notes queue here; Send delivers them to the ${H?"page owner":"agent"}.`})));for(let a of o)if(a.role==="agent")B.append(v("div",{class:"msg agent"},v("div",{class:"who",text:`Agent \xB7 ${Ef(a.at)}`}),v("div",{class:"md",html:__(a.text)})));else{let c=v("div",{class:`msg user${a.held?" held":""}`},v("div",{class:"who",text:`${x_(a)} \xB7 ${Ef(a.at)}${a.end?" \xB7 ended review":""}`}));for(let l of a.items||[])c.append(eh(l,{held:!!a.held}));let u=z_(a);u&&c.append(u),B.append(c)}let i=fe?h.transcript.filter(a=>a.held).length:0;if(i&&B.append(v("div",{class:"held-bar"},v("span",{text:`${i} held from teammates`}),v("button",{type:"button",class:"btn tiny primary",text:"Send all",onclick:()=>Fi("release",h.transcript.filter(a=>a.held).map(a=>a.id))}),v("button",{type:"button",class:"btn tiny ghost",text:"Discard all",onclick:()=>Fi("discard")}))),h.queue.length){let a=v("div",{class:"queued"},v("div",{class:"queued-head",text:`Queued \xB7 ${h.queue.length}`}));for(let c of h.queue){let u=eh(c,{queued:!0});u.classList.add("q"),u.append(v("div",{class:"q-actions"},v("button",{type:"button",class:"btn tiny ghost",text:"Edit",onclick:()=>{h.editing=c.qid,q()}}),v("button",{type:"button",class:"btn tiny ghost",text:"Remove",onclick:()=>ih(c.qid)}))),a.append(u)}B.append(a)}if(h.closed)B.append(v("div",{class:"ended-note",text:fe?"You closed this review.":"The owner closed this review."}));else if(h.status==="ended"){let a=h.endedBy==="agent"?"The agent ended this review.":fe?"You ended this review.":"The owner ended this review.";B.append(v("div",{class:"ended-note",text:`${a} Notes you send now reach the agent the next time it polls.`}))}let s=o.length+h.queue.length;(e||t||s!==th)&&(B.scrollTop=B.scrollHeight),th=s,Ki()}function Ki(){let e=h.closed,t=h.queue.length;Fe.disabled=e||!!at||h.sending,I(".send").disabled=e||!!at||h.sending||!!H&&Ve===void 0,I(".send-end")&&(I(".send-end").disabled=e||h.sending),I(".send").textContent=h.sending?"Sending\u2026":t?`Send ${t}`:"Send",Fe.placeholder=e?"Review closed":t?"Add a message (optional)\u2026":"Message the agent\u2026"}function ct(e){let t=I(".composer-error");t.textContent=e||"",t.hidden=!e}async function xr(e=!1){if(h.sending||h.closed)return;let t=Fe.value.trim(),n=h.queue.map(({qid:r,...o})=>o);if(t&&n.push({kind:"message",text:t}),!n.length&&!e){Fe.focus();return}if(!(e&&!fe)&&!(e&&!n.length&&!confirm("End this review? The agent will stop listening; notes you send later still reach it."))){if(H)return P_(n);h.sending=!0,ct(""),Ki();try{let r=await fetch(`${ie}/send`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({items:n,end:e})}),o=await r.json().catch(()=>({}));if(!r.ok)throw new Error(o.error||`HTTP ${r.status}`);h.queue=[],kr(),Fe.value="";let i=o.entry;i&&!h.transcript.some(s=>s.id===i.id)&&h.transcript.push(i)}catch(r){ct(`Not sent: ${r.message}. Your notes are still queued.`)}finally{h.sending=!1,q(!0),Ze()}}}function S_(e){if(e.kind==="message")return{kind:"message",text:yn(e.text)};if(e.kind==="action")return{kind:"message",text:[yn(e.message),e.form?Ji(e.form).join(" \xB7 "):""].filter(Boolean).join(" \xB7 ")};let t={kind:"annotation"},n=e.kind==="render-error"?e.statement:e.target;typeof n=="string"&&n&&(t.target=n);for(let o of["component","selection","excerpt","note"]){let i=e[o];typeof i=="string"&&i&&(t[o]=i)}e.kind==="render-error"&&typeof e.message=="string"&&(t.excerpt=e.message),Array.isArray(e.path)&&(t.path=e.path.filter(o=>typeof o=="string"));let r=e.detail;if(r&&typeof r=="object"){let o={};for(let i of["part","row","column"])typeof r[i]=="string"&&(o[i]=r[i]);Number.isInteger(r.rowIndex)&&(o.rowIndex=r.rowIndex),Object.keys(o).length&&(t.detail=o)}return t}var I_="This browser could not keep a copy of your note: keep this tab open until it shows \u201CSent to the page owner\u201D.";function Zf(){ct([Of,$r?I_:""].filter(Boolean).join(" "))}function jf(e){let t=(e.retryAt??0)-Date.now();if(t<=0){delete e.retryAt,wr?.send(e.m);return}zf.has(e)||zf.set(e,window.setTimeout(()=>{zf.delete(e),xe.includes(e)&&e.as===Lf()&&jf(e)},t))}function P_(e){if(at||Ve===void 0)return;if(Ve===null&&!ge&&it){it.hidden=!1,I("input",it).focus();return}let t=e.map(S_),n=new TextEncoder().encode(JSON.stringify(t)).length;if(n>Ot.noteItemsBytes){ct(`Too long to send: ${n} bytes, the limit is ${Ot.noteItemsBytes}. Shorten or remove a note.`);return}let o=qm("addNote",Ve===null?{items:t,name:ge}:{items:t},{clientId:rh,n:++b_});xe.push({m:o,at:Date.now(),as:Lf()}),$r=!Ee.set(ji,xe),wr?.send(o),h.queue=[],kr(),Fe.value="",Zf(),q(!0),Ze()}I(".composer").addEventListener("submit",e=>{e.preventDefault(),xr(!1)});I(".send-end")?.addEventListener("click",()=>xr(!0));Fe.addEventListener("keydown",e=>{e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),xr(!1))});function bn(e){h.mode=e==="explore"?"explore":"annotate",Be.set("austere:mode",h.mode);let t=document.documentElement,n=t.classList.contains("exploring");t.classList.toggle("exploring",h.mode==="explore"),n&&h.mode==="annotate"&&(B.scrollTop=B.scrollHeight);for(let r of document.querySelectorAll(".seg button"))r.classList.toggle("on",r.dataset.mode===h.mode);Ue({type:"mode",mode:h.closed?"explore":h.mode})}for(let e of document.querySelectorAll(".seg button"))e.addEventListener("click",()=>bn(e.dataset.mode));document.addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&(e.key==="i"||e.key==="I")&&(e.preventDefault(),bn(h.mode==="annotate"?"explore":"annotate"))});function je(){let e=I(".presence"),t,n;h.closed?[t,n]=["Review closed","ended"]:at?[t,n]=[at,"ended"]:h.connected?H?[t,n]=["Shared page","hosted"]:h.presence==="listening"?[t,n]=["Agent listening","listening"]:h.presence==="working"?[t,n]=["Agent working","working"]:h.status==="ended"?[t,n]=["Agent stopped","idle"]:[t,n]=["Agent not listening","idle"]:[t,n]=["Reconnecting\u2026","off"],n==="idle"&&h.unread&&(t+=` \xB7 ${h.unread} waiting`),e.className=`presence ${n}`,e.textContent=t,e.title=n==="idle"?"Your notes are kept and reach the agent the next time it polls.":n==="working"?"The agent has your last batch.":n==="hosted"?"Notes go to the page owner. Replies show up here as they are posted.":"",document.documentElement.classList.toggle("is-ended",h.closed),fe&&(I('[data-cmd="end"]').hidden=h.status==="ended",I('[data-cmd="close"]').hidden=h.closed,I('[data-cmd="reopen"]').hidden=!h.closed&&h.status!=="ended"),Ze()}function Mf(){let e=I(".changes");if(e.setAttribute("aria-pressed",String(h.highlight)),!h.changes.length&&!h.highlight){e.hidden=!0;return}e.hidden=!1,e.textContent=`${h.changes.length} changed`,e.title=h.changes.length?`${h.highlight?"Hide":"Highlight"} what the last turn changed: ${h.changes.join(", ")}`:"The last turn changed nothing on the page. Click to stop highlighting."}function Nf(e){Ue({type:"highlight",ids:h.highlight?h.changes:[],scroll:e})}I(".changes").addEventListener("click",()=>{h.highlight=!h.highlight,Mf(),Nf(h.highlight)});var Ui=I(".menu-pop");I(".menu-btn").addEventListener("click",e=>{e.stopPropagation(),Ui.hidden=!Ui.hidden});document.addEventListener("click",()=>Ui.hidden=!0);Ui.addEventListener("click",async e=>{let t=e.target instanceof Element?e.target.closest("[data-cmd]")?.dataset.cmd:void 0;if(t){if(t==="copy-path"&&navigator.clipboard?.writeText($e.file),t==="copy-link"&&navigator.clipboard?.writeText(h.links?.remote||location.href),t==="reload"&&Df(),t==="end"){if(h.queue.length)return xr(!0);if(!confirm("End this review? The agent will stop listening."))return;await fetch(`${ie}/end`,{method:"POST"}).catch(()=>{})}if(t==="close"){if(!confirm("Close this review? No one can add notes until you reopen it."))return;await fetch(`${ie}/close`,{method:"POST"}).catch(()=>{})}t==="reopen"&&await fetch(`${ie}/reopen`,{method:"POST"}).catch(()=>{})}});var Vf=()=>window.matchMedia("(max-width: 860px)").matches;function ut(e){h.sheetOpen=e,Ee.set(`austere:sheet:${ze}`,e),document.documentElement.classList.toggle("sheet-open",e),e&&setTimeout(()=>B.scrollTop=B.scrollHeight,50)}function Ze(){let e=I(".dock"),t=h.queue.length,n=["Conversation"];t&&n.push(`${t} queued`);let r=h.transcript[h.transcript.length-1];r?.role==="agent"&&r.at>(Ee.get(`austere:seen:${ze}`)||0)&&n.push("new reply"),e.innerHTML=`<span class="dock-grip"></span><span>${Mi(n.join(" \xB7 "))}</span><span class="dock-presence ${Mi(I(".presence").className.replace("presence","").trim())}"></span>`}function O_(){let e=I(".dock");e.classList.remove("pulse"),e.offsetWidth,e.classList.add("pulse")}I(".dock").addEventListener("click",()=>{Ee.set(`austere:seen:${ze}`,Date.now()),ut(!0),Ze()});I(".sheet-close").addEventListener("click",()=>ut(!1));I(".scrim").addEventListener("click",()=>ut(!1));document.addEventListener("keydown",e=>{e.key==="Escape"&&h.sheetOpen&&Vf()&&ut(!1)});var st=null;I(".panel-head").addEventListener("touchstart",e=>st=e.touches[0].clientY,{passive:!0});I(".panel-head").addEventListener("touchend",e=>{st!=null&&e.changedTouches[0].clientY-st>60&&ut(!1),st=null},{passive:!0});I(".dock").addEventListener("touchstart",e=>st=e.touches[0].clientY,{passive:!0});I(".dock").addEventListener("touchend",e=>{st!=null&&st-e.changedTouches[0].clientY>40&&ut(!0),st=null},{passive:!0});function Tf(e){let t=I(".notice");if(!e||!e.length){t.hidden=!0;return}t.textContent=`Third-party pack code runs in this page: check queued items before you send (${e.join(", ")}).`,t.title=t.textContent,t.hidden=!1}function Me(e,t=[]){if(Ri.textContent="",!e){Ri.hidden=!0;return}Ri.append(v("span",{text:e}),...t),Ri.hidden=!1}function sh(e){for(let t of e){let n=h.transcript.findIndex(r=>r.id===t.id);t.discarded?n>=0&&h.transcript.splice(n,1):n>=0?h.transcript[n]=t:h.transcript.push(t)}h.transcript.sort((t,n)=>t.at-n.at)}async function A_(){let e=h.transcript[0];if(e)try{let t=await fetch(`${ie}/transcript?before=${encodeURIComponent(e.id)}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);let n=await t.json(),r=new Set(h.transcript.map(i=>i.id));h.transcript=[...(n.entries||[]).filter(i=>!i.discarded&&!r.has(i.id)),...h.transcript],h.more=!!n.more;let o=B.scrollHeight-B.scrollTop;q(),B.scrollTop=B.scrollHeight-o}catch(t){ct(`Could not load earlier messages: ${t.message}`)}}var nh=null,Di=0;function E_(){nh=new EventSource(`${ie}/events`);let e=nh;if(e.addEventListener("open",()=>{h.connected=!0,Di=0,Me(""),je()}),e.addEventListener("error",()=>{h.connected=!1,Di||(Di=Date.now()),je(),setTimeout(()=>{!h.connected&&Date.now()-Di>3500&&Me("Lost the austere-axi server. Run any austere-axi command to restart it; this page reconnects on its own.",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})])},4e3)}),fe){let t=n=>{fetch(`${ie}/presence`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)}).catch(()=>{})};e.addEventListener("open",()=>pe.connect(t)),e.addEventListener("error",()=>pe.disconnect()),e.addEventListener("viewer",n=>{let r=Ci(n.data),o=r.ok?r.value:null;o&&(o.t==="hello"||o.t==="status"||o.t==="focus"||o.t==="bye")&&pe.handle(o)})}e.addEventListener("snapshot",t=>{let n=JSON.parse(t.data);h.transcript=(n.transcript||[]).filter(r=>!r.discarded),h.presence=n.presence,h.status=n.session.status,h.endedBy=n.session.endedBy,h.closed=!!n.session.closed,h.unread=n.session.unread||0,h.more=!!n.more,h.links=n.links,n.version&&n.version!==$e.version&&Me("austere-axi was updated. This page is running the previous version.",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]),Tf(n.thirdPartyPacks),h.thirdParty=!!n.thirdPartyPacks?.length,h.program===null||n.revision===h.revision||n.program===h.program?(n.revision!==h.revision&&(h.errorsRevision=n.revision),h.revision=n.revision,Af()):(h.revision=n.revision,h.parserErrors=[],h.runtimeErrors=[],h.renderReport=null),h.program===null?h.program=n.program:n.program!==h.program&&(h.program=n.program,h.frameReady&&Ue({type:"source",program:n.program})),je(),q(),bn(h.mode)}),e.addEventListener("transcript",t=>{sh(JSON.parse(t.data).entries||[]),q(),Ze()}),e.addEventListener("presence",t=>{let n=JSON.parse(t.data);h.presence=n.presence,h.status=n.status,h.endedBy=n.endedBy,h.closed=!!n.closed,h.unread=n.unread||0,bn(h.mode),je(),q()}),e.addEventListener("changed",t=>{let n=JSON.parse(t.data);h.revision=n.revision,h.renderReport=null,h.parserErrors=[],h.runtimeErrors=[],Tf(n.thirdPartyPacks),h.thirdParty=!!n.thirdPartyPacks?.length,n.shellChanged||!h.frameReady?(h.program=n.program,h.changes=[],Mf(),Df()):(h.program=n.program,Ue({type:"source",program:n.program})),q()}),e.addEventListener("ended",t=>{let n=JSON.parse(t.data);h.status="ended",h.endedBy=n.by,n.closed&&(h.closed=!0,Ue({type:"mode",mode:"explore"})),je(),q()}),e.addEventListener("server",t=>{let n=JSON.parse(t.data);if(n.state==="revoked"){e.close(),h.connected=!1,Me("Your invite was revoked. Ask the owner for a new link.");return}n.state==="stopped"&&Me("The austere-axi server stopped. Run any austere-axi command to start it again; this page reconnects on its own.")})}var If=H?.publishedAt,ah=0;function gn(e,t,n=[]){at=e,h.connected=!1,wr?.stop(),Me(t,n),je(),Ki()}function Ff(e){if(e===403)Se?gn("Invite no longer valid","This invite is no longer valid. Ask the page owner for a new link."):gn("Invite required","This page is invite-only. Open it from the link the page owner sent you.");else if(e===404||e===410)gn("Page removed","This page is no longer available.");else return!1;return!0}async function ch(e){let t=await fetch(`${ie}/asset-token`,{method:"POST",headers:Se?{"X-Austere-Invite":Se}:{},signal:e});if(!t.ok)return{status:t.status};let n=await t.json().catch(()=>null),r=typeof n?.token=="string"&&/^[A-Za-z0-9_-]+$/.test(n.token)?n.token:void 0;return{status:t.status,token:r,name:typeof n?.name=="string"&&n.name?n.name.slice(0,vr):null}}async function uh(){let e=await ch().catch(()=>null);return e&&Ff(e.status)?!1:e?.token?(Ve=e.name??null,Ve?ge=Ve:(Se&&(Se=null,Be.remove(Pf)),ge=String(Be.get("austere:name","")||"").slice(0,vr)),Rf(),Ki(),Bi.src=`${$e.artifactUrl??`${ie}/a/`}${e.token}/`,!0):(Me(`Could not load this page${e?` (HTTP ${e.status})`:""}.`,[v("button",{type:"button",class:"btn tiny",text:"Retry",onclick:()=>lh()})]),!1)}function Z_(e){e.reset&&(h.transcript=[]);let t=[];for(let n of e.rows)n.type==="page"?N_(n):n.type==="note"?t.push({id:`note:${n.id}`,role:"user",author:n.author.slice(0,vr),items:n.items,at:n.at,discarded:n.state==="discarded"}):n.type==="reply"&&t.push({id:`reply:${n.id}`,role:"agent",text:n.text,at:n.at});sh(t),ah=e.cursor,q(),Ze()}function N_(e){if(e.deleted)return gn("Page removed","The owner removed this page.");If??(If=e.publishedAt),e.publishedAt!==If&&Me("New version, reload",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]),Tf(e.packs.map(t=>t.name))}function T_(e){let t=xe.findIndex(o=>o.m.clientId===e.clientId&&o.m.n===e.n);if(t<0)return;if(e.error?.code==="rate_limited"){let o=xe[t],i=Math.max(1,e.error.retryAfter??5);o.retryAt=Date.now()+i*1e3,$r=!Ee.set(ji,xe),Of=`Too many notes for now: sending again in ${i} s.`,Zf(),jf(o);return}let[n]=xe.splice(t,1),r=Ee.set(ji,xe);if($r&&(r||!xe.length)&&($r=!1),xe.some(o=>o.retryAt)||(Of=null),Zf(),e.error){for(let o of n.m.args.items)Vi({...o});ct(`Not sent: ${e.error.message}. Your notes are back in the queue.`)}q(),Ze()}function C_(e){e.t==="changes"?Z_(e):e.t==="ack"?T_(e):e.t==="error"&&e.code!=="forbidden"&&e.code!=="upgrade_required"&&ct(e.message)}function L_(e,t){h.connected=!1,!t&&!at&&(e.error?.code==="upgrade_required"?gn("Update needed","This page needs a newer review page. Reload to get it.",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]):e.code===1e3&&!e.error?gn("Page removed","This page is no longer available."):Ff(403)),je()}var R_=5e3;async function lh(){if(Me(""),!await uh()||wr)return;let e=Gm({url:`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${ie}/sync`,protocols:()=>Wm(Se?{invite:Se}:{}),mayRetry:async t=>{if(at)return!1;if(t.opened)return!0;let n=await ch(AbortSignal.timeout(R_)).catch(()=>null);return!(n&&Ff(n.status))}});wr=e,e.onOpen(()=>{h.connected=!0,e.send({v:kf,t:"pull",after:ah});for(let t of oh())jf(t);je()}),e.onFrame(C_),e.onClose(L_),e.onOpen(()=>pe.connect(t=>{e.send(t)})),e.onFrame(t=>{(t.t==="hello"||t.t==="status"||t.t==="focus"||t.t==="bye")&&pe.handle(t)}),e.onClose(()=>pe.disconnect())}H||window.addEventListener("pagehide",e=>{e.persisted||navigator.sendBeacon?.(`${ie}/bye`)});bn(h.mode);Vf()&&h.sheetOpen&&ut(!0);je();q();Ze();H?lh():(Df(),E_());})();
121
+ `),n=[],r=0;for(;r<t.length;){let o=t[r];if(/^```/.test(o)){let s=[];for(r++;r<t.length&&!/^```/.test(t[r]);)s.push(t[r++]);r++,n.push(`<pre><code>${Vi(s.join(`
122
+ `))}</code></pre>`);continue}if(/^\s*([-*]|\d+\.)\s+/.test(o)){let s=/^\s*\d+\./.test(o),a=[];for(;r<t.length&&/^\s*([-*]|\d+\.)\s+/.test(t[r]);)a.push(t[r++].replace(/^\s*([-*]|\d+\.)\s+/,""));n.push(`<${s?"ol":"ul"}>${a.map(c=>`<li>${Sf(c)}</li>`).join("")}</${s?"ol":"ul"}>`);continue}if(/^#{1,6}\s+/.test(o)){n.push(`<p><strong>${Sf(o.replace(/^#+\s+/,""))}</strong></p>`),r++;continue}if(!o.trim()){r++;continue}let i=[];for(;r<t.length&&t[r].trim()&&!/^```|^\s*([-*]|\d+\.)\s+|^#{1,6}\s/.test(t[r]);)i.push(t[r++]);n.push(`<p>${i.map(Sf).join("<br>")}</p>`)}return n.join("")}function Ue(e){Bi.contentWindow?.postMessage({austere:1,...e},"*")}function Vf(){h.frameReady=!1,F?bh():Bi.src=`${de.artifactUrl??`${X}/a/`}?r=${Date.now()}`}window.addEventListener("message",e=>{if(e.source!==Bi.contentWindow)return;let t=e.data;if(!(!t||t.austere!==1))switch(t.type){case"hello":Ue({type:"init",mode:h.closed?"explore":h.mode,state:Ne.get(`austere:form:${Se}`),scrollY:h.scrollY});break;case"ready":h.frameReady=!0,t.title&&(S(".title").textContent=t.title,document.title=`${t.title} \xB7 austere`),h.highlight&&Zf(!1),pe.redraw(),pe.setWriting("note",!1);break;case"annotate":Fi(t.item);break;case"focus":typeof t.id=="string"&&pe.setFocus(t.id);break;case"writing":pe.setWriting("note",t.on===!0);break;case"action":Fi(t.item),F_();break;case"errors":h.parserErrors=(t.errors||[]).filter(r=>r.severity!=="warning"),h.errorsRevision=h.revision,H(),Af();break;case"runtime-error":let n=t.error;n&&!h.runtimeErrors.some(r=>r.statementId===n.statementId&&r.message===n.message)&&(h.runtimeErrors.push(n),h.errorsRevision=h.revision,H(),Af());break;case"state":Ne.set(`austere:form:${Se}`,t.state);break;case"scroll":h.scrollY=t.y||0;break;case"changes":h.changes=Array.isArray(t.ids)?t.ids.filter(r=>typeof r=="string").slice(0,50):[],Uf(),h.highlight&&Zf(!1);break;case"toggle-mode":_n(h.mode==="annotate"?"explore":"annotate");break;case"open-url":A_(t.url);break}});function A_(e){let t;try{t=new URL(String(e))}catch{return}!/^(https?|mailto):$/.test(t.protocol)||t.origin===location.origin||window.open(t.href,"_blank","noopener")}function zr(){Be.set(`austere:queue:${Se}`,h.queue)}function Fi(e){if(h.closed||!e||typeof e!="object"||typeof e.kind!="string")return;let t=e;for(let r of["target","component","note","text","selection","excerpt","message","statement"])r in t&&(t[r]=bn(t[r]));let n=e;n.qid=`q${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,h.queue.push(n),zr(),H(!0),Ze()}var ah;function Af(){!se||h.closed||h.thirdParty||(clearTimeout(ah),ah=setTimeout(async()=>{let e=[...h.parserErrors,...h.runtimeErrors].map(n=>({statement:bn(n.statementId),message:bn(n.message)}));if(!e.length)return;let t=await fetch(`${X}/render-errors`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({revision:h.errorsRevision,errors:e})}).then(async n=>n.ok?await n.json():null,()=>null);h.renderReport=t&&!t.stale?"sent":t?null:"failed",H()},500))}function mh(e){h.queue=h.queue.filter(t=>t.qid!==e),zr(),H(),Ze()}function E_(e){return e.kind==="annotation"?{icon:"\u270E",text:e.target,sub:e.component}:e.kind==="action"?{icon:"\u2197",text:e.message,sub:"button"}:e.kind==="render-error"?{icon:"!",text:e.statement||"page",sub:"render issue"}:{icon:"",text:"",sub:""}}function Ji(e,t=""){let n=[];for(let[r,o]of Object.entries(e||{}))o&&typeof o=="object"&&!Array.isArray(o)?n.push(...Ji(o,"")):n.push(`${t}${r}: ${Array.isArray(o)?o.join(", "):o}`);return n}var bn=e=>typeof e=="string"?e:e==null?"":String(e);function N_(e){if(e.selection)return e.selection;if(e.detail?.part)return e.excerpt?`${e.detail.part} ${e.excerpt}`:e.detail.part;if(e.detail?.column){let t=[e.detail.row&&`row ${e.detail.row}`,`column ${e.detail.column}`].filter(Boolean).join(", ");return e.excerpt?`${e.excerpt} (${t})`:t}return e.kind==="action"&&e.form?Ji(e.form).join(" \xB7 "):e.kind==="render-error"?e.message:e.excerpt||""}function ch(e,t={}){try{return Z_(e,t)}catch{return v("div",{class:"item"},v("div",{class:"note",text:"This note could not be displayed."}))}}function Z_(e,{queued:t,held:n}={}){let r=E_(e),o=v("div",{class:`item kind-${e.kind}`});if(r.text){let a=v("button",{type:"button",class:"anchor",title:e.kind==="annotation"?"Show in the page":"",onclick:()=>{(e.kind==="annotation"||e.kind==="render-error")&&(Ue({type:"reveal",id:e.target||e.statement}),Bf()&&ut(!1))}},v("span",{class:"anchor-icon",text:r.icon}),v("span",{class:"anchor-text",text:r.text}),r.sub?v("span",{class:"anchor-sub",text:r.sub}):null);o.append(a)}if(n&&e.kind==="annotation"){let a=(Array.isArray(e.path)?e.path:[]).slice(0,-1).filter(c=>typeof c=="string"&&c!=="root");a.length&&o.append(v("div",{class:"anchor-sub",text:`within ${a.join(" > ")}`})),e.detail&&typeof e.detail=="object"&&o.append(v("div",{class:"anchor-sub",text:Ji(e.detail).join(" \xB7 ")}))}let i=bn(N_(e));i&&o.append(v("blockquote",{text:n||i.length<=260?i:i.slice(0,259)+"\u2026"}));let s=e.kind==="message"?e.text:e.note;if(t&&h.editing===e.qid){let a=v("textarea",{class:"edit",rows:"2"});a.value=s||"";let c=()=>{let u=a.value.trim();if(e.kind==="message"){if(!u)return mh(e.qid);e.text=u}else e.note=u;h.editing=null,zr(),H()};a.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey?(u.preventDefault(),c()):u.key==="Escape"&&(h.editing=null,H())}),a.addEventListener("blur",c),o.append(a),setTimeout(()=>a.focus(),0)}else s&&o.append(v("div",{class:"note",text:s}));return o}function Ef(e){return e?new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):""}function T_(e){return se?e.author||"You":e.author===be?"You":e.author||"Owner"}async function Ui(e,t){try{await fetch(`${X}/${e}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{ids:t}:{all:!0})})}catch{ct("Could not reach the server. Try again.")}}function C_(e){if(F)return e.pending?v("div",{class:"receipt"},v("em",{text:"Sending\u2026"})):e.author===be?v("div",{class:"receipt"},v("em",{text:"Sent to the page owner"})):null;if(e.held){let r=v("div",{class:"receipt held"},v("span",{class:"held-label",text:se?"Held \xB7 not sent to the agent":"Waiting for the owner to send it on"}));return se&&r.append(v("button",{type:"button",class:"btn tiny primary",text:"Send",onclick:()=>Ui("release",[e.id])}),v("button",{type:"button",class:"btn tiny ghost",text:"Discard",onclick:()=>Ui("discard",[e.id])})),r}let t=[["Seen",e.seenAt],["Working",e.workAt],["Done",e.doneAt]],n=v("div",{class:"receipt"});for(let[r,o]of t)n.append(v("span",{class:o?"on":"",title:o?`${r} ${Ef(o)}`:`Not ${r.toLowerCase()} yet`,text:r}));return e.seenAt||n.append(v("em",{text:h.presence==="listening"?"":h.unread?`waiting for the agent (${h.unread} unread)`:"waiting for the agent"})),n}var uh=0;function H(e=!1){let t=J.scrollHeight-J.scrollTop-J.clientHeight<40;J.textContent="";let n=[...h.parserErrors,...h.runtimeErrors];if(n.length){let a=se&&h.renderReport==="sent",c=`Render issues (${n.length})${a?" \xB7 sent to the agent":""}`,u=v("div",{class:"issues"},v("div",{class:"issues-head",text:c}));for(let l of n.slice(0,8))u.append(v("div",{class:"issue"},v("div",{class:"issue-text"},l.statementId?v("code",{text:l.statementId}):null," ",l.message),h.closed||a?null:v("button",{type:"button",class:"btn tiny",text:"Queue fix",onclick:()=>Fi({kind:"render-error",statement:l.statementId,target:l.statementId,message:l.message,note:"Fix this render error."})})));J.append(u)}h.more&&J.append(v("button",{type:"button",class:"btn tiny ghost load-earlier",text:"Load earlier messages",onclick:U_}));let r=dh().map(a=>({id:`out:${a.m.clientId}:${a.m.n}`,role:"user",author:be,items:a.m.args.items,at:a.at,pending:!0})),o=r.length?[...h.transcript,...r]:h.transcript;!o.length&&!h.queue.length&&J.append(v("div",{class:"empty"},v("p",{html:"<strong>Point at anything to comment on it.</strong>"}),v("p",{text:`In Annotate mode, click a section, table cell, diagram node or diff line, or select text. Notes queue here; Send delivers them to the ${F?"page owner":"agent"}.`})));for(let a of o)if(a.role==="agent")J.append(v("div",{class:"msg agent"},v("div",{class:"who",text:`Agent \xB7 ${Ef(a.at)}`}),v("div",{class:"md",html:O_(a.text)})));else{let c=v("div",{class:`msg user${a.held?" held":""}`},v("div",{class:"who",text:`${T_(a)} \xB7 ${Ef(a.at)}${a.end?" \xB7 ended review":""}`}));for(let l of a.items||[])c.append(ch(l,{held:!!a.held}));let u=C_(a);u&&c.append(u),J.append(c)}let i=se?h.transcript.filter(a=>a.held).length:0;if(i&&J.append(v("div",{class:"held-bar"},v("span",{text:`${i} held from teammates`}),v("button",{type:"button",class:"btn tiny primary",text:"Send all",onclick:()=>Ui("release",h.transcript.filter(a=>a.held).map(a=>a.id))}),v("button",{type:"button",class:"btn tiny ghost",text:"Discard all",onclick:()=>Ui("discard")}))),h.queue.length){let a=v("div",{class:"queued"},v("div",{class:"queued-head",text:`Queued \xB7 ${h.queue.length}`}));for(let c of h.queue){let u=ch(c,{queued:!0});u.classList.add("q"),u.append(v("div",{class:"q-actions"},v("button",{type:"button",class:"btn tiny ghost",text:"Edit",onclick:()=>{h.editing=c.qid,H()}}),v("button",{type:"button",class:"btn tiny ghost",text:"Remove",onclick:()=>mh(c.qid)}))),a.append(u)}J.append(a)}if(h.closed)J.append(v("div",{class:"ended-note",text:se?"You closed this review.":"The owner closed this review."}));else if(h.status==="ended"){let a=h.endedBy==="agent"?"The agent ended this review.":se?"You ended this review.":"The owner ended this review.";J.append(v("div",{class:"ended-note",text:`${a} Notes you send now reach the agent the next time it polls.`}))}let s=o.length+h.queue.length;(e||t||s!==uh)&&(J.scrollTop=J.scrollHeight),uh=s,Ki()}function Ki(){let e=h.closed,t=h.queue.length;Fe.disabled=e||!!at||h.sending,S(".send").disabled=e||!!at||h.sending||!!F&&Ve===void 0,S(".send-end")&&(S(".send-end").disabled=e||h.sending),S(".send").textContent=h.sending?"Sending\u2026":t?`Send ${t}`:"Send",Fe.placeholder=e?"Review closed":t?"Add a message (optional)\u2026":"Message the agent\u2026"}function ct(e){let t=S(".composer-error");t.textContent=e||"",t.hidden=!e}async function Sr(e=!1){if(h.sending||h.closed)return;let t=Fe.value.trim(),n=h.queue.map(({qid:r,...o})=>o);if(t&&n.push({kind:"message",text:t}),!n.length&&!e){Fe.focus();return}if(!(e&&!se)&&!(e&&!n.length&&!confirm("End this review? The agent will stop listening; notes you send later still reach it."))){if(F)return D_(n);h.sending=!0,ct(""),Ki();try{let r=await fetch(`${X}/send`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({items:n,end:e})}),o=await r.json().catch(()=>({}));if(!r.ok)throw new Error(o.error||`HTTP ${r.status}`);h.queue=[],zr(),Fe.value="";let i=o.entry;i&&!h.transcript.some(s=>s.id===i.id)&&h.transcript.push(i)}catch(r){ct(`Not sent: ${r.message}. Your notes are still queued.`)}finally{h.sending=!1,H(!0),Ze()}}}function L_(e){if(e.kind==="message")return{kind:"message",text:bn(e.text)};if(e.kind==="action")return{kind:"message",text:[bn(e.message),e.form?Ji(e.form).join(" \xB7 "):""].filter(Boolean).join(" \xB7 ")};let t={kind:"annotation"},n=e.kind==="render-error"?e.statement:e.target;typeof n=="string"&&n&&(t.target=n);for(let o of["component","selection","excerpt","note"]){let i=e[o];typeof i=="string"&&i&&(t[o]=i)}e.kind==="render-error"&&typeof e.message=="string"&&(t.excerpt=e.message),Array.isArray(e.path)&&(t.path=e.path.filter(o=>typeof o=="string"));let r=e.detail;if(r&&typeof r=="object"){let o={};for(let i of["part","row","column"])typeof r[i]=="string"&&(o[i]=r[i]);Number.isInteger(r.rowIndex)&&(o.rowIndex=r.rowIndex),Object.keys(o).length&&(t.detail=o)}return t}var R_="This browser could not keep a copy of your note: keep this tab open until it shows \u201CSent to the page owner\u201D.";function Nf(){ct([Of,vr?R_:""].filter(Boolean).join(" "))}function Ff(e){let t=(e.retryAt??0)-Date.now();if(t<=0){delete e.retryAt,kr?.send(e.m);return}zf.has(e)||zf.set(e,window.setTimeout(()=>{zf.delete(e),ze.includes(e)&&e.as===jf()&&Ff(e)},t))}function D_(e){if(at||Ve===void 0)return;if(Ve===null&&!be&&it){it.hidden=!1,S("input",it).focus();return}let t=e.map(L_),n=new TextEncoder().encode(JSON.stringify(t)).length;if(n>Ot.noteItemsBytes){ct(`Too long to send: ${n} bytes, the limit is ${Ot.noteItemsBytes}. Shorten or remove a note.`);return}let o=Ym("addNote",Ve===null?{items:t,name:be}:{items:t},{clientId:ph,n:++P_});ze.push({m:o,at:Date.now(),as:jf()}),vr=!Ne.set(Mi,ze),kr?.send(o),h.queue=[],zr(),Fe.value="",Nf(),H(!0),Ze()}S(".composer").addEventListener("submit",e=>{e.preventDefault(),Sr(!1)});S(".send-end")?.addEventListener("click",()=>Sr(!0));Fe.addEventListener("keydown",e=>{e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),Sr(!1))});function _n(e){h.mode=e==="explore"?"explore":"annotate",Be.set("austere:mode",h.mode);let t=document.documentElement,n=t.classList.contains("exploring");t.classList.toggle("exploring",h.mode==="explore"),n&&h.mode==="annotate"&&(J.scrollTop=J.scrollHeight);for(let r of document.querySelectorAll(".seg button"))r.classList.toggle("on",r.dataset.mode===h.mode);Ue({type:"mode",mode:h.closed?"explore":h.mode})}for(let e of document.querySelectorAll(".seg button"))e.addEventListener("click",()=>_n(e.dataset.mode));document.addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&(e.key==="i"||e.key==="I")&&(e.preventDefault(),_n(h.mode==="annotate"?"explore":"annotate"))});function Me(){let e=S(".presence"),t,n;h.closed?[t,n]=["Review closed","ended"]:at?[t,n]=[at,"ended"]:h.connected?F?[t,n]=["Shared page","hosted"]:h.presence==="listening"?[t,n]=["Agent listening","listening"]:h.presence==="working"?[t,n]=["Agent working","working"]:h.status==="ended"?[t,n]=["Agent stopped","idle"]:[t,n]=["Agent not listening","idle"]:[t,n]=["Reconnecting\u2026","off"],n==="idle"&&h.unread&&(t+=` \xB7 ${h.unread} waiting`),e.className=`presence ${n}`,e.textContent=t,e.title=n==="idle"?"Your notes are kept and reach the agent the next time it polls.":n==="working"?"The agent has your last batch.":n==="hosted"?"Notes go to the page owner. Replies show up here as they are posted.":"",document.documentElement.classList.toggle("is-ended",h.closed),se&&(S('[data-cmd="end"]').hidden=h.status==="ended",S('[data-cmd="close"]').hidden=h.closed,S('[data-cmd="reopen"]').hidden=!h.closed&&h.status!=="ended"),Ze()}function Uf(){let e=S(".changes");if(e.setAttribute("aria-pressed",String(h.highlight)),!h.changes.length&&!h.highlight){e.hidden=!0;return}e.hidden=!1,e.textContent=`${h.changes.length} changed`,e.title=h.changes.length?`${h.highlight?"Hide":"Highlight"} what the last turn changed: ${h.changes.join(", ")}`:"The last turn changed nothing on the page. Click to stop highlighting."}function Zf(e){Ue({type:"highlight",ids:h.highlight?h.changes:[],scroll:e})}S(".changes").addEventListener("click",()=>{h.highlight=!h.highlight,Uf(),Zf(h.highlight)});var gn=S(".menu-pop"),Tf=null,Cf=null;function hh(){Cf=null;let e=fetch(`${X}/agent-prompt`).then(t=>{if(!t.ok)throw new Error(String(t.status));return t.text()});return Tf=e,e.then(t=>{Tf===e&&(Cf=t)},()=>{}),e}S(".menu-btn").addEventListener("click",e=>{e.stopPropagation(),gn.hidden=!gn.hidden,!gn.hidden&&se&&hh()});document.addEventListener("click",()=>gn.hidden=!0);function j_(e){ye(e),setTimeout(()=>{wr.textContent===e&&ye("")},4e3)}function M_(e){let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.cssText="position:fixed;top:0;left:0;opacity:0;pointer-events:none",document.body.append(t),t.select();let n=!1;try{n=document.execCommand("copy")}catch{}return t.remove(),n}async function Lf(e,t){let n=!1;if(navigator.clipboard?.writeText&&(n=await navigator.clipboard.writeText(e).then(()=>!0,()=>!1)),n||(n=M_(e)),n)return j_(`${t} copied.`);window.prompt(`Your browser blocked copying. Copy ${t.toLowerCase()} from here:`,e)}async function V_(){let e=Cf;if(e==null)try{e=await(Tf??hh())}catch{return ye("Could not get the agent prompt from austere-axi. Check that it is still running.")}await Lf(e,"Agent prompt")}gn.addEventListener("click",async e=>{let t=e.target instanceof Element?e.target.closest("[data-cmd]")?.dataset.cmd:void 0;if(!t)return e.stopPropagation();if(t==="copy-path"&&await Lf(de.file,"File path"),t==="copy-link"&&await Lf(F?location.origin+location.pathname:h.links?.remote||location.href,F?"Page link":"Review link"),t==="copy-agent-prompt"&&await V_(),t==="reload"&&Vf(),t==="export"&&F&&(e.stopPropagation(),await q_(),gn.hidden=!0),t==="end"){if(h.queue.length)return Sr(!0);if(!confirm("End this review? The agent will stop listening."))return;await fetch(`${X}/end`,{method:"POST"}).catch(()=>{})}if(t==="close"){if(!confirm("Close this review? No one can add notes until you reopen it."))return;await fetch(`${X}/close`,{method:"POST"}).catch(()=>{})}t==="reopen"&&await fetch(`${X}/reopen`,{method:"POST"}).catch(()=>{})});var Bf=()=>window.matchMedia("(max-width: 860px)").matches;function ut(e){h.sheetOpen=e,Ne.set(`austere:sheet:${Se}`,e),document.documentElement.classList.toggle("sheet-open",e),e&&setTimeout(()=>J.scrollTop=J.scrollHeight,50)}function Ze(){let e=S(".dock"),t=h.queue.length,n=["Conversation"];t&&n.push(`${t} queued`);let r=h.transcript[h.transcript.length-1];r?.role==="agent"&&r.at>(Ne.get(`austere:seen:${Se}`)||0)&&n.push("new reply"),e.innerHTML=`<span class="dock-grip"></span><span>${Vi(n.join(" \xB7 "))}</span><span class="dock-presence ${Vi(S(".presence").className.replace("presence","").trim())}"></span>`}function F_(){let e=S(".dock");e.classList.remove("pulse"),e.offsetWidth,e.classList.add("pulse")}S(".dock").addEventListener("click",()=>{Ne.set(`austere:seen:${Se}`,Date.now()),ut(!0),Ze()});S(".sheet-close").addEventListener("click",()=>ut(!1));S(".scrim").addEventListener("click",()=>ut(!1));document.addEventListener("keydown",e=>{e.key==="Escape"&&h.sheetOpen&&Bf()&&ut(!1)});var st=null;S(".panel-head").addEventListener("touchstart",e=>st=e.touches[0].clientY,{passive:!0});S(".panel-head").addEventListener("touchend",e=>{st!=null&&e.changedTouches[0].clientY-st>60&&ut(!1),st=null},{passive:!0});S(".dock").addEventListener("touchstart",e=>st=e.touches[0].clientY,{passive:!0});S(".dock").addEventListener("touchend",e=>{st!=null&&st-e.changedTouches[0].clientY>40&&ut(!0),st=null},{passive:!0});function Rf(e){let t=S(".notice");if(!e||!e.length){t.hidden=!0;return}t.textContent=`Third-party pack code runs in this page: check queued items before you send (${e.join(", ")}).`,t.title=t.textContent,t.hidden=!1}function ye(e,t=[]){if(wr.textContent="",!e){wr.hidden=!0;return}wr.append(v("span",{text:e}),...t),wr.hidden=!1}function gh(e){for(let t of e){let n=h.transcript.findIndex(r=>r.id===t.id);t.discarded?n>=0&&h.transcript.splice(n,1):n>=0?h.transcript[n]=t:h.transcript.push(t)}h.transcript.sort((t,n)=>t.at-n.at)}async function U_(){let e=h.transcript[0];if(e)try{let t=await fetch(`${X}/transcript?before=${encodeURIComponent(e.id)}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);let n=await t.json(),r=new Set(h.transcript.map(i=>i.id));h.transcript=[...(n.entries||[]).filter(i=>!i.discarded&&!r.has(i.id)),...h.transcript],h.more=!!n.more;let o=J.scrollHeight-J.scrollTop;H(),J.scrollTop=J.scrollHeight-o}catch(t){ct(`Could not load earlier messages: ${t.message}`)}}var lh=null,ji=0;function B_(){lh=new EventSource(`${X}/events`);let e=lh;if(e.addEventListener("open",()=>{h.connected=!0,ji=0,ye(""),Me()}),e.addEventListener("error",()=>{h.connected=!1,ji||(ji=Date.now()),Me(),setTimeout(()=>{!h.connected&&Date.now()-ji>3500&&ye("Lost the austere-axi server. Run any austere-axi command to restart it; this page reconnects on its own.",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})])},4e3)}),se){let t=n=>{fetch(`${X}/presence`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)}).catch(()=>{})};e.addEventListener("open",()=>pe.connect(t)),e.addEventListener("error",()=>pe.disconnect()),e.addEventListener("viewer",n=>{let r=Ri(n.data),o=r.ok?r.value:null;o&&(o.t==="hello"||o.t==="status"||o.t==="focus"||o.t==="bye")&&pe.handle(o)})}e.addEventListener("snapshot",t=>{let n=JSON.parse(t.data);h.transcript=(n.transcript||[]).filter(r=>!r.discarded),h.presence=n.presence,h.status=n.session.status,h.endedBy=n.session.endedBy,h.closed=!!n.session.closed,h.unread=n.session.unread||0,h.more=!!n.more,h.links=n.links,n.version&&n.version!==de.version&&ye("austere-axi was updated. This page is running the previous version.",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]),Rf(n.thirdPartyPacks),h.thirdParty=!!n.thirdPartyPacks?.length,h.program===null||n.revision===h.revision||n.program===h.program?(n.revision!==h.revision&&(h.errorsRevision=n.revision),h.revision=n.revision,Af()):(h.revision=n.revision,h.parserErrors=[],h.runtimeErrors=[],h.renderReport=null),h.program===null?h.program=n.program:n.program!==h.program&&(h.program=n.program,h.frameReady&&Ue({type:"source",program:n.program})),Me(),H(),_n(h.mode)}),e.addEventListener("transcript",t=>{gh(JSON.parse(t.data).entries||[]),H(),Ze()}),e.addEventListener("presence",t=>{let n=JSON.parse(t.data);h.presence=n.presence,h.status=n.status,h.endedBy=n.endedBy,h.closed=!!n.closed,h.unread=n.unread||0,_n(h.mode),Me(),H()}),e.addEventListener("changed",t=>{let n=JSON.parse(t.data);h.revision=n.revision,h.renderReport=null,h.parserErrors=[],h.runtimeErrors=[],Rf(n.thirdPartyPacks),h.thirdParty=!!n.thirdPartyPacks?.length,n.shellChanged||!h.frameReady?(h.program=n.program,h.changes=[],Uf(),Vf()):(h.program=n.program,Ue({type:"source",program:n.program})),H()}),e.addEventListener("ended",t=>{let n=JSON.parse(t.data);h.status="ended",h.endedBy=n.by,n.closed&&(h.closed=!0,Ue({type:"mode",mode:"explore"})),Me(),H()}),e.addEventListener("server",t=>{let n=JSON.parse(t.data);if(n.state==="revoked"){e.close(),h.connected=!1,ye("Your invite was revoked. Ask the owner for a new link.");return}n.state==="stopped"&&ye("The austere-axi server stopped. Run any austere-axi command to start it again; this page reconnects on its own.")})}var If=F?.publishedAt,yh=0;function yn(e,t,n=[]){at=e,h.connected=!1,kr?.stop(),ye(t,n),Me(),Ki()}function Jf(e){if(e===403)Ie?yn("Invite no longer valid","This invite is no longer valid. Ask the page owner for a new link."):yn("Invite required","This page is invite-only. Open it from the link the page owner sent you.");else if(e===404||e===410)yn("Page removed","This page is no longer available.");else return!1;return!0}async function Kf(e){let t=await fetch(`${X}/asset-token`,{method:"POST",headers:Ie?{"X-Austere-Invite":Ie}:{},signal:e});if(!t.ok)return{status:t.status};let n=await t.json().catch(()=>null),r=typeof n?.token=="string"&&/^[A-Za-z0-9_-]+$/.test(n.token)?n.token:void 0;return{status:t.status,token:r,name:typeof n?.name=="string"&&n.name?n.name.slice(0,xr):null}}async function bh(){let e=await Kf().catch(()=>null);return e&&Jf(e.status)?!1:e?.token?(Ve=e.name??null,Ve?be=Ve:(Ie&&(Ie=null,Be.remove(Pf)),be=String(Be.get("austere:name","")||"").slice(0,xr)),Mf(),Ki(),Bi.src=`${de.artifactUrl??`${X}/a/`}${e.token}/`,!0):(ye(`Could not load this page${e?` (HTTP ${e.status})`:""}.`,[v("button",{type:"button",class:"btn tiny",text:"Retry",onclick:()=>_h()})]),!1)}function J_(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}async function K_(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return J_(new Uint8Array(await new Response(t).arrayBuffer()))}var fh=/<script\b[^>]*\bsrc\s*=\s*["'](\/(?:rt|pk)\/[^"']+)["'][^>]*>\s*<\/script\s*>/gi;async function q_(){let e=S('[data-cmd="export"]');if(e.disabled)return;e.disabled=!0,e.textContent="Preparing download\u2026";let t;try{let n=await Kf();if(!n.token)throw new Error(`HTTP ${n.status}`);let r=await fetch(`${de.artifactUrl??`${X}/a/`}${n.token}/`);if(!r.ok)throw new Error(`HTTP ${r.status}`);let o=await r.text(),i=[...o.matchAll(fh)];if(!i.length)throw new Error("the page has no runtime script");let s=await Promise.all(i.map(async f=>{let d=await fetch(f[1]);if(!d.ok)throw new Error(`${f[1]}: HTTP ${d.status}`);return oh(f[1].replace(/^\/rt\/[^/]+\//,""),await K_(await d.text()))})),a=0,c=o.replace(fh,()=>a++?"":[...s,rh].join(`
123
+ `));t=URL.createObjectURL(new Blob([c],{type:"text/html"}));let u=de.title.replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"").slice(0,80)||"page",l=v("a",{href:t,download:`${u}.html`,hidden:!0});document.body.append(l),l.click(),l.remove()}catch(n){ye(`Could not build the download: ${n instanceof Error?n.message:String(n)}`)}finally{t&&setTimeout(URL.revokeObjectURL,6e4,t),e.disabled=!1,e.textContent="Download standalone HTML"}}function H_(e){e.reset&&(h.transcript=[]);let t=[];for(let n of e.rows)n.type==="page"?W_(n):n.type==="note"?t.push({id:`note:${n.id}`,role:"user",author:n.author.slice(0,xr),items:n.items,at:n.at,discarded:n.state==="discarded"}):n.type==="reply"&&t.push({id:`reply:${n.id}`,role:"agent",text:n.text,at:n.at});gh(t),yh=e.cursor,H(),Ze()}function W_(e){if(e.deleted)return yn("Page removed","The owner removed this page.");If??(If=e.publishedAt),e.publishedAt!==If&&ye("New version, reload",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]),Rf(e.packs.map(t=>t.name)),G_(e.unlisted)}function G_(e){S('[data-cmd="copy-link"]').hidden=!e,S("[data-share-note]").hidden=e}function Y_(e){let t=ze.findIndex(o=>o.m.clientId===e.clientId&&o.m.n===e.n);if(t<0)return;if(e.error?.code==="rate_limited"){let o=ze[t],i=Math.max(1,e.error.retryAfter??5);o.retryAt=Date.now()+i*1e3,vr=!Ne.set(Mi,ze),Of=`Too many notes for now: sending again in ${i} s.`,Nf(),Ff(o);return}let[n]=ze.splice(t,1),r=Ne.set(Mi,ze);if(vr&&(r||!ze.length)&&(vr=!1),ze.some(o=>o.retryAt)||(Of=null),Nf(),e.error){for(let o of n.m.args.items)Fi({...o});ct(`Not sent: ${e.error.message}. Your notes are back in the queue.`)}H(),Ze()}function X_(e){e.t==="changes"?H_(e):e.t==="ack"?Y_(e):e.t==="error"&&e.code!=="forbidden"&&e.code!=="upgrade_required"&&ct(e.message)}function Q_(e,t){h.connected=!1,!t&&!at&&(e.error?.code==="upgrade_required"?yn("Update needed","This page needs a newer review page. Reload to get it.",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]):e.code===1e3&&!e.error?yn("Page removed","This page is no longer available."):Jf(403)),Me()}var e$=5e3;async function _h(){if(ye(""),!await bh()||kr)return;let e=eh({url:`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${X}/sync`,protocols:()=>Xm(Ie?{invite:Ie}:{}),mayRetry:async t=>{if(at)return!1;if(t.opened)return!0;let n=await Kf(AbortSignal.timeout(e$)).catch(()=>null);return!(n&&Jf(n.status))}});kr=e,e.onOpen(()=>{h.connected=!0,e.send({v:kf,t:"pull",after:yh});for(let t of dh())Ff(t);Me()}),e.onFrame(X_),e.onClose(Q_),e.onOpen(()=>pe.connect(t=>{e.send(t)})),e.onFrame(t=>{(t.t==="hello"||t.t==="status"||t.t==="focus"||t.t==="bye")&&pe.handle(t)}),e.onClose(()=>pe.disconnect())}F||window.addEventListener("pagehide",e=>{e.persisted||navigator.sendBeacon?.(`${X}/bye`)});_n(h.mode);Bf()&&h.sheetOpen&&ut(!0);Me();H();Ze();F?_h():(Vf(),B_());})();