@skyramp/testbot-core 0.13.2-v3.539 → 0.13.2-v3.542

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.
@@ -2108,6 +2108,9 @@ declare enum ContextStatus {
2108
2108
  Interrupted = "interrupted",
2109
2109
  NotRun = "not_run"
2110
2110
  }
2111
+ declare enum ContextNotRunReason {
2112
+ AppNotAnswering = "app_not_answering"
2113
+ }
2111
2114
  declare enum ContextScope {
2112
2115
  Disposable = "disposable",
2113
2116
  Shared = "shared"
@@ -2139,7 +2142,7 @@ export interface TestExecutionContext {
2139
2142
  detail: string;
2140
2143
  }[];
2141
2144
  status: ContextStatus;
2142
- notRunReason: ActionRequiredReason.IsolationUnavailable | null;
2145
+ notRunReason: ActionRequiredReason.IsolationUnavailable | ContextNotRunReason | null;
2143
2146
  cleanup: {
2144
2147
  status: ContextCleanupStatus;
2145
2148
  detail: string;
@@ -1,4 +1,4 @@
1
- "use strict";var Fe=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var Ot=Object.prototype.hasOwnProperty;var tt=(r,e)=>{for(var t in e)Fe(r,t,{get:e[t],enumerable:!0})},Et=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Rt(e))!Ot.call(r,n)&&n!==t&&Fe(r,n,{get:()=>e[n],enumerable:!(s=St(e,n))||s.enumerable});return r};var At=r=>Et(Fe({},"__esModule",{value:!0}),r);var Jr={};tt(Jr,{renderDeliveredSharedTest:()=>kt,sharedEnvironmentTest:()=>Wr});module.exports=At(Jr);var Q=require("node:fs"),wt=require("node:crypto"),Ce=require("node:path"),Tt=require("node:test"),qe=require("node:assert");var yt=require("node:crypto");var p={};tt(p,{BRAND:()=>tr,DIRTY:()=>K,EMPTY_PATH:()=>It,INVALID:()=>m,NEVER:()=>Vr,OK:()=>R,ParseStatus:()=>S,Schema:()=>v,ZodAny:()=>G,ZodArray:()=>W,ZodBigInt:()=>te,ZodBoolean:()=>re,ZodBranded:()=>Ne,ZodCatch:()=>pe,ZodDate:()=>se,ZodDefault:()=>fe,ZodDiscriminatedUnion:()=>Me,ZodEffects:()=>$,ZodEnum:()=>ue,ZodError:()=>C,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>Ue,ZodIntersection:()=>oe,ZodIssueCode:()=>c,ZodLazy:()=>ce,ZodLiteral:()=>de,ZodMap:()=>we,ZodNaN:()=>Se,ZodNativeEnum:()=>le,ZodNever:()=>Z,ZodNull:()=>ae,ZodNullable:()=>L,ZodNumber:()=>ee,ZodObject:()=>j,ZodOptional:()=>I,ZodParsedType:()=>f,ZodPipeline:()=>Ie,ZodPromise:()=>X,ZodReadonly:()=>he,ZodRecord:()=>Ve,ZodSchema:()=>v,ZodSet:()=>Te,ZodString:()=>Y,ZodSymbol:()=>be,ZodTransformer:()=>$,ZodTuple:()=>U,ZodType:()=>v,ZodUndefined:()=>ne,ZodUnion:()=>ie,ZodUnknown:()=>B,ZodVoid:()=>ke,addIssueToContext:()=>l,any:()=>ur,array:()=>hr,bigint:()=>ar,boolean:()=>ft,coerce:()=>Mr,custom:()=>dt,date:()=>ir,datetimeRegex:()=>ot,defaultErrorMap:()=>H,discriminatedUnion:()=>_r,effect:()=>Cr,enum:()=>Or,function:()=>Tr,getErrorMap:()=>_e,getParsedType:()=>V,instanceof:()=>sr,intersection:()=>vr,isAborted:()=>De,isAsync:()=>ve,isDirty:()=>Ze,isValid:()=>J,late:()=>rr,lazy:()=>Sr,literal:()=>Rr,makeIssue:()=>je,map:()=>kr,nan:()=>nr,nativeEnum:()=>Er,never:()=>fr,null:()=>dr,nullable:()=>Nr,number:()=>lt,object:()=>mr,objectUtil:()=>Be,oboolean:()=>Zr,onumber:()=>Dr,optional:()=>jr,ostring:()=>$r,pipeline:()=>Pr,preprocess:()=>Ir,promise:()=>Ar,quotelessJson:()=>Ct,record:()=>br,set:()=>wr,setErrorMap:()=>Nt,strictObject:()=>yr,string:()=>ut,symbol:()=>or,transformer:()=>Cr,tuple:()=>xr,undefined:()=>cr,union:()=>gr,unknown:()=>lr,util:()=>x,void:()=>pr});var x;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let i of n)a[i]=i;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(let o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(let i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var Be;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Be||(Be={}));var f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),V=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}};var c=x.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ct=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),C=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,d=0;for(;d<i.path.length;){let u=i.path[d],g=d===i.path.length-1;if(u==="_errors"){g&&o._errors.push(t(i)),d++;continue}Object.prototype.hasOwnProperty.call(o,u)||(u==="__proto__"?Object.defineProperty(o,u,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):o[u]={_errors:[]}),o=o[u],g&&o._errors.push(t(i)),d++}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t=Object.create(null),s=[];for(let n of this.issues)if(n.path.length>0){let a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};C.create=r=>new C(r);var jt=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}},H=jt;var rt=H;function Nt(r){rt=r}function _e(){return rt}var je=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="",d=s.filter(u=>!!u).slice().reverse();for(let u of d)o=u(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},It=[];function l(r,e){let t=_e(),s=je({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===H?void 0:H].filter(n=>!!n)});r.common.issues.push(s)}var S=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,i=await n.value;s.push({key:a,value:i})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}},m=Object.freeze({status:"aborted"}),K=r=>({status:"dirty",value:r}),R=r=>({status:"valid",value:r}),De=r=>r.status==="aborted",Ze=r=>r.status==="dirty",J=r=>r.status==="valid",ve=r=>typeof Promise<"u"&&r instanceof Promise;var h;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));var P=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},st=(r,e)=>{if(J(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new C(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{let{message:d}=r;return i.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:d??t??o.defaultError}},description:n}}var v=class{get description(){return this._def.description}_getType(e){return V(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ve(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},n=this._parseSync({data:e,path:s.path,parent:s});return st(s,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return J(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>J(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(ve(n)?n:Promise.resolve(n));return st(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let i=e(n),o=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new $({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return I.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return W.create(this)}promise(){return X.create(this,this._def)}or(e){return ie.create([this,e],this._def)}and(e){return oe.create(this,e,this._def)}transform(e){return new $({..._(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new fe({..._(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new Ne({typeName:y.ZodBranded,type:this,..._(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new pe({..._(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ie.create(this,e)}readonly(){return he.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Pt=/^c[^\s-]{8,}$/i,$t=/^[0-9a-z]+$/,Dt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Mt=/^[a-z0-9_-]{21}$/i,Vt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ut=/^[-+]?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)?)??$/,Lt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zt="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",We,qt=/^(?:(?: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])$/,Ht=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Ft=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Bt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Wt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Jt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,at="((\\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])))",Yt=new RegExp(`^${at}$`);function it(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Gt(r){return new RegExp(`^${it(r)}$`)}function ot(r){let e=`${at}T${it(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Xt(r,e){return!!((e==="v4"||!e)&&qt.test(r)||(e==="v6"||!e)&&Ft.test(r))}function Qt(r,e){if(!Vt.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Kt(r,e){return!!((e==="v4"||!e)&&Ht.test(r)||(e==="v6"||!e)&&Bt.test(r))}var Y=class r extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),m}let s=new S,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?l(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Lt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")We||(We=new RegExp(zt,"u")),We.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Zt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")Mt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Pt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")$t.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Dt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),l(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?ot(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Yt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Gt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Ut.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Xt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Qt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Kt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Wt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Jt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...h.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Y.create=r=>new Y({checks:[],typeName:y.ZodString,coerce:r?.coerce??!1,..._(r)});function er(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}var ee=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),m}let s,n=new S;for(let a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?er(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_finite,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ee.create=r=>new ee({checks:[],typeName:y.ZodNumber,coerce:r?.coerce||!1,..._(r)});var te=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let s,n=new S;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:f.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};te.create=r=>new te({checks:[],typeName:y.ZodBigInt,coerce:r?.coerce??!1,..._(r)});var re=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.boolean,received:s.parsedType}),m}return R(e.data)}};re.create=r=>new re({typeName:y.ZodBoolean,coerce:r?.coerce||!1,..._(r)});var se=class r extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),m}let s=new S,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):x.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};se.create=r=>new se({checks:[],coerce:r?.coerce||!1,typeName:y.ZodDate,..._(r)});var be=class extends v{_parse(e){if(this._getType(e)!==f.symbol){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.symbol,received:s.parsedType}),m}return R(e.data)}};be.create=r=>new be({typeName:y.ZodSymbol,..._(r)});var ne=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.undefined,received:s.parsedType}),m}return R(e.data)}};ne.create=r=>new ne({typeName:y.ZodUndefined,..._(r)});var ae=class extends v{_parse(e){if(this._getType(e)!==f.null){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.null,received:s.parsedType}),m}return R(e.data)}};ae.create=r=>new ae({typeName:y.ZodNull,..._(r)});var G=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}};G.create=r=>new G({typeName:y.ZodAny,..._(r)});var B=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}};B.create=r=>new B({typeName:y.ZodUnknown,..._(r)});var Z=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:f.never,received:t.parsedType}),m}};Z.create=r=>new Z({typeName:y.ZodNever,..._(r)});var ke=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.void,received:s.parsedType}),m}return R(e.data)}};ke.create=r=>new ke({typeName:y.ZodVoid,..._(r)});var W=class r extends v{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.array)return l(t,{code:c.invalid_type,expected:f.array,received:t.parsedType}),m;if(n.exactLength!==null){let i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(l(t,{code:i?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(l(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(l(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new P(t,i,t.path,o)))).then(i=>S.mergeArray(s,i));let a=[...t.data].map((i,o)=>n.type._parseSync(new P(t,i,t.path,o)));return S.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}};W.create=(r,e)=>new W({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});function xe(r){if(r instanceof j){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=I.create(xe(s))}return new j({...r._def,shape:()=>e})}else return r instanceof W?new W({...r._def,type:xe(r.element)}):r instanceof I?I.create(xe(r.unwrap())):r instanceof L?L.create(xe(r.unwrap())):r instanceof U?U.create(r.items.map(e=>xe(e))):r}var j=class r extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){let u=this._getOrReturnCtx(e);return l(u,{code:c.invalid_type,expected:f.object,received:u.parsedType}),m}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Z&&this._def.unknownKeys==="strip"))for(let u in n.data)i.includes(u)||o.push(u);let d=[];for(let u of i){let g=a[u],O=n.data[u];d.push({key:{status:"valid",value:u},value:g._parse(new P(n,O,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof Z){let u=this._def.unknownKeys;if(u==="passthrough")for(let g of o)d.push({key:{status:"valid",value:g},value:{status:"valid",value:n.data[g]}});else if(u==="strict")o.length>0&&(l(n,{code:c.unrecognized_keys,keys:o}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let g of o){let O=n.data[g];d.push({key:{status:"valid",value:g},value:u._parse(new P(n,O,n.path,g)),alwaysSet:g in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let g of d){let O=await g.key,M=await g.value;u.push({key:O,value:M,alwaysSet:g.alwaysSet})}return u}).then(u=>S.mergeObjectSync(s,u)):S.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:h.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let s of x.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let s of x.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}deepPartial(){return xe(this)}partial(e){let t={};for(let s of x.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let s of x.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof I;)a=a._def.innerType;t[s]=a}return new r({...this._def,shape:()=>t})}keyof(){return ct(x.objectKeys(this.shape))}};j.create=(r,e)=>new j({shape:()=>r,unknownKeys:"strip",catchall:Z.create(),typeName:y.ZodObject,..._(e)});j.strictCreate=(r,e)=>new j({shape:()=>r,unknownKeys:"strict",catchall:Z.create(),typeName:y.ZodObject,..._(e)});j.lazycreate=(r,e)=>new j({shape:r,unknownKeys:"strip",catchall:Z.create(),typeName:y.ZodObject,..._(e)});var ie=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new C(o.ctx.common.issues));return l(t,{code:c.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(s.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a,i=[];for(let d of s){let u={...t,common:{...t.common,issues:[]},parent:null},g=d._parseSync({data:t.data,path:t.path,parent:u});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(d=>new C(d));return l(t,{code:c.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}};ie.create=(r,e)=>new ie({options:r,typeName:y.ZodUnion,..._(e)});var F=r=>r instanceof ce?F(r.schema):r instanceof $?F(r.innerType()):r instanceof de?[r.value]:r instanceof ue?r.options:r instanceof le?x.objectValues(r.enum):r instanceof fe?F(r._def.innerType):r instanceof ne?[void 0]:r instanceof ae?[null]:r instanceof I?[void 0,...F(r.unwrap())]:r instanceof L?[null,...F(r.unwrap())]:r instanceof Ne||r instanceof he?F(r.unwrap()):r instanceof pe?F(r._def.innerType):[],Me=class r extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return l(t,{code:c.invalid_type,expected:f.object,received:t.parsedType}),m;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let i=F(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new r({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,..._(s)})}};function Je(r,e){let t=V(r),s=V(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&s===f.object){let n=x.objectKeys(e),a=x.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(let o of a){if(o==="__proto__")continue;let d=Je(r[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(t===f.array&&s===f.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let i=r[a],o=e[a],d=Je(i,o);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return t===f.date&&s===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var oe=class extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(De(a)||De(i))return m;let o=Je(a.value,i.value);return o.valid?((Ze(a)||Ze(i))&&t.dirty(),{status:t.value,value:o.data}):(l(s,{code:c.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};oe.create=(r,e,t)=>new oe({left:r,right:e,typeName:y.ZodIntersection,..._(t)});var U=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return l(s,{code:c.invalid_type,expected:f.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return l(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(l(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((i,o)=>{let d=this._def.items[o]||this._def.rest;return d?d._parse(new P(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>S.mergeArray(t,i)):S.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};U.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new U({items:r,typeName:y.ZodTuple,rest:null,..._(e)})};var Ve=class r extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return l(s,{code:c.invalid_type,expected:f.object,received:s.parsedType}),m;let n=[],a=this._def.keyType,i=this._def.valueType;for(let o in s.data)n.push({key:a._parse(new P(s,o,s.path,o)),value:i._parse(new P(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?S.mergeObjectAsync(t,n):S.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof v?new r({keyType:e,valueType:t,typeName:y.ZodRecord,..._(s)}):new r({keyType:Y.create(),valueType:e,typeName:y.ZodRecord,..._(t)})}},we=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return l(s,{code:c.invalid_type,expected:f.map,received:s.parsedType}),m;let n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,d],u)=>({key:n._parse(new P(s,o,s.path,[u,"key"])),value:a._parse(new P(s,d,s.path,[u,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of i){let u=await d.key,g=await d.value;if(u.status==="aborted"||g.status==="aborted")return m;(u.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(u.value,g.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let d of i){let u=d.key,g=d.value;if(u.status==="aborted"||g.status==="aborted")return m;(u.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(u.value,g.value)}return{status:t.value,value:o}}}};we.create=(r,e,t)=>new we({valueType:e,keyType:r,typeName:y.ZodMap,..._(t)});var Te=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return l(s,{code:c.invalid_type,expected:f.set,received:s.parsedType}),m;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(l(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(l(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function i(d){let u=new Set;for(let g of d){if(g.status==="aborted")return m;g.status==="dirty"&&t.dirty(),u.add(g.value)}return{status:t.value,value:u}}let o=[...s.data.values()].map((d,u)=>a._parse(new P(s,d,s.path,u)));return s.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Te.create=(r,e)=>new Te({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});var Ue=class r extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return l(t,{code:c.invalid_type,expected:f.function,received:t.parsedType}),m;function s(o,d){return je({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),H].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:d}})}function n(o,d){return je({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),H].filter(u=>!!u),issueData:{code:c.invalid_return_type,returnTypeError:d}})}let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof X){let o=this;return R(async function(...d){let u=new C([]),g=await o._def.args.parseAsync(d,a).catch(me=>{throw u.addIssue(s(d,me)),u}),O=await Reflect.apply(i,this,g);return await o._def.returns._def.type.parseAsync(O,a).catch(me=>{throw u.addIssue(n(O,me)),u})})}else{let o=this;return R(function(...d){let u=o._def.args.safeParse(d,a);if(!u.success)throw new C([s(d,u.error)]);let g=Reflect.apply(i,this,u.data),O=o._def.returns.safeParse(g,a);if(!O.success)throw new C([n(g,O.error)]);return O.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:U.create(e).rest(B.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||U.create([]).rest(B.create()),returns:t||B.create(),typeName:y.ZodFunction,..._(s)})}},ce=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ce.create=(r,e)=>new ce({getter:r,typeName:y.ZodLazy,..._(e)});var de=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};de.create=(r,e)=>new de({value:r,typeName:y.ZodLiteral,..._(e)});function ct(r,e){return new ue({values:r,typeName:y.ZodEnum,..._(e)})}var ue=class r extends v{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{expected:x.joinValues(s),received:t.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{received:t.data,code:c.invalid_enum_value,options:s}),m}return R(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};ue.create=ct;var le=class extends v{_parse(e){let t=x.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){let n=x.objectValues(t);return l(s,{expected:x.joinValues(n),received:s.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=x.objectValues(t);return l(s,{received:s.data,code:c.invalid_enum_value,options:n}),m}return R(e.data)}get enum(){return this._def.values}};le.create=(r,e)=>new le({values:r,typeName:y.ZodNativeEnum,..._(e)});var X=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return l(t,{code:c.invalid_type,expected:f.promise,received:t.parsedType}),m;let s=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return R(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};X.create=(r,e)=>new X({type:r,typeName:y.ZodPromise,..._(e)});var $=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{l(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return m;let d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?m:d.status==="dirty"?K(d.value):t.value==="dirty"?K(d.value):d});{if(t.value==="aborted")return m;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?m:o.status==="dirty"?K(o.value):t.value==="dirty"?K(o.value):o}}if(n.type==="refinement"){let i=o=>{let d=n.refinement(o,a);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!J(i))return m;let o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>J(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):m);x.assertNever(n)}};$.create=(r,e,t)=>new $({schema:r,typeName:y.ZodEffects,effect:e,..._(t)});$.createWithPreprocess=(r,e,t)=>new $({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,..._(t)});var I=class extends v{_parse(e){return this._getType(e)===f.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};I.create=(r,e)=>new I({innerType:r,typeName:y.ZodOptional,..._(e)});var L=class extends v{_parse(e){return this._getType(e)===f.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};L.create=(r,e)=>new L({innerType:r,typeName:y.ZodNullable,..._(e)});var fe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};fe.create=(r,e)=>new fe({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var pe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ve(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};pe.create=(r,e)=>new pe({innerType:r,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var Se=class extends v{_parse(e){if(this._getType(e)!==f.nan){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}};Se.create=r=>new Se({typeName:y.ZodNaN,..._(r)});var tr=Symbol("zod_brand"),Ne=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Ie=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),K(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:y.ZodPipeline})}},he=class extends v{_parse(e){let t=this._def.innerType._parse(e),s=n=>(J(n)&&(n.value=Object.freeze(n.value)),n);return ve(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};he.create=(r,e)=>new he({innerType:r,typeName:y.ZodReadonly,..._(e)});function nt(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function dt(r,e={},t){return r?G.create().superRefine((s,n)=>{let a=r(s);if(a instanceof Promise)return a.then(i=>{if(!i){let o=nt(e,s),d=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:d})}});if(!a){let i=nt(e,s),o=i.fatal??t??!0;n.addIssue({code:"custom",...i,fatal:o})}}):G.create()}var rr={object:j.lazycreate},y;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(y||(y={}));var sr=(r,e={message:`Input not instance of ${r.name}`})=>dt(t=>t instanceof r,e),ut=Y.create,lt=ee.create,nr=Se.create,ar=te.create,ft=re.create,ir=se.create,or=be.create,cr=ne.create,dr=ae.create,ur=G.create,lr=B.create,fr=Z.create,pr=ke.create,hr=W.create,mr=j.create,yr=j.strictCreate,gr=ie.create,_r=Me.create,vr=oe.create,xr=U.create,br=Ve.create,kr=we.create,wr=Te.create,Tr=Ue.create,Sr=ce.create,Rr=de.create,Or=ue.create,Er=le.create,Ar=X.create,Cr=$.create,jr=I.create,Nr=L.create,Ir=$.createWithPreprocess,Pr=Ie.create,$r=()=>ut().optional(),Dr=()=>lt().optional(),Zr=()=>ft().optional(),Mr={string:(r=>Y.create({...r,coerce:!0})),number:(r=>ee.create({...r,coerce:!0})),boolean:(r=>re.create({...r,coerce:!0})),bigint:(r=>te.create({...r,coerce:!0})),date:(r=>se.create({...r,coerce:!0}))};var Vr=m;var Re=p.string().uuid(),ws=p.object({environmentId:p.string().uuid(),allowed:p.boolean(),revision:Re,updatedAt:p.string().datetime(),updatedBy:p.string().uuid()}).strict();var pt=(i=>(i.NoEnvironment="no_environment",i.NoRecordedGrant="no_recorded_grant",i.Unavailable="unavailable",i.Changed="changed",i.Denied="denied",i.OutOfScope="out_of_scope",i))(pt||{});function ht(r,e){try{let t=new URL(e),s=new URL(r);if(s.search||s.hash)return!1;let n=/%(?:2f|5c|2e|25)/i;if(e.includes("\\")||r.includes("\\")||n.test(t.pathname)||n.test(s.pathname))return!1;let a=s.pathname.replace(/\/$/,"");return["https:","http:"].includes(s.protocol)&&t.origin===s.origin&&(t.pathname===a||t.pathname.startsWith(`${a}/`))}catch{return!1}}var Ts=p.object({environmentId:p.string().uuid(),environmentAddress:p.string().url(),revision:Re}).strict(),Ss=p.object({refusal:p.nativeEnum(pt)}).strict();var Ye=(t=>(t.Patch="PATCH",t.Put="PUT",t))(Ye||{}),Oe=class extends Error{constructor(t){super(`Safety gap: ${t.reason}`);this.incident=t}incident},Ee=class extends Error{constructor(t){super("The delivered test assertion or execution failed; its resource trace is retained in diagnostics");this.trace=t}trace},Ae=class extends Error{};function D(r){throw new Ae(`environment restriction: ${r}`)}function gt(r){let e=new URL(r);return(!["https:","http:"].includes(e.protocol)||e.username||e.password||e.search||e.hash||/%(?:2f|5c|2e|25)/i.test(e.pathname)||r.includes("\\"))&&D("unsupported environment address"),e.href.replace(/\/$/,"")}function Le(r,e){let t=new URL(e,`${r}/`);return(!ht(r,e.includes("://")?e:t.href)||t.username||t.password||t.hash)&&D("request leaves the selected environment"),t}function Ur(r){let e=r.map(t=>{(!t||t.includes("\\")||/[\[\]{}()]/.test(t))&&D("unsupported off-limits pattern");let s=n=>n.split("*").map(a=>a.replace(/[.+?^$|]/g,"\\$&")).join(".*");return new RegExp(t.endsWith("/**")?`^(?:${s(t)}|${s(t.slice(0,-3))})$`:`^${s(t)}$`,"i")});return t=>e.some(s=>s.test(t.href)||s.test(t.pathname))}async function Lr(r){let e=await r.text();if(e)try{return JSON.parse(e)}catch{throw new Error("Shared test response was not JSON")}}function ze(r,e){let t=r;for(let s of e){if(!t||typeof t!="object"||!Object.hasOwn(t,s))return;t=t[s]}return t}async function mt(r){let e=await r.text(),t;if(e)try{t=JSON.parse(e)}catch{t=e}return{status:r.status,headers:r.headers,body:t}}function zr(r,e){let t=r.bearerTokenEnv;if(!t)return;let s=process.env[t];if(!s?.trim())throw new Error(`required SUT credential ${t} is unavailable`);if(process.env.TESTBOT_SHARED_SUT_TOKEN_ENV!==t)throw new Error("declared SUT credential is not approved by TESTBOT_SHARED_SUT_TOKEN_ENV");let n=process.env.TESTBOT_SHARED_SUT_ADDRESS,a=!1;try{a=!!n&&gt(n)===e}catch{}if(!a)throw new Error("SUT address does not match TESTBOT_SHARED_SUT_ADDRESS");return s}function qr(r){return{status:"restricted",detail:r instanceof Ae?r.message:"environment restriction: unsupported shared-environment configuration"}}async function _t(r,e){let t,s;try{(!r||!r.environmentId||!Array.isArray(r.offLimits))&&D("shared-environment identity and off-limits rules are required"),t=gt(r.environmentAddress),s=Ur(r.offLimits),r.route?.kind!=="persistence"&&D("delivered shared tests require the persistence route")}catch(k){return qr(k)}if(!Re.safeParse(r.persistenceRevision).success)throw new Error("No valid persistence revision was recorded at generation. Regenerate this test with persistence permission.");let n=zr(r,t),a=`testbot-${(0,yt.randomUUID)()}`,i=new Set,o=[],d=async(k,T,b)=>{let N=Le(t,T);return s(N)&&D("the request is off limits"),["GET","HEAD","OPTIONS"].includes(k)||(me=!0),await fetch(N,{method:k,headers:{...n?{Authorization:`Bearer ${n}`}:{},...b===void 0?{}:{"Content-Type":"application/json"}},redirect:"error",signal:AbortSignal.timeout(1e4),...b===void 0?{}:{body:JSON.stringify(b)}})},u=k=>{let T=Le(t,k).href;return i.has(T)||D("mutations and resource reads require a run-owned resource"),T},g=k=>new Ee({runId:a,route:r.route.kind,resources:o,retained:!0,outcome:"test-failed",...k===void 0?{}:{status:k}}),O=async(k,T)=>{let b=k.status;if(!(T===void 0?k.ok:T===b)||b<200||b>=300&&b<400||b>=500)throw await k.body?.cancel(),g(b);return mt(k)},M,me=!1;try{await e({async create(k,T,b,N={}){(!b.trim()||!Object.hasOwn(T,b)||typeof T[b]!="string")&&D("creation needs a supported run-unique string field"),Object.keys(T).some(q=>/^(?:id|_id|uuid|pk)$/i.test(q))&&D("caller-selected resource IDs cannot establish a newly owned record");let A=Le(t,k);A.search&&D("create-only collections cannot use query actions"),s(A)&&D("the request is off limits");let ye=`${T[b]}-${a}`,ge=q=>new Oe({runId:a,route:r.route.kind,resources:[...o,A.href],outcome:"failed-or-unknown",reason:q}),E;try{E=await d("POST",A.href,{...T,[b]:ye})}catch(q){throw q instanceof Ae?q:ge("create response was unavailable; side effects are unknown")}if(E.status>=400&&E.status<500){if(E.status===N.expectedStatus)return mt(E);throw await E.body?.cancel(),g(E.status)}if(!E.ok)throw ge(`create did not establish new-resource provenance (${E.status})`);let $e;try{$e=await Lr(E)}catch{throw ge("create returned unreadable resource provenance")}if(ze($e,N.responseUniqueFieldPath??[b])!==ye)throw ge("create did not confirm the run-unique value");let He=ze($e,N.responseIdPath??["id"]),Qe=E.headers.get("location"),z;try{let q=Qe?new URL(Qe,A).href:typeof He=="string"||typeof He=="number"?`${A.href.replace(/\/$/,"")}/${encodeURIComponent(He)}`:void 0;if(!q)throw new Error("no resource identity");z=Le(t,q)}catch{throw ge("create returned missing, invalid or out-of-scope resource provenance")}let Ke=A.pathname.replace(/\/$/,"")+"/",et=z.pathname.slice(Ke.length);if(z.search||!z.pathname.startsWith(Ke)||!et||et.includes("/")||s(z)||i.has(z.href))throw ge("create returned unsupported resource provenance");if(i.add(z.href),o.push(z.href),E.status!==(N.expectedStatus??201))throw g(E.status);return{url:z.href,body:$e,status:E.status,headers:E.headers}},async read(k,T={}){let b=new URL(u(k));for(let[A,ye]of Object.entries(T.query??{}))b.searchParams.append(A,ye);let N=await d("GET",b.href);return O(N,T.expectedStatus)},async update(k,T,b={}){let N=u(k),A=b.method??"PATCH";A!=="PATCH"&&A!=="PUT"&&D("unsupported resource update method");let ye=await d(A,N,T);return O(ye,b.expectedStatus)}})}catch(k){M=k}if(M instanceof Ae&&!me)return{status:"restricted",detail:M.message};if(M instanceof Oe||M instanceof Ee)throw M;if(M)throw g();return{status:"executed",runId:a,resources:o,retained:!0}}var Pe=p.lazy(()=>p.union([p.string(),p.number().finite(),p.boolean(),p.null(),p.array(Pe),p.record(Pe)])),w=p.string().trim().min(1),xt=p.string().regex(/^[A-Za-z_]\w*$/).optional(),Ge=p.number().int().refine(r=>r>=200&&r<300||r>=400&&r<500,"Expected an explicit success or client rejection status").optional(),vt=p.array(w).min(1).max(20).optional(),Hr=p.object({environmentId:p.string().uuid(),environmentAddress:p.string().url(),targetId:w.optional(),appOrigin:p.string().url().optional(),persistenceRevision:Re.optional(),offLimits:p.array(w),bearerTokenEnv:xt,route:p.object({kind:p.literal("persistence")}).strict()}).strict().refine(r=>!r.persistenceRevision||!r.targetId&&!r.appOrigin,"A generated persistence decision cannot include legacy policy lookup fields"),bt=p.array(p.discriminatedUnion("op",[p.object({op:p.literal("create"),collection:w,body:p.record(Pe),uniqueField:w,expectedStatus:Ge,responseIdPath:vt,responseUniqueFieldPath:vt,as:w}).strict(),p.object({op:p.literal("read"),resource:w,as:w,expectedStatus:Ge,query:p.record(p.string()).optional()}).strict(),p.object({op:p.literal("update"),resource:w,method:p.nativeEnum(Ye).optional(),expectedStatus:Ge,body:p.record(Pe),as:w}).strict(),p.object({op:p.literal("assert"),resource:w,path:p.array(w),equals:Pe}).strict(),p.object({op:p.literal("assertStatus"),resource:w,equals:p.number().int().min(200).max(499)}).strict(),p.object({op:p.literal("assertHeader"),resource:w,name:p.string().regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/),equals:p.string().nullable()}).strict()])).min(1).refine(r=>r.some(e=>e.op==="assert"||e.op==="assertStatus"||e.op==="assertHeader"),"A runnable test must retain a planned assertion"),Ns=p.object({name:w,bearerTokenEnv:xt,steps:bt.describe("ordered objects with op: create (collection, body, uniqueField, as; optional expectedStatus, responseIdPath, responseUniqueFieldPath), read (resource, as; optional expectedStatus, query), update (resource, body, as; optional expectedStatus, method PUT or PATCH), assert (resource, path, equals), assertStatus (resource, equals), or assertHeader (resource, name, equals). Resource names an earlier request alias and paths are arrays of JSON keys")}).strict(),Xe=p.union([p.object({name:w,definition:Hr,steps:bt}).strict(),p.object({name:w,restriction:w,sourceAsset:p.object({path:w.regex(/^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))[^\\]+\.source$/),sha256:p.string().regex(/^[a-f0-9]{64}$/)}).strict()}).strict()]),Fr=`"use strict";
1
+ "use strict";var Fe=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var Ot=Object.prototype.hasOwnProperty;var tt=(r,e)=>{for(var t in e)Fe(r,t,{get:e[t],enumerable:!0})},Et=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Rt(e))!Ot.call(r,n)&&n!==t&&Fe(r,n,{get:()=>e[n],enumerable:!(s=St(e,n))||s.enumerable});return r};var At=r=>Et(Fe({},"__esModule",{value:!0}),r);var Jr={};tt(Jr,{renderDeliveredSharedTest:()=>kt,sharedEnvironmentTest:()=>Wr});module.exports=At(Jr);var Q=require("node:fs"),wt=require("node:crypto"),Ce=require("node:path"),Tt=require("node:test"),qe=require("node:assert");var yt=require("node:crypto");var p={};tt(p,{BRAND:()=>tr,DIRTY:()=>K,EMPTY_PATH:()=>It,INVALID:()=>m,NEVER:()=>Vr,OK:()=>R,ParseStatus:()=>S,Schema:()=>v,ZodAny:()=>G,ZodArray:()=>W,ZodBigInt:()=>te,ZodBoolean:()=>re,ZodBranded:()=>Ne,ZodCatch:()=>pe,ZodDate:()=>se,ZodDefault:()=>fe,ZodDiscriminatedUnion:()=>Me,ZodEffects:()=>$,ZodEnum:()=>ue,ZodError:()=>C,ZodFirstPartyTypeKind:()=>y,ZodFunction:()=>Ue,ZodIntersection:()=>oe,ZodIssueCode:()=>c,ZodLazy:()=>ce,ZodLiteral:()=>de,ZodMap:()=>we,ZodNaN:()=>Se,ZodNativeEnum:()=>le,ZodNever:()=>Z,ZodNull:()=>ae,ZodNullable:()=>L,ZodNumber:()=>ee,ZodObject:()=>j,ZodOptional:()=>I,ZodParsedType:()=>f,ZodPipeline:()=>Ie,ZodPromise:()=>X,ZodReadonly:()=>he,ZodRecord:()=>Ve,ZodSchema:()=>v,ZodSet:()=>Te,ZodString:()=>Y,ZodSymbol:()=>be,ZodTransformer:()=>$,ZodTuple:()=>U,ZodType:()=>v,ZodUndefined:()=>ne,ZodUnion:()=>ie,ZodUnknown:()=>B,ZodVoid:()=>ke,addIssueToContext:()=>l,any:()=>ur,array:()=>hr,bigint:()=>ar,boolean:()=>ft,coerce:()=>Mr,custom:()=>dt,date:()=>ir,datetimeRegex:()=>ot,defaultErrorMap:()=>H,discriminatedUnion:()=>_r,effect:()=>Cr,enum:()=>Or,function:()=>Tr,getErrorMap:()=>_e,getParsedType:()=>V,instanceof:()=>sr,intersection:()=>vr,isAborted:()=>De,isAsync:()=>ve,isDirty:()=>Ze,isValid:()=>J,late:()=>rr,lazy:()=>Sr,literal:()=>Rr,makeIssue:()=>je,map:()=>kr,nan:()=>nr,nativeEnum:()=>Er,never:()=>fr,null:()=>dr,nullable:()=>Nr,number:()=>lt,object:()=>mr,objectUtil:()=>Be,oboolean:()=>Zr,onumber:()=>Dr,optional:()=>jr,ostring:()=>$r,pipeline:()=>Pr,preprocess:()=>Ir,promise:()=>Ar,quotelessJson:()=>Ct,record:()=>br,set:()=>wr,setErrorMap:()=>Nt,strictObject:()=>yr,string:()=>ut,symbol:()=>or,transformer:()=>Cr,tuple:()=>xr,undefined:()=>cr,union:()=>gr,unknown:()=>lr,util:()=>x,void:()=>pr});var x;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let i of n)a[i]=i;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(let o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(let i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var Be;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Be||(Be={}));var f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),V=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}};var c=x.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ct=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),C=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,d=0;for(;d<i.path.length;){let u=i.path[d],g=d===i.path.length-1;if(u==="_errors"){g&&o._errors.push(t(i)),d++;continue}Object.prototype.hasOwnProperty.call(o,u)||(u==="__proto__"?Object.defineProperty(o,u,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):o[u]={_errors:[]}),o=o[u],g&&o._errors.push(t(i)),d++}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t=Object.create(null),s=[];for(let n of this.issues)if(n.path.length>0){let a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};C.create=r=>new C(r);var jt=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}},H=jt;var rt=H;function Nt(r){rt=r}function _e(){return rt}var je=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="",d=s.filter(u=>!!u).slice().reverse();for(let u of d)o=u(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},It=[];function l(r,e){let t=_e(),s=je({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===H?void 0:H].filter(n=>!!n)});r.common.issues.push(s)}var S=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,i=await n.value;s.push({key:a,value:i})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}},m=Object.freeze({status:"aborted"}),K=r=>({status:"dirty",value:r}),R=r=>({status:"valid",value:r}),De=r=>r.status==="aborted",Ze=r=>r.status==="dirty",J=r=>r.status==="valid",ve=r=>typeof Promise<"u"&&r instanceof Promise;var h;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));var P=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},st=(r,e)=>{if(J(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new C(r.common.issues);return this._error=t,this._error}}};function _(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{let{message:d}=r;return i.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:d??t??o.defaultError}},description:n}}var v=class{get description(){return this._def.description}_getType(e){return V(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new S,ctx:{common:e.parent.common,data:e.data,parsedType:V(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ve(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},n=this._parseSync({data:e,path:s.path,parent:s});return st(s,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return J(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>J(s)?{value:s.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:V(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(ve(n)?n:Promise.resolve(n));return st(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let i=e(n),o=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(d=>d?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new $({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return I.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return W.create(this)}promise(){return X.create(this,this._def)}or(e){return ie.create([this,e],this._def)}and(e){return oe.create(this,e,this._def)}transform(e){return new $({..._(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new fe({..._(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new Ne({typeName:y.ZodBranded,type:this,..._(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new pe({..._(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ie.create(this,e)}readonly(){return he.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Pt=/^c[^\s-]{8,}$/i,$t=/^[0-9a-z]+$/,Dt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Mt=/^[a-z0-9_-]{21}$/i,Vt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ut=/^[-+]?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)?)??$/,Lt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,zt="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",We,qt=/^(?:(?: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])$/,Ht=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Ft=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Bt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Wt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Jt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,at="((\\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])))",Yt=new RegExp(`^${at}$`);function it(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Gt(r){return new RegExp(`^${it(r)}$`)}function ot(r){let e=`${at}T${it(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Xt(r,e){return!!((e==="v4"||!e)&&qt.test(r)||(e==="v6"||!e)&&Ft.test(r))}function Qt(r,e){if(!Vt.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Kt(r,e){return!!((e==="v4"||!e)&&Ht.test(r)||(e==="v6"||!e)&&Bt.test(r))}var Y=class r extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.string,received:a.parsedType}),m}let s=new S,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?l(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Lt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")We||(We=new RegExp(zt,"u")),We.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Zt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")Mt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Pt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")$t.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Dt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),l(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?ot(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Yt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Gt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Ut.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Xt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Qt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Kt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Wt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Jt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...h.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...h.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Y.create=r=>new Y({checks:[],typeName:y.ZodString,coerce:r?.coerce??!1,..._(r)});function er(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}var ee=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.number,received:a.parsedType}),m}let s,n=new S;for(let a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?er(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_finite,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ee.create=r=>new ee({checks:[],typeName:y.ZodNumber,coerce:r?.coerce||!1,..._(r)});var te=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let s,n=new S;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):x.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:f.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};te.create=r=>new te({checks:[],typeName:y.ZodBigInt,coerce:r?.coerce??!1,..._(r)});var re=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.boolean,received:s.parsedType}),m}return R(e.data)}};re.create=r=>new re({typeName:y.ZodBoolean,coerce:r?.coerce||!1,..._(r)});var se=class r extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:f.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),m}let s=new S,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):x.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};se.create=r=>new se({checks:[],coerce:r?.coerce||!1,typeName:y.ZodDate,..._(r)});var be=class extends v{_parse(e){if(this._getType(e)!==f.symbol){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.symbol,received:s.parsedType}),m}return R(e.data)}};be.create=r=>new be({typeName:y.ZodSymbol,..._(r)});var ne=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.undefined,received:s.parsedType}),m}return R(e.data)}};ne.create=r=>new ne({typeName:y.ZodUndefined,..._(r)});var ae=class extends v{_parse(e){if(this._getType(e)!==f.null){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.null,received:s.parsedType}),m}return R(e.data)}};ae.create=r=>new ae({typeName:y.ZodNull,..._(r)});var G=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return R(e.data)}};G.create=r=>new G({typeName:y.ZodAny,..._(r)});var B=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return R(e.data)}};B.create=r=>new B({typeName:y.ZodUnknown,..._(r)});var Z=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return l(t,{code:c.invalid_type,expected:f.never,received:t.parsedType}),m}};Z.create=r=>new Z({typeName:y.ZodNever,..._(r)});var ke=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.void,received:s.parsedType}),m}return R(e.data)}};ke.create=r=>new ke({typeName:y.ZodVoid,..._(r)});var W=class r extends v{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==f.array)return l(t,{code:c.invalid_type,expected:f.array,received:t.parsedType}),m;if(n.exactLength!==null){let i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(l(t,{code:i?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(l(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(l(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new P(t,i,t.path,o)))).then(i=>S.mergeArray(s,i));let a=[...t.data].map((i,o)=>n.type._parseSync(new P(t,i,t.path,o)));return S.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}};W.create=(r,e)=>new W({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});function xe(r){if(r instanceof j){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=I.create(xe(s))}return new j({...r._def,shape:()=>e})}else return r instanceof W?new W({...r._def,type:xe(r.element)}):r instanceof I?I.create(xe(r.unwrap())):r instanceof L?L.create(xe(r.unwrap())):r instanceof U?U.create(r.items.map(e=>xe(e))):r}var j=class r extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){let u=this._getOrReturnCtx(e);return l(u,{code:c.invalid_type,expected:f.object,received:u.parsedType}),m}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Z&&this._def.unknownKeys==="strip"))for(let u in n.data)i.includes(u)||o.push(u);let d=[];for(let u of i){let g=a[u],O=n.data[u];d.push({key:{status:"valid",value:u},value:g._parse(new P(n,O,n.path,u)),alwaysSet:u in n.data})}if(this._def.catchall instanceof Z){let u=this._def.unknownKeys;if(u==="passthrough")for(let g of o)d.push({key:{status:"valid",value:g},value:{status:"valid",value:n.data[g]}});else if(u==="strict")o.length>0&&(l(n,{code:c.unrecognized_keys,keys:o}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let g of o){let O=n.data[g];d.push({key:{status:"valid",value:g},value:u._parse(new P(n,O,n.path,g)),alwaysSet:g in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let u=[];for(let g of d){let O=await g.key,M=await g.value;u.push({key:O,value:M,alwaysSet:g.alwaysSet})}return u}).then(u=>S.mergeObjectSync(s,u)):S.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:h.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let s of x.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let s of x.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r({...this._def,shape:()=>t})}deepPartial(){return xe(this)}partial(e){let t={};for(let s of x.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let s of x.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof I;)a=a._def.innerType;t[s]=a}return new r({...this._def,shape:()=>t})}keyof(){return ct(x.objectKeys(this.shape))}};j.create=(r,e)=>new j({shape:()=>r,unknownKeys:"strip",catchall:Z.create(),typeName:y.ZodObject,..._(e)});j.strictCreate=(r,e)=>new j({shape:()=>r,unknownKeys:"strict",catchall:Z.create(),typeName:y.ZodObject,..._(e)});j.lazycreate=(r,e)=>new j({shape:r,unknownKeys:"strip",catchall:Z.create(),typeName:y.ZodObject,..._(e)});var ie=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new C(o.ctx.common.issues));return l(t,{code:c.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(s.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a,i=[];for(let d of s){let u={...t,common:{...t.common,issues:[]},parent:null},g=d._parseSync({data:t.data,path:t.path,parent:u});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(d=>new C(d));return l(t,{code:c.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}};ie.create=(r,e)=>new ie({options:r,typeName:y.ZodUnion,..._(e)});var F=r=>r instanceof ce?F(r.schema):r instanceof $?F(r.innerType()):r instanceof de?[r.value]:r instanceof ue?r.options:r instanceof le?x.objectValues(r.enum):r instanceof fe?F(r._def.innerType):r instanceof ne?[void 0]:r instanceof ae?[null]:r instanceof I?[void 0,...F(r.unwrap())]:r instanceof L?[null,...F(r.unwrap())]:r instanceof Ne||r instanceof he?F(r.unwrap()):r instanceof pe?F(r._def.innerType):[],Me=class r extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return l(t,{code:c.invalid_type,expected:f.object,received:t.parsedType}),m;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let i=F(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new r({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,..._(s)})}};function Je(r,e){let t=V(r),s=V(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&s===f.object){let n=x.objectKeys(e),a=x.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};Object.prototype.hasOwnProperty.call(i,"__proto__")&&delete i.__proto__;for(let o of a){if(o==="__proto__")continue;let d=Je(r[o],e[o]);if(!d.valid)return{valid:!1};i[o]=d.data}return{valid:!0,data:i}}else if(t===f.array&&s===f.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let i=r[a],o=e[a],d=Je(i,o);if(!d.valid)return{valid:!1};n.push(d.data)}return{valid:!0,data:n}}else return t===f.date&&s===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var oe=class extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(De(a)||De(i))return m;let o=Je(a.value,i.value);return o.valid?((Ze(a)||Ze(i))&&t.dirty(),{status:t.value,value:o.data}):(l(s,{code:c.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};oe.create=(r,e,t)=>new oe({left:r,right:e,typeName:y.ZodIntersection,..._(t)});var U=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.array)return l(s,{code:c.invalid_type,expected:f.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return l(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(l(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((i,o)=>{let d=this._def.items[o]||this._def.rest;return d?d._parse(new P(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>S.mergeArray(t,i)):S.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};U.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new U({items:r,typeName:y.ZodTuple,rest:null,..._(e)})};var Ve=class r extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.object)return l(s,{code:c.invalid_type,expected:f.object,received:s.parsedType}),m;let n=[],a=this._def.keyType,i=this._def.valueType;for(let o in s.data)n.push({key:a._parse(new P(s,o,s.path,o)),value:i._parse(new P(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?S.mergeObjectAsync(t,n):S.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof v?new r({keyType:e,valueType:t,typeName:y.ZodRecord,..._(s)}):new r({keyType:Y.create(),valueType:e,typeName:y.ZodRecord,..._(t)})}},we=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.map)return l(s,{code:c.invalid_type,expected:f.map,received:s.parsedType}),m;let n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,d],u)=>({key:n._parse(new P(s,o,s.path,[u,"key"])),value:a._parse(new P(s,d,s.path,[u,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of i){let u=await d.key,g=await d.value;if(u.status==="aborted"||g.status==="aborted")return m;(u.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(u.value,g.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let d of i){let u=d.key,g=d.value;if(u.status==="aborted"||g.status==="aborted")return m;(u.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(u.value,g.value)}return{status:t.value,value:o}}}};we.create=(r,e,t)=>new we({valueType:e,keyType:r,typeName:y.ZodMap,..._(t)});var Te=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==f.set)return l(s,{code:c.invalid_type,expected:f.set,received:s.parsedType}),m;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(l(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(l(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function i(d){let u=new Set;for(let g of d){if(g.status==="aborted")return m;g.status==="dirty"&&t.dirty(),u.add(g.value)}return{status:t.value,value:u}}let o=[...s.data.values()].map((d,u)=>a._parse(new P(s,d,s.path,u)));return s.common.async?Promise.all(o).then(d=>i(d)):i(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Te.create=(r,e)=>new Te({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});var Ue=class r extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return l(t,{code:c.invalid_type,expected:f.function,received:t.parsedType}),m;function s(o,d){return je({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),H].filter(u=>!!u),issueData:{code:c.invalid_arguments,argumentsError:d}})}function n(o,d){return je({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_e(),H].filter(u=>!!u),issueData:{code:c.invalid_return_type,returnTypeError:d}})}let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof X){let o=this;return R(async function(...d){let u=new C([]),g=await o._def.args.parseAsync(d,a).catch(me=>{throw u.addIssue(s(d,me)),u}),O=await Reflect.apply(i,this,g);return await o._def.returns._def.type.parseAsync(O,a).catch(me=>{throw u.addIssue(n(O,me)),u})})}else{let o=this;return R(function(...d){let u=o._def.args.safeParse(d,a);if(!u.success)throw new C([s(d,u.error)]);let g=Reflect.apply(i,this,u.data),O=o._def.returns.safeParse(g,a);if(!O.success)throw new C([n(g,O.error)]);return O.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:U.create(e).rest(B.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||U.create([]).rest(B.create()),returns:t||B.create(),typeName:y.ZodFunction,..._(s)})}},ce=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ce.create=(r,e)=>new ce({getter:r,typeName:y.ZodLazy,..._(e)});var de=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};de.create=(r,e)=>new de({value:r,typeName:y.ZodLiteral,..._(e)});function ct(r,e){return new ue({values:r,typeName:y.ZodEnum,..._(e)})}var ue=class r extends v{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{expected:x.joinValues(s),received:t.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return l(t,{received:t.data,code:c.invalid_enum_value,options:s}),m}return R(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};ue.create=ct;var le=class extends v{_parse(e){let t=x.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==f.string&&s.parsedType!==f.number){let n=x.objectValues(t);return l(s,{expected:x.joinValues(n),received:s.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=x.objectValues(t);return l(s,{received:s.data,code:c.invalid_enum_value,options:n}),m}return R(e.data)}get enum(){return this._def.values}};le.create=(r,e)=>new le({values:r,typeName:y.ZodNativeEnum,..._(e)});var X=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return l(t,{code:c.invalid_type,expected:f.promise,received:t.parsedType}),m;let s=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return R(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};X.create=(r,e)=>new X({type:r,typeName:y.ZodPromise,..._(e)});var $=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{l(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return m;let d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?m:d.status==="dirty"?K(d.value):t.value==="dirty"?K(d.value):d});{if(t.value==="aborted")return m;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?m:o.status==="dirty"?K(o.value):t.value==="dirty"?K(o.value):o}}if(n.type==="refinement"){let i=o=>{let d=n.refinement(o,a);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!J(i))return m;let o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>J(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):m);x.assertNever(n)}};$.create=(r,e,t)=>new $({schema:r,typeName:y.ZodEffects,effect:e,..._(t)});$.createWithPreprocess=(r,e,t)=>new $({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,..._(t)});var I=class extends v{_parse(e){return this._getType(e)===f.undefined?R(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};I.create=(r,e)=>new I({innerType:r,typeName:y.ZodOptional,..._(e)});var L=class extends v{_parse(e){return this._getType(e)===f.null?R(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};L.create=(r,e)=>new L({innerType:r,typeName:y.ZodNullable,..._(e)});var fe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===f.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};fe.create=(r,e)=>new fe({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var pe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return ve(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new C(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};pe.create=(r,e)=>new pe({innerType:r,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var Se=class extends v{_parse(e){if(this._getType(e)!==f.nan){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:f.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}};Se.create=r=>new Se({typeName:y.ZodNaN,..._(r)});var tr=Symbol("zod_brand"),Ne=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Ie=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),K(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:y.ZodPipeline})}},he=class extends v{_parse(e){let t=this._def.innerType._parse(e),s=n=>(J(n)&&(n.value=Object.freeze(n.value)),n);return ve(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};he.create=(r,e)=>new he({innerType:r,typeName:y.ZodReadonly,..._(e)});function nt(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function dt(r,e={},t){return r?G.create().superRefine((s,n)=>{let a=r(s);if(a instanceof Promise)return a.then(i=>{if(!i){let o=nt(e,s),d=o.fatal??t??!0;n.addIssue({code:"custom",...o,fatal:d})}});if(!a){let i=nt(e,s),o=i.fatal??t??!0;n.addIssue({code:"custom",...i,fatal:o})}}):G.create()}var rr={object:j.lazycreate},y;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(y||(y={}));var sr=(r,e={message:`Input not instance of ${r.name}`})=>dt(t=>t instanceof r,e),ut=Y.create,lt=ee.create,nr=Se.create,ar=te.create,ft=re.create,ir=se.create,or=be.create,cr=ne.create,dr=ae.create,ur=G.create,lr=B.create,fr=Z.create,pr=ke.create,hr=W.create,mr=j.create,yr=j.strictCreate,gr=ie.create,_r=Me.create,vr=oe.create,xr=U.create,br=Ve.create,kr=we.create,wr=Te.create,Tr=Ue.create,Sr=ce.create,Rr=de.create,Or=ue.create,Er=le.create,Ar=X.create,Cr=$.create,jr=I.create,Nr=L.create,Ir=$.createWithPreprocess,Pr=Ie.create,$r=()=>ut().optional(),Dr=()=>lt().optional(),Zr=()=>ft().optional(),Mr={string:(r=>Y.create({...r,coerce:!0})),number:(r=>ee.create({...r,coerce:!0})),boolean:(r=>re.create({...r,coerce:!0})),bigint:(r=>te.create({...r,coerce:!0})),date:(r=>se.create({...r,coerce:!0}))};var Vr=m;var Re=p.string().uuid(),ws=p.object({environmentId:p.string().uuid(),allowed:p.boolean(),revision:Re,updatedAt:p.string().datetime(),updatedBy:p.string().uuid()}).strict();var pt=(i=>(i.NoEnvironment="no_environment",i.NoRecordedGrant="no_recorded_grant",i.Unavailable="unavailable",i.Changed="changed",i.Denied="denied",i.OutOfScope="out_of_scope",i))(pt||{});function ht(r,e){try{let t=new URL(e),s=new URL(r);if(s.search||s.hash)return!1;let n=/%(?:2f|5c|2e|25)/i;if(e.includes("\\")||r.includes("\\")||n.test(t.pathname)||n.test(s.pathname))return!1;let a=s.pathname.replace(/\/$/,"");return["https:","http:"].includes(s.protocol)&&t.origin===s.origin&&(t.pathname===a||t.pathname.startsWith(`${a}/`))}catch{return!1}}var Ts=p.object({environmentId:p.string().uuid(),environmentAddress:p.string().url(),revision:Re}).strict(),Ss=p.object({refusal:p.nativeEnum(pt)}).strict();var Ye=(t=>(t.Patch="PATCH",t.Put="PUT",t))(Ye||{}),Oe=class extends Error{constructor(t){super(`Safety gap: ${t.reason}`);this.incident=t}incident},Ee=class extends Error{constructor(t){super("The delivered test assertion or execution failed; its resource trace is retained in diagnostics");this.trace=t}trace},Ae=class extends Error{};function D(r){throw new Ae(`environment restriction: ${r}`)}function gt(r){let e=new URL(r);return(!["https:","http:"].includes(e.protocol)||e.username||e.password||e.search||e.hash||/%(?:2f|5c|2e|25)/i.test(e.pathname)||r.includes("\\"))&&D("unsupported environment address"),e.href.replace(/\/$/,"")}function Le(r,e){let t=new URL(e,`${r}/`);return(!ht(r,e.includes("://")?e:t.href)||t.username||t.password||t.hash)&&D("request leaves the selected environment"),t}function Ur(r){let e=r.map(t=>{(!t||t.includes("\\")||/[\[\]{}()]/.test(t))&&D("unsupported off-limits pattern");let s=n=>n.split("*").map(a=>a.replace(/[.+?^$|]/g,"\\$&")).join(".*");return new RegExp(t.endsWith("/**")?`^(?:${s(t)}|${s(t.slice(0,-3))})$`:`^${s(t)}$`,"i")});return t=>e.some(s=>s.test(t.href)||s.test(t.pathname))}async function Lr(r){let e=await r.text();if(e)try{return JSON.parse(e)}catch{throw new Error("Shared test response was not JSON")}}function ze(r,e){let t=r;for(let s of e){if(!t||typeof t!="object"||!Object.hasOwn(t,s))return;t=t[s]}return t}async function mt(r){let e=await r.text(),t;if(e)try{t=JSON.parse(e)}catch{t=e}return{status:r.status,headers:r.headers,body:t}}function zr(r,e){let t=r.bearerTokenEnv;if(!t)return;let s=process.env[t];if(!s?.trim())throw new Error(`required SUT credential ${t} is unavailable`);if(process.env.TESTBOT_SHARED_SUT_TOKEN_ENV!==t)throw new Error("declared SUT credential is not approved by TESTBOT_SHARED_SUT_TOKEN_ENV");let n=process.env.TESTBOT_SHARED_SUT_ADDRESS,a=!1;try{a=!!n&&gt(n)===e}catch{}if(!a)throw new Error("SUT address does not match TESTBOT_SHARED_SUT_ADDRESS");return s}function qr(r){return{status:"restricted",detail:r instanceof Ae?r.message:"environment restriction: unsupported shared-environment configuration"}}async function _t(r,e){if(!Re.safeParse(r?.persistenceRevision).success)throw new Error("No valid persistence revision was recorded at generation. Regenerate this test with persistence permission.");let t,s;try{(!r.environmentId||!Array.isArray(r.offLimits))&&D("shared-environment identity and off-limits rules are required"),t=gt(r.environmentAddress),s=Ur(r.offLimits),r.route?.kind!=="persistence"&&D("delivered shared tests require the persistence route")}catch(k){return qr(k)}let n=zr(r,t),a=`testbot-${(0,yt.randomUUID)()}`,i=new Set,o=[],d=async(k,T,b)=>{let N=Le(t,T);return s(N)&&D("the request is off limits"),["GET","HEAD","OPTIONS"].includes(k)||(me=!0),await fetch(N,{method:k,headers:{...n?{Authorization:`Bearer ${n}`}:{},...b===void 0?{}:{"Content-Type":"application/json"}},redirect:"error",signal:AbortSignal.timeout(1e4),...b===void 0?{}:{body:JSON.stringify(b)}})},u=k=>{let T=Le(t,k).href;return i.has(T)||D("mutations and resource reads require a run-owned resource"),T},g=k=>new Ee({runId:a,route:r.route.kind,resources:o,retained:!0,outcome:"test-failed",...k===void 0?{}:{status:k}}),O=async(k,T)=>{let b=k.status;if(!(T===void 0?k.ok:T===b)||b<200||b>=300&&b<400||b>=500)throw await k.body?.cancel(),g(b);return mt(k)},M,me=!1;try{await e({async create(k,T,b,N={}){(!b.trim()||!Object.hasOwn(T,b)||typeof T[b]!="string")&&D("creation needs a supported run-unique string field"),Object.keys(T).some(q=>/^(?:id|_id|uuid|pk)$/i.test(q))&&D("caller-selected resource IDs cannot establish a newly owned record");let A=Le(t,k);A.search&&D("create-only collections cannot use query actions"),s(A)&&D("the request is off limits");let ye=`${T[b]}-${a}`,ge=q=>new Oe({runId:a,route:r.route.kind,resources:[...o,A.href],outcome:"failed-or-unknown",reason:q}),E;try{E=await d("POST",A.href,{...T,[b]:ye})}catch(q){throw q instanceof Ae?q:ge("create response was unavailable; side effects are unknown")}if(E.status>=400&&E.status<500){if(E.status===N.expectedStatus)return mt(E);throw await E.body?.cancel(),g(E.status)}if(!E.ok)throw ge(`create did not establish new-resource provenance (${E.status})`);let $e;try{$e=await Lr(E)}catch{throw ge("create returned unreadable resource provenance")}if(ze($e,N.responseUniqueFieldPath??[b])!==ye)throw ge("create did not confirm the run-unique value");let He=ze($e,N.responseIdPath??["id"]),Qe=E.headers.get("location"),z;try{let q=Qe?new URL(Qe,A).href:typeof He=="string"||typeof He=="number"?`${A.href.replace(/\/$/,"")}/${encodeURIComponent(He)}`:void 0;if(!q)throw new Error("no resource identity");z=Le(t,q)}catch{throw ge("create returned missing, invalid or out-of-scope resource provenance")}let Ke=A.pathname.replace(/\/$/,"")+"/",et=z.pathname.slice(Ke.length);if(z.search||!z.pathname.startsWith(Ke)||!et||et.includes("/")||s(z)||i.has(z.href))throw ge("create returned unsupported resource provenance");if(i.add(z.href),o.push(z.href),E.status!==(N.expectedStatus??201))throw g(E.status);return{url:z.href,body:$e,status:E.status,headers:E.headers}},async read(k,T={}){let b=new URL(u(k));for(let[A,ye]of Object.entries(T.query??{}))b.searchParams.append(A,ye);let N=await d("GET",b.href);return O(N,T.expectedStatus)},async update(k,T,b={}){let N=u(k),A=b.method??"PATCH";A!=="PATCH"&&A!=="PUT"&&D("unsupported resource update method");let ye=await d(A,N,T);return O(ye,b.expectedStatus)}})}catch(k){M=k}if(M instanceof Ae&&!me)return{status:"restricted",detail:M.message};if(M instanceof Oe||M instanceof Ee)throw M;if(M)throw g();return{status:"executed",runId:a,resources:o,retained:!0}}var Pe=p.lazy(()=>p.union([p.string(),p.number().finite(),p.boolean(),p.null(),p.array(Pe),p.record(Pe)])),w=p.string().trim().min(1),xt=p.string().regex(/^[A-Za-z_]\w*$/).optional(),Ge=p.number().int().refine(r=>r>=200&&r<300||r>=400&&r<500,"Expected an explicit success or client rejection status").optional(),vt=p.array(w).min(1).max(20).optional(),Hr=p.object({environmentId:p.string().uuid(),environmentAddress:p.string().url(),targetId:w.optional(),appOrigin:p.string().url().optional(),persistenceRevision:Re.optional(),offLimits:p.array(w),bearerTokenEnv:xt,route:p.object({kind:p.literal("persistence")}).strict()}).strict().refine(r=>!r.persistenceRevision||!r.targetId&&!r.appOrigin,"A generated persistence decision cannot include legacy policy lookup fields"),bt=p.array(p.discriminatedUnion("op",[p.object({op:p.literal("create"),collection:w,body:p.record(Pe),uniqueField:w,expectedStatus:Ge,responseIdPath:vt,responseUniqueFieldPath:vt,as:w}).strict(),p.object({op:p.literal("read"),resource:w,as:w,expectedStatus:Ge,query:p.record(p.string()).optional()}).strict(),p.object({op:p.literal("update"),resource:w,method:p.nativeEnum(Ye).optional(),expectedStatus:Ge,body:p.record(Pe),as:w}).strict(),p.object({op:p.literal("assert"),resource:w,path:p.array(w),equals:Pe}).strict(),p.object({op:p.literal("assertStatus"),resource:w,equals:p.number().int().min(200).max(499)}).strict(),p.object({op:p.literal("assertHeader"),resource:w,name:p.string().regex(/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/),equals:p.string().nullable()}).strict()])).min(1).refine(r=>r.some(e=>e.op==="assert"||e.op==="assertStatus"||e.op==="assertHeader"),"A runnable test must retain a planned assertion"),Ns=p.object({name:w,bearerTokenEnv:xt,steps:bt.describe("ordered objects with op: create (collection, body, uniqueField, as; optional expectedStatus, responseIdPath, responseUniqueFieldPath), read (resource, as; optional expectedStatus, query), update (resource, body, as; optional expectedStatus, method PUT or PATCH), assert (resource, path, equals), assertStatus (resource, equals), or assertHeader (resource, name, equals). Resource names an earlier request alias and paths are arrays of JSON keys")}).strict(),Xe=p.union([p.object({name:w,definition:Hr,steps:bt}).strict(),p.object({name:w,restriction:w,sourceAsset:p.object({path:w.regex(/^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))[^\\]+\.source$/),sha256:p.string().regex(/^[a-f0-9]{64}$/)}).strict()}).strict()]),Fr=`"use strict";
2
2
  const spec = `,Br=`;
3
3
  let runtime;
4
4
  try { runtime = require("@skyramp/testbot-core/dist/shared-environment-test.cjs"); } catch {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyramp/testbot-core",
3
- "version": "0.13.2-v3.539",
3
+ "version": "0.13.2-v3.542",
4
4
  "description": "Skyramp Testbot engine: AI-powered deterministic test generation, execution and maintenance",
5
5
  "main": "dist/main.js",
6
6
  "//files": "An explicit allowlist, never a glob. `dist/` is gitignored, so without this key npm's .gitignore fallback would publish a package with no engine in it; with a glob it would publish the sourcemaps, whose sourcesContent embeds every src/*.ts verbatim. dist/VERSION.json exists only in a release-engine.yml build.",