@sreetej510/pi-shipd-checks 0.1.15 → 0.1.17
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/README.md +8 -7
- package/dist/index.js +15 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,15 +52,16 @@ The two finder flags are additive/combinable; `--config` must be used alone.
|
|
|
52
52
|
|
|
53
53
|
## Configuration
|
|
54
54
|
|
|
55
|
-
`/checks --config`
|
|
55
|
+
`/checks --config` opens the row-based settings menu with two sections:
|
|
56
56
|
|
|
57
|
-
- **Reviewer
|
|
58
|
-
|
|
59
|
-
- **Solver
|
|
60
|
-
|
|
57
|
+
- **Reviewer**: model and thinking level used by the behavioral gap finders, validator, and
|
|
58
|
+
solver-solution comparison agent.
|
|
59
|
+
- **Solver**: model and thinking level for TDD solver agents, plus their timeout, parallel solver
|
|
60
|
+
count, and artifact-saving setting.
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
Use ↑/↓ to select a row and Enter/Space to change it. The currently selected model is shown first
|
|
63
|
+
in its picker. Settings are saved to `~/.pi/agent/checks-config.json`; solver settings are nested
|
|
64
|
+
under `solverGap`.
|
|
64
65
|
|
|
65
66
|
## Install
|
|
66
67
|
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Sf=Object.defineProperty;var Et=(e,t)=>{for(var r in t)Sf(e,r,{get:t[r],enumerable:!0})};import{Container as xv,Key as Iv,Spacer as bv,Text as Xo}from"@earendil-works/pi-tui";import{randomUUID as lf}from"node:crypto";import{copyFileSync as pv,existsSync as df,mkdirSync as ff,rmSync as uv,writeFileSync as cv}from"node:fs";import{tmpdir as gf}from"node:os";import{join as Ze}from"node:path";import{getSettingsListTheme as lv}from"@earendil-works/pi-coding-agent";import{Container as dv,Key as Kt,matchesKey as _t,Spacer as fv,Text as hf}from"@earendil-works/pi-tui";import{createAgentSession as va,SessionManager as $a}from"@earendil-works/pi-coding-agent";import{copyFileSync as Lf,existsSync as ja,lstatSync as qf,mkdirSync as Fa,readFileSync as ln,rmSync as di,symlinkSync as jf,unlinkSync as Ff,writeFileSync as rt}from"node:fs";import{join as ce}from"node:path";import{existsSync as sn,mkdirSync as Of,readFileSync as Ca,writeFileSync as Pf}from"node:fs";import{dirname as Cf,join as ai}from"node:path";import{getAgentDir as oi}from"@earendil-works/pi-coding-agent";var an=ai(oi(),"checks-config.json"),on=ai(oi(),"settings.json"),ii=10,si=60,Ma=20,Aa=1,mi=5,La=3,qa=!0,Mf=["off","minimal","low","medium","high","xhigh","max"];function pi(e){return e?.reasoning?Mf.filter(t=>{let r=e.thinkingLevelMap?.[t];return r===null?!1:t==="xhigh"||t==="max"?r!==void 0:!0}):["off"]}function ut(){try{if(!sn(an))return null;let e=JSON.parse(Ca(an,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function ct(e){let t=Cf(an);sn(t)||Of(t,{recursive:!0}),Pf(an,JSON.stringify(e,null,2),"utf-8")}function ui(){let e=ut()?.solverGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e,timeoutMinutes:e.timeoutMinutes>0?e.timeoutMinutes:Ma,solverCount:e.solverCount>0?e.solverCount:La,saveArtifacts:typeof e.saveArtifacts=="boolean"?e.saveArtifacts:qa}}function ci(){try{return sn(on)?JSON.parse(Ca(on,"utf-8")).enabledModels??[]:[]}catch{return[]}}function li(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function Af(){try{if(sn(on))return JSON.parse(Ca(on,"utf-8"))}catch{}return{}}function mn(){let e=Af().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function pn(e){return e.replace(/\\/g,"/")}function un(e){return`'${e.replace(/'/g,"'\\''")}'`}async function cn(e,t,r){if((await e.exec("git",["rev-parse","HEAD"],{cwd:t,timeout:15e3})).code!==0)return{status:"error",error:"Not a git repository, or it has no commits yet."};let a=`git archive HEAD | tar -x -C ${un(pn(r))}`,i=await e.exec(mn(),["-c",a],{cwd:t,timeout:6e4});return i.code!==0?{status:"error",error:i.stderr?.trim()||`git archive failed (exit ${i.code})`}:{status:"ok"}}var Da=3e4,Df=4e3,Nf=".pi/shipd-checks",xr="solver_gap_solutions";function Gf(e){let t=new Set,r=/^diff --git "?a\/(.+?)"? "?b\/(.+?)"?$/gm;for(let n of e.matchAll(r))n[1]&&t.add(n[1]),n[2]&&t.add(n[2]);return[...t]}function Uf(e,t){return e.length>t?e.slice(e.length-t):e}async function fi(e){let{pi:t,repoDir:r,solverDir:n,testPatchPath:a,agentPromptPath:i}=e,m=await cn(t,r,n);if(m.status==="error")return{status:"error",solverDir:n,error:m.error};let c={cwd:n,timeout:Da},l=await t.exec("git",["init"],c);if(l.code!==0)return{status:"error",solverDir:n,error:l.stderr?.trim()||"git init failed"};await t.exec("git",["config","user.email","solvergap@shipd-checks.local"],c),await t.exec("git",["config","user.name","shipd-checks solver-gap-finder"],c);let g=await t.exec("git",["add","-A"],c);if(g.code!==0)return{status:"error",solverDir:n,error:g.stderr?.trim()||"git add (baseline) failed"};let f=await t.exec("git",["commit","-m","baseline","--allow-empty"],c);if(f.code!==0)return{status:"error",solverDir:n,error:f.stderr?.trim()||"git commit (baseline) failed"};let w=ce(n,".gitignore"),F=ja(w)?ln(w,"utf-8"):"";if(!F.split(/\r?\n/).some(mt=>mt.trim()==="node_modules")){let mt=F.length>0&&!F.endsWith(`
|
|
2
2
|
`)?`
|
|
3
|
-
`:"";
|
|
4
|
-
`,"utf-8")}let
|
|
5
|
-
${Ce.stderr}`.trim(),Tf);return{index:r,status:a,passed:je,diff:U,testOutputTail:Xe,durationMs:s,testOutputXmlPath:Q}}function oi(e){let{repoDir:t,runId:r,index:n,trajectory:a,solutionPatch:s,testOutputXmlPath:m,testOutputTail:c}=e,l=ue(t,kf,r,`solver_${n}`);Ca(l,{recursive:!0}),Ze(ue(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),Ze(ue(l,"solution.patch"),s,"utf-8");try{let I=Aa(m,"utf-8");Ze(ue(l,"test_output.xml"),I,"utf-8")}catch{Ze(ue(l,"test_output.txt"),c,"utf-8")}return l}function ii(e,t){let r=ue(e,dr);Ca(r,{recursive:!0});let n=t.map(a=>{let s=ue(r,`solver_${a.index}`);return Ca(s,{recursive:!0}),Ze(ue(s,"solution.diff"),a.diff,"utf-8"),Ze(ue(s,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return Ze(ue(r,"manifest.json"),JSON.stringify(n,null,2),"utf-8"),r}function si(e){let t=ue(e,"node_modules");try{bf(t).isSymbolicLink()&&ri(t,{force:!0})}catch{}try{ri(e,{recursive:!0,force:!0})}catch{}}var p={};kt(p,{Assign:()=>Rf,Clone:()=>yr,Create:()=>Ag,Discard:()=>qg,Metrics:()=>Ae,Update:()=>Lg});var Ae={assign:0,create:0,clone:0,discard:0,update:0};function Rf(e,t){return Ae.assign+=1,{...e,...t}}var i={};kt(i,{Entries:()=>Hf,EntriesRegExp:()=>Wf,Every:()=>zf,EveryAll:()=>Bf,GraphemeCount:()=>Uf,HasPropertyKey:()=>Vf,IsArray:()=>gr,IsBigInt:()=>fr,IsBoolean:()=>hi,IsClassInstance:()=>Nf,IsConstructor:()=>Af,IsDeepEqual:()=>Da,IsEqual:()=>P,IsFunction:()=>yi,IsGreaterEqualThan:()=>Ii,IsGreaterThan:()=>jf,IsInteger:()=>ja,IsLessEqualThan:()=>xi,IsLessThan:()=>Ff,IsMaxLength:()=>Kf,IsMinLength:()=>_f,IsMultipleOf:()=>Df,IsNull:()=>cn,IsNumber:()=>ln,IsObject:()=>hr,IsObjectNotArray:()=>qf,IsString:()=>dn,IsSymbol:()=>Lf,IsUndefined:()=>Fa,IsUnsafePropertyKey:()=>bi,IsValueLike:()=>Gf,Keys:()=>un,ShiftLeft:()=>fn,Symbols:()=>Yf,Values:()=>Jf});function Et(e,t,r){return e>=t&&e<=r}function Sf(e){return e===8205}function Of(e){return Et(e,55296,56319)}function mi(e){return Et(e,127462,127487)}function ui(e){return Et(e,65024,65039)}function ci(e){return Et(e,768,879)||Et(e,6832,6911)||Et(e,7616,7679)||Et(e,65056,65071)}function pn(e){return e>65535?2:1}function pi(e,t){for(;t<e.length;){let r=e.codePointAt(t);if(ci(r)||ui(r))t+=pn(r);else break}return t}function La(e,t){let r=e.codePointAt(t),n=t+pn(r);for(n=pi(e,n);n<e.length-1&&e[n]==="\u200D";){let a=e.codePointAt(n+1);n+=1+pn(a),n=pi(e,n)}return mi(r)&&n<e.length&&mi(e.codePointAt(n))&&(n+=pn(e.codePointAt(n))),n}function li(e){return Of(e)||ci(e)||ui(e)||Sf(e)}function di(e){let t=0,r=0;for(;r<e.length;)r=La(e,r),t++;return t}function Pf(e,t){if(t===0)return!0;let r=0,n=0;for(;n<e.length;)if(n=La(e,n),r++,r>=t)return!0;return!1}function Mf(e,t){let r=0,n=0;for(;n<e.length;)if(n=La(e,n),r++,r>t)return!1;return!0}function fi(e,t){if(t===0)return!0;let r=0;for(;r<e.length;){if(li(e.charCodeAt(r)))return Pf(e,t);if(r++,r>=t)return!0}return!1}function gi(e,t){let r=0;for(;r<e.length;){if(li(e.charCodeAt(r)))return Mf(e,t);if(r++,r>t)return!1}return!0}function gr(e){return Array.isArray(e)}function fr(e){return P(typeof e,"bigint")}function hi(e){return P(typeof e,"boolean")}function Af(e){if(Fa(e)||!yi(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function yi(e){return P(typeof e,"function")}function ja(e){return Number.isInteger(e)}function cn(e){return P(e,null)}function ln(e){return Number.isFinite(e)}function qf(e){return hr(e)&&!gr(e)}function hr(e){return P(typeof e,"object")&&!cn(e)}function dn(e){return P(typeof e,"string")}function Lf(e){return P(typeof e,"symbol")}function Fa(e){return P(e,void 0)}function P(e,t){return e===t}function jf(e,t){return e>t}function Ff(e,t){return e<t}function xi(e,t){return e<=t}function Ii(e,t){return e>=t}function Df(e,t){if(fr(e)||fr(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!ln(e)||ja(e)&&1/t%1===0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<r}function Nf(e){if(!hr(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return cn(t)?!1:P(typeof t.constructor,"function")&&!(P(t.constructor,globalThis.Object)||P(t.constructor.name,"Object"))}function Gf(e){return fr(e)||hi(e)||cn(e)||ln(e)||dn(e)||Fa(e)}function Uf(e){return di(e)}function Kf(e,t){return gi(e,t)}function _f(e,t){return fi(e,t)}function zf(e,t,r){for(let n=t;n<e.length;n++)if(!r(e[n],n))return!1;return!0}function Bf(e,t,r){let n=!0;for(let a=t;a<e.length;a++)r(e[a],a)||(n=!1);return n}function fn(e,t,r){return P(e.length,0)?r():t(e[0],e.slice(1))}function bi(e){return P(e,"__proto__")||P(e,"constructor")||P(e,"prototype")}function Vf(e,t){return bi(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Wf(e){return un(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function Hf(e){return Object.entries(e)}function un(e){return Object.getOwnPropertyNames(e)}function Yf(e){return Object.getOwnPropertySymbols(e)}function Jf(e){return Object.values(e)}function Xf(e,t){if(!hr(t))return!1;let r=un(e);return P(r.length,un(t).length)&&r.every(n=>Da(e[n],t[n]))}function Zf(e,t){return gr(t)&&P(e.length,t.length)&&e.every((r,n)=>Da(e[n],t[n]))}function Da(e,t){return gr(e)?Zf(e,t):hr(e)?Xf(e,t):P(e,t)}var st={};kt(st,{IsBigInt64Array:()=>dg,IsBigUint64Array:()=>fg,IsBoolean:()=>eg,IsDate:()=>hg,IsFloat32Array:()=>cg,IsFloat64Array:()=>lg,IsInt16Array:()=>sg,IsInt32Array:()=>pg,IsInt8Array:()=>ag,IsMap:()=>xg,IsNumber:()=>tg,IsRegExp:()=>gg,IsSet:()=>yg,IsString:()=>rg,IsTypeArray:()=>ng,IsUint16Array:()=>mg,IsUint32Array:()=>ug,IsUint8Array:()=>og,IsUint8ClampedArray:()=>ig});function eg(e){return e instanceof Boolean}function tg(e){return e instanceof Number}function rg(e){return e instanceof String}function ng(e){return globalThis.ArrayBuffer.isView(e)}function ag(e){return e instanceof globalThis.Int8Array}function og(e){return e instanceof globalThis.Uint8Array}function ig(e){return e instanceof globalThis.Uint8ClampedArray}function sg(e){return e instanceof globalThis.Int16Array}function mg(e){return e instanceof globalThis.Uint16Array}function pg(e){return e instanceof globalThis.Int32Array}function ug(e){return e instanceof globalThis.Uint32Array}function cg(e){return e instanceof globalThis.Float32Array}function lg(e){return e instanceof globalThis.Float64Array}function dg(e){return e instanceof globalThis.BigInt64Array}function fg(e){return e instanceof globalThis.BigUint64Array}function gg(e){return e instanceof globalThis.RegExp}function hg(e){return e instanceof globalThis.Date}function yg(e){return e instanceof globalThis.Set}function xg(e){return e instanceof globalThis.Map}function bg(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function vg(e){let t={},r=Object.getOwnPropertyDescriptors(e);for(let n of Object.keys(r)){if(i.IsUnsafePropertyKey(n))continue;let a=r[n];i.HasPropertyKey(a,"value")&&Object.defineProperty(t,n,{...a,value:wt(a.value)})}return t}function $g(e){let t={};for(let r of i.Keys(e))i.IsUnsafePropertyKey(r)||(t[r]=wt(e[r]));for(let r of i.Symbols(e))t[r]=wt(e[r]);return t}function Tg(e){return i.IsClassInstance(e)?e:bg(e)?vg(e):$g(e)}function kg(e){return e.map(t=>wt(t))}function Eg(e){return e.slice()}function wg(e){return new RegExp(e.source,e.flags)}function Rg(e){return new Map(wt([...e.entries()]))}function Sg(e){return new Set(wt([...e.values()]))}function wt(e){return st.IsTypeArray(e)?Eg(e):st.IsRegExp(e)?wg(e):st.IsMap(e)?Rg(e):st.IsSet(e)?Sg(e):i.IsArray(e)?kg(e):i.IsObject(e)?Tg(e):e}function yr(e){return Ae.clone+=1,wt(e)}var Rt={};kt(Rt,{Get:()=>Mg,Reset:()=>Og,Set:()=>Pg});var Qe={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Og(){Qe.immutableTypes=!1,Qe.maxErrors=8,Qe.useAcceleration=!0,Qe.exactOptionalPropertyTypes=!1,Qe.enumerableKind=!1,Qe.correctiveParse=!1,Qe.unionPrioritySort=!0}function Pg(e){for(let t of i.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(Qe,t,{value:r})}}function Mg(){return Qe}function Cg(e,t){for(let r of Object.keys(t))Object.defineProperty(e,r,{configurable:!0,writable:!0,enumerable:!1,value:t[r]});return e}function vi(e,t){return{...e,...t}}function Ag(e,t,r={}){Ae.create+=1;let n=Rt.Get(),a=vi(t,r),s=n.enumerableKind?vi(a,e):Cg(a,e);return n.immutableTypes?Object.freeze(s):s}function qg(e,t){Ae.discard+=1;let r={},n=Object.getOwnPropertyDescriptors(yr(e)),a=new Set(t);for(let s of Object.keys(n))a.has(s)||Object.defineProperty(r,s,n[s]);return r}function Lg(e,t,r){Ae.update+=1;let n=Rt.Get(),a=yr(e);for(let s of Object.keys(t))Object.defineProperty(a,s,{configurable:!0,writable:!0,enumerable:n.enumerableKind,value:t[s]});for(let s of Object.keys(r))Object.defineProperty(a,s,{configurable:!0,enumerable:!0,writable:!0,value:r[s]});return a}function g(e,t){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],t)}function ee(e){return i.IsObject(e)}function y(e,t,r){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:r},{})}function mt(e){return g(e,"Deferred")}function jg(e){return p.Update(e,{"~readonly":!0},{})}function xr(e,t){return p.Update(jg(e),{},t)}function $i(e,t,r,n){let a=d(e,t,r);return xr(a,n)}function Fg(e){return p.Update(e,{"~optional":!0},{})}function Ir(e,t){return p.Update(Fg(e),{},t)}function Ti(e,t,r,n){let a=d(e,t,r);return Ir(a,n)}function Te(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function K(e){return g(e,"Array")}function gn(e){return p.Discard(e,["~kind","type","items"])}function De(e,t,r={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function re(e){return g(e,"Constructor")}function ki(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ne(e,t,r={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function ne(e){return g(e,"Function")}function Ei(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function et(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function ae(e){return g(e,"Ref")}function pt(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Kt(e){return g(e,"Generic")}function _t(e){return p.Create({"~kind":"Any"},{},e)}function Y(e){return g(e,"Any")}var wi="(?!)";function q(e){return p.Create({"~kind":"Never"},{not:{}},e)}function ut(e){return g(e,"Never")}function Ge(e,t={}){return y("AddOptional",[e],t)}function St(e,t={}){return Ir(e,t)}function Ri(e){return St(e)}function ce(e){return ee(e)&&i.HasPropertyKey(e,"~optional")}function Si(e){return i.Keys(e).filter(t=>!ce(e[t]))}function hn(e){return i.Keys(e)}function yn(e){return i.Values(e)}function v(e,t={}){let r=Si(e),n=r.length>0?{required:r}:{};return p.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function M(e){return g(e,"Object")}function Oi(e){return p.Discard(e,["~kind","type","properties","required"])}function oe(e){return p.Create({"~kind":"Unknown"},{},e)}function te(e){return g(e,"Unknown")}function Ue(e,t,r){let n=i.Keys(e).reduce((a,s)=>({...a,[s]:p.Update(e[s],{},{$id:s})}),{});return p.Create({"~kind":"Cyclic"},{$defs:n,$ref:t},r)}function se(e){return g(e,"Cyclic")}function Pi(e){return p.Update(e,{"~unsafe":null},{})}function xn(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var Ke={};kt(Ke,{Match:()=>Dg});function Dg(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function br(...e){let[t,r]=Ke.Match(e,{2:(n,a)=>[n,a,a],1:n=>[n,oe(),oe()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function W(e){return g(e,"Infer")}function Ot(e,t,r,n={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:r},n)}function B(e){return g(e,"Dependent")}function Mi(e){return p.Discard(e,["~kind","if","then","else"])}function Ci(e){return i.IsObjectNotArray(e)}function Ai(e){return i.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function qi(e){return i.IsString(e)||i.IsNumber(e)}function Li(e,t){let r=Ci(e)?Ai(e):e;return p.Create({"~kind":"Enum"},{enum:r},t)}function de(e){return g(e,"Enum")}function le(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function R(e){return g(e,"Intersect")}function ji(e){return p.Discard(e,["~kind","allOf"])}function H(){throw new Error("Unreachable")}var Fi;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(Fi||(Fi={}));var IT=BigInt("14695981039346656037"),[bT,vT]=[BigInt("1099511628211"),BigInt("18446744073709551616")],$T=Array.from({length:256}).map((e,t)=>BigInt(t)),Di=new Float64Array(1),TT=new DataView(Di.buffer),kT=new Uint8Array(Di.buffer);var ET=new TextEncoder;var vr=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=In(r)?m=>this.decode(r["~codec"].decode(m)):this.decode,a=In(r)?m=>r["~codec"].encode(t(m)):t,s={decode:n,encode:a};return p.Update(this.type,{"~codec":s},{})}},$r=class{constructor(t){this.type=t}Decode(t){return new vr(this.type,t)}};function bn(e){return new $r(e)}function Gi(e,t){return bn(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Ui(e,t){return bn(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function In(e){return ee(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function Ki(e){return zt(e)}function Pt(e){return ee(e)&&i.HasPropertyKey(e,"~immutable")}function _e(e,t={}){return y("AddReadonly",[e],t)}function Mt(e,t={}){return xr(e,t)}function _i(e){return Mt(e)}function Ct(e){return ee(e)&&i.HasPropertyKey(e,"~readonly")}function Kg(e,t){let r=Na(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":r},{})}function zi(...e){let[t,r,n]=Ke.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return Kg(t,{check:r,error:n})}function _g(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function Na(e){return ee(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>_g(t))}var Bi="-?(?:0|[1-9][0-9]*)n";function Tr(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function ze(e){return g(e,"BigInt")}function vn(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Re(e){return g(e,"Boolean")}function kr(e){return p.Create({"~kind":"Identifier"},{name:e})}function Vi(e){return g(e,"Identifier")}var $n="-?(?:0|[1-9][0-9]*)";function At(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function fe(e){return g(e,"Integer")}var Ga=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function zg(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new Ga(e)})()}function S(e,t){return p.Create({"~kind":"Literal"},{type:zg(e),const:e},t)}function Tn(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function Wi(e){return C(e)&&i.IsNumber(e.const)}function Hi(e){return C(e)&&i.IsString(e.const)}function C(e){return g(e,"Literal")}function Bt(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Vt(e){return g(e,"Null")}var kn="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function be(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function J(e){return g(e,"Number")}function Wt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function ct(e){return g(e,"Symbol")}function qt(...e){let[t,r,n]=Ke.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,s],1:a=>[a,oe(),oe()]});return p.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function Yi(e){return g(e,"Parameter")}var En=".*";function Se(e){return p.Create({"~kind":"String"},{type:"string"},e)}function ge(e){return g(e,"String")}function k(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function h(e){return g(e,"Union")}function Ji(e){return p.Discard(e,["~kind","anyOf"])}function Er(e){let t=Xi(e);return i.IsEqual(t.length,2)?t[0]:[]}function Bg(e){return!0}function Zi(e){return i.ShiftLeft(e,(t,r)=>Vg(t)?Zi(r):!1,()=>!0)}function Qi(e){return i.IsEqual(e.length,0)?!1:Zi(e)}function Vg(e){return h(e)?Qi(e.anyOf):C(e)?Bg(e.const):!1}function wn(e){return Qi(e)}function Rn(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function es(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>es(a,t,[...r,`${n}${t}`]),()=>r)}function Wg(e,t){return i.IsEqual(e.length,0)?[`${t}`]:es(e,t)}function ts(e,t,r=[]){return i.ShiftLeft(t,(n,a)=>ts(e,a,[...r,...rs(e,n)]),()=>r)}function rs(e,t){return h(t)?ts(e,t.anyOf):C(t)?Wg(e,t.const):H()}function ns(e,t){return i.ShiftLeft(t,(r,n)=>ns(rs(e,r),n),()=>e)}function Hg(e){return e.map(t=>S(t))}function Yg(e){let t=ns([],e),r=Hg(t);return k(r)}function Jg(e){return i.IsEqual(e.length,0)?H():i.IsEqual(e.length,1)&&C(e[0])?e[0]:Yg(e)}function Ua(e){let t=Er(e);return i.IsEqual(t.length,0)?Se():wn(t)?Jg(t):Rn(e)}function as(e){let t=Ua(e);return X(t)?Se():t}function ye(e,t){let r="object",n={[e]:t};return p.Create({"~kind":"Record"},{type:r,patternProperties:n})}function os(e){return ye(qe,e)}function is(e){return v({true:e,false:e})}function Z(e,t={}){let[r,n,a]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:a,items:r,minItems:n},t)}function L(e){return g(e,"Tuple")}function ss(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Xg(e){return p.Discard(e,["~readonly"])}function Ka(e,t){return p.Update(Xg(e),{},t)}function ms(e,t,r,n){let a=d(e,t,r);return Ka(a,n)}function ps(e,t={}){return y("RemoveReadonly",[e],t)}function us(e,t={}){return Ka(e,t)}function Zg(e){return p.Discard(e,["~optional"])}function _a(e,t){return p.Update(Zg(e),{},t)}function cs(e,t,r,n){let a=d(e,t,r);return _a(a,n)}function ls(e,t={}){return y("RemoveOptional",[e],t)}function Sn(e,t={}){return _a(e,t)}function za(e){return e.reduceRight((r,n,a)=>({[a]:n,...r}),{})}function ds(e){let t=za(e.items);return v(t)}function Qg(e,t){return Ct(e)?!!Ct(t):!1}function eh(e,t){return ce(e)?!!ce(t):!1}function th(e,t){let r=Qg(e,t),n=eh(e,t),a=_([e,t]),s=us(Sn(a));return r&&n?Mt(St(s)):r&&!n?Mt(s):!r&&n?St(s):s}function rh(e,t,r){return r in e?r in t?th(e[r],t[r]):e[r]:r in t?t[r]:q()}function nh(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((n,a)=>({...n,[a]:rh(e,t,a)}),{})}function fs(e){return M(e)?e.properties:L(e)?za(e.items):H()}function gs(e,t){let r=fs(e),n=fs(t),a=nh(r,n);return v(a)}function hs(e,t){let r=Ht(e,t);return i.IsEqual(r,Rr)?e:i.IsEqual(r,Sr)||i.IsEqual(r,wr)?t:q()}function ys(e){return M(e)||L(e)}function ah(e,t){let r=h(e),n=h(t);return r||n}function oh(e,t){let r=Oe(e),n=Oe(t),a=ah(r,n),s=ys(r),m=ys(n);return a?_([r,n]):s&&m?gs(r,n):s&&!m?r:!s&&m?n:hs(r,n)}function xs(e,t,r=[]){return i.ShiftLeft(t,(n,a)=>xs(e,a,[...r,oh(e,n)]),()=>i.IsEqual(r.length,0)?[e]:r)}function Is(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>Is(a,t,[...r,...Or([n],t)]),()=>r)}function Or(e,t=[]){return i.ShiftLeft(e,(r,n)=>h(r)?Or(n,Is(r.anyOf,t)):Or(n,xs(r,t)),()=>t)}function ih(e,t){let r=me({},e,t);return b.IsExtendsTrueLike(r)?[]:[e]}function sh(e,t){return e.reduce((r,n)=>[...r,...ih(n,t)],[])}function On(e,t){let r=Oe(e),n=h(r)?r.anyOf:[r],a=sh(n,t);return ve(a)}function Le(e,t,r){let n=le([e,t]),a=On(r,e);return ve([n,a])}function ke(e){let t=e.map(r=>S(r));return ve(t)}function _(e){let t=Or(e),r=Ba(t);return tt(r)}function xe(e){let t=as(e);return Oe(t)}function ve(e){let t=Ba(e);return tt(t)}function Oe(e){return B(e)?Le(e.if,e.then,e.else):de(e)?ke(e.enum):R(e)?_(e.allOf):X(e)?xe(e.pattern):h(e)?ve(e.anyOf):e}function tt(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?q():k(e)}function bs(e,t){let r=ke(e);return lt(r,t)}function vs(e,t){return ye(dt,t)}function $s(e,t){let r=_(e);return lt(r,t)}function Ts(e,t){return i.IsString(e)||i.IsNumber(e)?v({[e]:t}):i.IsEqual(e,!1)?v({false:t}):i.IsEqual(e,!0)?v({true:t}):v({})}function ks(e,t){return ye(Yt,t)}function Es(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?ye(e.pattern.toString(),t):ye(qe,t)}function ws(e,t){let r=Er(e);return wn(r)?lt(xe(e),t):ye(e,t)}function mh(e){return h(e)?Pr(e.anyOf):[e]}function Pr(e){return e.reduce((t,r)=>[...t,...mh(r)],[])}function ph(e){return e.some(t=>ge(t)||J(t)||fe(t))}function uh(e,t){return i.IsEqual(ph(e),!0)?ye(qe,t):void 0}function ch(e,t){return e.reduce((r,n)=>C(n)&&(i.IsString(n.const)||i.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function lh(e,t){let r=ch(e,t);return v(r)}function Rs(e,t){let r=Pr(e),n=uh(r,t);return ee(n)?n:lh(r,t)}function lt(e,t){return Y(e)?os(t):Re(e)?is(t):de(e)?bs(e.enum,t):fe(e)?vs(e,t):R(e)?$s(e.allOf,t):C(e)?Ts(e.const,t):J(e)?ks(e,t):h(e)?Rs(e.anyOf,t):ge(e)?Es(e,t):X(e)?ws(e.pattern,t):v({})}function Va(e,t,r){return T([e])?p.Update(lt(e,t),{},r):Pn(e,t,r)}function Ss(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Va(s,m,a)}var dt=`^${$n}$`,Yt=`^${kn}$`,qe=`^${En}$`;function Pn(e,t,r={}){return y("Record",[e,t],r)}function Mn(e,t,r={}){return Va(e,t,r)}function Os(e,t){return ye(e,t)}function Cn(e){return i.IsEqual(e,qe)?Se():i.IsEqual(e,dt)?At():i.IsEqual(e,Yt)?be():Ua(e)}function Pe(e){return i.Keys(e.patternProperties)[0]}function Jt(e){let t=Pe(e);return Cn(t)}function he(e){return e.patternProperties[Pe(e)]}function pe(e){return g(e,"Record")}function Lt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function ft(e){return g(e,"Rest")}function An(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function qn(e){return g(e,"This")}function Xt(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function Zt(e){return g(e,"Undefined")}function Ln(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Be(e){return g(e,"Void")}function fh(e,t){return i.IsEqual(e,"Array")?Te(t[0]):i.IsEqual(e,"Capitalize")?Fn(t[0]):i.IsEqual(e,"ConstructorParameters")?Kn(t[0]):i.IsEqual(e,"Evaluate")?Mp(t[0]):i.IsEqual(e,"Exclude")?_n(t[0],t[1]):i.IsEqual(e,"Extract")?zn(t[0],t[1]):i.IsEqual(e,"Index")?qr(t[0],t[1]):i.IsEqual(e,"InstanceType")?Bn(t[0]):i.IsEqual(e,"Lowercase")?Dn(t[0]):i.IsEqual(e,"NonNullable")?Vn(t[0]):i.IsEqual(e,"Omit")?Wn(t[0],t[1]):i.IsEqual(e,"Parameters")?Hn(t[0]):i.IsEqual(e,"Partial")?Yn(t[0]):i.IsEqual(e,"Pick")?Jn(t[0],t[1]):i.IsEqual(e,"Readonly")?Xn(t[0]):i.IsEqual(e,"KeyOf")?Lr(t[0]):i.IsEqual(e,"Record")?Pn(t[0],t[1]):i.IsEqual(e,"Required")?Zn(t[0]):i.IsEqual(e,"ReturnType")?Qn(t[0]):i.IsEqual(e,"Uncapitalize")?Nn(t[0]):i.IsEqual(e,"Uppercase")?Gn(t[0]):Ar(et(e),t)}function jt(){throw Error("Unreachable")}var gh=(e,t=[])=>e.reduce((r,n)=>i.IsArray(n)&&i.IsEqual(n.length,2)?[...r,n[0]]:[...r,n],[]),rt=e=>{let[t,r]=e;return gh([...t,...r])};function qs(e){return qt(e[0],e[2],e[4])}function Ls(e){return qt(e[0],e[2],e[2])}function js(e){return qt(e[0],oe(),e[2])}function Fs(e){return qt(e,oe(),oe())}function Ds(e){return rt(e)}function Ns(e){return e[1]}function Gs(e){return rt(e)}function Us(e){return e[1]}function Ks(e){return fh(e[0],e[1])}function _s(e){return null}function zs(e){return Se()}function Bs(e){return be()}function Vs(e){return vn()}function Ws(e){return Xt()}function Hs(e){return Bt()}function Ys(e){return At()}function Js(e){return Tr()}function Xs(e){return oe()}function Zs(e){return _t()}function Qs(e){return v({})}function em(e){return q()}function tm(e){return Wt()}function rm(e){return Ln()}function nm(e){return An()}function am(e){return S(BigInt(e))}function om(e){return S(i.IsEqual(e,"true"))}function im(e){return S(parseFloat(e))}function sm(e){return S(e)}function mm(e){return e[1]}function pm(e){return S(e)}function um(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function cm(e){return e[1]}function lm(e){return jn(e)}function dm(e){return i.IsEqual(e.length,6)?Ot(e[1],e[3],e[5]):Ot(e[1],e[3],oe())}function fm(e){return e.length>0}function gm(e){return e.reduce((t,r)=>i.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function hm(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function ym(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function xm(e){return i.IsEqual(e.length,2)?e[1]:[]}function Ps(e,t){return t.reduce((r,n)=>{let a=n;return i.IsEqual(a.length,1)?qr(r,a[0]):i.IsEqual(a.length,0)?Te(r):jt()},e)}function Ms(e,t){return i.IsEqual(t.length,3)?Un(e,t[0],t[1],t[2]):e}function hh(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:ea(e,t)}function Im(e){let[t,r,n,a,s]=e;return hh(Ms(t?Lr(Ps(r,n)):Ps(r,n),a),s)}function Wa(e,t){return i.IsEqual(t.length,3)?(()=>{let[r,n,a]=t,s=Wa(n,a);if(i.IsEqual(r,"&"))return R(s)?le([e,...s.allOf]):le([e,s]);if(i.IsEqual(r,"|"))return h(s)?k([e,...s.anyOf]):k([e,s]);jt()})():e}function bm(e){let[t,r]=e;return Wa(t,r)}function vm(e){let[t,r]=e;return Wa(t,r)}function $m(e){return Pp(e[1])}function Tm(e){return e[1]}function km(e){return pt(e[0],e[2])}function Em(e){return i.IsEqual(e.length,4)?br(e[1],e[3]):i.IsEqual(e.length,2)?br(e[1],oe()):jt()}function wm(e){return`${e}`}function Rm(e){return fe(e[3])?dt:J(e[3])?Yt:ct(e[3])?qe:ge(e[3])?qe:jt()}function Sm(e){return e.length>0}function Om(e){return e.length>0}function Pm(e){let[t,r,n,a,s]=e;return{[r]:t&&n?_e(Ge(s)):t&&!n?_e(s):!t&&n?Ge(s):s}}function Mm(e){return rt(e)}function Cm(e){return e.reduce((t,r)=>i.HasPropertyKey(r,dt)||i.HasPropertyKey(r,Yt)||i.HasPropertyKey(r,qe)?[t[0],p.Assign(t[1],r)]:[p.Assign(t[0],r),t[1]],[{},{}])}function Am(e){return Cm(e[1])}function qm(e){let[t,r]=e,n=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return v(t,n)}function Lm(e){return i.IsEqual(e.length,5)?_e(Ge(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?_e(e[3]):Ge(e[3]):jt()}function jm(e){return _e(Ge(e[1]))}function Fm(e){return _e(e[1])}function Dm(e){return Ge(e[0])}function Nm(e){return i.IsEqual(e.length,2)?Lt(e[1]):i.IsEqual(e.length,1)?e[0]:jt()}function Gm(e){return rt(e)}function Um(e){return Z(e[1])}function Km(e){return _e(Ge(e[4]))}function _m(e){return _e(e[3])}function zm(e){return Ge(e[3])}function Bm(e){return e[2]}function Vm(e){return i.IsEqual(e.length,2)?Lt(e[1]):i.IsEqual(e.length,1)?e[0]:jt()}function Wm(e){return rt(e)}function Hm(e){return Ne(e[1],e[4])}function Ym(e){return De(e[2],e[5])}function Cs(e,t){return i.IsEqual(e,"remove")?ps(t):i.IsEqual(e,"add")?_e(t):t}function Jm(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function As(e,t){return i.IsEqual(e,"remove")?ls(t):i.IsEqual(e,"add")?Ge(t):t}function Xm(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function Zm(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function Qm(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?Mr(kr(e[3]),e[5],e[6][0],Cs(e[1],As(e[8],e[10]))):Mr(kr(e[3]),e[5],et(e[3]),Cs(e[1],As(e[8],e[10])))}function ep(e){return et(e)}function tp(e){return BigInt(e)}function rp(e){return parseFloat(e)}function np(e){return i.IsEqual(e,"true")}function ap(e){return null}function op(e){return{[e[0]]:e[2]}}function ip(e){return rt(e)}function yh(e){return e.reduce((t,r)=>p.Assign(t,r),{})}function sp(e){return yh(e[1])}function mp(e){return rt(e)}function pp(e){return e[1]}function up(e){return Tr()}function cp(e){return Se()}function lp(e){return be()}function dp(e){return At()}function fp(e){return q()}function gp(e){return S(e)}function hp(e){return k(e[1])}function yp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function xp(e){return[e[0],...e[1]]}function Ip(e){return e[1]}function bp(e){return rt(e)}function vp(e){return i.IsEqual(e.length,2)?e[1]:[]}function $p(e){let t=e[2],r=e[3],[n,a]=e[4],s=i.IsEqual(i.Keys(a).length,0)?{}:{patternProperties:a};return{[e[1]]:pt(t,Cr(r,n,s))}}function Tp(e){let t=e[2],[r,n]=e[3],a=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:Cr(t,r,a)}}function kp(e){return{[e[1]]:pt(e[2],e[4])}}function Ep(e){return{[e[1]]:e[3]}}function wp(e){return null}function Rp(e){return Cm(rt(e))}function Sp(e){return e[1]}function Op(e){let t=e[0],r=e[1];return Cp(p.Assign(t,r[0]))}function jr(e){return P(e.length,2)}function E(e,t,r){return jr(e)?t(e[0],e[1]):r()}function bh(e,t){return P(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function z(e,t){for(let r=0;r<e.length;r++){let n=bh(e[r],t);if(jr(n))return n}return[]}function Ha(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var Ap=[...Ha(97,122),...Ha(65,90)],Ya="0",Ja=Ha(49,57),Qt=[Ya,...Ja],qp=" ",er=`
|
|
6
|
-
`;var
|
|
3
|
+
`:"";rt(w,`${F}${mt}node_modules
|
|
4
|
+
`,"utf-8")}let _=ce(r,"node_modules"),ue=ce(n,"node_modules");if(ja(_)&&!ja(ue))try{jf(_,ue,process.platform==="win32"?"junction":"dir")}catch{}try{Lf(i,ce(n,"agent_prompt.md"))}catch{}let Me=ln(a,"utf-8"),Ae=Gf(Me),De=ce(n,"test.patch");rt(De,Me,"utf-8");let Qe=await t.exec("git",["apply","test.patch"],c);try{Ff(De)}catch{}if(Qe.code!==0)return{status:"patchFailed",solverDir:n,error:Qe.stderr?.trim()||"git apply test.patch failed"};let D=await t.exec("git",["add","-A"],c);if(D.code!==0)return{status:"error",solverDir:n,error:D.stderr?.trim()||"git add (tests applied) failed"};let et=await t.exec("git",["commit","-m","tests applied","--allow-empty"],c);if(et.code!==0)return{status:"error",solverDir:n,error:et.stderr?.trim()||"git commit (tests applied) failed"};let Ne=await t.exec("git",["rev-parse","HEAD"],c);return Ne.code!==0||!Ne.stdout.trim()?{status:"error",solverDir:n,error:"Could not resolve tests-applied commit hash."}:{status:"ok",solverDir:n,testsAppliedCommit:Ne.stdout.trim(),testPatchPaths:Ae}}function Kf(e){try{let t=ln(e,"utf-8").match(/<testsuites\b[^>]*>/i)?.[0];if(!t)return{totalTests:null,failedTests:null};let r=m=>Number.parseInt(t.match(new RegExp(`\\b${m}="(\\d+)"`,"i"))?.[1]??"",10),n=r("tests"),a=r("failures"),i=r("errors");return{totalTests:Number.isFinite(n)?n:null,failedTests:Number.isFinite(a)?a+(Number.isFinite(i)?i:0):null}}catch{return{totalTests:null,failedTests:null}}}async function gi(e){let{pi:t,index:r,workspace:n,status:a,durationMs:i}=e,{solverDir:m,testsAppliedCommit:c,testPatchPaths:l}=n,g={cwd:m,timeout:Da};await t.exec("git",["add","-A"],g);let f=[...l,"agent_prompt.md"].map(Ne=>`:(exclude)${Ne}`),w=await t.exec("git",["diff","--cached",c,"--",".",...f],g),F=w.code===0?w.stdout:"",_=ce(m,"test_output.xml"),ue=`bash test.sh --output_path ${un(pn(_))} new`,Me=mn(),Ae=await t.exec(Me,["-c",`cd ${un(pn(m))} && ${ue}`],{timeout:Da*10}),De=Ae.code===0,Qe=Uf(`${Ae.stdout}
|
|
5
|
+
${Ae.stderr}`.trim(),Df),{totalTests:D,failedTests:et}=Kf(_);return{index:r,status:a,passed:De,diff:F,testOutputTail:Qe,durationMs:i,totalTests:D,failedTests:et,testOutputXmlPath:_}}function hi(e){let{repoDir:t,runId:r,index:n,trajectory:a,solutionPatch:i,testOutputXmlPath:m,testOutputTail:c}=e,l=ce(t,Nf,r,`solver_${n}`);Fa(l,{recursive:!0}),rt(ce(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),rt(ce(l,"solution.patch"),i,"utf-8");try{let g=ln(m,"utf-8");rt(ce(l,"test_output.xml"),g,"utf-8")}catch{rt(ce(l,"test_output.txt"),c,"utf-8")}return l}function yi(e,t){let r=ce(e,xr);Fa(r,{recursive:!0});let n=t.map(a=>{let i=ce(r,`solver_${a.index}`);return Fa(i,{recursive:!0}),rt(ce(i,"solution.diff"),a.diff,"utf-8"),rt(ce(i,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return rt(ce(r,"manifest.json"),JSON.stringify(n,null,2),"utf-8"),r}function xi(e){let t=ce(e,"node_modules");try{qf(t).isSymbolicLink()&&di(t,{force:!0})}catch{}try{di(e,{recursive:!0,force:!0})}catch{}}var p={};Et(p,{Assign:()=>_f,Clone:()=>$r,Create:()=>Yg,Discard:()=>Jg,Metrics:()=>qe,Update:()=>Xg});var qe={assign:0,create:0,clone:0,discard:0,update:0};function _f(e,t){return qe.assign+=1,{...e,...t}}var s={};Et(s,{Entries:()=>ug,EntriesRegExp:()=>pg,Every:()=>ig,EveryAll:()=>sg,GraphemeCount:()=>ng,HasPropertyKey:()=>mg,IsArray:()=>br,IsBigInt:()=>Ir,IsBoolean:()=>Ri,IsClassInstance:()=>tg,IsConstructor:()=>Yf,IsDeepEqual:()=>Ka,IsEqual:()=>C,IsFunction:()=>Si,IsGreaterEqualThan:()=>Pi,IsGreaterThan:()=>Zf,IsInteger:()=>Ga,IsLessEqualThan:()=>Oi,IsLessThan:()=>Qf,IsMaxLength:()=>ag,IsMinLength:()=>og,IsMultipleOf:()=>eg,IsNull:()=>gn,IsNumber:()=>hn,IsObject:()=>vr,IsObjectNotArray:()=>Jf,IsString:()=>yn,IsSymbol:()=>Xf,IsUndefined:()=>Ua,IsUnsafePropertyKey:()=>Ci,IsValueLike:()=>rg,Keys:()=>fn,ShiftLeft:()=>xn,Symbols:()=>cg,Values:()=>lg});function Rt(e,t,r){return e>=t&&e<=r}function zf(e){return e===8205}function Bf(e){return Rt(e,55296,56319)}function Ii(e){return Rt(e,127462,127487)}function vi(e){return Rt(e,65024,65039)}function $i(e){return Rt(e,768,879)||Rt(e,6832,6911)||Rt(e,7616,7679)||Rt(e,65056,65071)}function dn(e){return e>65535?2:1}function bi(e,t){for(;t<e.length;){let r=e.codePointAt(t);if($i(r)||vi(r))t+=dn(r);else break}return t}function Na(e,t){let r=e.codePointAt(t),n=t+dn(r);for(n=bi(e,n);n<e.length-1&&e[n]==="\u200D";){let a=e.codePointAt(n+1);n+=1+dn(a),n=bi(e,n)}return Ii(r)&&n<e.length&&Ii(e.codePointAt(n))&&(n+=dn(e.codePointAt(n))),n}function Ti(e){return Bf(e)||$i(e)||vi(e)||zf(e)}function ki(e){let t=0,r=0;for(;r<e.length;)r=Na(e,r),t++;return t}function Vf(e,t){if(t===0)return!0;let r=0,n=0;for(;n<e.length;)if(n=Na(e,n),r++,r>=t)return!0;return!1}function Wf(e,t){let r=0,n=0;for(;n<e.length;)if(n=Na(e,n),r++,r>t)return!1;return!0}function wi(e,t){if(t===0)return!0;let r=0;for(;r<e.length;){if(Ti(e.charCodeAt(r)))return Vf(e,t);if(r++,r>=t)return!0}return!1}function Ei(e,t){let r=0;for(;r<e.length;){if(Ti(e.charCodeAt(r)))return Wf(e,t);if(r++,r>t)return!1}return!0}function br(e){return Array.isArray(e)}function Ir(e){return C(typeof e,"bigint")}function Ri(e){return C(typeof e,"boolean")}function Yf(e){if(Ua(e)||!Si(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Si(e){return C(typeof e,"function")}function Ga(e){return Number.isInteger(e)}function gn(e){return C(e,null)}function hn(e){return Number.isFinite(e)}function Jf(e){return vr(e)&&!br(e)}function vr(e){return C(typeof e,"object")&&!gn(e)}function yn(e){return C(typeof e,"string")}function Xf(e){return C(typeof e,"symbol")}function Ua(e){return C(e,void 0)}function C(e,t){return e===t}function Zf(e,t){return e>t}function Qf(e,t){return e<t}function Oi(e,t){return e<=t}function Pi(e,t){return e>=t}function eg(e,t){if(Ir(e)||Ir(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!hn(e)||Ga(e)&&1/t%1===0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<r}function tg(e){if(!vr(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return gn(t)?!1:C(typeof t.constructor,"function")&&!(C(t.constructor,globalThis.Object)||C(t.constructor.name,"Object"))}function rg(e){return Ir(e)||Ri(e)||gn(e)||hn(e)||yn(e)||Ua(e)}function ng(e){return ki(e)}function ag(e,t){return Ei(e,t)}function og(e,t){return wi(e,t)}function ig(e,t,r){for(let n=t;n<e.length;n++)if(!r(e[n],n))return!1;return!0}function sg(e,t,r){let n=!0;for(let a=t;a<e.length;a++)r(e[a],a)||(n=!1);return n}function xn(e,t,r){return C(e.length,0)?r():t(e[0],e.slice(1))}function Ci(e){return C(e,"__proto__")||C(e,"constructor")||C(e,"prototype")}function mg(e,t){return Ci(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function pg(e){return fn(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function ug(e){return Object.entries(e)}function fn(e){return Object.getOwnPropertyNames(e)}function cg(e){return Object.getOwnPropertySymbols(e)}function lg(e){return Object.values(e)}function dg(e,t){if(!vr(t))return!1;let r=fn(e);return C(r.length,fn(t).length)&&r.every(n=>Ka(e[n],t[n]))}function fg(e,t){return br(t)&&C(e.length,t.length)&&e.every((r,n)=>Ka(e[n],t[n]))}function Ka(e,t){return br(e)?fg(e,t):vr(e)?dg(e,t):C(e,t)}var lt={};Et(lt,{IsBigInt64Array:()=>Og,IsBigUint64Array:()=>Pg,IsBoolean:()=>hg,IsDate:()=>Mg,IsFloat32Array:()=>Rg,IsFloat64Array:()=>Sg,IsInt16Array:()=>Tg,IsInt32Array:()=>wg,IsInt8Array:()=>bg,IsMap:()=>Lg,IsNumber:()=>yg,IsRegExp:()=>Cg,IsSet:()=>Ag,IsString:()=>xg,IsTypeArray:()=>Ig,IsUint16Array:()=>kg,IsUint32Array:()=>Eg,IsUint8Array:()=>vg,IsUint8ClampedArray:()=>$g});function hg(e){return e instanceof Boolean}function yg(e){return e instanceof Number}function xg(e){return e instanceof String}function Ig(e){return globalThis.ArrayBuffer.isView(e)}function bg(e){return e instanceof globalThis.Int8Array}function vg(e){return e instanceof globalThis.Uint8Array}function $g(e){return e instanceof globalThis.Uint8ClampedArray}function Tg(e){return e instanceof globalThis.Int16Array}function kg(e){return e instanceof globalThis.Uint16Array}function wg(e){return e instanceof globalThis.Int32Array}function Eg(e){return e instanceof globalThis.Uint32Array}function Rg(e){return e instanceof globalThis.Float32Array}function Sg(e){return e instanceof globalThis.Float64Array}function Og(e){return e instanceof globalThis.BigInt64Array}function Pg(e){return e instanceof globalThis.BigUint64Array}function Cg(e){return e instanceof globalThis.RegExp}function Mg(e){return e instanceof globalThis.Date}function Ag(e){return e instanceof globalThis.Set}function Lg(e){return e instanceof globalThis.Map}function jg(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function Fg(e){let t={},r=Object.getOwnPropertyDescriptors(e);for(let n of Object.keys(r)){if(s.IsUnsafePropertyKey(n))continue;let a=r[n];s.HasPropertyKey(a,"value")&&Object.defineProperty(t,n,{...a,value:St(a.value)})}return t}function Dg(e){let t={};for(let r of s.Keys(e))s.IsUnsafePropertyKey(r)||(t[r]=St(e[r]));for(let r of s.Symbols(e))t[r]=St(e[r]);return t}function Ng(e){return s.IsClassInstance(e)?e:jg(e)?Fg(e):Dg(e)}function Gg(e){return e.map(t=>St(t))}function Ug(e){return e.slice()}function Kg(e){return new RegExp(e.source,e.flags)}function _g(e){return new Map(St([...e.entries()]))}function zg(e){return new Set(St([...e.values()]))}function St(e){return lt.IsTypeArray(e)?Ug(e):lt.IsRegExp(e)?Kg(e):lt.IsMap(e)?_g(e):lt.IsSet(e)?zg(e):s.IsArray(e)?Gg(e):s.IsObject(e)?Ng(e):e}function $r(e){return qe.clone+=1,St(e)}var Ot={};Et(Ot,{Get:()=>Wg,Reset:()=>Bg,Set:()=>Vg});var nt={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Bg(){nt.immutableTypes=!1,nt.maxErrors=8,nt.useAcceleration=!0,nt.exactOptionalPropertyTypes=!1,nt.enumerableKind=!1,nt.correctiveParse=!1,nt.unionPrioritySort=!0}function Vg(e){for(let t of s.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(nt,t,{value:r})}}function Wg(){return nt}function Hg(e,t){for(let r of Object.keys(t))Object.defineProperty(e,r,{configurable:!0,writable:!0,enumerable:!1,value:t[r]});return e}function Mi(e,t){return{...e,...t}}function Yg(e,t,r={}){qe.create+=1;let n=Ot.Get(),a=Mi(t,r),i=n.enumerableKind?Mi(a,e):Hg(a,e);return n.immutableTypes?Object.freeze(i):i}function Jg(e,t){qe.discard+=1;let r={},n=Object.getOwnPropertyDescriptors($r(e)),a=new Set(t);for(let i of Object.keys(n))a.has(i)||Object.defineProperty(r,i,n[i]);return r}function Xg(e,t,r){qe.update+=1;let n=Ot.Get(),a=$r(e);for(let i of Object.keys(t))Object.defineProperty(a,i,{configurable:!0,writable:!0,enumerable:n.enumerableKind,value:t[i]});for(let i of Object.keys(r))Object.defineProperty(a,i,{configurable:!0,enumerable:!0,writable:!0,value:r[i]});return a}function y(e,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function ee(e){return s.IsObject(e)}function I(e,t,r){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:r},{})}function dt(e){return y(e,"Deferred")}function Zg(e){return p.Update(e,{"~readonly":!0},{})}function Tr(e,t){return p.Update(Zg(e),{},t)}function Ai(e,t,r,n){let a=d(e,t,r);return Tr(a,n)}function Qg(e){return p.Update(e,{"~optional":!0},{})}function kr(e,t){return p.Update(Qg(e),{},t)}function Li(e,t,r,n){let a=d(e,t,r);return kr(a,n)}function Te(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function K(e){return y(e,"Array")}function In(e){return p.Discard(e,["~kind","type","items"])}function Ge(e,t,r={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function re(e){return y(e,"Constructor")}function qi(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ue(e,t,r={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function ne(e){return y(e,"Function")}function ji(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function at(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function ae(e){return y(e,"Ref")}function ft(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Vt(e){return y(e,"Generic")}function Wt(e){return p.Create({"~kind":"Any"},{},e)}function J(e){return y(e,"Any")}var Fi="(?!)";function q(e){return p.Create({"~kind":"Never"},{not:{}},e)}function gt(e){return y(e,"Never")}function Ke(e,t={}){return I("AddOptional",[e],t)}function Pt(e,t={}){return kr(e,t)}function Di(e){return Pt(e)}function le(e){return ee(e)&&s.HasPropertyKey(e,"~optional")}function Ni(e){return s.Keys(e).filter(t=>!le(e[t]))}function bn(e){return s.Keys(e)}function vn(e){return s.Values(e)}function v(e,t={}){let r=Ni(e),n=r.length>0?{required:r}:{};return p.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function M(e){return y(e,"Object")}function Gi(e){return p.Discard(e,["~kind","type","properties","required"])}function oe(e){return p.Create({"~kind":"Unknown"},{},e)}function te(e){return y(e,"Unknown")}function _e(e,t,r){let n=s.Keys(e).reduce((a,i)=>({...a,[i]:p.Update(e[i],{},{$id:i})}),{});return p.Create({"~kind":"Cyclic"},{$defs:n,$ref:t},r)}function se(e){return y(e,"Cyclic")}function Ui(e){return p.Update(e,{"~unsafe":null},{})}function $n(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}var ze={};Et(ze,{Match:()=>eh});function eh(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function wr(...e){let[t,r]=ze.Match(e,{2:(n,a)=>[n,a,a],1:n=>[n,oe(),oe()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function H(e){return y(e,"Infer")}function Ct(e,t,r,n={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:r},n)}function V(e){return y(e,"Dependent")}function Ki(e){return p.Discard(e,["~kind","if","then","else"])}function _i(e){return s.IsObjectNotArray(e)}function zi(e){return s.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function Bi(e){return s.IsString(e)||s.IsNumber(e)}function Vi(e,t){let r=_i(e)?zi(e):e;return p.Create({"~kind":"Enum"},{enum:r},t)}function fe(e){return y(e,"Enum")}function de(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function S(e){return y(e,"Intersect")}function Wi(e){return p.Discard(e,["~kind","allOf"])}function Y(){throw new Error("Unreachable")}var Hi;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(Hi||(Hi={}));var DT=BigInt("14695981039346656037"),[NT,GT]=[BigInt("1099511628211"),BigInt("18446744073709551616")],UT=Array.from({length:256}).map((e,t)=>BigInt(t)),Yi=new Float64Array(1),KT=new DataView(Yi.buffer),_T=new Uint8Array(Yi.buffer);var zT=new TextEncoder;var Er=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=Tn(r)?m=>this.decode(r["~codec"].decode(m)):this.decode,a=Tn(r)?m=>r["~codec"].encode(t(m)):t,i={decode:n,encode:a};return p.Update(this.type,{"~codec":i},{})}},Rr=class{constructor(t){this.type=t}Decode(t){return new Er(this.type,t)}};function kn(e){return new Rr(e)}function Xi(e,t){return kn(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Zi(e,t){return kn(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function Tn(e){return ee(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function Qi(e){return Ht(e)}function Mt(e){return ee(e)&&s.HasPropertyKey(e,"~immutable")}function Be(e,t={}){return I("AddReadonly",[e],t)}function At(e,t={}){return Tr(e,t)}function es(e){return At(e)}function Lt(e){return ee(e)&&s.HasPropertyKey(e,"~readonly")}function ah(e,t){let r=_a(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":r},{})}function ts(...e){let[t,r,n]=ze.Match(e,{3:(a,i,m)=>[a,i,m],2:(a,i)=>[a,i,()=>"Refine Error"]});return ah(t,{check:r,error:n})}function oh(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function _a(e){return ee(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>oh(t))}var rs="-?(?:0|[1-9][0-9]*)n";function Sr(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function Ve(e){return y(e,"BigInt")}function wn(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Se(e){return y(e,"Boolean")}function Or(e){return p.Create({"~kind":"Identifier"},{name:e})}function ns(e){return y(e,"Identifier")}var En="-?(?:0|[1-9][0-9]*)";function qt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function ge(e){return y(e,"Integer")}var za=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function ih(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new za(e)})()}function O(e,t){return p.Create({"~kind":"Literal"},{type:ih(e),const:e},t)}function Rn(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function as(e){return A(e)&&s.IsNumber(e.const)}function os(e){return A(e)&&s.IsString(e.const)}function A(e){return y(e,"Literal")}function Yt(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Jt(e){return y(e,"Null")}var Sn="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function be(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function X(e){return y(e,"Number")}function Xt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function ht(e){return y(e,"Symbol")}function jt(...e){let[t,r,n]=ze.Match(e,{3:(a,i,m)=>[a,i,m],2:(a,i)=>[a,i,i],1:a=>[a,oe(),oe()]});return p.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function is(e){return y(e,"Parameter")}var On=".*";function Oe(e){return p.Create({"~kind":"String"},{type:"string"},e)}function he(e){return y(e,"String")}function k(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return y(e,"Union")}function ss(e){return p.Discard(e,["~kind","anyOf"])}function Pr(e){let t=ms(e);return s.IsEqual(t.length,2)?t[0]:[]}function sh(e){return!0}function ps(e){return s.ShiftLeft(e,(t,r)=>mh(t)?ps(r):!1,()=>!0)}function us(e){return s.IsEqual(e.length,0)?!1:ps(e)}function mh(e){return x(e)?us(e.anyOf):A(e)?sh(e.const):!1}function Pn(e){return us(e)}function Cn(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function cs(e,t,r=[]){return s.ShiftLeft(e,(n,a)=>cs(a,t,[...r,`${n}${t}`]),()=>r)}function ph(e,t){return s.IsEqual(e.length,0)?[`${t}`]:cs(e,t)}function ls(e,t,r=[]){return s.ShiftLeft(t,(n,a)=>ls(e,a,[...r,...ds(e,n)]),()=>r)}function ds(e,t){return x(t)?ls(e,t.anyOf):A(t)?ph(e,t.const):Y()}function fs(e,t){return s.ShiftLeft(t,(r,n)=>fs(ds(e,r),n),()=>e)}function uh(e){return e.map(t=>O(t))}function ch(e){let t=fs([],e),r=uh(t);return k(r)}function lh(e){return s.IsEqual(e.length,0)?Y():s.IsEqual(e.length,1)&&A(e[0])?e[0]:ch(e)}function Ba(e){let t=Pr(e);return s.IsEqual(t.length,0)?Oe():Pn(t)?lh(t):Cn(e)}function gs(e){let t=Ba(e);return Z(t)?Oe():t}function xe(e,t){let r="object",n={[e]:t};return p.Create({"~kind":"Record"},{type:r,patternProperties:n})}function hs(e){return xe(je,e)}function ys(e){return v({true:e,false:e})}function Q(e,t={}){let[r,n,a]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:a,items:r,minItems:n},t)}function j(e){return y(e,"Tuple")}function xs(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function dh(e){return p.Discard(e,["~readonly"])}function Va(e,t){return p.Update(dh(e),{},t)}function Is(e,t,r,n){let a=d(e,t,r);return Va(a,n)}function bs(e,t={}){return I("RemoveReadonly",[e],t)}function vs(e,t={}){return Va(e,t)}function fh(e){return p.Discard(e,["~optional"])}function Wa(e,t){return p.Update(fh(e),{},t)}function $s(e,t,r,n){let a=d(e,t,r);return Wa(a,n)}function Ts(e,t={}){return I("RemoveOptional",[e],t)}function Mn(e,t={}){return Wa(e,t)}function Ha(e){return e.reduceRight((r,n,a)=>({[a]:n,...r}),{})}function ks(e){let t=Ha(e.items);return v(t)}function gh(e,t){return Lt(e)?!!Lt(t):!1}function hh(e,t){return le(e)?!!le(t):!1}function yh(e,t){let r=gh(e,t),n=hh(e,t),a=z([e,t]),i=vs(Mn(a));return r&&n?At(Pt(i)):r&&!n?At(i):!r&&n?Pt(i):i}function xh(e,t,r){return r in e?r in t?yh(e[r],t[r]):e[r]:r in t?t[r]:q()}function Ih(e,t){return[...new Set([...s.Keys(t),...s.Keys(e)])].reduce((n,a)=>({...n,[a]:xh(e,t,a)}),{})}function ws(e){return M(e)?e.properties:j(e)?Ha(e.items):Y()}function Es(e,t){let r=ws(e),n=ws(t),a=Ih(r,n);return v(a)}function Rs(e,t){let r=Zt(e,t);return s.IsEqual(r,Mr)?e:s.IsEqual(r,Ar)||s.IsEqual(r,Cr)?t:q()}function Ss(e){return M(e)||j(e)}function bh(e,t){let r=x(e),n=x(t);return r||n}function vh(e,t){let r=Pe(e),n=Pe(t),a=bh(r,n),i=Ss(r),m=Ss(n);return a?z([r,n]):i&&m?Es(r,n):i&&!m?r:!i&&m?n:Rs(r,n)}function Os(e,t,r=[]){return s.ShiftLeft(t,(n,a)=>Os(e,a,[...r,vh(e,n)]),()=>s.IsEqual(r.length,0)?[e]:r)}function Ps(e,t,r=[]){return s.ShiftLeft(e,(n,a)=>Ps(a,t,[...r,...Lr([n],t)]),()=>r)}function Lr(e,t=[]){return s.ShiftLeft(e,(r,n)=>x(r)?Lr(n,Ps(r.anyOf,t)):Lr(n,Os(r,t)),()=>t)}function $h(e,t){let r=me({},e,t);return b.IsExtendsTrueLike(r)?[]:[e]}function Th(e,t){return e.reduce((r,n)=>[...r,...$h(n,t)],[])}function An(e,t){let r=Pe(e),n=x(r)?r.anyOf:[r],a=Th(n,t);return ve(a)}function Fe(e,t,r){let n=de([e,t]),a=An(r,e);return ve([n,a])}function ke(e){let t=e.map(r=>O(r));return ve(t)}function z(e){let t=Lr(e),r=Ya(t);return ot(r)}function Ie(e){let t=gs(e);return Pe(t)}function ve(e){let t=Ya(e);return ot(t)}function Pe(e){return V(e)?Fe(e.if,e.then,e.else):fe(e)?ke(e.enum):S(e)?z(e.allOf):Z(e)?Ie(e.pattern):x(e)?ve(e.anyOf):e}function ot(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?q():k(e)}function Cs(e,t){let r=ke(e);return yt(r,t)}function Ms(e,t){return xe(xt,t)}function As(e,t){let r=z(e);return yt(r,t)}function Ls(e,t){return s.IsString(e)||s.IsNumber(e)?v({[e]:t}):s.IsEqual(e,!1)?v({false:t}):s.IsEqual(e,!0)?v({true:t}):v({})}function qs(e,t){return xe(Qt,t)}function js(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?xe(e.pattern.toString(),t):xe(je,t)}function Fs(e,t){let r=Pr(e);return Pn(r)?yt(Ie(e),t):xe(e,t)}function kh(e){return x(e)?qr(e.anyOf):[e]}function qr(e){return e.reduce((t,r)=>[...t,...kh(r)],[])}function wh(e){return e.some(t=>he(t)||X(t)||ge(t))}function Eh(e,t){return s.IsEqual(wh(e),!0)?xe(je,t):void 0}function Rh(e,t){return e.reduce((r,n)=>A(n)&&(s.IsString(n.const)||s.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function Sh(e,t){let r=Rh(e,t);return v(r)}function Ds(e,t){let r=qr(e),n=Eh(r,t);return ee(n)?n:Sh(r,t)}function yt(e,t){return J(e)?hs(t):Se(e)?ys(t):fe(e)?Cs(e.enum,t):ge(e)?Ms(e,t):S(e)?As(e.allOf,t):A(e)?Ls(e.const,t):X(e)?qs(e,t):x(e)?Ds(e.anyOf,t):he(e)?js(e,t):Z(e)?Fs(e.pattern,t):v({})}function Ja(e,t,r){return T([e])?p.Update(yt(e,t),{},r):Ln(e,t,r)}function Ns(e,t,r,n,a){let i=d(e,t,r),m=d(e,t,n);return Ja(i,m,a)}var xt=`^${En}$`,Qt=`^${Sn}$`,je=`^${On}$`;function Ln(e,t,r={}){return I("Record",[e,t],r)}function qn(e,t,r={}){return Ja(e,t,r)}function Gs(e,t){return xe(e,t)}function jn(e){return s.IsEqual(e,je)?Oe():s.IsEqual(e,xt)?qt():s.IsEqual(e,Qt)?be():Ba(e)}function Ce(e){return s.Keys(e.patternProperties)[0]}function er(e){let t=Ce(e);return jn(t)}function ye(e){return e.patternProperties[Ce(e)]}function pe(e){return y(e,"Record")}function Ft(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function It(e){return y(e,"Rest")}function Fn(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function Dn(e){return y(e,"This")}function tr(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function rr(e){return y(e,"Undefined")}function Nn(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function We(e){return y(e,"Void")}function Ph(e,t){return s.IsEqual(e,"Array")?Te(t[0]):s.IsEqual(e,"Capitalize")?Un(t[0]):s.IsEqual(e,"ConstructorParameters")?Vn(t[0]):s.IsEqual(e,"Evaluate")?Kp(t[0]):s.IsEqual(e,"Exclude")?Wn(t[0],t[1]):s.IsEqual(e,"Extract")?Hn(t[0],t[1]):s.IsEqual(e,"Index")?Nr(t[0],t[1]):s.IsEqual(e,"InstanceType")?Yn(t[0]):s.IsEqual(e,"Lowercase")?Kn(t[0]):s.IsEqual(e,"NonNullable")?Jn(t[0]):s.IsEqual(e,"Omit")?Xn(t[0],t[1]):s.IsEqual(e,"Parameters")?Zn(t[0]):s.IsEqual(e,"Partial")?Qn(t[0]):s.IsEqual(e,"Pick")?ea(t[0],t[1]):s.IsEqual(e,"Readonly")?ta(t[0]):s.IsEqual(e,"KeyOf")?Gr(t[0]):s.IsEqual(e,"Record")?Ln(t[0],t[1]):s.IsEqual(e,"Required")?ra(t[0]):s.IsEqual(e,"ReturnType")?na(t[0]):s.IsEqual(e,"Uncapitalize")?_n(t[0]):s.IsEqual(e,"Uppercase")?zn(t[0]):Dr(at(e),t)}function Dt(){throw Error("Unreachable")}var Ch=(e,t=[])=>e.reduce((r,n)=>s.IsArray(n)&&s.IsEqual(n.length,2)?[...r,n[0]]:[...r,n],[]),it=e=>{let[t,r]=e;return Ch([...t,...r])};function Bs(e){return jt(e[0],e[2],e[4])}function Vs(e){return jt(e[0],e[2],e[2])}function Ws(e){return jt(e[0],oe(),e[2])}function Hs(e){return jt(e,oe(),oe())}function Ys(e){return it(e)}function Js(e){return e[1]}function Xs(e){return it(e)}function Zs(e){return e[1]}function Qs(e){return Ph(e[0],e[1])}function em(e){return null}function tm(e){return Oe()}function rm(e){return be()}function nm(e){return wn()}function am(e){return tr()}function om(e){return Yt()}function im(e){return qt()}function sm(e){return Sr()}function mm(e){return oe()}function pm(e){return Wt()}function um(e){return v({})}function cm(e){return q()}function lm(e){return Xt()}function dm(e){return Nn()}function fm(e){return Fn()}function gm(e){return O(BigInt(e))}function hm(e){return O(s.IsEqual(e,"true"))}function ym(e){return O(parseFloat(e))}function xm(e){return O(e)}function Im(e){return e[1]}function bm(e){return O(e)}function vm(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function $m(e){return e[1]}function Tm(e){return Gn(e)}function km(e){return s.IsEqual(e.length,6)?Ct(e[1],e[3],e[5]):Ct(e[1],e[3],oe())}function wm(e){return e.length>0}function Em(e){return e.reduce((t,r)=>s.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function Rm(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Sm(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function Om(e){return s.IsEqual(e.length,2)?e[1]:[]}function Us(e,t){return t.reduce((r,n)=>{let a=n;return s.IsEqual(a.length,1)?Nr(r,a[0]):s.IsEqual(a.length,0)?Te(r):Dt()},e)}function Ks(e,t){return s.IsEqual(t.length,3)?Bn(e,t[0],t[1],t[2]):e}function Mh(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:aa(e,t)}function Pm(e){let[t,r,n,a,i]=e;return Mh(Ks(t?Gr(Us(r,n)):Us(r,n),a),i)}function Xa(e,t){return s.IsEqual(t.length,3)?(()=>{let[r,n,a]=t,i=Xa(n,a);if(s.IsEqual(r,"&"))return S(i)?de([e,...i.allOf]):de([e,i]);if(s.IsEqual(r,"|"))return x(i)?k([e,...i.anyOf]):k([e,i]);Dt()})():e}function Cm(e){let[t,r]=e;return Xa(t,r)}function Mm(e){let[t,r]=e;return Xa(t,r)}function Am(e){return Up(e[1])}function Lm(e){return e[1]}function qm(e){return ft(e[0],e[2])}function jm(e){return s.IsEqual(e.length,4)?wr(e[1],e[3]):s.IsEqual(e.length,2)?wr(e[1],oe()):Dt()}function Fm(e){return`${e}`}function Dm(e){return ge(e[3])?xt:X(e[3])?Qt:ht(e[3])?je:he(e[3])?je:Dt()}function Nm(e){return e.length>0}function Gm(e){return e.length>0}function Um(e){let[t,r,n,a,i]=e;return{[r]:t&&n?Be(Ke(i)):t&&!n?Be(i):!t&&n?Ke(i):i}}function Km(e){return it(e)}function _m(e){return e.reduce((t,r)=>s.HasPropertyKey(r,xt)||s.HasPropertyKey(r,Qt)||s.HasPropertyKey(r,je)?[t[0],p.Assign(t[1],r)]:[p.Assign(t[0],r),t[1]],[{},{}])}function zm(e){return _m(e[1])}function Bm(e){let[t,r]=e,n=s.IsEqual(s.Keys(r).length,0)?{}:{patternProperties:r};return v(t,n)}function Vm(e){return s.IsEqual(e.length,5)?Be(Ke(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?Be(e[3]):Ke(e[3]):Dt()}function Wm(e){return Be(Ke(e[1]))}function Hm(e){return Be(e[1])}function Ym(e){return Ke(e[0])}function Jm(e){return s.IsEqual(e.length,2)?Ft(e[1]):s.IsEqual(e.length,1)?e[0]:Dt()}function Xm(e){return it(e)}function Zm(e){return Q(e[1])}function Qm(e){return Be(Ke(e[4]))}function ep(e){return Be(e[3])}function tp(e){return Ke(e[3])}function rp(e){return e[2]}function np(e){return s.IsEqual(e.length,2)?Ft(e[1]):s.IsEqual(e.length,1)?e[0]:Dt()}function ap(e){return it(e)}function op(e){return Ue(e[1],e[4])}function ip(e){return Ge(e[2],e[5])}function _s(e,t){return s.IsEqual(e,"remove")?bs(t):s.IsEqual(e,"add")?Be(t):t}function sp(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function zs(e,t){return s.IsEqual(e,"remove")?Ts(t):s.IsEqual(e,"add")?Ke(t):t}function mp(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function pp(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function up(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?jr(Or(e[3]),e[5],e[6][0],_s(e[1],zs(e[8],e[10]))):jr(Or(e[3]),e[5],at(e[3]),_s(e[1],zs(e[8],e[10])))}function cp(e){return at(e)}function lp(e){return BigInt(e)}function dp(e){return parseFloat(e)}function fp(e){return s.IsEqual(e,"true")}function gp(e){return null}function hp(e){return{[e[0]]:e[2]}}function yp(e){return it(e)}function Ah(e){return e.reduce((t,r)=>p.Assign(t,r),{})}function xp(e){return Ah(e[1])}function Ip(e){return it(e)}function bp(e){return e[1]}function vp(e){return Sr()}function $p(e){return Oe()}function Tp(e){return be()}function kp(e){return qt()}function wp(e){return q()}function Ep(e){return O(e)}function Rp(e){return k(e[1])}function Sp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Op(e){return[e[0],...e[1]]}function Pp(e){return e[1]}function Cp(e){return it(e)}function Mp(e){return s.IsEqual(e.length,2)?e[1]:[]}function Ap(e){let t=e[2],r=e[3],[n,a]=e[4],i=s.IsEqual(s.Keys(a).length,0)?{}:{patternProperties:a};return{[e[1]]:ft(t,Fr(r,n,i))}}function Lp(e){let t=e[2],[r,n]=e[3],a=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:Fr(t,r,a)}}function qp(e){return{[e[1]]:ft(e[2],e[4])}}function jp(e){return{[e[1]]:e[3]}}function Fp(e){return null}function Dp(e){return _m(it(e))}function Np(e){return e[1]}function Gp(e){let t=e[0],r=e[1];return _p(p.Assign(t,r[0]))}function Ur(e){return C(e.length,2)}function E(e,t,r){return Ur(e)?t(e[0],e[1]):r()}function jh(e,t){return C(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function B(e,t){for(let r=0;r<e.length;r++){let n=jh(e[r],t);if(Ur(n))return n}return[]}function Za(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var zp=[...Za(97,122),...Za(65,90)],Qa="0",eo=Za(49,57),nr=[Qa,...eo],Bp=" ",ar=`
|
|
6
|
+
`;var bt="_",oa=".",Vp="$",ia="-";var Wp="//",Hp="/*",Dh="*/";function Yp(e){let t=e.indexOf(Dh);return C(t,-1)?"":e.slice(t+2)}function Jp(e){let t=e.indexOf(ar);return C(t,-1)?"":e.slice(t)}function Nh(e){return e.replace(/^[ \t\r\f\v]+/,"")}function sa(e){let t=Nh(e);return t.startsWith(Hp)?sa(Yp(t.slice(2))):t.startsWith(Wp)?sa(Jp(t.slice(2))):t}function ie(e){let t=e.trimStart();return t.startsWith(Hp)?ie(Yp(t.slice(2))):t.startsWith(Wp)?ie(Jp(t.slice(2))):t}function ma(e,t){return E(B([e],t),(r,n)=>[r,n],()=>["",t])}function Gh(e,t){return e.includes(t)}function or(e,t,r,n=""){return E(B(e,r),(a,i)=>Gh(t,a)?or(e,t,i,n):or(e,t,i,`${n}${a}`),()=>[n,r])}function Uh(e){return B(eo,e)}var Kh=[...nr,bt];function _h(e){return or(Kh,[bt],e)}function zh(e){return E(B([Qa],e),(t,r)=>[t,r],()=>E(Uh(e),(t,r)=>E(_h(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[]))}function pa(e){return zh(ie(e))}function Bh(e){return ma(ia,e)}function Vh(e){return E(Bh(e),(t,r)=>E(pa(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function Xp(e){return Vh(ie(e))}function Wh(e){return E(Xp(e),(t,r)=>E(B(["n"],r),(n,a)=>[`${t}`,a],()=>[]),()=>[])}function to(e){return Wh(e)}function ro(e,t){return B([e],t)}function u(e,t){return C(e,"")?["",t]:e.startsWith(ar)?ro(e,sa(t)):e.startsWith(Bp)?ro(e,t):ro(e,ie(t))}var Zp=[...zp,bt,Vp];function Hh(e){return B(Zp,e)}var Yh=[...Zp,...nr];function Qp(e,t=""){return E(B(Yh,e),(r,n)=>Qp(n,`${t}${r}`),()=>[t,e])}function Jh(e){return E(Hh(e),(t,r)=>E(Qp(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function W(e){return Jh(ie(e))}var Xh=[...nr,bt];function Zh(e){return Ur(B([oa],e))}function eu(e){return E(or(Xh,[bt],e),(t,r)=>C(t,"")?[]:[t,r],()=>[])}function Qh(e){return E(B([oa],e),(t,r)=>E(eu(r),(n,a)=>[`0${t}${n}`,a],()=>[]),()=>[])}function ey(e){return E(pa(e),(t,r)=>E(B([oa],r),(n,a)=>E(eu(a),(i,m)=>[`${t}${n}${i}`,m],()=>[`${t}`,a]),()=>[`${t}`,r]),()=>[])}function ty(e){return Zh(e)?Qh(e):ey(e)}function tu(e){return ty(ie(e))}function ry(e){return ma(ia,e)}function ny(e){return E(ry(e),(t,r)=>E(tu(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function ua(e){return ny(ie(e))}function ay(e){return C(e,"")?[]:[e.slice(0,1),e.slice(1)]}function ru(e,t){return xn(e,(r,n)=>t.startsWith(r)?!0:ru(n,t),()=>!1)}function vt(e,t,r=""){return E(ay(t),(n,a)=>ru(e,t)?[r,t]:vt(e,a,`${r}${n}`),()=>[])}function oy(e,t,r){return E(B([e],r),(n,a)=>E(vt([t],a),(i,m)=>E(B([t],m),(c,l)=>[`${i}`,l],()=>[]),()=>[]),()=>[])}function iy(e,t,r){return E(B([e],r),(n,a)=>E(vt([ar,t],a),(i,m)=>E(B([t],m),(c,l)=>[`${i}`,l],()=>[]),()=>[]),()=>[])}function nu(e,t,r,n){return r?oy(e,t,ie(n)):iy(e,t,ie(n))}function sy(e,t){return B(e,t)}function my(e,t){return nu(e,e,!1,t)}function py(e,t){return E(sy(e,t),(r,n)=>my(r,`${r}${n}`),()=>[])}function ca(e,t){return py(e,ie(t))}function au(e,t){return E(vt(e,t),(r,n)=>C(r,"")?[]:[r,n],()=>[])}var o=(e,t,r=()=>[])=>e.length===2?t(e):r(),cy=e=>o(o(W(e),([t,r])=>o(u("extends",r),([n,a])=>o(R(a),([i,m])=>o(u("=",m),([c,l])=>o(R(l),([g,f])=>[[t,n,i,c,g],f]))))),([t,r])=>[Bs(t),r]),ly=e=>o(o(W(e),([t,r])=>o(u("extends",r),([n,a])=>o(R(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Vs(t),r]),dy=e=>o(o(W(e),([t,r])=>o(u("=",r),([n,a])=>o(R(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Ws(t),r]),fy=e=>o(W(e),([t,r])=>[Hs(t),r]),su=e=>o(o(cy(e),([t,r])=>[t,r],()=>o(ly(e),([t,r])=>[t,r],()=>o(dy(e),([t,r])=>[t,r],()=>o(fy(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),mu=(e,t=[])=>o(o(su(e),([r,n])=>o(u(",",n),([a,i])=>[[r,a],i])),([r,n])=>mu(n,[...t,r]),()=>[t,e]),gy=e=>o(o(mu(e),([t,r])=>o(o(o(su(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Ys(t),r]),oo=e=>o(o(u("<",e),([t,r])=>o(gy(r),([n,a])=>o(u(">",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Js(t),r]),pu=(e,t=[])=>o(o(R(e),([r,n])=>o(u(",",n),([a,i])=>[[r,a],i])),([r,n])=>pu(n,[...t,r]),()=>[t,e]),hy=e=>o(o(pu(e),([t,r])=>o(o(o(R(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Xs(t),r]),yy=e=>o(o(u("<",e),([t,r])=>o(hy(r),([n,a])=>o(u(">",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Zs(t),r]),xy=e=>o(o(W(e),([t,r])=>o(yy(r),([n,a])=>[[t,n],a])),([t,r])=>[Qs(t),r]),uu=e=>o(o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[em(t),r]),cu=e=>o(u("string",e),([t,r])=>[tm(t),r]),lu=e=>o(u("number",e),([t,r])=>[rm(t),r]),Iy=e=>o(u("boolean",e),([t,r])=>[nm(t),r]),by=e=>o(u("undefined",e),([t,r])=>[am(t),r]),vy=e=>o(u("null",e),([t,r])=>[om(t),r]),du=e=>o(u("integer",e),([t,r])=>[im(t),r]),$y=e=>o(u("bigint",e),([t,r])=>[sm(t),r]),Ty=e=>o(u("unknown",e),([t,r])=>[mm(t),r]),ky=e=>o(u("any",e),([t,r])=>[pm(t),r]),wy=e=>o(u("object",e),([t,r])=>[um(t),r]),Ey=e=>o(u("never",e),([t,r])=>[cm(t),r]),fu=e=>o(u("symbol",e),([t,r])=>[lm(t),r]),Ry=e=>o(u("void",e),([t,r])=>[dm(t),r]),Sy=e=>o(u("this",e),([t,r])=>[fm(t),r]),Oy=e=>o(o(u("${",e),([t,r])=>o(R(r),([n,a])=>o(u("}",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Im(t),r]),no=e=>o(vt(["${","`"],e),([t,r])=>[bm(t),r]),gu=e=>o(o(o(no(e),([t,r])=>o(Oy(r),([n,a])=>o(gu(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[t,r],()=>o(o(no(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(no(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[vm(t),r]),io=e=>o(o(u("`",e),([t,r])=>o(gu(r),([n,a])=>o(u("`",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[$m(t),r]),Py=e=>o(io(e),([t,r])=>[Tm(t),r]),Cy=e=>o(o(o(u("if",e),([t,r])=>o(R(r),([n,a])=>o(u("then",a),([i,m])=>o(R(m),([c,l])=>o(u("else",l),([g,f])=>o(R(f),([w,F])=>[[t,n,i,c,g,w],F])))))),([t,r])=>[t,r],()=>o(o(u("if",e),([t,r])=>o(R(r),([n,a])=>o(u("then",a),([i,m])=>o(R(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[t,r],()=>[])),([t,r])=>[km(t),r]),My=e=>o(to(e),([t,r])=>[gm(t),r]),Ay=e=>o(o(u("true",e),([t,r])=>[t,r],()=>o(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[hm(t),r]),Ly=e=>o(ua(e),([t,r])=>[ym(t),r]),qy=e=>o(ca(["'",'"'],e),([t,r])=>[xm(t),r]),jy=e=>o(o(o(u("keyof",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[wm(t),r]),hu=(e,t=[])=>o(o(o(u("[",e),([r,n])=>o(R(n),([a,i])=>o(u("]",i),([m,c])=>[[r,a,m],c]))),([r,n])=>[r,n],()=>o(o(u("[",e),([r,n])=>o(u("]",n),([a,i])=>[[r,a],i])),([r,n])=>[r,n],()=>[])),([r,n])=>hu(n,[...t,r]),()=>[t,e]),Fy=e=>o(hu(e),([t,r])=>[Em(t),r]),Dy=e=>o(o(o(u("extends",e),([t,r])=>o(R(r),([n,a])=>o(u("?",a),([i,m])=>o(R(m),([c,l])=>o(u(":",l),([g,f])=>o(R(f),([w,F])=>[[t,n,i,c,g,w],F])))))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Rm(t),r]),Ny=e=>o(o(o(u("(",e),([t,r])=>o(R(r),([n,a])=>o(u(")",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[t,r],()=>o(cu(e),([t,r])=>[t,r],()=>o(lu(e),([t,r])=>[t,r],()=>o(Iy(e),([t,r])=>[t,r],()=>o(by(e),([t,r])=>[t,r],()=>o(vy(e),([t,r])=>[t,r],()=>o(du(e),([t,r])=>[t,r],()=>o($y(e),([t,r])=>[t,r],()=>o(Ty(e),([t,r])=>[t,r],()=>o(ky(e),([t,r])=>[t,r],()=>o(wy(e),([t,r])=>[t,r],()=>o(Ey(e),([t,r])=>[t,r],()=>o(fu(e),([t,r])=>[t,r],()=>o(Ry(e),([t,r])=>[t,r],()=>o(Sy(e),([t,r])=>[t,r],()=>o(My(e),([t,r])=>[t,r],()=>o(Ay(e),([t,r])=>[t,r],()=>o(Ly(e),([t,r])=>[t,r],()=>o(qy(e),([t,r])=>[t,r],()=>o(Py(e),([t,r])=>[t,r],()=>o(Cy(e),([t,r])=>[t,r],()=>o(Zy(e),([t,r])=>[t,r],()=>o(ax(e),([t,r])=>[t,r],()=>o(ux(e),([t,r])=>[t,r],()=>o(px(e),([t,r])=>[t,r],()=>o(fx(e),([t,r])=>[t,r],()=>o(xy(e),([t,r])=>[t,r],()=>o(gx(e),([t,r])=>[t,r],()=>[])))))))))))))))))))))))))))),([t,r])=>[Sm(t),r]),Gy=e=>o(o(o(u("with",e),([t,r])=>o(Mu(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Om(t),r]),yu=e=>o(o(jy(e),([t,r])=>o(Ny(r),([n,a])=>o(Fy(a),([i,m])=>o(Dy(m),([c,l])=>o(Gy(l),([g,f])=>[[t,n,i,c,g],f]))))),([t,r])=>[Pm(t),r]),xu=e=>o(o(o(u("&",e),([t,r])=>o(yu(r),([n,a])=>o(xu(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Iu=e=>o(o(yu(e),([t,r])=>o(xu(r),([n,a])=>[[t,n],a])),([t,r])=>[Cm(t),r]),bu=e=>o(o(o(u("|",e),([t,r])=>o(Iu(r),([n,a])=>o(bu(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),la=e=>o(o(Iu(e),([t,r])=>o(bu(r),([n,a])=>[[t,n],a])),([t,r])=>[Mm(t),r]),Uy=e=>o(o(u("readonly",e),([t,r])=>o(la(r),([n,a])=>[[t,n],a])),([t,r])=>[Am(t),r]),Ky=e=>o(o(u("|",e),([t,r])=>o(la(r),([n,a])=>[[t,n],a])),([t,r])=>[Lm(t),r]),_y=e=>o(o(oo(e),([t,r])=>o(u("=",r),([n,a])=>o(R(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[qm(t),r]),zy=e=>o(o(o(u("infer",e),([t,r])=>o(W(r),([n,a])=>o(u("extends",a),([i,m])=>o(la(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[t,r],()=>o(o(u("infer",e),([t,r])=>o(W(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>[])),([t,r])=>[jm(t),r]),R=e=>o(o(zy(e),([t,r])=>[t,r],()=>o(Ky(e),([t,r])=>[t,r],()=>o(Uy(e),([t,r])=>[t,r],()=>o(la(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),By=e=>o(ua(e),([t,r])=>[Fm(t),r]),Vy=e=>o(W(e),([t,r])=>[t,r]),Wy=e=>o(ca(["'",'"'],e),([t,r])=>[t,r]),Hy=e=>o(o(u("[",e),([t,r])=>o(W(r),([n,a])=>o(u(":",a),([i,m])=>o(o(du(m),([c,l])=>[c,l],()=>o(lu(m),([c,l])=>[c,l],()=>o(cu(m),([c,l])=>[c,l],()=>o(fu(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([g,f])=>[[t,n,i,c,g],f]))))),([t,r])=>[Dm(t),r]),vu=e=>o(o(By(e),([t,r])=>[t,r],()=>o(Vy(e),([t,r])=>[t,r],()=>o(Wy(e),([t,r])=>[t,r],()=>o(Hy(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),Yy=e=>o(o(o(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Nm(t),r]),Jy=e=>o(o(o(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Gm(t),r]),$u=e=>o(o(Yy(e),([t,r])=>o(vu(r),([n,a])=>o(Jy(a),([i,m])=>o(u(":",m),([c,l])=>o(R(l),([g,f])=>[[t,n,i,c,g],f]))))),([t,r])=>[Um(t),r]),Tu=e=>o(o(o(u(",",e),([t,r])=>o(u(`
|
|
7
7
|
`,r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u(";",e),([t,r])=>o(u(`
|
|
8
8
|
`,r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u(",",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(u(`
|
|
9
|
-
`,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),
|
|
9
|
+
`,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),ku=(e,t=[])=>o(o($u(e),([r,n])=>o(Tu(n),([a,i])=>[[r,a],i])),([r,n])=>ku(n,[...t,r]),()=>[t,e]),Xy=e=>o(o(ku(e),([t,r])=>o(o(o($u(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Km(t),r]),so=e=>o(o(u("{",e),([t,r])=>o(Xy(r),([n,a])=>o(u("}",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[zm(t),r]),Zy=e=>o(so(e),([t,r])=>[Bm(t),r]),Qy=e=>o(o(o(W(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([i,m])=>o(u("readonly",m),([c,l])=>o(R(l),([g,f])=>[[t,n,i,c,g],f]))))),([t,r])=>[t,r],()=>o(o(W(e),([t,r])=>o(u(":",r),([n,a])=>o(u("readonly",a),([i,m])=>o(R(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[t,r],()=>o(o(W(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([i,m])=>o(R(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[t,r],()=>o(o(W(e),([t,r])=>o(u(":",r),([n,a])=>o(R(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[t,r],()=>[])))),([t,r])=>[Vm(t),r]),ex=e=>o(o(u("readonly",e),([t,r])=>o(R(r),([n,a])=>o(u("?",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Wm(t),r]),tx=e=>o(o(u("readonly",e),([t,r])=>o(R(r),([n,a])=>[[t,n],a])),([t,r])=>[Hm(t),r]),rx=e=>o(o(R(e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[Ym(t),r]),ou=e=>o(o(Qy(e),([t,r])=>[t,r],()=>o(ex(e),([t,r])=>[t,r],()=>o(tx(e),([t,r])=>[t,r],()=>o(rx(e),([t,r])=>[t,r],()=>o(R(e),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),wu=e=>o(o(o(u("...",e),([t,r])=>o(ou(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(ou(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[Jm(t),r]),Eu=(e,t=[])=>o(o(wu(e),([r,n])=>o(u(",",n),([a,i])=>[[r,a],i])),([r,n])=>Eu(n,[...t,r]),()=>[t,e]),nx=e=>o(o(Eu(e),([t,r])=>o(o(o(wu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Xm(t),r]),ax=e=>o(o(u("[",e),([t,r])=>o(nx(r),([n,a])=>o(u("]",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Zm(t),r]),ox=e=>o(o(W(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([i,m])=>o(u("readonly",m),([c,l])=>o(R(l),([g,f])=>[[t,n,i,c,g],f]))))),([t,r])=>[Qm(t),r]),ix=e=>o(o(W(e),([t,r])=>o(u(":",r),([n,a])=>o(u("readonly",a),([i,m])=>o(R(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[ep(t),r]),sx=e=>o(o(W(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([i,m])=>o(R(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[tp(t),r]),mx=e=>o(o(W(e),([t,r])=>o(u(":",r),([n,a])=>o(R(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[rp(t),r]),iu=e=>o(o(ox(e),([t,r])=>[t,r],()=>o(ix(e),([t,r])=>[t,r],()=>o(sx(e),([t,r])=>[t,r],()=>o(mx(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),Ru=e=>o(o(o(u("...",e),([t,r])=>o(iu(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(iu(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[np(t),r]),Su=(e,t=[])=>o(o(Ru(e),([r,n])=>o(u(",",n),([a,i])=>[[r,a],i])),([r,n])=>Su(n,[...t,r]),()=>[t,e]),Ou=e=>o(o(Su(e),([t,r])=>o(o(o(Ru(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[ap(t),r]),px=e=>o(o(u("(",e),([t,r])=>o(Ou(r),([n,a])=>o(u(")",a),([i,m])=>o(u("=>",m),([c,l])=>o(R(l),([g,f])=>[[t,n,i,c,g],f]))))),([t,r])=>[op(t),r]),ux=e=>o(o(u("new",e),([t,r])=>o(u("(",r),([n,a])=>o(Ou(a),([i,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([g,f])=>o(R(f),([w,F])=>[[t,n,i,c,g,w],F])))))),([t,r])=>[ip(t),r]),cx=e=>o(o(o(u("+",e),([t,r])=>o(u("readonly",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("-",e),([t,r])=>o(u("readonly",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[sp(t),r]),lx=e=>o(o(o(u("+",e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("-",e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[mp(t),r]),dx=e=>o(o(o(u("as",e),([t,r])=>o(R(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[pp(t),r]),fx=e=>o(o(u("{",e),([t,r])=>o(cx(r),([n,a])=>o(u("[",a),([i,m])=>o(W(m),([c,l])=>o(u("in",l),([g,f])=>o(R(f),([w,F])=>o(dx(F),([_,ue])=>o(u("]",ue),([Me,Ae])=>o(lx(Ae),([De,Qe])=>o(u(":",Qe),([D,et])=>o(R(et),([Ne,mt])=>o(uu(mt),([pt,kt])=>o(u("}",kt),([wt,zt])=>[[t,n,i,c,g,w,_,Me,De,D,Ne,pt,wt],zt]))))))))))))),([t,r])=>[up(t),r]),gx=e=>o(W(e),([t,r])=>[cp(t),r]),hx=e=>o(to(e),([t,r])=>[lp(t),r]),yx=e=>o(ua(e),([t,r])=>[dp(t),r]),xx=e=>o(o(u("true",e),([t,r])=>[t,r],()=>o(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[fp(t),r]),Ix=e=>o(ca(['"',"'"],e),([t,r])=>[t,r]),bx=e=>o(u("null",e),([t,r])=>[gp(t),r]),vx=e=>o(u("undefined",e),([t,r])=>[void 0,r]),Pu=e=>o(o(vu(e),([t,r])=>o(u(":",r),([n,a])=>o(mo(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[hp(t),r]),Cu=(e,t=[])=>o(o(Pu(e),([r,n])=>o(Tu(n),([a,i])=>[[r,a],i])),([r,n])=>Cu(n,[...t,r]),()=>[t,e]),$x=e=>o(o(Cu(e),([t,r])=>o(o(o(Pu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[yp(t),r]),Mu=e=>o(o(u("{",e),([t,r])=>o($x(r),([n,a])=>o(u("}",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[xp(t),r]),Au=(e,t=[])=>o(o(mo(e),([r,n])=>o(u(",",n),([a,i])=>[[r,a],i])),([r,n])=>Au(n,[...t,r]),()=>[t,e]),Tx=e=>o(o(Au(e),([t,r])=>o(o(o(mo(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Ip(t),r]),kx=e=>o(o(u("[",e),([t,r])=>o(Tx(r),([n,a])=>o(u("]",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[bp(t),r]),mo=e=>o(o(hx(e),([t,r])=>[t,r],()=>o(yx(e),([t,r])=>[t,r],()=>o(xx(e),([t,r])=>[t,r],()=>o(Ix(e),([t,r])=>[t,r],()=>o(bx(e),([t,r])=>[t,r],()=>o(vx(e),([t,r])=>[t,r],()=>o(Mu(e),([t,r])=>[t,r],()=>o(kx(e),([t,r])=>[t,r],()=>[])))))))),([t,r])=>[t,r]),wx=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,r])=>[vp(t),r]),Ex=e=>o(u(".*",e),([t,r])=>[$p(t),r]),Rx=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,r])=>[Tp(t),r]),Sx=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,r])=>[kp(t),r]),Ox=e=>o(u("(?!)",e),([t,r])=>[wp(t),r]),Px=e=>o(au(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,r])=>[Ep(t),r]),Cx=e=>o(o(wx(e),([t,r])=>[t,r],()=>o(Ex(e),([t,r])=>[t,r],()=>o(Rx(e),([t,r])=>[t,r],()=>o(Sx(e),([t,r])=>[t,r],()=>o(Ox(e),([t,r])=>[t,r],()=>o(Mx(e),([t,r])=>[t,r],()=>o(Px(e),([t,r])=>[t,r],()=>[]))))))),([t,r])=>[t,r]),Mx=e=>o(o(u("(",e),([t,r])=>o(po(r),([n,a])=>o(u(")",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Rp(t),r]),Lu=e=>o(o(o(ao(e),([t,r])=>o(u("|",r),([n,a])=>o(Lu(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[t,r],()=>o(o(ao(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[]))),([t,r])=>[Sp(t),r]),ao=e=>o(o(Cx(e),([t,r])=>o(po(r),([n,a])=>[[t,n],a])),([t,r])=>[Op(t),r]),po=e=>o(o(Lu(e),([t,r])=>[t,r],()=>o(ao(e),([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),ms=e=>o(o(u("^",e),([t,r])=>o(po(r),([n,a])=>o(u("$",a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Pp(t),r]),qu=(e,t=[])=>o(o(R(e),([r,n])=>o(u(",",n),([a,i])=>[[r,a],i])),([r,n])=>qu(n,[...t,r]),()=>[t,e]),Ax=e=>o(o(qu(e),([t,r])=>o(o(o(R(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Cp(t),r]),ju=e=>o(o(o(u("extends",e),([t,r])=>o(Ax(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Mp(t),r]),Lx=e=>o(o(u("interface",e),([t,r])=>o(W(r),([n,a])=>o(oo(a),([i,m])=>o(ju(m),([c,l])=>o(so(l),([g,f])=>[[t,n,i,c,g],f]))))),([t,r])=>[Ap(t),r]),qx=e=>o(o(u("interface",e),([t,r])=>o(W(r),([n,a])=>o(ju(a),([i,m])=>o(so(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[Lp(t),r]),jx=e=>o(o(u("type",e),([t,r])=>o(W(r),([n,a])=>o(oo(a),([i,m])=>o(u("=",m),([c,l])=>o(R(l),([g,f])=>[[t,n,i,c,g],f]))))),([t,r])=>[qp(t),r]),Fx=e=>o(o(u("type",e),([t,r])=>o(W(r),([n,a])=>o(u("=",a),([i,m])=>o(R(m),([c,l])=>[[t,n,i,c],l])))),([t,r])=>[jp(t),r]),Dx=e=>o(o(o(u("export",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Fp(t),r]),Nx=e=>o(o(o(u(";",e),([t,r])=>o(u(`
|
|
10
10
|
`,r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(u(`
|
|
11
|
-
`,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]),wu=(e,t=[])=>o(o(io(e),([r,n])=>o(Tx(n),([a,s])=>[[r,a],s])),([r,n])=>wu(n,[...t,r]),()=>[t,e]),kx=e=>o(o(wu(e),([t,r])=>o(o(o(io(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Rp(t),r]),io=e=>o(o($x(e),([t,r])=>o(o(xx(r),([n,a])=>[n,a],()=>o(Ix(r),([n,a])=>[n,a],()=>o(bx(r),([n,a])=>[n,a],()=>o(vx(r),([n,a])=>[n,a],()=>[])))),([n,a])=>o(Qp(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Sp(t),r]),Ex=e=>o(o(io(e),([t,r])=>o(kx(r),([n,a])=>[[t,n],a])),([t,r])=>[Op(t),r]),Ru=e=>o(o(Ex(e),([t,r])=>[t,r],()=>o(Ry(e),([t,r])=>[t,r],()=>o(w(e),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]);function Su(e){let t=ro(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:H()}function Rx(e){return e.join("|")}function Sx(e){return e.slice(1,e.length-1)}function Ox(e,t,r){return yt(t,`${r}${e}`)}function Px(e,t){return yt(e,`${t}${Bi}`)}function Mx(e,t){return yt(e,`${t}${$n}`)}function Cx(e,t){return yt(e,`${t}${kn}`)}function Ax(e,t){return Fr(k([S("false"),S("true")]),e,t)}function qx(e,t){return yt(e,`${t}${En}`)}function Lx(e,t,r){return yt(t,`${r}${Sx(e)}`)}function jx(e,t,r){let n=Dr(e,{});return Fr(n,t,r)}function Fx(e,t,r){let n=ke(e);return Fr(n,t,r)}function Ou(e,t,r,n=[]){return i.ShiftLeft(e,(a,s)=>Ou(s,t,r,[...n,Fr(a,[],"")]),()=>yt(t,`${r}(${Rx(n)})`))}function Fr(e,t,r){return de(e)?Fx(e.enum,t,r):fe(e)?Mx(t,r):C(e)?Ox(e.const,t,r):ze(e)?Px(t,r):Re(e)?Ax(t,r):J(e)?Cx(t,r):ge(e)?qx(t,r):X(e)?Lx(e.pattern,t,r):Mu(e)?jx(e.parameters[0],t,r):h(e)?Ou(e.anyOf,t,r):wi}function yt(e,t){return i.ShiftLeft(e,(r,n)=>Fr(r,n,t),()=>t)}function Dx(e){return`^${yt(e,"")}$`}function Pu(e){let t=Dx(e);return Rn(t)}function Dr(e,t){return T(e)?p.Update(Pu(e),{},t):jn(e,t)}function Cu(e,t,r,n){let a=Ee(e,t,r);return Dr(a,n)}function jn(e,t={}){return y("TemplateLiteral",[e],t)}function Mu(e){return ee(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function Au(e){return Dr(e,{})}function Nx(e){let t=Su(e);return Au(t)}function qu(e,t={}){let r=i.IsString(e)?Nx(e):Au(e);return p.Update(r,{},t)}function X(e){return g(e,"TemplateLiteral")}var b={};kt(b,{ExtendsFalse:()=>$,ExtendsTrue:()=>f,ExtendsUnion:()=>so,IsExtendsFalse:()=>Gx,IsExtendsTrue:()=>ju,IsExtendsTrueLike:()=>rr,IsExtendsUnion:()=>Lu,Match:()=>G});function so(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Lu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsUnion")&&i.IsObject(e.inferred)}function f(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function ju(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function $(){return p.Create({"~kind":"ExtendsFalse"},{})}function Gx(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function rr(e){return Lu(e)||ju(e)}function G(e,t,r){return rr(e)?t(e.inferred):r()}function Ux(e,t,r,n){return G(O(e,r,n),a=>f(p.Assign(p.Assign(e,a),{[t]:r})),()=>$())}function Kx(e,t){return f(e)}function _x(e,t,r,n,a){return G(O(e,t,r),s=>G(O(s,t,n),m=>f(m),()=>$()),()=>G(O(e,t,a),s=>f(s),()=>$()))}function zx(e,t,r){let n=ke(r);return O(e,t,n)}function Fu(e,t,r){return i.ShiftLeft(r,(n,a)=>G(O(e,t,n),s=>Fu(s,t,a),()=>$()),()=>f(e))}function Bx(e,t,r){let n=xe(r);return O(e,t,n)}function Du(e,t,r){return i.ShiftLeft(r,(n,a)=>G(O(e,t,n),s=>f(s),()=>Du(e,t,a)),()=>$())}function A(e,t,r){return Y(r)?Kx(e,t):B(r)?_x(e,t,r.if,r.then,r.else):de(r)?zx(e,t,r.enum):W(r)?Ux(e,r.name,t,r.extends):R(r)?Fu(e,t,r.allOf):X(r)?Bx(e,t,r.pattern):h(r)?Du(e,t,r.anyOf):te(r)?f(e):$()}function Nu(e,t,r){return W(r)?A(e,t,r):Y(r)?f(e):te(r)?f(e):so(e)}function Vx(e,t){let r=Pt(e),n=Pt(t);return r&&n||!r&&n?!0:!(r&&!n)}function Gu(e,t,r,n){return K(n)?Vx(t,n)?O(e,r,n.items):$():A(e,t,n)}function Uu(e,t,r){return ze(r)?f(e):A(e,t,r)}function Ku(e,t,r){return Re(r)?f(e):A(e,t,r)}function Wx(e,t,r,n,a){let s=W(n)?t:n,m=W(n)?n:t,c=ce(t),l=ce(n);return!c&&l?$():G(O(e,s,m),I=>Nr(I,r,a),()=>$())}function Hx(e,t,r,n){return i.ShiftLeft(n,(a,s)=>Wx(e,t,r,a,s),()=>ce(t)?f(e):$())}function Yx(e,t,r){return i.ShiftLeft(t,(n,a)=>Hx(e,n,a,r),()=>f(e))}function Nr(e,t,r){return Yx(e,t,r)}function pa(e,t,r){return Be(r)?f(e):O(e,t,r)}function _u(e,t,r,n){return Y(n)?f(e):te(n)?f(e):re(n)?G(Nr(e,t,n.parameters),a=>pa(a,r,n.instanceType),()=>$()):$()}function zu(e,t,r,n,a){return G(O(e,t,a),()=>O(e,r,a),()=>O(e,n,a))}function Bu(e,t,r){let n=ke(t);return O(e,n,r)}function Vu(e,t,r,n){return Y(n)?f(e):te(n)?f(e):ne(n)?G(Nr(e,t,n.parameters),a=>pa(a,r,n.returnType),()=>$()):$()}function Wu(e,t,r){return fe(r)?f(e):J(r)?f(e):A(e,t,r)}function Hu(e,t,r){let n=_(t);return O(e,n,r)}function ua(e,t,r){return t===r?f(e):$()}function Jx(e,t,r){return C(r)?ua(e,t,r.const):ze(r)?f(e):A(e,S(t),r)}function Xx(e,t,r){return C(r)?ua(e,t,r.const):Re(r)?f(e):A(e,S(t),r)}function Zx(e,t,r){return C(r)?ua(e,t,r.const):J(r)?f(e):A(e,S(t),r)}function Qx(e,t,r){return C(r)?ua(e,t,r.const):ge(r)?f(e):A(e,S(t),r)}function Yu(e,t,r){return i.IsBigInt(t.const)?Jx(e,t.const,r):i.IsBoolean(t.const)?Xx(e,t.const,r):i.IsNumber(t.const)?Zx(e,t.const,r):i.IsString(t.const)?Qx(e,t.const,r):H()}function Ju(e,t,r){return W(r)?A(e,t,r):f(e)}function Xu(e,t,r){return Vt(r)?f(e):A(e,t,r)}function Zu(e,t,r){return J(r)?f(e):A(e,t,r)}function eI(e,t,r){return ce(t)?ce(r)?f(e):$():f(e)}function tI(e,t,r){return W(r)&&ut(r.extends)?$():G(O(e,t,r),n=>eI(n,t,r),()=>$())}function rI(e,t){return e.reduce((r,n)=>n in t?rr(t[n])?{...r,...t[n].inferred}:H():H(),{})}function nI(e,t,r){let n={};for(let m of i.Keys(r))n[m]=m in t?tI({},t[m],r[m]):ce(r[m])?W(r[m])?f(p.Assign(e,{[r[m].name]:r[m].extends})):f(e):$();let a=i.Values(n).every(m=>rr(m)),s=a?rI(i.Keys(n),n):{};return a?f(s):$()}function aI(e,t,r){let n=nI(e,t,r);return rr(n)?f(p.Assign(e,n.inferred)):$()}function oI(e,t,r){return aI(e,t,r)}function iI(e,t){return i.Keys(t).reduce((r,n)=>({...r,[n]:i.HasPropertyKey(e,n)?h(r[n])?k([...r[n].anyOf,t[n]]):k([e[n],t[n]]):t[n]}),e)}function Qu(e,t,r,n){return i.ShiftLeft(t,(a,s)=>G(O({},e[a],r),m=>Qu(e,s,r,iI(n,m)),()=>$()),()=>f(n))}function sI(e,t,r,n){let a=i.Keys(t);return Qu(t,a,n,e)}function ec(e,t,r){return pe(r)?sI(e,t,Pe(r),he(r)):M(r)?oI(e,t,r.properties):A(e,v(t),r)}function mI(e,t){return i.IsEqual(i.Keys(t).length,0)?f(e):$()}function pI(e,t,r,n,a){return O(e,r,a)}function tc(e,t,r,n){return pe(n)?pI(e,Cn(t),r,Cn(Pe(n)),he(n)):M(n)?mI(e,n.properties):Y(n)?f(e):te(n)?f(e):$()}function rc(e,t,r){return ge(r)?f(e):A(e,t,r)}function nc(e,t,r){return ct(r)?f(e):A(e,t,r)}function ac(e,t,r){let n=xe(t);return O(e,n,r)}function mo(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Gr(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"name")&&i.HasPropertyKey(e,"type")&&i.IsEqual(e["~kind"],"Inferrable")&&i.IsString(e.name)&&i.IsObject(e.type)}function po(e){return ft(e)?W(e.items)?K(e.items.extends)?mo(e.items.name,e.items.extends.items):te(e.items.extends)?mo(e.items.name,e.items.extends):void 0:H():void 0}function ca(e){return W(e)?mo(e.name,e.extends):void 0}function uo(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>G(O({},n,t),()=>uo(a,t,[...r,n]),()=>{}),()=>r)}function oc(e,t,r,n){let a=uo(r,n);return i.IsArray(a)?f(p.Assign(e,{[t]:Z(a)})):$()}function la(e,t,r,n){let a=uo(r,n);return i.IsArray(a)?f(p.Assign(e,{[t]:k(a)})):$()}function uI(e){return[...e].reverse()}function co(e,t){return t?uI(e):e}function cI(e){let t=e.length>0?e[0]:void 0,r=ee(t)?po(t):void 0;return ee(r)}function lI(e,t,r,n,a,s){return G(O(e,r,a),m=>ic(m,t,n,s),()=>$())}function dI(e,t,r,n,a){let s=po(n);return Gr(s)?oc(e,s.name,co(r,t),s.type):i.ShiftLeft(r,(m,c)=>lI(e,t,m,c,n,a),()=>$())}function fI(e,t,r,n){return i.ShiftLeft(n,(a,s)=>dI(e,t,r,a,s),()=>i.IsEqual(r.length,0)?f(e):$())}function ic(e,t,r,n){return fI(e,t,r,n)}function gI(e,t,r){let n=xt(e,N([],[]),r),a=cI(n);return ic(e,a,co(t,a),co(n,a))}function sc(e,t,r){let n=ca(r);return Gr(n)?la(e,n.name,t,n.type):i.ShiftLeft(t,(a,s)=>G(O(e,a,r),m=>sc(m,s,r),()=>$()),()=>f(e))}function mc(e,t,r){let n=xt(e,N([],[]),t);return L(r)?gI(e,n,r.items):K(r)?sc(e,n,r.items):A(e,Z(n),r)}function pc(e,t,r){return Be(r)?f(e):Zt(r)?f(e):A(e,t,r)}function uc(e,t,r){return i.ShiftLeft(r,(n,a)=>G(O(e,t,n),s=>f(s),()=>uc(e,t,a)),()=>$())}function lo(e,t,r){return i.ShiftLeft(t,(n,a)=>G(uc(e,n,r),s=>lo(s,a,r),()=>$()),()=>f(e))}function cc(e,t,r){let n=ca(r);return Gr(n)?la(e,n.name,t,n.type):h(r)?lo(e,t,r.anyOf):lo(e,t,[r])}function lc(e,t,r){return W(r)?A(e,t,r):Y(r)?f(e):te(r)?f(e):$()}function dc(e,t,r){return Be(r)?f(e):A(e,t,r)}function O(e,t,r){return Y(t)?Nu(e,t,r):K(t)?Gu(e,t,t.items,r):ze(t)?Uu(e,t,r):Re(t)?Ku(e,t,r):re(t)?_u(e,t.parameters,t.instanceType,r):B(t)?zu(e,t.if,t.then,t.else,r):de(t)?Bu(e,t.enum,r):ne(t)?Vu(e,t.parameters,t.returnType,r):fe(t)?Wu(e,t,r):R(t)?Hu(e,t.allOf,r):C(t)?Yu(e,t,r):ut(t)?Ju(e,t,r):Vt(t)?Xu(e,t,r):J(t)?Zu(e,t,r):M(t)?ec(e,t.properties,r):pe(t)?tc(e,Pe(t),he(t),r):ge(t)?rc(e,t,r):ct(t)?nc(e,t,r):X(t)?ac(e,t.pattern,r):L(t)?mc(e,t.items,r):Zt(t)?pc(e,t,r):h(t)?cc(e,t.anyOf,r):te(t)?lc(e,t,r):Be(t)?dc(e,t,r):$()}function hI(e,t){return _([...e,v(t)])}function fo(e,t,r){return T(e)?p.Update(hI(e,t),{},r):Cr(e,t,r)}function fc(e,t,r,n,a){let s=Ee(e,t,r),m=Ur(e,t,n);return fo(s,m,a)}function Cr(e,t,r={}){return y("Interface",[e,t],r)}function nr(e){return ee(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function gc(e,t,r={}){return fo(e,t,r)}function yI(e,t,r){return e.includes(r)?!0:Kr([...e,r],t,t[r])}function hc(e,t,r){let n=yn(r);return Ft(e,t,n)}function Ft(e,t,r){return i.ShiftLeft(r,(n,a)=>Kr(e,t,n)?!0:Ft(e,t,a),()=>!1)}function Kr(e,t,r){return ae(r)?yI(e,t,r.$ref):K(r)?Kr(e,t,r.items):re(r)?Ft(e,t,[...r.parameters,r.instanceType]):ne(r)?Ft(e,t,[...r.parameters,r.returnType]):nr(r)?hc(e,t,r.parameters[1]):R(r)?Ft(e,t,r.allOf):M(r)?hc(e,t,r.properties):h(r)?Ft(e,t,r.anyOf):L(r)?Ft(e,t,r.items):pe(r)?Kr(e,t,he(r)):!1}function yc(e,t,r){return Kr(e,t,r)}function xI(e,t){return t.reduce((r,n)=>yc([n],e,e[n])?[...r,n]:r,[])}function xc(e){let t=hn(e);return xI(e,t)}function II(e,t,r){return r.includes(t)?r:t in e?_r(e,e[t],[...r,t]):H()}function Ic(e,t,r){let n=yn(t);return ar(e,n,r)}function ar(e,t,r){return t.reduce((n,a)=>_r(e,a,n),r)}function _r(e,t,r){return ae(t)?II(e,t.$ref,r):K(t)?_r(e,t.items,r):re(t)?ar(e,[...t.parameters,t.instanceType],r):ne(t)?ar(e,[...t.parameters,t.returnType],r):nr(t)?Ic(e,t.parameters[1],r):R(t)?ar(e,t.allOf,r):M(t)?Ic(e,t.properties,r):h(t)?ar(e,t.anyOf,r):L(t)?ar(e,t.items,r):pe(t)?_r(e,he(t),r):r}function bc(e,t,r){return _r(e,r,[t])}function bI(e){return _t()}function vI(e){return i.Keys(e).reduce((t,r)=>({...t,[r]:Dt(e[r])}),{})}function zr(e){return e.reduce((t,r)=>[...t,Dt(r)],[])}function Dt(e){return ae(e)?bI(e.$ref):K(e)?Te(Dt(e.items),gn(e)):re(e)?De(zr(e.parameters),Dt(e.instanceType)):ne(e)?Ne(zr(e.parameters),Dt(e.returnType)):R(e)?le(zr(e.allOf)):M(e)?v(vI(e.properties)):pe(e)?Mn(Jt(e),Dt(he(e))):h(e)?k(zr(e.anyOf)):L(e)?Z(zr(e.items)):e}function $I(e,t){return t in e?Dt(e[t]):oe()}function vc(e){return $I(e.$defs,e.$ref)}function TI(e,t,r){let n=Ee(e,N([],[]),t),a=Ur({},N([],[]),r);return _([...n,v(a)])}function kI(e,t){return i.Keys(e).filter(n=>t.includes(n)).reduce((n,a)=>{let s=e[a],m=nr(s)?TI(e,s.parameters[0],s.parameters[1]):s;return{...n,[a]:m}},{})}function $c(e,t,r){let n=bc(e,t,r),a=kI(e,n);return Ue(a,t)}function Tc(e,t){return t in e?ae(e[t])?Tc(e,e[t].$ref):e[t]:q()}function Ve(e,t){return Tc(e,t)}function kc(e){return se(e)?vc(e):xn(e)?oe():e}function me(e,t,r){let n=kc(t),a=kc(r);return O(e,n,a)}var wr="equal",EI="disjoint",Rr="left-inside",Sr="right-inside";function Ht(e,t){let r=[te(e)?b.ExtendsFalse():me({},e,t),te(e)?b.ExtendsTrue({}):me({},t,e)];return b.IsExtendsTrueLike(r[0])&&b.IsExtendsTrueLike(r[1])?wr:b.IsExtendsTrueLike(r[0])&&b.IsExtendsFalse(r[1])?Rr:b.IsExtendsFalse(r[0])&&b.IsExtendsTrueLike(r[1])?Sr:EI}function wI(e,t){return t.filter(r=>Ht(e,r)!==Sr)}function RI(e,t){let r=t.some(n=>{let a=Ht(e,n);return i.IsEqual(a,Rr)||i.IsEqual(a,wr)});return i.IsEqual(r,!1)}function SI(e,t){let r=Oe(e);return Y(r)?[r]:RI(r,t)?[...wI(r,t),r]:t}function OI(e){return e.reduce((t,r)=>M(r)?[...t,r]:ut(r)?t:SI(r,t),[])}function Ba(e){let t=OI(e);return Pr(t)}function go(e,t){return p.Update(Oe(e),{},t)}function Ec(e,t,r,n){let a=d(e,t,r);return go(a,n)}function Br(e,t=[]){return mt(e)&&i.IsEqual(e.action,"Conditional")?ae(e.parameters[0])?Br(e.parameters[2],Br(e.parameters[3],[...t,e.parameters[0].$ref])):Br(e.parameters[2],Br(e.parameters[3],t)):mt(e)&&i.IsEqual(e.action,"Mapped")&&mt(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&ae(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function PI(e,t){return e.reduce((r,n)=>[...r,t.includes(n.name)],[])}function Sc(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>i.ShiftLeft(t,(s,m)=>Sc(a,m,[...r,[s,n]]),()=>r),()=>r)}function MI(e){return h(e)?[...e.anyOf]:[e]}function CI(e,t){return e.reduce((r,n)=>[...r,[...n,t]],[])}function wc(e,t){return t.reduce((r,n)=>[...r,...CI(e,n)],[])}function Rc(e){return e.reduce((t,r)=>i.IsEqual(r[0],!0)?wc(t,MI(r[1])):wc(t,[r[1]]),[[]])}function Oc(e,t,r){let n=Br(r),a=PI(e,n),s=Sc(t,a);return mt(r)&&i.IsEqual(r.action,"Conditional")||mt(r)&&i.IsEqual(r.action,"Mapped")?Rc(s):[t]}function AI(){return["(not-resolvable)",q()]}function qI(){return["(not-generic)",q()]}function LI(e,t,r){return[e,pt(t,r)]}function jI(e,t,r){return t in e?Pc(e,t,e[t],r):AI()}function Pc(e,t,r,n){return Kt(r)?LI(t,r.parameters,r.expression):ae(r)?jI(e,r.$ref,n):qI()}function Mc(e,t,r){return Pc(e,"(anonymous)",t,r)}function FI(e,t,r){if(W(t)||or(t)||b.IsExtendsTrueLike(me({},t,r)))return;let n={parameter:e,expect:r,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:n})}function Cc(e,t,r,n,a){let s=d(e,t,a);return FI(r,s,n),p.Assign(e,{[r]:s})}function DI(e,t,r,n,a){let s=d(e,t,r.extends),m=d(e,t,r.equals);return i.ShiftLeft(a,(c,l)=>ho(Cc(e,t,r.name,s,c),t,n,l),()=>ho(Cc(e,t,r.name,s,m),t,n,[]))}function ho(e,t,r,n){return i.ShiftLeft(r,(a,s)=>DI(e,t,a,s,n),()=>e)}function Ac(e,t,r,n){return ho(e,t,r,n)}function NI(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function GI(e,t){return i.IsEqual(NI(e),t)}function UI(e,t,r,n,a,s){let m=Ac(e,t,n,s),c=d(m,N([...t.callstack,r.$ref],t.visited),a);return d(m,N([],[]),c)}function KI(e,t,r,n,a,s){return s.reduce((m,c)=>[...m,UI(e,t,r,n,a,c)],[])}function _I(e,t,r,n,a,s){let m=Oc(n,s,a),c=KI(e,t,r,n,a,m);return i.IsEqual(c.length,1)?c[0]:ve(c)}function da(e,t,r,n){let a=Ee(e,t,n),s=Mc(e,r,n),m=s[0],c=s[1];return Kt(c)?GI(t,m)?Ar(et(m),a):_I(e,t,et(m),c.parameters,c.expression,a):Ar(r,a)}function Ar(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function qc(e,t){return da({},N([],[]),e,t)}function or(e){return g(e,"Call")}function zI(e){return p.Discard(e,["~immutable"])}function Lc(e,t){return p.Update(zI(e),{},t)}function jc(e,t,r,n){let a=d(e,t,r);return Lc(a,n)}function Fc(e,t){return e(t)}function Dc(e,t){return i.IsString(t)?S(Fc(e,t)):S(t)}function Nc(e,t){let r=xe(t);return nt(e,r)}function Gc(e,t){let r=t.map(n=>nt(e,n));return k(r)}function nt(e,t){return C(t)?Dc(e,t.const):X(t)?Nc(e,t.pattern):h(t)?Gc(e,t.anyOf):t}function Fn(e,t={}){return y("Capitalize",[e],t)}function Uc(e,t={}){return yo(e,t)}function Dn(e,t={}){return y("Lowercase",[e],t)}function Kc(e,t={}){return xo(e,t)}function Nn(e,t={}){return y("Uncapitalize",[e],t)}function _c(e,t={}){return Io(e,t)}function Gn(e,t={}){return y("Uppercase",[e],t)}function zc(e,t={}){return bo(e,t)}var BI=e=>e[0].toUpperCase()+e.slice(1),VI=e=>e.toLowerCase(),WI=e=>e[0].toLowerCase()+e.slice(1),HI=e=>e.toUpperCase();function yo(e,t){return T([e])?p.Update(nt(BI,e),{},t):Fn(e,t)}function xo(e,t){return T([e])?p.Update(nt(VI,e),{},t):Dn(e,t)}function Io(e,t){return T([e])?p.Update(nt(WI,e),{},t):Nn(e,t)}function bo(e,t){return T([e])?p.Update(nt(HI,e),{},t):Gn(e,t)}function Bc(e,t,r,n){let a=d(e,t,r);return yo(a,n)}function Vc(e,t,r,n){let a=d(e,t,r);return xo(a,n)}function Wc(e,t,r,n){let a=d(e,t,r);return Io(a,n)}function Hc(e,t,r,n){let a=d(e,t,r);return bo(a,n)}function Un(e,t,r,n,a={}){return y("Conditional",[e,t,r,n],a)}function Yc(e,t,r,n,a={}){return vo({},N([],[]),e,t,r,n,a)}function YI(e,t,r,n,a,s){let m=me(e,r,n);return b.IsExtendsUnion(m)?k([d(m.inferred,t,a),d(e,t,s)]):b.IsExtendsTrue(m)?d(m.inferred,t,a):d(e,t,s)}function vo(e,t,r,n,a,s,m){return T([r,n])?p.Update(YI(e,t,r,n,a,s),{},m):Un(r,n,a,s,m)}function Jc(e,t,r,n,a,s,m){let c=d(e,t,r),l=d(e,t,n);return vo(e,t,c,l,a,s,m)}function Kn(e,t={}){return y("ConstructorParameters",[e],t)}function Xc(e,t={}){return $o(e,t)}function JI(e){let t=re(e)?e.parameters:[],r=xt({},N([],[]),t);return Z(r)}function $o(e,t){return T([e])?p.Update(JI(e),{},t):Kn(e,t)}function Zc(e,t,r,n){let a=d(e,t,r);return $o(a,n)}function _n(e,t,r={}){return y("Exclude",[e,t],r)}function Qc(e,t,r={}){return Vr(e,t,r)}function Vr(e,t,r){return T([e,t])?p.Update(On(e,t),{},r):_n(e,t,r)}function el(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Vr(s,m,a)}function zn(e,t,r={}){return y("Extract",[e,t],r)}function tl(e,t,r={}){return To(e,t,r)}function XI(e,t){let r=me({},e,t);return b.IsExtendsTrueLike(r)?[e]:[]}function ZI(e,t){return e.reduce((r,n)=>[...r,...XI(n,t)],[])}function rl(e,t){let r=Oe(e),n=h(r)?r.anyOf:[r],a=ZI(n,t);return ve(a)}function To(e,t,r){return T([e,t])?p.Update(rl(e,t),{},r):zn(e,t,r)}function nl(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return To(s,m,a)}function QI(e){return e.reduce((t,r)=>Tn(r)?[...t,S(r)]:t,[])}function ir(e){let t=QI(e);return k(t)}function qr(e,t,r={}){return y("Index",[e,t],r)}function al(e,t,r={}){let n=i.IsArray(t)?ir(t):t;return ko(e,n,r)}function ol(e,t){let r=Ve(e,t);return we(r)}function il(e,t,r){let n=Le(e,t,r);return we(n)}function eb(e,t){let r=i.Keys(e).filter(x=>!i.HasPropertyKey(t,x)),n=i.Keys(t).filter(x=>!i.HasPropertyKey(e,x)),a=i.Keys(e).filter(x=>i.HasPropertyKey(t,x)),s=r.reduce((x,j)=>({...x,[j]:e[j]}),{}),m=n.reduce((x,j)=>({...x,[j]:t[j]}),{}),c=a.reduce((x,j)=>({...x,[j]:_([e[j],t[j]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function sl(e){return e.reduce((t,r)=>eb(t,we(r)),{})}function ml(e){let t=ds(Z(e));return we(t)}function tb(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:ve([e[s],t[s]])}),{})}function pl(e,t){return i.ShiftLeft(e,(r,n)=>pl(n,tb(t,we(r))),()=>t)}function ul(e){return i.ShiftLeft(e,(t,r)=>pl(r,we(t)),()=>H())}function we(e){return se(e)?ol(e.$defs,e.$ref):B(e)?il(e.if,e.then,e.else):R(e)?sl(e.allOf):h(e)?ul(e.anyOf):L(e)?ml(e.items):M(e)?e.properties:{}}function sr(e){let t=we(e);return v(t)}var rb=new RegExp("^(?:0|[1-9][0-9]*)$");function mr(e){let t=`${e}`;return rb.test(t)?parseInt(t):e}function nb(e){return S(mr(e))}function cl(e){return e.map(t=>ll(t))}function ll(e){return R(e)?le(cl(e.allOf)):h(e)?k(cl(e.anyOf)):C(e)?nb(e.const):e}function dl(e,t){let r=ll(t),n=me({},r,be());return b.IsExtendsTrueLike(n)?e:C(t)&&i.IsEqual(t.const,"length")?be():q()}function fl(e,t){let r=Ve(e,t);return $e(r)}function gl(e,t,r){let n=Le(e,t,r);return $e(n)}function hl(e){let t=ke(e);return $e(t)}function yl(e){let t=_(e);return $e(t)}function xl(e){return[`${e}`]}function Il(e){let t=xe(e);return $e(t)}function bl(e){return e.reduce((t,r)=>[...t,...$e(r)],[])}function $e(e){return se(e)?fl(e.$defs,e.$ref):B(e)?gl(e.if,e.then,e.else):de(e)?hl(e.enum):R(e)?yl(e.allOf):C(e)?xl(e.const):X(e)?Il(e.pattern):h(e)?bl(e.anyOf):[]}function pr(e){return $e(e)}function Wr(e,t){return t.map(r=>Hr(e,r))}function Hr(e,t){return K(t)?Te(Hr(e,t.items)):re(t)?De(Wr(e,t.parameters),Hr(e,t.instanceType)):ne(t)?Ne(Wr(e,t.parameters),Hr(e,t.returnType)):L(t)?Z(Wr(e,t.items)):h(t)?k(Wr(e,t.anyOf)):R(t)?le(Wr(e,t.allOf)):qn(t)?v(e):t}function vl(e,t){return Hr(e,t)}function ab(e,t){let r=t in e?e[t]:q();return vl(e,r)}function $l(e,t){return t.reduce((r,n)=>[...r,ab(e,n)],[])}function ob(e,t){let r=pr(t),n=$l(e,r);return ve(n)}var ib=new RegExp(dt);function sb(e){return e.filter(r=>ib.test(r))}function mb(e){let t=hn(e),r=sb(t),n=$l(e,r);return ve(n)}function Tl(e,t){return J(t)?mb(e):ob(e,t)}function pb(e){return S(mr(e))}function kl(e){return e.map(t=>Eo(t))}function Eo(e){return R(e)?le(kl(e.allOf)):h(e)?k(kl(e.anyOf)):C(e)?pb(e.const):e}function ub(e,t){return e.reduceRight((r,n,a)=>{let s=me({},S(a),t);return b.IsExtendsTrueLike(s)?[n,...r]:r},[])}function cb(e,t){let r=Eo(t),n=ub(e,r);return tt(n)}function lb(e){return tt(e)}function El(e,t){return C(t)&&i.IsEqual(t.const,"length")?S(e.length):J(t)||fe(t)?lb(e):cb(e,t)}function wl(e,t){return K(e)?dl(e.items,t):M(e)?Tl(e.properties,t):L(e)?El(e.items,t):q()}function db(e){return se(e)||B(e)||R(e)||h(e)?sr(e):e}function ko(e,t,r){return T([e,t])?p.Update(wl(db(e),t),{},r):qr(e,t,r)}function Rl(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return ko(s,m,a)}function Bn(e,t={}){return y("InstanceType",[e],t)}function Sl(e,t={}){return wo(e,t)}function fb(e){return re(e)?e.instanceType:q()}function wo(e,t){return T([e])?p.Update(fb(e),{},t):Bn(e,t)}function Ol(e,t,r,n={}){let a=d(e,t,r);return wo(a,n)}function Lr(e,t={}){return y("KeyOf",[e],t)}function Pl(e,t={}){return Ro(e,t)}function Ml(){return k([be(),Se(),Wt()])}function Cl(e){return be()}function gb(e){return e.reduce((r,n)=>Tn(n)?[...r,S(mr(n))]:H(),[])}function Al(e){let t=i.Keys(e),r=gb(t);return tt(r)}function ql(e){return Jt(e)}function Ll(e){let t=e.map((r,n)=>S(n));return tt(t)}function jl(e){return Y(e)?Ml():K(e)?Cl(e.items):M(e)?Al(e.properties):pe(e)?ql(e):L(e)?Ll(e.items):q()}function hb(e){return se(e)||B(e)||R(e)||h(e)?sr(e):e}function Ro(e,t){return T([e])?p.Update(jl(hb(e)),{},t):Lr(e,t)}function Fl(e,t,r,n){let a=d(e,t,r);return Ro(a,n)}function Mr(e,t,r,n,a={}){return y("Mapped",[e,t,r,n],a)}function Dl(e,t,r,n,a={}){return So({},N([],[]),e,t,r,n,a)}function yb(e){let t=xe(e);return fa(t)}function xb(e){return e.reduce((t,r)=>[...t,...fa(r)],[])}function Ib(e){let t=ke(e);return fa(t)}function bb(e){return i.IsNumber(e)?[S(`${e}`)]:[S(e)]}function fa(e){return de(e)?Ib(e.enum):C(e)?bb(e.const):X(e)?yb(e.pattern):h(e)?xb(e.anyOf):[e]}function Nl(e){return fa(e)}function vb(e){return X(e)?xe(e.pattern):e}function $b(e,t,r,n,a,s){let m=p.Assign(e,{[r.name]:n}),c=d(m,t,a),l=vb(c),I=d(m,t,s);return Wi(l)||Hi(l)?{[l.const]:I}:{}}function Tb(e,t,r,n,a,s){return n.reduce((m,c)=>[...m,$b(e,t,r,c,a,s)],[])}function kb(e){return e.reduce((t,r)=>[...t,v(r)],[])}function Gl(e,t,r,n,a,s){let m=Nl(n),c=Tb(e,t,r,m,a,s),l=kb(c);return _(l)}function So(e,t,r,n,a,s,m){return T([n])?p.Update(Gl(e,t,r,n,a,s),{},m):Mr(r,n,a,s,m)}function Ul(e,t,r,n,a,s,m){let c=d(e,t,n);return So(e,t,r,c,a,s,m)}function Eb(e,t,r){let n=p.Assign(e,t);return i.Keys(t).filter(s=>r.includes(s)).reduce((s,m)=>({...s,[m]:$c(n,m,t[m])}),{})}function wb(e,t,r){let n=p.Assign(e,t);return i.Keys(t).filter(s=>!r.includes(s)).reduce((s,m)=>({...s,[m]:d(n,N([],[]),t[m])}),{})}function Rb(e,t,r){let n=xc(t),a=Eb(e,t,n),s=wb(e,t,n),m={...a,...s};return p.Update(m,{},r)}function ga(e,t,r,n){return Rb(e,r,n)}function Vn(e,t={}){return y("NonNullable",[e],t)}function Kl(e,t={}){return Oo(e,t)}function Sb(e){let t=k([Bt(),Xt()]);return Vr(e,t,{})}function Oo(e,t){return T([e])?p.Update(Sb(e),{},t):Vn(e,t)}function _l(e,t,r,n){let a=d(e,t,r);return Oo(a,n)}function Wn(e,t,r={}){return y("Omit",[e,t],r)}function zl(e,t,r={}){let n=i.IsArray(t)?ir(t):t;return Po(e,n,r)}function ha(e){let t=sr(e);return M(t)?t.properties:H()}function Ob(e,t){return i.Keys(e).reduce((n,a)=>t.includes(a)?n:{...n,[a]:e[a]},{})}function Bl(e,t){let r=ha(e),n=pr(t),a=Ob(r,n);return v(a)}function Po(e,t,r){return T([e,t])?p.Update(Bl(e,t),{},r):Wn(e,t,r)}function Vl(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Po(s,m,a)}function Hn(e,t={}){return y("Parameters",[e],t)}function Wl(e,t={}){return Mo(e,t)}function Pb(e){let t=ne(e)?e.parameters:[],r=xt({},N([],[]),t);return Z(r)}function Mo(e,t){return T([e])?p.Update(Pb(e),{},t):Hn(e,t)}function Hl(e,t,r,n){let a=d(e,t,r);return Mo(a,n)}function Yn(e,t={}){return y("Partial",[e],t)}function Yl(e,t={}){return Co(e,t)}function Jl(e,t){let r=Ve(e,t),n=We(r);return Ue(p.Assign(e,{[t]:n}),t)}function Xl(e,t,r){let n=Le(e,t,r);return We(n)}function Zl(e){let t=_(e);return We(t)}function Ql(e){let t=e.map(r=>We(r));return k(t)}function ed(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:St(e[a])}),{});return v(t)}function We(e){return se(e)?Jl(e.$defs,e.$ref):B(e)?Xl(e.if,e.then,e.else):R(e)?Zl(e.allOf):h(e)?Ql(e.anyOf):M(e)?ed(e.properties):v({})}function Co(e,t){return T([e])?p.Update(We(e),{},t):Yn(e,t)}function td(e,t,r,n){let a=d(e,t,r);return Co(a,n)}function Jn(e,t,r={}){return y("Pick",[e,t],r)}function rd(e,t,r={}){let n=i.IsArray(t)?ir(t):t;return Ao(e,n,r)}function Mb(e,t){return i.Keys(e).reduce((n,a)=>t.includes(a)?p.Assign(n,{[a]:e[a]}):n,{})}function nd(e,t){let r=ha(e),n=pr(t),a=Mb(r,n);return v(a)}function Ao(e,t,r){return T([e,t])?p.Update(nd(e,t),{},r):Jn(e,t,r)}function ad(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Ao(s,m,a)}function Xn(e,t={}){return y("ReadonlyObject",[e],t)}function qo(e,t={}){return Lo(e,t)}var od=qo;function id(e){return zt(Te(e))}function sd(e,t){let r=Ve(e,t),n=He(r);return Ue(p.Assign(e,{[t]:n}),t)}function md(e,t,r){let n=Le(e,t,r);return He(n)}function pd(e){let t=_(e);return He(t)}function ud(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:Mt(e[a])}),{});return v(t)}function cd(e){return zt(Z(e))}function ld(e){let t=e.map(r=>He(r));return k(t)}function He(e){return K(e)?id(e.items):se(e)?sd(e.$defs,e.$ref):B(e)?md(e.if,e.then,e.else):R(e)?pd(e.allOf):M(e)?ud(e.properties):L(e)?cd(e.items):h(e)?ld(e.anyOf):e}function Lo(e,t){return T([e])?p.Update(He(e),{},t):Xn(e)}function dd(e,t,r,n){let a=d(e,t,r);return Lo(a,n)}function fd(e,t,r,n){return t.visited.includes(n)?r:n in e?d(e,N(t.callstack,[...t.visited,n]),e[n]):r}function gd(e,t){let r=Ve(e,t),n=Ye(r);return Ue(p.Assign(e,{[t]:n}),t)}function hd(e,t,r){let n=Le(e,t,r);return Ye(n)}function yd(e){let t=_(e);return Ye(t)}function xd(e){let t=e.map(r=>Ye(r));return k(t)}function Id(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:Sn(e[a])}),{});return v(t)}function Ye(e){return se(e)?gd(e.$defs,e.$ref):B(e)?hd(e.if,e.then,e.else):R(e)?yd(e.allOf):h(e)?xd(e.anyOf):M(e)?Id(e.properties):v({})}function Zn(e,t={}){return y("Required",[e],t)}function bd(e,t={}){return jo(e,t)}function jo(e,t){return T([e])?p.Update(Ye(e),{},t):Zn(e,t)}function vd(e,t,r,n){let a=d(e,t,r);return jo(a,n)}function Qn(e,t={}){return y("ReturnType",[e],t)}function $d(e,t={}){return Fo(e,t)}function Cb(e){return ne(e)?e.returnType:q()}function Fo(e,t){return T([e])?p.Update(Cb(e),{},t):Qn(e,t)}function Td(e,t,r,n={}){let a=d(e,t,r);return Fo(a,n)}function ea(e,t){return y("With",[e,t],{})}function kd(e,t){return Do(e,t)}function Do(e,t){return T([e])?p.Update(e,{},t):ea(e,t)}function Ed(e,t,r,n){let a=d(e,t,r);return Do(a,n)}function Ab(e){return ft(e)?L(e.items)?No(e.items.items):W(e.items)?[e]:ae(e.items)?[e]:[q()]:[e]}function No(e){return e.reduce((r,n)=>[...r,...Ab(n)],[])}function N(e,t){return{callstack:e,visited:t}}function T(e){return i.ShiftLeft(e,(t,r)=>ae(t)?!1:T(r),()=>!0)}function Ur(e,t,r){return i.Keys(r).reduce((n,a)=>({...n,[a]:d(e,t,r[a])}),{})}function xt(e,t,r){let n=Ee(e,t,r);return No(n)}function Ee(e,t,r){return r.map(n=>d(e,t,n))}function qb(e,t){let r=ce(e)?Ir(t,{}):t,n=Ct(e)?xr(r,{}):r;return Pt(e)?Yr(n,{}):n}function Lb(e,t,r,n,a){return i.IsEqual(r,"AddImmutable")?wd(e,t,n[0],a):i.IsEqual(r,"RemoveImmutable")?jc(e,t,n[0],a):i.IsEqual(r,"AddReadonly")?$i(e,t,n[0],a):i.IsEqual(r,"RemoveReadonly")?ms(e,t,n[0],a):i.IsEqual(r,"AddOptional")?Ti(e,t,n[0],a):i.IsEqual(r,"RemoveOptional")?cs(e,t,n[0],a):i.IsEqual(r,"Capitalize")?Bc(e,t,n[0],a):i.IsEqual(r,"Conditional")?Jc(e,t,n[0],n[1],n[2],n[3],a):i.IsEqual(r,"ConstructorParameters")?Zc(e,t,n[0],a):i.IsEqual(r,"Evaluate")?Ec(e,t,n[0],a):i.IsEqual(r,"Exclude")?el(e,t,n[0],n[1],a):i.IsEqual(r,"Extract")?nl(e,t,n[0],n[1],a):i.IsEqual(r,"Index")?Rl(e,t,n[0],n[1],a):i.IsEqual(r,"InstanceType")?Ol(e,t,n[0],a):i.IsEqual(r,"Interface")?fc(e,t,n[0],n[1],a):i.IsEqual(r,"KeyOf")?Fl(e,t,n[0],a):i.IsEqual(r,"Lowercase")?Vc(e,t,n[0],a):i.IsEqual(r,"Mapped")?Ul(e,t,n[0],n[1],n[2],n[3],a):i.IsEqual(r,"Module")?ga(e,t,n[0],a):i.IsEqual(r,"NonNullable")?_l(e,t,n[0],a):i.IsEqual(r,"Pick")?ad(e,t,n[0],n[1],a):i.IsEqual(r,"Parameters")?Hl(e,t,n[0],a):i.IsEqual(r,"Partial")?td(e,t,n[0],a):i.IsEqual(r,"Omit")?Vl(e,t,n[0],n[1],a):i.IsEqual(r,"ReadonlyObject")?dd(e,t,n[0],a):i.IsEqual(r,"Record")?Ss(e,t,n[0],n[1],a):i.IsEqual(r,"Required")?vd(e,t,n[0],a):i.IsEqual(r,"ReturnType")?Td(e,t,n[0],a):i.IsEqual(r,"TemplateLiteral")?Cu(e,t,n[0],a):i.IsEqual(r,"Uncapitalize")?Wc(e,t,n[0],a):i.IsEqual(r,"Uppercase")?Hc(e,t,n[0],a):i.IsEqual(r,"With")?Ed(e,t,n[0],n[1]):y(r,n,a)}function jb(e,t,r){let n=ae(r)?fd(e,t,r,r.$ref):K(r)?Te(d(e,t,r.items),gn(r)):or(r)?da(e,t,r.target,r.arguments):re(r)?De(Ee(e,t,r.parameters),d(e,t,r.instanceType),ki(r)):ne(r)?Ne(Ee(e,t,r.parameters),d(e,t,r.returnType),Ei(r)):B(r)?Ot(d(e,t,r.if),d(e,t,r.then),d(e,t,r.else),Mi(r)):R(r)?le(Ee(e,t,r.allOf),ji(r)):M(r)?v(Ur(e,t,r.properties),Oi(r)):pe(r)?Os(Pe(r),d(e,t,he(r))):ft(r)?Lt(d(e,t,r.items)):L(r)?Z(xt(e,t,r.items),ss(r)):h(r)?k(Ee(e,t,r.anyOf),Ji(r)):r;return qb(r,n)}function d(e,t,r){return mt(r)?Lb(e,t,r.action,r.parameters,r.options):jb(e,t,r)}function Go(e,t){return d(e,N([],[]),t)}function Fb(e){return p.Update(e,{"~immutable":!0},{})}function Yr(e,t){return p.Update(Fb(e),{},t)}function wd(e,t,r,n){let a=d(e,t,r);return Yr(a,n)}function Pp(e,t={}){return y("AddImmutable",[e],t)}function zt(e,t={}){return Yr(e,t)}function Mp(e,t={}){return y("Evaluate",[e],t)}function Rd(e,t={}){return go(e,t)}function Cp(e,t={}){return y("Module",[e],t)}function Sd(e,t={}){return ga({},N([],[]),e,t)}function Od(...e){let[t,r,n]=Ke.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=Ru(r),s=i.IsArray(a)&&i.IsEqual(a.length,2)?d(t,N([],[]),a[0]):q();return p.Update(s,{},n)}var D={};kt(D,{Any:()=>_t,Array:()=>Te,BigInt:()=>Tr,Boolean:()=>vn,Call:()=>qc,Capitalize:()=>Uc,Codec:()=>bn,Conditional:()=>Yc,Constructor:()=>De,ConstructorParameters:()=>Xc,Cyclic:()=>Ue,Decode:()=>Gi,DecodeBuilder:()=>$r,Dependent:()=>Ot,Encode:()=>Ui,EncodeBuilder:()=>vr,Enum:()=>Li,Evaluate:()=>Rd,Exclude:()=>Qc,Extends:()=>me,ExtendsResult:()=>b,Extract:()=>tl,Function:()=>Ne,Generic:()=>pt,Identifier:()=>kr,Immutable:()=>Ki,Index:()=>al,Infer:()=>br,InstanceType:()=>Sl,Instantiate:()=>Go,Integer:()=>At,Interface:()=>gc,Intersect:()=>le,IsAny:()=>Y,IsArray:()=>K,IsBigInt:()=>ze,IsBoolean:()=>Re,IsCall:()=>or,IsCodec:()=>In,IsConstructor:()=>re,IsCyclic:()=>se,IsDependent:()=>B,IsEnum:()=>de,IsEnumValue:()=>qi,IsFunction:()=>ne,IsGeneric:()=>Kt,IsIdentifier:()=>Vi,IsImmutable:()=>Pt,IsInfer:()=>W,IsInteger:()=>fe,IsIntersect:()=>R,IsKind:()=>g,IsLiteral:()=>C,IsNever:()=>ut,IsNull:()=>Vt,IsNumber:()=>J,IsObject:()=>M,IsOptional:()=>ce,IsParameter:()=>Yi,IsReadonly:()=>Ct,IsRecord:()=>pe,IsRef:()=>ae,IsRefine:()=>Na,IsRest:()=>ft,IsSchema:()=>ee,IsString:()=>ge,IsSymbol:()=>ct,IsTemplateLiteral:()=>X,IsThis:()=>qn,IsTuple:()=>L,IsUndefined:()=>Zt,IsUnion:()=>h,IsUnknown:()=>te,IsUnsafe:()=>xn,IsVoid:()=>Be,KeyOf:()=>Pl,Literal:()=>S,Lowercase:()=>Kc,Mapped:()=>Dl,Module:()=>Sd,Never:()=>q,NonNullable:()=>Kl,Null:()=>Bt,Number:()=>be,Object:()=>v,Omit:()=>zl,Optional:()=>Ri,Parameter:()=>qt,Parameters:()=>Wl,Partial:()=>Yl,Pick:()=>rd,Readonly:()=>_i,ReadonlyObject:()=>qo,ReadonlyType:()=>od,Record:()=>Mn,RecordKey:()=>Jt,RecordPattern:()=>Pe,RecordValue:()=>he,Ref:()=>et,Refine:()=>zi,Required:()=>bd,Rest:()=>Lt,ReturnType:()=>$d,Script:()=>Od,String:()=>Se,Symbol:()=>Wt,TemplateLiteral:()=>qu,This:()=>An,Tuple:()=>Z,Uncapitalize:()=>_c,Undefined:()=>Xt,Union:()=>k,Unknown:()=>oe,Unsafe:()=>Pi,Uppercase:()=>zc,Void:()=>Ln,With:()=>kd});var ur="submit_test_gap_candidates",Jr="submit_filtered_test_gaps",Xr="submit_solver_gaps",r4=D.Object({verdict:D.Union([D.Literal("PASS"),D.Literal("FAIL")],{description:"FAIL only for a genuine blocking issue (clear rubric violation, agent-fault-worthy gap, unfair/undiscoverable test requirement, or a real determinism/regression risk). Optional, minor, or stylistic points are NOT grounds for FAIL \u2014 put those in `notes` instead and use PASS."}),summary:D.String({description:"One short sentence summarizing the verdict."}),reasons:D.Array(D.String(),{description:"Specific BLOCKING justifications only, citing rubric item IDs and concrete evidence from the files you read. Required (non-empty) when verdict is FAIL. Use an empty array when verdict is PASS."}),notes:D.Array(D.String(),{description:"Non-blocking, optional/minor observations or suggested improvements \u2014 the kind of feedback a real reviewer leaves as 'Minor/optional' without failing the task. Include these regardless of verdict; use an empty array if you truly have none."})});var Db=D.Object({gaps:D.Array(D.Object({description:D.String({description:"The specific untested behavior or edge case, in plain terms. Prefix with POSITIVE: or NEGATIVE: to indicate whether this is a missing required-behavior test or a missing forbidden/wrong-behavior test."}),risk:D.String({description:"Concretely why a plausible-but-incorrect implementation could still pass every test in test.patch despite missing, misimplementing, or violating this behavior (including doing a forbidden thing because no test asserts it must not happen)."})}),{description:"Candidate behavioral test gaps (positive and negative) grounded in agent_prompt.md or clear existing repo behavior. Use an empty array if you found none \u2014 do not manufacture gaps just to report something."})});function Pd(e){return{name:ur,label:"Submit Candidate Test Gaps",description:"Submit your candidate list of behavioral test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished reading and analyzing the relevant files.",parameters:Db,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Recorded ${n.length} candidate gap(s)`}],details:void 0}}}}var Nb=D.Object({gaps:D.Array(D.Object({description:D.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:D.String({description:"Why this is genuinely grounded in agent_prompt.md or the repo, fair to test per the fairness methodology, and a real (non-duplicate) coverage hole in test.patch \u2014 for negative gaps, cite the prompt's prohibition/constraint and why no existing test catches the forbidden outcome."})}),{description:"The filtered, final list of confirmed test gaps. Use an empty array if none of the candidates survive strict scrutiny."})});function Md(e){return{name:Jr,label:"Submit Filtered Test Gaps",description:"Submit your final, strictly filtered list of confirmed test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have independently verified each candidate.",parameters:Nb,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Confirmed ${n.length} gap(s) after filtering`}],details:void 0}}}}var Gb=D.Object({gaps:D.Array(D.Object({description:D.String({description:"The specific behavioral gap: a way one or more solver's diff differs materially from what agent_prompt.md/solution.patch require, despite that solver passing `./test.sh new`."}),justification:D.String({description:"Why this is a genuine requirement from agent_prompt.md or solution.patch (cite the specific requirement/line) that the solver's diff misses, contradicts, or diverges from \u2014 and why the current tests fail to catch that divergence."}),evidence:D.String({description:"Which solver(s) (by index) exhibit this, and the specific part of their diff that grounds the gap."})}),{description:"Concrete, diff-grounded behavioral gaps \u2014 cases where a passing solver's materially different approach reveals that `test.sh new` under-specifies a real requirement. Use an empty array if the solvers converged on equivalent behavior; do not manufacture gaps just to report something."})});function Cd(e){return{name:Xr,label:"Submit Solver Gaps",description:"Submit your final list of behavioral gaps found by comparing the solver diffs against the real solution.patch. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished comparing every solver.",parameters:Gb,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Recorded ${n.length} solver gap(s)`}],details:void 0}}}}function Ad(e){return[e,"You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the task description given to a coding agent), `test.patch` (a unified diff adding the hidden tests that will grade that agent's solution), and `solution.patch` (a unified diff of one golden/reference solution).","Another specialized agent is searching the complementary direction in parallel \u2014 stay in your lane and do not duplicate its work."]}var qd=["Thoroughness \u2014 your job is high recall on genuine gaps only:","- Find every gap you can justify with concrete evidence. Do not stop after the first obvious ones \u2014 keep reading until you have systematically covered the prompt, `solution.patch`, and relevant repo context.","- After your first pass, run at least one deliberate second sweep (re-read `agent_prompt.md`, re-scan `solution.patch`, grep the repo) before submitting \u2014 but if that sweep still finds nothing, submit an empty list.","- Do not self-censor or merge distinct genuine gaps into one \u2014 the validator will prune. Never invent or pad the list to seem thorough; an empty array is correct when exhaustive analysis truly finds none.","- Hunt subtle gaps too: partial coverage (asserted once but not under other valid inputs), behaviors implied by repo convention, interaction effects, ordering/timing, and branches visible in `solution.patch` that no test forces.","- Include a candidate only when you can cite specific grounding and a concrete false-pass risk \u2014 not to meet a quota."],Uo=["Ground rules \u2014 do not overreach:","- Every gap must trace back to a specific requirement or sentence in `agent_prompt.md`, or to behavior that is unambiguous from the existing, visible repo. Do not invent requirements the prompt doesn't support.","- Do not propose gaps for things `agent_prompt.md` leaves intentionally open, or for implementation details/style the prompt doesn't mandate.","- Read `test.patch` carefully before deciding something is untested \u2014 do not propose a gap that an existing test already covers (even indirectly).","- Keep findings strictly behavioral and publicly observable: a user, caller, or documented public contract must be able to observe the required outcome. Do not report internal helper calls, private state, implementation structure, call order, file placement, or other incidental mechanics.","- Do not require DOM classes, DOM/data/test attributes, selectors, or exact string literals unless the prompt explicitly names them or they are an established, already-present public contract in the repository. Prefer a visible outcome or public API behavior that accepts equivalent implementations."];function Ld(e,t){let r=[...Ad("You are an exhaustive, research-minded POSITIVE test-coverage analyst for a coding-agent benchmark task. Your sole mandate is to surface EVERY genuine POSITIVE behavioral test gap \u2014 required behavior that `test.patch` never asserts but `agent_prompt.md` requires. Do NOT search for forbidden/wrong-behavior gaps; a separate negative-case agent handles those in parallel. Stay in your lane and search exhaustively before concluding there are none."),"","Your job: find real POSITIVE TEST GAPS. A positive gap is required or clearly-implied behavior from `agent_prompt.md` (and, where relevant, obvious existing repo conventions) that `test.patch` does NOT actually verify \u2014 such that a plausible implementation could skip or misimplement that required behavior and STILL pass every test in `test.patch` as written.","","Focus on required outcomes: happy paths, side effects, state changes, outputs, transitions, edge inputs where the prompt still expects correct handling, combined/interacting behaviors, and branches in `solution.patch` whose correct outcome is never forced by a test.","","Be systematic and exhaustive \u2014 work through ALL of the following passes:","1. Go through `agent_prompt.md` sentence by sentence. For every distinct required behavior, constraint, or implied rule, check which test(s) in `test.patch` exercise it and how thoroughly.","2. Go through `solution.patch` branch by branch \u2014 every conditional, loop, early return, error path, and state transition. For each one, ask whether `test.patch` forces the correct outcome to be checked.","3. Consider standard positive edge-case categories: boundary/limit values, empty/missing/null/zero inputs that should still produce the required correct behavior, duplicate or repeated inputs handled correctly, ordering and interleaving, concurrent or repeated invocations, error/failure/rollback paths that should recover correctly, interaction between two or more required behaviors at once, and state left behind after an operation.","4. Cross-check overlapping/interacting requirements \u2014 behaviors each tested alone but never tested together.","5. Second-pass sweep: return to any requirement you marked 'covered' and ask whether coverage is shallow \u2014 one happy-path assertion is not enough if other valid inputs, sequences, or combinations could still slip through.",...qd,"Do not filter yourself or self-censor for volume. A separate validator will strictly filter afterward \u2014 your job is recall on POSITIVE gaps only.","",...Uo,"","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",e];return t&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),r.push("","For each gap, prefix the description with `POSITIVE:` and explain: (1) the specific untested required behavior/edge case, and (2) concretely why a plausible-but-incomplete implementation would still pass every given test despite missing or misimplementing it.",`When you are done \u2014 after completing ALL the passes above and a deliberate second sweep \u2014 call the \`${ur}\` tool exactly once with your full candidate list (empty only if, after genuinely exhaustive analysis, none exist). That tool call is your only way to report a result.`),r.join(`
|
|
12
|
-
`)}function
|
|
13
|
-
`)}function
|
|
14
|
-
`)}function
|
|
15
|
-
`)}function
|
|
16
|
-
`)}var
|
|
11
|
+
`,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]),Fu=(e,t=[])=>o(o(uo(e),([r,n])=>o(Nx(n),([a,i])=>[[r,a],i])),([r,n])=>Fu(n,[...t,r]),()=>[t,e]),Gx=e=>o(o(Fu(e),([t,r])=>o(o(o(uo(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Dp(t),r]),uo=e=>o(o(Dx(e),([t,r])=>o(o(Lx(r),([n,a])=>[n,a],()=>o(qx(r),([n,a])=>[n,a],()=>o(jx(r),([n,a])=>[n,a],()=>o(Fx(r),([n,a])=>[n,a],()=>[])))),([n,a])=>o(uu(a),([i,m])=>[[t,n,i],m]))),([t,r])=>[Np(t),r]),Ux=e=>o(o(uo(e),([t,r])=>o(Gx(r),([n,a])=>[[t,n],a])),([t,r])=>[Gp(t),r]),Du=e=>o(o(Ux(e),([t,r])=>[t,r],()=>o(_y(e),([t,r])=>[t,r],()=>o(R(e),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]);function Nu(e){let t=io(`\`${e}\``);return s.IsEqual(t.length,2)?t[0]:Y()}function _x(e){return e.join("|")}function zx(e){return e.slice(1,e.length-1)}function Bx(e,t,r){return $t(t,`${r}${e}`)}function Vx(e,t){return $t(e,`${t}${rs}`)}function Wx(e,t){return $t(e,`${t}${En}`)}function Hx(e,t){return $t(e,`${t}${Sn}`)}function Yx(e,t){return Kr(k([O("false"),O("true")]),e,t)}function Jx(e,t){return $t(e,`${t}${On}`)}function Xx(e,t,r){return $t(t,`${r}${zx(e)}`)}function Zx(e,t,r){let n=_r(e,{});return Kr(n,t,r)}function Qx(e,t,r){let n=ke(e);return Kr(n,t,r)}function Gu(e,t,r,n=[]){return s.ShiftLeft(e,(a,i)=>Gu(i,t,r,[...n,Kr(a,[],"")]),()=>$t(t,`${r}(${_x(n)})`))}function Kr(e,t,r){return fe(e)?Qx(e.enum,t,r):ge(e)?Wx(t,r):A(e)?Bx(e.const,t,r):Ve(e)?Vx(t,r):Se(e)?Yx(t,r):X(e)?Hx(t,r):he(e)?Jx(t,r):Z(e)?Xx(e.pattern,t,r):Ku(e)?Zx(e.parameters[0],t,r):x(e)?Gu(e.anyOf,t,r):Fi}function $t(e,t){return s.ShiftLeft(e,(r,n)=>Kr(r,n,t),()=>t)}function eI(e){return`^${$t(e,"")}$`}function Uu(e){let t=eI(e);return Cn(t)}function _r(e,t){return T(e)?p.Update(Uu(e),{},t):Gn(e,t)}function _u(e,t,r,n){let a=we(e,t,r);return _r(a,n)}function Gn(e,t={}){return I("TemplateLiteral",[e],t)}function Ku(e){return ee(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function zu(e){return _r(e,{})}function tI(e){let t=Nu(e);return zu(t)}function Bu(e,t={}){let r=s.IsString(e)?tI(e):zu(e);return p.Update(r,{},t)}function Z(e){return y(e,"TemplateLiteral")}var b={};Et(b,{ExtendsFalse:()=>$,ExtendsTrue:()=>h,ExtendsUnion:()=>co,IsExtendsFalse:()=>rI,IsExtendsTrue:()=>Wu,IsExtendsTrueLike:()=>ir,IsExtendsUnion:()=>Vu,Match:()=>U});function co(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Vu(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsUnion")&&s.IsObject(e.inferred)}function h(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function Wu(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsTrue")&&s.IsObject(e.inferred)}function $(){return p.Create({"~kind":"ExtendsFalse"},{})}function rI(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function ir(e){return Vu(e)||Wu(e)}function U(e,t,r){return ir(e)?t(e.inferred):r()}function nI(e,t,r,n){return U(P(e,r,n),a=>h(p.Assign(p.Assign(e,a),{[t]:r})),()=>$())}function aI(e,t){return h(e)}function oI(e,t,r,n,a){return U(P(e,t,r),i=>U(P(i,t,n),m=>h(m),()=>$()),()=>U(P(e,t,a),i=>h(i),()=>$()))}function iI(e,t,r){let n=ke(r);return P(e,t,n)}function Hu(e,t,r){return s.ShiftLeft(r,(n,a)=>U(P(e,t,n),i=>Hu(i,t,a),()=>$()),()=>h(e))}function sI(e,t,r){let n=Ie(r);return P(e,t,n)}function Yu(e,t,r){return s.ShiftLeft(r,(n,a)=>U(P(e,t,n),i=>h(i),()=>Yu(e,t,a)),()=>$())}function L(e,t,r){return J(r)?aI(e,t):V(r)?oI(e,t,r.if,r.then,r.else):fe(r)?iI(e,t,r.enum):H(r)?nI(e,r.name,t,r.extends):S(r)?Hu(e,t,r.allOf):Z(r)?sI(e,t,r.pattern):x(r)?Yu(e,t,r.anyOf):te(r)?h(e):$()}function Ju(e,t,r){return H(r)?L(e,t,r):J(r)?h(e):te(r)?h(e):co(e)}function mI(e,t){let r=Mt(e),n=Mt(t);return r&&n||!r&&n?!0:!(r&&!n)}function Xu(e,t,r,n){return K(n)?mI(t,n)?P(e,r,n.items):$():L(e,t,n)}function Zu(e,t,r){return Ve(r)?h(e):L(e,t,r)}function Qu(e,t,r){return Se(r)?h(e):L(e,t,r)}function pI(e,t,r,n,a){let i=H(n)?t:n,m=H(n)?n:t,c=le(t),l=le(n);return!c&&l?$():U(P(e,i,m),g=>zr(g,r,a),()=>$())}function uI(e,t,r,n){return s.ShiftLeft(n,(a,i)=>pI(e,t,r,a,i),()=>le(t)?h(e):$())}function cI(e,t,r){return s.ShiftLeft(t,(n,a)=>uI(e,n,a,r),()=>h(e))}function zr(e,t,r){return cI(e,t,r)}function da(e,t,r){return We(r)?h(e):P(e,t,r)}function ec(e,t,r,n){return J(n)?h(e):te(n)?h(e):re(n)?U(zr(e,t,n.parameters),a=>da(a,r,n.instanceType),()=>$()):$()}function tc(e,t,r,n,a){return U(P(e,t,a),()=>P(e,r,a),()=>P(e,n,a))}function rc(e,t,r){let n=ke(t);return P(e,n,r)}function nc(e,t,r,n){return J(n)?h(e):te(n)?h(e):ne(n)?U(zr(e,t,n.parameters),a=>da(a,r,n.returnType),()=>$()):$()}function ac(e,t,r){return ge(r)?h(e):X(r)?h(e):L(e,t,r)}function oc(e,t,r){let n=z(t);return P(e,n,r)}function fa(e,t,r){return t===r?h(e):$()}function lI(e,t,r){return A(r)?fa(e,t,r.const):Ve(r)?h(e):L(e,O(t),r)}function dI(e,t,r){return A(r)?fa(e,t,r.const):Se(r)?h(e):L(e,O(t),r)}function fI(e,t,r){return A(r)?fa(e,t,r.const):X(r)?h(e):L(e,O(t),r)}function gI(e,t,r){return A(r)?fa(e,t,r.const):he(r)?h(e):L(e,O(t),r)}function ic(e,t,r){return s.IsBigInt(t.const)?lI(e,t.const,r):s.IsBoolean(t.const)?dI(e,t.const,r):s.IsNumber(t.const)?fI(e,t.const,r):s.IsString(t.const)?gI(e,t.const,r):Y()}function sc(e,t,r){return H(r)?L(e,t,r):h(e)}function mc(e,t,r){return Jt(r)?h(e):L(e,t,r)}function pc(e,t,r){return X(r)?h(e):L(e,t,r)}function hI(e,t,r){return le(t)?le(r)?h(e):$():h(e)}function yI(e,t,r){return H(r)&>(r.extends)?$():U(P(e,t,r),n=>hI(n,t,r),()=>$())}function xI(e,t){return e.reduce((r,n)=>n in t?ir(t[n])?{...r,...t[n].inferred}:Y():Y(),{})}function II(e,t,r){let n={};for(let m of s.Keys(r))n[m]=m in t?yI({},t[m],r[m]):le(r[m])?H(r[m])?h(p.Assign(e,{[r[m].name]:r[m].extends})):h(e):$();let a=s.Values(n).every(m=>ir(m)),i=a?xI(s.Keys(n),n):{};return a?h(i):$()}function bI(e,t,r){let n=II(e,t,r);return ir(n)?h(p.Assign(e,n.inferred)):$()}function vI(e,t,r){return bI(e,t,r)}function $I(e,t){return s.Keys(t).reduce((r,n)=>({...r,[n]:s.HasPropertyKey(e,n)?x(r[n])?k([...r[n].anyOf,t[n]]):k([e[n],t[n]]):t[n]}),e)}function uc(e,t,r,n){return s.ShiftLeft(t,(a,i)=>U(P({},e[a],r),m=>uc(e,i,r,$I(n,m)),()=>$()),()=>h(n))}function TI(e,t,r,n){let a=s.Keys(t);return uc(t,a,n,e)}function cc(e,t,r){return pe(r)?TI(e,t,Ce(r),ye(r)):M(r)?vI(e,t,r.properties):L(e,v(t),r)}function kI(e,t){return s.IsEqual(s.Keys(t).length,0)?h(e):$()}function wI(e,t,r,n,a){return P(e,r,a)}function lc(e,t,r,n){return pe(n)?wI(e,jn(t),r,jn(Ce(n)),ye(n)):M(n)?kI(e,n.properties):J(n)?h(e):te(n)?h(e):$()}function dc(e,t,r){return he(r)?h(e):L(e,t,r)}function fc(e,t,r){return ht(r)?h(e):L(e,t,r)}function gc(e,t,r){let n=Ie(t);return P(e,n,r)}function lo(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Br(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"name")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"Inferrable")&&s.IsString(e.name)&&s.IsObject(e.type)}function fo(e){return It(e)?H(e.items)?K(e.items.extends)?lo(e.items.name,e.items.extends.items):te(e.items.extends)?lo(e.items.name,e.items.extends):void 0:Y():void 0}function ga(e){return H(e)?lo(e.name,e.extends):void 0}function go(e,t,r=[]){return s.ShiftLeft(e,(n,a)=>U(P({},n,t),()=>go(a,t,[...r,n]),()=>{}),()=>r)}function hc(e,t,r,n){let a=go(r,n);return s.IsArray(a)?h(p.Assign(e,{[t]:Q(a)})):$()}function ha(e,t,r,n){let a=go(r,n);return s.IsArray(a)?h(p.Assign(e,{[t]:k(a)})):$()}function EI(e){return[...e].reverse()}function ho(e,t){return t?EI(e):e}function RI(e){let t=e.length>0?e[0]:void 0,r=ee(t)?fo(t):void 0;return ee(r)}function SI(e,t,r,n,a,i){return U(P(e,r,a),m=>yc(m,t,n,i),()=>$())}function OI(e,t,r,n,a){let i=fo(n);return Br(i)?hc(e,i.name,ho(r,t),i.type):s.ShiftLeft(r,(m,c)=>SI(e,t,m,c,n,a),()=>$())}function PI(e,t,r,n){return s.ShiftLeft(n,(a,i)=>OI(e,t,r,a,i),()=>s.IsEqual(r.length,0)?h(e):$())}function yc(e,t,r,n){return PI(e,t,r,n)}function CI(e,t,r){let n=Tt(e,G([],[]),r),a=RI(n);return yc(e,a,ho(t,a),ho(n,a))}function xc(e,t,r){let n=ga(r);return Br(n)?ha(e,n.name,t,n.type):s.ShiftLeft(t,(a,i)=>U(P(e,a,r),m=>xc(m,i,r),()=>$()),()=>h(e))}function Ic(e,t,r){let n=Tt(e,G([],[]),t);return j(r)?CI(e,n,r.items):K(r)?xc(e,n,r.items):L(e,Q(n),r)}function bc(e,t,r){return We(r)?h(e):rr(r)?h(e):L(e,t,r)}function vc(e,t,r){return s.ShiftLeft(r,(n,a)=>U(P(e,t,n),i=>h(i),()=>vc(e,t,a)),()=>$())}function yo(e,t,r){return s.ShiftLeft(t,(n,a)=>U(vc(e,n,r),i=>yo(i,a,r),()=>$()),()=>h(e))}function $c(e,t,r){let n=ga(r);return Br(n)?ha(e,n.name,t,n.type):x(r)?yo(e,t,r.anyOf):yo(e,t,[r])}function Tc(e,t,r){return H(r)?L(e,t,r):J(r)?h(e):te(r)?h(e):$()}function kc(e,t,r){return We(r)?h(e):L(e,t,r)}function P(e,t,r){return J(t)?Ju(e,t,r):K(t)?Xu(e,t,t.items,r):Ve(t)?Zu(e,t,r):Se(t)?Qu(e,t,r):re(t)?ec(e,t.parameters,t.instanceType,r):V(t)?tc(e,t.if,t.then,t.else,r):fe(t)?rc(e,t.enum,r):ne(t)?nc(e,t.parameters,t.returnType,r):ge(t)?ac(e,t,r):S(t)?oc(e,t.allOf,r):A(t)?ic(e,t,r):gt(t)?sc(e,t,r):Jt(t)?mc(e,t,r):X(t)?pc(e,t,r):M(t)?cc(e,t.properties,r):pe(t)?lc(e,Ce(t),ye(t),r):he(t)?dc(e,t,r):ht(t)?fc(e,t,r):Z(t)?gc(e,t.pattern,r):j(t)?Ic(e,t.items,r):rr(t)?bc(e,t,r):x(t)?$c(e,t.anyOf,r):te(t)?Tc(e,t,r):We(t)?kc(e,t,r):$()}function MI(e,t){return z([...e,v(t)])}function xo(e,t,r){return T(e)?p.Update(MI(e,t),{},r):Fr(e,t,r)}function wc(e,t,r,n,a){let i=we(e,t,r),m=Vr(e,t,n);return xo(i,m,a)}function Fr(e,t,r={}){return I("Interface",[e,t],r)}function sr(e){return ee(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function Ec(e,t,r={}){return xo(e,t,r)}function AI(e,t,r){return e.includes(r)?!0:Wr([...e,r],t,t[r])}function Rc(e,t,r){let n=vn(r);return Nt(e,t,n)}function Nt(e,t,r){return s.ShiftLeft(r,(n,a)=>Wr(e,t,n)?!0:Nt(e,t,a),()=>!1)}function Wr(e,t,r){return ae(r)?AI(e,t,r.$ref):K(r)?Wr(e,t,r.items):re(r)?Nt(e,t,[...r.parameters,r.instanceType]):ne(r)?Nt(e,t,[...r.parameters,r.returnType]):sr(r)?Rc(e,t,r.parameters[1]):S(r)?Nt(e,t,r.allOf):M(r)?Rc(e,t,r.properties):x(r)?Nt(e,t,r.anyOf):j(r)?Nt(e,t,r.items):pe(r)?Wr(e,t,ye(r)):!1}function Sc(e,t,r){return Wr(e,t,r)}function LI(e,t){return t.reduce((r,n)=>Sc([n],e,e[n])?[...r,n]:r,[])}function Oc(e){let t=bn(e);return LI(e,t)}function qI(e,t,r){return r.includes(t)?r:t in e?Hr(e,e[t],[...r,t]):Y()}function Pc(e,t,r){let n=vn(t);return mr(e,n,r)}function mr(e,t,r){return t.reduce((n,a)=>Hr(e,a,n),r)}function Hr(e,t,r){return ae(t)?qI(e,t.$ref,r):K(t)?Hr(e,t.items,r):re(t)?mr(e,[...t.parameters,t.instanceType],r):ne(t)?mr(e,[...t.parameters,t.returnType],r):sr(t)?Pc(e,t.parameters[1],r):S(t)?mr(e,t.allOf,r):M(t)?Pc(e,t.properties,r):x(t)?mr(e,t.anyOf,r):j(t)?mr(e,t.items,r):pe(t)?Hr(e,ye(t),r):r}function Cc(e,t,r){return Hr(e,r,[t])}function jI(e){return Wt()}function FI(e){return s.Keys(e).reduce((t,r)=>({...t,[r]:Gt(e[r])}),{})}function Yr(e){return e.reduce((t,r)=>[...t,Gt(r)],[])}function Gt(e){return ae(e)?jI(e.$ref):K(e)?Te(Gt(e.items),In(e)):re(e)?Ge(Yr(e.parameters),Gt(e.instanceType)):ne(e)?Ue(Yr(e.parameters),Gt(e.returnType)):S(e)?de(Yr(e.allOf)):M(e)?v(FI(e.properties)):pe(e)?qn(er(e),Gt(ye(e))):x(e)?k(Yr(e.anyOf)):j(e)?Q(Yr(e.items)):e}function DI(e,t){return t in e?Gt(e[t]):oe()}function Mc(e){return DI(e.$defs,e.$ref)}function NI(e,t,r){let n=we(e,G([],[]),t),a=Vr({},G([],[]),r);return z([...n,v(a)])}function GI(e,t){return s.Keys(e).filter(n=>t.includes(n)).reduce((n,a)=>{let i=e[a],m=sr(i)?NI(e,i.parameters[0],i.parameters[1]):i;return{...n,[a]:m}},{})}function Ac(e,t,r){let n=Cc(e,t,r),a=GI(e,n);return _e(a,t)}function Lc(e,t){return t in e?ae(e[t])?Lc(e,e[t].$ref):e[t]:q()}function He(e,t){return Lc(e,t)}function qc(e){return se(e)?Mc(e):$n(e)?oe():e}function me(e,t,r){let n=qc(t),a=qc(r);return P(e,n,a)}var Cr="equal",UI="disjoint",Mr="left-inside",Ar="right-inside";function Zt(e,t){let r=[te(e)?b.ExtendsFalse():me({},e,t),te(e)?b.ExtendsTrue({}):me({},t,e)];return b.IsExtendsTrueLike(r[0])&&b.IsExtendsTrueLike(r[1])?Cr:b.IsExtendsTrueLike(r[0])&&b.IsExtendsFalse(r[1])?Mr:b.IsExtendsFalse(r[0])&&b.IsExtendsTrueLike(r[1])?Ar:UI}function KI(e,t){return t.filter(r=>Zt(e,r)!==Ar)}function _I(e,t){let r=t.some(n=>{let a=Zt(e,n);return s.IsEqual(a,Mr)||s.IsEqual(a,Cr)});return s.IsEqual(r,!1)}function zI(e,t){let r=Pe(e);return J(r)?[r]:_I(r,t)?[...KI(r,t),r]:t}function BI(e){return e.reduce((t,r)=>M(r)?[...t,r]:gt(r)?t:zI(r,t),[])}function Ya(e){let t=BI(e);return qr(t)}function Io(e,t){return p.Update(Pe(e),{},t)}function jc(e,t,r,n){let a=d(e,t,r);return Io(a,n)}function Jr(e,t=[]){return dt(e)&&s.IsEqual(e.action,"Conditional")?ae(e.parameters[0])?Jr(e.parameters[2],Jr(e.parameters[3],[...t,e.parameters[0].$ref])):Jr(e.parameters[2],Jr(e.parameters[3],t)):dt(e)&&s.IsEqual(e.action,"Mapped")&&dt(e.parameters[1])&&s.IsEqual(e.parameters[1].action,"KeyOf")&&ae(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function VI(e,t){return e.reduce((r,n)=>[...r,t.includes(n.name)],[])}function Nc(e,t,r=[]){return s.ShiftLeft(e,(n,a)=>s.ShiftLeft(t,(i,m)=>Nc(a,m,[...r,[i,n]]),()=>r),()=>r)}function WI(e){return x(e)?[...e.anyOf]:[e]}function HI(e,t){return e.reduce((r,n)=>[...r,[...n,t]],[])}function Fc(e,t){return t.reduce((r,n)=>[...r,...HI(e,n)],[])}function Dc(e){return e.reduce((t,r)=>s.IsEqual(r[0],!0)?Fc(t,WI(r[1])):Fc(t,[r[1]]),[[]])}function Gc(e,t,r){let n=Jr(r),a=VI(e,n),i=Nc(t,a);return dt(r)&&s.IsEqual(r.action,"Conditional")||dt(r)&&s.IsEqual(r.action,"Mapped")?Dc(i):[t]}function YI(){return["(not-resolvable)",q()]}function JI(){return["(not-generic)",q()]}function XI(e,t,r){return[e,ft(t,r)]}function ZI(e,t,r){return t in e?Uc(e,t,e[t],r):YI()}function Uc(e,t,r,n){return Vt(r)?XI(t,r.parameters,r.expression):ae(r)?ZI(e,r.$ref,n):JI()}function Kc(e,t,r){return Uc(e,"(anonymous)",t,r)}function QI(e,t,r){if(H(t)||pr(t)||b.IsExtendsTrueLike(me({},t,r)))return;let n={parameter:e,expect:r,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:n})}function _c(e,t,r,n,a){let i=d(e,t,a);return QI(r,i,n),p.Assign(e,{[r]:i})}function eb(e,t,r,n,a){let i=d(e,t,r.extends),m=d(e,t,r.equals);return s.ShiftLeft(a,(c,l)=>bo(_c(e,t,r.name,i,c),t,n,l),()=>bo(_c(e,t,r.name,i,m),t,n,[]))}function bo(e,t,r,n){return s.ShiftLeft(r,(a,i)=>eb(e,t,a,i,n),()=>e)}function zc(e,t,r,n){return bo(e,t,r,n)}function tb(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function rb(e,t){return s.IsEqual(tb(e),t)}function nb(e,t,r,n,a,i){let m=zc(e,t,n,i),c=d(m,G([...t.callstack,r.$ref],t.visited),a);return d(m,G([],[]),c)}function ab(e,t,r,n,a,i){return i.reduce((m,c)=>[...m,nb(e,t,r,n,a,c)],[])}function ob(e,t,r,n,a,i){let m=Gc(n,i,a),c=ab(e,t,r,n,a,m);return s.IsEqual(c.length,1)?c[0]:ve(c)}function ya(e,t,r,n){let a=we(e,t,n),i=Kc(e,r,n),m=i[0],c=i[1];return Vt(c)?rb(t,m)?Dr(at(m),a):ob(e,t,at(m),c.parameters,c.expression,a):Dr(r,a)}function Dr(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Bc(e,t){return ya({},G([],[]),e,t)}function pr(e){return y(e,"Call")}function ib(e){return p.Discard(e,["~immutable"])}function Vc(e,t){return p.Update(ib(e),{},t)}function Wc(e,t,r,n){let a=d(e,t,r);return Vc(a,n)}function Hc(e,t){return e(t)}function Yc(e,t){return s.IsString(t)?O(Hc(e,t)):O(t)}function Jc(e,t){let r=Ie(t);return st(e,r)}function Xc(e,t){let r=t.map(n=>st(e,n));return k(r)}function st(e,t){return A(t)?Yc(e,t.const):Z(t)?Jc(e,t.pattern):x(t)?Xc(e,t.anyOf):t}function Un(e,t={}){return I("Capitalize",[e],t)}function Zc(e,t={}){return vo(e,t)}function Kn(e,t={}){return I("Lowercase",[e],t)}function Qc(e,t={}){return $o(e,t)}function _n(e,t={}){return I("Uncapitalize",[e],t)}function el(e,t={}){return To(e,t)}function zn(e,t={}){return I("Uppercase",[e],t)}function tl(e,t={}){return ko(e,t)}var sb=e=>e[0].toUpperCase()+e.slice(1),mb=e=>e.toLowerCase(),pb=e=>e[0].toLowerCase()+e.slice(1),ub=e=>e.toUpperCase();function vo(e,t){return T([e])?p.Update(st(sb,e),{},t):Un(e,t)}function $o(e,t){return T([e])?p.Update(st(mb,e),{},t):Kn(e,t)}function To(e,t){return T([e])?p.Update(st(pb,e),{},t):_n(e,t)}function ko(e,t){return T([e])?p.Update(st(ub,e),{},t):zn(e,t)}function rl(e,t,r,n){let a=d(e,t,r);return vo(a,n)}function nl(e,t,r,n){let a=d(e,t,r);return $o(a,n)}function al(e,t,r,n){let a=d(e,t,r);return To(a,n)}function ol(e,t,r,n){let a=d(e,t,r);return ko(a,n)}function Bn(e,t,r,n,a={}){return I("Conditional",[e,t,r,n],a)}function il(e,t,r,n,a={}){return wo({},G([],[]),e,t,r,n,a)}function cb(e,t,r,n,a,i){let m=me(e,r,n);return b.IsExtendsUnion(m)?k([d(m.inferred,t,a),d(e,t,i)]):b.IsExtendsTrue(m)?d(m.inferred,t,a):d(e,t,i)}function wo(e,t,r,n,a,i,m){return T([r,n])?p.Update(cb(e,t,r,n,a,i),{},m):Bn(r,n,a,i,m)}function sl(e,t,r,n,a,i,m){let c=d(e,t,r),l=d(e,t,n);return wo(e,t,c,l,a,i,m)}function Vn(e,t={}){return I("ConstructorParameters",[e],t)}function ml(e,t={}){return Eo(e,t)}function lb(e){let t=re(e)?e.parameters:[],r=Tt({},G([],[]),t);return Q(r)}function Eo(e,t){return T([e])?p.Update(lb(e),{},t):Vn(e,t)}function pl(e,t,r,n){let a=d(e,t,r);return Eo(a,n)}function Wn(e,t,r={}){return I("Exclude",[e,t],r)}function ul(e,t,r={}){return Xr(e,t,r)}function Xr(e,t,r){return T([e,t])?p.Update(An(e,t),{},r):Wn(e,t,r)}function cl(e,t,r,n,a){let i=d(e,t,r),m=d(e,t,n);return Xr(i,m,a)}function Hn(e,t,r={}){return I("Extract",[e,t],r)}function ll(e,t,r={}){return Ro(e,t,r)}function db(e,t){let r=me({},e,t);return b.IsExtendsTrueLike(r)?[e]:[]}function fb(e,t){return e.reduce((r,n)=>[...r,...db(n,t)],[])}function dl(e,t){let r=Pe(e),n=x(r)?r.anyOf:[r],a=fb(n,t);return ve(a)}function Ro(e,t,r){return T([e,t])?p.Update(dl(e,t),{},r):Hn(e,t,r)}function fl(e,t,r,n,a){let i=d(e,t,r),m=d(e,t,n);return Ro(i,m,a)}function gb(e){return e.reduce((t,r)=>Rn(r)?[...t,O(r)]:t,[])}function ur(e){let t=gb(e);return k(t)}function Nr(e,t,r={}){return I("Index",[e,t],r)}function gl(e,t,r={}){let n=s.IsArray(t)?ur(t):t;return So(e,n,r)}function hl(e,t){let r=He(e,t);return Ee(r)}function yl(e,t,r){let n=Fe(e,t,r);return Ee(n)}function hb(e,t){let r=s.Keys(e).filter(f=>!s.HasPropertyKey(t,f)),n=s.Keys(t).filter(f=>!s.HasPropertyKey(e,f)),a=s.Keys(e).filter(f=>s.HasPropertyKey(t,f)),i=r.reduce((f,w)=>({...f,[w]:e[w]}),{}),m=n.reduce((f,w)=>({...f,[w]:t[w]}),{}),c=a.reduce((f,w)=>({...f,[w]:z([e[w],t[w]])}),{}),l=p.Assign(i,m);return p.Assign(l,c)}function xl(e){return e.reduce((t,r)=>hb(t,Ee(r)),{})}function Il(e){let t=ks(Q(e));return Ee(t)}function yb(e,t){return s.Keys(e).filter(a=>a in t).reduce((a,i)=>({...a,[i]:ve([e[i],t[i]])}),{})}function bl(e,t){return s.ShiftLeft(e,(r,n)=>bl(n,yb(t,Ee(r))),()=>t)}function vl(e){return s.ShiftLeft(e,(t,r)=>bl(r,Ee(t)),()=>Y())}function Ee(e){return se(e)?hl(e.$defs,e.$ref):V(e)?yl(e.if,e.then,e.else):S(e)?xl(e.allOf):x(e)?vl(e.anyOf):j(e)?Il(e.items):M(e)?e.properties:{}}function cr(e){let t=Ee(e);return v(t)}var xb=new RegExp("^(?:0|[1-9][0-9]*)$");function lr(e){let t=`${e}`;return xb.test(t)?parseInt(t):e}function Ib(e){return O(lr(e))}function $l(e){return e.map(t=>Tl(t))}function Tl(e){return S(e)?de($l(e.allOf)):x(e)?k($l(e.anyOf)):A(e)?Ib(e.const):e}function kl(e,t){let r=Tl(t),n=me({},r,be());return b.IsExtendsTrueLike(n)?e:A(t)&&s.IsEqual(t.const,"length")?be():q()}function wl(e,t){let r=He(e,t);return $e(r)}function El(e,t,r){let n=Fe(e,t,r);return $e(n)}function Rl(e){let t=ke(e);return $e(t)}function Sl(e){let t=z(e);return $e(t)}function Ol(e){return[`${e}`]}function Pl(e){let t=Ie(e);return $e(t)}function Cl(e){return e.reduce((t,r)=>[...t,...$e(r)],[])}function $e(e){return se(e)?wl(e.$defs,e.$ref):V(e)?El(e.if,e.then,e.else):fe(e)?Rl(e.enum):S(e)?Sl(e.allOf):A(e)?Ol(e.const):Z(e)?Pl(e.pattern):x(e)?Cl(e.anyOf):[]}function dr(e){return $e(e)}function Zr(e,t){return t.map(r=>Qr(e,r))}function Qr(e,t){return K(t)?Te(Qr(e,t.items)):re(t)?Ge(Zr(e,t.parameters),Qr(e,t.instanceType)):ne(t)?Ue(Zr(e,t.parameters),Qr(e,t.returnType)):j(t)?Q(Zr(e,t.items)):x(t)?k(Zr(e,t.anyOf)):S(t)?de(Zr(e,t.allOf)):Dn(t)?v(e):t}function Ml(e,t){return Qr(e,t)}function bb(e,t){let r=t in e?e[t]:q();return Ml(e,r)}function Al(e,t){return t.reduce((r,n)=>[...r,bb(e,n)],[])}function vb(e,t){let r=dr(t),n=Al(e,r);return ve(n)}var $b=new RegExp(xt);function Tb(e){return e.filter(r=>$b.test(r))}function kb(e){let t=bn(e),r=Tb(t),n=Al(e,r);return ve(n)}function Ll(e,t){return X(t)?kb(e):vb(e,t)}function wb(e){return O(lr(e))}function ql(e){return e.map(t=>Oo(t))}function Oo(e){return S(e)?de(ql(e.allOf)):x(e)?k(ql(e.anyOf)):A(e)?wb(e.const):e}function Eb(e,t){return e.reduceRight((r,n,a)=>{let i=me({},O(a),t);return b.IsExtendsTrueLike(i)?[n,...r]:r},[])}function Rb(e,t){let r=Oo(t),n=Eb(e,r);return ot(n)}function Sb(e){return ot(e)}function jl(e,t){return A(t)&&s.IsEqual(t.const,"length")?O(e.length):X(t)||ge(t)?Sb(e):Rb(e,t)}function Fl(e,t){return K(e)?kl(e.items,t):M(e)?Ll(e.properties,t):j(e)?jl(e.items,t):q()}function Ob(e){return se(e)||V(e)||S(e)||x(e)?cr(e):e}function So(e,t,r){return T([e,t])?p.Update(Fl(Ob(e),t),{},r):Nr(e,t,r)}function Dl(e,t,r,n,a){let i=d(e,t,r),m=d(e,t,n);return So(i,m,a)}function Yn(e,t={}){return I("InstanceType",[e],t)}function Nl(e,t={}){return Po(e,t)}function Pb(e){return re(e)?e.instanceType:q()}function Po(e,t){return T([e])?p.Update(Pb(e),{},t):Yn(e,t)}function Gl(e,t,r,n={}){let a=d(e,t,r);return Po(a,n)}function Gr(e,t={}){return I("KeyOf",[e],t)}function Ul(e,t={}){return Co(e,t)}function Kl(){return k([be(),Oe(),Xt()])}function _l(e){return be()}function Cb(e){return e.reduce((r,n)=>Rn(n)?[...r,O(lr(n))]:Y(),[])}function zl(e){let t=s.Keys(e),r=Cb(t);return ot(r)}function Bl(e){return er(e)}function Vl(e){let t=e.map((r,n)=>O(n));return ot(t)}function Wl(e){return J(e)?Kl():K(e)?_l(e.items):M(e)?zl(e.properties):pe(e)?Bl(e):j(e)?Vl(e.items):q()}function Mb(e){return se(e)||V(e)||S(e)||x(e)?cr(e):e}function Co(e,t){return T([e])?p.Update(Wl(Mb(e)),{},t):Gr(e,t)}function Hl(e,t,r,n){let a=d(e,t,r);return Co(a,n)}function jr(e,t,r,n,a={}){return I("Mapped",[e,t,r,n],a)}function Yl(e,t,r,n,a={}){return Mo({},G([],[]),e,t,r,n,a)}function Ab(e){let t=Ie(e);return xa(t)}function Lb(e){return e.reduce((t,r)=>[...t,...xa(r)],[])}function qb(e){let t=ke(e);return xa(t)}function jb(e){return s.IsNumber(e)?[O(`${e}`)]:[O(e)]}function xa(e){return fe(e)?qb(e.enum):A(e)?jb(e.const):Z(e)?Ab(e.pattern):x(e)?Lb(e.anyOf):[e]}function Jl(e){return xa(e)}function Fb(e){return Z(e)?Ie(e.pattern):e}function Db(e,t,r,n,a,i){let m=p.Assign(e,{[r.name]:n}),c=d(m,t,a),l=Fb(c),g=d(m,t,i);return as(l)||os(l)?{[l.const]:g}:{}}function Nb(e,t,r,n,a,i){return n.reduce((m,c)=>[...m,Db(e,t,r,c,a,i)],[])}function Gb(e){return e.reduce((t,r)=>[...t,v(r)],[])}function Xl(e,t,r,n,a,i){let m=Jl(n),c=Nb(e,t,r,m,a,i),l=Gb(c);return z(l)}function Mo(e,t,r,n,a,i,m){return T([n])?p.Update(Xl(e,t,r,n,a,i),{},m):jr(r,n,a,i,m)}function Zl(e,t,r,n,a,i,m){let c=d(e,t,n);return Mo(e,t,r,c,a,i,m)}function Ub(e,t,r){let n=p.Assign(e,t);return s.Keys(t).filter(i=>r.includes(i)).reduce((i,m)=>({...i,[m]:Ac(n,m,t[m])}),{})}function Kb(e,t,r){let n=p.Assign(e,t);return s.Keys(t).filter(i=>!r.includes(i)).reduce((i,m)=>({...i,[m]:d(n,G([],[]),t[m])}),{})}function _b(e,t,r){let n=Oc(t),a=Ub(e,t,n),i=Kb(e,t,n),m={...a,...i};return p.Update(m,{},r)}function Ia(e,t,r,n){return _b(e,r,n)}function Jn(e,t={}){return I("NonNullable",[e],t)}function Ql(e,t={}){return Ao(e,t)}function zb(e){let t=k([Yt(),tr()]);return Xr(e,t,{})}function Ao(e,t){return T([e])?p.Update(zb(e),{},t):Jn(e,t)}function ed(e,t,r,n){let a=d(e,t,r);return Ao(a,n)}function Xn(e,t,r={}){return I("Omit",[e,t],r)}function td(e,t,r={}){let n=s.IsArray(t)?ur(t):t;return Lo(e,n,r)}function ba(e){let t=cr(e);return M(t)?t.properties:Y()}function Bb(e,t){return s.Keys(e).reduce((n,a)=>t.includes(a)?n:{...n,[a]:e[a]},{})}function rd(e,t){let r=ba(e),n=dr(t),a=Bb(r,n);return v(a)}function Lo(e,t,r){return T([e,t])?p.Update(rd(e,t),{},r):Xn(e,t,r)}function nd(e,t,r,n,a){let i=d(e,t,r),m=d(e,t,n);return Lo(i,m,a)}function Zn(e,t={}){return I("Parameters",[e],t)}function ad(e,t={}){return qo(e,t)}function Vb(e){let t=ne(e)?e.parameters:[],r=Tt({},G([],[]),t);return Q(r)}function qo(e,t){return T([e])?p.Update(Vb(e),{},t):Zn(e,t)}function od(e,t,r,n){let a=d(e,t,r);return qo(a,n)}function Qn(e,t={}){return I("Partial",[e],t)}function id(e,t={}){return jo(e,t)}function sd(e,t){let r=He(e,t),n=Ye(r);return _e(p.Assign(e,{[t]:n}),t)}function md(e,t,r){let n=Fe(e,t,r);return Ye(n)}function pd(e){let t=z(e);return Ye(t)}function ud(e){let t=e.map(r=>Ye(r));return k(t)}function cd(e){let t=s.Keys(e).reduce((n,a)=>({...n,[a]:Pt(e[a])}),{});return v(t)}function Ye(e){return se(e)?sd(e.$defs,e.$ref):V(e)?md(e.if,e.then,e.else):S(e)?pd(e.allOf):x(e)?ud(e.anyOf):M(e)?cd(e.properties):v({})}function jo(e,t){return T([e])?p.Update(Ye(e),{},t):Qn(e,t)}function ld(e,t,r,n){let a=d(e,t,r);return jo(a,n)}function ea(e,t,r={}){return I("Pick",[e,t],r)}function dd(e,t,r={}){let n=s.IsArray(t)?ur(t):t;return Fo(e,n,r)}function Wb(e,t){return s.Keys(e).reduce((n,a)=>t.includes(a)?p.Assign(n,{[a]:e[a]}):n,{})}function fd(e,t){let r=ba(e),n=dr(t),a=Wb(r,n);return v(a)}function Fo(e,t,r){return T([e,t])?p.Update(fd(e,t),{},r):ea(e,t,r)}function gd(e,t,r,n,a){let i=d(e,t,r),m=d(e,t,n);return Fo(i,m,a)}function ta(e,t={}){return I("ReadonlyObject",[e],t)}function Do(e,t={}){return No(e,t)}var hd=Do;function yd(e){return Ht(Te(e))}function xd(e,t){let r=He(e,t),n=Je(r);return _e(p.Assign(e,{[t]:n}),t)}function Id(e,t,r){let n=Fe(e,t,r);return Je(n)}function bd(e){let t=z(e);return Je(t)}function vd(e){let t=s.Keys(e).reduce((n,a)=>({...n,[a]:At(e[a])}),{});return v(t)}function $d(e){return Ht(Q(e))}function Td(e){let t=e.map(r=>Je(r));return k(t)}function Je(e){return K(e)?yd(e.items):se(e)?xd(e.$defs,e.$ref):V(e)?Id(e.if,e.then,e.else):S(e)?bd(e.allOf):M(e)?vd(e.properties):j(e)?$d(e.items):x(e)?Td(e.anyOf):e}function No(e,t){return T([e])?p.Update(Je(e),{},t):ta(e)}function kd(e,t,r,n){let a=d(e,t,r);return No(a,n)}function wd(e,t,r,n){return t.visited.includes(n)?r:n in e?d(e,G(t.callstack,[...t.visited,n]),e[n]):r}function Ed(e,t){let r=He(e,t),n=Xe(r);return _e(p.Assign(e,{[t]:n}),t)}function Rd(e,t,r){let n=Fe(e,t,r);return Xe(n)}function Sd(e){let t=z(e);return Xe(t)}function Od(e){let t=e.map(r=>Xe(r));return k(t)}function Pd(e){let t=s.Keys(e).reduce((n,a)=>({...n,[a]:Mn(e[a])}),{});return v(t)}function Xe(e){return se(e)?Ed(e.$defs,e.$ref):V(e)?Rd(e.if,e.then,e.else):S(e)?Sd(e.allOf):x(e)?Od(e.anyOf):M(e)?Pd(e.properties):v({})}function ra(e,t={}){return I("Required",[e],t)}function Cd(e,t={}){return Go(e,t)}function Go(e,t){return T([e])?p.Update(Xe(e),{},t):ra(e,t)}function Md(e,t,r,n){let a=d(e,t,r);return Go(a,n)}function na(e,t={}){return I("ReturnType",[e],t)}function Ad(e,t={}){return Uo(e,t)}function Hb(e){return ne(e)?e.returnType:q()}function Uo(e,t){return T([e])?p.Update(Hb(e),{},t):na(e,t)}function Ld(e,t,r,n={}){let a=d(e,t,r);return Uo(a,n)}function aa(e,t){return I("With",[e,t],{})}function qd(e,t){return Ko(e,t)}function Ko(e,t){return T([e])?p.Update(e,{},t):aa(e,t)}function jd(e,t,r,n){let a=d(e,t,r);return Ko(a,n)}function Yb(e){return It(e)?j(e.items)?_o(e.items.items):H(e.items)?[e]:ae(e.items)?[e]:[q()]:[e]}function _o(e){return e.reduce((r,n)=>[...r,...Yb(n)],[])}function G(e,t){return{callstack:e,visited:t}}function T(e){return s.ShiftLeft(e,(t,r)=>ae(t)?!1:T(r),()=>!0)}function Vr(e,t,r){return s.Keys(r).reduce((n,a)=>({...n,[a]:d(e,t,r[a])}),{})}function Tt(e,t,r){let n=we(e,t,r);return _o(n)}function we(e,t,r){return r.map(n=>d(e,t,n))}function Jb(e,t){let r=le(e)?kr(t,{}):t,n=Lt(e)?Tr(r,{}):r;return Mt(e)?en(n,{}):n}function Xb(e,t,r,n,a){return s.IsEqual(r,"AddImmutable")?Fd(e,t,n[0],a):s.IsEqual(r,"RemoveImmutable")?Wc(e,t,n[0],a):s.IsEqual(r,"AddReadonly")?Ai(e,t,n[0],a):s.IsEqual(r,"RemoveReadonly")?Is(e,t,n[0],a):s.IsEqual(r,"AddOptional")?Li(e,t,n[0],a):s.IsEqual(r,"RemoveOptional")?$s(e,t,n[0],a):s.IsEqual(r,"Capitalize")?rl(e,t,n[0],a):s.IsEqual(r,"Conditional")?sl(e,t,n[0],n[1],n[2],n[3],a):s.IsEqual(r,"ConstructorParameters")?pl(e,t,n[0],a):s.IsEqual(r,"Evaluate")?jc(e,t,n[0],a):s.IsEqual(r,"Exclude")?cl(e,t,n[0],n[1],a):s.IsEqual(r,"Extract")?fl(e,t,n[0],n[1],a):s.IsEqual(r,"Index")?Dl(e,t,n[0],n[1],a):s.IsEqual(r,"InstanceType")?Gl(e,t,n[0],a):s.IsEqual(r,"Interface")?wc(e,t,n[0],n[1],a):s.IsEqual(r,"KeyOf")?Hl(e,t,n[0],a):s.IsEqual(r,"Lowercase")?nl(e,t,n[0],a):s.IsEqual(r,"Mapped")?Zl(e,t,n[0],n[1],n[2],n[3],a):s.IsEqual(r,"Module")?Ia(e,t,n[0],a):s.IsEqual(r,"NonNullable")?ed(e,t,n[0],a):s.IsEqual(r,"Pick")?gd(e,t,n[0],n[1],a):s.IsEqual(r,"Parameters")?od(e,t,n[0],a):s.IsEqual(r,"Partial")?ld(e,t,n[0],a):s.IsEqual(r,"Omit")?nd(e,t,n[0],n[1],a):s.IsEqual(r,"ReadonlyObject")?kd(e,t,n[0],a):s.IsEqual(r,"Record")?Ns(e,t,n[0],n[1],a):s.IsEqual(r,"Required")?Md(e,t,n[0],a):s.IsEqual(r,"ReturnType")?Ld(e,t,n[0],a):s.IsEqual(r,"TemplateLiteral")?_u(e,t,n[0],a):s.IsEqual(r,"Uncapitalize")?al(e,t,n[0],a):s.IsEqual(r,"Uppercase")?ol(e,t,n[0],a):s.IsEqual(r,"With")?jd(e,t,n[0],n[1]):I(r,n,a)}function Zb(e,t,r){let n=ae(r)?wd(e,t,r,r.$ref):K(r)?Te(d(e,t,r.items),In(r)):pr(r)?ya(e,t,r.target,r.arguments):re(r)?Ge(we(e,t,r.parameters),d(e,t,r.instanceType),qi(r)):ne(r)?Ue(we(e,t,r.parameters),d(e,t,r.returnType),ji(r)):V(r)?Ct(d(e,t,r.if),d(e,t,r.then),d(e,t,r.else),Ki(r)):S(r)?de(we(e,t,r.allOf),Wi(r)):M(r)?v(Vr(e,t,r.properties),Gi(r)):pe(r)?Gs(Ce(r),d(e,t,ye(r))):It(r)?Ft(d(e,t,r.items)):j(r)?Q(Tt(e,t,r.items),xs(r)):x(r)?k(we(e,t,r.anyOf),ss(r)):r;return Jb(r,n)}function d(e,t,r){return dt(r)?Xb(e,t,r.action,r.parameters,r.options):Zb(e,t,r)}function zo(e,t){return d(e,G([],[]),t)}function Qb(e){return p.Update(e,{"~immutable":!0},{})}function en(e,t){return p.Update(Qb(e),{},t)}function Fd(e,t,r,n){let a=d(e,t,r);return en(a,n)}function Up(e,t={}){return I("AddImmutable",[e],t)}function Ht(e,t={}){return en(e,t)}function Kp(e,t={}){return I("Evaluate",[e],t)}function Dd(e,t={}){return Io(e,t)}function _p(e,t={}){return I("Module",[e],t)}function Nd(e,t={}){return Ia({},G([],[]),e,t)}function Gd(...e){let[t,r,n]=ze.Match(e,{2:(m,c)=>s.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=Du(r),i=s.IsArray(a)&&s.IsEqual(a.length,2)?d(t,G([],[]),a[0]):q();return p.Update(i,{},n)}var N={};Et(N,{Any:()=>Wt,Array:()=>Te,BigInt:()=>Sr,Boolean:()=>wn,Call:()=>Bc,Capitalize:()=>Zc,Codec:()=>kn,Conditional:()=>il,Constructor:()=>Ge,ConstructorParameters:()=>ml,Cyclic:()=>_e,Decode:()=>Xi,DecodeBuilder:()=>Rr,Dependent:()=>Ct,Encode:()=>Zi,EncodeBuilder:()=>Er,Enum:()=>Vi,Evaluate:()=>Dd,Exclude:()=>ul,Extends:()=>me,ExtendsResult:()=>b,Extract:()=>ll,Function:()=>Ue,Generic:()=>ft,Identifier:()=>Or,Immutable:()=>Qi,Index:()=>gl,Infer:()=>wr,InstanceType:()=>Nl,Instantiate:()=>zo,Integer:()=>qt,Interface:()=>Ec,Intersect:()=>de,IsAny:()=>J,IsArray:()=>K,IsBigInt:()=>Ve,IsBoolean:()=>Se,IsCall:()=>pr,IsCodec:()=>Tn,IsConstructor:()=>re,IsCyclic:()=>se,IsDependent:()=>V,IsEnum:()=>fe,IsEnumValue:()=>Bi,IsFunction:()=>ne,IsGeneric:()=>Vt,IsIdentifier:()=>ns,IsImmutable:()=>Mt,IsInfer:()=>H,IsInteger:()=>ge,IsIntersect:()=>S,IsKind:()=>y,IsLiteral:()=>A,IsNever:()=>gt,IsNull:()=>Jt,IsNumber:()=>X,IsObject:()=>M,IsOptional:()=>le,IsParameter:()=>is,IsReadonly:()=>Lt,IsRecord:()=>pe,IsRef:()=>ae,IsRefine:()=>_a,IsRest:()=>It,IsSchema:()=>ee,IsString:()=>he,IsSymbol:()=>ht,IsTemplateLiteral:()=>Z,IsThis:()=>Dn,IsTuple:()=>j,IsUndefined:()=>rr,IsUnion:()=>x,IsUnknown:()=>te,IsUnsafe:()=>$n,IsVoid:()=>We,KeyOf:()=>Ul,Literal:()=>O,Lowercase:()=>Qc,Mapped:()=>Yl,Module:()=>Nd,Never:()=>q,NonNullable:()=>Ql,Null:()=>Yt,Number:()=>be,Object:()=>v,Omit:()=>td,Optional:()=>Di,Parameter:()=>jt,Parameters:()=>ad,Partial:()=>id,Pick:()=>dd,Readonly:()=>es,ReadonlyObject:()=>Do,ReadonlyType:()=>hd,Record:()=>qn,RecordKey:()=>er,RecordPattern:()=>Ce,RecordValue:()=>ye,Ref:()=>at,Refine:()=>ts,Required:()=>Cd,Rest:()=>Ft,ReturnType:()=>Ad,Script:()=>Gd,String:()=>Oe,Symbol:()=>Xt,TemplateLiteral:()=>Bu,This:()=>Fn,Tuple:()=>Q,Uncapitalize:()=>el,Undefined:()=>tr,Union:()=>k,Unknown:()=>oe,Unsafe:()=>Ui,Uppercase:()=>tl,Void:()=>Nn,With:()=>qd});var fr="submit_test_gap_candidates",tn="submit_filtered_test_gaps",rn="submit_solver_gaps",v4=N.Object({verdict:N.Union([N.Literal("PASS"),N.Literal("FAIL")],{description:"FAIL only for a genuine blocking issue (clear rubric violation, agent-fault-worthy gap, unfair/undiscoverable test requirement, or a real determinism/regression risk). Optional, minor, or stylistic points are NOT grounds for FAIL \u2014 put those in `notes` instead and use PASS."}),summary:N.String({description:"One short sentence summarizing the verdict."}),reasons:N.Array(N.String(),{description:"Specific BLOCKING justifications only, citing rubric item IDs and concrete evidence from the files you read. Required (non-empty) when verdict is FAIL. Use an empty array when verdict is PASS."}),notes:N.Array(N.String(),{description:"Non-blocking, optional/minor observations or suggested improvements \u2014 the kind of feedback a real reviewer leaves as 'Minor/optional' without failing the task. Include these regardless of verdict; use an empty array if you truly have none."})});var ev=N.Object({gaps:N.Array(N.Object({description:N.String({description:"The specific untested behavior or edge case, in plain terms. Prefix with POSITIVE: or NEGATIVE: to indicate whether this is a missing required-behavior test or a missing forbidden/wrong-behavior test."}),risk:N.String({description:"Concretely why a plausible-but-incorrect implementation could still pass every test in test.patch despite missing, misimplementing, or violating this behavior (including doing a forbidden thing because no test asserts it must not happen)."})}),{description:"Candidate behavioral test gaps (positive and negative) grounded in agent_prompt.md or clear existing repo behavior. Use an empty array if you found none \u2014 do not manufacture gaps just to report something."})});function Ud(e){return{name:fr,label:"Submit Candidate Test Gaps",description:"Submit your candidate list of behavioral test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished reading and analyzing the relevant files.",parameters:ev,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Recorded ${n.length} candidate gap(s)`}],details:void 0}}}}var tv=N.Object({gaps:N.Array(N.Object({description:N.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:N.String({description:"Why this is genuinely grounded in agent_prompt.md or the repo, fair to test per the fairness methodology, and a real (non-duplicate) coverage hole in test.patch \u2014 for negative gaps, cite the prompt's prohibition/constraint and why no existing test catches the forbidden outcome."})}),{description:"The filtered, final list of confirmed test gaps. Use an empty array if none of the candidates survive strict scrutiny."})});function Kd(e){return{name:tn,label:"Submit Filtered Test Gaps",description:"Submit your final, strictly filtered list of confirmed test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have independently verified each candidate.",parameters:tv,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Confirmed ${n.length} gap(s) after filtering`}],details:void 0}}}}var rv=N.Object({gaps:N.Array(N.Object({description:N.String({description:"The specific behavioral gap: a way one or more solver's diff differs materially from what agent_prompt.md/solution.patch require, despite that solver passing `./test.sh new`."}),justification:N.String({description:"Why this is a genuine requirement from agent_prompt.md or solution.patch (cite the specific requirement/line) that the solver's diff misses, contradicts, or diverges from \u2014 and why the current tests fail to catch that divergence."}),evidence:N.String({description:"Which solver(s) (by index) exhibit this, and the specific part of their diff that grounds the gap."})}),{description:"Concrete, diff-grounded behavioral gaps \u2014 cases where a passing solver's materially different approach reveals that `test.sh new` under-specifies a real requirement. Use an empty array if the solvers converged on equivalent behavior; do not manufacture gaps just to report something."})});function _d(e){return{name:rn,label:"Submit Solver Gaps",description:"Submit your final list of behavioral gaps found by comparing the solver diffs against the real solution.patch. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished comparing every solver.",parameters:rv,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Recorded ${n.length} solver gap(s)`}],details:void 0}}}}function zd(e){return[e,"You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the task description given to a coding agent), `test.patch` (a unified diff adding the hidden tests that will grade that agent's solution), and `solution.patch` (a unified diff of one golden/reference solution).","Another specialized agent is searching the complementary direction in parallel \u2014 stay in your lane and do not duplicate its work."]}var Bd=["Thoroughness \u2014 your job is high recall on genuine gaps only:","- Find every gap you can justify with concrete evidence. Do not stop after the first obvious ones \u2014 keep reading until you have systematically covered the prompt, `solution.patch`, and relevant repo context.","- After your first pass, run at least one deliberate second sweep (re-read `agent_prompt.md`, re-scan `solution.patch`, grep the repo) before submitting \u2014 but if that sweep still finds nothing, submit an empty list.","- Do not self-censor or merge distinct genuine gaps into one \u2014 the validator will prune. Never invent or pad the list to seem thorough; an empty array is correct when exhaustive analysis truly finds none.","- Hunt subtle gaps too: partial coverage (asserted once but not under other valid inputs), behaviors implied by repo convention, interaction effects, ordering/timing, and branches visible in `solution.patch` that no test forces.","- Include a candidate only when you can cite specific grounding and a concrete false-pass risk \u2014 not to meet a quota."],Bo=["Ground rules \u2014 do not overreach:","- Every gap must trace back to a specific requirement or sentence in `agent_prompt.md`, or to behavior that is unambiguous from the existing, visible repo. Do not invent requirements the prompt doesn't support.","- Do not propose gaps for things `agent_prompt.md` leaves intentionally open, or for implementation details/style the prompt doesn't mandate.","- Read `test.patch` carefully before deciding something is untested \u2014 do not propose a gap that an existing test already covers (even indirectly).","- Keep findings strictly behavioral and publicly observable: a user, caller, or documented public contract must be able to observe the required outcome. Do not report internal helper calls, private state, implementation structure, call order, file placement, or other incidental mechanics.","- Do not require DOM classes, DOM/data/test attributes, selectors, or exact string literals unless the prompt explicitly names them or they are an established, already-present public contract in the repository. Prefer a visible outcome or public API behavior that accepts equivalent implementations."];function Vd(e,t){let r=[...zd("You are an exhaustive, research-minded POSITIVE test-coverage analyst for a coding-agent benchmark task. Your sole mandate is to surface EVERY genuine POSITIVE behavioral test gap \u2014 required behavior that `test.patch` never asserts but `agent_prompt.md` requires. Do NOT search for forbidden/wrong-behavior gaps; a separate negative-case agent handles those in parallel. Stay in your lane and search exhaustively before concluding there are none."),"","Your job: find real POSITIVE TEST GAPS. A positive gap is required or clearly-implied behavior from `agent_prompt.md` (and, where relevant, obvious existing repo conventions) that `test.patch` does NOT actually verify \u2014 such that a plausible implementation could skip or misimplement that required behavior and STILL pass every test in `test.patch` as written.","","Focus on required outcomes: happy paths, side effects, state changes, outputs, transitions, edge inputs where the prompt still expects correct handling, combined/interacting behaviors, and branches in `solution.patch` whose correct outcome is never forced by a test.","","Be systematic and exhaustive \u2014 work through ALL of the following passes:","1. Go through `agent_prompt.md` sentence by sentence. For every distinct required behavior, constraint, or implied rule, check which test(s) in `test.patch` exercise it and how thoroughly.","2. Go through `solution.patch` branch by branch \u2014 every conditional, loop, early return, error path, and state transition. For each one, ask whether `test.patch` forces the correct outcome to be checked.","3. Consider standard positive edge-case categories: boundary/limit values, empty/missing/null/zero inputs that should still produce the required correct behavior, duplicate or repeated inputs handled correctly, ordering and interleaving, concurrent or repeated invocations, error/failure/rollback paths that should recover correctly, interaction between two or more required behaviors at once, and state left behind after an operation.","4. Cross-check overlapping/interacting requirements \u2014 behaviors each tested alone but never tested together.","5. Second-pass sweep: return to any requirement you marked 'covered' and ask whether coverage is shallow \u2014 one happy-path assertion is not enough if other valid inputs, sequences, or combinations could still slip through.",...Bd,"Do not filter yourself or self-censor for volume. A separate validator will strictly filter afterward \u2014 your job is recall on POSITIVE gaps only.","",...Bo,"","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",e];return t&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),r.push("","For each gap, prefix the description with `POSITIVE:` and explain: (1) the specific untested required behavior/edge case, and (2) concretely why a plausible-but-incomplete implementation would still pass every given test despite missing or misimplementing it.",`When you are done \u2014 after completing ALL the passes above and a deliberate second sweep \u2014 call the \`${fr}\` tool exactly once with your full candidate list (empty only if, after genuinely exhaustive analysis, none exist). That tool call is your only way to report a result.`),r.join(`
|
|
12
|
+
`)}function Wd(e,t){let r=[...zd("You are an exhaustive, research-minded NEGATIVE test-coverage analyst for a coding-agent benchmark task. Your sole mandate is to surface EVERY genuine NEGATIVE behavioral test gap \u2014 forbidden behavior, invalid states, or wrong outcomes that `test.patch` never asserts against but `agent_prompt.md` prohibits or implies must not happen. Do NOT search for missing required-behavior gaps; a separate positive-case agent handles those in parallel. Stay in your lane and search exhaustively before concluding there are none."),"","Your job: find real NEGATIVE TEST GAPS. A negative gap is a prohibition, guard, or 'must not' constraint from `agent_prompt.md` (or unambiguous repo convention) that `test.patch` does NOT verify \u2014 such that an agent could violate `agent_prompt.md` by doing the forbidden thing, leaving the wrong state enabled, applying an effect to the wrong target, skipping a guard, or accepting invalid input, and STILL pass every test because the suite only checks that correct actions work, not that incorrect ones are rejected.","","Be systematic and exhaustive \u2014 work through ALL of the following passes:","1. Re-read `agent_prompt.md` specifically for prohibitions, conditions, guards, and 'only when' / 'must not' / 'never' / 'disabled when' / 'should not' language. For each, ask: does `test.patch` assert the WRONG thing does NOT happen?","2. Go through `solution.patch` for every guard, early return, disabled branch, isolation check, and rejection path. Ask whether a sloppy implementation that bypassed that guard would still pass.","3. Hunt these negative patterns explicitly:"," - Controls that must be disabled/unavailable in a given state, but no test drives that state and asserts disabled."," - Operations that must NOT affect a separate scope/target (isolation), but tests never prove the wrong scope is untouched."," - Side effects that must NOT occur (duplicate entries, spurious history steps, refresh on no-op)."," - Invalid, out-of-order, or repeated input that should be ignored/rejected/coalesced differently."," - Undo/redo or rollback boundaries where the first action must NOT be undoable, or redo must NOT be available."," - Mutual exclusion: doing A must NOT silently change B, but no test proves independence.","4. For every prompt prohibition, ask: 'Is there a test that would catch an agent doing the forbidden thing or applying the requirement in the wrong context?' If not, it is a gap.","5. Adversarial pass: imagine a lazy or slightly-wrong implementation that satisfies the obvious tests \u2014 list every way it could still violate the prompt (wrong scope, wrong timing, wrong guard, spurious side effect, missing rejection) and check whether `test.patch` would catch each one.",...Bd,"Do not filter yourself or self-censor for volume. A separate validator will strictly filter afterward \u2014 your job is recall on NEGATIVE gaps only.","",...Bo,"- Negative gaps must be grounded in an explicit or clearly implied prohibition/constraint in `agent_prompt.md` \u2014 not generic 'more negative tests would be nice'.","- A single test that asserts both the positive outcome AND that the forbidden/wrong outcome did not occur counts as covered.","","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",e];return t&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),r.push("","For each gap, prefix the description with `NEGATIVE:` and explain: (1) the specific untested forbidden/wrong behavior or invalid state, and (2) concretely why a plausible-but-wrong implementation would still pass every given test despite violating this constraint.",`When you are done \u2014 after completing ALL the passes above and a deliberate second sweep \u2014 call the \`${fr}\` tool exactly once with your full candidate list (empty only if, after genuinely exhaustive analysis, none exist). That tool call is your only way to report a result.`),r.join(`
|
|
13
|
+
`)}function Hd(e,t,r){let n=["You are a strict, skeptical fairness auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","Two specialized research agents reviewed this same task (`agent_prompt.md`, `test.patch`, `solution.patch`, and the repo) in parallel \u2014 one hunting POSITIVE gaps (missing required-behavior tests), one hunting NEGATIVE gaps (missing forbidden/wrong-behavior tests). They proposed the following combined CANDIDATE list:","",JSON.stringify(e,null,2),"","Your job is to independently re-verify the files yourself and FILTER this list down to only candidates that are ALL of the following:","1. Genuinely grounded \u2014 actually required by a specific statement in `agent_prompt.md`, or unambiguous from clearly visible, existing repo behavior. Drop anything speculative, nice-to-have, or invented beyond what the prompt actually asks for.","2. Fair to test \u2014 verifying it would not require undiscoverable private internals, an invented/unnamed API, or exact incidental structure that only `solution.patch` happens to use. Judge this precisely against the fairness methodology below.","3. A real, distinct coverage hole \u2014 re-check `test.patch` yourself; drop any candidate an existing test already covers, and drop near-duplicate candidates (keep only the clearest phrasing of each distinct gap). For negative-case candidates, keep them only if `test.patch` does not already assert that the forbidden/wrong outcome does not occur.","4. Behaviorally testable through a public contract \u2014 drop candidates that would require an internal helper, private state, implementation structure, call order, DOM class/attribute/data hook, selector, or exact string literal. The sole exceptions are details explicitly named in `agent_prompt.md` or already established as a public contract in the existing repository.","","Be strict: when genuinely unsure whether a candidate holds up, drop it rather than keep it. It is fine \u2014 expected, even \u2014 to return an empty list if none of the candidates survive scrutiny.","","Checklist for the tests focus area, for calibration:",t];return r&&n.push("","Fairness methodology:",r),n.push("","For every gap you keep, give a short justification citing where in `agent_prompt.md` or the repo it is grounded. Preserve POSITIVE:/NEGATIVE: prefix when applicable.",`When you are done, call the \`${tn}\` tool exactly once with your final filtered list (which may be empty). That tool call is your only way to report a result.`),n.join(`
|
|
14
|
+
`)}function Yd(){return["You are a software engineer practicing test-driven development in a real git repository (this is your current directory).","`agent_prompt.md` in the repo root describes your task. Tests for it already exist and are currently failing \u2014 that's normal in TDD, the tests come first.","","Goal: make all of the new tests pass.","1. Read `agent_prompt.md`.","2. Run `bash test.sh new` to see the failures and what the tests expect.","3. Read the failing tests \u2014 they are the precise spec \u2014 and the surrounding repo code for conventions and utilities to reuse.","4. Implement the code needed to satisfy both `agent_prompt.md` and the tests, matching repo style.","5. Re-run `bash test.sh new` and iterate until everything passes, or you're confident you can't progress further.","","Rules:","- Do NOT modify the test files or `test.sh`. Only change application/library code.","- You have shell access \u2014 install any dependencies you need.","- Prefer the smallest, most direct change that satisfies the tests and `agent_prompt.md` using existing repo patterns."].join(`
|
|
15
|
+
`)}function nv(e){let t=e.status==="ok"?e.passed?"PASSED all new tests":"did NOT pass all new tests":`did not complete normally (status: ${e.status})`;return`- Solver ${e.index} \u2014 ${t} \u2014 solution.diff / test_output.txt in \`${xr}/solver_${e.index}/\``}function Jd(e,t,r){let n=["You are a strict, skeptical behavioral-gap auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the real task description), `solution.patch` (a unified diff of the real golden/reference solution), and `test.patch` (a unified diff adding the hidden tests).","",`Separately, several coding agents ('solvers') were each given the same \`agent_prompt.md\` plus the failing tests from \`test.patch\` \u2014 but never \`solution.patch\` \u2014 and asked to implement the task TDD-style, iterating with real shell access until the tests passed or they gave up. Each solver's diff and full \`test.sh new\` output \u2014 captured and verified independently by the harness, not self-reported \u2014 is saved under \`${xr}/solver_<index>/\` (\`solution.diff\`, \`test_output.txt\`), with a \`${xr}/manifest.json\` summary. Use read/grep/find/ls to open exactly what you need. Status summary:`,"",...e.map(nv),"","Your job: compare the reference `solution.patch` with each solver's `solution.diff` to find concrete BEHAVIORAL GAPS. Keep only a difference where: (a) `agent_prompt.md` explicitly requires the behavior, (b) the solver passed the relevant tests (even if it failed elsewhere), (c) the reference and solver produce observably different behavior for a real edge case or scenario, and (d) a fair public-facing test could distinguish them. The reference solution is evidence for scenarios to inspect, never a specification by itself.","","How to work:","1. Read `agent_prompt.md` sentence by sentence and note every distinct requirement, constraint, and prohibition.","2. Read `solution.patch` to see how the reference solution satisfies those requirements.","3. For each solver, read its `solution.diff` and compare it against the reference behavior. Look specifically for a solver shortcut, missed constraint, edge case, or side effect that the PROMPT requires, where the solver still passes because the tests do not observe the behavioral difference.","4. A solver that did not pass the full suite may still provide evidence for a completed, relevant part of its diff, but only when its test output shows the failure is unrelated to that behavior (or shows the relevant tests already passed). Do not treat its failing behavior as a gap, and do not infer gaps from a hypothetical wrong implementation.","5. Treat multiple solvers converging on the same divergent-but-passing shortcut as stronger evidence of a real gap, not proof it's acceptable \u2014 the tests are what's under scrutiny, not majority solver behavior.","",...Bo,"- Every gap must be evidenced by an actual, cited solver diff and a contrasting reference behavior. For a solver that failed the full suite, also cite its test output showing that the relevant behavior already passed or is unrelated to the failure. Cite the prompt sentence that makes the behavioral difference required; do not report a gap that is purely theoretical or based only on the reference implementation.","- It is fine, and expected, to submit an empty list if the solvers that passed all converged on behavior equivalent to the reference solution with no material gaps.","- Do not self-censor for volume, but do not pad the list either \u2014 only include what you can concretely justify with cited evidence.","","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",t];return r&&n.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",r),n.push("",`When you are done, call the \`${rn}\` tool exactly once with your final list (which may be empty). That tool call is your only way to report a result.`),n.join(`
|
|
16
|
+
`)}var av=900*1e3,Vo=["read","grep","find","ls"];function Ta(e){return e==="off"?void 0:e}async function ka(e,t,r=av){let n=t.aborted?"cancelled":"done";return await Promise.race([e().then(()=>{t.aborted||(n="done")}),new Promise(a=>{setTimeout(()=>{n="timedOut",a()},r)}),new Promise(a=>{if(t.aborted)return a();t.addEventListener("abort",()=>{n="cancelled",a()},{once:!0})})]),n}async function Xd(e){let t={},r=e.kind==="positive"?Vd:Wd,n=e.model,{session:a}=await va({cwd:e.tempDir,model:n,thinkingLevel:Ta(e.thinkingLevel),tools:[...Vo,fr],customTools:[Ud(t)],sessionManager:$a.inMemory()});try{let i=await ka(async()=>{await a.prompt(r(e.testRubric,e.fairnessRules))},e.cancelSignal);if(i!=="done")return await a.abort(),{status:i,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var ov=["read","grep","find","ls","write","edit","bash"];async function Zd(e){let t=e.model;try{let r=$a.inMemory(),{session:n}=await va({cwd:e.solverDir,model:t,thinkingLevel:Ta(e.thinkingLevel),tools:[...ov],sessionManager:r}),a=await ka(async()=>{await n.prompt(Yd())},e.cancelSignal,e.timeoutMinutes*60*1e3);return a!=="done"&&await n.abort(),{outcome:a,trajectory:r.getEntries()}}catch{return{outcome:"error",trajectory:[]}}}async function Qd(e){let t={},r=e.model,{session:n}=await va({cwd:e.tempDir,model:r,thinkingLevel:Ta(e.thinkingLevel),tools:[...Vo,rn],customTools:[_d(t)],sessionManager:$a.inMemory()});try{let a=await ka(async()=>{await n.prompt(Jd(e.solverResults,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await n.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}async function ef(e){let t={},r=e.model,{session:n}=await va({cwd:e.tempDir,model:r,thinkingLevel:Ta(e.thinkingLevel),tools:[...Vo,tn],customTools:[Kd(t)],sessionManager:$a.inMemory()});try{let a=await ka(async()=>{await n.prompt(Hd(e.candidates,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await n.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var Ut="checks_progress";function wa(e,t,r,n){let a=r>0?Math.min(1,t/r):0,i=Math.round(24*a),m="\u2588".repeat(i)+"\u2591".repeat(Math.max(0,24-i)),c=n?` pass:${n.passed} fail:${n.failed}`:"";return[`checks: ${e} [${m}] ${t}/${r}${c}`]}import{existsSync as iv,readFileSync as sv}from"node:fs";var Wo=["agent_prompt.md","solution.patch","test.patch"];function Ho(e=new Date){let t=(i,m=2)=>String(i).padStart(m,"0"),r=-e.getTimezoneOffset(),n=r>=0?"+":"-",a=Math.abs(r);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}${n}${t(Math.floor(a/60))}:${t(a%60)}`}function tf(e){try{if(!iv(e))return{};let t=JSON.parse(sv(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function rf(e){let t={...e.existingReport,timestamp:Ho(),model:`${e.config.provider}/${e.config.modelId}`,thinkingLevel:e.config.thinkingLevel};return delete t.overall,delete t.reports,e.runGapFinder&&(t.testGaps=e.testGaps,e.gapAnalysisIncomplete?t.testGapAnalysisNote=`Gap analysis did not fully complete (positive finder: ${e.positiveGapFinderStatus}, negative finder: ${e.negativeGapFinderStatus}, filter: ${e.gapFilterStatus}); testGaps may be incomplete.`:delete t.testGapAnalysisNote),e.runSolverGapFinder&&(t.solverRunSummary=e.solverResults.map(r=>({index:r.index,status:r.status,passed:r.passed,durationMs:r.durationMs,totalTests:r.totalTests,failedTests:r.failedTests,artifactsDir:r.artifactsDir})),t.solverGaps=e.solverGaps,e.solverGapAnalysisIncomplete?t.solverGapAnalysisNote=`Solver-gap analysis did not fully complete (comparison reviewer: ${e.solverComparisonStatus}); solverGaps may be incomplete.`:delete t.solverGapAnalysisNote),t}function nf(e){let t=Math.round(e/1e3);return t>=60?`${Math.floor(t/60)}m ${t%60}s`:`${t}s`}function af(e){let t=Array.isArray(e.merged.testGaps)?e.merged.testGaps.length:0,r=e.runSolverGapFinder&&Array.isArray(e.merged.solverRunSummary)?e.merged.solverRunSummary.map(i=>({...i,durationMs:i.durationMs??0})):[],n=Array.isArray(e.merged.solverGaps)?e.merged.solverGaps.length:0,a=[];return e.runGapFinder&&a.push(t>0?`${t} test gap(s) found`:"no test gaps found"),e.runSolverGapFinder&&a.push(`${r.filter(i=>i.passed).length}/${r.length} solvers passed, ${n} gap(s) found`),{content:`Gap finders: ${a.join(" | ")}`,details:{gapsCount:t,showGaps:e.runGapFinder,showSolverGaps:e.runSolverGapFinder,solverDetails:r,solverGapsCount:n}}}var of=`## The problem description (aka the task)\r
|
|
17
17
|
P1: Aligns with the repo's philosophy\r
|
|
18
18
|
P2: Self-contained \u2014 solvable from the repo and description alone\r
|
|
19
19
|
P3: Clear, concise, and unambiguous \u2014 describes what to build or fix and don't leave points for guessing\r
|
|
@@ -40,7 +40,7 @@ That's the golden solution \u2014 the proof that your task is solvable and that
|
|
|
40
40
|
S1: The solution should meet all the requirements. (If it's missing a requirement and it manages to pass your tests, you're in a bad position \u{1F620}.)\r
|
|
41
41
|
S2: No regressions and follow existing code patterns. Don't break existing working code by mistake (we'll still run the repo's existing tests).\r
|
|
42
42
|
S3: No irrelevant changes to the code \u2014 if something is unrelated to your task, keep it as it is.\r
|
|
43
|
-
S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,
|
|
43
|
+
S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,mv=`# Agent Evaluation Guidelines\r
|
|
44
44
|
\r
|
|
45
45
|
This file describes how to align a task prompt, reference solution, and tests for fair coding-agent evaluation. It is generic and can be reused across repositories and tasks.\r
|
|
46
46
|
\r
|
|
@@ -320,5 +320,5 @@ Keep changes separated when possible:\r
|
|
|
320
320
|
- Avoid unrelated dependency or lockfile changes.\r
|
|
321
321
|
- Regenerate patches after every prompt/test/solution change.\r
|
|
322
322
|
\r
|
|
323
|
-
---`;function
|
|
324
|
-
`),"info");return}let a=[...new Set(n.split(/\s+/).filter(Boolean))],
|
|
323
|
+
---`;function sf(){return(of.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??of).trim()}function mf(){return mv.trim()}var Ea=!1,gr;function Ra(){return Ea}function pf(){return Ea=!0,gr=new AbortController,gr}function uf(){Ea=!1,gr=void 0}function cf(){return!Ea||!gr||gr.signal.aborted?!1:(gr.abort(),!0)}var gv="Ctrl+Shift+X",Yo=[{value:"--gap-finder",label:"--gap-finder",description:"Find and validate behavioral test-coverage gaps"},{value:"--solver-gap-finder",label:"--solver-gap-finder",description:"Use TDD solver attempts to find behavioral gaps"},{value:"--config",label:"--config",description:"Configure gap-finder models"}];function hv(e){let t=e.trimStart(),r=/\s$/.test(t),n=t.trimEnd().split(/\s+/).filter(Boolean),a=r?"":n.at(-1)??"",i=new Set(r?n:n.slice(0,-1)),m=r?t:t.slice(0,t.length-a.length),c=i.has("--config"),l=[...i].some(f=>f!=="--config"),g=Yo.filter(f=>!i.has(f.value)&&!c&&!(l&&f.value==="--config")&&f.value.startsWith(a));return g.length?g.map(f=>({...f,value:`${m}${f.value}`})):null}async function yf(e,t,r){let n=ci();if(n.length===0)return e.ui.notify("No enabledModels configured in settings.json.","error"),null;let a=e.modelRegistry.getAll(),i=n.map(g=>{let f=li(g);if(!f)return null;let w=a.find(ue=>ue.provider===f.provider&&ue.id===f.modelId),F=t?.provider===f.provider&&t?.modelId===f.modelId,_=w?`${w.name} (${g})`:g;return{ref:g,parsed:f,display:F?`${_} [current]`:_,isCurrent:F}}).filter(g=>g!==null);if(i.length===0)return e.ui.notify("Could not resolve any enabledModels entries.","error"),null;let m=[...i].sort((g,f)=>g.isCurrent===f.isCurrent?0:g.isCurrent?-1:1),c=await e.ui.select(r,m.map(g=>g.display));if(!c)return null;let l=i.find(g=>g.display===c);return l?{provider:l.parsed.provider,modelId:l.parsed.modelId}:null}function Oa(e,t,r){let n=e.modelRegistry.getAll().find(a=>a.provider===t&&a.id===r);return pi(n)}var Sa={provider:"",modelId:"",thinkingLevel:"off",timeoutMinutes:Ma,solverCount:La,saveArtifacts:qa};function xf(e,t,r){let n=t?Oa(e,t.provider,t.modelId):["off"],a=r.provider?Oa(e,r.provider,r.modelId):["off"];return[{id:"reviewer-model",section:"Reviewer",label:"Model",value:t?`${t.provider}/${t.modelId}`:"not set",kind:"model"},{id:"reviewer-thinking",section:"Reviewer",label:"Thinking level",value:t?.thinkingLevel??"off",kind:"cycle",values:n},{id:"solvergap-model",section:"Solver",label:"Model",value:r.provider?`${r.provider}/${r.modelId}`:"not set",kind:"model"},{id:"solvergap-thinking",section:"Solver",label:"Thinking level",value:r.thinkingLevel,kind:"cycle",values:a},{id:"solvergap-timeout",section:"Solver",label:"Timeout",value:`${r.timeoutMinutes} min`,kind:"cycle",values:[10,20,30,40,50,si].filter((i,m,c)=>i>=ii&&c.indexOf(i)===m).map(i=>`${i} min`)},{id:"solvergap-solver-count",section:"Solver",label:"Parallel agents",value:String(r.solverCount),kind:"cycle",values:Array.from({length:mi-Aa+1},(i,m)=>`${Aa+m}`)},{id:"solvergap-save-artifacts",section:"Solver",label:"Save artifacts",value:r.saveArtifacts?"on":"off",kind:"cycle",values:["on","off"]}]}var Jo=class{constructor(t,r,n,a,i,m){this.ctx=t;this.settingsListTheme=r;this.theme=n;this.onCycleSaved=a;this.onActivateModel=i;this.onExit=m;this.rows=xf(t,ut(),ut()?.solverGap??Sa)}selectedIndex=0;rows;refresh(){let t=ut();this.rows=xf(this.ctx,t,t?.solverGap??Sa),this.selectedIndex=Math.min(this.selectedIndex,this.rows.length-1)}invalidate(){}render(t){let r=[],n=Math.min(30,Math.max(...this.rows.map(i=>i.label.length))),a;for(let i=0;i<this.rows.length;i++){let m=this.rows[i];if(!m)continue;m.section!==a&&(a!==void 0&&r.push(""),r.push(this.theme.bold(this.theme.fg("accent",m.section))),a=m.section);let c=i===this.selectedIndex,l=c?this.settingsListTheme.cursor:" ",g=m.label+" ".repeat(Math.max(0,n-m.label.length)),f=this.settingsListTheme.label(g,c),w=this.settingsListTheme.value(m.value,c);r.push(`${l}${f} ${w}`)}return r}handleInput(t){if(_t(t,Kt.ctrl("s"))||_t(t,Kt.escape)||_t(t,Kt.ctrl("c"))){this.onExit();return}if(_t(t,Kt.up)){this.selectedIndex=this.selectedIndex===0?this.rows.length-1:this.selectedIndex-1;return}if(_t(t,Kt.down)){this.selectedIndex=this.selectedIndex===this.rows.length-1?0:this.selectedIndex+1;return}if(_t(t,Kt.enter)||_t(t,Kt.return)||t===" "){let r=this.rows[this.selectedIndex];if(!r)return;if(r.kind==="model"){this.onActivateModel(r.id);return}if(!r.values||r.values.length===0)return;let n=ut();if(!n){this.ctx.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");return}let a=n.solverGap??Sa,i=r.values.indexOf(r.value),m=r.values[(i+1)%r.values.length];if(m===void 0)return;r.id==="reviewer-thinking"?ct({...n,thinkingLevel:m,solverGap:a}):r.id==="solvergap-thinking"?ct({...n,solverGap:{...a,thinkingLevel:m}}):r.id==="solvergap-timeout"?ct({...n,solverGap:{...a,timeoutMinutes:Number.parseInt(m,10)}}):r.id==="solvergap-solver-count"?ct({...n,solverGap:{...a,solverCount:Number.parseInt(m,10)}}):r.id==="solvergap-save-artifacts"&&ct({...n,solverGap:{...a,saveArtifacts:m==="on"}}),this.refresh(),this.onCycleSaved()}}};async function yv(e){if(e.mode!=="tui"){e.ui.notify("/checks --config requires interactive mode","error");return}let t=0;for(;;){let r=await e.ui.custom((i,m,c,l)=>{let g=new Jo(e,lv(),m,()=>i.requestRender(),w=>l(w),()=>l(void 0));g.selectedIndex=t;let f=new dv;return f.addChild(new hf(m.bold(m.fg("accent","Checks settings")))),f.addChild({render:w=>g.render(w),invalidate:()=>g.invalidate()}),f.addChild(new fv(1)),f.addChild(new hf(m.fg("dim","\u2191\u2193 navigate enter select ctrl+s save & exit esc cancel"))),{render(w){return f.render(w)},invalidate(){f.invalidate()},handleInput(w){g.handleInput(w),t=g.selectedIndex,i.requestRender()}}});if(!r)return;let n=ut(),a=n?.solverGap??Sa;if(r==="reviewer-model"){let i=await yf(e,n,"Select reviewer model");if(!i)continue;let m=Oa(e,i.provider,i.modelId),c=m.includes(n?.thinkingLevel??"off")?n?.thinkingLevel??"off":m[0]??"off";ct({...i,thinkingLevel:c,solverGap:a}),e.ui.notify(`Reviewer model saved: ${i.provider}/${i.modelId}`,"info");continue}if(r==="solvergap-model"){if(!n){e.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");continue}let i=await yf(e,a.provider?a:null,"Select solver model");if(!i)continue;let m=Oa(e,i.provider,i.modelId),c=m.includes(a.thinkingLevel)?a.thinkingLevel:m[0]??"off";ct({...n,solverGap:{...a,...i,thinkingLevel:c}}),e.ui.notify(`Solver model saved: ${i.provider}/${i.modelId}`,"info")}}}function bf(e){e.registerCommand("checks",{description:"Find behavioral gaps in test coverage. Requires an option \u2014 see /checks.",getArgumentCompletions:hv,handler:async(t,r)=>{let n=t.trim();if(!n){r.ui.notify(Yo.map(D=>`${D.value} \u2014 ${D.description}`).join(`
|
|
324
|
+
`),"info");return}let a=[...new Set(n.split(/\s+/).filter(Boolean))],i=new Set(Yo.map(D=>D.value)),m=a.filter(D=>!i.has(D));if(m.length){r.ui.notify(`Unknown option(s): ${m.join(", ")}. Run /checks with no arguments to see options.`,"warning");return}if(a.includes("--config")){a.length>1?r.ui.notify("--config cannot be combined with other options.","warning"):await yv(r);return}let c=a.includes("--gap-finder"),l=a.includes("--solver-gap-finder");if(!c&&!l)return;if(Ra()){r.ui.notify("A checks run is already in progress.","warning");return}let g=ut();if(!g){r.ui.notify("No gap-finder model configured. Run /checks --config first.","error");return}let f=r.modelRegistry.find(g.provider,g.modelId);if(!f||!r.modelRegistry.hasConfiguredAuth(f)){r.ui.notify("Configured behavioral gap-finder model is unavailable or unauthenticated. Run /checks --config.","error");return}let w=Wo.filter(D=>!df(Ze(r.cwd,D)));if(w.length){r.ui.notify(`Missing required file(s): ${w.join(", ")}`,"error");return}let F=null,_;if(l){if(F=ui(),!F||!df(Ze(r.cwd,"test.sh"))){r.ui.notify("Configure solver gap finder and provide test.sh before running it.","error");return}if(_=r.modelRegistry.find(F.provider,F.modelId),!_||!r.modelRegistry.hasConfiguredAuth(_)){r.ui.notify("Configured solver gap-finder model is unavailable or unauthenticated.","error");return}}let ue=pf(),Me=F?.solverCount??0,Ae=(c?3:0)+(l?Me+1:0);r.ui.setWidget(Ut,wa("preparing clean snapshot",0,Ae)),r.ui.notify(`gap finders (${a.join(" ")}) started. Press ${gv} to cancel.`,"info");let De,Qe=[];try{let D=Ze(gf(),`checks-${lf()}`);ff(D,{recursive:!0}),De=D;let et=await cn(e,r.cwd,D);if(et.status==="error"){r.ui.notify(`checks: ${et.error}`,"error");return}for(let Re of Wo)pv(Ze(r.cwd,Re),Ze(D,Re));let Ne=sf(),mt=mf(),pt=0,kt={status:"ok",gaps:[]},wt={status:"ok",gaps:[]},zt={status:"ok",gaps:[]};if(c){let Re={tempDir:D,model:f,thinkingLevel:g.thinkingLevel,testRubric:Ne,fairnessRules:mt,cancelSignal:ue.signal};[kt,wt]=await Promise.all([If(Re,"positive"),If(Re,"negative")]),pt+=2,r.ui.setWidget(Ut,wa("validating test gaps",pt,Ae));let hr=[...kt.gaps,...wt.gaps];if(hr.length&&(zt=await ef({...Re,candidates:hr})),pt+=1,ue.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}}let Bt=[],nn={status:"ok",gaps:[]};if(l&&F){let Re=[],hr=tt=>{Re.push(tt),pt+=1,r.ui.setWidget(Ut,wa("solver gap finder: solving",pt,Ae,{passed:Re.filter(Le=>Le.passed).length,failed:Re.filter(Le=>!Le.passed).length}))},Tf=await Promise.all(Array.from({length:Me},async(tt,Le)=>{let yr=Ze(gf(),`checks-solvergap-${lf()}`);return ff(yr,{recursive:!0}),Qe.push(yr),{index:Le+1,setup:await fi({pi:e,repoDir:r.cwd,solverDir:yr,testPatchPath:Ze(r.cwd,"test.patch"),agentPromptPath:Ze(r.cwd,"agent_prompt.md")})}})),kf=Ho().replace(/[:.]/g,"-");if(Bt=await Promise.all(Tf.map(async({index:tt,setup:Le})=>{if(Le.status!=="ok"){let ni={index:tt,status:Le.status,passed:!1,diff:"",testOutputTail:Le.error,durationMs:0,totalTests:null,failedTests:null};return hr(ni),ni}let yr=Date.now(),{outcome:ti,trajectory:wf}=await Zd({pi:e,solverDir:Le.solverDir,model:_,thinkingLevel:F.thinkingLevel,timeoutMinutes:F.timeoutMinutes,cancelSignal:ue.signal}),{testOutputXmlPath:Ef,...Pa}=await gi({pi:e,index:tt,workspace:Le,status:ti==="done"?"ok":ti,durationMs:Date.now()-yr}),Rf=F.saveArtifacts?hi({repoDir:r.cwd,runId:kf,index:tt,trajectory:wf,solutionPatch:Pa.diff,testOutputXmlPath:Ef,testOutputTail:Pa.testOutputTail}):void 0,ri={...Pa,artifactsDir:Rf};return hr(ri),ri})),Bt.some(tt=>tt.status!=="patchFailed"&&tt.status!=="error")&&(yi(D,Bt),nn=await Qd({tempDir:D,model:f,thinkingLevel:g.thinkingLevel,solverResults:Bt,testRubric:Ne,fairnessRules:mt,cancelSignal:ue.signal})),pt+=1,ue.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}}let $f=c&&(kt.status!=="ok"||wt.status!=="ok"||(kt.gaps.length>0||wt.gaps.length>0)&&zt.status!=="ok"),Zo=rf({existingReport:tf(Ze(r.cwd,"shipd_report.json")),config:g,runGapFinder:c,testGaps:zt.gaps,gapAnalysisIncomplete:$f,positiveGapFinderStatus:kt.status,negativeGapFinderStatus:wt.status,gapFilterStatus:zt.status,runSolverGapFinder:l,solverResults:Bt,solverGaps:nn.gaps,solverGapAnalysisIncomplete:l&&(Bt.some(Re=>Re.status==="error")||nn.status!=="ok"),solverComparisonStatus:nn.status}),Qo=af({merged:Zo,runGapFinder:c,runSolverGapFinder:l});e.sendMessage({customType:"shipd_checks_report",content:Qo.content,display:!0,details:Qo.details});let ei=Ze(r.cwd,"shipd_report.json");cv(ei,JSON.stringify(Zo,null,2),"utf-8"),r.ui.notify(`checks: wrote details to ${ei}`,"info")}catch(D){r.ui.notify(`checks failed: ${D instanceof Error?D.message:String(D)}`,"error")}finally{r.ui.setWidget(Ut,void 0),De&&uv(De,{recursive:!0,force:!0});for(let D of Qe)xi(D);uf()}}})}async function If(e,t){return Xd({...e,kind:t})}var vf=Iv.ctrlShift("x");function vv(e){e.registerMessageRenderer("shipd_checks_report",(t,r,n)=>{let a=t.details??{},i=new xv;i.addChild(new Xo(n.bold(n.fg("accent","Checks")),0,0));let m=!1,c=l=>{i.addChild(new Xo(l,0,0)),m=!0};if(a.showGaps){let l=a.gapsCount??0;c(l>0?n.fg("warning",` \u26A0 ${l} test gap(s) found`):n.fg("success"," \u2713 no test gaps found"))}if(a.showSolverGaps){let l=a.solverDetails??[],g=l.filter(_=>_.passed).length,f=a.solverGapsCount??0;i.addChild(new bv(1)),c(n.bold(n.fg("accent","Solver gap finder")));for(let _ of l){let ue=_.passed?n.fg("success","\u2713"):n.fg("error","\u2717"),Me=_.passed?"passed":_.status==="ok"?"failed tests":_.status;c(` ${ue} Solver ${_.index}: ${Me} (${nf(_.durationMs)})`)}let w=g===l.length&&l.length>0?n.fg("success",`${g}/${l.length} solvers passed`):n.fg("warning",`${g}/${l.length} solvers passed`),F=f>0?n.fg("warning",`${f} behavioral gap(s) found`):n.fg("success","no behavioral gaps found");c(` ${w}, ${F}`)}return m||i.addChild(new Xo(n.fg("dim"," nothing to report"),0,0)),i}),e.registerShortcut(vf,{description:"Cancel an in-progress /checks run",handler:t=>{Ra()&&cf()&&(t.ui.setWidget(Ut,[`checks: cancelling (${vf})...`]),t.ui.notify("checks: cancelling...","warning"))}}),bf(e)}export{vv as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sreetej510/pi-shipd-checks",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Pi extension that runs a strict, multi-agent fairness review of a benchmark task's agent_prompt.md, test.patch, and solution.patch, plus behavioral test-gap analysis, via /checks.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|