@sreetej510/pi-shipd-checks 0.1.23 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +17 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _f=Object.defineProperty;var Rt=(e,t)=>{for(var n in t)_f(e,n,{get:t[n],enumerable:!0})};import{Container as Wv,Key as Hv,Spacer as Yv,Text as di}from"@earendil-works/pi-tui";import{randomUUID as Pf}from"node:crypto";import{copyFileSync as Dv,existsSync as Af,mkdirSync as Cf,rmSync as Gv,writeFileSync as Nv}from"node:fs";import{tmpdir as Mf}from"node:os";import{join as et}from"node:path";import{getSettingsListTheme as Uv}from"@earendil-works/pi-coding-agent";import{Container as _v,Key as _t,matchesKey as Kt,Spacer as Kv,Text as Lf}from"@earendil-works/pi-tui";import{createAgentSession as wa,SessionManager as Ea}from"@earendil-works/pi-coding-agent";import{copyFileSync as Yf,existsSync as Ha,lstatSync as Jf,mkdirSync as Ya,readFileSync as gr,rmSync as Pi,symlinkSync as Zf,unlinkSync as Xf,writeFileSync as ot}from"node:fs";import{join as fe}from"node:path";import{existsSync as cr,mkdirSync as Kf,readFileSync as Ka,writeFileSync as zf}from"node:fs";import{dirname as Bf,join as bi}from"node:path";import{getAgentDir as vi}from"@earendil-works/pi-coding-agent";var pr=bi(vi(),"checks-config.json"),ur=bi(vi(),"settings.json"),$i=10,Ti=60,za=20,Ba=1,ki=5,Va=3,Wa=!0,Vf=!1,Wf=["off","minimal","low","medium","high","xhigh","max"];function wi(e){return e?.reasoning?Wf.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t==="xhigh"||t==="max"?n!==void 0:!0}):["off"]}function Ee(){try{if(!cr(pr))return null;let e=JSON.parse(Ka(pr,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function Fe(e){let t=Bf(pr);cr(t)||Kf(t,{recursive:!0}),zf(pr,JSON.stringify(e,null,2),"utf-8")}function Ei(){let e=Ee()?.solverGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e,timeoutMinutes:e.timeoutMinutes>0?e.timeoutMinutes:za,solverCount:e.solverCount>0?e.solverCount:Va,saveArtifacts:typeof e.saveArtifacts=="boolean"?e.saveArtifacts:Wa}}function xn(){return Ee()?.enableAnalyzeTool??Vf}function Ri(){let e=Ee()?.analyzeGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e}}function Si(){try{return cr(ur)?JSON.parse(Ka(ur,"utf-8")).enabledModels??[]:[]}catch{return[]}}function Oi(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function Hf(){try{if(cr(ur))return JSON.parse(Ka(ur,"utf-8"))}catch{}return{}}function lr(){let e=Hf().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function dr(e){return e.replace(/\\/g,"/")}function fr(e){return`'${e.replace(/'/g,"'\\''")}'`}async function hr(e,t,n){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 ${fr(dr(n))}`,i=await e.exec(lr(),["-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 Ja=3e4,Qf=4e3,eh=".pi/shipd-checks",In="solver_gap_solutions";function th(e){let t=new Set,n=/^diff --git "?a\/(.+?)"? "?b\/(.+?)"?$/gm;for(let r of e.matchAll(n))r[1]&&t.add(r[1]),r[2]&&t.add(r[2]);return[...t]}function nh(e,t){return e.length>t?e.slice(e.length-t):e}async function Ai(e){let{pi:t,repoDir:n,solverDir:r,testPatchPath:a,agentPromptPath:i}=e,m=await hr(t,n,r);if(m.status==="error")return{status:"error",solverDir:r,error:m.error};let u={cwd:r,timeout:Ja},l=await t.exec("git",["init"],u);if(l.code!==0)return{status:"error",solverDir:r,error:l.stderr?.trim()||"git init failed"};await t.exec("git",["config","user.email","solvergap@shipd-checks.local"],u),await t.exec("git",["config","user.name","shipd-checks solver-gap-finder"],u);let f=await t.exec("git",["add","-A"],u);if(f.code!==0)return{status:"error",solverDir:r,error:f.stderr?.trim()||"git add (baseline) failed"};let h=await t.exec("git",["commit","-m","baseline","--allow-empty"],u);if(h.code!==0)return{status:"error",solverDir:r,error:h.stderr?.trim()||"git commit (baseline) failed"};let $=fe(r,".gitignore"),E=Ha($)?gr($,"utf-8"):"";if(!E.split(/\r?\n/).some(ct=>ct.trim()==="node_modules")){let ct=E.length>0&&!E.endsWith(`
|
|
2
2
|
`)?`
|
|
3
|
-
`:"";ot($,`${
|
|
4
|
-
`,"utf-8")}let
|
|
5
|
-
${re.stderr}`.trim(),Zf),{totalTests:N,failedTests:nt}=nh(C);return{index:n,status:a,passed:Pe,diff:P,testOutputTail:tt,durationMs:i,totalTests:N,failedTests:nt,testOutputXmlPath:C}}function Ci(e){let{repoDir:t,runId:n,index:r,trajectory:a,solutionPatch:i,testOutputXmlPath:m,testOutputTail:u}=e,l=le(t,Qf,n,`solver_${r}`);Ya(l,{recursive:!0}),ot(le(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),ot(le(l,"solution.patch"),i,"utf-8");try{let f=yr(m,"utf-8");ot(le(l,"test_output.xml"),f,"utf-8")}catch{ot(le(l,"test_output.txt"),u,"utf-8")}return l}function Mi(e,t){let n=le(e,In);Ya(n,{recursive:!0});let r=t.map(a=>{let i=le(n,`solver_${a.index}`);return Ya(i,{recursive:!0}),ot(le(i,"solution.diff"),a.diff,"utf-8"),ot(le(i,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return ot(le(n,"manifest.json"),JSON.stringify(r,null,2),"utf-8"),n}function Li(e){let t=le(e,"node_modules");try{Yf(t).isSymbolicLink()&&Oi(t,{force:!0})}catch{}try{Oi(e,{recursive:!0,force:!0})}catch{}}var p={};Rt(p,{Assign:()=>rh,Clone:()=>Tn,Create:()=>pg,Discard:()=>ug,Metrics:()=>De,Update:()=>cg});var De={assign:0,create:0,clone:0,discard:0,update:0};function rh(e,t){return De.assign+=1,{...e,...t}}var s={};Rt(s,{Entries:()=>kh,EntriesRegExp:()=>Th,Every:()=>bh,EveryAll:()=>vh,GraphemeCount:()=>yh,HasPropertyKey:()=>$h,IsArray:()=>vn,IsBigInt:()=>bn,IsBoolean:()=>Ki,IsClassInstance:()=>hh,IsConstructor:()=>ph,IsDeepEqual:()=>eo,IsEqual:()=>M,IsFunction:()=>zi,IsGreaterEqualThan:()=>Vi,IsGreaterThan:()=>lh,IsInteger:()=>Za,IsLessEqualThan:()=>Bi,IsLessThan:()=>dh,IsMaxLength:()=>xh,IsMinLength:()=>Ih,IsMultipleOf:()=>fh,IsNull:()=>br,IsNumber:()=>vr,IsObject:()=>$n,IsObjectNotArray:()=>uh,IsString:()=>$r,IsSymbol:()=>ch,IsUndefined:()=>Qa,IsUnsafePropertyKey:()=>Wi,IsValueLike:()=>gh,Keys:()=>Ir,ShiftLeft:()=>Tr,Symbols:()=>wh,Values:()=>Eh});function St(e,t,n){return e>=t&&e<=n}function ah(e){return e===8205}function oh(e){return St(e,55296,56319)}function qi(e){return St(e,127462,127487)}function Fi(e){return St(e,65024,65039)}function Di(e){return St(e,768,879)||St(e,6832,6911)||St(e,7616,7679)||St(e,65056,65071)}function xr(e){return e>65535?2:1}function ji(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Di(n)||Fi(n))t+=xr(n);else break}return t}function Xa(e,t){let n=e.codePointAt(t),r=t+xr(n);for(r=ji(e,r);r<e.length-1&&e[r]==="\u200D";){let a=e.codePointAt(r+1);r+=1+xr(a),r=ji(e,r)}return qi(n)&&r<e.length&&qi(e.codePointAt(r))&&(r+=xr(e.codePointAt(r))),r}function Gi(e){return oh(e)||Di(e)||Fi(e)||ah(e)}function Ni(e){let t=0,n=0;for(;n<e.length;)n=Xa(e,n),t++;return t}function ih(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=Xa(e,r),n++,n>=t)return!0;return!1}function sh(e,t){let n=0,r=0;for(;r<e.length;)if(r=Xa(e,r),n++,n>t)return!1;return!0}function Ui(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Gi(e.charCodeAt(n)))return ih(e,t);if(n++,n>=t)return!0}return!1}function _i(e,t){let n=0;for(;n<e.length;){if(Gi(e.charCodeAt(n)))return sh(e,t);if(n++,n>t)return!1}return!0}function vn(e){return Array.isArray(e)}function bn(e){return M(typeof e,"bigint")}function Ki(e){return M(typeof e,"boolean")}function ph(e){if(Qa(e)||!zi(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function zi(e){return M(typeof e,"function")}function Za(e){return Number.isInteger(e)}function br(e){return M(e,null)}function vr(e){return Number.isFinite(e)}function uh(e){return $n(e)&&!vn(e)}function $n(e){return M(typeof e,"object")&&!br(e)}function $r(e){return M(typeof e,"string")}function ch(e){return M(typeof e,"symbol")}function Qa(e){return M(e,void 0)}function M(e,t){return e===t}function lh(e,t){return e>t}function dh(e,t){return e<t}function Bi(e,t){return e<=t}function Vi(e,t){return e>=t}function fh(e,t){if(bn(e)||bn(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!vr(e)||Za(e)&&1/t%1===0)return!0;let r=e%t;return Math.min(Math.abs(r),Math.abs(r-t),Math.abs(r+t))<n}function hh(e){if(!$n(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return br(t)?!1:M(typeof t.constructor,"function")&&!(M(t.constructor,globalThis.Object)||M(t.constructor.name,"Object"))}function gh(e){return bn(e)||Ki(e)||br(e)||vr(e)||$r(e)||Qa(e)}function yh(e){return Ni(e)}function xh(e,t){return _i(e,t)}function Ih(e,t){return Ui(e,t)}function bh(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function vh(e,t,n){let r=!0;for(let a=t;a<e.length;a++)n(e[a],a)||(r=!1);return r}function Tr(e,t,n){return M(e.length,0)?n():t(e[0],e.slice(1))}function Wi(e){return M(e,"__proto__")||M(e,"constructor")||M(e,"prototype")}function $h(e,t){return Wi(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Th(e){return Ir(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function kh(e){return Object.entries(e)}function Ir(e){return Object.getOwnPropertyNames(e)}function wh(e){return Object.getOwnPropertySymbols(e)}function Eh(e){return Object.values(e)}function Rh(e,t){if(!$n(t))return!1;let n=Ir(e);return M(n.length,Ir(t).length)&&n.every(r=>eo(e[r],t[r]))}function Sh(e,t){return vn(t)&&M(e.length,t.length)&&e.every((n,r)=>eo(e[r],t[r]))}function eo(e,t){return vn(e)?Sh(e,t):$n(e)?Rh(e,t):M(e,t)}var ft={};Rt(ft,{IsBigInt64Array:()=>Kh,IsBigUint64Array:()=>zh,IsBoolean:()=>Ph,IsDate:()=>Vh,IsFloat32Array:()=>Uh,IsFloat64Array:()=>_h,IsInt16Array:()=>Fh,IsInt32Array:()=>Gh,IsInt8Array:()=>Lh,IsMap:()=>Hh,IsNumber:()=>Ah,IsRegExp:()=>Bh,IsSet:()=>Wh,IsString:()=>Ch,IsTypeArray:()=>Mh,IsUint16Array:()=>Dh,IsUint32Array:()=>Nh,IsUint8Array:()=>qh,IsUint8ClampedArray:()=>jh});function Ph(e){return e instanceof Boolean}function Ah(e){return e instanceof Number}function Ch(e){return e instanceof String}function Mh(e){return globalThis.ArrayBuffer.isView(e)}function Lh(e){return e instanceof globalThis.Int8Array}function qh(e){return e instanceof globalThis.Uint8Array}function jh(e){return e instanceof globalThis.Uint8ClampedArray}function Fh(e){return e instanceof globalThis.Int16Array}function Dh(e){return e instanceof globalThis.Uint16Array}function Gh(e){return e instanceof globalThis.Int32Array}function Nh(e){return e instanceof globalThis.Uint32Array}function Uh(e){return e instanceof globalThis.Float32Array}function _h(e){return e instanceof globalThis.Float64Array}function Kh(e){return e instanceof globalThis.BigInt64Array}function zh(e){return e instanceof globalThis.BigUint64Array}function Bh(e){return e instanceof globalThis.RegExp}function Vh(e){return e instanceof globalThis.Date}function Wh(e){return e instanceof globalThis.Set}function Hh(e){return e instanceof globalThis.Map}function Jh(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function Xh(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let r of Object.keys(n)){if(s.IsUnsafePropertyKey(r))continue;let a=n[r];s.HasPropertyKey(a,"value")&&Object.defineProperty(t,r,{...a,value:Ot(a.value)})}return t}function Zh(e){let t={};for(let n of s.Keys(e))s.IsUnsafePropertyKey(n)||(t[n]=Ot(e[n]));for(let n of s.Symbols(e))t[n]=Ot(e[n]);return t}function Qh(e){return s.IsClassInstance(e)?e:Jh(e)?Xh(e):Zh(e)}function eg(e){return e.map(t=>Ot(t))}function tg(e){return e.slice()}function ng(e){return new RegExp(e.source,e.flags)}function rg(e){return new Map(Ot([...e.entries()]))}function ag(e){return new Set(Ot([...e.values()]))}function Ot(e){return ft.IsTypeArray(e)?tg(e):ft.IsRegExp(e)?ng(e):ft.IsMap(e)?rg(e):ft.IsSet(e)?ag(e):s.IsArray(e)?eg(e):s.IsObject(e)?Qh(e):e}function Tn(e){return De.clone+=1,Ot(e)}var Pt={};Rt(Pt,{Get:()=>sg,Reset:()=>og,Set:()=>ig});var it={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function og(){it.immutableTypes=!1,it.maxErrors=8,it.useAcceleration=!0,it.exactOptionalPropertyTypes=!1,it.enumerableKind=!1,it.correctiveParse=!1,it.unionPrioritySort=!0}function ig(e){for(let t of s.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(it,t,{value:n})}}function sg(){return it}function mg(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Hi(e,t){return{...e,...t}}function pg(e,t,n={}){De.create+=1;let r=Pt.Get(),a=Hi(t,n),i=r.enumerableKind?Hi(a,e):mg(a,e);return r.immutableTypes?Object.freeze(i):i}function ug(e,t){De.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(Tn(e)),a=new Set(t);for(let i of Object.keys(r))a.has(i)||Object.defineProperty(n,i,r[i]);return n}function cg(e,t,n){De.update+=1;let r=Pt.Get(),a=Tn(e);for(let i of Object.keys(t))Object.defineProperty(a,i,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[i]});for(let i of Object.keys(n))Object.defineProperty(a,i,{configurable:!0,enumerable:!0,writable:!0,value:n[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,n){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function ht(e){return y(e,"Deferred")}function lg(e){return p.Update(e,{"~readonly":!0},{})}function kn(e,t){return p.Update(lg(e),{},t)}function Yi(e,t,n,r){let a=d(e,t,n);return kn(a,r)}function dg(e){return p.Update(e,{"~optional":!0},{})}function wn(e,t){return p.Update(dg(e),{},t)}function Ji(e,t,n,r){let a=d(e,t,n);return wn(a,r)}function Ee(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function K(e){return y(e,"Array")}function kr(e){return p.Discard(e,["~kind","type","items"])}function _e(e,t,n={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function ae(e){return y(e,"Constructor")}function Xi(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ke(e,t,n={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function oe(e){return y(e,"Function")}function Zi(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function st(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function ie(e){return y(e,"Ref")}function gt(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Bt(e){return y(e,"Generic")}function Vt(e){return p.Create({"~kind":"Any"},{},e)}function J(e){return y(e,"Any")}var Qi="(?!)";function F(e){return p.Create({"~kind":"Never"},{not:{}},e)}function yt(e){return y(e,"Never")}function ze(e,t={}){return I("AddOptional",[e],t)}function At(e,t={}){return wn(e,t)}function es(e){return At(e)}function de(e){return ee(e)&&s.HasPropertyKey(e,"~optional")}function ts(e){return s.Keys(e).filter(t=>!de(e[t]))}function wr(e){return s.Keys(e)}function Er(e){return s.Values(e)}function v(e,t={}){let n=ts(e),r=n.length>0?{required:n}:{};return p.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function L(e){return y(e,"Object")}function ns(e){return p.Discard(e,["~kind","type","properties","required"])}function se(e){return p.Create({"~kind":"Unknown"},{},e)}function te(e){return y(e,"Unknown")}function Be(e,t,n){let r=s.Keys(e).reduce((a,i)=>({...a,[i]:p.Update(e[i],{},{$id:i})}),{});return p.Create({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function pe(e){return y(e,"Cyclic")}function rs(e){return p.Update(e,{"~unsafe":null},{})}function Rr(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}var Ve={};Rt(Ve,{Match:()=>fg});function fg(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function En(...e){let[t,n]=Ve.Match(e,{2:(r,a)=>[r,a,a],1:r=>[r,se(),se()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function H(e){return y(e,"Infer")}function Ct(e,t,n,r={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function V(e){return y(e,"Dependent")}function as(e){return p.Discard(e,["~kind","if","then","else"])}function os(e){return s.IsObjectNotArray(e)}function is(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function ss(e){return s.IsString(e)||s.IsNumber(e)}function ms(e,t){let n=os(e)?is(e):e;return p.Create({"~kind":"Enum"},{enum:n},t)}function he(e){return y(e,"Enum")}function fe(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function S(e){return y(e,"Intersect")}function ps(e){return p.Discard(e,["~kind","allOf"])}function Y(){throw new Error("Unreachable")}var us;(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"})(us||(us={}));var mk=BigInt("14695981039346656037"),[pk,uk]=[BigInt("1099511628211"),BigInt("18446744073709551616")],ck=Array.from({length:256}).map((e,t)=>BigInt(t)),cs=new Float64Array(1),lk=new DataView(cs.buffer),dk=new Uint8Array(cs.buffer);var fk=new TextEncoder;var Rn=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=Sr(n)?m=>this.decode(n["~codec"].decode(m)):this.decode,a=Sr(n)?m=>n["~codec"].encode(t(m)):t,i={decode:r,encode:a};return p.Update(this.type,{"~codec":i},{})}},Sn=class{constructor(t){this.type=t}Decode(t){return new Rn(this.type,t)}};function Or(e){return new Sn(e)}function ds(e,t){return Or(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function fs(e,t){return Or(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function Sr(e){return ee(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function hs(e){return Wt(e)}function Mt(e){return ee(e)&&s.HasPropertyKey(e,"~immutable")}function We(e,t={}){return I("AddReadonly",[e],t)}function Lt(e,t={}){return kn(e,t)}function gs(e){return Lt(e)}function qt(e){return ee(e)&&s.HasPropertyKey(e,"~readonly")}function xg(e,t){let n=to(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":n},{})}function ys(...e){let[t,n,r]=Ve.Match(e,{3:(a,i,m)=>[a,i,m],2:(a,i)=>[a,i,()=>"Refine Error"]});return xg(t,{check:n,error:r})}function Ig(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function to(e){return ee(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>Ig(t))}var xs="-?(?:0|[1-9][0-9]*)n";function On(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function He(e){return y(e,"BigInt")}function Pr(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Ae(e){return y(e,"Boolean")}function Pn(e){return p.Create({"~kind":"Identifier"},{name:e})}function Is(e){return y(e,"Identifier")}var Ar="-?(?:0|[1-9][0-9]*)";function jt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function ge(e){return y(e,"Integer")}var no=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function bg(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new no(e)})()}function O(e,t){return p.Create({"~kind":"Literal"},{type:bg(e),const:e},t)}function Cr(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function bs(e){return q(e)&&s.IsNumber(e.const)}function vs(e){return q(e)&&s.IsString(e.const)}function q(e){return y(e,"Literal")}function Ht(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Yt(e){return y(e,"Null")}var Mr="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function $e(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function X(e){return y(e,"Number")}function Jt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function xt(e){return y(e,"Symbol")}function Ft(...e){let[t,n,r]=Ve.Match(e,{3:(a,i,m)=>[a,i,m],2:(a,i)=>[a,i,i],1:a=>[a,se(),se()]});return p.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function $s(e){return y(e,"Parameter")}var Lr=".*";function Ce(e){return p.Create({"~kind":"String"},{type:"string"},e)}function ye(e){return y(e,"String")}function w(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return y(e,"Union")}function Ts(e){return p.Discard(e,["~kind","anyOf"])}function An(e){let t=ks(e);return s.IsEqual(t.length,2)?t[0]:[]}function vg(e){return!0}function ws(e){return s.ShiftLeft(e,(t,n)=>$g(t)?ws(n):!1,()=>!0)}function Es(e){return s.IsEqual(e.length,0)?!1:ws(e)}function $g(e){return x(e)?Es(e.anyOf):q(e)?vg(e.const):!1}function qr(e){return Es(e)}function jr(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Rs(e,t,n=[]){return s.ShiftLeft(e,(r,a)=>Rs(a,t,[...n,`${r}${t}`]),()=>n)}function Tg(e,t){return s.IsEqual(e.length,0)?[`${t}`]:Rs(e,t)}function Ss(e,t,n=[]){return s.ShiftLeft(t,(r,a)=>Ss(e,a,[...n,...Os(e,r)]),()=>n)}function Os(e,t){return x(t)?Ss(e,t.anyOf):q(t)?Tg(e,t.const):Y()}function Ps(e,t){return s.ShiftLeft(t,(n,r)=>Ps(Os(e,n),r),()=>e)}function kg(e){return e.map(t=>O(t))}function wg(e){let t=Ps([],e),n=kg(t);return w(n)}function Eg(e){return s.IsEqual(e.length,0)?Y():s.IsEqual(e.length,1)&&q(e[0])?e[0]:wg(e)}function ro(e){let t=An(e);return s.IsEqual(t.length,0)?Ce():qr(t)?Eg(t):jr(e)}function As(e){let t=ro(e);return Z(t)?Ce():t}function be(e,t){let n="object",r={[e]:t};return p.Create({"~kind":"Record"},{type:n,patternProperties:r})}function Cs(e){return be(Ge,e)}function Ms(e){return v({true:e,false:e})}function Q(e,t={}){let[n,r,a]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:a,items:n,minItems:r},t)}function G(e){return y(e,"Tuple")}function Ls(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Rg(e){return p.Discard(e,["~readonly"])}function ao(e,t){return p.Update(Rg(e),{},t)}function qs(e,t,n,r){let a=d(e,t,n);return ao(a,r)}function js(e,t={}){return I("RemoveReadonly",[e],t)}function Fs(e,t={}){return ao(e,t)}function Sg(e){return p.Discard(e,["~optional"])}function oo(e,t){return p.Update(Sg(e),{},t)}function Ds(e,t,n,r){let a=d(e,t,n);return oo(a,r)}function Gs(e,t={}){return I("RemoveOptional",[e],t)}function Fr(e,t={}){return oo(e,t)}function io(e){return e.reduceRight((n,r,a)=>({[a]:r,...n}),{})}function Ns(e){let t=io(e.items);return v(t)}function Og(e,t){return qt(e)?!!qt(t):!1}function Pg(e,t){return de(e)?!!de(t):!1}function Ag(e,t){let n=Og(e,t),r=Pg(e,t),a=z([e,t]),i=Fs(Fr(a));return n&&r?Lt(At(i)):n&&!r?Lt(i):!n&&r?At(i):i}function Cg(e,t,n){return n in e?n in t?Ag(e[n],t[n]):e[n]:n in t?t[n]:F()}function Mg(e,t){return[...new Set([...s.Keys(t),...s.Keys(e)])].reduce((r,a)=>({...r,[a]:Cg(e,t,a)}),{})}function Us(e){return L(e)?e.properties:G(e)?io(e.items):Y()}function _s(e,t){let n=Us(e),r=Us(t),a=Mg(n,r);return v(a)}function Ks(e,t){let n=Xt(e,t);return s.IsEqual(n,Mn)?e:s.IsEqual(n,Ln)||s.IsEqual(n,Cn)?t:F()}function zs(e){return L(e)||G(e)}function Lg(e,t){let n=x(e),r=x(t);return n||r}function qg(e,t){let n=Me(e),r=Me(t),a=Lg(n,r),i=zs(n),m=zs(r);return a?z([n,r]):i&&m?_s(n,r):i&&!m?n:!i&&m?r:Ks(n,r)}function Bs(e,t,n=[]){return s.ShiftLeft(t,(r,a)=>Bs(e,a,[...n,qg(e,r)]),()=>s.IsEqual(n.length,0)?[e]:n)}function Vs(e,t,n=[]){return s.ShiftLeft(e,(r,a)=>Vs(a,t,[...n,...qn([r],t)]),()=>n)}function qn(e,t=[]){return s.ShiftLeft(e,(n,r)=>x(n)?qn(r,Vs(n.anyOf,t)):qn(r,Bs(n,t)),()=>t)}function jg(e,t){let n=ue({},e,t);return b.IsExtendsTrueLike(n)?[]:[e]}function Fg(e,t){return e.reduce((n,r)=>[...n,...jg(r,t)],[])}function Dr(e,t){let n=Me(e),r=x(n)?n.anyOf:[n],a=Fg(r,t);return Te(a)}function Ne(e,t,n){let r=fe([e,t]),a=Dr(n,e);return Te([r,a])}function Re(e){let t=e.map(n=>O(n));return Te(t)}function z(e){let t=qn(e),n=so(t);return mt(n)}function ve(e){let t=As(e);return Me(t)}function Te(e){let t=so(e);return mt(t)}function Me(e){return V(e)?Ne(e.if,e.then,e.else):he(e)?Re(e.enum):S(e)?z(e.allOf):Z(e)?ve(e.pattern):x(e)?Te(e.anyOf):e}function mt(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?F():w(e)}function Ws(e,t){let n=Re(e);return It(n,t)}function Hs(e,t){return be(bt,t)}function Ys(e,t){let n=z(e);return It(n,t)}function Js(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 Xs(e,t){return be(Zt,t)}function Zs(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?be(e.pattern.toString(),t):be(Ge,t)}function Qs(e,t){let n=An(e);return qr(n)?It(ve(e),t):be(e,t)}function Dg(e){return x(e)?jn(e.anyOf):[e]}function jn(e){return e.reduce((t,n)=>[...t,...Dg(n)],[])}function Gg(e){return e.some(t=>ye(t)||X(t)||ge(t))}function Ng(e,t){return s.IsEqual(Gg(e),!0)?be(Ge,t):void 0}function Ug(e,t){return e.reduce((n,r)=>q(r)&&(s.IsString(r.const)||s.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function _g(e,t){let n=Ug(e,t);return v(n)}function em(e,t){let n=jn(e),r=Ng(n,t);return ee(r)?r:_g(n,t)}function It(e,t){return J(e)?Cs(t):Ae(e)?Ms(t):he(e)?Ws(e.enum,t):ge(e)?Hs(e,t):S(e)?Ys(e.allOf,t):q(e)?Js(e.const,t):X(e)?Xs(e,t):x(e)?em(e.anyOf,t):ye(e)?Zs(e,t):Z(e)?Qs(e.pattern,t):v({})}function mo(e,t,n){return k([e])?p.Update(It(e,t),{},n):Gr(e,t,n)}function tm(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return mo(i,m,a)}var bt=`^${Ar}$`,Zt=`^${Mr}$`,Ge=`^${Lr}$`;function Gr(e,t,n={}){return I("Record",[e,t],n)}function Nr(e,t,n={}){return mo(e,t,n)}function nm(e,t){return be(e,t)}function Ur(e){return s.IsEqual(e,Ge)?Ce():s.IsEqual(e,bt)?jt():s.IsEqual(e,Zt)?$e():ro(e)}function Le(e){return s.Keys(e.patternProperties)[0]}function Qt(e){let t=Le(e);return Ur(t)}function xe(e){return e.patternProperties[Le(e)]}function ce(e){return y(e,"Record")}function Dt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function vt(e){return y(e,"Rest")}function _r(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function Kr(e){return y(e,"This")}function en(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function tn(e){return y(e,"Undefined")}function zr(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Ye(e){return y(e,"Void")}function zg(e,t){return s.IsEqual(e,"Array")?Ee(t[0]):s.IsEqual(e,"Capitalize")?Vr(t[0]):s.IsEqual(e,"ConstructorParameters")?Xr(t[0]):s.IsEqual(e,"Evaluate")?au(t[0]):s.IsEqual(e,"Exclude")?Zr(t[0],t[1]):s.IsEqual(e,"Extract")?Qr(t[0],t[1]):s.IsEqual(e,"Index")?Nn(t[0],t[1]):s.IsEqual(e,"InstanceType")?ea(t[0]):s.IsEqual(e,"Lowercase")?Wr(t[0]):s.IsEqual(e,"NonNullable")?ta(t[0]):s.IsEqual(e,"Omit")?na(t[0],t[1]):s.IsEqual(e,"Parameters")?ra(t[0]):s.IsEqual(e,"Partial")?aa(t[0]):s.IsEqual(e,"Pick")?oa(t[0],t[1]):s.IsEqual(e,"Readonly")?ia(t[0]):s.IsEqual(e,"KeyOf")?Un(t[0]):s.IsEqual(e,"Record")?Gr(t[0],t[1]):s.IsEqual(e,"Required")?sa(t[0]):s.IsEqual(e,"ReturnType")?ma(t[0]):s.IsEqual(e,"Uncapitalize")?Hr(t[0]):s.IsEqual(e,"Uppercase")?Yr(t[0]):Gn(st(e),t)}function Gt(){throw Error("Unreachable")}var Bg=(e,t=[])=>e.reduce((n,r)=>s.IsArray(r)&&s.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),pt=e=>{let[t,n]=e;return Bg([...t,...n])};function sm(e){return Ft(e[0],e[2],e[4])}function mm(e){return Ft(e[0],e[2],e[2])}function pm(e){return Ft(e[0],se(),e[2])}function um(e){return Ft(e,se(),se())}function cm(e){return pt(e)}function lm(e){return e[1]}function dm(e){return pt(e)}function fm(e){return e[1]}function hm(e){return zg(e[0],e[1])}function gm(e){return null}function ym(e){return Ce()}function xm(e){return $e()}function Im(e){return Pr()}function bm(e){return en()}function vm(e){return Ht()}function $m(e){return jt()}function Tm(e){return On()}function km(e){return se()}function wm(e){return Vt()}function Em(e){return v({})}function Rm(e){return F()}function Sm(e){return Jt()}function Om(e){return zr()}function Pm(e){return _r()}function Am(e){return O(BigInt(e))}function Cm(e){return O(s.IsEqual(e,"true"))}function Mm(e){return O(parseFloat(e))}function Lm(e){return O(e)}function qm(e){return e[1]}function jm(e){return O(e)}function Fm(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Dm(e){return e[1]}function Gm(e){return Br(e)}function Nm(e){return s.IsEqual(e.length,6)?Ct(e[1],e[3],e[5]):Ct(e[1],e[3],se())}function Um(e){return e.length>0}function _m(e){return e.reduce((t,n)=>s.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function Km(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function zm(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function Bm(e){return s.IsEqual(e.length,2)?e[1]:[]}function rm(e,t){return t.reduce((n,r)=>{let a=r;return s.IsEqual(a.length,1)?Nn(n,a[0]):s.IsEqual(a.length,0)?Ee(n):Gt()},e)}function am(e,t){return s.IsEqual(t.length,3)?Jr(e,t[0],t[1],t[2]):e}function Vg(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:pa(e,t)}function Vm(e){let[t,n,r,a,i]=e;return Vg(am(t?Un(rm(n,r)):rm(n,r),a),i)}function po(e,t){return s.IsEqual(t.length,3)?(()=>{let[n,r,a]=t,i=po(r,a);if(s.IsEqual(n,"&"))return S(i)?fe([e,...i.allOf]):fe([e,i]);if(s.IsEqual(n,"|"))return x(i)?w([e,...i.anyOf]):w([e,i]);Gt()})():e}function Wm(e){let[t,n]=e;return po(t,n)}function Hm(e){let[t,n]=e;return po(t,n)}function Ym(e){return ru(e[1])}function Jm(e){return e[1]}function Xm(e){return gt(e[0],e[2])}function Zm(e){return s.IsEqual(e.length,4)?En(e[1],e[3]):s.IsEqual(e.length,2)?En(e[1],se()):Gt()}function Qm(e){return`${e}`}function ep(e){return ge(e[3])?bt:X(e[3])?Zt:xt(e[3])?Ge:ye(e[3])?Ge:Gt()}function tp(e){return e.length>0}function np(e){return e.length>0}function rp(e){let[t,n,r,a,i]=e;return{[n]:t&&r?We(ze(i)):t&&!r?We(i):!t&&r?ze(i):i}}function ap(e){return pt(e)}function op(e){return e.reduce((t,n)=>s.HasPropertyKey(n,bt)||s.HasPropertyKey(n,Zt)||s.HasPropertyKey(n,Ge)?[t[0],p.Assign(t[1],n)]:[p.Assign(t[0],n),t[1]],[{},{}])}function ip(e){return op(e[1])}function sp(e){let[t,n]=e,r=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return v(t,r)}function mp(e){return s.IsEqual(e.length,5)?We(ze(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?We(e[3]):ze(e[3]):Gt()}function pp(e){return We(ze(e[1]))}function up(e){return We(e[1])}function cp(e){return ze(e[0])}function lp(e){return s.IsEqual(e.length,2)?Dt(e[1]):s.IsEqual(e.length,1)?e[0]:Gt()}function dp(e){return pt(e)}function fp(e){return Q(e[1])}function hp(e){return We(ze(e[4]))}function gp(e){return We(e[3])}function yp(e){return ze(e[3])}function xp(e){return e[2]}function Ip(e){return s.IsEqual(e.length,2)?Dt(e[1]):s.IsEqual(e.length,1)?e[0]:Gt()}function bp(e){return pt(e)}function vp(e){return Ke(e[1],e[4])}function $p(e){return _e(e[2],e[5])}function om(e,t){return s.IsEqual(e,"remove")?js(t):s.IsEqual(e,"add")?We(t):t}function Tp(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 im(e,t){return s.IsEqual(e,"remove")?Gs(t):s.IsEqual(e,"add")?ze(t):t}function kp(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 wp(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function Ep(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?Fn(Pn(e[3]),e[5],e[6][0],om(e[1],im(e[8],e[10]))):Fn(Pn(e[3]),e[5],st(e[3]),om(e[1],im(e[8],e[10])))}function Rp(e){return st(e)}function Sp(e){return BigInt(e)}function Op(e){return parseFloat(e)}function Pp(e){return s.IsEqual(e,"true")}function Ap(e){return null}function Cp(e){return{[e[0]]:e[2]}}function Mp(e){return pt(e)}function Wg(e){return e.reduce((t,n)=>p.Assign(t,n),{})}function Lp(e){return Wg(e[1])}function qp(e){return pt(e)}function jp(e){return e[1]}function Fp(e){return On()}function Dp(e){return Ce()}function Gp(e){return $e()}function Np(e){return jt()}function Up(e){return F()}function _p(e){return O(e)}function Kp(e){return w(e[1])}function zp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Bp(e){return[e[0],...e[1]]}function Vp(e){return e[1]}function Wp(e){return pt(e)}function Hp(e){return s.IsEqual(e.length,2)?e[1]:[]}function Yp(e){let t=e[2],n=e[3],[r,a]=e[4],i=s.IsEqual(s.Keys(a).length,0)?{}:{patternProperties:a};return{[e[1]]:gt(t,Dn(n,r,i))}}function Jp(e){let t=e[2],[n,r]=e[3],a=s.IsEqual(s.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:Dn(t,n,a)}}function Xp(e){return{[e[1]]:gt(e[2],e[4])}}function Zp(e){return{[e[1]]:e[3]}}function Qp(e){return null}function eu(e){return op(pt(e))}function tu(e){return e[1]}function nu(e){let t=e[0],n=e[1];return ou(p.Assign(t,n[0]))}function _n(e){return M(e.length,2)}function E(e,t,n){return _n(e)?t(e[0],e[1]):n()}function Jg(e,t){return M(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function B(e,t){for(let n=0;n<e.length;n++){let r=Jg(e[n],t);if(_n(r))return r}return[]}function uo(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var iu=[...uo(97,122),...uo(65,90)],co="0",lo=uo(49,57),nn=[co,...lo],su=" ",rn=`
|
|
6
|
-
`;var $t="_",
|
|
3
|
+
`:"";ot($,`${E}${ct}node_modules
|
|
4
|
+
`,"utf-8")}let A=fe(n,"node_modules"),H=fe(r,"node_modules");if(Ha(A)&&!Ha(H))try{Zf(A,H,process.platform==="win32"?"junction":"dir")}catch{}try{Yf(i,fe(r,"agent_prompt.md"))}catch{}let te=gr(a,"utf-8"),ne=th(te),ue=fe(r,"test.patch");ot(ue,te,"utf-8");let tt=await t.exec("git",["apply","test.patch"],u);try{Xf(ue)}catch{}if(tt.code!==0)return{status:"patchFailed",solverDir:r,error:tt.stderr?.trim()||"git apply test.patch failed"};let N=await t.exec("git",["add","-A"],u);if(N.code!==0)return{status:"error",solverDir:r,error:N.stderr?.trim()||"git add (tests applied) failed"};let nt=await t.exec("git",["commit","-m","tests applied","--allow-empty"],u);if(nt.code!==0)return{status:"error",solverDir:r,error:nt.stderr?.trim()||"git commit (tests applied) failed"};let Ue=await t.exec("git",["rev-parse","HEAD"],u);return Ue.code!==0||!Ue.stdout.trim()?{status:"error",solverDir:r,error:"Could not resolve tests-applied commit hash."}:{status:"ok",solverDir:r,testsAppliedCommit:Ue.stdout.trim(),testPatchPaths:ne}}function rh(e){try{let t=gr(e,"utf-8").match(/<testsuites\b[^>]*>/i)?.[0];if(!t)return{totalTests:null,failedTests:null};let n=m=>Number.parseInt(t.match(new RegExp(`\\b${m}="(\\d+)"`,"i"))?.[1]??"",10),r=n("tests"),a=n("failures"),i=n("errors");return{totalTests:Number.isFinite(r)?r:null,failedTests:Number.isFinite(a)?a+(Number.isFinite(i)?i:0):null}}catch{return{totalTests:null,failedTests:null}}}async function Ci(e){let{pi:t,index:n,workspace:r,status:a,durationMs:i}=e,{solverDir:m,testsAppliedCommit:u,testPatchPaths:l}=r,f={cwd:m,timeout:Ja};await t.exec("git",["add","-A"],f);let h=[...l,"agent_prompt.md"].map(Ue=>`:(exclude)${Ue}`),$=await t.exec("git",["diff","--cached",u,"--",".",...h],f),E=$.code===0?$.stdout:"",A=fe(m,"test_output.xml"),H=`bash test.sh --output_path ${fr(dr(A))} new`,te=lr(),ne=await t.exec(te,["-c",`cd ${fr(dr(m))} && ${H}`],{timeout:Ja*10}),ue=ne.code===0,tt=nh(`${ne.stdout}
|
|
5
|
+
${ne.stderr}`.trim(),Qf),{totalTests:N,failedTests:nt}=rh(A);return{index:n,status:a,passed:ue,diff:E,testOutputTail:tt,durationMs:i,totalTests:N,failedTests:nt,testOutputXmlPath:A}}function Mi(e){let{repoDir:t,runId:n,index:r,trajectory:a,solutionPatch:i,testOutputXmlPath:m,testOutputTail:u}=e,l=fe(t,eh,n,`solver_${r}`);Ya(l,{recursive:!0}),ot(fe(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),ot(fe(l,"solution.patch"),i,"utf-8");try{let f=gr(m,"utf-8");ot(fe(l,"test_output.xml"),f,"utf-8")}catch{ot(fe(l,"test_output.txt"),u,"utf-8")}return l}function Li(e,t){let n=fe(e,In);Ya(n,{recursive:!0});let r=t.map(a=>{let i=fe(n,`solver_${a.index}`);return Ya(i,{recursive:!0}),ot(fe(i,"solution.diff"),a.diff,"utf-8"),ot(fe(i,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return ot(fe(n,"manifest.json"),JSON.stringify(r,null,2),"utf-8"),n}function qi(e){let t=fe(e,"node_modules");try{Jf(t).isSymbolicLink()&&Pi(t,{force:!0})}catch{}try{Pi(e,{recursive:!0,force:!0})}catch{}}var p={};Rt(p,{Assign:()=>ah,Clone:()=>Tn,Create:()=>ug,Discard:()=>cg,Metrics:()=>De,Update:()=>lg});var De={assign:0,create:0,clone:0,discard:0,update:0};function ah(e,t){return De.assign+=1,{...e,...t}}var s={};Rt(s,{Entries:()=>wh,EntriesRegExp:()=>kh,Every:()=>vh,EveryAll:()=>$h,GraphemeCount:()=>xh,HasPropertyKey:()=>Th,IsArray:()=>vn,IsBigInt:()=>bn,IsBoolean:()=>zi,IsClassInstance:()=>gh,IsConstructor:()=>uh,IsDeepEqual:()=>eo,IsEqual:()=>M,IsFunction:()=>Bi,IsGreaterEqualThan:()=>Wi,IsGreaterThan:()=>dh,IsInteger:()=>Xa,IsLessEqualThan:()=>Vi,IsLessThan:()=>fh,IsMaxLength:()=>Ih,IsMinLength:()=>bh,IsMultipleOf:()=>hh,IsNull:()=>Ir,IsNumber:()=>br,IsObject:()=>$n,IsObjectNotArray:()=>ch,IsString:()=>vr,IsSymbol:()=>lh,IsUndefined:()=>Qa,IsUnsafePropertyKey:()=>Hi,IsValueLike:()=>yh,Keys:()=>xr,ShiftLeft:()=>$r,Symbols:()=>Eh,Values:()=>Rh});function St(e,t,n){return e>=t&&e<=n}function oh(e){return e===8205}function ih(e){return St(e,55296,56319)}function ji(e){return St(e,127462,127487)}function Di(e){return St(e,65024,65039)}function Gi(e){return St(e,768,879)||St(e,6832,6911)||St(e,7616,7679)||St(e,65056,65071)}function yr(e){return e>65535?2:1}function Fi(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Gi(n)||Di(n))t+=yr(n);else break}return t}function Za(e,t){let n=e.codePointAt(t),r=t+yr(n);for(r=Fi(e,r);r<e.length-1&&e[r]==="\u200D";){let a=e.codePointAt(r+1);r+=1+yr(a),r=Fi(e,r)}return ji(n)&&r<e.length&&ji(e.codePointAt(r))&&(r+=yr(e.codePointAt(r))),r}function Ni(e){return ih(e)||Gi(e)||Di(e)||oh(e)}function Ui(e){let t=0,n=0;for(;n<e.length;)n=Za(e,n),t++;return t}function sh(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=Za(e,r),n++,n>=t)return!0;return!1}function mh(e,t){let n=0,r=0;for(;r<e.length;)if(r=Za(e,r),n++,n>t)return!1;return!0}function _i(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Ni(e.charCodeAt(n)))return sh(e,t);if(n++,n>=t)return!0}return!1}function Ki(e,t){let n=0;for(;n<e.length;){if(Ni(e.charCodeAt(n)))return mh(e,t);if(n++,n>t)return!1}return!0}function vn(e){return Array.isArray(e)}function bn(e){return M(typeof e,"bigint")}function zi(e){return M(typeof e,"boolean")}function uh(e){if(Qa(e)||!Bi(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Bi(e){return M(typeof e,"function")}function Xa(e){return Number.isInteger(e)}function Ir(e){return M(e,null)}function br(e){return Number.isFinite(e)}function ch(e){return $n(e)&&!vn(e)}function $n(e){return M(typeof e,"object")&&!Ir(e)}function vr(e){return M(typeof e,"string")}function lh(e){return M(typeof e,"symbol")}function Qa(e){return M(e,void 0)}function M(e,t){return e===t}function dh(e,t){return e>t}function fh(e,t){return e<t}function Vi(e,t){return e<=t}function Wi(e,t){return e>=t}function hh(e,t){if(bn(e)||bn(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!br(e)||Xa(e)&&1/t%1===0)return!0;let r=e%t;return Math.min(Math.abs(r),Math.abs(r-t),Math.abs(r+t))<n}function gh(e){if(!$n(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Ir(t)?!1:M(typeof t.constructor,"function")&&!(M(t.constructor,globalThis.Object)||M(t.constructor.name,"Object"))}function yh(e){return bn(e)||zi(e)||Ir(e)||br(e)||vr(e)||Qa(e)}function xh(e){return Ui(e)}function Ih(e,t){return Ki(e,t)}function bh(e,t){return _i(e,t)}function vh(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function $h(e,t,n){let r=!0;for(let a=t;a<e.length;a++)n(e[a],a)||(r=!1);return r}function $r(e,t,n){return M(e.length,0)?n():t(e[0],e.slice(1))}function Hi(e){return M(e,"__proto__")||M(e,"constructor")||M(e,"prototype")}function Th(e,t){return Hi(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function kh(e){return xr(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function wh(e){return Object.entries(e)}function xr(e){return Object.getOwnPropertyNames(e)}function Eh(e){return Object.getOwnPropertySymbols(e)}function Rh(e){return Object.values(e)}function Sh(e,t){if(!$n(t))return!1;let n=xr(e);return M(n.length,xr(t).length)&&n.every(r=>eo(e[r],t[r]))}function Oh(e,t){return vn(t)&&M(e.length,t.length)&&e.every((n,r)=>eo(e[r],t[r]))}function eo(e,t){return vn(e)?Oh(e,t):$n(e)?Sh(e,t):M(e,t)}var ft={};Rt(ft,{IsBigInt64Array:()=>zh,IsBigUint64Array:()=>Bh,IsBoolean:()=>Ah,IsDate:()=>Wh,IsFloat32Array:()=>_h,IsFloat64Array:()=>Kh,IsInt16Array:()=>Dh,IsInt32Array:()=>Nh,IsInt8Array:()=>qh,IsMap:()=>Yh,IsNumber:()=>Ch,IsRegExp:()=>Vh,IsSet:()=>Hh,IsString:()=>Mh,IsTypeArray:()=>Lh,IsUint16Array:()=>Gh,IsUint32Array:()=>Uh,IsUint8Array:()=>jh,IsUint8ClampedArray:()=>Fh});function Ah(e){return e instanceof Boolean}function Ch(e){return e instanceof Number}function Mh(e){return e instanceof String}function Lh(e){return globalThis.ArrayBuffer.isView(e)}function qh(e){return e instanceof globalThis.Int8Array}function jh(e){return e instanceof globalThis.Uint8Array}function Fh(e){return e instanceof globalThis.Uint8ClampedArray}function Dh(e){return e instanceof globalThis.Int16Array}function Gh(e){return e instanceof globalThis.Uint16Array}function Nh(e){return e instanceof globalThis.Int32Array}function Uh(e){return e instanceof globalThis.Uint32Array}function _h(e){return e instanceof globalThis.Float32Array}function Kh(e){return e instanceof globalThis.Float64Array}function zh(e){return e instanceof globalThis.BigInt64Array}function Bh(e){return e instanceof globalThis.BigUint64Array}function Vh(e){return e instanceof globalThis.RegExp}function Wh(e){return e instanceof globalThis.Date}function Hh(e){return e instanceof globalThis.Set}function Yh(e){return e instanceof globalThis.Map}function Zh(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function Xh(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let r of Object.keys(n)){if(s.IsUnsafePropertyKey(r))continue;let a=n[r];s.HasPropertyKey(a,"value")&&Object.defineProperty(t,r,{...a,value:Ot(a.value)})}return t}function Qh(e){let t={};for(let n of s.Keys(e))s.IsUnsafePropertyKey(n)||(t[n]=Ot(e[n]));for(let n of s.Symbols(e))t[n]=Ot(e[n]);return t}function eg(e){return s.IsClassInstance(e)?e:Zh(e)?Xh(e):Qh(e)}function tg(e){return e.map(t=>Ot(t))}function ng(e){return e.slice()}function rg(e){return new RegExp(e.source,e.flags)}function ag(e){return new Map(Ot([...e.entries()]))}function og(e){return new Set(Ot([...e.values()]))}function Ot(e){return ft.IsTypeArray(e)?ng(e):ft.IsRegExp(e)?rg(e):ft.IsMap(e)?ag(e):ft.IsSet(e)?og(e):s.IsArray(e)?tg(e):s.IsObject(e)?eg(e):e}function Tn(e){return De.clone+=1,Ot(e)}var Pt={};Rt(Pt,{Get:()=>mg,Reset:()=>ig,Set:()=>sg});var it={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function ig(){it.immutableTypes=!1,it.maxErrors=8,it.useAcceleration=!0,it.exactOptionalPropertyTypes=!1,it.enumerableKind=!1,it.correctiveParse=!1,it.unionPrioritySort=!0}function sg(e){for(let t of s.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(it,t,{value:n})}}function mg(){return it}function pg(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Yi(e,t){return{...e,...t}}function ug(e,t,n={}){De.create+=1;let r=Pt.Get(),a=Yi(t,n),i=r.enumerableKind?Yi(a,e):pg(a,e);return r.immutableTypes?Object.freeze(i):i}function cg(e,t){De.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(Tn(e)),a=new Set(t);for(let i of Object.keys(r))a.has(i)||Object.defineProperty(n,i,r[i]);return n}function lg(e,t,n){De.update+=1;let r=Pt.Get(),a=Tn(e);for(let i of Object.keys(t))Object.defineProperty(a,i,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[i]});for(let i of Object.keys(n))Object.defineProperty(a,i,{configurable:!0,enumerable:!0,writable:!0,value:n[i]});return a}function y(e,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function re(e){return s.IsObject(e)}function I(e,t,n){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function ht(e){return y(e,"Deferred")}function dg(e){return p.Update(e,{"~readonly":!0},{})}function kn(e,t){return p.Update(dg(e),{},t)}function Ji(e,t,n,r){let a=d(e,t,n);return kn(a,r)}function fg(e){return p.Update(e,{"~optional":!0},{})}function wn(e,t){return p.Update(fg(e),{},t)}function Zi(e,t,n,r){let a=d(e,t,n);return wn(a,r)}function Re(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function K(e){return y(e,"Array")}function Tr(e){return p.Discard(e,["~kind","type","items"])}function _e(e,t,n={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function oe(e){return y(e,"Constructor")}function Xi(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ke(e,t,n={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function ie(e){return y(e,"Function")}function Qi(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function st(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function se(e){return y(e,"Ref")}function gt(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Bt(e){return y(e,"Generic")}function Vt(e){return p.Create({"~kind":"Any"},{},e)}function Z(e){return y(e,"Any")}var es="(?!)";function F(e){return p.Create({"~kind":"Never"},{not:{}},e)}function yt(e){return y(e,"Never")}function ze(e,t={}){return I("AddOptional",[e],t)}function At(e,t={}){return wn(e,t)}function ts(e){return At(e)}function he(e){return re(e)&&s.HasPropertyKey(e,"~optional")}function ns(e){return s.Keys(e).filter(t=>!he(e[t]))}function kr(e){return s.Keys(e)}function wr(e){return s.Values(e)}function v(e,t={}){let n=ns(e),r=n.length>0?{required:n}:{};return p.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function L(e){return y(e,"Object")}function rs(e){return p.Discard(e,["~kind","type","properties","required"])}function me(e){return p.Create({"~kind":"Unknown"},{},e)}function ae(e){return y(e,"Unknown")}function Be(e,t,n){let r=s.Keys(e).reduce((a,i)=>({...a,[i]:p.Update(e[i],{},{$id:i})}),{});return p.Create({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function ce(e){return y(e,"Cyclic")}function as(e){return p.Update(e,{"~unsafe":null},{})}function Er(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}var Ve={};Rt(Ve,{Match:()=>hg});function hg(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function En(...e){let[t,n]=Ve.Match(e,{2:(r,a)=>[r,a,a],1:r=>[r,me(),me()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Y(e){return y(e,"Infer")}function Ct(e,t,n,r={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function V(e){return y(e,"Dependent")}function os(e){return p.Discard(e,["~kind","if","then","else"])}function is(e){return s.IsObjectNotArray(e)}function ss(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function ms(e){return s.IsString(e)||s.IsNumber(e)}function ps(e,t){let n=is(e)?ss(e):e;return p.Create({"~kind":"Enum"},{enum:n},t)}function ye(e){return y(e,"Enum")}function ge(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function O(e){return y(e,"Intersect")}function us(e){return p.Discard(e,["~kind","allOf"])}function J(){throw new Error("Unreachable")}var cs;(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"})(cs||(cs={}));var fk=BigInt("14695981039346656037"),[hk,gk]=[BigInt("1099511628211"),BigInt("18446744073709551616")],yk=Array.from({length:256}).map((e,t)=>BigInt(t)),ls=new Float64Array(1),xk=new DataView(ls.buffer),Ik=new Uint8Array(ls.buffer);var bk=new TextEncoder;var Rn=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=Rr(n)?m=>this.decode(n["~codec"].decode(m)):this.decode,a=Rr(n)?m=>n["~codec"].encode(t(m)):t,i={decode:r,encode:a};return p.Update(this.type,{"~codec":i},{})}},Sn=class{constructor(t){this.type=t}Decode(t){return new Rn(this.type,t)}};function Sr(e){return new Sn(e)}function fs(e,t){return Sr(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function hs(e,t){return Sr(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function Rr(e){return re(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function gs(e){return Wt(e)}function Mt(e){return re(e)&&s.HasPropertyKey(e,"~immutable")}function We(e,t={}){return I("AddReadonly",[e],t)}function Lt(e,t={}){return kn(e,t)}function ys(e){return Lt(e)}function qt(e){return re(e)&&s.HasPropertyKey(e,"~readonly")}function Ig(e,t){let n=to(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":n},{})}function xs(...e){let[t,n,r]=Ve.Match(e,{3:(a,i,m)=>[a,i,m],2:(a,i)=>[a,i,()=>"Refine Error"]});return Ig(t,{check:n,error:r})}function bg(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function to(e){return re(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>bg(t))}var Is="-?(?:0|[1-9][0-9]*)n";function On(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function He(e){return y(e,"BigInt")}function Or(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Ae(e){return y(e,"Boolean")}function Pn(e){return p.Create({"~kind":"Identifier"},{name:e})}function bs(e){return y(e,"Identifier")}var Pr="-?(?:0|[1-9][0-9]*)";function jt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function xe(e){return y(e,"Integer")}var no=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function vg(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new no(e)})()}function P(e,t){return p.Create({"~kind":"Literal"},{type:vg(e),const:e},t)}function Ar(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function vs(e){return q(e)&&s.IsNumber(e.const)}function $s(e){return q(e)&&s.IsString(e.const)}function q(e){return y(e,"Literal")}function Ht(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Yt(e){return y(e,"Null")}var Cr="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Te(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function X(e){return y(e,"Number")}function Jt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function xt(e){return y(e,"Symbol")}function Ft(...e){let[t,n,r]=Ve.Match(e,{3:(a,i,m)=>[a,i,m],2:(a,i)=>[a,i,i],1:a=>[a,me(),me()]});return p.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function Ts(e){return y(e,"Parameter")}var Mr=".*";function Ce(e){return p.Create({"~kind":"String"},{type:"string"},e)}function Ie(e){return y(e,"String")}function w(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return y(e,"Union")}function ks(e){return p.Discard(e,["~kind","anyOf"])}function An(e){let t=ws(e);return s.IsEqual(t.length,2)?t[0]:[]}function $g(e){return!0}function Es(e){return s.ShiftLeft(e,(t,n)=>Tg(t)?Es(n):!1,()=>!0)}function Rs(e){return s.IsEqual(e.length,0)?!1:Es(e)}function Tg(e){return x(e)?Rs(e.anyOf):q(e)?$g(e.const):!1}function Lr(e){return Rs(e)}function qr(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Ss(e,t,n=[]){return s.ShiftLeft(e,(r,a)=>Ss(a,t,[...n,`${r}${t}`]),()=>n)}function kg(e,t){return s.IsEqual(e.length,0)?[`${t}`]:Ss(e,t)}function Os(e,t,n=[]){return s.ShiftLeft(t,(r,a)=>Os(e,a,[...n,...Ps(e,r)]),()=>n)}function Ps(e,t){return x(t)?Os(e,t.anyOf):q(t)?kg(e,t.const):J()}function As(e,t){return s.ShiftLeft(t,(n,r)=>As(Ps(e,n),r),()=>e)}function wg(e){return e.map(t=>P(t))}function Eg(e){let t=As([],e),n=wg(t);return w(n)}function Rg(e){return s.IsEqual(e.length,0)?J():s.IsEqual(e.length,1)&&q(e[0])?e[0]:Eg(e)}function ro(e){let t=An(e);return s.IsEqual(t.length,0)?Ce():Lr(t)?Rg(t):qr(e)}function Cs(e){let t=ro(e);return Q(t)?Ce():t}function ve(e,t){let n="object",r={[e]:t};return p.Create({"~kind":"Record"},{type:n,patternProperties:r})}function Ms(e){return ve(Ge,e)}function Ls(e){return v({true:e,false:e})}function ee(e,t={}){let[n,r,a]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:a,items:n,minItems:r},t)}function G(e){return y(e,"Tuple")}function qs(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Sg(e){return p.Discard(e,["~readonly"])}function ao(e,t){return p.Update(Sg(e),{},t)}function js(e,t,n,r){let a=d(e,t,n);return ao(a,r)}function Fs(e,t={}){return I("RemoveReadonly",[e],t)}function Ds(e,t={}){return ao(e,t)}function Og(e){return p.Discard(e,["~optional"])}function oo(e,t){return p.Update(Og(e),{},t)}function Gs(e,t,n,r){let a=d(e,t,n);return oo(a,r)}function Ns(e,t={}){return I("RemoveOptional",[e],t)}function jr(e,t={}){return oo(e,t)}function io(e){return e.reduceRight((n,r,a)=>({[a]:r,...n}),{})}function Us(e){let t=io(e.items);return v(t)}function Pg(e,t){return qt(e)?!!qt(t):!1}function Ag(e,t){return he(e)?!!he(t):!1}function Cg(e,t){let n=Pg(e,t),r=Ag(e,t),a=z([e,t]),i=Ds(jr(a));return n&&r?Lt(At(i)):n&&!r?Lt(i):!n&&r?At(i):i}function Mg(e,t,n){return n in e?n in t?Cg(e[n],t[n]):e[n]:n in t?t[n]:F()}function Lg(e,t){return[...new Set([...s.Keys(t),...s.Keys(e)])].reduce((r,a)=>({...r,[a]:Mg(e,t,a)}),{})}function _s(e){return L(e)?e.properties:G(e)?io(e.items):J()}function Ks(e,t){let n=_s(e),r=_s(t),a=Lg(n,r);return v(a)}function zs(e,t){let n=Zt(e,t);return s.IsEqual(n,Mn)?e:s.IsEqual(n,Ln)||s.IsEqual(n,Cn)?t:F()}function Bs(e){return L(e)||G(e)}function qg(e,t){let n=x(e),r=x(t);return n||r}function jg(e,t){let n=Me(e),r=Me(t),a=qg(n,r),i=Bs(n),m=Bs(r);return a?z([n,r]):i&&m?Ks(n,r):i&&!m?n:!i&&m?r:zs(n,r)}function Vs(e,t,n=[]){return s.ShiftLeft(t,(r,a)=>Vs(e,a,[...n,jg(e,r)]),()=>s.IsEqual(n.length,0)?[e]:n)}function Ws(e,t,n=[]){return s.ShiftLeft(e,(r,a)=>Ws(a,t,[...n,...qn([r],t)]),()=>n)}function qn(e,t=[]){return s.ShiftLeft(e,(n,r)=>x(n)?qn(r,Ws(n.anyOf,t)):qn(r,Vs(n,t)),()=>t)}function Fg(e,t){let n=le({},e,t);return b.IsExtendsTrueLike(n)?[]:[e]}function Dg(e,t){return e.reduce((n,r)=>[...n,...Fg(r,t)],[])}function Fr(e,t){let n=Me(e),r=x(n)?n.anyOf:[n],a=Dg(r,t);return ke(a)}function Ne(e,t,n){let r=ge([e,t]),a=Fr(n,e);return ke([r,a])}function Se(e){let t=e.map(n=>P(n));return ke(t)}function z(e){let t=qn(e),n=so(t);return mt(n)}function $e(e){let t=Cs(e);return Me(t)}function ke(e){let t=so(e);return mt(t)}function Me(e){return V(e)?Ne(e.if,e.then,e.else):ye(e)?Se(e.enum):O(e)?z(e.allOf):Q(e)?$e(e.pattern):x(e)?ke(e.anyOf):e}function mt(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?F():w(e)}function Hs(e,t){let n=Se(e);return It(n,t)}function Ys(e,t){return ve(bt,t)}function Js(e,t){let n=z(e);return It(n,t)}function Zs(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 Xs(e,t){return ve(Xt,t)}function Qs(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?ve(e.pattern.toString(),t):ve(Ge,t)}function em(e,t){let n=An(e);return Lr(n)?It($e(e),t):ve(e,t)}function Gg(e){return x(e)?jn(e.anyOf):[e]}function jn(e){return e.reduce((t,n)=>[...t,...Gg(n)],[])}function Ng(e){return e.some(t=>Ie(t)||X(t)||xe(t))}function Ug(e,t){return s.IsEqual(Ng(e),!0)?ve(Ge,t):void 0}function _g(e,t){return e.reduce((n,r)=>q(r)&&(s.IsString(r.const)||s.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function Kg(e,t){let n=_g(e,t);return v(n)}function tm(e,t){let n=jn(e),r=Ug(n,t);return re(r)?r:Kg(n,t)}function It(e,t){return Z(e)?Ms(t):Ae(e)?Ls(t):ye(e)?Hs(e.enum,t):xe(e)?Ys(e,t):O(e)?Js(e.allOf,t):q(e)?Zs(e.const,t):X(e)?Xs(e,t):x(e)?tm(e.anyOf,t):Ie(e)?Qs(e,t):Q(e)?em(e.pattern,t):v({})}function mo(e,t,n){return k([e])?p.Update(It(e,t),{},n):Dr(e,t,n)}function nm(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return mo(i,m,a)}var bt=`^${Pr}$`,Xt=`^${Cr}$`,Ge=`^${Mr}$`;function Dr(e,t,n={}){return I("Record",[e,t],n)}function Gr(e,t,n={}){return mo(e,t,n)}function rm(e,t){return ve(e,t)}function Nr(e){return s.IsEqual(e,Ge)?Ce():s.IsEqual(e,bt)?jt():s.IsEqual(e,Xt)?Te():ro(e)}function Le(e){return s.Keys(e.patternProperties)[0]}function Qt(e){let t=Le(e);return Nr(t)}function be(e){return e.patternProperties[Le(e)]}function de(e){return y(e,"Record")}function Dt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function vt(e){return y(e,"Rest")}function Ur(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function _r(e){return y(e,"This")}function en(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function tn(e){return y(e,"Undefined")}function Kr(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Ye(e){return y(e,"Void")}function Bg(e,t){return s.IsEqual(e,"Array")?Re(t[0]):s.IsEqual(e,"Capitalize")?Br(t[0]):s.IsEqual(e,"ConstructorParameters")?Jr(t[0]):s.IsEqual(e,"Evaluate")?ou(t[0]):s.IsEqual(e,"Exclude")?Zr(t[0],t[1]):s.IsEqual(e,"Extract")?Xr(t[0],t[1]):s.IsEqual(e,"Index")?Nn(t[0],t[1]):s.IsEqual(e,"InstanceType")?Qr(t[0]):s.IsEqual(e,"Lowercase")?Vr(t[0]):s.IsEqual(e,"NonNullable")?ea(t[0]):s.IsEqual(e,"Omit")?ta(t[0],t[1]):s.IsEqual(e,"Parameters")?na(t[0]):s.IsEqual(e,"Partial")?ra(t[0]):s.IsEqual(e,"Pick")?aa(t[0],t[1]):s.IsEqual(e,"Readonly")?oa(t[0]):s.IsEqual(e,"KeyOf")?Un(t[0]):s.IsEqual(e,"Record")?Dr(t[0],t[1]):s.IsEqual(e,"Required")?ia(t[0]):s.IsEqual(e,"ReturnType")?sa(t[0]):s.IsEqual(e,"Uncapitalize")?Wr(t[0]):s.IsEqual(e,"Uppercase")?Hr(t[0]):Gn(st(e),t)}function Gt(){throw Error("Unreachable")}var Vg=(e,t=[])=>e.reduce((n,r)=>s.IsArray(r)&&s.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),pt=e=>{let[t,n]=e;return Vg([...t,...n])};function mm(e){return Ft(e[0],e[2],e[4])}function pm(e){return Ft(e[0],e[2],e[2])}function um(e){return Ft(e[0],me(),e[2])}function cm(e){return Ft(e,me(),me())}function lm(e){return pt(e)}function dm(e){return e[1]}function fm(e){return pt(e)}function hm(e){return e[1]}function gm(e){return Bg(e[0],e[1])}function ym(e){return null}function xm(e){return Ce()}function Im(e){return Te()}function bm(e){return Or()}function vm(e){return en()}function $m(e){return Ht()}function Tm(e){return jt()}function km(e){return On()}function wm(e){return me()}function Em(e){return Vt()}function Rm(e){return v({})}function Sm(e){return F()}function Om(e){return Jt()}function Pm(e){return Kr()}function Am(e){return Ur()}function Cm(e){return P(BigInt(e))}function Mm(e){return P(s.IsEqual(e,"true"))}function Lm(e){return P(parseFloat(e))}function qm(e){return P(e)}function jm(e){return e[1]}function Fm(e){return P(e)}function Dm(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Gm(e){return e[1]}function Nm(e){return zr(e)}function Um(e){return s.IsEqual(e.length,6)?Ct(e[1],e[3],e[5]):Ct(e[1],e[3],me())}function _m(e){return e.length>0}function Km(e){return e.reduce((t,n)=>s.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function zm(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Bm(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function Vm(e){return s.IsEqual(e.length,2)?e[1]:[]}function am(e,t){return t.reduce((n,r)=>{let a=r;return s.IsEqual(a.length,1)?Nn(n,a[0]):s.IsEqual(a.length,0)?Re(n):Gt()},e)}function om(e,t){return s.IsEqual(t.length,3)?Yr(e,t[0],t[1],t[2]):e}function Wg(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:ma(e,t)}function Wm(e){let[t,n,r,a,i]=e;return Wg(om(t?Un(am(n,r)):am(n,r),a),i)}function po(e,t){return s.IsEqual(t.length,3)?(()=>{let[n,r,a]=t,i=po(r,a);if(s.IsEqual(n,"&"))return O(i)?ge([e,...i.allOf]):ge([e,i]);if(s.IsEqual(n,"|"))return x(i)?w([e,...i.anyOf]):w([e,i]);Gt()})():e}function Hm(e){let[t,n]=e;return po(t,n)}function Ym(e){let[t,n]=e;return po(t,n)}function Jm(e){return au(e[1])}function Zm(e){return e[1]}function Xm(e){return gt(e[0],e[2])}function Qm(e){return s.IsEqual(e.length,4)?En(e[1],e[3]):s.IsEqual(e.length,2)?En(e[1],me()):Gt()}function ep(e){return`${e}`}function tp(e){return xe(e[3])?bt:X(e[3])?Xt:xt(e[3])?Ge:Ie(e[3])?Ge:Gt()}function np(e){return e.length>0}function rp(e){return e.length>0}function ap(e){let[t,n,r,a,i]=e;return{[n]:t&&r?We(ze(i)):t&&!r?We(i):!t&&r?ze(i):i}}function op(e){return pt(e)}function ip(e){return e.reduce((t,n)=>s.HasPropertyKey(n,bt)||s.HasPropertyKey(n,Xt)||s.HasPropertyKey(n,Ge)?[t[0],p.Assign(t[1],n)]:[p.Assign(t[0],n),t[1]],[{},{}])}function sp(e){return ip(e[1])}function mp(e){let[t,n]=e,r=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return v(t,r)}function pp(e){return s.IsEqual(e.length,5)?We(ze(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?We(e[3]):ze(e[3]):Gt()}function up(e){return We(ze(e[1]))}function cp(e){return We(e[1])}function lp(e){return ze(e[0])}function dp(e){return s.IsEqual(e.length,2)?Dt(e[1]):s.IsEqual(e.length,1)?e[0]:Gt()}function fp(e){return pt(e)}function hp(e){return ee(e[1])}function gp(e){return We(ze(e[4]))}function yp(e){return We(e[3])}function xp(e){return ze(e[3])}function Ip(e){return e[2]}function bp(e){return s.IsEqual(e.length,2)?Dt(e[1]):s.IsEqual(e.length,1)?e[0]:Gt()}function vp(e){return pt(e)}function $p(e){return Ke(e[1],e[4])}function Tp(e){return _e(e[2],e[5])}function im(e,t){return s.IsEqual(e,"remove")?Fs(t):s.IsEqual(e,"add")?We(t):t}function kp(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 sm(e,t){return s.IsEqual(e,"remove")?Ns(t):s.IsEqual(e,"add")?ze(t):t}function wp(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 Ep(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function Rp(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?Fn(Pn(e[3]),e[5],e[6][0],im(e[1],sm(e[8],e[10]))):Fn(Pn(e[3]),e[5],st(e[3]),im(e[1],sm(e[8],e[10])))}function Sp(e){return st(e)}function Op(e){return BigInt(e)}function Pp(e){return parseFloat(e)}function Ap(e){return s.IsEqual(e,"true")}function Cp(e){return null}function Mp(e){return{[e[0]]:e[2]}}function Lp(e){return pt(e)}function Hg(e){return e.reduce((t,n)=>p.Assign(t,n),{})}function qp(e){return Hg(e[1])}function jp(e){return pt(e)}function Fp(e){return e[1]}function Dp(e){return On()}function Gp(e){return Ce()}function Np(e){return Te()}function Up(e){return jt()}function _p(e){return F()}function Kp(e){return P(e)}function zp(e){return w(e[1])}function Bp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Vp(e){return[e[0],...e[1]]}function Wp(e){return e[1]}function Hp(e){return pt(e)}function Yp(e){return s.IsEqual(e.length,2)?e[1]:[]}function Jp(e){let t=e[2],n=e[3],[r,a]=e[4],i=s.IsEqual(s.Keys(a).length,0)?{}:{patternProperties:a};return{[e[1]]:gt(t,Dn(n,r,i))}}function Zp(e){let t=e[2],[n,r]=e[3],a=s.IsEqual(s.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:Dn(t,n,a)}}function Xp(e){return{[e[1]]:gt(e[2],e[4])}}function Qp(e){return{[e[1]]:e[3]}}function eu(e){return null}function tu(e){return ip(pt(e))}function nu(e){return e[1]}function ru(e){let t=e[0],n=e[1];return iu(p.Assign(t,n[0]))}function _n(e){return M(e.length,2)}function R(e,t,n){return _n(e)?t(e[0],e[1]):n()}function Zg(e,t){return M(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function B(e,t){for(let n=0;n<e.length;n++){let r=Zg(e[n],t);if(_n(r))return r}return[]}function uo(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var su=[...uo(97,122),...uo(65,90)],co="0",lo=uo(49,57),nn=[co,...lo],mu=" ",rn=`
|
|
6
|
+
`;var $t="_",pa=".",pu="$",ua="-";var uu="//",cu="/*",Qg="*/";function lu(e){let t=e.indexOf(Qg);return M(t,-1)?"":e.slice(t+2)}function du(e){let t=e.indexOf(rn);return M(t,-1)?"":e.slice(t)}function ey(e){return e.replace(/^[ \t\r\f\v]+/,"")}function ca(e){let t=ey(e);return t.startsWith(cu)?ca(lu(t.slice(2))):t.startsWith(uu)?ca(du(t.slice(2))):t}function pe(e){let t=e.trimStart();return t.startsWith(cu)?pe(lu(t.slice(2))):t.startsWith(uu)?pe(du(t.slice(2))):t}function la(e,t){return R(B([e],t),(n,r)=>[n,r],()=>["",t])}function ty(e,t){return e.includes(t)}function an(e,t,n,r=""){return R(B(e,n),(a,i)=>ty(t,a)?an(e,t,i,r):an(e,t,i,`${r}${a}`),()=>[r,n])}function ny(e){return B(lo,e)}var ry=[...nn,$t];function ay(e){return an(ry,[$t],e)}function oy(e){return R(B([co],e),(t,n)=>[t,n],()=>R(ny(e),(t,n)=>R(ay(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[]))}function da(e){return oy(pe(e))}function iy(e){return la(ua,e)}function sy(e){return R(iy(e),(t,n)=>R(da(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function fu(e){return sy(pe(e))}function my(e){return R(fu(e),(t,n)=>R(B(["n"],n),(r,a)=>[`${t}`,a],()=>[]),()=>[])}function fo(e){return my(e)}function ho(e,t){return B([e],t)}function c(e,t){return M(e,"")?["",t]:e.startsWith(rn)?ho(e,ca(t)):e.startsWith(mu)?ho(e,t):ho(e,pe(t))}var hu=[...su,$t,pu];function py(e){return B(hu,e)}var uy=[...hu,...nn];function gu(e,t=""){return R(B(uy,e),(n,r)=>gu(r,`${t}${n}`),()=>[t,e])}function cy(e){return R(py(e),(t,n)=>R(gu(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function W(e){return cy(pe(e))}var ly=[...nn,$t];function dy(e){return _n(B([pa],e))}function yu(e){return R(an(ly,[$t],e),(t,n)=>M(t,"")?[]:[t,n],()=>[])}function fy(e){return R(B([pa],e),(t,n)=>R(yu(n),(r,a)=>[`0${t}${r}`,a],()=>[]),()=>[])}function hy(e){return R(da(e),(t,n)=>R(B([pa],n),(r,a)=>R(yu(a),(i,m)=>[`${t}${r}${i}`,m],()=>[`${t}`,a]),()=>[`${t}`,n]),()=>[])}function gy(e){return dy(e)?fy(e):hy(e)}function xu(e){return gy(pe(e))}function yy(e){return la(ua,e)}function xy(e){return R(yy(e),(t,n)=>R(xu(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function fa(e){return xy(pe(e))}function Iy(e){return M(e,"")?[]:[e.slice(0,1),e.slice(1)]}function Iu(e,t){return $r(e,(n,r)=>t.startsWith(n)?!0:Iu(r,t),()=>!1)}function Tt(e,t,n=""){return R(Iy(t),(r,a)=>Iu(e,t)?[n,t]:Tt(e,a,`${n}${r}`),()=>[])}function by(e,t,n){return R(B([e],n),(r,a)=>R(Tt([t],a),(i,m)=>R(B([t],m),(u,l)=>[`${i}`,l],()=>[]),()=>[]),()=>[])}function vy(e,t,n){return R(B([e],n),(r,a)=>R(Tt([rn,t],a),(i,m)=>R(B([t],m),(u,l)=>[`${i}`,l],()=>[]),()=>[]),()=>[])}function bu(e,t,n,r){return n?by(e,t,pe(r)):vy(e,t,pe(r))}function $y(e,t){return B(e,t)}function Ty(e,t){return bu(e,e,!1,t)}function ky(e,t){return R($y(e,t),(n,r)=>Ty(n,`${n}${r}`),()=>[])}function ha(e,t){return ky(e,pe(t))}function vu(e,t){return R(Tt(e,t),(n,r)=>M(n,"")?[]:[n,r],()=>[])}var o=(e,t,n=()=>[])=>e.length===2?t(e):n(),Ey=e=>o(o(W(e),([t,n])=>o(c("extends",n),([r,a])=>o(S(a),([i,m])=>o(c("=",m),([u,l])=>o(S(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[mm(t),n]),Ry=e=>o(o(W(e),([t,n])=>o(c("extends",n),([r,a])=>o(S(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[pm(t),n]),Sy=e=>o(o(W(e),([t,n])=>o(c("=",n),([r,a])=>o(S(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[um(t),n]),Oy=e=>o(W(e),([t,n])=>[cm(t),n]),ku=e=>o(o(Ey(e),([t,n])=>[t,n],()=>o(Ry(e),([t,n])=>[t,n],()=>o(Sy(e),([t,n])=>[t,n],()=>o(Oy(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),wu=(e,t=[])=>o(o(ku(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>wu(r,[...t,n]),()=>[t,e]),Py=e=>o(o(wu(e),([t,n])=>o(o(o(ku(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[lm(t),n]),xo=e=>o(o(c("<",e),([t,n])=>o(Py(n),([r,a])=>o(c(">",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[dm(t),n]),Eu=(e,t=[])=>o(o(S(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>Eu(r,[...t,n]),()=>[t,e]),Ay=e=>o(o(Eu(e),([t,n])=>o(o(o(S(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[fm(t),n]),Cy=e=>o(o(c("<",e),([t,n])=>o(Ay(n),([r,a])=>o(c(">",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[hm(t),n]),My=e=>o(o(W(e),([t,n])=>o(Cy(n),([r,a])=>[[t,r],a])),([t,n])=>[gm(t),n]),Ru=e=>o(o(o(c(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[ym(t),n]),Su=e=>o(c("string",e),([t,n])=>[xm(t),n]),Ou=e=>o(c("number",e),([t,n])=>[Im(t),n]),Ly=e=>o(c("boolean",e),([t,n])=>[bm(t),n]),qy=e=>o(c("undefined",e),([t,n])=>[vm(t),n]),jy=e=>o(c("null",e),([t,n])=>[$m(t),n]),Pu=e=>o(c("integer",e),([t,n])=>[Tm(t),n]),Fy=e=>o(c("bigint",e),([t,n])=>[km(t),n]),Dy=e=>o(c("unknown",e),([t,n])=>[wm(t),n]),Gy=e=>o(c("any",e),([t,n])=>[Em(t),n]),Ny=e=>o(c("object",e),([t,n])=>[Rm(t),n]),Uy=e=>o(c("never",e),([t,n])=>[Sm(t),n]),Au=e=>o(c("symbol",e),([t,n])=>[Om(t),n]),_y=e=>o(c("void",e),([t,n])=>[Pm(t),n]),Ky=e=>o(c("this",e),([t,n])=>[Am(t),n]),zy=e=>o(o(c("${",e),([t,n])=>o(S(n),([r,a])=>o(c("}",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[jm(t),n]),go=e=>o(Tt(["${","`"],e),([t,n])=>[Fm(t),n]),Cu=e=>o(o(o(go(e),([t,n])=>o(zy(n),([r,a])=>o(Cu(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o(o(go(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(go(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[Dm(t),n]),Io=e=>o(o(c("`",e),([t,n])=>o(Cu(n),([r,a])=>o(c("`",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Gm(t),n]),By=e=>o(Io(e),([t,n])=>[Nm(t),n]),Vy=e=>o(o(o(c("if",e),([t,n])=>o(S(n),([r,a])=>o(c("then",a),([i,m])=>o(S(m),([u,l])=>o(c("else",l),([f,h])=>o(S(h),([$,E])=>[[t,r,i,u,f,$],E])))))),([t,n])=>[t,n],()=>o(o(c("if",e),([t,n])=>o(S(n),([r,a])=>o(c("then",a),([i,m])=>o(S(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[Um(t),n]),Wy=e=>o(fo(e),([t,n])=>[Cm(t),n]),Hy=e=>o(o(c("true",e),([t,n])=>[t,n],()=>o(c("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[Mm(t),n]),Yy=e=>o(fa(e),([t,n])=>[Lm(t),n]),Jy=e=>o(ha(["'",'"'],e),([t,n])=>[qm(t),n]),Zy=e=>o(o(o(c("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[_m(t),n]),Mu=(e,t=[])=>o(o(o(c("[",e),([n,r])=>o(S(r),([a,i])=>o(c("]",i),([m,u])=>[[n,a,m],u]))),([n,r])=>[n,r],()=>o(o(c("[",e),([n,r])=>o(c("]",r),([a,i])=>[[n,a],i])),([n,r])=>[n,r],()=>[])),([n,r])=>Mu(r,[...t,n]),()=>[t,e]),Xy=e=>o(Mu(e),([t,n])=>[Km(t),n]),Qy=e=>o(o(o(c("extends",e),([t,n])=>o(S(n),([r,a])=>o(c("?",a),([i,m])=>o(S(m),([u,l])=>o(c(":",l),([f,h])=>o(S(h),([$,E])=>[[t,r,i,u,f,$],E])))))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[zm(t),n]),ex=e=>o(o(o(c("(",e),([t,n])=>o(S(n),([r,a])=>o(c(")",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o(Su(e),([t,n])=>[t,n],()=>o(Ou(e),([t,n])=>[t,n],()=>o(Ly(e),([t,n])=>[t,n],()=>o(qy(e),([t,n])=>[t,n],()=>o(jy(e),([t,n])=>[t,n],()=>o(Pu(e),([t,n])=>[t,n],()=>o(Fy(e),([t,n])=>[t,n],()=>o(Dy(e),([t,n])=>[t,n],()=>o(Gy(e),([t,n])=>[t,n],()=>o(Ny(e),([t,n])=>[t,n],()=>o(Uy(e),([t,n])=>[t,n],()=>o(Au(e),([t,n])=>[t,n],()=>o(_y(e),([t,n])=>[t,n],()=>o(Ky(e),([t,n])=>[t,n],()=>o(Wy(e),([t,n])=>[t,n],()=>o(Hy(e),([t,n])=>[t,n],()=>o(Yy(e),([t,n])=>[t,n],()=>o(Jy(e),([t,n])=>[t,n],()=>o(By(e),([t,n])=>[t,n],()=>o(Vy(e),([t,n])=>[t,n],()=>o(dx(e),([t,n])=>[t,n],()=>o(Ix(e),([t,n])=>[t,n],()=>o(wx(e),([t,n])=>[t,n],()=>o(kx(e),([t,n])=>[t,n],()=>o(Ox(e),([t,n])=>[t,n],()=>o(My(e),([t,n])=>[t,n],()=>o(Px(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[Bm(t),n]),tx=e=>o(o(o(c("with",e),([t,n])=>o(Yu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Vm(t),n]),Lu=e=>o(o(Zy(e),([t,n])=>o(ex(n),([r,a])=>o(Xy(a),([i,m])=>o(Qy(m),([u,l])=>o(tx(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[Wm(t),n]),qu=e=>o(o(o(c("&",e),([t,n])=>o(Lu(n),([r,a])=>o(qu(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ju=e=>o(o(Lu(e),([t,n])=>o(qu(n),([r,a])=>[[t,r],a])),([t,n])=>[Hm(t),n]),Fu=e=>o(o(o(c("|",e),([t,n])=>o(ju(n),([r,a])=>o(Fu(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ga=e=>o(o(ju(e),([t,n])=>o(Fu(n),([r,a])=>[[t,r],a])),([t,n])=>[Ym(t),n]),nx=e=>o(o(c("readonly",e),([t,n])=>o(ga(n),([r,a])=>[[t,r],a])),([t,n])=>[Jm(t),n]),rx=e=>o(o(c("|",e),([t,n])=>o(ga(n),([r,a])=>[[t,r],a])),([t,n])=>[Zm(t),n]),ax=e=>o(o(xo(e),([t,n])=>o(c("=",n),([r,a])=>o(S(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Xm(t),n]),ox=e=>o(o(o(c("infer",e),([t,n])=>o(W(n),([r,a])=>o(c("extends",a),([i,m])=>o(ga(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[t,n],()=>o(o(c("infer",e),([t,n])=>o(W(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>[])),([t,n])=>[Qm(t),n]),S=e=>o(o(ox(e),([t,n])=>[t,n],()=>o(rx(e),([t,n])=>[t,n],()=>o(nx(e),([t,n])=>[t,n],()=>o(ga(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),ix=e=>o(fa(e),([t,n])=>[ep(t),n]),sx=e=>o(W(e),([t,n])=>[t,n]),mx=e=>o(ha(["'",'"'],e),([t,n])=>[t,n]),px=e=>o(o(c("[",e),([t,n])=>o(W(n),([r,a])=>o(c(":",a),([i,m])=>o(o(Pu(m),([u,l])=>[u,l],()=>o(Ou(m),([u,l])=>[u,l],()=>o(Su(m),([u,l])=>[u,l],()=>o(Au(m),([u,l])=>[u,l],()=>[])))),([u,l])=>o(c("]",l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[tp(t),n]),Du=e=>o(o(ix(e),([t,n])=>[t,n],()=>o(sx(e),([t,n])=>[t,n],()=>o(mx(e),([t,n])=>[t,n],()=>o(px(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),ux=e=>o(o(o(c("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[np(t),n]),cx=e=>o(o(o(c("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[rp(t),n]),Gu=e=>o(o(ux(e),([t,n])=>o(Du(n),([r,a])=>o(cx(a),([i,m])=>o(c(":",m),([u,l])=>o(S(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[ap(t),n]),Nu=e=>o(o(o(c(",",e),([t,n])=>o(c(`
|
|
7
7
|
`,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c(";",e),([t,n])=>o(c(`
|
|
8
8
|
`,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(c(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(c(`
|
|
9
|
-
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),
|
|
9
|
+
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),Uu=(e,t=[])=>o(o(Gu(e),([n,r])=>o(Nu(r),([a,i])=>[[n,a],i])),([n,r])=>Uu(r,[...t,n]),()=>[t,e]),lx=e=>o(o(Uu(e),([t,n])=>o(o(o(Gu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[op(t),n]),bo=e=>o(o(c("{",e),([t,n])=>o(lx(n),([r,a])=>o(c("}",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[sp(t),n]),dx=e=>o(bo(e),([t,n])=>[mp(t),n]),fx=e=>o(o(o(W(e),([t,n])=>o(c("?",n),([r,a])=>o(c(":",a),([i,m])=>o(c("readonly",m),([u,l])=>o(S(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(c(":",n),([r,a])=>o(c("readonly",a),([i,m])=>o(S(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(c("?",n),([r,a])=>o(c(":",a),([i,m])=>o(S(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(c(":",n),([r,a])=>o(S(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[pp(t),n]),hx=e=>o(o(c("readonly",e),([t,n])=>o(S(n),([r,a])=>o(c("?",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[up(t),n]),gx=e=>o(o(c("readonly",e),([t,n])=>o(S(n),([r,a])=>[[t,r],a])),([t,n])=>[cp(t),n]),yx=e=>o(o(S(e),([t,n])=>o(c("?",n),([r,a])=>[[t,r],a])),([t,n])=>[lp(t),n]),$u=e=>o(o(fx(e),([t,n])=>[t,n],()=>o(hx(e),([t,n])=>[t,n],()=>o(gx(e),([t,n])=>[t,n],()=>o(yx(e),([t,n])=>[t,n],()=>o(S(e),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),_u=e=>o(o(o(c("...",e),([t,n])=>o($u(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o($u(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[dp(t),n]),Ku=(e,t=[])=>o(o(_u(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>Ku(r,[...t,n]),()=>[t,e]),xx=e=>o(o(Ku(e),([t,n])=>o(o(o(_u(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[fp(t),n]),Ix=e=>o(o(c("[",e),([t,n])=>o(xx(n),([r,a])=>o(c("]",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[hp(t),n]),bx=e=>o(o(W(e),([t,n])=>o(c("?",n),([r,a])=>o(c(":",a),([i,m])=>o(c("readonly",m),([u,l])=>o(S(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[gp(t),n]),vx=e=>o(o(W(e),([t,n])=>o(c(":",n),([r,a])=>o(c("readonly",a),([i,m])=>o(S(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[yp(t),n]),$x=e=>o(o(W(e),([t,n])=>o(c("?",n),([r,a])=>o(c(":",a),([i,m])=>o(S(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[xp(t),n]),Tx=e=>o(o(W(e),([t,n])=>o(c(":",n),([r,a])=>o(S(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Ip(t),n]),Tu=e=>o(o(bx(e),([t,n])=>[t,n],()=>o(vx(e),([t,n])=>[t,n],()=>o($x(e),([t,n])=>[t,n],()=>o(Tx(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),zu=e=>o(o(o(c("...",e),([t,n])=>o(Tu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(Tu(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[bp(t),n]),Bu=(e,t=[])=>o(o(zu(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>Bu(r,[...t,n]),()=>[t,e]),Vu=e=>o(o(Bu(e),([t,n])=>o(o(o(zu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[vp(t),n]),kx=e=>o(o(c("(",e),([t,n])=>o(Vu(n),([r,a])=>o(c(")",a),([i,m])=>o(c("=>",m),([u,l])=>o(S(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[$p(t),n]),wx=e=>o(o(c("new",e),([t,n])=>o(c("(",n),([r,a])=>o(Vu(a),([i,m])=>o(c(")",m),([u,l])=>o(c("=>",l),([f,h])=>o(S(h),([$,E])=>[[t,r,i,u,f,$],E])))))),([t,n])=>[Tp(t),n]),Ex=e=>o(o(o(c("+",e),([t,n])=>o(c("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c("-",e),([t,n])=>o(c("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[kp(t),n]),Rx=e=>o(o(o(c("+",e),([t,n])=>o(c("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c("-",e),([t,n])=>o(c("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[wp(t),n]),Sx=e=>o(o(o(c("as",e),([t,n])=>o(S(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ep(t),n]),Ox=e=>o(o(c("{",e),([t,n])=>o(Ex(n),([r,a])=>o(c("[",a),([i,m])=>o(W(m),([u,l])=>o(c("in",l),([f,h])=>o(S(h),([$,E])=>o(Sx(E),([A,H])=>o(c("]",H),([te,ne])=>o(Rx(ne),([ue,tt])=>o(c(":",tt),([N,nt])=>o(S(nt),([Ue,ct])=>o(Ru(ct),([rt,lt])=>o(c("}",lt),([zt,dt])=>[[t,r,i,u,f,$,A,te,ue,N,Ue,rt,zt],dt]))))))))))))),([t,n])=>[Rp(t),n]),Px=e=>o(W(e),([t,n])=>[Sp(t),n]),Ax=e=>o(fo(e),([t,n])=>[Op(t),n]),Cx=e=>o(fa(e),([t,n])=>[Pp(t),n]),Mx=e=>o(o(c("true",e),([t,n])=>[t,n],()=>o(c("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[Ap(t),n]),Lx=e=>o(ha(['"',"'"],e),([t,n])=>[t,n]),qx=e=>o(c("null",e),([t,n])=>[Cp(t),n]),jx=e=>o(c("undefined",e),([t,n])=>[void 0,n]),Wu=e=>o(o(Du(e),([t,n])=>o(c(":",n),([r,a])=>o(vo(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Mp(t),n]),Hu=(e,t=[])=>o(o(Wu(e),([n,r])=>o(Nu(r),([a,i])=>[[n,a],i])),([n,r])=>Hu(r,[...t,n]),()=>[t,e]),Fx=e=>o(o(Hu(e),([t,n])=>o(o(o(Wu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Lp(t),n]),Yu=e=>o(o(c("{",e),([t,n])=>o(Fx(n),([r,a])=>o(c("}",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[qp(t),n]),Ju=(e,t=[])=>o(o(vo(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>Ju(r,[...t,n]),()=>[t,e]),Dx=e=>o(o(Ju(e),([t,n])=>o(o(o(vo(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[jp(t),n]),Gx=e=>o(o(c("[",e),([t,n])=>o(Dx(n),([r,a])=>o(c("]",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Fp(t),n]),vo=e=>o(o(Ax(e),([t,n])=>[t,n],()=>o(Cx(e),([t,n])=>[t,n],()=>o(Mx(e),([t,n])=>[t,n],()=>o(Lx(e),([t,n])=>[t,n],()=>o(qx(e),([t,n])=>[t,n],()=>o(jx(e),([t,n])=>[t,n],()=>o(Yu(e),([t,n])=>[t,n],()=>o(Gx(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),Nx=e=>o(c("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[Dp(t),n]),Ux=e=>o(c(".*",e),([t,n])=>[Gp(t),n]),_x=e=>o(c("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[Np(t),n]),Kx=e=>o(c("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[Up(t),n]),zx=e=>o(c("(?!)",e),([t,n])=>[_p(t),n]),Bx=e=>o(vu(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[Kp(t),n]),Vx=e=>o(o(Nx(e),([t,n])=>[t,n],()=>o(Ux(e),([t,n])=>[t,n],()=>o(_x(e),([t,n])=>[t,n],()=>o(Kx(e),([t,n])=>[t,n],()=>o(zx(e),([t,n])=>[t,n],()=>o(Wx(e),([t,n])=>[t,n],()=>o(Bx(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),Wx=e=>o(o(c("(",e),([t,n])=>o($o(n),([r,a])=>o(c(")",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[zp(t),n]),Zu=e=>o(o(o(yo(e),([t,n])=>o(c("|",n),([r,a])=>o(Zu(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o(o(yo(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[Bp(t),n]),yo=e=>o(o(Vx(e),([t,n])=>o($o(n),([r,a])=>[[t,r],a])),([t,n])=>[Vp(t),n]),$o=e=>o(o(Zu(e),([t,n])=>[t,n],()=>o(yo(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ws=e=>o(o(c("^",e),([t,n])=>o($o(n),([r,a])=>o(c("$",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Wp(t),n]),Xu=(e,t=[])=>o(o(S(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>Xu(r,[...t,n]),()=>[t,e]),Hx=e=>o(o(Xu(e),([t,n])=>o(o(o(S(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Hp(t),n]),Qu=e=>o(o(o(c("extends",e),([t,n])=>o(Hx(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Yp(t),n]),Yx=e=>o(o(c("interface",e),([t,n])=>o(W(n),([r,a])=>o(xo(a),([i,m])=>o(Qu(m),([u,l])=>o(bo(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[Jp(t),n]),Jx=e=>o(o(c("interface",e),([t,n])=>o(W(n),([r,a])=>o(Qu(a),([i,m])=>o(bo(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[Zp(t),n]),Zx=e=>o(o(c("type",e),([t,n])=>o(W(n),([r,a])=>o(xo(a),([i,m])=>o(c("=",m),([u,l])=>o(S(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[Xp(t),n]),Xx=e=>o(o(c("type",e),([t,n])=>o(W(n),([r,a])=>o(c("=",a),([i,m])=>o(S(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[Qp(t),n]),Qx=e=>o(o(o(c("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[eu(t),n]),eI=e=>o(o(o(c(";",e),([t,n])=>o(c(`
|
|
10
10
|
`,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(c(`
|
|
11
|
-
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),Qu=(e,t=[])=>o(o(To(e),([n,r])=>o(Qx(r),([a,i])=>[[n,a],i])),([n,r])=>Qu(r,[...t,n]),()=>[t,e]),eI=e=>o(o(Qu(e),([t,n])=>o(o(o(To(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[eu(t),n]),To=e=>o(o(Zx(e),([t,n])=>o(o(Hx(n),([r,a])=>[r,a],()=>o(Yx(n),([r,a])=>[r,a],()=>o(Jx(n),([r,a])=>[r,a],()=>o(Xx(n),([r,a])=>[r,a],()=>[])))),([r,a])=>o(Eu(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[tu(t),n]),tI=e=>o(o(To(e),([t,n])=>o(eI(n),([r,a])=>[[t,r],a])),([t,n])=>[nu(t),n]),ec=e=>o(o(tI(e),([t,n])=>[t,n],()=>o(rx(e),([t,n])=>[t,n],()=>o(R(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function tc(e){let t=Io(`\`${e}\``);return s.IsEqual(t.length,2)?t[0]:Y()}function rI(e){return e.join("|")}function aI(e){return e.slice(1,e.length-1)}function oI(e,t,n){return kt(t,`${n}${e}`)}function iI(e,t){return kt(e,`${t}${xs}`)}function sI(e,t){return kt(e,`${t}${Ar}`)}function mI(e,t){return kt(e,`${t}${Mr}`)}function pI(e,t){return Kn(w([O("false"),O("true")]),e,t)}function uI(e,t){return kt(e,`${t}${Lr}`)}function cI(e,t,n){return kt(t,`${n}${aI(e)}`)}function lI(e,t,n){let r=zn(e,{});return Kn(r,t,n)}function dI(e,t,n){let r=Re(e);return Kn(r,t,n)}function nc(e,t,n,r=[]){return s.ShiftLeft(e,(a,i)=>nc(i,t,n,[...r,Kn(a,[],"")]),()=>kt(t,`${n}(${rI(r)})`))}function Kn(e,t,n){return he(e)?dI(e.enum,t,n):ge(e)?sI(t,n):q(e)?oI(e.const,t,n):He(e)?iI(t,n):Ae(e)?pI(t,n):X(e)?mI(t,n):ye(e)?uI(t,n):Z(e)?cI(e.pattern,t,n):ac(e)?lI(e.parameters[0],t,n):x(e)?nc(e.anyOf,t,n):Qi}function kt(e,t){return s.ShiftLeft(e,(n,r)=>Kn(n,r,t),()=>t)}function fI(e){return`^${kt(e,"")}$`}function rc(e){let t=fI(e);return jr(t)}function zn(e,t){return k(e)?p.Update(rc(e),{},t):Br(e,t)}function oc(e,t,n,r){let a=Se(e,t,n);return zn(a,r)}function Br(e,t={}){return I("TemplateLiteral",[e],t)}function ac(e){return ee(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function ic(e){return zn(e,{})}function hI(e){let t=tc(e);return ic(t)}function sc(e,t={}){let n=s.IsString(e)?hI(e):ic(e);return p.Update(n,{},t)}function Z(e){return y(e,"TemplateLiteral")}var b={};Rt(b,{ExtendsFalse:()=>T,ExtendsTrue:()=>g,ExtendsUnion:()=>ko,IsExtendsFalse:()=>gI,IsExtendsTrue:()=>pc,IsExtendsTrueLike:()=>on,IsExtendsUnion:()=>mc,Match:()=>_});function ko(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function mc(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsUnion")&&s.IsObject(e.inferred)}function g(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function pc(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsTrue")&&s.IsObject(e.inferred)}function T(){return p.Create({"~kind":"ExtendsFalse"},{})}function gI(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function on(e){return mc(e)||pc(e)}function _(e,t,n){return on(e)?t(e.inferred):n()}function yI(e,t,n,r){return _(A(e,n,r),a=>g(p.Assign(p.Assign(e,a),{[t]:n})),()=>T())}function xI(e,t){return g(e)}function II(e,t,n,r,a){return _(A(e,t,n),i=>_(A(i,t,r),m=>g(m),()=>T()),()=>_(A(e,t,a),i=>g(i),()=>T()))}function bI(e,t,n){let r=Re(n);return A(e,t,r)}function uc(e,t,n){return s.ShiftLeft(n,(r,a)=>_(A(e,t,r),i=>uc(i,t,a),()=>T()),()=>g(e))}function vI(e,t,n){let r=ve(n);return A(e,t,r)}function cc(e,t,n){return s.ShiftLeft(n,(r,a)=>_(A(e,t,r),i=>g(i),()=>cc(e,t,a)),()=>T())}function j(e,t,n){return J(n)?xI(e,t):V(n)?II(e,t,n.if,n.then,n.else):he(n)?bI(e,t,n.enum):H(n)?yI(e,n.name,t,n.extends):S(n)?uc(e,t,n.allOf):Z(n)?vI(e,t,n.pattern):x(n)?cc(e,t,n.anyOf):te(n)?g(e):T()}function lc(e,t,n){return H(n)?j(e,t,n):J(n)?g(e):te(n)?g(e):ko(e)}function $I(e,t){let n=Mt(e),r=Mt(t);return n&&r||!n&&r?!0:!(n&&!r)}function dc(e,t,n,r){return K(r)?$I(t,r)?A(e,n,r.items):T():j(e,t,r)}function fc(e,t,n){return He(n)?g(e):j(e,t,n)}function hc(e,t,n){return Ae(n)?g(e):j(e,t,n)}function TI(e,t,n,r,a){let i=H(r)?t:r,m=H(r)?r:t,u=de(t),l=de(r);return!u&&l?T():_(A(e,i,m),f=>Bn(f,n,a),()=>T())}function kI(e,t,n,r){return s.ShiftLeft(r,(a,i)=>TI(e,t,n,a,i),()=>de(t)?g(e):T())}function wI(e,t,n){return s.ShiftLeft(t,(r,a)=>kI(e,r,a,n),()=>g(e))}function Bn(e,t,n){return wI(e,t,n)}function xa(e,t,n){return Ye(n)?g(e):A(e,t,n)}function gc(e,t,n,r){return J(r)?g(e):te(r)?g(e):ae(r)?_(Bn(e,t,r.parameters),a=>xa(a,n,r.instanceType),()=>T()):T()}function yc(e,t,n,r,a){return _(A(e,t,a),()=>A(e,n,a),()=>A(e,r,a))}function xc(e,t,n){let r=Re(t);return A(e,r,n)}function Ic(e,t,n,r){return J(r)?g(e):te(r)?g(e):oe(r)?_(Bn(e,t,r.parameters),a=>xa(a,n,r.returnType),()=>T()):T()}function bc(e,t,n){return ge(n)?g(e):X(n)?g(e):j(e,t,n)}function vc(e,t,n){let r=z(t);return A(e,r,n)}function Ia(e,t,n){return t===n?g(e):T()}function EI(e,t,n){return q(n)?Ia(e,t,n.const):He(n)?g(e):j(e,O(t),n)}function RI(e,t,n){return q(n)?Ia(e,t,n.const):Ae(n)?g(e):j(e,O(t),n)}function SI(e,t,n){return q(n)?Ia(e,t,n.const):X(n)?g(e):j(e,O(t),n)}function OI(e,t,n){return q(n)?Ia(e,t,n.const):ye(n)?g(e):j(e,O(t),n)}function $c(e,t,n){return s.IsBigInt(t.const)?EI(e,t.const,n):s.IsBoolean(t.const)?RI(e,t.const,n):s.IsNumber(t.const)?SI(e,t.const,n):s.IsString(t.const)?OI(e,t.const,n):Y()}function Tc(e,t,n){return H(n)?j(e,t,n):g(e)}function kc(e,t,n){return Yt(n)?g(e):j(e,t,n)}function wc(e,t,n){return X(n)?g(e):j(e,t,n)}function PI(e,t,n){return de(t)?de(n)?g(e):T():g(e)}function AI(e,t,n){return H(n)&&yt(n.extends)?T():_(A(e,t,n),r=>PI(r,t,n),()=>T())}function CI(e,t){return e.reduce((n,r)=>r in t?on(t[r])?{...n,...t[r].inferred}:Y():Y(),{})}function MI(e,t,n){let r={};for(let m of s.Keys(n))r[m]=m in t?AI({},t[m],n[m]):de(n[m])?H(n[m])?g(p.Assign(e,{[n[m].name]:n[m].extends})):g(e):T();let a=s.Values(r).every(m=>on(m)),i=a?CI(s.Keys(r),r):{};return a?g(i):T()}function LI(e,t,n){let r=MI(e,t,n);return on(r)?g(p.Assign(e,r.inferred)):T()}function qI(e,t,n){return LI(e,t,n)}function jI(e,t){return s.Keys(t).reduce((n,r)=>({...n,[r]:s.HasPropertyKey(e,r)?x(n[r])?w([...n[r].anyOf,t[r]]):w([e[r],t[r]]):t[r]}),e)}function Ec(e,t,n,r){return s.ShiftLeft(t,(a,i)=>_(A({},e[a],n),m=>Ec(e,i,n,jI(r,m)),()=>T()),()=>g(r))}function FI(e,t,n,r){let a=s.Keys(t);return Ec(t,a,r,e)}function Rc(e,t,n){return ce(n)?FI(e,t,Le(n),xe(n)):L(n)?qI(e,t,n.properties):j(e,v(t),n)}function DI(e,t){return s.IsEqual(s.Keys(t).length,0)?g(e):T()}function GI(e,t,n,r,a){return A(e,n,a)}function Sc(e,t,n,r){return ce(r)?GI(e,Ur(t),n,Ur(Le(r)),xe(r)):L(r)?DI(e,r.properties):J(r)?g(e):te(r)?g(e):T()}function Oc(e,t,n){return ye(n)?g(e):j(e,t,n)}function Pc(e,t,n){return xt(n)?g(e):j(e,t,n)}function Ac(e,t,n){let r=ve(t);return A(e,r,n)}function wo(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Vn(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 Eo(e){return vt(e)?H(e.items)?K(e.items.extends)?wo(e.items.name,e.items.extends.items):te(e.items.extends)?wo(e.items.name,e.items.extends):void 0:Y():void 0}function ba(e){return H(e)?wo(e.name,e.extends):void 0}function Ro(e,t,n=[]){return s.ShiftLeft(e,(r,a)=>_(A({},r,t),()=>Ro(a,t,[...n,r]),()=>{}),()=>n)}function Cc(e,t,n,r){let a=Ro(n,r);return s.IsArray(a)?g(p.Assign(e,{[t]:Q(a)})):T()}function va(e,t,n,r){let a=Ro(n,r);return s.IsArray(a)?g(p.Assign(e,{[t]:w(a)})):T()}function NI(e){return[...e].reverse()}function So(e,t){return t?NI(e):e}function UI(e){let t=e.length>0?e[0]:void 0,n=ee(t)?Eo(t):void 0;return ee(n)}function _I(e,t,n,r,a,i){return _(A(e,n,a),m=>Mc(m,t,r,i),()=>T())}function KI(e,t,n,r,a){let i=Eo(r);return Vn(i)?Cc(e,i.name,So(n,t),i.type):s.ShiftLeft(n,(m,u)=>_I(e,t,m,u,r,a),()=>T())}function zI(e,t,n,r){return s.ShiftLeft(r,(a,i)=>KI(e,t,n,a,i),()=>s.IsEqual(n.length,0)?g(e):T())}function Mc(e,t,n,r){return zI(e,t,n,r)}function BI(e,t,n){let r=wt(e,U([],[]),n),a=UI(r);return Mc(e,a,So(t,a),So(r,a))}function Lc(e,t,n){let r=ba(n);return Vn(r)?va(e,r.name,t,r.type):s.ShiftLeft(t,(a,i)=>_(A(e,a,n),m=>Lc(m,i,n),()=>T()),()=>g(e))}function qc(e,t,n){let r=wt(e,U([],[]),t);return G(n)?BI(e,r,n.items):K(n)?Lc(e,r,n.items):j(e,Q(r),n)}function jc(e,t,n){return Ye(n)?g(e):tn(n)?g(e):j(e,t,n)}function Fc(e,t,n){return s.ShiftLeft(n,(r,a)=>_(A(e,t,r),i=>g(i),()=>Fc(e,t,a)),()=>T())}function Oo(e,t,n){return s.ShiftLeft(t,(r,a)=>_(Fc(e,r,n),i=>Oo(i,a,n),()=>T()),()=>g(e))}function Dc(e,t,n){let r=ba(n);return Vn(r)?va(e,r.name,t,r.type):x(n)?Oo(e,t,n.anyOf):Oo(e,t,[n])}function Gc(e,t,n){return H(n)?j(e,t,n):J(n)?g(e):te(n)?g(e):T()}function Nc(e,t,n){return Ye(n)?g(e):j(e,t,n)}function A(e,t,n){return J(t)?lc(e,t,n):K(t)?dc(e,t,t.items,n):He(t)?fc(e,t,n):Ae(t)?hc(e,t,n):ae(t)?gc(e,t.parameters,t.instanceType,n):V(t)?yc(e,t.if,t.then,t.else,n):he(t)?xc(e,t.enum,n):oe(t)?Ic(e,t.parameters,t.returnType,n):ge(t)?bc(e,t,n):S(t)?vc(e,t.allOf,n):q(t)?$c(e,t,n):yt(t)?Tc(e,t,n):Yt(t)?kc(e,t,n):X(t)?wc(e,t,n):L(t)?Rc(e,t.properties,n):ce(t)?Sc(e,Le(t),xe(t),n):ye(t)?Oc(e,t,n):xt(t)?Pc(e,t,n):Z(t)?Ac(e,t.pattern,n):G(t)?qc(e,t.items,n):tn(t)?jc(e,t,n):x(t)?Dc(e,t.anyOf,n):te(t)?Gc(e,t,n):Ye(t)?Nc(e,t,n):T()}function VI(e,t){return z([...e,v(t)])}function Po(e,t,n){return k(e)?p.Update(VI(e,t),{},n):Dn(e,t,n)}function Uc(e,t,n,r,a){let i=Se(e,t,n),m=Wn(e,t,r);return Po(i,m,a)}function Dn(e,t,n={}){return I("Interface",[e,t],n)}function sn(e){return ee(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function _c(e,t,n={}){return Po(e,t,n)}function WI(e,t,n){return e.includes(n)?!0:Hn([...e,n],t,t[n])}function Kc(e,t,n){let r=Er(n);return Nt(e,t,r)}function Nt(e,t,n){return s.ShiftLeft(n,(r,a)=>Hn(e,t,r)?!0:Nt(e,t,a),()=>!1)}function Hn(e,t,n){return ie(n)?WI(e,t,n.$ref):K(n)?Hn(e,t,n.items):ae(n)?Nt(e,t,[...n.parameters,n.instanceType]):oe(n)?Nt(e,t,[...n.parameters,n.returnType]):sn(n)?Kc(e,t,n.parameters[1]):S(n)?Nt(e,t,n.allOf):L(n)?Kc(e,t,n.properties):x(n)?Nt(e,t,n.anyOf):G(n)?Nt(e,t,n.items):ce(n)?Hn(e,t,xe(n)):!1}function zc(e,t,n){return Hn(e,t,n)}function HI(e,t){return t.reduce((n,r)=>zc([r],e,e[r])?[...n,r]:n,[])}function Bc(e){let t=wr(e);return HI(e,t)}function YI(e,t,n){return n.includes(t)?n:t in e?Yn(e,e[t],[...n,t]):Y()}function Vc(e,t,n){let r=Er(t);return mn(e,r,n)}function mn(e,t,n){return t.reduce((r,a)=>Yn(e,a,r),n)}function Yn(e,t,n){return ie(t)?YI(e,t.$ref,n):K(t)?Yn(e,t.items,n):ae(t)?mn(e,[...t.parameters,t.instanceType],n):oe(t)?mn(e,[...t.parameters,t.returnType],n):sn(t)?Vc(e,t.parameters[1],n):S(t)?mn(e,t.allOf,n):L(t)?Vc(e,t.properties,n):x(t)?mn(e,t.anyOf,n):G(t)?mn(e,t.items,n):ce(t)?Yn(e,xe(t),n):n}function Wc(e,t,n){return Yn(e,n,[t])}function JI(e){return Vt()}function XI(e){return s.Keys(e).reduce((t,n)=>({...t,[n]:Ut(e[n])}),{})}function Jn(e){return e.reduce((t,n)=>[...t,Ut(n)],[])}function Ut(e){return ie(e)?JI(e.$ref):K(e)?Ee(Ut(e.items),kr(e)):ae(e)?_e(Jn(e.parameters),Ut(e.instanceType)):oe(e)?Ke(Jn(e.parameters),Ut(e.returnType)):S(e)?fe(Jn(e.allOf)):L(e)?v(XI(e.properties)):ce(e)?Nr(Qt(e),Ut(xe(e))):x(e)?w(Jn(e.anyOf)):G(e)?Q(Jn(e.items)):e}function ZI(e,t){return t in e?Ut(e[t]):se()}function Hc(e){return ZI(e.$defs,e.$ref)}function QI(e,t,n){let r=Se(e,U([],[]),t),a=Wn({},U([],[]),n);return z([...r,v(a)])}function eb(e,t){return s.Keys(e).filter(r=>t.includes(r)).reduce((r,a)=>{let i=e[a],m=sn(i)?QI(e,i.parameters[0],i.parameters[1]):i;return{...r,[a]:m}},{})}function Yc(e,t,n){let r=Wc(e,t,n),a=eb(e,r);return Be(a,t)}function Jc(e,t){return t in e?ie(e[t])?Jc(e,e[t].$ref):e[t]:F()}function Je(e,t){return Jc(e,t)}function Xc(e){return pe(e)?Hc(e):Rr(e)?se():e}function ue(e,t,n){let r=Xc(t),a=Xc(n);return A(e,r,a)}var Cn="equal",tb="disjoint",Mn="left-inside",Ln="right-inside";function Xt(e,t){let n=[te(e)?b.ExtendsFalse():ue({},e,t),te(e)?b.ExtendsTrue({}):ue({},t,e)];return b.IsExtendsTrueLike(n[0])&&b.IsExtendsTrueLike(n[1])?Cn:b.IsExtendsTrueLike(n[0])&&b.IsExtendsFalse(n[1])?Mn:b.IsExtendsFalse(n[0])&&b.IsExtendsTrueLike(n[1])?Ln:tb}function nb(e,t){return t.filter(n=>Xt(e,n)!==Ln)}function rb(e,t){let n=t.some(r=>{let a=Xt(e,r);return s.IsEqual(a,Mn)||s.IsEqual(a,Cn)});return s.IsEqual(n,!1)}function ab(e,t){let n=Me(e);return J(n)?[n]:rb(n,t)?[...nb(n,t),n]:t}function ob(e){return e.reduce((t,n)=>L(n)?[...t,n]:yt(n)?t:ab(n,t),[])}function so(e){let t=ob(e);return jn(t)}function Ao(e,t){return p.Update(Me(e),{},t)}function Zc(e,t,n,r){let a=d(e,t,n);return Ao(a,r)}function Xn(e,t=[]){return ht(e)&&s.IsEqual(e.action,"Conditional")?ie(e.parameters[0])?Xn(e.parameters[2],Xn(e.parameters[3],[...t,e.parameters[0].$ref])):Xn(e.parameters[2],Xn(e.parameters[3],t)):ht(e)&&s.IsEqual(e.action,"Mapped")&&ht(e.parameters[1])&&s.IsEqual(e.parameters[1].action,"KeyOf")&&ie(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function ib(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function tl(e,t,n=[]){return s.ShiftLeft(e,(r,a)=>s.ShiftLeft(t,(i,m)=>tl(a,m,[...n,[i,r]]),()=>n),()=>n)}function sb(e){return x(e)?[...e.anyOf]:[e]}function mb(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function Qc(e,t){return t.reduce((n,r)=>[...n,...mb(e,r)],[])}function el(e){return e.reduce((t,n)=>s.IsEqual(n[0],!0)?Qc(t,sb(n[1])):Qc(t,[n[1]]),[[]])}function nl(e,t,n){let r=Xn(n),a=ib(e,r),i=tl(t,a);return ht(n)&&s.IsEqual(n.action,"Conditional")||ht(n)&&s.IsEqual(n.action,"Mapped")?el(i):[t]}function pb(){return["(not-resolvable)",F()]}function ub(){return["(not-generic)",F()]}function cb(e,t,n){return[e,gt(t,n)]}function lb(e,t,n){return t in e?rl(e,t,e[t],n):pb()}function rl(e,t,n,r){return Bt(n)?cb(t,n.parameters,n.expression):ie(n)?lb(e,n.$ref,r):ub()}function al(e,t,n){return rl(e,"(anonymous)",t,n)}function db(e,t,n){if(H(t)||pn(t)||b.IsExtendsTrueLike(ue({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function ol(e,t,n,r,a){let i=d(e,t,a);return db(n,i,r),p.Assign(e,{[n]:i})}function fb(e,t,n,r,a){let i=d(e,t,n.extends),m=d(e,t,n.equals);return s.ShiftLeft(a,(u,l)=>Co(ol(e,t,n.name,i,u),t,r,l),()=>Co(ol(e,t,n.name,i,m),t,r,[]))}function Co(e,t,n,r){return s.ShiftLeft(n,(a,i)=>fb(e,t,a,i,r),()=>e)}function il(e,t,n,r){return Co(e,t,n,r)}function hb(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function gb(e,t){return s.IsEqual(hb(e),t)}function yb(e,t,n,r,a,i){let m=il(e,t,r,i),u=d(m,U([...t.callstack,n.$ref],t.visited),a);return d(m,U([],[]),u)}function xb(e,t,n,r,a,i){return i.reduce((m,u)=>[...m,yb(e,t,n,r,a,u)],[])}function Ib(e,t,n,r,a,i){let m=nl(r,i,a),u=xb(e,t,n,r,a,m);return s.IsEqual(u.length,1)?u[0]:Te(u)}function $a(e,t,n,r){let a=Se(e,t,r),i=al(e,n,r),m=i[0],u=i[1];return Bt(u)?gb(t,m)?Gn(st(m),a):Ib(e,t,st(m),u.parameters,u.expression,a):Gn(n,a)}function Gn(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function sl(e,t){return $a({},U([],[]),e,t)}function pn(e){return y(e,"Call")}function bb(e){return p.Discard(e,["~immutable"])}function ml(e,t){return p.Update(bb(e),{},t)}function pl(e,t,n,r){let a=d(e,t,n);return ml(a,r)}function ul(e,t){return e(t)}function cl(e,t){return s.IsString(t)?O(ul(e,t)):O(t)}function ll(e,t){let n=ve(t);return ut(e,n)}function dl(e,t){let n=t.map(r=>ut(e,r));return w(n)}function ut(e,t){return q(t)?cl(e,t.const):Z(t)?ll(e,t.pattern):x(t)?dl(e,t.anyOf):t}function Vr(e,t={}){return I("Capitalize",[e],t)}function fl(e,t={}){return Mo(e,t)}function Wr(e,t={}){return I("Lowercase",[e],t)}function hl(e,t={}){return Lo(e,t)}function Hr(e,t={}){return I("Uncapitalize",[e],t)}function gl(e,t={}){return qo(e,t)}function Yr(e,t={}){return I("Uppercase",[e],t)}function yl(e,t={}){return jo(e,t)}var vb=e=>e[0].toUpperCase()+e.slice(1),$b=e=>e.toLowerCase(),Tb=e=>e[0].toLowerCase()+e.slice(1),kb=e=>e.toUpperCase();function Mo(e,t){return k([e])?p.Update(ut(vb,e),{},t):Vr(e,t)}function Lo(e,t){return k([e])?p.Update(ut($b,e),{},t):Wr(e,t)}function qo(e,t){return k([e])?p.Update(ut(Tb,e),{},t):Hr(e,t)}function jo(e,t){return k([e])?p.Update(ut(kb,e),{},t):Yr(e,t)}function xl(e,t,n,r){let a=d(e,t,n);return Mo(a,r)}function Il(e,t,n,r){let a=d(e,t,n);return Lo(a,r)}function bl(e,t,n,r){let a=d(e,t,n);return qo(a,r)}function vl(e,t,n,r){let a=d(e,t,n);return jo(a,r)}function Jr(e,t,n,r,a={}){return I("Conditional",[e,t,n,r],a)}function $l(e,t,n,r,a={}){return Fo({},U([],[]),e,t,n,r,a)}function wb(e,t,n,r,a,i){let m=ue(e,n,r);return b.IsExtendsUnion(m)?w([d(m.inferred,t,a),d(e,t,i)]):b.IsExtendsTrue(m)?d(m.inferred,t,a):d(e,t,i)}function Fo(e,t,n,r,a,i,m){return k([n,r])?p.Update(wb(e,t,n,r,a,i),{},m):Jr(n,r,a,i,m)}function Tl(e,t,n,r,a,i,m){let u=d(e,t,n),l=d(e,t,r);return Fo(e,t,u,l,a,i,m)}function Xr(e,t={}){return I("ConstructorParameters",[e],t)}function kl(e,t={}){return Do(e,t)}function Eb(e){let t=ae(e)?e.parameters:[],n=wt({},U([],[]),t);return Q(n)}function Do(e,t){return k([e])?p.Update(Eb(e),{},t):Xr(e,t)}function wl(e,t,n,r){let a=d(e,t,n);return Do(a,r)}function Zr(e,t,n={}){return I("Exclude",[e,t],n)}function El(e,t,n={}){return Zn(e,t,n)}function Zn(e,t,n){return k([e,t])?p.Update(Dr(e,t),{},n):Zr(e,t,n)}function Rl(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return Zn(i,m,a)}function Qr(e,t,n={}){return I("Extract",[e,t],n)}function Sl(e,t,n={}){return Go(e,t,n)}function Rb(e,t){let n=ue({},e,t);return b.IsExtendsTrueLike(n)?[e]:[]}function Sb(e,t){return e.reduce((n,r)=>[...n,...Rb(r,t)],[])}function Ol(e,t){let n=Me(e),r=x(n)?n.anyOf:[n],a=Sb(r,t);return Te(a)}function Go(e,t,n){return k([e,t])?p.Update(Ol(e,t),{},n):Qr(e,t,n)}function Pl(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return Go(i,m,a)}function Ob(e){return e.reduce((t,n)=>Cr(n)?[...t,O(n)]:t,[])}function un(e){let t=Ob(e);return w(t)}function Nn(e,t,n={}){return I("Index",[e,t],n)}function Al(e,t,n={}){let r=s.IsArray(t)?un(t):t;return No(e,r,n)}function Cl(e,t){let n=Je(e,t);return Oe(n)}function Ml(e,t,n){let r=Ne(e,t,n);return Oe(r)}function Pb(e,t){let n=s.Keys(e).filter(h=>!s.HasPropertyKey(t,h)),r=s.Keys(t).filter(h=>!s.HasPropertyKey(e,h)),a=s.Keys(e).filter(h=>s.HasPropertyKey(t,h)),i=n.reduce((h,$)=>({...h,[$]:e[$]}),{}),m=r.reduce((h,$)=>({...h,[$]:t[$]}),{}),u=a.reduce((h,$)=>({...h,[$]:z([e[$],t[$]])}),{}),l=p.Assign(i,m);return p.Assign(l,u)}function Ll(e){return e.reduce((t,n)=>Pb(t,Oe(n)),{})}function ql(e){let t=Ns(Q(e));return Oe(t)}function Ab(e,t){return s.Keys(e).filter(a=>a in t).reduce((a,i)=>({...a,[i]:Te([e[i],t[i]])}),{})}function jl(e,t){return s.ShiftLeft(e,(n,r)=>jl(r,Ab(t,Oe(n))),()=>t)}function Fl(e){return s.ShiftLeft(e,(t,n)=>jl(n,Oe(t)),()=>Y())}function Oe(e){return pe(e)?Cl(e.$defs,e.$ref):V(e)?Ml(e.if,e.then,e.else):S(e)?Ll(e.allOf):x(e)?Fl(e.anyOf):G(e)?ql(e.items):L(e)?e.properties:{}}function cn(e){let t=Oe(e);return v(t)}var Cb=new RegExp("^(?:0|[1-9][0-9]*)$");function ln(e){let t=`${e}`;return Cb.test(t)?parseInt(t):e}function Mb(e){return O(ln(e))}function Dl(e){return e.map(t=>Gl(t))}function Gl(e){return S(e)?fe(Dl(e.allOf)):x(e)?w(Dl(e.anyOf)):q(e)?Mb(e.const):e}function Nl(e,t){let n=Gl(t),r=ue({},n,$e());return b.IsExtendsTrueLike(r)?e:q(t)&&s.IsEqual(t.const,"length")?$e():F()}function Ul(e,t){let n=Je(e,t);return ke(n)}function _l(e,t,n){let r=Ne(e,t,n);return ke(r)}function Kl(e){let t=Re(e);return ke(t)}function zl(e){let t=z(e);return ke(t)}function Bl(e){return[`${e}`]}function Vl(e){let t=ve(e);return ke(t)}function Wl(e){return e.reduce((t,n)=>[...t,...ke(n)],[])}function ke(e){return pe(e)?Ul(e.$defs,e.$ref):V(e)?_l(e.if,e.then,e.else):he(e)?Kl(e.enum):S(e)?zl(e.allOf):q(e)?Bl(e.const):Z(e)?Vl(e.pattern):x(e)?Wl(e.anyOf):[]}function dn(e){return ke(e)}function Qn(e,t){return t.map(n=>er(e,n))}function er(e,t){return K(t)?Ee(er(e,t.items)):ae(t)?_e(Qn(e,t.parameters),er(e,t.instanceType)):oe(t)?Ke(Qn(e,t.parameters),er(e,t.returnType)):G(t)?Q(Qn(e,t.items)):x(t)?w(Qn(e,t.anyOf)):S(t)?fe(Qn(e,t.allOf)):Kr(t)?v(e):t}function Hl(e,t){return er(e,t)}function Lb(e,t){let n=t in e?e[t]:F();return Hl(e,n)}function Yl(e,t){return t.reduce((n,r)=>[...n,Lb(e,r)],[])}function qb(e,t){let n=dn(t),r=Yl(e,n);return Te(r)}var jb=new RegExp(bt);function Fb(e){return e.filter(n=>jb.test(n))}function Db(e){let t=wr(e),n=Fb(t),r=Yl(e,n);return Te(r)}function Jl(e,t){return X(t)?Db(e):qb(e,t)}function Gb(e){return O(ln(e))}function Xl(e){return e.map(t=>Uo(t))}function Uo(e){return S(e)?fe(Xl(e.allOf)):x(e)?w(Xl(e.anyOf)):q(e)?Gb(e.const):e}function Nb(e,t){return e.reduceRight((n,r,a)=>{let i=ue({},O(a),t);return b.IsExtendsTrueLike(i)?[r,...n]:n},[])}function Ub(e,t){let n=Uo(t),r=Nb(e,n);return mt(r)}function _b(e){return mt(e)}function Zl(e,t){return q(t)&&s.IsEqual(t.const,"length")?O(e.length):X(t)||ge(t)?_b(e):Ub(e,t)}function Ql(e,t){return K(e)?Nl(e.items,t):L(e)?Jl(e.properties,t):G(e)?Zl(e.items,t):F()}function Kb(e){return pe(e)||V(e)||S(e)||x(e)?cn(e):e}function No(e,t,n){return k([e,t])?p.Update(Ql(Kb(e),t),{},n):Nn(e,t,n)}function ed(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return No(i,m,a)}function ea(e,t={}){return I("InstanceType",[e],t)}function td(e,t={}){return _o(e,t)}function zb(e){return ae(e)?e.instanceType:F()}function _o(e,t){return k([e])?p.Update(zb(e),{},t):ea(e,t)}function nd(e,t,n,r={}){let a=d(e,t,n);return _o(a,r)}function Un(e,t={}){return I("KeyOf",[e],t)}function rd(e,t={}){return Ko(e,t)}function ad(){return w([$e(),Ce(),Jt()])}function od(e){return $e()}function Bb(e){return e.reduce((n,r)=>Cr(r)?[...n,O(ln(r))]:Y(),[])}function id(e){let t=s.Keys(e),n=Bb(t);return mt(n)}function sd(e){return Qt(e)}function md(e){let t=e.map((n,r)=>O(r));return mt(t)}function pd(e){return J(e)?ad():K(e)?od(e.items):L(e)?id(e.properties):ce(e)?sd(e):G(e)?md(e.items):F()}function Vb(e){return pe(e)||V(e)||S(e)||x(e)?cn(e):e}function Ko(e,t){return k([e])?p.Update(pd(Vb(e)),{},t):Un(e,t)}function ud(e,t,n,r){let a=d(e,t,n);return Ko(a,r)}function Fn(e,t,n,r,a={}){return I("Mapped",[e,t,n,r],a)}function cd(e,t,n,r,a={}){return zo({},U([],[]),e,t,n,r,a)}function Wb(e){let t=ve(e);return Ta(t)}function Hb(e){return e.reduce((t,n)=>[...t,...Ta(n)],[])}function Yb(e){let t=Re(e);return Ta(t)}function Jb(e){return s.IsNumber(e)?[O(`${e}`)]:[O(e)]}function Ta(e){return he(e)?Yb(e.enum):q(e)?Jb(e.const):Z(e)?Wb(e.pattern):x(e)?Hb(e.anyOf):[e]}function ld(e){return Ta(e)}function Xb(e){return Z(e)?ve(e.pattern):e}function Zb(e,t,n,r,a,i){let m=p.Assign(e,{[n.name]:r}),u=d(m,t,a),l=Xb(u),f=d(m,t,i);return bs(l)||vs(l)?{[l.const]:f}:{}}function Qb(e,t,n,r,a,i){return r.reduce((m,u)=>[...m,Zb(e,t,n,u,a,i)],[])}function ev(e){return e.reduce((t,n)=>[...t,v(n)],[])}function dd(e,t,n,r,a,i){let m=ld(r),u=Qb(e,t,n,m,a,i),l=ev(u);return z(l)}function zo(e,t,n,r,a,i,m){return k([r])?p.Update(dd(e,t,n,r,a,i),{},m):Fn(n,r,a,i,m)}function fd(e,t,n,r,a,i,m){let u=d(e,t,r);return zo(e,t,n,u,a,i,m)}function tv(e,t,n){let r=p.Assign(e,t);return s.Keys(t).filter(i=>n.includes(i)).reduce((i,m)=>({...i,[m]:Yc(r,m,t[m])}),{})}function nv(e,t,n){let r=p.Assign(e,t);return s.Keys(t).filter(i=>!n.includes(i)).reduce((i,m)=>({...i,[m]:d(r,U([],[]),t[m])}),{})}function rv(e,t,n){let r=Bc(t),a=tv(e,t,r),i=nv(e,t,r),m={...a,...i};return p.Update(m,{},n)}function ka(e,t,n,r){return rv(e,n,r)}function ta(e,t={}){return I("NonNullable",[e],t)}function hd(e,t={}){return Bo(e,t)}function av(e){let t=w([Ht(),en()]);return Zn(e,t,{})}function Bo(e,t){return k([e])?p.Update(av(e),{},t):ta(e,t)}function gd(e,t,n,r){let a=d(e,t,n);return Bo(a,r)}function na(e,t,n={}){return I("Omit",[e,t],n)}function yd(e,t,n={}){let r=s.IsArray(t)?un(t):t;return Vo(e,r,n)}function wa(e){let t=cn(e);return L(t)?t.properties:Y()}function ov(e,t){return s.Keys(e).reduce((r,a)=>t.includes(a)?r:{...r,[a]:e[a]},{})}function xd(e,t){let n=wa(e),r=dn(t),a=ov(n,r);return v(a)}function Vo(e,t,n){return k([e,t])?p.Update(xd(e,t),{},n):na(e,t,n)}function Id(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return Vo(i,m,a)}function ra(e,t={}){return I("Parameters",[e],t)}function bd(e,t={}){return Wo(e,t)}function iv(e){let t=oe(e)?e.parameters:[],n=wt({},U([],[]),t);return Q(n)}function Wo(e,t){return k([e])?p.Update(iv(e),{},t):ra(e,t)}function vd(e,t,n,r){let a=d(e,t,n);return Wo(a,r)}function aa(e,t={}){return I("Partial",[e],t)}function $d(e,t={}){return Ho(e,t)}function Td(e,t){let n=Je(e,t),r=Xe(n);return Be(p.Assign(e,{[t]:r}),t)}function kd(e,t,n){let r=Ne(e,t,n);return Xe(r)}function wd(e){let t=z(e);return Xe(t)}function Ed(e){let t=e.map(n=>Xe(n));return w(t)}function Rd(e){let t=s.Keys(e).reduce((r,a)=>({...r,[a]:At(e[a])}),{});return v(t)}function Xe(e){return pe(e)?Td(e.$defs,e.$ref):V(e)?kd(e.if,e.then,e.else):S(e)?wd(e.allOf):x(e)?Ed(e.anyOf):L(e)?Rd(e.properties):v({})}function Ho(e,t){return k([e])?p.Update(Xe(e),{},t):aa(e,t)}function Sd(e,t,n,r){let a=d(e,t,n);return Ho(a,r)}function oa(e,t,n={}){return I("Pick",[e,t],n)}function Od(e,t,n={}){let r=s.IsArray(t)?un(t):t;return Yo(e,r,n)}function sv(e,t){return s.Keys(e).reduce((r,a)=>t.includes(a)?p.Assign(r,{[a]:e[a]}):r,{})}function Pd(e,t){let n=wa(e),r=dn(t),a=sv(n,r);return v(a)}function Yo(e,t,n){return k([e,t])?p.Update(Pd(e,t),{},n):oa(e,t,n)}function Ad(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return Yo(i,m,a)}function ia(e,t={}){return I("ReadonlyObject",[e],t)}function Jo(e,t={}){return Xo(e,t)}var Cd=Jo;function Md(e){return Wt(Ee(e))}function Ld(e,t){let n=Je(e,t),r=Ze(n);return Be(p.Assign(e,{[t]:r}),t)}function qd(e,t,n){let r=Ne(e,t,n);return Ze(r)}function jd(e){let t=z(e);return Ze(t)}function Fd(e){let t=s.Keys(e).reduce((r,a)=>({...r,[a]:Lt(e[a])}),{});return v(t)}function Dd(e){return Wt(Q(e))}function Gd(e){let t=e.map(n=>Ze(n));return w(t)}function Ze(e){return K(e)?Md(e.items):pe(e)?Ld(e.$defs,e.$ref):V(e)?qd(e.if,e.then,e.else):S(e)?jd(e.allOf):L(e)?Fd(e.properties):G(e)?Dd(e.items):x(e)?Gd(e.anyOf):e}function Xo(e,t){return k([e])?p.Update(Ze(e),{},t):ia(e)}function Nd(e,t,n,r){let a=d(e,t,n);return Xo(a,r)}function Ud(e,t,n,r){return t.visited.includes(r)?n:r in e?d(e,U(t.callstack,[...t.visited,r]),e[r]):n}function _d(e,t){let n=Je(e,t),r=Qe(n);return Be(p.Assign(e,{[t]:r}),t)}function Kd(e,t,n){let r=Ne(e,t,n);return Qe(r)}function zd(e){let t=z(e);return Qe(t)}function Bd(e){let t=e.map(n=>Qe(n));return w(t)}function Vd(e){let t=s.Keys(e).reduce((r,a)=>({...r,[a]:Fr(e[a])}),{});return v(t)}function Qe(e){return pe(e)?_d(e.$defs,e.$ref):V(e)?Kd(e.if,e.then,e.else):S(e)?zd(e.allOf):x(e)?Bd(e.anyOf):L(e)?Vd(e.properties):v({})}function sa(e,t={}){return I("Required",[e],t)}function Wd(e,t={}){return Zo(e,t)}function Zo(e,t){return k([e])?p.Update(Qe(e),{},t):sa(e,t)}function Hd(e,t,n,r){let a=d(e,t,n);return Zo(a,r)}function ma(e,t={}){return I("ReturnType",[e],t)}function Yd(e,t={}){return Qo(e,t)}function mv(e){return oe(e)?e.returnType:F()}function Qo(e,t){return k([e])?p.Update(mv(e),{},t):ma(e,t)}function Jd(e,t,n,r={}){let a=d(e,t,n);return Qo(a,r)}function pa(e,t){return I("With",[e,t],{})}function Xd(e,t){return ei(e,t)}function ei(e,t){return k([e])?p.Update(e,{},t):pa(e,t)}function Zd(e,t,n,r){let a=d(e,t,n);return ei(a,r)}function pv(e){return vt(e)?G(e.items)?ti(e.items.items):H(e.items)?[e]:ie(e.items)?[e]:[F()]:[e]}function ti(e){return e.reduce((n,r)=>[...n,...pv(r)],[])}function U(e,t){return{callstack:e,visited:t}}function k(e){return s.ShiftLeft(e,(t,n)=>ie(t)?!1:k(n),()=>!0)}function Wn(e,t,n){return s.Keys(n).reduce((r,a)=>({...r,[a]:d(e,t,n[a])}),{})}function wt(e,t,n){let r=Se(e,t,n);return ti(r)}function Se(e,t,n){return n.map(r=>d(e,t,r))}function uv(e,t){let n=de(e)?wn(t,{}):t,r=qt(e)?kn(n,{}):n;return Mt(e)?tr(r,{}):r}function cv(e,t,n,r,a){return s.IsEqual(n,"AddImmutable")?Qd(e,t,r[0],a):s.IsEqual(n,"RemoveImmutable")?pl(e,t,r[0],a):s.IsEqual(n,"AddReadonly")?Yi(e,t,r[0],a):s.IsEqual(n,"RemoveReadonly")?qs(e,t,r[0],a):s.IsEqual(n,"AddOptional")?Ji(e,t,r[0],a):s.IsEqual(n,"RemoveOptional")?Ds(e,t,r[0],a):s.IsEqual(n,"Capitalize")?xl(e,t,r[0],a):s.IsEqual(n,"Conditional")?Tl(e,t,r[0],r[1],r[2],r[3],a):s.IsEqual(n,"ConstructorParameters")?wl(e,t,r[0],a):s.IsEqual(n,"Evaluate")?Zc(e,t,r[0],a):s.IsEqual(n,"Exclude")?Rl(e,t,r[0],r[1],a):s.IsEqual(n,"Extract")?Pl(e,t,r[0],r[1],a):s.IsEqual(n,"Index")?ed(e,t,r[0],r[1],a):s.IsEqual(n,"InstanceType")?nd(e,t,r[0],a):s.IsEqual(n,"Interface")?Uc(e,t,r[0],r[1],a):s.IsEqual(n,"KeyOf")?ud(e,t,r[0],a):s.IsEqual(n,"Lowercase")?Il(e,t,r[0],a):s.IsEqual(n,"Mapped")?fd(e,t,r[0],r[1],r[2],r[3],a):s.IsEqual(n,"Module")?ka(e,t,r[0],a):s.IsEqual(n,"NonNullable")?gd(e,t,r[0],a):s.IsEqual(n,"Pick")?Ad(e,t,r[0],r[1],a):s.IsEqual(n,"Parameters")?vd(e,t,r[0],a):s.IsEqual(n,"Partial")?Sd(e,t,r[0],a):s.IsEqual(n,"Omit")?Id(e,t,r[0],r[1],a):s.IsEqual(n,"ReadonlyObject")?Nd(e,t,r[0],a):s.IsEqual(n,"Record")?tm(e,t,r[0],r[1],a):s.IsEqual(n,"Required")?Hd(e,t,r[0],a):s.IsEqual(n,"ReturnType")?Jd(e,t,r[0],a):s.IsEqual(n,"TemplateLiteral")?oc(e,t,r[0],a):s.IsEqual(n,"Uncapitalize")?bl(e,t,r[0],a):s.IsEqual(n,"Uppercase")?vl(e,t,r[0],a):s.IsEqual(n,"With")?Zd(e,t,r[0],r[1]):I(n,r,a)}function lv(e,t,n){let r=ie(n)?Ud(e,t,n,n.$ref):K(n)?Ee(d(e,t,n.items),kr(n)):pn(n)?$a(e,t,n.target,n.arguments):ae(n)?_e(Se(e,t,n.parameters),d(e,t,n.instanceType),Xi(n)):oe(n)?Ke(Se(e,t,n.parameters),d(e,t,n.returnType),Zi(n)):V(n)?Ct(d(e,t,n.if),d(e,t,n.then),d(e,t,n.else),as(n)):S(n)?fe(Se(e,t,n.allOf),ps(n)):L(n)?v(Wn(e,t,n.properties),ns(n)):ce(n)?nm(Le(n),d(e,t,xe(n))):vt(n)?Dt(d(e,t,n.items)):G(n)?Q(wt(e,t,n.items),Ls(n)):x(n)?w(Se(e,t,n.anyOf),Ts(n)):n;return uv(n,r)}function d(e,t,n){return ht(n)?cv(e,t,n.action,n.parameters,n.options):lv(e,t,n)}function ni(e,t){return d(e,U([],[]),t)}function dv(e){return p.Update(e,{"~immutable":!0},{})}function tr(e,t){return p.Update(dv(e),{},t)}function Qd(e,t,n,r){let a=d(e,t,n);return tr(a,r)}function ru(e,t={}){return I("AddImmutable",[e],t)}function Wt(e,t={}){return tr(e,t)}function au(e,t={}){return I("Evaluate",[e],t)}function ef(e,t={}){return Ao(e,t)}function ou(e,t={}){return I("Module",[e],t)}function tf(e,t={}){return ka({},U([],[]),e,t)}function nf(...e){let[t,n,r]=Ve.Match(e,{2:(m,u)=>s.IsString(m)?[{},m,u]:[m,u,{}],3:(m,u,l)=>[m,u,l],1:m=>[{},m,{}]}),a=ec(n),i=s.IsArray(a)&&s.IsEqual(a.length,2)?d(t,U([],[]),a[0]):F();return p.Update(i,{},r)}var D={};Rt(D,{Any:()=>Vt,Array:()=>Ee,BigInt:()=>On,Boolean:()=>Pr,Call:()=>sl,Capitalize:()=>fl,Codec:()=>Or,Conditional:()=>$l,Constructor:()=>_e,ConstructorParameters:()=>kl,Cyclic:()=>Be,Decode:()=>ds,DecodeBuilder:()=>Sn,Dependent:()=>Ct,Encode:()=>fs,EncodeBuilder:()=>Rn,Enum:()=>ms,Evaluate:()=>ef,Exclude:()=>El,Extends:()=>ue,ExtendsResult:()=>b,Extract:()=>Sl,Function:()=>Ke,Generic:()=>gt,Identifier:()=>Pn,Immutable:()=>hs,Index:()=>Al,Infer:()=>En,InstanceType:()=>td,Instantiate:()=>ni,Integer:()=>jt,Interface:()=>_c,Intersect:()=>fe,IsAny:()=>J,IsArray:()=>K,IsBigInt:()=>He,IsBoolean:()=>Ae,IsCall:()=>pn,IsCodec:()=>Sr,IsConstructor:()=>ae,IsCyclic:()=>pe,IsDependent:()=>V,IsEnum:()=>he,IsEnumValue:()=>ss,IsFunction:()=>oe,IsGeneric:()=>Bt,IsIdentifier:()=>Is,IsImmutable:()=>Mt,IsInfer:()=>H,IsInteger:()=>ge,IsIntersect:()=>S,IsKind:()=>y,IsLiteral:()=>q,IsNever:()=>yt,IsNull:()=>Yt,IsNumber:()=>X,IsObject:()=>L,IsOptional:()=>de,IsParameter:()=>$s,IsReadonly:()=>qt,IsRecord:()=>ce,IsRef:()=>ie,IsRefine:()=>to,IsRest:()=>vt,IsSchema:()=>ee,IsString:()=>ye,IsSymbol:()=>xt,IsTemplateLiteral:()=>Z,IsThis:()=>Kr,IsTuple:()=>G,IsUndefined:()=>tn,IsUnion:()=>x,IsUnknown:()=>te,IsUnsafe:()=>Rr,IsVoid:()=>Ye,KeyOf:()=>rd,Literal:()=>O,Lowercase:()=>hl,Mapped:()=>cd,Module:()=>tf,Never:()=>F,NonNullable:()=>hd,Null:()=>Ht,Number:()=>$e,Object:()=>v,Omit:()=>yd,Optional:()=>es,Parameter:()=>Ft,Parameters:()=>bd,Partial:()=>$d,Pick:()=>Od,Readonly:()=>gs,ReadonlyObject:()=>Jo,ReadonlyType:()=>Cd,Record:()=>Nr,RecordKey:()=>Qt,RecordPattern:()=>Le,RecordValue:()=>xe,Ref:()=>st,Refine:()=>ys,Required:()=>Wd,Rest:()=>Dt,ReturnType:()=>Yd,Script:()=>nf,String:()=>Ce,Symbol:()=>Jt,TemplateLiteral:()=>sc,This:()=>_r,Tuple:()=>Q,Uncapitalize:()=>gl,Undefined:()=>en,Union:()=>w,Unknown:()=>se,Unsafe:()=>rs,Uppercase:()=>yl,Void:()=>zr,With:()=>Xd});var nr="submit_test_gap_candidates",rr="submit_filtered_test_gaps",ar="submit_solver_gaps",B6=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 fv=D.Object({statement:D.String({description:"One sentence from agent_prompt.md, copied verbatim."}),gaps:D.Array(D.Object({description:D.String({description:"A fair, publicly observable missing behavioral test."}),risk:D.String({description:"Why an incorrect implementation could pass the current tests despite this missing behavior."})}),{description:"All candidate positive and negative gaps for this sentence; there is no maximum or target count, so include every distinct evidence-backed gap and relevant edge case rather than stopping at 10; use an empty array only when exhaustive analysis finds none."})});function rf(e){return{name:nr,label:"Submit Candidate Test Gaps",description:"Submit one candidate-gap list for one prompt sentence. Call this after each sentence so the orchestrator can track the todo list; empty lists are required when that sentence has no gaps.",parameters:fv,async execute(t,n){let r=e.statements??[];return r.push({statement:n.statement,gaps:n.gaps??[]}),e.statements=r,{content:[{type:"text",text:`Recorded ${n.gaps?.length??0} candidate gap(s)`}],details:void 0}}}}var hv=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 af(e){return{name:rr,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:hv,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Confirmed ${r.length} gap(s) after filtering`}],details:void 0}}}}var gv=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 of(e){return{name:ar,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:gv,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Recorded ${r.length} solver gap(s)`}],details:void 0}}}}function yv(e){return[e,"You are working inside the actual repository (this is your current directory) in read-only mode. 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).","Do not rely only on the patch files: read the actual repository files in the working tree to see the file changes in place and to understand which files and behaviors the patches touch. Use `git`-equivalent reasoning by comparing the patched files against their surrounding code."]}var xv=["Thoroughness \u2014 your job is high recall on genuine gaps only:","- There is no target count or cap: do not stop at 10 (or any other arbitrary number). For each prompt sentence, enumerate as many distinct uncovered required behaviors and edge cases as the files justify, then continue until an additional sweep finds no new genuine gap.","- 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."],sf=["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 mf(e,t){let n=[...yv("You are an exhaustive behavioral test-gap finder. Review the task prompt sentence by sentence, finding both missing required-behavior (positive) and missing forbidden/wrong-behavior (negative) tests."),"","First split `agent_prompt.md` into its meaningful sentences using periods (`.`) as the sentence boundary. Create an explicit TODO checklist of every resulting requirement sentence. Work through it one item at a time; do not finish until every item is checked off.","","Before analyzing each sentence, use read/grep/find/ls to inspect the relevant pre-existing source files, their closest analogues, and relevant existing tests. Use that repository context to understand the actual problem, public contracts, conventions, and what the current tests already cover. Then act as an investigator: first trace every behavior the reference `solution.patch` implements for that sentence \u2014 branches, guards, early returns, state transitions, side effects, boundary handling, and negative/prohibited outcomes. Then compare those behaviors against `test.patch` and relevant repository context. Report every distinct, prompt-required behavioral edge case or prohibition that the solution handles but the tests do not catch. A candidate must describe a plausible incorrect implementation that still passes the current suite. Include positive and negative gaps together for that sentence. There is no maximum number of gaps: keep enumerating distinct missing behaviors for this sentence, including boundary, empty, repeated, interacting, and other relevant edge cases; do not treat 10 as sufficient.","",...xv,"",...sf,"","Test-coverage checklist for calibration:",e];return t&&n.push("","Fairness methodology:",t),n.push("","For every candidate, state the missing fair behavioral test, the relevant solution behavior or branch that led you to investigate it, and why the current suite permits the incorrect behavior. The prompt sentence is the required specification: do not report incidental reference-solution details it does not require. Do not propose the exact test implementation.",`After completing EACH TODO sentence, call \`${nr}\` with that exact sentence and its gap array (including an empty array when none exist). You may and must call the tool multiple times: once per sentence. Only finish after every TODO item has been submitted.`),n.join(`
|
|
12
|
-
`)}function
|
|
13
|
-
`)}function
|
|
14
|
-
`)}function
|
|
15
|
-
`)}var
|
|
11
|
+
`,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),ec=(e,t=[])=>o(o(To(e),([n,r])=>o(eI(r),([a,i])=>[[n,a],i])),([n,r])=>ec(r,[...t,n]),()=>[t,e]),tI=e=>o(o(ec(e),([t,n])=>o(o(o(To(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[tu(t),n]),To=e=>o(o(Qx(e),([t,n])=>o(o(Yx(n),([r,a])=>[r,a],()=>o(Jx(n),([r,a])=>[r,a],()=>o(Zx(n),([r,a])=>[r,a],()=>o(Xx(n),([r,a])=>[r,a],()=>[])))),([r,a])=>o(Ru(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[nu(t),n]),nI=e=>o(o(To(e),([t,n])=>o(tI(n),([r,a])=>[[t,r],a])),([t,n])=>[ru(t),n]),tc=e=>o(o(nI(e),([t,n])=>[t,n],()=>o(ax(e),([t,n])=>[t,n],()=>o(S(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function nc(e){let t=Io(`\`${e}\``);return s.IsEqual(t.length,2)?t[0]:J()}function aI(e){return e.join("|")}function oI(e){return e.slice(1,e.length-1)}function iI(e,t,n){return kt(t,`${n}${e}`)}function sI(e,t){return kt(e,`${t}${Is}`)}function mI(e,t){return kt(e,`${t}${Pr}`)}function pI(e,t){return kt(e,`${t}${Cr}`)}function uI(e,t){return Kn(w([P("false"),P("true")]),e,t)}function cI(e,t){return kt(e,`${t}${Mr}`)}function lI(e,t,n){return kt(t,`${n}${oI(e)}`)}function dI(e,t,n){let r=zn(e,{});return Kn(r,t,n)}function fI(e,t,n){let r=Se(e);return Kn(r,t,n)}function rc(e,t,n,r=[]){return s.ShiftLeft(e,(a,i)=>rc(i,t,n,[...r,Kn(a,[],"")]),()=>kt(t,`${n}(${aI(r)})`))}function Kn(e,t,n){return ye(e)?fI(e.enum,t,n):xe(e)?mI(t,n):q(e)?iI(e.const,t,n):He(e)?sI(t,n):Ae(e)?uI(t,n):X(e)?pI(t,n):Ie(e)?cI(t,n):Q(e)?lI(e.pattern,t,n):oc(e)?dI(e.parameters[0],t,n):x(e)?rc(e.anyOf,t,n):es}function kt(e,t){return s.ShiftLeft(e,(n,r)=>Kn(n,r,t),()=>t)}function hI(e){return`^${kt(e,"")}$`}function ac(e){let t=hI(e);return qr(t)}function zn(e,t){return k(e)?p.Update(ac(e),{},t):zr(e,t)}function ic(e,t,n,r){let a=Oe(e,t,n);return zn(a,r)}function zr(e,t={}){return I("TemplateLiteral",[e],t)}function oc(e){return re(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function sc(e){return zn(e,{})}function gI(e){let t=nc(e);return sc(t)}function mc(e,t={}){let n=s.IsString(e)?gI(e):sc(e);return p.Update(n,{},t)}function Q(e){return y(e,"TemplateLiteral")}var b={};Rt(b,{ExtendsFalse:()=>T,ExtendsTrue:()=>g,ExtendsUnion:()=>ko,IsExtendsFalse:()=>yI,IsExtendsTrue:()=>uc,IsExtendsTrueLike:()=>on,IsExtendsUnion:()=>pc,Match:()=>_});function ko(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function pc(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsUnion")&&s.IsObject(e.inferred)}function g(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function uc(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsTrue")&&s.IsObject(e.inferred)}function T(){return p.Create({"~kind":"ExtendsFalse"},{})}function yI(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function on(e){return pc(e)||uc(e)}function _(e,t,n){return on(e)?t(e.inferred):n()}function xI(e,t,n,r){return _(C(e,n,r),a=>g(p.Assign(p.Assign(e,a),{[t]:n})),()=>T())}function II(e,t){return g(e)}function bI(e,t,n,r,a){return _(C(e,t,n),i=>_(C(i,t,r),m=>g(m),()=>T()),()=>_(C(e,t,a),i=>g(i),()=>T()))}function vI(e,t,n){let r=Se(n);return C(e,t,r)}function cc(e,t,n){return s.ShiftLeft(n,(r,a)=>_(C(e,t,r),i=>cc(i,t,a),()=>T()),()=>g(e))}function $I(e,t,n){let r=$e(n);return C(e,t,r)}function lc(e,t,n){return s.ShiftLeft(n,(r,a)=>_(C(e,t,r),i=>g(i),()=>lc(e,t,a)),()=>T())}function j(e,t,n){return Z(n)?II(e,t):V(n)?bI(e,t,n.if,n.then,n.else):ye(n)?vI(e,t,n.enum):Y(n)?xI(e,n.name,t,n.extends):O(n)?cc(e,t,n.allOf):Q(n)?$I(e,t,n.pattern):x(n)?lc(e,t,n.anyOf):ae(n)?g(e):T()}function dc(e,t,n){return Y(n)?j(e,t,n):Z(n)?g(e):ae(n)?g(e):ko(e)}function TI(e,t){let n=Mt(e),r=Mt(t);return n&&r||!n&&r?!0:!(n&&!r)}function fc(e,t,n,r){return K(r)?TI(t,r)?C(e,n,r.items):T():j(e,t,r)}function hc(e,t,n){return He(n)?g(e):j(e,t,n)}function gc(e,t,n){return Ae(n)?g(e):j(e,t,n)}function kI(e,t,n,r,a){let i=Y(r)?t:r,m=Y(r)?r:t,u=he(t),l=he(r);return!u&&l?T():_(C(e,i,m),f=>Bn(f,n,a),()=>T())}function wI(e,t,n,r){return s.ShiftLeft(r,(a,i)=>kI(e,t,n,a,i),()=>he(t)?g(e):T())}function EI(e,t,n){return s.ShiftLeft(t,(r,a)=>wI(e,r,a,n),()=>g(e))}function Bn(e,t,n){return EI(e,t,n)}function ya(e,t,n){return Ye(n)?g(e):C(e,t,n)}function yc(e,t,n,r){return Z(r)?g(e):ae(r)?g(e):oe(r)?_(Bn(e,t,r.parameters),a=>ya(a,n,r.instanceType),()=>T()):T()}function xc(e,t,n,r,a){return _(C(e,t,a),()=>C(e,n,a),()=>C(e,r,a))}function Ic(e,t,n){let r=Se(t);return C(e,r,n)}function bc(e,t,n,r){return Z(r)?g(e):ae(r)?g(e):ie(r)?_(Bn(e,t,r.parameters),a=>ya(a,n,r.returnType),()=>T()):T()}function vc(e,t,n){return xe(n)?g(e):X(n)?g(e):j(e,t,n)}function $c(e,t,n){let r=z(t);return C(e,r,n)}function xa(e,t,n){return t===n?g(e):T()}function RI(e,t,n){return q(n)?xa(e,t,n.const):He(n)?g(e):j(e,P(t),n)}function SI(e,t,n){return q(n)?xa(e,t,n.const):Ae(n)?g(e):j(e,P(t),n)}function OI(e,t,n){return q(n)?xa(e,t,n.const):X(n)?g(e):j(e,P(t),n)}function PI(e,t,n){return q(n)?xa(e,t,n.const):Ie(n)?g(e):j(e,P(t),n)}function Tc(e,t,n){return s.IsBigInt(t.const)?RI(e,t.const,n):s.IsBoolean(t.const)?SI(e,t.const,n):s.IsNumber(t.const)?OI(e,t.const,n):s.IsString(t.const)?PI(e,t.const,n):J()}function kc(e,t,n){return Y(n)?j(e,t,n):g(e)}function wc(e,t,n){return Yt(n)?g(e):j(e,t,n)}function Ec(e,t,n){return X(n)?g(e):j(e,t,n)}function AI(e,t,n){return he(t)?he(n)?g(e):T():g(e)}function CI(e,t,n){return Y(n)&&yt(n.extends)?T():_(C(e,t,n),r=>AI(r,t,n),()=>T())}function MI(e,t){return e.reduce((n,r)=>r in t?on(t[r])?{...n,...t[r].inferred}:J():J(),{})}function LI(e,t,n){let r={};for(let m of s.Keys(n))r[m]=m in t?CI({},t[m],n[m]):he(n[m])?Y(n[m])?g(p.Assign(e,{[n[m].name]:n[m].extends})):g(e):T();let a=s.Values(r).every(m=>on(m)),i=a?MI(s.Keys(r),r):{};return a?g(i):T()}function qI(e,t,n){let r=LI(e,t,n);return on(r)?g(p.Assign(e,r.inferred)):T()}function jI(e,t,n){return qI(e,t,n)}function FI(e,t){return s.Keys(t).reduce((n,r)=>({...n,[r]:s.HasPropertyKey(e,r)?x(n[r])?w([...n[r].anyOf,t[r]]):w([e[r],t[r]]):t[r]}),e)}function Rc(e,t,n,r){return s.ShiftLeft(t,(a,i)=>_(C({},e[a],n),m=>Rc(e,i,n,FI(r,m)),()=>T()),()=>g(r))}function DI(e,t,n,r){let a=s.Keys(t);return Rc(t,a,r,e)}function Sc(e,t,n){return de(n)?DI(e,t,Le(n),be(n)):L(n)?jI(e,t,n.properties):j(e,v(t),n)}function GI(e,t){return s.IsEqual(s.Keys(t).length,0)?g(e):T()}function NI(e,t,n,r,a){return C(e,n,a)}function Oc(e,t,n,r){return de(r)?NI(e,Nr(t),n,Nr(Le(r)),be(r)):L(r)?GI(e,r.properties):Z(r)?g(e):ae(r)?g(e):T()}function Pc(e,t,n){return Ie(n)?g(e):j(e,t,n)}function Ac(e,t,n){return xt(n)?g(e):j(e,t,n)}function Cc(e,t,n){let r=$e(t);return C(e,r,n)}function wo(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Vn(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 Eo(e){return vt(e)?Y(e.items)?K(e.items.extends)?wo(e.items.name,e.items.extends.items):ae(e.items.extends)?wo(e.items.name,e.items.extends):void 0:J():void 0}function Ia(e){return Y(e)?wo(e.name,e.extends):void 0}function Ro(e,t,n=[]){return s.ShiftLeft(e,(r,a)=>_(C({},r,t),()=>Ro(a,t,[...n,r]),()=>{}),()=>n)}function Mc(e,t,n,r){let a=Ro(n,r);return s.IsArray(a)?g(p.Assign(e,{[t]:ee(a)})):T()}function ba(e,t,n,r){let a=Ro(n,r);return s.IsArray(a)?g(p.Assign(e,{[t]:w(a)})):T()}function UI(e){return[...e].reverse()}function So(e,t){return t?UI(e):e}function _I(e){let t=e.length>0?e[0]:void 0,n=re(t)?Eo(t):void 0;return re(n)}function KI(e,t,n,r,a,i){return _(C(e,n,a),m=>Lc(m,t,r,i),()=>T())}function zI(e,t,n,r,a){let i=Eo(r);return Vn(i)?Mc(e,i.name,So(n,t),i.type):s.ShiftLeft(n,(m,u)=>KI(e,t,m,u,r,a),()=>T())}function BI(e,t,n,r){return s.ShiftLeft(r,(a,i)=>zI(e,t,n,a,i),()=>s.IsEqual(n.length,0)?g(e):T())}function Lc(e,t,n,r){return BI(e,t,n,r)}function VI(e,t,n){let r=wt(e,U([],[]),n),a=_I(r);return Lc(e,a,So(t,a),So(r,a))}function qc(e,t,n){let r=Ia(n);return Vn(r)?ba(e,r.name,t,r.type):s.ShiftLeft(t,(a,i)=>_(C(e,a,n),m=>qc(m,i,n),()=>T()),()=>g(e))}function jc(e,t,n){let r=wt(e,U([],[]),t);return G(n)?VI(e,r,n.items):K(n)?qc(e,r,n.items):j(e,ee(r),n)}function Fc(e,t,n){return Ye(n)?g(e):tn(n)?g(e):j(e,t,n)}function Dc(e,t,n){return s.ShiftLeft(n,(r,a)=>_(C(e,t,r),i=>g(i),()=>Dc(e,t,a)),()=>T())}function Oo(e,t,n){return s.ShiftLeft(t,(r,a)=>_(Dc(e,r,n),i=>Oo(i,a,n),()=>T()),()=>g(e))}function Gc(e,t,n){let r=Ia(n);return Vn(r)?ba(e,r.name,t,r.type):x(n)?Oo(e,t,n.anyOf):Oo(e,t,[n])}function Nc(e,t,n){return Y(n)?j(e,t,n):Z(n)?g(e):ae(n)?g(e):T()}function Uc(e,t,n){return Ye(n)?g(e):j(e,t,n)}function C(e,t,n){return Z(t)?dc(e,t,n):K(t)?fc(e,t,t.items,n):He(t)?hc(e,t,n):Ae(t)?gc(e,t,n):oe(t)?yc(e,t.parameters,t.instanceType,n):V(t)?xc(e,t.if,t.then,t.else,n):ye(t)?Ic(e,t.enum,n):ie(t)?bc(e,t.parameters,t.returnType,n):xe(t)?vc(e,t,n):O(t)?$c(e,t.allOf,n):q(t)?Tc(e,t,n):yt(t)?kc(e,t,n):Yt(t)?wc(e,t,n):X(t)?Ec(e,t,n):L(t)?Sc(e,t.properties,n):de(t)?Oc(e,Le(t),be(t),n):Ie(t)?Pc(e,t,n):xt(t)?Ac(e,t,n):Q(t)?Cc(e,t.pattern,n):G(t)?jc(e,t.items,n):tn(t)?Fc(e,t,n):x(t)?Gc(e,t.anyOf,n):ae(t)?Nc(e,t,n):Ye(t)?Uc(e,t,n):T()}function WI(e,t){return z([...e,v(t)])}function Po(e,t,n){return k(e)?p.Update(WI(e,t),{},n):Dn(e,t,n)}function _c(e,t,n,r,a){let i=Oe(e,t,n),m=Wn(e,t,r);return Po(i,m,a)}function Dn(e,t,n={}){return I("Interface",[e,t],n)}function sn(e){return re(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function Kc(e,t,n={}){return Po(e,t,n)}function HI(e,t,n){return e.includes(n)?!0:Hn([...e,n],t,t[n])}function zc(e,t,n){let r=wr(n);return Nt(e,t,r)}function Nt(e,t,n){return s.ShiftLeft(n,(r,a)=>Hn(e,t,r)?!0:Nt(e,t,a),()=>!1)}function Hn(e,t,n){return se(n)?HI(e,t,n.$ref):K(n)?Hn(e,t,n.items):oe(n)?Nt(e,t,[...n.parameters,n.instanceType]):ie(n)?Nt(e,t,[...n.parameters,n.returnType]):sn(n)?zc(e,t,n.parameters[1]):O(n)?Nt(e,t,n.allOf):L(n)?zc(e,t,n.properties):x(n)?Nt(e,t,n.anyOf):G(n)?Nt(e,t,n.items):de(n)?Hn(e,t,be(n)):!1}function Bc(e,t,n){return Hn(e,t,n)}function YI(e,t){return t.reduce((n,r)=>Bc([r],e,e[r])?[...n,r]:n,[])}function Vc(e){let t=kr(e);return YI(e,t)}function JI(e,t,n){return n.includes(t)?n:t in e?Yn(e,e[t],[...n,t]):J()}function Wc(e,t,n){let r=wr(t);return mn(e,r,n)}function mn(e,t,n){return t.reduce((r,a)=>Yn(e,a,r),n)}function Yn(e,t,n){return se(t)?JI(e,t.$ref,n):K(t)?Yn(e,t.items,n):oe(t)?mn(e,[...t.parameters,t.instanceType],n):ie(t)?mn(e,[...t.parameters,t.returnType],n):sn(t)?Wc(e,t.parameters[1],n):O(t)?mn(e,t.allOf,n):L(t)?Wc(e,t.properties,n):x(t)?mn(e,t.anyOf,n):G(t)?mn(e,t.items,n):de(t)?Yn(e,be(t),n):n}function Hc(e,t,n){return Yn(e,n,[t])}function ZI(e){return Vt()}function XI(e){return s.Keys(e).reduce((t,n)=>({...t,[n]:Ut(e[n])}),{})}function Jn(e){return e.reduce((t,n)=>[...t,Ut(n)],[])}function Ut(e){return se(e)?ZI(e.$ref):K(e)?Re(Ut(e.items),Tr(e)):oe(e)?_e(Jn(e.parameters),Ut(e.instanceType)):ie(e)?Ke(Jn(e.parameters),Ut(e.returnType)):O(e)?ge(Jn(e.allOf)):L(e)?v(XI(e.properties)):de(e)?Gr(Qt(e),Ut(be(e))):x(e)?w(Jn(e.anyOf)):G(e)?ee(Jn(e.items)):e}function QI(e,t){return t in e?Ut(e[t]):me()}function Yc(e){return QI(e.$defs,e.$ref)}function eb(e,t,n){let r=Oe(e,U([],[]),t),a=Wn({},U([],[]),n);return z([...r,v(a)])}function tb(e,t){return s.Keys(e).filter(r=>t.includes(r)).reduce((r,a)=>{let i=e[a],m=sn(i)?eb(e,i.parameters[0],i.parameters[1]):i;return{...r,[a]:m}},{})}function Jc(e,t,n){let r=Hc(e,t,n),a=tb(e,r);return Be(a,t)}function Zc(e,t){return t in e?se(e[t])?Zc(e,e[t].$ref):e[t]:F()}function Je(e,t){return Zc(e,t)}function Xc(e){return ce(e)?Yc(e):Er(e)?me():e}function le(e,t,n){let r=Xc(t),a=Xc(n);return C(e,r,a)}var Cn="equal",nb="disjoint",Mn="left-inside",Ln="right-inside";function Zt(e,t){let n=[ae(e)?b.ExtendsFalse():le({},e,t),ae(e)?b.ExtendsTrue({}):le({},t,e)];return b.IsExtendsTrueLike(n[0])&&b.IsExtendsTrueLike(n[1])?Cn:b.IsExtendsTrueLike(n[0])&&b.IsExtendsFalse(n[1])?Mn:b.IsExtendsFalse(n[0])&&b.IsExtendsTrueLike(n[1])?Ln:nb}function rb(e,t){return t.filter(n=>Zt(e,n)!==Ln)}function ab(e,t){let n=t.some(r=>{let a=Zt(e,r);return s.IsEqual(a,Mn)||s.IsEqual(a,Cn)});return s.IsEqual(n,!1)}function ob(e,t){let n=Me(e);return Z(n)?[n]:ab(n,t)?[...rb(n,t),n]:t}function ib(e){return e.reduce((t,n)=>L(n)?[...t,n]:yt(n)?t:ob(n,t),[])}function so(e){let t=ib(e);return jn(t)}function Ao(e,t){return p.Update(Me(e),{},t)}function Qc(e,t,n,r){let a=d(e,t,n);return Ao(a,r)}function Zn(e,t=[]){return ht(e)&&s.IsEqual(e.action,"Conditional")?se(e.parameters[0])?Zn(e.parameters[2],Zn(e.parameters[3],[...t,e.parameters[0].$ref])):Zn(e.parameters[2],Zn(e.parameters[3],t)):ht(e)&&s.IsEqual(e.action,"Mapped")&&ht(e.parameters[1])&&s.IsEqual(e.parameters[1].action,"KeyOf")&&se(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function sb(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function nl(e,t,n=[]){return s.ShiftLeft(e,(r,a)=>s.ShiftLeft(t,(i,m)=>nl(a,m,[...n,[i,r]]),()=>n),()=>n)}function mb(e){return x(e)?[...e.anyOf]:[e]}function pb(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function el(e,t){return t.reduce((n,r)=>[...n,...pb(e,r)],[])}function tl(e){return e.reduce((t,n)=>s.IsEqual(n[0],!0)?el(t,mb(n[1])):el(t,[n[1]]),[[]])}function rl(e,t,n){let r=Zn(n),a=sb(e,r),i=nl(t,a);return ht(n)&&s.IsEqual(n.action,"Conditional")||ht(n)&&s.IsEqual(n.action,"Mapped")?tl(i):[t]}function ub(){return["(not-resolvable)",F()]}function cb(){return["(not-generic)",F()]}function lb(e,t,n){return[e,gt(t,n)]}function db(e,t,n){return t in e?al(e,t,e[t],n):ub()}function al(e,t,n,r){return Bt(n)?lb(t,n.parameters,n.expression):se(n)?db(e,n.$ref,r):cb()}function ol(e,t,n){return al(e,"(anonymous)",t,n)}function fb(e,t,n){if(Y(t)||pn(t)||b.IsExtendsTrueLike(le({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function il(e,t,n,r,a){let i=d(e,t,a);return fb(n,i,r),p.Assign(e,{[n]:i})}function hb(e,t,n,r,a){let i=d(e,t,n.extends),m=d(e,t,n.equals);return s.ShiftLeft(a,(u,l)=>Co(il(e,t,n.name,i,u),t,r,l),()=>Co(il(e,t,n.name,i,m),t,r,[]))}function Co(e,t,n,r){return s.ShiftLeft(n,(a,i)=>hb(e,t,a,i,r),()=>e)}function sl(e,t,n,r){return Co(e,t,n,r)}function gb(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function yb(e,t){return s.IsEqual(gb(e),t)}function xb(e,t,n,r,a,i){let m=sl(e,t,r,i),u=d(m,U([...t.callstack,n.$ref],t.visited),a);return d(m,U([],[]),u)}function Ib(e,t,n,r,a,i){return i.reduce((m,u)=>[...m,xb(e,t,n,r,a,u)],[])}function bb(e,t,n,r,a,i){let m=rl(r,i,a),u=Ib(e,t,n,r,a,m);return s.IsEqual(u.length,1)?u[0]:ke(u)}function va(e,t,n,r){let a=Oe(e,t,r),i=ol(e,n,r),m=i[0],u=i[1];return Bt(u)?yb(t,m)?Gn(st(m),a):bb(e,t,st(m),u.parameters,u.expression,a):Gn(n,a)}function Gn(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function ml(e,t){return va({},U([],[]),e,t)}function pn(e){return y(e,"Call")}function vb(e){return p.Discard(e,["~immutable"])}function pl(e,t){return p.Update(vb(e),{},t)}function ul(e,t,n,r){let a=d(e,t,n);return pl(a,r)}function cl(e,t){return e(t)}function ll(e,t){return s.IsString(t)?P(cl(e,t)):P(t)}function dl(e,t){let n=$e(t);return ut(e,n)}function fl(e,t){let n=t.map(r=>ut(e,r));return w(n)}function ut(e,t){return q(t)?ll(e,t.const):Q(t)?dl(e,t.pattern):x(t)?fl(e,t.anyOf):t}function Br(e,t={}){return I("Capitalize",[e],t)}function hl(e,t={}){return Mo(e,t)}function Vr(e,t={}){return I("Lowercase",[e],t)}function gl(e,t={}){return Lo(e,t)}function Wr(e,t={}){return I("Uncapitalize",[e],t)}function yl(e,t={}){return qo(e,t)}function Hr(e,t={}){return I("Uppercase",[e],t)}function xl(e,t={}){return jo(e,t)}var $b=e=>e[0].toUpperCase()+e.slice(1),Tb=e=>e.toLowerCase(),kb=e=>e[0].toLowerCase()+e.slice(1),wb=e=>e.toUpperCase();function Mo(e,t){return k([e])?p.Update(ut($b,e),{},t):Br(e,t)}function Lo(e,t){return k([e])?p.Update(ut(Tb,e),{},t):Vr(e,t)}function qo(e,t){return k([e])?p.Update(ut(kb,e),{},t):Wr(e,t)}function jo(e,t){return k([e])?p.Update(ut(wb,e),{},t):Hr(e,t)}function Il(e,t,n,r){let a=d(e,t,n);return Mo(a,r)}function bl(e,t,n,r){let a=d(e,t,n);return Lo(a,r)}function vl(e,t,n,r){let a=d(e,t,n);return qo(a,r)}function $l(e,t,n,r){let a=d(e,t,n);return jo(a,r)}function Yr(e,t,n,r,a={}){return I("Conditional",[e,t,n,r],a)}function Tl(e,t,n,r,a={}){return Fo({},U([],[]),e,t,n,r,a)}function Eb(e,t,n,r,a,i){let m=le(e,n,r);return b.IsExtendsUnion(m)?w([d(m.inferred,t,a),d(e,t,i)]):b.IsExtendsTrue(m)?d(m.inferred,t,a):d(e,t,i)}function Fo(e,t,n,r,a,i,m){return k([n,r])?p.Update(Eb(e,t,n,r,a,i),{},m):Yr(n,r,a,i,m)}function kl(e,t,n,r,a,i,m){let u=d(e,t,n),l=d(e,t,r);return Fo(e,t,u,l,a,i,m)}function Jr(e,t={}){return I("ConstructorParameters",[e],t)}function wl(e,t={}){return Do(e,t)}function Rb(e){let t=oe(e)?e.parameters:[],n=wt({},U([],[]),t);return ee(n)}function Do(e,t){return k([e])?p.Update(Rb(e),{},t):Jr(e,t)}function El(e,t,n,r){let a=d(e,t,n);return Do(a,r)}function Zr(e,t,n={}){return I("Exclude",[e,t],n)}function Rl(e,t,n={}){return Xn(e,t,n)}function Xn(e,t,n){return k([e,t])?p.Update(Fr(e,t),{},n):Zr(e,t,n)}function Sl(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return Xn(i,m,a)}function Xr(e,t,n={}){return I("Extract",[e,t],n)}function Ol(e,t,n={}){return Go(e,t,n)}function Sb(e,t){let n=le({},e,t);return b.IsExtendsTrueLike(n)?[e]:[]}function Ob(e,t){return e.reduce((n,r)=>[...n,...Sb(r,t)],[])}function Pl(e,t){let n=Me(e),r=x(n)?n.anyOf:[n],a=Ob(r,t);return ke(a)}function Go(e,t,n){return k([e,t])?p.Update(Pl(e,t),{},n):Xr(e,t,n)}function Al(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return Go(i,m,a)}function Pb(e){return e.reduce((t,n)=>Ar(n)?[...t,P(n)]:t,[])}function un(e){let t=Pb(e);return w(t)}function Nn(e,t,n={}){return I("Index",[e,t],n)}function Cl(e,t,n={}){let r=s.IsArray(t)?un(t):t;return No(e,r,n)}function Ml(e,t){let n=Je(e,t);return Pe(n)}function Ll(e,t,n){let r=Ne(e,t,n);return Pe(r)}function Ab(e,t){let n=s.Keys(e).filter(h=>!s.HasPropertyKey(t,h)),r=s.Keys(t).filter(h=>!s.HasPropertyKey(e,h)),a=s.Keys(e).filter(h=>s.HasPropertyKey(t,h)),i=n.reduce((h,$)=>({...h,[$]:e[$]}),{}),m=r.reduce((h,$)=>({...h,[$]:t[$]}),{}),u=a.reduce((h,$)=>({...h,[$]:z([e[$],t[$]])}),{}),l=p.Assign(i,m);return p.Assign(l,u)}function ql(e){return e.reduce((t,n)=>Ab(t,Pe(n)),{})}function jl(e){let t=Us(ee(e));return Pe(t)}function Cb(e,t){return s.Keys(e).filter(a=>a in t).reduce((a,i)=>({...a,[i]:ke([e[i],t[i]])}),{})}function Fl(e,t){return s.ShiftLeft(e,(n,r)=>Fl(r,Cb(t,Pe(n))),()=>t)}function Dl(e){return s.ShiftLeft(e,(t,n)=>Fl(n,Pe(t)),()=>J())}function Pe(e){return ce(e)?Ml(e.$defs,e.$ref):V(e)?Ll(e.if,e.then,e.else):O(e)?ql(e.allOf):x(e)?Dl(e.anyOf):G(e)?jl(e.items):L(e)?e.properties:{}}function cn(e){let t=Pe(e);return v(t)}var Mb=new RegExp("^(?:0|[1-9][0-9]*)$");function ln(e){let t=`${e}`;return Mb.test(t)?parseInt(t):e}function Lb(e){return P(ln(e))}function Gl(e){return e.map(t=>Nl(t))}function Nl(e){return O(e)?ge(Gl(e.allOf)):x(e)?w(Gl(e.anyOf)):q(e)?Lb(e.const):e}function Ul(e,t){let n=Nl(t),r=le({},n,Te());return b.IsExtendsTrueLike(r)?e:q(t)&&s.IsEqual(t.const,"length")?Te():F()}function _l(e,t){let n=Je(e,t);return we(n)}function Kl(e,t,n){let r=Ne(e,t,n);return we(r)}function zl(e){let t=Se(e);return we(t)}function Bl(e){let t=z(e);return we(t)}function Vl(e){return[`${e}`]}function Wl(e){let t=$e(e);return we(t)}function Hl(e){return e.reduce((t,n)=>[...t,...we(n)],[])}function we(e){return ce(e)?_l(e.$defs,e.$ref):V(e)?Kl(e.if,e.then,e.else):ye(e)?zl(e.enum):O(e)?Bl(e.allOf):q(e)?Vl(e.const):Q(e)?Wl(e.pattern):x(e)?Hl(e.anyOf):[]}function dn(e){return we(e)}function Qn(e,t){return t.map(n=>er(e,n))}function er(e,t){return K(t)?Re(er(e,t.items)):oe(t)?_e(Qn(e,t.parameters),er(e,t.instanceType)):ie(t)?Ke(Qn(e,t.parameters),er(e,t.returnType)):G(t)?ee(Qn(e,t.items)):x(t)?w(Qn(e,t.anyOf)):O(t)?ge(Qn(e,t.allOf)):_r(t)?v(e):t}function Yl(e,t){return er(e,t)}function qb(e,t){let n=t in e?e[t]:F();return Yl(e,n)}function Jl(e,t){return t.reduce((n,r)=>[...n,qb(e,r)],[])}function jb(e,t){let n=dn(t),r=Jl(e,n);return ke(r)}var Fb=new RegExp(bt);function Db(e){return e.filter(n=>Fb.test(n))}function Gb(e){let t=kr(e),n=Db(t),r=Jl(e,n);return ke(r)}function Zl(e,t){return X(t)?Gb(e):jb(e,t)}function Nb(e){return P(ln(e))}function Xl(e){return e.map(t=>Uo(t))}function Uo(e){return O(e)?ge(Xl(e.allOf)):x(e)?w(Xl(e.anyOf)):q(e)?Nb(e.const):e}function Ub(e,t){return e.reduceRight((n,r,a)=>{let i=le({},P(a),t);return b.IsExtendsTrueLike(i)?[r,...n]:n},[])}function _b(e,t){let n=Uo(t),r=Ub(e,n);return mt(r)}function Kb(e){return mt(e)}function Ql(e,t){return q(t)&&s.IsEqual(t.const,"length")?P(e.length):X(t)||xe(t)?Kb(e):_b(e,t)}function ed(e,t){return K(e)?Ul(e.items,t):L(e)?Zl(e.properties,t):G(e)?Ql(e.items,t):F()}function zb(e){return ce(e)||V(e)||O(e)||x(e)?cn(e):e}function No(e,t,n){return k([e,t])?p.Update(ed(zb(e),t),{},n):Nn(e,t,n)}function td(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return No(i,m,a)}function Qr(e,t={}){return I("InstanceType",[e],t)}function nd(e,t={}){return _o(e,t)}function Bb(e){return oe(e)?e.instanceType:F()}function _o(e,t){return k([e])?p.Update(Bb(e),{},t):Qr(e,t)}function rd(e,t,n,r={}){let a=d(e,t,n);return _o(a,r)}function Un(e,t={}){return I("KeyOf",[e],t)}function ad(e,t={}){return Ko(e,t)}function od(){return w([Te(),Ce(),Jt()])}function id(e){return Te()}function Vb(e){return e.reduce((n,r)=>Ar(r)?[...n,P(ln(r))]:J(),[])}function sd(e){let t=s.Keys(e),n=Vb(t);return mt(n)}function md(e){return Qt(e)}function pd(e){let t=e.map((n,r)=>P(r));return mt(t)}function ud(e){return Z(e)?od():K(e)?id(e.items):L(e)?sd(e.properties):de(e)?md(e):G(e)?pd(e.items):F()}function Wb(e){return ce(e)||V(e)||O(e)||x(e)?cn(e):e}function Ko(e,t){return k([e])?p.Update(ud(Wb(e)),{},t):Un(e,t)}function cd(e,t,n,r){let a=d(e,t,n);return Ko(a,r)}function Fn(e,t,n,r,a={}){return I("Mapped",[e,t,n,r],a)}function ld(e,t,n,r,a={}){return zo({},U([],[]),e,t,n,r,a)}function Hb(e){let t=$e(e);return $a(t)}function Yb(e){return e.reduce((t,n)=>[...t,...$a(n)],[])}function Jb(e){let t=Se(e);return $a(t)}function Zb(e){return s.IsNumber(e)?[P(`${e}`)]:[P(e)]}function $a(e){return ye(e)?Jb(e.enum):q(e)?Zb(e.const):Q(e)?Hb(e.pattern):x(e)?Yb(e.anyOf):[e]}function dd(e){return $a(e)}function Xb(e){return Q(e)?$e(e.pattern):e}function Qb(e,t,n,r,a,i){let m=p.Assign(e,{[n.name]:r}),u=d(m,t,a),l=Xb(u),f=d(m,t,i);return vs(l)||$s(l)?{[l.const]:f}:{}}function ev(e,t,n,r,a,i){return r.reduce((m,u)=>[...m,Qb(e,t,n,u,a,i)],[])}function tv(e){return e.reduce((t,n)=>[...t,v(n)],[])}function fd(e,t,n,r,a,i){let m=dd(r),u=ev(e,t,n,m,a,i),l=tv(u);return z(l)}function zo(e,t,n,r,a,i,m){return k([r])?p.Update(fd(e,t,n,r,a,i),{},m):Fn(n,r,a,i,m)}function hd(e,t,n,r,a,i,m){let u=d(e,t,r);return zo(e,t,n,u,a,i,m)}function nv(e,t,n){let r=p.Assign(e,t);return s.Keys(t).filter(i=>n.includes(i)).reduce((i,m)=>({...i,[m]:Jc(r,m,t[m])}),{})}function rv(e,t,n){let r=p.Assign(e,t);return s.Keys(t).filter(i=>!n.includes(i)).reduce((i,m)=>({...i,[m]:d(r,U([],[]),t[m])}),{})}function av(e,t,n){let r=Vc(t),a=nv(e,t,r),i=rv(e,t,r),m={...a,...i};return p.Update(m,{},n)}function Ta(e,t,n,r){return av(e,n,r)}function ea(e,t={}){return I("NonNullable",[e],t)}function gd(e,t={}){return Bo(e,t)}function ov(e){let t=w([Ht(),en()]);return Xn(e,t,{})}function Bo(e,t){return k([e])?p.Update(ov(e),{},t):ea(e,t)}function yd(e,t,n,r){let a=d(e,t,n);return Bo(a,r)}function ta(e,t,n={}){return I("Omit",[e,t],n)}function xd(e,t,n={}){let r=s.IsArray(t)?un(t):t;return Vo(e,r,n)}function ka(e){let t=cn(e);return L(t)?t.properties:J()}function iv(e,t){return s.Keys(e).reduce((r,a)=>t.includes(a)?r:{...r,[a]:e[a]},{})}function Id(e,t){let n=ka(e),r=dn(t),a=iv(n,r);return v(a)}function Vo(e,t,n){return k([e,t])?p.Update(Id(e,t),{},n):ta(e,t,n)}function bd(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return Vo(i,m,a)}function na(e,t={}){return I("Parameters",[e],t)}function vd(e,t={}){return Wo(e,t)}function sv(e){let t=ie(e)?e.parameters:[],n=wt({},U([],[]),t);return ee(n)}function Wo(e,t){return k([e])?p.Update(sv(e),{},t):na(e,t)}function $d(e,t,n,r){let a=d(e,t,n);return Wo(a,r)}function ra(e,t={}){return I("Partial",[e],t)}function Td(e,t={}){return Ho(e,t)}function kd(e,t){let n=Je(e,t),r=Ze(n);return Be(p.Assign(e,{[t]:r}),t)}function wd(e,t,n){let r=Ne(e,t,n);return Ze(r)}function Ed(e){let t=z(e);return Ze(t)}function Rd(e){let t=e.map(n=>Ze(n));return w(t)}function Sd(e){let t=s.Keys(e).reduce((r,a)=>({...r,[a]:At(e[a])}),{});return v(t)}function Ze(e){return ce(e)?kd(e.$defs,e.$ref):V(e)?wd(e.if,e.then,e.else):O(e)?Ed(e.allOf):x(e)?Rd(e.anyOf):L(e)?Sd(e.properties):v({})}function Ho(e,t){return k([e])?p.Update(Ze(e),{},t):ra(e,t)}function Od(e,t,n,r){let a=d(e,t,n);return Ho(a,r)}function aa(e,t,n={}){return I("Pick",[e,t],n)}function Pd(e,t,n={}){let r=s.IsArray(t)?un(t):t;return Yo(e,r,n)}function mv(e,t){return s.Keys(e).reduce((r,a)=>t.includes(a)?p.Assign(r,{[a]:e[a]}):r,{})}function Ad(e,t){let n=ka(e),r=dn(t),a=mv(n,r);return v(a)}function Yo(e,t,n){return k([e,t])?p.Update(Ad(e,t),{},n):aa(e,t,n)}function Cd(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return Yo(i,m,a)}function oa(e,t={}){return I("ReadonlyObject",[e],t)}function Jo(e,t={}){return Zo(e,t)}var Md=Jo;function Ld(e){return Wt(Re(e))}function qd(e,t){let n=Je(e,t),r=Xe(n);return Be(p.Assign(e,{[t]:r}),t)}function jd(e,t,n){let r=Ne(e,t,n);return Xe(r)}function Fd(e){let t=z(e);return Xe(t)}function Dd(e){let t=s.Keys(e).reduce((r,a)=>({...r,[a]:Lt(e[a])}),{});return v(t)}function Gd(e){return Wt(ee(e))}function Nd(e){let t=e.map(n=>Xe(n));return w(t)}function Xe(e){return K(e)?Ld(e.items):ce(e)?qd(e.$defs,e.$ref):V(e)?jd(e.if,e.then,e.else):O(e)?Fd(e.allOf):L(e)?Dd(e.properties):G(e)?Gd(e.items):x(e)?Nd(e.anyOf):e}function Zo(e,t){return k([e])?p.Update(Xe(e),{},t):oa(e)}function Ud(e,t,n,r){let a=d(e,t,n);return Zo(a,r)}function _d(e,t,n,r){return t.visited.includes(r)?n:r in e?d(e,U(t.callstack,[...t.visited,r]),e[r]):n}function Kd(e,t){let n=Je(e,t),r=Qe(n);return Be(p.Assign(e,{[t]:r}),t)}function zd(e,t,n){let r=Ne(e,t,n);return Qe(r)}function Bd(e){let t=z(e);return Qe(t)}function Vd(e){let t=e.map(n=>Qe(n));return w(t)}function Wd(e){let t=s.Keys(e).reduce((r,a)=>({...r,[a]:jr(e[a])}),{});return v(t)}function Qe(e){return ce(e)?Kd(e.$defs,e.$ref):V(e)?zd(e.if,e.then,e.else):O(e)?Bd(e.allOf):x(e)?Vd(e.anyOf):L(e)?Wd(e.properties):v({})}function ia(e,t={}){return I("Required",[e],t)}function Hd(e,t={}){return Xo(e,t)}function Xo(e,t){return k([e])?p.Update(Qe(e),{},t):ia(e,t)}function Yd(e,t,n,r){let a=d(e,t,n);return Xo(a,r)}function sa(e,t={}){return I("ReturnType",[e],t)}function Jd(e,t={}){return Qo(e,t)}function pv(e){return ie(e)?e.returnType:F()}function Qo(e,t){return k([e])?p.Update(pv(e),{},t):sa(e,t)}function Zd(e,t,n,r={}){let a=d(e,t,n);return Qo(a,r)}function ma(e,t){return I("With",[e,t],{})}function Xd(e,t){return ei(e,t)}function ei(e,t){return k([e])?p.Update(e,{},t):ma(e,t)}function Qd(e,t,n,r){let a=d(e,t,n);return ei(a,r)}function uv(e){return vt(e)?G(e.items)?ti(e.items.items):Y(e.items)?[e]:se(e.items)?[e]:[F()]:[e]}function ti(e){return e.reduce((n,r)=>[...n,...uv(r)],[])}function U(e,t){return{callstack:e,visited:t}}function k(e){return s.ShiftLeft(e,(t,n)=>se(t)?!1:k(n),()=>!0)}function Wn(e,t,n){return s.Keys(n).reduce((r,a)=>({...r,[a]:d(e,t,n[a])}),{})}function wt(e,t,n){let r=Oe(e,t,n);return ti(r)}function Oe(e,t,n){return n.map(r=>d(e,t,r))}function cv(e,t){let n=he(e)?wn(t,{}):t,r=qt(e)?kn(n,{}):n;return Mt(e)?tr(r,{}):r}function lv(e,t,n,r,a){return s.IsEqual(n,"AddImmutable")?ef(e,t,r[0],a):s.IsEqual(n,"RemoveImmutable")?ul(e,t,r[0],a):s.IsEqual(n,"AddReadonly")?Ji(e,t,r[0],a):s.IsEqual(n,"RemoveReadonly")?js(e,t,r[0],a):s.IsEqual(n,"AddOptional")?Zi(e,t,r[0],a):s.IsEqual(n,"RemoveOptional")?Gs(e,t,r[0],a):s.IsEqual(n,"Capitalize")?Il(e,t,r[0],a):s.IsEqual(n,"Conditional")?kl(e,t,r[0],r[1],r[2],r[3],a):s.IsEqual(n,"ConstructorParameters")?El(e,t,r[0],a):s.IsEqual(n,"Evaluate")?Qc(e,t,r[0],a):s.IsEqual(n,"Exclude")?Sl(e,t,r[0],r[1],a):s.IsEqual(n,"Extract")?Al(e,t,r[0],r[1],a):s.IsEqual(n,"Index")?td(e,t,r[0],r[1],a):s.IsEqual(n,"InstanceType")?rd(e,t,r[0],a):s.IsEqual(n,"Interface")?_c(e,t,r[0],r[1],a):s.IsEqual(n,"KeyOf")?cd(e,t,r[0],a):s.IsEqual(n,"Lowercase")?bl(e,t,r[0],a):s.IsEqual(n,"Mapped")?hd(e,t,r[0],r[1],r[2],r[3],a):s.IsEqual(n,"Module")?Ta(e,t,r[0],a):s.IsEqual(n,"NonNullable")?yd(e,t,r[0],a):s.IsEqual(n,"Pick")?Cd(e,t,r[0],r[1],a):s.IsEqual(n,"Parameters")?$d(e,t,r[0],a):s.IsEqual(n,"Partial")?Od(e,t,r[0],a):s.IsEqual(n,"Omit")?bd(e,t,r[0],r[1],a):s.IsEqual(n,"ReadonlyObject")?Ud(e,t,r[0],a):s.IsEqual(n,"Record")?nm(e,t,r[0],r[1],a):s.IsEqual(n,"Required")?Yd(e,t,r[0],a):s.IsEqual(n,"ReturnType")?Zd(e,t,r[0],a):s.IsEqual(n,"TemplateLiteral")?ic(e,t,r[0],a):s.IsEqual(n,"Uncapitalize")?vl(e,t,r[0],a):s.IsEqual(n,"Uppercase")?$l(e,t,r[0],a):s.IsEqual(n,"With")?Qd(e,t,r[0],r[1]):I(n,r,a)}function dv(e,t,n){let r=se(n)?_d(e,t,n,n.$ref):K(n)?Re(d(e,t,n.items),Tr(n)):pn(n)?va(e,t,n.target,n.arguments):oe(n)?_e(Oe(e,t,n.parameters),d(e,t,n.instanceType),Xi(n)):ie(n)?Ke(Oe(e,t,n.parameters),d(e,t,n.returnType),Qi(n)):V(n)?Ct(d(e,t,n.if),d(e,t,n.then),d(e,t,n.else),os(n)):O(n)?ge(Oe(e,t,n.allOf),us(n)):L(n)?v(Wn(e,t,n.properties),rs(n)):de(n)?rm(Le(n),d(e,t,be(n))):vt(n)?Dt(d(e,t,n.items)):G(n)?ee(wt(e,t,n.items),qs(n)):x(n)?w(Oe(e,t,n.anyOf),ks(n)):n;return cv(n,r)}function d(e,t,n){return ht(n)?lv(e,t,n.action,n.parameters,n.options):dv(e,t,n)}function ni(e,t){return d(e,U([],[]),t)}function fv(e){return p.Update(e,{"~immutable":!0},{})}function tr(e,t){return p.Update(fv(e),{},t)}function ef(e,t,n,r){let a=d(e,t,n);return tr(a,r)}function au(e,t={}){return I("AddImmutable",[e],t)}function Wt(e,t={}){return tr(e,t)}function ou(e,t={}){return I("Evaluate",[e],t)}function tf(e,t={}){return Ao(e,t)}function iu(e,t={}){return I("Module",[e],t)}function nf(e,t={}){return Ta({},U([],[]),e,t)}function rf(...e){let[t,n,r]=Ve.Match(e,{2:(m,u)=>s.IsString(m)?[{},m,u]:[m,u,{}],3:(m,u,l)=>[m,u,l],1:m=>[{},m,{}]}),a=tc(n),i=s.IsArray(a)&&s.IsEqual(a.length,2)?d(t,U([],[]),a[0]):F();return p.Update(i,{},r)}var D={};Rt(D,{Any:()=>Vt,Array:()=>Re,BigInt:()=>On,Boolean:()=>Or,Call:()=>ml,Capitalize:()=>hl,Codec:()=>Sr,Conditional:()=>Tl,Constructor:()=>_e,ConstructorParameters:()=>wl,Cyclic:()=>Be,Decode:()=>fs,DecodeBuilder:()=>Sn,Dependent:()=>Ct,Encode:()=>hs,EncodeBuilder:()=>Rn,Enum:()=>ps,Evaluate:()=>tf,Exclude:()=>Rl,Extends:()=>le,ExtendsResult:()=>b,Extract:()=>Ol,Function:()=>Ke,Generic:()=>gt,Identifier:()=>Pn,Immutable:()=>gs,Index:()=>Cl,Infer:()=>En,InstanceType:()=>nd,Instantiate:()=>ni,Integer:()=>jt,Interface:()=>Kc,Intersect:()=>ge,IsAny:()=>Z,IsArray:()=>K,IsBigInt:()=>He,IsBoolean:()=>Ae,IsCall:()=>pn,IsCodec:()=>Rr,IsConstructor:()=>oe,IsCyclic:()=>ce,IsDependent:()=>V,IsEnum:()=>ye,IsEnumValue:()=>ms,IsFunction:()=>ie,IsGeneric:()=>Bt,IsIdentifier:()=>bs,IsImmutable:()=>Mt,IsInfer:()=>Y,IsInteger:()=>xe,IsIntersect:()=>O,IsKind:()=>y,IsLiteral:()=>q,IsNever:()=>yt,IsNull:()=>Yt,IsNumber:()=>X,IsObject:()=>L,IsOptional:()=>he,IsParameter:()=>Ts,IsReadonly:()=>qt,IsRecord:()=>de,IsRef:()=>se,IsRefine:()=>to,IsRest:()=>vt,IsSchema:()=>re,IsString:()=>Ie,IsSymbol:()=>xt,IsTemplateLiteral:()=>Q,IsThis:()=>_r,IsTuple:()=>G,IsUndefined:()=>tn,IsUnion:()=>x,IsUnknown:()=>ae,IsUnsafe:()=>Er,IsVoid:()=>Ye,KeyOf:()=>ad,Literal:()=>P,Lowercase:()=>gl,Mapped:()=>ld,Module:()=>nf,Never:()=>F,NonNullable:()=>gd,Null:()=>Ht,Number:()=>Te,Object:()=>v,Omit:()=>xd,Optional:()=>ts,Parameter:()=>Ft,Parameters:()=>vd,Partial:()=>Td,Pick:()=>Pd,Readonly:()=>ys,ReadonlyObject:()=>Jo,ReadonlyType:()=>Md,Record:()=>Gr,RecordKey:()=>Qt,RecordPattern:()=>Le,RecordValue:()=>be,Ref:()=>st,Refine:()=>xs,Required:()=>Hd,Rest:()=>Dt,ReturnType:()=>Jd,Script:()=>rf,String:()=>Ce,Symbol:()=>Jt,TemplateLiteral:()=>mc,This:()=>Ur,Tuple:()=>ee,Uncapitalize:()=>yl,Undefined:()=>en,Union:()=>w,Unknown:()=>me,Unsafe:()=>as,Uppercase:()=>xl,Void:()=>Kr,With:()=>Xd});var nr="submit_test_gap_candidates",rr="submit_filtered_test_gaps",ar="submit_solver_gaps",Z4=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 hv=D.Object({statement:D.String({description:"One sentence from agent_prompt.md, copied verbatim."}),gaps:D.Array(D.Object({description:D.String({description:"A fair, publicly observable missing behavioral test."}),risk:D.String({description:"Why an incorrect implementation could pass the current tests despite this missing behavior."})}),{description:"All candidate positive and negative gaps for this sentence; there is no maximum or target count, so include every distinct evidence-backed gap and relevant edge case rather than stopping at 10; use an empty array only when exhaustive analysis finds none."})});function af(e){return{name:nr,label:"Submit Candidate Test Gaps",description:"Submit one candidate-gap list for one prompt sentence. Call this after each sentence so the orchestrator can track the todo list; empty lists are required when that sentence has no gaps.",parameters:hv,async execute(t,n){let r=e.statements??[];return r.push({statement:n.statement,gaps:n.gaps??[]}),e.statements=r,{content:[{type:"text",text:`Recorded ${n.gaps?.length??0} candidate gap(s)`}],details:void 0}}}}var gv=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 of(e){return{name:rr,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:gv,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Confirmed ${r.length} gap(s) after filtering`}],details:void 0}}}}var yv=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 sf(e){return{name:ar,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:yv,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Recorded ${r.length} solver gap(s)`}],details:void 0}}}}function xv(e){return[e,"You are working inside the actual repository (this is your current directory) in read-only mode. You have access to read/grep/find/ls tools only \u2014 you cannot execute code or edit files.","Read `agent_prompt.md` for the task requirements and inspect the repository's existing source/code files with read/grep/find/ls. Base the analysis on the prompt and the observable behavior supported by those code files."]}var Iv=["Thoroughness \u2014 your job is high recall on genuine gaps only:","- There is no target count or cap: do not stop at 10 (or any other arbitrary number). For each prompt sentence, enumerate as many distinct uncovered required behaviors and edge cases as the files justify, then continue until an additional sweep finds no new genuine gap.","- 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 and relevant repository code.","- After your first pass, run at least one deliberate second sweep (re-read `agent_prompt.md` and grep/read the relevant code files) 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: behaviors that may be missed under other valid inputs, repository conventions, interaction effects, ordering/timing, and branches in the relevant source code that need behavioral coverage.","- Include a candidate only when you can cite specific grounding and a concrete false-pass risk \u2014 not to meet a quota."],mf=["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 the relevant source files carefully and distinguish genuinely required behavior from speculation; focus on public outcomes and edge cases that deserve behavioral coverage.","- 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 pf(e,t){let n=[...xv("You are an exhaustive behavioral test-gap finder. Review the task prompt sentence by sentence, finding both missing required-behavior (positive) and missing forbidden/wrong-behavior (negative) tests."),"","First split `agent_prompt.md` into its meaningful sentences using periods (`.`) as the sentence boundary. Create an explicit TODO checklist of every resulting requirement sentence. Work through it one item at a time; do not finish until every item is checked off.","","Before analyzing each sentence, use read/grep/find/ls to inspect the relevant source files and their closest analogues. Use that code context to understand the public contracts, conventions, branches, guards, early returns, state transitions, side effects, boundary handling, and negative/prohibited outcomes required by the sentence. Report every distinct, prompt-required behavioral edge case or prohibition that a plausible implementation could miss. Include positive and negative gaps together for that sentence. There is no maximum number of gaps: keep enumerating distinct missing behaviors for this sentence, including boundary, empty, repeated, interacting, and other relevant edge cases; do not treat 10 as sufficient.","",...Iv,"",...mf,"","Test-coverage checklist for calibration:",e];return n.push("","Fairness: keep only behavior that a user, caller, or existing public contract can observe. Do not require private helpers, internal state, implementation structure, call order, selectors, or incidental strings unless the task explicitly makes them public requirements."),n.push("","For every candidate, state the missing fair behavioral test, the relevant source behavior or branch that led you to investigate it, and why a plausible incorrect implementation could evade that test. The prompt sentence is the required specification: do not report incidental implementation details it does not require. Do not propose the exact test implementation.",`After completing EACH TODO sentence, call \`${nr}\` with that exact sentence and its gap array (including an empty array when none exist). You may and must call the tool multiple times: once per sentence. Only finish after every TODO item has been submitted.`),n.join(`
|
|
12
|
+
`)}function uf(e,t,n){let r=["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 or edit files.","Two specialized research agents reviewed `agent_prompt.md` and the repository's source/code files sentence by sentence, proposing both positive (missing required-behavior) and negative (missing forbidden/wrong-behavior) gaps. It submitted the following per-sentence candidate report:","",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 implementation structure. Judge this precisely against the fairness guidance below.","3. A real, distinct behavioral gap \u2014 drop near-duplicate candidates and keep only the clearest phrasing of each distinct gap. Retain a candidate only when the source code and prompt provide concrete grounding for a behavior that deserves an explicit public-outcome check.","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.push("","Fairness: keep only behavior that a user, caller, or existing public contract can observe. Do not require private helpers, internal state, implementation structure, call order, selectors, or incidental strings unless the task explicitly makes them public requirements."),r.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 \`${rr}\` tool exactly once with your final filtered list (which may be empty). That tool call is your only way to report a result.`),r.join(`
|
|
13
|
+
`)}function cf(){return["You are a adversarial tester. Your goal is to find the most minimal, shortcut implementation that makes all new tests pass \u2014 not a full, correct solution. This is intentional: we want to discover whether the test suite lets through an implementation that barely satisfies the assertions without properly implementing the prompt's required behavior.","`agent_prompt.md` in the repo root describes the intended task. Tests for it already exist and are currently failing.","","Goal: make ALL of the new tests pass with the least amount of real logic possible.","1. Run `bash test.sh new` to see the failures and what the tests expect. Read the failing tests carefully \u2014 they are the only spec you need to satisfy.","2. Understand exactly what each test assertion checks. Ask, 'what is the minimum thing I can do \u2014 a stub, a hardcoded return, a mockish pass-through, a trivial branch \u2014 to satisfy this test?', not 'what does agent_prompt.md intend?'. Skim `agent_prompt.md` only enough to understand what the test file names and assertions refer to, then rely on the test errors to drive what to implement.","3. Prefer the most minimal implementation possible:"," - Hardcode a return value if the test expects one."," - Add only the code paths a test actually exercises; leave anything untested unimplemented."," - Mock the minimum number of dependencies (or none) that the test error forces you to touch."," - Use the most direct, trivial, shortcut approach \u2014 do not build abstractions, do not handle unobserved edge cases, do not add defensive code.","4. Before declaring success, also run `bash test.sh base` to confirm your changes cause no regressions. The shortcut must not break existing tests \u2014 that would be a false positive from a different angle.","5. Re-run `bash test.sh new` and iterate until both the new tests and the base tests pass, or you're confident you cannot pass more without adding real logic.","","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.","- The prompt is not your spec: the tests are. Implement exactly what the tests demand, nothing more. If you can satisfy a test with a hardcoded return, do it."].join(`
|
|
14
|
+
`)}function bv(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 \`${In}/solver_${e.index}/\``}function lf(e,t,n){let r=["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 \`${In}/solver_<index>/\` (\`solution.diff\`, \`test_output.txt\`), with a \`${In}/manifest.json\` summary. Use read/grep/find/ls to open exactly what you need. Status summary:`,"",...e.map(bv),"","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.","",...mf,"- 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 n&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",n),r.push("",`When you are done, call the \`${ar}\` tool exactly once with your final list (which may be empty). That tool call is your only way to report a result.`),r.join(`
|
|
15
|
+
`)}var vv=900*1e3,ri=["read","grep","find","ls"];function Ra(e){return e==="off"?void 0:e}async function Sa(e,t,n=vv){let r=t.aborted?"cancelled":"done";return await Promise.race([e().then(()=>{t.aborted||(r="done")}),new Promise(a=>{setTimeout(()=>{r="timedOut",a()},n)}),new Promise(a=>{if(t.aborted)return a();t.addEventListener("abort",()=>{r="cancelled",a()},{once:!0})})]),r}async function Oa(e){let t={},n=e.model,{session:r}=await wa({cwd:e.tempDir,model:n,thinkingLevel:Ra(e.thinkingLevel),tools:[...ri,nr],customTools:[af(t)],sessionManager:Ea.inMemory()});try{let a=await Sa(async()=>{await r.prompt(pf(e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.statements?{status:"ok",gaps:t.statements}:{status:"noSubmission",gaps:[]}}var $v=["read","grep","find","ls","write","edit","bash"];async function df(e){let t=e.model;try{let n=Ea.inMemory(),{session:r}=await wa({cwd:e.solverDir,model:t,thinkingLevel:Ra(e.thinkingLevel),tools:[...$v],sessionManager:n}),a=await Sa(async()=>{await r.prompt(cf())},e.cancelSignal,e.timeoutMinutes*60*1e3);return a!=="done"&&await r.abort(),{outcome:a,trajectory:n.getEntries()}}catch{return{outcome:"error",trajectory:[]}}}async function ff(e){let t={},n=e.model,{session:r}=await wa({cwd:e.tempDir,model:n,thinkingLevel:Ra(e.thinkingLevel),tools:[...ri,ar],customTools:[sf(t)],sessionManager:Ea.inMemory()});try{let a=await Sa(async()=>{await r.prompt(lf(e.solverResults,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}async function Pa(e){let t={},n=e.model,{session:r}=await wa({cwd:e.tempDir,model:n,thinkingLevel:Ra(e.thinkingLevel),tools:[...ri,rr],customTools:[of(t)],sessionManager:Ea.inMemory()});try{let a=await Sa(async()=>{await r.prompt(uf(e.statementReports,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var Et="checks_progress";function or(e,t,n,r){let a=n>0?Math.min(1,t/n):0,i=Math.round(24*a),m="\u2588".repeat(i)+"\u2591".repeat(Math.max(0,24-i)),u=r?` pass:${r.passed} fail:${r.failed}`:"";return[`checks: ${e} [${m}] ${t}/${n}${u}`]}import{existsSync as Tv,readFileSync as kv}from"node:fs";var ai=["agent_prompt.md","solution.patch","test.patch"];function oi(e=new Date){let t=(i,m=2)=>String(i).padStart(m,"0"),n=-e.getTimezoneOffset(),r=n>=0?"+":"-",a=Math.abs(n);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}${r}${t(Math.floor(a/60))}:${t(a%60)}`}function hf(e){try{if(!Tv(e))return{};let t=JSON.parse(kv(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function gf(e){let t={...e.existingReport,timestamp:oi(),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 (sentence finder: ${e.gapFinderStatus}, review: ${e.gapFilterStatus}); testGaps may be incomplete.`:delete t.testGapAnalysisNote),e.runSolverGapFinder&&(t.solverRunSummary=e.solverResults.map(n=>({index:n.index,status:n.status,passed:n.passed,durationMs:n.durationMs,totalTests:n.totalTests,failedTests:n.failedTests,artifactsDir:n.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 yf(e){let t=Math.round(e/1e3);return t>=60?`${Math.floor(t/60)}m ${t%60}s`:`${t}s`}function xf(e){let t=Array.isArray(e.merged.testGaps)?e.merged.testGaps.length:0,n=e.runSolverGapFinder&&Array.isArray(e.merged.solverRunSummary)?e.merged.solverRunSummary.map(i=>({...i,durationMs:i.durationMs??0})):[],r=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(`${n.filter(i=>i.passed).length}/${n.length} solvers passed, ${r} gap(s) found`),{content:`Gap finders: ${a.join(" | ")}`,details:{gapsCount:t,showGaps:e.runGapFinder,showSolverGaps:e.runSolverGapFinder,solverDetails:n,solverGapsCount:r}}}var If=`## The problem description (aka the task)\r
|
|
16
16
|
P1: Aligns with the repo's philosophy\r
|
|
17
17
|
P2: Self-contained \u2014 solvable from the repo and description alone\r
|
|
18
18
|
P3: Clear, concise, and unambiguous \u2014 describes what to build or fix and don't leave points for guessing\r
|
|
@@ -39,7 +39,7 @@ That's the golden solution \u2014 the proof that your task is solvable and that
|
|
|
39
39
|
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
|
|
40
40
|
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
|
|
41
41
|
S3: No irrelevant changes to the code \u2014 if something is unrelated to your task, keep it as it is.\r
|
|
42
|
-
S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,
|
|
42
|
+
S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,wv=`# Agent Evaluation Guidelines\r
|
|
43
43
|
\r
|
|
44
44
|
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
|
|
45
45
|
\r
|
|
@@ -319,9 +319,9 @@ Keep changes separated when possible:\r
|
|
|
319
319
|
- Avoid unrelated dependency or lockfile changes.\r
|
|
320
320
|
- Regenerate patches after every prompt/test/solution change.\r
|
|
321
321
|
\r
|
|
322
|
-
---`;function
|
|
323
|
-
`)
|
|
324
|
-
${
|
|
322
|
+
---`;function Aa(){return(If.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??If).trim()}function Ca(){return wv.trim()}var Ma=!1,fn;function La(){return Ma}function bf(){return Ma=!0,fn=new AbortController,fn}function vf(){Ma=!1,fn=void 0}function $f(){return!Ma||!fn||fn.signal.aborted?!1:(fn.abort(),!0)}import{existsSync as Ev}from"node:fs";import{join as Rv}from"node:path";import{keyHint as Sv}from"@earendil-works/pi-coding-agent";import{Text as Ov,wrapTextWithAnsi as Pv}from"@earendil-works/pi-tui";var ir="analyze_test_gaps",Tf=6;function kf(e){e.registerTool({name:ir,label:"Gap Finder",description:"Run the sentence-by-sentence behavioral test-gap analysis on the current task and its repository source files: a read-only finder agent splits agent_prompt.md into sentences and proposes missing positive/negative behavioral tests per sentence, then a read-only fairness reviewer filters out unfair or internally-observable candidates (skipped when the finder found nothing). Returns the confirmed gaps as the tool result (details.testGaps). Never writes or modifies files.",promptSnippet:"Analyze the task's hidden tests for behavioral coverage gaps",promptGuidelines:["Use analyze_test_gaps when you need the confirmed list of fair behavioral test gaps for the current task's hidden tests."],parameters:D.Object({}),renderCall(t,n,r){let a=r.state;r.executionStarted&&a.startedAt===void 0&&(a.startedAt=Date.now(),a.endedAt=void 0);let i=r.lastComponent??new Ov("",0,0);return i.setText(""),i},renderResult(t,n,r,a){let i=a.state;i.startedAt!==void 0&&n.isPartial&&!i.interval&&(i.interval=setInterval(()=>a.invalidate(),1e3)),(!n.isPartial||a.isError)&&(i.endedAt??=Date.now(),i.interval&&(clearInterval(i.interval),i.interval=void 0));let m=n.isPartial?"Elapsed":"Took",u=i.endedAt??Date.now(),l=i.startedAt!==void 0?Mv(u-i.startedAt):"\u2014",f=t.details,h=Array.isArray(f?.testGaps)?f.testGaps.length:void 0,$=h===void 0?"gaps \u2014":`${h} gap${h===1?"":"s"}`,E=r.fg("toolTitle",r.bold("Gap Finder"))+r.fg("muted",` ${m} ${l} \xB7 ${$}`),H=(t.content??[]).map(ue=>ue.type==="text"?ue.text:"").join(`
|
|
323
|
+
`).trim(),te=H?Av(H.split(`
|
|
324
|
+
`)):["(no output)"];if(!n.expanded){let ue=Math.max(0,te.length-Tf);te=te.slice(0,Tf),ue>0&&te.push(`... (${ue} more lines, ${Sv("app.tools.expand","to expand")})`)}let ne=a.lastComponent instanceof qa?a.lastComponent:new qa;return ne.setContent(E,te,r),ne},async execute(t,n,r,a,i){if(!xn())throw new Error("analyze_test_gaps is disabled. Enable it via /checks --config (Analyze Tool section -> Enabled).");let m=Rv(i.cwd,"agent_prompt.md");if(!Ev(m))throw new Error("Missing required file in project root: agent_prompt.md");let u=Ri()??Ee(),l=u,f=l?i.modelRegistry.find(l.provider,l.modelId):i.model;if(!f||l&&!i.modelRegistry.hasConfiguredAuth(f))throw new Error("No model configured/authenticated for analyze_test_gaps. Set one via /checks --config (Analyze Tool section).");let h=u?.thinkingLevel??"off",$=new AbortController;r&&(r.aborted?$.abort():r.addEventListener("abort",()=>$.abort(),{once:!0}));let E={tempDir:i.cwd,model:f,thinkingLevel:h,testRubric:Aa(),fairnessRules:Ca(),cancelSignal:$.signal};a?.({content:[{type:"text",text:"Finding behavioral test gaps sentence by sentence..."}],details:{}});let A=await Oa(E);if($.signal.aborted)throw new Error("Cancelled by user.");if(A.status!=="ok")throw new Error(`Gap finder did not complete (status: ${A.status}).`);let H=A.gaps.reduce((ne,ue)=>ne+ue.gaps.length,0),te=[];if(H>0){a?.({content:[{type:"text",text:`Validating ${H} candidate gap(s)...`}],details:{}});let ne=await Pa({...E,statementReports:A.gaps});if($.signal.aborted)throw new Error("Cancelled by user.");if(ne.status!=="ok")throw new Error(`Gap review did not complete (status: ${ne.status}).`);te=ne.gaps}return{content:[{type:"text",text:Lv(te)}],details:{testGaps:te}}}})}function Av(e){let t=[],n=!1;for(let r of e)/^\s*\d+\.\s+/.test(r)?(n=!1,t.push(r)):/^\s*Justification:/i.test(r)?n=!0:n||t.push(r);return t}var qa=class{header="";styledLines=[];theme;cachedWidth=-1;cachedLines=[];setContent(t,n,r){this.header=t,this.styledLines=n.map(a=>Cv(a,r)),this.theme=r,this.cachedWidth=-1}invalidate(){this.cachedWidth=-1}render(t){if(this.cachedWidth!==t){let n=this.theme,r=[];this.header&&r.push(this.header,"");for(let a of this.styledLines)n?r.push(...Pv(a,t)):r.push(a);this.cachedLines=r,this.cachedWidth=t}return this.cachedLines}};function Cv(e,t){let n=e.match(/^(\d+)\.\s+(.*)$/);return n?`${t.fg("accent",`${n[1]}.`)} ${t.fg("muted",n[2]??"")}`:t.fg("toolOutput",e)}function Mv(e){return`${Math.floor(e/1e3)}s`}function Lv(e){return e.length===0?"Gap analysis complete: no confirmed behavioral test gaps were found.":["Below are the gaps found by another agent. If they are fair under our prompt, we need to add tests to fix the gap. If not fair, do not mind those \u2014 only add tests for gaps that are absolutely fair.","",...e.map((n,r)=>`${r+1}. ${n.description}
|
|
325
325
|
Justification: ${n.justification}`)].join(`
|
|
326
|
-
`)}var
|
|
327
|
-
`),"info");return}let a=[...new Set(r.split(/\s+/).filter(Boolean))],i=new Set(
|
|
326
|
+
`)}var ii=!1,wf=!1,hn=!1;function si(e){return e.getActiveTools().map(n=>typeof n=="string"?n:n.name)}function mi(){return ii}function qv(e){return si(e).includes(ir)}function ja(e){return mi()!==qv(e)}function jv(e){wf||(kf(e),wf=!0)}function Fv(e,t){let n=si(e);if(t){if(n.length===0){hn=!0;return}let r=new Set(n);r.add(ir),r.size!==n.length&&e.setActiveTools([...r])}else{let r=n.filter(a=>a!==ir);r.length!==n.length&&e.setActiveTools(r)}hn=ja(e)}function sr(e){let t=mi();t&&jv(e),Fv(e,t)}function pi(e){ii=xn(),hn=!0,Ef(e)}function Ef(e,t=0){let n=mi(),r=si(e);if(n&&r.length===0&&t<8){queueMicrotask(()=>Ef(e,t+1));return}sr(e)}function Rf(e){for(let t of[0,50,150,400])setTimeout(()=>{(hn||ja(e))&&sr(e)},t)}function Sf(){return hn}function Of(e){ii=xn(),hn=!0,sr(e)}var zv="Ctrl+Shift+X",ci=[{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 Bv(e){let t=e.trimStart(),n=/\s$/.test(t),r=t.trimEnd().split(/\s+/).filter(Boolean),a=n?"":r.at(-1)??"",i=new Set(n?r:r.slice(0,-1)),m=n?t:t.slice(0,t.length-a.length),u=i.has("--config"),l=[...i].some(h=>h!=="--config"),f=ci.filter(h=>!i.has(h.value)&&!u&&!(l&&h.value==="--config")&&h.value.startsWith(a));return f.length?f.map(h=>({...h,value:`${m}${h.value}`})):null}async function ui(e,t,n){let r=Si();if(r.length===0)return e.ui.notify("No enabledModels configured in settings.json.","error"),null;let a=e.modelRegistry.getAll(),i=r.map(f=>{let h=Oi(f);if(!h)return null;let $=a.find(H=>H.provider===h.provider&&H.id===h.modelId),E=t?.provider===h.provider&&t?.modelId===h.modelId,A=$?`${$.name} (${f})`:f;return{ref:f,parsed:h,display:E?`${A} [current]`:A,isCurrent:E}}).filter(f=>f!==null);if(i.length===0)return e.ui.notify("Could not resolve any enabledModels entries.","error"),null;let m=[...i].sort((f,h)=>f.isCurrent===h.isCurrent?0:f.isCurrent?-1:1),u=await e.ui.select(n,m.map(f=>f.display));if(!u)return null;let l=i.find(f=>f.display===u);return l?{provider:l.parsed.provider,modelId:l.parsed.modelId}:null}function gn(e,t,n){let r=e.modelRegistry.getAll().find(a=>a.provider===t&&a.id===n);return wi(r)}var Fa={provider:"",modelId:"",thinkingLevel:"off",timeoutMinutes:za,solverCount:Va,saveArtifacts:Wa},Da={provider:"",modelId:"",thinkingLevel:"off"};function qf(e,t,n,r){let a=t?gn(e,t.provider,t.modelId):["off"],i=n.provider?gn(e,n.provider,n.modelId):["off"],m=r.provider?gn(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:a},{id:"solvergap-model",section:"Solver",label:"Model",value:n.provider?`${n.provider}/${n.modelId}`:"not set",kind:"model"},{id:"solvergap-thinking",section:"Solver",label:"Thinking level",value:n.thinkingLevel,kind:"cycle",values:i},{id:"solvergap-timeout",section:"Solver",label:"Timeout",value:`${n.timeoutMinutes} min`,kind:"cycle",values:[10,20,30,40,50,Ti].filter((u,l,f)=>u>=$i&&f.indexOf(u)===l).map(u=>`${u} min`)},{id:"solvergap-solver-count",section:"Solver",label:"Parallel agents",value:String(n.solverCount),kind:"cycle",values:Array.from({length:ki-Ba+1},(u,l)=>`${Ba+l}`)},{id:"solvergap-save-artifacts",section:"Solver",label:"Save artifacts",value:n.saveArtifacts?"on":"off",kind:"cycle",values:["on","off"]},{id:"analyze-enabled",section:"Analyze Tool",label:"Enabled",value:t?.enableAnalyzeTool?"on":"off",kind:"cycle",values:["on","off"]},{id:"analyze-model",section:"Analyze Tool",label:"Model",value:r.provider?`${r.provider}/${r.modelId}`:"not set",kind:"model"},{id:"analyze-thinking",section:"Analyze Tool",label:"Thinking level",value:r.thinkingLevel,kind:"cycle",values:m}]}var li=class{constructor(t,n,r,a,i,m){this.ctx=t;this.settingsListTheme=n;this.theme=r;this.onCycleSaved=a;this.onActivateModel=i;this.onExit=m;this.rows=qf(t,Ee(),Ee()?.solverGap??Fa,Ee()?.analyzeGap??Da)}selectedIndex=0;rows;refresh(){let t=Ee();this.rows=qf(this.ctx,t,t?.solverGap??Fa,t?.analyzeGap??Da),this.selectedIndex=Math.min(this.selectedIndex,this.rows.length-1)}invalidate(){}render(t){let n=[],r=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&&n.push(""),n.push(this.theme.bold(this.theme.fg("accent",m.section))),a=m.section);let u=i===this.selectedIndex,l=u?this.settingsListTheme.cursor:" ",f=m.label+" ".repeat(Math.max(0,r-m.label.length)),h=this.settingsListTheme.label(f,u),$=this.settingsListTheme.value(m.value,u);n.push(`${l}${h} ${$}`)}return n}handleInput(t){if(Kt(t,_t.ctrl("s"))||Kt(t,_t.escape)||Kt(t,_t.ctrl("c"))){this.onExit();return}if(Kt(t,_t.up)){this.selectedIndex=this.selectedIndex===0?this.rows.length-1:this.selectedIndex-1;return}if(Kt(t,_t.down)){this.selectedIndex=this.selectedIndex===this.rows.length-1?0:this.selectedIndex+1;return}if(Kt(t,_t.enter)||Kt(t,_t.return)||t===" "){let n=this.rows[this.selectedIndex];if(!n)return;if(n.kind==="model"){this.onActivateModel(n.id);return}if(!n.values||n.values.length===0)return;let r=Ee();if(!r){this.ctx.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");return}let a=r.solverGap??Fa,i=r.analyzeGap??Da,m=n.values.indexOf(n.value),u=n.values[(m+1)%n.values.length];if(u===void 0)return;n.id==="reviewer-thinking"?Fe({...r,thinkingLevel:u,solverGap:a,analyzeGap:i}):n.id==="solvergap-thinking"?Fe({...r,solverGap:{...a,thinkingLevel:u}}):n.id==="solvergap-timeout"?Fe({...r,solverGap:{...a,timeoutMinutes:Number.parseInt(u,10)}}):n.id==="solvergap-solver-count"?Fe({...r,solverGap:{...a,solverCount:Number.parseInt(u,10)}}):n.id==="solvergap-save-artifacts"?Fe({...r,solverGap:{...a,saveArtifacts:u==="on"}}):n.id==="analyze-enabled"?Fe({...r,enableAnalyzeTool:u==="on"}):n.id==="analyze-thinking"&&Fe({...r,analyzeGap:{...i,thinkingLevel:u}}),this.refresh(),this.onCycleSaved()}}};async function Vv(e,t){if(t.mode!=="tui"){t.ui.notify("/checks --config requires interactive mode","error");return}let n=0;for(;;){let r=await t.ui.custom((u,l,f,h)=>{let $=new li(t,Uv(),l,()=>{Of(e),u.requestRender()},A=>h(A),()=>h(void 0));$.selectedIndex=n;let E=new _v;return E.addChild(new Lf(l.bold(l.fg("accent","Checks settings")))),E.addChild({render:A=>$.render(A),invalidate:()=>$.invalidate()}),E.addChild(new Kv(1)),E.addChild(new Lf(l.fg("dim","\u2191\u2193 navigate enter select ctrl+s save & exit esc cancel"))),{render(A){return E.render(A)},invalidate(){E.invalidate()},handleInput(A){$.handleInput(A),n=$.selectedIndex,u.requestRender()}}});if(!r)return;let a=Ee(),i=a?.solverGap??Fa,m=a?.analyzeGap??Da;if(r==="reviewer-model"){let u=await ui(t,a,"Select reviewer model");if(!u)continue;let l=gn(t,u.provider,u.modelId),f=l.includes(a?.thinkingLevel??"off")?a?.thinkingLevel??"off":l[0]??"off";Fe({...u,thinkingLevel:f,solverGap:i,analyzeGap:m,enableAnalyzeTool:a?.enableAnalyzeTool}),t.ui.notify(`Reviewer model saved: ${u.provider}/${u.modelId}`,"info");continue}if(r==="solvergap-model"){if(!a){t.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");continue}let u=await ui(t,i.provider?i:null,"Select solver model");if(!u)continue;let l=gn(t,u.provider,u.modelId),f=l.includes(i.thinkingLevel)?i.thinkingLevel:l[0]??"off";Fe({...a,solverGap:{...i,...u,thinkingLevel:f}}),t.ui.notify(`Solver model saved: ${u.provider}/${u.modelId}`,"info");continue}if(r==="analyze-model"){if(!a){t.ui.notify("Set the reviewer model first \u2014 it's required before analyze-tool settings.","warning");continue}let u=await ui(t,m.provider?m:null,"Select analyze tool model");if(!u)continue;let l=gn(t,u.provider,u.modelId),f=l.includes(m.thinkingLevel)?m.thinkingLevel:l[0]??"off";Fe({...a,analyzeGap:{...m,...u,thinkingLevel:f}}),t.ui.notify(`Analyze tool model saved: ${u.provider}/${u.modelId}`,"info")}}}function jf(e){e.registerCommand("checks",{description:"Find behavioral gaps in test coverage. Requires an option \u2014 see /checks.",getArgumentCompletions:Bv,handler:async(t,n)=>{let r=t.trim();if(!r){n.ui.notify(ci.map(N=>`${N.value} \u2014 ${N.description}`).join(`
|
|
327
|
+
`),"info");return}let a=[...new Set(r.split(/\s+/).filter(Boolean))],i=new Set(ci.map(N=>N.value)),m=a.filter(N=>!i.has(N));if(m.length){n.ui.notify(`Unknown option(s): ${m.join(", ")}. Run /checks with no arguments to see options.`,"warning");return}if(a.includes("--config")){a.length>1?n.ui.notify("--config cannot be combined with other options.","warning"):await Vv(e,n);return}let u=a.includes("--gap-finder"),l=a.includes("--solver-gap-finder");if(!u&&!l)return;if(La()){n.ui.notify("A checks run is already in progress.","warning");return}let f=Ee();if(!f){n.ui.notify("No gap-finder model configured. Run /checks --config first.","error");return}let h=n.modelRegistry.find(f.provider,f.modelId);if(!h||!n.modelRegistry.hasConfiguredAuth(h)){n.ui.notify("Configured behavioral gap-finder model is unavailable or unauthenticated. Run /checks --config.","error");return}let $=ai.filter(N=>!Af(et(n.cwd,N)));if($.length){n.ui.notify(`Missing required file(s): ${$.join(", ")}`,"error");return}let E=null,A;if(l){if(E=Ei(),!E||!Af(et(n.cwd,"test.sh"))){n.ui.notify("Configure solver gap finder and provide test.sh before running it.","error");return}if(A=n.modelRegistry.find(E.provider,E.modelId),!A||!n.modelRegistry.hasConfiguredAuth(A)){n.ui.notify("Configured solver gap-finder model is unavailable or unauthenticated.","error");return}}let H=bf(),te=E?.solverCount??0,ne=(u?2:0)+(l?te+1:0);n.ui.setWidget(Et,or("preparing clean snapshot",0,ne)),n.ui.notify(`gap finders (${a.join(" ")}) started. Press ${zv} to cancel.`,"info");let ue,tt=[];try{let N=et(Mf(),`checks-${Pf()}`);Cf(N,{recursive:!0}),ue=N;let nt=await hr(e,n.cwd,N);if(nt.status==="error"){n.ui.notify(`checks: ${nt.error}`,"error");return}for(let qe of ai)Dv(et(n.cwd,qe),et(N,qe));let Ue=Aa(),ct=Ca(),rt=0,lt={status:"ok",gaps:[]},zt={status:"ok",gaps:[]};if(u){let qe={tempDir:N,model:h,thinkingLevel:f.thinkingLevel,testRubric:Ue,fairnessRules:ct,cancelSignal:H.signal};if(n.ui.setWidget(Et,or("finding sentence-by-sentence test gaps",rt,ne)),lt=await Oa(qe),rt+=1,n.ui.setWidget(Et,or("reviewing test gaps",rt,ne)),lt.gaps.reduce((Na,Ua)=>Na+Ua.gaps.length,0)>0&&(zt=await Pa({...qe,statementReports:lt.gaps})),rt+=1,H.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let dt=[],mr={status:"ok",gaps:[]};if(l&&E){let qe=[],Ga=at=>{qe.push(at),rt+=1,n.ui.setWidget(Et,or("solver gap finder: solving",rt,ne,{passed:qe.filter(je=>je.passed).length,failed:qe.filter(je=>!je.passed).length}))},Na=await Promise.all(Array.from({length:te},async(at,je)=>{let yn=et(Mf(),`checks-solvergap-${Pf()}`);return Cf(yn,{recursive:!0}),tt.push(yn),{index:je+1,setup:await Ai({pi:e,repoDir:n.cwd,solverDir:yn,testPatchPath:et(n.cwd,"test.patch"),agentPromptPath:et(n.cwd,"agent_prompt.md")})}})),Ua=oi().replace(/[:.]/g,"-");if(dt=await Promise.all(Na.map(async({index:at,setup:je})=>{if(je.status!=="ok"){let Ii={index:at,status:je.status,passed:!1,diff:"",testOutputTail:je.error,durationMs:0,totalTests:null,failedTests:null};return Ga(Ii),Ii}let yn=Date.now(),{outcome:yi,trajectory:Gf}=await df({pi:e,solverDir:je.solverDir,model:A,thinkingLevel:E.thinkingLevel,timeoutMinutes:E.timeoutMinutes,cancelSignal:H.signal}),{testOutputXmlPath:Nf,..._a}=await Ci({pi:e,index:at,workspace:je,status:yi==="done"?"ok":yi,durationMs:Date.now()-yn}),Uf=E.saveArtifacts?Mi({repoDir:n.cwd,runId:Ua,index:at,trajectory:Gf,solutionPatch:_a.diff,testOutputXmlPath:Nf,testOutputTail:_a.testOutputTail}):void 0,xi={..._a,artifactsDir:Uf};return Ga(xi),xi})),dt.some(at=>at.status!=="patchFailed"&&at.status!=="error")&&(Li(N,dt),mr=await ff({tempDir:N,model:h,thinkingLevel:f.thinkingLevel,solverResults:dt,testRubric:Ue,fairnessRules:ct,cancelSignal:H.signal})),rt+=1,H.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let Df=u&&(lt.status!=="ok"||lt.gaps.length>0&&zt.status!=="ok"),fi=gf({existingReport:hf(et(n.cwd,"shipd_report.json")),config:f,runGapFinder:u,testGaps:zt.gaps,gapAnalysisIncomplete:Df,gapFinderStatus:lt.status,gapFilterStatus:zt.status,runSolverGapFinder:l,solverResults:dt,solverGaps:mr.gaps,solverGapAnalysisIncomplete:l&&(dt.some(qe=>qe.status==="error")||mr.status!=="ok"),solverComparisonStatus:mr.status}),hi=xf({merged:fi,runGapFinder:u,runSolverGapFinder:l});e.sendMessage({customType:"shipd_checks_report",content:hi.content,display:!0,details:hi.details});let gi=et(n.cwd,"shipd_report.json");Nv(gi,JSON.stringify(fi,null,2),"utf-8"),n.ui.notify(`checks: wrote details to ${gi}`,"info")}catch(N){n.ui.notify(`checks failed: ${N instanceof Error?N.message:String(N)}`,"error")}finally{n.ui.setWidget(Et,void 0),ue&&Gv(ue,{recursive:!0,force:!0});for(let N of tt)qi(N);vf()}}})}var Ff=Hv.ctrlShift("x");function Jv(e){e.registerMessageRenderer("shipd_checks_report",(t,n,r)=>{let a=t.details??{},i=new Wv;i.addChild(new di(r.bold(r.fg("accent","Checks")),0,0));let m=!1,u=l=>{i.addChild(new di(l,0,0)),m=!0};if(a.showGaps){let l=a.gapsCount??0;u(l>0?r.fg("warning",` \u26A0 ${l} test gap(s) found`):r.fg("success"," \u2713 no test gaps found"))}if(a.showSolverGaps){let l=a.solverDetails??[],f=l.filter(A=>A.passed).length,h=a.solverGapsCount??0;i.addChild(new Yv(1)),u(r.bold(r.fg("accent","Solver gap finder")));for(let A of l){let H=A.passed?r.fg("success","\u2713"):r.fg("error","\u2717"),te=A.passed?"passed":A.status==="ok"?"failed tests":A.status;u(` ${H} Solver ${A.index}: ${te} (${yf(A.durationMs)})`)}let $=f===l.length&&l.length>0?r.fg("success",`${f}/${l.length} solvers passed`):r.fg("warning",`${f}/${l.length} solvers passed`),E=h>0?r.fg("warning",`${h} behavioral gap(s) found`):r.fg("success","no behavioral gaps found");u(` ${$}, ${E}`)}return m||i.addChild(new di(r.fg("dim"," nothing to report"),0,0)),i}),e.registerShortcut(Ff,{description:"Cancel an in-progress /checks run",handler:t=>{La()&&$f()&&(t.ui.setWidget(Et,[`checks: cancelling (${Ff})...`]),t.ui.notify("checks: cancelling...","warning"))}}),Zv(e),jf(e)}function Zv(e){e.on("session_start",(t,n)=>{pi(e),(t.reason==="resume"||t.reason==="reload"||t.reason==="startup")&&Rf(e)}),e.on("session_tree",()=>{pi(e)}),e.on("before_agent_start",()=>{!Sf()&&!ja(e)||sr(e)})}export{Jv 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.24",
|
|
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",
|