@sreetej510/pi-shipd-checks 0.1.21 → 0.1.23

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.
Files changed (3) hide show
  1. package/README.md +4 -2
  2. package/dist/index.js +21 -17
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -52,16 +52,18 @@ The two finder flags are additive/combinable; `--config` must be used alone.
52
52
 
53
53
  ## Configuration
54
54
 
55
- `/checks --config` opens the row-based settings menu with two sections:
55
+ `/checks --config` opens the row-based settings menu with three sections:
56
56
 
57
57
  - **Reviewer**: model and thinking level used by the behavioral gap finders, validator, and
58
58
  solver-solution comparison agent.
59
59
  - **Solver**: model and thinking level for TDD solver agents, plus their timeout, parallel solver
60
60
  count, and artifact-saving setting.
61
+ - **Analyze Tool**: enable/disable the agent-callable `analyze_test_gaps` tool (off by default,
62
+ like HPC tools) and pick the model + thinking level for its finder/reviewer agents.
61
63
 
62
64
  Use ↑/↓ to select a row and Enter/Space to change it. The currently selected model is shown first
63
65
  in its picker. Settings are saved to `~/.pi/agent/checks-config.json`; solver settings are nested
64
- under `solverGap`.
66
+ under `solverGap` and analyze-tool settings under `analyzeGap`.
65
67
 
66
68
  ## Install
