@skyramp/testbot-core 0.13.0-v3.282 → 0.13.0-v3.283

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/post.js CHANGED
@@ -113,7 +113,7 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}fun
113
113
  `+p.slice(S,v),S=v+1),I=x;return _+=`
114
114
  `,p.length-S>m&&I>S?_+=p.slice(S,I)+`
115
115
  `+p.slice(I+1):_+=p.slice(S),_.slice(1)}function Bt(p){let m="",E=0;for(let Q=0;Q<p.length;E>=65536?Q+=2:Q++){E=ut(p,Q);let S=ae[E];!S&&wt(E)?(m+=p[Q],E>=65536&&(m+=p[Q+1])):m+=S||Pe(E)}return m}function mi(p,m,E){let Q="",S=p.tag;for(let v=0,I=E.length;v<I;v+=1){let x=E[v];p.replacer&&(x=p.replacer.call(E,String(v),x)),(g(p,m,x,!1,!1)||typeof x>"u"&&g(p,m,null,!1,!1))&&(Q!==""&&(Q+=","+(p.condenseFlow?"":" ")),Q+=p.dump)}p.tag=S,p.dump="["+Q+"]"}function Kn(p,m,E,Q){let S="",v=p.tag;for(let I=0,x=E.length;I<x;I+=1){let _=E[I];p.replacer&&(_=p.replacer.call(E,String(I),_)),(g(p,m+1,_,!0,!0,!1,!0)||typeof _>"u"&&g(p,m+1,null,!0,!0,!1,!0))&&((!Q||S!=="")&&(S+=ct(p,m)),p.dump&&c===p.dump.charCodeAt(0)?S+="-":S+="- ",S+=p.dump)}p.tag=v,p.dump=S||"[]"}function yi(p,m,E){let Q="",S=p.tag,v=Object.keys(E);for(let I=0,x=v.length;I<x;I+=1){let _="";Q!==""&&(_+=", "),p.condenseFlow&&(_+='"');let P=v[I],L=E[P];p.replacer&&(L=p.replacer.call(E,P,L)),g(p,m,P,!1,!1)&&(p.dump.length>1024&&(_+="? "),_+=p.dump+(p.condenseFlow?'"':"")+":"+(p.condenseFlow?"":" "),g(p,m,L,!1,!1)&&(_+=p.dump,Q+=_))}p.tag=S,p.dump="{"+Q+"}"}function Ei(p,m,E,Q){let S="",v=p.tag,I=Object.keys(E);if(p.sortKeys===!0)I.sort();else if(typeof p.sortKeys=="function")I.sort(p.sortKeys);else if(p.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let x=0,_=I.length;x<_;x+=1){let P="";(!Q||S!=="")&&(P+=ct(p,m));let L=I[x],q=E[L];if(p.replacer&&(q=p.replacer.call(E,L,q)),!g(p,m+1,L,!0,!0,!0))continue;let J=p.tag!==null&&p.tag!=="?"||p.dump&&p.dump.length>1024;J&&(p.dump&&c===p.dump.charCodeAt(0)?P+="?":P+="? "),P+=p.dump,J&&(P+=ct(p,m)),g(p,m+1,q,!0,J)&&(p.dump&&c===p.dump.charCodeAt(0)?P+=":":P+=": ",P+=p.dump,S+=P)}p.tag=v,p.dump=S||"{}"}function a(p,m,E){let Q=E?p.explicitTypes:p.implicitTypes;for(let S=0,v=Q.length;S<v;S+=1){let I=Q[S];if((I.instanceOf||I.predicate)&&(!I.instanceOf||typeof m=="object"&&m instanceof I.instanceOf)&&(!I.predicate||I.predicate(m))){if(E?I.multi&&I.representName?p.tag=I.representName(m):p.tag=I.tag:p.tag="?",I.represent){let x=p.styleMap[I.tag]||I.defaultStyle,_;if(r.call(I.represent)==="[object Function]")_=I.represent(m,x);else if(s.call(I.represent,x))_=I.represent[x](m,x);else throw new e("!<"+I.tag+'> tag resolver accepts not "'+x+'" style');p.dump=_}return!0}}return!1}function g(p,m,E,Q,S,v,I){p.tag=null,p.dump=E,a(p,E,!1)||a(p,E,!0);let x=r.call(p.dump),_=Q;Q&&(Q=p.flowLevel<0||p.flowLevel>m);let P=x==="[object Object]"||x==="[object Array]",L,q;if(P&&(L=p.duplicates.indexOf(E),q=L!==-1),(p.tag!==null&&p.tag!=="?"||q||p.indent!==2&&m>0)&&(S=!1),q&&p.usedDuplicates[L])p.dump="*ref_"+L;else{if(P&&q&&!p.usedDuplicates[L]&&(p.usedDuplicates[L]=!0),x==="[object Object]")Q&&Object.keys(p.dump).length!==0?(Ei(p,m,p.dump,S),q&&(p.dump="&ref_"+L+p.dump)):(yi(p,m,p.dump),q&&(p.dump="&ref_"+L+" "+p.dump));else if(x==="[object Array]")Q&&p.dump.length!==0?(p.noArrayIndent&&!I&&m>0?Kn(p,m-1,p.dump,S):Kn(p,m,p.dump,S),q&&(p.dump="&ref_"+L+p.dump)):(mi(p,m,p.dump),q&&(p.dump="&ref_"+L+" "+p.dump));else if(x==="[object String]")p.tag!=="?"&&$r(p,p.dump,m,v,_);else{if(x==="[object Undefined]")return!1;if(p.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+x)}if(p.tag!==null&&p.tag!=="?"){let J=encodeURI(p.tag[0]==="!"?p.tag.slice(1):p.tag).replace(/!/g,"%21");p.tag[0]==="!"?J="!"+J:J.slice(0,18)==="tag:yaml.org,2002:"?J="!!"+J.slice(18):J="!<"+J+">",p.dump=J+" "+p.dump}}return!0}function w(p,m){let E=[],Q=[];b(p,E,Q);let S=Q.length;for(let v=0;v<S;v+=1)m.duplicates.push(E[Q[v]]);m.usedDuplicates=new Array(S)}function b(p,m,E){if(p!==null&&typeof p=="object"){let Q=m.indexOf(p);if(Q!==-1)E.indexOf(Q)===-1&&E.push(Q);else if(m.push(p),Array.isArray(p))for(let S=0,v=p.length;S<v;S+=1)b(p[S],m,E);else{let S=Object.keys(p);for(let v=0,I=S.length;v<I;v+=1)b(p[S[v]],m,E)}}}function C(p,m){m=m||{};let E=new Oe(m);E.noRefs||w(p,E);let Q=p;return E.replacer&&(Q=E.replacer.call({"":Q},"",Q)),g(E,0,Q,!0,!0)?E.dump+`
