@skyramp/testbot-core 0.13.1-v3.466 → 0.13.1-v3.467
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VERSION.json +1 -1
- package/dist/main.js +467 -467
- package/dist/post.js +67 -67
- package/dist/runner-client.cjs +2 -2
- package/dist/setup-failure.cjs +1 -1
- package/dist/setup-failure.d.cts +2 -0
- package/package.json +1 -1
package/dist/runner-client.cjs
CHANGED
|
@@ -58,7 +58,7 @@ ${i}
|
|
|
58
58
|
`),`
|
|
59
59
|
`,t)}o(XL,"boundedFailureText");function aa(e){return Js(Sre(e),[]).trim()}o(aa,"commandFailureText");var kre=/^(.*?:\s*)?Command failed: (?:git|gh)\b.*$/;function qd(e,t=Rh){let[n="",...i]=e.split(`
|
|
60
60
|
`).map(a=>a.trim()).filter(Boolean),r=i.length?kre.exec(n):null,s=r?[`${r[1]??""}${i[0]}`,...i.slice(1)]:[n,...i];return KL(s," ",t,Math.floor(t*2/3))}o(qd,"failureReason");function Jd(e){return e.replace(new RegExp("\x1B\\[[0-9;]*m","g"),"")}o(Jd,"stripAnsi");function Bre(e){let t=/^(yarn run v|info Visit|error Command failed|npm ERR!|husky\b|\$ )/i,n=Jd(e).split(`
|
|
61
|
-
`).map(a=>a.trim()).filter(Boolean),i=n.filter(a=>!t.test(a)),r=i.length?i:n;return[...r].reverse().find(a=>/(error|warning|problem|✖|✗|✘|fail|not listed|cannot|denied)/i.test(a))??r[r.length-1]??"(no output)"}o(Bre,"hookSummary");function ej(e){if(!/\bhook\b|husky|pre-commit|lint-staged/i.test(e))return;let t=Bre(e),n=ae().staged.commitHook(/husky\s*[->]\s*([\w-]+)\s+(?:script|hook)\b/i.exec(Jd(e))?.[1]);return/\(code 127\)|exit code 127/i.test(e)||/command not found|: not found$/i.test(t)?ae().staged.commitHookCouldNotRun(n,t):ae().staged.commitRefusedByHook(n,t)}o(ej,"hookRefusal");var d={};Vr(d,{BRAND:()=>Xre,DIRTY:()=>ca,EMPTY_PATH:()=>$re,INVALID:()=>Ee,NEVER:()=>Uie,OK:()=>mn,ParseStatus:()=>rn,Schema:()=>Ge,ZodAny:()=>Ws,ZodArray:()=>os,ZodBigInt:()=>la,ZodBoolean:()=>da,ZodBranded:()=>Yd,ZodCatch:()=>ba,ZodDate:()=>pa,ZodDefault:()=>va,ZodDiscriminatedUnion:()=>$h,ZodEffects:()=>Tr,ZodEnum:()=>Ea,ZodError:()=>zn,ZodFirstPartyTypeKind:()=>Se,ZodFunction:()=>Dh,ZodIntersection:()=>ha,ZodIssueCode:()=>V,ZodLazy:()=>ma,ZodLiteral:()=>ya,ZodMap:()=>gu,ZodNaN:()=>mu,ZodNativeEnum:()=>Ia,ZodNever:()=>ti,ZodNull:()=>Aa,ZodNullable:()=>Si,ZodNumber:()=>ua,ZodObject:()=>qn,ZodOptional:()=>xr,ZodParsedType:()=>te,ZodPipeline:()=>Wd,ZodPromise:()=>Zs,ZodReadonly:()=>wa,ZodRecord:()=>Th,ZodSchema:()=>Ge,ZodSet:()=>hu,ZodString:()=>Ys,ZodSymbol:()=>fu,ZodTransformer:()=>Tr,ZodTuple:()=>Ci,ZodType:()=>Ge,ZodUndefined:()=>fa,ZodUnion:()=>ga,ZodUnknown:()=>ss,ZodVoid:()=>Au,addIssueToContext:()=>K,any:()=>cie,array:()=>pie,bigint:()=>rie,boolean:()=>dj,coerce:()=>Pie,custom:()=>cj,date:()=>iie,datetimeRegex:()=>oj,defaultErrorMap:()=>rs,discriminatedUnion:()=>hie,effect:()=>Rie,enum:()=>Sie,function:()=>bie,getErrorMap:()=>lu,getParsedType:()=>wi,instanceof:()=>tie,intersection:()=>mie,isAborted:()=>Qh,isAsync:()=>du,isDirty:()=>xh,isValid:()=>Hs,late:()=>eie,lazy:()=>wie,literal:()=>Cie,makeIssue:()=>Hd,map:()=>Iie,nan:()=>nie,nativeEnum:()=>kie,never:()=>lie,null:()=>aie,nullable:()=>xie,number:()=>lj,object:()=>fie,objectUtil:()=>eC,oboolean:()=>Nie,onumber:()=>_ie,optional:()=>Qie,ostring:()=>Die,pipeline:()=>Tie,preprocess:()=>$ie,promise:()=>Bie,quotelessJson:()=>Rre,record:()=>Eie,set:()=>vie,setErrorMap:()=>xre,strictObject:()=>Aie,string:()=>uj,symbol:()=>sie,transformer:()=>Rie,tuple:()=>yie,undefined:()=>oie,union:()=>gie,unknown:()=>uie,util:()=>Ye,void:()=>die});var Ye;(function(e){e.assertEqual=r=>{};function t(r){}o(t,"assertIs"),e.assertIs=t;function n(r){throw new Error}o(n,"assertNever"),e.assertNever=n,e.arrayToEnum=r=>{let s={};for(let a of r)s[a]=a;return s},e.getValidEnumValues=r=>{let s=e.objectKeys(r).filter(c=>typeof r[r[c]]!="number"),a={};for(let c of s)a[c]=r[c];return e.objectValues(a)},e.objectValues=r=>e.objectKeys(r).map(function(s){return r[s]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let s=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&s.push(a);return s},e.find=(r,s)=>{for(let a of r)if(s(a))return a},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,s=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}o(i,"joinValues"),e.joinValues=i,e.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(Ye||(Ye={}));var eC;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(eC||(eC={}));var te=Ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wi=o(e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return Number.isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}},"getParsedType");var V=Ye.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"]),Rre=o(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),zn=class e extends Error{static{o(this,"ZodError")}get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(s){return s.message},i={_errors:[]},r=o(s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)i._errors.push(n(a));else{let c=i,u=0;for(;u<a.path.length;){let l=a.path[u],p=u===a.path.length-1;if(l==="_errors"){p&&c._errors.push(n(a)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||(l==="__proto__"?Object.defineProperty(c,l,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):c[l]={_errors:[]}),c=c[l],p&&c._errors.push(n(a)),u++}}},"processError");return r(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n=Object.create(null),i=[];for(let r of this.issues)if(r.path.length>0){let s=r.path[0];n[s]=n[s]||[],n[s].push(t(r))}else i.push(t(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};zn.create=e=>new zn(e);var Qre=o((e,t)=>{let n;switch(e.code){case V.invalid_type:e.received===te.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ye.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ye.joinValues(e.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ye.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${Ye.joinValues(e.options)}, received '${e.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ye.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case V.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case V.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ye.assertNever(e)}return{message:n}},"errorMap"),rs=Qre;var tj=rs;function xre(e){tj=e}o(xre,"setErrorMap");function lu(){return tj}o(lu,"getErrorMap");var Hd=o(e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,s=[...n,...r.path||[]],a={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let c="",u=i.filter(l=>!!l).slice().reverse();for(let l of u)c=l(a,{data:t,defaultError:c}).message;return{...r,path:s,message:c}},"makeIssue"),$re=[];function K(e,t){let n=lu(),i=Hd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===rs?void 0:rs].filter(r=>!!r)});e.common.issues.push(i)}o(K,"addIssueToContext");var rn=class e{static{o(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let i=[];for(let r of n){if(r.status==="aborted")return Ee;r.status==="dirty"&&t.dirty(),i.push(r.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,n){let i=[];for(let r of n){let s=await r.key,a=await r.value;i.push({key:s,value:a})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:s,value:a}=r;if(s.status==="aborted"||a.status==="aborted")return Ee;s.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(i[s.value]=a.value)}return{status:t.value,value:i}}},Ee=Object.freeze({status:"aborted"}),ca=o(e=>({status:"dirty",value:e}),"DIRTY"),mn=o(e=>({status:"valid",value:e}),"OK"),Qh=o(e=>e.status==="aborted","isAborted"),xh=o(e=>e.status==="dirty","isDirty"),Hs=o(e=>e.status==="valid","isValid"),du=o(e=>typeof Promise<"u"&&e instanceof Promise,"isAsync");var le;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(le||(le={}));var $r=class{static{o(this,"ParseInputLazyPath")}constructor(t,n,i,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=i,this._key=r}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}},nj=o((e,t)=>{if(Hs(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new zn(e.common.issues);return this._error=n,this._error}}},"handleResult");function Ue(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:i,description:r}=e;if(t&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:o((a,c)=>{let{message:u}=e;return a.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??i??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:u??n??c.defaultError}},"customMap"),description:r}}o(Ue,"processCreateParams");var Ge=class{static{o(this,"ZodType")}get description(){return this._def.description}_getType(t){return wi(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:wi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rn,ctx:{common:t.parent.common,data:t.data,parsedType:wi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(du(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let i=this.safeParse(t,n);if(i.success)return i.data;throw i.error}safeParse(t,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wi(t)},r=this._parseSync({data:t,path:i.path,parent:i});return nj(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wi(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return Hs(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>Hs(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){let i=await this.safeParseAsync(t,n);if(i.success)return i.data;throw i.error}async safeParseAsync(t,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wi(t)},r=this._parse({data:t,path:i.path,parent:i}),s=await(du(r)?r:Promise.resolve(r));return nj(i,s)}refine(t,n){let i=o(r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n,"getIssueProperties");return this._refinement((r,s)=>{let a=t(r),c=o(()=>s.addIssue({code:V.custom,...i(r)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(t,n){return this._refinement((i,r)=>t(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(t){return new Tr({schema:this,typeName:Se.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:o(n=>this["~validate"](n),"validate")}}optional(){return xr.create(this,this._def)}nullable(){return Si.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return os.create(this)}promise(){return Zs.create(this,this._def)}or(t){return ga.create([this,t],this._def)}and(t){return ha.create(this,t,this._def)}transform(t){return new Tr({...Ue(this._def),schema:this,typeName:Se.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new va({...Ue(this._def),innerType:this,defaultValue:n,typeName:Se.ZodDefault})}brand(){return new Yd({typeName:Se.ZodBranded,type:this,...Ue(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new ba({...Ue(this._def),innerType:this,catchValue:n,typeName:Se.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Wd.create(this,t)}readonly(){return wa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Tre=/^c[^\s-]{8,}$/i,Dre=/^[0-9a-z]+$/,_re=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nre=/^[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,Pre=/^[a-z0-9_-]{21}$/i,Ure=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Fre=/^[-+]?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)?)??$/,Ore=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Mre="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",tC,Lre=/^(?:(?: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])$/,jre=/^(?:(?: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])$/,Gre=/^(([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]))$/,Vre=/^(([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])$/,zre=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qre=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ij="((\\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])))",Jre=new RegExp(`^${ij}$`);function sj(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}o(sj,"timeRegexSource");function Hre(e){return new RegExp(`^${sj(e)}$`)}o(Hre,"timeRegex");function oj(e){let t=`${ij}T${sj(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}o(oj,"datetimeRegex");function Yre(e,t){return!!((t==="v4"||!t)&&Lre.test(e)||(t==="v6"||!t)&&Gre.test(e))}o(Yre,"isValidIP");function Wre(e,t){if(!Ure.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||t&&r.alg!==t)}catch{return!1}}o(Wre,"isValidJWT");function Zre(e,t){return!!((t==="v4"||!t)&&jre.test(e)||(t==="v6"||!t)&&Vre.test(e))}o(Zre,"isValidCidr");var Ys=class e extends Ge{static{o(this,"ZodString")}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){let s=this._getOrReturnCtx(t);return K(s,{code:V.invalid_type,expected:te.string,received:s.parsedType}),Ee}let i=new rn,r;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(r=this._getOrReturnCtx(t,r),K(r,{code:V.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="max")t.data.length>s.value&&(r=this._getOrReturnCtx(t,r),K(r,{code:V.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="length"){let a=t.data.length>s.value,c=t.data.length<s.value;(a||c)&&(r=this._getOrReturnCtx(t,r),a?K(r,{code:V.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&K(r,{code:V.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),i.dirty())}else if(s.kind==="email")Ore.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"email",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="emoji")tC||(tC=new RegExp(Mre,"u")),tC.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"emoji",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="uuid")Nre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"uuid",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="nanoid")Pre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"nanoid",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid")Tre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"cuid",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid2")Dre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"cuid2",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="ulid")_re.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"ulid",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),K(r,{validation:"url",code:V.invalid_string,message:s.message}),i.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"regex",code:V.invalid_string,message:s.message}),i.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(t,r),K(r,{code:V.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),i.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(r=this._getOrReturnCtx(t,r),K(r,{code:V.invalid_string,validation:{startsWith:s.value},message:s.message}),i.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(r=this._getOrReturnCtx(t,r),K(r,{code:V.invalid_string,validation:{endsWith:s.value},message:s.message}),i.dirty()):s.kind==="datetime"?oj(s).test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{code:V.invalid_string,validation:"datetime",message:s.message}),i.dirty()):s.kind==="date"?Jre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{code:V.invalid_string,validation:"date",message:s.message}),i.dirty()):s.kind==="time"?Hre(s).test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{code:V.invalid_string,validation:"time",message:s.message}),i.dirty()):s.kind==="duration"?Fre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"duration",code:V.invalid_string,message:s.message}),i.dirty()):s.kind==="ip"?Yre(t.data,s.version)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"ip",code:V.invalid_string,message:s.message}),i.dirty()):s.kind==="jwt"?Wre(t.data,s.alg)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"jwt",code:V.invalid_string,message:s.message}),i.dirty()):s.kind==="cidr"?Zre(t.data,s.version)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"cidr",code:V.invalid_string,message:s.message}),i.dirty()):s.kind==="base64"?zre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"base64",code:V.invalid_string,message:s.message}),i.dirty()):s.kind==="base64url"?qre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"base64url",code:V.invalid_string,message:s.message}),i.dirty()):Ye.assertNever(s);return{status:i.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:V.invalid_string,...le.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...le.errToObj(t)})}url(t){return this._addCheck({kind:"url",...le.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...le.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...le.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...le.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...le.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...le.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...le.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...le.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...le.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...le.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...le.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...le.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...le.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...le.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...le.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...le.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...le.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...le.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...le.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...le.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...le.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...le.errToObj(n)})}nonempty(t){return this.min(1,le.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Ys.create=e=>new Ys({checks:[],typeName:Se.ZodString,coerce:e?.coerce??!1,...Ue(e)});function Kre(e,t){let n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,r=n>i?n:i,s=Number.parseInt(e.toFixed(r).replace(".","")),a=Number.parseInt(t.toFixed(r).replace(".",""));return s%a/10**r}o(Kre,"floatSafeRemainder");var ua=class e extends Ge{static{o(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==te.number){let s=this._getOrReturnCtx(t);return K(s,{code:V.invalid_type,expected:te.number,received:s.parsedType}),Ee}let i,r=new rn;for(let s of this._def.checks)s.kind==="int"?Ye.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),K(i,{code:V.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(i=this._getOrReturnCtx(t,i),K(i,{code:V.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(i=this._getOrReturnCtx(t,i),K(i,{code:V.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?Kre(t.data,s.value)!==0&&(i=this._getOrReturnCtx(t,i),K(i,{code:V.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),K(i,{code:V.not_finite,message:s.message}),r.dirty()):Ye.assertNever(s);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,le.toString(n))}gt(t,n){return this.setLimit("min",t,!1,le.toString(n))}lte(t,n){return this.setLimit("max",t,!0,le.toString(n))}lt(t,n){return this.setLimit("max",t,!1,le.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:le.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:le.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:le.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:le.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:le.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:le.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:le.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:le.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:le.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:le.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ye.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(n)&&Number.isFinite(t)}};ua.create=e=>new ua({checks:[],typeName:Se.ZodNumber,coerce:e?.coerce||!1,...Ue(e)});var la=class e extends Ge{static{o(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==te.bigint)return this._getInvalidInput(t);let i,r=new rn;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(i=this._getOrReturnCtx(t,i),K(i,{code:V.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(i=this._getOrReturnCtx(t,i),K(i,{code:V.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),K(i,{code:V.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):Ye.assertNever(s);return{status:r.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return K(n,{code:V.invalid_type,expected:te.bigint,received:n.parsedType}),Ee}gte(t,n){return this.setLimit("min",t,!0,le.toString(n))}gt(t,n){return this.setLimit("min",t,!1,le.toString(n))}lte(t,n){return this.setLimit("max",t,!0,le.toString(n))}lt(t,n){return this.setLimit("max",t,!1,le.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:le.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:le.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:le.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:le.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:le.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:le.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};la.create=e=>new la({checks:[],typeName:Se.ZodBigInt,coerce:e?.coerce??!1,...Ue(e)});var da=class extends Ge{static{o(this,"ZodBoolean")}_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){let i=this._getOrReturnCtx(t);return K(i,{code:V.invalid_type,expected:te.boolean,received:i.parsedType}),Ee}return mn(t.data)}};da.create=e=>new da({typeName:Se.ZodBoolean,coerce:e?.coerce||!1,...Ue(e)});var pa=class e extends Ge{static{o(this,"ZodDate")}_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){let s=this._getOrReturnCtx(t);return K(s,{code:V.invalid_type,expected:te.date,received:s.parsedType}),Ee}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return K(s,{code:V.invalid_date}),Ee}let i=new rn,r;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(r=this._getOrReturnCtx(t,r),K(r,{code:V.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),i.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(r=this._getOrReturnCtx(t,r),K(r,{code:V.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):Ye.assertNever(s);return{status:i.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:le.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:le.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};pa.create=e=>new pa({checks:[],coerce:e?.coerce||!1,typeName:Se.ZodDate,...Ue(e)});var fu=class extends Ge{static{o(this,"ZodSymbol")}_parse(t){if(this._getType(t)!==te.symbol){let i=this._getOrReturnCtx(t);return K(i,{code:V.invalid_type,expected:te.symbol,received:i.parsedType}),Ee}return mn(t.data)}};fu.create=e=>new fu({typeName:Se.ZodSymbol,...Ue(e)});var fa=class extends Ge{static{o(this,"ZodUndefined")}_parse(t){if(this._getType(t)!==te.undefined){let i=this._getOrReturnCtx(t);return K(i,{code:V.invalid_type,expected:te.undefined,received:i.parsedType}),Ee}return mn(t.data)}};fa.create=e=>new fa({typeName:Se.ZodUndefined,...Ue(e)});var Aa=class extends Ge{static{o(this,"ZodNull")}_parse(t){if(this._getType(t)!==te.null){let i=this._getOrReturnCtx(t);return K(i,{code:V.invalid_type,expected:te.null,received:i.parsedType}),Ee}return mn(t.data)}};Aa.create=e=>new Aa({typeName:Se.ZodNull,...Ue(e)});var Ws=class extends Ge{static{o(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(t){return mn(t.data)}};Ws.create=e=>new Ws({typeName:Se.ZodAny,...Ue(e)});var ss=class extends Ge{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(t){return mn(t.data)}};ss.create=e=>new ss({typeName:Se.ZodUnknown,...Ue(e)});var ti=class extends Ge{static{o(this,"ZodNever")}_parse(t){let n=this._getOrReturnCtx(t);return K(n,{code:V.invalid_type,expected:te.never,received:n.parsedType}),Ee}};ti.create=e=>new ti({typeName:Se.ZodNever,...Ue(e)});var Au=class extends Ge{static{o(this,"ZodVoid")}_parse(t){if(this._getType(t)!==te.undefined){let i=this._getOrReturnCtx(t);return K(i,{code:V.invalid_type,expected:te.void,received:i.parsedType}),Ee}return mn(t.data)}};Au.create=e=>new Au({typeName:Se.ZodVoid,...Ue(e)});var os=class e extends Ge{static{o(this,"ZodArray")}_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==te.array)return K(n,{code:V.invalid_type,expected:te.array,received:n.parsedType}),Ee;if(r.exactLength!==null){let a=n.data.length>r.exactLength.value,c=n.data.length<r.exactLength.value;(a||c)&&(K(n,{code:a?V.too_big:V.too_small,minimum:c?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(K(n,{code:V.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(K(n,{code:V.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((a,c)=>r.type._parseAsync(new $r(n,a,n.path,c)))).then(a=>rn.mergeArray(i,a));let s=[...n.data].map((a,c)=>r.type._parseSync(new $r(n,a,n.path,c)));return rn.mergeArray(i,s)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:le.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:le.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:le.toString(n)}})}nonempty(t){return this.min(1,t)}};os.create=(e,t)=>new os({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Se.ZodArray,...Ue(t)});function pu(e){if(e instanceof qn){let t={};for(let n in e.shape){let i=e.shape[n];t[n]=xr.create(pu(i))}return new qn({...e._def,shape:o(()=>t,"shape")})}else return e instanceof os?new os({...e._def,type:pu(e.element)}):e instanceof xr?xr.create(pu(e.unwrap())):e instanceof Si?Si.create(pu(e.unwrap())):e instanceof Ci?Ci.create(e.items.map(t=>pu(t))):e}o(pu,"deepPartialify");var qn=class e extends Ge{static{o(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=Ye.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==te.object){let l=this._getOrReturnCtx(t);return K(l,{code:V.invalid_type,expected:te.object,received:l.parsedType}),Ee}let{status:i,ctx:r}=this._processInputParams(t),{shape:s,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof ti&&this._def.unknownKeys==="strip"))for(let l in r.data)a.includes(l)||c.push(l);let u=[];for(let l of a){let p=s[l],f=r.data[l];u.push({key:{status:"valid",value:l},value:p._parse(new $r(r,f,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof ti){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of c)u.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(l==="strict")c.length>0&&(K(r,{code:V.unrecognized_keys,keys:c}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of c){let f=r.data[p];u.push({key:{status:"valid",value:p},value:l._parse(new $r(r,f,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of u){let f=await p.key,g=await p.value;l.push({key:f,value:g,alwaysSet:p.alwaysSet})}return l}).then(l=>rn.mergeObjectSync(i,l)):rn.mergeObjectSync(i,u)}get shape(){return this._def.shape()}strict(t){return le.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:o((n,i)=>{let r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:le.errToObj(t).message??r}:{message:r}},"errorMap")}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:o(()=>({...this._def.shape(),...t}),"shape")})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:o(()=>({...this._def.shape(),...t._def.shape()}),"shape"),typeName:Se.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let i of Ye.objectKeys(t))t[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new e({...this._def,shape:o(()=>n,"shape")})}omit(t){let n={};for(let i of Ye.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:o(()=>n,"shape")})}deepPartial(){return pu(this)}partial(t){let n={};for(let i of Ye.objectKeys(this.shape)){let r=this.shape[i];t&&!t[i]?n[i]=r:n[i]=r.optional()}return new e({...this._def,shape:o(()=>n,"shape")})}required(t){let n={};for(let i of Ye.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof xr;)s=s._def.innerType;n[i]=s}return new e({...this._def,shape:o(()=>n,"shape")})}keyof(){return aj(Ye.objectKeys(this.shape))}};qn.create=(e,t)=>new qn({shape:o(()=>e,"shape"),unknownKeys:"strip",catchall:ti.create(),typeName:Se.ZodObject,...Ue(t)});qn.strictCreate=(e,t)=>new qn({shape:o(()=>e,"shape"),unknownKeys:"strict",catchall:ti.create(),typeName:Se.ZodObject,...Ue(t)});qn.lazycreate=(e,t)=>new qn({shape:e,unknownKeys:"strip",catchall:ti.create(),typeName:Se.ZodObject,...Ue(t)});var ga=class extends Ge{static{o(this,"ZodUnion")}_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(s){for(let c of s)if(c.result.status==="valid")return c.result;for(let c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;let a=s.map(c=>new zn(c.ctx.common.issues));return K(n,{code:V.invalid_union,unionErrors:a}),Ee}if(o(r,"handleResults"),n.common.async)return Promise.all(i.map(async s=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(r);{let s,a=[];for(let u of i){let l={...n,common:{...n.common,issues:[]},parent:null},p=u._parseSync({data:n.data,path:n.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let c=a.map(u=>new zn(u));return K(n,{code:V.invalid_union,unionErrors:c}),Ee}}get options(){return this._def.options}};ga.create=(e,t)=>new ga({options:e,typeName:Se.ZodUnion,...Ue(t)});var is=o(e=>e instanceof ma?is(e.schema):e instanceof Tr?is(e.innerType()):e instanceof ya?[e.value]:e instanceof Ea?e.options:e instanceof Ia?Ye.objectValues(e.enum):e instanceof va?is(e._def.innerType):e instanceof fa?[void 0]:e instanceof Aa?[null]:e instanceof xr?[void 0,...is(e.unwrap())]:e instanceof Si?[null,...is(e.unwrap())]:e instanceof Yd||e instanceof wa?is(e.unwrap()):e instanceof ba?is(e._def.innerType):[],"getDiscriminator"),$h=class e extends Ge{static{o(this,"ZodDiscriminatedUnion")}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==te.object)return K(n,{code:V.invalid_type,expected:te.object,received:n.parsedType}),Ee;let i=this.discriminator,r=n.data[i],s=this.optionsMap.get(r);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(K(n,{code:V.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,i){let r=new Map;for(let s of n){let a=is(s.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let c of a){if(r.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);r.set(c,s)}}return new e({typeName:Se.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...Ue(i)})}};function nC(e,t){let n=wi(e),i=wi(t);if(e===t)return{valid:!0,data:e};if(n===te.object&&i===te.object){let r=Ye.objectKeys(t),s=Ye.objectKeys(e).filter(c=>r.indexOf(c)!==-1),a={...e,...t};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let c of s){if(c==="__proto__")continue;let u=nC(e[c],t[c]);if(!u.valid)return{valid:!1};a[c]=u.data}return{valid:!0,data:a}}else if(n===te.array&&i===te.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let s=0;s<e.length;s++){let a=e[s],c=t[s],u=nC(a,c);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return n===te.date&&i===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}o(nC,"mergeValues");var ha=class extends Ge{static{o(this,"ZodIntersection")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=o((s,a)=>{if(Qh(s)||Qh(a))return Ee;let c=nC(s.value,a.value);return c.valid?((xh(s)||xh(a))&&n.dirty(),{status:n.value,value:c.data}):(K(i,{code:V.invalid_intersection_types}),Ee)},"handleParsed");return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,a])=>r(s,a)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};ha.create=(e,t,n)=>new ha({left:e,right:t,typeName:Se.ZodIntersection,...Ue(n)});var Ci=class e extends Ge{static{o(this,"ZodTuple")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==te.array)return K(i,{code:V.invalid_type,expected:te.array,received:i.parsedType}),Ee;if(i.data.length<this._def.items.length)return K(i,{code:V.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&i.data.length>this._def.items.length&&(K(i,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...i.data].map((a,c)=>{let u=this._def.items[c]||this._def.rest;return u?u._parse(new $r(i,a,i.path,c)):null}).filter(a=>!!a);return i.common.async?Promise.all(s).then(a=>rn.mergeArray(n,a)):rn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ci.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ci({items:e,typeName:Se.ZodTuple,rest:null,...Ue(t)})};var Th=class e extends Ge{static{o(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==te.object)return K(i,{code:V.invalid_type,expected:te.object,received:i.parsedType}),Ee;let r=[],s=this._def.keyType,a=this._def.valueType;for(let c in i.data)r.push({key:s._parse(new $r(i,c,i.path,c)),value:a._parse(new $r(i,i.data[c],i.path,c)),alwaysSet:c in i.data});return i.common.async?rn.mergeObjectAsync(n,r):rn.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof Ge?new e({keyType:t,valueType:n,typeName:Se.ZodRecord,...Ue(i)}):new e({keyType:Ys.create(),valueType:t,typeName:Se.ZodRecord,...Ue(n)})}},gu=class extends Ge{static{o(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==te.map)return K(i,{code:V.invalid_type,expected:te.map,received:i.parsedType}),Ee;let r=this._def.keyType,s=this._def.valueType,a=[...i.data.entries()].map(([c,u],l)=>({key:r._parse(new $r(i,c,i.path,[l,"key"])),value:s._parse(new $r(i,u,i.path,[l,"value"]))}));if(i.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,p=await u.value;if(l.status==="aborted"||p.status==="aborted")return Ee;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(l.value,p.value)}return{status:n.value,value:c}})}else{let c=new Map;for(let u of a){let l=u.key,p=u.value;if(l.status==="aborted"||p.status==="aborted")return Ee;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(l.value,p.value)}return{status:n.value,value:c}}}};gu.create=(e,t,n)=>new gu({valueType:t,keyType:e,typeName:Se.ZodMap,...Ue(n)});var hu=class e extends Ge{static{o(this,"ZodSet")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==te.set)return K(i,{code:V.invalid_type,expected:te.set,received:i.parsedType}),Ee;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(K(i,{code:V.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(K(i,{code:V.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let s=this._def.valueType;function a(u){let l=new Set;for(let p of u){if(p.status==="aborted")return Ee;p.status==="dirty"&&n.dirty(),l.add(p.value)}return{status:n.value,value:l}}o(a,"finalizeSet");let c=[...i.data.values()].map((u,l)=>s._parse(new $r(i,u,i.path,l)));return i.common.async?Promise.all(c).then(u=>a(u)):a(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:le.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:le.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};hu.create=(e,t)=>new hu({valueType:e,minSize:null,maxSize:null,typeName:Se.ZodSet,...Ue(t)});var Dh=class e extends Ge{static{o(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==te.function)return K(n,{code:V.invalid_type,expected:te.function,received:n.parsedType}),Ee;function i(c,u){return Hd({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,lu(),rs].filter(l=>!!l),issueData:{code:V.invalid_arguments,argumentsError:u}})}o(i,"makeArgsIssue");function r(c,u){return Hd({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,lu(),rs].filter(l=>!!l),issueData:{code:V.invalid_return_type,returnTypeError:u}})}o(r,"makeReturnsIssue");let s={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Zs){let c=this;return mn(async function(...u){let l=new zn([]),p=await c._def.args.parseAsync(u,s).catch(h=>{throw l.addIssue(i(u,h)),l}),f=await Reflect.apply(a,this,p);return await c._def.returns._def.type.parseAsync(f,s).catch(h=>{throw l.addIssue(r(f,h)),l})})}else{let c=this;return mn(function(...u){let l=c._def.args.safeParse(u,s);if(!l.success)throw new zn([i(u,l.error)]);let p=Reflect.apply(a,this,l.data),f=c._def.returns.safeParse(p,s);if(!f.success)throw new zn([r(p,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ci.create(t).rest(ss.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,i){return new e({args:t||Ci.create([]).rest(ss.create()),returns:n||ss.create(),typeName:Se.ZodFunction,...Ue(i)})}},ma=class extends Ge{static{o(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ma.create=(e,t)=>new ma({getter:e,typeName:Se.ZodLazy,...Ue(t)});var ya=class extends Ge{static{o(this,"ZodLiteral")}_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return K(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:t.data}}get value(){return this._def.value}};ya.create=(e,t)=>new ya({value:e,typeName:Se.ZodLiteral,...Ue(t)});function aj(e,t){return new Ea({values:e,typeName:Se.ZodEnum,...Ue(t)})}o(aj,"createZodEnum");var Ea=class e extends Ge{static{o(this,"ZodEnum")}_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return K(n,{expected:Ye.joinValues(i),received:n.parsedType,code:V.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),i=this._def.values;return K(n,{received:n.data,code:V.invalid_enum_value,options:i}),Ee}return mn(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(i=>!t.includes(i)),{...this._def,...n})}};Ea.create=aj;var Ia=class extends Ge{static{o(this,"ZodNativeEnum")}_parse(t){let n=Ye.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==te.string&&i.parsedType!==te.number){let r=Ye.objectValues(n);return K(i,{expected:Ye.joinValues(r),received:i.parsedType,code:V.invalid_type}),Ee}if(this._cache||(this._cache=new Set(Ye.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=Ye.objectValues(n);return K(i,{received:i.data,code:V.invalid_enum_value,options:r}),Ee}return mn(t.data)}get enum(){return this._def.values}};Ia.create=(e,t)=>new Ia({values:e,typeName:Se.ZodNativeEnum,...Ue(t)});var Zs=class extends Ge{static{o(this,"ZodPromise")}unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==te.promise&&n.common.async===!1)return K(n,{code:V.invalid_type,expected:te.promise,received:n.parsedType}),Ee;let i=n.parsedType===te.promise?n.data:Promise.resolve(n.data);return mn(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Zs.create=(e,t)=>new Zs({type:e,typeName:Se.ZodPromise,...Ue(t)});var Tr=class extends Ge{static{o(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Se.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=this._def.effect||null,s={addIssue:o(a=>{K(i,a),a.fatal?n.abort():n.dirty()},"addIssue"),get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let a=r.transform(i.data,s);if(i.common.async)return Promise.resolve(a).then(async c=>{if(n.value==="aborted")return Ee;let u=await this._def.schema._parseAsync({data:c,path:i.path,parent:i});return u.status==="aborted"?Ee:u.status==="dirty"?ca(u.value):n.value==="dirty"?ca(u.value):u});{if(n.value==="aborted")return Ee;let c=this._def.schema._parseSync({data:a,path:i.path,parent:i});return c.status==="aborted"?Ee:c.status==="dirty"?ca(c.value):n.value==="dirty"?ca(c.value):c}}if(r.type==="refinement"){let a=o(c=>{let u=r.refinement(c,s);if(i.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c},"executeRefinement");if(i.common.async===!1){let c=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?Ee:(c.status==="dirty"&&n.dirty(),a(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(c=>c.status==="aborted"?Ee:(c.status==="dirty"&&n.dirty(),a(c.value).then(()=>({status:n.value,value:c.value}))))}if(r.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Hs(a))return Ee;let c=r.transform(a.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>Hs(a)?Promise.resolve(r.transform(a.value,s)).then(c=>({status:n.value,value:c})):Ee);Ye.assertNever(r)}};Tr.create=(e,t,n)=>new Tr({schema:e,typeName:Se.ZodEffects,effect:t,...Ue(n)});Tr.createWithPreprocess=(e,t,n)=>new Tr({schema:t,effect:{type:"preprocess",transform:e},typeName:Se.ZodEffects,...Ue(n)});var xr=class extends Ge{static{o(this,"ZodOptional")}_parse(t){return this._getType(t)===te.undefined?mn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};xr.create=(e,t)=>new xr({innerType:e,typeName:Se.ZodOptional,...Ue(t)});var Si=class extends Ge{static{o(this,"ZodNullable")}_parse(t){return this._getType(t)===te.null?mn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Si.create=(e,t)=>new Si({innerType:e,typeName:Se.ZodNullable,...Ue(t)});var va=class extends Ge{static{o(this,"ZodDefault")}_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===te.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};va.create=(e,t)=>new va({innerType:e,typeName:Se.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ue(t)});var ba=class extends Ge{static{o(this,"ZodCatch")}_parse(t){let{ctx:n}=this._processInputParams(t),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return du(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new zn(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new zn(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};ba.create=(e,t)=>new ba({innerType:e,typeName:Se.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ue(t)});var mu=class extends Ge{static{o(this,"ZodNaN")}_parse(t){if(this._getType(t)!==te.nan){let i=this._getOrReturnCtx(t);return K(i,{code:V.invalid_type,expected:te.nan,received:i.parsedType}),Ee}return{status:"valid",value:t.data}}};mu.create=e=>new mu({typeName:Se.ZodNaN,...Ue(e)});var Xre=Symbol("zod_brand"),Yd=class extends Ge{static{o(this,"ZodBranded")}_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},Wd=class e extends Ge{static{o(this,"ZodPipeline")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return o(async()=>{let s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?Ee:s.status==="dirty"?(n.dirty(),ca(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})},"handleAsync")();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?Ee:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(t,n){return new e({in:t,out:n,typeName:Se.ZodPipeline})}},wa=class extends Ge{static{o(this,"ZodReadonly")}_parse(t){let n=this._def.innerType._parse(t),i=o(r=>(Hs(r)&&(r.value=Object.freeze(r.value)),r),"freeze");return du(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};wa.create=(e,t)=>new wa({innerType:e,typeName:Se.ZodReadonly,...Ue(t)});function rj(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}o(rj,"cleanParams");function cj(e,t={},n){return e?Ws.create().superRefine((i,r)=>{let s=e(i);if(s instanceof Promise)return s.then(a=>{if(!a){let c=rj(t,i),u=c.fatal??n??!0;r.addIssue({code:"custom",...c,fatal:u})}});if(!s){let a=rj(t,i),c=a.fatal??n??!0;r.addIssue({code:"custom",...a,fatal:c})}}):Ws.create()}o(cj,"custom");var eie={object:qn.lazycreate},Se;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Se||(Se={}));var tie=o((e,t={message:`Input not instance of ${e.name}`})=>cj(n=>n instanceof e,t),"instanceOfType"),uj=Ys.create,lj=ua.create,nie=mu.create,rie=la.create,dj=da.create,iie=pa.create,sie=fu.create,oie=fa.create,aie=Aa.create,cie=Ws.create,uie=ss.create,lie=ti.create,die=Au.create,pie=os.create,fie=qn.create,Aie=qn.strictCreate,gie=ga.create,hie=$h.create,mie=ha.create,yie=Ci.create,Eie=Th.create,Iie=gu.create,vie=hu.create,bie=Dh.create,wie=ma.create,Cie=ya.create,Sie=Ea.create,kie=Ia.create,Bie=Zs.create,Rie=Tr.create,Qie=xr.create,xie=Si.create,$ie=Tr.createWithPreprocess,Tie=Wd.create,Die=o(()=>uj().optional(),"ostring"),_ie=o(()=>lj().optional(),"onumber"),Nie=o(()=>dj().optional(),"oboolean"),Pie={string:o((e=>Ys.create({...e,coerce:!0})),"string"),number:o((e=>ua.create({...e,coerce:!0})),"number"),boolean:o((e=>da.create({...e,coerce:!0})),"boolean"),bigint:o((e=>la.create({...e,coerce:!0})),"bigint"),date:o((e=>pa.create({...e,coerce:!0})),"date")};var Uie=Ee;var Zd=(r=>(r.ModelProvider="model_provider",r.SutAccess="sut_access",r.Skyramp="skyramp",r.Other="other",r))(Zd||{}),rC=(i=>(i.Ready="ready",i.Blocked="blocked",i.NeedsInputs="needs_inputs",i))(rC||{});var _h=300,Bt=d.string().trim().min(1),Fie=d.object({action:d.enum(["start","run","wait"]),text:Bt,source:d.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:Bt.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(e=>e.source==="file"==(e.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),Kd=/^[A-Za-z_][A-Za-z0-9_]*$/,ki=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,yu=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(yu||{}),Bi="shared",Oie=Bt.refine(e=>{try{let t=new URL(e);return["http:","https:"].includes(t.protocol)&&!t.username&&!t.password}catch{return!1}},"an http(s) URL with no login in it"),Eu=d.object({address:Oie,readyWhen:Bt.nullable(),credentials:d.array(d.string().regex(ki)).max(50),revisionSources:d.array(d.object({method:d.nativeEnum(yu),detail:Bt.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:d.array(Bt).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),iC={steps:d.array(Fie).max(20).optional().describe("how it starts, in order"),kind:d.enum(["web_app","service","database","external_service"]).optional(),from:d.object({file:Bt,service:Bt.nullable()}).strict().optional(),credentials:d.array(d.string().max(100).regex(Kd)).max(50).optional().describe("the Target's credentials this component's recipe uses: a sign-in (a test user, password or token) or an API key, which the workflow supplies from a GitHub Actions secret as the environment variable of the credential's name; give each name exactly as the recipe reads it. Names only, never a value, and not a secret the recipe generates itself")},sC=d.object({name:Bt,repository:Bt.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:d.boolean(),...iC,deployed:Bt.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),Mie=d.object({name:d.string().regex(ki).describe("the credential's environment variable name, as the recipe reads it and the credentials event names it"),purpose:d.enum(["sut_access","other"]).describe("sut_access: it signs in to or calls the SUT or a service it needs; other: anything else"),required:d.boolean().describe("false only when the SUT starts without it, with less working"),how:Bt.max(_h).describe('one short sentence: what the value is and where a person gets it, such as "A Mattermost Enterprise licence key, from the customer portal"; never a value')}),Lie=d.object({component:Bt,problem:Bt,evidence:Bt.describe("the exact command and output that shows it"),fix:Bt.describe("what the user must provide, and where")}),jie=d.object({framework:Bt,file:Bt.describe("the test file run, relative to its repository root"),result:d.enum(["pass","fail","error"])}),Gie=d.object({input:Bt.describe("the part of the user's SUT input, as given"),reason:Bt}),XSe=d.object({schemaVersion:d.literal(1),status:d.nativeEnum(rC).describe("ready only if every component came up healthy and the recipe is written; needs_inputs when the recipe is written but a component cannot start without a credential this run has no value for"),components:d.array(sC),suites:d.array(jie).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:d.array(Bt).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:d.array(d.object({input:Bt.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:Bt.describe("what the recipe did with it")})).optional(),inputsNotUsed:d.array(Gie).default([]).describe("the parts it did not use, and why. A part that is wrong goes here, with what was wrong, even when the recipe does something like it instead: one the repositories or the app show is wrong, such as a file, command, port, route or setting that is not there. Something outside them that does not answer is not one: that is a blocker"),blockers:d.array(Lie).describe("required (non-empty) when status is blocked"),inputs:d.array(Mie).max(50).optional().describe("required (non-empty) when status is needs_inputs, else left out: each credential the candidate recipe needs a value for"),environment:Eu.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});var oC=64*1024,aC=512*1024,pj=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var Ri=(r=>(r.Clean="clean",r.RecipeDrift="recipe-drift",r.ChangeBrokeBringup="change-broke-bringup",r.BringupFailed="bringup-failed",r))(Ri||{}),ni=d.string().trim().min(1),Vie=d.object({url:d.string().optional().describe("the URL probed, if the check is an HTTP request"),command:d.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:d.record(d.string()).optional(),status:d.union([d.number(),d.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:ni.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),cC=d.array(d.object({component:ni.describe("a shared component listed above"),url:ni.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:ni.describe("what the URL returned, VERBATIM; this gate FETCHES each url")})).describe("only when shared components are listed above: one check per component whose deployed commit you found"),zie=d.object({name:ni.describe("the credential's environment variable name, as listed above; never its value"),component:ni.describe("the component that refused it"),status:d.number().int().min(400).max(599).optional().describe("the HTTP status it got, such as 401 or 403; leave it out when the refusal was not an HTTP answer"),evidence:ni.describe("the request or command you tested it with and what came back, never the value")}),fj=d.object({schemaVersion:d.literal(1),baseUrls:d.record(d.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:Vie.optional(),teardown:ni.describe("command that tears the SUT down"),dependencies:d.record(d.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:d.nativeEnum(Ri).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:d.array(d.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:d.object({command:ni,output:ni}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:d.array(d.string()).optional().describe("required for change-broke-bringup: files THIS PR changed that the failure points at, relative to your working directory (a file in another checkout of the run: its absolute path)"),seeded:d.boolean(),startedAt:ni.describe("ISO timestamp"),revisions:cC.optional(),missingSecrets:d.array(d.string().regex(Kd)).optional().describe("bringup-failed only: each secret the app cannot start without that this run has no value for, by its environment variable name; never a value"),credentialsRefused:d.array(zie).optional().describe("only for credentials the prompt lists to test: each that was refused when you tested it, such as with a 401 or 403; leave it out when none was, or when none is listed"),recipeRecorded:d.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});var Fj=require("node:crypto");var Ca=(s=>(s.NotFound="not_found",s.NoAccess="no_access",s.Unavailable="unavailable",s.AccessLost="access_lost",s.CannotOpen="cannot_open",s))(Ca||{});var uC=o(e=>`${e.source}:${e.site??""}:${e.key}`,"requirementItemId");var Xd=/^pasted-[0-9a-f]{16}$/,Ks=/^file-[0-9a-f]{16}$/,ep=(r=>(r.Pdf="application/pdf",r.Csv="text/csv",r.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",r.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",r))(ep||{}),tp=o(e=>e.trim().toUpperCase(),"normalKey"),Aj=o((e,t)=>{let n=e.trim();return Xd.test(n.toLowerCase())?"Pasted text":Ks.test(n.toLowerCase())?t?.get(tp(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()},"itemName");var Nh=(i=>(i.New="new",i.Updated="updated",i.Existing="existing",i))(Nh||{}),Qi=(i=>(i.Sufficient="sufficient",i.Insufficient="insufficient",i.NoChange="no_change",i))(Qi||{}),Iu=(I=>(I.RelatedChangeConflict="related_change_conflict",I.ReferenceOutsideTarget="reference_outside_target",I.SourceAccessLost="source_access_lost",I.ConfigurationIncomplete="configuration_incomplete",I.CredentialUnavailable="credential_unavailable",I.WorkflowBindingUnverified="workflow_binding_unverified",I.WorkflowRefUnprotected="workflow_ref_unprotected",I.BedrockWorkflowRequired="bedrock_workflow_required",I.DeploymentReview="deployment_review",I.SutRevisionMismatch="sut_revision_mismatch",I.IsolationUnavailable="isolation_unavailable",I.EvidenceInsufficient="evidence_insufficient",I.ConfigurationUnresolved="configuration_unresolved",I.ModelProviderDenied="model_provider_denied",I.ModelProviderUnavailable="model_provider_unavailable",I.RunnerProviderNotReady="runner_provider_not_ready",I.MergeConflict="merge_conflict",I))(Iu||{}),Xs=(s=>(s.CiCheck="ci_check",s.TestReport="test_report",s.StaticAnalysis="static_analysis",s.CodeReview="code_review",s.Other="other",s))(Xs||{}),np=(i=>(i.Application="application",i.Environment="environment",i.TestDefect="test_defect",i))(np||{}),rp=(c=>(c.AuthToken="auth_token",c.Secret="secret",c.DataConnection="data_connection",c.AppNotStarted="app_not_started",c.Login="login",c.ExternalDependency="external_dependency",c.RecordingReplay="recording_replay",c))(rp||{});var Ph=(n=>(n.Probe="probe",n.Agent="agent",n))(Ph||{}),ip=(i=>(i.Seed="seed",i.RuntimeMock="runtime_mock",i.EnvOverride="env_override",i))(ip||{}),Uh=(i=>(i.TestCode="test_code",i.SkyrampMocker="skyramp_mocker",i.RecipeOverride="recipe_override",i))(Uh||{});var sp=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(sp||{}),xi=d.string().trim().min(1),qie=d.object({case:xi.describe("recommend id this assertion enforces"),evidence:xi.describe("the exact assertion line from the file that checks that case's observable")}),gj=d.object({route:d.literal("persistence"),url:d.string().url()}).strict(),op=d.object({kind:d.nativeEnum(ip).describe("seed: data the test creates in the app; runtime_mock: a mock on a Skyramp worker, which other tests reach too; env_override: an env value the app runs with. A stub inside the test's own process, such as a browser page's route, is none of these"),target:xi.describe("the dependency, endpoint or data it affects"),mechanism:d.nativeEnum(Uh).describe("test_code: the test applies and undoes it; skyramp_mocker: a mock the test applies on a Skyramp worker; recipe_override: the mocker cannot reach the dependency (its URL is fixed in the build)"),detail:xi.describe("what it sets up"),worker:xi.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),safety:gj.optional().describe("shared seed that keeps its data only because the environment permits it: the persistence route and the exact endpoint; Testbot checks the current permission just before it runs the test"),cleanup:xi.optional().describe("seed: when its data can be removed, a command that removes it if the test does not; otherwise declare leftBehind instead. Run as written and without a shell: give real values, not a placeholder such as <id>, single-quote an argument that holds shell syntax, or put the logic in a script in the repository and run that"),leftBehind:xi.optional().describe("seed: the records the test creates and cannot remove from the app, and how to find them")}).refine(e=>!e.leftBehind||e.kind==="seed",{message:"leftBehind is for a seed only: a runtime mock or an env override creates no records",path:["leftBehind"]}),Jie=d.object({file:xi.describe("staged path under .skyramp/staged/"),source:d.nativeEnum(sp),language:xi,covers:d.array(d.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:d.array(qie).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:d.array(op).optional().describe("what the test sets up against the running app, in order: data it seeds, Skyramp mocks it applies, env overrides; omit when none")}),lC=d.object({schemaVersion:d.literal(1),tests:d.array(Jie),deferredUi:d.array(d.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:xi.describe("one paragraph")});var as=(a=>(a.Place="place",a.Update="update",a.Regenerate="regenerate",a.Delete="delete",a.Verify="verify",a.None="none",a))(as||{}),Jn=(i=>(i.Pass="pass",i.Fail="fail",i.Skip="skip",i))(Jn||{}),Bn=d.string().trim().min(1),dC=(r=>(r.Setup="setup",r.Expectation="expectation",r.Locator="locator",r.Other="other",r))(dC||{}),Fh=d.object({kind:d.nativeEnum(dC),reason:Bn.describe("what in the test is wrong, with the evidence: the setup error it raised, or the requirement or changed line its expectation contradicts")}),ap=d.array(d.string().url().max(2048).regex(/^https?:\/\//i)).max(50),hj=d.object({case:Bn.describe("a covers id \u2014 the recommend case this test realizes"),status:d.nativeEnum(Jn),runtimeTargets:ap.optional().describe("HTTP(S) URLs this case actually exercised in its current run; omit for in-process or mocked checks, never infer from test type"),environmentRestriction:Bn.optional().describe("for a skipped case: what this run lacks to execute it; the test is still written"),fromJourney:d.boolean().optional(),testProblem:Fh.optional().describe("[derived] write's reading of a failing case: the test, not the app, is at fault"),defect:d.boolean().optional().describe("[derived] write's reading of a failing case: true when the app is wrong and the test is right"),failure:d.string().optional().describe("[derived] for a failing case: the runner's failure for it, as printed")}).refine(e=>!e.environmentRestriction||e.status==="skip"&&!e.runtimeTargets?.length,{message:"an environment-restricted case must be skipped and have no runtimeTargets"}),mj=d.object({started:d.boolean().optional().describe("with exit null: true if the test command started (it was interrupted or timed out), false if it never started. Left out, Testbot counts it as possibly started, with its cleanup unknown"),exit:d.number({invalid_type_error:"must be a number or null"}).nullable().describe("process exit of the re-run; null when no SUT was available"),details:d.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:d.array(hj).optional().describe("ONE ENTRY PER CASE the file covers, its own result; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one, or the non-test reason in details). The report reads the file by these where they are given")}),yj=d.object({context:d.array(op).optional().describe("[derived] setup declarations retained for every executed test, including maintained tests"),from:d.string().optional().describe("staged path \u2014 required for placements"),file:Bn.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:Bn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:d.nativeEnum(as),covers:d.array(d.string()).optional().describe("recommend ids a placed test covers"),repro:d.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:d.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:d.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:Bn.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:Bn.optional().describe('only for a test marked "runs alone": the command, from its checkout root and without a shell, that runs only this file and writes its JUnit XML into $SKYRAMP_RESULTS_DIR (named by its path: no shell expands it) \u2014 the harness runs it, so leave reran.exit null'),reran:mj,assertionCount:d.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time"),addedOnly:d.boolean().optional().describe("[derived] an existing test file the run only added to: every line it had is still there"),added:d.array(Bn).optional().describe("[derived] the cases of the test functions the run added to an existing file: functions it did not have"),staleOnBase:d.boolean().optional().describe("[derived] an existing test that fails the same way on the base branch: its failure is the test's own")}).refine(e=>e.action!=="place"||typeof e.from=="string"&&e.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),Ej=(n=>(n.Junit="junit",n.Converter="converter",n))(Ej||{}),Hie=Bn.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),Yie=d.object({results:Bn.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:d.nativeEnum(Ej),run:Bn.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:d.array(Bn).min(1).describe("the items[].file paths this run covered"),cases:d.array(d.object({test:Bn.describe("the test's name as the runner reports it, qualified by its class or file (e.g. tests/test_a.py::test_x) when the bare name repeats"),case:Bn.describe("the covers id it realizes"),file:Hie})).describe("map each reported test name to the case it covers")}),Wie=d.object({suites:d.array(Yie).min(1)}),pC=d.object({schemaVersion:d.literal(1),items:d.array(yj),runnerResults:Wie.optional().describe("the JUnit XML your test runs wrote into $SKYRAMP_RESULTS_DIR, so the harness reads each test's result from the runner \u2014 omit only when no SUT is available"),ignored:d.array(d.string()).describe("existing tests assessed and deliberately left untouched"),summary:Bn.describe("one paragraph")});cu();Kw();function Ij(e){return e.toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}o(Ij,"credentialKeyFromRole");var vj=re(require("path"));var sn=d.string().trim().min(1),Oh=sn,fC=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(fC||{}),AC=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],bj=d.object({schemaVersion:d.literal(1),type:d.nativeEnum(fC).optional(),repository:Oh.optional().describe("namespace/name of the source whose checkout the recipe was written and proven in (SKYR-5380); a run replays it from there. Never on a customer_deployed plan"),status:d.enum(["ready","blocked"]),environment:Eu.optional(),components:d.array(d.object({name:sn,repository:sn.describe(`owner/repo, or "${Bi}" for a customer-deployed component no repository builds`),healthy:d.boolean(),url:d.string().min(1).nullable(),...iC,credentials:d.array(d.string().regex(ki)).max(50).optional(),deployed:sn.nullable().optional().describe("customer_deployed only: the revision the component runs, as setup read it (WF-SETUP-22's Deployed now), or null when it could not tell")}).strict()),suites:d.array(d.object({framework:sn,file:sn,result:d.enum(["pass","fail","error"])}).strict()),inputsUsed:d.array(sn),inputsUsedHow:d.array(d.object({input:sn,how:sn}).strict()).optional(),inputsNotUsed:d.array(d.object({input:sn,reason:sn}).strict()),blockers:d.array(d.object({component:sn,problem:sn,evidence:sn,fix:sn}).strict()),replay:d.object({outcome:sn,durationSeconds:d.number().nonnegative().nullable()}).strict().nullable(),files:d.array(d.object({path:sn,content:d.string()}).strict())}).strict().superRefine((e,t)=>{e.inputsUsedHow?.forEach((r,s)=>{e.inputsUsed.includes(r.input)||t.addIssue({code:d.ZodIssueCode.custom,path:["inputsUsedHow",s,"input"],message:"not one of inputsUsed"})}),e.components.forEach((r,s)=>{r.credentials&&new Set(r.credentials).size!==r.credentials.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"credentials"],message:"names a credential twice"})});let n=e.type==="customer_deployed";n!==(e.environment!==void 0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&e.repository!==void 0&&t.addIssue({code:d.ZodIssueCode.custom,path:["repository"],message:"a customer_deployed plan names no repository"}),e.environment&&new Set(e.environment.credentials).size!==e.environment.credentials.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let i=new Set(e.components.map(r=>r.name));if(e.environment?.revisionSources.forEach((r,s)=>{r.components.forEach((a,c)=>{i.has(a)||t.addIssue({code:d.ZodIssueCode.custom,path:["environment","revisionSources",s,"components",c],message:"not one of components"})})}),e.components.forEach((r,s)=>{r.deployed!==void 0!==n&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),r.repository===Bi&&!n&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"repository"],message:`only a customer_deployed component is ${Bi}`})}),n&&(e.components.forEach((r,s)=>{e.components.findIndex(a=>a.name===r.name)!==s&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"name"],message:"names a component twice"})}),e.replay!==null&&t.addIssue({code:d.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),e.files.forEach((r,s)=>{AC.includes(r.path)&&t.addIssue({code:d.ZodIssueCode.custom,path:["files",s,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&e.status==="ready"){let r=new Set(e.environment?.revisionSources.flatMap(s=>s.components));e.components.forEach((s,a)=>{s.repository!==Bi&&!r.has(s.name)&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",a,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var Ske=["clean","recipe-drift"];function cp(e){let t=vj.posix.normalize(e);return t===e&&(t===".skyramp/workspace.yml"||t.startsWith(".skyramp/sut/")&&t.length>13)}o(cp,"isRuntimePlanFile");var vu=d.object({environmentId:d.string().uuid(),allowed:d.boolean(),revision:d.string().uuid(),updatedAt:d.string().datetime(),updatedBy:d.string().uuid()}).strict();function Mh(e,t,n){let i=vu.safeParse(t);return!i.success||!i.data.allowed||!e.environmentId||i.data.environmentId!==e.environmentId||!e.environmentAddress||e.persistentDataPolicy&&e.persistentDataPolicy.revision!==i.data.revision?!1:eo(e.environmentAddress,n)}o(Mh,"persistentDataPolicyApplies");function eo(e,t){try{let n=new URL(t),i=new URL(e);if(i.search||i.hash)return!1;let r=/%(?:2f|5c|2e|25)/i;if(t.includes("\\")||e.includes("\\")||r.test(n.pathname)||r.test(i.pathname))return!1;let s=i.pathname.replace(/\/$/,"");return["https:","http:"].includes(i.protocol)&&n.origin===i.origin&&(n.pathname===s||n.pathname.startsWith(`${s}/`))}catch{return!1}}o(eo,"environmentContainsUrl");var Oj=d.unknown().optional(),Mj={handshake:"/api/v1/runner/runs/:runId/attempts",report:"/api/v1/runner/attempts/:attemptId/report",end:"/api/v1/runner/attempts/:attemptId/end",configuration:"/api/v1/runner/attempts/:attemptId/configuration",progress:"/api/v1/runner/attempts/:attemptId/progress",sutRecipe:"/api/v1/runner/attempts/:attemptId/sut-recipe",runtimePlan:"/api/v1/runner/attempts/:attemptId/runtime-plan",persistentDataPolicy:"/api/v1/runner/attempts/:attemptId/persistent-data-policy",heartbeat:"/api/v1/runner/attempts/:attemptId/heartbeat",setupEvents:"/api/v1/runner/attempts/:attemptId/setup-events",runEvents:"/api/v1/runner/attempts/:attemptId/run-events",requirements:"/api/v1/runner/attempts/:attemptId/requirements",requirementFile:"/api/v1/runner/attempts/:attemptId/requirements/:key/file",deployedRevisions:"/api/v1/runner/attempts/:attemptId/deployed-revisions"},ka=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(ka||{}),qh=(s=>(s.Trigger="TRIGGER",s.Baseline="BASELINE",s.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",s.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",s.ManualOverride="MANUAL_OVERRIDE",s))(qh||{}),Jh=(a=>(a.PullRequest="pull_request",a.ReadyForReview="ready_for_review",a.Schedule="schedule",a.Manual="manual",a.SutSetup="sut_setup",a.RevisionRead="revision_read",a))(Jh||{}),Zie=["sut_setup"],Kie=["sut_setup","schedule","revision_read"],Xie=["sut_setup"],yC=(t=>(t.PullRequest="pull_request",t))(yC||{}),EC=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(EC||{}),wj=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"];var Hh=(r=>(r.None="none",r.Delivered="delivered",r.Partial="partial",r.Failed="failed",r))(Hh||{}),lp=(s=>(s.ReportUploaded="report_uploaded",s.NoReport="no_report",s.Cancelled="cancelled",s.RecipeUploaded="recipe_uploaded",s.RevisionsUploaded="revisions_uploaded",s))(lp||{}),Lj=(n=>(n.Running="running",n.Ended="ended",n))(Lj||{}),dp=(g=>(g.TimedOut="timed_out",g.AgentFailed="agent_failed",g.SetupFailed="setup_failed",g.CredentialMissing="credential_missing",g.RunnerLost="runner_lost",g.CheckoutFailed="checkout_failed",g.EnvironmentUnverified="environment_unverified",g.ModelProviderDenied="model_provider_denied",g.ModelProviderUnavailable="model_provider_unavailable",g.RunnerProviderNotReady="runner_provider_not_ready",g.MergeConflict="merge_conflict",g.EnvironmentUnavailable="environment_unavailable",g))(dp||{}),jj=(i=>(i.Onboard="onboard",i.Deploy="deploy",i.Recheck="recheck",i))(jj||{}),IC=(n=>(n.Started="started",n.Finished="finished",n))(IC||{}),Gj=(i=>(i.Passed="passed",i.Failed="failed",i.Skipped="skipped",i))(Gj||{});var Vj=(i=>(i.ChooseCredential="choose_credential",i.FreeText="free_text",i.ChooseSource="choose_source",i))(Vj||{});var zj=(r=>(r.Answered="answered",r.Followed="followed",r.NotFollowed="not_followed",r.TooLate="too_late",r))(zj||{}),vC=(i=>(i.Discover="discover",i.Start="start",i.Check="check",i))(vC||{}),gC=(r=>(r.ValidationPlan="validation_plan",r.TestEnvironment="test_environment",r.TestConditions="test_conditions",r.Tests="tests",r))(gC||{});var bC=(r=>(r.Found="found",r.Starting="starting",r.Up="up",r.OutOfScope="out_of_scope",r))(bC||{}),Dr=d.string().regex(/^[1-9][0-9]{0,18}$/),_r=d.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),hC=d.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),Cu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function qj(e,t){return`${e.replace(/\/+$/,"")}/runs/${t}`}o(qj,"skyrampRunPageUrl");var yn=d.string().regex(Cu),Rn=d.string().regex(/^[0-9a-f]{64}$/),Vh=d.object({id:yn,revision:Dr}).strict(),Yh={provider:d.literal("github"),providerAccountId:Dr,providerRepositoryId:Dr},Wh={provider:d.literal("azure-devops"),providerAccountId:yn,providerRepositoryId:yn},hr=d.discriminatedUnion("provider",[d.object(Yh).strict(),d.object(Wh).strict()]),wC=d.discriminatedUnion("provider",[d.object(Yh).passthrough(),d.object(Wh).passthrough()]),Ti=o(e=>`${e.provider}:${e.providerRepositoryId}`,"sourceKey"),Cj={namespace:d.string().min(1),name:d.string().min(1)},Jj=d.discriminatedUnion("provider",[d.object({...Yh,...Cj}).strict(),d.object({...Wh,...Cj}).strict()]),Sj=d.object({ref:d.string().min(1),revision:_r}).strict(),ese=d.object({kind:d.nativeEnum(EC),number:Dr.optional(),ref:d.string().min(1),revision:_r,reason:d.nativeEnum(qh)}).strict(),tse=d.object({repository:Jj,revision:_r,ref:d.string().nullable(),reason:d.nativeEnum(qh),change:d.object({kind:d.nativeEnum(yC),number:Dr,base:Sj.optional()}).strict().nullable(),compareWith:Sj.optional(),merge:d.array(ese).min(2).optional()}).strict();function nse(e){let t=e.merge;if(!t)return null;if(e.change||e.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(e.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,i=new Set;for(let[s,a]of t.entries()){if(a.kind==="pull_request"!=(a.number!==void 0))return{path:["merge",s,"number"],message:"a pull request names its number, and a branch none"};if(!wj.includes(a.reason))return{path:["merge",s,"reason"],message:`${a.reason} does not select a merged revision`};if(a.kind==="branch"&&a.reason!=="MANUAL_OVERRIDE")return{path:["merge",s,"reason"],message:"only a person chooses a branch to merge"};if(a.ref===e.ref)return{path:["merge",s,"ref"],message:"the baseline branch is what the source merges onto"};if(a.number!==void 0&&n.has(a.number)||i.has(a.ref))return{path:["merge",s],message:"names a revision the source already merges"};a.number!==void 0&&n.add(a.number),i.add(a.ref)}let r=wj.find(s=>t.some(a=>a.reason===s));return e.reason!==r?{path:["reason"],message:`a source that merges these revisions is ${r}`}:null}o(nse,"mergedSourceIssue");function rse(e){if(e.trigger.kind==="revision_read"!=!e.baseline)return e.baseline?"a revision_read run names no baseline":"names its baseline";if(!e.baseline)return null;let{confirmedRunId:t,initialBaselineId:n,comparisonBaselineId:i,sources:r}=e.baseline;if([t,n,i].filter(l=>l!=null).length>1)return"a run compares with one baseline";let s=e.trigger.kind==="schedule"&&t!==null||n!==void 0||i!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(t===null&&n===void 0&&i===void 0)return"a run with no Confirmed Baseline names no baseline sources";let a=new Set(e.sources.map(l=>Ti(l.repository))),c=new Set(r.map(l=>Ti(l.repository)));return c.size===r.length&&c.size===a.size&&[...c].every(l=>a.has(l))?null:"names every source of the snapshot, once"}o(rse,"baselineSourcesIssue");var Hj=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,Yj=/^[1-9][0-9]{0,18}$/,kj=new RegExp(`${Hj.source}|${Yj.source}`),Bj=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,ise=d.union([d.object({source:d.literal("jira"),site:d.string().regex(Bj),key:d.string().regex(Hj),updated:d.string().datetime(),contentHash:Rn}).strict(),d.object({source:d.literal("confluence"),site:d.string().regex(Bj),key:d.string().regex(Yj),version:d.number().int().positive(),contentHash:Rn}).strict(),d.object({source:d.literal("other"),key:d.string().regex(Xd),contentHash:Rn}).strict(),d.object({source:d.literal("other"),key:d.string().regex(Ks),contentHash:Rn,fileName:d.string().min(1).max(255),mediaType:d.nativeEnum(ep)}).strict()]),Rj=d.union([d.literal("jira"),d.literal("confluence")]),sse=d.object({schemaVersion:d.literal(1),items:d.array(d.union([d.object({source:Rj,site:d.string(),key:d.string().regex(kj),state:d.literal("read"),text:d.string(),version:d.string().min(1),contentMatches:d.boolean()}).strict(),d.object({source:Rj,site:d.string(),key:d.string().regex(kj),state:d.literal("not_read"),reason:d.nativeEnum(Ca)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(Xd),state:d.literal("read"),text:d.string(),version:d.string().min(1),contentMatches:d.boolean()}).strict(),d.object({source:d.literal("other"),key:d.string().regex(Xd),state:d.literal("not_read"),reason:d.nativeEnum(Ca)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(Ks),state:d.literal("read"),version:Rn,fileName:d.string().min(1).max(255),mediaType:d.nativeEnum(ep)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(Ks),state:d.literal("not_read"),reason:d.nativeEnum(Ca)}).strict()])),instructions:d.array(d.string()).optional()}).strict(),ose=d.object({resultId:d.string().min(1),repository:d.string().min(1),testType:d.string().min(1),path:d.string(),finding:d.string().min(1)}).strict(),ase=d.object({schemaVersion:d.literal(1),runId:yn,skyrampOrgId:yn,target:Vh,policy:Vh.nullable(),trigger:d.object({kind:d.nativeEnum(Jh),requestedAt:d.string().datetime()}).strict(),configuration:d.object({captureId:yn,revision:Dr.nullable(),hash:Rn}).strict(),baseline:d.object({confirmedRunId:yn.nullable(),initialBaselineId:yn.optional(),comparisonBaselineId:yn.optional(),knownFailures:d.array(ose).optional(),sources:d.array(d.object({repository:hr,revision:_r}).strict()).optional()}).strict().optional(),sources:d.array(tse).min(1).max(1e3),execution:d.object({provider:d.nativeEnum(ka),repository:Jj,workflowPath:d.string(),ref:d.string()}).strict(),credentials:d.array(d.object({name:d.string(),purpose:d.nativeEnum(Zd),required:d.boolean()}).strict()),requirements:d.array(ise).min(1).optional(),instructions:d.object({contentHash:Rn}).strict().optional(),deployedRevisions:d.array(d.object({repository:hr,revision:_r}).strict()).min(1).optional()}).strict().superRefine((e,t)=>{let n=new Set;(e.requirements??[]).forEach((u,l)=>{let p="fileName"in u?"file":"pasted";u.source==="other"&&u.key!==`${p}-${u.contentHash.slice(0,16)}`&&t.addIssue({code:d.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",l,"key"]});let f=uC({source:u.source,key:u.key});n.has(f)&&t.addIssue({code:d.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",l,"key"]}),n.add(f)});let i=e.trigger.kind,r=Zie.includes(i);r!==(e.policy===null)&&t.addIssue({code:d.ZodIssueCode.custom,path:["policy"],message:r?`a ${i} run has no policy`:"names the policy revision"}),e.baseline?.knownFailures&&!e.baseline.comparisonBaselineId&&t.addIssue({code:d.ZodIssueCode.custom,path:["baseline","knownFailures"],message:"known failures require a chosen comparison checkpoint"});let s=rse(e);s&&t.addIssue({code:d.ZodIssueCode.custom,path:e.baseline?["baseline","sources"]:["baseline"],message:s}),Kie.includes(i)&&e.sources.forEach((u,l)=>{u.reason!=="BASELINE"&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l,"reason"],message:`a ${i} run selects only BASELINE sources`})}),e.deployedRevisions&&i!=="manual"&&t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let a=new Set(e.sources.map(u=>Ti(u.repository))),c=new Set;(e.deployedRevisions??[]).forEach((u,l)=>{let p=Ti(u.repository);a.has(p)?c.has(p)&&t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions",l,"repository"],message:"repository appears twice"}):t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions",l,"repository"],message:"names a repository outside the snapshot"}),c.add(p)}),e.sources.forEach((u,l)=>{u.compareWith&&(u.reason!=="MANUAL_OVERRIDE"||u.change)&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"}),e.baseline?.comparisonBaselineId&&(u.change?.base||u.compareWith||u.merge)&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l],message:"a chosen checkpoint cannot be combined with a source comparison base or merge"});let p=nse(u);p&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l,...p.path],message:p.message})})});var CC=(n=>(n.Person="person",n.Policy="policy",n))(CC||{}),cse=d.object({kind:d.nativeEnum(CC),name:d.string().min(1).max(256)}).strict(),use=d.object({mcp:d.discriminatedUnion("source",[d.object({source:d.literal("npm"),version:d.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),d.object({source:d.literal("github"),ref:d.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:d.object({region:d.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:d.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),lse=d.object({schemaVersion:d.literal(1),attempt:d.object({id:yn,number:d.number().int().positive(),deadlineAt:d.string().datetime()}).strict(),manifest:ase,manifestHash:Rn,entitlements:d.array(d.string()).optional(),runToken:d.string().min(1).optional(),requestedBy:cse.nullable().optional(),writeAllowed:d.boolean().optional(),claudeCodeVersion:d.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:d.array(d.object({repository:hr,revision:_r}).strict()).optional(),statedRevisions:d.array(d.object({repository:hr,revision:_r}).strict()).optional(),runSettings:use.optional()}).strict(),Qj={providerRunAttempt:d.number().int().positive(),workflowRef:d.string().min(1)},dse=d.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),pse=d.object({schemaVersion:d.literal(1),runId:yn,execution:d.discriminatedUnion("provider",[d.object({...Qj,provider:d.literal("github"),repository:d.object(Yh).strict(),providerRunId:Dr}).strict(),d.object({...Qj,provider:d.literal("azure-devops"),repository:d.object(Wh).strict(),providerRunId:dse}).strict()]),requester:d.literal(!0).optional(),writeCheck:d.literal(!0).optional(),claudeCodePin:d.literal(!0).optional(),deployedPins:d.literal(!0).optional(),statedPins:d.literal(!0).optional(),runSettings:d.literal(!0).optional()}).strict(),xj=d.object({repository:hr,number:Dr,commitSha:_r.optional()}).strict(),Lh=d.array(d.object({repository:hr,reason:d.string().max(4096).regex(/\S/)}).strict()).max(1e3).optional(),Wj=d.object({branch:hC.optional(),commitSha:_r.optional()}).strict(),$j=d.object({repository:hr,message:d.string(),...Wj.shape}).strict(),fse=d.discriminatedUnion("status",[d.object({status:d.literal("none"),noTests:Lh}).strict(),d.object({status:d.literal("delivered"),noTests:Lh,pullRequests:d.array(xj).min(1)}).strict(),d.object({status:d.literal("partial"),noTests:Lh,pullRequests:d.array(xj).min(1),failures:d.array($j).min(1)}).strict(),d.object({status:d.literal("failed"),message:d.string(),noTests:Lh,failures:d.array($j).min(1).optional()}).strict()]),Zh=1024*1024,Zj=16*1024*1024,jh=o(e=>d.array(d.object({[e]:d.string()}).strict()).optional(),"texts"),Ase=d.object({language:d.custom(e=>e==="ja","Invalid"),businessCaseAnalysis:d.string(),validation:d.object({rationale:d.string(),gaps:d.array(d.string())}).strict().optional(),changes:d.array(d.object({id:d.string(),text:d.string()}).strict()).optional(),issuesFound:jh("description"),newTestsCreated:jh("description"),testResults:jh("details"),caveats:jh("text")}).strict(),gse=d.object({blockedPreflight:d.object({file:d.string().min(1),repository:d.string().min(1).optional(),reason:d.string().min(1).max(300),evidence:d.string().min(1).max(400)}).strict().optional(),sufficiency:d.nativeEnum(Qi),rationale:d.string().min(1),gaps:d.array(d.string().min(1)),acceptedEvidence:d.array(d.object({kind:d.nativeEnum(Xs),repository:d.string().min(1),revision:_r,reference:d.string().min(1),summary:d.string().min(1)}).strict()),actionRequired:d.array(d.nativeEnum(Iu))}).strict().superRefine((e,t)=>{e.sufficiency==="insufficient"!=e.gaps.length>0&&t.addIssue({code:d.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(e.actionRequired).size!==e.actionRequired.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),Gh=500,Kj=2048,Xj=1e3,hse=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,Tj=o(e=>e.length>0&&e.length<=64&&e===e.trim()&&!hse.test(e)&&!/[^\S ]/u.test(e)&&!/^[._]/.test(e)&&!e.endsWith("."),"isAzureName"),e1=o(e=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!0;let[t,n,i,...r]=e.split("/");return e.length<=201&&r.length===0&&i!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(t)&&Tj(n)&&Tj(i)},"isResultRepository"),mse=d.object({testResults:d.array(d.object({resultId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:d.string().refine(e1,"Invalid"),testType:d.string(),runtimeTargets:ap.optional(),endpoint:d.string(),status:d.enum(["Pass","Fail","Skipped"]),details:d.string(),fileName:d.string().optional(),testId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:d.object({kind:d.nativeEnum(np),family:d.nativeEnum(rp).optional()}).strict().optional(),origin:d.nativeEnum(Nh).optional()}).strict()),validation:gse,changes:d.array(d.object({id:d.string().min(1).max(512),text:d.string().max(16384),source:d.string().max(Kj),testedBy:d.array(d.string().min(1).max(1024)).max(Gh),writtenBy:d.array(d.string().min(1).max(1024)).max(Gh),maintainedBy:d.array(d.string().min(1).max(1024)).max(Gh)}).strict()).max(Xj).optional(),traceVersion:d.literal(1),display:Ase.optional()}).passthrough().superRefine((e,t)=>{let n=e.display,i={issuesFound:e.issuesFound,newTestsCreated:e.newTestsCreated,testResults:e.testResults,caveats:e.caveats};for(let s of["issuesFound","newTestsCreated","testResults","caveats"]){let a=n?.[s];a&&a.length!==(Array.isArray(i[s])?i[s].length:0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["display",s],message:`has not one row per ${s} row`})}n?.validation&&n.validation.gaps.length!==e.validation.gaps.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let r=new Set;e.testResults.forEach((s,a)=>{let c=s.failureCause;c&&s.status==="Pass"&&t.addIssue({code:d.ZodIssueCode.custom,path:["testResults",a,"failureCause"],message:"a passing result has no failure cause"}),c&&c.kind==="environment"!=(c.family!==void 0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["testResults",a,"failureCause"],message:"an environment cause names its family, and no other cause does"});let u=["testResults",a,"resultId"],l=s.resultId.slice(`${s.repository}:${s.testType}:`.length);(!s.resultId.startsWith(`${s.repository}:${s.testType}:`)||l===""||l.startsWith("/")||l.startsWith("#"))&&t.addIssue({code:d.ZodIssueCode.custom,path:u,message:"is not repository:testType:path for this result"}),r.has(s.resultId)&&t.addIssue({code:d.ZodIssueCode.custom,path:u,message:"stable identity repeated"}),r.add(s.resultId)})}),Dj=o(e=>e.replace(/[%:#]/g,t=>encodeURIComponent(t)),"encodeIdPart");function SC(e,t,n,i){let r=n.replace(/\\/g,"/"),s=r.split("/").filter(u=>u!==""&&u!==".");if(r.startsWith("/")||/^[A-Za-z]:/.test(r)||s.length===0||s.includes(".."))throw new Error(`testResultId needs a path relative to the repository root, got "${n}"`);let a=s.join("/"),c=`${e}:${t}:${Dj(a)}`;return i?`${c}#${Dj(i)}`:c}o(SC,"testResultId");var Kh=(i=>(i.BranchPushed="branch_pushed",i.PullRequestOpened="pull_request_opened",i.PullRequestEdited="pull_request_edited",i))(Kh||{}),t1=50,n1=d.discriminatedUnion("kind",[d.object({kind:d.literal("branch_pushed"),repository:hr,branch:hC,commit:_r}).strict(),d.object({kind:d.enum(["pull_request_opened","pull_request_edited"]),repository:hr,number:Dr,branch:hC}).strict()]),r1=d.object({schemaVersion:d.literal(1),run:d.object({runId:yn,attemptNumber:d.number().int().positive(),manifestHash:Rn}).strict(),target:Vh,policy:Vh,provenance:d.object({sources:d.array(d.object({repository:hr,revision:_r}).strict()),firstQualification:d.literal(!0).optional()}).strict(),delivery:d.object({generatedTests:fse}).strict(),producer:d.object({testbot:d.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:d.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:mse,githubWrites:d.array(n1).max(t1).optional()}).strict(),kC=(r=>(r.Recipe="recipe",r.CredentialRejected="credential_rejected",r.Environment="environment",r.Unknown="unknown",r))(kC||{}),BC=200,yse=d.object({cause:d.nativeEnum(kC),credential:d.string().regex(ki).optional(),reason:d.string().trim().min(1).max(BC).optional()}).strict().refine(e=>e.cause==="credential_rejected"==(e.credential!==void 0&&e.reason!==void 0),{message:"a credential_rejected check, and only one, names the credential and why"}),Ese=d.object({name:d.string().regex(ki),purpose:d.enum(["sut_access","other"]),required:d.boolean(),how:d.string().trim().min(1).max(_h)}).strict(),Oke=r1.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:bj,check:yse.optional(),inputs:d.array(Ese).min(1).max(50).optional()}).strict().superRefine(({recipe:e},t)=>{let n=o((s,a)=>t.addIssue({code:d.ZodIssueCode.custom,path:["recipe",...s],message:a}),"issue");e.status==="blocked"&&e.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let i=new Set,r=0;e.files.forEach((s,a)=>{cp(s.path)||n(["files",a,"path"],"is not a file under .skyramp/sut/, or the .skyramp/workspace.yml a recipe stored before SKYR-5829 carries"),i.has(s.path)&&n(["files",a,"path"],"file repeated"),i.add(s.path),pj.test(s.content)&&n(["files",a,"content"],"is not text");let c=Buffer.byteLength(s.content,"utf8");r+=c,c>oC&&n(["files",a,"content"],`larger than ${oC} bytes`)}),r>aC&&n(["files"],`recipe text over ${aC} bytes in total`)}),Mke=d.object({components:d.array(d.object({name:d.string().min(1),repository:d.string().refine(e1,"Invalid"),observedRevision:d.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:d.nativeEnum(Ph),evidence:d.string()}).strict().refine(e=>e.source!=="agent"||e.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();function i1(e){return e.trigger.kind==="schedule"||e.trigger.kind==="manual"&&e.sources.every(t=>t.reason==="BASELINE")}o(i1,"readsDeployedState");var Ise=d.object({schemaVersion:d.literal(1),stage:d.nativeEnum(jj),event:d.nativeEnum(IC),status:d.nativeEnum(Gj).optional()}).strict().refine(e=>e.status===void 0||e.event==="finished",{path:["status"],message:"only a finished stage has a status"}),Xh=100,vse=5e3,Sa=2e3,_j=100,s1=/^[A-Za-z0-9_-]{1,64}$/,bse=20,wse=200,Cse=100,Sse=100,kse=200,Nj="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",Bse=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${Nj}/${Nj})$`),Rse=500,Qse=50,xse=10,$se=/^[A-Za-z0-9](?:[A-Za-z0-9 _-]{0,48}[A-Za-z0-9])?$/,o1=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,gr=o(e=>d.string().max(e).refine(t=>t.trim().length>0&&!o1.test(t),"blank, or not text"),"setupText"),$i={sequence:d.number().int().min(1).max(vse),at:d.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},a1=d.object({...$i,kind:d.literal("reply"),to:d.string().uuid(),outcome:d.nativeEnum(zj),accepted:d.boolean(),text:gr(Sa),note:d.object({source:d.enum(["target","environment"]),quote:gr(Sa)}).strict().optional(),kept:gr(Sa).optional()}).strict();function c1(e,t){if(e.kind!=="reply")return;let n=e;n.accepted!==(n.outcome==="answered"||n.outcome==="followed")&&t.addIssue({code:d.ZodIssueCode.custom,path:["accepted"],message:"accepted exactly when answered or followed"}),n.note&&n.outcome!=="not_followed"&&t.addIssue({code:d.ZodIssueCode.custom,path:["note"],message:"a note only when not_followed"}),n.kept&&n.outcome!=="followed"&&t.addIssue({code:d.ZodIssueCode.custom,path:["kept"],message:"kept only when followed"})}o(c1,"checkReply");var Tse=d.discriminatedUnion("kind",[d.object({...$i,kind:d.literal("log"),phase:d.nativeEnum(vC),text:gr(Sa)}).strict(),d.object({...$i,kind:d.literal("component"),name:gr(_j),repository:gr(kse).refine(e=>Bse.test(e)||e===Bi,"not owner/name"),file:gr(Rse).nullable(),status:d.nativeEnum(bC),version:gr(Sse).optional()}).strict(),a1,d.object({...$i,kind:d.literal("question"),id:d.string().regex(s1),type:d.nativeEnum(Vj),text:gr(Sa),component:gr(_j).nullable(),choices:d.array(gr(wse)).max(bse),placeholder:gr(Cse).optional()}).strict(),d.object({...$i,kind:d.literal("delivered"),ids:d.array(d.string().uuid()).max(Xh)}).strict(),d.object({...$i,kind:d.literal("credentials"),names:d.array(d.string().regex(ki)).min(1).max(Qse),logins:d.array(d.object({key:d.string().regex($se),usernameVariable:d.string().regex(ki),passwordVariable:d.string().regex(ki)}).strict()).min(1).max(xse).optional()}).strict()]).superRefine((e,t)=>{if(c1(e,t),e.kind==="credentials"&&new Set(e.names).size!==e.names.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["names"],message:"a name twice"}),e.kind==="credentials"&&e.logins){let n=e.logins.map(i=>Ij(i.key));new Set(n).size!==n.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["logins"],message:"a key twice"}),e.logins.forEach((i,r)=>{for(let s of["usernameVariable","passwordVariable"])e.names.includes(i[s])||t.addIssue({code:d.ZodIssueCode.custom,path:["logins",r,s],message:"not one of the names"})})}e.kind==="question"&&(e.type==="free_text"!=(e.choices.length===0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(e.choices).size!==e.choices.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),Dse=d.object({schemaVersion:d.literal(1),events:d.array(Tse).max(Xh)}).strict(),_se=d.discriminatedUnion("kind",[d.object({...$i,kind:d.literal("log"),stage:d.nativeEnum(gC),text:gr(Sa)}).strict(),a1,d.object({...$i,kind:d.literal("delivered"),ids:d.array(d.string().uuid()).max(Xh)}).strict(),d.object({...$i,kind:d.literal("stage"),stage:d.nativeEnum(gC),event:d.nativeEnum(IC)}).strict(),d.object({...$i,kind:d.literal("test"),resultId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/),status:d.enum(["Pass","Fail","Skipped"]),details:d.string().max(Sa).refine(e=>!o1.test(e),"not text")}).strict()]).superRefine(c1),Nse=d.object({schemaVersion:d.literal(1),events:d.array(_se).max(Xh)}).strict(),Pj={id:d.string().uuid(),text:d.string(),by:d.string().nullable(),at:d.string(),replied:d.literal(!0).optional()},u1=d.discriminatedUnion("kind",[d.object({...Pj,kind:d.literal("instruction"),question:d.null()}),d.object({...Pj,kind:d.literal("answer"),question:d.string().regex(s1)})]),l1=d.string().regex(/^[A-Za-z0-9+/]{43}=$/),Pse=d.object({id:d.string().uuid(),revision:d.string(),by:d.string().nullable(),at:d.string(),target:d.string(),own:d.object({source:d.enum(["policy","test_environment"]),text:d.string()}).nullable()}),Use=d.object({schemaVersion:d.literal(1),leftOut:d.array(d.string()),messages:d.array(u1).optional(),stop:d.object({key:l1}).optional(),notes:Pse.optional()}),Fse=d.object({schemaVersion:d.literal(1),messages:d.array(u1).optional()});var Ose=500*1024*1024,d1=d.object({id:Dr,name:d.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:Dr,expiresAt:d.string().datetime()}).strict(),Mse=d.object({schemaVersion:d.literal(1),artifact:d1,sessionId:yn,contentHash:Rn,bytes:d.number().int().min(1).max(Ose)}).strict(),Lse=d.object({schemaVersion:d.literal(1),checkpoint:d.object({artifact:d1,repository:d.object({namespace:d.string().min(1),name:d.string().min(1)}).strict(),sessionId:yn,contentHash:Rn,key:l1}).strict().nullable()}).strict(),jse=200,bu=100,p1=(i=>(i.Resume="resume",i.Retry="retry",i.Update="update",i))(p1||{}),Gse=d.object({kind:d.nativeEnum(p1),setup:d.object({runId:yn,endedAt:d.string().nullable(),outcome:d.string().nullable()}).strict(),components:d.array(d.object({name:d.string().min(1),repository:d.string().min(1),status:d.nativeEnum(bC)}).strict()).max(bu),credentials:d.array(d.string().min(1)).max(bu),answers:d.array(d.object({question:d.string(),answer:d.string().nullable()}).strict()).max(bu),instructions:d.array(d.object({text:d.string(),reply:d.string().nullable()}).strict()).max(bu),log:d.array(d.object({phase:d.nativeEnum(vC),text:d.string()}).strict()).max(jse),recipe:d.object({files:d.array(d.object({path:d.string().min(1),content:d.string()}).strict()).max(bu),blockers:d.array(d.object({component:d.string(),problem:d.string(),evidence:d.string(),fix:d.string()}).strict()).max(bu)}).strict().optional()}).strict(),Vse=d.object({schemaVersion:d.literal(1),context:Gse.nullable()}).strict(),zse=d.object({schemaVersion:d.literal(1),configuration:d.object({captureId:yn,revision:Dr.nullable(),hash:Rn}).strict(),capture:d.object({schemaVersion:d.literal(1),settings:d.object({target:d.object({environment:d.unknown()}).passthrough(),timeoutMinutes:d.number().int().positive(),answerWaitMinutes:d.number().int().positive().optional(),testEnvironment:d.object({name:d.string().min(1),address:d.string().min(1).optional(),readyWhen:d.string().min(1).optional(),environmentId:d.string().uuid().optional(),persistentDataPolicy:Oj}).passthrough().optional()}).passthrough(),provenance:d.object({}).passthrough(),hash:Rn}).strict()}).strict(),f1=d.object({schemaVersion:d.literal(1),environmentId:d.string().uuid().nullable(),environmentAddress:d.string().url().nullable(),persistentDataPolicy:vu.nullable()}).strict(),qse=Eu.extend({environmentId:d.string().uuid().optional(),persistentDataPolicy:Oj,version:d.number().int().positive(),components:d.array(d.object({name:d.string().min(1),repository:d.string().min(1)}).strict()),contentHash:Rn.optional(),files:d.array(d.object({path:d.string().refine(e=>cp(e)&&!AC.includes(e),"not a file of a customer_deployed plan"),content:d.string()}).strict()).optional()}).strict(),Jse=d.object({schemaVersion:d.literal(1),testEnvironment:qse.nullable().optional(),runtimePlan:d.object({version:d.number().int().positive(),contentHash:Rn,files:d.array(d.object({path:d.string().refine(cp,"not a recipe file path"),content:d.string()}).strict()).min(1),repository:Oh.optional(),recipeRepository:Oh.optional(),recipe:d.record(d.unknown()).optional()}).strict().nullable()}).strict().refine(e=>!(e.runtimePlan&&e.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),A1=d.object({schemaVersion:d.literal(1),state:d.nativeEnum(Lj),ending:d.nativeEnum(lp).nullable(),cause:d.nativeEnum(dp).nullable(),deadlineAt:d.string().datetime()}).strict();function g1(e,t){return e.state==="ended"?e.ending==="cancelled"?"cancelled":e.cause==="runner_lost"?"expired":"ended":t.getTime()>=Date.parse(e.deadlineAt)?"expired":null}o(g1,"attemptClosure");var h1=50,Lke=d.object({repository:hr,revisions:d.array(d.number().int().nonnegative()).min(1).max(2).refine(e=>e.length<2||e[0]<e[1],"two revisions name the earlier first"),files:d.array(d.string().min(1)).min(1).max(h1)}).strict();function mC(e){if(typeof e=="number"&&!Number.isFinite(e))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(e))return`[${e.map(mC).join(",")}]`;if(e!==null&&typeof e=="object"){let n=e;return`{${Object.keys(n).sort().map(i=>`${JSON.stringify(i)}:${mC(n[i])}`).join(",")}}`}let t=JSON.stringify(e);if(t===void 0)throw new TypeError("Canonical JSON requires JSON values");return t}o(mC,"canonicalJson");function m1(e){return(0,Fj.createHash)("sha256").update(mC(e),"utf8").digest("hex")}o(m1,"manifestHash");var wu=o(e=>({provider:e.provider,providerAccountId:e.providerAccountId,providerRepositoryId:e.providerRepositoryId}),"toSourceRef");function RC(e,t,{statedPins:n=!0}={}){return pse.parse({schemaVersion:1,runId:e,execution:t.execution(),requester:!0,writeCheck:!0,claudeCodePin:!0,deployedPins:!0,...n?{statedPins:!0}:{},...t.runSettingsFromApp?{runSettings:!0}:{}})}o(RC,"handshakeRequest");function y1(e){let t=lse.parse(e);if(m1(t.manifest)!==t.manifestHash)throw new Error("The handshake manifest hash does not match its manifest");return t}o(y1,"parseHandshakeResponse");function Hse(e){let t=o(r=>r.map(s=>({repository:wu(s.repository),number:s.number,...s.commitSha===void 0?{}:{commitSha:s.commitSha}})),"pullRequests"),n=e.noTests?{noTests:e.noTests.map(r=>({repository:wu(r.repository),reason:r.reason}))}:{};if(e.status==="delivered")return{status:e.status,...n,pullRequests:t(e.pullRequests)};let i=o(r=>r.map(s=>({repository:wu(s.repository),message:s.message,...s.branch===void 0?{}:{branch:s.branch},...s.commitSha===void 0?{}:{commitSha:s.commitSha}})),"failures");return e.status==="partial"?{status:e.status,...n,pullRequests:t(e.pullRequests),failures:i(e.failures)}:e.status==="failed"&&e.failures?{...e,...n,failures:i(e.failures)}:{...e,...n}}o(Hse,"toDelivery");function Yse(e){return e.issues.map(t=>`${t.path.map((i,r)=>typeof i=="number"?`[${i}]`:r===0?i:`.${i}`).join("")}: ${t.message}`).join("; ")}o(Yse,"describeIssues");function E1(e){let{manifest:t}=e;if(Xie.includes(t.trigger.kind))throw new Error(`The report upload is invalid: a ${t.trigger.kind} run uploads its SUT recipe, never a report`);if(t.trigger.kind==="revision_read")throw new Error("The report upload is invalid: a revision_read run uploads what each component runs, never a report");if(e.firstQualification&&!t.baseline?.sources)throw new Error("The report upload is invalid: only a run whose manifest names baseline sources can be a first qualification");let n=r1.safeParse({schemaVersion:1,run:{runId:t.runId,attemptNumber:e.attemptNumber,manifestHash:m1(t)},target:{id:t.target.id,revision:t.target.revision},policy:t.policy&&{id:t.policy.id,revision:t.policy.revision},provenance:{sources:e.checkedOut.map(i=>({repository:wu(i.repository),revision:i.revision})),...e.firstQualification?{firstQualification:!0}:{}},delivery:{generatedTests:Hse(e.generatedTests)},producer:e.producer,report:e.report,...e.githubWrites?.length?{githubWrites:e.githubWrites.map(i=>({...i,repository:wu(i.repository)}))}:{}});if(!n.success)throw new Error(`The report upload is invalid: ${Yse(n.error)}`);return Wse(n.data,t,e.checkedOut),n.data}o(E1,"buildReportUpload");function Wse(e,t,n){let i=o(s=>n.find(a=>Ti(a.repository)===Ti(s.repository))?.revision??s.revision,"revisionOf"),r=new Map(t.sources.map(s=>[`${s.repository.namespace}/${s.repository.name}`.toLowerCase(),i(s)]));e.report.validation.acceptedEvidence.forEach((s,a)=>{let c=`report.validation.acceptedEvidence[${a}]`,u=r.get(s.repository.toLowerCase());if(!u)throw new Error(`${c}.repository: ${s.repository} is outside the run's snapshot`);if(s.revision!==u)throw new Error(`${c}.revision: evidence is not from the checked-out revision ${u}`)})}o(Wse,"assertEvidenceFromSnapshot");function I1(e){if(e.reportUploaded)return{schemaVersion:1,reason:"report_uploaded",cause:null};if(e.recipeUploaded)return{schemaVersion:1,reason:"recipe_uploaded",cause:null};if(e.revisionsUploaded)return{schemaVersion:1,reason:"revisions_uploaded",cause:null};let t=e.githubWrites?.length?{githubWrites:e.githubWrites.map(n=>({...n,repository:wu(n.repository)}))}:{};return e.cancelled?{schemaVersion:1,reason:"cancelled",cause:null,...t}:e.mergeConflict&&Uj(e)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:e.mergeConflict,...t}:{schemaVersion:1,reason:"no_report",cause:Uj({...e,mergeConflict:void 0}),...t}}o(I1,"attemptEndFor");function Uj(e){return e.runnerProviderNotReady?"runner_provider_not_ready":e.credentialMissing?"credential_missing":e.mergeConflict?"merge_conflict":e.checkoutFailed?"checkout_failed":e.environmentUnverified?"environment_unverified":e.setupFailed?"setup_failed":e.timedOut?"timed_out":e.modelProviderDenied?"model_provider_denied":e.modelProviderUnavailable?"model_provider_unavailable":"agent_failed"}o(Uj,"noReportCause");var Yke=["clean","recipe-drift"];var to=re(require("path"));var Xke={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var QC=o(e=>new Map((e??[]).flatMap(t=>t.file?[[tp(t.key),t.file.name]]:[])),"itemNames"),Xse=10*1024*1024,eoe=o(e=>e?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||e?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","needsExtraction"),b1=o((e,t)=>to.join(to.dirname(e),`${to.basename(e,to.extname(e))}${t}`),"besideFile"),toe=o(e=>b1(e,".extracted.txt"),"extractedTextPath");var noe=o(e=>b1(e,".quotes.txt"),"confirmedQuotesPath");function w1(e){return eoe(e.file)?toe(e.path):e.file?.mediaType==="application/pdf"?noe(e.path):e.path}o(w1,"itemTextPath");function xt(e){let t=Math.max(0,...(e.match(/`+/g)??[]).map(r=>r.length)),n="`".repeat(t+1),i=e.startsWith("`")||e.endsWith("`")?" ":"";return`${n}${i}${e}${i}${n}`}o(xt,"codeSpan");var C1=re(require("path"));var pp=re(require("fs")),Ba=re(require("path"));var roe=8;function on(e,t,n={}){let i=t.slice(0,roe),r=t.length-i.length;return{name:e,passed:!1,details:i.join("; ")+(r>0?`; \u2026and ${r} more`:""),...n.fatal?{fatal:!0}:{}}}o(on,"fail");function no(e){if(pp.existsSync(e))try{return JSON.parse(pp.readFileSync(e,"utf-8"))}catch{return}}o(no,"readJsonFile");function Be(e,t){return no(Ba.join(e.outputsDir,t))}o(Be,"readArtifact");function Hn(e,t){return{name:e,verify(n,i){let{errors:r}=t(n,i);return r.length===0?{name:this.name,passed:!0}:on(this.name,r,{fatal:!0})}}}o(Hn,"schemaGate");function cs(e,t){return Ba.relative(e,Ba.resolve(e,t)).replace(/\/+$/,"")}o(cs,"relNorm");function fp(e){return e.replace(/\s+/g," ").trim()}o(fp,"normalizeCode");var Ap=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var xC="outputs/preflight.json",Ra="pr-diff.txt",$C="related-diffs";function TC(e){return C1.join($C,`${e.toLowerCase().replace(/\//g,"__").replace(/[^a-z0-9._-]/g,"_")}.diff`)}o(TC,"relatedDiffArtifact");var us=re(require("path"));var gp=re(require("path"));var ro="Skyramp Testbot",Qa="test-bot@skyramp.dev";var Su=o(e=>e.slice(0,12),"shortCommit");var ioe=o((e,t)=>Ot(t,{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim(),"git");function S1(e){let t="";try{t=ioe(e,["remote","get-url","origin"])}catch{}let n=/[:/]([A-Za-z0-9._-]+)\/([A-Za-z0-9._-]+?)(?:\.git)?\/?$/.exec(t);return n&&!t.startsWith("/")&&!t.startsWith(".")?`${n[1]}/${n[2]}`:`local/${gp.basename(gp.resolve(e)).replace(/[^A-Za-z0-9._-]/g,"-")||"repo"}`}o(S1,"repositorySlug");var yBe=new Set(Object.values(Xs));var EBe=d.object({checks:d.array(d.object({repository:d.string().optional(),name:d.string().min(1),headSha:d.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:d.string().default("completed"),conclusion:d.string().nullable().optional(),url:d.string().optional(),summary:d.string().optional()}))});var soe=["generate-unit","native-run"],wBe=["preflight","plan","write",...soe,"report","deliver"];var em=(i=>(i.Unit="unit",i.Integration="integration",i.E2e="e2e",i))(em||{}),ooe=Object.values(em);var k1=8e3,DC=new Map;function coe(e){return e.repositorySlug?e.repositorySlug:(DC.has(e.repositoryPath)||DC.set(e.repositoryPath,S1(e.repositoryPath)),DC.get(e.repositoryPath))}o(coe,"workingSlug");function an(e){return[{slug:coe(e),path:e.repositoryPath,writable:!0,working:!0},...(e.relatedRepos??[]).map(t=>({slug:t.slug,path:t.path,writable:t.writable===!0,working:!1}))]}o(an,"runSources");var Di=o((e,t)=>e.toLowerCase()===t.toLowerCase(),"sameSlug");function tm(e,t){return t?.trim()?e.find(n=>Di(n.slug,t.trim())):e[0]}o(tm,"findSource");function mr(e,t){return tm(an(e),t)}o(mr,"resolveSource");var uoe=o((e,t)=>`${t} is not a repository of this run (${an(e).map(n=>n.slug).join(", ")})`,"notARepository");function io(e,t){let n=mr(e,t);return n?n.writable?{source:n}:{error:`${n.slug} is read-only in this run: tests are written only to ${an(e).filter(i=>i.writable).map(i=>i.slug).join(", ")}`}:{error:uoe(e,t)}}o(io,"writableSource");var _C=o(e=>us.basename(us.resolve(e.path)),"relatedDirName");var UBe={focused:"Focused",impacted_critical:"Impacted and critical",broad:"Broad"};var Bu=o(e=>!!e.inputs?.scheduledValidation?.comparisonBaselineId,"retestsKnownFailures");var Jf=re(require("fs")),Ht=re(require("path"));function Gt(e,t=[]){let n=e.trim();if(!n)return{error:"session produced no output"};let i=o(u=>{try{let l=JSON.parse(u);return typeof l=="object"&&l!==null&&!Array.isArray(l)?l:void 0}catch{return}},"tryParse"),r=i(n);if(r!==void 0)return{value:r};let s;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(u){s=u instanceof Error?u.message:String(u)}let a=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let u=a.length-1;u>=0;u--){let l=i(a[u][1].trim());if(l!==void 0)return{value:l}}let c;for(let u=n.indexOf("{");u!==-1;u=n.indexOf("{",u+1)){let l=0,p=!1,f=!1;for(let g=u;g<n.length;g++){let h=n[g];if(f){f=!1;continue}if(h==="\\"){f=p;continue}if(h==='"'){p=!p;continue}if(!p){if(h==="{")l++;else if(h==="}"&&(l--,l===0)){let m=i(n.slice(u,g+1));m!==void 0&&Object.keys(m).length>0&&(c=m,u=g);break}}}}return s&&(c===void 0||Object.keys(c).length<3)?{error:`final message is not valid JSON \u2014 ${s}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:c!==void 0?{value:c}:s?{error:`final message is not valid JSON \u2014 ${s}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:{error:`no parseable JSON object found in session output \u2014 the final message was: "${doe(ei(n,t))}"`}}o(Gt,"extractJsonObject");var B1=240;function doe(e){let t=e.replace(/\s+/g," ").trim();return t.length<=B1?t:`\u2026${t.slice(-B1)}`}o(doe,"snippetOf");function poe(e){return e.issues.map(t=>{let n=t.path.map(r=>typeof r=="number"?`[${r}]`:`.${r}`).join("").replace(/^\./,""),i=n||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(t.message))return`${i} ${t.message}`;switch(t.code){case"invalid_type":return n?t.expected==="object"?`${i} must be an object`:t.received==="undefined"?`${i} is required`:`${i} must be ${t.expected}, got ${t.received}`:"output is not a JSON object";case"invalid_enum_value":{let r=JSON.stringify(t.received),s=t.options.find(c=>typeof c=="string"&&typeof t.received=="string"&&t.received.startsWith(c)),a=s?` \u2014 you sent ${r}; the value must be exactly ${JSON.stringify(s)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${r}`;return`${i} must be one of: ${t.options.join(", ")}${a}`}case"invalid_literal":return`${i} must be ${JSON.stringify(t.expected)}`;case"too_small":return t.type==="string"?`${i} must be a non-empty string`:`${i} must have at least ${t.minimum} item(s)`;case"unrecognized_keys":return`${i} has unknown key(s): ${t.keys.join(", ")}`;default:return`${i}: ${t.message}`}})}o(poe,"issuesToMessages");function Qn(e,t){let n=e.safeParse(t);if(n.success)return{value:n.data,errors:[]};let i=o((s,a)=>a.reduce((c,u)=>c&&typeof c=="object"?c[u]:void 0,s),"at"),r=n.error.issues.filter(s=>s.path.length&&i(t,s.path)===null);if(r.length===n.error.issues.length)try{let s=e.safeParse(r.reduce((a,{path:c})=>R1(a,c),t));if(s.success)return{value:s.data,errors:[]}}catch{}return{errors:poe(n.error)}}o(Qn,"validateWith");function R1(e,t){if(!t.length||!e||typeof e!="object")return e;let[n,...i]=t,r=Array.isArray(e)?e.slice():{...e};return i.length?r[n]=R1(r[n],i):delete r[n],r}o(R1,"withoutAt");var so=re(require("fs")),yr=re(require("path"));function foe(e){try{return so.lstatSync(e),!0}catch{return!1}}o(foe,"entryExists");function nm(e){let t=yr.resolve(e),n=[];for(;!foe(t);){let r=yr.dirname(t);if(r===t)break;n.unshift(yr.basename(t)),t=r}let i=t;try{i=so.realpathSync(t)}catch{try{so.lstatSync(t).isSymbolicLink()&&(i=yr.resolve(yr.dirname(t),so.readlinkSync(t)))}catch{}}return n.length?yr.join(i,...n):i}o(nm,"realOfExisting");function $a(e){let t=e.split(/[\\/]/)[0];return t===".skyramp"||t===".testbot"}o($a,"inUnshippedFolder");var Q1=String.raw`(?:\[[^\]]*\]|\([^)]*\))`,Aoe=String.raw`(?:["'\u201c\u2018\x60]|\*{1,2})?[^\s:"'\u201c\u201d\u2018\u2019\x60*()[\],]+(?:["'\u201d\u2019\x60]|\*{1,2})?`,x1=String.raw`(?:${Q1}|${Aoe}(?:\s*${Q1})?)`,$1=String.raw`(?:\s*:|\s+[\u2014\u2013-])`,ZBe=new RegExp(String.raw`^\s*(?:${x1}(?:,\s*${x1})*(?::L?\d+(?:[-\u2013]\d+)?${$1}?|${$1})|\[[^\]\s]+\]|\([^)\s]+\))\s+`);var rm=(r=>(r.RestApi="rest-api",r.Frontend="frontend",r.FullStack="full-stack",r.Other="other",r))(rm||{}),Ta=(r=>(r.Critical="critical",r.High="high",r.Medium="medium",r.Low="low",r))(Ta||{}),Da=(i=>(i.Suspected="suspected",i.Latent="latent",i.Refuted="refuted",i))(Da||{}),UC=(i=>(i.Skyramp="skyramp",i.External="external",i.Unknown="unknown",i))(UC||{}),FC=(r=>(r.Cascade="cascade",r.Restrict="restrict",r.Orphan="orphan",r.Unknown="unknown",r))(FC||{}),_i=(r=>(r.RequirementReference="requirement-reference",r.Spec="spec",r.PrDescription="pr-description",r.CouldBreak="could-break",r))(_i||{}),ct=d.string().trim().min(1),Ru=ct.describe("file:line"),T1=o(e=>ct.refine(t=>t.length<=400,t=>({message:`is ${t.length} characters, over the 400 cap \u2014 ${e}`})),"cap400"),hp=ct.optional().describe('multi-repo only: the OTHER checkout this lives in \u2014 its "owner/repo" slug, or the directory name if the run discovered it; omit for the working checkout'),PC=d.object({method:ct,path:ct,service:d.string().optional(),evidence:Ru,repository:hp}),goe=d.object({id:ct.describe("short-slug, e.g. R9"),statement:ct.max(400,"exceeds 400 characters \u2014 state the requirement, do not paste the spec section").describe("a testable obligation, not a summary"),source:d.nativeEnum(_i).describe("spec outranks pr-description when both state it"),evidence:ct.describe("spec: file:line or a section locator. pr-description: the quoted phrase it comes from.")}),hoe=d.object({id:ct.describe("short-slug"),statement:ct.max(400,"exceeds 400 characters \u2014 state the behaviour, do not paste the code").describe("what the change makes true"),surface:ct.describe("METHOD /path, or a component/page name"),evidence:ct.describe("file:line from the diff that introduces it"),repository:hp,satisfies:d.array(ct).optional().describe("requirement ids (from `requirements`) this behaviour correctly implements \u2014 a requirement met only in part is ALSO named by the finding that shows the rest (conflictsWith)")}),moe=d.object({id:ct.describe("short-slug"),file:ct,line:d.number().optional(),claim:T1("shorten it to the one sentence that states the defect, and move the supporting detail into `evidence`"),severity:d.nativeEnum(Ta),evidence:T1("cite the file:line and the one line that shows it, rather than reproducing the surrounding code").describe("quoted diff/code line"),status:d.nativeEnum(Da),repository:hp,conflictsWith:d.array(ct).optional().describe("requirement ids (from `requirements`) this defect contradicts or leaves unimplemented \u2014 a lower-precedence source (the diff, or the PR description) lost")}),yoe=d.object({name:ct,language:d.string().optional(),framework:d.string().optional(),evidence:Ru,repository:hp}),Eoe=d.object({dir:ct,framework:d.string().optional(),kind:d.nativeEnum(UC),evidence:Ru,repository:hp}),Ioe=d.object({from:ct,to:ct,onDelete:d.nativeEnum(FC),evidence:Ru}),voe=d.object({entity:ct,field:ct,values:d.array(d.string()),evidence:Ru}),boe=d.object({entities:d.array(d.object({name:ct,evidence:Ru})),references:d.array(Ioe).describe("INBOUND references \u2014 what still points at an entity when it is deleted"),stateFields:d.array(voe)}),OC=d.object({schemaVersion:d.literal(1),repository:d.object({path:ct.describe("absolute repo path"),currentBranch:ct,baseBranch:ct}),project:d.object({type:d.nativeEnum(rm),primaryLanguage:ct,languages:d.array(d.string()),frameworks:d.array(d.string())}),services:d.array(yoe),infrastructure:d.object({containerized:d.boolean(),hasDockerCompose:d.boolean(),composeFiles:d.array(d.string()),hasCiCd:d.boolean()}),diff:d.object({changedFiles:d.array(d.string()).describe("as git reports them; a file in another checkout may carry that repo's name"),nonApplicationOnly:d.boolean(),summary:ct.describe("\u2264400 chars")}),endpoints:d.object({new:d.array(PC),modified:d.array(PC),removed:d.array(PC)}),existingTests:d.object({locations:d.array(Eoe)}),entityMap:boe,requirements:d.array(goe).describe("from a spec (attached or linked) and/or the PR description; empty when neither states a testable obligation"),behaviors:d.array(hoe),findings:d.array(moe),unexamined:d.array(d.string()).describe("files or areas outside this change you did not open"),summary:ct.describe("one paragraph on what this change does and its test-relevant risk")});var mp=(n=>(n.Full="full",n.Static="static",n))(mp||{}),ri=(i=>(i.Contract="contract",i.Integration="integration",i.Ui="ui",i))(ri||{}),yp=(s=>(s.OwnSurface="own_surface",s.StateReadBack="state_read_back",s.Referential="referential",s.Lifecycle="lifecycle",s.Boundaries="boundaries",s))(yp||{}),Ni=(r=>(r.Update="update",r.Regenerate="regenerate",r.Delete="delete",r.Verify="verify",r))(Ni||{}),im=(l=>(l.Equals="equals",l.NotEquals="not_equals",l.GreaterThan="greater_than",l.LessThan="less_than",l.Contains="contains",l.NotContains="not_contains",l.Matches="matches",l.Absent="absent",l.Present="present",l))(im||{});var Er=d.string().trim().min(1),woe=d.object({subject:Er.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:d.nativeEnum(im),value:d.union([d.string(),d.number(),d.boolean(),d.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),Coe=d.object({test:Er.describe("existing test path, relative to its repository"),repository:Er.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:d.nativeEnum(Ni),evidence:Er.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:d.array(d.string()).optional().describe("analyze behavior ids this maintenance covers"),staleOnBase:d.boolean().optional().describe("[derived] the plan found the test already wrong on the base branch: it is left as it is and re-run")});var Soe=d.object({surface:Er.describe("a surface from the list, copied verbatim"),axis:d.nativeEnum(yp)}),koe=d.object({id:Er.describe("short-slug, unique across generate[]"),type:d.nativeEnum(ri),target:Er.describe('"METHOD /path", or a business-flow name'),from_finding:d.string().optional().describe("analyze finding id this case catches"),from_behavior:d.string().optional().describe("analyze behavior id this case pins"),derived_from:Soe.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:Er.describe("why this test matters"),expected_observable:Er.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:woe.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:Er.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:d.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),Boe=d.object({covered:d.array(d.string()).optional(),abstain:d.string().optional()}).superRefine((e,t)=>{let n=Array.isArray(e.covered),i=typeof e.abstain=="string";if(n===i)return void t.addIssue({code:d.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&e.covered.length===0&&t.addIssue({code:d.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),i&&!e.abstain.trim()&&t.addIssue({code:d.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),Roe=d.object({surface:Er.describe("a surface from the list, copied verbatim"),axes:d.object(Object.fromEntries(Object.values(yp).map(e=>[e,Boe])))}),D1=d.object({schemaVersion:d.literal(1),mode:d.nativeEnum(mp),maintenance:d.array(Coe),generate:d.array(koe),surfaces:d.array(Roe).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:d.object({total:d.number().describe("case count"),rationale:Er}),summary:Er.describe("one paragraph")});var ls=d.string().trim().min(1),ds=72,Qoe=d.object({repository:ls.optional().describe("owner/repo of the checkout this lint ran in, when the run has several; omit for the working checkout"),tool:d.string(),command:d.string().describe("the exact command you ran, scoped to the changed files"),clean:d.boolean(),notRun:d.string().optional().describe("why no linter checked the files, when none could (SKYR-5827): then `clean` is false and does not hold the tests back"),fixed:d.array(d.string()).optional().describe("files you fixed"),uncovered:d.array(d.string()).describe("changed/new files this linter's own config does not match (wrong extension, wrong directory) \u2014 so `clean` never examined them, even though CI may still execute them. Empty array, not omitted, when every changed/new file IS covered.")});var LC=d.object({schemaVersion:d.literal(1),lint:d.array(Qoe).min(1).describe("one entry per checkout this run wrote tests in, each run from that checkout"),fileConventions:d.object({ok:d.boolean(),notes:d.string().optional()}),ciReadiness:d.object({covered:d.boolean().describe("will the repo's CI run these tests?"),notes:d.string().optional(),unrecorded:d.array(d.string()).optional().describe("tests with no record of whether CI runs them: not covered, and not known to be left out")}),dependencies:d.object({added:d.array(d.object({package:d.string(),manifest:d.string(),repository:ls.optional().describe("owner/repo of the manifest's checkout; omit for the working checkout"),reason:ls.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).describe("every package added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own")}),support:d.array(d.object({file:ls,repository:ls.optional().describe("owner/repo of the file's checkout; omit for the working checkout")})).optional().describe("the files the tests need besides themselves (helper modules, page objects, fixtures, snapshots), delivered with them"),commit:d.object({message:ls.refine(e=>e.split(`
|
|
61
|
+
`).map(a=>a.trim()).filter(Boolean),i=n.filter(a=>!t.test(a)),r=i.length?i:n;return[...r].reverse().find(a=>/(error|warning|problem|✖|✗|✘|fail|not listed|cannot|denied)/i.test(a))??r[r.length-1]??"(no output)"}o(Bre,"hookSummary");function ej(e){if(!/\bhook\b|husky|pre-commit|lint-staged/i.test(e))return;let t=Bre(e),n=ae().staged.commitHook(/husky\s*[->]\s*([\w-]+)\s+(?:script|hook)\b/i.exec(Jd(e))?.[1]);return/\(code 127\)|exit code 127/i.test(e)||/command not found|: not found$/i.test(t)?ae().staged.commitHookCouldNotRun(n,t):ae().staged.commitRefusedByHook(n,t)}o(ej,"hookRefusal");var d={};Vr(d,{BRAND:()=>Xre,DIRTY:()=>ca,EMPTY_PATH:()=>$re,INVALID:()=>Ee,NEVER:()=>Uie,OK:()=>mn,ParseStatus:()=>rn,Schema:()=>Ge,ZodAny:()=>Ws,ZodArray:()=>os,ZodBigInt:()=>la,ZodBoolean:()=>da,ZodBranded:()=>Yd,ZodCatch:()=>ba,ZodDate:()=>pa,ZodDefault:()=>va,ZodDiscriminatedUnion:()=>$h,ZodEffects:()=>Tr,ZodEnum:()=>Ea,ZodError:()=>zn,ZodFirstPartyTypeKind:()=>Se,ZodFunction:()=>Dh,ZodIntersection:()=>ha,ZodIssueCode:()=>V,ZodLazy:()=>ma,ZodLiteral:()=>ya,ZodMap:()=>gu,ZodNaN:()=>mu,ZodNativeEnum:()=>Ia,ZodNever:()=>ti,ZodNull:()=>Aa,ZodNullable:()=>Si,ZodNumber:()=>ua,ZodObject:()=>qn,ZodOptional:()=>xr,ZodParsedType:()=>te,ZodPipeline:()=>Wd,ZodPromise:()=>Zs,ZodReadonly:()=>wa,ZodRecord:()=>Th,ZodSchema:()=>Ge,ZodSet:()=>hu,ZodString:()=>Ys,ZodSymbol:()=>fu,ZodTransformer:()=>Tr,ZodTuple:()=>Ci,ZodType:()=>Ge,ZodUndefined:()=>fa,ZodUnion:()=>ga,ZodUnknown:()=>ss,ZodVoid:()=>Au,addIssueToContext:()=>K,any:()=>cie,array:()=>pie,bigint:()=>rie,boolean:()=>dj,coerce:()=>Pie,custom:()=>cj,date:()=>iie,datetimeRegex:()=>oj,defaultErrorMap:()=>rs,discriminatedUnion:()=>hie,effect:()=>Rie,enum:()=>Sie,function:()=>bie,getErrorMap:()=>lu,getParsedType:()=>wi,instanceof:()=>tie,intersection:()=>mie,isAborted:()=>Qh,isAsync:()=>du,isDirty:()=>xh,isValid:()=>Hs,late:()=>eie,lazy:()=>wie,literal:()=>Cie,makeIssue:()=>Hd,map:()=>Iie,nan:()=>nie,nativeEnum:()=>kie,never:()=>lie,null:()=>aie,nullable:()=>xie,number:()=>lj,object:()=>fie,objectUtil:()=>eC,oboolean:()=>Nie,onumber:()=>_ie,optional:()=>Qie,ostring:()=>Die,pipeline:()=>Tie,preprocess:()=>$ie,promise:()=>Bie,quotelessJson:()=>Rre,record:()=>Eie,set:()=>vie,setErrorMap:()=>xre,strictObject:()=>Aie,string:()=>uj,symbol:()=>sie,transformer:()=>Rie,tuple:()=>yie,undefined:()=>oie,union:()=>gie,unknown:()=>uie,util:()=>Ye,void:()=>die});var Ye;(function(e){e.assertEqual=r=>{};function t(r){}o(t,"assertIs"),e.assertIs=t;function n(r){throw new Error}o(n,"assertNever"),e.assertNever=n,e.arrayToEnum=r=>{let s={};for(let a of r)s[a]=a;return s},e.getValidEnumValues=r=>{let s=e.objectKeys(r).filter(c=>typeof r[r[c]]!="number"),a={};for(let c of s)a[c]=r[c];return e.objectValues(a)},e.objectValues=r=>e.objectKeys(r).map(function(s){return r[s]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let s=[];for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&s.push(a);return s},e.find=(r,s)=>{for(let a of r)if(s(a))return a},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,s=" | "){return r.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}o(i,"joinValues"),e.joinValues=i,e.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(Ye||(Ye={}));var eC;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(eC||(eC={}));var te=Ye.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),wi=o(e=>{switch(typeof e){case"undefined":return te.undefined;case"string":return te.string;case"number":return Number.isNaN(e)?te.nan:te.number;case"boolean":return te.boolean;case"function":return te.function;case"bigint":return te.bigint;case"symbol":return te.symbol;case"object":return Array.isArray(e)?te.array:e===null?te.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?te.promise:typeof Map<"u"&&e instanceof Map?te.map:typeof Set<"u"&&e instanceof Set?te.set:typeof Date<"u"&&e instanceof Date?te.date:te.object;default:return te.unknown}},"getParsedType");var V=Ye.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"]),Rre=o(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),zn=class e extends Error{static{o(this,"ZodError")}get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){let n=t||function(s){return s.message},i={_errors:[]},r=o(s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(r);else if(a.code==="invalid_return_type")r(a.returnTypeError);else if(a.code==="invalid_arguments")r(a.argumentsError);else if(a.path.length===0)i._errors.push(n(a));else{let c=i,u=0;for(;u<a.path.length;){let l=a.path[u],p=u===a.path.length-1;if(l==="_errors"){p&&c._errors.push(n(a)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||(l==="__proto__"?Object.defineProperty(c,l,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):c[l]={_errors:[]}),c=c[l],p&&c._errors.push(n(a)),u++}}},"processError");return r(this),i}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ye.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){let n=Object.create(null),i=[];for(let r of this.issues)if(r.path.length>0){let s=r.path[0];n[s]=n[s]||[],n[s].push(t(r))}else i.push(t(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}};zn.create=e=>new zn(e);var Qre=o((e,t)=>{let n;switch(e.code){case V.invalid_type:e.received===te.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case V.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Ye.jsonStringifyReplacer)}`;break;case V.unrecognized_keys:n=`Unrecognized key(s) in object: ${Ye.joinValues(e.keys,", ")}`;break;case V.invalid_union:n="Invalid input";break;case V.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Ye.joinValues(e.options)}`;break;case V.invalid_enum_value:n=`Invalid enum value. Expected ${Ye.joinValues(e.options)}, received '${e.received}'`;break;case V.invalid_arguments:n="Invalid function arguments";break;case V.invalid_return_type:n="Invalid function return type";break;case V.invalid_date:n="Invalid date";break;case V.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Ye.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case V.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case V.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case V.custom:n="Invalid input";break;case V.invalid_intersection_types:n="Intersection results could not be merged";break;case V.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case V.not_finite:n="Number must be finite";break;default:n=t.defaultError,Ye.assertNever(e)}return{message:n}},"errorMap"),rs=Qre;var tj=rs;function xre(e){tj=e}o(xre,"setErrorMap");function lu(){return tj}o(lu,"getErrorMap");var Hd=o(e=>{let{data:t,path:n,errorMaps:i,issueData:r}=e,s=[...n,...r.path||[]],a={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let c="",u=i.filter(l=>!!l).slice().reverse();for(let l of u)c=l(a,{data:t,defaultError:c}).message;return{...r,path:s,message:c}},"makeIssue"),$re=[];function K(e,t){let n=lu(),i=Hd({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===rs?void 0:rs].filter(r=>!!r)});e.common.issues.push(i)}o(K,"addIssueToContext");var rn=class e{static{o(this,"ParseStatus")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){let i=[];for(let r of n){if(r.status==="aborted")return Ee;r.status==="dirty"&&t.dirty(),i.push(r.value)}return{status:t.value,value:i}}static async mergeObjectAsync(t,n){let i=[];for(let r of n){let s=await r.key,a=await r.value;i.push({key:s,value:a})}return e.mergeObjectSync(t,i)}static mergeObjectSync(t,n){let i={};for(let r of n){let{key:s,value:a}=r;if(s.status==="aborted"||a.status==="aborted")return Ee;s.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||r.alwaysSet)&&(i[s.value]=a.value)}return{status:t.value,value:i}}},Ee=Object.freeze({status:"aborted"}),ca=o(e=>({status:"dirty",value:e}),"DIRTY"),mn=o(e=>({status:"valid",value:e}),"OK"),Qh=o(e=>e.status==="aborted","isAborted"),xh=o(e=>e.status==="dirty","isDirty"),Hs=o(e=>e.status==="valid","isValid"),du=o(e=>typeof Promise<"u"&&e instanceof Promise,"isAsync");var le;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(le||(le={}));var $r=class{static{o(this,"ParseInputLazyPath")}constructor(t,n,i,r){this._cachedPath=[],this.parent=t,this.data=n,this._path=i,this._key=r}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}},nj=o((e,t)=>{if(Hs(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let n=new zn(e.common.issues);return this._error=n,this._error}}},"handleResult");function Ue(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:i,description:r}=e;if(t&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:o((a,c)=>{let{message:u}=e;return a.code==="invalid_enum_value"?{message:u??c.defaultError}:typeof c.data>"u"?{message:u??i??c.defaultError}:a.code!=="invalid_type"?{message:c.defaultError}:{message:u??n??c.defaultError}},"customMap"),description:r}}o(Ue,"processCreateParams");var Ge=class{static{o(this,"ZodType")}get description(){return this._def.description}_getType(t){return wi(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:wi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new rn,ctx:{common:t.parent.common,data:t.data,parsedType:wi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let n=this._parse(t);if(du(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){let n=this._parse(t);return Promise.resolve(n)}parse(t,n){let i=this.safeParse(t,n);if(i.success)return i.data;throw i.error}safeParse(t,n){let i={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wi(t)},r=this._parseSync({data:t,path:i.path,parent:i});return nj(i,r)}"~validate"(t){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wi(t)};if(!this["~standard"].async)try{let i=this._parseSync({data:t,path:[],parent:n});return Hs(i)?{value:i.value}:{issues:n.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>Hs(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(t,n){let i=await this.safeParseAsync(t,n);if(i.success)return i.data;throw i.error}async safeParseAsync(t,n){let i={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:wi(t)},r=this._parse({data:t,path:i.path,parent:i}),s=await(du(r)?r:Promise.resolve(r));return nj(i,s)}refine(t,n){let i=o(r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n,"getIssueProperties");return this._refinement((r,s)=>{let a=t(r),c=o(()=>s.addIssue({code:V.custom,...i(r)}),"setError");return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(c(),!1)):a?!0:(c(),!1)})}refinement(t,n){return this._refinement((i,r)=>t(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(t){return new Tr({schema:this,typeName:Se.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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:o(n=>this["~validate"](n),"validate")}}optional(){return xr.create(this,this._def)}nullable(){return Si.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return os.create(this)}promise(){return Zs.create(this,this._def)}or(t){return ga.create([this,t],this._def)}and(t){return ha.create(this,t,this._def)}transform(t){return new Tr({...Ue(this._def),schema:this,typeName:Se.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let n=typeof t=="function"?t:()=>t;return new va({...Ue(this._def),innerType:this,defaultValue:n,typeName:Se.ZodDefault})}brand(){return new Yd({typeName:Se.ZodBranded,type:this,...Ue(this._def)})}catch(t){let n=typeof t=="function"?t:()=>t;return new ba({...Ue(this._def),innerType:this,catchValue:n,typeName:Se.ZodCatch})}describe(t){let n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Wd.create(this,t)}readonly(){return wa.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Tre=/^c[^\s-]{8,}$/i,Dre=/^[0-9a-z]+$/,_re=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nre=/^[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,Pre=/^[a-z0-9_-]{21}$/i,Ure=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Fre=/^[-+]?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)?)??$/,Ore=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Mre="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",tC,Lre=/^(?:(?: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])$/,jre=/^(?:(?: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])$/,Gre=/^(([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]))$/,Vre=/^(([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])$/,zre=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qre=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ij="((\\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])))",Jre=new RegExp(`^${ij}$`);function sj(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}o(sj,"timeRegexSource");function Hre(e){return new RegExp(`^${sj(e)}$`)}o(Hre,"timeRegex");function oj(e){let t=`${ij}T${sj(e)}`,n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}o(oj,"datetimeRegex");function Yre(e,t){return!!((t==="v4"||!t)&&Lre.test(e)||(t==="v6"||!t)&&Gre.test(e))}o(Yre,"isValidIP");function Wre(e,t){if(!Ure.test(e))return!1;try{let[n]=e.split(".");if(!n)return!1;let i=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||t&&r.alg!==t)}catch{return!1}}o(Wre,"isValidJWT");function Zre(e,t){return!!((t==="v4"||!t)&&jre.test(e)||(t==="v6"||!t)&&Vre.test(e))}o(Zre,"isValidCidr");var Ys=class e extends Ge{static{o(this,"ZodString")}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==te.string){let s=this._getOrReturnCtx(t);return K(s,{code:V.invalid_type,expected:te.string,received:s.parsedType}),Ee}let i=new rn,r;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(r=this._getOrReturnCtx(t,r),K(r,{code:V.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="max")t.data.length>s.value&&(r=this._getOrReturnCtx(t,r),K(r,{code:V.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="length"){let a=t.data.length>s.value,c=t.data.length<s.value;(a||c)&&(r=this._getOrReturnCtx(t,r),a?K(r,{code:V.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&K(r,{code:V.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),i.dirty())}else if(s.kind==="email")Ore.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"email",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="emoji")tC||(tC=new RegExp(Mre,"u")),tC.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"emoji",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="uuid")Nre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"uuid",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="nanoid")Pre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"nanoid",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid")Tre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"cuid",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="cuid2")Dre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"cuid2",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="ulid")_re.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"ulid",code:V.invalid_string,message:s.message}),i.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),K(r,{validation:"url",code:V.invalid_string,message:s.message}),i.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"regex",code:V.invalid_string,message:s.message}),i.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(t,r),K(r,{code:V.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),i.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(r=this._getOrReturnCtx(t,r),K(r,{code:V.invalid_string,validation:{startsWith:s.value},message:s.message}),i.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(r=this._getOrReturnCtx(t,r),K(r,{code:V.invalid_string,validation:{endsWith:s.value},message:s.message}),i.dirty()):s.kind==="datetime"?oj(s).test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{code:V.invalid_string,validation:"datetime",message:s.message}),i.dirty()):s.kind==="date"?Jre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{code:V.invalid_string,validation:"date",message:s.message}),i.dirty()):s.kind==="time"?Hre(s).test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{code:V.invalid_string,validation:"time",message:s.message}),i.dirty()):s.kind==="duration"?Fre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"duration",code:V.invalid_string,message:s.message}),i.dirty()):s.kind==="ip"?Yre(t.data,s.version)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"ip",code:V.invalid_string,message:s.message}),i.dirty()):s.kind==="jwt"?Wre(t.data,s.alg)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"jwt",code:V.invalid_string,message:s.message}),i.dirty()):s.kind==="cidr"?Zre(t.data,s.version)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"cidr",code:V.invalid_string,message:s.message}),i.dirty()):s.kind==="base64"?zre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"base64",code:V.invalid_string,message:s.message}),i.dirty()):s.kind==="base64url"?qre.test(t.data)||(r=this._getOrReturnCtx(t,r),K(r,{validation:"base64url",code:V.invalid_string,message:s.message}),i.dirty()):Ye.assertNever(s);return{status:i.value,value:t.data}}_regex(t,n,i){return this.refinement(r=>t.test(r),{validation:n,code:V.invalid_string,...le.errToObj(i)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...le.errToObj(t)})}url(t){return this._addCheck({kind:"url",...le.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...le.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...le.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...le.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...le.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...le.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...le.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...le.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...le.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...le.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...le.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...le.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...le.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...le.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...le.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...le.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...le.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...le.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...le.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...le.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...le.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...le.errToObj(n)})}nonempty(t){return this.min(1,le.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};Ys.create=e=>new Ys({checks:[],typeName:Se.ZodString,coerce:e?.coerce??!1,...Ue(e)});function Kre(e,t){let n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,r=n>i?n:i,s=Number.parseInt(e.toFixed(r).replace(".","")),a=Number.parseInt(t.toFixed(r).replace(".",""));return s%a/10**r}o(Kre,"floatSafeRemainder");var ua=class e extends Ge{static{o(this,"ZodNumber")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==te.number){let s=this._getOrReturnCtx(t);return K(s,{code:V.invalid_type,expected:te.number,received:s.parsedType}),Ee}let i,r=new rn;for(let s of this._def.checks)s.kind==="int"?Ye.isInteger(t.data)||(i=this._getOrReturnCtx(t,i),K(i,{code:V.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(i=this._getOrReturnCtx(t,i),K(i,{code:V.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(i=this._getOrReturnCtx(t,i),K(i,{code:V.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?Kre(t.data,s.value)!==0&&(i=this._getOrReturnCtx(t,i),K(i,{code:V.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(i=this._getOrReturnCtx(t,i),K(i,{code:V.not_finite,message:s.message}),r.dirty()):Ye.assertNever(s);return{status:r.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,le.toString(n))}gt(t,n){return this.setLimit("min",t,!1,le.toString(n))}lte(t,n){return this.setLimit("max",t,!0,le.toString(n))}lt(t,n){return this.setLimit("max",t,!1,le.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:le.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:le.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:le.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:le.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:le.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:le.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:le.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:le.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:le.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:le.toString(t)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Ye.isInteger(t.value))}get isFinite(){let t=null,n=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(t===null||i.value<t)&&(t=i.value)}return Number.isFinite(n)&&Number.isFinite(t)}};ua.create=e=>new ua({checks:[],typeName:Se.ZodNumber,coerce:e?.coerce||!1,...Ue(e)});var la=class e extends Ge{static{o(this,"ZodBigInt")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==te.bigint)return this._getInvalidInput(t);let i,r=new rn;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(i=this._getOrReturnCtx(t,i),K(i,{code:V.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(i=this._getOrReturnCtx(t,i),K(i,{code:V.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(t,i),K(i,{code:V.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):Ye.assertNever(s);return{status:r.value,value:t.data}}_getInvalidInput(t){let n=this._getOrReturnCtx(t);return K(n,{code:V.invalid_type,expected:te.bigint,received:n.parsedType}),Ee}gte(t,n){return this.setLimit("min",t,!0,le.toString(n))}gt(t,n){return this.setLimit("min",t,!1,le.toString(n))}lte(t,n){return this.setLimit("max",t,!0,le.toString(n))}lt(t,n){return this.setLimit("max",t,!1,le.toString(n))}setLimit(t,n,i,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:i,message:le.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:le.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:le.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:le.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:le.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:le.toString(n)})}get minValue(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}};la.create=e=>new la({checks:[],typeName:Se.ZodBigInt,coerce:e?.coerce??!1,...Ue(e)});var da=class extends Ge{static{o(this,"ZodBoolean")}_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==te.boolean){let i=this._getOrReturnCtx(t);return K(i,{code:V.invalid_type,expected:te.boolean,received:i.parsedType}),Ee}return mn(t.data)}};da.create=e=>new da({typeName:Se.ZodBoolean,coerce:e?.coerce||!1,...Ue(e)});var pa=class e extends Ge{static{o(this,"ZodDate")}_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==te.date){let s=this._getOrReturnCtx(t);return K(s,{code:V.invalid_type,expected:te.date,received:s.parsedType}),Ee}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return K(s,{code:V.invalid_date}),Ee}let i=new rn,r;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(r=this._getOrReturnCtx(t,r),K(r,{code:V.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),i.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(r=this._getOrReturnCtx(t,r),K(r,{code:V.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):Ye.assertNever(s);return{status:i.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:le.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:le.toString(n)})}get minDate(){let t=null;for(let n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}};pa.create=e=>new pa({checks:[],coerce:e?.coerce||!1,typeName:Se.ZodDate,...Ue(e)});var fu=class extends Ge{static{o(this,"ZodSymbol")}_parse(t){if(this._getType(t)!==te.symbol){let i=this._getOrReturnCtx(t);return K(i,{code:V.invalid_type,expected:te.symbol,received:i.parsedType}),Ee}return mn(t.data)}};fu.create=e=>new fu({typeName:Se.ZodSymbol,...Ue(e)});var fa=class extends Ge{static{o(this,"ZodUndefined")}_parse(t){if(this._getType(t)!==te.undefined){let i=this._getOrReturnCtx(t);return K(i,{code:V.invalid_type,expected:te.undefined,received:i.parsedType}),Ee}return mn(t.data)}};fa.create=e=>new fa({typeName:Se.ZodUndefined,...Ue(e)});var Aa=class extends Ge{static{o(this,"ZodNull")}_parse(t){if(this._getType(t)!==te.null){let i=this._getOrReturnCtx(t);return K(i,{code:V.invalid_type,expected:te.null,received:i.parsedType}),Ee}return mn(t.data)}};Aa.create=e=>new Aa({typeName:Se.ZodNull,...Ue(e)});var Ws=class extends Ge{static{o(this,"ZodAny")}constructor(){super(...arguments),this._any=!0}_parse(t){return mn(t.data)}};Ws.create=e=>new Ws({typeName:Se.ZodAny,...Ue(e)});var ss=class extends Ge{static{o(this,"ZodUnknown")}constructor(){super(...arguments),this._unknown=!0}_parse(t){return mn(t.data)}};ss.create=e=>new ss({typeName:Se.ZodUnknown,...Ue(e)});var ti=class extends Ge{static{o(this,"ZodNever")}_parse(t){let n=this._getOrReturnCtx(t);return K(n,{code:V.invalid_type,expected:te.never,received:n.parsedType}),Ee}};ti.create=e=>new ti({typeName:Se.ZodNever,...Ue(e)});var Au=class extends Ge{static{o(this,"ZodVoid")}_parse(t){if(this._getType(t)!==te.undefined){let i=this._getOrReturnCtx(t);return K(i,{code:V.invalid_type,expected:te.void,received:i.parsedType}),Ee}return mn(t.data)}};Au.create=e=>new Au({typeName:Se.ZodVoid,...Ue(e)});var os=class e extends Ge{static{o(this,"ZodArray")}_parse(t){let{ctx:n,status:i}=this._processInputParams(t),r=this._def;if(n.parsedType!==te.array)return K(n,{code:V.invalid_type,expected:te.array,received:n.parsedType}),Ee;if(r.exactLength!==null){let a=n.data.length>r.exactLength.value,c=n.data.length<r.exactLength.value;(a||c)&&(K(n,{code:a?V.too_big:V.too_small,minimum:c?r.exactLength.value:void 0,maximum:a?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(K(n,{code:V.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(K(n,{code:V.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((a,c)=>r.type._parseAsync(new $r(n,a,n.path,c)))).then(a=>rn.mergeArray(i,a));let s=[...n.data].map((a,c)=>r.type._parseSync(new $r(n,a,n.path,c)));return rn.mergeArray(i,s)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:le.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:le.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:le.toString(n)}})}nonempty(t){return this.min(1,t)}};os.create=(e,t)=>new os({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Se.ZodArray,...Ue(t)});function pu(e){if(e instanceof qn){let t={};for(let n in e.shape){let i=e.shape[n];t[n]=xr.create(pu(i))}return new qn({...e._def,shape:o(()=>t,"shape")})}else return e instanceof os?new os({...e._def,type:pu(e.element)}):e instanceof xr?xr.create(pu(e.unwrap())):e instanceof Si?Si.create(pu(e.unwrap())):e instanceof Ci?Ci.create(e.items.map(t=>pu(t))):e}o(pu,"deepPartialify");var qn=class e extends Ge{static{o(this,"ZodObject")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=Ye.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==te.object){let l=this._getOrReturnCtx(t);return K(l,{code:V.invalid_type,expected:te.object,received:l.parsedType}),Ee}let{status:i,ctx:r}=this._processInputParams(t),{shape:s,keys:a}=this._getCached(),c=[];if(!(this._def.catchall instanceof ti&&this._def.unknownKeys==="strip"))for(let l in r.data)a.includes(l)||c.push(l);let u=[];for(let l of a){let p=s[l],f=r.data[l];u.push({key:{status:"valid",value:l},value:p._parse(new $r(r,f,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof ti){let l=this._def.unknownKeys;if(l==="passthrough")for(let p of c)u.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(l==="strict")c.length>0&&(K(r,{code:V.unrecognized_keys,keys:c}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let p of c){let f=r.data[p];u.push({key:{status:"valid",value:p},value:l._parse(new $r(r,f,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let l=[];for(let p of u){let f=await p.key,g=await p.value;l.push({key:f,value:g,alwaysSet:p.alwaysSet})}return l}).then(l=>rn.mergeObjectSync(i,l)):rn.mergeObjectSync(i,u)}get shape(){return this._def.shape()}strict(t){return le.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:o((n,i)=>{let r=this._def.errorMap?.(n,i).message??i.defaultError;return n.code==="unrecognized_keys"?{message:le.errToObj(t).message??r}:{message:r}},"errorMap")}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:o(()=>({...this._def.shape(),...t}),"shape")})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:o(()=>({...this._def.shape(),...t._def.shape()}),"shape"),typeName:Se.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let i of Ye.objectKeys(t))t[i]&&this.shape[i]&&(n[i]=this.shape[i]);return new e({...this._def,shape:o(()=>n,"shape")})}omit(t){let n={};for(let i of Ye.objectKeys(this.shape))t[i]||(n[i]=this.shape[i]);return new e({...this._def,shape:o(()=>n,"shape")})}deepPartial(){return pu(this)}partial(t){let n={};for(let i of Ye.objectKeys(this.shape)){let r=this.shape[i];t&&!t[i]?n[i]=r:n[i]=r.optional()}return new e({...this._def,shape:o(()=>n,"shape")})}required(t){let n={};for(let i of Ye.objectKeys(this.shape))if(t&&!t[i])n[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof xr;)s=s._def.innerType;n[i]=s}return new e({...this._def,shape:o(()=>n,"shape")})}keyof(){return aj(Ye.objectKeys(this.shape))}};qn.create=(e,t)=>new qn({shape:o(()=>e,"shape"),unknownKeys:"strip",catchall:ti.create(),typeName:Se.ZodObject,...Ue(t)});qn.strictCreate=(e,t)=>new qn({shape:o(()=>e,"shape"),unknownKeys:"strict",catchall:ti.create(),typeName:Se.ZodObject,...Ue(t)});qn.lazycreate=(e,t)=>new qn({shape:e,unknownKeys:"strip",catchall:ti.create(),typeName:Se.ZodObject,...Ue(t)});var ga=class extends Ge{static{o(this,"ZodUnion")}_parse(t){let{ctx:n}=this._processInputParams(t),i=this._def.options;function r(s){for(let c of s)if(c.result.status==="valid")return c.result;for(let c of s)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;let a=s.map(c=>new zn(c.ctx.common.issues));return K(n,{code:V.invalid_union,unionErrors:a}),Ee}if(o(r,"handleResults"),n.common.async)return Promise.all(i.map(async s=>{let a={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(r);{let s,a=[];for(let u of i){let l={...n,common:{...n.common,issues:[]},parent:null},p=u._parseSync({data:n.data,path:n.path,parent:l});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;let c=a.map(u=>new zn(u));return K(n,{code:V.invalid_union,unionErrors:c}),Ee}}get options(){return this._def.options}};ga.create=(e,t)=>new ga({options:e,typeName:Se.ZodUnion,...Ue(t)});var is=o(e=>e instanceof ma?is(e.schema):e instanceof Tr?is(e.innerType()):e instanceof ya?[e.value]:e instanceof Ea?e.options:e instanceof Ia?Ye.objectValues(e.enum):e instanceof va?is(e._def.innerType):e instanceof fa?[void 0]:e instanceof Aa?[null]:e instanceof xr?[void 0,...is(e.unwrap())]:e instanceof Si?[null,...is(e.unwrap())]:e instanceof Yd||e instanceof wa?is(e.unwrap()):e instanceof ba?is(e._def.innerType):[],"getDiscriminator"),$h=class e extends Ge{static{o(this,"ZodDiscriminatedUnion")}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==te.object)return K(n,{code:V.invalid_type,expected:te.object,received:n.parsedType}),Ee;let i=this.discriminator,r=n.data[i],s=this.optionsMap.get(r);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(K(n,{code:V.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,i){let r=new Map;for(let s of n){let a=is(s.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let c of a){if(r.has(c))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(c)}`);r.set(c,s)}}return new e({typeName:Se.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...Ue(i)})}};function nC(e,t){let n=wi(e),i=wi(t);if(e===t)return{valid:!0,data:e};if(n===te.object&&i===te.object){let r=Ye.objectKeys(t),s=Ye.objectKeys(e).filter(c=>r.indexOf(c)!==-1),a={...e,...t};Object.prototype.hasOwnProperty.call(a,"__proto__")&&delete a.__proto__;for(let c of s){if(c==="__proto__")continue;let u=nC(e[c],t[c]);if(!u.valid)return{valid:!1};a[c]=u.data}return{valid:!0,data:a}}else if(n===te.array&&i===te.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let s=0;s<e.length;s++){let a=e[s],c=t[s],u=nC(a,c);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return n===te.date&&i===te.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}o(nC,"mergeValues");var ha=class extends Ge{static{o(this,"ZodIntersection")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=o((s,a)=>{if(Qh(s)||Qh(a))return Ee;let c=nC(s.value,a.value);return c.valid?((xh(s)||xh(a))&&n.dirty(),{status:n.value,value:c.data}):(K(i,{code:V.invalid_intersection_types}),Ee)},"handleParsed");return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,a])=>r(s,a)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};ha.create=(e,t,n)=>new ha({left:e,right:t,typeName:Se.ZodIntersection,...Ue(n)});var Ci=class e extends Ge{static{o(this,"ZodTuple")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==te.array)return K(i,{code:V.invalid_type,expected:te.array,received:i.parsedType}),Ee;if(i.data.length<this._def.items.length)return K(i,{code:V.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ee;!this._def.rest&&i.data.length>this._def.items.length&&(K(i,{code:V.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let s=[...i.data].map((a,c)=>{let u=this._def.items[c]||this._def.rest;return u?u._parse(new $r(i,a,i.path,c)):null}).filter(a=>!!a);return i.common.async?Promise.all(s).then(a=>rn.mergeArray(n,a)):rn.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ci.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ci({items:e,typeName:Se.ZodTuple,rest:null,...Ue(t)})};var Th=class e extends Ge{static{o(this,"ZodRecord")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==te.object)return K(i,{code:V.invalid_type,expected:te.object,received:i.parsedType}),Ee;let r=[],s=this._def.keyType,a=this._def.valueType;for(let c in i.data)r.push({key:s._parse(new $r(i,c,i.path,c)),value:a._parse(new $r(i,i.data[c],i.path,c)),alwaysSet:c in i.data});return i.common.async?rn.mergeObjectAsync(n,r):rn.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(t,n,i){return n instanceof Ge?new e({keyType:t,valueType:n,typeName:Se.ZodRecord,...Ue(i)}):new e({keyType:Ys.create(),valueType:t,typeName:Se.ZodRecord,...Ue(n)})}},gu=class extends Ge{static{o(this,"ZodMap")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==te.map)return K(i,{code:V.invalid_type,expected:te.map,received:i.parsedType}),Ee;let r=this._def.keyType,s=this._def.valueType,a=[...i.data.entries()].map(([c,u],l)=>({key:r._parse(new $r(i,c,i.path,[l,"key"])),value:s._parse(new $r(i,u,i.path,[l,"value"]))}));if(i.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,p=await u.value;if(l.status==="aborted"||p.status==="aborted")return Ee;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(l.value,p.value)}return{status:n.value,value:c}})}else{let c=new Map;for(let u of a){let l=u.key,p=u.value;if(l.status==="aborted"||p.status==="aborted")return Ee;(l.status==="dirty"||p.status==="dirty")&&n.dirty(),c.set(l.value,p.value)}return{status:n.value,value:c}}}};gu.create=(e,t,n)=>new gu({valueType:t,keyType:e,typeName:Se.ZodMap,...Ue(n)});var hu=class e extends Ge{static{o(this,"ZodSet")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.parsedType!==te.set)return K(i,{code:V.invalid_type,expected:te.set,received:i.parsedType}),Ee;let r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(K(i,{code:V.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(K(i,{code:V.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());let s=this._def.valueType;function a(u){let l=new Set;for(let p of u){if(p.status==="aborted")return Ee;p.status==="dirty"&&n.dirty(),l.add(p.value)}return{status:n.value,value:l}}o(a,"finalizeSet");let c=[...i.data.values()].map((u,l)=>s._parse(new $r(i,u,i.path,l)));return i.common.async?Promise.all(c).then(u=>a(u)):a(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:le.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:le.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}};hu.create=(e,t)=>new hu({valueType:e,minSize:null,maxSize:null,typeName:Se.ZodSet,...Ue(t)});var Dh=class e extends Ge{static{o(this,"ZodFunction")}constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==te.function)return K(n,{code:V.invalid_type,expected:te.function,received:n.parsedType}),Ee;function i(c,u){return Hd({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,lu(),rs].filter(l=>!!l),issueData:{code:V.invalid_arguments,argumentsError:u}})}o(i,"makeArgsIssue");function r(c,u){return Hd({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,lu(),rs].filter(l=>!!l),issueData:{code:V.invalid_return_type,returnTypeError:u}})}o(r,"makeReturnsIssue");let s={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof Zs){let c=this;return mn(async function(...u){let l=new zn([]),p=await c._def.args.parseAsync(u,s).catch(h=>{throw l.addIssue(i(u,h)),l}),f=await Reflect.apply(a,this,p);return await c._def.returns._def.type.parseAsync(f,s).catch(h=>{throw l.addIssue(r(f,h)),l})})}else{let c=this;return mn(function(...u){let l=c._def.args.safeParse(u,s);if(!l.success)throw new zn([i(u,l.error)]);let p=Reflect.apply(a,this,l.data),f=c._def.returns.safeParse(p,s);if(!f.success)throw new zn([r(p,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ci.create(t).rest(ss.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,i){return new e({args:t||Ci.create([]).rest(ss.create()),returns:n||ss.create(),typeName:Se.ZodFunction,...Ue(i)})}},ma=class extends Ge{static{o(this,"ZodLazy")}get schema(){return this._def.getter()}_parse(t){let{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ma.create=(e,t)=>new ma({getter:e,typeName:Se.ZodLazy,...Ue(t)});var ya=class extends Ge{static{o(this,"ZodLiteral")}_parse(t){if(t.data!==this._def.value){let n=this._getOrReturnCtx(t);return K(n,{received:n.data,code:V.invalid_literal,expected:this._def.value}),Ee}return{status:"valid",value:t.data}}get value(){return this._def.value}};ya.create=(e,t)=>new ya({value:e,typeName:Se.ZodLiteral,...Ue(t)});function aj(e,t){return new Ea({values:e,typeName:Se.ZodEnum,...Ue(t)})}o(aj,"createZodEnum");var Ea=class e extends Ge{static{o(this,"ZodEnum")}_parse(t){if(typeof t.data!="string"){let n=this._getOrReturnCtx(t),i=this._def.values;return K(n,{expected:Ye.joinValues(i),received:n.parsedType,code:V.invalid_type}),Ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let n=this._getOrReturnCtx(t),i=this._def.values;return K(n,{received:n.data,code:V.invalid_enum_value,options:i}),Ee}return mn(t.data)}get options(){return this._def.values}get enum(){let t={};for(let n of this._def.values)t[n]=n;return t}get Values(){let t={};for(let n of this._def.values)t[n]=n;return t}get Enum(){let t={};for(let n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(i=>!t.includes(i)),{...this._def,...n})}};Ea.create=aj;var Ia=class extends Ge{static{o(this,"ZodNativeEnum")}_parse(t){let n=Ye.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(t);if(i.parsedType!==te.string&&i.parsedType!==te.number){let r=Ye.objectValues(n);return K(i,{expected:Ye.joinValues(r),received:i.parsedType,code:V.invalid_type}),Ee}if(this._cache||(this._cache=new Set(Ye.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let r=Ye.objectValues(n);return K(i,{received:i.data,code:V.invalid_enum_value,options:r}),Ee}return mn(t.data)}get enum(){return this._def.values}};Ia.create=(e,t)=>new Ia({values:e,typeName:Se.ZodNativeEnum,...Ue(t)});var Zs=class extends Ge{static{o(this,"ZodPromise")}unwrap(){return this._def.type}_parse(t){let{ctx:n}=this._processInputParams(t);if(n.parsedType!==te.promise&&n.common.async===!1)return K(n,{code:V.invalid_type,expected:te.promise,received:n.parsedType}),Ee;let i=n.parsedType===te.promise?n.data:Promise.resolve(n.data);return mn(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}};Zs.create=(e,t)=>new Zs({type:e,typeName:Se.ZodPromise,...Ue(t)});var Tr=class extends Ge{static{o(this,"ZodEffects")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Se.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:i}=this._processInputParams(t),r=this._def.effect||null,s={addIssue:o(a=>{K(i,a),a.fatal?n.abort():n.dirty()},"addIssue"),get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let a=r.transform(i.data,s);if(i.common.async)return Promise.resolve(a).then(async c=>{if(n.value==="aborted")return Ee;let u=await this._def.schema._parseAsync({data:c,path:i.path,parent:i});return u.status==="aborted"?Ee:u.status==="dirty"?ca(u.value):n.value==="dirty"?ca(u.value):u});{if(n.value==="aborted")return Ee;let c=this._def.schema._parseSync({data:a,path:i.path,parent:i});return c.status==="aborted"?Ee:c.status==="dirty"?ca(c.value):n.value==="dirty"?ca(c.value):c}}if(r.type==="refinement"){let a=o(c=>{let u=r.refinement(c,s);if(i.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c},"executeRefinement");if(i.common.async===!1){let c=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return c.status==="aborted"?Ee:(c.status==="dirty"&&n.dirty(),a(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(c=>c.status==="aborted"?Ee:(c.status==="dirty"&&n.dirty(),a(c.value).then(()=>({status:n.value,value:c.value}))))}if(r.type==="transform")if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Hs(a))return Ee;let c=r.transform(a.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>Hs(a)?Promise.resolve(r.transform(a.value,s)).then(c=>({status:n.value,value:c})):Ee);Ye.assertNever(r)}};Tr.create=(e,t,n)=>new Tr({schema:e,typeName:Se.ZodEffects,effect:t,...Ue(n)});Tr.createWithPreprocess=(e,t,n)=>new Tr({schema:t,effect:{type:"preprocess",transform:e},typeName:Se.ZodEffects,...Ue(n)});var xr=class extends Ge{static{o(this,"ZodOptional")}_parse(t){return this._getType(t)===te.undefined?mn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};xr.create=(e,t)=>new xr({innerType:e,typeName:Se.ZodOptional,...Ue(t)});var Si=class extends Ge{static{o(this,"ZodNullable")}_parse(t){return this._getType(t)===te.null?mn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Si.create=(e,t)=>new Si({innerType:e,typeName:Se.ZodNullable,...Ue(t)});var va=class extends Ge{static{o(this,"ZodDefault")}_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return n.parsedType===te.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};va.create=(e,t)=>new va({innerType:e,typeName:Se.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ue(t)});var ba=class extends Ge{static{o(this,"ZodCatch")}_parse(t){let{ctx:n}=this._processInputParams(t),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return du(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new zn(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new zn(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};ba.create=(e,t)=>new ba({innerType:e,typeName:Se.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ue(t)});var mu=class extends Ge{static{o(this,"ZodNaN")}_parse(t){if(this._getType(t)!==te.nan){let i=this._getOrReturnCtx(t);return K(i,{code:V.invalid_type,expected:te.nan,received:i.parsedType}),Ee}return{status:"valid",value:t.data}}};mu.create=e=>new mu({typeName:Se.ZodNaN,...Ue(e)});var Xre=Symbol("zod_brand"),Yd=class extends Ge{static{o(this,"ZodBranded")}_parse(t){let{ctx:n}=this._processInputParams(t),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}},Wd=class e extends Ge{static{o(this,"ZodPipeline")}_parse(t){let{status:n,ctx:i}=this._processInputParams(t);if(i.common.async)return o(async()=>{let s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?Ee:s.status==="dirty"?(n.dirty(),ca(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})},"handleAsync")();{let r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?Ee:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(t,n){return new e({in:t,out:n,typeName:Se.ZodPipeline})}},wa=class extends Ge{static{o(this,"ZodReadonly")}_parse(t){let n=this._def.innerType._parse(t),i=o(r=>(Hs(r)&&(r.value=Object.freeze(r.value)),r),"freeze");return du(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}};wa.create=(e,t)=>new wa({innerType:e,typeName:Se.ZodReadonly,...Ue(t)});function rj(e,t){let n=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof n=="string"?{message:n}:n}o(rj,"cleanParams");function cj(e,t={},n){return e?Ws.create().superRefine((i,r)=>{let s=e(i);if(s instanceof Promise)return s.then(a=>{if(!a){let c=rj(t,i),u=c.fatal??n??!0;r.addIssue({code:"custom",...c,fatal:u})}});if(!s){let a=rj(t,i),c=a.fatal??n??!0;r.addIssue({code:"custom",...a,fatal:c})}}):Ws.create()}o(cj,"custom");var eie={object:qn.lazycreate},Se;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Se||(Se={}));var tie=o((e,t={message:`Input not instance of ${e.name}`})=>cj(n=>n instanceof e,t),"instanceOfType"),uj=Ys.create,lj=ua.create,nie=mu.create,rie=la.create,dj=da.create,iie=pa.create,sie=fu.create,oie=fa.create,aie=Aa.create,cie=Ws.create,uie=ss.create,lie=ti.create,die=Au.create,pie=os.create,fie=qn.create,Aie=qn.strictCreate,gie=ga.create,hie=$h.create,mie=ha.create,yie=Ci.create,Eie=Th.create,Iie=gu.create,vie=hu.create,bie=Dh.create,wie=ma.create,Cie=ya.create,Sie=Ea.create,kie=Ia.create,Bie=Zs.create,Rie=Tr.create,Qie=xr.create,xie=Si.create,$ie=Tr.createWithPreprocess,Tie=Wd.create,Die=o(()=>uj().optional(),"ostring"),_ie=o(()=>lj().optional(),"onumber"),Nie=o(()=>dj().optional(),"oboolean"),Pie={string:o((e=>Ys.create({...e,coerce:!0})),"string"),number:o((e=>ua.create({...e,coerce:!0})),"number"),boolean:o((e=>da.create({...e,coerce:!0})),"boolean"),bigint:o((e=>la.create({...e,coerce:!0})),"bigint"),date:o((e=>pa.create({...e,coerce:!0})),"date")};var Uie=Ee;var Zd=(r=>(r.ModelProvider="model_provider",r.SutAccess="sut_access",r.Skyramp="skyramp",r.Other="other",r))(Zd||{}),rC=(i=>(i.Ready="ready",i.Blocked="blocked",i.NeedsInputs="needs_inputs",i))(rC||{});var _h=300,Bt=d.string().trim().min(1),Fie=d.object({action:d.enum(["start","run","wait"]),text:Bt,source:d.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:Bt.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(e=>e.source==="file"==(e.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),Kd=/^[A-Za-z_][A-Za-z0-9_]*$/,ki=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,yu=(a=>(a.VersionEndpoint="version_endpoint",a.DeployWorkflow="deploy_workflow",a.KubernetesLabels="kubernetes_labels",a.Command="command",a.Api="api",a.NotTracked="not_tracked",a))(yu||{}),Bi="shared",Oie=Bt.refine(e=>{try{let t=new URL(e);return["http:","https:"].includes(t.protocol)&&!t.username&&!t.password}catch{return!1}},"an http(s) URL with no login in it"),Eu=d.object({address:Oie,readyWhen:Bt.nullable(),credentials:d.array(d.string().regex(ki)).max(50),revisionSources:d.array(d.object({method:d.nativeEnum(yu),detail:Bt.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:d.array(Bt).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),iC={steps:d.array(Fie).max(20).optional().describe("how it starts, in order"),kind:d.enum(["web_app","service","database","external_service"]).optional(),from:d.object({file:Bt,service:Bt.nullable()}).strict().optional(),credentials:d.array(d.string().max(100).regex(Kd)).max(50).optional().describe("the Target's credentials this component's recipe uses: a sign-in (a test user, password or token) or an API key, which the workflow supplies from a GitHub Actions secret as the environment variable of the credential's name; give each name exactly as the recipe reads it. Names only, never a value, and not a secret the recipe generates itself")},sC=d.object({name:Bt,repository:Bt.describe("owner/repo of the Target repository the component is built or started from, such as the one whose compose file starts its database"),healthy:d.boolean(),...iC,deployed:Bt.nullable().optional().describe('only with "environment": the revision the component runs, as you read it from its revision source, or null when you could not tell')}),Mie=d.object({name:d.string().regex(ki).describe("the credential's environment variable name, as the recipe reads it and the credentials event names it"),purpose:d.enum(["sut_access","other"]).describe("sut_access: it signs in to or calls the SUT or a service it needs; other: anything else"),required:d.boolean().describe("false only when the SUT starts without it, with less working"),how:Bt.max(_h).describe('one short sentence: what the value is and where a person gets it, such as "A Mattermost Enterprise licence key, from the customer portal"; never a value')}),Lie=d.object({component:Bt,problem:Bt,evidence:Bt.describe("the exact command and output that shows it"),fix:Bt.describe("what the user must provide, and where")}),jie=d.object({framework:Bt,file:Bt.describe("the test file run, relative to its repository root"),result:d.enum(["pass","fail","error"])}),Gie=d.object({input:Bt.describe("the part of the user's SUT input, as given"),reason:Bt}),XSe=d.object({schemaVersion:d.literal(1),status:d.nativeEnum(rC).describe("ready only if every component came up healthy and the recipe is written; needs_inputs when the recipe is written but a component cannot start without a credential this run has no value for"),components:d.array(sC),suites:d.array(jie).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:d.array(Bt).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:d.array(d.object({input:Bt.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:Bt.describe("what the recipe did with it")})).optional(),inputsNotUsed:d.array(Gie).default([]).describe("the parts it did not use, and why. A part that is wrong goes here, with what was wrong, even when the recipe does something like it instead: one the repositories or the app show is wrong, such as a file, command, port, route or setting that is not there. Something outside them that does not answer is not one: that is a blocker"),blockers:d.array(Lie).describe("required (non-empty) when status is blocked"),inputs:d.array(Mie).max(50).optional().describe("required (non-empty) when status is needs_inputs, else left out: each credential the candidate recipe needs a value for"),environment:Eu.optional().describe("only when the whole SUT is an existing deployment you tested where it runs, building and starting nothing: its address, what says it is ready, the credentials that reach it, and how to read what each component runs. Leave it out when any part was built or started on the runner, or reaching it needed something there (a tunnel, port-forward, proxy or client certificate)")});var oC=64*1024,aC=512*1024,pj=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var Ri=(r=>(r.Clean="clean",r.RecipeDrift="recipe-drift",r.ChangeBrokeBringup="change-broke-bringup",r.BringupFailed="bringup-failed",r))(Ri||{}),ni=d.string().trim().min(1),Vie=d.object({url:d.string().optional().describe("the URL probed, if the check is an HTTP request"),command:d.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:d.record(d.string()).optional(),status:d.union([d.number(),d.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:ni.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),cC=d.array(d.object({component:ni.describe("a shared component listed above"),url:ni.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:ni.describe("what the URL returned, VERBATIM; this gate FETCHES each url")})).describe("only when shared components are listed above: one check per component whose deployed commit you found"),zie=d.object({name:ni.describe("the credential's environment variable name, as listed above; never its value"),component:ni.describe("the component that refused it"),status:d.number().int().min(400).max(599).optional().describe("the HTTP status it got, such as 401 or 403; leave it out when the refusal was not an HTTP answer"),evidence:ni.describe("the request or command you tested it with and what came back, never the value")}),fj=d.object({schemaVersion:d.literal(1),baseUrls:d.record(d.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:Vie.optional(),teardown:ni.describe("command that tears the SUT down"),dependencies:d.record(d.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:d.nativeEnum(Ri).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:d.array(d.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:d.object({command:ni,output:ni}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:d.array(d.string()).optional().describe("required for change-broke-bringup: files THIS PR changed that the failure points at, relative to your working directory (a file in another checkout of the run: its absolute path)"),seeded:d.boolean(),startedAt:ni.describe("ISO timestamp"),revisions:cC.optional(),missingSecrets:d.array(d.string().regex(Kd)).optional().describe("bringup-failed only: each secret the app cannot start without that this run has no value for, by its environment variable name; never a value"),credentialsRefused:d.array(zie).optional().describe("only for credentials the prompt lists to test: each that was refused when you tested it, such as with a 401 or 403; leave it out when none was, or when none is listed"),recipeRecorded:d.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});var Fj=require("node:crypto");var Ca=(s=>(s.NotFound="not_found",s.NoAccess="no_access",s.Unavailable="unavailable",s.AccessLost="access_lost",s.CannotOpen="cannot_open",s))(Ca||{});var uC=o(e=>`${e.source}:${e.site??""}:${e.key}`,"requirementItemId");var Xd=/^pasted-[0-9a-f]{16}$/,Ks=/^file-[0-9a-f]{16}$/,ep=(r=>(r.Pdf="application/pdf",r.Csv="text/csv",r.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",r.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",r))(ep||{}),tp=o(e=>e.trim().toUpperCase(),"normalKey"),Aj=o((e,t)=>{let n=e.trim();return Xd.test(n.toLowerCase())?"Pasted text":Ks.test(n.toLowerCase())?t?.get(tp(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()},"itemName");var Nh=(i=>(i.New="new",i.Updated="updated",i.Existing="existing",i))(Nh||{}),Qi=(i=>(i.Sufficient="sufficient",i.Insufficient="insufficient",i.NoChange="no_change",i))(Qi||{}),Iu=(I=>(I.RelatedChangeConflict="related_change_conflict",I.ReferenceOutsideTarget="reference_outside_target",I.SourceAccessLost="source_access_lost",I.ConfigurationIncomplete="configuration_incomplete",I.CredentialUnavailable="credential_unavailable",I.WorkflowBindingUnverified="workflow_binding_unverified",I.WorkflowRefUnprotected="workflow_ref_unprotected",I.BedrockWorkflowRequired="bedrock_workflow_required",I.DeploymentReview="deployment_review",I.SutRevisionMismatch="sut_revision_mismatch",I.IsolationUnavailable="isolation_unavailable",I.EvidenceInsufficient="evidence_insufficient",I.ConfigurationUnresolved="configuration_unresolved",I.ModelProviderDenied="model_provider_denied",I.ModelProviderUnavailable="model_provider_unavailable",I.RunnerProviderNotReady="runner_provider_not_ready",I.MergeConflict="merge_conflict",I))(Iu||{}),Xs=(s=>(s.CiCheck="ci_check",s.TestReport="test_report",s.StaticAnalysis="static_analysis",s.CodeReview="code_review",s.Other="other",s))(Xs||{}),np=(i=>(i.Application="application",i.Environment="environment",i.TestDefect="test_defect",i))(np||{}),rp=(c=>(c.AuthToken="auth_token",c.Secret="secret",c.DataConnection="data_connection",c.AppNotStarted="app_not_started",c.Login="login",c.ExternalDependency="external_dependency",c.RecordingReplay="recording_replay",c))(rp||{});var Ph=(n=>(n.Probe="probe",n.Agent="agent",n))(Ph||{}),ip=(i=>(i.Seed="seed",i.RuntimeMock="runtime_mock",i.EnvOverride="env_override",i))(ip||{}),Uh=(i=>(i.TestCode="test_code",i.SkyrampMocker="skyramp_mocker",i.RecipeOverride="recipe_override",i))(Uh||{});var sp=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(sp||{}),xi=d.string().trim().min(1),qie=d.object({case:xi.describe("recommend id this assertion enforces"),evidence:xi.describe("the exact assertion line from the file that checks that case's observable")}),gj=d.object({route:d.literal("persistence"),url:d.string().url()}).strict(),op=d.object({kind:d.nativeEnum(ip).describe("seed: data the test creates in the app; runtime_mock: a mock on a Skyramp worker, which other tests reach too; env_override: an env value the app runs with. A stub inside the test's own process, such as a browser page's route, is none of these"),target:xi.describe("the dependency, endpoint or data it affects"),mechanism:d.nativeEnum(Uh).describe("test_code: the test applies and undoes it; skyramp_mocker: a mock the test applies on a Skyramp worker; recipe_override: the mocker cannot reach the dependency (its URL is fixed in the build)"),detail:xi.describe("what it sets up"),worker:xi.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),safety:gj.optional().describe("shared seed that keeps its data only because the environment permits it: the persistence route and the exact endpoint; Testbot checks the current permission just before it runs the test"),cleanup:xi.optional().describe("seed: when its data can be removed, a command that removes it if the test does not; otherwise declare leftBehind instead. Run as written and without a shell: give real values, not a placeholder such as <id>, single-quote an argument that holds shell syntax, or put the logic in a script in the repository and run that"),leftBehind:xi.optional().describe("seed: the records the test creates and cannot remove from the app, and how to find them")}).refine(e=>!e.leftBehind||e.kind==="seed",{message:"leftBehind is for a seed only: a runtime mock or an env override creates no records",path:["leftBehind"]}),Jie=d.object({file:xi.describe("staged path under .skyramp/staged/"),source:d.nativeEnum(sp),language:xi,covers:d.array(d.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:d.array(qie).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:d.array(op).optional().describe("what the test sets up against the running app, in order: data it seeds, Skyramp mocks it applies, env overrides; omit when none")}),lC=d.object({schemaVersion:d.literal(1),tests:d.array(Jie),deferredUi:d.array(d.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:xi.describe("one paragraph")});var as=(a=>(a.Place="place",a.Update="update",a.Regenerate="regenerate",a.Delete="delete",a.Verify="verify",a.None="none",a))(as||{}),Jn=(i=>(i.Pass="pass",i.Fail="fail",i.Skip="skip",i))(Jn||{}),Bn=d.string().trim().min(1),dC=(r=>(r.Setup="setup",r.Expectation="expectation",r.Locator="locator",r.Other="other",r))(dC||{}),Fh=d.object({kind:d.nativeEnum(dC),reason:Bn.describe("what in the test is wrong, with the evidence: the setup error it raised, or the requirement or changed line its expectation contradicts")}),ap=d.array(d.string().url().max(2048).regex(/^https?:\/\//i)).max(50),hj=d.object({case:Bn.describe("a covers id \u2014 the recommend case this test realizes"),status:d.nativeEnum(Jn),runtimeTargets:ap.optional().describe("HTTP(S) URLs this case actually exercised in its current run; omit for in-process or mocked checks, never infer from test type"),environmentRestriction:Bn.optional().describe("for a skipped case: what this run lacks to execute it; the test is still written"),fromJourney:d.boolean().optional(),testProblem:Fh.optional().describe("[derived] write's reading of a failing case: the test, not the app, is at fault"),defect:d.boolean().optional().describe("[derived] write's reading of a failing case: true when the app is wrong and the test is right"),failure:d.string().optional().describe("[derived] for a failing case: the runner's failure for it, as printed")}).refine(e=>!e.environmentRestriction||e.status==="skip"&&!e.runtimeTargets?.length,{message:"an environment-restricted case must be skipped and have no runtimeTargets"}),mj=d.object({started:d.boolean().optional().describe("with exit null: true if the test command started (it was interrupted or timed out), false if it never started. Left out, Testbot counts it as possibly started, with its cleanup unknown"),exit:d.number({invalid_type_error:"must be a number or null"}).nullable().describe("process exit of the re-run; null when no SUT was available"),details:d.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:d.array(hj).optional().describe("ONE ENTRY PER CASE the file covers, its own result; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one, or the non-test reason in details). The report reads the file by these where they are given")}),yj=d.object({context:d.array(op).optional().describe("[derived] setup declarations retained for every executed test, including maintained tests"),from:d.string().optional().describe("staged path \u2014 required for placements"),file:Bn.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:Bn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:d.nativeEnum(as),covers:d.array(d.string()).optional().describe("recommend ids a placed test covers"),repro:d.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:d.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:d.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:Bn.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:Bn.optional().describe('only for a test marked "runs alone": the command, from its checkout root and without a shell, that runs only this file and writes its JUnit XML into $SKYRAMP_RESULTS_DIR (named by its path: no shell expands it) \u2014 the harness runs it, so leave reran.exit null'),reran:mj,assertionCount:d.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time"),addedOnly:d.boolean().optional().describe("[derived] an existing test file the run only added to: every line it had is still there"),added:d.array(Bn).optional().describe("[derived] the cases of the test functions the run added to an existing file: functions it did not have"),staleOnBase:d.boolean().optional().describe("[derived] an existing test that fails the same way on the base branch: its failure is the test's own")}).refine(e=>e.action!=="place"||typeof e.from=="string"&&e.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),Ej=(n=>(n.Junit="junit",n.Converter="converter",n))(Ej||{}),Hie=Bn.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),Yie=d.object({results:Bn.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:d.nativeEnum(Ej),run:Bn.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:d.array(Bn).min(1).describe("the items[].file paths this run covered"),cases:d.array(d.object({test:Bn.describe("the test's name as the runner reports it, qualified by its class or file (e.g. tests/test_a.py::test_x) when the bare name repeats"),case:Bn.describe("the covers id it realizes"),file:Hie})).describe("map each reported test name to the case it covers")}),Wie=d.object({suites:d.array(Yie).min(1)}),pC=d.object({schemaVersion:d.literal(1),items:d.array(yj),runnerResults:Wie.optional().describe("the JUnit XML your test runs wrote into $SKYRAMP_RESULTS_DIR, so the harness reads each test's result from the runner \u2014 omit only when no SUT is available"),ignored:d.array(d.string()).describe("existing tests assessed and deliberately left untouched"),summary:Bn.describe("one paragraph")});cu();Kw();function Ij(e){return e.toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"")}o(Ij,"credentialKeyFromRole");var vj=re(require("path"));var sn=d.string().trim().min(1),Oh=sn,fC=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(fC||{}),AC=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],bj=d.object({schemaVersion:d.literal(1),type:d.nativeEnum(fC).optional(),repository:Oh.optional().describe("namespace/name of the source whose checkout the recipe was written and proven in (SKYR-5380); a run replays it from there. Never on a customer_deployed plan"),status:d.enum(["ready","blocked"]),environment:Eu.optional(),components:d.array(d.object({name:sn,repository:sn.describe(`owner/repo, or "${Bi}" for a customer-deployed component no repository builds`),healthy:d.boolean(),url:d.string().min(1).nullable(),...iC,credentials:d.array(d.string().regex(ki)).max(50).optional(),deployed:sn.nullable().optional().describe("customer_deployed only: the revision the component runs, as setup read it (WF-SETUP-22's Deployed now), or null when it could not tell")}).strict()),suites:d.array(d.object({framework:sn,file:sn,result:d.enum(["pass","fail","error"])}).strict()),inputsUsed:d.array(sn),inputsUsedHow:d.array(d.object({input:sn,how:sn}).strict()).optional(),inputsNotUsed:d.array(d.object({input:sn,reason:sn}).strict()),blockers:d.array(d.object({component:sn,problem:sn,evidence:sn,fix:sn}).strict()),replay:d.object({outcome:sn,durationSeconds:d.number().nonnegative().nullable()}).strict().nullable(),files:d.array(d.object({path:sn,content:d.string()}).strict())}).strict().superRefine((e,t)=>{e.inputsUsedHow?.forEach((r,s)=>{e.inputsUsed.includes(r.input)||t.addIssue({code:d.ZodIssueCode.custom,path:["inputsUsedHow",s,"input"],message:"not one of inputsUsed"})}),e.components.forEach((r,s)=>{r.credentials&&new Set(r.credentials).size!==r.credentials.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"credentials"],message:"names a credential twice"})});let n=e.type==="customer_deployed";n!==(e.environment!==void 0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&e.repository!==void 0&&t.addIssue({code:d.ZodIssueCode.custom,path:["repository"],message:"a customer_deployed plan names no repository"}),e.environment&&new Set(e.environment.credentials).size!==e.environment.credentials.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let i=new Set(e.components.map(r=>r.name));if(e.environment?.revisionSources.forEach((r,s)=>{r.components.forEach((a,c)=>{i.has(a)||t.addIssue({code:d.ZodIssueCode.custom,path:["environment","revisionSources",s,"components",c],message:"not one of components"})})}),e.components.forEach((r,s)=>{r.deployed!==void 0!==n&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),r.repository===Bi&&!n&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"repository"],message:`only a customer_deployed component is ${Bi}`})}),n&&(e.components.forEach((r,s)=>{e.components.findIndex(a=>a.name===r.name)!==s&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",s,"name"],message:"names a component twice"})}),e.replay!==null&&t.addIssue({code:d.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),e.files.forEach((r,s)=>{AC.includes(r.path)&&t.addIssue({code:d.ZodIssueCode.custom,path:["files",s,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&e.status==="ready"){let r=new Set(e.environment?.revisionSources.flatMap(s=>s.components));e.components.forEach((s,a)=>{s.repository!==Bi&&!r.has(s.name)&&t.addIssue({code:d.ZodIssueCode.custom,path:["components",a,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var Ske=["clean","recipe-drift"];function cp(e){let t=vj.posix.normalize(e);return t===e&&(t===".skyramp/workspace.yml"||t.startsWith(".skyramp/sut/")&&t.length>13)}o(cp,"isRuntimePlanFile");var vu=d.object({environmentId:d.string().uuid(),allowed:d.boolean(),revision:d.string().uuid(),updatedAt:d.string().datetime(),updatedBy:d.string().uuid()}).strict();function Mh(e,t,n){let i=vu.safeParse(t);return!i.success||!i.data.allowed||!e.environmentId||i.data.environmentId!==e.environmentId||!e.environmentAddress||e.persistentDataPolicy&&e.persistentDataPolicy.revision!==i.data.revision?!1:eo(e.environmentAddress,n)}o(Mh,"persistentDataPolicyApplies");function eo(e,t){try{let n=new URL(t),i=new URL(e);if(i.search||i.hash)return!1;let r=/%(?:2f|5c|2e|25)/i;if(t.includes("\\")||e.includes("\\")||r.test(n.pathname)||r.test(i.pathname))return!1;let s=i.pathname.replace(/\/$/,"");return["https:","http:"].includes(i.protocol)&&n.origin===i.origin&&(n.pathname===s||n.pathname.startsWith(`${s}/`))}catch{return!1}}o(eo,"environmentContainsUrl");var Oj=d.unknown().optional(),Mj={handshake:"/api/v1/runner/runs/:runId/attempts",report:"/api/v1/runner/attempts/:attemptId/report",end:"/api/v1/runner/attempts/:attemptId/end",configuration:"/api/v1/runner/attempts/:attemptId/configuration",progress:"/api/v1/runner/attempts/:attemptId/progress",sutRecipe:"/api/v1/runner/attempts/:attemptId/sut-recipe",runtimePlan:"/api/v1/runner/attempts/:attemptId/runtime-plan",persistentDataPolicy:"/api/v1/runner/attempts/:attemptId/persistent-data-policy",heartbeat:"/api/v1/runner/attempts/:attemptId/heartbeat",setupEvents:"/api/v1/runner/attempts/:attemptId/setup-events",runEvents:"/api/v1/runner/attempts/:attemptId/run-events",requirements:"/api/v1/runner/attempts/:attemptId/requirements",requirementFile:"/api/v1/runner/attempts/:attemptId/requirements/:key/file",deployedRevisions:"/api/v1/runner/attempts/:attemptId/deployed-revisions"},ka=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(ka||{}),qh=(s=>(s.Trigger="TRIGGER",s.Baseline="BASELINE",s.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",s.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",s.ManualOverride="MANUAL_OVERRIDE",s))(qh||{}),Jh=(a=>(a.PullRequest="pull_request",a.ReadyForReview="ready_for_review",a.Schedule="schedule",a.Manual="manual",a.SutSetup="sut_setup",a.RevisionRead="revision_read",a))(Jh||{}),Zie=["sut_setup"],Kie=["sut_setup","schedule","revision_read"],Xie=["sut_setup"],yC=(t=>(t.PullRequest="pull_request",t))(yC||{}),EC=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(EC||{}),wj=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"];var Hh=(r=>(r.None="none",r.Delivered="delivered",r.Partial="partial",r.Failed="failed",r))(Hh||{}),lp=(s=>(s.ReportUploaded="report_uploaded",s.NoReport="no_report",s.Cancelled="cancelled",s.RecipeUploaded="recipe_uploaded",s.RevisionsUploaded="revisions_uploaded",s))(lp||{}),Lj=(n=>(n.Running="running",n.Ended="ended",n))(Lj||{}),dp=(g=>(g.TimedOut="timed_out",g.AgentFailed="agent_failed",g.SetupFailed="setup_failed",g.CredentialMissing="credential_missing",g.RunnerLost="runner_lost",g.CheckoutFailed="checkout_failed",g.EnvironmentUnverified="environment_unverified",g.ModelProviderDenied="model_provider_denied",g.ModelProviderUnavailable="model_provider_unavailable",g.RunnerProviderNotReady="runner_provider_not_ready",g.MergeConflict="merge_conflict",g.EnvironmentUnavailable="environment_unavailable",g))(dp||{}),jj=(i=>(i.Onboard="onboard",i.Deploy="deploy",i.Recheck="recheck",i))(jj||{}),IC=(n=>(n.Started="started",n.Finished="finished",n))(IC||{}),Gj=(i=>(i.Passed="passed",i.Failed="failed",i.Skipped="skipped",i))(Gj||{});var Vj=(i=>(i.ChooseCredential="choose_credential",i.FreeText="free_text",i.ChooseSource="choose_source",i))(Vj||{});var zj=(r=>(r.Answered="answered",r.Followed="followed",r.NotFollowed="not_followed",r.TooLate="too_late",r))(zj||{}),vC=(i=>(i.Discover="discover",i.Start="start",i.Check="check",i))(vC||{}),gC=(r=>(r.ValidationPlan="validation_plan",r.TestEnvironment="test_environment",r.TestConditions="test_conditions",r.Tests="tests",r))(gC||{});var bC=(r=>(r.Found="found",r.Starting="starting",r.Up="up",r.OutOfScope="out_of_scope",r))(bC||{}),Dr=d.string().regex(/^[1-9][0-9]{0,18}$/),_r=d.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),hC=d.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),Cu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function qj(e,t){return`${e.replace(/\/+$/,"")}/runs/${t}`}o(qj,"skyrampRunPageUrl");var yn=d.string().regex(Cu),Rn=d.string().regex(/^[0-9a-f]{64}$/),Vh=d.object({id:yn,revision:Dr}).strict(),Yh={provider:d.literal("github"),providerAccountId:Dr,providerRepositoryId:Dr},Wh={provider:d.literal("azure-devops"),providerAccountId:yn,providerRepositoryId:yn},hr=d.discriminatedUnion("provider",[d.object(Yh).strict(),d.object(Wh).strict()]),wC=d.discriminatedUnion("provider",[d.object(Yh).passthrough(),d.object(Wh).passthrough()]),Ti=o(e=>`${e.provider}:${e.providerRepositoryId}`,"sourceKey"),Cj={namespace:d.string().min(1),name:d.string().min(1)},Jj=d.discriminatedUnion("provider",[d.object({...Yh,...Cj}).strict(),d.object({...Wh,...Cj}).strict()]),Sj=d.object({ref:d.string().min(1),revision:_r}).strict(),ese=d.object({kind:d.nativeEnum(EC),number:Dr.optional(),ref:d.string().min(1),revision:_r,reason:d.nativeEnum(qh)}).strict(),tse=d.object({repository:Jj,revision:_r,ref:d.string().nullable(),reason:d.nativeEnum(qh),change:d.object({kind:d.nativeEnum(yC),number:Dr,base:Sj.optional()}).strict().nullable(),compareWith:Sj.optional(),merge:d.array(ese).min(2).optional()}).strict();function nse(e){let t=e.merge;if(!t)return null;if(e.change||e.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(e.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,i=new Set;for(let[s,a]of t.entries()){if(a.kind==="pull_request"!=(a.number!==void 0))return{path:["merge",s,"number"],message:"a pull request names its number, and a branch none"};if(!wj.includes(a.reason))return{path:["merge",s,"reason"],message:`${a.reason} does not select a merged revision`};if(a.kind==="branch"&&a.reason!=="MANUAL_OVERRIDE")return{path:["merge",s,"reason"],message:"only a person chooses a branch to merge"};if(a.ref===e.ref)return{path:["merge",s,"ref"],message:"the baseline branch is what the source merges onto"};if(a.number!==void 0&&n.has(a.number)||i.has(a.ref))return{path:["merge",s],message:"names a revision the source already merges"};a.number!==void 0&&n.add(a.number),i.add(a.ref)}let r=wj.find(s=>t.some(a=>a.reason===s));return e.reason!==r?{path:["reason"],message:`a source that merges these revisions is ${r}`}:null}o(nse,"mergedSourceIssue");function rse(e){if(e.trigger.kind==="revision_read"!=!e.baseline)return e.baseline?"a revision_read run names no baseline":"names its baseline";if(!e.baseline)return null;let{confirmedRunId:t,initialBaselineId:n,comparisonBaselineId:i,sources:r}=e.baseline;if([t,n,i].filter(l=>l!=null).length>1)return"a run compares with one baseline";let s=e.trigger.kind==="schedule"&&t!==null||n!==void 0||i!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(t===null&&n===void 0&&i===void 0)return"a run with no Confirmed Baseline names no baseline sources";let a=new Set(e.sources.map(l=>Ti(l.repository))),c=new Set(r.map(l=>Ti(l.repository)));return c.size===r.length&&c.size===a.size&&[...c].every(l=>a.has(l))?null:"names every source of the snapshot, once"}o(rse,"baselineSourcesIssue");var Hj=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,Yj=/^[1-9][0-9]{0,18}$/,kj=new RegExp(`${Hj.source}|${Yj.source}`),Bj=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,ise=d.union([d.object({source:d.literal("jira"),site:d.string().regex(Bj),key:d.string().regex(Hj),updated:d.string().datetime(),contentHash:Rn}).strict(),d.object({source:d.literal("confluence"),site:d.string().regex(Bj),key:d.string().regex(Yj),version:d.number().int().positive(),contentHash:Rn}).strict(),d.object({source:d.literal("other"),key:d.string().regex(Xd),contentHash:Rn}).strict(),d.object({source:d.literal("other"),key:d.string().regex(Ks),contentHash:Rn,fileName:d.string().min(1).max(255),mediaType:d.nativeEnum(ep)}).strict()]),Rj=d.union([d.literal("jira"),d.literal("confluence")]),sse=d.object({schemaVersion:d.literal(1),items:d.array(d.union([d.object({source:Rj,site:d.string(),key:d.string().regex(kj),state:d.literal("read"),text:d.string(),version:d.string().min(1),contentMatches:d.boolean()}).strict(),d.object({source:Rj,site:d.string(),key:d.string().regex(kj),state:d.literal("not_read"),reason:d.nativeEnum(Ca)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(Xd),state:d.literal("read"),text:d.string(),version:d.string().min(1),contentMatches:d.boolean()}).strict(),d.object({source:d.literal("other"),key:d.string().regex(Xd),state:d.literal("not_read"),reason:d.nativeEnum(Ca)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(Ks),state:d.literal("read"),version:Rn,fileName:d.string().min(1).max(255),mediaType:d.nativeEnum(ep)}).strict(),d.object({source:d.literal("other"),key:d.string().regex(Ks),state:d.literal("not_read"),reason:d.nativeEnum(Ca)}).strict()])),instructions:d.array(d.string()).optional()}).strict(),ose=d.object({resultId:d.string().min(1),repository:d.string().min(1),testType:d.string().min(1),path:d.string(),finding:d.string().min(1)}).strict(),ase=d.object({schemaVersion:d.literal(1),runId:yn,skyrampOrgId:yn,target:Vh,policy:Vh.nullable(),trigger:d.object({kind:d.nativeEnum(Jh),requestedAt:d.string().datetime()}).strict(),configuration:d.object({captureId:yn,revision:Dr.nullable(),hash:Rn}).strict(),baseline:d.object({confirmedRunId:yn.nullable(),initialBaselineId:yn.optional(),comparisonBaselineId:yn.optional(),knownFailures:d.array(ose).optional(),sources:d.array(d.object({repository:hr,revision:_r}).strict()).optional()}).strict().optional(),sources:d.array(tse).min(1).max(1e3),execution:d.object({provider:d.nativeEnum(ka),repository:Jj,workflowPath:d.string(),ref:d.string()}).strict(),credentials:d.array(d.object({name:d.string(),purpose:d.nativeEnum(Zd),required:d.boolean()}).strict()),requirements:d.array(ise).min(1).optional(),instructions:d.object({contentHash:Rn}).strict().optional(),deployedRevisions:d.array(d.object({repository:hr,revision:_r}).strict()).min(1).optional()}).strict().superRefine((e,t)=>{let n=new Set;(e.requirements??[]).forEach((u,l)=>{let p="fileName"in u?"file":"pasted";u.source==="other"&&u.key!==`${p}-${u.contentHash.slice(0,16)}`&&t.addIssue({code:d.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",l,"key"]});let f=uC({source:u.source,key:u.key});n.has(f)&&t.addIssue({code:d.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",l,"key"]}),n.add(f)});let i=e.trigger.kind,r=Zie.includes(i);r!==(e.policy===null)&&t.addIssue({code:d.ZodIssueCode.custom,path:["policy"],message:r?`a ${i} run has no policy`:"names the policy revision"}),e.baseline?.knownFailures&&!e.baseline.comparisonBaselineId&&t.addIssue({code:d.ZodIssueCode.custom,path:["baseline","knownFailures"],message:"known failures require a chosen comparison checkpoint"});let s=rse(e);s&&t.addIssue({code:d.ZodIssueCode.custom,path:e.baseline?["baseline","sources"]:["baseline"],message:s}),Kie.includes(i)&&e.sources.forEach((u,l)=>{u.reason!=="BASELINE"&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l,"reason"],message:`a ${i} run selects only BASELINE sources`})}),e.deployedRevisions&&i!=="manual"&&t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let a=new Set(e.sources.map(u=>Ti(u.repository))),c=new Set;(e.deployedRevisions??[]).forEach((u,l)=>{let p=Ti(u.repository);a.has(p)?c.has(p)&&t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions",l,"repository"],message:"repository appears twice"}):t.addIssue({code:d.ZodIssueCode.custom,path:["deployedRevisions",l,"repository"],message:"names a repository outside the snapshot"}),c.add(p)}),e.sources.forEach((u,l)=>{u.compareWith&&(u.reason!=="MANUAL_OVERRIDE"||u.change)&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"}),e.baseline?.comparisonBaselineId&&(u.change?.base||u.compareWith||u.merge)&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l],message:"a chosen checkpoint cannot be combined with a source comparison base or merge"});let p=nse(u);p&&t.addIssue({code:d.ZodIssueCode.custom,path:["sources",l,...p.path],message:p.message})})});var CC=(n=>(n.Person="person",n.Policy="policy",n))(CC||{}),cse=d.object({kind:d.nativeEnum(CC),name:d.string().min(1).max(256)}).strict(),use=d.object({mcp:d.discriminatedUnion("source",[d.object({source:d.literal("npm"),version:d.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),d.object({source:d.literal("github"),ref:d.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:d.object({region:d.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:d.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),lse=d.object({schemaVersion:d.literal(1),attempt:d.object({id:yn,number:d.number().int().positive(),deadlineAt:d.string().datetime()}).strict(),manifest:ase,manifestHash:Rn,entitlements:d.array(d.string()).optional(),runToken:d.string().min(1).optional(),requestedBy:cse.nullable().optional(),writeAllowed:d.boolean().optional(),claudeCodeVersion:d.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:d.array(d.object({repository:hr,revision:_r}).strict()).optional(),statedRevisions:d.array(d.object({repository:hr,revision:_r}).strict()).optional(),runSettings:use.optional()}).strict(),Qj={providerRunAttempt:d.number().int().positive(),workflowRef:d.string().min(1)},dse=d.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),pse=d.object({schemaVersion:d.literal(1),runId:yn,execution:d.discriminatedUnion("provider",[d.object({...Qj,provider:d.literal("github"),repository:d.object(Yh).strict(),providerRunId:Dr}).strict(),d.object({...Qj,provider:d.literal("azure-devops"),repository:d.object(Wh).strict(),providerRunId:dse}).strict()]),requester:d.literal(!0).optional(),writeCheck:d.literal(!0).optional(),claudeCodePin:d.literal(!0).optional(),deployedPins:d.literal(!0).optional(),statedPins:d.literal(!0).optional(),runSettings:d.literal(!0).optional()}).strict(),xj=d.object({repository:hr,number:Dr,commitSha:_r.optional()}).strict(),Lh=d.array(d.object({repository:hr,reason:d.string().max(4096).regex(/\S/)}).strict()).max(1e3).optional(),Wj=d.object({branch:hC.optional(),commitSha:_r.optional()}).strict(),$j=d.object({repository:hr,message:d.string(),...Wj.shape}).strict(),fse=d.discriminatedUnion("status",[d.object({status:d.literal("none"),noTests:Lh}).strict(),d.object({status:d.literal("delivered"),noTests:Lh,pullRequests:d.array(xj).min(1)}).strict(),d.object({status:d.literal("partial"),noTests:Lh,pullRequests:d.array(xj).min(1),failures:d.array($j).min(1)}).strict(),d.object({status:d.literal("failed"),message:d.string(),noTests:Lh,failures:d.array($j).min(1).optional()}).strict()]),Zh=1024*1024,Zj=16*1024*1024,jh=o(e=>d.array(d.object({[e]:d.string()}).strict()).optional(),"texts"),Ase=d.object({language:d.custom(e=>e==="ja","Invalid"),businessCaseAnalysis:d.string(),validation:d.object({rationale:d.string(),gaps:d.array(d.string())}).strict().optional(),changes:d.array(d.object({id:d.string(),text:d.string()}).strict()).optional(),issuesFound:jh("description"),newTestsCreated:jh("description"),testResults:jh("details"),caveats:jh("text")}).strict(),gse=d.object({blockedPreflight:d.object({file:d.string().min(1),repository:d.string().min(1).optional(),reason:d.string().min(1).max(300),evidence:d.string().min(1).max(400)}).strict().optional(),sufficiency:d.nativeEnum(Qi),rationale:d.string().min(1),gaps:d.array(d.string().min(1)),acceptedEvidence:d.array(d.object({kind:d.nativeEnum(Xs),repository:d.string().min(1),revision:_r,reference:d.string().min(1),summary:d.string().min(1)}).strict()),actionRequired:d.array(d.nativeEnum(Iu))}).strict().superRefine((e,t)=>{e.sufficiency==="insufficient"!=e.gaps.length>0&&t.addIssue({code:d.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(e.actionRequired).size!==e.actionRequired.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),Gh=500,Kj=2048,Xj=1e3,hse=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,Tj=o(e=>e.length>0&&e.length<=64&&e===e.trim()&&!hse.test(e)&&!/[^\S ]/u.test(e)&&!/^[._]/.test(e)&&!e.endsWith("."),"isAzureName"),e1=o(e=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(e))return!0;let[t,n,i,...r]=e.split("/");return e.length<=201&&r.length===0&&i!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(t)&&Tj(n)&&Tj(i)},"isResultRepository"),mse=d.object({testResults:d.array(d.object({resultId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:d.string().refine(e1,"Invalid"),testType:d.string(),runtimeTargets:ap.optional(),endpoint:d.string(),status:d.enum(["Pass","Fail","Skipped"]),details:d.string(),fileName:d.string().optional(),testId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:d.object({kind:d.nativeEnum(np),family:d.nativeEnum(rp).optional()}).strict().optional(),origin:d.nativeEnum(Nh).optional()}).strict()),validation:gse,changes:d.array(d.object({id:d.string().min(1).max(512),text:d.string().max(16384),source:d.string().max(Kj),testedBy:d.array(d.string().min(1).max(1024)).max(Gh),writtenBy:d.array(d.string().min(1).max(1024)).max(Gh),maintainedBy:d.array(d.string().min(1).max(1024)).max(Gh)}).strict()).max(Xj).optional(),traceVersion:d.literal(1),display:Ase.optional()}).passthrough().superRefine((e,t)=>{let n=e.display,i={issuesFound:e.issuesFound,newTestsCreated:e.newTestsCreated,testResults:e.testResults,caveats:e.caveats};for(let s of["issuesFound","newTestsCreated","testResults","caveats"]){let a=n?.[s];a&&a.length!==(Array.isArray(i[s])?i[s].length:0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["display",s],message:`has not one row per ${s} row`})}n?.validation&&n.validation.gaps.length!==e.validation.gaps.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let r=new Set;e.testResults.forEach((s,a)=>{let c=s.failureCause;c&&s.status==="Pass"&&t.addIssue({code:d.ZodIssueCode.custom,path:["testResults",a,"failureCause"],message:"a passing result has no failure cause"}),c&&c.kind==="environment"!=(c.family!==void 0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["testResults",a,"failureCause"],message:"an environment cause names its family, and no other cause does"});let u=["testResults",a,"resultId"],l=s.resultId.slice(`${s.repository}:${s.testType}:`.length);(!s.resultId.startsWith(`${s.repository}:${s.testType}:`)||l===""||l.startsWith("/")||l.startsWith("#"))&&t.addIssue({code:d.ZodIssueCode.custom,path:u,message:"is not repository:testType:path for this result"}),r.has(s.resultId)&&t.addIssue({code:d.ZodIssueCode.custom,path:u,message:"stable identity repeated"}),r.add(s.resultId)})}),Dj=o(e=>e.replace(/[%:#]/g,t=>encodeURIComponent(t)),"encodeIdPart");function SC(e,t,n,i){let r=n.replace(/\\/g,"/"),s=r.split("/").filter(u=>u!==""&&u!==".");if(r.startsWith("/")||/^[A-Za-z]:/.test(r)||s.length===0||s.includes(".."))throw new Error(`testResultId needs a path relative to the repository root, got "${n}"`);let a=s.join("/"),c=`${e}:${t}:${Dj(a)}`;return i?`${c}#${Dj(i)}`:c}o(SC,"testResultId");var Kh=(i=>(i.BranchPushed="branch_pushed",i.PullRequestOpened="pull_request_opened",i.PullRequestEdited="pull_request_edited",i))(Kh||{}),t1=50,n1=d.discriminatedUnion("kind",[d.object({kind:d.literal("branch_pushed"),repository:hr,branch:hC,commit:_r}).strict(),d.object({kind:d.enum(["pull_request_opened","pull_request_edited"]),repository:hr,number:Dr,branch:hC}).strict()]),r1=d.object({schemaVersion:d.literal(1),run:d.object({runId:yn,attemptNumber:d.number().int().positive(),manifestHash:Rn}).strict(),target:Vh,policy:Vh,provenance:d.object({sources:d.array(d.object({repository:hr,revision:_r}).strict()),firstQualification:d.literal(!0).optional()}).strict(),delivery:d.object({generatedTests:fse}).strict(),producer:d.object({testbot:d.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:d.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:mse,githubWrites:d.array(n1).max(t1).optional()}).strict(),kC=(r=>(r.Recipe="recipe",r.CredentialRejected="credential_rejected",r.Environment="environment",r.Unknown="unknown",r))(kC||{}),BC=200,yse=d.object({cause:d.nativeEnum(kC),credential:d.string().regex(ki).optional(),reason:d.string().trim().min(1).max(BC).optional()}).strict().refine(e=>e.cause==="credential_rejected"==(e.credential!==void 0&&e.reason!==void 0),{message:"a credential_rejected check, and only one, names the credential and why"}),Ese=d.object({name:d.string().regex(ki),purpose:d.enum(["sut_access","other"]),required:d.boolean(),how:d.string().trim().min(1).max(_h)}).strict(),Oke=r1.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:bj,check:yse.optional(),inputs:d.array(Ese).min(1).max(50).optional()}).strict().superRefine(({recipe:e},t)=>{let n=o((s,a)=>t.addIssue({code:d.ZodIssueCode.custom,path:["recipe",...s],message:a}),"issue");e.status==="blocked"&&e.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let i=new Set,r=0;e.files.forEach((s,a)=>{cp(s.path)||n(["files",a,"path"],"is not a file under .skyramp/sut/, or the .skyramp/workspace.yml a recipe stored before SKYR-5829 carries"),i.has(s.path)&&n(["files",a,"path"],"file repeated"),i.add(s.path),pj.test(s.content)&&n(["files",a,"content"],"is not text");let c=Buffer.byteLength(s.content,"utf8");r+=c,c>oC&&n(["files",a,"content"],`larger than ${oC} bytes`)}),r>aC&&n(["files"],`recipe text over ${aC} bytes in total`)}),Mke=d.object({components:d.array(d.object({name:d.string().min(1),repository:d.string().refine(e1,"Invalid"),observedRevision:d.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:d.nativeEnum(Ph),evidence:d.string()}).strict().refine(e=>e.source!=="agent"||e.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();function i1(e){return e.trigger.kind==="schedule"||e.trigger.kind==="manual"&&e.sources.every(t=>t.reason==="BASELINE")}o(i1,"readsDeployedState");var Ise=d.object({schemaVersion:d.literal(1),stage:d.nativeEnum(jj),event:d.nativeEnum(IC),status:d.nativeEnum(Gj).optional()}).strict().refine(e=>e.status===void 0||e.event==="finished",{path:["status"],message:"only a finished stage has a status"}),Xh=100,vse=5e3,Sa=2e3,_j=100,s1=/^[A-Za-z0-9_-]{1,64}$/,bse=20,wse=200,Cse=100,Sse=100,kse=200,Nj="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",Bse=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${Nj}/${Nj})$`),Rse=500,Qse=50,xse=10,$se=/^[A-Za-z0-9](?:[A-Za-z0-9 _-]{0,48}[A-Za-z0-9])?$/,o1=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,gr=o(e=>d.string().max(e).refine(t=>t.trim().length>0&&!o1.test(t),"blank, or not text"),"setupText"),$i={sequence:d.number().int().min(1).max(vse),at:d.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},a1=d.object({...$i,kind:d.literal("reply"),to:d.string().uuid(),outcome:d.nativeEnum(zj),accepted:d.boolean(),text:gr(Sa),note:d.object({source:d.enum(["target","environment"]),quote:gr(Sa)}).strict().optional(),kept:gr(Sa).optional()}).strict();function c1(e,t){if(e.kind!=="reply")return;let n=e;n.accepted!==(n.outcome==="answered"||n.outcome==="followed")&&t.addIssue({code:d.ZodIssueCode.custom,path:["accepted"],message:"accepted exactly when answered or followed"}),n.note&&n.outcome!=="not_followed"&&t.addIssue({code:d.ZodIssueCode.custom,path:["note"],message:"a note only when not_followed"}),n.kept&&n.outcome!=="followed"&&t.addIssue({code:d.ZodIssueCode.custom,path:["kept"],message:"kept only when followed"})}o(c1,"checkReply");var Tse=d.discriminatedUnion("kind",[d.object({...$i,kind:d.literal("log"),phase:d.nativeEnum(vC),text:gr(Sa)}).strict(),d.object({...$i,kind:d.literal("component"),name:gr(_j),repository:gr(kse).refine(e=>Bse.test(e)||e===Bi,"not owner/name"),file:gr(Rse).nullable(),status:d.nativeEnum(bC),version:gr(Sse).optional()}).strict(),a1,d.object({...$i,kind:d.literal("question"),id:d.string().regex(s1),type:d.nativeEnum(Vj),text:gr(Sa),component:gr(_j).nullable(),choices:d.array(gr(wse)).max(bse),placeholder:gr(Cse).optional()}).strict(),d.object({...$i,kind:d.literal("delivered"),ids:d.array(d.string().uuid()).max(Xh)}).strict(),d.object({...$i,kind:d.literal("credentials"),names:d.array(d.string().regex(ki)).min(1).max(Qse),logins:d.array(d.object({key:d.string().regex($se),usernameVariable:d.string().regex(ki),passwordVariable:d.string().regex(ki)}).strict()).min(1).max(xse).optional()}).strict()]).superRefine((e,t)=>{if(c1(e,t),e.kind==="credentials"&&new Set(e.names).size!==e.names.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["names"],message:"a name twice"}),e.kind==="credentials"&&e.logins){let n=e.logins.map(i=>Ij(i.key));new Set(n).size!==n.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["logins"],message:"a key twice"}),e.logins.forEach((i,r)=>{for(let s of["usernameVariable","passwordVariable"])e.names.includes(i[s])||t.addIssue({code:d.ZodIssueCode.custom,path:["logins",r,s],message:"not one of the names"})})}e.kind==="question"&&(e.type==="free_text"!=(e.choices.length===0)&&t.addIssue({code:d.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(e.choices).size!==e.choices.length&&t.addIssue({code:d.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),Dse=d.object({schemaVersion:d.literal(1),events:d.array(Tse).max(Xh)}).strict(),_se=d.discriminatedUnion("kind",[d.object({...$i,kind:d.literal("log"),stage:d.nativeEnum(gC),text:gr(Sa)}).strict(),a1,d.object({...$i,kind:d.literal("delivered"),ids:d.array(d.string().uuid()).max(Xh)}).strict(),d.object({...$i,kind:d.literal("stage"),stage:d.nativeEnum(gC),event:d.nativeEnum(IC)}).strict(),d.object({...$i,kind:d.literal("test"),resultId:d.string().regex(/^[^\u0000-\u001f]{1,512}$/),status:d.enum(["Pass","Fail","Skipped"]),details:d.string().max(Sa).refine(e=>!o1.test(e),"not text")}).strict()]).superRefine(c1),Nse=d.object({schemaVersion:d.literal(1),events:d.array(_se).max(Xh)}).strict(),Pj={id:d.string().uuid(),text:d.string(),by:d.string().nullable(),at:d.string(),replied:d.literal(!0).optional()},u1=d.discriminatedUnion("kind",[d.object({...Pj,kind:d.literal("instruction"),question:d.null()}),d.object({...Pj,kind:d.literal("answer"),question:d.string().regex(s1)})]),l1=d.string().regex(/^[A-Za-z0-9+/]{43}=$/),Pse=d.object({id:d.string().uuid(),revision:d.string(),by:d.string().nullable(),at:d.string(),target:d.string(),own:d.object({source:d.enum(["policy","test_environment"]),text:d.string()}).nullable()}),Use=d.object({schemaVersion:d.literal(1),leftOut:d.array(d.string()),messages:d.array(u1).optional(),stop:d.object({key:l1}).optional(),notes:Pse.optional()}),Fse=d.object({schemaVersion:d.literal(1),messages:d.array(u1).optional()});var Ose=500*1024*1024,d1=d.object({id:Dr,name:d.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:Dr,expiresAt:d.string().datetime()}).strict(),Mse=d.object({schemaVersion:d.literal(1),artifact:d1,sessionId:yn,contentHash:Rn,bytes:d.number().int().min(1).max(Ose)}).strict(),Lse=d.object({schemaVersion:d.literal(1),checkpoint:d.object({artifact:d1,repository:d.object({namespace:d.string().min(1),name:d.string().min(1)}).strict(),sessionId:yn,contentHash:Rn,key:l1}).strict().nullable()}).strict(),jse=200,bu=100,p1=(i=>(i.Resume="resume",i.Retry="retry",i.Update="update",i))(p1||{}),Gse=d.object({kind:d.nativeEnum(p1),setup:d.object({runId:yn,endedAt:d.string().nullable(),outcome:d.string().nullable()}).strict(),components:d.array(d.object({name:d.string().min(1),repository:d.string().min(1),status:d.nativeEnum(bC)}).strict()).max(bu),credentials:d.array(d.string().min(1)).max(bu),answers:d.array(d.object({question:d.string(),answer:d.string().nullable()}).strict()).max(bu),instructions:d.array(d.object({text:d.string(),reply:d.string().nullable()}).strict()).max(bu),log:d.array(d.object({phase:d.nativeEnum(vC),text:d.string()}).strict()).max(jse),recipe:d.object({files:d.array(d.object({path:d.string().min(1),content:d.string()}).strict()).max(bu),blockers:d.array(d.object({component:d.string(),problem:d.string(),evidence:d.string(),fix:d.string()}).strict()).max(bu)}).strict().optional()}).strict(),Vse=d.object({schemaVersion:d.literal(1),context:Gse.nullable()}).strict(),zse=d.object({schemaVersion:d.literal(1),configuration:d.object({captureId:yn,revision:Dr.nullable(),hash:Rn}).strict(),capture:d.object({schemaVersion:d.literal(1),settings:d.object({target:d.object({environment:d.unknown()}).passthrough(),timeoutMinutes:d.number().int().positive(),answerWaitMinutes:d.number().int().positive().optional(),testEnvironment:d.object({name:d.string().min(1),address:d.string().min(1).optional(),readyWhen:d.string().min(1).optional(),environmentId:d.string().uuid().optional(),persistentDataPolicy:Oj}).passthrough().optional()}).passthrough(),provenance:d.object({}).passthrough(),hash:Rn}).strict()}).strict(),f1=d.object({schemaVersion:d.literal(1),environmentId:d.string().uuid().nullable(),environmentAddress:d.string().url().nullable(),persistentDataPolicy:vu.nullable()}).strict(),qse=Eu.extend({environmentId:d.string().uuid().optional(),persistentDataPolicy:Oj,version:d.number().int().positive(),components:d.array(d.object({name:d.string().min(1),repository:d.string().min(1)}).strict()),contentHash:Rn.optional(),files:d.array(d.object({path:d.string().refine(e=>cp(e)&&!AC.includes(e),"not a file of a customer_deployed plan"),content:d.string()}).strict()).optional()}).strict(),Jse=d.object({schemaVersion:d.literal(1),testEnvironment:qse.nullable().optional(),runtimePlan:d.object({version:d.number().int().positive(),contentHash:Rn,files:d.array(d.object({path:d.string().refine(cp,"not a recipe file path"),content:d.string()}).strict()).min(1),repository:Oh.optional(),recipeRepository:Oh.optional(),recipe:d.record(d.unknown()).optional()}).strict().nullable()}).strict().refine(e=>!(e.runtimePlan&&e.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),A1=d.object({schemaVersion:d.literal(1),state:d.nativeEnum(Lj),ending:d.nativeEnum(lp).nullable(),cause:d.nativeEnum(dp).nullable(),deadlineAt:d.string().datetime()}).strict();function g1(e,t){return e.state==="ended"?e.ending==="cancelled"?"cancelled":e.cause==="runner_lost"?"expired":"ended":t.getTime()>=Date.parse(e.deadlineAt)?"expired":null}o(g1,"attemptClosure");var h1=50,Lke=d.object({repository:hr,revisions:d.array(d.number().int().nonnegative()).min(1).max(2).refine(e=>e.length<2||e[0]<e[1],"two revisions name the earlier first"),files:d.array(d.string().min(1)).min(1).max(h1)}).strict();function mC(e){if(typeof e=="number"&&!Number.isFinite(e))throw new TypeError("Canonical JSON requires JSON values");if(Array.isArray(e))return`[${e.map(mC).join(",")}]`;if(e!==null&&typeof e=="object"){let n=e;return`{${Object.keys(n).sort().map(i=>`${JSON.stringify(i)}:${mC(n[i])}`).join(",")}}`}let t=JSON.stringify(e);if(t===void 0)throw new TypeError("Canonical JSON requires JSON values");return t}o(mC,"canonicalJson");function m1(e){return(0,Fj.createHash)("sha256").update(mC(e),"utf8").digest("hex")}o(m1,"manifestHash");var wu=o(e=>({provider:e.provider,providerAccountId:e.providerAccountId,providerRepositoryId:e.providerRepositoryId}),"toSourceRef");function RC(e,t,{statedPins:n=!0}={}){return pse.parse({schemaVersion:1,runId:e,execution:t.execution(),requester:!0,writeCheck:!0,claudeCodePin:!0,deployedPins:!0,...n?{statedPins:!0}:{},...t.runSettingsFromApp?{runSettings:!0}:{}})}o(RC,"handshakeRequest");function y1(e){let t=lse.parse(e);if(m1(t.manifest)!==t.manifestHash)throw new Error("The handshake manifest hash does not match its manifest");return t}o(y1,"parseHandshakeResponse");function Hse(e){let t=o(r=>r.map(s=>({repository:wu(s.repository),number:s.number,...s.commitSha===void 0?{}:{commitSha:s.commitSha}})),"pullRequests"),n=e.noTests?{noTests:e.noTests.map(r=>({repository:wu(r.repository),reason:r.reason}))}:{};if(e.status==="delivered")return{status:e.status,...n,pullRequests:t(e.pullRequests)};let i=o(r=>r.map(s=>({repository:wu(s.repository),message:s.message,...s.branch===void 0?{}:{branch:s.branch},...s.commitSha===void 0?{}:{commitSha:s.commitSha}})),"failures");return e.status==="partial"?{status:e.status,...n,pullRequests:t(e.pullRequests),failures:i(e.failures)}:e.status==="failed"&&e.failures?{...e,...n,failures:i(e.failures)}:{...e,...n}}o(Hse,"toDelivery");function Yse(e){return e.issues.map(t=>`${t.path.map((i,r)=>typeof i=="number"?`[${i}]`:r===0?i:`.${i}`).join("")}: ${t.message}`).join("; ")}o(Yse,"describeIssues");function E1(e){let{manifest:t}=e;if(Xie.includes(t.trigger.kind))throw new Error(`The report upload is invalid: a ${t.trigger.kind} run uploads its SUT recipe, never a report`);if(t.trigger.kind==="revision_read")throw new Error("The report upload is invalid: a revision_read run uploads what each component runs, never a report");if(e.firstQualification&&!t.baseline?.sources)throw new Error("The report upload is invalid: only a run whose manifest names baseline sources can be a first qualification");let n=r1.safeParse({schemaVersion:1,run:{runId:t.runId,attemptNumber:e.attemptNumber,manifestHash:m1(t)},target:{id:t.target.id,revision:t.target.revision},policy:t.policy&&{id:t.policy.id,revision:t.policy.revision},provenance:{sources:e.checkedOut.map(i=>({repository:wu(i.repository),revision:i.revision})),...e.firstQualification?{firstQualification:!0}:{}},delivery:{generatedTests:Hse(e.generatedTests)},producer:e.producer,report:e.report,...e.githubWrites?.length?{githubWrites:e.githubWrites.map(i=>({...i,repository:wu(i.repository)}))}:{}});if(!n.success)throw new Error(`The report upload is invalid: ${Yse(n.error)}`);return Wse(n.data,t,e.checkedOut),n.data}o(E1,"buildReportUpload");function Wse(e,t,n){let i=o(s=>n.find(a=>Ti(a.repository)===Ti(s.repository))?.revision??s.revision,"revisionOf"),r=new Map(t.sources.map(s=>[`${s.repository.namespace}/${s.repository.name}`.toLowerCase(),i(s)]));e.report.validation.acceptedEvidence.forEach((s,a)=>{let c=`report.validation.acceptedEvidence[${a}]`,u=r.get(s.repository.toLowerCase());if(!u)throw new Error(`${c}.repository: ${s.repository} is outside the run's snapshot`);if(s.revision!==u)throw new Error(`${c}.revision: evidence is not from the checked-out revision ${u}`)})}o(Wse,"assertEvidenceFromSnapshot");function I1(e){if(e.reportUploaded)return{schemaVersion:1,reason:"report_uploaded",cause:null};if(e.recipeUploaded)return{schemaVersion:1,reason:"recipe_uploaded",cause:null};if(e.revisionsUploaded)return{schemaVersion:1,reason:"revisions_uploaded",cause:null};let t=e.githubWrites?.length?{githubWrites:e.githubWrites.map(n=>({...n,repository:wu(n.repository)}))}:{};return e.cancelled?{schemaVersion:1,reason:"cancelled",cause:null,...t}:e.mergeConflict&&Uj(e)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:e.mergeConflict,...t}:{schemaVersion:1,reason:"no_report",cause:Uj({...e,mergeConflict:void 0}),...t}}o(I1,"attemptEndFor");function Uj(e){return e.runnerProviderNotReady?"runner_provider_not_ready":e.credentialMissing?"credential_missing":e.mergeConflict?"merge_conflict":e.checkoutFailed?"checkout_failed":e.environmentUnverified?"environment_unverified":e.setupFailed?"setup_failed":e.timedOut?"timed_out":e.modelProviderDenied?"model_provider_denied":e.modelProviderUnavailable?"model_provider_unavailable":e.environmentUnavailable?"environment_unavailable":"agent_failed"}o(Uj,"noReportCause");var Yke=["clean","recipe-drift"];var to=re(require("path"));var Xke={"application/pdf":"PDF","text/csv":"CSV","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"DOCX","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"XLSX"};var QC=o(e=>new Map((e??[]).flatMap(t=>t.file?[[tp(t.key),t.file.name]]:[])),"itemNames"),Xse=10*1024*1024,eoe=o(e=>e?.mediaType==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||e?.mediaType==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","needsExtraction"),b1=o((e,t)=>to.join(to.dirname(e),`${to.basename(e,to.extname(e))}${t}`),"besideFile"),toe=o(e=>b1(e,".extracted.txt"),"extractedTextPath");var noe=o(e=>b1(e,".quotes.txt"),"confirmedQuotesPath");function w1(e){return eoe(e.file)?toe(e.path):e.file?.mediaType==="application/pdf"?noe(e.path):e.path}o(w1,"itemTextPath");function xt(e){let t=Math.max(0,...(e.match(/`+/g)??[]).map(r=>r.length)),n="`".repeat(t+1),i=e.startsWith("`")||e.endsWith("`")?" ":"";return`${n}${i}${e}${i}${n}`}o(xt,"codeSpan");var C1=re(require("path"));var pp=re(require("fs")),Ba=re(require("path"));var roe=8;function on(e,t,n={}){let i=t.slice(0,roe),r=t.length-i.length;return{name:e,passed:!1,details:i.join("; ")+(r>0?`; \u2026and ${r} more`:""),...n.fatal?{fatal:!0}:{}}}o(on,"fail");function no(e){if(pp.existsSync(e))try{return JSON.parse(pp.readFileSync(e,"utf-8"))}catch{return}}o(no,"readJsonFile");function Be(e,t){return no(Ba.join(e.outputsDir,t))}o(Be,"readArtifact");function Hn(e,t){return{name:e,verify(n,i){let{errors:r}=t(n,i);return r.length===0?{name:this.name,passed:!0}:on(this.name,r,{fatal:!0})}}}o(Hn,"schemaGate");function cs(e,t){return Ba.relative(e,Ba.resolve(e,t)).replace(/\/+$/,"")}o(cs,"relNorm");function fp(e){return e.replace(/\s+/g," ").trim()}o(fp,"normalizeCode");var Ap=new RegExp("(^|/)("+["test_[^/]+\\.py","[^/]+_test\\.py","[^/]+\\.(spec|test)\\.[cm]?[jt]sx?","[^/]+\\.e2e-(spec|test)\\.[cm]?[jt]sx?","[^/]+_test\\.go","[^/]+Tests?\\.(java|kts?)","[^/]+_(test|spec)\\.rb","[^/]+\\.feature","[^/]+Tests?\\.cs","[^/]+_test\\.rs","tests/[^/]+\\.rs","[^/]+Test\\.php","[^/]+(Test|Spec|Suite)\\.scala","[^/]+Tests?\\.swift","[^/]+_test\\.exs","[^/]+_test\\.dart","[^/]+_test\\.(c|cc|cpp|cxx)","test_[^/]+\\.(c|cc|cpp|cxx)","[^/]+(Spec|Test)\\.groovy"].join("|")+")$","i");var xC="outputs/preflight.json",Ra="pr-diff.txt",$C="related-diffs";function TC(e){return C1.join($C,`${e.toLowerCase().replace(/\//g,"__").replace(/[^a-z0-9._-]/g,"_")}.diff`)}o(TC,"relatedDiffArtifact");var us=re(require("path"));var gp=re(require("path"));var ro="Skyramp Testbot",Qa="test-bot@skyramp.dev";var Su=o(e=>e.slice(0,12),"shortCommit");var ioe=o((e,t)=>Ot(t,{cwd:e,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim(),"git");function S1(e){let t="";try{t=ioe(e,["remote","get-url","origin"])}catch{}let n=/[:/]([A-Za-z0-9._-]+)\/([A-Za-z0-9._-]+?)(?:\.git)?\/?$/.exec(t);return n&&!t.startsWith("/")&&!t.startsWith(".")?`${n[1]}/${n[2]}`:`local/${gp.basename(gp.resolve(e)).replace(/[^A-Za-z0-9._-]/g,"-")||"repo"}`}o(S1,"repositorySlug");var yBe=new Set(Object.values(Xs));var EBe=d.object({checks:d.array(d.object({repository:d.string().optional(),name:d.string().min(1),headSha:d.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:d.string().default("completed"),conclusion:d.string().nullable().optional(),url:d.string().optional(),summary:d.string().optional()}))});var soe=["generate-unit","native-run"],wBe=["preflight","plan","write",...soe,"report","deliver"];var em=(i=>(i.Unit="unit",i.Integration="integration",i.E2e="e2e",i))(em||{}),ooe=Object.values(em);var k1=8e3,DC=new Map;function coe(e){return e.repositorySlug?e.repositorySlug:(DC.has(e.repositoryPath)||DC.set(e.repositoryPath,S1(e.repositoryPath)),DC.get(e.repositoryPath))}o(coe,"workingSlug");function an(e){return[{slug:coe(e),path:e.repositoryPath,writable:!0,working:!0},...(e.relatedRepos??[]).map(t=>({slug:t.slug,path:t.path,writable:t.writable===!0,working:!1}))]}o(an,"runSources");var Di=o((e,t)=>e.toLowerCase()===t.toLowerCase(),"sameSlug");function tm(e,t){return t?.trim()?e.find(n=>Di(n.slug,t.trim())):e[0]}o(tm,"findSource");function mr(e,t){return tm(an(e),t)}o(mr,"resolveSource");var uoe=o((e,t)=>`${t} is not a repository of this run (${an(e).map(n=>n.slug).join(", ")})`,"notARepository");function io(e,t){let n=mr(e,t);return n?n.writable?{source:n}:{error:`${n.slug} is read-only in this run: tests are written only to ${an(e).filter(i=>i.writable).map(i=>i.slug).join(", ")}`}:{error:uoe(e,t)}}o(io,"writableSource");var _C=o(e=>us.basename(us.resolve(e.path)),"relatedDirName");var UBe={focused:"Focused",impacted_critical:"Impacted and critical",broad:"Broad"};var Bu=o(e=>!!e.inputs?.scheduledValidation?.comparisonBaselineId,"retestsKnownFailures");var Jf=re(require("fs")),Ht=re(require("path"));function Gt(e,t=[]){let n=e.trim();if(!n)return{error:"session produced no output"};let i=o(u=>{try{let l=JSON.parse(u);return typeof l=="object"&&l!==null&&!Array.isArray(l)?l:void 0}catch{return}},"tryParse"),r=i(n);if(r!==void 0)return{value:r};let s;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(u){s=u instanceof Error?u.message:String(u)}let a=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let u=a.length-1;u>=0;u--){let l=i(a[u][1].trim());if(l!==void 0)return{value:l}}let c;for(let u=n.indexOf("{");u!==-1;u=n.indexOf("{",u+1)){let l=0,p=!1,f=!1;for(let g=u;g<n.length;g++){let h=n[g];if(f){f=!1;continue}if(h==="\\"){f=p;continue}if(h==='"'){p=!p;continue}if(!p){if(h==="{")l++;else if(h==="}"&&(l--,l===0)){let m=i(n.slice(u,g+1));m!==void 0&&Object.keys(m).length>0&&(c=m,u=g);break}}}}return s&&(c===void 0||Object.keys(c).length<3)?{error:`final message is not valid JSON \u2014 ${s}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:c!==void 0?{value:c}:s?{error:`final message is not valid JSON \u2014 ${s}. Most often an unescaped double quote inside a string (e.g. in "summary" or "evidence"): escape it as \\" or use single quotes in prose`}:{error:`no parseable JSON object found in session output \u2014 the final message was: "${doe(ei(n,t))}"`}}o(Gt,"extractJsonObject");var B1=240;function doe(e){let t=e.replace(/\s+/g," ").trim();return t.length<=B1?t:`\u2026${t.slice(-B1)}`}o(doe,"snippetOf");function poe(e){return e.issues.map(t=>{let n=t.path.map(r=>typeof r=="number"?`[${r}]`:`.${r}`).join("").replace(/^\./,""),i=n||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(t.message))return`${i} ${t.message}`;switch(t.code){case"invalid_type":return n?t.expected==="object"?`${i} must be an object`:t.received==="undefined"?`${i} is required`:`${i} must be ${t.expected}, got ${t.received}`:"output is not a JSON object";case"invalid_enum_value":{let r=JSON.stringify(t.received),s=t.options.find(c=>typeof c=="string"&&typeof t.received=="string"&&t.received.startsWith(c)),a=s?` \u2014 you sent ${r}; the value must be exactly ${JSON.stringify(s)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${r}`;return`${i} must be one of: ${t.options.join(", ")}${a}`}case"invalid_literal":return`${i} must be ${JSON.stringify(t.expected)}`;case"too_small":return t.type==="string"?`${i} must be a non-empty string`:`${i} must have at least ${t.minimum} item(s)`;case"unrecognized_keys":return`${i} has unknown key(s): ${t.keys.join(", ")}`;default:return`${i}: ${t.message}`}})}o(poe,"issuesToMessages");function Qn(e,t){let n=e.safeParse(t);if(n.success)return{value:n.data,errors:[]};let i=o((s,a)=>a.reduce((c,u)=>c&&typeof c=="object"?c[u]:void 0,s),"at"),r=n.error.issues.filter(s=>s.path.length&&i(t,s.path)===null);if(r.length===n.error.issues.length)try{let s=e.safeParse(r.reduce((a,{path:c})=>R1(a,c),t));if(s.success)return{value:s.data,errors:[]}}catch{}return{errors:poe(n.error)}}o(Qn,"validateWith");function R1(e,t){if(!t.length||!e||typeof e!="object")return e;let[n,...i]=t,r=Array.isArray(e)?e.slice():{...e};return i.length?r[n]=R1(r[n],i):delete r[n],r}o(R1,"withoutAt");var so=re(require("fs")),yr=re(require("path"));function foe(e){try{return so.lstatSync(e),!0}catch{return!1}}o(foe,"entryExists");function nm(e){let t=yr.resolve(e),n=[];for(;!foe(t);){let r=yr.dirname(t);if(r===t)break;n.unshift(yr.basename(t)),t=r}let i=t;try{i=so.realpathSync(t)}catch{try{so.lstatSync(t).isSymbolicLink()&&(i=yr.resolve(yr.dirname(t),so.readlinkSync(t)))}catch{}}return n.length?yr.join(i,...n):i}o(nm,"realOfExisting");function $a(e){let t=e.split(/[\\/]/)[0];return t===".skyramp"||t===".testbot"}o($a,"inUnshippedFolder");var Q1=String.raw`(?:\[[^\]]*\]|\([^)]*\))`,Aoe=String.raw`(?:["'\u201c\u2018\x60]|\*{1,2})?[^\s:"'\u201c\u201d\u2018\u2019\x60*()[\],]+(?:["'\u201d\u2019\x60]|\*{1,2})?`,x1=String.raw`(?:${Q1}|${Aoe}(?:\s*${Q1})?)`,$1=String.raw`(?:\s*:|\s+[\u2014\u2013-])`,ZBe=new RegExp(String.raw`^\s*(?:${x1}(?:,\s*${x1})*(?::L?\d+(?:[-\u2013]\d+)?${$1}?|${$1})|\[[^\]\s]+\]|\([^)\s]+\))\s+`);var rm=(r=>(r.RestApi="rest-api",r.Frontend="frontend",r.FullStack="full-stack",r.Other="other",r))(rm||{}),Ta=(r=>(r.Critical="critical",r.High="high",r.Medium="medium",r.Low="low",r))(Ta||{}),Da=(i=>(i.Suspected="suspected",i.Latent="latent",i.Refuted="refuted",i))(Da||{}),UC=(i=>(i.Skyramp="skyramp",i.External="external",i.Unknown="unknown",i))(UC||{}),FC=(r=>(r.Cascade="cascade",r.Restrict="restrict",r.Orphan="orphan",r.Unknown="unknown",r))(FC||{}),_i=(r=>(r.RequirementReference="requirement-reference",r.Spec="spec",r.PrDescription="pr-description",r.CouldBreak="could-break",r))(_i||{}),ct=d.string().trim().min(1),Ru=ct.describe("file:line"),T1=o(e=>ct.refine(t=>t.length<=400,t=>({message:`is ${t.length} characters, over the 400 cap \u2014 ${e}`})),"cap400"),hp=ct.optional().describe('multi-repo only: the OTHER checkout this lives in \u2014 its "owner/repo" slug, or the directory name if the run discovered it; omit for the working checkout'),PC=d.object({method:ct,path:ct,service:d.string().optional(),evidence:Ru,repository:hp}),goe=d.object({id:ct.describe("short-slug, e.g. R9"),statement:ct.max(400,"exceeds 400 characters \u2014 state the requirement, do not paste the spec section").describe("a testable obligation, not a summary"),source:d.nativeEnum(_i).describe("spec outranks pr-description when both state it"),evidence:ct.describe("spec: file:line or a section locator. pr-description: the quoted phrase it comes from.")}),hoe=d.object({id:ct.describe("short-slug"),statement:ct.max(400,"exceeds 400 characters \u2014 state the behaviour, do not paste the code").describe("what the change makes true"),surface:ct.describe("METHOD /path, or a component/page name"),evidence:ct.describe("file:line from the diff that introduces it"),repository:hp,satisfies:d.array(ct).optional().describe("requirement ids (from `requirements`) this behaviour correctly implements \u2014 a requirement met only in part is ALSO named by the finding that shows the rest (conflictsWith)")}),moe=d.object({id:ct.describe("short-slug"),file:ct,line:d.number().optional(),claim:T1("shorten it to the one sentence that states the defect, and move the supporting detail into `evidence`"),severity:d.nativeEnum(Ta),evidence:T1("cite the file:line and the one line that shows it, rather than reproducing the surrounding code").describe("quoted diff/code line"),status:d.nativeEnum(Da),repository:hp,conflictsWith:d.array(ct).optional().describe("requirement ids (from `requirements`) this defect contradicts or leaves unimplemented \u2014 a lower-precedence source (the diff, or the PR description) lost")}),yoe=d.object({name:ct,language:d.string().optional(),framework:d.string().optional(),evidence:Ru,repository:hp}),Eoe=d.object({dir:ct,framework:d.string().optional(),kind:d.nativeEnum(UC),evidence:Ru,repository:hp}),Ioe=d.object({from:ct,to:ct,onDelete:d.nativeEnum(FC),evidence:Ru}),voe=d.object({entity:ct,field:ct,values:d.array(d.string()),evidence:Ru}),boe=d.object({entities:d.array(d.object({name:ct,evidence:Ru})),references:d.array(Ioe).describe("INBOUND references \u2014 what still points at an entity when it is deleted"),stateFields:d.array(voe)}),OC=d.object({schemaVersion:d.literal(1),repository:d.object({path:ct.describe("absolute repo path"),currentBranch:ct,baseBranch:ct}),project:d.object({type:d.nativeEnum(rm),primaryLanguage:ct,languages:d.array(d.string()),frameworks:d.array(d.string())}),services:d.array(yoe),infrastructure:d.object({containerized:d.boolean(),hasDockerCompose:d.boolean(),composeFiles:d.array(d.string()),hasCiCd:d.boolean()}),diff:d.object({changedFiles:d.array(d.string()).describe("as git reports them; a file in another checkout may carry that repo's name"),nonApplicationOnly:d.boolean(),summary:ct.describe("\u2264400 chars")}),endpoints:d.object({new:d.array(PC),modified:d.array(PC),removed:d.array(PC)}),existingTests:d.object({locations:d.array(Eoe)}),entityMap:boe,requirements:d.array(goe).describe("from a spec (attached or linked) and/or the PR description; empty when neither states a testable obligation"),behaviors:d.array(hoe),findings:d.array(moe),unexamined:d.array(d.string()).describe("files or areas outside this change you did not open"),summary:ct.describe("one paragraph on what this change does and its test-relevant risk")});var mp=(n=>(n.Full="full",n.Static="static",n))(mp||{}),ri=(i=>(i.Contract="contract",i.Integration="integration",i.Ui="ui",i))(ri||{}),yp=(s=>(s.OwnSurface="own_surface",s.StateReadBack="state_read_back",s.Referential="referential",s.Lifecycle="lifecycle",s.Boundaries="boundaries",s))(yp||{}),Ni=(r=>(r.Update="update",r.Regenerate="regenerate",r.Delete="delete",r.Verify="verify",r))(Ni||{}),im=(l=>(l.Equals="equals",l.NotEquals="not_equals",l.GreaterThan="greater_than",l.LessThan="less_than",l.Contains="contains",l.NotContains="not_contains",l.Matches="matches",l.Absent="absent",l.Present="present",l))(im||{});var Er=d.string().trim().min(1),woe=d.object({subject:Er.describe('what the test READS: a response field path, the literal "status", or the on-screen text for a ui case \u2014 the FINAL read in a multi-step case'),comparator:d.nativeEnum(im),value:d.union([d.string(),d.number(),d.boolean(),d.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),Coe=d.object({test:Er.describe("existing test path, relative to its repository"),repository:Er.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:d.nativeEnum(Ni),evidence:Er.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:d.array(d.string()).optional().describe("analyze behavior ids this maintenance covers"),staleOnBase:d.boolean().optional().describe("[derived] the plan found the test already wrong on the base branch: it is left as it is and re-run")});var Soe=d.object({surface:Er.describe("a surface from the list, copied verbatim"),axis:d.nativeEnum(yp)}),koe=d.object({id:Er.describe("short-slug, unique across generate[]"),type:d.nativeEnum(ri),target:Er.describe('"METHOD /path", or a business-flow name'),from_finding:d.string().optional().describe("analyze finding id this case catches"),from_behavior:d.string().optional().describe("analyze behavior id this case pins"),derived_from:Soe.optional().describe("the surface \xD7 axis this case pins when no analyze behavior or finding names it \u2014 one of the three is required"),rationale:Er.describe("why this test matters"),expected_observable:Er.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:woe.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:Er.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:d.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),Boe=d.object({covered:d.array(d.string()).optional(),abstain:d.string().optional()}).superRefine((e,t)=>{let n=Array.isArray(e.covered),i=typeof e.abstain=="string";if(n===i)return void t.addIssue({code:d.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&e.covered.length===0&&t.addIssue({code:d.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),i&&!e.abstain.trim()&&t.addIssue({code:d.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),Roe=d.object({surface:Er.describe("a surface from the list, copied verbatim"),axes:d.object(Object.fromEntries(Object.values(yp).map(e=>[e,Boe])))}),D1=d.object({schemaVersion:d.literal(1),mode:d.nativeEnum(mp),maintenance:d.array(Coe),generate:d.array(koe),surfaces:d.array(Roe).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:d.object({total:d.number().describe("case count"),rationale:Er}),summary:Er.describe("one paragraph")});var ls=d.string().trim().min(1),ds=72,Qoe=d.object({repository:ls.optional().describe("owner/repo of the checkout this lint ran in, when the run has several; omit for the working checkout"),tool:d.string(),command:d.string().describe("the exact command you ran, scoped to the changed files"),clean:d.boolean(),notRun:d.string().optional().describe("why no linter checked the files, when none could (SKYR-5827): then `clean` is false and does not hold the tests back"),fixed:d.array(d.string()).optional().describe("files you fixed"),uncovered:d.array(d.string()).describe("changed/new files this linter's own config does not match (wrong extension, wrong directory) \u2014 so `clean` never examined them, even though CI may still execute them. Empty array, not omitted, when every changed/new file IS covered.")});var LC=d.object({schemaVersion:d.literal(1),lint:d.array(Qoe).min(1).describe("one entry per checkout this run wrote tests in, each run from that checkout"),fileConventions:d.object({ok:d.boolean(),notes:d.string().optional()}),ciReadiness:d.object({covered:d.boolean().describe("will the repo's CI run these tests?"),notes:d.string().optional(),unrecorded:d.array(d.string()).optional().describe("tests with no record of whether CI runs them: not covered, and not known to be left out")}),dependencies:d.object({added:d.array(d.object({package:d.string(),manifest:d.string(),repository:ls.optional().describe("owner/repo of the manifest's checkout; omit for the working checkout"),reason:ls.optional().describe("why the test must run inside the application's own test environment, so its manifest had to change \u2014 required for every entry")})).describe("every package added to an APPLICATION manifest (an exception, surfaced in the report); never the Testbot test package's own")}),support:d.array(d.object({file:ls,repository:ls.optional().describe("owner/repo of the file's checkout; omit for the working checkout")})).optional().describe("the files the tests need besides themselves (helper modules, page objects, fixtures, snapshots), delivered with them"),commit:d.object({message:ls.refine(e=>e.split(`
|
|
62
62
|
`)[0].length<=ds,{message:`subject line must be <= ${ds} chars`})}),pr:d.object({title:ls.max(ds,`must be <= ${ds} chars`),body:ls}),ready:d.boolean().describe("a statement of fact: true only if the tests are fit to commit as they stand"),blockers:d.array(d.string()).describe("what blocks the commit \u2014 required non-empty when ready is false"),summary:ls.describe("one paragraph")});function Ep(e){return(e?.blockers??[]).slice(0,3).join("; ")}o(Ep,"leadBlockers");var wo=re(require("fs")),hl=re(require("path"));var En="{junit}",sm=(s=>(s.Junit="junit",s.Trx="trx",s.GoTestJson="go-test-json",s.JestJson="jest-json",s.PlaywrightList="playwright-list",s))(sm||{}),jC=(t=>(t.Minitest="minitest",t))(jC||{}),_1=d.string().trim().min(1),_a=d.object({cwd:_1.describe('repo-relative directory the command starts in ("." for the root)'),argv:d.array(_1).min(1).describe(`the command as separate arguments, run without a shell; for a junit or trx report an argument or env value holds ${En}, where the report is written (not for Maven or Gradle, whose build writes its own)`),env:d.record(d.string(),d.string()).optional().describe("plain test or reporter settings beyond the repository's CI test job (RAILS_ENV=test, PLAYWRIGHT_JUNIT_OUTPUT_FILE={junit}); never a credential, PATH, or a tool's install path"),report:d.object({format:d.nativeEnum(sm).describe(`junit (JUnit XML to ${En}), trx (to ${En}), jest-json (Jest's --json or Vitest's --reporter=json, --outputFile=${En}), or go-test-json (go test -json on the command's output)`),reporter:d.nativeEnum(jC).optional().describe("a reporter Testbot loads for a runner that writes no report: minitest")}).optional().describe("the report the command writes; junit when omitted")});var Qu="a framework other than pytest, jest, vitest and node --test (go test, rails test, mvn, dotnet test), or one the repository's test script runs through another command (ng test, nx test)";var pRe=`pytest, Jest, Vitest and node --test tests run as the run already knows them, unless the repository's test script runs them through another command (ng test, nx test), which may be the only one that compiles them. A test in any other framework, or one run that way, also gives "run": the repository's own command for only those tests, from the directory the repository runs it in, as separate arguments without a shell. Its "report" says what the runner writes: junit (JUnit XML to ${En} in the reporter's argument or env setting), trx (a TRX file to ${En}, which every dotnet test writes with its built-in logger), jest-json (Jest's --json --outputFile=${En}, or Vitest's --reporter=json --outputFile=${En}: built in, no reporter package), or go-test-json (go test -json, read from the command's output). A Maven or Gradle command names no ${En}: its build writes JUnit XML to its own report directory, which the run reads. Use a reporter the repository already has, or one of those; a reporter or converter the command fetches is the version the repository pins, or else its latest release (an older one may not build with the repository's toolchain). For minitest, which writes none, give report.reporter "minitest" and the run fills ${En} itself. A setting the tests or reporter read goes in "env" (RAILS_ENV=test, or PLAYWRIGHT_JUNIT_OUTPUT_FILE=${En} with playwright test --reporter=junit): the run sets it, so never wrap the command in a shell to set one. The run replaces ${En} in argv and env with its report path, executes the command, and reads that report.`;var ps=(r=>(r.ExistingEvidenceSufficient="existing_evidence_sufficient",r.TargetedUnit="targeted_unit",r.RuntimeRequired="runtime_required",r.BlockedPreflight="blocked_preflight",r))(ps||{}),fs=(s=>(s.ExistingEvidence="existing_evidence",s.Unaffected="unaffected",s.ExistingUnit="existing_unit",s.NewUnit="new_unit",s.Runtime="runtime",s))(fs||{}),GC=(n=>(n.Repository="repository",n.Testbot="testbot",n))(GC||{}),VC=(i=>(i.Identified="identified",i.Passed="passed",i.Failed="failed",i))(VC||{}),Yn=d.string().trim().min(1),xoe=d.string().regex(/^[a-z0-9][a-z0-9-]*$/,"must be a short lowercase slug").describe("short-slug");var $oe=d.object({id:xoe,source:d.nativeEnum(GC),kind:d.nativeEnum(Xs),outcome:d.nativeEnum(VC),summary:Yn.max(400).describe("one line: what it shows"),tests:d.array(Yn).optional().describe("source repository: the existing tests, as repo-relative paths, optionally path::test-name"),repository:Yn.optional().describe("source repository: owner/repo the tests live in, when the run has several checkouts; omit for the working checkout"),command:Yn.optional().describe("source testbot: the exact command you ran, as you ran it"),run:_a.optional().describe(`source repository, for tests in ${Qu}: how the run executes the whole of each of these test files, all of them in one command, never narrowed to the named tests and never only listed, with the repository's own runner writing JUnit XML to {junit}. A test is credited to a file only by its name or by a report that names the file`)}),Toe=d.object({behaviorId:Yn.describe("an id from analyze's behaviors"),mechanism:d.nativeEnum(fs),evidenceIds:d.array(Yn).default([]).describe("existing_evidence: the ci-<n> or evidence ids that establish it; existing_unit: the evidence id naming the tests to run"),covers:d.string().trim().optional().describe('new_unit / runtime: the missing evidence this obtains, e.g. "the boundary the change moved"; unaffected: why the change cannot reach it, citing path:line')}),zC=(i=>(i.Browser="browser",i.RunningApp="running-app",i.Outside="outside",i))(zC||{}),Doe=d.object({behaviorId:d.string().trim().optional().describe("an id from analyze's behaviors, when it is about one"),missing:Yn.max(600).describe("the evidence that is required and cannot be obtained in this run"),needs:d.nativeEnum(zC).optional().describe("what that evidence needs: browser (only a real browser shows it), running-app (only the running app or its server shows it: its real requests, sign-in and permissions, what it saves), or outside (something the running app here could not give either: a third-party service it calls, hardware)")}),_oe=d.object({file:Yn.describe("the changed file the failure is in"),repository:Yn.optional().describe("owner/repo the file is in, when the run has several checkouts; omit for the working checkout"),reason:Yn.max(300).describe("what prerequisite the change fails"),evidence:Yn.max(400).describe("the error line, quoted")}),Noe=d.object({behaviorId:Yn.describe("an id from analyze's behaviors"),reason:Yn.max(600).describe("\u2264600 characters: why this change leaves the behavior's result as it was, citing the unchanged line that decides it (path:line)")}),vp=d.object({schemaVersion:d.literal(1),decision:d.nativeEnum(ps),evidence:d.array($oe).describe("evidence this session found or produced; CI results are the ci-<n> items and are not restated here"),plan:d.array(Toe).describe("how each changed behavior's evidence is obtained"),gaps:d.array(Doe),outOfScope:d.array(Noe).optional().describe("behaviors analyze found that this change neither changes nor states"),blocked:_oe.optional().describe("only for blocked_preflight"),rationale:Yn.max(1200).describe("\u22641200 characters: why this evidence is enough, or what it still lacks \u2014 the scope you chose and why")});var Or=re(require("fs")),Dz=require("child_process"),_z=require("module"),Nz=re(require("os")),Mi=re(require("path"));var De={};Vr(De,{$brand:()=>sS,$input:()=>UR,$output:()=>PR,INVALID:()=>Tn,NEVER:()=>iS,TimePrecision:()=>YR,ZodAny:()=>Px,ZodArray:()=>Mx,ZodBase64:()=>Ky,ZodBase64URL:()=>Xy,ZodBigInt:()=>fl,ZodBigIntFormat:()=>nE,ZodBoolean:()=>pl,ZodCIDRv4:()=>Wy,ZodCIDRv6:()=>Zy,ZodCUID:()=>Gy,ZodCUID2:()=>Vy,ZodCatch:()=>a$,ZodCodec:()=>If,ZodCompileAsyncError:()=>si,ZodCompileUnsupportedError:()=>Je,ZodCreditCard:()=>Rx,ZodCustom:()=>vf,ZodCustomStringFormat:()=>Za,ZodDate:()=>Af,ZodDefault:()=>t$,ZodDiscriminatedUnion:()=>jx,ZodE164:()=>eE,ZodEmail:()=>Oy,ZodEmoji:()=>Ly,ZodEnum:()=>ul,ZodError:()=>ede,ZodExactOptional:()=>oE,ZodFile:()=>Zx,ZodFirstPartyTypeKind:()=>v$,ZodFunction:()=>m$,ZodGUID:()=>My,ZodIBAN:()=>Qx,ZodIPv4:()=>Hy,ZodIPv6:()=>Yy,ZodISODate:()=>mo,ZodISODateTime:()=>ho,ZodISODuration:()=>Eo,ZodISOTime:()=>yo,ZodInstanceOf:()=>I$,ZodIntersection:()=>Gx,ZodIssueCode:()=>rde,ZodJWT:()=>tE,ZodKSUID:()=>Jy,ZodLazy:()=>A$,ZodLiteral:()=>Wx,ZodMAC:()=>Bx,ZodMap:()=>Hx,ZodNaN:()=>u$,ZodNanoID:()=>jy,ZodNever:()=>Fx,ZodNonOptional:()=>aE,ZodNull:()=>_x,ZodNullable:()=>e$,ZodNumber:()=>dl,ZodNumberFormat:()=>Ka,ZodObject:()=>hf,ZodOptional:()=>yf,ZodPipe:()=>Ef,ZodPrefault:()=>r$,ZodPreprocess:()=>l$,ZodPromise:()=>h$,ZodReadonly:()=>d$,ZodRealError:()=>er,ZodRecord:()=>cl,ZodSet:()=>Yx,ZodString:()=>ll,ZodStringFormat:()=>ut,ZodSuccess:()=>o$,ZodSymbol:()=>Tx,ZodTemplateLiteral:()=>f$,ZodTransform:()=>Kx,ZodTuple:()=>zx,ZodType:()=>Fe,ZodULID:()=>zy,ZodURL:()=>ff,ZodUUID:()=>Oi,ZodUndefined:()=>Dx,ZodUnion:()=>mf,ZodUnknown:()=>Ux,ZodVoid:()=>Ox,ZodXID:()=>qy,ZodXor:()=>Lx,_ZodString:()=>Fy,_default:()=>n$,_function:()=>cz,any:()=>OV,array:()=>gf,base64:()=>EV,base64url:()=>IV,bigint:()=>_V,boolean:()=>$x,catch:()=>c$,check:()=>uz,cidrv4:()=>mV,cidrv6:()=>yV,clone:()=>it,codec:()=>iz,coerce:()=>w$,compile:()=>LR,config:()=>$t,core:()=>ys,creditCard:()=>bV,cuid:()=>uV,cuid2:()=>lV,currencyCode:()=>RV,custom:()=>lz,date:()=>LV,decode:()=>Ix,decodeAsync:()=>bx,deepPartial:()=>wz,describe:()=>dz,discriminatedUnion:()=>JV,e164:()=>vV,email:()=>XG,emoji:()=>aV,encode:()=>Ex,encodeAsync:()=>vx,endsWith:()=>Zu,enum:()=>iE,exactOptional:()=>Xx,file:()=>ez,flattenError:()=>Tp,float32:()=>xV,float64:()=>$V,formatError:()=>Dp,fromJSONSchema:()=>vz,function:()=>cz,getDiscriminatedOption:()=>iB,getErrorMap:()=>sde,globalRegistry:()=>un,gt:()=>Ui,gte:()=>vr,guid:()=>eV,hash:()=>QV,hex:()=>BV,hostname:()=>kV,httpUrl:()=>oV,iban:()=>wV,includes:()=>Yu,input:()=>Sz,instanceof:()=>fz,int:()=>Py,int32:()=>TV,int64:()=>NV,intersection:()=>Vx,invertCodec:()=>sz,ipv4:()=>AV,ipv6:()=>hV,iso:()=>bf,json:()=>gz,jwt:()=>CV,keyof:()=>jV,ksuid:()=>fV,lazy:()=>g$,length:()=>qa,literal:()=>XV,locales:()=>nf,looseObject:()=>zV,looseRecord:()=>YV,lowercase:()=>Ju,lt:()=>Pi,lte:()=>Ir,mac:()=>gV,map:()=>WV,maxLength:()=>za,maxSize:()=>po,memoizer:()=>Zp,meta:()=>pz,mime:()=>Xu,minLength:()=>ms,minSize:()=>Fi,multipleOf:()=>lo,nan:()=>rz,nanoid:()=>cV,nativeEnum:()=>KV,negative:()=>Sy,never:()=>rE,nonnegative:()=>By,nonoptional:()=>s$,nonpositive:()=>ky,normalize:()=>el,null:()=>Nx,nullable:()=>pf,nullish:()=>tz,number:()=>xx,object:()=>GV,optional:()=>Ya,output:()=>kz,overwrite:()=>oi,parse:()=>gx,parseAsync:()=>hx,partialRecord:()=>HV,pipe:()=>Uy,positive:()=>Cy,prefault:()=>i$,preprocess:()=>hz,prettifyError:()=>lS,promise:()=>az,properties:()=>Ku,property:()=>Ry,readonly:()=>p$,record:()=>Jx,refine:()=>y$,regex:()=>qu,regexes:()=>Ur,registry:()=>Xm,safeDecode:()=>Cx,safeDecodeAsync:()=>kx,safeEncode:()=>wx,safeEncodeAsync:()=>Sx,safeParse:()=>mx,safeParseAsync:()=>yx,set:()=>ZV,setErrorMap:()=>ide,size:()=>Va,slugify:()=>il,startsWith:()=>Wu,strictObject:()=>VV,string:()=>df,stringFormat:()=>SV,stringbool:()=>Az,success:()=>nz,superRefine:()=>E$,symbol:()=>UV,templateLiteral:()=>oz,toJSONSchema:()=>Ty,toLowerCase:()=>nl,toUpperCase:()=>rl,toZod:()=>bp,transform:()=>sE,treeifyError:()=>uS,trim:()=>tl,tuple:()=>qx,uint32:()=>DV,uint64:()=>PV,ulid:()=>dV,undefined:()=>FV,union:()=>Al,unknown:()=>Ha,uppercase:()=>Hu,url:()=>sV,util:()=>N,uuid:()=>tV,uuidv4:()=>nV,uuidv6:()=>rV,uuidv7:()=>iV,validate:()=>_p,validateAsync:()=>Np,void:()=>MV,withParser:()=>ey,xid:()=>pV,xor:()=>qV});var ys={};Vr(ys,{$ZodAny:()=>Yk,$ZodArray:()=>tB,$ZodAsyncError:()=>Kn,$ZodBase64:()=>Uk,$ZodBase64URL:()=>Fk,$ZodBigInt:()=>jm,$ZodBigIntFormat:()=>zk,$ZodBoolean:()=>zp,$ZodCIDRv4:()=>Nk,$ZodCIDRv6:()=>Pk,$ZodCUID:()=>wk,$ZodCUID2:()=>Ck,$ZodCatch:()=>IB,$ZodCheck:()=>pt,$ZodCheckBigIntFormat:()=>WS,$ZodCheckEndsWith:()=>ck,$ZodCheckGreaterThan:()=>km,$ZodCheckIncludes:()=>ok,$ZodCheckLengthEquals:()=>nk,$ZodCheckLessThan:()=>Sm,$ZodCheckLowerCase:()=>ik,$ZodCheckMaxLength:()=>ek,$ZodCheckMaxSize:()=>ZS,$ZodCheckMimeType:()=>dk,$ZodCheckMinLength:()=>tk,$ZodCheckMinSize:()=>KS,$ZodCheckMultipleOf:()=>HS,$ZodCheckNumberFormat:()=>YS,$ZodCheckOverwrite:()=>pk,$ZodCheckProperties:()=>lk,$ZodCheckProperty:()=>uk,$ZodCheckRegex:()=>rk,$ZodCheckSizeEquals:()=>XS,$ZodCheckStartsWith:()=>ak,$ZodCheckStringFormat:()=>Lu,$ZodCheckUpperCase:()=>sk,$ZodCodec:()=>Jp,$ZodCreditCard:()=>Mk,$ZodCustom:()=>BB,$ZodCustomStringFormat:()=>Gk,$ZodCyclicError:()=>Ym,$ZodDate:()=>Xk,$ZodDefault:()=>hB,$ZodDiscriminatedUnion:()=>sB,$ZodE164:()=>Ok,$ZodEmail:()=>mk,$ZodEmoji:()=>vk,$ZodEncodeError:()=>co,$ZodEnum:()=>lB,$ZodError:()=>cS,$ZodExactOptional:()=>AB,$ZodFile:()=>pB,$ZodFunction:()=>SB,$ZodGUID:()=>gk,$ZodIBAN:()=>Lk,$ZodIPv4:()=>Tk,$ZodIPv6:()=>Dk,$ZodISODate:()=>Qk,$ZodISODateTime:()=>Rk,$ZodISODuration:()=>$k,$ZodISOTime:()=>xk,$ZodIntersection:()=>oB,$ZodJWT:()=>jk,$ZodKSUID:()=>Bk,$ZodLazy:()=>Hp,$ZodLiteral:()=>dB,$ZodMAC:()=>_k,$ZodMap:()=>cB,$ZodNaN:()=>vB,$ZodNanoID:()=>bk,$ZodNever:()=>Zk,$ZodNonOptional:()=>yB,$ZodNull:()=>Hk,$ZodNullable:()=>gB,$ZodNumber:()=>Lm,$ZodNumberFormat:()=>Vk,$ZodObject:()=>gG,$ZodObjectJIT:()=>nB,$ZodOptional:()=>Vm,$ZodPipe:()=>zm,$ZodPrefault:()=>mB,$ZodPreprocess:()=>bB,$ZodPromise:()=>kB,$ZodReadonly:()=>wB,$ZodRealError:()=>Xn,$ZodRecord:()=>aB,$ZodRegistry:()=>Km,$ZodSet:()=>uB,$ZodString:()=>Ma,$ZodStringFormat:()=>st,$ZodSuccess:()=>EB,$ZodSymbol:()=>qk,$ZodTemplateLiteral:()=>CB,$ZodTransform:()=>fB,$ZodTuple:()=>Gm,$ZodType:()=>xe,$ZodULID:()=>Sk,$ZodURL:()=>Ik,$ZodUUID:()=>hk,$ZodUndefined:()=>Jk,$ZodUnion:()=>qp,$ZodUnknown:()=>Wk,$ZodVoid:()=>Kk,$ZodXID:()=>kk,$ZodXor:()=>rB,$brand:()=>sS,$constructor:()=>S,$input:()=>UR,$output:()=>PR,Doc:()=>Oa,INVALID:()=>Tn,JSONSchema:()=>WG,JSONSchemaGenerator:()=>Dy,NEVER:()=>iS,TimePrecision:()=>YR,URL_BAD_FORMAT:()=>yk,URL_UNPARSEABLE:()=>Mp,ZodCompileAsyncError:()=>si,ZodCompileUnsupportedError:()=>Je,_any:()=>pQ,_array:()=>EQ,_base64:()=>Iy,_base64url:()=>vy,_bigint:()=>sQ,_boolean:()=>rQ,_catch:()=>jle,_check:()=>_G,_cidrv4:()=>yy,_cidrv6:()=>Ey,_coercedBigint:()=>oQ,_coercedBoolean:()=>iQ,_coercedDate:()=>mQ,_coercedNumber:()=>ZR,_coercedString:()=>zR,_creditCard:()=>JR,_cuid:()=>dy,_cuid2:()=>py,_custom:()=>vQ,_date:()=>hQ,_decode:()=>Am,_decodeAsync:()=>hm,_default:()=>Ole,_discriminatedUnion:()=>Ble,_e164:()=>by,_email:()=>ry,_emoji:()=>uy,_encode:()=>fm,_encodeAsync:()=>gm,_endsWith:()=>Zu,_enum:()=>Dle,_file:()=>IQ,_float32:()=>XR,_float64:()=>eQ,_gt:()=>Ui,_gte:()=>vr,_guid:()=>iy,_iban:()=>HR,_includes:()=>Yu,_int:()=>KR,_int32:()=>tQ,_int64:()=>aQ,_intersection:()=>Rle,_ipv4:()=>hy,_ipv6:()=>my,_isoDate:()=>of,_isoDateTime:()=>sf,_isoDuration:()=>cf,_isoTime:()=>af,_jwt:()=>wy,_ksuid:()=>gy,_lazy:()=>qle,_length:()=>qa,_literal:()=>Nle,_lowercase:()=>Ju,_lt:()=>Pi,_lte:()=>Ir,_mac:()=>qR,_map:()=>$le,_max:()=>Ir,_maxLength:()=>za,_maxSize:()=>po,_mime:()=>Xu,_min:()=>vr,_minLength:()=>ms,_minSize:()=>Fi,_multipleOf:()=>lo,_nan:()=>yQ,_nanoid:()=>ly,_nativeEnum:()=>_le,_negative:()=>Sy,_never:()=>AQ,_nonnegative:()=>By,_nonoptional:()=>Mle,_nonpositive:()=>ky,_normalize:()=>el,_null:()=>dQ,_nullable:()=>Fle,_number:()=>WR,_optional:()=>Ule,_overwrite:()=>oi,_parse:()=>Uu,_parseAsync:()=>Fu,_pipe:()=>Gle,_positive:()=>Cy,_promise:()=>Jle,_properties:()=>Ku,_property:()=>Ry,_readonly:()=>Vle,_record:()=>xle,_refine:()=>bQ,_regex:()=>qu,_safeDecode:()=>ym,_safeDecodeAsync:()=>Im,_safeEncode:()=>mm,_safeEncodeAsync:()=>Em,_safeParse:()=>Ou,_safeParseAsync:()=>Mu,_set:()=>Tle,_size:()=>Va,_slugify:()=>il,_startsWith:()=>Wu,_string:()=>VR,_stringFormat:()=>Ja,_stringbool:()=>kQ,_success:()=>Lle,_superRefine:()=>wQ,_symbol:()=>uQ,_templateLiteral:()=>zle,_toLowerCase:()=>nl,_toUpperCase:()=>rl,_transform:()=>Ple,_trim:()=>tl,_tuple:()=>Qle,_uint32:()=>nQ,_uint64:()=>cQ,_ulid:()=>fy,_undefined:()=>lQ,_union:()=>Sle,_unknown:()=>fQ,_uppercase:()=>Hu,_url:()=>rf,_uuid:()=>sy,_uuidv4:()=>oy,_uuidv6:()=>ay,_uuidv7:()=>cy,_void:()=>gQ,_xid:()=>Ay,_xor:()=>kle,base64Charset:()=>Pm,base64urlCharset:()=>Vp,canParseURL:()=>Ek,clone:()=>it,compile:()=>LR,compileFn:()=>ty,config:()=>$t,createStandardJSONSchemaMethod:()=>sl,createToJSONSchemaMethod:()=>RQ,decode:()=>kae,decodeAsync:()=>Rae,describe:()=>CQ,encode:()=>Sae,encodeAsync:()=>Bae,extractDefs:()=>Ao,finalize:()=>go,flattenError:()=>Tp,formatError:()=>Dp,getDiscriminatedOption:()=>iB,globalConfig:()=>Zt,globalRegistry:()=>un,handleUnrepresentable:()=>Vt,initializeContext:()=>fo,isBackEdge:()=>Zm,isRecursiveSchema:()=>Wm,isValidBase64:()=>Gp,isValidBase64URL:()=>Um,isValidCIDRv6:()=>Nm,isValidCreditCard:()=>Fm,isValidIBAN:()=>Om,isValidIPv6:()=>jp,isValidJWT:()=>Mm,locales:()=>nf,memoizer:()=>Zp,mergeValues:()=>ju,meta:()=>SQ,parse:()=>dm,parseAsync:()=>pm,parseURLObject:()=>pG,prettifyError:()=>lS,process:()=>ot,processSchema:()=>ot,regexes:()=>Ur,registry:()=>Xm,safeDecode:()=>xae,safeDecodeAsync:()=>Tae,safeEncode:()=>Qae,safeEncodeAsync:()=>$ae,safeParse:()=>Iae,safeParseAsync:()=>vae,standardProps:()=>$m,stripTabAndNewline:()=>Lp,toDotPath:()=>z1,toJSONSchema:()=>Ty,toZod:()=>bp,treeifyError:()=>uS,urlHostnameOk:()=>Dm,urlProtocolOk:()=>_m,util:()=>N,validate:()=>_p,validateAsync:()=>Np,validateURL:()=>Tm,version:()=>fk,withParser:()=>ey});var N={};Vr(N,{BIGINT_FORMAT_RANGES:()=>Bp,CONSTANT_CATCH:()=>um,Class:()=>HC,NUMBER_FORMAT_RANGES:()=>kp,aborted:()=>$n,allowsEval:()=>ZC,assert:()=>Moe,assertEqual:()=>Poe,assertIs:()=>Foe,assertNever:()=>Ooe,assertNotEqual:()=>Uoe,assignProp:()=>cn,attachSchema:()=>Rp,base64ToUint8Array:()=>O1,base64urlToUint8Array:()=>sae,cached:()=>Du,captureStackTrace:()=>am,cleanEnum:()=>iae,cleanRegex:()=>gs,clone:()=>it,cloneDef:()=>Goe,codePointLength:()=>Ua,constantCatch:()=>nS,createTransparentProxy:()=>Yoe,defineLazy:()=>YC,defineLazyInternal:()=>Le,derived:()=>uae,esc:()=>xn,escapeRegex:()=>Pr,explicitlyAborted:()=>eS,extend:()=>Koe,finalizeIssue:()=>Zn,floatSafeRemainder:()=>wp,getElementAtPath:()=>Voe,getEnumValues:()=>$u,getLengthableOrigin:()=>xp,getParsedType:()=>Hoe,getSizableOrigin:()=>Qp,hexToUint8Array:()=>aae,hide:()=>$p,installLazyProp:()=>fae,isObject:()=>Pa,isPlainObject:()=>Nr,issue:()=>Pu,joinValues:()=>B,jsonStringifyReplacer:()=>Tu,members:()=>tS,merge:()=>eae,mergeDefs:()=>ii,normalizeParams:()=>q,nullish:()=>om,numKeys:()=>Joe,objectClone:()=>Loe,omit:()=>Zoe,optionalKeys:()=>XC,own:()=>ao,parsedType:()=>U,partial:()=>tae,pick:()=>Woe,prefixIssues:()=>Wn,primitiveTypes:()=>KC,promiseAllObject:()=>zoe,propertyKeyTypes:()=>Sp,randomString:()=>qoe,rawShape:()=>_u,required:()=>nae,safeExtend:()=>Xoe,shallowClone:()=>Cp,sizeCaps:()=>Nu,slugify:()=>WC,stringifyPrimitive:()=>P,toZod:()=>bp,uint8ArrayToBase64:()=>M1,uint8ArrayToBase64url:()=>oae,uint8ArrayToHex:()=>cae,unwrapMessage:()=>xu});function Poe(e){return e}o(Poe,"assertEqual");function Uoe(e){return e}o(Uoe,"assertNotEqual");function bp(){return e=>e}o(bp,"toZod");function Foe(e){}o(Foe,"assertIs");function Ooe(e){throw new Error("Unexpected value in exhaustive check")}o(Ooe,"assertNever");function Moe(e){}o(Moe,"assert");function $u(e){let t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,r])=>t.indexOf(+i)===-1).map(([i,r])=>r)}o($u,"getEnumValues");function B(e,t="|"){return e.map(n=>P(n)).join(t)}o(B,"joinValues");function Tu(e,t){return typeof t=="bigint"?t.toString():t}o(Tu,"jsonStringifyReplacer");var JC=class{static{o(this,"Cached")}constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Du(e){return new JC(e)}o(Du,"cached");function om(e){return e==null}o(om,"nullish");function gs(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}o(gs,"cleanRegex");function wp(e,t){let n=e/t,i=Math.round(n),r=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<r?0:n-i}o(wp,"floatSafeRemainder");var N1=Symbol("evaluating");function YC(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==N1)return i===void 0&&(i=N1,i=n()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}o(YC,"defineLazy");function Loe(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}o(Loe,"objectClone");function cn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}o(cn,"assignProp");function _u(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}o(_u,"rawShape");function As(e){return _u(e._zod.def)??e._zod.def.shape}o(As,"sourceShape");function P1(e,t,n){Object.defineProperty(e,t,{get(){let i=n();return cn(this,t,i),i},enumerable:!0,configurable:!0})}o(P1,"deferProp");function U1(e,t,n){t in e?cn(e,t,n):e[t]=n}o(U1,"putProp");function Na(e,t,n,i){let r=As(t);for(let s of n){let a=Object.getOwnPropertyDescriptor(r,s);a.enumerable&&(a.get?P1(e,s,()=>{let c=t._zod.def.shape[s];return i?i(c,s):c}):U1(e,s,i?i(a.value,s):a.value))}}o(Na,"mirrorShape");function joe(e,t){for(let n of Reflect.ownKeys(t)){let i=Object.getOwnPropertyDescriptor(t,n);i.enumerable&&(i.get?P1(e,n,()=>t[n]):U1(e,n,i.value))}}o(joe,"mirrorProps");function ii(...e){let t={};for(let n of e){let i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}o(ii,"mergeDefs");function Goe(e){return ii(e._zod.def)}o(Goe,"cloneDef");function Voe(e,t){return t?t.reduce((n,i)=>n?.[i],e):e}o(Voe,"getElementAtPath");function zoe(e){let t=Object.keys(e),n=t.map(i=>e[i]);return Promise.all(n).then(i=>{let r={};for(let s=0;s<t.length;s++)r[t[s]]=i[s];return r})}o(zoe,"promiseAllObject");function qoe(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let i=0;i<e;i++)n+=t[Math.floor(Math.random()*t.length)];return n}o(qoe,"randomString");function xn(e){return JSON.stringify(e)}o(xn,"esc");function WC(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}o(WC,"slugify");var am="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Pa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}o(Pa,"isObject");var ZC=Du(()=>{if(Zt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Nr(e){if(Pa(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Pa(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}o(Nr,"isPlainObject");function Cp(e){return Nr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}o(Cp,"shallowClone");function Joe(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}o(Joe,"numKeys");var Hoe=o(e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},"getParsedType"),Sp=new Set(["string","number","symbol"]),KC=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Pr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}o(Pr,"escapeRegex");function it(e,t,n){let i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}o(it,"clone");function q(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:o(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:o(()=>t.error,"error")}:t}o(q,"normalizeParams");function Yoe(e){let t;return new Proxy({},{get(n,i,r){return t??(t=e()),Reflect.get(t,i,r)},set(n,i,r,s){return t??(t=e()),Reflect.set(t,i,r,s)},has(n,i){return t??(t=e()),Reflect.has(t,i)},deleteProperty(n,i){return t??(t=e()),Reflect.deleteProperty(t,i)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,i){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(n,i,r){return t??(t=e()),Reflect.defineProperty(t,i,r)}})}o(Yoe,"createTransparentProxy");function P(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}o(P,"stringifyPrimitive");function XC(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}o(XC,"optionalKeys");var kp={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Bp={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Woe(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return Na(s,e,cm(e,t)),it(e,ii(n,{shape:s,checks:[]}))}o(Woe,"pick");function cm(e,t){let n=As(e),i=[];for(let r of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,r)?.enumerable)throw new Error(`Unrecognized key: "${String(r)}"`);t[r]&&i.push(r)}return i}o(cm,"maskedKeys");function Zoe(e,t){let n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(cm(e,t)),a={};return Na(a,e,Reflect.ownKeys(As(e)).filter(c=>!s.has(c))),it(e,ii(n,{shape:a,checks:[]}))}o(Zoe,"omit");function Koe(e,t){if(!Nr(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let r=As(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(r,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return it(e,ii(e._zod.def,{shape:F1(e,t)}))}o(Koe,"extend");function F1(e,t){let n={};return Na(n,e,Reflect.ownKeys(As(e))),joe(n,t),n}o(F1,"extended");function Xoe(e,t){if(!Nr(t))throw new Error("Invalid input to safeExtend: expected a plain object");return it(e,ii(e._zod.def,{shape:F1(e,t)}))}o(Xoe,"safeExtend");function eae(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n={};Na(n,e,Reflect.ownKeys(As(e))),Na(n,t,Reflect.ownKeys(As(t)));let i=ii(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return it(e,i)}o(eae,"merge");function tae(e,t,n,i="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);let c=n?new Set(cm(t,n)):void 0,u={};return Na(u,t,Reflect.ownKeys(As(t)),e&&((l,p)=>c&&!c.has(p)?l:new e({type:"optional",innerType:l}))),it(t,ii(t._zod.def,{shape:u,checks:[]}))}o(tae,"partial");function nae(e,t,n){let i=n?new Set(cm(t,n)):void 0,r={};return Na(r,t,Reflect.ownKeys(As(t)),(s,a)=>i&&!i.has(a)?s:new e({type:"nonoptional",innerType:s})),it(t,ii(t._zod.def,{shape:r}))}o(nae,"required");function $n(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}o($n,"aborted");function eS(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}o(eS,"explicitlyAborted");function Wn(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}o(Wn,"prefixIssues");function xu(e){return typeof e=="string"?e:e?.message}o(xu,"unwrapMessage");function Nu(e){let t=[];for(let n of e??[]){let i=n._zod.def;if(!/_(length|size)$|_equals$/.test(i.check))break;let r=i.maximum??i.length??i.size;r>=0&&t.push([r,n])}return t}o(Nu,"sizeCaps");function Rp(e,t,n){var i;for(let r=t;r<e.length;r++)(i=e[r]).schema??(i.schema=n)}o(Rp,"attachSchema");function Zn(e,t,n){var i;let r=e.inst?._zod?.traits;r?.has("$ZodType")&&(r.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:xu(e.inst?._zod.def?.error?.(e))??xu(s?.(e))??xu(t?.error?.(e))??xu(n.customError?.(e))??xu(n.localeError?.(e))??"Invalid input",c={};for(let u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(c[u]=e[u]);return c.path??(c.path=[]),c.message=a,t?.reportInput&&(c.input=e.input),c}o(Zn,"finalizeIssue");function Qp(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}o(Qp,"getSizableOrigin");var rae=/[\uD800-\uDBFF]/;function Ua(e){let t=e.length;if(!rae.test(e))return t;let n=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(n--,i++);return n}o(Ua,"codePointLength");function xp(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}o(xp,"getLengthableOrigin");function U(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}o(U,"parsedType");function Pu(...e){let[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}o(Pu,"issue");function iae(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}o(iae,"cleanEnum");function O1(e){let t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return n}o(O1,"base64ToUint8Array");function M1(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}o(M1,"uint8ArrayToBase64");function sae(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return O1(t+n)}o(sae,"base64urlToUint8Array");function oae(e){return M1(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}o(oae,"uint8ArrayToBase64url");function aae(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let i=0;i<t.length;i+=2)n[i/2]=Number.parseInt(t.slice(i,i+2),16);return n}o(aae,"hexToUint8Array");function cae(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}o(cae,"uint8ArrayToHex");var HC=class{static{o(this,"Class")}constructor(...t){}};function tS(e,t){for(let n in t){let i=Object.getOwnPropertyDescriptor(t,n);i.get?Object.defineProperty(e,n,{...i,enumerable:!1}):lae(e,n,i.value)}}o(tS,"members");function ao(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}o(ao,"own");function $p(e,t,n){return ao(e,t,n,!1)}o($p,"hide");function uae(e,t){for(let n in e){let i=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return ao(this,n,i(this))},set(r){ao(this,n,r)}})}return t}o(uae,"derived");function lae(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:ao(this,t,n.bind(this))},set(i){ao(this,t,i)}})}o(lae,"defineBound");function dae(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}o(dae,"claim");var qC,oo=!1,pae={configurable:!0,get(){oo=!0}};function Le(e,t,n){let i=Object.getPrototypeOf(e._zod);if(t in i&&qC!==e._zod){qC=void 0;return}qC=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,pae);let r=oo;oo=!1;try{let s=n(this);return oo?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),oo=oo||r,s}catch(s){throw delete this[t],oo=oo||r,s}},set(r){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r})}})}o(Le,"defineLazyInternal");function fae(e,t,n,i){let r=dae(e,t);r&&Object.defineProperty(r,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,s),s.value=n(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:s})}})}o(fae,"installLazyProp");var um="~constantCatch";function nS(e){let t=o(()=>e,"fn");return t[um]=!0,t}o(nS,"constantCatch");var L1,iS=Object.freeze({status:"aborted"}),rS={value:void 0,enumerable:!1},j1="captureStackTrace"in Error?Error:null;function Aae(e){let t=j1;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return j1=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}o(Aae,"newError");function S(e,t,n,i){let r={};function s(g){this.def=g,this.constr=f,this.traits=new Set}o(s,"Internals"),s.prototype=r;let a=n,c=a&&new WeakSet;function u(g,h){if(g._zod){if(g._zod.traits.has(e))return}else{rS.value=new s(h);try{Object.defineProperty(g,"_zod",rS)}finally{rS.value=void 0}}if(g._zod.traits.add(e),t(g,h),c){let E=Object.getPrototypeOf(g),v=g._zod.constr.prototype,I=E;for(;I&&I!==v;)I=Object.getPrototypeOf(I);let b=I??E;c.has(b)||(c.add(b),tS(b,a))}let m=f.prototype;for(let E in m)Object.prototype.hasOwnProperty.call(m,E)&&(E in g||(g[E]=m[E].bind(g)))}o(u,"init");let l=i?.Parent??Object;class p extends l{static{o(this,"Definition")}}Object.defineProperty(p,"name",{value:e});function f(g){let h=i?.Parent?Aae(p):this;u(h,g);let m=h._zod.deferred;if(m){for(let v of m)v();h._zod.deferred=void 0}let E=globalThis.__zod_globalConfig?.postProcessor;return E&&E(h),h}return o(f,"_"),Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:o(g=>i?.Parent&&g instanceof i.Parent?!0:g?._zod?.traits?.has(e),"value")}),Object.defineProperty(f,"name",{value:e}),f}o(S,"$constructor");var sS=Symbol("zod_brand"),Kn=class extends Error{static{o(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},co=class extends Error{static{o(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(L1=globalThis).__zod_globalConfig??(L1.__zod_globalConfig={});var Zt=globalThis.__zod_globalConfig;function $t(e){return e&&Object.assign(Zt,e),Zt}o($t,"config");function gae(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Tu,2)),e.message}o(gae,"_getMessage");function hae(e){this._zod.message=e}o(hae,"_setMessage");var mae={get:gae,set:hae,enumerable:!0,configurable:!0},aS={value:void 0,enumerable:!1},G1=new WeakSet([Object.prototype,Error.prototype]),V1=o((e,t)=>{e.name="$ZodError",aS.value=t,Object.defineProperty(e,"issues",aS),aS.value=void 0,Object.defineProperty(e,"message",mae);let n=Object.getPrototypeOf(e);G1.has(n)||(G1.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let i=o(()=>this.message,"value");return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},"initializer"),cS=S("$ZodError",V1),Xn=S("$ZodError",V1,void 0,{Parent:Error});function yae(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}o(yae,"node");function Tp(e,t=n=>n.message){let n={},i=[];for(let r of e.issues)r.path.length>0?yae(n,r.path[0],()=>[]).push(t(r)):i.push(t(r));return{formErrors:i,fieldErrors:n}}o(Tp,"flattenError");function Dp(e,t=n=>n.message){let n={_errors:[]},i=o((r,s=[])=>{for(let a of r.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>i({issues:c},[...s,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...s,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...s,...a.path]);else{let c=[...s,...a.path];if(c.length===0)n._errors.push(t(a));else{let u=n,l=0;for(;l<c.length;){let p=c[l],f=l===c.length-1;if(p==="_errors"){f&&u._errors.push(t(a)),l++;continue}Object.prototype.hasOwnProperty.call(u,p)||Object.defineProperty(u,p,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let g=u[p];f&&g._errors.push(t(a)),u=g,l++}}}},"processError");return i(e),n}o(Dp,"formatError");function uS(e,t=n=>n.message){let n={errors:[]},i=o((r,s=[])=>{var a;for(let c of r.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>i({issues:u},[...s,...c.path]));else if(c.code==="invalid_key")i({issues:c.issues},[...s,...c.path]);else if(c.code==="invalid_element")i({issues:c.issues},[...s,...c.path]);else{let u=[...s,...c.path];if(u.length===0){n.errors.push(t(c));continue}let l=n,p=0;for(;p<u.length;){let f=u[p],g=p===u.length-1;typeof f=="string"?(l.properties??(l.properties={}),Object.prototype.hasOwnProperty.call(l.properties,f)||Object.defineProperty(l.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),l=l.properties[f]):(l.items??(l.items=[]),(a=l.items)[f]??(a[f]={errors:[]}),l=l.items[f]),g&&l.errors.push(t(c)),p++}}},"processError");return i(e),n}o(uS,"treeifyError");function z1(e){let t=[],n=e.map(i=>typeof i=="object"?i.key:i);for(let i of n)typeof i=="number"?t.push(`[${i}]`):typeof i=="symbol"?t.push(`[${JSON.stringify(String(i))}]`):/[^\w$]/.test(i)?t.push(`[${JSON.stringify(i)}]`):(t.length&&t.push("."),t.push(i));return t.join("")}o(z1,"toDotPath");function lS(e){let t=[],n=[...e.issues].sort((i,r)=>(i.path??[]).length-(r.path??[]).length);for(let i of n)t.push(`\u2716 ${i.message}`),i.path?.length&&t.push(` \u2192 at ${z1(i.path)}`);return t.join(`
|
|
63
63
|
`)}o(lS,"prettifyError");function lm(e,t){return{callee:t?.callee??e,Err:t?.Err}}o(lm,"finalizeParams");var Uu=o(e=>{let t=o((n,i,r,s)=>{let a=r?{...r,async:!1}:{async:!1},c=n._zod.run({value:i,issues:[]},a);if(c instanceof Promise)throw new Kn;if(c.issues.length){let u=new(s?.Err??e)(c.issues.map(l=>Zn(l,a,$t())));throw am(u,s?.callee??t),u}return c.value},"fn");return t},"_parse"),dm=Uu(Xn),Fu=o(e=>{let t=o(async(n,i,r,s)=>{let a=r?{...r,async:!0}:{async:!0},c=n._zod.run({value:i,issues:[]},a);if(c instanceof Promise&&(c=await c),c.issues.length){let u=new(s?.Err??e)(c.issues.map(l=>Zn(l,a,$t())));throw am(u,s?.callee??t),u}return c.value},"fn");return t},"_parseAsync"),pm=Fu(Xn),Ou=o(e=>(t,n,i)=>{let r=i?{...i,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new Kn;return s.issues.length?q1(e,s.issues,r):{success:!0,data:s.value}},"_safeParse"),Iae=Ou(Xn);function q1(e,t,n){let i;return{success:!1,get error(){return i||(i=new e(t.map(r=>Zn(r,n,$t()))),t=void 0,n=void 0),i},set error(r){i=r,t=void 0,n=void 0}}}o(q1,"failure");var Mu=o(e=>async(t,n,i)=>{let r=i?{...i,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},r);return s instanceof Promise&&(s=await s),s.issues.length?q1(e,s.issues,r):{success:!0,data:s.value}},"_safeParseAsync"),vae=Mu(Xn),bae=Symbol.for("zod.compile.invalid"),wae=Symbol.for("zod.compile.fallback"),_p=o(((e,t,n)=>{let i=e._zod.bag.validator;if(i!==void 0){if(i(t)!==bae)return!0;if(i.definite===!0&&n===void 0)return!1}return Cae(e,t,n)}),"validate");function Cae(e,t,n){let i=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},r=e._zod.bag.fallbackRun,s;if(r?(i[wae]=!0,s=r({value:t,issues:[]},i)):s=e._zod.run({value:t,issues:[]},i),s instanceof Promise)throw new Kn;return s.issues.length===0}o(Cae,"validateFallback");var Np=o(async(e,t,n)=>{let i=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},r=e._zod.run({value:t,issues:[]},i);return r instanceof Promise&&(r=await r),r.issues.length===0},"validateAsync"),fm=o(e=>{let t=Uu(e),n=o((i,r,s,a)=>{let c=s?{...s,direction:"backward"}:{direction:"backward"};return t(i,r,c,lm(n,a))},"fn");return n},"_encode"),Sae=fm(Xn),Am=o(e=>{let t=Uu(e),n=o((i,r,s,a)=>t(i,r,s,lm(n,a)),"fn");return n},"_decode"),kae=Am(Xn),gm=o(e=>{let t=Fu(e),n=o(async(i,r,s,a)=>{let c=s?{...s,direction:"backward"}:{direction:"backward"};return await t(i,r,c,lm(n,a))},"fn");return n},"_encodeAsync"),Bae=gm(Xn),hm=o(e=>{let t=Fu(e),n=o(async(i,r,s,a)=>await t(i,r,s,lm(n,a)),"fn");return n},"_decodeAsync"),Rae=hm(Xn),mm=o(e=>(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Ou(e)(t,n,r)},"_safeEncode"),Qae=mm(Xn),ym=o(e=>(t,n,i)=>Ou(e)(t,n,i),"_safeDecode"),xae=ym(Xn),Em=o(e=>async(t,n,i)=>{let r=i?{...i,direction:"backward"}:{direction:"backward"};return Mu(e)(t,n,r)},"_safeEncodeAsync"),$ae=Em(Xn),Im=o(e=>async(t,n,i)=>Mu(e)(t,n,i),"_safeDecodeAsync"),Tae=Im(Xn);var Ur={};Vr(Ur,{anyString:()=>US,base64:()=>RS,base64url:()=>QS,bigint:()=>OS,boolean:()=>MS,browserEmail:()=>Mae,cidrv4:()=>kS,cidrv6:()=>BS,creditCard:()=>vm,cuid:()=>pS,cuid2:()=>fS,currencyCode:()=>DS,date:()=>_S,datetime:()=>PS,domain:()=>$S,duration:()=>ES,e164:()=>TS,email:()=>vS,emoji:()=>bS,extendedDuration:()=>Dae,guid:()=>IS,hex:()=>zS,hostname:()=>xS,html5Email:()=>Uae,httpProtocol:()=>Pp,iban:()=>bm,idnEmail:()=>Oae,integer:()=>Up,ipv4:()=>wS,ipv6:()=>CS,ksuid:()=>hS,lowercase:()=>GS,mac:()=>SS,md5_base64:()=>Vae,md5_base64url:()=>zae,md5_hex:()=>Gae,nanoid:()=>mS,nanoidOfLength:()=>yS,null:()=>LS,number:()=>hs,rfc5322Email:()=>Fae,sha1_base64:()=>Jae,sha1_base64url:()=>Hae,sha1_hex:()=>qae,sha256_base64:()=>Wae,sha256_base64url:()=>Zae,sha256_hex:()=>Yae,sha384_base64:()=>Xae,sha384_base64url:()=>ece,sha384_hex:()=>Kae,sha512_base64:()=>nce,sha512_base64url:()=>rce,sha512_hex:()=>tce,string:()=>FS,time:()=>NS,ulid:()=>AS,undefined:()=>jS,unicodeEmail:()=>J1,uppercase:()=>VS,uuid:()=>Fa,uuid4:()=>_ae,uuid6:()=>Nae,uuid7:()=>Pae,xid:()=>gS});var pS=/^[cC][0-9a-z]{6,}$/,fS=/^[0-9a-z]+$/,AS=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,gS=/^[0-9a-vA-V]{20}$/,hS=/^[A-Za-z0-9]{27}$/,mS=/^[a-zA-Z0-9_-]{21}$/;function yS(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}o(yS,"nanoidOfLength");var ES=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Dae=/^[-+]?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)?)??$/,IS=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Fa=o(e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,"uuid"),_ae=Fa(4),Nae=Fa(6),Pae=Fa(7),vS=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Uae=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Fae=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,J1=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Oae=J1,Mae=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Lae="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function bS(){return new RegExp(Lae,"u")}o(bS,"emoji");var wS=/^(?:(?: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])$/,CS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,SS=o(e=>{let t=Pr(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},"mac"),kS=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,BS=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,RS=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,QS=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,xS=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,$S=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Pp=/^https?$/,TS=/^\+[1-9]\d{6,14}$/,vm=/^\d(?:[ -]?\d){11,18}$/,DS=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,bm=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,H1="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function jae(e){return new RegExp(`^${e}$`)}o(jae,"anchor");var _S=jae(H1);function dS(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}o(dS,"timeSource");function NS(e){return new RegExp(`^${dS(e)}$`)}o(NS,"time");function PS(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${dS({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,i=e.local?`${n}|${dS({precision:e.precision})}`:n;return new RegExp(`^${H1}T(?:${i})$`)}o(PS,"datetime");var US=/^[\s\S]{0,}$/,FS=o(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),OS=/^-?\d+n?$/,Up=/^-?\d+$/,hs=/^-?\d+(?:\.\d+)?$/,MS=/^(?:true|false)$/i,LS=/^null$/i;var jS=/^undefined$/i;var GS=/^[^A-Z]*$/,VS=/^[^a-z]*$/,zS=/^[0-9a-fA-F]*$/;function Fp(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}o(Fp,"fixedBase64");function Op(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}o(Op,"fixedBase64url");var Gae=/^[0-9a-fA-F]{32}$/,Vae=Fp(22,"=="),zae=Op(22),qae=/^[0-9a-fA-F]{40}$/,Jae=Fp(27,"="),Hae=Op(27),Yae=/^[0-9a-fA-F]{64}$/,Wae=Fp(43,"="),Zae=Op(43),Kae=/^[0-9a-fA-F]{96}$/,Xae=Fp(64,""),ece=Op(64),tce=/^[0-9a-fA-F]{128}$/,nce=Fp(86,"=="),rce=Op(86);var pt=S("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),qS=o(e=>{let t=e.value;return!om(t)&&t.size!==void 0},"_whenHasSize"),JS=o(e=>{let t=e.value;return!om(t)&&t.length!==void 0},"_whenHasLength"),wm={number:"number",bigint:"bigint",object:"date"},Sm=S("$ZodCheckLessThan",(e,t)=>{pt.init(e,t);let n=wm[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:wm[typeof i.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),km=S("$ZodCheckGreaterThan",(e,t)=>{pt.init(e,t);let n=wm[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:wm[typeof i.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),HS=S("$ZodCheckMultipleOf",(e,t)=>{pt.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):wp(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),YS=S("$ZodCheckNumberFormat",(e,t)=>{pt.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),i=n?"int":"number",[r,s]=kp[t.format];e._zod.check=a=>{let c=a.value;if(n){if(!Number.isInteger(c)){a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}c<r&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),c>s&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),WS=S("$ZodCheckBigIntFormat",(e,t)=>{pt.init(e,t);let[n,i]=Bp[t.format];e._zod.check=r=>{let s=r.value;s<n&&r.issues.push({origin:"bigint",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>i&&r.issues.push({origin:"bigint",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),ZS=S("$ZodCheckMaxSize",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=qS),e._zod.check=i=>{let r=i.value;r.size<=t.maximum||i.issues.push({origin:Qp(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),KS=S("$ZodCheckMinSize",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=qS),e._zod.check=i=>{let r=i.value;r.size>=t.minimum||i.issues.push({origin:Qp(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),XS=S("$ZodCheckSizeEquals",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=qS),e._zod.check=i=>{let r=i.value,s=r.size;if(s===t.size)return;let a=s>t.size;i.issues.push({origin:Qp(r),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),ek=S("$ZodCheckMaxLength",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=JS),e._zod.check=i=>{let r=i.value,s=r.length;if((typeof r=="string"&&s>t.maximum?Ua(r):s)<=t.maximum)return;let c=xp(r);i.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),tk=S("$ZodCheckMinLength",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=JS),e._zod.check=i=>{let r=i.value,s=r.length;if((typeof r=="string"&&s>=t.minimum&&s<t.minimum*2?Ua(r):s)>=t.minimum)return;let c=xp(r);i.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),nk=S("$ZodCheckLengthEquals",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=JS),e._zod.check=i=>{let r=i.value,s=r.length,a=typeof r=="string"&&s>=t.length&&s<=t.length*2?Ua(r):s;if(a===t.length)return;let c=xp(r),u=a>t.length;i.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Lu=S("$ZodCheckStringFormat",(e,t)=>{var n,i;pt.init(e,t),t.pattern?(n=e._zod).check??(n.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),rk=S("$ZodCheckRegex",(e,t)=>{Lu.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ik=S("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=GS),Lu.init(e,t)}),sk=S("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=VS),Lu.init(e,t)}),ok=S("$ZodCheckIncludes",(e,t)=>{pt.init(e,t);let n=Pr(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=i,e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),ak=S("$ZodCheckStartsWith",(e,t)=>{pt.init(e,t);let n=new RegExp(`^${Pr(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),ck=S("$ZodCheckEndsWith",(e,t)=>{pt.init(e,t);let n=new RegExp(`.*${Pr(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}});function Cm(e,t,n){e.issues.length&&t.issues.push(...Wn(n,e.issues))}o(Cm,"handleCheckPropertyResult");var uk=S("$ZodCheckProperty",(e,t)=>{pt.init(e,t),e._zod.check=n=>{let i=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(i instanceof Promise)return i.then(r=>Cm(r,n,t.property));Cm(i,n,t.property)}}),lk=S("$ZodCheckProperties",(e,t)=>{pt.init(e,t),$p(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=i=>{if(i.value==null){i.issues.push({expected:"object",code:"invalid_type",input:i.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(a=>[a,t.shape[a]]));let r=i.value,s;for(let[a,c]of n){let u=c._zod.run({value:r[a],issues:[]},{});u instanceof Promise?(s??(s=[]),s.push(u.then(l=>Cm(l,i,a)))):Cm(u,i,a)}if(s)return Promise.all(s).then(()=>{})}}),dk=S("$ZodCheckMimeType",(e,t)=>{pt.init(e,t);let n=new Set(t.mime);e._zod.check=i=>{n.has(i.value.type)||i.issues.push({code:"invalid_value",values:t.mime,input:i.value.type,inst:e,continue:!t.abort})}}),pk=S("$ZodCheckOverwrite",(e,t)=>{pt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var Oa=class{static{o(this,"Doc")}constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let i=t.split(`
|
|
64
64
|
`).filter(a=>a),r=Math.min(...i.map(a=>a.length-a.trimStart().length)),s=i.map(a=>a.slice(r)).map(a=>" ".repeat(this.indent*2)+a);for(let a of s)this.content.push(a)}compile(){let t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
@@ -235,7 +235,7 @@ ${n}`}:{prFailure:"unknown",prDetail:t}}o(QEe,"thrownFailure");async function xE
|
|
|
235
235
|
`}catch{return""}}o(_Ee,"heldBackPatch");var FY=o(e=>e.map(t=>t.dependsOn.length?`${t.file} (needs ${t.dependsOn.join(", ")})`:t.file).join("; "),"heldBackText");async function NEe(e,t,n,i,r,s){let a=ZH(i.path,e.runDir),c=process.env.PATH;a.dir&&(process.env.PATH=KH(a).PATH);try{return await PEe(e,t,n,i,r,s)}finally{a.dir&&(process.env.PATH=c),a.cleanup()}}o(NEe,"deliverOne");async function PEe(e,t,n,i,r,s){let a=i.slug,c,u=!1,l,p=[];try{let f=i.path,g=await xEe(e,t,n,i,r,s),{texts:h,shown:m,title:E,bot:v,remote:I,base:b,owner:C,testsBranch:Q,origin:w,mergedBase:$}=g,k=o((ne=[])=>CT(hY(bEe(ne,b)+AY(vEe(IEe(m,e,i),ne.map(et=>et.file)),{audience:"testbot-pr",runUrl:e.inputs.skyrampRunUrl,requestedBy:e.inputs.requestedBy,sourcePullRequest:w&&`${w.repository.namespace}/${w.repository.name}#${w.number}`}),e.inputs.skyrampRunUrl))+`
|
|
236
236
|
`,"bodyOf"),Y=s?"pr-body.md":`pr-body-${NY(a)}.md`,ue=ui.join(e.outputsDir,Y);Xt.writeFileSync(ue,k());let J=tt(f,["rev-parse","HEAD"]),be=$??J;tt(f,["checkout","-B",Q]),c=Q,tt(f,["reset"]);let we=Be(e,"write.json"),$e=nA(e).filter(ne=>ne.source.path===i.path&&r.includes(ne.record.sourceAsset)),Qe=AT(e);if(Qe.length)throw new Error(Qe.join("; "));let ee=we?YH(e,we,h):[];if(ee.length)throw new Error(ee.join("; "));let L=new Set($e.flatMap(({record:ne})=>[ne.sourceAsset,...ne.entry?[ne.entry]:[]]));for(let ne of r)L.has(ne)||EEe(ui.join(f,ne),h);let Ve=HH(e,$e,h,p);if(Ve.length)throw new Error(Ve.join("; "));let je=new Map([...L].map(ne=>{let et=Xt.readFileSync(ui.join(f,ne)),gt=o(bs=>tt(f,["hash-object","--no-filters","--stdin"],bs),"blobHash"),Ne=new Set([gt(et)]),An=et.toString("latin1");return!et.includes(0)&&An.includes(`\r
|
|
237
237
|
`)&&Ne.add(gt(Buffer.from(An.replace(/\r\n/g,`
|
|
238
|
-
`),"latin1"))),[ne,Ne]})),Dt=[];for(let ne of r)try{tt(f,["--literal-pathspecs","add","--",ne])}catch{Dt.push(ne)}if(Dt.some(ne=>L.has(ne)))throw new Error("could not stage every guarded delivery file");let Rt=new Map([...je].map(([ne,et])=>{let gt=tt(f,["--literal-pathspecs","ls-files","--stage","--",ne]),Ne=/^100(?:644|755) ([a-f0-9]+) 0\t/.exec(gt)?.[1];if(!Ne||!et.has(Ne))throw new Error(`the staged guarded file differs from the generated file: ${ne}`);return[ne,Ne]}));try{tt(f,["diff","--cached","--quiet"])}catch{try{let ne=$Ee(f,g,J,be,e.inputs.skyrampRunUrl);tt(f,["-c",`user.name=${v.name}`,"-c",`user.email=${v.email}`,"commit","-m",ne])}catch(ne){throw new tI(ne)}u=!0}u&&(p.length=0),l=tt(f,["rev-parse","HEAD"]);let en,St,Un,Fn=$??s?.headSha;if(u&&Fn&&Fn!==J){let ne=!1,et=l;try{tt(f,["checkout","-q","-B",c,Fn]),ne=!0;try{tt(f,["-c",`user.name=${v.name}`,"-c",`user.email=${v.email}`,"cherry-pick","--keep-redundant-commits",l])}catch(gt){let Ne=$?DEe(f,v,et):void 0;if(!Ne||(St=Ne.files.map(An=>({file:An,dependsOn:TEe(f,a,$,J,An)})),Un={repository:a,base:b,files:St,patch:_Ee(f,J,et,Ne.files)},!Ne.delivered))throw gt}ne=!1,$Y(gt=>tt(f,gt),Fn),l=tt(f,["rev-parse","HEAD"])}catch(gt){try{tt(f,["cherry-pick","--abort"])}catch{}tt(f,["checkout","-q","-B",c,l]);let Ne=qd(aa(gt),1/0);if($&&!ne)throw gt;if($)return{thrown:!1,held:Un,record:{schemaVersion:1,repository:a,branch:c,remote:I,base:b,committed:u,commitSha:l,pushed:!1,prAction:"skipped",prTitle:E,unstaged:Dt,...St?{heldBack:St}:{},reason:St?`every test change needs a merged revision ${b} does not have yet, so no tests PR was opened: ${FY(St)}`:`the tests do not apply to ${b} at ${$.slice(0,12)} without the merged revisions (${Ne}), so no tests PR was opened`}};en=`tests committed on the checkout's merge commit (re-cut onto ${Fn.slice(0,12)} failed: ${Ne})`}}St&&Xt.writeFileSync(ue,k(St));for(let[ne,et]of Rt){if(St?.some(Ne=>Ne.file===ne))continue;let gt=tt(f,["--literal-pathspecs","ls-tree",l,"--",ne]);if(/^100(?:644|755) blob ([a-f0-9]+)\t/.exec(gt)?.[1]!==et)throw new Error(`the committed guarded file differs from the generated file: ${ne}`)}for(let{record:ne}of $e){if(ne.entry)continue;let et=tt(f,["--literal-pathspecs","ls-tree",l,"--",ne.file]);if(et&&et!==tt(f,["--literal-pathspecs","ls-tree",J,"--",ne.file]))throw new Error(`the delivery included executable source for a held test: ${ne.file}`)}let _t=s?{}:{repositoryPath:f,repoSlug:a,devPr:null};if(!u){let ne=await t.markTestsPrUnchanged({branch:c,..._t});return{thrown:!1,record:{schemaVersion:1,repository:a,branch:c,remote:I,base:b,committed:!1,commitSha:l,pushed:!1,prAction:ne.action==="unchanged"?"unchanged":"skipped",prUrl:ne.url,prTitle:E,unstaged:Dt,reason:ne.action==="unchanged"?"no test changes to commit \u2014 existing tests PR annotated as unchanged":"no test changes to commit \u2014 nothing pushed, no PR opened"}}}let At=await t.publishTestsPr({repositoryPath:f,..._t,remote:I,branch:c,base:b,commitSha:l,title:E,bodyFile:ue,mode:e.inputs.deliverMode,deliveryOwner:C,...e.inputs.firstQualification?{firstQualification:!0}:{},runUrl:e.inputs.skyrampRunUrl,signal:e.signal,deadlineMs:e.deadlineMs});return{thrown:!1,held:Un,record:{schemaVersion:1,repository:a,branch:c,remote:I,base:At.base,requestedBase:b,committed:u,commitSha:l,pushed:At.pushed,...At.pushedCommits?{pushedCommits:At.pushedCommits}:{},...At.deliveredCommit?{deliveredCommit:At.deliveredCommit}:{},prAction:At.action,...At.retargetedAs?{retargetedAs:At.retargetedAs}:{},prUrl:At.url,prTitle:E,...At.failure?{prFailure:At.failure,prDetail:At.detail}:{},...en?{cutNote:en}:{},...At.action==="skipped"&&At.detail?{reason:At.detail}:{},unstaged:Dt,...St?{heldBack:St}:{}}}}catch(f){return{thrown:!0,record:{schemaVersion:1,repository:a,branch:c,committed:u,commitSha:l,pushed:!1,prAction:"failed",...QEe(f),unstaged:[]}}}finally{if(p.length){try{tt(i.path,["reset"])}catch{}for(let f of p.reverse())try{f()}catch{}}}}o(PEe,"deliverRepository");var c6e={name:"deliver",timeoutMinutes:5,execute:SEe,validateInput:o(e=>{let t=oT(e);return t?{ok:!1,reasons:[t]}:AEe(e)},"validateInput"),requires:["report"],branchRequires:{runtime:["write"],"no-runtime":["generate-unit"]}};var UEe=10*6e4;function FEe(e,t){return e.getTime()-t.getTime()-UEe}o(FEe,"remainingBudgetMs");var OY="This attempt revoked its scoped GitHub credentials; it mints no more.";var OEe=10*6e4;var MEe=o(e=>!!e&&Object.keys(e).length===1&&e.contents==="read","onlyReads"),LEe=3e4,jEe=3,MY=30,li=class extends Error{constructor(n,i,r,s){super(n);this.status=i;this.code=r;this.path=s}status;code;path;static{o(this,"AppRefusal")}},Gi=class extends Error{static{o(this,"AppUnreachable")}},Rl=class extends Gi{static{o(this,"AppNotReady")}},QT=class extends Rl{static{o(this,"RunnerProviderNotReady")}};function xT(e){let t;try{t=new URL(e)}catch{throw new Error(`skyrampAppOrigin "${e}" is not a URL`)}if(t.protocol!=="https:"||t.origin!==e.replace(/\/+$/,""))throw new Error(`skyrampAppOrigin must be an https origin, got "${e}"`);return t.origin}o(xT,"appOrigin");function jY(e,t){if(!Cu.test(e))throw new Error(`The ${t} "${e}" is not a uuid`);return e}o(jY,"routeId");function GY(e,t,n,i){throw t<500&&t!==429?new li(e,t,n,i):t===503&&n==="RUNNER_PROVIDER_NOT_READY"?new QT(e):t===503&&n==="RUN_NOT_READY"?new Rl(e):new Gi(e)}o(GY,"refusedOrUnreachable");async function VY(e,t,n,i,r,s=1/0){let a=xT(e.origin),c=`The time limit for ${t} ${n} was reached`,u,l=0;for(let p=1;p<=jEe||u instanceof Rl;p+=1){if(u instanceof Rl){if(l===MY)throw u;l+=1,p-=1,e.log?.(`${u.message}; trying again (${l} of ${MY}).`),await new Promise(f=>setTimeout(f,Math.max(0,Math.min(e.readyWaitMs??1e4,s-Date.now()))))}else p>1&&await new Promise(f=>setTimeout(f,Math.max(0,Math.min((e.retryDelayMs??2e3)*(p-1),s-Date.now()))));if(Date.now()>=s)throw new Gi(c);try{let f,g=await(Number.isFinite(s)?Promise.race([e.idToken(a),new Promise((m,E)=>{f=setTimeout(()=>E(new Gi(c)),Math.max(1,s-Date.now()))})]).finally(()=>{f&&clearTimeout(f)}):e.idToken(a));if(Date.now()>=s)throw new Gi(c);let h=await(e.fetch??fetch)(new URL(n,a).toString(),{...i(g),redirect:"error",signal:AbortSignal.timeout(Math.max(1,Math.min(LEe,s-Date.now())))}).catch(m=>{throw new Gi(m instanceof Error?m.message:String(m),{cause:m})});return await r(h)}catch(f){if(f instanceof li||Date.now()>=s)throw f;u=f}}throw u}o(VY,"callWithRetries");function zY(e,t,n,i,r){let s=i.headers.get("cf-ray");e.log?.(`Testbot V3: ${t} ${n} answered ${i.status}${s?`, cf-ray ${s}`:""}: ${r.replace(/\s+/g," ").slice(0,200)}`)}o(zY,"logRefusal");function nI(e,t,n,i,r){let s=t==="GET"?void 0:JSON.stringify(i),a=t==="PUT"&&/^\/api\/v1\/runner\/attempts\/[^/]+\/report$/.test(n)&&s!==void 0&&Buffer.byteLength(s,"utf8")>Zh;if(a&&Buffer.byteLength(s,"utf8")>Zj)throw new Error("The report exceeds the app's 16 MiB expanded report limit");let c=a?new Uint8Array((0,LY.gzipSync)(s)):s;if(a&&c.length>Zh)throw new Error("The compressed report exceeds the app's 1 MiB report upload limit");return VY(e,t,n,o(l=>({method:t,headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json",Accept:"application/json",...a?{"Content-Encoding":"gzip"}:{}},body:c}),"request"),async l=>{let p=await l.text().catch(()=>""),f={};try{f=JSON.parse(p)}catch{}if(l.ok)return f.data;zY(e,t,n,l,p);let g=f.error?.fields,h=typeof g?.path=="string"&&typeof g.reason=="string"?` at ${g.path}: ${g.reason}`:"",m=`The Skyramp app refused ${t} ${n}: ${l.status} ${f.error?.code??"no error code"}${h}`;return GY(m,l.status,f.error?.code,typeof g?.path=="string"?g.path:void 0)},r)}o(nI,"callApp");function GEe(e,t,n){return VY(e,"GET",t,o(r=>({method:"GET",headers:{Authorization:`Bearer ${r}`,Accept:"application/octet-stream"}}),"request"),async r=>{if(!r.ok)return zY(e,"GET",t,r,await r.text().catch(()=>"")),GY(`The Skyramp app refused GET ${t}: ${r.status}`,r.status);let s=Buffer.from(await r.arrayBuffer());if(s.length>n)throw new li(`The Skyramp app answered GET ${t} with more than ${n} bytes`,r.status);return s})}o(GEe,"callAppBytes");var cA=class{constructor(t,n,i,r,s,a,c,u,l,p=[],f=[],g){this.attemptId=t;this.attemptNumber=n;this.deadlineAt=i;this.manifest=r;this.deps=s;this.license=a;this.requestedBy=c;this.writeAllowed=u;this.claudeCodeVersion=l;this.deployedPins=p;this.statedPins=f;this.runSettings=g}attemptId;attemptNumber;deadlineAt;manifest;deps;license;requestedBy;writeAllowed;claudeCodeVersion;deployedPins;statedPins;runSettings;static{o(this,"V3Attempt")}budgetMs(t){return FEe(this.deadlineAt,t)}get skyrampRunUrl(){return qj(xT(this.deps.origin),this.manifest.runId)}log(t){this.deps.log?.(t)}send(t,n,i,r){return nI(this.deps,t,n,i,r)}readBytes(t,n){return GEe(this.deps,t,n)}issuedTokens=[];closure;modelKey;modelCredentials=[];credentials={};revocation;token(){return this.cachedToken("run")}readOnlyToken(){return this.cachedToken("read")}async cachedToken(t){if(this.revocation)throw new Error(OY);let n=(this.deps.now??(()=>new Date))().getTime(),i=this.credentials[t],r=i&&await i.catch(()=>{});if(this.credentials[t]!==i)return(await this.credentials[t]).token;if(r&&r.expiresAt-n>=OEe)return r.token;if(this.revocation)throw new Error(OY);let s=t==="read",a=s?{schemaVersion:1,access:t}:{schemaVersion:1},c=s?"read-only":"scoped",u=this.send("POST",`/api/v1/runner/attempts/${this.attemptId}/credentials`,a).then(l=>{let p={...l,token:l.token??this.jobToken()};if(this.issuedTokens.push(p.token),this.deps.mask?.(p.token),p.anthropicApiKey&&this.deps.mask?.(p.anthropicApiKey),s&&l.token&&!MEe(p.permissions))throw new Error(`The Skyramp app was asked for a read-only GitHub token, but its token grants ${JSON.stringify(p.permissions??null)}`);!s&&!r&&p.anthropicApiKey&&(this.modelKey=p.anthropicApiKey),this.deps.onTokenGranted?.(t);let f=r?"Renewed":"Received";return l.token&&this.deps.log?.(`${f} ${c} GitHub credentials; they expire at ${p.expiresAt}.`),{token:p.token,expiresAt:l.token?new Date(p.expiresAt).getTime():Number.POSITIVE_INFINITY}},l=>{if(this.deps.onTokenRefused?.(l,t),!(l instanceof li)||l.code!=="CREDENTIALS_UNAVAILABLE")throw l;let p=o(h=>[...new Set(h.map(m=>m.namespace))].join(", "),"unique"),f=this.manifest.sources.map(h=>h.repository);if(new Set(f.map(h=>h.providerAccountId)).size>1)throw new li(`${l.message}. The run's repositories are on more than one GitHub account (${p(f)}), which Skyramp does not support yet.`,l.status,l.code);let g=p([...f,this.manifest.execution.repository]);throw new li(`${l.message}. Check the Skyramp GitHub App installation on ${g}: it must be installed and not suspended, have access to these repositories, and have accepted the App's current permissions. Each account must also be connected to your Skyramp organization.`,l.status,l.code)});return this.credentials[t]=u,(await u).token}jobToken(){if(this.deps.sourceToken)return this.deps.sourceToken;throw new Error("The app answered the credentials request without a token, and the job gave Testbot none of its own: on Azure Pipelines, set SYSTEM_ACCESSTOKEN to $(System.AccessToken) in the Testbot step's env.")}sourceFetch(t){return t.fetch??this.deps.fetch??fetch}revokeTokens(t={}){let n=t.host??M0();return this.revocation??=n.revokeToken?this.revokeIssued(i=>n.revokeToken(i,this.sourceFetch(t))):Promise.resolve([]),this.revocation}async revokeIssued(t){let n=[...this.issuedTokens],i=Promise.all(n.map(a=>this.revokeOne(a,t)));await Promise.all(Object.values(this.credentials).map(a=>a.catch(()=>{})));let r=this.issuedTokens.filter(a=>!n.includes(a));return[...await i,...await Promise.all(r.map(a=>this.revokeOne(a,t)))].filter(a=>a!==void 0)}async revokeOne(t,n){try{await n(t);return}catch(i){return`token ${this.issuedTokens.indexOf(t)+1} of ${this.issuedTokens.length}: ${i instanceof Error?i.message:String(i)}`}}};async function qY(e,t,n){jY(e,"run id"),xT(n.origin);let i=RC(e,t),r=`/api/v1/runner/runs/${e}/attempts`,s;try{s=await nI(n,"POST",r,i)}catch(l){if(!(l instanceof li&&l.status===400&&l.path==="$.statedPins"))throw l;i=RC(e,t,{statedPins:!1}),s=await nI(n,"POST",r,i)}let a=y1(s);if(a.manifest.runId!==e)throw new Error(`The app answered the handshake of run ${e} with the manifest of another run (${a.manifest.runId})`);let c=a.manifest.sources.find(l=>l.repository.provider!==i.execution.provider);if(c)throw new Error(`The manifest of run ${e} names ${c.repository.namespace}/${c.repository.name} on ${c.repository.provider}, but this job runs on ${i.execution.provider}`);VEe(a.manifest,[...a.deployedRevisions??[],...a.statedRevisions??[]]),a.runToken&&n.mask?.(a.runToken);let u=a.runToken?{entitlements:a.entitlements??[],runToken:a.runToken}:void 0;return new cA(a.attempt.id,a.attempt.number,new Date(a.attempt.deadlineAt),a.manifest,n,u,a.requestedBy??void 0,a.writeAllowed,a.claudeCodeVersion??void 0,a.deployedRevisions??[],a.statedRevisions??[],a.runSettings)}o(qY,"startV3Attempt");function VEe(e,t){if(t.length===0)return;if(!i1(e))throw new Error(`The app pinned an attempt of a ${e.trigger.kind} run; only a scheduled run or unchosen manual run's retry is pinned to an earlier attempt's read`);let n=new Set(e.sources.map(r=>Ti(r.repository))),i=new Set;for(let r of t){let s=Ti(r.repository);if(!n.has(s))throw new Error(`The app pinned the attempt to repository ${r.repository.providerRepositoryId}, which is not a source of the run`);if(i.has(s))throw new Error(`The app pinned repository ${r.repository.providerRepositoryId} twice`);i.add(s)}}o(VEe,"checkAttemptPins");async function $T(e,t){return A1.parse(await e.send("POST",`/api/v1/runner/attempts/${e.attemptId}/heartbeat`,{schemaVersion:1},t))}o($T,"heartbeatV3Attempt");async function JY(e,t=()=>new Date,n){if(e.closure)return e.closure;let i=await $T(e,n).then(r=>g1(r,t())).catch(()=>null);return i&&(e.closure=i),i}o(JY,"closedV3Attempt");var oKe=10*6e4;var aKe=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE"];var cKe=d.object({tests:d.object({placements:d.array(d.unknown()).optional()}).passthrough().optional()}).passthrough(),uKe=d.object({repository:wC,testType:d.string(),directory:d.string()}).passthrough();var lKe=d.object({report:d.object({language:d.string()}).passthrough()}).passthrough();var dKe=d.object({environment:d.object({components:d.array(d.unknown()).optional(),dependencies:d.array(d.unknown()).optional()}).passthrough()}).passthrough(),pKe=d.object({environment:d.object({offLimits:d.unknown().optional()}).passthrough()}).passthrough();var fKe=d.object({environment:d.object({allowedEgress:d.unknown().optional()}).passthrough()}).passthrough();var AKe=d.object({name:d.string().min(1),provision:d.literal("existing"),url:d.string().min(1),repository:wC.optional(),revisionUrl:d.string().min(1).optional()}).passthrough(),gKe=d.object({name:d.string().min(1),url:d.string().nullable(),versionUrl:d.string().nullable(),notes:d.string().nullable()}).passthrough();var hKe=new Set(["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"]);function HY(e){let t=o(n=>e.testResults.filter(i=>i.status===n).length,"count");return{passed:t("Pass"),failed:t("Fail"),skipped:t("Skipped")}}o(HY,"statusCounts");function zEe(e){let{passed:t,failed:n,skipped:i}=HY(e);return t+n===0?{sufficiency:"insufficient",rationale:i>0?`Every test was skipped (${i}), so nothing was validated.`:"No test ran, so nothing was validated.",gaps:["No test ran against the frozen sources."],acceptedEvidence:[],actionRequired:[]}:{sufficiency:"sufficient",rationale:`${t+n} tests ran against the frozen sources: ${t} passed, ${n} failed${i?`, ${i} skipped`:""}.`,gaps:[],acceptedEvidence:[],actionRequired:[]}}o(zEe,"executedTestsValidation");function qEe(e,t){let n=e.map(c=>({result:c,repository:c.repository??t,path:c.fileName||c.testType})),i=new Map;for(let c of n){let u=`${c.repository}:${c.result.testType}:${c.path}`;i.set(u,(i.get(u)??0)+1)}let r=n.map(({result:c,repository:u,path:l})=>{let p=(i.get(`${u}:${c.testType}:${l}`)??0)>1;return c.resultId??SC(u,c.testType,l,p&&c.endpoint||void 0)}),s=new Map;for(let c of r)s.set(c,(s.get(c)??0)+1);let a=new Set(r.filter(c=>s.get(c)===1));return n.map(({result:c,repository:u},l)=>{let p=r[l],f=p;if(s.get(p)>1&&a.has(p))for(let g=2;a.has(f)||f===p;g+=1)f=p.includes("#")?`${p}.${g}`:`${p}#${g}`;return a.add(f),{...c,repository:u,resultId:f}})}o(qEe,"withResultIds");function JEe({notTranslated:e,...t},n){let i=qEe(t.testResults,n);return{...t,testResults:i,...HEe(t,i,n),validation:ZEe(KEe(t,YEe(t,t.validation??zEe(t)))),traceVersion:1}}o(JEe,"v3Report");function HEe(e,t,n){if(!e.testExecutionContexts)return{};let i=new Set,r=o(c=>{let u=c;for(let l=2;i.has(u);l+=1)u=`${c}#${l}`;return i.add(u),u},"unique"),s=[],a=new Map;for(let{repository:c,...u}of e.testExecutionContexts){let l=u.status==="not_run"?[]:t.filter(p=>p.fileName===u.test&&p.repository===(c?.trim()||n));l.length||s.push(u);for(let{resultId:p}of l){let f=a.get(p),g=f!==void 0&&s[f].cleanup.status==="failed"?s[f].cleanup:u.cleanup,h={...u,cleanup:g,test:p,resultId:p};f===void 0?a.set(p,s.push(h)-1):s[f]=h}}for(let c of s)c.resultId&&i.add(c.resultId);return{testExecutionContexts:s.map(c=>c.resultId?c:{...c,test:r(c.test.slice(0,512))}).slice(0,5e3)}}o(HEe,"linkedContexts");function YEe(e,t){let{passed:n,failed:i}=HY(e);return t.sufficiency!=="sufficient"||n+i>0||t.acceptedEvidence.length>0?t:{...t,sufficiency:"insufficient",gaps:["No test ran and no existing evidence was accepted, so nothing was validated."]}}o(YEe,"withEvidence");var WEe={"model-provider-denied":"model_provider_denied","model-provider-unavailable":"model_provider_unavailable"};function ZEe(e){return{...e,gaps:kf(e.gaps)}}o(ZEe,"boundedGaps");function KEe(e,t){if(t.sufficiency==="sufficient")return t;let n=(e.caveats??[]).map(r=>WEe[r.kind]).filter(r=>r!==void 0),i=[...new Set(n)].filter(r=>!t.actionRequired.includes(r));return i.length?{...t,actionRequired:[...i,...t.actionRequired]}:t}o(KEe,"withModelProviderFailure");function XEe(e,t,n){let{language:i,report:r}=t;if(i==="en")return;let s={language:i,businessCaseAnalysis:r.businessCaseAnalysis},a=o((m,E,v)=>Array.isArray(m)&&Array.isArray(E)&&m.length===E.length?m.map(I=>({[v]:I[v]})):void 0,"rows"),c=e.validation;r.validation&&c&&c.rationale===n.validation.rationale&&JSON.stringify(kf(c.gaps))===JSON.stringify(n.validation.gaps)&&kf(r.validation.gaps).length===n.validation.gaps.length&&(s.validation={rationale:r.validation.rationale,gaps:kf(r.validation.gaps)});let u=new Set((n.changes??[]).map(m=>m.id)),l=(r.changes??[]).filter(m=>u.has(m.id)).map(({id:m,text:E})=>({id:m,text:E}));l.length&&(s.changes=l);let p=a(r.issuesFound,n.issuesFound,"description");p&&(s.issuesFound=p);let f=a(r.newTestsCreated,n.newTestsCreated,"description");f&&(s.newTestsCreated=f);let g=a(r.testResults,n.testResults,"details");g&&(s.testResults=g);let h=a(r.caveats,n.caveats,"text");return h&&(s.caveats=h),s}o(XEe,"v3Display");async function YY(e,t){let n=YL([...e.issuedTokens,...t.secrets??[]]),i={...JEe(t.report,t.workingSlug),...t.notTranslated?{notTranslated:t.notTranslated}:{}},r=t.translated&&XEe(t.report,t.translated,i),s=o(c=>E1({manifest:e.manifest,attemptNumber:e.attemptNumber,checkedOut:t.sources.map(u=>({repository:u.repository,revision:u.revision})),firstQualification:t.firstQualification,generatedTests:uu(t.delivery,n),producer:t.producer,report:uu(c&&r?{...i,display:r}:i,n),githubWrites:t.githubWrites}),"build"),a=s(!0);r&&Buffer.byteLength(JSON.stringify(a),"utf8")>Zh&&(a=s(!1)),await e.send("PUT",`/api/v1/runner/attempts/${e.attemptId}/report`,a)}o(YY,"uploadV3Report");async function TT(e,t,n){if(!d.string().uuid().safeParse(t).success)return{refusal:"no_environment"};let i;try{i=f1.parse(await e.send("GET",Mj.persistentDataPolicy.replace(":attemptId",e.attemptId),void 0))}catch{return{refusal:"unavailable"}}try{if(!i.environmentAddress||new URL(i.environmentAddress).href!==new URL(n).href)return{refusal:"changed"}}catch{return{refusal:"changed"}}if(i.environmentId!==t)return{refusal:"changed"};let r=i.persistentDataPolicy;return r?r.environmentId===t?{policy:r}:{refusal:"changed"}:{refusal:"denied"}}o(TT,"fetchV3PersistentDataPolicy");async function WY(e,t,n){let{environmentId:i,environmentAddress:r}=t;if(!i||!r)return{allowed:!1,refusal:"no_environment"};let s=t.persistentDataPolicy;if(!s?.allowed||s.environmentId!==i)return{allowed:!1,refusal:"no_recorded_grant"};let a=await TT(e,i,r);return"refusal"in a?{allowed:!1,refusal:a.refusal}:a.policy.allowed?a.policy.revision!==s.revision?{allowed:!1,refusal:"changed"}:Mh(t,a.policy,n)?{allowed:!0,policy:a.policy}:{allowed:!1,refusal:"out_of_scope"}:{allowed:!1,refusal:"denied"}}o(WY,"currentV3PersistenceDecision");async function ZY(e,t){return jY(e.attemptId,"attempt id"),nI(t,"POST",`/api/v1/runner/attempts/${e.attemptId}/end`,I1({reportUploaded:e.reportUploaded,recipeUploaded:e.recipeUploaded,revisionsUploaded:e.revisionsUploaded,cancelled:e.cause==="cancelled",timedOut:e.cause==="timed_out",setupFailed:e.cause==="setup_failed",checkoutFailed:e.cause==="checkout_failed"||e.cause==="merge_conflict"&&!e.conflict,mergeConflict:e.cause==="merge_conflict"?e.conflict:void 0,environmentUnverified:e.cause==="environment_unverified",runnerProviderNotReady:e.cause==="runner_provider_not_ready",credentialMissing:e.cause==="credential_missing",modelProviderDenied:e.cause==="model_provider_denied",modelProviderUnavailable:e.cause==="model_provider_unavailable",githubWrites:e.githubWrites}))}o(ZY,"endV3Attempt");0&&(module.exports={AppRefusal,AppUnreachable,AttemptEndReason,DeliveryStatus,GitHubWriteKind,NoReportCause,SourceProvider,TARGET_ENVIRONMENT_KEYS,V3Attempt,ValidationSufficiency,closedV3Attempt,currentV3PersistenceDecision,endV3Attempt,fetchV3PersistentDataPolicy,heartbeatV3Attempt,startV3Attempt,uploadV3Report});
|
|
238
|
+
`),"latin1"))),[ne,Ne]})),Dt=[];for(let ne of r)try{tt(f,["--literal-pathspecs","add","--",ne])}catch{Dt.push(ne)}if(Dt.some(ne=>L.has(ne)))throw new Error("could not stage every guarded delivery file");let Rt=new Map([...je].map(([ne,et])=>{let gt=tt(f,["--literal-pathspecs","ls-files","--stage","--",ne]),Ne=/^100(?:644|755) ([a-f0-9]+) 0\t/.exec(gt)?.[1];if(!Ne||!et.has(Ne))throw new Error(`the staged guarded file differs from the generated file: ${ne}`);return[ne,Ne]}));try{tt(f,["diff","--cached","--quiet"])}catch{try{let ne=$Ee(f,g,J,be,e.inputs.skyrampRunUrl);tt(f,["-c",`user.name=${v.name}`,"-c",`user.email=${v.email}`,"commit","-m",ne])}catch(ne){throw new tI(ne)}u=!0}u&&(p.length=0),l=tt(f,["rev-parse","HEAD"]);let en,St,Un,Fn=$??s?.headSha;if(u&&Fn&&Fn!==J){let ne=!1,et=l;try{tt(f,["checkout","-q","-B",c,Fn]),ne=!0;try{tt(f,["-c",`user.name=${v.name}`,"-c",`user.email=${v.email}`,"cherry-pick","--keep-redundant-commits",l])}catch(gt){let Ne=$?DEe(f,v,et):void 0;if(!Ne||(St=Ne.files.map(An=>({file:An,dependsOn:TEe(f,a,$,J,An)})),Un={repository:a,base:b,files:St,patch:_Ee(f,J,et,Ne.files)},!Ne.delivered))throw gt}ne=!1,$Y(gt=>tt(f,gt),Fn),l=tt(f,["rev-parse","HEAD"])}catch(gt){try{tt(f,["cherry-pick","--abort"])}catch{}tt(f,["checkout","-q","-B",c,l]);let Ne=qd(aa(gt),1/0);if($&&!ne)throw gt;if($)return{thrown:!1,held:Un,record:{schemaVersion:1,repository:a,branch:c,remote:I,base:b,committed:u,commitSha:l,pushed:!1,prAction:"skipped",prTitle:E,unstaged:Dt,...St?{heldBack:St}:{},reason:St?`every test change needs a merged revision ${b} does not have yet, so no tests PR was opened: ${FY(St)}`:`the tests do not apply to ${b} at ${$.slice(0,12)} without the merged revisions (${Ne}), so no tests PR was opened`}};en=`tests committed on the checkout's merge commit (re-cut onto ${Fn.slice(0,12)} failed: ${Ne})`}}St&&Xt.writeFileSync(ue,k(St));for(let[ne,et]of Rt){if(St?.some(Ne=>Ne.file===ne))continue;let gt=tt(f,["--literal-pathspecs","ls-tree",l,"--",ne]);if(/^100(?:644|755) blob ([a-f0-9]+)\t/.exec(gt)?.[1]!==et)throw new Error(`the committed guarded file differs from the generated file: ${ne}`)}for(let{record:ne}of $e){if(ne.entry)continue;let et=tt(f,["--literal-pathspecs","ls-tree",l,"--",ne.file]);if(et&&et!==tt(f,["--literal-pathspecs","ls-tree",J,"--",ne.file]))throw new Error(`the delivery included executable source for a held test: ${ne.file}`)}let _t=s?{}:{repositoryPath:f,repoSlug:a,devPr:null};if(!u){let ne=await t.markTestsPrUnchanged({branch:c,..._t});return{thrown:!1,record:{schemaVersion:1,repository:a,branch:c,remote:I,base:b,committed:!1,commitSha:l,pushed:!1,prAction:ne.action==="unchanged"?"unchanged":"skipped",prUrl:ne.url,prTitle:E,unstaged:Dt,reason:ne.action==="unchanged"?"no test changes to commit \u2014 existing tests PR annotated as unchanged":"no test changes to commit \u2014 nothing pushed, no PR opened"}}}let At=await t.publishTestsPr({repositoryPath:f,..._t,remote:I,branch:c,base:b,commitSha:l,title:E,bodyFile:ue,mode:e.inputs.deliverMode,deliveryOwner:C,...e.inputs.firstQualification?{firstQualification:!0}:{},runUrl:e.inputs.skyrampRunUrl,signal:e.signal,deadlineMs:e.deadlineMs});return{thrown:!1,held:Un,record:{schemaVersion:1,repository:a,branch:c,remote:I,base:At.base,requestedBase:b,committed:u,commitSha:l,pushed:At.pushed,...At.pushedCommits?{pushedCommits:At.pushedCommits}:{},...At.deliveredCommit?{deliveredCommit:At.deliveredCommit}:{},prAction:At.action,...At.retargetedAs?{retargetedAs:At.retargetedAs}:{},prUrl:At.url,prTitle:E,...At.failure?{prFailure:At.failure,prDetail:At.detail}:{},...en?{cutNote:en}:{},...At.action==="skipped"&&At.detail?{reason:At.detail}:{},unstaged:Dt,...St?{heldBack:St}:{}}}}catch(f){return{thrown:!0,record:{schemaVersion:1,repository:a,branch:c,committed:u,commitSha:l,pushed:!1,prAction:"failed",...QEe(f),unstaged:[]}}}finally{if(p.length){try{tt(i.path,["reset"])}catch{}for(let f of p.reverse())try{f()}catch{}}}}o(PEe,"deliverRepository");var c6e={name:"deliver",timeoutMinutes:5,execute:SEe,validateInput:o(e=>{let t=oT(e);return t?{ok:!1,reasons:[t]}:AEe(e)},"validateInput"),requires:["report"],branchRequires:{runtime:["write"],"no-runtime":["generate-unit"]}};var UEe=10*6e4;function FEe(e,t){return e.getTime()-t.getTime()-UEe}o(FEe,"remainingBudgetMs");var OY="This attempt revoked its scoped GitHub credentials; it mints no more.";var OEe=10*6e4;var MEe=o(e=>!!e&&Object.keys(e).length===1&&e.contents==="read","onlyReads"),LEe=3e4,jEe=3,MY=30,li=class extends Error{constructor(n,i,r,s){super(n);this.status=i;this.code=r;this.path=s}status;code;path;static{o(this,"AppRefusal")}},Gi=class extends Error{static{o(this,"AppUnreachable")}},Rl=class extends Gi{static{o(this,"AppNotReady")}},QT=class extends Rl{static{o(this,"RunnerProviderNotReady")}};function xT(e){let t;try{t=new URL(e)}catch{throw new Error(`skyrampAppOrigin "${e}" is not a URL`)}if(t.protocol!=="https:"||t.origin!==e.replace(/\/+$/,""))throw new Error(`skyrampAppOrigin must be an https origin, got "${e}"`);return t.origin}o(xT,"appOrigin");function jY(e,t){if(!Cu.test(e))throw new Error(`The ${t} "${e}" is not a uuid`);return e}o(jY,"routeId");function GY(e,t,n,i){throw t<500&&t!==429?new li(e,t,n,i):t===503&&n==="RUNNER_PROVIDER_NOT_READY"?new QT(e):t===503&&n==="RUN_NOT_READY"?new Rl(e):new Gi(e)}o(GY,"refusedOrUnreachable");async function VY(e,t,n,i,r,s=1/0){let a=xT(e.origin),c=`The time limit for ${t} ${n} was reached`,u,l=0;for(let p=1;p<=jEe||u instanceof Rl;p+=1){if(u instanceof Rl){if(l===MY)throw u;l+=1,p-=1,e.log?.(`${u.message}; trying again (${l} of ${MY}).`),await new Promise(f=>setTimeout(f,Math.max(0,Math.min(e.readyWaitMs??1e4,s-Date.now()))))}else p>1&&await new Promise(f=>setTimeout(f,Math.max(0,Math.min((e.retryDelayMs??2e3)*(p-1),s-Date.now()))));if(Date.now()>=s)throw new Gi(c);try{let f,g=await(Number.isFinite(s)?Promise.race([e.idToken(a),new Promise((m,E)=>{f=setTimeout(()=>E(new Gi(c)),Math.max(1,s-Date.now()))})]).finally(()=>{f&&clearTimeout(f)}):e.idToken(a));if(Date.now()>=s)throw new Gi(c);let h=await(e.fetch??fetch)(new URL(n,a).toString(),{...i(g),redirect:"error",signal:AbortSignal.timeout(Math.max(1,Math.min(LEe,s-Date.now())))}).catch(m=>{throw new Gi(m instanceof Error?m.message:String(m),{cause:m})});return await r(h)}catch(f){if(f instanceof li||Date.now()>=s)throw f;u=f}}throw u}o(VY,"callWithRetries");function zY(e,t,n,i,r){let s=i.headers.get("cf-ray");e.log?.(`Testbot V3: ${t} ${n} answered ${i.status}${s?`, cf-ray ${s}`:""}: ${r.replace(/\s+/g," ").slice(0,200)}`)}o(zY,"logRefusal");function nI(e,t,n,i,r){let s=t==="GET"?void 0:JSON.stringify(i),a=t==="PUT"&&/^\/api\/v1\/runner\/attempts\/[^/]+\/report$/.test(n)&&s!==void 0&&Buffer.byteLength(s,"utf8")>Zh;if(a&&Buffer.byteLength(s,"utf8")>Zj)throw new Error("The report exceeds the app's 16 MiB expanded report limit");let c=a?new Uint8Array((0,LY.gzipSync)(s)):s;if(a&&c.length>Zh)throw new Error("The compressed report exceeds the app's 1 MiB report upload limit");return VY(e,t,n,o(l=>({method:t,headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json",Accept:"application/json",...a?{"Content-Encoding":"gzip"}:{}},body:c}),"request"),async l=>{let p=await l.text().catch(()=>""),f={};try{f=JSON.parse(p)}catch{}if(l.ok)return f.data;zY(e,t,n,l,p);let g=f.error?.fields,h=typeof g?.path=="string"&&typeof g.reason=="string"?` at ${g.path}: ${g.reason}`:"",m=`The Skyramp app refused ${t} ${n}: ${l.status} ${f.error?.code??"no error code"}${h}`;return GY(m,l.status,f.error?.code,typeof g?.path=="string"?g.path:void 0)},r)}o(nI,"callApp");function GEe(e,t,n){return VY(e,"GET",t,o(r=>({method:"GET",headers:{Authorization:`Bearer ${r}`,Accept:"application/octet-stream"}}),"request"),async r=>{if(!r.ok)return zY(e,"GET",t,r,await r.text().catch(()=>"")),GY(`The Skyramp app refused GET ${t}: ${r.status}`,r.status);let s=Buffer.from(await r.arrayBuffer());if(s.length>n)throw new li(`The Skyramp app answered GET ${t} with more than ${n} bytes`,r.status);return s})}o(GEe,"callAppBytes");var cA=class{constructor(t,n,i,r,s,a,c,u,l,p=[],f=[],g){this.attemptId=t;this.attemptNumber=n;this.deadlineAt=i;this.manifest=r;this.deps=s;this.license=a;this.requestedBy=c;this.writeAllowed=u;this.claudeCodeVersion=l;this.deployedPins=p;this.statedPins=f;this.runSettings=g}attemptId;attemptNumber;deadlineAt;manifest;deps;license;requestedBy;writeAllowed;claudeCodeVersion;deployedPins;statedPins;runSettings;static{o(this,"V3Attempt")}budgetMs(t){return FEe(this.deadlineAt,t)}get skyrampRunUrl(){return qj(xT(this.deps.origin),this.manifest.runId)}log(t){this.deps.log?.(t)}send(t,n,i,r){return nI(this.deps,t,n,i,r)}readBytes(t,n){return GEe(this.deps,t,n)}issuedTokens=[];closure;modelKey;modelCredentials=[];credentials={};revocation;token(){return this.cachedToken("run")}readOnlyToken(){return this.cachedToken("read")}async cachedToken(t){if(this.revocation)throw new Error(OY);let n=(this.deps.now??(()=>new Date))().getTime(),i=this.credentials[t],r=i&&await i.catch(()=>{});if(this.credentials[t]!==i)return(await this.credentials[t]).token;if(r&&r.expiresAt-n>=OEe)return r.token;if(this.revocation)throw new Error(OY);let s=t==="read",a=s?{schemaVersion:1,access:t}:{schemaVersion:1},c=s?"read-only":"scoped",u=this.send("POST",`/api/v1/runner/attempts/${this.attemptId}/credentials`,a).then(l=>{let p={...l,token:l.token??this.jobToken()};if(this.issuedTokens.push(p.token),this.deps.mask?.(p.token),p.anthropicApiKey&&this.deps.mask?.(p.anthropicApiKey),s&&l.token&&!MEe(p.permissions))throw new Error(`The Skyramp app was asked for a read-only GitHub token, but its token grants ${JSON.stringify(p.permissions??null)}`);!s&&!r&&p.anthropicApiKey&&(this.modelKey=p.anthropicApiKey),this.deps.onTokenGranted?.(t);let f=r?"Renewed":"Received";return l.token&&this.deps.log?.(`${f} ${c} GitHub credentials; they expire at ${p.expiresAt}.`),{token:p.token,expiresAt:l.token?new Date(p.expiresAt).getTime():Number.POSITIVE_INFINITY}},l=>{if(this.deps.onTokenRefused?.(l,t),!(l instanceof li)||l.code!=="CREDENTIALS_UNAVAILABLE")throw l;let p=o(h=>[...new Set(h.map(m=>m.namespace))].join(", "),"unique"),f=this.manifest.sources.map(h=>h.repository);if(new Set(f.map(h=>h.providerAccountId)).size>1)throw new li(`${l.message}. The run's repositories are on more than one GitHub account (${p(f)}), which Skyramp does not support yet.`,l.status,l.code);let g=p([...f,this.manifest.execution.repository]);throw new li(`${l.message}. Check the Skyramp GitHub App installation on ${g}: it must be installed and not suspended, have access to these repositories, and have accepted the App's current permissions. Each account must also be connected to your Skyramp organization.`,l.status,l.code)});return this.credentials[t]=u,(await u).token}jobToken(){if(this.deps.sourceToken)return this.deps.sourceToken;throw new Error("The app answered the credentials request without a token, and the job gave Testbot none of its own: on Azure Pipelines, set SYSTEM_ACCESSTOKEN to $(System.AccessToken) in the Testbot step's env.")}sourceFetch(t){return t.fetch??this.deps.fetch??fetch}revokeTokens(t={}){let n=t.host??M0();return this.revocation??=n.revokeToken?this.revokeIssued(i=>n.revokeToken(i,this.sourceFetch(t))):Promise.resolve([]),this.revocation}async revokeIssued(t){let n=[...this.issuedTokens],i=Promise.all(n.map(a=>this.revokeOne(a,t)));await Promise.all(Object.values(this.credentials).map(a=>a.catch(()=>{})));let r=this.issuedTokens.filter(a=>!n.includes(a));return[...await i,...await Promise.all(r.map(a=>this.revokeOne(a,t)))].filter(a=>a!==void 0)}async revokeOne(t,n){try{await n(t);return}catch(i){return`token ${this.issuedTokens.indexOf(t)+1} of ${this.issuedTokens.length}: ${i instanceof Error?i.message:String(i)}`}}};async function qY(e,t,n){jY(e,"run id"),xT(n.origin);let i=RC(e,t),r=`/api/v1/runner/runs/${e}/attempts`,s;try{s=await nI(n,"POST",r,i)}catch(l){if(!(l instanceof li&&l.status===400&&l.path==="$.statedPins"))throw l;i=RC(e,t,{statedPins:!1}),s=await nI(n,"POST",r,i)}let a=y1(s);if(a.manifest.runId!==e)throw new Error(`The app answered the handshake of run ${e} with the manifest of another run (${a.manifest.runId})`);let c=a.manifest.sources.find(l=>l.repository.provider!==i.execution.provider);if(c)throw new Error(`The manifest of run ${e} names ${c.repository.namespace}/${c.repository.name} on ${c.repository.provider}, but this job runs on ${i.execution.provider}`);VEe(a.manifest,[...a.deployedRevisions??[],...a.statedRevisions??[]]),a.runToken&&n.mask?.(a.runToken);let u=a.runToken?{entitlements:a.entitlements??[],runToken:a.runToken}:void 0;return new cA(a.attempt.id,a.attempt.number,new Date(a.attempt.deadlineAt),a.manifest,n,u,a.requestedBy??void 0,a.writeAllowed,a.claudeCodeVersion??void 0,a.deployedRevisions??[],a.statedRevisions??[],a.runSettings)}o(qY,"startV3Attempt");function VEe(e,t){if(t.length===0)return;if(!i1(e))throw new Error(`The app pinned an attempt of a ${e.trigger.kind} run; only a scheduled run or unchosen manual run's retry is pinned to an earlier attempt's read`);let n=new Set(e.sources.map(r=>Ti(r.repository))),i=new Set;for(let r of t){let s=Ti(r.repository);if(!n.has(s))throw new Error(`The app pinned the attempt to repository ${r.repository.providerRepositoryId}, which is not a source of the run`);if(i.has(s))throw new Error(`The app pinned repository ${r.repository.providerRepositoryId} twice`);i.add(s)}}o(VEe,"checkAttemptPins");async function $T(e,t){return A1.parse(await e.send("POST",`/api/v1/runner/attempts/${e.attemptId}/heartbeat`,{schemaVersion:1},t))}o($T,"heartbeatV3Attempt");async function JY(e,t=()=>new Date,n){if(e.closure)return e.closure;let i=await $T(e,n).then(r=>g1(r,t())).catch(()=>null);return i&&(e.closure=i),i}o(JY,"closedV3Attempt");var oKe=10*6e4;var aKe=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE"];var cKe=d.object({tests:d.object({placements:d.array(d.unknown()).optional()}).passthrough().optional()}).passthrough(),uKe=d.object({repository:wC,testType:d.string(),directory:d.string()}).passthrough();var lKe=d.object({report:d.object({language:d.string()}).passthrough()}).passthrough();var dKe=d.object({environment:d.object({components:d.array(d.unknown()).optional(),dependencies:d.array(d.unknown()).optional()}).passthrough()}).passthrough(),pKe=d.object({environment:d.object({offLimits:d.unknown().optional()}).passthrough()}).passthrough();var fKe=d.object({environment:d.object({allowedEgress:d.unknown().optional()}).passthrough()}).passthrough();var AKe=d.object({name:d.string().min(1),provision:d.literal("existing"),url:d.string().min(1),repository:wC.optional(),revisionUrl:d.string().min(1).optional()}).passthrough(),gKe=d.object({name:d.string().min(1),url:d.string().nullable(),versionUrl:d.string().nullable(),notes:d.string().nullable()}).passthrough();var hKe=new Set(["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"]);function HY(e){let t=o(n=>e.testResults.filter(i=>i.status===n).length,"count");return{passed:t("Pass"),failed:t("Fail"),skipped:t("Skipped")}}o(HY,"statusCounts");function zEe(e){let{passed:t,failed:n,skipped:i}=HY(e);return t+n===0?{sufficiency:"insufficient",rationale:i>0?`Every test was skipped (${i}), so nothing was validated.`:"No test ran, so nothing was validated.",gaps:["No test ran against the frozen sources."],acceptedEvidence:[],actionRequired:[]}:{sufficiency:"sufficient",rationale:`${t+n} tests ran against the frozen sources: ${t} passed, ${n} failed${i?`, ${i} skipped`:""}.`,gaps:[],acceptedEvidence:[],actionRequired:[]}}o(zEe,"executedTestsValidation");function qEe(e,t){let n=e.map(c=>({result:c,repository:c.repository??t,path:c.fileName||c.testType})),i=new Map;for(let c of n){let u=`${c.repository}:${c.result.testType}:${c.path}`;i.set(u,(i.get(u)??0)+1)}let r=n.map(({result:c,repository:u,path:l})=>{let p=(i.get(`${u}:${c.testType}:${l}`)??0)>1;return c.resultId??SC(u,c.testType,l,p&&c.endpoint||void 0)}),s=new Map;for(let c of r)s.set(c,(s.get(c)??0)+1);let a=new Set(r.filter(c=>s.get(c)===1));return n.map(({result:c,repository:u},l)=>{let p=r[l],f=p;if(s.get(p)>1&&a.has(p))for(let g=2;a.has(f)||f===p;g+=1)f=p.includes("#")?`${p}.${g}`:`${p}#${g}`;return a.add(f),{...c,repository:u,resultId:f}})}o(qEe,"withResultIds");function JEe({notTranslated:e,...t},n){let i=qEe(t.testResults,n);return{...t,testResults:i,...HEe(t,i,n),validation:ZEe(KEe(t,YEe(t,t.validation??zEe(t)))),traceVersion:1}}o(JEe,"v3Report");function HEe(e,t,n){if(!e.testExecutionContexts)return{};let i=new Set,r=o(c=>{let u=c;for(let l=2;i.has(u);l+=1)u=`${c}#${l}`;return i.add(u),u},"unique"),s=[],a=new Map;for(let{repository:c,...u}of e.testExecutionContexts){let l=u.status==="not_run"?[]:t.filter(p=>p.fileName===u.test&&p.repository===(c?.trim()||n));l.length||s.push(u);for(let{resultId:p}of l){let f=a.get(p),g=f!==void 0&&s[f].cleanup.status==="failed"?s[f].cleanup:u.cleanup,h={...u,cleanup:g,test:p,resultId:p};f===void 0?a.set(p,s.push(h)-1):s[f]=h}}for(let c of s)c.resultId&&i.add(c.resultId);return{testExecutionContexts:s.map(c=>c.resultId?c:{...c,test:r(c.test.slice(0,512))}).slice(0,5e3)}}o(HEe,"linkedContexts");function YEe(e,t){let{passed:n,failed:i}=HY(e);return t.sufficiency!=="sufficient"||n+i>0||t.acceptedEvidence.length>0?t:{...t,sufficiency:"insufficient",gaps:["No test ran and no existing evidence was accepted, so nothing was validated."]}}o(YEe,"withEvidence");var WEe={"model-provider-denied":"model_provider_denied","model-provider-unavailable":"model_provider_unavailable"};function ZEe(e){return{...e,gaps:kf(e.gaps)}}o(ZEe,"boundedGaps");function KEe(e,t){if(t.sufficiency==="sufficient")return t;let n=(e.caveats??[]).map(r=>WEe[r.kind]).filter(r=>r!==void 0),i=[...new Set(n)].filter(r=>!t.actionRequired.includes(r));return i.length?{...t,actionRequired:[...i,...t.actionRequired]}:t}o(KEe,"withModelProviderFailure");function XEe(e,t,n){let{language:i,report:r}=t;if(i==="en")return;let s={language:i,businessCaseAnalysis:r.businessCaseAnalysis},a=o((m,E,v)=>Array.isArray(m)&&Array.isArray(E)&&m.length===E.length?m.map(I=>({[v]:I[v]})):void 0,"rows"),c=e.validation;r.validation&&c&&c.rationale===n.validation.rationale&&JSON.stringify(kf(c.gaps))===JSON.stringify(n.validation.gaps)&&kf(r.validation.gaps).length===n.validation.gaps.length&&(s.validation={rationale:r.validation.rationale,gaps:kf(r.validation.gaps)});let u=new Set((n.changes??[]).map(m=>m.id)),l=(r.changes??[]).filter(m=>u.has(m.id)).map(({id:m,text:E})=>({id:m,text:E}));l.length&&(s.changes=l);let p=a(r.issuesFound,n.issuesFound,"description");p&&(s.issuesFound=p);let f=a(r.newTestsCreated,n.newTestsCreated,"description");f&&(s.newTestsCreated=f);let g=a(r.testResults,n.testResults,"details");g&&(s.testResults=g);let h=a(r.caveats,n.caveats,"text");return h&&(s.caveats=h),s}o(XEe,"v3Display");async function YY(e,t){let n=YL([...e.issuedTokens,...t.secrets??[]]),i={...JEe(t.report,t.workingSlug),...t.notTranslated?{notTranslated:t.notTranslated}:{}},r=t.translated&&XEe(t.report,t.translated,i),s=o(c=>E1({manifest:e.manifest,attemptNumber:e.attemptNumber,checkedOut:t.sources.map(u=>({repository:u.repository,revision:u.revision})),firstQualification:t.firstQualification,generatedTests:uu(t.delivery,n),producer:t.producer,report:uu(c&&r?{...i,display:r}:i,n),githubWrites:t.githubWrites}),"build"),a=s(!0);r&&Buffer.byteLength(JSON.stringify(a),"utf8")>Zh&&(a=s(!1)),await e.send("PUT",`/api/v1/runner/attempts/${e.attemptId}/report`,a)}o(YY,"uploadV3Report");async function TT(e,t,n){if(!d.string().uuid().safeParse(t).success)return{refusal:"no_environment"};let i;try{i=f1.parse(await e.send("GET",Mj.persistentDataPolicy.replace(":attemptId",e.attemptId),void 0))}catch{return{refusal:"unavailable"}}try{if(!i.environmentAddress||new URL(i.environmentAddress).href!==new URL(n).href)return{refusal:"changed"}}catch{return{refusal:"changed"}}if(i.environmentId!==t)return{refusal:"changed"};let r=i.persistentDataPolicy;return r?r.environmentId===t?{policy:r}:{refusal:"changed"}:{refusal:"denied"}}o(TT,"fetchV3PersistentDataPolicy");async function WY(e,t,n){let{environmentId:i,environmentAddress:r}=t;if(!i||!r)return{allowed:!1,refusal:"no_environment"};let s=t.persistentDataPolicy;if(!s?.allowed||s.environmentId!==i)return{allowed:!1,refusal:"no_recorded_grant"};let a=await TT(e,i,r);return"refusal"in a?{allowed:!1,refusal:a.refusal}:a.policy.allowed?a.policy.revision!==s.revision?{allowed:!1,refusal:"changed"}:Mh(t,a.policy,n)?{allowed:!0,policy:a.policy}:{allowed:!1,refusal:"out_of_scope"}:{allowed:!1,refusal:"denied"}}o(WY,"currentV3PersistenceDecision");async function ZY(e,t){return jY(e.attemptId,"attempt id"),nI(t,"POST",`/api/v1/runner/attempts/${e.attemptId}/end`,I1({reportUploaded:e.reportUploaded,recipeUploaded:e.recipeUploaded,revisionsUploaded:e.revisionsUploaded,cancelled:e.cause==="cancelled",timedOut:e.cause==="timed_out",setupFailed:e.cause==="setup_failed",checkoutFailed:e.cause==="checkout_failed"||e.cause==="merge_conflict"&&!e.conflict,mergeConflict:e.cause==="merge_conflict"?e.conflict:void 0,environmentUnverified:e.cause==="environment_unverified",runnerProviderNotReady:e.cause==="runner_provider_not_ready",credentialMissing:e.cause==="credential_missing",modelProviderDenied:e.cause==="model_provider_denied",modelProviderUnavailable:e.cause==="model_provider_unavailable",githubWrites:e.githubWrites,environmentUnavailable:e.cause==="environment_unavailable"}))}o(ZY,"endV3Attempt");0&&(module.exports={AppRefusal,AppUnreachable,AttemptEndReason,DeliveryStatus,GitHubWriteKind,NoReportCause,SourceProvider,TARGET_ENVIRONMENT_KEYS,V3Attempt,ValidationSufficiency,closedV3Attempt,currentV3PersistenceDecision,endV3Attempt,fetchV3PersistentDataPolicy,heartbeatV3Attempt,startV3Attempt,uploadV3Report});
|
|
239
239
|
/*! Bundled license information:
|
|
240
240
|
|
|
241
241
|
undici/lib/web/fetch/body.js:
|