@sreetej510/pi-shipd-checks 0.1.22 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +4 -2
  2. package/dist/index.js +21 -17
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -52,16 +52,18 @@ The two finder flags are additive/combinable; `--config` must be used alone.
52
52
 
53
53
  ## Configuration
54
54
 
55
- `/checks --config` opens the row-based settings menu with two sections:
55
+ `/checks --config` opens the row-based settings menu with three sections:
56
56
 
57
57
  - **Reviewer**: model and thinking level used by the behavioral gap finders, validator, and
58
58
  solver-solution comparison agent.
59
59
  - **Solver**: model and thinking level for TDD solver agents, plus their timeout, parallel solver
60
60
  count, and artifact-saving setting.
61
+ - **Analyze Tool**: enable/disable the agent-callable `analyze_test_gaps` tool (off by default,
62
+ like HPC tools) and pick the model + thinking level for its finder/reviewer agents.
61
63
 
62
64
  Use ↑/↓ to select a row and Enter/Space to change it. The currently selected model is shown first
63
65
  in its picker. Settings are saved to `~/.pi/agent/checks-config.json`; solver settings are nested
64
- under `solverGap`.
66
+ under `solverGap` and analyze-tool settings under `analyzeGap`.
65
67
 
66
68
  ## Install
67
69
 
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
- var Tf=Object.defineProperty;var Rt=(e,t)=>{for(var n in t)Tf(e,n,{get:t[n],enumerable:!0})};import{Container as hv,Key as gv,Spacer as yv,Text as Xo}from"@earendil-works/pi-tui";import{randomUUID as uf}from"node:crypto";import{copyFileSync as iv,existsSync as cf,mkdirSync as lf,rmSync as sv,writeFileSync as mv}from"node:fs";import{tmpdir as df}from"node:os";import{join as Ze}from"node:path";import{getSettingsListTheme as pv}from"@earendil-works/pi-coding-agent";import{Container as uv,Key as Kt,matchesKey as _t,Spacer as cv,Text as ff}from"@earendil-works/pi-tui";import{createAgentSession as ba,SessionManager as va}from"@earendil-works/pi-coding-agent";import{copyFileSync as Of,existsSync as Fa,lstatSync as Pf,mkdirSync as Da,readFileSync as cr,rmSync as di,symlinkSync as Cf,unlinkSync as Mf,writeFileSync as rt}from"node:fs";import{join as ce}from"node:path";import{existsSync as ir,mkdirSync as kf,readFileSync as Ma,writeFileSync as wf}from"node:fs";import{dirname as Ef,join as ai}from"node:path";import{getAgentDir as oi}from"@earendil-works/pi-coding-agent";var ar=ai(oi(),"checks-config.json"),or=ai(oi(),"settings.json"),ii=10,si=60,Aa=20,La=1,mi=5,qa=3,ja=!0,Rf=["off","minimal","low","medium","high","xhigh","max"];function pi(e){return e?.reasoning?Rf.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t==="xhigh"||t==="max"?n!==void 0:!0}):["off"]}function lt(){try{if(!ir(ar))return null;let e=JSON.parse(Ma(ar,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function dt(e){let t=Ef(ar);ir(t)||kf(t,{recursive:!0}),wf(ar,JSON.stringify(e,null,2),"utf-8")}function ui(){let e=lt()?.solverGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e,timeoutMinutes:e.timeoutMinutes>0?e.timeoutMinutes:Aa,solverCount:e.solverCount>0?e.solverCount:qa,saveArtifacts:typeof e.saveArtifacts=="boolean"?e.saveArtifacts:ja}}function ci(){try{return ir(or)?JSON.parse(Ma(or,"utf-8")).enabledModels??[]:[]}catch{return[]}}function li(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function Sf(){try{if(ir(or))return JSON.parse(Ma(or,"utf-8"))}catch{}return{}}function sr(){let e=Sf().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function mr(e){return e.replace(/\\/g,"/")}function pr(e){return`'${e.replace(/'/g,"'\\''")}'`}async function ur(e,t,n){if((await e.exec("git",["rev-parse","HEAD"],{cwd:t,timeout:15e3})).code!==0)return{status:"error",error:"Not a git repository, or it has no commits yet."};let a=`git archive HEAD | tar -x -C ${pr(mr(n))}`,s=await e.exec(sr(),["-c",a],{cwd:t,timeout:6e4});return s.code!==0?{status:"error",error:s.stderr?.trim()||`git archive failed (exit ${s.code})`}:{status:"ok"}}var Na=3e4,Af=4e3,Lf=".pi/shipd-checks",gn="solver_gap_solutions";function qf(e){let t=new Set,n=/^diff --git "?a\/(.+?)"? "?b\/(.+?)"?$/gm;for(let r of e.matchAll(n))r[1]&&t.add(r[1]),r[2]&&t.add(r[2]);return[...t]}function jf(e,t){return e.length>t?e.slice(e.length-t):e}async function fi(e){let{pi:t,repoDir:n,solverDir:r,testPatchPath:a,agentPromptPath:s}=e,m=await ur(t,n,r);if(m.status==="error")return{status:"error",solverDir:r,error:m.error};let c={cwd:r,timeout:Na},l=await t.exec("git",["init"],c);if(l.code!==0)return{status:"error",solverDir:r,error:l.stderr?.trim()||"git init failed"};await t.exec("git",["config","user.email","solvergap@shipd-checks.local"],c),await t.exec("git",["config","user.name","shipd-checks solver-gap-finder"],c);let h=await t.exec("git",["add","-A"],c);if(h.code!==0)return{status:"error",solverDir:r,error:h.stderr?.trim()||"git add (baseline) failed"};let f=await t.exec("git",["commit","-m","baseline","--allow-empty"],c);if(f.code!==0)return{status:"error",solverDir:r,error:f.stderr?.trim()||"git commit (baseline) failed"};let w=ce(r,".gitignore"),D=Fa(w)?cr(w,"utf-8"):"";if(!D.split(/\r?\n/).some(pt=>pt.trim()==="node_modules")){let pt=D.length>0&&!D.endsWith(`
1
+ var _f=Object.defineProperty;var Rt=(e,t)=>{for(var n in t)_f(e,n,{get:t[n],enumerable:!0})};import{Container as Wv,Key as Hv,Spacer as Yv,Text as di}from"@earendil-works/pi-tui";import{randomUUID as Pf}from"node:crypto";import{copyFileSync as Dv,existsSync as Af,mkdirSync as Cf,rmSync as Gv,writeFileSync as Nv}from"node:fs";import{tmpdir as Mf}from"node:os";import{join as et}from"node:path";import{getSettingsListTheme as Uv}from"@earendil-works/pi-coding-agent";import{Container as _v,Key as _t,matchesKey as Kt,Spacer as Kv,Text as Lf}from"@earendil-works/pi-tui";import{createAgentSession as wa,SessionManager as Ea}from"@earendil-works/pi-coding-agent";import{copyFileSync as Yf,existsSync as Ha,lstatSync as Jf,mkdirSync as Ya,readFileSync as gr,rmSync as Pi,symlinkSync as Zf,unlinkSync as Xf,writeFileSync as ot}from"node:fs";import{join as fe}from"node:path";import{existsSync as cr,mkdirSync as Kf,readFileSync as Ka,writeFileSync as zf}from"node:fs";import{dirname as Bf,join as bi}from"node:path";import{getAgentDir as vi}from"@earendil-works/pi-coding-agent";var pr=bi(vi(),"checks-config.json"),ur=bi(vi(),"settings.json"),$i=10,Ti=60,za=20,Ba=1,ki=5,Va=3,Wa=!0,Vf=!1,Wf=["off","minimal","low","medium","high","xhigh","max"];function wi(e){return e?.reasoning?Wf.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t==="xhigh"||t==="max"?n!==void 0:!0}):["off"]}function Ee(){try{if(!cr(pr))return null;let e=JSON.parse(Ka(pr,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function Fe(e){let t=Bf(pr);cr(t)||Kf(t,{recursive:!0}),zf(pr,JSON.stringify(e,null,2),"utf-8")}function Ei(){let e=Ee()?.solverGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e,timeoutMinutes:e.timeoutMinutes>0?e.timeoutMinutes:za,solverCount:e.solverCount>0?e.solverCount:Va,saveArtifacts:typeof e.saveArtifacts=="boolean"?e.saveArtifacts:Wa}}function xn(){return Ee()?.enableAnalyzeTool??Vf}function Ri(){let e=Ee()?.analyzeGap;return!e?.provider||!e.modelId||!e.thinkingLevel?null:{...e}}function Si(){try{return cr(ur)?JSON.parse(Ka(ur,"utf-8")).enabledModels??[]:[]}catch{return[]}}function Oi(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function Hf(){try{if(cr(ur))return JSON.parse(Ka(ur,"utf-8"))}catch{}return{}}function lr(){let e=Hf().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function dr(e){return e.replace(/\\/g,"/")}function fr(e){return`'${e.replace(/'/g,"'\\''")}'`}async function hr(e,t,n){if((await e.exec("git",["rev-parse","HEAD"],{cwd:t,timeout:15e3})).code!==0)return{status:"error",error:"Not a git repository, or it has no commits yet."};let a=`git archive HEAD | tar -x -C ${fr(dr(n))}`,i=await e.exec(lr(),["-c",a],{cwd:t,timeout:6e4});return i.code!==0?{status:"error",error:i.stderr?.trim()||`git archive failed (exit ${i.code})`}:{status:"ok"}}var Ja=3e4,Qf=4e3,eh=".pi/shipd-checks",In="solver_gap_solutions";function th(e){let t=new Set,n=/^diff --git "?a\/(.+?)"? "?b\/(.+?)"?$/gm;for(let r of e.matchAll(n))r[1]&&t.add(r[1]),r[2]&&t.add(r[2]);return[...t]}function nh(e,t){return e.length>t?e.slice(e.length-t):e}async function Ai(e){let{pi:t,repoDir:n,solverDir:r,testPatchPath:a,agentPromptPath:i}=e,m=await hr(t,n,r);if(m.status==="error")return{status:"error",solverDir:r,error:m.error};let u={cwd:r,timeout:Ja},l=await t.exec("git",["init"],u);if(l.code!==0)return{status:"error",solverDir:r,error:l.stderr?.trim()||"git init failed"};await t.exec("git",["config","user.email","solvergap@shipd-checks.local"],u),await t.exec("git",["config","user.name","shipd-checks solver-gap-finder"],u);let f=await t.exec("git",["add","-A"],u);if(f.code!==0)return{status:"error",solverDir:r,error:f.stderr?.trim()||"git add (baseline) failed"};let h=await t.exec("git",["commit","-m","baseline","--allow-empty"],u);if(h.code!==0)return{status:"error",solverDir:r,error:h.stderr?.trim()||"git commit (baseline) failed"};let $=fe(r,".gitignore"),E=Ha($)?gr($,"utf-8"):"";if(!E.split(/\r?\n/).some(ct=>ct.trim()==="node_modules")){let ct=E.length>0&&!E.endsWith(`
2
2
  `)?`
3
- `:"";rt(w,`${D}${pt}node_modules
4
- `,"utf-8")}let _=ce(n,"node_modules"),ue=ce(r,"node_modules");if(Fa(_)&&!Fa(ue))try{Cf(_,ue,process.platform==="win32"?"junction":"dir")}catch{}try{Of(s,ce(r,"agent_prompt.md"))}catch{}let Me=cr(a,"utf-8"),Re=qf(Me),De=ce(r,"test.patch");rt(De,Me,"utf-8");let Qe=await t.exec("git",["apply","test.patch"],c);try{Mf(De)}catch{}if(Qe.code!==0)return{status:"patchFailed",solverDir:r,error:Qe.stderr?.trim()||"git apply test.patch failed"};let N=await t.exec("git",["add","-A"],c);if(N.code!==0)return{status:"error",solverDir:r,error:N.stderr?.trim()||"git add (tests applied) failed"};let et=await t.exec("git",["commit","-m","tests applied","--allow-empty"],c);if(et.code!==0)return{status:"error",solverDir:r,error:et.stderr?.trim()||"git commit (tests applied) failed"};let Ne=await t.exec("git",["rev-parse","HEAD"],c);return Ne.code!==0||!Ne.stdout.trim()?{status:"error",solverDir:r,error:"Could not resolve tests-applied commit hash."}:{status:"ok",solverDir:r,testsAppliedCommit:Ne.stdout.trim(),testPatchPaths:Re}}function Ff(e){try{let t=cr(e,"utf-8").match(/<testsuites\b[^>]*>/i)?.[0];if(!t)return{totalTests:null,failedTests:null};let n=m=>Number.parseInt(t.match(new RegExp(`\\b${m}="(\\d+)"`,"i"))?.[1]??"",10),r=n("tests"),a=n("failures"),s=n("errors");return{totalTests:Number.isFinite(r)?r:null,failedTests:Number.isFinite(a)?a+(Number.isFinite(s)?s:0):null}}catch{return{totalTests:null,failedTests:null}}}async function hi(e){let{pi:t,index:n,workspace:r,status:a,durationMs:s}=e,{solverDir:m,testsAppliedCommit:c,testPatchPaths:l}=r,h={cwd:m,timeout:Na};await t.exec("git",["add","-A"],h);let f=[...l,"agent_prompt.md"].map(Ne=>`:(exclude)${Ne}`),w=await t.exec("git",["diff","--cached",c,"--",".",...f],h),D=w.code===0?w.stdout:"",_=ce(m,"test_output.xml"),ue=`bash test.sh --output_path ${pr(mr(_))} new`,Me=sr(),Re=await t.exec(Me,["-c",`cd ${pr(mr(m))} && ${ue}`],{timeout:Na*10}),De=Re.code===0,Qe=jf(`${Re.stdout}
5
- ${Re.stderr}`.trim(),Af),{totalTests:N,failedTests:et}=Ff(_);return{index:n,status:a,passed:De,diff:D,testOutputTail:Qe,durationMs:s,totalTests:N,failedTests:et,testOutputXmlPath:_}}function gi(e){let{repoDir:t,runId:n,index:r,trajectory:a,solutionPatch:s,testOutputXmlPath:m,testOutputTail:c}=e,l=ce(t,Lf,n,`solver_${r}`);Da(l,{recursive:!0}),rt(ce(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),rt(ce(l,"solution.patch"),s,"utf-8");try{let h=cr(m,"utf-8");rt(ce(l,"test_output.xml"),h,"utf-8")}catch{rt(ce(l,"test_output.txt"),c,"utf-8")}return l}function yi(e,t){let n=ce(e,gn);Da(n,{recursive:!0});let r=t.map(a=>{let s=ce(n,`solver_${a.index}`);return Da(s,{recursive:!0}),rt(ce(s,"solution.diff"),a.diff,"utf-8"),rt(ce(s,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return rt(ce(n,"manifest.json"),JSON.stringify(r,null,2),"utf-8"),n}function xi(e){let t=ce(e,"node_modules");try{Pf(t).isSymbolicLink()&&di(t,{force:!0})}catch{}try{di(e,{recursive:!0,force:!0})}catch{}}var p={};Rt(p,{Assign:()=>Df,Clone:()=>bn,Create:()=>zh,Discard:()=>Bh,Metrics:()=>qe,Update:()=>Vh});var qe={assign:0,create:0,clone:0,discard:0,update:0};function Df(e,t){return qe.assign+=1,{...e,...t}}var i={};Rt(i,{Entries:()=>oh,EntriesRegExp:()=>ah,Every:()=>th,EveryAll:()=>nh,GraphemeCount:()=>Zf,HasPropertyKey:()=>rh,IsArray:()=>xn,IsBigInt:()=>yn,IsBoolean:()=>Ri,IsClassInstance:()=>Jf,IsConstructor:()=>zf,IsDeepEqual:()=>_a,IsEqual:()=>C,IsFunction:()=>Si,IsGreaterEqualThan:()=>Pi,IsGreaterThan:()=>Wf,IsInteger:()=>Ua,IsLessEqualThan:()=>Oi,IsLessThan:()=>Hf,IsMaxLength:()=>Qf,IsMinLength:()=>eh,IsMultipleOf:()=>Yf,IsNull:()=>fr,IsNumber:()=>hr,IsObject:()=>In,IsObjectNotArray:()=>Bf,IsString:()=>gr,IsSymbol:()=>Vf,IsUndefined:()=>Ka,IsUnsafePropertyKey:()=>Ci,IsValueLike:()=>Xf,Keys:()=>dr,ShiftLeft:()=>yr,Symbols:()=>ih,Values:()=>sh});function St(e,t,n){return e>=t&&e<=n}function Nf(e){return e===8205}function Gf(e){return St(e,55296,56319)}function Ii(e){return St(e,127462,127487)}function vi(e){return St(e,65024,65039)}function $i(e){return St(e,768,879)||St(e,6832,6911)||St(e,7616,7679)||St(e,65056,65071)}function lr(e){return e>65535?2:1}function bi(e,t){for(;t<e.length;){let n=e.codePointAt(t);if($i(n)||vi(n))t+=lr(n);else break}return t}function Ga(e,t){let n=e.codePointAt(t),r=t+lr(n);for(r=bi(e,r);r<e.length-1&&e[r]==="\u200D";){let a=e.codePointAt(r+1);r+=1+lr(a),r=bi(e,r)}return Ii(n)&&r<e.length&&Ii(e.codePointAt(r))&&(r+=lr(e.codePointAt(r))),r}function Ti(e){return Gf(e)||$i(e)||vi(e)||Nf(e)}function ki(e){let t=0,n=0;for(;n<e.length;)n=Ga(e,n),t++;return t}function Uf(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=Ga(e,r),n++,n>=t)return!0;return!1}function Kf(e,t){let n=0,r=0;for(;r<e.length;)if(r=Ga(e,r),n++,n>t)return!1;return!0}function wi(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Ti(e.charCodeAt(n)))return Uf(e,t);if(n++,n>=t)return!0}return!1}function Ei(e,t){let n=0;for(;n<e.length;){if(Ti(e.charCodeAt(n)))return Kf(e,t);if(n++,n>t)return!1}return!0}function xn(e){return Array.isArray(e)}function yn(e){return C(typeof e,"bigint")}function Ri(e){return C(typeof e,"boolean")}function zf(e){if(Ka(e)||!Si(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Si(e){return C(typeof e,"function")}function Ua(e){return Number.isInteger(e)}function fr(e){return C(e,null)}function hr(e){return Number.isFinite(e)}function Bf(e){return In(e)&&!xn(e)}function In(e){return C(typeof e,"object")&&!fr(e)}function gr(e){return C(typeof e,"string")}function Vf(e){return C(typeof e,"symbol")}function Ka(e){return C(e,void 0)}function C(e,t){return e===t}function Wf(e,t){return e>t}function Hf(e,t){return e<t}function Oi(e,t){return e<=t}function Pi(e,t){return e>=t}function Yf(e,t){if(yn(e)||yn(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!hr(e)||Ua(e)&&1/t%1===0)return!0;let r=e%t;return Math.min(Math.abs(r),Math.abs(r-t),Math.abs(r+t))<n}function Jf(e){if(!In(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return fr(t)?!1:C(typeof t.constructor,"function")&&!(C(t.constructor,globalThis.Object)||C(t.constructor.name,"Object"))}function Xf(e){return yn(e)||Ri(e)||fr(e)||hr(e)||gr(e)||Ka(e)}function Zf(e){return ki(e)}function Qf(e,t){return Ei(e,t)}function eh(e,t){return wi(e,t)}function th(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function nh(e,t,n){let r=!0;for(let a=t;a<e.length;a++)n(e[a],a)||(r=!1);return r}function yr(e,t,n){return C(e.length,0)?n():t(e[0],e.slice(1))}function Ci(e){return C(e,"__proto__")||C(e,"constructor")||C(e,"prototype")}function rh(e,t){return Ci(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ah(e){return dr(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function oh(e){return Object.entries(e)}function dr(e){return Object.getOwnPropertyNames(e)}function ih(e){return Object.getOwnPropertySymbols(e)}function sh(e){return Object.values(e)}function mh(e,t){if(!In(t))return!1;let n=dr(e);return C(n.length,dr(t).length)&&n.every(r=>_a(e[r],t[r]))}function ph(e,t){return xn(t)&&C(e.length,t.length)&&e.every((n,r)=>_a(e[r],t[r]))}function _a(e,t){return xn(e)?ph(e,t):In(e)?mh(e,t):C(e,t)}var ft={};Rt(ft,{IsBigInt64Array:()=>kh,IsBigUint64Array:()=>wh,IsBoolean:()=>ch,IsDate:()=>Rh,IsFloat32Array:()=>$h,IsFloat64Array:()=>Th,IsInt16Array:()=>xh,IsInt32Array:()=>bh,IsInt8Array:()=>hh,IsMap:()=>Oh,IsNumber:()=>lh,IsRegExp:()=>Eh,IsSet:()=>Sh,IsString:()=>dh,IsTypeArray:()=>fh,IsUint16Array:()=>Ih,IsUint32Array:()=>vh,IsUint8Array:()=>gh,IsUint8ClampedArray:()=>yh});function ch(e){return e instanceof Boolean}function lh(e){return e instanceof Number}function dh(e){return e instanceof String}function fh(e){return globalThis.ArrayBuffer.isView(e)}function hh(e){return e instanceof globalThis.Int8Array}function gh(e){return e instanceof globalThis.Uint8Array}function yh(e){return e instanceof globalThis.Uint8ClampedArray}function xh(e){return e instanceof globalThis.Int16Array}function Ih(e){return e instanceof globalThis.Uint16Array}function bh(e){return e instanceof globalThis.Int32Array}function vh(e){return e instanceof globalThis.Uint32Array}function $h(e){return e instanceof globalThis.Float32Array}function Th(e){return e instanceof globalThis.Float64Array}function kh(e){return e instanceof globalThis.BigInt64Array}function wh(e){return e instanceof globalThis.BigUint64Array}function Eh(e){return e instanceof globalThis.RegExp}function Rh(e){return e instanceof globalThis.Date}function Sh(e){return e instanceof globalThis.Set}function Oh(e){return e instanceof globalThis.Map}function Ch(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function Mh(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let r of Object.keys(n)){if(i.IsUnsafePropertyKey(r))continue;let a=n[r];i.HasPropertyKey(a,"value")&&Object.defineProperty(t,r,{...a,value:Ot(a.value)})}return t}function Ah(e){let t={};for(let n of i.Keys(e))i.IsUnsafePropertyKey(n)||(t[n]=Ot(e[n]));for(let n of i.Symbols(e))t[n]=Ot(e[n]);return t}function Lh(e){return i.IsClassInstance(e)?e:Ch(e)?Mh(e):Ah(e)}function qh(e){return e.map(t=>Ot(t))}function jh(e){return e.slice()}function Fh(e){return new RegExp(e.source,e.flags)}function Dh(e){return new Map(Ot([...e.entries()]))}function Nh(e){return new Set(Ot([...e.values()]))}function Ot(e){return ft.IsTypeArray(e)?jh(e):ft.IsRegExp(e)?Fh(e):ft.IsMap(e)?Dh(e):ft.IsSet(e)?Nh(e):i.IsArray(e)?qh(e):i.IsObject(e)?Lh(e):e}function bn(e){return qe.clone+=1,Ot(e)}var Pt={};Rt(Pt,{Get:()=>Kh,Reset:()=>Gh,Set:()=>Uh});var at={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Gh(){at.immutableTypes=!1,at.maxErrors=8,at.useAcceleration=!0,at.exactOptionalPropertyTypes=!1,at.enumerableKind=!1,at.correctiveParse=!1,at.unionPrioritySort=!0}function Uh(e){for(let t of i.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(at,t,{value:n})}}function Kh(){return at}function _h(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Mi(e,t){return{...e,...t}}function zh(e,t,n={}){qe.create+=1;let r=Pt.Get(),a=Mi(t,n),s=r.enumerableKind?Mi(a,e):_h(a,e);return r.immutableTypes?Object.freeze(s):s}function Bh(e,t){qe.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(bn(e)),a=new Set(t);for(let s of Object.keys(r))a.has(s)||Object.defineProperty(n,s,r[s]);return n}function Vh(e,t,n){qe.update+=1;let r=Pt.Get(),a=bn(e);for(let s of Object.keys(t))Object.defineProperty(a,s,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[s]});for(let s of Object.keys(n))Object.defineProperty(a,s,{configurable:!0,enumerable:!0,writable:!0,value:n[s]});return a}function y(e,t){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],t)}function ee(e){return i.IsObject(e)}function I(e,t,n){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function ht(e){return y(e,"Deferred")}function Wh(e){return p.Update(e,{"~readonly":!0},{})}function vn(e,t){return p.Update(Wh(e),{},t)}function Ai(e,t,n,r){let a=d(e,t,n);return vn(a,r)}function Hh(e){return p.Update(e,{"~optional":!0},{})}function $n(e,t){return p.Update(Hh(e),{},t)}function Li(e,t,n,r){let a=d(e,t,n);return $n(a,r)}function Te(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function K(e){return y(e,"Array")}function xr(e){return p.Discard(e,["~kind","type","items"])}function Ge(e,t,n={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function ne(e){return y(e,"Constructor")}function qi(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ue(e,t,n={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function re(e){return y(e,"Function")}function ji(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function ot(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function ae(e){return y(e,"Ref")}function gt(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Bt(e){return y(e,"Generic")}function Vt(e){return p.Create({"~kind":"Any"},{},e)}function J(e){return y(e,"Any")}var Fi="(?!)";function q(e){return p.Create({"~kind":"Never"},{not:{}},e)}function yt(e){return y(e,"Never")}function Ke(e,t={}){return I("AddOptional",[e],t)}function Ct(e,t={}){return $n(e,t)}function Di(e){return Ct(e)}function le(e){return ee(e)&&i.HasPropertyKey(e,"~optional")}function Ni(e){return i.Keys(e).filter(t=>!le(e[t]))}function Ir(e){return i.Keys(e)}function br(e){return i.Values(e)}function v(e,t={}){let n=Ni(e),r=n.length>0?{required:n}:{};return p.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function M(e){return y(e,"Object")}function Gi(e){return p.Discard(e,["~kind","type","properties","required"])}function oe(e){return p.Create({"~kind":"Unknown"},{},e)}function te(e){return y(e,"Unknown")}function _e(e,t,n){let r=i.Keys(e).reduce((a,s)=>({...a,[s]:p.Update(e[s],{},{$id:s})}),{});return p.Create({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function se(e){return y(e,"Cyclic")}function Ui(e){return p.Update(e,{"~unsafe":null},{})}function vr(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var ze={};Rt(ze,{Match:()=>Yh});function Yh(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function Tn(...e){let[t,n]=ze.Match(e,{2:(r,a)=>[r,a,a],1:r=>[r,oe(),oe()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function H(e){return y(e,"Infer")}function Mt(e,t,n,r={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function V(e){return y(e,"Dependent")}function Ki(e){return p.Discard(e,["~kind","if","then","else"])}function _i(e){return i.IsObjectNotArray(e)}function zi(e){return i.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function Bi(e){return i.IsString(e)||i.IsNumber(e)}function Vi(e,t){let n=_i(e)?zi(e):e;return p.Create({"~kind":"Enum"},{enum:n},t)}function fe(e){return y(e,"Enum")}function de(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function S(e){return y(e,"Intersect")}function Wi(e){return p.Discard(e,["~kind","allOf"])}function Y(){throw new Error("Unreachable")}var Hi;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(Hi||(Hi={}));var qT=BigInt("14695981039346656037"),[jT,FT]=[BigInt("1099511628211"),BigInt("18446744073709551616")],DT=Array.from({length:256}).map((e,t)=>BigInt(t)),Yi=new Float64Array(1),NT=new DataView(Yi.buffer),GT=new Uint8Array(Yi.buffer);var UT=new TextEncoder;var kn=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=$r(n)?m=>this.decode(n["~codec"].decode(m)):this.decode,a=$r(n)?m=>n["~codec"].encode(t(m)):t,s={decode:r,encode:a};return p.Update(this.type,{"~codec":s},{})}},wn=class{constructor(t){this.type=t}Decode(t){return new kn(this.type,t)}};function Tr(e){return new wn(e)}function Xi(e,t){return Tr(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function Zi(e,t){return Tr(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function $r(e){return ee(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function Qi(e){return Wt(e)}function At(e){return ee(e)&&i.HasPropertyKey(e,"~immutable")}function Be(e,t={}){return I("AddReadonly",[e],t)}function Lt(e,t={}){return vn(e,t)}function es(e){return Lt(e)}function qt(e){return ee(e)&&i.HasPropertyKey(e,"~readonly")}function Qh(e,t){let n=za(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":n},{})}function ts(...e){let[t,n,r]=ze.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return Qh(t,{check:n,error:r})}function eg(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function za(e){return ee(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>eg(t))}var ns="-?(?:0|[1-9][0-9]*)n";function En(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function Ve(e){return y(e,"BigInt")}function kr(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Se(e){return y(e,"Boolean")}function Rn(e){return p.Create({"~kind":"Identifier"},{name:e})}function rs(e){return y(e,"Identifier")}var wr="-?(?:0|[1-9][0-9]*)";function jt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function he(e){return y(e,"Integer")}var Ba=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function tg(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new Ba(e)})()}function O(e,t){return p.Create({"~kind":"Literal"},{type:tg(e),const:e},t)}function Er(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function as(e){return A(e)&&i.IsNumber(e.const)}function os(e){return A(e)&&i.IsString(e.const)}function A(e){return y(e,"Literal")}function Ht(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Yt(e){return y(e,"Null")}var Rr="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function be(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function X(e){return y(e,"Number")}function Jt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function xt(e){return y(e,"Symbol")}function Ft(...e){let[t,n,r]=ze.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,s],1:a=>[a,oe(),oe()]});return p.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function is(e){return y(e,"Parameter")}var Sr=".*";function Oe(e){return p.Create({"~kind":"String"},{type:"string"},e)}function ge(e){return y(e,"String")}function k(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return y(e,"Union")}function ss(e){return p.Discard(e,["~kind","anyOf"])}function Sn(e){let t=ms(e);return i.IsEqual(t.length,2)?t[0]:[]}function ng(e){return!0}function ps(e){return i.ShiftLeft(e,(t,n)=>rg(t)?ps(n):!1,()=>!0)}function us(e){return i.IsEqual(e.length,0)?!1:ps(e)}function rg(e){return x(e)?us(e.anyOf):A(e)?ng(e.const):!1}function Or(e){return us(e)}function Pr(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function cs(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>cs(a,t,[...n,`${r}${t}`]),()=>n)}function ag(e,t){return i.IsEqual(e.length,0)?[`${t}`]:cs(e,t)}function ls(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>ls(e,a,[...n,...ds(e,r)]),()=>n)}function ds(e,t){return x(t)?ls(e,t.anyOf):A(t)?ag(e,t.const):Y()}function fs(e,t){return i.ShiftLeft(t,(n,r)=>fs(ds(e,n),r),()=>e)}function og(e){return e.map(t=>O(t))}function ig(e){let t=fs([],e),n=og(t);return k(n)}function sg(e){return i.IsEqual(e.length,0)?Y():i.IsEqual(e.length,1)&&A(e[0])?e[0]:ig(e)}function Va(e){let t=Sn(e);return i.IsEqual(t.length,0)?Oe():Or(t)?sg(t):Pr(e)}function hs(e){let t=Va(e);return Z(t)?Oe():t}function xe(e,t){let n="object",r={[e]:t};return p.Create({"~kind":"Record"},{type:n,patternProperties:r})}function gs(e){return xe(je,e)}function ys(e){return v({true:e,false:e})}function Q(e,t={}){let[n,r,a]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:a,items:n,minItems:r},t)}function j(e){return y(e,"Tuple")}function xs(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function mg(e){return p.Discard(e,["~readonly"])}function Wa(e,t){return p.Update(mg(e),{},t)}function Is(e,t,n,r){let a=d(e,t,n);return Wa(a,r)}function bs(e,t={}){return I("RemoveReadonly",[e],t)}function vs(e,t={}){return Wa(e,t)}function pg(e){return p.Discard(e,["~optional"])}function Ha(e,t){return p.Update(pg(e),{},t)}function $s(e,t,n,r){let a=d(e,t,n);return Ha(a,r)}function Ts(e,t={}){return I("RemoveOptional",[e],t)}function Cr(e,t={}){return Ha(e,t)}function Ya(e){return e.reduceRight((n,r,a)=>({[a]:r,...n}),{})}function ks(e){let t=Ya(e.items);return v(t)}function ug(e,t){return qt(e)?!!qt(t):!1}function cg(e,t){return le(e)?!!le(t):!1}function lg(e,t){let n=ug(e,t),r=cg(e,t),a=z([e,t]),s=vs(Cr(a));return n&&r?Lt(Ct(s)):n&&!r?Lt(s):!n&&r?Ct(s):s}function dg(e,t,n){return n in e?n in t?lg(e[n],t[n]):e[n]:n in t?t[n]:q()}function fg(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((r,a)=>({...r,[a]:dg(e,t,a)}),{})}function ws(e){return M(e)?e.properties:j(e)?Ya(e.items):Y()}function Es(e,t){let n=ws(e),r=ws(t),a=fg(n,r);return v(a)}function Rs(e,t){let n=Xt(e,t);return i.IsEqual(n,Pn)?e:i.IsEqual(n,Cn)||i.IsEqual(n,On)?t:q()}function Ss(e){return M(e)||j(e)}function hg(e,t){let n=x(e),r=x(t);return n||r}function gg(e,t){let n=Pe(e),r=Pe(t),a=hg(n,r),s=Ss(n),m=Ss(r);return a?z([n,r]):s&&m?Es(n,r):s&&!m?n:!s&&m?r:Rs(n,r)}function Os(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>Os(e,a,[...n,gg(e,r)]),()=>i.IsEqual(n.length,0)?[e]:n)}function Ps(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>Ps(a,t,[...n,...Mn([r],t)]),()=>n)}function Mn(e,t=[]){return i.ShiftLeft(e,(n,r)=>x(n)?Mn(r,Ps(n.anyOf,t)):Mn(r,Os(n,t)),()=>t)}function yg(e,t){let n=me({},e,t);return b.IsExtendsTrueLike(n)?[]:[e]}function xg(e,t){return e.reduce((n,r)=>[...n,...yg(r,t)],[])}function Mr(e,t){let n=Pe(e),r=x(n)?n.anyOf:[n],a=xg(r,t);return ve(a)}function Fe(e,t,n){let r=de([e,t]),a=Mr(n,e);return ve([r,a])}function ke(e){let t=e.map(n=>O(n));return ve(t)}function z(e){let t=Mn(e),n=Ja(t);return it(n)}function Ie(e){let t=hs(e);return Pe(t)}function ve(e){let t=Ja(e);return it(t)}function Pe(e){return V(e)?Fe(e.if,e.then,e.else):fe(e)?ke(e.enum):S(e)?z(e.allOf):Z(e)?Ie(e.pattern):x(e)?ve(e.anyOf):e}function it(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?q():k(e)}function Cs(e,t){let n=ke(e);return It(n,t)}function Ms(e,t){return xe(bt,t)}function As(e,t){let n=z(e);return It(n,t)}function Ls(e,t){return i.IsString(e)||i.IsNumber(e)?v({[e]:t}):i.IsEqual(e,!1)?v({false:t}):i.IsEqual(e,!0)?v({true:t}):v({})}function qs(e,t){return xe(Zt,t)}function js(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?xe(e.pattern.toString(),t):xe(je,t)}function Fs(e,t){let n=Sn(e);return Or(n)?It(Ie(e),t):xe(e,t)}function Ig(e){return x(e)?An(e.anyOf):[e]}function An(e){return e.reduce((t,n)=>[...t,...Ig(n)],[])}function bg(e){return e.some(t=>ge(t)||X(t)||he(t))}function vg(e,t){return i.IsEqual(bg(e),!0)?xe(je,t):void 0}function $g(e,t){return e.reduce((n,r)=>A(r)&&(i.IsString(r.const)||i.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function Tg(e,t){let n=$g(e,t);return v(n)}function Ds(e,t){let n=An(e),r=vg(n,t);return ee(r)?r:Tg(n,t)}function It(e,t){return J(e)?gs(t):Se(e)?ys(t):fe(e)?Cs(e.enum,t):he(e)?Ms(e,t):S(e)?As(e.allOf,t):A(e)?Ls(e.const,t):X(e)?qs(e,t):x(e)?Ds(e.anyOf,t):ge(e)?js(e,t):Z(e)?Fs(e.pattern,t):v({})}function Xa(e,t,n){return T([e])?p.Update(It(e,t),{},n):Ar(e,t,n)}function Ns(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Xa(s,m,a)}var bt=`^${wr}$`,Zt=`^${Rr}$`,je=`^${Sr}$`;function Ar(e,t,n={}){return I("Record",[e,t],n)}function Lr(e,t,n={}){return Xa(e,t,n)}function Gs(e,t){return xe(e,t)}function qr(e){return i.IsEqual(e,je)?Oe():i.IsEqual(e,bt)?jt():i.IsEqual(e,Zt)?be():Va(e)}function Ce(e){return i.Keys(e.patternProperties)[0]}function Qt(e){let t=Ce(e);return qr(t)}function ye(e){return e.patternProperties[Ce(e)]}function pe(e){return y(e,"Record")}function Dt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function vt(e){return y(e,"Rest")}function jr(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function Fr(e){return y(e,"This")}function en(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function tn(e){return y(e,"Undefined")}function Dr(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function We(e){return y(e,"Void")}function wg(e,t){return i.IsEqual(e,"Array")?Te(t[0]):i.IsEqual(e,"Capitalize")?Gr(t[0]):i.IsEqual(e,"ConstructorParameters")?Br(t[0]):i.IsEqual(e,"Evaluate")?Kp(t[0]):i.IsEqual(e,"Exclude")?Vr(t[0],t[1]):i.IsEqual(e,"Extract")?Wr(t[0],t[1]):i.IsEqual(e,"Index")?Fn(t[0],t[1]):i.IsEqual(e,"InstanceType")?Hr(t[0]):i.IsEqual(e,"Lowercase")?Ur(t[0]):i.IsEqual(e,"NonNullable")?Yr(t[0]):i.IsEqual(e,"Omit")?Jr(t[0],t[1]):i.IsEqual(e,"Parameters")?Xr(t[0]):i.IsEqual(e,"Partial")?Zr(t[0]):i.IsEqual(e,"Pick")?Qr(t[0],t[1]):i.IsEqual(e,"Readonly")?ea(t[0]):i.IsEqual(e,"KeyOf")?Dn(t[0]):i.IsEqual(e,"Record")?Ar(t[0],t[1]):i.IsEqual(e,"Required")?ta(t[0]):i.IsEqual(e,"ReturnType")?na(t[0]):i.IsEqual(e,"Uncapitalize")?Kr(t[0]):i.IsEqual(e,"Uppercase")?_r(t[0]):jn(ot(e),t)}function Nt(){throw Error("Unreachable")}var Eg=(e,t=[])=>e.reduce((n,r)=>i.IsArray(r)&&i.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),st=e=>{let[t,n]=e;return Eg([...t,...n])};function Bs(e){return Ft(e[0],e[2],e[4])}function Vs(e){return Ft(e[0],e[2],e[2])}function Ws(e){return Ft(e[0],oe(),e[2])}function Hs(e){return Ft(e,oe(),oe())}function Ys(e){return st(e)}function Js(e){return e[1]}function Xs(e){return st(e)}function Zs(e){return e[1]}function Qs(e){return wg(e[0],e[1])}function em(e){return null}function tm(e){return Oe()}function nm(e){return be()}function rm(e){return kr()}function am(e){return en()}function om(e){return Ht()}function im(e){return jt()}function sm(e){return En()}function mm(e){return oe()}function pm(e){return Vt()}function um(e){return v({})}function cm(e){return q()}function lm(e){return Jt()}function dm(e){return Dr()}function fm(e){return jr()}function hm(e){return O(BigInt(e))}function gm(e){return O(i.IsEqual(e,"true"))}function ym(e){return O(parseFloat(e))}function xm(e){return O(e)}function Im(e){return e[1]}function bm(e){return O(e)}function vm(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function $m(e){return e[1]}function Tm(e){return Nr(e)}function km(e){return i.IsEqual(e.length,6)?Mt(e[1],e[3],e[5]):Mt(e[1],e[3],oe())}function wm(e){return e.length>0}function Em(e){return e.reduce((t,n)=>i.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function Rm(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Sm(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function Om(e){return i.IsEqual(e.length,2)?e[1]:[]}function Us(e,t){return t.reduce((n,r)=>{let a=r;return i.IsEqual(a.length,1)?Fn(n,a[0]):i.IsEqual(a.length,0)?Te(n):Nt()},e)}function Ks(e,t){return i.IsEqual(t.length,3)?zr(e,t[0],t[1],t[2]):e}function Rg(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:ra(e,t)}function Pm(e){let[t,n,r,a,s]=e;return Rg(Ks(t?Dn(Us(n,r)):Us(n,r),a),s)}function Za(e,t){return i.IsEqual(t.length,3)?(()=>{let[n,r,a]=t,s=Za(r,a);if(i.IsEqual(n,"&"))return S(s)?de([e,...s.allOf]):de([e,s]);if(i.IsEqual(n,"|"))return x(s)?k([e,...s.anyOf]):k([e,s]);Nt()})():e}function Cm(e){let[t,n]=e;return Za(t,n)}function Mm(e){let[t,n]=e;return Za(t,n)}function Am(e){return Up(e[1])}function Lm(e){return e[1]}function qm(e){return gt(e[0],e[2])}function jm(e){return i.IsEqual(e.length,4)?Tn(e[1],e[3]):i.IsEqual(e.length,2)?Tn(e[1],oe()):Nt()}function Fm(e){return`${e}`}function Dm(e){return he(e[3])?bt:X(e[3])?Zt:xt(e[3])?je:ge(e[3])?je:Nt()}function Nm(e){return e.length>0}function Gm(e){return e.length>0}function Um(e){let[t,n,r,a,s]=e;return{[n]:t&&r?Be(Ke(s)):t&&!r?Be(s):!t&&r?Ke(s):s}}function Km(e){return st(e)}function _m(e){return e.reduce((t,n)=>i.HasPropertyKey(n,bt)||i.HasPropertyKey(n,Zt)||i.HasPropertyKey(n,je)?[t[0],p.Assign(t[1],n)]:[p.Assign(t[0],n),t[1]],[{},{}])}function zm(e){return _m(e[1])}function Bm(e){let[t,n]=e,r=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return v(t,r)}function Vm(e){return i.IsEqual(e.length,5)?Be(Ke(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?Be(e[3]):Ke(e[3]):Nt()}function Wm(e){return Be(Ke(e[1]))}function Hm(e){return Be(e[1])}function Ym(e){return Ke(e[0])}function Jm(e){return i.IsEqual(e.length,2)?Dt(e[1]):i.IsEqual(e.length,1)?e[0]:Nt()}function Xm(e){return st(e)}function Zm(e){return Q(e[1])}function Qm(e){return Be(Ke(e[4]))}function ep(e){return Be(e[3])}function tp(e){return Ke(e[3])}function np(e){return e[2]}function rp(e){return i.IsEqual(e.length,2)?Dt(e[1]):i.IsEqual(e.length,1)?e[0]:Nt()}function ap(e){return st(e)}function op(e){return Ue(e[1],e[4])}function ip(e){return Ge(e[2],e[5])}function _s(e,t){return i.IsEqual(e,"remove")?bs(t):i.IsEqual(e,"add")?Be(t):t}function sp(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function zs(e,t){return i.IsEqual(e,"remove")?Ts(t):i.IsEqual(e,"add")?Ke(t):t}function mp(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function pp(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function up(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?Ln(Rn(e[3]),e[5],e[6][0],_s(e[1],zs(e[8],e[10]))):Ln(Rn(e[3]),e[5],ot(e[3]),_s(e[1],zs(e[8],e[10])))}function cp(e){return ot(e)}function lp(e){return BigInt(e)}function dp(e){return parseFloat(e)}function fp(e){return i.IsEqual(e,"true")}function hp(e){return null}function gp(e){return{[e[0]]:e[2]}}function yp(e){return st(e)}function Sg(e){return e.reduce((t,n)=>p.Assign(t,n),{})}function xp(e){return Sg(e[1])}function Ip(e){return st(e)}function bp(e){return e[1]}function vp(e){return En()}function $p(e){return Oe()}function Tp(e){return be()}function kp(e){return jt()}function wp(e){return q()}function Ep(e){return O(e)}function Rp(e){return k(e[1])}function Sp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Op(e){return[e[0],...e[1]]}function Pp(e){return e[1]}function Cp(e){return st(e)}function Mp(e){return i.IsEqual(e.length,2)?e[1]:[]}function Ap(e){let t=e[2],n=e[3],[r,a]=e[4],s=i.IsEqual(i.Keys(a).length,0)?{}:{patternProperties:a};return{[e[1]]:gt(t,qn(n,r,s))}}function Lp(e){let t=e[2],[n,r]=e[3],a=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:qn(t,n,a)}}function qp(e){return{[e[1]]:gt(e[2],e[4])}}function jp(e){return{[e[1]]:e[3]}}function Fp(e){return null}function Dp(e){return _m(st(e))}function Np(e){return e[1]}function Gp(e){let t=e[0],n=e[1];return _p(p.Assign(t,n[0]))}function Nn(e){return C(e.length,2)}function E(e,t,n){return Nn(e)?t(e[0],e[1]):n()}function Cg(e,t){return C(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function B(e,t){for(let n=0;n<e.length;n++){let r=Cg(e[n],t);if(Nn(r))return r}return[]}function Qa(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var zp=[...Qa(97,122),...Qa(65,90)],eo="0",to=Qa(49,57),nn=[eo,...to],Bp=" ",rn=`
6
- `;var $t="_",aa=".",Vp="$",oa="-";var Wp="//",Hp="/*",Ag="*/";function Yp(e){let t=e.indexOf(Ag);return C(t,-1)?"":e.slice(t+2)}function Jp(e){let t=e.indexOf(rn);return C(t,-1)?"":e.slice(t)}function Lg(e){return e.replace(/^[ \t\r\f\v]+/,"")}function ia(e){let t=Lg(e);return t.startsWith(Hp)?ia(Yp(t.slice(2))):t.startsWith(Wp)?ia(Jp(t.slice(2))):t}function ie(e){let t=e.trimStart();return t.startsWith(Hp)?ie(Yp(t.slice(2))):t.startsWith(Wp)?ie(Jp(t.slice(2))):t}function sa(e,t){return E(B([e],t),(n,r)=>[n,r],()=>["",t])}function qg(e,t){return e.includes(t)}function an(e,t,n,r=""){return E(B(e,n),(a,s)=>qg(t,a)?an(e,t,s,r):an(e,t,s,`${r}${a}`),()=>[r,n])}function jg(e){return B(to,e)}var Fg=[...nn,$t];function Dg(e){return an(Fg,[$t],e)}function Ng(e){return E(B([eo],e),(t,n)=>[t,n],()=>E(jg(e),(t,n)=>E(Dg(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[]))}function ma(e){return Ng(ie(e))}function Gg(e){return sa(oa,e)}function Ug(e){return E(Gg(e),(t,n)=>E(ma(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function Xp(e){return Ug(ie(e))}function Kg(e){return E(Xp(e),(t,n)=>E(B(["n"],n),(r,a)=>[`${t}`,a],()=>[]),()=>[])}function no(e){return Kg(e)}function ro(e,t){return B([e],t)}function u(e,t){return C(e,"")?["",t]:e.startsWith(rn)?ro(e,ia(t)):e.startsWith(Bp)?ro(e,t):ro(e,ie(t))}var Zp=[...zp,$t,Vp];function _g(e){return B(Zp,e)}var zg=[...Zp,...nn];function Qp(e,t=""){return E(B(zg,e),(n,r)=>Qp(r,`${t}${n}`),()=>[t,e])}function Bg(e){return E(_g(e),(t,n)=>E(Qp(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function W(e){return Bg(ie(e))}var Vg=[...nn,$t];function Wg(e){return Nn(B([aa],e))}function eu(e){return E(an(Vg,[$t],e),(t,n)=>C(t,"")?[]:[t,n],()=>[])}function Hg(e){return E(B([aa],e),(t,n)=>E(eu(n),(r,a)=>[`0${t}${r}`,a],()=>[]),()=>[])}function Yg(e){return E(ma(e),(t,n)=>E(B([aa],n),(r,a)=>E(eu(a),(s,m)=>[`${t}${r}${s}`,m],()=>[`${t}`,a]),()=>[`${t}`,n]),()=>[])}function Jg(e){return Wg(e)?Hg(e):Yg(e)}function tu(e){return Jg(ie(e))}function Xg(e){return sa(oa,e)}function Zg(e){return E(Xg(e),(t,n)=>E(tu(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function pa(e){return Zg(ie(e))}function Qg(e){return C(e,"")?[]:[e.slice(0,1),e.slice(1)]}function nu(e,t){return yr(e,(n,r)=>t.startsWith(n)?!0:nu(r,t),()=>!1)}function Tt(e,t,n=""){return E(Qg(t),(r,a)=>nu(e,t)?[n,t]:Tt(e,a,`${n}${r}`),()=>[])}function ey(e,t,n){return E(B([e],n),(r,a)=>E(Tt([t],a),(s,m)=>E(B([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function ty(e,t,n){return E(B([e],n),(r,a)=>E(Tt([rn,t],a),(s,m)=>E(B([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function ru(e,t,n,r){return n?ey(e,t,ie(r)):ty(e,t,ie(r))}function ny(e,t){return B(e,t)}function ry(e,t){return ru(e,e,!1,t)}function ay(e,t){return E(ny(e,t),(n,r)=>ry(n,`${n}${r}`),()=>[])}function ua(e,t){return ay(e,ie(t))}function au(e,t){return E(Tt(e,t),(n,r)=>C(n,"")?[]:[n,r],()=>[])}var o=(e,t,n=()=>[])=>e.length===2?t(e):n(),iy=e=>o(o(W(e),([t,n])=>o(u("extends",n),([r,a])=>o(R(a),([s,m])=>o(u("=",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Bs(t),n]),sy=e=>o(o(W(e),([t,n])=>o(u("extends",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Vs(t),n]),my=e=>o(o(W(e),([t,n])=>o(u("=",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Ws(t),n]),py=e=>o(W(e),([t,n])=>[Hs(t),n]),su=e=>o(o(iy(e),([t,n])=>[t,n],()=>o(sy(e),([t,n])=>[t,n],()=>o(my(e),([t,n])=>[t,n],()=>o(py(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),mu=(e,t=[])=>o(o(su(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>mu(r,[...t,n]),()=>[t,e]),uy=e=>o(o(mu(e),([t,n])=>o(o(o(su(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Ys(t),n]),io=e=>o(o(u("<",e),([t,n])=>o(uy(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Js(t),n]),pu=(e,t=[])=>o(o(R(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>pu(r,[...t,n]),()=>[t,e]),cy=e=>o(o(pu(e),([t,n])=>o(o(o(R(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Xs(t),n]),ly=e=>o(o(u("<",e),([t,n])=>o(cy(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Zs(t),n]),dy=e=>o(o(W(e),([t,n])=>o(ly(n),([r,a])=>[[t,r],a])),([t,n])=>[Qs(t),n]),uu=e=>o(o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[em(t),n]),cu=e=>o(u("string",e),([t,n])=>[tm(t),n]),lu=e=>o(u("number",e),([t,n])=>[nm(t),n]),fy=e=>o(u("boolean",e),([t,n])=>[rm(t),n]),hy=e=>o(u("undefined",e),([t,n])=>[am(t),n]),gy=e=>o(u("null",e),([t,n])=>[om(t),n]),du=e=>o(u("integer",e),([t,n])=>[im(t),n]),yy=e=>o(u("bigint",e),([t,n])=>[sm(t),n]),xy=e=>o(u("unknown",e),([t,n])=>[mm(t),n]),Iy=e=>o(u("any",e),([t,n])=>[pm(t),n]),by=e=>o(u("object",e),([t,n])=>[um(t),n]),vy=e=>o(u("never",e),([t,n])=>[cm(t),n]),fu=e=>o(u("symbol",e),([t,n])=>[lm(t),n]),$y=e=>o(u("void",e),([t,n])=>[dm(t),n]),Ty=e=>o(u("this",e),([t,n])=>[fm(t),n]),ky=e=>o(o(u("${",e),([t,n])=>o(R(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Im(t),n]),ao=e=>o(Tt(["${","`"],e),([t,n])=>[bm(t),n]),hu=e=>o(o(o(ao(e),([t,n])=>o(ky(n),([r,a])=>o(hu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(ao(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(ao(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[vm(t),n]),so=e=>o(o(u("`",e),([t,n])=>o(hu(n),([r,a])=>o(u("`",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[$m(t),n]),wy=e=>o(so(e),([t,n])=>[Tm(t),n]),Ey=e=>o(o(o(u("if",e),([t,n])=>o(R(n),([r,a])=>o(u("then",a),([s,m])=>o(R(m),([c,l])=>o(u("else",l),([h,f])=>o(R(f),([w,D])=>[[t,r,s,c,h,w],D])))))),([t,n])=>[t,n],()=>o(o(u("if",e),([t,n])=>o(R(n),([r,a])=>o(u("then",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[km(t),n]),Ry=e=>o(no(e),([t,n])=>[hm(t),n]),Sy=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[gm(t),n]),Oy=e=>o(pa(e),([t,n])=>[ym(t),n]),Py=e=>o(ua(["'",'"'],e),([t,n])=>[xm(t),n]),Cy=e=>o(o(o(u("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[wm(t),n]),gu=(e,t=[])=>o(o(o(u("[",e),([n,r])=>o(R(r),([a,s])=>o(u("]",s),([m,c])=>[[n,a,m],c]))),([n,r])=>[n,r],()=>o(o(u("[",e),([n,r])=>o(u("]",r),([a,s])=>[[n,a],s])),([n,r])=>[n,r],()=>[])),([n,r])=>gu(r,[...t,n]),()=>[t,e]),My=e=>o(gu(e),([t,n])=>[Em(t),n]),Ay=e=>o(o(o(u("extends",e),([t,n])=>o(R(n),([r,a])=>o(u("?",a),([s,m])=>o(R(m),([c,l])=>o(u(":",l),([h,f])=>o(R(f),([w,D])=>[[t,r,s,c,h,w],D])))))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Rm(t),n]),Ly=e=>o(o(o(u("(",e),([t,n])=>o(R(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(cu(e),([t,n])=>[t,n],()=>o(lu(e),([t,n])=>[t,n],()=>o(fy(e),([t,n])=>[t,n],()=>o(hy(e),([t,n])=>[t,n],()=>o(gy(e),([t,n])=>[t,n],()=>o(du(e),([t,n])=>[t,n],()=>o(yy(e),([t,n])=>[t,n],()=>o(xy(e),([t,n])=>[t,n],()=>o(Iy(e),([t,n])=>[t,n],()=>o(by(e),([t,n])=>[t,n],()=>o(vy(e),([t,n])=>[t,n],()=>o(fu(e),([t,n])=>[t,n],()=>o($y(e),([t,n])=>[t,n],()=>o(Ty(e),([t,n])=>[t,n],()=>o(Ry(e),([t,n])=>[t,n],()=>o(Sy(e),([t,n])=>[t,n],()=>o(Oy(e),([t,n])=>[t,n],()=>o(Py(e),([t,n])=>[t,n],()=>o(wy(e),([t,n])=>[t,n],()=>o(Ey(e),([t,n])=>[t,n],()=>o(Wy(e),([t,n])=>[t,n],()=>o(Qy(e),([t,n])=>[t,n],()=>o(ox(e),([t,n])=>[t,n],()=>o(ax(e),([t,n])=>[t,n],()=>o(px(e),([t,n])=>[t,n],()=>o(dy(e),([t,n])=>[t,n],()=>o(ux(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[Sm(t),n]),qy=e=>o(o(o(u("with",e),([t,n])=>o(Mu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Om(t),n]),yu=e=>o(o(Cy(e),([t,n])=>o(Ly(n),([r,a])=>o(My(a),([s,m])=>o(Ay(m),([c,l])=>o(qy(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Pm(t),n]),xu=e=>o(o(o(u("&",e),([t,n])=>o(yu(n),([r,a])=>o(xu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Iu=e=>o(o(yu(e),([t,n])=>o(xu(n),([r,a])=>[[t,r],a])),([t,n])=>[Cm(t),n]),bu=e=>o(o(o(u("|",e),([t,n])=>o(Iu(n),([r,a])=>o(bu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ca=e=>o(o(Iu(e),([t,n])=>o(bu(n),([r,a])=>[[t,r],a])),([t,n])=>[Mm(t),n]),jy=e=>o(o(u("readonly",e),([t,n])=>o(ca(n),([r,a])=>[[t,r],a])),([t,n])=>[Am(t),n]),Fy=e=>o(o(u("|",e),([t,n])=>o(ca(n),([r,a])=>[[t,r],a])),([t,n])=>[Lm(t),n]),Dy=e=>o(o(io(e),([t,n])=>o(u("=",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[qm(t),n]),Ny=e=>o(o(o(u("infer",e),([t,n])=>o(W(n),([r,a])=>o(u("extends",a),([s,m])=>o(ca(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(u("infer",e),([t,n])=>o(W(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>[])),([t,n])=>[jm(t),n]),R=e=>o(o(Ny(e),([t,n])=>[t,n],()=>o(Fy(e),([t,n])=>[t,n],()=>o(jy(e),([t,n])=>[t,n],()=>o(ca(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Gy=e=>o(pa(e),([t,n])=>[Fm(t),n]),Uy=e=>o(W(e),([t,n])=>[t,n]),Ky=e=>o(ua(["'",'"'],e),([t,n])=>[t,n]),_y=e=>o(o(u("[",e),([t,n])=>o(W(n),([r,a])=>o(u(":",a),([s,m])=>o(o(du(m),([c,l])=>[c,l],()=>o(lu(m),([c,l])=>[c,l],()=>o(cu(m),([c,l])=>[c,l],()=>o(fu(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Dm(t),n]),vu=e=>o(o(Gy(e),([t,n])=>[t,n],()=>o(Uy(e),([t,n])=>[t,n],()=>o(Ky(e),([t,n])=>[t,n],()=>o(_y(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),zy=e=>o(o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Nm(t),n]),By=e=>o(o(o(u("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Gm(t),n]),$u=e=>o(o(zy(e),([t,n])=>o(vu(n),([r,a])=>o(By(a),([s,m])=>o(u(":",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Um(t),n]),Tu=e=>o(o(o(u(",",e),([t,n])=>o(u(`
7
- `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>o(u(`
8
- `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(u(`
9
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),ku=(e,t=[])=>o(o($u(e),([n,r])=>o(Tu(r),([a,s])=>[[n,a],s])),([n,r])=>ku(r,[...t,n]),()=>[t,e]),Vy=e=>o(o(ku(e),([t,n])=>o(o(o($u(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Km(t),n]),mo=e=>o(o(u("{",e),([t,n])=>o(Vy(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[zm(t),n]),Wy=e=>o(mo(e),([t,n])=>[Bm(t),n]),Hy=e=>o(o(o(W(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(u(":",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[Vm(t),n]),Yy=e=>o(o(u("readonly",e),([t,n])=>o(R(n),([r,a])=>o(u("?",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Wm(t),n]),Jy=e=>o(o(u("readonly",e),([t,n])=>o(R(n),([r,a])=>[[t,r],a])),([t,n])=>[Hm(t),n]),Xy=e=>o(o(R(e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[Ym(t),n]),ou=e=>o(o(Hy(e),([t,n])=>[t,n],()=>o(Yy(e),([t,n])=>[t,n],()=>o(Jy(e),([t,n])=>[t,n],()=>o(Xy(e),([t,n])=>[t,n],()=>o(R(e),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),wu=e=>o(o(o(u("...",e),([t,n])=>o(ou(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(ou(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[Jm(t),n]),Eu=(e,t=[])=>o(o(wu(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Eu(r,[...t,n]),()=>[t,e]),Zy=e=>o(o(Eu(e),([t,n])=>o(o(o(wu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Xm(t),n]),Qy=e=>o(o(u("[",e),([t,n])=>o(Zy(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Zm(t),n]),ex=e=>o(o(W(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Qm(t),n]),tx=e=>o(o(W(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[ep(t),n]),nx=e=>o(o(W(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[tp(t),n]),rx=e=>o(o(W(e),([t,n])=>o(u(":",n),([r,a])=>o(R(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[np(t),n]),iu=e=>o(o(ex(e),([t,n])=>[t,n],()=>o(tx(e),([t,n])=>[t,n],()=>o(nx(e),([t,n])=>[t,n],()=>o(rx(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Ru=e=>o(o(o(u("...",e),([t,n])=>o(iu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(iu(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[rp(t),n]),Su=(e,t=[])=>o(o(Ru(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Su(r,[...t,n]),()=>[t,e]),Ou=e=>o(o(Su(e),([t,n])=>o(o(o(Ru(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[ap(t),n]),ax=e=>o(o(u("(",e),([t,n])=>o(Ou(n),([r,a])=>o(u(")",a),([s,m])=>o(u("=>",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[op(t),n]),ox=e=>o(o(u("new",e),([t,n])=>o(u("(",n),([r,a])=>o(Ou(a),([s,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([h,f])=>o(R(f),([w,D])=>[[t,r,s,c,h,w],D])))))),([t,n])=>[ip(t),n]),ix=e=>o(o(o(u("+",e),([t,n])=>o(u("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("-",e),([t,n])=>o(u("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[sp(t),n]),sx=e=>o(o(o(u("+",e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("-",e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[mp(t),n]),mx=e=>o(o(o(u("as",e),([t,n])=>o(R(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[pp(t),n]),px=e=>o(o(u("{",e),([t,n])=>o(ix(n),([r,a])=>o(u("[",a),([s,m])=>o(W(m),([c,l])=>o(u("in",l),([h,f])=>o(R(f),([w,D])=>o(mx(D),([_,ue])=>o(u("]",ue),([Me,Re])=>o(sx(Re),([De,Qe])=>o(u(":",Qe),([N,et])=>o(R(et),([Ne,pt])=>o(uu(pt),([tt,ut])=>o(u("}",ut),([zt,ct])=>[[t,r,s,c,h,w,_,Me,De,N,Ne,tt,zt],ct]))))))))))))),([t,n])=>[up(t),n]),ux=e=>o(W(e),([t,n])=>[cp(t),n]),cx=e=>o(no(e),([t,n])=>[lp(t),n]),lx=e=>o(pa(e),([t,n])=>[dp(t),n]),dx=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[fp(t),n]),fx=e=>o(ua(['"',"'"],e),([t,n])=>[t,n]),hx=e=>o(u("null",e),([t,n])=>[hp(t),n]),gx=e=>o(u("undefined",e),([t,n])=>[void 0,n]),Pu=e=>o(o(vu(e),([t,n])=>o(u(":",n),([r,a])=>o(po(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[gp(t),n]),Cu=(e,t=[])=>o(o(Pu(e),([n,r])=>o(Tu(r),([a,s])=>[[n,a],s])),([n,r])=>Cu(r,[...t,n]),()=>[t,e]),yx=e=>o(o(Cu(e),([t,n])=>o(o(o(Pu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[yp(t),n]),Mu=e=>o(o(u("{",e),([t,n])=>o(yx(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[xp(t),n]),Au=(e,t=[])=>o(o(po(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Au(r,[...t,n]),()=>[t,e]),xx=e=>o(o(Au(e),([t,n])=>o(o(o(po(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Ip(t),n]),Ix=e=>o(o(u("[",e),([t,n])=>o(xx(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[bp(t),n]),po=e=>o(o(cx(e),([t,n])=>[t,n],()=>o(lx(e),([t,n])=>[t,n],()=>o(dx(e),([t,n])=>[t,n],()=>o(fx(e),([t,n])=>[t,n],()=>o(hx(e),([t,n])=>[t,n],()=>o(gx(e),([t,n])=>[t,n],()=>o(Mu(e),([t,n])=>[t,n],()=>o(Ix(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),bx=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[vp(t),n]),vx=e=>o(u(".*",e),([t,n])=>[$p(t),n]),$x=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[Tp(t),n]),Tx=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[kp(t),n]),kx=e=>o(u("(?!)",e),([t,n])=>[wp(t),n]),wx=e=>o(au(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[Ep(t),n]),Ex=e=>o(o(bx(e),([t,n])=>[t,n],()=>o(vx(e),([t,n])=>[t,n],()=>o($x(e),([t,n])=>[t,n],()=>o(Tx(e),([t,n])=>[t,n],()=>o(kx(e),([t,n])=>[t,n],()=>o(Rx(e),([t,n])=>[t,n],()=>o(wx(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),Rx=e=>o(o(u("(",e),([t,n])=>o(uo(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Rp(t),n]),Lu=e=>o(o(o(oo(e),([t,n])=>o(u("|",n),([r,a])=>o(Lu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(oo(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[Sp(t),n]),oo=e=>o(o(Ex(e),([t,n])=>o(uo(n),([r,a])=>[[t,r],a])),([t,n])=>[Op(t),n]),uo=e=>o(o(Lu(e),([t,n])=>[t,n],()=>o(oo(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ms=e=>o(o(u("^",e),([t,n])=>o(uo(n),([r,a])=>o(u("$",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Pp(t),n]),qu=(e,t=[])=>o(o(R(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>qu(r,[...t,n]),()=>[t,e]),Sx=e=>o(o(qu(e),([t,n])=>o(o(o(R(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Cp(t),n]),ju=e=>o(o(o(u("extends",e),([t,n])=>o(Sx(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Mp(t),n]),Ox=e=>o(o(u("interface",e),([t,n])=>o(W(n),([r,a])=>o(io(a),([s,m])=>o(ju(m),([c,l])=>o(mo(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[Ap(t),n]),Px=e=>o(o(u("interface",e),([t,n])=>o(W(n),([r,a])=>o(ju(a),([s,m])=>o(mo(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[Lp(t),n]),Cx=e=>o(o(u("type",e),([t,n])=>o(W(n),([r,a])=>o(io(a),([s,m])=>o(u("=",m),([c,l])=>o(R(l),([h,f])=>[[t,r,s,c,h],f]))))),([t,n])=>[qp(t),n]),Mx=e=>o(o(u("type",e),([t,n])=>o(W(n),([r,a])=>o(u("=",a),([s,m])=>o(R(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[jp(t),n]),Ax=e=>o(o(o(u("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Fp(t),n]),Lx=e=>o(o(o(u(";",e),([t,n])=>o(u(`
10
- `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(u(`
11
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),Fu=(e,t=[])=>o(o(co(e),([n,r])=>o(Lx(r),([a,s])=>[[n,a],s])),([n,r])=>Fu(r,[...t,n]),()=>[t,e]),qx=e=>o(o(Fu(e),([t,n])=>o(o(o(co(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Dp(t),n]),co=e=>o(o(Ax(e),([t,n])=>o(o(Ox(n),([r,a])=>[r,a],()=>o(Px(n),([r,a])=>[r,a],()=>o(Cx(n),([r,a])=>[r,a],()=>o(Mx(n),([r,a])=>[r,a],()=>[])))),([r,a])=>o(uu(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Np(t),n]),jx=e=>o(o(co(e),([t,n])=>o(qx(n),([r,a])=>[[t,r],a])),([t,n])=>[Gp(t),n]),Du=e=>o(o(jx(e),([t,n])=>[t,n],()=>o(Dy(e),([t,n])=>[t,n],()=>o(R(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function Nu(e){let t=so(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:Y()}function Dx(e){return e.join("|")}function Nx(e){return e.slice(1,e.length-1)}function Gx(e,t,n){return kt(t,`${n}${e}`)}function Ux(e,t){return kt(e,`${t}${ns}`)}function Kx(e,t){return kt(e,`${t}${wr}`)}function _x(e,t){return kt(e,`${t}${Rr}`)}function zx(e,t){return Gn(k([O("false"),O("true")]),e,t)}function Bx(e,t){return kt(e,`${t}${Sr}`)}function Vx(e,t,n){return kt(t,`${n}${Nx(e)}`)}function Wx(e,t,n){let r=Un(e,{});return Gn(r,t,n)}function Hx(e,t,n){let r=ke(e);return Gn(r,t,n)}function Gu(e,t,n,r=[]){return i.ShiftLeft(e,(a,s)=>Gu(s,t,n,[...r,Gn(a,[],"")]),()=>kt(t,`${n}(${Dx(r)})`))}function Gn(e,t,n){return fe(e)?Hx(e.enum,t,n):he(e)?Kx(t,n):A(e)?Gx(e.const,t,n):Ve(e)?Ux(t,n):Se(e)?zx(t,n):X(e)?_x(t,n):ge(e)?Bx(t,n):Z(e)?Vx(e.pattern,t,n):Ku(e)?Wx(e.parameters[0],t,n):x(e)?Gu(e.anyOf,t,n):Fi}function kt(e,t){return i.ShiftLeft(e,(n,r)=>Gn(n,r,t),()=>t)}function Yx(e){return`^${kt(e,"")}$`}function Uu(e){let t=Yx(e);return Pr(t)}function Un(e,t){return T(e)?p.Update(Uu(e),{},t):Nr(e,t)}function _u(e,t,n,r){let a=we(e,t,n);return Un(a,r)}function Nr(e,t={}){return I("TemplateLiteral",[e],t)}function Ku(e){return ee(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function zu(e){return Un(e,{})}function Jx(e){let t=Nu(e);return zu(t)}function Bu(e,t={}){let n=i.IsString(e)?Jx(e):zu(e);return p.Update(n,{},t)}function Z(e){return y(e,"TemplateLiteral")}var b={};Rt(b,{ExtendsFalse:()=>$,ExtendsTrue:()=>g,ExtendsUnion:()=>lo,IsExtendsFalse:()=>Xx,IsExtendsTrue:()=>Wu,IsExtendsTrueLike:()=>on,IsExtendsUnion:()=>Vu,Match:()=>U});function lo(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Vu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsUnion")&&i.IsObject(e.inferred)}function g(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function Wu(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function $(){return p.Create({"~kind":"ExtendsFalse"},{})}function Xx(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function on(e){return Vu(e)||Wu(e)}function U(e,t,n){return on(e)?t(e.inferred):n()}function Zx(e,t,n,r){return U(P(e,n,r),a=>g(p.Assign(p.Assign(e,a),{[t]:n})),()=>$())}function Qx(e,t){return g(e)}function eI(e,t,n,r,a){return U(P(e,t,n),s=>U(P(s,t,r),m=>g(m),()=>$()),()=>U(P(e,t,a),s=>g(s),()=>$()))}function tI(e,t,n){let r=ke(n);return P(e,t,r)}function Hu(e,t,n){return i.ShiftLeft(n,(r,a)=>U(P(e,t,r),s=>Hu(s,t,a),()=>$()),()=>g(e))}function nI(e,t,n){let r=Ie(n);return P(e,t,r)}function Yu(e,t,n){return i.ShiftLeft(n,(r,a)=>U(P(e,t,r),s=>g(s),()=>Yu(e,t,a)),()=>$())}function L(e,t,n){return J(n)?Qx(e,t):V(n)?eI(e,t,n.if,n.then,n.else):fe(n)?tI(e,t,n.enum):H(n)?Zx(e,n.name,t,n.extends):S(n)?Hu(e,t,n.allOf):Z(n)?nI(e,t,n.pattern):x(n)?Yu(e,t,n.anyOf):te(n)?g(e):$()}function Ju(e,t,n){return H(n)?L(e,t,n):J(n)?g(e):te(n)?g(e):lo(e)}function rI(e,t){let n=At(e),r=At(t);return n&&r||!n&&r?!0:!(n&&!r)}function Xu(e,t,n,r){return K(r)?rI(t,r)?P(e,n,r.items):$():L(e,t,r)}function Zu(e,t,n){return Ve(n)?g(e):L(e,t,n)}function Qu(e,t,n){return Se(n)?g(e):L(e,t,n)}function aI(e,t,n,r,a){let s=H(r)?t:r,m=H(r)?r:t,c=le(t),l=le(r);return!c&&l?$():U(P(e,s,m),h=>Kn(h,n,a),()=>$())}function oI(e,t,n,r){return i.ShiftLeft(r,(a,s)=>aI(e,t,n,a,s),()=>le(t)?g(e):$())}function iI(e,t,n){return i.ShiftLeft(t,(r,a)=>oI(e,r,a,n),()=>g(e))}function Kn(e,t,n){return iI(e,t,n)}function la(e,t,n){return We(n)?g(e):P(e,t,n)}function ec(e,t,n,r){return J(r)?g(e):te(r)?g(e):ne(r)?U(Kn(e,t,r.parameters),a=>la(a,n,r.instanceType),()=>$()):$()}function tc(e,t,n,r,a){return U(P(e,t,a),()=>P(e,n,a),()=>P(e,r,a))}function nc(e,t,n){let r=ke(t);return P(e,r,n)}function rc(e,t,n,r){return J(r)?g(e):te(r)?g(e):re(r)?U(Kn(e,t,r.parameters),a=>la(a,n,r.returnType),()=>$()):$()}function ac(e,t,n){return he(n)?g(e):X(n)?g(e):L(e,t,n)}function oc(e,t,n){let r=z(t);return P(e,r,n)}function da(e,t,n){return t===n?g(e):$()}function sI(e,t,n){return A(n)?da(e,t,n.const):Ve(n)?g(e):L(e,O(t),n)}function mI(e,t,n){return A(n)?da(e,t,n.const):Se(n)?g(e):L(e,O(t),n)}function pI(e,t,n){return A(n)?da(e,t,n.const):X(n)?g(e):L(e,O(t),n)}function uI(e,t,n){return A(n)?da(e,t,n.const):ge(n)?g(e):L(e,O(t),n)}function ic(e,t,n){return i.IsBigInt(t.const)?sI(e,t.const,n):i.IsBoolean(t.const)?mI(e,t.const,n):i.IsNumber(t.const)?pI(e,t.const,n):i.IsString(t.const)?uI(e,t.const,n):Y()}function sc(e,t,n){return H(n)?L(e,t,n):g(e)}function mc(e,t,n){return Yt(n)?g(e):L(e,t,n)}function pc(e,t,n){return X(n)?g(e):L(e,t,n)}function cI(e,t,n){return le(t)?le(n)?g(e):$():g(e)}function lI(e,t,n){return H(n)&&yt(n.extends)?$():U(P(e,t,n),r=>cI(r,t,n),()=>$())}function dI(e,t){return e.reduce((n,r)=>r in t?on(t[r])?{...n,...t[r].inferred}:Y():Y(),{})}function fI(e,t,n){let r={};for(let m of i.Keys(n))r[m]=m in t?lI({},t[m],n[m]):le(n[m])?H(n[m])?g(p.Assign(e,{[n[m].name]:n[m].extends})):g(e):$();let a=i.Values(r).every(m=>on(m)),s=a?dI(i.Keys(r),r):{};return a?g(s):$()}function hI(e,t,n){let r=fI(e,t,n);return on(r)?g(p.Assign(e,r.inferred)):$()}function gI(e,t,n){return hI(e,t,n)}function yI(e,t){return i.Keys(t).reduce((n,r)=>({...n,[r]:i.HasPropertyKey(e,r)?x(n[r])?k([...n[r].anyOf,t[r]]):k([e[r],t[r]]):t[r]}),e)}function uc(e,t,n,r){return i.ShiftLeft(t,(a,s)=>U(P({},e[a],n),m=>uc(e,s,n,yI(r,m)),()=>$()),()=>g(r))}function xI(e,t,n,r){let a=i.Keys(t);return uc(t,a,r,e)}function cc(e,t,n){return pe(n)?xI(e,t,Ce(n),ye(n)):M(n)?gI(e,t,n.properties):L(e,v(t),n)}function II(e,t){return i.IsEqual(i.Keys(t).length,0)?g(e):$()}function bI(e,t,n,r,a){return P(e,n,a)}function lc(e,t,n,r){return pe(r)?bI(e,qr(t),n,qr(Ce(r)),ye(r)):M(r)?II(e,r.properties):J(r)?g(e):te(r)?g(e):$()}function dc(e,t,n){return ge(n)?g(e):L(e,t,n)}function fc(e,t,n){return xt(n)?g(e):L(e,t,n)}function hc(e,t,n){let r=Ie(t);return P(e,r,n)}function fo(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function _n(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"name")&&i.HasPropertyKey(e,"type")&&i.IsEqual(e["~kind"],"Inferrable")&&i.IsString(e.name)&&i.IsObject(e.type)}function ho(e){return vt(e)?H(e.items)?K(e.items.extends)?fo(e.items.name,e.items.extends.items):te(e.items.extends)?fo(e.items.name,e.items.extends):void 0:Y():void 0}function fa(e){return H(e)?fo(e.name,e.extends):void 0}function go(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>U(P({},r,t),()=>go(a,t,[...n,r]),()=>{}),()=>n)}function gc(e,t,n,r){let a=go(n,r);return i.IsArray(a)?g(p.Assign(e,{[t]:Q(a)})):$()}function ha(e,t,n,r){let a=go(n,r);return i.IsArray(a)?g(p.Assign(e,{[t]:k(a)})):$()}function vI(e){return[...e].reverse()}function yo(e,t){return t?vI(e):e}function $I(e){let t=e.length>0?e[0]:void 0,n=ee(t)?ho(t):void 0;return ee(n)}function TI(e,t,n,r,a,s){return U(P(e,n,a),m=>yc(m,t,r,s),()=>$())}function kI(e,t,n,r,a){let s=ho(r);return _n(s)?gc(e,s.name,yo(n,t),s.type):i.ShiftLeft(n,(m,c)=>TI(e,t,m,c,r,a),()=>$())}function wI(e,t,n,r){return i.ShiftLeft(r,(a,s)=>kI(e,t,n,a,s),()=>i.IsEqual(n.length,0)?g(e):$())}function yc(e,t,n,r){return wI(e,t,n,r)}function EI(e,t,n){let r=wt(e,G([],[]),n),a=$I(r);return yc(e,a,yo(t,a),yo(r,a))}function xc(e,t,n){let r=fa(n);return _n(r)?ha(e,r.name,t,r.type):i.ShiftLeft(t,(a,s)=>U(P(e,a,n),m=>xc(m,s,n),()=>$()),()=>g(e))}function Ic(e,t,n){let r=wt(e,G([],[]),t);return j(n)?EI(e,r,n.items):K(n)?xc(e,r,n.items):L(e,Q(r),n)}function bc(e,t,n){return We(n)?g(e):tn(n)?g(e):L(e,t,n)}function vc(e,t,n){return i.ShiftLeft(n,(r,a)=>U(P(e,t,r),s=>g(s),()=>vc(e,t,a)),()=>$())}function xo(e,t,n){return i.ShiftLeft(t,(r,a)=>U(vc(e,r,n),s=>xo(s,a,n),()=>$()),()=>g(e))}function $c(e,t,n){let r=fa(n);return _n(r)?ha(e,r.name,t,r.type):x(n)?xo(e,t,n.anyOf):xo(e,t,[n])}function Tc(e,t,n){return H(n)?L(e,t,n):J(n)?g(e):te(n)?g(e):$()}function kc(e,t,n){return We(n)?g(e):L(e,t,n)}function P(e,t,n){return J(t)?Ju(e,t,n):K(t)?Xu(e,t,t.items,n):Ve(t)?Zu(e,t,n):Se(t)?Qu(e,t,n):ne(t)?ec(e,t.parameters,t.instanceType,n):V(t)?tc(e,t.if,t.then,t.else,n):fe(t)?nc(e,t.enum,n):re(t)?rc(e,t.parameters,t.returnType,n):he(t)?ac(e,t,n):S(t)?oc(e,t.allOf,n):A(t)?ic(e,t,n):yt(t)?sc(e,t,n):Yt(t)?mc(e,t,n):X(t)?pc(e,t,n):M(t)?cc(e,t.properties,n):pe(t)?lc(e,Ce(t),ye(t),n):ge(t)?dc(e,t,n):xt(t)?fc(e,t,n):Z(t)?hc(e,t.pattern,n):j(t)?Ic(e,t.items,n):tn(t)?bc(e,t,n):x(t)?$c(e,t.anyOf,n):te(t)?Tc(e,t,n):We(t)?kc(e,t,n):$()}function RI(e,t){return z([...e,v(t)])}function Io(e,t,n){return T(e)?p.Update(RI(e,t),{},n):qn(e,t,n)}function wc(e,t,n,r,a){let s=we(e,t,n),m=zn(e,t,r);return Io(s,m,a)}function qn(e,t,n={}){return I("Interface",[e,t],n)}function sn(e){return ee(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function Ec(e,t,n={}){return Io(e,t,n)}function SI(e,t,n){return e.includes(n)?!0:Bn([...e,n],t,t[n])}function Rc(e,t,n){let r=br(n);return Gt(e,t,r)}function Gt(e,t,n){return i.ShiftLeft(n,(r,a)=>Bn(e,t,r)?!0:Gt(e,t,a),()=>!1)}function Bn(e,t,n){return ae(n)?SI(e,t,n.$ref):K(n)?Bn(e,t,n.items):ne(n)?Gt(e,t,[...n.parameters,n.instanceType]):re(n)?Gt(e,t,[...n.parameters,n.returnType]):sn(n)?Rc(e,t,n.parameters[1]):S(n)?Gt(e,t,n.allOf):M(n)?Rc(e,t,n.properties):x(n)?Gt(e,t,n.anyOf):j(n)?Gt(e,t,n.items):pe(n)?Bn(e,t,ye(n)):!1}function Sc(e,t,n){return Bn(e,t,n)}function OI(e,t){return t.reduce((n,r)=>Sc([r],e,e[r])?[...n,r]:n,[])}function Oc(e){let t=Ir(e);return OI(e,t)}function PI(e,t,n){return n.includes(t)?n:t in e?Vn(e,e[t],[...n,t]):Y()}function Pc(e,t,n){let r=br(t);return mn(e,r,n)}function mn(e,t,n){return t.reduce((r,a)=>Vn(e,a,r),n)}function Vn(e,t,n){return ae(t)?PI(e,t.$ref,n):K(t)?Vn(e,t.items,n):ne(t)?mn(e,[...t.parameters,t.instanceType],n):re(t)?mn(e,[...t.parameters,t.returnType],n):sn(t)?Pc(e,t.parameters[1],n):S(t)?mn(e,t.allOf,n):M(t)?Pc(e,t.properties,n):x(t)?mn(e,t.anyOf,n):j(t)?mn(e,t.items,n):pe(t)?Vn(e,ye(t),n):n}function Cc(e,t,n){return Vn(e,n,[t])}function CI(e){return Vt()}function MI(e){return i.Keys(e).reduce((t,n)=>({...t,[n]:Ut(e[n])}),{})}function Wn(e){return e.reduce((t,n)=>[...t,Ut(n)],[])}function Ut(e){return ae(e)?CI(e.$ref):K(e)?Te(Ut(e.items),xr(e)):ne(e)?Ge(Wn(e.parameters),Ut(e.instanceType)):re(e)?Ue(Wn(e.parameters),Ut(e.returnType)):S(e)?de(Wn(e.allOf)):M(e)?v(MI(e.properties)):pe(e)?Lr(Qt(e),Ut(ye(e))):x(e)?k(Wn(e.anyOf)):j(e)?Q(Wn(e.items)):e}function AI(e,t){return t in e?Ut(e[t]):oe()}function Mc(e){return AI(e.$defs,e.$ref)}function LI(e,t,n){let r=we(e,G([],[]),t),a=zn({},G([],[]),n);return z([...r,v(a)])}function qI(e,t){return i.Keys(e).filter(r=>t.includes(r)).reduce((r,a)=>{let s=e[a],m=sn(s)?LI(e,s.parameters[0],s.parameters[1]):s;return{...r,[a]:m}},{})}function Ac(e,t,n){let r=Cc(e,t,n),a=qI(e,r);return _e(a,t)}function Lc(e,t){return t in e?ae(e[t])?Lc(e,e[t].$ref):e[t]:q()}function He(e,t){return Lc(e,t)}function qc(e){return se(e)?Mc(e):vr(e)?oe():e}function me(e,t,n){let r=qc(t),a=qc(n);return P(e,r,a)}var On="equal",jI="disjoint",Pn="left-inside",Cn="right-inside";function Xt(e,t){let n=[te(e)?b.ExtendsFalse():me({},e,t),te(e)?b.ExtendsTrue({}):me({},t,e)];return b.IsExtendsTrueLike(n[0])&&b.IsExtendsTrueLike(n[1])?On:b.IsExtendsTrueLike(n[0])&&b.IsExtendsFalse(n[1])?Pn:b.IsExtendsFalse(n[0])&&b.IsExtendsTrueLike(n[1])?Cn:jI}function FI(e,t){return t.filter(n=>Xt(e,n)!==Cn)}function DI(e,t){let n=t.some(r=>{let a=Xt(e,r);return i.IsEqual(a,Pn)||i.IsEqual(a,On)});return i.IsEqual(n,!1)}function NI(e,t){let n=Pe(e);return J(n)?[n]:DI(n,t)?[...FI(n,t),n]:t}function GI(e){return e.reduce((t,n)=>M(n)?[...t,n]:yt(n)?t:NI(n,t),[])}function Ja(e){let t=GI(e);return An(t)}function bo(e,t){return p.Update(Pe(e),{},t)}function jc(e,t,n,r){let a=d(e,t,n);return bo(a,r)}function Hn(e,t=[]){return ht(e)&&i.IsEqual(e.action,"Conditional")?ae(e.parameters[0])?Hn(e.parameters[2],Hn(e.parameters[3],[...t,e.parameters[0].$ref])):Hn(e.parameters[2],Hn(e.parameters[3],t)):ht(e)&&i.IsEqual(e.action,"Mapped")&&ht(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&ae(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function UI(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function Nc(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>i.ShiftLeft(t,(s,m)=>Nc(a,m,[...n,[s,r]]),()=>n),()=>n)}function KI(e){return x(e)?[...e.anyOf]:[e]}function _I(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function Fc(e,t){return t.reduce((n,r)=>[...n,..._I(e,r)],[])}function Dc(e){return e.reduce((t,n)=>i.IsEqual(n[0],!0)?Fc(t,KI(n[1])):Fc(t,[n[1]]),[[]])}function Gc(e,t,n){let r=Hn(n),a=UI(e,r),s=Nc(t,a);return ht(n)&&i.IsEqual(n.action,"Conditional")||ht(n)&&i.IsEqual(n.action,"Mapped")?Dc(s):[t]}function zI(){return["(not-resolvable)",q()]}function BI(){return["(not-generic)",q()]}function VI(e,t,n){return[e,gt(t,n)]}function WI(e,t,n){return t in e?Uc(e,t,e[t],n):zI()}function Uc(e,t,n,r){return Bt(n)?VI(t,n.parameters,n.expression):ae(n)?WI(e,n.$ref,r):BI()}function Kc(e,t,n){return Uc(e,"(anonymous)",t,n)}function HI(e,t,n){if(H(t)||pn(t)||b.IsExtendsTrueLike(me({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function _c(e,t,n,r,a){let s=d(e,t,a);return HI(n,s,r),p.Assign(e,{[n]:s})}function YI(e,t,n,r,a){let s=d(e,t,n.extends),m=d(e,t,n.equals);return i.ShiftLeft(a,(c,l)=>vo(_c(e,t,n.name,s,c),t,r,l),()=>vo(_c(e,t,n.name,s,m),t,r,[]))}function vo(e,t,n,r){return i.ShiftLeft(n,(a,s)=>YI(e,t,a,s,r),()=>e)}function zc(e,t,n,r){return vo(e,t,n,r)}function JI(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function XI(e,t){return i.IsEqual(JI(e),t)}function ZI(e,t,n,r,a,s){let m=zc(e,t,r,s),c=d(m,G([...t.callstack,n.$ref],t.visited),a);return d(m,G([],[]),c)}function QI(e,t,n,r,a,s){return s.reduce((m,c)=>[...m,ZI(e,t,n,r,a,c)],[])}function eb(e,t,n,r,a,s){let m=Gc(r,s,a),c=QI(e,t,n,r,a,m);return i.IsEqual(c.length,1)?c[0]:ve(c)}function ga(e,t,n,r){let a=we(e,t,r),s=Kc(e,n,r),m=s[0],c=s[1];return Bt(c)?XI(t,m)?jn(ot(m),a):eb(e,t,ot(m),c.parameters,c.expression,a):jn(n,a)}function jn(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Bc(e,t){return ga({},G([],[]),e,t)}function pn(e){return y(e,"Call")}function tb(e){return p.Discard(e,["~immutable"])}function Vc(e,t){return p.Update(tb(e),{},t)}function Wc(e,t,n,r){let a=d(e,t,n);return Vc(a,r)}function Hc(e,t){return e(t)}function Yc(e,t){return i.IsString(t)?O(Hc(e,t)):O(t)}function Jc(e,t){let n=Ie(t);return mt(e,n)}function Xc(e,t){let n=t.map(r=>mt(e,r));return k(n)}function mt(e,t){return A(t)?Yc(e,t.const):Z(t)?Jc(e,t.pattern):x(t)?Xc(e,t.anyOf):t}function Gr(e,t={}){return I("Capitalize",[e],t)}function Zc(e,t={}){return $o(e,t)}function Ur(e,t={}){return I("Lowercase",[e],t)}function Qc(e,t={}){return To(e,t)}function Kr(e,t={}){return I("Uncapitalize",[e],t)}function el(e,t={}){return ko(e,t)}function _r(e,t={}){return I("Uppercase",[e],t)}function tl(e,t={}){return wo(e,t)}var nb=e=>e[0].toUpperCase()+e.slice(1),rb=e=>e.toLowerCase(),ab=e=>e[0].toLowerCase()+e.slice(1),ob=e=>e.toUpperCase();function $o(e,t){return T([e])?p.Update(mt(nb,e),{},t):Gr(e,t)}function To(e,t){return T([e])?p.Update(mt(rb,e),{},t):Ur(e,t)}function ko(e,t){return T([e])?p.Update(mt(ab,e),{},t):Kr(e,t)}function wo(e,t){return T([e])?p.Update(mt(ob,e),{},t):_r(e,t)}function nl(e,t,n,r){let a=d(e,t,n);return $o(a,r)}function rl(e,t,n,r){let a=d(e,t,n);return To(a,r)}function al(e,t,n,r){let a=d(e,t,n);return ko(a,r)}function ol(e,t,n,r){let a=d(e,t,n);return wo(a,r)}function zr(e,t,n,r,a={}){return I("Conditional",[e,t,n,r],a)}function il(e,t,n,r,a={}){return Eo({},G([],[]),e,t,n,r,a)}function ib(e,t,n,r,a,s){let m=me(e,n,r);return b.IsExtendsUnion(m)?k([d(m.inferred,t,a),d(e,t,s)]):b.IsExtendsTrue(m)?d(m.inferred,t,a):d(e,t,s)}function Eo(e,t,n,r,a,s,m){return T([n,r])?p.Update(ib(e,t,n,r,a,s),{},m):zr(n,r,a,s,m)}function sl(e,t,n,r,a,s,m){let c=d(e,t,n),l=d(e,t,r);return Eo(e,t,c,l,a,s,m)}function Br(e,t={}){return I("ConstructorParameters",[e],t)}function ml(e,t={}){return Ro(e,t)}function sb(e){let t=ne(e)?e.parameters:[],n=wt({},G([],[]),t);return Q(n)}function Ro(e,t){return T([e])?p.Update(sb(e),{},t):Br(e,t)}function pl(e,t,n,r){let a=d(e,t,n);return Ro(a,r)}function Vr(e,t,n={}){return I("Exclude",[e,t],n)}function ul(e,t,n={}){return Yn(e,t,n)}function Yn(e,t,n){return T([e,t])?p.Update(Mr(e,t),{},n):Vr(e,t,n)}function cl(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Yn(s,m,a)}function Wr(e,t,n={}){return I("Extract",[e,t],n)}function ll(e,t,n={}){return So(e,t,n)}function mb(e,t){let n=me({},e,t);return b.IsExtendsTrueLike(n)?[e]:[]}function pb(e,t){return e.reduce((n,r)=>[...n,...mb(r,t)],[])}function dl(e,t){let n=Pe(e),r=x(n)?n.anyOf:[n],a=pb(r,t);return ve(a)}function So(e,t,n){return T([e,t])?p.Update(dl(e,t),{},n):Wr(e,t,n)}function fl(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return So(s,m,a)}function ub(e){return e.reduce((t,n)=>Er(n)?[...t,O(n)]:t,[])}function un(e){let t=ub(e);return k(t)}function Fn(e,t,n={}){return I("Index",[e,t],n)}function hl(e,t,n={}){let r=i.IsArray(t)?un(t):t;return Oo(e,r,n)}function gl(e,t){let n=He(e,t);return Ee(n)}function yl(e,t,n){let r=Fe(e,t,n);return Ee(r)}function cb(e,t){let n=i.Keys(e).filter(f=>!i.HasPropertyKey(t,f)),r=i.Keys(t).filter(f=>!i.HasPropertyKey(e,f)),a=i.Keys(e).filter(f=>i.HasPropertyKey(t,f)),s=n.reduce((f,w)=>({...f,[w]:e[w]}),{}),m=r.reduce((f,w)=>({...f,[w]:t[w]}),{}),c=a.reduce((f,w)=>({...f,[w]:z([e[w],t[w]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function xl(e){return e.reduce((t,n)=>cb(t,Ee(n)),{})}function Il(e){let t=ks(Q(e));return Ee(t)}function lb(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:ve([e[s],t[s]])}),{})}function bl(e,t){return i.ShiftLeft(e,(n,r)=>bl(r,lb(t,Ee(n))),()=>t)}function vl(e){return i.ShiftLeft(e,(t,n)=>bl(n,Ee(t)),()=>Y())}function Ee(e){return se(e)?gl(e.$defs,e.$ref):V(e)?yl(e.if,e.then,e.else):S(e)?xl(e.allOf):x(e)?vl(e.anyOf):j(e)?Il(e.items):M(e)?e.properties:{}}function cn(e){let t=Ee(e);return v(t)}var db=new RegExp("^(?:0|[1-9][0-9]*)$");function ln(e){let t=`${e}`;return db.test(t)?parseInt(t):e}function fb(e){return O(ln(e))}function $l(e){return e.map(t=>Tl(t))}function Tl(e){return S(e)?de($l(e.allOf)):x(e)?k($l(e.anyOf)):A(e)?fb(e.const):e}function kl(e,t){let n=Tl(t),r=me({},n,be());return b.IsExtendsTrueLike(r)?e:A(t)&&i.IsEqual(t.const,"length")?be():q()}function wl(e,t){let n=He(e,t);return $e(n)}function El(e,t,n){let r=Fe(e,t,n);return $e(r)}function Rl(e){let t=ke(e);return $e(t)}function Sl(e){let t=z(e);return $e(t)}function Ol(e){return[`${e}`]}function Pl(e){let t=Ie(e);return $e(t)}function Cl(e){return e.reduce((t,n)=>[...t,...$e(n)],[])}function $e(e){return se(e)?wl(e.$defs,e.$ref):V(e)?El(e.if,e.then,e.else):fe(e)?Rl(e.enum):S(e)?Sl(e.allOf):A(e)?Ol(e.const):Z(e)?Pl(e.pattern):x(e)?Cl(e.anyOf):[]}function dn(e){return $e(e)}function Jn(e,t){return t.map(n=>Xn(e,n))}function Xn(e,t){return K(t)?Te(Xn(e,t.items)):ne(t)?Ge(Jn(e,t.parameters),Xn(e,t.instanceType)):re(t)?Ue(Jn(e,t.parameters),Xn(e,t.returnType)):j(t)?Q(Jn(e,t.items)):x(t)?k(Jn(e,t.anyOf)):S(t)?de(Jn(e,t.allOf)):Fr(t)?v(e):t}function Ml(e,t){return Xn(e,t)}function hb(e,t){let n=t in e?e[t]:q();return Ml(e,n)}function Al(e,t){return t.reduce((n,r)=>[...n,hb(e,r)],[])}function gb(e,t){let n=dn(t),r=Al(e,n);return ve(r)}var yb=new RegExp(bt);function xb(e){return e.filter(n=>yb.test(n))}function Ib(e){let t=Ir(e),n=xb(t),r=Al(e,n);return ve(r)}function Ll(e,t){return X(t)?Ib(e):gb(e,t)}function bb(e){return O(ln(e))}function ql(e){return e.map(t=>Po(t))}function Po(e){return S(e)?de(ql(e.allOf)):x(e)?k(ql(e.anyOf)):A(e)?bb(e.const):e}function vb(e,t){return e.reduceRight((n,r,a)=>{let s=me({},O(a),t);return b.IsExtendsTrueLike(s)?[r,...n]:n},[])}function $b(e,t){let n=Po(t),r=vb(e,n);return it(r)}function Tb(e){return it(e)}function jl(e,t){return A(t)&&i.IsEqual(t.const,"length")?O(e.length):X(t)||he(t)?Tb(e):$b(e,t)}function Fl(e,t){return K(e)?kl(e.items,t):M(e)?Ll(e.properties,t):j(e)?jl(e.items,t):q()}function kb(e){return se(e)||V(e)||S(e)||x(e)?cn(e):e}function Oo(e,t,n){return T([e,t])?p.Update(Fl(kb(e),t),{},n):Fn(e,t,n)}function Dl(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Oo(s,m,a)}function Hr(e,t={}){return I("InstanceType",[e],t)}function Nl(e,t={}){return Co(e,t)}function wb(e){return ne(e)?e.instanceType:q()}function Co(e,t){return T([e])?p.Update(wb(e),{},t):Hr(e,t)}function Gl(e,t,n,r={}){let a=d(e,t,n);return Co(a,r)}function Dn(e,t={}){return I("KeyOf",[e],t)}function Ul(e,t={}){return Mo(e,t)}function Kl(){return k([be(),Oe(),Jt()])}function _l(e){return be()}function Eb(e){return e.reduce((n,r)=>Er(r)?[...n,O(ln(r))]:Y(),[])}function zl(e){let t=i.Keys(e),n=Eb(t);return it(n)}function Bl(e){return Qt(e)}function Vl(e){let t=e.map((n,r)=>O(r));return it(t)}function Wl(e){return J(e)?Kl():K(e)?_l(e.items):M(e)?zl(e.properties):pe(e)?Bl(e):j(e)?Vl(e.items):q()}function Rb(e){return se(e)||V(e)||S(e)||x(e)?cn(e):e}function Mo(e,t){return T([e])?p.Update(Wl(Rb(e)),{},t):Dn(e,t)}function Hl(e,t,n,r){let a=d(e,t,n);return Mo(a,r)}function Ln(e,t,n,r,a={}){return I("Mapped",[e,t,n,r],a)}function Yl(e,t,n,r,a={}){return Ao({},G([],[]),e,t,n,r,a)}function Sb(e){let t=Ie(e);return ya(t)}function Ob(e){return e.reduce((t,n)=>[...t,...ya(n)],[])}function Pb(e){let t=ke(e);return ya(t)}function Cb(e){return i.IsNumber(e)?[O(`${e}`)]:[O(e)]}function ya(e){return fe(e)?Pb(e.enum):A(e)?Cb(e.const):Z(e)?Sb(e.pattern):x(e)?Ob(e.anyOf):[e]}function Jl(e){return ya(e)}function Mb(e){return Z(e)?Ie(e.pattern):e}function Ab(e,t,n,r,a,s){let m=p.Assign(e,{[n.name]:r}),c=d(m,t,a),l=Mb(c),h=d(m,t,s);return as(l)||os(l)?{[l.const]:h}:{}}function Lb(e,t,n,r,a,s){return r.reduce((m,c)=>[...m,Ab(e,t,n,c,a,s)],[])}function qb(e){return e.reduce((t,n)=>[...t,v(n)],[])}function Xl(e,t,n,r,a,s){let m=Jl(r),c=Lb(e,t,n,m,a,s),l=qb(c);return z(l)}function Ao(e,t,n,r,a,s,m){return T([r])?p.Update(Xl(e,t,n,r,a,s),{},m):Ln(n,r,a,s,m)}function Zl(e,t,n,r,a,s,m){let c=d(e,t,r);return Ao(e,t,n,c,a,s,m)}function jb(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>n.includes(s)).reduce((s,m)=>({...s,[m]:Ac(r,m,t[m])}),{})}function Fb(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>!n.includes(s)).reduce((s,m)=>({...s,[m]:d(r,G([],[]),t[m])}),{})}function Db(e,t,n){let r=Oc(t),a=jb(e,t,r),s=Fb(e,t,r),m={...a,...s};return p.Update(m,{},n)}function xa(e,t,n,r){return Db(e,n,r)}function Yr(e,t={}){return I("NonNullable",[e],t)}function Ql(e,t={}){return Lo(e,t)}function Nb(e){let t=k([Ht(),en()]);return Yn(e,t,{})}function Lo(e,t){return T([e])?p.Update(Nb(e),{},t):Yr(e,t)}function ed(e,t,n,r){let a=d(e,t,n);return Lo(a,r)}function Jr(e,t,n={}){return I("Omit",[e,t],n)}function td(e,t,n={}){let r=i.IsArray(t)?un(t):t;return qo(e,r,n)}function Ia(e){let t=cn(e);return M(t)?t.properties:Y()}function Gb(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?r:{...r,[a]:e[a]},{})}function nd(e,t){let n=Ia(e),r=dn(t),a=Gb(n,r);return v(a)}function qo(e,t,n){return T([e,t])?p.Update(nd(e,t),{},n):Jr(e,t,n)}function rd(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return qo(s,m,a)}function Xr(e,t={}){return I("Parameters",[e],t)}function ad(e,t={}){return jo(e,t)}function Ub(e){let t=re(e)?e.parameters:[],n=wt({},G([],[]),t);return Q(n)}function jo(e,t){return T([e])?p.Update(Ub(e),{},t):Xr(e,t)}function od(e,t,n,r){let a=d(e,t,n);return jo(a,r)}function Zr(e,t={}){return I("Partial",[e],t)}function id(e,t={}){return Fo(e,t)}function sd(e,t){let n=He(e,t),r=Ye(n);return _e(p.Assign(e,{[t]:r}),t)}function md(e,t,n){let r=Fe(e,t,n);return Ye(r)}function pd(e){let t=z(e);return Ye(t)}function ud(e){let t=e.map(n=>Ye(n));return k(t)}function cd(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:Ct(e[a])}),{});return v(t)}function Ye(e){return se(e)?sd(e.$defs,e.$ref):V(e)?md(e.if,e.then,e.else):S(e)?pd(e.allOf):x(e)?ud(e.anyOf):M(e)?cd(e.properties):v({})}function Fo(e,t){return T([e])?p.Update(Ye(e),{},t):Zr(e,t)}function ld(e,t,n,r){let a=d(e,t,n);return Fo(a,r)}function Qr(e,t,n={}){return I("Pick",[e,t],n)}function dd(e,t,n={}){let r=i.IsArray(t)?un(t):t;return Do(e,r,n)}function Kb(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?p.Assign(r,{[a]:e[a]}):r,{})}function fd(e,t){let n=Ia(e),r=dn(t),a=Kb(n,r);return v(a)}function Do(e,t,n){return T([e,t])?p.Update(fd(e,t),{},n):Qr(e,t,n)}function hd(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Do(s,m,a)}function ea(e,t={}){return I("ReadonlyObject",[e],t)}function No(e,t={}){return Go(e,t)}var gd=No;function yd(e){return Wt(Te(e))}function xd(e,t){let n=He(e,t),r=Je(n);return _e(p.Assign(e,{[t]:r}),t)}function Id(e,t,n){let r=Fe(e,t,n);return Je(r)}function bd(e){let t=z(e);return Je(t)}function vd(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:Lt(e[a])}),{});return v(t)}function $d(e){return Wt(Q(e))}function Td(e){let t=e.map(n=>Je(n));return k(t)}function Je(e){return K(e)?yd(e.items):se(e)?xd(e.$defs,e.$ref):V(e)?Id(e.if,e.then,e.else):S(e)?bd(e.allOf):M(e)?vd(e.properties):j(e)?$d(e.items):x(e)?Td(e.anyOf):e}function Go(e,t){return T([e])?p.Update(Je(e),{},t):ea(e)}function kd(e,t,n,r){let a=d(e,t,n);return Go(a,r)}function wd(e,t,n,r){return t.visited.includes(r)?n:r in e?d(e,G(t.callstack,[...t.visited,r]),e[r]):n}function Ed(e,t){let n=He(e,t),r=Xe(n);return _e(p.Assign(e,{[t]:r}),t)}function Rd(e,t,n){let r=Fe(e,t,n);return Xe(r)}function Sd(e){let t=z(e);return Xe(t)}function Od(e){let t=e.map(n=>Xe(n));return k(t)}function Pd(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:Cr(e[a])}),{});return v(t)}function Xe(e){return se(e)?Ed(e.$defs,e.$ref):V(e)?Rd(e.if,e.then,e.else):S(e)?Sd(e.allOf):x(e)?Od(e.anyOf):M(e)?Pd(e.properties):v({})}function ta(e,t={}){return I("Required",[e],t)}function Cd(e,t={}){return Uo(e,t)}function Uo(e,t){return T([e])?p.Update(Xe(e),{},t):ta(e,t)}function Md(e,t,n,r){let a=d(e,t,n);return Uo(a,r)}function na(e,t={}){return I("ReturnType",[e],t)}function Ad(e,t={}){return Ko(e,t)}function _b(e){return re(e)?e.returnType:q()}function Ko(e,t){return T([e])?p.Update(_b(e),{},t):na(e,t)}function Ld(e,t,n,r={}){let a=d(e,t,n);return Ko(a,r)}function ra(e,t){return I("With",[e,t],{})}function qd(e,t){return _o(e,t)}function _o(e,t){return T([e])?p.Update(e,{},t):ra(e,t)}function jd(e,t,n,r){let a=d(e,t,n);return _o(a,r)}function zb(e){return vt(e)?j(e.items)?zo(e.items.items):H(e.items)?[e]:ae(e.items)?[e]:[q()]:[e]}function zo(e){return e.reduce((n,r)=>[...n,...zb(r)],[])}function G(e,t){return{callstack:e,visited:t}}function T(e){return i.ShiftLeft(e,(t,n)=>ae(t)?!1:T(n),()=>!0)}function zn(e,t,n){return i.Keys(n).reduce((r,a)=>({...r,[a]:d(e,t,n[a])}),{})}function wt(e,t,n){let r=we(e,t,n);return zo(r)}function we(e,t,n){return n.map(r=>d(e,t,r))}function Bb(e,t){let n=le(e)?$n(t,{}):t,r=qt(e)?vn(n,{}):n;return At(e)?Zn(r,{}):r}function Vb(e,t,n,r,a){return i.IsEqual(n,"AddImmutable")?Fd(e,t,r[0],a):i.IsEqual(n,"RemoveImmutable")?Wc(e,t,r[0],a):i.IsEqual(n,"AddReadonly")?Ai(e,t,r[0],a):i.IsEqual(n,"RemoveReadonly")?Is(e,t,r[0],a):i.IsEqual(n,"AddOptional")?Li(e,t,r[0],a):i.IsEqual(n,"RemoveOptional")?$s(e,t,r[0],a):i.IsEqual(n,"Capitalize")?nl(e,t,r[0],a):i.IsEqual(n,"Conditional")?sl(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"ConstructorParameters")?pl(e,t,r[0],a):i.IsEqual(n,"Evaluate")?jc(e,t,r[0],a):i.IsEqual(n,"Exclude")?cl(e,t,r[0],r[1],a):i.IsEqual(n,"Extract")?fl(e,t,r[0],r[1],a):i.IsEqual(n,"Index")?Dl(e,t,r[0],r[1],a):i.IsEqual(n,"InstanceType")?Gl(e,t,r[0],a):i.IsEqual(n,"Interface")?wc(e,t,r[0],r[1],a):i.IsEqual(n,"KeyOf")?Hl(e,t,r[0],a):i.IsEqual(n,"Lowercase")?rl(e,t,r[0],a):i.IsEqual(n,"Mapped")?Zl(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"Module")?xa(e,t,r[0],a):i.IsEqual(n,"NonNullable")?ed(e,t,r[0],a):i.IsEqual(n,"Pick")?hd(e,t,r[0],r[1],a):i.IsEqual(n,"Parameters")?od(e,t,r[0],a):i.IsEqual(n,"Partial")?ld(e,t,r[0],a):i.IsEqual(n,"Omit")?rd(e,t,r[0],r[1],a):i.IsEqual(n,"ReadonlyObject")?kd(e,t,r[0],a):i.IsEqual(n,"Record")?Ns(e,t,r[0],r[1],a):i.IsEqual(n,"Required")?Md(e,t,r[0],a):i.IsEqual(n,"ReturnType")?Ld(e,t,r[0],a):i.IsEqual(n,"TemplateLiteral")?_u(e,t,r[0],a):i.IsEqual(n,"Uncapitalize")?al(e,t,r[0],a):i.IsEqual(n,"Uppercase")?ol(e,t,r[0],a):i.IsEqual(n,"With")?jd(e,t,r[0],r[1]):I(n,r,a)}function Wb(e,t,n){let r=ae(n)?wd(e,t,n,n.$ref):K(n)?Te(d(e,t,n.items),xr(n)):pn(n)?ga(e,t,n.target,n.arguments):ne(n)?Ge(we(e,t,n.parameters),d(e,t,n.instanceType),qi(n)):re(n)?Ue(we(e,t,n.parameters),d(e,t,n.returnType),ji(n)):V(n)?Mt(d(e,t,n.if),d(e,t,n.then),d(e,t,n.else),Ki(n)):S(n)?de(we(e,t,n.allOf),Wi(n)):M(n)?v(zn(e,t,n.properties),Gi(n)):pe(n)?Gs(Ce(n),d(e,t,ye(n))):vt(n)?Dt(d(e,t,n.items)):j(n)?Q(wt(e,t,n.items),xs(n)):x(n)?k(we(e,t,n.anyOf),ss(n)):n;return Bb(n,r)}function d(e,t,n){return ht(n)?Vb(e,t,n.action,n.parameters,n.options):Wb(e,t,n)}function Bo(e,t){return d(e,G([],[]),t)}function Hb(e){return p.Update(e,{"~immutable":!0},{})}function Zn(e,t){return p.Update(Hb(e),{},t)}function Fd(e,t,n,r){let a=d(e,t,n);return Zn(a,r)}function Up(e,t={}){return I("AddImmutable",[e],t)}function Wt(e,t={}){return Zn(e,t)}function Kp(e,t={}){return I("Evaluate",[e],t)}function Dd(e,t={}){return bo(e,t)}function _p(e,t={}){return I("Module",[e],t)}function Nd(e,t={}){return xa({},G([],[]),e,t)}function Gd(...e){let[t,n,r]=ze.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=Du(n),s=i.IsArray(a)&&i.IsEqual(a.length,2)?d(t,G([],[]),a[0]):q();return p.Update(s,{},r)}var F={};Rt(F,{Any:()=>Vt,Array:()=>Te,BigInt:()=>En,Boolean:()=>kr,Call:()=>Bc,Capitalize:()=>Zc,Codec:()=>Tr,Conditional:()=>il,Constructor:()=>Ge,ConstructorParameters:()=>ml,Cyclic:()=>_e,Decode:()=>Xi,DecodeBuilder:()=>wn,Dependent:()=>Mt,Encode:()=>Zi,EncodeBuilder:()=>kn,Enum:()=>Vi,Evaluate:()=>Dd,Exclude:()=>ul,Extends:()=>me,ExtendsResult:()=>b,Extract:()=>ll,Function:()=>Ue,Generic:()=>gt,Identifier:()=>Rn,Immutable:()=>Qi,Index:()=>hl,Infer:()=>Tn,InstanceType:()=>Nl,Instantiate:()=>Bo,Integer:()=>jt,Interface:()=>Ec,Intersect:()=>de,IsAny:()=>J,IsArray:()=>K,IsBigInt:()=>Ve,IsBoolean:()=>Se,IsCall:()=>pn,IsCodec:()=>$r,IsConstructor:()=>ne,IsCyclic:()=>se,IsDependent:()=>V,IsEnum:()=>fe,IsEnumValue:()=>Bi,IsFunction:()=>re,IsGeneric:()=>Bt,IsIdentifier:()=>rs,IsImmutable:()=>At,IsInfer:()=>H,IsInteger:()=>he,IsIntersect:()=>S,IsKind:()=>y,IsLiteral:()=>A,IsNever:()=>yt,IsNull:()=>Yt,IsNumber:()=>X,IsObject:()=>M,IsOptional:()=>le,IsParameter:()=>is,IsReadonly:()=>qt,IsRecord:()=>pe,IsRef:()=>ae,IsRefine:()=>za,IsRest:()=>vt,IsSchema:()=>ee,IsString:()=>ge,IsSymbol:()=>xt,IsTemplateLiteral:()=>Z,IsThis:()=>Fr,IsTuple:()=>j,IsUndefined:()=>tn,IsUnion:()=>x,IsUnknown:()=>te,IsUnsafe:()=>vr,IsVoid:()=>We,KeyOf:()=>Ul,Literal:()=>O,Lowercase:()=>Qc,Mapped:()=>Yl,Module:()=>Nd,Never:()=>q,NonNullable:()=>Ql,Null:()=>Ht,Number:()=>be,Object:()=>v,Omit:()=>td,Optional:()=>Di,Parameter:()=>Ft,Parameters:()=>ad,Partial:()=>id,Pick:()=>dd,Readonly:()=>es,ReadonlyObject:()=>No,ReadonlyType:()=>gd,Record:()=>Lr,RecordKey:()=>Qt,RecordPattern:()=>Ce,RecordValue:()=>ye,Ref:()=>ot,Refine:()=>ts,Required:()=>Cd,Rest:()=>Dt,ReturnType:()=>Ad,Script:()=>Gd,String:()=>Oe,Symbol:()=>Jt,TemplateLiteral:()=>Bu,This:()=>jr,Tuple:()=>Q,Uncapitalize:()=>el,Undefined:()=>en,Union:()=>k,Unknown:()=>oe,Unsafe:()=>Ui,Uppercase:()=>tl,Void:()=>Dr,With:()=>qd});var Qn="submit_test_gap_candidates",er="submit_filtered_test_gaps",tr="submit_solver_gaps",x4=F.Object({verdict:F.Union([F.Literal("PASS"),F.Literal("FAIL")],{description:"FAIL only for a genuine blocking issue (clear rubric violation, agent-fault-worthy gap, unfair/undiscoverable test requirement, or a real determinism/regression risk). Optional, minor, or stylistic points are NOT grounds for FAIL \u2014 put those in `notes` instead and use PASS."}),summary:F.String({description:"One short sentence summarizing the verdict."}),reasons:F.Array(F.String(),{description:"Specific BLOCKING justifications only, citing rubric item IDs and concrete evidence from the files you read. Required (non-empty) when verdict is FAIL. Use an empty array when verdict is PASS."}),notes:F.Array(F.String(),{description:"Non-blocking, optional/minor observations or suggested improvements \u2014 the kind of feedback a real reviewer leaves as 'Minor/optional' without failing the task. Include these regardless of verdict; use an empty array if you truly have none."})});var Yb=F.Object({statement:F.String({description:"One sentence from agent_prompt.md, copied verbatim."}),gaps:F.Array(F.Object({description:F.String({description:"A fair, publicly observable missing behavioral test."}),risk:F.String({description:"Why an incorrect implementation could pass the current tests despite this missing behavior."})}),{description:"All candidate positive and negative gaps for this sentence; use an empty array when none exist."})});function Ud(e){return{name:Qn,label:"Submit Candidate Test Gaps",description:"Submit one candidate-gap list for one prompt sentence. Call this after each sentence so the orchestrator can track the todo list; empty lists are required when that sentence has no gaps.",parameters:Yb,async execute(t,n){let r=e.statements??[];return r.push({statement:n.statement,gaps:n.gaps??[]}),e.statements=r,{content:[{type:"text",text:`Recorded ${n.gaps?.length??0} candidate gap(s)`}],details:void 0}}}}var Jb=F.Object({gaps:F.Array(F.Object({description:F.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:F.String({description:"Why this is genuinely grounded in agent_prompt.md or the repo, fair to test per the fairness methodology, and a real (non-duplicate) coverage hole in test.patch \u2014 for negative gaps, cite the prompt's prohibition/constraint and why no existing test catches the forbidden outcome."})}),{description:"The filtered, final list of confirmed test gaps. Use an empty array if none of the candidates survive strict scrutiny."})});function Kd(e){return{name:er,label:"Submit Filtered Test Gaps",description:"Submit your final, strictly filtered list of confirmed test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have independently verified each candidate.",parameters:Jb,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Confirmed ${r.length} gap(s) after filtering`}],details:void 0}}}}var Xb=F.Object({gaps:F.Array(F.Object({description:F.String({description:"The specific behavioral gap: a way one or more solver's diff differs materially from what agent_prompt.md/solution.patch require, despite that solver passing `./test.sh new`."}),justification:F.String({description:"Why this is a genuine requirement from agent_prompt.md or solution.patch (cite the specific requirement/line) that the solver's diff misses, contradicts, or diverges from \u2014 and why the current tests fail to catch that divergence."}),evidence:F.String({description:"Which solver(s) (by index) exhibit this, and the specific part of their diff that grounds the gap."})}),{description:"Concrete, diff-grounded behavioral gaps \u2014 cases where a passing solver's materially different approach reveals that `test.sh new` under-specifies a real requirement. Use an empty array if the solvers converged on equivalent behavior; do not manufacture gaps just to report something."})});function _d(e){return{name:tr,label:"Submit Solver Gaps",description:"Submit your final list of behavioral gaps found by comparing the solver diffs against the real solution.patch. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished comparing every solver.",parameters:Xb,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Recorded ${r.length} solver gap(s)`}],details:void 0}}}}function Zb(e){return[e,"You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the task description given to a coding agent), `test.patch` (a unified diff adding the hidden tests that will grade that agent's solution), and `solution.patch` (a unified diff of one golden/reference solution).","Another specialized agent is searching the complementary direction in parallel \u2014 stay in your lane and do not duplicate its work."]}var Qb=["Thoroughness \u2014 your job is high recall on genuine gaps only:","- Find every gap you can justify with concrete evidence. Do not stop after the first obvious ones \u2014 keep reading until you have systematically covered the prompt, `solution.patch`, and relevant repo context.","- After your first pass, run at least one deliberate second sweep (re-read `agent_prompt.md`, re-scan `solution.patch`, grep the repo) before submitting \u2014 but if that sweep still finds nothing, submit an empty list.","- Do not self-censor or merge distinct genuine gaps into one \u2014 the validator will prune. Never invent or pad the list to seem thorough; an empty array is correct when exhaustive analysis truly finds none.","- Hunt subtle gaps too: partial coverage (asserted once but not under other valid inputs), behaviors implied by repo convention, interaction effects, ordering/timing, and branches visible in `solution.patch` that no test forces.","- Include a candidate only when you can cite specific grounding and a concrete false-pass risk \u2014 not to meet a quota."],zd=["Ground rules \u2014 do not overreach:","- Every gap must trace back to a specific requirement or sentence in `agent_prompt.md`, or to behavior that is unambiguous from the existing, visible repo. Do not invent requirements the prompt doesn't support.","- Do not propose gaps for things `agent_prompt.md` leaves intentionally open, or for implementation details/style the prompt doesn't mandate.","- Read `test.patch` carefully before deciding something is untested \u2014 do not propose a gap that an existing test already covers (even indirectly).","- Keep findings strictly behavioral and publicly observable: a user, caller, or documented public contract must be able to observe the required outcome. Do not report internal helper calls, private state, implementation structure, call order, file placement, or other incidental mechanics.","- Do not require DOM classes, DOM/data/test attributes, selectors, or exact string literals unless the prompt explicitly names them or they are an established, already-present public contract in the repository. Prefer a visible outcome or public API behavior that accepts equivalent implementations."];function Bd(e,t){let n=[...Zb("You are an exhaustive behavioral test-gap finder. Review the task prompt sentence by sentence, finding both missing required-behavior (positive) and missing forbidden/wrong-behavior (negative) tests."),"","First split `agent_prompt.md` into its meaningful sentences using periods (`.`) as the sentence boundary. Create an explicit TODO checklist of every resulting requirement sentence. Work through it one item at a time; do not finish until every item is checked off.","","Before analyzing each sentence, use read/grep/find/ls to inspect the relevant pre-existing source files, their closest analogues, and relevant existing tests. Use that repository context to understand the actual problem, public contracts, conventions, and what the current tests already cover. Then act as an investigator: first trace every behavior the reference `solution.patch` implements for that sentence \u2014 branches, guards, early returns, state transitions, side effects, boundary handling, and negative/prohibited outcomes. Then compare those behaviors against `test.patch` and relevant repository context. Report every distinct, prompt-required behavioral edge case or prohibition that the solution handles but the tests do not catch. A candidate must describe a plausible incorrect implementation that still passes the current suite. Include positive and negative gaps together for that sentence.","",...Qb,"",...zd,"","Test-coverage checklist for calibration:",e];return t&&n.push("","Fairness methodology:",t),n.push("","For every candidate, state the missing fair behavioral test, the relevant solution behavior or branch that led you to investigate it, and why the current suite permits the incorrect behavior. The prompt sentence is the required specification: do not report incidental reference-solution details it does not require. Do not propose the exact test implementation.",`After completing EACH TODO sentence, call \`${Qn}\` with that exact sentence and its gap array (including an empty array when none exist). You may and must call the tool multiple times: once per sentence. Only finish after every TODO item has been submitted.`),n.join(`
12
- `)}function Vd(e,t,n){let r=["You are a strict, skeptical fairness auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","Two specialized research agents reviewed this same task (`agent_prompt.md`, `test.patch`, `solution.patch`, and the repo) sentence by sentence, proposing both positive (missing required-behavior) and negative (missing forbidden/wrong-behavior) gaps. It submitted the following per-sentence candidate report:","",JSON.stringify(e,null,2),"","Your job is to independently re-verify the files yourself and FILTER this list down to only candidates that are ALL of the following:","1. Genuinely grounded \u2014 actually required by a specific statement in `agent_prompt.md`, or unambiguous from clearly visible, existing repo behavior. Drop anything speculative, nice-to-have, or invented beyond what the prompt actually asks for.","2. Fair to test \u2014 verifying it would not require undiscoverable private internals, an invented/unnamed API, or exact incidental structure that only `solution.patch` happens to use. Judge this precisely against the fairness methodology below.","3. A real, distinct coverage hole \u2014 re-check `test.patch` yourself; drop any candidate an existing test already covers, and drop near-duplicate candidates (keep only the clearest phrasing of each distinct gap). For negative-case candidates, keep them only if `test.patch` does not already assert that the forbidden/wrong outcome does not occur.","4. Behaviorally testable through a public contract \u2014 drop candidates that would require an internal helper, private state, implementation structure, call order, DOM class/attribute/data hook, selector, or exact string literal. The sole exceptions are details explicitly named in `agent_prompt.md` or already established as a public contract in the existing repository.","","Be strict: when genuinely unsure whether a candidate holds up, drop it rather than keep it. It is fine \u2014 expected, even \u2014 to return an empty list if none of the candidates survive scrutiny.","","Checklist for the tests focus area, for calibration:",t];return n&&r.push("","Fairness methodology:",n),r.push("","For every gap you keep, give a short justification citing where in `agent_prompt.md` or the repo it is grounded. Preserve POSITIVE:/NEGATIVE: prefix when applicable.",`When you are done, call the \`${er}\` tool exactly once with your final filtered list (which may be empty). That tool call is your only way to report a result.`),r.join(`
13
- `)}function Wd(){return["You are a adversarial tester. Your goal is to find the most minimal, shortcut implementation that makes all new tests pass \u2014 not a full, correct solution. This is intentional: we want to discover whether the test suite lets through an implementation that barely satisfies the assertions without properly implementing the prompt's required behavior.","`agent_prompt.md` in the repo root describes the intended task. Tests for it already exist and are currently failing.","","Goal: make ALL of the new tests pass with the least amount of real logic possible.","1. Run `bash test.sh new` to see the failures and what the tests expect. Read the failing tests carefully \u2014 they are the only spec you need to satisfy.","2. Understand exactly what each test assertion checks. Ask, 'what is the minimum thing I can do \u2014 a stub, a hardcoded return, a mockish pass-through, a trivial branch \u2014 to satisfy this test?', not 'what does agent_prompt.md intend?'. Skim `agent_prompt.md` only enough to understand what the test file names and assertions refer to, then rely on the test errors to drive what to implement.","3. Prefer the most minimal implementation possible:"," - Hardcode a return value if the test expects one."," - Add only the code paths a test actually exercises; leave anything untested unimplemented."," - Mock the minimum number of dependencies (or none) that the test error forces you to touch."," - Use the most direct, trivial, shortcut approach \u2014 do not build abstractions, do not handle unobserved edge cases, do not add defensive code.","4. Before declaring success, also run `bash test.sh base` to confirm your changes cause no regressions. The shortcut must not break existing tests \u2014 that would be a false positive from a different angle.","5. Re-run `bash test.sh new` and iterate until both the new tests and the base tests pass, or you're confident you cannot pass more without adding real logic.","","Rules:","- Do NOT modify the test files or `test.sh`. Only change application/library code.","- You have shell access \u2014 install any dependencies you need.","- The prompt is not your spec: the tests are. Implement exactly what the tests demand, nothing more. If you can satisfy a test with a hardcoded return, do it."].join(`
14
- `)}function ev(e){let t=e.status==="ok"?e.passed?"PASSED all new tests":"did NOT pass all new tests":`did not complete normally (status: ${e.status})`;return`- Solver ${e.index} \u2014 ${t} \u2014 solution.diff / test_output.txt in \`${gn}/solver_${e.index}/\``}function Hd(e,t,n){let r=["You are a strict, skeptical behavioral-gap auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the real task description), `solution.patch` (a unified diff of the real golden/reference solution), and `test.patch` (a unified diff adding the hidden tests).","",`Separately, several coding agents ('solvers') were each given the same \`agent_prompt.md\` plus the failing tests from \`test.patch\` \u2014 but never \`solution.patch\` \u2014 and asked to implement the task TDD-style, iterating with real shell access until the tests passed or they gave up. Each solver's diff and full \`test.sh new\` output \u2014 captured and verified independently by the harness, not self-reported \u2014 is saved under \`${gn}/solver_<index>/\` (\`solution.diff\`, \`test_output.txt\`), with a \`${gn}/manifest.json\` summary. Use read/grep/find/ls to open exactly what you need. Status summary:`,"",...e.map(ev),"","Your job: compare the reference `solution.patch` with each solver's `solution.diff` to find concrete BEHAVIORAL GAPS. Keep only a difference where: (a) `agent_prompt.md` explicitly requires the behavior, (b) the solver passed the relevant tests (even if it failed elsewhere), (c) the reference and solver produce observably different behavior for a real edge case or scenario, and (d) a fair public-facing test could distinguish them. The reference solution is evidence for scenarios to inspect, never a specification by itself.","","How to work:","1. Read `agent_prompt.md` sentence by sentence and note every distinct requirement, constraint, and prohibition.","2. Read `solution.patch` to see how the reference solution satisfies those requirements.","3. For each solver, read its `solution.diff` and compare it against the reference behavior. Look specifically for a solver shortcut, missed constraint, edge case, or side effect that the PROMPT requires, where the solver still passes because the tests do not observe the behavioral difference.","4. A solver that did not pass the full suite may still provide evidence for a completed, relevant part of its diff, but only when its test output shows the failure is unrelated to that behavior (or shows the relevant tests already passed). Do not treat its failing behavior as a gap, and do not infer gaps from a hypothetical wrong implementation.","5. Treat multiple solvers converging on the same divergent-but-passing shortcut as stronger evidence of a real gap, not proof it's acceptable \u2014 the tests are what's under scrutiny, not majority solver behavior.","",...zd,"- Every gap must be evidenced by an actual, cited solver diff and a contrasting reference behavior. For a solver that failed the full suite, also cite its test output showing that the relevant behavior already passed or is unrelated to the failure. Cite the prompt sentence that makes the behavioral difference required; do not report a gap that is purely theoretical or based only on the reference implementation.","- It is fine, and expected, to submit an empty list if the solvers that passed all converged on behavior equivalent to the reference solution with no material gaps.","- Do not self-censor for volume, but do not pad the list either \u2014 only include what you can concretely justify with cited evidence.","","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",t];return n&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",n),r.push("",`When you are done, call the \`${tr}\` tool exactly once with your final list (which may be empty). That tool call is your only way to report a result.`),r.join(`
15
- `)}var tv=900*1e3,Vo=["read","grep","find","ls"];function $a(e){return e==="off"?void 0:e}async function Ta(e,t,n=tv){let r=t.aborted?"cancelled":"done";return await Promise.race([e().then(()=>{t.aborted||(r="done")}),new Promise(a=>{setTimeout(()=>{r="timedOut",a()},n)}),new Promise(a=>{if(t.aborted)return a();t.addEventListener("abort",()=>{r="cancelled",a()},{once:!0})})]),r}async function Yd(e){let t={},n=e.model,{session:r}=await ba({cwd:e.tempDir,model:n,thinkingLevel:$a(e.thinkingLevel),tools:[...Vo,Qn],customTools:[Ud(t)],sessionManager:va.inMemory()});try{let a=await Ta(async()=>{await r.prompt(Bd(e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.statements?{status:"ok",gaps:t.statements}:{status:"noSubmission",gaps:[]}}var nv=["read","grep","find","ls","write","edit","bash"];async function Jd(e){let t=e.model;try{let n=va.inMemory(),{session:r}=await ba({cwd:e.solverDir,model:t,thinkingLevel:$a(e.thinkingLevel),tools:[...nv],sessionManager:n}),a=await Ta(async()=>{await r.prompt(Wd())},e.cancelSignal,e.timeoutMinutes*60*1e3);return a!=="done"&&await r.abort(),{outcome:a,trajectory:n.getEntries()}}catch{return{outcome:"error",trajectory:[]}}}async function Xd(e){let t={},n=e.model,{session:r}=await ba({cwd:e.tempDir,model:n,thinkingLevel:$a(e.thinkingLevel),tools:[...Vo,tr],customTools:[_d(t)],sessionManager:va.inMemory()});try{let a=await Ta(async()=>{await r.prompt(Hd(e.solverResults,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}async function Zd(e){let t={},n=e.model,{session:r}=await ba({cwd:e.tempDir,model:n,thinkingLevel:$a(e.thinkingLevel),tools:[...Vo,er],customTools:[Kd(t)],sessionManager:va.inMemory()});try{let a=await Ta(async()=>{await r.prompt(Vd(e.statementReports,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var Et="checks_progress";function nr(e,t,n,r){let a=n>0?Math.min(1,t/n):0,s=Math.round(24*a),m="\u2588".repeat(s)+"\u2591".repeat(Math.max(0,24-s)),c=r?` pass:${r.passed} fail:${r.failed}`:"";return[`checks: ${e} [${m}] ${t}/${n}${c}`]}import{existsSync as rv,readFileSync as av}from"node:fs";var Wo=["agent_prompt.md","solution.patch","test.patch"];function Ho(e=new Date){let t=(s,m=2)=>String(s).padStart(m,"0"),n=-e.getTimezoneOffset(),r=n>=0?"+":"-",a=Math.abs(n);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}${r}${t(Math.floor(a/60))}:${t(a%60)}`}function Qd(e){try{if(!rv(e))return{};let t=JSON.parse(av(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function ef(e){let t={...e.existingReport,timestamp:Ho(),model:`${e.config.provider}/${e.config.modelId}`,thinkingLevel:e.config.thinkingLevel};return delete t.overall,delete t.reports,e.runGapFinder&&(t.testGaps=e.testGaps,e.gapAnalysisIncomplete?t.testGapAnalysisNote=`Gap analysis did not fully complete (sentence finder: ${e.gapFinderStatus}, review: ${e.gapFilterStatus}); testGaps may be incomplete.`:delete t.testGapAnalysisNote),e.runSolverGapFinder&&(t.solverRunSummary=e.solverResults.map(n=>({index:n.index,status:n.status,passed:n.passed,durationMs:n.durationMs,totalTests:n.totalTests,failedTests:n.failedTests,artifactsDir:n.artifactsDir})),t.solverGaps=e.solverGaps,e.solverGapAnalysisIncomplete?t.solverGapAnalysisNote=`Solver-gap analysis did not fully complete (comparison reviewer: ${e.solverComparisonStatus}); solverGaps may be incomplete.`:delete t.solverGapAnalysisNote),t}function tf(e){let t=Math.round(e/1e3);return t>=60?`${Math.floor(t/60)}m ${t%60}s`:`${t}s`}function nf(e){let t=Array.isArray(e.merged.testGaps)?e.merged.testGaps.length:0,n=e.runSolverGapFinder&&Array.isArray(e.merged.solverRunSummary)?e.merged.solverRunSummary.map(s=>({...s,durationMs:s.durationMs??0})):[],r=Array.isArray(e.merged.solverGaps)?e.merged.solverGaps.length:0,a=[];return e.runGapFinder&&a.push(t>0?`${t} test gap(s) found`:"no test gaps found"),e.runSolverGapFinder&&a.push(`${n.filter(s=>s.passed).length}/${n.length} solvers passed, ${r} gap(s) found`),{content:`Gap finders: ${a.join(" | ")}`,details:{gapsCount:t,showGaps:e.runGapFinder,showSolverGaps:e.runSolverGapFinder,solverDetails:n,solverGapsCount:r}}}var rf=`## The problem description (aka the task)\r
3
+ `:"";ot($,`${E}${ct}node_modules
4
+ `,"utf-8")}let A=fe(n,"node_modules"),H=fe(r,"node_modules");if(Ha(A)&&!Ha(H))try{Zf(A,H,process.platform==="win32"?"junction":"dir")}catch{}try{Yf(i,fe(r,"agent_prompt.md"))}catch{}let te=gr(a,"utf-8"),ne=th(te),ue=fe(r,"test.patch");ot(ue,te,"utf-8");let tt=await t.exec("git",["apply","test.patch"],u);try{Xf(ue)}catch{}if(tt.code!==0)return{status:"patchFailed",solverDir:r,error:tt.stderr?.trim()||"git apply test.patch failed"};let N=await t.exec("git",["add","-A"],u);if(N.code!==0)return{status:"error",solverDir:r,error:N.stderr?.trim()||"git add (tests applied) failed"};let nt=await t.exec("git",["commit","-m","tests applied","--allow-empty"],u);if(nt.code!==0)return{status:"error",solverDir:r,error:nt.stderr?.trim()||"git commit (tests applied) failed"};let Ue=await t.exec("git",["rev-parse","HEAD"],u);return Ue.code!==0||!Ue.stdout.trim()?{status:"error",solverDir:r,error:"Could not resolve tests-applied commit hash."}:{status:"ok",solverDir:r,testsAppliedCommit:Ue.stdout.trim(),testPatchPaths:ne}}function rh(e){try{let t=gr(e,"utf-8").match(/<testsuites\b[^>]*>/i)?.[0];if(!t)return{totalTests:null,failedTests:null};let n=m=>Number.parseInt(t.match(new RegExp(`\\b${m}="(\\d+)"`,"i"))?.[1]??"",10),r=n("tests"),a=n("failures"),i=n("errors");return{totalTests:Number.isFinite(r)?r:null,failedTests:Number.isFinite(a)?a+(Number.isFinite(i)?i:0):null}}catch{return{totalTests:null,failedTests:null}}}async function Ci(e){let{pi:t,index:n,workspace:r,status:a,durationMs:i}=e,{solverDir:m,testsAppliedCommit:u,testPatchPaths:l}=r,f={cwd:m,timeout:Ja};await t.exec("git",["add","-A"],f);let h=[...l,"agent_prompt.md"].map(Ue=>`:(exclude)${Ue}`),$=await t.exec("git",["diff","--cached",u,"--",".",...h],f),E=$.code===0?$.stdout:"",A=fe(m,"test_output.xml"),H=`bash test.sh --output_path ${fr(dr(A))} new`,te=lr(),ne=await t.exec(te,["-c",`cd ${fr(dr(m))} && ${H}`],{timeout:Ja*10}),ue=ne.code===0,tt=nh(`${ne.stdout}
5
+ ${ne.stderr}`.trim(),Qf),{totalTests:N,failedTests:nt}=rh(A);return{index:n,status:a,passed:ue,diff:E,testOutputTail:tt,durationMs:i,totalTests:N,failedTests:nt,testOutputXmlPath:A}}function Mi(e){let{repoDir:t,runId:n,index:r,trajectory:a,solutionPatch:i,testOutputXmlPath:m,testOutputTail:u}=e,l=fe(t,eh,n,`solver_${r}`);Ya(l,{recursive:!0}),ot(fe(l,"trajectory.json"),JSON.stringify(a,null,2),"utf-8"),ot(fe(l,"solution.patch"),i,"utf-8");try{let f=gr(m,"utf-8");ot(fe(l,"test_output.xml"),f,"utf-8")}catch{ot(fe(l,"test_output.txt"),u,"utf-8")}return l}function Li(e,t){let n=fe(e,In);Ya(n,{recursive:!0});let r=t.map(a=>{let i=fe(n,`solver_${a.index}`);return Ya(i,{recursive:!0}),ot(fe(i,"solution.diff"),a.diff,"utf-8"),ot(fe(i,"test_output.txt"),a.testOutputTail,"utf-8"),{index:a.index,status:a.status,passed:a.passed}});return ot(fe(n,"manifest.json"),JSON.stringify(r,null,2),"utf-8"),n}function qi(e){let t=fe(e,"node_modules");try{Jf(t).isSymbolicLink()&&Pi(t,{force:!0})}catch{}try{Pi(e,{recursive:!0,force:!0})}catch{}}var p={};Rt(p,{Assign:()=>ah,Clone:()=>Tn,Create:()=>ug,Discard:()=>cg,Metrics:()=>De,Update:()=>lg});var De={assign:0,create:0,clone:0,discard:0,update:0};function ah(e,t){return De.assign+=1,{...e,...t}}var s={};Rt(s,{Entries:()=>wh,EntriesRegExp:()=>kh,Every:()=>vh,EveryAll:()=>$h,GraphemeCount:()=>xh,HasPropertyKey:()=>Th,IsArray:()=>vn,IsBigInt:()=>bn,IsBoolean:()=>zi,IsClassInstance:()=>gh,IsConstructor:()=>uh,IsDeepEqual:()=>eo,IsEqual:()=>M,IsFunction:()=>Bi,IsGreaterEqualThan:()=>Wi,IsGreaterThan:()=>dh,IsInteger:()=>Xa,IsLessEqualThan:()=>Vi,IsLessThan:()=>fh,IsMaxLength:()=>Ih,IsMinLength:()=>bh,IsMultipleOf:()=>hh,IsNull:()=>Ir,IsNumber:()=>br,IsObject:()=>$n,IsObjectNotArray:()=>ch,IsString:()=>vr,IsSymbol:()=>lh,IsUndefined:()=>Qa,IsUnsafePropertyKey:()=>Hi,IsValueLike:()=>yh,Keys:()=>xr,ShiftLeft:()=>$r,Symbols:()=>Eh,Values:()=>Rh});function St(e,t,n){return e>=t&&e<=n}function oh(e){return e===8205}function ih(e){return St(e,55296,56319)}function ji(e){return St(e,127462,127487)}function Di(e){return St(e,65024,65039)}function Gi(e){return St(e,768,879)||St(e,6832,6911)||St(e,7616,7679)||St(e,65056,65071)}function yr(e){return e>65535?2:1}function Fi(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Gi(n)||Di(n))t+=yr(n);else break}return t}function Za(e,t){let n=e.codePointAt(t),r=t+yr(n);for(r=Fi(e,r);r<e.length-1&&e[r]==="\u200D";){let a=e.codePointAt(r+1);r+=1+yr(a),r=Fi(e,r)}return ji(n)&&r<e.length&&ji(e.codePointAt(r))&&(r+=yr(e.codePointAt(r))),r}function Ni(e){return ih(e)||Gi(e)||Di(e)||oh(e)}function Ui(e){let t=0,n=0;for(;n<e.length;)n=Za(e,n),t++;return t}function sh(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=Za(e,r),n++,n>=t)return!0;return!1}function mh(e,t){let n=0,r=0;for(;r<e.length;)if(r=Za(e,r),n++,n>t)return!1;return!0}function _i(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Ni(e.charCodeAt(n)))return sh(e,t);if(n++,n>=t)return!0}return!1}function Ki(e,t){let n=0;for(;n<e.length;){if(Ni(e.charCodeAt(n)))return mh(e,t);if(n++,n>t)return!1}return!0}function vn(e){return Array.isArray(e)}function bn(e){return M(typeof e,"bigint")}function zi(e){return M(typeof e,"boolean")}function uh(e){if(Qa(e)||!Bi(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Bi(e){return M(typeof e,"function")}function Xa(e){return Number.isInteger(e)}function Ir(e){return M(e,null)}function br(e){return Number.isFinite(e)}function ch(e){return $n(e)&&!vn(e)}function $n(e){return M(typeof e,"object")&&!Ir(e)}function vr(e){return M(typeof e,"string")}function lh(e){return M(typeof e,"symbol")}function Qa(e){return M(e,void 0)}function M(e,t){return e===t}function dh(e,t){return e>t}function fh(e,t){return e<t}function Vi(e,t){return e<=t}function Wi(e,t){return e>=t}function hh(e,t){if(bn(e)||bn(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!br(e)||Xa(e)&&1/t%1===0)return!0;let r=e%t;return Math.min(Math.abs(r),Math.abs(r-t),Math.abs(r+t))<n}function gh(e){if(!$n(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Ir(t)?!1:M(typeof t.constructor,"function")&&!(M(t.constructor,globalThis.Object)||M(t.constructor.name,"Object"))}function yh(e){return bn(e)||zi(e)||Ir(e)||br(e)||vr(e)||Qa(e)}function xh(e){return Ui(e)}function Ih(e,t){return Ki(e,t)}function bh(e,t){return _i(e,t)}function vh(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function $h(e,t,n){let r=!0;for(let a=t;a<e.length;a++)n(e[a],a)||(r=!1);return r}function $r(e,t,n){return M(e.length,0)?n():t(e[0],e.slice(1))}function Hi(e){return M(e,"__proto__")||M(e,"constructor")||M(e,"prototype")}function Th(e,t){return Hi(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function kh(e){return xr(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function wh(e){return Object.entries(e)}function xr(e){return Object.getOwnPropertyNames(e)}function Eh(e){return Object.getOwnPropertySymbols(e)}function Rh(e){return Object.values(e)}function Sh(e,t){if(!$n(t))return!1;let n=xr(e);return M(n.length,xr(t).length)&&n.every(r=>eo(e[r],t[r]))}function Oh(e,t){return vn(t)&&M(e.length,t.length)&&e.every((n,r)=>eo(e[r],t[r]))}function eo(e,t){return vn(e)?Oh(e,t):$n(e)?Sh(e,t):M(e,t)}var ft={};Rt(ft,{IsBigInt64Array:()=>zh,IsBigUint64Array:()=>Bh,IsBoolean:()=>Ah,IsDate:()=>Wh,IsFloat32Array:()=>_h,IsFloat64Array:()=>Kh,IsInt16Array:()=>Dh,IsInt32Array:()=>Nh,IsInt8Array:()=>qh,IsMap:()=>Yh,IsNumber:()=>Ch,IsRegExp:()=>Vh,IsSet:()=>Hh,IsString:()=>Mh,IsTypeArray:()=>Lh,IsUint16Array:()=>Gh,IsUint32Array:()=>Uh,IsUint8Array:()=>jh,IsUint8ClampedArray:()=>Fh});function Ah(e){return e instanceof Boolean}function Ch(e){return e instanceof Number}function Mh(e){return e instanceof String}function Lh(e){return globalThis.ArrayBuffer.isView(e)}function qh(e){return e instanceof globalThis.Int8Array}function jh(e){return e instanceof globalThis.Uint8Array}function Fh(e){return e instanceof globalThis.Uint8ClampedArray}function Dh(e){return e instanceof globalThis.Int16Array}function Gh(e){return e instanceof globalThis.Uint16Array}function Nh(e){return e instanceof globalThis.Int32Array}function Uh(e){return e instanceof globalThis.Uint32Array}function _h(e){return e instanceof globalThis.Float32Array}function Kh(e){return e instanceof globalThis.Float64Array}function zh(e){return e instanceof globalThis.BigInt64Array}function Bh(e){return e instanceof globalThis.BigUint64Array}function Vh(e){return e instanceof globalThis.RegExp}function Wh(e){return e instanceof globalThis.Date}function Hh(e){return e instanceof globalThis.Set}function Yh(e){return e instanceof globalThis.Map}function Zh(e){return s.HasPropertyKey(e,"~kind")||s.HasPropertyKey(e,"~unsafe")}function Xh(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let r of Object.keys(n)){if(s.IsUnsafePropertyKey(r))continue;let a=n[r];s.HasPropertyKey(a,"value")&&Object.defineProperty(t,r,{...a,value:Ot(a.value)})}return t}function Qh(e){let t={};for(let n of s.Keys(e))s.IsUnsafePropertyKey(n)||(t[n]=Ot(e[n]));for(let n of s.Symbols(e))t[n]=Ot(e[n]);return t}function eg(e){return s.IsClassInstance(e)?e:Zh(e)?Xh(e):Qh(e)}function tg(e){return e.map(t=>Ot(t))}function ng(e){return e.slice()}function rg(e){return new RegExp(e.source,e.flags)}function ag(e){return new Map(Ot([...e.entries()]))}function og(e){return new Set(Ot([...e.values()]))}function Ot(e){return ft.IsTypeArray(e)?ng(e):ft.IsRegExp(e)?rg(e):ft.IsMap(e)?ag(e):ft.IsSet(e)?og(e):s.IsArray(e)?tg(e):s.IsObject(e)?eg(e):e}function Tn(e){return De.clone+=1,Ot(e)}var Pt={};Rt(Pt,{Get:()=>mg,Reset:()=>ig,Set:()=>sg});var it={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function ig(){it.immutableTypes=!1,it.maxErrors=8,it.useAcceleration=!0,it.exactOptionalPropertyTypes=!1,it.enumerableKind=!1,it.correctiveParse=!1,it.unionPrioritySort=!0}function sg(e){for(let t of s.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(it,t,{value:n})}}function mg(){return it}function pg(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Yi(e,t){return{...e,...t}}function ug(e,t,n={}){De.create+=1;let r=Pt.Get(),a=Yi(t,n),i=r.enumerableKind?Yi(a,e):pg(a,e);return r.immutableTypes?Object.freeze(i):i}function cg(e,t){De.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(Tn(e)),a=new Set(t);for(let i of Object.keys(r))a.has(i)||Object.defineProperty(n,i,r[i]);return n}function lg(e,t,n){De.update+=1;let r=Pt.Get(),a=Tn(e);for(let i of Object.keys(t))Object.defineProperty(a,i,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[i]});for(let i of Object.keys(n))Object.defineProperty(a,i,{configurable:!0,enumerable:!0,writable:!0,value:n[i]});return a}function y(e,t){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],t)}function re(e){return s.IsObject(e)}function I(e,t,n){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function ht(e){return y(e,"Deferred")}function dg(e){return p.Update(e,{"~readonly":!0},{})}function kn(e,t){return p.Update(dg(e),{},t)}function Ji(e,t,n,r){let a=d(e,t,n);return kn(a,r)}function fg(e){return p.Update(e,{"~optional":!0},{})}function wn(e,t){return p.Update(fg(e),{},t)}function Zi(e,t,n,r){let a=d(e,t,n);return wn(a,r)}function Re(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function K(e){return y(e,"Array")}function Tr(e){return p.Discard(e,["~kind","type","items"])}function _e(e,t,n={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function oe(e){return y(e,"Constructor")}function Xi(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ke(e,t,n={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function ie(e){return y(e,"Function")}function Qi(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function st(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function se(e){return y(e,"Ref")}function gt(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Bt(e){return y(e,"Generic")}function Vt(e){return p.Create({"~kind":"Any"},{},e)}function Z(e){return y(e,"Any")}var es="(?!)";function F(e){return p.Create({"~kind":"Never"},{not:{}},e)}function yt(e){return y(e,"Never")}function ze(e,t={}){return I("AddOptional",[e],t)}function At(e,t={}){return wn(e,t)}function ts(e){return At(e)}function he(e){return re(e)&&s.HasPropertyKey(e,"~optional")}function ns(e){return s.Keys(e).filter(t=>!he(e[t]))}function kr(e){return s.Keys(e)}function wr(e){return s.Values(e)}function v(e,t={}){let n=ns(e),r=n.length>0?{required:n}:{};return p.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function L(e){return y(e,"Object")}function rs(e){return p.Discard(e,["~kind","type","properties","required"])}function me(e){return p.Create({"~kind":"Unknown"},{},e)}function ae(e){return y(e,"Unknown")}function Be(e,t,n){let r=s.Keys(e).reduce((a,i)=>({...a,[i]:p.Update(e[i],{},{$id:i})}),{});return p.Create({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function ce(e){return y(e,"Cyclic")}function as(e){return p.Update(e,{"~unsafe":null},{})}function Er(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"~unsafe")&&s.IsNull(e["~unsafe"])}var Ve={};Rt(Ve,{Match:()=>hg});function hg(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function En(...e){let[t,n]=Ve.Match(e,{2:(r,a)=>[r,a,a],1:r=>[r,me(),me()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Y(e){return y(e,"Infer")}function Ct(e,t,n,r={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function V(e){return y(e,"Dependent")}function os(e){return p.Discard(e,["~kind","if","then","else"])}function is(e){return s.IsObjectNotArray(e)}function ss(e){return s.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function ms(e){return s.IsString(e)||s.IsNumber(e)}function ps(e,t){let n=is(e)?ss(e):e;return p.Create({"~kind":"Enum"},{enum:n},t)}function ye(e){return y(e,"Enum")}function ge(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function O(e){return y(e,"Intersect")}function us(e){return p.Discard(e,["~kind","allOf"])}function J(){throw new Error("Unreachable")}var cs;(function(e){e[e.Array=0]="Array",e[e.BigInt=1]="BigInt",e[e.Boolean=2]="Boolean",e[e.Date=3]="Date",e[e.Constructor=4]="Constructor",e[e.Function=5]="Function",e[e.Null=6]="Null",e[e.Number=7]="Number",e[e.Object=8]="Object",e[e.RegExp=9]="RegExp",e[e.String=10]="String",e[e.Symbol=11]="Symbol",e[e.TypeArray=12]="TypeArray",e[e.Undefined=13]="Undefined"})(cs||(cs={}));var fk=BigInt("14695981039346656037"),[hk,gk]=[BigInt("1099511628211"),BigInt("18446744073709551616")],yk=Array.from({length:256}).map((e,t)=>BigInt(t)),ls=new Float64Array(1),xk=new DataView(ls.buffer),Ik=new Uint8Array(ls.buffer);var bk=new TextEncoder;var Rn=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=Rr(n)?m=>this.decode(n["~codec"].decode(m)):this.decode,a=Rr(n)?m=>n["~codec"].encode(t(m)):t,i={decode:r,encode:a};return p.Update(this.type,{"~codec":i},{})}},Sn=class{constructor(t){this.type=t}Decode(t){return new Rn(this.type,t)}};function Sr(e){return new Sn(e)}function fs(e,t){return Sr(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function hs(e,t){return Sr(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function Rr(e){return re(e)&&s.HasPropertyKey(e,"~codec")&&s.IsObject(e["~codec"])&&s.HasPropertyKey(e["~codec"],"encode")&&s.HasPropertyKey(e["~codec"],"decode")}function gs(e){return Wt(e)}function Mt(e){return re(e)&&s.HasPropertyKey(e,"~immutable")}function We(e,t={}){return I("AddReadonly",[e],t)}function Lt(e,t={}){return kn(e,t)}function ys(e){return Lt(e)}function qt(e){return re(e)&&s.HasPropertyKey(e,"~readonly")}function Ig(e,t){let n=to(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":n},{})}function xs(...e){let[t,n,r]=Ve.Match(e,{3:(a,i,m)=>[a,i,m],2:(a,i)=>[a,i,()=>"Refine Error"]});return Ig(t,{check:n,error:r})}function bg(e){return s.IsObjectNotArray(e)&&s.HasPropertyKey(e,"check")&&s.HasPropertyKey(e,"error")&&s.IsFunction(e.check)&&s.IsFunction(e.error)}function to(e){return re(e)&&s.HasPropertyKey(e,"~refine")&&s.IsArray(e["~refine"])&&s.Every(e["~refine"],0,t=>bg(t))}var Is="-?(?:0|[1-9][0-9]*)n";function On(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function He(e){return y(e,"BigInt")}function Or(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Ae(e){return y(e,"Boolean")}function Pn(e){return p.Create({"~kind":"Identifier"},{name:e})}function bs(e){return y(e,"Identifier")}var Pr="-?(?:0|[1-9][0-9]*)";function jt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function xe(e){return y(e,"Integer")}var no=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function vg(e){return s.IsBigInt(e)?"bigint":s.IsBoolean(e)?"boolean":s.IsNumber(e)?"number":s.IsString(e)?"string":(()=>{throw new no(e)})()}function P(e,t){return p.Create({"~kind":"Literal"},{type:vg(e),const:e},t)}function Ar(e){return s.IsBigInt(e)||s.IsBoolean(e)||s.IsNumber(e)||s.IsString(e)}function vs(e){return q(e)&&s.IsNumber(e.const)}function $s(e){return q(e)&&s.IsString(e.const)}function q(e){return y(e,"Literal")}function Ht(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Yt(e){return y(e,"Null")}var Cr="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Te(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function X(e){return y(e,"Number")}function Jt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function xt(e){return y(e,"Symbol")}function Ft(...e){let[t,n,r]=Ve.Match(e,{3:(a,i,m)=>[a,i,m],2:(a,i)=>[a,i,i],1:a=>[a,me(),me()]});return p.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function Ts(e){return y(e,"Parameter")}var Mr=".*";function Ce(e){return p.Create({"~kind":"String"},{type:"string"},e)}function Ie(e){return y(e,"String")}function w(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return y(e,"Union")}function ks(e){return p.Discard(e,["~kind","anyOf"])}function An(e){let t=ws(e);return s.IsEqual(t.length,2)?t[0]:[]}function $g(e){return!0}function Es(e){return s.ShiftLeft(e,(t,n)=>Tg(t)?Es(n):!1,()=>!0)}function Rs(e){return s.IsEqual(e.length,0)?!1:Es(e)}function Tg(e){return x(e)?Rs(e.anyOf):q(e)?$g(e.const):!1}function Lr(e){return Rs(e)}function qr(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Ss(e,t,n=[]){return s.ShiftLeft(e,(r,a)=>Ss(a,t,[...n,`${r}${t}`]),()=>n)}function kg(e,t){return s.IsEqual(e.length,0)?[`${t}`]:Ss(e,t)}function Os(e,t,n=[]){return s.ShiftLeft(t,(r,a)=>Os(e,a,[...n,...Ps(e,r)]),()=>n)}function Ps(e,t){return x(t)?Os(e,t.anyOf):q(t)?kg(e,t.const):J()}function As(e,t){return s.ShiftLeft(t,(n,r)=>As(Ps(e,n),r),()=>e)}function wg(e){return e.map(t=>P(t))}function Eg(e){let t=As([],e),n=wg(t);return w(n)}function Rg(e){return s.IsEqual(e.length,0)?J():s.IsEqual(e.length,1)&&q(e[0])?e[0]:Eg(e)}function ro(e){let t=An(e);return s.IsEqual(t.length,0)?Ce():Lr(t)?Rg(t):qr(e)}function Cs(e){let t=ro(e);return Q(t)?Ce():t}function ve(e,t){let n="object",r={[e]:t};return p.Create({"~kind":"Record"},{type:n,patternProperties:r})}function Ms(e){return ve(Ge,e)}function Ls(e){return v({true:e,false:e})}function ee(e,t={}){let[n,r,a]=[e,e.length,!1];return p.Create({"~kind":"Tuple"},{type:"array",additionalItems:a,items:n,minItems:r},t)}function G(e){return y(e,"Tuple")}function qs(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Sg(e){return p.Discard(e,["~readonly"])}function ao(e,t){return p.Update(Sg(e),{},t)}function js(e,t,n,r){let a=d(e,t,n);return ao(a,r)}function Fs(e,t={}){return I("RemoveReadonly",[e],t)}function Ds(e,t={}){return ao(e,t)}function Og(e){return p.Discard(e,["~optional"])}function oo(e,t){return p.Update(Og(e),{},t)}function Gs(e,t,n,r){let a=d(e,t,n);return oo(a,r)}function Ns(e,t={}){return I("RemoveOptional",[e],t)}function jr(e,t={}){return oo(e,t)}function io(e){return e.reduceRight((n,r,a)=>({[a]:r,...n}),{})}function Us(e){let t=io(e.items);return v(t)}function Pg(e,t){return qt(e)?!!qt(t):!1}function Ag(e,t){return he(e)?!!he(t):!1}function Cg(e,t){let n=Pg(e,t),r=Ag(e,t),a=z([e,t]),i=Ds(jr(a));return n&&r?Lt(At(i)):n&&!r?Lt(i):!n&&r?At(i):i}function Mg(e,t,n){return n in e?n in t?Cg(e[n],t[n]):e[n]:n in t?t[n]:F()}function Lg(e,t){return[...new Set([...s.Keys(t),...s.Keys(e)])].reduce((r,a)=>({...r,[a]:Mg(e,t,a)}),{})}function _s(e){return L(e)?e.properties:G(e)?io(e.items):J()}function Ks(e,t){let n=_s(e),r=_s(t),a=Lg(n,r);return v(a)}function zs(e,t){let n=Zt(e,t);return s.IsEqual(n,Mn)?e:s.IsEqual(n,Ln)||s.IsEqual(n,Cn)?t:F()}function Bs(e){return L(e)||G(e)}function qg(e,t){let n=x(e),r=x(t);return n||r}function jg(e,t){let n=Me(e),r=Me(t),a=qg(n,r),i=Bs(n),m=Bs(r);return a?z([n,r]):i&&m?Ks(n,r):i&&!m?n:!i&&m?r:zs(n,r)}function Vs(e,t,n=[]){return s.ShiftLeft(t,(r,a)=>Vs(e,a,[...n,jg(e,r)]),()=>s.IsEqual(n.length,0)?[e]:n)}function Ws(e,t,n=[]){return s.ShiftLeft(e,(r,a)=>Ws(a,t,[...n,...qn([r],t)]),()=>n)}function qn(e,t=[]){return s.ShiftLeft(e,(n,r)=>x(n)?qn(r,Ws(n.anyOf,t)):qn(r,Vs(n,t)),()=>t)}function Fg(e,t){let n=le({},e,t);return b.IsExtendsTrueLike(n)?[]:[e]}function Dg(e,t){return e.reduce((n,r)=>[...n,...Fg(r,t)],[])}function Fr(e,t){let n=Me(e),r=x(n)?n.anyOf:[n],a=Dg(r,t);return ke(a)}function Ne(e,t,n){let r=ge([e,t]),a=Fr(n,e);return ke([r,a])}function Se(e){let t=e.map(n=>P(n));return ke(t)}function z(e){let t=qn(e),n=so(t);return mt(n)}function $e(e){let t=Cs(e);return Me(t)}function ke(e){let t=so(e);return mt(t)}function Me(e){return V(e)?Ne(e.if,e.then,e.else):ye(e)?Se(e.enum):O(e)?z(e.allOf):Q(e)?$e(e.pattern):x(e)?ke(e.anyOf):e}function mt(e){return s.IsEqual(e.length,1)?e[0]:s.IsEqual(e.length,0)?F():w(e)}function Hs(e,t){let n=Se(e);return It(n,t)}function Ys(e,t){return ve(bt,t)}function Js(e,t){let n=z(e);return It(n,t)}function Zs(e,t){return s.IsString(e)||s.IsNumber(e)?v({[e]:t}):s.IsEqual(e,!1)?v({false:t}):s.IsEqual(e,!0)?v({true:t}):v({})}function Xs(e,t){return ve(Xt,t)}function Qs(e,t){return s.HasPropertyKey(e,"pattern")&&(s.IsString(e.pattern)||e.pattern instanceof RegExp)?ve(e.pattern.toString(),t):ve(Ge,t)}function em(e,t){let n=An(e);return Lr(n)?It($e(e),t):ve(e,t)}function Gg(e){return x(e)?jn(e.anyOf):[e]}function jn(e){return e.reduce((t,n)=>[...t,...Gg(n)],[])}function Ng(e){return e.some(t=>Ie(t)||X(t)||xe(t))}function Ug(e,t){return s.IsEqual(Ng(e),!0)?ve(Ge,t):void 0}function _g(e,t){return e.reduce((n,r)=>q(r)&&(s.IsString(r.const)||s.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function Kg(e,t){let n=_g(e,t);return v(n)}function tm(e,t){let n=jn(e),r=Ug(n,t);return re(r)?r:Kg(n,t)}function It(e,t){return Z(e)?Ms(t):Ae(e)?Ls(t):ye(e)?Hs(e.enum,t):xe(e)?Ys(e,t):O(e)?Js(e.allOf,t):q(e)?Zs(e.const,t):X(e)?Xs(e,t):x(e)?tm(e.anyOf,t):Ie(e)?Qs(e,t):Q(e)?em(e.pattern,t):v({})}function mo(e,t,n){return k([e])?p.Update(It(e,t),{},n):Dr(e,t,n)}function nm(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return mo(i,m,a)}var bt=`^${Pr}$`,Xt=`^${Cr}$`,Ge=`^${Mr}$`;function Dr(e,t,n={}){return I("Record",[e,t],n)}function Gr(e,t,n={}){return mo(e,t,n)}function rm(e,t){return ve(e,t)}function Nr(e){return s.IsEqual(e,Ge)?Ce():s.IsEqual(e,bt)?jt():s.IsEqual(e,Xt)?Te():ro(e)}function Le(e){return s.Keys(e.patternProperties)[0]}function Qt(e){let t=Le(e);return Nr(t)}function be(e){return e.patternProperties[Le(e)]}function de(e){return y(e,"Record")}function Dt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function vt(e){return y(e,"Rest")}function Ur(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function _r(e){return y(e,"This")}function en(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function tn(e){return y(e,"Undefined")}function Kr(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Ye(e){return y(e,"Void")}function Bg(e,t){return s.IsEqual(e,"Array")?Re(t[0]):s.IsEqual(e,"Capitalize")?Br(t[0]):s.IsEqual(e,"ConstructorParameters")?Jr(t[0]):s.IsEqual(e,"Evaluate")?ou(t[0]):s.IsEqual(e,"Exclude")?Zr(t[0],t[1]):s.IsEqual(e,"Extract")?Xr(t[0],t[1]):s.IsEqual(e,"Index")?Nn(t[0],t[1]):s.IsEqual(e,"InstanceType")?Qr(t[0]):s.IsEqual(e,"Lowercase")?Vr(t[0]):s.IsEqual(e,"NonNullable")?ea(t[0]):s.IsEqual(e,"Omit")?ta(t[0],t[1]):s.IsEqual(e,"Parameters")?na(t[0]):s.IsEqual(e,"Partial")?ra(t[0]):s.IsEqual(e,"Pick")?aa(t[0],t[1]):s.IsEqual(e,"Readonly")?oa(t[0]):s.IsEqual(e,"KeyOf")?Un(t[0]):s.IsEqual(e,"Record")?Dr(t[0],t[1]):s.IsEqual(e,"Required")?ia(t[0]):s.IsEqual(e,"ReturnType")?sa(t[0]):s.IsEqual(e,"Uncapitalize")?Wr(t[0]):s.IsEqual(e,"Uppercase")?Hr(t[0]):Gn(st(e),t)}function Gt(){throw Error("Unreachable")}var Vg=(e,t=[])=>e.reduce((n,r)=>s.IsArray(r)&&s.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),pt=e=>{let[t,n]=e;return Vg([...t,...n])};function mm(e){return Ft(e[0],e[2],e[4])}function pm(e){return Ft(e[0],e[2],e[2])}function um(e){return Ft(e[0],me(),e[2])}function cm(e){return Ft(e,me(),me())}function lm(e){return pt(e)}function dm(e){return e[1]}function fm(e){return pt(e)}function hm(e){return e[1]}function gm(e){return Bg(e[0],e[1])}function ym(e){return null}function xm(e){return Ce()}function Im(e){return Te()}function bm(e){return Or()}function vm(e){return en()}function $m(e){return Ht()}function Tm(e){return jt()}function km(e){return On()}function wm(e){return me()}function Em(e){return Vt()}function Rm(e){return v({})}function Sm(e){return F()}function Om(e){return Jt()}function Pm(e){return Kr()}function Am(e){return Ur()}function Cm(e){return P(BigInt(e))}function Mm(e){return P(s.IsEqual(e,"true"))}function Lm(e){return P(parseFloat(e))}function qm(e){return P(e)}function jm(e){return e[1]}function Fm(e){return P(e)}function Dm(e){return s.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Gm(e){return e[1]}function Nm(e){return zr(e)}function Um(e){return s.IsEqual(e.length,6)?Ct(e[1],e[3],e[5]):Ct(e[1],e[3],me())}function _m(e){return e.length>0}function Km(e){return e.reduce((t,n)=>s.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function zm(e){return s.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Bm(e){return s.IsArray(e)&&s.IsEqual(e.length,3)?e[1]:e}function Vm(e){return s.IsEqual(e.length,2)?e[1]:[]}function am(e,t){return t.reduce((n,r)=>{let a=r;return s.IsEqual(a.length,1)?Nn(n,a[0]):s.IsEqual(a.length,0)?Re(n):Gt()},e)}function om(e,t){return s.IsEqual(t.length,3)?Yr(e,t[0],t[1],t[2]):e}function Wg(e,t){return s.IsArray(t)&&s.IsEqual(t.length,0)?e:ma(e,t)}function Wm(e){let[t,n,r,a,i]=e;return Wg(om(t?Un(am(n,r)):am(n,r),a),i)}function po(e,t){return s.IsEqual(t.length,3)?(()=>{let[n,r,a]=t,i=po(r,a);if(s.IsEqual(n,"&"))return O(i)?ge([e,...i.allOf]):ge([e,i]);if(s.IsEqual(n,"|"))return x(i)?w([e,...i.anyOf]):w([e,i]);Gt()})():e}function Hm(e){let[t,n]=e;return po(t,n)}function Ym(e){let[t,n]=e;return po(t,n)}function Jm(e){return au(e[1])}function Zm(e){return e[1]}function Xm(e){return gt(e[0],e[2])}function Qm(e){return s.IsEqual(e.length,4)?En(e[1],e[3]):s.IsEqual(e.length,2)?En(e[1],me()):Gt()}function ep(e){return`${e}`}function tp(e){return xe(e[3])?bt:X(e[3])?Xt:xt(e[3])?Ge:Ie(e[3])?Ge:Gt()}function np(e){return e.length>0}function rp(e){return e.length>0}function ap(e){let[t,n,r,a,i]=e;return{[n]:t&&r?We(ze(i)):t&&!r?We(i):!t&&r?ze(i):i}}function op(e){return pt(e)}function ip(e){return e.reduce((t,n)=>s.HasPropertyKey(n,bt)||s.HasPropertyKey(n,Xt)||s.HasPropertyKey(n,Ge)?[t[0],p.Assign(t[1],n)]:[p.Assign(t[0],n),t[1]],[{},{}])}function sp(e){return ip(e[1])}function mp(e){let[t,n]=e,r=s.IsEqual(s.Keys(n).length,0)?{}:{patternProperties:n};return v(t,r)}function pp(e){return s.IsEqual(e.length,5)?We(ze(e[4])):s.IsEqual(e.length,3)?e[2]:s.IsEqual(e.length,4)?s.IsEqual(e[2],"readonly")?We(e[3]):ze(e[3]):Gt()}function up(e){return We(ze(e[1]))}function cp(e){return We(e[1])}function lp(e){return ze(e[0])}function dp(e){return s.IsEqual(e.length,2)?Dt(e[1]):s.IsEqual(e.length,1)?e[0]:Gt()}function fp(e){return pt(e)}function hp(e){return ee(e[1])}function gp(e){return We(ze(e[4]))}function yp(e){return We(e[3])}function xp(e){return ze(e[3])}function Ip(e){return e[2]}function bp(e){return s.IsEqual(e.length,2)?Dt(e[1]):s.IsEqual(e.length,1)?e[0]:Gt()}function vp(e){return pt(e)}function $p(e){return Ke(e[1],e[4])}function Tp(e){return _e(e[2],e[5])}function im(e,t){return s.IsEqual(e,"remove")?Fs(t):s.IsEqual(e,"add")?We(t):t}function kp(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function sm(e,t){return s.IsEqual(e,"remove")?Ns(t):s.IsEqual(e,"add")?ze(t):t}function wp(e){return s.IsEqual(e.length,2)&&s.IsEqual(e[0],"-")?"remove":s.IsEqual(e.length,2)&&s.IsEqual(e[0],"+")||s.IsEqual(e.length,1)?"add":"none"}function Ep(e){return s.IsEqual(e.length,2)?[e[1]]:[]}function Rp(e){return s.IsArray(e[6])&&s.IsEqual(e[6].length,1)?Fn(Pn(e[3]),e[5],e[6][0],im(e[1],sm(e[8],e[10]))):Fn(Pn(e[3]),e[5],st(e[3]),im(e[1],sm(e[8],e[10])))}function Sp(e){return st(e)}function Op(e){return BigInt(e)}function Pp(e){return parseFloat(e)}function Ap(e){return s.IsEqual(e,"true")}function Cp(e){return null}function Mp(e){return{[e[0]]:e[2]}}function Lp(e){return pt(e)}function Hg(e){return e.reduce((t,n)=>p.Assign(t,n),{})}function qp(e){return Hg(e[1])}function jp(e){return pt(e)}function Fp(e){return e[1]}function Dp(e){return On()}function Gp(e){return Ce()}function Np(e){return Te()}function Up(e){return jt()}function _p(e){return F()}function Kp(e){return P(e)}function zp(e){return w(e[1])}function Bp(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Vp(e){return[e[0],...e[1]]}function Wp(e){return e[1]}function Hp(e){return pt(e)}function Yp(e){return s.IsEqual(e.length,2)?e[1]:[]}function Jp(e){let t=e[2],n=e[3],[r,a]=e[4],i=s.IsEqual(s.Keys(a).length,0)?{}:{patternProperties:a};return{[e[1]]:gt(t,Dn(n,r,i))}}function Zp(e){let t=e[2],[n,r]=e[3],a=s.IsEqual(s.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:Dn(t,n,a)}}function Xp(e){return{[e[1]]:gt(e[2],e[4])}}function Qp(e){return{[e[1]]:e[3]}}function eu(e){return null}function tu(e){return ip(pt(e))}function nu(e){return e[1]}function ru(e){let t=e[0],n=e[1];return iu(p.Assign(t,n[0]))}function _n(e){return M(e.length,2)}function R(e,t,n){return _n(e)?t(e[0],e[1]):n()}function Zg(e,t){return M(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function B(e,t){for(let n=0;n<e.length;n++){let r=Zg(e[n],t);if(_n(r))return r}return[]}function uo(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var su=[...uo(97,122),...uo(65,90)],co="0",lo=uo(49,57),nn=[co,...lo],mu=" ",rn=`
6
+ `;var $t="_",pa=".",pu="$",ua="-";var uu="//",cu="/*",Qg="*/";function lu(e){let t=e.indexOf(Qg);return M(t,-1)?"":e.slice(t+2)}function du(e){let t=e.indexOf(rn);return M(t,-1)?"":e.slice(t)}function ey(e){return e.replace(/^[ \t\r\f\v]+/,"")}function ca(e){let t=ey(e);return t.startsWith(cu)?ca(lu(t.slice(2))):t.startsWith(uu)?ca(du(t.slice(2))):t}function pe(e){let t=e.trimStart();return t.startsWith(cu)?pe(lu(t.slice(2))):t.startsWith(uu)?pe(du(t.slice(2))):t}function la(e,t){return R(B([e],t),(n,r)=>[n,r],()=>["",t])}function ty(e,t){return e.includes(t)}function an(e,t,n,r=""){return R(B(e,n),(a,i)=>ty(t,a)?an(e,t,i,r):an(e,t,i,`${r}${a}`),()=>[r,n])}function ny(e){return B(lo,e)}var ry=[...nn,$t];function ay(e){return an(ry,[$t],e)}function oy(e){return R(B([co],e),(t,n)=>[t,n],()=>R(ny(e),(t,n)=>R(ay(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[]))}function da(e){return oy(pe(e))}function iy(e){return la(ua,e)}function sy(e){return R(iy(e),(t,n)=>R(da(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function fu(e){return sy(pe(e))}function my(e){return R(fu(e),(t,n)=>R(B(["n"],n),(r,a)=>[`${t}`,a],()=>[]),()=>[])}function fo(e){return my(e)}function ho(e,t){return B([e],t)}function c(e,t){return M(e,"")?["",t]:e.startsWith(rn)?ho(e,ca(t)):e.startsWith(mu)?ho(e,t):ho(e,pe(t))}var hu=[...su,$t,pu];function py(e){return B(hu,e)}var uy=[...hu,...nn];function gu(e,t=""){return R(B(uy,e),(n,r)=>gu(r,`${t}${n}`),()=>[t,e])}function cy(e){return R(py(e),(t,n)=>R(gu(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function W(e){return cy(pe(e))}var ly=[...nn,$t];function dy(e){return _n(B([pa],e))}function yu(e){return R(an(ly,[$t],e),(t,n)=>M(t,"")?[]:[t,n],()=>[])}function fy(e){return R(B([pa],e),(t,n)=>R(yu(n),(r,a)=>[`0${t}${r}`,a],()=>[]),()=>[])}function hy(e){return R(da(e),(t,n)=>R(B([pa],n),(r,a)=>R(yu(a),(i,m)=>[`${t}${r}${i}`,m],()=>[`${t}`,a]),()=>[`${t}`,n]),()=>[])}function gy(e){return dy(e)?fy(e):hy(e)}function xu(e){return gy(pe(e))}function yy(e){return la(ua,e)}function xy(e){return R(yy(e),(t,n)=>R(xu(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function fa(e){return xy(pe(e))}function Iy(e){return M(e,"")?[]:[e.slice(0,1),e.slice(1)]}function Iu(e,t){return $r(e,(n,r)=>t.startsWith(n)?!0:Iu(r,t),()=>!1)}function Tt(e,t,n=""){return R(Iy(t),(r,a)=>Iu(e,t)?[n,t]:Tt(e,a,`${n}${r}`),()=>[])}function by(e,t,n){return R(B([e],n),(r,a)=>R(Tt([t],a),(i,m)=>R(B([t],m),(u,l)=>[`${i}`,l],()=>[]),()=>[]),()=>[])}function vy(e,t,n){return R(B([e],n),(r,a)=>R(Tt([rn,t],a),(i,m)=>R(B([t],m),(u,l)=>[`${i}`,l],()=>[]),()=>[]),()=>[])}function bu(e,t,n,r){return n?by(e,t,pe(r)):vy(e,t,pe(r))}function $y(e,t){return B(e,t)}function Ty(e,t){return bu(e,e,!1,t)}function ky(e,t){return R($y(e,t),(n,r)=>Ty(n,`${n}${r}`),()=>[])}function ha(e,t){return ky(e,pe(t))}function vu(e,t){return R(Tt(e,t),(n,r)=>M(n,"")?[]:[n,r],()=>[])}var o=(e,t,n=()=>[])=>e.length===2?t(e):n(),Ey=e=>o(o(W(e),([t,n])=>o(c("extends",n),([r,a])=>o(S(a),([i,m])=>o(c("=",m),([u,l])=>o(S(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[mm(t),n]),Ry=e=>o(o(W(e),([t,n])=>o(c("extends",n),([r,a])=>o(S(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[pm(t),n]),Sy=e=>o(o(W(e),([t,n])=>o(c("=",n),([r,a])=>o(S(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[um(t),n]),Oy=e=>o(W(e),([t,n])=>[cm(t),n]),ku=e=>o(o(Ey(e),([t,n])=>[t,n],()=>o(Ry(e),([t,n])=>[t,n],()=>o(Sy(e),([t,n])=>[t,n],()=>o(Oy(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),wu=(e,t=[])=>o(o(ku(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>wu(r,[...t,n]),()=>[t,e]),Py=e=>o(o(wu(e),([t,n])=>o(o(o(ku(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[lm(t),n]),xo=e=>o(o(c("<",e),([t,n])=>o(Py(n),([r,a])=>o(c(">",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[dm(t),n]),Eu=(e,t=[])=>o(o(S(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>Eu(r,[...t,n]),()=>[t,e]),Ay=e=>o(o(Eu(e),([t,n])=>o(o(o(S(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[fm(t),n]),Cy=e=>o(o(c("<",e),([t,n])=>o(Ay(n),([r,a])=>o(c(">",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[hm(t),n]),My=e=>o(o(W(e),([t,n])=>o(Cy(n),([r,a])=>[[t,r],a])),([t,n])=>[gm(t),n]),Ru=e=>o(o(o(c(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[ym(t),n]),Su=e=>o(c("string",e),([t,n])=>[xm(t),n]),Ou=e=>o(c("number",e),([t,n])=>[Im(t),n]),Ly=e=>o(c("boolean",e),([t,n])=>[bm(t),n]),qy=e=>o(c("undefined",e),([t,n])=>[vm(t),n]),jy=e=>o(c("null",e),([t,n])=>[$m(t),n]),Pu=e=>o(c("integer",e),([t,n])=>[Tm(t),n]),Fy=e=>o(c("bigint",e),([t,n])=>[km(t),n]),Dy=e=>o(c("unknown",e),([t,n])=>[wm(t),n]),Gy=e=>o(c("any",e),([t,n])=>[Em(t),n]),Ny=e=>o(c("object",e),([t,n])=>[Rm(t),n]),Uy=e=>o(c("never",e),([t,n])=>[Sm(t),n]),Au=e=>o(c("symbol",e),([t,n])=>[Om(t),n]),_y=e=>o(c("void",e),([t,n])=>[Pm(t),n]),Ky=e=>o(c("this",e),([t,n])=>[Am(t),n]),zy=e=>o(o(c("${",e),([t,n])=>o(S(n),([r,a])=>o(c("}",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[jm(t),n]),go=e=>o(Tt(["${","`"],e),([t,n])=>[Fm(t),n]),Cu=e=>o(o(o(go(e),([t,n])=>o(zy(n),([r,a])=>o(Cu(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o(o(go(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(go(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[Dm(t),n]),Io=e=>o(o(c("`",e),([t,n])=>o(Cu(n),([r,a])=>o(c("`",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Gm(t),n]),By=e=>o(Io(e),([t,n])=>[Nm(t),n]),Vy=e=>o(o(o(c("if",e),([t,n])=>o(S(n),([r,a])=>o(c("then",a),([i,m])=>o(S(m),([u,l])=>o(c("else",l),([f,h])=>o(S(h),([$,E])=>[[t,r,i,u,f,$],E])))))),([t,n])=>[t,n],()=>o(o(c("if",e),([t,n])=>o(S(n),([r,a])=>o(c("then",a),([i,m])=>o(S(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[Um(t),n]),Wy=e=>o(fo(e),([t,n])=>[Cm(t),n]),Hy=e=>o(o(c("true",e),([t,n])=>[t,n],()=>o(c("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[Mm(t),n]),Yy=e=>o(fa(e),([t,n])=>[Lm(t),n]),Jy=e=>o(ha(["'",'"'],e),([t,n])=>[qm(t),n]),Zy=e=>o(o(o(c("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[_m(t),n]),Mu=(e,t=[])=>o(o(o(c("[",e),([n,r])=>o(S(r),([a,i])=>o(c("]",i),([m,u])=>[[n,a,m],u]))),([n,r])=>[n,r],()=>o(o(c("[",e),([n,r])=>o(c("]",r),([a,i])=>[[n,a],i])),([n,r])=>[n,r],()=>[])),([n,r])=>Mu(r,[...t,n]),()=>[t,e]),Xy=e=>o(Mu(e),([t,n])=>[Km(t),n]),Qy=e=>o(o(o(c("extends",e),([t,n])=>o(S(n),([r,a])=>o(c("?",a),([i,m])=>o(S(m),([u,l])=>o(c(":",l),([f,h])=>o(S(h),([$,E])=>[[t,r,i,u,f,$],E])))))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[zm(t),n]),ex=e=>o(o(o(c("(",e),([t,n])=>o(S(n),([r,a])=>o(c(")",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o(Su(e),([t,n])=>[t,n],()=>o(Ou(e),([t,n])=>[t,n],()=>o(Ly(e),([t,n])=>[t,n],()=>o(qy(e),([t,n])=>[t,n],()=>o(jy(e),([t,n])=>[t,n],()=>o(Pu(e),([t,n])=>[t,n],()=>o(Fy(e),([t,n])=>[t,n],()=>o(Dy(e),([t,n])=>[t,n],()=>o(Gy(e),([t,n])=>[t,n],()=>o(Ny(e),([t,n])=>[t,n],()=>o(Uy(e),([t,n])=>[t,n],()=>o(Au(e),([t,n])=>[t,n],()=>o(_y(e),([t,n])=>[t,n],()=>o(Ky(e),([t,n])=>[t,n],()=>o(Wy(e),([t,n])=>[t,n],()=>o(Hy(e),([t,n])=>[t,n],()=>o(Yy(e),([t,n])=>[t,n],()=>o(Jy(e),([t,n])=>[t,n],()=>o(By(e),([t,n])=>[t,n],()=>o(Vy(e),([t,n])=>[t,n],()=>o(dx(e),([t,n])=>[t,n],()=>o(Ix(e),([t,n])=>[t,n],()=>o(wx(e),([t,n])=>[t,n],()=>o(kx(e),([t,n])=>[t,n],()=>o(Ox(e),([t,n])=>[t,n],()=>o(My(e),([t,n])=>[t,n],()=>o(Px(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[Bm(t),n]),tx=e=>o(o(o(c("with",e),([t,n])=>o(Yu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Vm(t),n]),Lu=e=>o(o(Zy(e),([t,n])=>o(ex(n),([r,a])=>o(Xy(a),([i,m])=>o(Qy(m),([u,l])=>o(tx(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[Wm(t),n]),qu=e=>o(o(o(c("&",e),([t,n])=>o(Lu(n),([r,a])=>o(qu(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ju=e=>o(o(Lu(e),([t,n])=>o(qu(n),([r,a])=>[[t,r],a])),([t,n])=>[Hm(t),n]),Fu=e=>o(o(o(c("|",e),([t,n])=>o(ju(n),([r,a])=>o(Fu(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ga=e=>o(o(ju(e),([t,n])=>o(Fu(n),([r,a])=>[[t,r],a])),([t,n])=>[Ym(t),n]),nx=e=>o(o(c("readonly",e),([t,n])=>o(ga(n),([r,a])=>[[t,r],a])),([t,n])=>[Jm(t),n]),rx=e=>o(o(c("|",e),([t,n])=>o(ga(n),([r,a])=>[[t,r],a])),([t,n])=>[Zm(t),n]),ax=e=>o(o(xo(e),([t,n])=>o(c("=",n),([r,a])=>o(S(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Xm(t),n]),ox=e=>o(o(o(c("infer",e),([t,n])=>o(W(n),([r,a])=>o(c("extends",a),([i,m])=>o(ga(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[t,n],()=>o(o(c("infer",e),([t,n])=>o(W(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>[])),([t,n])=>[Qm(t),n]),S=e=>o(o(ox(e),([t,n])=>[t,n],()=>o(rx(e),([t,n])=>[t,n],()=>o(nx(e),([t,n])=>[t,n],()=>o(ga(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),ix=e=>o(fa(e),([t,n])=>[ep(t),n]),sx=e=>o(W(e),([t,n])=>[t,n]),mx=e=>o(ha(["'",'"'],e),([t,n])=>[t,n]),px=e=>o(o(c("[",e),([t,n])=>o(W(n),([r,a])=>o(c(":",a),([i,m])=>o(o(Pu(m),([u,l])=>[u,l],()=>o(Ou(m),([u,l])=>[u,l],()=>o(Su(m),([u,l])=>[u,l],()=>o(Au(m),([u,l])=>[u,l],()=>[])))),([u,l])=>o(c("]",l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[tp(t),n]),Du=e=>o(o(ix(e),([t,n])=>[t,n],()=>o(sx(e),([t,n])=>[t,n],()=>o(mx(e),([t,n])=>[t,n],()=>o(px(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),ux=e=>o(o(o(c("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[np(t),n]),cx=e=>o(o(o(c("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[rp(t),n]),Gu=e=>o(o(ux(e),([t,n])=>o(Du(n),([r,a])=>o(cx(a),([i,m])=>o(c(":",m),([u,l])=>o(S(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[ap(t),n]),Nu=e=>o(o(o(c(",",e),([t,n])=>o(c(`
7
+ `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c(";",e),([t,n])=>o(c(`
8
+ `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(c(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(c(`
9
+ `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),Uu=(e,t=[])=>o(o(Gu(e),([n,r])=>o(Nu(r),([a,i])=>[[n,a],i])),([n,r])=>Uu(r,[...t,n]),()=>[t,e]),lx=e=>o(o(Uu(e),([t,n])=>o(o(o(Gu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[op(t),n]),bo=e=>o(o(c("{",e),([t,n])=>o(lx(n),([r,a])=>o(c("}",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[sp(t),n]),dx=e=>o(bo(e),([t,n])=>[mp(t),n]),fx=e=>o(o(o(W(e),([t,n])=>o(c("?",n),([r,a])=>o(c(":",a),([i,m])=>o(c("readonly",m),([u,l])=>o(S(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(c(":",n),([r,a])=>o(c("readonly",a),([i,m])=>o(S(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(c("?",n),([r,a])=>o(c(":",a),([i,m])=>o(S(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[t,n],()=>o(o(W(e),([t,n])=>o(c(":",n),([r,a])=>o(S(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[pp(t),n]),hx=e=>o(o(c("readonly",e),([t,n])=>o(S(n),([r,a])=>o(c("?",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[up(t),n]),gx=e=>o(o(c("readonly",e),([t,n])=>o(S(n),([r,a])=>[[t,r],a])),([t,n])=>[cp(t),n]),yx=e=>o(o(S(e),([t,n])=>o(c("?",n),([r,a])=>[[t,r],a])),([t,n])=>[lp(t),n]),$u=e=>o(o(fx(e),([t,n])=>[t,n],()=>o(hx(e),([t,n])=>[t,n],()=>o(gx(e),([t,n])=>[t,n],()=>o(yx(e),([t,n])=>[t,n],()=>o(S(e),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),_u=e=>o(o(o(c("...",e),([t,n])=>o($u(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o($u(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[dp(t),n]),Ku=(e,t=[])=>o(o(_u(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>Ku(r,[...t,n]),()=>[t,e]),xx=e=>o(o(Ku(e),([t,n])=>o(o(o(_u(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[fp(t),n]),Ix=e=>o(o(c("[",e),([t,n])=>o(xx(n),([r,a])=>o(c("]",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[hp(t),n]),bx=e=>o(o(W(e),([t,n])=>o(c("?",n),([r,a])=>o(c(":",a),([i,m])=>o(c("readonly",m),([u,l])=>o(S(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[gp(t),n]),vx=e=>o(o(W(e),([t,n])=>o(c(":",n),([r,a])=>o(c("readonly",a),([i,m])=>o(S(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[yp(t),n]),$x=e=>o(o(W(e),([t,n])=>o(c("?",n),([r,a])=>o(c(":",a),([i,m])=>o(S(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[xp(t),n]),Tx=e=>o(o(W(e),([t,n])=>o(c(":",n),([r,a])=>o(S(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Ip(t),n]),Tu=e=>o(o(bx(e),([t,n])=>[t,n],()=>o(vx(e),([t,n])=>[t,n],()=>o($x(e),([t,n])=>[t,n],()=>o(Tx(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),zu=e=>o(o(o(c("...",e),([t,n])=>o(Tu(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(Tu(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[bp(t),n]),Bu=(e,t=[])=>o(o(zu(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>Bu(r,[...t,n]),()=>[t,e]),Vu=e=>o(o(Bu(e),([t,n])=>o(o(o(zu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[vp(t),n]),kx=e=>o(o(c("(",e),([t,n])=>o(Vu(n),([r,a])=>o(c(")",a),([i,m])=>o(c("=>",m),([u,l])=>o(S(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[$p(t),n]),wx=e=>o(o(c("new",e),([t,n])=>o(c("(",n),([r,a])=>o(Vu(a),([i,m])=>o(c(")",m),([u,l])=>o(c("=>",l),([f,h])=>o(S(h),([$,E])=>[[t,r,i,u,f,$],E])))))),([t,n])=>[Tp(t),n]),Ex=e=>o(o(o(c("+",e),([t,n])=>o(c("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c("-",e),([t,n])=>o(c("readonly",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[kp(t),n]),Rx=e=>o(o(o(c("+",e),([t,n])=>o(c("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c("-",e),([t,n])=>o(c("?",n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[wp(t),n]),Sx=e=>o(o(o(c("as",e),([t,n])=>o(S(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ep(t),n]),Ox=e=>o(o(c("{",e),([t,n])=>o(Ex(n),([r,a])=>o(c("[",a),([i,m])=>o(W(m),([u,l])=>o(c("in",l),([f,h])=>o(S(h),([$,E])=>o(Sx(E),([A,H])=>o(c("]",H),([te,ne])=>o(Rx(ne),([ue,tt])=>o(c(":",tt),([N,nt])=>o(S(nt),([Ue,ct])=>o(Ru(ct),([rt,lt])=>o(c("}",lt),([zt,dt])=>[[t,r,i,u,f,$,A,te,ue,N,Ue,rt,zt],dt]))))))))))))),([t,n])=>[Rp(t),n]),Px=e=>o(W(e),([t,n])=>[Sp(t),n]),Ax=e=>o(fo(e),([t,n])=>[Op(t),n]),Cx=e=>o(fa(e),([t,n])=>[Pp(t),n]),Mx=e=>o(o(c("true",e),([t,n])=>[t,n],()=>o(c("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[Ap(t),n]),Lx=e=>o(ha(['"',"'"],e),([t,n])=>[t,n]),qx=e=>o(c("null",e),([t,n])=>[Cp(t),n]),jx=e=>o(c("undefined",e),([t,n])=>[void 0,n]),Wu=e=>o(o(Du(e),([t,n])=>o(c(":",n),([r,a])=>o(vo(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Mp(t),n]),Hu=(e,t=[])=>o(o(Wu(e),([n,r])=>o(Nu(r),([a,i])=>[[n,a],i])),([n,r])=>Hu(r,[...t,n]),()=>[t,e]),Fx=e=>o(o(Hu(e),([t,n])=>o(o(o(Wu(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Lp(t),n]),Yu=e=>o(o(c("{",e),([t,n])=>o(Fx(n),([r,a])=>o(c("}",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[qp(t),n]),Ju=(e,t=[])=>o(o(vo(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>Ju(r,[...t,n]),()=>[t,e]),Dx=e=>o(o(Ju(e),([t,n])=>o(o(o(vo(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[jp(t),n]),Gx=e=>o(o(c("[",e),([t,n])=>o(Dx(n),([r,a])=>o(c("]",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Fp(t),n]),vo=e=>o(o(Ax(e),([t,n])=>[t,n],()=>o(Cx(e),([t,n])=>[t,n],()=>o(Mx(e),([t,n])=>[t,n],()=>o(Lx(e),([t,n])=>[t,n],()=>o(qx(e),([t,n])=>[t,n],()=>o(jx(e),([t,n])=>[t,n],()=>o(Yu(e),([t,n])=>[t,n],()=>o(Gx(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),Nx=e=>o(c("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[Dp(t),n]),Ux=e=>o(c(".*",e),([t,n])=>[Gp(t),n]),_x=e=>o(c("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[Np(t),n]),Kx=e=>o(c("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[Up(t),n]),zx=e=>o(c("(?!)",e),([t,n])=>[_p(t),n]),Bx=e=>o(vu(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[Kp(t),n]),Vx=e=>o(o(Nx(e),([t,n])=>[t,n],()=>o(Ux(e),([t,n])=>[t,n],()=>o(_x(e),([t,n])=>[t,n],()=>o(Kx(e),([t,n])=>[t,n],()=>o(zx(e),([t,n])=>[t,n],()=>o(Wx(e),([t,n])=>[t,n],()=>o(Bx(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),Wx=e=>o(o(c("(",e),([t,n])=>o($o(n),([r,a])=>o(c(")",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[zp(t),n]),Zu=e=>o(o(o(yo(e),([t,n])=>o(c("|",n),([r,a])=>o(Zu(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[t,n],()=>o(o(yo(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[Bp(t),n]),yo=e=>o(o(Vx(e),([t,n])=>o($o(n),([r,a])=>[[t,r],a])),([t,n])=>[Vp(t),n]),$o=e=>o(o(Zu(e),([t,n])=>[t,n],()=>o(yo(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ws=e=>o(o(c("^",e),([t,n])=>o($o(n),([r,a])=>o(c("$",a),([i,m])=>[[t,r,i],m]))),([t,n])=>[Wp(t),n]),Xu=(e,t=[])=>o(o(S(e),([n,r])=>o(c(",",r),([a,i])=>[[n,a],i])),([n,r])=>Xu(r,[...t,n]),()=>[t,e]),Hx=e=>o(o(Xu(e),([t,n])=>o(o(o(S(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Hp(t),n]),Qu=e=>o(o(o(c("extends",e),([t,n])=>o(Hx(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Yp(t),n]),Yx=e=>o(o(c("interface",e),([t,n])=>o(W(n),([r,a])=>o(xo(a),([i,m])=>o(Qu(m),([u,l])=>o(bo(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[Jp(t),n]),Jx=e=>o(o(c("interface",e),([t,n])=>o(W(n),([r,a])=>o(Qu(a),([i,m])=>o(bo(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[Zp(t),n]),Zx=e=>o(o(c("type",e),([t,n])=>o(W(n),([r,a])=>o(xo(a),([i,m])=>o(c("=",m),([u,l])=>o(S(l),([f,h])=>[[t,r,i,u,f],h]))))),([t,n])=>[Xp(t),n]),Xx=e=>o(o(c("type",e),([t,n])=>o(W(n),([r,a])=>o(c("=",a),([i,m])=>o(S(m),([u,l])=>[[t,r,i,u],l])))),([t,n])=>[Qp(t),n]),Qx=e=>o(o(o(c("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[eu(t),n]),eI=e=>o(o(o(c(";",e),([t,n])=>o(c(`
10
+ `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(c(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(c(`
11
+ `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),ec=(e,t=[])=>o(o(To(e),([n,r])=>o(eI(r),([a,i])=>[[n,a],i])),([n,r])=>ec(r,[...t,n]),()=>[t,e]),tI=e=>o(o(ec(e),([t,n])=>o(o(o(To(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[tu(t),n]),To=e=>o(o(Qx(e),([t,n])=>o(o(Yx(n),([r,a])=>[r,a],()=>o(Jx(n),([r,a])=>[r,a],()=>o(Zx(n),([r,a])=>[r,a],()=>o(Xx(n),([r,a])=>[r,a],()=>[])))),([r,a])=>o(Ru(a),([i,m])=>[[t,r,i],m]))),([t,n])=>[nu(t),n]),nI=e=>o(o(To(e),([t,n])=>o(tI(n),([r,a])=>[[t,r],a])),([t,n])=>[ru(t),n]),tc=e=>o(o(nI(e),([t,n])=>[t,n],()=>o(ax(e),([t,n])=>[t,n],()=>o(S(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function nc(e){let t=Io(`\`${e}\``);return s.IsEqual(t.length,2)?t[0]:J()}function aI(e){return e.join("|")}function oI(e){return e.slice(1,e.length-1)}function iI(e,t,n){return kt(t,`${n}${e}`)}function sI(e,t){return kt(e,`${t}${Is}`)}function mI(e,t){return kt(e,`${t}${Pr}`)}function pI(e,t){return kt(e,`${t}${Cr}`)}function uI(e,t){return Kn(w([P("false"),P("true")]),e,t)}function cI(e,t){return kt(e,`${t}${Mr}`)}function lI(e,t,n){return kt(t,`${n}${oI(e)}`)}function dI(e,t,n){let r=zn(e,{});return Kn(r,t,n)}function fI(e,t,n){let r=Se(e);return Kn(r,t,n)}function rc(e,t,n,r=[]){return s.ShiftLeft(e,(a,i)=>rc(i,t,n,[...r,Kn(a,[],"")]),()=>kt(t,`${n}(${aI(r)})`))}function Kn(e,t,n){return ye(e)?fI(e.enum,t,n):xe(e)?mI(t,n):q(e)?iI(e.const,t,n):He(e)?sI(t,n):Ae(e)?uI(t,n):X(e)?pI(t,n):Ie(e)?cI(t,n):Q(e)?lI(e.pattern,t,n):oc(e)?dI(e.parameters[0],t,n):x(e)?rc(e.anyOf,t,n):es}function kt(e,t){return s.ShiftLeft(e,(n,r)=>Kn(n,r,t),()=>t)}function hI(e){return`^${kt(e,"")}$`}function ac(e){let t=hI(e);return qr(t)}function zn(e,t){return k(e)?p.Update(ac(e),{},t):zr(e,t)}function ic(e,t,n,r){let a=Oe(e,t,n);return zn(a,r)}function zr(e,t={}){return I("TemplateLiteral",[e],t)}function oc(e){return re(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"TemplateLiteral")}function sc(e){return zn(e,{})}function gI(e){let t=nc(e);return sc(t)}function mc(e,t={}){let n=s.IsString(e)?gI(e):sc(e);return p.Update(n,{},t)}function Q(e){return y(e,"TemplateLiteral")}var b={};Rt(b,{ExtendsFalse:()=>T,ExtendsTrue:()=>g,ExtendsUnion:()=>ko,IsExtendsFalse:()=>yI,IsExtendsTrue:()=>uc,IsExtendsTrueLike:()=>on,IsExtendsUnion:()=>pc,Match:()=>_});function ko(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function pc(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsUnion")&&s.IsObject(e.inferred)}function g(e){return p.Create({"~kind":"ExtendsTrue"},{inferred:e})}function uc(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"inferred")&&s.IsEqual(e["~kind"],"ExtendsTrue")&&s.IsObject(e.inferred)}function T(){return p.Create({"~kind":"ExtendsFalse"},{})}function yI(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.IsEqual(e["~kind"],"ExtendsFalse")}function on(e){return pc(e)||uc(e)}function _(e,t,n){return on(e)?t(e.inferred):n()}function xI(e,t,n,r){return _(C(e,n,r),a=>g(p.Assign(p.Assign(e,a),{[t]:n})),()=>T())}function II(e,t){return g(e)}function bI(e,t,n,r,a){return _(C(e,t,n),i=>_(C(i,t,r),m=>g(m),()=>T()),()=>_(C(e,t,a),i=>g(i),()=>T()))}function vI(e,t,n){let r=Se(n);return C(e,t,r)}function cc(e,t,n){return s.ShiftLeft(n,(r,a)=>_(C(e,t,r),i=>cc(i,t,a),()=>T()),()=>g(e))}function $I(e,t,n){let r=$e(n);return C(e,t,r)}function lc(e,t,n){return s.ShiftLeft(n,(r,a)=>_(C(e,t,r),i=>g(i),()=>lc(e,t,a)),()=>T())}function j(e,t,n){return Z(n)?II(e,t):V(n)?bI(e,t,n.if,n.then,n.else):ye(n)?vI(e,t,n.enum):Y(n)?xI(e,n.name,t,n.extends):O(n)?cc(e,t,n.allOf):Q(n)?$I(e,t,n.pattern):x(n)?lc(e,t,n.anyOf):ae(n)?g(e):T()}function dc(e,t,n){return Y(n)?j(e,t,n):Z(n)?g(e):ae(n)?g(e):ko(e)}function TI(e,t){let n=Mt(e),r=Mt(t);return n&&r||!n&&r?!0:!(n&&!r)}function fc(e,t,n,r){return K(r)?TI(t,r)?C(e,n,r.items):T():j(e,t,r)}function hc(e,t,n){return He(n)?g(e):j(e,t,n)}function gc(e,t,n){return Ae(n)?g(e):j(e,t,n)}function kI(e,t,n,r,a){let i=Y(r)?t:r,m=Y(r)?r:t,u=he(t),l=he(r);return!u&&l?T():_(C(e,i,m),f=>Bn(f,n,a),()=>T())}function wI(e,t,n,r){return s.ShiftLeft(r,(a,i)=>kI(e,t,n,a,i),()=>he(t)?g(e):T())}function EI(e,t,n){return s.ShiftLeft(t,(r,a)=>wI(e,r,a,n),()=>g(e))}function Bn(e,t,n){return EI(e,t,n)}function ya(e,t,n){return Ye(n)?g(e):C(e,t,n)}function yc(e,t,n,r){return Z(r)?g(e):ae(r)?g(e):oe(r)?_(Bn(e,t,r.parameters),a=>ya(a,n,r.instanceType),()=>T()):T()}function xc(e,t,n,r,a){return _(C(e,t,a),()=>C(e,n,a),()=>C(e,r,a))}function Ic(e,t,n){let r=Se(t);return C(e,r,n)}function bc(e,t,n,r){return Z(r)?g(e):ae(r)?g(e):ie(r)?_(Bn(e,t,r.parameters),a=>ya(a,n,r.returnType),()=>T()):T()}function vc(e,t,n){return xe(n)?g(e):X(n)?g(e):j(e,t,n)}function $c(e,t,n){let r=z(t);return C(e,r,n)}function xa(e,t,n){return t===n?g(e):T()}function RI(e,t,n){return q(n)?xa(e,t,n.const):He(n)?g(e):j(e,P(t),n)}function SI(e,t,n){return q(n)?xa(e,t,n.const):Ae(n)?g(e):j(e,P(t),n)}function OI(e,t,n){return q(n)?xa(e,t,n.const):X(n)?g(e):j(e,P(t),n)}function PI(e,t,n){return q(n)?xa(e,t,n.const):Ie(n)?g(e):j(e,P(t),n)}function Tc(e,t,n){return s.IsBigInt(t.const)?RI(e,t.const,n):s.IsBoolean(t.const)?SI(e,t.const,n):s.IsNumber(t.const)?OI(e,t.const,n):s.IsString(t.const)?PI(e,t.const,n):J()}function kc(e,t,n){return Y(n)?j(e,t,n):g(e)}function wc(e,t,n){return Yt(n)?g(e):j(e,t,n)}function Ec(e,t,n){return X(n)?g(e):j(e,t,n)}function AI(e,t,n){return he(t)?he(n)?g(e):T():g(e)}function CI(e,t,n){return Y(n)&&yt(n.extends)?T():_(C(e,t,n),r=>AI(r,t,n),()=>T())}function MI(e,t){return e.reduce((n,r)=>r in t?on(t[r])?{...n,...t[r].inferred}:J():J(),{})}function LI(e,t,n){let r={};for(let m of s.Keys(n))r[m]=m in t?CI({},t[m],n[m]):he(n[m])?Y(n[m])?g(p.Assign(e,{[n[m].name]:n[m].extends})):g(e):T();let a=s.Values(r).every(m=>on(m)),i=a?MI(s.Keys(r),r):{};return a?g(i):T()}function qI(e,t,n){let r=LI(e,t,n);return on(r)?g(p.Assign(e,r.inferred)):T()}function jI(e,t,n){return qI(e,t,n)}function FI(e,t){return s.Keys(t).reduce((n,r)=>({...n,[r]:s.HasPropertyKey(e,r)?x(n[r])?w([...n[r].anyOf,t[r]]):w([e[r],t[r]]):t[r]}),e)}function Rc(e,t,n,r){return s.ShiftLeft(t,(a,i)=>_(C({},e[a],n),m=>Rc(e,i,n,FI(r,m)),()=>T()),()=>g(r))}function DI(e,t,n,r){let a=s.Keys(t);return Rc(t,a,r,e)}function Sc(e,t,n){return de(n)?DI(e,t,Le(n),be(n)):L(n)?jI(e,t,n.properties):j(e,v(t),n)}function GI(e,t){return s.IsEqual(s.Keys(t).length,0)?g(e):T()}function NI(e,t,n,r,a){return C(e,n,a)}function Oc(e,t,n,r){return de(r)?NI(e,Nr(t),n,Nr(Le(r)),be(r)):L(r)?GI(e,r.properties):Z(r)?g(e):ae(r)?g(e):T()}function Pc(e,t,n){return Ie(n)?g(e):j(e,t,n)}function Ac(e,t,n){return xt(n)?g(e):j(e,t,n)}function Cc(e,t,n){let r=$e(t);return C(e,r,n)}function wo(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function Vn(e){return s.IsObject(e)&&s.HasPropertyKey(e,"~kind")&&s.HasPropertyKey(e,"name")&&s.HasPropertyKey(e,"type")&&s.IsEqual(e["~kind"],"Inferrable")&&s.IsString(e.name)&&s.IsObject(e.type)}function Eo(e){return vt(e)?Y(e.items)?K(e.items.extends)?wo(e.items.name,e.items.extends.items):ae(e.items.extends)?wo(e.items.name,e.items.extends):void 0:J():void 0}function Ia(e){return Y(e)?wo(e.name,e.extends):void 0}function Ro(e,t,n=[]){return s.ShiftLeft(e,(r,a)=>_(C({},r,t),()=>Ro(a,t,[...n,r]),()=>{}),()=>n)}function Mc(e,t,n,r){let a=Ro(n,r);return s.IsArray(a)?g(p.Assign(e,{[t]:ee(a)})):T()}function ba(e,t,n,r){let a=Ro(n,r);return s.IsArray(a)?g(p.Assign(e,{[t]:w(a)})):T()}function UI(e){return[...e].reverse()}function So(e,t){return t?UI(e):e}function _I(e){let t=e.length>0?e[0]:void 0,n=re(t)?Eo(t):void 0;return re(n)}function KI(e,t,n,r,a,i){return _(C(e,n,a),m=>Lc(m,t,r,i),()=>T())}function zI(e,t,n,r,a){let i=Eo(r);return Vn(i)?Mc(e,i.name,So(n,t),i.type):s.ShiftLeft(n,(m,u)=>KI(e,t,m,u,r,a),()=>T())}function BI(e,t,n,r){return s.ShiftLeft(r,(a,i)=>zI(e,t,n,a,i),()=>s.IsEqual(n.length,0)?g(e):T())}function Lc(e,t,n,r){return BI(e,t,n,r)}function VI(e,t,n){let r=wt(e,U([],[]),n),a=_I(r);return Lc(e,a,So(t,a),So(r,a))}function qc(e,t,n){let r=Ia(n);return Vn(r)?ba(e,r.name,t,r.type):s.ShiftLeft(t,(a,i)=>_(C(e,a,n),m=>qc(m,i,n),()=>T()),()=>g(e))}function jc(e,t,n){let r=wt(e,U([],[]),t);return G(n)?VI(e,r,n.items):K(n)?qc(e,r,n.items):j(e,ee(r),n)}function Fc(e,t,n){return Ye(n)?g(e):tn(n)?g(e):j(e,t,n)}function Dc(e,t,n){return s.ShiftLeft(n,(r,a)=>_(C(e,t,r),i=>g(i),()=>Dc(e,t,a)),()=>T())}function Oo(e,t,n){return s.ShiftLeft(t,(r,a)=>_(Dc(e,r,n),i=>Oo(i,a,n),()=>T()),()=>g(e))}function Gc(e,t,n){let r=Ia(n);return Vn(r)?ba(e,r.name,t,r.type):x(n)?Oo(e,t,n.anyOf):Oo(e,t,[n])}function Nc(e,t,n){return Y(n)?j(e,t,n):Z(n)?g(e):ae(n)?g(e):T()}function Uc(e,t,n){return Ye(n)?g(e):j(e,t,n)}function C(e,t,n){return Z(t)?dc(e,t,n):K(t)?fc(e,t,t.items,n):He(t)?hc(e,t,n):Ae(t)?gc(e,t,n):oe(t)?yc(e,t.parameters,t.instanceType,n):V(t)?xc(e,t.if,t.then,t.else,n):ye(t)?Ic(e,t.enum,n):ie(t)?bc(e,t.parameters,t.returnType,n):xe(t)?vc(e,t,n):O(t)?$c(e,t.allOf,n):q(t)?Tc(e,t,n):yt(t)?kc(e,t,n):Yt(t)?wc(e,t,n):X(t)?Ec(e,t,n):L(t)?Sc(e,t.properties,n):de(t)?Oc(e,Le(t),be(t),n):Ie(t)?Pc(e,t,n):xt(t)?Ac(e,t,n):Q(t)?Cc(e,t.pattern,n):G(t)?jc(e,t.items,n):tn(t)?Fc(e,t,n):x(t)?Gc(e,t.anyOf,n):ae(t)?Nc(e,t,n):Ye(t)?Uc(e,t,n):T()}function WI(e,t){return z([...e,v(t)])}function Po(e,t,n){return k(e)?p.Update(WI(e,t),{},n):Dn(e,t,n)}function _c(e,t,n,r,a){let i=Oe(e,t,n),m=Wn(e,t,r);return Po(i,m,a)}function Dn(e,t,n={}){return I("Interface",[e,t],n)}function sn(e){return re(e)&&s.HasPropertyKey(e,"action")&&s.IsEqual(e.action,"Interface")}function Kc(e,t,n={}){return Po(e,t,n)}function HI(e,t,n){return e.includes(n)?!0:Hn([...e,n],t,t[n])}function zc(e,t,n){let r=wr(n);return Nt(e,t,r)}function Nt(e,t,n){return s.ShiftLeft(n,(r,a)=>Hn(e,t,r)?!0:Nt(e,t,a),()=>!1)}function Hn(e,t,n){return se(n)?HI(e,t,n.$ref):K(n)?Hn(e,t,n.items):oe(n)?Nt(e,t,[...n.parameters,n.instanceType]):ie(n)?Nt(e,t,[...n.parameters,n.returnType]):sn(n)?zc(e,t,n.parameters[1]):O(n)?Nt(e,t,n.allOf):L(n)?zc(e,t,n.properties):x(n)?Nt(e,t,n.anyOf):G(n)?Nt(e,t,n.items):de(n)?Hn(e,t,be(n)):!1}function Bc(e,t,n){return Hn(e,t,n)}function YI(e,t){return t.reduce((n,r)=>Bc([r],e,e[r])?[...n,r]:n,[])}function Vc(e){let t=kr(e);return YI(e,t)}function JI(e,t,n){return n.includes(t)?n:t in e?Yn(e,e[t],[...n,t]):J()}function Wc(e,t,n){let r=wr(t);return mn(e,r,n)}function mn(e,t,n){return t.reduce((r,a)=>Yn(e,a,r),n)}function Yn(e,t,n){return se(t)?JI(e,t.$ref,n):K(t)?Yn(e,t.items,n):oe(t)?mn(e,[...t.parameters,t.instanceType],n):ie(t)?mn(e,[...t.parameters,t.returnType],n):sn(t)?Wc(e,t.parameters[1],n):O(t)?mn(e,t.allOf,n):L(t)?Wc(e,t.properties,n):x(t)?mn(e,t.anyOf,n):G(t)?mn(e,t.items,n):de(t)?Yn(e,be(t),n):n}function Hc(e,t,n){return Yn(e,n,[t])}function ZI(e){return Vt()}function XI(e){return s.Keys(e).reduce((t,n)=>({...t,[n]:Ut(e[n])}),{})}function Jn(e){return e.reduce((t,n)=>[...t,Ut(n)],[])}function Ut(e){return se(e)?ZI(e.$ref):K(e)?Re(Ut(e.items),Tr(e)):oe(e)?_e(Jn(e.parameters),Ut(e.instanceType)):ie(e)?Ke(Jn(e.parameters),Ut(e.returnType)):O(e)?ge(Jn(e.allOf)):L(e)?v(XI(e.properties)):de(e)?Gr(Qt(e),Ut(be(e))):x(e)?w(Jn(e.anyOf)):G(e)?ee(Jn(e.items)):e}function QI(e,t){return t in e?Ut(e[t]):me()}function Yc(e){return QI(e.$defs,e.$ref)}function eb(e,t,n){let r=Oe(e,U([],[]),t),a=Wn({},U([],[]),n);return z([...r,v(a)])}function tb(e,t){return s.Keys(e).filter(r=>t.includes(r)).reduce((r,a)=>{let i=e[a],m=sn(i)?eb(e,i.parameters[0],i.parameters[1]):i;return{...r,[a]:m}},{})}function Jc(e,t,n){let r=Hc(e,t,n),a=tb(e,r);return Be(a,t)}function Zc(e,t){return t in e?se(e[t])?Zc(e,e[t].$ref):e[t]:F()}function Je(e,t){return Zc(e,t)}function Xc(e){return ce(e)?Yc(e):Er(e)?me():e}function le(e,t,n){let r=Xc(t),a=Xc(n);return C(e,r,a)}var Cn="equal",nb="disjoint",Mn="left-inside",Ln="right-inside";function Zt(e,t){let n=[ae(e)?b.ExtendsFalse():le({},e,t),ae(e)?b.ExtendsTrue({}):le({},t,e)];return b.IsExtendsTrueLike(n[0])&&b.IsExtendsTrueLike(n[1])?Cn:b.IsExtendsTrueLike(n[0])&&b.IsExtendsFalse(n[1])?Mn:b.IsExtendsFalse(n[0])&&b.IsExtendsTrueLike(n[1])?Ln:nb}function rb(e,t){return t.filter(n=>Zt(e,n)!==Ln)}function ab(e,t){let n=t.some(r=>{let a=Zt(e,r);return s.IsEqual(a,Mn)||s.IsEqual(a,Cn)});return s.IsEqual(n,!1)}function ob(e,t){let n=Me(e);return Z(n)?[n]:ab(n,t)?[...rb(n,t),n]:t}function ib(e){return e.reduce((t,n)=>L(n)?[...t,n]:yt(n)?t:ob(n,t),[])}function so(e){let t=ib(e);return jn(t)}function Ao(e,t){return p.Update(Me(e),{},t)}function Qc(e,t,n,r){let a=d(e,t,n);return Ao(a,r)}function Zn(e,t=[]){return ht(e)&&s.IsEqual(e.action,"Conditional")?se(e.parameters[0])?Zn(e.parameters[2],Zn(e.parameters[3],[...t,e.parameters[0].$ref])):Zn(e.parameters[2],Zn(e.parameters[3],t)):ht(e)&&s.IsEqual(e.action,"Mapped")&&ht(e.parameters[1])&&s.IsEqual(e.parameters[1].action,"KeyOf")&&se(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function sb(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function nl(e,t,n=[]){return s.ShiftLeft(e,(r,a)=>s.ShiftLeft(t,(i,m)=>nl(a,m,[...n,[i,r]]),()=>n),()=>n)}function mb(e){return x(e)?[...e.anyOf]:[e]}function pb(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function el(e,t){return t.reduce((n,r)=>[...n,...pb(e,r)],[])}function tl(e){return e.reduce((t,n)=>s.IsEqual(n[0],!0)?el(t,mb(n[1])):el(t,[n[1]]),[[]])}function rl(e,t,n){let r=Zn(n),a=sb(e,r),i=nl(t,a);return ht(n)&&s.IsEqual(n.action,"Conditional")||ht(n)&&s.IsEqual(n.action,"Mapped")?tl(i):[t]}function ub(){return["(not-resolvable)",F()]}function cb(){return["(not-generic)",F()]}function lb(e,t,n){return[e,gt(t,n)]}function db(e,t,n){return t in e?al(e,t,e[t],n):ub()}function al(e,t,n,r){return Bt(n)?lb(t,n.parameters,n.expression):se(n)?db(e,n.$ref,r):cb()}function ol(e,t,n){return al(e,"(anonymous)",t,n)}function fb(e,t,n){if(Y(t)||pn(t)||b.IsExtendsTrueLike(le({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw new Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function il(e,t,n,r,a){let i=d(e,t,a);return fb(n,i,r),p.Assign(e,{[n]:i})}function hb(e,t,n,r,a){let i=d(e,t,n.extends),m=d(e,t,n.equals);return s.ShiftLeft(a,(u,l)=>Co(il(e,t,n.name,i,u),t,r,l),()=>Co(il(e,t,n.name,i,m),t,r,[]))}function Co(e,t,n,r){return s.ShiftLeft(n,(a,i)=>hb(e,t,a,i,r),()=>e)}function sl(e,t,n,r){return Co(e,t,n,r)}function gb(e){return s.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function yb(e,t){return s.IsEqual(gb(e),t)}function xb(e,t,n,r,a,i){let m=sl(e,t,r,i),u=d(m,U([...t.callstack,n.$ref],t.visited),a);return d(m,U([],[]),u)}function Ib(e,t,n,r,a,i){return i.reduce((m,u)=>[...m,xb(e,t,n,r,a,u)],[])}function bb(e,t,n,r,a,i){let m=rl(r,i,a),u=Ib(e,t,n,r,a,m);return s.IsEqual(u.length,1)?u[0]:ke(u)}function va(e,t,n,r){let a=Oe(e,t,r),i=ol(e,n,r),m=i[0],u=i[1];return Bt(u)?yb(t,m)?Gn(st(m),a):bb(e,t,st(m),u.parameters,u.expression,a):Gn(n,a)}function Gn(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function ml(e,t){return va({},U([],[]),e,t)}function pn(e){return y(e,"Call")}function vb(e){return p.Discard(e,["~immutable"])}function pl(e,t){return p.Update(vb(e),{},t)}function ul(e,t,n,r){let a=d(e,t,n);return pl(a,r)}function cl(e,t){return e(t)}function ll(e,t){return s.IsString(t)?P(cl(e,t)):P(t)}function dl(e,t){let n=$e(t);return ut(e,n)}function fl(e,t){let n=t.map(r=>ut(e,r));return w(n)}function ut(e,t){return q(t)?ll(e,t.const):Q(t)?dl(e,t.pattern):x(t)?fl(e,t.anyOf):t}function Br(e,t={}){return I("Capitalize",[e],t)}function hl(e,t={}){return Mo(e,t)}function Vr(e,t={}){return I("Lowercase",[e],t)}function gl(e,t={}){return Lo(e,t)}function Wr(e,t={}){return I("Uncapitalize",[e],t)}function yl(e,t={}){return qo(e,t)}function Hr(e,t={}){return I("Uppercase",[e],t)}function xl(e,t={}){return jo(e,t)}var $b=e=>e[0].toUpperCase()+e.slice(1),Tb=e=>e.toLowerCase(),kb=e=>e[0].toLowerCase()+e.slice(1),wb=e=>e.toUpperCase();function Mo(e,t){return k([e])?p.Update(ut($b,e),{},t):Br(e,t)}function Lo(e,t){return k([e])?p.Update(ut(Tb,e),{},t):Vr(e,t)}function qo(e,t){return k([e])?p.Update(ut(kb,e),{},t):Wr(e,t)}function jo(e,t){return k([e])?p.Update(ut(wb,e),{},t):Hr(e,t)}function Il(e,t,n,r){let a=d(e,t,n);return Mo(a,r)}function bl(e,t,n,r){let a=d(e,t,n);return Lo(a,r)}function vl(e,t,n,r){let a=d(e,t,n);return qo(a,r)}function $l(e,t,n,r){let a=d(e,t,n);return jo(a,r)}function Yr(e,t,n,r,a={}){return I("Conditional",[e,t,n,r],a)}function Tl(e,t,n,r,a={}){return Fo({},U([],[]),e,t,n,r,a)}function Eb(e,t,n,r,a,i){let m=le(e,n,r);return b.IsExtendsUnion(m)?w([d(m.inferred,t,a),d(e,t,i)]):b.IsExtendsTrue(m)?d(m.inferred,t,a):d(e,t,i)}function Fo(e,t,n,r,a,i,m){return k([n,r])?p.Update(Eb(e,t,n,r,a,i),{},m):Yr(n,r,a,i,m)}function kl(e,t,n,r,a,i,m){let u=d(e,t,n),l=d(e,t,r);return Fo(e,t,u,l,a,i,m)}function Jr(e,t={}){return I("ConstructorParameters",[e],t)}function wl(e,t={}){return Do(e,t)}function Rb(e){let t=oe(e)?e.parameters:[],n=wt({},U([],[]),t);return ee(n)}function Do(e,t){return k([e])?p.Update(Rb(e),{},t):Jr(e,t)}function El(e,t,n,r){let a=d(e,t,n);return Do(a,r)}function Zr(e,t,n={}){return I("Exclude",[e,t],n)}function Rl(e,t,n={}){return Xn(e,t,n)}function Xn(e,t,n){return k([e,t])?p.Update(Fr(e,t),{},n):Zr(e,t,n)}function Sl(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return Xn(i,m,a)}function Xr(e,t,n={}){return I("Extract",[e,t],n)}function Ol(e,t,n={}){return Go(e,t,n)}function Sb(e,t){let n=le({},e,t);return b.IsExtendsTrueLike(n)?[e]:[]}function Ob(e,t){return e.reduce((n,r)=>[...n,...Sb(r,t)],[])}function Pl(e,t){let n=Me(e),r=x(n)?n.anyOf:[n],a=Ob(r,t);return ke(a)}function Go(e,t,n){return k([e,t])?p.Update(Pl(e,t),{},n):Xr(e,t,n)}function Al(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return Go(i,m,a)}function Pb(e){return e.reduce((t,n)=>Ar(n)?[...t,P(n)]:t,[])}function un(e){let t=Pb(e);return w(t)}function Nn(e,t,n={}){return I("Index",[e,t],n)}function Cl(e,t,n={}){let r=s.IsArray(t)?un(t):t;return No(e,r,n)}function Ml(e,t){let n=Je(e,t);return Pe(n)}function Ll(e,t,n){let r=Ne(e,t,n);return Pe(r)}function Ab(e,t){let n=s.Keys(e).filter(h=>!s.HasPropertyKey(t,h)),r=s.Keys(t).filter(h=>!s.HasPropertyKey(e,h)),a=s.Keys(e).filter(h=>s.HasPropertyKey(t,h)),i=n.reduce((h,$)=>({...h,[$]:e[$]}),{}),m=r.reduce((h,$)=>({...h,[$]:t[$]}),{}),u=a.reduce((h,$)=>({...h,[$]:z([e[$],t[$]])}),{}),l=p.Assign(i,m);return p.Assign(l,u)}function ql(e){return e.reduce((t,n)=>Ab(t,Pe(n)),{})}function jl(e){let t=Us(ee(e));return Pe(t)}function Cb(e,t){return s.Keys(e).filter(a=>a in t).reduce((a,i)=>({...a,[i]:ke([e[i],t[i]])}),{})}function Fl(e,t){return s.ShiftLeft(e,(n,r)=>Fl(r,Cb(t,Pe(n))),()=>t)}function Dl(e){return s.ShiftLeft(e,(t,n)=>Fl(n,Pe(t)),()=>J())}function Pe(e){return ce(e)?Ml(e.$defs,e.$ref):V(e)?Ll(e.if,e.then,e.else):O(e)?ql(e.allOf):x(e)?Dl(e.anyOf):G(e)?jl(e.items):L(e)?e.properties:{}}function cn(e){let t=Pe(e);return v(t)}var Mb=new RegExp("^(?:0|[1-9][0-9]*)$");function ln(e){let t=`${e}`;return Mb.test(t)?parseInt(t):e}function Lb(e){return P(ln(e))}function Gl(e){return e.map(t=>Nl(t))}function Nl(e){return O(e)?ge(Gl(e.allOf)):x(e)?w(Gl(e.anyOf)):q(e)?Lb(e.const):e}function Ul(e,t){let n=Nl(t),r=le({},n,Te());return b.IsExtendsTrueLike(r)?e:q(t)&&s.IsEqual(t.const,"length")?Te():F()}function _l(e,t){let n=Je(e,t);return we(n)}function Kl(e,t,n){let r=Ne(e,t,n);return we(r)}function zl(e){let t=Se(e);return we(t)}function Bl(e){let t=z(e);return we(t)}function Vl(e){return[`${e}`]}function Wl(e){let t=$e(e);return we(t)}function Hl(e){return e.reduce((t,n)=>[...t,...we(n)],[])}function we(e){return ce(e)?_l(e.$defs,e.$ref):V(e)?Kl(e.if,e.then,e.else):ye(e)?zl(e.enum):O(e)?Bl(e.allOf):q(e)?Vl(e.const):Q(e)?Wl(e.pattern):x(e)?Hl(e.anyOf):[]}function dn(e){return we(e)}function Qn(e,t){return t.map(n=>er(e,n))}function er(e,t){return K(t)?Re(er(e,t.items)):oe(t)?_e(Qn(e,t.parameters),er(e,t.instanceType)):ie(t)?Ke(Qn(e,t.parameters),er(e,t.returnType)):G(t)?ee(Qn(e,t.items)):x(t)?w(Qn(e,t.anyOf)):O(t)?ge(Qn(e,t.allOf)):_r(t)?v(e):t}function Yl(e,t){return er(e,t)}function qb(e,t){let n=t in e?e[t]:F();return Yl(e,n)}function Jl(e,t){return t.reduce((n,r)=>[...n,qb(e,r)],[])}function jb(e,t){let n=dn(t),r=Jl(e,n);return ke(r)}var Fb=new RegExp(bt);function Db(e){return e.filter(n=>Fb.test(n))}function Gb(e){let t=kr(e),n=Db(t),r=Jl(e,n);return ke(r)}function Zl(e,t){return X(t)?Gb(e):jb(e,t)}function Nb(e){return P(ln(e))}function Xl(e){return e.map(t=>Uo(t))}function Uo(e){return O(e)?ge(Xl(e.allOf)):x(e)?w(Xl(e.anyOf)):q(e)?Nb(e.const):e}function Ub(e,t){return e.reduceRight((n,r,a)=>{let i=le({},P(a),t);return b.IsExtendsTrueLike(i)?[r,...n]:n},[])}function _b(e,t){let n=Uo(t),r=Ub(e,n);return mt(r)}function Kb(e){return mt(e)}function Ql(e,t){return q(t)&&s.IsEqual(t.const,"length")?P(e.length):X(t)||xe(t)?Kb(e):_b(e,t)}function ed(e,t){return K(e)?Ul(e.items,t):L(e)?Zl(e.properties,t):G(e)?Ql(e.items,t):F()}function zb(e){return ce(e)||V(e)||O(e)||x(e)?cn(e):e}function No(e,t,n){return k([e,t])?p.Update(ed(zb(e),t),{},n):Nn(e,t,n)}function td(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return No(i,m,a)}function Qr(e,t={}){return I("InstanceType",[e],t)}function nd(e,t={}){return _o(e,t)}function Bb(e){return oe(e)?e.instanceType:F()}function _o(e,t){return k([e])?p.Update(Bb(e),{},t):Qr(e,t)}function rd(e,t,n,r={}){let a=d(e,t,n);return _o(a,r)}function Un(e,t={}){return I("KeyOf",[e],t)}function ad(e,t={}){return Ko(e,t)}function od(){return w([Te(),Ce(),Jt()])}function id(e){return Te()}function Vb(e){return e.reduce((n,r)=>Ar(r)?[...n,P(ln(r))]:J(),[])}function sd(e){let t=s.Keys(e),n=Vb(t);return mt(n)}function md(e){return Qt(e)}function pd(e){let t=e.map((n,r)=>P(r));return mt(t)}function ud(e){return Z(e)?od():K(e)?id(e.items):L(e)?sd(e.properties):de(e)?md(e):G(e)?pd(e.items):F()}function Wb(e){return ce(e)||V(e)||O(e)||x(e)?cn(e):e}function Ko(e,t){return k([e])?p.Update(ud(Wb(e)),{},t):Un(e,t)}function cd(e,t,n,r){let a=d(e,t,n);return Ko(a,r)}function Fn(e,t,n,r,a={}){return I("Mapped",[e,t,n,r],a)}function ld(e,t,n,r,a={}){return zo({},U([],[]),e,t,n,r,a)}function Hb(e){let t=$e(e);return $a(t)}function Yb(e){return e.reduce((t,n)=>[...t,...$a(n)],[])}function Jb(e){let t=Se(e);return $a(t)}function Zb(e){return s.IsNumber(e)?[P(`${e}`)]:[P(e)]}function $a(e){return ye(e)?Jb(e.enum):q(e)?Zb(e.const):Q(e)?Hb(e.pattern):x(e)?Yb(e.anyOf):[e]}function dd(e){return $a(e)}function Xb(e){return Q(e)?$e(e.pattern):e}function Qb(e,t,n,r,a,i){let m=p.Assign(e,{[n.name]:r}),u=d(m,t,a),l=Xb(u),f=d(m,t,i);return vs(l)||$s(l)?{[l.const]:f}:{}}function ev(e,t,n,r,a,i){return r.reduce((m,u)=>[...m,Qb(e,t,n,u,a,i)],[])}function tv(e){return e.reduce((t,n)=>[...t,v(n)],[])}function fd(e,t,n,r,a,i){let m=dd(r),u=ev(e,t,n,m,a,i),l=tv(u);return z(l)}function zo(e,t,n,r,a,i,m){return k([r])?p.Update(fd(e,t,n,r,a,i),{},m):Fn(n,r,a,i,m)}function hd(e,t,n,r,a,i,m){let u=d(e,t,r);return zo(e,t,n,u,a,i,m)}function nv(e,t,n){let r=p.Assign(e,t);return s.Keys(t).filter(i=>n.includes(i)).reduce((i,m)=>({...i,[m]:Jc(r,m,t[m])}),{})}function rv(e,t,n){let r=p.Assign(e,t);return s.Keys(t).filter(i=>!n.includes(i)).reduce((i,m)=>({...i,[m]:d(r,U([],[]),t[m])}),{})}function av(e,t,n){let r=Vc(t),a=nv(e,t,r),i=rv(e,t,r),m={...a,...i};return p.Update(m,{},n)}function Ta(e,t,n,r){return av(e,n,r)}function ea(e,t={}){return I("NonNullable",[e],t)}function gd(e,t={}){return Bo(e,t)}function ov(e){let t=w([Ht(),en()]);return Xn(e,t,{})}function Bo(e,t){return k([e])?p.Update(ov(e),{},t):ea(e,t)}function yd(e,t,n,r){let a=d(e,t,n);return Bo(a,r)}function ta(e,t,n={}){return I("Omit",[e,t],n)}function xd(e,t,n={}){let r=s.IsArray(t)?un(t):t;return Vo(e,r,n)}function ka(e){let t=cn(e);return L(t)?t.properties:J()}function iv(e,t){return s.Keys(e).reduce((r,a)=>t.includes(a)?r:{...r,[a]:e[a]},{})}function Id(e,t){let n=ka(e),r=dn(t),a=iv(n,r);return v(a)}function Vo(e,t,n){return k([e,t])?p.Update(Id(e,t),{},n):ta(e,t,n)}function bd(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return Vo(i,m,a)}function na(e,t={}){return I("Parameters",[e],t)}function vd(e,t={}){return Wo(e,t)}function sv(e){let t=ie(e)?e.parameters:[],n=wt({},U([],[]),t);return ee(n)}function Wo(e,t){return k([e])?p.Update(sv(e),{},t):na(e,t)}function $d(e,t,n,r){let a=d(e,t,n);return Wo(a,r)}function ra(e,t={}){return I("Partial",[e],t)}function Td(e,t={}){return Ho(e,t)}function kd(e,t){let n=Je(e,t),r=Ze(n);return Be(p.Assign(e,{[t]:r}),t)}function wd(e,t,n){let r=Ne(e,t,n);return Ze(r)}function Ed(e){let t=z(e);return Ze(t)}function Rd(e){let t=e.map(n=>Ze(n));return w(t)}function Sd(e){let t=s.Keys(e).reduce((r,a)=>({...r,[a]:At(e[a])}),{});return v(t)}function Ze(e){return ce(e)?kd(e.$defs,e.$ref):V(e)?wd(e.if,e.then,e.else):O(e)?Ed(e.allOf):x(e)?Rd(e.anyOf):L(e)?Sd(e.properties):v({})}function Ho(e,t){return k([e])?p.Update(Ze(e),{},t):ra(e,t)}function Od(e,t,n,r){let a=d(e,t,n);return Ho(a,r)}function aa(e,t,n={}){return I("Pick",[e,t],n)}function Pd(e,t,n={}){let r=s.IsArray(t)?un(t):t;return Yo(e,r,n)}function mv(e,t){return s.Keys(e).reduce((r,a)=>t.includes(a)?p.Assign(r,{[a]:e[a]}):r,{})}function Ad(e,t){let n=ka(e),r=dn(t),a=mv(n,r);return v(a)}function Yo(e,t,n){return k([e,t])?p.Update(Ad(e,t),{},n):aa(e,t,n)}function Cd(e,t,n,r,a){let i=d(e,t,n),m=d(e,t,r);return Yo(i,m,a)}function oa(e,t={}){return I("ReadonlyObject",[e],t)}function Jo(e,t={}){return Zo(e,t)}var Md=Jo;function Ld(e){return Wt(Re(e))}function qd(e,t){let n=Je(e,t),r=Xe(n);return Be(p.Assign(e,{[t]:r}),t)}function jd(e,t,n){let r=Ne(e,t,n);return Xe(r)}function Fd(e){let t=z(e);return Xe(t)}function Dd(e){let t=s.Keys(e).reduce((r,a)=>({...r,[a]:Lt(e[a])}),{});return v(t)}function Gd(e){return Wt(ee(e))}function Nd(e){let t=e.map(n=>Xe(n));return w(t)}function Xe(e){return K(e)?Ld(e.items):ce(e)?qd(e.$defs,e.$ref):V(e)?jd(e.if,e.then,e.else):O(e)?Fd(e.allOf):L(e)?Dd(e.properties):G(e)?Gd(e.items):x(e)?Nd(e.anyOf):e}function Zo(e,t){return k([e])?p.Update(Xe(e),{},t):oa(e)}function Ud(e,t,n,r){let a=d(e,t,n);return Zo(a,r)}function _d(e,t,n,r){return t.visited.includes(r)?n:r in e?d(e,U(t.callstack,[...t.visited,r]),e[r]):n}function Kd(e,t){let n=Je(e,t),r=Qe(n);return Be(p.Assign(e,{[t]:r}),t)}function zd(e,t,n){let r=Ne(e,t,n);return Qe(r)}function Bd(e){let t=z(e);return Qe(t)}function Vd(e){let t=e.map(n=>Qe(n));return w(t)}function Wd(e){let t=s.Keys(e).reduce((r,a)=>({...r,[a]:jr(e[a])}),{});return v(t)}function Qe(e){return ce(e)?Kd(e.$defs,e.$ref):V(e)?zd(e.if,e.then,e.else):O(e)?Bd(e.allOf):x(e)?Vd(e.anyOf):L(e)?Wd(e.properties):v({})}function ia(e,t={}){return I("Required",[e],t)}function Hd(e,t={}){return Xo(e,t)}function Xo(e,t){return k([e])?p.Update(Qe(e),{},t):ia(e,t)}function Yd(e,t,n,r){let a=d(e,t,n);return Xo(a,r)}function sa(e,t={}){return I("ReturnType",[e],t)}function Jd(e,t={}){return Qo(e,t)}function pv(e){return ie(e)?e.returnType:F()}function Qo(e,t){return k([e])?p.Update(pv(e),{},t):sa(e,t)}function Zd(e,t,n,r={}){let a=d(e,t,n);return Qo(a,r)}function ma(e,t){return I("With",[e,t],{})}function Xd(e,t){return ei(e,t)}function ei(e,t){return k([e])?p.Update(e,{},t):ma(e,t)}function Qd(e,t,n,r){let a=d(e,t,n);return ei(a,r)}function uv(e){return vt(e)?G(e.items)?ti(e.items.items):Y(e.items)?[e]:se(e.items)?[e]:[F()]:[e]}function ti(e){return e.reduce((n,r)=>[...n,...uv(r)],[])}function U(e,t){return{callstack:e,visited:t}}function k(e){return s.ShiftLeft(e,(t,n)=>se(t)?!1:k(n),()=>!0)}function Wn(e,t,n){return s.Keys(n).reduce((r,a)=>({...r,[a]:d(e,t,n[a])}),{})}function wt(e,t,n){let r=Oe(e,t,n);return ti(r)}function Oe(e,t,n){return n.map(r=>d(e,t,r))}function cv(e,t){let n=he(e)?wn(t,{}):t,r=qt(e)?kn(n,{}):n;return Mt(e)?tr(r,{}):r}function lv(e,t,n,r,a){return s.IsEqual(n,"AddImmutable")?ef(e,t,r[0],a):s.IsEqual(n,"RemoveImmutable")?ul(e,t,r[0],a):s.IsEqual(n,"AddReadonly")?Ji(e,t,r[0],a):s.IsEqual(n,"RemoveReadonly")?js(e,t,r[0],a):s.IsEqual(n,"AddOptional")?Zi(e,t,r[0],a):s.IsEqual(n,"RemoveOptional")?Gs(e,t,r[0],a):s.IsEqual(n,"Capitalize")?Il(e,t,r[0],a):s.IsEqual(n,"Conditional")?kl(e,t,r[0],r[1],r[2],r[3],a):s.IsEqual(n,"ConstructorParameters")?El(e,t,r[0],a):s.IsEqual(n,"Evaluate")?Qc(e,t,r[0],a):s.IsEqual(n,"Exclude")?Sl(e,t,r[0],r[1],a):s.IsEqual(n,"Extract")?Al(e,t,r[0],r[1],a):s.IsEqual(n,"Index")?td(e,t,r[0],r[1],a):s.IsEqual(n,"InstanceType")?rd(e,t,r[0],a):s.IsEqual(n,"Interface")?_c(e,t,r[0],r[1],a):s.IsEqual(n,"KeyOf")?cd(e,t,r[0],a):s.IsEqual(n,"Lowercase")?bl(e,t,r[0],a):s.IsEqual(n,"Mapped")?hd(e,t,r[0],r[1],r[2],r[3],a):s.IsEqual(n,"Module")?Ta(e,t,r[0],a):s.IsEqual(n,"NonNullable")?yd(e,t,r[0],a):s.IsEqual(n,"Pick")?Cd(e,t,r[0],r[1],a):s.IsEqual(n,"Parameters")?$d(e,t,r[0],a):s.IsEqual(n,"Partial")?Od(e,t,r[0],a):s.IsEqual(n,"Omit")?bd(e,t,r[0],r[1],a):s.IsEqual(n,"ReadonlyObject")?Ud(e,t,r[0],a):s.IsEqual(n,"Record")?nm(e,t,r[0],r[1],a):s.IsEqual(n,"Required")?Yd(e,t,r[0],a):s.IsEqual(n,"ReturnType")?Zd(e,t,r[0],a):s.IsEqual(n,"TemplateLiteral")?ic(e,t,r[0],a):s.IsEqual(n,"Uncapitalize")?vl(e,t,r[0],a):s.IsEqual(n,"Uppercase")?$l(e,t,r[0],a):s.IsEqual(n,"With")?Qd(e,t,r[0],r[1]):I(n,r,a)}function dv(e,t,n){let r=se(n)?_d(e,t,n,n.$ref):K(n)?Re(d(e,t,n.items),Tr(n)):pn(n)?va(e,t,n.target,n.arguments):oe(n)?_e(Oe(e,t,n.parameters),d(e,t,n.instanceType),Xi(n)):ie(n)?Ke(Oe(e,t,n.parameters),d(e,t,n.returnType),Qi(n)):V(n)?Ct(d(e,t,n.if),d(e,t,n.then),d(e,t,n.else),os(n)):O(n)?ge(Oe(e,t,n.allOf),us(n)):L(n)?v(Wn(e,t,n.properties),rs(n)):de(n)?rm(Le(n),d(e,t,be(n))):vt(n)?Dt(d(e,t,n.items)):G(n)?ee(wt(e,t,n.items),qs(n)):x(n)?w(Oe(e,t,n.anyOf),ks(n)):n;return cv(n,r)}function d(e,t,n){return ht(n)?lv(e,t,n.action,n.parameters,n.options):dv(e,t,n)}function ni(e,t){return d(e,U([],[]),t)}function fv(e){return p.Update(e,{"~immutable":!0},{})}function tr(e,t){return p.Update(fv(e),{},t)}function ef(e,t,n,r){let a=d(e,t,n);return tr(a,r)}function au(e,t={}){return I("AddImmutable",[e],t)}function Wt(e,t={}){return tr(e,t)}function ou(e,t={}){return I("Evaluate",[e],t)}function tf(e,t={}){return Ao(e,t)}function iu(e,t={}){return I("Module",[e],t)}function nf(e,t={}){return Ta({},U([],[]),e,t)}function rf(...e){let[t,n,r]=Ve.Match(e,{2:(m,u)=>s.IsString(m)?[{},m,u]:[m,u,{}],3:(m,u,l)=>[m,u,l],1:m=>[{},m,{}]}),a=tc(n),i=s.IsArray(a)&&s.IsEqual(a.length,2)?d(t,U([],[]),a[0]):F();return p.Update(i,{},r)}var D={};Rt(D,{Any:()=>Vt,Array:()=>Re,BigInt:()=>On,Boolean:()=>Or,Call:()=>ml,Capitalize:()=>hl,Codec:()=>Sr,Conditional:()=>Tl,Constructor:()=>_e,ConstructorParameters:()=>wl,Cyclic:()=>Be,Decode:()=>fs,DecodeBuilder:()=>Sn,Dependent:()=>Ct,Encode:()=>hs,EncodeBuilder:()=>Rn,Enum:()=>ps,Evaluate:()=>tf,Exclude:()=>Rl,Extends:()=>le,ExtendsResult:()=>b,Extract:()=>Ol,Function:()=>Ke,Generic:()=>gt,Identifier:()=>Pn,Immutable:()=>gs,Index:()=>Cl,Infer:()=>En,InstanceType:()=>nd,Instantiate:()=>ni,Integer:()=>jt,Interface:()=>Kc,Intersect:()=>ge,IsAny:()=>Z,IsArray:()=>K,IsBigInt:()=>He,IsBoolean:()=>Ae,IsCall:()=>pn,IsCodec:()=>Rr,IsConstructor:()=>oe,IsCyclic:()=>ce,IsDependent:()=>V,IsEnum:()=>ye,IsEnumValue:()=>ms,IsFunction:()=>ie,IsGeneric:()=>Bt,IsIdentifier:()=>bs,IsImmutable:()=>Mt,IsInfer:()=>Y,IsInteger:()=>xe,IsIntersect:()=>O,IsKind:()=>y,IsLiteral:()=>q,IsNever:()=>yt,IsNull:()=>Yt,IsNumber:()=>X,IsObject:()=>L,IsOptional:()=>he,IsParameter:()=>Ts,IsReadonly:()=>qt,IsRecord:()=>de,IsRef:()=>se,IsRefine:()=>to,IsRest:()=>vt,IsSchema:()=>re,IsString:()=>Ie,IsSymbol:()=>xt,IsTemplateLiteral:()=>Q,IsThis:()=>_r,IsTuple:()=>G,IsUndefined:()=>tn,IsUnion:()=>x,IsUnknown:()=>ae,IsUnsafe:()=>Er,IsVoid:()=>Ye,KeyOf:()=>ad,Literal:()=>P,Lowercase:()=>gl,Mapped:()=>ld,Module:()=>nf,Never:()=>F,NonNullable:()=>gd,Null:()=>Ht,Number:()=>Te,Object:()=>v,Omit:()=>xd,Optional:()=>ts,Parameter:()=>Ft,Parameters:()=>vd,Partial:()=>Td,Pick:()=>Pd,Readonly:()=>ys,ReadonlyObject:()=>Jo,ReadonlyType:()=>Md,Record:()=>Gr,RecordKey:()=>Qt,RecordPattern:()=>Le,RecordValue:()=>be,Ref:()=>st,Refine:()=>xs,Required:()=>Hd,Rest:()=>Dt,ReturnType:()=>Jd,Script:()=>rf,String:()=>Ce,Symbol:()=>Jt,TemplateLiteral:()=>mc,This:()=>Ur,Tuple:()=>ee,Uncapitalize:()=>yl,Undefined:()=>en,Union:()=>w,Unknown:()=>me,Unsafe:()=>as,Uppercase:()=>xl,Void:()=>Kr,With:()=>Xd});var nr="submit_test_gap_candidates",rr="submit_filtered_test_gaps",ar="submit_solver_gaps",Z4=D.Object({verdict:D.Union([D.Literal("PASS"),D.Literal("FAIL")],{description:"FAIL only for a genuine blocking issue (clear rubric violation, agent-fault-worthy gap, unfair/undiscoverable test requirement, or a real determinism/regression risk). Optional, minor, or stylistic points are NOT grounds for FAIL \u2014 put those in `notes` instead and use PASS."}),summary:D.String({description:"One short sentence summarizing the verdict."}),reasons:D.Array(D.String(),{description:"Specific BLOCKING justifications only, citing rubric item IDs and concrete evidence from the files you read. Required (non-empty) when verdict is FAIL. Use an empty array when verdict is PASS."}),notes:D.Array(D.String(),{description:"Non-blocking, optional/minor observations or suggested improvements \u2014 the kind of feedback a real reviewer leaves as 'Minor/optional' without failing the task. Include these regardless of verdict; use an empty array if you truly have none."})});var hv=D.Object({statement:D.String({description:"One sentence from agent_prompt.md, copied verbatim."}),gaps:D.Array(D.Object({description:D.String({description:"A fair, publicly observable missing behavioral test."}),risk:D.String({description:"Why an incorrect implementation could pass the current tests despite this missing behavior."})}),{description:"All candidate positive and negative gaps for this sentence; there is no maximum or target count, so include every distinct evidence-backed gap and relevant edge case rather than stopping at 10; use an empty array only when exhaustive analysis finds none."})});function af(e){return{name:nr,label:"Submit Candidate Test Gaps",description:"Submit one candidate-gap list for one prompt sentence. Call this after each sentence so the orchestrator can track the todo list; empty lists are required when that sentence has no gaps.",parameters:hv,async execute(t,n){let r=e.statements??[];return r.push({statement:n.statement,gaps:n.gaps??[]}),e.statements=r,{content:[{type:"text",text:`Recorded ${n.gaps?.length??0} candidate gap(s)`}],details:void 0}}}}var gv=D.Object({gaps:D.Array(D.Object({description:D.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:D.String({description:"Why this is genuinely grounded in agent_prompt.md or the repo, fair to test per the fairness methodology, and a real (non-duplicate) coverage hole in test.patch \u2014 for negative gaps, cite the prompt's prohibition/constraint and why no existing test catches the forbidden outcome."})}),{description:"The filtered, final list of confirmed test gaps. Use an empty array if none of the candidates survive strict scrutiny."})});function of(e){return{name:rr,label:"Submit Filtered Test Gaps",description:"Submit your final, strictly filtered list of confirmed test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have independently verified each candidate.",parameters:gv,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Confirmed ${r.length} gap(s) after filtering`}],details:void 0}}}}var yv=D.Object({gaps:D.Array(D.Object({description:D.String({description:"The specific behavioral gap: a way one or more solver's diff differs materially from what agent_prompt.md/solution.patch require, despite that solver passing `./test.sh new`."}),justification:D.String({description:"Why this is a genuine requirement from agent_prompt.md or solution.patch (cite the specific requirement/line) that the solver's diff misses, contradicts, or diverges from \u2014 and why the current tests fail to catch that divergence."}),evidence:D.String({description:"Which solver(s) (by index) exhibit this, and the specific part of their diff that grounds the gap."})}),{description:"Concrete, diff-grounded behavioral gaps \u2014 cases where a passing solver's materially different approach reveals that `test.sh new` under-specifies a real requirement. Use an empty array if the solvers converged on equivalent behavior; do not manufacture gaps just to report something."})});function sf(e){return{name:ar,label:"Submit Solver Gaps",description:"Submit your final list of behavioral gaps found by comparing the solver diffs against the real solution.patch. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished comparing every solver.",parameters:yv,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Recorded ${r.length} solver gap(s)`}],details:void 0}}}}function xv(e){return[e,"You are working inside the actual repository (this is your current directory) in read-only mode. You have access to read/grep/find/ls tools only \u2014 you cannot execute code or edit files.","Read `agent_prompt.md` for the task requirements and inspect the repository's existing source/code files with read/grep/find/ls. Base the analysis on the prompt and the observable behavior supported by those code files."]}var Iv=["Thoroughness \u2014 your job is high recall on genuine gaps only:","- There is no target count or cap: do not stop at 10 (or any other arbitrary number). For each prompt sentence, enumerate as many distinct uncovered required behaviors and edge cases as the files justify, then continue until an additional sweep finds no new genuine gap.","- Find every gap you can justify with concrete evidence. Do not stop after the first obvious ones \u2014 keep reading until you have systematically covered the prompt and relevant repository code.","- After your first pass, run at least one deliberate second sweep (re-read `agent_prompt.md` and grep/read the relevant code files) before submitting \u2014 but if that sweep still finds nothing, submit an empty list.","- Do not self-censor or merge distinct genuine gaps into one \u2014 the validator will prune. Never invent or pad the list to seem thorough; an empty array is correct when exhaustive analysis truly finds none.","- Hunt subtle gaps too: behaviors that may be missed under other valid inputs, repository conventions, interaction effects, ordering/timing, and branches in the relevant source code that need behavioral coverage.","- Include a candidate only when you can cite specific grounding and a concrete false-pass risk \u2014 not to meet a quota."],mf=["Ground rules \u2014 do not overreach:","- Every gap must trace back to a specific requirement or sentence in `agent_prompt.md`, or to behavior that is unambiguous from the existing, visible repo. Do not invent requirements the prompt doesn't support.","- Do not propose gaps for things `agent_prompt.md` leaves intentionally open, or for implementation details/style the prompt doesn't mandate.","- Read the relevant source files carefully and distinguish genuinely required behavior from speculation; focus on public outcomes and edge cases that deserve behavioral coverage.","- Keep findings strictly behavioral and publicly observable: a user, caller, or documented public contract must be able to observe the required outcome. Do not report internal helper calls, private state, implementation structure, call order, file placement, or other incidental mechanics.","- Do not require DOM classes, DOM/data/test attributes, selectors, or exact string literals unless the prompt explicitly names them or they are an established, already-present public contract in the repository. Prefer a visible outcome or public API behavior that accepts equivalent implementations."];function pf(e,t){let n=[...xv("You are an exhaustive behavioral test-gap finder. Review the task prompt sentence by sentence, finding both missing required-behavior (positive) and missing forbidden/wrong-behavior (negative) tests."),"","First split `agent_prompt.md` into its meaningful sentences using periods (`.`) as the sentence boundary. Create an explicit TODO checklist of every resulting requirement sentence. Work through it one item at a time; do not finish until every item is checked off.","","Before analyzing each sentence, use read/grep/find/ls to inspect the relevant source files and their closest analogues. Use that code context to understand the public contracts, conventions, branches, guards, early returns, state transitions, side effects, boundary handling, and negative/prohibited outcomes required by the sentence. Report every distinct, prompt-required behavioral edge case or prohibition that a plausible implementation could miss. Include positive and negative gaps together for that sentence. There is no maximum number of gaps: keep enumerating distinct missing behaviors for this sentence, including boundary, empty, repeated, interacting, and other relevant edge cases; do not treat 10 as sufficient.","",...Iv,"",...mf,"","Test-coverage checklist for calibration:",e];return n.push("","Fairness: keep only behavior that a user, caller, or existing public contract can observe. Do not require private helpers, internal state, implementation structure, call order, selectors, or incidental strings unless the task explicitly makes them public requirements."),n.push("","For every candidate, state the missing fair behavioral test, the relevant source behavior or branch that led you to investigate it, and why a plausible incorrect implementation could evade that test. The prompt sentence is the required specification: do not report incidental implementation details it does not require. Do not propose the exact test implementation.",`After completing EACH TODO sentence, call \`${nr}\` with that exact sentence and its gap array (including an empty array when none exist). You may and must call the tool multiple times: once per sentence. Only finish after every TODO item has been submitted.`),n.join(`
12
+ `)}function uf(e,t,n){let r=["You are a strict, skeptical fairness auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code or edit files.","Two specialized research agents reviewed `agent_prompt.md` and the repository's source/code files sentence by sentence, proposing both positive (missing required-behavior) and negative (missing forbidden/wrong-behavior) gaps. It submitted the following per-sentence candidate report:","",JSON.stringify(e,null,2),"","Your job is to independently re-verify the files yourself and FILTER this list down to only candidates that are ALL of the following:","1. Genuinely grounded \u2014 actually required by a specific statement in `agent_prompt.md`, or unambiguous from clearly visible, existing repo behavior. Drop anything speculative, nice-to-have, or invented beyond what the prompt actually asks for.","2. Fair to test \u2014 verifying it would not require undiscoverable private internals, an invented/unnamed API, or exact incidental implementation structure. Judge this precisely against the fairness guidance below.","3. A real, distinct behavioral gap \u2014 drop near-duplicate candidates and keep only the clearest phrasing of each distinct gap. Retain a candidate only when the source code and prompt provide concrete grounding for a behavior that deserves an explicit public-outcome check.","4. Behaviorally testable through a public contract \u2014 drop candidates that would require an internal helper, private state, implementation structure, call order, DOM class/attribute/data hook, selector, or exact string literal. The sole exceptions are details explicitly named in `agent_prompt.md` or already established as a public contract in the existing repository.","","Be strict: when genuinely unsure whether a candidate holds up, drop it rather than keep it. It is fine \u2014 expected, even \u2014 to return an empty list if none of the candidates survive scrutiny.","","Checklist for the tests focus area, for calibration:",t];return r.push("","Fairness: keep only behavior that a user, caller, or existing public contract can observe. Do not require private helpers, internal state, implementation structure, call order, selectors, or incidental strings unless the task explicitly makes them public requirements."),r.push("","For every gap you keep, give a short justification citing where in `agent_prompt.md` or the repo it is grounded. Preserve POSITIVE:/NEGATIVE: prefix when applicable.",`When you are done, call the \`${rr}\` tool exactly once with your final filtered list (which may be empty). That tool call is your only way to report a result.`),r.join(`
13
+ `)}function cf(){return["You are a adversarial tester. Your goal is to find the most minimal, shortcut implementation that makes all new tests pass \u2014 not a full, correct solution. This is intentional: we want to discover whether the test suite lets through an implementation that barely satisfies the assertions without properly implementing the prompt's required behavior.","`agent_prompt.md` in the repo root describes the intended task. Tests for it already exist and are currently failing.","","Goal: make ALL of the new tests pass with the least amount of real logic possible.","1. Run `bash test.sh new` to see the failures and what the tests expect. Read the failing tests carefully \u2014 they are the only spec you need to satisfy.","2. Understand exactly what each test assertion checks. Ask, 'what is the minimum thing I can do \u2014 a stub, a hardcoded return, a mockish pass-through, a trivial branch \u2014 to satisfy this test?', not 'what does agent_prompt.md intend?'. Skim `agent_prompt.md` only enough to understand what the test file names and assertions refer to, then rely on the test errors to drive what to implement.","3. Prefer the most minimal implementation possible:"," - Hardcode a return value if the test expects one."," - Add only the code paths a test actually exercises; leave anything untested unimplemented."," - Mock the minimum number of dependencies (or none) that the test error forces you to touch."," - Use the most direct, trivial, shortcut approach \u2014 do not build abstractions, do not handle unobserved edge cases, do not add defensive code.","4. Before declaring success, also run `bash test.sh base` to confirm your changes cause no regressions. The shortcut must not break existing tests \u2014 that would be a false positive from a different angle.","5. Re-run `bash test.sh new` and iterate until both the new tests and the base tests pass, or you're confident you cannot pass more without adding real logic.","","Rules:","- Do NOT modify the test files or `test.sh`. Only change application/library code.","- You have shell access \u2014 install any dependencies you need.","- The prompt is not your spec: the tests are. Implement exactly what the tests demand, nothing more. If you can satisfy a test with a hardcoded return, do it."].join(`
14
+ `)}function bv(e){let t=e.status==="ok"?e.passed?"PASSED all new tests":"did NOT pass all new tests":`did not complete normally (status: ${e.status})`;return`- Solver ${e.index} \u2014 ${t} \u2014 solution.diff / test_output.txt in \`${In}/solver_${e.index}/\``}function lf(e,t,n){let r=["You are a strict, skeptical behavioral-gap auditor for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root contains `agent_prompt.md` (the real task description), `solution.patch` (a unified diff of the real golden/reference solution), and `test.patch` (a unified diff adding the hidden tests).","",`Separately, several coding agents ('solvers') were each given the same \`agent_prompt.md\` plus the failing tests from \`test.patch\` \u2014 but never \`solution.patch\` \u2014 and asked to implement the task TDD-style, iterating with real shell access until the tests passed or they gave up. Each solver's diff and full \`test.sh new\` output \u2014 captured and verified independently by the harness, not self-reported \u2014 is saved under \`${In}/solver_<index>/\` (\`solution.diff\`, \`test_output.txt\`), with a \`${In}/manifest.json\` summary. Use read/grep/find/ls to open exactly what you need. Status summary:`,"",...e.map(bv),"","Your job: compare the reference `solution.patch` with each solver's `solution.diff` to find concrete BEHAVIORAL GAPS. Keep only a difference where: (a) `agent_prompt.md` explicitly requires the behavior, (b) the solver passed the relevant tests (even if it failed elsewhere), (c) the reference and solver produce observably different behavior for a real edge case or scenario, and (d) a fair public-facing test could distinguish them. The reference solution is evidence for scenarios to inspect, never a specification by itself.","","How to work:","1. Read `agent_prompt.md` sentence by sentence and note every distinct requirement, constraint, and prohibition.","2. Read `solution.patch` to see how the reference solution satisfies those requirements.","3. For each solver, read its `solution.diff` and compare it against the reference behavior. Look specifically for a solver shortcut, missed constraint, edge case, or side effect that the PROMPT requires, where the solver still passes because the tests do not observe the behavioral difference.","4. A solver that did not pass the full suite may still provide evidence for a completed, relevant part of its diff, but only when its test output shows the failure is unrelated to that behavior (or shows the relevant tests already passed). Do not treat its failing behavior as a gap, and do not infer gaps from a hypothetical wrong implementation.","5. Treat multiple solvers converging on the same divergent-but-passing shortcut as stronger evidence of a real gap, not proof it's acceptable \u2014 the tests are what's under scrutiny, not majority solver behavior.","",...mf,"- Every gap must be evidenced by an actual, cited solver diff and a contrasting reference behavior. For a solver that failed the full suite, also cite its test output showing that the relevant behavior already passed or is unrelated to the failure. Cite the prompt sentence that makes the behavioral difference required; do not report a gap that is purely theoretical or based only on the reference implementation.","- It is fine, and expected, to submit an empty list if the solvers that passed all converged on behavior equivalent to the reference solution with no material gaps.","- Do not self-censor for volume, but do not pad the list either \u2014 only include what you can concretely justify with cited evidence.","","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",t];return n&&r.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",n),r.push("",`When you are done, call the \`${ar}\` tool exactly once with your final list (which may be empty). That tool call is your only way to report a result.`),r.join(`
15
+ `)}var vv=900*1e3,ri=["read","grep","find","ls"];function Ra(e){return e==="off"?void 0:e}async function Sa(e,t,n=vv){let r=t.aborted?"cancelled":"done";return await Promise.race([e().then(()=>{t.aborted||(r="done")}),new Promise(a=>{setTimeout(()=>{r="timedOut",a()},n)}),new Promise(a=>{if(t.aborted)return a();t.addEventListener("abort",()=>{r="cancelled",a()},{once:!0})})]),r}async function Oa(e){let t={},n=e.model,{session:r}=await wa({cwd:e.tempDir,model:n,thinkingLevel:Ra(e.thinkingLevel),tools:[...ri,nr],customTools:[af(t)],sessionManager:Ea.inMemory()});try{let a=await Sa(async()=>{await r.prompt(pf(e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.statements?{status:"ok",gaps:t.statements}:{status:"noSubmission",gaps:[]}}var $v=["read","grep","find","ls","write","edit","bash"];async function df(e){let t=e.model;try{let n=Ea.inMemory(),{session:r}=await wa({cwd:e.solverDir,model:t,thinkingLevel:Ra(e.thinkingLevel),tools:[...$v],sessionManager:n}),a=await Sa(async()=>{await r.prompt(cf())},e.cancelSignal,e.timeoutMinutes*60*1e3);return a!=="done"&&await r.abort(),{outcome:a,trajectory:n.getEntries()}}catch{return{outcome:"error",trajectory:[]}}}async function ff(e){let t={},n=e.model,{session:r}=await wa({cwd:e.tempDir,model:n,thinkingLevel:Ra(e.thinkingLevel),tools:[...ri,ar],customTools:[sf(t)],sessionManager:Ea.inMemory()});try{let a=await Sa(async()=>{await r.prompt(lf(e.solverResults,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}async function Pa(e){let t={},n=e.model,{session:r}=await wa({cwd:e.tempDir,model:n,thinkingLevel:Ra(e.thinkingLevel),tools:[...ri,rr],customTools:[of(t)],sessionManager:Ea.inMemory()});try{let a=await Sa(async()=>{await r.prompt(uf(e.statementReports,e.testRubric,e.fairnessRules))},e.cancelSignal);if(a!=="done")return await r.abort(),{status:a,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}var Et="checks_progress";function or(e,t,n,r){let a=n>0?Math.min(1,t/n):0,i=Math.round(24*a),m="\u2588".repeat(i)+"\u2591".repeat(Math.max(0,24-i)),u=r?` pass:${r.passed} fail:${r.failed}`:"";return[`checks: ${e} [${m}] ${t}/${n}${u}`]}import{existsSync as Tv,readFileSync as kv}from"node:fs";var ai=["agent_prompt.md","solution.patch","test.patch"];function oi(e=new Date){let t=(i,m=2)=>String(i).padStart(m,"0"),n=-e.getTimezoneOffset(),r=n>=0?"+":"-",a=Math.abs(n);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}${r}${t(Math.floor(a/60))}:${t(a%60)}`}function hf(e){try{if(!Tv(e))return{};let t=JSON.parse(kv(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function gf(e){let t={...e.existingReport,timestamp:oi(),model:`${e.config.provider}/${e.config.modelId}`,thinkingLevel:e.config.thinkingLevel};return delete t.overall,delete t.reports,e.runGapFinder&&(t.testGaps=e.testGaps,e.gapAnalysisIncomplete?t.testGapAnalysisNote=`Gap analysis did not fully complete (sentence finder: ${e.gapFinderStatus}, review: ${e.gapFilterStatus}); testGaps may be incomplete.`:delete t.testGapAnalysisNote),e.runSolverGapFinder&&(t.solverRunSummary=e.solverResults.map(n=>({index:n.index,status:n.status,passed:n.passed,durationMs:n.durationMs,totalTests:n.totalTests,failedTests:n.failedTests,artifactsDir:n.artifactsDir})),t.solverGaps=e.solverGaps,e.solverGapAnalysisIncomplete?t.solverGapAnalysisNote=`Solver-gap analysis did not fully complete (comparison reviewer: ${e.solverComparisonStatus}); solverGaps may be incomplete.`:delete t.solverGapAnalysisNote),t}function yf(e){let t=Math.round(e/1e3);return t>=60?`${Math.floor(t/60)}m ${t%60}s`:`${t}s`}function xf(e){let t=Array.isArray(e.merged.testGaps)?e.merged.testGaps.length:0,n=e.runSolverGapFinder&&Array.isArray(e.merged.solverRunSummary)?e.merged.solverRunSummary.map(i=>({...i,durationMs:i.durationMs??0})):[],r=Array.isArray(e.merged.solverGaps)?e.merged.solverGaps.length:0,a=[];return e.runGapFinder&&a.push(t>0?`${t} test gap(s) found`:"no test gaps found"),e.runSolverGapFinder&&a.push(`${n.filter(i=>i.passed).length}/${n.length} solvers passed, ${r} gap(s) found`),{content:`Gap finders: ${a.join(" | ")}`,details:{gapsCount:t,showGaps:e.runGapFinder,showSolverGaps:e.runSolverGapFinder,solverDetails:n,solverGapsCount:r}}}var If=`## The problem description (aka the task)\r
16
16
  P1: Aligns with the repo's philosophy\r
17
17
  P2: Self-contained \u2014 solvable from the repo and description alone\r
18
18
  P3: Clear, concise, and unambiguous \u2014 describes what to build or fix and don't leave points for guessing\r
@@ -39,7 +39,7 @@ That's the golden solution \u2014 the proof that your task is solvable and that
39
39
  S1: The solution should meet all the requirements. (If it's missing a requirement and it manages to pass your tests, you're in a bad position \u{1F620}.)\r
40
40
  S2: No regressions and follow existing code patterns. Don't break existing working code by mistake (we'll still run the repo's existing tests).\r
41
41
  S3: No irrelevant changes to the code \u2014 if something is unrelated to your task, keep it as it is.\r
42
- S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,ov=`# Agent Evaluation Guidelines\r
42
+ S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,wv=`# Agent Evaluation Guidelines\r
43
43
  \r
44
44
  This file describes how to align a task prompt, reference solution, and tests for fair coding-agent evaluation. It is generic and can be reused across repositories and tasks.\r
45
45
  \r
@@ -319,5 +319,9 @@ Keep changes separated when possible:\r
319
319
  - Avoid unrelated dependency or lockfile changes.\r
320
320
  - Regenerate patches after every prompt/test/solution change.\r
321
321
  \r
322
- ---`;function af(){return(rf.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??rf).trim()}function of(){return ov.trim()}var ka=!1,fn;function wa(){return ka}function sf(){return ka=!0,fn=new AbortController,fn}function mf(){ka=!1,fn=void 0}function pf(){return!ka||!fn||fn.signal.aborted?!1:(fn.abort(),!0)}var lv="Ctrl+Shift+X",Yo=[{value:"--gap-finder",label:"--gap-finder",description:"Find and validate behavioral test-coverage gaps"},{value:"--solver-gap-finder",label:"--solver-gap-finder",description:"Use TDD solver attempts to find behavioral gaps"},{value:"--config",label:"--config",description:"Configure gap-finder models"}];function dv(e){let t=e.trimStart(),n=/\s$/.test(t),r=t.trimEnd().split(/\s+/).filter(Boolean),a=n?"":r.at(-1)??"",s=new Set(n?r:r.slice(0,-1)),m=n?t:t.slice(0,t.length-a.length),c=s.has("--config"),l=[...s].some(f=>f!=="--config"),h=Yo.filter(f=>!s.has(f.value)&&!c&&!(l&&f.value==="--config")&&f.value.startsWith(a));return h.length?h.map(f=>({...f,value:`${m}${f.value}`})):null}async function hf(e,t,n){let r=ci();if(r.length===0)return e.ui.notify("No enabledModels configured in settings.json.","error"),null;let a=e.modelRegistry.getAll(),s=r.map(h=>{let f=li(h);if(!f)return null;let w=a.find(ue=>ue.provider===f.provider&&ue.id===f.modelId),D=t?.provider===f.provider&&t?.modelId===f.modelId,_=w?`${w.name} (${h})`:h;return{ref:h,parsed:f,display:D?`${_} [current]`:_,isCurrent:D}}).filter(h=>h!==null);if(s.length===0)return e.ui.notify("Could not resolve any enabledModels entries.","error"),null;let m=[...s].sort((h,f)=>h.isCurrent===f.isCurrent?0:h.isCurrent?-1:1),c=await e.ui.select(n,m.map(h=>h.display));if(!c)return null;let l=s.find(h=>h.display===c);return l?{provider:l.parsed.provider,modelId:l.parsed.modelId}:null}function Ra(e,t,n){let r=e.modelRegistry.getAll().find(a=>a.provider===t&&a.id===n);return pi(r)}var Ea={provider:"",modelId:"",thinkingLevel:"off",timeoutMinutes:Aa,solverCount:qa,saveArtifacts:ja};function gf(e,t,n){let r=t?Ra(e,t.provider,t.modelId):["off"],a=n.provider?Ra(e,n.provider,n.modelId):["off"];return[{id:"reviewer-model",section:"Reviewer",label:"Model",value:t?`${t.provider}/${t.modelId}`:"not set",kind:"model"},{id:"reviewer-thinking",section:"Reviewer",label:"Thinking level",value:t?.thinkingLevel??"off",kind:"cycle",values:r},{id:"solvergap-model",section:"Solver",label:"Model",value:n.provider?`${n.provider}/${n.modelId}`:"not set",kind:"model"},{id:"solvergap-thinking",section:"Solver",label:"Thinking level",value:n.thinkingLevel,kind:"cycle",values:a},{id:"solvergap-timeout",section:"Solver",label:"Timeout",value:`${n.timeoutMinutes} min`,kind:"cycle",values:[10,20,30,40,50,si].filter((s,m,c)=>s>=ii&&c.indexOf(s)===m).map(s=>`${s} min`)},{id:"solvergap-solver-count",section:"Solver",label:"Parallel agents",value:String(n.solverCount),kind:"cycle",values:Array.from({length:mi-La+1},(s,m)=>`${La+m}`)},{id:"solvergap-save-artifacts",section:"Solver",label:"Save artifacts",value:n.saveArtifacts?"on":"off",kind:"cycle",values:["on","off"]}]}var Jo=class{constructor(t,n,r,a,s,m){this.ctx=t;this.settingsListTheme=n;this.theme=r;this.onCycleSaved=a;this.onActivateModel=s;this.onExit=m;this.rows=gf(t,lt(),lt()?.solverGap??Ea)}selectedIndex=0;rows;refresh(){let t=lt();this.rows=gf(this.ctx,t,t?.solverGap??Ea),this.selectedIndex=Math.min(this.selectedIndex,this.rows.length-1)}invalidate(){}render(t){let n=[],r=Math.min(30,Math.max(...this.rows.map(s=>s.label.length))),a;for(let s=0;s<this.rows.length;s++){let m=this.rows[s];if(!m)continue;m.section!==a&&(a!==void 0&&n.push(""),n.push(this.theme.bold(this.theme.fg("accent",m.section))),a=m.section);let c=s===this.selectedIndex,l=c?this.settingsListTheme.cursor:" ",h=m.label+" ".repeat(Math.max(0,r-m.label.length)),f=this.settingsListTheme.label(h,c),w=this.settingsListTheme.value(m.value,c);n.push(`${l}${f} ${w}`)}return n}handleInput(t){if(_t(t,Kt.ctrl("s"))||_t(t,Kt.escape)||_t(t,Kt.ctrl("c"))){this.onExit();return}if(_t(t,Kt.up)){this.selectedIndex=this.selectedIndex===0?this.rows.length-1:this.selectedIndex-1;return}if(_t(t,Kt.down)){this.selectedIndex=this.selectedIndex===this.rows.length-1?0:this.selectedIndex+1;return}if(_t(t,Kt.enter)||_t(t,Kt.return)||t===" "){let n=this.rows[this.selectedIndex];if(!n)return;if(n.kind==="model"){this.onActivateModel(n.id);return}if(!n.values||n.values.length===0)return;let r=lt();if(!r){this.ctx.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");return}let a=r.solverGap??Ea,s=n.values.indexOf(n.value),m=n.values[(s+1)%n.values.length];if(m===void 0)return;n.id==="reviewer-thinking"?dt({...r,thinkingLevel:m,solverGap:a}):n.id==="solvergap-thinking"?dt({...r,solverGap:{...a,thinkingLevel:m}}):n.id==="solvergap-timeout"?dt({...r,solverGap:{...a,timeoutMinutes:Number.parseInt(m,10)}}):n.id==="solvergap-solver-count"?dt({...r,solverGap:{...a,solverCount:Number.parseInt(m,10)}}):n.id==="solvergap-save-artifacts"&&dt({...r,solverGap:{...a,saveArtifacts:m==="on"}}),this.refresh(),this.onCycleSaved()}}};async function fv(e){if(e.mode!=="tui"){e.ui.notify("/checks --config requires interactive mode","error");return}let t=0;for(;;){let n=await e.ui.custom((s,m,c,l)=>{let h=new Jo(e,pv(),m,()=>s.requestRender(),w=>l(w),()=>l(void 0));h.selectedIndex=t;let f=new uv;return f.addChild(new ff(m.bold(m.fg("accent","Checks settings")))),f.addChild({render:w=>h.render(w),invalidate:()=>h.invalidate()}),f.addChild(new cv(1)),f.addChild(new ff(m.fg("dim","\u2191\u2193 navigate enter select ctrl+s save & exit esc cancel"))),{render(w){return f.render(w)},invalidate(){f.invalidate()},handleInput(w){h.handleInput(w),t=h.selectedIndex,s.requestRender()}}});if(!n)return;let r=lt(),a=r?.solverGap??Ea;if(n==="reviewer-model"){let s=await hf(e,r,"Select reviewer model");if(!s)continue;let m=Ra(e,s.provider,s.modelId),c=m.includes(r?.thinkingLevel??"off")?r?.thinkingLevel??"off":m[0]??"off";dt({...s,thinkingLevel:c,solverGap:a}),e.ui.notify(`Reviewer model saved: ${s.provider}/${s.modelId}`,"info");continue}if(n==="solvergap-model"){if(!r){e.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");continue}let s=await hf(e,a.provider?a:null,"Select solver model");if(!s)continue;let m=Ra(e,s.provider,s.modelId),c=m.includes(a.thinkingLevel)?a.thinkingLevel:m[0]??"off";dt({...r,solverGap:{...a,...s,thinkingLevel:c}}),e.ui.notify(`Solver model saved: ${s.provider}/${s.modelId}`,"info")}}}function yf(e){e.registerCommand("checks",{description:"Find behavioral gaps in test coverage. Requires an option \u2014 see /checks.",getArgumentCompletions:dv,handler:async(t,n)=>{let r=t.trim();if(!r){n.ui.notify(Yo.map(N=>`${N.value} \u2014 ${N.description}`).join(`
323
- `),"info");return}let a=[...new Set(r.split(/\s+/).filter(Boolean))],s=new Set(Yo.map(N=>N.value)),m=a.filter(N=>!s.has(N));if(m.length){n.ui.notify(`Unknown option(s): ${m.join(", ")}. Run /checks with no arguments to see options.`,"warning");return}if(a.includes("--config")){a.length>1?n.ui.notify("--config cannot be combined with other options.","warning"):await fv(n);return}let c=a.includes("--gap-finder"),l=a.includes("--solver-gap-finder");if(!c&&!l)return;if(wa()){n.ui.notify("A checks run is already in progress.","warning");return}let h=lt();if(!h){n.ui.notify("No gap-finder model configured. Run /checks --config first.","error");return}let f=n.modelRegistry.find(h.provider,h.modelId);if(!f||!n.modelRegistry.hasConfiguredAuth(f)){n.ui.notify("Configured behavioral gap-finder model is unavailable or unauthenticated. Run /checks --config.","error");return}let w=Wo.filter(N=>!cf(Ze(n.cwd,N)));if(w.length){n.ui.notify(`Missing required file(s): ${w.join(", ")}`,"error");return}let D=null,_;if(l){if(D=ui(),!D||!cf(Ze(n.cwd,"test.sh"))){n.ui.notify("Configure solver gap finder and provide test.sh before running it.","error");return}if(_=n.modelRegistry.find(D.provider,D.modelId),!_||!n.modelRegistry.hasConfiguredAuth(_)){n.ui.notify("Configured solver gap-finder model is unavailable or unauthenticated.","error");return}}let ue=sf(),Me=D?.solverCount??0,Re=(c?2:0)+(l?Me+1:0);n.ui.setWidget(Et,nr("preparing clean snapshot",0,Re)),n.ui.notify(`gap finders (${a.join(" ")}) started. Press ${lv} to cancel.`,"info");let De,Qe=[];try{let N=Ze(df(),`checks-${uf()}`);lf(N,{recursive:!0}),De=N;let et=await ur(e,n.cwd,N);if(et.status==="error"){n.ui.notify(`checks: ${et.error}`,"error");return}for(let Ae of Wo)iv(Ze(n.cwd,Ae),Ze(N,Ae));let Ne=af(),pt=of(),tt=0,ut={status:"ok",gaps:[]},zt={status:"ok",gaps:[]};if(c){let Ae={tempDir:N,model:f,thinkingLevel:h.thinkingLevel,testRubric:Ne,fairnessRules:pt,cancelSignal:ue.signal};if(n.ui.setWidget(Et,nr("finding sentence-by-sentence test gaps",tt,Re)),ut=await Yd(Ae),tt+=1,n.ui.setWidget(Et,nr("reviewing test gaps",tt,Re)),ut.gaps.reduce((Oa,Pa)=>Oa+Pa.gaps.length,0)>0&&(zt=await Zd({...Ae,statementReports:ut.gaps})),tt+=1,ue.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let ct=[],rr={status:"ok",gaps:[]};if(l&&D){let Ae=[],Sa=nt=>{Ae.push(nt),tt+=1,n.ui.setWidget(Et,nr("solver gap finder: solving",tt,Re,{passed:Ae.filter(Le=>Le.passed).length,failed:Ae.filter(Le=>!Le.passed).length}))},Oa=await Promise.all(Array.from({length:Me},async(nt,Le)=>{let hn=Ze(df(),`checks-solvergap-${uf()}`);return lf(hn,{recursive:!0}),Qe.push(hn),{index:Le+1,setup:await fi({pi:e,repoDir:n.cwd,solverDir:hn,testPatchPath:Ze(n.cwd,"test.patch"),agentPromptPath:Ze(n.cwd,"agent_prompt.md")})}})),Pa=Ho().replace(/[:.]/g,"-");if(ct=await Promise.all(Oa.map(async({index:nt,setup:Le})=>{if(Le.status!=="ok"){let ri={index:nt,status:Le.status,passed:!1,diff:"",testOutputTail:Le.error,durationMs:0,totalTests:null,failedTests:null};return Sa(ri),ri}let hn=Date.now(),{outcome:ti,trajectory:bf}=await Jd({pi:e,solverDir:Le.solverDir,model:_,thinkingLevel:D.thinkingLevel,timeoutMinutes:D.timeoutMinutes,cancelSignal:ue.signal}),{testOutputXmlPath:vf,...Ca}=await hi({pi:e,index:nt,workspace:Le,status:ti==="done"?"ok":ti,durationMs:Date.now()-hn}),$f=D.saveArtifacts?gi({repoDir:n.cwd,runId:Pa,index:nt,trajectory:bf,solutionPatch:Ca.diff,testOutputXmlPath:vf,testOutputTail:Ca.testOutputTail}):void 0,ni={...Ca,artifactsDir:$f};return Sa(ni),ni})),ct.some(nt=>nt.status!=="patchFailed"&&nt.status!=="error")&&(yi(N,ct),rr=await Xd({tempDir:N,model:f,thinkingLevel:h.thinkingLevel,solverResults:ct,testRubric:Ne,fairnessRules:pt,cancelSignal:ue.signal})),tt+=1,ue.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let If=c&&(ut.status!=="ok"||ut.gaps.length>0&&zt.status!=="ok"),Zo=ef({existingReport:Qd(Ze(n.cwd,"shipd_report.json")),config:h,runGapFinder:c,testGaps:zt.gaps,gapAnalysisIncomplete:If,gapFinderStatus:ut.status,gapFilterStatus:zt.status,runSolverGapFinder:l,solverResults:ct,solverGaps:rr.gaps,solverGapAnalysisIncomplete:l&&(ct.some(Ae=>Ae.status==="error")||rr.status!=="ok"),solverComparisonStatus:rr.status}),Qo=nf({merged:Zo,runGapFinder:c,runSolverGapFinder:l});e.sendMessage({customType:"shipd_checks_report",content:Qo.content,display:!0,details:Qo.details});let ei=Ze(n.cwd,"shipd_report.json");mv(ei,JSON.stringify(Zo,null,2),"utf-8"),n.ui.notify(`checks: wrote details to ${ei}`,"info")}catch(N){n.ui.notify(`checks failed: ${N instanceof Error?N.message:String(N)}`,"error")}finally{n.ui.setWidget(Et,void 0),De&&sv(De,{recursive:!0,force:!0});for(let N of Qe)xi(N);mf()}}})}var xf=gv.ctrlShift("x");function xv(e){e.registerMessageRenderer("shipd_checks_report",(t,n,r)=>{let a=t.details??{},s=new hv;s.addChild(new Xo(r.bold(r.fg("accent","Checks")),0,0));let m=!1,c=l=>{s.addChild(new Xo(l,0,0)),m=!0};if(a.showGaps){let l=a.gapsCount??0;c(l>0?r.fg("warning",` \u26A0 ${l} test gap(s) found`):r.fg("success"," \u2713 no test gaps found"))}if(a.showSolverGaps){let l=a.solverDetails??[],h=l.filter(_=>_.passed).length,f=a.solverGapsCount??0;s.addChild(new yv(1)),c(r.bold(r.fg("accent","Solver gap finder")));for(let _ of l){let ue=_.passed?r.fg("success","\u2713"):r.fg("error","\u2717"),Me=_.passed?"passed":_.status==="ok"?"failed tests":_.status;c(` ${ue} Solver ${_.index}: ${Me} (${tf(_.durationMs)})`)}let w=h===l.length&&l.length>0?r.fg("success",`${h}/${l.length} solvers passed`):r.fg("warning",`${h}/${l.length} solvers passed`),D=f>0?r.fg("warning",`${f} behavioral gap(s) found`):r.fg("success","no behavioral gaps found");c(` ${w}, ${D}`)}return m||s.addChild(new Xo(r.fg("dim"," nothing to report"),0,0)),s}),e.registerShortcut(xf,{description:"Cancel an in-progress /checks run",handler:t=>{wa()&&pf()&&(t.ui.setWidget(Et,[`checks: cancelling (${xf})...`]),t.ui.notify("checks: cancelling...","warning"))}}),yf(e)}export{xv as default};
322
+ ---`;function Aa(){return(If.split(/\r?\n(?=## )/g).find(t=>/^## The tests/i.test(t.trim()))??If).trim()}function Ca(){return wv.trim()}var Ma=!1,fn;function La(){return Ma}function bf(){return Ma=!0,fn=new AbortController,fn}function vf(){Ma=!1,fn=void 0}function $f(){return!Ma||!fn||fn.signal.aborted?!1:(fn.abort(),!0)}import{existsSync as Ev}from"node:fs";import{join as Rv}from"node:path";import{keyHint as Sv}from"@earendil-works/pi-coding-agent";import{Text as Ov,wrapTextWithAnsi as Pv}from"@earendil-works/pi-tui";var ir="analyze_test_gaps",Tf=6;function kf(e){e.registerTool({name:ir,label:"Gap Finder",description:"Run the sentence-by-sentence behavioral test-gap analysis on the current task and its repository source files: a read-only finder agent splits agent_prompt.md into sentences and proposes missing positive/negative behavioral tests per sentence, then a read-only fairness reviewer filters out unfair or internally-observable candidates (skipped when the finder found nothing). Returns the confirmed gaps as the tool result (details.testGaps). Never writes or modifies files.",promptSnippet:"Analyze the task's hidden tests for behavioral coverage gaps",promptGuidelines:["Use analyze_test_gaps when you need the confirmed list of fair behavioral test gaps for the current task's hidden tests."],parameters:D.Object({}),renderCall(t,n,r){let a=r.state;r.executionStarted&&a.startedAt===void 0&&(a.startedAt=Date.now(),a.endedAt=void 0);let i=r.lastComponent??new Ov("",0,0);return i.setText(""),i},renderResult(t,n,r,a){let i=a.state;i.startedAt!==void 0&&n.isPartial&&!i.interval&&(i.interval=setInterval(()=>a.invalidate(),1e3)),(!n.isPartial||a.isError)&&(i.endedAt??=Date.now(),i.interval&&(clearInterval(i.interval),i.interval=void 0));let m=n.isPartial?"Elapsed":"Took",u=i.endedAt??Date.now(),l=i.startedAt!==void 0?Mv(u-i.startedAt):"\u2014",f=t.details,h=Array.isArray(f?.testGaps)?f.testGaps.length:void 0,$=h===void 0?"gaps \u2014":`${h} gap${h===1?"":"s"}`,E=r.fg("toolTitle",r.bold("Gap Finder"))+r.fg("muted",` ${m} ${l} \xB7 ${$}`),H=(t.content??[]).map(ue=>ue.type==="text"?ue.text:"").join(`
323
+ `).trim(),te=H?Av(H.split(`
324
+ `)):["(no output)"];if(!n.expanded){let ue=Math.max(0,te.length-Tf);te=te.slice(0,Tf),ue>0&&te.push(`... (${ue} more lines, ${Sv("app.tools.expand","to expand")})`)}let ne=a.lastComponent instanceof qa?a.lastComponent:new qa;return ne.setContent(E,te,r),ne},async execute(t,n,r,a,i){if(!xn())throw new Error("analyze_test_gaps is disabled. Enable it via /checks --config (Analyze Tool section -> Enabled).");let m=Rv(i.cwd,"agent_prompt.md");if(!Ev(m))throw new Error("Missing required file in project root: agent_prompt.md");let u=Ri()??Ee(),l=u,f=l?i.modelRegistry.find(l.provider,l.modelId):i.model;if(!f||l&&!i.modelRegistry.hasConfiguredAuth(f))throw new Error("No model configured/authenticated for analyze_test_gaps. Set one via /checks --config (Analyze Tool section).");let h=u?.thinkingLevel??"off",$=new AbortController;r&&(r.aborted?$.abort():r.addEventListener("abort",()=>$.abort(),{once:!0}));let E={tempDir:i.cwd,model:f,thinkingLevel:h,testRubric:Aa(),fairnessRules:Ca(),cancelSignal:$.signal};a?.({content:[{type:"text",text:"Finding behavioral test gaps sentence by sentence..."}],details:{}});let A=await Oa(E);if($.signal.aborted)throw new Error("Cancelled by user.");if(A.status!=="ok")throw new Error(`Gap finder did not complete (status: ${A.status}).`);let H=A.gaps.reduce((ne,ue)=>ne+ue.gaps.length,0),te=[];if(H>0){a?.({content:[{type:"text",text:`Validating ${H} candidate gap(s)...`}],details:{}});let ne=await Pa({...E,statementReports:A.gaps});if($.signal.aborted)throw new Error("Cancelled by user.");if(ne.status!=="ok")throw new Error(`Gap review did not complete (status: ${ne.status}).`);te=ne.gaps}return{content:[{type:"text",text:Lv(te)}],details:{testGaps:te}}}})}function Av(e){let t=[],n=!1;for(let r of e)/^\s*\d+\.\s+/.test(r)?(n=!1,t.push(r)):/^\s*Justification:/i.test(r)?n=!0:n||t.push(r);return t}var qa=class{header="";styledLines=[];theme;cachedWidth=-1;cachedLines=[];setContent(t,n,r){this.header=t,this.styledLines=n.map(a=>Cv(a,r)),this.theme=r,this.cachedWidth=-1}invalidate(){this.cachedWidth=-1}render(t){if(this.cachedWidth!==t){let n=this.theme,r=[];this.header&&r.push(this.header,"");for(let a of this.styledLines)n?r.push(...Pv(a,t)):r.push(a);this.cachedLines=r,this.cachedWidth=t}return this.cachedLines}};function Cv(e,t){let n=e.match(/^(\d+)\.\s+(.*)$/);return n?`${t.fg("accent",`${n[1]}.`)} ${t.fg("muted",n[2]??"")}`:t.fg("toolOutput",e)}function Mv(e){return`${Math.floor(e/1e3)}s`}function Lv(e){return e.length===0?"Gap analysis complete: no confirmed behavioral test gaps were found.":["Below are the gaps found by another agent. If they are fair under our prompt, we need to add tests to fix the gap. If not fair, do not mind those \u2014 only add tests for gaps that are absolutely fair.","",...e.map((n,r)=>`${r+1}. ${n.description}
325
+ Justification: ${n.justification}`)].join(`
326
+ `)}var ii=!1,wf=!1,hn=!1;function si(e){return e.getActiveTools().map(n=>typeof n=="string"?n:n.name)}function mi(){return ii}function qv(e){return si(e).includes(ir)}function ja(e){return mi()!==qv(e)}function jv(e){wf||(kf(e),wf=!0)}function Fv(e,t){let n=si(e);if(t){if(n.length===0){hn=!0;return}let r=new Set(n);r.add(ir),r.size!==n.length&&e.setActiveTools([...r])}else{let r=n.filter(a=>a!==ir);r.length!==n.length&&e.setActiveTools(r)}hn=ja(e)}function sr(e){let t=mi();t&&jv(e),Fv(e,t)}function pi(e){ii=xn(),hn=!0,Ef(e)}function Ef(e,t=0){let n=mi(),r=si(e);if(n&&r.length===0&&t<8){queueMicrotask(()=>Ef(e,t+1));return}sr(e)}function Rf(e){for(let t of[0,50,150,400])setTimeout(()=>{(hn||ja(e))&&sr(e)},t)}function Sf(){return hn}function Of(e){ii=xn(),hn=!0,sr(e)}var zv="Ctrl+Shift+X",ci=[{value:"--gap-finder",label:"--gap-finder",description:"Find and validate behavioral test-coverage gaps"},{value:"--solver-gap-finder",label:"--solver-gap-finder",description:"Use TDD solver attempts to find behavioral gaps"},{value:"--config",label:"--config",description:"Configure gap-finder models"}];function Bv(e){let t=e.trimStart(),n=/\s$/.test(t),r=t.trimEnd().split(/\s+/).filter(Boolean),a=n?"":r.at(-1)??"",i=new Set(n?r:r.slice(0,-1)),m=n?t:t.slice(0,t.length-a.length),u=i.has("--config"),l=[...i].some(h=>h!=="--config"),f=ci.filter(h=>!i.has(h.value)&&!u&&!(l&&h.value==="--config")&&h.value.startsWith(a));return f.length?f.map(h=>({...h,value:`${m}${h.value}`})):null}async function ui(e,t,n){let r=Si();if(r.length===0)return e.ui.notify("No enabledModels configured in settings.json.","error"),null;let a=e.modelRegistry.getAll(),i=r.map(f=>{let h=Oi(f);if(!h)return null;let $=a.find(H=>H.provider===h.provider&&H.id===h.modelId),E=t?.provider===h.provider&&t?.modelId===h.modelId,A=$?`${$.name} (${f})`:f;return{ref:f,parsed:h,display:E?`${A} [current]`:A,isCurrent:E}}).filter(f=>f!==null);if(i.length===0)return e.ui.notify("Could not resolve any enabledModels entries.","error"),null;let m=[...i].sort((f,h)=>f.isCurrent===h.isCurrent?0:f.isCurrent?-1:1),u=await e.ui.select(n,m.map(f=>f.display));if(!u)return null;let l=i.find(f=>f.display===u);return l?{provider:l.parsed.provider,modelId:l.parsed.modelId}:null}function gn(e,t,n){let r=e.modelRegistry.getAll().find(a=>a.provider===t&&a.id===n);return wi(r)}var Fa={provider:"",modelId:"",thinkingLevel:"off",timeoutMinutes:za,solverCount:Va,saveArtifacts:Wa},Da={provider:"",modelId:"",thinkingLevel:"off"};function qf(e,t,n,r){let a=t?gn(e,t.provider,t.modelId):["off"],i=n.provider?gn(e,n.provider,n.modelId):["off"],m=r.provider?gn(e,r.provider,r.modelId):["off"];return[{id:"reviewer-model",section:"Reviewer",label:"Model",value:t?`${t.provider}/${t.modelId}`:"not set",kind:"model"},{id:"reviewer-thinking",section:"Reviewer",label:"Thinking level",value:t?.thinkingLevel??"off",kind:"cycle",values:a},{id:"solvergap-model",section:"Solver",label:"Model",value:n.provider?`${n.provider}/${n.modelId}`:"not set",kind:"model"},{id:"solvergap-thinking",section:"Solver",label:"Thinking level",value:n.thinkingLevel,kind:"cycle",values:i},{id:"solvergap-timeout",section:"Solver",label:"Timeout",value:`${n.timeoutMinutes} min`,kind:"cycle",values:[10,20,30,40,50,Ti].filter((u,l,f)=>u>=$i&&f.indexOf(u)===l).map(u=>`${u} min`)},{id:"solvergap-solver-count",section:"Solver",label:"Parallel agents",value:String(n.solverCount),kind:"cycle",values:Array.from({length:ki-Ba+1},(u,l)=>`${Ba+l}`)},{id:"solvergap-save-artifacts",section:"Solver",label:"Save artifacts",value:n.saveArtifacts?"on":"off",kind:"cycle",values:["on","off"]},{id:"analyze-enabled",section:"Analyze Tool",label:"Enabled",value:t?.enableAnalyzeTool?"on":"off",kind:"cycle",values:["on","off"]},{id:"analyze-model",section:"Analyze Tool",label:"Model",value:r.provider?`${r.provider}/${r.modelId}`:"not set",kind:"model"},{id:"analyze-thinking",section:"Analyze Tool",label:"Thinking level",value:r.thinkingLevel,kind:"cycle",values:m}]}var li=class{constructor(t,n,r,a,i,m){this.ctx=t;this.settingsListTheme=n;this.theme=r;this.onCycleSaved=a;this.onActivateModel=i;this.onExit=m;this.rows=qf(t,Ee(),Ee()?.solverGap??Fa,Ee()?.analyzeGap??Da)}selectedIndex=0;rows;refresh(){let t=Ee();this.rows=qf(this.ctx,t,t?.solverGap??Fa,t?.analyzeGap??Da),this.selectedIndex=Math.min(this.selectedIndex,this.rows.length-1)}invalidate(){}render(t){let n=[],r=Math.min(30,Math.max(...this.rows.map(i=>i.label.length))),a;for(let i=0;i<this.rows.length;i++){let m=this.rows[i];if(!m)continue;m.section!==a&&(a!==void 0&&n.push(""),n.push(this.theme.bold(this.theme.fg("accent",m.section))),a=m.section);let u=i===this.selectedIndex,l=u?this.settingsListTheme.cursor:" ",f=m.label+" ".repeat(Math.max(0,r-m.label.length)),h=this.settingsListTheme.label(f,u),$=this.settingsListTheme.value(m.value,u);n.push(`${l}${h} ${$}`)}return n}handleInput(t){if(Kt(t,_t.ctrl("s"))||Kt(t,_t.escape)||Kt(t,_t.ctrl("c"))){this.onExit();return}if(Kt(t,_t.up)){this.selectedIndex=this.selectedIndex===0?this.rows.length-1:this.selectedIndex-1;return}if(Kt(t,_t.down)){this.selectedIndex=this.selectedIndex===this.rows.length-1?0:this.selectedIndex+1;return}if(Kt(t,_t.enter)||Kt(t,_t.return)||t===" "){let n=this.rows[this.selectedIndex];if(!n)return;if(n.kind==="model"){this.onActivateModel(n.id);return}if(!n.values||n.values.length===0)return;let r=Ee();if(!r){this.ctx.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");return}let a=r.solverGap??Fa,i=r.analyzeGap??Da,m=n.values.indexOf(n.value),u=n.values[(m+1)%n.values.length];if(u===void 0)return;n.id==="reviewer-thinking"?Fe({...r,thinkingLevel:u,solverGap:a,analyzeGap:i}):n.id==="solvergap-thinking"?Fe({...r,solverGap:{...a,thinkingLevel:u}}):n.id==="solvergap-timeout"?Fe({...r,solverGap:{...a,timeoutMinutes:Number.parseInt(u,10)}}):n.id==="solvergap-solver-count"?Fe({...r,solverGap:{...a,solverCount:Number.parseInt(u,10)}}):n.id==="solvergap-save-artifacts"?Fe({...r,solverGap:{...a,saveArtifacts:u==="on"}}):n.id==="analyze-enabled"?Fe({...r,enableAnalyzeTool:u==="on"}):n.id==="analyze-thinking"&&Fe({...r,analyzeGap:{...i,thinkingLevel:u}}),this.refresh(),this.onCycleSaved()}}};async function Vv(e,t){if(t.mode!=="tui"){t.ui.notify("/checks --config requires interactive mode","error");return}let n=0;for(;;){let r=await t.ui.custom((u,l,f,h)=>{let $=new li(t,Uv(),l,()=>{Of(e),u.requestRender()},A=>h(A),()=>h(void 0));$.selectedIndex=n;let E=new _v;return E.addChild(new Lf(l.bold(l.fg("accent","Checks settings")))),E.addChild({render:A=>$.render(A),invalidate:()=>$.invalidate()}),E.addChild(new Kv(1)),E.addChild(new Lf(l.fg("dim","\u2191\u2193 navigate enter select ctrl+s save & exit esc cancel"))),{render(A){return E.render(A)},invalidate(){E.invalidate()},handleInput(A){$.handleInput(A),n=$.selectedIndex,u.requestRender()}}});if(!r)return;let a=Ee(),i=a?.solverGap??Fa,m=a?.analyzeGap??Da;if(r==="reviewer-model"){let u=await ui(t,a,"Select reviewer model");if(!u)continue;let l=gn(t,u.provider,u.modelId),f=l.includes(a?.thinkingLevel??"off")?a?.thinkingLevel??"off":l[0]??"off";Fe({...u,thinkingLevel:f,solverGap:i,analyzeGap:m,enableAnalyzeTool:a?.enableAnalyzeTool}),t.ui.notify(`Reviewer model saved: ${u.provider}/${u.modelId}`,"info");continue}if(r==="solvergap-model"){if(!a){t.ui.notify("Set the reviewer model first \u2014 it's required before solver-gap-finder settings.","warning");continue}let u=await ui(t,i.provider?i:null,"Select solver model");if(!u)continue;let l=gn(t,u.provider,u.modelId),f=l.includes(i.thinkingLevel)?i.thinkingLevel:l[0]??"off";Fe({...a,solverGap:{...i,...u,thinkingLevel:f}}),t.ui.notify(`Solver model saved: ${u.provider}/${u.modelId}`,"info");continue}if(r==="analyze-model"){if(!a){t.ui.notify("Set the reviewer model first \u2014 it's required before analyze-tool settings.","warning");continue}let u=await ui(t,m.provider?m:null,"Select analyze tool model");if(!u)continue;let l=gn(t,u.provider,u.modelId),f=l.includes(m.thinkingLevel)?m.thinkingLevel:l[0]??"off";Fe({...a,analyzeGap:{...m,...u,thinkingLevel:f}}),t.ui.notify(`Analyze tool model saved: ${u.provider}/${u.modelId}`,"info")}}}function jf(e){e.registerCommand("checks",{description:"Find behavioral gaps in test coverage. Requires an option \u2014 see /checks.",getArgumentCompletions:Bv,handler:async(t,n)=>{let r=t.trim();if(!r){n.ui.notify(ci.map(N=>`${N.value} \u2014 ${N.description}`).join(`
327
+ `),"info");return}let a=[...new Set(r.split(/\s+/).filter(Boolean))],i=new Set(ci.map(N=>N.value)),m=a.filter(N=>!i.has(N));if(m.length){n.ui.notify(`Unknown option(s): ${m.join(", ")}. Run /checks with no arguments to see options.`,"warning");return}if(a.includes("--config")){a.length>1?n.ui.notify("--config cannot be combined with other options.","warning"):await Vv(e,n);return}let u=a.includes("--gap-finder"),l=a.includes("--solver-gap-finder");if(!u&&!l)return;if(La()){n.ui.notify("A checks run is already in progress.","warning");return}let f=Ee();if(!f){n.ui.notify("No gap-finder model configured. Run /checks --config first.","error");return}let h=n.modelRegistry.find(f.provider,f.modelId);if(!h||!n.modelRegistry.hasConfiguredAuth(h)){n.ui.notify("Configured behavioral gap-finder model is unavailable or unauthenticated. Run /checks --config.","error");return}let $=ai.filter(N=>!Af(et(n.cwd,N)));if($.length){n.ui.notify(`Missing required file(s): ${$.join(", ")}`,"error");return}let E=null,A;if(l){if(E=Ei(),!E||!Af(et(n.cwd,"test.sh"))){n.ui.notify("Configure solver gap finder and provide test.sh before running it.","error");return}if(A=n.modelRegistry.find(E.provider,E.modelId),!A||!n.modelRegistry.hasConfiguredAuth(A)){n.ui.notify("Configured solver gap-finder model is unavailable or unauthenticated.","error");return}}let H=bf(),te=E?.solverCount??0,ne=(u?2:0)+(l?te+1:0);n.ui.setWidget(Et,or("preparing clean snapshot",0,ne)),n.ui.notify(`gap finders (${a.join(" ")}) started. Press ${zv} to cancel.`,"info");let ue,tt=[];try{let N=et(Mf(),`checks-${Pf()}`);Cf(N,{recursive:!0}),ue=N;let nt=await hr(e,n.cwd,N);if(nt.status==="error"){n.ui.notify(`checks: ${nt.error}`,"error");return}for(let qe of ai)Dv(et(n.cwd,qe),et(N,qe));let Ue=Aa(),ct=Ca(),rt=0,lt={status:"ok",gaps:[]},zt={status:"ok",gaps:[]};if(u){let qe={tempDir:N,model:h,thinkingLevel:f.thinkingLevel,testRubric:Ue,fairnessRules:ct,cancelSignal:H.signal};if(n.ui.setWidget(Et,or("finding sentence-by-sentence test gaps",rt,ne)),lt=await Oa(qe),rt+=1,n.ui.setWidget(Et,or("reviewing test gaps",rt,ne)),lt.gaps.reduce((Na,Ua)=>Na+Ua.gaps.length,0)>0&&(zt=await Pa({...qe,statementReports:lt.gaps})),rt+=1,H.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let dt=[],mr={status:"ok",gaps:[]};if(l&&E){let qe=[],Ga=at=>{qe.push(at),rt+=1,n.ui.setWidget(Et,or("solver gap finder: solving",rt,ne,{passed:qe.filter(je=>je.passed).length,failed:qe.filter(je=>!je.passed).length}))},Na=await Promise.all(Array.from({length:te},async(at,je)=>{let yn=et(Mf(),`checks-solvergap-${Pf()}`);return Cf(yn,{recursive:!0}),tt.push(yn),{index:je+1,setup:await Ai({pi:e,repoDir:n.cwd,solverDir:yn,testPatchPath:et(n.cwd,"test.patch"),agentPromptPath:et(n.cwd,"agent_prompt.md")})}})),Ua=oi().replace(/[:.]/g,"-");if(dt=await Promise.all(Na.map(async({index:at,setup:je})=>{if(je.status!=="ok"){let Ii={index:at,status:je.status,passed:!1,diff:"",testOutputTail:je.error,durationMs:0,totalTests:null,failedTests:null};return Ga(Ii),Ii}let yn=Date.now(),{outcome:yi,trajectory:Gf}=await df({pi:e,solverDir:je.solverDir,model:A,thinkingLevel:E.thinkingLevel,timeoutMinutes:E.timeoutMinutes,cancelSignal:H.signal}),{testOutputXmlPath:Nf,..._a}=await Ci({pi:e,index:at,workspace:je,status:yi==="done"?"ok":yi,durationMs:Date.now()-yn}),Uf=E.saveArtifacts?Mi({repoDir:n.cwd,runId:Ua,index:at,trajectory:Gf,solutionPatch:_a.diff,testOutputXmlPath:Nf,testOutputTail:_a.testOutputTail}):void 0,xi={..._a,artifactsDir:Uf};return Ga(xi),xi})),dt.some(at=>at.status!=="patchFailed"&&at.status!=="error")&&(Li(N,dt),mr=await ff({tempDir:N,model:h,thinkingLevel:f.thinkingLevel,solverResults:dt,testRubric:Ue,fairnessRules:ct,cancelSignal:H.signal})),rt+=1,H.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}let Df=u&&(lt.status!=="ok"||lt.gaps.length>0&&zt.status!=="ok"),fi=gf({existingReport:hf(et(n.cwd,"shipd_report.json")),config:f,runGapFinder:u,testGaps:zt.gaps,gapAnalysisIncomplete:Df,gapFinderStatus:lt.status,gapFilterStatus:zt.status,runSolverGapFinder:l,solverResults:dt,solverGaps:mr.gaps,solverGapAnalysisIncomplete:l&&(dt.some(qe=>qe.status==="error")||mr.status!=="ok"),solverComparisonStatus:mr.status}),hi=xf({merged:fi,runGapFinder:u,runSolverGapFinder:l});e.sendMessage({customType:"shipd_checks_report",content:hi.content,display:!0,details:hi.details});let gi=et(n.cwd,"shipd_report.json");Nv(gi,JSON.stringify(fi,null,2),"utf-8"),n.ui.notify(`checks: wrote details to ${gi}`,"info")}catch(N){n.ui.notify(`checks failed: ${N instanceof Error?N.message:String(N)}`,"error")}finally{n.ui.setWidget(Et,void 0),ue&&Gv(ue,{recursive:!0,force:!0});for(let N of tt)qi(N);vf()}}})}var Ff=Hv.ctrlShift("x");function Jv(e){e.registerMessageRenderer("shipd_checks_report",(t,n,r)=>{let a=t.details??{},i=new Wv;i.addChild(new di(r.bold(r.fg("accent","Checks")),0,0));let m=!1,u=l=>{i.addChild(new di(l,0,0)),m=!0};if(a.showGaps){let l=a.gapsCount??0;u(l>0?r.fg("warning",` \u26A0 ${l} test gap(s) found`):r.fg("success"," \u2713 no test gaps found"))}if(a.showSolverGaps){let l=a.solverDetails??[],f=l.filter(A=>A.passed).length,h=a.solverGapsCount??0;i.addChild(new Yv(1)),u(r.bold(r.fg("accent","Solver gap finder")));for(let A of l){let H=A.passed?r.fg("success","\u2713"):r.fg("error","\u2717"),te=A.passed?"passed":A.status==="ok"?"failed tests":A.status;u(` ${H} Solver ${A.index}: ${te} (${yf(A.durationMs)})`)}let $=f===l.length&&l.length>0?r.fg("success",`${f}/${l.length} solvers passed`):r.fg("warning",`${f}/${l.length} solvers passed`),E=h>0?r.fg("warning",`${h} behavioral gap(s) found`):r.fg("success","no behavioral gaps found");u(` ${$}, ${E}`)}return m||i.addChild(new di(r.fg("dim"," nothing to report"),0,0)),i}),e.registerShortcut(Ff,{description:"Cancel an in-progress /checks run",handler:t=>{La()&&$f()&&(t.ui.setWidget(Et,[`checks: cancelling (${Ff})...`]),t.ui.notify("checks: cancelling...","warning"))}}),Zv(e),jf(e)}function Zv(e){e.on("session_start",(t,n)=>{pi(e),(t.reason==="resume"||t.reason==="reload"||t.reason==="startup")&&Rf(e)}),e.on("session_tree",()=>{pi(e)}),e.on("before_agent_start",()=>{!Sf()&&!ja(e)||sr(e)})}export{Jv as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sreetej510/pi-shipd-checks",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "description": "Pi extension that runs a strict, multi-agent fairness review of a benchmark task's agent_prompt.md, test.patch, and solution.patch, plus behavioral test-gap analysis, via /checks.",
5
5
  "type": "module",
6
6
  "license": "MIT",