116
- `:""}return gE.dump=C,gE}var JT;function HJ(){if(JT)return Pt;JT=1;let t=GJ(),e=jJ();function n(r,s){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}return Pt.Type=Jt(),Pt.Schema=WT(),Pt.FAILSAFE_SCHEMA=XT(),Pt.JSON_SCHEMA=s0(),Pt.CORE_SCHEMA=i0(),Pt.DEFAULT_SCHEMA=mE(),Pt.load=t.load,Pt.loadAll=t.loadAll,Pt.dump=e.dump,Pt.YAMLException=Hu(),Pt.types={binary:c0(),float:r0(),map:ZT(),null:e0(),pairs:l0(),set:d0(),timestamp:o0(),bool:t0(),int:n0(),merge:a0(),omap:u0(),seq:KT(),str:zT()},Pt.safeLoad=n("safeLoad","load"),Pt.safeLoadAll=n("safeLoadAll","loadAll"),Pt.safeDump=n("safeDump","dump"),Pt}var qJ=HJ(),YJ=$J(qJ),{Type:e7,Schema:t7,FAILSAFE_SCHEMA:n7,JSON_SCHEMA:A0,CORE_SCHEMA:r7,DEFAULT_SCHEMA:s7,load:ds,loadAll:JJ,dump:i7,YAMLException:o7,types:a7,safeLoad:c7,safeLoadAll:u7,safeDump:l7}=YJ;var As=t=>typeof t=="string"?t:void 0;function f0(t){let e={services:[]},n;try{let l=p0.readFileSync(t,"utf8");n=ds(l,{schema:A0})}catch(l){return He(`Lenient parse: failed to read/parse ${t}: ${l.message}`),e}if(!n||typeof n!="object"||Array.isArray(n))return He(`Lenient parse: ${t} did not contain a YAML object`),e;let r=n,s=r.metadata&&typeof r.metadata=="object"?r.metadata:void 0,i=s?{executorVersion:As(s.executorVersion),mcpVersion:As(s.mcpVersion)}:void 0,c=(Array.isArray(r.services)?r.services:[]).reduce((l,d,A)=>{if(!d||typeof d!="object"||Array.isArray(d))return He(`Lenient parse: services[${A}] is not an object \u2014 skipping`),l;let f=d,h=As(f.serviceName);if(!h)return He(`Lenient parse: services[${A}] missing or non-string serviceName \u2014 skipping`),l;let y=f.api&&typeof f.api=="object"?f.api:void 0,B=f.runtimeDetails&&typeof f.runtimeDetails=="object"?f.runtimeDetails:void 0;return l.push({serviceName:h,language:As(f.language),framework:As(f.framework),testDirectory:As(f.testDirectory),api:y?{baseUrl:As(y.baseUrl)}:void 0,runtimeDetails:B?{serverStartCommand:As(B.serverStartCommand),serverTeardownCommand:As(B.serverTeardownCommand)}:void 0}),l},[]);return{metadata:i,services:c}}async function g0(t){let e=h0.resolve(t.workingDirectory),n=new op(e),r=[],s=t.targetSetupCommand,i=t.targetTeardownCommand,o=t.skyrampExecutorVersion,c=t.skyrampMcpVersion;if(await n.exists()){Dn(`Found ${n.getConfigPath()}, loading workspace configuration...`);try{let d;try{d=await n.read()}catch(f){He(`${n.getConfigPath()} failed strict validation: ${f.message}. Re-reading with per-field lenient parse \u2014 invalid fields will fall back to action input defaults.`),d=f0(n.getConfigPath())}d.metadata&&(!o&&d.metadata.executorVersion&&(o=d.metadata.executorVersion),!c&&d.metadata.mcpVersion&&(c=d.metadata.mcpVersion));for(let f of d.services??[])r.push({serviceName:f.serviceName,language:f.language,framework:f.framework,baseUrl:f.api?.baseUrl,testDirectory:f.testDirectory});let A=(d.services??[])[0];if(A){!s&&A.runtimeDetails?.serverStartCommand&&(s=A.runtimeDetails.serverStartCommand);let f=A.runtimeDetails?.serverTeardownCommand;!i&&typeof f=="string"&&(i=f)}}catch(d){He(`Failed to parse ${n.getConfigPath()}: ${d.message} \u2014 falling back to action input defaults`)}}else Mu("No .skyramp/workspace.yml found, using action input defaults");o||(o="v1.3.54"),c||(c="latest"),s||(s="docker compose up -d --build");let l={targetSetupCommand:s,authTokenCommand:t.authTokenCommand,targetTeardownCommand:i,skipTargetTeardown:t.skipTargetTeardown,skyrampExecutorVersion:o,skyrampMcpVersion:c,skyrampMcpSource:t.skyrampMcpSource,skyrampMcpGithubRef:t.skyrampMcpGithubRef,nodeVersion:t.nodeVersion,skipTargetSetup:t.skipTargetSetup,targetReadyCheckCommand:t.targetReadyCheckCommand,targetReadyCheckTimeout:t.targetReadyCheckTimeout,targetReadyCheckInterval:t.targetReadyCheckInterval,targetReadyCheckDiagnosticsCommand:t.targetReadyCheckDiagnosticsCommand,autoCommit:t.autoCommit,commitMessage:t.commitMessage,generatedTestsMode:t.generatedTestsMode,postPrComment:t.postPrComment,testExecutionTimeout:t.testExecutionTimeout,maxRecommendations:t.maxRecommendations,maxGenerate:t.maxGenerate,perTestMaxFixAttempts:t.perTestMaxFixAttempts,testbotMaxRetries:t.testbotMaxRetries,testbotRetryDelay:t.testbotRetryDelay,testbotTimeout:t.testbotTimeout,targetSetupRetries:t.targetSetupRetries,targetSetupRetryDelay:t.targetSetupRetryDelay,authTokenRetries:t.authTokenRetries,authTokenRetryDelay:t.authTokenRetryDelay,reportCollapsed:t.reportCollapsed,language:t.language,enableDebug:t.enableDebug,testRepoPath:t.testRepoPath,relatedRepoPaths:t.relatedRepoPaths,services:r};$A("Resolved configuration");for(let[d,A]of Object.entries(l))d==="authTokenCommand"?Dn(` ${d}: [REDACTED]`):d==="services"?Dn(` ${d}: ${JSON.stringify(A)}`):Dn(` ${d}: ${A}`);return VA(),l}qt();qt();ly();var y0=ce(require("child_process")),yE=class extends Error{constructor(e){super(e),this.name="ExecTimeoutError"}},cp=class extends Error{constructor(e){super(e),this.name="ExecAbortedError"}};function m0(t,e){if(!(!t||t.destroyed||t.writableEnded))try{t.write(e)}catch(n){He(`stream write failed: ${n instanceof Error?n.message:String(n)}`)}}async function E0(t,e=[],n={}){let r="",s="",i={cwd:n.cwd,silent:n.silent??!1,ignoreReturnCode:n.ignoreReturnCode??!1,env:n.env?{...process.env,...n.env}:void 0,input:n.input,listeners:{stdout:c=>{r+=c.toString(),m0(n.stdoutStream,c)},stderr:c=>{s+=c.toString()}}};if(n.timeout||n.signal){let c=n.signal;return c?.aborted?Promise.reject(new cp(`Command aborted before start: ${t}`)):new Promise((l,d)=>{let A=y0.spawn(t,e,{cwd:n.cwd,env:n.env?{...process.env,...n.env}:process.env,stdio:["pipe","pipe","pipe"],shell:!1});A.stdout?.on("data",R=>{r+=R.toString(),n.silent||process.stdout.write(R),m0(n.stdoutStream,R)}),A.stderr?.on("data",R=>{s+=R.toString(),n.silent||process.stderr.write(R)}),n.input&&A.stdin?.end(n.input);let f=()=>{B&&clearTimeout(B),c?.removeEventListener("abort",y)},h=R=>{f();try{A.kill("SIGTERM")}catch{}d(R)},y=()=>h(new cp(`Command aborted: ${t}`)),B=n.timeout?setTimeout(()=>h(new yE(`Command timed out after ${Math.round(n.timeout/6e4)}m: ${t}`)),n.timeout):void 0;c?.addEventListener("abort",y,{once:!0}),A.on("close",R=>{f();let F=R??1;F!==0&&!n.ignoreReturnCode?d(new Error(`The process '${t}' failed with exit code ${F}`)):l({exitCode:F,stdout:r,stderr:s})}),A.on("error",R=>{f(),d(R)})})}return{exitCode:await Zk(t,e,i),stdout:r,stderr:s}}async function C0(t,e){$A(t);try{return await e()}finally{VA()}}async function I0(t,e){await C0("Tearing down services",async()=>{if(t.skipTargetTeardown){Mu("Skipping service teardown (skipTargetTeardown=true)");return}if(!t.targetTeardownCommand){Dn("No targetTeardownCommand configured, skipping teardown");return}Dn(`Running teardown command: ${t.targetTeardownCommand}`);try{await E0("bash",["-c",t.targetTeardownCommand],{cwd:e}),Mu("Services torn down successfully")}catch(n){let r=n instanceof Error?n.message:String(n);He(`Service teardown command failed (non-fatal): ${r}`)}})}qt();qt();var fo=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(fo||{});var EE=t=>`${t.source}:${t.site??""}:${t.key}`;var qu=/^pasted-[0-9a-f]{16}$/,Za=/^file-[0-9a-f]{16}$/,Yu=(s=>(s.Pdf="application/pdf",s.Csv="text/csv",s.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",s))(Yu||{}),Ju=t=>t.trim().toUpperCase(),w0=(t,e)=>{let n=t.trim();return qu.test(n.toLowerCase())?"Pasted text":Za.test(n.toLowerCase())?e?.get(Ju(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()};var up=(r=>(r.New="new",r.Updated="updated",r.Existing="existing",r))(up||{}),ho=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r.NoChange="no_change",r))(ho||{}),Xa=(k=>(k.RelatedChangeConflict="related_change_conflict",k.ReferenceOutsideTarget="reference_outside_target",k.SourceAccessLost="source_access_lost",k.ConfigurationIncomplete="configuration_incomplete",k.CredentialUnavailable="credential_unavailable",k.WorkflowBindingUnverified="workflow_binding_unverified",k.WorkflowRefUnprotected="workflow_ref_unprotected",k.BedrockWorkflowRequired="bedrock_workflow_required",k.DeploymentReview="deployment_review",k.SutRevisionMismatch="sut_revision_mismatch",k.IsolationUnavailable="isolation_unavailable",k.EvidenceInsufficient="evidence_insufficient",k.ConfigurationUnresolved="configuration_unresolved",k.ModelProviderDenied="model_provider_denied",k.ModelProviderUnavailable="model_provider_unavailable",k.RunnerProviderNotReady="runner_provider_not_ready",k.MergeConflict="merge_conflict",k))(Xa||{}),Ks=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(Ks||{}),lp=(r=>(r.Application="application",r.Environment="environment",r.TestDefect="test_defect",r))(lp||{}),dp=(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))(dp||{});var Ap=(n=>(n.Probe="probe",n.Agent="agent",n))(Ap||{}),pp=(r=>(r.Seed="seed",r.RuntimeMock="runtime_mock",r.EnvOverride="env_override",r))(pp||{}),fp=(r=>(r.TestCode="test_code",r.SkyrampMocker="skyramp_mocker",r.RecipeOverride="recipe_override",r))(fp||{});var ec=t=>t.slice(0,12);var zJ=["generate-unit","native-run"],I7=["preflight","plan","write",...zJ,"report","deliver"];var gp=(r=>(r.Unit="unit",r.Integration="integration",r.E2e="e2e",r))(gp||{});var Ql=ce(require("path"));var mp="\xABredacted\xBB";function KJ(t){return t.replace(/AUTHORIZATION: (basic|bearer) \S+/gi,"AUTHORIZATION: $1 ***").replace(/x-access-token:[^@\s]+@/gi,"x-access-token:***@")}function bn(t,e){if(!t||e.length===0)return t;let n=t;for(let r of e)!r||!n.includes(r)||(n=n.split(r).join(mp));return n}function yp(t,e){return bn(KJ(t),e)}var R7=new TextDecoder("utf-8",{fatal:!0});function yt(t,e=[]){let n=t.trim();if(!n)return{error:"session produced no output"};let r=l=>{try{let d=JSON.parse(l);return typeof d=="object"&&d!==null&&!Array.isArray(d)?d:void 0}catch{return}},s=r(n);if(s!==void 0)return{value:s};let i;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(l){i=l instanceof Error?l.message:String(l)}let o=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let l=o.length-1;l>=0;l--){let d=r(o[l][1].trim());if(d!==void 0)return{value:d}}let c;for(let l=n.indexOf("{");l!==-1;l=n.indexOf("{",l+1)){let d=0,A=!1,f=!1;for(let h=l;h<n.length;h++){let y=n[h];if(f){f=!1;continue}if(y==="\\"){f=A;continue}if(y==='"'){A=!A;continue}if(!A){if(y==="{")d++;else if(y==="}"&&(d--,d===0)){let B=r(n.slice(l,h+1));B!==void 0&&Object.keys(B).length>0&&(c=B,l=h);break}}}}return i&&(c===void 0||Object.keys(c).length<3)?{error:`final message is not valid JSON \u2014 ${i}. 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}:i?{error:`final message is not valid JSON \u2014 ${i}. 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: "${ZJ(bn(n,e))}"`}}var b0=240;function ZJ(t){let e=t.replace(/\s+/g," ").trim();return e.length<=b0?e:`\u2026${e.slice(-b0)}`}var Wu=ce(require("fs")),zu=ce(require("path"));var XJ=8;function kt(t,e,n={}){let r=e.slice(0,XJ),s=e.length-r.length;return{name:t,passed:!1,details:r.join("; ")+(s>0?`; \u2026and ${s} more`:""),...n.fatal?{fatal:!0}:{}}}function go(t){if(Wu.existsSync(t))try{return JSON.parse(Wu.readFileSync(t,"utf-8"))}catch{return}}function Ze(t,e){return go(zu.join(t.outputsDir,e))}function Un(t,e){return{name:t,verify(n,r){let{errors:s}=e(n,r);return s.length===0?{name:this.name,passed:!0}:kt(this.name,s,{fatal:!0})}}}function Ku(t){return t.replace(/\s+/g," ").trim()}var Ep=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 u={};Cf(u,{BRAND:()=>QW,DIRTY:()=>mo,EMPTY_PATH:()=>rW,INVALID:()=>Ae,NEVER:()=>uz,OK:()=>Lt,ParseStatus:()=>xt,Schema:()=>Se,ZodAny:()=>ei,ZodArray:()=>gs,ZodBigInt:()=>Eo,ZodBoolean:()=>Co,ZodBranded:()=>Xu,ZodCatch:()=>To,ZodDate:()=>Io,ZodDefault:()=>xo,ZodDiscriminatedUnion:()=>wp,ZodEffects:()=>On,ZodEnum:()=>Ro,ZodError:()=>on,ZodFirstPartyTypeKind:()=>ge,ZodFunction:()=>Bp,ZodIntersection:()=>Qo,ZodIssueCode:()=>G,ZodLazy:()=>So,ZodLiteral:()=>vo,ZodMap:()=>ac,ZodNaN:()=>uc,ZodNativeEnum:()=>ko,ZodNever:()=>lr,ZodNull:()=>bo,ZodNullable:()=>Fr,ZodNumber:()=>yo,ZodObject:()=>an,ZodOptional:()=>Pn,ZodParsedType:()=>X,ZodPipeline:()=>el,ZodPromise:()=>ti,ZodReadonly:()=>No,ZodRecord:()=>bp,ZodSchema:()=>Se,ZodSet:()=>cc,ZodString:()=>Xs,ZodSymbol:()=>ic,ZodTransformer:()=>On,ZodTuple:()=>Dr,ZodType:()=>Se,ZodUndefined:()=>wo,ZodUnion:()=>Bo,ZodUnknown:()=>hs,ZodVoid:()=>oc,addIssueToContext:()=>K,any:()=>FW,array:()=>PW,bigint:()=>kW,boolean:()=>F0,coerce:()=>cz,custom:()=>T0,date:()=>xW,datetimeRegex:()=>k0,defaultErrorMap:()=>ps,discriminatedUnion:()=>VW,effect:()=>ez,enum:()=>KW,function:()=>JW,getErrorMap:()=>nc,getParsedType:()=>Nr,instanceof:()=>vW,intersection:()=>GW,isAborted:()=>Cp,isAsync:()=>rc,isDirty:()=>Ip,isValid:()=>Zs,late:()=>SW,lazy:()=>WW,literal:()=>zW,makeIssue:()=>Zu,map:()=>qW,nan:()=>RW,nativeEnum:()=>ZW,never:()=>MW,null:()=>DW,nullable:()=>nz,number:()=>D0,object:()=>LW,objectUtil:()=>CE,oboolean:()=>az,onumber:()=>oz,optional:()=>tz,ostring:()=>iz,pipeline:()=>sz,preprocess:()=>rz,promise:()=>XW,quotelessJson:()=>eW,record:()=>HW,set:()=>YW,setErrorMap:()=>nW,strictObject:()=>OW,string:()=>N0,symbol:()=>TW,transformer:()=>ez,tuple:()=>jW,undefined:()=>NW,union:()=>$W,unknown:()=>_W,util:()=>xe,void:()=>UW});var xe;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{let i={};for(let o of s)i[o]=o;return i},t.getValidEnumValues=s=>{let i=t.objectKeys(s).filter(c=>typeof s[s[c]]!="number"),o={};for(let c of i)o[c]=s[c];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(let o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(xe||(xe={}));var CE;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(CE||(CE={}));var X=xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Nr=t=>{switch(typeof t){case"undefined":return X.undefined;case"string":return X.string;case"number":return Number.isNaN(t)?X.nan:X.number;case"boolean":return X.boolean;case"function":return X.function;case"bigint":return X.bigint;case"symbol":return X.symbol;case"object":return Array.isArray(t)?X.array:t===null?X.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?X.promise:typeof Map<"u"&&t instanceof Map?X.map:typeof Set<"u"&&t instanceof Set?X.set:typeof Date<"u"&&t instanceof Date?X.date:X.object;default:return X.unknown}};var G=xe.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"]),eW=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),on=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let c=r,l=0;for(;l<o.path.length;){let d=o.path[l],A=l===o.path.length-1;if(d==="_errors"){A&&c._errors.push(n(o)),l++;continue}Object.prototype.hasOwnProperty.call(c,d)||(d==="__proto__"?Object.defineProperty(c,d,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):c[d]={_errors:[]}),c=c[d],A&&c._errors.push(n(o)),l++}}};return s(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};on.create=t=>new on(t);var tW=(t,e)=>{let n;switch(t.code){case G.invalid_type:t.received===X.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,xe.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${xe.joinValues(t.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${xe.joinValues(t.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${xe.joinValues(t.options)}, received '${t.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:xe.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case G.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case G.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;default:n=e.defaultError,xe.assertNever(t)}return{message:n}},ps=tW;var B0=ps;function nW(t){B0=t}function nc(){return B0}var Zu=t=>{let{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let c="",l=r.filter(d=>!!d).slice().reverse();for(let d of l)c=d(o,{data:e,defaultError:c}).message;return{...s,path:i,message:c}},rW=[];function K(t,e){let n=nc(),r=Zu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ps?void 0:ps].filter(s=>!!s)});t.common.issues.push(r)}var xt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let s of n){if(s.status==="aborted")return Ae;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let s of n){let i=await s.key,o=await s.value;r.push({key:i,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let s of n){let{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return Ae;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}},Ae=Object.freeze({status:"aborted"}),mo=t=>({status:"dirty",value:t}),Lt=t=>({status:"valid",value:t}),Cp=t=>t.status==="aborted",Ip=t=>t.status==="dirty",Zs=t=>t.status==="valid",rc=t=>typeof Promise<"u"&&t instanceof Promise;var re;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(re||(re={}));var Ln=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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}},Q0=(t,e)=>{if(Zs(e))return{success:!0,data:e.value};if(!t.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 on(t.common.issues);return this._error=n,this._error}}};function be(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,c)=>{let{message:l}=t;return o.code==="invalid_enum_value"?{message:l??c.defaultError}:typeof c.data>"u"?{message:l??r??c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:l??n??c.defaultError}},description:s}}var Se=class{get description(){return this._def.description}_getType(e){return Nr(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xt,ctx:{common:e.parent.common,data:e.data,parsedType:Nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(rc(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nr(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Q0(r,s)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nr(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return Zs(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>Zs(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nr(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(rc(s)?s:Promise.resolve(s));return Q0(r,i)}refine(e,n){let r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{let o=e(s),c=()=>i.addIssue({code:G.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new On({schema:this,typeName:ge.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Pn.create(this,this._def)}nullable(){return Fr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gs.create(this)}promise(){return ti.create(this,this._def)}or(e){return Bo.create([this,e],this._def)}and(e){return Qo.create(this,e,this._def)}transform(e){return new On({...be(this._def),schema:this,typeName:ge.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new xo({...be(this._def),innerType:this,defaultValue:n,typeName:ge.ZodDefault})}brand(){return new Xu({typeName:ge.ZodBranded,type:this,...be(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new To({...be(this._def),innerType:this,catchValue:n,typeName:ge.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return el.create(this,e)}readonly(){return No.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},sW=/^c[^\s-]{8,}$/i,iW=/^[0-9a-z]+$/,oW=/^[0-9A-HJKMNP-TV-Z]{26}$/i,aW=/^[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,cW=/^[a-z0-9_-]{21}$/i,uW=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lW=/^[-+]?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)?)??$/,dW=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,AW="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",IE,pW=/^(?:(?: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])$/,fW=/^(?:(?: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])$/,hW=/^(([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]))$/,gW=/^(([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])$/,mW=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yW=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,v0="((\\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])))",EW=new RegExp(`^${v0}$`);function R0(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function CW(t){return new RegExp(`^${R0(t)}$`)}function k0(t){let e=`${v0}T${R0(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function IW(t,e){return!!((e==="v4"||!e)&&pW.test(t)||(e==="v6"||!e)&&hW.test(t))}function wW(t,e){if(!uW.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function bW(t,e){return!!((e==="v4"||!e)&&fW.test(t)||(e==="v6"||!e)&&gW.test(t))}var Xs=class t extends Se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==X.string){let i=this._getOrReturnCtx(e);return K(i,{code:G.invalid_type,expected:X.string,received:i.parsedType}),Ae}let r=new xt,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:G.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:G.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,c=e.data.length<i.value;(o||c)&&(s=this._getOrReturnCtx(e,s),o?K(s,{code:G.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&K(s,{code:G.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")dW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"email",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")IE||(IE=new RegExp(AW,"u")),IE.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"emoji",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")aW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"uuid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")cW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"nanoid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")sW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"cuid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")iW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"cuid2",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")oW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"ulid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),K(s,{validation:"url",code:G.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"regex",code:G.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?k0(i).test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?EW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?CW(i).test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?lW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"duration",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?IW(e.data,i.version)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"ip",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?wW(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"jwt",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?bW(e.data,i.version)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"cidr",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?mW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"base64",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?yW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"base64url",code:G.invalid_string,message:i.message}),r.dirty()):xe.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:G.invalid_string,...re.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...re.errToObj(e)})}url(e){return this._addCheck({kind:"url",...re.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...re.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...re.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...re.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...re.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...re.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...re.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...re.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...re.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...re.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...re.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...re.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...re.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...re.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...re.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...re.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...re.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...re.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...re.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...re.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...re.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...re.errToObj(n)})}nonempty(e){return this.min(1,re.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Xs.create=t=>new Xs({checks:[],typeName:ge.ZodString,coerce:t?.coerce??!1,...be(t)});function BW(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}var yo=class t extends Se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==X.number){let i=this._getOrReturnCtx(e);return K(i,{code:G.invalid_type,expected:X.number,received:i.parsedType}),Ae}let r,s=new xt;for(let i of this._def.checks)i.kind==="int"?xe.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),K(r,{code:G.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?BW(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),K(r,{code:G.not_finite,message:i.message}),s.dirty()):xe.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,re.toString(n))}gt(e,n){return this.setLimit("min",e,!1,re.toString(n))}lte(e,n){return this.setLimit("max",e,!0,re.toString(n))}lt(e,n){return this.setLimit("max",e,!1,re.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:re.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:re.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:re.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&xe.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};yo.create=t=>new yo({checks:[],typeName:ge.ZodNumber,coerce:t?.coerce||!1,...be(t)});var Eo=class t extends Se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==X.bigint)return this._getInvalidInput(e);let r,s=new xt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):xe.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return K(n,{code:G.invalid_type,expected:X.bigint,received:n.parsedType}),Ae}gte(e,n){return this.setLimit("min",e,!0,re.toString(n))}gt(e,n){return this.setLimit("min",e,!1,re.toString(n))}lte(e,n){return this.setLimit("max",e,!0,re.toString(n))}lt(e,n){return this.setLimit("max",e,!1,re.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:re.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Eo.create=t=>new Eo({checks:[],typeName:ge.ZodBigInt,coerce:t?.coerce??!1,...be(t)});var Co=class extends Se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==X.boolean){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.boolean,received:r.parsedType}),Ae}return Lt(e.data)}};Co.create=t=>new Co({typeName:ge.ZodBoolean,coerce:t?.coerce||!1,...be(t)});var Io=class t extends Se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==X.date){let i=this._getOrReturnCtx(e);return K(i,{code:G.invalid_type,expected:X.date,received:i.parsedType}),Ae}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return K(i,{code:G.invalid_date}),Ae}let r=new xt,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:G.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:G.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):xe.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:re.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:re.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Io.create=t=>new Io({checks:[],coerce:t?.coerce||!1,typeName:ge.ZodDate,...be(t)});var ic=class extends Se{_parse(e){if(this._getType(e)!==X.symbol){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.symbol,received:r.parsedType}),Ae}return Lt(e.data)}};ic.create=t=>new ic({typeName:ge.ZodSymbol,...be(t)});var wo=class extends Se{_parse(e){if(this._getType(e)!==X.undefined){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.undefined,received:r.parsedType}),Ae}return Lt(e.data)}};wo.create=t=>new wo({typeName:ge.ZodUndefined,...be(t)});var bo=class extends Se{_parse(e){if(this._getType(e)!==X.null){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.null,received:r.parsedType}),Ae}return Lt(e.data)}};bo.create=t=>new bo({typeName:ge.ZodNull,...be(t)});var ei=class extends Se{constructor(){super(...arguments),this._any=!0}_parse(e){return Lt(e.data)}};ei.create=t=>new ei({typeName:ge.ZodAny,...be(t)});var hs=class extends Se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Lt(e.data)}};hs.create=t=>new hs({typeName:ge.ZodUnknown,...be(t)});var lr=class extends Se{_parse(e){let n=this._getOrReturnCtx(e);return K(n,{code:G.invalid_type,expected:X.never,received:n.parsedType}),Ae}};lr.create=t=>new lr({typeName:ge.ZodNever,...be(t)});var oc=class extends Se{_parse(e){if(this._getType(e)!==X.undefined){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.void,received:r.parsedType}),Ae}return Lt(e.data)}};oc.create=t=>new oc({typeName:ge.ZodVoid,...be(t)});var gs=class t extends Se{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==X.array)return K(n,{code:G.invalid_type,expected:X.array,received:n.parsedType}),Ae;if(s.exactLength!==null){let o=n.data.length>s.exactLength.value,c=n.data.length<s.exactLength.value;(o||c)&&(K(n,{code:o?G.too_big:G.too_small,minimum:c?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(K(n,{code:G.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(K(n,{code:G.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,c)=>s.type._parseAsync(new Ln(n,o,n.path,c)))).then(o=>xt.mergeArray(r,o));let i=[...n.data].map((o,c)=>s.type._parseSync(new Ln(n,o,n.path,c)));return xt.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:re.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:re.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:re.toString(n)}})}nonempty(e){return this.min(1,e)}};gs.create=(t,e)=>new gs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ge.ZodArray,...be(e)});function sc(t){if(t instanceof an){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Pn.create(sc(r))}return new an({...t._def,shape:()=>e})}else return t instanceof gs?new gs({...t._def,type:sc(t.element)}):t instanceof Pn?Pn.create(sc(t.unwrap())):t instanceof Fr?Fr.create(sc(t.unwrap())):t instanceof Dr?Dr.create(t.items.map(e=>sc(e))):t}var an=class t extends Se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=xe.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==X.object){let d=this._getOrReturnCtx(e);return K(d,{code:G.invalid_type,expected:X.object,received:d.parsedType}),Ae}let{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof lr&&this._def.unknownKeys==="strip"))for(let d in s.data)o.includes(d)||c.push(d);let l=[];for(let d of o){let A=i[d],f=s.data[d];l.push({key:{status:"valid",value:d},value:A._parse(new Ln(s,f,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof lr){let d=this._def.unknownKeys;if(d==="passthrough")for(let A of c)l.push({key:{status:"valid",value:A},value:{status:"valid",value:s.data[A]}});else if(d==="strict")c.length>0&&(K(s,{code:G.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let A of c){let f=s.data[A];l.push({key:{status:"valid",value:A},value:d._parse(new Ln(s,f,s.path,A)),alwaysSet:A in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let A of l){let f=await A.key,h=await A.value;d.push({key:f,value:h,alwaysSet:A.alwaysSet})}return d}).then(d=>xt.mergeObjectSync(r,d)):xt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return re.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:re.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ge.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of xe.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of xe.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return sc(this)}partial(e){let n={};for(let r of xe.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of xe.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Pn;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:()=>n})}keyof(){return x0(xe.objectKeys(this.shape))}};an.create=(t,e)=>new an({shape:()=>t,unknownKeys:"strip",catchall:lr.create(),typeName:ge.ZodObject,...be(e)});an.strictCreate=(t,e)=>new an({shape:()=>t,unknownKeys:"strict",catchall:lr.create(),typeName:ge.ZodObject,...be(e)});an.lazycreate=(t,e)=>new an({shape:t,unknownKeys:"strip",catchall:lr.create(),typeName:ge.ZodObject,...be(e)});var Bo=class extends Se{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(let c of i)if(c.result.status==="valid")return c.result;for(let c of i)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;let o=i.map(c=>new on(c.ctx.common.issues));return K(n,{code:G.invalid_union,unionErrors:o}),Ae}if(n.common.async)return Promise.all(r.map(async i=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i,o=[];for(let l of r){let d={...n,common:{...n.common,issues:[]},parent:null},A=l._parseSync({data:n.data,path:n.path,parent:d});if(A.status==="valid")return A;A.status==="dirty"&&!i&&(i={result:A,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let c=o.map(l=>new on(l));return K(n,{code:G.invalid_union,unionErrors:c}),Ae}}get options(){return this._def.options}};Bo.create=(t,e)=>new Bo({options:t,typeName:ge.ZodUnion,...be(e)});var fs=t=>t instanceof So?fs(t.schema):t instanceof On?fs(t.innerType()):t instanceof vo?[t.value]:t instanceof Ro?t.options:t instanceof ko?xe.objectValues(t.enum):t instanceof xo?fs(t._def.innerType):t instanceof wo?[void 0]:t instanceof bo?[null]:t instanceof Pn?[void 0,...fs(t.unwrap())]:t instanceof Fr?[null,...fs(t.unwrap())]:t instanceof Xu||t instanceof No?fs(t.unwrap()):t instanceof To?fs(t._def.innerType):[],wp=class t extends Se{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==X.object)return K(n,{code:G.invalid_type,expected:X.object,received:n.parsedType}),Ae;let r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(K(n,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let s=new Map;for(let i of n){let o=fs(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of o){if(s.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);s.set(c,i)}}return new t({typeName:ge.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...be(r)})}};function wE(t,e){let n=Nr(t),r=Nr(e);if(t===e)return{valid:!0,data:t};if(n===X.object&&r===X.object){let s=xe.objectKeys(e),i=xe.objectKeys(t).filter(c=>s.indexOf(c)!==-1),o={...t,...e};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let c of i){if(c==="__proto__")continue;let l=wE(t[c],e[c]);if(!l.valid)return{valid:!1};o[c]=l.data}return{valid:!0,data:o}}else if(n===X.array&&r===X.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let o=t[i],c=e[i],l=wE(o,c);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===X.date&&r===X.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Qo=class extends Se{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Cp(i)||Cp(o))return Ae;let c=wE(i.value,o.value);return c.valid?((Ip(i)||Ip(o))&&n.dirty(),{status:n.value,value:c.data}):(K(r,{code:G.invalid_intersection_types}),Ae)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Qo.create=(t,e,n)=>new Qo({left:t,right:e,typeName:ge.ZodIntersection,...be(n)});var Dr=class t extends Se{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==X.array)return K(r,{code:G.invalid_type,expected:X.array,received:r.parsedType}),Ae;if(r.data.length<this._def.items.length)return K(r,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ae;!this._def.rest&&r.data.length>this._def.items.length&&(K(r,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((o,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new Ln(r,o,r.path,c)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>xt.mergeArray(n,o)):xt.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Dr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dr({items:t,typeName:ge.ZodTuple,rest:null,...be(e)})};var bp=class t extends Se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==X.object)return K(r,{code:G.invalid_type,expected:X.object,received:r.parsedType}),Ae;let s=[],i=this._def.keyType,o=this._def.valueType;for(let c in r.data)s.push({key:i._parse(new Ln(r,c,r.path,c)),value:o._parse(new Ln(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?xt.mergeObjectAsync(n,s):xt.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Se?new t({keyType:e,valueType:n,typeName:ge.ZodRecord,...be(r)}):new t({keyType:Xs.create(),valueType:e,typeName:ge.ZodRecord,...be(n)})}},ac=class extends Se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==X.map)return K(r,{code:G.invalid_type,expected:X.map,received:r.parsedType}),Ae;let s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([c,l],d)=>({key:s._parse(new Ln(r,c,r.path,[d,"key"])),value:i._parse(new Ln(r,l,r.path,[d,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of o){let d=await l.key,A=await l.value;if(d.status==="aborted"||A.status==="aborted")return Ae;(d.status==="dirty"||A.status==="dirty")&&n.dirty(),c.set(d.value,A.value)}return{status:n.value,value:c}})}else{let c=new Map;for(let l of o){let d=l.key,A=l.value;if(d.status==="aborted"||A.status==="aborted")return Ae;(d.status==="dirty"||A.status==="dirty")&&n.dirty(),c.set(d.value,A.value)}return{status:n.value,value:c}}}};ac.create=(t,e,n)=>new ac({valueType:e,keyType:t,typeName:ge.ZodMap,...be(n)});var cc=class t extends Se{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==X.set)return K(r,{code:G.invalid_type,expected:X.set,received:r.parsedType}),Ae;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(K(r,{code:G.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(K(r,{code:G.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let i=this._def.valueType;function o(l){let d=new Set;for(let A of l){if(A.status==="aborted")return Ae;A.status==="dirty"&&n.dirty(),d.add(A.value)}return{status:n.value,value:d}}let c=[...r.data.values()].map((l,d)=>i._parse(new Ln(r,l,r.path,d)));return r.common.async?Promise.all(c).then(l=>o(l)):o(c)}min(e,n){return new t({...this._def,minSize:{value:e,message:re.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:re.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};cc.create=(t,e)=>new cc({valueType:t,minSize:null,maxSize:null,typeName:ge.ZodSet,...be(e)});var Bp=class t extends Se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==X.function)return K(n,{code:G.invalid_type,expected:X.function,received:n.parsedType}),Ae;function r(c,l){return Zu({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,nc(),ps].filter(d=>!!d),issueData:{code:G.invalid_arguments,argumentsError:l}})}function s(c,l){return Zu({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,nc(),ps].filter(d=>!!d),issueData:{code:G.invalid_return_type,returnTypeError:l}})}let i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof ti){let c=this;return Lt(async function(...l){let d=new on([]),A=await c._def.args.parseAsync(l,i).catch(y=>{throw d.addIssue(r(l,y)),d}),f=await Reflect.apply(o,this,A);return await c._def.returns._def.type.parseAsync(f,i).catch(y=>{throw d.addIssue(s(f,y)),d})})}else{let c=this;return Lt(function(...l){let d=c._def.args.safeParse(l,i);if(!d.success)throw new on([r(l,d.error)]);let A=Reflect.apply(o,this,d.data),f=c._def.returns.safeParse(A,i);if(!f.success)throw new on([s(A,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Dr.create(e).rest(hs.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||Dr.create([]).rest(hs.create()),returns:n||hs.create(),typeName:ge.ZodFunction,...be(r)})}},So=class extends Se{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};So.create=(t,e)=>new So({getter:t,typeName:ge.ZodLazy,...be(e)});var vo=class extends Se{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return K(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),Ae}return{status:"valid",value:e.data}}get value(){return this._def.value}};vo.create=(t,e)=>new vo({value:t,typeName:ge.ZodLiteral,...be(e)});function x0(t,e){return new Ro({values:t,typeName:ge.ZodEnum,...be(e)})}var Ro=class t extends Se{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return K(n,{expected:xe.joinValues(r),received:n.parsedType,code:G.invalid_type}),Ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return K(n,{received:n.data,code:G.invalid_enum_value,options:r}),Ae}return Lt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Ro.create=x0;var ko=class extends Se{_parse(e){let n=xe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==X.string&&r.parsedType!==X.number){let s=xe.objectValues(n);return K(r,{expected:xe.joinValues(s),received:r.parsedType,code:G.invalid_type}),Ae}if(this._cache||(this._cache=new Set(xe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=xe.objectValues(n);return K(r,{received:r.data,code:G.invalid_enum_value,options:s}),Ae}return Lt(e.data)}get enum(){return this._def.values}};ko.create=(t,e)=>new ko({values:t,typeName:ge.ZodNativeEnum,...be(e)});var ti=class extends Se{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==X.promise&&n.common.async===!1)return K(n,{code:G.invalid_type,expected:X.promise,received:n.parsedType}),Ae;let r=n.parsedType===X.promise?n.data:Promise.resolve(n.data);return Lt(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ti.create=(t,e)=>new ti({type:t,typeName:ge.ZodPromise,...be(e)});var On=class extends Se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ge.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{K(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async c=>{if(n.value==="aborted")return Ae;let l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?Ae:l.status==="dirty"?mo(l.value):n.value==="dirty"?mo(l.value):l});{if(n.value==="aborted")return Ae;let c=this._def.schema._parseSync({data:o,path:r.path,parent:r});return c.status==="aborted"?Ae:c.status==="dirty"?mo(c.value):n.value==="dirty"?mo(c.value):c}}if(s.type==="refinement"){let o=c=>{let l=s.refinement(c,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Ae:(c.status==="dirty"&&n.dirty(),o(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Ae:(c.status==="dirty"&&n.dirty(),o(c.value).then(()=>({status:n.value,value:c.value}))))}if(s.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Zs(o))return Ae;let c=s.transform(o.value,i);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:r.data,path:r.path,parent:r}).then(o=>Zs(o)?Promise.resolve(s.transform(o.value,i)).then(c=>({status:n.value,value:c})):Ae);xe.assertNever(s)}};On.create=(t,e,n)=>new On({schema:t,typeName:ge.ZodEffects,effect:e,...be(n)});On.createWithPreprocess=(t,e,n)=>new On({schema:e,effect:{type:"preprocess",transform:t},typeName:ge.ZodEffects,...be(n)});var Pn=class extends Se{_parse(e){return this._getType(e)===X.undefined?Lt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pn.create=(t,e)=>new Pn({innerType:t,typeName:ge.ZodOptional,...be(e)});var Fr=class extends Se{_parse(e){return this._getType(e)===X.null?Lt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Fr.create=(t,e)=>new Fr({innerType:t,typeName:ge.ZodNullable,...be(e)});var xo=class extends Se{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===X.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};xo.create=(t,e)=>new xo({innerType:t,typeName:ge.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...be(e)});var To=class extends Se{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return rc(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new on(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new on(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};To.create=(t,e)=>new To({innerType:t,typeName:ge.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...be(e)});var uc=class extends Se{_parse(e){if(this._getType(e)!==X.nan){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.nan,received:r.parsedType}),Ae}return{status:"valid",value:e.data}}};uc.create=t=>new uc({typeName:ge.ZodNaN,...be(t)});var QW=Symbol("zod_brand"),Xu=class extends Se{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},el=class t extends Se{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ae:i.status==="dirty"?(n.dirty(),mo(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ae:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:ge.ZodPipeline})}},No=class extends Se{_parse(e){let n=this._def.innerType._parse(e),r=s=>(Zs(s)&&(s.value=Object.freeze(s.value)),s);return rc(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};No.create=(t,e)=>new No({innerType:t,typeName:ge.ZodReadonly,...be(e)});function S0(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function T0(t,e={},n){return t?ei.create().superRefine((r,s)=>{let i=t(r);if(i instanceof Promise)return i.then(o=>{if(!o){let c=S0(e,r),l=c.fatal??n??!0;s.addIssue({code:"custom",...c,fatal:l})}});if(!i){let o=S0(e,r),c=o.fatal??n??!0;s.addIssue({code:"custom",...o,fatal:c})}}):ei.create()}var SW={object:an.lazycreate},ge;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ge||(ge={}));var vW=(t,e={message:`Input not instance of ${t.name}`})=>T0(n=>n instanceof t,e),N0=Xs.create,D0=yo.create,RW=uc.create,kW=Eo.create,F0=Co.create,xW=Io.create,TW=ic.create,NW=wo.create,DW=bo.create,FW=ei.create,_W=hs.create,MW=lr.create,UW=oc.create,PW=gs.create,LW=an.create,OW=an.strictCreate,$W=Bo.create,VW=wp.create,GW=Qo.create,jW=Dr.create,HW=bp.create,qW=ac.create,YW=cc.create,JW=Bp.create,WW=So.create,zW=vo.create,KW=Ro.create,ZW=ko.create,XW=ti.create,ez=On.create,tz=Pn.create,nz=Fr.create,rz=On.createWithPreprocess,sz=el.create,iz=()=>N0().optional(),oz=()=>D0().optional(),az=()=>F0().optional(),cz={string:(t=>Xs.create({...t,coerce:!0})),number:(t=>yo.create({...t,coerce:!0})),boolean:(t=>Co.create({...t,coerce:!0})),bigint:(t=>Eo.create({...t,coerce:!0})),date:(t=>Io.create({...t,coerce:!0}))};var uz=Ae;function lz(t){return t.issues.map(e=>{let n=e.path.map(s=>typeof s=="number"?`[${s}]`:`.${s}`).join("").replace(/^\./,""),r=n||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(e.message))return`${r} ${e.message}`;switch(e.code){case"invalid_type":return n?e.expected==="object"?`${r} must be an object`:e.received==="undefined"?`${r} is required`:`${r} must be ${e.expected}, got ${e.received}`:"output is not a JSON object";case"invalid_enum_value":{let s=JSON.stringify(e.received),i=e.options.find(c=>typeof c=="string"&&typeof e.received=="string"&&e.received.startsWith(c)),o=i?` \u2014 you sent ${s}; the value must be exactly ${JSON.stringify(i)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${s}`;return`${r} must be one of: ${e.options.join(", ")}${o}`}case"invalid_literal":return`${r} must be ${JSON.stringify(e.expected)}`;case"too_small":return e.type==="string"?`${r} must be a non-empty string`:`${r} must have at least ${e.minimum} item(s)`;case"unrecognized_keys":return`${r} has unknown key(s): ${e.keys.join(", ")}`;default:return`${r}: ${e.message}`}})}function Bn(t,e){let n=t.safeParse(e);if(n.success)return{value:n.data,errors:[]};let r=(i,o)=>o.reduce((c,l)=>c&&typeof c=="object"?c[l]:void 0,i),s=n.error.issues.filter(i=>i.path.length&&r(e,i.path)===null);if(s.length===n.error.issues.length)try{let i=t.safeParse(s.reduce((o,{path:c})=>_0(o,c),e));if(i.success)return{value:i.data,errors:[]}}catch{}return{errors:lz(n.error)}}function _0(t,e){if(!e.length||!t||typeof t!="object")return t;let[n,...r]=e,s=Array.isArray(t)?t.slice():{...t};return r.length?s[n]=_0(s[n],r):delete s[n],s}var M0=require("child_process");var tl=ce(require("path"));var ms="Skyramp Testbot",ni="test-bot@skyramp.dev";var dz=(t,e)=>(0,M0.execFileSync)("git",e,{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();function U0(t){let e="";try{e=dz(t,["remote","get-url","origin"])}catch{}let n=/[:/]([A-Za-z0-9._-]+)\/([A-Za-z0-9._-]+?)(?:\.git)?\/?$/.exec(e);return n&&!e.startsWith("/")&&!e.startsWith(".")?`${n[1]}/${n[2]}`:`local/${tl.basename(tl.resolve(t)).replace(/[^A-Za-z0-9._-]/g,"-")||"repo"}`}var Aee=new Set(Object.values(Ks));var pee=u.object({checks:u.array(u.object({repository:u.string().optional(),name:u.string().min(1),headSha:u.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:u.string().default("completed"),conclusion:u.string().nullable().optional(),url:u.string().optional(),summary:u.string().optional()}))});var bE=new Map;function Az(t){return t.repositorySlug?t.repositorySlug:(bE.has(t.repositoryPath)||bE.set(t.repositoryPath,U0(t.repositoryPath)),bE.get(t.repositoryPath))}function dr(t){return[{slug:Az(t),path:t.repositoryPath,writable:!0,working:!0},...(t.relatedRepos??[]).map(e=>({slug:e.slug,path:e.path,writable:e.writable===!0,working:!1}))]}var BE=(t,e)=>t.toLowerCase()===e.toLowerCase();function QE(t,e){return e?.trim()?t.find(n=>BE(n.slug,e.trim())):t[0]}function lc(t,e){return QE(dr(t),e)}var pz=(t,e)=>`${e} is not a repository of this run (${dr(t).map(n=>n.slug).join(", ")})`;function nl(t,e){let n=lc(t,e);return n?n.writable?{source:n}:{error:`${n.slug} is read-only in this run: tests are written only to ${dr(t).filter(r=>r.writable).map(r=>r.slug).join(", ")}`}:{error:pz(t,e)}}function SE(t){let e=t.split(/[\\/]/)[0];return e===".skyramp"||e===".testbot"}var Es=ce(require("path"));var ri=["-c","core.fsmonitor=false"],fz=new Set(["GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","ACTIONS_RUNTIME_TOKEN","ACTIONS_ID_TOKEN_REQUEST_TOKEN","ACTIONS_ID_TOKEN_REQUEST_URL","SYSTEM_ACCESSTOKEN","SYSTEM_OIDCREQUESTURI","SKYRAMP_MCP_GITHUB_TOKEN","SSH_AUTH_SOCK","GIT_SSH","GIT_SSH_COMMAND","GITHUB_STEP_SUMMARY"]),vE=new Set(["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_PROFILE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN","AWS_ROLE_SESSION_NAME","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"]);function Ot(t=process.env,e,n="repo-command"){let r={};for(let[s,i]of Object.entries(t))n==="repo-command"&&vE.has(s)||(r[s]=i);Object.assign(r,e??{});for(let s of Object.keys(r))(fz.has(s)||s.startsWith("INPUT_"))&&delete r[s];return r}var $0=require("child_process");var O0=ce(require("path"));var Do=(n=>(n.Ready="ready",n.Blocked="blocked",n))(Do||{}),at=u.string().trim().min(1),hz=u.object({action:u.enum(["start","run","wait"]),text:at,source:u.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:at.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(t=>t.source==="file"==(t.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),gz=/^[A-Za-z_][A-Za-z0-9_]*$/,dc=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Ac=(o=>(o.VersionEndpoint="version_endpoint",o.DeployWorkflow="deploy_workflow",o.KubernetesLabels="kubernetes_labels",o.Command="command",o.Api="api",o.NotTracked="not_tracked",o))(Ac||{}),cn="shared",mz=at.refine(t=>{try{let e=new URL(t);return["http:","https:"].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}},"an http(s) URL with no login in it"),pc=u.object({address:mz,readyWhen:at.nullable(),credentials:u.array(u.string().regex(dc)).max(50),revisionSources:u.array(u.object({method:u.nativeEnum(Ac),detail:at.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:u.array(at).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),RE={steps:u.array(hz).max(20).optional().describe("how it starts, in order"),kind:u.enum(["web_app","service","database","external_service"]).optional(),from:u.object({file:at,service:at.nullable()}).strict().optional(),credentials:u.array(u.string().max(100).regex(gz)).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")},yz=u.object({name:at,repository:at.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:u.boolean(),...RE,deployed:at.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')}),Ez=u.object({component:at,problem:at,evidence:at.describe("the exact command and output that shows it"),fix:at.describe("what the user must provide, and where")}),Cz=u.object({framework:at,file:at.describe("the test file run, relative to its repository root"),result:u.enum(["pass","fail","error"])}),Iz=u.object({input:at.describe("the part of the user's SUT input, as given"),reason:at}),P0=u.object({schemaVersion:u.literal(1),status:u.nativeEnum(Do).describe("ready only if every component came up healthy and the recipe is written"),components:u.array(yz),suites:u.array(Cz).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:u.array(at).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:u.array(u.object({input:at.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:at.describe("what the recipe did with it")})).optional(),inputsNotUsed:u.array(Iz).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 that names a file, command, port, route or setting that does not exist or does not work"),blockers:u.array(Ez).describe("required (non-empty) when status is blocked"),environment:pc.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 rl=64*1024,sl=512*1024,kE=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var ys=(s=>(s.Clean="clean",s.RecipeDrift="recipe-drift",s.ChangeBrokeBringup="change-broke-bringup",s.BringupFailed="bringup-failed",s))(ys||{}),Ar=u.string().trim().min(1),wz=u.object({url:u.string().optional().describe("the URL probed, if the check is an HTTP request"),command:u.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:u.record(u.string()).optional(),status:u.union([u.number(),u.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:Ar.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),xE=u.array(u.object({component:Ar.describe("a shared component listed above"),url:Ar.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:Ar.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"),bz=u.object({name:Ar.describe("the credential's environment variable name, as listed above; never its value"),component:Ar.describe("the component that refused it"),status:u.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:Ar.describe("the request or command you tested it with and what came back, never the value")}),L0=u.object({schemaVersion:u.literal(1),baseUrls:u.record(u.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:wz.optional(),teardown:Ar.describe("command that tears the SUT down"),dependencies:u.record(u.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:u.nativeEnum(ys).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:u.array(u.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:u.object({command:Ar,output:Ar}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:u.array(u.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:u.boolean(),startedAt:Ar.describe("ISO timestamp"),revisions:xE.optional(),credentialsRefused:u.array(bz).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:u.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});var Tt=u.string().trim().min(1),Qp=Tt,TE=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(TE||{}),Sp=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],NE=u.object({schemaVersion:u.literal(1),type:u.nativeEnum(TE).optional(),repository:Qp.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:u.enum(["ready","blocked"]),environment:pc.optional(),components:u.array(u.object({name:Tt,repository:Tt.describe(`owner/repo, or "${cn}" for a customer-deployed component no repository builds`),healthy:u.boolean(),url:u.string().min(1).nullable(),...RE,credentials:u.array(u.string().regex(dc)).max(50).optional(),deployed:Tt.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:u.array(u.object({framework:Tt,file:Tt,result:u.enum(["pass","fail","error"])}).strict()),inputsUsed:u.array(Tt),inputsUsedHow:u.array(u.object({input:Tt,how:Tt}).strict()).optional(),inputsNotUsed:u.array(u.object({input:Tt,reason:Tt}).strict()),blockers:u.array(u.object({component:Tt,problem:Tt,evidence:Tt,fix:Tt}).strict()),replay:u.object({outcome:Tt,durationSeconds:u.number().nonnegative().nullable()}).strict().nullable(),files:u.array(u.object({path:Tt,content:u.string()}).strict())}).strict().superRefine((t,e)=>{t.inputsUsedHow?.forEach((s,i)=>{t.inputsUsed.includes(s.input)||e.addIssue({code:u.ZodIssueCode.custom,path:["inputsUsedHow",i,"input"],message:"not one of inputsUsed"})}),t.components.forEach((s,i)=>{s.credentials&&new Set(s.credentials).size!==s.credentials.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"credentials"],message:"names a credential twice"})});let n=t.type==="customer_deployed";n!==(t.environment!==void 0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&t.repository!==void 0&&e.addIssue({code:u.ZodIssueCode.custom,path:["repository"],message:"a customer_deployed plan names no repository"}),t.environment&&new Set(t.environment.credentials).size!==t.environment.credentials.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let r=new Set(t.components.map(s=>s.name));if(t.environment?.revisionSources.forEach((s,i)=>{s.components.forEach((o,c)=>{r.has(o)||e.addIssue({code:u.ZodIssueCode.custom,path:["environment","revisionSources",i,"components",c],message:"not one of components"})})}),t.components.forEach((s,i)=>{s.deployed!==void 0!==n&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),s.repository===cn&&!n&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"repository"],message:`only a customer_deployed component is ${cn}`})}),n&&(t.components.forEach((s,i)=>{t.components.findIndex(o=>o.name===s.name)!==i&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"name"],message:"names a component twice"})}),t.replay!==null&&e.addIssue({code:u.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),t.files.forEach((s,i)=>{Sp.includes(s.path)&&e.addIssue({code:u.ZodIssueCode.custom,path:["files",i,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&t.status==="ready"){let s=new Set(t.environment?.revisionSources.flatMap(i=>i.components));t.components.forEach((i,o)=>{i.repository!==cn&&!s.has(i.name)&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",o,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var Ree=["clean","recipe-drift"];function il(t){let e=O0.posix.normalize(t);return e===t&&(e===".skyramp/workspace.yml"||e.startsWith(".skyramp/sut/")&&e.length>13)}var DE=[".skyramp/sut",".skyramp/workspace.yml"];var Bz=256*1024*1024,Qz=3e4;function V0(t,e,n=Qz){let r=(0,$0.spawnSync)("git",[...ri,...e],{env:Ot(),cwd:t,encoding:"utf-8",timeout:n,maxBuffer:Bz});return r.status===0?r.stdout.trimEnd():void 0}var _ee=["--",":/",...DE.map(t=>`:(exclude)${t}`)],G0="--literal-pathspecs";function j0(t,e){return!!V0(t,[G0,"status","--porcelain","--",e])}function FE(t,e){return/ blob /.test(V0(t,[G0,"ls-tree","HEAD","--",e])??"")}var ol=ce(require("fs")),Xe=ce(require("path"));var vp=ce(require("fs")),Fo=ce(require("path"));var fc=ce(require("path"));var Pee=fc.join(".skyramp","workspace.yml");var Sz={py:"python",go:"go",java:"java",kt:"kotlin",rb:"ruby",cs:"csharp",ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",kts:"kotlin",rs:"rust",php:"php",scala:"scala",swift:"swift",ex:"elixir",exs:"elixir",dart:"dart",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",groovy:"groovy"};var Lee=new Set(Object.values(Sz));var Jee=5*6e4;function ME(t){try{let r=JSON.parse(vp.readFileSync(Fo.join(t,"package.json"),"utf-8")).packageManager,s=typeof r=="string"?r.match(/^(pnpm|yarn|bun|npm)\b/):null;if(s)return s[1]}catch{}let e=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["bun.lockb","bun"],["bun.lock","bun"],["package-lock.json","npm"]],n=Fo.resolve(t);for(let r=0;r<6;r++){for(let[i,o]of e)if(vp.existsSync(Fo.join(n,i)))return o;let s=Fo.dirname(n);if(s===n)break;n=s}return"npm"}var H0=["package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"],vz={"package.json":H0,"pyproject.toml":["poetry.lock","uv.lock","pdm.lock"],Pipfile:["Pipfile.lock"]};function PE(t,e){let n=Xe.basename(e),r=vz[n];if(!r)return[];let s=Xe.resolve(t),i=Xe.dirname(Xe.resolve(s,e)),o=Xe.relative(s,i);if(o===".."||o.startsWith(`..${Xe.sep}`)||Xe.isAbsolute(o))return[];let c=(d,A)=>A.map(f=>Xe.join(Xe.relative(s,d),f)).filter(f=>FE(s,f)),l=c(i,r);if(l.length)return l;for(let d=i;d!==s;){d=Xe.dirname(d);let A=Rz(d,Xe.relative(d,i).split(Xe.sep).join("/"),n);if(A)return c(d,A)}return[]}function q0(t,e){return e.filter(n=>j0(t,n)&&Rp(Xe.join(t,n)))}function Rz(t,e,n){if(n==="package.json"){let r=Dz(Xe.join(t,"pnpm-workspace.yaml"));if(UE(r?.packages,e))return["pnpm-lock.yaml"];let i=xz(Xe.join(t,"package.json"))?.workspaces,o=Array.isArray(i)?i:i?.packages;return UE(o,e)?H0.filter(c=>c!=="pnpm-lock.yaml"):void 0}if(n==="pyproject.toml"){let r=kz(Xe.join(t,"pyproject.toml"));if(r&&UE([...r.members,...r.exclude.map(s=>`!${s}`)],e))return["uv.lock"]}}function UE(t,e){if(!Array.isArray(t))return!1;let n=o=>o.trim().replace(/^\.\//,"").replace(/\/+$/,""),r=t.filter(o=>typeof o=="string"),s=r.filter(o=>!o.startsWith("!")).map(n),i=r.filter(o=>o.startsWith("!")).map(o=>n(o.slice(1)));return s.some(o=>Xe.matchesGlob(e,o))&&!i.some(o=>Xe.matchesGlob(e,o))}function kz(t){let e;try{e=ol.readFileSync(t,"utf-8")}catch{return}let n=e.split(`
116
+ `:""}return gE.dump=C,gE}var JT;function HJ(){if(JT)return Pt;JT=1;let t=GJ(),e=jJ();function n(r,s){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}return Pt.Type=Jt(),Pt.Schema=WT(),Pt.FAILSAFE_SCHEMA=XT(),Pt.JSON_SCHEMA=s0(),Pt.CORE_SCHEMA=i0(),Pt.DEFAULT_SCHEMA=mE(),Pt.load=t.load,Pt.loadAll=t.loadAll,Pt.dump=e.dump,Pt.YAMLException=Hu(),Pt.types={binary:c0(),float:r0(),map:ZT(),null:e0(),pairs:l0(),set:d0(),timestamp:o0(),bool:t0(),int:n0(),merge:a0(),omap:u0(),seq:KT(),str:zT()},Pt.safeLoad=n("safeLoad","load"),Pt.safeLoadAll=n("safeLoadAll","loadAll"),Pt.safeDump=n("safeDump","dump"),Pt}var qJ=HJ(),YJ=$J(qJ),{Type:e7,Schema:t7,FAILSAFE_SCHEMA:n7,JSON_SCHEMA:A0,CORE_SCHEMA:r7,DEFAULT_SCHEMA:s7,load:ds,loadAll:JJ,dump:i7,YAMLException:o7,types:a7,safeLoad:c7,safeLoadAll:u7,safeDump:l7}=YJ;var As=t=>typeof t=="string"?t:void 0;function f0(t){let e={services:[]},n;try{let l=p0.readFileSync(t,"utf8");n=ds(l,{schema:A0})}catch(l){return He(`Lenient parse: failed to read/parse ${t}: ${l.message}`),e}if(!n||typeof n!="object"||Array.isArray(n))return He(`Lenient parse: ${t} did not contain a YAML object`),e;let r=n,s=r.metadata&&typeof r.metadata=="object"?r.metadata:void 0,i=s?{executorVersion:As(s.executorVersion),mcpVersion:As(s.mcpVersion)}:void 0,c=(Array.isArray(r.services)?r.services:[]).reduce((l,d,A)=>{if(!d||typeof d!="object"||Array.isArray(d))return He(`Lenient parse: services[${A}] is not an object \u2014 skipping`),l;let f=d,h=As(f.serviceName);if(!h)return He(`Lenient parse: services[${A}] missing or non-string serviceName \u2014 skipping`),l;let y=f.api&&typeof f.api=="object"?f.api:void 0,B=f.runtimeDetails&&typeof f.runtimeDetails=="object"?f.runtimeDetails:void 0;return l.push({serviceName:h,language:As(f.language),framework:As(f.framework),testDirectory:As(f.testDirectory),api:y?{baseUrl:As(y.baseUrl)}:void 0,runtimeDetails:B?{serverStartCommand:As(B.serverStartCommand),serverTeardownCommand:As(B.serverTeardownCommand)}:void 0}),l},[]);return{metadata:i,services:c}}async function g0(t){let e=h0.resolve(t.workingDirectory),n=new op(e),r=[],s=t.targetSetupCommand,i=t.targetTeardownCommand,o=t.skyrampExecutorVersion,c=t.skyrampMcpVersion;if(await n.exists()){Dn(`Found ${n.getConfigPath()}, loading workspace configuration...`);try{let d;try{d=await n.read()}catch(f){He(`${n.getConfigPath()} failed strict validation: ${f.message}. Re-reading with per-field lenient parse \u2014 invalid fields will fall back to action input defaults.`),d=f0(n.getConfigPath())}d.metadata&&(!o&&d.metadata.executorVersion&&(o=d.metadata.executorVersion),!c&&d.metadata.mcpVersion&&(c=d.metadata.mcpVersion));for(let f of d.services??[])r.push({serviceName:f.serviceName,language:f.language,framework:f.framework,baseUrl:f.api?.baseUrl,testDirectory:f.testDirectory});let A=(d.services??[])[0];if(A){!s&&A.runtimeDetails?.serverStartCommand&&(s=A.runtimeDetails.serverStartCommand);let f=A.runtimeDetails?.serverTeardownCommand;!i&&typeof f=="string"&&(i=f)}}catch(d){He(`Failed to parse ${n.getConfigPath()}: ${d.message} \u2014 falling back to action input defaults`)}}else Mu("No .skyramp/workspace.yml found, using action input defaults");o||(o="v1.3.54"),c||(c="latest"),s||(s="docker compose up -d --build");let l={targetSetupCommand:s,authTokenCommand:t.authTokenCommand,targetTeardownCommand:i,skipTargetTeardown:t.skipTargetTeardown,skyrampExecutorVersion:o,skyrampMcpVersion:c,skyrampMcpSource:t.skyrampMcpSource,skyrampMcpGithubRef:t.skyrampMcpGithubRef,nodeVersion:t.nodeVersion,skipTargetSetup:t.skipTargetSetup,targetReadyCheckCommand:t.targetReadyCheckCommand,targetReadyCheckTimeout:t.targetReadyCheckTimeout,targetReadyCheckInterval:t.targetReadyCheckInterval,targetReadyCheckDiagnosticsCommand:t.targetReadyCheckDiagnosticsCommand,autoCommit:t.autoCommit,commitMessage:t.commitMessage,generatedTestsMode:t.generatedTestsMode,postPrComment:t.postPrComment,testExecutionTimeout:t.testExecutionTimeout,maxRecommendations:t.maxRecommendations,maxGenerate:t.maxGenerate,perTestMaxFixAttempts:t.perTestMaxFixAttempts,testbotMaxRetries:t.testbotMaxRetries,testbotRetryDelay:t.testbotRetryDelay,testbotTimeout:t.testbotTimeout,targetSetupRetries:t.targetSetupRetries,targetSetupRetryDelay:t.targetSetupRetryDelay,authTokenRetries:t.authTokenRetries,authTokenRetryDelay:t.authTokenRetryDelay,reportCollapsed:t.reportCollapsed,language:t.language,enableDebug:t.enableDebug,testRepoPath:t.testRepoPath,relatedRepoPaths:t.relatedRepoPaths,services:r};$A("Resolved configuration");for(let[d,A]of Object.entries(l))d==="authTokenCommand"?Dn(` ${d}: [REDACTED]`):d==="services"?Dn(` ${d}: ${JSON.stringify(A)}`):Dn(` ${d}: ${A}`);return VA(),l}qt();qt();ly();var y0=ce(require("child_process")),yE=class extends Error{constructor(e){super(e),this.name="ExecTimeoutError"}},cp=class extends Error{constructor(e){super(e),this.name="ExecAbortedError"}};function m0(t,e){if(!(!t||t.destroyed||t.writableEnded))try{t.write(e)}catch(n){He(`stream write failed: ${n instanceof Error?n.message:String(n)}`)}}async function E0(t,e=[],n={}){let r="",s="",i={cwd:n.cwd,silent:n.silent??!1,ignoreReturnCode:n.ignoreReturnCode??!1,env:n.env?{...process.env,...n.env}:void 0,input:n.input,listeners:{stdout:c=>{r+=c.toString(),m0(n.stdoutStream,c)},stderr:c=>{s+=c.toString()}}};if(n.timeout||n.signal){let c=n.signal;return c?.aborted?Promise.reject(new cp(`Command aborted before start: ${t}`)):new Promise((l,d)=>{let A=y0.spawn(t,e,{cwd:n.cwd,env:n.env?{...process.env,...n.env}:process.env,stdio:["pipe","pipe","pipe"],shell:!1});A.stdout?.on("data",R=>{r+=R.toString(),n.silent||process.stdout.write(R),m0(n.stdoutStream,R)}),A.stderr?.on("data",R=>{s+=R.toString(),n.silent||process.stderr.write(R)}),n.input&&A.stdin?.end(n.input);let f=()=>{B&&clearTimeout(B),c?.removeEventListener("abort",y)},h=R=>{f();try{A.kill("SIGTERM")}catch{}d(R)},y=()=>h(new cp(`Command aborted: ${t}`)),B=n.timeout?setTimeout(()=>h(new yE(`Command timed out after ${Math.round(n.timeout/6e4)}m: ${t}`)),n.timeout):void 0;c?.addEventListener("abort",y,{once:!0}),A.on("close",R=>{f();let F=R??1;F!==0&&!n.ignoreReturnCode?d(new Error(`The process '${t}' failed with exit code ${F}`)):l({exitCode:F,stdout:r,stderr:s})}),A.on("error",R=>{f(),d(R)})})}return{exitCode:await Zk(t,e,i),stdout:r,stderr:s}}async function C0(t,e){$A(t);try{return await e()}finally{VA()}}async function I0(t,e){await C0("Tearing down services",async()=>{if(t.skipTargetTeardown){Mu("Skipping service teardown (skipTargetTeardown=true)");return}if(!t.targetTeardownCommand){Dn("No targetTeardownCommand configured, skipping teardown");return}Dn(`Running teardown command: ${t.targetTeardownCommand}`);try{await E0("bash",["-c",t.targetTeardownCommand],{cwd:e}),Mu("Services torn down successfully")}catch(n){let r=n instanceof Error?n.message:String(n);He(`Service teardown command failed (non-fatal): ${r}`)}})}qt();qt();var fo=(i=>(i.NotFound="not_found",i.NoAccess="no_access",i.Unavailable="unavailable",i.AccessLost="access_lost",i.CannotOpen="cannot_open",i))(fo||{});var EE=t=>`${t.source}:${t.site??""}:${t.key}`;var qu=/^pasted-[0-9a-f]{16}$/,Za=/^file-[0-9a-f]{16}$/,Yu=(s=>(s.Pdf="application/pdf",s.Csv="text/csv",s.Docx="application/vnd.openxmlformats-officedocument.wordprocessingml.document",s.Xlsx="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",s))(Yu||{}),Ju=t=>t.trim().toUpperCase(),w0=(t,e)=>{let n=t.trim();return qu.test(n.toLowerCase())?"Pasted text":Za.test(n.toLowerCase())?e?.get(Ju(n))??"Uploaded document":/^\d+$/.test(n)?`Confluence page ${n}`:n.toUpperCase()};var up=(r=>(r.New="new",r.Updated="updated",r.Existing="existing",r))(up||{}),ho=(r=>(r.Sufficient="sufficient",r.Insufficient="insufficient",r.NoChange="no_change",r))(ho||{}),Xa=(k=>(k.RelatedChangeConflict="related_change_conflict",k.ReferenceOutsideTarget="reference_outside_target",k.SourceAccessLost="source_access_lost",k.ConfigurationIncomplete="configuration_incomplete",k.CredentialUnavailable="credential_unavailable",k.WorkflowBindingUnverified="workflow_binding_unverified",k.WorkflowRefUnprotected="workflow_ref_unprotected",k.BedrockWorkflowRequired="bedrock_workflow_required",k.DeploymentReview="deployment_review",k.SutRevisionMismatch="sut_revision_mismatch",k.IsolationUnavailable="isolation_unavailable",k.EvidenceInsufficient="evidence_insufficient",k.ConfigurationUnresolved="configuration_unresolved",k.ModelProviderDenied="model_provider_denied",k.ModelProviderUnavailable="model_provider_unavailable",k.RunnerProviderNotReady="runner_provider_not_ready",k.MergeConflict="merge_conflict",k))(Xa||{}),Ks=(i=>(i.CiCheck="ci_check",i.TestReport="test_report",i.StaticAnalysis="static_analysis",i.CodeReview="code_review",i.Other="other",i))(Ks||{}),lp=(r=>(r.Application="application",r.Environment="environment",r.TestDefect="test_defect",r))(lp||{}),dp=(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))(dp||{});var Ap=(n=>(n.Probe="probe",n.Agent="agent",n))(Ap||{}),pp=(r=>(r.Seed="seed",r.RuntimeMock="runtime_mock",r.EnvOverride="env_override",r))(pp||{}),fp=(r=>(r.TestCode="test_code",r.SkyrampMocker="skyramp_mocker",r.RecipeOverride="recipe_override",r))(fp||{});var ec=t=>t.slice(0,12);var zJ=["generate-unit","native-run"],I7=["preflight","plan","write",...zJ,"report","deliver"];var gp=(r=>(r.Unit="unit",r.Integration="integration",r.E2e="e2e",r))(gp||{});var Ql=ce(require("path"));var mp="\xABredacted\xBB";function KJ(t){return t.replace(/AUTHORIZATION: (basic|bearer) \S+/gi,"AUTHORIZATION: $1 ***").replace(/x-access-token:[^@\s]+@/gi,"x-access-token:***@")}function bn(t,e){if(!t||e.length===0)return t;let n=t;for(let r of e)!r||!n.includes(r)||(n=n.split(r).join(mp));return n}function yp(t,e){return bn(KJ(t),e)}var R7=new TextDecoder("utf-8",{fatal:!0});function yt(t,e=[]){let n=t.trim();if(!n)return{error:"session produced no output"};let r=l=>{try{let d=JSON.parse(l);return typeof d=="object"&&d!==null&&!Array.isArray(d)?d:void 0}catch{return}},s=r(n);if(s!==void 0)return{value:s};let i;if(n.startsWith("{")&&n.endsWith("}"))try{JSON.parse(n)}catch(l){i=l instanceof Error?l.message:String(l)}let o=[...n.matchAll(/```(?:json)?\s*\n([\s\S]*?)```/g)];for(let l=o.length-1;l>=0;l--){let d=r(o[l][1].trim());if(d!==void 0)return{value:d}}let c;for(let l=n.indexOf("{");l!==-1;l=n.indexOf("{",l+1)){let d=0,A=!1,f=!1;for(let h=l;h<n.length;h++){let y=n[h];if(f){f=!1;continue}if(y==="\\"){f=A;continue}if(y==='"'){A=!A;continue}if(!A){if(y==="{")d++;else if(y==="}"&&(d--,d===0)){let B=r(n.slice(l,h+1));B!==void 0&&Object.keys(B).length>0&&(c=B,l=h);break}}}}return i&&(c===void 0||Object.keys(c).length<3)?{error:`final message is not valid JSON \u2014 ${i}. 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}:i?{error:`final message is not valid JSON \u2014 ${i}. 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: "${ZJ(bn(n,e))}"`}}var b0=240;function ZJ(t){let e=t.replace(/\s+/g," ").trim();return e.length<=b0?e:`\u2026${e.slice(-b0)}`}var Wu=ce(require("fs")),zu=ce(require("path"));var XJ=8;function kt(t,e,n={}){let r=e.slice(0,XJ),s=e.length-r.length;return{name:t,passed:!1,details:r.join("; ")+(s>0?`; \u2026and ${s} more`:""),...n.fatal?{fatal:!0}:{}}}function go(t){if(Wu.existsSync(t))try{return JSON.parse(Wu.readFileSync(t,"utf-8"))}catch{return}}function Ze(t,e){return go(zu.join(t.outputsDir,e))}function Un(t,e){return{name:t,verify(n,r){let{errors:s}=e(n,r);return s.length===0?{name:this.name,passed:!0}:kt(this.name,s,{fatal:!0})}}}function Ku(t){return t.replace(/\s+/g," ").trim()}var Ep=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 u={};Cf(u,{BRAND:()=>QW,DIRTY:()=>mo,EMPTY_PATH:()=>rW,INVALID:()=>Ae,NEVER:()=>uz,OK:()=>Lt,ParseStatus:()=>xt,Schema:()=>Se,ZodAny:()=>ei,ZodArray:()=>gs,ZodBigInt:()=>Eo,ZodBoolean:()=>Co,ZodBranded:()=>Xu,ZodCatch:()=>To,ZodDate:()=>Io,ZodDefault:()=>xo,ZodDiscriminatedUnion:()=>wp,ZodEffects:()=>On,ZodEnum:()=>Ro,ZodError:()=>on,ZodFirstPartyTypeKind:()=>ge,ZodFunction:()=>Bp,ZodIntersection:()=>Qo,ZodIssueCode:()=>G,ZodLazy:()=>So,ZodLiteral:()=>vo,ZodMap:()=>ac,ZodNaN:()=>uc,ZodNativeEnum:()=>ko,ZodNever:()=>lr,ZodNull:()=>bo,ZodNullable:()=>Fr,ZodNumber:()=>yo,ZodObject:()=>an,ZodOptional:()=>Pn,ZodParsedType:()=>X,ZodPipeline:()=>el,ZodPromise:()=>ti,ZodReadonly:()=>No,ZodRecord:()=>bp,ZodSchema:()=>Se,ZodSet:()=>cc,ZodString:()=>Xs,ZodSymbol:()=>ic,ZodTransformer:()=>On,ZodTuple:()=>Dr,ZodType:()=>Se,ZodUndefined:()=>wo,ZodUnion:()=>Bo,ZodUnknown:()=>hs,ZodVoid:()=>oc,addIssueToContext:()=>K,any:()=>FW,array:()=>PW,bigint:()=>kW,boolean:()=>F0,coerce:()=>cz,custom:()=>T0,date:()=>xW,datetimeRegex:()=>k0,defaultErrorMap:()=>ps,discriminatedUnion:()=>VW,effect:()=>ez,enum:()=>KW,function:()=>JW,getErrorMap:()=>nc,getParsedType:()=>Nr,instanceof:()=>vW,intersection:()=>GW,isAborted:()=>Cp,isAsync:()=>rc,isDirty:()=>Ip,isValid:()=>Zs,late:()=>SW,lazy:()=>WW,literal:()=>zW,makeIssue:()=>Zu,map:()=>qW,nan:()=>RW,nativeEnum:()=>ZW,never:()=>MW,null:()=>DW,nullable:()=>nz,number:()=>D0,object:()=>LW,objectUtil:()=>CE,oboolean:()=>az,onumber:()=>oz,optional:()=>tz,ostring:()=>iz,pipeline:()=>sz,preprocess:()=>rz,promise:()=>XW,quotelessJson:()=>eW,record:()=>HW,set:()=>YW,setErrorMap:()=>nW,strictObject:()=>OW,string:()=>N0,symbol:()=>TW,transformer:()=>ez,tuple:()=>jW,undefined:()=>NW,union:()=>$W,unknown:()=>_W,util:()=>xe,void:()=>UW});var xe;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{let i={};for(let o of s)i[o]=o;return i},t.getValidEnumValues=s=>{let i=t.objectKeys(s).filter(c=>typeof s[s[c]]!="number"),o={};for(let c of i)o[c]=s[c];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(let o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(xe||(xe={}));var CE;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(CE||(CE={}));var X=xe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Nr=t=>{switch(typeof t){case"undefined":return X.undefined;case"string":return X.string;case"number":return Number.isNaN(t)?X.nan:X.number;case"boolean":return X.boolean;case"function":return X.function;case"bigint":return X.bigint;case"symbol":return X.symbol;case"object":return Array.isArray(t)?X.array:t===null?X.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?X.promise:typeof Map<"u"&&t instanceof Map?X.map:typeof Set<"u"&&t instanceof Set?X.set:typeof Date<"u"&&t instanceof Date?X.date:X.object;default:return X.unknown}};var G=xe.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"]),eW=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),on=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){let n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let c=r,l=0;for(;l<o.path.length;){let d=o.path[l],A=l===o.path.length-1;if(d==="_errors"){A&&c._errors.push(n(o)),l++;continue}Object.prototype.hasOwnProperty.call(c,d)||(d==="__proto__"?Object.defineProperty(c,d,{value:{_errors:[]},writable:!0,enumerable:!0,configurable:!0}):c[d]={_errors:[]}),c=c[d],A&&c._errors.push(n(o)),l++}}};return s(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,xe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n=Object.create(null),r=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};on.create=t=>new on(t);var tW=(t,e)=>{let n;switch(t.code){case G.invalid_type:t.received===X.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case G.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,xe.jsonStringifyReplacer)}`;break;case G.unrecognized_keys:n=`Unrecognized key(s) in object: ${xe.joinValues(t.keys,", ")}`;break;case G.invalid_union:n="Invalid input";break;case G.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${xe.joinValues(t.options)}`;break;case G.invalid_enum_value:n=`Invalid enum value. Expected ${xe.joinValues(t.options)}, received '${t.received}'`;break;case G.invalid_arguments:n="Invalid function arguments";break;case G.invalid_return_type:n="Invalid function return type";break;case G.invalid_date:n="Invalid date";break;case G.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:xe.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case G.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case G.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case G.custom:n="Invalid input";break;case G.invalid_intersection_types:n="Intersection results could not be merged";break;case G.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case G.not_finite:n="Number must be finite";break;default:n=e.defaultError,xe.assertNever(t)}return{message:n}},ps=tW;var B0=ps;function nW(t){B0=t}function nc(){return B0}var Zu=t=>{let{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let c="",l=r.filter(d=>!!d).slice().reverse();for(let d of l)c=d(o,{data:e,defaultError:c}).message;return{...s,path:i,message:c}},rW=[];function K(t,e){let n=nc(),r=Zu({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===ps?void 0:ps].filter(s=>!!s)});t.common.issues.push(r)}var xt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){let r=[];for(let s of n){if(s.status==="aborted")return Ae;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let s of n){let i=await s.key,o=await s.value;r.push({key:i,value:o})}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let s of n){let{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return Ae;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}},Ae=Object.freeze({status:"aborted"}),mo=t=>({status:"dirty",value:t}),Lt=t=>({status:"valid",value:t}),Cp=t=>t.status==="aborted",Ip=t=>t.status==="dirty",Zs=t=>t.status==="valid",rc=t=>typeof Promise<"u"&&t instanceof Promise;var re;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(re||(re={}));var Ln=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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}},Q0=(t,e)=>{if(Zs(e))return{success:!0,data:e.value};if(!t.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 on(t.common.issues);return this._error=n,this._error}}};function be(t){if(!t)return{};let{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,c)=>{let{message:l}=t;return o.code==="invalid_enum_value"?{message:l??c.defaultError}:typeof c.data>"u"?{message:l??r??c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:l??n??c.defaultError}},description:s}}var Se=class{get description(){return this._def.description}_getType(e){return Nr(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new xt,ctx:{common:e.parent.common,data:e.data,parsedType:Nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(rc(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nr(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Q0(r,s)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nr(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return Zs(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(r=>Zs(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nr(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(rc(s)?s:Promise.resolve(s));return Q0(r,i)}refine(e,n){let r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{let o=e(s),c=()=>i.addIssue({code:G.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new On({schema:this,typeName:ge.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Pn.create(this,this._def)}nullable(){return Fr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gs.create(this)}promise(){return ti.create(this,this._def)}or(e){return Bo.create([this,e],this._def)}and(e){return Qo.create(this,e,this._def)}transform(e){return new On({...be(this._def),schema:this,typeName:ge.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new xo({...be(this._def),innerType:this,defaultValue:n,typeName:ge.ZodDefault})}brand(){return new Xu({typeName:ge.ZodBranded,type:this,...be(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new To({...be(this._def),innerType:this,catchValue:n,typeName:ge.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return el.create(this,e)}readonly(){return No.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},sW=/^c[^\s-]{8,}$/i,iW=/^[0-9a-z]+$/,oW=/^[0-9A-HJKMNP-TV-Z]{26}$/i,aW=/^[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,cW=/^[a-z0-9_-]{21}$/i,uW=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,lW=/^[-+]?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)?)??$/,dW=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,AW="^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",IE,pW=/^(?:(?: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])$/,fW=/^(?:(?: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])$/,hW=/^(([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]))$/,gW=/^(([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])$/,mW=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,yW=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,v0="((\\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])))",EW=new RegExp(`^${v0}$`);function R0(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function CW(t){return new RegExp(`^${R0(t)}$`)}function k0(t){let e=`${v0}T${R0(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function IW(t,e){return!!((e==="v4"||!e)&&pW.test(t)||(e==="v6"||!e)&&hW.test(t))}function wW(t,e){if(!uW.test(t))return!1;try{let[n]=t.split(".");if(!n)return!1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function bW(t,e){return!!((e==="v4"||!e)&&fW.test(t)||(e==="v6"||!e)&&gW.test(t))}var Xs=class t extends Se{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==X.string){let i=this._getOrReturnCtx(e);return K(i,{code:G.invalid_type,expected:X.string,received:i.parsedType}),Ae}let r=new xt,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:G.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:G.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,c=e.data.length<i.value;(o||c)&&(s=this._getOrReturnCtx(e,s),o?K(s,{code:G.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&K(s,{code:G.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")dW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"email",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")IE||(IE=new RegExp(AW,"u")),IE.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"emoji",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")aW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"uuid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")cW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"nanoid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")sW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"cuid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")iW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"cuid2",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")oW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"ulid",code:G.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),K(s,{validation:"url",code:G.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"regex",code:G.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?k0(i).test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?EW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?CW(i).test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{code:G.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?lW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"duration",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?IW(e.data,i.version)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"ip",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?wW(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"jwt",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?bW(e.data,i.version)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"cidr",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?mW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"base64",code:G.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?yW.test(e.data)||(s=this._getOrReturnCtx(e,s),K(s,{validation:"base64url",code:G.invalid_string,message:i.message}),r.dirty()):xe.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:G.invalid_string,...re.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...re.errToObj(e)})}url(e){return this._addCheck({kind:"url",...re.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...re.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...re.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...re.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...re.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...re.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...re.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...re.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...re.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...re.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...re.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...re.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...re.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...re.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...re.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...re.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...re.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...re.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...re.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...re.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...re.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...re.errToObj(n)})}nonempty(e){return this.min(1,re.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Xs.create=t=>new Xs({checks:[],typeName:ge.ZodString,coerce:t?.coerce??!1,...be(t)});function BW(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}var yo=class t extends Se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==X.number){let i=this._getOrReturnCtx(e);return K(i,{code:G.invalid_type,expected:X.number,received:i.parsedType}),Ae}let r,s=new xt;for(let i of this._def.checks)i.kind==="int"?xe.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),K(r,{code:G.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?BW(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),K(r,{code:G.not_finite,message:i.message}),s.dirty()):xe.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,re.toString(n))}gt(e,n){return this.setLimit("min",e,!1,re.toString(n))}lte(e,n){return this.setLimit("max",e,!0,re.toString(n))}lt(e,n){return this.setLimit("max",e,!1,re.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:re.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:re.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:re.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:re.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:re.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:re.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&xe.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}};yo.create=t=>new yo({checks:[],typeName:ge.ZodNumber,coerce:t?.coerce||!1,...be(t)});var Eo=class t extends Se{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==X.bigint)return this._getInvalidInput(e);let r,s=new xt;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),K(r,{code:G.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):xe.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return K(n,{code:G.invalid_type,expected:X.bigint,received:n.parsedType}),Ae}gte(e,n){return this.setLimit("min",e,!0,re.toString(n))}gt(e,n){return this.setLimit("min",e,!1,re.toString(n))}lte(e,n){return this.setLimit("max",e,!0,re.toString(n))}lt(e,n){return this.setLimit("max",e,!1,re.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:re.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:re.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:re.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};Eo.create=t=>new Eo({checks:[],typeName:ge.ZodBigInt,coerce:t?.coerce??!1,...be(t)});var Co=class extends Se{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==X.boolean){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.boolean,received:r.parsedType}),Ae}return Lt(e.data)}};Co.create=t=>new Co({typeName:ge.ZodBoolean,coerce:t?.coerce||!1,...be(t)});var Io=class t extends Se{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==X.date){let i=this._getOrReturnCtx(e);return K(i,{code:G.invalid_type,expected:X.date,received:i.parsedType}),Ae}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return K(i,{code:G.invalid_date}),Ae}let r=new xt,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:G.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),K(s,{code:G.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):xe.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:re.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:re.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};Io.create=t=>new Io({checks:[],coerce:t?.coerce||!1,typeName:ge.ZodDate,...be(t)});var ic=class extends Se{_parse(e){if(this._getType(e)!==X.symbol){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.symbol,received:r.parsedType}),Ae}return Lt(e.data)}};ic.create=t=>new ic({typeName:ge.ZodSymbol,...be(t)});var wo=class extends Se{_parse(e){if(this._getType(e)!==X.undefined){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.undefined,received:r.parsedType}),Ae}return Lt(e.data)}};wo.create=t=>new wo({typeName:ge.ZodUndefined,...be(t)});var bo=class extends Se{_parse(e){if(this._getType(e)!==X.null){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.null,received:r.parsedType}),Ae}return Lt(e.data)}};bo.create=t=>new bo({typeName:ge.ZodNull,...be(t)});var ei=class extends Se{constructor(){super(...arguments),this._any=!0}_parse(e){return Lt(e.data)}};ei.create=t=>new ei({typeName:ge.ZodAny,...be(t)});var hs=class extends Se{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Lt(e.data)}};hs.create=t=>new hs({typeName:ge.ZodUnknown,...be(t)});var lr=class extends Se{_parse(e){let n=this._getOrReturnCtx(e);return K(n,{code:G.invalid_type,expected:X.never,received:n.parsedType}),Ae}};lr.create=t=>new lr({typeName:ge.ZodNever,...be(t)});var oc=class extends Se{_parse(e){if(this._getType(e)!==X.undefined){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.void,received:r.parsedType}),Ae}return Lt(e.data)}};oc.create=t=>new oc({typeName:ge.ZodVoid,...be(t)});var gs=class t extends Se{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==X.array)return K(n,{code:G.invalid_type,expected:X.array,received:n.parsedType}),Ae;if(s.exactLength!==null){let o=n.data.length>s.exactLength.value,c=n.data.length<s.exactLength.value;(o||c)&&(K(n,{code:o?G.too_big:G.too_small,minimum:c?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(K(n,{code:G.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(K(n,{code:G.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,c)=>s.type._parseAsync(new Ln(n,o,n.path,c)))).then(o=>xt.mergeArray(r,o));let i=[...n.data].map((o,c)=>s.type._parseSync(new Ln(n,o,n.path,c)));return xt.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:re.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:re.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:re.toString(n)}})}nonempty(e){return this.min(1,e)}};gs.create=(t,e)=>new gs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ge.ZodArray,...be(e)});function sc(t){if(t instanceof an){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=Pn.create(sc(r))}return new an({...t._def,shape:()=>e})}else return t instanceof gs?new gs({...t._def,type:sc(t.element)}):t instanceof Pn?Pn.create(sc(t.unwrap())):t instanceof Fr?Fr.create(sc(t.unwrap())):t instanceof Dr?Dr.create(t.items.map(e=>sc(e))):t}var an=class t extends Se{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=xe.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==X.object){let d=this._getOrReturnCtx(e);return K(d,{code:G.invalid_type,expected:X.object,received:d.parsedType}),Ae}let{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof lr&&this._def.unknownKeys==="strip"))for(let d in s.data)o.includes(d)||c.push(d);let l=[];for(let d of o){let A=i[d],f=s.data[d];l.push({key:{status:"valid",value:d},value:A._parse(new Ln(s,f,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof lr){let d=this._def.unknownKeys;if(d==="passthrough")for(let A of c)l.push({key:{status:"valid",value:A},value:{status:"valid",value:s.data[A]}});else if(d==="strict")c.length>0&&(K(s,{code:G.unrecognized_keys,keys:c}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let A of c){let f=s.data[A];l.push({key:{status:"valid",value:A},value:d._parse(new Ln(s,f,s.path,A)),alwaysSet:A in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let A of l){let f=await A.key,h=await A.value;d.push({key:f,value:h,alwaysSet:A.alwaysSet})}return d}).then(d=>xt.mergeObjectSync(r,d)):xt.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return re.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:re.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ge.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of xe.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of xe.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return sc(this)}partial(e){let n={};for(let r of xe.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of xe.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Pn;)i=i._def.innerType;n[r]=i}return new t({...this._def,shape:()=>n})}keyof(){return x0(xe.objectKeys(this.shape))}};an.create=(t,e)=>new an({shape:()=>t,unknownKeys:"strip",catchall:lr.create(),typeName:ge.ZodObject,...be(e)});an.strictCreate=(t,e)=>new an({shape:()=>t,unknownKeys:"strict",catchall:lr.create(),typeName:ge.ZodObject,...be(e)});an.lazycreate=(t,e)=>new an({shape:t,unknownKeys:"strip",catchall:lr.create(),typeName:ge.ZodObject,...be(e)});var Bo=class extends Se{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(let c of i)if(c.result.status==="valid")return c.result;for(let c of i)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;let o=i.map(c=>new on(c.ctx.common.issues));return K(n,{code:G.invalid_union,unionErrors:o}),Ae}if(n.common.async)return Promise.all(r.map(async i=>{let o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i,o=[];for(let l of r){let d={...n,common:{...n.common,issues:[]},parent:null},A=l._parseSync({data:n.data,path:n.path,parent:d});if(A.status==="valid")return A;A.status==="dirty"&&!i&&(i={result:A,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let c=o.map(l=>new on(l));return K(n,{code:G.invalid_union,unionErrors:c}),Ae}}get options(){return this._def.options}};Bo.create=(t,e)=>new Bo({options:t,typeName:ge.ZodUnion,...be(e)});var fs=t=>t instanceof So?fs(t.schema):t instanceof On?fs(t.innerType()):t instanceof vo?[t.value]:t instanceof Ro?t.options:t instanceof ko?xe.objectValues(t.enum):t instanceof xo?fs(t._def.innerType):t instanceof wo?[void 0]:t instanceof bo?[null]:t instanceof Pn?[void 0,...fs(t.unwrap())]:t instanceof Fr?[null,...fs(t.unwrap())]:t instanceof Xu||t instanceof No?fs(t.unwrap()):t instanceof To?fs(t._def.innerType):[],wp=class t extends Se{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==X.object)return K(n,{code:G.invalid_type,expected:X.object,received:n.parsedType}),Ae;let r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(K(n,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ae)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let s=new Map;for(let i of n){let o=fs(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of o){if(s.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);s.set(c,i)}}return new t({typeName:ge.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...be(r)})}};function wE(t,e){let n=Nr(t),r=Nr(e);if(t===e)return{valid:!0,data:t};if(n===X.object&&r===X.object){let s=xe.objectKeys(e),i=xe.objectKeys(t).filter(c=>s.indexOf(c)!==-1),o={...t,...e};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let c of i){if(c==="__proto__")continue;let l=wE(t[c],e[c]);if(!l.valid)return{valid:!1};o[c]=l.data}return{valid:!0,data:o}}else if(n===X.array&&r===X.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let i=0;i<t.length;i++){let o=t[i],c=e[i],l=wE(o,c);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===X.date&&r===X.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Qo=class extends Se{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Cp(i)||Cp(o))return Ae;let c=wE(i.value,o.value);return c.valid?((Ip(i)||Ip(o))&&n.dirty(),{status:n.value,value:c.data}):(K(r,{code:G.invalid_intersection_types}),Ae)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Qo.create=(t,e,n)=>new Qo({left:t,right:e,typeName:ge.ZodIntersection,...be(n)});var Dr=class t extends Se{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==X.array)return K(r,{code:G.invalid_type,expected:X.array,received:r.parsedType}),Ae;if(r.data.length<this._def.items.length)return K(r,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ae;!this._def.rest&&r.data.length>this._def.items.length&&(K(r,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());let i=[...r.data].map((o,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new Ln(r,o,r.path,c)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>xt.mergeArray(n,o)):xt.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Dr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dr({items:t,typeName:ge.ZodTuple,rest:null,...be(e)})};var bp=class t extends Se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==X.object)return K(r,{code:G.invalid_type,expected:X.object,received:r.parsedType}),Ae;let s=[],i=this._def.keyType,o=this._def.valueType;for(let c in r.data)s.push({key:i._parse(new Ln(r,c,r.path,c)),value:o._parse(new Ln(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?xt.mergeObjectAsync(n,s):xt.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Se?new t({keyType:e,valueType:n,typeName:ge.ZodRecord,...be(r)}):new t({keyType:Xs.create(),valueType:e,typeName:ge.ZodRecord,...be(n)})}},ac=class extends Se{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==X.map)return K(r,{code:G.invalid_type,expected:X.map,received:r.parsedType}),Ae;let s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([c,l],d)=>({key:s._parse(new Ln(r,c,r.path,[d,"key"])),value:i._parse(new Ln(r,l,r.path,[d,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of o){let d=await l.key,A=await l.value;if(d.status==="aborted"||A.status==="aborted")return Ae;(d.status==="dirty"||A.status==="dirty")&&n.dirty(),c.set(d.value,A.value)}return{status:n.value,value:c}})}else{let c=new Map;for(let l of o){let d=l.key,A=l.value;if(d.status==="aborted"||A.status==="aborted")return Ae;(d.status==="dirty"||A.status==="dirty")&&n.dirty(),c.set(d.value,A.value)}return{status:n.value,value:c}}}};ac.create=(t,e,n)=>new ac({valueType:e,keyType:t,typeName:ge.ZodMap,...be(n)});var cc=class t extends Se{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==X.set)return K(r,{code:G.invalid_type,expected:X.set,received:r.parsedType}),Ae;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(K(r,{code:G.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(K(r,{code:G.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());let i=this._def.valueType;function o(l){let d=new Set;for(let A of l){if(A.status==="aborted")return Ae;A.status==="dirty"&&n.dirty(),d.add(A.value)}return{status:n.value,value:d}}let c=[...r.data.values()].map((l,d)=>i._parse(new Ln(r,l,r.path,d)));return r.common.async?Promise.all(c).then(l=>o(l)):o(c)}min(e,n){return new t({...this._def,minSize:{value:e,message:re.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:re.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};cc.create=(t,e)=>new cc({valueType:t,minSize:null,maxSize:null,typeName:ge.ZodSet,...be(e)});var Bp=class t extends Se{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==X.function)return K(n,{code:G.invalid_type,expected:X.function,received:n.parsedType}),Ae;function r(c,l){return Zu({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,nc(),ps].filter(d=>!!d),issueData:{code:G.invalid_arguments,argumentsError:l}})}function s(c,l){return Zu({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,nc(),ps].filter(d=>!!d),issueData:{code:G.invalid_return_type,returnTypeError:l}})}let i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof ti){let c=this;return Lt(async function(...l){let d=new on([]),A=await c._def.args.parseAsync(l,i).catch(y=>{throw d.addIssue(r(l,y)),d}),f=await Reflect.apply(o,this,A);return await c._def.returns._def.type.parseAsync(f,i).catch(y=>{throw d.addIssue(s(f,y)),d})})}else{let c=this;return Lt(function(...l){let d=c._def.args.safeParse(l,i);if(!d.success)throw new on([r(l,d.error)]);let A=Reflect.apply(o,this,d.data),f=c._def.returns.safeParse(A,i);if(!f.success)throw new on([s(A,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Dr.create(e).rest(hs.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||Dr.create([]).rest(hs.create()),returns:n||hs.create(),typeName:ge.ZodFunction,...be(r)})}},So=class extends Se{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};So.create=(t,e)=>new So({getter:t,typeName:ge.ZodLazy,...be(e)});var vo=class extends Se{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return K(n,{received:n.data,code:G.invalid_literal,expected:this._def.value}),Ae}return{status:"valid",value:e.data}}get value(){return this._def.value}};vo.create=(t,e)=>new vo({value:t,typeName:ge.ZodLiteral,...be(e)});function x0(t,e){return new Ro({values:t,typeName:ge.ZodEnum,...be(e)})}var Ro=class t extends Se{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return K(n,{expected:xe.joinValues(r),received:n.parsedType,code:G.invalid_type}),Ae}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return K(n,{received:n.data,code:G.invalid_enum_value,options:r}),Ae}return Lt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};Ro.create=x0;var ko=class extends Se{_parse(e){let n=xe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==X.string&&r.parsedType!==X.number){let s=xe.objectValues(n);return K(r,{expected:xe.joinValues(s),received:r.parsedType,code:G.invalid_type}),Ae}if(this._cache||(this._cache=new Set(xe.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=xe.objectValues(n);return K(r,{received:r.data,code:G.invalid_enum_value,options:s}),Ae}return Lt(e.data)}get enum(){return this._def.values}};ko.create=(t,e)=>new ko({values:t,typeName:ge.ZodNativeEnum,...be(e)});var ti=class extends Se{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==X.promise&&n.common.async===!1)return K(n,{code:G.invalid_type,expected:X.promise,received:n.parsedType}),Ae;let r=n.parsedType===X.promise?n.data:Promise.resolve(n.data);return Lt(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ti.create=(t,e)=>new ti({type:t,typeName:ge.ZodPromise,...be(e)});var On=class extends Se{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ge.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{K(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async c=>{if(n.value==="aborted")return Ae;let l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?Ae:l.status==="dirty"?mo(l.value):n.value==="dirty"?mo(l.value):l});{if(n.value==="aborted")return Ae;let c=this._def.schema._parseSync({data:o,path:r.path,parent:r});return c.status==="aborted"?Ae:c.status==="dirty"?mo(c.value):n.value==="dirty"?mo(c.value):c}}if(s.type==="refinement"){let o=c=>{let l=s.refinement(c,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Ae:(c.status==="dirty"&&n.dirty(),o(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Ae:(c.status==="dirty"&&n.dirty(),o(c.value).then(()=>({status:n.value,value:c.value}))))}if(s.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Zs(o))return Ae;let c=s.transform(o.value,i);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:r.data,path:r.path,parent:r}).then(o=>Zs(o)?Promise.resolve(s.transform(o.value,i)).then(c=>({status:n.value,value:c})):Ae);xe.assertNever(s)}};On.create=(t,e,n)=>new On({schema:t,typeName:ge.ZodEffects,effect:e,...be(n)});On.createWithPreprocess=(t,e,n)=>new On({schema:e,effect:{type:"preprocess",transform:t},typeName:ge.ZodEffects,...be(n)});var Pn=class extends Se{_parse(e){return this._getType(e)===X.undefined?Lt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Pn.create=(t,e)=>new Pn({innerType:t,typeName:ge.ZodOptional,...be(e)});var Fr=class extends Se{_parse(e){return this._getType(e)===X.null?Lt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Fr.create=(t,e)=>new Fr({innerType:t,typeName:ge.ZodNullable,...be(e)});var xo=class extends Se{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===X.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};xo.create=(t,e)=>new xo({innerType:t,typeName:ge.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...be(e)});var To=class extends Se{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return rc(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new on(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new on(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};To.create=(t,e)=>new To({innerType:t,typeName:ge.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...be(e)});var uc=class extends Se{_parse(e){if(this._getType(e)!==X.nan){let r=this._getOrReturnCtx(e);return K(r,{code:G.invalid_type,expected:X.nan,received:r.parsedType}),Ae}return{status:"valid",value:e.data}}};uc.create=t=>new uc({typeName:ge.ZodNaN,...be(t)});var QW=Symbol("zod_brand"),Xu=class extends Se{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},el=class t extends Se{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ae:i.status==="dirty"?(n.dirty(),mo(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ae:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:ge.ZodPipeline})}},No=class extends Se{_parse(e){let n=this._def.innerType._parse(e),r=s=>(Zs(s)&&(s.value=Object.freeze(s.value)),s);return rc(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};No.create=(t,e)=>new No({innerType:t,typeName:ge.ZodReadonly,...be(e)});function S0(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function T0(t,e={},n){return t?ei.create().superRefine((r,s)=>{let i=t(r);if(i instanceof Promise)return i.then(o=>{if(!o){let c=S0(e,r),l=c.fatal??n??!0;s.addIssue({code:"custom",...c,fatal:l})}});if(!i){let o=S0(e,r),c=o.fatal??n??!0;s.addIssue({code:"custom",...o,fatal:c})}}):ei.create()}var SW={object:an.lazycreate},ge;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ge||(ge={}));var vW=(t,e={message:`Input not instance of ${t.name}`})=>T0(n=>n instanceof t,e),N0=Xs.create,D0=yo.create,RW=uc.create,kW=Eo.create,F0=Co.create,xW=Io.create,TW=ic.create,NW=wo.create,DW=bo.create,FW=ei.create,_W=hs.create,MW=lr.create,UW=oc.create,PW=gs.create,LW=an.create,OW=an.strictCreate,$W=Bo.create,VW=wp.create,GW=Qo.create,jW=Dr.create,HW=bp.create,qW=ac.create,YW=cc.create,JW=Bp.create,WW=So.create,zW=vo.create,KW=Ro.create,ZW=ko.create,XW=ti.create,ez=On.create,tz=Pn.create,nz=Fr.create,rz=On.createWithPreprocess,sz=el.create,iz=()=>N0().optional(),oz=()=>D0().optional(),az=()=>F0().optional(),cz={string:(t=>Xs.create({...t,coerce:!0})),number:(t=>yo.create({...t,coerce:!0})),boolean:(t=>Co.create({...t,coerce:!0})),bigint:(t=>Eo.create({...t,coerce:!0})),date:(t=>Io.create({...t,coerce:!0}))};var uz=Ae;function lz(t){return t.issues.map(e=>{let n=e.path.map(s=>typeof s=="number"?`[${s}]`:`.${s}`).join("").replace(/^\./,""),r=n||"output";if(!/^(Expected |Required$|Invalid |String must|Array must|Number must)/.test(e.message))return`${r} ${e.message}`;switch(e.code){case"invalid_type":return n?e.expected==="object"?`${r} must be an object`:e.received==="undefined"?`${r} is required`:`${r} must be ${e.expected}, got ${e.received}`:"output is not a JSON object";case"invalid_enum_value":{let s=JSON.stringify(e.received),i=e.options.find(c=>typeof c=="string"&&typeof e.received=="string"&&e.received.startsWith(c)),o=i?` \u2014 you sent ${s}; the value must be exactly ${JSON.stringify(i)}, with any qualifier moved to a field that takes free text`:` \u2014 you sent ${s}`;return`${r} must be one of: ${e.options.join(", ")}${o}`}case"invalid_literal":return`${r} must be ${JSON.stringify(e.expected)}`;case"too_small":return e.type==="string"?`${r} must be a non-empty string`:`${r} must have at least ${e.minimum} item(s)`;case"unrecognized_keys":return`${r} has unknown key(s): ${e.keys.join(", ")}`;default:return`${r}: ${e.message}`}})}function Bn(t,e){let n=t.safeParse(e);if(n.success)return{value:n.data,errors:[]};let r=(i,o)=>o.reduce((c,l)=>c&&typeof c=="object"?c[l]:void 0,i),s=n.error.issues.filter(i=>i.path.length&&r(e,i.path)===null);if(s.length===n.error.issues.length)try{let i=t.safeParse(s.reduce((o,{path:c})=>_0(o,c),e));if(i.success)return{value:i.data,errors:[]}}catch{}return{errors:lz(n.error)}}function _0(t,e){if(!e.length||!t||typeof t!="object")return t;let[n,...r]=e,s=Array.isArray(t)?t.slice():{...t};return r.length?s[n]=_0(s[n],r):delete s[n],s}var M0=require("child_process");var tl=ce(require("path"));var ms="Skyramp Testbot",ni="test-bot@skyramp.dev";var dz=(t,e)=>(0,M0.execFileSync)("git",e,{cwd:t,encoding:"utf-8",stdio:["ignore","pipe","ignore"]}).trim();function U0(t){let e="";try{e=dz(t,["remote","get-url","origin"])}catch{}let n=/[:/]([A-Za-z0-9._-]+)\/([A-Za-z0-9._-]+?)(?:\.git)?\/?$/.exec(e);return n&&!e.startsWith("/")&&!e.startsWith(".")?`${n[1]}/${n[2]}`:`local/${tl.basename(tl.resolve(t)).replace(/[^A-Za-z0-9._-]/g,"-")||"repo"}`}var Aee=new Set(Object.values(Ks));var pee=u.object({checks:u.array(u.object({repository:u.string().optional(),name:u.string().min(1),headSha:u.string().regex(/^[0-9a-f]{40}$|^[0-9a-f]{64}$/i),status:u.string().default("completed"),conclusion:u.string().nullable().optional(),url:u.string().optional(),summary:u.string().optional()}))});var bE=new Map;function Az(t){return t.repositorySlug?t.repositorySlug:(bE.has(t.repositoryPath)||bE.set(t.repositoryPath,U0(t.repositoryPath)),bE.get(t.repositoryPath))}function dr(t){return[{slug:Az(t),path:t.repositoryPath,writable:!0,working:!0},...(t.relatedRepos??[]).map(e=>({slug:e.slug,path:e.path,writable:e.writable===!0,working:!1}))]}var BE=(t,e)=>t.toLowerCase()===e.toLowerCase();function QE(t,e){return e?.trim()?t.find(n=>BE(n.slug,e.trim())):t[0]}function lc(t,e){return QE(dr(t),e)}var pz=(t,e)=>`${e} is not a repository of this run (${dr(t).map(n=>n.slug).join(", ")})`;function nl(t,e){let n=lc(t,e);return n?n.writable?{source:n}:{error:`${n.slug} is read-only in this run: tests are written only to ${dr(t).filter(r=>r.writable).map(r=>r.slug).join(", ")}`}:{error:pz(t,e)}}function SE(t){let e=t.split(/[\\/]/)[0];return e===".skyramp"||e===".testbot"}var Es=ce(require("path"));var ri=["-c","core.fsmonitor=false"],fz=new Set(["GH_TOKEN","GITHUB_TOKEN","GH_ENTERPRISE_TOKEN","GITHUB_ENTERPRISE_TOKEN","ACTIONS_RUNTIME_TOKEN","ACTIONS_ID_TOKEN_REQUEST_TOKEN","ACTIONS_ID_TOKEN_REQUEST_URL","SYSTEM_ACCESSTOKEN","SYSTEM_OIDCREQUESTURI","SKYRAMP_MCP_GITHUB_TOKEN","SSH_AUTH_SOCK","GIT_SSH","GIT_SSH_COMMAND","GITHUB_STEP_SUMMARY"]),vE=new Set(["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","CLAUDE_CODE_OAUTH_TOKEN","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY","AWS_SESSION_TOKEN","AWS_BEARER_TOKEN_BEDROCK","AWS_PROFILE","AWS_WEB_IDENTITY_TOKEN_FILE","AWS_ROLE_ARN","AWS_ROLE_SESSION_NAME","AWS_CONTAINER_CREDENTIALS_FULL_URI","AWS_CONTAINER_CREDENTIALS_RELATIVE_URI","AWS_CONTAINER_AUTHORIZATION_TOKEN","AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE"]);function Ot(t=process.env,e,n="repo-command"){let r={};for(let[s,i]of Object.entries(t))n==="repo-command"&&vE.has(s)||(r[s]=i);Object.assign(r,e??{});for(let s of Object.keys(r))(fz.has(s)||s.startsWith("INPUT_"))&&delete r[s];return r}var $0=require("child_process");var O0=ce(require("path"));var Do=(n=>(n.Ready="ready",n.Blocked="blocked",n))(Do||{}),at=u.string().trim().min(1),hz=u.object({action:u.enum(["start","run","wait"]),text:at,source:u.enum(["file","notes","testbot"]).describe("file: a file in the repository; notes: the Target's notes; testbot: Testbot's own finding"),file:at.nullable().describe("the file the step came from, relative to the component's repository; null unless source is file")}).strict().refine(t=>t.source==="file"==(t.file!==null),{path:["file"],message:"a file exactly when the step came from one"}),gz=/^[A-Za-z_][A-Za-z0-9_]*$/,dc=/^(?!GITHUB_)(?!SKYRAMP_RUNNER_)[A-Z][A-Z0-9_]{0,99}$/,Ac=(o=>(o.VersionEndpoint="version_endpoint",o.DeployWorkflow="deploy_workflow",o.KubernetesLabels="kubernetes_labels",o.Command="command",o.Api="api",o.NotTracked="not_tracked",o))(Ac||{}),cn="shared",mz=at.refine(t=>{try{let e=new URL(t);return["http:","https:"].includes(e.protocol)&&!e.username&&!e.password}catch{return!1}},"an http(s) URL with no login in it"),pc=u.object({address:mz,readyWhen:at.nullable(),credentials:u.array(u.string().regex(dc)).max(50),revisionSources:u.array(u.object({method:u.nativeEnum(Ac),detail:at.describe("what Testbot reads, such as GET /version or the deploy workflow's name; for not_tracked, why nothing shows it"),components:u.array(at).min(1).describe("the components it tells the revision of, by name")}).strict()).max(50)}).strict(),RE={steps:u.array(hz).max(20).optional().describe("how it starts, in order"),kind:u.enum(["web_app","service","database","external_service"]).optional(),from:u.object({file:at,service:at.nullable()}).strict().optional(),credentials:u.array(u.string().max(100).regex(gz)).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")},yz=u.object({name:at,repository:at.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:u.boolean(),...RE,deployed:at.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')}),Ez=u.object({component:at,problem:at,evidence:at.describe("the exact command and output that shows it"),fix:at.describe("what the user must provide, and where")}),Cz=u.object({framework:at,file:at.describe("the test file run, relative to its repository root"),result:u.enum(["pass","fail","error"])}),Iz=u.object({input:at.describe("the part of the user's SUT input, as given"),reason:at}),P0=u.object({schemaVersion:u.literal(1),status:u.nativeEnum(Do).describe("ready only if every component came up healthy and the recipe is written"),components:u.array(yz),suites:u.array(Cz).default([]).describe("one run per test suite the Target's repositories have; empty when they have none"),inputsUsed:u.array(at).default([]).describe("the parts of the user's SUT input the recipe used as given"),inputsUsedHow:u.array(u.object({input:at.describe("exactly as written in inputsUsed; an entry that is not there is left out"),how:at.describe("what the recipe did with it")})).optional(),inputsNotUsed:u.array(Iz).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:u.array(Ez).describe("required (non-empty) when status is blocked"),environment:pc.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 rl=64*1024,sl=512*1024,kE=/[\u0000-\u0008\u000b\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;var ys=(s=>(s.Clean="clean",s.RecipeDrift="recipe-drift",s.ChangeBrokeBringup="change-broke-bringup",s.BringupFailed="bringup-failed",s))(ys||{}),Ar=u.string().trim().min(1),wz=u.object({url:u.string().optional().describe("the URL probed, if the check is an HTTP request"),command:u.string().optional().describe("the command run, if the check is a script \u2014 preferred when auth is needed"),headers:u.record(u.string()).optional(),status:u.union([u.number(),u.string()]).optional().describe("expected HTTP status for a url check (default 200)"),output:Ar.describe("what the check returned, VERBATIM \u2014 the bytes, nothing appended; this gate RE-RUNS the check")}),xE=u.array(u.object({component:Ar.describe("a shared component listed above"),url:Ar.describe("the URL on the component's own origin (scheme, host and port) that answers with its deployed commit"),output:Ar.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"),bz=u.object({name:Ar.describe("the credential's environment variable name, as listed above; never its value"),component:Ar.describe("the component that refused it"),status:u.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:Ar.describe("the request or command you tested it with and what came back, never the value")}),L0=u.object({schemaVersion:u.literal(1),baseUrls:u.record(u.string()).optional().describe("service \u2192 base URL of the running app; omit on a failed bring-up, never invent one"),health:wz.optional(),teardown:Ar.describe("command that tears the SUT down"),dependencies:u.record(u.boolean()).optional().describe("EVERY backing service: true = really deployed, false = mocked; REQUIRED when the app came up"),outcome:u.nativeEnum(ys).describe("clean | recipe-drift (you corrected the recipe) | change-broke-bringup (the PR broke it) | bringup-failed (environment, not the PR)"),recipeFixes:u.array(u.string()).optional().describe("required when outcome is recipe-drift: what was corrected"),bringupError:u.object({command:Ar,output:Ar}).optional().describe("required when bring-up failed: the exact failing command and what it printed"),suspectFiles:u.array(u.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:u.boolean(),startedAt:Ar.describe("ISO timestamp"),revisions:xE.optional(),credentialsRefused:u.array(bz).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:u.boolean().optional().describe("[derived] whether the checkout had a recorded recipe before bring-up")});var Tt=u.string().trim().min(1),Qp=Tt,TE=(n=>(n.TestbotManaged="testbot_managed",n.CustomerDeployed="customer_deployed",n))(TE||{}),Sp=[".skyramp/sut/setup.sh",".skyramp/sut/teardown.sh"],NE=u.object({schemaVersion:u.literal(1),type:u.nativeEnum(TE).optional(),repository:Qp.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:u.enum(["ready","blocked"]),environment:pc.optional(),components:u.array(u.object({name:Tt,repository:Tt.describe(`owner/repo, or "${cn}" for a customer-deployed component no repository builds`),healthy:u.boolean(),url:u.string().min(1).nullable(),...RE,credentials:u.array(u.string().regex(dc)).max(50).optional(),deployed:Tt.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:u.array(u.object({framework:Tt,file:Tt,result:u.enum(["pass","fail","error"])}).strict()),inputsUsed:u.array(Tt),inputsUsedHow:u.array(u.object({input:Tt,how:Tt}).strict()).optional(),inputsNotUsed:u.array(u.object({input:Tt,reason:Tt}).strict()),blockers:u.array(u.object({component:Tt,problem:Tt,evidence:Tt,fix:Tt}).strict()),replay:u.object({outcome:Tt,durationSeconds:u.number().nonnegative().nullable()}).strict().nullable(),files:u.array(u.object({path:Tt,content:u.string()}).strict())}).strict().superRefine((t,e)=>{t.inputsUsedHow?.forEach((s,i)=>{t.inputsUsed.includes(s.input)||e.addIssue({code:u.ZodIssueCode.custom,path:["inputsUsedHow",i,"input"],message:"not one of inputsUsed"})}),t.components.forEach((s,i)=>{s.credentials&&new Set(s.credentials).size!==s.credentials.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"credentials"],message:"names a credential twice"})});let n=t.type==="customer_deployed";n!==(t.environment!==void 0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["environment"],message:"an environment exactly when the plan's type is customer_deployed"}),n&&t.repository!==void 0&&e.addIssue({code:u.ZodIssueCode.custom,path:["repository"],message:"a customer_deployed plan names no repository"}),t.environment&&new Set(t.environment.credentials).size!==t.environment.credentials.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["environment","credentials"],message:"names a credential twice"});let r=new Set(t.components.map(s=>s.name));if(t.environment?.revisionSources.forEach((s,i)=>{s.components.forEach((o,c)=>{r.has(o)||e.addIssue({code:u.ZodIssueCode.custom,path:["environment","revisionSources",i,"components",c],message:"not one of components"})})}),t.components.forEach((s,i)=>{s.deployed!==void 0!==n&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"deployed"],message:"what a component runs exactly when the plan is customer_deployed"}),s.repository===cn&&!n&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"repository"],message:`only a customer_deployed component is ${cn}`})}),n&&(t.components.forEach((s,i)=>{t.components.findIndex(o=>o.name===s.name)!==i&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",i,"name"],message:"names a component twice"})}),t.replay!==null&&e.addIssue({code:u.ZodIssueCode.custom,path:["replay"],message:"a customer_deployed plan is never replayed"}),t.files.forEach((s,i)=>{Sp.includes(s.path)&&e.addIssue({code:u.ZodIssueCode.custom,path:["files",i,"path"],message:"a customer_deployed plan has no script that starts or stops the system"})})),n&&t.status==="ready"){let s=new Set(t.environment?.revisionSources.flatMap(i=>i.components));t.components.forEach((i,o)=>{i.repository!==cn&&!s.has(i.name)&&e.addIssue({code:u.ZodIssueCode.custom,path:["components",o,"name"],message:"a ready customer_deployed plan reads what every component a repository builds runs"})})}});var Ree=["clean","recipe-drift"];function il(t){let e=O0.posix.normalize(t);return e===t&&(e===".skyramp/workspace.yml"||e.startsWith(".skyramp/sut/")&&e.length>13)}var DE=[".skyramp/sut",".skyramp/workspace.yml"];var Bz=256*1024*1024,Qz=3e4;function V0(t,e,n=Qz){let r=(0,$0.spawnSync)("git",[...ri,...e],{env:Ot(),cwd:t,encoding:"utf-8",timeout:n,maxBuffer:Bz});return r.status===0?r.stdout.trimEnd():void 0}var _ee=["--",":/",...DE.map(t=>`:(exclude)${t}`)],G0="--literal-pathspecs";function j0(t,e){return!!V0(t,[G0,"status","--porcelain","--",e])}function FE(t,e){return/ blob /.test(V0(t,[G0,"ls-tree","HEAD","--",e])??"")}var ol=ce(require("fs")),Xe=ce(require("path"));var vp=ce(require("fs")),Fo=ce(require("path"));var fc=ce(require("path"));var Pee=fc.join(".skyramp","workspace.yml");var Sz={py:"python",go:"go",java:"java",kt:"kotlin",rb:"ruby",cs:"csharp",ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",kts:"kotlin",rs:"rust",php:"php",scala:"scala",swift:"swift",ex:"elixir",exs:"elixir",dart:"dart",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",groovy:"groovy"};var Lee=new Set(Object.values(Sz));var Jee=5*6e4;function ME(t){try{let r=JSON.parse(vp.readFileSync(Fo.join(t,"package.json"),"utf-8")).packageManager,s=typeof r=="string"?r.match(/^(pnpm|yarn|bun|npm)\b/):null;if(s)return s[1]}catch{}let e=[["pnpm-lock.yaml","pnpm"],["yarn.lock","yarn"],["bun.lockb","bun"],["bun.lock","bun"],["package-lock.json","npm"]],n=Fo.resolve(t);for(let r=0;r<6;r++){for(let[i,o]of e)if(vp.existsSync(Fo.join(n,i)))return o;let s=Fo.dirname(n);if(s===n)break;n=s}return"npm"}var H0=["package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"],vz={"package.json":H0,"pyproject.toml":["poetry.lock","uv.lock","pdm.lock"],Pipfile:["Pipfile.lock"]};function PE(t,e){let n=Xe.basename(e),r=vz[n];if(!r)return[];let s=Xe.resolve(t),i=Xe.dirname(Xe.resolve(s,e)),o=Xe.relative(s,i);if(o===".."||o.startsWith(`..${Xe.sep}`)||Xe.isAbsolute(o))return[];let c=(d,A)=>A.map(f=>Xe.join(Xe.relative(s,d),f)).filter(f=>FE(s,f)),l=c(i,r);if(l.length)return l;for(let d=i;d!==s;){d=Xe.dirname(d);let A=Rz(d,Xe.relative(d,i).split(Xe.sep).join("/"),n);if(A)return c(d,A)}return[]}function q0(t,e){return e.filter(n=>j0(t,n)&&Rp(Xe.join(t,n)))}function Rz(t,e,n){if(n==="package.json"){let r=Dz(Xe.join(t,"pnpm-workspace.yaml"));if(UE(r?.packages,e))return["pnpm-lock.yaml"];let i=xz(Xe.join(t,"package.json"))?.workspaces,o=Array.isArray(i)?i:i?.packages;return UE(o,e)?H0.filter(c=>c!=="pnpm-lock.yaml"):void 0}if(n==="pyproject.toml"){let r=kz(Xe.join(t,"pyproject.toml"));if(r&&UE([...r.members,...r.exclude.map(s=>`!${s}`)],e))return["uv.lock"]}}function UE(t,e){if(!Array.isArray(t))return!1;let n=o=>o.trim().replace(/^\.\//,"").replace(/\/+$/,""),r=t.filter(o=>typeof o=="string"),s=r.filter(o=>!o.startsWith("!")).map(n),i=r.filter(o=>o.startsWith("!")).map(o=>n(o.slice(1)));return s.some(o=>Xe.matchesGlob(e,o))&&!i.some(o=>Xe.matchesGlob(e,o))}function kz(t){let e;try{e=ol.readFileSync(t,"utf-8")}catch{return}let n=e.split(`
117
117
  `),r=n.findIndex(c=>c.trim()==="[tool.uv.workspace]");if(r<0)return;let s=n.findIndex((c,l)=>l>r&&c.trim().startsWith("[")),i=n.slice(r+1,s<0?void 0:s).join(`
118
118
  `),o=c=>{let l=i.match(new RegExp(`^\\s*${c}\\s*=\\s*\\[([^\\]]*)\\]`,"m"));return l?[...l[1].matchAll(/["']([^"']+)["']/g)].map(d=>d[1]):[]};return{members:o("members"),exclude:o("exclude")}}function xz(t){return Tz(Y0(t))}function Tz(t){try{return JSON.parse(t)}catch{return}}function Nz(t){try{return ds(t)}catch{return}}function Dz(t){return Nz(Y0(t))}function Y0(t){try{return ol.readFileSync(t,"utf-8")}catch{return""}}function Rp(t){try{return ol.lstatSync(t).isFile()}catch{return!1}}var LE="test-package.json";var Fz=["node_modules",".venv","test-results","playwright-report","blob-report","__pycache__",".pytest_cache"],J0=t=>t.split(Es.sep).join("/");function OE(t,e){let n=J0(t);return e.some(r=>n===r||n.startsWith(`${r}/`))}function W0(t){return J0(t).split("/").some(e=>Fz.includes(e))}var _z=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K0=/%[psdifjo#]|\$[A-Za-z_][\w.]*/g;var Mz=/ (?:>|›) /;function Uz(t){return t.split(K0).map(e=>e.split(Mz).map(_z).join("(?: > | \u203A | )")).join(".+?")}function Z0(t,e){return new RegExp(K0.source).test(e)?new RegExp(`^(?:.* )?${Uz(e)}$`).test(t):!1}var al=(n=>(n.Full="full",n.Static="static",n))(al||{}),si=(r=>(r.Contract="contract",r.Integration="integration",r.Ui="ui",r))(si||{}),cl=(i=>(i.OwnSurface="own_surface",i.StateReadBack="state_read_back",i.Referential="referential",i.Lifecycle="lifecycle",i.Boundaries="boundaries",i))(cl||{}),ii=(s=>(s.Update="update",s.Regenerate="regenerate",s.Delete="delete",s.Verify="verify",s))(ii||{}),kp=(d=>(d.Equals="equals",d.NotEquals="not_equals",d.GreaterThan="greater_than",d.LessThan="less_than",d.Contains="contains",d.NotContains="not_contains",d.Matches="matches",d.Absent="absent",d.Present="present",d))(kp||{});var Qn=u.string().trim().min(1),Vz=u.object({subject:Qn.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:u.nativeEnum(kp),value:u.union([u.string(),u.number(),u.boolean(),u.null()]).optional().describe("the ONE value a broken build would not produce; OMIT for absent/present")}),Gz=u.object({test:Qn.describe("existing test path, relative to its repository"),repository:Qn.optional().describe("owner/repo the test lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(ii),evidence:Qn.describe("why \u2014 drift vs the diff, or a finding"),covers_behaviors:u.array(u.string()).optional().describe("analyze behavior ids this maintenance covers")});var jz=u.object({surface:Qn.describe("a surface from the list, copied verbatim"),axis:u.nativeEnum(cl)}),Hz=u.object({id:Qn.describe("short-slug, unique across generate[]"),type:u.nativeEnum(si),target:Qn.describe('"METHOD /path", or a business-flow name'),from_finding:u.string().optional().describe("analyze finding id this case catches"),from_behavior:u.string().optional().describe("analyze behavior id this case pins"),derived_from:jz.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:Qn.describe("why this test matters"),expected_observable:Qn.describe("one sentence for a human: what a catching test asserts, and what a broken build does instead"),expected:Vz.describe("the same intent AS DATA \u2014 see the rules below"),seededPrecondition:Qn.optional().describe("seeded non-initial state + how to reach it; only when a seeded-state transition applies"),verifiable:u.boolean().describe("true only when a live SUT could confirm this test (full mode)")}),qz=u.object({covered:u.array(u.string()).optional(),abstain:u.string().optional()}).superRefine((t,e)=>{let n=Array.isArray(t.covered),r=typeof t.abstain=="string";if(n===r)return void e.addIssue({code:u.ZodIssueCode.custom,message:"must have exactly one of covered[] or abstain"});n&&t.covered.length===0&&e.addIssue({code:u.ZodIssueCode.custom,path:["covered"],message:"must list at least one id (else abstain)"}),r&&!t.abstain.trim()&&e.addIssue({code:u.ZodIssueCode.custom,path:["abstain"],message:"must give a reason"})}).describe('{ "covered": [ids] } OR { "abstain": "reason" } \u2014 exactly one'),Yz=u.object({surface:Qn.describe("a surface from the list, copied verbatim"),axes:u.object(Object.fromEntries(Object.values(cl).map(t=>[t,qz])))}),X0=u.object({schemaVersion:u.literal(1),mode:u.nativeEnum(al),maintenance:u.array(Gz),generate:u.array(Hz),surfaces:u.array(Yz).describe("one entry per changed surface in the list \u2014 none missing, none invented"),budget:u.object({total:u.number().describe("case count"),rationale:Qn}),summary:Qn.describe("one paragraph")});var dl=(n=>(n.GitHub="github",n.AzureDevOps="azure-devops",n))(dl||{}),Dp=(i=>(i.Trigger="TRIGGER",i.Baseline="BASELINE",i.AuthoritativeRelatedChange="AUTHORITATIVE_RELATED_CHANGE",i.ConfiguredSharedDependency="CONFIGURED_SHARED_DEPENDENCY",i.ManualOverride="MANUAL_OVERRIDE",i))(Dp||{}),Al=(o=>(o.PullRequest="pull_request",o.ReadyForReview="ready_for_review",o.Schedule="schedule",o.Manual="manual",o.SutSetup="sut_setup",o.RevisionRead="revision_read",o))(Al||{}),Jz=["sut_setup"],Wz=["sut_setup","schedule","revision_read"];var Fp=(e=>(e.PullRequest="pull_request",e))(Fp||{}),VE=(n=>(n.PullRequest="pull_request",n.Branch="branch",n))(VE||{}),eN=["TRIGGER","AUTHORITATIVE_RELATED_CHANGE","MANUAL_OVERRIDE"],pl=(s=>(s.ModelProvider="model_provider",s.SutAccess="sut_access",s.Skyramp="skyramp",s.Other="other",s))(pl||{});var _p=(i=>(i.ReportUploaded="report_uploaded",i.NoReport="no_report",i.Cancelled="cancelled",i.RecipeUploaded="recipe_uploaded",i.RevisionsUploaded="revisions_uploaded",i))(_p||{}),pN=(n=>(n.Running="running",n.Ended="ended",n))(pN||{}),Mp=(f=>(f.TimedOut="timed_out",f.AgentFailed="agent_failed",f.SetupFailed="setup_failed",f.CredentialMissing="credential_missing",f.RunnerLost="runner_lost",f.CheckoutFailed="checkout_failed",f.EnvironmentUnverified="environment_unverified",f.ModelProviderDenied="model_provider_denied",f.ModelProviderUnavailable="model_provider_unavailable",f.RunnerProviderNotReady="runner_provider_not_ready",f.MergeConflict="merge_conflict",f))(Mp||{}),GE=(r=>(r.Onboard="onboard",r.Deploy="deploy",r.Recheck="recheck",r))(GE||{}),jE=(n=>(n.Started="started",n.Finished="finished",n))(jE||{}),HE=(r=>(r.Passed="passed",r.Failed="failed",r.Skipped="skipped",r))(HE||{});var qE=(r=>(r.ChooseCredential="choose_credential",r.FreeText="free_text",r.ChooseSource="choose_source",r))(qE||{});var fl=(r=>(r.Discover="discover",r.Start="start",r.Check="check",r))(fl||{}),hl=(s=>(s.ValidationPlan="validation_plan",s.TestEnvironment="test_environment",s.TestConditions="test_conditions",s.Tests="tests",s))(hl||{});var gl=(s=>(s.Found="found",s.Starting="starting",s.Up="up",s.OutOfScope="out_of_scope",s))(gl||{}),Vn=u.string().regex(/^[1-9][0-9]{0,18}$/),pr=u.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),gc=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,It=u.string().regex(gc),Wt=u.string().regex(/^[0-9a-f]{64}$/),Np=u.object({id:It,revision:Vn}).strict(),Up={provider:u.literal("github"),providerAccountId:Vn,providerRepositoryId:Vn},Pp={provider:u.literal("azure-devops"),providerAccountId:It,providerRepositoryId:It},Gn=u.discriminatedUnion("provider",[u.object(Up).strict(),u.object(Pp).strict()]),YE=u.discriminatedUnion("provider",[u.object(Up).passthrough(),u.object(Pp).passthrough()]),_o=t=>`${t.provider}:${t.providerRepositoryId}`,tN={namespace:u.string().min(1),name:u.string().min(1)},fN=u.discriminatedUnion("provider",[u.object({...Up,...tN}).strict(),u.object({...Pp,...tN}).strict()]),nN=u.object({ref:u.string().min(1),revision:pr}).strict(),zz=u.object({kind:u.nativeEnum(VE),number:Vn.optional(),ref:u.string().min(1),revision:pr,reason:u.nativeEnum(Dp)}).strict(),Kz=u.object({repository:fN,revision:pr,ref:u.string().nullable(),reason:u.nativeEnum(Dp),change:u.object({kind:u.nativeEnum(Fp),number:Vn,base:nN.optional()}).strict().nullable(),compareWith:nN.optional(),merge:u.array(zz).min(2).optional()}).strict();function Zz(t){let e=t.merge;if(!e)return null;if(t.change||t.compareWith)return{path:["merge"],message:"a merged source names no change and no compareWith"};if(t.ref===null)return{path:["ref"],message:"a merged source names its baseline branch"};let n=new Set,r=new Set;for(let[i,o]of e.entries()){if(o.kind==="pull_request"!=(o.number!==void 0))return{path:["merge",i,"number"],message:"a pull request names its number, and a branch none"};if(!eN.includes(o.reason))return{path:["merge",i,"reason"],message:`${o.reason} does not select a merged revision`};if(o.kind==="branch"&&o.reason!=="MANUAL_OVERRIDE")return{path:["merge",i,"reason"],message:"only a person chooses a branch to merge"};if(o.ref===t.ref)return{path:["merge",i,"ref"],message:"the baseline branch is what the source merges onto"};if(o.number!==void 0&&n.has(o.number)||r.has(o.ref))return{path:["merge",i],message:"names a revision the source already merges"};o.number!==void 0&&n.add(o.number),r.add(o.ref)}let s=eN.find(i=>e.some(o=>o.reason===i));return t.reason!==s?{path:["reason"],message:`a source that merges these revisions is ${s}`}:null}function Xz(t){if(t.trigger.kind==="revision_read"!=!t.baseline)return t.baseline?"a revision_read run names no baseline":"names its baseline";if(!t.baseline)return null;let{confirmedRunId:e,initialBaselineId:n,sources:r}=t.baseline;if(e!==null&&n!==void 0)return"a run compares with one baseline";let s=t.trigger.kind==="schedule"&&e!==null||n!==void 0;if(!r)return s?"names every source of the snapshot, once":null;if(e===null&&n===void 0)return"a run with no Confirmed Baseline names no baseline sources";let i=new Set(t.sources.map(l=>_o(l.repository))),o=new Set(r.map(l=>_o(l.repository)));return o.size===r.length&&o.size===i.size&&[...o].every(l=>i.has(l))?null:"names every source of the snapshot, once"}var hN=/^[A-Z][A-Z0-9_]+-[1-9][0-9]*$/,gN=/^[1-9][0-9]{0,18}$/,rN=new RegExp(`${hN.source}|${gN.source}`),sN=/^https:\/\/[a-z0-9-]+(\.[a-z0-9-]+)+$/,e9=u.union([u.object({source:u.literal("jira"),site:u.string().regex(sN),key:u.string().regex(hN),updated:u.string().datetime(),contentHash:Wt}).strict(),u.object({source:u.literal("confluence"),site:u.string().regex(sN),key:u.string().regex(gN),version:u.number().int().positive(),contentHash:Wt}).strict(),u.object({source:u.literal("other"),key:u.string().regex(qu),contentHash:Wt}).strict(),u.object({source:u.literal("other"),key:u.string().regex(Za),contentHash:Wt,fileName:u.string().min(1).max(255),mediaType:u.nativeEnum(Yu)}).strict()]),iN=u.union([u.literal("jira"),u.literal("confluence")]),t9=u.object({schemaVersion:u.literal(1),items:u.array(u.union([u.object({source:iN,site:u.string(),key:u.string().regex(rN),state:u.literal("read"),text:u.string(),version:u.string().min(1),contentMatches:u.boolean()}).strict(),u.object({source:iN,site:u.string(),key:u.string().regex(rN),state:u.literal("not_read"),reason:u.nativeEnum(fo)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(qu),state:u.literal("read"),text:u.string(),version:u.string().min(1),contentMatches:u.boolean()}).strict(),u.object({source:u.literal("other"),key:u.string().regex(qu),state:u.literal("not_read"),reason:u.nativeEnum(fo)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(Za),state:u.literal("read"),version:Wt,fileName:u.string().min(1).max(255),mediaType:u.nativeEnum(Yu)}).strict(),u.object({source:u.literal("other"),key:u.string().regex(Za),state:u.literal("not_read"),reason:u.nativeEnum(fo)}).strict()])),instructions:u.array(u.string()).optional()}).strict(),n9=u.object({schemaVersion:u.literal(1),runId:It,skyrampOrgId:It,target:Np,policy:Np.nullable(),trigger:u.object({kind:u.nativeEnum(Al),requestedAt:u.string().datetime()}).strict(),configuration:u.object({captureId:It,revision:Vn.nullable(),hash:Wt}).strict(),baseline:u.object({confirmedRunId:It.nullable(),initialBaselineId:It.optional(),sources:u.array(u.object({repository:Gn,revision:pr}).strict()).optional()}).strict().optional(),sources:u.array(Kz).min(1),execution:u.object({provider:u.nativeEnum(dl),repository:fN,workflowPath:u.string(),ref:u.string()}).strict(),credentials:u.array(u.object({name:u.string(),purpose:u.nativeEnum(pl),required:u.boolean()}).strict()),requirements:u.array(e9).min(1).optional(),instructions:u.object({contentHash:Wt}).strict().optional(),deployedRevisions:u.array(u.object({repository:Gn,revision:pr}).strict()).min(1).optional()}).strict().superRefine((t,e)=>{let n=new Set;(t.requirements??[]).forEach((l,d)=>{let A="fileName"in l?"file":"pasted";l.source==="other"&&l.key!==`${A}-${l.contentHash.slice(0,16)}`&&e.addIssue({code:u.ZodIssueCode.custom,message:"is not the key of its content hash",path:["requirements",d,"key"]});let f=EE({source:l.source,key:l.key});n.has(f)&&e.addIssue({code:u.ZodIssueCode.custom,message:"names an item that the run already names",path:["requirements",d,"key"]}),n.add(f)});let r=t.trigger.kind,s=Jz.includes(r);s!==(t.policy===null)&&e.addIssue({code:u.ZodIssueCode.custom,path:["policy"],message:s?`a ${r} run has no policy`:"names the policy revision"});let i=Xz(t);i&&e.addIssue({code:u.ZodIssueCode.custom,path:t.baseline?["baseline","sources"]:["baseline"],message:i}),Wz.includes(r)&&t.sources.forEach((l,d)=>{l.reason!=="BASELINE"&&e.addIssue({code:u.ZodIssueCode.custom,path:["sources",d,"reason"],message:`a ${r} run selects only BASELINE sources`})}),t.deployedRevisions&&r!=="manual"&&e.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions"],message:"only a manual run pins deployed revisions"});let o=new Set(t.sources.map(l=>_o(l.repository))),c=new Set;(t.deployedRevisions??[]).forEach((l,d)=>{let A=_o(l.repository);o.has(A)?c.has(A)&&e.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"repository appears twice"}):e.addIssue({code:u.ZodIssueCode.custom,path:["deployedRevisions",d,"repository"],message:"names a repository outside the snapshot"}),c.add(A)}),t.sources.forEach((l,d)=>{l.compareWith&&(l.reason!=="MANUAL_OVERRIDE"||l.change)&&e.addIssue({code:u.ZodIssueCode.custom,path:["sources",d,"compareWith"],message:"only a MANUAL_OVERRIDE source without a change names a revision to compare with"});let A=Zz(l);A&&e.addIssue({code:u.ZodIssueCode.custom,path:["sources",d,...A.path],message:A.message})})});var JE=(n=>(n.Person="person",n.Policy="policy",n))(JE||{}),r9=u.object({kind:u.nativeEnum(JE),name:u.string().min(1).max(256)}).strict(),s9=u.object({mcp:u.discriminatedUnion("source",[u.object({source:u.literal("npm"),version:u.string().regex(/^[A-Za-z0-9][A-Za-z0-9.+_-]{0,63}$/).nullable()}).strict(),u.object({source:u.literal("github"),ref:u.string().regex(/^[A-Za-z0-9._/-]{1,255}$/)}).strict()]),bedrock:u.object({region:u.string().regex(/^[a-z]{2}(-[a-z]+)+-[0-9]$/),roleArn:u.string().regex(/^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role\/[\w+=,.@/-]{1,512}$/)}).strict().nullable()}).strict(),Fte=u.object({schemaVersion:u.literal(1),attempt:u.object({id:It,number:u.number().int().positive(),deadlineAt:u.string().datetime()}).strict(),manifest:n9,manifestHash:Wt,entitlements:u.array(u.string()).optional(),runToken:u.string().min(1).optional(),requestedBy:r9.nullable().optional(),writeAllowed:u.boolean().optional(),claudeCodeVersion:u.string().regex(/^[0-9]+\.[0-9]+\.[0-9]+$/,"an exact version, such as 2.1.290").nullable().optional(),deployedRevisions:u.array(u.object({repository:Gn,revision:pr}).strict()).optional(),statedRevisions:u.array(u.object({repository:Gn,revision:pr}).strict()).optional(),runSettings:s9.optional(),credentialRelay:u.boolean().optional()}).strict(),oN={providerRunAttempt:u.number().int().positive(),workflowRef:u.string().min(1)},i9=u.string().regex(/^[^/]+\/[^/]+\/[1-9][0-9]{0,15}\/[1-9][0-9]{0,15}$/),_te=u.object({schemaVersion:u.literal(1),runId:It,execution:u.discriminatedUnion("provider",[u.object({...oN,provider:u.literal("github"),repository:u.object(Up).strict(),providerRunId:Vn}).strict(),u.object({...oN,provider:u.literal("azure-devops"),repository:u.object(Pp).strict(),providerRunId:i9}).strict()]),requester:u.literal(!0).optional(),writeCheck:u.literal(!0).optional(),claudeCodePin:u.literal(!0).optional(),deployedPins:u.literal(!0).optional(),statedPins:u.literal(!0).optional(),runSettings:u.literal(!0).optional(),credentialRelay:u.literal(!0).optional()}).strict(),aN=u.object({repository:Gn,number:Vn,commitSha:pr.optional()}).strict(),o9=u.discriminatedUnion("status",[u.object({status:u.literal("none")}).strict(),u.object({status:u.literal("delivered"),pullRequests:u.array(aN).min(1)}).strict(),u.object({status:u.literal("partial"),pullRequests:u.array(aN).min(1),failures:u.array(u.object({repository:Gn,message:u.string()}).strict()).min(1)}).strict(),u.object({status:u.literal("failed"),message:u.string()}).strict()]),a9=1024*1024,xp=t=>u.array(u.object({[t]:u.string()}).strict()).optional(),c9=u.object({language:u.custom(t=>t==="ja","Invalid"),businessCaseAnalysis:u.string(),validation:u.object({rationale:u.string(),gaps:u.array(u.string())}).strict().optional(),changes:u.array(u.object({id:u.string(),text:u.string()}).strict()).optional(),issuesFound:xp("description"),newTestsCreated:xp("description"),testResults:xp("details"),caveats:xp("text")}).strict(),u9=u.object({blockedPreflight:u.object({file:u.string().min(1),repository:u.string().min(1).optional(),reason:u.string().min(1).max(300),evidence:u.string().min(1).max(400)}).strict().optional(),sufficiency:u.nativeEnum(ho),rationale:u.string().min(1),gaps:u.array(u.string().min(1)),acceptedEvidence:u.array(u.object({kind:u.nativeEnum(Ks),repository:u.string().min(1),revision:pr,reference:u.string().min(1),summary:u.string().min(1)}).strict()),actionRequired:u.array(u.nativeEnum(Xa))}).strict().superRefine((t,e)=>{t.sufficiency==="insufficient"!=t.gaps.length>0&&e.addIssue({code:u.ZodIssueCode.custom,path:["gaps"],message:"only insufficient evidence names gaps, and it names at least one"}),new Set(t.actionRequired).size!==t.actionRequired.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["actionRequired"],message:"a reason appears twice"})}),Tp=500,mN=2048,yN=1e3,l9=/[\\/:*?"<>|;#$*{},+=[\]%\p{Cc}\p{Cf}]/u,cN=t=>t.length>0&&t.length<=64&&t===t.trim()&&!l9.test(t)&&!/[^\S ]/u.test(t)&&!/^[._]/.test(t)&&!t.endsWith("."),d9=t=>{if(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/.test(t))return!0;let[e,n,r,...s]=t.split("/");return t.length<=201&&s.length===0&&r!==void 0&&/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,48}[A-Za-z0-9])?$/.test(e)&&cN(n)&&cN(r)},A9=u.object({testResults:u.array(u.object({resultId:u.string().regex(/^[^\u0000-\u001f]{1,512}$/),repository:u.string().refine(d9,"Invalid"),testType:u.string(),endpoint:u.string(),status:u.enum(["Pass","Fail","Skipped"]),details:u.string(),fileName:u.string().optional(),testId:u.string().regex(/^[^\u0000-\u001f]{1,512}$/).optional(),failureCause:u.object({kind:u.nativeEnum(lp),family:u.nativeEnum(dp).optional()}).strict().optional(),origin:u.nativeEnum(up).optional()}).strict()),validation:u9,changes:u.array(u.object({id:u.string().min(1).max(512),text:u.string().max(16384),source:u.string().max(mN),testedBy:u.array(u.string().min(1).max(1024)).max(Tp),writtenBy:u.array(u.string().min(1).max(1024)).max(Tp),maintainedBy:u.array(u.string().min(1).max(1024)).max(Tp)}).strict()).max(yN).optional(),traceVersion:u.literal(1),display:c9.optional()}).passthrough().superRefine((t,e)=>{let n=t.display,r={issuesFound:t.issuesFound,newTestsCreated:t.newTestsCreated,testResults:t.testResults,caveats:t.caveats};for(let i of["issuesFound","newTestsCreated","testResults","caveats"]){let o=n?.[i];o&&o.length!==(Array.isArray(r[i])?r[i].length:0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["display",i],message:`has not one row per ${i} row`})}n?.validation&&n.validation.gaps.length!==t.validation.gaps.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["display","validation","gaps"],message:"has not one gap per validation gap"});let s=new Set;t.testResults.forEach((i,o)=>{let c=i.failureCause;c&&i.status==="Pass"&&e.addIssue({code:u.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"a passing result has no failure cause"}),c&&c.kind==="environment"!=(c.family!==void 0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["testResults",o,"failureCause"],message:"an environment cause names its family, and no other cause does"});let l=["testResults",o,"resultId"],d=i.resultId.slice(`${i.repository}:${i.testType}:`.length);(!i.resultId.startsWith(`${i.repository}:${i.testType}:`)||d===""||d.startsWith("/")||d.startsWith("#"))&&e.addIssue({code:u.ZodIssueCode.custom,path:l,message:"is not repository:testType:path for this result"}),s.has(i.resultId)&&e.addIssue({code:u.ZodIssueCode.custom,path:l,message:"stable identity repeated"}),s.add(i.resultId)})});var EN=50,uN=u.string().regex(/^(?!.*\.\.)(?!\/)(?!.*\/$)[A-Za-z0-9._/-]{1,255}$/),CN=u.discriminatedUnion("kind",[u.object({kind:u.literal("branch_pushed"),repository:Gn,branch:uN,commit:pr}).strict(),u.object({kind:u.enum(["pull_request_opened","pull_request_edited"]),repository:Gn,number:Vn,branch:uN}).strict()]),p9=u.object({schemaVersion:u.literal(1),run:u.object({runId:It,attemptNumber:u.number().int().positive(),manifestHash:Wt}).strict(),target:Np,policy:Np,provenance:u.object({sources:u.array(u.object({repository:Gn,revision:pr}).strict()),firstQualification:u.literal(!0).optional()}).strict(),delivery:u.object({generatedTests:o9}).strict(),producer:u.object({testbot:u.string().regex(/^[0-9A-Za-z.+-]{1,64}$/),mcp:u.string().regex(/^[0-9A-Za-z.+-]{1,64}$/)}).strict(),report:A9,githubWrites:u.array(CN).max(EN).optional()}).strict(),Mte=p9.pick({schemaVersion:!0,run:!0,target:!0,provenance:!0,producer:!0}).extend({recipe:NE}).strict().superRefine(({recipe:t},e)=>{let n=(i,o)=>e.addIssue({code:u.ZodIssueCode.custom,path:["recipe",...i],message:o});t.status==="blocked"&&t.blockers.length===0&&n(["blockers"],"a blocked recipe names at least one blocker");let r=new Set,s=0;t.files.forEach((i,o)=>{il(i.path)||n(["files",o,"path"],"is not .skyramp/workspace.yml or a file under .skyramp/sut/"),r.has(i.path)&&n(["files",o,"path"],"file repeated"),r.add(i.path),kE.test(i.content)&&n(["files",o,"content"],"is not text");let c=Buffer.byteLength(i.content,"utf8");s+=c,c>rl&&n(["files",o,"content"],`larger than ${rl} bytes`)}),s>sl&&n(["files"],`recipe text over ${sl} bytes in total`)}),Ute=u.object({components:u.array(u.object({name:u.string().min(1),repository:u.string().regex(/^[A-Za-z0-9._-]{1,100}\/[A-Za-z0-9._-]{1,100}$/),observedRevision:u.string().regex(/^[0-9a-f]{7,64}$/).nullable(),source:u.nativeEnum(Ap),evidence:u.string()}).strict().refine(t=>t.source!=="agent"||t.observedRevision===null,{path:["observedRevision"],message:"a component only an agent session can read names no revision"}))}).strict();var f9=u.object({schemaVersion:u.literal(1),stage:u.nativeEnum(GE),event:u.nativeEnum(jE),status:u.nativeEnum(HE).optional()}).strict().refine(t=>t.status===void 0||t.event==="finished",{path:["status"],message:"only a finished stage has a status"}),oi=100,WE=5e3,ll=2e3,$E=100,zE=/^[A-Za-z0-9_-]{1,64}$/,IN=20,wN=200,bN=100,BN=100,h9=200,lN="[^/\\s](?:(?:[^/\\s]| )*[^/\\s])?",g9=new RegExp(`^(?:[^/\\s]+/[^/\\s]+|[^/\\s]+/${lN}/${lN})$`),QN=500,SN=50,ml=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/,$n=t=>u.string().max(t).refine(e=>e.trim().length>0&&!ml.test(e),"blank, or not text"),Cs={sequence:u.number().int().min(1).max(WE),at:u.string().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,6})?Z$/)},vN=u.discriminatedUnion("kind",[u.object({...Cs,kind:u.literal("log"),phase:u.nativeEnum(fl),text:$n(ll)}).strict(),u.object({...Cs,kind:u.literal("component"),name:$n($E),repository:$n(h9).refine(t=>g9.test(t)||t===cn,"not owner/name"),file:$n(QN).nullable(),status:u.nativeEnum(gl),version:$n(BN).optional()}).strict(),u.object({...Cs,kind:u.literal("reply"),to:u.string().uuid(),accepted:u.boolean(),text:$n(ll)}).strict(),u.object({...Cs,kind:u.literal("question"),id:u.string().regex(zE),type:u.nativeEnum(qE),text:$n(ll),component:$n($E).nullable(),choices:u.array($n(wN)).max(IN),placeholder:$n(bN).optional()}).strict(),u.object({...Cs,kind:u.literal("delivered"),ids:u.array(u.string().uuid()).max(oi)}).strict(),u.object({...Cs,kind:u.literal("credentials"),names:u.array(u.string().regex(dc)).min(1).max(SN)}).strict()]).superRefine((t,e)=>{t.kind==="credentials"&&new Set(t.names).size!==t.names.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["names"],message:"a name twice"}),t.kind==="question"&&(t.type==="free_text"!=(t.choices.length===0)&&e.addIssue({code:u.ZodIssueCode.custom,path:["choices"],message:"choices exactly when the question is not free_text"}),new Set(t.choices).size!==t.choices.length&&e.addIssue({code:u.ZodIssueCode.custom,path:["choices"],message:"a choice twice"}))}),m9=u.object({schemaVersion:u.literal(1),events:u.array(vN).max(oi)}).strict(),RN=u.discriminatedUnion("kind",[u.object({...Cs,kind:u.literal("log"),stage:u.nativeEnum(hl),text:$n(ll)}).strict(),u.object({...Cs,kind:u.literal("reply"),to:u.string().uuid(),accepted:u.boolean(),text:$n(ll)}).strict(),u.object({...Cs,kind:u.literal("delivered"),ids:u.array(u.string().uuid()).max(oi)}).strict()]),y9=u.object({schemaVersion:u.literal(1),events:u.array(RN).max(oi)}).strict(),dN={id:u.string().uuid(),text:u.string(),by:u.string().nullable(),at:u.string(),replied:u.literal(!0).optional()},kN=u.discriminatedUnion("kind",[u.object({...dN,kind:u.literal("instruction"),question:u.null()}),u.object({...dN,kind:u.literal("answer"),question:u.string().regex(zE)})]),xN=u.string().regex(/^[A-Za-z0-9+/]{43}=$/),E9=u.object({id:u.string().uuid(),revision:u.string(),by:u.string().nullable(),at:u.string(),target:u.string(),own:u.object({source:u.enum(["policy","test_environment"]),text:u.string()}).nullable()}),TN=u.string().regex(/^[A-Za-z0-9+/]{43}=$/),C9=u.object({ephemeralPublicKey:TN,iv:u.string().regex(/^[A-Za-z0-9+/]{16}$/),ciphertext:u.string().min(1).max(65536),tag:u.string().regex(/^[A-Za-z0-9+/]{22}==$/)}).strict();var I9=/^[A-Z][A-Z0-9_]{0,99}$/,w9=new Set(["PATH","HOME","SHELL","USER","LOGNAME","PWD","OLDPWD","TMPDIR","TMP","TEMP","IFS","ENV","BASH_ENV","CDPATH","PS4","NODE_OPTIONS","NODE_PATH","NODE_EXTRA_CA_CERTS","NODE_TLS_REJECT_UNAUTHORIZED","PYTHONPATH","PYTHONHOME","PYTHONSTARTUP","RUBYOPT","RUBYLIB","PERL5OPT","PERL5LIB","JAVA_TOOL_OPTIONS","SSL_CERT_FILE","SSL_CERT_DIR","CURL_CA_BUNDLE","REQUESTS_CA_BUNDLE","HTTP_PROXY","HTTPS_PROXY","NO_PROXY","ALL_PROXY","SSH_AUTH_SOCK","DOCKER_HOST","GIT_SSH","GIT_SSH_COMMAND","GIT_ASKPASS","GIT_EXEC_PATH","GIT_DIR","GIT_WORK_TREE","GIT_PROXY_COMMAND"]),b9=["LD_","DYLD_","GIT_CONFIG","GITHUB_","RUNNER_","ACTIONS_","INPUT_","SKYRAMP_RUNNER_"],B9=t=>I9.test(t)&&!w9.has(t)&&!b9.some(e=>t.startsWith(e)),NN=u.string().refine(B9,"not a name a relay may set"),ul={id:It,credentialName:NN},Q9=u.discriminatedUnion("status",[u.object({...ul,status:u.literal("sealed"),sealed:C9}),u.object({...ul,status:u.literal("pending")}),u.object({...ul,status:u.literal("empty")}),u.object({...ul,status:u.literal("failed")}),u.object({...ul,status:u.literal("expired")})]),Pte=u.object({schemaVersion:u.literal(1),relayId:It,attemptId:It,credentialName:NN,publicKey:TN}).strict(),S9=u.object({schemaVersion:u.literal(1),leftOut:u.array(u.string()),messages:u.array(kN).optional(),stop:u.object({key:xN}).optional(),notes:E9.optional(),relays:u.array(u.unknown()).transform(t=>t.flatMap(e=>{let n=Q9.safeParse(e);return n.success?[n.data]:[]})).optional()}),v9=u.object({schemaVersion:u.literal(1),messages:u.array(kN).optional()});var DN=500*1024*1024,FN=u.object({id:Vn,name:u.string().regex(/^[A-Za-z0-9._-]{1,200}$/),providerRunId:Vn,expiresAt:u.string().datetime()}).strict(),R9=u.object({schemaVersion:u.literal(1),artifact:FN,sessionId:It,contentHash:Wt,bytes:u.number().int().min(1).max(DN)}).strict(),k9=u.object({schemaVersion:u.literal(1),checkpoint:u.object({artifact:FN,repository:u.object({namespace:u.string().min(1),name:u.string().min(1)}).strict(),sessionId:It,contentHash:Wt,key:xN}).strict().nullable()}).strict(),x9=200,hc=100,KE=(r=>(r.Resume="resume",r.Retry="retry",r.Update="update",r))(KE||{}),T9=u.object({kind:u.nativeEnum(KE),setup:u.object({runId:It,endedAt:u.string().nullable(),outcome:u.string().nullable()}).strict(),components:u.array(u.object({name:u.string().min(1),repository:u.string().min(1),status:u.nativeEnum(gl)}).strict()).max(hc),credentials:u.array(u.string().min(1)).max(hc),answers:u.array(u.object({question:u.string(),answer:u.string().nullable()}).strict()).max(hc),instructions:u.array(u.object({text:u.string(),reply:u.string().nullable()}).strict()).max(hc),log:u.array(u.object({phase:u.nativeEnum(fl),text:u.string()}).strict()).max(x9),recipe:u.object({files:u.array(u.object({path:u.string().min(1),content:u.string()}).strict()).max(hc),blockers:u.array(u.object({component:u.string(),problem:u.string(),evidence:u.string(),fix:u.string()}).strict()).max(hc)}).strict().optional()}).strict(),N9=u.object({schemaVersion:u.literal(1),context:T9.nullable()}).strict(),D9=u.object({schemaVersion:u.literal(1),configuration:u.object({captureId:It,revision:Vn.nullable(),hash:Wt}).strict(),capture:u.object({schemaVersion:u.literal(1),settings:u.object({target:u.object({environment:u.unknown()}).passthrough(),timeoutMinutes:u.number().int().positive(),answerWaitMinutes:u.number().int().positive().optional(),testEnvironment:u.object({name:u.string().min(1),address:u.string().min(1).optional(),readyWhen:u.string().min(1).optional()}).passthrough().optional()}).passthrough(),provenance:u.object({}).passthrough(),hash:Wt}).strict()}).strict(),F9=pc.extend({version:u.number().int().positive(),components:u.array(u.object({name:u.string().min(1),repository:u.string().min(1)}).strict()),contentHash:Wt.optional(),files:u.array(u.object({path:u.string().refine(t=>il(t)&&!Sp.includes(t),"not a file of a customer_deployed plan"),content:u.string()}).strict()).optional()}).strict(),_9=u.object({schemaVersion:u.literal(1),testEnvironment:F9.nullable().optional(),runtimePlan:u.object({version:u.number().int().positive(),contentHash:Wt,files:u.array(u.object({path:u.string().refine(il,"not a recipe file path"),content:u.string()}).strict()).min(1),repository:Qp.optional(),recipeRepository:Qp.optional(),recipe:u.record(u.unknown()).optional()}).strict().nullable()}).strict().refine(t=>!(t.runtimePlan&&t.testEnvironment),{message:"a run pins a recipe or a customer's Test Environment, never both",path:["testEnvironment"]}),M9=u.object({schemaVersion:u.literal(1),state:u.nativeEnum(pN),ending:u.nativeEnum(_p).nullable(),cause:u.nativeEnum(Mp).nullable(),deadlineAt:u.string().datetime()}).strict();var _N=50,MN=u.object({repository:Gn,revisions:u.array(u.number().int().nonnegative()).min(1).max(2).refine(t=>t.length<2||t[0]<t[1],"two revisions name the earlier first"),files:u.array(u.string().min(1)).min(1).max(_N)}).strict();function UN(t){return t.reportUploaded?{schemaVersion:1,reason:"report_uploaded",cause:null}:t.recipeUploaded?{schemaVersion:1,reason:"recipe_uploaded",cause:null}:t.revisionsUploaded?{schemaVersion:1,reason:"revisions_uploaded",cause:null}:t.cancelled?{schemaVersion:1,reason:"cancelled",cause:null}:t.mergeConflict&&AN(t)==="merge_conflict"?{schemaVersion:1,reason:"no_report",cause:"merge_conflict",conflict:t.mergeConflict}:{schemaVersion:1,reason:"no_report",cause:AN({...t,mergeConflict:void 0})}}function AN(t){return t.runnerProviderNotReady?"runner_provider_not_ready":t.credentialMissing?"credential_missing":t.mergeConflict?"merge_conflict":t.checkoutFailed?"checkout_failed":t.environmentUnverified?"environment_unverified":t.setupFailed?"setup_failed":t.timedOut?"timed_out":t.modelProviderDenied?"model_provider_denied":t.modelProviderUnavailable?"model_provider_unavailable":"agent_failed"}var PN=".skyramp/sut/deployed-revisions.sh",ZE=(n=>(n.Running="running",n.Requested="requested",n))(ZE||{});var jte=new Set(Object.values(ZE));var Hte=`Fix ${PN} so it prints the full commit each component runs, then set it up again.`;var yl="shared-environment";var rne=64*1024;var sne=new Set(["version_endpoint","api"]);function Op(t){return(t?.components??[]).filter(e=>!!e.repository&&!!e.expectedRevision)}var XE=(t,e)=>!!t&&!!e&&t.toLowerCase()===e.toLowerCase(),L9=(t,e)=>t.name===e.name&&XE(t.repository,e.repository);function LN(t){return Op(t).length>0||(t?.dependencies.length??0)>0}function ON(t){let e=t.inputs?.sharedEnvironment;if(!LN(e))return;let n=Ze(t,`${yl}.json`);if(n)return{components:VN(e,n.components),dependencies:n.dependencies};let r="Not checked: the run ended before it checked the shared environment.";return{components:Op(e).map(s=>$N(s,r)),dependencies:e.dependencies.map(s=>({name:s.name,url:s.url,version:null,evidence:r}))}}var $N=(t,e)=>({name:t.name,repository:t.repository,url:t.url,expectedRevision:t.expectedRevision,observedRevision:null,status:"unverifiable",source:t.revisionUrl||t.revisionScript?"probe":"agent",evidence:e});function VN(t,e){let n=new Set(e.map(s=>s.name.toLowerCase())),r=Op(t).filter(s=>s.touched&&!n.has(s.name.toLowerCase()));return[...e,...r.map(s=>$N(s,"Not checked: the run recorded no read of it."))]}function eC(t){return(ON(t)?.components??[]).filter(e=>e.status!=="verified")}function tC(t,e,n){if(!t.appRunning||n===!1)return[];let r=(t.sharedEnvironment?.components??[]).filter(s=>s.touched);return VN(t.sharedEnvironment,e?.components??[]).filter(s=>s.status!=="verified"&&r.some(i=>L9(i,s)))}function GN(t){let e=n=>{let r=`${n.name} (${n.repository}) must run ${ec(n.expectedRevision)}`;if(n.observedRevision&&n.expectedRevision&&(n.observedRevision.startsWith(n.expectedRevision)||n.expectedRevision.startsWith(n.observedRevision)))return`${r}: ${n.evidence}`;let s=n.observedRevision?`runs ${ec(n.observedRevision)}`:"no revision could be read";return`${r}, but ${s}: ${n.evidence}`};return t.length?`the Test Environment does not verifiably run the change: ${t.map(e).join("; ")}`:void 0}function nC(t){return(t?.components??[]).filter(e=>!!e.repository&&!e.expectedRevision)}function rC(t){return sC(t)&&eC(t).length===0&&nC(t.inputs?.sharedEnvironment).length===0}function sC(t){let e=H9(t);if(!e&&t.state.stages.deploy?.status!=="passed")return!1;let n=Ze(t,"deploy.json");return n?qN(n):!e}function qN(t){return t?.outcome==="clean"||t?.outcome==="recipe-drift"}function H9(t){let e=t.state.stages.plan,n=t.state.stages.deploy;return!(t.inputs?.pipeline?t.inputs.pipeline==="two-step":!n)||e?.status!=="passed"?!1:!n||n.updatedAt<=e.updatedAt}var Mo=(o=>(o.Place="place",o.Update="update",o.Regenerate="regenerate",o.Delete="delete",o.Verify="verify",o.None="none",o))(Mo||{}),qn=(r=>(r.Pass="pass",r.Fail="fail",r.Skip="skip",r))(qn||{}),Hn=u.string().trim().min(1),YN=u.object({case:Hn.describe("a covers id \u2014 the recommend case this test realizes"),status:u.nativeEnum(qn)}),JN=u.object({exit:u.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:u.string().optional().describe("what failed, or why a file was not run \u2014 required on any non-zero exit"),tests:u.array(YN).optional().describe("ONE ENTRY PER CASE the file covers; must agree with exit (0 \u2192 no fail; non-zero \u2192 at least one)")}),WN=u.object({from:u.string().optional().describe("staged path \u2014 required for placements"),file:Hn.describe("final path relative to its repository, inside that checkout, with a source-file extension"),repository:Hn.optional().describe("owner/repo the file lives in, when the run has several checkouts; omit for the working checkout"),action:u.nativeEnum(Mo),covers:u.array(u.string()).optional().describe("recommend ids a placed test covers"),repro:u.boolean().optional().describe("this test is MEANT to fail \u2014 it reproduces a reported bug"),finding:u.boolean().optional().describe("a non-repro test that failed on a REAL product bug"),placementBroken:u.boolean().optional().describe('placement/harness problem one repair could not fix \u2014 every reran.tests entry is then "skip"'),keptReason:Hn.optional().describe("why a planned delete/regenerate was declined and the file kept"),isolatedRun:Hn.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:JN,assertionCount:u.number().int().nonnegative().optional().describe("[derived] assertions reachable from the file, counted at write time")}).refine(t=>t.action!=="place"||typeof t.from=="string"&&t.from.trim().length>0,{message:'is a place but has no "from" staged path',path:[]}),zN=(n=>(n.Junit="junit",n.Converter="converter",n))(zN||{}),q9=Hn.optional().describe("the items[].file this test is in \u2014 needed only when two of this suite's files cover the same case id"),Y9=u.object({results:Hn.describe("the JUnit XML file this run wrote, a plain file name inside $SKYRAMP_RESULTS_DIR (e.g. backend.xml)"),source:u.nativeEnum(zN),run:Hn.describe("the command you ran that wrote it, exactly as you ran it (with any converter)"),files:u.array(Hn).min(1).describe("the items[].file paths this run covered"),cases:u.array(u.object({test:Hn.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:Hn.describe("the covers id it realizes"),file:q9})).describe("map each reported test name to the case it covers")}),J9=u.object({suites:u.array(Y9).min(1)}),iC=u.object({schemaVersion:u.literal(1),items:u.array(WN),runnerResults:J9.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:u.array(u.string()).describe("existing tests assessed and deliberately left untouched"),summary:Hn.describe("one paragraph")});var Gp=(s=>(s.RestApi="rest-api",s.Frontend="frontend",s.FullStack="full-stack",s.Other="other",s))(Gp||{}),Uo=(s=>(s.Critical="critical",s.High="high",s.Medium="medium",s.Low="low",s))(Uo||{}),Po=(r=>(r.Suspected="suspected",r.Latent="latent",r.Refuted="refuted",r))(Po||{}),aC=(r=>(r.Skyramp="skyramp",r.External="external",r.Unknown="unknown",r))(aC||{}),cC=(s=>(s.Cascade="cascade",s.Restrict="restrict",s.Orphan="orphan",s.Unknown="unknown",s))(cC||{}),Is=(s=>(s.RequirementReference="requirement-reference",s.Spec="spec",s.PrDescription="pr-description",s.CouldBreak="could-break",s))(Is||{}),qe=u.string().trim().min(1),mc=qe.describe("file:line"),KN=t=>qe.refine(e=>e.length<=400,e=>({message:`is ${e.length} characters, over the 400 cap \u2014 ${t}`})),El=qe.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'),oC=u.object({method:qe,path:qe,service:u.string().optional(),evidence:mc,repository:El}),W9=u.object({id:qe.describe("short-slug, e.g. R9"),statement:qe.max(400,"exceeds 400 characters \u2014 state the requirement, do not paste the spec section").describe("a testable obligation, not a summary"),source:u.nativeEnum(Is).describe("spec outranks pr-description when both state it"),evidence:qe.describe("spec: file:line or a section locator. pr-description: the quoted phrase it comes from.")}),z9=u.object({id:qe.describe("short-slug"),statement:qe.max(400,"exceeds 400 characters \u2014 state the behaviour, do not paste the code").describe("what the change makes true"),surface:qe.describe("METHOD /path, or a component/page name"),evidence:qe.describe("file:line from the diff that introduces it"),repository:El,satisfies:u.array(qe).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)")}),K9=u.object({id:qe.describe("short-slug"),file:qe,line:u.number().optional(),claim:KN("shorten it to the one sentence that states the defect, and move the supporting detail into `evidence`"),severity:u.nativeEnum(Uo),evidence:KN("cite the file:line and the one line that shows it, rather than reproducing the surrounding code").describe("quoted diff/code line"),status:u.nativeEnum(Po),repository:El,conflictsWith:u.array(qe).optional().describe("requirement ids (from `requirements`) this defect contradicts or leaves unimplemented \u2014 a lower-precedence source (the diff, or the PR description) lost")}),Z9=u.object({name:qe,language:u.string().optional(),framework:u.string().optional(),evidence:mc,repository:El}),X9=u.object({dir:qe,framework:u.string().optional(),kind:u.nativeEnum(aC),evidence:mc,repository:El}),eK=u.object({from:qe,to:qe,onDelete:u.nativeEnum(cC),evidence:mc}),tK=u.object({entity:qe,field:qe,values:u.array(u.string()),evidence:mc}),nK=u.object({entities:u.array(u.object({name:qe,evidence:mc})),references:u.array(eK).describe("INBOUND references \u2014 what still points at an entity when it is deleted"),stateFields:u.array(tK)}),uC=u.object({schemaVersion:u.literal(1),repository:u.object({path:qe.describe("absolute repo path"),currentBranch:qe,baseBranch:qe}),project:u.object({type:u.nativeEnum(Gp),primaryLanguage:qe,languages:u.array(u.string()),frameworks:u.array(u.string())}),services:u.array(Z9),infrastructure:u.object({containerized:u.boolean(),hasDockerCompose:u.boolean(),composeFiles:u.array(u.string()),hasCiCd:u.boolean()}),diff:u.object({changedFiles:u.array(u.string()).describe("as git reports them; a file in another checkout may carry that repo's name"),nonApplicationOnly:u.boolean(),summary:qe.describe("\u2264400 chars")}),endpoints:u.object({new:u.array(oC),modified:u.array(oC),removed:u.array(oC)}),existingTests:u.object({locations:u.array(X9)}),entityMap:nK,requirements:u.array(W9).describe("from a spec (attached or linked) and/or the PR description; empty when neither states a testable obligation"),behaviors:u.array(z9),findings:u.array(K9),unexamined:u.array(u.string()).describe("files or areas outside this change you did not open"),summary:qe.describe("one paragraph on what this change does and its test-relevant risk")});var jp=(n=>(n.Skyramp="skyramp",n.Llm="llm",n))(jp||{}),ws=u.string().trim().min(1),rK=u.object({case:ws.describe("recommend id this assertion enforces"),evidence:ws.describe("the exact assertion line from the file that checks that case's observable")}),lC=u.object({kind:u.nativeEnum(pp).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:ws.describe("the dependency, endpoint or data it affects"),mechanism:u.nativeEnum(fp).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:ws.describe("what it sets up"),worker:ws.optional().describe("skyramp_mocker: host:port of the worker the test applies the mock to (default localhost:35142)"),cleanup:ws.optional().describe("seed: a command that removes the data when the test does not, 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")}),sK=u.object({file:ws.describe("staged path under .skyramp/staged/"),source:u.nativeEnum(jp),language:ws,covers:u.array(u.string()).min(1,"must be a non-empty array of recommend ids").describe("recommend ids this test covers"),assertions:u.array(rK).min(1,"must be a non-empty array").describe("one per case covered, citing the real line"),context:u.array(lC).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")}),dC=u.object({schemaVersion:u.literal(1),tests:u.array(sK),deferredUi:u.array(u.string()).describe("recommend ui ids left for the UI stage (generate) \u2014 [] for generate-ui"),summary:ws.describe("one paragraph")});var bs=u.string().trim().min(1),Cl=72,iK=u.object({repository:bs.optional().describe("owner/repo of the checkout this lint ran in, when the run has several; omit for the working checkout"),tool:u.string(),command:u.string().describe("the exact command you ran, scoped to the changed files"),clean:u.boolean(),fixed:u.array(u.string()).optional().describe("files you fixed"),uncovered:u.array(u.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.")}),Lne=u.object({schemaVersion:u.literal(1),lint:u.array(iK).min(1).describe("one entry per checkout this run wrote tests in, each run from that checkout"),fileConventions:u.object({ok:u.boolean(),notes:u.string().optional()}),ciReadiness:u.object({covered:u.boolean().describe("will the repo's CI run these tests?"),notes:u.string().optional()}),dependencies:u.object({added:u.array(u.object({package:u.string(),manifest:u.string(),repository:bs.optional().describe("owner/repo of the manifest's checkout; omit for the working checkout"),reason:bs.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:u.array(u.object({file:bs,repository:bs.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:u.object({message:bs.refine(t=>t.split(`
119
119
  `)[0].length<=Cl,{message:`subject line must be <= ${Cl} chars`})}),pr:u.object({title:bs.max(Cl,`must be <= ${Cl} chars`),body:bs}),ready:u.boolean().describe("a statement of fact: true only if the tests are fit to commit as they stand"),blockers:u.array(u.string()).describe("what blocks the commit \u2014 required non-empty when ready is false"),summary:bs.describe("one paragraph")});var ci=ce(require("fs")),Cc=ce(require("path")),sD=require("child_process");var Yn="{junit}",Hp=(r=>(r.Junit="junit",r.Trx="trx",r.GoTestJson="go-test-json",r))(Hp||{}),AC=(e=>(e.Minitest="minitest",e))(AC||{}),ZN=u.string().trim().min(1),yc=u.object({cwd:ZN.describe('repo-relative directory the command starts in ("." for the root)'),argv:u.array(ZN).min(1).describe(`the command as separate arguments, run without a shell; for a junit or trx report an argument or env value holds ${Yn}, where the report is written (not for Maven or Gradle, whose build writes its own)`),env:u.record(u.string(),u.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:u.object({format:u.nativeEnum(Hp).describe(`junit (JUnit XML to ${Yn}), trx (to ${Yn}), or go-test-json (go test -json on the command's output)`),reporter:u.nativeEnum(AC).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 Ec="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)",Gne=`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 ${Yn} in the reporter's argument or env setting), trx (a TRX file to ${Yn}, which every dotnet test writes with its built-in logger), or go-test-json (go test -json, read from the command's output). A Maven or Gradle command names no ${Yn}: 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 ${Yn} itself. A setting the tests or reporter read goes in "env" (RAILS_ENV=test, or PLAYWRIGHT_JUNIT_OUTPUT_FILE=${Yn} with playwright test --reporter=junit): the run sets it, so never wrap the command in a shell to set one. The run replaces ${Yn} in argv and env with its report path, executes the command, and reads that report.`;var Lo=(s=>(s.ExistingEvidenceSufficient="existing_evidence_sufficient",s.TargetedUnit="targeted_unit",s.RuntimeRequired="runtime_required",s.BlockedPreflight="blocked_preflight",s))(Lo||{}),ai=(i=>(i.ExistingEvidence="existing_evidence",i.Unaffected="unaffected",i.ExistingUnit="existing_unit",i.NewUnit="new_unit",i.Runtime="runtime",i))(ai||{}),pC=(n=>(n.Repository="repository",n.Testbot="testbot",n))(pC||{}),fC=(r=>(r.Identified="identified",r.Passed="passed",r.Failed="failed",r))(fC||{}),un=u.string().trim().min(1),oK=u.string().regex(/^[a-z0-9][a-z0-9-]*$/,"must be a short lowercase slug").describe("short-slug");var aK=u.object({id:oK,source:u.nativeEnum(pC),kind:u.nativeEnum(Ks),outcome:u.nativeEnum(fC),summary:un.max(400).describe("one line: what it shows"),tests:u.array(un).optional().describe("source repository: the existing tests, as repo-relative paths, optionally path::test-name"),repository:un.optional().describe("source repository: owner/repo the tests live in, when the run has several checkouts; omit for the working checkout"),command:un.optional().describe("source testbot: the exact command you ran, as you ran it"),run:yc.optional().describe(`source repository, for tests in ${Ec}: how the run executes only these tests, all of them in one command, with the repository's own runner writing JUnit XML to {junit}. Name each test (path::test-name): a test is credited to a file only by its name or by a report that names the file`)}),cK=u.object({behaviorId:un.describe("an id from analyze's behaviors"),mechanism:u.nativeEnum(ai),evidenceIds:u.array(un).default([]).describe("existing_evidence: the ci-<n> or evidence ids that establish it; existing_unit: the evidence id naming the tests to run"),covers:u.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')}),hC=(r=>(r.Browser="browser",r.RunningApp="running-app",r.Outside="outside",r))(hC||{}),uK=u.object({behaviorId:u.string().trim().optional().describe("an id from analyze's behaviors, when it is about one"),missing:un.max(600).describe("the evidence that is required and cannot be obtained in this run"),needs:u.nativeEnum(hC).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)")}),lK=u.object({file:un.describe("the changed file the failure is in"),repository:un.optional().describe("owner/repo the file is in, when the run has several checkouts; omit for the working checkout"),reason:un.max(300).describe("what prerequisite the change fails"),evidence:un.max(400).describe("the error line, quoted")}),dK=u.object({behaviorId:un.describe("an id from analyze's behaviors"),reason:un.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)")}),Il=u.object({schemaVersion:u.literal(1),decision:u.nativeEnum(Lo),evidence:u.array(aK).describe("evidence this session found or produced; CI results are the ci-<n> items and are not restated here"),plan:u.array(cK).describe("how each changed behavior's evidence is obtained"),gaps:u.array(uK),outOfScope:u.array(dK).optional().describe("behaviors analyze found that this change neither changes nor states"),blocked:lK.optional().describe("only for blocked_preflight"),rationale:un.max(1200).describe("\u22641200 characters: why this evidence is enough, or what it still lacks \u2014 the scope you chose and why")});function qp(t){let e=Ze(t,"recommend.json");if(!e||!Array.isArray(e.generate)||!Array.isArray(e.maintenance))return;let n=e;return{...n,maintenance:n.maintenance.map(({repository:r,...s})=>({...s,test:s.test.trim().replace(/^\.\//,""),...r?.trim()?{repository:r.trim()}:{}}))}}var Oo=ce(require("fs"));function XN(t){let e=[];for(let n of hK(t)){let r=n;r?.type==="tool_use"&&typeof r.name=="string"&&e.push(r.name)}return e}function eD(t){return XN(t).some(e=>/^mcp__skyramp__skyramp_(contract|integration)_test_generation$/.test(e))}function tD(t){return XN(t).some(e=>e==="mcp__skyramp__skyramp_ui_test_generation")}function fK(t){if(!Oo.existsSync(t))return{};for(let e of Oo.readFileSync(t,"utf-8").split(`