@sreetej510/pi-shipd-checks 0.1.13 → 0.1.15

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 +20 -47
  2. package/dist/index.js +15 -16
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,9 +1,7 @@
1
1
  # @sreetej510/pi-shipd-checks
2
2
 
3
- A [pi](https://github.com/earendil-works/pi) coding agent extension that runs a strict,
4
- multi-agent review of a benchmark task's `agent_prompt.md`, `test.patch`, and `solution.patch`
5
- against a fairness rubric, and finds behavioral test-coverage gaps that could let an incorrect
6
- agent solution slip past the hidden tests.
3
+ A [pi](https://github.com/earendil-works/pi) coding agent extension that finds behavioral
4
+ coverage gaps in a benchmark task's hidden tests.
7
5
 
8
6
  ## What it does
9
7
 
@@ -14,15 +12,10 @@ For the flags you pass, `/checks`:
14
12
  uncommitted changes.
15
13
  2. Copies `agent_prompt.md`, `solution.patch`, and `test.patch` from your project root into
16
14
  that temp dir.
17
- 3. Spawns one read-only reviewer agent per focus area you selected — **description**, **tests**,
18
- **solution** — each restricted to `read`/`grep`/`find`/`ls` tools plus a single
19
- `submit_review_report` tool it must call with a structured `PASS`/`FAIL` verdict, reasons,
20
- and notes.
21
- 4. Optionally runs a 3-agent behavioral test-gap analysis: two specialized finders
15
+ 3. Optionally runs a 3-agent behavioral test-gap analysis: two specialized finders
22
16
  run in parallel (positive required-behavior gaps + negative forbidden-behavior gaps),
23
- then a strict validator filters the combined list. This never turns a `PASS` into a
24
- `FAIL` it's purely informational.
25
- 5. Optionally runs the solver gap finder: several (configurable, default 3) TDD-style solver
17
+ then a strict validator filters the combined list.
18
+ 4. Optionally runs the solver gap finder: several (configurable, default 3) TDD-style solver
26
19
  agents, each in its own throwaway git repo with `test.patch` and `agent_prompt.md` applied
27
20
  (never `solution.patch`), given write/edit/bash access to iterate until `./test.sh new`
28
21
  passes or they give up. The extension independently re-verifies each
@@ -36,58 +29,38 @@ For the flags you pass, `/checks`:
36
29
  `agent_prompt.md`/`solution.patch` to surface behavioral gaps — cases where a passing
37
30
  solver's approach diverges from the intended behavior, indicating a test that's
38
31
  under-specified. This is empirical (grounded in real agent attempts) rather than
39
- analytical, so it's reported separately from the `--gap-finder` results and is never
40
- included in `--all` since it's by far the most expensive stage. Each solver's full
32
+ analytical, so it's reported separately from the `--gap-finder` results. Each solver's full
41
33
  `trajectory.json` (its raw session entries), `solution.patch`, and `./test.sh new` output
42
34
  are also persisted to `.pi/shipd-checks/<run-id>/solver_<n>/` in your project root, for
43
35
  later inspection independent of `shipd_report.json`.
44
- 6. Posts a chat summary (only for the stage(s) actually run this invocation — a `--tests`-only
45
- run won't show a stale `Overall` verdict from a previous, unrelated run) and merges the
46
- results into `shipd_report.json` in your project root. Running flags separately, in any
47
- order, builds up one combined report instead of overwriting it — `overall` only becomes a
48
- confident `PASS`/`FAIL` once all 3 focus reviewers have run at least once, in the same
49
- invocation.
36
+ 5. Posts a chat summary and merges the gap-finder results into `shipd_report.json` in your
37
+ project root. Running either finder separately builds up one combined report without any
38
+ PASS/FAIL verdict.
50
39
 
51
40
  ## Commands
52
41
 
53
- All flags except `--config` are additive/combinable, e.g. `/checks --tests --gap-finder` runs
54
- just the tests reviewer plus the gap-finder/filter stages. `--config` must be used alone.
55
- `--solver-gap-finder` is additive like the other stage flags, but deliberately **not** included
56
- in `--all` since it's the most expensive stage (several full coding-agent runs with shell access).
42
+ The two finder flags are additive/combinable; `--config` must be used alone.
57
43
 
58
44
  | Command | Effect |
59
45
  |---|---|
60
46
  | `/checks` | List available options (runs nothing) |
61
- | `/checks --all` | Run all 3 focus reviewers + test-gap analysis |
62
- | `/checks --review` | Run only the 3 focus reviewer agents |
63
- | `/checks --description` | Run only the problem-description reviewer |
64
- | `/checks --tests` | Run only the tests reviewer |
65
- | `/checks --solution` | Run only the solution reviewer |
66
47
  | `/checks --gap-finder` | Run positive + negative gap finders (parallel), then validator |
67
48
  | `/checks --solver-gap-finder` | Run several solver agents TDD-style against `agent_prompt.md` + `test.patch`, then compare their solutions to the real solution to find gaps |
68
- | `/checks --config` | Open the settings menu (reviewer + solver-gap-finder settings) |
49
+ | `/checks --config` | Configure behavioral and solver gap-finder models |
69
50
 
70
51
  **Shortcut:** `Ctrl+Shift+X` cancels an in-progress `/checks` run.
71
52
 
72
53
  ## Configuration
73
54
 
74
- `/checks --config` opens a single row-based settings menu with two section headers:
75
-
76
- - **Reviewer**: model and thinking level used by the focus reviewers, gap-finders, gap-validator,
77
- and the solver-gap-finder's comparison reviewer.
78
- - **Solver Gap Finder**: model, thinking level, per-agent timeout in minutes (default 30, clamped to
79
- 1–120), number of parallel solver agents (default 3, clamped to 1–10), and a "Save artifacts"
80
- on/off toggle (default on) — used only by the TDD-style solver agents spawned by
81
- `--solver-gap-finder`. These write code and run shell commands (a heavier job than the
82
- read-only reviewers), so you may want a stronger coding model here. Turning "Save artifacts"
83
- off skips persisting `trajectory.json`/`solution.patch`/test output to
84
- `.pi/shipd-checks/<run-id>/` for each run — useful if you don't need to inspect solver runs
85
- after the fact and want to save disk space.
86
-
87
- Use ↑/↓ to move between rows, Enter/Space to open a model picker or cycle a value in place, and
88
- `Ctrl+S` to save and exit (Esc cancels without discarding already-saved changes). Everything is
89
- saved immediately to `~/.pi/agent/checks-config.json`, with the solver-gap-finder settings nested
90
- under a `solverGap` key.
55
+ `/checks --config` lets you choose which setting to change:
56
+
57
+ - **Reviewer model**: model and thinking level used by the behavioral gap finders, validator,
58
+ and solver-solution comparison agent.
59
+ - **Solver model**: model and thinking level used by the TDD solver agents. Configure the
60
+ reviewer model first.
61
+
62
+ Settings are saved to `~/.pi/agent/checks-config.json`; solver settings are nested under
63
+ `solverGap`.
91
64
 
92
65
  ## Install
93
66
 
package/dist/index.js CHANGED
@@ -1,20 +1,19 @@
1
- var Uf=Object.defineProperty;var Ot=(e,t)=>{for(var r in t)Uf(e,r,{get:t[r],enumerable:!0})};import{Container as Cv,Key as Mv,Spacer as Av,Text as mi}from"@earendil-works/pi-tui";import{randomUUID as Tf}from"node:crypto";import{copyFileSync as $v,existsSync as kf,mkdirSync as wf,rmSync as Tv,writeFileSync as kv}from"node:fs";import{tmpdir as Ef}from"node:os";import{join as ct}from"node:path";import{getSettingsListTheme as wv}from"@earendil-works/pi-coding-agent";import{Container as Ev,Key as zt,matchesKey as Vt,Spacer as Rv,Text as Rf}from"@earendil-works/pi-tui";import{createAgentSession as un,SessionManager as cn}from"@earendil-works/pi-coding-agent";import{copyFileSync as Wf,existsSync as Wa,lstatSync as Hf,mkdirSync as Ha,readFileSync as Ya,rmSync as bi,symlinkSync as Yf,unlinkSync as Jf,writeFileSync as at}from"node:fs";import{join as ye}from"node:path";import{existsSync as bn,mkdirSync as Kf,readFileSync as _a,writeFileSync as _f}from"node:fs";import{dirname as zf,join as ci}from"node:path";import{getAgentDir as li}from"@earendil-works/pi-coding-agent";var xn=ci(li(),"checks-config.json"),In=ci(li(),"settings.json"),di=10,fi=60,za=20,Va=1,gi=5,vn=3,Ba=!0,Vf=["off","minimal","low","medium","high","xhigh","max"];function hi(e){return e?.reasoning?Vf.filter(t=>{let r=e.thinkingLevelMap?.[t];return r===null?!1:t==="xhigh"||t==="max"?r!==void 0:!0}):["off"]}function dt(){try{if(!bn(xn))return null;let e=JSON.parse(_a(xn,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function ft(e){let t=zf(xn);bn(t)||Kf(t,{recursive:!0}),_f(xn,JSON.stringify(e,null,2),"utf-8")}function yi(){let e=dt()?.solverGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e,timeoutMinutes:e.timeoutMinutes>0?e.timeoutMinutes:za,solverCount:e.solverCount>0?e.solverCount:vn,saveArtifacts:typeof e.saveArtifacts=="boolean"?e.saveArtifacts:Ba}}function xi(){try{return bn(In)?JSON.parse(_a(In,"utf-8")).enabledModels??[]:[]}catch{return[]}}function Ii(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function Bf(){try{if(bn(In))return JSON.parse(_a(In,"utf-8"))}catch{}return{}}function $n(){let e=Bf().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function Tn(e){return e.replace(/\\/g,"/")}function kn(e){return`'${e.replace(/'/g,"'\\''")}'`}async function wn(e,t,r){if((await e.exec("git",["rev-parse","HEAD"],{cwd:t,timeout:15e3})).code!==0)return{status:"error",error:"Not a git repository, or it has no commits yet."};let a=`git archive HEAD | tar -x -C ${kn(Tn(r))}`,s=await e.exec($n(),["-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 Ja=3e4,Xf=4e3,Zf=".pi/shipd-checks",kr="solver_gap_solutions";function Qf(e){let t=new Set,r=/^diff --git "?a\/(.+?)"? "?b\/(.+?)"?$/gm;for(let n of e.matchAll(r))n[1]&&t.add(n[1]),n[2]&&t.add(n[2]);return[...t]}function eg(e,t){return e.length>t?e.slice(e.length-t):e}async function vi(e){let{pi:t,repoDir:r,solverDir:n,testPatchPath:a,agentPromptPath:s}=e,m=await wn(t,r,n);if(m.status==="error")return{status:"error",solverDir:n,error:m.error};let c={cwd:n,timeout:Ja},l=await t.exec("git",["init"],c);if(l.code!==0)return{status:"error",solverDir:n,error:l.stderr?.trim()||"git init failed"};await t.exec("git",["config","user.email","solvergap@shipd-checks.local"],c),await t.exec("git",["config","user.name","shipd-checks solver-gap-finder"],c);let d=await t.exec("git",["add","-A"],c);if(d.code!==0)return{status:"error",solverDir:n,error:d.stderr?.trim()||"git add (baseline) failed"};let g=await t.exec("git",["commit","-m","baseline","--allow-empty"],c);if(g.code!==0)return{status:"error",solverDir:n,error:g.stderr?.trim()||"git commit (baseline) failed"};let b=ye(n,".gitignore"),V=Wa(b)?Ya(b,"utf-8"):"";if(!V.split(/\r?\n/).some(lt=>lt.trim()==="node_modules")){let lt=V.length>0&&!V.endsWith(`
1
+ var df=Object.defineProperty;var kt=(e,t)=>{for(var r in t)df(e,r,{get:t[r],enumerable:!0})};import{Container as Qb,Key as ev,Spacer as tv,Text as Vo}from"@earendil-works/pi-tui";import{randomUUID as ef}from"node:crypto";import{copyFileSync as Wb,existsSync as tf,mkdirSync as rf,rmSync as Hb,writeFileSync as Yb}from"node:fs";import{tmpdir as nf}from"node:os";import{join as Je}from"node:path";import{createAgentSession as ya,SessionManager as xa}from"@earendil-works/pi-coding-agent";import{copyFileSync as If,existsSync as Ma,lstatSync as bf,mkdirSync as Ca,readFileSync as Aa,rmSync as ri,symlinkSync as vf,unlinkSync as $f,writeFileSync as Ze}from"node:fs";import{join as ue}from"node:path";import{existsSync as rn,mkdirSync as ff,readFileSync as Ea,writeFileSync as gf}from"node:fs";import{dirname as hf,join as Xo}from"node:path";import{getAgentDir as Zo}from"@earendil-works/pi-coding-agent";var en=Xo(Zo(),"checks-config.json"),tn=Xo(Zo(),"settings.json");var wa=20;var Ra=3,Sa=!0,yf=["off","minimal","low","medium","high","xhigh","max"];function Oa(e){return e?.reasoning?yf.filter(t=>{let r=e.thinkingLevelMap?.[t];return r===null?!1:t==="xhigh"||t==="max"?r!==void 0:!0}):["off"]}function nn(){try{if(!rn(en))return null;let e=JSON.parse(Ea(en,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function Pa(e){let t=hf(en);rn(t)||ff(t,{recursive:!0}),gf(en,JSON.stringify(e,null,2),"utf-8")}function Qo(){let e=nn()?.solverGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e,timeoutMinutes:e.timeoutMinutes>0?e.timeoutMinutes:wa,solverCount:e.solverCount>0?e.solverCount:Ra,saveArtifacts:typeof e.saveArtifacts=="boolean"?e.saveArtifacts:Sa}}function ei(){try{return rn(tn)?JSON.parse(Ea(tn,"utf-8")).enabledModels??[]:[]}catch{return[]}}function ti(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function xf(){try{if(rn(tn))return JSON.parse(Ea(tn,"utf-8"))}catch{}return{}}function an(){let e=xf().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function on(e){return e.replace(/\\/g,"/")}function sn(e){return`'${e.replace(/'/g,"'\\''")}'`}async function mn(e,t,r){if((await e.exec("git",["rev-parse","HEAD"],{cwd:t,timeout:15e3})).code!==0)return{status:"error",error:"Not a git repository, or it has no commits yet."};let a=`git archive HEAD | tar -x -C ${sn(on(r))}`,s=await e.exec(an(),["-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 qa=3e4,Tf=4e3,kf=".pi/shipd-checks",dr="solver_gap_solutions";function Ef(e){let t=new Set,r=/^diff --git "?a\/(.+?)"? "?b\/(.+?)"?$/gm;for(let n of e.matchAll(r))n[1]&&t.add(n[1]),n[2]&&t.add(n[2]);return[...t]}function wf(e,t){return e.length>t?e.slice(e.length-t):e}async function ni(e){let{pi:t,repoDir:r,solverDir:n,testPatchPath:a,agentPromptPath:s}=e,m=await mn(t,r,n);if(m.status==="error")return{status:"error",solverDir:n,error:m.error};let c={cwd:n,timeout:qa},l=await t.exec("git",["init"],c);if(l.code!==0)return{status:"error",solverDir:n,error:l.stderr?.trim()||"git init failed"};await t.exec("git",["config","user.email","solvergap@shipd-checks.local"],c),await t.exec("git",["config","user.name","shipd-checks solver-gap-finder"],c);let I=await t.exec("git",["add","-A"],c);if(I.code!==0)return{status:"error",solverDir:n,error:I.stderr?.trim()||"git add (baseline) failed"};let x=await t.exec("git",["commit","-m","baseline","--allow-empty"],c);if(x.code!==0)return{status:"error",solverDir:n,error:x.stderr?.trim()||"git commit (baseline) failed"};let j=ue(n,".gitignore"),U=Ma(j)?Aa(j,"utf-8"):"";if(!U.split(/\r?\n/).some(ot=>ot.trim()==="node_modules")){let ot=U.length>0&&!U.endsWith(`
2
2
  `)?`
3
- `:"";at(b,`${V}${lt}node_modules
4
- `,"utf-8")}let G=ye(r,"node_modules"),w=ye(n,"node_modules");if(Wa(G)&&!Wa(w))try{Yf(G,w,process.platform==="win32"?"junction":"dir")}catch{}try{Wf(s,ye(n,"agent_prompt.md"))}catch{}let Ce=Ya(a,"utf-8"),L=Qf(Ce),le=ye(n,"test.patch");at(le,Ce,"utf-8");let re=await t.exec("git",["apply","test.patch"],c);try{Jf(le)}catch{}if(re.code!==0)return{status:"patchFailed",solverDir:n,error:re.stderr?.trim()||"git apply test.patch failed"};let Me=await t.exec("git",["add","-A"],c);if(Me.code!==0)return{status:"error",solverDir:n,error:Me.stderr?.trim()||"git add (tests applied) failed"};let oe=await t.exec("git",["commit","-m","tests applied","--allow-empty"],c);if(oe.code!==0)return{status:"error",solverDir:n,error:oe.stderr?.trim()||"git commit (tests applied) failed"};let rt=await t.exec("git",["rev-parse","HEAD"],c);return rt.code!==0||!rt.stdout.trim()?{status:"error",solverDir:n,error:"Could not resolve tests-applied commit hash."}:{status:"ok",solverDir:n,testsAppliedCommit:rt.stdout.trim(),testPatchPaths:L}}async function $i(e){let{pi:t,index:r,workspace:n,status:a,durationMs:s}=e,{solverDir:m,testsAppliedCommit:c,testPatchPaths:l}=n,d={cwd:m,timeout:Ja};await t.exec("git",["add","-A"],d);let g=[...l,"agent_prompt.md"].map(Me=>`:(exclude)${Me}`),b=await t.exec("git",["diff","--cached",c,"--",".",...g],d),V=b.code===0?b.stdout:"",G=ye(m,"test_output.xml"),w=`bash test.sh --output_path ${kn(Tn(G))} new`,Ce=$n(),L=await t.exec(Ce,["-c",`cd ${kn(Tn(m))} && ${w}`],{timeout:Ja*10}),le=L.code===0,re=eg(`${L.stdout}
5
- ${L.stderr}`.trim(),Xf);return{index:r,status:a,passed:le,diff:V,testOutputTail:re,durationMs:s,testOutputXmlPath:G}}function Ti(e){let{repoDir:t,runId:r,index:n,trajectory:a,solutionPatch:s,testOutputXmlPath:m,testOutputTail:c}=e,l=ye(t,Zf,r,`solver_${n}`);Ha(l,{recursive:!0}),at(ye(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),at(ye(l,"solution.patch"),s,"utf-8");try{let d=Ya(m,"utf-8");at(ye(l,"test_output.xml"),d,"utf-8")}catch{at(ye(l,"test_output.txt"),c,"utf-8")}return l}function ki(e,t){let r=ye(e,kr);Ha(r,{recursive:!0});let n=t.map(a=>{let s=ye(r,`solver_${a.index}`);return Ha(s,{recursive:!0}),at(ye(s,"solution.diff"),a.diff,"utf-8"),at(ye(s,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return at(ye(r,"manifest.json"),JSON.stringify(n,null,2),"utf-8"),r}function wi(e){let t=ye(e,"node_modules");try{Hf(t).isSymbolicLink()&&bi(t,{force:!0})}catch{}try{bi(e,{recursive:!0,force:!0})}catch{}}var p={};Ot(p,{Assign:()=>tg,Clone:()=>Sr,Create:()=>sh,Discard:()=>mh,Metrics:()=>Ue,Update:()=>ph});var Ue={assign:0,create:0,clone:0,discard:0,update:0};function tg(e,t){return Ue.assign+=1,{...e,...t}}var i={};Ot(i,{Entries:()=>$g,EntriesRegExp:()=>vg,Every:()=>xg,EveryAll:()=>Ig,GraphemeCount:()=>gg,HasPropertyKey:()=>bg,IsArray:()=>Er,IsBigInt:()=>wr,IsBoolean:()=>Li,IsClassInstance:()=>dg,IsConstructor:()=>sg,IsDeepEqual:()=>eo,IsEqual:()=>M,IsFunction:()=>qi,IsGreaterEqualThan:()=>Fi,IsGreaterThan:()=>ug,IsInteger:()=>Za,IsLessEqualThan:()=>ji,IsLessThan:()=>cg,IsMaxLength:()=>hg,IsMinLength:()=>yg,IsMultipleOf:()=>lg,IsNull:()=>Sn,IsNumber:()=>On,IsObject:()=>Rr,IsObjectNotArray:()=>mg,IsString:()=>Pn,IsSymbol:()=>pg,IsUndefined:()=>Qa,IsUnsafePropertyKey:()=>Di,IsValueLike:()=>fg,Keys:()=>Rn,ShiftLeft:()=>Cn,Symbols:()=>Tg,Values:()=>kg});function Pt(e,t,r){return e>=t&&e<=r}function rg(e){return e===8205}function ng(e){return Pt(e,55296,56319)}function Ei(e){return Pt(e,127462,127487)}function Si(e){return Pt(e,65024,65039)}function Oi(e){return Pt(e,768,879)||Pt(e,6832,6911)||Pt(e,7616,7679)||Pt(e,65056,65071)}function En(e){return e>65535?2:1}function Ri(e,t){for(;t<e.length;){let r=e.codePointAt(t);if(Oi(r)||Si(r))t+=En(r);else break}return t}function Xa(e,t){let r=e.codePointAt(t),n=t+En(r);for(n=Ri(e,n);n<e.length-1&&e[n]==="\u200D";){let a=e.codePointAt(n+1);n+=1+En(a),n=Ri(e,n)}return Ei(r)&&n<e.length&&Ei(e.codePointAt(n))&&(n+=En(e.codePointAt(n))),n}function Pi(e){return ng(e)||Oi(e)||Si(e)||rg(e)}function Ci(e){let t=0,r=0;for(;r<e.length;)r=Xa(e,r),t++;return t}function ag(e,t){if(t===0)return!0;let r=0,n=0;for(;n<e.length;)if(n=Xa(e,n),r++,r>=t)return!0;return!1}function og(e,t){let r=0,n=0;for(;n<e.length;)if(n=Xa(e,n),r++,r>t)return!1;return!0}function Mi(e,t){if(t===0)return!0;let r=0;for(;r<e.length;){if(Pi(e.charCodeAt(r)))return ag(e,t);if(r++,r>=t)return!0}return!1}function Ai(e,t){let r=0;for(;r<e.length;){if(Pi(e.charCodeAt(r)))return og(e,t);if(r++,r>t)return!1}return!0}function Er(e){return Array.isArray(e)}function wr(e){return M(typeof e,"bigint")}function Li(e){return M(typeof e,"boolean")}function sg(e){if(Qa(e)||!qi(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function qi(e){return M(typeof e,"function")}function Za(e){return Number.isInteger(e)}function Sn(e){return M(e,null)}function On(e){return Number.isFinite(e)}function mg(e){return Rr(e)&&!Er(e)}function Rr(e){return M(typeof e,"object")&&!Sn(e)}function Pn(e){return M(typeof e,"string")}function pg(e){return M(typeof e,"symbol")}function Qa(e){return M(e,void 0)}function M(e,t){return e===t}function ug(e,t){return e>t}function cg(e,t){return e<t}function ji(e,t){return e<=t}function Fi(e,t){return e>=t}function lg(e,t){if(wr(e)||wr(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!On(e)||Za(e)&&1/t%1===0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<r}function dg(e){if(!Rr(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Sn(t)?!1:M(typeof t.constructor,"function")&&!(M(t.constructor,globalThis.Object)||M(t.constructor.name,"Object"))}function fg(e){return wr(e)||Li(e)||Sn(e)||On(e)||Pn(e)||Qa(e)}function gg(e){return Ci(e)}function hg(e,t){return Ai(e,t)}function yg(e,t){return Mi(e,t)}function xg(e,t,r){for(let n=t;n<e.length;n++)if(!r(e[n],n))return!1;return!0}function Ig(e,t,r){let n=!0;for(let a=t;a<e.length;a++)r(e[a],a)||(n=!1);return n}function Cn(e,t,r){return M(e.length,0)?r():t(e[0],e.slice(1))}function Di(e){return M(e,"__proto__")||M(e,"constructor")||M(e,"prototype")}function bg(e,t){return Di(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function vg(e){return Rn(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function $g(e){return Object.entries(e)}function Rn(e){return Object.getOwnPropertyNames(e)}function Tg(e){return Object.getOwnPropertySymbols(e)}function kg(e){return Object.values(e)}function wg(e,t){if(!Rr(t))return!1;let r=Rn(e);return M(r.length,Rn(t).length)&&r.every(n=>eo(e[n],t[n]))}function Eg(e,t){return Er(t)&&M(e.length,t.length)&&e.every((r,n)=>eo(e[n],t[n]))}function eo(e,t){return Er(e)?Eg(e,t):Rr(e)?wg(e,t):M(e,t)}var gt={};Ot(gt,{IsBigInt64Array:()=>Ug,IsBigUint64Array:()=>Kg,IsBoolean:()=>Sg,IsDate:()=>zg,IsFloat32Array:()=>Gg,IsFloat64Array:()=>Ng,IsInt16Array:()=>qg,IsInt32Array:()=>Fg,IsInt8Array:()=>Mg,IsMap:()=>Bg,IsNumber:()=>Og,IsRegExp:()=>_g,IsSet:()=>Vg,IsString:()=>Pg,IsTypeArray:()=>Cg,IsUint16Array:()=>jg,IsUint32Array:()=>Dg,IsUint8Array:()=>Ag,IsUint8ClampedArray:()=>Lg});function Sg(e){return e instanceof Boolean}function Og(e){return e instanceof Number}function Pg(e){return e instanceof String}function Cg(e){return globalThis.ArrayBuffer.isView(e)}function Mg(e){return e instanceof globalThis.Int8Array}function Ag(e){return e instanceof globalThis.Uint8Array}function Lg(e){return e instanceof globalThis.Uint8ClampedArray}function qg(e){return e instanceof globalThis.Int16Array}function jg(e){return e instanceof globalThis.Uint16Array}function Fg(e){return e instanceof globalThis.Int32Array}function Dg(e){return e instanceof globalThis.Uint32Array}function Gg(e){return e instanceof globalThis.Float32Array}function Ng(e){return e instanceof globalThis.Float64Array}function Ug(e){return e instanceof globalThis.BigInt64Array}function Kg(e){return e instanceof globalThis.BigUint64Array}function _g(e){return e instanceof globalThis.RegExp}function zg(e){return e instanceof globalThis.Date}function Vg(e){return e instanceof globalThis.Set}function Bg(e){return e instanceof globalThis.Map}function Hg(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function Yg(e){let t={},r=Object.getOwnPropertyDescriptors(e);for(let n of Object.keys(r)){if(i.IsUnsafePropertyKey(n))continue;let a=r[n];i.HasPropertyKey(a,"value")&&Object.defineProperty(t,n,{...a,value:Ct(a.value)})}return t}function Jg(e){let t={};for(let r of i.Keys(e))i.IsUnsafePropertyKey(r)||(t[r]=Ct(e[r]));for(let r of i.Symbols(e))t[r]=Ct(e[r]);return t}function Xg(e){return i.IsClassInstance(e)?e:Hg(e)?Yg(e):Jg(e)}function Zg(e){return e.map(t=>Ct(t))}function Qg(e){return e.slice()}function eh(e){return new RegExp(e.source,e.flags)}function th(e){return new Map(Ct([...e.entries()]))}function rh(e){return new Set(Ct([...e.values()]))}function Ct(e){return gt.IsTypeArray(e)?Qg(e):gt.IsRegExp(e)?eh(e):gt.IsMap(e)?th(e):gt.IsSet(e)?rh(e):i.IsArray(e)?Zg(e):i.IsObject(e)?Xg(e):e}function Sr(e){return Ue.clone+=1,Ct(e)}var Mt={};Ot(Mt,{Get:()=>oh,Reset:()=>nh,Set:()=>ah});var ot={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function nh(){ot.immutableTypes=!1,ot.maxErrors=8,ot.useAcceleration=!0,ot.exactOptionalPropertyTypes=!1,ot.enumerableKind=!1,ot.correctiveParse=!1,ot.unionPrioritySort=!0}function ah(e){for(let t of i.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(ot,t,{value:r})}}function oh(){return ot}function ih(e,t){for(let r of Object.keys(t))Object.defineProperty(e,r,{configurable:!0,writable:!0,enumerable:!1,value:t[r]});return e}function Gi(e,t){return{...e,...t}}function sh(e,t,r={}){Ue.create+=1;let n=Mt.Get(),a=Gi(t,r),s=n.enumerableKind?Gi(a,e):ih(a,e);return n.immutableTypes?Object.freeze(s):s}function mh(e,t){Ue.discard+=1;let r={},n=Object.getOwnPropertyDescriptors(Sr(e)),a=new Set(t);for(let s of Object.keys(n))a.has(s)||Object.defineProperty(r,s,n[s]);return r}function ph(e,t,r){Ue.update+=1;let n=Mt.Get(),a=Sr(e);for(let s of Object.keys(t))Object.defineProperty(a,s,{configurable:!0,writable:!0,enumerable:n.enumerableKind,value:t[s]});for(let s of Object.keys(r))Object.defineProperty(a,s,{configurable:!0,enumerable:!0,writable:!0,value:r[s]});return a}function y(e,t){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],t)}function ne(e){return i.IsObject(e)}function I(e,t,r){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:r},{})}function ht(e){return y(e,"Deferred")}function uh(e){return p.Update(e,{"~readonly":!0},{})}function Or(e,t){return p.Update(uh(e),{},t)}function Ni(e,t,r,n){let a=f(e,t,r);return Or(a,n)}function ch(e){return p.Update(e,{"~optional":!0},{})}function Pr(e,t){return p.Update(ch(e),{},t)}function Ui(e,t,r,n){let a=f(e,t,r);return Pr(a,n)}function Ae(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function z(e){return y(e,"Array")}function Mn(e){return p.Discard(e,["~kind","type","items"])}function ze(e,t,r={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function ie(e){return y(e,"Constructor")}function Ki(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ve(e,t,r={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function se(e){return y(e,"Function")}function _i(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function it(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function me(e){return y(e,"Ref")}function yt(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Wt(e){return y(e,"Generic")}function Ht(e){return p.Create({"~kind":"Any"},{},e)}function Z(e){return y(e,"Any")}var zi="(?!)";function D(e){return p.Create({"~kind":"Never"},{not:{}},e)}function xt(e){return y(e,"Never")}function Be(e,t={}){return I("AddOptional",[e],t)}function At(e,t={}){return Pr(e,t)}function Vi(e){return At(e)}function xe(e){return ne(e)&&i.HasPropertyKey(e,"~optional")}function Bi(e){return i.Keys(e).filter(t=>!xe(e[t]))}function An(e){return i.Keys(e)}function Ln(e){return i.Values(e)}function $(e,t={}){let r=Bi(e),n=r.length>0?{required:r}:{};return p.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function A(e){return y(e,"Object")}function Wi(e){return p.Discard(e,["~kind","type","properties","required"])}function ue(e){return p.Create({"~kind":"Unknown"},{},e)}function ae(e){return y(e,"Unknown")}function We(e,t,r){let n=i.Keys(e).reduce((a,s)=>({...a,[s]:p.Update(e[s],{},{$id:s})}),{});return p.Create({"~kind":"Cyclic"},{$defs:n,$ref:t},r)}function de(e){return y(e,"Cyclic")}function Hi(e){return p.Update(e,{"~unsafe":null},{})}function qn(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var He={};Ot(He,{Match:()=>lh});function lh(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Cr(...e){let[t,r]=He.Match(e,{2:(n,a)=>[n,a,a],1:n=>[n,ue(),ue()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function J(e){return y(e,"Infer")}function Lt(e,t,r,n={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:r},n)}function H(e){return y(e,"Dependent")}function Yi(e){return p.Discard(e,["~kind","if","then","else"])}function Ji(e){return i.IsObjectNotArray(e)}function Xi(e){return i.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function Zi(e){return i.IsString(e)||i.IsNumber(e)}function Qi(e,t){let r=Ji(e)?Xi(e):e;return p.Create({"~kind":"Enum"},{enum:r},t)}function be(e){return y(e,"Enum")}function Ie(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function O(e){return y(e,"Intersect")}function es(e){return p.Discard(e,["~kind","allOf"])}function X(){throw new Error("Unreachable")}var ts;(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"})(ts||(ts={}));var ZT=BigInt("14695981039346656037"),[QT,ek]=[BigInt("1099511628211"),BigInt("18446744073709551616")],tk=Array.from({length:256}).map((e,t)=>BigInt(t)),rs=new Float64Array(1),rk=new DataView(rs.buffer),nk=new Uint8Array(rs.buffer);var ak=new TextEncoder;var Mr=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=jn(r)?m=>this.decode(r["~codec"].decode(m)):this.decode,a=jn(r)?m=>r["~codec"].encode(t(m)):t,s={decode:n,encode:a};return p.Update(this.type,{"~codec":s},{})}},Ar=class{constructor(t){this.type=t}Decode(t){return new Mr(this.type,t)}};function Fn(e){return new Ar(e)}function as(e,t){return Fn(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function os(e,t){return Fn(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function jn(e){return ne(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function is(e){return Yt(e)}function qt(e){return ne(e)&&i.HasPropertyKey(e,"~immutable")}function Ye(e,t={}){return I("AddReadonly",[e],t)}function jt(e,t={}){return Or(e,t)}function ss(e){return jt(e)}function Ft(e){return ne(e)&&i.HasPropertyKey(e,"~readonly")}function hh(e,t){let r=to(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":r},{})}function ms(...e){let[t,r,n]=He.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return hh(t,{check:r,error:n})}function yh(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function to(e){return ne(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>yh(t))}var ps="-?(?:0|[1-9][0-9]*)n";function Lr(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function Je(e){return y(e,"BigInt")}function Dn(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Fe(e){return y(e,"Boolean")}function qr(e){return p.Create({"~kind":"Identifier"},{name:e})}function us(e){return y(e,"Identifier")}var Gn="-?(?:0|[1-9][0-9]*)";function Dt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function ve(e){return y(e,"Integer")}var ro=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function xh(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new ro(e)})()}function P(e,t){return p.Create({"~kind":"Literal"},{type:xh(e),const:e},t)}function Nn(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function cs(e){return q(e)&&i.IsNumber(e.const)}function ls(e){return q(e)&&i.IsString(e.const)}function q(e){return y(e,"Literal")}function Jt(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Xt(e){return y(e,"Null")}var Un="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Se(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function Q(e){return y(e,"Number")}function Zt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function It(e){return y(e,"Symbol")}function Gt(...e){let[t,r,n]=He.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,s],1:a=>[a,ue(),ue()]});return p.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function ds(e){return y(e,"Parameter")}var Kn=".*";function De(e){return p.Create({"~kind":"String"},{type:"string"},e)}function $e(e){return y(e,"String")}function E(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return y(e,"Union")}function fs(e){return p.Discard(e,["~kind","anyOf"])}function jr(e){let t=gs(e);return i.IsEqual(t.length,2)?t[0]:[]}function Ih(e){return!0}function hs(e){return i.ShiftLeft(e,(t,r)=>bh(t)?hs(r):!1,()=>!0)}function ys(e){return i.IsEqual(e.length,0)?!1:hs(e)}function bh(e){return x(e)?ys(e.anyOf):q(e)?Ih(e.const):!1}function _n(e){return ys(e)}function zn(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function xs(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>xs(a,t,[...r,`${n}${t}`]),()=>r)}function vh(e,t){return i.IsEqual(e.length,0)?[`${t}`]:xs(e,t)}function Is(e,t,r=[]){return i.ShiftLeft(t,(n,a)=>Is(e,a,[...r,...bs(e,n)]),()=>r)}function bs(e,t){return x(t)?Is(e,t.anyOf):q(t)?vh(e,t.const):X()}function vs(e,t){return i.ShiftLeft(t,(r,n)=>vs(bs(e,r),n),()=>e)}function $h(e){return e.map(t=>P(t))}function Th(e){let t=vs([],e),r=$h(t);return E(r)}function kh(e){return i.IsEqual(e.length,0)?X():i.IsEqual(e.length,1)&&q(e[0])?e[0]:Th(e)}function no(e){let t=jr(e);return i.IsEqual(t.length,0)?De():_n(t)?kh(t):zn(e)}function $s(e){let t=no(e);return ee(t)?De():t}function ke(e,t){let r="object",n={[e]:t};return p.Create({"~kind":"Record"},{type:r,patternProperties:n})}function Ts(e){return ke(Ke,e)}function ks(e){return $({true:e,false:e})}function te(e,t={}){let[r,n,a]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:a,items:r,minItems:n},t)}function N(e){return y(e,"Tuple")}function ws(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function wh(e){return p.Discard(e,["~readonly"])}function ao(e,t){return p.Update(wh(e),{},t)}function Es(e,t,r,n){let a=f(e,t,r);return ao(a,n)}function Rs(e,t={}){return I("RemoveReadonly",[e],t)}function Ss(e,t={}){return ao(e,t)}function Eh(e){return p.Discard(e,["~optional"])}function oo(e,t){return p.Update(Eh(e),{},t)}function Os(e,t,r,n){let a=f(e,t,r);return oo(a,n)}function Ps(e,t={}){return I("RemoveOptional",[e],t)}function Vn(e,t={}){return oo(e,t)}function io(e){return e.reduceRight((r,n,a)=>({[a]:n,...r}),{})}function Cs(e){let t=io(e.items);return $(t)}function Rh(e,t){return Ft(e)?!!Ft(t):!1}function Sh(e,t){return xe(e)?!!xe(t):!1}function Oh(e,t){let r=Rh(e,t),n=Sh(e,t),a=B([e,t]),s=Ss(Vn(a));return r&&n?jt(At(s)):r&&!n?jt(s):!r&&n?At(s):s}function Ph(e,t,r){return r in e?r in t?Oh(e[r],t[r]):e[r]:r in t?t[r]:D()}function Ch(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((n,a)=>({...n,[a]:Ph(e,t,a)}),{})}function Ms(e){return A(e)?e.properties:N(e)?io(e.items):X()}function As(e,t){let r=Ms(e),n=Ms(t),a=Ch(r,n);return $(a)}function Ls(e,t){let r=Qt(e,t);return i.IsEqual(r,Dr)?e:i.IsEqual(r,Gr)||i.IsEqual(r,Fr)?t:D()}function qs(e){return A(e)||N(e)}function Mh(e,t){let r=x(e),n=x(t);return r||n}function Ah(e,t){let r=Ge(e),n=Ge(t),a=Mh(r,n),s=qs(r),m=qs(n);return a?B([r,n]):s&&m?As(r,n):s&&!m?r:!s&&m?n:Ls(r,n)}function js(e,t,r=[]){return i.ShiftLeft(t,(n,a)=>js(e,a,[...r,Ah(e,n)]),()=>i.IsEqual(r.length,0)?[e]:r)}function Fs(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>Fs(a,t,[...r,...Nr([n],t)]),()=>r)}function Nr(e,t=[]){return i.ShiftLeft(e,(r,n)=>x(r)?Nr(n,Fs(r.anyOf,t)):Nr(n,js(r,t)),()=>t)}function Lh(e,t){let r=fe({},e,t);return v.IsExtendsTrueLike(r)?[]:[e]}function qh(e,t){return e.reduce((r,n)=>[...r,...Lh(n,t)],[])}function Bn(e,t){let r=Ge(e),n=x(r)?r.anyOf:[r],a=qh(n,t);return Oe(a)}function _e(e,t,r){let n=Ie([e,t]),a=Bn(r,e);return Oe([n,a])}function Le(e){let t=e.map(r=>P(r));return Oe(t)}function B(e){let t=Nr(e),r=so(t);return st(r)}function we(e){let t=$s(e);return Ge(t)}function Oe(e){let t=so(e);return st(t)}function Ge(e){return H(e)?_e(e.if,e.then,e.else):be(e)?Le(e.enum):O(e)?B(e.allOf):ee(e)?we(e.pattern):x(e)?Oe(e.anyOf):e}function st(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?D():E(e)}function Ds(e,t){let r=Le(e);return bt(r,t)}function Gs(e,t){return ke(vt,t)}function Ns(e,t){let r=B(e);return bt(r,t)}function Us(e,t){return i.IsString(e)||i.IsNumber(e)?$({[e]:t}):i.IsEqual(e,!1)?$({false:t}):i.IsEqual(e,!0)?$({true:t}):$({})}function Ks(e,t){return ke(er,t)}function _s(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?ke(e.pattern.toString(),t):ke(Ke,t)}function zs(e,t){let r=jr(e);return _n(r)?bt(we(e),t):ke(e,t)}function jh(e){return x(e)?Ur(e.anyOf):[e]}function Ur(e){return e.reduce((t,r)=>[...t,...jh(r)],[])}function Fh(e){return e.some(t=>$e(t)||Q(t)||ve(t))}function Dh(e,t){return i.IsEqual(Fh(e),!0)?ke(Ke,t):void 0}function Gh(e,t){return e.reduce((r,n)=>q(n)&&(i.IsString(n.const)||i.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function Nh(e,t){let r=Gh(e,t);return $(r)}function Vs(e,t){let r=Ur(e),n=Dh(r,t);return ne(n)?n:Nh(r,t)}function bt(e,t){return Z(e)?Ts(t):Fe(e)?ks(t):be(e)?Ds(e.enum,t):ve(e)?Gs(e,t):O(e)?Ns(e.allOf,t):q(e)?Us(e.const,t):Q(e)?Ks(e,t):x(e)?Vs(e.anyOf,t):$e(e)?_s(e,t):ee(e)?zs(e.pattern,t):$({})}function mo(e,t,r){return k([e])?p.Update(bt(e,t),{},r):Wn(e,t,r)}function Bs(e,t,r,n,a){let s=f(e,t,r),m=f(e,t,n);return mo(s,m,a)}var vt=`^${Gn}$`,er=`^${Un}$`,Ke=`^${Kn}$`;function Wn(e,t,r={}){return I("Record",[e,t],r)}function Hn(e,t,r={}){return mo(e,t,r)}function Ws(e,t){return ke(e,t)}function Yn(e){return i.IsEqual(e,Ke)?De():i.IsEqual(e,vt)?Dt():i.IsEqual(e,er)?Se():no(e)}function Ne(e){return i.Keys(e.patternProperties)[0]}function tr(e){let t=Ne(e);return Yn(t)}function Te(e){return e.patternProperties[Ne(e)]}function ge(e){return y(e,"Record")}function Nt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function $t(e){return y(e,"Rest")}function Jn(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function Xn(e){return y(e,"This")}function rr(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function nr(e){return y(e,"Undefined")}function Zn(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Xe(e){return y(e,"Void")}function Kh(e,t){return i.IsEqual(e,"Array")?Ae(t[0]):i.IsEqual(e,"Capitalize")?ea(t[0]):i.IsEqual(e,"ConstructorParameters")?oa(t[0]):i.IsEqual(e,"Evaluate")?Yp(t[0]):i.IsEqual(e,"Exclude")?ia(t[0],t[1]):i.IsEqual(e,"Extract")?sa(t[0],t[1]):i.IsEqual(e,"Index")?Vr(t[0],t[1]):i.IsEqual(e,"InstanceType")?ma(t[0]):i.IsEqual(e,"Lowercase")?ta(t[0]):i.IsEqual(e,"NonNullable")?pa(t[0]):i.IsEqual(e,"Omit")?ua(t[0],t[1]):i.IsEqual(e,"Parameters")?ca(t[0]):i.IsEqual(e,"Partial")?la(t[0]):i.IsEqual(e,"Pick")?da(t[0],t[1]):i.IsEqual(e,"Readonly")?fa(t[0]):i.IsEqual(e,"KeyOf")?Br(t[0]):i.IsEqual(e,"Record")?Wn(t[0],t[1]):i.IsEqual(e,"Required")?ga(t[0]):i.IsEqual(e,"ReturnType")?ha(t[0]):i.IsEqual(e,"Uncapitalize")?ra(t[0]):i.IsEqual(e,"Uppercase")?na(t[0]):zr(it(e),t)}function Ut(){throw Error("Unreachable")}var _h=(e,t=[])=>e.reduce((r,n)=>i.IsArray(n)&&i.IsEqual(n.length,2)?[...r,n[0]]:[...r,n],[]),mt=e=>{let[t,r]=e;return _h([...t,...r])};function Zs(e){return Gt(e[0],e[2],e[4])}function Qs(e){return Gt(e[0],e[2],e[2])}function em(e){return Gt(e[0],ue(),e[2])}function tm(e){return Gt(e,ue(),ue())}function rm(e){return mt(e)}function nm(e){return e[1]}function am(e){return mt(e)}function om(e){return e[1]}function im(e){return Kh(e[0],e[1])}function sm(e){return null}function mm(e){return De()}function pm(e){return Se()}function um(e){return Dn()}function cm(e){return rr()}function lm(e){return Jt()}function dm(e){return Dt()}function fm(e){return Lr()}function gm(e){return ue()}function hm(e){return Ht()}function ym(e){return $({})}function xm(e){return D()}function Im(e){return Zt()}function bm(e){return Zn()}function vm(e){return Jn()}function $m(e){return P(BigInt(e))}function Tm(e){return P(i.IsEqual(e,"true"))}function km(e){return P(parseFloat(e))}function wm(e){return P(e)}function Em(e){return e[1]}function Rm(e){return P(e)}function Sm(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Om(e){return e[1]}function Pm(e){return Qn(e)}function Cm(e){return i.IsEqual(e.length,6)?Lt(e[1],e[3],e[5]):Lt(e[1],e[3],ue())}function Mm(e){return e.length>0}function Am(e){return e.reduce((t,r)=>i.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function Lm(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function qm(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function jm(e){return i.IsEqual(e.length,2)?e[1]:[]}function Hs(e,t){return t.reduce((r,n)=>{let a=n;return i.IsEqual(a.length,1)?Vr(r,a[0]):i.IsEqual(a.length,0)?Ae(r):Ut()},e)}function Ys(e,t){return i.IsEqual(t.length,3)?aa(e,t[0],t[1],t[2]):e}function zh(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:ya(e,t)}function Fm(e){let[t,r,n,a,s]=e;return zh(Ys(t?Br(Hs(r,n)):Hs(r,n),a),s)}function po(e,t){return i.IsEqual(t.length,3)?(()=>{let[r,n,a]=t,s=po(n,a);if(i.IsEqual(r,"&"))return O(s)?Ie([e,...s.allOf]):Ie([e,s]);if(i.IsEqual(r,"|"))return x(s)?E([e,...s.anyOf]):E([e,s]);Ut()})():e}function Dm(e){let[t,r]=e;return po(t,r)}function Gm(e){let[t,r]=e;return po(t,r)}function Nm(e){return Hp(e[1])}function Um(e){return e[1]}function Km(e){return yt(e[0],e[2])}function _m(e){return i.IsEqual(e.length,4)?Cr(e[1],e[3]):i.IsEqual(e.length,2)?Cr(e[1],ue()):Ut()}function zm(e){return`${e}`}function Vm(e){return ve(e[3])?vt:Q(e[3])?er:It(e[3])?Ke:$e(e[3])?Ke:Ut()}function Bm(e){return e.length>0}function Wm(e){return e.length>0}function Hm(e){let[t,r,n,a,s]=e;return{[r]:t&&n?Ye(Be(s)):t&&!n?Ye(s):!t&&n?Be(s):s}}function Ym(e){return mt(e)}function Jm(e){return e.reduce((t,r)=>i.HasPropertyKey(r,vt)||i.HasPropertyKey(r,er)||i.HasPropertyKey(r,Ke)?[t[0],p.Assign(t[1],r)]:[p.Assign(t[0],r),t[1]],[{},{}])}function Xm(e){return Jm(e[1])}function Zm(e){let[t,r]=e,n=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return $(t,n)}function Qm(e){return i.IsEqual(e.length,5)?Ye(Be(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?Ye(e[3]):Be(e[3]):Ut()}function ep(e){return Ye(Be(e[1]))}function tp(e){return Ye(e[1])}function rp(e){return Be(e[0])}function np(e){return i.IsEqual(e.length,2)?Nt(e[1]):i.IsEqual(e.length,1)?e[0]:Ut()}function ap(e){return mt(e)}function op(e){return te(e[1])}function ip(e){return Ye(Be(e[4]))}function sp(e){return Ye(e[3])}function mp(e){return Be(e[3])}function pp(e){return e[2]}function up(e){return i.IsEqual(e.length,2)?Nt(e[1]):i.IsEqual(e.length,1)?e[0]:Ut()}function cp(e){return mt(e)}function lp(e){return Ve(e[1],e[4])}function dp(e){return ze(e[2],e[5])}function Js(e,t){return i.IsEqual(e,"remove")?Rs(t):i.IsEqual(e,"add")?Ye(t):t}function fp(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 Xs(e,t){return i.IsEqual(e,"remove")?Ps(t):i.IsEqual(e,"add")?Be(t):t}function gp(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 hp(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function yp(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?Kr(qr(e[3]),e[5],e[6][0],Js(e[1],Xs(e[8],e[10]))):Kr(qr(e[3]),e[5],it(e[3]),Js(e[1],Xs(e[8],e[10])))}function xp(e){return it(e)}function Ip(e){return BigInt(e)}function bp(e){return parseFloat(e)}function vp(e){return i.IsEqual(e,"true")}function $p(e){return null}function Tp(e){return{[e[0]]:e[2]}}function kp(e){return mt(e)}function Vh(e){return e.reduce((t,r)=>p.Assign(t,r),{})}function wp(e){return Vh(e[1])}function Ep(e){return mt(e)}function Rp(e){return e[1]}function Sp(e){return Lr()}function Op(e){return De()}function Pp(e){return Se()}function Cp(e){return Dt()}function Mp(e){return D()}function Ap(e){return P(e)}function Lp(e){return E(e[1])}function qp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function jp(e){return[e[0],...e[1]]}function Fp(e){return e[1]}function Dp(e){return mt(e)}function Gp(e){return i.IsEqual(e.length,2)?e[1]:[]}function Np(e){let t=e[2],r=e[3],[n,a]=e[4],s=i.IsEqual(i.Keys(a).length,0)?{}:{patternProperties:a};return{[e[1]]:yt(t,_r(r,n,s))}}function Up(e){let t=e[2],[r,n]=e[3],a=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:_r(t,r,a)}}function Kp(e){return{[e[1]]:yt(e[2],e[4])}}function _p(e){return{[e[1]]:e[3]}}function zp(e){return null}function Vp(e){return Jm(mt(e))}function Bp(e){return e[1]}function Wp(e){let t=e[0],r=e[1];return Jp(p.Assign(t,r[0]))}function Wr(e){return M(e.length,2)}function R(e,t,r){return Wr(e)?t(e[0],e[1]):r()}function Hh(e,t){return M(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function W(e,t){for(let r=0;r<e.length;r++){let n=Hh(e[r],t);if(Wr(n))return n}return[]}function uo(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var Xp=[...uo(97,122),...uo(65,90)],co="0",lo=uo(49,57),ar=[co,...lo],Zp=" ",or=`
6
- `;var Tt="_",xa=".",Qp="$",Ia="-";var eu="//",tu="/*",Jh="*/";function ru(e){let t=e.indexOf(Jh);return M(t,-1)?"":e.slice(t+2)}function nu(e){let t=e.indexOf(or);return M(t,-1)?"":e.slice(t)}function Xh(e){return e.replace(/^[ \t\r\f\v]+/,"")}function ba(e){let t=Xh(e);return t.startsWith(tu)?ba(ru(t.slice(2))):t.startsWith(eu)?ba(nu(t.slice(2))):t}function ce(e){let t=e.trimStart();return t.startsWith(tu)?ce(ru(t.slice(2))):t.startsWith(eu)?ce(nu(t.slice(2))):t}function va(e,t){return R(W([e],t),(r,n)=>[r,n],()=>["",t])}function Zh(e,t){return e.includes(t)}function ir(e,t,r,n=""){return R(W(e,r),(a,s)=>Zh(t,a)?ir(e,t,s,n):ir(e,t,s,`${n}${a}`),()=>[n,r])}function Qh(e){return W(lo,e)}var ey=[...ar,Tt];function ty(e){return ir(ey,[Tt],e)}function ry(e){return R(W([co],e),(t,r)=>[t,r],()=>R(Qh(e),(t,r)=>R(ty(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[]))}function $a(e){return ry(ce(e))}function ny(e){return va(Ia,e)}function ay(e){return R(ny(e),(t,r)=>R($a(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function au(e){return ay(ce(e))}function oy(e){return R(au(e),(t,r)=>R(W(["n"],r),(n,a)=>[`${t}`,a],()=>[]),()=>[])}function fo(e){return oy(e)}function go(e,t){return W([e],t)}function u(e,t){return M(e,"")?["",t]:e.startsWith(or)?go(e,ba(t)):e.startsWith(Zp)?go(e,t):go(e,ce(t))}var ou=[...Xp,Tt,Qp];function iy(e){return W(ou,e)}var sy=[...ou,...ar];function iu(e,t=""){return R(W(sy,e),(r,n)=>iu(n,`${t}${r}`),()=>[t,e])}function my(e){return R(iy(e),(t,r)=>R(iu(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function Y(e){return my(ce(e))}var py=[...ar,Tt];function uy(e){return Wr(W([xa],e))}function su(e){return R(ir(py,[Tt],e),(t,r)=>M(t,"")?[]:[t,r],()=>[])}function cy(e){return R(W([xa],e),(t,r)=>R(su(r),(n,a)=>[`0${t}${n}`,a],()=>[]),()=>[])}function ly(e){return R($a(e),(t,r)=>R(W([xa],r),(n,a)=>R(su(a),(s,m)=>[`${t}${n}${s}`,m],()=>[`${t}`,a]),()=>[`${t}`,r]),()=>[])}function dy(e){return uy(e)?cy(e):ly(e)}function mu(e){return dy(ce(e))}function fy(e){return va(Ia,e)}function gy(e){return R(fy(e),(t,r)=>R(mu(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function Ta(e){return gy(ce(e))}function hy(e){return M(e,"")?[]:[e.slice(0,1),e.slice(1)]}function pu(e,t){return Cn(e,(r,n)=>t.startsWith(r)?!0:pu(n,t),()=>!1)}function kt(e,t,r=""){return R(hy(t),(n,a)=>pu(e,t)?[r,t]:kt(e,a,`${r}${n}`),()=>[])}function yy(e,t,r){return R(W([e],r),(n,a)=>R(kt([t],a),(s,m)=>R(W([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function xy(e,t,r){return R(W([e],r),(n,a)=>R(kt([or,t],a),(s,m)=>R(W([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function uu(e,t,r,n){return r?yy(e,t,ce(n)):xy(e,t,ce(n))}function Iy(e,t){return W(e,t)}function by(e,t){return uu(e,e,!1,t)}function vy(e,t){return R(Iy(e,t),(r,n)=>by(r,`${r}${n}`),()=>[])}function ka(e,t){return vy(e,ce(t))}function cu(e,t){return R(kt(e,t),(r,n)=>M(r,"")?[]:[r,n],()=>[])}var o=(e,t,r=()=>[])=>e.length===2?t(e):r(),Ty=e=>o(o(Y(e),([t,r])=>o(u("extends",r),([n,a])=>o(S(a),([s,m])=>o(u("=",m),([c,l])=>o(S(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[Zs(t),r]),ky=e=>o(o(Y(e),([t,r])=>o(u("extends",r),([n,a])=>o(S(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Qs(t),r]),wy=e=>o(o(Y(e),([t,r])=>o(u("=",r),([n,a])=>o(S(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[em(t),r]),Ey=e=>o(Y(e),([t,r])=>[tm(t),r]),fu=e=>o(o(Ty(e),([t,r])=>[t,r],()=>o(ky(e),([t,r])=>[t,r],()=>o(wy(e),([t,r])=>[t,r],()=>o(Ey(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),gu=(e,t=[])=>o(o(fu(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>gu(n,[...t,r]),()=>[t,e]),Ry=e=>o(o(gu(e),([t,r])=>o(o(o(fu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[rm(t),r]),xo=e=>o(o(u("<",e),([t,r])=>o(Ry(r),([n,a])=>o(u(">",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[nm(t),r]),hu=(e,t=[])=>o(o(S(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>hu(n,[...t,r]),()=>[t,e]),Sy=e=>o(o(hu(e),([t,r])=>o(o(o(S(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[am(t),r]),Oy=e=>o(o(u("<",e),([t,r])=>o(Sy(r),([n,a])=>o(u(">",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[om(t),r]),Py=e=>o(o(Y(e),([t,r])=>o(Oy(r),([n,a])=>[[t,n],a])),([t,r])=>[im(t),r]),yu=e=>o(o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[sm(t),r]),xu=e=>o(u("string",e),([t,r])=>[mm(t),r]),Iu=e=>o(u("number",e),([t,r])=>[pm(t),r]),Cy=e=>o(u("boolean",e),([t,r])=>[um(t),r]),My=e=>o(u("undefined",e),([t,r])=>[cm(t),r]),Ay=e=>o(u("null",e),([t,r])=>[lm(t),r]),bu=e=>o(u("integer",e),([t,r])=>[dm(t),r]),Ly=e=>o(u("bigint",e),([t,r])=>[fm(t),r]),qy=e=>o(u("unknown",e),([t,r])=>[gm(t),r]),jy=e=>o(u("any",e),([t,r])=>[hm(t),r]),Fy=e=>o(u("object",e),([t,r])=>[ym(t),r]),Dy=e=>o(u("never",e),([t,r])=>[xm(t),r]),vu=e=>o(u("symbol",e),([t,r])=>[Im(t),r]),Gy=e=>o(u("void",e),([t,r])=>[bm(t),r]),Ny=e=>o(u("this",e),([t,r])=>[vm(t),r]),Uy=e=>o(o(u("${",e),([t,r])=>o(S(r),([n,a])=>o(u("}",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Em(t),r]),ho=e=>o(kt(["${","`"],e),([t,r])=>[Rm(t),r]),$u=e=>o(o(o(ho(e),([t,r])=>o(Uy(r),([n,a])=>o($u(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o(o(ho(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(ho(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[Sm(t),r]),Io=e=>o(o(u("`",e),([t,r])=>o($u(r),([n,a])=>o(u("`",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Om(t),r]),Ky=e=>o(Io(e),([t,r])=>[Pm(t),r]),_y=e=>o(o(o(u("if",e),([t,r])=>o(S(r),([n,a])=>o(u("then",a),([s,m])=>o(S(m),([c,l])=>o(u("else",l),([d,g])=>o(S(g),([b,V])=>[[t,n,s,c,d,b],V])))))),([t,r])=>[t,r],()=>o(o(u("if",e),([t,r])=>o(S(r),([n,a])=>o(u("then",a),([s,m])=>o(S(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>[])),([t,r])=>[Cm(t),r]),zy=e=>o(fo(e),([t,r])=>[$m(t),r]),Vy=e=>o(o(u("true",e),([t,r])=>[t,r],()=>o(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[Tm(t),r]),By=e=>o(Ta(e),([t,r])=>[km(t),r]),Wy=e=>o(ka(["'",'"'],e),([t,r])=>[wm(t),r]),Hy=e=>o(o(o(u("keyof",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Mm(t),r]),Tu=(e,t=[])=>o(o(o(u("[",e),([r,n])=>o(S(n),([a,s])=>o(u("]",s),([m,c])=>[[r,a,m],c]))),([r,n])=>[r,n],()=>o(o(u("[",e),([r,n])=>o(u("]",n),([a,s])=>[[r,a],s])),([r,n])=>[r,n],()=>[])),([r,n])=>Tu(n,[...t,r]),()=>[t,e]),Yy=e=>o(Tu(e),([t,r])=>[Am(t),r]),Jy=e=>o(o(o(u("extends",e),([t,r])=>o(S(r),([n,a])=>o(u("?",a),([s,m])=>o(S(m),([c,l])=>o(u(":",l),([d,g])=>o(S(g),([b,V])=>[[t,n,s,c,d,b],V])))))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Lm(t),r]),Xy=e=>o(o(o(u("(",e),([t,r])=>o(S(r),([n,a])=>o(u(")",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o(xu(e),([t,r])=>[t,r],()=>o(Iu(e),([t,r])=>[t,r],()=>o(Cy(e),([t,r])=>[t,r],()=>o(My(e),([t,r])=>[t,r],()=>o(Ay(e),([t,r])=>[t,r],()=>o(bu(e),([t,r])=>[t,r],()=>o(Ly(e),([t,r])=>[t,r],()=>o(qy(e),([t,r])=>[t,r],()=>o(jy(e),([t,r])=>[t,r],()=>o(Fy(e),([t,r])=>[t,r],()=>o(Dy(e),([t,r])=>[t,r],()=>o(vu(e),([t,r])=>[t,r],()=>o(Gy(e),([t,r])=>[t,r],()=>o(Ny(e),([t,r])=>[t,r],()=>o(zy(e),([t,r])=>[t,r],()=>o(Vy(e),([t,r])=>[t,r],()=>o(By(e),([t,r])=>[t,r],()=>o(Wy(e),([t,r])=>[t,r],()=>o(Ky(e),([t,r])=>[t,r],()=>o(_y(e),([t,r])=>[t,r],()=>o(ux(e),([t,r])=>[t,r],()=>o(hx(e),([t,r])=>[t,r],()=>o($x(e),([t,r])=>[t,r],()=>o(vx(e),([t,r])=>[t,r],()=>o(Ex(e),([t,r])=>[t,r],()=>o(Py(e),([t,r])=>[t,r],()=>o(Rx(e),([t,r])=>[t,r],()=>[])))))))))))))))))))))))))))),([t,r])=>[qm(t),r]),Zy=e=>o(o(o(u("with",e),([t,r])=>o(Gu(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[jm(t),r]),ku=e=>o(o(Hy(e),([t,r])=>o(Xy(r),([n,a])=>o(Yy(a),([s,m])=>o(Jy(m),([c,l])=>o(Zy(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[Fm(t),r]),wu=e=>o(o(o(u("&",e),([t,r])=>o(ku(r),([n,a])=>o(wu(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Eu=e=>o(o(ku(e),([t,r])=>o(wu(r),([n,a])=>[[t,n],a])),([t,r])=>[Dm(t),r]),Ru=e=>o(o(o(u("|",e),([t,r])=>o(Eu(r),([n,a])=>o(Ru(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),wa=e=>o(o(Eu(e),([t,r])=>o(Ru(r),([n,a])=>[[t,n],a])),([t,r])=>[Gm(t),r]),Qy=e=>o(o(u("readonly",e),([t,r])=>o(wa(r),([n,a])=>[[t,n],a])),([t,r])=>[Nm(t),r]),ex=e=>o(o(u("|",e),([t,r])=>o(wa(r),([n,a])=>[[t,n],a])),([t,r])=>[Um(t),r]),tx=e=>o(o(xo(e),([t,r])=>o(u("=",r),([n,a])=>o(S(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Km(t),r]),rx=e=>o(o(o(u("infer",e),([t,r])=>o(Y(r),([n,a])=>o(u("extends",a),([s,m])=>o(wa(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>o(o(u("infer",e),([t,r])=>o(Y(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>[])),([t,r])=>[_m(t),r]),S=e=>o(o(rx(e),([t,r])=>[t,r],()=>o(ex(e),([t,r])=>[t,r],()=>o(Qy(e),([t,r])=>[t,r],()=>o(wa(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),nx=e=>o(Ta(e),([t,r])=>[zm(t),r]),ax=e=>o(Y(e),([t,r])=>[t,r]),ox=e=>o(ka(["'",'"'],e),([t,r])=>[t,r]),ix=e=>o(o(u("[",e),([t,r])=>o(Y(r),([n,a])=>o(u(":",a),([s,m])=>o(o(bu(m),([c,l])=>[c,l],()=>o(Iu(m),([c,l])=>[c,l],()=>o(xu(m),([c,l])=>[c,l],()=>o(vu(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[Vm(t),r]),Su=e=>o(o(nx(e),([t,r])=>[t,r],()=>o(ax(e),([t,r])=>[t,r],()=>o(ox(e),([t,r])=>[t,r],()=>o(ix(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),sx=e=>o(o(o(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Bm(t),r]),mx=e=>o(o(o(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Wm(t),r]),Ou=e=>o(o(sx(e),([t,r])=>o(Su(r),([n,a])=>o(mx(a),([s,m])=>o(u(":",m),([c,l])=>o(S(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[Hm(t),r]),Pu=e=>o(o(o(u(",",e),([t,r])=>o(u(`
3
+ `:"";Ze(j,`${U}${ot}node_modules
4
+ `,"utf-8")}let Q=ue(r,"node_modules"),Ie=ue(n,"node_modules");if(Ma(Q)&&!Ma(Ie))try{vf(Q,Ie,process.platform==="win32"?"junction":"dir")}catch{}try{If(s,ue(n,"agent_prompt.md"))}catch{}let Me=Aa(a,"utf-8"),Ce=Ef(Me),je=ue(n,"test.patch");Ze(je,Me,"utf-8");let Xe=await t.exec("git",["apply","test.patch"],c);try{$f(je)}catch{}if(Xe.code!==0)return{status:"patchFailed",solverDir:n,error:Xe.stderr?.trim()||"git apply test.patch failed"};let F=await t.exec("git",["add","-A"],c);if(F.code!==0)return{status:"error",solverDir:n,error:F.stderr?.trim()||"git add (tests applied) failed"};let It=await t.exec("git",["commit","-m","tests applied","--allow-empty"],c);if(It.code!==0)return{status:"error",solverDir:n,error:It.stderr?.trim()||"git commit (tests applied) failed"};let at=await t.exec("git",["rev-parse","HEAD"],c);return at.code!==0||!at.stdout.trim()?{status:"error",solverDir:n,error:"Could not resolve tests-applied commit hash."}:{status:"ok",solverDir:n,testsAppliedCommit:at.stdout.trim(),testPatchPaths:Ce}}async function ai(e){let{pi:t,index:r,workspace:n,status:a,durationMs:s}=e,{solverDir:m,testsAppliedCommit:c,testPatchPaths:l}=n,I={cwd:m,timeout:qa};await t.exec("git",["add","-A"],I);let x=[...l,"agent_prompt.md"].map(F=>`:(exclude)${F}`),j=await t.exec("git",["diff","--cached",c,"--",".",...x],I),U=j.code===0?j.stdout:"",Q=ue(m,"test_output.xml"),Ie=`bash test.sh --output_path ${sn(on(Q))} new`,Me=an(),Ce=await t.exec(Me,["-c",`cd ${sn(on(m))} && ${Ie}`],{timeout:qa*10}),je=Ce.code===0,Xe=wf(`${Ce.stdout}
5
+ ${Ce.stderr}`.trim(),Tf);return{index:r,status:a,passed:je,diff:U,testOutputTail:Xe,durationMs:s,testOutputXmlPath:Q}}function oi(e){let{repoDir:t,runId:r,index:n,trajectory:a,solutionPatch:s,testOutputXmlPath:m,testOutputTail:c}=e,l=ue(t,kf,r,`solver_${n}`);Ca(l,{recursive:!0}),Ze(ue(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),Ze(ue(l,"solution.patch"),s,"utf-8");try{let I=Aa(m,"utf-8");Ze(ue(l,"test_output.xml"),I,"utf-8")}catch{Ze(ue(l,"test_output.txt"),c,"utf-8")}return l}function ii(e,t){let r=ue(e,dr);Ca(r,{recursive:!0});let n=t.map(a=>{let s=ue(r,`solver_${a.index}`);return Ca(s,{recursive:!0}),Ze(ue(s,"solution.diff"),a.diff,"utf-8"),Ze(ue(s,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return Ze(ue(r,"manifest.json"),JSON.stringify(n,null,2),"utf-8"),r}function si(e){let t=ue(e,"node_modules");try{bf(t).isSymbolicLink()&&ri(t,{force:!0})}catch{}try{ri(e,{recursive:!0,force:!0})}catch{}}var p={};kt(p,{Assign:()=>Rf,Clone:()=>yr,Create:()=>Ag,Discard:()=>qg,Metrics:()=>Ae,Update:()=>Lg});var Ae={assign:0,create:0,clone:0,discard:0,update:0};function Rf(e,t){return Ae.assign+=1,{...e,...t}}var i={};kt(i,{Entries:()=>Hf,EntriesRegExp:()=>Wf,Every:()=>zf,EveryAll:()=>Bf,GraphemeCount:()=>Uf,HasPropertyKey:()=>Vf,IsArray:()=>gr,IsBigInt:()=>fr,IsBoolean:()=>hi,IsClassInstance:()=>Nf,IsConstructor:()=>Af,IsDeepEqual:()=>Da,IsEqual:()=>P,IsFunction:()=>yi,IsGreaterEqualThan:()=>Ii,IsGreaterThan:()=>jf,IsInteger:()=>ja,IsLessEqualThan:()=>xi,IsLessThan:()=>Ff,IsMaxLength:()=>Kf,IsMinLength:()=>_f,IsMultipleOf:()=>Df,IsNull:()=>cn,IsNumber:()=>ln,IsObject:()=>hr,IsObjectNotArray:()=>qf,IsString:()=>dn,IsSymbol:()=>Lf,IsUndefined:()=>Fa,IsUnsafePropertyKey:()=>bi,IsValueLike:()=>Gf,Keys:()=>un,ShiftLeft:()=>fn,Symbols:()=>Yf,Values:()=>Jf});function Et(e,t,r){return e>=t&&e<=r}function Sf(e){return e===8205}function Of(e){return Et(e,55296,56319)}function mi(e){return Et(e,127462,127487)}function ui(e){return Et(e,65024,65039)}function ci(e){return Et(e,768,879)||Et(e,6832,6911)||Et(e,7616,7679)||Et(e,65056,65071)}function pn(e){return e>65535?2:1}function pi(e,t){for(;t<e.length;){let r=e.codePointAt(t);if(ci(r)||ui(r))t+=pn(r);else break}return t}function La(e,t){let r=e.codePointAt(t),n=t+pn(r);for(n=pi(e,n);n<e.length-1&&e[n]==="\u200D";){let a=e.codePointAt(n+1);n+=1+pn(a),n=pi(e,n)}return mi(r)&&n<e.length&&mi(e.codePointAt(n))&&(n+=pn(e.codePointAt(n))),n}function li(e){return Of(e)||ci(e)||ui(e)||Sf(e)}function di(e){let t=0,r=0;for(;r<e.length;)r=La(e,r),t++;return t}function Pf(e,t){if(t===0)return!0;let r=0,n=0;for(;n<e.length;)if(n=La(e,n),r++,r>=t)return!0;return!1}function Mf(e,t){let r=0,n=0;for(;n<e.length;)if(n=La(e,n),r++,r>t)return!1;return!0}function fi(e,t){if(t===0)return!0;let r=0;for(;r<e.length;){if(li(e.charCodeAt(r)))return Pf(e,t);if(r++,r>=t)return!0}return!1}function gi(e,t){let r=0;for(;r<e.length;){if(li(e.charCodeAt(r)))return Mf(e,t);if(r++,r>t)return!1}return!0}function gr(e){return Array.isArray(e)}function fr(e){return P(typeof e,"bigint")}function hi(e){return P(typeof e,"boolean")}function Af(e){if(Fa(e)||!yi(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function yi(e){return P(typeof e,"function")}function ja(e){return Number.isInteger(e)}function cn(e){return P(e,null)}function ln(e){return Number.isFinite(e)}function qf(e){return hr(e)&&!gr(e)}function hr(e){return P(typeof e,"object")&&!cn(e)}function dn(e){return P(typeof e,"string")}function Lf(e){return P(typeof e,"symbol")}function Fa(e){return P(e,void 0)}function P(e,t){return e===t}function jf(e,t){return e>t}function Ff(e,t){return e<t}function xi(e,t){return e<=t}function Ii(e,t){return e>=t}function Df(e,t){if(fr(e)||fr(t))return BigInt(e)%BigInt(t)===0n;let r=1e-10;if(!ln(e)||ja(e)&&1/t%1===0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<r}function Nf(e){if(!hr(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return cn(t)?!1:P(typeof t.constructor,"function")&&!(P(t.constructor,globalThis.Object)||P(t.constructor.name,"Object"))}function Gf(e){return fr(e)||hi(e)||cn(e)||ln(e)||dn(e)||Fa(e)}function Uf(e){return di(e)}function Kf(e,t){return gi(e,t)}function _f(e,t){return fi(e,t)}function zf(e,t,r){for(let n=t;n<e.length;n++)if(!r(e[n],n))return!1;return!0}function Bf(e,t,r){let n=!0;for(let a=t;a<e.length;a++)r(e[a],a)||(n=!1);return n}function fn(e,t,r){return P(e.length,0)?r():t(e[0],e.slice(1))}function bi(e){return P(e,"__proto__")||P(e,"constructor")||P(e,"prototype")}function Vf(e,t){return bi(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Wf(e){return un(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function Hf(e){return Object.entries(e)}function un(e){return Object.getOwnPropertyNames(e)}function Yf(e){return Object.getOwnPropertySymbols(e)}function Jf(e){return Object.values(e)}function Xf(e,t){if(!hr(t))return!1;let r=un(e);return P(r.length,un(t).length)&&r.every(n=>Da(e[n],t[n]))}function Zf(e,t){return gr(t)&&P(e.length,t.length)&&e.every((r,n)=>Da(e[n],t[n]))}function Da(e,t){return gr(e)?Zf(e,t):hr(e)?Xf(e,t):P(e,t)}var st={};kt(st,{IsBigInt64Array:()=>dg,IsBigUint64Array:()=>fg,IsBoolean:()=>eg,IsDate:()=>hg,IsFloat32Array:()=>cg,IsFloat64Array:()=>lg,IsInt16Array:()=>sg,IsInt32Array:()=>pg,IsInt8Array:()=>ag,IsMap:()=>xg,IsNumber:()=>tg,IsRegExp:()=>gg,IsSet:()=>yg,IsString:()=>rg,IsTypeArray:()=>ng,IsUint16Array:()=>mg,IsUint32Array:()=>ug,IsUint8Array:()=>og,IsUint8ClampedArray:()=>ig});function eg(e){return e instanceof Boolean}function tg(e){return e instanceof Number}function rg(e){return e instanceof String}function ng(e){return globalThis.ArrayBuffer.isView(e)}function ag(e){return e instanceof globalThis.Int8Array}function og(e){return e instanceof globalThis.Uint8Array}function ig(e){return e instanceof globalThis.Uint8ClampedArray}function sg(e){return e instanceof globalThis.Int16Array}function mg(e){return e instanceof globalThis.Uint16Array}function pg(e){return e instanceof globalThis.Int32Array}function ug(e){return e instanceof globalThis.Uint32Array}function cg(e){return e instanceof globalThis.Float32Array}function lg(e){return e instanceof globalThis.Float64Array}function dg(e){return e instanceof globalThis.BigInt64Array}function fg(e){return e instanceof globalThis.BigUint64Array}function gg(e){return e instanceof globalThis.RegExp}function hg(e){return e instanceof globalThis.Date}function yg(e){return e instanceof globalThis.Set}function xg(e){return e instanceof globalThis.Map}function bg(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function vg(e){let t={},r=Object.getOwnPropertyDescriptors(e);for(let n of Object.keys(r)){if(i.IsUnsafePropertyKey(n))continue;let a=r[n];i.HasPropertyKey(a,"value")&&Object.defineProperty(t,n,{...a,value:wt(a.value)})}return t}function $g(e){let t={};for(let r of i.Keys(e))i.IsUnsafePropertyKey(r)||(t[r]=wt(e[r]));for(let r of i.Symbols(e))t[r]=wt(e[r]);return t}function Tg(e){return i.IsClassInstance(e)?e:bg(e)?vg(e):$g(e)}function kg(e){return e.map(t=>wt(t))}function Eg(e){return e.slice()}function wg(e){return new RegExp(e.source,e.flags)}function Rg(e){return new Map(wt([...e.entries()]))}function Sg(e){return new Set(wt([...e.values()]))}function wt(e){return st.IsTypeArray(e)?Eg(e):st.IsRegExp(e)?wg(e):st.IsMap(e)?Rg(e):st.IsSet(e)?Sg(e):i.IsArray(e)?kg(e):i.IsObject(e)?Tg(e):e}function yr(e){return Ae.clone+=1,wt(e)}var Rt={};kt(Rt,{Get:()=>Mg,Reset:()=>Og,Set:()=>Pg});var Qe={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Og(){Qe.immutableTypes=!1,Qe.maxErrors=8,Qe.useAcceleration=!0,Qe.exactOptionalPropertyTypes=!1,Qe.enumerableKind=!1,Qe.correctiveParse=!1,Qe.unionPrioritySort=!0}function Pg(e){for(let t of i.Keys(e)){let r=e[t];r!==void 0&&Object.defineProperty(Qe,t,{value:r})}}function Mg(){return Qe}function Cg(e,t){for(let r of Object.keys(t))Object.defineProperty(e,r,{configurable:!0,writable:!0,enumerable:!1,value:t[r]});return e}function vi(e,t){return{...e,...t}}function Ag(e,t,r={}){Ae.create+=1;let n=Rt.Get(),a=vi(t,r),s=n.enumerableKind?vi(a,e):Cg(a,e);return n.immutableTypes?Object.freeze(s):s}function qg(e,t){Ae.discard+=1;let r={},n=Object.getOwnPropertyDescriptors(yr(e)),a=new Set(t);for(let s of Object.keys(n))a.has(s)||Object.defineProperty(r,s,n[s]);return r}function Lg(e,t,r){Ae.update+=1;let n=Rt.Get(),a=yr(e);for(let s of Object.keys(t))Object.defineProperty(a,s,{configurable:!0,writable:!0,enumerable:n.enumerableKind,value:t[s]});for(let s of Object.keys(r))Object.defineProperty(a,s,{configurable:!0,enumerable:!0,writable:!0,value:r[s]});return a}function g(e,t){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],t)}function ee(e){return i.IsObject(e)}function y(e,t,r){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:r},{})}function mt(e){return g(e,"Deferred")}function jg(e){return p.Update(e,{"~readonly":!0},{})}function xr(e,t){return p.Update(jg(e),{},t)}function $i(e,t,r,n){let a=d(e,t,r);return xr(a,n)}function Fg(e){return p.Update(e,{"~optional":!0},{})}function Ir(e,t){return p.Update(Fg(e),{},t)}function Ti(e,t,r,n){let a=d(e,t,r);return Ir(a,n)}function Te(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function K(e){return g(e,"Array")}function gn(e){return p.Discard(e,["~kind","type","items"])}function De(e,t,r={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},r)}function re(e){return g(e,"Constructor")}function ki(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ne(e,t,r={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},r)}function ne(e){return g(e,"Function")}function Ei(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function et(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function ae(e){return g(e,"Ref")}function pt(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Kt(e){return g(e,"Generic")}function _t(e){return p.Create({"~kind":"Any"},{},e)}function Y(e){return g(e,"Any")}var wi="(?!)";function q(e){return p.Create({"~kind":"Never"},{not:{}},e)}function ut(e){return g(e,"Never")}function Ge(e,t={}){return y("AddOptional",[e],t)}function St(e,t={}){return Ir(e,t)}function Ri(e){return St(e)}function ce(e){return ee(e)&&i.HasPropertyKey(e,"~optional")}function Si(e){return i.Keys(e).filter(t=>!ce(e[t]))}function hn(e){return i.Keys(e)}function yn(e){return i.Values(e)}function v(e,t={}){let r=Si(e),n=r.length>0?{required:r}:{};return p.Create({"~kind":"Object"},{type:"object",...n,properties:e},t)}function M(e){return g(e,"Object")}function Oi(e){return p.Discard(e,["~kind","type","properties","required"])}function oe(e){return p.Create({"~kind":"Unknown"},{},e)}function te(e){return g(e,"Unknown")}function Ue(e,t,r){let n=i.Keys(e).reduce((a,s)=>({...a,[s]:p.Update(e[s],{},{$id:s})}),{});return p.Create({"~kind":"Cyclic"},{$defs:n,$ref:t},r)}function se(e){return g(e,"Cyclic")}function Pi(e){return p.Update(e,{"~unsafe":null},{})}function xn(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var Ke={};kt(Ke,{Match:()=>Dg});function Dg(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function br(...e){let[t,r]=Ke.Match(e,{2:(n,a)=>[n,a,a],1:n=>[n,oe(),oe()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:r},{})}function W(e){return g(e,"Infer")}function Ot(e,t,r,n={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:r},n)}function B(e){return g(e,"Dependent")}function Mi(e){return p.Discard(e,["~kind","if","then","else"])}function Ci(e){return i.IsObjectNotArray(e)}function Ai(e){return i.Keys(e).filter(r=>isNaN(r)).reduce((r,n)=>[...r,e[n]],[])}function qi(e){return i.IsString(e)||i.IsNumber(e)}function Li(e,t){let r=Ci(e)?Ai(e):e;return p.Create({"~kind":"Enum"},{enum:r},t)}function de(e){return g(e,"Enum")}function le(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function R(e){return g(e,"Intersect")}function ji(e){return p.Discard(e,["~kind","allOf"])}function H(){throw new Error("Unreachable")}var Fi;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(Fi||(Fi={}));var IT=BigInt("14695981039346656037"),[bT,vT]=[BigInt("1099511628211"),BigInt("18446744073709551616")],$T=Array.from({length:256}).map((e,t)=>BigInt(t)),Di=new Float64Array(1),TT=new DataView(Di.buffer),kT=new Uint8Array(Di.buffer);var ET=new TextEncoder;var vr=class{constructor(t,r){this.type=t,this.decode=r}Encode(t){let r=this.type,n=In(r)?m=>this.decode(r["~codec"].decode(m)):this.decode,a=In(r)?m=>r["~codec"].encode(t(m)):t,s={decode:n,encode:a};return p.Update(this.type,{"~codec":s},{})}},$r=class{constructor(t){this.type=t}Decode(t){return new vr(this.type,t)}};function bn(e){return new $r(e)}function Gi(e,t){return bn(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Ui(e,t){return bn(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function In(e){return ee(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function Ki(e){return zt(e)}function Pt(e){return ee(e)&&i.HasPropertyKey(e,"~immutable")}function _e(e,t={}){return y("AddReadonly",[e],t)}function Mt(e,t={}){return xr(e,t)}function _i(e){return Mt(e)}function Ct(e){return ee(e)&&i.HasPropertyKey(e,"~readonly")}function Kg(e,t){let r=Na(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":r},{})}function zi(...e){let[t,r,n]=Ke.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return Kg(t,{check:r,error:n})}function _g(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function Na(e){return ee(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>_g(t))}var Bi="-?(?:0|[1-9][0-9]*)n";function Tr(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function ze(e){return g(e,"BigInt")}function vn(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Re(e){return g(e,"Boolean")}function kr(e){return p.Create({"~kind":"Identifier"},{name:e})}function Vi(e){return g(e,"Identifier")}var $n="-?(?:0|[1-9][0-9]*)";function At(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function fe(e){return g(e,"Integer")}var Ga=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function zg(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new Ga(e)})()}function S(e,t){return p.Create({"~kind":"Literal"},{type:zg(e),const:e},t)}function Tn(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function Wi(e){return C(e)&&i.IsNumber(e.const)}function Hi(e){return C(e)&&i.IsString(e.const)}function C(e){return g(e,"Literal")}function Bt(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Vt(e){return g(e,"Null")}var kn="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function be(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function J(e){return g(e,"Number")}function Wt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function ct(e){return g(e,"Symbol")}function qt(...e){let[t,r,n]=Ke.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,s],1:a=>[a,oe(),oe()]});return p.Create({"~kind":"Parameter"},{name:t,extends:r,equals:n},{})}function Yi(e){return g(e,"Parameter")}var En=".*";function Se(e){return p.Create({"~kind":"String"},{type:"string"},e)}function ge(e){return g(e,"String")}function k(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function h(e){return g(e,"Union")}function Ji(e){return p.Discard(e,["~kind","anyOf"])}function Er(e){let t=Xi(e);return i.IsEqual(t.length,2)?t[0]:[]}function Bg(e){return!0}function Zi(e){return i.ShiftLeft(e,(t,r)=>Vg(t)?Zi(r):!1,()=>!0)}function Qi(e){return i.IsEqual(e.length,0)?!1:Zi(e)}function Vg(e){return h(e)?Qi(e.anyOf):C(e)?Bg(e.const):!1}function wn(e){return Qi(e)}function Rn(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function es(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>es(a,t,[...r,`${n}${t}`]),()=>r)}function Wg(e,t){return i.IsEqual(e.length,0)?[`${t}`]:es(e,t)}function ts(e,t,r=[]){return i.ShiftLeft(t,(n,a)=>ts(e,a,[...r,...rs(e,n)]),()=>r)}function rs(e,t){return h(t)?ts(e,t.anyOf):C(t)?Wg(e,t.const):H()}function ns(e,t){return i.ShiftLeft(t,(r,n)=>ns(rs(e,r),n),()=>e)}function Hg(e){return e.map(t=>S(t))}function Yg(e){let t=ns([],e),r=Hg(t);return k(r)}function Jg(e){return i.IsEqual(e.length,0)?H():i.IsEqual(e.length,1)&&C(e[0])?e[0]:Yg(e)}function Ua(e){let t=Er(e);return i.IsEqual(t.length,0)?Se():wn(t)?Jg(t):Rn(e)}function as(e){let t=Ua(e);return X(t)?Se():t}function ye(e,t){let r="object",n={[e]:t};return p.Create({"~kind":"Record"},{type:r,patternProperties:n})}function os(e){return ye(qe,e)}function is(e){return v({true:e,false:e})}function Z(e,t={}){let[r,n,a]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:a,items:r,minItems:n},t)}function L(e){return g(e,"Tuple")}function ss(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Xg(e){return p.Discard(e,["~readonly"])}function Ka(e,t){return p.Update(Xg(e),{},t)}function ms(e,t,r,n){let a=d(e,t,r);return Ka(a,n)}function ps(e,t={}){return y("RemoveReadonly",[e],t)}function us(e,t={}){return Ka(e,t)}function Zg(e){return p.Discard(e,["~optional"])}function _a(e,t){return p.Update(Zg(e),{},t)}function cs(e,t,r,n){let a=d(e,t,r);return _a(a,n)}function ls(e,t={}){return y("RemoveOptional",[e],t)}function Sn(e,t={}){return _a(e,t)}function za(e){return e.reduceRight((r,n,a)=>({[a]:n,...r}),{})}function ds(e){let t=za(e.items);return v(t)}function Qg(e,t){return Ct(e)?!!Ct(t):!1}function eh(e,t){return ce(e)?!!ce(t):!1}function th(e,t){let r=Qg(e,t),n=eh(e,t),a=_([e,t]),s=us(Sn(a));return r&&n?Mt(St(s)):r&&!n?Mt(s):!r&&n?St(s):s}function rh(e,t,r){return r in e?r in t?th(e[r],t[r]):e[r]:r in t?t[r]:q()}function nh(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((n,a)=>({...n,[a]:rh(e,t,a)}),{})}function fs(e){return M(e)?e.properties:L(e)?za(e.items):H()}function gs(e,t){let r=fs(e),n=fs(t),a=nh(r,n);return v(a)}function hs(e,t){let r=Ht(e,t);return i.IsEqual(r,Rr)?e:i.IsEqual(r,Sr)||i.IsEqual(r,wr)?t:q()}function ys(e){return M(e)||L(e)}function ah(e,t){let r=h(e),n=h(t);return r||n}function oh(e,t){let r=Oe(e),n=Oe(t),a=ah(r,n),s=ys(r),m=ys(n);return a?_([r,n]):s&&m?gs(r,n):s&&!m?r:!s&&m?n:hs(r,n)}function xs(e,t,r=[]){return i.ShiftLeft(t,(n,a)=>xs(e,a,[...r,oh(e,n)]),()=>i.IsEqual(r.length,0)?[e]:r)}function Is(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>Is(a,t,[...r,...Or([n],t)]),()=>r)}function Or(e,t=[]){return i.ShiftLeft(e,(r,n)=>h(r)?Or(n,Is(r.anyOf,t)):Or(n,xs(r,t)),()=>t)}function ih(e,t){let r=me({},e,t);return b.IsExtendsTrueLike(r)?[]:[e]}function sh(e,t){return e.reduce((r,n)=>[...r,...ih(n,t)],[])}function On(e,t){let r=Oe(e),n=h(r)?r.anyOf:[r],a=sh(n,t);return ve(a)}function Le(e,t,r){let n=le([e,t]),a=On(r,e);return ve([n,a])}function ke(e){let t=e.map(r=>S(r));return ve(t)}function _(e){let t=Or(e),r=Ba(t);return tt(r)}function xe(e){let t=as(e);return Oe(t)}function ve(e){let t=Ba(e);return tt(t)}function Oe(e){return B(e)?Le(e.if,e.then,e.else):de(e)?ke(e.enum):R(e)?_(e.allOf):X(e)?xe(e.pattern):h(e)?ve(e.anyOf):e}function tt(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?q():k(e)}function bs(e,t){let r=ke(e);return lt(r,t)}function vs(e,t){return ye(dt,t)}function $s(e,t){let r=_(e);return lt(r,t)}function Ts(e,t){return i.IsString(e)||i.IsNumber(e)?v({[e]:t}):i.IsEqual(e,!1)?v({false:t}):i.IsEqual(e,!0)?v({true:t}):v({})}function ks(e,t){return ye(Yt,t)}function Es(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?ye(e.pattern.toString(),t):ye(qe,t)}function ws(e,t){let r=Er(e);return wn(r)?lt(xe(e),t):ye(e,t)}function mh(e){return h(e)?Pr(e.anyOf):[e]}function Pr(e){return e.reduce((t,r)=>[...t,...mh(r)],[])}function ph(e){return e.some(t=>ge(t)||J(t)||fe(t))}function uh(e,t){return i.IsEqual(ph(e),!0)?ye(qe,t):void 0}function ch(e,t){return e.reduce((r,n)=>C(n)&&(i.IsString(n.const)||i.IsNumber(n.const))?{...r,[n.const]:t}:r,{})}function lh(e,t){let r=ch(e,t);return v(r)}function Rs(e,t){let r=Pr(e),n=uh(r,t);return ee(n)?n:lh(r,t)}function lt(e,t){return Y(e)?os(t):Re(e)?is(t):de(e)?bs(e.enum,t):fe(e)?vs(e,t):R(e)?$s(e.allOf,t):C(e)?Ts(e.const,t):J(e)?ks(e,t):h(e)?Rs(e.anyOf,t):ge(e)?Es(e,t):X(e)?ws(e.pattern,t):v({})}function Va(e,t,r){return T([e])?p.Update(lt(e,t),{},r):Pn(e,t,r)}function Ss(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Va(s,m,a)}var dt=`^${$n}$`,Yt=`^${kn}$`,qe=`^${En}$`;function Pn(e,t,r={}){return y("Record",[e,t],r)}function Mn(e,t,r={}){return Va(e,t,r)}function Os(e,t){return ye(e,t)}function Cn(e){return i.IsEqual(e,qe)?Se():i.IsEqual(e,dt)?At():i.IsEqual(e,Yt)?be():Ua(e)}function Pe(e){return i.Keys(e.patternProperties)[0]}function Jt(e){let t=Pe(e);return Cn(t)}function he(e){return e.patternProperties[Pe(e)]}function pe(e){return g(e,"Record")}function Lt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function ft(e){return g(e,"Rest")}function An(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function qn(e){return g(e,"This")}function Xt(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function Zt(e){return g(e,"Undefined")}function Ln(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Be(e){return g(e,"Void")}function fh(e,t){return i.IsEqual(e,"Array")?Te(t[0]):i.IsEqual(e,"Capitalize")?Fn(t[0]):i.IsEqual(e,"ConstructorParameters")?Kn(t[0]):i.IsEqual(e,"Evaluate")?Mp(t[0]):i.IsEqual(e,"Exclude")?_n(t[0],t[1]):i.IsEqual(e,"Extract")?zn(t[0],t[1]):i.IsEqual(e,"Index")?qr(t[0],t[1]):i.IsEqual(e,"InstanceType")?Bn(t[0]):i.IsEqual(e,"Lowercase")?Dn(t[0]):i.IsEqual(e,"NonNullable")?Vn(t[0]):i.IsEqual(e,"Omit")?Wn(t[0],t[1]):i.IsEqual(e,"Parameters")?Hn(t[0]):i.IsEqual(e,"Partial")?Yn(t[0]):i.IsEqual(e,"Pick")?Jn(t[0],t[1]):i.IsEqual(e,"Readonly")?Xn(t[0]):i.IsEqual(e,"KeyOf")?Lr(t[0]):i.IsEqual(e,"Record")?Pn(t[0],t[1]):i.IsEqual(e,"Required")?Zn(t[0]):i.IsEqual(e,"ReturnType")?Qn(t[0]):i.IsEqual(e,"Uncapitalize")?Nn(t[0]):i.IsEqual(e,"Uppercase")?Gn(t[0]):Ar(et(e),t)}function jt(){throw Error("Unreachable")}var gh=(e,t=[])=>e.reduce((r,n)=>i.IsArray(n)&&i.IsEqual(n.length,2)?[...r,n[0]]:[...r,n],[]),rt=e=>{let[t,r]=e;return gh([...t,...r])};function qs(e){return qt(e[0],e[2],e[4])}function Ls(e){return qt(e[0],e[2],e[2])}function js(e){return qt(e[0],oe(),e[2])}function Fs(e){return qt(e,oe(),oe())}function Ds(e){return rt(e)}function Ns(e){return e[1]}function Gs(e){return rt(e)}function Us(e){return e[1]}function Ks(e){return fh(e[0],e[1])}function _s(e){return null}function zs(e){return Se()}function Bs(e){return be()}function Vs(e){return vn()}function Ws(e){return Xt()}function Hs(e){return Bt()}function Ys(e){return At()}function Js(e){return Tr()}function Xs(e){return oe()}function Zs(e){return _t()}function Qs(e){return v({})}function em(e){return q()}function tm(e){return Wt()}function rm(e){return Ln()}function nm(e){return An()}function am(e){return S(BigInt(e))}function om(e){return S(i.IsEqual(e,"true"))}function im(e){return S(parseFloat(e))}function sm(e){return S(e)}function mm(e){return e[1]}function pm(e){return S(e)}function um(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function cm(e){return e[1]}function lm(e){return jn(e)}function dm(e){return i.IsEqual(e.length,6)?Ot(e[1],e[3],e[5]):Ot(e[1],e[3],oe())}function fm(e){return e.length>0}function gm(e){return e.reduce((t,r)=>i.IsEqual(r.length,3)?[...t,[r[1]]]:[...t,[]],[])}function hm(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function ym(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function xm(e){return i.IsEqual(e.length,2)?e[1]:[]}function Ps(e,t){return t.reduce((r,n)=>{let a=n;return i.IsEqual(a.length,1)?qr(r,a[0]):i.IsEqual(a.length,0)?Te(r):jt()},e)}function Ms(e,t){return i.IsEqual(t.length,3)?Un(e,t[0],t[1],t[2]):e}function hh(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:ea(e,t)}function Im(e){let[t,r,n,a,s]=e;return hh(Ms(t?Lr(Ps(r,n)):Ps(r,n),a),s)}function Wa(e,t){return i.IsEqual(t.length,3)?(()=>{let[r,n,a]=t,s=Wa(n,a);if(i.IsEqual(r,"&"))return R(s)?le([e,...s.allOf]):le([e,s]);if(i.IsEqual(r,"|"))return h(s)?k([e,...s.anyOf]):k([e,s]);jt()})():e}function bm(e){let[t,r]=e;return Wa(t,r)}function vm(e){let[t,r]=e;return Wa(t,r)}function $m(e){return Pp(e[1])}function Tm(e){return e[1]}function km(e){return pt(e[0],e[2])}function Em(e){return i.IsEqual(e.length,4)?br(e[1],e[3]):i.IsEqual(e.length,2)?br(e[1],oe()):jt()}function wm(e){return`${e}`}function Rm(e){return fe(e[3])?dt:J(e[3])?Yt:ct(e[3])?qe:ge(e[3])?qe:jt()}function Sm(e){return e.length>0}function Om(e){return e.length>0}function Pm(e){let[t,r,n,a,s]=e;return{[r]:t&&n?_e(Ge(s)):t&&!n?_e(s):!t&&n?Ge(s):s}}function Mm(e){return rt(e)}function Cm(e){return e.reduce((t,r)=>i.HasPropertyKey(r,dt)||i.HasPropertyKey(r,Yt)||i.HasPropertyKey(r,qe)?[t[0],p.Assign(t[1],r)]:[p.Assign(t[0],r),t[1]],[{},{}])}function Am(e){return Cm(e[1])}function qm(e){let[t,r]=e,n=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return v(t,n)}function Lm(e){return i.IsEqual(e.length,5)?_e(Ge(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?_e(e[3]):Ge(e[3]):jt()}function jm(e){return _e(Ge(e[1]))}function Fm(e){return _e(e[1])}function Dm(e){return Ge(e[0])}function Nm(e){return i.IsEqual(e.length,2)?Lt(e[1]):i.IsEqual(e.length,1)?e[0]:jt()}function Gm(e){return rt(e)}function Um(e){return Z(e[1])}function Km(e){return _e(Ge(e[4]))}function _m(e){return _e(e[3])}function zm(e){return Ge(e[3])}function Bm(e){return e[2]}function Vm(e){return i.IsEqual(e.length,2)?Lt(e[1]):i.IsEqual(e.length,1)?e[0]:jt()}function Wm(e){return rt(e)}function Hm(e){return Ne(e[1],e[4])}function Ym(e){return De(e[2],e[5])}function Cs(e,t){return i.IsEqual(e,"remove")?ps(t):i.IsEqual(e,"add")?_e(t):t}function Jm(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function As(e,t){return i.IsEqual(e,"remove")?ls(t):i.IsEqual(e,"add")?Ge(t):t}function Xm(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function Zm(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function Qm(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?Mr(kr(e[3]),e[5],e[6][0],Cs(e[1],As(e[8],e[10]))):Mr(kr(e[3]),e[5],et(e[3]),Cs(e[1],As(e[8],e[10])))}function ep(e){return et(e)}function tp(e){return BigInt(e)}function rp(e){return parseFloat(e)}function np(e){return i.IsEqual(e,"true")}function ap(e){return null}function op(e){return{[e[0]]:e[2]}}function ip(e){return rt(e)}function yh(e){return e.reduce((t,r)=>p.Assign(t,r),{})}function sp(e){return yh(e[1])}function mp(e){return rt(e)}function pp(e){return e[1]}function up(e){return Tr()}function cp(e){return Se()}function lp(e){return be()}function dp(e){return At()}function fp(e){return q()}function gp(e){return S(e)}function hp(e){return k(e[1])}function yp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function xp(e){return[e[0],...e[1]]}function Ip(e){return e[1]}function bp(e){return rt(e)}function vp(e){return i.IsEqual(e.length,2)?e[1]:[]}function $p(e){let t=e[2],r=e[3],[n,a]=e[4],s=i.IsEqual(i.Keys(a).length,0)?{}:{patternProperties:a};return{[e[1]]:pt(t,Cr(r,n,s))}}function Tp(e){let t=e[2],[r,n]=e[3],a=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return{[e[1]]:Cr(t,r,a)}}function kp(e){return{[e[1]]:pt(e[2],e[4])}}function Ep(e){return{[e[1]]:e[3]}}function wp(e){return null}function Rp(e){return Cm(rt(e))}function Sp(e){return e[1]}function Op(e){let t=e[0],r=e[1];return Cp(p.Assign(t,r[0]))}function jr(e){return P(e.length,2)}function E(e,t,r){return jr(e)?t(e[0],e[1]):r()}function bh(e,t){return P(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function z(e,t){for(let r=0;r<e.length;r++){let n=bh(e[r],t);if(jr(n))return n}return[]}function Ha(e,t){return Array.from({length:t-e+1},(r,n)=>String.fromCharCode(e+n))}var Ap=[...Ha(97,122),...Ha(65,90)],Ya="0",Ja=Ha(49,57),Qt=[Ya,...Ja],qp=" ",er=`
6
+ `;var gt="_",ta=".",Lp="$",ra="-";var jp="//",Fp="/*",$h="*/";function Dp(e){let t=e.indexOf($h);return P(t,-1)?"":e.slice(t+2)}function Np(e){let t=e.indexOf(er);return P(t,-1)?"":e.slice(t)}function Th(e){return e.replace(/^[ \t\r\f\v]+/,"")}function na(e){let t=Th(e);return t.startsWith(Fp)?na(Dp(t.slice(2))):t.startsWith(jp)?na(Np(t.slice(2))):t}function ie(e){let t=e.trimStart();return t.startsWith(Fp)?ie(Dp(t.slice(2))):t.startsWith(jp)?ie(Np(t.slice(2))):t}function aa(e,t){return E(z([e],t),(r,n)=>[r,n],()=>["",t])}function kh(e,t){return e.includes(t)}function tr(e,t,r,n=""){return E(z(e,r),(a,s)=>kh(t,a)?tr(e,t,s,n):tr(e,t,s,`${n}${a}`),()=>[n,r])}function Eh(e){return z(Ja,e)}var wh=[...Qt,gt];function Rh(e){return tr(wh,[gt],e)}function Sh(e){return E(z([Ya],e),(t,r)=>[t,r],()=>E(Eh(e),(t,r)=>E(Rh(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[]))}function oa(e){return Sh(ie(e))}function Oh(e){return aa(ra,e)}function Ph(e){return E(Oh(e),(t,r)=>E(oa(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function Gp(e){return Ph(ie(e))}function Mh(e){return E(Gp(e),(t,r)=>E(z(["n"],r),(n,a)=>[`${t}`,a],()=>[]),()=>[])}function Xa(e){return Mh(e)}function Za(e,t){return z([e],t)}function u(e,t){return P(e,"")?["",t]:e.startsWith(er)?Za(e,na(t)):e.startsWith(qp)?Za(e,t):Za(e,ie(t))}var Up=[...Ap,gt,Lp];function Ch(e){return z(Up,e)}var Ah=[...Up,...Qt];function Kp(e,t=""){return E(z(Ah,e),(r,n)=>Kp(n,`${t}${r}`),()=>[t,e])}function qh(e){return E(Ch(e),(t,r)=>E(Kp(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function V(e){return qh(ie(e))}var Lh=[...Qt,gt];function jh(e){return jr(z([ta],e))}function _p(e){return E(tr(Lh,[gt],e),(t,r)=>P(t,"")?[]:[t,r],()=>[])}function Fh(e){return E(z([ta],e),(t,r)=>E(_p(r),(n,a)=>[`0${t}${n}`,a],()=>[]),()=>[])}function Dh(e){return E(oa(e),(t,r)=>E(z([ta],r),(n,a)=>E(_p(a),(s,m)=>[`${t}${n}${s}`,m],()=>[`${t}`,a]),()=>[`${t}`,r]),()=>[])}function Nh(e){return jh(e)?Fh(e):Dh(e)}function zp(e){return Nh(ie(e))}function Gh(e){return aa(ra,e)}function Uh(e){return E(Gh(e),(t,r)=>E(zp(r),(n,a)=>[`${t}${n}`,a],()=>[]),()=>[])}function ia(e){return Uh(ie(e))}function Kh(e){return P(e,"")?[]:[e.slice(0,1),e.slice(1)]}function Bp(e,t){return fn(e,(r,n)=>t.startsWith(r)?!0:Bp(n,t),()=>!1)}function ht(e,t,r=""){return E(Kh(t),(n,a)=>Bp(e,t)?[r,t]:ht(e,a,`${r}${n}`),()=>[])}function _h(e,t,r){return E(z([e],r),(n,a)=>E(ht([t],a),(s,m)=>E(z([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function zh(e,t,r){return E(z([e],r),(n,a)=>E(ht([er,t],a),(s,m)=>E(z([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function Vp(e,t,r,n){return r?_h(e,t,ie(n)):zh(e,t,ie(n))}function Bh(e,t){return z(e,t)}function Vh(e,t){return Vp(e,e,!1,t)}function Wh(e,t){return E(Bh(e,t),(r,n)=>Vh(r,`${r}${n}`),()=>[])}function sa(e,t){return Wh(e,ie(t))}function Wp(e,t){return E(ht(e,t),(r,n)=>P(r,"")?[]:[r,n],()=>[])}var o=(e,t,r=()=>[])=>e.length===2?t(e):r(),Yh=e=>o(o(V(e),([t,r])=>o(u("extends",r),([n,a])=>o(w(a),([s,m])=>o(u("=",m),([c,l])=>o(w(l),([I,x])=>[[t,n,s,c,I],x]))))),([t,r])=>[qs(t),r]),Jh=e=>o(o(V(e),([t,r])=>o(u("extends",r),([n,a])=>o(w(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Ls(t),r]),Xh=e=>o(o(V(e),([t,r])=>o(u("=",r),([n,a])=>o(w(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[js(t),r]),Zh=e=>o(V(e),([t,r])=>[Fs(t),r]),Jp=e=>o(o(Yh(e),([t,r])=>[t,r],()=>o(Jh(e),([t,r])=>[t,r],()=>o(Xh(e),([t,r])=>[t,r],()=>o(Zh(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),Xp=(e,t=[])=>o(o(Jp(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>Xp(n,[...t,r]),()=>[t,e]),Qh=e=>o(o(Xp(e),([t,r])=>o(o(o(Jp(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Ds(t),r]),to=e=>o(o(u("<",e),([t,r])=>o(Qh(r),([n,a])=>o(u(">",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Ns(t),r]),Zp=(e,t=[])=>o(o(w(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>Zp(n,[...t,r]),()=>[t,e]),ey=e=>o(o(Zp(e),([t,r])=>o(o(o(w(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Gs(t),r]),ty=e=>o(o(u("<",e),([t,r])=>o(ey(r),([n,a])=>o(u(">",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Us(t),r]),ry=e=>o(o(V(e),([t,r])=>o(ty(r),([n,a])=>[[t,n],a])),([t,r])=>[Ks(t),r]),Qp=e=>o(o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[_s(t),r]),eu=e=>o(u("string",e),([t,r])=>[zs(t),r]),tu=e=>o(u("number",e),([t,r])=>[Bs(t),r]),ny=e=>o(u("boolean",e),([t,r])=>[Vs(t),r]),ay=e=>o(u("undefined",e),([t,r])=>[Ws(t),r]),oy=e=>o(u("null",e),([t,r])=>[Hs(t),r]),ru=e=>o(u("integer",e),([t,r])=>[Ys(t),r]),iy=e=>o(u("bigint",e),([t,r])=>[Js(t),r]),sy=e=>o(u("unknown",e),([t,r])=>[Xs(t),r]),my=e=>o(u("any",e),([t,r])=>[Zs(t),r]),py=e=>o(u("object",e),([t,r])=>[Qs(t),r]),uy=e=>o(u("never",e),([t,r])=>[em(t),r]),nu=e=>o(u("symbol",e),([t,r])=>[tm(t),r]),cy=e=>o(u("void",e),([t,r])=>[rm(t),r]),ly=e=>o(u("this",e),([t,r])=>[nm(t),r]),dy=e=>o(o(u("${",e),([t,r])=>o(w(r),([n,a])=>o(u("}",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[mm(t),r]),Qa=e=>o(ht(["${","`"],e),([t,r])=>[pm(t),r]),au=e=>o(o(o(Qa(e),([t,r])=>o(dy(r),([n,a])=>o(au(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o(o(Qa(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(Qa(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[um(t),r]),ro=e=>o(o(u("`",e),([t,r])=>o(au(r),([n,a])=>o(u("`",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[cm(t),r]),fy=e=>o(ro(e),([t,r])=>[lm(t),r]),gy=e=>o(o(o(u("if",e),([t,r])=>o(w(r),([n,a])=>o(u("then",a),([s,m])=>o(w(m),([c,l])=>o(u("else",l),([I,x])=>o(w(x),([j,U])=>[[t,n,s,c,I,j],U])))))),([t,r])=>[t,r],()=>o(o(u("if",e),([t,r])=>o(w(r),([n,a])=>o(u("then",a),([s,m])=>o(w(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>[])),([t,r])=>[dm(t),r]),hy=e=>o(Xa(e),([t,r])=>[am(t),r]),yy=e=>o(o(u("true",e),([t,r])=>[t,r],()=>o(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[om(t),r]),xy=e=>o(ia(e),([t,r])=>[im(t),r]),Iy=e=>o(sa(["'",'"'],e),([t,r])=>[sm(t),r]),by=e=>o(o(o(u("keyof",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[fm(t),r]),ou=(e,t=[])=>o(o(o(u("[",e),([r,n])=>o(w(n),([a,s])=>o(u("]",s),([m,c])=>[[r,a,m],c]))),([r,n])=>[r,n],()=>o(o(u("[",e),([r,n])=>o(u("]",n),([a,s])=>[[r,a],s])),([r,n])=>[r,n],()=>[])),([r,n])=>ou(n,[...t,r]),()=>[t,e]),vy=e=>o(ou(e),([t,r])=>[gm(t),r]),$y=e=>o(o(o(u("extends",e),([t,r])=>o(w(r),([n,a])=>o(u("?",a),([s,m])=>o(w(m),([c,l])=>o(u(":",l),([I,x])=>o(w(x),([j,U])=>[[t,n,s,c,I,j],U])))))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[hm(t),r]),Ty=e=>o(o(o(u("(",e),([t,r])=>o(w(r),([n,a])=>o(u(")",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o(eu(e),([t,r])=>[t,r],()=>o(tu(e),([t,r])=>[t,r],()=>o(ny(e),([t,r])=>[t,r],()=>o(ay(e),([t,r])=>[t,r],()=>o(oy(e),([t,r])=>[t,r],()=>o(ru(e),([t,r])=>[t,r],()=>o(iy(e),([t,r])=>[t,r],()=>o(sy(e),([t,r])=>[t,r],()=>o(my(e),([t,r])=>[t,r],()=>o(py(e),([t,r])=>[t,r],()=>o(uy(e),([t,r])=>[t,r],()=>o(nu(e),([t,r])=>[t,r],()=>o(cy(e),([t,r])=>[t,r],()=>o(ly(e),([t,r])=>[t,r],()=>o(hy(e),([t,r])=>[t,r],()=>o(yy(e),([t,r])=>[t,r],()=>o(xy(e),([t,r])=>[t,r],()=>o(Iy(e),([t,r])=>[t,r],()=>o(fy(e),([t,r])=>[t,r],()=>o(gy(e),([t,r])=>[t,r],()=>o(jy(e),([t,r])=>[t,r],()=>o(Ky(e),([t,r])=>[t,r],()=>o(Hy(e),([t,r])=>[t,r],()=>o(Wy(e),([t,r])=>[t,r],()=>o(Zy(e),([t,r])=>[t,r],()=>o(ry(e),([t,r])=>[t,r],()=>o(Qy(e),([t,r])=>[t,r],()=>[])))))))))))))))))))))))))))),([t,r])=>[ym(t),r]),ky=e=>o(o(o(u("with",e),([t,r])=>o(vu(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[xm(t),r]),iu=e=>o(o(by(e),([t,r])=>o(Ty(r),([n,a])=>o(vy(a),([s,m])=>o($y(m),([c,l])=>o(ky(l),([I,x])=>[[t,n,s,c,I],x]))))),([t,r])=>[Im(t),r]),su=e=>o(o(o(u("&",e),([t,r])=>o(iu(r),([n,a])=>o(su(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),mu=e=>o(o(iu(e),([t,r])=>o(su(r),([n,a])=>[[t,n],a])),([t,r])=>[bm(t),r]),pu=e=>o(o(o(u("|",e),([t,r])=>o(mu(r),([n,a])=>o(pu(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),ma=e=>o(o(mu(e),([t,r])=>o(pu(r),([n,a])=>[[t,n],a])),([t,r])=>[vm(t),r]),Ey=e=>o(o(u("readonly",e),([t,r])=>o(ma(r),([n,a])=>[[t,n],a])),([t,r])=>[$m(t),r]),wy=e=>o(o(u("|",e),([t,r])=>o(ma(r),([n,a])=>[[t,n],a])),([t,r])=>[Tm(t),r]),Ry=e=>o(o(to(e),([t,r])=>o(u("=",r),([n,a])=>o(w(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[km(t),r]),Sy=e=>o(o(o(u("infer",e),([t,r])=>o(V(r),([n,a])=>o(u("extends",a),([s,m])=>o(ma(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>o(o(u("infer",e),([t,r])=>o(V(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>[])),([t,r])=>[Em(t),r]),w=e=>o(o(Sy(e),([t,r])=>[t,r],()=>o(wy(e),([t,r])=>[t,r],()=>o(Ey(e),([t,r])=>[t,r],()=>o(ma(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),Oy=e=>o(ia(e),([t,r])=>[wm(t),r]),Py=e=>o(V(e),([t,r])=>[t,r]),My=e=>o(sa(["'",'"'],e),([t,r])=>[t,r]),Cy=e=>o(o(u("[",e),([t,r])=>o(V(r),([n,a])=>o(u(":",a),([s,m])=>o(o(ru(m),([c,l])=>[c,l],()=>o(tu(m),([c,l])=>[c,l],()=>o(eu(m),([c,l])=>[c,l],()=>o(nu(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([I,x])=>[[t,n,s,c,I],x]))))),([t,r])=>[Rm(t),r]),uu=e=>o(o(Oy(e),([t,r])=>[t,r],()=>o(Py(e),([t,r])=>[t,r],()=>o(My(e),([t,r])=>[t,r],()=>o(Cy(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),Ay=e=>o(o(o(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Sm(t),r]),qy=e=>o(o(o(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Om(t),r]),cu=e=>o(o(Ay(e),([t,r])=>o(uu(r),([n,a])=>o(qy(a),([s,m])=>o(u(":",m),([c,l])=>o(w(l),([I,x])=>[[t,n,s,c,I],x]))))),([t,r])=>[Pm(t),r]),lu=e=>o(o(o(u(",",e),([t,r])=>o(u(`
7
7
  `,r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u(";",e),([t,r])=>o(u(`
8
8
  `,r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u(",",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(u(`
9
- `,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),Cu=(e,t=[])=>o(o(Ou(e),([r,n])=>o(Pu(n),([a,s])=>[[r,a],s])),([r,n])=>Cu(n,[...t,r]),()=>[t,e]),px=e=>o(o(Cu(e),([t,r])=>o(o(o(Ou(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Ym(t),r]),bo=e=>o(o(u("{",e),([t,r])=>o(px(r),([n,a])=>o(u("}",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Xm(t),r]),ux=e=>o(bo(e),([t,r])=>[Zm(t),r]),cx=e=>o(o(o(Y(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(S(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[t,r],()=>o(o(Y(e),([t,r])=>o(u(":",r),([n,a])=>o(u("readonly",a),([s,m])=>o(S(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>o(o(Y(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(S(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>o(o(Y(e),([t,r])=>o(u(":",r),([n,a])=>o(S(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>[])))),([t,r])=>[Qm(t),r]),lx=e=>o(o(u("readonly",e),([t,r])=>o(S(r),([n,a])=>o(u("?",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[ep(t),r]),dx=e=>o(o(u("readonly",e),([t,r])=>o(S(r),([n,a])=>[[t,n],a])),([t,r])=>[tp(t),r]),fx=e=>o(o(S(e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[rp(t),r]),lu=e=>o(o(cx(e),([t,r])=>[t,r],()=>o(lx(e),([t,r])=>[t,r],()=>o(dx(e),([t,r])=>[t,r],()=>o(fx(e),([t,r])=>[t,r],()=>o(S(e),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),Mu=e=>o(o(o(u("...",e),([t,r])=>o(lu(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(lu(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[np(t),r]),Au=(e,t=[])=>o(o(Mu(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>Au(n,[...t,r]),()=>[t,e]),gx=e=>o(o(Au(e),([t,r])=>o(o(o(Mu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[ap(t),r]),hx=e=>o(o(u("[",e),([t,r])=>o(gx(r),([n,a])=>o(u("]",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[op(t),r]),yx=e=>o(o(Y(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(S(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[ip(t),r]),xx=e=>o(o(Y(e),([t,r])=>o(u(":",r),([n,a])=>o(u("readonly",a),([s,m])=>o(S(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[sp(t),r]),Ix=e=>o(o(Y(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(S(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[mp(t),r]),bx=e=>o(o(Y(e),([t,r])=>o(u(":",r),([n,a])=>o(S(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[pp(t),r]),du=e=>o(o(yx(e),([t,r])=>[t,r],()=>o(xx(e),([t,r])=>[t,r],()=>o(Ix(e),([t,r])=>[t,r],()=>o(bx(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),Lu=e=>o(o(o(u("...",e),([t,r])=>o(du(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(du(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[up(t),r]),qu=(e,t=[])=>o(o(Lu(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>qu(n,[...t,r]),()=>[t,e]),ju=e=>o(o(qu(e),([t,r])=>o(o(o(Lu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[cp(t),r]),vx=e=>o(o(u("(",e),([t,r])=>o(ju(r),([n,a])=>o(u(")",a),([s,m])=>o(u("=>",m),([c,l])=>o(S(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[lp(t),r]),$x=e=>o(o(u("new",e),([t,r])=>o(u("(",r),([n,a])=>o(ju(a),([s,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([d,g])=>o(S(g),([b,V])=>[[t,n,s,c,d,b],V])))))),([t,r])=>[dp(t),r]),Tx=e=>o(o(o(u("+",e),([t,r])=>o(u("readonly",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("-",e),([t,r])=>o(u("readonly",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[fp(t),r]),kx=e=>o(o(o(u("+",e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("-",e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[gp(t),r]),wx=e=>o(o(o(u("as",e),([t,r])=>o(S(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[hp(t),r]),Ex=e=>o(o(u("{",e),([t,r])=>o(Tx(r),([n,a])=>o(u("[",a),([s,m])=>o(Y(m),([c,l])=>o(u("in",l),([d,g])=>o(S(g),([b,V])=>o(wx(V),([G,w])=>o(u("]",w),([Ce,L])=>o(kx(L),([le,re])=>o(u(":",re),([Me,oe])=>o(S(oe),([rt,lt])=>o(yu(lt),([F,fn])=>o(u("}",fn),([xr,Ir])=>[[t,n,s,c,d,b,G,Ce,le,Me,rt,F,xr],Ir]))))))))))))),([t,r])=>[yp(t),r]),Rx=e=>o(Y(e),([t,r])=>[xp(t),r]),Sx=e=>o(fo(e),([t,r])=>[Ip(t),r]),Ox=e=>o(Ta(e),([t,r])=>[bp(t),r]),Px=e=>o(o(u("true",e),([t,r])=>[t,r],()=>o(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[vp(t),r]),Cx=e=>o(ka(['"',"'"],e),([t,r])=>[t,r]),Mx=e=>o(u("null",e),([t,r])=>[$p(t),r]),Ax=e=>o(u("undefined",e),([t,r])=>[void 0,r]),Fu=e=>o(o(Su(e),([t,r])=>o(u(":",r),([n,a])=>o(vo(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Tp(t),r]),Du=(e,t=[])=>o(o(Fu(e),([r,n])=>o(Pu(n),([a,s])=>[[r,a],s])),([r,n])=>Du(n,[...t,r]),()=>[t,e]),Lx=e=>o(o(Du(e),([t,r])=>o(o(o(Fu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[kp(t),r]),Gu=e=>o(o(u("{",e),([t,r])=>o(Lx(r),([n,a])=>o(u("}",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[wp(t),r]),Nu=(e,t=[])=>o(o(vo(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>Nu(n,[...t,r]),()=>[t,e]),qx=e=>o(o(Nu(e),([t,r])=>o(o(o(vo(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Ep(t),r]),jx=e=>o(o(u("[",e),([t,r])=>o(qx(r),([n,a])=>o(u("]",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Rp(t),r]),vo=e=>o(o(Sx(e),([t,r])=>[t,r],()=>o(Ox(e),([t,r])=>[t,r],()=>o(Px(e),([t,r])=>[t,r],()=>o(Cx(e),([t,r])=>[t,r],()=>o(Mx(e),([t,r])=>[t,r],()=>o(Ax(e),([t,r])=>[t,r],()=>o(Gu(e),([t,r])=>[t,r],()=>o(jx(e),([t,r])=>[t,r],()=>[])))))))),([t,r])=>[t,r]),Fx=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,r])=>[Sp(t),r]),Dx=e=>o(u(".*",e),([t,r])=>[Op(t),r]),Gx=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,r])=>[Pp(t),r]),Nx=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,r])=>[Cp(t),r]),Ux=e=>o(u("(?!)",e),([t,r])=>[Mp(t),r]),Kx=e=>o(cu(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,r])=>[Ap(t),r]),_x=e=>o(o(Fx(e),([t,r])=>[t,r],()=>o(Dx(e),([t,r])=>[t,r],()=>o(Gx(e),([t,r])=>[t,r],()=>o(Nx(e),([t,r])=>[t,r],()=>o(Ux(e),([t,r])=>[t,r],()=>o(zx(e),([t,r])=>[t,r],()=>o(Kx(e),([t,r])=>[t,r],()=>[]))))))),([t,r])=>[t,r]),zx=e=>o(o(u("(",e),([t,r])=>o($o(r),([n,a])=>o(u(")",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Lp(t),r]),Uu=e=>o(o(o(yo(e),([t,r])=>o(u("|",r),([n,a])=>o(Uu(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o(o(yo(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[]))),([t,r])=>[qp(t),r]),yo=e=>o(o(_x(e),([t,r])=>o($o(r),([n,a])=>[[t,n],a])),([t,r])=>[jp(t),r]),$o=e=>o(o(Uu(e),([t,r])=>[t,r],()=>o(yo(e),([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),gs=e=>o(o(u("^",e),([t,r])=>o($o(r),([n,a])=>o(u("$",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Fp(t),r]),Ku=(e,t=[])=>o(o(S(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>Ku(n,[...t,r]),()=>[t,e]),Vx=e=>o(o(Ku(e),([t,r])=>o(o(o(S(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Dp(t),r]),_u=e=>o(o(o(u("extends",e),([t,r])=>o(Vx(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Gp(t),r]),Bx=e=>o(o(u("interface",e),([t,r])=>o(Y(r),([n,a])=>o(xo(a),([s,m])=>o(_u(m),([c,l])=>o(bo(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[Np(t),r]),Wx=e=>o(o(u("interface",e),([t,r])=>o(Y(r),([n,a])=>o(_u(a),([s,m])=>o(bo(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[Up(t),r]),Hx=e=>o(o(u("type",e),([t,r])=>o(Y(r),([n,a])=>o(xo(a),([s,m])=>o(u("=",m),([c,l])=>o(S(l),([d,g])=>[[t,n,s,c,d],g]))))),([t,r])=>[Kp(t),r]),Yx=e=>o(o(u("type",e),([t,r])=>o(Y(r),([n,a])=>o(u("=",a),([s,m])=>o(S(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[_p(t),r]),Jx=e=>o(o(o(u("export",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[zp(t),r]),Xx=e=>o(o(o(u(";",e),([t,r])=>o(u(`
9
+ `,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),du=(e,t=[])=>o(o(cu(e),([r,n])=>o(lu(n),([a,s])=>[[r,a],s])),([r,n])=>du(n,[...t,r]),()=>[t,e]),Ly=e=>o(o(du(e),([t,r])=>o(o(o(cu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Mm(t),r]),no=e=>o(o(u("{",e),([t,r])=>o(Ly(r),([n,a])=>o(u("}",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Am(t),r]),jy=e=>o(no(e),([t,r])=>[qm(t),r]),Fy=e=>o(o(o(V(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(w(l),([I,x])=>[[t,n,s,c,I],x]))))),([t,r])=>[t,r],()=>o(o(V(e),([t,r])=>o(u(":",r),([n,a])=>o(u("readonly",a),([s,m])=>o(w(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>o(o(V(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(w(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[t,r],()=>o(o(V(e),([t,r])=>o(u(":",r),([n,a])=>o(w(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>[])))),([t,r])=>[Lm(t),r]),Dy=e=>o(o(u("readonly",e),([t,r])=>o(w(r),([n,a])=>o(u("?",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[jm(t),r]),Ny=e=>o(o(u("readonly",e),([t,r])=>o(w(r),([n,a])=>[[t,n],a])),([t,r])=>[Fm(t),r]),Gy=e=>o(o(w(e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[Dm(t),r]),Hp=e=>o(o(Fy(e),([t,r])=>[t,r],()=>o(Dy(e),([t,r])=>[t,r],()=>o(Ny(e),([t,r])=>[t,r],()=>o(Gy(e),([t,r])=>[t,r],()=>o(w(e),([t,r])=>[t,r],()=>[]))))),([t,r])=>[t,r]),fu=e=>o(o(o(u("...",e),([t,r])=>o(Hp(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(Hp(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[Nm(t),r]),gu=(e,t=[])=>o(o(fu(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>gu(n,[...t,r]),()=>[t,e]),Uy=e=>o(o(gu(e),([t,r])=>o(o(o(fu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Gm(t),r]),Ky=e=>o(o(u("[",e),([t,r])=>o(Uy(r),([n,a])=>o(u("]",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Um(t),r]),_y=e=>o(o(V(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(w(l),([I,x])=>[[t,n,s,c,I],x]))))),([t,r])=>[Km(t),r]),zy=e=>o(o(V(e),([t,r])=>o(u(":",r),([n,a])=>o(u("readonly",a),([s,m])=>o(w(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[_m(t),r]),By=e=>o(o(V(e),([t,r])=>o(u("?",r),([n,a])=>o(u(":",a),([s,m])=>o(w(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[zm(t),r]),Vy=e=>o(o(V(e),([t,r])=>o(u(":",r),([n,a])=>o(w(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Bm(t),r]),Yp=e=>o(o(_y(e),([t,r])=>[t,r],()=>o(zy(e),([t,r])=>[t,r],()=>o(By(e),([t,r])=>[t,r],()=>o(Vy(e),([t,r])=>[t,r],()=>[])))),([t,r])=>[t,r]),hu=e=>o(o(o(u("...",e),([t,r])=>o(Yp(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(Yp(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[])),([t,r])=>[Vm(t),r]),yu=(e,t=[])=>o(o(hu(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>yu(n,[...t,r]),()=>[t,e]),xu=e=>o(o(yu(e),([t,r])=>o(o(o(hu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Wm(t),r]),Wy=e=>o(o(u("(",e),([t,r])=>o(xu(r),([n,a])=>o(u(")",a),([s,m])=>o(u("=>",m),([c,l])=>o(w(l),([I,x])=>[[t,n,s,c,I],x]))))),([t,r])=>[Hm(t),r]),Hy=e=>o(o(u("new",e),([t,r])=>o(u("(",r),([n,a])=>o(xu(a),([s,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([I,x])=>o(w(x),([j,U])=>[[t,n,s,c,I,j],U])))))),([t,r])=>[Ym(t),r]),Yy=e=>o(o(o(u("+",e),([t,r])=>o(u("readonly",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("-",e),([t,r])=>o(u("readonly",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("readonly",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[Jm(t),r]),Jy=e=>o(o(o(u("+",e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("-",e),([t,r])=>o(u("?",r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u("?",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])))),([t,r])=>[Xm(t),r]),Xy=e=>o(o(o(u("as",e),([t,r])=>o(w(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[Zm(t),r]),Zy=e=>o(o(u("{",e),([t,r])=>o(Yy(r),([n,a])=>o(u("[",a),([s,m])=>o(V(m),([c,l])=>o(u("in",l),([I,x])=>o(w(x),([j,U])=>o(Xy(U),([Q,Ie])=>o(u("]",Ie),([Me,Ce])=>o(Jy(Ce),([je,Xe])=>o(u(":",Xe),([F,It])=>o(w(It),([at,ot])=>o(Qp(ot),([it,bt])=>o(u("}",bt),([vt,Gt])=>[[t,n,s,c,I,j,Q,Me,je,F,at,it,vt],Gt]))))))))))))),([t,r])=>[Qm(t),r]),Qy=e=>o(V(e),([t,r])=>[ep(t),r]),ex=e=>o(Xa(e),([t,r])=>[tp(t),r]),tx=e=>o(ia(e),([t,r])=>[rp(t),r]),rx=e=>o(o(u("true",e),([t,r])=>[t,r],()=>o(u("false",e),([t,r])=>[t,r],()=>[])),([t,r])=>[np(t),r]),nx=e=>o(sa(['"',"'"],e),([t,r])=>[t,r]),ax=e=>o(u("null",e),([t,r])=>[ap(t),r]),ox=e=>o(u("undefined",e),([t,r])=>[void 0,r]),Iu=e=>o(o(uu(e),([t,r])=>o(u(":",r),([n,a])=>o(ao(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[op(t),r]),bu=(e,t=[])=>o(o(Iu(e),([r,n])=>o(lu(n),([a,s])=>[[r,a],s])),([r,n])=>bu(n,[...t,r]),()=>[t,e]),ix=e=>o(o(bu(e),([t,r])=>o(o(o(Iu(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[ip(t),r]),vu=e=>o(o(u("{",e),([t,r])=>o(ix(r),([n,a])=>o(u("}",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[sp(t),r]),$u=(e,t=[])=>o(o(ao(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>$u(n,[...t,r]),()=>[t,e]),sx=e=>o(o($u(e),([t,r])=>o(o(o(ao(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[mp(t),r]),mx=e=>o(o(u("[",e),([t,r])=>o(sx(r),([n,a])=>o(u("]",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[pp(t),r]),ao=e=>o(o(ex(e),([t,r])=>[t,r],()=>o(tx(e),([t,r])=>[t,r],()=>o(rx(e),([t,r])=>[t,r],()=>o(nx(e),([t,r])=>[t,r],()=>o(ax(e),([t,r])=>[t,r],()=>o(ox(e),([t,r])=>[t,r],()=>o(vu(e),([t,r])=>[t,r],()=>o(mx(e),([t,r])=>[t,r],()=>[])))))))),([t,r])=>[t,r]),px=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,r])=>[up(t),r]),ux=e=>o(u(".*",e),([t,r])=>[cp(t),r]),cx=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,r])=>[lp(t),r]),lx=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,r])=>[dp(t),r]),dx=e=>o(u("(?!)",e),([t,r])=>[fp(t),r]),fx=e=>o(Wp(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,r])=>[gp(t),r]),gx=e=>o(o(px(e),([t,r])=>[t,r],()=>o(ux(e),([t,r])=>[t,r],()=>o(cx(e),([t,r])=>[t,r],()=>o(lx(e),([t,r])=>[t,r],()=>o(dx(e),([t,r])=>[t,r],()=>o(hx(e),([t,r])=>[t,r],()=>o(fx(e),([t,r])=>[t,r],()=>[]))))))),([t,r])=>[t,r]),hx=e=>o(o(u("(",e),([t,r])=>o(oo(r),([n,a])=>o(u(")",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[hp(t),r]),Tu=e=>o(o(o(eo(e),([t,r])=>o(u("|",r),([n,a])=>o(Tu(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[t,r],()=>o(o(eo(e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[]))),([t,r])=>[yp(t),r]),eo=e=>o(o(gx(e),([t,r])=>o(oo(r),([n,a])=>[[t,n],a])),([t,r])=>[xp(t),r]),oo=e=>o(o(Tu(e),([t,r])=>[t,r],()=>o(eo(e),([t,r])=>[t,r],()=>[])),([t,r])=>[t,r]),Xi=e=>o(o(u("^",e),([t,r])=>o(oo(r),([n,a])=>o(u("$",a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Ip(t),r]),ku=(e,t=[])=>o(o(w(e),([r,n])=>o(u(",",n),([a,s])=>[[r,a],s])),([r,n])=>ku(n,[...t,r]),()=>[t,e]),yx=e=>o(o(ku(e),([t,r])=>o(o(o(w(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[bp(t),r]),Eu=e=>o(o(o(u("extends",e),([t,r])=>o(yx(r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[vp(t),r]),xx=e=>o(o(u("interface",e),([t,r])=>o(V(r),([n,a])=>o(to(a),([s,m])=>o(Eu(m),([c,l])=>o(no(l),([I,x])=>[[t,n,s,c,I],x]))))),([t,r])=>[$p(t),r]),Ix=e=>o(o(u("interface",e),([t,r])=>o(V(r),([n,a])=>o(Eu(a),([s,m])=>o(no(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[Tp(t),r]),bx=e=>o(o(u("type",e),([t,r])=>o(V(r),([n,a])=>o(to(a),([s,m])=>o(u("=",m),([c,l])=>o(w(l),([I,x])=>[[t,n,s,c,I],x]))))),([t,r])=>[kp(t),r]),vx=e=>o(o(u("type",e),([t,r])=>o(V(r),([n,a])=>o(u("=",a),([s,m])=>o(w(m),([c,l])=>[[t,n,s,c],l])))),([t,r])=>[Ep(t),r]),$x=e=>o(o(o(u("export",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o([[],e],([t,r])=>[t,r],()=>[])),([t,r])=>[wp(t),r]),Tx=e=>o(o(o(u(";",e),([t,r])=>o(u(`
10
10
  `,r),([n,a])=>[[t,n],a])),([t,r])=>[t,r],()=>o(o(u(";",e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>o(o(u(`
11
- `,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]),zu=(e,t=[])=>o(o(To(e),([r,n])=>o(Xx(n),([a,s])=>[[r,a],s])),([r,n])=>zu(n,[...t,r]),()=>[t,e]),Zx=e=>o(o(zu(e),([t,r])=>o(o(o(To(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Vp(t),r]),To=e=>o(o(Jx(e),([t,r])=>o(o(Bx(r),([n,a])=>[n,a],()=>o(Wx(r),([n,a])=>[n,a],()=>o(Hx(r),([n,a])=>[n,a],()=>o(Yx(r),([n,a])=>[n,a],()=>[])))),([n,a])=>o(yu(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Bp(t),r]),Qx=e=>o(o(To(e),([t,r])=>o(Zx(r),([n,a])=>[[t,n],a])),([t,r])=>[Wp(t),r]),Vu=e=>o(o(Qx(e),([t,r])=>[t,r],()=>o(tx(e),([t,r])=>[t,r],()=>o(S(e),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]);function Bu(e){let t=Io(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:X()}function tI(e){return e.join("|")}function rI(e){return e.slice(1,e.length-1)}function nI(e,t,r){return wt(t,`${r}${e}`)}function aI(e,t){return wt(e,`${t}${ps}`)}function oI(e,t){return wt(e,`${t}${Gn}`)}function iI(e,t){return wt(e,`${t}${Un}`)}function sI(e,t){return Hr(E([P("false"),P("true")]),e,t)}function mI(e,t){return wt(e,`${t}${Kn}`)}function pI(e,t,r){return wt(t,`${r}${rI(e)}`)}function uI(e,t,r){let n=Yr(e,{});return Hr(n,t,r)}function cI(e,t,r){let n=Le(e);return Hr(n,t,r)}function Wu(e,t,r,n=[]){return i.ShiftLeft(e,(a,s)=>Wu(s,t,r,[...n,Hr(a,[],"")]),()=>wt(t,`${r}(${tI(n)})`))}function Hr(e,t,r){return be(e)?cI(e.enum,t,r):ve(e)?oI(t,r):q(e)?nI(e.const,t,r):Je(e)?aI(t,r):Fe(e)?sI(t,r):Q(e)?iI(t,r):$e(e)?mI(t,r):ee(e)?pI(e.pattern,t,r):Yu(e)?uI(e.parameters[0],t,r):x(e)?Wu(e.anyOf,t,r):zi}function wt(e,t){return i.ShiftLeft(e,(r,n)=>Hr(r,n,t),()=>t)}function lI(e){return`^${wt(e,"")}$`}function Hu(e){let t=lI(e);return zn(t)}function Yr(e,t){return k(e)?p.Update(Hu(e),{},t):Qn(e,t)}function Ju(e,t,r,n){let a=qe(e,t,r);return Yr(a,n)}function Qn(e,t={}){return I("TemplateLiteral",[e],t)}function Yu(e){return ne(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function Xu(e){return Yr(e,{})}function dI(e){let t=Bu(e);return Xu(t)}function Zu(e,t={}){let r=i.IsString(e)?dI(e):Xu(e);return p.Update(r,{},t)}function ee(e){return y(e,"TemplateLiteral")}var v={};Ot(v,{ExtendsFalse:()=>T,ExtendsTrue:()=>h,ExtendsUnion:()=>ko,IsExtendsFalse:()=>fI,IsExtendsTrue:()=>ec,IsExtendsTrueLike:()=>sr,IsExtendsUnion:()=>Qu,Match:()=>_});function ko(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Qu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsUnion")&&i.IsObject(e.inferred)}function h(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function ec(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function T(){return p.Create({"~kind":"ExtendsFalse"},{})}function fI(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function sr(e){return Qu(e)||ec(e)}function _(e,t,r){return sr(e)?t(e.inferred):r()}function gI(e,t,r,n){return _(C(e,r,n),a=>h(p.Assign(p.Assign(e,a),{[t]:r})),()=>T())}function hI(e,t){return h(e)}function yI(e,t,r,n,a){return _(C(e,t,r),s=>_(C(s,t,n),m=>h(m),()=>T()),()=>_(C(e,t,a),s=>h(s),()=>T()))}function xI(e,t,r){let n=Le(r);return C(e,t,n)}function tc(e,t,r){return i.ShiftLeft(r,(n,a)=>_(C(e,t,n),s=>tc(s,t,a),()=>T()),()=>h(e))}function II(e,t,r){let n=we(r);return C(e,t,n)}function rc(e,t,r){return i.ShiftLeft(r,(n,a)=>_(C(e,t,n),s=>h(s),()=>rc(e,t,a)),()=>T())}function j(e,t,r){return Z(r)?hI(e,t):H(r)?yI(e,t,r.if,r.then,r.else):be(r)?xI(e,t,r.enum):J(r)?gI(e,r.name,t,r.extends):O(r)?tc(e,t,r.allOf):ee(r)?II(e,t,r.pattern):x(r)?rc(e,t,r.anyOf):ae(r)?h(e):T()}function nc(e,t,r){return J(r)?j(e,t,r):Z(r)?h(e):ae(r)?h(e):ko(e)}function bI(e,t){let r=qt(e),n=qt(t);return r&&n||!r&&n?!0:!(r&&!n)}function ac(e,t,r,n){return z(n)?bI(t,n)?C(e,r,n.items):T():j(e,t,n)}function oc(e,t,r){return Je(r)?h(e):j(e,t,r)}function ic(e,t,r){return Fe(r)?h(e):j(e,t,r)}function vI(e,t,r,n,a){let s=J(n)?t:n,m=J(n)?n:t,c=xe(t),l=xe(n);return!c&&l?T():_(C(e,s,m),d=>Jr(d,r,a),()=>T())}function $I(e,t,r,n){return i.ShiftLeft(n,(a,s)=>vI(e,t,r,a,s),()=>xe(t)?h(e):T())}function TI(e,t,r){return i.ShiftLeft(t,(n,a)=>$I(e,n,a,r),()=>h(e))}function Jr(e,t,r){return TI(e,t,r)}function Ea(e,t,r){return Xe(r)?h(e):C(e,t,r)}function sc(e,t,r,n){return Z(n)?h(e):ae(n)?h(e):ie(n)?_(Jr(e,t,n.parameters),a=>Ea(a,r,n.instanceType),()=>T()):T()}function mc(e,t,r,n,a){return _(C(e,t,a),()=>C(e,r,a),()=>C(e,n,a))}function pc(e,t,r){let n=Le(t);return C(e,n,r)}function uc(e,t,r,n){return Z(n)?h(e):ae(n)?h(e):se(n)?_(Jr(e,t,n.parameters),a=>Ea(a,r,n.returnType),()=>T()):T()}function cc(e,t,r){return ve(r)?h(e):Q(r)?h(e):j(e,t,r)}function lc(e,t,r){let n=B(t);return C(e,n,r)}function Ra(e,t,r){return t===r?h(e):T()}function kI(e,t,r){return q(r)?Ra(e,t,r.const):Je(r)?h(e):j(e,P(t),r)}function wI(e,t,r){return q(r)?Ra(e,t,r.const):Fe(r)?h(e):j(e,P(t),r)}function EI(e,t,r){return q(r)?Ra(e,t,r.const):Q(r)?h(e):j(e,P(t),r)}function RI(e,t,r){return q(r)?Ra(e,t,r.const):$e(r)?h(e):j(e,P(t),r)}function dc(e,t,r){return i.IsBigInt(t.const)?kI(e,t.const,r):i.IsBoolean(t.const)?wI(e,t.const,r):i.IsNumber(t.const)?EI(e,t.const,r):i.IsString(t.const)?RI(e,t.const,r):X()}function fc(e,t,r){return J(r)?j(e,t,r):h(e)}function gc(e,t,r){return Xt(r)?h(e):j(e,t,r)}function hc(e,t,r){return Q(r)?h(e):j(e,t,r)}function SI(e,t,r){return xe(t)?xe(r)?h(e):T():h(e)}function OI(e,t,r){return J(r)&&xt(r.extends)?T():_(C(e,t,r),n=>SI(n,t,r),()=>T())}function PI(e,t){return e.reduce((r,n)=>n in t?sr(t[n])?{...r,...t[n].inferred}:X():X(),{})}function CI(e,t,r){let n={};for(let m of i.Keys(r))n[m]=m in t?OI({},t[m],r[m]):xe(r[m])?J(r[m])?h(p.Assign(e,{[r[m].name]:r[m].extends})):h(e):T();let a=i.Values(n).every(m=>sr(m)),s=a?PI(i.Keys(n),n):{};return a?h(s):T()}function MI(e,t,r){let n=CI(e,t,r);return sr(n)?h(p.Assign(e,n.inferred)):T()}function AI(e,t,r){return MI(e,t,r)}function LI(e,t){return i.Keys(t).reduce((r,n)=>({...r,[n]:i.HasPropertyKey(e,n)?x(r[n])?E([...r[n].anyOf,t[n]]):E([e[n],t[n]]):t[n]}),e)}function yc(e,t,r,n){return i.ShiftLeft(t,(a,s)=>_(C({},e[a],r),m=>yc(e,s,r,LI(n,m)),()=>T()),()=>h(n))}function qI(e,t,r,n){let a=i.Keys(t);return yc(t,a,n,e)}function xc(e,t,r){return ge(r)?qI(e,t,Ne(r),Te(r)):A(r)?AI(e,t,r.properties):j(e,$(t),r)}function jI(e,t){return i.IsEqual(i.Keys(t).length,0)?h(e):T()}function FI(e,t,r,n,a){return C(e,r,a)}function Ic(e,t,r,n){return ge(n)?FI(e,Yn(t),r,Yn(Ne(n)),Te(n)):A(n)?jI(e,n.properties):Z(n)?h(e):ae(n)?h(e):T()}function bc(e,t,r){return $e(r)?h(e):j(e,t,r)}function vc(e,t,r){return It(r)?h(e):j(e,t,r)}function $c(e,t,r){let n=we(t);return C(e,n,r)}function wo(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Xr(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 Eo(e){return $t(e)?J(e.items)?z(e.items.extends)?wo(e.items.name,e.items.extends.items):ae(e.items.extends)?wo(e.items.name,e.items.extends):void 0:X():void 0}function Sa(e){return J(e)?wo(e.name,e.extends):void 0}function Ro(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>_(C({},n,t),()=>Ro(a,t,[...r,n]),()=>{}),()=>r)}function Tc(e,t,r,n){let a=Ro(r,n);return i.IsArray(a)?h(p.Assign(e,{[t]:te(a)})):T()}function Oa(e,t,r,n){let a=Ro(r,n);return i.IsArray(a)?h(p.Assign(e,{[t]:E(a)})):T()}function DI(e){return[...e].reverse()}function So(e,t){return t?DI(e):e}function GI(e){let t=e.length>0?e[0]:void 0,r=ne(t)?Eo(t):void 0;return ne(r)}function NI(e,t,r,n,a,s){return _(C(e,r,a),m=>kc(m,t,n,s),()=>T())}function UI(e,t,r,n,a){let s=Eo(n);return Xr(s)?Tc(e,s.name,So(r,t),s.type):i.ShiftLeft(r,(m,c)=>NI(e,t,m,c,n,a),()=>T())}function KI(e,t,r,n){return i.ShiftLeft(n,(a,s)=>UI(e,t,r,a,s),()=>i.IsEqual(r.length,0)?h(e):T())}function kc(e,t,r,n){return KI(e,t,r,n)}function _I(e,t,r){let n=Et(e,K([],[]),r),a=GI(n);return kc(e,a,So(t,a),So(n,a))}function wc(e,t,r){let n=Sa(r);return Xr(n)?Oa(e,n.name,t,n.type):i.ShiftLeft(t,(a,s)=>_(C(e,a,r),m=>wc(m,s,r),()=>T()),()=>h(e))}function Ec(e,t,r){let n=Et(e,K([],[]),t);return N(r)?_I(e,n,r.items):z(r)?wc(e,n,r.items):j(e,te(n),r)}function Rc(e,t,r){return Xe(r)?h(e):nr(r)?h(e):j(e,t,r)}function Sc(e,t,r){return i.ShiftLeft(r,(n,a)=>_(C(e,t,n),s=>h(s),()=>Sc(e,t,a)),()=>T())}function Oo(e,t,r){return i.ShiftLeft(t,(n,a)=>_(Sc(e,n,r),s=>Oo(s,a,r),()=>T()),()=>h(e))}function Oc(e,t,r){let n=Sa(r);return Xr(n)?Oa(e,n.name,t,n.type):x(r)?Oo(e,t,r.anyOf):Oo(e,t,[r])}function Pc(e,t,r){return J(r)?j(e,t,r):Z(r)?h(e):ae(r)?h(e):T()}function Cc(e,t,r){return Xe(r)?h(e):j(e,t,r)}function C(e,t,r){return Z(t)?nc(e,t,r):z(t)?ac(e,t,t.items,r):Je(t)?oc(e,t,r):Fe(t)?ic(e,t,r):ie(t)?sc(e,t.parameters,t.instanceType,r):H(t)?mc(e,t.if,t.then,t.else,r):be(t)?pc(e,t.enum,r):se(t)?uc(e,t.parameters,t.returnType,r):ve(t)?cc(e,t,r):O(t)?lc(e,t.allOf,r):q(t)?dc(e,t,r):xt(t)?fc(e,t,r):Xt(t)?gc(e,t,r):Q(t)?hc(e,t,r):A(t)?xc(e,t.properties,r):ge(t)?Ic(e,Ne(t),Te(t),r):$e(t)?bc(e,t,r):It(t)?vc(e,t,r):ee(t)?$c(e,t.pattern,r):N(t)?Ec(e,t.items,r):nr(t)?Rc(e,t,r):x(t)?Oc(e,t.anyOf,r):ae(t)?Pc(e,t,r):Xe(t)?Cc(e,t,r):T()}function zI(e,t){return B([...e,$(t)])}function Po(e,t,r){return k(e)?p.Update(zI(e,t),{},r):_r(e,t,r)}function Mc(e,t,r,n,a){let s=qe(e,t,r),m=Zr(e,t,n);return Po(s,m,a)}function _r(e,t,r={}){return I("Interface",[e,t],r)}function mr(e){return ne(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function Ac(e,t,r={}){return Po(e,t,r)}function VI(e,t,r){return e.includes(r)?!0:Qr([...e,r],t,t[r])}function Lc(e,t,r){let n=Ln(r);return Kt(e,t,n)}function Kt(e,t,r){return i.ShiftLeft(r,(n,a)=>Qr(e,t,n)?!0:Kt(e,t,a),()=>!1)}function Qr(e,t,r){return me(r)?VI(e,t,r.$ref):z(r)?Qr(e,t,r.items):ie(r)?Kt(e,t,[...r.parameters,r.instanceType]):se(r)?Kt(e,t,[...r.parameters,r.returnType]):mr(r)?Lc(e,t,r.parameters[1]):O(r)?Kt(e,t,r.allOf):A(r)?Lc(e,t,r.properties):x(r)?Kt(e,t,r.anyOf):N(r)?Kt(e,t,r.items):ge(r)?Qr(e,t,Te(r)):!1}function qc(e,t,r){return Qr(e,t,r)}function BI(e,t){return t.reduce((r,n)=>qc([n],e,e[n])?[...r,n]:r,[])}function jc(e){let t=An(e);return BI(e,t)}function WI(e,t,r){return r.includes(t)?r:t in e?en(e,e[t],[...r,t]):X()}function Fc(e,t,r){let n=Ln(t);return pr(e,n,r)}function pr(e,t,r){return t.reduce((n,a)=>en(e,a,n),r)}function en(e,t,r){return me(t)?WI(e,t.$ref,r):z(t)?en(e,t.items,r):ie(t)?pr(e,[...t.parameters,t.instanceType],r):se(t)?pr(e,[...t.parameters,t.returnType],r):mr(t)?Fc(e,t.parameters[1],r):O(t)?pr(e,t.allOf,r):A(t)?Fc(e,t.properties,r):x(t)?pr(e,t.anyOf,r):N(t)?pr(e,t.items,r):ge(t)?en(e,Te(t),r):r}function Dc(e,t,r){return en(e,r,[t])}function HI(e){return Ht()}function YI(e){return i.Keys(e).reduce((t,r)=>({...t,[r]:_t(e[r])}),{})}function tn(e){return e.reduce((t,r)=>[...t,_t(r)],[])}function _t(e){return me(e)?HI(e.$ref):z(e)?Ae(_t(e.items),Mn(e)):ie(e)?ze(tn(e.parameters),_t(e.instanceType)):se(e)?Ve(tn(e.parameters),_t(e.returnType)):O(e)?Ie(tn(e.allOf)):A(e)?$(YI(e.properties)):ge(e)?Hn(tr(e),_t(Te(e))):x(e)?E(tn(e.anyOf)):N(e)?te(tn(e.items)):e}function JI(e,t){return t in e?_t(e[t]):ue()}function Gc(e){return JI(e.$defs,e.$ref)}function XI(e,t,r){let n=qe(e,K([],[]),t),a=Zr({},K([],[]),r);return B([...n,$(a)])}function ZI(e,t){return i.Keys(e).filter(n=>t.includes(n)).reduce((n,a)=>{let s=e[a],m=mr(s)?XI(e,s.parameters[0],s.parameters[1]):s;return{...n,[a]:m}},{})}function Nc(e,t,r){let n=Dc(e,t,r),a=ZI(e,n);return We(a,t)}function Uc(e,t){return t in e?me(e[t])?Uc(e,e[t].$ref):e[t]:D()}function Ze(e,t){return Uc(e,t)}function Kc(e){return de(e)?Gc(e):qn(e)?ue():e}function fe(e,t,r){let n=Kc(t),a=Kc(r);return C(e,n,a)}var Fr="equal",QI="disjoint",Dr="left-inside",Gr="right-inside";function Qt(e,t){let r=[ae(e)?v.ExtendsFalse():fe({},e,t),ae(e)?v.ExtendsTrue({}):fe({},t,e)];return v.IsExtendsTrueLike(r[0])&&v.IsExtendsTrueLike(r[1])?Fr:v.IsExtendsTrueLike(r[0])&&v.IsExtendsFalse(r[1])?Dr:v.IsExtendsFalse(r[0])&&v.IsExtendsTrueLike(r[1])?Gr:QI}function eb(e,t){return t.filter(r=>Qt(e,r)!==Gr)}function tb(e,t){let r=t.some(n=>{let a=Qt(e,n);return i.IsEqual(a,Dr)||i.IsEqual(a,Fr)});return i.IsEqual(r,!1)}function rb(e,t){let r=Ge(e);return Z(r)?[r]:tb(r,t)?[...eb(r,t),r]:t}function nb(e){return e.reduce((t,r)=>A(r)?[...t,r]:xt(r)?t:rb(r,t),[])}function so(e){let t=nb(e);return Ur(t)}function Co(e,t){return p.Update(Ge(e),{},t)}function _c(e,t,r,n){let a=f(e,t,r);return Co(a,n)}function rn(e,t=[]){return ht(e)&&i.IsEqual(e.action,"Conditional")?me(e.parameters[0])?rn(e.parameters[2],rn(e.parameters[3],[...t,e.parameters[0].$ref])):rn(e.parameters[2],rn(e.parameters[3],t)):ht(e)&&i.IsEqual(e.action,"Mapped")&&ht(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&me(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function ab(e,t){return e.reduce((r,n)=>[...r,t.includes(n.name)],[])}function Bc(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>i.ShiftLeft(t,(s,m)=>Bc(a,m,[...r,[s,n]]),()=>r),()=>r)}function ob(e){return x(e)?[...e.anyOf]:[e]}function ib(e,t){return e.reduce((r,n)=>[...r,[...n,t]],[])}function zc(e,t){return t.reduce((r,n)=>[...r,...ib(e,n)],[])}function Vc(e){return e.reduce((t,r)=>i.IsEqual(r[0],!0)?zc(t,ob(r[1])):zc(t,[r[1]]),[[]])}function Wc(e,t,r){let n=rn(r),a=ab(e,n),s=Bc(t,a);return ht(r)&&i.IsEqual(r.action,"Conditional")||ht(r)&&i.IsEqual(r.action,"Mapped")?Vc(s):[t]}function sb(){return["(not-resolvable)",D()]}function mb(){return["(not-generic)",D()]}function pb(e,t,r){return[e,yt(t,r)]}function ub(e,t,r){return t in e?Hc(e,t,e[t],r):sb()}function Hc(e,t,r,n){return Wt(r)?pb(t,r.parameters,r.expression):me(r)?ub(e,r.$ref,n):mb()}function Yc(e,t,r){return Hc(e,"(anonymous)",t,r)}function cb(e,t,r){if(J(t)||ur(t)||v.IsExtendsTrueLike(fe({},t,r)))return;let n={parameter:e,expect:r,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:n})}function Jc(e,t,r,n,a){let s=f(e,t,a);return cb(r,s,n),p.Assign(e,{[r]:s})}function lb(e,t,r,n,a){let s=f(e,t,r.extends),m=f(e,t,r.equals);return i.ShiftLeft(a,(c,l)=>Mo(Jc(e,t,r.name,s,c),t,n,l),()=>Mo(Jc(e,t,r.name,s,m),t,n,[]))}function Mo(e,t,r,n){return i.ShiftLeft(r,(a,s)=>lb(e,t,a,s,n),()=>e)}function Xc(e,t,r,n){return Mo(e,t,r,n)}function db(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function fb(e,t){return i.IsEqual(db(e),t)}function gb(e,t,r,n,a,s){let m=Xc(e,t,n,s),c=f(m,K([...t.callstack,r.$ref],t.visited),a);return f(m,K([],[]),c)}function hb(e,t,r,n,a,s){return s.reduce((m,c)=>[...m,gb(e,t,r,n,a,c)],[])}function yb(e,t,r,n,a,s){let m=Wc(n,s,a),c=hb(e,t,r,n,a,m);return i.IsEqual(c.length,1)?c[0]:Oe(c)}function Pa(e,t,r,n){let a=qe(e,t,n),s=Yc(e,r,n),m=s[0],c=s[1];return Wt(c)?fb(t,m)?zr(it(m),a):yb(e,t,it(m),c.parameters,c.expression,a):zr(r,a)}function zr(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Zc(e,t){return Pa({},K([],[]),e,t)}function ur(e){return y(e,"Call")}function xb(e){return p.Discard(e,["~immutable"])}function Qc(e,t){return p.Update(xb(e),{},t)}function el(e,t,r,n){let a=f(e,t,r);return Qc(a,n)}function tl(e,t){return e(t)}function rl(e,t){return i.IsString(t)?P(tl(e,t)):P(t)}function nl(e,t){let r=we(t);return pt(e,r)}function al(e,t){let r=t.map(n=>pt(e,n));return E(r)}function pt(e,t){return q(t)?rl(e,t.const):ee(t)?nl(e,t.pattern):x(t)?al(e,t.anyOf):t}function ea(e,t={}){return I("Capitalize",[e],t)}function ol(e,t={}){return Ao(e,t)}function ta(e,t={}){return I("Lowercase",[e],t)}function il(e,t={}){return Lo(e,t)}function ra(e,t={}){return I("Uncapitalize",[e],t)}function sl(e,t={}){return qo(e,t)}function na(e,t={}){return I("Uppercase",[e],t)}function ml(e,t={}){return jo(e,t)}var Ib=e=>e[0].toUpperCase()+e.slice(1),bb=e=>e.toLowerCase(),vb=e=>e[0].toLowerCase()+e.slice(1),$b=e=>e.toUpperCase();function Ao(e,t){return k([e])?p.Update(pt(Ib,e),{},t):ea(e,t)}function Lo(e,t){return k([e])?p.Update(pt(bb,e),{},t):ta(e,t)}function qo(e,t){return k([e])?p.Update(pt(vb,e),{},t):ra(e,t)}function jo(e,t){return k([e])?p.Update(pt($b,e),{},t):na(e,t)}function pl(e,t,r,n){let a=f(e,t,r);return Ao(a,n)}function ul(e,t,r,n){let a=f(e,t,r);return Lo(a,n)}function cl(e,t,r,n){let a=f(e,t,r);return qo(a,n)}function ll(e,t,r,n){let a=f(e,t,r);return jo(a,n)}function aa(e,t,r,n,a={}){return I("Conditional",[e,t,r,n],a)}function dl(e,t,r,n,a={}){return Fo({},K([],[]),e,t,r,n,a)}function Tb(e,t,r,n,a,s){let m=fe(e,r,n);return v.IsExtendsUnion(m)?E([f(m.inferred,t,a),f(e,t,s)]):v.IsExtendsTrue(m)?f(m.inferred,t,a):f(e,t,s)}function Fo(e,t,r,n,a,s,m){return k([r,n])?p.Update(Tb(e,t,r,n,a,s),{},m):aa(r,n,a,s,m)}function fl(e,t,r,n,a,s,m){let c=f(e,t,r),l=f(e,t,n);return Fo(e,t,c,l,a,s,m)}function oa(e,t={}){return I("ConstructorParameters",[e],t)}function gl(e,t={}){return Do(e,t)}function kb(e){let t=ie(e)?e.parameters:[],r=Et({},K([],[]),t);return te(r)}function Do(e,t){return k([e])?p.Update(kb(e),{},t):oa(e,t)}function hl(e,t,r,n){let a=f(e,t,r);return Do(a,n)}function ia(e,t,r={}){return I("Exclude",[e,t],r)}function yl(e,t,r={}){return nn(e,t,r)}function nn(e,t,r){return k([e,t])?p.Update(Bn(e,t),{},r):ia(e,t,r)}function xl(e,t,r,n,a){let s=f(e,t,r),m=f(e,t,n);return nn(s,m,a)}function sa(e,t,r={}){return I("Extract",[e,t],r)}function Il(e,t,r={}){return Go(e,t,r)}function wb(e,t){let r=fe({},e,t);return v.IsExtendsTrueLike(r)?[e]:[]}function Eb(e,t){return e.reduce((r,n)=>[...r,...wb(n,t)],[])}function bl(e,t){let r=Ge(e),n=x(r)?r.anyOf:[r],a=Eb(n,t);return Oe(a)}function Go(e,t,r){return k([e,t])?p.Update(bl(e,t),{},r):sa(e,t,r)}function vl(e,t,r,n,a){let s=f(e,t,r),m=f(e,t,n);return Go(s,m,a)}function Rb(e){return e.reduce((t,r)=>Nn(r)?[...t,P(r)]:t,[])}function cr(e){let t=Rb(e);return E(t)}function Vr(e,t,r={}){return I("Index",[e,t],r)}function $l(e,t,r={}){let n=i.IsArray(t)?cr(t):t;return No(e,n,r)}function Tl(e,t){let r=Ze(e,t);return je(r)}function kl(e,t,r){let n=_e(e,t,r);return je(n)}function Sb(e,t){let r=i.Keys(e).filter(g=>!i.HasPropertyKey(t,g)),n=i.Keys(t).filter(g=>!i.HasPropertyKey(e,g)),a=i.Keys(e).filter(g=>i.HasPropertyKey(t,g)),s=r.reduce((g,b)=>({...g,[b]:e[b]}),{}),m=n.reduce((g,b)=>({...g,[b]:t[b]}),{}),c=a.reduce((g,b)=>({...g,[b]:B([e[b],t[b]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function wl(e){return e.reduce((t,r)=>Sb(t,je(r)),{})}function El(e){let t=Cs(te(e));return je(t)}function Ob(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:Oe([e[s],t[s]])}),{})}function Rl(e,t){return i.ShiftLeft(e,(r,n)=>Rl(n,Ob(t,je(r))),()=>t)}function Sl(e){return i.ShiftLeft(e,(t,r)=>Rl(r,je(t)),()=>X())}function je(e){return de(e)?Tl(e.$defs,e.$ref):H(e)?kl(e.if,e.then,e.else):O(e)?wl(e.allOf):x(e)?Sl(e.anyOf):N(e)?El(e.items):A(e)?e.properties:{}}function lr(e){let t=je(e);return $(t)}var Pb=new RegExp("^(?:0|[1-9][0-9]*)$");function dr(e){let t=`${e}`;return Pb.test(t)?parseInt(t):e}function Cb(e){return P(dr(e))}function Ol(e){return e.map(t=>Pl(t))}function Pl(e){return O(e)?Ie(Ol(e.allOf)):x(e)?E(Ol(e.anyOf)):q(e)?Cb(e.const):e}function Cl(e,t){let r=Pl(t),n=fe({},r,Se());return v.IsExtendsTrueLike(n)?e:q(t)&&i.IsEqual(t.const,"length")?Se():D()}function Ml(e,t){let r=Ze(e,t);return Pe(r)}function Al(e,t,r){let n=_e(e,t,r);return Pe(n)}function Ll(e){let t=Le(e);return Pe(t)}function ql(e){let t=B(e);return Pe(t)}function jl(e){return[`${e}`]}function Fl(e){let t=we(e);return Pe(t)}function Dl(e){return e.reduce((t,r)=>[...t,...Pe(r)],[])}function Pe(e){return de(e)?Ml(e.$defs,e.$ref):H(e)?Al(e.if,e.then,e.else):be(e)?Ll(e.enum):O(e)?ql(e.allOf):q(e)?jl(e.const):ee(e)?Fl(e.pattern):x(e)?Dl(e.anyOf):[]}function fr(e){return Pe(e)}function an(e,t){return t.map(r=>on(e,r))}function on(e,t){return z(t)?Ae(on(e,t.items)):ie(t)?ze(an(e,t.parameters),on(e,t.instanceType)):se(t)?Ve(an(e,t.parameters),on(e,t.returnType)):N(t)?te(an(e,t.items)):x(t)?E(an(e,t.anyOf)):O(t)?Ie(an(e,t.allOf)):Xn(t)?$(e):t}function Gl(e,t){return on(e,t)}function Mb(e,t){let r=t in e?e[t]:D();return Gl(e,r)}function Nl(e,t){return t.reduce((r,n)=>[...r,Mb(e,n)],[])}function Ab(e,t){let r=fr(t),n=Nl(e,r);return Oe(n)}var Lb=new RegExp(vt);function qb(e){return e.filter(r=>Lb.test(r))}function jb(e){let t=An(e),r=qb(t),n=Nl(e,r);return Oe(n)}function Ul(e,t){return Q(t)?jb(e):Ab(e,t)}function Fb(e){return P(dr(e))}function Kl(e){return e.map(t=>Uo(t))}function Uo(e){return O(e)?Ie(Kl(e.allOf)):x(e)?E(Kl(e.anyOf)):q(e)?Fb(e.const):e}function Db(e,t){return e.reduceRight((r,n,a)=>{let s=fe({},P(a),t);return v.IsExtendsTrueLike(s)?[n,...r]:r},[])}function Gb(e,t){let r=Uo(t),n=Db(e,r);return st(n)}function Nb(e){return st(e)}function _l(e,t){return q(t)&&i.IsEqual(t.const,"length")?P(e.length):Q(t)||ve(t)?Nb(e):Gb(e,t)}function zl(e,t){return z(e)?Cl(e.items,t):A(e)?Ul(e.properties,t):N(e)?_l(e.items,t):D()}function Ub(e){return de(e)||H(e)||O(e)||x(e)?lr(e):e}function No(e,t,r){return k([e,t])?p.Update(zl(Ub(e),t),{},r):Vr(e,t,r)}function Vl(e,t,r,n,a){let s=f(e,t,r),m=f(e,t,n);return No(s,m,a)}function ma(e,t={}){return I("InstanceType",[e],t)}function Bl(e,t={}){return Ko(e,t)}function Kb(e){return ie(e)?e.instanceType:D()}function Ko(e,t){return k([e])?p.Update(Kb(e),{},t):ma(e,t)}function Wl(e,t,r,n={}){let a=f(e,t,r);return Ko(a,n)}function Br(e,t={}){return I("KeyOf",[e],t)}function Hl(e,t={}){return _o(e,t)}function Yl(){return E([Se(),De(),Zt()])}function Jl(e){return Se()}function _b(e){return e.reduce((r,n)=>Nn(n)?[...r,P(dr(n))]:X(),[])}function Xl(e){let t=i.Keys(e),r=_b(t);return st(r)}function Zl(e){return tr(e)}function Ql(e){let t=e.map((r,n)=>P(n));return st(t)}function ed(e){return Z(e)?Yl():z(e)?Jl(e.items):A(e)?Xl(e.properties):ge(e)?Zl(e):N(e)?Ql(e.items):D()}function zb(e){return de(e)||H(e)||O(e)||x(e)?lr(e):e}function _o(e,t){return k([e])?p.Update(ed(zb(e)),{},t):Br(e,t)}function td(e,t,r,n){let a=f(e,t,r);return _o(a,n)}function Kr(e,t,r,n,a={}){return I("Mapped",[e,t,r,n],a)}function rd(e,t,r,n,a={}){return zo({},K([],[]),e,t,r,n,a)}function Vb(e){let t=we(e);return Ca(t)}function Bb(e){return e.reduce((t,r)=>[...t,...Ca(r)],[])}function Wb(e){let t=Le(e);return Ca(t)}function Hb(e){return i.IsNumber(e)?[P(`${e}`)]:[P(e)]}function Ca(e){return be(e)?Wb(e.enum):q(e)?Hb(e.const):ee(e)?Vb(e.pattern):x(e)?Bb(e.anyOf):[e]}function nd(e){return Ca(e)}function Yb(e){return ee(e)?we(e.pattern):e}function Jb(e,t,r,n,a,s){let m=p.Assign(e,{[r.name]:n}),c=f(m,t,a),l=Yb(c),d=f(m,t,s);return cs(l)||ls(l)?{[l.const]:d}:{}}function Xb(e,t,r,n,a,s){return n.reduce((m,c)=>[...m,Jb(e,t,r,c,a,s)],[])}function Zb(e){return e.reduce((t,r)=>[...t,$(r)],[])}function ad(e,t,r,n,a,s){let m=nd(n),c=Xb(e,t,r,m,a,s),l=Zb(c);return B(l)}function zo(e,t,r,n,a,s,m){return k([n])?p.Update(ad(e,t,r,n,a,s),{},m):Kr(r,n,a,s,m)}function od(e,t,r,n,a,s,m){let c=f(e,t,n);return zo(e,t,r,c,a,s,m)}function Qb(e,t,r){let n=p.Assign(e,t);return i.Keys(t).filter(s=>r.includes(s)).reduce((s,m)=>({...s,[m]:Nc(n,m,t[m])}),{})}function ev(e,t,r){let n=p.Assign(e,t);return i.Keys(t).filter(s=>!r.includes(s)).reduce((s,m)=>({...s,[m]:f(n,K([],[]),t[m])}),{})}function tv(e,t,r){let n=jc(t),a=Qb(e,t,n),s=ev(e,t,n),m={...a,...s};return p.Update(m,{},r)}function Ma(e,t,r,n){return tv(e,r,n)}function pa(e,t={}){return I("NonNullable",[e],t)}function id(e,t={}){return Vo(e,t)}function rv(e){let t=E([Jt(),rr()]);return nn(e,t,{})}function Vo(e,t){return k([e])?p.Update(rv(e),{},t):pa(e,t)}function sd(e,t,r,n){let a=f(e,t,r);return Vo(a,n)}function ua(e,t,r={}){return I("Omit",[e,t],r)}function md(e,t,r={}){let n=i.IsArray(t)?cr(t):t;return Bo(e,n,r)}function Aa(e){let t=lr(e);return A(t)?t.properties:X()}function nv(e,t){return i.Keys(e).reduce((n,a)=>t.includes(a)?n:{...n,[a]:e[a]},{})}function pd(e,t){let r=Aa(e),n=fr(t),a=nv(r,n);return $(a)}function Bo(e,t,r){return k([e,t])?p.Update(pd(e,t),{},r):ua(e,t,r)}function ud(e,t,r,n,a){let s=f(e,t,r),m=f(e,t,n);return Bo(s,m,a)}function ca(e,t={}){return I("Parameters",[e],t)}function cd(e,t={}){return Wo(e,t)}function av(e){let t=se(e)?e.parameters:[],r=Et({},K([],[]),t);return te(r)}function Wo(e,t){return k([e])?p.Update(av(e),{},t):ca(e,t)}function ld(e,t,r,n){let a=f(e,t,r);return Wo(a,n)}function la(e,t={}){return I("Partial",[e],t)}function dd(e,t={}){return Ho(e,t)}function fd(e,t){let r=Ze(e,t),n=Qe(r);return We(p.Assign(e,{[t]:n}),t)}function gd(e,t,r){let n=_e(e,t,r);return Qe(n)}function hd(e){let t=B(e);return Qe(t)}function yd(e){let t=e.map(r=>Qe(r));return E(t)}function xd(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:At(e[a])}),{});return $(t)}function Qe(e){return de(e)?fd(e.$defs,e.$ref):H(e)?gd(e.if,e.then,e.else):O(e)?hd(e.allOf):x(e)?yd(e.anyOf):A(e)?xd(e.properties):$({})}function Ho(e,t){return k([e])?p.Update(Qe(e),{},t):la(e,t)}function Id(e,t,r,n){let a=f(e,t,r);return Ho(a,n)}function da(e,t,r={}){return I("Pick",[e,t],r)}function bd(e,t,r={}){let n=i.IsArray(t)?cr(t):t;return Yo(e,n,r)}function ov(e,t){return i.Keys(e).reduce((n,a)=>t.includes(a)?p.Assign(n,{[a]:e[a]}):n,{})}function vd(e,t){let r=Aa(e),n=fr(t),a=ov(r,n);return $(a)}function Yo(e,t,r){return k([e,t])?p.Update(vd(e,t),{},r):da(e,t,r)}function $d(e,t,r,n,a){let s=f(e,t,r),m=f(e,t,n);return Yo(s,m,a)}function fa(e,t={}){return I("ReadonlyObject",[e],t)}function Jo(e,t={}){return Xo(e,t)}var Td=Jo;function kd(e){return Yt(Ae(e))}function wd(e,t){let r=Ze(e,t),n=et(r);return We(p.Assign(e,{[t]:n}),t)}function Ed(e,t,r){let n=_e(e,t,r);return et(n)}function Rd(e){let t=B(e);return et(t)}function Sd(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:jt(e[a])}),{});return $(t)}function Od(e){return Yt(te(e))}function Pd(e){let t=e.map(r=>et(r));return E(t)}function et(e){return z(e)?kd(e.items):de(e)?wd(e.$defs,e.$ref):H(e)?Ed(e.if,e.then,e.else):O(e)?Rd(e.allOf):A(e)?Sd(e.properties):N(e)?Od(e.items):x(e)?Pd(e.anyOf):e}function Xo(e,t){return k([e])?p.Update(et(e),{},t):fa(e)}function Cd(e,t,r,n){let a=f(e,t,r);return Xo(a,n)}function Md(e,t,r,n){return t.visited.includes(n)?r:n in e?f(e,K(t.callstack,[...t.visited,n]),e[n]):r}function Ad(e,t){let r=Ze(e,t),n=tt(r);return We(p.Assign(e,{[t]:n}),t)}function Ld(e,t,r){let n=_e(e,t,r);return tt(n)}function qd(e){let t=B(e);return tt(t)}function jd(e){let t=e.map(r=>tt(r));return E(t)}function Fd(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:Vn(e[a])}),{});return $(t)}function tt(e){return de(e)?Ad(e.$defs,e.$ref):H(e)?Ld(e.if,e.then,e.else):O(e)?qd(e.allOf):x(e)?jd(e.anyOf):A(e)?Fd(e.properties):$({})}function ga(e,t={}){return I("Required",[e],t)}function Dd(e,t={}){return Zo(e,t)}function Zo(e,t){return k([e])?p.Update(tt(e),{},t):ga(e,t)}function Gd(e,t,r,n){let a=f(e,t,r);return Zo(a,n)}function ha(e,t={}){return I("ReturnType",[e],t)}function Nd(e,t={}){return Qo(e,t)}function iv(e){return se(e)?e.returnType:D()}function Qo(e,t){return k([e])?p.Update(iv(e),{},t):ha(e,t)}function Ud(e,t,r,n={}){let a=f(e,t,r);return Qo(a,n)}function ya(e,t){return I("With",[e,t],{})}function Kd(e,t){return ei(e,t)}function ei(e,t){return k([e])?p.Update(e,{},t):ya(e,t)}function _d(e,t,r,n){let a=f(e,t,r);return ei(a,n)}function sv(e){return $t(e)?N(e.items)?ti(e.items.items):J(e.items)?[e]:me(e.items)?[e]:[D()]:[e]}function ti(e){return e.reduce((r,n)=>[...r,...sv(n)],[])}function K(e,t){return{callstack:e,visited:t}}function k(e){return i.ShiftLeft(e,(t,r)=>me(t)?!1:k(r),()=>!0)}function Zr(e,t,r){return i.Keys(r).reduce((n,a)=>({...n,[a]:f(e,t,r[a])}),{})}function Et(e,t,r){let n=qe(e,t,r);return ti(n)}function qe(e,t,r){return r.map(n=>f(e,t,n))}function mv(e,t){let r=xe(e)?Pr(t,{}):t,n=Ft(e)?Or(r,{}):r;return qt(e)?sn(n,{}):n}function pv(e,t,r,n,a){return i.IsEqual(r,"AddImmutable")?zd(e,t,n[0],a):i.IsEqual(r,"RemoveImmutable")?el(e,t,n[0],a):i.IsEqual(r,"AddReadonly")?Ni(e,t,n[0],a):i.IsEqual(r,"RemoveReadonly")?Es(e,t,n[0],a):i.IsEqual(r,"AddOptional")?Ui(e,t,n[0],a):i.IsEqual(r,"RemoveOptional")?Os(e,t,n[0],a):i.IsEqual(r,"Capitalize")?pl(e,t,n[0],a):i.IsEqual(r,"Conditional")?fl(e,t,n[0],n[1],n[2],n[3],a):i.IsEqual(r,"ConstructorParameters")?hl(e,t,n[0],a):i.IsEqual(r,"Evaluate")?_c(e,t,n[0],a):i.IsEqual(r,"Exclude")?xl(e,t,n[0],n[1],a):i.IsEqual(r,"Extract")?vl(e,t,n[0],n[1],a):i.IsEqual(r,"Index")?Vl(e,t,n[0],n[1],a):i.IsEqual(r,"InstanceType")?Wl(e,t,n[0],a):i.IsEqual(r,"Interface")?Mc(e,t,n[0],n[1],a):i.IsEqual(r,"KeyOf")?td(e,t,n[0],a):i.IsEqual(r,"Lowercase")?ul(e,t,n[0],a):i.IsEqual(r,"Mapped")?od(e,t,n[0],n[1],n[2],n[3],a):i.IsEqual(r,"Module")?Ma(e,t,n[0],a):i.IsEqual(r,"NonNullable")?sd(e,t,n[0],a):i.IsEqual(r,"Pick")?$d(e,t,n[0],n[1],a):i.IsEqual(r,"Parameters")?ld(e,t,n[0],a):i.IsEqual(r,"Partial")?Id(e,t,n[0],a):i.IsEqual(r,"Omit")?ud(e,t,n[0],n[1],a):i.IsEqual(r,"ReadonlyObject")?Cd(e,t,n[0],a):i.IsEqual(r,"Record")?Bs(e,t,n[0],n[1],a):i.IsEqual(r,"Required")?Gd(e,t,n[0],a):i.IsEqual(r,"ReturnType")?Ud(e,t,n[0],a):i.IsEqual(r,"TemplateLiteral")?Ju(e,t,n[0],a):i.IsEqual(r,"Uncapitalize")?cl(e,t,n[0],a):i.IsEqual(r,"Uppercase")?ll(e,t,n[0],a):i.IsEqual(r,"With")?_d(e,t,n[0],n[1]):I(r,n,a)}function uv(e,t,r){let n=me(r)?Md(e,t,r,r.$ref):z(r)?Ae(f(e,t,r.items),Mn(r)):ur(r)?Pa(e,t,r.target,r.arguments):ie(r)?ze(qe(e,t,r.parameters),f(e,t,r.instanceType),Ki(r)):se(r)?Ve(qe(e,t,r.parameters),f(e,t,r.returnType),_i(r)):H(r)?Lt(f(e,t,r.if),f(e,t,r.then),f(e,t,r.else),Yi(r)):O(r)?Ie(qe(e,t,r.allOf),es(r)):A(r)?$(Zr(e,t,r.properties),Wi(r)):ge(r)?Ws(Ne(r),f(e,t,Te(r))):$t(r)?Nt(f(e,t,r.items)):N(r)?te(Et(e,t,r.items),ws(r)):x(r)?E(qe(e,t,r.anyOf),fs(r)):r;return mv(r,n)}function f(e,t,r){return ht(r)?pv(e,t,r.action,r.parameters,r.options):uv(e,t,r)}function ri(e,t){return f(e,K([],[]),t)}function cv(e){return p.Update(e,{"~immutable":!0},{})}function sn(e,t){return p.Update(cv(e),{},t)}function zd(e,t,r,n){let a=f(e,t,r);return sn(a,n)}function Hp(e,t={}){return I("AddImmutable",[e],t)}function Yt(e,t={}){return sn(e,t)}function Yp(e,t={}){return I("Evaluate",[e],t)}function Vd(e,t={}){return Co(e,t)}function Jp(e,t={}){return I("Module",[e],t)}function Bd(e,t={}){return Ma({},K([],[]),e,t)}function Wd(...e){let[t,r,n]=He.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=Vu(r),s=i.IsArray(a)&&i.IsEqual(a.length,2)?f(t,K([],[]),a[0]):D();return p.Update(s,{},n)}var U={};Ot(U,{Any:()=>Ht,Array:()=>Ae,BigInt:()=>Lr,Boolean:()=>Dn,Call:()=>Zc,Capitalize:()=>ol,Codec:()=>Fn,Conditional:()=>dl,Constructor:()=>ze,ConstructorParameters:()=>gl,Cyclic:()=>We,Decode:()=>as,DecodeBuilder:()=>Ar,Dependent:()=>Lt,Encode:()=>os,EncodeBuilder:()=>Mr,Enum:()=>Qi,Evaluate:()=>Vd,Exclude:()=>yl,Extends:()=>fe,ExtendsResult:()=>v,Extract:()=>Il,Function:()=>Ve,Generic:()=>yt,Identifier:()=>qr,Immutable:()=>is,Index:()=>$l,Infer:()=>Cr,InstanceType:()=>Bl,Instantiate:()=>ri,Integer:()=>Dt,Interface:()=>Ac,Intersect:()=>Ie,IsAny:()=>Z,IsArray:()=>z,IsBigInt:()=>Je,IsBoolean:()=>Fe,IsCall:()=>ur,IsCodec:()=>jn,IsConstructor:()=>ie,IsCyclic:()=>de,IsDependent:()=>H,IsEnum:()=>be,IsEnumValue:()=>Zi,IsFunction:()=>se,IsGeneric:()=>Wt,IsIdentifier:()=>us,IsImmutable:()=>qt,IsInfer:()=>J,IsInteger:()=>ve,IsIntersect:()=>O,IsKind:()=>y,IsLiteral:()=>q,IsNever:()=>xt,IsNull:()=>Xt,IsNumber:()=>Q,IsObject:()=>A,IsOptional:()=>xe,IsParameter:()=>ds,IsReadonly:()=>Ft,IsRecord:()=>ge,IsRef:()=>me,IsRefine:()=>to,IsRest:()=>$t,IsSchema:()=>ne,IsString:()=>$e,IsSymbol:()=>It,IsTemplateLiteral:()=>ee,IsThis:()=>Xn,IsTuple:()=>N,IsUndefined:()=>nr,IsUnion:()=>x,IsUnknown:()=>ae,IsUnsafe:()=>qn,IsVoid:()=>Xe,KeyOf:()=>Hl,Literal:()=>P,Lowercase:()=>il,Mapped:()=>rd,Module:()=>Bd,Never:()=>D,NonNullable:()=>id,Null:()=>Jt,Number:()=>Se,Object:()=>$,Omit:()=>md,Optional:()=>Vi,Parameter:()=>Gt,Parameters:()=>cd,Partial:()=>dd,Pick:()=>bd,Readonly:()=>ss,ReadonlyObject:()=>Jo,ReadonlyType:()=>Td,Record:()=>Hn,RecordKey:()=>tr,RecordPattern:()=>Ne,RecordValue:()=>Te,Ref:()=>it,Refine:()=>ms,Required:()=>Dd,Rest:()=>Nt,ReturnType:()=>Nd,Script:()=>Wd,String:()=>De,Symbol:()=>Zt,TemplateLiteral:()=>Zu,This:()=>Jn,Tuple:()=>te,Uncapitalize:()=>sl,Undefined:()=>rr,Union:()=>E,Unknown:()=>ue,Unsafe:()=>Hi,Uppercase:()=>ml,Void:()=>Zn,With:()=>Kd});var gr="submit_review_report",hr="submit_test_gap_candidates",mn="submit_filtered_test_gaps",pn="submit_solver_gaps",lv=U.Object({verdict:U.Union([U.Literal("PASS"),U.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:U.String({description:"One short sentence summarizing the verdict."}),reasons:U.Array(U.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:U.Array(U.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."})});function Hd(e){return{name:gr,label:"Submit Review Report",description:"Submit your final verdict for this review. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished reading and analyzing the relevant files. Do not write a plain-text final answer instead of calling this tool.",parameters:lv,async execute(t,r){return e.report={verdict:r.verdict,summary:r.summary,reasons:r.reasons??[],notes:r.notes??[]},{content:[{type:"text",text:`Report recorded: ${r.verdict}`}],details:void 0}}}}var dv=U.Object({gaps:U.Array(U.Object({description:U.String({description:"The specific untested behavior or edge case, in plain terms. Prefix with POSITIVE: or NEGATIVE: to indicate whether this is a missing required-behavior test or a missing forbidden/wrong-behavior test."}),risk:U.String({description:"Concretely why a plausible-but-incorrect implementation could still pass every test in test.patch despite missing, misimplementing, or violating this behavior (including doing a forbidden thing because no test asserts it must not happen)."})}),{description:"Candidate behavioral test gaps (positive and negative) grounded in agent_prompt.md or clear existing repo behavior. Use an empty array if you found none \u2014 do not manufacture gaps just to report something."})});function Yd(e){return{name:hr,label:"Submit Candidate Test Gaps",description:"Submit your candidate list of behavioral test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished reading and analyzing the relevant files.",parameters:dv,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Recorded ${n.length} candidate gap(s)`}],details:void 0}}}}var fv=U.Object({gaps:U.Array(U.Object({description:U.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:U.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 Jd(e){return{name:mn,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:fv,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Confirmed ${n.length} gap(s) after filtering`}],details:void 0}}}}var gv=U.Object({gaps:U.Array(U.Object({description:U.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:U.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:U.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 Xd(e){return{name:pn,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,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Recorded ${n.length} solver gap(s)`}],details:void 0}}}}var hv={description:"Focus area: the task description in `agent_prompt.md`. Judge it strictly against rubric items P1-P5 below. You do not need to judge the tests or solution \u2014 other reviewers cover those.",tests:"Focus area: the tests added in `test.patch` (a unified diff). Judge them strictly against rubric items T1-T6 below. You cannot execute code or apply the patch, so read the diff carefully and reason about determinism, coverage, and strictness directly from the added code. Read `agent_prompt.md` for context on what behavior is in scope, and skim `solution.patch` only to understand what the tests are checking. Do not judge the description or the solution's code quality.\nMandatory symbol-fairness check: for every non-trivial method/function/property/export name that a test calls, mutates, mocks, or asserts on, use grep/read on the repository (the pre-existing code, not solution.patch) to confirm it actually exists there, OR confirm it is explicitly named in `agent_prompt.md`. Pay special attention to any such name that is new/invented and that duplicates, shadows, or conflicts with an existing, differently-named public API doing the same thing (e.g. a test calling `setFoo(...)` when the repo's real, visible API is `setBar(...)`) \u2014 that is a textbook unfair/undiscoverable test per the fairness methodology, and is blocking on its own even if every other test in the patch is fine.",solution:"Focus area: the golden solution in `solution.patch` (a unified diff). Judge it strictly against rubric items S1-S4 below. Read `agent_prompt.md` for the requirements and `test.patch` to see what must pass, and use read/grep/ls/find on the rest of the repository to check for regressions, inconsistent style, and irrelevant/unexplained changes. Do not judge the description's wording or the tests' coverage.\nMandatory repo-conventions check: for every file and area touched by `solution.patch`, read the corresponding pre-existing code in the repo \u2014 same directory, sibling modules, similar components/services/hooks, and any files the patch imports from or extends. Establish how this repo actually does things (error handling and logging, naming, exports, state management, async patterns, i18n, test helpers, DI/service boundaries, comment density, defensive checks) and judge whether the solution matches those conventions. Flag clear deviations as S2/S4 issues \u2014 e.g. inventing a new logger when the repo uses a shared one, raw `console.*` where the codebase uses a structured error reporter, a different hook/service pattern than neighboring features, or new abstractions where similar code inlines the same logic. Use grep/read to find 2\u20133 closest analogues before concluding a pattern is acceptable.\nMandatory dead-code check: scan every added/changed line in `solution.patch` for unused code \u2014 variables, parameters, imports, functions/methods, or fields that are declared/assigned but never read or called anywhere (including by `test.patch`) \u2014 and for dead/unreachable code (branches, conditions, or statements that can never execute, or code left behind after a return/throw/break that makes it unreachable). Use grep to confirm a symbol truly has no other usages in the repo before flagging it. This is a rubric S4 violation and is blocking on its own, even if the rest of the solution is otherwise excellent."};function Zd(e){return[e,"You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the task description given to a coding agent), `test.patch` (a unified diff adding the hidden tests that will grade that agent's solution), and `solution.patch` (a unified diff of one golden/reference solution).","Another specialized agent is searching the complementary direction in parallel \u2014 stay in your lane and do not duplicate its work."]}var Qd=["Thoroughness \u2014 your job is high recall on genuine gaps only:","- Find every gap you can justify with concrete evidence. Do not stop after the first obvious ones \u2014 keep reading until you have systematically covered the prompt, `solution.patch`, and relevant repo context.","- After your first pass, run at least one deliberate second sweep (re-read `agent_prompt.md`, re-scan `solution.patch`, grep the repo) before submitting \u2014 but if that sweep still finds nothing, submit an empty list.","- Do not self-censor or merge distinct genuine gaps into one \u2014 the validator will prune. Never invent or pad the list to seem thorough; an empty array is correct when exhaustive analysis truly finds none.","- Hunt subtle gaps too: partial coverage (asserted once but not under other valid inputs), behaviors implied by repo convention, interaction effects, ordering/timing, and branches visible in `solution.patch` that no test forces.","- Include a candidate only when you can cite specific grounding and a concrete false-pass risk \u2014 not to meet a quota."],ef=["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)."];function tf(e,t,r){let n=["You are a careful, calibrated reviewer 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 may contain: `agent_prompt.md` (the task description), `test.patch` (unified diff adding tests), and `solution.patch` (unified diff of the golden solution). Read whichever are relevant to your focus, and read the rest of the repository as needed via grep/read/ls/find to judge things against real repo context.","",hv[e.key],"","Checklist for your focus area:",t];return r&&n.push("","Fairness methodology (use this to judge whether an issue is actually blocking, and to distinguish agent-fault from prompt-ambiguity from test-flaw problems):",r),e.key==="solution"&&n.push("","Solution-specific calibration for repo standards (S2/S4):","Before returning PASS, you must have read real analogue files in the repo and compared patterns. A clear, documented mismatch with established repo conventions \u2014 wrong error/logging approach, inconsistent service or hook structure vs neighboring code, new patterns where the repo consistently uses existing ones \u2014 is blocking under S2/S4, not a minor note. Purely cosmetic nits (spacing, import order) with no pattern break belong in `notes`."),n.push("","How to set the verdict \u2014 calibrate, don't nitpick:","FAIL only for a genuine BLOCKING issue: a checklist item is clearly violated, a requirement stated in `agent_prompt.md` is untested or contradicted, a test asserts something unfair/undiscoverable per the fairness methodology above (private internals, exact class names not in the prompt, exact call order, reference-solution-only structure, etc.), a test is genuinely non-deterministic in a way that risks real CI flakiness (real network calls, unseeded randomness, race-prone ordering), or the solution has a real regression, missing requirement, or unrelated/unexplained change.","Do NOT fail for: optional coverage suggestions, 'would also be nice to test X', dead/unused code that doesn't affect correctness, minor style inconsistencies, or defensible implementation choices the prompt didn't forbid. These are exactly the kind of thing a real reviewer leaves as a 'Minor/optional' note without failing the task \u2014 put them in `notes` and still return PASS.","When genuinely torn between PASS and FAIL, default to PASS with the concern captured in `notes`, unless the issue would let a materially incorrect agent solution pass the hidden tests, or would unfairly fail a correct one \u2014 that is always blocking.","A single blocking issue is enough to FAIL, even if it affects only one test or one line out of many, and even if the rest of the suite is excellent. Do NOT average it away or let a large, otherwise-strong test suite talk you into a PASS \u2014 one unfair or undiscoverable test (e.g. requiring a private/invented API name that doesn't exist in the repo and isn't named in the prompt, especially one that conflicts with an existing, differently-named public API) is exactly as blocking as many.","",`When you are done analyzing, call the \`${gr}\` tool exactly once with your structured verdict. That tool call is your only way to report a result.`),n.join(`
12
- `)}function rf(e,t){let r=[...Zd("You are an exhaustive, research-minded POSITIVE test-coverage analyst for a coding-agent benchmark task. Your sole mandate is to surface EVERY genuine POSITIVE behavioral test gap \u2014 required behavior that `test.patch` never asserts but `agent_prompt.md` requires. Do NOT search for forbidden/wrong-behavior gaps; a separate negative-case agent handles those in parallel. Stay in your lane and search exhaustively before concluding there are none."),"","Your job: find real POSITIVE TEST GAPS. A positive gap is required or clearly-implied behavior from `agent_prompt.md` (and, where relevant, obvious existing repo conventions) that `test.patch` does NOT actually verify \u2014 such that a plausible implementation could skip or misimplement that required behavior and STILL pass every test in `test.patch` as written.","","Focus on required outcomes: happy paths, side effects, state changes, outputs, transitions, edge inputs where the prompt still expects correct handling, combined/interacting behaviors, and branches in `solution.patch` whose correct outcome is never forced by a test.","","Be systematic and exhaustive \u2014 work through ALL of the following passes:","1. Go through `agent_prompt.md` sentence by sentence. For every distinct required behavior, constraint, or implied rule, check which test(s) in `test.patch` exercise it and how thoroughly.","2. Go through `solution.patch` branch by branch \u2014 every conditional, loop, early return, error path, and state transition. For each one, ask whether `test.patch` forces the correct outcome to be checked.","3. Consider standard positive edge-case categories: boundary/limit values, empty/missing/null/zero inputs that should still produce the required correct behavior, duplicate or repeated inputs handled correctly, ordering and interleaving, concurrent or repeated invocations, error/failure/rollback paths that should recover correctly, interaction between two or more required behaviors at once, and state left behind after an operation.","4. Cross-check overlapping/interacting requirements \u2014 behaviors each tested alone but never tested together.","5. Second-pass sweep: return to any requirement you marked 'covered' and ask whether coverage is shallow \u2014 one happy-path assertion is not enough if other valid inputs, sequences, or combinations could still slip through.",...Qd,"Do not filter yourself or self-censor for volume. A separate validator will strictly filter afterward \u2014 your job is recall on POSITIVE gaps only.","",...ef,"","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",e];return t&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),r.push("","For each gap, prefix the description with `POSITIVE:` and explain: (1) the specific untested required behavior/edge case, and (2) concretely why a plausible-but-incomplete implementation would still pass every given test despite missing or misimplementing it.",`When you are done \u2014 after completing ALL the passes above and a deliberate second sweep \u2014 call the \`${hr}\` tool exactly once with your full candidate list (empty only if, after genuinely exhaustive analysis, none exist). That tool call is your only way to report a result.`),r.join(`
13
- `)}function nf(e,t){let r=[...Zd("You are an exhaustive, research-minded NEGATIVE test-coverage analyst for a coding-agent benchmark task. Your sole mandate is to surface EVERY genuine NEGATIVE behavioral test gap \u2014 forbidden behavior, invalid states, or wrong outcomes that `test.patch` never asserts against but `agent_prompt.md` prohibits or implies must not happen. Do NOT search for missing required-behavior gaps; a separate positive-case agent handles those in parallel. Stay in your lane and search exhaustively before concluding there are none."),"","Your job: find real NEGATIVE TEST GAPS. A negative gap is a prohibition, guard, or 'must not' constraint from `agent_prompt.md` (or unambiguous repo convention) that `test.patch` does NOT verify \u2014 such that an agent could violate `agent_prompt.md` by doing the forbidden thing, leaving the wrong state enabled, applying an effect to the wrong target, skipping a guard, or accepting invalid input, and STILL pass every test because the suite only checks that correct actions work, not that incorrect ones are rejected.","","Be systematic and exhaustive \u2014 work through ALL of the following passes:","1. Re-read `agent_prompt.md` specifically for prohibitions, conditions, guards, and 'only when' / 'must not' / 'never' / 'disabled when' / 'should not' language. For each, ask: does `test.patch` assert the WRONG thing does NOT happen?","2. Go through `solution.patch` for every guard, early return, disabled branch, isolation check, and rejection path. Ask whether a sloppy implementation that bypassed that guard would still pass.","3. Hunt these negative patterns explicitly:"," - Controls that must be disabled/unavailable in a given state, but no test drives that state and asserts disabled."," - Operations that must NOT affect a separate scope/target (isolation), but tests never prove the wrong scope is untouched."," - Side effects that must NOT occur (duplicate entries, spurious history steps, refresh on no-op)."," - Invalid, out-of-order, or repeated input that should be ignored/rejected/coalesced differently."," - Undo/redo or rollback boundaries where the first action must NOT be undoable, or redo must NOT be available."," - Mutual exclusion: doing A must NOT silently change B, but no test proves independence.","4. For every prompt prohibition, ask: 'Is there a test that would catch an agent doing the forbidden thing or applying the requirement in the wrong context?' If not, it is a gap.","5. Adversarial pass: imagine a lazy or slightly-wrong implementation that satisfies the obvious tests \u2014 list every way it could still violate the prompt (wrong scope, wrong timing, wrong guard, spurious side effect, missing rejection) and check whether `test.patch` would catch each one.",...Qd,"Do not filter yourself or self-censor for volume. A separate validator will strictly filter afterward \u2014 your job is recall on NEGATIVE gaps only.","",...ef,"- Negative gaps must be grounded in an explicit or clearly implied prohibition/constraint in `agent_prompt.md` \u2014 not generic 'more negative tests would be nice'.","- A single test that asserts both the positive outcome AND that the forbidden/wrong outcome did not occur counts as covered.","","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",e];return t&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),r.push("","For each gap, prefix the description with `NEGATIVE:` and explain: (1) the specific untested forbidden/wrong behavior or invalid state, and (2) concretely why a plausible-but-wrong implementation would still pass every given test despite violating this constraint.",`When you are done \u2014 after completing ALL the passes above and a deliberate second sweep \u2014 call the \`${hr}\` tool exactly once with your full candidate list (empty only if, after genuinely exhaustive analysis, none exist). That tool call is your only way to report a result.`),r.join(`
14
- `)}function af(e,t,r){let n=["You are a strict, skeptical fairness auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","Two specialized research agents reviewed this same task (`agent_prompt.md`, `test.patch`, `solution.patch`, and the repo) in parallel \u2014 one hunting POSITIVE gaps (missing required-behavior tests), one hunting NEGATIVE gaps (missing forbidden/wrong-behavior tests). They proposed the following combined CANDIDATE list:","",JSON.stringify(e,null,2),"","Your job is to independently re-verify the files yourself and FILTER this list down to only candidates that are ALL of the following:","1. Genuinely grounded \u2014 actually required by a specific statement in `agent_prompt.md`, or unambiguous from clearly visible, existing repo behavior. Drop anything speculative, nice-to-have, or invented beyond what the prompt actually asks for.","2. Fair to test \u2014 verifying it would not require undiscoverable private internals, an invented/unnamed API, or exact incidental structure that only `solution.patch` happens to use. Judge this precisely against the fairness methodology below.","3. A real, distinct coverage hole \u2014 re-check `test.patch` yourself; drop any candidate an existing test already covers, and drop near-duplicate candidates (keep only the clearest phrasing of each distinct gap). For negative-case candidates, keep them only if `test.patch` does not already assert that the forbidden/wrong outcome does not occur.","","Be strict: when genuinely unsure whether a candidate holds up, drop it rather than keep it. It is fine \u2014 expected, even \u2014 to return an empty list if none of the candidates survive scrutiny.","","Checklist for the tests focus area, for calibration:",t];return r&&n.push("","Fairness methodology:",r),n.push("","For every gap you keep, give a short justification citing where in `agent_prompt.md` or the repo it is grounded. Preserve POSITIVE:/NEGATIVE: prefix when applicable.",`When you are done, call the \`${mn}\` tool exactly once with your final filtered list (which may be empty). That tool call is your only way to report a result.`),n.join(`
15
- `)}function of(){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(`
16
- `)}function yv(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 \`${kr}/solver_${e.index}/\``}function sf(e){return["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 \`${kr}/solver_<index>/\` (\`solution.diff\`, \`test_output.txt\`), with a \`${kr}/manifest.json\` summary. Use read/grep/find/ls to open exactly what you need. Status summary:`,"",...e.map(yv),"","Your job: read `agent_prompt.md` and `solution.patch` carefully, then read each PASSED solver's `solution.diff` to find concrete BEHAVIORAL GAPS \u2014 cases where a solver took a materially different approach from what `agent_prompt.md` requires or `solution.patch` implements, that solver's tests still PASSED, and the difference reveals a real requirement that `test.patch` fails to actually enforce.","","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 that PASSED, read its `solution.diff` and compare it against the reference approach. Look specifically for places where the solver's code takes a shortcut, ignores a constraint, mishandles an edge case, or omits a side effect that `agent_prompt.md` calls for or `solution.patch` implements \u2014 yet the tests didn't catch it.","4. A solver that FAILED is not itself a gap \u2014 but if you can see from its `solution.diff` that it was heading toward a plausible-but-wrong implementation of some requirement, and nothing in `test.patch` would have caught that wrong implementation even if it had otherwise passed, that is still worth surfacing; use its `test_output.txt` for extra context if useful.","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.","","Ground rules \u2014 do not overreach:","- Every gap must be grounded in a specific requirement/sentence in `agent_prompt.md` (or an unambiguous behavior in `solution.patch` that directly implements a prompt requirement) \u2014 do not invent requirements the prompt doesn't support.","- Every gap must be evidenced by an actual, cited part of a specific solver's diff \u2014 do not report a gap that is purely theoretical with no solver diff demonstrating it.","- Do not flag a solver difference if `test.patch` already exercises and would catch the wrong behavior, or if the difference is a defensible implementation detail the prompt doesn't mandate (naming, file layout, helper structure, etc. \u2014 unless the prompt or repo conventions specifically call for it).","- 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.","",`When you are done, call the \`${pn}\` tool exactly once with your final list (which may be empty). That tool call is your only way to report a result.`].join(`
17
- `)}var mf=900*1e3,La=["read","grep","find","ls"];function ln(e){return e==="off"?void 0:e}async function dn(e,t,r=mf){let n=t.aborted?"cancelled":"done";return await Promise.race([e().then(()=>{t.aborted||(n="done")}),new Promise(a=>{setTimeout(()=>{n="timedOut",a()},r)}),new Promise(a=>{if(t.aborted)return a();t.addEventListener("abort",()=>{n="cancelled",a()},{once:!0})})]),n}async function pf(e){let t={},r=e.model,{session:n}=await un({cwd:e.tempDir,model:r,thinkingLevel:ln(e.thinkingLevel),tools:[...La,gr],customTools:[Hd(t)],sessionManager:cn.inMemory()});try{let a=await dn(async()=>{await n.prompt(tf(e.role,e.rubric,e.fairnessRules))},e.cancelSignal);if(a==="cancelled")return await n.abort(),{verdict:"FAIL",summary:`${e.role.label} reviewer cancelled`,reasons:["Cancelled by user."],notes:[]};if(a==="timedOut")return await n.abort(),{verdict:"FAIL",summary:`${e.role.label} reviewer timed out`,reasons:[`Reviewer did not finish within ${mf/1e3}s.`],notes:[]}}catch(a){return{verdict:"FAIL",summary:`${e.role.label} reviewer errored`,reasons:[`Reviewer agent failed: ${a instanceof Error?a.message:String(a)}`],notes:[]}}return t.report?t.report:{verdict:"FAIL",summary:`${e.role.label} reviewer did not submit a report`,reasons:[`The reviewer agent finished without calling ${gr}.`],notes:[]}}async function ni(e){let t={},r=e.kind==="positive"?rf:nf,n=e.model,{session:a}=await un({cwd:e.tempDir,model:n,thinkingLevel:ln(e.thinkingLevel),tools:[...La,hr],customTools:[Yd(t)],sessionManager:cn.inMemory()});try{let s=await dn(async()=>{await a.prompt(r(e.testRubric,e.fairnessRules))},e.cancelSignal);if(s!=="done")return await a.abort(),{status:s,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var xv=["read","grep","find","ls","write","edit","bash"];async function uf(e){let t=e.model;try{let r=cn.inMemory(),{session:n}=await un({cwd:e.solverDir,model:t,thinkingLevel:ln(e.thinkingLevel),tools:[...xv],sessionManager:r}),a=await dn(async()=>{await n.prompt(of())},e.cancelSignal,e.timeoutMinutes*60*1e3);return a!=="done"&&await n.abort(),{outcome:a,trajectory:r.getEntries()}}catch{return{outcome:"error",trajectory:[]}}}async function cf(e){let t={},r=e.model,{session:n}=await un({cwd:e.tempDir,model:r,thinkingLevel:ln(e.thinkingLevel),tools:[...La,pn],customTools:[Xd(t)],sessionManager:cn.inMemory()});try{let a=await dn(async()=>{await n.prompt(sf(e.solverResults))},e.cancelSignal);if(a!=="done")return await n.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}async function lf(e){let t={},r=e.model,{session:n}=await un({cwd:e.tempDir,model:r,thinkingLevel:ln(e.thinkingLevel),tools:[...La,mn],customTools:[Jd(t)],sessionManager:cn.inMemory()});try{let a=await dn(async()=>{await n.prompt(af(e.candidates,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await n.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var he="checks_progress";function Ee(e,t,r){let n=r>0?Math.min(1,t/r):0,a=Math.round(24*n),s="\u2588".repeat(a)+"\u2591".repeat(Math.max(0,24-a));return[`checks: ${e} [${s}] ${t}/${r}`]}import{existsSync as Iv,readFileSync as bv}from"node:fs";var ut=[{key:"description",label:"Description",rubricHeading:/^## The problem description/i},{key:"tests",label:"Tests",rubricHeading:/^## The tests/i},{key:"solution",label:"Solution",rubricHeading:/^## The solution/i}];var ai=["agent_prompt.md","solution.patch","test.patch"];function oi(e=new Date){let t=(s,m=2)=>String(s).padStart(m,"0"),r=-e.getTimezoneOffset(),n=r>=0?"+":"-",a=Math.abs(r);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}${n}${t(Math.floor(a/60))}:${t(a%60)}`}function df(e){try{if(!Iv(e))return{};let t=JSON.parse(bv(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function ff(e){let{existingReport:t,config:r,runReviewers:n,byRole:a,runGapStages:s,testGaps:m,gapAnalysisIncomplete:c,positiveGapFinderStatus:l,negativeGapFinderStatus:d,gapFilterStatus:g,runSolverGapFinder:b,solverResults:V,solverGaps:G,solverGapAnalysisIncomplete:w,solverComparisonStatus:Ce}=e,L={...t,timestamp:oi(),model:`${r.provider}/${r.modelId}`,thinkingLevel:r.thinkingLevel};if(n){let re={...t.reports&&typeof t.reports=="object"?t.reports:{},...a};L.reports=re,ut.every(Me=>re[Me.key])?L.overall=ut.every(Me=>re[Me.key].verdict==="PASS")?"PASS":"FAIL":delete L.overall}return s&&(L.testGaps=m,c?L.testGapAnalysisNote=`Gap analysis did not fully complete (positive finder: ${l}, negative finder: ${d}, filter: ${g}); testGaps may be incomplete.`:delete L.testGapAnalysisNote),b&&(L.solverRunSummary=V.map(le=>({index:le.index,status:le.status,passed:le.passed,durationMs:le.durationMs,artifactsDir:le.artifactsDir})),L.solverGaps=G,w?L.solverGapAnalysisNote=`Solver-gap analysis did not fully complete (comparison reviewer: ${Ce}); solverGaps may be incomplete.`:delete L.solverGapAnalysisNote),L}function gf(e){let t=Math.round(e/1e3),r=Math.floor(t/60),n=t%60;return r>0?`${r}m ${n}s`:`${n}s`}function hf(e){let{merged:t,runReviewers:r,activeRoles:n,byRole:a,runGapStages:s,runSolverGapFinder:m}=e,c=Array.isArray(t.testGaps)?t.testGaps.length:0,l=r?Object.fromEntries(n.filter(w=>a[w.key]).map(w=>[w.key,a[w.key].verdict])):void 0,d=r&&typeof t.overall=="string"?t.overall:void 0,g=[];if(l&&g.push(n.map(w=>`${w.label}: ${l[w.key]??"?"}`).join(", ")),d){let w=d==="PASS"&&c>0?" (with test gaps)":"";g.push(`Overall: ${d}${w}`)}s&&g.push(c>0?`${c} test gap(s) found`:"no test gaps found");let b=m?(Array.isArray(t.solverRunSummary)?t.solverRunSummary:[]).map(w=>({index:w.index,status:w.status,passed:w.passed,durationMs:w.durationMs??0})):[],V=b.filter(w=>w.passed).length,G=Array.isArray(t.solverGaps)?t.solverGaps.length:0;return m&&g.push(`${V}/${b.length} solvers passed, ${G} gap(s) found`),{content:`Checks: ${g.join(" | ")}`,details:{overall:d,hasTestGaps:c>0,gapsCount:c,roleVerdicts:l,showGaps:s,showSolverGaps:m,solverDetails:b,solverGapsCount:G}}}var yf=`## The problem description (aka the task)\r
11
+ `,e),([t,r])=>[[t],r]),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]),wu=(e,t=[])=>o(o(io(e),([r,n])=>o(Tx(n),([a,s])=>[[r,a],s])),([r,n])=>wu(n,[...t,r]),()=>[t,e]),kx=e=>o(o(wu(e),([t,r])=>o(o(o(io(r),([n,a])=>[[n],a]),([n,a])=>[n,a],()=>o([[],r],([n,a])=>[n,a],()=>[])),([n,a])=>[[t,n],a])),([t,r])=>[Rp(t),r]),io=e=>o(o($x(e),([t,r])=>o(o(xx(r),([n,a])=>[n,a],()=>o(Ix(r),([n,a])=>[n,a],()=>o(bx(r),([n,a])=>[n,a],()=>o(vx(r),([n,a])=>[n,a],()=>[])))),([n,a])=>o(Qp(a),([s,m])=>[[t,n,s],m]))),([t,r])=>[Sp(t),r]),Ex=e=>o(o(io(e),([t,r])=>o(kx(r),([n,a])=>[[t,n],a])),([t,r])=>[Op(t),r]),Ru=e=>o(o(Ex(e),([t,r])=>[t,r],()=>o(Ry(e),([t,r])=>[t,r],()=>o(w(e),([t,r])=>[t,r],()=>[]))),([t,r])=>[t,r]);function Su(e){let t=ro(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:H()}function Rx(e){return e.join("|")}function Sx(e){return e.slice(1,e.length-1)}function Ox(e,t,r){return yt(t,`${r}${e}`)}function Px(e,t){return yt(e,`${t}${Bi}`)}function Mx(e,t){return yt(e,`${t}${$n}`)}function Cx(e,t){return yt(e,`${t}${kn}`)}function Ax(e,t){return Fr(k([S("false"),S("true")]),e,t)}function qx(e,t){return yt(e,`${t}${En}`)}function Lx(e,t,r){return yt(t,`${r}${Sx(e)}`)}function jx(e,t,r){let n=Dr(e,{});return Fr(n,t,r)}function Fx(e,t,r){let n=ke(e);return Fr(n,t,r)}function Ou(e,t,r,n=[]){return i.ShiftLeft(e,(a,s)=>Ou(s,t,r,[...n,Fr(a,[],"")]),()=>yt(t,`${r}(${Rx(n)})`))}function Fr(e,t,r){return de(e)?Fx(e.enum,t,r):fe(e)?Mx(t,r):C(e)?Ox(e.const,t,r):ze(e)?Px(t,r):Re(e)?Ax(t,r):J(e)?Cx(t,r):ge(e)?qx(t,r):X(e)?Lx(e.pattern,t,r):Mu(e)?jx(e.parameters[0],t,r):h(e)?Ou(e.anyOf,t,r):wi}function yt(e,t){return i.ShiftLeft(e,(r,n)=>Fr(r,n,t),()=>t)}function Dx(e){return`^${yt(e,"")}$`}function Pu(e){let t=Dx(e);return Rn(t)}function Dr(e,t){return T(e)?p.Update(Pu(e),{},t):jn(e,t)}function Cu(e,t,r,n){let a=Ee(e,t,r);return Dr(a,n)}function jn(e,t={}){return y("TemplateLiteral",[e],t)}function Mu(e){return ee(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function Au(e){return Dr(e,{})}function Nx(e){let t=Su(e);return Au(t)}function qu(e,t={}){let r=i.IsString(e)?Nx(e):Au(e);return p.Update(r,{},t)}function X(e){return g(e,"TemplateLiteral")}var b={};kt(b,{ExtendsFalse:()=>$,ExtendsTrue:()=>f,ExtendsUnion:()=>so,IsExtendsFalse:()=>Gx,IsExtendsTrue:()=>ju,IsExtendsTrueLike:()=>rr,IsExtendsUnion:()=>Lu,Match:()=>G});function so(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Lu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsUnion")&&i.IsObject(e.inferred)}function f(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function ju(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function $(){return p.Create({"~kind":"ExtendsFalse"},{})}function Gx(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function rr(e){return Lu(e)||ju(e)}function G(e,t,r){return rr(e)?t(e.inferred):r()}function Ux(e,t,r,n){return G(O(e,r,n),a=>f(p.Assign(p.Assign(e,a),{[t]:r})),()=>$())}function Kx(e,t){return f(e)}function _x(e,t,r,n,a){return G(O(e,t,r),s=>G(O(s,t,n),m=>f(m),()=>$()),()=>G(O(e,t,a),s=>f(s),()=>$()))}function zx(e,t,r){let n=ke(r);return O(e,t,n)}function Fu(e,t,r){return i.ShiftLeft(r,(n,a)=>G(O(e,t,n),s=>Fu(s,t,a),()=>$()),()=>f(e))}function Bx(e,t,r){let n=xe(r);return O(e,t,n)}function Du(e,t,r){return i.ShiftLeft(r,(n,a)=>G(O(e,t,n),s=>f(s),()=>Du(e,t,a)),()=>$())}function A(e,t,r){return Y(r)?Kx(e,t):B(r)?_x(e,t,r.if,r.then,r.else):de(r)?zx(e,t,r.enum):W(r)?Ux(e,r.name,t,r.extends):R(r)?Fu(e,t,r.allOf):X(r)?Bx(e,t,r.pattern):h(r)?Du(e,t,r.anyOf):te(r)?f(e):$()}function Nu(e,t,r){return W(r)?A(e,t,r):Y(r)?f(e):te(r)?f(e):so(e)}function Vx(e,t){let r=Pt(e),n=Pt(t);return r&&n||!r&&n?!0:!(r&&!n)}function Gu(e,t,r,n){return K(n)?Vx(t,n)?O(e,r,n.items):$():A(e,t,n)}function Uu(e,t,r){return ze(r)?f(e):A(e,t,r)}function Ku(e,t,r){return Re(r)?f(e):A(e,t,r)}function Wx(e,t,r,n,a){let s=W(n)?t:n,m=W(n)?n:t,c=ce(t),l=ce(n);return!c&&l?$():G(O(e,s,m),I=>Nr(I,r,a),()=>$())}function Hx(e,t,r,n){return i.ShiftLeft(n,(a,s)=>Wx(e,t,r,a,s),()=>ce(t)?f(e):$())}function Yx(e,t,r){return i.ShiftLeft(t,(n,a)=>Hx(e,n,a,r),()=>f(e))}function Nr(e,t,r){return Yx(e,t,r)}function pa(e,t,r){return Be(r)?f(e):O(e,t,r)}function _u(e,t,r,n){return Y(n)?f(e):te(n)?f(e):re(n)?G(Nr(e,t,n.parameters),a=>pa(a,r,n.instanceType),()=>$()):$()}function zu(e,t,r,n,a){return G(O(e,t,a),()=>O(e,r,a),()=>O(e,n,a))}function Bu(e,t,r){let n=ke(t);return O(e,n,r)}function Vu(e,t,r,n){return Y(n)?f(e):te(n)?f(e):ne(n)?G(Nr(e,t,n.parameters),a=>pa(a,r,n.returnType),()=>$()):$()}function Wu(e,t,r){return fe(r)?f(e):J(r)?f(e):A(e,t,r)}function Hu(e,t,r){let n=_(t);return O(e,n,r)}function ua(e,t,r){return t===r?f(e):$()}function Jx(e,t,r){return C(r)?ua(e,t,r.const):ze(r)?f(e):A(e,S(t),r)}function Xx(e,t,r){return C(r)?ua(e,t,r.const):Re(r)?f(e):A(e,S(t),r)}function Zx(e,t,r){return C(r)?ua(e,t,r.const):J(r)?f(e):A(e,S(t),r)}function Qx(e,t,r){return C(r)?ua(e,t,r.const):ge(r)?f(e):A(e,S(t),r)}function Yu(e,t,r){return i.IsBigInt(t.const)?Jx(e,t.const,r):i.IsBoolean(t.const)?Xx(e,t.const,r):i.IsNumber(t.const)?Zx(e,t.const,r):i.IsString(t.const)?Qx(e,t.const,r):H()}function Ju(e,t,r){return W(r)?A(e,t,r):f(e)}function Xu(e,t,r){return Vt(r)?f(e):A(e,t,r)}function Zu(e,t,r){return J(r)?f(e):A(e,t,r)}function eI(e,t,r){return ce(t)?ce(r)?f(e):$():f(e)}function tI(e,t,r){return W(r)&&ut(r.extends)?$():G(O(e,t,r),n=>eI(n,t,r),()=>$())}function rI(e,t){return e.reduce((r,n)=>n in t?rr(t[n])?{...r,...t[n].inferred}:H():H(),{})}function nI(e,t,r){let n={};for(let m of i.Keys(r))n[m]=m in t?tI({},t[m],r[m]):ce(r[m])?W(r[m])?f(p.Assign(e,{[r[m].name]:r[m].extends})):f(e):$();let a=i.Values(n).every(m=>rr(m)),s=a?rI(i.Keys(n),n):{};return a?f(s):$()}function aI(e,t,r){let n=nI(e,t,r);return rr(n)?f(p.Assign(e,n.inferred)):$()}function oI(e,t,r){return aI(e,t,r)}function iI(e,t){return i.Keys(t).reduce((r,n)=>({...r,[n]:i.HasPropertyKey(e,n)?h(r[n])?k([...r[n].anyOf,t[n]]):k([e[n],t[n]]):t[n]}),e)}function Qu(e,t,r,n){return i.ShiftLeft(t,(a,s)=>G(O({},e[a],r),m=>Qu(e,s,r,iI(n,m)),()=>$()),()=>f(n))}function sI(e,t,r,n){let a=i.Keys(t);return Qu(t,a,n,e)}function ec(e,t,r){return pe(r)?sI(e,t,Pe(r),he(r)):M(r)?oI(e,t,r.properties):A(e,v(t),r)}function mI(e,t){return i.IsEqual(i.Keys(t).length,0)?f(e):$()}function pI(e,t,r,n,a){return O(e,r,a)}function tc(e,t,r,n){return pe(n)?pI(e,Cn(t),r,Cn(Pe(n)),he(n)):M(n)?mI(e,n.properties):Y(n)?f(e):te(n)?f(e):$()}function rc(e,t,r){return ge(r)?f(e):A(e,t,r)}function nc(e,t,r){return ct(r)?f(e):A(e,t,r)}function ac(e,t,r){let n=xe(t);return O(e,n,r)}function mo(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Gr(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"name")&&i.HasPropertyKey(e,"type")&&i.IsEqual(e["~kind"],"Inferrable")&&i.IsString(e.name)&&i.IsObject(e.type)}function po(e){return ft(e)?W(e.items)?K(e.items.extends)?mo(e.items.name,e.items.extends.items):te(e.items.extends)?mo(e.items.name,e.items.extends):void 0:H():void 0}function ca(e){return W(e)?mo(e.name,e.extends):void 0}function uo(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>G(O({},n,t),()=>uo(a,t,[...r,n]),()=>{}),()=>r)}function oc(e,t,r,n){let a=uo(r,n);return i.IsArray(a)?f(p.Assign(e,{[t]:Z(a)})):$()}function la(e,t,r,n){let a=uo(r,n);return i.IsArray(a)?f(p.Assign(e,{[t]:k(a)})):$()}function uI(e){return[...e].reverse()}function co(e,t){return t?uI(e):e}function cI(e){let t=e.length>0?e[0]:void 0,r=ee(t)?po(t):void 0;return ee(r)}function lI(e,t,r,n,a,s){return G(O(e,r,a),m=>ic(m,t,n,s),()=>$())}function dI(e,t,r,n,a){let s=po(n);return Gr(s)?oc(e,s.name,co(r,t),s.type):i.ShiftLeft(r,(m,c)=>lI(e,t,m,c,n,a),()=>$())}function fI(e,t,r,n){return i.ShiftLeft(n,(a,s)=>dI(e,t,r,a,s),()=>i.IsEqual(r.length,0)?f(e):$())}function ic(e,t,r,n){return fI(e,t,r,n)}function gI(e,t,r){let n=xt(e,N([],[]),r),a=cI(n);return ic(e,a,co(t,a),co(n,a))}function sc(e,t,r){let n=ca(r);return Gr(n)?la(e,n.name,t,n.type):i.ShiftLeft(t,(a,s)=>G(O(e,a,r),m=>sc(m,s,r),()=>$()),()=>f(e))}function mc(e,t,r){let n=xt(e,N([],[]),t);return L(r)?gI(e,n,r.items):K(r)?sc(e,n,r.items):A(e,Z(n),r)}function pc(e,t,r){return Be(r)?f(e):Zt(r)?f(e):A(e,t,r)}function uc(e,t,r){return i.ShiftLeft(r,(n,a)=>G(O(e,t,n),s=>f(s),()=>uc(e,t,a)),()=>$())}function lo(e,t,r){return i.ShiftLeft(t,(n,a)=>G(uc(e,n,r),s=>lo(s,a,r),()=>$()),()=>f(e))}function cc(e,t,r){let n=ca(r);return Gr(n)?la(e,n.name,t,n.type):h(r)?lo(e,t,r.anyOf):lo(e,t,[r])}function lc(e,t,r){return W(r)?A(e,t,r):Y(r)?f(e):te(r)?f(e):$()}function dc(e,t,r){return Be(r)?f(e):A(e,t,r)}function O(e,t,r){return Y(t)?Nu(e,t,r):K(t)?Gu(e,t,t.items,r):ze(t)?Uu(e,t,r):Re(t)?Ku(e,t,r):re(t)?_u(e,t.parameters,t.instanceType,r):B(t)?zu(e,t.if,t.then,t.else,r):de(t)?Bu(e,t.enum,r):ne(t)?Vu(e,t.parameters,t.returnType,r):fe(t)?Wu(e,t,r):R(t)?Hu(e,t.allOf,r):C(t)?Yu(e,t,r):ut(t)?Ju(e,t,r):Vt(t)?Xu(e,t,r):J(t)?Zu(e,t,r):M(t)?ec(e,t.properties,r):pe(t)?tc(e,Pe(t),he(t),r):ge(t)?rc(e,t,r):ct(t)?nc(e,t,r):X(t)?ac(e,t.pattern,r):L(t)?mc(e,t.items,r):Zt(t)?pc(e,t,r):h(t)?cc(e,t.anyOf,r):te(t)?lc(e,t,r):Be(t)?dc(e,t,r):$()}function hI(e,t){return _([...e,v(t)])}function fo(e,t,r){return T(e)?p.Update(hI(e,t),{},r):Cr(e,t,r)}function fc(e,t,r,n,a){let s=Ee(e,t,r),m=Ur(e,t,n);return fo(s,m,a)}function Cr(e,t,r={}){return y("Interface",[e,t],r)}function nr(e){return ee(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function gc(e,t,r={}){return fo(e,t,r)}function yI(e,t,r){return e.includes(r)?!0:Kr([...e,r],t,t[r])}function hc(e,t,r){let n=yn(r);return Ft(e,t,n)}function Ft(e,t,r){return i.ShiftLeft(r,(n,a)=>Kr(e,t,n)?!0:Ft(e,t,a),()=>!1)}function Kr(e,t,r){return ae(r)?yI(e,t,r.$ref):K(r)?Kr(e,t,r.items):re(r)?Ft(e,t,[...r.parameters,r.instanceType]):ne(r)?Ft(e,t,[...r.parameters,r.returnType]):nr(r)?hc(e,t,r.parameters[1]):R(r)?Ft(e,t,r.allOf):M(r)?hc(e,t,r.properties):h(r)?Ft(e,t,r.anyOf):L(r)?Ft(e,t,r.items):pe(r)?Kr(e,t,he(r)):!1}function yc(e,t,r){return Kr(e,t,r)}function xI(e,t){return t.reduce((r,n)=>yc([n],e,e[n])?[...r,n]:r,[])}function xc(e){let t=hn(e);return xI(e,t)}function II(e,t,r){return r.includes(t)?r:t in e?_r(e,e[t],[...r,t]):H()}function Ic(e,t,r){let n=yn(t);return ar(e,n,r)}function ar(e,t,r){return t.reduce((n,a)=>_r(e,a,n),r)}function _r(e,t,r){return ae(t)?II(e,t.$ref,r):K(t)?_r(e,t.items,r):re(t)?ar(e,[...t.parameters,t.instanceType],r):ne(t)?ar(e,[...t.parameters,t.returnType],r):nr(t)?Ic(e,t.parameters[1],r):R(t)?ar(e,t.allOf,r):M(t)?Ic(e,t.properties,r):h(t)?ar(e,t.anyOf,r):L(t)?ar(e,t.items,r):pe(t)?_r(e,he(t),r):r}function bc(e,t,r){return _r(e,r,[t])}function bI(e){return _t()}function vI(e){return i.Keys(e).reduce((t,r)=>({...t,[r]:Dt(e[r])}),{})}function zr(e){return e.reduce((t,r)=>[...t,Dt(r)],[])}function Dt(e){return ae(e)?bI(e.$ref):K(e)?Te(Dt(e.items),gn(e)):re(e)?De(zr(e.parameters),Dt(e.instanceType)):ne(e)?Ne(zr(e.parameters),Dt(e.returnType)):R(e)?le(zr(e.allOf)):M(e)?v(vI(e.properties)):pe(e)?Mn(Jt(e),Dt(he(e))):h(e)?k(zr(e.anyOf)):L(e)?Z(zr(e.items)):e}function $I(e,t){return t in e?Dt(e[t]):oe()}function vc(e){return $I(e.$defs,e.$ref)}function TI(e,t,r){let n=Ee(e,N([],[]),t),a=Ur({},N([],[]),r);return _([...n,v(a)])}function kI(e,t){return i.Keys(e).filter(n=>t.includes(n)).reduce((n,a)=>{let s=e[a],m=nr(s)?TI(e,s.parameters[0],s.parameters[1]):s;return{...n,[a]:m}},{})}function $c(e,t,r){let n=bc(e,t,r),a=kI(e,n);return Ue(a,t)}function Tc(e,t){return t in e?ae(e[t])?Tc(e,e[t].$ref):e[t]:q()}function Ve(e,t){return Tc(e,t)}function kc(e){return se(e)?vc(e):xn(e)?oe():e}function me(e,t,r){let n=kc(t),a=kc(r);return O(e,n,a)}var wr="equal",EI="disjoint",Rr="left-inside",Sr="right-inside";function Ht(e,t){let r=[te(e)?b.ExtendsFalse():me({},e,t),te(e)?b.ExtendsTrue({}):me({},t,e)];return b.IsExtendsTrueLike(r[0])&&b.IsExtendsTrueLike(r[1])?wr:b.IsExtendsTrueLike(r[0])&&b.IsExtendsFalse(r[1])?Rr:b.IsExtendsFalse(r[0])&&b.IsExtendsTrueLike(r[1])?Sr:EI}function wI(e,t){return t.filter(r=>Ht(e,r)!==Sr)}function RI(e,t){let r=t.some(n=>{let a=Ht(e,n);return i.IsEqual(a,Rr)||i.IsEqual(a,wr)});return i.IsEqual(r,!1)}function SI(e,t){let r=Oe(e);return Y(r)?[r]:RI(r,t)?[...wI(r,t),r]:t}function OI(e){return e.reduce((t,r)=>M(r)?[...t,r]:ut(r)?t:SI(r,t),[])}function Ba(e){let t=OI(e);return Pr(t)}function go(e,t){return p.Update(Oe(e),{},t)}function Ec(e,t,r,n){let a=d(e,t,r);return go(a,n)}function Br(e,t=[]){return mt(e)&&i.IsEqual(e.action,"Conditional")?ae(e.parameters[0])?Br(e.parameters[2],Br(e.parameters[3],[...t,e.parameters[0].$ref])):Br(e.parameters[2],Br(e.parameters[3],t)):mt(e)&&i.IsEqual(e.action,"Mapped")&&mt(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&ae(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function PI(e,t){return e.reduce((r,n)=>[...r,t.includes(n.name)],[])}function Sc(e,t,r=[]){return i.ShiftLeft(e,(n,a)=>i.ShiftLeft(t,(s,m)=>Sc(a,m,[...r,[s,n]]),()=>r),()=>r)}function MI(e){return h(e)?[...e.anyOf]:[e]}function CI(e,t){return e.reduce((r,n)=>[...r,[...n,t]],[])}function wc(e,t){return t.reduce((r,n)=>[...r,...CI(e,n)],[])}function Rc(e){return e.reduce((t,r)=>i.IsEqual(r[0],!0)?wc(t,MI(r[1])):wc(t,[r[1]]),[[]])}function Oc(e,t,r){let n=Br(r),a=PI(e,n),s=Sc(t,a);return mt(r)&&i.IsEqual(r.action,"Conditional")||mt(r)&&i.IsEqual(r.action,"Mapped")?Rc(s):[t]}function AI(){return["(not-resolvable)",q()]}function qI(){return["(not-generic)",q()]}function LI(e,t,r){return[e,pt(t,r)]}function jI(e,t,r){return t in e?Pc(e,t,e[t],r):AI()}function Pc(e,t,r,n){return Kt(r)?LI(t,r.parameters,r.expression):ae(r)?jI(e,r.$ref,n):qI()}function Mc(e,t,r){return Pc(e,"(anonymous)",t,r)}function FI(e,t,r){if(W(t)||or(t)||b.IsExtendsTrueLike(me({},t,r)))return;let n={parameter:e,expect:r,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:n})}function Cc(e,t,r,n,a){let s=d(e,t,a);return FI(r,s,n),p.Assign(e,{[r]:s})}function DI(e,t,r,n,a){let s=d(e,t,r.extends),m=d(e,t,r.equals);return i.ShiftLeft(a,(c,l)=>ho(Cc(e,t,r.name,s,c),t,n,l),()=>ho(Cc(e,t,r.name,s,m),t,n,[]))}function ho(e,t,r,n){return i.ShiftLeft(r,(a,s)=>DI(e,t,a,s,n),()=>e)}function Ac(e,t,r,n){return ho(e,t,r,n)}function NI(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function GI(e,t){return i.IsEqual(NI(e),t)}function UI(e,t,r,n,a,s){let m=Ac(e,t,n,s),c=d(m,N([...t.callstack,r.$ref],t.visited),a);return d(m,N([],[]),c)}function KI(e,t,r,n,a,s){return s.reduce((m,c)=>[...m,UI(e,t,r,n,a,c)],[])}function _I(e,t,r,n,a,s){let m=Oc(n,s,a),c=KI(e,t,r,n,a,m);return i.IsEqual(c.length,1)?c[0]:ve(c)}function da(e,t,r,n){let a=Ee(e,t,n),s=Mc(e,r,n),m=s[0],c=s[1];return Kt(c)?GI(t,m)?Ar(et(m),a):_I(e,t,et(m),c.parameters,c.expression,a):Ar(r,a)}function Ar(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function qc(e,t){return da({},N([],[]),e,t)}function or(e){return g(e,"Call")}function zI(e){return p.Discard(e,["~immutable"])}function Lc(e,t){return p.Update(zI(e),{},t)}function jc(e,t,r,n){let a=d(e,t,r);return Lc(a,n)}function Fc(e,t){return e(t)}function Dc(e,t){return i.IsString(t)?S(Fc(e,t)):S(t)}function Nc(e,t){let r=xe(t);return nt(e,r)}function Gc(e,t){let r=t.map(n=>nt(e,n));return k(r)}function nt(e,t){return C(t)?Dc(e,t.const):X(t)?Nc(e,t.pattern):h(t)?Gc(e,t.anyOf):t}function Fn(e,t={}){return y("Capitalize",[e],t)}function Uc(e,t={}){return yo(e,t)}function Dn(e,t={}){return y("Lowercase",[e],t)}function Kc(e,t={}){return xo(e,t)}function Nn(e,t={}){return y("Uncapitalize",[e],t)}function _c(e,t={}){return Io(e,t)}function Gn(e,t={}){return y("Uppercase",[e],t)}function zc(e,t={}){return bo(e,t)}var BI=e=>e[0].toUpperCase()+e.slice(1),VI=e=>e.toLowerCase(),WI=e=>e[0].toLowerCase()+e.slice(1),HI=e=>e.toUpperCase();function yo(e,t){return T([e])?p.Update(nt(BI,e),{},t):Fn(e,t)}function xo(e,t){return T([e])?p.Update(nt(VI,e),{},t):Dn(e,t)}function Io(e,t){return T([e])?p.Update(nt(WI,e),{},t):Nn(e,t)}function bo(e,t){return T([e])?p.Update(nt(HI,e),{},t):Gn(e,t)}function Bc(e,t,r,n){let a=d(e,t,r);return yo(a,n)}function Vc(e,t,r,n){let a=d(e,t,r);return xo(a,n)}function Wc(e,t,r,n){let a=d(e,t,r);return Io(a,n)}function Hc(e,t,r,n){let a=d(e,t,r);return bo(a,n)}function Un(e,t,r,n,a={}){return y("Conditional",[e,t,r,n],a)}function Yc(e,t,r,n,a={}){return vo({},N([],[]),e,t,r,n,a)}function YI(e,t,r,n,a,s){let m=me(e,r,n);return b.IsExtendsUnion(m)?k([d(m.inferred,t,a),d(e,t,s)]):b.IsExtendsTrue(m)?d(m.inferred,t,a):d(e,t,s)}function vo(e,t,r,n,a,s,m){return T([r,n])?p.Update(YI(e,t,r,n,a,s),{},m):Un(r,n,a,s,m)}function Jc(e,t,r,n,a,s,m){let c=d(e,t,r),l=d(e,t,n);return vo(e,t,c,l,a,s,m)}function Kn(e,t={}){return y("ConstructorParameters",[e],t)}function Xc(e,t={}){return $o(e,t)}function JI(e){let t=re(e)?e.parameters:[],r=xt({},N([],[]),t);return Z(r)}function $o(e,t){return T([e])?p.Update(JI(e),{},t):Kn(e,t)}function Zc(e,t,r,n){let a=d(e,t,r);return $o(a,n)}function _n(e,t,r={}){return y("Exclude",[e,t],r)}function Qc(e,t,r={}){return Vr(e,t,r)}function Vr(e,t,r){return T([e,t])?p.Update(On(e,t),{},r):_n(e,t,r)}function el(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Vr(s,m,a)}function zn(e,t,r={}){return y("Extract",[e,t],r)}function tl(e,t,r={}){return To(e,t,r)}function XI(e,t){let r=me({},e,t);return b.IsExtendsTrueLike(r)?[e]:[]}function ZI(e,t){return e.reduce((r,n)=>[...r,...XI(n,t)],[])}function rl(e,t){let r=Oe(e),n=h(r)?r.anyOf:[r],a=ZI(n,t);return ve(a)}function To(e,t,r){return T([e,t])?p.Update(rl(e,t),{},r):zn(e,t,r)}function nl(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return To(s,m,a)}function QI(e){return e.reduce((t,r)=>Tn(r)?[...t,S(r)]:t,[])}function ir(e){let t=QI(e);return k(t)}function qr(e,t,r={}){return y("Index",[e,t],r)}function al(e,t,r={}){let n=i.IsArray(t)?ir(t):t;return ko(e,n,r)}function ol(e,t){let r=Ve(e,t);return we(r)}function il(e,t,r){let n=Le(e,t,r);return we(n)}function eb(e,t){let r=i.Keys(e).filter(x=>!i.HasPropertyKey(t,x)),n=i.Keys(t).filter(x=>!i.HasPropertyKey(e,x)),a=i.Keys(e).filter(x=>i.HasPropertyKey(t,x)),s=r.reduce((x,j)=>({...x,[j]:e[j]}),{}),m=n.reduce((x,j)=>({...x,[j]:t[j]}),{}),c=a.reduce((x,j)=>({...x,[j]:_([e[j],t[j]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function sl(e){return e.reduce((t,r)=>eb(t,we(r)),{})}function ml(e){let t=ds(Z(e));return we(t)}function tb(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:ve([e[s],t[s]])}),{})}function pl(e,t){return i.ShiftLeft(e,(r,n)=>pl(n,tb(t,we(r))),()=>t)}function ul(e){return i.ShiftLeft(e,(t,r)=>pl(r,we(t)),()=>H())}function we(e){return se(e)?ol(e.$defs,e.$ref):B(e)?il(e.if,e.then,e.else):R(e)?sl(e.allOf):h(e)?ul(e.anyOf):L(e)?ml(e.items):M(e)?e.properties:{}}function sr(e){let t=we(e);return v(t)}var rb=new RegExp("^(?:0|[1-9][0-9]*)$");function mr(e){let t=`${e}`;return rb.test(t)?parseInt(t):e}function nb(e){return S(mr(e))}function cl(e){return e.map(t=>ll(t))}function ll(e){return R(e)?le(cl(e.allOf)):h(e)?k(cl(e.anyOf)):C(e)?nb(e.const):e}function dl(e,t){let r=ll(t),n=me({},r,be());return b.IsExtendsTrueLike(n)?e:C(t)&&i.IsEqual(t.const,"length")?be():q()}function fl(e,t){let r=Ve(e,t);return $e(r)}function gl(e,t,r){let n=Le(e,t,r);return $e(n)}function hl(e){let t=ke(e);return $e(t)}function yl(e){let t=_(e);return $e(t)}function xl(e){return[`${e}`]}function Il(e){let t=xe(e);return $e(t)}function bl(e){return e.reduce((t,r)=>[...t,...$e(r)],[])}function $e(e){return se(e)?fl(e.$defs,e.$ref):B(e)?gl(e.if,e.then,e.else):de(e)?hl(e.enum):R(e)?yl(e.allOf):C(e)?xl(e.const):X(e)?Il(e.pattern):h(e)?bl(e.anyOf):[]}function pr(e){return $e(e)}function Wr(e,t){return t.map(r=>Hr(e,r))}function Hr(e,t){return K(t)?Te(Hr(e,t.items)):re(t)?De(Wr(e,t.parameters),Hr(e,t.instanceType)):ne(t)?Ne(Wr(e,t.parameters),Hr(e,t.returnType)):L(t)?Z(Wr(e,t.items)):h(t)?k(Wr(e,t.anyOf)):R(t)?le(Wr(e,t.allOf)):qn(t)?v(e):t}function vl(e,t){return Hr(e,t)}function ab(e,t){let r=t in e?e[t]:q();return vl(e,r)}function $l(e,t){return t.reduce((r,n)=>[...r,ab(e,n)],[])}function ob(e,t){let r=pr(t),n=$l(e,r);return ve(n)}var ib=new RegExp(dt);function sb(e){return e.filter(r=>ib.test(r))}function mb(e){let t=hn(e),r=sb(t),n=$l(e,r);return ve(n)}function Tl(e,t){return J(t)?mb(e):ob(e,t)}function pb(e){return S(mr(e))}function kl(e){return e.map(t=>Eo(t))}function Eo(e){return R(e)?le(kl(e.allOf)):h(e)?k(kl(e.anyOf)):C(e)?pb(e.const):e}function ub(e,t){return e.reduceRight((r,n,a)=>{let s=me({},S(a),t);return b.IsExtendsTrueLike(s)?[n,...r]:r},[])}function cb(e,t){let r=Eo(t),n=ub(e,r);return tt(n)}function lb(e){return tt(e)}function El(e,t){return C(t)&&i.IsEqual(t.const,"length")?S(e.length):J(t)||fe(t)?lb(e):cb(e,t)}function wl(e,t){return K(e)?dl(e.items,t):M(e)?Tl(e.properties,t):L(e)?El(e.items,t):q()}function db(e){return se(e)||B(e)||R(e)||h(e)?sr(e):e}function ko(e,t,r){return T([e,t])?p.Update(wl(db(e),t),{},r):qr(e,t,r)}function Rl(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return ko(s,m,a)}function Bn(e,t={}){return y("InstanceType",[e],t)}function Sl(e,t={}){return wo(e,t)}function fb(e){return re(e)?e.instanceType:q()}function wo(e,t){return T([e])?p.Update(fb(e),{},t):Bn(e,t)}function Ol(e,t,r,n={}){let a=d(e,t,r);return wo(a,n)}function Lr(e,t={}){return y("KeyOf",[e],t)}function Pl(e,t={}){return Ro(e,t)}function Ml(){return k([be(),Se(),Wt()])}function Cl(e){return be()}function gb(e){return e.reduce((r,n)=>Tn(n)?[...r,S(mr(n))]:H(),[])}function Al(e){let t=i.Keys(e),r=gb(t);return tt(r)}function ql(e){return Jt(e)}function Ll(e){let t=e.map((r,n)=>S(n));return tt(t)}function jl(e){return Y(e)?Ml():K(e)?Cl(e.items):M(e)?Al(e.properties):pe(e)?ql(e):L(e)?Ll(e.items):q()}function hb(e){return se(e)||B(e)||R(e)||h(e)?sr(e):e}function Ro(e,t){return T([e])?p.Update(jl(hb(e)),{},t):Lr(e,t)}function Fl(e,t,r,n){let a=d(e,t,r);return Ro(a,n)}function Mr(e,t,r,n,a={}){return y("Mapped",[e,t,r,n],a)}function Dl(e,t,r,n,a={}){return So({},N([],[]),e,t,r,n,a)}function yb(e){let t=xe(e);return fa(t)}function xb(e){return e.reduce((t,r)=>[...t,...fa(r)],[])}function Ib(e){let t=ke(e);return fa(t)}function bb(e){return i.IsNumber(e)?[S(`${e}`)]:[S(e)]}function fa(e){return de(e)?Ib(e.enum):C(e)?bb(e.const):X(e)?yb(e.pattern):h(e)?xb(e.anyOf):[e]}function Nl(e){return fa(e)}function vb(e){return X(e)?xe(e.pattern):e}function $b(e,t,r,n,a,s){let m=p.Assign(e,{[r.name]:n}),c=d(m,t,a),l=vb(c),I=d(m,t,s);return Wi(l)||Hi(l)?{[l.const]:I}:{}}function Tb(e,t,r,n,a,s){return n.reduce((m,c)=>[...m,$b(e,t,r,c,a,s)],[])}function kb(e){return e.reduce((t,r)=>[...t,v(r)],[])}function Gl(e,t,r,n,a,s){let m=Nl(n),c=Tb(e,t,r,m,a,s),l=kb(c);return _(l)}function So(e,t,r,n,a,s,m){return T([n])?p.Update(Gl(e,t,r,n,a,s),{},m):Mr(r,n,a,s,m)}function Ul(e,t,r,n,a,s,m){let c=d(e,t,n);return So(e,t,r,c,a,s,m)}function Eb(e,t,r){let n=p.Assign(e,t);return i.Keys(t).filter(s=>r.includes(s)).reduce((s,m)=>({...s,[m]:$c(n,m,t[m])}),{})}function wb(e,t,r){let n=p.Assign(e,t);return i.Keys(t).filter(s=>!r.includes(s)).reduce((s,m)=>({...s,[m]:d(n,N([],[]),t[m])}),{})}function Rb(e,t,r){let n=xc(t),a=Eb(e,t,n),s=wb(e,t,n),m={...a,...s};return p.Update(m,{},r)}function ga(e,t,r,n){return Rb(e,r,n)}function Vn(e,t={}){return y("NonNullable",[e],t)}function Kl(e,t={}){return Oo(e,t)}function Sb(e){let t=k([Bt(),Xt()]);return Vr(e,t,{})}function Oo(e,t){return T([e])?p.Update(Sb(e),{},t):Vn(e,t)}function _l(e,t,r,n){let a=d(e,t,r);return Oo(a,n)}function Wn(e,t,r={}){return y("Omit",[e,t],r)}function zl(e,t,r={}){let n=i.IsArray(t)?ir(t):t;return Po(e,n,r)}function ha(e){let t=sr(e);return M(t)?t.properties:H()}function Ob(e,t){return i.Keys(e).reduce((n,a)=>t.includes(a)?n:{...n,[a]:e[a]},{})}function Bl(e,t){let r=ha(e),n=pr(t),a=Ob(r,n);return v(a)}function Po(e,t,r){return T([e,t])?p.Update(Bl(e,t),{},r):Wn(e,t,r)}function Vl(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Po(s,m,a)}function Hn(e,t={}){return y("Parameters",[e],t)}function Wl(e,t={}){return Mo(e,t)}function Pb(e){let t=ne(e)?e.parameters:[],r=xt({},N([],[]),t);return Z(r)}function Mo(e,t){return T([e])?p.Update(Pb(e),{},t):Hn(e,t)}function Hl(e,t,r,n){let a=d(e,t,r);return Mo(a,n)}function Yn(e,t={}){return y("Partial",[e],t)}function Yl(e,t={}){return Co(e,t)}function Jl(e,t){let r=Ve(e,t),n=We(r);return Ue(p.Assign(e,{[t]:n}),t)}function Xl(e,t,r){let n=Le(e,t,r);return We(n)}function Zl(e){let t=_(e);return We(t)}function Ql(e){let t=e.map(r=>We(r));return k(t)}function ed(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:St(e[a])}),{});return v(t)}function We(e){return se(e)?Jl(e.$defs,e.$ref):B(e)?Xl(e.if,e.then,e.else):R(e)?Zl(e.allOf):h(e)?Ql(e.anyOf):M(e)?ed(e.properties):v({})}function Co(e,t){return T([e])?p.Update(We(e),{},t):Yn(e,t)}function td(e,t,r,n){let a=d(e,t,r);return Co(a,n)}function Jn(e,t,r={}){return y("Pick",[e,t],r)}function rd(e,t,r={}){let n=i.IsArray(t)?ir(t):t;return Ao(e,n,r)}function Mb(e,t){return i.Keys(e).reduce((n,a)=>t.includes(a)?p.Assign(n,{[a]:e[a]}):n,{})}function nd(e,t){let r=ha(e),n=pr(t),a=Mb(r,n);return v(a)}function Ao(e,t,r){return T([e,t])?p.Update(nd(e,t),{},r):Jn(e,t,r)}function ad(e,t,r,n,a){let s=d(e,t,r),m=d(e,t,n);return Ao(s,m,a)}function Xn(e,t={}){return y("ReadonlyObject",[e],t)}function qo(e,t={}){return Lo(e,t)}var od=qo;function id(e){return zt(Te(e))}function sd(e,t){let r=Ve(e,t),n=He(r);return Ue(p.Assign(e,{[t]:n}),t)}function md(e,t,r){let n=Le(e,t,r);return He(n)}function pd(e){let t=_(e);return He(t)}function ud(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:Mt(e[a])}),{});return v(t)}function cd(e){return zt(Z(e))}function ld(e){let t=e.map(r=>He(r));return k(t)}function He(e){return K(e)?id(e.items):se(e)?sd(e.$defs,e.$ref):B(e)?md(e.if,e.then,e.else):R(e)?pd(e.allOf):M(e)?ud(e.properties):L(e)?cd(e.items):h(e)?ld(e.anyOf):e}function Lo(e,t){return T([e])?p.Update(He(e),{},t):Xn(e)}function dd(e,t,r,n){let a=d(e,t,r);return Lo(a,n)}function fd(e,t,r,n){return t.visited.includes(n)?r:n in e?d(e,N(t.callstack,[...t.visited,n]),e[n]):r}function gd(e,t){let r=Ve(e,t),n=Ye(r);return Ue(p.Assign(e,{[t]:n}),t)}function hd(e,t,r){let n=Le(e,t,r);return Ye(n)}function yd(e){let t=_(e);return Ye(t)}function xd(e){let t=e.map(r=>Ye(r));return k(t)}function Id(e){let t=i.Keys(e).reduce((n,a)=>({...n,[a]:Sn(e[a])}),{});return v(t)}function Ye(e){return se(e)?gd(e.$defs,e.$ref):B(e)?hd(e.if,e.then,e.else):R(e)?yd(e.allOf):h(e)?xd(e.anyOf):M(e)?Id(e.properties):v({})}function Zn(e,t={}){return y("Required",[e],t)}function bd(e,t={}){return jo(e,t)}function jo(e,t){return T([e])?p.Update(Ye(e),{},t):Zn(e,t)}function vd(e,t,r,n){let a=d(e,t,r);return jo(a,n)}function Qn(e,t={}){return y("ReturnType",[e],t)}function $d(e,t={}){return Fo(e,t)}function Cb(e){return ne(e)?e.returnType:q()}function Fo(e,t){return T([e])?p.Update(Cb(e),{},t):Qn(e,t)}function Td(e,t,r,n={}){let a=d(e,t,r);return Fo(a,n)}function ea(e,t){return y("With",[e,t],{})}function kd(e,t){return Do(e,t)}function Do(e,t){return T([e])?p.Update(e,{},t):ea(e,t)}function Ed(e,t,r,n){let a=d(e,t,r);return Do(a,n)}function Ab(e){return ft(e)?L(e.items)?No(e.items.items):W(e.items)?[e]:ae(e.items)?[e]:[q()]:[e]}function No(e){return e.reduce((r,n)=>[...r,...Ab(n)],[])}function N(e,t){return{callstack:e,visited:t}}function T(e){return i.ShiftLeft(e,(t,r)=>ae(t)?!1:T(r),()=>!0)}function Ur(e,t,r){return i.Keys(r).reduce((n,a)=>({...n,[a]:d(e,t,r[a])}),{})}function xt(e,t,r){let n=Ee(e,t,r);return No(n)}function Ee(e,t,r){return r.map(n=>d(e,t,n))}function qb(e,t){let r=ce(e)?Ir(t,{}):t,n=Ct(e)?xr(r,{}):r;return Pt(e)?Yr(n,{}):n}function Lb(e,t,r,n,a){return i.IsEqual(r,"AddImmutable")?wd(e,t,n[0],a):i.IsEqual(r,"RemoveImmutable")?jc(e,t,n[0],a):i.IsEqual(r,"AddReadonly")?$i(e,t,n[0],a):i.IsEqual(r,"RemoveReadonly")?ms(e,t,n[0],a):i.IsEqual(r,"AddOptional")?Ti(e,t,n[0],a):i.IsEqual(r,"RemoveOptional")?cs(e,t,n[0],a):i.IsEqual(r,"Capitalize")?Bc(e,t,n[0],a):i.IsEqual(r,"Conditional")?Jc(e,t,n[0],n[1],n[2],n[3],a):i.IsEqual(r,"ConstructorParameters")?Zc(e,t,n[0],a):i.IsEqual(r,"Evaluate")?Ec(e,t,n[0],a):i.IsEqual(r,"Exclude")?el(e,t,n[0],n[1],a):i.IsEqual(r,"Extract")?nl(e,t,n[0],n[1],a):i.IsEqual(r,"Index")?Rl(e,t,n[0],n[1],a):i.IsEqual(r,"InstanceType")?Ol(e,t,n[0],a):i.IsEqual(r,"Interface")?fc(e,t,n[0],n[1],a):i.IsEqual(r,"KeyOf")?Fl(e,t,n[0],a):i.IsEqual(r,"Lowercase")?Vc(e,t,n[0],a):i.IsEqual(r,"Mapped")?Ul(e,t,n[0],n[1],n[2],n[3],a):i.IsEqual(r,"Module")?ga(e,t,n[0],a):i.IsEqual(r,"NonNullable")?_l(e,t,n[0],a):i.IsEqual(r,"Pick")?ad(e,t,n[0],n[1],a):i.IsEqual(r,"Parameters")?Hl(e,t,n[0],a):i.IsEqual(r,"Partial")?td(e,t,n[0],a):i.IsEqual(r,"Omit")?Vl(e,t,n[0],n[1],a):i.IsEqual(r,"ReadonlyObject")?dd(e,t,n[0],a):i.IsEqual(r,"Record")?Ss(e,t,n[0],n[1],a):i.IsEqual(r,"Required")?vd(e,t,n[0],a):i.IsEqual(r,"ReturnType")?Td(e,t,n[0],a):i.IsEqual(r,"TemplateLiteral")?Cu(e,t,n[0],a):i.IsEqual(r,"Uncapitalize")?Wc(e,t,n[0],a):i.IsEqual(r,"Uppercase")?Hc(e,t,n[0],a):i.IsEqual(r,"With")?Ed(e,t,n[0],n[1]):y(r,n,a)}function jb(e,t,r){let n=ae(r)?fd(e,t,r,r.$ref):K(r)?Te(d(e,t,r.items),gn(r)):or(r)?da(e,t,r.target,r.arguments):re(r)?De(Ee(e,t,r.parameters),d(e,t,r.instanceType),ki(r)):ne(r)?Ne(Ee(e,t,r.parameters),d(e,t,r.returnType),Ei(r)):B(r)?Ot(d(e,t,r.if),d(e,t,r.then),d(e,t,r.else),Mi(r)):R(r)?le(Ee(e,t,r.allOf),ji(r)):M(r)?v(Ur(e,t,r.properties),Oi(r)):pe(r)?Os(Pe(r),d(e,t,he(r))):ft(r)?Lt(d(e,t,r.items)):L(r)?Z(xt(e,t,r.items),ss(r)):h(r)?k(Ee(e,t,r.anyOf),Ji(r)):r;return qb(r,n)}function d(e,t,r){return mt(r)?Lb(e,t,r.action,r.parameters,r.options):jb(e,t,r)}function Go(e,t){return d(e,N([],[]),t)}function Fb(e){return p.Update(e,{"~immutable":!0},{})}function Yr(e,t){return p.Update(Fb(e),{},t)}function wd(e,t,r,n){let a=d(e,t,r);return Yr(a,n)}function Pp(e,t={}){return y("AddImmutable",[e],t)}function zt(e,t={}){return Yr(e,t)}function Mp(e,t={}){return y("Evaluate",[e],t)}function Rd(e,t={}){return go(e,t)}function Cp(e,t={}){return y("Module",[e],t)}function Sd(e,t={}){return ga({},N([],[]),e,t)}function Od(...e){let[t,r,n]=Ke.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=Ru(r),s=i.IsArray(a)&&i.IsEqual(a.length,2)?d(t,N([],[]),a[0]):q();return p.Update(s,{},n)}var D={};kt(D,{Any:()=>_t,Array:()=>Te,BigInt:()=>Tr,Boolean:()=>vn,Call:()=>qc,Capitalize:()=>Uc,Codec:()=>bn,Conditional:()=>Yc,Constructor:()=>De,ConstructorParameters:()=>Xc,Cyclic:()=>Ue,Decode:()=>Gi,DecodeBuilder:()=>$r,Dependent:()=>Ot,Encode:()=>Ui,EncodeBuilder:()=>vr,Enum:()=>Li,Evaluate:()=>Rd,Exclude:()=>Qc,Extends:()=>me,ExtendsResult:()=>b,Extract:()=>tl,Function:()=>Ne,Generic:()=>pt,Identifier:()=>kr,Immutable:()=>Ki,Index:()=>al,Infer:()=>br,InstanceType:()=>Sl,Instantiate:()=>Go,Integer:()=>At,Interface:()=>gc,Intersect:()=>le,IsAny:()=>Y,IsArray:()=>K,IsBigInt:()=>ze,IsBoolean:()=>Re,IsCall:()=>or,IsCodec:()=>In,IsConstructor:()=>re,IsCyclic:()=>se,IsDependent:()=>B,IsEnum:()=>de,IsEnumValue:()=>qi,IsFunction:()=>ne,IsGeneric:()=>Kt,IsIdentifier:()=>Vi,IsImmutable:()=>Pt,IsInfer:()=>W,IsInteger:()=>fe,IsIntersect:()=>R,IsKind:()=>g,IsLiteral:()=>C,IsNever:()=>ut,IsNull:()=>Vt,IsNumber:()=>J,IsObject:()=>M,IsOptional:()=>ce,IsParameter:()=>Yi,IsReadonly:()=>Ct,IsRecord:()=>pe,IsRef:()=>ae,IsRefine:()=>Na,IsRest:()=>ft,IsSchema:()=>ee,IsString:()=>ge,IsSymbol:()=>ct,IsTemplateLiteral:()=>X,IsThis:()=>qn,IsTuple:()=>L,IsUndefined:()=>Zt,IsUnion:()=>h,IsUnknown:()=>te,IsUnsafe:()=>xn,IsVoid:()=>Be,KeyOf:()=>Pl,Literal:()=>S,Lowercase:()=>Kc,Mapped:()=>Dl,Module:()=>Sd,Never:()=>q,NonNullable:()=>Kl,Null:()=>Bt,Number:()=>be,Object:()=>v,Omit:()=>zl,Optional:()=>Ri,Parameter:()=>qt,Parameters:()=>Wl,Partial:()=>Yl,Pick:()=>rd,Readonly:()=>_i,ReadonlyObject:()=>qo,ReadonlyType:()=>od,Record:()=>Mn,RecordKey:()=>Jt,RecordPattern:()=>Pe,RecordValue:()=>he,Ref:()=>et,Refine:()=>zi,Required:()=>bd,Rest:()=>Lt,ReturnType:()=>$d,Script:()=>Od,String:()=>Se,Symbol:()=>Wt,TemplateLiteral:()=>qu,This:()=>An,Tuple:()=>Z,Uncapitalize:()=>_c,Undefined:()=>Xt,Union:()=>k,Unknown:()=>oe,Unsafe:()=>Pi,Uppercase:()=>zc,Void:()=>Ln,With:()=>kd});var ur="submit_test_gap_candidates",Jr="submit_filtered_test_gaps",Xr="submit_solver_gaps",r4=D.Object({verdict:D.Union([D.Literal("PASS"),D.Literal("FAIL")],{description:"FAIL only for a genuine blocking issue (clear rubric violation, agent-fault-worthy gap, unfair/undiscoverable test requirement, or a real determinism/regression risk). Optional, minor, or stylistic points are NOT grounds for FAIL \u2014 put those in `notes` instead and use PASS."}),summary:D.String({description:"One short sentence summarizing the verdict."}),reasons:D.Array(D.String(),{description:"Specific BLOCKING justifications only, citing rubric item IDs and concrete evidence from the files you read. Required (non-empty) when verdict is FAIL. Use an empty array when verdict is PASS."}),notes:D.Array(D.String(),{description:"Non-blocking, optional/minor observations or suggested improvements \u2014 the kind of feedback a real reviewer leaves as 'Minor/optional' without failing the task. Include these regardless of verdict; use an empty array if you truly have none."})});var Db=D.Object({gaps:D.Array(D.Object({description:D.String({description:"The specific untested behavior or edge case, in plain terms. Prefix with POSITIVE: or NEGATIVE: to indicate whether this is a missing required-behavior test or a missing forbidden/wrong-behavior test."}),risk:D.String({description:"Concretely why a plausible-but-incorrect implementation could still pass every test in test.patch despite missing, misimplementing, or violating this behavior (including doing a forbidden thing because no test asserts it must not happen)."})}),{description:"Candidate behavioral test gaps (positive and negative) grounded in agent_prompt.md or clear existing repo behavior. Use an empty array if you found none \u2014 do not manufacture gaps just to report something."})});function Pd(e){return{name:ur,label:"Submit Candidate Test Gaps",description:"Submit your candidate list of behavioral test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished reading and analyzing the relevant files.",parameters:Db,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Recorded ${n.length} candidate gap(s)`}],details:void 0}}}}var Nb=D.Object({gaps:D.Array(D.Object({description:D.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:D.String({description:"Why this is genuinely grounded in agent_prompt.md or the repo, fair to test per the fairness methodology, and a real (non-duplicate) coverage hole in test.patch \u2014 for negative gaps, cite the prompt's prohibition/constraint and why no existing test catches the forbidden outcome."})}),{description:"The filtered, final list of confirmed test gaps. Use an empty array if none of the candidates survive strict scrutiny."})});function Md(e){return{name:Jr,label:"Submit Filtered Test Gaps",description:"Submit your final, strictly filtered list of confirmed test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have independently verified each candidate.",parameters:Nb,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Confirmed ${n.length} gap(s) after filtering`}],details:void 0}}}}var Gb=D.Object({gaps:D.Array(D.Object({description:D.String({description:"The specific behavioral gap: a way one or more solver's diff differs materially from what agent_prompt.md/solution.patch require, despite that solver passing `./test.sh new`."}),justification:D.String({description:"Why this is a genuine requirement from agent_prompt.md or solution.patch (cite the specific requirement/line) that the solver's diff misses, contradicts, or diverges from \u2014 and why the current tests fail to catch that divergence."}),evidence:D.String({description:"Which solver(s) (by index) exhibit this, and the specific part of their diff that grounds the gap."})}),{description:"Concrete, diff-grounded behavioral gaps \u2014 cases where a passing solver's materially different approach reveals that `test.sh new` under-specifies a real requirement. Use an empty array if the solvers converged on equivalent behavior; do not manufacture gaps just to report something."})});function Cd(e){return{name:Xr,label:"Submit Solver Gaps",description:"Submit your final list of behavioral gaps found by comparing the solver diffs against the real solution.patch. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished comparing every solver.",parameters:Gb,async execute(t,r){let n=r.gaps??[];return e.gaps=n,{content:[{type:"text",text:`Recorded ${n.length} solver gap(s)`}],details:void 0}}}}function Ad(e){return[e,"You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the task description given to a coding agent), `test.patch` (a unified diff adding the hidden tests that will grade that agent's solution), and `solution.patch` (a unified diff of one golden/reference solution).","Another specialized agent is searching the complementary direction in parallel \u2014 stay in your lane and do not duplicate its work."]}var qd=["Thoroughness \u2014 your job is high recall on genuine gaps only:","- Find every gap you can justify with concrete evidence. Do not stop after the first obvious ones \u2014 keep reading until you have systematically covered the prompt, `solution.patch`, and relevant repo context.","- After your first pass, run at least one deliberate second sweep (re-read `agent_prompt.md`, re-scan `solution.patch`, grep the repo) before submitting \u2014 but if that sweep still finds nothing, submit an empty list.","- Do not self-censor or merge distinct genuine gaps into one \u2014 the validator will prune. Never invent or pad the list to seem thorough; an empty array is correct when exhaustive analysis truly finds none.","- Hunt subtle gaps too: partial coverage (asserted once but not under other valid inputs), behaviors implied by repo convention, interaction effects, ordering/timing, and branches visible in `solution.patch` that no test forces.","- Include a candidate only when you can cite specific grounding and a concrete false-pass risk \u2014 not to meet a quota."],Uo=["Ground rules \u2014 do not overreach:","- Every gap must trace back to a specific requirement or sentence in `agent_prompt.md`, or to behavior that is unambiguous from the existing, visible repo. Do not invent requirements the prompt doesn't support.","- Do not propose gaps for things `agent_prompt.md` leaves intentionally open, or for implementation details/style the prompt doesn't mandate.","- Read `test.patch` carefully before deciding something is untested \u2014 do not propose a gap that an existing test already covers (even indirectly).","- Keep findings strictly behavioral and publicly observable: a user, caller, or documented public contract must be able to observe the required outcome. Do not report internal helper calls, private state, implementation structure, call order, file placement, or other incidental mechanics.","- Do not require DOM classes, DOM/data/test attributes, selectors, or exact string literals unless the prompt explicitly names them or they are an established, already-present public contract in the repository. Prefer a visible outcome or public API behavior that accepts equivalent implementations."];function Ld(e,t){let r=[...Ad("You are an exhaustive, research-minded POSITIVE test-coverage analyst for a coding-agent benchmark task. Your sole mandate is to surface EVERY genuine POSITIVE behavioral test gap \u2014 required behavior that `test.patch` never asserts but `agent_prompt.md` requires. Do NOT search for forbidden/wrong-behavior gaps; a separate negative-case agent handles those in parallel. Stay in your lane and search exhaustively before concluding there are none."),"","Your job: find real POSITIVE TEST GAPS. A positive gap is required or clearly-implied behavior from `agent_prompt.md` (and, where relevant, obvious existing repo conventions) that `test.patch` does NOT actually verify \u2014 such that a plausible implementation could skip or misimplement that required behavior and STILL pass every test in `test.patch` as written.","","Focus on required outcomes: happy paths, side effects, state changes, outputs, transitions, edge inputs where the prompt still expects correct handling, combined/interacting behaviors, and branches in `solution.patch` whose correct outcome is never forced by a test.","","Be systematic and exhaustive \u2014 work through ALL of the following passes:","1. Go through `agent_prompt.md` sentence by sentence. For every distinct required behavior, constraint, or implied rule, check which test(s) in `test.patch` exercise it and how thoroughly.","2. Go through `solution.patch` branch by branch \u2014 every conditional, loop, early return, error path, and state transition. For each one, ask whether `test.patch` forces the correct outcome to be checked.","3. Consider standard positive edge-case categories: boundary/limit values, empty/missing/null/zero inputs that should still produce the required correct behavior, duplicate or repeated inputs handled correctly, ordering and interleaving, concurrent or repeated invocations, error/failure/rollback paths that should recover correctly, interaction between two or more required behaviors at once, and state left behind after an operation.","4. Cross-check overlapping/interacting requirements \u2014 behaviors each tested alone but never tested together.","5. Second-pass sweep: return to any requirement you marked 'covered' and ask whether coverage is shallow \u2014 one happy-path assertion is not enough if other valid inputs, sequences, or combinations could still slip through.",...qd,"Do not filter yourself or self-censor for volume. A separate validator will strictly filter afterward \u2014 your job is recall on POSITIVE gaps only.","",...Uo,"","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",e];return t&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),r.push("","For each gap, prefix the description with `POSITIVE:` and explain: (1) the specific untested required behavior/edge case, and (2) concretely why a plausible-but-incomplete implementation would still pass every given test despite missing or misimplementing it.",`When you are done \u2014 after completing ALL the passes above and a deliberate second sweep \u2014 call the \`${ur}\` tool exactly once with your full candidate list (empty only if, after genuinely exhaustive analysis, none exist). That tool call is your only way to report a result.`),r.join(`
12
+ `)}function jd(e,t){let r=[...Ad("You are an exhaustive, research-minded NEGATIVE test-coverage analyst for a coding-agent benchmark task. Your sole mandate is to surface EVERY genuine NEGATIVE behavioral test gap \u2014 forbidden behavior, invalid states, or wrong outcomes that `test.patch` never asserts against but `agent_prompt.md` prohibits or implies must not happen. Do NOT search for missing required-behavior gaps; a separate positive-case agent handles those in parallel. Stay in your lane and search exhaustively before concluding there are none."),"","Your job: find real NEGATIVE TEST GAPS. A negative gap is a prohibition, guard, or 'must not' constraint from `agent_prompt.md` (or unambiguous repo convention) that `test.patch` does NOT verify \u2014 such that an agent could violate `agent_prompt.md` by doing the forbidden thing, leaving the wrong state enabled, applying an effect to the wrong target, skipping a guard, or accepting invalid input, and STILL pass every test because the suite only checks that correct actions work, not that incorrect ones are rejected.","","Be systematic and exhaustive \u2014 work through ALL of the following passes:","1. Re-read `agent_prompt.md` specifically for prohibitions, conditions, guards, and 'only when' / 'must not' / 'never' / 'disabled when' / 'should not' language. For each, ask: does `test.patch` assert the WRONG thing does NOT happen?","2. Go through `solution.patch` for every guard, early return, disabled branch, isolation check, and rejection path. Ask whether a sloppy implementation that bypassed that guard would still pass.","3. Hunt these negative patterns explicitly:"," - Controls that must be disabled/unavailable in a given state, but no test drives that state and asserts disabled."," - Operations that must NOT affect a separate scope/target (isolation), but tests never prove the wrong scope is untouched."," - Side effects that must NOT occur (duplicate entries, spurious history steps, refresh on no-op)."," - Invalid, out-of-order, or repeated input that should be ignored/rejected/coalesced differently."," - Undo/redo or rollback boundaries where the first action must NOT be undoable, or redo must NOT be available."," - Mutual exclusion: doing A must NOT silently change B, but no test proves independence.","4. For every prompt prohibition, ask: 'Is there a test that would catch an agent doing the forbidden thing or applying the requirement in the wrong context?' If not, it is a gap.","5. Adversarial pass: imagine a lazy or slightly-wrong implementation that satisfies the obvious tests \u2014 list every way it could still violate the prompt (wrong scope, wrong timing, wrong guard, spurious side effect, missing rejection) and check whether `test.patch` would catch each one.",...qd,"Do not filter yourself or self-censor for volume. A separate validator will strictly filter afterward \u2014 your job is recall on NEGATIVE gaps only.","",...Uo,"- Negative gaps must be grounded in an explicit or clearly implied prohibition/constraint in `agent_prompt.md` \u2014 not generic 'more negative tests would be nice'.","- A single test that asserts both the positive outcome AND that the forbidden/wrong outcome did not occur counts as covered.","","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",e];return t&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),r.push("","For each gap, prefix the description with `NEGATIVE:` and explain: (1) the specific untested forbidden/wrong behavior or invalid state, and (2) concretely why a plausible-but-wrong implementation would still pass every given test despite violating this constraint.",`When you are done \u2014 after completing ALL the passes above and a deliberate second sweep \u2014 call the \`${ur}\` tool exactly once with your full candidate list (empty only if, after genuinely exhaustive analysis, none exist). That tool call is your only way to report a result.`),r.join(`
13
+ `)}function Fd(e,t,r){let n=["You are a strict, skeptical fairness auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","Two specialized research agents reviewed this same task (`agent_prompt.md`, `test.patch`, `solution.patch`, and the repo) in parallel \u2014 one hunting POSITIVE gaps (missing required-behavior tests), one hunting NEGATIVE gaps (missing forbidden/wrong-behavior tests). They proposed the following combined CANDIDATE list:","",JSON.stringify(e,null,2),"","Your job is to independently re-verify the files yourself and FILTER this list down to only candidates that are ALL of the following:","1. Genuinely grounded \u2014 actually required by a specific statement in `agent_prompt.md`, or unambiguous from clearly visible, existing repo behavior. Drop anything speculative, nice-to-have, or invented beyond what the prompt actually asks for.","2. Fair to test \u2014 verifying it would not require undiscoverable private internals, an invented/unnamed API, or exact incidental structure that only `solution.patch` happens to use. Judge this precisely against the fairness methodology below.","3. A real, distinct coverage hole \u2014 re-check `test.patch` yourself; drop any candidate an existing test already covers, and drop near-duplicate candidates (keep only the clearest phrasing of each distinct gap). For negative-case candidates, keep them only if `test.patch` does not already assert that the forbidden/wrong outcome does not occur.","4. Behaviorally testable through a public contract \u2014 drop candidates that would require an internal helper, private state, implementation structure, call order, DOM class/attribute/data hook, selector, or exact string literal. The sole exceptions are details explicitly named in `agent_prompt.md` or already established as a public contract in the existing repository.","","Be strict: when genuinely unsure whether a candidate holds up, drop it rather than keep it. It is fine \u2014 expected, even \u2014 to return an empty list if none of the candidates survive scrutiny.","","Checklist for the tests focus area, for calibration:",t];return r&&n.push("","Fairness methodology:",r),n.push("","For every gap you keep, give a short justification citing where in `agent_prompt.md` or the repo it is grounded. Preserve POSITIVE:/NEGATIVE: prefix when applicable.",`When you are done, call the \`${Jr}\` tool exactly once with your final filtered list (which may be empty). That tool call is your only way to report a result.`),n.join(`
14
+ `)}function Dd(){return["You are a software engineer practicing test-driven development in a real git repository (this is your current directory).","`agent_prompt.md` in the repo root describes your task. Tests for it already exist and are currently failing \u2014 that's normal in TDD, the tests come first.","","Goal: make all of the new tests pass.","1. Read `agent_prompt.md`.","2. Run `bash test.sh new` to see the failures and what the tests expect.","3. Read the failing tests \u2014 they are the precise spec \u2014 and the surrounding repo code for conventions and utilities to reuse.","4. Implement the code needed to satisfy both `agent_prompt.md` and the tests, matching repo style.","5. Re-run `bash test.sh new` and iterate until everything passes, or you're confident you can't progress further.","","Rules:","- Do NOT modify the test files or `test.sh`. Only change application/library code.","- You have shell access \u2014 install any dependencies you need.","- Prefer the smallest, most direct change that satisfies the tests and `agent_prompt.md` using existing repo patterns."].join(`
15
+ `)}function Ub(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 \`${dr}/solver_${e.index}/\``}function Nd(e,t,r){let n=["You are a strict, skeptical behavioral-gap auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the real task description), `solution.patch` (a unified diff of the real golden/reference solution), and `test.patch` (a unified diff adding the hidden tests).","",`Separately, several coding agents ('solvers') were each given the same \`agent_prompt.md\` plus the failing tests from \`test.patch\` \u2014 but never \`solution.patch\` \u2014 and asked to implement the task TDD-style, iterating with real shell access until the tests passed or they gave up. Each solver's diff and full \`test.sh new\` output \u2014 captured and verified independently by the harness, not self-reported \u2014 is saved under \`${dr}/solver_<index>/\` (\`solution.diff\`, \`test_output.txt\`), with a \`${dr}/manifest.json\` summary. Use read/grep/find/ls to open exactly what you need. Status summary:`,"",...e.map(Ub),"","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.","",...Uo,"- Every gap must be evidenced by an actual, cited solver diff and a contrasting reference behavior. For a solver that failed the full suite, also cite its test output showing that the relevant behavior already passed or is unrelated to the failure. Cite the prompt sentence that makes the behavioral difference required; do not report a gap that is purely theoretical or based only on the reference implementation.","- It is fine, and expected, to submit an empty list if the solvers that passed all converged on behavior equivalent to the reference solution with no material gaps.","- Do not self-censor for volume, but do not pad the list either \u2014 only include what you can concretely justify with cited evidence.","","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",t];return r&&n.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",r),n.push("",`When you are done, call the \`${Xr}\` tool exactly once with your final list (which may be empty). That tool call is your only way to report a result.`),n.join(`
16
+ `)}var Kb=900*1e3,Ko=["read","grep","find","ls"];function Ia(e){return e==="off"?void 0:e}async function ba(e,t,r=Kb){let n=t.aborted?"cancelled":"done";return await Promise.race([e().then(()=>{t.aborted||(n="done")}),new Promise(a=>{setTimeout(()=>{n="timedOut",a()},r)}),new Promise(a=>{if(t.aborted)return a();t.addEventListener("abort",()=>{n="cancelled",a()},{once:!0})})]),n}async function Gd(e){let t={},r=e.kind==="positive"?Ld:jd,n=e.model,{session:a}=await ya({cwd:e.tempDir,model:n,thinkingLevel:Ia(e.thinkingLevel),tools:[...Ko,ur],customTools:[Pd(t)],sessionManager:xa.inMemory()});try{let s=await ba(async()=>{await a.prompt(r(e.testRubric,e.fairnessRules))},e.cancelSignal);if(s!=="done")return await a.abort(),{status:s,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var _b=["read","grep","find","ls","write","edit","bash"];async function Ud(e){let t=e.model;try{let r=xa.inMemory(),{session:n}=await ya({cwd:e.solverDir,model:t,thinkingLevel:Ia(e.thinkingLevel),tools:[..._b],sessionManager:r}),a=await ba(async()=>{await n.prompt(Dd())},e.cancelSignal,e.timeoutMinutes*60*1e3);return a!=="done"&&await n.abort(),{outcome:a,trajectory:r.getEntries()}}catch{return{outcome:"error",trajectory:[]}}}async function Kd(e){let t={},r=e.model,{session:n}=await ya({cwd:e.tempDir,model:r,thinkingLevel:Ia(e.thinkingLevel),tools:[...Ko,Xr],customTools:[Cd(t)],sessionManager:xa.inMemory()});try{let a=await ba(async()=>{await n.prompt(Nd(e.solverResults,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await n.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}async function _d(e){let t={},r=e.model,{session:n}=await ya({cwd:e.tempDir,model:r,thinkingLevel:Ia(e.thinkingLevel),tools:[...Ko,Jr],customTools:[Md(t)],sessionManager:xa.inMemory()});try{let a=await ba(async()=>{await n.prompt(Fd(e.candidates,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await n.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var Nt="checks_progress";function va(e,t,r){let n=r>0?Math.min(1,t/r):0,a=Math.round(24*n),s="\u2588".repeat(a)+"\u2591".repeat(Math.max(0,24-a));return[`checks: ${e} [${s}] ${t}/${r}`]}import{existsSync as zb,readFileSync as Bb}from"node:fs";var _o=["agent_prompt.md","solution.patch","test.patch"];function zo(e=new Date){let t=(s,m=2)=>String(s).padStart(m,"0"),r=-e.getTimezoneOffset(),n=r>=0?"+":"-",a=Math.abs(r);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}${n}${t(Math.floor(a/60))}:${t(a%60)}`}function zd(e){try{if(!zb(e))return{};let t=JSON.parse(Bb(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Bd(e){let t={...e.existingReport,timestamp:zo(),model:`${e.config.provider}/${e.config.modelId}`,thinkingLevel:e.config.thinkingLevel};return delete t.overall,delete t.reports,e.runGapFinder&&(t.testGaps=e.testGaps,e.gapAnalysisIncomplete?t.testGapAnalysisNote=`Gap analysis did not fully complete (positive finder: ${e.positiveGapFinderStatus}, negative finder: ${e.negativeGapFinderStatus}, filter: ${e.gapFilterStatus}); testGaps may be incomplete.`:delete t.testGapAnalysisNote),e.runSolverGapFinder&&(t.solverRunSummary=e.solverResults.map(r=>({index:r.index,status:r.status,passed:r.passed,durationMs:r.durationMs,artifactsDir:r.artifactsDir})),t.solverGaps=e.solverGaps,e.solverGapAnalysisIncomplete?t.solverGapAnalysisNote=`Solver-gap analysis did not fully complete (comparison reviewer: ${e.solverComparisonStatus}); solverGaps may be incomplete.`:delete t.solverGapAnalysisNote),t}function Vd(e){let t=Math.round(e/1e3);return t>=60?`${Math.floor(t/60)}m ${t%60}s`:`${t}s`}function Wd(e){let t=Array.isArray(e.merged.testGaps)?e.merged.testGaps.length:0,r=e.runSolverGapFinder&&Array.isArray(e.merged.solverRunSummary)?e.merged.solverRunSummary.map(s=>({...s,durationMs:s.durationMs??0})):[],n=Array.isArray(e.merged.solverGaps)?e.merged.solverGaps.length:0,a=[];return e.runGapFinder&&a.push(t>0?`${t} test gap(s) found`:"no test gaps found"),e.runSolverGapFinder&&a.push(`${r.filter(s=>s.passed).length}/${r.length} solvers passed, ${n} gap(s) found`),{content:`Gap finders: ${a.join(" | ")}`,details:{gapsCount:t,showGaps:e.runGapFinder,showSolverGaps:e.runSolverGapFinder,solverDetails:r,solverGapsCount:n}}}var Hd=`## The problem description (aka the task)\r
18
17
  P1: Aligns with the repo's philosophy\r
19
18
  P2: Self-contained \u2014 solvable from the repo and description alone\r
20
19
  P3: Clear, concise, and unambiguous \u2014 describes what to build or fix and don't leave points for guessing\r
@@ -41,7 +40,7 @@ That's the golden solution \u2014 the proof that your task is solvable and that
41
40
  S1: The solution should meet all the requirements. (If it's missing a requirement and it manages to pass your tests, you're in a bad position \u{1F620}.)\r
42
41
  S2: No regressions and follow existing code patterns. Don't break existing working code by mistake (we'll still run the repo's existing tests).\r
43
42
  S3: No irrelevant changes to the code \u2014 if something is unrelated to your task, keep it as it is.\r
44
- S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,vv=`# Agent Evaluation Guidelines\r
43
+ S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,Vb=`# Agent Evaluation Guidelines\r
45
44
  \r
46
45
  This file describes how to align a task prompt, reference solution, and tests for fair coding-agent evaluation. It is generic and can be reused across repositories and tasks.\r
47
46
  \r
@@ -321,5 +320,5 @@ Keep changes separated when possible:\r
321
320
  - Avoid unrelated dependency or lockfile changes.\r
322
321
  - Regenerate patches after every prompt/test/solution change.\r
323
322
  \r
324
- ---`;function xf(){let e=yf.split(/\r?\n(?=## )/g),t={};for(let r of ut){let n=e.find(a=>r.rubricHeading.test(a.trim()));t[r.key]=(n??yf).trim()}return t}function If(){return vv.trim()}var qa=!1,yr;function ja(){return qa}function bf(){return qa=!0,yr=new AbortController,yr}function vf(){qa=!1,yr=void 0}function $f(){return!qa||!yr||yr.signal.aborted?!1:(yr.abort(),!0)}var Sv="Ctrl+Shift+X",ii=[{value:"--all",label:"--all",description:"Run everything: 3 focus reviewers + test-gap finder/filter"},{value:"--review",label:"--review",description:"Run only the 3 focus reviewer agents (description/tests/solution)"},{value:"--description",label:"--description",description:"Run only the problem-description (prompt) focus reviewer"},{value:"--tests",label:"--tests",description:"Run only the tests focus reviewer"},{value:"--solution",label:"--solution",description:"Run only the solution focus reviewer"},{value:"--gap-finder",label:"--gap-finder",description:"Run only the 3-agent test-gap flow: positive finder + negative finder (parallel), then validator"},{value:"--solver-gap-finder",label:"--solver-gap-finder",description:"Run several solver agents TDD-style against agent_prompt.md + test.patch (no solution.patch), then compare their solutions to find gaps"},{value:"--config",label:"--config",description:"Open the settings menu: reviewer model/thinking level + solver-gap-finder settings"}];function Ov(e){let t=e.trimStart(),r=/\s$/.test(t),n=t.trimEnd().split(/\s+/).filter(Boolean),a=r?"":n.at(-1)??"",s=new Set(r?n:n.slice(0,-1)),m=r?t:t.slice(0,t.length-a.length),c=s.has("--config"),l=[...s].some(g=>g!=="--config"),d=ii.filter(g=>s.has(g.value)||c||l&&g.value==="--config"?!1:g.value.startsWith(a));return d.length>0?d.map(g=>({...g,value:`${m}${g.value}`})):null}async function Sf(e,t,r){let n=xi();if(n.length===0)return e.ui.notify("No enabledModels configured in settings.json.","error"),null;let a=e.modelRegistry.getAll(),s=n.map(d=>{let g=Ii(d);if(!g)return null;let b=a.find(w=>w.provider===g.provider&&w.id===g.modelId),V=t?.provider===g.provider&&t?.modelId===g.modelId,G=b?`${b.name} (${d})`:d;return{ref:d,parsed:g,display:V?`${G} [current]`:G,isCurrent:V}}).filter(d=>d!==null);if(s.length===0)return e.ui.notify("Could not resolve any enabledModels entries.","error"),null;let m=[...s].sort((d,g)=>d.isCurrent===g.isCurrent?0:d.isCurrent?-1:1),c=await e.ui.select(r,m.map(d=>d.display));if(!c)return null;let l=s.find(d=>d.display===c);return l?{provider:l.parsed.provider,modelId:l.parsed.modelId}:null}function Da(e,t,r){let n=e.modelRegistry.getAll().find(a=>a.provider===t&&a.id===r);return hi(n)}var Fa={provider:"",modelId:"",thinkingLevel:"off",timeoutMinutes:za,solverCount:vn,saveArtifacts:Ba};function Of(e,t,r){let n=t?Da(e,t.provider,t.modelId):["off"],a=r.provider?Da(e,r.provider,r.modelId):["off"];return[{id:"reviewer-model",section:"Reviewer",label:"Model",value:t?`${t.provider}/${t.modelId}`:"not set",kind:"model"},{id:"reviewer-thinking",section:"Reviewer",label:"Thinking level",value:t?.thinkingLevel??"off",kind:"cycle",values:n},{id:"solvergap-model",section:"Solver Gap Finder",label:"Model",value:r.provider?`${r.provider}/${r.modelId}`:"not set",kind:"model"},{id:"solvergap-thinking",section:"Solver Gap Finder",label:"Thinking level",value:r.thinkingLevel,kind:"cycle",values:a},{id:"solvergap-timeout",section:"Solver Gap Finder",label:"Timeout",value:`${r.timeoutMinutes} min`,kind:"cycle",values:[10,20,30,40,50,fi].filter((s,m,c)=>s>=di&&c.indexOf(s)===m).map(s=>`${s} min`)},{id:"solvergap-solver-count",section:"Solver Gap Finder",label:"Parallel agents",value:String(r.solverCount),kind:"cycle",values:Array.from({length:gi-Va+1},(s,m)=>`${Va+m}`)},{id:"solvergap-save-artifacts",section:"Solver Gap Finder",label:"Save artifacts",value:r.saveArtifacts?"on":"off",kind:"cycle",values:["on","off"]}]}var si=class{constructor(t,r,n,a,s,m){this.ctx=t;this.settingsListTheme=r;this.theme=n;this.onCycleSaved=a;this.onActivateModel=s;this.onExit=m;this.rows=Of(t,dt(),dt()?.solverGap??Fa)}selectedIndex=0;rows;refresh(){let t=dt();this.rows=Of(this.ctx,t,t?.solverGap??Fa),this.selectedIndex=Math.min(this.selectedIndex,this.rows.length-1)}invalidate(){}render(t){let r=[],n=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&&r.push(""),r.push(this.theme.bold(this.theme.fg("accent",m.section))),a=m.section);let c=s===this.selectedIndex,l=c?this.settingsListTheme.cursor:" ",d=m.label+" ".repeat(Math.max(0,n-m.label.length)),g=this.settingsListTheme.label(d,c),b=this.settingsListTheme.value(m.value,c);r.push(`${l}${g} ${b}`)}return r}handleInput(t){if(Vt(t,zt.ctrl("s"))||Vt(t,zt.escape)||Vt(t,zt.ctrl("c"))){this.onExit();return}if(Vt(t,zt.up)){this.selectedIndex=this.selectedIndex===0?this.rows.length-1:this.selectedIndex-1;return}if(Vt(t,zt.down)){this.selectedIndex=this.selectedIndex===this.rows.length-1?0:this.selectedIndex+1;return}if(Vt(t,zt.enter)||Vt(t,zt.return)||t===" "){let r=this.rows[this.selectedIndex];if(!r)return;if(r.kind==="model"){this.onActivateModel(r.id);return}if(!r.values||r.values.length===0)return;let n=dt();if(!n){this.ctx.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");return}let a=n.solverGap??Fa,s=r.values.indexOf(r.value),m=r.values[(s+1)%r.values.length];if(m===void 0)return;r.id==="reviewer-thinking"?ft({...n,thinkingLevel:m,solverGap:a}):r.id==="solvergap-thinking"?ft({...n,solverGap:{...a,thinkingLevel:m}}):r.id==="solvergap-timeout"?ft({...n,solverGap:{...a,timeoutMinutes:Number.parseInt(m,10)}}):r.id==="solvergap-solver-count"?ft({...n,solverGap:{...a,solverCount:Number.parseInt(m,10)}}):r.id==="solvergap-save-artifacts"&&ft({...n,solverGap:{...a,saveArtifacts:m==="on"}}),this.refresh(),this.onCycleSaved()}}};async function Pv(e){if(e.mode!=="tui"){e.ui.notify("/checks --config requires interactive mode","error");return}let t=0;for(;;){let r=await e.ui.custom((s,m,c,l)=>{let d=new si(e,wv(),m,()=>s.requestRender(),b=>l(b),()=>l(void 0));d.selectedIndex=t;let g=new Ev;return g.addChild(new Rf(m.bold(m.fg("accent","Checks settings")))),g.addChild({render:b=>d.render(b),invalidate:()=>d.invalidate()}),g.addChild(new Rv(1)),g.addChild(new Rf(m.fg("dim","\u2191\u2193 navigate enter select ctrl+s save & exit esc cancel"))),{render(b){return g.render(b)},invalidate(){g.invalidate()},handleInput(b){d.handleInput(b),t=d.selectedIndex,s.requestRender()}}});if(!r)return;let n=dt(),a=n?.solverGap??Fa;if(r==="reviewer-model"){let s=await Sf(e,n,"Select model for checks reviewer agents");if(!s)continue;let m=Da(e,s.provider,s.modelId),c=m.includes(n?.thinkingLevel??"off")?n?.thinkingLevel??"off":m[0]??"off";ft({...s,thinkingLevel:c,solverGap:a}),e.ui.notify(`Reviewer model saved: ${s.provider}/${s.modelId}`,"info");continue}if(r==="solvergap-model"){if(!n){e.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");continue}let s=await Sf(e,a.provider?a:null,"Select model for solver-gap-finder's solver agents");if(!s)continue;let m=Da(e,s.provider,s.modelId),c=m.includes(a.thinkingLevel)?a.thinkingLevel:m[0]??"off";ft({...n,solverGap:{...a,...s,thinkingLevel:c}}),e.ui.notify(`Solver-gap-finder model saved: ${s.provider}/${s.modelId}`,"info")}}}function Pf(e){e.registerCommand("checks",{description:"Strict review of agent_prompt.md/test.patch/solution.patch. Requires an option \u2014 see /checks.",getArgumentCompletions:Ov,handler:async(t,r)=>{let n=t.trim();if(n===""){r.ui.notify(ii.map(F=>`${F.value} \u2014 ${F.description}`).join(`
325
- `),"info");return}let a=[...new Set(n.split(/\s+/).filter(Boolean))],s=new Set(ii.map(F=>F.value)),m=a.filter(F=>!s.has(F));if(m.length>0){r.ui.notify(`Unknown option(s): ${m.join(", ")}. Run /checks with no arguments to see the available options.`,"warning");return}if(a.includes("--config")){if(a.length>1){r.ui.notify("--config cannot be combined with other options.","warning");return}await Pv(r);return}let c=new Set;if(a.includes("--all")||a.includes("--review"))for(let F of ut)c.add(F.key);for(let F of ut)a.includes(`--${F.key}`)&&c.add(F.key);let l=a.includes("--all")||a.includes("--gap-finder"),d=a.includes("--solver-gap-finder"),g=ut.filter(F=>c.has(F.key)),b=g.length>0;if(!b&&!l&&!d){r.ui.notify(`Nothing to run for: ${a.join(" ")}. Run /checks with no arguments to see the available options.`,"warning");return}let V=a.join(" ");if(ja()){r.ui.notify("A checks run is already in progress.","warning");return}let G=dt();if(!G){r.ui.notify("No reviewer model configured. Run /checks --config first.","error");return}let w=r.modelRegistry.find(G.provider,G.modelId);if(!w){r.ui.notify(`Configured model ${G.provider}/${G.modelId} not found. Run /checks --config again.`,"error");return}if(!r.modelRegistry.hasConfiguredAuth(w)){r.ui.notify(`No auth configured for ${G.provider}/${G.modelId}.`,"error");return}let Ce=ai.filter(F=>!kf(ct(r.cwd,F)));if(Ce.length>0){r.ui.notify(`Missing required file(s) in project root: ${Ce.join(", ")}`,"error");return}let L=null,le;if(d){if(L=yi(),!L){r.ui.notify("No solver-gap-finder model configured. Run /checks --config and set it up.","error");return}if(le=r.modelRegistry.find(L.provider,L.modelId),!le){r.ui.notify(`Configured solver-gap-finder model ${L.provider}/${L.modelId} not found. Run /checks --config again.`,"error");return}if(!r.modelRegistry.hasConfiguredAuth(le)){r.ui.notify(`No auth configured for ${L.provider}/${L.modelId}.`,"error");return}if(!kf(ct(r.cwd,"test.sh"))){r.ui.notify("Missing required file in project root for --solver-gap-finder: test.sh","error");return}}let re=bf(),Me=L?.solverCount??vn,oe=(b?g.length:0)+(l?3:0)+(d?Me+1:0);r.ui.setWidget(he,Ee("preparing clean snapshot",0,oe)),r.ui.notify(`checks (${V}) started. Press ${Sv} to cancel.`,"info");let rt,lt=[];try{let F=ct(Ef(),`checks-${Tf()}`);wf(F,{recursive:!0}),rt=F;let fn=await wn(e,r.cwd,F);if(fn.status==="error"){r.ui.notify(`checks: ${fn.error}`,"error");return}for(let Re of ai)$v(ct(r.cwd,Re),ct(F,Re));let xr=xf(),Ir=If(),pe=0,Ga=[];if(b&&(r.ui.setWidget(he,Ee("reviewing",pe,oe)),Ga=await Promise.all(g.map(Re=>pf({pi:e,role:Re,tempDir:F,model:w,thinkingLevel:G.thinkingLevel,rubric:xr[Re.key],fairnessRules:Ir,cancelSignal:re.signal}).then(nt=>(pe+=1,r.ui.setWidget(he,Ee("reviewing",pe,oe)),nt)))),re.signal.aborted)){r.ui.notify("checks: cancelled.","warning");return}let br={status:"ok",gaps:[]},vr={status:"ok",gaps:[]},gn={status:"ok",gaps:[]};if(l){let Re={tempDir:F,model:w,thinkingLevel:G.thinkingLevel,testRubric:xr.tests,fairnessRules:Ir,cancelSignal:re.signal};if(r.ui.setWidget(he,Ee("finding test gaps",pe,oe)),[br,vr]=await Promise.all([ni({...Re,kind:"positive"}).then($r=>(pe+=1,r.ui.setWidget(he,Ee("finding test gaps",pe,oe)),$r)),ni({...Re,kind:"negative"}).then($r=>(pe+=1,r.ui.setWidget(he,Ee("finding test gaps",pe,oe)),$r))]),re.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}let nt=[...br.gaps,...vr.gaps];if(nt.length>0&&(r.ui.setWidget(he,Ee("validating test gaps",pe,oe)),gn=await lf({tempDir:F,model:w,thinkingLevel:G.thinkingLevel,testRubric:xr.tests,fairnessRules:Ir,candidates:nt,cancelSignal:re.signal})),pe+=1,r.ui.setWidget(he,Ee("validating test gaps",pe,oe)),re.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}}let Bt=[],hn={status:"ok",gaps:[]};if(d&&L){r.ui.setWidget(he,Ee("solver-gap-finder: solving",pe,oe));let Re=ct(r.cwd,"test.patch"),nt=ct(r.cwd,"agent_prompt.md"),$r=await Promise.all(Array.from({length:Me},async(Rt,St)=>{let Tr=ct(Ef(),`checks-solvergap-${Tf()}`);wf(Tr,{recursive:!0}),lt.push(Tr);let yn=await vi({pi:e,repoDir:r.cwd,solverDir:Tr,testPatchPath:Re,agentPromptPath:nt});return{index:St+1,setup:yn}})),Ff=oi().replace(/[:.]/g,"-");if(Bt=await Promise.all($r.map(async({index:Rt,setup:St})=>{if(St.status!=="ok")return pe+=1,r.ui.setWidget(he,Ee("solver-gap-finder: solving",pe,oe)),{index:Rt,status:St.status,passed:!1,diff:"",testOutputTail:St.error,durationMs:0};let Tr=Date.now(),{outcome:yn,trajectory:Df}=await uf({pi:e,solverDir:St.solverDir,model:le,thinkingLevel:L.thinkingLevel,timeoutMinutes:L.timeoutMinutes,cancelSignal:re.signal}),{testOutputXmlPath:Gf,...Ka}=await $i({pi:e,index:Rt,workspace:St,status:yn==="done"?"ok":yn,durationMs:Date.now()-Tr}),Nf=L.saveArtifacts?Ti({repoDir:r.cwd,runId:Ff,index:Rt,trajectory:Df,solutionPatch:Ka.diff,testOutputXmlPath:Gf,testOutputTail:Ka.testOutputTail}):void 0;return pe+=1,r.ui.setWidget(he,Ee("solver-gap-finder: solving",pe,oe)),{...Ka,artifactsDir:Nf}})),re.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}if(Bt.some(Rt=>Rt.status!=="patchFailed"&&Rt.status!=="error")?(r.ui.setWidget(he,Ee("solver-gap-finder: comparing solutions",pe,oe)),ki(F,Bt),hn=await cf({tempDir:F,model:w,thinkingLevel:G.thinkingLevel,solverResults:Bt,cancelSignal:re.signal})):r.ui.notify("checks: all solver-gap-finder solvers failed to set up; skipping comparison.","warning"),pe+=1,r.ui.setWidget(he,Ee("solver-gap-finder: comparing solutions",pe,oe)),re.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}}r.ui.setWidget(he,Ee("finalizing report",oe,oe));let Na={};g.forEach((Re,nt)=>{Ga[nt]&&(Na[Re.key]=Ga[nt])});let Mf=gn.gaps,Af=br.gaps.length>0||vr.gaps.length>0,Lf=l&&(br.status!=="ok"||vr.status!=="ok"||Af&&gn.status!=="ok"),Ua=ct(r.cwd,"shipd_report.json"),qf=df(Ua),jf=d&&(Bt.some(Re=>Re.status==="error")||hn.status!=="ok"),pi=ff({existingReport:qf,config:G,runReviewers:b,byRole:Na,runGapStages:l,testGaps:Mf,gapAnalysisIncomplete:Lf,positiveGapFinderStatus:br.status,negativeGapFinderStatus:vr.status,gapFilterStatus:gn.status,runSolverGapFinder:d,solverResults:Bt,solverGaps:hn.gaps,solverGapAnalysisIncomplete:jf,solverComparisonStatus:hn.status}),ui=hf({merged:pi,runReviewers:b,activeRoles:g,byRole:Na,runGapStages:l,runSolverGapFinder:d});e.sendMessage({customType:"shipd_checks_report",content:ui.content,display:!0,details:ui.details}),kv(Ua,JSON.stringify(pi,null,2),"utf-8"),r.ui.notify(`checks: wrote details to ${Ua}`,"info")}catch(F){r.ui.notify(`checks failed: ${F instanceof Error?F.message:String(F)}`,"error")}finally{if(r.ui.setWidget(he,void 0),rt)try{Tv(rt,{recursive:!0,force:!0})}catch{}for(let F of lt)wi(F);vf()}}})}var Cf=Mv.ctrlShift("x");function Lv(e){e.registerMessageRenderer("shipd_checks_report",(t,r,n)=>{let a=t.details??{},s=d=>d==="PASS"?n.fg("success",d):n.fg("error",d),m=new Cv;m.addChild(new mi(n.bold(n.fg("accent","Checks")),0,0));let c=!1,l=d=>{m.addChild(new mi(d,0,0)),c=!0};if(a.roleVerdicts&&Object.keys(a.roleVerdicts).length>0){for(let[d,g]of Object.entries(a.roleVerdicts)){let b=g==="PASS"?n.fg("success","\u2713"):n.fg("error","\u2717");l(` ${b} ${n.bold(d)}: ${s(g)}`)}if(a.overall){let d=a.overall==="PASS"&&a.hasTestGaps?" (with test gaps)":"";l(` ${n.bold("Overall:")} ${s(a.overall)}${d}`)}}if(a.showGaps){let d=a.gapsCount??0;l(d>0?n.fg("warning",` \u26A0 ${d} test gap(s) found`):n.fg("success"," \u2713 no test gaps found"))}if(a.showSolverGaps){let d=a.solverDetails??[],g=d.filter(w=>w.passed).length,b=a.solverGapsCount??0;m.addChild(new Av(1)),l(n.bold(n.fg("accent","Solver gap finder")));for(let w of d){let Ce=w.passed?n.fg("success","\u2713"):n.fg("error","\u2717"),L=w.passed?"passed":w.status==="ok"?"failed tests":w.status;l(` ${Ce} Solver ${w.index}: ${L} (${gf(w.durationMs)})`)}let V=g===d.length&&d.length>0?n.fg("success",`${g}/${d.length} solvers passed`):n.fg("warning",`${g}/${d.length} solvers passed`),G=b>0?n.fg("warning",`${b} behavioral gap(s) found`):n.fg("success","no behavioral gaps found");l(` ${V}, ${G}`)}return c||m.addChild(new mi(n.fg("dim"," nothing to report"),0,0)),m}),e.registerShortcut(Cf,{description:"Cancel an in-progress /checks run",handler:t=>{ja()&&$f()&&(t.ui.setWidget(he,[`checks: cancelling (${Cf})...`]),t.ui.notify("checks: cancelling...","warning"))}}),Pf(e)}export{Lv as default};
323
+ ---`;function Yd(){return(Hd.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??Hd).trim()}function Jd(){return Vb.trim()}var $a=!1,cr;function Ta(){return $a}function Xd(){return $a=!0,cr=new AbortController,cr}function Zd(){$a=!1,cr=void 0}function Qd(){return!$a||!cr||cr.signal.aborted?!1:(cr.abort(),!0)}var Jb="Ctrl+Shift+X",Bo=[{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 Xb(e){let t=e.trimStart(),r=/\s$/.test(t),n=t.trimEnd().split(/\s+/).filter(Boolean),a=r?"":n.at(-1)??"",s=new Set(r?n:n.slice(0,-1)),m=r?t:t.slice(0,t.length-a.length),c=s.has("--config"),l=[...s].some(x=>x!=="--config"),I=Bo.filter(x=>!s.has(x.value)&&!c&&!(l&&x.value==="--config")&&x.value.startsWith(a));return I.length?I.map(x=>({...x,value:`${m}${x.value}`})):null}async function af(e,t,r){let n=e.modelRegistry.getAll(),a=ei().map(m=>{let c=ti(m);if(!c)return null;let l=n.find(I=>I.provider===c.provider&&I.id===c.modelId);return{ref:m,parsed:c,label:`${l?.name??m} (${m})${r?.provider===c.provider&&r.modelId===c.modelId?" [current]":""}`}}).filter(m=>m!==null);if(!a.length)return e.ui.notify("No enabledModels configured in settings.json.","error"),null;let s=await e.ui.select(t,a.map(m=>m.label));return a.find(m=>m.label===s)?.parsed??null}async function Zb(e){let t=nn(),r=await e.ui.select("Configure checks",["Reviewer model","Solver model"]);if(!r)return;if(r==="Reviewer model"){let m=await af(e,"Select reviewer model",t??void 0);if(!m)return;let c=Oa(e.modelRegistry.find(m.provider,m.modelId)),l=await e.ui.select("Select reviewer thinking level",c);if(!l)return;Pa({provider:m.provider,modelId:m.modelId,thinkingLevel:l,solverGap:t?.solverGap}),e.ui.notify("Reviewer model saved.","info");return}if(!t){e.ui.notify("Configure the reviewer model first.","warning");return}let n=await af(e,"Select solver model",t.solverGap);if(!n)return;let a=Oa(e.modelRegistry.find(n.provider,n.modelId)),s=await e.ui.select("Select solver thinking level",a);s&&(Pa({provider:t.provider,modelId:t.modelId,thinkingLevel:t.thinkingLevel,solverGap:{provider:n.provider,modelId:n.modelId,thinkingLevel:s,timeoutMinutes:t.solverGap?.timeoutMinutes??wa,solverCount:t.solverGap?.solverCount??Ra,saveArtifacts:t.solverGap?.saveArtifacts??Sa}}),e.ui.notify("Solver model saved.","info"))}function sf(e){e.registerCommand("checks",{description:"Find behavioral gaps in test coverage. Requires an option \u2014 see /checks.",getArgumentCompletions:Xb,handler:async(t,r)=>{let n=t.trim();if(!n){r.ui.notify(Bo.map(F=>`${F.value} \u2014 ${F.description}`).join(`
324
+ `),"info");return}let a=[...new Set(n.split(/\s+/).filter(Boolean))],s=new Set(Bo.map(F=>F.value)),m=a.filter(F=>!s.has(F));if(m.length){r.ui.notify(`Unknown option(s): ${m.join(", ")}. Run /checks with no arguments to see options.`,"warning");return}if(a.includes("--config")){a.length>1?r.ui.notify("--config cannot be combined with other options.","warning"):await Zb(r);return}let c=a.includes("--gap-finder"),l=a.includes("--solver-gap-finder");if(!c&&!l)return;if(Ta()){r.ui.notify("A checks run is already in progress.","warning");return}let I=nn();if(!I){r.ui.notify("No gap-finder model configured. Run /checks --config first.","error");return}let x=r.modelRegistry.find(I.provider,I.modelId);if(!x||!r.modelRegistry.hasConfiguredAuth(x)){r.ui.notify("Configured behavioral gap-finder model is unavailable or unauthenticated. Run /checks --config.","error");return}let j=_o.filter(F=>!tf(Je(r.cwd,F)));if(j.length){r.ui.notify(`Missing required file(s): ${j.join(", ")}`,"error");return}let U=null,Q;if(l){if(U=Qo(),!U||!tf(Je(r.cwd,"test.sh"))){r.ui.notify("Configure solver gap finder and provide test.sh before running it.","error");return}if(Q=r.modelRegistry.find(U.provider,U.modelId),!Q||!r.modelRegistry.hasConfiguredAuth(Q)){r.ui.notify("Configured solver gap-finder model is unavailable or unauthenticated.","error");return}}let Ie=Xd(),Me=U?.solverCount??0,Ce=(c?3:0)+(l?Me+1:0);r.ui.setWidget(Nt,va("preparing clean snapshot",0,Ce)),r.ui.notify(`gap finders (${a.join(" ")}) started. Press ${Jb} to cancel.`,"info");let je,Xe=[];try{let F=Je(nf(),`checks-${ef()}`);rf(F,{recursive:!0}),je=F;let It=await mn(e,r.cwd,F);if(It.status==="error"){r.ui.notify(`checks: ${It.error}`,"error");return}for(let Fe of _o)Wb(Je(r.cwd,Fe),Je(F,Fe));let at=Yd(),ot=Jd(),it=0,bt={status:"ok",gaps:[]},vt={status:"ok",gaps:[]},Gt={status:"ok",gaps:[]};if(c){let Fe={tempDir:F,model:x,thinkingLevel:I.thinkingLevel,testRubric:at,fairnessRules:ot,cancelSignal:Ie.signal};[bt,vt]=await Promise.all([of(Fe,"positive"),of(Fe,"negative")]),it+=2,r.ui.setWidget(Nt,va("validating test gaps",it,Ce));let Qr=[...bt.gaps,...vt.gaps];if(Qr.length&&(Gt=await _d({...Fe,candidates:Qr})),it+=1,Ie.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}}let Ut=[],Zr={status:"ok",gaps:[]};if(l&&U){let Fe=await Promise.all(Array.from({length:Me},async($t,Tt)=>{let lr=Je(nf(),`checks-solvergap-${ef()}`);return rf(lr,{recursive:!0}),Xe.push(lr),{index:Tt+1,setup:await ni({pi:e,repoDir:r.cwd,solverDir:lr,testPatchPath:Je(r.cwd,"test.patch"),agentPromptPath:Je(r.cwd,"agent_prompt.md")})}})),Qr=zo().replace(/[:.]/g,"-");if(Ut=await Promise.all(Fe.map(async({index:$t,setup:Tt})=>{if(Tt.status!=="ok")return{index:$t,status:Tt.status,passed:!1,diff:"",testOutputTail:Tt.error,durationMs:0};let lr=Date.now(),{outcome:Jo,trajectory:uf}=await Ud({pi:e,solverDir:Tt.solverDir,model:Q,thinkingLevel:U.thinkingLevel,timeoutMinutes:U.timeoutMinutes,cancelSignal:Ie.signal}),{testOutputXmlPath:cf,...ka}=await ai({pi:e,index:$t,workspace:Tt,status:Jo==="done"?"ok":Jo,durationMs:Date.now()-lr}),lf=U.saveArtifacts?oi({repoDir:r.cwd,runId:Qr,index:$t,trajectory:uf,solutionPatch:ka.diff,testOutputXmlPath:cf,testOutputTail:ka.testOutputTail}):void 0;return it+=1,r.ui.setWidget(Nt,va("solver gap finder: solving",it,Ce)),{...ka,artifactsDir:lf}})),Ut.some($t=>$t.status!=="patchFailed"&&$t.status!=="error")&&(ii(F,Ut),Zr=await Kd({tempDir:F,model:x,thinkingLevel:I.thinkingLevel,solverResults:Ut,testRubric:at,fairnessRules:ot,cancelSignal:Ie.signal})),it+=1,Ie.signal.aborted){r.ui.notify("checks: cancelled.","warning");return}}let pf=c&&(bt.status!=="ok"||vt.status!=="ok"||(bt.gaps.length>0||vt.gaps.length>0)&&Gt.status!=="ok"),Wo=Bd({existingReport:zd(Je(r.cwd,"shipd_report.json")),config:I,runGapFinder:c,testGaps:Gt.gaps,gapAnalysisIncomplete:pf,positiveGapFinderStatus:bt.status,negativeGapFinderStatus:vt.status,gapFilterStatus:Gt.status,runSolverGapFinder:l,solverResults:Ut,solverGaps:Zr.gaps,solverGapAnalysisIncomplete:l&&(Ut.some(Fe=>Fe.status==="error")||Zr.status!=="ok"),solverComparisonStatus:Zr.status}),Ho=Wd({merged:Wo,runGapFinder:c,runSolverGapFinder:l});e.sendMessage({customType:"shipd_checks_report",content:Ho.content,display:!0,details:Ho.details});let Yo=Je(r.cwd,"shipd_report.json");Yb(Yo,JSON.stringify(Wo,null,2),"utf-8"),r.ui.notify(`checks: wrote details to ${Yo}`,"info")}catch(F){r.ui.notify(`checks failed: ${F instanceof Error?F.message:String(F)}`,"error")}finally{r.ui.setWidget(Nt,void 0),je&&Hb(je,{recursive:!0,force:!0});for(let F of Xe)si(F);Zd()}}})}async function of(e,t){return Gd({...e,kind:t})}var mf=ev.ctrlShift("x");function rv(e){e.registerMessageRenderer("shipd_checks_report",(t,r,n)=>{let a=t.details??{},s=new Qb;s.addChild(new Vo(n.bold(n.fg("accent","Checks")),0,0));let m=!1,c=l=>{s.addChild(new Vo(l,0,0)),m=!0};if(a.showGaps){let l=a.gapsCount??0;c(l>0?n.fg("warning",` \u26A0 ${l} test gap(s) found`):n.fg("success"," \u2713 no test gaps found"))}if(a.showSolverGaps){let l=a.solverDetails??[],I=l.filter(Q=>Q.passed).length,x=a.solverGapsCount??0;s.addChild(new tv(1)),c(n.bold(n.fg("accent","Solver gap finder")));for(let Q of l){let Ie=Q.passed?n.fg("success","\u2713"):n.fg("error","\u2717"),Me=Q.passed?"passed":Q.status==="ok"?"failed tests":Q.status;c(` ${Ie} Solver ${Q.index}: ${Me} (${Vd(Q.durationMs)})`)}let j=I===l.length&&l.length>0?n.fg("success",`${I}/${l.length} solvers passed`):n.fg("warning",`${I}/${l.length} solvers passed`),U=x>0?n.fg("warning",`${x} behavioral gap(s) found`):n.fg("success","no behavioral gaps found");c(` ${j}, ${U}`)}return m||s.addChild(new Vo(n.fg("dim"," nothing to report"),0,0)),s}),e.registerShortcut(mf,{description:"Cancel an in-progress /checks run",handler:t=>{Ta()&&Qd()&&(t.ui.setWidget(Nt,[`checks: cancelling (${mf})...`]),t.ui.notify("checks: cancelling...","warning"))}}),sf(e)}export{rv as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sreetej510/pi-shipd-checks",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
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",