@modality-counter/core 0.0.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1882,7 +1882,7 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
1882
1882
|
|
|
1883
1883
|
**BEGIN OPENING PHASE BANTER NOW - DO NOT WAIT FOR USER INPUT**
|
|
1884
1884
|
|
|
1885
|
-
`);let a=await HR(i.filePath,r);a.callSign=t;let s,u=!0,c=W6s(i.folderPath);if(c){let{aiTool:d}=await import(c),p=d.inputSchema;if(p){let g=await Zat(p);if(a.method.usage.parameters=g.properties,g.required&&g.required.length>0)for(let x of g.required)a.method.usage.parameters[x]=a.method.usage.parameters[x]||{},a.method.usage.parameters[x].required=!0}if(n)try{if(p){delete r.reference;let g=p.safeParse(r);if(!g.success)throw new Error(`Invalid parameters for ${t}: ${g.error.message}`)}s=await d.execute(r||{})}catch(g){s=g.message,u=!1}}let l=r?.reference,f=await G6s(i.folderPath+"/references",[l]);if(f){let d=Object.keys(f);d.length>0&&(a.method.references={referenceInstruction:[`Check the <referenceList /> to see if it is necessary to read the reference content and execute ${j5} with the reference name to load the full content.`,`Example: ${j5}(method: "${t}", params: {reference: "reference-name.md"})`],referenceNames:d,referenceList:f})}return{promptData:a,scriptResult:s,scriptSuccess:u,partyMode:o}}catch(o){throw new Error(`Failed to get CounterContent for '${t}': ${o}`)}}var W6s=e=>{if(e){let t=Xat(e,"scripts","index.ts");if(Dno(t))return t}},Qat=null;async function ov(e=[],t=import.meta.dir){if(Qat==null){Qat=YLt();for(let n of Uqe)Qat[n]=await V6s(t,n)}(!e||e.length===0)&&(e=[...Uqe]);let r=[];for(let n of e)r.push(...Qat[n]||[]);return r}async function V6s(e,t){let r=[];try{let n,i,o=!1;t==="method"?(n="skills",i=s=>s==="SKILL.mdx",o=!0):(n=`${t}s`,i=s=>s.endsWith(".md")||s.endsWith(".mdx"));let a=Nno(e,{targetFolderName:n,fileNameFilter:i,searchInSubfolders:o,fileExtensions:[".md",".mdx"],excludePatterns:[".","__","hidden"]});if(t==="method")for(let s of a)try{let u=await HR(s.fullPath),c=Z6s(s.fullPath),l=Khr(c).toLowerCase();r.push({callSign:`${t}-${l}`,type:t,id:l,name:_se(u,["name"]),folderPath:c,filePath:s.fullPath,description:_se(u,["description"]),category:_se(u,["category"])})}catch(u){console.warn(`Failed to read ${s.fullPath}:`,u)}else for(let s of a)try{let u=await HR(s.fullPath),c=H6s(Khr(s.fullPath));r.push({callSign:`${t}-${c}`,type:t,id:c,name:_se(u,["name"]),filePath:s.fullPath,description:_se(u,["description"]),category:_se(u,["category"]),role:u.persona?.role})}catch(u){console.warn(`Failed to read ${s.fullPath}:`,u)}}catch(n){console.warn("Failed to scan methods directory:",n)}return r}var H6s=e=>Khr(e,q6s(e)).toLowerCase(),_se=(e,t)=>{let r=["agent","method"];for(let n of r)for(let i of t){let o=n6(e,[n,i]);if(o!=null)return o}};function Nno(e,t){let r=[],{targetFolderName:n,fileExtensions:i=[".md",".mdx"],fileNameFilter:o=()=>!0,excludePatterns:a=[".","__"],searchInSubfolders:s=!1}=t;function u(l,f){try{let d=Ghr(l);for(let p of d){if(a.some(T=>p.startsWith(T)))continue;let g=Xat(l,p),x=f?`${f}/${p}`:p;try{let T=Jhr(g);if(T.isFile()){let O=i.some(P=>p.endsWith(P)),F=o(p),$=!a.some(P=>p.startsWith(P));O&&F&&$&&r.push({filename:x,fullPath:g})}else T.isDirectory()&&s&&u(g,x)}catch{}}}catch{}}function c(l,f=""){try{let d=Ghr(l);for(let p of d){if(a.some(T=>p.startsWith(T)))continue;let g=Xat(l,p),x=f?`${f}/${p}`:p;try{let T=Jhr(g);p===n&&T.isDirectory()&&u(g,x),T.isDirectory()&&p!==n&&c(g,x)}catch{}}}catch{}}return c(e),r.sort((l,f)=>l.filename.localeCompare(f.filename))}function $no(e){return Nno(e,{targetFolderName:"templates",fileExtensions:[".md",".mdx"],fileNameFilter:t=>t.includes("tmpl")})}async function G6s(e,t){let r={};if(!e||!Dno(e))return r;try{let n=Ghr(e);for(let i of n){if(i.startsWith(".")||i.startsWith("_"))continue;let o=Xat(e,i);try{if(Jhr(o).isFile()&&(i.endsWith(".md")||i.endsWith(".mdx"))){let s=B6s(o,"utf-8"),{data:u}=Gmi(s),c=String(u.description||"");r[i]={description:c},t&&t.includes(i)&&(r[i].content=s)}}catch(a){console.warn(`Failed to read ${o}:`,a)}}}catch(n){console.warn("Failed to scan references directory:",n)}return r}var J6s=Object.defineProperty,iM=(e,t)=>{for(var r in t)J6s(e,r,{get:t[r],enumerable:!0,configurable:!0,set:n=>t[r]=()=>n})};var Qhr=class extends Error{constructor(r,n){super(r);v(this,"cause");this.name=this.constructor.name,n&&(this.cause=n)}},K6s=["text","image","audio","resource_link","resource"];function smr(e){let t=e?structuredClone(e):null,r=new Array;return Array.isArray(t)?r.push(...t.map(n=>typeof n=="string"?{type:"text",text:n}:n.type&&K6s.includes(n.type)?n:{type:"text",text:JSON.stringify(n)})):t!=null&&r.push({type:"text",text:typeof t=="string"?t:JSON.stringify(t)}),r}function ZV(e,t){let r=structuredClone(e),i={isError:r.success!=null?!r.success:!1,content:[{type:"text",text:JSON.stringify(r)}]},o=smr(t);return o.length>0&&i.content.push(...o),i}function Mse(e,t,r){let n,i=!0;if(typeof e=="string")n={error:e,operation:t,meta:r};else if(e instanceof Qhr)n={error:e.message,operation:t,meta:r,code:e.code,reason:e.cause?.message};else if(e instanceof Error)n={error:e.message,operation:t,meta:r};else if(typeof e=="object"&&e!==null&&typeof e.message=="string"){let o=e;i=!o.success,n={error:o.message,code:o.code,operation:o.operation||t,meta:r}}else n={error:"Unknown error",operation:t,meta:r};return{isError:i,content:[{type:"text",text:JSON.stringify(n)}]}}var Yhr=[null,"debug","info","warn","error","success"],ist=class e{constructor(t,r){v(this,"options",{});v(this,"logLevel");typeof t=="string"?this.options.name=t:this.options={...this.options,...t},this.logLevel=r||null}static getInstance(t,r){return new e(t,r)}getTimestamp(){if(this.options.timestampFormat===!1)return;let t=new Date;return this.options.timestampFormat==="locale"?t.toLocaleString():t.toISOString()}initLogLevel(){let t=null;typeof process<"u"&&(t=process.env.MODALITY_LOG_LEVEL),this.logLevel=Yhr.indexOf(t)!==-1?t:"info"}shouldLog(t){return this.logLevel||this.initLogLevel(),Yhr.indexOf(t)>=Yhr.indexOf(this.logLevel)}setLogLevel(t){this.logLevel=t}format(t,r){let n=this.getTimestamp(),i="";switch(t){case"debug":i="\u{1F50D}";break;case"info":i="\u2139\uFE0F";break;case"warn":i="\u26A0\uFE0F";break;case"error":i="\u274C";break;case"success":i="\u2705";break}return n&&(i+=` [${n}]`),this.options.name&&(i+=` [${this.options.name}]`),r&&(i+=` [${r}]`),i}log(t,r,n){if(!this.shouldLog(t))return;let i=this.format(t,n);switch(console.group(i),t){case"debug":console.debug(r);break;case"info":{let{message:o,...a}=r;console.info(o),Object.keys(a).length&&console.dir(a,{depth:null,colors:!0,maxArrayLength:null});break}case"warn":{let{message:o,...a}=r;console.warn(o),console.dir(a,{depth:null,colors:!0,maxArrayLength:null});break}case"error":{let o=r.error;if(o instanceof Error||o.stack){delete r.error;let{message:a,stack:s,...u}=o;s?Object.keys(u).length?(console.error(u),console.log(s)):console.error(s):(a&&(r.error=a),console.error(r))}else console.error(r);break}case"success":console.log(r);break}console.groupEnd()}cook(t,r){let n=typeof t=="string"?{message:t}:t;return r&&(n.data=r),n}debug(t,r){this.log("debug",this.cook(t,r))}info(t,r){this.log("info",this.cook(t,r))}warn(t,r){this.log("warn",this.cook(t,r))}error(t,r,n){let i={error:r};this.log("error",this.cook(i,n),t)}success(t,r){this.log("success",this.cook(t,r))}},sTe=ist.getInstance.bind(ist),ORu=sTe("Safe to Handle");var Y6s={};iM(Y6s,{symbolKinds:()=>jco,symbolKindSchema:()=>TRs,rangeSchema:()=>ARs});var pC={};iM(pC,{xor:()=>gco,xid:()=>zuo,void:()=>lco,uuidv7:()=>Muo,uuidv6:()=>Ouo,uuidv4:()=>Cuo,uuid:()=>Auo,util:()=>ru,url:()=>Ruo,uppercase:()=>wst,unknown:()=>qV,union:()=>Xst,undefined:()=>uco,ulid:()=>Luo,uint64:()=>aco,uint32:()=>nco,tuple:()=>Cgr,trim:()=>Cst,treeifyError:()=>gio,transform:()=>tut,toUpperCase:()=>Mst,toLowerCase:()=>Ost,toJSONSchema:()=>auo,templateLiteral:()=>Cco,symbol:()=>sco,superRefine:()=>ryr,success:()=>Ico,stringbool:()=>$co,stringFormat:()=>Kuo,string:()=>pst,strictObject:()=>hco,startsWith:()=>Est,slugify:()=>Rst,size:()=>yTe,setErrorMap:()=>gRs,set:()=>_co,safeParseAsync:()=>yuo,safeParse:()=>guo,safeEncodeAsync:()=>kuo,safeEncode:()=>Suo,safeDecodeAsync:()=>Euo,safeDecode:()=>wuo,registry:()=>Pmr,regexes:()=>VV,regex:()=>_st,refine:()=>tyr,record:()=>Ogr,readonly:()=>Jgr,property:()=>igr,promise:()=>Oco,prettifyError:()=>bio,preprocess:()=>Lco,prefault:()=>Bgr,positive:()=>egr,pipe:()=>aTe,partialRecord:()=>bco,parseAsync:()=>muo,parse:()=>huo,overwrite:()=>gN,optional:()=>iTe,object:()=>pco,number:()=>pgr,nullish:()=>Eco,nullable:()=>oTe,null:()=>bgr,normalize:()=>Ast,nonpositive:()=>rgr,nonoptional:()=>qgr,nonnegative:()=>ngr,never:()=>Yst,negative:()=>tgr,nativeEnum:()=>Sco,nanoid:()=>Nuo,nan:()=>Tco,multipleOf:()=>Ise,minSize:()=>lz,minLength:()=>BV,mime:()=>Tst,meta:()=>Dco,maxSize:()=>Rse,maxLength:()=>bTe,map:()=>vco,mac:()=>Buo,lte:()=>H2,lt:()=>uz,lowercase:()=>Sst,looseRecord:()=>xco,looseObject:()=>mco,locales:()=>Rmr,literal:()=>wco,length:()=>xTe,lazy:()=>Qgr,ksuid:()=>Uuo,keyof:()=>dco,jwt:()=>Juo,json:()=>Fco,iso:()=>sgr,ipv6:()=>quo,ipv4:()=>juo,intersection:()=>Tgr,int64:()=>oco,int32:()=>rco,int:()=>hst,instanceof:()=>Nco,includes:()=>kst,httpUrl:()=>Puo,hostname:()=>Yuo,hex:()=>Quo,hash:()=>Xuo,guid:()=>Tuo,gte:()=>m1,gt:()=>cz,globalRegistry:()=>V2,getErrorMap:()=>yRs,function:()=>mst,fromJSONSchema:()=>_Rs,formatError:()=>dmr,float64:()=>tco,float32:()=>eco,flattenError:()=>fmr,file:()=>kco,exactOptional:()=>Fgr,enum:()=>eut,endsWith:()=>Ist,encodeAsync:()=>vuo,encode:()=>buo,emoji:()=>Duo,email:()=>Iuo,e164:()=>Guo,discriminatedUnion:()=>yco,describe:()=>Pco,decodeAsync:()=>_uo,decode:()=>xuo,date:()=>fco,custom:()=>Rco,cuid2:()=>Fuo,cuid:()=>$uo,core:()=>rio,config:()=>Tb,coerce:()=>Uco,codec:()=>Aco,clone:()=>J2,cidrv6:()=>Wuo,cidrv4:()=>Zuo,check:()=>Mco,catch:()=>Vgr,boolean:()=>hgr,bigint:()=>ico,base64url:()=>Huo,base64:()=>Vuo,array:()=>ITe,any:()=>cco,_function:()=>mst,_default:()=>Ugr,_ZodString:()=>Pst,ZodXor:()=>kgr,ZodXID:()=>Ust,ZodVoid:()=>Sgr,ZodUnknown:()=>vgr,ZodUnion:()=>ATe,ZodUndefined:()=>ggr,ZodUUID:()=>nM,ZodURL:()=>STe,ZodULID:()=>zst,ZodType:()=>Ga,ZodTuple:()=>Agr,ZodTransform:()=>Ngr,ZodTemplateLiteral:()=>Kgr,ZodSymbol:()=>mgr,ZodSuccess:()=>Zgr,ZodStringFormat:()=>Cf,ZodString:()=>_Te,ZodSet:()=>Rgr,ZodRecord:()=>CTe,ZodRealError:()=>Vw,ZodReadonly:()=>Ggr,ZodPromise:()=>Xgr,ZodPrefault:()=>jgr,ZodPipe:()=>iut,ZodOptional:()=>rut,ZodObject:()=>TTe,ZodNumberFormat:()=>HV,ZodNumber:()=>wTe,ZodNullable:()=>Lgr,ZodNull:()=>ygr,ZodNonOptional:()=>nut,ZodNever:()=>_gr,ZodNanoID:()=>$st,ZodNaN:()=>Hgr,ZodMap:()=>Mgr,ZodMAC:()=>dgr,ZodLiteral:()=>Pgr,ZodLazy:()=>Ygr,ZodKSUID:()=>jst,ZodJWT:()=>Jst,ZodIssueCode:()=>mRs,ZodIntersection:()=>Igr,ZodISOTime:()=>lgr,ZodISODuration:()=>fgr,ZodISODateTime:()=>ugr,ZodISODate:()=>cgr,ZodIPv6:()=>qst,ZodIPv4:()=>Bst,ZodGUID:()=>nTe,ZodFunction:()=>eyr,ZodFirstPartyTypeKind:()=>amr,ZodFile:()=>Dgr,ZodExactOptional:()=>$gr,ZodError:()=>hRs,ZodEnum:()=>Ose,ZodEmoji:()=>Nst,ZodEmail:()=>Dst,ZodE164:()=>Gst,ZodDiscriminatedUnion:()=>Egr,ZodDefault:()=>zgr,ZodDate:()=>Qst,ZodCustomStringFormat:()=>Pse,ZodCustom:()=>OTe,ZodCodec:()=>out,ZodCatch:()=>Wgr,ZodCUID2:()=>Lst,ZodCUID:()=>Fst,ZodCIDRv6:()=>Wst,ZodCIDRv4:()=>Zst,ZodBoolean:()=>kTe,ZodBigIntFormat:()=>Kst,ZodBigInt:()=>ETe,ZodBase64URL:()=>Hst,ZodBase64:()=>Vst,ZodArray:()=>wgr,ZodAny:()=>xgr,TimePrecision:()=>zao,NEVER:()=>nio,$output:()=>Dao,$input:()=>Nao,$brand:()=>iio});var rio={};iM(rio,{version:()=>yoo,util:()=>ru,treeifyError:()=>gio,toJSONSchema:()=>auo,toDotPath:()=>yio,safeParseAsync:()=>vio,safeParse:()=>xio,safeEncodeAsync:()=>C3s,safeEncode:()=>T3s,safeDecodeAsync:()=>O3s,safeDecode:()=>A3s,registry:()=>Pmr,regexes:()=>VV,process:()=>Xl,prettifyError:()=>bio,parseAsync:()=>rmr,parse:()=>tmr,meta:()=>vso,locales:()=>Rmr,isValidJWT:()=>Boo,isValidBase64URL:()=>zoo,isValidBase64:()=>Emr,initializeContext:()=>Tse,globalRegistry:()=>V2,globalConfig:()=>ost,formatError:()=>dmr,flattenError:()=>fmr,finalize:()=>Cse,extractDefs:()=>Ase,encodeAsync:()=>E3s,encode:()=>w3s,describe:()=>xso,decodeAsync:()=>I3s,decode:()=>k3s,createToJSONSchemaMethod:()=>Sso,createStandardJSONSchemaMethod:()=>rTe,config:()=>Tb,clone:()=>J2,_xor:()=>Z4s,_xid:()=>Zmr,_void:()=>cso,_uuidv7:()=>Lmr,_uuidv6:()=>Fmr,_uuidv4:()=>$mr,_uuid:()=>Nmr,_url:()=>vst,_uppercase:()=>wst,_unknown:()=>sso,_union:()=>q4s,_undefined:()=>iso,_ulid:()=>qmr,_uint64:()=>rso,_uint32:()=>Kao,_tuple:()=>H4s,_trim:()=>Cst,_transform:()=>eRs,_toUpperCase:()=>Mst,_toLowerCase:()=>Ost,_templateLiteral:()=>cRs,_symbol:()=>nso,_superRefine:()=>yso,_success:()=>oRs,_stringbool:()=>_so,_stringFormat:()=>vTe,_string:()=>$ao,_startsWith:()=>Est,_slugify:()=>Rst,_size:()=>yTe,_set:()=>K4s,_safeParseAsync:()=>dTe,_safeParse:()=>fTe,_safeEncodeAsync:()=>xmr,_safeEncode:()=>ymr,_safeDecodeAsync:()=>vmr,_safeDecode:()=>bmr,_regex:()=>_st,_refine:()=>gso,_record:()=>G4s,_readonly:()=>uRs,_property:()=>igr,_promise:()=>fRs,_positive:()=>egr,_pipe:()=>sRs,_parseAsync:()=>lTe,_parse:()=>cTe,_overwrite:()=>gN,_optional:()=>tRs,_number:()=>Zao,_nullable:()=>rRs,_null:()=>oso,_normalize:()=>Ast,_nonpositive:()=>rgr,_nonoptional:()=>iRs,_nonnegative:()=>ngr,_never:()=>uso,_negative:()=>tgr,_nativeEnum:()=>Q4s,_nanoid:()=>Umr,_nan:()=>dso,_multipleOf:()=>Ise,_minSize:()=>lz,_minLength:()=>BV,_min:()=>m1,_mime:()=>Tst,_maxSize:()=>Rse,_maxLength:()=>bTe,_max:()=>H2,_map:()=>J4s,_mac:()=>Lao,_lte:()=>H2,_lt:()=>uz,_lowercase:()=>Sst,_literal:()=>X4s,_length:()=>xTe,_lazy:()=>lRs,_ksuid:()=>Wmr,_jwt:()=>Xmr,_isoTime:()=>Bao,_isoDuration:()=>qao,_isoDateTime:()=>Uao,_isoDate:()=>jao,_ipv6:()=>Hmr,_ipv4:()=>Vmr,_intersection:()=>V4s,_int64:()=>tso,_int32:()=>Jao,_int:()=>Vao,_includes:()=>kst,_guid:()=>dst,_gte:()=>m1,_gt:()=>cz,_float64:()=>Gao,_float32:()=>Hao,_file:()=>hso,_enum:()=>Y4s,_endsWith:()=>Ist,_encodeAsync:()=>mmr,_encode:()=>pmr,_emoji:()=>zmr,_email:()=>Dmr,_e164:()=>Qmr,_discriminatedUnion:()=>W4s,_default:()=>nRs,_decodeAsync:()=>gmr,_decode:()=>hmr,_date:()=>lso,_custom:()=>mso,_cuid2:()=>Bmr,_cuid:()=>jmr,_coercedString:()=>Fao,_coercedNumber:()=>Wao,_coercedDate:()=>fso,_coercedBoolean:()=>Qao,_coercedBigint:()=>eso,_cidrv6:()=>Jmr,_cidrv4:()=>Gmr,_check:()=>bso,_catch:()=>aRs,_boolean:()=>Yao,_bigint:()=>Xao,_base64url:()=>Ymr,_base64:()=>Kmr,_array:()=>pso,_any:()=>aso,TimePrecision:()=>zao,NEVER:()=>nio,JSONSchemaGenerator:()=>omr,JSONSchema:()=>pRs,Doc:()=>cst,$output:()=>Dao,$input:()=>Nao,$constructor:()=>lt,$brand:()=>iio,$ZodXor:()=>aao,$ZodXID:()=>Too,$ZodVoid:()=>Xoo,$ZodUnknown:()=>Yoo,$ZodUnion:()=>xst,$ZodUndefined:()=>Goo,$ZodUUID:()=>xoo,$ZodURL:()=>_oo,$ZodULID:()=>Ioo,$ZodType:()=>Sa,$ZodTuple:()=>Cmr,$ZodTransform:()=>mao,$ZodTemplateLiteral:()=>Iao,$ZodSymbol:()=>Hoo,$ZodSuccess:()=>_ao,$ZodStringFormat:()=>Af,$ZodString:()=>gTe,$ZodSet:()=>fao,$ZodRegistry:()=>fst,$ZodRecord:()=>cao,$ZodRealError:()=>Ww,$ZodReadonly:()=>Eao,$ZodPromise:()=>Aao,$ZodPrefault:()=>xao,$ZodPipe:()=>kao,$ZodOptional:()=>Omr,$ZodObjectJIT:()=>oao,$ZodObject:()=>iao,$ZodNumberFormat:()=>Woo,$ZodNumber:()=>Imr,$ZodNullable:()=>yao,$ZodNull:()=>Joo,$ZodNonOptional:()=>vao,$ZodNever:()=>Qoo,$ZodNanoID:()=>woo,$ZodNaN:()=>wao,$ZodMap:()=>lao,$ZodMAC:()=>Noo,$ZodLiteral:()=>pao,$ZodLazy:()=>Cao,$ZodKSUID:()=>Aoo,$ZodJWT:()=>qoo,$ZodIntersection:()=>uao,$ZodISOTime:()=>Moo,$ZodISODuration:()=>Roo,$ZodISODateTime:()=>Coo,$ZodISODate:()=>Ooo,$ZodIPv6:()=>Doo,$ZodIPv4:()=>Poo,$ZodGUID:()=>boo,$ZodFunction:()=>Tao,$ZodFile:()=>hao,$ZodExactOptional:()=>gao,$ZodError:()=>lmr,$ZodEnum:()=>dao,$ZodEncodeError:()=>wse,$ZodEmoji:()=>Soo,$ZodEmail:()=>voo,$ZodE164:()=>joo,$ZodDiscriminatedUnion:()=>sao,$ZodDefault:()=>bao,$ZodDate:()=>eao,$ZodCustomStringFormat:()=>Zoo,$ZodCustom:()=>Oao,$ZodCodec:()=>Mmr,$ZodCheckUpperCase:()=>loo,$ZodCheckStringFormat:()=>mTe,$ZodCheckStartsWith:()=>doo,$ZodCheckSizeEquals:()=>ioo,$ZodCheckRegex:()=>uoo,$ZodCheckProperty:()=>hoo,$ZodCheckOverwrite:()=>goo,$ZodCheckNumberFormat:()=>eoo,$ZodCheckMultipleOf:()=>Xio,$ZodCheckMinSize:()=>noo,$ZodCheckMinLength:()=>aoo,$ZodCheckMimeType:()=>moo,$ZodCheckMaxSize:()=>roo,$ZodCheckMaxLength:()=>ooo,$ZodCheckLowerCase:()=>coo,$ZodCheckLessThan:()=>wmr,$ZodCheckLengthEquals:()=>soo,$ZodCheckIncludes:()=>foo,$ZodCheckGreaterThan:()=>kmr,$ZodCheckEndsWith:()=>poo,$ZodCheckBigIntFormat:()=>too,$ZodCheck:()=>hp,$ZodCatch:()=>Sao,$ZodCUID2:()=>Eoo,$ZodCUID:()=>koo,$ZodCIDRv6:()=>Foo,$ZodCIDRv4:()=>$oo,$ZodBoolean:()=>Tmr,$ZodBigIntFormat:()=>Voo,$ZodBigInt:()=>Amr,$ZodBase64URL:()=>Uoo,$ZodBase64:()=>Loo,$ZodAsyncError:()=>pN,$ZodArray:()=>tao,$ZodAny:()=>Koo});var nio=Object.freeze({status:"aborted"});function lt(e,t,r){function n(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let c=a.prototype,l=Object.keys(c);for(let f=0;f<l.length;f++){let d=l[f];d in s||(s[d]=c[d].bind(s))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function a(s){var u;let c=r?.Parent?new o:this;n(c,s),(u=c._zod).deferred??(u.deferred=[]);for(let l of c._zod.deferred)l();return c}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var iio=Symbol("zod_brand"),pN=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},wse=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},ost={};function Tb(e){return e&&Object.assign(ost,e),ost}var ru={};iM(ru,{unwrapMessage:()=>tTe,uint8ArrayToHex:()=>S3s,uint8ArrayToBase64url:()=>v3s,uint8ArrayToBase64:()=>hio,stringifyPrimitive:()=>Co,slugify:()=>aio,shallowClone:()=>uio,safeExtend:()=>h3s,required:()=>y3s,randomString:()=>s3s,propertyKeyTypes:()=>sst,promiseAllObject:()=>a3s,primitiveTypes:()=>cio,prefixIssues:()=>hC,pick:()=>f3s,partial:()=>g3s,parsedType:()=>Vo,optionalKeys:()=>lio,omit:()=>d3s,objectClone:()=>n3s,numKeys:()=>u3s,nullish:()=>WV,normalizeParams:()=>Hr,mergeDefs:()=>mN,merge:()=>m3s,jsonStringifyReplacer:()=>ast,joinValues:()=>Lr,issue:()=>ust,isPlainObject:()=>jV,isObject:()=>kse,hexToUint8Array:()=>_3s,getSizableOrigin:()=>yst,getParsedType:()=>c3s,getLengthableOrigin:()=>bst,getEnumValues:()=>umr,getElementAtPath:()=>o3s,floatSafeRemainder:()=>oio,finalizeIssue:()=>G2,extend:()=>p3s,escapeRegex:()=>hN,esc:()=>Xhr,defineLazy:()=>Os,createTransparentProxy:()=>l3s,cloneDef:()=>i3s,clone:()=>J2,cleanRegex:()=>gst,cleanEnum:()=>b3s,captureStackTrace:()=>cmr,cached:()=>uTe,base64urlToUint8Array:()=>x3s,base64ToUint8Array:()=>pio,assignProp:()=>fz,assertNotEqual:()=>X6s,assertNever:()=>t3s,assertIs:()=>e3s,assertEqual:()=>Q6s,assert:()=>r3s,allowsEval:()=>sio,aborted:()=>UV,NUMBER_FORMAT_RANGES:()=>fio,Class:()=>emr,BIGINT_FORMAT_RANGES:()=>dio});function Q6s(e){return e}function X6s(e){return e}function e3s(e){}function t3s(e){throw new Error("Unexpected value in exhaustive check")}function r3s(e){}function umr(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function Lr(e,t="|"){return e.map(r=>Co(r)).join(t)}function ast(e,t){return typeof t=="bigint"?t.toString():t}function uTe(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function WV(e){return e==null}function gst(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function oio(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let u=n.match(/\d?e-(\d?)/);u?.[1]&&(i=Number.parseInt(u[1]))}let o=r>i?r:i,a=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return a%s/10**o}var Fno=Symbol("evaluating");function Os(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Fno)return n===void 0&&(n=Fno,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function n3s(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function fz(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function mN(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function i3s(e){return mN(e._zod.def)}function o3s(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function a3s(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<t.length;o++)i[t[o]]=n[o];return i})}function s3s(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Xhr(e){return JSON.stringify(e)}function aio(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var cmr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function kse(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var sio=uTe(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function jV(e){if(kse(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(kse(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function uio(e){return jV(e)?{...e}:Array.isArray(e)?[...e]:e}function u3s(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var c3s=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}`)}},sst=new Set(["string","number","symbol"]),cio=new Set(["string","number","bigint","boolean","symbol","undefined"]);function hN(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J2(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Hr(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 l3s(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,o){return t??(t=e()),Reflect.set(t,n,i,o)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function Co(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function lio(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var fio={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]},dio={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function f3s(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=mN(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return fz(this,"shape",a),a},checks:[]});return J2(e,o)}function d3s(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=mN(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return fz(this,"shape",a),a},checks:[]});return J2(e,o)}function p3s(e,t){if(!jV(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=mN(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return fz(this,"shape",o),o}});return J2(e,i)}function h3s(e,t){if(!jV(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=mN(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return fz(this,"shape",n),n}});return J2(e,r)}function m3s(e,t){let r=mN(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return fz(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return J2(e,r)}function g3s(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=mN(t._zod.def,{get shape(){let s=t._zod.def.shape,u={...s};if(r)for(let c in r){if(!(c in s))throw new Error(`Unrecognized key: "${c}"`);r[c]&&(u[c]=e?new e({type:"optional",innerType:s[c]}):s[c])}else for(let c in s)u[c]=e?new e({type:"optional",innerType:s[c]}):s[c];return fz(this,"shape",u),u},checks:[]});return J2(t,a)}function y3s(e,t,r){let n=mN(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(o[a]=new e({type:"nonoptional",innerType:i[a]}))}else for(let a in i)o[a]=new e({type:"nonoptional",innerType:i[a]});return fz(this,"shape",o),o}});return J2(t,n)}function UV(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function hC(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function tTe(e){return typeof e=="string"?e:e?.message}function G2(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=tTe(e.inst?._zod.def?.error?.(e))??tTe(t?.error?.(e))??tTe(r.customError?.(e))??tTe(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function yst(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function bst(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Vo(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function ust(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function b3s(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function pio(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function hio(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function x3s(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return pio(t+r)}function v3s(e){return hio(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function _3s(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function S3s(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var emr=class{constructor(...t){}},mio=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ast,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lmr=lt("$ZodError",mio),Ww=lt("$ZodError",mio,{Parent:Error});function fmr(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function dmr(e,t=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>n({issues:a}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let a=r,s=0;for(;s<o.path.length;){let u=o.path[s];s===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(o))):a[u]=a[u]||{_errors:[]},a=a[u],s++}}};return n(e),r}function gio(e,t=r=>r.message){let r={errors:[]},n=(i,o=[])=>{var a,s;for(let u of i.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(c=>n({issues:c},u.path));else if(u.code==="invalid_key")n({issues:u.issues},u.path);else if(u.code==="invalid_element")n({issues:u.issues},u.path);else{let c=[...o,...u.path];if(c.length===0){r.errors.push(t(u));continue}let l=r,f=0;for(;f<c.length;){let d=c[f],p=f===c.length-1;typeof d=="string"?(l.properties??(l.properties={}),(a=l.properties)[d]??(a[d]={errors:[]}),l=l.properties[d]):(l.items??(l.items=[]),(s=l.items)[d]??(s[d]={errors:[]}),l=l.items[d]),p&&l.errors.push(t(u)),f++}}};return n(e),r}function yio(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function bio(e){let t=[],r=[...e.issues].sort((n,i)=>(n.path??[]).length-(i.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${yio(n.path)}`);return t.join(`
|
|
1885
|
+
`);let a=await HR(i.filePath,r);a.callSign=t;let s,u=!0,c=W6s(i.folderPath);if(c){let{aiTool:d}=await import(c),p=d.inputSchema;if(p){let g=await Zat(p);if(a.method.usage.parameters=g.properties,g.required&&g.required.length>0)for(let O of g.required)a.method.usage.parameters[O]=a.method.usage.parameters[O]||{},a.method.usage.parameters[O].required=!0;let x={};Object.keys(g.properties||{}).forEach(O=>{x[O]=r[O]??void 0});let T=p.safeParse(r);if(!T.success)throw new Error(`Invalid parameters for ${t}: ${T.error.message}`)}if(n)try{s=await d.execute(r||{})}catch(g){s=g.message,u=!1}}let l=r?.reference,f=await G6s(i.folderPath+"/references",[l]);if(f){let d=Object.keys(f);d.length>0&&(a.method.references={referenceInstruction:[`Check the <referenceList /> to see if it is necessary to read the reference content and execute ${j5} with the reference name to load the full content.`,`Example: ${j5}(method: "${t}", params: {reference: "reference-name.md"})`],referenceNames:d,referenceList:f})}return{promptData:a,scriptResult:s,scriptSuccess:u,partyMode:o}}catch(o){throw new Error(`Failed to get CounterContent for '${t}': ${o}`)}}var W6s=e=>{if(e){let t=Xat(e,"scripts","index.ts");if(Dno(t))return t}},Qat=null;async function ov(e=[],t=import.meta.dir){if(Qat==null){Qat=YLt();for(let n of Uqe)Qat[n]=await V6s(t,n)}(!e||e.length===0)&&(e=[...Uqe]);let r=[];for(let n of e)r.push(...Qat[n]||[]);return r}async function V6s(e,t){let r=[];try{let n,i,o=!1;t==="method"?(n="skills",i=s=>s==="SKILL.mdx",o=!0):(n=`${t}s`,i=s=>s.endsWith(".md")||s.endsWith(".mdx"));let a=Nno(e,{targetFolderName:n,fileNameFilter:i,searchInSubfolders:o,fileExtensions:[".md",".mdx"],excludePatterns:[".","__","hidden"]});if(t==="method")for(let s of a)try{let u=await HR(s.fullPath),c=Z6s(s.fullPath),l=Khr(c).toLowerCase();r.push({callSign:`${t}-${l}`,type:t,id:l,name:_se(u,["name"]),folderPath:c,filePath:s.fullPath,description:_se(u,["description"]),category:_se(u,["category"])})}catch(u){console.warn(`Failed to read ${s.fullPath}:`,u)}else for(let s of a)try{let u=await HR(s.fullPath),c=H6s(Khr(s.fullPath));r.push({callSign:`${t}-${c}`,type:t,id:c,name:_se(u,["name"]),filePath:s.fullPath,description:_se(u,["description"]),category:_se(u,["category"]),role:u.persona?.role})}catch(u){console.warn(`Failed to read ${s.fullPath}:`,u)}}catch(n){console.warn("Failed to scan methods directory:",n)}return r}var H6s=e=>Khr(e,q6s(e)).toLowerCase(),_se=(e,t)=>{let r=["agent","method"];for(let n of r)for(let i of t){let o=n6(e,[n,i]);if(o!=null)return o}};function Nno(e,t){let r=[],{targetFolderName:n,fileExtensions:i=[".md",".mdx"],fileNameFilter:o=()=>!0,excludePatterns:a=[".","__"],searchInSubfolders:s=!1}=t;function u(l,f){try{let d=Ghr(l);for(let p of d){if(a.some(T=>p.startsWith(T)))continue;let g=Xat(l,p),x=f?`${f}/${p}`:p;try{let T=Jhr(g);if(T.isFile()){let O=i.some(P=>p.endsWith(P)),F=o(p),$=!a.some(P=>p.startsWith(P));O&&F&&$&&r.push({filename:x,fullPath:g})}else T.isDirectory()&&s&&u(g,x)}catch{}}}catch{}}function c(l,f=""){try{let d=Ghr(l);for(let p of d){if(a.some(T=>p.startsWith(T)))continue;let g=Xat(l,p),x=f?`${f}/${p}`:p;try{let T=Jhr(g);p===n&&T.isDirectory()&&u(g,x),T.isDirectory()&&p!==n&&c(g,x)}catch{}}}catch{}}return c(e),r.sort((l,f)=>l.filename.localeCompare(f.filename))}function $no(e){return Nno(e,{targetFolderName:"templates",fileExtensions:[".md",".mdx"],fileNameFilter:t=>t.includes("tmpl")})}async function G6s(e,t){let r={};if(!e||!Dno(e))return r;try{let n=Ghr(e);for(let i of n){if(i.startsWith(".")||i.startsWith("_"))continue;let o=Xat(e,i);try{if(Jhr(o).isFile()&&(i.endsWith(".md")||i.endsWith(".mdx"))){let s=B6s(o,"utf-8"),{data:u}=Gmi(s),c=String(u.description||"");r[i]={description:c},t&&t.includes(i)&&(r[i].content=s)}}catch(a){console.warn(`Failed to read ${o}:`,a)}}}catch(n){console.warn("Failed to scan references directory:",n)}return r}var J6s=Object.defineProperty,iM=(e,t)=>{for(var r in t)J6s(e,r,{get:t[r],enumerable:!0,configurable:!0,set:n=>t[r]=()=>n})};var Qhr=class extends Error{constructor(r,n){super(r);v(this,"cause");this.name=this.constructor.name,n&&(this.cause=n)}},K6s=["text","image","audio","resource_link","resource"];function smr(e){let t=e?structuredClone(e):null,r=new Array;return Array.isArray(t)?r.push(...t.map(n=>typeof n=="string"?{type:"text",text:n}:n.type&&K6s.includes(n.type)?n:{type:"text",text:JSON.stringify(n)})):t!=null&&r.push({type:"text",text:typeof t=="string"?t:JSON.stringify(t)}),r}function ZV(e,t){let r=structuredClone(e),i={isError:r.success!=null?!r.success:!1,content:[{type:"text",text:JSON.stringify(r)}]},o=smr(t);return o.length>0&&i.content.push(...o),i}function Mse(e,t,r){let n,i=!0;if(typeof e=="string")n={error:e,operation:t,meta:r};else if(e instanceof Qhr)n={error:e.message,operation:t,meta:r,code:e.code,reason:e.cause?.message};else if(e instanceof Error)n={error:e.message,operation:t,meta:r};else if(typeof e=="object"&&e!==null&&typeof e.message=="string"){let o=e;i=!o.success,n={error:o.message,code:o.code,operation:o.operation||t,meta:r}}else n={error:"Unknown error",operation:t,meta:r};return{isError:i,content:[{type:"text",text:JSON.stringify(n)}]}}var Yhr=[null,"debug","info","warn","error","success"],ist=class e{constructor(t,r){v(this,"options",{});v(this,"logLevel");typeof t=="string"?this.options.name=t:this.options={...this.options,...t},this.logLevel=r||null}static getInstance(t,r){return new e(t,r)}getTimestamp(){if(this.options.timestampFormat===!1)return;let t=new Date;return this.options.timestampFormat==="locale"?t.toLocaleString():t.toISOString()}initLogLevel(){let t=null;typeof process<"u"&&(t=process.env.MODALITY_LOG_LEVEL),this.logLevel=Yhr.indexOf(t)!==-1?t:"info"}shouldLog(t){return this.logLevel||this.initLogLevel(),Yhr.indexOf(t)>=Yhr.indexOf(this.logLevel)}setLogLevel(t){this.logLevel=t}format(t,r){let n=this.getTimestamp(),i="";switch(t){case"debug":i="\u{1F50D}";break;case"info":i="\u2139\uFE0F";break;case"warn":i="\u26A0\uFE0F";break;case"error":i="\u274C";break;case"success":i="\u2705";break}return n&&(i+=` [${n}]`),this.options.name&&(i+=` [${this.options.name}]`),r&&(i+=` [${r}]`),i}log(t,r,n){if(!this.shouldLog(t))return;let i=this.format(t,n);switch(console.group(i),t){case"debug":console.debug(r);break;case"info":{let{message:o,...a}=r;console.info(o),Object.keys(a).length&&console.dir(a,{depth:null,colors:!0,maxArrayLength:null});break}case"warn":{let{message:o,...a}=r;console.warn(o),console.dir(a,{depth:null,colors:!0,maxArrayLength:null});break}case"error":{let o=r.error;if(o instanceof Error||o.stack){delete r.error;let{message:a,stack:s,...u}=o;s?Object.keys(u).length?(console.error(u),console.log(s)):console.error(s):(a&&(r.error=a),console.error(r))}else console.error(r);break}case"success":console.log(r);break}console.groupEnd()}cook(t,r){let n=typeof t=="string"?{message:t}:t;return r&&(n.data=r),n}debug(t,r){this.log("debug",this.cook(t,r))}info(t,r){this.log("info",this.cook(t,r))}warn(t,r){this.log("warn",this.cook(t,r))}error(t,r,n){let i={error:r};this.log("error",this.cook(i,n),t)}success(t,r){this.log("success",this.cook(t,r))}},sTe=ist.getInstance.bind(ist),ORu=sTe("Safe to Handle");var Y6s={};iM(Y6s,{symbolKinds:()=>jco,symbolKindSchema:()=>TRs,rangeSchema:()=>ARs});var pC={};iM(pC,{xor:()=>gco,xid:()=>zuo,void:()=>lco,uuidv7:()=>Muo,uuidv6:()=>Ouo,uuidv4:()=>Cuo,uuid:()=>Auo,util:()=>ru,url:()=>Ruo,uppercase:()=>wst,unknown:()=>qV,union:()=>Xst,undefined:()=>uco,ulid:()=>Luo,uint64:()=>aco,uint32:()=>nco,tuple:()=>Cgr,trim:()=>Cst,treeifyError:()=>gio,transform:()=>tut,toUpperCase:()=>Mst,toLowerCase:()=>Ost,toJSONSchema:()=>auo,templateLiteral:()=>Cco,symbol:()=>sco,superRefine:()=>ryr,success:()=>Ico,stringbool:()=>$co,stringFormat:()=>Kuo,string:()=>pst,strictObject:()=>hco,startsWith:()=>Est,slugify:()=>Rst,size:()=>yTe,setErrorMap:()=>gRs,set:()=>_co,safeParseAsync:()=>yuo,safeParse:()=>guo,safeEncodeAsync:()=>kuo,safeEncode:()=>Suo,safeDecodeAsync:()=>Euo,safeDecode:()=>wuo,registry:()=>Pmr,regexes:()=>VV,regex:()=>_st,refine:()=>tyr,record:()=>Ogr,readonly:()=>Jgr,property:()=>igr,promise:()=>Oco,prettifyError:()=>bio,preprocess:()=>Lco,prefault:()=>Bgr,positive:()=>egr,pipe:()=>aTe,partialRecord:()=>bco,parseAsync:()=>muo,parse:()=>huo,overwrite:()=>gN,optional:()=>iTe,object:()=>pco,number:()=>pgr,nullish:()=>Eco,nullable:()=>oTe,null:()=>bgr,normalize:()=>Ast,nonpositive:()=>rgr,nonoptional:()=>qgr,nonnegative:()=>ngr,never:()=>Yst,negative:()=>tgr,nativeEnum:()=>Sco,nanoid:()=>Nuo,nan:()=>Tco,multipleOf:()=>Ise,minSize:()=>lz,minLength:()=>BV,mime:()=>Tst,meta:()=>Dco,maxSize:()=>Rse,maxLength:()=>bTe,map:()=>vco,mac:()=>Buo,lte:()=>H2,lt:()=>uz,lowercase:()=>Sst,looseRecord:()=>xco,looseObject:()=>mco,locales:()=>Rmr,literal:()=>wco,length:()=>xTe,lazy:()=>Qgr,ksuid:()=>Uuo,keyof:()=>dco,jwt:()=>Juo,json:()=>Fco,iso:()=>sgr,ipv6:()=>quo,ipv4:()=>juo,intersection:()=>Tgr,int64:()=>oco,int32:()=>rco,int:()=>hst,instanceof:()=>Nco,includes:()=>kst,httpUrl:()=>Puo,hostname:()=>Yuo,hex:()=>Quo,hash:()=>Xuo,guid:()=>Tuo,gte:()=>m1,gt:()=>cz,globalRegistry:()=>V2,getErrorMap:()=>yRs,function:()=>mst,fromJSONSchema:()=>_Rs,formatError:()=>dmr,float64:()=>tco,float32:()=>eco,flattenError:()=>fmr,file:()=>kco,exactOptional:()=>Fgr,enum:()=>eut,endsWith:()=>Ist,encodeAsync:()=>vuo,encode:()=>buo,emoji:()=>Duo,email:()=>Iuo,e164:()=>Guo,discriminatedUnion:()=>yco,describe:()=>Pco,decodeAsync:()=>_uo,decode:()=>xuo,date:()=>fco,custom:()=>Rco,cuid2:()=>Fuo,cuid:()=>$uo,core:()=>rio,config:()=>Tb,coerce:()=>Uco,codec:()=>Aco,clone:()=>J2,cidrv6:()=>Wuo,cidrv4:()=>Zuo,check:()=>Mco,catch:()=>Vgr,boolean:()=>hgr,bigint:()=>ico,base64url:()=>Huo,base64:()=>Vuo,array:()=>ITe,any:()=>cco,_function:()=>mst,_default:()=>Ugr,_ZodString:()=>Pst,ZodXor:()=>kgr,ZodXID:()=>Ust,ZodVoid:()=>Sgr,ZodUnknown:()=>vgr,ZodUnion:()=>ATe,ZodUndefined:()=>ggr,ZodUUID:()=>nM,ZodURL:()=>STe,ZodULID:()=>zst,ZodType:()=>Ga,ZodTuple:()=>Agr,ZodTransform:()=>Ngr,ZodTemplateLiteral:()=>Kgr,ZodSymbol:()=>mgr,ZodSuccess:()=>Zgr,ZodStringFormat:()=>Cf,ZodString:()=>_Te,ZodSet:()=>Rgr,ZodRecord:()=>CTe,ZodRealError:()=>Vw,ZodReadonly:()=>Ggr,ZodPromise:()=>Xgr,ZodPrefault:()=>jgr,ZodPipe:()=>iut,ZodOptional:()=>rut,ZodObject:()=>TTe,ZodNumberFormat:()=>HV,ZodNumber:()=>wTe,ZodNullable:()=>Lgr,ZodNull:()=>ygr,ZodNonOptional:()=>nut,ZodNever:()=>_gr,ZodNanoID:()=>$st,ZodNaN:()=>Hgr,ZodMap:()=>Mgr,ZodMAC:()=>dgr,ZodLiteral:()=>Pgr,ZodLazy:()=>Ygr,ZodKSUID:()=>jst,ZodJWT:()=>Jst,ZodIssueCode:()=>mRs,ZodIntersection:()=>Igr,ZodISOTime:()=>lgr,ZodISODuration:()=>fgr,ZodISODateTime:()=>ugr,ZodISODate:()=>cgr,ZodIPv6:()=>qst,ZodIPv4:()=>Bst,ZodGUID:()=>nTe,ZodFunction:()=>eyr,ZodFirstPartyTypeKind:()=>amr,ZodFile:()=>Dgr,ZodExactOptional:()=>$gr,ZodError:()=>hRs,ZodEnum:()=>Ose,ZodEmoji:()=>Nst,ZodEmail:()=>Dst,ZodE164:()=>Gst,ZodDiscriminatedUnion:()=>Egr,ZodDefault:()=>zgr,ZodDate:()=>Qst,ZodCustomStringFormat:()=>Pse,ZodCustom:()=>OTe,ZodCodec:()=>out,ZodCatch:()=>Wgr,ZodCUID2:()=>Lst,ZodCUID:()=>Fst,ZodCIDRv6:()=>Wst,ZodCIDRv4:()=>Zst,ZodBoolean:()=>kTe,ZodBigIntFormat:()=>Kst,ZodBigInt:()=>ETe,ZodBase64URL:()=>Hst,ZodBase64:()=>Vst,ZodArray:()=>wgr,ZodAny:()=>xgr,TimePrecision:()=>zao,NEVER:()=>nio,$output:()=>Dao,$input:()=>Nao,$brand:()=>iio});var rio={};iM(rio,{version:()=>yoo,util:()=>ru,treeifyError:()=>gio,toJSONSchema:()=>auo,toDotPath:()=>yio,safeParseAsync:()=>vio,safeParse:()=>xio,safeEncodeAsync:()=>C3s,safeEncode:()=>T3s,safeDecodeAsync:()=>O3s,safeDecode:()=>A3s,registry:()=>Pmr,regexes:()=>VV,process:()=>Xl,prettifyError:()=>bio,parseAsync:()=>rmr,parse:()=>tmr,meta:()=>vso,locales:()=>Rmr,isValidJWT:()=>Boo,isValidBase64URL:()=>zoo,isValidBase64:()=>Emr,initializeContext:()=>Tse,globalRegistry:()=>V2,globalConfig:()=>ost,formatError:()=>dmr,flattenError:()=>fmr,finalize:()=>Cse,extractDefs:()=>Ase,encodeAsync:()=>E3s,encode:()=>w3s,describe:()=>xso,decodeAsync:()=>I3s,decode:()=>k3s,createToJSONSchemaMethod:()=>Sso,createStandardJSONSchemaMethod:()=>rTe,config:()=>Tb,clone:()=>J2,_xor:()=>Z4s,_xid:()=>Zmr,_void:()=>cso,_uuidv7:()=>Lmr,_uuidv6:()=>Fmr,_uuidv4:()=>$mr,_uuid:()=>Nmr,_url:()=>vst,_uppercase:()=>wst,_unknown:()=>sso,_union:()=>q4s,_undefined:()=>iso,_ulid:()=>qmr,_uint64:()=>rso,_uint32:()=>Kao,_tuple:()=>H4s,_trim:()=>Cst,_transform:()=>eRs,_toUpperCase:()=>Mst,_toLowerCase:()=>Ost,_templateLiteral:()=>cRs,_symbol:()=>nso,_superRefine:()=>yso,_success:()=>oRs,_stringbool:()=>_so,_stringFormat:()=>vTe,_string:()=>$ao,_startsWith:()=>Est,_slugify:()=>Rst,_size:()=>yTe,_set:()=>K4s,_safeParseAsync:()=>dTe,_safeParse:()=>fTe,_safeEncodeAsync:()=>xmr,_safeEncode:()=>ymr,_safeDecodeAsync:()=>vmr,_safeDecode:()=>bmr,_regex:()=>_st,_refine:()=>gso,_record:()=>G4s,_readonly:()=>uRs,_property:()=>igr,_promise:()=>fRs,_positive:()=>egr,_pipe:()=>sRs,_parseAsync:()=>lTe,_parse:()=>cTe,_overwrite:()=>gN,_optional:()=>tRs,_number:()=>Zao,_nullable:()=>rRs,_null:()=>oso,_normalize:()=>Ast,_nonpositive:()=>rgr,_nonoptional:()=>iRs,_nonnegative:()=>ngr,_never:()=>uso,_negative:()=>tgr,_nativeEnum:()=>Q4s,_nanoid:()=>Umr,_nan:()=>dso,_multipleOf:()=>Ise,_minSize:()=>lz,_minLength:()=>BV,_min:()=>m1,_mime:()=>Tst,_maxSize:()=>Rse,_maxLength:()=>bTe,_max:()=>H2,_map:()=>J4s,_mac:()=>Lao,_lte:()=>H2,_lt:()=>uz,_lowercase:()=>Sst,_literal:()=>X4s,_length:()=>xTe,_lazy:()=>lRs,_ksuid:()=>Wmr,_jwt:()=>Xmr,_isoTime:()=>Bao,_isoDuration:()=>qao,_isoDateTime:()=>Uao,_isoDate:()=>jao,_ipv6:()=>Hmr,_ipv4:()=>Vmr,_intersection:()=>V4s,_int64:()=>tso,_int32:()=>Jao,_int:()=>Vao,_includes:()=>kst,_guid:()=>dst,_gte:()=>m1,_gt:()=>cz,_float64:()=>Gao,_float32:()=>Hao,_file:()=>hso,_enum:()=>Y4s,_endsWith:()=>Ist,_encodeAsync:()=>mmr,_encode:()=>pmr,_emoji:()=>zmr,_email:()=>Dmr,_e164:()=>Qmr,_discriminatedUnion:()=>W4s,_default:()=>nRs,_decodeAsync:()=>gmr,_decode:()=>hmr,_date:()=>lso,_custom:()=>mso,_cuid2:()=>Bmr,_cuid:()=>jmr,_coercedString:()=>Fao,_coercedNumber:()=>Wao,_coercedDate:()=>fso,_coercedBoolean:()=>Qao,_coercedBigint:()=>eso,_cidrv6:()=>Jmr,_cidrv4:()=>Gmr,_check:()=>bso,_catch:()=>aRs,_boolean:()=>Yao,_bigint:()=>Xao,_base64url:()=>Ymr,_base64:()=>Kmr,_array:()=>pso,_any:()=>aso,TimePrecision:()=>zao,NEVER:()=>nio,JSONSchemaGenerator:()=>omr,JSONSchema:()=>pRs,Doc:()=>cst,$output:()=>Dao,$input:()=>Nao,$constructor:()=>lt,$brand:()=>iio,$ZodXor:()=>aao,$ZodXID:()=>Too,$ZodVoid:()=>Xoo,$ZodUnknown:()=>Yoo,$ZodUnion:()=>xst,$ZodUndefined:()=>Goo,$ZodUUID:()=>xoo,$ZodURL:()=>_oo,$ZodULID:()=>Ioo,$ZodType:()=>Sa,$ZodTuple:()=>Cmr,$ZodTransform:()=>mao,$ZodTemplateLiteral:()=>Iao,$ZodSymbol:()=>Hoo,$ZodSuccess:()=>_ao,$ZodStringFormat:()=>Af,$ZodString:()=>gTe,$ZodSet:()=>fao,$ZodRegistry:()=>fst,$ZodRecord:()=>cao,$ZodRealError:()=>Ww,$ZodReadonly:()=>Eao,$ZodPromise:()=>Aao,$ZodPrefault:()=>xao,$ZodPipe:()=>kao,$ZodOptional:()=>Omr,$ZodObjectJIT:()=>oao,$ZodObject:()=>iao,$ZodNumberFormat:()=>Woo,$ZodNumber:()=>Imr,$ZodNullable:()=>yao,$ZodNull:()=>Joo,$ZodNonOptional:()=>vao,$ZodNever:()=>Qoo,$ZodNanoID:()=>woo,$ZodNaN:()=>wao,$ZodMap:()=>lao,$ZodMAC:()=>Noo,$ZodLiteral:()=>pao,$ZodLazy:()=>Cao,$ZodKSUID:()=>Aoo,$ZodJWT:()=>qoo,$ZodIntersection:()=>uao,$ZodISOTime:()=>Moo,$ZodISODuration:()=>Roo,$ZodISODateTime:()=>Coo,$ZodISODate:()=>Ooo,$ZodIPv6:()=>Doo,$ZodIPv4:()=>Poo,$ZodGUID:()=>boo,$ZodFunction:()=>Tao,$ZodFile:()=>hao,$ZodExactOptional:()=>gao,$ZodError:()=>lmr,$ZodEnum:()=>dao,$ZodEncodeError:()=>wse,$ZodEmoji:()=>Soo,$ZodEmail:()=>voo,$ZodE164:()=>joo,$ZodDiscriminatedUnion:()=>sao,$ZodDefault:()=>bao,$ZodDate:()=>eao,$ZodCustomStringFormat:()=>Zoo,$ZodCustom:()=>Oao,$ZodCodec:()=>Mmr,$ZodCheckUpperCase:()=>loo,$ZodCheckStringFormat:()=>mTe,$ZodCheckStartsWith:()=>doo,$ZodCheckSizeEquals:()=>ioo,$ZodCheckRegex:()=>uoo,$ZodCheckProperty:()=>hoo,$ZodCheckOverwrite:()=>goo,$ZodCheckNumberFormat:()=>eoo,$ZodCheckMultipleOf:()=>Xio,$ZodCheckMinSize:()=>noo,$ZodCheckMinLength:()=>aoo,$ZodCheckMimeType:()=>moo,$ZodCheckMaxSize:()=>roo,$ZodCheckMaxLength:()=>ooo,$ZodCheckLowerCase:()=>coo,$ZodCheckLessThan:()=>wmr,$ZodCheckLengthEquals:()=>soo,$ZodCheckIncludes:()=>foo,$ZodCheckGreaterThan:()=>kmr,$ZodCheckEndsWith:()=>poo,$ZodCheckBigIntFormat:()=>too,$ZodCheck:()=>hp,$ZodCatch:()=>Sao,$ZodCUID2:()=>Eoo,$ZodCUID:()=>koo,$ZodCIDRv6:()=>Foo,$ZodCIDRv4:()=>$oo,$ZodBoolean:()=>Tmr,$ZodBigIntFormat:()=>Voo,$ZodBigInt:()=>Amr,$ZodBase64URL:()=>Uoo,$ZodBase64:()=>Loo,$ZodAsyncError:()=>pN,$ZodArray:()=>tao,$ZodAny:()=>Koo});var nio=Object.freeze({status:"aborted"});function lt(e,t,r){function n(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let c=a.prototype,l=Object.keys(c);for(let f=0;f<l.length;f++){let d=l[f];d in s||(s[d]=c[d].bind(s))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function a(s){var u;let c=r?.Parent?new o:this;n(c,s),(u=c._zod).deferred??(u.deferred=[]);for(let l of c._zod.deferred)l();return c}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var iio=Symbol("zod_brand"),pN=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},wse=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},ost={};function Tb(e){return e&&Object.assign(ost,e),ost}var ru={};iM(ru,{unwrapMessage:()=>tTe,uint8ArrayToHex:()=>S3s,uint8ArrayToBase64url:()=>v3s,uint8ArrayToBase64:()=>hio,stringifyPrimitive:()=>Co,slugify:()=>aio,shallowClone:()=>uio,safeExtend:()=>h3s,required:()=>y3s,randomString:()=>s3s,propertyKeyTypes:()=>sst,promiseAllObject:()=>a3s,primitiveTypes:()=>cio,prefixIssues:()=>hC,pick:()=>f3s,partial:()=>g3s,parsedType:()=>Vo,optionalKeys:()=>lio,omit:()=>d3s,objectClone:()=>n3s,numKeys:()=>u3s,nullish:()=>WV,normalizeParams:()=>Hr,mergeDefs:()=>mN,merge:()=>m3s,jsonStringifyReplacer:()=>ast,joinValues:()=>Lr,issue:()=>ust,isPlainObject:()=>jV,isObject:()=>kse,hexToUint8Array:()=>_3s,getSizableOrigin:()=>yst,getParsedType:()=>c3s,getLengthableOrigin:()=>bst,getEnumValues:()=>umr,getElementAtPath:()=>o3s,floatSafeRemainder:()=>oio,finalizeIssue:()=>G2,extend:()=>p3s,escapeRegex:()=>hN,esc:()=>Xhr,defineLazy:()=>Os,createTransparentProxy:()=>l3s,cloneDef:()=>i3s,clone:()=>J2,cleanRegex:()=>gst,cleanEnum:()=>b3s,captureStackTrace:()=>cmr,cached:()=>uTe,base64urlToUint8Array:()=>x3s,base64ToUint8Array:()=>pio,assignProp:()=>fz,assertNotEqual:()=>X6s,assertNever:()=>t3s,assertIs:()=>e3s,assertEqual:()=>Q6s,assert:()=>r3s,allowsEval:()=>sio,aborted:()=>UV,NUMBER_FORMAT_RANGES:()=>fio,Class:()=>emr,BIGINT_FORMAT_RANGES:()=>dio});function Q6s(e){return e}function X6s(e){return e}function e3s(e){}function t3s(e){throw new Error("Unexpected value in exhaustive check")}function r3s(e){}function umr(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function Lr(e,t="|"){return e.map(r=>Co(r)).join(t)}function ast(e,t){return typeof t=="bigint"?t.toString():t}function uTe(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function WV(e){return e==null}function gst(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function oio(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let u=n.match(/\d?e-(\d?)/);u?.[1]&&(i=Number.parseInt(u[1]))}let o=r>i?r:i,a=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return a%s/10**o}var Fno=Symbol("evaluating");function Os(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Fno)return n===void 0&&(n=Fno,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function n3s(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function fz(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function mN(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function i3s(e){return mN(e._zod.def)}function o3s(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function a3s(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<t.length;o++)i[t[o]]=n[o];return i})}function s3s(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Xhr(e){return JSON.stringify(e)}function aio(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var cmr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function kse(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var sio=uTe(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function jV(e){if(kse(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(kse(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function uio(e){return jV(e)?{...e}:Array.isArray(e)?[...e]:e}function u3s(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var c3s=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}`)}},sst=new Set(["string","number","symbol"]),cio=new Set(["string","number","bigint","boolean","symbol","undefined"]);function hN(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J2(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Hr(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 l3s(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,o){return t??(t=e()),Reflect.set(t,n,i,o)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function Co(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function lio(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var fio={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]},dio={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function f3s(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=mN(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return fz(this,"shape",a),a},checks:[]});return J2(e,o)}function d3s(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=mN(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return fz(this,"shape",a),a},checks:[]});return J2(e,o)}function p3s(e,t){if(!jV(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=mN(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return fz(this,"shape",o),o}});return J2(e,i)}function h3s(e,t){if(!jV(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=mN(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return fz(this,"shape",n),n}});return J2(e,r)}function m3s(e,t){let r=mN(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return fz(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return J2(e,r)}function g3s(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=mN(t._zod.def,{get shape(){let s=t._zod.def.shape,u={...s};if(r)for(let c in r){if(!(c in s))throw new Error(`Unrecognized key: "${c}"`);r[c]&&(u[c]=e?new e({type:"optional",innerType:s[c]}):s[c])}else for(let c in s)u[c]=e?new e({type:"optional",innerType:s[c]}):s[c];return fz(this,"shape",u),u},checks:[]});return J2(t,a)}function y3s(e,t,r){let n=mN(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(o[a]=new e({type:"nonoptional",innerType:i[a]}))}else for(let a in i)o[a]=new e({type:"nonoptional",innerType:i[a]});return fz(this,"shape",o),o}});return J2(t,n)}function UV(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function hC(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function tTe(e){return typeof e=="string"?e:e?.message}function G2(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=tTe(e.inst?._zod.def?.error?.(e))??tTe(t?.error?.(e))??tTe(r.customError?.(e))??tTe(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function yst(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function bst(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Vo(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function ust(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function b3s(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function pio(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function hio(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function x3s(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return pio(t+r)}function v3s(e){return hio(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function _3s(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function S3s(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var emr=class{constructor(...t){}},mio=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ast,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},lmr=lt("$ZodError",mio),Ww=lt("$ZodError",mio,{Parent:Error});function fmr(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function dmr(e,t=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>n({issues:a}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let a=r,s=0;for(;s<o.path.length;){let u=o.path[s];s===o.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(o))):a[u]=a[u]||{_errors:[]},a=a[u],s++}}};return n(e),r}function gio(e,t=r=>r.message){let r={errors:[]},n=(i,o=[])=>{var a,s;for(let u of i.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(c=>n({issues:c},u.path));else if(u.code==="invalid_key")n({issues:u.issues},u.path);else if(u.code==="invalid_element")n({issues:u.issues},u.path);else{let c=[...o,...u.path];if(c.length===0){r.errors.push(t(u));continue}let l=r,f=0;for(;f<c.length;){let d=c[f],p=f===c.length-1;typeof d=="string"?(l.properties??(l.properties={}),(a=l.properties)[d]??(a[d]={errors:[]}),l=l.properties[d]):(l.items??(l.items=[]),(s=l.items)[d]??(s[d]={errors:[]}),l=l.items[d]),p&&l.errors.push(t(u)),f++}}};return n(e),r}function yio(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}function bio(e){let t=[],r=[...e.issues].sort((n,i)=>(n.path??[]).length-(i.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${yio(n.path)}`);return t.join(`
|
|
1886
1886
|
`)}var cTe=e=>(t,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new pN;if(a.issues.length){let s=new(i?.Err??e)(a.issues.map(u=>G2(u,o,Tb())));throw cmr(s,i?.callee),s}return a.value},tmr=cTe(Ww),lTe=e=>async(t,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(i?.Err??e)(a.issues.map(u=>G2(u,o,Tb())));throw cmr(s,i?.callee),s}return a.value},rmr=lTe(Ww),fTe=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new pN;return o.issues.length?{success:!1,error:new(e??lmr)(o.issues.map(a=>G2(a,i,Tb())))}:{success:!0,data:o.value}},xio=fTe(Ww),dTe=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>G2(a,i,Tb())))}:{success:!0,data:o.value}},vio=dTe(Ww),pmr=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return cTe(e)(t,r,i)},w3s=pmr(Ww),hmr=e=>(t,r,n)=>cTe(e)(t,r,n),k3s=hmr(Ww),mmr=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return lTe(e)(t,r,i)},E3s=mmr(Ww),gmr=e=>async(t,r,n)=>lTe(e)(t,r,n),I3s=gmr(Ww),ymr=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return fTe(e)(t,r,i)},T3s=ymr(Ww),bmr=e=>(t,r,n)=>fTe(e)(t,r,n),A3s=bmr(Ww),xmr=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return dTe(e)(t,r,i)},C3s=xmr(Ww),vmr=e=>async(t,r,n)=>dTe(e)(t,r,n),O3s=vmr(Ww),VV={};iM(VV,{xid:()=>kio,uuid7:()=>D3s,uuid6:()=>P3s,uuid4:()=>R3s,uuid:()=>Ese,uppercase:()=>Yio,unicodeEmail:()=>Oio,undefined:()=>Jio,ulid:()=>wio,time:()=>Bio,string:()=>Zio,sha512_hex:()=>tMs,sha512_base64url:()=>nMs,sha512_base64:()=>rMs,sha384_hex:()=>Q3s,sha384_base64url:()=>eMs,sha384_base64:()=>X3s,sha256_hex:()=>J3s,sha256_base64url:()=>Y3s,sha256_base64:()=>K3s,sha1_hex:()=>V3s,sha1_base64url:()=>G3s,sha1_base64:()=>H3s,rfc5322Email:()=>$3s,number:()=>Smr,null:()=>Gio,nanoid:()=>Iio,md5_hex:()=>q3s,md5_base64url:()=>W3s,md5_base64:()=>Z3s,mac:()=>Dio,lowercase:()=>Kio,ksuid:()=>Eio,ipv6:()=>Pio,ipv4:()=>Rio,integer:()=>Vio,idnEmail:()=>F3s,html5Email:()=>N3s,hostname:()=>U3s,hex:()=>B3s,guid:()=>Aio,extendedDuration:()=>M3s,emoji:()=>Mio,email:()=>Cio,e164:()=>Lio,duration:()=>Tio,domain:()=>j3s,datetime:()=>qio,date:()=>Uio,cuid2:()=>Sio,cuid:()=>_io,cidrv6:()=>$io,cidrv4:()=>Nio,browserEmail:()=>L3s,boolean:()=>Hio,bigint:()=>Wio,base64url:()=>_mr,base64:()=>Fio});var _io=/^[cC][^\s-]{8,}$/,Sio=/^[0-9a-z]+$/,wio=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,kio=/^[0-9a-vA-V]{20}$/,Eio=/^[A-Za-z0-9]{27}$/,Iio=/^[a-zA-Z0-9_-]{21}$/,Tio=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,M3s=/^[-+]?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)?)??$/,Aio=/^([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})$/,Ese=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)$/,R3s=Ese(4),P3s=Ese(6),D3s=Ese(7),Cio=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,N3s=/^[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])?)*$/,$3s=/^(([^<>()\[\]\\.,;:\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,}))$/,Oio=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,F3s=Oio,L3s=/^[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])?)*$/,z3s="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Mio(){return new RegExp(z3s,"u")}var Rio=/^(?:(?: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])$/,Pio=/^(([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}|:))$/,Dio=e=>{let t=hN(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Nio=/^((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])$/,$io=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Fio=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_mr=/^[A-Za-z0-9_-]*$/,U3s=/^(?=.{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])?)*\.?$/,j3s=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Lio=/^\+[1-9]\d{6,14}$/,zio="(?:(?:\\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])))",Uio=new RegExp(`^${zio}$`);function jio(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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Bio(e){return new RegExp(`^${jio(e)}$`)}function qio(e){let t=jio({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${zio}T(?:${n})$`)}var Zio=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Wio=/^-?\d+n?$/,Vio=/^-?\d+$/,Smr=/^-?\d+(?:\.\d+)?$/,Hio=/^(?:true|false)$/i,Gio=/^null$/i,Jio=/^undefined$/i,Kio=/^[^A-Z]*$/,Yio=/^[^a-z]*$/,B3s=/^[0-9a-fA-F]*$/;function pTe(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function hTe(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var q3s=/^[0-9a-fA-F]{32}$/,Z3s=pTe(22,"=="),W3s=hTe(22),V3s=/^[0-9a-fA-F]{40}$/,H3s=pTe(27,"="),G3s=hTe(27),J3s=/^[0-9a-fA-F]{64}$/,K3s=pTe(43,"="),Y3s=hTe(43),Q3s=/^[0-9a-fA-F]{96}$/,X3s=pTe(64,""),eMs=hTe(64),tMs=/^[0-9a-fA-F]{128}$/,rMs=pTe(86,"=="),nMs=hTe(86),hp=lt("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Qio={number:"number",bigint:"bigint",object:"date"},wmr=lt("$ZodCheckLessThan",(e,t)=>{hp.init(e,t);let r=Qio[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),kmr=lt("$ZodCheckGreaterThan",(e,t)=>{hp.init(e,t);let r=Qio[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xio=lt("$ZodCheckMultipleOf",(e,t)=>{hp.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):oio(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),eoo=lt("$ZodCheckNumberFormat",(e,t)=>{hp.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=fio[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=i,s.maximum=o,r&&(s.pattern=Vio)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),too=lt("$ZodCheckBigIntFormat",(e,t)=>{hp.init(e,t);let[r,n]=dio[t.format];e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,o.minimum=r,o.maximum=n}),e._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),roo=lt("$ZodCheckMaxSize",(e,t)=>{var r;hp.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!WV(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:yst(i),code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),noo=lt("$ZodCheckMinSize",(e,t)=>{var r;hp.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!WV(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:yst(i),code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),ioo=lt("$ZodCheckSizeEquals",(e,t)=>{var r;hp.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!WV(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,o=i.size;if(o===t.size)return;let a=o>t.size;n.issues.push({origin:yst(i),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ooo=lt("$ZodCheckMaxLength",(e,t)=>{var r;hp.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!WV(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let a=bst(i);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),aoo=lt("$ZodCheckMinLength",(e,t)=>{var r;hp.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!WV(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let a=bst(i);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),soo=lt("$ZodCheckLengthEquals",(e,t)=>{var r;hp.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!WV(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,o=i.length;if(o===t.length)return;let a=bst(i),s=o>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),mTe=lt("$ZodCheckStringFormat",(e,t)=>{var r,n;hp.init(e,t),e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),uoo=lt("$ZodCheckRegex",(e,t)=>{mTe.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),coo=lt("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Kio),mTe.init(e,t)}),loo=lt("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Yio),mTe.init(e,t)}),foo=lt("$ZodCheckIncludes",(e,t)=>{hp.init(e,t);let r=hN(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),doo=lt("$ZodCheckStartsWith",(e,t)=>{hp.init(e,t);let r=new RegExp(`^${hN(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),poo=lt("$ZodCheckEndsWith",(e,t)=>{hp.init(e,t);let r=new RegExp(`.*${hN(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function Lno(e,t,r){e.issues.length&&t.issues.push(...hC(r,e.issues))}var hoo=lt("$ZodCheckProperty",(e,t)=>{hp.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>Lno(i,r,t.property));Lno(n,r,t.property)}}),moo=lt("$ZodCheckMimeType",(e,t)=>{hp.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),goo=lt("$ZodCheckOverwrite",(e,t)=>{hp.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}}),cst=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
1887
1887
|
`).filter(a=>a),i=Math.min(...n.map(a=>a.length-a.trimStart().length)),o=n.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let t=Function,r=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...r,i.join(`
|
|
1888
1888
|
`))}},yoo={major:4,minor:3,patch:5},Sa=lt("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yoo;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,s,u)=>{let c=UV(a),l;for(let f of s){if(f._zod.def.when){if(!f._zod.def.when(a))continue}else if(c)continue;let d=a.issues.length,p=f._zod.check(a);if(p instanceof Promise&&u?.async===!1)throw new pN;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==d&&(c||(c=UV(a,d)))});else{if(a.issues.length===d)continue;c||(c=UV(a,d))}}return l?l.then(()=>a):a},o=(a,s,u)=>{if(UV(a))return a.aborted=!0,a;let c=i(s,n,u);if(c instanceof Promise){if(u.async===!1)throw new pN;return c.then(l=>e._zod.parse(l,u))}return e._zod.parse(c,u)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let c=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return c instanceof Promise?c.then(l=>o(l,a,s)):o(c,a,s)}let u=e._zod.parse(a,s);if(u instanceof Promise){if(s.async===!1)throw new pN;return u.then(c=>i(c,n,s))}return i(u,n,s)}}Os(e,"~standard",()=>({validate:i=>{try{let o=xio(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return vio(e,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),gTe=lt("$ZodString",(e,t)=>{Sa.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Zio(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Af=lt("$ZodStringFormat",(e,t)=>{mTe.init(e,t),gTe.init(e,t)}),boo=lt("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Aio),Af.init(e,t)}),xoo=lt("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ese(n))}else t.pattern??(t.pattern=Ese());Af.init(e,t)}),voo=lt("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Cio),Af.init(e,t)}),_oo=lt("$ZodURL",(e,t)=>{Af.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Soo=lt("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Mio()),Af.init(e,t)}),woo=lt("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Iio),Af.init(e,t)}),koo=lt("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=_io),Af.init(e,t)}),Eoo=lt("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Sio),Af.init(e,t)}),Ioo=lt("$ZodULID",(e,t)=>{t.pattern??(t.pattern=wio),Af.init(e,t)}),Too=lt("$ZodXID",(e,t)=>{t.pattern??(t.pattern=kio),Af.init(e,t)}),Aoo=lt("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Eio),Af.init(e,t)}),Coo=lt("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=qio(t)),Af.init(e,t)}),Ooo=lt("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Uio),Af.init(e,t)}),Moo=lt("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Bio(t)),Af.init(e,t)}),Roo=lt("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Tio),Af.init(e,t)}),Poo=lt("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Rio),Af.init(e,t),e._zod.bag.format="ipv4"}),Doo=lt("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Pio),Af.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Noo=lt("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Dio(t.delimiter)),Af.init(e,t),e._zod.bag.format="mac"}),$oo=lt("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Nio),Af.init(e,t)}),Foo=lt("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=$io),Af.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Emr(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Loo=lt("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Fio),Af.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Emr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function zoo(e){if(!_mr.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Emr(r)}var Uoo=lt("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_mr),Af.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{zoo(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),joo=lt("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Lio),Af.init(e,t)});function Boo(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}var qoo=lt("$ZodJWT",(e,t)=>{Af.init(e,t),e._zod.check=r=>{Boo(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Zoo=lt("$ZodCustomStringFormat",(e,t)=>{Af.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Imr=lt("$ZodNumber",(e,t)=>{Sa.init(e,t),e._zod.pattern=e._zod.bag.pattern??Smr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),Woo=lt("$ZodNumberFormat",(e,t)=>{eoo.init(e,t),Imr.init(e,t)}),Tmr=lt("$ZodBoolean",(e,t)=>{Sa.init(e,t),e._zod.pattern=Hio,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Amr=lt("$ZodBigInt",(e,t)=>{Sa.init(e,t),e._zod.pattern=Wio,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Voo=lt("$ZodBigIntFormat",(e,t)=>{too.init(e,t),Amr.init(e,t)}),Hoo=lt("$ZodSymbol",(e,t)=>{Sa.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:e}),r}}),Goo=lt("$ZodUndefined",(e,t)=>{Sa.init(e,t),e._zod.pattern=Jio,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),r}}),Joo=lt("$ZodNull",(e,t)=>{Sa.init(e,t),e._zod.pattern=Gio,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),r}}),Koo=lt("$ZodAny",(e,t)=>{Sa.init(e,t),e._zod.parse=r=>r}),Yoo=lt("$ZodUnknown",(e,t)=>{Sa.init(e,t),e._zod.parse=r=>r}),Qoo=lt("$ZodNever",(e,t)=>{Sa.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Xoo=lt("$ZodVoid",(e,t)=>{Sa.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),eao=lt("$ZodDate",(e,t)=>{Sa.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),r}});function zno(e,t,r){e.issues.length&&t.issues.push(...hC(r,e.issues)),t.value[r]=e.value}var tao=lt("$ZodArray",(e,t)=>{Sa.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let a=0;a<i.length;a++){let s=i[a],u=t.element._zod.run({value:s,issues:[]},n);u instanceof Promise?o.push(u.then(c=>zno(c,r,a))):zno(u,r,a)}return o.length?Promise.all(o).then(()=>r):r}});function lst(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...hC(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function rao(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=lio(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function nao(e,t,r,n,i,o){let a=[],s=i.keySet,u=i.catchall._zod,c=u.def.type,l=u.optout==="optional";for(let f in t){if(s.has(f))continue;if(c==="never"){a.push(f);continue}let d=u.run({value:t[f],issues:[]},n);d instanceof Promise?e.push(d.then(p=>lst(p,r,f,t,l))):lst(d,r,f,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var iao=lt("$ZodObject",(e,t)=>{if(Sa.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let n=uTe(()=>rao(t));Os(e._zod,"propValues",()=>{let s=t.shape,u={};for(let c in s){let l=s[c]._zod;if(l.values){u[c]??(u[c]=new Set);for(let f of l.values)u[c].add(f)}}return u});let i=kse,o=t.catchall,a;e._zod.parse=(s,u)=>{a??(a=n.value);let c=s.value;if(!i(c))return s.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),s;s.value={};let l=[],f=a.shape;for(let d of a.keys){let p=f[d],g=p._zod.optout==="optional",x=p._zod.run({value:c[d],issues:[]},u);x instanceof Promise?l.push(x.then(T=>lst(T,s,d,c,g))):lst(x,s,d,c,g)}return o?nao(l,c,s,u,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),oao=lt("$ZodObjectJIT",(e,t)=>{iao.init(e,t);let r=e._zod.parse,n=uTe(()=>rao(t)),i=d=>{let p=new cst(["shape","payload","ctx"]),g=n.value,x=$=>{let P=Xhr($);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};p.write("const input = payload.value;");let T=Object.create(null),O=0;for(let $ of g.keys)T[$]=`key_${O++}`;p.write("const newResult = {};");for(let $ of g.keys){let P=T[$],z=Xhr($),q=d[$]?._zod?.optout==="optional";p.write(`const ${P} = ${x($)};`),q?p.write(`
|
package/package.json
CHANGED