67
69
 
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
- var Tf=Object.defineProperty;var Rt=(e,t)=>{for(var n in t)Tf(e,n,{get:t[n],enumerable:!0})};import{Container as hv,Key as gv,Spacer as yv,Text as Xo}from"@earendil-works/pi-tui";import{randomUUID as uf}from"node:crypto";import{copyFileSync as iv,existsSync as cf,mkdirSync as lf,rmSync as sv,writeFileSync as mv}from"node:fs";import{tmpdir as df}from"node:os";import{join as Ze}from"node:path";import{getSettingsListTheme as pv}from"@earendil-works/pi-coding-agent";import{Container as uv,Key as Kt,matchesKey as _t,Spacer as cv,Text as ff}from"@earendil-works/pi-tui";import{createAgentSession as ba,SessionManager as va}from"@earendil-works/pi-coding-agent";import{copyFileSync as Of,existsSync as Fa,lstatSync as Pf,mkdirSync as Da,readFileSync as cr,rmSync as di,symlinkSync as Cf,unlinkSync as Mf,writeFileSync as rt}from"node:fs";import{join as ce}from"node:path";import{existsSync as ir,mkdirSync as kf,readFileSync as Ma,writeFileSync as wf}from"node:fs";import{dirname as Ef,join as ai}from"node:path";import{getAgentDir as oi}from"@earendil-works/pi-coding-agent";var ar=ai(oi(),"checks-config.json"),or=ai(oi(),"settings.json"),ii=10,si=60,Aa=20,La=1,mi=5,qa=3,ja=!0,Rf=["off","minimal","low","medium","high","xhigh","max"];function pi(e){return e?.reasoning?Rf.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t==="xhigh"||t==="max"?n!==void 0:!0}):["off"]}function lt(){try{if(!ir(ar))return null;let e=JSON.parse(Ma(ar,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function dt(e){let t=Ef(ar);ir(t)||kf(t,{recursive:!0}),wf(ar,JSON.stringify(e,null,2),"utf-8")}function ui(){let e=lt()?.solverGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e,timeoutMinutes:e.timeoutMinutes>0?e.timeoutMinutes:Aa,solverCount:e.solverCount>0?e.solverCount:qa,saveArtifacts:typeof e.saveArtifacts=="boolean"?e.saveArtifacts:ja}}function ci(){try{return ir(or)?JSON.parse(Ma(or,"utf-8")).enabledModels??[]:[]}catch{return[]}}function li(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function Sf(){try{if(ir(or))return JSON.parse(Ma(or,"utf-8"))}catch{}return{}}function sr(){let e=Sf().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function mr(e){return e.replace(/\\/g,"/")}function pr(e){return`'${e.replace(/'/g,"'\\''")}'`}async function ur(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 ${pr(mr(n))}`,s=await e.exec(sr(),["-c",a],{cwd:t,timeout:6e4});return s.code!==0?{status:"error",error:s.stderr?.trim()||`git archive failed (exit ${s.code})`}:{status:"ok"}}var Na=3e4,Af=4e3,Lf=".pi/shipd-checks",gn="solver_gap_solutions";function qf(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 jf(e,t){return e.length>t?e.slice(e.length-t):e}async function fi(e){let{pi:t,repoDir:n,solverDir:r,testPatchPath:a,agentPromptPath:s}=e,m=await ur(t,n,r);if(m.status==="error")return{status:"error",solverDir:r,error:m.error};let c={cwd:r,timeout:Na},l=await t.exec("git",["init"],c);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"],c),await t.exec("git",["config","user.name","shipd-checks solver-gap-finder"],c);let h=await t.exec("git",["add","-A"],c);if(h.code!==0)return{status:"error",solverDir:r,error:h.stderr?.trim()||"git add (baseline) failed"};let f=await t.exec("git",["commit","-m","baseline","--allow-empty"],c);if(f.code!==0)return{status:"error",solverDir:r,error:f.stderr?.trim()||"git commit (baseline) failed"};let w=ce(r,".gitignore"),D=Fa(w)?cr(w,"utf-8"):"";if(!D.split(/\r?\n/).some(pt=>pt.trim()==="node_modules")){let pt=D.length>0&&!D.endsWith(`
1
+ var Uf=Object.defineProperty;var Rt=(e,t)=>{for(var n in t)Uf(e,n,{get:t[n],enumerable:!0})};import{Container as Uv,Key as _v,Spacer as Kv,Text as li}from"@earendil-works/pi-tui";import{randomUUID as Of}from"node:crypto";import{copyFileSync as Cv,existsSync as Pf,mkdirSync as Af,rmSync as Mv,writeFileSync as Lv}from"node:fs";import{tmpdir as Cf}from"node:os";import{join as et}from"node:path";import{getSettingsListTheme as qv}from"@earendil-works/pi-coding-agent";import{Container as jv,Key as _t,matchesKey as Kt,Spacer as Fv,Text as Mf}from"@earendil-works/pi-tui";import{createAgentSession as Ea,SessionManager as Ra}from"@earendil-works/pi-coding-agent";import{copyFileSync as Hf,existsSync as Ha,lstatSync as Yf,mkdirSync as Ya,readFileSync as yr,rmSync as Oi,symlinkSync as Jf,unlinkSync as Xf,writeFileSync as ot}from"node:fs";import{join as le}from"node:path";import{existsSync as lr,mkdirSync as _f,readFileSync as Ka,writeFileSync as Kf}from"node:fs";import{dirname as zf,join as Ii}from"node:path";import{getAgentDir as bi}from"@earendil-works/pi-coding-agent";var ur=Ii(bi(),"checks-config.json"),cr=Ii(bi(),"settings.json"),vi=10,$i=60,za=20,Ba=1,Ti=5,Va=3,Wa=!0,Bf=!1,Vf=["off","minimal","low","medium","high","xhigh","max"];function ki(e){return e?.reasoning?Vf.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t==="xhigh"||t==="max"?n!==void 0:!0}):["off"]}function we(){try{if(!lr(ur))return null;let e=JSON.parse(Ka(ur,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function Fe(e){let t=zf(ur);lr(t)||_f(t,{recursive:!0}),Kf(ur,JSON.stringify(e,null,2),"utf-8")}function wi(){let e=we()?.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 we()?.enableAnalyzeTool??Bf}function Ei(){let e=we()?.analyzeGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e}}function Ri(){try{return lr(cr)?JSON.parse(Ka(cr,"utf-8")).enabledModels??[]:[]}catch{return[]}}function Si(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function Wf(){try{if(lr(cr))return JSON.parse(Ka(cr,"utf-8"))}catch{}return{}}function dr(){let e=Wf().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function fr(e){return e.replace(/\\/g,"/")}function hr(e){return`'${e.replace(/'/g,"'\\''")}'`}async function gr(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 ${hr(fr(n))}`,i=await e.exec(dr(),["-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,Zf=4e3,Qf=".pi/shipd-checks",In="solver_gap_solutions";function eh(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 th(e,t){return e.length>t?e.slice(e.length-t):e}async function Pi(e){let{pi:t,repoDir:n,solverDir:r,testPatchPath:a,agentPromptPath:i}=e,m=await gr(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 $=le(r,".gitignore"),P=Ha($)?yr($,"utf-8"):"";if(!P.split(/\r?\n/).some(ct=>ct.trim()==="node_modules")){let ct=P.length>0&&!P.endsWith(`
2
2
  `)?`
3
- `:"";rt(w,`${D}${pt}node_modules
4
- `,"utf-8")}let _=ce(n,"node_modules"),ue=ce(r,"node_modules");if(Fa(_)&&!Fa(ue))try{Cf(_,ue,process.platform==="win32"?"junction":"dir")}catch{}try{Of(s,ce(r,"agent_prompt.md"))}catch{}let Me=cr(a,"utf-8"),Re=qf(Me),De=ce(r,"test.patch");rt(De,Me,"utf-8");let Qe=await t.exec("git",["apply","test.patch"],c);try{Mf(De)}catch{}if(Qe.code!==0)return{status:"patchFailed",solverDir:r,error:Qe.stderr?.trim()||"git apply test.patch failed"};let N=await t.exec("git",["add","-A"],c);if(N.code!==0)return{status:"error",solverDir:r,error:N.stderr?.trim()||"git add (tests applied) failed"};let et=await t.exec("git",["commit","-m","tests applied","--allow-empty"],c);if(et.code!==0)return{status:"error",solverDir:r,error:et.stderr?.trim()||"git commit (tests applied) failed"};let Ne=await t.exec("git",["rev-parse","HEAD"],c);return Ne.code!==0||!Ne.stdout.trim()?{status:"error",solverDir:r,error:"Could not resolve tests-applied commit hash."}:{status:"ok",solverDir:r,testsAppliedCommit:Ne.stdout.trim(),testPatchPaths:Re}}function Ff(e){try{let t=cr(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"),s=n("errors");return{totalTests:Number.isFinite(r)?r:null,failedTests:Number.isFinite(a)?a+(Number.isFinite(s)?s:0):null}}catch{return{totalTests:null,failedTests:null}}}async function hi(e){let{pi:t,index:n,workspace:r,status:a,durationMs:s}=e,{solverDir:m,testsAppliedCommit:c,testPatchPaths:l}=r,h={cwd:m,timeout:Na};await t.exec("git",["add","-A"],h);let f=[...l,"agent_prompt.md"].map(Ne=>`:(exclude)${Ne}`),w=await t.exec("git",["diff","--cached",c,"--",".",...f],h),D=w.code===0?w.stdout:"",_=ce(m,"test_output.xml"),ue=`bash test.sh --output_path ${pr(mr(_))} new`,Me=sr(),Re=await t.exec(Me,["-c",`cd ${pr(mr(m))} && ${ue}`],{timeout:Na*10}),De=Re.code===0,Qe=jf(`${Re.stdout}
5
- ${Re.stderr}`.trim(),Af),{totalTests:N,failedTests:et}=Ff(_);return{index:n,status:a,passed:De,diff:D,testOutputTail:Qe,durationMs:s,totalTests:N,failedTests:et,testOutputXmlPath:_}}function gi(e){let{repoDir:t,runId:n,index:r,trajectory:a,solutionPatch:s,testOutputXmlPath:m,testOutputTail:c}=e,l=ce(t,Lf,n,`solver_${r}`);Da(l,{recursive:!0}),rt(ce(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),rt(ce(l,"solution.patch"),s,"utf-8");try{let h=cr(m,"utf-8");rt(ce(l,"test_output.xml"),h,"utf-8")}catch{rt(ce(l,"test_output.txt"),c,"utf-8")}return l}function yi(e,t){let n=ce(e,gn);Da(n,{recursive:!0});let r=t.map(a=>{let s=ce(n,`solver_${a.index}`);return Da(s,{recursive:!0}),rt(ce(s,"solution.diff"),a.diff,"utf-8"),rt(ce(s,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return rt(ce(n,"manifest.json"),JSON.stringify(r,null,2),"utf-8"),n}function xi(e){let t=ce(e,"node_modules");try{Pf(t).isSymbolicLink()&&di(t,{force:!0})}catch{}try{di(e,{recursive:!0,force:!0})}catch{}}var p={};Rt(p,{Assign:()=>Df,Clone:()=>bn,Create:()=>zh,Discard:()=>Bh,Metrics:()=>qe,Update:()=>Vh});var qe={assign:0,create:0,clone:0,discard:0,update:0};function Df(e,t){return qe.assign+=1,{...e,...t}}var i={};Rt(i,{Entries:()=>oh,EntriesRegExp:()=>ah,Every:()=>th,EveryAll:()=>nh,GraphemeCount:()=>Zf,HasPropertyKey:()=>rh,IsArray:()=>xn,IsBigInt:()=>yn,IsBoolean:()=>Ri,IsClassInstance:()=>Jf,IsConstructor:()=>zf,IsDeepEqual:()=>_a,IsEqual:()=>C,IsFunction:()=>Si,IsGreaterEqualThan:()=>Pi,IsGreaterThan:()=>Wf,IsInteger:()=>Ua,IsLessEqualThan:()=>Oi,IsLessThan:()=>Hf,IsMaxLength:()=>Qf,IsMinLength:()=>eh,IsMultipleOf:()=>Yf,IsNull:()=>fr,IsNumber:()=>hr,IsObject:()=>In,IsObjectNotArray:()=>Bf,IsString:()=>gr,IsSymbol:()=>Vf,IsUndefined:()=>Ka,IsUnsafePropertyKey:()=>Ci,IsValueLike:()=>Xf,Keys:()=>dr,ShiftLeft:()=>yr,Symbols:()=>ih,Values:()=>sh});function St(e,t,n){return e>=t&&e<=n}function Nf(e){return e===8205}function Gf(e){return St(e,55296,56319)}function Ii(e){return St(e,127462,127487)}function vi(e){return St(e,65024,65039)}function $i(e){return St(e,768,879)||St(e,6832,6911)||St(e,7616,7679)||St(e,65056,65071)}function lr(e){return e>65535?2:1}function bi(e,t){for(;t<e.length;){let n=e.codePointAt(t);if($i(n)||vi(n))t+=lr(n);else break}return t}function Ga(e,t){let n=e.codePointAt(t),r=t+lr(n);for(r=bi(e,r);r<e.length-1&&e[r]==="\u200D";){let a=e.codePointAt(r+1);r+=1+lr(a),r=bi(e,r)}return Ii(n)&&r<e.length&&Ii(e.codePointAt(r))&&(r+=lr(e.codePointAt(r))),r}function Ti(e){return Gf(e)||$i(e)||vi(e)||Nf(e)}function ki(e){let t=0,n=0;for(;n<e.length;)n=Ga(e,n),t++;return t}function Uf(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=Ga(e,r),n++,n>=t)return!0;return!1}function Kf(e,t){let n=0,r=0;for(;r<e.length;)if(r=Ga(e,r),n++,n>t)return!1;return!0}function wi(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Ti(e.charCodeAt(n)))return Uf(e,t);if(n++,n>=t)return!0}return!1}function Ei(e,t){let n=0;for(;n<e.length;){if(Ti(e.charCodeAt(n)))return Kf(e,t);if(n++,n>t)return!1}return!0}function xn(e){return Array.isArray(e)}function yn(e){return C(typeof e,"bigint")}function Ri(e){return C(typeof e,"boolean")}function zf(e){if(Ka(e)||!Si(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Si(e){return C(typeof e,"function")}function Ua(e){return Number.isInteger(e)}function fr(e){return C(e,null)}function hr(e){return Number.isFinite(e)}function Bf(e){return In(e)&&!xn(e)}function In(e){return C(typeof e,"object")&&!fr(e)}function gr(e){return C(typeof e,"string")}function Vf(e){return C(typeof e,"symbol")}function Ka(e){return C(e,void 0)}function C(e,t){return e===t}function Wf(e,t){return e>t}function Hf(e,t){return e<t}function Oi(e,t){return e<=t}function Pi(e,t){return e>=t}function Yf(e,t){if(yn(e)||yn(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!hr(e)||Ua(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 Jf(e){if(!In(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return fr(t)?!1:C(typeof t.constructor,"function")&&!(C(t.constructor,globalThis.Object)||C(t.constructor.name,"Object"))}function Xf(e){return yn(e)||Ri(e)||fr(e)||hr(e)||gr(e)||Ka(e)}function Zf(e){return ki(e)}function Qf(e,t){return Ei(e,t)}function eh(e,t){return wi(e,t)}function th(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function nh(e,t,n){let r=!0;for(let a=t;a<e.length;a++)n(e[a],a)||(r=!1);return r}function yr(e,t,n){return C(e.length,0)?n():t(e[0],e.slice(1))}function Ci(e){return C(e,"__proto__")||C(e,"constructor")||C(e,"prototype")}function rh(e,t){return Ci(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ah(e){return dr(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function oh(e){return Object.entries(e)}function dr(e){return Object.getOwnPropertyNames(e)}function ih(e){return Object.getOwnPropertySymbols(e)}function sh(e){return Object.values(e)}function mh(e,t){if(!In(t))return!1;let n=dr(e);return C(n.length,dr(t).length)&&n.every(r=>_a(e[r],t[r]))}function ph(e,t){return xn(t)&&C(e.length,t.length)&&e.every((n,r)=>_a(e[r],t[r]))}function _a(e,t){return xn(e)?ph(e,t):In(e)?mh(e,t):C(e,t)}var ft={};Rt(ft,{IsBigInt64Array:()=>kh,IsBigUint64Array:()=>wh,IsBoolean:()=>ch,IsDate:()=>Rh,IsFloat32Array:()=>$h,IsFloat64Array:()=>Th,IsInt16Array:()=>xh,IsInt32Array:()=>bh,IsInt8Array:()=>hh,IsMap:()=>Oh,IsNumber:()=>lh,IsRegExp:()=>Eh,IsSet:()=>Sh,IsString:()=>dh,IsTypeArray:()=>fh,IsUint16Array:()=>Ih,IsUint32Array:()=>vh,IsUint8Array:()=>gh,IsUint8ClampedArray:()=>yh});function ch(e){return e instanceof Boolean}function lh(e){return e instanceof Number}function dh(e){return e instanceof String}function fh(e){return globalThis.ArrayBuffer.isView(e)}function hh(e){return e instanceof globalThis.Int8Array}function gh(e){return e instanceof globalThis.Uint8Array}function yh(e){return e instanceof globalThis.Uint8ClampedArray}function xh(e){return e instanceof globalThis.Int16Array}function Ih(e){return e instanceof globalThis.Uint16Array}function bh(e){return e instanceof globalThis.Int32Array}function vh(e){return e instanceof globalThis.Uint32Array}function $h(e){return e instanceof globalThis.Float32Array}function Th(e){return e instanceof globalThis.Float64Array}function kh(e){return e instanceof globalThis.BigInt64Array}function wh(e){return e instanceof globalThis.BigUint64Array}function Eh(e){return e instanceof globalThis.RegExp}function Rh(e){return e instanceof globalThis.Date}function Sh(e){return e instanceof globalThis.Set}function Oh(e){return e instanceof globalThis.Map}function Ch(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function Mh(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let r of Object.keys(n)){if(i.IsUnsafePropertyKey(r))continue;let a=n[r];i.HasPropertyKey(a,"value")&&Object.defineProperty(t,r,{...a,value:Ot(a.value)})}return t}function Ah(e){let t={};for(let n of i.Keys(e))i.IsUnsafePropertyKey(n)||(t[n]=Ot(e[n]));for(let n of i.Symbols(e))t[n]=Ot(e[n]);return t}function Lh(e){return i.IsClassInstance(e)?e:Ch(e)?Mh(e):Ah(e)}function qh(e){return e.map(t=>Ot(t))}function jh(e){return e.slice()}function Fh(e){return new RegExp(e.source,e.flags)}function Dh(e){return new Map(Ot([...e.entries()]))}function Nh(e){return new Set(Ot([...e.values()]))}function Ot(e){return ft.IsTypeArray(e)?jh(e):ft.IsRegExp(e)?Fh(e):ft.IsMap(e)?Dh(e):ft.IsSet(e)?Nh(e):i.IsArray(e)?qh(e):i.IsObject(e)?Lh(e):e}function bn(e){return qe.clone+=1,Ot(e)}var Pt={};Rt(Pt,{Get:()=>Kh,Reset:()=>Gh,Set:()=>Uh});var at={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Gh(){at.immutableTypes=!1,at.maxErrors=8,at.useAcceleration=!0,at.exactOptionalPropertyTypes=!1,at.enumerableKind=!1,at.correctiveParse=!1,at.unionPrioritySort=!0}function Uh(e){for(let t of i.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(at,t,{value:n})}}function Kh(){return at}function _h(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 Mi(e,t){return{...e,...t}}function zh(e,t,n={}){qe.create+=1;let r=Pt.Get(),a=Mi(t,n),s=r.enumerableKind?Mi(a,e):_h(a,e);return r.immutableTypes?Object.freeze(s):s}function Bh(e,t){qe.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(bn(e)),a=new Set(t);for(let s of Object.keys(r))a.has(s)||Object.defineProperty(n,s,r[s]);return n}function Vh(e,t,n){qe.update+=1;let r=Pt.Get(),a=bn(e);for(let s of Object.keys(t))Object.defineProperty(a,s,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[s]});for(let s of Object.keys(n))Object.defineProperty(a,s,{configurable:!0,enumerable:!0,writable:!0,value:n[s]});return a}function y(e,t){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],t)}function ee(e){return i.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 Wh(e){return p.Update(e,{"~readonly":!0},{})}function vn(e,t){return p.Update(Wh(e),{},t)}function Ai(e,t,n,r){let a=d(e,t,n);return vn(a,r)}function Hh(e){return p.Update(e,{"~optional":!0},{})}function $n(e,t){return p.Update(Hh(e),{},t)}function Li(e,t,n,r){let a=d(e,t,n);return $n(a,r)}function Te(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function K(e){return y(e,"Array")}function xr(e){return p.Discard(e,["~kind","type","items"])}function Ge(e,t,n={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function ne(e){return y(e,"Constructor")}function qi(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ue(e,t,n={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function re(e){return y(e,"Function")}function ji(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function ot(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function ae(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 Fi="(?!)";function q(e){return p.Create({"~kind":"Never"},{not:{}},e)}function yt(e){return y(e,"Never")}function Ke(e,t={}){return I("AddOptional",[e],t)}function Ct(e,t={}){return $n(e,t)}function Di(e){return Ct(e)}function le(e){return ee(e)&&i.HasPropertyKey(e,"~optional")}function Ni(e){return i.Keys(e).filter(t=>!le(e[t]))}function Ir(e){return i.Keys(e)}function br(e){return i.Values(e)}function v(e,t={}){let n=Ni(e),r=n.length>0?{required:n}:{};return p.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function M(e){return y(e,"Object")}function Gi(e){return p.Discard(e,["~kind","type","properties","required"])}function oe(e){return p.Create({"~kind":"Unknown"},{},e)}function te(e){return y(e,"Unknown")}function _e(e,t,n){let r=i.Keys(e).reduce((a,s)=>({...a,[s]:p.Update(e[s],{},{$id:s})}),{});return p.Create({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function se(e){return y(e,"Cyclic")}function Ui(e){return p.Update(e,{"~unsafe":null},{})}function vr(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var ze={};Rt(ze,{Match:()=>Yh});function Yh(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Tn(...e){let[t,n]=ze.Match(e,{2:(r,a)=>[r,a,a],1:r=>[r,oe(),oe()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function H(e){return y(e,"Infer")}function Mt(e,t,n,r={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function V(e){return y(e,"Dependent")}function Ki(e){return p.Discard(e,["~kind","if","then","else"])}function _i(e){return i.IsObjectNotArray(e)}function zi(e){return i.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function Bi(e){return i.IsString(e)||i.IsNumber(e)}function Vi(e,t){let n=_i(e)?zi(e):e;return p.Create({"~kind":"Enum"},{enum:n},t)}function fe(e){return y(e,"Enum")}function de(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function S(e){return y(e,"Intersect")}function Wi(e){return p.Discard(e,["~kind","allOf"])}function Y(){throw new Error("Unreachable")}var Hi;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(Hi||(Hi={}));var qT=BigInt("14695981039346656037"),[jT,FT]=[BigInt("1099511628211"),BigInt("18446744073709551616")],DT=Array.from({length:256}).map((e,t)=>BigInt(t)),Yi=new Float64Array(1),NT=new DataView(Yi.buffer),GT=new Uint8Array(Yi.buffer);var UT=new TextEncoder;var kn=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=$r(n)?m=>this.decode(n["~codec"].decode(m)):this.decode,a=$r(n)?m=>n["~codec"].encode(t(m)):t,s={decode:r,encode:a};return p.Update(this.type,{"~codec":s},{})}},wn=class{constructor(t){this.type=t}Decode(t){return new kn(this.type,t)}};function Tr(e){return new wn(e)}function Xi(e,t){return Tr(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Zi(e,t){return Tr(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function $r(e){return ee(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function Qi(e){return Wt(e)}function At(e){return ee(e)&&i.HasPropertyKey(e,"~immutable")}function Be(e,t={}){return I("AddReadonly",[e],t)}function Lt(e,t={}){return vn(e,t)}function es(e){return Lt(e)}function qt(e){return ee(e)&&i.HasPropertyKey(e,"~readonly")}function Qh(e,t){let n=za(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":n},{})}function ts(...e){let[t,n,r]=ze.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return Qh(t,{check:n,error:r})}function eg(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function za(e){return ee(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>eg(t))}var ns="-?(?:0|[1-9][0-9]*)n";function En(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function Ve(e){return y(e,"BigInt")}function kr(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Se(e){return y(e,"Boolean")}function Rn(e){return p.Create({"~kind":"Identifier"},{name:e})}function rs(e){return y(e,"Identifier")}var wr="-?(?:0|[1-9][0-9]*)";function jt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function he(e){return y(e,"Integer")}var Ba=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function tg(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new Ba(e)})()}function O(e,t){return p.Create({"~kind":"Literal"},{type:tg(e),const:e},t)}function Er(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function as(e){return A(e)&&i.IsNumber(e.const)}function os(e){return A(e)&&i.IsString(e.const)}function A(e){return y(e,"Literal")}function Ht(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Yt(e){return y(e,"Null")}var Rr="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function be(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function X(e){return y(e,"Number")}function Jt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function xt(e){return y(e,"Symbol")}function Ft(...e){let[t,n,r]=ze.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,s],1:a=>[a,oe(),oe()]});return p.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function is(e){return y(e,"Parameter")}var Sr=".*";function Oe(e){return p.Create({"~kind":"String"},{type:"string"},e)}function ge(e){return y(e,"String")}function k(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return y(e,"Union")}function ss(e){return p.Discard(e,["~kind","anyOf"])}function Sn(e){let t=ms(e);return i.IsEqual(t.length,2)?t[0]:[]}function ng(e){return!0}function ps(e){return i.ShiftLeft(e,(t,n)=>rg(t)?ps(n):!1,()=>!0)}function us(e){return i.IsEqual(e.length,0)?!1:ps(e)}function rg(e){return x(e)?us(e.anyOf):A(e)?ng(e.const):!1}function Or(e){return us(e)}function Pr(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function cs(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>cs(a,t,[...n,`${r}${t}`]),()=>n)}function ag(e,t){return i.IsEqual(e.length,0)?[`${t}`]:cs(e,t)}function ls(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>ls(e,a,[...n,...ds(e,r)]),()=>n)}function ds(e,t){return x(t)?ls(e,t.anyOf):A(t)?ag(e,t.const):Y()}function fs(e,t){return i.ShiftLeft(t,(n,r)=>fs(ds(e,n),r),()=>e)}function og(e){return e.map(t=>O(t))}function ig(e){let t=fs([],e),n=og(t);return k(n)}function sg(e){return i.IsEqual(e.length,0)?Y():i.IsEqual(e.length,1)&&A(e[0])?e[0]:ig(e)}function Va(e){let t=Sn(e);return i.IsEqual(t.length,0)?Oe():Or(t)?sg(t):Pr(e)}function hs(e){let t=Va(e);return Z(t)?Oe():t}function xe(e,t){let n="object",r={[e]:t};return p.Create({"~kind":"Record"},{type:n,patternProperties:r})}function gs(e){return xe(je,e)}function ys(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 j(e){return y(e,"Tuple")}function xs(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function mg(e){return p.Discard(e,["~readonly"])}function Wa(e,t){return p.Update(mg(e),{},t)}function Is(e,t,n,r){let a=d(e,t,n);return Wa(a,r)}function bs(e,t={}){return I("RemoveReadonly",[e],t)}function vs(e,t={}){return Wa(e,t)}function pg(e){return p.Discard(e,["~optional"])}function Ha(e,t){return p.Update(pg(e),{},t)}function $s(e,t,n,r){let a=d(e,t,n);return Ha(a,r)}function Ts(e,t={}){return I("RemoveOptional",[e],t)}function Cr(e,t={}){return Ha(e,t)}function Ya(e){return e.reduceRight((n,r,a)=>({[a]:r,...n}),{})}function ks(e){let t=Ya(e.items);return v(t)}function ug(e,t){return qt(e)?!!qt(t):!1}function cg(e,t){return le(e)?!!le(t):!1}function lg(e,t){let n=ug(e,t),r=cg(e,t),a=z([e,t]),s=vs(Cr(a));return n&&r?Lt(Ct(s)):n&&!r?Lt(s):!n&&r?Ct(s):s}function dg(e,t,n){return n in e?n in t?lg(e[n],t[n]):e[n]:n in t?t[n]:q()}function fg(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((r,a)=>({...r,[a]:dg(e,t,a)}),{})}function ws(e){return M(e)?e.properties:j(e)?Ya(e.items):Y()}function Es(e,t){let n=ws(e),r=ws(t),a=fg(n,r);return v(a)}function Rs(e,t){let n=Xt(e,t);return i.IsEqual(n,Pn)?e:i.IsEqual(n,Cn)||i.IsEqual(n,On)?t:q()}function Ss(e){return M(e)||j(e)}function hg(e,t){let n=x(e),r=x(t);return n||r}function gg(e,t){let n=Pe(e),r=Pe(t),a=hg(n,r),s=Ss(n),m=Ss(r);return a?z([n,r]):s&&m?Es(n,r):s&&!m?n:!s&&m?r:Rs(n,r)}function Os(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>Os(e,a,[...n,gg(e,r)]),()=>i.IsEqual(n.length,0)?[e]:n)}function Ps(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>Ps(a,t,[...n,...Mn([r],t)]),()=>n)}function Mn(e,t=[]){return i.ShiftLeft(e,(n,r)=>x(n)?Mn(r,Ps(n.anyOf,t)):Mn(r,Os(n,t)),()=>t)}function yg(e,t){let n=me({},e,t);return b.IsExtendsTrueLike(n)?[]:[e]}function xg(e,t){return e.reduce((n,r)=>[...n,...yg(r,t)],[])}function Mr(e,t){let n=Pe(e),r=x(n)?n.anyOf:[n],a=xg(r,t);return ve(a)}function Fe(e,t,n){let r=de([e,t]),a=Mr(n,e);return ve([r,a])}function ke(e){let t=e.map(n=>O(n));return ve(t)}function z(e){let t=Mn(e),n=Ja(t);return it(n)}function Ie(e){let t=hs(e);return Pe(t)}function ve(e){let t=Ja(e);return it(t)}function Pe(e){return V(e)?Fe(e.if,e.then,e.else):fe(e)?ke(e.enum):S(e)?z(e.allOf):Z(e)?Ie(e.pattern):x(e)?ve(e.anyOf):e}function it(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?q():k(e)}function Cs(e,t){let n=ke(e);return It(n,t)}function Ms(e,t){return xe(bt,t)}function As(e,t){let n=z(e);return It(n,t)}function Ls(e,t){return i.IsString(e)||i.IsNumber(e)?v({[e]:t}):i.IsEqual(e,!1)?v({false:t}):i.IsEqual(e,!0)?v({true:t}):v({})}function qs(e,t){return xe(Zt,t)}function js(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?xe(e.pattern.toString(),t):xe(je,t)}function Fs(e,t){let n=Sn(e);return Or(n)?It(Ie(e),t):xe(e,t)}function Ig(e){return x(e)?An(e.anyOf):[e]}function An(e){return e.reduce((t,n)=>[...t,...Ig(n)],[])}function bg(e){return e.some(t=>ge(t)||X(t)||he(t))}function vg(e,t){return i.IsEqual(bg(e),!0)?xe(je,t):void 0}function $g(e,t){return e.reduce((n,r)=>A(r)&&(i.IsString(r.const)||i.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function Tg(e,t){let n=$g(e,t);return v(n)}function Ds(e,t){let n=An(e),r=vg(n,t);return ee(r)?r:Tg(n,t)}function It(e,t){return J(e)?gs(t):Se(e)?ys(t):fe(e)?Cs(e.enum,t):he(e)?Ms(e,t):S(e)?As(e.allOf,t):A(e)?Ls(e.const,t):X(e)?qs(e,t):x(e)?Ds(e.anyOf,t):ge(e)?js(e,t):Z(e)?Fs(e.pattern,t):v({})}function Xa(e,t,n){return T([e])?p.Update(It(e,t),{},n):Ar(e,t,n)}function Ns(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Xa(s,m,a)}var bt=`^${wr}$`,Zt=`^${Rr}$`,je=`^${Sr}$`;function Ar(e,t,n={}){return I("Record",[e,t],n)}function Lr(e,t,n={}){return Xa(e,t,n)}function Gs(e,t){return xe(e,t)}function qr(e){return i.IsEqual(e,je)?Oe():i.IsEqual(e,bt)?jt():i.IsEqual(e,Zt)?be():Va(e)}function Ce(e){return i.Keys(e.patternProperties)[0]}function Qt(e){let t=Ce(e);return qr(t)}function ye(e){return e.patternProperties[Ce(e)]}function pe(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 jr(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function Fr(e){return y(e,"This")}function en(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function tn(e){return y(e,"Undefined")}function Dr(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function We(e){return y(e,"Void")}function wg(e,t){return i.IsEqual(e,"Array")?Te(t[0]):i.IsEqual(e,"Capitalize")?Gr(t[0]):i.IsEqual(e,"ConstructorParameters")?Br(t[0]):i.IsEqual(e,"Evaluate")?Kp(t[0]):i.IsEqual(e,"Exclude")?Vr(t[0],t[1]):i.IsEqual(e,"Extract")?Wr(t[0],t[1]):i.IsEqual(e,"Index")?Fn(t[0],t[1]):i.IsEqual(e,"InstanceType")?Hr(t[0]):i.IsEqual(e,"Lowercase")?Ur(t[0]):i.IsEqual(e,"NonNullable")?Yr(t[0]):i.IsEqual(e,"Omit")?Jr(t[0],t[1]):i.IsEqual(e,"Parameters")?Xr(t[0]):i.IsEqual(e,"Partial")?Zr(t[0]):i.IsEqual(e,"Pick")?Qr(t[0],t[1]):i.IsEqual(e,"Readonly")?ea(t[0]):i.IsEqual(e,"KeyOf")?Dn(t[0]):i.IsEqual(e,"Record")?Ar(t[0],t[1]):i.IsEqual(e,"Required")?ta(t[0]):i.IsEqual(e,"ReturnType")?na(t[0]):i.IsEqual(e,"Uncapitalize")?Kr(t[0]):i.IsEqual(e,"Uppercase")?_r(t[0]):jn(ot(e),t)}function Nt(){throw Error("Unreachable")}var Eg=(e,t=[])=>e.reduce((n,r)=>i.IsArray(r)&&i.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),st=e=>{let[t,n]=e;return Eg([...t,...n])};function Bs(e){return Ft(e[0],e[2],e[4])}function Vs(e){return Ft(e[0],e[2],e[2])}function Ws(e){return Ft(e[0],oe(),e[2])}function Hs(e){return Ft(e,oe(),oe())}function Ys(e){return st(e)}function Js(e){return e[1]}function Xs(e){return st(e)}function Zs(e){return e[1]}function Qs(e){return wg(e[0],e[1])}function em(e){return null}function tm(e){return Oe()}function nm(e){return be()}function rm(e){return kr()}function am(e){return en()}function om(e){return Ht()}function im(e){return jt()}function sm(e){return En()}function mm(e){return oe()}function pm(e){return Vt()}function um(e){return v({})}function cm(e){return q()}function lm(e){return Jt()}function dm(e){return Dr()}function fm(e){return jr()}function hm(e){return O(BigInt(e))}function gm(e){return O(i.IsEqual(e,"true"))}function ym(e){return O(parseFloat(e))}function xm(e){return O(e)}function Im(e){return e[1]}function bm(e){return O(e)}function vm(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function $m(e){return e[1]}function Tm(e){return Nr(e)}function km(e){return i.IsEqual(e.length,6)?Mt(e[1],e[3],e[5]):Mt(e[1],e[3],oe())}function wm(e){return e.length>0}function Em(e){return e.reduce((t,n)=>i.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function Rm(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Sm(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function Om(e){return i.IsEqual(e.length,2)?e[1]:[]}function Us(e,t){return t.reduce((n,r)=>{let a=r;return i.IsEqual(a.length,1)?Fn(n,a[0]):i.IsEqual(a.length,0)?Te(n):Nt()},e)}function Ks(e,t){return i.IsEqual(t.length,3)?zr(e,t[0],t[1],t[2]):e}function Rg(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:ra(e,t)}function Pm(e){let[t,n,r,a,s]=e;return Rg(Ks(t?Dn(Us(n,r)):Us(n,r),a),s)}function Za(e,t){return i.IsEqual(t.length,3)?(()=>{let[n,r,a]=t,s=Za(r,a);if(i.IsEqual(n,"&"))return S(s)?de([e,...s.allOf]):de([e,s]);if(i.IsEqual(n,"|"))return x(s)?k([e,...s.anyOf]):k([e,s]);Nt()})():e}function Cm(e){let[t,n]=e;return Za(t,n)}function Mm(e){let[t,n]=e;return Za(t,n)}function Am(e){return Up(e[1])}function Lm(e){return e[1]}function qm(e){return gt(e[0],e[2])}function jm(e){return i.IsEqual(e.length,4)?Tn(e[1],e[3]):i.IsEqual(e.length,2)?Tn(e[1],oe()):Nt()}function Fm(e){return`${e}`}function Dm(e){return he(e[3])?bt:X(e[3])?Zt:xt(e[3])?je:ge(e[3])?je:Nt()}function Nm(e){return e.length>0}function Gm(e){return e.length>0}function Um(e){let[t,n,r,a,s]=e;return{[n]:t&&r?Be(Ke(s)):t&&!r?Be(s):!t&&r?Ke(s):s}}function Km(e){return st(e)}function _m(e){return e.reduce((t,n)=>i.HasPropertyKey(n,bt)||i.HasPropertyKey(n,Zt)||i.HasPropertyKey(n,je)?[t[0],p.Assign(t[1],n)]:[p.Assign(t[0],n),t[1]],[{},{}])}function zm(e){return _m(e[1])}function Bm(e){let[t,n]=e,r=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return v(t,r)}function Vm(e){return i.IsEqual(e.length,5)?Be(Ke(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?Be(e[3]):Ke(e[3]):Nt()}function Wm(e){return Be(Ke(e[1]))}function Hm(e){return Be(e[1])}function Ym(e){return Ke(e[0])}function Jm(e){return i.IsEqual(e.length,2)?Dt(e[1]):i.IsEqual(e.length,1)?e[0]:Nt()}function Xm(e){return st(e)}function Zm(e){return Q(e[1])}function Qm(e){return Be(Ke(e[4]))}function ep(e){return Be(e[3])}function tp(e){return Ke(e[3])}function np(e){return e[2]}function rp(e){return i.IsEqual(e.length,2)?Dt(e[1]):i.IsEqual(e.length,1)?e[0]:Nt()}function ap(e){return st(e)}function op(e){return Ue(e[1],e[4])}function ip(e){return Ge(e[2],e[5])}function _s(e,t){return i.IsEqual(e,"remove")?bs(t):i.IsEqual(e,"add")?Be(t):t}function sp(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function zs(e,t){return i.IsEqual(e,"remove")?Ts(t):i.IsEqual(e,"add")?Ke(t):t}function mp(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function pp(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function up(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?Ln(Rn(e[3]),e[5],e[6][0],_s(e[1],zs(e[8],e[10]))):Ln(Rn(e[3]),e[5],ot(e[3]),_s(e[1],zs(e[8],e[10])))}function cp(e){return ot(e)}function lp(e){return BigInt(e)}function dp(e){return parseFloat(e)}function fp(e){return i.IsEqual(e,"true")}function hp(e){return null}function gp(e){return{[e[0]]:e[2]}}function yp(e){return st(e)}function Sg(e){return e.reduce((t,n)=>p.Assign(t,n),{})}function xp(e){return Sg(e[1])}function Ip(e){return st(e)}function bp(e){return e[1]}function vp(e){return En()}function $p(e){return Oe()}function Tp(e){return be()}function kp(e){return jt()}function wp(e){return q()}function Ep(e){return O(e)}function Rp(e){return k(e[1])}function Sp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Op(e){return[e[0],...e[1]]}function Pp(e){return e[1]}function Cp(e){return st(e)}function Mp(e){return i.IsEqual(e.length,2)?e[1]:[]}function Ap(e){let t=e[2],n=e[3],[r,a]=e[4],s=i.IsEqual(i.Keys(a).length,0)?{}:{patternProperties:a};return{[e[1]]:gt(t,qn(n,r,s))}}function Lp(e){let t=e[2],[n,r]=e[3],a=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:qn(t,n,a)}}function qp(e){return{[e[1]]:gt(e[2],e[4])}}function jp(e){return{[e[1]]:e[3]}}function Fp(e){return null}function Dp(e){return _m(st(e))}function Np(e){return e[1]}function Gp(e){let t=e[0],n=e[1];return _p(p.Assign(t,n[0]))}function Nn(e){return C(e.length,2)}function E(e,t,n){return Nn(e)?t(e[0],e[1]):n()}function Cg(e,t){return C(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function B(e,t){for(let n=0;n<e.length;n++){let r=Cg(e[n],t);if(Nn(r))return r}return[]}function Qa(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var zp=[...Qa(97,122),...Qa(65,90)],eo="0",to=Qa(49,57),nn=[eo,...to],Bp=" ",rn=`
6
- `;var $t="_",aa=".",Vp="$",oa="-";var Wp="//",Hp="/*",Ag="*/";function Yp(e){let t=e.indexOf(Ag);return C(t,-1)?"":e.slice(t+2)}function Jp(e){let t=e.indexOf(rn);return C(t,-1)?"":e.slice(t)}function Lg(e){return e.replace(/^[ \t\r\f\v]+/,"")}function ia(e){let t=Lg(e);return t.startsWith(Hp)?ia(Yp(t.slice(2))):t.startsWith(Wp)?ia(Jp(t.slice(2))):t}function ie(e){let t=e.trimStart();return t.startsWith(Hp)?ie(Yp(t.slice(2))):t.startsWith(Wp)?ie(Jp(t.slice(2))):t}function sa(e,t){return E(B([e],t),(n,r)=>[n,r],()=>["",t])}function qg(e,t){return e.includes(t)}function an(e,t,n,r=""){return E(B(e,n),(a,s)=>qg(t,a)?an(e,t,s,r):an(e,t,s,`${r}${a}`),()=>[r,n])}function jg(e){return B(to,e)}var Fg=[...nn,$t];function Dg(e){return an(Fg,[$t],e)}function Ng(e){return E(B([eo],e),(t,n)=>[t,n],()=>E(jg(e),(t,n)=>E(Dg(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[]))}function ma(e){return Ng(ie(e))}function Gg(e){return sa(oa,e)}function Ug(e){return E(Gg(e),(t,n)=>E(ma(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function Xp(e){return Ug(ie(e))}function Kg(e){return E(Xp(e),(t,n)=>E(B(["n"],n),(r,a)=>[`${t}`,a],()=>[]),()=>[])}function no(e){return Kg(e)}function ro(e,t){return B([e],t)}function u(e,t){return C(e,"")?["",t]:e.startsWith(rn)?ro(e,ia(t)):e.startsWith(Bp)?ro(e,t):ro(e,ie(t))}var Zp=[...zp,$t,Vp];function _g(e){return B(Zp,e)}var zg=[...Zp,...nn];function Qp(e,t=""){return E(B(zg,e),(n,r)=>Qp(r,`${t}${n}`),()=>[t,e])}function Bg(e){return E(_g(e),(t,n)=>E(Qp(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function W(e){return Bg(ie(e))}var Vg=[...nn,$t];function Wg(e){return Nn(B([aa],e))}function eu(e){return E(an(Vg,[$t],e),(t,n)=>C(t,"")?[]:[t,n],()=>[])}function Hg(e){return E(B([aa],e),(t,n)=>E(eu(n),(r,a)=>[`0${t}${r}`,a],()=>[]),()=>[])}function Yg(e){return E(ma(e),(t,n)=>E(B([aa],n),(r,a)=>E(eu(a),(s,m)=>[`${t}${r}${s}`,m],()=>[`${t}`,a]),()=>[`${t}`,n]),()=>[])}function Jg(e){return Wg(e)?Hg(e):Yg(e)}function tu(e){return Jg(ie(e))}function Xg(e){return sa(oa,e)}function Zg(e){return E(Xg(e),(t,n)=>E(tu(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function pa(e){return Zg(ie(e))}function Qg(e){return C(e,"")?[]:[e.slice(0,1),e.slice(1)]}function nu(e,t){return yr(e,(n,r)=>t.startsWith(n)?!0:nu(r,t),()=>!1)}function Tt(e,t,n=""){return E(Qg(t),(r,a)=>nu(e,t)?[n,t]:Tt(e,a,`${n}${r}`),()=>[])}function ey(e,t,n){return E(B([e],n),(r,a)=>E(Tt([t],a),(s,m)=>E(B([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function ty(e,t,n){return E(B([e],n),(r,a)=>E(Tt([rn,t],a),(s,m)=>E(B([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function ru(e,t,n,r){return n?ey(e,t,ie(r)):ty(e,t,ie(r))}function ny(e,t){return B(e,t)}function ry(e,t){return ru(e,e,!1,t)}function ay(e,t){return E(ny(e,t),(n,r)=>ry(n,`${n}${r}`),()=>[])}function ua(e,t){return ay(e,ie(t))}function au(e,t){return E(Tt(e,t),(n,r)=>C(n,"")?[]:[n,r],()=>[])}var o=(e,t,n=()=>[])=>e.length===2?t(e):n(),iy=e=>o(o(W(e),([t,n])=>o(u("extends",n),([r,a])=>o(R(a),([s,m])=>o(u("=",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Bs(t),n]),sy=e=>o(o(W(e),([t,n])=>o(u("extends",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Vs(t),n]),my=e=>o(o(W(e),([t,n])=>o(u("=",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Ws(t),n]),py=e=>o(W(e),([t,n])=>[Hs(t),n]),su=e=>o(o(iy(e),([t,n])=>[t,n],()=>o(sy(e),([t,n])=>[t,n],()=>o(my(e),([t,n])=>[t,n],()=>o(py(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),mu=(e,t=[])=>o(o(su(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>mu(r,[...t,n]),()=>[t,e]),uy=e=>o(o(mu(e),([t,n])=>o(o(o(su(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Ys(t),n]),io=e=>o(o(u("<",e),([t,n])=>o(uy(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Js(t),n]),pu=(e,t=[])=>o(o(R(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>pu(r,[...t,n]),()=>[t,e]),cy=e=>o(o(pu(e),([t,n])=>o(o(o(R(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Xs(t),n]),ly=e=>o(o(u("<",e),([t,n])=>o(cy(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Zs(t),n]),dy=e=>o(o(W(e),([t,n])=>o(ly(n),([r,a])=>[[t,r],a])),([t,n])=>[Qs(t),n]),uu=e=>o(o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[em(t),n]),cu=e=>o(u("string",e),([t,n])=>[tm(t),n]),lu=e=>o(u("number",e),([t,n])=>[nm(t),n]),fy=e=>o(u("boolean",e),([t,n])=>[rm(t),n]),hy=e=>o(u("undefined",e),([t,n])=>[am(t),n]),gy=e=>o(u("null",e),([t,n])=>[om(t),n]),du=e=>o(u("integer",e),([t,n])=>[im(t),n]),yy=e=>o(u("bigint",e),([t,n])=>[sm(t),n]),xy=e=>o(u("unknown",e),([t,n])=>[mm(t),n]),Iy=e=>o(u("any",e),([t,n])=>[pm(t),n]),by=e=>o(u("object",e),([t,n])=>[um(t),n]),vy=e=>o(u("never",e),([t,n])=>[cm(t),n]),fu=e=>o(u("symbol",e),([t,n])=>[lm(t),n]),$y=e=>o(u("void",e),([t,n])=>[dm(t),n]),Ty=e=>o(u("this",e),([t,n])=>[fm(t),n]),ky=e=>o(o(u("${",e),([t,n])=>o(R(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Im(t),n]),ao=e=>o(Tt(["${","`"],e),([t,n])=>[bm(t),n]),hu=e=>o(o(o(ao(e),([t,n])=>o(ky(n),([r,a])=>o(hu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(ao(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(ao(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[vm(t),n]),so=e=>o(o(u("`",e),([t,n])=>o(hu(n),([r,a])=>o(u("`",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[$m(t),n]),wy=e=>o(so(e),([t,n])=>[Tm(t),n]),Ey=e=>o(o(o(u("if",e),([t,n])=>o(R(n),([r,a])=>o(u("then",a),([s,m])=>o(R(m),([c,l])=>o(u("else",l),([h,f])=>o(R(f),([w,D])=>[[t,r,s,c,h,w],D])))))),([t,n])=>[t,n],()=>o(o(u("if",e),([t,n])=>o(R(n),([r,a])=>o(u("then",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[km(t),n]),Ry=e=>o(no(e),([t,n])=>[hm(t),n]),Sy=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[gm(t),n]),Oy=e=>o(pa(e),([t,n])=>[ym(t),n]),Py=e=>o(ua(["'",'"'],e),([t,n])=>[xm(t),n]),Cy=e=>o(o(o(u("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[wm(t),n]),gu=(e,t=[])=>o(o(o(u("[",e),([n,r])=>o(R(r),([a,s])=>o(u("]",s),([m,c])=>[[n,a,m],c]))),([n,r])=>[n,r],()=>o(o(u("[",e),([n,r])=>o(u("]",r),([a,s])=>[[n,a],s])),([n,r])=>[n,r],()=>[])),([n,r])=>gu(r,[...t,n]),()=>[t,e]),My=e=>o(gu(e),([t,n])=>[Em(t),n]),Ay=e=>o(o(o(u("extends",e),([t,n])=>o(R(n),([r,a])=>o(u("?",a),([s,m])=>o(R(m),([c,l])=>o(u(":",l),([h,f])=>o(R(f),([w,D])=>[[t,r,s,c,h,w],D])))))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Rm(t),n]),Ly=e=>o(o(o(u("(",e),([t,n])=>o(R(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(cu(e),([t,n])=>[t,n],()=>o(lu(e),([t,n])=>[t,n],()=>o(fy(e),([t,n])=>[t,n],()=>o(hy(e),([t,n])=>[t,n],()=>o(gy(e),([t,n])=>[t,n],()=>o(du(e),([t,n])=>[t,n],()=>o(yy(e),([t,n])=>[t,n],()=>o(xy(e),([t,n])=>[t,n],()=>o(Iy(e),([t,n])=>[t,n],()=>o(by(e),([t,n])=>[t,n],()=>o(vy(e),([t,n])=>[t,n],()=>o(fu(e),([t,n])=>[t,n],()=>o($y(e),([t,n])=>[t,n],()=>o(Ty(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],()=>o(Py(e),([t,n])=>[t,n],()=>o(wy(e),([t,n])=>[t,n],()=>o(Ey(e),([t,n])=>[t,n],()=>o(Wy(e),([t,n])=>[t,n],()=>o(Qy(e),([t,n])=>[t,n],()=>o(ox(e),([t,n])=>[t,n],()=>o(ax(e),([t,n])=>[t,n],()=>o(px(e),([t,n])=>[t,n],()=>o(dy(e),([t,n])=>[t,n],()=>o(ux(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[Sm(t),n]),qy=e=>o(o(o(u("with",e),([t,n])=>o(Mu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Om(t),n]),yu=e=>o(o(Cy(e),([t,n])=>o(Ly(n),([r,a])=>o(My(a),([s,m])=>o(Ay(m),([c,l])=>o(qy(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Pm(t),n]),xu=e=>o(o(o(u("&",e),([t,n])=>o(yu(n),([r,a])=>o(xu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Iu=e=>o(o(yu(e),([t,n])=>o(xu(n),([r,a])=>[[t,r],a])),([t,n])=>[Cm(t),n]),bu=e=>o(o(o(u("|",e),([t,n])=>o(Iu(n),([r,a])=>o(bu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ca=e=>o(o(Iu(e),([t,n])=>o(bu(n),([r,a])=>[[t,r],a])),([t,n])=>[Mm(t),n]),jy=e=>o(o(u("readonly",e),([t,n])=>o(ca(n),([r,a])=>[[t,r],a])),([t,n])=>[Am(t),n]),Fy=e=>o(o(u("|",e),([t,n])=>o(ca(n),([r,a])=>[[t,r],a])),([t,n])=>[Lm(t),n]),Dy=e=>o(o(io(e),([t,n])=>o(u("=",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[qm(t),n]),Ny=e=>o(o(o(u("infer",e),([t,n])=>o(W(n),([r,a])=>o(u("extends",a),([s,m])=>o(ca(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(u("infer",e),([t,n])=>o(W(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>[])),([t,n])=>[jm(t),n]),R=e=>o(o(Ny(e),([t,n])=>[t,n],()=>o(Fy(e),([t,n])=>[t,n],()=>o(jy(e),([t,n])=>[t,n],()=>o(ca(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Gy=e=>o(pa(e),([t,n])=>[Fm(t),n]),Uy=e=>o(W(e),([t,n])=>[t,n]),Ky=e=>o(ua(["'",'"'],e),([t,n])=>[t,n]),_y=e=>o(o(u("[",e),([t,n])=>o(W(n),([r,a])=>o(u(":",a),([s,m])=>o(o(du(m),([c,l])=>[c,l],()=>o(lu(m),([c,l])=>[c,l],()=>o(cu(m),([c,l])=>[c,l],()=>o(fu(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Dm(t),n]),vu=e=>o(o(Gy(e),([t,n])=>[t,n],()=>o(Uy(e),([t,n])=>[t,n],()=>o(Ky(e),([t,n])=>[t,n],()=>o(_y(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),zy=e=>o(o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Nm(t),n]),By=e=>o(o(o(u("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Gm(t),n]),$u=e=>o(o(zy(e),([t,n])=>o(vu(n),([r,a])=>o(By(a),([s,m])=>o(u(":",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Um(t),n]),Tu=e=>o(o(o(u(",",e),([t,n])=>o(u(`
7
- `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>o(u(`
8
- `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(u(`
9
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),ku=(e,t=[])=>o(o($u(e),([n,r])=>o(Tu(r),([a,s])=>[[n,a],s])),([n,r])=>ku(r,[...t,n]),()=>[t,e]),Vy=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])=>[Km(t),n]),mo=e=>o(o(u("{",e),([t,n])=>o(Vy(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[zm(t),n]),Wy=e=>o(mo(e),([t,n])=>[Bm(t),n]),Hy=e=>o(o(o(W(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(u(":",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[Vm(t),n]),Yy=e=>o(o(u("readonly",e),([t,n])=>o(R(n),([r,a])=>o(u("?",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Wm(t),n]),Jy=e=>o(o(u("readonly",e),([t,n])=>o(R(n),([r,a])=>[[t,r],a])),([t,n])=>[Hm(t),n]),Xy=e=>o(o(R(e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[Ym(t),n]),ou=e=>o(o(Hy(e),([t,n])=>[t,n],()=>o(Yy(e),([t,n])=>[t,n],()=>o(Jy(e),([t,n])=>[t,n],()=>o(Xy(e),([t,n])=>[t,n],()=>o(R(e),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),wu=e=>o(o(o(u("...",e),([t,n])=>o(ou(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(ou(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[Jm(t),n]),Eu=(e,t=[])=>o(o(wu(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Eu(r,[...t,n]),()=>[t,e]),Zy=e=>o(o(Eu(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])=>[Xm(t),n]),Qy=e=>o(o(u("[",e),([t,n])=>o(Zy(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Zm(t),n]),ex=e=>o(o(W(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Qm(t),n]),tx=e=>o(o(W(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[ep(t),n]),nx=e=>o(o(W(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[tp(t),n]),rx=e=>o(o(W(e),([t,n])=>o(u(":",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[np(t),n]),iu=e=>o(o(ex(e),([t,n])=>[t,n],()=>o(tx(e),([t,n])=>[t,n],()=>o(nx(e),([t,n])=>[t,n],()=>o(rx(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Ru=e=>o(o(o(u("...",e),([t,n])=>o(iu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(iu(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[rp(t),n]),Su=(e,t=[])=>o(o(Ru(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Su(r,[...t,n]),()=>[t,e]),Ou=e=>o(o(Su(e),([t,n])=>o(o(o(Ru(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[ap(t),n]),ax=e=>o(o(u("(",e),([t,n])=>o(Ou(n),([r,a])=>o(u(")",a),([s,m])=>o(u("=>",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[op(t),n]),ox=e=>o(o(u("new",e),([t,n])=>o(u("(",n),([r,a])=>o(Ou(a),([s,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([h,f])=>o(R(f),([w,D])=>[[t,r,s,c,h,w],D])))))),([t,n])=>[ip(t),n]),ix=e=>o(o(o(u("+",e),([t,n])=>o(u("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("-",e),([t,n])=>o(u("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[sp(t),n]),sx=e=>o(o(o(u("+",e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("-",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],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[mp(t),n]),mx=e=>o(o(o(u("as",e),([t,n])=>o(R(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[pp(t),n]),px=e=>o(o(u("{",e),([t,n])=>o(ix(n),([r,a])=>o(u("[",a),([s,m])=>o(W(m),([c,l])=>o(u("in",l),([h,f])=>o(R(f),([w,D])=>o(mx(D),([_,ue])=>o(u("]",ue),([Me,Re])=>o(sx(Re),([De,Qe])=>o(u(":",Qe),([N,et])=>o(R(et),([Ne,pt])=>o(uu(pt),([tt,ut])=>o(u("}",ut),([zt,ct])=>[[t,r,s,c,h,w,_,Me,De,N,Ne,tt,zt],ct]))))))))))))),([t,n])=>[up(t),n]),ux=e=>o(W(e),([t,n])=>[cp(t),n]),cx=e=>o(no(e),([t,n])=>[lp(t),n]),lx=e=>o(pa(e),([t,n])=>[dp(t),n]),dx=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[fp(t),n]),fx=e=>o(ua(['"',"'"],e),([t,n])=>[t,n]),hx=e=>o(u("null",e),([t,n])=>[hp(t),n]),gx=e=>o(u("undefined",e),([t,n])=>[void 0,n]),Pu=e=>o(o(vu(e),([t,n])=>o(u(":",n),([r,a])=>o(po(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[gp(t),n]),Cu=(e,t=[])=>o(o(Pu(e),([n,r])=>o(Tu(r),([a,s])=>[[n,a],s])),([n,r])=>Cu(r,[...t,n]),()=>[t,e]),yx=e=>o(o(Cu(e),([t,n])=>o(o(o(Pu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[yp(t),n]),Mu=e=>o(o(u("{",e),([t,n])=>o(yx(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[xp(t),n]),Au=(e,t=[])=>o(o(po(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Au(r,[...t,n]),()=>[t,e]),xx=e=>o(o(Au(e),([t,n])=>o(o(o(po(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Ip(t),n]),Ix=e=>o(o(u("[",e),([t,n])=>o(xx(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[bp(t),n]),po=e=>o(o(cx(e),([t,n])=>[t,n],()=>o(lx(e),([t,n])=>[t,n],()=>o(dx(e),([t,n])=>[t,n],()=>o(fx(e),([t,n])=>[t,n],()=>o(hx(e),([t,n])=>[t,n],()=>o(gx(e),([t,n])=>[t,n],()=>o(Mu(e),([t,n])=>[t,n],()=>o(Ix(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),bx=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[vp(t),n]),vx=e=>o(u(".*",e),([t,n])=>[$p(t),n]),$x=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[Tp(t),n]),Tx=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[kp(t),n]),kx=e=>o(u("(?!)",e),([t,n])=>[wp(t),n]),wx=e=>o(au(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[Ep(t),n]),Ex=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],()=>o(kx(e),([t,n])=>[t,n],()=>o(Rx(e),([t,n])=>[t,n],()=>o(wx(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),Rx=e=>o(o(u("(",e),([t,n])=>o(uo(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Rp(t),n]),Lu=e=>o(o(o(oo(e),([t,n])=>o(u("|",n),([r,a])=>o(Lu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(oo(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[Sp(t),n]),oo=e=>o(o(Ex(e),([t,n])=>o(uo(n),([r,a])=>[[t,r],a])),([t,n])=>[Op(t),n]),uo=e=>o(o(Lu(e),([t,n])=>[t,n],()=>o(oo(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ms=e=>o(o(u("^",e),([t,n])=>o(uo(n),([r,a])=>o(u("$",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Pp(t),n]),qu=(e,t=[])=>o(o(R(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>qu(r,[...t,n]),()=>[t,e]),Sx=e=>o(o(qu(e),([t,n])=>o(o(o(R(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Cp(t),n]),ju=e=>o(o(o(u("extends",e),([t,n])=>o(Sx(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Mp(t),n]),Ox=e=>o(o(u("interface",e),([t,n])=>o(W(n),([r,a])=>o(io(a),([s,m])=>o(ju(m),([c,l])=>o(mo(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Ap(t),n]),Px=e=>o(o(u("interface",e),([t,n])=>o(W(n),([r,a])=>o(ju(a),([s,m])=>o(mo(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[Lp(t),n]),Cx=e=>o(o(u("type",e),([t,n])=>o(W(n),([r,a])=>o(io(a),([s,m])=>o(u("=",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[qp(t),n]),Mx=e=>o(o(u("type",e),([t,n])=>o(W(n),([r,a])=>o(u("=",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[jp(t),n]),Ax=e=>o(o(o(u("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Fp(t),n]),Lx=e=>o(o(o(u(";",e),([t,n])=>o(u(`
10
- `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(u(`
11
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),Fu=(e,t=[])=>o(o(co(e),([n,r])=>o(Lx(r),([a,s])=>[[n,a],s])),([n,r])=>Fu(r,[...t,n]),()=>[t,e]),qx=e=>o(o(Fu(e),([t,n])=>o(o(o(co(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Dp(t),n]),co=e=>o(o(Ax(e),([t,n])=>o(o(Ox(n),([r,a])=>[r,a],()=>o(Px(n),([r,a])=>[r,a],()=>o(Cx(n),([r,a])=>[r,a],()=>o(Mx(n),([r,a])=>[r,a],()=>[])))),([r,a])=>o(uu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Np(t),n]),jx=e=>o(o(co(e),([t,n])=>o(qx(n),([r,a])=>[[t,r],a])),([t,n])=>[Gp(t),n]),Du=e=>o(o(jx(e),([t,n])=>[t,n],()=>o(Dy(e),([t,n])=>[t,n],()=>o(R(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function Nu(e){let t=so(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:Y()}function Dx(e){return e.join("|")}function Nx(e){return e.slice(1,e.length-1)}function Gx(e,t,n){return kt(t,`${n}${e}`)}function Ux(e,t){return kt(e,`${t}${ns}`)}function Kx(e,t){return kt(e,`${t}${wr}`)}function _x(e,t){return kt(e,`${t}${Rr}`)}function zx(e,t){return Gn(k([O("false"),O("true")]),e,t)}function Bx(e,t){return kt(e,`${t}${Sr}`)}function Vx(e,t,n){return kt(t,`${n}${Nx(e)}`)}function Wx(e,t,n){let r=Un(e,{});return Gn(r,t,n)}function Hx(e,t,n){let r=ke(e);return Gn(r,t,n)}function Gu(e,t,n,r=[]){return i.ShiftLeft(e,(a,s)=>Gu(s,t,n,[...r,Gn(a,[],"")]),()=>kt(t,`${n}(${Dx(r)})`))}function Gn(e,t,n){return fe(e)?Hx(e.enum,t,n):he(e)?Kx(t,n):A(e)?Gx(e.const,t,n):Ve(e)?Ux(t,n):Se(e)?zx(t,n):X(e)?_x(t,n):ge(e)?Bx(t,n):Z(e)?Vx(e.pattern,t,n):Ku(e)?Wx(e.parameters[0],t,n):x(e)?Gu(e.anyOf,t,n):Fi}function kt(e,t){return i.ShiftLeft(e,(n,r)=>Gn(n,r,t),()=>t)}function Yx(e){return`^${kt(e,"")}$`}function Uu(e){let t=Yx(e);return Pr(t)}function Un(e,t){return T(e)?p.Update(Uu(e),{},t):Nr(e,t)}function _u(e,t,n,r){let a=we(e,t,n);return Un(a,r)}function Nr(e,t={}){return I("TemplateLiteral",[e],t)}function Ku(e){return ee(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function zu(e){return Un(e,{})}function Jx(e){let t=Nu(e);return zu(t)}function Bu(e,t={}){let n=i.IsString(e)?Jx(e):zu(e);return p.Update(n,{},t)}function Z(e){return y(e,"TemplateLiteral")}var b={};Rt(b,{ExtendsFalse:()=>$,ExtendsTrue:()=>g,ExtendsUnion:()=>lo,IsExtendsFalse:()=>Xx,IsExtendsTrue:()=>Wu,IsExtendsTrueLike:()=>on,IsExtendsUnion:()=>Vu,Match:()=>U});function lo(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Vu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsUnion")&&i.IsObject(e.inferred)}function g(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function Wu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function $(){return p.Create({"~kind":"ExtendsFalse"},{})}function Xx(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function on(e){return Vu(e)||Wu(e)}function U(e,t,n){return on(e)?t(e.inferred):n()}function Zx(e,t,n,r){return U(P(e,n,r),a=>g(p.Assign(p.Assign(e,a),{[t]:n})),()=>$())}function Qx(e,t){return g(e)}function eI(e,t,n,r,a){return U(P(e,t,n),s=>U(P(s,t,r),m=>g(m),()=>$()),()=>U(P(e,t,a),s=>g(s),()=>$()))}function tI(e,t,n){let r=ke(n);return P(e,t,r)}function Hu(e,t,n){return i.ShiftLeft(n,(r,a)=>U(P(e,t,r),s=>Hu(s,t,a),()=>$()),()=>g(e))}function nI(e,t,n){let r=Ie(n);return P(e,t,r)}function Yu(e,t,n){return i.ShiftLeft(n,(r,a)=>U(P(e,t,r),s=>g(s),()=>Yu(e,t,a)),()=>$())}function L(e,t,n){return J(n)?Qx(e,t):V(n)?eI(e,t,n.if,n.then,n.else):fe(n)?tI(e,t,n.enum):H(n)?Zx(e,n.name,t,n.extends):S(n)?Hu(e,t,n.allOf):Z(n)?nI(e,t,n.pattern):x(n)?Yu(e,t,n.anyOf):te(n)?g(e):$()}function Ju(e,t,n){return H(n)?L(e,t,n):J(n)?g(e):te(n)?g(e):lo(e)}function rI(e,t){let n=At(e),r=At(t);return n&&r||!n&&r?!0:!(n&&!r)}function Xu(e,t,n,r){return K(r)?rI(t,r)?P(e,n,r.items):$():L(e,t,r)}function Zu(e,t,n){return Ve(n)?g(e):L(e,t,n)}function Qu(e,t,n){return Se(n)?g(e):L(e,t,n)}function aI(e,t,n,r,a){let s=H(r)?t:r,m=H(r)?r:t,c=le(t),l=le(r);return!c&&l?$():U(P(e,s,m),h=>Kn(h,n,a),()=>$())}function oI(e,t,n,r){return i.ShiftLeft(r,(a,s)=>aI(e,t,n,a,s),()=>le(t)?g(e):$())}function iI(e,t,n){return i.ShiftLeft(t,(r,a)=>oI(e,r,a,n),()=>g(e))}function Kn(e,t,n){return iI(e,t,n)}function la(e,t,n){return We(n)?g(e):P(e,t,n)}function ec(e,t,n,r){return J(r)?g(e):te(r)?g(e):ne(r)?U(Kn(e,t,r.parameters),a=>la(a,n,r.instanceType),()=>$()):$()}function tc(e,t,n,r,a){return U(P(e,t,a),()=>P(e,n,a),()=>P(e,r,a))}function nc(e,t,n){let r=ke(t);return P(e,r,n)}function rc(e,t,n,r){return J(r)?g(e):te(r)?g(e):re(r)?U(Kn(e,t,r.parameters),a=>la(a,n,r.returnType),()=>$()):$()}function ac(e,t,n){return he(n)?g(e):X(n)?g(e):L(e,t,n)}function oc(e,t,n){let r=z(t);return P(e,r,n)}function da(e,t,n){return t===n?g(e):$()}function sI(e,t,n){return A(n)?da(e,t,n.const):Ve(n)?g(e):L(e,O(t),n)}function mI(e,t,n){return A(n)?da(e,t,n.const):Se(n)?g(e):L(e,O(t),n)}function pI(e,t,n){return A(n)?da(e,t,n.const):X(n)?g(e):L(e,O(t),n)}function uI(e,t,n){return A(n)?da(e,t,n.const):ge(n)?g(e):L(e,O(t),n)}function ic(e,t,n){return i.IsBigInt(t.const)?sI(e,t.const,n):i.IsBoolean(t.const)?mI(e,t.const,n):i.IsNumber(t.const)?pI(e,t.const,n):i.IsString(t.const)?uI(e,t.const,n):Y()}function sc(e,t,n){return H(n)?L(e,t,n):g(e)}function mc(e,t,n){return Yt(n)?g(e):L(e,t,n)}function pc(e,t,n){return X(n)?g(e):L(e,t,n)}function cI(e,t,n){return le(t)?le(n)?g(e):$():g(e)}function lI(e,t,n){return H(n)&&yt(n.extends)?$():U(P(e,t,n),r=>cI(r,t,n),()=>$())}function dI(e,t){return e.reduce((n,r)=>r in t?on(t[r])?{...n,...t[r].inferred}:Y():Y(),{})}function fI(e,t,n){let r={};for(let m of i.Keys(n))r[m]=m in t?lI({},t[m],n[m]):le(n[m])?H(n[m])?g(p.Assign(e,{[n[m].name]:n[m].extends})):g(e):$();let a=i.Values(r).every(m=>on(m)),s=a?dI(i.Keys(r),r):{};return a?g(s):$()}function hI(e,t,n){let r=fI(e,t,n);return on(r)?g(p.Assign(e,r.inferred)):$()}function gI(e,t,n){return hI(e,t,n)}function yI(e,t){return i.Keys(t).reduce((n,r)=>({...n,[r]:i.HasPropertyKey(e,r)?x(n[r])?k([...n[r].anyOf,t[r]]):k([e[r],t[r]]):t[r]}),e)}function uc(e,t,n,r){return i.ShiftLeft(t,(a,s)=>U(P({},e[a],n),m=>uc(e,s,n,yI(r,m)),()=>$()),()=>g(r))}function xI(e,t,n,r){let a=i.Keys(t);return uc(t,a,r,e)}function cc(e,t,n){return pe(n)?xI(e,t,Ce(n),ye(n)):M(n)?gI(e,t,n.properties):L(e,v(t),n)}function II(e,t){return i.IsEqual(i.Keys(t).length,0)?g(e):$()}function bI(e,t,n,r,a){return P(e,n,a)}function lc(e,t,n,r){return pe(r)?bI(e,qr(t),n,qr(Ce(r)),ye(r)):M(r)?II(e,r.properties):J(r)?g(e):te(r)?g(e):$()}function dc(e,t,n){return ge(n)?g(e):L(e,t,n)}function fc(e,t,n){return xt(n)?g(e):L(e,t,n)}function hc(e,t,n){let r=Ie(t);return P(e,r,n)}function fo(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function _n(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"name")&&i.HasPropertyKey(e,"type")&&i.IsEqual(e["~kind"],"Inferrable")&&i.IsString(e.name)&&i.IsObject(e.type)}function ho(e){return vt(e)?H(e.items)?K(e.items.extends)?fo(e.items.name,e.items.extends.items):te(e.items.extends)?fo(e.items.name,e.items.extends):void 0:Y():void 0}function fa(e){return H(e)?fo(e.name,e.extends):void 0}function go(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>U(P({},r,t),()=>go(a,t,[...n,r]),()=>{}),()=>n)}function gc(e,t,n,r){let a=go(n,r);return i.IsArray(a)?g(p.Assign(e,{[t]:Q(a)})):$()}function ha(e,t,n,r){let a=go(n,r);return i.IsArray(a)?g(p.Assign(e,{[t]:k(a)})):$()}function vI(e){return[...e].reverse()}function yo(e,t){return t?vI(e):e}function $I(e){let t=e.length>0?e[0]:void 0,n=ee(t)?ho(t):void 0;return ee(n)}function TI(e,t,n,r,a,s){return U(P(e,n,a),m=>yc(m,t,r,s),()=>$())}function kI(e,t,n,r,a){let s=ho(r);return _n(s)?gc(e,s.name,yo(n,t),s.type):i.ShiftLeft(n,(m,c)=>TI(e,t,m,c,r,a),()=>$())}function wI(e,t,n,r){return i.ShiftLeft(r,(a,s)=>kI(e,t,n,a,s),()=>i.IsEqual(n.length,0)?g(e):$())}function yc(e,t,n,r){return wI(e,t,n,r)}function EI(e,t,n){let r=wt(e,G([],[]),n),a=$I(r);return yc(e,a,yo(t,a),yo(r,a))}function xc(e,t,n){let r=fa(n);return _n(r)?ha(e,r.name,t,r.type):i.ShiftLeft(t,(a,s)=>U(P(e,a,n),m=>xc(m,s,n),()=>$()),()=>g(e))}function Ic(e,t,n){let r=wt(e,G([],[]),t);return j(n)?EI(e,r,n.items):K(n)?xc(e,r,n.items):L(e,Q(r),n)}function bc(e,t,n){return We(n)?g(e):tn(n)?g(e):L(e,t,n)}function vc(e,t,n){return i.ShiftLeft(n,(r,a)=>U(P(e,t,r),s=>g(s),()=>vc(e,t,a)),()=>$())}function xo(e,t,n){return i.ShiftLeft(t,(r,a)=>U(vc(e,r,n),s=>xo(s,a,n),()=>$()),()=>g(e))}function $c(e,t,n){let r=fa(n);return _n(r)?ha(e,r.name,t,r.type):x(n)?xo(e,t,n.anyOf):xo(e,t,[n])}function Tc(e,t,n){return H(n)?L(e,t,n):J(n)?g(e):te(n)?g(e):$()}function kc(e,t,n){return We(n)?g(e):L(e,t,n)}function P(e,t,n){return J(t)?Ju(e,t,n):K(t)?Xu(e,t,t.items,n):Ve(t)?Zu(e,t,n):Se(t)?Qu(e,t,n):ne(t)?ec(e,t.parameters,t.instanceType,n):V(t)?tc(e,t.if,t.then,t.else,n):fe(t)?nc(e,t.enum,n):re(t)?rc(e,t.parameters,t.returnType,n):he(t)?ac(e,t,n):S(t)?oc(e,t.allOf,n):A(t)?ic(e,t,n):yt(t)?sc(e,t,n):Yt(t)?mc(e,t,n):X(t)?pc(e,t,n):M(t)?cc(e,t.properties,n):pe(t)?lc(e,Ce(t),ye(t),n):ge(t)?dc(e,t,n):xt(t)?fc(e,t,n):Z(t)?hc(e,t.pattern,n):j(t)?Ic(e,t.items,n):tn(t)?bc(e,t,n):x(t)?$c(e,t.anyOf,n):te(t)?Tc(e,t,n):We(t)?kc(e,t,n):$()}function RI(e,t){return z([...e,v(t)])}function Io(e,t,n){return T(e)?p.Update(RI(e,t),{},n):qn(e,t,n)}function wc(e,t,n,r,a){let s=we(e,t,n),m=zn(e,t,r);return Io(s,m,a)}function qn(e,t,n={}){return I("Interface",[e,t],n)}function sn(e){return ee(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function Ec(e,t,n={}){return Io(e,t,n)}function SI(e,t,n){return e.includes(n)?!0:Bn([...e,n],t,t[n])}function Rc(e,t,n){let r=br(n);return Gt(e,t,r)}function Gt(e,t,n){return i.ShiftLeft(n,(r,a)=>Bn(e,t,r)?!0:Gt(e,t,a),()=>!1)}function Bn(e,t,n){return ae(n)?SI(e,t,n.$ref):K(n)?Bn(e,t,n.items):ne(n)?Gt(e,t,[...n.parameters,n.instanceType]):re(n)?Gt(e,t,[...n.parameters,n.returnType]):sn(n)?Rc(e,t,n.parameters[1]):S(n)?Gt(e,t,n.allOf):M(n)?Rc(e,t,n.properties):x(n)?Gt(e,t,n.anyOf):j(n)?Gt(e,t,n.items):pe(n)?Bn(e,t,ye(n)):!1}function Sc(e,t,n){return Bn(e,t,n)}function OI(e,t){return t.reduce((n,r)=>Sc([r],e,e[r])?[...n,r]:n,[])}function Oc(e){let t=Ir(e);return OI(e,t)}function PI(e,t,n){return n.includes(t)?n:t in e?Vn(e,e[t],[...n,t]):Y()}function Pc(e,t,n){let r=br(t);return mn(e,r,n)}function mn(e,t,n){return t.reduce((r,a)=>Vn(e,a,r),n)}function Vn(e,t,n){return ae(t)?PI(e,t.$ref,n):K(t)?Vn(e,t.items,n):ne(t)?mn(e,[...t.parameters,t.instanceType],n):re(t)?mn(e,[...t.parameters,t.returnType],n):sn(t)?Pc(e,t.parameters[1],n):S(t)?mn(e,t.allOf,n):M(t)?Pc(e,t.properties,n):x(t)?mn(e,t.anyOf,n):j(t)?mn(e,t.items,n):pe(t)?Vn(e,ye(t),n):n}function Cc(e,t,n){return Vn(e,n,[t])}function CI(e){return Vt()}function MI(e){return i.Keys(e).reduce((t,n)=>({...t,[n]:Ut(e[n])}),{})}function Wn(e){return e.reduce((t,n)=>[...t,Ut(n)],[])}function Ut(e){return ae(e)?CI(e.$ref):K(e)?Te(Ut(e.items),xr(e)):ne(e)?Ge(Wn(e.parameters),Ut(e.instanceType)):re(e)?Ue(Wn(e.parameters),Ut(e.returnType)):S(e)?de(Wn(e.allOf)):M(e)?v(MI(e.properties)):pe(e)?Lr(Qt(e),Ut(ye(e))):x(e)?k(Wn(e.anyOf)):j(e)?Q(Wn(e.items)):e}function AI(e,t){return t in e?Ut(e[t]):oe()}function Mc(e){return AI(e.$defs,e.$ref)}function LI(e,t,n){let r=we(e,G([],[]),t),a=zn({},G([],[]),n);return z([...r,v(a)])}function qI(e,t){return i.Keys(e).filter(r=>t.includes(r)).reduce((r,a)=>{let s=e[a],m=sn(s)?LI(e,s.parameters[0],s.parameters[1]):s;return{...r,[a]:m}},{})}function Ac(e,t,n){let r=Cc(e,t,n),a=qI(e,r);return _e(a,t)}function Lc(e,t){return t in e?ae(e[t])?Lc(e,e[t].$ref):e[t]:q()}function He(e,t){return Lc(e,t)}function qc(e){return se(e)?Mc(e):vr(e)?oe():e}function me(e,t,n){let r=qc(t),a=qc(n);return P(e,r,a)}var On="equal",jI="disjoint",Pn="left-inside",Cn="right-inside";function Xt(e,t){let n=[te(e)?b.ExtendsFalse():me({},e,t),te(e)?b.ExtendsTrue({}):me({},t,e)];return b.IsExtendsTrueLike(n[0])&&b.IsExtendsTrueLike(n[1])?On:b.IsExtendsTrueLike(n[0])&&b.IsExtendsFalse(n[1])?Pn:b.IsExtendsFalse(n[0])&&b.IsExtendsTrueLike(n[1])?Cn:jI}function FI(e,t){return t.filter(n=>Xt(e,n)!==Cn)}function DI(e,t){let n=t.some(r=>{let a=Xt(e,r);return i.IsEqual(a,Pn)||i.IsEqual(a,On)});return i.IsEqual(n,!1)}function NI(e,t){let n=Pe(e);return J(n)?[n]:DI(n,t)?[...FI(n,t),n]:t}function GI(e){return e.reduce((t,n)=>M(n)?[...t,n]:yt(n)?t:NI(n,t),[])}function Ja(e){let t=GI(e);return An(t)}function bo(e,t){return p.Update(Pe(e),{},t)}function jc(e,t,n,r){let a=d(e,t,n);return bo(a,r)}function Hn(e,t=[]){return ht(e)&&i.IsEqual(e.action,"Conditional")?ae(e.parameters[0])?Hn(e.parameters[2],Hn(e.parameters[3],[...t,e.parameters[0].$ref])):Hn(e.parameters[2],Hn(e.parameters[3],t)):ht(e)&&i.IsEqual(e.action,"Mapped")&&ht(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&ae(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function UI(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function Nc(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>i.ShiftLeft(t,(s,m)=>Nc(a,m,[...n,[s,r]]),()=>n),()=>n)}function KI(e){return x(e)?[...e.anyOf]:[e]}function _I(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function Fc(e,t){return t.reduce((n,r)=>[...n,..._I(e,r)],[])}function Dc(e){return e.reduce((t,n)=>i.IsEqual(n[0],!0)?Fc(t,KI(n[1])):Fc(t,[n[1]]),[[]])}function Gc(e,t,n){let r=Hn(n),a=UI(e,r),s=Nc(t,a);return ht(n)&&i.IsEqual(n.action,"Conditional")||ht(n)&&i.IsEqual(n.action,"Mapped")?Dc(s):[t]}function zI(){return["(not-resolvable)",q()]}function BI(){return["(not-generic)",q()]}function VI(e,t,n){return[e,gt(t,n)]}function WI(e,t,n){return t in e?Uc(e,t,e[t],n):zI()}function Uc(e,t,n,r){return Bt(n)?VI(t,n.parameters,n.expression):ae(n)?WI(e,n.$ref,r):BI()}function Kc(e,t,n){return Uc(e,"(anonymous)",t,n)}function HI(e,t,n){if(H(t)||pn(t)||b.IsExtendsTrueLike(me({},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 _c(e,t,n,r,a){let s=d(e,t,a);return HI(n,s,r),p.Assign(e,{[n]:s})}function YI(e,t,n,r,a){let s=d(e,t,n.extends),m=d(e,t,n.equals);return i.ShiftLeft(a,(c,l)=>vo(_c(e,t,n.name,s,c),t,r,l),()=>vo(_c(e,t,n.name,s,m),t,r,[]))}function vo(e,t,n,r){return i.ShiftLeft(n,(a,s)=>YI(e,t,a,s,r),()=>e)}function zc(e,t,n,r){return vo(e,t,n,r)}function JI(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function XI(e,t){return i.IsEqual(JI(e),t)}function ZI(e,t,n,r,a,s){let m=zc(e,t,r,s),c=d(m,G([...t.callstack,n.$ref],t.visited),a);return d(m,G([],[]),c)}function QI(e,t,n,r,a,s){return s.reduce((m,c)=>[...m,ZI(e,t,n,r,a,c)],[])}function eb(e,t,n,r,a,s){let m=Gc(r,s,a),c=QI(e,t,n,r,a,m);return i.IsEqual(c.length,1)?c[0]:ve(c)}function ga(e,t,n,r){let a=we(e,t,r),s=Kc(e,n,r),m=s[0],c=s[1];return Bt(c)?XI(t,m)?jn(ot(m),a):eb(e,t,ot(m),c.parameters,c.expression,a):jn(n,a)}function jn(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Bc(e,t){return ga({},G([],[]),e,t)}function pn(e){return y(e,"Call")}function tb(e){return p.Discard(e,["~immutable"])}function Vc(e,t){return p.Update(tb(e),{},t)}function Wc(e,t,n,r){let a=d(e,t,n);return Vc(a,r)}function Hc(e,t){return e(t)}function Yc(e,t){return i.IsString(t)?O(Hc(e,t)):O(t)}function Jc(e,t){let n=Ie(t);return mt(e,n)}function Xc(e,t){let n=t.map(r=>mt(e,r));return k(n)}function mt(e,t){return A(t)?Yc(e,t.const):Z(t)?Jc(e,t.pattern):x(t)?Xc(e,t.anyOf):t}function Gr(e,t={}){return I("Capitalize",[e],t)}function Zc(e,t={}){return $o(e,t)}function Ur(e,t={}){return I("Lowercase",[e],t)}function Qc(e,t={}){return To(e,t)}function Kr(e,t={}){return I("Uncapitalize",[e],t)}function el(e,t={}){return ko(e,t)}function _r(e,t={}){return I("Uppercase",[e],t)}function tl(e,t={}){return wo(e,t)}var nb=e=>e[0].toUpperCase()+e.slice(1),rb=e=>e.toLowerCase(),ab=e=>e[0].toLowerCase()+e.slice(1),ob=e=>e.toUpperCase();function $o(e,t){return T([e])?p.Update(mt(nb,e),{},t):Gr(e,t)}function To(e,t){return T([e])?p.Update(mt(rb,e),{},t):Ur(e,t)}function ko(e,t){return T([e])?p.Update(mt(ab,e),{},t):Kr(e,t)}function wo(e,t){return T([e])?p.Update(mt(ob,e),{},t):_r(e,t)}function nl(e,t,n,r){let a=d(e,t,n);return $o(a,r)}function rl(e,t,n,r){let a=d(e,t,n);return To(a,r)}function al(e,t,n,r){let a=d(e,t,n);return ko(a,r)}function ol(e,t,n,r){let a=d(e,t,n);return wo(a,r)}function zr(e,t,n,r,a={}){return I("Conditional",[e,t,n,r],a)}function il(e,t,n,r,a={}){return Eo({},G([],[]),e,t,n,r,a)}function ib(e,t,n,r,a,s){let m=me(e,n,r);return b.IsExtendsUnion(m)?k([d(m.inferred,t,a),d(e,t,s)]):b.IsExtendsTrue(m)?d(m.inferred,t,a):d(e,t,s)}function Eo(e,t,n,r,a,s,m){return T([n,r])?p.Update(ib(e,t,n,r,a,s),{},m):zr(n,r,a,s,m)}function sl(e,t,n,r,a,s,m){let c=d(e,t,n),l=d(e,t,r);return Eo(e,t,c,l,a,s,m)}function Br(e,t={}){return I("ConstructorParameters",[e],t)}function ml(e,t={}){return Ro(e,t)}function sb(e){let t=ne(e)?e.parameters:[],n=wt({},G([],[]),t);return Q(n)}function Ro(e,t){return T([e])?p.Update(sb(e),{},t):Br(e,t)}function pl(e,t,n,r){let a=d(e,t,n);return Ro(a,r)}function Vr(e,t,n={}){return I("Exclude",[e,t],n)}function ul(e,t,n={}){return Yn(e,t,n)}function Yn(e,t,n){return T([e,t])?p.Update(Mr(e,t),{},n):Vr(e,t,n)}function cl(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Yn(s,m,a)}function Wr(e,t,n={}){return I("Extract",[e,t],n)}function ll(e,t,n={}){return So(e,t,n)}function mb(e,t){let n=me({},e,t);return b.IsExtendsTrueLike(n)?[e]:[]}function pb(e,t){return e.reduce((n,r)=>[...n,...mb(r,t)],[])}function dl(e,t){let n=Pe(e),r=x(n)?n.anyOf:[n],a=pb(r,t);return ve(a)}function So(e,t,n){return T([e,t])?p.Update(dl(e,t),{},n):Wr(e,t,n)}function fl(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return So(s,m,a)}function ub(e){return e.reduce((t,n)=>Er(n)?[...t,O(n)]:t,[])}function un(e){let t=ub(e);return k(t)}function Fn(e,t,n={}){return I("Index",[e,t],n)}function hl(e,t,n={}){let r=i.IsArray(t)?un(t):t;return Oo(e,r,n)}function gl(e,t){let n=He(e,t);return Ee(n)}function yl(e,t,n){let r=Fe(e,t,n);return Ee(r)}function cb(e,t){let n=i.Keys(e).filter(f=>!i.HasPropertyKey(t,f)),r=i.Keys(t).filter(f=>!i.HasPropertyKey(e,f)),a=i.Keys(e).filter(f=>i.HasPropertyKey(t,f)),s=n.reduce((f,w)=>({...f,[w]:e[w]}),{}),m=r.reduce((f,w)=>({...f,[w]:t[w]}),{}),c=a.reduce((f,w)=>({...f,[w]:z([e[w],t[w]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function xl(e){return e.reduce((t,n)=>cb(t,Ee(n)),{})}function Il(e){let t=ks(Q(e));return Ee(t)}function lb(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:ve([e[s],t[s]])}),{})}function bl(e,t){return i.ShiftLeft(e,(n,r)=>bl(r,lb(t,Ee(n))),()=>t)}function vl(e){return i.ShiftLeft(e,(t,n)=>bl(n,Ee(t)),()=>Y())}function Ee(e){return se(e)?gl(e.$defs,e.$ref):V(e)?yl(e.if,e.then,e.else):S(e)?xl(e.allOf):x(e)?vl(e.anyOf):j(e)?Il(e.items):M(e)?e.properties:{}}function cn(e){let t=Ee(e);return v(t)}var db=new RegExp("^(?:0|[1-9][0-9]*)$");function ln(e){let t=`${e}`;return db.test(t)?parseInt(t):e}function fb(e){return O(ln(e))}function $l(e){return e.map(t=>Tl(t))}function Tl(e){return S(e)?de($l(e.allOf)):x(e)?k($l(e.anyOf)):A(e)?fb(e.const):e}function kl(e,t){let n=Tl(t),r=me({},n,be());return b.IsExtendsTrueLike(r)?e:A(t)&&i.IsEqual(t.const,"length")?be():q()}function wl(e,t){let n=He(e,t);return $e(n)}function El(e,t,n){let r=Fe(e,t,n);return $e(r)}function Rl(e){let t=ke(e);return $e(t)}function Sl(e){let t=z(e);return $e(t)}function Ol(e){return[`${e}`]}function Pl(e){let t=Ie(e);return $e(t)}function Cl(e){return e.reduce((t,n)=>[...t,...$e(n)],[])}function $e(e){return se(e)?wl(e.$defs,e.$ref):V(e)?El(e.if,e.then,e.else):fe(e)?Rl(e.enum):S(e)?Sl(e.allOf):A(e)?Ol(e.const):Z(e)?Pl(e.pattern):x(e)?Cl(e.anyOf):[]}function dn(e){return $e(e)}function Jn(e,t){return t.map(n=>Xn(e,n))}function Xn(e,t){return K(t)?Te(Xn(e,t.items)):ne(t)?Ge(Jn(e,t.parameters),Xn(e,t.instanceType)):re(t)?Ue(Jn(e,t.parameters),Xn(e,t.returnType)):j(t)?Q(Jn(e,t.items)):x(t)?k(Jn(e,t.anyOf)):S(t)?de(Jn(e,t.allOf)):Fr(t)?v(e):t}function Ml(e,t){return Xn(e,t)}function hb(e,t){let n=t in e?e[t]:q();return Ml(e,n)}function Al(e,t){return t.reduce((n,r)=>[...n,hb(e,r)],[])}function gb(e,t){let n=dn(t),r=Al(e,n);return ve(r)}var yb=new RegExp(bt);function xb(e){return e.filter(n=>yb.test(n))}function Ib(e){let t=Ir(e),n=xb(t),r=Al(e,n);return ve(r)}function Ll(e,t){return X(t)?Ib(e):gb(e,t)}function bb(e){return O(ln(e))}function ql(e){return e.map(t=>Po(t))}function Po(e){return S(e)?de(ql(e.allOf)):x(e)?k(ql(e.anyOf)):A(e)?bb(e.const):e}function vb(e,t){return e.reduceRight((n,r,a)=>{let s=me({},O(a),t);return b.IsExtendsTrueLike(s)?[r,...n]:n},[])}function $b(e,t){let n=Po(t),r=vb(e,n);return it(r)}function Tb(e){return it(e)}function jl(e,t){return A(t)&&i.IsEqual(t.const,"length")?O(e.length):X(t)||he(t)?Tb(e):$b(e,t)}function Fl(e,t){return K(e)?kl(e.items,t):M(e)?Ll(e.properties,t):j(e)?jl(e.items,t):q()}function kb(e){return se(e)||V(e)||S(e)||x(e)?cn(e):e}function Oo(e,t,n){return T([e,t])?p.Update(Fl(kb(e),t),{},n):Fn(e,t,n)}function Dl(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Oo(s,m,a)}function Hr(e,t={}){return I("InstanceType",[e],t)}function Nl(e,t={}){return Co(e,t)}function wb(e){return ne(e)?e.instanceType:q()}function Co(e,t){return T([e])?p.Update(wb(e),{},t):Hr(e,t)}function Gl(e,t,n,r={}){let a=d(e,t,n);return Co(a,r)}function Dn(e,t={}){return I("KeyOf",[e],t)}function Ul(e,t={}){return Mo(e,t)}function Kl(){return k([be(),Oe(),Jt()])}function _l(e){return be()}function Eb(e){return e.reduce((n,r)=>Er(r)?[...n,O(ln(r))]:Y(),[])}function zl(e){let t=i.Keys(e),n=Eb(t);return it(n)}function Bl(e){return Qt(e)}function Vl(e){let t=e.map((n,r)=>O(r));return it(t)}function Wl(e){return J(e)?Kl():K(e)?_l(e.items):M(e)?zl(e.properties):pe(e)?Bl(e):j(e)?Vl(e.items):q()}function Rb(e){return se(e)||V(e)||S(e)||x(e)?cn(e):e}function Mo(e,t){return T([e])?p.Update(Wl(Rb(e)),{},t):Dn(e,t)}function Hl(e,t,n,r){let a=d(e,t,n);return Mo(a,r)}function Ln(e,t,n,r,a={}){return I("Mapped",[e,t,n,r],a)}function Yl(e,t,n,r,a={}){return Ao({},G([],[]),e,t,n,r,a)}function Sb(e){let t=Ie(e);return ya(t)}function Ob(e){return e.reduce((t,n)=>[...t,...ya(n)],[])}function Pb(e){let t=ke(e);return ya(t)}function Cb(e){return i.IsNumber(e)?[O(`${e}`)]:[O(e)]}function ya(e){return fe(e)?Pb(e.enum):A(e)?Cb(e.const):Z(e)?Sb(e.pattern):x(e)?Ob(e.anyOf):[e]}function Jl(e){return ya(e)}function Mb(e){return Z(e)?Ie(e.pattern):e}function Ab(e,t,n,r,a,s){let m=p.Assign(e,{[n.name]:r}),c=d(m,t,a),l=Mb(c),h=d(m,t,s);return as(l)||os(l)?{[l.const]:h}:{}}function Lb(e,t,n,r,a,s){return r.reduce((m,c)=>[...m,Ab(e,t,n,c,a,s)],[])}function qb(e){return e.reduce((t,n)=>[...t,v(n)],[])}function Xl(e,t,n,r,a,s){let m=Jl(r),c=Lb(e,t,n,m,a,s),l=qb(c);return z(l)}function Ao(e,t,n,r,a,s,m){return T([r])?p.Update(Xl(e,t,n,r,a,s),{},m):Ln(n,r,a,s,m)}function Zl(e,t,n,r,a,s,m){let c=d(e,t,r);return Ao(e,t,n,c,a,s,m)}function jb(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>n.includes(s)).reduce((s,m)=>({...s,[m]:Ac(r,m,t[m])}),{})}function Fb(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>!n.includes(s)).reduce((s,m)=>({...s,[m]:d(r,G([],[]),t[m])}),{})}function Db(e,t,n){let r=Oc(t),a=jb(e,t,r),s=Fb(e,t,r),m={...a,...s};return p.Update(m,{},n)}function xa(e,t,n,r){return Db(e,n,r)}function Yr(e,t={}){return I("NonNullable",[e],t)}function Ql(e,t={}){return Lo(e,t)}function Nb(e){let t=k([Ht(),en()]);return Yn(e,t,{})}function Lo(e,t){return T([e])?p.Update(Nb(e),{},t):Yr(e,t)}function ed(e,t,n,r){let a=d(e,t,n);return Lo(a,r)}function Jr(e,t,n={}){return I("Omit",[e,t],n)}function td(e,t,n={}){let r=i.IsArray(t)?un(t):t;return qo(e,r,n)}function Ia(e){let t=cn(e);return M(t)?t.properties:Y()}function Gb(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?r:{...r,[a]:e[a]},{})}function nd(e,t){let n=Ia(e),r=dn(t),a=Gb(n,r);return v(a)}function qo(e,t,n){return T([e,t])?p.Update(nd(e,t),{},n):Jr(e,t,n)}function rd(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return qo(s,m,a)}function Xr(e,t={}){return I("Parameters",[e],t)}function ad(e,t={}){return jo(e,t)}function Ub(e){let t=re(e)?e.parameters:[],n=wt({},G([],[]),t);return Q(n)}function jo(e,t){return T([e])?p.Update(Ub(e),{},t):Xr(e,t)}function od(e,t,n,r){let a=d(e,t,n);return jo(a,r)}function Zr(e,t={}){return I("Partial",[e],t)}function id(e,t={}){return Fo(e,t)}function sd(e,t){let n=He(e,t),r=Ye(n);return _e(p.Assign(e,{[t]:r}),t)}function md(e,t,n){let r=Fe(e,t,n);return Ye(r)}function pd(e){let t=z(e);return Ye(t)}function ud(e){let t=e.map(n=>Ye(n));return k(t)}function cd(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:Ct(e[a])}),{});return v(t)}function Ye(e){return se(e)?sd(e.$defs,e.$ref):V(e)?md(e.if,e.then,e.else):S(e)?pd(e.allOf):x(e)?ud(e.anyOf):M(e)?cd(e.properties):v({})}function Fo(e,t){return T([e])?p.Update(Ye(e),{},t):Zr(e,t)}function ld(e,t,n,r){let a=d(e,t,n);return Fo(a,r)}function Qr(e,t,n={}){return I("Pick",[e,t],n)}function dd(e,t,n={}){let r=i.IsArray(t)?un(t):t;return Do(e,r,n)}function Kb(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?p.Assign(r,{[a]:e[a]}):r,{})}function fd(e,t){let n=Ia(e),r=dn(t),a=Kb(n,r);return v(a)}function Do(e,t,n){return T([e,t])?p.Update(fd(e,t),{},n):Qr(e,t,n)}function hd(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Do(s,m,a)}function ea(e,t={}){return I("ReadonlyObject",[e],t)}function No(e,t={}){return Go(e,t)}var gd=No;function yd(e){return Wt(Te(e))}function xd(e,t){let n=He(e,t),r=Je(n);return _e(p.Assign(e,{[t]:r}),t)}function Id(e,t,n){let r=Fe(e,t,n);return Je(r)}function bd(e){let t=z(e);return Je(t)}function vd(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:Lt(e[a])}),{});return v(t)}function $d(e){return Wt(Q(e))}function Td(e){let t=e.map(n=>Je(n));return k(t)}function Je(e){return K(e)?yd(e.items):se(e)?xd(e.$defs,e.$ref):V(e)?Id(e.if,e.then,e.else):S(e)?bd(e.allOf):M(e)?vd(e.properties):j(e)?$d(e.items):x(e)?Td(e.anyOf):e}function Go(e,t){return T([e])?p.Update(Je(e),{},t):ea(e)}function kd(e,t,n,r){let a=d(e,t,n);return Go(a,r)}function wd(e,t,n,r){return t.visited.includes(r)?n:r in e?d(e,G(t.callstack,[...t.visited,r]),e[r]):n}function Ed(e,t){let n=He(e,t),r=Xe(n);return _e(p.Assign(e,{[t]:r}),t)}function Rd(e,t,n){let r=Fe(e,t,n);return Xe(r)}function Sd(e){let t=z(e);return Xe(t)}function Od(e){let t=e.map(n=>Xe(n));return k(t)}function Pd(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:Cr(e[a])}),{});return v(t)}function Xe(e){return se(e)?Ed(e.$defs,e.$ref):V(e)?Rd(e.if,e.then,e.else):S(e)?Sd(e.allOf):x(e)?Od(e.anyOf):M(e)?Pd(e.properties):v({})}function ta(e,t={}){return I("Required",[e],t)}function Cd(e,t={}){return Uo(e,t)}function Uo(e,t){return T([e])?p.Update(Xe(e),{},t):ta(e,t)}function Md(e,t,n,r){let a=d(e,t,n);return Uo(a,r)}function na(e,t={}){return I("ReturnType",[e],t)}function Ad(e,t={}){return Ko(e,t)}function _b(e){return re(e)?e.returnType:q()}function Ko(e,t){return T([e])?p.Update(_b(e),{},t):na(e,t)}function Ld(e,t,n,r={}){let a=d(e,t,n);return Ko(a,r)}function ra(e,t){return I("With",[e,t],{})}function qd(e,t){return _o(e,t)}function _o(e,t){return T([e])?p.Update(e,{},t):ra(e,t)}function jd(e,t,n,r){let a=d(e,t,n);return _o(a,r)}function zb(e){return vt(e)?j(e.items)?zo(e.items.items):H(e.items)?[e]:ae(e.items)?[e]:[q()]:[e]}function zo(e){return e.reduce((n,r)=>[...n,...zb(r)],[])}function G(e,t){return{callstack:e,visited:t}}function T(e){return i.ShiftLeft(e,(t,n)=>ae(t)?!1:T(n),()=>!0)}function zn(e,t,n){return i.Keys(n).reduce((r,a)=>({...r,[a]:d(e,t,n[a])}),{})}function wt(e,t,n){let r=we(e,t,n);return zo(r)}function we(e,t,n){return n.map(r=>d(e,t,r))}function Bb(e,t){let n=le(e)?$n(t,{}):t,r=qt(e)?vn(n,{}):n;return At(e)?Zn(r,{}):r}function Vb(e,t,n,r,a){return i.IsEqual(n,"AddImmutable")?Fd(e,t,r[0],a):i.IsEqual(n,"RemoveImmutable")?Wc(e,t,r[0],a):i.IsEqual(n,"AddReadonly")?Ai(e,t,r[0],a):i.IsEqual(n,"RemoveReadonly")?Is(e,t,r[0],a):i.IsEqual(n,"AddOptional")?Li(e,t,r[0],a):i.IsEqual(n,"RemoveOptional")?$s(e,t,r[0],a):i.IsEqual(n,"Capitalize")?nl(e,t,r[0],a):i.IsEqual(n,"Conditional")?sl(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"ConstructorParameters")?pl(e,t,r[0],a):i.IsEqual(n,"Evaluate")?jc(e,t,r[0],a):i.IsEqual(n,"Exclude")?cl(e,t,r[0],r[1],a):i.IsEqual(n,"Extract")?fl(e,t,r[0],r[1],a):i.IsEqual(n,"Index")?Dl(e,t,r[0],r[1],a):i.IsEqual(n,"InstanceType")?Gl(e,t,r[0],a):i.IsEqual(n,"Interface")?wc(e,t,r[0],r[1],a):i.IsEqual(n,"KeyOf")?Hl(e,t,r[0],a):i.IsEqual(n,"Lowercase")?rl(e,t,r[0],a):i.IsEqual(n,"Mapped")?Zl(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"Module")?xa(e,t,r[0],a):i.IsEqual(n,"NonNullable")?ed(e,t,r[0],a):i.IsEqual(n,"Pick")?hd(e,t,r[0],r[1],a):i.IsEqual(n,"Parameters")?od(e,t,r[0],a):i.IsEqual(n,"Partial")?ld(e,t,r[0],a):i.IsEqual(n,"Omit")?rd(e,t,r[0],r[1],a):i.IsEqual(n,"ReadonlyObject")?kd(e,t,r[0],a):i.IsEqual(n,"Record")?Ns(e,t,r[0],r[1],a):i.IsEqual(n,"Required")?Md(e,t,r[0],a):i.IsEqual(n,"ReturnType")?Ld(e,t,r[0],a):i.IsEqual(n,"TemplateLiteral")?_u(e,t,r[0],a):i.IsEqual(n,"Uncapitalize")?al(e,t,r[0],a):i.IsEqual(n,"Uppercase")?ol(e,t,r[0],a):i.IsEqual(n,"With")?jd(e,t,r[0],r[1]):I(n,r,a)}function Wb(e,t,n){let r=ae(n)?wd(e,t,n,n.$ref):K(n)?Te(d(e,t,n.items),xr(n)):pn(n)?ga(e,t,n.target,n.arguments):ne(n)?Ge(we(e,t,n.parameters),d(e,t,n.instanceType),qi(n)):re(n)?Ue(we(e,t,n.parameters),d(e,t,n.returnType),ji(n)):V(n)?Mt(d(e,t,n.if),d(e,t,n.then),d(e,t,n.else),Ki(n)):S(n)?de(we(e,t,n.allOf),Wi(n)):M(n)?v(zn(e,t,n.properties),Gi(n)):pe(n)?Gs(Ce(n),d(e,t,ye(n))):vt(n)?Dt(d(e,t,n.items)):j(n)?Q(wt(e,t,n.items),xs(n)):x(n)?k(we(e,t,n.anyOf),ss(n)):n;return Bb(n,r)}function d(e,t,n){return ht(n)?Vb(e,t,n.action,n.parameters,n.options):Wb(e,t,n)}function Bo(e,t){return d(e,G([],[]),t)}function Hb(e){return p.Update(e,{"~immutable":!0},{})}function Zn(e,t){return p.Update(Hb(e),{},t)}function Fd(e,t,n,r){let a=d(e,t,n);return Zn(a,r)}function Up(e,t={}){return I("AddImmutable",[e],t)}function Wt(e,t={}){return Zn(e,t)}function Kp(e,t={}){return I("Evaluate",[e],t)}function Dd(e,t={}){return bo(e,t)}function _p(e,t={}){return I("Module",[e],t)}function Nd(e,t={}){return xa({},G([],[]),e,t)}function Gd(...e){let[t,n,r]=ze.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=Du(n),s=i.IsArray(a)&&i.IsEqual(a.length,2)?d(t,G([],[]),a[0]):q();return p.Update(s,{},r)}var F={};Rt(F,{Any:()=>Vt,Array:()=>Te,BigInt:()=>En,Boolean:()=>kr,Call:()=>Bc,Capitalize:()=>Zc,Codec:()=>Tr,Conditional:()=>il,Constructor:()=>Ge,ConstructorParameters:()=>ml,Cyclic:()=>_e,Decode:()=>Xi,DecodeBuilder:()=>wn,Dependent:()=>Mt,Encode:()=>Zi,EncodeBuilder:()=>kn,Enum:()=>Vi,Evaluate:()=>Dd,Exclude:()=>ul,Extends:()=>me,ExtendsResult:()=>b,Extract:()=>ll,Function:()=>Ue,Generic:()=>gt,Identifier:()=>Rn,Immutable:()=>Qi,Index:()=>hl,Infer:()=>Tn,InstanceType:()=>Nl,Instantiate:()=>Bo,Integer:()=>jt,Interface:()=>Ec,Intersect:()=>de,IsAny:()=>J,IsArray:()=>K,IsBigInt:()=>Ve,IsBoolean:()=>Se,IsCall:()=>pn,IsCodec:()=>$r,IsConstructor:()=>ne,IsCyclic:()=>se,IsDependent:()=>V,IsEnum:()=>fe,IsEnumValue:()=>Bi,IsFunction:()=>re,IsGeneric:()=>Bt,IsIdentifier:()=>rs,IsImmutable:()=>At,IsInfer:()=>H,IsInteger:()=>he,IsIntersect:()=>S,IsKind:()=>y,IsLiteral:()=>A,IsNever:()=>yt,IsNull:()=>Yt,IsNumber:()=>X,IsObject:()=>M,IsOptional:()=>le,IsParameter:()=>is,IsReadonly:()=>qt,IsRecord:()=>pe,IsRef:()=>ae,IsRefine:()=>za,IsRest:()=>vt,IsSchema:()=>ee,IsString:()=>ge,IsSymbol:()=>xt,IsTemplateLiteral:()=>Z,IsThis:()=>Fr,IsTuple:()=>j,IsUndefined:()=>tn,IsUnion:()=>x,IsUnknown:()=>te,IsUnsafe:()=>vr,IsVoid:()=>We,KeyOf:()=>Ul,Literal:()=>O,Lowercase:()=>Qc,Mapped:()=>Yl,Module:()=>Nd,Never:()=>q,NonNullable:()=>Ql,Null:()=>Ht,Number:()=>be,Object:()=>v,Omit:()=>td,Optional:()=>Di,Parameter:()=>Ft,Parameters:()=>ad,Partial:()=>id,Pick:()=>dd,Readonly:()=>es,ReadonlyObject:()=>No,ReadonlyType:()=>gd,Record:()=>Lr,RecordKey:()=>Qt,RecordPattern:()=>Ce,RecordValue:()=>ye,Ref:()=>ot,Refine:()=>ts,Required:()=>Cd,Rest:()=>Dt,ReturnType:()=>Ad,Script:()=>Gd,String:()=>Oe,Symbol:()=>Jt,TemplateLiteral:()=>Bu,This:()=>jr,Tuple:()=>Q,Uncapitalize:()=>el,Undefined:()=>en,Union:()=>k,Unknown:()=>oe,Unsafe:()=>Ui,Uppercase:()=>tl,Void:()=>Dr,With:()=>qd});var Qn="submit_test_gap_candidates",er="submit_filtered_test_gaps",tr="submit_solver_gaps",x4=F.Object({verdict:F.Union([F.Literal("PASS"),F.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:F.String({description:"One short sentence summarizing the verdict."}),reasons:F.Array(F.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:F.Array(F.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 Yb=F.Object({statement:F.String({description:"One sentence from agent_prompt.md, copied verbatim."}),gaps:F.Array(F.Object({description:F.String({description:"A fair, publicly observable missing behavioral test."}),risk:F.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; use an empty array when none exist."})});function Ud(e){return{name:Qn,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:Yb,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 Jb=F.Object({gaps:F.Array(F.Object({description:F.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:F.String({description:"Why this is genuinely grounded in agent_prompt.md or the repo, fair to test per the fairness methodology, and a real (non-duplicate) coverage hole in test.patch \u2014 for negative gaps, cite the prompt's prohibition/constraint and why no existing test catches the forbidden outcome."})}),{description:"The filtered, final list of confirmed test gaps. Use an empty array if none of the candidates survive strict scrutiny."})});function Kd(e){return{name:er,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:Jb,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 Xb=F.Object({gaps:F.Array(F.Object({description:F.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:F.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:F.String({description:"Which solver(s) (by index) exhibit this, and the specific part of their diff that grounds the gap."})}),{description:"Concrete, diff-grounded behavioral gaps \u2014 cases where a passing solver's materially different approach reveals that `test.sh new` under-specifies a real requirement. Use an empty array if the solvers converged on equivalent behavior; do not manufacture gaps just to report something."})});function _d(e){return{name:tr,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:Xb,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 Zb(e){return[e,"You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the task description given to a coding agent), `test.patch` (a unified diff adding the hidden tests that will grade that agent's solution), and `solution.patch` (a unified diff of one golden/reference solution).","Another specialized agent is searching the complementary direction in parallel \u2014 stay in your lane and do not duplicate its work."]}var Qb=["Thoroughness \u2014 your job is high recall on genuine gaps only:","- Find every gap you can justify with concrete evidence. Do not stop after the first obvious ones \u2014 keep reading until you have systematically covered the prompt, `solution.patch`, and relevant repo context.","- After your first pass, run at least one deliberate second sweep (re-read `agent_prompt.md`, re-scan `solution.patch`, grep the repo) before submitting \u2014 but if that sweep still finds nothing, submit an empty list.","- Do not self-censor or merge distinct genuine gaps into one \u2014 the validator will prune. Never invent or pad the list to seem thorough; an empty array is correct when exhaustive analysis truly finds none.","- Hunt subtle gaps too: partial coverage (asserted once but not under other valid inputs), behaviors implied by repo convention, interaction effects, ordering/timing, and branches visible in `solution.patch` that no test forces.","- Include a candidate only when you can cite specific grounding and a concrete false-pass risk \u2014 not to meet a quota."],zd=["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 Bd(e,t){let n=[...Zb("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.","",...Qb,"",...zd,"","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 \`${Qn}\` 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 Vd(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, apply patches, or edit files.","Two specialized research agents reviewed this same task (`agent_prompt.md`, `test.patch`, `solution.patch`, and the repo) 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 structure that only `solution.patch` happens to use. Judge this precisely against the fairness methodology below.","3. A real, distinct coverage hole \u2014 re-check `test.patch` yourself; drop any candidate an existing test already covers, and drop near-duplicate candidates (keep only the clearest phrasing of each distinct gap). For negative-case candidates, keep them only if `test.patch` does not already assert that the forbidden/wrong outcome does not occur.","4. Behaviorally testable through a public contract \u2014 drop candidates that would require an internal helper, private state, implementation structure, call order, DOM class/attribute/data hook, selector, or exact string literal. The sole exceptions are details explicitly named in `agent_prompt.md` or already established as a public contract in the existing repository.","","Be strict: when genuinely unsure whether a candidate holds up, drop it rather than keep it. It is fine \u2014 expected, even \u2014 to return an empty list if none of the candidates survive scrutiny.","","Checklist for the tests focus area, for calibration:",t];return n&&r.push("","Fairness methodology:",n),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 \`${er}\` 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 Wd(){return["You are a software engineer practicing test-driven development in a real git repository (this is your current directory).","`agent_prompt.md` in the repo root describes your task. Tests for it already exist and are currently failing \u2014 that's normal in TDD, the tests come first.","","Goal: make all of the new tests pass.","1. Read `agent_prompt.md`.","2. Run `bash test.sh new` to see the failures and what the tests expect.","3. Read the failing tests \u2014 they are the precise spec \u2014 and the surrounding repo code for conventions and utilities to reuse.","4. Implement the code needed to satisfy both `agent_prompt.md` and the tests, matching repo style.","5. Re-run `bash test.sh new` and iterate until everything passes, or you're confident you can't progress further.","","Rules:","- Do NOT modify the test files or `test.sh`. Only change application/library code.","- You have shell access \u2014 install any dependencies you need.","- Prefer the smallest, most direct change that satisfies the tests and `agent_prompt.md` using existing repo patterns."].join(`
14
- `)}function ev(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 \`${gn}/solver_${e.index}/\``}function Hd(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 \`${gn}/solver_<index>/\` (\`solution.diff\`, \`test_output.txt\`), with a \`${gn}/manifest.json\` summary. Use read/grep/find/ls to open exactly what you need. Status summary:`,"",...e.map(ev),"","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.","",...zd,"- 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 \`${tr}\` 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 tv=900*1e3,Vo=["read","grep","find","ls"];function $a(e){return e==="off"?void 0:e}async function Ta(e,t,n=tv){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 Yd(e){let t={},n=e.model,{session:r}=await ba({cwd:e.tempDir,model:n,thinkingLevel:$a(e.thinkingLevel),tools:[...Vo,Qn],customTools:[Ud(t)],sessionManager:va.inMemory()});try{let a=await Ta(async()=>{await r.prompt(Bd(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 nv=["read","grep","find","ls","write","edit","bash"];async function Jd(e){let t=e.model;try{let n=va.inMemory(),{session:r}=await ba({cwd:e.solverDir,model:t,thinkingLevel:$a(e.thinkingLevel),tools:[...nv],sessionManager:n}),a=await Ta(async()=>{await r.prompt(Wd())},e.cancelSignal,e.timeoutMinutes*60*1e3);return a!=="done"&&await r.abort(),{outcome:a,trajectory:n.getEntries()}}catch{return{outcome:"error",trajectory:[]}}}async function Xd(e){let t={},n=e.model,{session:r}=await ba({cwd:e.tempDir,model:n,thinkingLevel:$a(e.thinkingLevel),tools:[...Vo,tr],customTools:[_d(t)],sessionManager:va.inMemory()});try{let a=await Ta(async()=>{await r.prompt(Hd(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 Zd(e){let t={},n=e.model,{session:r}=await ba({cwd:e.tempDir,model:n,thinkingLevel:$a(e.thinkingLevel),tools:[...Vo,er],customTools:[Kd(t)],sessionManager:va.inMemory()});try{let a=await Ta(async()=>{await r.prompt(Vd(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 nr(e,t,n,r){let a=n>0?Math.min(1,t/n):0,s=Math.round(24*a),m="\u2588".repeat(s)+"\u2591".repeat(Math.max(0,24-s)),c=r?` pass:${r.passed} fail:${r.failed}`:"";return[`checks: ${e} [${m}] ${t}/${n}${c}`]}import{existsSync as rv,readFileSync as av}from"node:fs";var Wo=["agent_prompt.md","solution.patch","test.patch"];function Ho(e=new Date){let t=(s,m=2)=>String(s).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 Qd(e){try{if(!rv(e))return{};let t=JSON.parse(av(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function ef(e){let t={...e.existingReport,timestamp:Ho(),model:`${e.config.provider}/${e.config.modelId}`,thinkingLevel:e.config.thinkingLevel};return delete t.overall,delete t.reports,e.runGapFinder&&(t.testGaps=e.testGaps,e.gapAnalysisIncomplete?t.testGapAnalysisNote=`Gap analysis did not fully complete (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 tf(e){let t=Math.round(e/1e3);return t>=60?`${Math.floor(t/60)}m ${t%60}s`:`${t}s`}function nf(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(s=>({...s,durationMs:s.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(s=>s.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 rf=`## The problem description (aka the task)\r
3
+ `:"";ot($,`${P}${ct}node_modules
4
+ `,"utf-8")}let C=le(n,"node_modules"),ne=le(r,"node_modules");if(Ha(C)&&!Ha(ne))try{Jf(C,ne,process.platform==="win32"?"junction":"dir")}catch{}try{Hf(i,le(r,"agent_prompt.md"))}catch{}let Ie=yr(a,"utf-8"),re=eh(Ie),Pe=le(r,"test.patch");ot(Pe,Ie,"utf-8");let tt=await t.exec("git",["apply","test.patch"],u);try{Xf(Pe)}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:re}}function nh(e){try{let t=yr(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 Ai(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),P=$.code===0?$.stdout:"",C=le(m,"test_output.xml"),ne=`bash test.sh --output_path ${hr(fr(C))} new`,Ie=dr(),re=await t.exec(Ie,["-c",`cd ${hr(fr(m))} && ${ne}`],{timeout:Ja*10}),Pe=re.code===0,tt=th(`${re.stdout}
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="_",ua=".",mu="$",ca="-";var pu="//",uu="/*",Zg="*/";function cu(e){let t=e.indexOf(Zg);return M(t,-1)?"":e.slice(t+2)}function lu(e){let t=e.indexOf(rn);return M(t,-1)?"":e.slice(t)}function Qg(e){return e.replace(/^[ \t\r\f\v]+/,"")}function la(e){let t=Qg(e);return t.startsWith(uu)?la(cu(t.slice(2))):t.startsWith(pu)?la(lu(t.slice(2))):t}function me(e){let t=e.trimStart();return t.startsWith(uu)?me(cu(t.slice(2))):t.startsWith(pu)?me(lu(t.slice(2))):t}function da(e,t){return E(B([e],t),(n,r)=>[n,r],()=>["",t])}function ey(e,t){return e.includes(t)}function an(e,t,n,r=""){return E(B(e,n),(a,i)=>ey(t,a)?an(e,t,i,r):an(e,t,i,`${r}${a}`),()=>[r,n])}function ty(e){return B(lo,e)}var ny=[...nn,$t];function ry(e){return an(ny,[$t],e)}function ay(e){return E(B([co],e),(t,n)=>[t,n],()=>E(ty(e),(t,n)=>E(ry(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[]))}function fa(e){return ay(me(e))}function oy(e){return da(ca,e)}function iy(e){return E(oy(e),(t,n)=>E(fa(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function du(e){return iy(me(e))}function sy(e){return E(du(e),(t,n)=>E(B(["n"],n),(r,a)=>[`${t}`,a],()=>[]),()=>[])}function fo(e){return sy(e)}function ho(e,t){return B([e],t)}function c(e,t){return M(e,"")?["",t]:e.startsWith(rn)?ho(e,la(t)):e.startsWith(su)?ho(e,t):ho(e,me(t))}var fu=[...iu,$t,mu];function my(e){return B(fu,e)}var py=[...fu,...nn];function hu(e,t=""){return E(B(py,e),(n,r)=>hu(r,`${t}${n}`),()=>[t,e])}function uy(e){return E(my(e),(t,n)=>E(hu(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function W(e){return uy(me(e))}var cy=[...nn,$t];function ly(e){return _n(B([ua],e))}function gu(e){return E(an(cy,[$t],e),(t,n)=>M(t,"")?[]:[t,n],()=>[])}function dy(e){return E(B([ua],e),(t,n)=>E(gu(n),(r,a)=>[`0${t}${r}`,a],()=>[]),()=>[])}function fy(e){return E(fa(e),(t,n)=>E(B([ua],n),(r,a)=>E(gu(a),(i,m)=>[`${t}${r}${i}`,m],()=>[`${t}`,a]),()=>[`${t}`,n]),()=>[])}function hy(e){return ly(e)?dy(e):fy(e)}function yu(e){return hy(me(e))}function gy(e){return da(ca,e)}function yy(e){return E(gy(e),(t,n)=>E(yu(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function ha(e){return yy(me(e))}function xy(e){return M(e,"")?[]:[e.slice(0,1),e.slice(1)]}function xu(e,t){return Tr(e,(n,r)=>t.startsWith(n)?!0:xu(r,t),()=>!1)}function Tt(e,t,n=""){return E(xy(t),(r,a)=>xu(e,t)?[n,t]:Tt(e,a,`${n}${r}`),()=>[])}function Iy(e,t,n){return E(B([e],n),(r,a)=>E(Tt([t],a),(i,m)=>E(B([t],m),(u,l)=>[`${i}`,l],()=>[]),()=>[]),()=>[])}function by(e,t,n){return E(B([e],n),(r,a)=>E(Tt([rn,t],a),(i,m)=>E(B([t],m),(u,l)=>[`${i}`,l],()=>[]),()=>[]),()=>[])}function Iu(e,t,n,r){return n?Iy(e,t,me(r)):by(e,t,me(r))}function vy(e,t){return B(e,t)}function $y(e,t){return Iu(e,e,!1,t)}function Ty(e,t){return E(vy(e,t),(n,r)=>$y(n,`${n}${r}`),()=>[])}function ga(e,t){return Ty(e,me(t))}function bu(e,t){return E(Tt(e,t),(n,r)=>M(n,"")?[]:[n,r],()=>[])}var o=(e,t,n=()=>[])=>e.length===2?t(e):n(),wy=e=>o(o(W(e),([t,n])=>o(c("extends",n),([r,a])=>o(R(a),([i,m])=>o(c("=",m),([u,l])=>o(R(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[sm(t),n]),Ey=e=>o(o(W(e),([t,n])=>o(c("extends",n),([r,a])=>o(R(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[mm(t),n]),Ry=e=>o(o(W(e),([t,n])=>o(c("=",n),([r,a])=>o(R(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[pm(t),n]),Sy=e=>o(W(e),([t,n])=>[um(t),n]),Tu=e=>o(o(wy(e),([t,n])=>[t,n],()=>o(Ey(e),([t,n])=>[t,n],()=>o(Ry(e),([t,n])=>[t,n],()=>o(Sy(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),ku=(e,t=[])=>o(o(Tu(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>ku(r,[...t,n]),()=>[t,e]),Oy=e=>o(o(ku(e),([t,n])=>o(o(o(Tu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[cm(t),n]),xo=e=>o(o(c("<",e),([t,n])=>o(Oy(n),([r,a])=>o(c(">",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[lm(t),n]),wu=(e,t=[])=>o(o(R(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(R(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[dm(t),n]),Ay=e=>o(o(c("<",e),([t,n])=>o(Py(n),([r,a])=>o(c(">",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[fm(t),n]),Cy=e=>o(o(W(e),([t,n])=>o(Ay(n),([r,a])=>[[t,r],a])),([t,n])=>[hm(t),n]),Eu=e=>o(o(o(c(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[gm(t),n]),Ru=e=>o(c("string",e),([t,n])=>[ym(t),n]),Su=e=>o(c("number",e),([t,n])=>[xm(t),n]),My=e=>o(c("boolean",e),([t,n])=>[Im(t),n]),Ly=e=>o(c("undefined",e),([t,n])=>[bm(t),n]),qy=e=>o(c("null",e),([t,n])=>[vm(t),n]),Ou=e=>o(c("integer",e),([t,n])=>[$m(t),n]),jy=e=>o(c("bigint",e),([t,n])=>[Tm(t),n]),Fy=e=>o(c("unknown",e),([t,n])=>[km(t),n]),Dy=e=>o(c("any",e),([t,n])=>[wm(t),n]),Gy=e=>o(c("object",e),([t,n])=>[Em(t),n]),Ny=e=>o(c("never",e),([t,n])=>[Rm(t),n]),Pu=e=>o(c("symbol",e),([t,n])=>[Sm(t),n]),Uy=e=>o(c("void",e),([t,n])=>[Om(t),n]),_y=e=>o(c("this",e),([t,n])=>[Pm(t),n]),Ky=e=>o(o(c("${",e),([t,n])=>o(R(n),([r,a])=>o(c("}",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[qm(t),n]),go=e=>o(Tt(["${","`"],e),([t,n])=>[jm(t),n]),Au=e=>o(o(o(go(e),([t,n])=>o(Ky(n),([r,a])=>o(Au(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])=>[Fm(t),n]),Io=e=>o(o(c("`",e),([t,n])=>o(Au(n),([r,a])=>o(c("`",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Dm(t),n]),zy=e=>o(Io(e),([t,n])=>[Gm(t),n]),By=e=>o(o(o(c("if",e),([t,n])=>o(R(n),([r,a])=>o(c("then",a),([i,m])=>o(R(m),([u,l])=>o(c("else",l),([f,h])=>o(R(h),([$,P])=>[[t,r,i,u,f,$],P])))))),([t,n])=>[t,n],()=>o(o(c("if",e),([t,n])=>o(R(n),([r,a])=>o(c("then",a),([i,m])=>o(R(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[Nm(t),n]),Vy=e=>o(fo(e),([t,n])=>[Am(t),n]),Wy=e=>o(o(c("true",e),([t,n])=>[t,n],()=>o(c("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[Cm(t),n]),Hy=e=>o(ha(e),([t,n])=>[Mm(t),n]),Yy=e=>o(ga(["'",'"'],e),([t,n])=>[Lm(t),n]),Jy=e=>o(o(o(c("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Um(t),n]),Cu=(e,t=[])=>o(o(o(c("[",e),([n,r])=>o(R(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])=>Cu(r,[...t,n]),()=>[t,e]),Xy=e=>o(Cu(e),([t,n])=>[_m(t),n]),Zy=e=>o(o(o(c("extends",e),([t,n])=>o(R(n),([r,a])=>o(c("?",a),([i,m])=>o(R(m),([u,l])=>o(c(":",l),([f,h])=>o(R(h),([$,P])=>[[t,r,i,u,f,$],P])))))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Km(t),n]),Qy=e=>o(o(o(c("(",e),([t,n])=>o(R(n),([r,a])=>o(c(")",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o(Ru(e),([t,n])=>[t,n],()=>o(Su(e),([t,n])=>[t,n],()=>o(My(e),([t,n])=>[t,n],()=>o(Ly(e),([t,n])=>[t,n],()=>o(qy(e),([t,n])=>[t,n],()=>o(Ou(e),([t,n])=>[t,n],()=>o(jy(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(Pu(e),([t,n])=>[t,n],()=>o(Uy(e),([t,n])=>[t,n],()=>o(_y(e),([t,n])=>[t,n],()=>o(Vy(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(zy(e),([t,n])=>[t,n],()=>o(By(e),([t,n])=>[t,n],()=>o(lx(e),([t,n])=>[t,n],()=>o(xx(e),([t,n])=>[t,n],()=>o(kx(e),([t,n])=>[t,n],()=>o(Tx(e),([t,n])=>[t,n],()=>o(Sx(e),([t,n])=>[t,n],()=>o(Cy(e),([t,n])=>[t,n],()=>o(Ox(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[zm(t),n]),ex=e=>o(o(o(c("with",e),([t,n])=>o(Hu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Bm(t),n]),Mu=e=>o(o(Jy(e),([t,n])=>o(Qy(n),([r,a])=>o(Xy(a),([i,m])=>o(Zy(m),([u,l])=>o(ex(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[Vm(t),n]),Lu=e=>o(o(o(c("&",e),([t,n])=>o(Mu(n),([r,a])=>o(Lu(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),qu=e=>o(o(Mu(e),([t,n])=>o(Lu(n),([r,a])=>[[t,r],a])),([t,n])=>[Wm(t),n]),ju=e=>o(o(o(c("|",e),([t,n])=>o(qu(n),([r,a])=>o(ju(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ya=e=>o(o(qu(e),([t,n])=>o(ju(n),([r,a])=>[[t,r],a])),([t,n])=>[Hm(t),n]),tx=e=>o(o(c("readonly",e),([t,n])=>o(ya(n),([r,a])=>[[t,r],a])),([t,n])=>[Ym(t),n]),nx=e=>o(o(c("|",e),([t,n])=>o(ya(n),([r,a])=>[[t,r],a])),([t,n])=>[Jm(t),n]),rx=e=>o(o(xo(e),([t,n])=>o(c("=",n),([r,a])=>o(R(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Xm(t),n]),ax=e=>o(o(o(c("infer",e),([t,n])=>o(W(n),([r,a])=>o(c("extends",a),([i,m])=>o(ya(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])=>[Zm(t),n]),R=e=>o(o(ax(e),([t,n])=>[t,n],()=>o(nx(e),([t,n])=>[t,n],()=>o(tx(e),([t,n])=>[t,n],()=>o(ya(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),ox=e=>o(ha(e),([t,n])=>[Qm(t),n]),ix=e=>o(W(e),([t,n])=>[t,n]),sx=e=>o(ga(["'",'"'],e),([t,n])=>[t,n]),mx=e=>o(o(c("[",e),([t,n])=>o(W(n),([r,a])=>o(c(":",a),([i,m])=>o(o(Ou(m),([u,l])=>[u,l],()=>o(Su(m),([u,l])=>[u,l],()=>o(Ru(m),([u,l])=>[u,l],()=>o(Pu(m),([u,l])=>[u,l],()=>[])))),([u,l])=>o(c("]",l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[ep(t),n]),Fu=e=>o(o(ox(e),([t,n])=>[t,n],()=>o(ix(e),([t,n])=>[t,n],()=>o(sx(e),([t,n])=>[t,n],()=>o(mx(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),px=e=>o(o(o(c("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[tp(t),n]),ux=e=>o(o(o(c("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[np(t),n]),Du=e=>o(o(px(e),([t,n])=>o(Fu(n),([r,a])=>o(ux(a),([i,m])=>o(c(":",m),([u,l])=>o(R(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[rp(t),n]),Gu=e=>o(o(o(c(",",e),([t,n])=>o(c(`
7
+ `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c(";",e),([t,n])=>o(c(`
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]),Nu=(e,t=[])=>o(o(Du(e),([n,r])=>o(Gu(r),([a,i])=>[[n,a],i])),([n,r])=>Nu(r,[...t,n]),()=>[t,e]),cx=e=>o(o(Nu(e),([t,n])=>o(o(o(Du(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[ap(t),n]),bo=e=>o(o(c("{",e),([t,n])=>o(cx(n),([r,a])=>o(c("}",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[ip(t),n]),lx=e=>o(bo(e),([t,n])=>[sp(t),n]),dx=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(R(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(R(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(R(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(c(":",n),([r,a])=>o(R(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[mp(t),n]),fx=e=>o(o(c("readonly",e),([t,n])=>o(R(n),([r,a])=>o(c("?",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[pp(t),n]),hx=e=>o(o(c("readonly",e),([t,n])=>o(R(n),([r,a])=>[[t,r],a])),([t,n])=>[up(t),n]),gx=e=>o(o(R(e),([t,n])=>o(c("?",n),([r,a])=>[[t,r],a])),([t,n])=>[cp(t),n]),vu=e=>o(o(dx(e),([t,n])=>[t,n],()=>o(fx(e),([t,n])=>[t,n],()=>o(hx(e),([t,n])=>[t,n],()=>o(gx(e),([t,n])=>[t,n],()=>o(R(e),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),Uu=e=>o(o(o(c("...",e),([t,n])=>o(vu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(vu(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[lp(t),n]),_u=(e,t=[])=>o(o(Uu(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>_u(r,[...t,n]),()=>[t,e]),yx=e=>o(o(_u(e),([t,n])=>o(o(o(Uu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[dp(t),n]),xx=e=>o(o(c("[",e),([t,n])=>o(yx(n),([r,a])=>o(c("]",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[fp(t),n]),Ix=e=>o(o(W(e),([t,n])=>o(c("?",n),([r,a])=>o(c(":",a),([i,m])=>o(c("readonly",m),([u,l])=>o(R(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[hp(t),n]),bx=e=>o(o(W(e),([t,n])=>o(c(":",n),([r,a])=>o(c("readonly",a),([i,m])=>o(R(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[gp(t),n]),vx=e=>o(o(W(e),([t,n])=>o(c("?",n),([r,a])=>o(c(":",a),([i,m])=>o(R(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(R(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[xp(t),n]),$u=e=>o(o(Ix(e),([t,n])=>[t,n],()=>o(bx(e),([t,n])=>[t,n],()=>o(vx(e),([t,n])=>[t,n],()=>o($x(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Ku=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])=>[Ip(t),n]),zu=(e,t=[])=>o(o(Ku(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>zu(r,[...t,n]),()=>[t,e]),Bu=e=>o(o(zu(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])=>[bp(t),n]),Tx=e=>o(o(c("(",e),([t,n])=>o(Bu(n),([r,a])=>o(c(")",a),([i,m])=>o(c("=>",m),([u,l])=>o(R(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[vp(t),n]),kx=e=>o(o(c("new",e),([t,n])=>o(c("(",n),([r,a])=>o(Bu(a),([i,m])=>o(c(")",m),([u,l])=>o(c("=>",l),([f,h])=>o(R(h),([$,P])=>[[t,r,i,u,f,$],P])))))),([t,n])=>[$p(t),n]),wx=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])=>[Tp(t),n]),Ex=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])=>[kp(t),n]),Rx=e=>o(o(o(c("as",e),([t,n])=>o(R(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[wp(t),n]),Sx=e=>o(o(c("{",e),([t,n])=>o(wx(n),([r,a])=>o(c("[",a),([i,m])=>o(W(m),([u,l])=>o(c("in",l),([f,h])=>o(R(h),([$,P])=>o(Rx(P),([C,ne])=>o(c("]",ne),([Ie,re])=>o(Ex(re),([Pe,tt])=>o(c(":",tt),([N,nt])=>o(R(nt),([Ue,ct])=>o(Eu(ct),([rt,lt])=>o(c("}",lt),([zt,dt])=>[[t,r,i,u,f,$,C,Ie,Pe,N,Ue,rt,zt],dt]))))))))))))),([t,n])=>[Ep(t),n]),Ox=e=>o(W(e),([t,n])=>[Rp(t),n]),Px=e=>o(fo(e),([t,n])=>[Sp(t),n]),Ax=e=>o(ha(e),([t,n])=>[Op(t),n]),Cx=e=>o(o(c("true",e),([t,n])=>[t,n],()=>o(c("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[Pp(t),n]),Mx=e=>o(ga(['"',"'"],e),([t,n])=>[t,n]),Lx=e=>o(c("null",e),([t,n])=>[Ap(t),n]),qx=e=>o(c("undefined",e),([t,n])=>[void 0,n]),Vu=e=>o(o(Fu(e),([t,n])=>o(c(":",n),([r,a])=>o(vo(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Cp(t),n]),Wu=(e,t=[])=>o(o(Vu(e),([n,r])=>o(Gu(r),([a,i])=>[[n,a],i])),([n,r])=>Wu(r,[...t,n]),()=>[t,e]),jx=e=>o(o(Wu(e),([t,n])=>o(o(o(Vu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Mp(t),n]),Hu=e=>o(o(c("{",e),([t,n])=>o(jx(n),([r,a])=>o(c("}",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Lp(t),n]),Yu=(e,t=[])=>o(o(vo(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>Yu(r,[...t,n]),()=>[t,e]),Fx=e=>o(o(Yu(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])=>[qp(t),n]),Dx=e=>o(o(c("[",e),([t,n])=>o(Fx(n),([r,a])=>o(c("]",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[jp(t),n]),vo=e=>o(o(Px(e),([t,n])=>[t,n],()=>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(Hu(e),([t,n])=>[t,n],()=>o(Dx(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),Gx=e=>o(c("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[Fp(t),n]),Nx=e=>o(c(".*",e),([t,n])=>[Dp(t),n]),Ux=e=>o(c("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[Gp(t),n]),_x=e=>o(c("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[Np(t),n]),Kx=e=>o(c("(?!)",e),([t,n])=>[Up(t),n]),zx=e=>o(bu(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[_p(t),n]),Bx=e=>o(o(Gx(e),([t,n])=>[t,n],()=>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(Vx(e),([t,n])=>[t,n],()=>o(zx(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),Vx=e=>o(o(c("(",e),([t,n])=>o($o(n),([r,a])=>o(c(")",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Kp(t),n]),Ju=e=>o(o(o(yo(e),([t,n])=>o(c("|",n),([r,a])=>o(Ju(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])=>[zp(t),n]),yo=e=>o(o(Bx(e),([t,n])=>o($o(n),([r,a])=>[[t,r],a])),([t,n])=>[Bp(t),n]),$o=e=>o(o(Ju(e),([t,n])=>[t,n],()=>o(yo(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ks=e=>o(o(c("^",e),([t,n])=>o($o(n),([r,a])=>o(c("$",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Vp(t),n]),Xu=(e,t=[])=>o(o(R(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>Xu(r,[...t,n]),()=>[t,e]),Wx=e=>o(o(Xu(e),([t,n])=>o(o(o(R(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Wp(t),n]),Zu=e=>o(o(o(c("extends",e),([t,n])=>o(Wx(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Hp(t),n]),Hx=e=>o(o(c("interface",e),([t,n])=>o(W(n),([r,a])=>o(xo(a),([i,m])=>o(Zu(m),([u,l])=>o(bo(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[Yp(t),n]),Yx=e=>o(o(c("interface",e),([t,n])=>o(W(n),([r,a])=>o(Zu(a),([i,m])=>o(bo(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[Jp(t),n]),Jx=e=>o(o(c("type",e),([t,n])=>o(W(n),([r,a])=>o(xo(a),([i,m])=>o(c("=",m),([u,l])=>o(R(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(R(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[Zp(t),n]),Zx=e=>o(o(o(c("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Qp(t),n]),Qx=e=>o(o(o(c(";",e),([t,n])=>o(c(`
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 pf(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, apply patches, or edit files.","Two specialized research agents reviewed this same task (`agent_prompt.md`, `test.patch`, `solution.patch`, and the repo) 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 structure that only `solution.patch` happens to use. Judge this precisely against the fairness methodology below.","3. A real, distinct coverage hole \u2014 re-check `test.patch` yourself; drop any candidate an existing test already covers, and drop near-duplicate candidates (keep only the clearest phrasing of each distinct gap). For negative-case candidates, keep them only if `test.patch` does not already assert that the forbidden/wrong outcome does not occur.","4. Behaviorally testable through a public contract \u2014 drop candidates that would require an internal helper, private state, implementation structure, call order, DOM class/attribute/data hook, selector, or exact string literal. The sole exceptions are details explicitly named in `agent_prompt.md` or already established as a public contract in the existing repository.","","Be strict: when genuinely unsure whether a candidate holds up, drop it rather than keep it. It is fine \u2014 expected, even \u2014 to return an empty list if none of the candidates survive scrutiny.","","Checklist for the tests focus area, for calibration:",t];return n&&r.push("","Fairness methodology:",n),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 uf(){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 Iv(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 cf(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(Iv),"","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.","",...sf,"- 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 bv=900*1e3,ri=["read","grep","find","ls"];function Sa(e){return e==="off"?void 0:e}async function Oa(e,t,n=bv){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 Pa(e){let t={},n=e.model,{session:r}=await Ea({cwd:e.tempDir,model:n,thinkingLevel:Sa(e.thinkingLevel),tools:[...ri,nr],customTools:[rf(t)],sessionManager:Ra.inMemory()});try{let a=await Oa(async()=>{await r.prompt(mf(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 vv=["read","grep","find","ls","write","edit","bash"];async function lf(e){let t=e.model;try{let n=Ra.inMemory(),{session:r}=await Ea({cwd:e.solverDir,model:t,thinkingLevel:Sa(e.thinkingLevel),tools:[...vv],sessionManager:n}),a=await Oa(async()=>{await r.prompt(uf())},e.cancelSignal,e.timeoutMinutes*60*1e3);return a!=="done"&&await r.abort(),{outcome:a,trajectory:n.getEntries()}}catch{return{outcome:"error",trajectory:[]}}}async function df(e){let t={},n=e.model,{session:r}=await Ea({cwd:e.tempDir,model:n,thinkingLevel:Sa(e.thinkingLevel),tools:[...ri,ar],customTools:[of(t)],sessionManager:Ra.inMemory()});try{let a=await Oa(async()=>{await r.prompt(cf(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 Aa(e){let t={},n=e.model,{session:r}=await Ea({cwd:e.tempDir,model:n,thinkingLevel:Sa(e.thinkingLevel),tools:[...ri,rr],customTools:[af(t)],sessionManager:Ra.inMemory()});try{let a=await Oa(async()=>{await r.prompt(pf(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 $v,readFileSync as Tv}from"node:fs";var ir=["agent_prompt.md","solution.patch","test.patch"];function ai(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 ff(e){try{if(!$v(e))return{};let t=JSON.parse(Tv(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function hf(e){let t={...e.existingReport,timestamp:ai(),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 gf(e){let t=Math.round(e/1e3);return t>=60?`${Math.floor(t/60)}m ${t%60}s`:`${t}s`}function yf(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 xf=`## 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).`,ov=`# Agent Evaluation Guidelines\r
42
+ S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,kv=`# 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,5 +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 af(){return(rf.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??rf).trim()}function of(){return ov.trim()}var ka=!1,fn;function wa(){return ka}function sf(){return ka=!0,fn=new AbortController,fn}function mf(){ka=!1,fn=void 0}function pf(){return!ka||!fn||fn.signal.aborted?!1:(fn.abort(),!0)}var lv="Ctrl+Shift+X",Yo=[{value:"--gap-finder",label:"--gap-finder",description:"Find and validate behavioral test-coverage gaps"},{value:"--solver-gap-finder",label:"--solver-gap-finder",description:"Use TDD solver attempts to find behavioral gaps"},{value:"--config",label:"--config",description:"Configure gap-finder models"}];function dv(e){let t=e.trimStart(),n=/\s$/.test(t),r=t.trimEnd().split(/\s+/).filter(Boolean),a=n?"":r.at(-1)??"",s=new Set(n?r:r.slice(0,-1)),m=n?t:t.slice(0,t.length-a.length),c=s.has("--config"),l=[...s].some(f=>f!=="--config"),h=Yo.filter(f=>!s.has(f.value)&&!c&&!(l&&f.value==="--config")&&f.value.startsWith(a));return h.length?h.map(f=>({...f,value:`${m}${f.value}`})):null}async function hf(e,t,n){let r=ci();if(r.length===0)return e.ui.notify("No enabledModels configured in settings.json.","error"),null;let a=e.modelRegistry.getAll(),s=r.map(h=>{let f=li(h);if(!f)return null;let w=a.find(ue=>ue.provider===f.provider&&ue.id===f.modelId),D=t?.provider===f.provider&&t?.modelId===f.modelId,_=w?`${w.name} (${h})`:h;return{ref:h,parsed:f,display:D?`${_} [current]`:_,isCurrent:D}}).filter(h=>h!==null);if(s.length===0)return e.ui.notify("Could not resolve any enabledModels entries.","error"),null;let m=[...s].sort((h,f)=>h.isCurrent===f.isCurrent?0:h.isCurrent?-1:1),c=await e.ui.select(n,m.map(h=>h.display));if(!c)return null;let l=s.find(h=>h.display===c);return l?{provider:l.parsed.provider,modelId:l.parsed.modelId}:null}function Ra(e,t,n){let r=e.modelRegistry.getAll().find(a=>a.provider===t&&a.id===n);return pi(r)}var Ea={provider:"",modelId:"",thinkingLevel:"off",timeoutMinutes:Aa,solverCount:qa,saveArtifacts:ja};function gf(e,t,n){let r=t?Ra(e,t.provider,t.modelId):["off"],a=n.provider?Ra(e,n.provider,n.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:r},{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:a},{id:"solvergap-timeout",section:"Solver",label:"Timeout",value:`${n.timeoutMinutes} min`,kind:"cycle",values:[10,20,30,40,50,si].filter((s,m,c)=>s>=ii&&c.indexOf(s)===m).map(s=>`${s} min`)},{id:"solvergap-solver-count",section:"Solver",label:"Parallel agents",value:String(n.solverCount),kind:"cycle",values:Array.from({length:mi-La+1},(s,m)=>`${La+m}`)},{id:"solvergap-save-artifacts",section:"Solver",label:"Save artifacts",value:n.saveArtifacts?"on":"off",kind:"cycle",values:["on","off"]}]}var Jo=class{constructor(t,n,r,a,s,m){this.ctx=t;this.settingsListTheme=n;this.theme=r;this.onCycleSaved=a;this.onActivateModel=s;this.onExit=m;this.rows=gf(t,lt(),lt()?.solverGap??Ea)}selectedIndex=0;rows;refresh(){let t=lt();this.rows=gf(this.ctx,t,t?.solverGap??Ea),this.selectedIndex=Math.min(this.selectedIndex,this.rows.length-1)}invalidate(){}render(t){let n=[],r=Math.min(30,Math.max(...this.rows.map(s=>s.label.length))),a;for(let s=0;s<this.rows.length;s++){let m=this.rows[s];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 c=s===this.selectedIndex,l=c?this.settingsListTheme.cursor:" ",h=m.label+" ".repeat(Math.max(0,r-m.label.length)),f=this.settingsListTheme.label(h,c),w=this.settingsListTheme.value(m.value,c);n.push(`${l}${f} ${w}`)}return n}handleInput(t){if(_t(t,Kt.ctrl("s"))||_t(t,Kt.escape)||_t(t,Kt.ctrl("c"))){this.onExit();return}if(_t(t,Kt.up)){this.selectedIndex=this.selectedIndex===0?this.rows.length-1:this.selectedIndex-1;return}if(_t(t,Kt.down)){this.selectedIndex=this.selectedIndex===this.rows.length-1?0:this.selectedIndex+1;return}if(_t(t,Kt.enter)||_t(t,Kt.return)||t===" "){let 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=lt();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??Ea,s=n.values.indexOf(n.value),m=n.values[(s+1)%n.values.length];if(m===void 0)return;n.id==="reviewer-thinking"?dt({...r,thinkingLevel:m,solverGap:a}):n.id==="solvergap-thinking"?dt({...r,solverGap:{...a,thinkingLevel:m}}):n.id==="solvergap-timeout"?dt({...r,solverGap:{...a,timeoutMinutes:Number.parseInt(m,10)}}):n.id==="solvergap-solver-count"?dt({...r,solverGap:{...a,solverCount:Number.parseInt(m,10)}}):n.id==="solvergap-save-artifacts"&&dt({...r,solverGap:{...a,saveArtifacts:m==="on"}}),this.refresh(),this.onCycleSaved()}}};async function fv(e){if(e.mode!=="tui"){e.ui.notify("/checks --config requires interactive mode","error");return}let t=0;for(;;){let n=await e.ui.custom((s,m,c,l)=>{let h=new Jo(e,pv(),m,()=>s.requestRender(),w=>l(w),()=>l(void 0));h.selectedIndex=t;let f=new uv;return f.addChild(new ff(m.bold(m.fg("accent","Checks settings")))),f.addChild({render:w=>h.render(w),invalidate:()=>h.invalidate()}),f.addChild(new cv(1)),f.addChild(new ff(m.fg("dim","\u2191\u2193 navigate enter select ctrl+s save & exit esc cancel"))),{render(w){return f.render(w)},invalidate(){f.invalidate()},handleInput(w){h.handleInput(w),t=h.selectedIndex,s.requestRender()}}});if(!n)return;let r=lt(),a=r?.solverGap??Ea;if(n==="reviewer-model"){let s=await hf(e,r,"Select reviewer model");if(!s)continue;let m=Ra(e,s.provider,s.modelId),c=m.includes(r?.thinkingLevel??"off")?r?.thinkingLevel??"off":m[0]??"off";dt({...s,thinkingLevel:c,solverGap:a}),e.ui.notify(`Reviewer model saved: ${s.provider}/${s.modelId}`,"info");continue}if(n==="solvergap-model"){if(!r){e.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");continue}let s=await hf(e,a.provider?a:null,"Select solver model");if(!s)continue;let m=Ra(e,s.provider,s.modelId),c=m.includes(a.thinkingLevel)?a.thinkingLevel:m[0]??"off";dt({...r,solverGap:{...a,...s,thinkingLevel:c}}),e.ui.notify(`Solver model saved: ${s.provider}/${s.modelId}`,"info")}}}function yf(e){e.registerCommand("checks",{description:"Find behavioral gaps in test coverage. Requires an option \u2014 see /checks.",getArgumentCompletions:dv,handler:async(t,n)=>{let r=t.trim();if(!r){n.ui.notify(Yo.map(N=>`${N.value} \u2014 ${N.description}`).join(`
323
- `),"info");return}let a=[...new Set(r.split(/\s+/).filter(Boolean))],s=new Set(Yo.map(N=>N.value)),m=a.filter(N=>!s.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 fv(n);return}let c=a.includes("--gap-finder"),l=a.includes("--solver-gap-finder");if(!c&&!l)return;if(wa()){n.ui.notify("A checks run is already in progress.","warning");return}let h=lt();if(!h){n.ui.notify("No gap-finder model configured. Run /checks --config first.","error");return}let f=n.modelRegistry.find(h.provider,h.modelId);if(!f||!n.modelRegistry.hasConfiguredAuth(f)){n.ui.notify("Configured behavioral gap-finder model is unavailable or unauthenticated. Run /checks --config.","error");return}let w=Wo.filter(N=>!cf(Ze(n.cwd,N)));if(w.length){n.ui.notify(`Missing required file(s): ${w.join(", ")}`,"error");return}let D=null,_;if(l){if(D=ui(),!D||!cf(Ze(n.cwd,"test.sh"))){n.ui.notify("Configure solver gap finder and provide test.sh before running it.","error");return}if(_=n.modelRegistry.find(D.provider,D.modelId),!_||!n.modelRegistry.hasConfiguredAuth(_)){n.ui.notify("Configured solver gap-finder model is unavailable or unauthenticated.","error");return}}let ue=sf(),Me=D?.solverCount??0,Re=(c?2:0)+(l?Me+1:0);n.ui.setWidget(Et,nr("preparing clean snapshot",0,Re)),n.ui.notify(`gap finders (${a.join(" ")}) started. Press ${lv} to cancel.`,"info");let De,Qe=[];try{let N=Ze(df(),`checks-${uf()}`);lf(N,{recursive:!0}),De=N;let et=await ur(e,n.cwd,N);if(et.status==="error"){n.ui.notify(`checks: ${et.error}`,"error");return}for(let Ae of Wo)iv(Ze(n.cwd,Ae),Ze(N,Ae));let Ne=af(),pt=of(),tt=0,ut={status:"ok",gaps:[]},zt={status:"ok",gaps:[]};if(c){let Ae={tempDir:N,model:f,thinkingLevel:h.thinkingLevel,testRubric:Ne,fairnessRules:pt,cancelSignal:ue.signal};if(n.ui.setWidget(Et,nr("finding sentence-by-sentence test gaps",tt,Re)),ut=await Yd(Ae),tt+=1,n.ui.setWidget(Et,nr("reviewing test gaps",tt,Re)),ut.gaps.reduce((Oa,Pa)=>Oa+Pa.gaps.length,0)>0&&(zt=await Zd({...Ae,statementReports:ut.gaps})),tt+=1,ue.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let ct=[],rr={status:"ok",gaps:[]};if(l&&D){let Ae=[],Sa=nt=>{Ae.push(nt),tt+=1,n.ui.setWidget(Et,nr("solver gap finder: solving",tt,Re,{passed:Ae.filter(Le=>Le.passed).length,failed:Ae.filter(Le=>!Le.passed).length}))},Oa=await Promise.all(Array.from({length:Me},async(nt,Le)=>{let hn=Ze(df(),`checks-solvergap-${uf()}`);return lf(hn,{recursive:!0}),Qe.push(hn),{index:Le+1,setup:await fi({pi:e,repoDir:n.cwd,solverDir:hn,testPatchPath:Ze(n.cwd,"test.patch"),agentPromptPath:Ze(n.cwd,"agent_prompt.md")})}})),Pa=Ho().replace(/[:.]/g,"-");if(ct=await Promise.all(Oa.map(async({index:nt,setup:Le})=>{if(Le.status!=="ok"){let ri={index:nt,status:Le.status,passed:!1,diff:"",testOutputTail:Le.error,durationMs:0,totalTests:null,failedTests:null};return Sa(ri),ri}let hn=Date.now(),{outcome:ti,trajectory:bf}=await Jd({pi:e,solverDir:Le.solverDir,model:_,thinkingLevel:D.thinkingLevel,timeoutMinutes:D.timeoutMinutes,cancelSignal:ue.signal}),{testOutputXmlPath:vf,...Ca}=await hi({pi:e,index:nt,workspace:Le,status:ti==="done"?"ok":ti,durationMs:Date.now()-hn}),$f=D.saveArtifacts?gi({repoDir:n.cwd,runId:Pa,index:nt,trajectory:bf,solutionPatch:Ca.diff,testOutputXmlPath:vf,testOutputTail:Ca.testOutputTail}):void 0,ni={...Ca,artifactsDir:$f};return Sa(ni),ni})),ct.some(nt=>nt.status!=="patchFailed"&&nt.status!=="error")&&(yi(N,ct),rr=await Xd({tempDir:N,model:f,thinkingLevel:h.thinkingLevel,solverResults:ct,testRubric:Ne,fairnessRules:pt,cancelSignal:ue.signal})),tt+=1,ue.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let If=c&&(ut.status!=="ok"||ut.gaps.length>0&&zt.status!=="ok"),Zo=ef({existingReport:Qd(Ze(n.cwd,"shipd_report.json")),config:h,runGapFinder:c,testGaps:zt.gaps,gapAnalysisIncomplete:If,gapFinderStatus:ut.status,gapFilterStatus:zt.status,runSolverGapFinder:l,solverResults:ct,solverGaps:rr.gaps,solverGapAnalysisIncomplete:l&&(ct.some(Ae=>Ae.status==="error")||rr.status!=="ok"),solverComparisonStatus:rr.status}),Qo=nf({merged:Zo,runGapFinder:c,runSolverGapFinder:l});e.sendMessage({customType:"shipd_checks_report",content:Qo.content,display:!0,details:Qo.details});let ei=Ze(n.cwd,"shipd_report.json");mv(ei,JSON.stringify(Zo,null,2),"utf-8"),n.ui.notify(`checks: wrote details to ${ei}`,"info")}catch(N){n.ui.notify(`checks failed: ${N instanceof Error?N.message:String(N)}`,"error")}finally{n.ui.setWidget(Et,void 0),De&&sv(De,{recursive:!0,force:!0});for(let N of Qe)xi(N);mf()}}})}var xf=gv.ctrlShift("x");function xv(e){e.registerMessageRenderer("shipd_checks_report",(t,n,r)=>{let a=t.details??{},s=new hv;s.addChild(new Xo(r.bold(r.fg("accent","Checks")),0,0));let m=!1,c=l=>{s.addChild(new Xo(l,0,0)),m=!0};if(a.showGaps){let l=a.gapsCount??0;c(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??[],h=l.filter(_=>_.passed).length,f=a.solverGapsCount??0;s.addChild(new yv(1)),c(r.bold(r.fg("accent","Solver gap finder")));for(let _ of l){let ue=_.passed?r.fg("success","\u2713"):r.fg("error","\u2717"),Me=_.passed?"passed":_.status==="ok"?"failed tests":_.status;c(` ${ue} Solver ${_.index}: ${Me} (${tf(_.durationMs)})`)}let w=h===l.length&&l.length>0?r.fg("success",`${h}/${l.length} solvers passed`):r.fg("warning",`${h}/${l.length} solvers passed`),D=f>0?r.fg("warning",`${f} behavioral gap(s) found`):r.fg("success","no behavioral gaps found");c(` ${w}, ${D}`)}return m||s.addChild(new Xo(r.fg("dim"," nothing to report"),0,0)),s}),e.registerShortcut(xf,{description:"Cancel an in-progress /checks run",handler:t=>{wa()&&pf()&&(t.ui.setWidget(Et,[`checks: cancelling (${xf})...`]),t.ui.notify("checks: cancelling...","warning"))}}),yf(e)}export{xv as default};
322
+ ---`;function Ca(){return(xf.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??xf).trim()}function Ma(){return kv.trim()}var La=!1,fn;function qa(){return La}function If(){return La=!0,fn=new AbortController,fn}function bf(){La=!1,fn=void 0}function vf(){return!La||!fn||fn.signal.aborted?!1:(fn.abort(),!0)}import{existsSync as wv}from"node:fs";import{join as Ev}from"node:path";import{Text as $f}from"@earendil-works/pi-tui";var sr="analyze_test_gaps";function Tf(e){e.registerTool({name:sr,label:"Analyze Test Gaps",description:"Run the sentence-by-sentence behavioral test-gap analysis on the current benchmark task, directly in the current working directory (agent_prompt.md, test.patch, solution.patch, and the real repo 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 patches any 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 $f("",0,0);return i.setText("analyze_test_gaps"),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?` ${r.fg("muted",`${m} ${Rv(u-i.startedAt)}`)}`:"",f=(t.content??[]).map($=>$.type==="text"?$.text:"").join(`
323
+ `),h=a.lastComponent??new $f("",0,0);return h.setText(`${l.trimStart()}
324
+ ${f}`),h},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=ir.filter(re=>!wv(Ev(i.cwd,re)));if(m.length>0)throw new Error(`Missing required file(s) in project root: ${m.join(", ")}`);let u=Ei()??we(),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 P={tempDir:i.cwd,model:f,thinkingLevel:h,testRubric:Ca(),fairnessRules:Ma(),cancelSignal:$.signal};a?.({content:[{type:"text",text:"Finding behavioral test gaps sentence by sentence..."}],details:{}});let C=await Pa(P);if($.signal.aborted)throw new Error("Cancelled by user.");if(C.status!=="ok")throw new Error(`Gap finder did not complete (status: ${C.status}).`);let ne=C.gaps.reduce((re,Pe)=>re+Pe.gaps.length,0),Ie=[];if(ne>0){a?.({content:[{type:"text",text:`Validating ${ne} candidate gap(s)...`}],details:{}});let re=await Aa({...P,statementReports:C.gaps});if($.signal.aborted)throw new Error("Cancelled by user.");if(re.status!=="ok")throw new Error(`Gap review did not complete (status: ${re.status}).`);Ie=re.gaps}return{content:[{type:"text",text:Sv(Ie)}],details:{testGaps:Ie}}}})}function Rv(e){return`${Math.floor(e/1e3)}s`}function Sv(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
+ Justification: ${n.justification}`)].join(`
326
+ `)}var oi=!1,kf=!1,hn=!1;function ii(e){return e.getActiveTools().map(n=>typeof n=="string"?n:n.name)}function si(){return oi}function Ov(e){return ii(e).includes(sr)}function ja(e){return si()!==Ov(e)}function Pv(e){kf||(Tf(e),kf=!0)}function Av(e,t){let n=ii(e);if(t){if(n.length===0){hn=!0;return}let r=new Set(n);r.add(sr),r.size!==n.length&&e.setActiveTools([...r])}else{let r=n.filter(a=>a!==sr);r.length!==n.length&&e.setActiveTools(r)}hn=ja(e)}function mr(e){let t=si();t&&Pv(e),Av(e,t)}function mi(e){oi=xn(),hn=!0,wf(e)}function wf(e,t=0){let n=si(),r=ii(e);if(n&&r.length===0&&t<8){queueMicrotask(()=>wf(e,t+1));return}mr(e)}function Ef(e){for(let t of[0,50,150,400])setTimeout(()=>{(hn||ja(e))&&mr(e)},t)}function Rf(){return hn}function Sf(e){oi=xn(),hn=!0,mr(e)}var Dv="Ctrl+Shift+X",ui=[{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 Gv(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=ui.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 pi(e,t,n){let r=Ri();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=Si(f);if(!h)return null;let $=a.find(ne=>ne.provider===h.provider&&ne.id===h.modelId),P=t?.provider===h.provider&&t?.modelId===h.modelId,C=$?`${$.name} (${f})`:f;return{ref:f,parsed:h,display:P?`${C} [current]`:C,isCurrent:P}}).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 ki(r)}var Fa={provider:"",modelId:"",thinkingLevel:"off",timeoutMinutes:za,solverCount:Va,saveArtifacts:Wa},Da={provider:"",modelId:"",thinkingLevel:"off"};function Lf(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,$i].filter((u,l,f)=>u>=vi&&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:Ti-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 ci=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=Lf(t,we(),we()?.solverGap??Fa,we()?.analyzeGap??Da)}selectedIndex=0;rows;refresh(){let t=we();this.rows=Lf(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=we();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 Nv(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 ci(t,qv(),l,()=>{Sf(e),u.requestRender()},C=>h(C),()=>h(void 0));$.selectedIndex=n;let P=new jv;return P.addChild(new Mf(l.bold(l.fg("accent","Checks settings")))),P.addChild({render:C=>$.render(C),invalidate:()=>$.invalidate()}),P.addChild(new Fv(1)),P.addChild(new Mf(l.fg("dim","\u2191\u2193 navigate enter select ctrl+s save & exit esc cancel"))),{render(C){return P.render(C)},invalidate(){P.invalidate()},handleInput(C){$.handleInput(C),n=$.selectedIndex,u.requestRender()}}});if(!r)return;let a=we(),i=a?.solverGap??Fa,m=a?.analyzeGap??Da;if(r==="reviewer-model"){let u=await pi(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 pi(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 pi(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 qf(e){e.registerCommand("checks",{description:"Find behavioral gaps in test coverage. Requires an option \u2014 see /checks.",getArgumentCompletions:Gv,handler:async(t,n)=>{let r=t.trim();if(!r){n.ui.notify(ui.map(N=>`${N.value} \u2014 ${N.description}`).join(`
327
+ `),"info");return}let a=[...new Set(r.split(/\s+/).filter(Boolean))],i=new Set(ui.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 Nv(e,n);return}let u=a.includes("--gap-finder"),l=a.includes("--solver-gap-finder");if(!u&&!l)return;if(qa()){n.ui.notify("A checks run is already in progress.","warning");return}let f=we();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 $=ir.filter(N=>!Pf(et(n.cwd,N)));if($.length){n.ui.notify(`Missing required file(s): ${$.join(", ")}`,"error");return}let P=null,C;if(l){if(P=wi(),!P||!Pf(et(n.cwd,"test.sh"))){n.ui.notify("Configure solver gap finder and provide test.sh before running it.","error");return}if(C=n.modelRegistry.find(P.provider,P.modelId),!C||!n.modelRegistry.hasConfiguredAuth(C)){n.ui.notify("Configured solver gap-finder model is unavailable or unauthenticated.","error");return}}let ne=If(),Ie=P?.solverCount??0,re=(u?2:0)+(l?Ie+1:0);n.ui.setWidget(Et,or("preparing clean snapshot",0,re)),n.ui.notify(`gap finders (${a.join(" ")}) started. Press ${Dv} to cancel.`,"info");let Pe,tt=[];try{let N=et(Cf(),`checks-${Of()}`);Af(N,{recursive:!0}),Pe=N;let nt=await gr(e,n.cwd,N);if(nt.status==="error"){n.ui.notify(`checks: ${nt.error}`,"error");return}for(let qe of ir)Cv(et(n.cwd,qe),et(N,qe));let Ue=Ca(),ct=Ma(),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:ne.signal};if(n.ui.setWidget(Et,or("finding sentence-by-sentence test gaps",rt,re)),lt=await Pa(qe),rt+=1,n.ui.setWidget(Et,or("reviewing test gaps",rt,re)),lt.gaps.reduce((Na,Ua)=>Na+Ua.gaps.length,0)>0&&(zt=await Aa({...qe,statementReports:lt.gaps})),rt+=1,ne.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let dt=[],pr={status:"ok",gaps:[]};if(l&&P){let qe=[],Ga=at=>{qe.push(at),rt+=1,n.ui.setWidget(Et,or("solver gap finder: solving",rt,re,{passed:qe.filter(je=>je.passed).length,failed:qe.filter(je=>!je.passed).length}))},Na=await Promise.all(Array.from({length:Ie},async(at,je)=>{let yn=et(Cf(),`checks-solvergap-${Of()}`);return Af(yn,{recursive:!0}),tt.push(yn),{index:je+1,setup:await Pi({pi:e,repoDir:n.cwd,solverDir:yn,testPatchPath:et(n.cwd,"test.patch"),agentPromptPath:et(n.cwd,"agent_prompt.md")})}})),Ua=ai().replace(/[:.]/g,"-");if(dt=await Promise.all(Na.map(async({index:at,setup:je})=>{if(je.status!=="ok"){let xi={index:at,status:je.status,passed:!1,diff:"",testOutputTail:je.error,durationMs:0,totalTests:null,failedTests:null};return Ga(xi),xi}let yn=Date.now(),{outcome:gi,trajectory:Df}=await lf({pi:e,solverDir:je.solverDir,model:C,thinkingLevel:P.thinkingLevel,timeoutMinutes:P.timeoutMinutes,cancelSignal:ne.signal}),{testOutputXmlPath:Gf,..._a}=await Ai({pi:e,index:at,workspace:je,status:gi==="done"?"ok":gi,durationMs:Date.now()-yn}),Nf=P.saveArtifacts?Ci({repoDir:n.cwd,runId:Ua,index:at,trajectory:Df,solutionPatch:_a.diff,testOutputXmlPath:Gf,testOutputTail:_a.testOutputTail}):void 0,yi={..._a,artifactsDir:Nf};return Ga(yi),yi})),dt.some(at=>at.status!=="patchFailed"&&at.status!=="error")&&(Mi(N,dt),pr=await df({tempDir:N,model:h,thinkingLevel:f.thinkingLevel,solverResults:dt,testRubric:Ue,fairnessRules:ct,cancelSignal:ne.signal})),rt+=1,ne.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let Ff=u&&(lt.status!=="ok"||lt.gaps.length>0&&zt.status!=="ok"),di=hf({existingReport:ff(et(n.cwd,"shipd_report.json")),config:f,runGapFinder:u,testGaps:zt.gaps,gapAnalysisIncomplete:Ff,gapFinderStatus:lt.status,gapFilterStatus:zt.status,runSolverGapFinder:l,solverResults:dt,solverGaps:pr.gaps,solverGapAnalysisIncomplete:l&&(dt.some(qe=>qe.status==="error")||pr.status!=="ok"),solverComparisonStatus:pr.status}),fi=yf({merged:di,runGapFinder:u,runSolverGapFinder:l});e.sendMessage({customType:"shipd_checks_report",content:fi.content,display:!0,details:fi.details});let hi=et(n.cwd,"shipd_report.json");Lv(hi,JSON.stringify(di,null,2),"utf-8"),n.ui.notify(`checks: wrote details to ${hi}`,"info")}catch(N){n.ui.notify(`checks failed: ${N instanceof Error?N.message:String(N)}`,"error")}finally{n.ui.setWidget(Et,void 0),Pe&&Mv(Pe,{recursive:!0,force:!0});for(let N of tt)Li(N);bf()}}})}var jf=_v.ctrlShift("x");function zv(e){e.registerMessageRenderer("shipd_checks_report",(t,n,r)=>{let a=t.details??{},i=new Uv;i.addChild(new li(r.bold(r.fg("accent","Checks")),0,0));let m=!1,u=l=>{i.addChild(new li(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(C=>C.passed).length,h=a.solverGapsCount??0;i.addChild(new Kv(1)),u(r.bold(r.fg("accent","Solver gap finder")));for(let C of l){let ne=C.passed?r.fg("success","\u2713"):r.fg("error","\u2717"),Ie=C.passed?"passed":C.status==="ok"?"failed tests":C.status;u(` ${ne} Solver ${C.index}: ${Ie} (${gf(C.durationMs)})`)}let $=f===l.length&&l.length>0?r.fg("success",`${f}/${l.length} solvers passed`):r.fg("warning",`${f}/${l.length} solvers passed`),P=h>0?r.fg("warning",`${h} behavioral gap(s) found`):r.fg("success","no behavioral gaps found");u(` ${$}, ${P}`)}return m||i.addChild(new li(r.fg("dim"," nothing to report"),0,0)),i}),e.registerShortcut(jf,{description:"Cancel an in-progress /checks run",handler:t=>{qa()&&vf()&&(t.ui.setWidget(Et,[`checks: cancelling (${jf})...`]),t.ui.notify("checks: cancelling...","warning"))}}),Bv(e),qf(e)}function Bv(e){e.on("session_start",(t,n)=>{mi(e),(t.reason==="resume"||t.reason==="reload"||t.reason==="startup")&&Ef(e)}),e.on("session_tree",()=>{mi(e)}),e.on("before_agent_start",()=>{!Rf()&&!ja(e)||mr(e)})}export{zv as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sreetej510/pi-shipd-checks",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
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",