@sreetej510/pi-shipd-checks 0.1.8 → 0.1.11

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 +6 -6
  2. package/dist/index.js +11 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -18,10 +18,10 @@ For the flags you pass, `/checks`:
18
18
  **solution** — each restricted to `read`/`grep`/`find`/`ls` tools plus a single
19
19
  `submit_review_report` tool it must call with a structured `PASS`/`FAIL` verdict, reasons,
20
20
  and notes.
21
- 4. Optionally runs a 2-stage behavioral test-gap analysis: an exhaustive researcher agent
22
- proposes candidate gaps (required-but-untested edge cases), then a strict, independent
23
- filter agent re-verifies each one against the fairness rules. This never turns a `PASS` into
24
- a `FAIL` — it's purely informational.
21
+ 4. Optionally runs a 3-agent behavioral test-gap analysis: two specialized finders
22
+ run in parallel (positive required-behavior gaps + negative forbidden-behavior gaps),
23
+ then a strict validator filters the combined list. This never turns a `PASS` into a
24
+ `FAIL` — it's purely informational.
25
25
  5. Posts a one-line chat summary and merges the results into `shipd_report.json` in your
26
26
  project root. Running flags separately, in any order, builds up one combined report instead
27
27
  of overwriting it — `overall` only becomes a confident `PASS`/`FAIL` once all 3 focus
@@ -40,7 +40,7 @@ just the tests reviewer plus the gap-finder/filter stages. `--config` must be us
40
40
  | `/checks --description` | Run only the problem-description reviewer |
41
41
  | `/checks --tests` | Run only the tests reviewer |
42
42
  | `/checks --solution` | Run only the solution reviewer |
43
- | `/checks --gap-finder` | Run only the test-gap finder + filter agents |
43
+ | `/checks --gap-finder` | Run positive + negative gap finders (parallel), then validator |
44
44
  | `/checks --config` | Set the reviewer model and thinking level |
45
45
 
46
46
  **Shortcut:** `Ctrl+Shift+X` cancels an in-progress `/checks` run.
@@ -50,7 +50,7 @@ just the tests reviewer plus the gap-finder/filter stages. `--config` must be us
50
50
  `/checks --config` lets you pick a model from your `enabledModels` list in `settings.json`,
51
51
  then (if the model supports more than one) a thinking level. The currently configured
52
52
  model/level is highlighted `[current]` in the picker. Settings are saved globally to
53
- `~/.pi/agent/checks-config.json` and shared by all reviewer/gap-finder/validator agents.
53
+ `~/.pi/agent/checks-config.json` and shared by all reviewer, gap-finder, and validator agents.
54
54
 
55
55
  ## Install
56
56
 
package/dist/index.js CHANGED
@@ -1,13 +1,14 @@
1
- var Ed=Object.defineProperty;var xt=(e,t)=>{for(var n in t)Ed(e,n,{get:t[n],enumerable:!0})};import{Key as mb,Text as pb}from"@earendil-works/pi-tui";import{randomUUID as XI}from"node:crypto";import{copyFileSync as QI,existsSync as eb,mkdirSync as tb,rmSync as nb,writeFileSync as rb}from"node:fs";import{tmpdir as ab}from"node:os";import{join as Wn}from"node:path";import{createAgentSession as go,SessionManager as xo}from"@earendil-works/pi-coding-agent";var p={};xt(p,{Assign:()=>wd,Clone:()=>cn,Create:()=>Af,Discard:()=>qf,Metrics:()=>qe,Update:()=>Lf});var qe={assign:0,create:0,clone:0,discard:0,update:0};function wd(e,t){return qe.assign+=1,{...e,...t}}var i={};xt(i,{Entries:()=>Vd,EntriesRegExp:()=>Wd,Every:()=>_d,EveryAll:()=>zd,GraphemeCount:()=>Kd,HasPropertyKey:()=>Bd,IsArray:()=>pn,IsBigInt:()=>mn,IsBoolean:()=>Ao,IsClassInstance:()=>Dd,IsConstructor:()=>Cd,IsDeepEqual:()=>la,IsEqual:()=>S,IsFunction:()=>qo,IsGreaterEqualThan:()=>jo,IsGreaterThan:()=>Ld,IsInteger:()=>ua,IsLessEqualThan:()=>Lo,IsLessThan:()=>jd,IsMaxLength:()=>Ud,IsMinLength:()=>Gd,IsMultipleOf:()=>Fd,IsNull:()=>Zn,IsNumber:()=>Xn,IsObject:()=>un,IsObjectNotArray:()=>Ad,IsString:()=>Qn,IsSymbol:()=>qd,IsUndefined:()=>ca,IsUnsafePropertyKey:()=>Fo,IsValueLike:()=>Nd,Keys:()=>Jn,ShiftLeft:()=>er,Symbols:()=>Hd,Values:()=>Yd});function yt(e,t,n){return e>=t&&e<=n}function Rd(e){return e===8205}function Od(e){return yt(e,55296,56319)}function Eo(e){return yt(e,127462,127487)}function Ro(e){return yt(e,65024,65039)}function Oo(e){return yt(e,768,879)||yt(e,6832,6911)||yt(e,7616,7679)||yt(e,65056,65071)}function Yn(e){return e>65535?2:1}function wo(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Oo(n)||Ro(n))t+=Yn(n);else break}return t}function pa(e,t){let n=e.codePointAt(t),r=t+Yn(n);for(r=wo(e,r);r<e.length-1&&e[r]==="\u200D";){let a=e.codePointAt(r+1);r+=1+Yn(a),r=wo(e,r)}return Eo(n)&&r<e.length&&Eo(e.codePointAt(r))&&(r+=Yn(e.codePointAt(r))),r}function Po(e){return Od(e)||Oo(e)||Ro(e)||Rd(e)}function So(e){let t=0,n=0;for(;n<e.length;)n=pa(e,n),t++;return t}function Pd(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=pa(e,r),n++,n>=t)return!0;return!1}function Sd(e,t){let n=0,r=0;for(;r<e.length;)if(r=pa(e,r),n++,n>t)return!1;return!0}function Mo(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Po(e.charCodeAt(n)))return Pd(e,t);if(n++,n>=t)return!0}return!1}function Co(e,t){let n=0;for(;n<e.length;){if(Po(e.charCodeAt(n)))return Sd(e,t);if(n++,n>t)return!1}return!0}function pn(e){return Array.isArray(e)}function mn(e){return S(typeof e,"bigint")}function Ao(e){return S(typeof e,"boolean")}function Cd(e){if(ca(e)||!qo(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function qo(e){return S(typeof e,"function")}function ua(e){return Number.isInteger(e)}function Zn(e){return S(e,null)}function Xn(e){return Number.isFinite(e)}function Ad(e){return un(e)&&!pn(e)}function un(e){return S(typeof e,"object")&&!Zn(e)}function Qn(e){return S(typeof e,"string")}function qd(e){return S(typeof e,"symbol")}function ca(e){return S(e,void 0)}function S(e,t){return e===t}function Ld(e,t){return e>t}function jd(e,t){return e<t}function Lo(e,t){return e<=t}function jo(e,t){return e>=t}function Fd(e,t){if(mn(e)||mn(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!Xn(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 Dd(e){if(!un(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Zn(t)?!1:S(typeof t.constructor,"function")&&!(S(t.constructor,globalThis.Object)||S(t.constructor.name,"Object"))}function Nd(e){return mn(e)||Ao(e)||Zn(e)||Xn(e)||Qn(e)||ca(e)}function Kd(e){return So(e)}function Ud(e,t){return Co(e,t)}function Gd(e,t){return Mo(e,t)}function _d(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function zd(e,t,n){let r=!0;for(let a=t;a<e.length;a++)n(e[a],a)||(r=!1);return r}function er(e,t,n){return S(e.length,0)?n():t(e[0],e.slice(1))}function Fo(e){return S(e,"__proto__")||S(e,"constructor")||S(e,"prototype")}function Bd(e,t){return Fo(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Wd(e){return Jn(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function Vd(e){return Object.entries(e)}function Jn(e){return Object.getOwnPropertyNames(e)}function Hd(e){return Object.getOwnPropertySymbols(e)}function Yd(e){return Object.values(e)}function Jd(e,t){if(!un(t))return!1;let n=Jn(e);return S(n.length,Jn(t).length)&&n.every(r=>la(e[r],t[r]))}function Zd(e,t){return pn(t)&&S(e.length,t.length)&&e.every((n,r)=>la(e[r],t[r]))}function la(e,t){return pn(e)?Zd(e,t):un(e)?Jd(e,t):S(e,t)}var rt={};xt(rt,{IsBigInt64Array:()=>df,IsBigUint64Array:()=>ff,IsBoolean:()=>Qd,IsDate:()=>xf,IsFloat32Array:()=>cf,IsFloat64Array:()=>lf,IsInt16Array:()=>sf,IsInt32Array:()=>pf,IsInt8Array:()=>rf,IsMap:()=>hf,IsNumber:()=>ef,IsRegExp:()=>gf,IsSet:()=>yf,IsString:()=>tf,IsTypeArray:()=>nf,IsUint16Array:()=>mf,IsUint32Array:()=>uf,IsUint8Array:()=>af,IsUint8ClampedArray:()=>of});function Qd(e){return e instanceof Boolean}function ef(e){return e instanceof Number}function tf(e){return e instanceof String}function nf(e){return globalThis.ArrayBuffer.isView(e)}function rf(e){return e instanceof globalThis.Int8Array}function af(e){return e instanceof globalThis.Uint8Array}function of(e){return e instanceof globalThis.Uint8ClampedArray}function sf(e){return e instanceof globalThis.Int16Array}function mf(e){return e instanceof globalThis.Uint16Array}function pf(e){return e instanceof globalThis.Int32Array}function uf(e){return e instanceof globalThis.Uint32Array}function cf(e){return e instanceof globalThis.Float32Array}function lf(e){return e instanceof globalThis.Float64Array}function df(e){return e instanceof globalThis.BigInt64Array}function ff(e){return e instanceof globalThis.BigUint64Array}function gf(e){return e instanceof globalThis.RegExp}function xf(e){return e instanceof globalThis.Date}function yf(e){return e instanceof globalThis.Set}function hf(e){return e instanceof globalThis.Map}function bf(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function $f(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:ht(a.value)})}return t}function Tf(e){let t={};for(let n of i.Keys(e))i.IsUnsafePropertyKey(n)||(t[n]=ht(e[n]));for(let n of i.Symbols(e))t[n]=ht(e[n]);return t}function vf(e){return i.IsClassInstance(e)?e:bf(e)?$f(e):Tf(e)}function kf(e){return e.map(t=>ht(t))}function Ef(e){return e.slice()}function wf(e){return new RegExp(e.source,e.flags)}function Rf(e){return new Map(ht([...e.entries()]))}function Of(e){return new Set(ht([...e.values()]))}function ht(e){return rt.IsTypeArray(e)?Ef(e):rt.IsRegExp(e)?wf(e):rt.IsMap(e)?Rf(e):rt.IsSet(e)?Of(e):i.IsArray(e)?kf(e):i.IsObject(e)?vf(e):e}function cn(e){return qe.clone+=1,ht(e)}var It={};xt(It,{Get:()=>Mf,Reset:()=>Pf,Set:()=>Sf});var Ye={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Pf(){Ye.immutableTypes=!1,Ye.maxErrors=8,Ye.useAcceleration=!0,Ye.exactOptionalPropertyTypes=!1,Ye.enumerableKind=!1,Ye.correctiveParse=!1,Ye.unionPrioritySort=!0}function Sf(e){for(let t of i.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(Ye,t,{value:n})}}function Mf(){return Ye}function Cf(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 Do(e,t){return{...e,...t}}function Af(e,t,n={}){qe.create+=1;let r=It.Get(),a=Do(t,n),s=r.enumerableKind?Do(a,e):Cf(a,e);return r.immutableTypes?Object.freeze(s):s}function qf(e,t){qe.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(cn(e)),a=new Set(t);for(let s of Object.keys(r))a.has(s)||Object.defineProperty(n,s,r[s]);return n}function Lf(e,t,n){qe.update+=1;let r=It.Get(),a=cn(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 x(e,t){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],t)}function Q(e){return i.IsObject(e)}function h(e,t,n){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function at(e){return x(e,"Deferred")}function jf(e){return p.Update(e,{"~readonly":!0},{})}function ln(e,t){return p.Update(jf(e),{},t)}function No(e,t,n,r){let a=d(e,t,n);return ln(a,r)}function Ff(e){return p.Update(e,{"~optional":!0},{})}function dn(e,t){return p.Update(Ff(e),{},t)}function Ko(e,t,n,r){let a=d(e,t,n);return dn(a,r)}function ve(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function U(e){return x(e,"Array")}function tr(e){return p.Discard(e,["~kind","type","items"])}function Fe(e,t,n={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function te(e){return x(e,"Constructor")}function Uo(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function De(e,t,n={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function ne(e){return x(e,"Function")}function Go(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function Je(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function re(e){return x(e,"Ref")}function ot(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function Ct(e){return x(e,"Generic")}function At(e){return p.Create({"~kind":"Any"},{},e)}function Y(e){return x(e,"Any")}var _o="(?!)";function L(e){return p.Create({"~kind":"Never"},{not:{}},e)}function it(e){return x(e,"Never")}function Ne(e,t={}){return h("AddOptional",[e],t)}function bt(e,t={}){return dn(e,t)}function zo(e){return bt(e)}function ue(e){return Q(e)&&i.HasPropertyKey(e,"~optional")}function Bo(e){return i.Keys(e).filter(t=>!ue(e[t]))}function nr(e){return i.Keys(e)}function rr(e){return i.Values(e)}function $(e,t={}){let n=Bo(e),r=n.length>0?{required:n}:{};return p.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function M(e){return x(e,"Object")}function Wo(e){return p.Discard(e,["~kind","type","properties","required"])}function ae(e){return p.Create({"~kind":"Unknown"},{},e)}function ee(e){return x(e,"Unknown")}function Ke(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 x(e,"Cyclic")}function Vo(e){return p.Update(e,{"~unsafe":null},{})}function ar(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var Ue={};xt(Ue,{Match:()=>Df});function Df(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function fn(...e){let[t,n]=Ue.Match(e,{2:(r,a)=>[r,a,a],1:r=>[r,ae(),ae()]});return p.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function W(e){return x(e,"Infer")}function $t(e,t,n,r={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function z(e){return x(e,"Dependent")}function Ho(e){return p.Discard(e,["~kind","if","then","else"])}function Yo(e){return i.IsObjectNotArray(e)}function Jo(e){return i.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function Zo(e){return i.IsString(e)||i.IsNumber(e)}function Xo(e,t){let n=Yo(e)?Jo(e):e;return p.Create({"~kind":"Enum"},{enum:n},t)}function de(e){return x(e,"Enum")}function ce(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function R(e){return x(e,"Intersect")}function Qo(e){return p.Discard(e,["~kind","allOf"])}function V(){throw new Error("Unreachable")}var ei;(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"})(ei||(ei={}));var xT=BigInt("14695981039346656037"),[yT,hT]=[BigInt("1099511628211"),BigInt("18446744073709551616")],IT=Array.from({length:256}).map((e,t)=>BigInt(t)),ti=new Float64Array(1),bT=new DataView(ti.buffer),$T=new Uint8Array(ti.buffer);var TT=new TextEncoder;var gn=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=or(n)?m=>this.decode(n["~codec"].decode(m)):this.decode,a=or(n)?m=>n["~codec"].encode(t(m)):t,s={decode:r,encode:a};return p.Update(this.type,{"~codec":s},{})}},xn=class{constructor(t){this.type=t}Decode(t){return new gn(this.type,t)}};function ir(e){return new xn(e)}function ri(e,t){return ir(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function ai(e,t){return ir(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function or(e){return Q(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function oi(e){return qt(e)}function Tt(e){return Q(e)&&i.HasPropertyKey(e,"~immutable")}function Ge(e,t={}){return h("AddReadonly",[e],t)}function vt(e,t={}){return ln(e,t)}function ii(e){return vt(e)}function kt(e){return Q(e)&&i.HasPropertyKey(e,"~readonly")}function Gf(e,t){let n=da(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":n},{})}function si(...e){let[t,n,r]=Ue.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return Gf(t,{check:n,error:r})}function _f(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function da(e){return Q(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>_f(t))}var mi="-?(?:0|[1-9][0-9]*)n";function yn(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function _e(e){return x(e,"BigInt")}function sr(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Re(e){return x(e,"Boolean")}function hn(e){return p.Create({"~kind":"Identifier"},{name:e})}function pi(e){return x(e,"Identifier")}var mr="-?(?:0|[1-9][0-9]*)";function Et(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function fe(e){return x(e,"Integer")}var fa=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function zf(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new fa(e)})()}function O(e,t){return p.Create({"~kind":"Literal"},{type:zf(e),const:e},t)}function pr(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function ui(e){return C(e)&&i.IsNumber(e.const)}function ci(e){return C(e)&&i.IsString(e.const)}function C(e){return x(e,"Literal")}function Lt(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function jt(e){return x(e,"Null")}var ur="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Ie(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function J(e){return x(e,"Number")}function Ft(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function st(e){return x(e,"Symbol")}function wt(...e){let[t,n,r]=Ue.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,s],1:a=>[a,ae(),ae()]});return p.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function li(e){return x(e,"Parameter")}var cr=".*";function Oe(e){return p.Create({"~kind":"String"},{type:"string"},e)}function ge(e){return x(e,"String")}function k(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function y(e){return x(e,"Union")}function di(e){return p.Discard(e,["~kind","anyOf"])}function In(e){let t=fi(e);return i.IsEqual(t.length,2)?t[0]:[]}function Bf(e){return!0}function gi(e){return i.ShiftLeft(e,(t,n)=>Wf(t)?gi(n):!1,()=>!0)}function xi(e){return i.IsEqual(e.length,0)?!1:gi(e)}function Wf(e){return y(e)?xi(e.anyOf):C(e)?Bf(e.const):!1}function lr(e){return xi(e)}function dr(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function yi(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>yi(a,t,[...n,`${r}${t}`]),()=>n)}function Vf(e,t){return i.IsEqual(e.length,0)?[`${t}`]:yi(e,t)}function hi(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>hi(e,a,[...n,...Ii(e,r)]),()=>n)}function Ii(e,t){return y(t)?hi(e,t.anyOf):C(t)?Vf(e,t.const):V()}function bi(e,t){return i.ShiftLeft(t,(n,r)=>bi(Ii(e,n),r),()=>e)}function Hf(e){return e.map(t=>O(t))}function Yf(e){let t=bi([],e),n=Hf(t);return k(n)}function Jf(e){return i.IsEqual(e.length,0)?V():i.IsEqual(e.length,1)&&C(e[0])?e[0]:Yf(e)}function ga(e){let t=In(e);return i.IsEqual(t.length,0)?Oe():lr(t)?Jf(t):dr(e)}function $i(e){let t=ga(e);return Z(t)?Oe():t}function ye(e,t){let n="object",r={[e]:t};return p.Create({"~kind":"Record"},{type:n,patternProperties:r})}function Ti(e){return ye(Le,e)}function vi(e){return $({true:e,false:e})}function X(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 F(e){return x(e,"Tuple")}function ki(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Zf(e){return p.Discard(e,["~readonly"])}function xa(e,t){return p.Update(Zf(e),{},t)}function Ei(e,t,n,r){let a=d(e,t,n);return xa(a,r)}function wi(e,t={}){return h("RemoveReadonly",[e],t)}function Ri(e,t={}){return xa(e,t)}function Xf(e){return p.Discard(e,["~optional"])}function ya(e,t){return p.Update(Xf(e),{},t)}function Oi(e,t,n,r){let a=d(e,t,n);return ya(a,r)}function Pi(e,t={}){return h("RemoveOptional",[e],t)}function fr(e,t={}){return ya(e,t)}function ha(e){return e.reduceRight((n,r,a)=>({[a]:r,...n}),{})}function Si(e){let t=ha(e.items);return $(t)}function Qf(e,t){return kt(e)?!!kt(t):!1}function eg(e,t){return ue(e)?!!ue(t):!1}function tg(e,t){let n=Qf(e,t),r=eg(e,t),a=G([e,t]),s=Ri(fr(a));return n&&r?vt(bt(s)):n&&!r?vt(s):!n&&r?bt(s):s}function ng(e,t,n){return n in e?n in t?tg(e[n],t[n]):e[n]:n in t?t[n]:L()}function rg(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((r,a)=>({...r,[a]:ng(e,t,a)}),{})}function Mi(e){return M(e)?e.properties:F(e)?ha(e.items):V()}function Ci(e,t){let n=Mi(e),r=Mi(t),a=rg(n,r);return $(a)}function Ai(e,t){let n=Dt(e,t);return i.IsEqual(n,$n)?e:i.IsEqual(n,Tn)||i.IsEqual(n,bn)?t:L()}function qi(e){return M(e)||F(e)}function ag(e,t){let n=y(e),r=y(t);return n||r}function og(e,t){let n=Pe(e),r=Pe(t),a=ag(n,r),s=qi(n),m=qi(r);return a?G([n,r]):s&&m?Ci(n,r):s&&!m?n:!s&&m?r:Ai(n,r)}function Li(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>Li(e,a,[...n,og(e,r)]),()=>i.IsEqual(n.length,0)?[e]:n)}function ji(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>ji(a,t,[...n,...vn([r],t)]),()=>n)}function vn(e,t=[]){return i.ShiftLeft(e,(n,r)=>y(n)?vn(r,ji(n.anyOf,t)):vn(r,Li(n,t)),()=>t)}function ig(e,t){let n=me({},e,t);return b.IsExtendsTrueLike(n)?[]:[e]}function sg(e,t){return e.reduce((n,r)=>[...n,...ig(r,t)],[])}function gr(e,t){let n=Pe(e),r=y(n)?n.anyOf:[n],a=sg(r,t);return be(a)}function je(e,t,n){let r=ce([e,t]),a=gr(n,e);return be([r,a])}function ke(e){let t=e.map(n=>O(n));return be(t)}function G(e){let t=vn(e),n=Ia(t);return Ze(n)}function he(e){let t=$i(e);return Pe(t)}function be(e){let t=Ia(e);return Ze(t)}function Pe(e){return z(e)?je(e.if,e.then,e.else):de(e)?ke(e.enum):R(e)?G(e.allOf):Z(e)?he(e.pattern):y(e)?be(e.anyOf):e}function Ze(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?L():k(e)}function Fi(e,t){let n=ke(e);return mt(n,t)}function Di(e,t){return ye(pt,t)}function Ni(e,t){let n=G(e);return mt(n,t)}function Ki(e,t){return i.IsString(e)||i.IsNumber(e)?$({[e]:t}):i.IsEqual(e,!1)?$({false:t}):i.IsEqual(e,!0)?$({true:t}):$({})}function Ui(e,t){return ye(Nt,t)}function Gi(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?ye(e.pattern.toString(),t):ye(Le,t)}function _i(e,t){let n=In(e);return lr(n)?mt(he(e),t):ye(e,t)}function mg(e){return y(e)?kn(e.anyOf):[e]}function kn(e){return e.reduce((t,n)=>[...t,...mg(n)],[])}function pg(e){return e.some(t=>ge(t)||J(t)||fe(t))}function ug(e,t){return i.IsEqual(pg(e),!0)?ye(Le,t):void 0}function cg(e,t){return e.reduce((n,r)=>C(r)&&(i.IsString(r.const)||i.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function lg(e,t){let n=cg(e,t);return $(n)}function zi(e,t){let n=kn(e),r=ug(n,t);return Q(r)?r:lg(n,t)}function mt(e,t){return Y(e)?Ti(t):Re(e)?vi(t):de(e)?Fi(e.enum,t):fe(e)?Di(e,t):R(e)?Ni(e.allOf,t):C(e)?Ki(e.const,t):J(e)?Ui(e,t):y(e)?zi(e.anyOf,t):ge(e)?Gi(e,t):Z(e)?_i(e.pattern,t):$({})}function ba(e,t,n){return v([e])?p.Update(mt(e,t),{},n):xr(e,t,n)}function Bi(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return ba(s,m,a)}var pt=`^${mr}$`,Nt=`^${ur}$`,Le=`^${cr}$`;function xr(e,t,n={}){return h("Record",[e,t],n)}function yr(e,t,n={}){return ba(e,t,n)}function Wi(e,t){return ye(e,t)}function hr(e){return i.IsEqual(e,Le)?Oe():i.IsEqual(e,pt)?Et():i.IsEqual(e,Nt)?Ie():ga(e)}function Se(e){return i.Keys(e.patternProperties)[0]}function Kt(e){let t=Se(e);return hr(t)}function xe(e){return e.patternProperties[Se(e)]}function pe(e){return x(e,"Record")}function Rt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function ut(e){return x(e,"Rest")}function Ir(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function br(e){return x(e,"This")}function Ut(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function Gt(e){return x(e,"Undefined")}function $r(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function ze(e){return x(e,"Void")}function fg(e,t){return i.IsEqual(e,"Array")?ve(t[0]):i.IsEqual(e,"Capitalize")?vr(t[0]):i.IsEqual(e,"ConstructorParameters")?Or(t[0]):i.IsEqual(e,"Evaluate")?Hm(t[0]):i.IsEqual(e,"Exclude")?Pr(t[0],t[1]):i.IsEqual(e,"Extract")?Sr(t[0],t[1]):i.IsEqual(e,"Index")?On(t[0],t[1]):i.IsEqual(e,"InstanceType")?Mr(t[0]):i.IsEqual(e,"Lowercase")?kr(t[0]):i.IsEqual(e,"NonNullable")?Cr(t[0]):i.IsEqual(e,"Omit")?Ar(t[0],t[1]):i.IsEqual(e,"Parameters")?qr(t[0]):i.IsEqual(e,"Partial")?Lr(t[0]):i.IsEqual(e,"Pick")?jr(t[0],t[1]):i.IsEqual(e,"Readonly")?Fr(t[0]):i.IsEqual(e,"KeyOf")?Pn(t[0]):i.IsEqual(e,"Record")?xr(t[0],t[1]):i.IsEqual(e,"Required")?Dr(t[0]):i.IsEqual(e,"ReturnType")?Nr(t[0]):i.IsEqual(e,"Uncapitalize")?Er(t[0]):i.IsEqual(e,"Uppercase")?wr(t[0]):Rn(Je(e),t)}function Ot(){throw Error("Unreachable")}var gg=(e,t=[])=>e.reduce((n,r)=>i.IsArray(r)&&i.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),Xe=e=>{let[t,n]=e;return gg([...t,...n])};function Zi(e){return wt(e[0],e[2],e[4])}function Xi(e){return wt(e[0],e[2],e[2])}function Qi(e){return wt(e[0],ae(),e[2])}function es(e){return wt(e,ae(),ae())}function ts(e){return Xe(e)}function ns(e){return e[1]}function rs(e){return Xe(e)}function as(e){return e[1]}function os(e){return fg(e[0],e[1])}function is(e){return null}function ss(e){return Oe()}function ms(e){return Ie()}function ps(e){return sr()}function us(e){return Ut()}function cs(e){return Lt()}function ls(e){return Et()}function ds(e){return yn()}function fs(e){return ae()}function gs(e){return At()}function xs(e){return $({})}function ys(e){return L()}function hs(e){return Ft()}function Is(e){return $r()}function bs(e){return Ir()}function $s(e){return O(BigInt(e))}function Ts(e){return O(i.IsEqual(e,"true"))}function vs(e){return O(parseFloat(e))}function ks(e){return O(e)}function Es(e){return e[1]}function ws(e){return O(e)}function Rs(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Os(e){return e[1]}function Ps(e){return Tr(e)}function Ss(e){return i.IsEqual(e.length,6)?$t(e[1],e[3],e[5]):$t(e[1],e[3],ae())}function Ms(e){return e.length>0}function Cs(e){return e.reduce((t,n)=>i.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function As(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function qs(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function Ls(e){return i.IsEqual(e.length,2)?e[1]:[]}function Vi(e,t){return t.reduce((n,r)=>{let a=r;return i.IsEqual(a.length,1)?On(n,a[0]):i.IsEqual(a.length,0)?ve(n):Ot()},e)}function Hi(e,t){return i.IsEqual(t.length,3)?Rr(e,t[0],t[1],t[2]):e}function xg(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:Kr(e,t)}function js(e){let[t,n,r,a,s]=e;return xg(Hi(t?Pn(Vi(n,r)):Vi(n,r),a),s)}function $a(e,t){return i.IsEqual(t.length,3)?(()=>{let[n,r,a]=t,s=$a(r,a);if(i.IsEqual(n,"&"))return R(s)?ce([e,...s.allOf]):ce([e,s]);if(i.IsEqual(n,"|"))return y(s)?k([e,...s.anyOf]):k([e,s]);Ot()})():e}function Fs(e){let[t,n]=e;return $a(t,n)}function Ds(e){let[t,n]=e;return $a(t,n)}function Ns(e){return Vm(e[1])}function Ks(e){return e[1]}function Us(e){return ot(e[0],e[2])}function Gs(e){return i.IsEqual(e.length,4)?fn(e[1],e[3]):i.IsEqual(e.length,2)?fn(e[1],ae()):Ot()}function _s(e){return`${e}`}function zs(e){return fe(e[3])?pt:J(e[3])?Nt:st(e[3])?Le:ge(e[3])?Le:Ot()}function Bs(e){return e.length>0}function Ws(e){return e.length>0}function Vs(e){let[t,n,r,a,s]=e;return{[n]:t&&r?Ge(Ne(s)):t&&!r?Ge(s):!t&&r?Ne(s):s}}function Hs(e){return Xe(e)}function Ys(e){return e.reduce((t,n)=>i.HasPropertyKey(n,pt)||i.HasPropertyKey(n,Nt)||i.HasPropertyKey(n,Le)?[t[0],p.Assign(t[1],n)]:[p.Assign(t[0],n),t[1]],[{},{}])}function Js(e){return Ys(e[1])}function Zs(e){let[t,n]=e,r=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return $(t,r)}function Xs(e){return i.IsEqual(e.length,5)?Ge(Ne(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?Ge(e[3]):Ne(e[3]):Ot()}function Qs(e){return Ge(Ne(e[1]))}function em(e){return Ge(e[1])}function tm(e){return Ne(e[0])}function nm(e){return i.IsEqual(e.length,2)?Rt(e[1]):i.IsEqual(e.length,1)?e[0]:Ot()}function rm(e){return Xe(e)}function am(e){return X(e[1])}function om(e){return Ge(Ne(e[4]))}function im(e){return Ge(e[3])}function sm(e){return Ne(e[3])}function mm(e){return e[2]}function pm(e){return i.IsEqual(e.length,2)?Rt(e[1]):i.IsEqual(e.length,1)?e[0]:Ot()}function um(e){return Xe(e)}function cm(e){return De(e[1],e[4])}function lm(e){return Fe(e[2],e[5])}function Yi(e,t){return i.IsEqual(e,"remove")?wi(t):i.IsEqual(e,"add")?Ge(t):t}function dm(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 Ji(e,t){return i.IsEqual(e,"remove")?Pi(t):i.IsEqual(e,"add")?Ne(t):t}function fm(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 gm(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function xm(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?En(hn(e[3]),e[5],e[6][0],Yi(e[1],Ji(e[8],e[10]))):En(hn(e[3]),e[5],Je(e[3]),Yi(e[1],Ji(e[8],e[10])))}function ym(e){return Je(e)}function hm(e){return BigInt(e)}function Im(e){return parseFloat(e)}function bm(e){return i.IsEqual(e,"true")}function $m(e){return null}function Tm(e){return{[e[0]]:e[2]}}function vm(e){return Xe(e)}function yg(e){return e.reduce((t,n)=>p.Assign(t,n),{})}function km(e){return yg(e[1])}function Em(e){return Xe(e)}function wm(e){return e[1]}function Rm(e){return yn()}function Om(e){return Oe()}function Pm(e){return Ie()}function Sm(e){return Et()}function Mm(e){return L()}function Cm(e){return O(e)}function Am(e){return k(e[1])}function qm(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Lm(e){return[e[0],...e[1]]}function jm(e){return e[1]}function Fm(e){return Xe(e)}function Dm(e){return i.IsEqual(e.length,2)?e[1]:[]}function Nm(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]]:ot(t,wn(n,r,s))}}function Km(e){let t=e[2],[n,r]=e[3],a=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:wn(t,n,a)}}function Um(e){return{[e[1]]:ot(e[2],e[4])}}function Gm(e){return{[e[1]]:e[3]}}function _m(e){return null}function zm(e){return Ys(Xe(e))}function Bm(e){return e[1]}function Wm(e){let t=e[0],n=e[1];return Ym(p.Assign(t,n[0]))}function Sn(e){return S(e.length,2)}function E(e,t,n){return Sn(e)?t(e[0],e[1]):n()}function bg(e,t){return S(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function _(e,t){for(let n=0;n<e.length;n++){let r=bg(e[n],t);if(Sn(r))return r}return[]}function Ta(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var Jm=[...Ta(97,122),...Ta(65,90)],va="0",ka=Ta(49,57),_t=[va,...ka],Zm=" ",zt=`
2
- `;var ct="_",Ur=".",Xm="$",Gr="-";var Qm="//",ep="/*",Tg="*/";function tp(e){let t=e.indexOf(Tg);return S(t,-1)?"":e.slice(t+2)}function np(e){let t=e.indexOf(zt);return S(t,-1)?"":e.slice(t)}function vg(e){return e.replace(/^[ \t\r\f\v]+/,"")}function _r(e){let t=vg(e);return t.startsWith(ep)?_r(tp(t.slice(2))):t.startsWith(Qm)?_r(np(t.slice(2))):t}function oe(e){let t=e.trimStart();return t.startsWith(ep)?oe(tp(t.slice(2))):t.startsWith(Qm)?oe(np(t.slice(2))):t}function zr(e,t){return E(_([e],t),(n,r)=>[n,r],()=>["",t])}function kg(e,t){return e.includes(t)}function Bt(e,t,n,r=""){return E(_(e,n),(a,s)=>kg(t,a)?Bt(e,t,s,r):Bt(e,t,s,`${r}${a}`),()=>[r,n])}function Eg(e){return _(ka,e)}var wg=[..._t,ct];function Rg(e){return Bt(wg,[ct],e)}function Og(e){return E(_([va],e),(t,n)=>[t,n],()=>E(Eg(e),(t,n)=>E(Rg(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[]))}function Br(e){return Og(oe(e))}function Pg(e){return zr(Gr,e)}function Sg(e){return E(Pg(e),(t,n)=>E(Br(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function rp(e){return Sg(oe(e))}function Mg(e){return E(rp(e),(t,n)=>E(_(["n"],n),(r,a)=>[`${t}`,a],()=>[]),()=>[])}function Ea(e){return Mg(e)}function wa(e,t){return _([e],t)}function u(e,t){return S(e,"")?["",t]:e.startsWith(zt)?wa(e,_r(t)):e.startsWith(Zm)?wa(e,t):wa(e,oe(t))}var ap=[...Jm,ct,Xm];function Cg(e){return _(ap,e)}var Ag=[...ap,..._t];function op(e,t=""){return E(_(Ag,e),(n,r)=>op(r,`${t}${n}`),()=>[t,e])}function qg(e){return E(Cg(e),(t,n)=>E(op(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function B(e){return qg(oe(e))}var Lg=[..._t,ct];function jg(e){return Sn(_([Ur],e))}function ip(e){return E(Bt(Lg,[ct],e),(t,n)=>S(t,"")?[]:[t,n],()=>[])}function Fg(e){return E(_([Ur],e),(t,n)=>E(ip(n),(r,a)=>[`0${t}${r}`,a],()=>[]),()=>[])}function Dg(e){return E(Br(e),(t,n)=>E(_([Ur],n),(r,a)=>E(ip(a),(s,m)=>[`${t}${r}${s}`,m],()=>[`${t}`,a]),()=>[`${t}`,n]),()=>[])}function Ng(e){return jg(e)?Fg(e):Dg(e)}function sp(e){return Ng(oe(e))}function Kg(e){return zr(Gr,e)}function Ug(e){return E(Kg(e),(t,n)=>E(sp(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function Wr(e){return Ug(oe(e))}function Gg(e){return S(e,"")?[]:[e.slice(0,1),e.slice(1)]}function mp(e,t){return er(e,(n,r)=>t.startsWith(n)?!0:mp(r,t),()=>!1)}function lt(e,t,n=""){return E(Gg(t),(r,a)=>mp(e,t)?[n,t]:lt(e,a,`${n}${r}`),()=>[])}function _g(e,t,n){return E(_([e],n),(r,a)=>E(lt([t],a),(s,m)=>E(_([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function zg(e,t,n){return E(_([e],n),(r,a)=>E(lt([zt,t],a),(s,m)=>E(_([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function pp(e,t,n,r){return n?_g(e,t,oe(r)):zg(e,t,oe(r))}function Bg(e,t){return _(e,t)}function Wg(e,t){return pp(e,e,!1,t)}function Vg(e,t){return E(Bg(e,t),(n,r)=>Wg(n,`${n}${r}`),()=>[])}function Vr(e,t){return Vg(e,oe(t))}function up(e,t){return E(lt(e,t),(n,r)=>S(n,"")?[]:[n,r],()=>[])}var o=(e,t,n=()=>[])=>e.length===2?t(e):n(),Yg=e=>o(o(B(e),([t,n])=>o(u("extends",n),([r,a])=>o(w(a),([s,m])=>o(u("=",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Zi(t),n]),Jg=e=>o(o(B(e),([t,n])=>o(u("extends",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Xi(t),n]),Zg=e=>o(o(B(e),([t,n])=>o(u("=",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Qi(t),n]),Xg=e=>o(B(e),([t,n])=>[es(t),n]),dp=e=>o(o(Yg(e),([t,n])=>[t,n],()=>o(Jg(e),([t,n])=>[t,n],()=>o(Zg(e),([t,n])=>[t,n],()=>o(Xg(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),fp=(e,t=[])=>o(o(dp(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>fp(r,[...t,n]),()=>[t,e]),Qg=e=>o(o(fp(e),([t,n])=>o(o(o(dp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[ts(t),n]),Pa=e=>o(o(u("<",e),([t,n])=>o(Qg(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[ns(t),n]),gp=(e,t=[])=>o(o(w(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>gp(r,[...t,n]),()=>[t,e]),ex=e=>o(o(gp(e),([t,n])=>o(o(o(w(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[rs(t),n]),tx=e=>o(o(u("<",e),([t,n])=>o(ex(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[as(t),n]),nx=e=>o(o(B(e),([t,n])=>o(tx(n),([r,a])=>[[t,r],a])),([t,n])=>[os(t),n]),xp=e=>o(o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[is(t),n]),yp=e=>o(u("string",e),([t,n])=>[ss(t),n]),hp=e=>o(u("number",e),([t,n])=>[ms(t),n]),rx=e=>o(u("boolean",e),([t,n])=>[ps(t),n]),ax=e=>o(u("undefined",e),([t,n])=>[us(t),n]),ox=e=>o(u("null",e),([t,n])=>[cs(t),n]),Ip=e=>o(u("integer",e),([t,n])=>[ls(t),n]),ix=e=>o(u("bigint",e),([t,n])=>[ds(t),n]),sx=e=>o(u("unknown",e),([t,n])=>[fs(t),n]),mx=e=>o(u("any",e),([t,n])=>[gs(t),n]),px=e=>o(u("object",e),([t,n])=>[xs(t),n]),ux=e=>o(u("never",e),([t,n])=>[ys(t),n]),bp=e=>o(u("symbol",e),([t,n])=>[hs(t),n]),cx=e=>o(u("void",e),([t,n])=>[Is(t),n]),lx=e=>o(u("this",e),([t,n])=>[bs(t),n]),dx=e=>o(o(u("${",e),([t,n])=>o(w(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Es(t),n]),Ra=e=>o(lt(["${","`"],e),([t,n])=>[ws(t),n]),$p=e=>o(o(o(Ra(e),([t,n])=>o(dx(n),([r,a])=>o($p(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(Ra(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(Ra(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[Rs(t),n]),Sa=e=>o(o(u("`",e),([t,n])=>o($p(n),([r,a])=>o(u("`",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Os(t),n]),fx=e=>o(Sa(e),([t,n])=>[Ps(t),n]),gx=e=>o(o(o(u("if",e),([t,n])=>o(w(n),([r,a])=>o(u("then",a),([s,m])=>o(w(m),([c,l])=>o(u("else",l),([I,f])=>o(w(f),([q,j])=>[[t,r,s,c,I,q],j])))))),([t,n])=>[t,n],()=>o(o(u("if",e),([t,n])=>o(w(n),([r,a])=>o(u("then",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[Ss(t),n]),xx=e=>o(Ea(e),([t,n])=>[$s(t),n]),yx=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[Ts(t),n]),hx=e=>o(Wr(e),([t,n])=>[vs(t),n]),Ix=e=>o(Vr(["'",'"'],e),([t,n])=>[ks(t),n]),bx=e=>o(o(o(u("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ms(t),n]),Tp=(e,t=[])=>o(o(o(u("[",e),([n,r])=>o(w(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])=>Tp(r,[...t,n]),()=>[t,e]),$x=e=>o(Tp(e),([t,n])=>[Cs(t),n]),Tx=e=>o(o(o(u("extends",e),([t,n])=>o(w(n),([r,a])=>o(u("?",a),([s,m])=>o(w(m),([c,l])=>o(u(":",l),([I,f])=>o(w(f),([q,j])=>[[t,r,s,c,I,q],j])))))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[As(t),n]),vx=e=>o(o(o(u("(",e),([t,n])=>o(w(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(yp(e),([t,n])=>[t,n],()=>o(hp(e),([t,n])=>[t,n],()=>o(rx(e),([t,n])=>[t,n],()=>o(ax(e),([t,n])=>[t,n],()=>o(ox(e),([t,n])=>[t,n],()=>o(Ip(e),([t,n])=>[t,n],()=>o(ix(e),([t,n])=>[t,n],()=>o(sx(e),([t,n])=>[t,n],()=>o(mx(e),([t,n])=>[t,n],()=>o(px(e),([t,n])=>[t,n],()=>o(ux(e),([t,n])=>[t,n],()=>o(bp(e),([t,n])=>[t,n],()=>o(cx(e),([t,n])=>[t,n],()=>o(lx(e),([t,n])=>[t,n],()=>o(xx(e),([t,n])=>[t,n],()=>o(yx(e),([t,n])=>[t,n],()=>o(hx(e),([t,n])=>[t,n],()=>o(Ix(e),([t,n])=>[t,n],()=>o(fx(e),([t,n])=>[t,n],()=>o(gx(e),([t,n])=>[t,n],()=>o(jx(e),([t,n])=>[t,n],()=>o(Gx(e),([t,n])=>[t,n],()=>o(Hx(e),([t,n])=>[t,n],()=>o(Vx(e),([t,n])=>[t,n],()=>o(Xx(e),([t,n])=>[t,n],()=>o(nx(e),([t,n])=>[t,n],()=>o(Qx(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[qs(t),n]),kx=e=>o(o(o(u("with",e),([t,n])=>o(Dp(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ls(t),n]),vp=e=>o(o(bx(e),([t,n])=>o(vx(n),([r,a])=>o($x(a),([s,m])=>o(Tx(m),([c,l])=>o(kx(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[js(t),n]),kp=e=>o(o(o(u("&",e),([t,n])=>o(vp(n),([r,a])=>o(kp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Ep=e=>o(o(vp(e),([t,n])=>o(kp(n),([r,a])=>[[t,r],a])),([t,n])=>[Fs(t),n]),wp=e=>o(o(o(u("|",e),([t,n])=>o(Ep(n),([r,a])=>o(wp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Hr=e=>o(o(Ep(e),([t,n])=>o(wp(n),([r,a])=>[[t,r],a])),([t,n])=>[Ds(t),n]),Ex=e=>o(o(u("readonly",e),([t,n])=>o(Hr(n),([r,a])=>[[t,r],a])),([t,n])=>[Ns(t),n]),wx=e=>o(o(u("|",e),([t,n])=>o(Hr(n),([r,a])=>[[t,r],a])),([t,n])=>[Ks(t),n]),Rx=e=>o(o(Pa(e),([t,n])=>o(u("=",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Us(t),n]),Ox=e=>o(o(o(u("infer",e),([t,n])=>o(B(n),([r,a])=>o(u("extends",a),([s,m])=>o(Hr(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(u("infer",e),([t,n])=>o(B(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>[])),([t,n])=>[Gs(t),n]),w=e=>o(o(Ox(e),([t,n])=>[t,n],()=>o(wx(e),([t,n])=>[t,n],()=>o(Ex(e),([t,n])=>[t,n],()=>o(Hr(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Px=e=>o(Wr(e),([t,n])=>[_s(t),n]),Sx=e=>o(B(e),([t,n])=>[t,n]),Mx=e=>o(Vr(["'",'"'],e),([t,n])=>[t,n]),Cx=e=>o(o(u("[",e),([t,n])=>o(B(n),([r,a])=>o(u(":",a),([s,m])=>o(o(Ip(m),([c,l])=>[c,l],()=>o(hp(m),([c,l])=>[c,l],()=>o(yp(m),([c,l])=>[c,l],()=>o(bp(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[zs(t),n]),Rp=e=>o(o(Px(e),([t,n])=>[t,n],()=>o(Sx(e),([t,n])=>[t,n],()=>o(Mx(e),([t,n])=>[t,n],()=>o(Cx(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Ax=e=>o(o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Bs(t),n]),qx=e=>o(o(o(u("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ws(t),n]),Op=e=>o(o(Ax(e),([t,n])=>o(Rp(n),([r,a])=>o(qx(a),([s,m])=>o(u(":",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Vs(t),n]),Pp=e=>o(o(o(u(",",e),([t,n])=>o(u(`
1
+ var Ad=Object.defineProperty;var yt=(e,t)=>{for(var n in t)Ad(e,n,{get:t[n],enumerable:!0})};import{Key as xb,Text as yb}from"@earendil-works/pi-tui";import{randomUUID as sb}from"node:crypto";import{copyFileSync as mb,existsSync as pb,mkdirSync as ub,rmSync as cb,writeFileSync as lb}from"node:fs";import{tmpdir as db}from"node:os";import{join as Wn}from"node:path";import{createAgentSession as xo,SessionManager as yo}from"@earendil-works/pi-coding-agent";var p={};yt(p,{Assign:()=>qd,Clone:()=>dn,Create:()=>Uf,Discard:()=>Gf,Metrics:()=>qe,Update:()=>_f});var qe={assign:0,create:0,clone:0,discard:0,update:0};function qd(e,t){return qe.assign+=1,{...e,...t}}var i={};yt(i,{Entries:()=>tf,EntriesRegExp:()=>ef,Every:()=>Zd,EveryAll:()=>Xd,GraphemeCount:()=>Hd,HasPropertyKey:()=>Qd,IsArray:()=>cn,IsBigInt:()=>un,IsBoolean:()=>Fo,IsClassInstance:()=>Vd,IsConstructor:()=>Kd,IsDeepEqual:()=>fa,IsEqual:()=>M,IsFunction:()=>Do,IsGreaterEqualThan:()=>Ko,IsGreaterThan:()=>_d,IsInteger:()=>la,IsLessEqualThan:()=>No,IsLessThan:()=>zd,IsMaxLength:()=>Yd,IsMinLength:()=>Jd,IsMultipleOf:()=>Bd,IsNull:()=>Zn,IsNumber:()=>Xn,IsObject:()=>ln,IsObjectNotArray:()=>Ud,IsString:()=>Qn,IsSymbol:()=>Gd,IsUndefined:()=>da,IsUnsafePropertyKey:()=>Uo,IsValueLike:()=>Wd,Keys:()=>Jn,ShiftLeft:()=>er,Symbols:()=>nf,Values:()=>rf});function It(e,t,n){return e>=t&&e<=n}function Ld(e){return e===8205}function jd(e){return It(e,55296,56319)}function Po(e){return It(e,127462,127487)}function Mo(e){return It(e,65024,65039)}function Co(e){return It(e,768,879)||It(e,6832,6911)||It(e,7616,7679)||It(e,65056,65071)}function Yn(e){return e>65535?2:1}function So(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(Co(n)||Mo(n))t+=Yn(n);else break}return t}function ca(e,t){let n=e.codePointAt(t),r=t+Yn(n);for(r=So(e,r);r<e.length-1&&e[r]==="\u200D";){let a=e.codePointAt(r+1);r+=1+Yn(a),r=So(e,r)}return Po(n)&&r<e.length&&Po(e.codePointAt(r))&&(r+=Yn(e.codePointAt(r))),r}function Ao(e){return jd(e)||Co(e)||Mo(e)||Ld(e)}function qo(e){let t=0,n=0;for(;n<e.length;)n=ca(e,n),t++;return t}function Fd(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=ca(e,r),n++,n>=t)return!0;return!1}function Dd(e,t){let n=0,r=0;for(;r<e.length;)if(r=ca(e,r),n++,n>t)return!1;return!0}function Lo(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(Ao(e.charCodeAt(n)))return Fd(e,t);if(n++,n>=t)return!0}return!1}function jo(e,t){let n=0;for(;n<e.length;){if(Ao(e.charCodeAt(n)))return Dd(e,t);if(n++,n>t)return!1}return!0}function cn(e){return Array.isArray(e)}function un(e){return M(typeof e,"bigint")}function Fo(e){return M(typeof e,"boolean")}function Kd(e){if(da(e)||!Do(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Do(e){return M(typeof e,"function")}function la(e){return Number.isInteger(e)}function Zn(e){return M(e,null)}function Xn(e){return Number.isFinite(e)}function Ud(e){return ln(e)&&!cn(e)}function ln(e){return M(typeof e,"object")&&!Zn(e)}function Qn(e){return M(typeof e,"string")}function Gd(e){return M(typeof e,"symbol")}function da(e){return M(e,void 0)}function M(e,t){return e===t}function _d(e,t){return e>t}function zd(e,t){return e<t}function No(e,t){return e<=t}function Ko(e,t){return e>=t}function Bd(e,t){if(un(e)||un(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!Xn(e)||la(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 Vd(e){if(!ln(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return Zn(t)?!1:M(typeof t.constructor,"function")&&!(M(t.constructor,globalThis.Object)||M(t.constructor.name,"Object"))}function Wd(e){return un(e)||Fo(e)||Zn(e)||Xn(e)||Qn(e)||da(e)}function Hd(e){return qo(e)}function Yd(e,t){return jo(e,t)}function Jd(e,t){return Lo(e,t)}function Zd(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function Xd(e,t,n){let r=!0;for(let a=t;a<e.length;a++)n(e[a],a)||(r=!1);return r}function er(e,t,n){return M(e.length,0)?n():t(e[0],e.slice(1))}function Uo(e){return M(e,"__proto__")||M(e,"constructor")||M(e,"prototype")}function Qd(e,t){return Uo(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function ef(e){return Jn(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function tf(e){return Object.entries(e)}function Jn(e){return Object.getOwnPropertyNames(e)}function nf(e){return Object.getOwnPropertySymbols(e)}function rf(e){return Object.values(e)}function af(e,t){if(!ln(t))return!1;let n=Jn(e);return M(n.length,Jn(t).length)&&n.every(r=>fa(e[r],t[r]))}function of(e,t){return cn(t)&&M(e.length,t.length)&&e.every((n,r)=>fa(e[r],t[r]))}function fa(e,t){return cn(e)?of(e,t):ln(e)?af(e,t):M(e,t)}var rt={};yt(rt,{IsBigInt64Array:()=>$f,IsBigUint64Array:()=>vf,IsBoolean:()=>mf,IsDate:()=>kf,IsFloat32Array:()=>If,IsFloat64Array:()=>bf,IsInt16Array:()=>gf,IsInt32Array:()=>xf,IsInt8Array:()=>lf,IsMap:()=>wf,IsNumber:()=>pf,IsRegExp:()=>Tf,IsSet:()=>Ef,IsString:()=>uf,IsTypeArray:()=>cf,IsUint16Array:()=>hf,IsUint32Array:()=>yf,IsUint8Array:()=>df,IsUint8ClampedArray:()=>ff});function mf(e){return e instanceof Boolean}function pf(e){return e instanceof Number}function uf(e){return e instanceof String}function cf(e){return globalThis.ArrayBuffer.isView(e)}function lf(e){return e instanceof globalThis.Int8Array}function df(e){return e instanceof globalThis.Uint8Array}function ff(e){return e instanceof globalThis.Uint8ClampedArray}function gf(e){return e instanceof globalThis.Int16Array}function hf(e){return e instanceof globalThis.Uint16Array}function xf(e){return e instanceof globalThis.Int32Array}function yf(e){return e instanceof globalThis.Uint32Array}function If(e){return e instanceof globalThis.Float32Array}function bf(e){return e instanceof globalThis.Float64Array}function $f(e){return e instanceof globalThis.BigInt64Array}function vf(e){return e instanceof globalThis.BigUint64Array}function Tf(e){return e instanceof globalThis.RegExp}function kf(e){return e instanceof globalThis.Date}function Ef(e){return e instanceof globalThis.Set}function wf(e){return e instanceof globalThis.Map}function Of(e){return i.HasPropertyKey(e,"~kind")||i.HasPropertyKey(e,"~unsafe")}function Pf(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:bt(a.value)})}return t}function Sf(e){let t={};for(let n of i.Keys(e))i.IsUnsafePropertyKey(n)||(t[n]=bt(e[n]));for(let n of i.Symbols(e))t[n]=bt(e[n]);return t}function Mf(e){return i.IsClassInstance(e)?e:Of(e)?Pf(e):Sf(e)}function Cf(e){return e.map(t=>bt(t))}function Af(e){return e.slice()}function qf(e){return new RegExp(e.source,e.flags)}function Lf(e){return new Map(bt([...e.entries()]))}function jf(e){return new Set(bt([...e.values()]))}function bt(e){return rt.IsTypeArray(e)?Af(e):rt.IsRegExp(e)?qf(e):rt.IsMap(e)?Lf(e):rt.IsSet(e)?jf(e):i.IsArray(e)?Cf(e):i.IsObject(e)?Mf(e):e}function dn(e){return qe.clone+=1,bt(e)}var $t={};yt($t,{Get:()=>Nf,Reset:()=>Ff,Set:()=>Df});var Ze={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Ff(){Ze.immutableTypes=!1,Ze.maxErrors=8,Ze.useAcceleration=!0,Ze.exactOptionalPropertyTypes=!1,Ze.enumerableKind=!1,Ze.correctiveParse=!1,Ze.unionPrioritySort=!0}function Df(e){for(let t of i.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(Ze,t,{value:n})}}function Nf(){return Ze}function Kf(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 Go(e,t){return{...e,...t}}function Uf(e,t,n={}){qe.create+=1;let r=$t.Get(),a=Go(t,n),s=r.enumerableKind?Go(a,e):Kf(a,e);return r.immutableTypes?Object.freeze(s):s}function Gf(e,t){qe.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(dn(e)),a=new Set(t);for(let s of Object.keys(r))a.has(s)||Object.defineProperty(n,s,r[s]);return n}function _f(e,t,n){qe.update+=1;let r=$t.Get(),a=dn(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 h(e,t){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],t)}function Q(e){return i.IsObject(e)}function y(e,t,n){return p.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function at(e){return h(e,"Deferred")}function zf(e){return p.Update(e,{"~readonly":!0},{})}function fn(e,t){return p.Update(zf(e),{},t)}function _o(e,t,n,r){let a=d(e,t,n);return fn(a,r)}function Bf(e){return p.Update(e,{"~optional":!0},{})}function gn(e,t){return p.Update(Bf(e),{},t)}function zo(e,t,n,r){let a=d(e,t,n);return gn(a,r)}function ke(e,t){return p.Create({"~kind":"Array"},{type:"array",items:e},t)}function U(e){return h(e,"Array")}function tr(e){return p.Discard(e,["~kind","type","items"])}function De(e,t,n={}){return p.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function ne(e){return h(e,"Constructor")}function Bo(e){return p.Discard(e,["~kind","type","parameters","instanceType"])}function Ne(e,t,n={}){return p.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function re(e){return h(e,"Function")}function Vo(e){return p.Discard(e,["~kind","type","parameters","returnType"])}function Xe(e,t){return p.Create({"~kind":"Ref"},{$ref:e},t)}function ae(e){return h(e,"Ref")}function ot(e,t){return p.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function qt(e){return h(e,"Generic")}function Lt(e){return p.Create({"~kind":"Any"},{},e)}function Y(e){return h(e,"Any")}var Wo="(?!)";function L(e){return p.Create({"~kind":"Never"},{not:{}},e)}function it(e){return h(e,"Never")}function Ke(e,t={}){return y("AddOptional",[e],t)}function vt(e,t={}){return gn(e,t)}function Ho(e){return vt(e)}function ce(e){return Q(e)&&i.HasPropertyKey(e,"~optional")}function Yo(e){return i.Keys(e).filter(t=>!ce(e[t]))}function nr(e){return i.Keys(e)}function rr(e){return i.Values(e)}function $(e,t={}){let n=Yo(e),r=n.length>0?{required:n}:{};return p.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function C(e){return h(e,"Object")}function Jo(e){return p.Discard(e,["~kind","type","properties","required"])}function oe(e){return p.Create({"~kind":"Unknown"},{},e)}function ee(e){return h(e,"Unknown")}function Ue(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 me(e){return h(e,"Cyclic")}function Zo(e){return p.Update(e,{"~unsafe":null},{})}function ar(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"~unsafe")&&i.IsNull(e["~unsafe"])}var Ge={};yt(Ge,{Match:()=>Vf});function Vf(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function hn(...e){let[t,n]=Ge.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 V(e){return h(e,"Infer")}function Tt(e,t,n,r={}){return p.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function z(e){return h(e,"Dependent")}function Xo(e){return p.Discard(e,["~kind","if","then","else"])}function Qo(e){return i.IsObjectNotArray(e)}function ei(e){return i.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function ti(e){return i.IsString(e)||i.IsNumber(e)}function ni(e,t){let n=Qo(e)?ei(e):e;return p.Create({"~kind":"Enum"},{enum:n},t)}function de(e){return h(e,"Enum")}function le(e,t={}){return p.Create({"~kind":"Intersect"},{allOf:e},t)}function R(e){return h(e,"Intersect")}function ri(e){return p.Discard(e,["~kind","allOf"])}function W(){throw new Error("Unreachable")}var ai;(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"})(ai||(ai={}));var Ev=BigInt("14695981039346656037"),[wv,Rv]=[BigInt("1099511628211"),BigInt("18446744073709551616")],Ov=Array.from({length:256}).map((e,t)=>BigInt(t)),oi=new Float64Array(1),Pv=new DataView(oi.buffer),Sv=new Uint8Array(oi.buffer);var Mv=new TextEncoder;var xn=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=or(n)?m=>this.decode(n["~codec"].decode(m)):this.decode,a=or(n)?m=>n["~codec"].encode(t(m)):t,s={decode:r,encode:a};return p.Update(this.type,{"~codec":s},{})}},yn=class{constructor(t){this.type=t}Decode(t){return new xn(this.type,t)}};function ir(e){return new yn(e)}function si(e,t){return ir(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function mi(e,t){return ir(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function or(e){return Q(e)&&i.HasPropertyKey(e,"~codec")&&i.IsObject(e["~codec"])&&i.HasPropertyKey(e["~codec"],"encode")&&i.HasPropertyKey(e["~codec"],"decode")}function pi(e){return jt(e)}function kt(e){return Q(e)&&i.HasPropertyKey(e,"~immutable")}function _e(e,t={}){return y("AddReadonly",[e],t)}function Et(e,t={}){return fn(e,t)}function ui(e){return Et(e)}function wt(e){return Q(e)&&i.HasPropertyKey(e,"~readonly")}function Jf(e,t){let n=ga(e)?[...e["~refine"],t]:[t];return p.Update(e,{"~refine":n},{})}function ci(...e){let[t,n,r]=Ge.Match(e,{3:(a,s,m)=>[a,s,m],2:(a,s)=>[a,s,()=>"Refine Error"]});return Jf(t,{check:n,error:r})}function Zf(e){return i.IsObjectNotArray(e)&&i.HasPropertyKey(e,"check")&&i.HasPropertyKey(e,"error")&&i.IsFunction(e.check)&&i.IsFunction(e.error)}function ga(e){return Q(e)&&i.HasPropertyKey(e,"~refine")&&i.IsArray(e["~refine"])&&i.Every(e["~refine"],0,t=>Zf(t))}var li="-?(?:0|[1-9][0-9]*)n";function In(e){return p.Create({"~kind":"BigInt"},{type:"bigint"},e)}function ze(e){return h(e,"BigInt")}function sr(e){return p.Create({"~kind":"Boolean"},{type:"boolean"},e)}function Se(e){return h(e,"Boolean")}function bn(e){return p.Create({"~kind":"Identifier"},{name:e})}function di(e){return h(e,"Identifier")}var mr="-?(?:0|[1-9][0-9]*)";function Rt(e){return p.Create({"~kind":"Integer"},{type:"integer"},e)}function fe(e){return h(e,"Integer")}var ha=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function Xf(e){return i.IsBigInt(e)?"bigint":i.IsBoolean(e)?"boolean":i.IsNumber(e)?"number":i.IsString(e)?"string":(()=>{throw new ha(e)})()}function O(e,t){return p.Create({"~kind":"Literal"},{type:Xf(e),const:e},t)}function pr(e){return i.IsBigInt(e)||i.IsBoolean(e)||i.IsNumber(e)||i.IsString(e)}function fi(e){return A(e)&&i.IsNumber(e.const)}function gi(e){return A(e)&&i.IsString(e.const)}function A(e){return h(e,"Literal")}function Ft(e){return p.Create({"~kind":"Null"},{type:"null"},e)}function Dt(e){return h(e,"Null")}var ur="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Ie(e){return p.Create({"~kind":"Number"},{type:"number"},e)}function J(e){return h(e,"Number")}function Nt(e){return p.Create({"~kind":"Symbol"},{type:"symbol"},e)}function st(e){return h(e,"Symbol")}function Ot(...e){let[t,n,r]=Ge.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 hi(e){return h(e,"Parameter")}var cr=".*";function Me(e){return p.Create({"~kind":"String"},{type:"string"},e)}function ge(e){return h(e,"String")}function k(e,t={}){return p.Create({"~kind":"Union"},{anyOf:e},t)}function x(e){return h(e,"Union")}function xi(e){return p.Discard(e,["~kind","anyOf"])}function $n(e){let t=yi(e);return i.IsEqual(t.length,2)?t[0]:[]}function Qf(e){return!0}function Ii(e){return i.ShiftLeft(e,(t,n)=>eg(t)?Ii(n):!1,()=>!0)}function bi(e){return i.IsEqual(e.length,0)?!1:Ii(e)}function eg(e){return x(e)?bi(e.anyOf):A(e)?Qf(e.const):!1}function lr(e){return bi(e)}function dr(e){return p.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function $i(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>$i(a,t,[...n,`${r}${t}`]),()=>n)}function tg(e,t){return i.IsEqual(e.length,0)?[`${t}`]:$i(e,t)}function vi(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>vi(e,a,[...n,...Ti(e,r)]),()=>n)}function Ti(e,t){return x(t)?vi(e,t.anyOf):A(t)?tg(e,t.const):W()}function ki(e,t){return i.ShiftLeft(t,(n,r)=>ki(Ti(e,n),r),()=>e)}function ng(e){return e.map(t=>O(t))}function rg(e){let t=ki([],e),n=ng(t);return k(n)}function ag(e){return i.IsEqual(e.length,0)?W():i.IsEqual(e.length,1)&&A(e[0])?e[0]:rg(e)}function xa(e){let t=$n(e);return i.IsEqual(t.length,0)?Me():lr(t)?ag(t):dr(e)}function Ei(e){let t=xa(e);return Z(t)?Me():t}function xe(e,t){let n="object",r={[e]:t};return p.Create({"~kind":"Record"},{type:n,patternProperties:r})}function wi(e){return xe(Le,e)}function Ri(e){return $({true:e,false:e})}function X(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 h(e,"Tuple")}function Oi(e){return p.Discard(e,["~kind","type","items","minItems","additionalItems"])}function og(e){return p.Discard(e,["~readonly"])}function ya(e,t){return p.Update(og(e),{},t)}function Pi(e,t,n,r){let a=d(e,t,n);return ya(a,r)}function Si(e,t={}){return y("RemoveReadonly",[e],t)}function Mi(e,t={}){return ya(e,t)}function ig(e){return p.Discard(e,["~optional"])}function Ia(e,t){return p.Update(ig(e),{},t)}function Ci(e,t,n,r){let a=d(e,t,n);return Ia(a,r)}function Ai(e,t={}){return y("RemoveOptional",[e],t)}function fr(e,t={}){return Ia(e,t)}function ba(e){return e.reduceRight((n,r,a)=>({[a]:r,...n}),{})}function qi(e){let t=ba(e.items);return $(t)}function sg(e,t){return wt(e)?!!wt(t):!1}function mg(e,t){return ce(e)?!!ce(t):!1}function pg(e,t){let n=sg(e,t),r=mg(e,t),a=G([e,t]),s=Mi(fr(a));return n&&r?Et(vt(s)):n&&!r?Et(s):!n&&r?vt(s):s}function ug(e,t,n){return n in e?n in t?pg(e[n],t[n]):e[n]:n in t?t[n]:L()}function cg(e,t){return[...new Set([...i.Keys(t),...i.Keys(e)])].reduce((r,a)=>({...r,[a]:ug(e,t,a)}),{})}function Li(e){return C(e)?e.properties:j(e)?ba(e.items):W()}function ji(e,t){let n=Li(e),r=Li(t),a=cg(n,r);return $(a)}function Fi(e,t){let n=Kt(e,t);return i.IsEqual(n,Tn)?e:i.IsEqual(n,kn)||i.IsEqual(n,vn)?t:L()}function Di(e){return C(e)||j(e)}function lg(e,t){let n=x(e),r=x(t);return n||r}function dg(e,t){let n=Ce(e),r=Ce(t),a=lg(n,r),s=Di(n),m=Di(r);return a?G([n,r]):s&&m?ji(n,r):s&&!m?n:!s&&m?r:Fi(n,r)}function Ni(e,t,n=[]){return i.ShiftLeft(t,(r,a)=>Ni(e,a,[...n,dg(e,r)]),()=>i.IsEqual(n.length,0)?[e]:n)}function Ki(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>Ki(a,t,[...n,...En([r],t)]),()=>n)}function En(e,t=[]){return i.ShiftLeft(e,(n,r)=>x(n)?En(r,Ki(n.anyOf,t)):En(r,Ni(n,t)),()=>t)}function fg(e,t){let n=pe({},e,t);return b.IsExtendsTrueLike(n)?[]:[e]}function gg(e,t){return e.reduce((n,r)=>[...n,...fg(r,t)],[])}function gr(e,t){let n=Ce(e),r=x(n)?n.anyOf:[n],a=gg(r,t);return be(a)}function je(e,t,n){let r=le([e,t]),a=gr(n,e);return be([r,a])}function Ee(e){let t=e.map(n=>O(n));return be(t)}function G(e){let t=En(e),n=$a(t);return Qe(n)}function ye(e){let t=Ei(e);return Ce(t)}function be(e){let t=$a(e);return Qe(t)}function Ce(e){return z(e)?je(e.if,e.then,e.else):de(e)?Ee(e.enum):R(e)?G(e.allOf):Z(e)?ye(e.pattern):x(e)?be(e.anyOf):e}function Qe(e){return i.IsEqual(e.length,1)?e[0]:i.IsEqual(e.length,0)?L():k(e)}function Ui(e,t){let n=Ee(e);return mt(n,t)}function Gi(e,t){return xe(pt,t)}function _i(e,t){let n=G(e);return mt(n,t)}function zi(e,t){return i.IsString(e)||i.IsNumber(e)?$({[e]:t}):i.IsEqual(e,!1)?$({false:t}):i.IsEqual(e,!0)?$({true:t}):$({})}function Bi(e,t){return xe(Ut,t)}function Vi(e,t){return i.HasPropertyKey(e,"pattern")&&(i.IsString(e.pattern)||e.pattern instanceof RegExp)?xe(e.pattern.toString(),t):xe(Le,t)}function Wi(e,t){let n=$n(e);return lr(n)?mt(ye(e),t):xe(e,t)}function hg(e){return x(e)?wn(e.anyOf):[e]}function wn(e){return e.reduce((t,n)=>[...t,...hg(n)],[])}function xg(e){return e.some(t=>ge(t)||J(t)||fe(t))}function yg(e,t){return i.IsEqual(xg(e),!0)?xe(Le,t):void 0}function Ig(e,t){return e.reduce((n,r)=>A(r)&&(i.IsString(r.const)||i.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function bg(e,t){let n=Ig(e,t);return $(n)}function Hi(e,t){let n=wn(e),r=yg(n,t);return Q(r)?r:bg(n,t)}function mt(e,t){return Y(e)?wi(t):Se(e)?Ri(t):de(e)?Ui(e.enum,t):fe(e)?Gi(e,t):R(e)?_i(e.allOf,t):A(e)?zi(e.const,t):J(e)?Bi(e,t):x(e)?Hi(e.anyOf,t):ge(e)?Vi(e,t):Z(e)?Wi(e.pattern,t):$({})}function va(e,t,n){return T([e])?p.Update(mt(e,t),{},n):hr(e,t,n)}function Yi(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return va(s,m,a)}var pt=`^${mr}$`,Ut=`^${ur}$`,Le=`^${cr}$`;function hr(e,t,n={}){return y("Record",[e,t],n)}function xr(e,t,n={}){return va(e,t,n)}function Ji(e,t){return xe(e,t)}function yr(e){return i.IsEqual(e,Le)?Me():i.IsEqual(e,pt)?Rt():i.IsEqual(e,Ut)?Ie():xa(e)}function Ae(e){return i.Keys(e.patternProperties)[0]}function Gt(e){let t=Ae(e);return yr(t)}function he(e){return e.patternProperties[Ae(e)]}function ue(e){return h(e,"Record")}function Pt(e){return p.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function ut(e){return h(e,"Rest")}function Ir(e){return p.Create({"~kind":"This"},{$ref:"#"},e)}function br(e){return h(e,"This")}function _t(e){return p.Create({"~kind":"Undefined"},{type:"undefined"},e)}function zt(e){return h(e,"Undefined")}function $r(e){return p.Create({"~kind":"Void"},{type:"void"},e)}function Be(e){return h(e,"Void")}function vg(e,t){return i.IsEqual(e,"Array")?ke(t[0]):i.IsEqual(e,"Capitalize")?Tr(t[0]):i.IsEqual(e,"ConstructorParameters")?Or(t[0]):i.IsEqual(e,"Evaluate")?Xm(t[0]):i.IsEqual(e,"Exclude")?Pr(t[0],t[1]):i.IsEqual(e,"Extract")?Sr(t[0],t[1]):i.IsEqual(e,"Index")?Sn(t[0],t[1]):i.IsEqual(e,"InstanceType")?Mr(t[0]):i.IsEqual(e,"Lowercase")?kr(t[0]):i.IsEqual(e,"NonNullable")?Cr(t[0]):i.IsEqual(e,"Omit")?Ar(t[0],t[1]):i.IsEqual(e,"Parameters")?qr(t[0]):i.IsEqual(e,"Partial")?Lr(t[0]):i.IsEqual(e,"Pick")?jr(t[0],t[1]):i.IsEqual(e,"Readonly")?Fr(t[0]):i.IsEqual(e,"KeyOf")?Mn(t[0]):i.IsEqual(e,"Record")?hr(t[0],t[1]):i.IsEqual(e,"Required")?Dr(t[0]):i.IsEqual(e,"ReturnType")?Nr(t[0]):i.IsEqual(e,"Uncapitalize")?Er(t[0]):i.IsEqual(e,"Uppercase")?wr(t[0]):Pn(Xe(e),t)}function St(){throw Error("Unreachable")}var Tg=(e,t=[])=>e.reduce((n,r)=>i.IsArray(r)&&i.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),et=e=>{let[t,n]=e;return Tg([...t,...n])};function ts(e){return Ot(e[0],e[2],e[4])}function ns(e){return Ot(e[0],e[2],e[2])}function rs(e){return Ot(e[0],oe(),e[2])}function as(e){return Ot(e,oe(),oe())}function os(e){return et(e)}function is(e){return e[1]}function ss(e){return et(e)}function ms(e){return e[1]}function ps(e){return vg(e[0],e[1])}function us(e){return null}function cs(e){return Me()}function ls(e){return Ie()}function ds(e){return sr()}function fs(e){return _t()}function gs(e){return Ft()}function hs(e){return Rt()}function xs(e){return In()}function ys(e){return oe()}function Is(e){return Lt()}function bs(e){return $({})}function $s(e){return L()}function vs(e){return Nt()}function Ts(e){return $r()}function ks(e){return Ir()}function Es(e){return O(BigInt(e))}function ws(e){return O(i.IsEqual(e,"true"))}function Rs(e){return O(parseFloat(e))}function Os(e){return O(e)}function Ps(e){return e[1]}function Ss(e){return O(e)}function Ms(e){return i.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function Cs(e){return e[1]}function As(e){return vr(e)}function qs(e){return i.IsEqual(e.length,6)?Tt(e[1],e[3],e[5]):Tt(e[1],e[3],oe())}function Ls(e){return e.length>0}function js(e){return e.reduce((t,n)=>i.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function Fs(e){return i.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Ds(e){return i.IsArray(e)&&i.IsEqual(e.length,3)?e[1]:e}function Ns(e){return i.IsEqual(e.length,2)?e[1]:[]}function Zi(e,t){return t.reduce((n,r)=>{let a=r;return i.IsEqual(a.length,1)?Sn(n,a[0]):i.IsEqual(a.length,0)?ke(n):St()},e)}function Xi(e,t){return i.IsEqual(t.length,3)?Rr(e,t[0],t[1],t[2]):e}function kg(e,t){return i.IsArray(t)&&i.IsEqual(t.length,0)?e:Kr(e,t)}function Ks(e){let[t,n,r,a,s]=e;return kg(Xi(t?Mn(Zi(n,r)):Zi(n,r),a),s)}function Ta(e,t){return i.IsEqual(t.length,3)?(()=>{let[n,r,a]=t,s=Ta(r,a);if(i.IsEqual(n,"&"))return R(s)?le([e,...s.allOf]):le([e,s]);if(i.IsEqual(n,"|"))return x(s)?k([e,...s.anyOf]):k([e,s]);St()})():e}function Us(e){let[t,n]=e;return Ta(t,n)}function Gs(e){let[t,n]=e;return Ta(t,n)}function _s(e){return Zm(e[1])}function zs(e){return e[1]}function Bs(e){return ot(e[0],e[2])}function Vs(e){return i.IsEqual(e.length,4)?hn(e[1],e[3]):i.IsEqual(e.length,2)?hn(e[1],oe()):St()}function Ws(e){return`${e}`}function Hs(e){return fe(e[3])?pt:J(e[3])?Ut:st(e[3])?Le:ge(e[3])?Le:St()}function Ys(e){return e.length>0}function Js(e){return e.length>0}function Zs(e){let[t,n,r,a,s]=e;return{[n]:t&&r?_e(Ke(s)):t&&!r?_e(s):!t&&r?Ke(s):s}}function Xs(e){return et(e)}function Qs(e){return e.reduce((t,n)=>i.HasPropertyKey(n,pt)||i.HasPropertyKey(n,Ut)||i.HasPropertyKey(n,Le)?[t[0],p.Assign(t[1],n)]:[p.Assign(t[0],n),t[1]],[{},{}])}function em(e){return Qs(e[1])}function tm(e){let[t,n]=e,r=i.IsEqual(i.Keys(n).length,0)?{}:{patternProperties:n};return $(t,r)}function nm(e){return i.IsEqual(e.length,5)?_e(Ke(e[4])):i.IsEqual(e.length,3)?e[2]:i.IsEqual(e.length,4)?i.IsEqual(e[2],"readonly")?_e(e[3]):Ke(e[3]):St()}function rm(e){return _e(Ke(e[1]))}function am(e){return _e(e[1])}function om(e){return Ke(e[0])}function im(e){return i.IsEqual(e.length,2)?Pt(e[1]):i.IsEqual(e.length,1)?e[0]:St()}function sm(e){return et(e)}function mm(e){return X(e[1])}function pm(e){return _e(Ke(e[4]))}function um(e){return _e(e[3])}function cm(e){return Ke(e[3])}function lm(e){return e[2]}function dm(e){return i.IsEqual(e.length,2)?Pt(e[1]):i.IsEqual(e.length,1)?e[0]:St()}function fm(e){return et(e)}function gm(e){return Ne(e[1],e[4])}function hm(e){return De(e[2],e[5])}function Qi(e,t){return i.IsEqual(e,"remove")?Si(t):i.IsEqual(e,"add")?_e(t):t}function xm(e){return i.IsEqual(e.length,2)&&i.IsEqual(e[0],"-")?"remove":i.IsEqual(e.length,2)&&i.IsEqual(e[0],"+")||i.IsEqual(e.length,1)?"add":"none"}function es(e,t){return i.IsEqual(e,"remove")?Ai(t):i.IsEqual(e,"add")?Ke(t):t}function ym(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 Im(e){return i.IsEqual(e.length,2)?[e[1]]:[]}function bm(e){return i.IsArray(e[6])&&i.IsEqual(e[6].length,1)?Rn(bn(e[3]),e[5],e[6][0],Qi(e[1],es(e[8],e[10]))):Rn(bn(e[3]),e[5],Xe(e[3]),Qi(e[1],es(e[8],e[10])))}function $m(e){return Xe(e)}function vm(e){return BigInt(e)}function Tm(e){return parseFloat(e)}function km(e){return i.IsEqual(e,"true")}function Em(e){return null}function wm(e){return{[e[0]]:e[2]}}function Rm(e){return et(e)}function Eg(e){return e.reduce((t,n)=>p.Assign(t,n),{})}function Om(e){return Eg(e[1])}function Pm(e){return et(e)}function Sm(e){return e[1]}function Mm(e){return In()}function Cm(e){return Me()}function Am(e){return Ie()}function qm(e){return Rt()}function Lm(e){return L()}function jm(e){return O(e)}function Fm(e){return k(e[1])}function Dm(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Nm(e){return[e[0],...e[1]]}function Km(e){return e[1]}function Um(e){return et(e)}function Gm(e){return i.IsEqual(e.length,2)?e[1]:[]}function _m(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]]:ot(t,On(n,r,s))}}function zm(e){let t=e[2],[n,r]=e[3],a=i.IsEqual(i.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:On(t,n,a)}}function Bm(e){return{[e[1]]:ot(e[2],e[4])}}function Vm(e){return{[e[1]]:e[3]}}function Wm(e){return null}function Hm(e){return Qs(et(e))}function Ym(e){return e[1]}function Jm(e){let t=e[0],n=e[1];return Qm(p.Assign(t,n[0]))}function Cn(e){return M(e.length,2)}function E(e,t,n){return Cn(e)?t(e[0],e[1]):n()}function Og(e,t){return M(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function _(e,t){for(let n=0;n<e.length;n++){let r=Og(e[n],t);if(Cn(r))return r}return[]}function ka(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var ep=[...ka(97,122),...ka(65,90)],Ea="0",wa=ka(49,57),Bt=[Ea,...wa],tp=" ",Vt=`
2
+ `;var ct="_",Ur=".",np="$",Gr="-";var rp="//",ap="/*",Sg="*/";function op(e){let t=e.indexOf(Sg);return M(t,-1)?"":e.slice(t+2)}function ip(e){let t=e.indexOf(Vt);return M(t,-1)?"":e.slice(t)}function Mg(e){return e.replace(/^[ \t\r\f\v]+/,"")}function _r(e){let t=Mg(e);return t.startsWith(ap)?_r(op(t.slice(2))):t.startsWith(rp)?_r(ip(t.slice(2))):t}function ie(e){let t=e.trimStart();return t.startsWith(ap)?ie(op(t.slice(2))):t.startsWith(rp)?ie(ip(t.slice(2))):t}function zr(e,t){return E(_([e],t),(n,r)=>[n,r],()=>["",t])}function Cg(e,t){return e.includes(t)}function Wt(e,t,n,r=""){return E(_(e,n),(a,s)=>Cg(t,a)?Wt(e,t,s,r):Wt(e,t,s,`${r}${a}`),()=>[r,n])}function Ag(e){return _(wa,e)}var qg=[...Bt,ct];function Lg(e){return Wt(qg,[ct],e)}function jg(e){return E(_([Ea],e),(t,n)=>[t,n],()=>E(Ag(e),(t,n)=>E(Lg(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[]))}function Br(e){return jg(ie(e))}function Fg(e){return zr(Gr,e)}function Dg(e){return E(Fg(e),(t,n)=>E(Br(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function sp(e){return Dg(ie(e))}function Ng(e){return E(sp(e),(t,n)=>E(_(["n"],n),(r,a)=>[`${t}`,a],()=>[]),()=>[])}function Ra(e){return Ng(e)}function Oa(e,t){return _([e],t)}function u(e,t){return M(e,"")?["",t]:e.startsWith(Vt)?Oa(e,_r(t)):e.startsWith(tp)?Oa(e,t):Oa(e,ie(t))}var mp=[...ep,ct,np];function Kg(e){return _(mp,e)}var Ug=[...mp,...Bt];function pp(e,t=""){return E(_(Ug,e),(n,r)=>pp(r,`${t}${n}`),()=>[t,e])}function Gg(e){return E(Kg(e),(t,n)=>E(pp(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function B(e){return Gg(ie(e))}var _g=[...Bt,ct];function zg(e){return Cn(_([Ur],e))}function up(e){return E(Wt(_g,[ct],e),(t,n)=>M(t,"")?[]:[t,n],()=>[])}function Bg(e){return E(_([Ur],e),(t,n)=>E(up(n),(r,a)=>[`0${t}${r}`,a],()=>[]),()=>[])}function Vg(e){return E(Br(e),(t,n)=>E(_([Ur],n),(r,a)=>E(up(a),(s,m)=>[`${t}${r}${s}`,m],()=>[`${t}`,a]),()=>[`${t}`,n]),()=>[])}function Wg(e){return zg(e)?Bg(e):Vg(e)}function cp(e){return Wg(ie(e))}function Hg(e){return zr(Gr,e)}function Yg(e){return E(Hg(e),(t,n)=>E(cp(n),(r,a)=>[`${t}${r}`,a],()=>[]),()=>[])}function Vr(e){return Yg(ie(e))}function Jg(e){return M(e,"")?[]:[e.slice(0,1),e.slice(1)]}function lp(e,t){return er(e,(n,r)=>t.startsWith(n)?!0:lp(r,t),()=>!1)}function lt(e,t,n=""){return E(Jg(t),(r,a)=>lp(e,t)?[n,t]:lt(e,a,`${n}${r}`),()=>[])}function Zg(e,t,n){return E(_([e],n),(r,a)=>E(lt([t],a),(s,m)=>E(_([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function Xg(e,t,n){return E(_([e],n),(r,a)=>E(lt([Vt,t],a),(s,m)=>E(_([t],m),(c,l)=>[`${s}`,l],()=>[]),()=>[]),()=>[])}function dp(e,t,n,r){return n?Zg(e,t,ie(r)):Xg(e,t,ie(r))}function Qg(e,t){return _(e,t)}function eh(e,t){return dp(e,e,!1,t)}function th(e,t){return E(Qg(e,t),(n,r)=>eh(n,`${n}${r}`),()=>[])}function Wr(e,t){return th(e,ie(t))}function fp(e,t){return E(lt(e,t),(n,r)=>M(n,"")?[]:[n,r],()=>[])}var o=(e,t,n=()=>[])=>e.length===2?t(e):n(),rh=e=>o(o(B(e),([t,n])=>o(u("extends",n),([r,a])=>o(w(a),([s,m])=>o(u("=",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[ts(t),n]),ah=e=>o(o(B(e),([t,n])=>o(u("extends",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[ns(t),n]),oh=e=>o(o(B(e),([t,n])=>o(u("=",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[rs(t),n]),ih=e=>o(B(e),([t,n])=>[as(t),n]),xp=e=>o(o(rh(e),([t,n])=>[t,n],()=>o(ah(e),([t,n])=>[t,n],()=>o(oh(e),([t,n])=>[t,n],()=>o(ih(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),yp=(e,t=[])=>o(o(xp(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>yp(r,[...t,n]),()=>[t,e]),sh=e=>o(o(yp(e),([t,n])=>o(o(o(xp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[os(t),n]),Ma=e=>o(o(u("<",e),([t,n])=>o(sh(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[is(t),n]),Ip=(e,t=[])=>o(o(w(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Ip(r,[...t,n]),()=>[t,e]),mh=e=>o(o(Ip(e),([t,n])=>o(o(o(w(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[ss(t),n]),ph=e=>o(o(u("<",e),([t,n])=>o(mh(n),([r,a])=>o(u(">",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[ms(t),n]),uh=e=>o(o(B(e),([t,n])=>o(ph(n),([r,a])=>[[t,r],a])),([t,n])=>[ps(t),n]),bp=e=>o(o(o(u(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[us(t),n]),$p=e=>o(u("string",e),([t,n])=>[cs(t),n]),vp=e=>o(u("number",e),([t,n])=>[ls(t),n]),ch=e=>o(u("boolean",e),([t,n])=>[ds(t),n]),lh=e=>o(u("undefined",e),([t,n])=>[fs(t),n]),dh=e=>o(u("null",e),([t,n])=>[gs(t),n]),Tp=e=>o(u("integer",e),([t,n])=>[hs(t),n]),fh=e=>o(u("bigint",e),([t,n])=>[xs(t),n]),gh=e=>o(u("unknown",e),([t,n])=>[ys(t),n]),hh=e=>o(u("any",e),([t,n])=>[Is(t),n]),xh=e=>o(u("object",e),([t,n])=>[bs(t),n]),yh=e=>o(u("never",e),([t,n])=>[$s(t),n]),kp=e=>o(u("symbol",e),([t,n])=>[vs(t),n]),Ih=e=>o(u("void",e),([t,n])=>[Ts(t),n]),bh=e=>o(u("this",e),([t,n])=>[ks(t),n]),$h=e=>o(o(u("${",e),([t,n])=>o(w(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Ps(t),n]),Pa=e=>o(lt(["${","`"],e),([t,n])=>[Ss(t),n]),Ep=e=>o(o(o(Pa(e),([t,n])=>o($h(n),([r,a])=>o(Ep(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(Pa(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o(o(Pa(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[Ms(t),n]),Ca=e=>o(o(u("`",e),([t,n])=>o(Ep(n),([r,a])=>o(u("`",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Cs(t),n]),vh=e=>o(Ca(e),([t,n])=>[As(t),n]),Th=e=>o(o(o(u("if",e),([t,n])=>o(w(n),([r,a])=>o(u("then",a),([s,m])=>o(w(m),([c,l])=>o(u("else",l),([I,f])=>o(w(f),([P,N])=>[[t,r,s,c,I,P],N])))))),([t,n])=>[t,n],()=>o(o(u("if",e),([t,n])=>o(w(n),([r,a])=>o(u("then",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>[])),([t,n])=>[qs(t),n]),kh=e=>o(Ra(e),([t,n])=>[Es(t),n]),Eh=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[ws(t),n]),wh=e=>o(Vr(e),([t,n])=>[Rs(t),n]),Rh=e=>o(Wr(["'",'"'],e),([t,n])=>[Os(t),n]),Oh=e=>o(o(o(u("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ls(t),n]),wp=(e,t=[])=>o(o(o(u("[",e),([n,r])=>o(w(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])=>wp(r,[...t,n]),()=>[t,e]),Ph=e=>o(wp(e),([t,n])=>[js(t),n]),Sh=e=>o(o(o(u("extends",e),([t,n])=>o(w(n),([r,a])=>o(u("?",a),([s,m])=>o(w(m),([c,l])=>o(u(":",l),([I,f])=>o(w(f),([P,N])=>[[t,r,s,c,I,P],N])))))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Fs(t),n]),Mh=e=>o(o(o(u("(",e),([t,n])=>o(w(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o($p(e),([t,n])=>[t,n],()=>o(vp(e),([t,n])=>[t,n],()=>o(ch(e),([t,n])=>[t,n],()=>o(lh(e),([t,n])=>[t,n],()=>o(dh(e),([t,n])=>[t,n],()=>o(Tp(e),([t,n])=>[t,n],()=>o(fh(e),([t,n])=>[t,n],()=>o(gh(e),([t,n])=>[t,n],()=>o(hh(e),([t,n])=>[t,n],()=>o(xh(e),([t,n])=>[t,n],()=>o(yh(e),([t,n])=>[t,n],()=>o(kp(e),([t,n])=>[t,n],()=>o(Ih(e),([t,n])=>[t,n],()=>o(bh(e),([t,n])=>[t,n],()=>o(kh(e),([t,n])=>[t,n],()=>o(Eh(e),([t,n])=>[t,n],()=>o(wh(e),([t,n])=>[t,n],()=>o(Rh(e),([t,n])=>[t,n],()=>o(vh(e),([t,n])=>[t,n],()=>o(Th(e),([t,n])=>[t,n],()=>o(zh(e),([t,n])=>[t,n],()=>o(Jh(e),([t,n])=>[t,n],()=>o(nx(e),([t,n])=>[t,n],()=>o(tx(e),([t,n])=>[t,n],()=>o(ix(e),([t,n])=>[t,n],()=>o(uh(e),([t,n])=>[t,n],()=>o(sx(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[Ds(t),n]),Ch=e=>o(o(o(u("with",e),([t,n])=>o(Gp(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ns(t),n]),Rp=e=>o(o(Oh(e),([t,n])=>o(Mh(n),([r,a])=>o(Ph(a),([s,m])=>o(Sh(m),([c,l])=>o(Ch(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Ks(t),n]),Op=e=>o(o(o(u("&",e),([t,n])=>o(Rp(n),([r,a])=>o(Op(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Pp=e=>o(o(Rp(e),([t,n])=>o(Op(n),([r,a])=>[[t,r],a])),([t,n])=>[Us(t),n]),Sp=e=>o(o(o(u("|",e),([t,n])=>o(Pp(n),([r,a])=>o(Sp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),Hr=e=>o(o(Pp(e),([t,n])=>o(Sp(n),([r,a])=>[[t,r],a])),([t,n])=>[Gs(t),n]),Ah=e=>o(o(u("readonly",e),([t,n])=>o(Hr(n),([r,a])=>[[t,r],a])),([t,n])=>[_s(t),n]),qh=e=>o(o(u("|",e),([t,n])=>o(Hr(n),([r,a])=>[[t,r],a])),([t,n])=>[zs(t),n]),Lh=e=>o(o(Ma(e),([t,n])=>o(u("=",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Bs(t),n]),jh=e=>o(o(o(u("infer",e),([t,n])=>o(B(n),([r,a])=>o(u("extends",a),([s,m])=>o(Hr(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(u("infer",e),([t,n])=>o(B(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>[])),([t,n])=>[Vs(t),n]),w=e=>o(o(jh(e),([t,n])=>[t,n],()=>o(qh(e),([t,n])=>[t,n],()=>o(Ah(e),([t,n])=>[t,n],()=>o(Hr(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Fh=e=>o(Vr(e),([t,n])=>[Ws(t),n]),Dh=e=>o(B(e),([t,n])=>[t,n]),Nh=e=>o(Wr(["'",'"'],e),([t,n])=>[t,n]),Kh=e=>o(o(u("[",e),([t,n])=>o(B(n),([r,a])=>o(u(":",a),([s,m])=>o(o(Tp(m),([c,l])=>[c,l],()=>o(vp(m),([c,l])=>[c,l],()=>o($p(m),([c,l])=>[c,l],()=>o(kp(m),([c,l])=>[c,l],()=>[])))),([c,l])=>o(u("]",l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Hs(t),n]),Mp=e=>o(o(Fh(e),([t,n])=>[t,n],()=>o(Dh(e),([t,n])=>[t,n],()=>o(Nh(e),([t,n])=>[t,n],()=>o(Kh(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Uh=e=>o(o(o(u("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ys(t),n]),Gh=e=>o(o(o(u("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Js(t),n]),Cp=e=>o(o(Uh(e),([t,n])=>o(Mp(n),([r,a])=>o(Gh(a),([s,m])=>o(u(":",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Zs(t),n]),Ap=e=>o(o(o(u(",",e),([t,n])=>o(u(`
3
3
  `,n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(u(";",e),([t,n])=>o(u(`
4
4
  `,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(`
5
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),Sp=(e,t=[])=>o(o(Op(e),([n,r])=>o(Pp(r),([a,s])=>[[n,a],s])),([n,r])=>Sp(r,[...t,n]),()=>[t,e]),Lx=e=>o(o(Sp(e),([t,n])=>o(o(o(Op(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Hs(t),n]),Ma=e=>o(o(u("{",e),([t,n])=>o(Lx(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Js(t),n]),jx=e=>o(Ma(e),([t,n])=>[Zs(t),n]),Fx=e=>o(o(o(B(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[t,n],()=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(B(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[Xs(t),n]),Dx=e=>o(o(u("readonly",e),([t,n])=>o(w(n),([r,a])=>o(u("?",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Qs(t),n]),Nx=e=>o(o(u("readonly",e),([t,n])=>o(w(n),([r,a])=>[[t,r],a])),([t,n])=>[em(t),n]),Kx=e=>o(o(w(e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[tm(t),n]),cp=e=>o(o(Fx(e),([t,n])=>[t,n],()=>o(Dx(e),([t,n])=>[t,n],()=>o(Nx(e),([t,n])=>[t,n],()=>o(Kx(e),([t,n])=>[t,n],()=>o(w(e),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),Mp=e=>o(o(o(u("...",e),([t,n])=>o(cp(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(cp(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[nm(t),n]),Cp=(e,t=[])=>o(o(Mp(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Cp(r,[...t,n]),()=>[t,e]),Ux=e=>o(o(Cp(e),([t,n])=>o(o(o(Mp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[rm(t),n]),Gx=e=>o(o(u("[",e),([t,n])=>o(Ux(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[am(t),n]),_x=e=>o(o(B(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[om(t),n]),zx=e=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[im(t),n]),Bx=e=>o(o(B(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[sm(t),n]),Wx=e=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[mm(t),n]),lp=e=>o(o(_x(e),([t,n])=>[t,n],()=>o(zx(e),([t,n])=>[t,n],()=>o(Bx(e),([t,n])=>[t,n],()=>o(Wx(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Ap=e=>o(o(o(u("...",e),([t,n])=>o(lp(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(lp(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[pm(t),n]),qp=(e,t=[])=>o(o(Ap(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>qp(r,[...t,n]),()=>[t,e]),Lp=e=>o(o(qp(e),([t,n])=>o(o(o(Ap(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[um(t),n]),Vx=e=>o(o(u("(",e),([t,n])=>o(Lp(n),([r,a])=>o(u(")",a),([s,m])=>o(u("=>",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[cm(t),n]),Hx=e=>o(o(u("new",e),([t,n])=>o(u("(",n),([r,a])=>o(Lp(a),([s,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([I,f])=>o(w(f),([q,j])=>[[t,r,s,c,I,q],j])))))),([t,n])=>[lm(t),n]),Yx=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])=>[dm(t),n]),Jx=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])=>[fm(t),n]),Zx=e=>o(o(o(u("as",e),([t,n])=>o(w(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[gm(t),n]),Xx=e=>o(o(u("{",e),([t,n])=>o(Yx(n),([r,a])=>o(u("[",a),([s,m])=>o(B(m),([c,l])=>o(u("in",l),([I,f])=>o(w(f),([q,j])=>o(Zx(j),([ie,le])=>o(u("]",le),([Te,Ce])=>o(Jx(Ce),([nn,D])=>o(u(":",D),([Vn,rn])=>o(w(rn),([an,Ae])=>o(xp(Ae),([on,nt])=>o(u("}",nt),([Mt,sn])=>[[t,r,s,c,I,q,ie,Te,nn,Vn,an,on,Mt],sn]))))))))))))),([t,n])=>[xm(t),n]),Qx=e=>o(B(e),([t,n])=>[ym(t),n]),ey=e=>o(Ea(e),([t,n])=>[hm(t),n]),ty=e=>o(Wr(e),([t,n])=>[Im(t),n]),ny=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[bm(t),n]),ry=e=>o(Vr(['"',"'"],e),([t,n])=>[t,n]),ay=e=>o(u("null",e),([t,n])=>[$m(t),n]),oy=e=>o(u("undefined",e),([t,n])=>[void 0,n]),jp=e=>o(o(Rp(e),([t,n])=>o(u(":",n),([r,a])=>o(Ca(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Tm(t),n]),Fp=(e,t=[])=>o(o(jp(e),([n,r])=>o(Pp(r),([a,s])=>[[n,a],s])),([n,r])=>Fp(r,[...t,n]),()=>[t,e]),iy=e=>o(o(Fp(e),([t,n])=>o(o(o(jp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[vm(t),n]),Dp=e=>o(o(u("{",e),([t,n])=>o(iy(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[km(t),n]),Np=(e,t=[])=>o(o(Ca(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Np(r,[...t,n]),()=>[t,e]),sy=e=>o(o(Np(e),([t,n])=>o(o(o(Ca(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Em(t),n]),my=e=>o(o(u("[",e),([t,n])=>o(sy(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[wm(t),n]),Ca=e=>o(o(ey(e),([t,n])=>[t,n],()=>o(ty(e),([t,n])=>[t,n],()=>o(ny(e),([t,n])=>[t,n],()=>o(ry(e),([t,n])=>[t,n],()=>o(ay(e),([t,n])=>[t,n],()=>o(oy(e),([t,n])=>[t,n],()=>o(Dp(e),([t,n])=>[t,n],()=>o(my(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),py=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[Rm(t),n]),uy=e=>o(u(".*",e),([t,n])=>[Om(t),n]),cy=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[Pm(t),n]),ly=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[Sm(t),n]),dy=e=>o(u("(?!)",e),([t,n])=>[Mm(t),n]),fy=e=>o(up(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[Cm(t),n]),gy=e=>o(o(py(e),([t,n])=>[t,n],()=>o(uy(e),([t,n])=>[t,n],()=>o(cy(e),([t,n])=>[t,n],()=>o(ly(e),([t,n])=>[t,n],()=>o(dy(e),([t,n])=>[t,n],()=>o(xy(e),([t,n])=>[t,n],()=>o(fy(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),xy=e=>o(o(u("(",e),([t,n])=>o(Aa(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Am(t),n]),Kp=e=>o(o(o(Oa(e),([t,n])=>o(u("|",n),([r,a])=>o(Kp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(Oa(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[qm(t),n]),Oa=e=>o(o(gy(e),([t,n])=>o(Aa(n),([r,a])=>[[t,r],a])),([t,n])=>[Lm(t),n]),Aa=e=>o(o(Kp(e),([t,n])=>[t,n],()=>o(Oa(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),fi=e=>o(o(u("^",e),([t,n])=>o(Aa(n),([r,a])=>o(u("$",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[jm(t),n]),Up=(e,t=[])=>o(o(w(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Up(r,[...t,n]),()=>[t,e]),yy=e=>o(o(Up(e),([t,n])=>o(o(o(w(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]),Gp=e=>o(o(o(u("extends",e),([t,n])=>o(yy(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Dm(t),n]),hy=e=>o(o(u("interface",e),([t,n])=>o(B(n),([r,a])=>o(Pa(a),([s,m])=>o(Gp(m),([c,l])=>o(Ma(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Nm(t),n]),Iy=e=>o(o(u("interface",e),([t,n])=>o(B(n),([r,a])=>o(Gp(a),([s,m])=>o(Ma(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[Km(t),n]),by=e=>o(o(u("type",e),([t,n])=>o(B(n),([r,a])=>o(Pa(a),([s,m])=>o(u("=",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Um(t),n]),$y=e=>o(o(u("type",e),([t,n])=>o(B(n),([r,a])=>o(u("=",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[Gm(t),n]),Ty=e=>o(o(o(u("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[_m(t),n]),vy=e=>o(o(o(u(";",e),([t,n])=>o(u(`
5
+ `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),qp=(e,t=[])=>o(o(Cp(e),([n,r])=>o(Ap(r),([a,s])=>[[n,a],s])),([n,r])=>qp(r,[...t,n]),()=>[t,e]),_h=e=>o(o(qp(e),([t,n])=>o(o(o(Cp(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]),Aa=e=>o(o(u("{",e),([t,n])=>o(_h(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[em(t),n]),zh=e=>o(Aa(e),([t,n])=>[tm(t),n]),Bh=e=>o(o(o(B(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[t,n],()=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(B(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[t,n],()=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[nm(t),n]),Vh=e=>o(o(u("readonly",e),([t,n])=>o(w(n),([r,a])=>o(u("?",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[rm(t),n]),Wh=e=>o(o(u("readonly",e),([t,n])=>o(w(n),([r,a])=>[[t,r],a])),([t,n])=>[am(t),n]),Hh=e=>o(o(w(e),([t,n])=>o(u("?",n),([r,a])=>[[t,r],a])),([t,n])=>[om(t),n]),gp=e=>o(o(Bh(e),([t,n])=>[t,n],()=>o(Vh(e),([t,n])=>[t,n],()=>o(Wh(e),([t,n])=>[t,n],()=>o(Hh(e),([t,n])=>[t,n],()=>o(w(e),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),Lp=e=>o(o(o(u("...",e),([t,n])=>o(gp(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(gp(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[im(t),n]),jp=(e,t=[])=>o(o(Lp(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>jp(r,[...t,n]),()=>[t,e]),Yh=e=>o(o(jp(e),([t,n])=>o(o(o(Lp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[sm(t),n]),Jh=e=>o(o(u("[",e),([t,n])=>o(Yh(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[mm(t),n]),Zh=e=>o(o(B(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(u("readonly",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[pm(t),n]),Xh=e=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(u("readonly",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[um(t),n]),Qh=e=>o(o(B(e),([t,n])=>o(u("?",n),([r,a])=>o(u(":",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[cm(t),n]),ex=e=>o(o(B(e),([t,n])=>o(u(":",n),([r,a])=>o(w(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[lm(t),n]),hp=e=>o(o(Zh(e),([t,n])=>[t,n],()=>o(Xh(e),([t,n])=>[t,n],()=>o(Qh(e),([t,n])=>[t,n],()=>o(ex(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Fp=e=>o(o(o(u("...",e),([t,n])=>o(hp(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o(o(hp(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[dm(t),n]),Dp=(e,t=[])=>o(o(Fp(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Dp(r,[...t,n]),()=>[t,e]),Np=e=>o(o(Dp(e),([t,n])=>o(o(o(Fp(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]),tx=e=>o(o(u("(",e),([t,n])=>o(Np(n),([r,a])=>o(u(")",a),([s,m])=>o(u("=>",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[gm(t),n]),nx=e=>o(o(u("new",e),([t,n])=>o(u("(",n),([r,a])=>o(Np(a),([s,m])=>o(u(")",m),([c,l])=>o(u("=>",l),([I,f])=>o(w(f),([P,N])=>[[t,r,s,c,I,P],N])))))),([t,n])=>[hm(t),n]),rx=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])=>[xm(t),n]),ax=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])=>[ym(t),n]),ox=e=>o(o(o(u("as",e),([t,n])=>o(w(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Im(t),n]),ix=e=>o(o(u("{",e),([t,n])=>o(rx(n),([r,a])=>o(u("[",a),([s,m])=>o(B(m),([c,l])=>o(u("in",l),([I,f])=>o(w(f),([P,N])=>o(ox(N),([se,te])=>o(u("]",te),([ve,Pe])=>o(ax(Pe),([on,F])=>o(u(":",F),([Hn,sn])=>o(w(sn),([mn,Te])=>o(bp(Te),([pn,gt])=>o(u("}",gt),([ht,At])=>[[t,r,s,c,I,P,se,ve,on,Hn,mn,pn,ht],At]))))))))))))),([t,n])=>[bm(t),n]),sx=e=>o(B(e),([t,n])=>[$m(t),n]),mx=e=>o(Ra(e),([t,n])=>[vm(t),n]),px=e=>o(Vr(e),([t,n])=>[Tm(t),n]),ux=e=>o(o(u("true",e),([t,n])=>[t,n],()=>o(u("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[km(t),n]),cx=e=>o(Wr(['"',"'"],e),([t,n])=>[t,n]),lx=e=>o(u("null",e),([t,n])=>[Em(t),n]),dx=e=>o(u("undefined",e),([t,n])=>[void 0,n]),Kp=e=>o(o(Mp(e),([t,n])=>o(u(":",n),([r,a])=>o(qa(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[wm(t),n]),Up=(e,t=[])=>o(o(Kp(e),([n,r])=>o(Ap(r),([a,s])=>[[n,a],s])),([n,r])=>Up(r,[...t,n]),()=>[t,e]),fx=e=>o(o(Up(e),([t,n])=>o(o(o(Kp(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Rm(t),n]),Gp=e=>o(o(u("{",e),([t,n])=>o(fx(n),([r,a])=>o(u("}",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Om(t),n]),_p=(e,t=[])=>o(o(qa(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>_p(r,[...t,n]),()=>[t,e]),gx=e=>o(o(_p(e),([t,n])=>o(o(o(qa(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Pm(t),n]),hx=e=>o(o(u("[",e),([t,n])=>o(gx(n),([r,a])=>o(u("]",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Sm(t),n]),qa=e=>o(o(mx(e),([t,n])=>[t,n],()=>o(px(e),([t,n])=>[t,n],()=>o(ux(e),([t,n])=>[t,n],()=>o(cx(e),([t,n])=>[t,n],()=>o(lx(e),([t,n])=>[t,n],()=>o(dx(e),([t,n])=>[t,n],()=>o(Gp(e),([t,n])=>[t,n],()=>o(hx(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),xx=e=>o(u("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[Mm(t),n]),yx=e=>o(u(".*",e),([t,n])=>[Cm(t),n]),Ix=e=>o(u("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[Am(t),n]),bx=e=>o(u("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[qm(t),n]),$x=e=>o(u("(?!)",e),([t,n])=>[Lm(t),n]),vx=e=>o(fp(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[jm(t),n]),Tx=e=>o(o(xx(e),([t,n])=>[t,n],()=>o(yx(e),([t,n])=>[t,n],()=>o(Ix(e),([t,n])=>[t,n],()=>o(bx(e),([t,n])=>[t,n],()=>o($x(e),([t,n])=>[t,n],()=>o(kx(e),([t,n])=>[t,n],()=>o(vx(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),kx=e=>o(o(u("(",e),([t,n])=>o(La(n),([r,a])=>o(u(")",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Fm(t),n]),zp=e=>o(o(o(Sa(e),([t,n])=>o(u("|",n),([r,a])=>o(zp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[t,n],()=>o(o(Sa(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[Dm(t),n]),Sa=e=>o(o(Tx(e),([t,n])=>o(La(n),([r,a])=>[[t,r],a])),([t,n])=>[Nm(t),n]),La=e=>o(o(zp(e),([t,n])=>[t,n],()=>o(Sa(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),yi=e=>o(o(u("^",e),([t,n])=>o(La(n),([r,a])=>o(u("$",a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Km(t),n]),Bp=(e,t=[])=>o(o(w(e),([n,r])=>o(u(",",r),([a,s])=>[[n,a],s])),([n,r])=>Bp(r,[...t,n]),()=>[t,e]),Ex=e=>o(o(Bp(e),([t,n])=>o(o(o(w(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Um(t),n]),Vp=e=>o(o(o(u("extends",e),([t,n])=>o(Ex(n),([r,a])=>[[t,r],a])),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Gm(t),n]),wx=e=>o(o(u("interface",e),([t,n])=>o(B(n),([r,a])=>o(Ma(a),([s,m])=>o(Vp(m),([c,l])=>o(Aa(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[_m(t),n]),Rx=e=>o(o(u("interface",e),([t,n])=>o(B(n),([r,a])=>o(Vp(a),([s,m])=>o(Aa(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[zm(t),n]),Ox=e=>o(o(u("type",e),([t,n])=>o(B(n),([r,a])=>o(Ma(a),([s,m])=>o(u("=",m),([c,l])=>o(w(l),([I,f])=>[[t,r,s,c,I],f]))))),([t,n])=>[Bm(t),n]),Px=e=>o(o(u("type",e),([t,n])=>o(B(n),([r,a])=>o(u("=",a),([s,m])=>o(w(m),([c,l])=>[[t,r,s,c],l])))),([t,n])=>[Vm(t),n]),Sx=e=>o(o(o(u("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>o([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Wm(t),n]),Mx=e=>o(o(o(u(";",e),([t,n])=>o(u(`
6
6
  `,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(`
7
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),_p=(e,t=[])=>o(o(qa(e),([n,r])=>o(vy(r),([a,s])=>[[n,a],s])),([n,r])=>_p(r,[...t,n]),()=>[t,e]),ky=e=>o(o(_p(e),([t,n])=>o(o(o(qa(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[zm(t),n]),qa=e=>o(o(Ty(e),([t,n])=>o(o(hy(n),([r,a])=>[r,a],()=>o(Iy(n),([r,a])=>[r,a],()=>o(by(n),([r,a])=>[r,a],()=>o($y(n),([r,a])=>[r,a],()=>[])))),([r,a])=>o(xp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Bm(t),n]),Ey=e=>o(o(qa(e),([t,n])=>o(ky(n),([r,a])=>[[t,r],a])),([t,n])=>[Wm(t),n]),zp=e=>o(o(Ey(e),([t,n])=>[t,n],()=>o(Rx(e),([t,n])=>[t,n],()=>o(w(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function Bp(e){let t=Sa(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:V()}function Ry(e){return e.join("|")}function Oy(e){return e.slice(1,e.length-1)}function Py(e,t,n){return dt(t,`${n}${e}`)}function Sy(e,t){return dt(e,`${t}${mi}`)}function My(e,t){return dt(e,`${t}${mr}`)}function Cy(e,t){return dt(e,`${t}${ur}`)}function Ay(e,t){return Mn(k([O("false"),O("true")]),e,t)}function qy(e,t){return dt(e,`${t}${cr}`)}function Ly(e,t,n){return dt(t,`${n}${Oy(e)}`)}function jy(e,t,n){let r=Cn(e,{});return Mn(r,t,n)}function Fy(e,t,n){let r=ke(e);return Mn(r,t,n)}function Wp(e,t,n,r=[]){return i.ShiftLeft(e,(a,s)=>Wp(s,t,n,[...r,Mn(a,[],"")]),()=>dt(t,`${n}(${Ry(r)})`))}function Mn(e,t,n){return de(e)?Fy(e.enum,t,n):fe(e)?My(t,n):C(e)?Py(e.const,t,n):_e(e)?Sy(t,n):Re(e)?Ay(t,n):J(e)?Cy(t,n):ge(e)?qy(t,n):Z(e)?Ly(e.pattern,t,n):Hp(e)?jy(e.parameters[0],t,n):y(e)?Wp(e.anyOf,t,n):_o}function dt(e,t){return i.ShiftLeft(e,(n,r)=>Mn(n,r,t),()=>t)}function Dy(e){return`^${dt(e,"")}$`}function Vp(e){let t=Dy(e);return dr(t)}function Cn(e,t){return v(e)?p.Update(Vp(e),{},t):Tr(e,t)}function Yp(e,t,n,r){let a=Ee(e,t,n);return Cn(a,r)}function Tr(e,t={}){return h("TemplateLiteral",[e],t)}function Hp(e){return Q(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function Jp(e){return Cn(e,{})}function Ny(e){let t=Bp(e);return Jp(t)}function Zp(e,t={}){let n=i.IsString(e)?Ny(e):Jp(e);return p.Update(n,{},t)}function Z(e){return x(e,"TemplateLiteral")}var b={};xt(b,{ExtendsFalse:()=>T,ExtendsTrue:()=>g,ExtendsUnion:()=>La,IsExtendsFalse:()=>Ky,IsExtendsTrue:()=>Qp,IsExtendsTrueLike:()=>Wt,IsExtendsUnion:()=>Xp,Match:()=>K});function La(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Xp(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 Qp(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function T(){return p.Create({"~kind":"ExtendsFalse"},{})}function Ky(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function Wt(e){return Xp(e)||Qp(e)}function K(e,t,n){return Wt(e)?t(e.inferred):n()}function Uy(e,t,n,r){return K(P(e,n,r),a=>g(p.Assign(p.Assign(e,a),{[t]:n})),()=>T())}function Gy(e,t){return g(e)}function _y(e,t,n,r,a){return K(P(e,t,n),s=>K(P(s,t,r),m=>g(m),()=>T()),()=>K(P(e,t,a),s=>g(s),()=>T()))}function zy(e,t,n){let r=ke(n);return P(e,t,r)}function eu(e,t,n){return i.ShiftLeft(n,(r,a)=>K(P(e,t,r),s=>eu(s,t,a),()=>T()),()=>g(e))}function By(e,t,n){let r=he(n);return P(e,t,r)}function tu(e,t,n){return i.ShiftLeft(n,(r,a)=>K(P(e,t,r),s=>g(s),()=>tu(e,t,a)),()=>T())}function A(e,t,n){return Y(n)?Gy(e,t):z(n)?_y(e,t,n.if,n.then,n.else):de(n)?zy(e,t,n.enum):W(n)?Uy(e,n.name,t,n.extends):R(n)?eu(e,t,n.allOf):Z(n)?By(e,t,n.pattern):y(n)?tu(e,t,n.anyOf):ee(n)?g(e):T()}function nu(e,t,n){return W(n)?A(e,t,n):Y(n)?g(e):ee(n)?g(e):La(e)}function Wy(e,t){let n=Tt(e),r=Tt(t);return n&&r||!n&&r?!0:!(n&&!r)}function ru(e,t,n,r){return U(r)?Wy(t,r)?P(e,n,r.items):T():A(e,t,r)}function au(e,t,n){return _e(n)?g(e):A(e,t,n)}function ou(e,t,n){return Re(n)?g(e):A(e,t,n)}function Vy(e,t,n,r,a){let s=W(r)?t:r,m=W(r)?r:t,c=ue(t),l=ue(r);return!c&&l?T():K(P(e,s,m),I=>An(I,n,a),()=>T())}function Hy(e,t,n,r){return i.ShiftLeft(r,(a,s)=>Vy(e,t,n,a,s),()=>ue(t)?g(e):T())}function Yy(e,t,n){return i.ShiftLeft(t,(r,a)=>Hy(e,r,a,n),()=>g(e))}function An(e,t,n){return Yy(e,t,n)}function Yr(e,t,n){return ze(n)?g(e):P(e,t,n)}function iu(e,t,n,r){return Y(r)?g(e):ee(r)?g(e):te(r)?K(An(e,t,r.parameters),a=>Yr(a,n,r.instanceType),()=>T()):T()}function su(e,t,n,r,a){return K(P(e,t,a),()=>P(e,n,a),()=>P(e,r,a))}function mu(e,t,n){let r=ke(t);return P(e,r,n)}function pu(e,t,n,r){return Y(r)?g(e):ee(r)?g(e):ne(r)?K(An(e,t,r.parameters),a=>Yr(a,n,r.returnType),()=>T()):T()}function uu(e,t,n){return fe(n)?g(e):J(n)?g(e):A(e,t,n)}function cu(e,t,n){let r=G(t);return P(e,r,n)}function Jr(e,t,n){return t===n?g(e):T()}function Jy(e,t,n){return C(n)?Jr(e,t,n.const):_e(n)?g(e):A(e,O(t),n)}function Zy(e,t,n){return C(n)?Jr(e,t,n.const):Re(n)?g(e):A(e,O(t),n)}function Xy(e,t,n){return C(n)?Jr(e,t,n.const):J(n)?g(e):A(e,O(t),n)}function Qy(e,t,n){return C(n)?Jr(e,t,n.const):ge(n)?g(e):A(e,O(t),n)}function lu(e,t,n){return i.IsBigInt(t.const)?Jy(e,t.const,n):i.IsBoolean(t.const)?Zy(e,t.const,n):i.IsNumber(t.const)?Xy(e,t.const,n):i.IsString(t.const)?Qy(e,t.const,n):V()}function du(e,t,n){return W(n)?A(e,t,n):g(e)}function fu(e,t,n){return jt(n)?g(e):A(e,t,n)}function gu(e,t,n){return J(n)?g(e):A(e,t,n)}function eh(e,t,n){return ue(t)?ue(n)?g(e):T():g(e)}function th(e,t,n){return W(n)&&it(n.extends)?T():K(P(e,t,n),r=>eh(r,t,n),()=>T())}function nh(e,t){return e.reduce((n,r)=>r in t?Wt(t[r])?{...n,...t[r].inferred}:V():V(),{})}function rh(e,t,n){let r={};for(let m of i.Keys(n))r[m]=m in t?th({},t[m],n[m]):ue(n[m])?W(n[m])?g(p.Assign(e,{[n[m].name]:n[m].extends})):g(e):T();let a=i.Values(r).every(m=>Wt(m)),s=a?nh(i.Keys(r),r):{};return a?g(s):T()}function ah(e,t,n){let r=rh(e,t,n);return Wt(r)?g(p.Assign(e,r.inferred)):T()}function oh(e,t,n){return ah(e,t,n)}function ih(e,t){return i.Keys(t).reduce((n,r)=>({...n,[r]:i.HasPropertyKey(e,r)?y(n[r])?k([...n[r].anyOf,t[r]]):k([e[r],t[r]]):t[r]}),e)}function xu(e,t,n,r){return i.ShiftLeft(t,(a,s)=>K(P({},e[a],n),m=>xu(e,s,n,ih(r,m)),()=>T()),()=>g(r))}function sh(e,t,n,r){let a=i.Keys(t);return xu(t,a,r,e)}function yu(e,t,n){return pe(n)?sh(e,t,Se(n),xe(n)):M(n)?oh(e,t,n.properties):A(e,$(t),n)}function mh(e,t){return i.IsEqual(i.Keys(t).length,0)?g(e):T()}function ph(e,t,n,r,a){return P(e,n,a)}function hu(e,t,n,r){return pe(r)?ph(e,hr(t),n,hr(Se(r)),xe(r)):M(r)?mh(e,r.properties):Y(r)?g(e):ee(r)?g(e):T()}function Iu(e,t,n){return ge(n)?g(e):A(e,t,n)}function bu(e,t,n){return st(n)?g(e):A(e,t,n)}function $u(e,t,n){let r=he(t);return P(e,r,n)}function ja(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function qn(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 Fa(e){return ut(e)?W(e.items)?U(e.items.extends)?ja(e.items.name,e.items.extends.items):ee(e.items.extends)?ja(e.items.name,e.items.extends):void 0:V():void 0}function Zr(e){return W(e)?ja(e.name,e.extends):void 0}function Da(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>K(P({},r,t),()=>Da(a,t,[...n,r]),()=>{}),()=>n)}function Tu(e,t,n,r){let a=Da(n,r);return i.IsArray(a)?g(p.Assign(e,{[t]:X(a)})):T()}function Xr(e,t,n,r){let a=Da(n,r);return i.IsArray(a)?g(p.Assign(e,{[t]:k(a)})):T()}function uh(e){return[...e].reverse()}function Na(e,t){return t?uh(e):e}function ch(e){let t=e.length>0?e[0]:void 0,n=Q(t)?Fa(t):void 0;return Q(n)}function lh(e,t,n,r,a,s){return K(P(e,n,a),m=>vu(m,t,r,s),()=>T())}function dh(e,t,n,r,a){let s=Fa(r);return qn(s)?Tu(e,s.name,Na(n,t),s.type):i.ShiftLeft(n,(m,c)=>lh(e,t,m,c,r,a),()=>T())}function fh(e,t,n,r){return i.ShiftLeft(r,(a,s)=>dh(e,t,n,a,s),()=>i.IsEqual(n.length,0)?g(e):T())}function vu(e,t,n,r){return fh(e,t,n,r)}function gh(e,t,n){let r=ft(e,N([],[]),n),a=ch(r);return vu(e,a,Na(t,a),Na(r,a))}function ku(e,t,n){let r=Zr(n);return qn(r)?Xr(e,r.name,t,r.type):i.ShiftLeft(t,(a,s)=>K(P(e,a,n),m=>ku(m,s,n),()=>T()),()=>g(e))}function Eu(e,t,n){let r=ft(e,N([],[]),t);return F(n)?gh(e,r,n.items):U(n)?ku(e,r,n.items):A(e,X(r),n)}function wu(e,t,n){return ze(n)?g(e):Gt(n)?g(e):A(e,t,n)}function Ru(e,t,n){return i.ShiftLeft(n,(r,a)=>K(P(e,t,r),s=>g(s),()=>Ru(e,t,a)),()=>T())}function Ka(e,t,n){return i.ShiftLeft(t,(r,a)=>K(Ru(e,r,n),s=>Ka(s,a,n),()=>T()),()=>g(e))}function Ou(e,t,n){let r=Zr(n);return qn(r)?Xr(e,r.name,t,r.type):y(n)?Ka(e,t,n.anyOf):Ka(e,t,[n])}function Pu(e,t,n){return W(n)?A(e,t,n):Y(n)?g(e):ee(n)?g(e):T()}function Su(e,t,n){return ze(n)?g(e):A(e,t,n)}function P(e,t,n){return Y(t)?nu(e,t,n):U(t)?ru(e,t,t.items,n):_e(t)?au(e,t,n):Re(t)?ou(e,t,n):te(t)?iu(e,t.parameters,t.instanceType,n):z(t)?su(e,t.if,t.then,t.else,n):de(t)?mu(e,t.enum,n):ne(t)?pu(e,t.parameters,t.returnType,n):fe(t)?uu(e,t,n):R(t)?cu(e,t.allOf,n):C(t)?lu(e,t,n):it(t)?du(e,t,n):jt(t)?fu(e,t,n):J(t)?gu(e,t,n):M(t)?yu(e,t.properties,n):pe(t)?hu(e,Se(t),xe(t),n):ge(t)?Iu(e,t,n):st(t)?bu(e,t,n):Z(t)?$u(e,t.pattern,n):F(t)?Eu(e,t.items,n):Gt(t)?wu(e,t,n):y(t)?Ou(e,t.anyOf,n):ee(t)?Pu(e,t,n):ze(t)?Su(e,t,n):T()}function xh(e,t){return G([...e,$(t)])}function Ua(e,t,n){return v(e)?p.Update(xh(e,t),{},n):wn(e,t,n)}function Mu(e,t,n,r,a){let s=Ee(e,t,n),m=Ln(e,t,r);return Ua(s,m,a)}function wn(e,t,n={}){return h("Interface",[e,t],n)}function Vt(e){return Q(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function Cu(e,t,n={}){return Ua(e,t,n)}function yh(e,t,n){return e.includes(n)?!0:jn([...e,n],t,t[n])}function Au(e,t,n){let r=rr(n);return Pt(e,t,r)}function Pt(e,t,n){return i.ShiftLeft(n,(r,a)=>jn(e,t,r)?!0:Pt(e,t,a),()=>!1)}function jn(e,t,n){return re(n)?yh(e,t,n.$ref):U(n)?jn(e,t,n.items):te(n)?Pt(e,t,[...n.parameters,n.instanceType]):ne(n)?Pt(e,t,[...n.parameters,n.returnType]):Vt(n)?Au(e,t,n.parameters[1]):R(n)?Pt(e,t,n.allOf):M(n)?Au(e,t,n.properties):y(n)?Pt(e,t,n.anyOf):F(n)?Pt(e,t,n.items):pe(n)?jn(e,t,xe(n)):!1}function qu(e,t,n){return jn(e,t,n)}function hh(e,t){return t.reduce((n,r)=>qu([r],e,e[r])?[...n,r]:n,[])}function Lu(e){let t=nr(e);return hh(e,t)}function Ih(e,t,n){return n.includes(t)?n:t in e?Fn(e,e[t],[...n,t]):V()}function ju(e,t,n){let r=rr(t);return Ht(e,r,n)}function Ht(e,t,n){return t.reduce((r,a)=>Fn(e,a,r),n)}function Fn(e,t,n){return re(t)?Ih(e,t.$ref,n):U(t)?Fn(e,t.items,n):te(t)?Ht(e,[...t.parameters,t.instanceType],n):ne(t)?Ht(e,[...t.parameters,t.returnType],n):Vt(t)?ju(e,t.parameters[1],n):R(t)?Ht(e,t.allOf,n):M(t)?ju(e,t.properties,n):y(t)?Ht(e,t.anyOf,n):F(t)?Ht(e,t.items,n):pe(t)?Fn(e,xe(t),n):n}function Fu(e,t,n){return Fn(e,n,[t])}function bh(e){return At()}function $h(e){return i.Keys(e).reduce((t,n)=>({...t,[n]:St(e[n])}),{})}function Dn(e){return e.reduce((t,n)=>[...t,St(n)],[])}function St(e){return re(e)?bh(e.$ref):U(e)?ve(St(e.items),tr(e)):te(e)?Fe(Dn(e.parameters),St(e.instanceType)):ne(e)?De(Dn(e.parameters),St(e.returnType)):R(e)?ce(Dn(e.allOf)):M(e)?$($h(e.properties)):pe(e)?yr(Kt(e),St(xe(e))):y(e)?k(Dn(e.anyOf)):F(e)?X(Dn(e.items)):e}function Th(e,t){return t in e?St(e[t]):ae()}function Du(e){return Th(e.$defs,e.$ref)}function vh(e,t,n){let r=Ee(e,N([],[]),t),a=Ln({},N([],[]),n);return G([...r,$(a)])}function kh(e,t){return i.Keys(e).filter(r=>t.includes(r)).reduce((r,a)=>{let s=e[a],m=Vt(s)?vh(e,s.parameters[0],s.parameters[1]):s;return{...r,[a]:m}},{})}function Nu(e,t,n){let r=Fu(e,t,n),a=kh(e,r);return Ke(a,t)}function Ku(e,t){return t in e?re(e[t])?Ku(e,e[t].$ref):e[t]:L()}function Be(e,t){return Ku(e,t)}function Uu(e){return se(e)?Du(e):ar(e)?ae():e}function me(e,t,n){let r=Uu(t),a=Uu(n);return P(e,r,a)}var bn="equal",Eh="disjoint",$n="left-inside",Tn="right-inside";function Dt(e,t){let n=[ee(e)?b.ExtendsFalse():me({},e,t),ee(e)?b.ExtendsTrue({}):me({},t,e)];return b.IsExtendsTrueLike(n[0])&&b.IsExtendsTrueLike(n[1])?bn:b.IsExtendsTrueLike(n[0])&&b.IsExtendsFalse(n[1])?$n:b.IsExtendsFalse(n[0])&&b.IsExtendsTrueLike(n[1])?Tn:Eh}function wh(e,t){return t.filter(n=>Dt(e,n)!==Tn)}function Rh(e,t){let n=t.some(r=>{let a=Dt(e,r);return i.IsEqual(a,$n)||i.IsEqual(a,bn)});return i.IsEqual(n,!1)}function Oh(e,t){let n=Pe(e);return Y(n)?[n]:Rh(n,t)?[...wh(n,t),n]:t}function Ph(e){return e.reduce((t,n)=>M(n)?[...t,n]:it(n)?t:Oh(n,t),[])}function Ia(e){let t=Ph(e);return kn(t)}function Ga(e,t){return p.Update(Pe(e),{},t)}function Gu(e,t,n,r){let a=d(e,t,n);return Ga(a,r)}function Nn(e,t=[]){return at(e)&&i.IsEqual(e.action,"Conditional")?re(e.parameters[0])?Nn(e.parameters[2],Nn(e.parameters[3],[...t,e.parameters[0].$ref])):Nn(e.parameters[2],Nn(e.parameters[3],t)):at(e)&&i.IsEqual(e.action,"Mapped")&&at(e.parameters[1])&&i.IsEqual(e.parameters[1].action,"KeyOf")&&re(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function Sh(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function Bu(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>i.ShiftLeft(t,(s,m)=>Bu(a,m,[...n,[s,r]]),()=>n),()=>n)}function Mh(e){return y(e)?[...e.anyOf]:[e]}function Ch(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function _u(e,t){return t.reduce((n,r)=>[...n,...Ch(e,r)],[])}function zu(e){return e.reduce((t,n)=>i.IsEqual(n[0],!0)?_u(t,Mh(n[1])):_u(t,[n[1]]),[[]])}function Wu(e,t,n){let r=Nn(n),a=Sh(e,r),s=Bu(t,a);return at(n)&&i.IsEqual(n.action,"Conditional")||at(n)&&i.IsEqual(n.action,"Mapped")?zu(s):[t]}function Ah(){return["(not-resolvable)",L()]}function qh(){return["(not-generic)",L()]}function Lh(e,t,n){return[e,ot(t,n)]}function jh(e,t,n){return t in e?Vu(e,t,e[t],n):Ah()}function Vu(e,t,n,r){return Ct(n)?Lh(t,n.parameters,n.expression):re(n)?jh(e,n.$ref,r):qh()}function Hu(e,t,n){return Vu(e,"(anonymous)",t,n)}function Fh(e,t,n){if(W(t)||Yt(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 Yu(e,t,n,r,a){let s=d(e,t,a);return Fh(n,s,r),p.Assign(e,{[n]:s})}function Dh(e,t,n,r,a){let s=d(e,t,n.extends),m=d(e,t,n.equals);return i.ShiftLeft(a,(c,l)=>_a(Yu(e,t,n.name,s,c),t,r,l),()=>_a(Yu(e,t,n.name,s,m),t,r,[]))}function _a(e,t,n,r){return i.ShiftLeft(n,(a,s)=>Dh(e,t,a,s,r),()=>e)}function Ju(e,t,n,r){return _a(e,t,n,r)}function Nh(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function Kh(e,t){return i.IsEqual(Nh(e),t)}function Uh(e,t,n,r,a,s){let m=Ju(e,t,r,s),c=d(m,N([...t.callstack,n.$ref],t.visited),a);return d(m,N([],[]),c)}function Gh(e,t,n,r,a,s){return s.reduce((m,c)=>[...m,Uh(e,t,n,r,a,c)],[])}function _h(e,t,n,r,a,s){let m=Wu(r,s,a),c=Gh(e,t,n,r,a,m);return i.IsEqual(c.length,1)?c[0]:be(c)}function Qr(e,t,n,r){let a=Ee(e,t,r),s=Hu(e,n,r),m=s[0],c=s[1];return Ct(c)?Kh(t,m)?Rn(Je(m),a):_h(e,t,Je(m),c.parameters,c.expression,a):Rn(n,a)}function Rn(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function Zu(e,t){return Qr({},N([],[]),e,t)}function Yt(e){return x(e,"Call")}function zh(e){return p.Discard(e,["~immutable"])}function Xu(e,t){return p.Update(zh(e),{},t)}function Qu(e,t,n,r){let a=d(e,t,n);return Xu(a,r)}function ec(e,t){return e(t)}function tc(e,t){return i.IsString(t)?O(ec(e,t)):O(t)}function nc(e,t){let n=he(t);return Qe(e,n)}function rc(e,t){let n=t.map(r=>Qe(e,r));return k(n)}function Qe(e,t){return C(t)?tc(e,t.const):Z(t)?nc(e,t.pattern):y(t)?rc(e,t.anyOf):t}function vr(e,t={}){return h("Capitalize",[e],t)}function ac(e,t={}){return za(e,t)}function kr(e,t={}){return h("Lowercase",[e],t)}function oc(e,t={}){return Ba(e,t)}function Er(e,t={}){return h("Uncapitalize",[e],t)}function ic(e,t={}){return Wa(e,t)}function wr(e,t={}){return h("Uppercase",[e],t)}function sc(e,t={}){return Va(e,t)}var Bh=e=>e[0].toUpperCase()+e.slice(1),Wh=e=>e.toLowerCase(),Vh=e=>e[0].toLowerCase()+e.slice(1),Hh=e=>e.toUpperCase();function za(e,t){return v([e])?p.Update(Qe(Bh,e),{},t):vr(e,t)}function Ba(e,t){return v([e])?p.Update(Qe(Wh,e),{},t):kr(e,t)}function Wa(e,t){return v([e])?p.Update(Qe(Vh,e),{},t):Er(e,t)}function Va(e,t){return v([e])?p.Update(Qe(Hh,e),{},t):wr(e,t)}function mc(e,t,n,r){let a=d(e,t,n);return za(a,r)}function pc(e,t,n,r){let a=d(e,t,n);return Ba(a,r)}function uc(e,t,n,r){let a=d(e,t,n);return Wa(a,r)}function cc(e,t,n,r){let a=d(e,t,n);return Va(a,r)}function Rr(e,t,n,r,a={}){return h("Conditional",[e,t,n,r],a)}function lc(e,t,n,r,a={}){return Ha({},N([],[]),e,t,n,r,a)}function Yh(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 Ha(e,t,n,r,a,s,m){return v([n,r])?p.Update(Yh(e,t,n,r,a,s),{},m):Rr(n,r,a,s,m)}function dc(e,t,n,r,a,s,m){let c=d(e,t,n),l=d(e,t,r);return Ha(e,t,c,l,a,s,m)}function Or(e,t={}){return h("ConstructorParameters",[e],t)}function fc(e,t={}){return Ya(e,t)}function Jh(e){let t=te(e)?e.parameters:[],n=ft({},N([],[]),t);return X(n)}function Ya(e,t){return v([e])?p.Update(Jh(e),{},t):Or(e,t)}function gc(e,t,n,r){let a=d(e,t,n);return Ya(a,r)}function Pr(e,t,n={}){return h("Exclude",[e,t],n)}function xc(e,t,n={}){return Kn(e,t,n)}function Kn(e,t,n){return v([e,t])?p.Update(gr(e,t),{},n):Pr(e,t,n)}function yc(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Kn(s,m,a)}function Sr(e,t,n={}){return h("Extract",[e,t],n)}function hc(e,t,n={}){return Ja(e,t,n)}function Zh(e,t){let n=me({},e,t);return b.IsExtendsTrueLike(n)?[e]:[]}function Xh(e,t){return e.reduce((n,r)=>[...n,...Zh(r,t)],[])}function Ic(e,t){let n=Pe(e),r=y(n)?n.anyOf:[n],a=Xh(r,t);return be(a)}function Ja(e,t,n){return v([e,t])?p.Update(Ic(e,t),{},n):Sr(e,t,n)}function bc(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Ja(s,m,a)}function Qh(e){return e.reduce((t,n)=>pr(n)?[...t,O(n)]:t,[])}function Jt(e){let t=Qh(e);return k(t)}function On(e,t,n={}){return h("Index",[e,t],n)}function $c(e,t,n={}){let r=i.IsArray(t)?Jt(t):t;return Za(e,r,n)}function Tc(e,t){let n=Be(e,t);return we(n)}function vc(e,t,n){let r=je(e,t,n);return we(r)}function eI(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,q)=>({...f,[q]:e[q]}),{}),m=r.reduce((f,q)=>({...f,[q]:t[q]}),{}),c=a.reduce((f,q)=>({...f,[q]:G([e[q],t[q]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function kc(e){return e.reduce((t,n)=>eI(t,we(n)),{})}function Ec(e){let t=Si(X(e));return we(t)}function tI(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:be([e[s],t[s]])}),{})}function wc(e,t){return i.ShiftLeft(e,(n,r)=>wc(r,tI(t,we(n))),()=>t)}function Rc(e){return i.ShiftLeft(e,(t,n)=>wc(n,we(t)),()=>V())}function we(e){return se(e)?Tc(e.$defs,e.$ref):z(e)?vc(e.if,e.then,e.else):R(e)?kc(e.allOf):y(e)?Rc(e.anyOf):F(e)?Ec(e.items):M(e)?e.properties:{}}function Zt(e){let t=we(e);return $(t)}var nI=new RegExp("^(?:0|[1-9][0-9]*)$");function Xt(e){let t=`${e}`;return nI.test(t)?parseInt(t):e}function rI(e){return O(Xt(e))}function Oc(e){return e.map(t=>Pc(t))}function Pc(e){return R(e)?ce(Oc(e.allOf)):y(e)?k(Oc(e.anyOf)):C(e)?rI(e.const):e}function Sc(e,t){let n=Pc(t),r=me({},n,Ie());return b.IsExtendsTrueLike(r)?e:C(t)&&i.IsEqual(t.const,"length")?Ie():L()}function Mc(e,t){let n=Be(e,t);return $e(n)}function Cc(e,t,n){let r=je(e,t,n);return $e(r)}function Ac(e){let t=ke(e);return $e(t)}function qc(e){let t=G(e);return $e(t)}function Lc(e){return[`${e}`]}function jc(e){let t=he(e);return $e(t)}function Fc(e){return e.reduce((t,n)=>[...t,...$e(n)],[])}function $e(e){return se(e)?Mc(e.$defs,e.$ref):z(e)?Cc(e.if,e.then,e.else):de(e)?Ac(e.enum):R(e)?qc(e.allOf):C(e)?Lc(e.const):Z(e)?jc(e.pattern):y(e)?Fc(e.anyOf):[]}function Qt(e){return $e(e)}function Un(e,t){return t.map(n=>Gn(e,n))}function Gn(e,t){return U(t)?ve(Gn(e,t.items)):te(t)?Fe(Un(e,t.parameters),Gn(e,t.instanceType)):ne(t)?De(Un(e,t.parameters),Gn(e,t.returnType)):F(t)?X(Un(e,t.items)):y(t)?k(Un(e,t.anyOf)):R(t)?ce(Un(e,t.allOf)):br(t)?$(e):t}function Dc(e,t){return Gn(e,t)}function aI(e,t){let n=t in e?e[t]:L();return Dc(e,n)}function Nc(e,t){return t.reduce((n,r)=>[...n,aI(e,r)],[])}function oI(e,t){let n=Qt(t),r=Nc(e,n);return be(r)}var iI=new RegExp(pt);function sI(e){return e.filter(n=>iI.test(n))}function mI(e){let t=nr(e),n=sI(t),r=Nc(e,n);return be(r)}function Kc(e,t){return J(t)?mI(e):oI(e,t)}function pI(e){return O(Xt(e))}function Uc(e){return e.map(t=>Xa(t))}function Xa(e){return R(e)?ce(Uc(e.allOf)):y(e)?k(Uc(e.anyOf)):C(e)?pI(e.const):e}function uI(e,t){return e.reduceRight((n,r,a)=>{let s=me({},O(a),t);return b.IsExtendsTrueLike(s)?[r,...n]:n},[])}function cI(e,t){let n=Xa(t),r=uI(e,n);return Ze(r)}function lI(e){return Ze(e)}function Gc(e,t){return C(t)&&i.IsEqual(t.const,"length")?O(e.length):J(t)||fe(t)?lI(e):cI(e,t)}function _c(e,t){return U(e)?Sc(e.items,t):M(e)?Kc(e.properties,t):F(e)?Gc(e.items,t):L()}function dI(e){return se(e)||z(e)||R(e)||y(e)?Zt(e):e}function Za(e,t,n){return v([e,t])?p.Update(_c(dI(e),t),{},n):On(e,t,n)}function zc(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Za(s,m,a)}function Mr(e,t={}){return h("InstanceType",[e],t)}function Bc(e,t={}){return Qa(e,t)}function fI(e){return te(e)?e.instanceType:L()}function Qa(e,t){return v([e])?p.Update(fI(e),{},t):Mr(e,t)}function Wc(e,t,n,r={}){let a=d(e,t,n);return Qa(a,r)}function Pn(e,t={}){return h("KeyOf",[e],t)}function Vc(e,t={}){return eo(e,t)}function Hc(){return k([Ie(),Oe(),Ft()])}function Yc(e){return Ie()}function gI(e){return e.reduce((n,r)=>pr(r)?[...n,O(Xt(r))]:V(),[])}function Jc(e){let t=i.Keys(e),n=gI(t);return Ze(n)}function Zc(e){return Kt(e)}function Xc(e){let t=e.map((n,r)=>O(r));return Ze(t)}function Qc(e){return Y(e)?Hc():U(e)?Yc(e.items):M(e)?Jc(e.properties):pe(e)?Zc(e):F(e)?Xc(e.items):L()}function xI(e){return se(e)||z(e)||R(e)||y(e)?Zt(e):e}function eo(e,t){return v([e])?p.Update(Qc(xI(e)),{},t):Pn(e,t)}function el(e,t,n,r){let a=d(e,t,n);return eo(a,r)}function En(e,t,n,r,a={}){return h("Mapped",[e,t,n,r],a)}function tl(e,t,n,r,a={}){return to({},N([],[]),e,t,n,r,a)}function yI(e){let t=he(e);return ea(t)}function hI(e){return e.reduce((t,n)=>[...t,...ea(n)],[])}function II(e){let t=ke(e);return ea(t)}function bI(e){return i.IsNumber(e)?[O(`${e}`)]:[O(e)]}function ea(e){return de(e)?II(e.enum):C(e)?bI(e.const):Z(e)?yI(e.pattern):y(e)?hI(e.anyOf):[e]}function nl(e){return ea(e)}function $I(e){return Z(e)?he(e.pattern):e}function TI(e,t,n,r,a,s){let m=p.Assign(e,{[n.name]:r}),c=d(m,t,a),l=$I(c),I=d(m,t,s);return ui(l)||ci(l)?{[l.const]:I}:{}}function vI(e,t,n,r,a,s){return r.reduce((m,c)=>[...m,TI(e,t,n,c,a,s)],[])}function kI(e){return e.reduce((t,n)=>[...t,$(n)],[])}function rl(e,t,n,r,a,s){let m=nl(r),c=vI(e,t,n,m,a,s),l=kI(c);return G(l)}function to(e,t,n,r,a,s,m){return v([r])?p.Update(rl(e,t,n,r,a,s),{},m):En(n,r,a,s,m)}function al(e,t,n,r,a,s,m){let c=d(e,t,r);return to(e,t,n,c,a,s,m)}function EI(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>n.includes(s)).reduce((s,m)=>({...s,[m]:Nu(r,m,t[m])}),{})}function wI(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,N([],[]),t[m])}),{})}function RI(e,t,n){let r=Lu(t),a=EI(e,t,r),s=wI(e,t,r),m={...a,...s};return p.Update(m,{},n)}function ta(e,t,n,r){return RI(e,n,r)}function Cr(e,t={}){return h("NonNullable",[e],t)}function ol(e,t={}){return no(e,t)}function OI(e){let t=k([Lt(),Ut()]);return Kn(e,t,{})}function no(e,t){return v([e])?p.Update(OI(e),{},t):Cr(e,t)}function il(e,t,n,r){let a=d(e,t,n);return no(a,r)}function Ar(e,t,n={}){return h("Omit",[e,t],n)}function sl(e,t,n={}){let r=i.IsArray(t)?Jt(t):t;return ro(e,r,n)}function na(e){let t=Zt(e);return M(t)?t.properties:V()}function PI(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?r:{...r,[a]:e[a]},{})}function ml(e,t){let n=na(e),r=Qt(t),a=PI(n,r);return $(a)}function ro(e,t,n){return v([e,t])?p.Update(ml(e,t),{},n):Ar(e,t,n)}function pl(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return ro(s,m,a)}function qr(e,t={}){return h("Parameters",[e],t)}function ul(e,t={}){return ao(e,t)}function SI(e){let t=ne(e)?e.parameters:[],n=ft({},N([],[]),t);return X(n)}function ao(e,t){return v([e])?p.Update(SI(e),{},t):qr(e,t)}function cl(e,t,n,r){let a=d(e,t,n);return ao(a,r)}function Lr(e,t={}){return h("Partial",[e],t)}function ll(e,t={}){return oo(e,t)}function dl(e,t){let n=Be(e,t),r=We(n);return Ke(p.Assign(e,{[t]:r}),t)}function fl(e,t,n){let r=je(e,t,n);return We(r)}function gl(e){let t=G(e);return We(t)}function xl(e){let t=e.map(n=>We(n));return k(t)}function yl(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:bt(e[a])}),{});return $(t)}function We(e){return se(e)?dl(e.$defs,e.$ref):z(e)?fl(e.if,e.then,e.else):R(e)?gl(e.allOf):y(e)?xl(e.anyOf):M(e)?yl(e.properties):$({})}function oo(e,t){return v([e])?p.Update(We(e),{},t):Lr(e,t)}function hl(e,t,n,r){let a=d(e,t,n);return oo(a,r)}function jr(e,t,n={}){return h("Pick",[e,t],n)}function Il(e,t,n={}){let r=i.IsArray(t)?Jt(t):t;return io(e,r,n)}function MI(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?p.Assign(r,{[a]:e[a]}):r,{})}function bl(e,t){let n=na(e),r=Qt(t),a=MI(n,r);return $(a)}function io(e,t,n){return v([e,t])?p.Update(bl(e,t),{},n):jr(e,t,n)}function $l(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return io(s,m,a)}function Fr(e,t={}){return h("ReadonlyObject",[e],t)}function so(e,t={}){return mo(e,t)}var Tl=so;function vl(e){return qt(ve(e))}function kl(e,t){let n=Be(e,t),r=Ve(n);return Ke(p.Assign(e,{[t]:r}),t)}function El(e,t,n){let r=je(e,t,n);return Ve(r)}function wl(e){let t=G(e);return Ve(t)}function Rl(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:vt(e[a])}),{});return $(t)}function Ol(e){return qt(X(e))}function Pl(e){let t=e.map(n=>Ve(n));return k(t)}function Ve(e){return U(e)?vl(e.items):se(e)?kl(e.$defs,e.$ref):z(e)?El(e.if,e.then,e.else):R(e)?wl(e.allOf):M(e)?Rl(e.properties):F(e)?Ol(e.items):y(e)?Pl(e.anyOf):e}function mo(e,t){return v([e])?p.Update(Ve(e),{},t):Fr(e)}function Sl(e,t,n,r){let a=d(e,t,n);return mo(a,r)}function Ml(e,t,n,r){return t.visited.includes(r)?n:r in e?d(e,N(t.callstack,[...t.visited,r]),e[r]):n}function Cl(e,t){let n=Be(e,t),r=He(n);return Ke(p.Assign(e,{[t]:r}),t)}function Al(e,t,n){let r=je(e,t,n);return He(r)}function ql(e){let t=G(e);return He(t)}function Ll(e){let t=e.map(n=>He(n));return k(t)}function jl(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:fr(e[a])}),{});return $(t)}function He(e){return se(e)?Cl(e.$defs,e.$ref):z(e)?Al(e.if,e.then,e.else):R(e)?ql(e.allOf):y(e)?Ll(e.anyOf):M(e)?jl(e.properties):$({})}function Dr(e,t={}){return h("Required",[e],t)}function Fl(e,t={}){return po(e,t)}function po(e,t){return v([e])?p.Update(He(e),{},t):Dr(e,t)}function Dl(e,t,n,r){let a=d(e,t,n);return po(a,r)}function Nr(e,t={}){return h("ReturnType",[e],t)}function Nl(e,t={}){return uo(e,t)}function CI(e){return ne(e)?e.returnType:L()}function uo(e,t){return v([e])?p.Update(CI(e),{},t):Nr(e,t)}function Kl(e,t,n,r={}){let a=d(e,t,n);return uo(a,r)}function Kr(e,t){return h("With",[e,t],{})}function Ul(e,t){return co(e,t)}function co(e,t){return v([e])?p.Update(e,{},t):Kr(e,t)}function Gl(e,t,n,r){let a=d(e,t,n);return co(a,r)}function AI(e){return ut(e)?F(e.items)?lo(e.items.items):W(e.items)?[e]:re(e.items)?[e]:[L()]:[e]}function lo(e){return e.reduce((n,r)=>[...n,...AI(r)],[])}function N(e,t){return{callstack:e,visited:t}}function v(e){return i.ShiftLeft(e,(t,n)=>re(t)?!1:v(n),()=>!0)}function Ln(e,t,n){return i.Keys(n).reduce((r,a)=>({...r,[a]:d(e,t,n[a])}),{})}function ft(e,t,n){let r=Ee(e,t,n);return lo(r)}function Ee(e,t,n){return n.map(r=>d(e,t,r))}function qI(e,t){let n=ue(e)?dn(t,{}):t,r=kt(e)?ln(n,{}):n;return Tt(e)?_n(r,{}):r}function LI(e,t,n,r,a){return i.IsEqual(n,"AddImmutable")?_l(e,t,r[0],a):i.IsEqual(n,"RemoveImmutable")?Qu(e,t,r[0],a):i.IsEqual(n,"AddReadonly")?No(e,t,r[0],a):i.IsEqual(n,"RemoveReadonly")?Ei(e,t,r[0],a):i.IsEqual(n,"AddOptional")?Ko(e,t,r[0],a):i.IsEqual(n,"RemoveOptional")?Oi(e,t,r[0],a):i.IsEqual(n,"Capitalize")?mc(e,t,r[0],a):i.IsEqual(n,"Conditional")?dc(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"ConstructorParameters")?gc(e,t,r[0],a):i.IsEqual(n,"Evaluate")?Gu(e,t,r[0],a):i.IsEqual(n,"Exclude")?yc(e,t,r[0],r[1],a):i.IsEqual(n,"Extract")?bc(e,t,r[0],r[1],a):i.IsEqual(n,"Index")?zc(e,t,r[0],r[1],a):i.IsEqual(n,"InstanceType")?Wc(e,t,r[0],a):i.IsEqual(n,"Interface")?Mu(e,t,r[0],r[1],a):i.IsEqual(n,"KeyOf")?el(e,t,r[0],a):i.IsEqual(n,"Lowercase")?pc(e,t,r[0],a):i.IsEqual(n,"Mapped")?al(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"Module")?ta(e,t,r[0],a):i.IsEqual(n,"NonNullable")?il(e,t,r[0],a):i.IsEqual(n,"Pick")?$l(e,t,r[0],r[1],a):i.IsEqual(n,"Parameters")?cl(e,t,r[0],a):i.IsEqual(n,"Partial")?hl(e,t,r[0],a):i.IsEqual(n,"Omit")?pl(e,t,r[0],r[1],a):i.IsEqual(n,"ReadonlyObject")?Sl(e,t,r[0],a):i.IsEqual(n,"Record")?Bi(e,t,r[0],r[1],a):i.IsEqual(n,"Required")?Dl(e,t,r[0],a):i.IsEqual(n,"ReturnType")?Kl(e,t,r[0],a):i.IsEqual(n,"TemplateLiteral")?Yp(e,t,r[0],a):i.IsEqual(n,"Uncapitalize")?uc(e,t,r[0],a):i.IsEqual(n,"Uppercase")?cc(e,t,r[0],a):i.IsEqual(n,"With")?Gl(e,t,r[0],r[1]):h(n,r,a)}function jI(e,t,n){let r=re(n)?Ml(e,t,n,n.$ref):U(n)?ve(d(e,t,n.items),tr(n)):Yt(n)?Qr(e,t,n.target,n.arguments):te(n)?Fe(Ee(e,t,n.parameters),d(e,t,n.instanceType),Uo(n)):ne(n)?De(Ee(e,t,n.parameters),d(e,t,n.returnType),Go(n)):z(n)?$t(d(e,t,n.if),d(e,t,n.then),d(e,t,n.else),Ho(n)):R(n)?ce(Ee(e,t,n.allOf),Qo(n)):M(n)?$(Ln(e,t,n.properties),Wo(n)):pe(n)?Wi(Se(n),d(e,t,xe(n))):ut(n)?Rt(d(e,t,n.items)):F(n)?X(ft(e,t,n.items),ki(n)):y(n)?k(Ee(e,t,n.anyOf),di(n)):n;return qI(n,r)}function d(e,t,n){return at(n)?LI(e,t,n.action,n.parameters,n.options):jI(e,t,n)}function fo(e,t){return d(e,N([],[]),t)}function FI(e){return p.Update(e,{"~immutable":!0},{})}function _n(e,t){return p.Update(FI(e),{},t)}function _l(e,t,n,r){let a=d(e,t,n);return _n(a,r)}function Vm(e,t={}){return h("AddImmutable",[e],t)}function qt(e,t={}){return _n(e,t)}function Hm(e,t={}){return h("Evaluate",[e],t)}function zl(e,t={}){return Ga(e,t)}function Ym(e,t={}){return h("Module",[e],t)}function Bl(e,t={}){return ta({},N([],[]),e,t)}function Wl(...e){let[t,n,r]=Ue.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=zp(n),s=i.IsArray(a)&&i.IsEqual(a.length,2)?d(t,N([],[]),a[0]):L();return p.Update(s,{},r)}var H={};xt(H,{Any:()=>At,Array:()=>ve,BigInt:()=>yn,Boolean:()=>sr,Call:()=>Zu,Capitalize:()=>ac,Codec:()=>ir,Conditional:()=>lc,Constructor:()=>Fe,ConstructorParameters:()=>fc,Cyclic:()=>Ke,Decode:()=>ri,DecodeBuilder:()=>xn,Dependent:()=>$t,Encode:()=>ai,EncodeBuilder:()=>gn,Enum:()=>Xo,Evaluate:()=>zl,Exclude:()=>xc,Extends:()=>me,ExtendsResult:()=>b,Extract:()=>hc,Function:()=>De,Generic:()=>ot,Identifier:()=>hn,Immutable:()=>oi,Index:()=>$c,Infer:()=>fn,InstanceType:()=>Bc,Instantiate:()=>fo,Integer:()=>Et,Interface:()=>Cu,Intersect:()=>ce,IsAny:()=>Y,IsArray:()=>U,IsBigInt:()=>_e,IsBoolean:()=>Re,IsCall:()=>Yt,IsCodec:()=>or,IsConstructor:()=>te,IsCyclic:()=>se,IsDependent:()=>z,IsEnum:()=>de,IsEnumValue:()=>Zo,IsFunction:()=>ne,IsGeneric:()=>Ct,IsIdentifier:()=>pi,IsImmutable:()=>Tt,IsInfer:()=>W,IsInteger:()=>fe,IsIntersect:()=>R,IsKind:()=>x,IsLiteral:()=>C,IsNever:()=>it,IsNull:()=>jt,IsNumber:()=>J,IsObject:()=>M,IsOptional:()=>ue,IsParameter:()=>li,IsReadonly:()=>kt,IsRecord:()=>pe,IsRef:()=>re,IsRefine:()=>da,IsRest:()=>ut,IsSchema:()=>Q,IsString:()=>ge,IsSymbol:()=>st,IsTemplateLiteral:()=>Z,IsThis:()=>br,IsTuple:()=>F,IsUndefined:()=>Gt,IsUnion:()=>y,IsUnknown:()=>ee,IsUnsafe:()=>ar,IsVoid:()=>ze,KeyOf:()=>Vc,Literal:()=>O,Lowercase:()=>oc,Mapped:()=>tl,Module:()=>Bl,Never:()=>L,NonNullable:()=>ol,Null:()=>Lt,Number:()=>Ie,Object:()=>$,Omit:()=>sl,Optional:()=>zo,Parameter:()=>wt,Parameters:()=>ul,Partial:()=>ll,Pick:()=>Il,Readonly:()=>ii,ReadonlyObject:()=>so,ReadonlyType:()=>Tl,Record:()=>yr,RecordKey:()=>Kt,RecordPattern:()=>Se,RecordValue:()=>xe,Ref:()=>Je,Refine:()=>si,Required:()=>Fl,Rest:()=>Rt,ReturnType:()=>Nl,Script:()=>Wl,String:()=>Oe,Symbol:()=>Ft,TemplateLiteral:()=>Zp,This:()=>Ir,Tuple:()=>X,Uncapitalize:()=>ic,Undefined:()=>Ut,Union:()=>k,Unknown:()=>ae,Unsafe:()=>Vo,Uppercase:()=>sc,Void:()=>$r,With:()=>Ul});var en="submit_review_report",zn="submit_test_gap_candidates",Bn="submit_filtered_test_gaps",DI=H.Object({verdict:H.Union([H.Literal("PASS"),H.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:H.String({description:"One short sentence summarizing the verdict."}),reasons:H.Array(H.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:H.Array(H.String(),{description:"Non-blocking, optional/minor observations or suggested improvements \u2014 the kind of feedback a real reviewer leaves as 'Minor/optional' without failing the task. Include these regardless of verdict; use an empty array if you truly have none."})});function Vl(e){return{name:en,label:"Submit Review Report",description:"Submit your final verdict for this review. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished reading and analyzing the relevant files. Do not write a plain-text final answer instead of calling this tool.",parameters:DI,async execute(t,n){return e.report={verdict:n.verdict,summary:n.summary,reasons:n.reasons??[],notes:n.notes??[]},{content:[{type:"text",text:`Report recorded: ${n.verdict}`}],details:void 0}}}}var NI=H.Object({gaps:H.Array(H.Object({description:H.String({description:"The specific untested behavior or edge case, in plain terms. Prefix with POSITIVE: or NEGATIVE: to indicate whether this is a missing required-behavior test or a missing forbidden/wrong-behavior test."}),risk:H.String({description:"Concretely why a plausible-but-incorrect implementation could still pass every test in test.patch despite missing, misimplementing, or violating this behavior (including doing a forbidden thing because no test asserts it must not happen)."})}),{description:"Candidate behavioral test gaps (positive and negative) grounded in agent_prompt.md or clear existing repo behavior. Use an empty array if you found none \u2014 do not manufacture gaps just to report something."})});function Hl(e){return{name:zn,label:"Submit Candidate Test Gaps",description:"Submit your candidate list of behavioral test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished reading and analyzing the relevant files.",parameters:NI,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Recorded ${r.length} candidate gap(s)`}],details:void 0}}}}var KI=H.Object({gaps:H.Array(H.Object({description:H.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:H.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 Yl(e){return{name:Bn,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:KI,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 UI={description:"Focus area: the task description in `agent_prompt.md`. Judge it strictly against rubric items P1-P5 below. You do not need to judge the tests or solution \u2014 other reviewers cover those.",tests:"Focus area: the tests added in `test.patch` (a unified diff). Judge them strictly against rubric items T1-T6 below. You cannot execute code or apply the patch, so read the diff carefully and reason about determinism, coverage, and strictness directly from the added code. Read `agent_prompt.md` for context on what behavior is in scope, and skim `solution.patch` only to understand what the tests are checking. Do not judge the description or the solution's code quality.\nMandatory symbol-fairness check: for every non-trivial method/function/property/export name that a test calls, mutates, mocks, or asserts on, use grep/read on the repository (the pre-existing code, not solution.patch) to confirm it actually exists there, OR confirm it is explicitly named in `agent_prompt.md`. Pay special attention to any such name that is new/invented and that duplicates, shadows, or conflicts with an existing, differently-named public API doing the same thing (e.g. a test calling `setFoo(...)` when the repo's real, visible API is `setBar(...)`) \u2014 that is a textbook unfair/undiscoverable test per the fairness methodology, and is blocking on its own even if every other test in the patch is fine.",solution:"Focus area: the golden solution in `solution.patch` (a unified diff). Judge it strictly against rubric items S1-S4 below. Read `agent_prompt.md` for the requirements and `test.patch` to see what must pass, and use read/grep/ls/find on the rest of the repository to check for regressions, inconsistent style, and irrelevant/unexplained changes. Do not judge the description's wording or the tests' coverage.\nMandatory dead-code check: scan every added/changed line in `solution.patch` for unused code \u2014 variables, parameters, imports, functions/methods, or fields that are declared/assigned but never read or called anywhere (including by `test.patch`) \u2014 and for dead/unreachable code (branches, conditions, or statements that can never execute, or code left behind after a return/throw/break that makes it unreachable). Use grep to confirm a symbol truly has no other usages in the repo before flagging it. This is a rubric S4 violation and is blocking on its own, even if the rest of the solution is otherwise excellent."};function Jl(e,t,n){let r=["You are a careful, calibrated reviewer for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root may contain: `agent_prompt.md` (the task description), `test.patch` (unified diff adding tests), and `solution.patch` (unified diff of the golden solution). Read whichever are relevant to your focus, and read the rest of the repository as needed via grep/read/ls/find to judge things against real repo context.","",UI[e.key],"","Checklist for your focus area:",t];return n&&r.push("","Fairness methodology (use this to judge whether an issue is actually blocking, and to distinguish agent-fault from prompt-ambiguity from test-flaw problems):",n),r.push("","How to set the verdict \u2014 calibrate, don't nitpick:","FAIL only for a genuine BLOCKING issue: a checklist item is clearly violated, a requirement stated in `agent_prompt.md` is untested or contradicted, a test asserts something unfair/undiscoverable per the fairness methodology above (private internals, exact class names not in the prompt, exact call order, reference-solution-only structure, etc.), a test is genuinely non-deterministic in a way that risks real CI flakiness (real network calls, unseeded randomness, race-prone ordering), or the solution has a real regression, missing requirement, or unrelated/unexplained change.","Do NOT fail for: optional coverage suggestions, 'would also be nice to test X', dead/unused code that doesn't affect correctness, minor style inconsistencies, or defensible implementation choices the prompt didn't forbid. These are exactly the kind of thing a real reviewer leaves as a 'Minor/optional' note without failing the task \u2014 put them in `notes` and still return PASS.","When genuinely torn between PASS and FAIL, default to PASS with the concern captured in `notes`, unless the issue would let a materially incorrect agent solution pass the hidden tests, or would unfairly fail a correct one \u2014 that is always blocking.","A single blocking issue is enough to FAIL, even if it affects only one test or one line out of many, and even if the rest of the suite is excellent. Do NOT average it away or let a large, otherwise-strong test suite talk you into a PASS \u2014 one unfair or undiscoverable test (e.g. requiring a private/invented API name that doesn't exist in the repo and isn't named in the prompt, especially one that conflicts with an existing, differently-named public API) is exactly as blocking as many.","",`When you are done analyzing, call the \`${en}\` tool exactly once with your structured verdict. That tool call is your only way to report a result.`),r.join(`
8
- `)}function Zl(e,t){let n=["You are an exhaustive, research-minded test-coverage analyst for a coding-agent benchmark task. Your mandate is to dig as deep as possible and surface EVERY genuine behavioral test gap you can find \u2014 positive AND negative \u2014 not just the first one or two obvious ones. Treat a short list as a signal that you stopped too early, not as success.","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).","","Your job: find real BEHAVIORAL TEST GAPS \u2014 both positive and negative. A gap is required or clearly-implied behavior from `agent_prompt.md` (and, where relevant, obvious existing repo conventions) that `test.patch` does NOT actually verify \u2014 such that a plausible alternative implementation could satisfy `agent_prompt.md` on its face, differ from `solution.patch`, get that behavior wrong or skip it entirely, and STILL pass every test in `test.patch` as written.","","Coverage must include BOTH directions:","- POSITIVE gaps: required behavior that should happen but is never asserted (the happy path, side effects, state changes, outputs, or transitions the prompt requires).","- NEGATIVE gaps: forbidden behavior, invalid states, or wrong outcomes that should NOT happen but are never asserted against. These are often the most dangerous holes: an agent can violate `agent_prompt.md` in a material way \u2014 doing something it must not do, leaving something enabled when it should be disabled, applying an effect to the wrong target, skipping a guard, or accepting invalid input \u2014 and still pass every test if the suite only checks that the correct action works, not that incorrect actions are rejected.","","Be systematic and exhaustive \u2014 do not stop after finding one or two gaps. Work through ALL of the following passes before you consider yourself done:","1. Go through `agent_prompt.md` sentence by sentence. For every distinct requirement, constraint, or implied rule, explicitly check which test(s) in `test.patch` exercise it, and how thoroughly \u2014 both the required outcome AND any paired forbidden/wrong outcome.","2. Go through `solution.patch` branch by branch \u2014 every conditional, loop, early return, error path, guard, and state transition. For each one, ask whether `test.patch` actually forces that branch to be taken and its outcome checked, or whether an implementation that got that branch wrong would still pass.","3. Systematically consider standard edge-case categories against the required behavior: boundary/limit values, empty/missing/null/zero inputs, duplicate or repeated inputs, ordering and interleaving, concurrent or repeated invocations, error/failure/rollback paths, interaction between two or more required behaviors at once (not just each in isolation), and state left behind after an operation.","4. Cross-check overlapping/interacting requirements \u2014 behaviors that are each tested alone but never tested together \u2014 since that's exactly where a plausible-looking but incomplete implementation slips through.","5. NEGATIVE-CASE PASS (mandatory \u2014 do not skip): re-read `agent_prompt.md` specifically for prohibitions, conditions, guards, and 'only when' / 'must not' / 'never' / 'disabled when' / 'should not' language. For each one, ask: does `test.patch` assert that the WRONG thing does NOT happen? Examples of negative gaps:"," - A control that must be disabled/unavailable in a given state, but no test ever drives that state and asserts it stays disabled (an agent could leave it always enabled)."," - An operation that must NOT affect a separate scope/target (isolation, cross-contamination), but tests only verify the correct scope changes \u2014 never that the wrong scope is untouched."," - A side effect that must NOT occur (no duplicate entries, no spurious history step, no refresh on no-op), but tests never trigger the scenario where a sloppy implementation would create one."," - Invalid, out-of-order, or repeated input that should be ignored/rejected/coalesced differently, but tests never assert the incorrect handling would fail."," - A rollback/undo boundary where the first action must NOT be undoable, or redo must NOT be available when nothing was undone \u2014 but tests only exercise the happy undo/redo path."," - Mutual exclusion: two behaviors required to stay independent, but no test proves doing A does not silently change B.","For every prompt requirement, ask BOTH: 'Is the correct behavior tested?' AND 'Is there a corresponding test that would catch an agent doing the opposite, the forbidden thing, or applying it in the wrong context?' If only the first is tested, the second is a gap.","Do not filter yourself or self-censor for volume. List every gap that survives your own check against the ground rules below \u2014 a long, thorough list is expected and desired. A separate, independent agent will strictly filter this list afterward, so your job here is coverage and recall, not brevity.","","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.","- Negative gaps must be grounded in an explicit or clearly implied prohibition/constraint in `agent_prompt.md` \u2014 not generic 'more negative tests would be nice'. The forbidden outcome must be part of the task contract.","- 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). A single test that asserts both the positive outcome AND that the forbidden/wrong outcome did not occur counts as covered.","","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",e];return t&&n.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),n.push("","For each gap, describe: (1) the specific untested behavior/edge case \u2014 say explicitly if it is a POSITIVE gap (required behavior never verified) or a NEGATIVE gap (forbidden/wrong behavior never asserted against) \u2014 in plain terms, and (2) concretely why a plausible-but-incorrect implementation would still pass every given test despite missing, misimplementing, or violating this requirement.",`When you are done \u2014 after completing ALL the passes above \u2014 call the \`${zn}\` tool exactly once with your full candidate list (empty only if, after genuinely exhaustive analysis, none exist). That tool call is your only way to report a result.`),n.join(`
9
- `)}function Xl(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.","Another research agent reviewed this same task (`agent_prompt.md`, `test.patch`, `solution.patch`, and the repo) and proposed the following CANDIDATE test gaps \u2014 required-but-untested behaviors (positive and negative) it believes are missing from `test.patch`:","",JSON.stringify(e,null,2),"","Your job is to independently re-verify the files yourself and FILTER this list down to only candidates that are ALL of the following:","1. Genuinely grounded \u2014 actually required by a specific statement in `agent_prompt.md`, or unambiguous from clearly visible, existing repo behavior. Drop anything speculative, nice-to-have, or invented beyond what the prompt actually asks for.","2. Fair to test \u2014 verifying it would not require undiscoverable private internals, an invented/unnamed API, or exact incidental structure that only `solution.patch` happens to use. Judge this precisely against the fairness methodology below.","3. A real, distinct coverage hole \u2014 re-check `test.patch` yourself; drop any candidate an existing test already covers, and drop near-duplicate candidates (keep only the clearest phrasing of each distinct gap). For negative-case candidates, keep them only if `test.patch` does not already assert that the forbidden/wrong outcome does not occur.","","Be strict: when genuinely unsure whether a candidate holds up, drop it rather than keep it. It is fine \u2014 expected, even \u2014 to return an empty list if none of the candidates survive scrutiny.","","Checklist for the tests focus area, for calibration:",t];return 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.",`When you are done, call the \`${Bn}\` 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(`
10
- `)}var Ql=900*1e3,yo=["read","grep","find","ls"];async function ho(e,t){let n=t.aborted?"cancelled":"done";return await Promise.race([e().then(()=>{t.aborted||(n="done")}),new Promise(r=>{setTimeout(()=>{n="timedOut",r()},Ql)}),new Promise(r=>{if(t.aborted)return r();t.addEventListener("abort",()=>{n="cancelled",r()},{once:!0})})]),n}async function ed(e){let t={},n=e.model,{session:r}=await go({cwd:e.tempDir,model:n,thinkingLevel:e.thinkingLevel==="off"?void 0:e.thinkingLevel,tools:[...yo,en],customTools:[Vl(t)],sessionManager:xo.inMemory()});try{let a=await ho(async()=>{await r.prompt(Jl(e.role,e.rubric,e.fairnessRules))},e.cancelSignal);if(a==="cancelled")return await r.abort(),{verdict:"FAIL",summary:`${e.role.label} reviewer cancelled`,reasons:["Cancelled by user."],notes:[]};if(a==="timedOut")return await r.abort(),{verdict:"FAIL",summary:`${e.role.label} reviewer timed out`,reasons:[`Reviewer did not finish within ${Ql/1e3}s.`],notes:[]}}catch(a){return{verdict:"FAIL",summary:`${e.role.label} reviewer errored`,reasons:[`Reviewer agent failed: ${a instanceof Error?a.message:String(a)}`],notes:[]}}return t.report?t.report:{verdict:"FAIL",summary:`${e.role.label} reviewer did not submit a report`,reasons:[`The reviewer agent finished without calling ${en}.`],notes:[]}}async function td(e){let t={},n=e.model,{session:r}=await go({cwd:e.tempDir,model:n,thinkingLevel:e.thinkingLevel==="off"?void 0:e.thinkingLevel,tools:[...yo,zn],customTools:[Hl(t)],sessionManager:xo.inMemory()});try{let a=await ho(async()=>{await r.prompt(Zl(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 nd(e){let t={},n=e.model,{session:r}=await go({cwd:e.tempDir,model:n,thinkingLevel:e.thinkingLevel==="off"?void 0:e.thinkingLevel,tools:[...yo,Bn],customTools:[Yl(t)],sessionManager:xo.inMemory()});try{let a=await ho(async()=>{await r.prompt(Xl(e.candidates,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:[]}}import{existsSync as oa,mkdirSync as GI,readFileSync as Io,writeFileSync as _I}from"node:fs";import{dirname as zI,join as rd}from"node:path";import{getAgentDir as ad}from"@earendil-works/pi-coding-agent";var ra=rd(ad(),"checks-config.json"),aa=rd(ad(),"settings.json"),BI=["off","minimal","low","medium","high","xhigh","max"];function od(e){return e?.reasoning?BI.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t==="xhigh"||t==="max"?n!==void 0:!0}):["off"]}function bo(){try{if(!oa(ra))return null;let e=JSON.parse(Io(ra,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function id(e){let t=zI(ra);oa(t)||GI(t,{recursive:!0}),_I(ra,JSON.stringify(e,null,2),"utf-8")}function sd(){try{return oa(aa)?JSON.parse(Io(aa,"utf-8")).enabledModels??[]:[]}catch{return[]}}function md(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function WI(){try{if(oa(aa))return JSON.parse(Io(aa,"utf-8"))}catch{}return{}}function pd(){let e=WI().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function VI(e){return e.replace(/\\/g,"/")}function HI(e){return`'${e.replace(/'/g,"'\\''")}'`}async function ud(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 ${HI(VI(n))}`,s=await e.exec(pd(),["-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 Me="checks_progress";function et(e,t,n){let r=n>0?Math.min(1,t/n):0,a=Math.round(24*r),s="\u2588".repeat(a)+"\u2591".repeat(Math.max(0,24-a));return[`checks: ${e} [${s}] ${t}/${n}`]}import{existsSync as YI,readFileSync as JI}from"node:fs";var tt=[{key:"description",label:"Description",rubricHeading:/^## The problem description/i},{key:"tests",label:"Tests",rubricHeading:/^## The tests/i},{key:"solution",label:"Solution",rubricHeading:/^## The solution/i}];var $o=["agent_prompt.md","solution.patch","test.patch"];function cd(e){try{if(!YI(e))return{};let t=JSON.parse(JI(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function ld(e){let{existingReport:t,config:n,runReviewers:r,byRole:a,runGapStages:s,testGaps:m,gapAnalysisIncomplete:c,gapFinderStatus:l,gapFilterStatus:I}=e,f={...t,timestamp:new Date().toISOString(),model:`${n.provider}/${n.modelId}`,thinkingLevel:n.thinkingLevel};if(r){let j={...t.reports&&typeof t.reports=="object"?t.reports:{},...a};f.reports=j,tt.every(ie=>j[ie.key])?f.overall=tt.every(ie=>j[ie.key].verdict==="PASS")?"PASS":"FAIL":delete f.overall}return s&&(f.testGaps=m,c?f.testGapAnalysisNote=`Gap analysis did not fully complete (finder: ${l}, filter: ${I}); testGaps may be incomplete.`:delete f.testGapAnalysisNote),f}function dd(e){let{merged:t,runReviewers:n,activeRoles:r,byRole:a,runGapStages:s}=e,m=typeof t.overall=="string"?t.overall:void 0,c=Array.isArray(t.testGaps)?t.testGaps.length:0,l=n?Object.fromEntries(r.filter(f=>a[f.key]).map(f=>[f.key,a[f.key].verdict])):void 0,I=[];if(l&&I.push(r.map(f=>`${f.label}: ${l[f.key]??"?"}`).join(", ")),m){let f=m==="PASS"&&c>0?" (with test gaps)":"";I.push(`Overall: ${m}${f}`)}return s&&I.push(c>0?`${c} test gap(s) found`:"no test gaps found"),{content:`Checks: ${I.join(" | ")}`,details:{overall:m,hasTestGaps:c>0,gapsCount:c,roleVerdicts:l,showGaps:s}}}var fd=`## The problem description (aka the task)\r
7
+ `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),Wp=(e,t=[])=>o(o(ja(e),([n,r])=>o(Mx(r),([a,s])=>[[n,a],s])),([n,r])=>Wp(r,[...t,n]),()=>[t,e]),Cx=e=>o(o(Wp(e),([t,n])=>o(o(o(ja(n),([r,a])=>[[r],a]),([r,a])=>[r,a],()=>o([[],n],([r,a])=>[r,a],()=>[])),([r,a])=>[[t,r],a])),([t,n])=>[Hm(t),n]),ja=e=>o(o(Sx(e),([t,n])=>o(o(wx(n),([r,a])=>[r,a],()=>o(Rx(n),([r,a])=>[r,a],()=>o(Ox(n),([r,a])=>[r,a],()=>o(Px(n),([r,a])=>[r,a],()=>[])))),([r,a])=>o(bp(a),([s,m])=>[[t,r,s],m]))),([t,n])=>[Ym(t),n]),Ax=e=>o(o(ja(e),([t,n])=>o(Cx(n),([r,a])=>[[t,r],a])),([t,n])=>[Jm(t),n]),Hp=e=>o(o(Ax(e),([t,n])=>[t,n],()=>o(Lh(e),([t,n])=>[t,n],()=>o(w(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function Yp(e){let t=Ca(`\`${e}\``);return i.IsEqual(t.length,2)?t[0]:W()}function Lx(e){return e.join("|")}function jx(e){return e.slice(1,e.length-1)}function Fx(e,t,n){return dt(t,`${n}${e}`)}function Dx(e,t){return dt(e,`${t}${li}`)}function Nx(e,t){return dt(e,`${t}${mr}`)}function Kx(e,t){return dt(e,`${t}${ur}`)}function Ux(e,t){return An(k([O("false"),O("true")]),e,t)}function Gx(e,t){return dt(e,`${t}${cr}`)}function _x(e,t,n){return dt(t,`${n}${jx(e)}`)}function zx(e,t,n){let r=qn(e,{});return An(r,t,n)}function Bx(e,t,n){let r=Ee(e);return An(r,t,n)}function Jp(e,t,n,r=[]){return i.ShiftLeft(e,(a,s)=>Jp(s,t,n,[...r,An(a,[],"")]),()=>dt(t,`${n}(${Lx(r)})`))}function An(e,t,n){return de(e)?Bx(e.enum,t,n):fe(e)?Nx(t,n):A(e)?Fx(e.const,t,n):ze(e)?Dx(t,n):Se(e)?Ux(t,n):J(e)?Kx(t,n):ge(e)?Gx(t,n):Z(e)?_x(e.pattern,t,n):Xp(e)?zx(e.parameters[0],t,n):x(e)?Jp(e.anyOf,t,n):Wo}function dt(e,t){return i.ShiftLeft(e,(n,r)=>An(n,r,t),()=>t)}function Vx(e){return`^${dt(e,"")}$`}function Zp(e){let t=Vx(e);return dr(t)}function qn(e,t){return T(e)?p.Update(Zp(e),{},t):vr(e,t)}function Qp(e,t,n,r){let a=we(e,t,n);return qn(a,r)}function vr(e,t={}){return y("TemplateLiteral",[e],t)}function Xp(e){return Q(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"TemplateLiteral")}function eu(e){return qn(e,{})}function Wx(e){let t=Yp(e);return eu(t)}function tu(e,t={}){let n=i.IsString(e)?Wx(e):eu(e);return p.Update(n,{},t)}function Z(e){return h(e,"TemplateLiteral")}var b={};yt(b,{ExtendsFalse:()=>v,ExtendsTrue:()=>g,ExtendsUnion:()=>Fa,IsExtendsFalse:()=>Hx,IsExtendsTrue:()=>ru,IsExtendsTrueLike:()=>Ht,IsExtendsUnion:()=>nu,Match:()=>K});function Fa(e){return p.Create({"~kind":"ExtendsUnion"},{inferred:e})}function nu(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 ru(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.HasPropertyKey(e,"inferred")&&i.IsEqual(e["~kind"],"ExtendsTrue")&&i.IsObject(e.inferred)}function v(){return p.Create({"~kind":"ExtendsFalse"},{})}function Hx(e){return i.IsObject(e)&&i.HasPropertyKey(e,"~kind")&&i.IsEqual(e["~kind"],"ExtendsFalse")}function Ht(e){return nu(e)||ru(e)}function K(e,t,n){return Ht(e)?t(e.inferred):n()}function Yx(e,t,n,r){return K(S(e,n,r),a=>g(p.Assign(p.Assign(e,a),{[t]:n})),()=>v())}function Jx(e,t){return g(e)}function Zx(e,t,n,r,a){return K(S(e,t,n),s=>K(S(s,t,r),m=>g(m),()=>v()),()=>K(S(e,t,a),s=>g(s),()=>v()))}function Xx(e,t,n){let r=Ee(n);return S(e,t,r)}function au(e,t,n){return i.ShiftLeft(n,(r,a)=>K(S(e,t,r),s=>au(s,t,a),()=>v()),()=>g(e))}function Qx(e,t,n){let r=ye(n);return S(e,t,r)}function ou(e,t,n){return i.ShiftLeft(n,(r,a)=>K(S(e,t,r),s=>g(s),()=>ou(e,t,a)),()=>v())}function q(e,t,n){return Y(n)?Jx(e,t):z(n)?Zx(e,t,n.if,n.then,n.else):de(n)?Xx(e,t,n.enum):V(n)?Yx(e,n.name,t,n.extends):R(n)?au(e,t,n.allOf):Z(n)?Qx(e,t,n.pattern):x(n)?ou(e,t,n.anyOf):ee(n)?g(e):v()}function iu(e,t,n){return V(n)?q(e,t,n):Y(n)?g(e):ee(n)?g(e):Fa(e)}function ey(e,t){let n=kt(e),r=kt(t);return n&&r||!n&&r?!0:!(n&&!r)}function su(e,t,n,r){return U(r)?ey(t,r)?S(e,n,r.items):v():q(e,t,r)}function mu(e,t,n){return ze(n)?g(e):q(e,t,n)}function pu(e,t,n){return Se(n)?g(e):q(e,t,n)}function ty(e,t,n,r,a){let s=V(r)?t:r,m=V(r)?r:t,c=ce(t),l=ce(r);return!c&&l?v():K(S(e,s,m),I=>Ln(I,n,a),()=>v())}function ny(e,t,n,r){return i.ShiftLeft(r,(a,s)=>ty(e,t,n,a,s),()=>ce(t)?g(e):v())}function ry(e,t,n){return i.ShiftLeft(t,(r,a)=>ny(e,r,a,n),()=>g(e))}function Ln(e,t,n){return ry(e,t,n)}function Yr(e,t,n){return Be(n)?g(e):S(e,t,n)}function uu(e,t,n,r){return Y(r)?g(e):ee(r)?g(e):ne(r)?K(Ln(e,t,r.parameters),a=>Yr(a,n,r.instanceType),()=>v()):v()}function cu(e,t,n,r,a){return K(S(e,t,a),()=>S(e,n,a),()=>S(e,r,a))}function lu(e,t,n){let r=Ee(t);return S(e,r,n)}function du(e,t,n,r){return Y(r)?g(e):ee(r)?g(e):re(r)?K(Ln(e,t,r.parameters),a=>Yr(a,n,r.returnType),()=>v()):v()}function fu(e,t,n){return fe(n)?g(e):J(n)?g(e):q(e,t,n)}function gu(e,t,n){let r=G(t);return S(e,r,n)}function Jr(e,t,n){return t===n?g(e):v()}function ay(e,t,n){return A(n)?Jr(e,t,n.const):ze(n)?g(e):q(e,O(t),n)}function oy(e,t,n){return A(n)?Jr(e,t,n.const):Se(n)?g(e):q(e,O(t),n)}function iy(e,t,n){return A(n)?Jr(e,t,n.const):J(n)?g(e):q(e,O(t),n)}function sy(e,t,n){return A(n)?Jr(e,t,n.const):ge(n)?g(e):q(e,O(t),n)}function hu(e,t,n){return i.IsBigInt(t.const)?ay(e,t.const,n):i.IsBoolean(t.const)?oy(e,t.const,n):i.IsNumber(t.const)?iy(e,t.const,n):i.IsString(t.const)?sy(e,t.const,n):W()}function xu(e,t,n){return V(n)?q(e,t,n):g(e)}function yu(e,t,n){return Dt(n)?g(e):q(e,t,n)}function Iu(e,t,n){return J(n)?g(e):q(e,t,n)}function my(e,t,n){return ce(t)?ce(n)?g(e):v():g(e)}function py(e,t,n){return V(n)&&it(n.extends)?v():K(S(e,t,n),r=>my(r,t,n),()=>v())}function uy(e,t){return e.reduce((n,r)=>r in t?Ht(t[r])?{...n,...t[r].inferred}:W():W(),{})}function cy(e,t,n){let r={};for(let m of i.Keys(n))r[m]=m in t?py({},t[m],n[m]):ce(n[m])?V(n[m])?g(p.Assign(e,{[n[m].name]:n[m].extends})):g(e):v();let a=i.Values(r).every(m=>Ht(m)),s=a?uy(i.Keys(r),r):{};return a?g(s):v()}function ly(e,t,n){let r=cy(e,t,n);return Ht(r)?g(p.Assign(e,r.inferred)):v()}function dy(e,t,n){return ly(e,t,n)}function fy(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 bu(e,t,n,r){return i.ShiftLeft(t,(a,s)=>K(S({},e[a],n),m=>bu(e,s,n,fy(r,m)),()=>v()),()=>g(r))}function gy(e,t,n,r){let a=i.Keys(t);return bu(t,a,r,e)}function $u(e,t,n){return ue(n)?gy(e,t,Ae(n),he(n)):C(n)?dy(e,t,n.properties):q(e,$(t),n)}function hy(e,t){return i.IsEqual(i.Keys(t).length,0)?g(e):v()}function xy(e,t,n,r,a){return S(e,n,a)}function vu(e,t,n,r){return ue(r)?xy(e,yr(t),n,yr(Ae(r)),he(r)):C(r)?hy(e,r.properties):Y(r)?g(e):ee(r)?g(e):v()}function Tu(e,t,n){return ge(n)?g(e):q(e,t,n)}function ku(e,t,n){return st(n)?g(e):q(e,t,n)}function Eu(e,t,n){let r=ye(t);return S(e,r,n)}function Da(e,t){return p.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function jn(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 Na(e){return ut(e)?V(e.items)?U(e.items.extends)?Da(e.items.name,e.items.extends.items):ee(e.items.extends)?Da(e.items.name,e.items.extends):void 0:W():void 0}function Zr(e){return V(e)?Da(e.name,e.extends):void 0}function Ka(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>K(S({},r,t),()=>Ka(a,t,[...n,r]),()=>{}),()=>n)}function wu(e,t,n,r){let a=Ka(n,r);return i.IsArray(a)?g(p.Assign(e,{[t]:X(a)})):v()}function Xr(e,t,n,r){let a=Ka(n,r);return i.IsArray(a)?g(p.Assign(e,{[t]:k(a)})):v()}function yy(e){return[...e].reverse()}function Ua(e,t){return t?yy(e):e}function Iy(e){let t=e.length>0?e[0]:void 0,n=Q(t)?Na(t):void 0;return Q(n)}function by(e,t,n,r,a,s){return K(S(e,n,a),m=>Ru(m,t,r,s),()=>v())}function $y(e,t,n,r,a){let s=Na(r);return jn(s)?wu(e,s.name,Ua(n,t),s.type):i.ShiftLeft(n,(m,c)=>by(e,t,m,c,r,a),()=>v())}function vy(e,t,n,r){return i.ShiftLeft(r,(a,s)=>$y(e,t,n,a,s),()=>i.IsEqual(n.length,0)?g(e):v())}function Ru(e,t,n,r){return vy(e,t,n,r)}function Ty(e,t,n){let r=ft(e,D([],[]),n),a=Iy(r);return Ru(e,a,Ua(t,a),Ua(r,a))}function Ou(e,t,n){let r=Zr(n);return jn(r)?Xr(e,r.name,t,r.type):i.ShiftLeft(t,(a,s)=>K(S(e,a,n),m=>Ou(m,s,n),()=>v()),()=>g(e))}function Pu(e,t,n){let r=ft(e,D([],[]),t);return j(n)?Ty(e,r,n.items):U(n)?Ou(e,r,n.items):q(e,X(r),n)}function Su(e,t,n){return Be(n)?g(e):zt(n)?g(e):q(e,t,n)}function Mu(e,t,n){return i.ShiftLeft(n,(r,a)=>K(S(e,t,r),s=>g(s),()=>Mu(e,t,a)),()=>v())}function Ga(e,t,n){return i.ShiftLeft(t,(r,a)=>K(Mu(e,r,n),s=>Ga(s,a,n),()=>v()),()=>g(e))}function Cu(e,t,n){let r=Zr(n);return jn(r)?Xr(e,r.name,t,r.type):x(n)?Ga(e,t,n.anyOf):Ga(e,t,[n])}function Au(e,t,n){return V(n)?q(e,t,n):Y(n)?g(e):ee(n)?g(e):v()}function qu(e,t,n){return Be(n)?g(e):q(e,t,n)}function S(e,t,n){return Y(t)?iu(e,t,n):U(t)?su(e,t,t.items,n):ze(t)?mu(e,t,n):Se(t)?pu(e,t,n):ne(t)?uu(e,t.parameters,t.instanceType,n):z(t)?cu(e,t.if,t.then,t.else,n):de(t)?lu(e,t.enum,n):re(t)?du(e,t.parameters,t.returnType,n):fe(t)?fu(e,t,n):R(t)?gu(e,t.allOf,n):A(t)?hu(e,t,n):it(t)?xu(e,t,n):Dt(t)?yu(e,t,n):J(t)?Iu(e,t,n):C(t)?$u(e,t.properties,n):ue(t)?vu(e,Ae(t),he(t),n):ge(t)?Tu(e,t,n):st(t)?ku(e,t,n):Z(t)?Eu(e,t.pattern,n):j(t)?Pu(e,t.items,n):zt(t)?Su(e,t,n):x(t)?Cu(e,t.anyOf,n):ee(t)?Au(e,t,n):Be(t)?qu(e,t,n):v()}function ky(e,t){return G([...e,$(t)])}function _a(e,t,n){return T(e)?p.Update(ky(e,t),{},n):On(e,t,n)}function Lu(e,t,n,r,a){let s=we(e,t,n),m=Fn(e,t,r);return _a(s,m,a)}function On(e,t,n={}){return y("Interface",[e,t],n)}function Yt(e){return Q(e)&&i.HasPropertyKey(e,"action")&&i.IsEqual(e.action,"Interface")}function ju(e,t,n={}){return _a(e,t,n)}function Ey(e,t,n){return e.includes(n)?!0:Dn([...e,n],t,t[n])}function Fu(e,t,n){let r=rr(n);return Mt(e,t,r)}function Mt(e,t,n){return i.ShiftLeft(n,(r,a)=>Dn(e,t,r)?!0:Mt(e,t,a),()=>!1)}function Dn(e,t,n){return ae(n)?Ey(e,t,n.$ref):U(n)?Dn(e,t,n.items):ne(n)?Mt(e,t,[...n.parameters,n.instanceType]):re(n)?Mt(e,t,[...n.parameters,n.returnType]):Yt(n)?Fu(e,t,n.parameters[1]):R(n)?Mt(e,t,n.allOf):C(n)?Fu(e,t,n.properties):x(n)?Mt(e,t,n.anyOf):j(n)?Mt(e,t,n.items):ue(n)?Dn(e,t,he(n)):!1}function Du(e,t,n){return Dn(e,t,n)}function wy(e,t){return t.reduce((n,r)=>Du([r],e,e[r])?[...n,r]:n,[])}function Nu(e){let t=nr(e);return wy(e,t)}function Ry(e,t,n){return n.includes(t)?n:t in e?Nn(e,e[t],[...n,t]):W()}function Ku(e,t,n){let r=rr(t);return Jt(e,r,n)}function Jt(e,t,n){return t.reduce((r,a)=>Nn(e,a,r),n)}function Nn(e,t,n){return ae(t)?Ry(e,t.$ref,n):U(t)?Nn(e,t.items,n):ne(t)?Jt(e,[...t.parameters,t.instanceType],n):re(t)?Jt(e,[...t.parameters,t.returnType],n):Yt(t)?Ku(e,t.parameters[1],n):R(t)?Jt(e,t.allOf,n):C(t)?Ku(e,t.properties,n):x(t)?Jt(e,t.anyOf,n):j(t)?Jt(e,t.items,n):ue(t)?Nn(e,he(t),n):n}function Uu(e,t,n){return Nn(e,n,[t])}function Oy(e){return Lt()}function Py(e){return i.Keys(e).reduce((t,n)=>({...t,[n]:Ct(e[n])}),{})}function Kn(e){return e.reduce((t,n)=>[...t,Ct(n)],[])}function Ct(e){return ae(e)?Oy(e.$ref):U(e)?ke(Ct(e.items),tr(e)):ne(e)?De(Kn(e.parameters),Ct(e.instanceType)):re(e)?Ne(Kn(e.parameters),Ct(e.returnType)):R(e)?le(Kn(e.allOf)):C(e)?$(Py(e.properties)):ue(e)?xr(Gt(e),Ct(he(e))):x(e)?k(Kn(e.anyOf)):j(e)?X(Kn(e.items)):e}function Sy(e,t){return t in e?Ct(e[t]):oe()}function Gu(e){return Sy(e.$defs,e.$ref)}function My(e,t,n){let r=we(e,D([],[]),t),a=Fn({},D([],[]),n);return G([...r,$(a)])}function Cy(e,t){return i.Keys(e).filter(r=>t.includes(r)).reduce((r,a)=>{let s=e[a],m=Yt(s)?My(e,s.parameters[0],s.parameters[1]):s;return{...r,[a]:m}},{})}function _u(e,t,n){let r=Uu(e,t,n),a=Cy(e,r);return Ue(a,t)}function zu(e,t){return t in e?ae(e[t])?zu(e,e[t].$ref):e[t]:L()}function Ve(e,t){return zu(e,t)}function Bu(e){return me(e)?Gu(e):ar(e)?oe():e}function pe(e,t,n){let r=Bu(t),a=Bu(n);return S(e,r,a)}var vn="equal",Ay="disjoint",Tn="left-inside",kn="right-inside";function Kt(e,t){let n=[ee(e)?b.ExtendsFalse():pe({},e,t),ee(e)?b.ExtendsTrue({}):pe({},t,e)];return b.IsExtendsTrueLike(n[0])&&b.IsExtendsTrueLike(n[1])?vn:b.IsExtendsTrueLike(n[0])&&b.IsExtendsFalse(n[1])?Tn:b.IsExtendsFalse(n[0])&&b.IsExtendsTrueLike(n[1])?kn:Ay}function qy(e,t){return t.filter(n=>Kt(e,n)!==kn)}function Ly(e,t){let n=t.some(r=>{let a=Kt(e,r);return i.IsEqual(a,Tn)||i.IsEqual(a,vn)});return i.IsEqual(n,!1)}function jy(e,t){let n=Ce(e);return Y(n)?[n]:Ly(n,t)?[...qy(n,t),n]:t}function Fy(e){return e.reduce((t,n)=>C(n)?[...t,n]:it(n)?t:jy(n,t),[])}function $a(e){let t=Fy(e);return wn(t)}function za(e,t){return p.Update(Ce(e),{},t)}function Vu(e,t,n,r){let a=d(e,t,n);return za(a,r)}function Un(e,t=[]){return at(e)&&i.IsEqual(e.action,"Conditional")?ae(e.parameters[0])?Un(e.parameters[2],Un(e.parameters[3],[...t,e.parameters[0].$ref])):Un(e.parameters[2],Un(e.parameters[3],t)):at(e)&&i.IsEqual(e.action,"Mapped")&&at(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 Dy(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function Yu(e,t,n=[]){return i.ShiftLeft(e,(r,a)=>i.ShiftLeft(t,(s,m)=>Yu(a,m,[...n,[s,r]]),()=>n),()=>n)}function Ny(e){return x(e)?[...e.anyOf]:[e]}function Ky(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function Wu(e,t){return t.reduce((n,r)=>[...n,...Ky(e,r)],[])}function Hu(e){return e.reduce((t,n)=>i.IsEqual(n[0],!0)?Wu(t,Ny(n[1])):Wu(t,[n[1]]),[[]])}function Ju(e,t,n){let r=Un(n),a=Dy(e,r),s=Yu(t,a);return at(n)&&i.IsEqual(n.action,"Conditional")||at(n)&&i.IsEqual(n.action,"Mapped")?Hu(s):[t]}function Uy(){return["(not-resolvable)",L()]}function Gy(){return["(not-generic)",L()]}function _y(e,t,n){return[e,ot(t,n)]}function zy(e,t,n){return t in e?Zu(e,t,e[t],n):Uy()}function Zu(e,t,n,r){return qt(n)?_y(t,n.parameters,n.expression):ae(n)?zy(e,n.$ref,r):Gy()}function Xu(e,t,n){return Zu(e,"(anonymous)",t,n)}function By(e,t,n){if(V(t)||Zt(t)||b.IsExtendsTrueLike(pe({},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 Qu(e,t,n,r,a){let s=d(e,t,a);return By(n,s,r),p.Assign(e,{[n]:s})}function Vy(e,t,n,r,a){let s=d(e,t,n.extends),m=d(e,t,n.equals);return i.ShiftLeft(a,(c,l)=>Ba(Qu(e,t,n.name,s,c),t,r,l),()=>Ba(Qu(e,t,n.name,s,m),t,r,[]))}function Ba(e,t,n,r){return i.ShiftLeft(n,(a,s)=>Vy(e,t,a,s,r),()=>e)}function ec(e,t,n,r){return Ba(e,t,n,r)}function Wy(e){return i.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function Hy(e,t){return i.IsEqual(Wy(e),t)}function Yy(e,t,n,r,a,s){let m=ec(e,t,r,s),c=d(m,D([...t.callstack,n.$ref],t.visited),a);return d(m,D([],[]),c)}function Jy(e,t,n,r,a,s){return s.reduce((m,c)=>[...m,Yy(e,t,n,r,a,c)],[])}function Zy(e,t,n,r,a,s){let m=Ju(r,s,a),c=Jy(e,t,n,r,a,m);return i.IsEqual(c.length,1)?c[0]:be(c)}function Qr(e,t,n,r){let a=we(e,t,r),s=Xu(e,n,r),m=s[0],c=s[1];return qt(c)?Hy(t,m)?Pn(Xe(m),a):Zy(e,t,Xe(m),c.parameters,c.expression,a):Pn(n,a)}function Pn(e,t){return p.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function tc(e,t){return Qr({},D([],[]),e,t)}function Zt(e){return h(e,"Call")}function Xy(e){return p.Discard(e,["~immutable"])}function nc(e,t){return p.Update(Xy(e),{},t)}function rc(e,t,n,r){let a=d(e,t,n);return nc(a,r)}function ac(e,t){return e(t)}function oc(e,t){return i.IsString(t)?O(ac(e,t)):O(t)}function ic(e,t){let n=ye(t);return tt(e,n)}function sc(e,t){let n=t.map(r=>tt(e,r));return k(n)}function tt(e,t){return A(t)?oc(e,t.const):Z(t)?ic(e,t.pattern):x(t)?sc(e,t.anyOf):t}function Tr(e,t={}){return y("Capitalize",[e],t)}function mc(e,t={}){return Va(e,t)}function kr(e,t={}){return y("Lowercase",[e],t)}function pc(e,t={}){return Wa(e,t)}function Er(e,t={}){return y("Uncapitalize",[e],t)}function uc(e,t={}){return Ha(e,t)}function wr(e,t={}){return y("Uppercase",[e],t)}function cc(e,t={}){return Ya(e,t)}var Qy=e=>e[0].toUpperCase()+e.slice(1),eI=e=>e.toLowerCase(),tI=e=>e[0].toLowerCase()+e.slice(1),nI=e=>e.toUpperCase();function Va(e,t){return T([e])?p.Update(tt(Qy,e),{},t):Tr(e,t)}function Wa(e,t){return T([e])?p.Update(tt(eI,e),{},t):kr(e,t)}function Ha(e,t){return T([e])?p.Update(tt(tI,e),{},t):Er(e,t)}function Ya(e,t){return T([e])?p.Update(tt(nI,e),{},t):wr(e,t)}function lc(e,t,n,r){let a=d(e,t,n);return Va(a,r)}function dc(e,t,n,r){let a=d(e,t,n);return Wa(a,r)}function fc(e,t,n,r){let a=d(e,t,n);return Ha(a,r)}function gc(e,t,n,r){let a=d(e,t,n);return Ya(a,r)}function Rr(e,t,n,r,a={}){return y("Conditional",[e,t,n,r],a)}function hc(e,t,n,r,a={}){return Ja({},D([],[]),e,t,n,r,a)}function rI(e,t,n,r,a,s){let m=pe(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 Ja(e,t,n,r,a,s,m){return T([n,r])?p.Update(rI(e,t,n,r,a,s),{},m):Rr(n,r,a,s,m)}function xc(e,t,n,r,a,s,m){let c=d(e,t,n),l=d(e,t,r);return Ja(e,t,c,l,a,s,m)}function Or(e,t={}){return y("ConstructorParameters",[e],t)}function yc(e,t={}){return Za(e,t)}function aI(e){let t=ne(e)?e.parameters:[],n=ft({},D([],[]),t);return X(n)}function Za(e,t){return T([e])?p.Update(aI(e),{},t):Or(e,t)}function Ic(e,t,n,r){let a=d(e,t,n);return Za(a,r)}function Pr(e,t,n={}){return y("Exclude",[e,t],n)}function bc(e,t,n={}){return Gn(e,t,n)}function Gn(e,t,n){return T([e,t])?p.Update(gr(e,t),{},n):Pr(e,t,n)}function $c(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Gn(s,m,a)}function Sr(e,t,n={}){return y("Extract",[e,t],n)}function vc(e,t,n={}){return Xa(e,t,n)}function oI(e,t){let n=pe({},e,t);return b.IsExtendsTrueLike(n)?[e]:[]}function iI(e,t){return e.reduce((n,r)=>[...n,...oI(r,t)],[])}function Tc(e,t){let n=Ce(e),r=x(n)?n.anyOf:[n],a=iI(r,t);return be(a)}function Xa(e,t,n){return T([e,t])?p.Update(Tc(e,t),{},n):Sr(e,t,n)}function kc(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Xa(s,m,a)}function sI(e){return e.reduce((t,n)=>pr(n)?[...t,O(n)]:t,[])}function Xt(e){let t=sI(e);return k(t)}function Sn(e,t,n={}){return y("Index",[e,t],n)}function Ec(e,t,n={}){let r=i.IsArray(t)?Xt(t):t;return Qa(e,r,n)}function wc(e,t){let n=Ve(e,t);return Re(n)}function Rc(e,t,n){let r=je(e,t,n);return Re(r)}function mI(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,P)=>({...f,[P]:e[P]}),{}),m=r.reduce((f,P)=>({...f,[P]:t[P]}),{}),c=a.reduce((f,P)=>({...f,[P]:G([e[P],t[P]])}),{}),l=p.Assign(s,m);return p.Assign(l,c)}function Oc(e){return e.reduce((t,n)=>mI(t,Re(n)),{})}function Pc(e){let t=qi(X(e));return Re(t)}function pI(e,t){return i.Keys(e).filter(a=>a in t).reduce((a,s)=>({...a,[s]:be([e[s],t[s]])}),{})}function Sc(e,t){return i.ShiftLeft(e,(n,r)=>Sc(r,pI(t,Re(n))),()=>t)}function Mc(e){return i.ShiftLeft(e,(t,n)=>Sc(n,Re(t)),()=>W())}function Re(e){return me(e)?wc(e.$defs,e.$ref):z(e)?Rc(e.if,e.then,e.else):R(e)?Oc(e.allOf):x(e)?Mc(e.anyOf):j(e)?Pc(e.items):C(e)?e.properties:{}}function Qt(e){let t=Re(e);return $(t)}var uI=new RegExp("^(?:0|[1-9][0-9]*)$");function en(e){let t=`${e}`;return uI.test(t)?parseInt(t):e}function cI(e){return O(en(e))}function Cc(e){return e.map(t=>Ac(t))}function Ac(e){return R(e)?le(Cc(e.allOf)):x(e)?k(Cc(e.anyOf)):A(e)?cI(e.const):e}function qc(e,t){let n=Ac(t),r=pe({},n,Ie());return b.IsExtendsTrueLike(r)?e:A(t)&&i.IsEqual(t.const,"length")?Ie():L()}function Lc(e,t){let n=Ve(e,t);return $e(n)}function jc(e,t,n){let r=je(e,t,n);return $e(r)}function Fc(e){let t=Ee(e);return $e(t)}function Dc(e){let t=G(e);return $e(t)}function Nc(e){return[`${e}`]}function Kc(e){let t=ye(e);return $e(t)}function Uc(e){return e.reduce((t,n)=>[...t,...$e(n)],[])}function $e(e){return me(e)?Lc(e.$defs,e.$ref):z(e)?jc(e.if,e.then,e.else):de(e)?Fc(e.enum):R(e)?Dc(e.allOf):A(e)?Nc(e.const):Z(e)?Kc(e.pattern):x(e)?Uc(e.anyOf):[]}function tn(e){return $e(e)}function _n(e,t){return t.map(n=>zn(e,n))}function zn(e,t){return U(t)?ke(zn(e,t.items)):ne(t)?De(_n(e,t.parameters),zn(e,t.instanceType)):re(t)?Ne(_n(e,t.parameters),zn(e,t.returnType)):j(t)?X(_n(e,t.items)):x(t)?k(_n(e,t.anyOf)):R(t)?le(_n(e,t.allOf)):br(t)?$(e):t}function Gc(e,t){return zn(e,t)}function lI(e,t){let n=t in e?e[t]:L();return Gc(e,n)}function _c(e,t){return t.reduce((n,r)=>[...n,lI(e,r)],[])}function dI(e,t){let n=tn(t),r=_c(e,n);return be(r)}var fI=new RegExp(pt);function gI(e){return e.filter(n=>fI.test(n))}function hI(e){let t=nr(e),n=gI(t),r=_c(e,n);return be(r)}function zc(e,t){return J(t)?hI(e):dI(e,t)}function xI(e){return O(en(e))}function Bc(e){return e.map(t=>eo(t))}function eo(e){return R(e)?le(Bc(e.allOf)):x(e)?k(Bc(e.anyOf)):A(e)?xI(e.const):e}function yI(e,t){return e.reduceRight((n,r,a)=>{let s=pe({},O(a),t);return b.IsExtendsTrueLike(s)?[r,...n]:n},[])}function II(e,t){let n=eo(t),r=yI(e,n);return Qe(r)}function bI(e){return Qe(e)}function Vc(e,t){return A(t)&&i.IsEqual(t.const,"length")?O(e.length):J(t)||fe(t)?bI(e):II(e,t)}function Wc(e,t){return U(e)?qc(e.items,t):C(e)?zc(e.properties,t):j(e)?Vc(e.items,t):L()}function $I(e){return me(e)||z(e)||R(e)||x(e)?Qt(e):e}function Qa(e,t,n){return T([e,t])?p.Update(Wc($I(e),t),{},n):Sn(e,t,n)}function Hc(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return Qa(s,m,a)}function Mr(e,t={}){return y("InstanceType",[e],t)}function Yc(e,t={}){return to(e,t)}function vI(e){return ne(e)?e.instanceType:L()}function to(e,t){return T([e])?p.Update(vI(e),{},t):Mr(e,t)}function Jc(e,t,n,r={}){let a=d(e,t,n);return to(a,r)}function Mn(e,t={}){return y("KeyOf",[e],t)}function Zc(e,t={}){return no(e,t)}function Xc(){return k([Ie(),Me(),Nt()])}function Qc(e){return Ie()}function TI(e){return e.reduce((n,r)=>pr(r)?[...n,O(en(r))]:W(),[])}function el(e){let t=i.Keys(e),n=TI(t);return Qe(n)}function tl(e){return Gt(e)}function nl(e){let t=e.map((n,r)=>O(r));return Qe(t)}function rl(e){return Y(e)?Xc():U(e)?Qc(e.items):C(e)?el(e.properties):ue(e)?tl(e):j(e)?nl(e.items):L()}function kI(e){return me(e)||z(e)||R(e)||x(e)?Qt(e):e}function no(e,t){return T([e])?p.Update(rl(kI(e)),{},t):Mn(e,t)}function al(e,t,n,r){let a=d(e,t,n);return no(a,r)}function Rn(e,t,n,r,a={}){return y("Mapped",[e,t,n,r],a)}function ol(e,t,n,r,a={}){return ro({},D([],[]),e,t,n,r,a)}function EI(e){let t=ye(e);return ea(t)}function wI(e){return e.reduce((t,n)=>[...t,...ea(n)],[])}function RI(e){let t=Ee(e);return ea(t)}function OI(e){return i.IsNumber(e)?[O(`${e}`)]:[O(e)]}function ea(e){return de(e)?RI(e.enum):A(e)?OI(e.const):Z(e)?EI(e.pattern):x(e)?wI(e.anyOf):[e]}function il(e){return ea(e)}function PI(e){return Z(e)?ye(e.pattern):e}function SI(e,t,n,r,a,s){let m=p.Assign(e,{[n.name]:r}),c=d(m,t,a),l=PI(c),I=d(m,t,s);return fi(l)||gi(l)?{[l.const]:I}:{}}function MI(e,t,n,r,a,s){return r.reduce((m,c)=>[...m,SI(e,t,n,c,a,s)],[])}function CI(e){return e.reduce((t,n)=>[...t,$(n)],[])}function sl(e,t,n,r,a,s){let m=il(r),c=MI(e,t,n,m,a,s),l=CI(c);return G(l)}function ro(e,t,n,r,a,s,m){return T([r])?p.Update(sl(e,t,n,r,a,s),{},m):Rn(n,r,a,s,m)}function ml(e,t,n,r,a,s,m){let c=d(e,t,r);return ro(e,t,n,c,a,s,m)}function AI(e,t,n){let r=p.Assign(e,t);return i.Keys(t).filter(s=>n.includes(s)).reduce((s,m)=>({...s,[m]:_u(r,m,t[m])}),{})}function qI(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,D([],[]),t[m])}),{})}function LI(e,t,n){let r=Nu(t),a=AI(e,t,r),s=qI(e,t,r),m={...a,...s};return p.Update(m,{},n)}function ta(e,t,n,r){return LI(e,n,r)}function Cr(e,t={}){return y("NonNullable",[e],t)}function pl(e,t={}){return ao(e,t)}function jI(e){let t=k([Ft(),_t()]);return Gn(e,t,{})}function ao(e,t){return T([e])?p.Update(jI(e),{},t):Cr(e,t)}function ul(e,t,n,r){let a=d(e,t,n);return ao(a,r)}function Ar(e,t,n={}){return y("Omit",[e,t],n)}function cl(e,t,n={}){let r=i.IsArray(t)?Xt(t):t;return oo(e,r,n)}function na(e){let t=Qt(e);return C(t)?t.properties:W()}function FI(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?r:{...r,[a]:e[a]},{})}function ll(e,t){let n=na(e),r=tn(t),a=FI(n,r);return $(a)}function oo(e,t,n){return T([e,t])?p.Update(ll(e,t),{},n):Ar(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 qr(e,t={}){return y("Parameters",[e],t)}function fl(e,t={}){return io(e,t)}function DI(e){let t=re(e)?e.parameters:[],n=ft({},D([],[]),t);return X(n)}function io(e,t){return T([e])?p.Update(DI(e),{},t):qr(e,t)}function gl(e,t,n,r){let a=d(e,t,n);return io(a,r)}function Lr(e,t={}){return y("Partial",[e],t)}function hl(e,t={}){return so(e,t)}function xl(e,t){let n=Ve(e,t),r=We(n);return Ue(p.Assign(e,{[t]:r}),t)}function yl(e,t,n){let r=je(e,t,n);return We(r)}function Il(e){let t=G(e);return We(t)}function bl(e){let t=e.map(n=>We(n));return k(t)}function $l(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:vt(e[a])}),{});return $(t)}function We(e){return me(e)?xl(e.$defs,e.$ref):z(e)?yl(e.if,e.then,e.else):R(e)?Il(e.allOf):x(e)?bl(e.anyOf):C(e)?$l(e.properties):$({})}function so(e,t){return T([e])?p.Update(We(e),{},t):Lr(e,t)}function vl(e,t,n,r){let a=d(e,t,n);return so(a,r)}function jr(e,t,n={}){return y("Pick",[e,t],n)}function Tl(e,t,n={}){let r=i.IsArray(t)?Xt(t):t;return mo(e,r,n)}function NI(e,t){return i.Keys(e).reduce((r,a)=>t.includes(a)?p.Assign(r,{[a]:e[a]}):r,{})}function kl(e,t){let n=na(e),r=tn(t),a=NI(n,r);return $(a)}function mo(e,t,n){return T([e,t])?p.Update(kl(e,t),{},n):jr(e,t,n)}function El(e,t,n,r,a){let s=d(e,t,n),m=d(e,t,r);return mo(s,m,a)}function Fr(e,t={}){return y("ReadonlyObject",[e],t)}function po(e,t={}){return uo(e,t)}var wl=po;function Rl(e){return jt(ke(e))}function Ol(e,t){let n=Ve(e,t),r=He(n);return Ue(p.Assign(e,{[t]:r}),t)}function Pl(e,t,n){let r=je(e,t,n);return He(r)}function Sl(e){let t=G(e);return He(t)}function Ml(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:Et(e[a])}),{});return $(t)}function Cl(e){return jt(X(e))}function Al(e){let t=e.map(n=>He(n));return k(t)}function He(e){return U(e)?Rl(e.items):me(e)?Ol(e.$defs,e.$ref):z(e)?Pl(e.if,e.then,e.else):R(e)?Sl(e.allOf):C(e)?Ml(e.properties):j(e)?Cl(e.items):x(e)?Al(e.anyOf):e}function uo(e,t){return T([e])?p.Update(He(e),{},t):Fr(e)}function ql(e,t,n,r){let a=d(e,t,n);return uo(a,r)}function Ll(e,t,n,r){return t.visited.includes(r)?n:r in e?d(e,D(t.callstack,[...t.visited,r]),e[r]):n}function jl(e,t){let n=Ve(e,t),r=Ye(n);return Ue(p.Assign(e,{[t]:r}),t)}function Fl(e,t,n){let r=je(e,t,n);return Ye(r)}function Dl(e){let t=G(e);return Ye(t)}function Nl(e){let t=e.map(n=>Ye(n));return k(t)}function Kl(e){let t=i.Keys(e).reduce((r,a)=>({...r,[a]:fr(e[a])}),{});return $(t)}function Ye(e){return me(e)?jl(e.$defs,e.$ref):z(e)?Fl(e.if,e.then,e.else):R(e)?Dl(e.allOf):x(e)?Nl(e.anyOf):C(e)?Kl(e.properties):$({})}function Dr(e,t={}){return y("Required",[e],t)}function Ul(e,t={}){return co(e,t)}function co(e,t){return T([e])?p.Update(Ye(e),{},t):Dr(e,t)}function Gl(e,t,n,r){let a=d(e,t,n);return co(a,r)}function Nr(e,t={}){return y("ReturnType",[e],t)}function _l(e,t={}){return lo(e,t)}function KI(e){return re(e)?e.returnType:L()}function lo(e,t){return T([e])?p.Update(KI(e),{},t):Nr(e,t)}function zl(e,t,n,r={}){let a=d(e,t,n);return lo(a,r)}function Kr(e,t){return y("With",[e,t],{})}function Bl(e,t){return fo(e,t)}function fo(e,t){return T([e])?p.Update(e,{},t):Kr(e,t)}function Vl(e,t,n,r){let a=d(e,t,n);return fo(a,r)}function UI(e){return ut(e)?j(e.items)?go(e.items.items):V(e.items)?[e]:ae(e.items)?[e]:[L()]:[e]}function go(e){return e.reduce((n,r)=>[...n,...UI(r)],[])}function D(e,t){return{callstack:e,visited:t}}function T(e){return i.ShiftLeft(e,(t,n)=>ae(t)?!1:T(n),()=>!0)}function Fn(e,t,n){return i.Keys(n).reduce((r,a)=>({...r,[a]:d(e,t,n[a])}),{})}function ft(e,t,n){let r=we(e,t,n);return go(r)}function we(e,t,n){return n.map(r=>d(e,t,r))}function GI(e,t){let n=ce(e)?gn(t,{}):t,r=wt(e)?fn(n,{}):n;return kt(e)?Bn(r,{}):r}function _I(e,t,n,r,a){return i.IsEqual(n,"AddImmutable")?Wl(e,t,r[0],a):i.IsEqual(n,"RemoveImmutable")?rc(e,t,r[0],a):i.IsEqual(n,"AddReadonly")?_o(e,t,r[0],a):i.IsEqual(n,"RemoveReadonly")?Pi(e,t,r[0],a):i.IsEqual(n,"AddOptional")?zo(e,t,r[0],a):i.IsEqual(n,"RemoveOptional")?Ci(e,t,r[0],a):i.IsEqual(n,"Capitalize")?lc(e,t,r[0],a):i.IsEqual(n,"Conditional")?xc(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"ConstructorParameters")?Ic(e,t,r[0],a):i.IsEqual(n,"Evaluate")?Vu(e,t,r[0],a):i.IsEqual(n,"Exclude")?$c(e,t,r[0],r[1],a):i.IsEqual(n,"Extract")?kc(e,t,r[0],r[1],a):i.IsEqual(n,"Index")?Hc(e,t,r[0],r[1],a):i.IsEqual(n,"InstanceType")?Jc(e,t,r[0],a):i.IsEqual(n,"Interface")?Lu(e,t,r[0],r[1],a):i.IsEqual(n,"KeyOf")?al(e,t,r[0],a):i.IsEqual(n,"Lowercase")?dc(e,t,r[0],a):i.IsEqual(n,"Mapped")?ml(e,t,r[0],r[1],r[2],r[3],a):i.IsEqual(n,"Module")?ta(e,t,r[0],a):i.IsEqual(n,"NonNullable")?ul(e,t,r[0],a):i.IsEqual(n,"Pick")?El(e,t,r[0],r[1],a):i.IsEqual(n,"Parameters")?gl(e,t,r[0],a):i.IsEqual(n,"Partial")?vl(e,t,r[0],a):i.IsEqual(n,"Omit")?dl(e,t,r[0],r[1],a):i.IsEqual(n,"ReadonlyObject")?ql(e,t,r[0],a):i.IsEqual(n,"Record")?Yi(e,t,r[0],r[1],a):i.IsEqual(n,"Required")?Gl(e,t,r[0],a):i.IsEqual(n,"ReturnType")?zl(e,t,r[0],a):i.IsEqual(n,"TemplateLiteral")?Qp(e,t,r[0],a):i.IsEqual(n,"Uncapitalize")?fc(e,t,r[0],a):i.IsEqual(n,"Uppercase")?gc(e,t,r[0],a):i.IsEqual(n,"With")?Vl(e,t,r[0],r[1]):y(n,r,a)}function zI(e,t,n){let r=ae(n)?Ll(e,t,n,n.$ref):U(n)?ke(d(e,t,n.items),tr(n)):Zt(n)?Qr(e,t,n.target,n.arguments):ne(n)?De(we(e,t,n.parameters),d(e,t,n.instanceType),Bo(n)):re(n)?Ne(we(e,t,n.parameters),d(e,t,n.returnType),Vo(n)):z(n)?Tt(d(e,t,n.if),d(e,t,n.then),d(e,t,n.else),Xo(n)):R(n)?le(we(e,t,n.allOf),ri(n)):C(n)?$(Fn(e,t,n.properties),Jo(n)):ue(n)?Ji(Ae(n),d(e,t,he(n))):ut(n)?Pt(d(e,t,n.items)):j(n)?X(ft(e,t,n.items),Oi(n)):x(n)?k(we(e,t,n.anyOf),xi(n)):n;return GI(n,r)}function d(e,t,n){return at(n)?_I(e,t,n.action,n.parameters,n.options):zI(e,t,n)}function ho(e,t){return d(e,D([],[]),t)}function BI(e){return p.Update(e,{"~immutable":!0},{})}function Bn(e,t){return p.Update(BI(e),{},t)}function Wl(e,t,n,r){let a=d(e,t,n);return Bn(a,r)}function Zm(e,t={}){return y("AddImmutable",[e],t)}function jt(e,t={}){return Bn(e,t)}function Xm(e,t={}){return y("Evaluate",[e],t)}function Hl(e,t={}){return za(e,t)}function Qm(e,t={}){return y("Module",[e],t)}function Yl(e,t={}){return ta({},D([],[]),e,t)}function Jl(...e){let[t,n,r]=Ge.Match(e,{2:(m,c)=>i.IsString(m)?[{},m,c]:[m,c,{}],3:(m,c,l)=>[m,c,l],1:m=>[{},m,{}]}),a=Hp(n),s=i.IsArray(a)&&i.IsEqual(a.length,2)?d(t,D([],[]),a[0]):L();return p.Update(s,{},r)}var H={};yt(H,{Any:()=>Lt,Array:()=>ke,BigInt:()=>In,Boolean:()=>sr,Call:()=>tc,Capitalize:()=>mc,Codec:()=>ir,Conditional:()=>hc,Constructor:()=>De,ConstructorParameters:()=>yc,Cyclic:()=>Ue,Decode:()=>si,DecodeBuilder:()=>yn,Dependent:()=>Tt,Encode:()=>mi,EncodeBuilder:()=>xn,Enum:()=>ni,Evaluate:()=>Hl,Exclude:()=>bc,Extends:()=>pe,ExtendsResult:()=>b,Extract:()=>vc,Function:()=>Ne,Generic:()=>ot,Identifier:()=>bn,Immutable:()=>pi,Index:()=>Ec,Infer:()=>hn,InstanceType:()=>Yc,Instantiate:()=>ho,Integer:()=>Rt,Interface:()=>ju,Intersect:()=>le,IsAny:()=>Y,IsArray:()=>U,IsBigInt:()=>ze,IsBoolean:()=>Se,IsCall:()=>Zt,IsCodec:()=>or,IsConstructor:()=>ne,IsCyclic:()=>me,IsDependent:()=>z,IsEnum:()=>de,IsEnumValue:()=>ti,IsFunction:()=>re,IsGeneric:()=>qt,IsIdentifier:()=>di,IsImmutable:()=>kt,IsInfer:()=>V,IsInteger:()=>fe,IsIntersect:()=>R,IsKind:()=>h,IsLiteral:()=>A,IsNever:()=>it,IsNull:()=>Dt,IsNumber:()=>J,IsObject:()=>C,IsOptional:()=>ce,IsParameter:()=>hi,IsReadonly:()=>wt,IsRecord:()=>ue,IsRef:()=>ae,IsRefine:()=>ga,IsRest:()=>ut,IsSchema:()=>Q,IsString:()=>ge,IsSymbol:()=>st,IsTemplateLiteral:()=>Z,IsThis:()=>br,IsTuple:()=>j,IsUndefined:()=>zt,IsUnion:()=>x,IsUnknown:()=>ee,IsUnsafe:()=>ar,IsVoid:()=>Be,KeyOf:()=>Zc,Literal:()=>O,Lowercase:()=>pc,Mapped:()=>ol,Module:()=>Yl,Never:()=>L,NonNullable:()=>pl,Null:()=>Ft,Number:()=>Ie,Object:()=>$,Omit:()=>cl,Optional:()=>Ho,Parameter:()=>Ot,Parameters:()=>fl,Partial:()=>hl,Pick:()=>Tl,Readonly:()=>ui,ReadonlyObject:()=>po,ReadonlyType:()=>wl,Record:()=>xr,RecordKey:()=>Gt,RecordPattern:()=>Ae,RecordValue:()=>he,Ref:()=>Xe,Refine:()=>ci,Required:()=>Ul,Rest:()=>Pt,ReturnType:()=>_l,Script:()=>Jl,String:()=>Me,Symbol:()=>Nt,TemplateLiteral:()=>tu,This:()=>Ir,Tuple:()=>X,Uncapitalize:()=>uc,Undefined:()=>_t,Union:()=>k,Unknown:()=>oe,Unsafe:()=>Zo,Uppercase:()=>cc,Void:()=>$r,With:()=>Bl});var nn="submit_review_report",rn="submit_test_gap_candidates",Vn="submit_filtered_test_gaps",VI=H.Object({verdict:H.Union([H.Literal("PASS"),H.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:H.String({description:"One short sentence summarizing the verdict."}),reasons:H.Array(H.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:H.Array(H.String(),{description:"Non-blocking, optional/minor observations or suggested improvements \u2014 the kind of feedback a real reviewer leaves as 'Minor/optional' without failing the task. Include these regardless of verdict; use an empty array if you truly have none."})});function Zl(e){return{name:nn,label:"Submit Review Report",description:"Submit your final verdict for this review. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished reading and analyzing the relevant files. Do not write a plain-text final answer instead of calling this tool.",parameters:VI,async execute(t,n){return e.report={verdict:n.verdict,summary:n.summary,reasons:n.reasons??[],notes:n.notes??[]},{content:[{type:"text",text:`Report recorded: ${n.verdict}`}],details:void 0}}}}var WI=H.Object({gaps:H.Array(H.Object({description:H.String({description:"The specific untested behavior or edge case, in plain terms. Prefix with POSITIVE: or NEGATIVE: to indicate whether this is a missing required-behavior test or a missing forbidden/wrong-behavior test."}),risk:H.String({description:"Concretely why a plausible-but-incorrect implementation could still pass every test in test.patch despite missing, misimplementing, or violating this behavior (including doing a forbidden thing because no test asserts it must not happen)."})}),{description:"Candidate behavioral test gaps (positive and negative) grounded in agent_prompt.md or clear existing repo behavior. Use an empty array if you found none \u2014 do not manufacture gaps just to report something."})});function Xl(e){return{name:rn,label:"Submit Candidate Test Gaps",description:"Submit your candidate list of behavioral test gaps. This is the ONLY way to report your result \u2014 call it exactly once, as your last action, after you have finished reading and analyzing the relevant files.",parameters:WI,async execute(t,n){let r=n.gaps??[];return e.gaps=r,{content:[{type:"text",text:`Recorded ${r.length} candidate gap(s)`}],details:void 0}}}}var HI=H.Object({gaps:H.Array(H.Object({description:H.String({description:"The confirmed, real, fair test gap (may be reworded for clarity). Keep POSITIVE:/NEGATIVE: prefix when applicable."}),justification:H.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 Ql(e){return{name:Vn,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:HI,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 YI={description:"Focus area: the task description in `agent_prompt.md`. Judge it strictly against rubric items P1-P5 below. You do not need to judge the tests or solution \u2014 other reviewers cover those.",tests:"Focus area: the tests added in `test.patch` (a unified diff). Judge them strictly against rubric items T1-T6 below. You cannot execute code or apply the patch, so read the diff carefully and reason about determinism, coverage, and strictness directly from the added code. Read `agent_prompt.md` for context on what behavior is in scope, and skim `solution.patch` only to understand what the tests are checking. Do not judge the description or the solution's code quality.\nMandatory symbol-fairness check: for every non-trivial method/function/property/export name that a test calls, mutates, mocks, or asserts on, use grep/read on the repository (the pre-existing code, not solution.patch) to confirm it actually exists there, OR confirm it is explicitly named in `agent_prompt.md`. Pay special attention to any such name that is new/invented and that duplicates, shadows, or conflicts with an existing, differently-named public API doing the same thing (e.g. a test calling `setFoo(...)` when the repo's real, visible API is `setBar(...)`) \u2014 that is a textbook unfair/undiscoverable test per the fairness methodology, and is blocking on its own even if every other test in the patch is fine.",solution:"Focus area: the golden solution in `solution.patch` (a unified diff). Judge it strictly against rubric items S1-S4 below. Read `agent_prompt.md` for the requirements and `test.patch` to see what must pass, and use read/grep/ls/find on the rest of the repository to check for regressions, inconsistent style, and irrelevant/unexplained changes. Do not judge the description's wording or the tests' coverage.\nMandatory repo-conventions check: for every file and area touched by `solution.patch`, read the corresponding pre-existing code in the repo \u2014 same directory, sibling modules, similar components/services/hooks, and any files the patch imports from or extends. Establish how this repo actually does things (error handling and logging, naming, exports, state management, async patterns, i18n, test helpers, DI/service boundaries, comment density, defensive checks) and judge whether the solution matches those conventions. Flag clear deviations as S2/S4 issues \u2014 e.g. inventing a new logger when the repo uses a shared one, raw `console.*` where the codebase uses a structured error reporter, a different hook/service pattern than neighboring features, or new abstractions where similar code inlines the same logic. Use grep/read to find 2\u20133 closest analogues before concluding a pattern is acceptable.\nMandatory dead-code check: scan every added/changed line in `solution.patch` for unused code \u2014 variables, parameters, imports, functions/methods, or fields that are declared/assigned but never read or called anywhere (including by `test.patch`) \u2014 and for dead/unreachable code (branches, conditions, or statements that can never execute, or code left behind after a return/throw/break that makes it unreachable). Use grep to confirm a symbol truly has no other usages in the repo before flagging it. This is a rubric S4 violation and is blocking on its own, even if the rest of the solution is otherwise excellent."};function ed(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 td=["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."],nd=["Ground rules \u2014 do not overreach:","- Every gap must trace back to a specific requirement or sentence in `agent_prompt.md`, or to behavior that is unambiguous from the existing, visible repo. Do not invent requirements the prompt doesn't support.","- Do not propose gaps for things `agent_prompt.md` leaves intentionally open, or for implementation details/style the prompt doesn't mandate.","- Read `test.patch` carefully before deciding something is untested \u2014 do not propose a gap that an existing test already covers (even indirectly)."];function rd(e,t,n){let r=["You are a careful, calibrated reviewer for a coding-agent benchmark task.","You are working inside a throwaway, read-only copy of a git repository (this is your current directory). You have access to read/grep/find/ls tools only \u2014 you cannot execute code, apply patches, or edit files.","The repo root may contain: `agent_prompt.md` (the task description), `test.patch` (unified diff adding tests), and `solution.patch` (unified diff of the golden solution). Read whichever are relevant to your focus, and read the rest of the repository as needed via grep/read/ls/find to judge things against real repo context.","",YI[e.key],"","Checklist for your focus area:",t];return n&&r.push("","Fairness methodology (use this to judge whether an issue is actually blocking, and to distinguish agent-fault from prompt-ambiguity from test-flaw problems):",n),e.key==="solution"&&r.push("","Solution-specific calibration for repo standards (S2/S4):","Before returning PASS, you must have read real analogue files in the repo and compared patterns. A clear, documented mismatch with established repo conventions \u2014 wrong error/logging approach, inconsistent service or hook structure vs neighboring code, new patterns where the repo consistently uses existing ones \u2014 is blocking under S2/S4, not a minor note. Purely cosmetic nits (spacing, import order) with no pattern break belong in `notes`."),r.push("","How to set the verdict \u2014 calibrate, don't nitpick:","FAIL only for a genuine BLOCKING issue: a checklist item is clearly violated, a requirement stated in `agent_prompt.md` is untested or contradicted, a test asserts something unfair/undiscoverable per the fairness methodology above (private internals, exact class names not in the prompt, exact call order, reference-solution-only structure, etc.), a test is genuinely non-deterministic in a way that risks real CI flakiness (real network calls, unseeded randomness, race-prone ordering), or the solution has a real regression, missing requirement, or unrelated/unexplained change.","Do NOT fail for: optional coverage suggestions, 'would also be nice to test X', dead/unused code that doesn't affect correctness, minor style inconsistencies, or defensible implementation choices the prompt didn't forbid. These are exactly the kind of thing a real reviewer leaves as a 'Minor/optional' note without failing the task \u2014 put them in `notes` and still return PASS.","When genuinely torn between PASS and FAIL, default to PASS with the concern captured in `notes`, unless the issue would let a materially incorrect agent solution pass the hidden tests, or would unfairly fail a correct one \u2014 that is always blocking.","A single blocking issue is enough to FAIL, even if it affects only one test or one line out of many, and even if the rest of the suite is excellent. Do NOT average it away or let a large, otherwise-strong test suite talk you into a PASS \u2014 one unfair or undiscoverable test (e.g. requiring a private/invented API name that doesn't exist in the repo and isn't named in the prompt, especially one that conflicts with an existing, differently-named public API) is exactly as blocking as many.","",`When you are done analyzing, call the \`${nn}\` tool exactly once with your structured verdict. That tool call is your only way to report a result.`),r.join(`
8
+ `)}function ad(e,t){let n=[...ed("You are an exhaustive, research-minded POSITIVE test-coverage analyst for a coding-agent benchmark task. Your sole mandate is to surface EVERY genuine POSITIVE behavioral test gap \u2014 required behavior that `test.patch` never asserts but `agent_prompt.md` requires. Do NOT search for forbidden/wrong-behavior gaps; a separate negative-case agent handles those in parallel. Stay in your lane and search exhaustively before concluding there are none."),"","Your job: find real POSITIVE TEST GAPS. A positive gap is required or clearly-implied behavior from `agent_prompt.md` (and, where relevant, obvious existing repo conventions) that `test.patch` does NOT actually verify \u2014 such that a plausible implementation could skip or misimplement that required behavior and STILL pass every test in `test.patch` as written.","","Focus on required outcomes: happy paths, side effects, state changes, outputs, transitions, edge inputs where the prompt still expects correct handling, combined/interacting behaviors, and branches in `solution.patch` whose correct outcome is never forced by a test.","","Be systematic and exhaustive \u2014 work through ALL of the following passes:","1. Go through `agent_prompt.md` sentence by sentence. For every distinct required behavior, constraint, or implied rule, check which test(s) in `test.patch` exercise it and how thoroughly.","2. Go through `solution.patch` branch by branch \u2014 every conditional, loop, early return, error path, and state transition. For each one, ask whether `test.patch` forces the correct outcome to be checked.","3. Consider standard positive edge-case categories: boundary/limit values, empty/missing/null/zero inputs that should still produce the required correct behavior, duplicate or repeated inputs handled correctly, ordering and interleaving, concurrent or repeated invocations, error/failure/rollback paths that should recover correctly, interaction between two or more required behaviors at once, and state left behind after an operation.","4. Cross-check overlapping/interacting requirements \u2014 behaviors each tested alone but never tested together.","5. Second-pass sweep: return to any requirement you marked 'covered' and ask whether coverage is shallow \u2014 one happy-path assertion is not enough if other valid inputs, sequences, or combinations could still slip through.",...td,"Do not filter yourself or self-censor for volume. A separate validator will strictly filter afterward \u2014 your job is recall on POSITIVE gaps only.","",...nd,"","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",e];return t&&n.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),n.push("","For each gap, prefix the description with `POSITIVE:` and explain: (1) the specific untested required behavior/edge case, and (2) concretely why a plausible-but-incomplete implementation would still pass every given test despite missing or misimplementing it.",`When you are done \u2014 after completing ALL the passes above and a deliberate second sweep \u2014 call the \`${rn}\` tool exactly once with your full candidate list (empty only if, after genuinely exhaustive analysis, none exist). That tool call is your only way to report a result.`),n.join(`
9
+ `)}function od(e,t){let n=[...ed("You are an exhaustive, research-minded NEGATIVE test-coverage analyst for a coding-agent benchmark task. Your sole mandate is to surface EVERY genuine NEGATIVE behavioral test gap \u2014 forbidden behavior, invalid states, or wrong outcomes that `test.patch` never asserts against but `agent_prompt.md` prohibits or implies must not happen. Do NOT search for missing required-behavior gaps; a separate positive-case agent handles those in parallel. Stay in your lane and search exhaustively before concluding there are none."),"","Your job: find real NEGATIVE TEST GAPS. A negative gap is a prohibition, guard, or 'must not' constraint from `agent_prompt.md` (or unambiguous repo convention) that `test.patch` does NOT verify \u2014 such that an agent could violate `agent_prompt.md` by doing the forbidden thing, leaving the wrong state enabled, applying an effect to the wrong target, skipping a guard, or accepting invalid input, and STILL pass every test because the suite only checks that correct actions work, not that incorrect ones are rejected.","","Be systematic and exhaustive \u2014 work through ALL of the following passes:","1. Re-read `agent_prompt.md` specifically for prohibitions, conditions, guards, and 'only when' / 'must not' / 'never' / 'disabled when' / 'should not' language. For each, ask: does `test.patch` assert the WRONG thing does NOT happen?","2. Go through `solution.patch` for every guard, early return, disabled branch, isolation check, and rejection path. Ask whether a sloppy implementation that bypassed that guard would still pass.","3. Hunt these negative patterns explicitly:"," - Controls that must be disabled/unavailable in a given state, but no test drives that state and asserts disabled."," - Operations that must NOT affect a separate scope/target (isolation), but tests never prove the wrong scope is untouched."," - Side effects that must NOT occur (duplicate entries, spurious history steps, refresh on no-op)."," - Invalid, out-of-order, or repeated input that should be ignored/rejected/coalesced differently."," - Undo/redo or rollback boundaries where the first action must NOT be undoable, or redo must NOT be available."," - Mutual exclusion: doing A must NOT silently change B, but no test proves independence.","4. For every prompt prohibition, ask: 'Is there a test that would catch an agent doing the forbidden thing or applying the requirement in the wrong context?' If not, it is a gap.","5. Adversarial pass: imagine a lazy or slightly-wrong implementation that satisfies the obvious tests \u2014 list every way it could still violate the prompt (wrong scope, wrong timing, wrong guard, spurious side effect, missing rejection) and check whether `test.patch` would catch each one.",...td,"Do not filter yourself or self-censor for volume. A separate validator will strictly filter afterward \u2014 your job is recall on NEGATIVE gaps only.","",...nd,"- Negative gaps must be grounded in an explicit or clearly implied prohibition/constraint in `agent_prompt.md` \u2014 not generic 'more negative tests would be nice'.","- A single test that asserts both the positive outcome AND that the forbidden/wrong outcome did not occur counts as covered.","","For reference, here is the checklist for the tests focus area (use it to calibrate what good coverage looks like, not as a list of gaps to report verbatim):",e];return t&&n.push("","Fairness methodology (context on what a fair, in-scope requirement looks like):",t),n.push("","For each gap, prefix the description with `NEGATIVE:` and explain: (1) the specific untested forbidden/wrong behavior or invalid state, and (2) concretely why a plausible-but-wrong implementation would still pass every given test despite violating this constraint.",`When you are done \u2014 after completing ALL the passes above and a deliberate second sweep \u2014 call the \`${rn}\` tool exactly once with your full candidate list (empty only if, after genuinely exhaustive analysis, none exist). That tool call is your only way to report a result.`),n.join(`
10
+ `)}function id(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) in parallel \u2014 one hunting POSITIVE gaps (missing required-behavior tests), one hunting NEGATIVE gaps (missing forbidden/wrong-behavior tests). They proposed the following combined CANDIDATE list:","",JSON.stringify(e,null,2),"","Your job is to independently re-verify the files yourself and FILTER this list down to only candidates that are ALL of the following:","1. Genuinely grounded \u2014 actually required by a specific statement in `agent_prompt.md`, or unambiguous from clearly visible, existing repo behavior. Drop anything speculative, nice-to-have, or invented beyond what the prompt actually asks for.","2. Fair to test \u2014 verifying it would not require undiscoverable private internals, an invented/unnamed API, or exact incidental structure that only `solution.patch` happens to use. Judge this precisely against the fairness methodology below.","3. A real, distinct coverage hole \u2014 re-check `test.patch` yourself; drop any candidate an existing test already covers, and drop near-duplicate candidates (keep only the clearest phrasing of each distinct gap). For negative-case candidates, keep them only if `test.patch` does not already assert that the forbidden/wrong outcome does not occur.","","Be strict: when genuinely unsure whether a candidate holds up, drop it rather than keep it. It is fine \u2014 expected, even \u2014 to return an empty list if none of the candidates survive scrutiny.","","Checklist for the tests focus area, for calibration:",t];return 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 \`${Vn}\` 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(`
11
+ `)}var sd=900*1e3,Io=["read","grep","find","ls"];function bo(e){return e==="off"?void 0:e}async function $o(e,t){let n=t.aborted?"cancelled":"done";return await Promise.race([e().then(()=>{t.aborted||(n="done")}),new Promise(r=>{setTimeout(()=>{n="timedOut",r()},sd)}),new Promise(r=>{if(t.aborted)return r();t.addEventListener("abort",()=>{n="cancelled",r()},{once:!0})})]),n}async function md(e){let t={},n=e.model,{session:r}=await xo({cwd:e.tempDir,model:n,thinkingLevel:bo(e.thinkingLevel),tools:[...Io,nn],customTools:[Zl(t)],sessionManager:yo.inMemory()});try{let a=await $o(async()=>{await r.prompt(rd(e.role,e.rubric,e.fairnessRules))},e.cancelSignal);if(a==="cancelled")return await r.abort(),{verdict:"FAIL",summary:`${e.role.label} reviewer cancelled`,reasons:["Cancelled by user."],notes:[]};if(a==="timedOut")return await r.abort(),{verdict:"FAIL",summary:`${e.role.label} reviewer timed out`,reasons:[`Reviewer did not finish within ${sd/1e3}s.`],notes:[]}}catch(a){return{verdict:"FAIL",summary:`${e.role.label} reviewer errored`,reasons:[`Reviewer agent failed: ${a instanceof Error?a.message:String(a)}`],notes:[]}}return t.report?t.report:{verdict:"FAIL",summary:`${e.role.label} reviewer did not submit a report`,reasons:[`The reviewer agent finished without calling ${nn}.`],notes:[]}}async function vo(e){let t={},n=e.kind==="positive"?ad:od,r=e.model,{session:a}=await xo({cwd:e.tempDir,model:r,thinkingLevel:bo(e.thinkingLevel),tools:[...Io,rn],customTools:[Xl(t)],sessionManager:yo.inMemory()});try{let s=await $o(async()=>{await a.prompt(n(e.testRubric,e.fairnessRules))},e.cancelSignal);if(s!=="done")return await a.abort(),{status:s,gaps:[]}}catch{return{status:"error",gaps:[]}}return t.gaps?{status:"ok",gaps:t.gaps}:{status:"noSubmission",gaps:[]}}async function pd(e){let t={},n=e.model,{session:r}=await xo({cwd:e.tempDir,model:n,thinkingLevel:bo(e.thinkingLevel),tools:[...Io,Vn],customTools:[Ql(t)],sessionManager:yo.inMemory()});try{let a=await $o(async()=>{await r.prompt(id(e.candidates,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:[]}}import{existsSync as oa,mkdirSync as JI,readFileSync as To,writeFileSync as ZI}from"node:fs";import{dirname as XI,join as ud}from"node:path";import{getAgentDir as cd}from"@earendil-works/pi-coding-agent";var ra=ud(cd(),"checks-config.json"),aa=ud(cd(),"settings.json"),QI=["off","minimal","low","medium","high","xhigh","max"];function ld(e){return e?.reasoning?QI.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t==="xhigh"||t==="max"?n!==void 0:!0}):["off"]}function ko(){try{if(!oa(ra))return null;let e=JSON.parse(To(ra,"utf-8"));if(e.provider&&e.modelId&&e.thinkingLevel)return e}catch{}return null}function dd(e){let t=XI(ra);oa(t)||JI(t,{recursive:!0}),ZI(ra,JSON.stringify(e,null,2),"utf-8")}function fd(){try{return oa(aa)?JSON.parse(To(aa,"utf-8")).enabledModels??[]:[]}catch{return[]}}function gd(e){let t=e.indexOf("/");return t<=0||t===e.length-1?null:{provider:e.slice(0,t),modelId:e.slice(t+1)}}function eb(){try{if(oa(aa))return JSON.parse(To(aa,"utf-8"))}catch{}return{}}function hd(){let e=eb().shellPath;return e||(process.platform==="win32"?"C:\\Program Files\\Git\\bin\\bash.exe":"bash")}function tb(e){return e.replace(/\\/g,"/")}function nb(e){return`'${e.replace(/'/g,"'\\''")}'`}async function xd(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 ${nb(tb(n))}`,s=await e.exec(hd(),["-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 Oe="checks_progress";function Je(e,t,n){let r=n>0?Math.min(1,t/n):0,a=Math.round(24*r),s="\u2588".repeat(a)+"\u2591".repeat(Math.max(0,24-a));return[`checks: ${e} [${s}] ${t}/${n}`]}import{existsSync as rb,readFileSync as ab}from"node:fs";var nt=[{key:"description",label:"Description",rubricHeading:/^## The problem description/i},{key:"tests",label:"Tests",rubricHeading:/^## The tests/i},{key:"solution",label:"Solution",rubricHeading:/^## The solution/i}];var Eo=["agent_prompt.md","solution.patch","test.patch"];function ob(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 yd(e){try{if(!rb(e))return{};let t=JSON.parse(ab(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function Id(e){let{existingReport:t,config:n,runReviewers:r,byRole:a,runGapStages:s,testGaps:m,gapAnalysisIncomplete:c,positiveGapFinderStatus:l,negativeGapFinderStatus:I,gapFilterStatus:f}=e,P={...t,timestamp:ob(),model:`${n.provider}/${n.modelId}`,thinkingLevel:n.thinkingLevel};if(r){let se={...t.reports&&typeof t.reports=="object"?t.reports:{},...a};P.reports=se,nt.every(te=>se[te.key])?P.overall=nt.every(te=>se[te.key].verdict==="PASS")?"PASS":"FAIL":delete P.overall}return s&&(P.testGaps=m,c?P.testGapAnalysisNote=`Gap analysis did not fully complete (positive finder: ${l}, negative finder: ${I}, filter: ${f}); testGaps may be incomplete.`:delete P.testGapAnalysisNote),P}function bd(e){let{merged:t,runReviewers:n,activeRoles:r,byRole:a,runGapStages:s}=e,m=typeof t.overall=="string"?t.overall:void 0,c=Array.isArray(t.testGaps)?t.testGaps.length:0,l=n?Object.fromEntries(r.filter(f=>a[f.key]).map(f=>[f.key,a[f.key].verdict])):void 0,I=[];if(l&&I.push(r.map(f=>`${f.label}: ${l[f.key]??"?"}`).join(", ")),m){let f=m==="PASS"&&c>0?" (with test gaps)":"";I.push(`Overall: ${m}${f}`)}return s&&I.push(c>0?`${c} test gap(s) found`:"no test gaps found"),{content:`Checks: ${I.join(" | ")}`,details:{overall:m,hasTestGaps:c>0,gapsCount:c,roleVerdicts:l,showGaps:s}}}var $d=`## The problem description (aka the task)\r
11
12
  P1: Aligns with the repo's philosophy\r
12
13
  P2: Self-contained \u2014 solvable from the repo and description alone\r
13
14
  P3: Clear, concise, and unambiguous \u2014 describes what to build or fix and don't leave points for guessing\r
@@ -34,7 +35,7 @@ That's the golden solution \u2014 the proof that your task is solvable and that
34
35
  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
35
36
  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
36
37
  S3: No irrelevant changes to the code \u2014 if something is unrelated to your task, keep it as it is.\r
37
- S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,ZI=`# Agent Evaluation Guidelines\r
38
+ S4: No AI slop (weird comments, unexplained defensive code, new coding patterns, etc).`,ib=`# Agent Evaluation Guidelines\r
38
39
  \r
39
40
  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
40
41
  \r
@@ -314,5 +315,5 @@ Keep changes separated when possible:\r
314
315
  - Avoid unrelated dependency or lockfile changes.\r
315
316
  - Regenerate patches after every prompt/test/solution change.\r
316
317
  \r
317
- ---`;function gd(){let e=fd.split(/\r?\n(?=## )/g),t={};for(let n of tt){let r=e.find(a=>n.rubricHeading.test(a.trim()));t[n.key]=(r??fd).trim()}return t}function xd(){return ZI.trim()}var ia=!1,tn;function sa(){return ia}function yd(){return ia=!0,tn=new AbortController,tn}function hd(){ia=!1,tn=void 0}function Id(){return!ia||!tn||tn.signal.aborted?!1:(tn.abort(),!0)}var ob="Ctrl+Shift+X",To=[{value:"--all",label:"--all",description:"Run everything: 3 focus reviewers + test-gap finder/filter"},{value:"--review",label:"--review",description:"Run only the 3 focus reviewer agents (description/tests/solution)"},{value:"--description",label:"--description",description:"Run only the problem-description (prompt) focus reviewer"},{value:"--tests",label:"--tests",description:"Run only the tests focus reviewer"},{value:"--solution",label:"--solution",description:"Run only the solution focus reviewer"},{value:"--gap-finder",label:"--gap-finder",description:"Run only the 2-step behavioral test-gap finder + strict filter agents"},{value:"--config",label:"--config",description:"Set the reviewer model and thinking level"}];function ib(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"),I=To.filter(f=>s.has(f.value)||c||l&&f.value==="--config"?!1:f.value.startsWith(a));return I.length>0?I.map(f=>({...f,value:`${m}${f.value}`})):null}async function sb(e){if(e.mode!=="tui"){e.ui.notify("/checks --config requires interactive mode","error");return}let t=sd();if(t.length===0){e.ui.notify("No enabledModels configured in settings.json.","error");return}let n=bo(),r=e.modelRegistry.getAll(),a=t.map(f=>{let q=md(f);if(!q)return null;let j=r.find(Te=>Te.provider===q.provider&&Te.id===q.modelId),ie=n?.provider===q.provider&&n?.modelId===q.modelId,le=j?`${j.name} (${f})`:f;return{ref:f,parsed:q,display:ie?`${le} [current]`:le,found:j,isCurrent:ie}}).filter(f=>f!==null);if(a.length===0){e.ui.notify("Could not resolve any enabledModels entries.","error");return}let s=[...a].sort((f,q)=>f.isCurrent===q.isCurrent?0:f.isCurrent?-1:1),m=await e.ui.select("Select model for checks reviewer agents",s.map(f=>f.display));if(!m)return;let c=a.find(f=>f.display===m);if(!c)return;let l="off",I=od(c.found);if(I.length>1){let f=c.isCurrent?n?.thinkingLevel:void 0,q=[...I].sort((le,Te)=>le===f==(Te===f)?0:le===f?-1:1),j=le=>le===f?`${le} [current]`:le,ie=await e.ui.select("Select thinking level for reviewer agents",q.map(j));if(!ie)return;l=q.find(le=>j(le)===ie)??ie}id({provider:c.parsed.provider,modelId:c.parsed.modelId,thinkingLevel:l}),e.ui.notify(`checks config saved: ${c.parsed.provider}/${c.parsed.modelId} (thinking: ${l})`,"info")}function bd(e){e.registerCommand("checks",{description:"Strict review of agent_prompt.md/test.patch/solution.patch. Requires an option \u2014 see /checks.",getArgumentCompletions:ib,handler:async(t,n)=>{let r=t.trim();if(r===""){n.ui.notify(To.map(D=>`${D.value} \u2014 ${D.description}`).join(`
318
- `),"info");return}let a=[...new Set(r.split(/\s+/).filter(Boolean))],s=new Set(To.map(D=>D.value)),m=a.filter(D=>!s.has(D));if(m.length>0){n.ui.notify(`Unknown option(s): ${m.join(", ")}. Run /checks with no arguments to see the available options.`,"warning");return}if(a.includes("--config")){if(a.length>1){n.ui.notify("--config cannot be combined with other options.","warning");return}await sb(n);return}let c=new Set;if(a.includes("--all")||a.includes("--review"))for(let D of tt)c.add(D.key);for(let D of tt)a.includes(`--${D.key}`)&&c.add(D.key);let l=a.includes("--all")||a.includes("--gap-finder"),I=tt.filter(D=>c.has(D.key)),f=I.length>0;if(!f&&!l){n.ui.notify(`Nothing to run for: ${a.join(" ")}. Run /checks with no arguments to see the available options.`,"warning");return}let q=a.join(" ");if(sa()){n.ui.notify("A checks run is already in progress.","warning");return}let j=bo();if(!j){n.ui.notify("No reviewer model configured. Run /checks --config first.","error");return}let ie=n.modelRegistry.find(j.provider,j.modelId);if(!ie){n.ui.notify(`Configured model ${j.provider}/${j.modelId} not found. Run /checks --config again.`,"error");return}if(!n.modelRegistry.hasConfiguredAuth(ie)){n.ui.notify(`No auth configured for ${j.provider}/${j.modelId}.`,"error");return}let le=$o.filter(D=>!eb(Wn(n.cwd,D)));if(le.length>0){n.ui.notify(`Missing required file(s) in project root: ${le.join(", ")}`,"error");return}let Te=yd(),Ce=(f?I.length:0)+(l?2:0);n.ui.setWidget(Me,et("preparing clean snapshot",0,Ce)),n.ui.notify(`checks (${q}) started. Press ${ob} to cancel.`,"info");let nn;try{let D=Wn(ab(),`checks-${XI()}`);tb(D,{recursive:!0}),nn=D;let Vn=await ud(e,n.cwd,D);if(Vn.status==="error"){n.ui.notify(`checks: ${Vn.error}`,"error");return}for(let gt of $o)QI(Wn(n.cwd,gt),Wn(D,gt));let rn=gd(),an=xd(),Ae=0,on=[];if(f&&(n.ui.setWidget(Me,et("reviewing",Ae,Ce)),on=await Promise.all(I.map(gt=>ed({pi:e,role:gt,tempDir:D,model:ie,thinkingLevel:j.thinkingLevel,rubric:rn[gt.key],fairnessRules:an,cancelSignal:Te.signal}).then(Hn=>(Ae+=1,n.ui.setWidget(Me,et("reviewing",Ae,Ce)),Hn)))),Te.signal.aborted)){n.ui.notify("checks: cancelled.","warning");return}let nt={status:"ok",gaps:[]},Mt={status:"ok",gaps:[]};if(l){if(n.ui.setWidget(Me,et("finding test gaps",Ae,Ce)),nt=await td({tempDir:D,model:ie,thinkingLevel:j.thinkingLevel,testRubric:rn.tests,fairnessRules:an,cancelSignal:Te.signal}),Ae+=1,n.ui.setWidget(Me,et("finding test gaps",Ae,Ce)),Te.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}if(nt.status==="ok"&&nt.gaps.length>0&&(n.ui.setWidget(Me,et("validating test gaps",Ae,Ce)),Mt=await nd({tempDir:D,model:ie,thinkingLevel:j.thinkingLevel,testRubric:rn.tests,fairnessRules:an,candidates:nt.gaps,cancelSignal:Te.signal})),Ae+=1,n.ui.setWidget(Me,et("validating test gaps",Ae,Ce)),Te.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}n.ui.setWidget(Me,et("finalizing report",Ce,Ce));let sn={};I.forEach((gt,Hn)=>{on[Hn]&&(sn[gt.key]=on[Hn])});let Td=Mt.gaps,vd=l&&(nt.status!=="ok"||Mt.status!=="ok"),ma=Wn(n.cwd,"shipd_report.json"),kd=cd(ma),vo=ld({existingReport:kd,config:j,runReviewers:f,byRole:sn,runGapStages:l,testGaps:Td,gapAnalysisIncomplete:vd,gapFinderStatus:nt.status,gapFilterStatus:Mt.status}),ko=dd({merged:vo,runReviewers:f,activeRoles:I,byRole:sn,runGapStages:l});e.sendMessage({customType:"shipd_checks_report",content:ko.content,display:!0,details:ko.details}),rb(ma,JSON.stringify(vo,null,2),"utf-8"),n.ui.notify(`checks: wrote details to ${ma}`,"info")}catch(D){n.ui.notify(`checks failed: ${D instanceof Error?D.message:String(D)}`,"error")}finally{if(n.ui.setWidget(Me,void 0),nn)try{nb(nn,{recursive:!0,force:!0})}catch{}hd()}}})}var $d=mb.ctrlShift("x");function ub(e){e.registerMessageRenderer("shipd_checks_report",(t,n,r)=>{let a=t.details??{},s=l=>l==="PASS"?r.fg("success",l):r.fg("error",l),m=[];if(a.roleVerdicts)for(let[l,I]of Object.entries(a.roleVerdicts))m.push(`${l}: ${s(I)}`);if(a.overall){let l=a.overall==="PASS"&&a.hasTestGaps?" (with test gaps)":"";m.push(`Overall: ${s(a.overall)}${l}`)}if(a.showGaps){let l=a.gapsCount??0;m.push(l>0?r.fg("warning",`${l} test gap(s) found`):r.fg("success","no test gaps found"))}let c=m.length>0?m.join(" "):r.fg("dim","nothing to report");return new pb(`${r.bold("Checks: ")}${c}`,0,0)}),e.registerShortcut($d,{description:"Cancel an in-progress /checks run",handler:t=>{sa()&&Id()&&(t.ui.setWidget(Me,[`checks: cancelling (${$d})...`]),t.ui.notify("checks: cancelling...","warning"))}}),bd(e)}export{ub as default};
318
+ ---`;function vd(){let e=$d.split(/\r?\n(?=## )/g),t={};for(let n of nt){let r=e.find(a=>n.rubricHeading.test(a.trim()));t[n.key]=(r??$d).trim()}return t}function Td(){return ib.trim()}var ia=!1,an;function sa(){return ia}function kd(){return ia=!0,an=new AbortController,an}function Ed(){ia=!1,an=void 0}function wd(){return!ia||!an||an.signal.aborted?!1:(an.abort(),!0)}var fb="Ctrl+Shift+X",wo=[{value:"--all",label:"--all",description:"Run everything: 3 focus reviewers + test-gap finder/filter"},{value:"--review",label:"--review",description:"Run only the 3 focus reviewer agents (description/tests/solution)"},{value:"--description",label:"--description",description:"Run only the problem-description (prompt) focus reviewer"},{value:"--tests",label:"--tests",description:"Run only the tests focus reviewer"},{value:"--solution",label:"--solution",description:"Run only the solution focus reviewer"},{value:"--gap-finder",label:"--gap-finder",description:"Run only the 3-agent test-gap flow: positive finder + negative finder (parallel), then validator"},{value:"--config",label:"--config",description:"Set the reviewer model and thinking level"}];function gb(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"),I=wo.filter(f=>s.has(f.value)||c||l&&f.value==="--config"?!1:f.value.startsWith(a));return I.length>0?I.map(f=>({...f,value:`${m}${f.value}`})):null}async function hb(e){if(e.mode!=="tui"){e.ui.notify("/checks --config requires interactive mode","error");return}let t=fd();if(t.length===0){e.ui.notify("No enabledModels configured in settings.json.","error");return}let n=ko(),r=e.modelRegistry.getAll(),a=t.map(f=>{let P=gd(f);if(!P)return null;let N=r.find(ve=>ve.provider===P.provider&&ve.id===P.modelId),se=n?.provider===P.provider&&n?.modelId===P.modelId,te=N?`${N.name} (${f})`:f;return{ref:f,parsed:P,display:se?`${te} [current]`:te,found:N,isCurrent:se}}).filter(f=>f!==null);if(a.length===0){e.ui.notify("Could not resolve any enabledModels entries.","error");return}let s=[...a].sort((f,P)=>f.isCurrent===P.isCurrent?0:f.isCurrent?-1:1),m=await e.ui.select("Select model for checks reviewer agents",s.map(f=>f.display));if(!m)return;let c=a.find(f=>f.display===m);if(!c)return;let l="off",I=ld(c.found);if(I.length>1){let f=c.isCurrent?n?.thinkingLevel:void 0,P=[...I].sort((te,ve)=>te===f==(ve===f)?0:te===f?-1:1),N=te=>te===f?`${te} [current]`:te,se=await e.ui.select("Select thinking level for reviewer agents",P.map(N));if(!se)return;l=P.find(te=>N(te)===se)??se}dd({provider:c.parsed.provider,modelId:c.parsed.modelId,thinkingLevel:l}),e.ui.notify(`checks config saved: ${c.parsed.provider}/${c.parsed.modelId} (thinking: ${l})`,"info")}function Rd(e){e.registerCommand("checks",{description:"Strict review of agent_prompt.md/test.patch/solution.patch. Requires an option \u2014 see /checks.",getArgumentCompletions:gb,handler:async(t,n)=>{let r=t.trim();if(r===""){n.ui.notify(wo.map(F=>`${F.value} \u2014 ${F.description}`).join(`
319
+ `),"info");return}let a=[...new Set(r.split(/\s+/).filter(Boolean))],s=new Set(wo.map(F=>F.value)),m=a.filter(F=>!s.has(F));if(m.length>0){n.ui.notify(`Unknown option(s): ${m.join(", ")}. Run /checks with no arguments to see the available options.`,"warning");return}if(a.includes("--config")){if(a.length>1){n.ui.notify("--config cannot be combined with other options.","warning");return}await hb(n);return}let c=new Set;if(a.includes("--all")||a.includes("--review"))for(let F of nt)c.add(F.key);for(let F of nt)a.includes(`--${F.key}`)&&c.add(F.key);let l=a.includes("--all")||a.includes("--gap-finder"),I=nt.filter(F=>c.has(F.key)),f=I.length>0;if(!f&&!l){n.ui.notify(`Nothing to run for: ${a.join(" ")}. Run /checks with no arguments to see the available options.`,"warning");return}let P=a.join(" ");if(sa()){n.ui.notify("A checks run is already in progress.","warning");return}let N=ko();if(!N){n.ui.notify("No reviewer model configured. Run /checks --config first.","error");return}let se=n.modelRegistry.find(N.provider,N.modelId);if(!se){n.ui.notify(`Configured model ${N.provider}/${N.modelId} not found. Run /checks --config again.`,"error");return}if(!n.modelRegistry.hasConfiguredAuth(se)){n.ui.notify(`No auth configured for ${N.provider}/${N.modelId}.`,"error");return}let te=Eo.filter(F=>!pb(Wn(n.cwd,F)));if(te.length>0){n.ui.notify(`Missing required file(s) in project root: ${te.join(", ")}`,"error");return}let ve=kd(),Pe=(f?I.length:0)+(l?3:0);n.ui.setWidget(Oe,Je("preparing clean snapshot",0,Pe)),n.ui.notify(`checks (${P}) started. Press ${fb} to cancel.`,"info");let on;try{let F=Wn(db(),`checks-${sb()}`);ub(F,{recursive:!0}),on=F;let Hn=await xd(e,n.cwd,F);if(Hn.status==="error"){n.ui.notify(`checks: ${Hn.error}`,"error");return}for(let Fe of Eo)mb(Wn(n.cwd,Fe),Wn(F,Fe));let sn=vd(),mn=Td(),Te=0,pn=[];if(f&&(n.ui.setWidget(Oe,Je("reviewing",Te,Pe)),pn=await Promise.all(I.map(Fe=>md({pi:e,role:Fe,tempDir:F,model:se,thinkingLevel:N.thinkingLevel,rubric:sn[Fe.key],fairnessRules:mn,cancelSignal:ve.signal}).then(xt=>(Te+=1,n.ui.setWidget(Oe,Je("reviewing",Te,Pe)),xt)))),ve.signal.aborted)){n.ui.notify("checks: cancelled.","warning");return}let gt={status:"ok",gaps:[]},ht={status:"ok",gaps:[]},At={status:"ok",gaps:[]};if(l){let Fe={tempDir:F,model:se,thinkingLevel:N.thinkingLevel,testRubric:sn.tests,fairnessRules:mn,cancelSignal:ve.signal};if(n.ui.setWidget(Oe,Je("finding test gaps",Te,Pe)),[gt,ht]=await Promise.all([vo({...Fe,kind:"positive"}).then(ua=>(Te+=1,n.ui.setWidget(Oe,Je("finding test gaps",Te,Pe)),ua)),vo({...Fe,kind:"negative"}).then(ua=>(Te+=1,n.ui.setWidget(Oe,Je("finding test gaps",Te,Pe)),ua))]),ve.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}let xt=[...gt.gaps,...ht.gaps];if(xt.length>0&&(n.ui.setWidget(Oe,Je("validating test gaps",Te,Pe)),At=await pd({tempDir:F,model:se,thinkingLevel:N.thinkingLevel,testRubric:sn.tests,fairnessRules:mn,candidates:xt,cancelSignal:ve.signal})),Te+=1,n.ui.setWidget(Oe,Je("validating test gaps",Te,Pe)),ve.signal.aborted){n.ui.notify("checks: cancelled.","warning");return}}n.ui.setWidget(Oe,Je("finalizing report",Pe,Pe));let ma={};I.forEach((Fe,xt)=>{pn[xt]&&(ma[Fe.key]=pn[xt])});let Pd=At.gaps,Sd=gt.gaps.length>0||ht.gaps.length>0,Md=l&&(gt.status!=="ok"||ht.status!=="ok"||Sd&&At.status!=="ok"),pa=Wn(n.cwd,"shipd_report.json"),Cd=yd(pa),Ro=Id({existingReport:Cd,config:N,runReviewers:f,byRole:ma,runGapStages:l,testGaps:Pd,gapAnalysisIncomplete:Md,positiveGapFinderStatus:gt.status,negativeGapFinderStatus:ht.status,gapFilterStatus:At.status}),Oo=bd({merged:Ro,runReviewers:f,activeRoles:I,byRole:ma,runGapStages:l});e.sendMessage({customType:"shipd_checks_report",content:Oo.content,display:!0,details:Oo.details}),lb(pa,JSON.stringify(Ro,null,2),"utf-8"),n.ui.notify(`checks: wrote details to ${pa}`,"info")}catch(F){n.ui.notify(`checks failed: ${F instanceof Error?F.message:String(F)}`,"error")}finally{if(n.ui.setWidget(Oe,void 0),on)try{cb(on,{recursive:!0,force:!0})}catch{}Ed()}}})}var Od=xb.ctrlShift("x");function Ib(e){e.registerMessageRenderer("shipd_checks_report",(t,n,r)=>{let a=t.details??{},s=l=>l==="PASS"?r.fg("success",l):r.fg("error",l),m=[];if(a.roleVerdicts)for(let[l,I]of Object.entries(a.roleVerdicts))m.push(`${l}: ${s(I)}`);if(a.overall){let l=a.overall==="PASS"&&a.hasTestGaps?" (with test gaps)":"";m.push(`Overall: ${s(a.overall)}${l}`)}if(a.showGaps){let l=a.gapsCount??0;m.push(l>0?r.fg("warning",`${l} test gap(s) found`):r.fg("success","no test gaps found"))}let c=m.length>0?m.join(" "):r.fg("dim","nothing to report");return new yb(`${r.bold("Checks: ")}${c}`,0,0)}),e.registerShortcut(Od,{description:"Cancel an in-progress /checks run",handler:t=>{sa()&&wd()&&(t.ui.setWidget(Oe,[`checks: cancelling (${Od})...`]),t.ui.notify("checks: cancelling...","warning"))}}),Rd(e)}export{Ib as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sreetej510/pi-shipd-checks",
3
- "version": "0.1.8",
3
+ "version": "0.1.11",
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",