create-principles-disciple 1.124.0 → 1.124.2

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 (39) hide show
  1. package/console/dist/server/models/OwnerDecisionConsoleModel.js +13 -2
  2. package/console/dist/ui/api.js +1 -1
  3. package/console/dist/ui/i18n/en.json +6 -2
  4. package/console/dist/ui/i18n/zh-CN.json +6 -2
  5. package/console/dist/ui/pages/settings/SettingsPage.js +40 -4
  6. package/console/dist/web/assets/app.js +45 -10
  7. package/core/dist/index.d.ts +7 -12
  8. package/core/dist/index.d.ts.map +1 -1
  9. package/core/dist/index.js +7 -12
  10. package/core/dist/index.js.map +1 -1
  11. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js +1 -1
  12. package/core/dist/runtime-v2/__tests__/architecture-regression.test.js.map +1 -1
  13. package/core/dist/runtime-v2/__tests__/status-contract.test.js +0 -29
  14. package/core/dist/runtime-v2/__tests__/status-contract.test.js.map +1 -1
  15. package/core/dist/runtime-v2/index.d.ts +0 -1
  16. package/core/dist/runtime-v2/index.d.ts.map +1 -1
  17. package/core/dist/runtime-v2/index.js +0 -2
  18. package/core/dist/runtime-v2/index.js.map +1 -1
  19. package/core/package.json +0 -36
  20. package/package.json +1 -1
  21. package/plugin/dist/bundle.js +343 -343
  22. package/plugin/dist/governance-audit.js +5 -5
  23. package/plugin/dist/rulehost-evidence.js +4 -4
  24. package/core/dist/principle-injector.d.ts +0 -67
  25. package/core/dist/principle-injector.d.ts.map +0 -1
  26. package/core/dist/principle-injector.js +0 -89
  27. package/core/dist/principle-injector.js.map +0 -1
  28. package/core/dist/principle-injector.test.d.ts +0 -2
  29. package/core/dist/principle-injector.test.d.ts.map +0 -1
  30. package/core/dist/principle-injector.test.js +0 -158
  31. package/core/dist/principle-injector.test.js.map +0 -1
  32. package/core/dist/runtime-v2/store/task-migration.d.ts +0 -89
  33. package/core/dist/runtime-v2/store/task-migration.d.ts.map +0 -1
  34. package/core/dist/runtime-v2/store/task-migration.js +0 -79
  35. package/core/dist/runtime-v2/store/task-migration.js.map +0 -1
  36. package/dist/updater.d.ts +0 -39
  37. package/dist/updater.d.ts.map +0 -1
  38. package/dist/updater.js +0 -347
  39. package/dist/updater.js.map +0 -1
@@ -306,7 +306,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
306
306
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
307
307
  `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){$P(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",o=[];if(i&&n.sep&&!n.value){let a=[];for(let c=0;c<n.sep.length;++c){let u=n.sep[c];switch(u.type){case"newline":a.push(c);break;case"space":break;case"comment":u.indent>t.indent&&(a.length=0);break;default:a.length=0}}a.length>=2&&(o=n.sep.splice(a[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(o.push(this.sourceToken),t.items.push({start:o}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(o.push(this.sourceToken),t.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(fm(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(X_e(n.key)&&!fm(n.sep,"newline")){let a=mx(n.start),c=n.key,u=n.sep;u.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:c,sep:u}]})}else o.length>0?n.sep=n.sep.concat(o,this.sourceToken):n.sep.push(this.sourceToken);else if(fm(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let a=mx(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?t.items.push({start:o,key:null,sep:[this.sourceToken]}):fm(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);i||n.value?(t.items.push({start:o,key:a,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(a):(Object.assign(n,{key:a,sep:[]}),this.onKeyLine=!0);return}default:{let a=this.startBlockValue(t);if(a){if(a.type==="block-seq"){if(!n.explicitKey&&n.sep&&!fm(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:o});this.stack.push(a);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){$P(i,n.start),i.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||fm(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let i=DP(r),o=mx(i);Y_e(t);let a=t.end.splice(1,t.end.length);a.push(this.sourceToken);let c={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:o,key:t,sep:a}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=c}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
308
308
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
309
- `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=DP(t),r=mx(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=DP(t),r=mx(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Q_e.Parser=rB});var r0e=X(TT=>{"use strict";var Z_e=BG(),bdt=fT(),wT=yT(),wdt=jj(),Tdt=Cn(),Idt=nB(),e0e=iB();function t0e(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Idt.LineCounter||null,prettyErrors:t}}function kdt(e,t={}){let{lineCounter:n,prettyErrors:r}=t0e(t),i=new e0e.Parser(n?.addNewLine),o=new Z_e.Composer(t),a=Array.from(o.compose(i.parse(e)));if(r&&n)for(let c of a)c.errors.forEach(wT.prettifyError(e,n)),c.warnings.forEach(wT.prettifyError(e,n));return a.length>0?a:Object.assign([],{empty:!0},o.streamInfo())}function n0e(e,t={}){let{lineCounter:n,prettyErrors:r}=t0e(t),i=new e0e.Parser(n?.addNewLine),o=new Z_e.Composer(t),a=null;for(let c of o.compose(i.parse(e),!0,e.length))if(!a)a=c;else if(a.options.logLevel!=="silent"){a.errors.push(new wT.YAMLParseError(c.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(wT.prettifyError(e,n)),a.warnings.forEach(wT.prettifyError(e,n))),a}function Edt(e,t,n){let r;typeof t=="function"?r=t:n===void 0&&t&&typeof t=="object"&&(n=t);let i=n0e(e,n);if(!i)return null;if(i.warnings.forEach(o=>wdt.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function Sdt(e,t,n){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){let{keepUndefined:i}=n??t??{};if(!i)return}return Tdt.isDocument(e)&&!r?e.toString(n):new bdt.Document(e,r,n).toString(n)}TT.parse=Edt;TT.parseAllDocuments=kdt;TT.parseDocument=n0e;TT.stringify=Sdt});var aB=X(Bn=>{"use strict";var Adt=BG(),Rdt=fT(),Cdt=IG(),oB=yT(),Odt=Qw(),hm=Cn(),Pdt=lm(),Ldt=Pi(),Mdt=dm(),Ndt=mm(),Ddt=MP(),$dt=eB(),Fdt=nB(),Udt=iB(),FP=r0e(),i0e=zw();Bn.Composer=Adt.Composer;Bn.Document=Rdt.Document;Bn.Schema=Cdt.Schema;Bn.YAMLError=oB.YAMLError;Bn.YAMLParseError=oB.YAMLParseError;Bn.YAMLWarning=oB.YAMLWarning;Bn.Alias=Odt.Alias;Bn.isAlias=hm.isAlias;Bn.isCollection=hm.isCollection;Bn.isDocument=hm.isDocument;Bn.isMap=hm.isMap;Bn.isNode=hm.isNode;Bn.isPair=hm.isPair;Bn.isScalar=hm.isScalar;Bn.isSeq=hm.isSeq;Bn.Pair=Pdt.Pair;Bn.Scalar=Ldt.Scalar;Bn.YAMLMap=Mdt.YAMLMap;Bn.YAMLSeq=Ndt.YAMLSeq;Bn.CST=Ddt;Bn.Lexer=$dt.Lexer;Bn.LineCounter=Fdt.LineCounter;Bn.Parser=Udt.Parser;Bn.parse=FP.parse;Bn.parseAllDocuments=FP.parseAllDocuments;Bn.parseDocument=FP.parseDocument;Bn.stringify=FP.stringify;Bn.visit=i0e.visit;Bn.visitAsync=i0e.visitAsync});var m0e=X((TBn,qP)=>{function s0e(e){return Array.isArray(e)?e:[e]}var qdt=void 0,uB="",o0e=" ",cB="\\",jdt=/^\s+$/,Gdt=/(?:[^\\]|^)\\$/,Bdt=/^\\!/,Kdt=/^\\#/,Hdt=/\r?\n/g,Vdt=/^\.{0,2}\/|^\.{1,2}$/,zdt=/\/$/,fx="/",c0e="node-ignore";typeof Symbol<"u"&&(c0e=Symbol.for("node-ignore"));var u0e=c0e,hx=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),Jdt=/([0-z])-([0-z])/g,l0e=()=>!1,Ydt=e=>e.replace(Jdt,(t,n,r)=>n.charCodeAt(0)<=r.charCodeAt(0)?t:uB),Xdt=e=>{let{length:t}=e;return e.slice(0,t-t%2)},Qdt=[[/^\uFEFF/,()=>uB],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf("\\")===0?o0e:uB)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+o0e}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>{let r=n.replace(/\\\*/g,"[^\\/]*");return t+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>cB],[/\\\\/g,()=>cB],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===cB?`\\[${n}${Xdt(r)}${i}`:i==="]"&&r.length%2===0?`[${Ydt(n)}${r}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`]],Zdt=/(^|\\\/)?\\\*$/,IT="regex",UP="checkRegex",a0e="_",emt={[IT](e,t){return`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`},[UP](e,t){return`${t?`${t}[^/]*`:"[^/]*"}(?=$|\\/$)`}},tmt=e=>Qdt.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),WP=e=>typeof e=="string",nmt=e=>e&&WP(e)&&!jdt.test(e)&&!Gdt.test(e)&&e.indexOf("#")!==0,rmt=e=>e.split(Hdt).filter(Boolean),lB=class{constructor(t,n,r,i,o,a){this.pattern=t,this.mark=n,this.negative=o,hx(this,"body",r),hx(this,"ignoreCase",i),hx(this,"regexPrefix",a)}get regex(){let t=a0e+IT;return this[t]?this[t]:this._make(IT,t)}get checkRegex(){let t=a0e+UP;return this[t]?this[t]:this._make(UP,t)}_make(t,n){let r=this.regexPrefix.replace(Zdt,emt[t]),i=this.ignoreCase?new RegExp(r,"i"):new RegExp(r);return hx(this,n,i)}},imt=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf("!")===0&&(r=!0,i=i.substr(1)),i=i.replace(Bdt,"!").replace(Kdt,"#");let o=tmt(i);return new lB(e,t,i,n,r,o)},pB=class{constructor(t){this._ignoreCase=t,this._rules=[]}_add(t){if(t&&t[u0e]){this._rules=this._rules.concat(t._rules._rules),this._added=!0;return}if(WP(t)&&(t={pattern:t}),nmt(t.pattern)){let n=imt(t,this._ignoreCase);this._added=!0,this._rules.push(n)}}add(t){return this._added=!1,s0e(WP(t)?rmt(t):t).forEach(this._add,this),this._added}test(t,n,r){let i=!1,o=!1,a;this._rules.forEach(u=>{let{negative:l}=u;o===l&&i!==o||l&&!i&&!o&&!n||!u[r].test(t)||(i=!l,o=l,a=l?qdt:u)});let c={ignored:i,unignored:o};return a&&(c.rule=a),c}},omt=(e,t)=>{throw new t(e)},Ep=(e,t,n)=>WP(e)?e?Ep.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n("path must not be empty",TypeError):n(`path must be a string, but got \`${t}\``,TypeError),p0e=e=>Vdt.test(e);Ep.isNotRelative=p0e;Ep.convert=e=>e;var dB=class{constructor({ignorecase:t=!0,ignoreCase:n=t,allowRelativePaths:r=!1}={}){hx(this,u0e,!0),this._rules=new pB(n),this._strictPathCheck=!r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(t){return this._rules.add(t)&&this._initCache(),this}addPattern(t){return this.add(t)}_test(t,n,r,i){let o=t&&Ep.convert(t);return Ep(o,t,this._strictPathCheck?omt:l0e),this._t(o,n,r,i)}checkIgnore(t){if(!zdt.test(t))return this.test(t);let n=t.split(fx).filter(Boolean);if(n.pop(),n.length){let r=this._t(n.join(fx)+fx,this._testCache,!0,n);if(r.ignored)return r}return this._rules.test(t,!1,UP)}_t(t,n,r,i){if(t in n)return n[t];if(i||(i=t.split(fx).filter(Boolean)),i.pop(),!i.length)return n[t]=this._rules.test(t,r,IT);let o=this._t(i.join(fx)+fx,n,r,i);return n[t]=o.ignored?o:this._rules.test(t,r,IT)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return s0e(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}},mB=e=>new dB(e),amt=e=>Ep(e&&Ep.convert(e),e,l0e),d0e=()=>{let e=n=>/^\\\\\?\\/.test(n)||/["<>|\u0000-\u001F]+/u.test(n)?n:n.replace(/\\/g,"/");Ep.convert=e;let t=/^[a-z]:\//i;Ep.isNotRelative=n=>t.test(n)||p0e(n)};typeof process<"u"&&process.platform==="win32"&&d0e();qP.exports=mB;mB.default=mB;qP.exports.isPathValid=amt;hx(qP.exports,Symbol.for("setupWindows"),d0e)});var Oo={};On(Oo,{HasPropertyKey:()=>UI,IsArray:()=>ci,IsAsyncIterator:()=>ML,IsBigInt:()=>Jx,IsBoolean:()=>wl,IsDate:()=>Dm,IsFunction:()=>NL,IsIterator:()=>DL,IsNull:()=>$L,IsNumber:()=>Va,IsObject:()=>zn,IsRegExp:()=>Yx,IsString:()=>or,IsSymbol:()=>FL,IsUint8Array:()=>Tl,IsUndefined:()=>ui});function UI(e,t){return t in e}function ML(e){return zn(e)&&!ci(e)&&!Tl(e)&&Symbol.asyncIterator in e}function ci(e){return Array.isArray(e)}function Jx(e){return typeof e=="bigint"}function wl(e){return typeof e=="boolean"}function Dm(e){return e instanceof globalThis.Date}function NL(e){return typeof e=="function"}function DL(e){return zn(e)&&!ci(e)&&!Tl(e)&&Symbol.iterator in e}function $L(e){return e===null}function Va(e){return typeof e=="number"}function zn(e){return typeof e=="object"&&e!==null}function Yx(e){return e instanceof globalThis.RegExp}function or(e){return typeof e=="string"}function FL(e){return typeof e=="symbol"}function Tl(e){return e instanceof globalThis.Uint8Array}function ui(e){return e===void 0}function jAe(e){return e.map(t=>WI(t))}function GAe(e){return new Date(e.getTime())}function BAe(e){return new Uint8Array(e)}function KAe(e){return new RegExp(e.source,e.flags)}function HAe(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=WI(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=WI(e[n]);return t}function WI(e){return ci(e)?jAe(e):Dm(e)?GAe(e):Tl(e)?BAe(e):Yx(e)?KAe(e):zn(e)?HAe(e):e}function _r(e){return WI(e)}function rg(e,t){return t===void 0?_r(e):_r({...t,...e})}function qI(e){return Ut(e)&&globalThis.Symbol.asyncIterator in e}function jI(e){return Ut(e)&&globalThis.Symbol.iterator in e}function UL(e){return Ut(e)&&(globalThis.Object.getPrototypeOf(e)===Object.prototype||globalThis.Object.getPrototypeOf(e)===null)}function GI(e){return e instanceof globalThis.Promise}function Xo(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function FK(e){return e instanceof globalThis.Map}function UK(e){return e instanceof globalThis.Set}function As(e){return globalThis.ArrayBuffer.isView(e)}function ig(e){return e instanceof globalThis.Uint8Array}function Tt(e,t){return t in e}function Ut(e){return e!==null&&typeof e=="object"}function Rt(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function xr(e){return e===void 0}function Il(e){return e===null}function hu(e){return typeof e=="boolean"}function vr(e){return typeof e=="number"}function BI(e){return globalThis.Number.isInteger(e)}function hc(e){return typeof e=="bigint"}function qn(e){return typeof e=="string"}function Fp(e){return typeof e=="function"}function kl(e){return typeof e=="symbol"}function za(e){return hc(e)||hu(e)||Il(e)||vr(e)||qn(e)||kl(e)||xr(e)}var xi;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(a,c){return e.ExactOptionalPropertyTypes?c in a:a[c]!==void 0}e.IsExactOptionalProperty=t;function n(a){let c=Ut(a);return e.AllowArrayObject?c:c&&!Rt(a)}e.IsObjectLike=n;function r(a){return n(a)&&!(a instanceof Date)&&!(a instanceof Uint8Array)}e.IsRecordLike=r;function i(a){return e.AllowNaN?vr(a):Number.isFinite(a)}e.IsNumberLike=i;function o(a){let c=xr(a);return e.AllowNullVoid?c||a===null:c}e.IsVoidLike=o})(xi||(xi={}));function VAe(e){return globalThis.Object.freeze(e).map(t=>Xx(t))}function zAe(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=Xx(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=Xx(e[n]);return globalThis.Object.freeze(t)}function Xx(e){return ci(e)?VAe(e):Dm(e)?e:Tl(e)?e:Yx(e)?e:zn(e)?zAe(e):e}function fe(e,t){let n=t!==void 0?{...t,...e}:e;switch(xi.InstanceMode){case"freeze":return Xx(n);case"clone":return _r(n);default:return n}}var Mt=class extends Error{constructor(t){super(t)}};var Or=Symbol.for("TypeBox.Transform"),gc=Symbol.for("TypeBox.Readonly"),fo=Symbol.for("TypeBox.Optional"),Rs=Symbol.for("TypeBox.Hint"),he=Symbol.for("TypeBox.Kind");function og(e){return zn(e)&&e[gc]==="Readonly"}function _a(e){return zn(e)&&e[fo]==="Optional"}function WL(e){return gn(e,"Any")}function qL(e){return gn(e,"Argument")}function yc(e){return gn(e,"Array")}function $m(e){return gn(e,"AsyncIterator")}function Fm(e){return gn(e,"BigInt")}function El(e){return gn(e,"Boolean")}function _c(e){return gn(e,"Computed")}function xc(e){return gn(e,"Constructor")}function JAe(e){return gn(e,"Date")}function vc(e){return gn(e,"Function")}function bc(e){return gn(e,"Integer")}function Gr(e){return gn(e,"Intersect")}function Um(e){return gn(e,"Iterator")}function gn(e,t){return zn(e)&&he in e&&e[he]===t}function KI(e){return wl(e)||Va(e)||or(e)}function Ja(e){return gn(e,"Literal")}function Ya(e){return gn(e,"MappedKey")}function br(e){return gn(e,"MappedResult")}function Up(e){return gn(e,"Never")}function YAe(e){return gn(e,"Not")}function Qx(e){return gn(e,"Null")}function wc(e){return gn(e,"Number")}function li(e){return gn(e,"Object")}function Wm(e){return gn(e,"Promise")}function qm(e){return gn(e,"Record")}function Xr(e){return gn(e,"Ref")}function jL(e){return gn(e,"RegExp")}function Sl(e){return gn(e,"String")}function Zx(e){return gn(e,"Symbol")}function Xa(e){return gn(e,"TemplateLiteral")}function XAe(e){return gn(e,"This")}function Pn(e){return zn(e)&&Or in e}function Qa(e){return gn(e,"Tuple")}function Al(e){return gn(e,"Undefined")}function xn(e){return gn(e,"Union")}function QAe(e){return gn(e,"Uint8Array")}function ZAe(e){return gn(e,"Unknown")}function eRe(e){return gn(e,"Unsafe")}function tRe(e){return gn(e,"Void")}function Wp(e){return zn(e)&&he in e&&or(e[he])}function Pr(e){return WL(e)||qL(e)||yc(e)||El(e)||Fm(e)||$m(e)||_c(e)||xc(e)||JAe(e)||vc(e)||bc(e)||Gr(e)||Um(e)||Ja(e)||Ya(e)||br(e)||Up(e)||YAe(e)||Qx(e)||wc(e)||li(e)||Wm(e)||qm(e)||Xr(e)||jL(e)||Sl(e)||Zx(e)||Xa(e)||XAe(e)||Qa(e)||Al(e)||xn(e)||QAe(e)||ZAe(e)||eRe(e)||tRe(e)||Wp(e)}var V={};On(V,{IsAny:()=>GK,IsArgument:()=>BK,IsArray:()=>KK,IsAsyncIterator:()=>HK,IsBigInt:()=>VK,IsBoolean:()=>zK,IsComputed:()=>JK,IsConstructor:()=>YK,IsDate:()=>XK,IsFunction:()=>QK,IsImport:()=>sRe,IsInteger:()=>ZK,IsIntersect:()=>e6,IsIterator:()=>t6,IsKind:()=>S6,IsKindOf:()=>sn,IsLiteral:()=>tv,IsLiteralBoolean:()=>cRe,IsLiteralNumber:()=>r6,IsLiteralString:()=>n6,IsLiteralValue:()=>i6,IsMappedKey:()=>o6,IsMappedResult:()=>a6,IsNever:()=>s6,IsNot:()=>c6,IsNull:()=>u6,IsNumber:()=>l6,IsObject:()=>p6,IsOptional:()=>aRe,IsPromise:()=>d6,IsProperties:()=>HI,IsReadonly:()=>oRe,IsRecord:()=>m6,IsRecursive:()=>uRe,IsRef:()=>f6,IsRegExp:()=>h6,IsSchema:()=>Vi,IsString:()=>g6,IsSymbol:()=>y6,IsTemplateLiteral:()=>_6,IsThis:()=>x6,IsTransform:()=>v6,IsTuple:()=>b6,IsUint8Array:()=>T6,IsUndefined:()=>w6,IsUnion:()=>HL,IsUnionLiteral:()=>lRe,IsUnknown:()=>I6,IsUnsafe:()=>k6,IsVoid:()=>E6,TypeGuardUnknownTypeError:()=>GL});var GL=class extends Mt{},nRe=["Argument","Any","Array","AsyncIterator","BigInt","Boolean","Computed","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function WK(e){try{return new RegExp(e),!0}catch{return!1}}function BL(e){if(!or(e))return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=7&&n<=13||n===27||n===127)return!1}return!0}function qK(e){return KL(e)||Vi(e)}function ev(e){return ui(e)||Jx(e)}function ar(e){return ui(e)||Va(e)}function KL(e){return ui(e)||wl(e)}function Jn(e){return ui(e)||or(e)}function rRe(e){return ui(e)||or(e)&&BL(e)&&WK(e)}function iRe(e){return ui(e)||or(e)&&BL(e)}function jK(e){return ui(e)||Vi(e)}function oRe(e){return zn(e)&&e[gc]==="Readonly"}function aRe(e){return zn(e)&&e[fo]==="Optional"}function GK(e){return sn(e,"Any")&&Jn(e.$id)}function BK(e){return sn(e,"Argument")&&Va(e.index)}function KK(e){return sn(e,"Array")&&e.type==="array"&&Jn(e.$id)&&Vi(e.items)&&ar(e.minItems)&&ar(e.maxItems)&&KL(e.uniqueItems)&&jK(e.contains)&&ar(e.minContains)&&ar(e.maxContains)}function HK(e){return sn(e,"AsyncIterator")&&e.type==="AsyncIterator"&&Jn(e.$id)&&Vi(e.items)}function VK(e){return sn(e,"BigInt")&&e.type==="bigint"&&Jn(e.$id)&&ev(e.exclusiveMaximum)&&ev(e.exclusiveMinimum)&&ev(e.maximum)&&ev(e.minimum)&&ev(e.multipleOf)}function zK(e){return sn(e,"Boolean")&&e.type==="boolean"&&Jn(e.$id)}function JK(e){return sn(e,"Computed")&&or(e.target)&&ci(e.parameters)&&e.parameters.every(t=>Vi(t))}function YK(e){return sn(e,"Constructor")&&e.type==="Constructor"&&Jn(e.$id)&&ci(e.parameters)&&e.parameters.every(t=>Vi(t))&&Vi(e.returns)}function XK(e){return sn(e,"Date")&&e.type==="Date"&&Jn(e.$id)&&ar(e.exclusiveMaximumTimestamp)&&ar(e.exclusiveMinimumTimestamp)&&ar(e.maximumTimestamp)&&ar(e.minimumTimestamp)&&ar(e.multipleOfTimestamp)}function QK(e){return sn(e,"Function")&&e.type==="Function"&&Jn(e.$id)&&ci(e.parameters)&&e.parameters.every(t=>Vi(t))&&Vi(e.returns)}function sRe(e){return sn(e,"Import")&&UI(e,"$defs")&&zn(e.$defs)&&HI(e.$defs)&&UI(e,"$ref")&&or(e.$ref)&&e.$ref in e.$defs}function ZK(e){return sn(e,"Integer")&&e.type==="integer"&&Jn(e.$id)&&ar(e.exclusiveMaximum)&&ar(e.exclusiveMinimum)&&ar(e.maximum)&&ar(e.minimum)&&ar(e.multipleOf)}function HI(e){return zn(e)&&Object.entries(e).every(([t,n])=>BL(t)&&Vi(n))}function e6(e){return sn(e,"Intersect")&&!(or(e.type)&&e.type!=="object")&&ci(e.allOf)&&e.allOf.every(t=>Vi(t)&&!v6(t))&&Jn(e.type)&&(KL(e.unevaluatedProperties)||jK(e.unevaluatedProperties))&&Jn(e.$id)}function t6(e){return sn(e,"Iterator")&&e.type==="Iterator"&&Jn(e.$id)&&Vi(e.items)}function sn(e,t){return zn(e)&&he in e&&e[he]===t}function n6(e){return tv(e)&&or(e.const)}function r6(e){return tv(e)&&Va(e.const)}function cRe(e){return tv(e)&&wl(e.const)}function tv(e){return sn(e,"Literal")&&Jn(e.$id)&&i6(e.const)}function i6(e){return wl(e)||Va(e)||or(e)}function o6(e){return sn(e,"MappedKey")&&ci(e.keys)&&e.keys.every(t=>Va(t)||or(t))}function a6(e){return sn(e,"MappedResult")&&HI(e.properties)}function s6(e){return sn(e,"Never")&&zn(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function c6(e){return sn(e,"Not")&&Vi(e.not)}function u6(e){return sn(e,"Null")&&e.type==="null"&&Jn(e.$id)}function l6(e){return sn(e,"Number")&&e.type==="number"&&Jn(e.$id)&&ar(e.exclusiveMaximum)&&ar(e.exclusiveMinimum)&&ar(e.maximum)&&ar(e.minimum)&&ar(e.multipleOf)}function p6(e){return sn(e,"Object")&&e.type==="object"&&Jn(e.$id)&&HI(e.properties)&&qK(e.additionalProperties)&&ar(e.minProperties)&&ar(e.maxProperties)}function d6(e){return sn(e,"Promise")&&e.type==="Promise"&&Jn(e.$id)&&Vi(e.item)}function m6(e){return sn(e,"Record")&&e.type==="object"&&Jn(e.$id)&&qK(e.additionalProperties)&&zn(e.patternProperties)&&(t=>{let n=Object.getOwnPropertyNames(t.patternProperties);return n.length===1&&WK(n[0])&&zn(t.patternProperties)&&Vi(t.patternProperties[n[0]])})(e)}function uRe(e){return zn(e)&&Rs in e&&e[Rs]==="Recursive"}function f6(e){return sn(e,"Ref")&&Jn(e.$id)&&or(e.$ref)}function h6(e){return sn(e,"RegExp")&&Jn(e.$id)&&or(e.source)&&or(e.flags)&&ar(e.maxLength)&&ar(e.minLength)}function g6(e){return sn(e,"String")&&e.type==="string"&&Jn(e.$id)&&ar(e.minLength)&&ar(e.maxLength)&&rRe(e.pattern)&&iRe(e.format)}function y6(e){return sn(e,"Symbol")&&e.type==="symbol"&&Jn(e.$id)}function _6(e){return sn(e,"TemplateLiteral")&&e.type==="string"&&or(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function x6(e){return sn(e,"This")&&Jn(e.$id)&&or(e.$ref)}function v6(e){return zn(e)&&Or in e}function b6(e){return sn(e,"Tuple")&&e.type==="array"&&Jn(e.$id)&&Va(e.minItems)&&Va(e.maxItems)&&e.minItems===e.maxItems&&(ui(e.items)&&ui(e.additionalItems)&&e.minItems===0||ci(e.items)&&e.items.every(t=>Vi(t)))}function w6(e){return sn(e,"Undefined")&&e.type==="undefined"&&Jn(e.$id)}function lRe(e){return HL(e)&&e.anyOf.every(t=>n6(t)||r6(t))}function HL(e){return sn(e,"Union")&&Jn(e.$id)&&zn(e)&&ci(e.anyOf)&&e.anyOf.every(t=>Vi(t))}function T6(e){return sn(e,"Uint8Array")&&e.type==="Uint8Array"&&Jn(e.$id)&&ar(e.minByteLength)&&ar(e.maxByteLength)}function I6(e){return sn(e,"Unknown")&&Jn(e.$id)}function k6(e){return sn(e,"Unsafe")}function E6(e){return sn(e,"Void")&&e.type==="void"&&Jn(e.$id)}function S6(e){return zn(e)&&he in e&&or(e[he])&&!nRe.includes(e[he])}function Vi(e){return zn(e)&&(GK(e)||BK(e)||KK(e)||zK(e)||VK(e)||HK(e)||JK(e)||YK(e)||XK(e)||QK(e)||ZK(e)||e6(e)||t6(e)||tv(e)||o6(e)||a6(e)||s6(e)||c6(e)||u6(e)||l6(e)||p6(e)||d6(e)||m6(e)||f6(e)||h6(e)||g6(e)||y6(e)||_6(e)||x6(e)||b6(e)||w6(e)||HL(e)||T6(e)||I6(e)||k6(e)||E6(e)||S6(e))}var VL="(true|false)",nv="(0|[1-9][0-9]*)",zL="(.*)",pRe="(?!.*)",zwt=`^${VL}$`,qp=`^${nv}$`,jp=`^${zL}$`,A6=`^${pRe}$`;var gu={};On(gu,{Clear:()=>mRe,Delete:()=>fRe,Entries:()=>dRe,Get:()=>yRe,Has:()=>hRe,Set:()=>gRe});var ag=new Map;function dRe(){return new Map(ag)}function mRe(){return ag.clear()}function fRe(e){return ag.delete(e)}function hRe(e){return ag.has(e)}function gRe(e,t){ag.set(e,t)}function yRe(e){return ag.get(e)}var Tc={};On(Tc,{Clear:()=>xRe,Delete:()=>vRe,Entries:()=>_Re,Get:()=>TRe,Has:()=>bRe,Set:()=>wRe});var sg=new Map;function _Re(){return new Map(sg)}function xRe(){return sg.clear()}function vRe(e){return sg.delete(e)}function bRe(e){return sg.has(e)}function wRe(e,t){sg.set(e,t)}function TRe(e){return sg.get(e)}function R6(e,t){return e.includes(t)}function C6(e){return[...new Set(e)]}function IRe(e,t){return e.filter(n=>t.includes(n))}function kRe(e,t){return e.reduce((n,r)=>IRe(n,r),t)}function O6(e){return e.length===1?e[0]:e.length>1?kRe(e.slice(1),e[0]):[]}function P6(e){let t=[];for(let n of e)t.push(...n);return t}function Gp(e){return fe({[he]:"Any"},e)}function cg(e,t){return fe({[he]:"Array",type:"array",items:e},t)}function L6(e){return fe({[he]:"Argument",index:e})}function ug(e,t){return fe({[he]:"AsyncIterator",type:"AsyncIterator",items:e},t)}function lr(e,t,n){return fe({[he]:"Computed",target:e,parameters:t},n)}function ERe(e,t){let{[t]:n,...r}=e;return r}function Br(e,t){return t.reduce((n,r)=>ERe(n,r),e)}function rn(e){return fe({[he]:"Never",not:{}},e)}function Sn(e){return fe({[he]:"MappedResult",properties:e})}function lg(e,t,n){return fe({[he]:"Constructor",type:"Constructor",parameters:e,returns:t},n)}function yu(e,t,n){return fe({[he]:"Function",type:"Function",parameters:e,returns:t},n)}function rv(e,t){return fe({[he]:"Union",anyOf:e},t)}function SRe(e){return e.some(t=>_a(t))}function M6(e){return e.map(t=>_a(t)?ARe(t):t)}function ARe(e){return Br(e,[fo])}function RRe(e,t){return SRe(e)?Po(rv(M6(e),t)):rv(M6(e),t)}function _u(e,t){return e.length===1?fe(e[0],t):e.length===0?rn(t):RRe(e,t)}function Ln(e,t){return e.length===0?rn(t):e.length===1?fe(e[0],t):rv(e,t)}var VI=class extends Mt{};function CRe(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function JL(e,t,n){return e[t]===n&&e.charCodeAt(t-1)!==92}function Cl(e,t){return JL(e,t,"(")}function iv(e,t){return JL(e,t,")")}function N6(e,t){return JL(e,t,"|")}function ORe(e){if(!(Cl(e,0)&&iv(e,e.length-1)))return!1;let t=0;for(let n=0;n<e.length;n++)if(Cl(e,n)&&(t+=1),iv(e,n)&&(t-=1),t===0&&n!==e.length-1)return!1;return!0}function PRe(e){return e.slice(1,e.length-1)}function LRe(e){let t=0;for(let n=0;n<e.length;n++)if(Cl(e,n)&&(t+=1),iv(e,n)&&(t-=1),N6(e,n)&&t===0)return!0;return!1}function MRe(e){for(let t=0;t<e.length;t++)if(Cl(e,t))return!0;return!1}function NRe(e){let[t,n]=[0,0],r=[];for(let o=0;o<e.length;o++)if(Cl(e,o)&&(t+=1),iv(e,o)&&(t-=1),N6(e,o)&&t===0){let a=e.slice(n,o);a.length>0&&r.push(pg(a)),n=o+1}let i=e.slice(n);return i.length>0&&r.push(pg(i)),r.length===0?{type:"const",const:""}:r.length===1?r[0]:{type:"or",expr:r}}function DRe(e){function t(i,o){if(!Cl(i,o))throw new VI("TemplateLiteralParser: Index must point to open parens");let a=0;for(let c=o;c<i.length;c++)if(Cl(i,c)&&(a+=1),iv(i,c)&&(a-=1),a===0)return[o,c];throw new VI("TemplateLiteralParser: Unclosed group parens in expression")}function n(i,o){for(let a=o;a<i.length;a++)if(Cl(i,a))return[o,a];return[o,i.length]}let r=[];for(let i=0;i<e.length;i++)if(Cl(e,i)){let[o,a]=t(e,i),c=e.slice(o,a+1);r.push(pg(c)),i=a}else{let[o,a]=n(e,i),c=e.slice(o,a);c.length>0&&r.push(pg(c)),i=a-1}return r.length===0?{type:"const",const:""}:r.length===1?r[0]:{type:"and",expr:r}}function pg(e){return ORe(e)?pg(PRe(e)):LRe(e)?NRe(e):MRe(e)?DRe(e):{type:"const",const:CRe(e)}}function dg(e){return pg(e.slice(1,e.length-1))}var YL=class extends Mt{};function $Re(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="0"&&e.expr[1].type==="const"&&e.expr[1].const==="[1-9][0-9]*"}function FRe(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="true"&&e.expr[1].type==="const"&&e.expr[1].const==="false"}function URe(e){return e.type==="const"&&e.const===".*"}function jm(e){return $Re(e)||URe(e)?!1:FRe(e)?!0:e.type==="and"?e.expr.every(t=>jm(t)):e.type==="or"?e.expr.every(t=>jm(t)):e.type==="const"?!0:(()=>{throw new YL("Unknown expression type")})()}function zI(e){let t=dg(e.pattern);return jm(t)}var XL=class extends Mt{};function*D6(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let n of D6(e.slice(1)))yield`${t}${n}`}function*WRe(e){return yield*D6(e.expr.map(t=>[...ov(t)]))}function*qRe(e){for(let t of e.expr)yield*ov(t)}function*jRe(e){return yield e.const}function*ov(e){return e.type==="and"?yield*WRe(e):e.type==="or"?yield*qRe(e):e.type==="const"?yield*jRe(e):(()=>{throw new XL("Unknown expression")})()}function mg(e){let t=dg(e.pattern);return jm(t)?[...ov(t)]:[]}function yn(e,t){return fe({[he]:"Literal",const:e,type:typeof e},t)}function JI(e){return fe({[he]:"Boolean",type:"boolean"},e)}function fg(e){return fe({[he]:"BigInt",type:"bigint"},e)}function Cs(e){return fe({[he]:"Number",type:"number"},e)}function Qo(e){return fe({[he]:"String",type:"string"},e)}function*GRe(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield JI():t==="number"?yield Cs():t==="bigint"?yield fg():t==="string"?yield Qo():yield(()=>{let n=t.split("|").map(r=>yn(r.trim()));return n.length===0?rn():n.length===1?n[0]:_u(n)})()}function*BRe(e){if(e[1]!=="{"){let t=yn("$"),n=QL(e.slice(1));return yield*[t,...n]}for(let t=2;t<e.length;t++)if(e[t]==="}"){let n=GRe(e.slice(2,t)),r=QL(e.slice(t+1));return yield*[...n,...r]}yield yn(e)}function*QL(e){for(let t=0;t<e.length;t++)if(e[t]==="$"){let n=yn(e.slice(0,t)),r=BRe(e.slice(t));return yield*[n,...r]}yield yn(e)}function $6(e){return[...QL(e)]}var ZL=class extends Mt{};function KRe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F6(e,t){return Xa(e)?e.pattern.slice(1,e.pattern.length-1):xn(e)?`(${e.anyOf.map(n=>F6(n,t)).join("|")})`:wc(e)?`${t}${nv}`:bc(e)?`${t}${nv}`:Fm(e)?`${t}${nv}`:Sl(e)?`${t}${zL}`:Ja(e)?`${t}${KRe(e.const.toString())}`:El(e)?`${t}${VL}`:(()=>{throw new ZL(`Unexpected Kind '${e[he]}'`)})()}function eM(e){return`^${e.map(t=>F6(t,"")).join("")}$`}function Gm(e){let n=mg(e).map(r=>yn(r));return _u(n)}function YI(e,t){let n=or(e)?eM($6(e)):eM(e);return fe({[he]:"TemplateLiteral",type:"string",pattern:n},t)}function HRe(e){return mg(e).map(n=>n.toString())}function VRe(e){let t=[];for(let n of e)t.push(...xa(n));return t}function zRe(e){return[e.toString()]}function xa(e){return[...new Set(Xa(e)?HRe(e):xn(e)?VRe(e.anyOf):Ja(e)?zRe(e.const):wc(e)?["[number]"]:bc(e)?["[number]"]:[])]}function JRe(e,t,n){let r={};for(let i of Object.getOwnPropertyNames(t))r[i]=Bp(e,xa(t[i]),n);return r}function YRe(e,t,n){return JRe(e,t.properties,n)}function U6(e,t,n){let r=YRe(e,t,n);return Sn(r)}function q6(e,t){return e.map(n=>j6(n,t))}function XRe(e){return e.filter(t=>!Up(t))}function QRe(e,t){return XI(XRe(q6(e,t)))}function ZRe(e){return e.some(t=>Up(t))?[]:e}function eCe(e,t){return _u(ZRe(q6(e,t)))}function tCe(e,t){return t in e?e[t]:t==="[number]"?_u(e):rn()}function nCe(e,t){return t==="[number]"?e:rn()}function rCe(e,t){return t in e?e[t]:rn()}function j6(e,t){return Gr(e)?QRe(e.allOf,t):xn(e)?eCe(e.anyOf,t):Qa(e)?tCe(e.items??[],t):yc(e)?nCe(e.items,t):li(e)?rCe(e.properties,t):rn()}function av(e,t){return t.map(n=>j6(e,n))}function W6(e,t){return _u(av(e,t))}function Bp(e,t,n){if(Xr(e)||Xr(t)){let r="Index types using Ref parameters require both Type and Key to be of TSchema";if(!Pr(e)||!Pr(t))throw new Mt(r);return lr("Index",[e,t])}return br(t)?U6(e,t,n):Ya(t)?G6(e,t,n):fe(Pr(t)?W6(e,xa(t)):W6(e,t),n)}function iCe(e,t,n){return{[t]:Bp(e,[t],_r(n))}}function oCe(e,t,n){return t.reduce((r,i)=>({...r,...iCe(e,i,n)}),{})}function aCe(e,t,n){return oCe(e,t.keys,n)}function G6(e,t,n){let r=aCe(e,t,n);return Sn(r)}function hg(e,t){return fe({[he]:"Iterator",type:"Iterator",items:e},t)}function sCe(e){return globalThis.Object.keys(e).filter(t=>!_a(e[t]))}function cCe(e,t){let n=sCe(e),r=n.length>0?{[he]:"Object",type:"object",required:n,properties:e}:{[he]:"Object",type:"object",properties:e};return fe(r,t)}var Mn=cCe;function QI(e,t){return fe({[he]:"Promise",type:"Promise",item:e},t)}function uCe(e){return fe(Br(e,[gc]))}function lCe(e){return fe({...e,[gc]:"Readonly"})}function pCe(e,t){return t===!1?uCe(e):lCe(e)}function va(e,t){let n=t??!0;return br(e)?B6(e,n):pCe(e,n)}function dCe(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=va(e[r],t);return n}function mCe(e,t){return dCe(e.properties,t)}function B6(e,t){let n=mCe(e,t);return Sn(n)}function Os(e,t){return fe(e.length>0?{[he]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[he]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},t)}function K6(e,t){return e in t?Ps(e,t[e]):Sn(t)}function fCe(e){return{[e]:yn(e)}}function hCe(e){let t={};for(let n of e)t[n]=yn(n);return t}function gCe(e,t){return R6(t,e)?fCe(e):hCe(t)}function yCe(e,t){let n=gCe(e,t);return K6(e,n)}function sv(e,t){return t.map(n=>Ps(e,n))}function _Ce(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(t))n[r]=Ps(e,t[r]);return n}function Ps(e,t){let n={...t};return _a(t)?Po(Ps(e,Br(t,[fo]))):og(t)?va(Ps(e,Br(t,[gc]))):br(t)?K6(e,t.properties):Ya(t)?yCe(e,t.keys):xc(t)?lg(sv(e,t.parameters),Ps(e,t.returns),n):vc(t)?yu(sv(e,t.parameters),Ps(e,t.returns),n):$m(t)?ug(Ps(e,t.items),n):Um(t)?hg(Ps(e,t.items),n):Gr(t)?Lo(sv(e,t.allOf),n):xn(t)?Ln(sv(e,t.anyOf),n):Qa(t)?Os(sv(e,t.items??[]),n):li(t)?Mn(_Ce(e,t.properties),n):yc(t)?cg(Ps(e,t.items),n):Wm(t)?QI(Ps(e,t.item),n):t}function xCe(e,t){let n={};for(let r of e)n[r]=Ps(r,t);return n}function H6(e,t,n){let r=Pr(e)?xa(e):e,i=t({[he]:"MappedKey",keys:r}),o=xCe(r,i);return Mn(o,n)}function vCe(e){return fe(Br(e,[fo]))}function bCe(e){return fe({...e,[fo]:"Optional"})}function wCe(e,t){return t===!1?vCe(e):bCe(e)}function Po(e,t){let n=t??!0;return br(e)?V6(e,n):wCe(e,n)}function TCe(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Po(e[r],t);return n}function ICe(e,t){return TCe(e.properties,t)}function V6(e,t){let n=ICe(e,t);return Sn(n)}function cv(e,t={}){let n=e.every(i=>li(i)),r=Pr(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return fe(t.unevaluatedProperties===!1||Pr(t.unevaluatedProperties)||n?{...r,[he]:"Intersect",type:"object",allOf:e}:{...r,[he]:"Intersect",allOf:e},t)}function kCe(e){return e.every(t=>_a(t))}function ECe(e){return Br(e,[fo])}function z6(e){return e.map(t=>_a(t)?ECe(t):t)}function SCe(e,t){return kCe(e)?Po(cv(z6(e),t)):cv(z6(e),t)}function XI(e,t={}){if(e.length===1)return fe(e[0],t);if(e.length===0)return rn(t);if(e.some(n=>Pn(n)))throw new Error("Cannot intersect transform types");return SCe(e,t)}function Lo(e,t){if(e.length===1)return fe(e[0],t);if(e.length===0)return rn(t);if(e.some(n=>Pn(n)))throw new Error("Cannot intersect transform types");return cv(e,t)}function xu(...e){let[t,n]=typeof e[0]=="string"?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!="string")throw new Mt("Ref: $ref must be a string");return fe({[he]:"Ref",$ref:t},n)}function ACe(e,t){return lr("Awaited",[lr(e,t)])}function RCe(e){return lr("Awaited",[xu(e)])}function CCe(e){return Lo(J6(e))}function OCe(e){return Ln(J6(e))}function PCe(e){return gg(e)}function J6(e){return e.map(t=>gg(t))}function gg(e,t){return fe(_c(e)?ACe(e.target,e.parameters):Gr(e)?CCe(e.allOf):xn(e)?OCe(e.anyOf):Wm(e)?PCe(e.item):Xr(e)?RCe(e.$ref):e,t)}function Y6(e){let t=[];for(let n of e)t.push(ba(n));return t}function LCe(e){let t=Y6(e);return P6(t)}function MCe(e){let t=Y6(e);return O6(t)}function NCe(e){return e.map((t,n)=>n.toString())}function DCe(e){return["[number]"]}function $Ce(e){return globalThis.Object.getOwnPropertyNames(e)}function FCe(e){return tM?globalThis.Object.getOwnPropertyNames(e).map(n=>n[0]==="^"&&n[n.length-1]==="$"?n.slice(1,n.length-1):n):[]}function ba(e){return Gr(e)?LCe(e.allOf):xn(e)?MCe(e.anyOf):Qa(e)?NCe(e.items??[]):yc(e)?DCe(e.items):li(e)?$Ce(e.properties):qm(e)?FCe(e.patternProperties):[]}var tM=!1;function yg(e){tM=!0;let t=ba(e);return tM=!1,`^(${t.map(r=>`(${r})`).join("|")})$`}function UCe(e,t){return lr("KeyOf",[lr(e,t)])}function WCe(e){return lr("KeyOf",[xu(e)])}function qCe(e,t){let n=ba(e),r=jCe(n),i=_u(r);return fe(i,t)}function jCe(e){return e.map(t=>t==="[number]"?Cs():yn(t))}function _g(e,t){return _c(e)?UCe(e.target,e.parameters):Xr(e)?WCe(e.$ref):br(e)?X6(e,t):qCe(e,t)}function GCe(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=_g(e[r],_r(t));return n}function BCe(e,t){return GCe(e.properties,t)}function X6(e,t){let n=BCe(e,t);return Sn(n)}function ZI(e){let t=ba(e),n=av(e,t);return t.map((r,i)=>[t[i],n[i]])}function KCe(e){let t=[];for(let n of e)t.push(...ba(n));return C6(t)}function HCe(e){return e.filter(t=>!Up(t))}function VCe(e,t){let n=[];for(let r of e)n.push(...av(r,[t]));return HCe(n)}function zCe(e,t){let n={};for(let r of t)n[r]=XI(VCe(e,r));return n}function Q6(e,t){let n=KCe(e),r=zCe(e,n);return Mn(r,t)}function ek(e){return fe({[he]:"Date",type:"Date"},e)}function tk(e){return fe({[he]:"Null",type:"null"},e)}function nk(e){return fe({[he]:"Symbol",type:"symbol"},e)}function rk(e){return fe({[he]:"Undefined",type:"undefined"},e)}function ik(e){return fe({[he]:"Uint8Array",type:"Uint8Array"},e)}function Ic(e){return fe({[he]:"Unknown"},e)}function JCe(e){return e.map(t=>nM(t,!1))}function YCe(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=va(nM(e[n],!1));return t}function ok(e,t){return t===!0?e:va(e)}function nM(e,t){return ML(e)?ok(Gp(),t):DL(e)?ok(Gp(),t):ci(e)?va(Os(JCe(e))):Tl(e)?ik():Dm(e)?ek():zn(e)?ok(Mn(YCe(e)),t):NL(e)?ok(yu([],Ic()),t):ui(e)?rk():$L(e)?tk():FL(e)?nk():Jx(e)?fg():Va(e)?yn(e):wl(e)?yn(e):or(e)?yn(e):Mn({})}function Z6(e,t){return fe(nM(e,!0),t)}function eH(e,t){return xc(e)?Os(e.parameters,t):rn(t)}function tH(e,t){if(ui(e))throw new Error("Enum undefined or empty");let n=globalThis.Object.getOwnPropertyNames(e).filter(o=>isNaN(o)).map(o=>e[o]),i=[...new Set(n)].map(o=>yn(o));return Ln(i,{...t,[Rs]:"Enum"})}var iM=class extends Mt{},ge;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(ge||(ge={}));function Ls(e){return e===ge.False?e:ge.True}function xg(e){throw new iM(e)}function vi(e){return V.IsNever(e)||V.IsIntersect(e)||V.IsUnion(e)||V.IsUnknown(e)||V.IsAny(e)}function bi(e,t){return V.IsNever(t)?cH(e,t):V.IsIntersect(t)?ak(e,t):V.IsUnion(t)?cM(e,t):V.IsUnknown(t)?dH(e,t):V.IsAny(t)?sM(e,t):xg("StructuralRight")}function sM(e,t){return ge.True}function XCe(e,t){return V.IsIntersect(t)?ak(e,t):V.IsUnion(t)&&t.anyOf.some(n=>V.IsAny(n)||V.IsUnknown(n))?ge.True:V.IsUnion(t)?ge.Union:V.IsUnknown(t)||V.IsAny(t)?ge.True:ge.Union}function QCe(e,t){return V.IsUnknown(e)?ge.False:V.IsAny(e)?ge.Union:V.IsNever(e)?ge.True:ge.False}function ZCe(e,t){return V.IsObject(t)&&sk(t)?ge.True:vi(t)?bi(e,t):V.IsArray(t)?Ls(Yn(e.items,t.items)):ge.False}function eOe(e,t){return vi(t)?bi(e,t):V.IsAsyncIterator(t)?Ls(Yn(e.items,t.items)):ge.False}function tOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsBigInt(t)?ge.True:ge.False}function aH(e,t){return V.IsLiteralBoolean(e)||V.IsBoolean(e)?ge.True:ge.False}function nOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsBoolean(t)?ge.True:ge.False}function rOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsConstructor(t)?e.parameters.length>t.parameters.length?ge.False:e.parameters.every((n,r)=>Ls(Yn(t.parameters[r],n))===ge.True)?Ls(Yn(e.returns,t.returns)):ge.False:ge.False}function iOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsDate(t)?ge.True:ge.False}function oOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsFunction(t)?e.parameters.length>t.parameters.length?ge.False:e.parameters.every((n,r)=>Ls(Yn(t.parameters[r],n))===ge.True)?Ls(Yn(e.returns,t.returns)):ge.False:ge.False}function sH(e,t){return V.IsLiteral(e)&&Oo.IsNumber(e.const)||V.IsNumber(e)||V.IsInteger(e)?ge.True:ge.False}function aOe(e,t){return V.IsInteger(t)||V.IsNumber(t)?ge.True:vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):ge.False}function ak(e,t){return t.allOf.every(n=>Yn(e,n)===ge.True)?ge.True:ge.False}function sOe(e,t){return e.allOf.some(n=>Yn(n,t)===ge.True)?ge.True:ge.False}function cOe(e,t){return vi(t)?bi(e,t):V.IsIterator(t)?Ls(Yn(e.items,t.items)):ge.False}function uOe(e,t){return V.IsLiteral(t)&&t.const===e.const?ge.True:vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsString(t)?pH(e,t):V.IsNumber(t)?uH(e,t):V.IsInteger(t)?sH(e,t):V.IsBoolean(t)?aH(e,t):ge.False}function cH(e,t){return ge.False}function lOe(e,t){return ge.True}function nH(e){let[t,n]=[e,0];for(;V.IsNot(t);)t=t.not,n+=1;return n%2===0?t:Ic()}function pOe(e,t){return V.IsNot(e)?Yn(nH(e),t):V.IsNot(t)?Yn(e,nH(t)):xg("Invalid fallthrough for Not")}function dOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsNull(t)?ge.True:ge.False}function uH(e,t){return V.IsLiteralNumber(e)||V.IsNumber(e)||V.IsInteger(e)?ge.True:ge.False}function mOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsInteger(t)||V.IsNumber(t)?ge.True:ge.False}function wa(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function rH(e){return sk(e)}function iH(e){return wa(e,0)||wa(e,1)&&"description"in e.properties&&V.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(V.IsString(e.properties.description.anyOf[0])&&V.IsUndefined(e.properties.description.anyOf[1])||V.IsString(e.properties.description.anyOf[1])&&V.IsUndefined(e.properties.description.anyOf[0]))}function rM(e){return wa(e,0)}function oH(e){return wa(e,0)}function fOe(e){return wa(e,0)}function hOe(e){return wa(e,0)}function gOe(e){return sk(e)}function yOe(e){let t=Cs();return wa(e,0)||wa(e,1)&&"length"in e.properties&&Ls(Yn(e.properties.length,t))===ge.True}function _Oe(e){return wa(e,0)}function sk(e){let t=Cs();return wa(e,0)||wa(e,1)&&"length"in e.properties&&Ls(Yn(e.properties.length,t))===ge.True}function xOe(e){let t=yu([Gp()],Gp());return wa(e,0)||wa(e,1)&&"then"in e.properties&&Ls(Yn(e.properties.then,t))===ge.True}function lH(e,t){return Yn(e,t)===ge.False||V.IsOptional(e)&&!V.IsOptional(t)?ge.False:ge.True}function Mo(e,t){return V.IsUnknown(e)?ge.False:V.IsAny(e)?ge.Union:V.IsNever(e)||V.IsLiteralString(e)&&rH(t)||V.IsLiteralNumber(e)&&rM(t)||V.IsLiteralBoolean(e)&&oH(t)||V.IsSymbol(e)&&iH(t)||V.IsBigInt(e)&&fOe(t)||V.IsString(e)&&rH(t)||V.IsSymbol(e)&&iH(t)||V.IsNumber(e)&&rM(t)||V.IsInteger(e)&&rM(t)||V.IsBoolean(e)&&oH(t)||V.IsUint8Array(e)&&gOe(t)||V.IsDate(e)&&hOe(t)||V.IsConstructor(e)&&_Oe(t)||V.IsFunction(e)&&yOe(t)?ge.True:V.IsRecord(e)&&V.IsString(oM(e))?t[Rs]==="Record"?ge.True:ge.False:V.IsRecord(e)&&V.IsNumber(oM(e))&&wa(t,0)?ge.True:ge.False}function vOe(e,t){return vi(t)?bi(e,t):V.IsRecord(t)?Ms(e,t):V.IsObject(t)?(()=>{for(let n of Object.getOwnPropertyNames(t.properties)){if(!(n in e.properties)&&!V.IsOptional(t.properties[n]))return ge.False;if(V.IsOptional(t.properties[n]))return ge.True;if(lH(e.properties[n],t.properties[n])===ge.False)return ge.False}return ge.True})():ge.False}function bOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)&&xOe(t)?ge.True:V.IsPromise(t)?Ls(Yn(e.item,t.item)):ge.False}function oM(e){return qp in e.patternProperties?Cs():jp in e.patternProperties?Qo():xg("Unknown record key pattern")}function aM(e){return qp in e.patternProperties?e.patternProperties[qp]:jp in e.patternProperties?e.patternProperties[jp]:xg("Unable to get record value schema")}function Ms(e,t){let[n,r]=[oM(t),aM(t)];return V.IsLiteralString(e)&&V.IsNumber(n)&&Ls(Yn(e,r))===ge.True?ge.True:V.IsUint8Array(e)&&V.IsNumber(n)||V.IsString(e)&&V.IsNumber(n)||V.IsArray(e)&&V.IsNumber(n)?Yn(e,r):V.IsObject(e)?(()=>{for(let i of Object.getOwnPropertyNames(e.properties))if(lH(r,e.properties[i])===ge.False)return ge.False;return ge.True})():ge.False}function wOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Yn(aM(e),aM(t)):ge.False}function TOe(e,t){let n=V.IsRegExp(e)?Qo():e,r=V.IsRegExp(t)?Qo():t;return Yn(n,r)}function pH(e,t){return V.IsLiteral(e)&&Oo.IsString(e.const)||V.IsString(e)?ge.True:ge.False}function IOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsString(t)?ge.True:ge.False}function kOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsSymbol(t)?ge.True:ge.False}function EOe(e,t){return V.IsTemplateLiteral(e)?Yn(Gm(e),t):V.IsTemplateLiteral(t)?Yn(e,Gm(t)):xg("Invalid fallthrough for TemplateLiteral")}function SOe(e,t){return V.IsArray(t)&&e.items!==void 0&&e.items.every(n=>Yn(n,t.items)===ge.True)}function AOe(e,t){return V.IsNever(e)?ge.True:V.IsUnknown(e)?ge.False:V.IsAny(e)?ge.Union:ge.False}function ROe(e,t){return vi(t)?bi(e,t):V.IsObject(t)&&sk(t)||V.IsArray(t)&&SOe(e,t)?ge.True:V.IsTuple(t)?Oo.IsUndefined(e.items)&&!Oo.IsUndefined(t.items)||!Oo.IsUndefined(e.items)&&Oo.IsUndefined(t.items)?ge.False:Oo.IsUndefined(e.items)&&!Oo.IsUndefined(t.items)||e.items.every((n,r)=>Yn(n,t.items[r])===ge.True)?ge.True:ge.False:ge.False}function COe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsUint8Array(t)?ge.True:ge.False}function OOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsVoid(t)?MOe(e,t):V.IsUndefined(t)?ge.True:ge.False}function cM(e,t){return t.anyOf.some(n=>Yn(e,n)===ge.True)?ge.True:ge.False}function POe(e,t){return e.anyOf.every(n=>Yn(n,t)===ge.True)?ge.True:ge.False}function dH(e,t){return ge.True}function LOe(e,t){return V.IsNever(t)?cH(e,t):V.IsIntersect(t)?ak(e,t):V.IsUnion(t)?cM(e,t):V.IsAny(t)?sM(e,t):V.IsString(t)?pH(e,t):V.IsNumber(t)?uH(e,t):V.IsInteger(t)?sH(e,t):V.IsBoolean(t)?aH(e,t):V.IsArray(t)?QCe(e,t):V.IsTuple(t)?AOe(e,t):V.IsObject(t)?Mo(e,t):V.IsUnknown(t)?ge.True:ge.False}function MOe(e,t){return V.IsUndefined(e)||V.IsUndefined(e)?ge.True:ge.False}function NOe(e,t){return V.IsIntersect(t)?ak(e,t):V.IsUnion(t)?cM(e,t):V.IsUnknown(t)?dH(e,t):V.IsAny(t)?sM(e,t):V.IsObject(t)?Mo(e,t):V.IsVoid(t)?ge.True:ge.False}function Yn(e,t){return V.IsTemplateLiteral(e)||V.IsTemplateLiteral(t)?EOe(e,t):V.IsRegExp(e)||V.IsRegExp(t)?TOe(e,t):V.IsNot(e)||V.IsNot(t)?pOe(e,t):V.IsAny(e)?XCe(e,t):V.IsArray(e)?ZCe(e,t):V.IsBigInt(e)?tOe(e,t):V.IsBoolean(e)?nOe(e,t):V.IsAsyncIterator(e)?eOe(e,t):V.IsConstructor(e)?rOe(e,t):V.IsDate(e)?iOe(e,t):V.IsFunction(e)?oOe(e,t):V.IsInteger(e)?aOe(e,t):V.IsIntersect(e)?sOe(e,t):V.IsIterator(e)?cOe(e,t):V.IsLiteral(e)?uOe(e,t):V.IsNever(e)?lOe(e,t):V.IsNull(e)?dOe(e,t):V.IsNumber(e)?mOe(e,t):V.IsObject(e)?vOe(e,t):V.IsRecord(e)?wOe(e,t):V.IsString(e)?IOe(e,t):V.IsSymbol(e)?kOe(e,t):V.IsTuple(e)?ROe(e,t):V.IsPromise(e)?bOe(e,t):V.IsUint8Array(e)?COe(e,t):V.IsUndefined(e)?OOe(e,t):V.IsUnion(e)?POe(e,t):V.IsUnknown(e)?LOe(e,t):V.IsVoid(e)?NOe(e,t):xg(`Unknown left type operand '${e[he]}'`)}function Kp(e,t){return Yn(e,t)}function DOe(e,t,n,r,i){let o={};for(let a of globalThis.Object.getOwnPropertyNames(e))o[a]=vg(e[a],t,n,r,_r(i));return o}function $Oe(e,t,n,r,i){return DOe(e.properties,t,n,r,i)}function mH(e,t,n,r,i){let o=$Oe(e,t,n,r,i);return Sn(o)}function FOe(e,t,n,r){let i=Kp(e,t);return i===ge.Union?Ln([n,r]):i===ge.True?n:r}function vg(e,t,n,r,i){return br(e)?mH(e,t,n,r,i):Ya(e)?fe(fH(e,t,n,r,i)):fe(FOe(e,t,n,r),i)}function UOe(e,t,n,r,i){return{[e]:vg(yn(e),t,n,r,_r(i))}}function WOe(e,t,n,r,i){return e.reduce((o,a)=>({...o,...UOe(a,t,n,r,i)}),{})}function qOe(e,t,n,r,i){return WOe(e.keys,t,n,r,i)}function fH(e,t,n,r,i){let o=qOe(e,t,n,r,i);return Sn(o)}function jOe(e){return e.allOf.every(t=>Bm(t))}function GOe(e){return e.anyOf.some(t=>Bm(t))}function BOe(e){return!Bm(e.not)}function Bm(e){return e[he]==="Intersect"?jOe(e):e[he]==="Union"?GOe(e):e[he]==="Not"?BOe(e):e[he]==="Undefined"}function hH(e,t){return bg(Gm(e),t)}function KOe(e,t){let n=e.filter(r=>Kp(r,t)===ge.False);return n.length===1?n[0]:Ln(n)}function bg(e,t,n={}){return Xa(e)?fe(hH(e,t),n):br(e)?fe(gH(e,t),n):fe(xn(e)?KOe(e.anyOf,t):Kp(e,t)!==ge.False?rn():e,n)}function HOe(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=bg(e[r],t);return n}function VOe(e,t){return HOe(e.properties,t)}function gH(e,t){let n=VOe(e,t);return Sn(n)}function yH(e,t){return wg(Gm(e),t)}function zOe(e,t){let n=e.filter(r=>Kp(r,t)!==ge.False);return n.length===1?n[0]:Ln(n)}function wg(e,t,n){return Xa(e)?fe(yH(e,t),n):br(e)?fe(_H(e,t),n):fe(xn(e)?zOe(e.anyOf,t):Kp(e,t)!==ge.False?e:rn(),n)}function JOe(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=wg(e[r],t);return n}function YOe(e,t){return JOe(e.properties,t)}function _H(e,t){let n=YOe(e,t);return Sn(n)}function xH(e,t){return xc(e)?fe(e.returns,t):rn(t)}function ck(e){return va(Po(e))}function Km(e,t,n){return fe({[he]:"Record",type:"object",patternProperties:{[e]:t}},n)}function uM(e,t,n){let r={};for(let i of e)r[i]=t;return Mn(r,{...n,[Rs]:"Record"})}function XOe(e,t,n){return zI(e)?uM(xa(e),t,n):Km(e.pattern,t,n)}function QOe(e,t,n){return uM(xa(Ln(e)),t,n)}function ZOe(e,t,n){return uM([e.toString()],t,n)}function ePe(e,t,n){return Km(e.source,t,n)}function tPe(e,t,n){let r=ui(e.pattern)?jp:e.pattern;return Km(r,t,n)}function nPe(e,t,n){return Km(jp,t,n)}function rPe(e,t,n){return Km(A6,t,n)}function iPe(e,t,n){return Mn({true:t,false:t},n)}function oPe(e,t,n){return Km(qp,t,n)}function aPe(e,t,n){return Km(qp,t,n)}function uk(e,t,n={}){return xn(e)?QOe(e.anyOf,t,n):Xa(e)?XOe(e,t,n):Ja(e)?ZOe(e.const,t,n):El(e)?iPe(e,t,n):bc(e)?oPe(e,t,n):wc(e)?aPe(e,t,n):jL(e)?ePe(e,t,n):Sl(e)?tPe(e,t,n):WL(e)?nPe(e,t,n):Up(e)?rPe(e,t,n):rn(n)}function lk(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function vH(e){let t=lk(e);return t===jp?Qo():t===qp?Cs():Qo({pattern:t})}function pk(e){return e.patternProperties[lk(e)]}function sPe(e,t){return t.parameters=uv(e,t.parameters),t.returns=kc(e,t.returns),t}function cPe(e,t){return t.parameters=uv(e,t.parameters),t.returns=kc(e,t.returns),t}function uPe(e,t){return t.allOf=uv(e,t.allOf),t}function lPe(e,t){return t.anyOf=uv(e,t.anyOf),t}function pPe(e,t){return ui(t.items)||(t.items=uv(e,t.items)),t}function dPe(e,t){return t.items=kc(e,t.items),t}function mPe(e,t){return t.items=kc(e,t.items),t}function fPe(e,t){return t.items=kc(e,t.items),t}function hPe(e,t){return t.item=kc(e,t.item),t}function gPe(e,t){let n=vPe(e,t.properties);return{...t,...Mn(n)}}function yPe(e,t){let n=kc(e,vH(t)),r=kc(e,pk(t)),i=uk(n,r);return{...t,...i}}function _Pe(e,t){return t.index in e?e[t.index]:Ic()}function xPe(e,t){let n=og(t),r=_a(t),i=kc(e,t);return n&&r?ck(i):n&&!r?va(i):!n&&r?Po(i):i}function vPe(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:xPe(e,t[r])}),{})}function uv(e,t){return t.map(n=>kc(e,n))}function kc(e,t){return xc(t)?sPe(e,t):vc(t)?cPe(e,t):Gr(t)?uPe(e,t):xn(t)?lPe(e,t):Qa(t)?pPe(e,t):yc(t)?dPe(e,t):$m(t)?mPe(e,t):Um(t)?fPe(e,t):Wm(t)?hPe(e,t):li(t)?gPe(e,t):qm(t)?yPe(e,t):qL(t)?_Pe(e,t):t}function bH(e,t){return kc(t,rg(e))}function wH(e){return fe({[he]:"Integer",type:"integer"},e)}function bPe(e,t,n){return{[e]:Ec(yn(e),t,_r(n))}}function wPe(e,t,n){return e.reduce((i,o)=>({...i,...bPe(o,t,n)}),{})}function TPe(e,t,n){return wPe(e.keys,t,n)}function TH(e,t,n){let r=TPe(e,t,n);return Sn(r)}function IPe(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),n].join("")}function kPe(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),n].join("")}function EPe(e){return e.toUpperCase()}function SPe(e){return e.toLowerCase()}function APe(e,t,n){let r=dg(e.pattern);if(!jm(r))return{...e,pattern:IH(e.pattern,t)};let a=[...ov(r)].map(l=>yn(l)),c=kH(a,t),u=Ln(c);return YI([u],n)}function IH(e,t){return typeof e=="string"?t==="Uncapitalize"?IPe(e):t==="Capitalize"?kPe(e):t==="Uppercase"?EPe(e):t==="Lowercase"?SPe(e):e:e.toString()}function kH(e,t){return e.map(n=>Ec(n,t))}function Ec(e,t,n={}){return Ya(e)?TH(e,t,n):Xa(e)?APe(e,t,n):xn(e)?Ln(kH(e.anyOf,t),n):Ja(e)?yn(IH(e.const,t),n):fe(e,n)}function EH(e,t={}){return Ec(e,"Capitalize",t)}function SH(e,t={}){return Ec(e,"Lowercase",t)}function AH(e,t={}){return Ec(e,"Uncapitalize",t)}function RH(e,t={}){return Ec(e,"Uppercase",t)}function RPe(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=Hp(e[i],t,_r(n));return r}function CPe(e,t,n){return RPe(e.properties,t,n)}function CH(e,t,n){let r=CPe(e,t,n);return Sn(r)}function OPe(e,t){return e.map(n=>lM(n,t))}function PPe(e,t){return e.map(n=>lM(n,t))}function LPe(e,t){let{[t]:n,...r}=e;return r}function MPe(e,t){return t.reduce((n,r)=>LPe(n,r),e)}function NPe(e,t,n){let r=Br(e,[Or,"$id","required","properties"]),i=MPe(n,t);return Mn(i,r)}function DPe(e){let t=e.reduce((n,r)=>KI(r)?[...n,yn(r)]:n,[]);return Ln(t)}function lM(e,t){return Gr(e)?Lo(OPe(e.allOf,t)):xn(e)?Ln(PPe(e.anyOf,t)):li(e)?NPe(e,t,e.properties):Mn({})}function Hp(e,t,n){let r=ci(t)?DPe(t):t,i=Pr(t)?xa(t):t,o=Xr(e),a=Xr(t);return br(e)?CH(e,i,n):Ya(t)?OH(e,t,n):o&&a?lr("Omit",[e,r],n):!o&&a?lr("Omit",[e,r],n):o&&!a?lr("Omit",[e,r],n):fe({...lM(e,i),...n})}function $Pe(e,t,n){return{[t]:Hp(e,[t],_r(n))}}function FPe(e,t,n){return t.reduce((r,i)=>({...r,...$Pe(e,i,n)}),{})}function UPe(e,t,n){return FPe(e,t.keys,n)}function OH(e,t,n){let r=UPe(e,t,n);return Sn(r)}function WPe(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=Vp(e[i],t,_r(n));return r}function qPe(e,t,n){return WPe(e.properties,t,n)}function PH(e,t,n){let r=qPe(e,t,n);return Sn(r)}function jPe(e,t){return e.map(n=>pM(n,t))}function GPe(e,t){return e.map(n=>pM(n,t))}function BPe(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function KPe(e,t,n){let r=Br(e,[Or,"$id","required","properties"]),i=BPe(n,t);return Mn(i,r)}function HPe(e){let t=e.reduce((n,r)=>KI(r)?[...n,yn(r)]:n,[]);return Ln(t)}function pM(e,t){return Gr(e)?Lo(jPe(e.allOf,t)):xn(e)?Ln(GPe(e.anyOf,t)):li(e)?KPe(e,t,e.properties):Mn({})}function Vp(e,t,n){let r=ci(t)?HPe(t):t,i=Pr(t)?xa(t):t,o=Xr(e),a=Xr(t);return br(e)?PH(e,i,n):Ya(t)?LH(e,t,n):o&&a?lr("Pick",[e,r],n):!o&&a?lr("Pick",[e,r],n):o&&!a?lr("Pick",[e,r],n):fe({...pM(e,i),...n})}function VPe(e,t,n){return{[t]:Vp(e,[t],_r(n))}}function zPe(e,t,n){return t.reduce((r,i)=>({...r,...VPe(e,i,n)}),{})}function JPe(e,t,n){return zPe(e,t.keys,n)}function LH(e,t,n){let r=JPe(e,t,n);return Sn(r)}function YPe(e,t){return lr("Partial",[lr(e,t)])}function XPe(e){return lr("Partial",[xu(e)])}function QPe(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=Po(e[n]);return t}function ZPe(e,t){let n=Br(e,[Or,"$id","required","properties"]),r=QPe(t);return Mn(r,n)}function MH(e){return e.map(t=>NH(t))}function NH(e){return _c(e)?YPe(e.target,e.parameters):Xr(e)?XPe(e.$ref):Gr(e)?Lo(MH(e.allOf)):xn(e)?Ln(MH(e.anyOf)):li(e)?ZPe(e,e.properties):Fm(e)||El(e)||bc(e)||Ja(e)||Qx(e)||wc(e)||Sl(e)||Zx(e)||Al(e)?e:Mn({})}function Tg(e,t){return br(e)?DH(e,t):fe({...NH(e),...t})}function e1e(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Tg(e[r],_r(t));return n}function t1e(e,t){return e1e(e.properties,t)}function DH(e,t){let n=t1e(e,t);return Sn(n)}function n1e(e,t){return lr("Required",[lr(e,t)])}function r1e(e){return lr("Required",[xu(e)])}function i1e(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=Br(e[n],[fo]);return t}function o1e(e,t){let n=Br(e,[Or,"$id","required","properties"]),r=i1e(t);return Mn(r,n)}function $H(e){return e.map(t=>FH(t))}function FH(e){return _c(e)?n1e(e.target,e.parameters):Xr(e)?r1e(e.$ref):Gr(e)?Lo($H(e.allOf)):xn(e)?Ln($H(e.anyOf)):li(e)?o1e(e,e.properties):Fm(e)||El(e)||bc(e)||Ja(e)||Qx(e)||wc(e)||Sl(e)||Zx(e)||Al(e)?e:Mn({})}function Ig(e,t){return br(e)?UH(e,t):fe({...FH(e),...t})}function a1e(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Ig(e[r],t);return n}function s1e(e,t){return a1e(e.properties,t)}function UH(e,t){let n=s1e(e,t);return Sn(n)}function c1e(e,t){return t.map(n=>Xr(n)?dM(e,n.$ref):Za(e,n))}function dM(e,t){return t in e?Xr(e[t])?dM(e,e[t].$ref):Za(e,e[t]):rn()}function u1e(e){return gg(e[0])}function l1e(e){return Bp(e[0],e[1])}function p1e(e){return _g(e[0])}function d1e(e){return Tg(e[0])}function m1e(e){return Hp(e[0],e[1])}function f1e(e){return Vp(e[0],e[1])}function h1e(e){return Ig(e[0])}function g1e(e,t,n){let r=c1e(e,n);return t==="Awaited"?u1e(r):t==="Index"?l1e(r):t==="KeyOf"?p1e(r):t==="Partial"?d1e(r):t==="Omit"?m1e(r):t==="Pick"?f1e(r):t==="Required"?h1e(r):rn()}function y1e(e,t){return cg(Za(e,t))}function _1e(e,t){return ug(Za(e,t))}function x1e(e,t,n){return lg(lv(e,t),Za(e,n))}function v1e(e,t,n){return yu(lv(e,t),Za(e,n))}function b1e(e,t){return Lo(lv(e,t))}function w1e(e,t){return hg(Za(e,t))}function T1e(e,t){return Mn(globalThis.Object.keys(t).reduce((n,r)=>({...n,[r]:Za(e,t[r])}),{}))}function I1e(e,t){let[n,r]=[Za(e,pk(t)),lk(t)],i=rg(t);return i.patternProperties[r]=n,i}function k1e(e,t){return Xr(t)?{...dM(e,t.$ref),[Or]:t[Or]}:t}function E1e(e,t){return Os(lv(e,t))}function S1e(e,t){return Ln(lv(e,t))}function lv(e,t){return t.map(n=>Za(e,n))}function Za(e,t){return _a(t)?fe(Za(e,Br(t,[fo])),t):og(t)?fe(Za(e,Br(t,[gc])),t):Pn(t)?fe(k1e(e,t),t):yc(t)?fe(y1e(e,t.items),t):$m(t)?fe(_1e(e,t.items),t):_c(t)?fe(g1e(e,t.target,t.parameters)):xc(t)?fe(x1e(e,t.parameters,t.returns),t):vc(t)?fe(v1e(e,t.parameters,t.returns),t):Gr(t)?fe(b1e(e,t.allOf),t):Um(t)?fe(w1e(e,t.items),t):li(t)?fe(T1e(e,t.properties),t):qm(t)?fe(I1e(e,t)):Qa(t)?fe(E1e(e,t.items||[]),t):xn(t)?fe(S1e(e,t.anyOf),t):t}function A1e(e,t){return t in e?Za(e,e[t]):rn()}function WH(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:A1e(e,n)}),{})}var mM=class{constructor(t){let n=WH(t),r=this.WithIdentifiers(n);this.$defs=r}Import(t,n){let r={...this.$defs,[t]:fe(this.$defs[t],n)};return fe({[he]:"Import",$defs:r,$ref:t})}WithIdentifiers(t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:{...t[r],$id:r}}),{})}};function qH(e){return new mM(e)}function jH(e,t){return fe({[he]:"Not",not:e},t)}function GH(e,t){return vc(e)?Os(e.parameters,t):rn()}var R1e=0;function BH(e,t={}){ui(t.$id)&&(t.$id=`T${R1e++}`);let n=rg(e({[he]:"This",$ref:`${t.$id}`}));return n.$id=t.$id,fe({[Rs]:"Recursive",...n},t)}function KH(e,t){let n=or(e)?new globalThis.RegExp(e):e;return fe({[he]:"RegExp",type:"RegExp",source:n.source,flags:n.flags},t)}function C1e(e){return Gr(e)?e.allOf:xn(e)?e.anyOf:Qa(e)?e.items??[]:[]}function HH(e){return C1e(e)}function VH(e,t){return vc(e)?fe(e.returns,t):rn(t)}var fM=class{constructor(t){this.schema=t}Decode(t){return new hM(this.schema,t)}},hM=class{constructor(t,n){this.schema=t,this.decode=n}EncodeTransform(t,n){let o={Encode:a=>n[Or].Encode(t(a)),Decode:a=>this.decode(n[Or].Decode(a))};return{...n,[Or]:o}}EncodeSchema(t,n){let r={Decode:this.decode,Encode:t};return{...n,[Or]:r}}Encode(t){return Pn(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function zH(e){return new fM(e)}function JH(e={}){return fe({[he]:e[he]??"Unsafe"},e)}function YH(e){return fe({[he]:"Void",type:"void"},e)}var gM={};On(gM,{Any:()=>Gp,Argument:()=>L6,Array:()=>cg,AsyncIterator:()=>ug,Awaited:()=>gg,BigInt:()=>fg,Boolean:()=>JI,Capitalize:()=>EH,Composite:()=>Q6,Const:()=>Z6,Constructor:()=>lg,ConstructorParameters:()=>eH,Date:()=>ek,Enum:()=>tH,Exclude:()=>bg,Extends:()=>vg,Extract:()=>wg,Function:()=>yu,Index:()=>Bp,InstanceType:()=>xH,Instantiate:()=>bH,Integer:()=>wH,Intersect:()=>Lo,Iterator:()=>hg,KeyOf:()=>_g,Literal:()=>yn,Lowercase:()=>SH,Mapped:()=>H6,Module:()=>qH,Never:()=>rn,Not:()=>jH,Null:()=>tk,Number:()=>Cs,Object:()=>Mn,Omit:()=>Hp,Optional:()=>Po,Parameters:()=>GH,Partial:()=>Tg,Pick:()=>Vp,Promise:()=>QI,Readonly:()=>va,ReadonlyOptional:()=>ck,Record:()=>uk,Recursive:()=>BH,Ref:()=>xu,RegExp:()=>KH,Required:()=>Ig,Rest:()=>HH,ReturnType:()=>VH,String:()=>Qo,Symbol:()=>nk,TemplateLiteral:()=>YI,Transform:()=>zH,Tuple:()=>Os,Uint8Array:()=>ik,Uncapitalize:()=>AH,Undefined:()=>rk,Union:()=>Ln,Unknown:()=>Ic,Unsafe:()=>JH,Uppercase:()=>RH,Void:()=>YH});var s=gM;var O1e=s.String(),P1e=s.Literal("1.0.0");function L1e(e){switch(e.errorType){case de.ArrayContains:return"Expected array to contain at least one matching value";case de.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case de.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case de.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case de.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case de.ArrayUniqueItems:return"Expected array elements to be unique";case de.Array:return"Expected array";case de.AsyncIterator:return"Expected AsyncIterator";case de.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case de.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case de.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case de.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case de.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case de.BigInt:return"Expected bigint";case de.Boolean:return"Expected boolean";case de.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case de.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case de.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case de.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case de.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case de.Date:return"Expected Date";case de.Function:return"Expected function";case de.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case de.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case de.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case de.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case de.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case de.Integer:return"Expected integer";case de.IntersectUnevaluatedProperties:return"Unexpected property";case de.Intersect:return"Expected all values to match";case de.Iterator:return"Expected Iterator";case de.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case de.Never:return"Never";case de.Not:return"Value should not match";case de.Null:return"Expected null";case de.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case de.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case de.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case de.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case de.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case de.Number:return"Expected number";case de.Object:return"Expected object";case de.ObjectAdditionalProperties:return"Unexpected property";case de.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case de.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case de.ObjectRequiredProperty:return"Expected required property";case de.Promise:return"Expected Promise";case de.RegExp:return"Expected string to match regular expression";case de.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case de.StringFormat:return`Expected string to match '${e.schema.format}' format`;case de.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case de.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case de.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case de.String:return"Expected string";case de.Symbol:return"Expected symbol";case de.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case de.Tuple:return"Expected tuple";case de.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case de.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case de.Uint8Array:return"Expected Uint8Array";case de.Undefined:return"Expected undefined";case de.Union:return"Expected union value";case de.Void:return"Expected void";case de.Kind:return`Expected kind '${e.schema[he]}'`;default:return"Unknown error type"}}var M1e=L1e;function XH(){return M1e}var yM=class extends Mt{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}};function N1e(e,t){let n=t.find(r=>r.$id===e.$ref);if(n===void 0)throw new yM(e);return Nn(n,t)}function zi(e,t){return!qn(e.$id)||t.some(n=>n.$id===e.$id)||t.push(e),t}function Nn(e,t){return e[he]==="This"||e[he]==="Ref"?N1e(e,t):e}var _M=class extends Mt{constructor(t){super("Unable to hash value"),this.value=t}},es;(function(e){e[e.Undefined=0]="Undefined",e[e.Null=1]="Null",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.Object=5]="Object",e[e.Array=6]="Array",e[e.Date=7]="Date",e[e.Uint8Array=8]="Uint8Array",e[e.Symbol=9]="Symbol",e[e.BigInt=10]="BigInt"})(es||(es={}));var kg=BigInt("14695981039346656037"),[D1e,$1e]=[BigInt("1099511628211"),BigInt("18446744073709551616")],F1e=Array.from({length:256}).map((e,t)=>BigInt(t)),QH=new Float64Array(1),ZH=new DataView(QH.buffer),eV=new Uint8Array(QH.buffer);function*U1e(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let n=0;n<t;n++)yield e>>8*(t-1-n)&255}function W1e(e){No(es.Array);for(let t of e)Eg(t)}function q1e(e){No(es.Boolean),No(e?1:0)}function j1e(e){No(es.BigInt),ZH.setBigInt64(0,e);for(let t of eV)No(t)}function G1e(e){No(es.Date),Eg(e.getTime())}function B1e(e){No(es.Null)}function K1e(e){No(es.Number),ZH.setFloat64(0,e);for(let t of eV)No(t)}function H1e(e){No(es.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())Eg(t),Eg(e[t])}function V1e(e){No(es.String);for(let t=0;t<e.length;t++)for(let n of U1e(e.charCodeAt(t)))No(n)}function z1e(e){No(es.Symbol),Eg(e.description)}function J1e(e){No(es.Uint8Array);for(let t=0;t<e.length;t++)No(e[t])}function Y1e(e){return No(es.Undefined)}function Eg(e){if(Rt(e))return W1e(e);if(hu(e))return q1e(e);if(hc(e))return j1e(e);if(Xo(e))return G1e(e);if(Il(e))return B1e(e);if(vr(e))return K1e(e);if(Ut(e))return H1e(e);if(qn(e))return V1e(e);if(kl(e))return z1e(e);if(ig(e))return J1e(e);if(xr(e))return Y1e(e);throw new _M(e)}function No(e){kg=kg^F1e[e],kg=kg*D1e%$1e}function Sg(e){return kg=BigInt("14695981039346656037"),Eg(e),kg}var xM=class extends Mt{constructor(t){super("Unknown type"),this.schema=t}};function X1e(e){return e[he]==="Any"||e[he]==="Unknown"}function dn(e){return e!==void 0}function Q1e(e,t,n){return!0}function Z1e(e,t,n){return!0}function eLe(e,t,n){if(!Rt(n)||dn(e.minItems)&&!(n.length>=e.minItems)||dn(e.maxItems)&&!(n.length<=e.maxItems))return!1;for(let o of n)if(!Ji(e.items,t,o))return!1;if(e.uniqueItems===!0&&!(function(){let o=new Set;for(let a of n){let c=Sg(a);if(o.has(c))return!1;o.add(c)}return!0})())return!1;if(!(dn(e.contains)||vr(e.minContains)||vr(e.maxContains)))return!0;let r=dn(e.contains)?e.contains:rn(),i=n.reduce((o,a)=>Ji(r,t,a)?o+1:o,0);return!(i===0||vr(e.minContains)&&i<e.minContains||vr(e.maxContains)&&i>e.maxContains)}function tLe(e,t,n){return qI(n)}function nLe(e,t,n){return!(!hc(n)||dn(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||dn(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||dn(e.maximum)&&!(n<=e.maximum)||dn(e.minimum)&&!(n>=e.minimum)||dn(e.multipleOf)&&n%e.multipleOf!==BigInt(0))}function rLe(e,t,n){return hu(n)}function iLe(e,t,n){return Ji(e.returns,t,n.prototype)}function oLe(e,t,n){return!(!Xo(n)||dn(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)||dn(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)||dn(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)||dn(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)||dn(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0)}function aLe(e,t,n){return Fp(n)}function sLe(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Ji(i,[...t,...r],n)}function cLe(e,t,n){return!(!BI(n)||dn(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||dn(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||dn(e.maximum)&&!(n<=e.maximum)||dn(e.minimum)&&!(n>=e.minimum)||dn(e.multipleOf)&&n%e.multipleOf!==0)}function uLe(e,t,n){let r=e.allOf.every(i=>Ji(i,t,n));if(e.unevaluatedProperties===!1){let i=new RegExp(yg(e)),o=Object.getOwnPropertyNames(n).every(a=>i.test(a));return r&&o}else if(Pr(e.unevaluatedProperties)){let i=new RegExp(yg(e)),o=Object.getOwnPropertyNames(n).every(a=>i.test(a)||Ji(e.unevaluatedProperties,t,n[a]));return r&&o}else return r}function lLe(e,t,n){return jI(n)}function pLe(e,t,n){return n===e.const}function dLe(e,t,n){return!1}function mLe(e,t,n){return!Ji(e.not,t,n)}function fLe(e,t,n){return Il(n)}function hLe(e,t,n){return!(!xi.IsNumberLike(n)||dn(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||dn(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||dn(e.minimum)&&!(n>=e.minimum)||dn(e.maximum)&&!(n<=e.maximum)||dn(e.multipleOf)&&n%e.multipleOf!==0)}function gLe(e,t,n){if(!xi.IsObjectLike(n)||dn(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||dn(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let r=Object.getOwnPropertyNames(e.properties);for(let i of r){let o=e.properties[i];if(e.required&&e.required.includes(i)){if(!Ji(o,t,n[i])||(Bm(o)||X1e(o))&&!(i in n))return!1}else if(xi.IsExactOptionalProperty(n,i)&&!Ji(o,t,n[i]))return!1}if(e.additionalProperties===!1){let i=Object.getOwnPropertyNames(n);return e.required&&e.required.length===r.length&&i.length===r.length?!0:i.every(o=>r.includes(o))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(n).every(o=>r.includes(o)||Ji(e.additionalProperties,t,n[o])):!0}function yLe(e,t,n){return GI(n)}function _Le(e,t,n){if(!xi.IsRecordLike(n)||dn(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||dn(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let[r,i]=Object.entries(e.patternProperties)[0],o=new RegExp(r),a=Object.entries(n).every(([l,d])=>o.test(l)?Ji(i,t,d):!0),c=typeof e.additionalProperties=="object"?Object.entries(n).every(([l,d])=>o.test(l)?!0:Ji(e.additionalProperties,t,d)):!0,u=e.additionalProperties===!1?Object.getOwnPropertyNames(n).every(l=>o.test(l)):!0;return a&&c&&u}function xLe(e,t,n){return Ji(Nn(e,t),t,n)}function vLe(e,t,n){let r=new RegExp(e.source,e.flags);return dn(e.minLength)&&!(n.length>=e.minLength)||dn(e.maxLength)&&!(n.length<=e.maxLength)?!1:r.test(n)}function bLe(e,t,n){return!qn(n)||dn(e.minLength)&&!(n.length>=e.minLength)||dn(e.maxLength)&&!(n.length<=e.maxLength)||dn(e.pattern)&&!new RegExp(e.pattern).test(n)?!1:dn(e.format)?gu.Has(e.format)?gu.Get(e.format)(n):!1:!0}function wLe(e,t,n){return kl(n)}function TLe(e,t,n){return qn(n)&&new RegExp(e.pattern).test(n)}function ILe(e,t,n){return Ji(Nn(e,t),t,n)}function kLe(e,t,n){if(!Rt(n)||e.items===void 0&&n.length!==0||n.length!==e.maxItems)return!1;if(!e.items)return!0;for(let r=0;r<e.items.length;r++)if(!Ji(e.items[r],t,n[r]))return!1;return!0}function ELe(e,t,n){return xr(n)}function SLe(e,t,n){return e.anyOf.some(r=>Ji(r,t,n))}function ALe(e,t,n){return!(!ig(n)||dn(e.maxByteLength)&&!(n.length<=e.maxByteLength)||dn(e.minByteLength)&&!(n.length>=e.minByteLength))}function RLe(e,t,n){return!0}function CLe(e,t,n){return xi.IsVoidLike(n)}function OLe(e,t,n){return Tc.Has(e[he])?Tc.Get(e[he])(e,n):!1}function Ji(e,t,n){let r=dn(e.$id)?zi(e,t):t,i=e;switch(i[he]){case"Any":return Q1e(i,r,n);case"Argument":return Z1e(i,r,n);case"Array":return eLe(i,r,n);case"AsyncIterator":return tLe(i,r,n);case"BigInt":return nLe(i,r,n);case"Boolean":return rLe(i,r,n);case"Constructor":return iLe(i,r,n);case"Date":return oLe(i,r,n);case"Function":return aLe(i,r,n);case"Import":return sLe(i,r,n);case"Integer":return cLe(i,r,n);case"Intersect":return uLe(i,r,n);case"Iterator":return lLe(i,r,n);case"Literal":return pLe(i,r,n);case"Never":return dLe(i,r,n);case"Not":return mLe(i,r,n);case"Null":return fLe(i,r,n);case"Number":return hLe(i,r,n);case"Object":return gLe(i,r,n);case"Promise":return yLe(i,r,n);case"Record":return _Le(i,r,n);case"Ref":return xLe(i,r,n);case"RegExp":return vLe(i,r,n);case"String":return bLe(i,r,n);case"Symbol":return wLe(i,r,n);case"TemplateLiteral":return TLe(i,r,n);case"This":return ILe(i,r,n);case"Tuple":return kLe(i,r,n);case"Undefined":return ELe(i,r,n);case"Union":return SLe(i,r,n);case"Uint8Array":return ALe(i,r,n);case"Unknown":return RLe(i,r,n);case"Void":return CLe(i,r,n);default:if(!Tc.Has(i[he]))throw new xM(i);return OLe(i,r,n)}}function Kt(...e){return e.length===3?Ji(e[0],e[1],e[2]):Ji(e[0],[],e[1])}var de;(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(de||(de={}));var vM=class extends Mt{constructor(t){super("Unknown type"),this.schema=t}};function Ol(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function mn(e){return e!==void 0}var zp=class{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator}First(){let t=this.iterator.next();return t.done?void 0:t.value}};function Ke(e,t,n,r,i=[]){return{type:e,schema:t,path:n,value:r,message:XH()({errorType:e,path:n,schema:t,value:r,errors:i}),errors:i}}function*PLe(e,t,n,r){}function*LLe(e,t,n,r){}function*MLe(e,t,n,r){if(!Rt(r))return yield Ke(de.Array,e,n,r);mn(e.minItems)&&!(r.length>=e.minItems)&&(yield Ke(de.ArrayMinItems,e,n,r)),mn(e.maxItems)&&!(r.length<=e.maxItems)&&(yield Ke(de.ArrayMaxItems,e,n,r));for(let a=0;a<r.length;a++)yield*Yi(e.items,t,`${n}/${a}`,r[a]);if(e.uniqueItems===!0&&!(function(){let a=new Set;for(let c of r){let u=Sg(c);if(a.has(u))return!1;a.add(u)}return!0})()&&(yield Ke(de.ArrayUniqueItems,e,n,r)),!(mn(e.contains)||mn(e.minContains)||mn(e.maxContains)))return;let i=mn(e.contains)?e.contains:rn(),o=r.reduce((a,c,u)=>Yi(i,t,`${n}${u}`,c).next().done===!0?a+1:a,0);o===0&&(yield Ke(de.ArrayContains,e,n,r)),vr(e.minContains)&&o<e.minContains&&(yield Ke(de.ArrayMinContains,e,n,r)),vr(e.maxContains)&&o>e.maxContains&&(yield Ke(de.ArrayMaxContains,e,n,r))}function*NLe(e,t,n,r){qI(r)||(yield Ke(de.AsyncIterator,e,n,r))}function*DLe(e,t,n,r){if(!hc(r))return yield Ke(de.BigInt,e,n,r);mn(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield Ke(de.BigIntExclusiveMaximum,e,n,r)),mn(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield Ke(de.BigIntExclusiveMinimum,e,n,r)),mn(e.maximum)&&!(r<=e.maximum)&&(yield Ke(de.BigIntMaximum,e,n,r)),mn(e.minimum)&&!(r>=e.minimum)&&(yield Ke(de.BigIntMinimum,e,n,r)),mn(e.multipleOf)&&r%e.multipleOf!==BigInt(0)&&(yield Ke(de.BigIntMultipleOf,e,n,r))}function*$Le(e,t,n,r){hu(r)||(yield Ke(de.Boolean,e,n,r))}function*FLe(e,t,n,r){yield*Yi(e.returns,t,n,r.prototype)}function*ULe(e,t,n,r){if(!Xo(r))return yield Ke(de.Date,e,n,r);mn(e.exclusiveMaximumTimestamp)&&!(r.getTime()<e.exclusiveMaximumTimestamp)&&(yield Ke(de.DateExclusiveMaximumTimestamp,e,n,r)),mn(e.exclusiveMinimumTimestamp)&&!(r.getTime()>e.exclusiveMinimumTimestamp)&&(yield Ke(de.DateExclusiveMinimumTimestamp,e,n,r)),mn(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)&&(yield Ke(de.DateMaximumTimestamp,e,n,r)),mn(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)&&(yield Ke(de.DateMinimumTimestamp,e,n,r)),mn(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0&&(yield Ke(de.DateMultipleOfTimestamp,e,n,r))}function*WLe(e,t,n,r){Fp(r)||(yield Ke(de.Function,e,n,r))}function*qLe(e,t,n,r){let i=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];yield*Yi(o,[...t,...i],n,r)}function*jLe(e,t,n,r){if(!BI(r))return yield Ke(de.Integer,e,n,r);mn(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield Ke(de.IntegerExclusiveMaximum,e,n,r)),mn(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield Ke(de.IntegerExclusiveMinimum,e,n,r)),mn(e.maximum)&&!(r<=e.maximum)&&(yield Ke(de.IntegerMaximum,e,n,r)),mn(e.minimum)&&!(r>=e.minimum)&&(yield Ke(de.IntegerMinimum,e,n,r)),mn(e.multipleOf)&&r%e.multipleOf!==0&&(yield Ke(de.IntegerMultipleOf,e,n,r))}function*GLe(e,t,n,r){let i=!1;for(let o of e.allOf)for(let a of Yi(o,t,n,r))i=!0,yield a;if(i)return yield Ke(de.Intersect,e,n,r);if(e.unevaluatedProperties===!1){let o=new RegExp(yg(e));for(let a of Object.getOwnPropertyNames(r))o.test(a)||(yield Ke(de.IntersectUnevaluatedProperties,e,`${n}/${a}`,r))}if(typeof e.unevaluatedProperties=="object"){let o=new RegExp(yg(e));for(let a of Object.getOwnPropertyNames(r))if(!o.test(a)){let c=Yi(e.unevaluatedProperties,t,`${n}/${a}`,r[a]).next();c.done||(yield c.value)}}}function*BLe(e,t,n,r){jI(r)||(yield Ke(de.Iterator,e,n,r))}function*KLe(e,t,n,r){r!==e.const&&(yield Ke(de.Literal,e,n,r))}function*HLe(e,t,n,r){yield Ke(de.Never,e,n,r)}function*VLe(e,t,n,r){Yi(e.not,t,n,r).next().done===!0&&(yield Ke(de.Not,e,n,r))}function*zLe(e,t,n,r){Il(r)||(yield Ke(de.Null,e,n,r))}function*JLe(e,t,n,r){if(!xi.IsNumberLike(r))return yield Ke(de.Number,e,n,r);mn(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield Ke(de.NumberExclusiveMaximum,e,n,r)),mn(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield Ke(de.NumberExclusiveMinimum,e,n,r)),mn(e.maximum)&&!(r<=e.maximum)&&(yield Ke(de.NumberMaximum,e,n,r)),mn(e.minimum)&&!(r>=e.minimum)&&(yield Ke(de.NumberMinimum,e,n,r)),mn(e.multipleOf)&&r%e.multipleOf!==0&&(yield Ke(de.NumberMultipleOf,e,n,r))}function*YLe(e,t,n,r){if(!xi.IsObjectLike(r))return yield Ke(de.Object,e,n,r);mn(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield Ke(de.ObjectMinProperties,e,n,r)),mn(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield Ke(de.ObjectMaxProperties,e,n,r));let i=Array.isArray(e.required)?e.required:[],o=Object.getOwnPropertyNames(e.properties),a=Object.getOwnPropertyNames(r);for(let c of i)a.includes(c)||(yield Ke(de.ObjectRequiredProperty,e.properties[c],`${n}/${Ol(c)}`,void 0));if(e.additionalProperties===!1)for(let c of a)o.includes(c)||(yield Ke(de.ObjectAdditionalProperties,e,`${n}/${Ol(c)}`,r[c]));if(typeof e.additionalProperties=="object")for(let c of a)o.includes(c)||(yield*Yi(e.additionalProperties,t,`${n}/${Ol(c)}`,r[c]));for(let c of o){let u=e.properties[c];e.required&&e.required.includes(c)?(yield*Yi(u,t,`${n}/${Ol(c)}`,r[c]),Bm(e)&&!(c in r)&&(yield Ke(de.ObjectRequiredProperty,u,`${n}/${Ol(c)}`,void 0))):xi.IsExactOptionalProperty(r,c)&&(yield*Yi(u,t,`${n}/${Ol(c)}`,r[c]))}}function*XLe(e,t,n,r){GI(r)||(yield Ke(de.Promise,e,n,r))}function*QLe(e,t,n,r){if(!xi.IsRecordLike(r))return yield Ke(de.Object,e,n,r);mn(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield Ke(de.ObjectMinProperties,e,n,r)),mn(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield Ke(de.ObjectMaxProperties,e,n,r));let[i,o]=Object.entries(e.patternProperties)[0],a=new RegExp(i);for(let[c,u]of Object.entries(r))a.test(c)&&(yield*Yi(o,t,`${n}/${Ol(c)}`,u));if(typeof e.additionalProperties=="object")for(let[c,u]of Object.entries(r))a.test(c)||(yield*Yi(e.additionalProperties,t,`${n}/${Ol(c)}`,u));if(e.additionalProperties===!1){for(let[c,u]of Object.entries(r))if(!a.test(c))return yield Ke(de.ObjectAdditionalProperties,e,`${n}/${Ol(c)}`,u)}}function*ZLe(e,t,n,r){yield*Yi(Nn(e,t),t,n,r)}function*eMe(e,t,n,r){if(!qn(r))return yield Ke(de.String,e,n,r);if(mn(e.minLength)&&!(r.length>=e.minLength)&&(yield Ke(de.StringMinLength,e,n,r)),mn(e.maxLength)&&!(r.length<=e.maxLength)&&(yield Ke(de.StringMaxLength,e,n,r)),!new RegExp(e.source,e.flags).test(r))return yield Ke(de.RegExp,e,n,r)}function*tMe(e,t,n,r){if(!qn(r))return yield Ke(de.String,e,n,r);mn(e.minLength)&&!(r.length>=e.minLength)&&(yield Ke(de.StringMinLength,e,n,r)),mn(e.maxLength)&&!(r.length<=e.maxLength)&&(yield Ke(de.StringMaxLength,e,n,r)),qn(e.pattern)&&(new RegExp(e.pattern).test(r)||(yield Ke(de.StringPattern,e,n,r))),qn(e.format)&&(gu.Has(e.format)?gu.Get(e.format)(r)||(yield Ke(de.StringFormat,e,n,r)):yield Ke(de.StringFormatUnknown,e,n,r))}function*nMe(e,t,n,r){kl(r)||(yield Ke(de.Symbol,e,n,r))}function*rMe(e,t,n,r){if(!qn(r))return yield Ke(de.String,e,n,r);new RegExp(e.pattern).test(r)||(yield Ke(de.StringPattern,e,n,r))}function*iMe(e,t,n,r){yield*Yi(Nn(e,t),t,n,r)}function*oMe(e,t,n,r){if(!Rt(r))return yield Ke(de.Tuple,e,n,r);if(e.items===void 0&&r.length!==0)return yield Ke(de.TupleLength,e,n,r);if(r.length!==e.maxItems)return yield Ke(de.TupleLength,e,n,r);if(e.items)for(let i=0;i<e.items.length;i++)yield*Yi(e.items[i],t,`${n}/${i}`,r[i])}function*aMe(e,t,n,r){xr(r)||(yield Ke(de.Undefined,e,n,r))}function*sMe(e,t,n,r){if(Kt(e,t,r))return;let i=e.anyOf.map(o=>new zp(Yi(o,t,n,r)));yield Ke(de.Union,e,n,r,i)}function*cMe(e,t,n,r){if(!ig(r))return yield Ke(de.Uint8Array,e,n,r);mn(e.maxByteLength)&&!(r.length<=e.maxByteLength)&&(yield Ke(de.Uint8ArrayMaxByteLength,e,n,r)),mn(e.minByteLength)&&!(r.length>=e.minByteLength)&&(yield Ke(de.Uint8ArrayMinByteLength,e,n,r))}function*uMe(e,t,n,r){}function*lMe(e,t,n,r){xi.IsVoidLike(r)||(yield Ke(de.Void,e,n,r))}function*pMe(e,t,n,r){Tc.Get(e[he])(e,r)||(yield Ke(de.Kind,e,n,r))}function*Yi(e,t,n,r){let i=mn(e.$id)?[...t,e]:t,o=e;switch(o[he]){case"Any":return yield*PLe(o,i,n,r);case"Argument":return yield*LLe(o,i,n,r);case"Array":return yield*MLe(o,i,n,r);case"AsyncIterator":return yield*NLe(o,i,n,r);case"BigInt":return yield*DLe(o,i,n,r);case"Boolean":return yield*$Le(o,i,n,r);case"Constructor":return yield*FLe(o,i,n,r);case"Date":return yield*ULe(o,i,n,r);case"Function":return yield*WLe(o,i,n,r);case"Import":return yield*qLe(o,i,n,r);case"Integer":return yield*jLe(o,i,n,r);case"Intersect":return yield*GLe(o,i,n,r);case"Iterator":return yield*BLe(o,i,n,r);case"Literal":return yield*KLe(o,i,n,r);case"Never":return yield*HLe(o,i,n,r);case"Not":return yield*VLe(o,i,n,r);case"Null":return yield*zLe(o,i,n,r);case"Number":return yield*JLe(o,i,n,r);case"Object":return yield*YLe(o,i,n,r);case"Promise":return yield*XLe(o,i,n,r);case"Record":return yield*QLe(o,i,n,r);case"Ref":return yield*ZLe(o,i,n,r);case"RegExp":return yield*eMe(o,i,n,r);case"String":return yield*tMe(o,i,n,r);case"Symbol":return yield*nMe(o,i,n,r);case"TemplateLiteral":return yield*rMe(o,i,n,r);case"This":return yield*iMe(o,i,n,r);case"Tuple":return yield*oMe(o,i,n,r);case"Undefined":return yield*aMe(o,i,n,r);case"Union":return yield*sMe(o,i,n,r);case"Uint8Array":return yield*cMe(o,i,n,r);case"Unknown":return yield*uMe(o,i,n,r);case"Void":return yield*lMe(o,i,n,r);default:if(!Tc.Has(o[he]))throw new vM(e);return yield*pMe(o,i,n,r)}}function Jp(...e){let t=e.length===3?Yi(e[0],e[1],"",e[2]):Yi(e[0],[],"",e[1]);return new zp(t)}var dMe=function(e,t,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(e,n):i?i.value=n:t.set(e,n),n},nV=function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},bM,dk,rV,wM=class extends Mt{constructor(t){let n=t.First();super(n===void 0?"Invalid Value":n.message),bM.add(this),dk.set(this,void 0),dMe(this,dk,t,"f"),this.error=n}Errors(){return new zp(nV(this,bM,"m",rV).call(this))}};dk=new WeakMap,bM=new WeakSet,rV=function*(){this.error&&(yield this.error),yield*nV(this,dk,"f")};function tV(e,t,n){if(!Kt(e,t,n))throw new wM(Jp(e,t,n))}function mk(...e){return e.length===3?tV(e[0],e[1],e[2]):tV(e[0],[],e[1])}function mMe(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=An(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=An(e[n]);return t}function fMe(e){return e.map(t=>An(t))}function hMe(e){return e.slice()}function gMe(e){return new Map(An([...e.entries()]))}function yMe(e){return new Set(An([...e.entries()]))}function _Me(e){return new Date(e.toISOString())}function An(e){if(Rt(e))return fMe(e);if(Xo(e))return _Me(e);if(As(e))return hMe(e);if(FK(e))return gMe(e);if(UK(e))return yMe(e);if(Ut(e))return mMe(e);if(za(e))return e;throw new Error("ValueClone: Unable to clone value")}var ts=class extends Mt{constructor(t,n){super(n),this.schema=t}};function Rn(e){return Fp(e)?e():An(e)}function xMe(e,t){return Tt(e,"default")?Rn(e.default):{}}function vMe(e,t){return{}}function bMe(e,t){if(e.uniqueItems===!0&&!Tt(e,"default"))throw new ts(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!Tt(e,"default"))throw new ts(e,"Array with the contains constraint requires a default value");return"default"in e?Rn(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(n=>ns(e.items,t)):[]}function wMe(e,t){return Tt(e,"default")?Rn(e.default):(async function*(){})()}function TMe(e,t){return Tt(e,"default")?Rn(e.default):BigInt(0)}function IMe(e,t){return Tt(e,"default")?Rn(e.default):!1}function kMe(e,t){if(Tt(e,"default"))return Rn(e.default);{let n=ns(e.returns,t);return typeof n=="object"&&!Array.isArray(n)?class{constructor(){for(let[r,i]of Object.entries(n)){let o=this;o[r]=i}}}:class{}}}function EMe(e,t){return Tt(e,"default")?Rn(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function SMe(e,t){return Tt(e,"default")?Rn(e.default):()=>ns(e.returns,t)}function AMe(e,t){let n=globalThis.Object.values(e.$defs),r=e.$defs[e.$ref];return ns(r,[...t,...n])}function RMe(e,t){return Tt(e,"default")?Rn(e.default):e.minimum!==void 0?e.minimum:0}function CMe(e,t){if(Tt(e,"default"))return Rn(e.default);{let n=e.allOf.reduce((r,i)=>{let o=ns(i,t);return typeof o=="object"?{...r,...o}:o},{});if(!Kt(e,t,n))throw new ts(e,"Intersect produced invalid value. Consider using a default value.");return n}}function OMe(e,t){return Tt(e,"default")?Rn(e.default):(function*(){})()}function PMe(e,t){return Tt(e,"default")?Rn(e.default):e.const}function LMe(e,t){if(Tt(e,"default"))return Rn(e.default);throw new ts(e,"Never types cannot be created. Consider using a default value.")}function MMe(e,t){if(Tt(e,"default"))return Rn(e.default);throw new ts(e,"Not types must have a default value")}function NMe(e,t){return Tt(e,"default")?Rn(e.default):null}function DMe(e,t){return Tt(e,"default")?Rn(e.default):e.minimum!==void 0?e.minimum:0}function $Me(e,t){if(Tt(e,"default"))return Rn(e.default);{let n=new Set(e.required),r={};for(let[i,o]of Object.entries(e.properties))n.has(i)&&(r[i]=ns(o,t));return r}}function FMe(e,t){return Tt(e,"default")?Rn(e.default):Promise.resolve(ns(e.item,t))}function UMe(e,t){return Tt(e,"default")?Rn(e.default):{}}function WMe(e,t){return Tt(e,"default")?Rn(e.default):ns(Nn(e,t),t)}function qMe(e,t){if(Tt(e,"default"))return Rn(e.default);throw new ts(e,"RegExp types cannot be created. Consider using a default value.")}function jMe(e,t){if(e.pattern!==void 0){if(Tt(e,"default"))return Rn(e.default);throw new ts(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(Tt(e,"default"))return Rn(e.default);throw new ts(e,"String types with formats must specify a default value")}else return Tt(e,"default")?Rn(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function GMe(e,t){return Tt(e,"default")?Rn(e.default):"value"in e?Symbol.for(e.value):Symbol()}function BMe(e,t){if(Tt(e,"default"))return Rn(e.default);if(!zI(e))throw new ts(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return mg(e)[0]}function KMe(e,t){if(iV++>ZMe)throw new ts(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return Tt(e,"default")?Rn(e.default):ns(Nn(e,t),t)}function HMe(e,t){return Tt(e,"default")?Rn(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((n,r)=>ns(e.items[r],t))}function VMe(e,t){if(Tt(e,"default"))return Rn(e.default)}function zMe(e,t){if(Tt(e,"default"))return Rn(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return ns(e.anyOf[0],t)}function JMe(e,t){return Tt(e,"default")?Rn(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function YMe(e,t){return Tt(e,"default")?Rn(e.default):{}}function XMe(e,t){if(Tt(e,"default"))return Rn(e.default)}function QMe(e,t){if(Tt(e,"default"))return Rn(e.default);throw new Error("User defined types must specify a default value")}function ns(e,t){let n=zi(e,t),r=e;switch(r[he]){case"Any":return xMe(r,n);case"Argument":return vMe(r,n);case"Array":return bMe(r,n);case"AsyncIterator":return wMe(r,n);case"BigInt":return TMe(r,n);case"Boolean":return IMe(r,n);case"Constructor":return kMe(r,n);case"Date":return EMe(r,n);case"Function":return SMe(r,n);case"Import":return AMe(r,n);case"Integer":return RMe(r,n);case"Intersect":return CMe(r,n);case"Iterator":return OMe(r,n);case"Literal":return PMe(r,n);case"Never":return LMe(r,n);case"Not":return MMe(r,n);case"Null":return NMe(r,n);case"Number":return DMe(r,n);case"Object":return $Me(r,n);case"Promise":return FMe(r,n);case"Record":return UMe(r,n);case"Ref":return WMe(r,n);case"RegExp":return qMe(r,n);case"String":return jMe(r,n);case"Symbol":return GMe(r,n);case"TemplateLiteral":return BMe(r,n);case"This":return KMe(r,n);case"Tuple":return HMe(r,n);case"Undefined":return VMe(r,n);case"Union":return zMe(r,n);case"Uint8Array":return JMe(r,n);case"Unknown":return YMe(r,n);case"Void":return XMe(r,n);default:if(!Tc.Has(r[he]))throw new ts(r,"Unknown type");return QMe(r,n)}}var ZMe=512,iV=0;function Sc(...e){return iV=0,e.length===2?ns(e[0],e[1]):ns(e[0],[])}var fk=class extends Mt{constructor(t,n){super(n),this.schema=t}};function oV(e,t,n){if(e[he]==="Object"&&typeof n=="object"&&!Il(n)){let r=e,i=Object.getOwnPropertyNames(n);return Object.entries(r.properties).reduce((a,[c,u])=>{let l=u[he]==="Literal"&&u.const===n[c]?100:0,d=Kt(u,t,n[c])?10:0,m=i.includes(c)?1:0;return a+(l+d+m)},0)}else if(e[he]==="Union"){let i=e.anyOf.map(o=>Nn(o,t)).map(o=>oV(o,t,n));return Math.max(...i)}else return Kt(e,t,n)?1:0}function eNe(e,t,n){let r=e.anyOf.map(a=>Nn(a,t)),[i,o]=[r[0],0];for(let a of r){let c=oV(a,t,n);c>o&&(i=a,o=c)}return i}function tNe(e,t,n){if("default"in e)return typeof n=="function"?e.default:An(e.default);{let r=eNe(e,t,n);return pv(r,t,n)}}function nNe(e,t,n){return Kt(e,t,n)?An(n):Sc(e,t)}function rNe(e,t,n){return Kt(e,t,n)?n:Sc(e,t)}function iNe(e,t,n){if(Kt(e,t,n))return An(n);let r=Rt(n)?An(n):Sc(e,t),i=vr(e.minItems)&&r.length<e.minItems?[...r,...Array.from({length:e.minItems-r.length},()=>null)]:r,a=(vr(e.maxItems)&&i.length>e.maxItems?i.slice(0,e.maxItems):i).map(u=>Ac(e.items,t,u));if(e.uniqueItems!==!0)return a;let c=[...new Set(a)];if(!Kt(e,t,c))throw new fk(e,"Array cast produced invalid data due to uniqueItems constraint");return c}function oNe(e,t,n){if(Kt(e,t,n))return Sc(e,t);let r=new Set(e.returns.required||[]),i=function(){};for(let[o,a]of Object.entries(e.returns.properties))!r.has(o)&&n.prototype[o]===void 0||(i.prototype[o]=Ac(a,t,n.prototype[o]));return i}function aNe(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Ac(i,[...t,...r],n)}function aV(e,t){return Ut(e)&&!Ut(t)||!Ut(e)&&Ut(t)?e:!Ut(e)||!Ut(t)?t:globalThis.Object.getOwnPropertyNames(e).reduce((n,r)=>{let i=r in t?aV(e[r],t[r]):e[r];return{...n,[r]:i}},{})}function sNe(e,t,n){if(Kt(e,t,n))return n;let r=Sc(e,t),i=aV(r,n);return Kt(e,t,i)?i:r}function cNe(e,t,n){throw new fk(e,"Never types cannot be cast")}function uNe(e,t,n){if(Kt(e,t,n))return n;if(n===null||typeof n!="object")return Sc(e,t);let r=new Set(e.required||[]),i={};for(let[o,a]of Object.entries(e.properties))!r.has(o)&&n[o]===void 0||(i[o]=Ac(a,t,n[o]));if(typeof e.additionalProperties=="object"){let o=Object.getOwnPropertyNames(e.properties);for(let a of Object.getOwnPropertyNames(n))o.includes(a)||(i[a]=Ac(e.additionalProperties,t,n[a]))}return i}function lNe(e,t,n){if(Kt(e,t,n))return An(n);if(n===null||typeof n!="object"||Array.isArray(n)||n instanceof Date)return Sc(e,t);let r=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[r],o={};for(let[a,c]of Object.entries(n))o[a]=Ac(i,t,c);return o}function pNe(e,t,n){return Ac(Nn(e,t),t,n)}function dNe(e,t,n){return Ac(Nn(e,t),t,n)}function mNe(e,t,n){return Kt(e,t,n)?An(n):Rt(n)?e.items===void 0?[]:e.items.map((r,i)=>Ac(r,t,n[i])):Sc(e,t)}function fNe(e,t,n){return Kt(e,t,n)?An(n):tNe(e,t,n)}function Ac(e,t,n){let r=qn(e.$id)?zi(e,t):t,i=e;switch(e[he]){case"Array":return iNe(i,r,n);case"Constructor":return oNe(i,r,n);case"Import":return aNe(i,r,n);case"Intersect":return sNe(i,r,n);case"Never":return cNe(i,r,n);case"Object":return uNe(i,r,n);case"Record":return lNe(i,r,n);case"Ref":return pNe(i,r,n);case"This":return dNe(i,r,n);case"Tuple":return mNe(i,r,n);case"Union":return fNe(i,r,n);case"Date":case"Symbol":case"Uint8Array":return nNe(e,t,n);default:return rNe(i,r,n)}}function pv(...e){return e.length===3?Ac(e[0],e[1],e[2]):Ac(e[0],[],e[1])}function hNe(e){return Wp(e)&&e[he]!=="Unsafe"}function gNe(e,t,n){return Rt(n)?n.map(r=>Ta(e.items,t,r)):n}function yNe(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Ta(i,[...t,...r],n)}function _Ne(e,t,n){let r=e.unevaluatedProperties,o=e.allOf.map(c=>Ta(c,t,An(n))).reduce((c,u)=>Ut(u)?{...c,...u}:u,{});if(!Ut(n)||!Ut(o)||!Wp(r))return o;let a=ba(e);for(let c of Object.getOwnPropertyNames(n))a.includes(c)||Kt(r,t,n[c])&&(o[c]=Ta(r,t,n[c]));return o}function xNe(e,t,n){if(!Ut(n)||Rt(n))return n;let r=e.additionalProperties;for(let i of Object.getOwnPropertyNames(n)){if(Tt(e.properties,i)){n[i]=Ta(e.properties[i],t,n[i]);continue}if(Wp(r)&&Kt(r,t,n[i])){n[i]=Ta(r,t,n[i]);continue}delete n[i]}return n}function vNe(e,t,n){if(!Ut(n))return n;let r=e.additionalProperties,i=Object.getOwnPropertyNames(n),[o,a]=Object.entries(e.patternProperties)[0],c=new RegExp(o);for(let u of i){if(c.test(u)){n[u]=Ta(a,t,n[u]);continue}if(Wp(r)&&Kt(r,t,n[u])){n[u]=Ta(r,t,n[u]);continue}delete n[u]}return n}function bNe(e,t,n){return Ta(Nn(e,t),t,n)}function wNe(e,t,n){return Ta(Nn(e,t),t,n)}function TNe(e,t,n){if(!Rt(n))return n;if(xr(e.items))return[];let r=Math.min(n.length,e.items.length);for(let i=0;i<r;i++)n[i]=Ta(e.items[i],t,n[i]);return n.length>r?n.slice(0,r):n}function INe(e,t,n){for(let r of e.anyOf)if(hNe(r)&&Kt(r,t,n))return Ta(r,t,n);return n}function Ta(e,t,n){let r=qn(e.$id)?zi(e,t):t,i=e;switch(i[he]){case"Array":return gNe(i,r,n);case"Import":return yNe(i,r,n);case"Intersect":return _Ne(i,r,n);case"Object":return xNe(i,r,n);case"Record":return vNe(i,r,n);case"Ref":return bNe(i,r,n);case"This":return wNe(i,r,n);case"Tuple":return TNe(i,r,n);case"Union":return INe(i,r,n);default:return n}}function hk(...e){return e.length===3?Ta(e[0],e[1],e[2]):Ta(e[0],[],e[1])}function gk(e){return qn(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function kNe(e){return hc(e)||hu(e)||vr(e)}function dv(e){return e===!0||vr(e)&&e===1||hc(e)&&e===BigInt("1")||qn(e)&&(e.toLowerCase()==="true"||e==="1")}function mv(e){return e===!1||vr(e)&&(e===0||Object.is(e,-0))||hc(e)&&e===BigInt("0")||qn(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function ENe(e){return qn(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function SNe(e){return qn(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function ANe(e){return qn(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function RNe(e){return qn(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function CNe(e){return qn(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function ONe(e,t){let n=cV(e);return n===t?n:e}function PNe(e,t){let n=uV(e);return n===t?n:e}function LNe(e,t){let n=sV(e);return n===t?n:e}function MNe(e,t){return qn(e.const)?ONe(t,e.const):vr(e.const)?PNe(t,e.const):hu(e.const)?LNe(t,e.const):t}function sV(e){return dv(e)?!0:mv(e)?!1:e}function NNe(e){let t=n=>n.split(".")[0];return gk(e)?BigInt(t(e)):vr(e)?BigInt(Math.trunc(e)):mv(e)?BigInt(0):dv(e)?BigInt(1):e}function cV(e){return kl(e)&&e.description!==void 0?e.description.toString():kNe(e)?e.toString():e}function uV(e){return gk(e)?parseFloat(e):dv(e)?1:mv(e)?0:e}function DNe(e){return gk(e)?parseInt(e):vr(e)?Math.trunc(e):dv(e)?1:mv(e)?0:e}function $Ne(e){return qn(e)&&e.toLowerCase()==="null"?null:e}function FNe(e){return qn(e)&&e==="undefined"?void 0:e}function UNe(e){return Xo(e)?e:vr(e)?new Date(e):dv(e)?new Date(1):mv(e)?new Date(0):gk(e)?new Date(parseInt(e)):SNe(e)?new Date(`1970-01-01T${e}.000Z`):ENe(e)?new Date(`1970-01-01T${e}`):RNe(e)?new Date(`${e}.000Z`):ANe(e)?new Date(e):CNe(e)?new Date(`${e}T00:00:00.000Z`):e}function WNe(e,t,n){return(Rt(n)?n:[n]).map(i=>Rc(e.items,t,i))}function qNe(e,t,n){return NNe(n)}function jNe(e,t,n){return sV(n)}function GNe(e,t,n){return UNe(n)}function BNe(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Rc(i,[...t,...r],n)}function KNe(e,t,n){return DNe(n)}function HNe(e,t,n){return e.allOf.reduce((r,i)=>Rc(i,t,r),n)}function VNe(e,t,n){return MNe(e,n)}function zNe(e,t,n){return $Ne(n)}function JNe(e,t,n){return uV(n)}function YNe(e,t,n){if(!Ut(n)||Rt(n))return n;for(let r of Object.getOwnPropertyNames(e.properties))Tt(n,r)&&(n[r]=Rc(e.properties[r],t,n[r]));return n}function XNe(e,t,n){if(!(Ut(n)&&!Rt(n)))return n;let i=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[i];for(let[a,c]of Object.entries(n))n[a]=Rc(o,t,c);return n}function QNe(e,t,n){return Rc(Nn(e,t),t,n)}function ZNe(e,t,n){return cV(n)}function eDe(e,t,n){return qn(n)||vr(n)?Symbol(n):n}function tDe(e,t,n){return Rc(Nn(e,t),t,n)}function nDe(e,t,n){return Rt(n)&&!xr(e.items)?n.map((i,o)=>o<e.items.length?Rc(e.items[o],t,i):i):n}function rDe(e,t,n){return FNe(n)}function iDe(e,t,n){for(let r of e.anyOf)if(Kt(r,t,n))return n;for(let r of e.anyOf){let i=Rc(r,t,An(n));if(Kt(r,t,i))return i}return n}function Rc(e,t,n){let r=zi(e,t),i=e;switch(e[he]){case"Array":return WNe(i,r,n);case"BigInt":return qNe(i,r,n);case"Boolean":return jNe(i,r,n);case"Date":return GNe(i,r,n);case"Import":return BNe(i,r,n);case"Integer":return KNe(i,r,n);case"Intersect":return HNe(i,r,n);case"Literal":return VNe(i,r,n);case"Null":return zNe(i,r,n);case"Number":return JNe(i,r,n);case"Object":return YNe(i,r,n);case"Record":return XNe(i,r,n);case"Ref":return QNe(i,r,n);case"String":return ZNe(i,r,n);case"Symbol":return eDe(i,r,n);case"This":return tDe(i,r,n);case"Tuple":return nDe(i,r,n);case"Undefined":return rDe(i,r,n);case"Union":return iDe(i,r,n);default:return n}}function yk(...e){return e.length===3?Rc(e[0],e[1],e[2]):Rc(e[0],[],e[1])}var _k=class extends Mt{constructor(t,n,r){super("Unable to decode value as it does not match the expected schema"),this.schema=t,this.value=n,this.error=r}},TM=class extends Mt{constructor(t,n,r,i){super(i instanceof Error?i.message:"Unknown error"),this.schema=t,this.path=n,this.value=r,this.error=i}};function Lr(e,t,n){try{return Pn(e)?e[Or].Decode(n):n}catch(r){throw new TM(e,t,n,r)}}function oDe(e,t,n,r){return Rt(r)?Lr(e,n,r.map((i,o)=>Cc(e.items,t,`${n}/${o}`,i))):Lr(e,n,r)}function aDe(e,t,n,r){if(!Ut(r)||za(r))return Lr(e,n,r);let i=ZI(e),o=i.map(d=>d[0]),a={...r};for(let[d,m]of i)d in a&&(a[d]=Cc(m,t,`${n}/${d}`,a[d]));if(!Pn(e.unevaluatedProperties))return Lr(e,n,a);let c=Object.getOwnPropertyNames(a),u=e.unevaluatedProperties,l={...a};for(let d of c)o.includes(d)||(l[d]=Lr(u,`${n}/${d}`,l[d]));return Lr(e,n,l)}function sDe(e,t,n,r){let i=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref],a=Cc(o,[...t,...i],n,r);return Lr(e,n,a)}function cDe(e,t,n,r){return Lr(e,n,Cc(e.not,t,n,r))}function uDe(e,t,n,r){if(!Ut(r))return Lr(e,n,r);let i=ba(e),o={...r};for(let l of i)Tt(o,l)&&(xr(o[l])&&(!Al(e.properties[l])||xi.IsExactOptionalProperty(o,l))||(o[l]=Cc(e.properties[l],t,`${n}/${l}`,o[l])));if(!Pr(e.additionalProperties))return Lr(e,n,o);let a=Object.getOwnPropertyNames(o),c=e.additionalProperties,u={...o};for(let l of a)i.includes(l)||(u[l]=Lr(c,`${n}/${l}`,u[l]));return Lr(e,n,u)}function lDe(e,t,n,r){if(!Ut(r))return Lr(e,n,r);let i=Object.getOwnPropertyNames(e.patternProperties)[0],o=new RegExp(i),a={...r};for(let d of Object.getOwnPropertyNames(r))o.test(d)&&(a[d]=Cc(e.patternProperties[i],t,`${n}/${d}`,a[d]));if(!Pr(e.additionalProperties))return Lr(e,n,a);let c=Object.getOwnPropertyNames(a),u=e.additionalProperties,l={...a};for(let d of c)o.test(d)||(l[d]=Lr(u,`${n}/${d}`,l[d]));return Lr(e,n,l)}function pDe(e,t,n,r){let i=Nn(e,t);return Lr(e,n,Cc(i,t,n,r))}function dDe(e,t,n,r){let i=Nn(e,t);return Lr(e,n,Cc(i,t,n,r))}function mDe(e,t,n,r){return Rt(r)&&Rt(e.items)?Lr(e,n,e.items.map((i,o)=>Cc(i,t,`${n}/${o}`,r[o]))):Lr(e,n,r)}function fDe(e,t,n,r){for(let i of e.anyOf){if(!Kt(i,t,r))continue;let o=Cc(i,t,n,r);return Lr(e,n,o)}return Lr(e,n,r)}function Cc(e,t,n,r){let i=zi(e,t),o=e;switch(e[he]){case"Array":return oDe(o,i,n,r);case"Import":return sDe(o,i,n,r);case"Intersect":return aDe(o,i,n,r);case"Not":return cDe(o,i,n,r);case"Object":return uDe(o,i,n,r);case"Record":return lDe(o,i,n,r);case"Ref":return pDe(o,i,n,r);case"Symbol":return Lr(o,n,r);case"This":return dDe(o,i,n,r);case"Tuple":return mDe(o,i,n,r);case"Union":return fDe(o,i,n,r);default:return Lr(o,n,r)}}function xk(e,t,n){return Cc(e,t,"",n)}var vk=class extends Mt{constructor(t,n,r){super("The encoded value does not match the expected schema"),this.schema=t,this.value=n,this.error=r}},IM=class extends Mt{constructor(t,n,r,i){super(`${i instanceof Error?i.message:"Unknown error"}`),this.schema=t,this.path=n,this.value=r,this.error=i}};function ho(e,t,n){try{return Pn(e)?e[Or].Encode(n):n}catch(r){throw new IM(e,t,n,r)}}function hDe(e,t,n,r){let i=ho(e,n,r);return Rt(i)?i.map((o,a)=>Oc(e.items,t,`${n}/${a}`,o)):i}function gDe(e,t,n,r){let i=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref],a=ho(e,n,r);return Oc(o,[...t,...i],n,a)}function yDe(e,t,n,r){let i=ho(e,n,r);if(!Ut(r)||za(r))return i;let o=ZI(e),a=o.map(m=>m[0]),c={...i};for(let[m,h]of o)m in c&&(c[m]=Oc(h,t,`${n}/${m}`,c[m]));if(!Pn(e.unevaluatedProperties))return c;let u=Object.getOwnPropertyNames(c),l=e.unevaluatedProperties,d={...c};for(let m of u)a.includes(m)||(d[m]=ho(l,`${n}/${m}`,d[m]));return d}function _De(e,t,n,r){return ho(e.not,n,ho(e,n,r))}function xDe(e,t,n,r){let i=ho(e,n,r);if(!Ut(i))return i;let o=ba(e),a={...i};for(let d of o)Tt(a,d)&&(xr(a[d])&&(!Al(e.properties[d])||xi.IsExactOptionalProperty(a,d))||(a[d]=Oc(e.properties[d],t,`${n}/${d}`,a[d])));if(!Pr(e.additionalProperties))return a;let c=Object.getOwnPropertyNames(a),u=e.additionalProperties,l={...a};for(let d of c)o.includes(d)||(l[d]=ho(u,`${n}/${d}`,l[d]));return l}function vDe(e,t,n,r){let i=ho(e,n,r);if(!Ut(r))return i;let o=Object.getOwnPropertyNames(e.patternProperties)[0],a=new RegExp(o),c={...i};for(let m of Object.getOwnPropertyNames(r))a.test(m)&&(c[m]=Oc(e.patternProperties[o],t,`${n}/${m}`,c[m]));if(!Pr(e.additionalProperties))return c;let u=Object.getOwnPropertyNames(c),l=e.additionalProperties,d={...c};for(let m of u)a.test(m)||(d[m]=ho(l,`${n}/${m}`,d[m]));return d}function bDe(e,t,n,r){let i=Nn(e,t),o=Oc(i,t,n,r);return ho(e,n,o)}function wDe(e,t,n,r){let i=Nn(e,t),o=Oc(i,t,n,r);return ho(e,n,o)}function TDe(e,t,n,r){let i=ho(e,n,r);return Rt(e.items)?e.items.map((o,a)=>Oc(o,t,`${n}/${a}`,i[a])):[]}function IDe(e,t,n,r){for(let i of e.anyOf){if(!Kt(i,t,r))continue;let o=Oc(i,t,n,r);return ho(e,n,o)}for(let i of e.anyOf){let o=Oc(i,t,n,r);if(Kt(e,t,o))return ho(e,n,o)}return ho(e,n,r)}function Oc(e,t,n,r){let i=zi(e,t),o=e;switch(e[he]){case"Array":return hDe(o,i,n,r);case"Import":return gDe(o,i,n,r);case"Intersect":return yDe(o,i,n,r);case"Not":return _De(o,i,n,r);case"Object":return xDe(o,i,n,r);case"Record":return vDe(o,i,n,r);case"Ref":return bDe(o,i,n,r);case"This":return wDe(o,i,n,r);case"Tuple":return TDe(o,i,n,r);case"Union":return IDe(o,i,n,r);default:return ho(o,n,r)}}function bk(e,t,n){return Oc(e,t,"",n)}function kDe(e,t){return Pn(e)||$i(e.items,t)}function EDe(e,t){return Pn(e)||$i(e.items,t)}function SDe(e,t){return Pn(e)||$i(e.returns,t)||e.parameters.some(n=>$i(n,t))}function ADe(e,t){return Pn(e)||$i(e.returns,t)||e.parameters.some(n=>$i(n,t))}function RDe(e,t){return Pn(e)||Pn(e.unevaluatedProperties)||e.allOf.some(n=>$i(n,t))}function CDe(e,t){let n=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((i,o)=>[...i,e.$defs[o]],[]),r=e.$defs[e.$ref];return Pn(e)||$i(r,[...n,...t])}function ODe(e,t){return Pn(e)||$i(e.items,t)}function PDe(e,t){return Pn(e)||$i(e.not,t)}function LDe(e,t){return Pn(e)||Object.values(e.properties).some(n=>$i(n,t))||Pr(e.additionalProperties)&&$i(e.additionalProperties,t)}function MDe(e,t){return Pn(e)||$i(e.item,t)}function NDe(e,t){let n=Object.getOwnPropertyNames(e.patternProperties)[0],r=e.patternProperties[n];return Pn(e)||$i(r,t)||Pr(e.additionalProperties)&&Pn(e.additionalProperties)}function DDe(e,t){return Pn(e)?!0:$i(Nn(e,t),t)}function $De(e,t){return Pn(e)?!0:$i(Nn(e,t),t)}function FDe(e,t){return Pn(e)||!xr(e.items)&&e.items.some(n=>$i(n,t))}function UDe(e,t){return Pn(e)||e.anyOf.some(n=>$i(n,t))}function $i(e,t){let n=zi(e,t),r=e;if(e.$id&&kM.has(e.$id))return!1;switch(e.$id&&kM.add(e.$id),e[he]){case"Array":return kDe(r,n);case"AsyncIterator":return EDe(r,n);case"Constructor":return SDe(r,n);case"Function":return ADe(r,n);case"Import":return CDe(r,n);case"Intersect":return RDe(r,n);case"Iterator":return ODe(r,n);case"Not":return PDe(r,n);case"Object":return LDe(r,n);case"Promise":return MDe(r,n);case"Record":return NDe(r,n);case"Ref":return DDe(r,n);case"This":return $De(r,n);case"Tuple":return FDe(r,n);case"Union":return UDe(r,n);default:return Pn(e)}}var kM=new Set;function Hm(e,t){return kM.clear(),$i(e,t)}function lV(...e){let[t,n,r]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!Kt(t,n,r))throw new _k(t,r,Jp(t,n,r).First());return Hm(t,n)?xk(t,n,r):r}function Pl(e,t){let n=Tt(e,"default")?e.default:void 0,r=Fp(n)?n():An(n);return xr(t)?r:Ut(t)&&Ut(r)?Object.assign(r,t):t}function EM(e){return Wp(e)&&"default"in e}function WDe(e,t,n){if(Rt(n)){for(let i=0;i<n.length;i++)n[i]=Zo(e.items,t,n[i]);return n}let r=Pl(e,n);if(!Rt(r))return r;for(let i=0;i<r.length;i++)r[i]=Zo(e.items,t,r[i]);return r}function qDe(e,t,n){return Xo(n)?n:Pl(e,n)}function jDe(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Zo(i,[...t,...r],n)}function GDe(e,t,n){let r=Pl(e,n);return e.allOf.reduce((i,o)=>{let a=Zo(o,t,r);return Ut(a)?{...i,...a}:a},{})}function BDe(e,t,n){let r=Pl(e,n);if(!Ut(r))return r;let i=Object.getOwnPropertyNames(e.properties);for(let o of i){let a=Zo(e.properties[o],t,r[o]);xr(a)||(r[o]=Zo(e.properties[o],t,r[o]))}if(!EM(e.additionalProperties))return r;for(let o of Object.getOwnPropertyNames(r))i.includes(o)||(r[o]=Zo(e.additionalProperties,t,r[o]));return r}function KDe(e,t,n){let r=Pl(e,n);if(!Ut(r))return r;let i=e.additionalProperties,[o,a]=Object.entries(e.patternProperties)[0],c=new RegExp(o);for(let u of Object.getOwnPropertyNames(r))c.test(u)&&EM(a)&&(r[u]=Zo(a,t,r[u]));if(!EM(i))return r;for(let u of Object.getOwnPropertyNames(r))c.test(u)||(r[u]=Zo(i,t,r[u]));return r}function HDe(e,t,n){return Zo(Nn(e,t),t,Pl(e,n))}function VDe(e,t,n){return Zo(Nn(e,t),t,n)}function zDe(e,t,n){let r=Pl(e,n);if(!Rt(r)||xr(e.items))return r;let[i,o]=[e.items,Math.max(e.items.length,r.length)];for(let a=0;a<o;a++)a<i.length&&(r[a]=Zo(i[a],t,r[a]));return r}function JDe(e,t,n){let r=Pl(e,n);for(let i of e.anyOf){let o=Zo(i,t,An(r));if(Kt(i,t,o))return o}return r}function Zo(e,t,n){let r=zi(e,t),i=e;switch(i[he]){case"Array":return WDe(i,r,n);case"Date":return qDe(i,r,n);case"Import":return jDe(i,r,n);case"Intersect":return GDe(i,r,n);case"Object":return BDe(i,r,n);case"Record":return KDe(i,r,n);case"Ref":return HDe(i,r,n);case"This":return VDe(i,r,n);case"Tuple":return zDe(i,r,n);case"Union":return JDe(i,r,n);default:return Pl(i,n)}}function wk(...e){return e.length===3?Zo(e[0],e[1],e[2]):Zo(e[0],[],e[1])}var Pc={};On(Pc,{Delete:()=>XDe,Format:()=>fv,Get:()=>ZDe,Has:()=>QDe,Set:()=>YDe,ValuePointerRootDeleteError:()=>Ik,ValuePointerRootSetError:()=>Tk});var Tk=class extends Mt{constructor(t,n,r){super("Cannot set root value"),this.value=t,this.path=n,this.update=r}},Ik=class extends Mt{constructor(t,n){super("Cannot delete root value"),this.value=t,this.path=n}};function pV(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*fv(e){if(e==="")return;let[t,n]=[0,0];for(let r=0;r<e.length;r++)e.charAt(r)==="/"?(r===0||(n=r,yield pV(e.slice(t,n))),t=r+1):n=r;yield pV(e.slice(t))}function YDe(e,t,n){if(t==="")throw new Tk(e,t,n);let[r,i,o]=[null,e,""];for(let a of fv(t))i[a]===void 0&&(i[a]={}),r=i,i=i[a],o=a;r[o]=n}function XDe(e,t){if(t==="")throw new Ik(e,t);let[n,r,i]=[null,e,""];for(let o of fv(t)){if(r[o]===void 0||r[o]===null)return;n=r,r=r[o],i=o}if(Array.isArray(n)){let o=parseInt(i);n.splice(o,1)}else delete n[i]}function QDe(e,t){if(t==="")return!0;let[n,r,i]=[null,e,""];for(let o of fv(t)){if(r[o]===void 0)return!1;n=r,r=r[o],i=o}return Object.getOwnPropertyNames(n).includes(i)}function ZDe(e,t){if(t==="")return e;let n=e;for(let r of fv(t)){if(n[r]===void 0)return;n=n[r]}return n}function e2e(e,t){if(!Ut(t))return!1;let n=[...Object.keys(e),...Object.getOwnPropertySymbols(e)],r=[...Object.keys(t),...Object.getOwnPropertySymbols(t)];return n.length!==r.length?!1:n.every(i=>Vm(e[i],t[i]))}function t2e(e,t){return Xo(t)&&e.getTime()===t.getTime()}function n2e(e,t){return!Rt(t)||e.length!==t.length?!1:e.every((n,r)=>Vm(n,t[r]))}function r2e(e,t){return!As(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((n,r)=>Vm(n,t[r]))}function i2e(e,t){return e===t}function Vm(e,t){if(Xo(e))return t2e(e,t);if(As(e))return r2e(e,t);if(Rt(e))return n2e(e,t);if(Ut(e))return e2e(e,t);if(za(e))return i2e(e,t);throw new Error("ValueEquals: Unable to compare value")}var o2e=Mn({type:yn("insert"),path:Qo(),value:Ic()}),a2e=Mn({type:yn("update"),path:Qo(),value:Ic()}),s2e=Mn({type:yn("delete"),path:Qo()}),mV=Ln([o2e,a2e,s2e]),kk=class extends Mt{constructor(t,n){super(n),this.value=t}};function Ek(e,t){return{type:"update",path:e,value:t}}function fV(e,t){return{type:"insert",path:e,value:t}}function hV(e){return{type:"delete",path:e}}function dV(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new kk(e,"Cannot diff objects with symbols")}function*c2e(e,t,n){if(dV(t),dV(n),!UL(n))return yield Ek(e,n);let r=globalThis.Object.getOwnPropertyNames(t),i=globalThis.Object.getOwnPropertyNames(n);for(let o of i)Tt(t,o)||(yield fV(`${e}/${o}`,n[o]));for(let o of r)Tt(n,o)&&(Vm(t,n)||(yield*Sk(`${e}/${o}`,t[o],n[o])));for(let o of r)Tt(n,o)||(yield hV(`${e}/${o}`))}function*u2e(e,t,n){if(!Rt(n))return yield Ek(e,n);for(let r=0;r<Math.min(t.length,n.length);r++)yield*Sk(`${e}/${r}`,t[r],n[r]);for(let r=0;r<n.length;r++)r<t.length||(yield fV(`${e}/${r}`,n[r]));for(let r=t.length-1;r>=0;r--)r<n.length||(yield hV(`${e}/${r}`))}function*l2e(e,t,n){if(!As(n)||t.length!==n.length||globalThis.Object.getPrototypeOf(t).constructor.name!==globalThis.Object.getPrototypeOf(n).constructor.name)return yield Ek(e,n);for(let r=0;r<Math.min(t.length,n.length);r++)yield*Sk(`${e}/${r}`,t[r],n[r])}function*p2e(e,t,n){t!==n&&(yield Ek(e,n))}function*Sk(e,t,n){if(UL(t))return yield*c2e(e,t,n);if(Rt(t))return yield*u2e(e,t,n);if(As(t))return yield*l2e(e,t,n);if(za(t))return yield*p2e(e,t,n);throw new kk(t,"Unable to diff value")}function gV(e,t){return[...Sk("",e,t)]}function d2e(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function m2e(e){return e.length===0}function yV(e,t){if(d2e(t))return An(t[0].value);if(m2e(t))return An(e);let n=An(e);for(let r of t)switch(r.type){case"insert":{Pc.Set(n,r.path,r.value);break}case"update":{Pc.Set(n,r.path,r.value);break}case"delete":{Pc.Delete(n,r.path);break}}return n}function _V(...e){let[t,n,r]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],i=Hm(t,n)?bk(t,n,r):r;if(!Kt(t,n,i))throw new vk(t,i,Jp(t,n,i).First());return i}function Ak(e){return Ut(e)&&!Rt(e)}var Rk=class extends Mt{constructor(t){super(t)}};function f2e(e,t,n,r){if(!Ak(n))Pc.Set(e,t,An(r));else{let i=Object.getOwnPropertyNames(n),o=Object.getOwnPropertyNames(r);for(let a of i)o.includes(a)||delete n[a];for(let a of o)i.includes(a)||(n[a]=null);for(let a of o)SM(e,`${t}/${a}`,n[a],r[a])}}function h2e(e,t,n,r){if(!Rt(n))Pc.Set(e,t,An(r));else{for(let i=0;i<r.length;i++)SM(e,`${t}/${i}`,n[i],r[i]);n.splice(r.length)}}function g2e(e,t,n,r){if(As(n)&&n.length===r.length)for(let i=0;i<n.length;i++)n[i]=r[i];else Pc.Set(e,t,An(r))}function y2e(e,t,n,r){n!==r&&Pc.Set(e,t,r)}function SM(e,t,n,r){if(Rt(r))return h2e(e,t,n,r);if(As(r))return g2e(e,t,n,r);if(Ak(r))return f2e(e,t,n,r);if(za(r))return y2e(e,t,n,r)}function xV(e){return As(e)||za(e)}function _2e(e,t){return Ak(e)&&Rt(t)||Rt(e)&&Ak(t)}function vV(e,t){if(xV(e)||xV(t))throw new Rk("Only object and array types can be mutated at the root level");if(_2e(e,t))throw new Rk("Cannot assign due type mismatch of assignable values");SM(e,"",e,t)}var Ck=class extends Mt{constructor(t){super(t)}},AM;(function(e){let t=new Map([["Assert",(o,a,c)=>(mk(o,a,c),c)],["Cast",(o,a,c)=>pv(o,a,c)],["Clean",(o,a,c)=>hk(o,a,c)],["Clone",(o,a,c)=>An(c)],["Convert",(o,a,c)=>yk(o,a,c)],["Decode",(o,a,c)=>Hm(o,a)?xk(o,a,c):c],["Default",(o,a,c)=>wk(o,a,c)],["Encode",(o,a,c)=>Hm(o,a)?bk(o,a,c):c]]);function n(o){t.delete(o)}e.Delete=n;function r(o,a){t.set(o,a)}e.Set=r;function i(o){return t.get(o)}e.Get=i})(AM||(AM={}));var bV=["Clone","Clean","Default","Convert","Assert","Decode"];function x2e(e,t,n,r){return e.reduce((i,o)=>{let a=AM.Get(o);if(xr(a))throw new Ck(`Unable to find Parse operation '${o}'`);return a(t,n,i)},r)}function wV(...e){let[t,n,r,i]=e.length===4?[e[0],e[1],e[2],e[3]]:e.length===3?Rt(e[0])?[e[0],e[1],[],e[2]]:[bV,e[0],e[1],e[2]]:e.length===2?[bV,e[0],[],e[1]]:(()=>{throw new Ck("Invalid Arguments")})();return x2e(t,n,r,i)}var Ag={};On(Ag,{Assert:()=>mk,Cast:()=>pv,Check:()=>Kt,Clean:()=>hk,Clone:()=>An,Convert:()=>yk,Create:()=>Sc,Decode:()=>lV,Default:()=>wk,Diff:()=>gV,Edit:()=>mV,Encode:()=>_V,Equal:()=>Vm,Errors:()=>Jp,Hash:()=>Sg,Mutate:()=>vV,Parse:()=>wV,Patch:()=>yV,ValueErrorIterator:()=>zp});var zm=s.Union([s.Literal("runtime_unavailable"),s.Literal("capability_missing"),s.Literal("input_invalid"),s.Literal("lease_conflict"),s.Literal("lease_expired"),s.Literal("execution_failed"),s.Literal("rate_limit"),s.Literal("timeout"),s.Literal("cancelled"),s.Literal("output_invalid"),s.Literal("artifact_commit_failed"),s.Literal("max_attempts_exceeded"),s.Literal("context_assembly_failed"),s.Literal("history_not_found"),s.Literal("trajectory_ambiguous"),s.Literal("storage_unavailable"),s.Literal("workspace_invalid"),s.Literal("workspace_dirty"),s.Literal("query_invalid")]),TV=["runtime_unavailable","capability_missing","input_invalid","lease_conflict","lease_expired","execution_failed","rate_limit","timeout","cancelled","output_invalid","artifact_commit_failed","max_attempts_exceeded","context_assembly_failed","history_not_found","trajectory_ambiguous","storage_unavailable","workspace_invalid","workspace_dirty","query_invalid"];var RM={runtime_unavailable:"runtime_unavailable",capability_missing:"config_missing",input_invalid:"config_missing",lease_conflict:"runtime_unavailable",lease_expired:"runtime_unavailable",execution_failed:"runtime_unavailable",rate_limit:"runtime_unavailable",timeout:"runtime_timeout",cancelled:"runtime_timeout",output_invalid:"output_invalid",artifact_commit_failed:"artifact_missing",max_attempts_exceeded:"runtime_timeout",context_assembly_failed:"runtime_unavailable",history_not_found:"runtime_unavailable",trajectory_ambiguous:"runtime_unavailable",storage_unavailable:"ledger_write_failed",workspace_invalid:"config_missing",workspace_dirty:"artifact_missing",query_invalid:"runtime_unavailable"};for(let e of TV)if(!Object.hasOwn(RM,e))throw new Error(`FAILURE_CATEGORY_MAP is missing mapping for PDErrorCategory: ${e}`);var v2e="^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$",Mr=s.String({minLength:1}),IV="governance-iso-utc";gu.Set(IV,e=>{if(!new RegExp(v2e).test(e))return!1;let t=new Date(e);if(!Number.isFinite(t.getTime()))return!1;let n=e.includes(".")?e:e.replace("Z",".000Z");return t.toISOString()===n});var Ll=s.String({format:IV}),Rg=s.Union([s.Literal("prompt"),s.Literal("code_tool_hook"),s.Literal("defer_archive")]),Jm=s.Union([s.Literal("strong"),s.Literal("weak"),s.Literal("unknown")]),Fi=s.Object({type:s.Union([s.Literal("principle"),s.Literal("artifact"),s.Literal("task"),s.Literal("run"),s.Literal("approval"),s.Literal("activation"),s.Literal("trajectory")]),id:Mr},{additionalProperties:!1}),CM=s.Union([s.Object({kind:s.Literal("evaluator_repair"),sourceEvaluatorTaskId:Mr,sourceArtificerArtifactId:Mr,repairIteration:s.Integer({minimum:0})},{additionalProperties:!1}),s.Object({kind:s.Literal("rollout_reopen"),causeId:Mr,sourceRolloutTaskId:Mr,sourceArtifactId:Mr,revisionIteration:s.Integer({minimum:0}),taskRevisionEpoch:s.Optional(s.Integer({minimum:0}))},{additionalProperties:!1}),s.Object({kind:s.Literal("none")},{additionalProperties:!1})]),Cg={schemaVersion:s.Literal("1"),sourceRef:Fi,principleId:Mr,artifactId:s.Optional(Mr),taskId:s.Optional(Mr),lineageKey:s.Optional(Mr),lineageConfidence:Jm,revisionIdentity:s.Optional(CM),occurredAt:s.Optional(Ll),recordedAt:Ll},kV=s.Object({...Cg,family:s.Literal("principle"),state:s.Union([s.Literal("candidate"),s.Literal("active"),s.Literal("archived"),s.Literal("deprecated"),s.Literal("probation")])},{additionalProperties:!1}),OM=s.Object({...Cg,family:s.Literal("task"),taskKind:s.Union([s.Literal("dreamer"),s.Literal("philosopher"),s.Literal("scribe"),s.Literal("artificer"),s.Literal("evaluator"),s.Literal("rollout_reviewer")]),channel:Rg,status:s.Union([s.Literal("pending"),s.Literal("leased"),s.Literal("succeeded"),s.Literal("retry_wait"),s.Literal("failed"),s.Literal("needs_human_review")]),leaseExpiresAt:s.Optional(Ll),attemptCount:s.Integer({minimum:0}),maxAttempts:s.Integer({minimum:1}),lastErrorCategory:s.Optional(zm),completionIntent:s.Optional(s.Object({status:s.Union([s.Literal("pending"),s.Literal("applied")]),revisionEpoch:s.Integer({minimum:0}),effect:s.Union([s.Literal("governance_transition"),s.Literal("needs_human_review")])},{additionalProperties:!1}))},{additionalProperties:!1}),EV=s.Object({...Cg,family:s.Literal("runner_verdict"),runnerKind:s.Union([s.Literal("evaluator"),s.Literal("rollout_reviewer")]),outcome:s.Union([s.Literal("approved"),s.Literal("approve_rollout"),s.Literal("needs_revision"),s.Literal("rejected"),s.Literal("reject")])},{additionalProperties:!1}),SV=s.Object({...Cg,family:s.Literal("approval"),approvalId:Mr,artifactId:Mr,channel:Rg,outcome:s.Union([s.Literal("pending"),s.Literal("approved"),s.Literal("rejected"),s.Literal("cancelled")])},{additionalProperties:!1}),AV=s.Object({...Cg,family:s.Literal("activation"),artifactId:Mr,activationId:Mr,channel:Rg,outcome:s.Union([s.Literal("active"),s.Literal("deactivated")]),activatedAt:Ll,deactivatedAt:s.Optional(Ll)},{additionalProperties:!1}),RV=s.Object({...Cg,family:s.Literal("derived_relation"),relation:s.Union([s.Literal("successor_present"),s.Literal("revision_materialized"),s.Literal("revision_pending"),s.Literal("verdict_missing")]),evidenceRefs:s.Array(Fi)},{additionalProperties:!1}),PM=s.Object({code:s.Union([s.Literal("pain_created"),s.Literal("candidate_generated"),s.Literal("review_started"),s.Literal("revision_requested"),s.Literal("revision_reopened"),s.Literal("approved"),s.Literal("rejected"),s.Literal("activated"),s.Literal("deactivated"),s.Literal("failed"),s.Literal("human_review")]),occurredAt:s.Optional(Ll),recordedAt:Ll,summaryCode:Mr,sourceRef:Fi,lineageConfidence:Jm},{additionalProperties:!1}),LM=s.Object({source:s.Union([s.Literal("ledger"),s.Literal("artifact"),s.Literal("task"),s.Literal("approval"),s.Literal("activation"),s.Literal("trajectory"),s.Literal("lineage")]),reasonCode:Mr,nextActionCode:Mr,sourceRef:s.Optional(Fi)},{additionalProperties:!1}),CV=s.Object({principleId:Mr,artifactIds:s.Array(Mr),taskIds:s.Array(Mr),revisionIdentities:s.Array(CM),confidence:Jm,sourceRefs:s.Array(Fi)},{additionalProperties:!1}),OV=s.Object({schemaVersion:s.Literal("1"),principleId:Mr,asOf:Ll,lineage:CV,principle:kV,tasks:s.Array(OM),runnerVerdicts:s.Array(EV),derivedRelations:s.Array(RV),approvals:s.Array(SV),activations:s.Array(AV),timelineEvents:s.Array(PM),collectionIssues:s.Array(LM)},{additionalProperties:!1}),PV=s.Object({value:s.Union([s.Literal("candidate"),s.Literal("active"),s.Literal("archived"),s.Literal("deprecated"),s.Literal("probation")]),sourceRefs:s.Array(Fi)},{additionalProperties:!1}),LV=s.Object({stage:s.Optional(s.Union([s.Literal("generating"),s.Literal("reviewing"),s.Literal("revising"),s.Literal("approval"),s.Literal("activation")])),currentTaskKind:s.Optional(OM.properties.taskKind),sourceRefs:s.Array(Fi)},{additionalProperties:!1}),MV=s.Object({state:s.Union([s.Literal("idle"),s.Literal("queued"),s.Literal("running"),s.Literal("retry_scheduled"),s.Literal("stalled")]),sourceRefs:s.Array(Fi)},{additionalProperties:!1}),NV=s.Object({kind:s.Union([s.Literal("owner_decision"),s.Literal("recovery")]),reasonCode:Mr,sourceRef:Fi},{additionalProperties:!1}),DV=s.Object({primary:s.Union([s.Literal("none"),s.Literal("owner_required"),s.Literal("recovery_required")]),items:s.Array(NV)},{additionalProperties:!1}),$V=s.Object({state:s.Union([s.Literal("none"),s.Literal("active"),s.Literal("partially_active"),s.Literal("deactivated")]),channels:s.Array(Rg),observedChannels:s.Array(Rg),sourceRefs:s.Array(Fi)},{additionalProperties:!1}),b2e=s.Union([s.Literal("governance.headline.owner_decision"),s.Literal("governance.headline.recovery"),s.Literal("governance.headline.revision"),s.Literal("governance.headline.processing"),s.Literal("governance.headline.active"),s.Literal("governance.headline.unavailable"),s.Literal("governance.headline.recorded")]),w2e=s.Union([s.Literal("governance.reason.approval_pending"),s.Literal("governance.reason.recovery_required"),s.Literal("governance.reason.automatic_revision"),s.Literal("governance.reason.processing"),s.Literal("governance.reason.activation_active"),s.Literal("governance.reason.data_incomplete"),s.Literal("governance.reason.no_current_process")]),T2e=s.Union([s.Literal("governance.next.review"),s.Literal("governance.next.inspect_recovery"),s.Literal("governance.next.wait"),s.Literal("governance.next.monitor"),s.Literal("governance.next.inspect_data"),s.Literal("governance.next.none")]),FV=s.Object({headlineCode:b2e,reasonCode:w2e,nextActionCode:T2e,ownerActionRequired:s.Boolean(),safeReasonSummary:s.Optional(Mr),sourceRefs:s.Array(Fi)},{additionalProperties:!1}),UV=s.Object({degraded:s.Boolean(),issues:s.Array(LM)},{additionalProperties:!1}),Ok=s.Object({schemaVersion:s.Literal("1"),principleId:Mr,asOf:Ll,summary:FV,principleState:PV,process:LV,automation:MV,attention:DV,activationSummary:$V,timeline:s.Array(PM),sourceRefs:s.Array(Fi),dataQuality:UV},{additionalProperties:!1});var vu=s.String({minLength:1}),WV=s.String({format:"governance-iso-utc"}),MM=s.Union([s.Literal("setup_required"),s.Literal("owner_decision_required"),s.Literal("recovery_required"),s.Literal("degraded"),s.Literal("background_processing"),s.Literal("all_clear")]),NM=s.Union([s.Literal("governance.exp.reason.owner_identity_missing"),s.Literal("governance.exp.reason.owner_identity_invalid"),s.Literal("governance.exp.reason.owner_authentication_missing"),s.Literal("governance.exp.reason.approval_pending"),s.Literal("governance.exp.reason.rulecode_owner_decision"),s.Literal("governance.exp.reason.no_pending_decision"),s.Literal("governance.exp.reason.owner_decision_available"),s.Literal("governance.exp.reason.break_glass_entry"),s.Literal("governance.exp.reason.recovery_required"),s.Literal("governance.exp.reason.source_unavailable"),s.Literal("governance.exp.reason.config_invalid"),s.Literal("governance.exp.reason.processing"),s.Literal("governance.exp.reason.workspace_clear"),s.Literal("governance.exp.reason.workspace_empty")]),DM=s.Union([s.Literal("governance.exp.next.configure_owner"),s.Literal("governance.exp.next.authenticate_console"),s.Literal("governance.exp.next.review_approvals"),s.Literal("governance.exp.next.inspect_recovery"),s.Literal("governance.exp.next.inspect_sources"),s.Literal("governance.exp.next.fix_config"),s.Literal("governance.exp.next.monitor"),s.Literal("governance.exp.next.none")]),qV=s.Union([s.Literal("production"),s.Literal("development"),s.Literal("demo"),s.Literal("test")]),$M=s.Object({environment:s.Union([qV,s.Literal("unknown")]),source:s.Union([s.Literal("workspace_config"),s.Literal("missing")]),configIssue:s.Optional(vu)},{additionalProperties:!1}),jV=s.Object({sourceId:s.Union([s.Literal("state_db"),s.Literal("principle_ledger")]),available:s.Boolean(),reasonCode:s.Optional(vu)},{additionalProperties:!1}),GV=s.Object({source:s.Union([s.Literal("approval"),s.Literal("task"),s.Literal("artifact"),s.Literal("principle"),s.Literal("activation")]),reasonCode:vu,count:s.Integer({minimum:0}),sampleRefs:s.Array(Fi,{maxItems:10})},{additionalProperties:!1}),Pk=s.Object({authenticationMode:s.Union([s.Literal("authenticated"),s.Literal("no_auth")]),ownerIdentityConfiguration:s.Union([s.Literal("configured"),s.Literal("missing"),s.Literal("invalid")])},{additionalProperties:!1}),BV=s.Object({view:Ok,lineageConfidence:Jm},{additionalProperties:!1}),KV=s.Object({sourceId:s.Literal("state_db"),activeTaskCount:s.Integer({minimum:0}),sampleRefs:s.Array(Fi,{maxItems:10})},{additionalProperties:!1}),HV=s.Object({schemaVersion:s.Literal("1"),asOf:WV,workspaceHash:vu,governanceViews:s.Array(BV),ownerConfigSnapshot:Pk,environmentContext:$M,sourceAvailability:s.Array(jV),dataQualityInputs:s.Array(GV),frontierEvidence:s.Optional(KV),rulecodeDecisionEvidence:s.Optional(s.Object({pendingCount:s.Integer({minimum:0}),sampleRefs:s.Array(Fi,{maxItems:10})},{additionalProperties:!1}))},{additionalProperties:!1}),VV=s.Union([s.Literal("principle_approval"),s.Literal("rulecode_owner_decision"),s.Literal("emergency_pause")]),zV=s.Union([s.Literal("operator_legacy"),s.Literal("configured_owner"),s.Literal("break_glass")]),JV=s.Object({kind:VV,observedAuthority:zV,status:s.Union([s.Literal("entry_conditions_met"),s.Literal("blocked")]),reasonCode:NM,nextActionCode:DM},{additionalProperties:!1}),YV=s.Object({authenticationMode:Pk.properties.authenticationMode,ownerIdentityConfiguration:Pk.properties.ownerIdentityConfiguration,governanceActions:s.Array(JV,{minItems:3,maxItems:3})},{additionalProperties:!1}),FM=s.Union([s.Literal("blocked"),s.Literal("needs_recovery"),s.Literal("needs_decision"),s.Literal("processing")]),XV=s.Object({principleId:s.Optional(vu),category:FM,reasonCode:vu,sourceRefs:s.Array(Fi,{maxItems:10})},{additionalProperties:!1}),QV=s.Object({category:FM,count:s.Integer({minimum:0}),items:s.Array(XV,{maxItems:10}),hasMore:s.Boolean()},{additionalProperties:!1}),ZV=s.Object({primaryAttention:MM,categories:s.Array(QV)},{additionalProperties:!1}),ez=s.Object({confidence:Jm,strongViewCount:s.Integer({minimum:0}),weakViewCount:s.Integer({minimum:0}),unknownViewCount:s.Integer({minimum:0})},{additionalProperties:!1}),tz=s.Object({environmentContext:$M,lineageTransparency:ez},{additionalProperties:!1}),nz=s.Object({source:s.Union([s.Literal("ledger"),s.Literal("artifact"),s.Literal("task"),s.Literal("approval"),s.Literal("activation"),s.Literal("trajectory"),s.Literal("lineage"),s.Literal("workspace")]),reasonCode:vu,nextActionCode:vu,count:s.Integer({minimum:1}),sampleRefs:s.Array(Fi,{maxItems:3})},{additionalProperties:!1}),rz=s.Object({degraded:s.Boolean(),issueGroups:s.Array(nz,{maxItems:10}),hasMore:s.Boolean()},{additionalProperties:!1}),iz=s.Object({primaryAttention:MM,headlineCode:vu,reasonCode:NM,nextActionCode:DM},{additionalProperties:!1}),oz=s.Object({schemaVersion:s.Literal("1"),snapshotId:vu,asOf:WV,summary:iz,readiness:YV,activity:ZV,trustContext:tz,dataQuality:rz},{additionalProperties:!1});var az="1";var sz=32,Ym=s.Union([s.Boolean(),s.Null()]),E2e=s.Object({schemaVersion:s.Literal(az),dailyTelemetryId:s.String(),bucketDate:s.String(),pdVersion:s.String({maxLength:sz}),hostKind:s.Union([s.Literal("openclaw"),s.Literal("codex"),s.Literal("other")]),milestones:s.Object({initialized:Ym,painObserved:Ym,principleObserved:Ym,activationObserved:Ym,presenceReceiptObserved:Ym,effectReceiptObserved:Ym}),reliability:s.Object({initializationFailed:Ym}),consentVersion:s.String()});var Lc=s.Union([s.Literal("openclaw"),s.Literal("openclaw-cli"),s.Literal("openclaw-history"),s.Literal("claude-cli"),s.Literal("codex-cli"),s.Literal("gemini-cli"),s.Literal("local-worker"),s.Literal("test-double"),s.Literal("pi-ai"),s.Literal("pi-ai-l2")]),S2e=s.Object({supportsStructuredJsonOutput:s.Boolean(),supportsToolUse:s.Boolean(),supportsWorkingDirectory:s.Boolean(),supportsModelSelection:s.Boolean(),supportsLongRunningSessions:s.Boolean(),supportsCancellation:s.Boolean(),supportsArtifactWriteBack:s.Boolean(),supportsConcurrentRuns:s.Boolean(),supportsStreaming:s.Boolean(),capabilitiesValidUntil:s.Optional(s.String()),dynamicCapabilities:s.Optional(s.Object({toolsAvailable:s.Optional(s.Array(s.String())),modelOptions:s.Optional(s.Array(s.String()))}))}),A2e=s.Object({healthy:s.Boolean(),degraded:s.Boolean(),warnings:s.Array(s.String()),lastCheckedAt:s.String()}),R2e=s.Object({runId:s.String({minLength:1}),runtimeKind:Lc,startedAt:s.String()}),UM=s.Union([s.Literal("queued"),s.Literal("running"),s.Literal("succeeded"),s.Literal("failed"),s.Literal("timed_out"),s.Literal("cancelled")]),C2e=s.Object({runId:s.String({minLength:1}),status:UM,startedAt:s.Optional(s.String()),endedAt:s.Optional(s.String()),reason:s.Optional(s.String())}),cz=s.Object({runId:s.String({minLength:1}),runtimeKind:Lc,startedAt:s.String(),taskId:s.String({minLength:1}),attemptNumber:s.Integer({minimum:0}),executionStatus:UM,endedAt:s.Optional(s.String()),reason:s.Optional(s.String()),outputRef:s.Optional(s.String()),createdAt:s.String(),updatedAt:s.String(),inputPayload:s.Optional(s.String()),outputPayload:s.Optional(s.String()),errorCategory:s.Optional(zm)}),uz=s.Object({role:s.Union([s.Literal("user"),s.Literal("system"),s.Literal("tool")]),content:s.String()}),lz=s.Object({agentId:s.String({minLength:1}),schemaVersion:s.String({minLength:1})}),pz=s.Object({workflowId:s.String({minLength:1})}),dz=s.Object({taskId:s.String({minLength:1})}),O2e=s.Object({agentSpec:lz,workflowRef:s.Optional(pz),taskRef:s.Optional(dz),inputPayload:s.Unknown(),contextItems:s.Array(uz),outputSchemaRef:s.Optional(s.String()),artifactContractRef:s.Optional(s.String()),timeoutMs:s.Number({minimum:0}),idempotencyKey:s.Optional(s.String()),preferredModel:s.Optional(s.String()),preferredRuntimeProfile:s.Optional(s.String())}),P2e=s.Object({runId:s.String(),payload:s.Unknown()}),L2e=s.Object({artifactType:s.String(),ref:s.String()});var mz=s.Object({structuredJson:s.Boolean(),toolUse:s.Optional(s.Boolean()),workingDirectory:s.Optional(s.Boolean())}),fz=s.Object({defaultTimeoutMs:s.Number({minimum:0})}),hz=s.Object({maxAttempts:s.Integer({minimum:1})}),WM=s.Object({agentId:s.String({minLength:1}),role:s.String({minLength:1}),schemaVersion:s.String({minLength:1}),inputSchemaRef:s.String({minLength:1}),outputSchemaRef:s.String({minLength:1}),artifactContractRef:s.Optional(s.String()),timeoutPolicy:fz,retryPolicy:hz,capabilitiesRequired:mz,preferredRuntimeKinds:s.Optional(s.Array(Lc)),preferredModelProfile:s.Optional(s.String())});var gz=["pending","leased","succeeded","retry_wait","failed","needs_human_review"],yz=s.Union([...gz.map(e=>s.Literal(e))]);var qM=s.Object({taskId:s.String({minLength:1}),taskKind:s.String({minLength:1}),status:yz,createdAt:s.String(),updatedAt:s.String(),leaseOwner:s.Optional(s.String()),leaseExpiresAt:s.Optional(s.String()),attemptCount:s.Integer({minimum:0}),maxAttempts:s.Integer({minimum:1}),lastError:s.Optional(s.Union([zm,s.Null()])),inputRef:s.Optional(s.String()),resultRef:s.Optional(s.String()),diagnosticJson:s.Optional(s.String())}),M2e=s.Intersect([qM,s.Object({taskKind:s.Literal("diagnostician"),sourcePainId:s.Optional(s.String()),workspaceDir:s.String(),severity:s.Optional(s.String()),source:s.Optional(s.String()),sessionIdHint:s.Optional(s.String()),agentIdHint:s.Optional(s.String()),reasonSummary:s.String(),provenance:s.Optional(s.Union([s.Literal("host_context_bound"),s.Literal("owner_reported_no_host_trace"),s.Literal("automatic_hook"),s.Literal("openclaw_context_bound")])),hostKind:s.Optional(s.Union([s.Literal("openclaw"),s.Literal("codex")])),provenanceReason:s.Optional(s.String()),evidence:s.Optional(s.Array(s.Object({sourceRef:s.String({minLength:1}),note:s.String({minLength:1,maxLength:200})})))})]);var N2e=s.Object({agentSpec:WM,workspacePolicy:s.Optional(s.Object({allowedRuntimes:s.Optional(s.Array(Lc)),blockedRuntimes:s.Optional(s.Array(Lc))})),fallbackEnabled:s.Optional(s.Boolean())});var Lk=["tool_call","tool_result","assistant_message","user_message","system_event","unknown"],_z=s.Union(Lk.map(e=>s.Literal(e))),Mk=["task","run","artifact","event"],xz=s.Union(Mk.map(e=>s.Literal(e))),vz=s.Object({kind:xz,id:s.String({minLength:1})}),bz=s.Object({at:s.Union([s.String({minLength:1}),s.Null()]),kind:_z,summary:s.String({minLength:1}),rawPreview:s.Optional(s.String()),metadata:s.Optional(s.Record(s.String(),s.Unknown()))}),wz=s.Object({sourceTaskId:s.String({minLength:1}),sourcePainId:s.String({minLength:1}),sourceRunIds:s.Array(s.String({minLength:1})),capturedAt:s.String({minLength:1}),sourceRefs:s.Array(vz),timeline:s.Array(bz),ambiguityNotes:s.Array(s.String()),sanitizationNotes:s.Array(s.String())}),dDt=new Set(Lk),mDt=new Set(Mk);var Nk=s.Object({ts:s.String({minLength:1}),role:s.Union([s.Literal("user"),s.Literal("assistant"),s.Literal("tool"),s.Literal("system")]),text:s.Optional(s.String()),toolName:s.Optional(s.String()),toolResultSummary:s.Optional(s.String()),eventType:s.Optional(s.String())}),Ez=s.Object({painId:s.Optional(s.String({minLength:1})),taskId:s.Optional(s.String({minLength:1})),runId:s.Optional(s.String({minLength:1})),sessionId:s.Optional(s.String({minLength:1})),timeRange:s.Optional(s.Object({start:s.String({minLength:1}),end:s.String({minLength:1})})),workspace:s.Optional(s.String({minLength:1})),executionStatus:s.Optional(s.String({minLength:1}))}),Sz=s.Object({trajectoryRef:s.String({minLength:1}),confidence:s.Number({minimum:0,maximum:1}),reasons:s.Array(s.String({minLength:1})),sourceTypes:s.Optional(s.Array(s.String({minLength:1})))}),Az=s.Object({query:Ez,candidates:s.Array(Sz)}),Rz=s.Object({sourceRef:s.String({minLength:1}),entries:s.Array(Nk),truncated:s.Boolean(),nextCursor:s.Optional(s.String({minLength:1}))}),$2e=s.Object({sourceRef:s.String({minLength:1}),note:s.String({minLength:1,maxLength:200})}),GM=s.Object({reasonSummary:s.Optional(s.String()),source:s.Optional(s.String()),severity:s.Optional(s.String()),painId:s.Optional(s.String({minLength:1})),sessionIdHint:s.Optional(s.String({minLength:1})),provenance:s.Optional(s.Union([s.Literal("host_context_bound"),s.Literal("owner_reported_no_host_trace"),s.Literal("automatic_hook")])),hostKind:s.Optional(s.Union([s.Literal("openclaw"),s.Literal("codex")])),provenanceReason:s.Optional(s.String()),traceAvailability:s.Optional(s.Union([s.Literal("available"),s.Literal("unavailable_with_reason"),s.Literal("ambiguous")])),traceUnavailableDetail:s.Optional(s.Object({reason:s.String(),nextAction:s.String()})),evidence:s.Optional(s.Array($2e))}),Cz=s.Object({toolName:s.Optional(s.String()),status:s.Optional(s.String()),params:s.Optional(s.String()),resultSummary:s.Optional(s.String()),errorSummary:s.Optional(s.String()),startedAt:s.Optional(s.String()),completedAt:s.Optional(s.String())}),Oz=s.Object({painId:s.Optional(s.String({minLength:1})),severity:s.Optional(s.String()),source:s.Optional(s.String()),reasonSummary:s.Optional(s.String()),sessionIdHint:s.Optional(s.String())}),Pz=s.Object({painContext:Oz,scratchpad:s.Array(s.String()),toolCallHistory:s.Array(Cz)});var F2e=s.Object({contextId:s.String({minLength:1}),sourceRefs:s.Array(s.String({minLength:1})),targetAgent:s.Optional(s.String({minLength:1})),diagnosisTarget:s.Optional(GM),conversationWindow:s.Array(Nk),artifactRefs:s.Optional(s.Array(s.String({minLength:1}))),ambiguityNotes:s.Optional(s.Array(s.String())),summary:s.String({minLength:1})}),Lz=s.Object({contextId:s.String({minLength:1}),contextHash:s.String({minLength:1}),taskId:s.String({minLength:1}),workspaceDir:s.String({minLength:1}),sourceRefs:s.Array(s.String({minLength:1})),diagnosisTarget:GM,conversationWindow:s.Array(Nk),ambiguityNotes:s.Optional(s.Array(s.String())),fullTrace:s.Optional(s.Union([Pz,wz,s.Null()]))});var U2e=s.Union([s.Literal("People"),s.Literal("Design"),s.Literal("Assumption"),s.Literal("Tooling")]),W2e=s.Object({why:s.Number({minimum:1,maximum:5}),statement:s.String({minLength:1}),evidenceRefs:s.Array(s.String({minLength:1}),{minItems:1})}),q2e=s.Object({sourceRef:s.String({minLength:1}),note:s.String({minLength:1})}),Mz=s.Union([s.Literal("none"),s.Literal("action_drift"),s.Literal("intent_suspect"),s.Literal("healthy_tension")]),Nz=s.Union([s.Literal("weak"),s.Literal("moderate"),s.Literal("strong")]),Dz=s.Union([s.Literal("why"),s.Literal("desired_outcome"),s.Literal("non_negotiables"),s.Literal("stop_escalation"),s.Literal("current_strategic_focus")]),$z=s.Union([s.Literal("confirm_drift"),s.Literal("revise_intent"),s.Literal("observe"),s.Literal("dismiss"),s.Literal("promote_to_principle"),s.Literal("promote_to_rulehost")]);var Og=s.Object({source:Mz,evidenceStrength:Nz,relatedIntentFields:s.Array(Dz),evidence:s.Array(s.String(),{maxItems:3}),explanation:s.String({minLength:1}),suggestedOwnerAction:$z,intentDocHash:s.Optional(s.String())},{additionalProperties:!1}),Dk=s.Object({valid:s.Boolean(),diagnosisId:s.String({minLength:1}),taskId:s.String({minLength:1,description:"Lineage \u2014 re-injected if stripped; ERR-008"}),summary:s.String({minLength:1}),causalChain:s.Array(W2e),rootCause:s.String({minLength:1,description:'MUST include category prefix: "People: ..." or "Design: ..." or "Assumption: ..." or "Tooling: ..."'}),rootCauseCategory:U2e,evidence:s.Array(q2e),confidence:s.Number({minimum:0,maximum:1}),ambiguityNotes:s.Optional(s.Array(s.String())),intentTension:s.Optional(Og)});var Fz=s.Object({principleId:s.Optional(s.String({minLength:1})),title:s.Optional(s.String()),rationale:s.String({minLength:1})}),Uz=s.Object({sourceRef:s.String({minLength:1}),note:s.String({minLength:1})}),BM=s.Union([s.Literal("principle"),s.Literal("rule"),s.Literal("implementation"),s.Literal("prompt"),s.Literal("defer")]),Wz=s.Object({kind:BM,description:s.String({minLength:1}),triggerPattern:s.Optional(s.String({description:'Required when kind is "rule". Regex or keyword pattern for interception.'})),action:s.Optional(s.String({description:'Required when kind is "rule". Action to take when pattern matches.'})),abstractedPrinciple:s.Optional(s.String({description:'Required when kind is "principle". Highly abstracted, reusable wisdom (\u2264200 chars).'}))}),Xm=s.Object({valid:s.Boolean(),diagnosisId:s.String({minLength:1}),summary:s.String({minLength:1}),rootCause:s.String({minLength:1,description:'MUST include category prefix: "Design: ..." or "People: ..." or "Assumption: ..." or "Tooling: ..."'}),violatedPrinciples:s.Array(Fz),evidence:s.Array(Uz),recommendations:s.Array(Wz,{minItems:1}),confidence:s.Number({minimum:0,maximum:1,description:"A number between 0.0 and 1.0 (NOT a string, NOT a percentage)"}),ambiguityNotes:s.Optional(s.Array(s.String())),intentTension:s.Optional(Og)}),j2e=s.Object({agentId:s.String({minLength:1}),taskId:s.String({minLength:1}),context:s.Unknown(),outputSchemaRef:s.Literal("diagnostician-output-v1"),timeoutMs:s.Number({minimum:0})});var KM=["candidate","active","archived","deprecated","probation"],$k=s.Union([...KM.map(e=>s.Literal(e))]),Fk=s.Union([s.Literal("P0"),s.Literal("P1"),s.Literal("P2")]),Uk=s.Union([s.Literal("general"),s.Literal("domain"),s.Literal("scenario")]),Wk=s.Union([s.Literal("manual_only"),s.Literal("deterministic"),s.Literal("weak_heuristic")]),qk=s.Union([s.Literal("proposed"),s.Literal("implemented"),s.Literal("enforced"),s.Literal("retired")]),jk=s.Union([s.Literal("hook"),s.Literal("gate"),s.Literal("skill"),s.Literal("lora"),s.Literal("test"),s.Literal("prompt")]),Gk=s.Union([s.Literal("candidate"),s.Literal("active"),s.Literal("disabled"),s.Literal("archived")]),Bk=s.Union([s.Literal("code"),s.Literal("skill"),s.Literal("lora"),s.Literal("test"),s.Literal("prompt")]),qz=s.Union([s.Literal("pain-negative"),s.Literal("success-positive"),s.Literal("principle-anchor")]);var Kk=s.Object({id:s.String(),version:s.Number(),text:s.String(),coreAxiomId:s.Optional(s.String()),triggerPattern:s.String(),action:s.String(),status:$k,priority:Fk,scope:Uk,domain:s.Optional(s.String()),evaluability:Wk,valueScore:s.Number(),adherenceRate:s.Number(),painPreventedCount:s.Number(),lastPainPreventedAt:s.Optional(s.String()),derivedFromPainIds:s.Array(s.String()),ruleIds:s.Array(s.String()),conflictsWithPrincipleIds:s.Array(s.String()),supersedesPrincipleId:s.Optional(s.String()),createdAt:s.String(),updatedAt:s.String(),deprecatedAt:s.Optional(s.String()),deprecatedReason:s.Optional(s.String()),compilationRetryCount:s.Optional(s.Number())}),Hk=s.Object({id:s.String(),version:s.Number(),name:s.String(),description:s.String(),type:jk,triggerCondition:s.String(),enforcement:s.Union([s.Literal("block"),s.Literal("warn"),s.Literal("log")]),action:s.String(),principleId:s.String(),parentRuleId:s.Optional(s.String()),status:qk,coverageRate:s.Number(),falsePositiveRate:s.Number(),implementationPath:s.Optional(s.String()),testPath:s.Optional(s.String()),createdAt:s.String(),updatedAt:s.String()}),Vk=s.Object({id:s.String(),ruleId:s.String(),type:Bk,path:s.String(),version:s.String(),coversCondition:s.String(),coveragePercentage:s.Number(),lifecycleState:Gk,previousActive:s.Optional(s.String()),disabledAt:s.Optional(s.String()),disabledBy:s.Optional(s.String()),disabledReason:s.Optional(s.String()),archivedAt:s.Optional(s.String()),createdAt:s.String(),updatedAt:s.String()});var jz=s.Object({principleId:s.String(),dependsOn:s.Array(s.String()),conflictedWith:s.Array(s.String()),supersedes:s.Array(s.String())});var zk=s.Object({principleId:s.String(),painPreventedCount:s.Number(),avgPainSeverityPrevented:s.Number(),lastPainPreventedAt:s.Optional(s.String()),totalOpportunities:s.Number(),adheredCount:s.Number(),violatedCount:s.Number(),implementationCost:s.Number(),benefitScore:s.Number(),calculatedAt:s.String()});var HM=s.Union([s.Literal("principle_created"),s.Literal("principle_updated"),s.Literal("principle_promoted"),s.Literal("principle_deprecated"),s.Literal("rule_created"),s.Literal("rule_enforced"),s.Literal("rule_retired"),s.Literal("implementation_added"),s.Literal("value_metrics_updated")]),Gz=s.Object({ts:s.String(),type:HM,data:s.Object({principleId:s.Optional(s.String()),ruleId:s.Optional(s.String()),implementationId:s.Optional(s.String()),reason:s.String(),metrics:s.Optional(s.Record(s.String(),s.Any()))})});var Bz=s.Object({principles:s.Record(s.String(),Kk),rules:s.Record(s.String(),Hk),implementations:s.Record(s.String(),Vk),metrics:s.Record(s.String(),zk),lastUpdated:s.String()});var Kz=s.Object({ts:s.String(),tool:s.String(),path:s.String(),type:s.Union([s.Literal("memory"),s.Literal("plan"),s.Literal("other")]),contentLength:s.Number()}),Hz=s.Object({date:s.String(),persistenceCount:s.Number(),persistenceByFile:s.Record(s.String(),s.Number()),lastPersistenceTime:s.Optional(s.String()),totalCharsPersisted:s.Number(),groomingExecutedCount:s.Number(),lastGroomingTime:s.Optional(s.String())});var Vz=s.Object({queueState:s.Object({total:s.Number(),pending:s.Number(),inProgress:s.Number(),completed:s.Number(),lastUpdated:s.String()}),activeSessions:s.Array(s.String())}),Jk=s.Object({successRateChange:s.Number(),toolCallVolumeChange:s.Number(),painSignalRateChange:s.Number()}),zz=s.Object({trajectoryData:s.Object({totalTasks:s.Number(),successRate:s.Number(),timeoutRate:s.Number(),lastUpdated:s.String()}),dailyStats:s.Object({toolCalls:s.Number(),painSignals:s.Number(),evolutionTasks:s.Number(),lastUpdated:s.String()}),trends:s.Object({sevenDay:Jk,thirtyDay:Jk})});var VM=s.Union([s.Literal("tool_call"),s.Literal("pain_signal"),s.Literal("rule_promotion"),s.Literal("governance_action"),s.Literal("hook_execution"),s.Literal("gate_block"),s.Literal("gate_bypass"),s.Literal("evolution_task"),s.Literal("empathy_rollback"),s.Literal("error"),s.Literal("warn"),s.Literal("diagnosis_task"),s.Literal("heartbeat_diagnosis"),s.Literal("diagnostician_report"),s.Literal("principle_candidate"),s.Literal("rule_enforced"),s.Literal("rulehost_evaluated"),s.Literal("rulehost_blocked"),s.Literal("rulehost_requireApproval"),s.Literal("rulehost_auto_correct_proposed"),s.Literal("rulehost_auto_correct_applied"),s.Literal("runtime_v2_prompt_activations_injected"),s.Literal("rulehost_unhealthy"),s.Literal("rulehost_skipped")]),ea=s.Union([s.Literal("success"),s.Literal("failure"),s.Literal("detected"),s.Literal("blocked"),s.Literal("bypassed"),s.Literal("approved"),s.Literal("enqueued"),s.Literal("completed"),s.Literal("promoted"),s.Literal("passed"),s.Literal("changed"),s.Literal("rolled_back"),s.Literal("written"),s.Literal("injected"),s.Literal("created"),s.Literal("matched"),s.Literal("evaluated"),s.Literal("requireApproval"),s.Literal("auto_correct")]),Jz=s.Object({ts:s.String(),date:s.String(),type:VM,category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),Yz=s.Object({toolName:s.String(),filePath:s.Optional(s.String()),error:s.Optional(s.String()),errorType:s.Optional(s.String()),gfi:s.Optional(s.Number()),consecutiveErrors:s.Optional(s.Number()),exitCode:s.Optional(s.Number()),gfiBefore:s.Optional(s.Number()),gfiAfter:s.Optional(s.Number())}),Xz=s.Object({score:s.Number(),source:s.String(),eventId:s.Optional(s.String()),reason:s.Optional(s.String()),isRisky:s.Optional(s.Boolean()),origin:s.Optional(s.Union([s.Literal("assistant_self_report"),s.Literal("user_manual"),s.Literal("system_infer")])),severity:s.Optional(s.Union([s.Literal("mild"),s.Literal("moderate"),s.Literal("severe")])),confidence:s.Optional(s.Number()),detection_mode:s.Optional(s.Union([s.Literal("structured"),s.Literal("legacy_tag")])),deduped:s.Optional(s.Boolean()),trigger_text_excerpt:s.Optional(s.String()),raw_score:s.Optional(s.Number()),calibrated_score:s.Optional(s.Number())}),Qz=s.Object({fingerprint:s.String(),ruleId:s.String(),phrase:s.String(),sampleCount:s.Number(),avgSimilarity:s.Number()}),zM=s.Object({action:s.Union([s.Literal("deactivate"),s.Literal("promote"),s.Literal("global_pause")]),activationId:s.Optional(s.String({minLength:1})),subject:s.Optional(s.Literal("all_live_rulecode")),actor:s.Union([s.Literal("owner"),s.Literal("cli"),s.Literal("session")]),reasonCode:s.String({minLength:1,maxLength:200}),outcome:s.Literal("authorized")}),Zz=s.Object({hook:s.String(),sessionId:s.Optional(s.String()),durationMs:s.Optional(s.Number()),error:s.Optional(s.String())}),e8=s.Object({toolName:s.String(),filePath:s.String(),reason:s.String(),blockSource:s.Optional(s.String())}),t8=s.Object({toolName:s.String(),filePath:s.String(),bypassType:s.Union([s.Literal("stage4_architect"),s.Literal("whitelisted")])}),n8=s.Object({taskId:s.String(),taskType:s.String(),reason:s.String()}),r8=s.Object({eventId:s.String(),originalScore:s.Number(),originalSessionId:s.Optional(s.String()),reason:s.String(),triggeredBy:s.Union([s.Literal("user_command"),s.Literal("natural_language"),s.Literal("system")])}),i8=s.Object({taskCount:s.Number(),taskIds:s.Array(s.String()),trigger:s.Union([s.Literal("heartbeat"),s.Literal("immediate")])}),o8=s.Object({taskId:s.String(),painEventId:s.Optional(s.String()),sessionId:s.Optional(s.String())}),a8=s.Object({taskId:s.String(),reportPath:s.String(),category:s.Union([s.Literal("success"),s.Literal("missing_json"),s.Literal("incomplete_fields")])}),s8=s.Object({principleId:s.String(),taskId:s.String(),source:s.Union([s.Literal("diagnostician"),s.Literal("manual")])}),c8=s.Object({ruleId:s.String(),principleId:s.String(),enforcement:s.Union([s.Literal("warn"),s.Literal("block"),s.Literal("requireApproval")]),toolName:s.String(),filePath:s.String()}),u8=s.Object({toolName:s.String(),filePath:s.String(),matched:s.Boolean(),decision:s.Union([s.Literal("allow"),s.Literal("block"),s.Literal("requireApproval"),s.Literal("auto_correct"),s.Literal("no_rules_armed"),s.Literal("evaluation_failed")]),ruleId:s.Optional(s.String()),activationId:s.Optional(s.String()),activationMode:s.Optional(s.Union([s.Literal("shadow"),s.Literal("live")]))}),l8=s.Object({toolName:s.String(),filePath:s.String(),reason:s.String(),ruleId:s.Optional(s.String())}),p8=s.Object({toolName:s.String(),filePath:s.String(),reason:s.String(),ruleId:s.Optional(s.String())}),d8=s.Object({toolName:s.String(),filePath:s.String(),ruleId:s.String(),principleId:s.Optional(s.String()),confidence:s.Number(),reason:s.String(),applicationMode:s.Union([s.Literal("shadow"),s.Literal("live")]),correctedFields:s.Array(s.String()),validationValid:s.Boolean()}),m8=s.Object({toolName:s.String(),filePath:s.String(),ruleId:s.String(),principleId:s.Optional(s.String()),confidence:s.Number(),reason:s.String(),correctedFields:s.Array(s.Object({field:s.String(),original:s.Unknown(),applied:s.Unknown()}))}),f8=s.Object({sessionId:s.String(),workspaceDir:s.String(),principleIds:s.Array(s.String()),activationIds:s.Array(s.String()),artifactIds:s.Array(s.String()),injectedCount:s.Number(),skippedWarnings:s.Array(s.String()),injectedCharCount:s.Number(),budget:s.Number(),skipReason:s.Optional(s.String()),nextAction:s.Optional(s.String()),legacySelectedCount:s.Optional(s.Number()),legacyTotalChars:s.Optional(s.Number()),legacyTruncated:s.Optional(s.Boolean()),v2Truncated:s.Optional(s.Boolean()),crossBlockDuplicateIds:s.Optional(s.Array(s.String()))}),h8=s.Object({activationId:s.String(),artifactId:s.String(),ruleId:s.String(),reason:s.String(),nextAction:s.String()}),g8=s.Object({activationId:s.String(),artifactId:s.String(),ruleId:s.String(),mode:s.Optional(s.Union([s.Literal("shadow"),s.Literal("live")])),reason:s.String(),nextAction:s.String()}),JM=s.Object({total:s.Number(),success:s.Number(),failure:s.Number(),byTool:s.Record(s.String(),s.Object({success:s.Number(),failure:s.Number()}))}),YM=s.Object({total:s.Number(),byType:s.Record(s.String(),s.Number()),byTool:s.Record(s.String(),s.Number())}),XM=s.Object({totalEvents:s.Number(),dedupedCount:s.Number(),dedupeHitRate:s.Number(),totalPenaltyScore:s.Number(),rolledBackScore:s.Number(),rollbackCount:s.Number(),bySeverity:s.Object({mild:s.Number(),moderate:s.Number(),severe:s.Number()}),scoreBySeverity:s.Object({mild:s.Number(),moderate:s.Number(),severe:s.Number()}),byDetectionMode:s.Object({structured:s.Number(),legacy_tag:s.Number()}),byOrigin:s.Object({assistant_self_report:s.Number(),user_manual:s.Number(),system_infer:s.Number()}),confidenceDistribution:s.Object({high:s.Number(),medium:s.Number(),low:s.Number()}),dailyTrend:s.Array(s.Object({date:s.String(),count:s.Number(),score:s.Number()}))}),QM=s.Object({peak:s.Number(),samples:s.Number(),total:s.Number(),resetCount:s.Number(),hourlyDistribution:s.Array(s.Number())}),ZM=s.Object({tasksEnqueued:s.Number(),tasksCompleted:s.Number(),rulesPromoted:s.Number(),diagnosisTasksWritten:s.Number(),heartbeatsInjected:s.Number(),diagnosticianReportsWritten:s.Number(),reportsMissingJson:s.Number(),reportsIncompleteFields:s.Number(),principleCandidatesCreated:s.Number(),rulesEnforced:s.Number(),rulehostEvaluated:s.Number(),rulehostBlocked:s.Number(),rulehostRequireApproval:s.Number(),rulehostAutoCorrectProposed:s.Number(),rulehostAutoCorrectApplied:s.Number()});var eN=s.Object({total:s.Number(),success:s.Number(),failure:s.Number(),byType:s.Record(s.String(),s.Object({total:s.Number(),success:s.Number(),failure:s.Number()})),errors:s.Number(),totalDurationMs:s.Number()}),y8=s.Object({date:s.String(),createdAt:s.String(),updatedAt:s.String(),tools:s.Object({total:s.Number(),success:s.Number(),failure:s.Number()}),toolCalls:JM,errors:YM,empathy:XM,gfi:QM,evolution:ZM,hooks:eN});var _8=s.Union([s.Object({ts:s.String(),date:s.String(),type:s.Literal("tool_call"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("pain_signal"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("rule_promotion"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("governance_action"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:zM}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("hook_execution"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("gate_block"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("gate_bypass"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("evolution_task"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("empathy_rollback"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("error"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("warn"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())})]);var tN=s.Union([s.Literal("low"),s.Literal("medium"),s.Literal("high"),s.Literal("critical")]),x8=s.Object({source:s.String({minLength:1}),score:s.Number({minimum:0,maximum:100}),timestamp:s.String({minLength:1}),reason:s.String({minLength:1}),sessionId:s.Optional(s.String()),agentId:s.Optional(s.String()),traceId:s.Optional(s.String()),triggerTextPreview:s.String(),version:s.Optional(s.String({default:"0.1.0"})),domain:s.String({default:"coding"}),severity:tN,context:s.Record(s.String(),s.Unknown())});var nN=s.Object({kind:s.Literal("every"),everyMs:s.Number({minimum:1e3})}),rN=s.Object({promptTemplate:s.String({minLength:1}),timeoutSeconds:s.Optional(s.Number({minimum:1})),lightContext:s.Optional(s.Boolean()),toolsAllow:s.Optional(s.Array(s.String({minLength:1})))}),iN=s.Object({mode:s.Union([s.Literal("none"),s.Literal("announce")]),channel:s.Optional(s.String({minLength:1})),to:s.Optional(s.String({minLength:1}))}),oN=s.Object({createdAtMs:s.Optional(s.Number({minimum:0})),lastSyncedAtMs:s.Optional(s.Number({minimum:0})),lastSyncedJobId:s.Optional(s.String({minLength:1})),lastSyncStatus:s.Optional(s.Union([s.Literal("ok"),s.Literal("error")])),lastSyncError:s.Optional(s.String({minLength:1})),consecutiveFailCount:s.Optional(s.Number({minimum:0})),lastFailedAtMs:s.Optional(s.Number({minimum:0})),autoDisabled:s.Optional(s.Boolean()),autoDisabledAt:s.Optional(s.Number({minimum:0})),autoDisabledReason:s.Optional(s.String({minLength:1})),lastTriggeredAtMs:s.Optional(s.Number({minimum:0})),lastTriggerStatus:s.Optional(s.Union([s.Literal("succeeded"),s.Literal("failed"),s.Literal("pending")]))}),v8=s.Object({id:s.String({minLength:1}),name:s.String({minLength:1}),description:s.String({minLength:1}),enabled:s.Boolean(),version:s.String({minLength:1}),schedule:nN,agentId:s.Optional(s.String({minLength:1})),execution:rN,delivery:iN,meta:s.Optional(oN)});var aN=s.Union([s.Literal("recorded-only"),s.Literal("evidence-only"),s.Literal("diagnosis-queued"),s.Literal("diagnosis-running"),s.Literal("diagnosis-succeeded"),s.Literal("diagnosis-failed"),s.Literal("diagnosis-retry-wait"),s.Literal("candidate-generated"),s.Literal("internalization-missing"),s.Literal("internalization-pending"),s.Literal("internalization-running"),s.Literal("internalization-failed"),s.Literal("internalization-succeeded"),s.Literal("owner-reviewable"),s.Literal("malformed"),s.Literal("degraded")]),sN=s.Object({id:s.String(),sourceKind:s.String(),observedAt:s.String(),state:aN,summary:s.String(),admissionDecision:s.Optional(s.String()),linkedPainId:s.Optional(s.String()),linkedTaskId:s.Optional(s.String()),linkedTaskStatus:s.Optional(s.String()),linkedCandidateId:s.Optional(s.String()),linkedPrincipleId:s.Optional(s.String()),failureReason:s.Optional(s.String()),degradedReason:s.Optional(s.String()),nextAction:s.Optional(s.String()),candidateTitle:s.Optional(s.String()),candidateSummary:s.Optional(s.String()),rootCauseSummary:s.Optional(s.String()),confidence:s.Optional(s.Number()),recommendationKind:s.Optional(s.String()),internalizationTaskId:s.Optional(s.String()),dreamerTaskStatus:s.Optional(s.String()),canonicalPainId:s.Optional(s.String()),runtimeTaskId:s.Optional(s.String()),linkMode:s.Optional(s.Union([s.Literal("canonical"),s.Literal("legacy")])),intentTension:s.Optional(Og)}),b8=s.Object({records:s.Array(sN),generatedAt:s.String(),degradedReason:s.Optional(s.String()),nextAction:s.Optional(s.String()),note:s.Optional(s.String())});var y$e=s.Object({candidateId:s.String({minLength:1}),workspaceDir:s.String({minLength:1})}),_$e=s.Object({candidateId:s.String(),artifactId:s.String(),ledgerRef:s.String(),status:s.Literal("consumed")}),x$e=s.Object({id:s.String(),title:s.String(),text:s.String(),triggerPattern:s.Optional(s.String()),action:s.Optional(s.String()),status:s.Literal("probation"),evaluability:s.Literal("weak_heuristic"),sourceRef:s.String(),artifactRef:s.Optional(s.String()),taskRef:s.Optional(s.String()),createdAt:s.String()});import q2t from"better-sqlite3";import*as uN from"path";import*as T8 from"os";var T$e=[/(^|[/\\])fake[/\\]/i,/(^|[/\\])mock[/\\]/i,/(^|[/\\])tmp[/\\]fake-/i],I$e=uN.join(T8.tmpdir(),".pd-test-quarantine");function I8(e){if(!e)return!1;let t=e.replace(/\\/g,"/");return T$e.some(n=>n.test(t))}function Yk(e){if(!e||!(process.env.NODE_ENV==="test"||!!process.env.VITEST)||!I8(e))return e;let n=e.replace(/[:*?"<>|]/g,"_").replace(/[/\\]/g,"_");for(;n.startsWith("_");)n=n.slice(1);for(;n.endsWith("_");)n=n.slice(0,-1);return uN.join(I$e,n)}wi();var O$e=1440*60*1e3;import{EventEmitter as U$e}from"events";var F$e=s.Union([s.Literal("pain_detected"),s.Literal("principle_candidate_created"),s.Literal("principle_promoted"),s.Literal("lease_acquired"),s.Literal("lease_released"),s.Literal("lease_renewed"),s.Literal("lease_expired"),s.Literal("task_retried"),s.Literal("task_failed"),s.Literal("task_succeeded"),s.Literal("run_started"),s.Literal("run_completed"),s.Literal("degradation_triggered"),s.Literal("diagnostician_task_leased"),s.Literal("diagnostician_context_built"),s.Literal("diagnostician_run_started"),s.Literal("diagnostician_run_failed"),s.Literal("diagnostician_output_invalid"),s.Literal("diagnostician_task_succeeded"),s.Literal("diagnostician_task_retried"),s.Literal("diagnostician_task_failed"),s.Literal("diagnostician_cancel_run_failed"),s.Literal("diagnostician_mark_succeeded_failed"),s.Literal("diag_router_invariant_override"),s.Literal("diagnostician_core_grounding_result"),s.Literal("diagnostician_artifact_committed"),s.Literal("diagnostician_artifact_commit_failed"),s.Literal("principle_candidate_registered"),s.Literal("runtime_adapter_selected"),s.Literal("runtime_invocation_started"),s.Literal("runtime_invocation_succeeded"),s.Literal("runtime_invocation_failed"),s.Literal("output_validation_succeeded"),s.Literal("output_validation_failed"),s.Literal("output_repair_attempted"),s.Literal("output_extraction_failed"),s.Literal("output_schema_invalid"),s.Literal("output_repair_exhausted"),s.Literal("output_path_chosen"),s.Literal("output_path_fallback"),s.Literal("dreamer_task_leased"),s.Literal("dreamer_context_built"),s.Literal("dreamer_run_started"),s.Literal("dreamer_run_failed"),s.Literal("dreamer_output_invalid"),s.Literal("dreamer_output_validated"),s.Literal("dreamer_task_succeeded"),s.Literal("dreamer_task_retried"),s.Literal("dreamer_task_failed"),s.Literal("dreamer_candidate_generated"),s.Literal("dreamer_cancel_run_failed"),s.Literal("dreamer_output_extraction_failed"),s.Literal("dreamer_mark_succeeded_failed"),s.Literal("dreamer_update_output_failed"),s.Literal("dreamer_context_partial"),s.Literal("dreamer_mark_failed_error"),s.Literal("dreamer_mark_retry_error"),s.Literal("philosopher_task_leased"),s.Literal("philosopher_context_built"),s.Literal("philosopher_run_started"),s.Literal("philosopher_run_failed"),s.Literal("philosopher_output_invalid"),s.Literal("philosopher_output_validated"),s.Literal("philosopher_task_succeeded"),s.Literal("philosopher_task_retried"),s.Literal("philosopher_task_failed"),s.Literal("philosopher_principle_candidate_generated"),s.Literal("philosopher_cancel_run_failed"),s.Literal("philosopher_mark_succeeded_failed"),s.Literal("philosopher_update_output_failed"),s.Literal("philosopher_dependency_not_succeeded"),s.Literal("philosopher_lineage_resolve_failed"),s.Literal("philosopher_lineage_partial"),s.Literal("philosopher_artifact_write_failed"),s.Literal("philosopher_wrong_task_kind"),s.Literal("philosopher_output_extraction_failed"),s.Literal("philosopher_mark_failed_error"),s.Literal("philosopher_mark_retry_error"),s.Literal("artificer_task_leased"),s.Literal("artificer_context_built"),s.Literal("artificer_run_started"),s.Literal("artificer_run_failed"),s.Literal("artificer_output_invalid"),s.Literal("artificer_output_validated"),s.Literal("artificer_task_succeeded"),s.Literal("artificer_task_retried"),s.Literal("artificer_task_failed"),s.Literal("artificer_implementation_plan_generated"),s.Literal("artificer_cancel_run_failed"),s.Literal("artificer_mark_succeeded_failed"),s.Literal("artificer_update_output_failed"),s.Literal("artificer_dependency_not_succeeded"),s.Literal("artificer_lineage_resolve_failed"),s.Literal("artificer_lineage_partial"),s.Literal("artificer_artifact_write_failed"),s.Literal("artificer_wrong_task_kind"),s.Literal("artificer_output_extraction_failed"),s.Literal("artificer_mark_failed_error"),s.Literal("artificer_mark_retry_error"),s.Literal("evaluator_task_leased"),s.Literal("evaluator_context_built"),s.Literal("evaluator_run_started"),s.Literal("evaluator_run_failed"),s.Literal("evaluator_output_invalid"),s.Literal("evaluator_output_validated"),s.Literal("evaluator_task_succeeded"),s.Literal("evaluator_task_retried"),s.Literal("evaluator_task_failed"),s.Literal("evaluator_cancel_run_failed"),s.Literal("evaluator_mark_succeeded_failed"),s.Literal("evaluator_update_output_failed"),s.Literal("evaluator_dependency_not_succeeded"),s.Literal("evaluator_lineage_resolve_failed"),s.Literal("evaluator_lineage_partial"),s.Literal("evaluator_artifact_write_failed"),s.Literal("evaluator_wrong_task_kind"),s.Literal("evaluator_output_extraction_failed"),s.Literal("evaluator_mark_failed_error"),s.Literal("evaluator_mark_retry_error"),s.Literal("evaluator_decision_recorded"),s.Literal("scribe_task_leased"),s.Literal("scribe_context_built"),s.Literal("scribe_run_started"),s.Literal("scribe_run_failed"),s.Literal("scribe_output_invalid"),s.Literal("scribe_output_validated"),s.Literal("scribe_task_succeeded"),s.Literal("scribe_task_retried"),s.Literal("scribe_task_failed"),s.Literal("scribe_principle_draft_generated"),s.Literal("scribe_cancel_run_failed"),s.Literal("scribe_mark_succeeded_failed"),s.Literal("scribe_update_output_failed"),s.Literal("scribe_dependency_not_succeeded"),s.Literal("scribe_lineage_resolve_failed"),s.Literal("scribe_lineage_partial"),s.Literal("scribe_artifact_write_failed"),s.Literal("scribe_wrong_task_kind"),s.Literal("scribe_output_extraction_failed"),s.Literal("scribe_mark_failed_error"),s.Literal("scribe_mark_retry_error"),s.Literal("dreamer_l2_turn"),s.Literal("dreamer_l2_complete"),s.Literal("dreamer_l2_fallback_to_l1"),s.Literal("artificer_l2_attempt"),s.Literal("artificer_l2_turn"),s.Literal("artificer_l2_complete"),s.Literal("evaluator_adversarial_replay"),s.Literal("evaluator_adversarial_replay_skipped"),s.Literal("evaluator_rule_assembled"),s.Literal("evaluator_rule_assembly_failed")]),A8=s.Object({eventType:F$e,traceId:s.String({minLength:1}),timestamp:s.String({minLength:1}),sessionId:s.String(),agentId:s.Optional(s.String()),payload:s.Record(s.String(),s.Unknown())});function R8(e){if(typeof e!="object"||e===null||Array.isArray(e))return{valid:!1,errors:["Input must be a non-null object"]};let t=e;if(typeof t.timestamp=="string"&&isNaN(Date.parse(t.timestamp)))return{valid:!1,errors:["timestamp must be a valid ISO 8601 date string"]};let n=[...Ag.Errors(A8,e)];return n.length>0?{valid:!1,errors:n.map(r=>`${r.path?`${r.path}: `:""}${r.message}`)}:{valid:!0,errors:[],event:Ag.Cast(A8,e)}}var Xk=class extends U$e{emitTelemetry(t){let n;try{let r=R8(t);!r.valid||!r.event?n=void 0:n=r.event}catch(r){let i={eventType:"degradation_triggered",traceId:t?.traceId?`fallback-${t.traceId}`:`fallback-${Date.now()}`,timestamp:new Date().toISOString(),sessionId:t?.sessionId??"",payload:{component:"StoreEventEmitter",trigger:"invalid_event",fallback:"dropped",severity:"warning",errors:[String(r)],originalEventType:t?.eventType??"unknown",originalTraceId:t?.traceId??"unknown"}};return this.emit("telemetry",i),this.emit(i.eventType,i),!0}if(!n){let r={eventType:"degradation_triggered",traceId:t?.traceId?`fallback-${t.traceId}`:`fallback-${Date.now()}`,timestamp:new Date().toISOString(),sessionId:t?.sessionId??"",payload:{component:"StoreEventEmitter",trigger:"invalid_event",fallback:"dropped",severity:"warning"}};return this.emit("telemetry",r),this.emit(r.eventType,r),!0}return this.emit("telemetry",n),this.emit(n.eventType,n),!0}onTelemetry(t){this.on("telemetry",t)}onEventType(t,n){this.on(t,n)}},Ml=new Xk;var hv;(function(e){e.Idle="idle",e.BuildingContext="building_context",e.CreatingRun="creating_run",e.Invoking="invoking",e.Polling="polling",e.FetchingOutput="fetching_output",e.Validating="validating",e.Committing="committing",e.Completed="completed",e.Failed="failed",e.RetryWaiting="retry_waiting"})(hv||(hv={}));wi();wi();var V$e=["taskId","sourcePainId","sourceTaskId","sourceRunIds","sourceArtifactId","sourceRefs"],MFt=new Set(V$e);var O8=s.Object({id:s.String({pattern:"^T-\\d{2}$"}),layer:s.Union([s.Literal("foundational"),s.Literal("operating")]),name:s.String({minLength:1}),nameZh:s.String({minLength:1}),statement:s.String({minLength:1}),statementZh:s.String({minLength:1})}),P8=[{id:"T-01",layer:"foundational",name:"Survey Before Acting",nameZh:"\u5148\u68B3\u7406\u518D\u884C\u52A8",statement:"Build a sufficient model of the relevant system before making consequential changes.",statementZh:"\u5728\u8FDB\u884C\u6709\u540E\u679C\u7684\u53D8\u66F4\u524D\uFF0C\u5148\u5EFA\u7ACB\u5BF9\u76F8\u5173\u7CFB\u7EDF\u8DB3\u591F\u51C6\u786E\u7684\u7406\u89E3\u3002"},{id:"T-02",layer:"foundational",name:"Intent & Constraints First",nameZh:"\u610F\u56FE\u4E0E\u7EA6\u675F\u4F18\u5148",statement:"Act toward the owner's actual intent; explicit goals, constraints, boundaries, and decisions override inferred preferences.",statementZh:"\u56F4\u7ED5 Owner \u7684\u771F\u5B9E\u610F\u56FE\u884C\u52A8\uFF1B\u660E\u786E\u8868\u8FBE\u7684\u76EE\u6807\u3001\u7EA6\u675F\u3001\u8FB9\u754C\u4E0E\u51B3\u7B56\u4F18\u5148\u4E8E\u6A21\u578B\u81EA\u884C\u63A8\u65AD\u7684\u504F\u597D\u3002"},{id:"T-03",layer:"foundational",name:"Evidence Over Assumption",nameZh:"\u8BC1\u636E\u4F18\u4E8E\u5047\u8BBE",statement:"Use observable evidence\u2014code, logs, outputs, and state\u2014before inferring causes or claiming results.",statementZh:"\u5728\u63A8\u65AD\u539F\u56E0\u6216\u5BA3\u79F0\u7ED3\u679C\u4E4B\u524D\uFF0C\u4F18\u5148\u4F7F\u7528\u53EF\u89C2\u5BDF\u7684\u4EE3\u7801\u3001\u65E5\u5FD7\u3001\u8F93\u51FA\u4E0E\u72B6\u6001\u4F5C\u4E3A\u8BC1\u636E\u3002"},{id:"T-04",layer:"foundational",name:"Reversible & Safe by Default",nameZh:"\u9ED8\u8BA4\u53EF\u9006\u4E14\u5B89\u5168",statement:"When uncertainty or downside is meaningful, prefer reversible actions and preserve hard safety boundaries.",statementZh:"\u5F53\u4E0D\u786E\u5B9A\u6027\u6216\u6F5C\u5728\u635F\u5931\u4E0D\u53EF\u5FFD\u7565\u65F6\uFF0C\u4F18\u5148\u9009\u62E9\u53EF\u9006\u884C\u52A8\uFF0C\u5E76\u4FDD\u6301\u4E0D\u53EF\u7A81\u7834\u7684\u5B89\u5168\u8FB9\u754C\u3002"},{id:"T-05",layer:"operating",name:"Safety Rails",nameZh:"\u5B89\u5168\u62A4\u680F",statement:"Translate hard constraints into explicit guardrails, checks, and forbidden transitions before execution.",statementZh:"\u5728\u6267\u884C\u524D\uFF0C\u628A\u4E0D\u53EF\u7A81\u7834\u7684\u7EA6\u675F\u8F6C\u5316\u4E3A\u660E\u786E\u7684\u62A4\u680F\u3001\u68C0\u67E5\u548C\u7981\u6B62\u72B6\u6001\u8F6C\u79FB\u3002"},{id:"T-06",layer:"foundational",name:"Minimal Sufficient Change",nameZh:"\u6700\u5C0F\u5145\u5206\u6539\u53D8",statement:"Choose the simplest intervention that satisfies the intent, and change no more state than necessary.",statementZh:"\u9009\u62E9\u80FD\u591F\u6EE1\u8DB3\u771F\u5B9E\u610F\u56FE\u7684\u6700\u7B80\u5355\u5E72\u9884\u65B9\u5F0F\uFF0C\u5E76\u4E14\u53EA\u6539\u53D8\u5FC5\u8981\u7684\u72B6\u6001\u3002"},{id:"T-07",layer:"operating",name:"Close the Loop",nameZh:"\u95ED\u73AF\u9A8C\u8BC1",statement:"After acting, observe the result and compare it with the intended outcome; execution is not success until verified.",statementZh:"\u884C\u52A8\u540E\u89C2\u5BDF\u5B9E\u9645\u7ED3\u679C\uFF0C\u5E76\u4E0E\u9884\u671F\u76EE\u6807\u8FDB\u884C\u6BD4\u8F83\uFF1B\u5B8C\u6210\u6267\u884C\u5E76\u4E0D\u7B49\u4E8E\u5DF2\u7ECF\u6210\u529F\u3002"},{id:"T-08",layer:"foundational",name:"Pain As Signal",nameZh:"\u75DB\u82E6\u5373\u4FE1\u53F7",statement:"Treat failures, corrections, and friction as feedback to improve future behavior rather than repeat the same mistake.",statementZh:"\u628A\u5931\u8D25\u3001\u7EA0\u6B63\u4E0E\u6469\u64E6\u89C6\u4E3A\u6539\u8FDB\u672A\u6765\u884C\u4E3A\u7684\u53CD\u9988\uFF0C\u800C\u4E0D\u662F\u53CD\u590D\u72AF\u540C\u6837\u7684\u9519\u8BEF\u3002"},{id:"T-09",layer:"operating",name:"Divide And Conquer",nameZh:"\u5206\u800C\u6CBB\u4E4B",statement:"Decompose complex work into independently understandable and verifiable parts when that reduces uncertainty or risk.",statementZh:"\u5F53\u62C6\u5206\u80FD\u591F\u964D\u4F4E\u4E0D\u786E\u5B9A\u6027\u6216\u98CE\u9669\u65F6\uFF0C\u5C06\u590D\u6742\u4EFB\u52A1\u5206\u89E3\u4E3A\u53EF\u72EC\u7ACB\u7406\u89E3\u548C\u9A8C\u8BC1\u7684\u90E8\u5206\u3002"},{id:"T-10",layer:"operating",name:"Memory Externalization",nameZh:"\u8BB0\u5FC6\u5916\u90E8\u5316",statement:"Persist important intermediate conclusions, decisions, and state outside transient context when continuity matters.",statementZh:"\u5F53\u8FDE\u7EED\u6027\u91CD\u8981\u65F6\uFF0C\u628A\u5173\u952E\u4E2D\u95F4\u7ED3\u8BBA\u3001\u51B3\u7B56\u4E0E\u72B6\u6001\u6301\u4E45\u5316\u5230\u77AC\u65F6\u4E0A\u4E0B\u6587\u4E4B\u5916\u3002"}],Qk=Object.freeze(P8.map(e=>Object.freeze({...e}))),L8=Object.freeze(P8.map(e=>e.id));go();var eE=[{id:"prompt",category:"core",enabled:!0,since:"2026-05-24",description:"Prompt injection for principle application"},{id:"code_tool_hook",category:"core",enabled:!0,since:"2026-05-24",description:"Code tool hook for rule host enforcement"},{id:"rulecode_safety_controls",category:"core",enabled:!0,since:"2026-08-21",description:"Durable RuleCode safety isolation authority. Default ON; emergency enforcement shutdown remains the code_tool_hook core flag."},{id:"rulecode_owner_live_decision",category:"core",enabled:!0,since:"2026-08-21",description:"Owner-reviewed RuleCode shadow-to-live decision authority. Default ON after the readiness, authenticated Console, CLI, audit, and rollback rollout gates passed; flag-off refuses promotion."},{id:"defer_archive",category:"core",enabled:!0,since:"2026-05-24",description:"Defer/archive activation writer"},{id:"correction_observer",category:"quiet",enabled:!1,since:"2026-06-02",description:"Optional LLM optimization service for correction keywords; synchronous correction detection remains active independently"},{id:"signal_collector",category:"quiet",enabled:!1,since:"2026-06-30",description:"Unified signal collection host (correction + empathy upstream merge). NOTE: keyword detection (high-precision phrases) runs regardless of this flag; this flag only gates the LLM deep-judgment path (ambiguous terms / missed keywords). Quiet flag: dogfood-only until validated."},{id:"internalization_auto_consumer",category:"quiet",enabled:!0,since:"2026-06-13",description:"Bounded auto-consumer for dreamer internalization tasks \u2014 prevents ready tasks from pending forever (PRI-381; quiet flag, default on, disableable via config)"},{id:"internalization_full_chain",category:"core",enabled:!0,since:"2026-08-12",description:"PRI-419 amendment: auto-consumer advances dreamer\u2192\u2026\u2192evaluator\u2192rollout_reviewer (full chain) so artifacts reach validated and the approval queue is populated unattended. The human gate is the approval queue (Console), not the rollout_reviewer CLI trigger. Default ON; flag-off = dreamer-only."},{id:"story_a_approval_completion",category:"quiet",enabled:!0,since:"2026-06-18",description:"Story A approval-completion orchestrator (PRI-408) \u2014 formal service replacing demo direct-writer activation; quiet flag, default on, disableable via config"},{id:"feedback_channel",category:"quiet",enabled:!0,since:"2026-06-01",description:"MVP seed feedback channel \u2014 privacy-preserving report drafts. PRI-543: flag scope extended to also cover the feedback SUBMIT ladder (ingest relay / gh CLI / mailto / export-file channels + submit endpoints). Flag-off = submit endpoints 403 + submit UI hidden; config `feedback:` segment and channel parameters still available."},{id:"release_manager_shadow",category:"quiet",enabled:!1,since:"2026-08-25",description:"ReleaseManager shadow mode \u2014 read-only signed-metadata update checks with legacy-updater comparison diagnostics; no activation"},{id:"gfi",category:"quiet",enabled:!1,since:"2026-05-24",description:"Global Friction Index session scoring"},{id:"evolution_worker",category:"quiet",enabled:!1,since:"2026-06-01",description:"Legacy evolution worker heartbeat (MVP-Quiet per ADR-0014 \xA72.5)"},{id:"empathy_observer",category:"quiet",enabled:!1,since:"2026-06-02",description:"Empathy observer service for sentiment checking (MVP-Quiet)"},{id:"painEvidenceAdmission",category:"quiet",enabled:!0,since:"2026-06-06",description:"Pre-diagnosis evidence triage for pain signals (PEAT-B1). PRI-454: default-on, Gate B is primary gate."},{id:"painEvidenceAdmissionDefault",category:"quiet",enabled:!0,since:"2026-06-24",description:"PRI-454: Global kill switch for Gate B migration. When ON (default), Gate B (TriggerController) owns admission. When OFF (rollback), Gate A (PainDiagnosticGate) is re-activated."},{id:"diagnostician_async_cli",category:"quiet",enabled:!1,since:"2026-06-11",description:"Async pain-record CLI \u2014 submit and return immediately, diagnosis runs in background. Default: false until orchestrator exists."},{id:"diagnostician_core_grounding",category:"quiet",enabled:!0,since:"2026-06-11",description:"Core principle grounding in diagnostician prompt (Arm 2)"},{id:"internalization_core_grounding",category:"quiet",enabled:!0,since:"2026-06-16",description:"Core principle grounding in internalization prompt builders (dreamer, philosopher, scribe)"},{id:"diagnostician_split_pipeline",category:"quiet",enabled:!0,since:"2026-06-11",description:"3-stage split diagnostician pipeline (RootCause\u2192Distiller\u2192Router)"},{id:"diagnostician_llm_degradation",category:"quiet",enabled:!0,since:"2026-07-03",description:"Diagnostician LLM rate-limit graceful degradation \u2014 on persistent rate-limit, emit diag_llm_rate_limit_degraded telemetry + rate_limit errorCategory instead of max_attempts_exceeded (ADR-0019). Default ON (graduated PRI-571, 2026-08-24); flag-off = hard fail (legacy behavior)."},{id:"l2_dreamer",category:"quiet",enabled:!1,since:"2026-06-16",description:"L2 multi-turn agent loop for the dreamer runner (PRI-419) \u2014 read-only tools + submit_output, scoped to dreamer only"},{id:"code_rule_capability",category:"core",enabled:!0,since:"2026-06-18",description:"Code-rule capability (atomic: ArtificerL2 + Evaluator) for RuleHost pipeline \u2014 MVP-Core, default ON (PRI-435)"},{id:"intent_engineering",category:"quiet",enabled:!1,since:"2026-06-25",description:"INTENT.md-grounded constructive friction and Stage-A intent tension diagnosis (PRI-465). Default off; flag-off = no INTENT read, no prompt injection, no intentTension."},{id:"rulecode_context_v2",category:"quiet",enabled:!1,since:"2026-06-27",description:"RuleContext v2 \u2014 rule-code context vision (PRI-479). Foundation flag; default off, v1 rule behavior unchanged. See docs/superpowers/specs/2026-06-27-rulecode-context-vision-design.md"},{id:"failed_tasks_observability",category:"quiet",enabled:!0,since:"2026-07-04",description:"Failed tasks observability \u2014 list/view failed pipeline tasks"},{id:"evaluator_artificer_repair_loop",category:"quiet",enabled:!0,since:"2026-07-04",description:"PRI-509/P0-D: Evaluator\u2192Artificer repair loop \u2014 auto-seed artificer repair on needs_revision (2-round cap \u2192 needs_human_review). Default ON (INV-02 liveness); production-wired in auto-consumer since 2026-08-18."},{id:"artificer_output_retry",category:"quiet",enabled:!0,since:"2026-08-20",description:"Issue 2/PRI-621: retry Artificer `output_invalid` (malformed LLM output, e.g. missed submit_rulecode) via the base retry policy (max 3 attempts) instead of permanent failure. Graduated default-on 2026-08-29 \u2014 aligns artificer with every other peer runner; flag-off reverts output_invalid to permanent (legacy)."},{id:"artifact_summary_redundancy",category:"quiet",enabled:!1,since:"2026-07-26",description:"Internalization progressive disclosure Layer 0 \u2014 writer-side ArtifactSummary + predecessorSummary envelope on all 8 SummaryRunnerKind stages. Default off; flag-off = current contentJson shape unchanged."},{id:"context_manifest_budget",category:"quiet",enabled:!1,since:"2026-07-26",description:"Internalization progressive disclosure Layer 1 \u2014 manifest + budget-driven context injection with information-floor fallback. Default off; flag-off = existing buildContext assembly unchanged."},{id:"progressive_evaluator",category:"quiet",enabled:!1,since:"2026-07-26",description:"Internalization progressive disclosure Layer 2 \u2014 two-stage evaluation with flagged criteria + painCoverage/compressionFidelity output fields. Default off; flag-off = single-stage evaluation unchanged."},{id:"host.codex",category:"core",enabled:!0,since:"2026-08-11",description:"ADR-0020: Codex CLI host adapter. Default ON (flipped 2026-08-12 after PRI-282 E2E). Flag-off = pd-hook.js outputs {} + exit 0 + SystemLogger records skip (rc-9). Disable via .pd/config.yaml: host.codex: { enabled: false }."},{id:"abstraction_layer_v1",category:"quiet",enabled:!1,since:"2026-08-13",description:"PRI-523 shared host-runtime cutover for OpenClaw. Default OFF preserves the legacy route; enable only for controlled parity validation."},{id:"principle_receipt_block_copy",category:"quiet",enabled:!0,since:"2026-08-15",description:"Principle Receipt P0 \u2014 enriched RuleHost block copy with principle attribution (title/approval date/source summary, PRI-530). Default ON (graduated PRI-571, 2026-08-24); flag-off = generic block template unchanged."},{id:"principle_receipt_ledger",category:"quiet",enabled:!0,since:"2026-08-15",description:"Principle Receipt ledger \u2014 durable principle_applications history (effect/presence two-level semantics, PRI-531). Default ON (graduated PRI-571, 2026-08-24); flag-off = no ledger writes."},{id:"principle_receipt_self_report",category:"quiet",enabled:!1,since:"2026-08-16",description:"Principle Receipt P1-a \u2014 agent self-report \u{1F4CC} line (injection instruction + capture, PRI-532). Default off; flag-off = directive template unchanged, no capture."},{id:"principle_governance_projection_v2",category:"quiet",enabled:!0,since:"2026-08-20",description:"Read-only per-principle Owner governance projection (PRI-549). Default ON (graduated PRI-571, 2026-08-24); flag-off preserves the pre-projection Principle Detail experience."},{id:"failed_task_recovery_console",category:"quiet",enabled:!0,since:"2026-08-23",description:"Governance Recovery Actions v1 \u2014 Owner-triggered recovery of failed / needs_human_review tasks from Console (failed\u2192pending via RecoverySweepService; needs_human_review\u2192pending via owner authority reset). Default on (2026-08-24 owner decision); flag-off = Console read-only."},{id:"pain_diagnosis_persistence",category:"quiet",enabled:!1,since:"2026-08-23",description:"Persist diagnostician root-cause attribution to pain_diagnoses (state.db, keyed by canonical pain_id) + Evidence First attribution rules in the Stage A prompt. Default off; flag-off = no writes, prompt byte-identical."},{id:"governance_experience_v1",category:"quiet",enabled:!0,since:"2026-08-24",description:"Governance Experience Snapshot v1.5.1 \u2014 read-only workspace governance experience (batch projection + GET /api/v1/governance/experience + Console Focus integration). Default on (graduated 2026-08-29); flag-off via config = endpoint 403 (no DB access) and legacy Focus behavior preserved."},{id:"anonymous_product_telemetry",category:"quiet",enabled:!1,since:"2026-08-26",description:"Anonymous Product Telemetry v1 \u2014 opt-in daily boolean-milestone snapshot (initialized/pain/principle/activation/receipt presence+effect), daily unlinkable IDs, zero content collection. Default off; export also requires explicit consent (pd telemetry enable) + production eligibility."},{id:"codex_conversation_ingestion",category:"quiet",enabled:!1,since:"2026-08-29",description:"Codex Governance Closure Slice A \u2014 bounded governance-observation ingestion from the authenticated Codex Stop-hook transcript (visible user/assistant/tool facts only, \u226432 turns/\u22647 days operational window, promotion substrate). Default off; flag-off = zero transcript reads, no observation writes, existing Codex behavior unchanged."},{id:"nocturnal",category:"gone",enabled:!1,since:"2026-05-24",description:"Nocturnal trinity pipeline (retired)"},{id:"idle_trigger",category:"gone",enabled:!1,since:"2026-05-24",description:"Idle trigger for background processing (retired)"},{id:"new_user_onboarding",category:"core",enabled:!0,since:"2026-07-01",description:"New user onboarding wizard \u2014 first-visit redirect to /welcome + demo story-a trigger endpoint. Maintainer-approved MVP-Core (2026-07-01): default-on; emergency disable via .pd/config.yaml: new_user_onboarding: { enabled: false }."}];var yv={};for(let e of eE)yv[e.id]={category:e.category,enabled:e.enabled};var fN={betterDecision:"required",rationale:"required",riskLevel:"required",badDecision:"optional",strategicPerspective:"excluded"},bUt=Object.entries(fN).filter(([,e])=>e==="required").map(([e])=>e),D8=["badDecision","betterDecision","rationale","riskLevel","strategicPerspective"];var xv=1;var IUt=D8.filter(e=>fN[e]!=="excluded");wi();var tFe=s.Union([s.Literal("general"),s.Literal("domain"),s.Literal("scenario")]),gN=s.Object({valid:s.Boolean(),taskId:s.String({minLength:1}),sourceRootCauseArtifactId:s.String({minLength:1,description:"Lineage consistency check \u2014 must match the artifact ID from Stage A"}),abstractedPrinciple:s.String({minLength:1,maxLength:200,description:"Highly abstracted, cross-scenario principle (\u2264200 chars)"}),rationale:s.String({minLength:1,description:"Why this principle addresses the root cause"}),groundedOnCorePrincipleIds:s.Array(s.String({minLength:1}),{description:"Subset of T-01..T-10. Validated against registry \u2014 fabricated IDs cause validation failure."}),scope:tFe,confidence:s.Number({minimum:0,maximum:1}),ambiguityNotes:s.Optional(s.Array(s.String()))});go();wi();go();var nFe=s.Object({candidateIndex:s.Number(),badDecision:s.String({minLength:1}),betterDecision:s.String({minLength:1}),rationale:s.String({minLength:1}),confidence:s.Number({minimum:0,maximum:1}),riskLevel:s.Union([s.Literal("low"),s.Literal("medium"),s.Literal("high")]),strategicPerspective:s.String({minLength:1})}),rFe=s.Object({valid:s.Boolean(),taskId:s.String({minLength:1}),candidates:s.Array(nFe,{minItems:1,maxItems:5}),sourcePrincipleId:s.Optional(s.String()),sourcePainId:s.Optional(s.String()),contextRefs:s.Array(s.String()),generatedAt:s.String({minLength:1}),reason:s.Optional(s.String())});var iFe=s.Object({title:s.String({minLength:1}),rationale:s.String({minLength:1}),scope:s.String({minLength:1}),confidence:s.Number({minimum:0,maximum:1})}),oFe=s.Object({taskId:s.String({minLength:1}),sourceDreamerArtifactId:s.String({minLength:1}),thesis:s.String({minLength:1}),principleCandidate:iFe,risks:s.Array(s.String()),generatedAt:s.String({minLength:1})});var aFe=s.Object({title:s.String({minLength:1}),statement:s.String({minLength:1}),rationale:s.String({minLength:1}),applicability:s.Array(s.String()),antiPatterns:s.Array(s.String()),confidence:s.Number({minimum:0,maximum:1})}),sFe=s.Object({dreamerArtifactId:s.Optional(s.String()),philosopherArtifactId:s.String({minLength:1})}),cFe=s.Object({taskId:s.String({minLength:1}),sourcePhilosopherArtifactId:s.String({minLength:1}),principleDraft:aFe,sourceTrace:sFe,risks:s.Array(s.String()),generatedAt:s.String({minLength:1})});var U8={read:"read",read_file:"read",read_many_files:"read",grep:"search",grep_search:"search",search_file_content:"search",glob:"search",write:"write",write_file:"write",edit:"write",edit_file:"write",replace:"write",apply_patch:"write",bash:"execute",exec:"execute",execute:"execute",run_shell_command:"execute",sessions_spawn:"agent"};function rE(e){if(typeof e!="string"||!Object.hasOwn(U8,e))return"other";let t=U8[e];return t!==void 0?t:"other"}function iE(e,t,n){if(e.status==="unavailable")return{priorReadOfTarget:"unknown",readCount:null,writeCount:null,uniqueWritePathCount:null,sameActionBlockCount:null};let r=0,i=0,o=new Set,a=t===null?"unknown":"no",{calls:c}=e;for(let u of c){let l=u.canonicalKind;l==="read"||l==="search"?(r++,t!==null&&u.normalizedPath===t&&(a="yes")):l==="write"&&(i++,typeof u.normalizedPath=="string"&&o.add(u.normalizedPath))}return{priorReadOfTarget:a,readCount:r,writeCount:i,uniqueWritePathCount:o.size,sameActionBlockCount:n}}var W8={priorReadOfTarget:"unknown",readCount:null,writeCount:null,uniqueWritePathCount:null,sameActionBlockCount:null};Object.freeze(W8);var yN={status:"unavailable",unavailableReason:"host did not provide a history window",truncated:!1,calls:[]};Object.freeze(yN.calls);Object.freeze(yN);var uFe={version:2,history:yN,facts:W8};Object.freeze(uFe);var q8=s.Object({scribeArtifactId:s.String({minLength:1}),philosopherArtifactId:s.Optional(s.String({minLength:1})),dreamerArtifactId:s.Optional(s.String({minLength:1}))}),j8=s.Object({taskId:s.String({minLength:1}),sourceScribeArtifactId:s.String({minLength:1}),implementationCode:s.String({minLength:1}),goldenTraceCases:s.Array(s.Object({caseId:s.String({minLength:1}),kind:s.Union([s.Literal("positive"),s.Literal("negative")]),toolName:s.String({minLength:1}),params:s.Record(s.String(),s.Unknown()),expectedDecision:s.Union([s.Literal("allow"),s.Literal("block"),s.Literal("propose_correction")]),expectedProposedParams:s.Optional(s.Record(s.String(),s.Unknown())),expectedApplicationMode:s.Optional(s.Union([s.Literal("shadow"),s.Literal("live")]))}),{minItems:2,maxItems:10}),affectedTools:s.Array(s.String({minLength:1}),{minItems:1}),implementationSummary:s.String({minLength:1}),risks:s.Array(s.String()),sourceTrace:q8,generatedAt:s.String({minLength:1}),requiresContextVersion:s.Optional(s.Literal(2)),evidenceRefs:s.Optional(s.Array(s.String({minLength:1})))});var lFe=s.Object({id:s.String({minLength:1}),status:s.Union([s.Literal("resolved"),s.Literal("still_open"),s.Literal("regressed")])}),pFe=s.Object({id:s.String({minLength:1}),statement:s.String({minLength:1}),status:s.Union([s.Literal("resolved"),s.Literal("still_open"),s.Literal("regressed")])}),G8=s.Object({decision:s.Union([s.Literal("approved"),s.Literal("needs_revision"),s.Literal("rejected")]),summary:s.String({minLength:1}),score:s.Number({minimum:0,maximum:1}),strengths:s.Array(s.String()),concerns:s.Array(s.String()),requiredChanges:s.Array(s.String()),priorRequirementStatuses:s.Optional(s.Array(lFe)),requirementLedger:s.Optional(s.Array(pFe))}),B8=s.Object({artificerArtifactId:s.String({minLength:1}),scribeArtifactId:s.Optional(s.String()),philosopherArtifactId:s.Optional(s.String()),dreamerArtifactId:s.Optional(s.String())}),K8=s.Object({taskId:s.String({minLength:1}),sourceArtificerArtifactId:s.String({minLength:1}),evaluation:G8,sourceTrace:B8,risks:s.Array(s.String()),generatedAt:s.String({minLength:1})});var H8=s.Object({decision:s.Union([s.Literal("approve_rollout"),s.Literal("needs_revision"),s.Literal("reject")]),summary:s.String({minLength:1}),confidence:s.Number({minimum:0,maximum:1}),requiredChanges:s.Array(s.String()),rolloutRisks:s.Array(s.String()),safetyChecks:s.Array(s.String())}),V8=s.Object({evaluatorArtifactId:s.String({minLength:1}),artificerArtifactId:s.Optional(s.String()),scribeArtifactId:s.Optional(s.String()),philosopherArtifactId:s.Optional(s.String()),dreamerArtifactId:s.Optional(s.String())}),z8=s.Object({taskId:s.String({minLength:1}),sourceEvaluatorArtifactId:s.String({minLength:1}),review:H8,sourceTrace:V8,risks:s.Array(s.String()),generatedAt:s.String({minLength:1})});var dFe=s.Object({userMessage:s.String({minLength:1})}),J8=s.Object({damageDetected:s.Boolean(),severity:s.Union([s.Literal("mild"),s.Literal("moderate"),s.Literal("severe")]),confidence:s.Number({minimum:0,maximum:1}),reason:s.String()});var mFe=s.Object({parentSessionId:s.String(),workspaceDir:s.String(),keywordStoreSummary:s.Object({totalKeywords:s.Number(),terms:s.Array(s.Object({term:s.String(),weight:s.Number(),hitCount:s.Number(),truePositiveCount:s.Number(),falsePositiveCount:s.Number()}))}),recentMessages:s.Array(s.String()),trajectoryHistory:s.Array(s.Object({sessionId:s.String(),timestamp:s.String(),term:s.String(),userMessage:s.String()}))}),Y8=s.Object({updated:s.Boolean(),updates:s.Optional(s.Record(s.String(),s.Object({action:s.Union([s.Literal("add"),s.Literal("update"),s.Literal("remove")]),weight:s.Optional(s.Number()),falsePositiveRate:s.Optional(s.Number()),reasoning:s.String()}))),fpTerms:s.Optional(s.Array(s.String())),fpAnalysisStatus:s.Optional(s.Union([s.Literal("completed"),s.Literal("skipped")])),summary:s.String()});var X8=s.Object({is_feedback:s.Boolean(),type:s.Union([s.Literal("correction"),s.Literal("empathy"),s.Literal("none")]),confidence:s.Number({minimum:0,maximum:1}),reason:s.String()});Ns();var ei=()=>Ti(()=>Promise.resolve().then(()=>(PJ(),OJ)));Ns();var WS=()=>Ti(()=>Promise.resolve().then(()=>(rX(),nX)));Ns();var Jqe=function(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,r,i,o,a){return r?t?".jsx":".js":i&&(!o||!a)?n:i+o+"."+a.toLowerCase()+"js"}):e},Yqe=e=>{let t=import.meta.url.endsWith(".js")?e.replace(/\.ts$/,".js"):e;return import(Jqe(t))},Xqe;var qS=()=>Ti(async()=>Xqe??await Yqe("./bedrock-converse-stream.ts"));Ns();var P0=()=>Ti(()=>Promise.resolve().then(()=>(Nre(),Mre)));Ns();var bC=()=>Ti(()=>Promise.resolve().then(()=>(Wre(),Ure)));Ns();var wC=()=>Ti(()=>Promise.resolve().then(()=>(Xre(),Yre)));Ns();var EC=()=>Ti(()=>Promise.resolve().then(()=>(Eie(),kie)));Ns();var gt=()=>Ti(()=>Promise.resolve().then(()=>(Uie(),Fie)));Ns();var Da=()=>Ti(()=>Promise.resolve().then(()=>(Kie(),Bie)));Ns();var SC=()=>Ti(()=>Promise.resolve().then(()=>(Xie(),Yie)));var JQe=function(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,r,i,o,a){return r?t?".jsx":".js":i&&(!o||!a)?n:i+o+"."+a.toLowerCase()+"js"}):e},YQe=null,XQe=null,QQe=null,t3=e=>import(JQe(e)),ZQe="node:fs",eZe="node:os",tZe="node:path";typeof process<"u"&&(process.versions?.node||process.versions?.bun)&&(t3(ZQe).then(e=>{YQe=e.existsSync}),t3(eZe).then(e=>{XQe=e.homedir}),t3(tZe).then(e=>{QQe=e.join}));var n3="ANTHROPIC_AUTH_TOKEN",Qie="ANTHROPIC_OAUTH_TOKEN",Zie="ANTHROPIC_API_KEY";var nZe=new Map;function rZe(e,t){return(n,r,i)=>{if(n.api!==e)throw new Error(`Mismatched api: ${n.api} expected ${e}`);return t(n,r,i)}}function eoe(e,t){nZe.set(e.api,{provider:{api:e.api,generateImages:rZe(e.api,e.generateImages)},sourceId:t})}var roe;function cZe(e,t){return{api:e.api,provider:e.provider,model:e.id,output:[],stopReason:"error",errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}function uZe(){return roe||=Promise.resolve().then(()=>(noe(),toe)).then(e=>e),roe}var lZe=async(e,t,n)=>{try{return await(await uZe()).generateImages(e,t,n)}catch(r){return cZe(e,r)}};function pZe(){eoe({api:"openrouter-images",generateImages:lZe})}pZe();var B={};On(B,{Assign:()=>dZe,Clone:()=>dw,Create:()=>xet,Discard:()=>vet,Metrics:()=>ru,Update:()=>bet});var ru={assign:0,create:0,clone:0,discard:0,update:0};function dZe(e,t){return ru.assign+=1,{...e,...t}}var R={};On(R,{Entries:()=>LZe,EntriesRegExp:()=>PZe,Every:()=>RZe,EveryAll:()=>CZe,GraphemeCount:()=>EZe,HasPropertyKey:()=>OZe,IsArray:()=>lw,IsBigInt:()=>uw,IsBoolean:()=>doe,IsClassInstance:()=>IZe,IsConstructor:()=>_Ze,IsDeepEqual:()=>a3,IsEqual:()=>cn,IsFunction:()=>moe,IsGreaterEqualThan:()=>hoe,IsGreaterThan:()=>bZe,IsInteger:()=>i3,IsLessEqualThan:()=>foe,IsLessThan:()=>wZe,IsMaxLength:()=>SZe,IsMinLength:()=>AZe,IsMultipleOf:()=>TZe,IsNull:()=>CC,IsNumber:()=>OC,IsObject:()=>pw,IsObjectNotArray:()=>xZe,IsString:()=>PC,IsSymbol:()=>vZe,IsUndefined:()=>o3,IsUnsafePropertyKey:()=>goe,IsValueLike:()=>kZe,Keys:()=>RC,ShiftLeft:()=>LC,Symbols:()=>MZe,Values:()=>NZe});function sh(e,t,n){return e>=t&&e<=n}function mZe(e){return e===8205}function fZe(e){return sh(e,55296,56319)}function ioe(e){return sh(e,127462,127487)}function aoe(e){return sh(e,65024,65039)}function soe(e){return sh(e,768,879)||sh(e,6832,6911)||sh(e,7616,7679)||sh(e,65056,65071)}function AC(e){return e>65535?2:1}function ooe(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(soe(n)||aoe(n))t+=AC(n);else break}return t}function r3(e,t){let n=e.codePointAt(t),r=t+AC(n);for(r=ooe(e,r);r<e.length-1&&e[r]==="\u200D";){let i=e.codePointAt(r+1);r+=1+AC(i),r=ooe(e,r)}return ioe(n)&&r<e.length&&ioe(e.codePointAt(r))&&(r+=AC(e.codePointAt(r))),r}function coe(e){return fZe(e)||soe(e)||aoe(e)||mZe(e)}function uoe(e){let t=0,n=0;for(;n<e.length;)n=r3(e,n),t++;return t}function hZe(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=r3(e,r),n++,n>=t)return!0;return!1}function gZe(e,t){let n=0,r=0;for(;r<e.length;)if(r=r3(e,r),n++,n>t)return!1;return!0}function loe(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(coe(e.charCodeAt(n)))return hZe(e,t);if(n++,n>=t)return!0}return!1}function poe(e,t){let n=0;for(;n<e.length;){if(coe(e.charCodeAt(n)))return gZe(e,t);if(n++,n>t)return!1}return!0}function lw(e){return Array.isArray(e)}function uw(e){return cn(typeof e,"bigint")}function doe(e){return cn(typeof e,"boolean")}function _Ze(e){if(o3(e)||!moe(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function moe(e){return cn(typeof e,"function")}function i3(e){return Number.isInteger(e)}function CC(e){return cn(e,null)}function OC(e){return Number.isFinite(e)}function xZe(e){return pw(e)&&!lw(e)}function pw(e){return cn(typeof e,"object")&&!CC(e)}function PC(e){return cn(typeof e,"string")}function vZe(e){return cn(typeof e,"symbol")}function o3(e){return cn(e,void 0)}function cn(e,t){return e===t}function bZe(e,t){return e>t}function wZe(e,t){return e<t}function foe(e,t){return e<=t}function hoe(e,t){return e>=t}function TZe(e,t){if(uw(e)||uw(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!OC(e)||i3(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 IZe(e){if(!pw(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return CC(t)?!1:cn(typeof t.constructor,"function")&&!(cn(t.constructor,globalThis.Object)||cn(t.constructor.name,"Object"))}function kZe(e){return uw(e)||doe(e)||CC(e)||OC(e)||PC(e)||o3(e)}function EZe(e){return uoe(e)}function SZe(e,t){return poe(e,t)}function AZe(e,t){return loe(e,t)}function RZe(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function CZe(e,t,n){let r=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(r=!1);return r}function LC(e,t,n){return cn(e.length,0)?n():t(e[0],e.slice(1))}function goe(e){return cn(e,"__proto__")||cn(e,"constructor")||cn(e,"prototype")}function OZe(e,t){return goe(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function PZe(e){return RC(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function LZe(e){return Object.entries(e)}function RC(e){return Object.getOwnPropertyNames(e)}function MZe(e){return Object.getOwnPropertySymbols(e)}function NZe(e){return Object.values(e)}function DZe(e,t){if(!pw(t))return!1;let n=RC(e);return cn(n.length,RC(t).length)&&n.every(r=>a3(e[r],t[r]))}function $Ze(e,t){return lw(t)&&cn(e.length,t.length)&&e.every((n,r)=>a3(e[r],t[r]))}function a3(e,t){return lw(e)?$Ze(e,t):pw(e)?DZe(e,t):cn(e,t)}var zd={};On(zd,{IsBigInt64Array:()=>QZe,IsBigUint64Array:()=>ZZe,IsBoolean:()=>UZe,IsDate:()=>tet,IsFloat32Array:()=>YZe,IsFloat64Array:()=>XZe,IsInt16Array:()=>HZe,IsInt32Array:()=>zZe,IsInt8Array:()=>GZe,IsMap:()=>ret,IsNumber:()=>WZe,IsRegExp:()=>eet,IsSet:()=>net,IsString:()=>qZe,IsTypeArray:()=>jZe,IsUint16Array:()=>VZe,IsUint32Array:()=>JZe,IsUint8Array:()=>BZe,IsUint8ClampedArray:()=>KZe});function UZe(e){return e instanceof Boolean}function WZe(e){return e instanceof Number}function qZe(e){return e instanceof String}function jZe(e){return globalThis.ArrayBuffer.isView(e)}function GZe(e){return e instanceof globalThis.Int8Array}function BZe(e){return e instanceof globalThis.Uint8Array}function KZe(e){return e instanceof globalThis.Uint8ClampedArray}function HZe(e){return e instanceof globalThis.Int16Array}function VZe(e){return e instanceof globalThis.Uint16Array}function zZe(e){return e instanceof globalThis.Int32Array}function JZe(e){return e instanceof globalThis.Uint32Array}function YZe(e){return e instanceof globalThis.Float32Array}function XZe(e){return e instanceof globalThis.Float64Array}function QZe(e){return e instanceof globalThis.BigInt64Array}function ZZe(e){return e instanceof globalThis.BigUint64Array}function eet(e){return e instanceof globalThis.RegExp}function tet(e){return e instanceof globalThis.Date}function net(e){return e instanceof globalThis.Set}function ret(e){return e instanceof globalThis.Map}function oet(e){return R.HasPropertyKey(e,"~kind")||R.HasPropertyKey(e,"~unsafe")}function aet(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let r of Object.keys(n)){if(R.IsUnsafePropertyKey(r))continue;let i=n[r];R.HasPropertyKey(i,"value")&&Object.defineProperty(t,r,{...i,value:ch(i.value)})}return t}function set(e){let t={};for(let n of R.Keys(e))R.IsUnsafePropertyKey(n)||(t[n]=ch(e[n]));for(let n of R.Symbols(e))t[n]=ch(e[n]);return t}function cet(e){return R.IsClassInstance(e)?e:oet(e)?aet(e):set(e)}function uet(e){return e.map(t=>ch(t))}function pet(e){return e.slice()}function det(e){return new RegExp(e.source,e.flags)}function met(e){return new Map(ch([...e.entries()]))}function fet(e){return new Set(ch([...e.values()]))}function ch(e){return zd.IsTypeArray(e)?pet(e):zd.IsRegExp(e)?det(e):zd.IsMap(e)?met(e):zd.IsSet(e)?fet(e):R.IsArray(e)?uet(e):R.IsObject(e)?cet(e):e}function dw(e){return ru.clone+=1,ch(e)}var uh={};On(uh,{Get:()=>yet,Reset:()=>het,Set:()=>get});var xp={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function het(){xp.immutableTypes=!1,xp.maxErrors=8,xp.useAcceleration=!0,xp.exactOptionalPropertyTypes=!1,xp.enumerableKind=!1,xp.correctiveParse=!1,xp.unionPrioritySort=!0}function get(e){for(let t of R.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(xp,t,{value:n})}}function yet(){return xp}function _et(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 yoe(e,t){return{...e,...t}}function xet(e,t,n={}){ru.create+=1;let r=uh.Get(),i=yoe(t,n),o=r.enumerableKind?yoe(i,e):_et(i,e);return r.immutableTypes?Object.freeze(o):o}function vet(e,t){ru.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(dw(e)),i=new Set(t);for(let o of Object.keys(r))i.has(o)||Object.defineProperty(n,o,r[o]);return n}function bet(e,t,n){ru.update+=1;let r=uh.Get(),i=dw(e);for(let o of Object.keys(t))Object.defineProperty(i,o,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[o]});for(let o of Object.keys(n))Object.defineProperty(i,o,{configurable:!0,enumerable:!0,writable:!0,value:n[o]});return i}function Qe(e,t){return R.IsObject(e)&&R.HasPropertyKey(e,"~kind")&&R.IsEqual(e["~kind"],t)}function fi(e){return R.IsObject(e)}function ot(e,t,n){return B.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function Jd(e){return Qe(e,"Deferred")}function wet(e){return B.Update(e,{"~readonly":!0},{})}function mw(e,t){return B.Update(wet(e),{},t)}function _oe(e,t,n,r){let i=Le(e,t,n);return mw(i,r)}function Tet(e){return B.Update(e,{"~optional":!0},{})}function fw(e,t){return B.Update(Tet(e),{},t)}function xoe(e,t,n,r){let i=Le(e,t,n);return fw(i,r)}function _s(e,t){return B.Create({"~kind":"Array"},{type:"array",items:e},t)}function mr(e){return Qe(e,"Array")}function MC(e){return B.Discard(e,["~kind","type","items"])}function ju(e,t,n={}){return B.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function Ri(e){return Qe(e,"Constructor")}function voe(e){return B.Discard(e,["~kind","type","parameters","instanceType"])}function Gu(e,t,n={}){return B.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function Ci(e){return Qe(e,"Function")}function boe(e){return B.Discard(e,["~kind","type","parameters","returnType"])}function vp(e,t){return B.Create({"~kind":"Ref"},{$ref:e},t)}function Oi(e){return Qe(e,"Ref")}function Yd(e,t){return B.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function M0(e){return Qe(e,"Generic")}function N0(e){return B.Create({"~kind":"Any"},{},e)}function ni(e){return Qe(e,"Any")}var woe="(?!)";function $n(e){return B.Create({"~kind":"Never"},{not:{}},e)}function Xd(e){return Qe(e,"Never")}function Bu(e,t={}){return ot("AddOptional",[e],t)}function lh(e,t={}){return fw(e,t)}function Toe(e){return lh(e)}function ko(e){return fi(e)&&R.HasPropertyKey(e,"~optional")}function Ioe(e){return R.Keys(e).filter(t=>!ko(e[t]))}function NC(e){return R.Keys(e)}function DC(e){return R.Values(e)}function Et(e,t={}){let n=Ioe(e),r=n.length>0?{required:n}:{};return B.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function _n(e){return Qe(e,"Object")}function koe(e){return B.Discard(e,["~kind","type","properties","required"])}function ji(e){return B.Create({"~kind":"Unknown"},{},e)}function hi(e){return Qe(e,"Unknown")}function Ku(e,t,n){let r=R.Keys(e).reduce((i,o)=>({...i,[o]:B.Update(e[o],{},{$id:o})}),{});return B.Create({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function oo(e){return Qe(e,"Cyclic")}function Eoe(e){return B.Update(e,{"~unsafe":null},{})}function $C(e){return R.IsObjectNotArray(e)&&R.HasPropertyKey(e,"~unsafe")&&R.IsNull(e["~unsafe"])}var Hu={};On(Hu,{Match:()=>Iet});function Iet(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function hw(...e){let[t,n]=Hu.Match(e,{2:(r,i)=>[r,i,i],1:r=>[r,ji(),ji()]});return B.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Hr(e){return Qe(e,"Infer")}function ph(e,t,n,r={}){return B.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function Fr(e){return Qe(e,"Dependent")}function Soe(e){return B.Discard(e,["~kind","if","then","else"])}function Aoe(e){return R.IsObjectNotArray(e)}function Roe(e){return R.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function Coe(e){return R.IsString(e)||R.IsNumber(e)}function Ooe(e,t){let n=Aoe(e)?Roe(e):e;return B.Create({"~kind":"Enum"},{enum:n},t)}function jo(e){return Qe(e,"Enum")}function Eo(e,t={}){return B.Create({"~kind":"Intersect"},{allOf:e},t)}function Yt(e){return Qe(e,"Intersect")}function Poe(e){return B.Discard(e,["~kind","allOf"])}function Vr(){throw new Error("Unreachable")}var Loe;(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"})(Loe||(Loe={}));var cin=BigInt("14695981039346656037"),[uin,lin]=[BigInt("1099511628211"),BigInt("18446744073709551616")],pin=Array.from({length:256}).map((e,t)=>BigInt(t)),Moe=new Float64Array(1),din=new DataView(Moe.buffer),min=new Uint8Array(Moe.buffer);var fin=new TextEncoder;var gw=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=FC(n)?a=>this.decode(n["~codec"].decode(a)):this.decode,i=FC(n)?a=>n["~codec"].encode(t(a)):t,o={decode:r,encode:i};return B.Update(this.type,{"~codec":o},{})}},yw=class{constructor(t){this.type=t}Decode(t){return new gw(this.type,t)}};function UC(e){return new yw(e)}function Doe(e,t){return UC(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function $oe(e,t){return UC(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function FC(e){return fi(e)&&R.HasPropertyKey(e,"~codec")&&R.IsObject(e["~codec"])&&R.HasPropertyKey(e["~codec"],"encode")&&R.HasPropertyKey(e["~codec"],"decode")}function Foe(e){return D0(e)}function dh(e){return fi(e)&&R.HasPropertyKey(e,"~immutable")}function Vu(e,t={}){return ot("AddReadonly",[e],t)}function mh(e,t={}){return mw(e,t)}function Uoe(e){return mh(e)}function fh(e){return fi(e)&&R.HasPropertyKey(e,"~readonly")}function Ret(e,t){let n=s3(e)?[...e["~refine"],t]:[t];return B.Update(e,{"~refine":n},{})}function Woe(...e){let[t,n,r]=Hu.Match(e,{3:(i,o,a)=>[i,o,a],2:(i,o)=>[i,o,()=>"Refine Error"]});return Ret(t,{check:n,error:r})}function Cet(e){return R.IsObjectNotArray(e)&&R.HasPropertyKey(e,"check")&&R.HasPropertyKey(e,"error")&&R.IsFunction(e.check)&&R.IsFunction(e.error)}function s3(e){return fi(e)&&R.HasPropertyKey(e,"~refine")&&R.IsArray(e["~refine"])&&R.Every(e["~refine"],0,t=>Cet(t))}var qoe="-?(?:0|[1-9][0-9]*)n";function _w(e){return B.Create({"~kind":"BigInt"},{type:"bigint"},e)}function zu(e){return Qe(e,"BigInt")}function WC(e){return B.Create({"~kind":"Boolean"},{type:"boolean"},e)}function nc(e){return Qe(e,"Boolean")}function xw(e){return B.Create({"~kind":"Identifier"},{name:e})}function joe(e){return Qe(e,"Identifier")}var qC="-?(?:0|[1-9][0-9]*)";function hh(e){return B.Create({"~kind":"Integer"},{type:"integer"},e)}function Go(e){return Qe(e,"Integer")}var c3=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function Oet(e){return R.IsBigInt(e)?"bigint":R.IsBoolean(e)?"boolean":R.IsNumber(e)?"number":R.IsString(e)?"string":(()=>{throw new c3(e)})()}function Xt(e,t){return B.Create({"~kind":"Literal"},{type:Oet(e),const:e},t)}function jC(e){return R.IsBigInt(e)||R.IsBoolean(e)||R.IsNumber(e)||R.IsString(e)}function Goe(e){return bn(e)&&R.IsNumber(e.const)}function Boe(e){return bn(e)&&R.IsString(e.const)}function bn(e){return Qe(e,"Literal")}function $0(e){return B.Create({"~kind":"Null"},{type:"null"},e)}function F0(e){return Qe(e,"Null")}var GC="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function $a(e){return B.Create({"~kind":"Number"},{type:"number"},e)}function ri(e){return Qe(e,"Number")}function U0(e){return B.Create({"~kind":"Symbol"},{type:"symbol"},e)}function Qd(e){return Qe(e,"Symbol")}function gh(...e){let[t,n,r]=Hu.Match(e,{3:(i,o,a)=>[i,o,a],2:(i,o)=>[i,o,o],1:i=>[i,ji(),ji()]});return B.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function Koe(e){return Qe(e,"Parameter")}var BC=".*";function rc(e){return B.Create({"~kind":"String"},{type:"string"},e)}function Bo(e){return Qe(e,"String")}function jt(e,t={}){return B.Create({"~kind":"Union"},{anyOf:e},t)}function nt(e){return Qe(e,"Union")}function Hoe(e){return B.Discard(e,["~kind","anyOf"])}function vw(e){let t=Voe(e);return R.IsEqual(t.length,2)?t[0]:[]}function Pet(e){return!0}function zoe(e){return R.ShiftLeft(e,(t,n)=>Let(t)?zoe(n):!1,()=>!0)}function Joe(e){return R.IsEqual(e.length,0)?!1:zoe(e)}function Let(e){return nt(e)?Joe(e.anyOf):bn(e)?Pet(e.const):!1}function KC(e){return Joe(e)}function HC(e){return B.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Yoe(e,t,n=[]){return R.ShiftLeft(e,(r,i)=>Yoe(i,t,[...n,`${r}${t}`]),()=>n)}function Met(e,t){return R.IsEqual(e.length,0)?[`${t}`]:Yoe(e,t)}function Xoe(e,t,n=[]){return R.ShiftLeft(t,(r,i)=>Xoe(e,i,[...n,...Qoe(e,r)]),()=>n)}function Qoe(e,t){return nt(t)?Xoe(e,t.anyOf):bn(t)?Met(e,t.const):Vr()}function Zoe(e,t){return R.ShiftLeft(t,(n,r)=>Zoe(Qoe(e,n),r),()=>e)}function Net(e){return e.map(t=>Xt(t))}function Det(e){let t=Zoe([],e),n=Net(t);return jt(n)}function $et(e){return R.IsEqual(e.length,0)?Vr():R.IsEqual(e.length,1)&&bn(e[0])?e[0]:Det(e)}function u3(e){let t=vw(e);return R.IsEqual(t.length,0)?rc():KC(t)?$et(t):HC(e)}function eae(e){let t=u3(e);return ii(t)?rc():t}function la(e,t){let n="object",r={[e]:t};return B.Create({"~kind":"Record"},{type:n,patternProperties:r})}function tae(e){return la(iu,e)}function nae(e){return Et({true:e,false:e})}function oi(e,t={}){let[n,r,i]=[e,e.length,!1];return B.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:r},t)}function Gn(e){return Qe(e,"Tuple")}function rae(e){return B.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Fet(e){return B.Discard(e,["~readonly"])}function l3(e,t){return B.Update(Fet(e),{},t)}function iae(e,t,n,r){let i=Le(e,t,n);return l3(i,r)}function oae(e,t={}){return ot("RemoveReadonly",[e],t)}function aae(e,t={}){return l3(e,t)}function Uet(e){return B.Discard(e,["~optional"])}function p3(e,t){return B.Update(Uet(e),{},t)}function sae(e,t,n,r){let i=Le(e,t,n);return p3(i,r)}function cae(e,t={}){return ot("RemoveOptional",[e],t)}function VC(e,t={}){return p3(e,t)}function d3(e){return e.reduceRight((n,r,i)=>({[i]:r,...n}),{})}function uae(e){let t=d3(e.items);return Et(t)}function Wet(e,t){return fh(e)?!!fh(t):!1}function qet(e,t){return ko(e)?!!ko(t):!1}function jet(e,t){let n=Wet(e,t),r=qet(e,t),i=Tr([e,t]),o=aae(VC(i));return n&&r?mh(lh(o)):n&&!r?mh(o):!n&&r?lh(o):o}function Get(e,t,n){return n in e?n in t?jet(e[n],t[n]):e[n]:n in t?t[n]:$n()}function Bet(e,t){return[...new Set([...R.Keys(t),...R.Keys(e)])].reduce((r,i)=>({...r,[i]:Get(e,t,i)}),{})}function lae(e){return _n(e)?e.properties:Gn(e)?d3(e.items):Vr()}function pae(e,t){let n=lae(e),r=lae(t),i=Bet(n,r);return Et(i)}function dae(e,t){let n=W0(e,t);return R.IsEqual(n,ww)?e:R.IsEqual(n,Tw)||R.IsEqual(n,bw)?t:$n()}function mae(e){return _n(e)||Gn(e)}function Ket(e,t){let n=nt(e),r=nt(t);return n||r}function Het(e,t){let n=ic(e),r=ic(t),i=Ket(n,r),o=mae(n),a=mae(r);return i?Tr([n,r]):o&&a?pae(n,r):o&&!a?n:!o&&a?r:dae(n,r)}function fae(e,t,n=[]){return R.ShiftLeft(t,(r,i)=>fae(e,i,[...n,Het(e,r)]),()=>R.IsEqual(n.length,0)?[e]:n)}function hae(e,t,n=[]){return R.ShiftLeft(e,(r,i)=>hae(i,t,[...n,...Iw([r],t)]),()=>n)}function Iw(e,t=[]){return R.ShiftLeft(e,(n,r)=>nt(n)?Iw(r,hae(n.anyOf,t)):Iw(r,fae(n,t)),()=>t)}function Vet(e,t){let n=ao({},e,t);return vt.IsExtendsTrueLike(n)?[]:[e]}function zet(e,t){return e.reduce((n,r)=>[...n,...Vet(r,t)],[])}function zC(e,t){let n=ic(e),r=nt(n)?n.anyOf:[n],i=zet(r,t);return Fa(i)}function ou(e,t,n){let r=Eo([e,t]),i=zC(n,e);return Fa([r,i])}function xs(e){let t=e.map(n=>Xt(n));return Fa(t)}function Tr(e){let t=Iw(e),n=m3(t);return bp(n)}function pa(e){let t=eae(e);return ic(t)}function Fa(e){let t=m3(e);return bp(t)}function ic(e){return Fr(e)?ou(e.if,e.then,e.else):jo(e)?xs(e.enum):Yt(e)?Tr(e.allOf):ii(e)?pa(e.pattern):nt(e)?Fa(e.anyOf):e}function bp(e){return R.IsEqual(e.length,1)?e[0]:R.IsEqual(e.length,0)?$n():jt(e)}function gae(e,t){let n=xs(e);return Zd(n,t)}function yae(e,t){return la(em,t)}function _ae(e,t){let n=Tr(e);return Zd(n,t)}function xae(e,t){return R.IsString(e)||R.IsNumber(e)?Et({[e]:t}):R.IsEqual(e,!1)?Et({false:t}):R.IsEqual(e,!0)?Et({true:t}):Et({})}function vae(e,t){return la(q0,t)}function bae(e,t){return R.HasPropertyKey(e,"pattern")&&(R.IsString(e.pattern)||e.pattern instanceof RegExp)?la(e.pattern.toString(),t):la(iu,t)}function wae(e,t){let n=vw(e);return KC(n)?Zd(pa(e),t):la(e,t)}function Jet(e){return nt(e)?kw(e.anyOf):[e]}function kw(e){return e.reduce((t,n)=>[...t,...Jet(n)],[])}function Yet(e){return e.some(t=>Bo(t)||ri(t)||Go(t))}function Xet(e,t){return R.IsEqual(Yet(e),!0)?la(iu,t):void 0}function Qet(e,t){return e.reduce((n,r)=>bn(r)&&(R.IsString(r.const)||R.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function Zet(e,t){let n=Qet(e,t);return Et(n)}function Tae(e,t){let n=kw(e),r=Xet(n,t);return fi(r)?r:Zet(n,t)}function Zd(e,t){return ni(e)?tae(t):nc(e)?nae(t):jo(e)?gae(e.enum,t):Go(e)?yae(e,t):Yt(e)?_ae(e.allOf,t):bn(e)?xae(e.const,t):ri(e)?vae(e,t):nt(e)?Tae(e.anyOf,t):Bo(e)?bae(e,t):ii(e)?wae(e.pattern,t):Et({})}function f3(e,t,n){return Dt([e])?B.Update(Zd(e,t),{},n):JC(e,t,n)}function Iae(e,t,n,r,i){let o=Le(e,t,n),a=Le(e,t,r);return f3(o,a,i)}var em=`^${qC}$`,q0=`^${GC}$`,iu=`^${BC}$`;function JC(e,t,n={}){return ot("Record",[e,t],n)}function YC(e,t,n={}){return f3(e,t,n)}function kae(e,t){return la(e,t)}function XC(e){return R.IsEqual(e,iu)?rc():R.IsEqual(e,em)?hh():R.IsEqual(e,q0)?$a():u3(e)}function oc(e){return R.Keys(e.patternProperties)[0]}function j0(e){let t=oc(e);return XC(t)}function Ko(e){return e.patternProperties[oc(e)]}function so(e){return Qe(e,"Record")}function yh(e){return B.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function tm(e){return Qe(e,"Rest")}function QC(e){return B.Create({"~kind":"This"},{$ref:"#"},e)}function ZC(e){return Qe(e,"This")}function G0(e){return B.Create({"~kind":"Undefined"},{type:"undefined"},e)}function B0(e){return Qe(e,"Undefined")}function eO(e){return B.Create({"~kind":"Void"},{type:"void"},e)}function Ju(e){return Qe(e,"Void")}function ttt(e,t){return R.IsEqual(e,"Array")?_s(t[0]):R.IsEqual(e,"Capitalize")?nO(t[0]):R.IsEqual(e,"ConstructorParameters")?sO(t[0]):R.IsEqual(e,"Evaluate")?Sce(t[0]):R.IsEqual(e,"Exclude")?cO(t[0],t[1]):R.IsEqual(e,"Extract")?uO(t[0],t[1]):R.IsEqual(e,"Index")?Rw(t[0],t[1]):R.IsEqual(e,"InstanceType")?lO(t[0]):R.IsEqual(e,"Lowercase")?rO(t[0]):R.IsEqual(e,"NonNullable")?pO(t[0]):R.IsEqual(e,"Omit")?dO(t[0],t[1]):R.IsEqual(e,"Parameters")?mO(t[0]):R.IsEqual(e,"Partial")?fO(t[0]):R.IsEqual(e,"Pick")?hO(t[0],t[1]):R.IsEqual(e,"Readonly")?gO(t[0]):R.IsEqual(e,"KeyOf")?Cw(t[0]):R.IsEqual(e,"Record")?JC(t[0],t[1]):R.IsEqual(e,"Required")?yO(t[0]):R.IsEqual(e,"ReturnType")?_O(t[0]):R.IsEqual(e,"Uncapitalize")?iO(t[0]):R.IsEqual(e,"Uppercase")?oO(t[0]):Aw(vp(e),t)}function _h(){throw Error("Unreachable")}var ntt=(e,t=[])=>e.reduce((n,r)=>R.IsArray(r)&&R.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),wp=e=>{let[t,n]=e;return ntt([...t,...n])};function Cae(e){return gh(e[0],e[2],e[4])}function Oae(e){return gh(e[0],e[2],e[2])}function Pae(e){return gh(e[0],ji(),e[2])}function Lae(e){return gh(e,ji(),ji())}function Mae(e){return wp(e)}function Nae(e){return e[1]}function Dae(e){return wp(e)}function $ae(e){return e[1]}function Fae(e){return ttt(e[0],e[1])}function Uae(e){return null}function Wae(e){return rc()}function qae(e){return $a()}function jae(e){return WC()}function Gae(e){return G0()}function Bae(e){return $0()}function Kae(e){return hh()}function Hae(e){return _w()}function Vae(e){return ji()}function zae(e){return N0()}function Jae(e){return Et({})}function Yae(e){return $n()}function Xae(e){return U0()}function Qae(e){return eO()}function Zae(e){return QC()}function ese(e){return Xt(BigInt(e))}function tse(e){return Xt(R.IsEqual(e,"true"))}function nse(e){return Xt(parseFloat(e))}function rse(e){return Xt(e)}function ise(e){return e[1]}function ose(e){return Xt(e)}function ase(e){return R.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function sse(e){return e[1]}function cse(e){return tO(e)}function use(e){return R.IsEqual(e.length,6)?ph(e[1],e[3],e[5]):ph(e[1],e[3],ji())}function lse(e){return e.length>0}function pse(e){return e.reduce((t,n)=>R.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function dse(e){return R.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function mse(e){return R.IsArray(e)&&R.IsEqual(e.length,3)?e[1]:e}function fse(e){return R.IsEqual(e.length,2)?e[1]:[]}function Eae(e,t){return t.reduce((n,r)=>{let i=r;return R.IsEqual(i.length,1)?Rw(n,i[0]):R.IsEqual(i.length,0)?_s(n):_h()},e)}function Sae(e,t){return R.IsEqual(t.length,3)?aO(e,t[0],t[1],t[2]):e}function rtt(e,t){return R.IsArray(t)&&R.IsEqual(t.length,0)?e:xO(e,t)}function hse(e){let[t,n,r,i,o]=e;return rtt(Sae(t?Cw(Eae(n,r)):Eae(n,r),i),o)}function h3(e,t){return R.IsEqual(t.length,3)?(()=>{let[n,r,i]=t,o=h3(r,i);if(R.IsEqual(n,"&"))return Yt(o)?Eo([e,...o.allOf]):Eo([e,o]);if(R.IsEqual(n,"|"))return nt(o)?jt([e,...o.anyOf]):jt([e,o]);_h()})():e}function gse(e){let[t,n]=e;return h3(t,n)}function yse(e){let[t,n]=e;return h3(t,n)}function _se(e){return Ece(e[1])}function xse(e){return e[1]}function vse(e){return Yd(e[0],e[2])}function bse(e){return R.IsEqual(e.length,4)?hw(e[1],e[3]):R.IsEqual(e.length,2)?hw(e[1],ji()):_h()}function wse(e){return`${e}`}function Tse(e){return Go(e[3])?em:ri(e[3])?q0:Qd(e[3])?iu:Bo(e[3])?iu:_h()}function Ise(e){return e.length>0}function kse(e){return e.length>0}function Ese(e){let[t,n,r,i,o]=e;return{[n]:t&&r?Vu(Bu(o)):t&&!r?Vu(o):!t&&r?Bu(o):o}}function Sse(e){return wp(e)}function Ase(e){return e.reduce((t,n)=>R.HasPropertyKey(n,em)||R.HasPropertyKey(n,q0)||R.HasPropertyKey(n,iu)?[t[0],B.Assign(t[1],n)]:[B.Assign(t[0],n),t[1]],[{},{}])}function Rse(e){return Ase(e[1])}function Cse(e){let[t,n]=e,r=R.IsEqual(R.Keys(n).length,0)?{}:{patternProperties:n};return Et(t,r)}function Ose(e){return R.IsEqual(e.length,5)?Vu(Bu(e[4])):R.IsEqual(e.length,3)?e[2]:R.IsEqual(e.length,4)?R.IsEqual(e[2],"readonly")?Vu(e[3]):Bu(e[3]):_h()}function Pse(e){return Vu(Bu(e[1]))}function Lse(e){return Vu(e[1])}function Mse(e){return Bu(e[0])}function Nse(e){return R.IsEqual(e.length,2)?yh(e[1]):R.IsEqual(e.length,1)?e[0]:_h()}function Dse(e){return wp(e)}function $se(e){return oi(e[1])}function Fse(e){return Vu(Bu(e[4]))}function Use(e){return Vu(e[3])}function Wse(e){return Bu(e[3])}function qse(e){return e[2]}function jse(e){return R.IsEqual(e.length,2)?yh(e[1]):R.IsEqual(e.length,1)?e[0]:_h()}function Gse(e){return wp(e)}function Bse(e){return Gu(e[1],e[4])}function Kse(e){return ju(e[2],e[5])}function Aae(e,t){return R.IsEqual(e,"remove")?oae(t):R.IsEqual(e,"add")?Vu(t):t}function Hse(e){return R.IsEqual(e.length,2)&&R.IsEqual(e[0],"-")?"remove":R.IsEqual(e.length,2)&&R.IsEqual(e[0],"+")||R.IsEqual(e.length,1)?"add":"none"}function Rae(e,t){return R.IsEqual(e,"remove")?cae(t):R.IsEqual(e,"add")?Bu(t):t}function Vse(e){return R.IsEqual(e.length,2)&&R.IsEqual(e[0],"-")?"remove":R.IsEqual(e.length,2)&&R.IsEqual(e[0],"+")||R.IsEqual(e.length,1)?"add":"none"}function zse(e){return R.IsEqual(e.length,2)?[e[1]]:[]}function Jse(e){return R.IsArray(e[6])&&R.IsEqual(e[6].length,1)?Ew(xw(e[3]),e[5],e[6][0],Aae(e[1],Rae(e[8],e[10]))):Ew(xw(e[3]),e[5],vp(e[3]),Aae(e[1],Rae(e[8],e[10])))}function Yse(e){return vp(e)}function Xse(e){return BigInt(e)}function Qse(e){return parseFloat(e)}function Zse(e){return R.IsEqual(e,"true")}function ece(e){return null}function tce(e){return{[e[0]]:e[2]}}function nce(e){return wp(e)}function itt(e){return e.reduce((t,n)=>B.Assign(t,n),{})}function rce(e){return itt(e[1])}function ice(e){return wp(e)}function oce(e){return e[1]}function ace(e){return _w()}function sce(e){return rc()}function cce(e){return $a()}function uce(e){return hh()}function lce(e){return $n()}function pce(e){return Xt(e)}function dce(e){return jt(e[1])}function mce(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function fce(e){return[e[0],...e[1]]}function hce(e){return e[1]}function gce(e){return wp(e)}function yce(e){return R.IsEqual(e.length,2)?e[1]:[]}function _ce(e){let t=e[2],n=e[3],[r,i]=e[4],o=R.IsEqual(R.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:Yd(t,Sw(n,r,o))}}function xce(e){let t=e[2],[n,r]=e[3],i=R.IsEqual(R.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:Sw(t,n,i)}}function vce(e){return{[e[1]]:Yd(e[2],e[4])}}function bce(e){return{[e[1]]:e[3]}}function wce(e){return null}function Tce(e){return Ase(wp(e))}function Ice(e){return e[1]}function kce(e){let t=e[0],n=e[1];return Ace(B.Assign(t,n[0]))}function Ow(e){return cn(e.length,2)}function Ht(e,t,n){return Ow(e)?t(e[0],e[1]):n()}function stt(e,t){return cn(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function Ir(e,t){for(let n=0;n<e.length;n++){let r=stt(e[n],t);if(Ow(r))return r}return[]}function g3(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var Rce=[...g3(97,122),...g3(65,90)],y3="0",_3=g3(49,57),K0=[y3,..._3],Cce=" ",H0=`
309
+ `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=DP(t),r=mx(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=DP(t),r=mx(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Q_e.Parser=rB});var r0e=X(TT=>{"use strict";var Z_e=BG(),bdt=fT(),wT=yT(),wdt=jj(),Tdt=Cn(),Idt=nB(),e0e=iB();function t0e(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Idt.LineCounter||null,prettyErrors:t}}function kdt(e,t={}){let{lineCounter:n,prettyErrors:r}=t0e(t),i=new e0e.Parser(n?.addNewLine),o=new Z_e.Composer(t),a=Array.from(o.compose(i.parse(e)));if(r&&n)for(let c of a)c.errors.forEach(wT.prettifyError(e,n)),c.warnings.forEach(wT.prettifyError(e,n));return a.length>0?a:Object.assign([],{empty:!0},o.streamInfo())}function n0e(e,t={}){let{lineCounter:n,prettyErrors:r}=t0e(t),i=new e0e.Parser(n?.addNewLine),o=new Z_e.Composer(t),a=null;for(let c of o.compose(i.parse(e),!0,e.length))if(!a)a=c;else if(a.options.logLevel!=="silent"){a.errors.push(new wT.YAMLParseError(c.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(a.errors.forEach(wT.prettifyError(e,n)),a.warnings.forEach(wT.prettifyError(e,n))),a}function Edt(e,t,n){let r;typeof t=="function"?r=t:n===void 0&&t&&typeof t=="object"&&(n=t);let i=n0e(e,n);if(!i)return null;if(i.warnings.forEach(o=>wdt.warn(i.options.logLevel,o)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function Sdt(e,t,n){let r=null;if(typeof t=="function"||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){let{keepUndefined:i}=n??t??{};if(!i)return}return Tdt.isDocument(e)&&!r?e.toString(n):new bdt.Document(e,r,n).toString(n)}TT.parse=Edt;TT.parseAllDocuments=kdt;TT.parseDocument=n0e;TT.stringify=Sdt});var aB=X(Bn=>{"use strict";var Adt=BG(),Rdt=fT(),Cdt=IG(),oB=yT(),Odt=Qw(),hm=Cn(),Pdt=lm(),Ldt=Pi(),Mdt=dm(),Ndt=mm(),Ddt=MP(),$dt=eB(),Fdt=nB(),Udt=iB(),FP=r0e(),i0e=zw();Bn.Composer=Adt.Composer;Bn.Document=Rdt.Document;Bn.Schema=Cdt.Schema;Bn.YAMLError=oB.YAMLError;Bn.YAMLParseError=oB.YAMLParseError;Bn.YAMLWarning=oB.YAMLWarning;Bn.Alias=Odt.Alias;Bn.isAlias=hm.isAlias;Bn.isCollection=hm.isCollection;Bn.isDocument=hm.isDocument;Bn.isMap=hm.isMap;Bn.isNode=hm.isNode;Bn.isPair=hm.isPair;Bn.isScalar=hm.isScalar;Bn.isSeq=hm.isSeq;Bn.Pair=Pdt.Pair;Bn.Scalar=Ldt.Scalar;Bn.YAMLMap=Mdt.YAMLMap;Bn.YAMLSeq=Ndt.YAMLSeq;Bn.CST=Ddt;Bn.Lexer=$dt.Lexer;Bn.LineCounter=Fdt.LineCounter;Bn.Parser=Udt.Parser;Bn.parse=FP.parse;Bn.parseAllDocuments=FP.parseAllDocuments;Bn.parseDocument=FP.parseDocument;Bn.stringify=FP.stringify;Bn.visit=i0e.visit;Bn.visitAsync=i0e.visitAsync});var m0e=X((wBn,qP)=>{function s0e(e){return Array.isArray(e)?e:[e]}var qdt=void 0,uB="",o0e=" ",cB="\\",jdt=/^\s+$/,Gdt=/(?:[^\\]|^)\\$/,Bdt=/^\\!/,Kdt=/^\\#/,Hdt=/\r?\n/g,Vdt=/^\.{0,2}\/|^\.{1,2}$/,zdt=/\/$/,fx="/",c0e="node-ignore";typeof Symbol<"u"&&(c0e=Symbol.for("node-ignore"));var u0e=c0e,hx=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),Jdt=/([0-z])-([0-z])/g,l0e=()=>!1,Ydt=e=>e.replace(Jdt,(t,n,r)=>n.charCodeAt(0)<=r.charCodeAt(0)?t:uB),Xdt=e=>{let{length:t}=e;return e.slice(0,t-t%2)},Qdt=[[/^\uFEFF/,()=>uB],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf("\\")===0?o0e:uB)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+o0e}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>{let r=n.replace(/\\\*/g,"[^\\/]*");return t+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>cB],[/\\\\/g,()=>cB],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===cB?`\\[${n}${Xdt(r)}${i}`:i==="]"&&r.length%2===0?`[${Ydt(n)}${r}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`]],Zdt=/(^|\\\/)?\\\*$/,IT="regex",UP="checkRegex",a0e="_",emt={[IT](e,t){return`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`},[UP](e,t){return`${t?`${t}[^/]*`:"[^/]*"}(?=$|\\/$)`}},tmt=e=>Qdt.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),WP=e=>typeof e=="string",nmt=e=>e&&WP(e)&&!jdt.test(e)&&!Gdt.test(e)&&e.indexOf("#")!==0,rmt=e=>e.split(Hdt).filter(Boolean),lB=class{constructor(t,n,r,i,o,a){this.pattern=t,this.mark=n,this.negative=o,hx(this,"body",r),hx(this,"ignoreCase",i),hx(this,"regexPrefix",a)}get regex(){let t=a0e+IT;return this[t]?this[t]:this._make(IT,t)}get checkRegex(){let t=a0e+UP;return this[t]?this[t]:this._make(UP,t)}_make(t,n){let r=this.regexPrefix.replace(Zdt,emt[t]),i=this.ignoreCase?new RegExp(r,"i"):new RegExp(r);return hx(this,n,i)}},imt=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf("!")===0&&(r=!0,i=i.substr(1)),i=i.replace(Bdt,"!").replace(Kdt,"#");let o=tmt(i);return new lB(e,t,i,n,r,o)},pB=class{constructor(t){this._ignoreCase=t,this._rules=[]}_add(t){if(t&&t[u0e]){this._rules=this._rules.concat(t._rules._rules),this._added=!0;return}if(WP(t)&&(t={pattern:t}),nmt(t.pattern)){let n=imt(t,this._ignoreCase);this._added=!0,this._rules.push(n)}}add(t){return this._added=!1,s0e(WP(t)?rmt(t):t).forEach(this._add,this),this._added}test(t,n,r){let i=!1,o=!1,a;this._rules.forEach(u=>{let{negative:l}=u;o===l&&i!==o||l&&!i&&!o&&!n||!u[r].test(t)||(i=!l,o=l,a=l?qdt:u)});let c={ignored:i,unignored:o};return a&&(c.rule=a),c}},omt=(e,t)=>{throw new t(e)},Ep=(e,t,n)=>WP(e)?e?Ep.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n("path must not be empty",TypeError):n(`path must be a string, but got \`${t}\``,TypeError),p0e=e=>Vdt.test(e);Ep.isNotRelative=p0e;Ep.convert=e=>e;var dB=class{constructor({ignorecase:t=!0,ignoreCase:n=t,allowRelativePaths:r=!1}={}){hx(this,u0e,!0),this._rules=new pB(n),this._strictPathCheck=!r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(t){return this._rules.add(t)&&this._initCache(),this}addPattern(t){return this.add(t)}_test(t,n,r,i){let o=t&&Ep.convert(t);return Ep(o,t,this._strictPathCheck?omt:l0e),this._t(o,n,r,i)}checkIgnore(t){if(!zdt.test(t))return this.test(t);let n=t.split(fx).filter(Boolean);if(n.pop(),n.length){let r=this._t(n.join(fx)+fx,this._testCache,!0,n);if(r.ignored)return r}return this._rules.test(t,!1,UP)}_t(t,n,r,i){if(t in n)return n[t];if(i||(i=t.split(fx).filter(Boolean)),i.pop(),!i.length)return n[t]=this._rules.test(t,r,IT);let o=this._t(i.join(fx)+fx,n,r,i);return n[t]=o.ignored?o:this._rules.test(t,r,IT)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return s0e(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}},mB=e=>new dB(e),amt=e=>Ep(e&&Ep.convert(e),e,l0e),d0e=()=>{let e=n=>/^\\\\\?\\/.test(n)||/["<>|\u0000-\u001F]+/u.test(n)?n:n.replace(/\\/g,"/");Ep.convert=e;let t=/^[a-z]:\//i;Ep.isNotRelative=n=>t.test(n)||p0e(n)};typeof process<"u"&&process.platform==="win32"&&d0e();qP.exports=mB;mB.default=mB;qP.exports.isPathValid=amt;hx(qP.exports,Symbol.for("setupWindows"),d0e)});var Oo={};On(Oo,{HasPropertyKey:()=>UI,IsArray:()=>ci,IsAsyncIterator:()=>ML,IsBigInt:()=>Jx,IsBoolean:()=>wl,IsDate:()=>Dm,IsFunction:()=>NL,IsIterator:()=>DL,IsNull:()=>$L,IsNumber:()=>Va,IsObject:()=>zn,IsRegExp:()=>Yx,IsString:()=>or,IsSymbol:()=>FL,IsUint8Array:()=>Tl,IsUndefined:()=>ui});function UI(e,t){return t in e}function ML(e){return zn(e)&&!ci(e)&&!Tl(e)&&Symbol.asyncIterator in e}function ci(e){return Array.isArray(e)}function Jx(e){return typeof e=="bigint"}function wl(e){return typeof e=="boolean"}function Dm(e){return e instanceof globalThis.Date}function NL(e){return typeof e=="function"}function DL(e){return zn(e)&&!ci(e)&&!Tl(e)&&Symbol.iterator in e}function $L(e){return e===null}function Va(e){return typeof e=="number"}function zn(e){return typeof e=="object"&&e!==null}function Yx(e){return e instanceof globalThis.RegExp}function or(e){return typeof e=="string"}function FL(e){return typeof e=="symbol"}function Tl(e){return e instanceof globalThis.Uint8Array}function ui(e){return e===void 0}function jAe(e){return e.map(t=>WI(t))}function GAe(e){return new Date(e.getTime())}function BAe(e){return new Uint8Array(e)}function KAe(e){return new RegExp(e.source,e.flags)}function HAe(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=WI(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=WI(e[n]);return t}function WI(e){return ci(e)?jAe(e):Dm(e)?GAe(e):Tl(e)?BAe(e):Yx(e)?KAe(e):zn(e)?HAe(e):e}function _r(e){return WI(e)}function rg(e,t){return t===void 0?_r(e):_r({...t,...e})}function qI(e){return Ut(e)&&globalThis.Symbol.asyncIterator in e}function jI(e){return Ut(e)&&globalThis.Symbol.iterator in e}function UL(e){return Ut(e)&&(globalThis.Object.getPrototypeOf(e)===Object.prototype||globalThis.Object.getPrototypeOf(e)===null)}function GI(e){return e instanceof globalThis.Promise}function Xo(e){return e instanceof Date&&globalThis.Number.isFinite(e.getTime())}function FK(e){return e instanceof globalThis.Map}function UK(e){return e instanceof globalThis.Set}function As(e){return globalThis.ArrayBuffer.isView(e)}function ig(e){return e instanceof globalThis.Uint8Array}function Tt(e,t){return t in e}function Ut(e){return e!==null&&typeof e=="object"}function Rt(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function xr(e){return e===void 0}function Il(e){return e===null}function hu(e){return typeof e=="boolean"}function vr(e){return typeof e=="number"}function BI(e){return globalThis.Number.isInteger(e)}function hc(e){return typeof e=="bigint"}function qn(e){return typeof e=="string"}function Fp(e){return typeof e=="function"}function kl(e){return typeof e=="symbol"}function za(e){return hc(e)||hu(e)||Il(e)||vr(e)||qn(e)||kl(e)||xr(e)}var xi;(function(e){e.InstanceMode="default",e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(a,c){return e.ExactOptionalPropertyTypes?c in a:a[c]!==void 0}e.IsExactOptionalProperty=t;function n(a){let c=Ut(a);return e.AllowArrayObject?c:c&&!Rt(a)}e.IsObjectLike=n;function r(a){return n(a)&&!(a instanceof Date)&&!(a instanceof Uint8Array)}e.IsRecordLike=r;function i(a){return e.AllowNaN?vr(a):Number.isFinite(a)}e.IsNumberLike=i;function o(a){let c=xr(a);return e.AllowNullVoid?c||a===null:c}e.IsVoidLike=o})(xi||(xi={}));function VAe(e){return globalThis.Object.freeze(e).map(t=>Xx(t))}function zAe(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=Xx(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=Xx(e[n]);return globalThis.Object.freeze(t)}function Xx(e){return ci(e)?VAe(e):Dm(e)?e:Tl(e)?e:Yx(e)?e:zn(e)?zAe(e):e}function fe(e,t){let n=t!==void 0?{...t,...e}:e;switch(xi.InstanceMode){case"freeze":return Xx(n);case"clone":return _r(n);default:return n}}var Mt=class extends Error{constructor(t){super(t)}};var Or=Symbol.for("TypeBox.Transform"),gc=Symbol.for("TypeBox.Readonly"),fo=Symbol.for("TypeBox.Optional"),Rs=Symbol.for("TypeBox.Hint"),he=Symbol.for("TypeBox.Kind");function og(e){return zn(e)&&e[gc]==="Readonly"}function _a(e){return zn(e)&&e[fo]==="Optional"}function WL(e){return gn(e,"Any")}function qL(e){return gn(e,"Argument")}function yc(e){return gn(e,"Array")}function $m(e){return gn(e,"AsyncIterator")}function Fm(e){return gn(e,"BigInt")}function El(e){return gn(e,"Boolean")}function _c(e){return gn(e,"Computed")}function xc(e){return gn(e,"Constructor")}function JAe(e){return gn(e,"Date")}function vc(e){return gn(e,"Function")}function bc(e){return gn(e,"Integer")}function Gr(e){return gn(e,"Intersect")}function Um(e){return gn(e,"Iterator")}function gn(e,t){return zn(e)&&he in e&&e[he]===t}function KI(e){return wl(e)||Va(e)||or(e)}function Ja(e){return gn(e,"Literal")}function Ya(e){return gn(e,"MappedKey")}function br(e){return gn(e,"MappedResult")}function Up(e){return gn(e,"Never")}function YAe(e){return gn(e,"Not")}function Qx(e){return gn(e,"Null")}function wc(e){return gn(e,"Number")}function li(e){return gn(e,"Object")}function Wm(e){return gn(e,"Promise")}function qm(e){return gn(e,"Record")}function Xr(e){return gn(e,"Ref")}function jL(e){return gn(e,"RegExp")}function Sl(e){return gn(e,"String")}function Zx(e){return gn(e,"Symbol")}function Xa(e){return gn(e,"TemplateLiteral")}function XAe(e){return gn(e,"This")}function Pn(e){return zn(e)&&Or in e}function Qa(e){return gn(e,"Tuple")}function Al(e){return gn(e,"Undefined")}function xn(e){return gn(e,"Union")}function QAe(e){return gn(e,"Uint8Array")}function ZAe(e){return gn(e,"Unknown")}function eRe(e){return gn(e,"Unsafe")}function tRe(e){return gn(e,"Void")}function Wp(e){return zn(e)&&he in e&&or(e[he])}function Pr(e){return WL(e)||qL(e)||yc(e)||El(e)||Fm(e)||$m(e)||_c(e)||xc(e)||JAe(e)||vc(e)||bc(e)||Gr(e)||Um(e)||Ja(e)||Ya(e)||br(e)||Up(e)||YAe(e)||Qx(e)||wc(e)||li(e)||Wm(e)||qm(e)||Xr(e)||jL(e)||Sl(e)||Zx(e)||Xa(e)||XAe(e)||Qa(e)||Al(e)||xn(e)||QAe(e)||ZAe(e)||eRe(e)||tRe(e)||Wp(e)}var V={};On(V,{IsAny:()=>GK,IsArgument:()=>BK,IsArray:()=>KK,IsAsyncIterator:()=>HK,IsBigInt:()=>VK,IsBoolean:()=>zK,IsComputed:()=>JK,IsConstructor:()=>YK,IsDate:()=>XK,IsFunction:()=>QK,IsImport:()=>sRe,IsInteger:()=>ZK,IsIntersect:()=>e6,IsIterator:()=>t6,IsKind:()=>S6,IsKindOf:()=>sn,IsLiteral:()=>tv,IsLiteralBoolean:()=>cRe,IsLiteralNumber:()=>r6,IsLiteralString:()=>n6,IsLiteralValue:()=>i6,IsMappedKey:()=>o6,IsMappedResult:()=>a6,IsNever:()=>s6,IsNot:()=>c6,IsNull:()=>u6,IsNumber:()=>l6,IsObject:()=>p6,IsOptional:()=>aRe,IsPromise:()=>d6,IsProperties:()=>HI,IsReadonly:()=>oRe,IsRecord:()=>m6,IsRecursive:()=>uRe,IsRef:()=>f6,IsRegExp:()=>h6,IsSchema:()=>Vi,IsString:()=>g6,IsSymbol:()=>y6,IsTemplateLiteral:()=>_6,IsThis:()=>x6,IsTransform:()=>v6,IsTuple:()=>b6,IsUint8Array:()=>T6,IsUndefined:()=>w6,IsUnion:()=>HL,IsUnionLiteral:()=>lRe,IsUnknown:()=>I6,IsUnsafe:()=>k6,IsVoid:()=>E6,TypeGuardUnknownTypeError:()=>GL});var GL=class extends Mt{},nRe=["Argument","Any","Array","AsyncIterator","BigInt","Boolean","Computed","Constructor","Date","Enum","Function","Integer","Intersect","Iterator","Literal","MappedKey","MappedResult","Not","Null","Number","Object","Promise","Record","Ref","RegExp","String","Symbol","TemplateLiteral","This","Tuple","Undefined","Union","Uint8Array","Unknown","Void"];function WK(e){try{return new RegExp(e),!0}catch{return!1}}function BL(e){if(!or(e))return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=7&&n<=13||n===27||n===127)return!1}return!0}function qK(e){return KL(e)||Vi(e)}function ev(e){return ui(e)||Jx(e)}function ar(e){return ui(e)||Va(e)}function KL(e){return ui(e)||wl(e)}function Jn(e){return ui(e)||or(e)}function rRe(e){return ui(e)||or(e)&&BL(e)&&WK(e)}function iRe(e){return ui(e)||or(e)&&BL(e)}function jK(e){return ui(e)||Vi(e)}function oRe(e){return zn(e)&&e[gc]==="Readonly"}function aRe(e){return zn(e)&&e[fo]==="Optional"}function GK(e){return sn(e,"Any")&&Jn(e.$id)}function BK(e){return sn(e,"Argument")&&Va(e.index)}function KK(e){return sn(e,"Array")&&e.type==="array"&&Jn(e.$id)&&Vi(e.items)&&ar(e.minItems)&&ar(e.maxItems)&&KL(e.uniqueItems)&&jK(e.contains)&&ar(e.minContains)&&ar(e.maxContains)}function HK(e){return sn(e,"AsyncIterator")&&e.type==="AsyncIterator"&&Jn(e.$id)&&Vi(e.items)}function VK(e){return sn(e,"BigInt")&&e.type==="bigint"&&Jn(e.$id)&&ev(e.exclusiveMaximum)&&ev(e.exclusiveMinimum)&&ev(e.maximum)&&ev(e.minimum)&&ev(e.multipleOf)}function zK(e){return sn(e,"Boolean")&&e.type==="boolean"&&Jn(e.$id)}function JK(e){return sn(e,"Computed")&&or(e.target)&&ci(e.parameters)&&e.parameters.every(t=>Vi(t))}function YK(e){return sn(e,"Constructor")&&e.type==="Constructor"&&Jn(e.$id)&&ci(e.parameters)&&e.parameters.every(t=>Vi(t))&&Vi(e.returns)}function XK(e){return sn(e,"Date")&&e.type==="Date"&&Jn(e.$id)&&ar(e.exclusiveMaximumTimestamp)&&ar(e.exclusiveMinimumTimestamp)&&ar(e.maximumTimestamp)&&ar(e.minimumTimestamp)&&ar(e.multipleOfTimestamp)}function QK(e){return sn(e,"Function")&&e.type==="Function"&&Jn(e.$id)&&ci(e.parameters)&&e.parameters.every(t=>Vi(t))&&Vi(e.returns)}function sRe(e){return sn(e,"Import")&&UI(e,"$defs")&&zn(e.$defs)&&HI(e.$defs)&&UI(e,"$ref")&&or(e.$ref)&&e.$ref in e.$defs}function ZK(e){return sn(e,"Integer")&&e.type==="integer"&&Jn(e.$id)&&ar(e.exclusiveMaximum)&&ar(e.exclusiveMinimum)&&ar(e.maximum)&&ar(e.minimum)&&ar(e.multipleOf)}function HI(e){return zn(e)&&Object.entries(e).every(([t,n])=>BL(t)&&Vi(n))}function e6(e){return sn(e,"Intersect")&&!(or(e.type)&&e.type!=="object")&&ci(e.allOf)&&e.allOf.every(t=>Vi(t)&&!v6(t))&&Jn(e.type)&&(KL(e.unevaluatedProperties)||jK(e.unevaluatedProperties))&&Jn(e.$id)}function t6(e){return sn(e,"Iterator")&&e.type==="Iterator"&&Jn(e.$id)&&Vi(e.items)}function sn(e,t){return zn(e)&&he in e&&e[he]===t}function n6(e){return tv(e)&&or(e.const)}function r6(e){return tv(e)&&Va(e.const)}function cRe(e){return tv(e)&&wl(e.const)}function tv(e){return sn(e,"Literal")&&Jn(e.$id)&&i6(e.const)}function i6(e){return wl(e)||Va(e)||or(e)}function o6(e){return sn(e,"MappedKey")&&ci(e.keys)&&e.keys.every(t=>Va(t)||or(t))}function a6(e){return sn(e,"MappedResult")&&HI(e.properties)}function s6(e){return sn(e,"Never")&&zn(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function c6(e){return sn(e,"Not")&&Vi(e.not)}function u6(e){return sn(e,"Null")&&e.type==="null"&&Jn(e.$id)}function l6(e){return sn(e,"Number")&&e.type==="number"&&Jn(e.$id)&&ar(e.exclusiveMaximum)&&ar(e.exclusiveMinimum)&&ar(e.maximum)&&ar(e.minimum)&&ar(e.multipleOf)}function p6(e){return sn(e,"Object")&&e.type==="object"&&Jn(e.$id)&&HI(e.properties)&&qK(e.additionalProperties)&&ar(e.minProperties)&&ar(e.maxProperties)}function d6(e){return sn(e,"Promise")&&e.type==="Promise"&&Jn(e.$id)&&Vi(e.item)}function m6(e){return sn(e,"Record")&&e.type==="object"&&Jn(e.$id)&&qK(e.additionalProperties)&&zn(e.patternProperties)&&(t=>{let n=Object.getOwnPropertyNames(t.patternProperties);return n.length===1&&WK(n[0])&&zn(t.patternProperties)&&Vi(t.patternProperties[n[0]])})(e)}function uRe(e){return zn(e)&&Rs in e&&e[Rs]==="Recursive"}function f6(e){return sn(e,"Ref")&&Jn(e.$id)&&or(e.$ref)}function h6(e){return sn(e,"RegExp")&&Jn(e.$id)&&or(e.source)&&or(e.flags)&&ar(e.maxLength)&&ar(e.minLength)}function g6(e){return sn(e,"String")&&e.type==="string"&&Jn(e.$id)&&ar(e.minLength)&&ar(e.maxLength)&&rRe(e.pattern)&&iRe(e.format)}function y6(e){return sn(e,"Symbol")&&e.type==="symbol"&&Jn(e.$id)}function _6(e){return sn(e,"TemplateLiteral")&&e.type==="string"&&or(e.pattern)&&e.pattern[0]==="^"&&e.pattern[e.pattern.length-1]==="$"}function x6(e){return sn(e,"This")&&Jn(e.$id)&&or(e.$ref)}function v6(e){return zn(e)&&Or in e}function b6(e){return sn(e,"Tuple")&&e.type==="array"&&Jn(e.$id)&&Va(e.minItems)&&Va(e.maxItems)&&e.minItems===e.maxItems&&(ui(e.items)&&ui(e.additionalItems)&&e.minItems===0||ci(e.items)&&e.items.every(t=>Vi(t)))}function w6(e){return sn(e,"Undefined")&&e.type==="undefined"&&Jn(e.$id)}function lRe(e){return HL(e)&&e.anyOf.every(t=>n6(t)||r6(t))}function HL(e){return sn(e,"Union")&&Jn(e.$id)&&zn(e)&&ci(e.anyOf)&&e.anyOf.every(t=>Vi(t))}function T6(e){return sn(e,"Uint8Array")&&e.type==="Uint8Array"&&Jn(e.$id)&&ar(e.minByteLength)&&ar(e.maxByteLength)}function I6(e){return sn(e,"Unknown")&&Jn(e.$id)}function k6(e){return sn(e,"Unsafe")}function E6(e){return sn(e,"Void")&&e.type==="void"&&Jn(e.$id)}function S6(e){return zn(e)&&he in e&&or(e[he])&&!nRe.includes(e[he])}function Vi(e){return zn(e)&&(GK(e)||BK(e)||KK(e)||zK(e)||VK(e)||HK(e)||JK(e)||YK(e)||XK(e)||QK(e)||ZK(e)||e6(e)||t6(e)||tv(e)||o6(e)||a6(e)||s6(e)||c6(e)||u6(e)||l6(e)||p6(e)||d6(e)||m6(e)||f6(e)||h6(e)||g6(e)||y6(e)||_6(e)||x6(e)||b6(e)||w6(e)||HL(e)||T6(e)||I6(e)||k6(e)||E6(e)||S6(e))}var VL="(true|false)",nv="(0|[1-9][0-9]*)",zL="(.*)",pRe="(?!.*)",zwt=`^${VL}$`,qp=`^${nv}$`,jp=`^${zL}$`,A6=`^${pRe}$`;var gu={};On(gu,{Clear:()=>mRe,Delete:()=>fRe,Entries:()=>dRe,Get:()=>yRe,Has:()=>hRe,Set:()=>gRe});var ag=new Map;function dRe(){return new Map(ag)}function mRe(){return ag.clear()}function fRe(e){return ag.delete(e)}function hRe(e){return ag.has(e)}function gRe(e,t){ag.set(e,t)}function yRe(e){return ag.get(e)}var Tc={};On(Tc,{Clear:()=>xRe,Delete:()=>vRe,Entries:()=>_Re,Get:()=>TRe,Has:()=>bRe,Set:()=>wRe});var sg=new Map;function _Re(){return new Map(sg)}function xRe(){return sg.clear()}function vRe(e){return sg.delete(e)}function bRe(e){return sg.has(e)}function wRe(e,t){sg.set(e,t)}function TRe(e){return sg.get(e)}function R6(e,t){return e.includes(t)}function C6(e){return[...new Set(e)]}function IRe(e,t){return e.filter(n=>t.includes(n))}function kRe(e,t){return e.reduce((n,r)=>IRe(n,r),t)}function O6(e){return e.length===1?e[0]:e.length>1?kRe(e.slice(1),e[0]):[]}function P6(e){let t=[];for(let n of e)t.push(...n);return t}function Gp(e){return fe({[he]:"Any"},e)}function cg(e,t){return fe({[he]:"Array",type:"array",items:e},t)}function L6(e){return fe({[he]:"Argument",index:e})}function ug(e,t){return fe({[he]:"AsyncIterator",type:"AsyncIterator",items:e},t)}function lr(e,t,n){return fe({[he]:"Computed",target:e,parameters:t},n)}function ERe(e,t){let{[t]:n,...r}=e;return r}function Br(e,t){return t.reduce((n,r)=>ERe(n,r),e)}function rn(e){return fe({[he]:"Never",not:{}},e)}function Sn(e){return fe({[he]:"MappedResult",properties:e})}function lg(e,t,n){return fe({[he]:"Constructor",type:"Constructor",parameters:e,returns:t},n)}function yu(e,t,n){return fe({[he]:"Function",type:"Function",parameters:e,returns:t},n)}function rv(e,t){return fe({[he]:"Union",anyOf:e},t)}function SRe(e){return e.some(t=>_a(t))}function M6(e){return e.map(t=>_a(t)?ARe(t):t)}function ARe(e){return Br(e,[fo])}function RRe(e,t){return SRe(e)?Po(rv(M6(e),t)):rv(M6(e),t)}function _u(e,t){return e.length===1?fe(e[0],t):e.length===0?rn(t):RRe(e,t)}function Ln(e,t){return e.length===0?rn(t):e.length===1?fe(e[0],t):rv(e,t)}var VI=class extends Mt{};function CRe(e){return e.replace(/\\\$/g,"$").replace(/\\\*/g,"*").replace(/\\\^/g,"^").replace(/\\\|/g,"|").replace(/\\\(/g,"(").replace(/\\\)/g,")")}function JL(e,t,n){return e[t]===n&&e.charCodeAt(t-1)!==92}function Cl(e,t){return JL(e,t,"(")}function iv(e,t){return JL(e,t,")")}function N6(e,t){return JL(e,t,"|")}function ORe(e){if(!(Cl(e,0)&&iv(e,e.length-1)))return!1;let t=0;for(let n=0;n<e.length;n++)if(Cl(e,n)&&(t+=1),iv(e,n)&&(t-=1),t===0&&n!==e.length-1)return!1;return!0}function PRe(e){return e.slice(1,e.length-1)}function LRe(e){let t=0;for(let n=0;n<e.length;n++)if(Cl(e,n)&&(t+=1),iv(e,n)&&(t-=1),N6(e,n)&&t===0)return!0;return!1}function MRe(e){for(let t=0;t<e.length;t++)if(Cl(e,t))return!0;return!1}function NRe(e){let[t,n]=[0,0],r=[];for(let o=0;o<e.length;o++)if(Cl(e,o)&&(t+=1),iv(e,o)&&(t-=1),N6(e,o)&&t===0){let a=e.slice(n,o);a.length>0&&r.push(pg(a)),n=o+1}let i=e.slice(n);return i.length>0&&r.push(pg(i)),r.length===0?{type:"const",const:""}:r.length===1?r[0]:{type:"or",expr:r}}function DRe(e){function t(i,o){if(!Cl(i,o))throw new VI("TemplateLiteralParser: Index must point to open parens");let a=0;for(let c=o;c<i.length;c++)if(Cl(i,c)&&(a+=1),iv(i,c)&&(a-=1),a===0)return[o,c];throw new VI("TemplateLiteralParser: Unclosed group parens in expression")}function n(i,o){for(let a=o;a<i.length;a++)if(Cl(i,a))return[o,a];return[o,i.length]}let r=[];for(let i=0;i<e.length;i++)if(Cl(e,i)){let[o,a]=t(e,i),c=e.slice(o,a+1);r.push(pg(c)),i=a}else{let[o,a]=n(e,i),c=e.slice(o,a);c.length>0&&r.push(pg(c)),i=a-1}return r.length===0?{type:"const",const:""}:r.length===1?r[0]:{type:"and",expr:r}}function pg(e){return ORe(e)?pg(PRe(e)):LRe(e)?NRe(e):MRe(e)?DRe(e):{type:"const",const:CRe(e)}}function dg(e){return pg(e.slice(1,e.length-1))}var YL=class extends Mt{};function $Re(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="0"&&e.expr[1].type==="const"&&e.expr[1].const==="[1-9][0-9]*"}function FRe(e){return e.type==="or"&&e.expr.length===2&&e.expr[0].type==="const"&&e.expr[0].const==="true"&&e.expr[1].type==="const"&&e.expr[1].const==="false"}function URe(e){return e.type==="const"&&e.const===".*"}function jm(e){return $Re(e)||URe(e)?!1:FRe(e)?!0:e.type==="and"?e.expr.every(t=>jm(t)):e.type==="or"?e.expr.every(t=>jm(t)):e.type==="const"?!0:(()=>{throw new YL("Unknown expression type")})()}function zI(e){let t=dg(e.pattern);return jm(t)}var XL=class extends Mt{};function*D6(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let n of D6(e.slice(1)))yield`${t}${n}`}function*WRe(e){return yield*D6(e.expr.map(t=>[...ov(t)]))}function*qRe(e){for(let t of e.expr)yield*ov(t)}function*jRe(e){return yield e.const}function*ov(e){return e.type==="and"?yield*WRe(e):e.type==="or"?yield*qRe(e):e.type==="const"?yield*jRe(e):(()=>{throw new XL("Unknown expression")})()}function mg(e){let t=dg(e.pattern);return jm(t)?[...ov(t)]:[]}function yn(e,t){return fe({[he]:"Literal",const:e,type:typeof e},t)}function JI(e){return fe({[he]:"Boolean",type:"boolean"},e)}function fg(e){return fe({[he]:"BigInt",type:"bigint"},e)}function Cs(e){return fe({[he]:"Number",type:"number"},e)}function Qo(e){return fe({[he]:"String",type:"string"},e)}function*GRe(e){let t=e.trim().replace(/"|'/g,"");return t==="boolean"?yield JI():t==="number"?yield Cs():t==="bigint"?yield fg():t==="string"?yield Qo():yield(()=>{let n=t.split("|").map(r=>yn(r.trim()));return n.length===0?rn():n.length===1?n[0]:_u(n)})()}function*BRe(e){if(e[1]!=="{"){let t=yn("$"),n=QL(e.slice(1));return yield*[t,...n]}for(let t=2;t<e.length;t++)if(e[t]==="}"){let n=GRe(e.slice(2,t)),r=QL(e.slice(t+1));return yield*[...n,...r]}yield yn(e)}function*QL(e){for(let t=0;t<e.length;t++)if(e[t]==="$"){let n=yn(e.slice(0,t)),r=BRe(e.slice(t));return yield*[n,...r]}yield yn(e)}function $6(e){return[...QL(e)]}var ZL=class extends Mt{};function KRe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function F6(e,t){return Xa(e)?e.pattern.slice(1,e.pattern.length-1):xn(e)?`(${e.anyOf.map(n=>F6(n,t)).join("|")})`:wc(e)?`${t}${nv}`:bc(e)?`${t}${nv}`:Fm(e)?`${t}${nv}`:Sl(e)?`${t}${zL}`:Ja(e)?`${t}${KRe(e.const.toString())}`:El(e)?`${t}${VL}`:(()=>{throw new ZL(`Unexpected Kind '${e[he]}'`)})()}function eM(e){return`^${e.map(t=>F6(t,"")).join("")}$`}function Gm(e){let n=mg(e).map(r=>yn(r));return _u(n)}function YI(e,t){let n=or(e)?eM($6(e)):eM(e);return fe({[he]:"TemplateLiteral",type:"string",pattern:n},t)}function HRe(e){return mg(e).map(n=>n.toString())}function VRe(e){let t=[];for(let n of e)t.push(...xa(n));return t}function zRe(e){return[e.toString()]}function xa(e){return[...new Set(Xa(e)?HRe(e):xn(e)?VRe(e.anyOf):Ja(e)?zRe(e.const):wc(e)?["[number]"]:bc(e)?["[number]"]:[])]}function JRe(e,t,n){let r={};for(let i of Object.getOwnPropertyNames(t))r[i]=Bp(e,xa(t[i]),n);return r}function YRe(e,t,n){return JRe(e,t.properties,n)}function U6(e,t,n){let r=YRe(e,t,n);return Sn(r)}function q6(e,t){return e.map(n=>j6(n,t))}function XRe(e){return e.filter(t=>!Up(t))}function QRe(e,t){return XI(XRe(q6(e,t)))}function ZRe(e){return e.some(t=>Up(t))?[]:e}function eCe(e,t){return _u(ZRe(q6(e,t)))}function tCe(e,t){return t in e?e[t]:t==="[number]"?_u(e):rn()}function nCe(e,t){return t==="[number]"?e:rn()}function rCe(e,t){return t in e?e[t]:rn()}function j6(e,t){return Gr(e)?QRe(e.allOf,t):xn(e)?eCe(e.anyOf,t):Qa(e)?tCe(e.items??[],t):yc(e)?nCe(e.items,t):li(e)?rCe(e.properties,t):rn()}function av(e,t){return t.map(n=>j6(e,n))}function W6(e,t){return _u(av(e,t))}function Bp(e,t,n){if(Xr(e)||Xr(t)){let r="Index types using Ref parameters require both Type and Key to be of TSchema";if(!Pr(e)||!Pr(t))throw new Mt(r);return lr("Index",[e,t])}return br(t)?U6(e,t,n):Ya(t)?G6(e,t,n):fe(Pr(t)?W6(e,xa(t)):W6(e,t),n)}function iCe(e,t,n){return{[t]:Bp(e,[t],_r(n))}}function oCe(e,t,n){return t.reduce((r,i)=>({...r,...iCe(e,i,n)}),{})}function aCe(e,t,n){return oCe(e,t.keys,n)}function G6(e,t,n){let r=aCe(e,t,n);return Sn(r)}function hg(e,t){return fe({[he]:"Iterator",type:"Iterator",items:e},t)}function sCe(e){return globalThis.Object.keys(e).filter(t=>!_a(e[t]))}function cCe(e,t){let n=sCe(e),r=n.length>0?{[he]:"Object",type:"object",required:n,properties:e}:{[he]:"Object",type:"object",properties:e};return fe(r,t)}var Mn=cCe;function QI(e,t){return fe({[he]:"Promise",type:"Promise",item:e},t)}function uCe(e){return fe(Br(e,[gc]))}function lCe(e){return fe({...e,[gc]:"Readonly"})}function pCe(e,t){return t===!1?uCe(e):lCe(e)}function va(e,t){let n=t??!0;return br(e)?B6(e,n):pCe(e,n)}function dCe(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=va(e[r],t);return n}function mCe(e,t){return dCe(e.properties,t)}function B6(e,t){let n=mCe(e,t);return Sn(n)}function Os(e,t){return fe(e.length>0?{[he]:"Tuple",type:"array",items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[he]:"Tuple",type:"array",minItems:e.length,maxItems:e.length},t)}function K6(e,t){return e in t?Ps(e,t[e]):Sn(t)}function fCe(e){return{[e]:yn(e)}}function hCe(e){let t={};for(let n of e)t[n]=yn(n);return t}function gCe(e,t){return R6(t,e)?fCe(e):hCe(t)}function yCe(e,t){let n=gCe(e,t);return K6(e,n)}function sv(e,t){return t.map(n=>Ps(e,n))}function _Ce(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(t))n[r]=Ps(e,t[r]);return n}function Ps(e,t){let n={...t};return _a(t)?Po(Ps(e,Br(t,[fo]))):og(t)?va(Ps(e,Br(t,[gc]))):br(t)?K6(e,t.properties):Ya(t)?yCe(e,t.keys):xc(t)?lg(sv(e,t.parameters),Ps(e,t.returns),n):vc(t)?yu(sv(e,t.parameters),Ps(e,t.returns),n):$m(t)?ug(Ps(e,t.items),n):Um(t)?hg(Ps(e,t.items),n):Gr(t)?Lo(sv(e,t.allOf),n):xn(t)?Ln(sv(e,t.anyOf),n):Qa(t)?Os(sv(e,t.items??[]),n):li(t)?Mn(_Ce(e,t.properties),n):yc(t)?cg(Ps(e,t.items),n):Wm(t)?QI(Ps(e,t.item),n):t}function xCe(e,t){let n={};for(let r of e)n[r]=Ps(r,t);return n}function H6(e,t,n){let r=Pr(e)?xa(e):e,i=t({[he]:"MappedKey",keys:r}),o=xCe(r,i);return Mn(o,n)}function vCe(e){return fe(Br(e,[fo]))}function bCe(e){return fe({...e,[fo]:"Optional"})}function wCe(e,t){return t===!1?vCe(e):bCe(e)}function Po(e,t){let n=t??!0;return br(e)?V6(e,n):wCe(e,n)}function TCe(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Po(e[r],t);return n}function ICe(e,t){return TCe(e.properties,t)}function V6(e,t){let n=ICe(e,t);return Sn(n)}function cv(e,t={}){let n=e.every(i=>li(i)),r=Pr(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return fe(t.unevaluatedProperties===!1||Pr(t.unevaluatedProperties)||n?{...r,[he]:"Intersect",type:"object",allOf:e}:{...r,[he]:"Intersect",allOf:e},t)}function kCe(e){return e.every(t=>_a(t))}function ECe(e){return Br(e,[fo])}function z6(e){return e.map(t=>_a(t)?ECe(t):t)}function SCe(e,t){return kCe(e)?Po(cv(z6(e),t)):cv(z6(e),t)}function XI(e,t={}){if(e.length===1)return fe(e[0],t);if(e.length===0)return rn(t);if(e.some(n=>Pn(n)))throw new Error("Cannot intersect transform types");return SCe(e,t)}function Lo(e,t){if(e.length===1)return fe(e[0],t);if(e.length===0)return rn(t);if(e.some(n=>Pn(n)))throw new Error("Cannot intersect transform types");return cv(e,t)}function xu(...e){let[t,n]=typeof e[0]=="string"?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!="string")throw new Mt("Ref: $ref must be a string");return fe({[he]:"Ref",$ref:t},n)}function ACe(e,t){return lr("Awaited",[lr(e,t)])}function RCe(e){return lr("Awaited",[xu(e)])}function CCe(e){return Lo(J6(e))}function OCe(e){return Ln(J6(e))}function PCe(e){return gg(e)}function J6(e){return e.map(t=>gg(t))}function gg(e,t){return fe(_c(e)?ACe(e.target,e.parameters):Gr(e)?CCe(e.allOf):xn(e)?OCe(e.anyOf):Wm(e)?PCe(e.item):Xr(e)?RCe(e.$ref):e,t)}function Y6(e){let t=[];for(let n of e)t.push(ba(n));return t}function LCe(e){let t=Y6(e);return P6(t)}function MCe(e){let t=Y6(e);return O6(t)}function NCe(e){return e.map((t,n)=>n.toString())}function DCe(e){return["[number]"]}function $Ce(e){return globalThis.Object.getOwnPropertyNames(e)}function FCe(e){return tM?globalThis.Object.getOwnPropertyNames(e).map(n=>n[0]==="^"&&n[n.length-1]==="$"?n.slice(1,n.length-1):n):[]}function ba(e){return Gr(e)?LCe(e.allOf):xn(e)?MCe(e.anyOf):Qa(e)?NCe(e.items??[]):yc(e)?DCe(e.items):li(e)?$Ce(e.properties):qm(e)?FCe(e.patternProperties):[]}var tM=!1;function yg(e){tM=!0;let t=ba(e);return tM=!1,`^(${t.map(r=>`(${r})`).join("|")})$`}function UCe(e,t){return lr("KeyOf",[lr(e,t)])}function WCe(e){return lr("KeyOf",[xu(e)])}function qCe(e,t){let n=ba(e),r=jCe(n),i=_u(r);return fe(i,t)}function jCe(e){return e.map(t=>t==="[number]"?Cs():yn(t))}function _g(e,t){return _c(e)?UCe(e.target,e.parameters):Xr(e)?WCe(e.$ref):br(e)?X6(e,t):qCe(e,t)}function GCe(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=_g(e[r],_r(t));return n}function BCe(e,t){return GCe(e.properties,t)}function X6(e,t){let n=BCe(e,t);return Sn(n)}function ZI(e){let t=ba(e),n=av(e,t);return t.map((r,i)=>[t[i],n[i]])}function KCe(e){let t=[];for(let n of e)t.push(...ba(n));return C6(t)}function HCe(e){return e.filter(t=>!Up(t))}function VCe(e,t){let n=[];for(let r of e)n.push(...av(r,[t]));return HCe(n)}function zCe(e,t){let n={};for(let r of t)n[r]=XI(VCe(e,r));return n}function Q6(e,t){let n=KCe(e),r=zCe(e,n);return Mn(r,t)}function ek(e){return fe({[he]:"Date",type:"Date"},e)}function tk(e){return fe({[he]:"Null",type:"null"},e)}function nk(e){return fe({[he]:"Symbol",type:"symbol"},e)}function rk(e){return fe({[he]:"Undefined",type:"undefined"},e)}function ik(e){return fe({[he]:"Uint8Array",type:"Uint8Array"},e)}function Ic(e){return fe({[he]:"Unknown"},e)}function JCe(e){return e.map(t=>nM(t,!1))}function YCe(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=va(nM(e[n],!1));return t}function ok(e,t){return t===!0?e:va(e)}function nM(e,t){return ML(e)?ok(Gp(),t):DL(e)?ok(Gp(),t):ci(e)?va(Os(JCe(e))):Tl(e)?ik():Dm(e)?ek():zn(e)?ok(Mn(YCe(e)),t):NL(e)?ok(yu([],Ic()),t):ui(e)?rk():$L(e)?tk():FL(e)?nk():Jx(e)?fg():Va(e)?yn(e):wl(e)?yn(e):or(e)?yn(e):Mn({})}function Z6(e,t){return fe(nM(e,!0),t)}function eH(e,t){return xc(e)?Os(e.parameters,t):rn(t)}function tH(e,t){if(ui(e))throw new Error("Enum undefined or empty");let n=globalThis.Object.getOwnPropertyNames(e).filter(o=>isNaN(o)).map(o=>e[o]),i=[...new Set(n)].map(o=>yn(o));return Ln(i,{...t,[Rs]:"Enum"})}var iM=class extends Mt{},ge;(function(e){e[e.Union=0]="Union",e[e.True=1]="True",e[e.False=2]="False"})(ge||(ge={}));function Ls(e){return e===ge.False?e:ge.True}function xg(e){throw new iM(e)}function vi(e){return V.IsNever(e)||V.IsIntersect(e)||V.IsUnion(e)||V.IsUnknown(e)||V.IsAny(e)}function bi(e,t){return V.IsNever(t)?cH(e,t):V.IsIntersect(t)?ak(e,t):V.IsUnion(t)?cM(e,t):V.IsUnknown(t)?dH(e,t):V.IsAny(t)?sM(e,t):xg("StructuralRight")}function sM(e,t){return ge.True}function XCe(e,t){return V.IsIntersect(t)?ak(e,t):V.IsUnion(t)&&t.anyOf.some(n=>V.IsAny(n)||V.IsUnknown(n))?ge.True:V.IsUnion(t)?ge.Union:V.IsUnknown(t)||V.IsAny(t)?ge.True:ge.Union}function QCe(e,t){return V.IsUnknown(e)?ge.False:V.IsAny(e)?ge.Union:V.IsNever(e)?ge.True:ge.False}function ZCe(e,t){return V.IsObject(t)&&sk(t)?ge.True:vi(t)?bi(e,t):V.IsArray(t)?Ls(Yn(e.items,t.items)):ge.False}function eOe(e,t){return vi(t)?bi(e,t):V.IsAsyncIterator(t)?Ls(Yn(e.items,t.items)):ge.False}function tOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsBigInt(t)?ge.True:ge.False}function aH(e,t){return V.IsLiteralBoolean(e)||V.IsBoolean(e)?ge.True:ge.False}function nOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsBoolean(t)?ge.True:ge.False}function rOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsConstructor(t)?e.parameters.length>t.parameters.length?ge.False:e.parameters.every((n,r)=>Ls(Yn(t.parameters[r],n))===ge.True)?Ls(Yn(e.returns,t.returns)):ge.False:ge.False}function iOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsDate(t)?ge.True:ge.False}function oOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsFunction(t)?e.parameters.length>t.parameters.length?ge.False:e.parameters.every((n,r)=>Ls(Yn(t.parameters[r],n))===ge.True)?Ls(Yn(e.returns,t.returns)):ge.False:ge.False}function sH(e,t){return V.IsLiteral(e)&&Oo.IsNumber(e.const)||V.IsNumber(e)||V.IsInteger(e)?ge.True:ge.False}function aOe(e,t){return V.IsInteger(t)||V.IsNumber(t)?ge.True:vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):ge.False}function ak(e,t){return t.allOf.every(n=>Yn(e,n)===ge.True)?ge.True:ge.False}function sOe(e,t){return e.allOf.some(n=>Yn(n,t)===ge.True)?ge.True:ge.False}function cOe(e,t){return vi(t)?bi(e,t):V.IsIterator(t)?Ls(Yn(e.items,t.items)):ge.False}function uOe(e,t){return V.IsLiteral(t)&&t.const===e.const?ge.True:vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsString(t)?pH(e,t):V.IsNumber(t)?uH(e,t):V.IsInteger(t)?sH(e,t):V.IsBoolean(t)?aH(e,t):ge.False}function cH(e,t){return ge.False}function lOe(e,t){return ge.True}function nH(e){let[t,n]=[e,0];for(;V.IsNot(t);)t=t.not,n+=1;return n%2===0?t:Ic()}function pOe(e,t){return V.IsNot(e)?Yn(nH(e),t):V.IsNot(t)?Yn(e,nH(t)):xg("Invalid fallthrough for Not")}function dOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsNull(t)?ge.True:ge.False}function uH(e,t){return V.IsLiteralNumber(e)||V.IsNumber(e)||V.IsInteger(e)?ge.True:ge.False}function mOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsInteger(t)||V.IsNumber(t)?ge.True:ge.False}function wa(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function rH(e){return sk(e)}function iH(e){return wa(e,0)||wa(e,1)&&"description"in e.properties&&V.IsUnion(e.properties.description)&&e.properties.description.anyOf.length===2&&(V.IsString(e.properties.description.anyOf[0])&&V.IsUndefined(e.properties.description.anyOf[1])||V.IsString(e.properties.description.anyOf[1])&&V.IsUndefined(e.properties.description.anyOf[0]))}function rM(e){return wa(e,0)}function oH(e){return wa(e,0)}function fOe(e){return wa(e,0)}function hOe(e){return wa(e,0)}function gOe(e){return sk(e)}function yOe(e){let t=Cs();return wa(e,0)||wa(e,1)&&"length"in e.properties&&Ls(Yn(e.properties.length,t))===ge.True}function _Oe(e){return wa(e,0)}function sk(e){let t=Cs();return wa(e,0)||wa(e,1)&&"length"in e.properties&&Ls(Yn(e.properties.length,t))===ge.True}function xOe(e){let t=yu([Gp()],Gp());return wa(e,0)||wa(e,1)&&"then"in e.properties&&Ls(Yn(e.properties.then,t))===ge.True}function lH(e,t){return Yn(e,t)===ge.False||V.IsOptional(e)&&!V.IsOptional(t)?ge.False:ge.True}function Mo(e,t){return V.IsUnknown(e)?ge.False:V.IsAny(e)?ge.Union:V.IsNever(e)||V.IsLiteralString(e)&&rH(t)||V.IsLiteralNumber(e)&&rM(t)||V.IsLiteralBoolean(e)&&oH(t)||V.IsSymbol(e)&&iH(t)||V.IsBigInt(e)&&fOe(t)||V.IsString(e)&&rH(t)||V.IsSymbol(e)&&iH(t)||V.IsNumber(e)&&rM(t)||V.IsInteger(e)&&rM(t)||V.IsBoolean(e)&&oH(t)||V.IsUint8Array(e)&&gOe(t)||V.IsDate(e)&&hOe(t)||V.IsConstructor(e)&&_Oe(t)||V.IsFunction(e)&&yOe(t)?ge.True:V.IsRecord(e)&&V.IsString(oM(e))?t[Rs]==="Record"?ge.True:ge.False:V.IsRecord(e)&&V.IsNumber(oM(e))&&wa(t,0)?ge.True:ge.False}function vOe(e,t){return vi(t)?bi(e,t):V.IsRecord(t)?Ms(e,t):V.IsObject(t)?(()=>{for(let n of Object.getOwnPropertyNames(t.properties)){if(!(n in e.properties)&&!V.IsOptional(t.properties[n]))return ge.False;if(V.IsOptional(t.properties[n]))return ge.True;if(lH(e.properties[n],t.properties[n])===ge.False)return ge.False}return ge.True})():ge.False}function bOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)&&xOe(t)?ge.True:V.IsPromise(t)?Ls(Yn(e.item,t.item)):ge.False}function oM(e){return qp in e.patternProperties?Cs():jp in e.patternProperties?Qo():xg("Unknown record key pattern")}function aM(e){return qp in e.patternProperties?e.patternProperties[qp]:jp in e.patternProperties?e.patternProperties[jp]:xg("Unable to get record value schema")}function Ms(e,t){let[n,r]=[oM(t),aM(t)];return V.IsLiteralString(e)&&V.IsNumber(n)&&Ls(Yn(e,r))===ge.True?ge.True:V.IsUint8Array(e)&&V.IsNumber(n)||V.IsString(e)&&V.IsNumber(n)||V.IsArray(e)&&V.IsNumber(n)?Yn(e,r):V.IsObject(e)?(()=>{for(let i of Object.getOwnPropertyNames(e.properties))if(lH(r,e.properties[i])===ge.False)return ge.False;return ge.True})():ge.False}function wOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Yn(aM(e),aM(t)):ge.False}function TOe(e,t){let n=V.IsRegExp(e)?Qo():e,r=V.IsRegExp(t)?Qo():t;return Yn(n,r)}function pH(e,t){return V.IsLiteral(e)&&Oo.IsString(e.const)||V.IsString(e)?ge.True:ge.False}function IOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsString(t)?ge.True:ge.False}function kOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsSymbol(t)?ge.True:ge.False}function EOe(e,t){return V.IsTemplateLiteral(e)?Yn(Gm(e),t):V.IsTemplateLiteral(t)?Yn(e,Gm(t)):xg("Invalid fallthrough for TemplateLiteral")}function SOe(e,t){return V.IsArray(t)&&e.items!==void 0&&e.items.every(n=>Yn(n,t.items)===ge.True)}function AOe(e,t){return V.IsNever(e)?ge.True:V.IsUnknown(e)?ge.False:V.IsAny(e)?ge.Union:ge.False}function ROe(e,t){return vi(t)?bi(e,t):V.IsObject(t)&&sk(t)||V.IsArray(t)&&SOe(e,t)?ge.True:V.IsTuple(t)?Oo.IsUndefined(e.items)&&!Oo.IsUndefined(t.items)||!Oo.IsUndefined(e.items)&&Oo.IsUndefined(t.items)?ge.False:Oo.IsUndefined(e.items)&&!Oo.IsUndefined(t.items)||e.items.every((n,r)=>Yn(n,t.items[r])===ge.True)?ge.True:ge.False:ge.False}function COe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsUint8Array(t)?ge.True:ge.False}function OOe(e,t){return vi(t)?bi(e,t):V.IsObject(t)?Mo(e,t):V.IsRecord(t)?Ms(e,t):V.IsVoid(t)?MOe(e,t):V.IsUndefined(t)?ge.True:ge.False}function cM(e,t){return t.anyOf.some(n=>Yn(e,n)===ge.True)?ge.True:ge.False}function POe(e,t){return e.anyOf.every(n=>Yn(n,t)===ge.True)?ge.True:ge.False}function dH(e,t){return ge.True}function LOe(e,t){return V.IsNever(t)?cH(e,t):V.IsIntersect(t)?ak(e,t):V.IsUnion(t)?cM(e,t):V.IsAny(t)?sM(e,t):V.IsString(t)?pH(e,t):V.IsNumber(t)?uH(e,t):V.IsInteger(t)?sH(e,t):V.IsBoolean(t)?aH(e,t):V.IsArray(t)?QCe(e,t):V.IsTuple(t)?AOe(e,t):V.IsObject(t)?Mo(e,t):V.IsUnknown(t)?ge.True:ge.False}function MOe(e,t){return V.IsUndefined(e)||V.IsUndefined(e)?ge.True:ge.False}function NOe(e,t){return V.IsIntersect(t)?ak(e,t):V.IsUnion(t)?cM(e,t):V.IsUnknown(t)?dH(e,t):V.IsAny(t)?sM(e,t):V.IsObject(t)?Mo(e,t):V.IsVoid(t)?ge.True:ge.False}function Yn(e,t){return V.IsTemplateLiteral(e)||V.IsTemplateLiteral(t)?EOe(e,t):V.IsRegExp(e)||V.IsRegExp(t)?TOe(e,t):V.IsNot(e)||V.IsNot(t)?pOe(e,t):V.IsAny(e)?XCe(e,t):V.IsArray(e)?ZCe(e,t):V.IsBigInt(e)?tOe(e,t):V.IsBoolean(e)?nOe(e,t):V.IsAsyncIterator(e)?eOe(e,t):V.IsConstructor(e)?rOe(e,t):V.IsDate(e)?iOe(e,t):V.IsFunction(e)?oOe(e,t):V.IsInteger(e)?aOe(e,t):V.IsIntersect(e)?sOe(e,t):V.IsIterator(e)?cOe(e,t):V.IsLiteral(e)?uOe(e,t):V.IsNever(e)?lOe(e,t):V.IsNull(e)?dOe(e,t):V.IsNumber(e)?mOe(e,t):V.IsObject(e)?vOe(e,t):V.IsRecord(e)?wOe(e,t):V.IsString(e)?IOe(e,t):V.IsSymbol(e)?kOe(e,t):V.IsTuple(e)?ROe(e,t):V.IsPromise(e)?bOe(e,t):V.IsUint8Array(e)?COe(e,t):V.IsUndefined(e)?OOe(e,t):V.IsUnion(e)?POe(e,t):V.IsUnknown(e)?LOe(e,t):V.IsVoid(e)?NOe(e,t):xg(`Unknown left type operand '${e[he]}'`)}function Kp(e,t){return Yn(e,t)}function DOe(e,t,n,r,i){let o={};for(let a of globalThis.Object.getOwnPropertyNames(e))o[a]=vg(e[a],t,n,r,_r(i));return o}function $Oe(e,t,n,r,i){return DOe(e.properties,t,n,r,i)}function mH(e,t,n,r,i){let o=$Oe(e,t,n,r,i);return Sn(o)}function FOe(e,t,n,r){let i=Kp(e,t);return i===ge.Union?Ln([n,r]):i===ge.True?n:r}function vg(e,t,n,r,i){return br(e)?mH(e,t,n,r,i):Ya(e)?fe(fH(e,t,n,r,i)):fe(FOe(e,t,n,r),i)}function UOe(e,t,n,r,i){return{[e]:vg(yn(e),t,n,r,_r(i))}}function WOe(e,t,n,r,i){return e.reduce((o,a)=>({...o,...UOe(a,t,n,r,i)}),{})}function qOe(e,t,n,r,i){return WOe(e.keys,t,n,r,i)}function fH(e,t,n,r,i){let o=qOe(e,t,n,r,i);return Sn(o)}function jOe(e){return e.allOf.every(t=>Bm(t))}function GOe(e){return e.anyOf.some(t=>Bm(t))}function BOe(e){return!Bm(e.not)}function Bm(e){return e[he]==="Intersect"?jOe(e):e[he]==="Union"?GOe(e):e[he]==="Not"?BOe(e):e[he]==="Undefined"}function hH(e,t){return bg(Gm(e),t)}function KOe(e,t){let n=e.filter(r=>Kp(r,t)===ge.False);return n.length===1?n[0]:Ln(n)}function bg(e,t,n={}){return Xa(e)?fe(hH(e,t),n):br(e)?fe(gH(e,t),n):fe(xn(e)?KOe(e.anyOf,t):Kp(e,t)!==ge.False?rn():e,n)}function HOe(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=bg(e[r],t);return n}function VOe(e,t){return HOe(e.properties,t)}function gH(e,t){let n=VOe(e,t);return Sn(n)}function yH(e,t){return wg(Gm(e),t)}function zOe(e,t){let n=e.filter(r=>Kp(r,t)!==ge.False);return n.length===1?n[0]:Ln(n)}function wg(e,t,n){return Xa(e)?fe(yH(e,t),n):br(e)?fe(_H(e,t),n):fe(xn(e)?zOe(e.anyOf,t):Kp(e,t)!==ge.False?e:rn(),n)}function JOe(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=wg(e[r],t);return n}function YOe(e,t){return JOe(e.properties,t)}function _H(e,t){let n=YOe(e,t);return Sn(n)}function xH(e,t){return xc(e)?fe(e.returns,t):rn(t)}function ck(e){return va(Po(e))}function Km(e,t,n){return fe({[he]:"Record",type:"object",patternProperties:{[e]:t}},n)}function uM(e,t,n){let r={};for(let i of e)r[i]=t;return Mn(r,{...n,[Rs]:"Record"})}function XOe(e,t,n){return zI(e)?uM(xa(e),t,n):Km(e.pattern,t,n)}function QOe(e,t,n){return uM(xa(Ln(e)),t,n)}function ZOe(e,t,n){return uM([e.toString()],t,n)}function ePe(e,t,n){return Km(e.source,t,n)}function tPe(e,t,n){let r=ui(e.pattern)?jp:e.pattern;return Km(r,t,n)}function nPe(e,t,n){return Km(jp,t,n)}function rPe(e,t,n){return Km(A6,t,n)}function iPe(e,t,n){return Mn({true:t,false:t},n)}function oPe(e,t,n){return Km(qp,t,n)}function aPe(e,t,n){return Km(qp,t,n)}function uk(e,t,n={}){return xn(e)?QOe(e.anyOf,t,n):Xa(e)?XOe(e,t,n):Ja(e)?ZOe(e.const,t,n):El(e)?iPe(e,t,n):bc(e)?oPe(e,t,n):wc(e)?aPe(e,t,n):jL(e)?ePe(e,t,n):Sl(e)?tPe(e,t,n):WL(e)?nPe(e,t,n):Up(e)?rPe(e,t,n):rn(n)}function lk(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function vH(e){let t=lk(e);return t===jp?Qo():t===qp?Cs():Qo({pattern:t})}function pk(e){return e.patternProperties[lk(e)]}function sPe(e,t){return t.parameters=uv(e,t.parameters),t.returns=kc(e,t.returns),t}function cPe(e,t){return t.parameters=uv(e,t.parameters),t.returns=kc(e,t.returns),t}function uPe(e,t){return t.allOf=uv(e,t.allOf),t}function lPe(e,t){return t.anyOf=uv(e,t.anyOf),t}function pPe(e,t){return ui(t.items)||(t.items=uv(e,t.items)),t}function dPe(e,t){return t.items=kc(e,t.items),t}function mPe(e,t){return t.items=kc(e,t.items),t}function fPe(e,t){return t.items=kc(e,t.items),t}function hPe(e,t){return t.item=kc(e,t.item),t}function gPe(e,t){let n=vPe(e,t.properties);return{...t,...Mn(n)}}function yPe(e,t){let n=kc(e,vH(t)),r=kc(e,pk(t)),i=uk(n,r);return{...t,...i}}function _Pe(e,t){return t.index in e?e[t.index]:Ic()}function xPe(e,t){let n=og(t),r=_a(t),i=kc(e,t);return n&&r?ck(i):n&&!r?va(i):!n&&r?Po(i):i}function vPe(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:xPe(e,t[r])}),{})}function uv(e,t){return t.map(n=>kc(e,n))}function kc(e,t){return xc(t)?sPe(e,t):vc(t)?cPe(e,t):Gr(t)?uPe(e,t):xn(t)?lPe(e,t):Qa(t)?pPe(e,t):yc(t)?dPe(e,t):$m(t)?mPe(e,t):Um(t)?fPe(e,t):Wm(t)?hPe(e,t):li(t)?gPe(e,t):qm(t)?yPe(e,t):qL(t)?_Pe(e,t):t}function bH(e,t){return kc(t,rg(e))}function wH(e){return fe({[he]:"Integer",type:"integer"},e)}function bPe(e,t,n){return{[e]:Ec(yn(e),t,_r(n))}}function wPe(e,t,n){return e.reduce((i,o)=>({...i,...bPe(o,t,n)}),{})}function TPe(e,t,n){return wPe(e.keys,t,n)}function TH(e,t,n){let r=TPe(e,t,n);return Sn(r)}function IPe(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),n].join("")}function kPe(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),n].join("")}function EPe(e){return e.toUpperCase()}function SPe(e){return e.toLowerCase()}function APe(e,t,n){let r=dg(e.pattern);if(!jm(r))return{...e,pattern:IH(e.pattern,t)};let a=[...ov(r)].map(l=>yn(l)),c=kH(a,t),u=Ln(c);return YI([u],n)}function IH(e,t){return typeof e=="string"?t==="Uncapitalize"?IPe(e):t==="Capitalize"?kPe(e):t==="Uppercase"?EPe(e):t==="Lowercase"?SPe(e):e:e.toString()}function kH(e,t){return e.map(n=>Ec(n,t))}function Ec(e,t,n={}){return Ya(e)?TH(e,t,n):Xa(e)?APe(e,t,n):xn(e)?Ln(kH(e.anyOf,t),n):Ja(e)?yn(IH(e.const,t),n):fe(e,n)}function EH(e,t={}){return Ec(e,"Capitalize",t)}function SH(e,t={}){return Ec(e,"Lowercase",t)}function AH(e,t={}){return Ec(e,"Uncapitalize",t)}function RH(e,t={}){return Ec(e,"Uppercase",t)}function RPe(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=Hp(e[i],t,_r(n));return r}function CPe(e,t,n){return RPe(e.properties,t,n)}function CH(e,t,n){let r=CPe(e,t,n);return Sn(r)}function OPe(e,t){return e.map(n=>lM(n,t))}function PPe(e,t){return e.map(n=>lM(n,t))}function LPe(e,t){let{[t]:n,...r}=e;return r}function MPe(e,t){return t.reduce((n,r)=>LPe(n,r),e)}function NPe(e,t,n){let r=Br(e,[Or,"$id","required","properties"]),i=MPe(n,t);return Mn(i,r)}function DPe(e){let t=e.reduce((n,r)=>KI(r)?[...n,yn(r)]:n,[]);return Ln(t)}function lM(e,t){return Gr(e)?Lo(OPe(e.allOf,t)):xn(e)?Ln(PPe(e.anyOf,t)):li(e)?NPe(e,t,e.properties):Mn({})}function Hp(e,t,n){let r=ci(t)?DPe(t):t,i=Pr(t)?xa(t):t,o=Xr(e),a=Xr(t);return br(e)?CH(e,i,n):Ya(t)?OH(e,t,n):o&&a?lr("Omit",[e,r],n):!o&&a?lr("Omit",[e,r],n):o&&!a?lr("Omit",[e,r],n):fe({...lM(e,i),...n})}function $Pe(e,t,n){return{[t]:Hp(e,[t],_r(n))}}function FPe(e,t,n){return t.reduce((r,i)=>({...r,...$Pe(e,i,n)}),{})}function UPe(e,t,n){return FPe(e,t.keys,n)}function OH(e,t,n){let r=UPe(e,t,n);return Sn(r)}function WPe(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=Vp(e[i],t,_r(n));return r}function qPe(e,t,n){return WPe(e.properties,t,n)}function PH(e,t,n){let r=qPe(e,t,n);return Sn(r)}function jPe(e,t){return e.map(n=>pM(n,t))}function GPe(e,t){return e.map(n=>pM(n,t))}function BPe(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function KPe(e,t,n){let r=Br(e,[Or,"$id","required","properties"]),i=BPe(n,t);return Mn(i,r)}function HPe(e){let t=e.reduce((n,r)=>KI(r)?[...n,yn(r)]:n,[]);return Ln(t)}function pM(e,t){return Gr(e)?Lo(jPe(e.allOf,t)):xn(e)?Ln(GPe(e.anyOf,t)):li(e)?KPe(e,t,e.properties):Mn({})}function Vp(e,t,n){let r=ci(t)?HPe(t):t,i=Pr(t)?xa(t):t,o=Xr(e),a=Xr(t);return br(e)?PH(e,i,n):Ya(t)?LH(e,t,n):o&&a?lr("Pick",[e,r],n):!o&&a?lr("Pick",[e,r],n):o&&!a?lr("Pick",[e,r],n):fe({...pM(e,i),...n})}function VPe(e,t,n){return{[t]:Vp(e,[t],_r(n))}}function zPe(e,t,n){return t.reduce((r,i)=>({...r,...VPe(e,i,n)}),{})}function JPe(e,t,n){return zPe(e,t.keys,n)}function LH(e,t,n){let r=JPe(e,t,n);return Sn(r)}function YPe(e,t){return lr("Partial",[lr(e,t)])}function XPe(e){return lr("Partial",[xu(e)])}function QPe(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=Po(e[n]);return t}function ZPe(e,t){let n=Br(e,[Or,"$id","required","properties"]),r=QPe(t);return Mn(r,n)}function MH(e){return e.map(t=>NH(t))}function NH(e){return _c(e)?YPe(e.target,e.parameters):Xr(e)?XPe(e.$ref):Gr(e)?Lo(MH(e.allOf)):xn(e)?Ln(MH(e.anyOf)):li(e)?ZPe(e,e.properties):Fm(e)||El(e)||bc(e)||Ja(e)||Qx(e)||wc(e)||Sl(e)||Zx(e)||Al(e)?e:Mn({})}function Tg(e,t){return br(e)?DH(e,t):fe({...NH(e),...t})}function e1e(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Tg(e[r],_r(t));return n}function t1e(e,t){return e1e(e.properties,t)}function DH(e,t){let n=t1e(e,t);return Sn(n)}function n1e(e,t){return lr("Required",[lr(e,t)])}function r1e(e){return lr("Required",[xu(e)])}function i1e(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=Br(e[n],[fo]);return t}function o1e(e,t){let n=Br(e,[Or,"$id","required","properties"]),r=i1e(t);return Mn(r,n)}function $H(e){return e.map(t=>FH(t))}function FH(e){return _c(e)?n1e(e.target,e.parameters):Xr(e)?r1e(e.$ref):Gr(e)?Lo($H(e.allOf)):xn(e)?Ln($H(e.anyOf)):li(e)?o1e(e,e.properties):Fm(e)||El(e)||bc(e)||Ja(e)||Qx(e)||wc(e)||Sl(e)||Zx(e)||Al(e)?e:Mn({})}function Ig(e,t){return br(e)?UH(e,t):fe({...FH(e),...t})}function a1e(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Ig(e[r],t);return n}function s1e(e,t){return a1e(e.properties,t)}function UH(e,t){let n=s1e(e,t);return Sn(n)}function c1e(e,t){return t.map(n=>Xr(n)?dM(e,n.$ref):Za(e,n))}function dM(e,t){return t in e?Xr(e[t])?dM(e,e[t].$ref):Za(e,e[t]):rn()}function u1e(e){return gg(e[0])}function l1e(e){return Bp(e[0],e[1])}function p1e(e){return _g(e[0])}function d1e(e){return Tg(e[0])}function m1e(e){return Hp(e[0],e[1])}function f1e(e){return Vp(e[0],e[1])}function h1e(e){return Ig(e[0])}function g1e(e,t,n){let r=c1e(e,n);return t==="Awaited"?u1e(r):t==="Index"?l1e(r):t==="KeyOf"?p1e(r):t==="Partial"?d1e(r):t==="Omit"?m1e(r):t==="Pick"?f1e(r):t==="Required"?h1e(r):rn()}function y1e(e,t){return cg(Za(e,t))}function _1e(e,t){return ug(Za(e,t))}function x1e(e,t,n){return lg(lv(e,t),Za(e,n))}function v1e(e,t,n){return yu(lv(e,t),Za(e,n))}function b1e(e,t){return Lo(lv(e,t))}function w1e(e,t){return hg(Za(e,t))}function T1e(e,t){return Mn(globalThis.Object.keys(t).reduce((n,r)=>({...n,[r]:Za(e,t[r])}),{}))}function I1e(e,t){let[n,r]=[Za(e,pk(t)),lk(t)],i=rg(t);return i.patternProperties[r]=n,i}function k1e(e,t){return Xr(t)?{...dM(e,t.$ref),[Or]:t[Or]}:t}function E1e(e,t){return Os(lv(e,t))}function S1e(e,t){return Ln(lv(e,t))}function lv(e,t){return t.map(n=>Za(e,n))}function Za(e,t){return _a(t)?fe(Za(e,Br(t,[fo])),t):og(t)?fe(Za(e,Br(t,[gc])),t):Pn(t)?fe(k1e(e,t),t):yc(t)?fe(y1e(e,t.items),t):$m(t)?fe(_1e(e,t.items),t):_c(t)?fe(g1e(e,t.target,t.parameters)):xc(t)?fe(x1e(e,t.parameters,t.returns),t):vc(t)?fe(v1e(e,t.parameters,t.returns),t):Gr(t)?fe(b1e(e,t.allOf),t):Um(t)?fe(w1e(e,t.items),t):li(t)?fe(T1e(e,t.properties),t):qm(t)?fe(I1e(e,t)):Qa(t)?fe(E1e(e,t.items||[]),t):xn(t)?fe(S1e(e,t.anyOf),t):t}function A1e(e,t){return t in e?Za(e,e[t]):rn()}function WH(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:A1e(e,n)}),{})}var mM=class{constructor(t){let n=WH(t),r=this.WithIdentifiers(n);this.$defs=r}Import(t,n){let r={...this.$defs,[t]:fe(this.$defs[t],n)};return fe({[he]:"Import",$defs:r,$ref:t})}WithIdentifiers(t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:{...t[r],$id:r}}),{})}};function qH(e){return new mM(e)}function jH(e,t){return fe({[he]:"Not",not:e},t)}function GH(e,t){return vc(e)?Os(e.parameters,t):rn()}var R1e=0;function BH(e,t={}){ui(t.$id)&&(t.$id=`T${R1e++}`);let n=rg(e({[he]:"This",$ref:`${t.$id}`}));return n.$id=t.$id,fe({[Rs]:"Recursive",...n},t)}function KH(e,t){let n=or(e)?new globalThis.RegExp(e):e;return fe({[he]:"RegExp",type:"RegExp",source:n.source,flags:n.flags},t)}function C1e(e){return Gr(e)?e.allOf:xn(e)?e.anyOf:Qa(e)?e.items??[]:[]}function HH(e){return C1e(e)}function VH(e,t){return vc(e)?fe(e.returns,t):rn(t)}var fM=class{constructor(t){this.schema=t}Decode(t){return new hM(this.schema,t)}},hM=class{constructor(t,n){this.schema=t,this.decode=n}EncodeTransform(t,n){let o={Encode:a=>n[Or].Encode(t(a)),Decode:a=>this.decode(n[Or].Decode(a))};return{...n,[Or]:o}}EncodeSchema(t,n){let r={Decode:this.decode,Encode:t};return{...n,[Or]:r}}Encode(t){return Pn(this.schema)?this.EncodeTransform(t,this.schema):this.EncodeSchema(t,this.schema)}};function zH(e){return new fM(e)}function JH(e={}){return fe({[he]:e[he]??"Unsafe"},e)}function YH(e){return fe({[he]:"Void",type:"void"},e)}var gM={};On(gM,{Any:()=>Gp,Argument:()=>L6,Array:()=>cg,AsyncIterator:()=>ug,Awaited:()=>gg,BigInt:()=>fg,Boolean:()=>JI,Capitalize:()=>EH,Composite:()=>Q6,Const:()=>Z6,Constructor:()=>lg,ConstructorParameters:()=>eH,Date:()=>ek,Enum:()=>tH,Exclude:()=>bg,Extends:()=>vg,Extract:()=>wg,Function:()=>yu,Index:()=>Bp,InstanceType:()=>xH,Instantiate:()=>bH,Integer:()=>wH,Intersect:()=>Lo,Iterator:()=>hg,KeyOf:()=>_g,Literal:()=>yn,Lowercase:()=>SH,Mapped:()=>H6,Module:()=>qH,Never:()=>rn,Not:()=>jH,Null:()=>tk,Number:()=>Cs,Object:()=>Mn,Omit:()=>Hp,Optional:()=>Po,Parameters:()=>GH,Partial:()=>Tg,Pick:()=>Vp,Promise:()=>QI,Readonly:()=>va,ReadonlyOptional:()=>ck,Record:()=>uk,Recursive:()=>BH,Ref:()=>xu,RegExp:()=>KH,Required:()=>Ig,Rest:()=>HH,ReturnType:()=>VH,String:()=>Qo,Symbol:()=>nk,TemplateLiteral:()=>YI,Transform:()=>zH,Tuple:()=>Os,Uint8Array:()=>ik,Uncapitalize:()=>AH,Undefined:()=>rk,Union:()=>Ln,Unknown:()=>Ic,Unsafe:()=>JH,Uppercase:()=>RH,Void:()=>YH});var s=gM;var O1e=s.String(),P1e=s.Literal("1.0.0");function L1e(e){switch(e.errorType){case de.ArrayContains:return"Expected array to contain at least one matching value";case de.ArrayMaxContains:return`Expected array to contain no more than ${e.schema.maxContains} matching values`;case de.ArrayMinContains:return`Expected array to contain at least ${e.schema.minContains} matching values`;case de.ArrayMaxItems:return`Expected array length to be less or equal to ${e.schema.maxItems}`;case de.ArrayMinItems:return`Expected array length to be greater or equal to ${e.schema.minItems}`;case de.ArrayUniqueItems:return"Expected array elements to be unique";case de.Array:return"Expected array";case de.AsyncIterator:return"Expected AsyncIterator";case de.BigIntExclusiveMaximum:return`Expected bigint to be less than ${e.schema.exclusiveMaximum}`;case de.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${e.schema.exclusiveMinimum}`;case de.BigIntMaximum:return`Expected bigint to be less or equal to ${e.schema.maximum}`;case de.BigIntMinimum:return`Expected bigint to be greater or equal to ${e.schema.minimum}`;case de.BigIntMultipleOf:return`Expected bigint to be a multiple of ${e.schema.multipleOf}`;case de.BigInt:return"Expected bigint";case de.Boolean:return"Expected boolean";case de.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${e.schema.exclusiveMinimumTimestamp}`;case de.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${e.schema.exclusiveMaximumTimestamp}`;case de.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${e.schema.minimumTimestamp}`;case de.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${e.schema.maximumTimestamp}`;case de.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${e.schema.multipleOfTimestamp}`;case de.Date:return"Expected Date";case de.Function:return"Expected function";case de.IntegerExclusiveMaximum:return`Expected integer to be less than ${e.schema.exclusiveMaximum}`;case de.IntegerExclusiveMinimum:return`Expected integer to be greater than ${e.schema.exclusiveMinimum}`;case de.IntegerMaximum:return`Expected integer to be less or equal to ${e.schema.maximum}`;case de.IntegerMinimum:return`Expected integer to be greater or equal to ${e.schema.minimum}`;case de.IntegerMultipleOf:return`Expected integer to be a multiple of ${e.schema.multipleOf}`;case de.Integer:return"Expected integer";case de.IntersectUnevaluatedProperties:return"Unexpected property";case de.Intersect:return"Expected all values to match";case de.Iterator:return"Expected Iterator";case de.Literal:return`Expected ${typeof e.schema.const=="string"?`'${e.schema.const}'`:e.schema.const}`;case de.Never:return"Never";case de.Not:return"Value should not match";case de.Null:return"Expected null";case de.NumberExclusiveMaximum:return`Expected number to be less than ${e.schema.exclusiveMaximum}`;case de.NumberExclusiveMinimum:return`Expected number to be greater than ${e.schema.exclusiveMinimum}`;case de.NumberMaximum:return`Expected number to be less or equal to ${e.schema.maximum}`;case de.NumberMinimum:return`Expected number to be greater or equal to ${e.schema.minimum}`;case de.NumberMultipleOf:return`Expected number to be a multiple of ${e.schema.multipleOf}`;case de.Number:return"Expected number";case de.Object:return"Expected object";case de.ObjectAdditionalProperties:return"Unexpected property";case de.ObjectMaxProperties:return`Expected object to have no more than ${e.schema.maxProperties} properties`;case de.ObjectMinProperties:return`Expected object to have at least ${e.schema.minProperties} properties`;case de.ObjectRequiredProperty:return"Expected required property";case de.Promise:return"Expected Promise";case de.RegExp:return"Expected string to match regular expression";case de.StringFormatUnknown:return`Unknown format '${e.schema.format}'`;case de.StringFormat:return`Expected string to match '${e.schema.format}' format`;case de.StringMaxLength:return`Expected string length less or equal to ${e.schema.maxLength}`;case de.StringMinLength:return`Expected string length greater or equal to ${e.schema.minLength}`;case de.StringPattern:return`Expected string to match '${e.schema.pattern}'`;case de.String:return"Expected string";case de.Symbol:return"Expected symbol";case de.TupleLength:return`Expected tuple to have ${e.schema.maxItems||0} elements`;case de.Tuple:return"Expected tuple";case de.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${e.schema.maxByteLength}`;case de.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${e.schema.minByteLength}`;case de.Uint8Array:return"Expected Uint8Array";case de.Undefined:return"Expected undefined";case de.Union:return"Expected union value";case de.Void:return"Expected void";case de.Kind:return`Expected kind '${e.schema[he]}'`;default:return"Unknown error type"}}var M1e=L1e;function XH(){return M1e}var yM=class extends Mt{constructor(t){super(`Unable to dereference schema with $id '${t.$ref}'`),this.schema=t}};function N1e(e,t){let n=t.find(r=>r.$id===e.$ref);if(n===void 0)throw new yM(e);return Nn(n,t)}function zi(e,t){return!qn(e.$id)||t.some(n=>n.$id===e.$id)||t.push(e),t}function Nn(e,t){return e[he]==="This"||e[he]==="Ref"?N1e(e,t):e}var _M=class extends Mt{constructor(t){super("Unable to hash value"),this.value=t}},es;(function(e){e[e.Undefined=0]="Undefined",e[e.Null=1]="Null",e[e.Boolean=2]="Boolean",e[e.Number=3]="Number",e[e.String=4]="String",e[e.Object=5]="Object",e[e.Array=6]="Array",e[e.Date=7]="Date",e[e.Uint8Array=8]="Uint8Array",e[e.Symbol=9]="Symbol",e[e.BigInt=10]="BigInt"})(es||(es={}));var kg=BigInt("14695981039346656037"),[D1e,$1e]=[BigInt("1099511628211"),BigInt("18446744073709551616")],F1e=Array.from({length:256}).map((e,t)=>BigInt(t)),QH=new Float64Array(1),ZH=new DataView(QH.buffer),eV=new Uint8Array(QH.buffer);function*U1e(e){let t=e===0?1:Math.ceil(Math.floor(Math.log2(e)+1)/8);for(let n=0;n<t;n++)yield e>>8*(t-1-n)&255}function W1e(e){No(es.Array);for(let t of e)Eg(t)}function q1e(e){No(es.Boolean),No(e?1:0)}function j1e(e){No(es.BigInt),ZH.setBigInt64(0,e);for(let t of eV)No(t)}function G1e(e){No(es.Date),Eg(e.getTime())}function B1e(e){No(es.Null)}function K1e(e){No(es.Number),ZH.setFloat64(0,e);for(let t of eV)No(t)}function H1e(e){No(es.Object);for(let t of globalThis.Object.getOwnPropertyNames(e).sort())Eg(t),Eg(e[t])}function V1e(e){No(es.String);for(let t=0;t<e.length;t++)for(let n of U1e(e.charCodeAt(t)))No(n)}function z1e(e){No(es.Symbol),Eg(e.description)}function J1e(e){No(es.Uint8Array);for(let t=0;t<e.length;t++)No(e[t])}function Y1e(e){return No(es.Undefined)}function Eg(e){if(Rt(e))return W1e(e);if(hu(e))return q1e(e);if(hc(e))return j1e(e);if(Xo(e))return G1e(e);if(Il(e))return B1e(e);if(vr(e))return K1e(e);if(Ut(e))return H1e(e);if(qn(e))return V1e(e);if(kl(e))return z1e(e);if(ig(e))return J1e(e);if(xr(e))return Y1e(e);throw new _M(e)}function No(e){kg=kg^F1e[e],kg=kg*D1e%$1e}function Sg(e){return kg=BigInt("14695981039346656037"),Eg(e),kg}var xM=class extends Mt{constructor(t){super("Unknown type"),this.schema=t}};function X1e(e){return e[he]==="Any"||e[he]==="Unknown"}function dn(e){return e!==void 0}function Q1e(e,t,n){return!0}function Z1e(e,t,n){return!0}function eLe(e,t,n){if(!Rt(n)||dn(e.minItems)&&!(n.length>=e.minItems)||dn(e.maxItems)&&!(n.length<=e.maxItems))return!1;for(let o of n)if(!Ji(e.items,t,o))return!1;if(e.uniqueItems===!0&&!(function(){let o=new Set;for(let a of n){let c=Sg(a);if(o.has(c))return!1;o.add(c)}return!0})())return!1;if(!(dn(e.contains)||vr(e.minContains)||vr(e.maxContains)))return!0;let r=dn(e.contains)?e.contains:rn(),i=n.reduce((o,a)=>Ji(r,t,a)?o+1:o,0);return!(i===0||vr(e.minContains)&&i<e.minContains||vr(e.maxContains)&&i>e.maxContains)}function tLe(e,t,n){return qI(n)}function nLe(e,t,n){return!(!hc(n)||dn(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||dn(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||dn(e.maximum)&&!(n<=e.maximum)||dn(e.minimum)&&!(n>=e.minimum)||dn(e.multipleOf)&&n%e.multipleOf!==BigInt(0))}function rLe(e,t,n){return hu(n)}function iLe(e,t,n){return Ji(e.returns,t,n.prototype)}function oLe(e,t,n){return!(!Xo(n)||dn(e.exclusiveMaximumTimestamp)&&!(n.getTime()<e.exclusiveMaximumTimestamp)||dn(e.exclusiveMinimumTimestamp)&&!(n.getTime()>e.exclusiveMinimumTimestamp)||dn(e.maximumTimestamp)&&!(n.getTime()<=e.maximumTimestamp)||dn(e.minimumTimestamp)&&!(n.getTime()>=e.minimumTimestamp)||dn(e.multipleOfTimestamp)&&n.getTime()%e.multipleOfTimestamp!==0)}function aLe(e,t,n){return Fp(n)}function sLe(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Ji(i,[...t,...r],n)}function cLe(e,t,n){return!(!BI(n)||dn(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||dn(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||dn(e.maximum)&&!(n<=e.maximum)||dn(e.minimum)&&!(n>=e.minimum)||dn(e.multipleOf)&&n%e.multipleOf!==0)}function uLe(e,t,n){let r=e.allOf.every(i=>Ji(i,t,n));if(e.unevaluatedProperties===!1){let i=new RegExp(yg(e)),o=Object.getOwnPropertyNames(n).every(a=>i.test(a));return r&&o}else if(Pr(e.unevaluatedProperties)){let i=new RegExp(yg(e)),o=Object.getOwnPropertyNames(n).every(a=>i.test(a)||Ji(e.unevaluatedProperties,t,n[a]));return r&&o}else return r}function lLe(e,t,n){return jI(n)}function pLe(e,t,n){return n===e.const}function dLe(e,t,n){return!1}function mLe(e,t,n){return!Ji(e.not,t,n)}function fLe(e,t,n){return Il(n)}function hLe(e,t,n){return!(!xi.IsNumberLike(n)||dn(e.exclusiveMaximum)&&!(n<e.exclusiveMaximum)||dn(e.exclusiveMinimum)&&!(n>e.exclusiveMinimum)||dn(e.minimum)&&!(n>=e.minimum)||dn(e.maximum)&&!(n<=e.maximum)||dn(e.multipleOf)&&n%e.multipleOf!==0)}function gLe(e,t,n){if(!xi.IsObjectLike(n)||dn(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||dn(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let r=Object.getOwnPropertyNames(e.properties);for(let i of r){let o=e.properties[i];if(e.required&&e.required.includes(i)){if(!Ji(o,t,n[i])||(Bm(o)||X1e(o))&&!(i in n))return!1}else if(xi.IsExactOptionalProperty(n,i)&&!Ji(o,t,n[i]))return!1}if(e.additionalProperties===!1){let i=Object.getOwnPropertyNames(n);return e.required&&e.required.length===r.length&&i.length===r.length?!0:i.every(o=>r.includes(o))}else return typeof e.additionalProperties=="object"?Object.getOwnPropertyNames(n).every(o=>r.includes(o)||Ji(e.additionalProperties,t,n[o])):!0}function yLe(e,t,n){return GI(n)}function _Le(e,t,n){if(!xi.IsRecordLike(n)||dn(e.minProperties)&&!(Object.getOwnPropertyNames(n).length>=e.minProperties)||dn(e.maxProperties)&&!(Object.getOwnPropertyNames(n).length<=e.maxProperties))return!1;let[r,i]=Object.entries(e.patternProperties)[0],o=new RegExp(r),a=Object.entries(n).every(([l,d])=>o.test(l)?Ji(i,t,d):!0),c=typeof e.additionalProperties=="object"?Object.entries(n).every(([l,d])=>o.test(l)?!0:Ji(e.additionalProperties,t,d)):!0,u=e.additionalProperties===!1?Object.getOwnPropertyNames(n).every(l=>o.test(l)):!0;return a&&c&&u}function xLe(e,t,n){return Ji(Nn(e,t),t,n)}function vLe(e,t,n){let r=new RegExp(e.source,e.flags);return dn(e.minLength)&&!(n.length>=e.minLength)||dn(e.maxLength)&&!(n.length<=e.maxLength)?!1:r.test(n)}function bLe(e,t,n){return!qn(n)||dn(e.minLength)&&!(n.length>=e.minLength)||dn(e.maxLength)&&!(n.length<=e.maxLength)||dn(e.pattern)&&!new RegExp(e.pattern).test(n)?!1:dn(e.format)?gu.Has(e.format)?gu.Get(e.format)(n):!1:!0}function wLe(e,t,n){return kl(n)}function TLe(e,t,n){return qn(n)&&new RegExp(e.pattern).test(n)}function ILe(e,t,n){return Ji(Nn(e,t),t,n)}function kLe(e,t,n){if(!Rt(n)||e.items===void 0&&n.length!==0||n.length!==e.maxItems)return!1;if(!e.items)return!0;for(let r=0;r<e.items.length;r++)if(!Ji(e.items[r],t,n[r]))return!1;return!0}function ELe(e,t,n){return xr(n)}function SLe(e,t,n){return e.anyOf.some(r=>Ji(r,t,n))}function ALe(e,t,n){return!(!ig(n)||dn(e.maxByteLength)&&!(n.length<=e.maxByteLength)||dn(e.minByteLength)&&!(n.length>=e.minByteLength))}function RLe(e,t,n){return!0}function CLe(e,t,n){return xi.IsVoidLike(n)}function OLe(e,t,n){return Tc.Has(e[he])?Tc.Get(e[he])(e,n):!1}function Ji(e,t,n){let r=dn(e.$id)?zi(e,t):t,i=e;switch(i[he]){case"Any":return Q1e(i,r,n);case"Argument":return Z1e(i,r,n);case"Array":return eLe(i,r,n);case"AsyncIterator":return tLe(i,r,n);case"BigInt":return nLe(i,r,n);case"Boolean":return rLe(i,r,n);case"Constructor":return iLe(i,r,n);case"Date":return oLe(i,r,n);case"Function":return aLe(i,r,n);case"Import":return sLe(i,r,n);case"Integer":return cLe(i,r,n);case"Intersect":return uLe(i,r,n);case"Iterator":return lLe(i,r,n);case"Literal":return pLe(i,r,n);case"Never":return dLe(i,r,n);case"Not":return mLe(i,r,n);case"Null":return fLe(i,r,n);case"Number":return hLe(i,r,n);case"Object":return gLe(i,r,n);case"Promise":return yLe(i,r,n);case"Record":return _Le(i,r,n);case"Ref":return xLe(i,r,n);case"RegExp":return vLe(i,r,n);case"String":return bLe(i,r,n);case"Symbol":return wLe(i,r,n);case"TemplateLiteral":return TLe(i,r,n);case"This":return ILe(i,r,n);case"Tuple":return kLe(i,r,n);case"Undefined":return ELe(i,r,n);case"Union":return SLe(i,r,n);case"Uint8Array":return ALe(i,r,n);case"Unknown":return RLe(i,r,n);case"Void":return CLe(i,r,n);default:if(!Tc.Has(i[he]))throw new xM(i);return OLe(i,r,n)}}function Kt(...e){return e.length===3?Ji(e[0],e[1],e[2]):Ji(e[0],[],e[1])}var de;(function(e){e[e.ArrayContains=0]="ArrayContains",e[e.ArrayMaxContains=1]="ArrayMaxContains",e[e.ArrayMaxItems=2]="ArrayMaxItems",e[e.ArrayMinContains=3]="ArrayMinContains",e[e.ArrayMinItems=4]="ArrayMinItems",e[e.ArrayUniqueItems=5]="ArrayUniqueItems",e[e.Array=6]="Array",e[e.AsyncIterator=7]="AsyncIterator",e[e.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",e[e.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",e[e.BigIntMaximum=10]="BigIntMaximum",e[e.BigIntMinimum=11]="BigIntMinimum",e[e.BigIntMultipleOf=12]="BigIntMultipleOf",e[e.BigInt=13]="BigInt",e[e.Boolean=14]="Boolean",e[e.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",e[e.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",e[e.DateMaximumTimestamp=17]="DateMaximumTimestamp",e[e.DateMinimumTimestamp=18]="DateMinimumTimestamp",e[e.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",e[e.Date=20]="Date",e[e.Function=21]="Function",e[e.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",e[e.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",e[e.IntegerMaximum=24]="IntegerMaximum",e[e.IntegerMinimum=25]="IntegerMinimum",e[e.IntegerMultipleOf=26]="IntegerMultipleOf",e[e.Integer=27]="Integer",e[e.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",e[e.Intersect=29]="Intersect",e[e.Iterator=30]="Iterator",e[e.Kind=31]="Kind",e[e.Literal=32]="Literal",e[e.Never=33]="Never",e[e.Not=34]="Not",e[e.Null=35]="Null",e[e.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",e[e.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",e[e.NumberMaximum=38]="NumberMaximum",e[e.NumberMinimum=39]="NumberMinimum",e[e.NumberMultipleOf=40]="NumberMultipleOf",e[e.Number=41]="Number",e[e.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",e[e.ObjectMaxProperties=43]="ObjectMaxProperties",e[e.ObjectMinProperties=44]="ObjectMinProperties",e[e.ObjectRequiredProperty=45]="ObjectRequiredProperty",e[e.Object=46]="Object",e[e.Promise=47]="Promise",e[e.RegExp=48]="RegExp",e[e.StringFormatUnknown=49]="StringFormatUnknown",e[e.StringFormat=50]="StringFormat",e[e.StringMaxLength=51]="StringMaxLength",e[e.StringMinLength=52]="StringMinLength",e[e.StringPattern=53]="StringPattern",e[e.String=54]="String",e[e.Symbol=55]="Symbol",e[e.TupleLength=56]="TupleLength",e[e.Tuple=57]="Tuple",e[e.Uint8ArrayMaxByteLength=58]="Uint8ArrayMaxByteLength",e[e.Uint8ArrayMinByteLength=59]="Uint8ArrayMinByteLength",e[e.Uint8Array=60]="Uint8Array",e[e.Undefined=61]="Undefined",e[e.Union=62]="Union",e[e.Void=63]="Void"})(de||(de={}));var vM=class extends Mt{constructor(t){super("Unknown type"),this.schema=t}};function Ol(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function mn(e){return e!==void 0}var zp=class{constructor(t){this.iterator=t}[Symbol.iterator](){return this.iterator}First(){let t=this.iterator.next();return t.done?void 0:t.value}};function Ke(e,t,n,r,i=[]){return{type:e,schema:t,path:n,value:r,message:XH()({errorType:e,path:n,schema:t,value:r,errors:i}),errors:i}}function*PLe(e,t,n,r){}function*LLe(e,t,n,r){}function*MLe(e,t,n,r){if(!Rt(r))return yield Ke(de.Array,e,n,r);mn(e.minItems)&&!(r.length>=e.minItems)&&(yield Ke(de.ArrayMinItems,e,n,r)),mn(e.maxItems)&&!(r.length<=e.maxItems)&&(yield Ke(de.ArrayMaxItems,e,n,r));for(let a=0;a<r.length;a++)yield*Yi(e.items,t,`${n}/${a}`,r[a]);if(e.uniqueItems===!0&&!(function(){let a=new Set;for(let c of r){let u=Sg(c);if(a.has(u))return!1;a.add(u)}return!0})()&&(yield Ke(de.ArrayUniqueItems,e,n,r)),!(mn(e.contains)||mn(e.minContains)||mn(e.maxContains)))return;let i=mn(e.contains)?e.contains:rn(),o=r.reduce((a,c,u)=>Yi(i,t,`${n}${u}`,c).next().done===!0?a+1:a,0);o===0&&(yield Ke(de.ArrayContains,e,n,r)),vr(e.minContains)&&o<e.minContains&&(yield Ke(de.ArrayMinContains,e,n,r)),vr(e.maxContains)&&o>e.maxContains&&(yield Ke(de.ArrayMaxContains,e,n,r))}function*NLe(e,t,n,r){qI(r)||(yield Ke(de.AsyncIterator,e,n,r))}function*DLe(e,t,n,r){if(!hc(r))return yield Ke(de.BigInt,e,n,r);mn(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield Ke(de.BigIntExclusiveMaximum,e,n,r)),mn(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield Ke(de.BigIntExclusiveMinimum,e,n,r)),mn(e.maximum)&&!(r<=e.maximum)&&(yield Ke(de.BigIntMaximum,e,n,r)),mn(e.minimum)&&!(r>=e.minimum)&&(yield Ke(de.BigIntMinimum,e,n,r)),mn(e.multipleOf)&&r%e.multipleOf!==BigInt(0)&&(yield Ke(de.BigIntMultipleOf,e,n,r))}function*$Le(e,t,n,r){hu(r)||(yield Ke(de.Boolean,e,n,r))}function*FLe(e,t,n,r){yield*Yi(e.returns,t,n,r.prototype)}function*ULe(e,t,n,r){if(!Xo(r))return yield Ke(de.Date,e,n,r);mn(e.exclusiveMaximumTimestamp)&&!(r.getTime()<e.exclusiveMaximumTimestamp)&&(yield Ke(de.DateExclusiveMaximumTimestamp,e,n,r)),mn(e.exclusiveMinimumTimestamp)&&!(r.getTime()>e.exclusiveMinimumTimestamp)&&(yield Ke(de.DateExclusiveMinimumTimestamp,e,n,r)),mn(e.maximumTimestamp)&&!(r.getTime()<=e.maximumTimestamp)&&(yield Ke(de.DateMaximumTimestamp,e,n,r)),mn(e.minimumTimestamp)&&!(r.getTime()>=e.minimumTimestamp)&&(yield Ke(de.DateMinimumTimestamp,e,n,r)),mn(e.multipleOfTimestamp)&&r.getTime()%e.multipleOfTimestamp!==0&&(yield Ke(de.DateMultipleOfTimestamp,e,n,r))}function*WLe(e,t,n,r){Fp(r)||(yield Ke(de.Function,e,n,r))}function*qLe(e,t,n,r){let i=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref];yield*Yi(o,[...t,...i],n,r)}function*jLe(e,t,n,r){if(!BI(r))return yield Ke(de.Integer,e,n,r);mn(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield Ke(de.IntegerExclusiveMaximum,e,n,r)),mn(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield Ke(de.IntegerExclusiveMinimum,e,n,r)),mn(e.maximum)&&!(r<=e.maximum)&&(yield Ke(de.IntegerMaximum,e,n,r)),mn(e.minimum)&&!(r>=e.minimum)&&(yield Ke(de.IntegerMinimum,e,n,r)),mn(e.multipleOf)&&r%e.multipleOf!==0&&(yield Ke(de.IntegerMultipleOf,e,n,r))}function*GLe(e,t,n,r){let i=!1;for(let o of e.allOf)for(let a of Yi(o,t,n,r))i=!0,yield a;if(i)return yield Ke(de.Intersect,e,n,r);if(e.unevaluatedProperties===!1){let o=new RegExp(yg(e));for(let a of Object.getOwnPropertyNames(r))o.test(a)||(yield Ke(de.IntersectUnevaluatedProperties,e,`${n}/${a}`,r))}if(typeof e.unevaluatedProperties=="object"){let o=new RegExp(yg(e));for(let a of Object.getOwnPropertyNames(r))if(!o.test(a)){let c=Yi(e.unevaluatedProperties,t,`${n}/${a}`,r[a]).next();c.done||(yield c.value)}}}function*BLe(e,t,n,r){jI(r)||(yield Ke(de.Iterator,e,n,r))}function*KLe(e,t,n,r){r!==e.const&&(yield Ke(de.Literal,e,n,r))}function*HLe(e,t,n,r){yield Ke(de.Never,e,n,r)}function*VLe(e,t,n,r){Yi(e.not,t,n,r).next().done===!0&&(yield Ke(de.Not,e,n,r))}function*zLe(e,t,n,r){Il(r)||(yield Ke(de.Null,e,n,r))}function*JLe(e,t,n,r){if(!xi.IsNumberLike(r))return yield Ke(de.Number,e,n,r);mn(e.exclusiveMaximum)&&!(r<e.exclusiveMaximum)&&(yield Ke(de.NumberExclusiveMaximum,e,n,r)),mn(e.exclusiveMinimum)&&!(r>e.exclusiveMinimum)&&(yield Ke(de.NumberExclusiveMinimum,e,n,r)),mn(e.maximum)&&!(r<=e.maximum)&&(yield Ke(de.NumberMaximum,e,n,r)),mn(e.minimum)&&!(r>=e.minimum)&&(yield Ke(de.NumberMinimum,e,n,r)),mn(e.multipleOf)&&r%e.multipleOf!==0&&(yield Ke(de.NumberMultipleOf,e,n,r))}function*YLe(e,t,n,r){if(!xi.IsObjectLike(r))return yield Ke(de.Object,e,n,r);mn(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield Ke(de.ObjectMinProperties,e,n,r)),mn(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield Ke(de.ObjectMaxProperties,e,n,r));let i=Array.isArray(e.required)?e.required:[],o=Object.getOwnPropertyNames(e.properties),a=Object.getOwnPropertyNames(r);for(let c of i)a.includes(c)||(yield Ke(de.ObjectRequiredProperty,e.properties[c],`${n}/${Ol(c)}`,void 0));if(e.additionalProperties===!1)for(let c of a)o.includes(c)||(yield Ke(de.ObjectAdditionalProperties,e,`${n}/${Ol(c)}`,r[c]));if(typeof e.additionalProperties=="object")for(let c of a)o.includes(c)||(yield*Yi(e.additionalProperties,t,`${n}/${Ol(c)}`,r[c]));for(let c of o){let u=e.properties[c];e.required&&e.required.includes(c)?(yield*Yi(u,t,`${n}/${Ol(c)}`,r[c]),Bm(e)&&!(c in r)&&(yield Ke(de.ObjectRequiredProperty,u,`${n}/${Ol(c)}`,void 0))):xi.IsExactOptionalProperty(r,c)&&(yield*Yi(u,t,`${n}/${Ol(c)}`,r[c]))}}function*XLe(e,t,n,r){GI(r)||(yield Ke(de.Promise,e,n,r))}function*QLe(e,t,n,r){if(!xi.IsRecordLike(r))return yield Ke(de.Object,e,n,r);mn(e.minProperties)&&!(Object.getOwnPropertyNames(r).length>=e.minProperties)&&(yield Ke(de.ObjectMinProperties,e,n,r)),mn(e.maxProperties)&&!(Object.getOwnPropertyNames(r).length<=e.maxProperties)&&(yield Ke(de.ObjectMaxProperties,e,n,r));let[i,o]=Object.entries(e.patternProperties)[0],a=new RegExp(i);for(let[c,u]of Object.entries(r))a.test(c)&&(yield*Yi(o,t,`${n}/${Ol(c)}`,u));if(typeof e.additionalProperties=="object")for(let[c,u]of Object.entries(r))a.test(c)||(yield*Yi(e.additionalProperties,t,`${n}/${Ol(c)}`,u));if(e.additionalProperties===!1){for(let[c,u]of Object.entries(r))if(!a.test(c))return yield Ke(de.ObjectAdditionalProperties,e,`${n}/${Ol(c)}`,u)}}function*ZLe(e,t,n,r){yield*Yi(Nn(e,t),t,n,r)}function*eMe(e,t,n,r){if(!qn(r))return yield Ke(de.String,e,n,r);if(mn(e.minLength)&&!(r.length>=e.minLength)&&(yield Ke(de.StringMinLength,e,n,r)),mn(e.maxLength)&&!(r.length<=e.maxLength)&&(yield Ke(de.StringMaxLength,e,n,r)),!new RegExp(e.source,e.flags).test(r))return yield Ke(de.RegExp,e,n,r)}function*tMe(e,t,n,r){if(!qn(r))return yield Ke(de.String,e,n,r);mn(e.minLength)&&!(r.length>=e.minLength)&&(yield Ke(de.StringMinLength,e,n,r)),mn(e.maxLength)&&!(r.length<=e.maxLength)&&(yield Ke(de.StringMaxLength,e,n,r)),qn(e.pattern)&&(new RegExp(e.pattern).test(r)||(yield Ke(de.StringPattern,e,n,r))),qn(e.format)&&(gu.Has(e.format)?gu.Get(e.format)(r)||(yield Ke(de.StringFormat,e,n,r)):yield Ke(de.StringFormatUnknown,e,n,r))}function*nMe(e,t,n,r){kl(r)||(yield Ke(de.Symbol,e,n,r))}function*rMe(e,t,n,r){if(!qn(r))return yield Ke(de.String,e,n,r);new RegExp(e.pattern).test(r)||(yield Ke(de.StringPattern,e,n,r))}function*iMe(e,t,n,r){yield*Yi(Nn(e,t),t,n,r)}function*oMe(e,t,n,r){if(!Rt(r))return yield Ke(de.Tuple,e,n,r);if(e.items===void 0&&r.length!==0)return yield Ke(de.TupleLength,e,n,r);if(r.length!==e.maxItems)return yield Ke(de.TupleLength,e,n,r);if(e.items)for(let i=0;i<e.items.length;i++)yield*Yi(e.items[i],t,`${n}/${i}`,r[i])}function*aMe(e,t,n,r){xr(r)||(yield Ke(de.Undefined,e,n,r))}function*sMe(e,t,n,r){if(Kt(e,t,r))return;let i=e.anyOf.map(o=>new zp(Yi(o,t,n,r)));yield Ke(de.Union,e,n,r,i)}function*cMe(e,t,n,r){if(!ig(r))return yield Ke(de.Uint8Array,e,n,r);mn(e.maxByteLength)&&!(r.length<=e.maxByteLength)&&(yield Ke(de.Uint8ArrayMaxByteLength,e,n,r)),mn(e.minByteLength)&&!(r.length>=e.minByteLength)&&(yield Ke(de.Uint8ArrayMinByteLength,e,n,r))}function*uMe(e,t,n,r){}function*lMe(e,t,n,r){xi.IsVoidLike(r)||(yield Ke(de.Void,e,n,r))}function*pMe(e,t,n,r){Tc.Get(e[he])(e,r)||(yield Ke(de.Kind,e,n,r))}function*Yi(e,t,n,r){let i=mn(e.$id)?[...t,e]:t,o=e;switch(o[he]){case"Any":return yield*PLe(o,i,n,r);case"Argument":return yield*LLe(o,i,n,r);case"Array":return yield*MLe(o,i,n,r);case"AsyncIterator":return yield*NLe(o,i,n,r);case"BigInt":return yield*DLe(o,i,n,r);case"Boolean":return yield*$Le(o,i,n,r);case"Constructor":return yield*FLe(o,i,n,r);case"Date":return yield*ULe(o,i,n,r);case"Function":return yield*WLe(o,i,n,r);case"Import":return yield*qLe(o,i,n,r);case"Integer":return yield*jLe(o,i,n,r);case"Intersect":return yield*GLe(o,i,n,r);case"Iterator":return yield*BLe(o,i,n,r);case"Literal":return yield*KLe(o,i,n,r);case"Never":return yield*HLe(o,i,n,r);case"Not":return yield*VLe(o,i,n,r);case"Null":return yield*zLe(o,i,n,r);case"Number":return yield*JLe(o,i,n,r);case"Object":return yield*YLe(o,i,n,r);case"Promise":return yield*XLe(o,i,n,r);case"Record":return yield*QLe(o,i,n,r);case"Ref":return yield*ZLe(o,i,n,r);case"RegExp":return yield*eMe(o,i,n,r);case"String":return yield*tMe(o,i,n,r);case"Symbol":return yield*nMe(o,i,n,r);case"TemplateLiteral":return yield*rMe(o,i,n,r);case"This":return yield*iMe(o,i,n,r);case"Tuple":return yield*oMe(o,i,n,r);case"Undefined":return yield*aMe(o,i,n,r);case"Union":return yield*sMe(o,i,n,r);case"Uint8Array":return yield*cMe(o,i,n,r);case"Unknown":return yield*uMe(o,i,n,r);case"Void":return yield*lMe(o,i,n,r);default:if(!Tc.Has(o[he]))throw new vM(e);return yield*pMe(o,i,n,r)}}function Jp(...e){let t=e.length===3?Yi(e[0],e[1],"",e[2]):Yi(e[0],[],"",e[1]);return new zp(t)}var dMe=function(e,t,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(e,n):i?i.value=n:t.set(e,n),n},nV=function(e,t,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(e):r?r.value:t.get(e)},bM,dk,rV,wM=class extends Mt{constructor(t){let n=t.First();super(n===void 0?"Invalid Value":n.message),bM.add(this),dk.set(this,void 0),dMe(this,dk,t,"f"),this.error=n}Errors(){return new zp(nV(this,bM,"m",rV).call(this))}};dk=new WeakMap,bM=new WeakSet,rV=function*(){this.error&&(yield this.error),yield*nV(this,dk,"f")};function tV(e,t,n){if(!Kt(e,t,n))throw new wM(Jp(e,t,n))}function mk(...e){return e.length===3?tV(e[0],e[1],e[2]):tV(e[0],[],e[1])}function mMe(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=An(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=An(e[n]);return t}function fMe(e){return e.map(t=>An(t))}function hMe(e){return e.slice()}function gMe(e){return new Map(An([...e.entries()]))}function yMe(e){return new Set(An([...e.entries()]))}function _Me(e){return new Date(e.toISOString())}function An(e){if(Rt(e))return fMe(e);if(Xo(e))return _Me(e);if(As(e))return hMe(e);if(FK(e))return gMe(e);if(UK(e))return yMe(e);if(Ut(e))return mMe(e);if(za(e))return e;throw new Error("ValueClone: Unable to clone value")}var ts=class extends Mt{constructor(t,n){super(n),this.schema=t}};function Rn(e){return Fp(e)?e():An(e)}function xMe(e,t){return Tt(e,"default")?Rn(e.default):{}}function vMe(e,t){return{}}function bMe(e,t){if(e.uniqueItems===!0&&!Tt(e,"default"))throw new ts(e,"Array with the uniqueItems constraint requires a default value");if("contains"in e&&!Tt(e,"default"))throw new ts(e,"Array with the contains constraint requires a default value");return"default"in e?Rn(e.default):e.minItems!==void 0?Array.from({length:e.minItems}).map(n=>ns(e.items,t)):[]}function wMe(e,t){return Tt(e,"default")?Rn(e.default):(async function*(){})()}function TMe(e,t){return Tt(e,"default")?Rn(e.default):BigInt(0)}function IMe(e,t){return Tt(e,"default")?Rn(e.default):!1}function kMe(e,t){if(Tt(e,"default"))return Rn(e.default);{let n=ns(e.returns,t);return typeof n=="object"&&!Array.isArray(n)?class{constructor(){for(let[r,i]of Object.entries(n)){let o=this;o[r]=i}}}:class{}}}function EMe(e,t){return Tt(e,"default")?Rn(e.default):e.minimumTimestamp!==void 0?new Date(e.minimumTimestamp):new Date}function SMe(e,t){return Tt(e,"default")?Rn(e.default):()=>ns(e.returns,t)}function AMe(e,t){let n=globalThis.Object.values(e.$defs),r=e.$defs[e.$ref];return ns(r,[...t,...n])}function RMe(e,t){return Tt(e,"default")?Rn(e.default):e.minimum!==void 0?e.minimum:0}function CMe(e,t){if(Tt(e,"default"))return Rn(e.default);{let n=e.allOf.reduce((r,i)=>{let o=ns(i,t);return typeof o=="object"?{...r,...o}:o},{});if(!Kt(e,t,n))throw new ts(e,"Intersect produced invalid value. Consider using a default value.");return n}}function OMe(e,t){return Tt(e,"default")?Rn(e.default):(function*(){})()}function PMe(e,t){return Tt(e,"default")?Rn(e.default):e.const}function LMe(e,t){if(Tt(e,"default"))return Rn(e.default);throw new ts(e,"Never types cannot be created. Consider using a default value.")}function MMe(e,t){if(Tt(e,"default"))return Rn(e.default);throw new ts(e,"Not types must have a default value")}function NMe(e,t){return Tt(e,"default")?Rn(e.default):null}function DMe(e,t){return Tt(e,"default")?Rn(e.default):e.minimum!==void 0?e.minimum:0}function $Me(e,t){if(Tt(e,"default"))return Rn(e.default);{let n=new Set(e.required),r={};for(let[i,o]of Object.entries(e.properties))n.has(i)&&(r[i]=ns(o,t));return r}}function FMe(e,t){return Tt(e,"default")?Rn(e.default):Promise.resolve(ns(e.item,t))}function UMe(e,t){return Tt(e,"default")?Rn(e.default):{}}function WMe(e,t){return Tt(e,"default")?Rn(e.default):ns(Nn(e,t),t)}function qMe(e,t){if(Tt(e,"default"))return Rn(e.default);throw new ts(e,"RegExp types cannot be created. Consider using a default value.")}function jMe(e,t){if(e.pattern!==void 0){if(Tt(e,"default"))return Rn(e.default);throw new ts(e,"String types with patterns must specify a default value")}else if(e.format!==void 0){if(Tt(e,"default"))return Rn(e.default);throw new ts(e,"String types with formats must specify a default value")}else return Tt(e,"default")?Rn(e.default):e.minLength!==void 0?Array.from({length:e.minLength}).map(()=>" ").join(""):""}function GMe(e,t){return Tt(e,"default")?Rn(e.default):"value"in e?Symbol.for(e.value):Symbol()}function BMe(e,t){if(Tt(e,"default"))return Rn(e.default);if(!zI(e))throw new ts(e,"Can only create template literals that produce a finite variants. Consider using a default value.");return mg(e)[0]}function KMe(e,t){if(iV++>ZMe)throw new ts(e,"Cannot create recursive type as it appears possibly infinite. Consider using a default.");return Tt(e,"default")?Rn(e.default):ns(Nn(e,t),t)}function HMe(e,t){return Tt(e,"default")?Rn(e.default):e.items===void 0?[]:Array.from({length:e.minItems}).map((n,r)=>ns(e.items[r],t))}function VMe(e,t){if(Tt(e,"default"))return Rn(e.default)}function zMe(e,t){if(Tt(e,"default"))return Rn(e.default);if(e.anyOf.length===0)throw new Error("ValueCreate.Union: Cannot create Union with zero variants");return ns(e.anyOf[0],t)}function JMe(e,t){return Tt(e,"default")?Rn(e.default):e.minByteLength!==void 0?new Uint8Array(e.minByteLength):new Uint8Array(0)}function YMe(e,t){return Tt(e,"default")?Rn(e.default):{}}function XMe(e,t){if(Tt(e,"default"))return Rn(e.default)}function QMe(e,t){if(Tt(e,"default"))return Rn(e.default);throw new Error("User defined types must specify a default value")}function ns(e,t){let n=zi(e,t),r=e;switch(r[he]){case"Any":return xMe(r,n);case"Argument":return vMe(r,n);case"Array":return bMe(r,n);case"AsyncIterator":return wMe(r,n);case"BigInt":return TMe(r,n);case"Boolean":return IMe(r,n);case"Constructor":return kMe(r,n);case"Date":return EMe(r,n);case"Function":return SMe(r,n);case"Import":return AMe(r,n);case"Integer":return RMe(r,n);case"Intersect":return CMe(r,n);case"Iterator":return OMe(r,n);case"Literal":return PMe(r,n);case"Never":return LMe(r,n);case"Not":return MMe(r,n);case"Null":return NMe(r,n);case"Number":return DMe(r,n);case"Object":return $Me(r,n);case"Promise":return FMe(r,n);case"Record":return UMe(r,n);case"Ref":return WMe(r,n);case"RegExp":return qMe(r,n);case"String":return jMe(r,n);case"Symbol":return GMe(r,n);case"TemplateLiteral":return BMe(r,n);case"This":return KMe(r,n);case"Tuple":return HMe(r,n);case"Undefined":return VMe(r,n);case"Union":return zMe(r,n);case"Uint8Array":return JMe(r,n);case"Unknown":return YMe(r,n);case"Void":return XMe(r,n);default:if(!Tc.Has(r[he]))throw new ts(r,"Unknown type");return QMe(r,n)}}var ZMe=512,iV=0;function Sc(...e){return iV=0,e.length===2?ns(e[0],e[1]):ns(e[0],[])}var fk=class extends Mt{constructor(t,n){super(n),this.schema=t}};function oV(e,t,n){if(e[he]==="Object"&&typeof n=="object"&&!Il(n)){let r=e,i=Object.getOwnPropertyNames(n);return Object.entries(r.properties).reduce((a,[c,u])=>{let l=u[he]==="Literal"&&u.const===n[c]?100:0,d=Kt(u,t,n[c])?10:0,m=i.includes(c)?1:0;return a+(l+d+m)},0)}else if(e[he]==="Union"){let i=e.anyOf.map(o=>Nn(o,t)).map(o=>oV(o,t,n));return Math.max(...i)}else return Kt(e,t,n)?1:0}function eNe(e,t,n){let r=e.anyOf.map(a=>Nn(a,t)),[i,o]=[r[0],0];for(let a of r){let c=oV(a,t,n);c>o&&(i=a,o=c)}return i}function tNe(e,t,n){if("default"in e)return typeof n=="function"?e.default:An(e.default);{let r=eNe(e,t,n);return pv(r,t,n)}}function nNe(e,t,n){return Kt(e,t,n)?An(n):Sc(e,t)}function rNe(e,t,n){return Kt(e,t,n)?n:Sc(e,t)}function iNe(e,t,n){if(Kt(e,t,n))return An(n);let r=Rt(n)?An(n):Sc(e,t),i=vr(e.minItems)&&r.length<e.minItems?[...r,...Array.from({length:e.minItems-r.length},()=>null)]:r,a=(vr(e.maxItems)&&i.length>e.maxItems?i.slice(0,e.maxItems):i).map(u=>Ac(e.items,t,u));if(e.uniqueItems!==!0)return a;let c=[...new Set(a)];if(!Kt(e,t,c))throw new fk(e,"Array cast produced invalid data due to uniqueItems constraint");return c}function oNe(e,t,n){if(Kt(e,t,n))return Sc(e,t);let r=new Set(e.returns.required||[]),i=function(){};for(let[o,a]of Object.entries(e.returns.properties))!r.has(o)&&n.prototype[o]===void 0||(i.prototype[o]=Ac(a,t,n.prototype[o]));return i}function aNe(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Ac(i,[...t,...r],n)}function aV(e,t){return Ut(e)&&!Ut(t)||!Ut(e)&&Ut(t)?e:!Ut(e)||!Ut(t)?t:globalThis.Object.getOwnPropertyNames(e).reduce((n,r)=>{let i=r in t?aV(e[r],t[r]):e[r];return{...n,[r]:i}},{})}function sNe(e,t,n){if(Kt(e,t,n))return n;let r=Sc(e,t),i=aV(r,n);return Kt(e,t,i)?i:r}function cNe(e,t,n){throw new fk(e,"Never types cannot be cast")}function uNe(e,t,n){if(Kt(e,t,n))return n;if(n===null||typeof n!="object")return Sc(e,t);let r=new Set(e.required||[]),i={};for(let[o,a]of Object.entries(e.properties))!r.has(o)&&n[o]===void 0||(i[o]=Ac(a,t,n[o]));if(typeof e.additionalProperties=="object"){let o=Object.getOwnPropertyNames(e.properties);for(let a of Object.getOwnPropertyNames(n))o.includes(a)||(i[a]=Ac(e.additionalProperties,t,n[a]))}return i}function lNe(e,t,n){if(Kt(e,t,n))return An(n);if(n===null||typeof n!="object"||Array.isArray(n)||n instanceof Date)return Sc(e,t);let r=Object.getOwnPropertyNames(e.patternProperties)[0],i=e.patternProperties[r],o={};for(let[a,c]of Object.entries(n))o[a]=Ac(i,t,c);return o}function pNe(e,t,n){return Ac(Nn(e,t),t,n)}function dNe(e,t,n){return Ac(Nn(e,t),t,n)}function mNe(e,t,n){return Kt(e,t,n)?An(n):Rt(n)?e.items===void 0?[]:e.items.map((r,i)=>Ac(r,t,n[i])):Sc(e,t)}function fNe(e,t,n){return Kt(e,t,n)?An(n):tNe(e,t,n)}function Ac(e,t,n){let r=qn(e.$id)?zi(e,t):t,i=e;switch(e[he]){case"Array":return iNe(i,r,n);case"Constructor":return oNe(i,r,n);case"Import":return aNe(i,r,n);case"Intersect":return sNe(i,r,n);case"Never":return cNe(i,r,n);case"Object":return uNe(i,r,n);case"Record":return lNe(i,r,n);case"Ref":return pNe(i,r,n);case"This":return dNe(i,r,n);case"Tuple":return mNe(i,r,n);case"Union":return fNe(i,r,n);case"Date":case"Symbol":case"Uint8Array":return nNe(e,t,n);default:return rNe(i,r,n)}}function pv(...e){return e.length===3?Ac(e[0],e[1],e[2]):Ac(e[0],[],e[1])}function hNe(e){return Wp(e)&&e[he]!=="Unsafe"}function gNe(e,t,n){return Rt(n)?n.map(r=>Ta(e.items,t,r)):n}function yNe(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Ta(i,[...t,...r],n)}function _Ne(e,t,n){let r=e.unevaluatedProperties,o=e.allOf.map(c=>Ta(c,t,An(n))).reduce((c,u)=>Ut(u)?{...c,...u}:u,{});if(!Ut(n)||!Ut(o)||!Wp(r))return o;let a=ba(e);for(let c of Object.getOwnPropertyNames(n))a.includes(c)||Kt(r,t,n[c])&&(o[c]=Ta(r,t,n[c]));return o}function xNe(e,t,n){if(!Ut(n)||Rt(n))return n;let r=e.additionalProperties;for(let i of Object.getOwnPropertyNames(n)){if(Tt(e.properties,i)){n[i]=Ta(e.properties[i],t,n[i]);continue}if(Wp(r)&&Kt(r,t,n[i])){n[i]=Ta(r,t,n[i]);continue}delete n[i]}return n}function vNe(e,t,n){if(!Ut(n))return n;let r=e.additionalProperties,i=Object.getOwnPropertyNames(n),[o,a]=Object.entries(e.patternProperties)[0],c=new RegExp(o);for(let u of i){if(c.test(u)){n[u]=Ta(a,t,n[u]);continue}if(Wp(r)&&Kt(r,t,n[u])){n[u]=Ta(r,t,n[u]);continue}delete n[u]}return n}function bNe(e,t,n){return Ta(Nn(e,t),t,n)}function wNe(e,t,n){return Ta(Nn(e,t),t,n)}function TNe(e,t,n){if(!Rt(n))return n;if(xr(e.items))return[];let r=Math.min(n.length,e.items.length);for(let i=0;i<r;i++)n[i]=Ta(e.items[i],t,n[i]);return n.length>r?n.slice(0,r):n}function INe(e,t,n){for(let r of e.anyOf)if(hNe(r)&&Kt(r,t,n))return Ta(r,t,n);return n}function Ta(e,t,n){let r=qn(e.$id)?zi(e,t):t,i=e;switch(i[he]){case"Array":return gNe(i,r,n);case"Import":return yNe(i,r,n);case"Intersect":return _Ne(i,r,n);case"Object":return xNe(i,r,n);case"Record":return vNe(i,r,n);case"Ref":return bNe(i,r,n);case"This":return wNe(i,r,n);case"Tuple":return TNe(i,r,n);case"Union":return INe(i,r,n);default:return n}}function hk(...e){return e.length===3?Ta(e[0],e[1],e[2]):Ta(e[0],[],e[1])}function gk(e){return qn(e)&&!isNaN(e)&&!isNaN(parseFloat(e))}function kNe(e){return hc(e)||hu(e)||vr(e)}function dv(e){return e===!0||vr(e)&&e===1||hc(e)&&e===BigInt("1")||qn(e)&&(e.toLowerCase()==="true"||e==="1")}function mv(e){return e===!1||vr(e)&&(e===0||Object.is(e,-0))||hc(e)&&e===BigInt("0")||qn(e)&&(e.toLowerCase()==="false"||e==="0"||e==="-0")}function ENe(e){return qn(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function SNe(e){return qn(e)&&/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function ANe(e){return qn(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(e)}function RNe(e){return qn(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(e)}function CNe(e){return qn(e)&&/^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(e)}function ONe(e,t){let n=cV(e);return n===t?n:e}function PNe(e,t){let n=uV(e);return n===t?n:e}function LNe(e,t){let n=sV(e);return n===t?n:e}function MNe(e,t){return qn(e.const)?ONe(t,e.const):vr(e.const)?PNe(t,e.const):hu(e.const)?LNe(t,e.const):t}function sV(e){return dv(e)?!0:mv(e)?!1:e}function NNe(e){let t=n=>n.split(".")[0];return gk(e)?BigInt(t(e)):vr(e)?BigInt(Math.trunc(e)):mv(e)?BigInt(0):dv(e)?BigInt(1):e}function cV(e){return kl(e)&&e.description!==void 0?e.description.toString():kNe(e)?e.toString():e}function uV(e){return gk(e)?parseFloat(e):dv(e)?1:mv(e)?0:e}function DNe(e){return gk(e)?parseInt(e):vr(e)?Math.trunc(e):dv(e)?1:mv(e)?0:e}function $Ne(e){return qn(e)&&e.toLowerCase()==="null"?null:e}function FNe(e){return qn(e)&&e==="undefined"?void 0:e}function UNe(e){return Xo(e)?e:vr(e)?new Date(e):dv(e)?new Date(1):mv(e)?new Date(0):gk(e)?new Date(parseInt(e)):SNe(e)?new Date(`1970-01-01T${e}.000Z`):ENe(e)?new Date(`1970-01-01T${e}`):RNe(e)?new Date(`${e}.000Z`):ANe(e)?new Date(e):CNe(e)?new Date(`${e}T00:00:00.000Z`):e}function WNe(e,t,n){return(Rt(n)?n:[n]).map(i=>Rc(e.items,t,i))}function qNe(e,t,n){return NNe(n)}function jNe(e,t,n){return sV(n)}function GNe(e,t,n){return UNe(n)}function BNe(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Rc(i,[...t,...r],n)}function KNe(e,t,n){return DNe(n)}function HNe(e,t,n){return e.allOf.reduce((r,i)=>Rc(i,t,r),n)}function VNe(e,t,n){return MNe(e,n)}function zNe(e,t,n){return $Ne(n)}function JNe(e,t,n){return uV(n)}function YNe(e,t,n){if(!Ut(n)||Rt(n))return n;for(let r of Object.getOwnPropertyNames(e.properties))Tt(n,r)&&(n[r]=Rc(e.properties[r],t,n[r]));return n}function XNe(e,t,n){if(!(Ut(n)&&!Rt(n)))return n;let i=Object.getOwnPropertyNames(e.patternProperties)[0],o=e.patternProperties[i];for(let[a,c]of Object.entries(n))n[a]=Rc(o,t,c);return n}function QNe(e,t,n){return Rc(Nn(e,t),t,n)}function ZNe(e,t,n){return cV(n)}function eDe(e,t,n){return qn(n)||vr(n)?Symbol(n):n}function tDe(e,t,n){return Rc(Nn(e,t),t,n)}function nDe(e,t,n){return Rt(n)&&!xr(e.items)?n.map((i,o)=>o<e.items.length?Rc(e.items[o],t,i):i):n}function rDe(e,t,n){return FNe(n)}function iDe(e,t,n){for(let r of e.anyOf)if(Kt(r,t,n))return n;for(let r of e.anyOf){let i=Rc(r,t,An(n));if(Kt(r,t,i))return i}return n}function Rc(e,t,n){let r=zi(e,t),i=e;switch(e[he]){case"Array":return WNe(i,r,n);case"BigInt":return qNe(i,r,n);case"Boolean":return jNe(i,r,n);case"Date":return GNe(i,r,n);case"Import":return BNe(i,r,n);case"Integer":return KNe(i,r,n);case"Intersect":return HNe(i,r,n);case"Literal":return VNe(i,r,n);case"Null":return zNe(i,r,n);case"Number":return JNe(i,r,n);case"Object":return YNe(i,r,n);case"Record":return XNe(i,r,n);case"Ref":return QNe(i,r,n);case"String":return ZNe(i,r,n);case"Symbol":return eDe(i,r,n);case"This":return tDe(i,r,n);case"Tuple":return nDe(i,r,n);case"Undefined":return rDe(i,r,n);case"Union":return iDe(i,r,n);default:return n}}function yk(...e){return e.length===3?Rc(e[0],e[1],e[2]):Rc(e[0],[],e[1])}var _k=class extends Mt{constructor(t,n,r){super("Unable to decode value as it does not match the expected schema"),this.schema=t,this.value=n,this.error=r}},TM=class extends Mt{constructor(t,n,r,i){super(i instanceof Error?i.message:"Unknown error"),this.schema=t,this.path=n,this.value=r,this.error=i}};function Lr(e,t,n){try{return Pn(e)?e[Or].Decode(n):n}catch(r){throw new TM(e,t,n,r)}}function oDe(e,t,n,r){return Rt(r)?Lr(e,n,r.map((i,o)=>Cc(e.items,t,`${n}/${o}`,i))):Lr(e,n,r)}function aDe(e,t,n,r){if(!Ut(r)||za(r))return Lr(e,n,r);let i=ZI(e),o=i.map(d=>d[0]),a={...r};for(let[d,m]of i)d in a&&(a[d]=Cc(m,t,`${n}/${d}`,a[d]));if(!Pn(e.unevaluatedProperties))return Lr(e,n,a);let c=Object.getOwnPropertyNames(a),u=e.unevaluatedProperties,l={...a};for(let d of c)o.includes(d)||(l[d]=Lr(u,`${n}/${d}`,l[d]));return Lr(e,n,l)}function sDe(e,t,n,r){let i=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref],a=Cc(o,[...t,...i],n,r);return Lr(e,n,a)}function cDe(e,t,n,r){return Lr(e,n,Cc(e.not,t,n,r))}function uDe(e,t,n,r){if(!Ut(r))return Lr(e,n,r);let i=ba(e),o={...r};for(let l of i)Tt(o,l)&&(xr(o[l])&&(!Al(e.properties[l])||xi.IsExactOptionalProperty(o,l))||(o[l]=Cc(e.properties[l],t,`${n}/${l}`,o[l])));if(!Pr(e.additionalProperties))return Lr(e,n,o);let a=Object.getOwnPropertyNames(o),c=e.additionalProperties,u={...o};for(let l of a)i.includes(l)||(u[l]=Lr(c,`${n}/${l}`,u[l]));return Lr(e,n,u)}function lDe(e,t,n,r){if(!Ut(r))return Lr(e,n,r);let i=Object.getOwnPropertyNames(e.patternProperties)[0],o=new RegExp(i),a={...r};for(let d of Object.getOwnPropertyNames(r))o.test(d)&&(a[d]=Cc(e.patternProperties[i],t,`${n}/${d}`,a[d]));if(!Pr(e.additionalProperties))return Lr(e,n,a);let c=Object.getOwnPropertyNames(a),u=e.additionalProperties,l={...a};for(let d of c)o.test(d)||(l[d]=Lr(u,`${n}/${d}`,l[d]));return Lr(e,n,l)}function pDe(e,t,n,r){let i=Nn(e,t);return Lr(e,n,Cc(i,t,n,r))}function dDe(e,t,n,r){let i=Nn(e,t);return Lr(e,n,Cc(i,t,n,r))}function mDe(e,t,n,r){return Rt(r)&&Rt(e.items)?Lr(e,n,e.items.map((i,o)=>Cc(i,t,`${n}/${o}`,r[o]))):Lr(e,n,r)}function fDe(e,t,n,r){for(let i of e.anyOf){if(!Kt(i,t,r))continue;let o=Cc(i,t,n,r);return Lr(e,n,o)}return Lr(e,n,r)}function Cc(e,t,n,r){let i=zi(e,t),o=e;switch(e[he]){case"Array":return oDe(o,i,n,r);case"Import":return sDe(o,i,n,r);case"Intersect":return aDe(o,i,n,r);case"Not":return cDe(o,i,n,r);case"Object":return uDe(o,i,n,r);case"Record":return lDe(o,i,n,r);case"Ref":return pDe(o,i,n,r);case"Symbol":return Lr(o,n,r);case"This":return dDe(o,i,n,r);case"Tuple":return mDe(o,i,n,r);case"Union":return fDe(o,i,n,r);default:return Lr(o,n,r)}}function xk(e,t,n){return Cc(e,t,"",n)}var vk=class extends Mt{constructor(t,n,r){super("The encoded value does not match the expected schema"),this.schema=t,this.value=n,this.error=r}},IM=class extends Mt{constructor(t,n,r,i){super(`${i instanceof Error?i.message:"Unknown error"}`),this.schema=t,this.path=n,this.value=r,this.error=i}};function ho(e,t,n){try{return Pn(e)?e[Or].Encode(n):n}catch(r){throw new IM(e,t,n,r)}}function hDe(e,t,n,r){let i=ho(e,n,r);return Rt(i)?i.map((o,a)=>Oc(e.items,t,`${n}/${a}`,o)):i}function gDe(e,t,n,r){let i=globalThis.Object.values(e.$defs),o=e.$defs[e.$ref],a=ho(e,n,r);return Oc(o,[...t,...i],n,a)}function yDe(e,t,n,r){let i=ho(e,n,r);if(!Ut(r)||za(r))return i;let o=ZI(e),a=o.map(m=>m[0]),c={...i};for(let[m,h]of o)m in c&&(c[m]=Oc(h,t,`${n}/${m}`,c[m]));if(!Pn(e.unevaluatedProperties))return c;let u=Object.getOwnPropertyNames(c),l=e.unevaluatedProperties,d={...c};for(let m of u)a.includes(m)||(d[m]=ho(l,`${n}/${m}`,d[m]));return d}function _De(e,t,n,r){return ho(e.not,n,ho(e,n,r))}function xDe(e,t,n,r){let i=ho(e,n,r);if(!Ut(i))return i;let o=ba(e),a={...i};for(let d of o)Tt(a,d)&&(xr(a[d])&&(!Al(e.properties[d])||xi.IsExactOptionalProperty(a,d))||(a[d]=Oc(e.properties[d],t,`${n}/${d}`,a[d])));if(!Pr(e.additionalProperties))return a;let c=Object.getOwnPropertyNames(a),u=e.additionalProperties,l={...a};for(let d of c)o.includes(d)||(l[d]=ho(u,`${n}/${d}`,l[d]));return l}function vDe(e,t,n,r){let i=ho(e,n,r);if(!Ut(r))return i;let o=Object.getOwnPropertyNames(e.patternProperties)[0],a=new RegExp(o),c={...i};for(let m of Object.getOwnPropertyNames(r))a.test(m)&&(c[m]=Oc(e.patternProperties[o],t,`${n}/${m}`,c[m]));if(!Pr(e.additionalProperties))return c;let u=Object.getOwnPropertyNames(c),l=e.additionalProperties,d={...c};for(let m of u)a.test(m)||(d[m]=ho(l,`${n}/${m}`,d[m]));return d}function bDe(e,t,n,r){let i=Nn(e,t),o=Oc(i,t,n,r);return ho(e,n,o)}function wDe(e,t,n,r){let i=Nn(e,t),o=Oc(i,t,n,r);return ho(e,n,o)}function TDe(e,t,n,r){let i=ho(e,n,r);return Rt(e.items)?e.items.map((o,a)=>Oc(o,t,`${n}/${a}`,i[a])):[]}function IDe(e,t,n,r){for(let i of e.anyOf){if(!Kt(i,t,r))continue;let o=Oc(i,t,n,r);return ho(e,n,o)}for(let i of e.anyOf){let o=Oc(i,t,n,r);if(Kt(e,t,o))return ho(e,n,o)}return ho(e,n,r)}function Oc(e,t,n,r){let i=zi(e,t),o=e;switch(e[he]){case"Array":return hDe(o,i,n,r);case"Import":return gDe(o,i,n,r);case"Intersect":return yDe(o,i,n,r);case"Not":return _De(o,i,n,r);case"Object":return xDe(o,i,n,r);case"Record":return vDe(o,i,n,r);case"Ref":return bDe(o,i,n,r);case"This":return wDe(o,i,n,r);case"Tuple":return TDe(o,i,n,r);case"Union":return IDe(o,i,n,r);default:return ho(o,n,r)}}function bk(e,t,n){return Oc(e,t,"",n)}function kDe(e,t){return Pn(e)||$i(e.items,t)}function EDe(e,t){return Pn(e)||$i(e.items,t)}function SDe(e,t){return Pn(e)||$i(e.returns,t)||e.parameters.some(n=>$i(n,t))}function ADe(e,t){return Pn(e)||$i(e.returns,t)||e.parameters.some(n=>$i(n,t))}function RDe(e,t){return Pn(e)||Pn(e.unevaluatedProperties)||e.allOf.some(n=>$i(n,t))}function CDe(e,t){let n=globalThis.Object.getOwnPropertyNames(e.$defs).reduce((i,o)=>[...i,e.$defs[o]],[]),r=e.$defs[e.$ref];return Pn(e)||$i(r,[...n,...t])}function ODe(e,t){return Pn(e)||$i(e.items,t)}function PDe(e,t){return Pn(e)||$i(e.not,t)}function LDe(e,t){return Pn(e)||Object.values(e.properties).some(n=>$i(n,t))||Pr(e.additionalProperties)&&$i(e.additionalProperties,t)}function MDe(e,t){return Pn(e)||$i(e.item,t)}function NDe(e,t){let n=Object.getOwnPropertyNames(e.patternProperties)[0],r=e.patternProperties[n];return Pn(e)||$i(r,t)||Pr(e.additionalProperties)&&Pn(e.additionalProperties)}function DDe(e,t){return Pn(e)?!0:$i(Nn(e,t),t)}function $De(e,t){return Pn(e)?!0:$i(Nn(e,t),t)}function FDe(e,t){return Pn(e)||!xr(e.items)&&e.items.some(n=>$i(n,t))}function UDe(e,t){return Pn(e)||e.anyOf.some(n=>$i(n,t))}function $i(e,t){let n=zi(e,t),r=e;if(e.$id&&kM.has(e.$id))return!1;switch(e.$id&&kM.add(e.$id),e[he]){case"Array":return kDe(r,n);case"AsyncIterator":return EDe(r,n);case"Constructor":return SDe(r,n);case"Function":return ADe(r,n);case"Import":return CDe(r,n);case"Intersect":return RDe(r,n);case"Iterator":return ODe(r,n);case"Not":return PDe(r,n);case"Object":return LDe(r,n);case"Promise":return MDe(r,n);case"Record":return NDe(r,n);case"Ref":return DDe(r,n);case"This":return $De(r,n);case"Tuple":return FDe(r,n);case"Union":return UDe(r,n);default:return Pn(e)}}var kM=new Set;function Hm(e,t){return kM.clear(),$i(e,t)}function lV(...e){let[t,n,r]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]];if(!Kt(t,n,r))throw new _k(t,r,Jp(t,n,r).First());return Hm(t,n)?xk(t,n,r):r}function Pl(e,t){let n=Tt(e,"default")?e.default:void 0,r=Fp(n)?n():An(n);return xr(t)?r:Ut(t)&&Ut(r)?Object.assign(r,t):t}function EM(e){return Wp(e)&&"default"in e}function WDe(e,t,n){if(Rt(n)){for(let i=0;i<n.length;i++)n[i]=Zo(e.items,t,n[i]);return n}let r=Pl(e,n);if(!Rt(r))return r;for(let i=0;i<r.length;i++)r[i]=Zo(e.items,t,r[i]);return r}function qDe(e,t,n){return Xo(n)?n:Pl(e,n)}function jDe(e,t,n){let r=globalThis.Object.values(e.$defs),i=e.$defs[e.$ref];return Zo(i,[...t,...r],n)}function GDe(e,t,n){let r=Pl(e,n);return e.allOf.reduce((i,o)=>{let a=Zo(o,t,r);return Ut(a)?{...i,...a}:a},{})}function BDe(e,t,n){let r=Pl(e,n);if(!Ut(r))return r;let i=Object.getOwnPropertyNames(e.properties);for(let o of i){let a=Zo(e.properties[o],t,r[o]);xr(a)||(r[o]=Zo(e.properties[o],t,r[o]))}if(!EM(e.additionalProperties))return r;for(let o of Object.getOwnPropertyNames(r))i.includes(o)||(r[o]=Zo(e.additionalProperties,t,r[o]));return r}function KDe(e,t,n){let r=Pl(e,n);if(!Ut(r))return r;let i=e.additionalProperties,[o,a]=Object.entries(e.patternProperties)[0],c=new RegExp(o);for(let u of Object.getOwnPropertyNames(r))c.test(u)&&EM(a)&&(r[u]=Zo(a,t,r[u]));if(!EM(i))return r;for(let u of Object.getOwnPropertyNames(r))c.test(u)||(r[u]=Zo(i,t,r[u]));return r}function HDe(e,t,n){return Zo(Nn(e,t),t,Pl(e,n))}function VDe(e,t,n){return Zo(Nn(e,t),t,n)}function zDe(e,t,n){let r=Pl(e,n);if(!Rt(r)||xr(e.items))return r;let[i,o]=[e.items,Math.max(e.items.length,r.length)];for(let a=0;a<o;a++)a<i.length&&(r[a]=Zo(i[a],t,r[a]));return r}function JDe(e,t,n){let r=Pl(e,n);for(let i of e.anyOf){let o=Zo(i,t,An(r));if(Kt(i,t,o))return o}return r}function Zo(e,t,n){let r=zi(e,t),i=e;switch(i[he]){case"Array":return WDe(i,r,n);case"Date":return qDe(i,r,n);case"Import":return jDe(i,r,n);case"Intersect":return GDe(i,r,n);case"Object":return BDe(i,r,n);case"Record":return KDe(i,r,n);case"Ref":return HDe(i,r,n);case"This":return VDe(i,r,n);case"Tuple":return zDe(i,r,n);case"Union":return JDe(i,r,n);default:return Pl(i,n)}}function wk(...e){return e.length===3?Zo(e[0],e[1],e[2]):Zo(e[0],[],e[1])}var Pc={};On(Pc,{Delete:()=>XDe,Format:()=>fv,Get:()=>ZDe,Has:()=>QDe,Set:()=>YDe,ValuePointerRootDeleteError:()=>Ik,ValuePointerRootSetError:()=>Tk});var Tk=class extends Mt{constructor(t,n,r){super("Cannot set root value"),this.value=t,this.path=n,this.update=r}},Ik=class extends Mt{constructor(t,n){super("Cannot delete root value"),this.value=t,this.path=n}};function pV(e){return e.indexOf("~")===-1?e:e.replace(/~1/g,"/").replace(/~0/g,"~")}function*fv(e){if(e==="")return;let[t,n]=[0,0];for(let r=0;r<e.length;r++)e.charAt(r)==="/"?(r===0||(n=r,yield pV(e.slice(t,n))),t=r+1):n=r;yield pV(e.slice(t))}function YDe(e,t,n){if(t==="")throw new Tk(e,t,n);let[r,i,o]=[null,e,""];for(let a of fv(t))i[a]===void 0&&(i[a]={}),r=i,i=i[a],o=a;r[o]=n}function XDe(e,t){if(t==="")throw new Ik(e,t);let[n,r,i]=[null,e,""];for(let o of fv(t)){if(r[o]===void 0||r[o]===null)return;n=r,r=r[o],i=o}if(Array.isArray(n)){let o=parseInt(i);n.splice(o,1)}else delete n[i]}function QDe(e,t){if(t==="")return!0;let[n,r,i]=[null,e,""];for(let o of fv(t)){if(r[o]===void 0)return!1;n=r,r=r[o],i=o}return Object.getOwnPropertyNames(n).includes(i)}function ZDe(e,t){if(t==="")return e;let n=e;for(let r of fv(t)){if(n[r]===void 0)return;n=n[r]}return n}function e2e(e,t){if(!Ut(t))return!1;let n=[...Object.keys(e),...Object.getOwnPropertySymbols(e)],r=[...Object.keys(t),...Object.getOwnPropertySymbols(t)];return n.length!==r.length?!1:n.every(i=>Vm(e[i],t[i]))}function t2e(e,t){return Xo(t)&&e.getTime()===t.getTime()}function n2e(e,t){return!Rt(t)||e.length!==t.length?!1:e.every((n,r)=>Vm(n,t[r]))}function r2e(e,t){return!As(t)||e.length!==t.length||Object.getPrototypeOf(e).constructor.name!==Object.getPrototypeOf(t).constructor.name?!1:e.every((n,r)=>Vm(n,t[r]))}function i2e(e,t){return e===t}function Vm(e,t){if(Xo(e))return t2e(e,t);if(As(e))return r2e(e,t);if(Rt(e))return n2e(e,t);if(Ut(e))return e2e(e,t);if(za(e))return i2e(e,t);throw new Error("ValueEquals: Unable to compare value")}var o2e=Mn({type:yn("insert"),path:Qo(),value:Ic()}),a2e=Mn({type:yn("update"),path:Qo(),value:Ic()}),s2e=Mn({type:yn("delete"),path:Qo()}),mV=Ln([o2e,a2e,s2e]),kk=class extends Mt{constructor(t,n){super(n),this.value=t}};function Ek(e,t){return{type:"update",path:e,value:t}}function fV(e,t){return{type:"insert",path:e,value:t}}function hV(e){return{type:"delete",path:e}}function dV(e){if(globalThis.Object.getOwnPropertySymbols(e).length>0)throw new kk(e,"Cannot diff objects with symbols")}function*c2e(e,t,n){if(dV(t),dV(n),!UL(n))return yield Ek(e,n);let r=globalThis.Object.getOwnPropertyNames(t),i=globalThis.Object.getOwnPropertyNames(n);for(let o of i)Tt(t,o)||(yield fV(`${e}/${o}`,n[o]));for(let o of r)Tt(n,o)&&(Vm(t,n)||(yield*Sk(`${e}/${o}`,t[o],n[o])));for(let o of r)Tt(n,o)||(yield hV(`${e}/${o}`))}function*u2e(e,t,n){if(!Rt(n))return yield Ek(e,n);for(let r=0;r<Math.min(t.length,n.length);r++)yield*Sk(`${e}/${r}`,t[r],n[r]);for(let r=0;r<n.length;r++)r<t.length||(yield fV(`${e}/${r}`,n[r]));for(let r=t.length-1;r>=0;r--)r<n.length||(yield hV(`${e}/${r}`))}function*l2e(e,t,n){if(!As(n)||t.length!==n.length||globalThis.Object.getPrototypeOf(t).constructor.name!==globalThis.Object.getPrototypeOf(n).constructor.name)return yield Ek(e,n);for(let r=0;r<Math.min(t.length,n.length);r++)yield*Sk(`${e}/${r}`,t[r],n[r])}function*p2e(e,t,n){t!==n&&(yield Ek(e,n))}function*Sk(e,t,n){if(UL(t))return yield*c2e(e,t,n);if(Rt(t))return yield*u2e(e,t,n);if(As(t))return yield*l2e(e,t,n);if(za(t))return yield*p2e(e,t,n);throw new kk(t,"Unable to diff value")}function gV(e,t){return[...Sk("",e,t)]}function d2e(e){return e.length>0&&e[0].path===""&&e[0].type==="update"}function m2e(e){return e.length===0}function yV(e,t){if(d2e(t))return An(t[0].value);if(m2e(t))return An(e);let n=An(e);for(let r of t)switch(r.type){case"insert":{Pc.Set(n,r.path,r.value);break}case"update":{Pc.Set(n,r.path,r.value);break}case"delete":{Pc.Delete(n,r.path);break}}return n}function _V(...e){let[t,n,r]=e.length===3?[e[0],e[1],e[2]]:[e[0],[],e[1]],i=Hm(t,n)?bk(t,n,r):r;if(!Kt(t,n,i))throw new vk(t,i,Jp(t,n,i).First());return i}function Ak(e){return Ut(e)&&!Rt(e)}var Rk=class extends Mt{constructor(t){super(t)}};function f2e(e,t,n,r){if(!Ak(n))Pc.Set(e,t,An(r));else{let i=Object.getOwnPropertyNames(n),o=Object.getOwnPropertyNames(r);for(let a of i)o.includes(a)||delete n[a];for(let a of o)i.includes(a)||(n[a]=null);for(let a of o)SM(e,`${t}/${a}`,n[a],r[a])}}function h2e(e,t,n,r){if(!Rt(n))Pc.Set(e,t,An(r));else{for(let i=0;i<r.length;i++)SM(e,`${t}/${i}`,n[i],r[i]);n.splice(r.length)}}function g2e(e,t,n,r){if(As(n)&&n.length===r.length)for(let i=0;i<n.length;i++)n[i]=r[i];else Pc.Set(e,t,An(r))}function y2e(e,t,n,r){n!==r&&Pc.Set(e,t,r)}function SM(e,t,n,r){if(Rt(r))return h2e(e,t,n,r);if(As(r))return g2e(e,t,n,r);if(Ak(r))return f2e(e,t,n,r);if(za(r))return y2e(e,t,n,r)}function xV(e){return As(e)||za(e)}function _2e(e,t){return Ak(e)&&Rt(t)||Rt(e)&&Ak(t)}function vV(e,t){if(xV(e)||xV(t))throw new Rk("Only object and array types can be mutated at the root level");if(_2e(e,t))throw new Rk("Cannot assign due type mismatch of assignable values");SM(e,"",e,t)}var Ck=class extends Mt{constructor(t){super(t)}},AM;(function(e){let t=new Map([["Assert",(o,a,c)=>(mk(o,a,c),c)],["Cast",(o,a,c)=>pv(o,a,c)],["Clean",(o,a,c)=>hk(o,a,c)],["Clone",(o,a,c)=>An(c)],["Convert",(o,a,c)=>yk(o,a,c)],["Decode",(o,a,c)=>Hm(o,a)?xk(o,a,c):c],["Default",(o,a,c)=>wk(o,a,c)],["Encode",(o,a,c)=>Hm(o,a)?bk(o,a,c):c]]);function n(o){t.delete(o)}e.Delete=n;function r(o,a){t.set(o,a)}e.Set=r;function i(o){return t.get(o)}e.Get=i})(AM||(AM={}));var bV=["Clone","Clean","Default","Convert","Assert","Decode"];function x2e(e,t,n,r){return e.reduce((i,o)=>{let a=AM.Get(o);if(xr(a))throw new Ck(`Unable to find Parse operation '${o}'`);return a(t,n,i)},r)}function wV(...e){let[t,n,r,i]=e.length===4?[e[0],e[1],e[2],e[3]]:e.length===3?Rt(e[0])?[e[0],e[1],[],e[2]]:[bV,e[0],e[1],e[2]]:e.length===2?[bV,e[0],[],e[1]]:(()=>{throw new Ck("Invalid Arguments")})();return x2e(t,n,r,i)}var Ag={};On(Ag,{Assert:()=>mk,Cast:()=>pv,Check:()=>Kt,Clean:()=>hk,Clone:()=>An,Convert:()=>yk,Create:()=>Sc,Decode:()=>lV,Default:()=>wk,Diff:()=>gV,Edit:()=>mV,Encode:()=>_V,Equal:()=>Vm,Errors:()=>Jp,Hash:()=>Sg,Mutate:()=>vV,Parse:()=>wV,Patch:()=>yV,ValueErrorIterator:()=>zp});var zm=s.Union([s.Literal("runtime_unavailable"),s.Literal("capability_missing"),s.Literal("input_invalid"),s.Literal("lease_conflict"),s.Literal("lease_expired"),s.Literal("execution_failed"),s.Literal("rate_limit"),s.Literal("timeout"),s.Literal("cancelled"),s.Literal("output_invalid"),s.Literal("artifact_commit_failed"),s.Literal("max_attempts_exceeded"),s.Literal("context_assembly_failed"),s.Literal("history_not_found"),s.Literal("trajectory_ambiguous"),s.Literal("storage_unavailable"),s.Literal("workspace_invalid"),s.Literal("workspace_dirty"),s.Literal("query_invalid")]),TV=["runtime_unavailable","capability_missing","input_invalid","lease_conflict","lease_expired","execution_failed","rate_limit","timeout","cancelled","output_invalid","artifact_commit_failed","max_attempts_exceeded","context_assembly_failed","history_not_found","trajectory_ambiguous","storage_unavailable","workspace_invalid","workspace_dirty","query_invalid"];var RM={runtime_unavailable:"runtime_unavailable",capability_missing:"config_missing",input_invalid:"config_missing",lease_conflict:"runtime_unavailable",lease_expired:"runtime_unavailable",execution_failed:"runtime_unavailable",rate_limit:"runtime_unavailable",timeout:"runtime_timeout",cancelled:"runtime_timeout",output_invalid:"output_invalid",artifact_commit_failed:"artifact_missing",max_attempts_exceeded:"runtime_timeout",context_assembly_failed:"runtime_unavailable",history_not_found:"runtime_unavailable",trajectory_ambiguous:"runtime_unavailable",storage_unavailable:"ledger_write_failed",workspace_invalid:"config_missing",workspace_dirty:"artifact_missing",query_invalid:"runtime_unavailable"};for(let e of TV)if(!Object.hasOwn(RM,e))throw new Error(`FAILURE_CATEGORY_MAP is missing mapping for PDErrorCategory: ${e}`);var v2e="^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$",Mr=s.String({minLength:1}),IV="governance-iso-utc";gu.Set(IV,e=>{if(!new RegExp(v2e).test(e))return!1;let t=new Date(e);if(!Number.isFinite(t.getTime()))return!1;let n=e.includes(".")?e:e.replace("Z",".000Z");return t.toISOString()===n});var Ll=s.String({format:IV}),Rg=s.Union([s.Literal("prompt"),s.Literal("code_tool_hook"),s.Literal("defer_archive")]),Jm=s.Union([s.Literal("strong"),s.Literal("weak"),s.Literal("unknown")]),Fi=s.Object({type:s.Union([s.Literal("principle"),s.Literal("artifact"),s.Literal("task"),s.Literal("run"),s.Literal("approval"),s.Literal("activation"),s.Literal("trajectory")]),id:Mr},{additionalProperties:!1}),CM=s.Union([s.Object({kind:s.Literal("evaluator_repair"),sourceEvaluatorTaskId:Mr,sourceArtificerArtifactId:Mr,repairIteration:s.Integer({minimum:0})},{additionalProperties:!1}),s.Object({kind:s.Literal("rollout_reopen"),causeId:Mr,sourceRolloutTaskId:Mr,sourceArtifactId:Mr,revisionIteration:s.Integer({minimum:0}),taskRevisionEpoch:s.Optional(s.Integer({minimum:0}))},{additionalProperties:!1}),s.Object({kind:s.Literal("none")},{additionalProperties:!1})]),Cg={schemaVersion:s.Literal("1"),sourceRef:Fi,principleId:Mr,artifactId:s.Optional(Mr),taskId:s.Optional(Mr),lineageKey:s.Optional(Mr),lineageConfidence:Jm,revisionIdentity:s.Optional(CM),occurredAt:s.Optional(Ll),recordedAt:Ll},kV=s.Object({...Cg,family:s.Literal("principle"),state:s.Union([s.Literal("candidate"),s.Literal("active"),s.Literal("archived"),s.Literal("deprecated"),s.Literal("probation")])},{additionalProperties:!1}),OM=s.Object({...Cg,family:s.Literal("task"),taskKind:s.Union([s.Literal("dreamer"),s.Literal("philosopher"),s.Literal("scribe"),s.Literal("artificer"),s.Literal("evaluator"),s.Literal("rollout_reviewer")]),channel:Rg,status:s.Union([s.Literal("pending"),s.Literal("leased"),s.Literal("succeeded"),s.Literal("retry_wait"),s.Literal("failed"),s.Literal("needs_human_review")]),leaseExpiresAt:s.Optional(Ll),attemptCount:s.Integer({minimum:0}),maxAttempts:s.Integer({minimum:1}),lastErrorCategory:s.Optional(zm),completionIntent:s.Optional(s.Object({status:s.Union([s.Literal("pending"),s.Literal("applied")]),revisionEpoch:s.Integer({minimum:0}),effect:s.Union([s.Literal("governance_transition"),s.Literal("needs_human_review")])},{additionalProperties:!1}))},{additionalProperties:!1}),EV=s.Object({...Cg,family:s.Literal("runner_verdict"),runnerKind:s.Union([s.Literal("evaluator"),s.Literal("rollout_reviewer")]),outcome:s.Union([s.Literal("approved"),s.Literal("approve_rollout"),s.Literal("needs_revision"),s.Literal("rejected"),s.Literal("reject")])},{additionalProperties:!1}),SV=s.Object({...Cg,family:s.Literal("approval"),approvalId:Mr,artifactId:Mr,channel:Rg,outcome:s.Union([s.Literal("pending"),s.Literal("approved"),s.Literal("rejected"),s.Literal("cancelled")])},{additionalProperties:!1}),AV=s.Object({...Cg,family:s.Literal("activation"),artifactId:Mr,activationId:Mr,channel:Rg,outcome:s.Union([s.Literal("active"),s.Literal("deactivated")]),activatedAt:Ll,deactivatedAt:s.Optional(Ll)},{additionalProperties:!1}),RV=s.Object({...Cg,family:s.Literal("derived_relation"),relation:s.Union([s.Literal("successor_present"),s.Literal("revision_materialized"),s.Literal("revision_pending"),s.Literal("verdict_missing")]),evidenceRefs:s.Array(Fi)},{additionalProperties:!1}),PM=s.Object({code:s.Union([s.Literal("pain_created"),s.Literal("candidate_generated"),s.Literal("review_started"),s.Literal("revision_requested"),s.Literal("revision_reopened"),s.Literal("approved"),s.Literal("rejected"),s.Literal("activated"),s.Literal("deactivated"),s.Literal("failed"),s.Literal("human_review")]),occurredAt:s.Optional(Ll),recordedAt:Ll,summaryCode:Mr,sourceRef:Fi,lineageConfidence:Jm},{additionalProperties:!1}),LM=s.Object({source:s.Union([s.Literal("ledger"),s.Literal("artifact"),s.Literal("task"),s.Literal("approval"),s.Literal("activation"),s.Literal("trajectory"),s.Literal("lineage")]),reasonCode:Mr,nextActionCode:Mr,sourceRef:s.Optional(Fi)},{additionalProperties:!1}),CV=s.Object({principleId:Mr,artifactIds:s.Array(Mr),taskIds:s.Array(Mr),revisionIdentities:s.Array(CM),confidence:Jm,sourceRefs:s.Array(Fi)},{additionalProperties:!1}),OV=s.Object({schemaVersion:s.Literal("1"),principleId:Mr,asOf:Ll,lineage:CV,principle:kV,tasks:s.Array(OM),runnerVerdicts:s.Array(EV),derivedRelations:s.Array(RV),approvals:s.Array(SV),activations:s.Array(AV),timelineEvents:s.Array(PM),collectionIssues:s.Array(LM)},{additionalProperties:!1}),PV=s.Object({value:s.Union([s.Literal("candidate"),s.Literal("active"),s.Literal("archived"),s.Literal("deprecated"),s.Literal("probation")]),sourceRefs:s.Array(Fi)},{additionalProperties:!1}),LV=s.Object({stage:s.Optional(s.Union([s.Literal("generating"),s.Literal("reviewing"),s.Literal("revising"),s.Literal("approval"),s.Literal("activation")])),currentTaskKind:s.Optional(OM.properties.taskKind),sourceRefs:s.Array(Fi)},{additionalProperties:!1}),MV=s.Object({state:s.Union([s.Literal("idle"),s.Literal("queued"),s.Literal("running"),s.Literal("retry_scheduled"),s.Literal("stalled")]),sourceRefs:s.Array(Fi)},{additionalProperties:!1}),NV=s.Object({kind:s.Union([s.Literal("owner_decision"),s.Literal("recovery")]),reasonCode:Mr,sourceRef:Fi},{additionalProperties:!1}),DV=s.Object({primary:s.Union([s.Literal("none"),s.Literal("owner_required"),s.Literal("recovery_required")]),items:s.Array(NV)},{additionalProperties:!1}),$V=s.Object({state:s.Union([s.Literal("none"),s.Literal("active"),s.Literal("partially_active"),s.Literal("deactivated")]),channels:s.Array(Rg),observedChannels:s.Array(Rg),sourceRefs:s.Array(Fi)},{additionalProperties:!1}),b2e=s.Union([s.Literal("governance.headline.owner_decision"),s.Literal("governance.headline.recovery"),s.Literal("governance.headline.revision"),s.Literal("governance.headline.processing"),s.Literal("governance.headline.active"),s.Literal("governance.headline.unavailable"),s.Literal("governance.headline.recorded")]),w2e=s.Union([s.Literal("governance.reason.approval_pending"),s.Literal("governance.reason.recovery_required"),s.Literal("governance.reason.automatic_revision"),s.Literal("governance.reason.processing"),s.Literal("governance.reason.activation_active"),s.Literal("governance.reason.data_incomplete"),s.Literal("governance.reason.no_current_process")]),T2e=s.Union([s.Literal("governance.next.review"),s.Literal("governance.next.inspect_recovery"),s.Literal("governance.next.wait"),s.Literal("governance.next.monitor"),s.Literal("governance.next.inspect_data"),s.Literal("governance.next.none")]),FV=s.Object({headlineCode:b2e,reasonCode:w2e,nextActionCode:T2e,ownerActionRequired:s.Boolean(),safeReasonSummary:s.Optional(Mr),sourceRefs:s.Array(Fi)},{additionalProperties:!1}),UV=s.Object({degraded:s.Boolean(),issues:s.Array(LM)},{additionalProperties:!1}),Ok=s.Object({schemaVersion:s.Literal("1"),principleId:Mr,asOf:Ll,summary:FV,principleState:PV,process:LV,automation:MV,attention:DV,activationSummary:$V,timeline:s.Array(PM),sourceRefs:s.Array(Fi),dataQuality:UV},{additionalProperties:!1});var vu=s.String({minLength:1}),WV=s.String({format:"governance-iso-utc"}),MM=s.Union([s.Literal("setup_required"),s.Literal("owner_decision_required"),s.Literal("recovery_required"),s.Literal("degraded"),s.Literal("background_processing"),s.Literal("all_clear")]),NM=s.Union([s.Literal("governance.exp.reason.owner_identity_missing"),s.Literal("governance.exp.reason.owner_identity_invalid"),s.Literal("governance.exp.reason.owner_authentication_missing"),s.Literal("governance.exp.reason.approval_pending"),s.Literal("governance.exp.reason.rulecode_owner_decision"),s.Literal("governance.exp.reason.no_pending_decision"),s.Literal("governance.exp.reason.owner_decision_available"),s.Literal("governance.exp.reason.break_glass_entry"),s.Literal("governance.exp.reason.recovery_required"),s.Literal("governance.exp.reason.source_unavailable"),s.Literal("governance.exp.reason.config_invalid"),s.Literal("governance.exp.reason.processing"),s.Literal("governance.exp.reason.workspace_clear"),s.Literal("governance.exp.reason.workspace_empty")]),DM=s.Union([s.Literal("governance.exp.next.configure_owner"),s.Literal("governance.exp.next.authenticate_console"),s.Literal("governance.exp.next.review_approvals"),s.Literal("governance.exp.next.inspect_recovery"),s.Literal("governance.exp.next.inspect_sources"),s.Literal("governance.exp.next.fix_config"),s.Literal("governance.exp.next.monitor"),s.Literal("governance.exp.next.none")]),qV=s.Union([s.Literal("production"),s.Literal("development"),s.Literal("demo"),s.Literal("test")]),$M=s.Object({environment:s.Union([qV,s.Literal("unknown")]),source:s.Union([s.Literal("workspace_config"),s.Literal("missing")]),configIssue:s.Optional(vu)},{additionalProperties:!1}),jV=s.Object({sourceId:s.Union([s.Literal("state_db"),s.Literal("principle_ledger")]),available:s.Boolean(),reasonCode:s.Optional(vu)},{additionalProperties:!1}),GV=s.Object({source:s.Union([s.Literal("approval"),s.Literal("task"),s.Literal("artifact"),s.Literal("principle"),s.Literal("activation")]),reasonCode:vu,count:s.Integer({minimum:0}),sampleRefs:s.Array(Fi,{maxItems:10})},{additionalProperties:!1}),Pk=s.Object({authenticationMode:s.Union([s.Literal("authenticated"),s.Literal("no_auth")]),ownerIdentityConfiguration:s.Union([s.Literal("configured"),s.Literal("missing"),s.Literal("invalid")])},{additionalProperties:!1}),BV=s.Object({view:Ok,lineageConfidence:Jm},{additionalProperties:!1}),KV=s.Object({sourceId:s.Literal("state_db"),activeTaskCount:s.Integer({minimum:0}),sampleRefs:s.Array(Fi,{maxItems:10})},{additionalProperties:!1}),HV=s.Object({schemaVersion:s.Literal("1"),asOf:WV,workspaceHash:vu,governanceViews:s.Array(BV),ownerConfigSnapshot:Pk,environmentContext:$M,sourceAvailability:s.Array(jV),dataQualityInputs:s.Array(GV),frontierEvidence:s.Optional(KV),rulecodeDecisionEvidence:s.Optional(s.Object({pendingCount:s.Integer({minimum:0}),sampleRefs:s.Array(Fi,{maxItems:10})},{additionalProperties:!1}))},{additionalProperties:!1}),VV=s.Union([s.Literal("principle_approval"),s.Literal("rulecode_owner_decision"),s.Literal("emergency_pause")]),zV=s.Union([s.Literal("operator_legacy"),s.Literal("configured_owner"),s.Literal("break_glass")]),JV=s.Object({kind:VV,observedAuthority:zV,status:s.Union([s.Literal("entry_conditions_met"),s.Literal("blocked")]),reasonCode:NM,nextActionCode:DM},{additionalProperties:!1}),YV=s.Object({authenticationMode:Pk.properties.authenticationMode,ownerIdentityConfiguration:Pk.properties.ownerIdentityConfiguration,governanceActions:s.Array(JV,{minItems:3,maxItems:3})},{additionalProperties:!1}),FM=s.Union([s.Literal("blocked"),s.Literal("needs_recovery"),s.Literal("needs_decision"),s.Literal("processing")]),XV=s.Object({principleId:s.Optional(vu),category:FM,reasonCode:vu,sourceRefs:s.Array(Fi,{maxItems:10})},{additionalProperties:!1}),QV=s.Object({category:FM,count:s.Integer({minimum:0}),items:s.Array(XV,{maxItems:10}),hasMore:s.Boolean()},{additionalProperties:!1}),ZV=s.Object({primaryAttention:MM,categories:s.Array(QV)},{additionalProperties:!1}),ez=s.Object({confidence:Jm,strongViewCount:s.Integer({minimum:0}),weakViewCount:s.Integer({minimum:0}),unknownViewCount:s.Integer({minimum:0})},{additionalProperties:!1}),tz=s.Object({environmentContext:$M,lineageTransparency:ez},{additionalProperties:!1}),nz=s.Object({source:s.Union([s.Literal("ledger"),s.Literal("artifact"),s.Literal("task"),s.Literal("approval"),s.Literal("activation"),s.Literal("trajectory"),s.Literal("lineage"),s.Literal("workspace")]),reasonCode:vu,nextActionCode:vu,count:s.Integer({minimum:1}),sampleRefs:s.Array(Fi,{maxItems:3})},{additionalProperties:!1}),rz=s.Object({degraded:s.Boolean(),issueGroups:s.Array(nz,{maxItems:10}),hasMore:s.Boolean()},{additionalProperties:!1}),iz=s.Object({primaryAttention:MM,headlineCode:vu,reasonCode:NM,nextActionCode:DM},{additionalProperties:!1}),oz=s.Object({schemaVersion:s.Literal("1"),snapshotId:vu,asOf:WV,summary:iz,readiness:YV,activity:ZV,trustContext:tz,dataQuality:rz},{additionalProperties:!1});var az="1";var sz=32,Ym=s.Union([s.Boolean(),s.Null()]),E2e=s.Object({schemaVersion:s.Literal(az),dailyTelemetryId:s.String(),bucketDate:s.String(),pdVersion:s.String({maxLength:sz}),hostKind:s.Union([s.Literal("openclaw"),s.Literal("codex"),s.Literal("other")]),milestones:s.Object({initialized:Ym,painObserved:Ym,principleObserved:Ym,activationObserved:Ym,presenceReceiptObserved:Ym,effectReceiptObserved:Ym}),reliability:s.Object({initializationFailed:Ym}),consentVersion:s.String()});var Lc=s.Union([s.Literal("openclaw"),s.Literal("openclaw-cli"),s.Literal("openclaw-history"),s.Literal("claude-cli"),s.Literal("codex-cli"),s.Literal("gemini-cli"),s.Literal("local-worker"),s.Literal("test-double"),s.Literal("pi-ai"),s.Literal("pi-ai-l2")]),S2e=s.Object({supportsStructuredJsonOutput:s.Boolean(),supportsToolUse:s.Boolean(),supportsWorkingDirectory:s.Boolean(),supportsModelSelection:s.Boolean(),supportsLongRunningSessions:s.Boolean(),supportsCancellation:s.Boolean(),supportsArtifactWriteBack:s.Boolean(),supportsConcurrentRuns:s.Boolean(),supportsStreaming:s.Boolean(),capabilitiesValidUntil:s.Optional(s.String()),dynamicCapabilities:s.Optional(s.Object({toolsAvailable:s.Optional(s.Array(s.String())),modelOptions:s.Optional(s.Array(s.String()))}))}),A2e=s.Object({healthy:s.Boolean(),degraded:s.Boolean(),warnings:s.Array(s.String()),lastCheckedAt:s.String()}),R2e=s.Object({runId:s.String({minLength:1}),runtimeKind:Lc,startedAt:s.String()}),UM=s.Union([s.Literal("queued"),s.Literal("running"),s.Literal("succeeded"),s.Literal("failed"),s.Literal("timed_out"),s.Literal("cancelled")]),C2e=s.Object({runId:s.String({minLength:1}),status:UM,startedAt:s.Optional(s.String()),endedAt:s.Optional(s.String()),reason:s.Optional(s.String())}),cz=s.Object({runId:s.String({minLength:1}),runtimeKind:Lc,startedAt:s.String(),taskId:s.String({minLength:1}),attemptNumber:s.Integer({minimum:0}),executionStatus:UM,endedAt:s.Optional(s.String()),reason:s.Optional(s.String()),outputRef:s.Optional(s.String()),createdAt:s.String(),updatedAt:s.String(),inputPayload:s.Optional(s.String()),outputPayload:s.Optional(s.String()),errorCategory:s.Optional(zm)}),uz=s.Object({role:s.Union([s.Literal("user"),s.Literal("system"),s.Literal("tool")]),content:s.String()}),lz=s.Object({agentId:s.String({minLength:1}),schemaVersion:s.String({minLength:1})}),pz=s.Object({workflowId:s.String({minLength:1})}),dz=s.Object({taskId:s.String({minLength:1})}),O2e=s.Object({agentSpec:lz,workflowRef:s.Optional(pz),taskRef:s.Optional(dz),inputPayload:s.Unknown(),contextItems:s.Array(uz),outputSchemaRef:s.Optional(s.String()),artifactContractRef:s.Optional(s.String()),timeoutMs:s.Number({minimum:0}),idempotencyKey:s.Optional(s.String()),preferredModel:s.Optional(s.String()),preferredRuntimeProfile:s.Optional(s.String())}),P2e=s.Object({runId:s.String(),payload:s.Unknown()}),L2e=s.Object({artifactType:s.String(),ref:s.String()});var mz=s.Object({structuredJson:s.Boolean(),toolUse:s.Optional(s.Boolean()),workingDirectory:s.Optional(s.Boolean())}),fz=s.Object({defaultTimeoutMs:s.Number({minimum:0})}),hz=s.Object({maxAttempts:s.Integer({minimum:1})}),WM=s.Object({agentId:s.String({minLength:1}),role:s.String({minLength:1}),schemaVersion:s.String({minLength:1}),inputSchemaRef:s.String({minLength:1}),outputSchemaRef:s.String({minLength:1}),artifactContractRef:s.Optional(s.String()),timeoutPolicy:fz,retryPolicy:hz,capabilitiesRequired:mz,preferredRuntimeKinds:s.Optional(s.Array(Lc)),preferredModelProfile:s.Optional(s.String())});var gz=["pending","leased","succeeded","retry_wait","failed","needs_human_review"],yz=s.Union([...gz.map(e=>s.Literal(e))]);var qM=s.Object({taskId:s.String({minLength:1}),taskKind:s.String({minLength:1}),status:yz,createdAt:s.String(),updatedAt:s.String(),leaseOwner:s.Optional(s.String()),leaseExpiresAt:s.Optional(s.String()),attemptCount:s.Integer({minimum:0}),maxAttempts:s.Integer({minimum:1}),lastError:s.Optional(s.Union([zm,s.Null()])),inputRef:s.Optional(s.String()),resultRef:s.Optional(s.String()),diagnosticJson:s.Optional(s.String())}),M2e=s.Intersect([qM,s.Object({taskKind:s.Literal("diagnostician"),sourcePainId:s.Optional(s.String()),workspaceDir:s.String(),severity:s.Optional(s.String()),source:s.Optional(s.String()),sessionIdHint:s.Optional(s.String()),agentIdHint:s.Optional(s.String()),reasonSummary:s.String(),provenance:s.Optional(s.Union([s.Literal("host_context_bound"),s.Literal("owner_reported_no_host_trace"),s.Literal("automatic_hook"),s.Literal("openclaw_context_bound")])),hostKind:s.Optional(s.Union([s.Literal("openclaw"),s.Literal("codex")])),provenanceReason:s.Optional(s.String()),evidence:s.Optional(s.Array(s.Object({sourceRef:s.String({minLength:1}),note:s.String({minLength:1,maxLength:200})})))})]);var N2e=s.Object({agentSpec:WM,workspacePolicy:s.Optional(s.Object({allowedRuntimes:s.Optional(s.Array(Lc)),blockedRuntimes:s.Optional(s.Array(Lc))})),fallbackEnabled:s.Optional(s.Boolean())});var Lk=["tool_call","tool_result","assistant_message","user_message","system_event","unknown"],_z=s.Union(Lk.map(e=>s.Literal(e))),Mk=["task","run","artifact","event"],xz=s.Union(Mk.map(e=>s.Literal(e))),vz=s.Object({kind:xz,id:s.String({minLength:1})}),bz=s.Object({at:s.Union([s.String({minLength:1}),s.Null()]),kind:_z,summary:s.String({minLength:1}),rawPreview:s.Optional(s.String()),metadata:s.Optional(s.Record(s.String(),s.Unknown()))}),wz=s.Object({sourceTaskId:s.String({minLength:1}),sourcePainId:s.String({minLength:1}),sourceRunIds:s.Array(s.String({minLength:1})),capturedAt:s.String({minLength:1}),sourceRefs:s.Array(vz),timeline:s.Array(bz),ambiguityNotes:s.Array(s.String()),sanitizationNotes:s.Array(s.String())}),dDt=new Set(Lk),mDt=new Set(Mk);var Nk=s.Object({ts:s.String({minLength:1}),role:s.Union([s.Literal("user"),s.Literal("assistant"),s.Literal("tool"),s.Literal("system")]),text:s.Optional(s.String()),toolName:s.Optional(s.String()),toolResultSummary:s.Optional(s.String()),eventType:s.Optional(s.String())}),Ez=s.Object({painId:s.Optional(s.String({minLength:1})),taskId:s.Optional(s.String({minLength:1})),runId:s.Optional(s.String({minLength:1})),sessionId:s.Optional(s.String({minLength:1})),timeRange:s.Optional(s.Object({start:s.String({minLength:1}),end:s.String({minLength:1})})),workspace:s.Optional(s.String({minLength:1})),executionStatus:s.Optional(s.String({minLength:1}))}),Sz=s.Object({trajectoryRef:s.String({minLength:1}),confidence:s.Number({minimum:0,maximum:1}),reasons:s.Array(s.String({minLength:1})),sourceTypes:s.Optional(s.Array(s.String({minLength:1})))}),Az=s.Object({query:Ez,candidates:s.Array(Sz)}),Rz=s.Object({sourceRef:s.String({minLength:1}),entries:s.Array(Nk),truncated:s.Boolean(),nextCursor:s.Optional(s.String({minLength:1}))}),$2e=s.Object({sourceRef:s.String({minLength:1}),note:s.String({minLength:1,maxLength:200})}),GM=s.Object({reasonSummary:s.Optional(s.String()),source:s.Optional(s.String()),severity:s.Optional(s.String()),painId:s.Optional(s.String({minLength:1})),sessionIdHint:s.Optional(s.String({minLength:1})),provenance:s.Optional(s.Union([s.Literal("host_context_bound"),s.Literal("owner_reported_no_host_trace"),s.Literal("automatic_hook")])),hostKind:s.Optional(s.Union([s.Literal("openclaw"),s.Literal("codex")])),provenanceReason:s.Optional(s.String()),traceAvailability:s.Optional(s.Union([s.Literal("available"),s.Literal("unavailable_with_reason"),s.Literal("ambiguous")])),traceUnavailableDetail:s.Optional(s.Object({reason:s.String(),nextAction:s.String()})),evidence:s.Optional(s.Array($2e))}),Cz=s.Object({toolName:s.Optional(s.String()),status:s.Optional(s.String()),params:s.Optional(s.String()),resultSummary:s.Optional(s.String()),errorSummary:s.Optional(s.String()),startedAt:s.Optional(s.String()),completedAt:s.Optional(s.String())}),Oz=s.Object({painId:s.Optional(s.String({minLength:1})),severity:s.Optional(s.String()),source:s.Optional(s.String()),reasonSummary:s.Optional(s.String()),sessionIdHint:s.Optional(s.String())}),Pz=s.Object({painContext:Oz,scratchpad:s.Array(s.String()),toolCallHistory:s.Array(Cz)});var F2e=s.Object({contextId:s.String({minLength:1}),sourceRefs:s.Array(s.String({minLength:1})),targetAgent:s.Optional(s.String({minLength:1})),diagnosisTarget:s.Optional(GM),conversationWindow:s.Array(Nk),artifactRefs:s.Optional(s.Array(s.String({minLength:1}))),ambiguityNotes:s.Optional(s.Array(s.String())),summary:s.String({minLength:1})}),Lz=s.Object({contextId:s.String({minLength:1}),contextHash:s.String({minLength:1}),taskId:s.String({minLength:1}),workspaceDir:s.String({minLength:1}),sourceRefs:s.Array(s.String({minLength:1})),diagnosisTarget:GM,conversationWindow:s.Array(Nk),ambiguityNotes:s.Optional(s.Array(s.String())),fullTrace:s.Optional(s.Union([Pz,wz,s.Null()]))});var U2e=s.Union([s.Literal("People"),s.Literal("Design"),s.Literal("Assumption"),s.Literal("Tooling")]),W2e=s.Object({why:s.Number({minimum:1,maximum:5}),statement:s.String({minLength:1}),evidenceRefs:s.Array(s.String({minLength:1}),{minItems:1})}),q2e=s.Object({sourceRef:s.String({minLength:1}),note:s.String({minLength:1})}),Mz=s.Union([s.Literal("none"),s.Literal("action_drift"),s.Literal("intent_suspect"),s.Literal("healthy_tension")]),Nz=s.Union([s.Literal("weak"),s.Literal("moderate"),s.Literal("strong")]),Dz=s.Union([s.Literal("why"),s.Literal("desired_outcome"),s.Literal("non_negotiables"),s.Literal("stop_escalation"),s.Literal("current_strategic_focus")]),$z=s.Union([s.Literal("confirm_drift"),s.Literal("revise_intent"),s.Literal("observe"),s.Literal("dismiss"),s.Literal("promote_to_principle"),s.Literal("promote_to_rulehost")]);var Og=s.Object({source:Mz,evidenceStrength:Nz,relatedIntentFields:s.Array(Dz),evidence:s.Array(s.String(),{maxItems:3}),explanation:s.String({minLength:1}),suggestedOwnerAction:$z,intentDocHash:s.Optional(s.String())},{additionalProperties:!1}),Dk=s.Object({valid:s.Boolean(),diagnosisId:s.String({minLength:1}),taskId:s.String({minLength:1,description:"Lineage \u2014 re-injected if stripped; ERR-008"}),summary:s.String({minLength:1}),causalChain:s.Array(W2e),rootCause:s.String({minLength:1,description:'MUST include category prefix: "People: ..." or "Design: ..." or "Assumption: ..." or "Tooling: ..."'}),rootCauseCategory:U2e,evidence:s.Array(q2e),confidence:s.Number({minimum:0,maximum:1}),ambiguityNotes:s.Optional(s.Array(s.String())),intentTension:s.Optional(Og)});var Fz=s.Object({principleId:s.Optional(s.String({minLength:1})),title:s.Optional(s.String()),rationale:s.String({minLength:1})}),Uz=s.Object({sourceRef:s.String({minLength:1}),note:s.String({minLength:1})}),BM=s.Union([s.Literal("principle"),s.Literal("rule"),s.Literal("implementation"),s.Literal("prompt"),s.Literal("defer")]),Wz=s.Object({kind:BM,description:s.String({minLength:1}),triggerPattern:s.Optional(s.String({description:'Required when kind is "rule". Regex or keyword pattern for interception.'})),action:s.Optional(s.String({description:'Required when kind is "rule". Action to take when pattern matches.'})),abstractedPrinciple:s.Optional(s.String({description:'Required when kind is "principle". Highly abstracted, reusable wisdom (\u2264200 chars).'}))}),Xm=s.Object({valid:s.Boolean(),diagnosisId:s.String({minLength:1}),summary:s.String({minLength:1}),rootCause:s.String({minLength:1,description:'MUST include category prefix: "Design: ..." or "People: ..." or "Assumption: ..." or "Tooling: ..."'}),violatedPrinciples:s.Array(Fz),evidence:s.Array(Uz),recommendations:s.Array(Wz,{minItems:1}),confidence:s.Number({minimum:0,maximum:1,description:"A number between 0.0 and 1.0 (NOT a string, NOT a percentage)"}),ambiguityNotes:s.Optional(s.Array(s.String())),intentTension:s.Optional(Og)}),j2e=s.Object({agentId:s.String({minLength:1}),taskId:s.String({minLength:1}),context:s.Unknown(),outputSchemaRef:s.Literal("diagnostician-output-v1"),timeoutMs:s.Number({minimum:0})});var KM=["candidate","active","archived","deprecated","probation"],$k=s.Union([...KM.map(e=>s.Literal(e))]),Fk=s.Union([s.Literal("P0"),s.Literal("P1"),s.Literal("P2")]),Uk=s.Union([s.Literal("general"),s.Literal("domain"),s.Literal("scenario")]),Wk=s.Union([s.Literal("manual_only"),s.Literal("deterministic"),s.Literal("weak_heuristic")]),qk=s.Union([s.Literal("proposed"),s.Literal("implemented"),s.Literal("enforced"),s.Literal("retired")]),jk=s.Union([s.Literal("hook"),s.Literal("gate"),s.Literal("skill"),s.Literal("lora"),s.Literal("test"),s.Literal("prompt")]),Gk=s.Union([s.Literal("candidate"),s.Literal("active"),s.Literal("disabled"),s.Literal("archived")]),Bk=s.Union([s.Literal("code"),s.Literal("skill"),s.Literal("lora"),s.Literal("test"),s.Literal("prompt")]),qz=s.Union([s.Literal("pain-negative"),s.Literal("success-positive"),s.Literal("principle-anchor")]);var Kk=s.Object({id:s.String(),version:s.Number(),text:s.String(),coreAxiomId:s.Optional(s.String()),triggerPattern:s.String(),action:s.String(),status:$k,priority:Fk,scope:Uk,domain:s.Optional(s.String()),evaluability:Wk,valueScore:s.Number(),adherenceRate:s.Number(),painPreventedCount:s.Number(),lastPainPreventedAt:s.Optional(s.String()),derivedFromPainIds:s.Array(s.String()),ruleIds:s.Array(s.String()),conflictsWithPrincipleIds:s.Array(s.String()),supersedesPrincipleId:s.Optional(s.String()),createdAt:s.String(),updatedAt:s.String(),deprecatedAt:s.Optional(s.String()),deprecatedReason:s.Optional(s.String()),compilationRetryCount:s.Optional(s.Number())}),Hk=s.Object({id:s.String(),version:s.Number(),name:s.String(),description:s.String(),type:jk,triggerCondition:s.String(),enforcement:s.Union([s.Literal("block"),s.Literal("warn"),s.Literal("log")]),action:s.String(),principleId:s.String(),parentRuleId:s.Optional(s.String()),status:qk,coverageRate:s.Number(),falsePositiveRate:s.Number(),implementationPath:s.Optional(s.String()),testPath:s.Optional(s.String()),createdAt:s.String(),updatedAt:s.String()}),Vk=s.Object({id:s.String(),ruleId:s.String(),type:Bk,path:s.String(),version:s.String(),coversCondition:s.String(),coveragePercentage:s.Number(),lifecycleState:Gk,previousActive:s.Optional(s.String()),disabledAt:s.Optional(s.String()),disabledBy:s.Optional(s.String()),disabledReason:s.Optional(s.String()),archivedAt:s.Optional(s.String()),createdAt:s.String(),updatedAt:s.String()});var jz=s.Object({principleId:s.String(),dependsOn:s.Array(s.String()),conflictedWith:s.Array(s.String()),supersedes:s.Array(s.String())});var zk=s.Object({principleId:s.String(),painPreventedCount:s.Number(),avgPainSeverityPrevented:s.Number(),lastPainPreventedAt:s.Optional(s.String()),totalOpportunities:s.Number(),adheredCount:s.Number(),violatedCount:s.Number(),implementationCost:s.Number(),benefitScore:s.Number(),calculatedAt:s.String()});var HM=s.Union([s.Literal("principle_created"),s.Literal("principle_updated"),s.Literal("principle_promoted"),s.Literal("principle_deprecated"),s.Literal("rule_created"),s.Literal("rule_enforced"),s.Literal("rule_retired"),s.Literal("implementation_added"),s.Literal("value_metrics_updated")]),Gz=s.Object({ts:s.String(),type:HM,data:s.Object({principleId:s.Optional(s.String()),ruleId:s.Optional(s.String()),implementationId:s.Optional(s.String()),reason:s.String(),metrics:s.Optional(s.Record(s.String(),s.Any()))})});var Bz=s.Object({principles:s.Record(s.String(),Kk),rules:s.Record(s.String(),Hk),implementations:s.Record(s.String(),Vk),metrics:s.Record(s.String(),zk),lastUpdated:s.String()});var Kz=s.Object({ts:s.String(),tool:s.String(),path:s.String(),type:s.Union([s.Literal("memory"),s.Literal("plan"),s.Literal("other")]),contentLength:s.Number()}),Hz=s.Object({date:s.String(),persistenceCount:s.Number(),persistenceByFile:s.Record(s.String(),s.Number()),lastPersistenceTime:s.Optional(s.String()),totalCharsPersisted:s.Number(),groomingExecutedCount:s.Number(),lastGroomingTime:s.Optional(s.String())});var Vz=s.Object({queueState:s.Object({total:s.Number(),pending:s.Number(),inProgress:s.Number(),completed:s.Number(),lastUpdated:s.String()}),activeSessions:s.Array(s.String())}),Jk=s.Object({successRateChange:s.Number(),toolCallVolumeChange:s.Number(),painSignalRateChange:s.Number()}),zz=s.Object({trajectoryData:s.Object({totalTasks:s.Number(),successRate:s.Number(),timeoutRate:s.Number(),lastUpdated:s.String()}),dailyStats:s.Object({toolCalls:s.Number(),painSignals:s.Number(),evolutionTasks:s.Number(),lastUpdated:s.String()}),trends:s.Object({sevenDay:Jk,thirtyDay:Jk})});var VM=s.Union([s.Literal("tool_call"),s.Literal("pain_signal"),s.Literal("rule_promotion"),s.Literal("governance_action"),s.Literal("hook_execution"),s.Literal("gate_block"),s.Literal("gate_bypass"),s.Literal("evolution_task"),s.Literal("empathy_rollback"),s.Literal("error"),s.Literal("warn"),s.Literal("diagnosis_task"),s.Literal("heartbeat_diagnosis"),s.Literal("diagnostician_report"),s.Literal("principle_candidate"),s.Literal("rule_enforced"),s.Literal("rulehost_evaluated"),s.Literal("rulehost_blocked"),s.Literal("rulehost_requireApproval"),s.Literal("rulehost_auto_correct_proposed"),s.Literal("rulehost_auto_correct_applied"),s.Literal("runtime_v2_prompt_activations_injected"),s.Literal("rulehost_unhealthy"),s.Literal("rulehost_skipped")]),ea=s.Union([s.Literal("success"),s.Literal("failure"),s.Literal("detected"),s.Literal("blocked"),s.Literal("bypassed"),s.Literal("approved"),s.Literal("enqueued"),s.Literal("completed"),s.Literal("promoted"),s.Literal("passed"),s.Literal("changed"),s.Literal("rolled_back"),s.Literal("written"),s.Literal("injected"),s.Literal("created"),s.Literal("matched"),s.Literal("evaluated"),s.Literal("requireApproval"),s.Literal("auto_correct")]),Jz=s.Object({ts:s.String(),date:s.String(),type:VM,category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),Yz=s.Object({toolName:s.String(),filePath:s.Optional(s.String()),error:s.Optional(s.String()),errorType:s.Optional(s.String()),gfi:s.Optional(s.Number()),consecutiveErrors:s.Optional(s.Number()),exitCode:s.Optional(s.Number()),gfiBefore:s.Optional(s.Number()),gfiAfter:s.Optional(s.Number())}),Xz=s.Object({score:s.Number(),source:s.String(),eventId:s.Optional(s.String()),reason:s.Optional(s.String()),isRisky:s.Optional(s.Boolean()),origin:s.Optional(s.Union([s.Literal("assistant_self_report"),s.Literal("user_manual"),s.Literal("system_infer")])),severity:s.Optional(s.Union([s.Literal("mild"),s.Literal("moderate"),s.Literal("severe")])),confidence:s.Optional(s.Number()),detection_mode:s.Optional(s.Union([s.Literal("structured"),s.Literal("legacy_tag")])),deduped:s.Optional(s.Boolean()),trigger_text_excerpt:s.Optional(s.String()),raw_score:s.Optional(s.Number()),calibrated_score:s.Optional(s.Number())}),Qz=s.Object({fingerprint:s.String(),ruleId:s.String(),phrase:s.String(),sampleCount:s.Number(),avgSimilarity:s.Number()}),zM=s.Object({action:s.Union([s.Literal("deactivate"),s.Literal("promote"),s.Literal("global_pause")]),activationId:s.Optional(s.String({minLength:1})),subject:s.Optional(s.Literal("all_live_rulecode")),actor:s.Union([s.Literal("owner"),s.Literal("cli"),s.Literal("session")]),reasonCode:s.String({minLength:1,maxLength:200}),outcome:s.Literal("authorized")}),Zz=s.Object({hook:s.String(),sessionId:s.Optional(s.String()),durationMs:s.Optional(s.Number()),error:s.Optional(s.String())}),e8=s.Object({toolName:s.String(),filePath:s.String(),reason:s.String(),blockSource:s.Optional(s.String())}),t8=s.Object({toolName:s.String(),filePath:s.String(),bypassType:s.Union([s.Literal("stage4_architect"),s.Literal("whitelisted")])}),n8=s.Object({taskId:s.String(),taskType:s.String(),reason:s.String()}),r8=s.Object({eventId:s.String(),originalScore:s.Number(),originalSessionId:s.Optional(s.String()),reason:s.String(),triggeredBy:s.Union([s.Literal("user_command"),s.Literal("natural_language"),s.Literal("system")])}),i8=s.Object({taskCount:s.Number(),taskIds:s.Array(s.String()),trigger:s.Union([s.Literal("heartbeat"),s.Literal("immediate")])}),o8=s.Object({taskId:s.String(),painEventId:s.Optional(s.String()),sessionId:s.Optional(s.String())}),a8=s.Object({taskId:s.String(),reportPath:s.String(),category:s.Union([s.Literal("success"),s.Literal("missing_json"),s.Literal("incomplete_fields")])}),s8=s.Object({principleId:s.String(),taskId:s.String(),source:s.Union([s.Literal("diagnostician"),s.Literal("manual")])}),c8=s.Object({ruleId:s.String(),principleId:s.String(),enforcement:s.Union([s.Literal("warn"),s.Literal("block"),s.Literal("requireApproval")]),toolName:s.String(),filePath:s.String()}),u8=s.Object({toolName:s.String(),filePath:s.String(),matched:s.Boolean(),decision:s.Union([s.Literal("allow"),s.Literal("block"),s.Literal("requireApproval"),s.Literal("auto_correct"),s.Literal("no_rules_armed"),s.Literal("evaluation_failed")]),ruleId:s.Optional(s.String()),activationId:s.Optional(s.String()),activationMode:s.Optional(s.Union([s.Literal("shadow"),s.Literal("live")]))}),l8=s.Object({toolName:s.String(),filePath:s.String(),reason:s.String(),ruleId:s.Optional(s.String())}),p8=s.Object({toolName:s.String(),filePath:s.String(),reason:s.String(),ruleId:s.Optional(s.String())}),d8=s.Object({toolName:s.String(),filePath:s.String(),ruleId:s.String(),principleId:s.Optional(s.String()),confidence:s.Number(),reason:s.String(),applicationMode:s.Union([s.Literal("shadow"),s.Literal("live")]),correctedFields:s.Array(s.String()),validationValid:s.Boolean()}),m8=s.Object({toolName:s.String(),filePath:s.String(),ruleId:s.String(),principleId:s.Optional(s.String()),confidence:s.Number(),reason:s.String(),correctedFields:s.Array(s.Object({field:s.String(),original:s.Unknown(),applied:s.Unknown()}))}),f8=s.Object({sessionId:s.String(),workspaceDir:s.String(),principleIds:s.Array(s.String()),activationIds:s.Array(s.String()),artifactIds:s.Array(s.String()),injectedCount:s.Number(),skippedWarnings:s.Array(s.String()),injectedCharCount:s.Number(),budget:s.Number(),skipReason:s.Optional(s.String()),nextAction:s.Optional(s.String()),legacySelectedCount:s.Optional(s.Number()),legacyTotalChars:s.Optional(s.Number()),legacyTruncated:s.Optional(s.Boolean()),v2Truncated:s.Optional(s.Boolean()),crossBlockDuplicateIds:s.Optional(s.Array(s.String()))}),h8=s.Object({activationId:s.String(),artifactId:s.String(),ruleId:s.String(),reason:s.String(),nextAction:s.String()}),g8=s.Object({activationId:s.String(),artifactId:s.String(),ruleId:s.String(),mode:s.Optional(s.Union([s.Literal("shadow"),s.Literal("live")])),reason:s.String(),nextAction:s.String()}),JM=s.Object({total:s.Number(),success:s.Number(),failure:s.Number(),byTool:s.Record(s.String(),s.Object({success:s.Number(),failure:s.Number()}))}),YM=s.Object({total:s.Number(),byType:s.Record(s.String(),s.Number()),byTool:s.Record(s.String(),s.Number())}),XM=s.Object({totalEvents:s.Number(),dedupedCount:s.Number(),dedupeHitRate:s.Number(),totalPenaltyScore:s.Number(),rolledBackScore:s.Number(),rollbackCount:s.Number(),bySeverity:s.Object({mild:s.Number(),moderate:s.Number(),severe:s.Number()}),scoreBySeverity:s.Object({mild:s.Number(),moderate:s.Number(),severe:s.Number()}),byDetectionMode:s.Object({structured:s.Number(),legacy_tag:s.Number()}),byOrigin:s.Object({assistant_self_report:s.Number(),user_manual:s.Number(),system_infer:s.Number()}),confidenceDistribution:s.Object({high:s.Number(),medium:s.Number(),low:s.Number()}),dailyTrend:s.Array(s.Object({date:s.String(),count:s.Number(),score:s.Number()}))}),QM=s.Object({peak:s.Number(),samples:s.Number(),total:s.Number(),resetCount:s.Number(),hourlyDistribution:s.Array(s.Number())}),ZM=s.Object({tasksEnqueued:s.Number(),tasksCompleted:s.Number(),rulesPromoted:s.Number(),diagnosisTasksWritten:s.Number(),heartbeatsInjected:s.Number(),diagnosticianReportsWritten:s.Number(),reportsMissingJson:s.Number(),reportsIncompleteFields:s.Number(),principleCandidatesCreated:s.Number(),rulesEnforced:s.Number(),rulehostEvaluated:s.Number(),rulehostBlocked:s.Number(),rulehostRequireApproval:s.Number(),rulehostAutoCorrectProposed:s.Number(),rulehostAutoCorrectApplied:s.Number()});var eN=s.Object({total:s.Number(),success:s.Number(),failure:s.Number(),byType:s.Record(s.String(),s.Object({total:s.Number(),success:s.Number(),failure:s.Number()})),errors:s.Number(),totalDurationMs:s.Number()}),y8=s.Object({date:s.String(),createdAt:s.String(),updatedAt:s.String(),tools:s.Object({total:s.Number(),success:s.Number(),failure:s.Number()}),toolCalls:JM,errors:YM,empathy:XM,gfi:QM,evolution:ZM,hooks:eN});var _8=s.Union([s.Object({ts:s.String(),date:s.String(),type:s.Literal("tool_call"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("pain_signal"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("rule_promotion"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("governance_action"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:zM}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("hook_execution"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("gate_block"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("gate_bypass"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("evolution_task"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("empathy_rollback"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("error"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())}),s.Object({ts:s.String(),date:s.String(),type:s.Literal("warn"),category:ea,sessionId:s.Optional(s.String()),workspaceDir:s.Optional(s.String()),data:s.Record(s.String(),s.Any())})]);var tN=s.Union([s.Literal("low"),s.Literal("medium"),s.Literal("high"),s.Literal("critical")]),x8=s.Object({source:s.String({minLength:1}),score:s.Number({minimum:0,maximum:100}),timestamp:s.String({minLength:1}),reason:s.String({minLength:1}),sessionId:s.Optional(s.String()),agentId:s.Optional(s.String()),traceId:s.Optional(s.String()),triggerTextPreview:s.String(),version:s.Optional(s.String({default:"0.1.0"})),domain:s.String({default:"coding"}),severity:tN,context:s.Record(s.String(),s.Unknown())});var nN=s.Object({kind:s.Literal("every"),everyMs:s.Number({minimum:1e3})}),rN=s.Object({promptTemplate:s.String({minLength:1}),timeoutSeconds:s.Optional(s.Number({minimum:1})),lightContext:s.Optional(s.Boolean()),toolsAllow:s.Optional(s.Array(s.String({minLength:1})))}),iN=s.Object({mode:s.Union([s.Literal("none"),s.Literal("announce")]),channel:s.Optional(s.String({minLength:1})),to:s.Optional(s.String({minLength:1}))}),oN=s.Object({createdAtMs:s.Optional(s.Number({minimum:0})),lastSyncedAtMs:s.Optional(s.Number({minimum:0})),lastSyncedJobId:s.Optional(s.String({minLength:1})),lastSyncStatus:s.Optional(s.Union([s.Literal("ok"),s.Literal("error")])),lastSyncError:s.Optional(s.String({minLength:1})),consecutiveFailCount:s.Optional(s.Number({minimum:0})),lastFailedAtMs:s.Optional(s.Number({minimum:0})),autoDisabled:s.Optional(s.Boolean()),autoDisabledAt:s.Optional(s.Number({minimum:0})),autoDisabledReason:s.Optional(s.String({minLength:1})),lastTriggeredAtMs:s.Optional(s.Number({minimum:0})),lastTriggerStatus:s.Optional(s.Union([s.Literal("succeeded"),s.Literal("failed"),s.Literal("pending")]))}),v8=s.Object({id:s.String({minLength:1}),name:s.String({minLength:1}),description:s.String({minLength:1}),enabled:s.Boolean(),version:s.String({minLength:1}),schedule:nN,agentId:s.Optional(s.String({minLength:1})),execution:rN,delivery:iN,meta:s.Optional(oN)});var aN=s.Union([s.Literal("recorded-only"),s.Literal("evidence-only"),s.Literal("diagnosis-queued"),s.Literal("diagnosis-running"),s.Literal("diagnosis-succeeded"),s.Literal("diagnosis-failed"),s.Literal("diagnosis-retry-wait"),s.Literal("candidate-generated"),s.Literal("internalization-missing"),s.Literal("internalization-pending"),s.Literal("internalization-running"),s.Literal("internalization-failed"),s.Literal("internalization-succeeded"),s.Literal("owner-reviewable"),s.Literal("malformed"),s.Literal("degraded")]),sN=s.Object({id:s.String(),sourceKind:s.String(),observedAt:s.String(),state:aN,summary:s.String(),admissionDecision:s.Optional(s.String()),linkedPainId:s.Optional(s.String()),linkedTaskId:s.Optional(s.String()),linkedTaskStatus:s.Optional(s.String()),linkedCandidateId:s.Optional(s.String()),linkedPrincipleId:s.Optional(s.String()),failureReason:s.Optional(s.String()),degradedReason:s.Optional(s.String()),nextAction:s.Optional(s.String()),candidateTitle:s.Optional(s.String()),candidateSummary:s.Optional(s.String()),rootCauseSummary:s.Optional(s.String()),confidence:s.Optional(s.Number()),recommendationKind:s.Optional(s.String()),internalizationTaskId:s.Optional(s.String()),dreamerTaskStatus:s.Optional(s.String()),canonicalPainId:s.Optional(s.String()),runtimeTaskId:s.Optional(s.String()),linkMode:s.Optional(s.Union([s.Literal("canonical"),s.Literal("legacy")])),intentTension:s.Optional(Og)}),b8=s.Object({records:s.Array(sN),generatedAt:s.String(),degradedReason:s.Optional(s.String()),nextAction:s.Optional(s.String()),note:s.Optional(s.String())});var y$e=s.Object({candidateId:s.String({minLength:1}),workspaceDir:s.String({minLength:1})}),_$e=s.Object({candidateId:s.String(),artifactId:s.String(),ledgerRef:s.String(),status:s.Literal("consumed")}),x$e=s.Object({id:s.String(),title:s.String(),text:s.String(),triggerPattern:s.Optional(s.String()),action:s.Optional(s.String()),status:s.Literal("probation"),evaluability:s.Literal("weak_heuristic"),sourceRef:s.String(),artifactRef:s.Optional(s.String()),taskRef:s.Optional(s.String()),createdAt:s.String()});import q2t from"better-sqlite3";import*as uN from"path";import*as T8 from"os";var T$e=[/(^|[/\\])fake[/\\]/i,/(^|[/\\])mock[/\\]/i,/(^|[/\\])tmp[/\\]fake-/i],I$e=uN.join(T8.tmpdir(),".pd-test-quarantine");function I8(e){if(!e)return!1;let t=e.replace(/\\/g,"/");return T$e.some(n=>n.test(t))}function Yk(e){if(!e||!(process.env.NODE_ENV==="test"||!!process.env.VITEST)||!I8(e))return e;let n=e.replace(/[:*?"<>|]/g,"_").replace(/[/\\]/g,"_");for(;n.startsWith("_");)n=n.slice(1);for(;n.endsWith("_");)n=n.slice(0,-1);return uN.join(I$e,n)}wi();var O$e=1440*60*1e3;import{EventEmitter as U$e}from"events";var F$e=s.Union([s.Literal("pain_detected"),s.Literal("principle_candidate_created"),s.Literal("principle_promoted"),s.Literal("lease_acquired"),s.Literal("lease_released"),s.Literal("lease_renewed"),s.Literal("lease_expired"),s.Literal("task_retried"),s.Literal("task_failed"),s.Literal("task_succeeded"),s.Literal("run_started"),s.Literal("run_completed"),s.Literal("degradation_triggered"),s.Literal("diagnostician_task_leased"),s.Literal("diagnostician_context_built"),s.Literal("diagnostician_run_started"),s.Literal("diagnostician_run_failed"),s.Literal("diagnostician_output_invalid"),s.Literal("diagnostician_task_succeeded"),s.Literal("diagnostician_task_retried"),s.Literal("diagnostician_task_failed"),s.Literal("diagnostician_cancel_run_failed"),s.Literal("diagnostician_mark_succeeded_failed"),s.Literal("diag_router_invariant_override"),s.Literal("diagnostician_core_grounding_result"),s.Literal("diagnostician_artifact_committed"),s.Literal("diagnostician_artifact_commit_failed"),s.Literal("principle_candidate_registered"),s.Literal("runtime_adapter_selected"),s.Literal("runtime_invocation_started"),s.Literal("runtime_invocation_succeeded"),s.Literal("runtime_invocation_failed"),s.Literal("output_validation_succeeded"),s.Literal("output_validation_failed"),s.Literal("output_repair_attempted"),s.Literal("output_extraction_failed"),s.Literal("output_schema_invalid"),s.Literal("output_repair_exhausted"),s.Literal("output_path_chosen"),s.Literal("output_path_fallback"),s.Literal("dreamer_task_leased"),s.Literal("dreamer_context_built"),s.Literal("dreamer_run_started"),s.Literal("dreamer_run_failed"),s.Literal("dreamer_output_invalid"),s.Literal("dreamer_output_validated"),s.Literal("dreamer_task_succeeded"),s.Literal("dreamer_task_retried"),s.Literal("dreamer_task_failed"),s.Literal("dreamer_candidate_generated"),s.Literal("dreamer_cancel_run_failed"),s.Literal("dreamer_output_extraction_failed"),s.Literal("dreamer_mark_succeeded_failed"),s.Literal("dreamer_update_output_failed"),s.Literal("dreamer_context_partial"),s.Literal("dreamer_mark_failed_error"),s.Literal("dreamer_mark_retry_error"),s.Literal("philosopher_task_leased"),s.Literal("philosopher_context_built"),s.Literal("philosopher_run_started"),s.Literal("philosopher_run_failed"),s.Literal("philosopher_output_invalid"),s.Literal("philosopher_output_validated"),s.Literal("philosopher_task_succeeded"),s.Literal("philosopher_task_retried"),s.Literal("philosopher_task_failed"),s.Literal("philosopher_principle_candidate_generated"),s.Literal("philosopher_cancel_run_failed"),s.Literal("philosopher_mark_succeeded_failed"),s.Literal("philosopher_update_output_failed"),s.Literal("philosopher_dependency_not_succeeded"),s.Literal("philosopher_lineage_resolve_failed"),s.Literal("philosopher_lineage_partial"),s.Literal("philosopher_artifact_write_failed"),s.Literal("philosopher_wrong_task_kind"),s.Literal("philosopher_output_extraction_failed"),s.Literal("philosopher_mark_failed_error"),s.Literal("philosopher_mark_retry_error"),s.Literal("artificer_task_leased"),s.Literal("artificer_context_built"),s.Literal("artificer_run_started"),s.Literal("artificer_run_failed"),s.Literal("artificer_output_invalid"),s.Literal("artificer_output_validated"),s.Literal("artificer_task_succeeded"),s.Literal("artificer_task_retried"),s.Literal("artificer_task_failed"),s.Literal("artificer_implementation_plan_generated"),s.Literal("artificer_cancel_run_failed"),s.Literal("artificer_mark_succeeded_failed"),s.Literal("artificer_update_output_failed"),s.Literal("artificer_dependency_not_succeeded"),s.Literal("artificer_lineage_resolve_failed"),s.Literal("artificer_lineage_partial"),s.Literal("artificer_artifact_write_failed"),s.Literal("artificer_wrong_task_kind"),s.Literal("artificer_output_extraction_failed"),s.Literal("artificer_mark_failed_error"),s.Literal("artificer_mark_retry_error"),s.Literal("evaluator_task_leased"),s.Literal("evaluator_context_built"),s.Literal("evaluator_run_started"),s.Literal("evaluator_run_failed"),s.Literal("evaluator_output_invalid"),s.Literal("evaluator_output_validated"),s.Literal("evaluator_task_succeeded"),s.Literal("evaluator_task_retried"),s.Literal("evaluator_task_failed"),s.Literal("evaluator_cancel_run_failed"),s.Literal("evaluator_mark_succeeded_failed"),s.Literal("evaluator_update_output_failed"),s.Literal("evaluator_dependency_not_succeeded"),s.Literal("evaluator_lineage_resolve_failed"),s.Literal("evaluator_lineage_partial"),s.Literal("evaluator_artifact_write_failed"),s.Literal("evaluator_wrong_task_kind"),s.Literal("evaluator_output_extraction_failed"),s.Literal("evaluator_mark_failed_error"),s.Literal("evaluator_mark_retry_error"),s.Literal("evaluator_decision_recorded"),s.Literal("scribe_task_leased"),s.Literal("scribe_context_built"),s.Literal("scribe_run_started"),s.Literal("scribe_run_failed"),s.Literal("scribe_output_invalid"),s.Literal("scribe_output_validated"),s.Literal("scribe_task_succeeded"),s.Literal("scribe_task_retried"),s.Literal("scribe_task_failed"),s.Literal("scribe_principle_draft_generated"),s.Literal("scribe_cancel_run_failed"),s.Literal("scribe_mark_succeeded_failed"),s.Literal("scribe_update_output_failed"),s.Literal("scribe_dependency_not_succeeded"),s.Literal("scribe_lineage_resolve_failed"),s.Literal("scribe_lineage_partial"),s.Literal("scribe_artifact_write_failed"),s.Literal("scribe_wrong_task_kind"),s.Literal("scribe_output_extraction_failed"),s.Literal("scribe_mark_failed_error"),s.Literal("scribe_mark_retry_error"),s.Literal("dreamer_l2_turn"),s.Literal("dreamer_l2_complete"),s.Literal("dreamer_l2_fallback_to_l1"),s.Literal("artificer_l2_attempt"),s.Literal("artificer_l2_turn"),s.Literal("artificer_l2_complete"),s.Literal("evaluator_adversarial_replay"),s.Literal("evaluator_adversarial_replay_skipped"),s.Literal("evaluator_rule_assembled"),s.Literal("evaluator_rule_assembly_failed")]),A8=s.Object({eventType:F$e,traceId:s.String({minLength:1}),timestamp:s.String({minLength:1}),sessionId:s.String(),agentId:s.Optional(s.String()),payload:s.Record(s.String(),s.Unknown())});function R8(e){if(typeof e!="object"||e===null||Array.isArray(e))return{valid:!1,errors:["Input must be a non-null object"]};let t=e;if(typeof t.timestamp=="string"&&isNaN(Date.parse(t.timestamp)))return{valid:!1,errors:["timestamp must be a valid ISO 8601 date string"]};let n=[...Ag.Errors(A8,e)];return n.length>0?{valid:!1,errors:n.map(r=>`${r.path?`${r.path}: `:""}${r.message}`)}:{valid:!0,errors:[],event:Ag.Cast(A8,e)}}var Xk=class extends U$e{emitTelemetry(t){let n;try{let r=R8(t);!r.valid||!r.event?n=void 0:n=r.event}catch(r){let i={eventType:"degradation_triggered",traceId:t?.traceId?`fallback-${t.traceId}`:`fallback-${Date.now()}`,timestamp:new Date().toISOString(),sessionId:t?.sessionId??"",payload:{component:"StoreEventEmitter",trigger:"invalid_event",fallback:"dropped",severity:"warning",errors:[String(r)],originalEventType:t?.eventType??"unknown",originalTraceId:t?.traceId??"unknown"}};return this.emit("telemetry",i),this.emit(i.eventType,i),!0}if(!n){let r={eventType:"degradation_triggered",traceId:t?.traceId?`fallback-${t.traceId}`:`fallback-${Date.now()}`,timestamp:new Date().toISOString(),sessionId:t?.sessionId??"",payload:{component:"StoreEventEmitter",trigger:"invalid_event",fallback:"dropped",severity:"warning"}};return this.emit("telemetry",r),this.emit(r.eventType,r),!0}return this.emit("telemetry",n),this.emit(n.eventType,n),!0}onTelemetry(t){this.on("telemetry",t)}onEventType(t,n){this.on(t,n)}},Ml=new Xk;var hv;(function(e){e.Idle="idle",e.BuildingContext="building_context",e.CreatingRun="creating_run",e.Invoking="invoking",e.Polling="polling",e.FetchingOutput="fetching_output",e.Validating="validating",e.Committing="committing",e.Completed="completed",e.Failed="failed",e.RetryWaiting="retry_waiting"})(hv||(hv={}));wi();wi();var V$e=["taskId","sourcePainId","sourceTaskId","sourceRunIds","sourceArtifactId","sourceRefs"],MFt=new Set(V$e);var O8=s.Object({id:s.String({pattern:"^T-\\d{2}$"}),layer:s.Union([s.Literal("foundational"),s.Literal("operating")]),name:s.String({minLength:1}),nameZh:s.String({minLength:1}),statement:s.String({minLength:1}),statementZh:s.String({minLength:1})}),P8=[{id:"T-01",layer:"foundational",name:"Survey Before Acting",nameZh:"\u5148\u68B3\u7406\u518D\u884C\u52A8",statement:"Build a sufficient model of the relevant system before making consequential changes.",statementZh:"\u5728\u8FDB\u884C\u6709\u540E\u679C\u7684\u53D8\u66F4\u524D\uFF0C\u5148\u5EFA\u7ACB\u5BF9\u76F8\u5173\u7CFB\u7EDF\u8DB3\u591F\u51C6\u786E\u7684\u7406\u89E3\u3002"},{id:"T-02",layer:"foundational",name:"Intent & Constraints First",nameZh:"\u610F\u56FE\u4E0E\u7EA6\u675F\u4F18\u5148",statement:"Act toward the owner's actual intent; explicit goals, constraints, boundaries, and decisions override inferred preferences.",statementZh:"\u56F4\u7ED5 Owner \u7684\u771F\u5B9E\u610F\u56FE\u884C\u52A8\uFF1B\u660E\u786E\u8868\u8FBE\u7684\u76EE\u6807\u3001\u7EA6\u675F\u3001\u8FB9\u754C\u4E0E\u51B3\u7B56\u4F18\u5148\u4E8E\u6A21\u578B\u81EA\u884C\u63A8\u65AD\u7684\u504F\u597D\u3002"},{id:"T-03",layer:"foundational",name:"Evidence Over Assumption",nameZh:"\u8BC1\u636E\u4F18\u4E8E\u5047\u8BBE",statement:"Use observable evidence\u2014code, logs, outputs, and state\u2014before inferring causes or claiming results.",statementZh:"\u5728\u63A8\u65AD\u539F\u56E0\u6216\u5BA3\u79F0\u7ED3\u679C\u4E4B\u524D\uFF0C\u4F18\u5148\u4F7F\u7528\u53EF\u89C2\u5BDF\u7684\u4EE3\u7801\u3001\u65E5\u5FD7\u3001\u8F93\u51FA\u4E0E\u72B6\u6001\u4F5C\u4E3A\u8BC1\u636E\u3002"},{id:"T-04",layer:"foundational",name:"Reversible & Safe by Default",nameZh:"\u9ED8\u8BA4\u53EF\u9006\u4E14\u5B89\u5168",statement:"When uncertainty or downside is meaningful, prefer reversible actions and preserve hard safety boundaries.",statementZh:"\u5F53\u4E0D\u786E\u5B9A\u6027\u6216\u6F5C\u5728\u635F\u5931\u4E0D\u53EF\u5FFD\u7565\u65F6\uFF0C\u4F18\u5148\u9009\u62E9\u53EF\u9006\u884C\u52A8\uFF0C\u5E76\u4FDD\u6301\u4E0D\u53EF\u7A81\u7834\u7684\u5B89\u5168\u8FB9\u754C\u3002"},{id:"T-05",layer:"operating",name:"Safety Rails",nameZh:"\u5B89\u5168\u62A4\u680F",statement:"Translate hard constraints into explicit guardrails, checks, and forbidden transitions before execution.",statementZh:"\u5728\u6267\u884C\u524D\uFF0C\u628A\u4E0D\u53EF\u7A81\u7834\u7684\u7EA6\u675F\u8F6C\u5316\u4E3A\u660E\u786E\u7684\u62A4\u680F\u3001\u68C0\u67E5\u548C\u7981\u6B62\u72B6\u6001\u8F6C\u79FB\u3002"},{id:"T-06",layer:"foundational",name:"Minimal Sufficient Change",nameZh:"\u6700\u5C0F\u5145\u5206\u6539\u53D8",statement:"Choose the simplest intervention that satisfies the intent, and change no more state than necessary.",statementZh:"\u9009\u62E9\u80FD\u591F\u6EE1\u8DB3\u771F\u5B9E\u610F\u56FE\u7684\u6700\u7B80\u5355\u5E72\u9884\u65B9\u5F0F\uFF0C\u5E76\u4E14\u53EA\u6539\u53D8\u5FC5\u8981\u7684\u72B6\u6001\u3002"},{id:"T-07",layer:"operating",name:"Close the Loop",nameZh:"\u95ED\u73AF\u9A8C\u8BC1",statement:"After acting, observe the result and compare it with the intended outcome; execution is not success until verified.",statementZh:"\u884C\u52A8\u540E\u89C2\u5BDF\u5B9E\u9645\u7ED3\u679C\uFF0C\u5E76\u4E0E\u9884\u671F\u76EE\u6807\u8FDB\u884C\u6BD4\u8F83\uFF1B\u5B8C\u6210\u6267\u884C\u5E76\u4E0D\u7B49\u4E8E\u5DF2\u7ECF\u6210\u529F\u3002"},{id:"T-08",layer:"foundational",name:"Pain As Signal",nameZh:"\u75DB\u82E6\u5373\u4FE1\u53F7",statement:"Treat failures, corrections, and friction as feedback to improve future behavior rather than repeat the same mistake.",statementZh:"\u628A\u5931\u8D25\u3001\u7EA0\u6B63\u4E0E\u6469\u64E6\u89C6\u4E3A\u6539\u8FDB\u672A\u6765\u884C\u4E3A\u7684\u53CD\u9988\uFF0C\u800C\u4E0D\u662F\u53CD\u590D\u72AF\u540C\u6837\u7684\u9519\u8BEF\u3002"},{id:"T-09",layer:"operating",name:"Divide And Conquer",nameZh:"\u5206\u800C\u6CBB\u4E4B",statement:"Decompose complex work into independently understandable and verifiable parts when that reduces uncertainty or risk.",statementZh:"\u5F53\u62C6\u5206\u80FD\u591F\u964D\u4F4E\u4E0D\u786E\u5B9A\u6027\u6216\u98CE\u9669\u65F6\uFF0C\u5C06\u590D\u6742\u4EFB\u52A1\u5206\u89E3\u4E3A\u53EF\u72EC\u7ACB\u7406\u89E3\u548C\u9A8C\u8BC1\u7684\u90E8\u5206\u3002"},{id:"T-10",layer:"operating",name:"Memory Externalization",nameZh:"\u8BB0\u5FC6\u5916\u90E8\u5316",statement:"Persist important intermediate conclusions, decisions, and state outside transient context when continuity matters.",statementZh:"\u5F53\u8FDE\u7EED\u6027\u91CD\u8981\u65F6\uFF0C\u628A\u5173\u952E\u4E2D\u95F4\u7ED3\u8BBA\u3001\u51B3\u7B56\u4E0E\u72B6\u6001\u6301\u4E45\u5316\u5230\u77AC\u65F6\u4E0A\u4E0B\u6587\u4E4B\u5916\u3002"}],Qk=Object.freeze(P8.map(e=>Object.freeze({...e}))),L8=Object.freeze(P8.map(e=>e.id));go();var eE=[{id:"prompt",category:"core",enabled:!0,since:"2026-05-24",description:"Prompt injection for principle application"},{id:"code_tool_hook",category:"core",enabled:!0,since:"2026-05-24",description:"Code tool hook for rule host enforcement"},{id:"rulecode_safety_controls",category:"core",enabled:!0,since:"2026-08-21",description:"Durable RuleCode safety isolation authority. Default ON; emergency enforcement shutdown remains the code_tool_hook core flag."},{id:"rulecode_owner_live_decision",category:"core",enabled:!0,since:"2026-08-21",description:"Owner-reviewed RuleCode shadow-to-live decision authority. Default ON after the readiness, authenticated Console, CLI, audit, and rollback rollout gates passed; flag-off refuses promotion."},{id:"defer_archive",category:"core",enabled:!0,since:"2026-05-24",description:"Defer/archive activation writer"},{id:"correction_observer",category:"quiet",enabled:!1,since:"2026-06-02",description:"Optional LLM optimization service for correction keywords; synchronous correction detection remains active independently"},{id:"signal_collector",category:"quiet",enabled:!1,since:"2026-06-30",description:"Unified signal collection host (correction + empathy upstream merge). NOTE: keyword detection (high-precision phrases) runs regardless of this flag; this flag only gates the LLM deep-judgment path (ambiguous terms / missed keywords). Quiet flag: dogfood-only until validated."},{id:"internalization_auto_consumer",category:"quiet",enabled:!0,since:"2026-06-13",description:"Bounded auto-consumer for dreamer internalization tasks \u2014 prevents ready tasks from pending forever (PRI-381; quiet flag, default on, disableable via config)"},{id:"internalization_full_chain",category:"core",enabled:!0,since:"2026-08-12",description:"PRI-419 amendment: auto-consumer advances dreamer\u2192\u2026\u2192evaluator\u2192rollout_reviewer (full chain) so artifacts reach validated and the approval queue is populated unattended. The human gate is the approval queue (Console), not the rollout_reviewer CLI trigger. Default ON; flag-off = dreamer-only."},{id:"story_a_approval_completion",category:"quiet",enabled:!0,since:"2026-06-18",description:"Story A approval-completion orchestrator (PRI-408) \u2014 formal service replacing demo direct-writer activation; quiet flag, default on, disableable via config"},{id:"feedback_channel",category:"quiet",enabled:!0,since:"2026-06-01",description:"MVP seed feedback channel \u2014 privacy-preserving report drafts. PRI-543: flag scope extended to also cover the feedback SUBMIT ladder (ingest relay / gh CLI / mailto / export-file channels + submit endpoints). Flag-off = submit endpoints 403 + submit UI hidden; config `feedback:` segment and channel parameters still available."},{id:"release_manager_shadow",category:"quiet",enabled:!1,since:"2026-08-25",description:"ReleaseManager shadow mode \u2014 read-only signed-metadata update checks with legacy-updater comparison diagnostics; no activation"},{id:"gfi",category:"quiet",enabled:!1,since:"2026-05-24",description:"Global Friction Index session scoring"},{id:"evolution_worker",category:"quiet",enabled:!1,since:"2026-06-01",description:"Legacy evolution worker heartbeat (MVP-Quiet per ADR-0014 \xA72.5)"},{id:"empathy_observer",category:"quiet",enabled:!1,since:"2026-06-02",description:"Empathy observer service for sentiment checking (MVP-Quiet)"},{id:"painEvidenceAdmission",category:"quiet",enabled:!0,since:"2026-06-06",description:"Pre-diagnosis evidence triage for pain signals (PEAT-B1). PRI-454: default-on, Gate B is primary gate."},{id:"painEvidenceAdmissionDefault",category:"quiet",enabled:!0,since:"2026-06-24",description:"PRI-454: Global kill switch for Gate B migration. When ON (default), Gate B (TriggerController) owns admission. When OFF (rollback), Gate A (PainDiagnosticGate) is re-activated."},{id:"diagnostician_async_cli",category:"quiet",enabled:!1,since:"2026-06-11",description:"Async pain-record CLI \u2014 submit and return immediately, diagnosis runs in background. Default: false until orchestrator exists."},{id:"diagnostician_core_grounding",category:"quiet",enabled:!0,since:"2026-06-11",description:"Core principle grounding in diagnostician prompt (Arm 2)"},{id:"internalization_core_grounding",category:"quiet",enabled:!0,since:"2026-06-16",description:"Core principle grounding in internalization prompt builders (dreamer, philosopher, scribe)"},{id:"diagnostician_split_pipeline",category:"quiet",enabled:!0,since:"2026-06-11",description:"3-stage split diagnostician pipeline (RootCause\u2192Distiller\u2192Router)"},{id:"diagnostician_llm_degradation",category:"quiet",enabled:!0,since:"2026-07-03",description:"Diagnostician LLM rate-limit graceful degradation \u2014 on persistent rate-limit, emit diag_llm_rate_limit_degraded telemetry + rate_limit errorCategory instead of max_attempts_exceeded (ADR-0019). Default ON (graduated PRI-571, 2026-08-24); flag-off = hard fail (legacy behavior)."},{id:"l2_dreamer",category:"quiet",enabled:!1,since:"2026-06-16",description:"L2 multi-turn agent loop for the dreamer runner (PRI-419) \u2014 read-only tools + submit_output, scoped to dreamer only"},{id:"code_rule_capability",category:"core",enabled:!0,since:"2026-06-18",description:"Code-rule capability (atomic: ArtificerL2 + Evaluator) for RuleHost pipeline \u2014 MVP-Core, default ON (PRI-435)"},{id:"intent_engineering",category:"quiet",enabled:!1,since:"2026-06-25",description:"INTENT.md-grounded constructive friction and Stage-A intent tension diagnosis (PRI-465). Default off; flag-off = no INTENT read, no prompt injection, no intentTension."},{id:"rulecode_context_v2",category:"quiet",enabled:!1,since:"2026-06-27",description:"RuleContext v2 \u2014 rule-code context vision (PRI-479). Foundation flag; default off, v1 rule behavior unchanged. See docs/superpowers/specs/2026-06-27-rulecode-context-vision-design.md"},{id:"failed_tasks_observability",category:"quiet",enabled:!0,since:"2026-07-04",description:"Failed tasks observability \u2014 list/view failed pipeline tasks"},{id:"evaluator_artificer_repair_loop",category:"quiet",enabled:!0,since:"2026-07-04",description:"PRI-509/P0-D: Evaluator\u2192Artificer repair loop \u2014 auto-seed artificer repair on needs_revision (2-round cap \u2192 needs_human_review). Default ON (INV-02 liveness); production-wired in auto-consumer since 2026-08-18."},{id:"artificer_output_retry",category:"quiet",enabled:!0,since:"2026-08-20",description:"Issue 2/PRI-621: retry Artificer `output_invalid` (malformed LLM output, e.g. missed submit_rulecode) via the base retry policy (max 3 attempts) instead of permanent failure. Graduated default-on 2026-08-29 \u2014 aligns artificer with every other peer runner; flag-off reverts output_invalid to permanent (legacy)."},{id:"artifact_summary_redundancy",category:"quiet",enabled:!1,since:"2026-07-26",description:"Internalization progressive disclosure Layer 0 \u2014 writer-side ArtifactSummary + predecessorSummary envelope on all 8 SummaryRunnerKind stages. Default off; flag-off = current contentJson shape unchanged."},{id:"context_manifest_budget",category:"quiet",enabled:!1,since:"2026-07-26",description:"Internalization progressive disclosure Layer 1 \u2014 manifest + budget-driven context injection with information-floor fallback. Default off; flag-off = existing buildContext assembly unchanged."},{id:"progressive_evaluator",category:"quiet",enabled:!1,since:"2026-07-26",description:"Internalization progressive disclosure Layer 2 \u2014 two-stage evaluation with flagged criteria + painCoverage/compressionFidelity output fields. Default off; flag-off = single-stage evaluation unchanged."},{id:"host.codex",category:"core",enabled:!0,since:"2026-08-11",description:"ADR-0020: Codex CLI host adapter. Default ON (flipped 2026-08-12 after PRI-282 E2E). Flag-off = pd-hook.js outputs {} + exit 0 + SystemLogger records skip (rc-9). Disable via .pd/config.yaml: host.codex: { enabled: false }."},{id:"abstraction_layer_v1",category:"quiet",enabled:!1,since:"2026-08-13",description:"PRI-523 shared host-runtime cutover for OpenClaw. Default OFF preserves the legacy route; enable only for controlled parity validation."},{id:"principle_receipt_block_copy",category:"quiet",enabled:!0,since:"2026-08-15",description:"Principle Receipt P0 \u2014 enriched RuleHost block copy with principle attribution (title/approval date/source summary, PRI-530). Default ON (graduated PRI-571, 2026-08-24); flag-off = generic block template unchanged."},{id:"principle_receipt_ledger",category:"quiet",enabled:!0,since:"2026-08-15",description:"Principle Receipt ledger \u2014 durable principle_applications history (effect/presence two-level semantics, PRI-531). Default ON (graduated PRI-571, 2026-08-24); flag-off = no ledger writes."},{id:"principle_receipt_self_report",category:"quiet",enabled:!1,since:"2026-08-16",description:"Principle Receipt P1-a \u2014 agent self-report \u{1F4CC} line (injection instruction + capture, PRI-532). Default off; flag-off = directive template unchanged, no capture."},{id:"principle_governance_projection_v2",category:"quiet",enabled:!0,since:"2026-08-20",description:"Read-only per-principle Owner governance projection (PRI-549). Default ON (graduated PRI-571, 2026-08-24); flag-off preserves the pre-projection Principle Detail experience."},{id:"failed_task_recovery_console",category:"quiet",enabled:!0,since:"2026-08-23",description:"Governance Recovery Actions v1 \u2014 Owner-triggered recovery of failed / needs_human_review tasks from Console (failed\u2192pending via RecoverySweepService; needs_human_review\u2192pending via owner authority reset). Default on (2026-08-24 owner decision); flag-off = Console read-only."},{id:"pain_diagnosis_persistence",category:"quiet",enabled:!1,since:"2026-08-23",description:"Persist diagnostician root-cause attribution to pain_diagnoses (state.db, keyed by canonical pain_id) + Evidence First attribution rules in the Stage A prompt. Default off; flag-off = no writes, prompt byte-identical."},{id:"governance_experience_v1",category:"quiet",enabled:!0,since:"2026-08-24",description:"Governance Experience Snapshot v1.5.1 \u2014 read-only workspace governance experience (batch projection + GET /api/v1/governance/experience + Console Focus integration). Default on (graduated 2026-08-29); flag-off via config = endpoint 403 (no DB access) and legacy Focus behavior preserved."},{id:"anonymous_product_telemetry",category:"quiet",enabled:!1,since:"2026-08-26",description:"Anonymous Product Telemetry v1 \u2014 opt-in daily boolean-milestone snapshot (initialized/pain/principle/activation/receipt presence+effect), daily unlinkable IDs, zero content collection. Default off; export also requires explicit consent (pd telemetry enable) + production eligibility."},{id:"codex_conversation_ingestion",category:"quiet",enabled:!1,since:"2026-08-29",description:"Codex Governance Closure Slice A \u2014 bounded governance-observation ingestion from the authenticated Codex Stop-hook transcript (visible user/assistant/tool facts only, \u226432 turns/\u22647 days operational window, promotion substrate). Default off; flag-off = zero transcript reads, no observation writes, existing Codex behavior unchanged."},{id:"nocturnal",category:"gone",enabled:!1,since:"2026-05-24",description:"Nocturnal trinity pipeline (retired)"},{id:"idle_trigger",category:"gone",enabled:!1,since:"2026-05-24",description:"Idle trigger for background processing (retired)"},{id:"new_user_onboarding",category:"core",enabled:!0,since:"2026-07-01",description:"New user onboarding wizard \u2014 first-visit redirect to /welcome + demo story-a trigger endpoint. Maintainer-approved MVP-Core (2026-07-01): default-on; emergency disable via .pd/config.yaml: new_user_onboarding: { enabled: false }."}];var yv={};for(let e of eE)yv[e.id]={category:e.category,enabled:e.enabled};var fN={betterDecision:"required",rationale:"required",riskLevel:"required",badDecision:"optional",strategicPerspective:"excluded"},bUt=Object.entries(fN).filter(([,e])=>e==="required").map(([e])=>e),D8=["badDecision","betterDecision","rationale","riskLevel","strategicPerspective"];var xv=1;var IUt=D8.filter(e=>fN[e]!=="excluded");wi();var tFe=s.Union([s.Literal("general"),s.Literal("domain"),s.Literal("scenario")]),gN=s.Object({valid:s.Boolean(),taskId:s.String({minLength:1}),sourceRootCauseArtifactId:s.String({minLength:1,description:"Lineage consistency check \u2014 must match the artifact ID from Stage A"}),abstractedPrinciple:s.String({minLength:1,maxLength:200,description:"Highly abstracted, cross-scenario principle (\u2264200 chars)"}),rationale:s.String({minLength:1,description:"Why this principle addresses the root cause"}),groundedOnCorePrincipleIds:s.Array(s.String({minLength:1}),{description:"Subset of T-01..T-10. Validated against registry \u2014 fabricated IDs cause validation failure."}),scope:tFe,confidence:s.Number({minimum:0,maximum:1}),ambiguityNotes:s.Optional(s.Array(s.String()))});go();wi();go();var nFe=s.Object({candidateIndex:s.Number(),badDecision:s.String({minLength:1}),betterDecision:s.String({minLength:1}),rationale:s.String({minLength:1}),confidence:s.Number({minimum:0,maximum:1}),riskLevel:s.Union([s.Literal("low"),s.Literal("medium"),s.Literal("high")]),strategicPerspective:s.String({minLength:1})}),rFe=s.Object({valid:s.Boolean(),taskId:s.String({minLength:1}),candidates:s.Array(nFe,{minItems:1,maxItems:5}),sourcePrincipleId:s.Optional(s.String()),sourcePainId:s.Optional(s.String()),contextRefs:s.Array(s.String()),generatedAt:s.String({minLength:1}),reason:s.Optional(s.String())});var iFe=s.Object({title:s.String({minLength:1}),rationale:s.String({minLength:1}),scope:s.String({minLength:1}),confidence:s.Number({minimum:0,maximum:1})}),oFe=s.Object({taskId:s.String({minLength:1}),sourceDreamerArtifactId:s.String({minLength:1}),thesis:s.String({minLength:1}),principleCandidate:iFe,risks:s.Array(s.String()),generatedAt:s.String({minLength:1})});var aFe=s.Object({title:s.String({minLength:1}),statement:s.String({minLength:1}),rationale:s.String({minLength:1}),applicability:s.Array(s.String()),antiPatterns:s.Array(s.String()),confidence:s.Number({minimum:0,maximum:1})}),sFe=s.Object({dreamerArtifactId:s.Optional(s.String()),philosopherArtifactId:s.String({minLength:1})}),cFe=s.Object({taskId:s.String({minLength:1}),sourcePhilosopherArtifactId:s.String({minLength:1}),principleDraft:aFe,sourceTrace:sFe,risks:s.Array(s.String()),generatedAt:s.String({minLength:1})});var U8={read:"read",read_file:"read",read_many_files:"read",grep:"search",grep_search:"search",search_file_content:"search",glob:"search",write:"write",write_file:"write",edit:"write",edit_file:"write",replace:"write",apply_patch:"write",bash:"execute",exec:"execute",execute:"execute",run_shell_command:"execute",sessions_spawn:"agent"};function rE(e){if(typeof e!="string"||!Object.hasOwn(U8,e))return"other";let t=U8[e];return t!==void 0?t:"other"}function iE(e,t,n){if(e.status==="unavailable")return{priorReadOfTarget:"unknown",readCount:null,writeCount:null,uniqueWritePathCount:null,sameActionBlockCount:null};let r=0,i=0,o=new Set,a=t===null?"unknown":"no",{calls:c}=e;for(let u of c){let l=u.canonicalKind;l==="read"||l==="search"?(r++,t!==null&&u.normalizedPath===t&&(a="yes")):l==="write"&&(i++,typeof u.normalizedPath=="string"&&o.add(u.normalizedPath))}return{priorReadOfTarget:a,readCount:r,writeCount:i,uniqueWritePathCount:o.size,sameActionBlockCount:n}}var W8={priorReadOfTarget:"unknown",readCount:null,writeCount:null,uniqueWritePathCount:null,sameActionBlockCount:null};Object.freeze(W8);var yN={status:"unavailable",unavailableReason:"host did not provide a history window",truncated:!1,calls:[]};Object.freeze(yN.calls);Object.freeze(yN);var uFe={version:2,history:yN,facts:W8};Object.freeze(uFe);var q8=s.Object({scribeArtifactId:s.String({minLength:1}),philosopherArtifactId:s.Optional(s.String({minLength:1})),dreamerArtifactId:s.Optional(s.String({minLength:1}))}),j8=s.Object({taskId:s.String({minLength:1}),sourceScribeArtifactId:s.String({minLength:1}),implementationCode:s.String({minLength:1}),goldenTraceCases:s.Array(s.Object({caseId:s.String({minLength:1}),kind:s.Union([s.Literal("positive"),s.Literal("negative")]),toolName:s.String({minLength:1}),params:s.Record(s.String(),s.Unknown()),expectedDecision:s.Union([s.Literal("allow"),s.Literal("block"),s.Literal("propose_correction")]),expectedProposedParams:s.Optional(s.Record(s.String(),s.Unknown())),expectedApplicationMode:s.Optional(s.Union([s.Literal("shadow"),s.Literal("live")]))}),{minItems:2,maxItems:10}),affectedTools:s.Array(s.String({minLength:1}),{minItems:1}),implementationSummary:s.String({minLength:1}),risks:s.Array(s.String()),sourceTrace:q8,generatedAt:s.String({minLength:1}),requiresContextVersion:s.Optional(s.Literal(2)),evidenceRefs:s.Optional(s.Array(s.String({minLength:1})))});var lFe=s.Object({id:s.String({minLength:1}),status:s.Union([s.Literal("resolved"),s.Literal("still_open"),s.Literal("regressed")])}),pFe=s.Object({id:s.String({minLength:1}),statement:s.String({minLength:1}),status:s.Union([s.Literal("resolved"),s.Literal("still_open"),s.Literal("regressed")])}),G8=s.Object({decision:s.Union([s.Literal("approved"),s.Literal("needs_revision"),s.Literal("rejected")]),summary:s.String({minLength:1}),score:s.Number({minimum:0,maximum:1}),strengths:s.Array(s.String()),concerns:s.Array(s.String()),requiredChanges:s.Array(s.String()),priorRequirementStatuses:s.Optional(s.Array(lFe)),requirementLedger:s.Optional(s.Array(pFe))}),B8=s.Object({artificerArtifactId:s.String({minLength:1}),scribeArtifactId:s.Optional(s.String()),philosopherArtifactId:s.Optional(s.String()),dreamerArtifactId:s.Optional(s.String())}),K8=s.Object({taskId:s.String({minLength:1}),sourceArtificerArtifactId:s.String({minLength:1}),evaluation:G8,sourceTrace:B8,risks:s.Array(s.String()),generatedAt:s.String({minLength:1})});var H8=s.Object({decision:s.Union([s.Literal("approve_rollout"),s.Literal("needs_revision"),s.Literal("reject")]),summary:s.String({minLength:1}),confidence:s.Number({minimum:0,maximum:1}),requiredChanges:s.Array(s.String()),rolloutRisks:s.Array(s.String()),safetyChecks:s.Array(s.String())}),V8=s.Object({evaluatorArtifactId:s.String({minLength:1}),artificerArtifactId:s.Optional(s.String()),scribeArtifactId:s.Optional(s.String()),philosopherArtifactId:s.Optional(s.String()),dreamerArtifactId:s.Optional(s.String())}),z8=s.Object({taskId:s.String({minLength:1}),sourceEvaluatorArtifactId:s.String({minLength:1}),review:H8,sourceTrace:V8,risks:s.Array(s.String()),generatedAt:s.String({minLength:1})});var dFe=s.Object({userMessage:s.String({minLength:1})}),J8=s.Object({damageDetected:s.Boolean(),severity:s.Union([s.Literal("mild"),s.Literal("moderate"),s.Literal("severe")]),confidence:s.Number({minimum:0,maximum:1}),reason:s.String()});var mFe=s.Object({parentSessionId:s.String(),workspaceDir:s.String(),keywordStoreSummary:s.Object({totalKeywords:s.Number(),terms:s.Array(s.Object({term:s.String(),weight:s.Number(),hitCount:s.Number(),truePositiveCount:s.Number(),falsePositiveCount:s.Number()}))}),recentMessages:s.Array(s.String()),trajectoryHistory:s.Array(s.Object({sessionId:s.String(),timestamp:s.String(),term:s.String(),userMessage:s.String()}))}),Y8=s.Object({updated:s.Boolean(),updates:s.Optional(s.Record(s.String(),s.Object({action:s.Union([s.Literal("add"),s.Literal("update"),s.Literal("remove")]),weight:s.Optional(s.Number()),falsePositiveRate:s.Optional(s.Number()),reasoning:s.String()}))),fpTerms:s.Optional(s.Array(s.String())),fpAnalysisStatus:s.Optional(s.Union([s.Literal("completed"),s.Literal("skipped")])),summary:s.String()});var X8=s.Object({is_feedback:s.Boolean(),type:s.Union([s.Literal("correction"),s.Literal("empathy"),s.Literal("none")]),confidence:s.Number({minimum:0,maximum:1}),reason:s.String()});Ns();var ei=()=>Ti(()=>Promise.resolve().then(()=>(PJ(),OJ)));Ns();var WS=()=>Ti(()=>Promise.resolve().then(()=>(rX(),nX)));Ns();var Jqe=function(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,r,i,o,a){return r?t?".jsx":".js":i&&(!o||!a)?n:i+o+"."+a.toLowerCase()+"js"}):e},Yqe=e=>{let t=import.meta.url.endsWith(".js")?e.replace(/\.ts$/,".js"):e;return import(Jqe(t))},Xqe;var qS=()=>Ti(async()=>Xqe??await Yqe("./bedrock-converse-stream.ts"));Ns();var P0=()=>Ti(()=>Promise.resolve().then(()=>(Nre(),Mre)));Ns();var bC=()=>Ti(()=>Promise.resolve().then(()=>(Wre(),Ure)));Ns();var wC=()=>Ti(()=>Promise.resolve().then(()=>(Xre(),Yre)));Ns();var EC=()=>Ti(()=>Promise.resolve().then(()=>(Eie(),kie)));Ns();var gt=()=>Ti(()=>Promise.resolve().then(()=>(Uie(),Fie)));Ns();var Da=()=>Ti(()=>Promise.resolve().then(()=>(Kie(),Bie)));Ns();var SC=()=>Ti(()=>Promise.resolve().then(()=>(Xie(),Yie)));var JQe=function(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,r,i,o,a){return r?t?".jsx":".js":i&&(!o||!a)?n:i+o+"."+a.toLowerCase()+"js"}):e},YQe=null,XQe=null,QQe=null,t3=e=>import(JQe(e)),ZQe="node:fs",eZe="node:os",tZe="node:path";typeof process<"u"&&(process.versions?.node||process.versions?.bun)&&(t3(ZQe).then(e=>{YQe=e.existsSync}),t3(eZe).then(e=>{XQe=e.homedir}),t3(tZe).then(e=>{QQe=e.join}));var n3="ANTHROPIC_AUTH_TOKEN",Qie="ANTHROPIC_OAUTH_TOKEN",Zie="ANTHROPIC_API_KEY";var nZe=new Map;function rZe(e,t){return(n,r,i)=>{if(n.api!==e)throw new Error(`Mismatched api: ${n.api} expected ${e}`);return t(n,r,i)}}function eoe(e,t){nZe.set(e.api,{provider:{api:e.api,generateImages:rZe(e.api,e.generateImages)},sourceId:t})}var roe;function cZe(e,t){return{api:e.api,provider:e.provider,model:e.id,output:[],stopReason:"error",errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}function uZe(){return roe||=Promise.resolve().then(()=>(noe(),toe)).then(e=>e),roe}var lZe=async(e,t,n)=>{try{return await(await uZe()).generateImages(e,t,n)}catch(r){return cZe(e,r)}};function pZe(){eoe({api:"openrouter-images",generateImages:lZe})}pZe();var B={};On(B,{Assign:()=>dZe,Clone:()=>dw,Create:()=>xet,Discard:()=>vet,Metrics:()=>ru,Update:()=>bet});var ru={assign:0,create:0,clone:0,discard:0,update:0};function dZe(e,t){return ru.assign+=1,{...e,...t}}var R={};On(R,{Entries:()=>LZe,EntriesRegExp:()=>PZe,Every:()=>RZe,EveryAll:()=>CZe,GraphemeCount:()=>EZe,HasPropertyKey:()=>OZe,IsArray:()=>lw,IsBigInt:()=>uw,IsBoolean:()=>doe,IsClassInstance:()=>IZe,IsConstructor:()=>_Ze,IsDeepEqual:()=>a3,IsEqual:()=>cn,IsFunction:()=>moe,IsGreaterEqualThan:()=>hoe,IsGreaterThan:()=>bZe,IsInteger:()=>i3,IsLessEqualThan:()=>foe,IsLessThan:()=>wZe,IsMaxLength:()=>SZe,IsMinLength:()=>AZe,IsMultipleOf:()=>TZe,IsNull:()=>CC,IsNumber:()=>OC,IsObject:()=>pw,IsObjectNotArray:()=>xZe,IsString:()=>PC,IsSymbol:()=>vZe,IsUndefined:()=>o3,IsUnsafePropertyKey:()=>goe,IsValueLike:()=>kZe,Keys:()=>RC,ShiftLeft:()=>LC,Symbols:()=>MZe,Values:()=>NZe});function sh(e,t,n){return e>=t&&e<=n}function mZe(e){return e===8205}function fZe(e){return sh(e,55296,56319)}function ioe(e){return sh(e,127462,127487)}function aoe(e){return sh(e,65024,65039)}function soe(e){return sh(e,768,879)||sh(e,6832,6911)||sh(e,7616,7679)||sh(e,65056,65071)}function AC(e){return e>65535?2:1}function ooe(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(soe(n)||aoe(n))t+=AC(n);else break}return t}function r3(e,t){let n=e.codePointAt(t),r=t+AC(n);for(r=ooe(e,r);r<e.length-1&&e[r]==="\u200D";){let i=e.codePointAt(r+1);r+=1+AC(i),r=ooe(e,r)}return ioe(n)&&r<e.length&&ioe(e.codePointAt(r))&&(r+=AC(e.codePointAt(r))),r}function coe(e){return fZe(e)||soe(e)||aoe(e)||mZe(e)}function uoe(e){let t=0,n=0;for(;n<e.length;)n=r3(e,n),t++;return t}function hZe(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=r3(e,r),n++,n>=t)return!0;return!1}function gZe(e,t){let n=0,r=0;for(;r<e.length;)if(r=r3(e,r),n++,n>t)return!1;return!0}function loe(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(coe(e.charCodeAt(n)))return hZe(e,t);if(n++,n>=t)return!0}return!1}function poe(e,t){let n=0;for(;n<e.length;){if(coe(e.charCodeAt(n)))return gZe(e,t);if(n++,n>t)return!1}return!0}function lw(e){return Array.isArray(e)}function uw(e){return cn(typeof e,"bigint")}function doe(e){return cn(typeof e,"boolean")}function _Ze(e){if(o3(e)||!moe(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function moe(e){return cn(typeof e,"function")}function i3(e){return Number.isInteger(e)}function CC(e){return cn(e,null)}function OC(e){return Number.isFinite(e)}function xZe(e){return pw(e)&&!lw(e)}function pw(e){return cn(typeof e,"object")&&!CC(e)}function PC(e){return cn(typeof e,"string")}function vZe(e){return cn(typeof e,"symbol")}function o3(e){return cn(e,void 0)}function cn(e,t){return e===t}function bZe(e,t){return e>t}function wZe(e,t){return e<t}function foe(e,t){return e<=t}function hoe(e,t){return e>=t}function TZe(e,t){if(uw(e)||uw(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!OC(e)||i3(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 IZe(e){if(!pw(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return CC(t)?!1:cn(typeof t.constructor,"function")&&!(cn(t.constructor,globalThis.Object)||cn(t.constructor.name,"Object"))}function kZe(e){return uw(e)||doe(e)||CC(e)||OC(e)||PC(e)||o3(e)}function EZe(e){return uoe(e)}function SZe(e,t){return poe(e,t)}function AZe(e,t){return loe(e,t)}function RZe(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function CZe(e,t,n){let r=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(r=!1);return r}function LC(e,t,n){return cn(e.length,0)?n():t(e[0],e.slice(1))}function goe(e){return cn(e,"__proto__")||cn(e,"constructor")||cn(e,"prototype")}function OZe(e,t){return goe(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function PZe(e){return RC(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function LZe(e){return Object.entries(e)}function RC(e){return Object.getOwnPropertyNames(e)}function MZe(e){return Object.getOwnPropertySymbols(e)}function NZe(e){return Object.values(e)}function DZe(e,t){if(!pw(t))return!1;let n=RC(e);return cn(n.length,RC(t).length)&&n.every(r=>a3(e[r],t[r]))}function $Ze(e,t){return lw(t)&&cn(e.length,t.length)&&e.every((n,r)=>a3(e[r],t[r]))}function a3(e,t){return lw(e)?$Ze(e,t):pw(e)?DZe(e,t):cn(e,t)}var zd={};On(zd,{IsBigInt64Array:()=>QZe,IsBigUint64Array:()=>ZZe,IsBoolean:()=>UZe,IsDate:()=>tet,IsFloat32Array:()=>YZe,IsFloat64Array:()=>XZe,IsInt16Array:()=>HZe,IsInt32Array:()=>zZe,IsInt8Array:()=>GZe,IsMap:()=>ret,IsNumber:()=>WZe,IsRegExp:()=>eet,IsSet:()=>net,IsString:()=>qZe,IsTypeArray:()=>jZe,IsUint16Array:()=>VZe,IsUint32Array:()=>JZe,IsUint8Array:()=>BZe,IsUint8ClampedArray:()=>KZe});function UZe(e){return e instanceof Boolean}function WZe(e){return e instanceof Number}function qZe(e){return e instanceof String}function jZe(e){return globalThis.ArrayBuffer.isView(e)}function GZe(e){return e instanceof globalThis.Int8Array}function BZe(e){return e instanceof globalThis.Uint8Array}function KZe(e){return e instanceof globalThis.Uint8ClampedArray}function HZe(e){return e instanceof globalThis.Int16Array}function VZe(e){return e instanceof globalThis.Uint16Array}function zZe(e){return e instanceof globalThis.Int32Array}function JZe(e){return e instanceof globalThis.Uint32Array}function YZe(e){return e instanceof globalThis.Float32Array}function XZe(e){return e instanceof globalThis.Float64Array}function QZe(e){return e instanceof globalThis.BigInt64Array}function ZZe(e){return e instanceof globalThis.BigUint64Array}function eet(e){return e instanceof globalThis.RegExp}function tet(e){return e instanceof globalThis.Date}function net(e){return e instanceof globalThis.Set}function ret(e){return e instanceof globalThis.Map}function oet(e){return R.HasPropertyKey(e,"~kind")||R.HasPropertyKey(e,"~unsafe")}function aet(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let r of Object.keys(n)){if(R.IsUnsafePropertyKey(r))continue;let i=n[r];R.HasPropertyKey(i,"value")&&Object.defineProperty(t,r,{...i,value:ch(i.value)})}return t}function set(e){let t={};for(let n of R.Keys(e))R.IsUnsafePropertyKey(n)||(t[n]=ch(e[n]));for(let n of R.Symbols(e))t[n]=ch(e[n]);return t}function cet(e){return R.IsClassInstance(e)?e:oet(e)?aet(e):set(e)}function uet(e){return e.map(t=>ch(t))}function pet(e){return e.slice()}function det(e){return new RegExp(e.source,e.flags)}function met(e){return new Map(ch([...e.entries()]))}function fet(e){return new Set(ch([...e.values()]))}function ch(e){return zd.IsTypeArray(e)?pet(e):zd.IsRegExp(e)?det(e):zd.IsMap(e)?met(e):zd.IsSet(e)?fet(e):R.IsArray(e)?uet(e):R.IsObject(e)?cet(e):e}function dw(e){return ru.clone+=1,ch(e)}var uh={};On(uh,{Get:()=>yet,Reset:()=>het,Set:()=>get});var xp={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function het(){xp.immutableTypes=!1,xp.maxErrors=8,xp.useAcceleration=!0,xp.exactOptionalPropertyTypes=!1,xp.enumerableKind=!1,xp.correctiveParse=!1,xp.unionPrioritySort=!0}function get(e){for(let t of R.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(xp,t,{value:n})}}function yet(){return xp}function _et(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 yoe(e,t){return{...e,...t}}function xet(e,t,n={}){ru.create+=1;let r=uh.Get(),i=yoe(t,n),o=r.enumerableKind?yoe(i,e):_et(i,e);return r.immutableTypes?Object.freeze(o):o}function vet(e,t){ru.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(dw(e)),i=new Set(t);for(let o of Object.keys(r))i.has(o)||Object.defineProperty(n,o,r[o]);return n}function bet(e,t,n){ru.update+=1;let r=uh.Get(),i=dw(e);for(let o of Object.keys(t))Object.defineProperty(i,o,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[o]});for(let o of Object.keys(n))Object.defineProperty(i,o,{configurable:!0,enumerable:!0,writable:!0,value:n[o]});return i}function Qe(e,t){return R.IsObject(e)&&R.HasPropertyKey(e,"~kind")&&R.IsEqual(e["~kind"],t)}function fi(e){return R.IsObject(e)}function ot(e,t,n){return B.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function Jd(e){return Qe(e,"Deferred")}function wet(e){return B.Update(e,{"~readonly":!0},{})}function mw(e,t){return B.Update(wet(e),{},t)}function _oe(e,t,n,r){let i=Le(e,t,n);return mw(i,r)}function Tet(e){return B.Update(e,{"~optional":!0},{})}function fw(e,t){return B.Update(Tet(e),{},t)}function xoe(e,t,n,r){let i=Le(e,t,n);return fw(i,r)}function _s(e,t){return B.Create({"~kind":"Array"},{type:"array",items:e},t)}function mr(e){return Qe(e,"Array")}function MC(e){return B.Discard(e,["~kind","type","items"])}function ju(e,t,n={}){return B.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function Ri(e){return Qe(e,"Constructor")}function voe(e){return B.Discard(e,["~kind","type","parameters","instanceType"])}function Gu(e,t,n={}){return B.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function Ci(e){return Qe(e,"Function")}function boe(e){return B.Discard(e,["~kind","type","parameters","returnType"])}function vp(e,t){return B.Create({"~kind":"Ref"},{$ref:e},t)}function Oi(e){return Qe(e,"Ref")}function Yd(e,t){return B.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function M0(e){return Qe(e,"Generic")}function N0(e){return B.Create({"~kind":"Any"},{},e)}function ni(e){return Qe(e,"Any")}var woe="(?!)";function $n(e){return B.Create({"~kind":"Never"},{not:{}},e)}function Xd(e){return Qe(e,"Never")}function Bu(e,t={}){return ot("AddOptional",[e],t)}function lh(e,t={}){return fw(e,t)}function Toe(e){return lh(e)}function ko(e){return fi(e)&&R.HasPropertyKey(e,"~optional")}function Ioe(e){return R.Keys(e).filter(t=>!ko(e[t]))}function NC(e){return R.Keys(e)}function DC(e){return R.Values(e)}function Et(e,t={}){let n=Ioe(e),r=n.length>0?{required:n}:{};return B.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function _n(e){return Qe(e,"Object")}function koe(e){return B.Discard(e,["~kind","type","properties","required"])}function ji(e){return B.Create({"~kind":"Unknown"},{},e)}function hi(e){return Qe(e,"Unknown")}function Ku(e,t,n){let r=R.Keys(e).reduce((i,o)=>({...i,[o]:B.Update(e[o],{},{$id:o})}),{});return B.Create({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function oo(e){return Qe(e,"Cyclic")}function Eoe(e){return B.Update(e,{"~unsafe":null},{})}function $C(e){return R.IsObjectNotArray(e)&&R.HasPropertyKey(e,"~unsafe")&&R.IsNull(e["~unsafe"])}var Hu={};On(Hu,{Match:()=>Iet});function Iet(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function hw(...e){let[t,n]=Hu.Match(e,{2:(r,i)=>[r,i,i],1:r=>[r,ji(),ji()]});return B.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Hr(e){return Qe(e,"Infer")}function ph(e,t,n,r={}){return B.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function Fr(e){return Qe(e,"Dependent")}function Soe(e){return B.Discard(e,["~kind","if","then","else"])}function Aoe(e){return R.IsObjectNotArray(e)}function Roe(e){return R.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function Coe(e){return R.IsString(e)||R.IsNumber(e)}function Ooe(e,t){let n=Aoe(e)?Roe(e):e;return B.Create({"~kind":"Enum"},{enum:n},t)}function jo(e){return Qe(e,"Enum")}function Eo(e,t={}){return B.Create({"~kind":"Intersect"},{allOf:e},t)}function Yt(e){return Qe(e,"Intersect")}function Poe(e){return B.Discard(e,["~kind","allOf"])}function Vr(){throw new Error("Unreachable")}var Loe;(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"})(Loe||(Loe={}));var cin=BigInt("14695981039346656037"),[uin,lin]=[BigInt("1099511628211"),BigInt("18446744073709551616")],pin=Array.from({length:256}).map((e,t)=>BigInt(t)),Moe=new Float64Array(1),din=new DataView(Moe.buffer),min=new Uint8Array(Moe.buffer);var fin=new TextEncoder;var gw=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=FC(n)?a=>this.decode(n["~codec"].decode(a)):this.decode,i=FC(n)?a=>n["~codec"].encode(t(a)):t,o={decode:r,encode:i};return B.Update(this.type,{"~codec":o},{})}},yw=class{constructor(t){this.type=t}Decode(t){return new gw(this.type,t)}};function UC(e){return new yw(e)}function Doe(e,t){return UC(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function $oe(e,t){return UC(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function FC(e){return fi(e)&&R.HasPropertyKey(e,"~codec")&&R.IsObject(e["~codec"])&&R.HasPropertyKey(e["~codec"],"encode")&&R.HasPropertyKey(e["~codec"],"decode")}function Foe(e){return D0(e)}function dh(e){return fi(e)&&R.HasPropertyKey(e,"~immutable")}function Vu(e,t={}){return ot("AddReadonly",[e],t)}function mh(e,t={}){return mw(e,t)}function Uoe(e){return mh(e)}function fh(e){return fi(e)&&R.HasPropertyKey(e,"~readonly")}function Ret(e,t){let n=s3(e)?[...e["~refine"],t]:[t];return B.Update(e,{"~refine":n},{})}function Woe(...e){let[t,n,r]=Hu.Match(e,{3:(i,o,a)=>[i,o,a],2:(i,o)=>[i,o,()=>"Refine Error"]});return Ret(t,{check:n,error:r})}function Cet(e){return R.IsObjectNotArray(e)&&R.HasPropertyKey(e,"check")&&R.HasPropertyKey(e,"error")&&R.IsFunction(e.check)&&R.IsFunction(e.error)}function s3(e){return fi(e)&&R.HasPropertyKey(e,"~refine")&&R.IsArray(e["~refine"])&&R.Every(e["~refine"],0,t=>Cet(t))}var qoe="-?(?:0|[1-9][0-9]*)n";function _w(e){return B.Create({"~kind":"BigInt"},{type:"bigint"},e)}function zu(e){return Qe(e,"BigInt")}function WC(e){return B.Create({"~kind":"Boolean"},{type:"boolean"},e)}function nc(e){return Qe(e,"Boolean")}function xw(e){return B.Create({"~kind":"Identifier"},{name:e})}function joe(e){return Qe(e,"Identifier")}var qC="-?(?:0|[1-9][0-9]*)";function hh(e){return B.Create({"~kind":"Integer"},{type:"integer"},e)}function Go(e){return Qe(e,"Integer")}var c3=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function Oet(e){return R.IsBigInt(e)?"bigint":R.IsBoolean(e)?"boolean":R.IsNumber(e)?"number":R.IsString(e)?"string":(()=>{throw new c3(e)})()}function Xt(e,t){return B.Create({"~kind":"Literal"},{type:Oet(e),const:e},t)}function jC(e){return R.IsBigInt(e)||R.IsBoolean(e)||R.IsNumber(e)||R.IsString(e)}function Goe(e){return bn(e)&&R.IsNumber(e.const)}function Boe(e){return bn(e)&&R.IsString(e.const)}function bn(e){return Qe(e,"Literal")}function $0(e){return B.Create({"~kind":"Null"},{type:"null"},e)}function F0(e){return Qe(e,"Null")}var GC="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function $a(e){return B.Create({"~kind":"Number"},{type:"number"},e)}function ri(e){return Qe(e,"Number")}function U0(e){return B.Create({"~kind":"Symbol"},{type:"symbol"},e)}function Qd(e){return Qe(e,"Symbol")}function gh(...e){let[t,n,r]=Hu.Match(e,{3:(i,o,a)=>[i,o,a],2:(i,o)=>[i,o,o],1:i=>[i,ji(),ji()]});return B.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function Koe(e){return Qe(e,"Parameter")}var BC=".*";function rc(e){return B.Create({"~kind":"String"},{type:"string"},e)}function Bo(e){return Qe(e,"String")}function jt(e,t={}){return B.Create({"~kind":"Union"},{anyOf:e},t)}function nt(e){return Qe(e,"Union")}function Hoe(e){return B.Discard(e,["~kind","anyOf"])}function vw(e){let t=Voe(e);return R.IsEqual(t.length,2)?t[0]:[]}function Pet(e){return!0}function zoe(e){return R.ShiftLeft(e,(t,n)=>Let(t)?zoe(n):!1,()=>!0)}function Joe(e){return R.IsEqual(e.length,0)?!1:zoe(e)}function Let(e){return nt(e)?Joe(e.anyOf):bn(e)?Pet(e.const):!1}function KC(e){return Joe(e)}function HC(e){return B.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function Yoe(e,t,n=[]){return R.ShiftLeft(e,(r,i)=>Yoe(i,t,[...n,`${r}${t}`]),()=>n)}function Met(e,t){return R.IsEqual(e.length,0)?[`${t}`]:Yoe(e,t)}function Xoe(e,t,n=[]){return R.ShiftLeft(t,(r,i)=>Xoe(e,i,[...n,...Qoe(e,r)]),()=>n)}function Qoe(e,t){return nt(t)?Xoe(e,t.anyOf):bn(t)?Met(e,t.const):Vr()}function Zoe(e,t){return R.ShiftLeft(t,(n,r)=>Zoe(Qoe(e,n),r),()=>e)}function Net(e){return e.map(t=>Xt(t))}function Det(e){let t=Zoe([],e),n=Net(t);return jt(n)}function $et(e){return R.IsEqual(e.length,0)?Vr():R.IsEqual(e.length,1)&&bn(e[0])?e[0]:Det(e)}function u3(e){let t=vw(e);return R.IsEqual(t.length,0)?rc():KC(t)?$et(t):HC(e)}function eae(e){let t=u3(e);return ii(t)?rc():t}function la(e,t){let n="object",r={[e]:t};return B.Create({"~kind":"Record"},{type:n,patternProperties:r})}function tae(e){return la(iu,e)}function nae(e){return Et({true:e,false:e})}function oi(e,t={}){let[n,r,i]=[e,e.length,!1];return B.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:r},t)}function Gn(e){return Qe(e,"Tuple")}function rae(e){return B.Discard(e,["~kind","type","items","minItems","additionalItems"])}function Fet(e){return B.Discard(e,["~readonly"])}function l3(e,t){return B.Update(Fet(e),{},t)}function iae(e,t,n,r){let i=Le(e,t,n);return l3(i,r)}function oae(e,t={}){return ot("RemoveReadonly",[e],t)}function aae(e,t={}){return l3(e,t)}function Uet(e){return B.Discard(e,["~optional"])}function p3(e,t){return B.Update(Uet(e),{},t)}function sae(e,t,n,r){let i=Le(e,t,n);return p3(i,r)}function cae(e,t={}){return ot("RemoveOptional",[e],t)}function VC(e,t={}){return p3(e,t)}function d3(e){return e.reduceRight((n,r,i)=>({[i]:r,...n}),{})}function uae(e){let t=d3(e.items);return Et(t)}function Wet(e,t){return fh(e)?!!fh(t):!1}function qet(e,t){return ko(e)?!!ko(t):!1}function jet(e,t){let n=Wet(e,t),r=qet(e,t),i=Tr([e,t]),o=aae(VC(i));return n&&r?mh(lh(o)):n&&!r?mh(o):!n&&r?lh(o):o}function Get(e,t,n){return n in e?n in t?jet(e[n],t[n]):e[n]:n in t?t[n]:$n()}function Bet(e,t){return[...new Set([...R.Keys(t),...R.Keys(e)])].reduce((r,i)=>({...r,[i]:Get(e,t,i)}),{})}function lae(e){return _n(e)?e.properties:Gn(e)?d3(e.items):Vr()}function pae(e,t){let n=lae(e),r=lae(t),i=Bet(n,r);return Et(i)}function dae(e,t){let n=W0(e,t);return R.IsEqual(n,ww)?e:R.IsEqual(n,Tw)||R.IsEqual(n,bw)?t:$n()}function mae(e){return _n(e)||Gn(e)}function Ket(e,t){let n=nt(e),r=nt(t);return n||r}function Het(e,t){let n=ic(e),r=ic(t),i=Ket(n,r),o=mae(n),a=mae(r);return i?Tr([n,r]):o&&a?pae(n,r):o&&!a?n:!o&&a?r:dae(n,r)}function fae(e,t,n=[]){return R.ShiftLeft(t,(r,i)=>fae(e,i,[...n,Het(e,r)]),()=>R.IsEqual(n.length,0)?[e]:n)}function hae(e,t,n=[]){return R.ShiftLeft(e,(r,i)=>hae(i,t,[...n,...Iw([r],t)]),()=>n)}function Iw(e,t=[]){return R.ShiftLeft(e,(n,r)=>nt(n)?Iw(r,hae(n.anyOf,t)):Iw(r,fae(n,t)),()=>t)}function Vet(e,t){let n=ao({},e,t);return vt.IsExtendsTrueLike(n)?[]:[e]}function zet(e,t){return e.reduce((n,r)=>[...n,...Vet(r,t)],[])}function zC(e,t){let n=ic(e),r=nt(n)?n.anyOf:[n],i=zet(r,t);return Fa(i)}function ou(e,t,n){let r=Eo([e,t]),i=zC(n,e);return Fa([r,i])}function xs(e){let t=e.map(n=>Xt(n));return Fa(t)}function Tr(e){let t=Iw(e),n=m3(t);return bp(n)}function pa(e){let t=eae(e);return ic(t)}function Fa(e){let t=m3(e);return bp(t)}function ic(e){return Fr(e)?ou(e.if,e.then,e.else):jo(e)?xs(e.enum):Yt(e)?Tr(e.allOf):ii(e)?pa(e.pattern):nt(e)?Fa(e.anyOf):e}function bp(e){return R.IsEqual(e.length,1)?e[0]:R.IsEqual(e.length,0)?$n():jt(e)}function gae(e,t){let n=xs(e);return Zd(n,t)}function yae(e,t){return la(em,t)}function _ae(e,t){let n=Tr(e);return Zd(n,t)}function xae(e,t){return R.IsString(e)||R.IsNumber(e)?Et({[e]:t}):R.IsEqual(e,!1)?Et({false:t}):R.IsEqual(e,!0)?Et({true:t}):Et({})}function vae(e,t){return la(q0,t)}function bae(e,t){return R.HasPropertyKey(e,"pattern")&&(R.IsString(e.pattern)||e.pattern instanceof RegExp)?la(e.pattern.toString(),t):la(iu,t)}function wae(e,t){let n=vw(e);return KC(n)?Zd(pa(e),t):la(e,t)}function Jet(e){return nt(e)?kw(e.anyOf):[e]}function kw(e){return e.reduce((t,n)=>[...t,...Jet(n)],[])}function Yet(e){return e.some(t=>Bo(t)||ri(t)||Go(t))}function Xet(e,t){return R.IsEqual(Yet(e),!0)?la(iu,t):void 0}function Qet(e,t){return e.reduce((n,r)=>bn(r)&&(R.IsString(r.const)||R.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function Zet(e,t){let n=Qet(e,t);return Et(n)}function Tae(e,t){let n=kw(e),r=Xet(n,t);return fi(r)?r:Zet(n,t)}function Zd(e,t){return ni(e)?tae(t):nc(e)?nae(t):jo(e)?gae(e.enum,t):Go(e)?yae(e,t):Yt(e)?_ae(e.allOf,t):bn(e)?xae(e.const,t):ri(e)?vae(e,t):nt(e)?Tae(e.anyOf,t):Bo(e)?bae(e,t):ii(e)?wae(e.pattern,t):Et({})}function f3(e,t,n){return Dt([e])?B.Update(Zd(e,t),{},n):JC(e,t,n)}function Iae(e,t,n,r,i){let o=Le(e,t,n),a=Le(e,t,r);return f3(o,a,i)}var em=`^${qC}$`,q0=`^${GC}$`,iu=`^${BC}$`;function JC(e,t,n={}){return ot("Record",[e,t],n)}function YC(e,t,n={}){return f3(e,t,n)}function kae(e,t){return la(e,t)}function XC(e){return R.IsEqual(e,iu)?rc():R.IsEqual(e,em)?hh():R.IsEqual(e,q0)?$a():u3(e)}function oc(e){return R.Keys(e.patternProperties)[0]}function j0(e){let t=oc(e);return XC(t)}function Ko(e){return e.patternProperties[oc(e)]}function so(e){return Qe(e,"Record")}function yh(e){return B.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function tm(e){return Qe(e,"Rest")}function QC(e){return B.Create({"~kind":"This"},{$ref:"#"},e)}function ZC(e){return Qe(e,"This")}function G0(e){return B.Create({"~kind":"Undefined"},{type:"undefined"},e)}function B0(e){return Qe(e,"Undefined")}function eO(e){return B.Create({"~kind":"Void"},{type:"void"},e)}function Ju(e){return Qe(e,"Void")}function ttt(e,t){return R.IsEqual(e,"Array")?_s(t[0]):R.IsEqual(e,"Capitalize")?nO(t[0]):R.IsEqual(e,"ConstructorParameters")?sO(t[0]):R.IsEqual(e,"Evaluate")?Sce(t[0]):R.IsEqual(e,"Exclude")?cO(t[0],t[1]):R.IsEqual(e,"Extract")?uO(t[0],t[1]):R.IsEqual(e,"Index")?Rw(t[0],t[1]):R.IsEqual(e,"InstanceType")?lO(t[0]):R.IsEqual(e,"Lowercase")?rO(t[0]):R.IsEqual(e,"NonNullable")?pO(t[0]):R.IsEqual(e,"Omit")?dO(t[0],t[1]):R.IsEqual(e,"Parameters")?mO(t[0]):R.IsEqual(e,"Partial")?fO(t[0]):R.IsEqual(e,"Pick")?hO(t[0],t[1]):R.IsEqual(e,"Readonly")?gO(t[0]):R.IsEqual(e,"KeyOf")?Cw(t[0]):R.IsEqual(e,"Record")?JC(t[0],t[1]):R.IsEqual(e,"Required")?yO(t[0]):R.IsEqual(e,"ReturnType")?_O(t[0]):R.IsEqual(e,"Uncapitalize")?iO(t[0]):R.IsEqual(e,"Uppercase")?oO(t[0]):Aw(vp(e),t)}function _h(){throw Error("Unreachable")}var ntt=(e,t=[])=>e.reduce((n,r)=>R.IsArray(r)&&R.IsEqual(r.length,2)?[...n,r[0]]:[...n,r],[]),wp=e=>{let[t,n]=e;return ntt([...t,...n])};function Cae(e){return gh(e[0],e[2],e[4])}function Oae(e){return gh(e[0],e[2],e[2])}function Pae(e){return gh(e[0],ji(),e[2])}function Lae(e){return gh(e,ji(),ji())}function Mae(e){return wp(e)}function Nae(e){return e[1]}function Dae(e){return wp(e)}function $ae(e){return e[1]}function Fae(e){return ttt(e[0],e[1])}function Uae(e){return null}function Wae(e){return rc()}function qae(e){return $a()}function jae(e){return WC()}function Gae(e){return G0()}function Bae(e){return $0()}function Kae(e){return hh()}function Hae(e){return _w()}function Vae(e){return ji()}function zae(e){return N0()}function Jae(e){return Et({})}function Yae(e){return $n()}function Xae(e){return U0()}function Qae(e){return eO()}function Zae(e){return QC()}function ese(e){return Xt(BigInt(e))}function tse(e){return Xt(R.IsEqual(e,"true"))}function nse(e){return Xt(parseFloat(e))}function rse(e){return Xt(e)}function ise(e){return e[1]}function ose(e){return Xt(e)}function ase(e){return R.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function sse(e){return e[1]}function cse(e){return tO(e)}function use(e){return R.IsEqual(e.length,6)?ph(e[1],e[3],e[5]):ph(e[1],e[3],ji())}function lse(e){return e.length>0}function pse(e){return e.reduce((t,n)=>R.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function dse(e){return R.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function mse(e){return R.IsArray(e)&&R.IsEqual(e.length,3)?e[1]:e}function fse(e){return R.IsEqual(e.length,2)?e[1]:[]}function Eae(e,t){return t.reduce((n,r)=>{let i=r;return R.IsEqual(i.length,1)?Rw(n,i[0]):R.IsEqual(i.length,0)?_s(n):_h()},e)}function Sae(e,t){return R.IsEqual(t.length,3)?aO(e,t[0],t[1],t[2]):e}function rtt(e,t){return R.IsArray(t)&&R.IsEqual(t.length,0)?e:xO(e,t)}function hse(e){let[t,n,r,i,o]=e;return rtt(Sae(t?Cw(Eae(n,r)):Eae(n,r),i),o)}function h3(e,t){return R.IsEqual(t.length,3)?(()=>{let[n,r,i]=t,o=h3(r,i);if(R.IsEqual(n,"&"))return Yt(o)?Eo([e,...o.allOf]):Eo([e,o]);if(R.IsEqual(n,"|"))return nt(o)?jt([e,...o.anyOf]):jt([e,o]);_h()})():e}function gse(e){let[t,n]=e;return h3(t,n)}function yse(e){let[t,n]=e;return h3(t,n)}function _se(e){return Ece(e[1])}function xse(e){return e[1]}function vse(e){return Yd(e[0],e[2])}function bse(e){return R.IsEqual(e.length,4)?hw(e[1],e[3]):R.IsEqual(e.length,2)?hw(e[1],ji()):_h()}function wse(e){return`${e}`}function Tse(e){return Go(e[3])?em:ri(e[3])?q0:Qd(e[3])?iu:Bo(e[3])?iu:_h()}function Ise(e){return e.length>0}function kse(e){return e.length>0}function Ese(e){let[t,n,r,i,o]=e;return{[n]:t&&r?Vu(Bu(o)):t&&!r?Vu(o):!t&&r?Bu(o):o}}function Sse(e){return wp(e)}function Ase(e){return e.reduce((t,n)=>R.HasPropertyKey(n,em)||R.HasPropertyKey(n,q0)||R.HasPropertyKey(n,iu)?[t[0],B.Assign(t[1],n)]:[B.Assign(t[0],n),t[1]],[{},{}])}function Rse(e){return Ase(e[1])}function Cse(e){let[t,n]=e,r=R.IsEqual(R.Keys(n).length,0)?{}:{patternProperties:n};return Et(t,r)}function Ose(e){return R.IsEqual(e.length,5)?Vu(Bu(e[4])):R.IsEqual(e.length,3)?e[2]:R.IsEqual(e.length,4)?R.IsEqual(e[2],"readonly")?Vu(e[3]):Bu(e[3]):_h()}function Pse(e){return Vu(Bu(e[1]))}function Lse(e){return Vu(e[1])}function Mse(e){return Bu(e[0])}function Nse(e){return R.IsEqual(e.length,2)?yh(e[1]):R.IsEqual(e.length,1)?e[0]:_h()}function Dse(e){return wp(e)}function $se(e){return oi(e[1])}function Fse(e){return Vu(Bu(e[4]))}function Use(e){return Vu(e[3])}function Wse(e){return Bu(e[3])}function qse(e){return e[2]}function jse(e){return R.IsEqual(e.length,2)?yh(e[1]):R.IsEqual(e.length,1)?e[0]:_h()}function Gse(e){return wp(e)}function Bse(e){return Gu(e[1],e[4])}function Kse(e){return ju(e[2],e[5])}function Aae(e,t){return R.IsEqual(e,"remove")?oae(t):R.IsEqual(e,"add")?Vu(t):t}function Hse(e){return R.IsEqual(e.length,2)&&R.IsEqual(e[0],"-")?"remove":R.IsEqual(e.length,2)&&R.IsEqual(e[0],"+")||R.IsEqual(e.length,1)?"add":"none"}function Rae(e,t){return R.IsEqual(e,"remove")?cae(t):R.IsEqual(e,"add")?Bu(t):t}function Vse(e){return R.IsEqual(e.length,2)&&R.IsEqual(e[0],"-")?"remove":R.IsEqual(e.length,2)&&R.IsEqual(e[0],"+")||R.IsEqual(e.length,1)?"add":"none"}function zse(e){return R.IsEqual(e.length,2)?[e[1]]:[]}function Jse(e){return R.IsArray(e[6])&&R.IsEqual(e[6].length,1)?Ew(xw(e[3]),e[5],e[6][0],Aae(e[1],Rae(e[8],e[10]))):Ew(xw(e[3]),e[5],vp(e[3]),Aae(e[1],Rae(e[8],e[10])))}function Yse(e){return vp(e)}function Xse(e){return BigInt(e)}function Qse(e){return parseFloat(e)}function Zse(e){return R.IsEqual(e,"true")}function ece(e){return null}function tce(e){return{[e[0]]:e[2]}}function nce(e){return wp(e)}function itt(e){return e.reduce((t,n)=>B.Assign(t,n),{})}function rce(e){return itt(e[1])}function ice(e){return wp(e)}function oce(e){return e[1]}function ace(e){return _w()}function sce(e){return rc()}function cce(e){return $a()}function uce(e){return hh()}function lce(e){return $n()}function pce(e){return Xt(e)}function dce(e){return jt(e[1])}function mce(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function fce(e){return[e[0],...e[1]]}function hce(e){return e[1]}function gce(e){return wp(e)}function yce(e){return R.IsEqual(e.length,2)?e[1]:[]}function _ce(e){let t=e[2],n=e[3],[r,i]=e[4],o=R.IsEqual(R.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:Yd(t,Sw(n,r,o))}}function xce(e){let t=e[2],[n,r]=e[3],i=R.IsEqual(R.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:Sw(t,n,i)}}function vce(e){return{[e[1]]:Yd(e[2],e[4])}}function bce(e){return{[e[1]]:e[3]}}function wce(e){return null}function Tce(e){return Ase(wp(e))}function Ice(e){return e[1]}function kce(e){let t=e[0],n=e[1];return Ace(B.Assign(t,n[0]))}function Ow(e){return cn(e.length,2)}function Ht(e,t,n){return Ow(e)?t(e[0],e[1]):n()}function stt(e,t){return cn(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function Ir(e,t){for(let n=0;n<e.length;n++){let r=stt(e[n],t);if(Ow(r))return r}return[]}function g3(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var Rce=[...g3(97,122),...g3(65,90)],y3="0",_3=g3(49,57),K0=[y3,..._3],Cce=" ",H0=`
310
310
  `;var nm="_",vO=".",Oce="$",bO="-";var Pce="//",Lce="/*",utt="*/";function Mce(e){let t=e.indexOf(utt);return cn(t,-1)?"":e.slice(t+2)}function Nce(e){let t=e.indexOf(H0);return cn(t,-1)?"":e.slice(t)}function ltt(e){return e.replace(/^[ \t\r\f\v]+/,"")}function wO(e){let t=ltt(e);return t.startsWith(Lce)?wO(Mce(t.slice(2))):t.startsWith(Pce)?wO(Nce(t.slice(2))):t}function Gi(e){let t=e.trimStart();return t.startsWith(Lce)?Gi(Mce(t.slice(2))):t.startsWith(Pce)?Gi(Nce(t.slice(2))):t}function TO(e,t){return Ht(Ir([e],t),(n,r)=>[n,r],()=>["",t])}function ptt(e,t){return e.includes(t)}function V0(e,t,n,r=""){return Ht(Ir(e,n),(i,o)=>ptt(t,i)?V0(e,t,o,r):V0(e,t,o,`${r}${i}`),()=>[r,n])}function dtt(e){return Ir(_3,e)}var mtt=[...K0,nm];function ftt(e){return V0(mtt,[nm],e)}function htt(e){return Ht(Ir([y3],e),(t,n)=>[t,n],()=>Ht(dtt(e),(t,n)=>Ht(ftt(n),(r,i)=>[`${t}${r}`,i],()=>[]),()=>[]))}function IO(e){return htt(Gi(e))}function gtt(e){return TO(bO,e)}function ytt(e){return Ht(gtt(e),(t,n)=>Ht(IO(n),(r,i)=>[`${t}${r}`,i],()=>[]),()=>[])}function Dce(e){return ytt(Gi(e))}function _tt(e){return Ht(Dce(e),(t,n)=>Ht(Ir(["n"],n),(r,i)=>[`${t}`,i],()=>[]),()=>[])}function x3(e){return _tt(e)}function v3(e,t){return Ir([e],t)}function se(e,t){return cn(e,"")?["",t]:e.startsWith(H0)?v3(e,wO(t)):e.startsWith(Cce)?v3(e,t):v3(e,Gi(t))}var $ce=[...Rce,nm,Oce];function xtt(e){return Ir($ce,e)}var vtt=[...$ce,...K0];function Fce(e,t=""){return Ht(Ir(vtt,e),(n,r)=>Fce(r,`${t}${n}`),()=>[t,e])}function btt(e){return Ht(xtt(e),(t,n)=>Ht(Fce(n),(r,i)=>[`${t}${r}`,i],()=>[]),()=>[])}function Ur(e){return btt(Gi(e))}var wtt=[...K0,nm];function Ttt(e){return Ow(Ir([vO],e))}function Uce(e){return Ht(V0(wtt,[nm],e),(t,n)=>cn(t,"")?[]:[t,n],()=>[])}function Itt(e){return Ht(Ir([vO],e),(t,n)=>Ht(Uce(n),(r,i)=>[`0${t}${r}`,i],()=>[]),()=>[])}function ktt(e){return Ht(IO(e),(t,n)=>Ht(Ir([vO],n),(r,i)=>Ht(Uce(i),(o,a)=>[`${t}${r}${o}`,a],()=>[`${t}`,i]),()=>[`${t}`,n]),()=>[])}function Ett(e){return Ttt(e)?Itt(e):ktt(e)}function Wce(e){return Ett(Gi(e))}function Stt(e){return TO(bO,e)}function Att(e){return Ht(Stt(e),(t,n)=>Ht(Wce(n),(r,i)=>[`${t}${r}`,i],()=>[]),()=>[])}function kO(e){return Att(Gi(e))}function Rtt(e){return cn(e,"")?[]:[e.slice(0,1),e.slice(1)]}function qce(e,t){return LC(e,(n,r)=>t.startsWith(n)?!0:qce(r,t),()=>!1)}function rm(e,t,n=""){return Ht(Rtt(t),(r,i)=>qce(e,t)?[n,t]:rm(e,i,`${n}${r}`),()=>[])}function Ctt(e,t,n){return Ht(Ir([e],n),(r,i)=>Ht(rm([t],i),(o,a)=>Ht(Ir([t],a),(c,u)=>[`${o}`,u],()=>[]),()=>[]),()=>[])}function Ott(e,t,n){return Ht(Ir([e],n),(r,i)=>Ht(rm([H0,t],i),(o,a)=>Ht(Ir([t],a),(c,u)=>[`${o}`,u],()=>[]),()=>[]),()=>[])}function jce(e,t,n,r){return n?Ctt(e,t,Gi(r)):Ott(e,t,Gi(r))}function Ptt(e,t){return Ir(e,t)}function Ltt(e,t){return jce(e,e,!1,t)}function Mtt(e,t){return Ht(Ptt(e,t),(n,r)=>Ltt(n,`${n}${r}`),()=>[])}function EO(e,t){return Mtt(e,Gi(t))}function Gce(e,t){return Ht(rm(e,t),(n,r)=>cn(n,"")?[]:[n,r],()=>[])}var T=(e,t,n=()=>[])=>e.length===2?t(e):n(),Dtt=e=>T(T(Ur(e),([t,n])=>T(se("extends",n),([r,i])=>T(Vt(i),([o,a])=>T(se("=",a),([c,u])=>T(Vt(u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[Cae(t),n]),$tt=e=>T(T(Ur(e),([t,n])=>T(se("extends",n),([r,i])=>T(Vt(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[Oae(t),n]),Ftt=e=>T(T(Ur(e),([t,n])=>T(se("=",n),([r,i])=>T(Vt(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[Pae(t),n]),Utt=e=>T(Ur(e),([t,n])=>[Lae(t),n]),Hce=e=>T(T(Dtt(e),([t,n])=>[t,n],()=>T($tt(e),([t,n])=>[t,n],()=>T(Ftt(e),([t,n])=>[t,n],()=>T(Utt(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Vce=(e,t=[])=>T(T(Hce(e),([n,r])=>T(se(",",r),([i,o])=>[[n,i],o])),([n,r])=>Vce(r,[...t,n]),()=>[t,e]),Wtt=e=>T(T(Vce(e),([t,n])=>T(T(T(Hce(n),([r,i])=>[[r],i]),([r,i])=>[r,i],()=>T([[],n],([r,i])=>[r,i],()=>[])),([r,i])=>[[t,r],i])),([t,n])=>[Mae(t),n]),T3=e=>T(T(se("<",e),([t,n])=>T(Wtt(n),([r,i])=>T(se(">",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[Nae(t),n]),zce=(e,t=[])=>T(T(Vt(e),([n,r])=>T(se(",",r),([i,o])=>[[n,i],o])),([n,r])=>zce(r,[...t,n]),()=>[t,e]),qtt=e=>T(T(zce(e),([t,n])=>T(T(T(Vt(n),([r,i])=>[[r],i]),([r,i])=>[r,i],()=>T([[],n],([r,i])=>[r,i],()=>[])),([r,i])=>[[t,r],i])),([t,n])=>[Dae(t),n]),jtt=e=>T(T(se("<",e),([t,n])=>T(qtt(n),([r,i])=>T(se(">",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[$ae(t),n]),Gtt=e=>T(T(Ur(e),([t,n])=>T(jtt(n),([r,i])=>[[t,r],i])),([t,n])=>[Fae(t),n]),Jce=e=>T(T(T(se(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>T([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Uae(t),n]),Yce=e=>T(se("string",e),([t,n])=>[Wae(t),n]),Xce=e=>T(se("number",e),([t,n])=>[qae(t),n]),Btt=e=>T(se("boolean",e),([t,n])=>[jae(t),n]),Ktt=e=>T(se("undefined",e),([t,n])=>[Gae(t),n]),Htt=e=>T(se("null",e),([t,n])=>[Bae(t),n]),Qce=e=>T(se("integer",e),([t,n])=>[Kae(t),n]),Vtt=e=>T(se("bigint",e),([t,n])=>[Hae(t),n]),ztt=e=>T(se("unknown",e),([t,n])=>[Vae(t),n]),Jtt=e=>T(se("any",e),([t,n])=>[zae(t),n]),Ytt=e=>T(se("object",e),([t,n])=>[Jae(t),n]),Xtt=e=>T(se("never",e),([t,n])=>[Yae(t),n]),Zce=e=>T(se("symbol",e),([t,n])=>[Xae(t),n]),Qtt=e=>T(se("void",e),([t,n])=>[Qae(t),n]),Ztt=e=>T(se("this",e),([t,n])=>[Zae(t),n]),ent=e=>T(T(se("${",e),([t,n])=>T(Vt(n),([r,i])=>T(se("}",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[ise(t),n]),b3=e=>T(rm(["${","`"],e),([t,n])=>[ose(t),n]),eue=e=>T(T(T(b3(e),([t,n])=>T(ent(n),([r,i])=>T(eue(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>T(T(b3(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>T(T(b3(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[ase(t),n]),I3=e=>T(T(se("`",e),([t,n])=>T(eue(n),([r,i])=>T(se("`",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[sse(t),n]),tnt=e=>T(I3(e),([t,n])=>[cse(t),n]),nnt=e=>T(T(T(se("if",e),([t,n])=>T(Vt(n),([r,i])=>T(se("then",i),([o,a])=>T(Vt(a),([c,u])=>T(se("else",u),([l,d])=>T(Vt(d),([m,h])=>[[t,r,o,c,l,m],h])))))),([t,n])=>[t,n],()=>T(T(se("if",e),([t,n])=>T(Vt(n),([r,i])=>T(se("then",i),([o,a])=>T(Vt(a),([c,u])=>[[t,r,o,c],u])))),([t,n])=>[t,n],()=>[])),([t,n])=>[use(t),n]),rnt=e=>T(x3(e),([t,n])=>[ese(t),n]),int=e=>T(T(se("true",e),([t,n])=>[t,n],()=>T(se("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[tse(t),n]),ont=e=>T(kO(e),([t,n])=>[nse(t),n]),ant=e=>T(EO(["'",'"'],e),([t,n])=>[rse(t),n]),snt=e=>T(T(T(se("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>T([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[lse(t),n]),tue=(e,t=[])=>T(T(T(se("[",e),([n,r])=>T(Vt(r),([i,o])=>T(se("]",o),([a,c])=>[[n,i,a],c]))),([n,r])=>[n,r],()=>T(T(se("[",e),([n,r])=>T(se("]",r),([i,o])=>[[n,i],o])),([n,r])=>[n,r],()=>[])),([n,r])=>tue(r,[...t,n]),()=>[t,e]),cnt=e=>T(tue(e),([t,n])=>[pse(t),n]),unt=e=>T(T(T(se("extends",e),([t,n])=>T(Vt(n),([r,i])=>T(se("?",i),([o,a])=>T(Vt(a),([c,u])=>T(se(":",u),([l,d])=>T(Vt(d),([m,h])=>[[t,r,o,c,l,m],h])))))),([t,n])=>[t,n],()=>T([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[dse(t),n]),lnt=e=>T(T(T(se("(",e),([t,n])=>T(Vt(n),([r,i])=>T(se(")",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>T(Yce(e),([t,n])=>[t,n],()=>T(Xce(e),([t,n])=>[t,n],()=>T(Btt(e),([t,n])=>[t,n],()=>T(Ktt(e),([t,n])=>[t,n],()=>T(Htt(e),([t,n])=>[t,n],()=>T(Qce(e),([t,n])=>[t,n],()=>T(Vtt(e),([t,n])=>[t,n],()=>T(ztt(e),([t,n])=>[t,n],()=>T(Jtt(e),([t,n])=>[t,n],()=>T(Ytt(e),([t,n])=>[t,n],()=>T(Xtt(e),([t,n])=>[t,n],()=>T(Zce(e),([t,n])=>[t,n],()=>T(Qtt(e),([t,n])=>[t,n],()=>T(Ztt(e),([t,n])=>[t,n],()=>T(rnt(e),([t,n])=>[t,n],()=>T(int(e),([t,n])=>[t,n],()=>T(ont(e),([t,n])=>[t,n],()=>T(ant(e),([t,n])=>[t,n],()=>T(tnt(e),([t,n])=>[t,n],()=>T(nnt(e),([t,n])=>[t,n],()=>T(Tnt(e),([t,n])=>[t,n],()=>T(Rnt(e),([t,n])=>[t,n],()=>T(Nnt(e),([t,n])=>[t,n],()=>T(Mnt(e),([t,n])=>[t,n],()=>T(Unt(e),([t,n])=>[t,n],()=>T(Gtt(e),([t,n])=>[t,n],()=>T(Wnt(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[mse(t),n]),pnt=e=>T(T(T(se("with",e),([t,n])=>T(yue(n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>T([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[fse(t),n]),nue=e=>T(T(snt(e),([t,n])=>T(lnt(n),([r,i])=>T(cnt(i),([o,a])=>T(unt(a),([c,u])=>T(pnt(u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[hse(t),n]),rue=e=>T(T(T(se("&",e),([t,n])=>T(nue(n),([r,i])=>T(rue(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>T([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),iue=e=>T(T(nue(e),([t,n])=>T(rue(n),([r,i])=>[[t,r],i])),([t,n])=>[gse(t),n]),oue=e=>T(T(T(se("|",e),([t,n])=>T(iue(n),([r,i])=>T(oue(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>T([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),SO=e=>T(T(iue(e),([t,n])=>T(oue(n),([r,i])=>[[t,r],i])),([t,n])=>[yse(t),n]),dnt=e=>T(T(se("readonly",e),([t,n])=>T(SO(n),([r,i])=>[[t,r],i])),([t,n])=>[_se(t),n]),mnt=e=>T(T(se("|",e),([t,n])=>T(SO(n),([r,i])=>[[t,r],i])),([t,n])=>[xse(t),n]),fnt=e=>T(T(T3(e),([t,n])=>T(se("=",n),([r,i])=>T(Vt(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[vse(t),n]),hnt=e=>T(T(T(se("infer",e),([t,n])=>T(Ur(n),([r,i])=>T(se("extends",i),([o,a])=>T(SO(a),([c,u])=>[[t,r,o,c],u])))),([t,n])=>[t,n],()=>T(T(se("infer",e),([t,n])=>T(Ur(n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>[])),([t,n])=>[bse(t),n]),Vt=e=>T(T(hnt(e),([t,n])=>[t,n],()=>T(mnt(e),([t,n])=>[t,n],()=>T(dnt(e),([t,n])=>[t,n],()=>T(SO(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),gnt=e=>T(kO(e),([t,n])=>[wse(t),n]),ynt=e=>T(Ur(e),([t,n])=>[t,n]),_nt=e=>T(EO(["'",'"'],e),([t,n])=>[t,n]),xnt=e=>T(T(se("[",e),([t,n])=>T(Ur(n),([r,i])=>T(se(":",i),([o,a])=>T(T(Qce(a),([c,u])=>[c,u],()=>T(Xce(a),([c,u])=>[c,u],()=>T(Yce(a),([c,u])=>[c,u],()=>T(Zce(a),([c,u])=>[c,u],()=>[])))),([c,u])=>T(se("]",u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[Tse(t),n]),aue=e=>T(T(gnt(e),([t,n])=>[t,n],()=>T(ynt(e),([t,n])=>[t,n],()=>T(_nt(e),([t,n])=>[t,n],()=>T(xnt(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),vnt=e=>T(T(T(se("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>T([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Ise(t),n]),bnt=e=>T(T(T(se("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>T([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[kse(t),n]),sue=e=>T(T(vnt(e),([t,n])=>T(aue(n),([r,i])=>T(bnt(i),([o,a])=>T(se(":",a),([c,u])=>T(Vt(u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[Ese(t),n]),cue=e=>T(T(T(se(",",e),([t,n])=>T(se(`
311
311
  `,n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>T(T(se(";",e),([t,n])=>T(se(`
312
312
  `,n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>T(T(se(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>T(T(se(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>T(T(se(`
@@ -343,14 +343,14 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
343
343
  `+A.slice(Te,Re),Te=Re+1),Se=Ye;return ze+=`
344
344
  `,A.length-Te>ie&&Se>Te?ze+=A.slice(Te,Se)+`
345
345
  `+A.slice(Se+1):ze+=A.slice(Te),ze.slice(1)}function tn(A){let ie="",Ee=0;for(let _e=0;_e<A.length;Ee>=65536?_e+=2:_e++){Ee=J(A,_e);let Te=De[Ee];!Te&&Qn(Ee)?(ie+=A[_e],Ee>=65536&&(ie+=A[_e+1])):ie+=Te||rr(Ee)}return ie}function fn(A,ie,Ee){let _e="",Te=A.tag;for(let Re=0,Se=Ee.length;Re<Se;Re+=1){let Ye=Ee[Re];A.replacer&&(Ye=A.replacer.call(Ee,String(Re),Ye)),(me(A,ie,Ye,!1,!1)||typeof Ye>"u"&&me(A,ie,null,!1,!1))&&(_e!==""&&(_e+=","+(A.condenseFlow?"":" ")),_e+=A.dump)}A.tag=Te,A.dump="["+_e+"]"}function Cr(A,ie,Ee,_e){let Te="",Re=A.tag;for(let Se=0,Ye=Ee.length;Se<Ye;Se+=1){let ze=Ee[Se];A.replacer&&(ze=A.replacer.call(Ee,String(Se),ze)),(me(A,ie+1,ze,!0,!0,!1,!0)||typeof ze>"u"&&me(A,ie+1,null,!0,!0,!1,!0))&&((!_e||Te!=="")&&(Te+=Rr(A,ie)),A.dump&&l===A.dump.charCodeAt(0)?Te+="-":Te+="- ",Te+=A.dump)}A.tag=Re,A.dump=Te||"[]"}function mu(A,ie,Ee){let _e="",Te=A.tag,Re=Object.keys(Ee);for(let Se=0,Ye=Re.length;Se<Ye;Se+=1){let ze="";_e!==""&&(ze+=", "),A.condenseFlow&&(ze+='"');let dt=Re[Se],ht=Ee[dt];A.replacer&&(ht=A.replacer.call(Ee,dt,ht)),me(A,ie,dt,!1,!1)&&(A.dump.length>1024&&(ze+="? "),ze+=A.dump+(A.condenseFlow?'"':"")+":"+(A.condenseFlow?"":" "),me(A,ie,ht,!1,!1)&&(ze+=A.dump,_e+=ze))}A.tag=Te,A.dump="{"+_e+"}"}function v(A,ie,Ee,_e){let Te="",Re=A.tag,Se=Object.keys(Ee);if(A.sortKeys===!0)Se.sort();else if(typeof A.sortKeys=="function")Se.sort(A.sortKeys);else if(A.sortKeys)throw new r("sortKeys must be a boolean or a function");for(let Ye=0,ze=Se.length;Ye<ze;Ye+=1){let dt="";(!_e||Te!=="")&&(dt+=Rr(A,ie));let ht=Se[Ye],pn=Ee[ht];if(A.replacer&&(pn=A.replacer.call(Ee,ht,pn)),!me(A,ie+1,ht,!0,!0,!0))continue;let yr=A.tag!==null&&A.tag!=="?"||A.dump&&A.dump.length>1024;yr&&(A.dump&&l===A.dump.charCodeAt(0)?dt+="?":dt+="? "),dt+=A.dump,yr&&(dt+=Rr(A,ie)),me(A,ie+1,pn,!0,yr)&&(A.dump&&l===A.dump.charCodeAt(0)?dt+=":":dt+=": ",dt+=A.dump,Te+=dt)}A.tag=Re,A.dump=Te||"{}"}function Q(A,ie,Ee){let _e=Ee?A.explicitTypes:A.implicitTypes;for(let Te=0,Re=_e.length;Te<Re;Te+=1){let Se=_e[Te];if((Se.instanceOf||Se.predicate)&&(!Se.instanceOf||typeof ie=="object"&&ie instanceof Se.instanceOf)&&(!Se.predicate||Se.predicate(ie))){if(Ee?Se.multi&&Se.representName?A.tag=Se.representName(ie):A.tag=Se.tag:A.tag="?",Se.represent){let Ye=A.styleMap[Se.tag]||Se.defaultStyle,ze;if(o.call(Se.represent)==="[object Function]")ze=Se.represent(ie,Ye);else if(a.call(Se.represent,Ye))ze=Se.represent[Ye](ie,Ye);else throw new r("!<"+Se.tag+'> tag resolver accepts not "'+Ye+'" style');A.dump=ze}return!0}}return!1}function me(A,ie,Ee,_e,Te,Re,Se){A.tag=null,A.dump=Ee,Q(A,Ee,!1)||Q(A,Ee,!0);let Ye=o.call(A.dump),ze=_e;_e&&(_e=A.flowLevel<0||A.flowLevel>ie);let dt=Ye==="[object Object]"||Ye==="[object Array]",ht,pn;if(dt&&(ht=A.duplicates.indexOf(Ee),pn=ht!==-1),(A.tag!==null&&A.tag!=="?"||pn||A.indent!==2&&ie>0)&&(Te=!1),pn&&A.usedDuplicates[ht])A.dump="*ref_"+ht;else{if(dt&&pn&&!A.usedDuplicates[ht]&&(A.usedDuplicates[ht]=!0),Ye==="[object Object]")_e&&Object.keys(A.dump).length!==0?(v(A,ie,A.dump,Te),pn&&(A.dump="&ref_"+ht+A.dump)):(mu(A,ie,A.dump),pn&&(A.dump="&ref_"+ht+" "+A.dump));else if(Ye==="[object Array]")_e&&A.dump.length!==0?(A.noArrayIndent&&!Se&&ie>0?Cr(A,ie-1,A.dump,Te):Cr(A,ie,A.dump,Te),pn&&(A.dump="&ref_"+ht+A.dump)):(fn(A,ie,A.dump),pn&&(A.dump="&ref_"+ht+" "+A.dump));else if(Ye==="[object String]")A.tag!=="?"&&et(A,A.dump,ie,Re,ze);else{if(Ye==="[object Undefined]")return!1;if(A.skipInvalid)return!1;throw new r("unacceptable kind of an object to dump "+Ye)}if(A.tag!==null&&A.tag!=="?"){let yr=encodeURI(A.tag[0]==="!"?A.tag.slice(1):A.tag).replace(/!/g,"%21");A.tag[0]==="!"?yr="!"+yr:yr.slice(0,18)==="tag:yaml.org,2002:"?yr="!!"+yr.slice(18):yr="!<"+yr+">",A.dump=yr+" "+A.dump}}return!0}function xe(A,ie){let Ee=[],_e=[];le(A,Ee,_e);let Te=_e.length;for(let Re=0;Re<Te;Re+=1)ie.duplicates.push(Ee[_e[Re]]);ie.usedDuplicates=new Array(Te)}function le(A,ie,Ee){if(A!==null&&typeof A=="object"){let _e=ie.indexOf(A);if(_e!==-1)Ee.indexOf(_e)===-1&&Ee.push(_e);else if(ie.push(A),Array.isArray(A))for(let Te=0,Re=A.length;Te<Re;Te+=1)le(A[Te],ie,Ee);else{let Te=Object.keys(A);for(let Re=0,Se=Te.length;Re<Se;Re+=1)le(A[Te[Re]],ie,Ee)}}}function Ie(A,ie){ie=ie||{};let Ee=new Pe(ie);Ee.noRefs||xe(A,Ee);let _e=A;return Ee.replacer&&(_e=Ee.replacer.call({"":_e},"",_e)),me(Ee,0,_e,!0,!0)?Ee.dump+`
346
- `:""}t.exports.dump=Ie})),_he=Fat(kr(((e,t)=>{var n=Wat(),r=qat();function i(o,a){return function(){throw new Error("Function yaml."+o+" is removed in js-yaml 4. Use yaml."+a+" instead, which is now safe by default.")}}t.exports.Type=da(),t.exports.Schema=the(),t.exports.FAILSAFE_SCHEMA=ohe(),t.exports.JSON_SCHEMA=lhe(),t.exports.CORE_SCHEMA=phe(),t.exports.DEFAULT_SCHEMA=fj(),t.exports.load=n.load,t.exports.loadAll=n.loadAll,t.exports.dump=r.dump,t.exports.YAMLException=Hw(),t.exports.types={binary:fhe(),float:uhe(),map:ihe(),null:ahe(),pairs:ghe(),set:yhe(),timestamp:dhe(),bool:she(),int:che(),merge:mhe(),omap:hhe(),seq:rhe(),str:nhe()},t.exports.safeLoad=i("safeLoad","load"),t.exports.safeLoadAll=i("safeLoadAll","loadAll"),t.exports.safeDump=i("safeDump","dump")}))(),1),{Type:M5n,Schema:N5n,FAILSAFE_SCHEMA:D5n,JSON_SCHEMA:$5n,CORE_SCHEMA:F5n,DEFAULT_SCHEMA:jat,load:Gat,loadAll:U5n,dump:W5n,YAMLException:q5n,types:j5n,safeLoad:G5n,safeLoadAll:B5n,safeDump:K5n}=_he.default,H5n=_he.default;import VWn from"better-sqlite3";var _st=[{pattern:/Physical interception|physical blocking|物理拦截/i,description:"Remove Physical interception / physical blocking / \u7269\u7406\u62E6\u622A references (AGENTS.md)",filenameSuffixes:["AGENTS.md"],actionType:"remove-line"},{pattern:/Single source of truth.*PLAN/i,description:"Remove Single source of truth PLAN references (AGENTS.md)",filenameSuffixes:["AGENTS.md"],actionType:"remove-line"},{pattern:/PLAN\.md` \(status: READY\)|PLAN\.md`(状态:READY)/,description:"Remove PLAN.md status: READY references (AGENTS.md, THINKING_OS.md)",filenameSuffixes:["AGENTS.md","THINKING_OS.md"],actionType:"remove-line"},{pattern:/project physical plan|项目物理计划/i,description:"Remove project physical plan / \u9879\u76EE\u7269\u7406\u8BA1\u5212 references (AGENTS.md)",filenameSuffixes:["AGENTS.md"],actionType:"remove-line"},{pattern:/L2 delegation.*(PLAN|gate|blocking)|L2 委派.*(PLAN|gate|拦截)/i,description:"Remove L2 delegation / L2 \u59D4\u6D3E tied to PLAN.md gate enforcement (AGENTS.md)",filenameSuffixes:["AGENTS.md"],actionType:"remove-line"},{pattern:/ or `PLAN\.md`/,description:'Replace "or PLAN.md" in T-02 PHYSICAL_MEMORY_PERSISTENCE (en)',filenameSuffixes:["THINKING_OS.md"],actionType:"replace",replacement:""},{pattern:/或 `PLAN\.md`/,description:'Replace "\u6216 PLAN.md" in T-02 PHYSICAL_MEMORY_PERSISTENCE (zh)',filenameSuffixes:["THINKING_OS.md"],actionType:"replace",replacement:""},{pattern:/PLAN\.md mechanism protects|PLAN\.md 机制保护/,description:"Remove PLAN.md mechanism protects / PLAN.md \u673A\u5236\u4FDD\u62A4 lines (MEMORY.md)",filenameSuffixes:["MEMORY.md"],actionType:"remove-line"},{pattern:/STATUS: READY|STATUS:READY/,description:"Remove STATUS: READY references (MEMORY.md)",filenameSuffixes:["MEMORY.md"],actionType:"remove-line"},{pattern:/Ensure `PLAN\.md` contains `## Target Files` heading|确保 `PLAN\.md` 包含 `## Target Files` 标题/,description:"Remove PLAN.md Target Files heading checks (admin/SKILL.md)",filenameSuffixes:["admin/SKILL.md"],actionType:"remove-line"},{pattern:/,\s*`PLAN\.md`\s*/,description:"Remove PLAN.md from list as trailing item (admin/SKILL.md, pd-grooming/SKILL.md)",filenameSuffixes:["admin/SKILL.md","pd-grooming/SKILL.md"],actionType:"replace",replacement:""},{pattern:/`PLAN\.md`\s*,\s*/,description:"Remove PLAN.md from list as leading item (admin/SKILL.md, pd-grooming/SKILL.md)",filenameSuffixes:["admin/SKILL.md","pd-grooming/SKILL.md"],actionType:"replace",replacement:""},{pattern:/Check `PLAN\.md` or early conversation/,description:"Replace Check PLAN.md or early conversation (en, reflection/SKILL.md)",filenameSuffixes:["reflection/SKILL.md"],actionType:"replace",replacement:"Check early conversation context"},{pattern:/Update `PLAN\.md`/,description:"Replace Update PLAN.md with Update memory/.scratchpad.md (en, reflection/SKILL.md)",filenameSuffixes:["reflection/SKILL.md"],actionType:"replace",replacement:"Update `memory/.scratchpad.md`"},{pattern:/检查 `PLAN\.md` 或早期对话/,description:"Replace Check PLAN.md or early conversation (zh, reflection/SKILL.md)",filenameSuffixes:["reflection/SKILL.md"],actionType:"replace",replacement:"\u68C0\u67E5\u65E9\u671F\u5BF9\u8BDD\u4E0A\u4E0B\u6587"},{pattern:/更新 `PLAN\.md`/,description:"Replace Update PLAN.md (zh, reflection/SKILL.md)",filenameSuffixes:["reflection/SKILL.md"],actionType:"replace",replacement:"\u66F4\u65B0 `memory/.scratchpad.md`"},{pattern:/, `PLAN\.md`, and /,description:"Remove PLAN.md from task descriptions (en, report/SKILL.md)",filenameSuffixes:["report/SKILL.md"],actionType:"replace",replacement:" and "},{pattern:/、`PLAN\.md` 和/,description:"Remove PLAN.md from task descriptions (zh, report/SKILL.md)",filenameSuffixes:["report/SKILL.md"],actionType:"replace",replacement:"\u548C"}],xst=_st.map(e=>({pattern:e.pattern,description:e.description}));import dqn from"better-sqlite3";import xqn from"better-sqlite3";var Sqn=7200*1e3;function $O(e,t){if(!e||typeof e!="string")return"";let n=e.replace(/\\/g,"/"),r=t.replace(/\\/g,"/"),i=n.length>=2&&n[1]===":",o=r.length>=2&&r[1]===":",a=n;i&&!o&&(a=`/mnt/${n.charAt(0).toLowerCase()}${n.slice(2)}`);let c=i&&o?a.slice(2):a,u=o?r.slice(2):r,l=c.startsWith("/"),d=u.startsWith("/");if(l&&d){let m=$he(u,c);return m.startsWith("../")?a:m}if(!l){let m=Gst(u,c),h=$he(u,m);return h.startsWith("../")?a:h}return a}function $he(e,t){let n=e.split("/").filter(u=>u.length>0),r=t.split("/").filter(u=>u.length>0),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;let o=n.length-i,a=r.slice(i),c=[];for(let u=0;u<o;u++)c.push("..");return c.push(...a),c.length===0?".":c.join("/")}function Gst(e,t){let n=e.split("/").filter(o=>o.length>0),r=t.split("/").filter(o=>o.length>0),i=[];for(let o of n)o===".."?i.length>0&&i.pop():o!=="."&&i.push(o);for(let o of r)o===".."?i.length>0&&i.pop():o!=="."&&i.push(o);return"/"+i.join("/")}function FO(e,t={}){let n=e.file_path||e.path||e.file||e.target;if(typeof n=="string"&&n.length>0)return n;if(t.isBashTool){let r=String(e.command||e.args||"");if(r){let i=/(?:>|>>|sed\s+-i|rm|mv|mkdir|touch|cp)\s+(?:-[a-zA-Z]+\s+)*([^\s;&|<>]+)/.exec(r);return i&&i[1]?i[1]:r}}return t.isWriteTool&&t.toolName?`<tool:${t.toolName}>`:null}function UO(e,t,n,r={}){let i=FO(t,{...r,toolName:e}),o=$O(i,n);return{toolName:e,normalizedPath:o,paramsSummary:{...t}}}var Fhe=s.Record(s.String(),s.Unknown()),Bst="^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$",Uhe=s.Union([s.Literal("shadow"),s.Literal("live")]),Whe=s.Union([s.Literal("allow"),s.Literal("block"),s.Literal("propose_correction")]),qhe=s.Union([s.Literal("negative"),s.Literal("positive")]),jhe=s.Object({caseId:s.String({minLength:1}),kind:qhe,toolName:s.String({minLength:1}),params:Fhe,expectedDecision:Whe,expectedProposedParams:s.Optional(Fhe),expectedApplicationMode:s.Optional(Uhe),sourceRefs:s.Optional(s.Object({painId:s.Optional(s.String({minLength:1})),candidateId:s.Optional(s.String({minLength:1})),artifactId:s.Optional(s.String({minLength:1})),auditEventId:s.Optional(s.String({minLength:1}))})),ruleContext:s.Optional(s.Unknown())}),Kst=s.Object({traceId:s.String({minLength:1}),sourcePainId:s.Optional(s.String({minLength:1})),sourceCandidateId:s.Optional(s.String({minLength:1})),sourceArtifactId:s.Optional(s.String({minLength:1})),cases:s.Array(jhe,{minItems:1}),createdAt:s.String({pattern:Bst}),version:s.Literal(1)});wi();function Yst(e,t){try{return Promise.resolve(t(Xhe))}catch(n){return Promise.reject(n)}}var Xhe={startSpan:Yst,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(Xhe);function ma(e){class t extends Error{_tag=e;constructor(r){super(r.message),this.name=e,Object.assign(this,r)}toJSON(){let r={};for(let i of Object.keys(this))i!=="_tag"&&(r[i]=this[i]);return{_tag:e,message:this.message,...r}}static is(r){return r instanceof t}}return t}var ege=class extends ma("LaneBusy"){},tge=class extends ma("MissingIdentities"){},nge=class extends ma("NoActiveRun"){},rge=class extends ma("NoActiveOperation"){},ige=class extends ma("NothingToResume"){},oge=class extends ma("InvalidMessage"){},age=class extends ma("UnknownSkill"){},sge=class extends ma("UnknownTemplate"){},cge=class extends ma("UnknownTarget"){},uge=class extends ma("UnknownQueueItem"){},lge=class extends ma("LaneExists"){},pge=class extends ma("InvalidLane"){},dge=class extends ma("NothingToCompact"){},mge=class extends ma("Closed"){};var Wdt=mo(aB(),1);var smt=mo(m0e(),1),cmt=mo(aB(),1);var umt=["before_run","before_resume","before_run_end","transform_context","before_request","before_payload","after_response","before_tool","after_tool","before_compaction","before_navigation"],lmt=["run_start","run_resume","run_suspend","run_abort","run_end","fault","handler_error","turn_start","turn_end","retry_scheduled","retry_start","retry_end","message_start","message_update","message_end","tool_start","tool_update","tool_end","entry_added","write_pending","queue_update","fact_update","config_update","compaction_start","compaction_end","navigation_start","navigation_end","lane_created","usage"],fB={"pi.session.id":{type:"string",required:!0,cardinality:"high",description:"Session id"},"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!0,cardinality:"high",description:"Durable operation id"},"pi.operation.recovery":{type:"boolean",required:!0,description:"Whether this invocation resumes durable work"}},hB={"pi.error.code":{type:"string",cardinality:"low",description:"Stable operation error code"},"pi.error.type":{type:"string",cardinality:"low",description:"Low-cardinality operation error class"}},pmt={version:1,spans:{"pi.harness.run":{description:"One admitted in-process run invocation",parents:{kind:"root_or_external"},startAttributes:{...fB,"pi.operation.kind":{type:"string",required:!0,values:["run"],description:"Run operation kind"}},endAttributes:{"pi.operation.outcome":{type:"string",values:["completed","aborted","failed","suspended"],description:"Run invocation outcome"},...hB},status:{default:"ok",errorWhen:"The run fails or throws"}},"pi.harness.compaction":{description:"One admitted in-process manual compaction invocation",parents:{kind:"root_or_external"},startAttributes:{...fB,"pi.operation.kind":{type:"string",required:!0,values:["compaction"],description:"Compaction operation kind"}},endAttributes:{"pi.operation.outcome":{type:"string",values:["completed","declined","aborted","failed"],description:"Compaction invocation outcome"},...hB},status:{default:"ok",errorWhen:"The compaction fails or throws"}},"pi.harness.navigation":{description:"One admitted in-process navigation invocation",parents:{kind:"root_or_external"},startAttributes:{...fB,"pi.operation.kind":{type:"string",required:!0,values:["navigation"],description:"Navigation operation kind"}},endAttributes:{"pi.operation.outcome":{type:"string",values:["completed","declined","aborted","failed"],description:"Navigation invocation outcome"},...hB},status:{default:"ok",errorWhen:"The navigation fails or throws"}},"pi.harness.checkpoint":{description:"One run checkpoint",parents:{kind:"spans",spans:["pi.harness.run"]},startAttributes:{"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!0,cardinality:"high",description:"Durable operation id"},"pi.checkpoint.kind":{type:"string",required:!0,values:["normal","failure_drain","abort_reconcile"],description:"Checkpoint purpose"}},endAttributes:{},status:{default:"ok",errorWhen:"Checkpoint work throws"}},"pi.harness.turn":{description:"One assistant response and its tool batch",parents:{kind:"spans",spans:["pi.harness.run"]},startAttributes:{"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!0,cardinality:"high",description:"Durable operation id"},"pi.turn.id":{type:"string",required:!0,cardinality:"high",description:"Invocation-local turn id"}},endAttributes:{},status:{default:"ok",errorWhen:"Turn work throws"}},"pi.harness.step":{description:"One durable retry attempt",parents:{kind:"spans",spans:["pi.harness.turn","pi.harness.checkpoint","pi.harness.compaction","pi.harness.navigation"]},startAttributes:{"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!0,cardinality:"high",description:"Durable operation id"},"pi.step.kind":{type:"string",required:!0,values:["assistant","compaction","branch_summary"],description:"Retryable step kind"},"pi.step.attempt":{type:"number",required:!0,description:"One-based durable attempt number"},"pi.compaction.reason":{type:"string",required:!1,values:["manual","threshold","overflow"],description:"Compaction trigger"}},endAttributes:{"pi.step.outcome":{type:"string",values:["succeeded","retry","failed","aborted","deferred","overflow"],description:"Attempt outcome"}},status:{default:"ok",errorWhen:"The attempt retries, fails, or throws"}},"pi.harness.tool":{description:"One raw phase-2 tool execution",parents:{kind:"spans",spans:["pi.harness.turn","pi.harness.run"]},startAttributes:{"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!0,cardinality:"high",description:"Durable operation id"},"pi.turn.id":{type:"string",required:!1,cardinality:"high",description:"Invocation-local live turn id"},"pi.tool.name":{type:"string",required:!0,description:"Tool name"},"pi.tool.call_id":{type:"string",required:!0,cardinality:"high",description:"Tool call id"},"pi.tool.replay":{type:"string",required:!0,values:["never","safe"],description:"Declared replay policy"},"pi.tool.recovery":{type:"boolean",required:!0,description:"Whether this is recovery execution"}},endAttributes:{"pi.tool.is_error":{type:"boolean",description:"Whether raw phase-2 execution returned an error"}},status:{default:"ok",errorWhen:"Raw phase-2 execution returns an error"}},"pi.harness.hook":{description:"One registered hook handler invocation",parents:{kind:"any"},startAttributes:{"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!1,cardinality:"high",description:"Durable operation id when accepted"},"pi.hook.name":{type:"string",required:!0,values:umt,description:"Hook name"},"pi.hook.registration_id":{type:"string",required:!1,description:"Stable hook registration id"}},endAttributes:{"pi.hook.outcome":{type:"string",values:["completed","skipped","blocked","failed"],description:"Handler outcome"}},status:{default:"ok",errorWhen:"The handler throws"}},"pi.harness.sleep":{description:"One retry delay",parents:{kind:"spans",spans:["pi.harness.step","pi.harness.run"]},startAttributes:{"pi.operation.id":{type:"string",required:!0,cardinality:"high",description:"Durable operation id"},"pi.sleep.delay_ms":{type:"number",required:!0,description:"Requested delay in milliseconds"}},endAttributes:{"pi.sleep.outcome":{type:"string",values:["elapsed","aborted"],description:"Delay outcome"}},status:{default:"ok",errorWhen:"Sleep work throws"}},"pi.harness.event_handler":{description:"One passive event listener invocation",parents:{kind:"any"},startAttributes:{"pi.event.type":{type:"string",required:!0,cardinality:"low",values:lmt,description:"Delivered harness event type"},"pi.lane.name":{type:"string",required:!1,cardinality:"high",description:"Lane name for lane-scoped events"}},endAttributes:{},status:{default:"ok",errorWhen:"The listener throws"}},"pi.session.write":{description:"One committed session mutation",parents:{kind:"any"},startAttributes:{"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!1,cardinality:"high",description:"Durable operation id when accepted"},"pi.session.mutation":{type:"string",required:!0,values:["entry","record","lane","fact"],description:"Session mutation kind"},"pi.session.item_type":{type:"string",required:!1,description:"Entry, record, lane, or fact subtype"}},endAttributes:{"pi.session.seq":{type:"number",description:"Committed session sequence when exposed"}},status:{default:"ok",errorWhen:"Storage rejects the mutation"}}}};var ABn=globalThis.Buffer;var UBn=2147483647/1e3;var WBn=fr.Object({command:fr.String({description:"Bash command to execute"}),timeout:fr.Optional(fr.Number({description:"Timeout in seconds (optional, no default timeout)"}))});var gmt=fr.Object({oldText:fr.String({description:"Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call."}),newText:fr.String({description:"Replacement text for this targeted edit."})},{}),i4n=fr.Object({path:fr.String({description:"Path to the file to edit (relative or absolute)"}),edits:fr.Array(gmt,{description:"One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead."})},{});var g4n=fr.Object({path:fr.String({description:"Path to the file to read (relative or absolute)"}),offset:fr.Optional(fr.Number({description:"Line number to start reading from (1-indexed)"})),limit:fr.Optional(fr.Number({description:"Maximum number of lines to read"}))});var w4n=fr.Object({path:fr.String({description:"Path to the file to write (relative or absolute)"}),content:fr.String({description:"Content to write to the file"})});var K={};On(K,{Assign:()=>ymt,Clone:()=>RT,Create:()=>Ift,Discard:()=>kft,Metrics:()=>cu,Update:()=>Eft});var cu={assign:0,create:0,clone:0,discard:0,update:0};function ymt(e,t){return cu.assign+=1,{...e,...t}}var S={};On(S,{Counted:()=>Dmt,Entries:()=>Umt,EntriesRegExp:()=>Fmt,Every:()=>Pmt,EveryAll:()=>Lmt,GraphemeCount:()=>Rmt,HasPropertyKey:()=>$mt,IsArray:()=>ST,IsBigInt:()=>ET,IsBoolean:()=>k0e,IsClassInstance:()=>Amt,IsConstructor:()=>wmt,IsDeepEqual:()=>xB,IsEqual:()=>un,IsFunction:()=>E0e,IsGreaterEqualThan:()=>A0e,IsGreaterThan:()=>kmt,IsInteger:()=>yB,IsLessEqualThan:()=>S0e,IsLessThan:()=>Emt,IsMaxLength:()=>Cmt,IsMinLength:()=>Omt,IsMultipleOf:()=>Smt,IsNull:()=>BP,IsNumber:()=>KP,IsObject:()=>AT,IsObjectNotArray:()=>Tmt,IsString:()=>HP,IsSymbol:()=>Imt,IsUndefined:()=>_B,IsUnsafePropertyKey:()=>C0e,IsValueLike:()=>R0e,Keys:()=>GP,ShiftLeft:()=>VP,Some:()=>Mmt,SomeAll:()=>Nmt,Symbols:()=>Wmt,Values:()=>qmt});function Rh(e,t,n){return e>=t&&e<=n}function _0e(e){return e===8205}function _mt(e){return Rh(e,55296,56319)}function g0e(e){return Rh(e,127462,127487)}function x0e(e){return Rh(e,65024,65039)}function v0e(e){return Rh(e,768,879)||Rh(e,6832,6911)||Rh(e,7616,7679)||Rh(e,65056,65071)}function jP(e){return e>65535?2:1}function y0e(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(v0e(n)||x0e(n))t+=jP(n);else break}return t}function gB(e,t){let n=e.codePointAt(t),r=t+jP(n);for(r=y0e(e,r);r<e.length-1&&_0e(e.codePointAt(r));){let i=e.codePointAt(r+1);r+=1+jP(i),r=y0e(e,r)}return g0e(n)&&r<e.length&&g0e(e.codePointAt(r))&&(r+=jP(e.codePointAt(r))),r}function b0e(e){return _mt(e)||v0e(e)||x0e(e)||_0e(e)}function w0e(e){let t=0,n=0;for(;n<e.length;)n=gB(e,n),t++;return t}function xmt(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=gB(e,r),n++,n>=t)return!0;return!1}function vmt(e,t){let n=0,r=0;for(;r<e.length;)if(r=gB(e,r),n++,n>t)return!1;return!0}function T0e(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(b0e(e.charCodeAt(n)))return xmt(e,t);if(n++,n>=t)return!0}return!1}function I0e(e,t){let n=0;for(;n<e.length;){if(b0e(e.charCodeAt(n)))return vmt(e,t);if(n++,n>t)return!1}return!0}function ST(e){return Array.isArray(e)}function ET(e){return un(typeof e,"bigint")}function k0e(e){return un(typeof e,"boolean")}function wmt(e){if(_B(e)||!E0e(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function E0e(e){return un(typeof e,"function")}function yB(e){return Number.isInteger(e)}function BP(e){return un(e,null)}function KP(e){return Number.isFinite(e)}function Tmt(e){return AT(e)&&!ST(e)}function AT(e){return un(typeof e,"object")&&!BP(e)}function HP(e){return un(typeof e,"string")}function Imt(e){return un(typeof e,"symbol")}function _B(e){return un(e,void 0)}function un(e,t){return e===t}function kmt(e,t){return e>t}function Emt(e,t){return e<t}function S0e(e,t){return e<=t}function A0e(e,t){return e>=t}function Smt(e,t){if(ET(e)||ET(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!KP(e)||yB(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 Amt(e){if(!AT(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return BP(t)?!1:un(typeof t.constructor,"function")&&!(un(t.constructor,globalThis.Object)||un(t.constructor.name,"Object"))}function R0e(e){return ET(e)||k0e(e)||BP(e)||KP(e)||HP(e)||_B(e)}function Rmt(e){return w0e(e)}function Cmt(e,t){return I0e(e,t)}function Omt(e,t){return T0e(e,t)}function Pmt(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function Lmt(e,t,n){let r=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(r=!1);return r}function Mmt(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function Nmt(e,t){let n=!1;for(let r=0;r<e.length;r++)t(e[r],r)&&(n=!0);return n}function Dmt(e,t){return e.reduce((n,r,i)=>t(r,i)?++n:n,0)}function VP(e,t,n){return un(e.length,0)?n():t(e[0],e.slice(1))}function C0e(e){return un(e,"__proto__")||un(e,"constructor")||un(e,"prototype")}function $mt(e,t){return C0e(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Fmt(e){return GP(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function Umt(e){return Object.entries(e)}function GP(e){return Object.getOwnPropertyNames(e)}function Wmt(e){return Object.getOwnPropertySymbols(e)}function qmt(e){return Object.values(e)}function jmt(e,t){if(!AT(t))return!1;let n=GP(e);return un(n.length,GP(t).length)&&n.every(r=>xB(e[r],t[r]))}function Gmt(e,t){return ST(t)&&un(e.length,t.length)&&e.every((n,r)=>xB(e[r],t[r]))}function xB(e,t){return ST(e)?Gmt(e,t):AT(e)?jmt(e,t):un(e,t)}var gm={};On(gm,{IsBigInt64Array:()=>ift,IsBigUint64Array:()=>oft,IsBoolean:()=>Kmt,IsDate:()=>sft,IsFloat32Array:()=>nft,IsFloat64Array:()=>rft,IsInt16Array:()=>Qmt,IsInt32Array:()=>eft,IsInt8Array:()=>Jmt,IsMap:()=>uft,IsNumber:()=>Hmt,IsRegExp:()=>aft,IsSet:()=>cft,IsString:()=>Vmt,IsTypeArray:()=>zmt,IsUint16Array:()=>Zmt,IsUint32Array:()=>tft,IsUint8Array:()=>Ymt,IsUint8ClampedArray:()=>Xmt});function Kmt(e){return e instanceof Boolean}function Hmt(e){return e instanceof Number}function Vmt(e){return e instanceof String}function zmt(e){return globalThis.ArrayBuffer.isView(e)}function Jmt(e){return e instanceof globalThis.Int8Array}function Ymt(e){return e instanceof globalThis.Uint8Array}function Xmt(e){return e instanceof globalThis.Uint8ClampedArray}function Qmt(e){return e instanceof globalThis.Int16Array}function Zmt(e){return e instanceof globalThis.Uint16Array}function eft(e){return e instanceof globalThis.Int32Array}function tft(e){return e instanceof globalThis.Uint32Array}function nft(e){return e instanceof globalThis.Float32Array}function rft(e){return e instanceof globalThis.Float64Array}function ift(e){return e instanceof globalThis.BigInt64Array}function oft(e){return e instanceof globalThis.BigUint64Array}function aft(e){return e instanceof globalThis.RegExp}function sft(e){return e instanceof globalThis.Date}function cft(e){return e instanceof globalThis.Set}function uft(e){return e instanceof globalThis.Map}function pft(e){return S.HasPropertyKey(e,"~kind")||S.HasPropertyKey(e,"~unsafe")}function dft(e){let t={};for(let n of S.Keys(e)){if(S.IsUnsafePropertyKey(n))continue;let r=Object.getOwnPropertyDescriptor(e,n);r.value=Ch(r.value),S.IsEqual(r.enumerable,!0)?t[n]=r.value:Object.defineProperty(t,n,r)}return t}function mft(e){let t={};for(let n of S.Keys(e))S.IsUnsafePropertyKey(n)||(t[n]=Ch(e[n]));for(let n of S.Symbols(e))t[n]=Ch(e[n]);return t}function fft(e){return S.IsClassInstance(e)?e:pft(e)?dft(e):mft(e)}function hft(e){return e.map(t=>Ch(t))}function gft(e){return e.slice()}function yft(e){return new RegExp(e.source,e.flags)}function _ft(e){return new Map(Ch([...e.entries()]))}function xft(e){return new Set(Ch([...e.values()]))}function Ch(e){return gm.IsTypeArray(e)?gft(e):gm.IsRegExp(e)?yft(e):gm.IsMap(e)?_ft(e):gm.IsSet(e)?xft(e):S.IsArray(e)?hft(e):S.IsObject(e)?fft(e):e}function RT(e){return cu.clone+=1,Ch(e)}var Sp={};On(Sp,{Get:()=>wft,Reset:()=>vft,Set:()=>bft});var nl={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function vft(){nl.immutableTypes=!1,nl.maxErrors=8,nl.maxInstantiationCount=128,nl.useAcceleration=!0,nl.exactOptionalPropertyTypes=!1,nl.enumerableKind=!1,nl.correctiveParse=!1,nl.unionPrioritySort=!0}function bft(e){for(let t of S.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(nl,t,{value:n})}}function wft(){return nl}function Tft(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 O0e(e,t){return{...e,...t}}function Ift(e,t,n={}){cu.create+=1;let r=Sp.Get(),i=O0e(t,n),o=r.enumerableKind?O0e(i,e):Tft(i,e);return r.immutableTypes?Object.freeze(o):o}function kft(e,t){cu.discard+=1;let n={};for(let r of S.Keys(e)){if(t.includes(r))continue;let i=Object.getOwnPropertyDescriptor(e,r);i.value=RT(i.value),Object.defineProperty(n,r,i)}return n}function Eft(e,t,n){cu.update+=1;let r=Sp.Get(),i=RT(e);for(let o of Object.keys(t))Object.defineProperty(i,o,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[o]});for(let o of Object.keys(n))Object.defineProperty(i,o,{configurable:!0,enumerable:!0,writable:!0,value:n[o]});return i}function Ze(e,t){return S.IsObject(e)&&S.HasPropertyKey(e,"~kind")&&S.IsEqual(e["~kind"],t)}function gi(e){return S.IsObject(e)}function at(e,t,n){return K.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function ym(e){return Ze(e,"Deferred")}function Sft(e){return K.Update(e,{"~readonly":!0},{})}function CT(e,t){return K.Update(Sft(e),{},t)}function P0e(e,t,n,r){let i=Me(e,t,n);return CT(i,r)}function Aft(e){return K.Update(e,{"~optional":!0},{})}function OT(e,t){return K.Update(Aft(e),{},t)}function L0e(e,t,n,r){let i=Me(e,t,n);return OT(i,r)}function ws(e,t){return K.Create({"~kind":"Array"},{type:"array",items:e},t)}function hr(e){return Ze(e,"Array")}function zP(e){return K.Discard(e,["~kind","type","items"])}function rl(e,t,n={}){return K.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function Li(e){return Ze(e,"Constructor")}function M0e(e){return K.Discard(e,["~kind","type","parameters","instanceType"])}function il(e,t,n={}){return K.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function Mi(e){return Ze(e,"Function")}function N0e(e){return K.Discard(e,["~kind","type","parameters","returnType"])}function Ap(e,t){return K.Create({"~kind":"Ref"},{$ref:e},t)}function Ni(e){return Ze(e,"Ref")}function _m(e,t){return K.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function gx(e){return Ze(e,"Generic")}function yx(e){return K.Create({"~kind":"Any"},{},e)}function Er(e){return Ze(e,"Any")}var D0e="(?!)";function Fn(e){return K.Create({"~kind":"Never"},{not:{}},e)}function uu(e){return Ze(e,"Never")}function ol(e,t={}){return at("AddOptional",[e],t)}function Oh(e,t={}){return OT(e,t)}function $0e(e){return Oh(e)}function Ao(e){return gi(e)&&S.HasPropertyKey(e,"~optional")}function F0e(e){return S.Keys(e).filter(t=>!Ao(e[t]))}function JP(e){return S.Keys(e)}function YP(e){return S.Values(e)}function St(e,t={}){let n=F0e(e),r=n.length>0?{required:n}:{};return K.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function Tn(e){return Ze(e,"Object")}function U0e(e){return K.Discard(e,["~kind","type","properties","required"])}function Ki(e){return K.Create({"~kind":"Unknown"},{},e)}function zr(e){return Ze(e,"Unknown")}function al(e,t,n){let r=S.Keys(e).reduce((i,o)=>({...i,[o]:K.Update(e[o],{},{$id:o})}),{});return K.Create({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function co(e){return Ze(e,"Cyclic")}function W0e(e){return K.Update(e,{"~unsafe":null},{})}function XP(e){return S.IsObjectNotArray(e)&&S.HasPropertyKey(e,"~unsafe")&&S.IsNull(e["~unsafe"])}var sl={};On(sl,{Match:()=>Rft});function Rft(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function PT(...e){let[t,n]=sl.Match(e,{2:(r,i)=>[r,i,i],1:r=>[r,Ki(),Ki()]});return K.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Jr(e){return Ze(e,"Infer")}function Ph(e,t,n,r={}){return K.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function Wr(e){return Ze(e,"Dependent")}function q0e(e){return K.Discard(e,["~kind","if","then","else"])}function j0e(e){return S.IsObjectNotArray(e)}function G0e(e){return S.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function B0e(e){return S.IsString(e)||S.IsNumber(e)}function K0e(e,t){let n=j0e(e)?G0e(e):e;return K.Create({"~kind":"Enum"},{enum:n},t)}function uo(e){return Ze(e,"Enum")}function fa(e,t={}){return K.Create({"~kind":"Intersect"},{allOf:e},t)}function Qt(e){return Ze(e,"Intersect")}function H0e(e){return K.Discard(e,["~kind","allOf"])}function yi(){throw new Error("Unreachable")}var V0e;(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"})(V0e||(V0e={}));var CHn=BigInt("14695981039346656037"),[OHn,PHn]=[BigInt("1099511628211"),BigInt("18446744073709551616")],LHn=Array.from({length:256}).map((e,t)=>BigInt(t)),z0e=new Float64Array(1),MHn=new DataView(z0e.buffer),NHn=new Uint8Array(z0e.buffer);var DHn=new TextEncoder;var LT=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=QP(n)?a=>this.decode(n["~codec"].decode(a)):this.decode,i=QP(n)?a=>n["~codec"].encode(t(a)):t,o={decode:r,encode:i};return K.Update(this.type,{"~codec":o},{})}},MT=class{constructor(t){this.type=t}Decode(t){return new LT(this.type,t)}};function ZP(e){return new MT(e)}function Y0e(e,t){return ZP(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function X0e(e,t){return ZP(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function QP(e){return gi(e)&&S.HasPropertyKey(e,"~codec")&&S.IsObject(e["~codec"])&&S.HasPropertyKey(e["~codec"],"encode")&&S.HasPropertyKey(e["~codec"],"decode")}function Q0e(e){return _x(e)}function Lh(e){return gi(e)&&S.HasPropertyKey(e,"~immutable")}function cl(e,t={}){return at("AddReadonly",[e],t)}function Mh(e,t={}){return CT(e,t)}function Z0e(e){return Mh(e)}function Nh(e){return gi(e)&&S.HasPropertyKey(e,"~readonly")}function Lft(e,t){let n=vB(e)?[...e["~refine"],t]:[t];return K.Update(e,{"~refine":n},{})}function exe(...e){let[t,n,r]=sl.Match(e,{3:(i,o,a)=>[i,o,a],2:(i,o)=>[i,o,()=>"Refine Error"]});return Lft(t,{check:n,error:r})}function Mft(e){return S.IsObjectNotArray(e)&&S.HasPropertyKey(e,"check")&&S.HasPropertyKey(e,"error")&&S.IsFunction(e.check)&&S.IsFunction(e.error)}function vB(e){return gi(e)&&S.HasPropertyKey(e,"~refine")&&S.IsArray(e["~refine"])&&S.Every(e["~refine"],0,t=>Mft(t))}var txe="-?(?:0|[1-9][0-9]*)n";function NT(e){return K.Create({"~kind":"BigInt"},{type:"bigint"},e)}function ul(e){return Ze(e,"BigInt")}function e1(e){return K.Create({"~kind":"Boolean"},{type:"boolean"},e)}function sc(e){return Ze(e,"Boolean")}function DT(e){return K.Create({"~kind":"Identifier"},{name:e})}function nxe(e){return Ze(e,"Identifier")}var t1="-?(?:0|[1-9][0-9]*)";function Dh(e){return K.Create({"~kind":"Integer"},{type:"integer"},e)}function Ho(e){return Ze(e,"Integer")}var bB=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function Nft(e){return S.IsBigInt(e)?"bigint":S.IsBoolean(e)?"boolean":S.IsNumber(e)?"number":S.IsString(e)?"string":(()=>{throw new bB(e)})()}function Zt(e,t){return K.Create({"~kind":"Literal"},{type:Nft(e),const:e},t)}function n1(e){return S.IsBigInt(e)||S.IsBoolean(e)||S.IsNumber(e)||S.IsString(e)}function rxe(e){return In(e)&&S.IsNumber(e.const)}function ixe(e){return In(e)&&S.IsString(e.const)}function In(e){return Ze(e,"Literal")}function xx(e){return K.Create({"~kind":"Null"},{type:"null"},e)}function vx(e){return Ze(e,"Null")}var r1="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Ba(e){return K.Create({"~kind":"Number"},{type:"number"},e)}function ai(e){return Ze(e,"Number")}function bx(e){return K.Create({"~kind":"Symbol"},{type:"symbol"},e)}function xm(e){return Ze(e,"Symbol")}function $h(...e){let[t,n,r]=sl.Match(e,{3:(i,o,a)=>[i,o,a],2:(i,o)=>[i,o,o],1:i=>[i,Ki(),Ki()]});return K.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function oxe(e){return Ze(e,"Parameter")}var i1=".*";function cc(e){return K.Create({"~kind":"String"},{type:"string"},e)}function Vo(e){return Ze(e,"String")}function Gt(e,t={}){return K.Create({"~kind":"Union"},{anyOf:e},t)}function rt(e){return Ze(e,"Union")}function axe(e){return K.Discard(e,["~kind","anyOf"])}function $T(e){let t=sxe(e);return S.IsEqual(t.length,2)?t[0]:[]}function Dft(e){return!0}function cxe(e){return S.ShiftLeft(e,(t,n)=>$ft(t)?cxe(n):!1,()=>!0)}function uxe(e){return S.IsEqual(e.length,0)?!1:cxe(e)}function $ft(e){return rt(e)?uxe(e.anyOf):In(e)?Dft(e.const):!1}function o1(e){return uxe(e)}function a1(e){return K.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function lxe(e,t,n=[]){return S.ShiftLeft(e,(r,i)=>lxe(i,t,[...n,`${r}${t}`]),()=>n)}function Fft(e,t){return S.IsEqual(e.length,0)?[`${t}`]:lxe(e,t)}function pxe(e,t,n=[]){return S.ShiftLeft(t,(r,i)=>pxe(e,i,[...n,...dxe(e,r)]),()=>n)}function dxe(e,t){return rt(t)?pxe(e,t.anyOf):In(t)?Fft(e,t.const):yi()}function mxe(e,t){return S.ShiftLeft(t,(n,r)=>mxe(dxe(e,n),r),()=>e)}function Uft(e){return e.map(t=>Zt(t))}function Wft(e){let t=mxe([],e),n=Uft(t);return Gt(n)}function qft(e){return S.IsEqual(e.length,0)?yi():S.IsEqual(e.length,1)&&In(e[0])?e[0]:Wft(e)}function wB(e){let t=$T(e);return S.IsEqual(t.length,0)?cc():o1(t)?qft(t):a1(e)}function fxe(e){let t=wB(e);return qr(t)?cc():t}function ha(e,t){let n="object",r={[e]:t};return K.Create({"~kind":"Record"},{type:n,patternProperties:r})}function hxe(e){return ha(lu,e)}function gxe(e){return St({true:e,false:e})}function si(e,t={}){let[n,r,i]=[e,e.length,!1];return K.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:r},t)}function Xn(e){return Ze(e,"Tuple")}function yxe(e){return K.Discard(e,["~kind","type","items","minItems","additionalItems"])}function jft(e){return K.Discard(e,["~readonly"])}function TB(e,t){return K.Update(jft(e),{},t)}function _xe(e,t,n,r){let i=Me(e,t,n);return TB(i,r)}function xxe(e,t={}){return at("RemoveReadonly",[e],t)}function vxe(e,t={}){return TB(e,t)}function Gft(e){return K.Discard(e,["~optional"])}function IB(e,t){return K.Update(Gft(e),{},t)}function bxe(e,t,n,r){let i=Me(e,t,n);return IB(i,r)}function wxe(e,t={}){return at("RemoveOptional",[e],t)}function s1(e,t={}){return IB(e,t)}function kB(e){return e.reduceRight((n,r,i)=>({[i]:r,...n}),{})}function Txe(e){let t=kB(e.items);return St(t)}function EB(e){return Tn(e)||Xn(e)}function Bft(e,t){return Nh(e)?!!Nh(t):!1}function Kft(e,t){return Ao(e)?!!Ao(t):!1}function Hft(e,t){let n=Bft(e,t),r=Kft(e,t),i=gr([e,t]),o=vxe(s1(i));return n&&r?Mh(Oh(o)):n&&!r?Mh(o):!n&&r?Oh(o):o}function Vft(e,t,n){return n in e?n in t?Hft(e[n],t[n]):e[n]:n in t?t[n]:Fn()}function zft(e,t){return[...new Set([...S.Keys(e),...S.Keys(t)])].reduce((i,o)=>({...i,[o]:Vft(e,t,o)}),{})}function Ixe(e){return Tn(e)?e.properties:Xn(e)?kB(e.items):{}}function kxe(e,t){let n=Ixe(e),r=Ixe(t),i=zft(n,r);return St(i)}function Jft(e,t){let n=WT(e,t);return S.IsEqual(n,UT)?e:S.IsEqual(n,c1)||S.IsEqual(n,FT)?t:Fn()}function Yft(e,t){let n=EB(e),r=EB(t);return n&&r?kxe(e,t):n&&!r?e:!n&&r?t:Jft(e,t)}function Exe(e,t){return uu(e)||Er(e)?e:zr(e)||uu(t)||Er(t)?t:zr(t)?e:Yft(e,t)}function Xft(e,t){return rt(e)||rt(t)}function Qft(e,t){let n=uc(e),r=uc(t);return Xft(n,r)?gr([n,r]):Exe(n,r)}function Sxe(e,t,n=[]){return S.ShiftLeft(t,(r,i)=>Sxe(e,i,[...n,Qft(r,e)]),()=>S.IsEqual(n.length,0)?[e]:n)}function Axe(e,t,n=[]){return S.ShiftLeft(e,(r,i)=>Axe(i,t,[...n,...qT([r],t)]),()=>n)}function qT(e,t=[]){return S.ShiftLeft(e,(n,r)=>rt(n)?qT(r,Axe(n.anyOf,t)):qT(r,Sxe(n,t)),()=>t)}function Zft(e,t){let n=lo({},e,t);return At.IsExtendsTrueLike(n)?[]:[e]}function Rxe(e,t,n=[]){return S.ShiftLeft(e,(r,i)=>Rxe(i,t,[...n,...Zft(r,t)]),()=>n)}function u1(e,t){let n=uc(e),r=rt(n)?n.anyOf:[n],i=Rxe(r,t);return ga(i)}function pu(e,t,n){let r=gr([e,t]),i=u1(n,e);return ga([r,i])}function zo(e,t=[]){return S.ShiftLeft(e,(n,r)=>zo(r,[...t,Zt(n)]),()=>ga(t))}function gr(e){let t=qT(e),n=SB(t);return ga(n)}function Ro(e){let t=fxe(e);return uc(t)}function ga(e){let t=SB(e);return vm(t)}function uc(e){return Wr(e)?pu(e.if,e.then,e.else):uo(e)?zo(e.enum):Qt(e)?gr(e.allOf):qr(e)?Ro(e.pattern):rt(e)?ga(e.anyOf):e}function vm(e){return S.IsEqual(e.length,1)?e[0]:S.IsEqual(e.length,0)?Fn():Gt(e)}function Cxe(e,t){let n=zo(e);return bm(n,t)}function Oxe(e,t){return ha(wm,t)}function Pxe(e,t){let n=gr(e);return bm(n,t)}function Lxe(e,t){return S.IsString(e)||S.IsNumber(e)?St({[e]:t}):S.IsEqual(e,!1)?St({false:t}):S.IsEqual(e,!0)?St({true:t}):St({})}function Mxe(e,t){return ha(wx,t)}function Nxe(e,t){return S.HasPropertyKey(e,"pattern")&&(S.IsString(e.pattern)||e.pattern instanceof RegExp)?ha(e.pattern.toString(),t):ha(lu,t)}function Dxe(e,t){let n=$T(e);return o1(n)?bm(Ro(e),t):ha(e,t)}function eht(e){return rt(e)?Tx(e.anyOf):[e]}function Tx(e,t=[]){return S.ShiftLeft(e,(n,r)=>Tx(r,[...t,...eht(n)]),()=>t)}function tht(e){return e.some(t=>Vo(t)||ai(t)||Ho(t))}function nht(e,t){return S.IsEqual(tht(e),!0)?ha(lu,t):void 0}function rht(e,t){return e.reduce((n,r)=>In(r)&&(S.IsString(r.const)||S.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function iht(e,t){let n=rht(e,t);return St(n)}function $xe(e,t){let n=Tx(e),r=nht(n,t);return gi(r)?r:iht(n,t)}function bm(e,t){return Er(e)?hxe(t):sc(e)?gxe(t):uo(e)?Cxe(e.enum,t):Ho(e)?Oxe(e,t):Qt(e)?Pxe(e.allOf,t):In(e)?Lxe(e.const,t):ai(e)?Mxe(e,t):rt(e)?$xe(e.anyOf,t):Vo(e)?Nxe(e,t):qr(e)?Dxe(e.pattern,t):St({})}function AB(e,t,n){return $t([e])?K.Update(bm(e,t),{},n):l1(e,t,n)}function Fxe(e,t,n,r,i){let o=Me(e,t,n),a=Me(e,t,r);return AB(o,a,i)}var wm=`^${t1}$`,wx=`^${r1}$`,lu=`^${i1}$`;function l1(e,t,n={}){return at("Record",[e,t],n)}function p1(e,t,n={}){return AB(e,t,n)}function Uxe(e,t){return ha(e,t)}function d1(e){return S.IsEqual(e,lu)?cc():S.IsEqual(e,wm)?Dh():S.IsEqual(e,wx)?Ba():wB(e)}function lc(e){return S.Keys(e.patternProperties)[0]}function Ix(e){let t=lc(e);return d1(t)}function Jo(e){return e.patternProperties[lc(e)]}function po(e){return Ze(e,"Record")}function Fh(e){return K.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function Tm(e){return Ze(e,"Rest")}function m1(e){return K.Create({"~kind":"This"},{$ref:"#"},e)}function f1(e){return Ze(e,"This")}function kx(e){return K.Create({"~kind":"Undefined"},{type:"undefined"},e)}function Ex(e){return Ze(e,"Undefined")}function h1(e){return K.Create({"~kind":"Void"},{type:"void"},e)}function ll(e){return Ze(e,"Void")}function aht(e,t){return S.IsEqual(e,"Array")?ws(t[0]):S.IsEqual(e,"Capitalize")?y1(t[0]):S.IsEqual(e,"ConstructorParameters")?w1(t[0]):S.IsEqual(e,"Evaluate")?Wbe(t[0]):S.IsEqual(e,"Exclude")?T1(t[0],t[1]):S.IsEqual(e,"Extract")?I1(t[0],t[1]):S.IsEqual(e,"Index")?KT(t[0],t[1]):S.IsEqual(e,"InstanceType")?k1(t[0]):S.IsEqual(e,"Lowercase")?_1(t[0]):S.IsEqual(e,"NonNullable")?E1(t[0]):S.IsEqual(e,"Omit")?S1(t[0],t[1]):S.IsEqual(e,"Parameters")?A1(t[0]):S.IsEqual(e,"Partial")?R1(t[0]):S.IsEqual(e,"Pick")?C1(t[0],t[1]):S.IsEqual(e,"Readonly")?O1(t[0]):S.IsEqual(e,"KeyOf")?HT(t[0]):S.IsEqual(e,"Record")?l1(t[0],t[1]):S.IsEqual(e,"Required")?P1(t[0]):S.IsEqual(e,"ReturnType")?L1(t[0]):S.IsEqual(e,"Uncapitalize")?x1(t[0]):S.IsEqual(e,"Uppercase")?v1(t[0]):BT(Ap(e),t)}function Uh(){throw Error("Unreachable")}function Bxe(e,t=[]){return S.ShiftLeft(e,(n,r)=>Bxe(r,[...t,n[1]]),()=>t)}function Rp(e){return S.IsEqual(e.length,3)?[e[0],...Bxe(e[1])]:[]}function Kxe(e){return $h(e[0],e[2],e[4])}function Hxe(e){return $h(e[0],e[2],e[2])}function Vxe(e){return $h(e[0],Ki(),e[2])}function zxe(e){return $h(e,Ki(),Ki())}function Jxe(e){return Rp(e)}function Yxe(e){return e[1]}function Xxe(e){return Rp(e)}function Qxe(e){return e[1]}function Zxe(e){return aht(e[0],e[1])}function eve(e){return null}function tve(e){return cc()}function nve(e){return Ba()}function rve(e){return e1()}function ive(e){return kx()}function ove(e){return xx()}function ave(e){return Dh()}function sve(e){return NT()}function cve(e){return Ki()}function uve(e){return yx()}function lve(e){return St({})}function pve(e){return Fn()}function dve(e){return bx()}function mve(e){return h1()}function fve(e){return m1()}function hve(e){return Zt(BigInt(e))}function gve(e){return Zt(S.IsEqual(e,"true"))}function yve(e){return Zt(parseFloat(e))}function _ve(e){return Zt(e)}function xve(e){return e[1]}function vve(e){return Zt(e)}function bve(e){return S.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function wve(e){return e[1]}function Tve(e){return g1(e)}function Ive(e){return S.IsEqual(e.length,6)?Ph(e[1],e[3],e[5]):Ph(e[1],e[3],Ki())}function kve(e){return e.length>0}function Eve(e){return e.reduce((t,n)=>S.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function Sve(e){return S.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Ave(e){return S.IsArray(e)&&S.IsEqual(e.length,3)?e[1]:e}function Rve(e){return S.IsEqual(e.length,2)?e[1]:[]}function Wxe(e,t){return t.reduce((n,r)=>{let i=r;return S.IsEqual(i.length,1)?KT(n,i[0]):S.IsEqual(i.length,0)?ws(n):Uh()},e)}function qxe(e,t){return S.IsEqual(t.length,3)?b1(e,t[0],t[1],t[2]):e}function sht(e,t){return S.IsArray(t)&&S.IsEqual(t.length,0)?e:M1(e,t)}function Cve(e){let[t,n,r,i,o]=e;return sht(qxe(t?HT(Wxe(n,r)):Wxe(n,r),i),o)}function RB(e,t){return S.IsEqual(t.length,3)?(()=>{let[n,r,i]=t,o=RB(r,i);if(S.IsEqual(n,"&"))return Qt(o)?fa([e,...o.allOf]):fa([e,o]);if(S.IsEqual(n,"|"))return rt(o)?Gt([e,...o.anyOf]):Gt([e,o]);Uh()})():e}function Ove(e){let[t,n]=e;return RB(t,n)}function Pve(e){let[t,n]=e;return RB(t,n)}function Lve(e){return Ube(e[1])}function Mve(e){return e[1]}function Nve(e){return _m(e[0],e[2])}function Dve(e){return S.IsEqual(e.length,4)?PT(e[1],e[3]):S.IsEqual(e.length,2)?PT(e[1],Ki()):Uh()}function $ve(e){return`${e}`}function Fve(e){return Ho(e[3])?wm:ai(e[3])?wx:xm(e[3])?lu:Vo(e[3])?lu:Uh()}function Uve(e){return e.length>0}function Wve(e){return e.length>0}function qve(e){let[t,n,r,i,o]=e;return{[n]:t&&r?cl(ol(o)):t&&!r?cl(o):!t&&r?ol(o):o}}function jve(e){return Rp(e)}function Gve(e){return e.reduce((t,n)=>S.HasPropertyKey(n,wm)||S.HasPropertyKey(n,wx)||S.HasPropertyKey(n,lu)?[t[0],K.Assign(t[1],n)]:[K.Assign(t[0],n),t[1]],[{},{}])}function Bve(e){return Gve(e[1])}function Kve(e){let[t,n]=e,r=S.IsEqual(S.Keys(n).length,0)?{}:{patternProperties:n};return St(t,r)}function Hve(e){return S.IsEqual(e.length,5)?cl(ol(e[4])):S.IsEqual(e.length,3)?e[2]:S.IsEqual(e.length,4)?S.IsEqual(e[2],"readonly")?cl(e[3]):ol(e[3]):Uh()}function Vve(e){if(!S.IsArray(e)||!S.IsEqual(e.length,3))return e;let[t,n,r]=e;return t&&r?cl(ol(n)):t&&!r?cl(n):!t&&r?ol(n):n}function zve(e){return S.IsEqual(e.length,2)?Fh(e[1]):S.IsEqual(e.length,1)?e[0]:Uh()}function Jve(e){return Rp(e)}function Yve(e){return si(e[1])}function Xve(e){return cl(ol(e[4]))}function Qve(e){return cl(e[3])}function Zve(e){return ol(e[3])}function ebe(e){return e[2]}function tbe(e){return S.IsEqual(e.length,2)?Fh(e[1]):S.IsEqual(e.length,1)?e[0]:Uh()}function nbe(e){return Rp(e)}function rbe(e){return il(e[1],e[4])}function ibe(e){return rl(e[2],e[5])}function jxe(e,t){return S.IsEqual(e,"remove")?xxe(t):S.IsEqual(e,"add")?cl(t):t}function obe(e){return S.IsEqual(e.length,2)&&S.IsEqual(e[0],"-")?"remove":S.IsEqual(e.length,2)&&S.IsEqual(e[0],"+")||S.IsEqual(e.length,1)?"add":"none"}function Gxe(e,t){return S.IsEqual(e,"remove")?wxe(t):S.IsEqual(e,"add")?ol(t):t}function abe(e){return S.IsEqual(e.length,2)&&S.IsEqual(e[0],"-")?"remove":S.IsEqual(e.length,2)&&S.IsEqual(e[0],"+")||S.IsEqual(e.length,1)?"add":"none"}function sbe(e){return S.IsEqual(e.length,2)?[e[1]]:[]}function cbe(e){return S.IsArray(e[6])&&S.IsEqual(e[6].length,1)?jT(DT(e[3]),e[5],e[6][0],jxe(e[1],Gxe(e[8],e[10]))):jT(DT(e[3]),e[5],Ap(e[3]),jxe(e[1],Gxe(e[8],e[10])))}function ube(e){return Ap(e)}function lbe(e){return BigInt(e)}function pbe(e){return parseFloat(e)}function dbe(e){return S.IsEqual(e,"true")}function mbe(e){return null}function fbe(e){return{[e[0]]:e[2]}}function hbe(e){return Rp(e)}function cht(e){return e.reduce((t,n)=>K.Assign(t,n),{})}function gbe(e){return cht(e[1])}function ybe(e){return Rp(e)}function _be(e){return e[1]}function xbe(e){return NT()}function vbe(e){return cc()}function bbe(e){return Ba()}function wbe(e){return Dh()}function Tbe(e){return Fn()}function Ibe(e){return Zt(e)}function kbe(e){return Gt(e[1])}function Ebe(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Sbe(e){return[e[0],...e[1]]}function Abe(e){return e[1]}function Rbe(e){return Rp(e)}function Cbe(e){return S.IsEqual(e.length,2)?e[1]:[]}function Obe(e){let t=e[2],n=e[3],[r,i]=e[4],o=S.IsEqual(S.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:_m(t,GT(n,r,o))}}function Pbe(e){let t=e[2],[n,r]=e[3],i=S.IsEqual(S.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:GT(t,n,i)}}function Lbe(e){return{[e[1]]:_m(e[2],e[4])}}function Mbe(e){return{[e[1]]:e[3]}}function Nbe(e){return null}function Dbe(e){return Rp(e)}function $be(e){return e[1]}function Fbe(e){let[t,n]=[e[0],e[1]];return qbe(K.Assign(t,Gve(n)[0]))}function VT(e){return un(e.length,2)}function zt(e,t,n){return VT(e)?t(e[0],e[1]):n()}function pht(e,t){return un(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function Sr(e,t){for(let n=0;n<e.length;n++){let r=pht(e[n],t);if(VT(r))return r}return[]}function CB(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var jbe=[...CB(97,122),...CB(65,90)],OB="0",PB=CB(49,57),Sx=[OB,...PB],Gbe=" ",Ax=`
346
+ `:""}t.exports.dump=Ie})),_he=Fat(kr(((e,t)=>{var n=Wat(),r=qat();function i(o,a){return function(){throw new Error("Function yaml."+o+" is removed in js-yaml 4. Use yaml."+a+" instead, which is now safe by default.")}}t.exports.Type=da(),t.exports.Schema=the(),t.exports.FAILSAFE_SCHEMA=ohe(),t.exports.JSON_SCHEMA=lhe(),t.exports.CORE_SCHEMA=phe(),t.exports.DEFAULT_SCHEMA=fj(),t.exports.load=n.load,t.exports.loadAll=n.loadAll,t.exports.dump=r.dump,t.exports.YAMLException=Hw(),t.exports.types={binary:fhe(),float:uhe(),map:ihe(),null:ahe(),pairs:ghe(),set:yhe(),timestamp:dhe(),bool:she(),int:che(),merge:mhe(),omap:hhe(),seq:rhe(),str:nhe()},t.exports.safeLoad=i("safeLoad","load"),t.exports.safeLoadAll=i("safeLoadAll","loadAll"),t.exports.safeDump=i("safeDump","dump")}))(),1),{Type:M5n,Schema:N5n,FAILSAFE_SCHEMA:D5n,JSON_SCHEMA:$5n,CORE_SCHEMA:F5n,DEFAULT_SCHEMA:jat,load:Gat,loadAll:U5n,dump:W5n,YAMLException:q5n,types:j5n,safeLoad:G5n,safeLoadAll:B5n,safeDump:K5n}=_he.default,H5n=_he.default;import VWn from"better-sqlite3";var _st=[{pattern:/Physical interception|physical blocking|物理拦截/i,description:"Remove Physical interception / physical blocking / \u7269\u7406\u62E6\u622A references (AGENTS.md)",filenameSuffixes:["AGENTS.md"],actionType:"remove-line"},{pattern:/Single source of truth.*PLAN/i,description:"Remove Single source of truth PLAN references (AGENTS.md)",filenameSuffixes:["AGENTS.md"],actionType:"remove-line"},{pattern:/PLAN\.md` \(status: READY\)|PLAN\.md`(状态:READY)/,description:"Remove PLAN.md status: READY references (AGENTS.md, THINKING_OS.md)",filenameSuffixes:["AGENTS.md","THINKING_OS.md"],actionType:"remove-line"},{pattern:/project physical plan|项目物理计划/i,description:"Remove project physical plan / \u9879\u76EE\u7269\u7406\u8BA1\u5212 references (AGENTS.md)",filenameSuffixes:["AGENTS.md"],actionType:"remove-line"},{pattern:/L2 delegation.*(PLAN|gate|blocking)|L2 委派.*(PLAN|gate|拦截)/i,description:"Remove L2 delegation / L2 \u59D4\u6D3E tied to PLAN.md gate enforcement (AGENTS.md)",filenameSuffixes:["AGENTS.md"],actionType:"remove-line"},{pattern:/ or `PLAN\.md`/,description:'Replace "or PLAN.md" in T-02 PHYSICAL_MEMORY_PERSISTENCE (en)',filenameSuffixes:["THINKING_OS.md"],actionType:"replace",replacement:""},{pattern:/或 `PLAN\.md`/,description:'Replace "\u6216 PLAN.md" in T-02 PHYSICAL_MEMORY_PERSISTENCE (zh)',filenameSuffixes:["THINKING_OS.md"],actionType:"replace",replacement:""},{pattern:/PLAN\.md mechanism protects|PLAN\.md 机制保护/,description:"Remove PLAN.md mechanism protects / PLAN.md \u673A\u5236\u4FDD\u62A4 lines (MEMORY.md)",filenameSuffixes:["MEMORY.md"],actionType:"remove-line"},{pattern:/STATUS: READY|STATUS:READY/,description:"Remove STATUS: READY references (MEMORY.md)",filenameSuffixes:["MEMORY.md"],actionType:"remove-line"},{pattern:/Ensure `PLAN\.md` contains `## Target Files` heading|确保 `PLAN\.md` 包含 `## Target Files` 标题/,description:"Remove PLAN.md Target Files heading checks (admin/SKILL.md)",filenameSuffixes:["admin/SKILL.md"],actionType:"remove-line"},{pattern:/,\s*`PLAN\.md`\s*/,description:"Remove PLAN.md from list as trailing item (admin/SKILL.md, pd-grooming/SKILL.md)",filenameSuffixes:["admin/SKILL.md","pd-grooming/SKILL.md"],actionType:"replace",replacement:""},{pattern:/`PLAN\.md`\s*,\s*/,description:"Remove PLAN.md from list as leading item (admin/SKILL.md, pd-grooming/SKILL.md)",filenameSuffixes:["admin/SKILL.md","pd-grooming/SKILL.md"],actionType:"replace",replacement:""},{pattern:/Check `PLAN\.md` or early conversation/,description:"Replace Check PLAN.md or early conversation (en, reflection/SKILL.md)",filenameSuffixes:["reflection/SKILL.md"],actionType:"replace",replacement:"Check early conversation context"},{pattern:/Update `PLAN\.md`/,description:"Replace Update PLAN.md with Update memory/.scratchpad.md (en, reflection/SKILL.md)",filenameSuffixes:["reflection/SKILL.md"],actionType:"replace",replacement:"Update `memory/.scratchpad.md`"},{pattern:/检查 `PLAN\.md` 或早期对话/,description:"Replace Check PLAN.md or early conversation (zh, reflection/SKILL.md)",filenameSuffixes:["reflection/SKILL.md"],actionType:"replace",replacement:"\u68C0\u67E5\u65E9\u671F\u5BF9\u8BDD\u4E0A\u4E0B\u6587"},{pattern:/更新 `PLAN\.md`/,description:"Replace Update PLAN.md (zh, reflection/SKILL.md)",filenameSuffixes:["reflection/SKILL.md"],actionType:"replace",replacement:"\u66F4\u65B0 `memory/.scratchpad.md`"},{pattern:/, `PLAN\.md`, and /,description:"Remove PLAN.md from task descriptions (en, report/SKILL.md)",filenameSuffixes:["report/SKILL.md"],actionType:"replace",replacement:" and "},{pattern:/、`PLAN\.md` 和/,description:"Remove PLAN.md from task descriptions (zh, report/SKILL.md)",filenameSuffixes:["report/SKILL.md"],actionType:"replace",replacement:"\u548C"}],xst=_st.map(e=>({pattern:e.pattern,description:e.description}));import pqn from"better-sqlite3";import _qn from"better-sqlite3";var Eqn=7200*1e3;function $O(e,t){if(!e||typeof e!="string")return"";let n=e.replace(/\\/g,"/"),r=t.replace(/\\/g,"/"),i=n.length>=2&&n[1]===":",o=r.length>=2&&r[1]===":",a=n;i&&!o&&(a=`/mnt/${n.charAt(0).toLowerCase()}${n.slice(2)}`);let c=i&&o?a.slice(2):a,u=o?r.slice(2):r,l=c.startsWith("/"),d=u.startsWith("/");if(l&&d){let m=$he(u,c);return m.startsWith("../")?a:m}if(!l){let m=Gst(u,c),h=$he(u,m);return h.startsWith("../")?a:h}return a}function $he(e,t){let n=e.split("/").filter(u=>u.length>0),r=t.split("/").filter(u=>u.length>0),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;let o=n.length-i,a=r.slice(i),c=[];for(let u=0;u<o;u++)c.push("..");return c.push(...a),c.length===0?".":c.join("/")}function Gst(e,t){let n=e.split("/").filter(o=>o.length>0),r=t.split("/").filter(o=>o.length>0),i=[];for(let o of n)o===".."?i.length>0&&i.pop():o!=="."&&i.push(o);for(let o of r)o===".."?i.length>0&&i.pop():o!=="."&&i.push(o);return"/"+i.join("/")}function FO(e,t={}){let n=e.file_path||e.path||e.file||e.target;if(typeof n=="string"&&n.length>0)return n;if(t.isBashTool){let r=String(e.command||e.args||"");if(r){let i=/(?:>|>>|sed\s+-i|rm|mv|mkdir|touch|cp)\s+(?:-[a-zA-Z]+\s+)*([^\s;&|<>]+)/.exec(r);return i&&i[1]?i[1]:r}}return t.isWriteTool&&t.toolName?`<tool:${t.toolName}>`:null}function UO(e,t,n,r={}){let i=FO(t,{...r,toolName:e}),o=$O(i,n);return{toolName:e,normalizedPath:o,paramsSummary:{...t}}}var Fhe=s.Record(s.String(),s.Unknown()),Bst="^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?Z$",Uhe=s.Union([s.Literal("shadow"),s.Literal("live")]),Whe=s.Union([s.Literal("allow"),s.Literal("block"),s.Literal("propose_correction")]),qhe=s.Union([s.Literal("negative"),s.Literal("positive")]),jhe=s.Object({caseId:s.String({minLength:1}),kind:qhe,toolName:s.String({minLength:1}),params:Fhe,expectedDecision:Whe,expectedProposedParams:s.Optional(Fhe),expectedApplicationMode:s.Optional(Uhe),sourceRefs:s.Optional(s.Object({painId:s.Optional(s.String({minLength:1})),candidateId:s.Optional(s.String({minLength:1})),artifactId:s.Optional(s.String({minLength:1})),auditEventId:s.Optional(s.String({minLength:1}))})),ruleContext:s.Optional(s.Unknown())}),Kst=s.Object({traceId:s.String({minLength:1}),sourcePainId:s.Optional(s.String({minLength:1})),sourceCandidateId:s.Optional(s.String({minLength:1})),sourceArtifactId:s.Optional(s.String({minLength:1})),cases:s.Array(jhe,{minItems:1}),createdAt:s.String({pattern:Bst}),version:s.Literal(1)});wi();function Yst(e,t){try{return Promise.resolve(t(Xhe))}catch(n){return Promise.reject(n)}}var Xhe={startSpan:Yst,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(Xhe);function ma(e){class t extends Error{_tag=e;constructor(r){super(r.message),this.name=e,Object.assign(this,r)}toJSON(){let r={};for(let i of Object.keys(this))i!=="_tag"&&(r[i]=this[i]);return{_tag:e,message:this.message,...r}}static is(r){return r instanceof t}}return t}var ege=class extends ma("LaneBusy"){},tge=class extends ma("MissingIdentities"){},nge=class extends ma("NoActiveRun"){},rge=class extends ma("NoActiveOperation"){},ige=class extends ma("NothingToResume"){},oge=class extends ma("InvalidMessage"){},age=class extends ma("UnknownSkill"){},sge=class extends ma("UnknownTemplate"){},cge=class extends ma("UnknownTarget"){},uge=class extends ma("UnknownQueueItem"){},lge=class extends ma("LaneExists"){},pge=class extends ma("InvalidLane"){},dge=class extends ma("NothingToCompact"){},mge=class extends ma("Closed"){};var Wdt=mo(aB(),1);var smt=mo(m0e(),1),cmt=mo(aB(),1);var umt=["before_run","before_resume","before_run_end","transform_context","before_request","before_payload","after_response","before_tool","after_tool","before_compaction","before_navigation"],lmt=["run_start","run_resume","run_suspend","run_abort","run_end","fault","handler_error","turn_start","turn_end","retry_scheduled","retry_start","retry_end","message_start","message_update","message_end","tool_start","tool_update","tool_end","entry_added","write_pending","queue_update","fact_update","config_update","compaction_start","compaction_end","navigation_start","navigation_end","lane_created","usage"],fB={"pi.session.id":{type:"string",required:!0,cardinality:"high",description:"Session id"},"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!0,cardinality:"high",description:"Durable operation id"},"pi.operation.recovery":{type:"boolean",required:!0,description:"Whether this invocation resumes durable work"}},hB={"pi.error.code":{type:"string",cardinality:"low",description:"Stable operation error code"},"pi.error.type":{type:"string",cardinality:"low",description:"Low-cardinality operation error class"}},pmt={version:1,spans:{"pi.harness.run":{description:"One admitted in-process run invocation",parents:{kind:"root_or_external"},startAttributes:{...fB,"pi.operation.kind":{type:"string",required:!0,values:["run"],description:"Run operation kind"}},endAttributes:{"pi.operation.outcome":{type:"string",values:["completed","aborted","failed","suspended"],description:"Run invocation outcome"},...hB},status:{default:"ok",errorWhen:"The run fails or throws"}},"pi.harness.compaction":{description:"One admitted in-process manual compaction invocation",parents:{kind:"root_or_external"},startAttributes:{...fB,"pi.operation.kind":{type:"string",required:!0,values:["compaction"],description:"Compaction operation kind"}},endAttributes:{"pi.operation.outcome":{type:"string",values:["completed","declined","aborted","failed"],description:"Compaction invocation outcome"},...hB},status:{default:"ok",errorWhen:"The compaction fails or throws"}},"pi.harness.navigation":{description:"One admitted in-process navigation invocation",parents:{kind:"root_or_external"},startAttributes:{...fB,"pi.operation.kind":{type:"string",required:!0,values:["navigation"],description:"Navigation operation kind"}},endAttributes:{"pi.operation.outcome":{type:"string",values:["completed","declined","aborted","failed"],description:"Navigation invocation outcome"},...hB},status:{default:"ok",errorWhen:"The navigation fails or throws"}},"pi.harness.checkpoint":{description:"One run checkpoint",parents:{kind:"spans",spans:["pi.harness.run"]},startAttributes:{"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!0,cardinality:"high",description:"Durable operation id"},"pi.checkpoint.kind":{type:"string",required:!0,values:["normal","failure_drain","abort_reconcile"],description:"Checkpoint purpose"}},endAttributes:{},status:{default:"ok",errorWhen:"Checkpoint work throws"}},"pi.harness.turn":{description:"One assistant response and its tool batch",parents:{kind:"spans",spans:["pi.harness.run"]},startAttributes:{"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!0,cardinality:"high",description:"Durable operation id"},"pi.turn.id":{type:"string",required:!0,cardinality:"high",description:"Invocation-local turn id"}},endAttributes:{},status:{default:"ok",errorWhen:"Turn work throws"}},"pi.harness.step":{description:"One durable retry attempt",parents:{kind:"spans",spans:["pi.harness.turn","pi.harness.checkpoint","pi.harness.compaction","pi.harness.navigation"]},startAttributes:{"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!0,cardinality:"high",description:"Durable operation id"},"pi.step.kind":{type:"string",required:!0,values:["assistant","compaction","branch_summary"],description:"Retryable step kind"},"pi.step.attempt":{type:"number",required:!0,description:"One-based durable attempt number"},"pi.compaction.reason":{type:"string",required:!1,values:["manual","threshold","overflow"],description:"Compaction trigger"}},endAttributes:{"pi.step.outcome":{type:"string",values:["succeeded","retry","failed","aborted","deferred","overflow"],description:"Attempt outcome"}},status:{default:"ok",errorWhen:"The attempt retries, fails, or throws"}},"pi.harness.tool":{description:"One raw phase-2 tool execution",parents:{kind:"spans",spans:["pi.harness.turn","pi.harness.run"]},startAttributes:{"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!0,cardinality:"high",description:"Durable operation id"},"pi.turn.id":{type:"string",required:!1,cardinality:"high",description:"Invocation-local live turn id"},"pi.tool.name":{type:"string",required:!0,description:"Tool name"},"pi.tool.call_id":{type:"string",required:!0,cardinality:"high",description:"Tool call id"},"pi.tool.replay":{type:"string",required:!0,values:["never","safe"],description:"Declared replay policy"},"pi.tool.recovery":{type:"boolean",required:!0,description:"Whether this is recovery execution"}},endAttributes:{"pi.tool.is_error":{type:"boolean",description:"Whether raw phase-2 execution returned an error"}},status:{default:"ok",errorWhen:"Raw phase-2 execution returns an error"}},"pi.harness.hook":{description:"One registered hook handler invocation",parents:{kind:"any"},startAttributes:{"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!1,cardinality:"high",description:"Durable operation id when accepted"},"pi.hook.name":{type:"string",required:!0,values:umt,description:"Hook name"},"pi.hook.registration_id":{type:"string",required:!1,description:"Stable hook registration id"}},endAttributes:{"pi.hook.outcome":{type:"string",values:["completed","skipped","blocked","failed"],description:"Handler outcome"}},status:{default:"ok",errorWhen:"The handler throws"}},"pi.harness.sleep":{description:"One retry delay",parents:{kind:"spans",spans:["pi.harness.step","pi.harness.run"]},startAttributes:{"pi.operation.id":{type:"string",required:!0,cardinality:"high",description:"Durable operation id"},"pi.sleep.delay_ms":{type:"number",required:!0,description:"Requested delay in milliseconds"}},endAttributes:{"pi.sleep.outcome":{type:"string",values:["elapsed","aborted"],description:"Delay outcome"}},status:{default:"ok",errorWhen:"Sleep work throws"}},"pi.harness.event_handler":{description:"One passive event listener invocation",parents:{kind:"any"},startAttributes:{"pi.event.type":{type:"string",required:!0,cardinality:"low",values:lmt,description:"Delivered harness event type"},"pi.lane.name":{type:"string",required:!1,cardinality:"high",description:"Lane name for lane-scoped events"}},endAttributes:{},status:{default:"ok",errorWhen:"The listener throws"}},"pi.session.write":{description:"One committed session mutation",parents:{kind:"any"},startAttributes:{"pi.lane.name":{type:"string",required:!0,cardinality:"high",description:"Lane name"},"pi.operation.id":{type:"string",required:!1,cardinality:"high",description:"Durable operation id when accepted"},"pi.session.mutation":{type:"string",required:!0,values:["entry","record","lane","fact"],description:"Session mutation kind"},"pi.session.item_type":{type:"string",required:!1,description:"Entry, record, lane, or fact subtype"}},endAttributes:{"pi.session.seq":{type:"number",description:"Committed session sequence when exposed"}},status:{default:"ok",errorWhen:"Storage rejects the mutation"}}}};var SBn=globalThis.Buffer;var FBn=2147483647/1e3;var UBn=fr.Object({command:fr.String({description:"Bash command to execute"}),timeout:fr.Optional(fr.Number({description:"Timeout in seconds (optional, no default timeout)"}))});var gmt=fr.Object({oldText:fr.String({description:"Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call."}),newText:fr.String({description:"Replacement text for this targeted edit."})},{}),r4n=fr.Object({path:fr.String({description:"Path to the file to edit (relative or absolute)"}),edits:fr.Array(gmt,{description:"One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead."})},{});var h4n=fr.Object({path:fr.String({description:"Path to the file to read (relative or absolute)"}),offset:fr.Optional(fr.Number({description:"Line number to start reading from (1-indexed)"})),limit:fr.Optional(fr.Number({description:"Maximum number of lines to read"}))});var b4n=fr.Object({path:fr.String({description:"Path to the file to write (relative or absolute)"}),content:fr.String({description:"Content to write to the file"})});var K={};On(K,{Assign:()=>ymt,Clone:()=>RT,Create:()=>Ift,Discard:()=>kft,Metrics:()=>cu,Update:()=>Eft});var cu={assign:0,create:0,clone:0,discard:0,update:0};function ymt(e,t){return cu.assign+=1,{...e,...t}}var S={};On(S,{Counted:()=>Dmt,Entries:()=>Umt,EntriesRegExp:()=>Fmt,Every:()=>Pmt,EveryAll:()=>Lmt,GraphemeCount:()=>Rmt,HasPropertyKey:()=>$mt,IsArray:()=>ST,IsBigInt:()=>ET,IsBoolean:()=>k0e,IsClassInstance:()=>Amt,IsConstructor:()=>wmt,IsDeepEqual:()=>xB,IsEqual:()=>un,IsFunction:()=>E0e,IsGreaterEqualThan:()=>A0e,IsGreaterThan:()=>kmt,IsInteger:()=>yB,IsLessEqualThan:()=>S0e,IsLessThan:()=>Emt,IsMaxLength:()=>Cmt,IsMinLength:()=>Omt,IsMultipleOf:()=>Smt,IsNull:()=>BP,IsNumber:()=>KP,IsObject:()=>AT,IsObjectNotArray:()=>Tmt,IsString:()=>HP,IsSymbol:()=>Imt,IsUndefined:()=>_B,IsUnsafePropertyKey:()=>C0e,IsValueLike:()=>R0e,Keys:()=>GP,ShiftLeft:()=>VP,Some:()=>Mmt,SomeAll:()=>Nmt,Symbols:()=>Wmt,Values:()=>qmt});function Rh(e,t,n){return e>=t&&e<=n}function _0e(e){return e===8205}function _mt(e){return Rh(e,55296,56319)}function g0e(e){return Rh(e,127462,127487)}function x0e(e){return Rh(e,65024,65039)}function v0e(e){return Rh(e,768,879)||Rh(e,6832,6911)||Rh(e,7616,7679)||Rh(e,65056,65071)}function jP(e){return e>65535?2:1}function y0e(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(v0e(n)||x0e(n))t+=jP(n);else break}return t}function gB(e,t){let n=e.codePointAt(t),r=t+jP(n);for(r=y0e(e,r);r<e.length-1&&_0e(e.codePointAt(r));){let i=e.codePointAt(r+1);r+=1+jP(i),r=y0e(e,r)}return g0e(n)&&r<e.length&&g0e(e.codePointAt(r))&&(r+=jP(e.codePointAt(r))),r}function b0e(e){return _mt(e)||v0e(e)||x0e(e)||_0e(e)}function w0e(e){let t=0,n=0;for(;n<e.length;)n=gB(e,n),t++;return t}function xmt(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=gB(e,r),n++,n>=t)return!0;return!1}function vmt(e,t){let n=0,r=0;for(;r<e.length;)if(r=gB(e,r),n++,n>t)return!1;return!0}function T0e(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(b0e(e.charCodeAt(n)))return xmt(e,t);if(n++,n>=t)return!0}return!1}function I0e(e,t){let n=0;for(;n<e.length;){if(b0e(e.charCodeAt(n)))return vmt(e,t);if(n++,n>t)return!1}return!0}function ST(e){return Array.isArray(e)}function ET(e){return un(typeof e,"bigint")}function k0e(e){return un(typeof e,"boolean")}function wmt(e){if(_B(e)||!E0e(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function E0e(e){return un(typeof e,"function")}function yB(e){return Number.isInteger(e)}function BP(e){return un(e,null)}function KP(e){return Number.isFinite(e)}function Tmt(e){return AT(e)&&!ST(e)}function AT(e){return un(typeof e,"object")&&!BP(e)}function HP(e){return un(typeof e,"string")}function Imt(e){return un(typeof e,"symbol")}function _B(e){return un(e,void 0)}function un(e,t){return e===t}function kmt(e,t){return e>t}function Emt(e,t){return e<t}function S0e(e,t){return e<=t}function A0e(e,t){return e>=t}function Smt(e,t){if(ET(e)||ET(t))return BigInt(e)%BigInt(t)===0n;let n=1e-10;if(!KP(e)||yB(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 Amt(e){if(!AT(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return BP(t)?!1:un(typeof t.constructor,"function")&&!(un(t.constructor,globalThis.Object)||un(t.constructor.name,"Object"))}function R0e(e){return ET(e)||k0e(e)||BP(e)||KP(e)||HP(e)||_B(e)}function Rmt(e){return w0e(e)}function Cmt(e,t){return I0e(e,t)}function Omt(e,t){return T0e(e,t)}function Pmt(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function Lmt(e,t,n){let r=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(r=!1);return r}function Mmt(e,t){for(let n=0;n<e.length;n++)if(t(e[n],n))return!0;return!1}function Nmt(e,t){let n=!1;for(let r=0;r<e.length;r++)t(e[r],r)&&(n=!0);return n}function Dmt(e,t){return e.reduce((n,r,i)=>t(r,i)?++n:n,0)}function VP(e,t,n){return un(e.length,0)?n():t(e[0],e.slice(1))}function C0e(e){return un(e,"__proto__")||un(e,"constructor")||un(e,"prototype")}function $mt(e,t){return C0e(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Fmt(e){return GP(e).map(t=>[new RegExp(`^${t}$`),e[t]])}function Umt(e){return Object.entries(e)}function GP(e){return Object.getOwnPropertyNames(e)}function Wmt(e){return Object.getOwnPropertySymbols(e)}function qmt(e){return Object.values(e)}function jmt(e,t){if(!AT(t))return!1;let n=GP(e);return un(n.length,GP(t).length)&&n.every(r=>xB(e[r],t[r]))}function Gmt(e,t){return ST(t)&&un(e.length,t.length)&&e.every((n,r)=>xB(e[r],t[r]))}function xB(e,t){return ST(e)?Gmt(e,t):AT(e)?jmt(e,t):un(e,t)}var gm={};On(gm,{IsBigInt64Array:()=>ift,IsBigUint64Array:()=>oft,IsBoolean:()=>Kmt,IsDate:()=>sft,IsFloat32Array:()=>nft,IsFloat64Array:()=>rft,IsInt16Array:()=>Qmt,IsInt32Array:()=>eft,IsInt8Array:()=>Jmt,IsMap:()=>uft,IsNumber:()=>Hmt,IsRegExp:()=>aft,IsSet:()=>cft,IsString:()=>Vmt,IsTypeArray:()=>zmt,IsUint16Array:()=>Zmt,IsUint32Array:()=>tft,IsUint8Array:()=>Ymt,IsUint8ClampedArray:()=>Xmt});function Kmt(e){return e instanceof Boolean}function Hmt(e){return e instanceof Number}function Vmt(e){return e instanceof String}function zmt(e){return globalThis.ArrayBuffer.isView(e)}function Jmt(e){return e instanceof globalThis.Int8Array}function Ymt(e){return e instanceof globalThis.Uint8Array}function Xmt(e){return e instanceof globalThis.Uint8ClampedArray}function Qmt(e){return e instanceof globalThis.Int16Array}function Zmt(e){return e instanceof globalThis.Uint16Array}function eft(e){return e instanceof globalThis.Int32Array}function tft(e){return e instanceof globalThis.Uint32Array}function nft(e){return e instanceof globalThis.Float32Array}function rft(e){return e instanceof globalThis.Float64Array}function ift(e){return e instanceof globalThis.BigInt64Array}function oft(e){return e instanceof globalThis.BigUint64Array}function aft(e){return e instanceof globalThis.RegExp}function sft(e){return e instanceof globalThis.Date}function cft(e){return e instanceof globalThis.Set}function uft(e){return e instanceof globalThis.Map}function pft(e){return S.HasPropertyKey(e,"~kind")||S.HasPropertyKey(e,"~unsafe")}function dft(e){let t={};for(let n of S.Keys(e)){if(S.IsUnsafePropertyKey(n))continue;let r=Object.getOwnPropertyDescriptor(e,n);r.value=Ch(r.value),S.IsEqual(r.enumerable,!0)?t[n]=r.value:Object.defineProperty(t,n,r)}return t}function mft(e){let t={};for(let n of S.Keys(e))S.IsUnsafePropertyKey(n)||(t[n]=Ch(e[n]));for(let n of S.Symbols(e))t[n]=Ch(e[n]);return t}function fft(e){return S.IsClassInstance(e)?e:pft(e)?dft(e):mft(e)}function hft(e){return e.map(t=>Ch(t))}function gft(e){return e.slice()}function yft(e){return new RegExp(e.source,e.flags)}function _ft(e){return new Map(Ch([...e.entries()]))}function xft(e){return new Set(Ch([...e.values()]))}function Ch(e){return gm.IsTypeArray(e)?gft(e):gm.IsRegExp(e)?yft(e):gm.IsMap(e)?_ft(e):gm.IsSet(e)?xft(e):S.IsArray(e)?hft(e):S.IsObject(e)?fft(e):e}function RT(e){return cu.clone+=1,Ch(e)}var Sp={};On(Sp,{Get:()=>wft,Reset:()=>vft,Set:()=>bft});var nl={immutableTypes:!1,maxErrors:8,maxInstantiationCount:128,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function vft(){nl.immutableTypes=!1,nl.maxErrors=8,nl.maxInstantiationCount=128,nl.useAcceleration=!0,nl.exactOptionalPropertyTypes=!1,nl.enumerableKind=!1,nl.correctiveParse=!1,nl.unionPrioritySort=!0}function bft(e){for(let t of S.Keys(e)){let n=e[t];n!==void 0&&Object.defineProperty(nl,t,{value:n})}}function wft(){return nl}function Tft(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 O0e(e,t){return{...e,...t}}function Ift(e,t,n={}){cu.create+=1;let r=Sp.Get(),i=O0e(t,n),o=r.enumerableKind?O0e(i,e):Tft(i,e);return r.immutableTypes?Object.freeze(o):o}function kft(e,t){cu.discard+=1;let n={};for(let r of S.Keys(e)){if(t.includes(r))continue;let i=Object.getOwnPropertyDescriptor(e,r);i.value=RT(i.value),Object.defineProperty(n,r,i)}return n}function Eft(e,t,n){cu.update+=1;let r=Sp.Get(),i=RT(e);for(let o of Object.keys(t))Object.defineProperty(i,o,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[o]});for(let o of Object.keys(n))Object.defineProperty(i,o,{configurable:!0,enumerable:!0,writable:!0,value:n[o]});return i}function Ze(e,t){return S.IsObject(e)&&S.HasPropertyKey(e,"~kind")&&S.IsEqual(e["~kind"],t)}function gi(e){return S.IsObject(e)}function at(e,t,n){return K.Create({"~kind":"Deferred"},{type:"deferred",action:e,parameters:t,options:n},{})}function ym(e){return Ze(e,"Deferred")}function Sft(e){return K.Update(e,{"~readonly":!0},{})}function CT(e,t){return K.Update(Sft(e),{},t)}function P0e(e,t,n,r){let i=Me(e,t,n);return CT(i,r)}function Aft(e){return K.Update(e,{"~optional":!0},{})}function OT(e,t){return K.Update(Aft(e),{},t)}function L0e(e,t,n,r){let i=Me(e,t,n);return OT(i,r)}function ws(e,t){return K.Create({"~kind":"Array"},{type:"array",items:e},t)}function hr(e){return Ze(e,"Array")}function zP(e){return K.Discard(e,["~kind","type","items"])}function rl(e,t,n={}){return K.Create({"~kind":"Constructor"},{type:"constructor",parameters:e,instanceType:t},n)}function Li(e){return Ze(e,"Constructor")}function M0e(e){return K.Discard(e,["~kind","type","parameters","instanceType"])}function il(e,t,n={}){return K.Create({"~kind":"Function"},{type:"function",parameters:e,returnType:t},n)}function Mi(e){return Ze(e,"Function")}function N0e(e){return K.Discard(e,["~kind","type","parameters","returnType"])}function Ap(e,t){return K.Create({"~kind":"Ref"},{$ref:e},t)}function Ni(e){return Ze(e,"Ref")}function _m(e,t){return K.Create({"~kind":"Generic"},{type:"generic",parameters:e,expression:t})}function gx(e){return Ze(e,"Generic")}function yx(e){return K.Create({"~kind":"Any"},{},e)}function Er(e){return Ze(e,"Any")}var D0e="(?!)";function Fn(e){return K.Create({"~kind":"Never"},{not:{}},e)}function uu(e){return Ze(e,"Never")}function ol(e,t={}){return at("AddOptional",[e],t)}function Oh(e,t={}){return OT(e,t)}function $0e(e){return Oh(e)}function Ao(e){return gi(e)&&S.HasPropertyKey(e,"~optional")}function F0e(e){return S.Keys(e).filter(t=>!Ao(e[t]))}function JP(e){return S.Keys(e)}function YP(e){return S.Values(e)}function St(e,t={}){let n=F0e(e),r=n.length>0?{required:n}:{};return K.Create({"~kind":"Object"},{type:"object",...r,properties:e},t)}function Tn(e){return Ze(e,"Object")}function U0e(e){return K.Discard(e,["~kind","type","properties","required"])}function Ki(e){return K.Create({"~kind":"Unknown"},{},e)}function zr(e){return Ze(e,"Unknown")}function al(e,t,n){let r=S.Keys(e).reduce((i,o)=>({...i,[o]:K.Update(e[o],{},{$id:o})}),{});return K.Create({"~kind":"Cyclic"},{$defs:r,$ref:t},n)}function co(e){return Ze(e,"Cyclic")}function W0e(e){return K.Update(e,{"~unsafe":null},{})}function XP(e){return S.IsObjectNotArray(e)&&S.HasPropertyKey(e,"~unsafe")&&S.IsNull(e["~unsafe"])}var sl={};On(sl,{Match:()=>Rft});function Rft(e,t){return t[e.length]?.(...e)??(()=>{throw Error("Invalid Arguments")})()}function PT(...e){let[t,n]=sl.Match(e,{2:(r,i)=>[r,i,i],1:r=>[r,Ki(),Ki()]});return K.Create({"~kind":"Infer"},{type:"infer",name:t,extends:n},{})}function Jr(e){return Ze(e,"Infer")}function Ph(e,t,n,r={}){return K.Create({"~kind":"Dependent"},{if:e,then:t,else:n},r)}function Wr(e){return Ze(e,"Dependent")}function q0e(e){return K.Discard(e,["~kind","if","then","else"])}function j0e(e){return S.IsObjectNotArray(e)}function G0e(e){return S.Keys(e).filter(n=>isNaN(n)).reduce((n,r)=>[...n,e[r]],[])}function B0e(e){return S.IsString(e)||S.IsNumber(e)}function K0e(e,t){let n=j0e(e)?G0e(e):e;return K.Create({"~kind":"Enum"},{enum:n},t)}function uo(e){return Ze(e,"Enum")}function fa(e,t={}){return K.Create({"~kind":"Intersect"},{allOf:e},t)}function Qt(e){return Ze(e,"Intersect")}function H0e(e){return K.Discard(e,["~kind","allOf"])}function yi(){throw new Error("Unreachable")}var V0e;(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"})(V0e||(V0e={}));var RHn=BigInt("14695981039346656037"),[CHn,OHn]=[BigInt("1099511628211"),BigInt("18446744073709551616")],PHn=Array.from({length:256}).map((e,t)=>BigInt(t)),z0e=new Float64Array(1),LHn=new DataView(z0e.buffer),MHn=new Uint8Array(z0e.buffer);var NHn=new TextEncoder;var LT=class{constructor(t,n){this.type=t,this.decode=n}Encode(t){let n=this.type,r=QP(n)?a=>this.decode(n["~codec"].decode(a)):this.decode,i=QP(n)?a=>n["~codec"].encode(t(a)):t,o={decode:r,encode:i};return K.Update(this.type,{"~codec":o},{})}},MT=class{constructor(t){this.type=t}Decode(t){return new LT(this.type,t)}};function ZP(e){return new MT(e)}function Y0e(e,t){return ZP(e).Decode(t).Encode(()=>{throw Error("Encode not implemented")})}function X0e(e,t){return ZP(e).Decode(()=>{throw Error("Decode not implemented")}).Encode(t)}function QP(e){return gi(e)&&S.HasPropertyKey(e,"~codec")&&S.IsObject(e["~codec"])&&S.HasPropertyKey(e["~codec"],"encode")&&S.HasPropertyKey(e["~codec"],"decode")}function Q0e(e){return _x(e)}function Lh(e){return gi(e)&&S.HasPropertyKey(e,"~immutable")}function cl(e,t={}){return at("AddReadonly",[e],t)}function Mh(e,t={}){return CT(e,t)}function Z0e(e){return Mh(e)}function Nh(e){return gi(e)&&S.HasPropertyKey(e,"~readonly")}function Lft(e,t){let n=vB(e)?[...e["~refine"],t]:[t];return K.Update(e,{"~refine":n},{})}function exe(...e){let[t,n,r]=sl.Match(e,{3:(i,o,a)=>[i,o,a],2:(i,o)=>[i,o,()=>"Refine Error"]});return Lft(t,{check:n,error:r})}function Mft(e){return S.IsObjectNotArray(e)&&S.HasPropertyKey(e,"check")&&S.HasPropertyKey(e,"error")&&S.IsFunction(e.check)&&S.IsFunction(e.error)}function vB(e){return gi(e)&&S.HasPropertyKey(e,"~refine")&&S.IsArray(e["~refine"])&&S.Every(e["~refine"],0,t=>Mft(t))}var txe="-?(?:0|[1-9][0-9]*)n";function NT(e){return K.Create({"~kind":"BigInt"},{type:"bigint"},e)}function ul(e){return Ze(e,"BigInt")}function e1(e){return K.Create({"~kind":"Boolean"},{type:"boolean"},e)}function sc(e){return Ze(e,"Boolean")}function DT(e){return K.Create({"~kind":"Identifier"},{name:e})}function nxe(e){return Ze(e,"Identifier")}var t1="-?(?:0|[1-9][0-9]*)";function Dh(e){return K.Create({"~kind":"Integer"},{type:"integer"},e)}function Ho(e){return Ze(e,"Integer")}var bB=class extends Error{constructor(t){super("Invalid Literal value"),Object.defineProperty(this,"cause",{value:{value:t},writable:!1,configurable:!1,enumerable:!1})}};function Nft(e){return S.IsBigInt(e)?"bigint":S.IsBoolean(e)?"boolean":S.IsNumber(e)?"number":S.IsString(e)?"string":(()=>{throw new bB(e)})()}function Zt(e,t){return K.Create({"~kind":"Literal"},{type:Nft(e),const:e},t)}function n1(e){return S.IsBigInt(e)||S.IsBoolean(e)||S.IsNumber(e)||S.IsString(e)}function rxe(e){return In(e)&&S.IsNumber(e.const)}function ixe(e){return In(e)&&S.IsString(e.const)}function In(e){return Ze(e,"Literal")}function xx(e){return K.Create({"~kind":"Null"},{type:"null"},e)}function vx(e){return Ze(e,"Null")}var r1="-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?";function Ba(e){return K.Create({"~kind":"Number"},{type:"number"},e)}function ai(e){return Ze(e,"Number")}function bx(e){return K.Create({"~kind":"Symbol"},{type:"symbol"},e)}function xm(e){return Ze(e,"Symbol")}function $h(...e){let[t,n,r]=sl.Match(e,{3:(i,o,a)=>[i,o,a],2:(i,o)=>[i,o,o],1:i=>[i,Ki(),Ki()]});return K.Create({"~kind":"Parameter"},{name:t,extends:n,equals:r},{})}function oxe(e){return Ze(e,"Parameter")}var i1=".*";function cc(e){return K.Create({"~kind":"String"},{type:"string"},e)}function Vo(e){return Ze(e,"String")}function Gt(e,t={}){return K.Create({"~kind":"Union"},{anyOf:e},t)}function rt(e){return Ze(e,"Union")}function axe(e){return K.Discard(e,["~kind","anyOf"])}function $T(e){let t=sxe(e);return S.IsEqual(t.length,2)?t[0]:[]}function Dft(e){return!0}function cxe(e){return S.ShiftLeft(e,(t,n)=>$ft(t)?cxe(n):!1,()=>!0)}function uxe(e){return S.IsEqual(e.length,0)?!1:cxe(e)}function $ft(e){return rt(e)?uxe(e.anyOf):In(e)?Dft(e.const):!1}function o1(e){return uxe(e)}function a1(e){return K.Create({"~kind":"TemplateLiteral"},{type:"string",pattern:e},{})}function lxe(e,t,n=[]){return S.ShiftLeft(e,(r,i)=>lxe(i,t,[...n,`${r}${t}`]),()=>n)}function Fft(e,t){return S.IsEqual(e.length,0)?[`${t}`]:lxe(e,t)}function pxe(e,t,n=[]){return S.ShiftLeft(t,(r,i)=>pxe(e,i,[...n,...dxe(e,r)]),()=>n)}function dxe(e,t){return rt(t)?pxe(e,t.anyOf):In(t)?Fft(e,t.const):yi()}function mxe(e,t){return S.ShiftLeft(t,(n,r)=>mxe(dxe(e,n),r),()=>e)}function Uft(e){return e.map(t=>Zt(t))}function Wft(e){let t=mxe([],e),n=Uft(t);return Gt(n)}function qft(e){return S.IsEqual(e.length,0)?yi():S.IsEqual(e.length,1)&&In(e[0])?e[0]:Wft(e)}function wB(e){let t=$T(e);return S.IsEqual(t.length,0)?cc():o1(t)?qft(t):a1(e)}function fxe(e){let t=wB(e);return qr(t)?cc():t}function ha(e,t){let n="object",r={[e]:t};return K.Create({"~kind":"Record"},{type:n,patternProperties:r})}function hxe(e){return ha(lu,e)}function gxe(e){return St({true:e,false:e})}function si(e,t={}){let[n,r,i]=[e,e.length,!1];return K.Create({"~kind":"Tuple"},{type:"array",additionalItems:i,items:n,minItems:r},t)}function Xn(e){return Ze(e,"Tuple")}function yxe(e){return K.Discard(e,["~kind","type","items","minItems","additionalItems"])}function jft(e){return K.Discard(e,["~readonly"])}function TB(e,t){return K.Update(jft(e),{},t)}function _xe(e,t,n,r){let i=Me(e,t,n);return TB(i,r)}function xxe(e,t={}){return at("RemoveReadonly",[e],t)}function vxe(e,t={}){return TB(e,t)}function Gft(e){return K.Discard(e,["~optional"])}function IB(e,t){return K.Update(Gft(e),{},t)}function bxe(e,t,n,r){let i=Me(e,t,n);return IB(i,r)}function wxe(e,t={}){return at("RemoveOptional",[e],t)}function s1(e,t={}){return IB(e,t)}function kB(e){return e.reduceRight((n,r,i)=>({[i]:r,...n}),{})}function Txe(e){let t=kB(e.items);return St(t)}function EB(e){return Tn(e)||Xn(e)}function Bft(e,t){return Nh(e)?!!Nh(t):!1}function Kft(e,t){return Ao(e)?!!Ao(t):!1}function Hft(e,t){let n=Bft(e,t),r=Kft(e,t),i=gr([e,t]),o=vxe(s1(i));return n&&r?Mh(Oh(o)):n&&!r?Mh(o):!n&&r?Oh(o):o}function Vft(e,t,n){return n in e?n in t?Hft(e[n],t[n]):e[n]:n in t?t[n]:Fn()}function zft(e,t){return[...new Set([...S.Keys(e),...S.Keys(t)])].reduce((i,o)=>({...i,[o]:Vft(e,t,o)}),{})}function Ixe(e){return Tn(e)?e.properties:Xn(e)?kB(e.items):{}}function kxe(e,t){let n=Ixe(e),r=Ixe(t),i=zft(n,r);return St(i)}function Jft(e,t){let n=WT(e,t);return S.IsEqual(n,UT)?e:S.IsEqual(n,c1)||S.IsEqual(n,FT)?t:Fn()}function Yft(e,t){let n=EB(e),r=EB(t);return n&&r?kxe(e,t):n&&!r?e:!n&&r?t:Jft(e,t)}function Exe(e,t){return uu(e)||Er(e)?e:zr(e)||uu(t)||Er(t)?t:zr(t)?e:Yft(e,t)}function Xft(e,t){return rt(e)||rt(t)}function Qft(e,t){let n=uc(e),r=uc(t);return Xft(n,r)?gr([n,r]):Exe(n,r)}function Sxe(e,t,n=[]){return S.ShiftLeft(t,(r,i)=>Sxe(e,i,[...n,Qft(r,e)]),()=>S.IsEqual(n.length,0)?[e]:n)}function Axe(e,t,n=[]){return S.ShiftLeft(e,(r,i)=>Axe(i,t,[...n,...qT([r],t)]),()=>n)}function qT(e,t=[]){return S.ShiftLeft(e,(n,r)=>rt(n)?qT(r,Axe(n.anyOf,t)):qT(r,Sxe(n,t)),()=>t)}function Zft(e,t){let n=lo({},e,t);return At.IsExtendsTrueLike(n)?[]:[e]}function Rxe(e,t,n=[]){return S.ShiftLeft(e,(r,i)=>Rxe(i,t,[...n,...Zft(r,t)]),()=>n)}function u1(e,t){let n=uc(e),r=rt(n)?n.anyOf:[n],i=Rxe(r,t);return ga(i)}function pu(e,t,n){let r=gr([e,t]),i=u1(n,e);return ga([r,i])}function zo(e,t=[]){return S.ShiftLeft(e,(n,r)=>zo(r,[...t,Zt(n)]),()=>ga(t))}function gr(e){let t=qT(e),n=SB(t);return ga(n)}function Ro(e){let t=fxe(e);return uc(t)}function ga(e){let t=SB(e);return vm(t)}function uc(e){return Wr(e)?pu(e.if,e.then,e.else):uo(e)?zo(e.enum):Qt(e)?gr(e.allOf):qr(e)?Ro(e.pattern):rt(e)?ga(e.anyOf):e}function vm(e){return S.IsEqual(e.length,1)?e[0]:S.IsEqual(e.length,0)?Fn():Gt(e)}function Cxe(e,t){let n=zo(e);return bm(n,t)}function Oxe(e,t){return ha(wm,t)}function Pxe(e,t){let n=gr(e);return bm(n,t)}function Lxe(e,t){return S.IsString(e)||S.IsNumber(e)?St({[e]:t}):S.IsEqual(e,!1)?St({false:t}):S.IsEqual(e,!0)?St({true:t}):St({})}function Mxe(e,t){return ha(wx,t)}function Nxe(e,t){return S.HasPropertyKey(e,"pattern")&&(S.IsString(e.pattern)||e.pattern instanceof RegExp)?ha(e.pattern.toString(),t):ha(lu,t)}function Dxe(e,t){let n=$T(e);return o1(n)?bm(Ro(e),t):ha(e,t)}function eht(e){return rt(e)?Tx(e.anyOf):[e]}function Tx(e,t=[]){return S.ShiftLeft(e,(n,r)=>Tx(r,[...t,...eht(n)]),()=>t)}function tht(e){return e.some(t=>Vo(t)||ai(t)||Ho(t))}function nht(e,t){return S.IsEqual(tht(e),!0)?ha(lu,t):void 0}function rht(e,t){return e.reduce((n,r)=>In(r)&&(S.IsString(r.const)||S.IsNumber(r.const))?{...n,[r.const]:t}:n,{})}function iht(e,t){let n=rht(e,t);return St(n)}function $xe(e,t){let n=Tx(e),r=nht(n,t);return gi(r)?r:iht(n,t)}function bm(e,t){return Er(e)?hxe(t):sc(e)?gxe(t):uo(e)?Cxe(e.enum,t):Ho(e)?Oxe(e,t):Qt(e)?Pxe(e.allOf,t):In(e)?Lxe(e.const,t):ai(e)?Mxe(e,t):rt(e)?$xe(e.anyOf,t):Vo(e)?Nxe(e,t):qr(e)?Dxe(e.pattern,t):St({})}function AB(e,t,n){return $t([e])?K.Update(bm(e,t),{},n):l1(e,t,n)}function Fxe(e,t,n,r,i){let o=Me(e,t,n),a=Me(e,t,r);return AB(o,a,i)}var wm=`^${t1}$`,wx=`^${r1}$`,lu=`^${i1}$`;function l1(e,t,n={}){return at("Record",[e,t],n)}function p1(e,t,n={}){return AB(e,t,n)}function Uxe(e,t){return ha(e,t)}function d1(e){return S.IsEqual(e,lu)?cc():S.IsEqual(e,wm)?Dh():S.IsEqual(e,wx)?Ba():wB(e)}function lc(e){return S.Keys(e.patternProperties)[0]}function Ix(e){let t=lc(e);return d1(t)}function Jo(e){return e.patternProperties[lc(e)]}function po(e){return Ze(e,"Record")}function Fh(e){return K.Create({"~kind":"Rest"},{type:"rest",items:e},{})}function Tm(e){return Ze(e,"Rest")}function m1(e){return K.Create({"~kind":"This"},{$ref:"#"},e)}function f1(e){return Ze(e,"This")}function kx(e){return K.Create({"~kind":"Undefined"},{type:"undefined"},e)}function Ex(e){return Ze(e,"Undefined")}function h1(e){return K.Create({"~kind":"Void"},{type:"void"},e)}function ll(e){return Ze(e,"Void")}function aht(e,t){return S.IsEqual(e,"Array")?ws(t[0]):S.IsEqual(e,"Capitalize")?y1(t[0]):S.IsEqual(e,"ConstructorParameters")?w1(t[0]):S.IsEqual(e,"Evaluate")?Wbe(t[0]):S.IsEqual(e,"Exclude")?T1(t[0],t[1]):S.IsEqual(e,"Extract")?I1(t[0],t[1]):S.IsEqual(e,"Index")?KT(t[0],t[1]):S.IsEqual(e,"InstanceType")?k1(t[0]):S.IsEqual(e,"Lowercase")?_1(t[0]):S.IsEqual(e,"NonNullable")?E1(t[0]):S.IsEqual(e,"Omit")?S1(t[0],t[1]):S.IsEqual(e,"Parameters")?A1(t[0]):S.IsEqual(e,"Partial")?R1(t[0]):S.IsEqual(e,"Pick")?C1(t[0],t[1]):S.IsEqual(e,"Readonly")?O1(t[0]):S.IsEqual(e,"KeyOf")?HT(t[0]):S.IsEqual(e,"Record")?l1(t[0],t[1]):S.IsEqual(e,"Required")?P1(t[0]):S.IsEqual(e,"ReturnType")?L1(t[0]):S.IsEqual(e,"Uncapitalize")?x1(t[0]):S.IsEqual(e,"Uppercase")?v1(t[0]):BT(Ap(e),t)}function Uh(){throw Error("Unreachable")}function Bxe(e,t=[]){return S.ShiftLeft(e,(n,r)=>Bxe(r,[...t,n[1]]),()=>t)}function Rp(e){return S.IsEqual(e.length,3)?[e[0],...Bxe(e[1])]:[]}function Kxe(e){return $h(e[0],e[2],e[4])}function Hxe(e){return $h(e[0],e[2],e[2])}function Vxe(e){return $h(e[0],Ki(),e[2])}function zxe(e){return $h(e,Ki(),Ki())}function Jxe(e){return Rp(e)}function Yxe(e){return e[1]}function Xxe(e){return Rp(e)}function Qxe(e){return e[1]}function Zxe(e){return aht(e[0],e[1])}function eve(e){return null}function tve(e){return cc()}function nve(e){return Ba()}function rve(e){return e1()}function ive(e){return kx()}function ove(e){return xx()}function ave(e){return Dh()}function sve(e){return NT()}function cve(e){return Ki()}function uve(e){return yx()}function lve(e){return St({})}function pve(e){return Fn()}function dve(e){return bx()}function mve(e){return h1()}function fve(e){return m1()}function hve(e){return Zt(BigInt(e))}function gve(e){return Zt(S.IsEqual(e,"true"))}function yve(e){return Zt(parseFloat(e))}function _ve(e){return Zt(e)}function xve(e){return e[1]}function vve(e){return Zt(e)}function bve(e){return S.IsEqual(e.length,3)?[e[0],e[1],...e[2]]:[e[0]]}function wve(e){return e[1]}function Tve(e){return g1(e)}function Ive(e){return S.IsEqual(e.length,6)?Ph(e[1],e[3],e[5]):Ph(e[1],e[3],Ki())}function kve(e){return e.length>0}function Eve(e){return e.reduce((t,n)=>S.IsEqual(n.length,3)?[...t,[n[1]]]:[...t,[]],[])}function Sve(e){return S.IsEqual(e.length,6)?[e[1],e[3],e[5]]:[]}function Ave(e){return S.IsArray(e)&&S.IsEqual(e.length,3)?e[1]:e}function Rve(e){return S.IsEqual(e.length,2)?e[1]:[]}function Wxe(e,t){return t.reduce((n,r)=>{let i=r;return S.IsEqual(i.length,1)?KT(n,i[0]):S.IsEqual(i.length,0)?ws(n):Uh()},e)}function qxe(e,t){return S.IsEqual(t.length,3)?b1(e,t[0],t[1],t[2]):e}function sht(e,t){return S.IsArray(t)&&S.IsEqual(t.length,0)?e:M1(e,t)}function Cve(e){let[t,n,r,i,o]=e;return sht(qxe(t?HT(Wxe(n,r)):Wxe(n,r),i),o)}function RB(e,t){return S.IsEqual(t.length,3)?(()=>{let[n,r,i]=t,o=RB(r,i);if(S.IsEqual(n,"&"))return Qt(o)?fa([e,...o.allOf]):fa([e,o]);if(S.IsEqual(n,"|"))return rt(o)?Gt([e,...o.anyOf]):Gt([e,o]);Uh()})():e}function Ove(e){let[t,n]=e;return RB(t,n)}function Pve(e){let[t,n]=e;return RB(t,n)}function Lve(e){return Ube(e[1])}function Mve(e){return e[1]}function Nve(e){return _m(e[0],e[2])}function Dve(e){return S.IsEqual(e.length,4)?PT(e[1],e[3]):S.IsEqual(e.length,2)?PT(e[1],Ki()):Uh()}function $ve(e){return`${e}`}function Fve(e){return Ho(e[3])?wm:ai(e[3])?wx:xm(e[3])?lu:Vo(e[3])?lu:Uh()}function Uve(e){return e.length>0}function Wve(e){return e.length>0}function qve(e){let[t,n,r,i,o]=e;return{[n]:t&&r?cl(ol(o)):t&&!r?cl(o):!t&&r?ol(o):o}}function jve(e){return Rp(e)}function Gve(e){return e.reduce((t,n)=>S.HasPropertyKey(n,wm)||S.HasPropertyKey(n,wx)||S.HasPropertyKey(n,lu)?[t[0],K.Assign(t[1],n)]:[K.Assign(t[0],n),t[1]],[{},{}])}function Bve(e){return Gve(e[1])}function Kve(e){let[t,n]=e,r=S.IsEqual(S.Keys(n).length,0)?{}:{patternProperties:n};return St(t,r)}function Hve(e){return S.IsEqual(e.length,5)?cl(ol(e[4])):S.IsEqual(e.length,3)?e[2]:S.IsEqual(e.length,4)?S.IsEqual(e[2],"readonly")?cl(e[3]):ol(e[3]):Uh()}function Vve(e){if(!S.IsArray(e)||!S.IsEqual(e.length,3))return e;let[t,n,r]=e;return t&&r?cl(ol(n)):t&&!r?cl(n):!t&&r?ol(n):n}function zve(e){return S.IsEqual(e.length,2)?Fh(e[1]):S.IsEqual(e.length,1)?e[0]:Uh()}function Jve(e){return Rp(e)}function Yve(e){return si(e[1])}function Xve(e){return cl(ol(e[4]))}function Qve(e){return cl(e[3])}function Zve(e){return ol(e[3])}function ebe(e){return e[2]}function tbe(e){return S.IsEqual(e.length,2)?Fh(e[1]):S.IsEqual(e.length,1)?e[0]:Uh()}function nbe(e){return Rp(e)}function rbe(e){return il(e[1],e[4])}function ibe(e){return rl(e[2],e[5])}function jxe(e,t){return S.IsEqual(e,"remove")?xxe(t):S.IsEqual(e,"add")?cl(t):t}function obe(e){return S.IsEqual(e.length,2)&&S.IsEqual(e[0],"-")?"remove":S.IsEqual(e.length,2)&&S.IsEqual(e[0],"+")||S.IsEqual(e.length,1)?"add":"none"}function Gxe(e,t){return S.IsEqual(e,"remove")?wxe(t):S.IsEqual(e,"add")?ol(t):t}function abe(e){return S.IsEqual(e.length,2)&&S.IsEqual(e[0],"-")?"remove":S.IsEqual(e.length,2)&&S.IsEqual(e[0],"+")||S.IsEqual(e.length,1)?"add":"none"}function sbe(e){return S.IsEqual(e.length,2)?[e[1]]:[]}function cbe(e){return S.IsArray(e[6])&&S.IsEqual(e[6].length,1)?jT(DT(e[3]),e[5],e[6][0],jxe(e[1],Gxe(e[8],e[10]))):jT(DT(e[3]),e[5],Ap(e[3]),jxe(e[1],Gxe(e[8],e[10])))}function ube(e){return Ap(e)}function lbe(e){return BigInt(e)}function pbe(e){return parseFloat(e)}function dbe(e){return S.IsEqual(e,"true")}function mbe(e){return null}function fbe(e){return{[e[0]]:e[2]}}function hbe(e){return Rp(e)}function cht(e){return e.reduce((t,n)=>K.Assign(t,n),{})}function gbe(e){return cht(e[1])}function ybe(e){return Rp(e)}function _be(e){return e[1]}function xbe(e){return NT()}function vbe(e){return cc()}function bbe(e){return Ba()}function wbe(e){return Dh()}function Tbe(e){return Fn()}function Ibe(e){return Zt(e)}function kbe(e){return Gt(e[1])}function Ebe(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function Sbe(e){return[e[0],...e[1]]}function Abe(e){return e[1]}function Rbe(e){return Rp(e)}function Cbe(e){return S.IsEqual(e.length,2)?e[1]:[]}function Obe(e){let t=e[2],n=e[3],[r,i]=e[4],o=S.IsEqual(S.Keys(i).length,0)?{}:{patternProperties:i};return{[e[1]]:_m(t,GT(n,r,o))}}function Pbe(e){let t=e[2],[n,r]=e[3],i=S.IsEqual(S.Keys(r).length,0)?{}:{patternProperties:r};return{[e[1]]:GT(t,n,i)}}function Lbe(e){return{[e[1]]:_m(e[2],e[4])}}function Mbe(e){return{[e[1]]:e[3]}}function Nbe(e){return null}function Dbe(e){return Rp(e)}function $be(e){return e[1]}function Fbe(e){let[t,n]=[e[0],e[1]];return qbe(K.Assign(t,Gve(n)[0]))}function VT(e){return un(e.length,2)}function zt(e,t,n){return VT(e)?t(e[0],e[1]):n()}function pht(e,t){return un(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function Sr(e,t){for(let n=0;n<e.length;n++){let r=pht(e[n],t);if(VT(r))return r}return[]}function CB(e,t){return Array.from({length:t-e+1},(n,r)=>String.fromCharCode(e+r))}var jbe=[...CB(97,122),...CB(65,90)],OB="0",PB=CB(49,57),Sx=[OB,...PB],Gbe=" ",Ax=`
347
347
  `;var Im="_",N1=".",Bbe="$",D1="-";var Kbe="//",Hbe="/*",mht="*/";function Vbe(e){let t=e.indexOf(mht);return un(t,-1)?"":e.slice(t+2)}function zbe(e){let t=e.indexOf(Ax);return un(t,-1)?"":e.slice(t)}function fht(e){return e.replace(/^[ \t\r\f\v]+/,"")}function $1(e){let t=fht(e);return t.startsWith(Hbe)?$1(Vbe(t.slice(2))):t.startsWith(Kbe)?$1(zbe(t.slice(2))):t}function Hi(e){let t=e.trimStart();return t.startsWith(Hbe)?Hi(Vbe(t.slice(2))):t.startsWith(Kbe)?Hi(zbe(t.slice(2))):t}function F1(e,t){return zt(Sr([e],t),(n,r)=>[n,r],()=>["",t])}function hht(e,t){return e.includes(t)}function Rx(e,t,n,r=""){return zt(Sr(e,n),(i,o)=>hht(t,i)?Rx(e,t,o,r):Rx(e,t,o,`${r}${i}`),()=>[r,n])}function ght(e){return Sr(PB,e)}var yht=[...Sx,Im];function _ht(e){return Rx(yht,[Im],e)}function xht(e){return zt(Sr([OB],e),(t,n)=>[t,n],()=>zt(ght(e),(t,n)=>zt(_ht(n),(r,i)=>[`${t}${r}`,i],()=>[]),()=>[]))}function U1(e){return xht(Hi(e))}function vht(e){return F1(D1,e)}function bht(e){return zt(vht(e),(t,n)=>zt(U1(n),(r,i)=>[`${t}${r}`,i],()=>[]),()=>[])}function Jbe(e){return bht(Hi(e))}function wht(e){return zt(Jbe(e),(t,n)=>zt(Sr(["n"],n),(r,i)=>[`${t}`,i],()=>[]),()=>[])}function LB(e){return wht(e)}function MB(e,t){return Sr([e],t)}function ae(e,t){return un(e,"")?["",t]:e.startsWith(Ax)?MB(e,$1(t)):e.startsWith(Gbe)?MB(e,t):MB(e,Hi(t))}var Ybe=[...jbe,Im,Bbe];function Tht(e){return Sr(Ybe,e)}var Iht=[...Ybe,...Sx];function Xbe(e,t=""){return zt(Sr(Iht,e),(n,r)=>Xbe(r,`${t}${n}`),()=>[t,e])}function kht(e){return zt(Tht(e),(t,n)=>zt(Xbe(n),(r,i)=>[`${t}${r}`,i],()=>[]),()=>[])}function jr(e){return kht(Hi(e))}var Eht=[...Sx,Im];function Sht(e){return VT(Sr([N1],e))}function Qbe(e){return zt(Rx(Eht,[Im],e),(t,n)=>un(t,"")?[]:[t,n],()=>[])}function Aht(e){return zt(Sr([N1],e),(t,n)=>zt(Qbe(n),(r,i)=>[`0${t}${r}`,i],()=>[]),()=>[])}function Rht(e){return zt(U1(e),(t,n)=>zt(Sr([N1],n),(r,i)=>zt(Qbe(i),(o,a)=>[`${t}${r}${o}`,a],()=>[`${t}`,i]),()=>[`${t}`,n]),()=>[])}function Cht(e){return Sht(e)?Aht(e):Rht(e)}function Zbe(e){return Cht(Hi(e))}function Oht(e){return F1(D1,e)}function Pht(e){return zt(Oht(e),(t,n)=>zt(Zbe(n),(r,i)=>[`${t}${r}`,i],()=>[]),()=>[])}function W1(e){return Pht(Hi(e))}function Lht(e){return un(e,"")?[]:[e.slice(0,1),e.slice(1)]}function ewe(e,t){return VP(e,(n,r)=>t.startsWith(n)?!0:ewe(r,t),()=>!1)}function km(e,t,n=""){return zt(Lht(t),(r,i)=>ewe(e,t)?[n,t]:km(e,i,`${n}${r}`),()=>[])}function Mht(e,t,n){return zt(Sr([e],n),(r,i)=>zt(km([t],i),(o,a)=>zt(Sr([t],a),(c,u)=>[`${o}`,u],()=>[]),()=>[]),()=>[])}function Nht(e,t,n){return zt(Sr([e],n),(r,i)=>zt(km([Ax,t],i),(o,a)=>zt(Sr([t],a),(c,u)=>[`${o}`,u],()=>[]),()=>[]),()=>[])}function twe(e,t,n,r){return n?Mht(e,t,Hi(r)):Nht(e,t,Hi(r))}function Dht(e,t){return Sr(e,t)}function $ht(e,t){return twe(e,e,!1,t)}function Fht(e,t){return zt(Dht(e,t),(n,r)=>$ht(n,`${n}${r}`),()=>[])}function q1(e,t){return Fht(e,Hi(t))}function nwe(e,t){return zt(km(e,t),(n,r)=>un(n,"")?[]:[n,r],()=>[])}var I=(e,t,n=()=>[])=>e.length===2?t(e):n(),Wht=e=>I(I(jr(e),([t,n])=>I(ae("extends",n),([r,i])=>I(ln(i),([o,a])=>I(ae("=",a),([c,u])=>I(ln(u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[Kxe(t),n]),qht=e=>I(I(jr(e),([t,n])=>I(ae("extends",n),([r,i])=>I(ln(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[Hxe(t),n]),jht=e=>I(I(jr(e),([t,n])=>I(ae("=",n),([r,i])=>I(ln(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[Vxe(t),n]),Ght=e=>I(jr(e),([t,n])=>[zxe(t),n]),owe=e=>I(I(Wht(e),([t,n])=>[t,n],()=>I(qht(e),([t,n])=>[t,n],()=>I(jht(e),([t,n])=>[t,n],()=>I(Ght(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),awe=(e,t=[])=>I(I(ae(",",e),([n,r])=>I(owe(r),([i,o])=>[[n,i],o])),([n,r])=>awe(r,[...t,n]),()=>[t,e]),Bht=e=>I(I(I(owe(e),([t,n])=>I(awe(n),([r,i])=>I(I(ae(",",i),([o,a])=>[[o],a],()=>[[],i]),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Jxe(t),n]),$B=e=>I(I(ae("<",e),([t,n])=>I(Bht(n),([r,i])=>I(ae(">",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[Yxe(t),n]),swe=(e,t=[])=>I(I(ae(",",e),([n,r])=>I(ln(r),([i,o])=>[[n,i],o])),([n,r])=>swe(r,[...t,n]),()=>[t,e]),Kht=e=>I(I(I(ln(e),([t,n])=>I(swe(n),([r,i])=>I(I(ae(",",i),([o,a])=>[[o],a],()=>[[],i]),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Xxe(t),n]),Hht=e=>I(I(ae("<",e),([t,n])=>I(Kht(n),([r,i])=>I(ae(">",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[Qxe(t),n]),Vht=e=>I(I(jr(e),([t,n])=>I(Hht(n),([r,i])=>[[t,r],i])),([t,n])=>[Zxe(t),n]),cwe=e=>I(I(I(ae(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[eve(t),n]),uwe=e=>I(ae("string",e),([t,n])=>[tve(t),n]),lwe=e=>I(ae("number",e),([t,n])=>[nve(t),n]),zht=e=>I(ae("boolean",e),([t,n])=>[rve(t),n]),Jht=e=>I(ae("undefined",e),([t,n])=>[ive(t),n]),Yht=e=>I(ae("null",e),([t,n])=>[ove(t),n]),pwe=e=>I(ae("integer",e),([t,n])=>[ave(t),n]),Xht=e=>I(ae("bigint",e),([t,n])=>[sve(t),n]),Qht=e=>I(ae("unknown",e),([t,n])=>[cve(t),n]),Zht=e=>I(ae("any",e),([t,n])=>[uve(t),n]),egt=e=>I(ae("object",e),([t,n])=>[lve(t),n]),tgt=e=>I(ae("never",e),([t,n])=>[pve(t),n]),dwe=e=>I(ae("symbol",e),([t,n])=>[dve(t),n]),ngt=e=>I(ae("void",e),([t,n])=>[mve(t),n]),rgt=e=>I(ae("this",e),([t,n])=>[fve(t),n]),igt=e=>I(I(ae("${",e),([t,n])=>I(ln(n),([r,i])=>I(ae("}",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[xve(t),n]),NB=e=>I(km(["${","`"],e),([t,n])=>[vve(t),n]),mwe=e=>I(I(I(NB(e),([t,n])=>I(igt(n),([r,i])=>I(mwe(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I(I(NB(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>I(I(NB(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[bve(t),n]),FB=e=>I(I(ae("`",e),([t,n])=>I(mwe(n),([r,i])=>I(ae("`",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[wve(t),n]),ogt=e=>I(FB(e),([t,n])=>[Tve(t),n]),agt=e=>I(I(I(ae("if",e),([t,n])=>I(ln(n),([r,i])=>I(ae("then",i),([o,a])=>I(ln(a),([c,u])=>I(ae("else",u),([l,d])=>I(ln(d),([m,h])=>[[t,r,o,c,l,m],h])))))),([t,n])=>[t,n],()=>I(I(ae("if",e),([t,n])=>I(ln(n),([r,i])=>I(ae("then",i),([o,a])=>I(ln(a),([c,u])=>[[t,r,o,c],u])))),([t,n])=>[t,n],()=>[])),([t,n])=>[Ive(t),n]),sgt=e=>I(LB(e),([t,n])=>[hve(t),n]),cgt=e=>I(I(ae("true",e),([t,n])=>[t,n],()=>I(ae("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[gve(t),n]),ugt=e=>I(W1(e),([t,n])=>[yve(t),n]),lgt=e=>I(q1(["'",'"'],e),([t,n])=>[_ve(t),n]),pgt=e=>I(I(I(ae("keyof",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[kve(t),n]),fwe=(e,t=[])=>I(I(I(ae("[",e),([n,r])=>I(ln(r),([i,o])=>I(ae("]",o),([a,c])=>[[n,i,a],c]))),([n,r])=>[n,r],()=>I(I(ae("[",e),([n,r])=>I(ae("]",r),([i,o])=>[[n,i],o])),([n,r])=>[n,r],()=>[])),([n,r])=>fwe(r,[...t,n]),()=>[t,e]),dgt=e=>I(fwe(e),([t,n])=>[Eve(t),n]),mgt=e=>I(I(I(ae("extends",e),([t,n])=>I(ln(n),([r,i])=>I(ae("?",i),([o,a])=>I(ln(a),([c,u])=>I(ae(":",u),([l,d])=>I(ln(d),([m,h])=>[[t,r,o,c,l,m],h])))))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Sve(t),n]),fgt=e=>I(I(I(ae("(",e),([t,n])=>I(ln(n),([r,i])=>I(ae(")",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I(uwe(e),([t,n])=>[t,n],()=>I(lwe(e),([t,n])=>[t,n],()=>I(zht(e),([t,n])=>[t,n],()=>I(Jht(e),([t,n])=>[t,n],()=>I(Yht(e),([t,n])=>[t,n],()=>I(pwe(e),([t,n])=>[t,n],()=>I(Xht(e),([t,n])=>[t,n],()=>I(Qht(e),([t,n])=>[t,n],()=>I(Zht(e),([t,n])=>[t,n],()=>I(egt(e),([t,n])=>[t,n],()=>I(tgt(e),([t,n])=>[t,n],()=>I(dwe(e),([t,n])=>[t,n],()=>I(ngt(e),([t,n])=>[t,n],()=>I(rgt(e),([t,n])=>[t,n],()=>I(sgt(e),([t,n])=>[t,n],()=>I(cgt(e),([t,n])=>[t,n],()=>I(ugt(e),([t,n])=>[t,n],()=>I(lgt(e),([t,n])=>[t,n],()=>I(ogt(e),([t,n])=>[t,n],()=>I(agt(e),([t,n])=>[t,n],()=>I(kgt(e),([t,n])=>[t,n],()=>I(Agt(e),([t,n])=>[t,n],()=>I(Mgt(e),([t,n])=>[t,n],()=>I(Lgt(e),([t,n])=>[t,n],()=>I(Fgt(e),([t,n])=>[t,n],()=>I(Vht(e),([t,n])=>[t,n],()=>I(Ugt(e),([t,n])=>[t,n],()=>[])))))))))))))))))))))))))))),([t,n])=>[Ave(t),n]),hgt=e=>I(I(I(ae("with",e),([t,n])=>I(Owe(n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Rve(t),n]),hwe=e=>I(I(pgt(e),([t,n])=>I(fgt(n),([r,i])=>I(dgt(i),([o,a])=>I(mgt(a),([c,u])=>I(hgt(u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[Cve(t),n]),gwe=e=>I(I(I(ae("&",e),([t,n])=>I(hwe(n),([r,i])=>I(gwe(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),ywe=e=>I(I(hwe(e),([t,n])=>I(gwe(n),([r,i])=>[[t,r],i])),([t,n])=>[Ove(t),n]),_we=e=>I(I(I(ae("|",e),([t,n])=>I(ywe(n),([r,i])=>I(_we(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),j1=e=>I(I(ywe(e),([t,n])=>I(_we(n),([r,i])=>[[t,r],i])),([t,n])=>[Pve(t),n]),ggt=e=>I(I(ae("readonly",e),([t,n])=>I(j1(n),([r,i])=>[[t,r],i])),([t,n])=>[Lve(t),n]),ygt=e=>I(I(ae("|",e),([t,n])=>I(j1(n),([r,i])=>[[t,r],i])),([t,n])=>[Mve(t),n]),_gt=e=>I(I($B(e),([t,n])=>I(ae("=",n),([r,i])=>I(ln(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[Nve(t),n]),xgt=e=>I(I(I(ae("infer",e),([t,n])=>I(jr(n),([r,i])=>I(ae("extends",i),([o,a])=>I(j1(a),([c,u])=>[[t,r,o,c],u])))),([t,n])=>[t,n],()=>I(I(ae("infer",e),([t,n])=>I(jr(n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>[])),([t,n])=>[Dve(t),n]),ln=e=>I(I(xgt(e),([t,n])=>[t,n],()=>I(ygt(e),([t,n])=>[t,n],()=>I(ggt(e),([t,n])=>[t,n],()=>I(j1(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),vgt=e=>I(W1(e),([t,n])=>[$ve(t),n]),bgt=e=>I(jr(e),([t,n])=>[t,n]),wgt=e=>I(q1(["'",'"'],e),([t,n])=>[t,n]),Tgt=e=>I(I(ae("[",e),([t,n])=>I(jr(n),([r,i])=>I(ae(":",i),([o,a])=>I(I(pwe(a),([c,u])=>[c,u],()=>I(lwe(a),([c,u])=>[c,u],()=>I(uwe(a),([c,u])=>[c,u],()=>I(dwe(a),([c,u])=>[c,u],()=>[])))),([c,u])=>I(ae("]",u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[Fve(t),n]),xwe=e=>I(I(vgt(e),([t,n])=>[t,n],()=>I(bgt(e),([t,n])=>[t,n],()=>I(wgt(e),([t,n])=>[t,n],()=>I(Tgt(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),vwe=e=>I(I(I(ae("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Uve(t),n]),bwe=e=>I(I(I(ae("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Wve(t),n]),wwe=e=>I(I(vwe(e),([t,n])=>I(xwe(n),([r,i])=>I(bwe(i),([o,a])=>I(ae(":",a),([c,u])=>I(ln(u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[qve(t),n]),G1=e=>I(I(I(ae(",",e),([t,n])=>I(ae(`
348
348
  `,n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>I(I(ae(";",e),([t,n])=>I(ae(`
349
349
  `,n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>I(I(ae(",",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>I(I(ae(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>I(I(ae(`
350
350
  `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))))),([t,n])=>[t,n]),Twe=(e,t=[])=>I(I(G1(e),([n,r])=>I(wwe(r),([i,o])=>[[n,i],o])),([n,r])=>Twe(r,[...t,n]),()=>[t,e]),Igt=e=>I(I(I(wwe(e),([t,n])=>I(Twe(n),([r,i])=>I(I(G1(i),([o,a])=>[[o],a],()=>[[],i]),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[jve(t),n]),UB=e=>I(I(ae("{",e),([t,n])=>I(Igt(n),([r,i])=>I(ae("}",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[Bve(t),n]),kgt=e=>I(UB(e),([t,n])=>[Kve(t),n]),Egt=e=>I(I(I(jr(e),([t,n])=>I(ae("?",n),([r,i])=>I(ae(":",i),([o,a])=>I(ae("readonly",a),([c,u])=>I(ln(u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[t,n],()=>I(I(jr(e),([t,n])=>I(ae(":",n),([r,i])=>I(ae("readonly",i),([o,a])=>I(ln(a),([c,u])=>[[t,r,o,c],u])))),([t,n])=>[t,n],()=>I(I(jr(e),([t,n])=>I(ae("?",n),([r,i])=>I(ae(":",i),([o,a])=>I(ln(a),([c,u])=>[[t,r,o,c],u])))),([t,n])=>[t,n],()=>I(I(jr(e),([t,n])=>I(ae(":",n),([r,i])=>I(ln(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>[])))),([t,n])=>[Hve(t),n]),rwe=e=>I(I(Egt(e),([t,n])=>[t,n],()=>I(I(vwe(e),([t,n])=>I(ln(n),([r,i])=>I(bwe(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>[])),([t,n])=>[Vve(t),n]),Iwe=e=>I(I(I(ae("...",e),([t,n])=>I(rwe(n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>I(I(rwe(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[zve(t),n]),kwe=(e,t=[])=>I(I(ae(",",e),([n,r])=>I(Iwe(r),([i,o])=>[[n,i],o])),([n,r])=>kwe(r,[...t,n]),()=>[t,e]),Sgt=e=>I(I(I(Iwe(e),([t,n])=>I(kwe(n),([r,i])=>I(I(ae(",",i),([o,a])=>[[o],a],()=>[[],i]),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Jve(t),n]),Agt=e=>I(I(ae("[",e),([t,n])=>I(Sgt(n),([r,i])=>I(ae("]",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[Yve(t),n]),Rgt=e=>I(I(jr(e),([t,n])=>I(ae("?",n),([r,i])=>I(ae(":",i),([o,a])=>I(ae("readonly",a),([c,u])=>I(ln(u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[Xve(t),n]),Cgt=e=>I(I(jr(e),([t,n])=>I(ae(":",n),([r,i])=>I(ae("readonly",i),([o,a])=>I(ln(a),([c,u])=>[[t,r,o,c],u])))),([t,n])=>[Qve(t),n]),Ogt=e=>I(I(jr(e),([t,n])=>I(ae("?",n),([r,i])=>I(ae(":",i),([o,a])=>I(ln(a),([c,u])=>[[t,r,o,c],u])))),([t,n])=>[Zve(t),n]),Pgt=e=>I(I(jr(e),([t,n])=>I(ae(":",n),([r,i])=>I(ln(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[ebe(t),n]),iwe=e=>I(I(Rgt(e),([t,n])=>[t,n],()=>I(Cgt(e),([t,n])=>[t,n],()=>I(Ogt(e),([t,n])=>[t,n],()=>I(Pgt(e),([t,n])=>[t,n],()=>[])))),([t,n])=>[t,n]),Ewe=e=>I(I(I(ae("...",e),([t,n])=>I(iwe(n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>I(I(iwe(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[])),([t,n])=>[tbe(t),n]),Swe=(e,t=[])=>I(I(ae(",",e),([n,r])=>I(Ewe(r),([i,o])=>[[n,i],o])),([n,r])=>Swe(r,[...t,n]),()=>[t,e]),Awe=e=>I(I(I(Ewe(e),([t,n])=>I(Swe(n),([r,i])=>I(I(ae(",",i),([o,a])=>[[o],a],()=>[[],i]),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[nbe(t),n]),Lgt=e=>I(I(ae("(",e),([t,n])=>I(Awe(n),([r,i])=>I(ae(")",i),([o,a])=>I(ae("=>",a),([c,u])=>I(ln(u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[rbe(t),n]),Mgt=e=>I(I(ae("new",e),([t,n])=>I(ae("(",n),([r,i])=>I(Awe(i),([o,a])=>I(ae(")",a),([c,u])=>I(ae("=>",u),([l,d])=>I(ln(d),([m,h])=>[[t,r,o,c,l,m],h])))))),([t,n])=>[ibe(t),n]),Ngt=e=>I(I(I(ae("+",e),([t,n])=>I(ae("readonly",n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>I(I(ae("-",e),([t,n])=>I(ae("readonly",n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>I(I(ae("readonly",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[obe(t),n]),Dgt=e=>I(I(I(ae("+",e),([t,n])=>I(ae("?",n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>I(I(ae("-",e),([t,n])=>I(ae("?",n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>I(I(ae("?",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])))),([t,n])=>[abe(t),n]),$gt=e=>I(I(I(ae("as",e),([t,n])=>I(ln(n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[sbe(t),n]),Fgt=e=>I(I(ae("{",e),([t,n])=>I(Ngt(n),([r,i])=>I(ae("[",i),([o,a])=>I(jr(a),([c,u])=>I(ae("in",u),([l,d])=>I(ln(d),([m,h])=>I($gt(h),([y,b])=>I(ae("]",b),([x,w])=>I(Dgt(w),([E,C])=>I(ae(":",C),([L,M])=>I(ln(M),([N,P])=>I(cwe(P),([z,G])=>I(ae("}",G),([q,ve])=>[[t,r,o,c,l,m,y,x,E,L,N,z,q],ve]))))))))))))),([t,n])=>[cbe(t),n]),Ugt=e=>I(jr(e),([t,n])=>[ube(t),n]),Wgt=e=>I(LB(e),([t,n])=>[lbe(t),n]),qgt=e=>I(W1(e),([t,n])=>[pbe(t),n]),jgt=e=>I(I(ae("true",e),([t,n])=>[t,n],()=>I(ae("false",e),([t,n])=>[t,n],()=>[])),([t,n])=>[dbe(t),n]),Ggt=e=>I(q1(['"',"'"],e),([t,n])=>[t,n]),Bgt=e=>I(ae("null",e),([t,n])=>[mbe(t),n]),Kgt=e=>I(ae("undefined",e),([t,n])=>[void 0,n]),Rwe=e=>I(I(xwe(e),([t,n])=>I(ae(":",n),([r,i])=>I(WB(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[fbe(t),n]),Cwe=(e,t=[])=>I(I(G1(e),([n,r])=>I(Rwe(r),([i,o])=>[[n,i],o])),([n,r])=>Cwe(r,[...t,n]),()=>[t,e]),Hgt=e=>I(I(I(Rwe(e),([t,n])=>I(Cwe(n),([r,i])=>I(I(G1(i),([o,a])=>[[o],a],()=>[[],i]),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[hbe(t),n]),Owe=e=>I(I(ae("{",e),([t,n])=>I(Hgt(n),([r,i])=>I(ae("}",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[gbe(t),n]),Pwe=(e,t=[])=>I(I(ae(",",e),([n,r])=>I(WB(r),([i,o])=>[[n,i],o])),([n,r])=>Pwe(r,[...t,n]),()=>[t,e]),Vgt=e=>I(I(I(WB(e),([t,n])=>I(Pwe(n),([r,i])=>I(I(ae(",",i),([o,a])=>[[o],a],()=>[[],i]),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[ybe(t),n]),zgt=e=>I(I(ae("[",e),([t,n])=>I(Vgt(n),([r,i])=>I(ae("]",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[_be(t),n]),WB=e=>I(I(Wgt(e),([t,n])=>[t,n],()=>I(qgt(e),([t,n])=>[t,n],()=>I(jgt(e),([t,n])=>[t,n],()=>I(Ggt(e),([t,n])=>[t,n],()=>I(Bgt(e),([t,n])=>[t,n],()=>I(Kgt(e),([t,n])=>[t,n],()=>I(Owe(e),([t,n])=>[t,n],()=>I(zgt(e),([t,n])=>[t,n],()=>[])))))))),([t,n])=>[t,n]),Jgt=e=>I(ae("-?(?:0|[1-9][0-9]*)n",e),([t,n])=>[xbe(t),n]),Ygt=e=>I(ae(".*",e),([t,n])=>[vbe(t),n]),Xgt=e=>I(ae("-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?",e),([t,n])=>[bbe(t),n]),Qgt=e=>I(ae("-?(?:0|[1-9][0-9]*)",e),([t,n])=>[wbe(t),n]),Zgt=e=>I(ae("(?!)",e),([t,n])=>[Tbe(t),n]),eyt=e=>I(nwe(["-?(?:0|[1-9][0-9]*)n",".*","-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?","-?(?:0|[1-9][0-9]*)","(?!)","(",")","$","|"],e),([t,n])=>[Ibe(t),n]),tyt=e=>I(I(Jgt(e),([t,n])=>[t,n],()=>I(Ygt(e),([t,n])=>[t,n],()=>I(Xgt(e),([t,n])=>[t,n],()=>I(Qgt(e),([t,n])=>[t,n],()=>I(Zgt(e),([t,n])=>[t,n],()=>I(nyt(e),([t,n])=>[t,n],()=>I(eyt(e),([t,n])=>[t,n],()=>[]))))))),([t,n])=>[t,n]),nyt=e=>I(I(ae("(",e),([t,n])=>I(qB(n),([r,i])=>I(ae(")",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[kbe(t),n]),Lwe=e=>I(I(I(DB(e),([t,n])=>I(ae("|",n),([r,i])=>I(Lwe(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I(I(DB(e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[]))),([t,n])=>[Ebe(t),n]),DB=e=>I(I(tyt(e),([t,n])=>I(qB(n),([r,i])=>[[t,r],i])),([t,n])=>[Sbe(t),n]),qB=e=>I(I(Lwe(e),([t,n])=>[t,n],()=>I(DB(e),([t,n])=>[t,n],()=>[])),([t,n])=>[t,n]),sxe=e=>I(I(ae("^",e),([t,n])=>I(qB(n),([r,i])=>I(ae("$",i),([o,a])=>[[t,r,o],a]))),([t,n])=>[Abe(t),n]),Mwe=(e,t=[])=>I(I(ae(",",e),([n,r])=>I(ln(r),([i,o])=>[[n,i],o])),([n,r])=>Mwe(r,[...t,n]),()=>[t,e]),ryt=e=>I(I(I(ln(e),([t,n])=>I(Mwe(n),([r,i])=>I(I(ae(",",i),([o,a])=>[[o],a],()=>[[],i]),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Rbe(t),n]),Nwe=e=>I(I(I(ae("extends",e),([t,n])=>I(ryt(n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Cbe(t),n]),iyt=e=>I(I(ae("interface",e),([t,n])=>I(jr(n),([r,i])=>I($B(i),([o,a])=>I(Nwe(a),([c,u])=>I(UB(u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[Obe(t),n]),oyt=e=>I(I(ae("interface",e),([t,n])=>I(jr(n),([r,i])=>I(Nwe(i),([o,a])=>I(UB(a),([c,u])=>[[t,r,o,c],u])))),([t,n])=>[Pbe(t),n]),ayt=e=>I(I(ae("type",e),([t,n])=>I(jr(n),([r,i])=>I($B(i),([o,a])=>I(ae("=",a),([c,u])=>I(ln(u),([l,d])=>[[t,r,o,c,l],d]))))),([t,n])=>[Lbe(t),n]),syt=e=>I(I(ae("type",e),([t,n])=>I(jr(n),([r,i])=>I(ae("=",i),([o,a])=>I(ln(a),([c,u])=>[[t,r,o,c],u])))),([t,n])=>[Mbe(t),n]),cyt=e=>I(I(I(ae("export",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Nbe(t),n]),Dwe=e=>I(I(I(ae(";",e),([t,n])=>I(ae(`
351
351
  `,n),([r,i])=>[[t,r],i])),([t,n])=>[t,n],()=>I(I(ae(";",e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>I(I(ae(`
352
- `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),$we=(e,t=[])=>I(I(Dwe(e),([n,r])=>I(jB(r),([i,o])=>[[n,i],o])),([n,r])=>$we(r,[...t,n]),()=>[t,e]),uyt=e=>I(I(I(jB(e),([t,n])=>I($we(n),([r,i])=>I(I(Dwe(i),([o,a])=>[[o],a],()=>[[],i]),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Dbe(t),n]),jB=e=>I(I(cyt(e),([t,n])=>I(I(iyt(n),([r,i])=>[r,i],()=>I(oyt(n),([r,i])=>[r,i],()=>I(ayt(n),([r,i])=>[r,i],()=>I(syt(n),([r,i])=>[r,i],()=>[])))),([r,i])=>I(cwe(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[$be(t),n]),lyt=e=>I(I(jB(e),([t,n])=>I(uyt(n),([r,i])=>[[t,r],i])),([t,n])=>[Fbe(t),n]),Fwe=e=>I(I(lyt(e),([t,n])=>[t,n],()=>I(_gt(e),([t,n])=>[t,n],()=>I(ln(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function Uwe(e){let t=FB(`\`${e}\``);return S.IsEqual(t.length,2)?t[0]:yi()}function dyt(e){return e.join("|")}function myt(e){return e.slice(1,e.length-1)}function fyt(e,t,n){return Em(t,`${n}${e}`)}function hyt(e,t){return Em(e,`${t}${txe}`)}function gyt(e,t){return Em(e,`${t}${t1}`)}function yyt(e,t){return Em(e,`${t}${r1}`)}function _yt(e,t){return zT(Gt([Zt("false"),Zt("true")]),e,t)}function xyt(e,t){return Em(e,`${t}${i1}`)}function vyt(e,t,n){return Em(t,`${n}${myt(e)}`)}function byt(e,t,n){let r=JT(e,{});return zT(r,t,n)}function wyt(e,t,n){let r=zo(e);return zT(r,t,n)}function Wwe(e,t,n,r=[]){return S.ShiftLeft(e,(i,o)=>Wwe(o,t,n,[...r,zT(i,[],"")]),()=>Em(t,`${n}(${dyt(r)})`))}function zT(e,t,n){return uo(e)?wyt(e.enum,t,n):Ho(e)?gyt(t,n):In(e)?fyt(e.const,t,n):ul(e)?hyt(t,n):sc(e)?_yt(t,n):ai(e)?yyt(t,n):Vo(e)?xyt(t,n):qr(e)?vyt(e.pattern,t,n):jwe(e)?byt(e.parameters[0],t,n):rt(e)?Wwe(e.anyOf,t,n):D0e}function Em(e,t){return S.ShiftLeft(e,(n,r)=>zT(n,r,t),()=>t)}function Tyt(e){return`^${Em(e,"")}$`}function qwe(e){let t=Tyt(e);return a1(t)}function JT(e,t){return $t(e)?K.Update(qwe(e),{},t):g1(e,t)}function Gwe(e,t,n,r){let i=Ts(e,t,n);return JT(i,r)}function g1(e,t={}){return at("TemplateLiteral",[e],t)}function jwe(e){return gi(e)&&S.HasPropertyKey(e,"action")&&S.IsEqual(e.action,"TemplateLiteral")}function Bwe(e){return JT(e,{})}function Iyt(e){let t=Uwe(e);return Bwe(t)}function Kwe(e,t={}){let n=S.IsString(e)?Iyt(e):Bwe(e);return K.Update(n,{},t)}function qr(e){return Ze(e,"TemplateLiteral")}var At={};On(At,{ExtendsFalse:()=>Pt,ExtendsTrue:()=>Ve,ExtendsUnion:()=>GB,IsExtendsFalse:()=>kyt,IsExtendsTrue:()=>Vwe,IsExtendsTrueLike:()=>Cx,IsExtendsUnion:()=>Hwe,Match:()=>cr});function GB(e){return K.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Hwe(e){return S.IsObject(e)&&S.HasPropertyKey(e,"~kind")&&S.HasPropertyKey(e,"inferred")&&S.IsEqual(e["~kind"],"ExtendsUnion")&&S.IsObject(e.inferred)}function Ve(e){return K.Create({"~kind":"ExtendsTrue"},{inferred:e})}function Vwe(e){return S.IsObject(e)&&S.HasPropertyKey(e,"~kind")&&S.HasPropertyKey(e,"inferred")&&S.IsEqual(e["~kind"],"ExtendsTrue")&&S.IsObject(e.inferred)}function Pt(){return K.Create({"~kind":"ExtendsFalse"},{})}function kyt(e){return S.IsObject(e)&&S.HasPropertyKey(e,"~kind")&&S.IsEqual(e["~kind"],"ExtendsFalse")}function Cx(e){return Hwe(e)||Vwe(e)}function cr(e,t,n){return Cx(e)?t(e.inferred):n()}function Eyt(e,t,n,r){return cr(an(e,n,r),i=>Ve(K.Assign(K.Assign(e,i),{[t]:n})),()=>Pt())}function Syt(e,t){return Ve(e)}function Ayt(e,t,n,r,i){return cr(an(e,t,n),o=>cr(an(o,t,r),a=>Ve(a),()=>Pt()),()=>cr(an(e,t,i),o=>Ve(o),()=>Pt()))}function Ryt(e,t,n){let r=zo(n);return an(e,t,r)}function zwe(e,t,n){return S.ShiftLeft(n,(r,i)=>cr(an(e,t,r),o=>zwe(o,t,i),()=>Pt()),()=>Ve(e))}function Cyt(e,t,n){let r=Ro(n);return an(e,t,r)}function Jwe(e,t,n){return S.ShiftLeft(n,(r,i)=>cr(an(e,t,r),o=>Ve(o),()=>Jwe(e,t,i)),()=>Pt())}function kn(e,t,n){return Er(n)?Syt(e,t):Wr(n)?Ayt(e,t,n.if,n.then,n.else):uo(n)?Ryt(e,t,n.enum):Jr(n)?Eyt(e,n.name,t,n.extends):Qt(n)?zwe(e,t,n.allOf):qr(n)?Cyt(e,t,n.pattern):rt(n)?Jwe(e,t,n.anyOf):zr(n)?Ve(e):Pt()}function Ywe(e,t,n){return Jr(n)?kn(e,t,n):Er(n)?Ve(e):zr(n)?Ve(e):GB(e)}function Oyt(e,t){let n=Lh(e),r=Lh(t);return n&&r||!n&&r?!0:!(n&&!r)}function Xwe(e,t,n,r){return hr(r)?Oyt(t,r)?an(e,n,r.items):Pt():kn(e,t,r)}function Qwe(e,t,n){return ul(n)?Ve(e):kn(e,t,n)}function Zwe(e,t,n){return sc(n)?Ve(e):kn(e,t,n)}function Pyt(e,t,n,r,i){let o=Jr(r)?t:r,a=Jr(r)?r:t,c=Ao(t),u=Ao(r);return!c&&u?Pt():cr(an(e,o,a),l=>YT(l,n,i),()=>Pt())}function Lyt(e,t,n,r){return S.ShiftLeft(r,(i,o)=>Pyt(e,t,n,i,o),()=>Ao(t)?Ve(e):Pt())}function Myt(e,t,n){return S.ShiftLeft(t,(r,i)=>Lyt(e,r,i,n),()=>Ve(e))}function YT(e,t,n){return Myt(e,t,n)}function B1(e,t,n){return ll(n)?Ve(e):an(e,t,n)}function eTe(e,t,n,r){return Er(r)?Ve(e):zr(r)?Ve(e):Li(r)?cr(YT(e,t,r.parameters),i=>B1(i,n,r.instanceType),()=>Pt()):Pt()}function tTe(e,t,n,r,i){return cr(an(e,t,i),()=>an(e,n,i),()=>an(e,r,i))}function nTe(e,t,n){let r=zo(t);return an(e,r,n)}function rTe(e,t,n,r){return Er(r)?Ve(e):zr(r)?Ve(e):Mi(r)?cr(YT(e,t,r.parameters),i=>B1(i,n,r.returnType),()=>Pt()):Pt()}function iTe(e,t,n){return Ho(n)?Ve(e):ai(n)?Ve(e):kn(e,t,n)}function oTe(e,t,n){let r=gr(t);return an(e,r,n)}function K1(e,t,n){return t===n?Ve(e):Pt()}function Nyt(e,t,n){return In(n)?K1(e,t,n.const):ul(n)?Ve(e):kn(e,Zt(t),n)}function Dyt(e,t,n){return In(n)?K1(e,t,n.const):sc(n)?Ve(e):kn(e,Zt(t),n)}function $yt(e,t,n){return In(n)?K1(e,t,n.const):ai(n)?Ve(e):kn(e,Zt(t),n)}function Fyt(e,t,n){return In(n)?K1(e,t,n.const):Vo(n)?Ve(e):kn(e,Zt(t),n)}function aTe(e,t,n){return S.IsBigInt(t.const)?Nyt(e,t.const,n):S.IsBoolean(t.const)?Dyt(e,t.const,n):S.IsNumber(t.const)?$yt(e,t.const,n):S.IsString(t.const)?Fyt(e,t.const,n):yi()}function sTe(e,t,n){return Jr(n)?kn(e,t,n):Ve(e)}function cTe(e,t,n){return vx(n)?Ve(e):kn(e,t,n)}function uTe(e,t,n){return ai(n)?Ve(e):kn(e,t,n)}function Uyt(e,t,n){return Ao(t)?Ao(n)?Ve(e):Pt():Ve(e)}function Wyt(e,t,n){return Jr(n)&&uu(n.extends)?Pt():cr(an(e,t,n),r=>Uyt(r,t,n),()=>Pt())}function qyt(e,t){return e.reduce((n,r)=>r in t?Cx(t[r])?{...n,...t[r].inferred}:yi():yi(),{})}function jyt(e,t,n){let r={};for(let a of S.Keys(n))r[a]=a in t?Wyt({},t[a],n[a]):Ao(n[a])?Jr(n[a])?Ve(K.Assign(e,{[n[a].name]:n[a].extends})):Ve(e):Pt();let i=S.Values(r).every(a=>Cx(a)),o=i?qyt(S.Keys(r),r):{};return i?Ve(o):Pt()}function Gyt(e,t,n){let r=jyt(e,t,n);return Cx(r)?Ve(K.Assign(e,r.inferred)):Pt()}function Byt(e,t,n){return Gyt(e,t,n)}function Kyt(e,t){return S.Keys(t).reduce((n,r)=>({...n,[r]:S.HasPropertyKey(e,r)?rt(n[r])?Gt([...n[r].anyOf,t[r]]):Gt([e[r],t[r]]):t[r]}),e)}function lTe(e,t,n,r){return S.ShiftLeft(t,(i,o)=>cr(an({},e[i],n),a=>lTe(e,o,n,Kyt(r,a)),()=>Pt()),()=>Ve(r))}function Hyt(e,t,n,r){let i=S.Keys(t);return lTe(t,i,r,e)}function pTe(e,t,n){return po(n)?Hyt(e,t,lc(n),Jo(n)):Tn(n)?Byt(e,t,n.properties):kn(e,St(t),n)}function Vyt(e,t){return S.IsEqual(S.Keys(t).length,0)?Ve(e):Pt()}function zyt(e,t,n,r,i){return an(e,n,i)}function dTe(e,t,n,r){return po(r)?zyt(e,d1(t),n,d1(lc(r)),Jo(r)):Tn(r)?Vyt(e,r.properties):Er(r)?Ve(e):zr(r)?Ve(e):Pt()}function mTe(e,t,n){return Vo(n)?Ve(e):kn(e,t,n)}function fTe(e,t,n){return xm(n)?Ve(e):kn(e,t,n)}function hTe(e,t,n){let r=Ro(t);return an(e,r,n)}function BB(e,t){return K.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function XT(e){return S.IsObject(e)&&S.HasPropertyKey(e,"~kind")&&S.HasPropertyKey(e,"name")&&S.HasPropertyKey(e,"type")&&S.IsEqual(e["~kind"],"Inferrable")&&S.IsString(e.name)&&S.IsObject(e.type)}function KB(e){return Tm(e)?Jr(e.items)?hr(e.items.extends)?BB(e.items.name,e.items.extends.items):zr(e.items.extends)?BB(e.items.name,e.items.extends):void 0:yi():void 0}function H1(e){return Jr(e)?BB(e.name,e.extends):void 0}function HB(e,t,n=[]){return S.ShiftLeft(e,(r,i)=>cr(an({},r,t),()=>HB(i,t,[...n,r]),()=>{}),()=>n)}function gTe(e,t,n,r){let i=HB(n,r);return S.IsArray(i)?Ve(K.Assign(e,{[t]:si(i)})):Pt()}function V1(e,t,n,r){let i=HB(n,r);return S.IsArray(i)?Ve(K.Assign(e,{[t]:Gt(i)})):Pt()}function Jyt(e){return[...e].reverse()}function VB(e,t){return t?Jyt(e):e}function Yyt(e){let t=e.length>0?e[0]:void 0,n=gi(t)?KB(t):void 0;return gi(n)}function Xyt(e,t,n,r,i,o){return cr(an(e,n,i),a=>yTe(a,t,r,o),()=>Pt())}function Qyt(e,t,n,r,i){let o=KB(r);return XT(o)?gTe(e,o.name,VB(n,t),o.type):S.ShiftLeft(n,(a,c)=>Xyt(e,t,a,c,r,i),()=>Pt())}function Zyt(e,t,n,r){return S.ShiftLeft(r,(i,o)=>Qyt(e,t,n,i,o),()=>S.IsEqual(n.length,0)?Ve(e):Pt())}function yTe(e,t,n,r){return Zyt(e,t,n,r)}function e_t(e,t,n){let r=Sm(e,nr([],[]),n),i=Yyt(r);return yTe(e,i,VB(t,i),VB(r,i))}function _Te(e,t,n){let r=H1(n);return XT(r)?V1(e,r.name,t,r.type):S.ShiftLeft(t,(i,o)=>cr(an(e,i,n),a=>_Te(a,o,n),()=>Pt()),()=>Ve(e))}function xTe(e,t,n){let r=Sm(e,nr([],[]),t);return Xn(n)?e_t(e,r,n.items):hr(n)?_Te(e,r,n.items):kn(e,si(r),n)}function vTe(e,t,n){return ll(n)?Ve(e):Ex(n)?Ve(e):kn(e,t,n)}function bTe(e,t,n){return S.ShiftLeft(n,(r,i)=>cr(an(e,t,r),o=>Ve(o),()=>bTe(e,t,i)),()=>Pt())}function zB(e,t,n){return S.ShiftLeft(t,(r,i)=>cr(bTe(e,r,n),o=>zB(o,i,n),()=>Pt()),()=>Ve(e))}function wTe(e,t,n){let r=H1(n);return XT(r)?V1(e,r.name,t,r.type):rt(n)?zB(e,t,n.anyOf):zB(e,t,[n])}function TTe(e,t,n){return Jr(n)?kn(e,t,n):Er(n)?Ve(e):zr(n)?Ve(e):Pt()}function ITe(e,t,n){return ll(n)?Ve(e):kn(e,t,n)}function an(e,t,n){return Er(t)?Ywe(e,t,n):hr(t)?Xwe(e,t,t.items,n):ul(t)?Qwe(e,t,n):sc(t)?Zwe(e,t,n):Li(t)?eTe(e,t.parameters,t.instanceType,n):Wr(t)?tTe(e,t.if,t.then,t.else,n):uo(t)?nTe(e,t.enum,n):Mi(t)?rTe(e,t.parameters,t.returnType,n):Ho(t)?iTe(e,t,n):Qt(t)?oTe(e,t.allOf,n):In(t)?aTe(e,t,n):uu(t)?sTe(e,t,n):vx(t)?cTe(e,t,n):ai(t)?uTe(e,t,n):Tn(t)?pTe(e,t.properties,n):po(t)?dTe(e,lc(t),Jo(t),n):Vo(t)?mTe(e,t,n):xm(t)?fTe(e,t,n):qr(t)?hTe(e,t.pattern,n):Xn(t)?xTe(e,t.items,n):Ex(t)?vTe(e,t,n):rt(t)?wTe(e,t.anyOf,n):zr(t)?TTe(e,t,n):ll(t)?ITe(e,t,n):Pt()}function t_t(e,t){return gr([...e,St(t)])}function JB(e,t,n){return $t(e)?K.Update(t_t(e,t),{},n):GT(e,t,n)}function kTe(e,t,n,r,i){let o=Ts(e,t,n),a=QT(e,t,r);return JB(o,a,i)}function GT(e,t,n={}){return at("Interface",[e,t],n)}function Ox(e){return gi(e)&&S.HasPropertyKey(e,"action")&&S.IsEqual(e.action,"Interface")}function ETe(e,t,n={}){return JB(e,t,n)}function n_t(e,t,n){return e.includes(n)?!0:ZT([...e,n],t,t[n])}function STe(e,t,n){let r=YP(n);return Wh(e,t,r)}function Wh(e,t,n){return S.ShiftLeft(n,(r,i)=>ZT(e,t,r)?!0:Wh(e,t,i),()=>!1)}function ZT(e,t,n){return Ni(n)?n_t(e,t,n.$ref):hr(n)?ZT(e,t,n.items):Li(n)?Wh(e,t,[...n.parameters,n.instanceType]):Mi(n)?Wh(e,t,[...n.parameters,n.returnType]):Ox(n)?STe(e,t,n.parameters[1]):Qt(n)?Wh(e,t,n.allOf):Tn(n)?STe(e,t,n.properties):rt(n)?Wh(e,t,n.anyOf):Xn(n)?Wh(e,t,n.items):po(n)?ZT(e,t,Jo(n)):!1}function ATe(e,t,n){return ZT(e,t,n)}function r_t(e,t){return t.reduce((n,r)=>ATe([r],e,e[r])?[...n,r]:n,[])}function RTe(e){let t=JP(e);return r_t(e,t)}function i_t(e,t,n){return n.includes(t)?n:t in e?eI(e,e[t],[...n,t]):yi()}function CTe(e,t,n){let r=YP(t);return Px(e,r,n)}function Px(e,t,n){return t.reduce((r,i)=>eI(e,i,r),n)}function eI(e,t,n){return Ni(t)?i_t(e,t.$ref,n):hr(t)?eI(e,t.items,n):Li(t)?Px(e,[...t.parameters,t.instanceType],n):Mi(t)?Px(e,[...t.parameters,t.returnType],n):Ox(t)?CTe(e,t.parameters[1],n):Qt(t)?Px(e,t.allOf,n):Tn(t)?CTe(e,t.properties,n):rt(t)?Px(e,t.anyOf,n):Xn(t)?Px(e,t.items,n):po(t)?eI(e,Jo(t),n):n}function OTe(e,t,n){return eI(e,n,[t])}function o_t(e){return yx()}function a_t(e){return S.Keys(e).reduce((t,n)=>({...t,[n]:qh(e[n])}),{})}function tI(e){return e.reduce((t,n)=>[...t,qh(n)],[])}function qh(e){return Ni(e)?o_t(e.$ref):hr(e)?ws(qh(e.items),zP(e)):Li(e)?rl(tI(e.parameters),qh(e.instanceType)):Mi(e)?il(tI(e.parameters),qh(e.returnType)):Qt(e)?fa(tI(e.allOf)):Tn(e)?St(a_t(e.properties)):po(e)?p1(Ix(e),qh(Jo(e))):rt(e)?Gt(tI(e.anyOf)):Xn(e)?si(tI(e.items)):e}function s_t(e,t){return t in e?qh(e[t]):Ki()}function PTe(e){return s_t(e.$defs,e.$ref)}function c_t(e,t,n){let r=Ts(e,nr([],[]),t),i=QT({},nr([],[]),n);return gr([...r,St(i)])}function u_t(e,t){return S.Keys(e).filter(r=>t.includes(r)).reduce((r,i)=>{let o=e[i],a=Ox(o)?c_t(e,o.parameters[0],o.parameters[1]):o;return{...r,[i]:a}},{})}function LTe(e,t,n){let r=OTe(e,t,n),i=u_t(e,r);return al(i,t)}function MTe(e,t){return t in e?Ni(e[t])?MTe(e,e[t].$ref):e[t]:Fn()}function pl(e,t){return MTe(e,t)}function NTe(e){return co(e)?PTe(e):XP(e)?Ki():e}function lo(e,t,n){let r=NTe(t),i=NTe(n);return an(e,r,i)}var FT=0,z1=1,UT=2,c1=3;function WT(e,t){let n=[lo({},e,t),lo({},t,e)];return At.IsExtendsTrueLike(n[0])&&At.IsExtendsTrueLike(n[1])?FT:At.IsExtendsTrueLike(n[0])&&At.IsExtendsFalse(n[1])?UT:At.IsExtendsFalse(n[0])&&At.IsExtendsTrueLike(n[1])?c1:z1}function YB(e,t,n=[],r=t){return S.ShiftLeft(t,(i,o)=>{let a=WT(e,i);return S.IsEqual(a,UT)||S.IsEqual(a,FT)?r:S.IsEqual(a,z1)?YB(e,o,[...n,i],r):YB(e,o,n,r)},()=>[...n,e])}function l_t(e,t,n){let r=uc(e);return Er(r)?[r]:zr(r)?[r]:uu(r)?J1(t,n):Tn(r)?J1(t,[...n,r]):J1(t,YB(r,n))}function J1(e,t=[]){return S.ShiftLeft(e,(n,r)=>l_t(n,r,t),()=>t)}function SB(e){let t=J1(e);return Tx(t)}function XB(e,t){return K.Update(uc(e),{},t)}function DTe(e,t,n,r){let i=Me(e,t,n);return XB(i,r)}function nI(e,t=[]){return ym(e)&&S.IsEqual(e.action,"Conditional")?Ni(e.parameters[0])?nI(e.parameters[2],nI(e.parameters[3],[...t,e.parameters[0].$ref])):nI(e.parameters[2],nI(e.parameters[3],t)):ym(e)&&S.IsEqual(e.action,"Mapped")&&ym(e.parameters[1])&&S.IsEqual(e.parameters[1].action,"KeyOf")&&Ni(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function p_t(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function UTe(e,t,n=[]){return S.ShiftLeft(e,(r,i)=>S.ShiftLeft(t,(o,a)=>UTe(i,a,[...n,[o,r]]),()=>n),()=>n)}function d_t(e){return qr(e)?Ro(e.pattern):uo(e)?zo(e.enum):e}function m_t(e){let t=d_t(e);return rt(t)?[...t.anyOf]:[t]}function f_t(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function $Te(e,t){return t.reduce((n,r)=>[...n,...f_t(e,r)],[])}function FTe(e){return e.reduce((t,n)=>S.IsEqual(n[0],!0)?$Te(t,m_t(n[1])):$Te(t,[n[1]]),[[]])}function WTe(e,t,n){let r=nI(n),i=p_t(e,r),o=UTe(t,i);return ym(n)&&S.IsEqual(n.action,"Conditional")||ym(n)&&S.IsEqual(n.action,"Mapped")?FTe(o):[t]}function h_t(){return["(not-resolvable)",Fn()]}function g_t(){return["(not-generic)",Fn()]}function y_t(e,t,n){return[e,_m(t,n)]}function __t(e,t,n){return t in e?qTe(e,t,e[t],n):h_t()}function qTe(e,t,n,r){return gx(n)?y_t(t,n.parameters,n.expression):Ni(n)?__t(e,n.$ref,r):g_t()}function jTe(e,t,n){return qTe(e,"(anonymous)",t,n)}function x_t(e,t,n){if(Jr(t)||Lx(t)||At.IsExtendsTrueLike(lo({},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 GTe(e,t,n,r,i){let o=Me(e,t,i);return x_t(n,o,r),K.Assign(e,{[n]:o})}function v_t(e,t,n,r,i){let o=Me(e,t,n.extends),a=Me(e,t,n.equals);return S.ShiftLeft(i,(c,u)=>QB(GTe(e,t,n.name,o,c),t,r,u),()=>QB(GTe(e,t,n.name,o,a),t,r,[]))}function QB(e,t,n,r){return S.ShiftLeft(n,(i,o)=>v_t(e,t,i,o,r),()=>e)}function BTe(e,t,n,r){return QB(e,t,n,r)}var ZB=0,e4=0;function b_t(){if(!S.IsLessThan(e4,Sp.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function w_t(){b_t(),e4++,ZB++}function T_t(){ZB--,S.IsEqual(ZB,0)&&(e4=0)}function I_t(e){return S.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function k_t(e,t){return S.IsEqual(I_t(e),t)}function E_t(e,t,n,r,i,o){w_t();try{let a=BTe(e,t,r,o),c=Me(a,nr([...t.callstack,n.$ref],t.visited),i);return Me(a,nr([],[]),c)}finally{T_t()}}function S_t(e,t,n,r,i,o){return o.reduce((a,c)=>{let u=E_t(e,t,n,r,i,c);return[...a,u]},[])}function A_t(e,t,n,r,i,o){let a=WTe(r,o,i),c=S_t(e,t,n,r,i,a);return S.IsEqual(c.length,1)?c[0]:ga(c)}function Y1(e,t,n,r){let i=Ts(e,t,r),o=jTe(e,n,r),a=o[0],c=o[1];return gx(c)?k_t(t,a)?BT(Ap(a),i):A_t(e,t,Ap(a),c.parameters,c.expression,i):BT(n,i)}function BT(e,t){return K.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function KTe(e,t){return Y1({},nr([],[]),e,t)}function Lx(e){return Ze(e,"Call")}function R_t(e){return K.Discard(e,["~immutable"])}function HTe(e,t){return K.Update(R_t(e),{},t)}function VTe(e,t,n,r){let i=Me(e,t,n);return HTe(i,r)}function zTe(e,t){return e(t)}function JTe(e,t){return S.IsString(t)?Zt(zTe(e,t)):Zt(t)}function YTe(e,t){let n=Ro(t);return Cp(e,n)}function XTe(e,t){let n=t.map(r=>Cp(e,r));return Gt(n)}function Cp(e,t){return In(t)?JTe(e,t.const):qr(t)?YTe(e,t.pattern):rt(t)?XTe(e,t.anyOf):t}function y1(e,t={}){return at("Capitalize",[e],t)}function QTe(e,t={}){return t4(e,t)}function _1(e,t={}){return at("Lowercase",[e],t)}function ZTe(e,t={}){return n4(e,t)}function x1(e,t={}){return at("Uncapitalize",[e],t)}function eIe(e,t={}){return r4(e,t)}function v1(e,t={}){return at("Uppercase",[e],t)}function tIe(e,t={}){return i4(e,t)}var C_t=e=>e[0].toUpperCase()+e.slice(1),O_t=e=>e.toLowerCase(),P_t=e=>e[0].toLowerCase()+e.slice(1),L_t=e=>e.toUpperCase();function t4(e,t){return $t([e])?K.Update(Cp(C_t,e),{},t):y1(e,t)}function n4(e,t){return $t([e])?K.Update(Cp(O_t,e),{},t):_1(e,t)}function r4(e,t){return $t([e])?K.Update(Cp(P_t,e),{},t):x1(e,t)}function i4(e,t){return $t([e])?K.Update(Cp(L_t,e),{},t):v1(e,t)}function nIe(e,t,n,r){let i=Me(e,t,n);return t4(i,r)}function rIe(e,t,n,r){let i=Me(e,t,n);return n4(i,r)}function iIe(e,t,n,r){let i=Me(e,t,n);return r4(i,r)}function oIe(e,t,n,r){let i=Me(e,t,n);return i4(i,r)}function b1(e,t,n,r,i={}){return at("Conditional",[e,t,n,r],i)}function aIe(e,t,n,r,i={}){return o4({},nr([],[]),e,t,n,r,i)}function M_t(e,t,n,r,i,o){let a=lo(e,n,r);return At.IsExtendsUnion(a)?Gt([Me(a.inferred,t,i),Me(e,t,o)]):At.IsExtendsTrue(a)?Me(a.inferred,t,i):Me(e,t,o)}function o4(e,t,n,r,i,o,a){return $t([n,r])?K.Update(M_t(e,t,n,r,i,o),{},a):b1(n,r,i,o,a)}function sIe(e,t,n,r,i,o,a){let c=Me(e,t,n),u=Me(e,t,r);return o4(e,t,c,u,i,o,a)}function w1(e,t={}){return at("ConstructorParameters",[e],t)}function cIe(e,t={}){return a4(e,t)}function N_t(e){let t=Li(e)?e.parameters:[],n=Sm({},nr([],[]),t);return si(n)}function a4(e,t){return $t([e])?K.Update(N_t(e),{},t):w1(e,t)}function uIe(e,t,n,r){let i=Me(e,t,n);return a4(i,r)}function T1(e,t,n={}){return at("Exclude",[e,t],n)}function lIe(e,t,n={}){return rI(e,t,n)}function rI(e,t,n){return $t([e,t])?K.Update(u1(e,t),{},n):T1(e,t,n)}function pIe(e,t,n,r,i){let o=Me(e,t,n),a=Me(e,t,r);return rI(o,a,i)}function I1(e,t,n={}){return at("Extract",[e,t],n)}function dIe(e,t,n={}){return s4(e,t,n)}function D_t(e,t){let n=lo({},e,t);return At.IsExtendsTrueLike(n)?[e]:[]}function mIe(e,t,n=[]){return S.ShiftLeft(e,(r,i)=>mIe(i,t,[...n,...D_t(r,t)]),()=>n)}function fIe(e,t){let n=uc(e),r=rt(n)?n.anyOf:[n],i=mIe(r,t);return ga(i)}function s4(e,t,n){return $t([e,t])?K.Update(fIe(e,t),{},n):I1(e,t,n)}function hIe(e,t,n,r,i){let o=Me(e,t,n),a=Me(e,t,r);return s4(o,a,i)}function $_t(e){return e.reduce((t,n)=>n1(n)?[...t,Zt(n)]:t,[])}function Mx(e){let t=$_t(e);return Gt(t)}function KT(e,t,n={}){return at("Index",[e,t],n)}function gIe(e,t,n={}){let r=S.IsArray(t)?Mx(t):t;return c4(e,r,n)}function yIe(e,t){let n=pl(e,t);return Is(n)}function _Ie(e,t,n){let r=pu(e,t,n);return Is(r)}function F_t(e,t){let n=S.Keys(e).filter(d=>!S.HasPropertyKey(t,d)),r=S.Keys(t).filter(d=>!S.HasPropertyKey(e,d)),i=S.Keys(e).filter(d=>S.HasPropertyKey(t,d)),o=n.reduce((d,m)=>({...d,[m]:e[m]}),{}),a=r.reduce((d,m)=>({...d,[m]:t[m]}),{}),c=i.reduce((d,m)=>({...d,[m]:gr([e[m],t[m]])}),{}),u=K.Assign(o,a);return K.Assign(u,c)}function xIe(e){return e.reduce((t,n)=>F_t(t,Is(n)),{})}function vIe(e){let t=Txe(si(e));return Is(t)}function U_t(e,t){return S.Keys(e).filter(i=>i in t).reduce((i,o)=>({...i,[o]:ga([e[o],t[o]])}),{})}function bIe(e,t){return S.ShiftLeft(e,(n,r)=>bIe(r,U_t(t,Is(n))),()=>t)}function wIe(e){return S.ShiftLeft(e,(t,n)=>bIe(n,Is(t)),()=>yi())}function Is(e){return co(e)?yIe(e.$defs,e.$ref):Wr(e)?_Ie(e.if,e.then,e.else):Qt(e)?xIe(e.allOf):rt(e)?wIe(e.anyOf):Xn(e)?vIe(e.items):Tn(e)?e.properties:{}}function Nx(e){let t=Is(e);return St(t)}var W_t=new RegExp("^(?:0|[1-9][0-9]*)$");function Dx(e){let t=`${e}`;return W_t.test(t)?parseInt(t):e}function q_t(e){return Zt(Dx(e))}function TIe(e){return e.map(t=>IIe(t))}function IIe(e){return Qt(e)?fa(TIe(e.allOf)):rt(e)?Gt(TIe(e.anyOf)):In(e)?q_t(e.const):e}function kIe(e,t){let n=IIe(t),r=lo({},n,Ba());return At.IsExtendsTrueLike(r)?e:In(t)&&S.IsEqual(t.const,"length")?Ba():Fn()}function EIe(e,t){let n=pl(e,t);return Ka(n)}function SIe(e,t,n){let r=pu(e,t,n);return Ka(r)}function AIe(e){let t=zo(e);return Ka(t)}function RIe(e){let t=gr(e);return Ka(t)}function CIe(e){return[`${e}`]}function OIe(e){let t=Ro(e);return Ka(t)}function PIe(e){return e.reduce((t,n)=>[...t,...Ka(n)],[])}function Ka(e){return co(e)?EIe(e.$defs,e.$ref):Wr(e)?SIe(e.if,e.then,e.else):uo(e)?AIe(e.enum):Qt(e)?RIe(e.allOf):In(e)?CIe(e.const):qr(e)?OIe(e.pattern):rt(e)?PIe(e.anyOf):[]}function $x(e){return Ka(e)}function iI(e,t){return t.map(n=>oI(e,n))}function oI(e,t){return hr(t)?ws(oI(e,t.items)):Li(t)?rl(iI(e,t.parameters),oI(e,t.instanceType)):Mi(t)?il(iI(e,t.parameters),oI(e,t.returnType)):Xn(t)?si(iI(e,t.items)):rt(t)?Gt(iI(e,t.anyOf)):Qt(t)?fa(iI(e,t.allOf)):f1(t)?St(e):t}function LIe(e,t){return oI(e,t)}function j_t(e,t){let n=t in e?e[t]:Fn();return LIe(e,n)}function MIe(e,t){return t.reduce((n,r)=>[...n,j_t(e,r)],[])}function G_t(e,t){let n=$x(t),r=MIe(e,n);return ga(r)}var B_t=new RegExp(wm);function K_t(e){return e.filter(n=>B_t.test(n))}function H_t(e){let t=JP(e),n=K_t(t),r=MIe(e,n);return ga(r)}function NIe(e,t){return ai(t)?H_t(e):G_t(e,t)}function V_t(e){return Zt(Dx(e))}function DIe(e){return e.map(t=>u4(t))}function u4(e){return Qt(e)?fa(DIe(e.allOf)):rt(e)?Gt(DIe(e.anyOf)):In(e)?V_t(e.const):e}function z_t(e,t){return e.reduceRight((n,r,i)=>{let o=lo({},Zt(i),t);return At.IsExtendsTrueLike(o)?[r,...n]:n},[])}function J_t(e,t){let n=u4(t),r=z_t(e,n);return vm(r)}function Y_t(e){return vm(e)}function $Ie(e,t){return In(t)&&S.IsEqual(t.const,"length")?Zt(e.length):ai(t)||Ho(t)?Y_t(e):J_t(e,t)}function FIe(e,t){return hr(e)?kIe(e.items,t):Tn(e)?NIe(e.properties,t):Xn(e)?$Ie(e.items,t):Fn()}function X_t(e){return co(e)||Wr(e)||Qt(e)||rt(e)?Nx(e):e}function c4(e,t,n){return $t([e,t])?K.Update(FIe(X_t(e),t),{},n):KT(e,t,n)}function UIe(e,t,n,r,i){let o=Me(e,t,n),a=Me(e,t,r);return c4(o,a,i)}function k1(e,t={}){return at("InstanceType",[e],t)}function WIe(e,t={}){return l4(e,t)}function Q_t(e){return Li(e)?e.instanceType:Fn()}function l4(e,t){return $t([e])?K.Update(Q_t(e),{},t):k1(e,t)}function qIe(e,t,n,r={}){let i=Me(e,t,n);return l4(i,r)}function HT(e,t={}){return at("KeyOf",[e],t)}function jIe(e,t={}){return p4(e,t)}function GIe(){return Gt([Ba(),cc(),bx()])}function BIe(e){return Ba()}function Z_t(e){return e.reduce((n,r)=>n1(r)?[...n,Zt(Dx(r))]:yi(),[])}function KIe(e){let t=S.Keys(e),n=Z_t(t);return vm(n)}function HIe(e){return Ix(e)}function VIe(e){let t=e.map((n,r)=>Zt(r));return vm(t)}function zIe(e){return Er(e)?GIe():hr(e)?BIe(e.items):Tn(e)?KIe(e.properties):po(e)?HIe(e):Xn(e)?VIe(e.items):Fn()}function e0t(e){return co(e)||Wr(e)||Qt(e)||rt(e)?Nx(e):e}function p4(e,t){return $t([e])?K.Update(zIe(e0t(e)),{},t):HT(e,t)}function JIe(e,t,n,r){let i=Me(e,t,n);return p4(i,r)}function jT(e,t,n,r,i={}){return at("Mapped",[e,t,n,r],i)}function YIe(e,t,n,r,i={}){return d4({},nr([],[]),e,t,n,r,i)}function t0t(e){let t=Ro(e);return X1(t)}function n0t(e){return e.reduce((t,n)=>[...t,...X1(n)],[])}function r0t(e){let t=zo(e);return X1(t)}function i0t(e){return S.IsNumber(e)?[Zt(`${e}`)]:[Zt(e)]}function X1(e){return uo(e)?r0t(e.enum):In(e)?i0t(e.const):qr(e)?t0t(e.pattern):rt(e)?n0t(e.anyOf):[e]}function XIe(e){return X1(e)}function o0t(e){return qr(e)?Ro(e.pattern):e}function a0t(e,t,n,r,i,o){let a=K.Assign(e,{[n.name]:r}),c=Me(a,t,i),u=o0t(c),l=Me(a,t,o);return rxe(u)||ixe(u)?{[u.const]:l}:{}}function s0t(e,t,n,r,i,o){return r.reduce((a,c)=>[...a,a0t(e,t,n,c,i,o)],[])}function c0t(e){return e.reduce((t,n)=>[...t,St(n)],[])}function QIe(e,t,n,r,i,o){let a=XIe(r),c=s0t(e,t,n,a,i,o),u=c0t(c);return gr(u)}function d4(e,t,n,r,i,o,a){return $t([r])?K.Update(QIe(e,t,n,r,i,o),{},a):jT(n,r,i,o,a)}function ZIe(e,t,n,r,i,o,a){let c=Me(e,t,r);return d4(e,t,n,c,i,o,a)}function u0t(e,t,n){let r=K.Assign(e,t);return S.Keys(t).filter(o=>n.includes(o)).reduce((o,a)=>({...o,[a]:LTe(r,a,t[a])}),{})}function l0t(e,t,n){let r=K.Assign(e,t);return S.Keys(t).filter(o=>!n.includes(o)).reduce((o,a)=>({...o,[a]:Me(r,nr([],[]),t[a])}),{})}function p0t(e,t,n){let r=RTe(t),i=u0t(e,t,r),o=l0t(e,t,r),a={...i,...o};return K.Update(a,{},n)}function Q1(e,t,n,r){return p0t(e,n,r)}function E1(e,t={}){return at("NonNullable",[e],t)}function eke(e,t={}){return m4(e,t)}function d0t(e){let t=Gt([xx(),kx()]);return rI(e,t,{})}function m4(e,t){return $t([e])?K.Update(d0t(e),{},t):E1(e,t)}function tke(e,t,n,r){let i=Me(e,t,n);return m4(i,r)}function S1(e,t,n={}){return at("Omit",[e,t],n)}function nke(e,t,n={}){let r=S.IsArray(t)?Mx(t):t;return f4(e,r,n)}function Z1(e){let t=Nx(e);return Tn(t)?t.properties:yi()}function m0t(e,t){return S.Keys(e).reduce((r,i)=>t.includes(i)?r:{...r,[i]:e[i]},{})}function rke(e,t){let n=Z1(e),r=$x(t),i=m0t(n,r);return St(i)}function f4(e,t,n){return $t([e,t])?K.Update(rke(e,t),{},n):S1(e,t,n)}function ike(e,t,n,r,i){let o=Me(e,t,n),a=Me(e,t,r);return f4(o,a,i)}function A1(e,t={}){return at("Parameters",[e],t)}function oke(e,t={}){return h4(e,t)}function f0t(e){let t=Mi(e)?e.parameters:[],n=Sm({},nr([],[]),t);return si(n)}function h4(e,t){return $t([e])?K.Update(f0t(e),{},t):A1(e,t)}function ake(e,t,n,r){let i=Me(e,t,n);return h4(i,r)}function R1(e,t={}){return at("Partial",[e],t)}function ske(e,t={}){return g4(e,t)}function cke(e,t){let n=pl(e,t),r=dl(n);return al(K.Assign(e,{[t]:r}),t)}function uke(e,t,n){let r=pu(e,t,n);return dl(r)}function lke(e){let t=gr(e);return dl(t)}function pke(e){let t=e.map(n=>dl(n));return Gt(t)}function dke(e){let t=S.Keys(e).reduce((r,i)=>({...r,[i]:Oh(e[i])}),{});return St(t)}function dl(e){return co(e)?cke(e.$defs,e.$ref):Wr(e)?uke(e.if,e.then,e.else):Qt(e)?lke(e.allOf):rt(e)?pke(e.anyOf):Tn(e)?dke(e.properties):St({})}function g4(e,t){return $t([e])?K.Update(dl(e),{},t):R1(e,t)}function mke(e,t,n,r){let i=Me(e,t,n);return g4(i,r)}function C1(e,t,n={}){return at("Pick",[e,t],n)}function fke(e,t,n={}){let r=S.IsArray(t)?Mx(t):t;return y4(e,r,n)}function h0t(e,t){return S.Keys(e).reduce((r,i)=>t.includes(i)?K.Assign(r,{[i]:e[i]}):r,{})}function hke(e,t){let n=Z1(e),r=$x(t),i=h0t(n,r);return St(i)}function y4(e,t,n){return $t([e,t])?K.Update(hke(e,t),{},n):C1(e,t,n)}function gke(e,t,n,r,i){let o=Me(e,t,n),a=Me(e,t,r);return y4(o,a,i)}function O1(e,t={}){return at("ReadonlyObject",[e],t)}function _4(e,t={}){return x4(e,t)}var yke=_4;function _ke(e){return _x(ws(e))}function xke(e,t){let n=pl(e,t),r=ml(n);return al(K.Assign(e,{[t]:r}),t)}function vke(e,t,n){let r=pu(e,t,n);return ml(r)}function bke(e){let t=gr(e);return ml(t)}function wke(e){let t=S.Keys(e).reduce((r,i)=>({...r,[i]:Mh(e[i])}),{});return St(t)}function Tke(e){return _x(si(e))}function Ike(e){let t=e.map(n=>ml(n));return Gt(t)}function ml(e){return hr(e)?_ke(e.items):co(e)?xke(e.$defs,e.$ref):Wr(e)?vke(e.if,e.then,e.else):Qt(e)?bke(e.allOf):Tn(e)?wke(e.properties):Xn(e)?Tke(e.items):rt(e)?Ike(e.anyOf):e}function x4(e,t){return $t([e])?K.Update(ml(e),{},t):O1(e)}function kke(e,t,n,r){let i=Me(e,t,n);return x4(i,r)}function Eke(e,t,n,r){return t.visited.includes(r)?n:r in e?Me(e,nr(t.callstack,[...t.visited,r]),e[r]):n}function Ske(e,t){let n=pl(e,t),r=fl(n);return al(K.Assign(e,{[t]:r}),t)}function Ake(e,t,n){let r=pu(e,t,n);return fl(r)}function Rke(e){let t=gr(e);return fl(t)}function Cke(e){let t=e.map(n=>fl(n));return Gt(t)}function Oke(e){let t=S.Keys(e).reduce((r,i)=>({...r,[i]:s1(e[i])}),{});return St(t)}function fl(e){return co(e)?Ske(e.$defs,e.$ref):Wr(e)?Ake(e.if,e.then,e.else):Qt(e)?Rke(e.allOf):rt(e)?Cke(e.anyOf):Tn(e)?Oke(e.properties):St({})}function P1(e,t={}){return at("Required",[e],t)}function Pke(e,t={}){return v4(e,t)}function v4(e,t){return $t([e])?K.Update(fl(e),{},t):P1(e,t)}function Lke(e,t,n,r){let i=Me(e,t,n);return v4(i,r)}function L1(e,t={}){return at("ReturnType",[e],t)}function Mke(e,t={}){return b4(e,t)}function g0t(e){return Mi(e)?e.returnType:Fn()}function b4(e,t){return $t([e])?K.Update(g0t(e),{},t):L1(e,t)}function Nke(e,t,n,r={}){let i=Me(e,t,n);return b4(i,r)}function M1(e,t){return at("With",[e,t],{})}function Dke(e,t){return w4(e,t)}function w4(e,t){return $t([e])?K.Update(e,{},t):M1(e,t)}function $ke(e,t,n,r){let i=Me(e,t,n);return w4(i,r)}function y0t(e){return Tm(e)?Xn(e.items)?T4(e.items.items):Jr(e.items)?[e]:Ni(e.items)?[e]:[Fn()]:[e]}function T4(e){return e.reduce((n,r)=>[...n,...y0t(r)],[])}function nr(e,t){return{callstack:e,visited:t}}function $t(e){return S.ShiftLeft(e,(t,n)=>Ni(t)?!1:$t(n),()=>!0)}function QT(e,t,n){return S.Keys(n).reduce((r,i)=>({...r,[i]:Me(e,t,n[i])}),{})}function Sm(e,t,n){let r=Ts(e,t,n);return T4(r)}function Ts(e,t,n){return n.map(r=>Me(e,t,r))}function _0t(e,t){let n=Ao(e)?OT(t,{}):t,r=Nh(e)?CT(n,{}):n;return Lh(e)?aI(r,{}):r}function x0t(e,t,n,r,i){return S.IsEqual(n,"AddImmutable")?Fke(e,t,r[0],i):S.IsEqual(n,"RemoveImmutable")?VTe(e,t,r[0],i):S.IsEqual(n,"AddReadonly")?P0e(e,t,r[0],i):S.IsEqual(n,"RemoveReadonly")?_xe(e,t,r[0],i):S.IsEqual(n,"AddOptional")?L0e(e,t,r[0],i):S.IsEqual(n,"RemoveOptional")?bxe(e,t,r[0],i):S.IsEqual(n,"Capitalize")?nIe(e,t,r[0],i):S.IsEqual(n,"Conditional")?sIe(e,t,r[0],r[1],r[2],r[3],i):S.IsEqual(n,"ConstructorParameters")?uIe(e,t,r[0],i):S.IsEqual(n,"Evaluate")?DTe(e,t,r[0],i):S.IsEqual(n,"Exclude")?pIe(e,t,r[0],r[1],i):S.IsEqual(n,"Extract")?hIe(e,t,r[0],r[1],i):S.IsEqual(n,"Index")?UIe(e,t,r[0],r[1],i):S.IsEqual(n,"InstanceType")?qIe(e,t,r[0],i):S.IsEqual(n,"Interface")?kTe(e,t,r[0],r[1],i):S.IsEqual(n,"KeyOf")?JIe(e,t,r[0],i):S.IsEqual(n,"Lowercase")?rIe(e,t,r[0],i):S.IsEqual(n,"Mapped")?ZIe(e,t,r[0],r[1],r[2],r[3],i):S.IsEqual(n,"Module")?Q1(e,t,r[0],i):S.IsEqual(n,"NonNullable")?tke(e,t,r[0],i):S.IsEqual(n,"Pick")?gke(e,t,r[0],r[1],i):S.IsEqual(n,"Parameters")?ake(e,t,r[0],i):S.IsEqual(n,"Partial")?mke(e,t,r[0],i):S.IsEqual(n,"Omit")?ike(e,t,r[0],r[1],i):S.IsEqual(n,"ReadonlyObject")?kke(e,t,r[0],i):S.IsEqual(n,"Record")?Fxe(e,t,r[0],r[1],i):S.IsEqual(n,"Required")?Lke(e,t,r[0],i):S.IsEqual(n,"ReturnType")?Nke(e,t,r[0],i):S.IsEqual(n,"TemplateLiteral")?Gwe(e,t,r[0],i):S.IsEqual(n,"Uncapitalize")?iIe(e,t,r[0],i):S.IsEqual(n,"Uppercase")?oIe(e,t,r[0],i):S.IsEqual(n,"With")?$ke(e,t,r[0],r[1]):at(n,r,i)}function v0t(e,t,n){let r=Ni(n)?Eke(e,t,n,n.$ref):hr(n)?ws(Me(e,t,n.items),zP(n)):Lx(n)?Y1(e,t,n.target,n.arguments):Li(n)?rl(Ts(e,t,n.parameters),Me(e,t,n.instanceType),M0e(n)):Mi(n)?il(Ts(e,t,n.parameters),Me(e,t,n.returnType),N0e(n)):Wr(n)?Ph(Me(e,t,n.if),Me(e,t,n.then),Me(e,t,n.else),q0e(n)):Qt(n)?fa(Ts(e,t,n.allOf),H0e(n)):Tn(n)?St(QT(e,t,n.properties),U0e(n)):po(n)?Uxe(lc(n),Me(e,t,Jo(n))):Tm(n)?Fh(Me(e,t,n.items)):Xn(n)?si(Sm(e,t,n.items),yxe(n)):rt(n)?Gt(Ts(e,t,n.anyOf),axe(n)):n;return _0t(n,r)}function Me(e,t,n){return ym(n)?x0t(e,t,n.action,n.parameters,n.options):v0t(e,t,n)}function I4(e,t){return Me(e,nr([],[]),t)}function b0t(e){return K.Update(e,{"~immutable":!0},{})}function aI(e,t){return K.Update(b0t(e),{},t)}function Fke(e,t,n,r){let i=Me(e,t,n);return aI(i,r)}function Ube(e,t={}){return at("AddImmutable",[e],t)}function _x(e,t={}){return aI(e,t)}function Wbe(e,t={}){return at("Evaluate",[e],t)}function Uke(e,t={}){return XB(e,t)}function qbe(e,t={}){return at("Module",[e],t)}function Wke(e,t={}){return Q1({},nr([],[]),e,t)}function qke(...e){let[t,n,r]=sl.Match(e,{2:(a,c)=>S.IsString(a)?[{},a,c]:[a,c,{}],3:(a,c,u)=>[a,c,u],1:a=>[{},a,{}]}),i=Fwe(n),o=S.IsArray(i)&&S.IsEqual(i.length,2)?Me(t,nr([],[]),i[0]):Fn();return K.Update(o,{},r)}var Fe={};On(Fe,{Any:()=>yx,Array:()=>ws,BigInt:()=>NT,Boolean:()=>e1,Call:()=>KTe,Capitalize:()=>QTe,Codec:()=>ZP,Conditional:()=>aIe,Constructor:()=>rl,ConstructorParameters:()=>cIe,Cyclic:()=>al,Decode:()=>Y0e,DecodeBuilder:()=>MT,Dependent:()=>Ph,Encode:()=>X0e,EncodeBuilder:()=>LT,Enum:()=>K0e,Evaluate:()=>Uke,Exclude:()=>lIe,Extends:()=>lo,ExtendsResult:()=>At,Extract:()=>dIe,Function:()=>il,Generic:()=>_m,Identifier:()=>DT,Immutable:()=>Q0e,Index:()=>gIe,Infer:()=>PT,InstanceType:()=>WIe,Instantiate:()=>I4,Integer:()=>Dh,Interface:()=>ETe,Intersect:()=>fa,IsAny:()=>Er,IsArray:()=>hr,IsBigInt:()=>ul,IsBoolean:()=>sc,IsCall:()=>Lx,IsCodec:()=>QP,IsConstructor:()=>Li,IsCyclic:()=>co,IsDependent:()=>Wr,IsEnum:()=>uo,IsEnumValue:()=>B0e,IsFunction:()=>Mi,IsGeneric:()=>gx,IsIdentifier:()=>nxe,IsImmutable:()=>Lh,IsInfer:()=>Jr,IsInteger:()=>Ho,IsIntersect:()=>Qt,IsKind:()=>Ze,IsLiteral:()=>In,IsNever:()=>uu,IsNull:()=>vx,IsNumber:()=>ai,IsObject:()=>Tn,IsOptional:()=>Ao,IsParameter:()=>oxe,IsReadonly:()=>Nh,IsRecord:()=>po,IsRef:()=>Ni,IsRefine:()=>vB,IsRest:()=>Tm,IsSchema:()=>gi,IsString:()=>Vo,IsSymbol:()=>xm,IsTemplateLiteral:()=>qr,IsThis:()=>f1,IsTuple:()=>Xn,IsUndefined:()=>Ex,IsUnion:()=>rt,IsUnknown:()=>zr,IsUnsafe:()=>XP,IsVoid:()=>ll,KeyOf:()=>jIe,Literal:()=>Zt,Lowercase:()=>ZTe,Mapped:()=>YIe,Module:()=>Wke,Never:()=>Fn,NonNullable:()=>eke,Null:()=>xx,Number:()=>Ba,Object:()=>St,Omit:()=>nke,Optional:()=>$0e,Parameter:()=>$h,Parameters:()=>oke,Partial:()=>ske,Pick:()=>fke,Readonly:()=>Z0e,ReadonlyObject:()=>_4,ReadonlyType:()=>yke,Record:()=>p1,RecordKey:()=>Ix,RecordPattern:()=>lc,RecordValue:()=>Jo,Ref:()=>Ap,Refine:()=>exe,Required:()=>Pke,Rest:()=>Fh,ReturnType:()=>Mke,Script:()=>qke,String:()=>cc,Symbol:()=>bx,TemplateLiteral:()=>Kwe,This:()=>m1,Tuple:()=>si,Uncapitalize:()=>eIe,Undefined:()=>kx,Union:()=>Gt,Unknown:()=>Ki,Unsafe:()=>W0e,Uppercase:()=>tIe,Void:()=>h1,With:()=>Dke});var jke=Fe.Object({candidateIndex:Fe.Number(),badDecision:Fe.String({minLength:1}),betterDecision:Fe.String({minLength:1}),rationale:Fe.String({minLength:1}),confidence:Fe.Number({minimum:0,maximum:1}),riskLevel:Fe.Union([Fe.Literal("low"),Fe.Literal("medium"),Fe.Literal("high")]),strategicPerspective:Fe.String({minLength:1})}),Gke=Fe.Object({valid:Fe.Boolean(),taskId:Fe.String({minLength:1}),candidates:Fe.Array(jke,{minItems:1,maxItems:5}),sourcePrincipleId:Fe.Optional(Fe.String()),sourcePainId:Fe.Optional(Fe.String()),contextRefs:Fe.Array(Fe.String()),generatedAt:Fe.String({minLength:1}),reason:Fe.Optional(Fe.String())});var kxr=Fe.Object({}),Exr=Fe.Object({artifactId:Fe.Optional(Fe.String({description:"Specific artifact id to read."})),sourceTaskId:Fe.Optional(Fe.String({description:"Read artifacts produced by this task (e.g. the predecessor diagnostician task)."}))});var eL=Fe.Object({caseId:Fe.String({minLength:1}),kind:Fe.Union([Fe.Literal("positive"),Fe.Literal("negative")]),toolName:Fe.String({minLength:1}),params:Fe.Record(Fe.String(),Fe.Unknown()),expectedDecision:Fe.Union([Fe.Literal("allow"),Fe.Literal("block"),Fe.Literal("propose_correction")]),expectedProposedParams:Fe.Optional(Fe.Record(Fe.String(),Fe.Unknown())),expectedApplicationMode:Fe.Optional(Fe.Union([Fe.Literal("shadow"),Fe.Literal("live")])),ruleContext:Fe.Optional(Fe.Unknown())}),Bke=Fe.Object({scribeArtifactId:Fe.String({minLength:1}),philosopherArtifactId:Fe.Optional(Fe.String({minLength:1})),dreamerArtifactId:Fe.Optional(Fe.String({minLength:1}))}),Kke=Fe.Object({taskId:Fe.String({minLength:1}),sourceScribeArtifactId:Fe.String({minLength:1}),implementationCode:Fe.String({minLength:1}),goldenTraceCases:Fe.Array(eL,{minItems:2,maxItems:10}),affectedTools:Fe.Array(Fe.String({minLength:1}),{minItems:1}),implementationSummary:Fe.String({minLength:1}),risks:Fe.Array(Fe.String()),sourceTrace:Bke,generatedAt:Fe.String({minLength:1}),requiresContextVersion:Fe.Optional(Fe.Literal(2))});var Gxr=Fe.Object({}),Bxr=Fe.Object({code:Fe.String({description:"The rule implementation source code to validate statically."})}),Kxr=Fe.Object({code:Fe.String({description:"The rule implementation source code to replay."}),goldenTraceCases:Fe.Array(eL,{minItems:2,maxItems:10,description:"Golden trace cases to replay against. At least 1 positive + 1 negative."})});var k0t=["=== RuleCode Dialect Spec (PRI-439) ===","","CANONICAL FORM:"," function evaluate(input, helpers) {"," // ... matcher logic ...",' return { decision: "allow"|"block"|"requireApproval"|"auto_correct", matched: <boolean>, reason: "<string>" };'," }",""," - Bare function (NO `export` keyword \u2014 export is forbidden)."," - Synchronous only (NO `async` / `await`)."," - The function MUST be named `evaluate` and take exactly (input, helpers).","","RETURN SHAPE (every return statement must include all three required fields):",' - decision: "allow" | "block" | "requireApproval" | "auto_correct"'," - matched: boolean (true if the rule applied to this input)"," - reason: non-empty string",' - correctionProposal?: required when decision === "auto_correct"',"","MATCHED=FALSE RULE:",' When matched === false, decision MUST be "allow". A "block" or "requireApproval"'," with matched=false is contradictory and will be rejected.","","FORBIDDEN PATTERNS (static check rejects these):"," require, import, export, async, await, fetch, eval, Function, process,"," globalThis, global, Reflect, Proxy, constructor, Buffer,"," setTimeout, setInterval, setImmediate, queueMicrotask,"," XMLHttpRequest, Math.random, crypto",' (also forbidden: bracket access like globalThis["require"])',"","INPUT SHAPE (input.action and input.context are the safe surfaces to inspect):"," input.action.toolName : string"," input.action.normalizedPath: string | null (posix-relative when available)"," input.action.paramsSummary : Record<string, unknown>"," input.workspace.isRiskPath : boolean"," input.derived.estimatedLineChanges: number",' input.derived.bashRisk : "safe"|"normal"|"dangerous"|"unknown"'," input.context : RuleContextV2 | undefined (optional, v2 only)","","CONTEXT (RuleContext v2 \u2014 optional, requiresContextVersion: 2):"," input.context.version : 2",' input.context.history.status : "available" | "unavailable"'," input.context.history.unavailableReason : string | undefined"," input.context.history.truncated: boolean"," input.context.history.calls : ReadonlyArray<RuleToolCallRecord>",' input.context.facts.priorReadOfTarget : "yes" | "no" | "unknown"'," input.context.facts.readCount : number | null"," input.context.facts.writeCount : number | null"," input.context.facts.uniqueWritePathCount : number | null"," input.context.facts.sameActionBlockCount : number | null","","CONTEXT RULES (critical for v2 rules):",' - When input.context is undefined or context.history.status === "unavailable",',' the rule MUST allow (decision: "allow", matched: false).',' Unavailable context must never be interpreted as "no history" or "not done".'," - Prefer context.facts (deterministic, host-computed) over raw context.history.calls."," Use canonicalKind from facts for kind-based logic; raw calls only when facts"," cannot express the needed pattern.",' - Do NOT infer "not done" from an empty calls array. An empty or truncated'," history window means the host did not provide enough data, not that the"," action did not happen."," - Rules declaring requiresContextVersion: 2 must handle context unavailability"," gracefully (return allow). v1 rules (no requiresContextVersion) must not"," read input.context and behave exactly as before.","","HELPERS (second argument):"," helpers.isRiskPath() : boolean"," helpers.getToolName() : string"," helpers.getEstimatedLineChanges() : number",' helpers.getBashRisk() : "safe"|"normal"|"dangerous"|"unknown"'," helpers.getEpTier() : number","","GOLDEN TRACE CASES (2-10 cases, at least 1 positive + 1 negative):",' - positive case: expectedDecision must be "allow"',' - negative case: expectedDecision is "block" or "propose_correction"'," - propose_correction cases MUST include expectedProposedParams + expectedApplicationMode","","WORKFLOW:"," 1. Call read_rulecode_spec once (or as needed) to ground your output."," 2. Call validate_rulecode with your draft code to catch static errors."," 3. Call replay_rulecode with your code + goldenTraceCases to verify sandbox replay."," 4. Call submit_rulecode with the full ArtificerRuleOutput once replay passes.",""].join(`
353
- `);var A0t=new Set(["__proto__","constructor","prototype"]),Vke=3,R0t=5,C0t=new Set(["allow","block","propose_correction"]),O0t={valid:!0,errors:[]};function E4(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Yke(e){for(let t of Object.keys(e))if(A0t.has(t))return!1;return!0}function P0t(e){return e.length===0?O0t:{valid:!1,errors:e}}function S4(e){return typeof e=="string"&&e.trim().length>0}function zke(e,t,n){let r=[];return E4(e)?Yke(e)?((!Object.hasOwn(e,"caseId")||!S4(e.caseId))&&r.push(`${t}.caseId must be a non-empty string`),(!Object.hasOwn(e,"kind")||e.kind!==n)&&r.push(`${t}.kind must be '${n}'`),(!Object.hasOwn(e,"toolName")||!S4(e.toolName))&&r.push(`${t}.toolName must be a non-empty string`),(!Object.hasOwn(e,"params")||!E4(e.params))&&r.push(`${t}.params must be a plain object`),!Object.hasOwn(e,"expectedDecision")||typeof e.expectedDecision!="string"||!C0t.has(e.expectedDecision)?r.push(`${t}.expectedDecision must be one of allow|block|propose_correction`):n==="positive"&&e.expectedDecision!=="allow"&&r.push(`${t}: positive cases must expect allow`),r):(r.push(`${t} must not carry prototype-pollution keys`),r):(r.push(`${t} must be a plain object`),r)}function Jke(e,t){let{fieldName:n,maxLength:r,requireNonEmpty:i}=t,o=[];if(!Array.isArray(e))return o.push(`${n} must be an array`),o;i&&e.length===0&&o.push(`${n} must contain at least 1 item`),r!==void 0&&e.length>r&&o.push(`${n} must contain at most ${r} items, got ${e.length}`);for(let a=0;a<e.length;a++)typeof e[a]!="string"&&o.push(`${n}[${a}] must be a string`);return o}function tL(e){if(!E4(e))return{valid:!1,errors:["BehaviorExamplePack must be a plain object"]};if(!Yke(e))return{valid:!1,errors:["BehaviorExamplePack must not carry prototype-pollution keys"]};let t=[];if(Object.hasOwn(e,"sourceNegativeCase")?t.push(...zke(e.sourceNegativeCase,"sourceNegativeCase","negative")):t.push("sourceNegativeCase is required"),(!Object.hasOwn(e,"ownerDesiredOutcome")||!S4(e.ownerDesiredOutcome))&&t.push("ownerDesiredOutcome must be a non-empty string"),!Object.hasOwn(e,"positiveCounterexamples"))t.push("positiveCounterexamples is required");else if(!Array.isArray(e.positiveCounterexamples))t.push("positiveCounterexamples must be an array");else{let n=e.positiveCounterexamples;n.length===0&&t.push("positiveCounterexamples must contain at least 1 item"),n.length>Vke&&t.push(`positiveCounterexamples must contain at most ${Vke} items, got ${n.length}`);for(let r=0;r<n.length;r++)t.push(...zke(n[r],`positiveCounterexamples[${r}]`,"positive"))}return Object.hasOwn(e,"evidenceRefs")?t.push(...Jke(e.evidenceRefs,{fieldName:"evidenceRefs",maxLength:R0t,requireNonEmpty:!0})):t.push("evidenceRefs is required"),Object.hasOwn(e,"redactionNotes")?t.push(...Jke(e.redactionNotes,{fieldName:"redactionNotes"})):t.push("redactionNotes is required"),P0t(t)}var sI=Object.create(null);sI.principle="principle-ledger";sI.rule="rule-candidate";sI.implementation="implementation-candidate";sI.prompt="prompt-injection-candidate";sI.defer="deferred";go();go();go();wi();var nL={evaluatorRepairBudgetExhausted:"evaluator_repair_budget_exhausted",rolloutRevisionBudgetExhausted:"rollout_revision_budget_exhausted",evaluatorRepairSeedFailed:"evaluator_repair_seed_failed",rolloutActivationCandidateUnresolved:"rollout_activation_candidate_unresolved",rolloutDispatchNotWired:"rollout_dispatch_not_wired",rolloutDispatchRefused:"rollout_dispatch_refused",rolloutRevisionTargetUnresolved:"rollout_revision_target_unresolved",rolloutRevisionRoutingNotWired:"rollout_revision_routing_not_wired",rolloutRevisionReopenFailed:"rollout_revision_reopen_failed",rolloutRevisionIterationMissing:"rollout_revision_iteration_missing",workspaceDirtyStall:"workspace_dirty_stall"},K0t=new Set([nL.evaluatorRepairBudgetExhausted,nL.rolloutRevisionBudgetExhausted]);wi();wi();wi();go();var Q0t={canonicalDiagnosis:{workspaceDir:"/workspace/dogfood",painEvents:[{id:1,source:"manual",reason:"Before declaring a user journey complete verify full observable product surface",text:"Manual record: surface validation missing",created_at:"2026-06-13T10:00:00.000Z",score:90}],tasks:[{task_id:"diagnosis_manual_1",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:01:00.000Z",input_ref:"pain_1",diagnostic_json:JSON.stringify({rootCause:"Verifier checks static patterns but misses real runtime load."})}],candidates:[],dreamerTasks:[],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},subRunDiagnosis:{workspaceDir:"/workspace/dogfood",painEvents:[{id:"2",source:"manual",reason:"Verify config file updates before committing",text:"Manual record: verify config changes",created_at:"2026-06-13T10:02:00.000Z",score:80}],tasks:[{task_id:"diag_router-diagnosis_manual_2",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:03:00.000Z",input_ref:"pain_2",diagnostic_json:JSON.stringify({rootCause:"No pre-commit hook runs pd config verification."})}],candidates:[{candidate_id:"cand-subrun-2",task_id:"diag_router-diagnosis_manual_2",title:"Verify config changes before commit",description:"Verify all config files conform to parser constraints prior to commit.",confidence:.95,recommendation_kind:"principle"}],dreamerTasks:[],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},asyncPendingWithoutConsumer:{workspaceDir:"/workspace/dogfood",painEvents:[{id:3,source:"manual",reason:"Agent does not pause to clarify when command fails",created_at:"2026-06-13T10:04:00.000Z",score:75}],tasks:[{task_id:"diagnosis_manual_3",task_kind:"diagnostician",status:"pending",created_at:"2026-06-13T10:05:00.000Z",input_ref:"pain_3"}],candidates:[],dreamerTasks:[],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},candidateGeneratedNoDreamer:{workspaceDir:"/workspace/dogfood",painEvents:[{id:4,source:"manual",reason:"Auto-consumer should lease tasks correctly",created_at:"2026-06-13T10:06:00.000Z",score:70}],tasks:[{task_id:"diagnosis_manual_4",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:07:00.000Z",input_ref:"pain_4"}],candidates:[{candidate_id:"cand-4",task_id:"diagnosis_manual_4",title:"Lease tasks correctly in auto-consumer",description:"Prevent ready dreamer tasks from staying pending.",confidence:.85,recommendation_kind:"principle"}],dreamerTasks:[],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},dreamerPending:{workspaceDir:"/workspace/dogfood",painEvents:[{id:5,source:"manual",reason:"Dreamer pending task scenario",created_at:"2026-06-13T10:08:00.000Z",score:85}],tasks:[{task_id:"diagnosis_manual_5",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:09:00.000Z",input_ref:"pain_5"}],candidates:[{candidate_id:"cand-5",task_id:"diagnosis_manual_5",title:"Dreamer pending title",description:"Dreamer pending description",confidence:.9}],dreamerTasks:[{task_id:"dreamer-cand-5-prompt",task_kind:"dreamer",status:"pending"}],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},dreamerRunning:{workspaceDir:"/workspace/dogfood",painEvents:[{id:6,source:"manual",reason:"Dreamer running task scenario",created_at:"2026-06-13T10:10:00.000Z",score:85}],tasks:[{task_id:"diagnosis_manual_6",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:11:00.000Z",input_ref:"pain_6"}],candidates:[{candidate_id:"cand-6",task_id:"diagnosis_manual_6",title:"Dreamer running title",description:"Dreamer running description",confidence:.9}],dreamerTasks:[{task_id:"dreamer-cand-6-prompt",task_kind:"dreamer",status:"running"}],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},dreamerFailed:{workspaceDir:"/workspace/dogfood",painEvents:[{id:7,source:"manual",reason:"Dreamer failed task scenario",created_at:"2026-06-13T10:12:00.000Z",score:85}],tasks:[{task_id:"diagnosis_manual_7",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:13:00.000Z",input_ref:"pain_7"}],candidates:[{candidate_id:"cand-7",task_id:"diagnosis_manual_7",title:"Dreamer failed title",description:"Dreamer failed description",confidence:.9}],dreamerTasks:[{task_id:"dreamer-cand-7-prompt",task_kind:"dreamer",status:"failed"}],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},dreamerSucceeded:{workspaceDir:"/workspace/dogfood",painEvents:[{id:8,source:"manual",reason:"Dreamer succeeded task scenario",created_at:"2026-06-13T10:14:00.000Z",score:85}],tasks:[{task_id:"diagnosis_manual_8",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:15:00.000Z",input_ref:"pain_8"}],candidates:[{candidate_id:"cand-8",task_id:"diagnosis_manual_8",title:"Dreamer succeeded title",description:"Dreamer succeeded description",confidence:.9}],dreamerTasks:[{task_id:"dreamer-cand-8-prompt",task_kind:"dreamer",status:"succeeded"}],ledgerPrinciples:[{id:"principle-8",derivedFromPainIds:["pain_8"],status:"candidate",text:"Dreamer succeeded principle text"}],trajectoryDbAvailable:!0,stateDbAvailable:!0},malformedLedgerDegradedJson:{workspaceDir:"/workspace/dogfood",painEvents:[{id:9,source:"manual",reason:"Malformed data handling",created_at:"2026-06-13T10:16:00.000Z",score:80}],tasks:[{task_id:"diagnosis_manual_9",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:17:00.000Z",input_ref:"pain_9",diagnostic_json:"{invalid-json}"}],candidates:[],dreamerTasks:[],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},workspaceMismatchWarning:{workspaceDir:"/workspace/dogfood",painEvents:[{id:10,source:"hook",reason:"Workspace mismatch event",created_at:"2026-06-13T10:18:00.000Z",score:60}],tasks:[{task_id:"diagnosis_other_999",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:00:00.000Z",input_ref:"pain_999"}],candidates:[],dreamerTasks:[],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},autoConsumerSuccess:{workspaceDir:"/workspace/dogfood",painEvents:[{id:11,source:"manual",reason:"Auto-consumer leasing and successor creation success",created_at:"2026-06-13T10:20:00.000Z",score:95}],tasks:[{task_id:"diagnosis_manual_11",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:21:00.000Z",input_ref:"pain_11"}],candidates:[{candidate_id:"cand-11",task_id:"diagnosis_manual_11",title:"Auto-consumer successor task",description:"Verifies that successor philosopher task is created after dreamer success.",confidence:.9}],dreamerTasks:[{task_id:"dreamer-cand-11-prompt",task_kind:"dreamer",status:"succeeded"}],ledgerPrinciples:[{id:"principle-11",derivedFromPainIds:["pain_11"],status:"active"}],trajectoryDbAvailable:!0,stateDbAvailable:!0},autoConsumerFailure:{workspaceDir:"/workspace/dogfood",painEvents:[{id:12,source:"manual",reason:"Auto-consumer failure persistence check",created_at:"2026-06-13T10:22:00.000Z",score:95}],tasks:[{task_id:"diagnosis_manual_12",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:23:00.000Z",input_ref:"pain_12"}],candidates:[{candidate_id:"cand-12",task_id:"diagnosis_manual_12",title:"Auto-consumer failure details",description:"Dreamer failed task description",confidence:.9}],dreamerTasks:[{task_id:"dreamer-cand-12-prompt",task_kind:"dreamer",status:"failed"}],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0}};wi();var nEe={manifestId:"dreamer.v1",schemaVersion:xv,runnerKind:"dreamer",tier0:["pain.summary.headline","diagnosis.summary.headline"],tier1:["pain.summary.category","pain.summary.severity","pain.summary.rootSymptom","diagnosis.summary.rootCause","diagnosis.summary.affectedComponents"],tier2:[],budgetTokens:1500,priority:["diagnosis.summary.rootCause","pain.summary.rootSymptom","pain.summary.category","pain.summary.severity","diagnosis.summary.affectedComponents","pain.summary.headline","diagnosis.summary.headline"]},rEe={manifestId:"scribe.v1",schemaVersion:xv,runnerKind:"scribe",tier0:["philosopher.summary.headline","philosopher.predecessorSummary.headline"],tier1:["philosopher.summary.thesis","philosopher.summary.principleTitle","philosopher.summary.principleScope","philosopher.predecessorSummary.badDecision","philosopher.predecessorSummary.betterDecision","philosopher.predecessorSummary.rationale","philosopher.predecessorSummary.riskLevel","philosopher.predecessorSummary.strategicPerspective"],tier2:[],budgetTokens:1800,priority:["philosopher.summary.principleTitle","philosopher.summary.thesis","philosopher.predecessorSummary.betterDecision","philosopher.predecessorSummary.riskLevel","philosopher.predecessorSummary.rationale","philosopher.summary.principleScope","philosopher.predecessorSummary.badDecision","philosopher.predecessorSummary.strategicPerspective","philosopher.summary.headline","philosopher.predecessorSummary.headline"]},iEe={manifestId:"artificer.v1",schemaVersion:xv,runnerKind:"artificer",tier0:["scribe.summary.headline","scribe.predecessorSummary.headline"],tier1:["scribe.summary.principleText","scribe.summary.scope","scribe.summary.exceptions"],tier2:["dreamer.raw.betterDecision","dreamer.raw.rationale","dreamer.raw.riskLevel"],budgetTokens:2e3,priority:["scribe.summary.principleText","dreamer.raw.betterDecision","scribe.summary.scope","dreamer.raw.rationale","dreamer.raw.riskLevel","scribe.summary.exceptions","scribe.summary.headline","scribe.predecessorSummary.headline"]},rL={manifestId:"evaluator.stage1.v1",schemaVersion:xv,runnerKind:"evaluator",tier0:["artificer.summary.headline","artificer.predecessorSummary.headline"],tier1:["scribe.summary.principleText","scribe.summary.scope","artificer.summary.changedFiles","artificer.summary.apiSurface","artificer.summary.risks","dreamer.summary.badDecision","dreamer.summary.betterDecision","dreamer.summary.rationale","dreamer.summary.riskLevel","pain.summary.rootSymptom","pain.summary.category"],tier2:[],budgetTokens:3e3,priority:["scribe.summary.principleText","dreamer.summary.betterDecision","pain.summary.rootSymptom","artificer.summary.apiSurface","dreamer.summary.riskLevel","dreamer.summary.rationale","scribe.summary.scope","artificer.summary.risks","pain.summary.category","artificer.summary.changedFiles","dreamer.summary.badDecision","artificer.summary.headline","artificer.predecessorSummary.headline"]},oEe={...rL,manifestId:"evaluator.stage2.v1",tier2:["pain.raw.evidence","dreamer.raw.candidates"],budgetTokens:4500,priority:[...rL.priority,"pain.raw.evidence","dreamer.raw.candidates"]},Z0t=[nEe,rEe,iEe,rL,oEe],Kvr=Array.from(new Set(Z0t.map(e=>e.runnerKind)));go();wi();go();wi();go();wi();go();wi();go();wi();go();go();wi();go();wi();wi();import QTr from"better-sqlite3";import oIr from"better-sqlite3";import dIr from"better-sqlite3";var ks;(function(e){e[e.Seed=1]="Seed",e[e.Sprout=2]="Sprout",e[e.Sapling=3]="Sapling",e[e.Tree=4]="Tree",e[e.Forest=5]="Forest"})(ks||(ks={}));var tvt=[{tier:ks.Seed,name:"Seed",requiredPoints:0,permissions:{maxLinesPerWrite:150,maxFilesPerTask:3,allowRiskPath:!1,allowSubagentSpawn:!0}},{tier:ks.Sprout,name:"Sprout",requiredPoints:50,permissions:{maxLinesPerWrite:300,maxFilesPerTask:5,allowRiskPath:!1,allowSubagentSpawn:!0}},{tier:ks.Sapling,name:"Sapling",requiredPoints:200,permissions:{maxLinesPerWrite:500,maxFilesPerTask:10,allowRiskPath:!0,allowSubagentSpawn:!0}},{tier:ks.Tree,name:"Tree",requiredPoints:500,permissions:{maxLinesPerWrite:1e3,maxFilesPerTask:20,allowRiskPath:!0,allowSubagentSpawn:!0}},{tier:ks.Forest,name:"Forest",requiredPoints:1e3,permissions:{maxLinesPerWrite:Number.MAX_SAFE_INTEGER,maxFilesPerTask:Number.MAX_SAFE_INTEGER,allowRiskPath:!0,allowSubagentSpawn:!0}}];var nvt={doubleRewardCooldownMs:3600*1e3,maxRecentEvents:50,difficultyPenalty:{tier4Trivial:.1,tier4Normal:.5,tier5Trivial:.1,tier5Normal:.5}};var jh=s.Union([s.Literal(ks.Seed),s.Literal(ks.Sprout),s.Literal(ks.Sapling),s.Literal(ks.Tree),s.Literal(ks.Forest)]),P4=s.Object({maxLinesPerWrite:s.Number(),maxFilesPerTask:s.Number(),allowRiskPath:s.Boolean(),allowSubagentSpawn:s.Boolean()}),rvt=s.Object({tier:jh,name:s.String(),requiredPoints:s.Number(),permissions:P4}),pEe=s.Union([s.Literal("trivial"),s.Literal("normal"),s.Literal("hard")]),ivt=s.Object({basePoints:s.Number(),description:s.String()}),dEe=s.Union([s.Literal("success"),s.Literal("failure")]),mEe=s.Object({id:s.String(),timestamp:s.String(),type:dEe,taskHash:s.String(),taskDifficulty:pEe,toolName:s.Optional(s.String()),filePath:s.Optional(s.String()),reason:s.Optional(s.String()),pointsAwarded:s.Number(),isDoubleReward:s.Boolean(),sessionId:s.Optional(s.String())}),fEe=s.Object({totalSuccesses:s.Number(),totalFailures:s.Number(),consecutiveSuccesses:s.Number(),consecutiveFailures:s.Number(),doubleRewardsEarned:s.Number(),tierPromotions:s.Number(),pointsByDifficulty:s.Object({trivial:s.Number(),normal:s.Number(),hard:s.Number()})}),hEe=s.Tuple([s.String(),s.String()]),gEe=s.Object({version:s.Literal("2.0"),agentId:s.String(),totalPoints:s.Number(),availablePoints:s.Number(),currentTier:jh,lastDoubleRewardTime:s.Optional(s.String()),recentFailureHashes:s.Array(hEe),stats:fEe,recentEvents:s.Array(mEe),lastUpdated:s.String()}),ovt=s.Object({scorecard:gEe,archivedStats:s.Object({totalEventsProcessed:s.Number(),pointsFromTrivial:s.Number(),pointsFromNormal:s.Number(),pointsFromHard:s.Number()})}),avt=s.Object({doubleRewardCooldownMs:s.Number(),maxRecentEvents:s.Number(),difficultyPenalty:s.Object({tier4Trivial:s.Number(),tier4Normal:s.Number(),tier5Trivial:s.Number(),tier5Normal:s.Number()})}),svt=s.Object({totalEventsProcessed:s.Number(),pointsFromTrivial:s.Number(),pointsFromNormal:s.Number(),pointsFromHard:s.Number()}),cvt=s.Object({allowed:s.Boolean(),reason:s.Optional(s.String()),currentTier:s.Optional(jh),requiredTier:s.Optional(jh)}),uvt=s.Object({toolName:s.String(),filePath:s.Optional(s.String()),content:s.Optional(s.String()),lineCount:s.Optional(s.Number()),isRiskPath:s.Optional(s.Boolean())}),lvt=s.Object({previousTier:jh,newTier:jh,totalPoints:s.Number(),timestamp:s.String(),newPermissions:P4}),aL=s.Union([s.Literal("candidate"),s.Literal("probation"),s.Literal("active"),s.Literal("deprecated"),s.Literal("archived")]),L4=s.Union([s.Literal("deterministic"),s.Literal("weak_heuristic"),s.Literal("manual_only")]);var M4=s.Object({applicabilityTags:s.Array(s.String()),positiveSignals:s.Array(s.String()),negativeSignals:s.Array(s.String()),toolSequenceHints:s.Array(s.Array(s.String())),confidence:s.Union([s.Literal("high"),s.Literal("medium"),s.Literal("low")])}),yEe=s.Object({name:s.String(),type:s.Union([s.Literal("hook"),s.Literal("gate"),s.Literal("skill"),s.Literal("test"),s.Literal("prompt")]),triggerCondition:s.String(),enforcement:s.Union([s.Literal("block"),s.Literal("warn"),s.Literal("log")]),action:s.String(),implementationHint:s.Optional(s.String())}),_Ee=s.Object({painPreventedCount:s.Number(),lastPainPreventedAt:s.Optional(s.String()),calculatedAt:s.String()}),pvt=s.Object({id:s.String(),version:s.Number(),text:s.String(),source:s.Object({painId:s.String(),painType:s.Union([s.Literal("tool_failure"),s.Literal("dispatch_error"),s.Literal("subagent_error"),s.Literal("user_frustration")]),timestamp:s.String()}),trigger:s.String(),action:s.String(),guardrails:s.Optional(s.Array(s.String())),contextTags:s.Array(s.String()),validation:s.Object({successCount:s.Number(),conflictCount:s.Number()}),status:aL,feedbackScore:s.Number(),usageCount:s.Number(),createdAt:s.String(),activatedAt:s.Optional(s.String()),deprecatedAt:s.Optional(s.String()),evaluability:L4,detectorMetadata:s.Optional(M4),abstractedPrinciple:s.Optional(s.String()),coreAxiomId:s.Optional(s.String()),priority:s.Optional(s.Union([s.Literal("P0"),s.Literal("P1"),s.Literal("P2")])),scope:s.Optional(s.Union([s.Literal("general"),s.Literal("domain")])),domain:s.Optional(s.String()),suggestedRules:s.Optional(s.Array(yEe)),valueMetrics:s.Optional(_Ee)}),dvt=s.Union([s.Literal("pain_detected"),s.Literal("candidate_created"),s.Literal("principle_promoted"),s.Literal("principle_deprecated"),s.Literal("principle_rolled_back"),s.Literal("circuit_breaker_opened"),s.Literal("legacy_import")]),O4=s.Object({painId:s.String(),painType:s.Union([s.Literal("tool_failure"),s.Literal("dispatch_error"),s.Literal("subagent_error"),s.Literal("user_frustration")]),source:s.String(),reason:s.String(),score:s.Optional(s.Number()),sessionId:s.Optional(s.String()),agentId:s.Optional(s.String()),taskId:s.Optional(s.String()),traceId:s.Optional(s.String()),provenance:s.Optional(s.Union([s.Literal("host_context_bound"),s.Literal("owner_reported_no_host_trace"),s.Literal("automatic_hook"),s.Literal("openclaw_context_bound")])),hostKind:s.Optional(s.Union([s.Literal("openclaw"),s.Literal("codex")]))}),xEe=s.Object({painId:s.String(),principleId:s.String(),trigger:s.String(),action:s.String(),status:s.Literal("candidate"),painType:s.Optional(s.Union([s.Literal("tool_failure"),s.Literal("dispatch_error"),s.Literal("subagent_error"),s.Literal("user_frustration")])),evaluability:s.Optional(L4),detectorMetadata:s.Optional(M4),abstractedPrinciple:s.Optional(s.String()),coreAxiomId:s.Optional(s.String())}),vEe=s.Object({principleId:s.String(),from:aL,to:aL,reason:s.String(),successCount:s.Optional(s.Number())}),bEe=s.Object({principleId:s.String(),reason:s.String(),triggeredBy:s.Union([s.Literal("auto"),s.Literal("manual")])}),wEe=s.Object({principleId:s.String(),reason:s.String(),triggeredBy:s.Union([s.Literal("user_command"),s.Literal("auto_conflict")]),blacklistPattern:s.Optional(s.String()),relatedPainId:s.Optional(s.String())}),TEe=s.Object({taskId:s.String(),painId:s.String(),failCount:s.Number(),reason:s.String(),requireHuman:s.Boolean(),nextRetryAt:s.Optional(s.String())}),IEe=s.Object({sourceFile:s.String(),content:s.String(),contentHash:s.Optional(s.String())}),mvt=s.Union([s.Object({ts:s.String(),type:s.Literal("pain_detected"),data:O4}),s.Object({ts:s.String(),type:s.Literal("pain_recorded"),data:O4}),s.Object({ts:s.String(),type:s.Literal("candidate_created"),data:xEe}),s.Object({ts:s.String(),type:s.Literal("principle_promoted"),data:vEe}),s.Object({ts:s.String(),type:s.Literal("principle_deprecated"),data:bEe}),s.Object({ts:s.String(),type:s.Literal("principle_rolled_back"),data:wEe}),s.Object({ts:s.String(),type:s.Literal("circuit_breaker_opened"),data:TEe}),s.Object({ts:s.String(),type:s.Literal("legacy_import"),data:IEe})]);var kEe=s.Object({term:s.String(),weight:s.Number(),source:s.Union([s.Literal("seed"),s.Literal("llm"),s.Literal("user")]),addedAt:s.String(),hitCount:s.Optional(s.Number({minimum:0})),truePositiveCount:s.Optional(s.Number({minimum:0})),falsePositiveCount:s.Optional(s.Number({minimum:0})),lastHitAt:s.Optional(s.String())}),fvt=s.Object({keywords:s.Array(kEe),version:s.Integer({minimum:0}),lastOptimizedAt:s.String()}),hvt=s.Object({matched:s.Boolean(),matchedTerms:s.Array(s.String()),score:s.Number({minimum:0,maximum:1}),confidence:s.Number({minimum:0,maximum:1})});var Bvt={on_change:"smoke",on_risk_change:"unit",commands:{}},WEe={enabled:!0,spiral_boost:20,min_threshold:15,max_threshold:70,backlog_trigger:6,hard_failure_trigger:1,low_recent_success_boost:15,high_recent_pain_boost:10},Kvt={soft_capture_threshold:30,adaptive:{...WEe}},Hvt={enabled:!0,heartbeat_stale_hours:72},Vvt={enabled:!0,max_file_size_bytes:10*1024*1024,fuzzy_match_enabled:!0,fuzzy_match_threshold:.8,skip_large_file_action:"warn"};var zvt={audit_level:"medium",risk_paths:[],evolution_mode:"realtime",tests:{...Bvt},pain:{soft_capture_threshold:Kvt.soft_capture_threshold,adaptive:{...WEe}},lifecycle:{...Hvt},edit_verification:{...Vvt},custom_guards:[]};import cwt from"better-sqlite3";import _i from"fs";import pc from"path";import ZEe from"crypto";import*as Yr from"fs";import*as JEe from"path";var D4=class extends Error{filePath;lockPath;constructor(t,n,r){super(t),this.name="LockAcquisitionError",this.filePath=n,this.lockPath=r}},zbt={maxRetries:50,baseRetryDelayMs:10,maxRetryDelayMs:500,lockStaleMs:1e4,lockSuffix:".lock"};function YEe(e){try{return process.kill(e,0),!0}catch{return!1}}function zEe(e,t){try{let n=JEe.dirname(e);Yr.existsSync(n)||Yr.mkdirSync(n,{recursive:!0});let r=Yr.constants.O_WRONLY|Yr.constants.O_CREAT|Yr.constants.O_EXCL,i=Yr.openSync(e,r);return Yr.writeSync(i,String(t)),Yr.fsyncSync(i),Yr.closeSync(i),!0}catch(n){if(n.code==="EEXIST")return!1;throw n}}function uI(e){try{let t=Yr.readFileSync(e,"utf8"),n=parseInt(t.trim(),10);return Number.isNaN(n)?null:n}catch{return null}}function Jbt(e,t){try{uI(e)===t&&Yr.unlinkSync(e)}catch{}}function Ybt(e,t){try{let n=Yr.statSync(e),r=uI(e),i=Date.now()-n.mtimeMs>t,o=r===null||!YEe(r);if(i||o)try{return Yr.unlinkSync(e),!0}catch{return!1}return!1}catch{return!1}}function Xbt(e,t,n){let r=Math.min(t*Math.pow(2,e),n),i=r*.2*Math.random();return Math.floor(r+i)}function Qbt(e){let t=Date.now()+e;for(;Date.now()<t;);}function Zbt(e,t){let n=uI(t),r=n!==null?YEe(n)?`alive (PID ${n})`:`dead (PID ${n})`:"unknown";return new D4(`Failed to acquire lock for ${e}. Lock holder: ${r}.`,e,t)}function ewt(e,t,n){let r=e+t.lockSuffix;return zEe(r,n)&&uI(r)===n?{lockPath:r,pid:n,acquiredAt:Date.now()}:(Ybt(r,t.lockStaleMs),zEe(r,n)&&uI(r)===n?{lockPath:r,pid:n,acquiredAt:Date.now()}:null)}function twt(e,t={}){let n={...zbt,...t},{pid:r}=process;for(let i=0;i<n.maxRetries;i++){let o=ewt(e,n,r);if(o)return o;if(i<n.maxRetries-1){let a=Xbt(i,n.baseRetryDelayMs,n.maxRetryDelayMs);Qbt(a)}}throw Zbt(e,e+n.lockSuffix)}function nwt(e){Jbt(e.lockPath,e.pid)}function XEe(e,t,n={}){let r=twt(e,n);try{return t()}finally{nwt(r)}}import*as Ux from"fs";var QEe=3,rwt=50;function sL(e,t){let n=e+".tmp";Ux.writeFileSync(n,t,"utf8");let r;for(let i=0;i<QEe;i++)try{Ux.renameSync(n,e);return}catch(o){r=o;let a=o.code;if(a==="EPERM"||a==="EBUSY"||a==="EACCES"){if(i<QEe-1){let c=rwt*Math.pow(2,i),u=Date.now()+c,l=!1;for(;Date.now()<u;)if(!l&&Date.now()>=u-10){try{$e("fs").accessSync?.(n)}catch{}l=!0}}continue}break}try{Ux.unlinkSync(n)}catch{}throw r}import*as Gh from"path";var Un=(...e)=>Gh.posix.join(...e);function iwt(e){return/^[A-Za-z]:[\\/]/.test(e)||e.startsWith("\\\\")}function owt(e,t){return iwt(e)?Gh.win32.join(e,t):e.startsWith("/")?Gh.posix.join(e,t):Gh.join(e,t)}var Kn={IDENTITY:".principles",MODELS:Un(".principles","models"),STATE:".state",MEMORY:"memory",OKR:Un("memory","okr"),LOGS:Un("memory","logs"),SESSIONS:Un(".state","sessions"),PAIN_SAMPLES:Un("memory","pain"),LOCKS:Un("memory",".locks"),IMPL_CODE_DIR:Un(".state","principles","implementations")},awt={PROFILE:Un(Kn.IDENTITY,"PROFILE.json"),PRINCIPLES:Un(Kn.IDENTITY,"PRINCIPLES.md"),THINKING_OS:Un(Kn.IDENTITY,"THINKING_OS.md"),DECISION_POLICY:Un(Kn.IDENTITY,"DECISION_POLICY.json"),MODELS_DIR:Kn.MODELS,STATE_DIR:Kn.STATE,EVOLUTION_QUEUE:Un(Kn.STATE,"evolution_queue.json"),EVOLUTION_DIRECTIVE:Un(Kn.STATE,"evolution_directive.json"),WORKBOARD:Un(Kn.STATE,"WORKBOARD.json"),AGENT_SCORECARD:Un(Kn.STATE,"AGENT_SCORECARD.json"),PAIN_FLAG:Un(Kn.STATE,".pain_flag"),SYSTEM_CAPABILITIES:Un(Kn.STATE,"SYSTEM_CAPABILITIES.json"),PAIN_SETTINGS:Un(Kn.STATE,"pain_settings.json"),PAIN_CANDIDATES:Un(Kn.STATE,"pain_candidates.json"),TRAJECTORY_DB:Un(Kn.STATE,"trajectory.db"),TRAJECTORY_BLOBS_DIR:Un(Kn.STATE,"blobs"),EXPORTS_DIR:Un(Kn.STATE,"exports"),SESSION_DIR:Kn.SESSIONS,DICTIONARY:Un(Kn.STATE,"pain_dictionary.json"),PRINCIPLE_BLACKLIST:Un(Kn.STATE,"principle_blacklist.json"),WORKFLOWS_YAML:Un(Kn.STATE,"workflows.yaml"),IMPL_CODE_DIR:Kn.IMPL_CODE_DIR,MEMORY_MD:"MEMORY.md",HEARTBEAT:"HEARTBEAT.md",SYSTEM_LOG:Un(Kn.LOGS,"SYSTEM.log"),REFLECTION_LOG:Un(Kn.MEMORY,"reflection-log.md"),USER_CONTEXT:Un(Kn.MEMORY,"USER_CONTEXT.md"),OKR_DIR:Kn.OKR,CURRENT_FOCUS:Un(Kn.OKR,"CURRENT_FOCUS.md"),WEEK_STATE:Un(Kn.OKR,"WEEK_STATE.json"),EVOLUTION_STREAM:Un(Kn.MEMORY,"evolution.jsonl"),EVOLUTION_LOCK:Un(Kn.LOCKS,"evolution")};function Bh(e,t){return owt(e,awt[t])}var swt={LOCK_UNAVAILABLE:"lease_conflict",PATH_RESOLUTION_ERROR:"workspace_invalid",WORKSPACE_NOT_FOUND:"workspace_invalid",SAMPLE_NOT_FOUND:"storage_unavailable",CONFIGURATION_ERROR:"input_invalid",DEPENDENCY_ERROR:"runtime_unavailable",EVOLUTION_PROCESSING_ERROR:"execution_failed",TRAJECTORY_ERROR:"storage_unavailable"},$4=class extends Error{constructor(n,r,i){super(n,i);this.code=r;this.name="PdError",this.category=swt[r]??"execution_failed"}code;category};var lI=class extends $4{constructor(t,n){super(`[PD:Sample] Correction sample not found: ${t}`,"SAMPLE_NOT_FOUND",n),this.name="SampleNotFoundError"}};var uwt=16*1024,lwt=5e3,pwt=7,F4=1;function dwt(e){return Object.hasOwn(e,"name")}function nSe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function mwt(e){return!nSe(e)||typeof e.id!="number"||typeof e.session_id!="string"?!1:Object.hasOwn(e,"source")&&Object.hasOwn(e,"score")&&Object.hasOwn(e,"reason")&&Object.hasOwn(e,"severity")&&Object.hasOwn(e,"origin")&&Object.hasOwn(e,"confidence")&&Object.hasOwn(e,"text")&&Object.hasOwn(e,"canonical_pain_id")&&Object.hasOwn(e,"runtime_task_id")&&Object.hasOwn(e,"created_at")}function fwt(e){let t=[],n=["schema_version","ingest_checkpoint","sessions","assistant_turns","user_turns","tool_calls","pain_events","gate_blocks","trust_changes","principle_events","task_outcomes","correction_samples","sample_reviews","exports_audit","evolution_tasks","evolution_events"];e.exec(`
352
+ `,e),([t,n])=>[[t],n]),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]),$we=(e,t=[])=>I(I(Dwe(e),([n,r])=>I(jB(r),([i,o])=>[[n,i],o])),([n,r])=>$we(r,[...t,n]),()=>[t,e]),uyt=e=>I(I(I(jB(e),([t,n])=>I($we(n),([r,i])=>I(I(Dwe(i),([o,a])=>[[o],a],()=>[[],i]),([o,a])=>[[t,r,o],a]))),([t,n])=>[t,n],()=>I([[],e],([t,n])=>[t,n],()=>[])),([t,n])=>[Dbe(t),n]),jB=e=>I(I(cyt(e),([t,n])=>I(I(iyt(n),([r,i])=>[r,i],()=>I(oyt(n),([r,i])=>[r,i],()=>I(ayt(n),([r,i])=>[r,i],()=>I(syt(n),([r,i])=>[r,i],()=>[])))),([r,i])=>I(cwe(i),([o,a])=>[[t,r,o],a]))),([t,n])=>[$be(t),n]),lyt=e=>I(I(jB(e),([t,n])=>I(uyt(n),([r,i])=>[[t,r],i])),([t,n])=>[Fbe(t),n]),Fwe=e=>I(I(lyt(e),([t,n])=>[t,n],()=>I(_gt(e),([t,n])=>[t,n],()=>I(ln(e),([t,n])=>[t,n],()=>[]))),([t,n])=>[t,n]);function Uwe(e){let t=FB(`\`${e}\``);return S.IsEqual(t.length,2)?t[0]:yi()}function dyt(e){return e.join("|")}function myt(e){return e.slice(1,e.length-1)}function fyt(e,t,n){return Em(t,`${n}${e}`)}function hyt(e,t){return Em(e,`${t}${txe}`)}function gyt(e,t){return Em(e,`${t}${t1}`)}function yyt(e,t){return Em(e,`${t}${r1}`)}function _yt(e,t){return zT(Gt([Zt("false"),Zt("true")]),e,t)}function xyt(e,t){return Em(e,`${t}${i1}`)}function vyt(e,t,n){return Em(t,`${n}${myt(e)}`)}function byt(e,t,n){let r=JT(e,{});return zT(r,t,n)}function wyt(e,t,n){let r=zo(e);return zT(r,t,n)}function Wwe(e,t,n,r=[]){return S.ShiftLeft(e,(i,o)=>Wwe(o,t,n,[...r,zT(i,[],"")]),()=>Em(t,`${n}(${dyt(r)})`))}function zT(e,t,n){return uo(e)?wyt(e.enum,t,n):Ho(e)?gyt(t,n):In(e)?fyt(e.const,t,n):ul(e)?hyt(t,n):sc(e)?_yt(t,n):ai(e)?yyt(t,n):Vo(e)?xyt(t,n):qr(e)?vyt(e.pattern,t,n):jwe(e)?byt(e.parameters[0],t,n):rt(e)?Wwe(e.anyOf,t,n):D0e}function Em(e,t){return S.ShiftLeft(e,(n,r)=>zT(n,r,t),()=>t)}function Tyt(e){return`^${Em(e,"")}$`}function qwe(e){let t=Tyt(e);return a1(t)}function JT(e,t){return $t(e)?K.Update(qwe(e),{},t):g1(e,t)}function Gwe(e,t,n,r){let i=Ts(e,t,n);return JT(i,r)}function g1(e,t={}){return at("TemplateLiteral",[e],t)}function jwe(e){return gi(e)&&S.HasPropertyKey(e,"action")&&S.IsEqual(e.action,"TemplateLiteral")}function Bwe(e){return JT(e,{})}function Iyt(e){let t=Uwe(e);return Bwe(t)}function Kwe(e,t={}){let n=S.IsString(e)?Iyt(e):Bwe(e);return K.Update(n,{},t)}function qr(e){return Ze(e,"TemplateLiteral")}var At={};On(At,{ExtendsFalse:()=>Pt,ExtendsTrue:()=>Ve,ExtendsUnion:()=>GB,IsExtendsFalse:()=>kyt,IsExtendsTrue:()=>Vwe,IsExtendsTrueLike:()=>Cx,IsExtendsUnion:()=>Hwe,Match:()=>cr});function GB(e){return K.Create({"~kind":"ExtendsUnion"},{inferred:e})}function Hwe(e){return S.IsObject(e)&&S.HasPropertyKey(e,"~kind")&&S.HasPropertyKey(e,"inferred")&&S.IsEqual(e["~kind"],"ExtendsUnion")&&S.IsObject(e.inferred)}function Ve(e){return K.Create({"~kind":"ExtendsTrue"},{inferred:e})}function Vwe(e){return S.IsObject(e)&&S.HasPropertyKey(e,"~kind")&&S.HasPropertyKey(e,"inferred")&&S.IsEqual(e["~kind"],"ExtendsTrue")&&S.IsObject(e.inferred)}function Pt(){return K.Create({"~kind":"ExtendsFalse"},{})}function kyt(e){return S.IsObject(e)&&S.HasPropertyKey(e,"~kind")&&S.IsEqual(e["~kind"],"ExtendsFalse")}function Cx(e){return Hwe(e)||Vwe(e)}function cr(e,t,n){return Cx(e)?t(e.inferred):n()}function Eyt(e,t,n,r){return cr(an(e,n,r),i=>Ve(K.Assign(K.Assign(e,i),{[t]:n})),()=>Pt())}function Syt(e,t){return Ve(e)}function Ayt(e,t,n,r,i){return cr(an(e,t,n),o=>cr(an(o,t,r),a=>Ve(a),()=>Pt()),()=>cr(an(e,t,i),o=>Ve(o),()=>Pt()))}function Ryt(e,t,n){let r=zo(n);return an(e,t,r)}function zwe(e,t,n){return S.ShiftLeft(n,(r,i)=>cr(an(e,t,r),o=>zwe(o,t,i),()=>Pt()),()=>Ve(e))}function Cyt(e,t,n){let r=Ro(n);return an(e,t,r)}function Jwe(e,t,n){return S.ShiftLeft(n,(r,i)=>cr(an(e,t,r),o=>Ve(o),()=>Jwe(e,t,i)),()=>Pt())}function kn(e,t,n){return Er(n)?Syt(e,t):Wr(n)?Ayt(e,t,n.if,n.then,n.else):uo(n)?Ryt(e,t,n.enum):Jr(n)?Eyt(e,n.name,t,n.extends):Qt(n)?zwe(e,t,n.allOf):qr(n)?Cyt(e,t,n.pattern):rt(n)?Jwe(e,t,n.anyOf):zr(n)?Ve(e):Pt()}function Ywe(e,t,n){return Jr(n)?kn(e,t,n):Er(n)?Ve(e):zr(n)?Ve(e):GB(e)}function Oyt(e,t){let n=Lh(e),r=Lh(t);return n&&r||!n&&r?!0:!(n&&!r)}function Xwe(e,t,n,r){return hr(r)?Oyt(t,r)?an(e,n,r.items):Pt():kn(e,t,r)}function Qwe(e,t,n){return ul(n)?Ve(e):kn(e,t,n)}function Zwe(e,t,n){return sc(n)?Ve(e):kn(e,t,n)}function Pyt(e,t,n,r,i){let o=Jr(r)?t:r,a=Jr(r)?r:t,c=Ao(t),u=Ao(r);return!c&&u?Pt():cr(an(e,o,a),l=>YT(l,n,i),()=>Pt())}function Lyt(e,t,n,r){return S.ShiftLeft(r,(i,o)=>Pyt(e,t,n,i,o),()=>Ao(t)?Ve(e):Pt())}function Myt(e,t,n){return S.ShiftLeft(t,(r,i)=>Lyt(e,r,i,n),()=>Ve(e))}function YT(e,t,n){return Myt(e,t,n)}function B1(e,t,n){return ll(n)?Ve(e):an(e,t,n)}function eTe(e,t,n,r){return Er(r)?Ve(e):zr(r)?Ve(e):Li(r)?cr(YT(e,t,r.parameters),i=>B1(i,n,r.instanceType),()=>Pt()):Pt()}function tTe(e,t,n,r,i){return cr(an(e,t,i),()=>an(e,n,i),()=>an(e,r,i))}function nTe(e,t,n){let r=zo(t);return an(e,r,n)}function rTe(e,t,n,r){return Er(r)?Ve(e):zr(r)?Ve(e):Mi(r)?cr(YT(e,t,r.parameters),i=>B1(i,n,r.returnType),()=>Pt()):Pt()}function iTe(e,t,n){return Ho(n)?Ve(e):ai(n)?Ve(e):kn(e,t,n)}function oTe(e,t,n){let r=gr(t);return an(e,r,n)}function K1(e,t,n){return t===n?Ve(e):Pt()}function Nyt(e,t,n){return In(n)?K1(e,t,n.const):ul(n)?Ve(e):kn(e,Zt(t),n)}function Dyt(e,t,n){return In(n)?K1(e,t,n.const):sc(n)?Ve(e):kn(e,Zt(t),n)}function $yt(e,t,n){return In(n)?K1(e,t,n.const):ai(n)?Ve(e):kn(e,Zt(t),n)}function Fyt(e,t,n){return In(n)?K1(e,t,n.const):Vo(n)?Ve(e):kn(e,Zt(t),n)}function aTe(e,t,n){return S.IsBigInt(t.const)?Nyt(e,t.const,n):S.IsBoolean(t.const)?Dyt(e,t.const,n):S.IsNumber(t.const)?$yt(e,t.const,n):S.IsString(t.const)?Fyt(e,t.const,n):yi()}function sTe(e,t,n){return Jr(n)?kn(e,t,n):Ve(e)}function cTe(e,t,n){return vx(n)?Ve(e):kn(e,t,n)}function uTe(e,t,n){return ai(n)?Ve(e):kn(e,t,n)}function Uyt(e,t,n){return Ao(t)?Ao(n)?Ve(e):Pt():Ve(e)}function Wyt(e,t,n){return Jr(n)&&uu(n.extends)?Pt():cr(an(e,t,n),r=>Uyt(r,t,n),()=>Pt())}function qyt(e,t){return e.reduce((n,r)=>r in t?Cx(t[r])?{...n,...t[r].inferred}:yi():yi(),{})}function jyt(e,t,n){let r={};for(let a of S.Keys(n))r[a]=a in t?Wyt({},t[a],n[a]):Ao(n[a])?Jr(n[a])?Ve(K.Assign(e,{[n[a].name]:n[a].extends})):Ve(e):Pt();let i=S.Values(r).every(a=>Cx(a)),o=i?qyt(S.Keys(r),r):{};return i?Ve(o):Pt()}function Gyt(e,t,n){let r=jyt(e,t,n);return Cx(r)?Ve(K.Assign(e,r.inferred)):Pt()}function Byt(e,t,n){return Gyt(e,t,n)}function Kyt(e,t){return S.Keys(t).reduce((n,r)=>({...n,[r]:S.HasPropertyKey(e,r)?rt(n[r])?Gt([...n[r].anyOf,t[r]]):Gt([e[r],t[r]]):t[r]}),e)}function lTe(e,t,n,r){return S.ShiftLeft(t,(i,o)=>cr(an({},e[i],n),a=>lTe(e,o,n,Kyt(r,a)),()=>Pt()),()=>Ve(r))}function Hyt(e,t,n,r){let i=S.Keys(t);return lTe(t,i,r,e)}function pTe(e,t,n){return po(n)?Hyt(e,t,lc(n),Jo(n)):Tn(n)?Byt(e,t,n.properties):kn(e,St(t),n)}function Vyt(e,t){return S.IsEqual(S.Keys(t).length,0)?Ve(e):Pt()}function zyt(e,t,n,r,i){return an(e,n,i)}function dTe(e,t,n,r){return po(r)?zyt(e,d1(t),n,d1(lc(r)),Jo(r)):Tn(r)?Vyt(e,r.properties):Er(r)?Ve(e):zr(r)?Ve(e):Pt()}function mTe(e,t,n){return Vo(n)?Ve(e):kn(e,t,n)}function fTe(e,t,n){return xm(n)?Ve(e):kn(e,t,n)}function hTe(e,t,n){let r=Ro(t);return an(e,r,n)}function BB(e,t){return K.Create({"~kind":"Inferrable"},{name:e,type:t},{})}function XT(e){return S.IsObject(e)&&S.HasPropertyKey(e,"~kind")&&S.HasPropertyKey(e,"name")&&S.HasPropertyKey(e,"type")&&S.IsEqual(e["~kind"],"Inferrable")&&S.IsString(e.name)&&S.IsObject(e.type)}function KB(e){return Tm(e)?Jr(e.items)?hr(e.items.extends)?BB(e.items.name,e.items.extends.items):zr(e.items.extends)?BB(e.items.name,e.items.extends):void 0:yi():void 0}function H1(e){return Jr(e)?BB(e.name,e.extends):void 0}function HB(e,t,n=[]){return S.ShiftLeft(e,(r,i)=>cr(an({},r,t),()=>HB(i,t,[...n,r]),()=>{}),()=>n)}function gTe(e,t,n,r){let i=HB(n,r);return S.IsArray(i)?Ve(K.Assign(e,{[t]:si(i)})):Pt()}function V1(e,t,n,r){let i=HB(n,r);return S.IsArray(i)?Ve(K.Assign(e,{[t]:Gt(i)})):Pt()}function Jyt(e){return[...e].reverse()}function VB(e,t){return t?Jyt(e):e}function Yyt(e){let t=e.length>0?e[0]:void 0,n=gi(t)?KB(t):void 0;return gi(n)}function Xyt(e,t,n,r,i,o){return cr(an(e,n,i),a=>yTe(a,t,r,o),()=>Pt())}function Qyt(e,t,n,r,i){let o=KB(r);return XT(o)?gTe(e,o.name,VB(n,t),o.type):S.ShiftLeft(n,(a,c)=>Xyt(e,t,a,c,r,i),()=>Pt())}function Zyt(e,t,n,r){return S.ShiftLeft(r,(i,o)=>Qyt(e,t,n,i,o),()=>S.IsEqual(n.length,0)?Ve(e):Pt())}function yTe(e,t,n,r){return Zyt(e,t,n,r)}function e_t(e,t,n){let r=Sm(e,nr([],[]),n),i=Yyt(r);return yTe(e,i,VB(t,i),VB(r,i))}function _Te(e,t,n){let r=H1(n);return XT(r)?V1(e,r.name,t,r.type):S.ShiftLeft(t,(i,o)=>cr(an(e,i,n),a=>_Te(a,o,n),()=>Pt()),()=>Ve(e))}function xTe(e,t,n){let r=Sm(e,nr([],[]),t);return Xn(n)?e_t(e,r,n.items):hr(n)?_Te(e,r,n.items):kn(e,si(r),n)}function vTe(e,t,n){return ll(n)?Ve(e):Ex(n)?Ve(e):kn(e,t,n)}function bTe(e,t,n){return S.ShiftLeft(n,(r,i)=>cr(an(e,t,r),o=>Ve(o),()=>bTe(e,t,i)),()=>Pt())}function zB(e,t,n){return S.ShiftLeft(t,(r,i)=>cr(bTe(e,r,n),o=>zB(o,i,n),()=>Pt()),()=>Ve(e))}function wTe(e,t,n){let r=H1(n);return XT(r)?V1(e,r.name,t,r.type):rt(n)?zB(e,t,n.anyOf):zB(e,t,[n])}function TTe(e,t,n){return Jr(n)?kn(e,t,n):Er(n)?Ve(e):zr(n)?Ve(e):Pt()}function ITe(e,t,n){return ll(n)?Ve(e):kn(e,t,n)}function an(e,t,n){return Er(t)?Ywe(e,t,n):hr(t)?Xwe(e,t,t.items,n):ul(t)?Qwe(e,t,n):sc(t)?Zwe(e,t,n):Li(t)?eTe(e,t.parameters,t.instanceType,n):Wr(t)?tTe(e,t.if,t.then,t.else,n):uo(t)?nTe(e,t.enum,n):Mi(t)?rTe(e,t.parameters,t.returnType,n):Ho(t)?iTe(e,t,n):Qt(t)?oTe(e,t.allOf,n):In(t)?aTe(e,t,n):uu(t)?sTe(e,t,n):vx(t)?cTe(e,t,n):ai(t)?uTe(e,t,n):Tn(t)?pTe(e,t.properties,n):po(t)?dTe(e,lc(t),Jo(t),n):Vo(t)?mTe(e,t,n):xm(t)?fTe(e,t,n):qr(t)?hTe(e,t.pattern,n):Xn(t)?xTe(e,t.items,n):Ex(t)?vTe(e,t,n):rt(t)?wTe(e,t.anyOf,n):zr(t)?TTe(e,t,n):ll(t)?ITe(e,t,n):Pt()}function t_t(e,t){return gr([...e,St(t)])}function JB(e,t,n){return $t(e)?K.Update(t_t(e,t),{},n):GT(e,t,n)}function kTe(e,t,n,r,i){let o=Ts(e,t,n),a=QT(e,t,r);return JB(o,a,i)}function GT(e,t,n={}){return at("Interface",[e,t],n)}function Ox(e){return gi(e)&&S.HasPropertyKey(e,"action")&&S.IsEqual(e.action,"Interface")}function ETe(e,t,n={}){return JB(e,t,n)}function n_t(e,t,n){return e.includes(n)?!0:ZT([...e,n],t,t[n])}function STe(e,t,n){let r=YP(n);return Wh(e,t,r)}function Wh(e,t,n){return S.ShiftLeft(n,(r,i)=>ZT(e,t,r)?!0:Wh(e,t,i),()=>!1)}function ZT(e,t,n){return Ni(n)?n_t(e,t,n.$ref):hr(n)?ZT(e,t,n.items):Li(n)?Wh(e,t,[...n.parameters,n.instanceType]):Mi(n)?Wh(e,t,[...n.parameters,n.returnType]):Ox(n)?STe(e,t,n.parameters[1]):Qt(n)?Wh(e,t,n.allOf):Tn(n)?STe(e,t,n.properties):rt(n)?Wh(e,t,n.anyOf):Xn(n)?Wh(e,t,n.items):po(n)?ZT(e,t,Jo(n)):!1}function ATe(e,t,n){return ZT(e,t,n)}function r_t(e,t){return t.reduce((n,r)=>ATe([r],e,e[r])?[...n,r]:n,[])}function RTe(e){let t=JP(e);return r_t(e,t)}function i_t(e,t,n){return n.includes(t)?n:t in e?eI(e,e[t],[...n,t]):yi()}function CTe(e,t,n){let r=YP(t);return Px(e,r,n)}function Px(e,t,n){return t.reduce((r,i)=>eI(e,i,r),n)}function eI(e,t,n){return Ni(t)?i_t(e,t.$ref,n):hr(t)?eI(e,t.items,n):Li(t)?Px(e,[...t.parameters,t.instanceType],n):Mi(t)?Px(e,[...t.parameters,t.returnType],n):Ox(t)?CTe(e,t.parameters[1],n):Qt(t)?Px(e,t.allOf,n):Tn(t)?CTe(e,t.properties,n):rt(t)?Px(e,t.anyOf,n):Xn(t)?Px(e,t.items,n):po(t)?eI(e,Jo(t),n):n}function OTe(e,t,n){return eI(e,n,[t])}function o_t(e){return yx()}function a_t(e){return S.Keys(e).reduce((t,n)=>({...t,[n]:qh(e[n])}),{})}function tI(e){return e.reduce((t,n)=>[...t,qh(n)],[])}function qh(e){return Ni(e)?o_t(e.$ref):hr(e)?ws(qh(e.items),zP(e)):Li(e)?rl(tI(e.parameters),qh(e.instanceType)):Mi(e)?il(tI(e.parameters),qh(e.returnType)):Qt(e)?fa(tI(e.allOf)):Tn(e)?St(a_t(e.properties)):po(e)?p1(Ix(e),qh(Jo(e))):rt(e)?Gt(tI(e.anyOf)):Xn(e)?si(tI(e.items)):e}function s_t(e,t){return t in e?qh(e[t]):Ki()}function PTe(e){return s_t(e.$defs,e.$ref)}function c_t(e,t,n){let r=Ts(e,nr([],[]),t),i=QT({},nr([],[]),n);return gr([...r,St(i)])}function u_t(e,t){return S.Keys(e).filter(r=>t.includes(r)).reduce((r,i)=>{let o=e[i],a=Ox(o)?c_t(e,o.parameters[0],o.parameters[1]):o;return{...r,[i]:a}},{})}function LTe(e,t,n){let r=OTe(e,t,n),i=u_t(e,r);return al(i,t)}function MTe(e,t){return t in e?Ni(e[t])?MTe(e,e[t].$ref):e[t]:Fn()}function pl(e,t){return MTe(e,t)}function NTe(e){return co(e)?PTe(e):XP(e)?Ki():e}function lo(e,t,n){let r=NTe(t),i=NTe(n);return an(e,r,i)}var FT=0,z1=1,UT=2,c1=3;function WT(e,t){let n=[lo({},e,t),lo({},t,e)];return At.IsExtendsTrueLike(n[0])&&At.IsExtendsTrueLike(n[1])?FT:At.IsExtendsTrueLike(n[0])&&At.IsExtendsFalse(n[1])?UT:At.IsExtendsFalse(n[0])&&At.IsExtendsTrueLike(n[1])?c1:z1}function YB(e,t,n=[],r=t){return S.ShiftLeft(t,(i,o)=>{let a=WT(e,i);return S.IsEqual(a,UT)||S.IsEqual(a,FT)?r:S.IsEqual(a,z1)?YB(e,o,[...n,i],r):YB(e,o,n,r)},()=>[...n,e])}function l_t(e,t,n){let r=uc(e);return Er(r)?[r]:zr(r)?[r]:uu(r)?J1(t,n):Tn(r)?J1(t,[...n,r]):J1(t,YB(r,n))}function J1(e,t=[]){return S.ShiftLeft(e,(n,r)=>l_t(n,r,t),()=>t)}function SB(e){let t=J1(e);return Tx(t)}function XB(e,t){return K.Update(uc(e),{},t)}function DTe(e,t,n,r){let i=Me(e,t,n);return XB(i,r)}function nI(e,t=[]){return ym(e)&&S.IsEqual(e.action,"Conditional")?Ni(e.parameters[0])?nI(e.parameters[2],nI(e.parameters[3],[...t,e.parameters[0].$ref])):nI(e.parameters[2],nI(e.parameters[3],t)):ym(e)&&S.IsEqual(e.action,"Mapped")&&ym(e.parameters[1])&&S.IsEqual(e.parameters[1].action,"KeyOf")&&Ni(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function p_t(e,t){return e.reduce((n,r)=>[...n,t.includes(r.name)],[])}function UTe(e,t,n=[]){return S.ShiftLeft(e,(r,i)=>S.ShiftLeft(t,(o,a)=>UTe(i,a,[...n,[o,r]]),()=>n),()=>n)}function d_t(e){return qr(e)?Ro(e.pattern):uo(e)?zo(e.enum):e}function m_t(e){let t=d_t(e);return rt(t)?[...t.anyOf]:[t]}function f_t(e,t){return e.reduce((n,r)=>[...n,[...r,t]],[])}function $Te(e,t){return t.reduce((n,r)=>[...n,...f_t(e,r)],[])}function FTe(e){return e.reduce((t,n)=>S.IsEqual(n[0],!0)?$Te(t,m_t(n[1])):$Te(t,[n[1]]),[[]])}function WTe(e,t,n){let r=nI(n),i=p_t(e,r),o=UTe(t,i);return ym(n)&&S.IsEqual(n.action,"Conditional")||ym(n)&&S.IsEqual(n.action,"Mapped")?FTe(o):[t]}function h_t(){return["(not-resolvable)",Fn()]}function g_t(){return["(not-generic)",Fn()]}function y_t(e,t,n){return[e,_m(t,n)]}function __t(e,t,n){return t in e?qTe(e,t,e[t],n):h_t()}function qTe(e,t,n,r){return gx(n)?y_t(t,n.parameters,n.expression):Ni(n)?__t(e,n.$ref,r):g_t()}function jTe(e,t,n){return qTe(e,"(anonymous)",t,n)}function x_t(e,t,n){if(Jr(t)||Lx(t)||At.IsExtendsTrueLike(lo({},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 GTe(e,t,n,r,i){let o=Me(e,t,i);return x_t(n,o,r),K.Assign(e,{[n]:o})}function v_t(e,t,n,r,i){let o=Me(e,t,n.extends),a=Me(e,t,n.equals);return S.ShiftLeft(i,(c,u)=>QB(GTe(e,t,n.name,o,c),t,r,u),()=>QB(GTe(e,t,n.name,o,a),t,r,[]))}function QB(e,t,n,r){return S.ShiftLeft(n,(i,o)=>v_t(e,t,i,o,r),()=>e)}function BTe(e,t,n,r){return QB(e,t,n,r)}var ZB=0,e4=0;function b_t(){if(!S.IsLessThan(e4,Sp.Get().maxInstantiationCount))throw Error("Type instantiation is excessively deep and possibly infinite")}function w_t(){b_t(),e4++,ZB++}function T_t(){ZB--,S.IsEqual(ZB,0)&&(e4=0)}function I_t(e){return S.IsGreaterThan(e.callstack.length,0)?e.callstack[e.callstack.length-1]:""}function k_t(e,t){return S.IsEqual(I_t(e),t)}function E_t(e,t,n,r,i,o){w_t();try{let a=BTe(e,t,r,o),c=Me(a,nr([...t.callstack,n.$ref],t.visited),i);return Me(a,nr([],[]),c)}finally{T_t()}}function S_t(e,t,n,r,i,o){return o.reduce((a,c)=>{let u=E_t(e,t,n,r,i,c);return[...a,u]},[])}function A_t(e,t,n,r,i,o){let a=WTe(r,o,i),c=S_t(e,t,n,r,i,a);return S.IsEqual(c.length,1)?c[0]:ga(c)}function Y1(e,t,n,r){let i=Ts(e,t,r),o=jTe(e,n,r),a=o[0],c=o[1];return gx(c)?k_t(t,a)?BT(Ap(a),i):A_t(e,t,Ap(a),c.parameters,c.expression,i):BT(n,i)}function BT(e,t){return K.Create({"~kind":"Call"},{type:"call",target:e,arguments:t},{})}function KTe(e,t){return Y1({},nr([],[]),e,t)}function Lx(e){return Ze(e,"Call")}function R_t(e){return K.Discard(e,["~immutable"])}function HTe(e,t){return K.Update(R_t(e),{},t)}function VTe(e,t,n,r){let i=Me(e,t,n);return HTe(i,r)}function zTe(e,t){return e(t)}function JTe(e,t){return S.IsString(t)?Zt(zTe(e,t)):Zt(t)}function YTe(e,t){let n=Ro(t);return Cp(e,n)}function XTe(e,t){let n=t.map(r=>Cp(e,r));return Gt(n)}function Cp(e,t){return In(t)?JTe(e,t.const):qr(t)?YTe(e,t.pattern):rt(t)?XTe(e,t.anyOf):t}function y1(e,t={}){return at("Capitalize",[e],t)}function QTe(e,t={}){return t4(e,t)}function _1(e,t={}){return at("Lowercase",[e],t)}function ZTe(e,t={}){return n4(e,t)}function x1(e,t={}){return at("Uncapitalize",[e],t)}function eIe(e,t={}){return r4(e,t)}function v1(e,t={}){return at("Uppercase",[e],t)}function tIe(e,t={}){return i4(e,t)}var C_t=e=>e[0].toUpperCase()+e.slice(1),O_t=e=>e.toLowerCase(),P_t=e=>e[0].toLowerCase()+e.slice(1),L_t=e=>e.toUpperCase();function t4(e,t){return $t([e])?K.Update(Cp(C_t,e),{},t):y1(e,t)}function n4(e,t){return $t([e])?K.Update(Cp(O_t,e),{},t):_1(e,t)}function r4(e,t){return $t([e])?K.Update(Cp(P_t,e),{},t):x1(e,t)}function i4(e,t){return $t([e])?K.Update(Cp(L_t,e),{},t):v1(e,t)}function nIe(e,t,n,r){let i=Me(e,t,n);return t4(i,r)}function rIe(e,t,n,r){let i=Me(e,t,n);return n4(i,r)}function iIe(e,t,n,r){let i=Me(e,t,n);return r4(i,r)}function oIe(e,t,n,r){let i=Me(e,t,n);return i4(i,r)}function b1(e,t,n,r,i={}){return at("Conditional",[e,t,n,r],i)}function aIe(e,t,n,r,i={}){return o4({},nr([],[]),e,t,n,r,i)}function M_t(e,t,n,r,i,o){let a=lo(e,n,r);return At.IsExtendsUnion(a)?Gt([Me(a.inferred,t,i),Me(e,t,o)]):At.IsExtendsTrue(a)?Me(a.inferred,t,i):Me(e,t,o)}function o4(e,t,n,r,i,o,a){return $t([n,r])?K.Update(M_t(e,t,n,r,i,o),{},a):b1(n,r,i,o,a)}function sIe(e,t,n,r,i,o,a){let c=Me(e,t,n),u=Me(e,t,r);return o4(e,t,c,u,i,o,a)}function w1(e,t={}){return at("ConstructorParameters",[e],t)}function cIe(e,t={}){return a4(e,t)}function N_t(e){let t=Li(e)?e.parameters:[],n=Sm({},nr([],[]),t);return si(n)}function a4(e,t){return $t([e])?K.Update(N_t(e),{},t):w1(e,t)}function uIe(e,t,n,r){let i=Me(e,t,n);return a4(i,r)}function T1(e,t,n={}){return at("Exclude",[e,t],n)}function lIe(e,t,n={}){return rI(e,t,n)}function rI(e,t,n){return $t([e,t])?K.Update(u1(e,t),{},n):T1(e,t,n)}function pIe(e,t,n,r,i){let o=Me(e,t,n),a=Me(e,t,r);return rI(o,a,i)}function I1(e,t,n={}){return at("Extract",[e,t],n)}function dIe(e,t,n={}){return s4(e,t,n)}function D_t(e,t){let n=lo({},e,t);return At.IsExtendsTrueLike(n)?[e]:[]}function mIe(e,t,n=[]){return S.ShiftLeft(e,(r,i)=>mIe(i,t,[...n,...D_t(r,t)]),()=>n)}function fIe(e,t){let n=uc(e),r=rt(n)?n.anyOf:[n],i=mIe(r,t);return ga(i)}function s4(e,t,n){return $t([e,t])?K.Update(fIe(e,t),{},n):I1(e,t,n)}function hIe(e,t,n,r,i){let o=Me(e,t,n),a=Me(e,t,r);return s4(o,a,i)}function $_t(e){return e.reduce((t,n)=>n1(n)?[...t,Zt(n)]:t,[])}function Mx(e){let t=$_t(e);return Gt(t)}function KT(e,t,n={}){return at("Index",[e,t],n)}function gIe(e,t,n={}){let r=S.IsArray(t)?Mx(t):t;return c4(e,r,n)}function yIe(e,t){let n=pl(e,t);return Is(n)}function _Ie(e,t,n){let r=pu(e,t,n);return Is(r)}function F_t(e,t){let n=S.Keys(e).filter(d=>!S.HasPropertyKey(t,d)),r=S.Keys(t).filter(d=>!S.HasPropertyKey(e,d)),i=S.Keys(e).filter(d=>S.HasPropertyKey(t,d)),o=n.reduce((d,m)=>({...d,[m]:e[m]}),{}),a=r.reduce((d,m)=>({...d,[m]:t[m]}),{}),c=i.reduce((d,m)=>({...d,[m]:gr([e[m],t[m]])}),{}),u=K.Assign(o,a);return K.Assign(u,c)}function xIe(e){return e.reduce((t,n)=>F_t(t,Is(n)),{})}function vIe(e){let t=Txe(si(e));return Is(t)}function U_t(e,t){return S.Keys(e).filter(i=>i in t).reduce((i,o)=>({...i,[o]:ga([e[o],t[o]])}),{})}function bIe(e,t){return S.ShiftLeft(e,(n,r)=>bIe(r,U_t(t,Is(n))),()=>t)}function wIe(e){return S.ShiftLeft(e,(t,n)=>bIe(n,Is(t)),()=>yi())}function Is(e){return co(e)?yIe(e.$defs,e.$ref):Wr(e)?_Ie(e.if,e.then,e.else):Qt(e)?xIe(e.allOf):rt(e)?wIe(e.anyOf):Xn(e)?vIe(e.items):Tn(e)?e.properties:{}}function Nx(e){let t=Is(e);return St(t)}var W_t=new RegExp("^(?:0|[1-9][0-9]*)$");function Dx(e){let t=`${e}`;return W_t.test(t)?parseInt(t):e}function q_t(e){return Zt(Dx(e))}function TIe(e){return e.map(t=>IIe(t))}function IIe(e){return Qt(e)?fa(TIe(e.allOf)):rt(e)?Gt(TIe(e.anyOf)):In(e)?q_t(e.const):e}function kIe(e,t){let n=IIe(t),r=lo({},n,Ba());return At.IsExtendsTrueLike(r)?e:In(t)&&S.IsEqual(t.const,"length")?Ba():Fn()}function EIe(e,t){let n=pl(e,t);return Ka(n)}function SIe(e,t,n){let r=pu(e,t,n);return Ka(r)}function AIe(e){let t=zo(e);return Ka(t)}function RIe(e){let t=gr(e);return Ka(t)}function CIe(e){return[`${e}`]}function OIe(e){let t=Ro(e);return Ka(t)}function PIe(e){return e.reduce((t,n)=>[...t,...Ka(n)],[])}function Ka(e){return co(e)?EIe(e.$defs,e.$ref):Wr(e)?SIe(e.if,e.then,e.else):uo(e)?AIe(e.enum):Qt(e)?RIe(e.allOf):In(e)?CIe(e.const):qr(e)?OIe(e.pattern):rt(e)?PIe(e.anyOf):[]}function $x(e){return Ka(e)}function iI(e,t){return t.map(n=>oI(e,n))}function oI(e,t){return hr(t)?ws(oI(e,t.items)):Li(t)?rl(iI(e,t.parameters),oI(e,t.instanceType)):Mi(t)?il(iI(e,t.parameters),oI(e,t.returnType)):Xn(t)?si(iI(e,t.items)):rt(t)?Gt(iI(e,t.anyOf)):Qt(t)?fa(iI(e,t.allOf)):f1(t)?St(e):t}function LIe(e,t){return oI(e,t)}function j_t(e,t){let n=t in e?e[t]:Fn();return LIe(e,n)}function MIe(e,t){return t.reduce((n,r)=>[...n,j_t(e,r)],[])}function G_t(e,t){let n=$x(t),r=MIe(e,n);return ga(r)}var B_t=new RegExp(wm);function K_t(e){return e.filter(n=>B_t.test(n))}function H_t(e){let t=JP(e),n=K_t(t),r=MIe(e,n);return ga(r)}function NIe(e,t){return ai(t)?H_t(e):G_t(e,t)}function V_t(e){return Zt(Dx(e))}function DIe(e){return e.map(t=>u4(t))}function u4(e){return Qt(e)?fa(DIe(e.allOf)):rt(e)?Gt(DIe(e.anyOf)):In(e)?V_t(e.const):e}function z_t(e,t){return e.reduceRight((n,r,i)=>{let o=lo({},Zt(i),t);return At.IsExtendsTrueLike(o)?[r,...n]:n},[])}function J_t(e,t){let n=u4(t),r=z_t(e,n);return vm(r)}function Y_t(e){return vm(e)}function $Ie(e,t){return In(t)&&S.IsEqual(t.const,"length")?Zt(e.length):ai(t)||Ho(t)?Y_t(e):J_t(e,t)}function FIe(e,t){return hr(e)?kIe(e.items,t):Tn(e)?NIe(e.properties,t):Xn(e)?$Ie(e.items,t):Fn()}function X_t(e){return co(e)||Wr(e)||Qt(e)||rt(e)?Nx(e):e}function c4(e,t,n){return $t([e,t])?K.Update(FIe(X_t(e),t),{},n):KT(e,t,n)}function UIe(e,t,n,r,i){let o=Me(e,t,n),a=Me(e,t,r);return c4(o,a,i)}function k1(e,t={}){return at("InstanceType",[e],t)}function WIe(e,t={}){return l4(e,t)}function Q_t(e){return Li(e)?e.instanceType:Fn()}function l4(e,t){return $t([e])?K.Update(Q_t(e),{},t):k1(e,t)}function qIe(e,t,n,r={}){let i=Me(e,t,n);return l4(i,r)}function HT(e,t={}){return at("KeyOf",[e],t)}function jIe(e,t={}){return p4(e,t)}function GIe(){return Gt([Ba(),cc(),bx()])}function BIe(e){return Ba()}function Z_t(e){return e.reduce((n,r)=>n1(r)?[...n,Zt(Dx(r))]:yi(),[])}function KIe(e){let t=S.Keys(e),n=Z_t(t);return vm(n)}function HIe(e){return Ix(e)}function VIe(e){let t=e.map((n,r)=>Zt(r));return vm(t)}function zIe(e){return Er(e)?GIe():hr(e)?BIe(e.items):Tn(e)?KIe(e.properties):po(e)?HIe(e):Xn(e)?VIe(e.items):Fn()}function e0t(e){return co(e)||Wr(e)||Qt(e)||rt(e)?Nx(e):e}function p4(e,t){return $t([e])?K.Update(zIe(e0t(e)),{},t):HT(e,t)}function JIe(e,t,n,r){let i=Me(e,t,n);return p4(i,r)}function jT(e,t,n,r,i={}){return at("Mapped",[e,t,n,r],i)}function YIe(e,t,n,r,i={}){return d4({},nr([],[]),e,t,n,r,i)}function t0t(e){let t=Ro(e);return X1(t)}function n0t(e){return e.reduce((t,n)=>[...t,...X1(n)],[])}function r0t(e){let t=zo(e);return X1(t)}function i0t(e){return S.IsNumber(e)?[Zt(`${e}`)]:[Zt(e)]}function X1(e){return uo(e)?r0t(e.enum):In(e)?i0t(e.const):qr(e)?t0t(e.pattern):rt(e)?n0t(e.anyOf):[e]}function XIe(e){return X1(e)}function o0t(e){return qr(e)?Ro(e.pattern):e}function a0t(e,t,n,r,i,o){let a=K.Assign(e,{[n.name]:r}),c=Me(a,t,i),u=o0t(c),l=Me(a,t,o);return rxe(u)||ixe(u)?{[u.const]:l}:{}}function s0t(e,t,n,r,i,o){return r.reduce((a,c)=>[...a,a0t(e,t,n,c,i,o)],[])}function c0t(e){return e.reduce((t,n)=>[...t,St(n)],[])}function QIe(e,t,n,r,i,o){let a=XIe(r),c=s0t(e,t,n,a,i,o),u=c0t(c);return gr(u)}function d4(e,t,n,r,i,o,a){return $t([r])?K.Update(QIe(e,t,n,r,i,o),{},a):jT(n,r,i,o,a)}function ZIe(e,t,n,r,i,o,a){let c=Me(e,t,r);return d4(e,t,n,c,i,o,a)}function u0t(e,t,n){let r=K.Assign(e,t);return S.Keys(t).filter(o=>n.includes(o)).reduce((o,a)=>({...o,[a]:LTe(r,a,t[a])}),{})}function l0t(e,t,n){let r=K.Assign(e,t);return S.Keys(t).filter(o=>!n.includes(o)).reduce((o,a)=>({...o,[a]:Me(r,nr([],[]),t[a])}),{})}function p0t(e,t,n){let r=RTe(t),i=u0t(e,t,r),o=l0t(e,t,r),a={...i,...o};return K.Update(a,{},n)}function Q1(e,t,n,r){return p0t(e,n,r)}function E1(e,t={}){return at("NonNullable",[e],t)}function eke(e,t={}){return m4(e,t)}function d0t(e){let t=Gt([xx(),kx()]);return rI(e,t,{})}function m4(e,t){return $t([e])?K.Update(d0t(e),{},t):E1(e,t)}function tke(e,t,n,r){let i=Me(e,t,n);return m4(i,r)}function S1(e,t,n={}){return at("Omit",[e,t],n)}function nke(e,t,n={}){let r=S.IsArray(t)?Mx(t):t;return f4(e,r,n)}function Z1(e){let t=Nx(e);return Tn(t)?t.properties:yi()}function m0t(e,t){return S.Keys(e).reduce((r,i)=>t.includes(i)?r:{...r,[i]:e[i]},{})}function rke(e,t){let n=Z1(e),r=$x(t),i=m0t(n,r);return St(i)}function f4(e,t,n){return $t([e,t])?K.Update(rke(e,t),{},n):S1(e,t,n)}function ike(e,t,n,r,i){let o=Me(e,t,n),a=Me(e,t,r);return f4(o,a,i)}function A1(e,t={}){return at("Parameters",[e],t)}function oke(e,t={}){return h4(e,t)}function f0t(e){let t=Mi(e)?e.parameters:[],n=Sm({},nr([],[]),t);return si(n)}function h4(e,t){return $t([e])?K.Update(f0t(e),{},t):A1(e,t)}function ake(e,t,n,r){let i=Me(e,t,n);return h4(i,r)}function R1(e,t={}){return at("Partial",[e],t)}function ske(e,t={}){return g4(e,t)}function cke(e,t){let n=pl(e,t),r=dl(n);return al(K.Assign(e,{[t]:r}),t)}function uke(e,t,n){let r=pu(e,t,n);return dl(r)}function lke(e){let t=gr(e);return dl(t)}function pke(e){let t=e.map(n=>dl(n));return Gt(t)}function dke(e){let t=S.Keys(e).reduce((r,i)=>({...r,[i]:Oh(e[i])}),{});return St(t)}function dl(e){return co(e)?cke(e.$defs,e.$ref):Wr(e)?uke(e.if,e.then,e.else):Qt(e)?lke(e.allOf):rt(e)?pke(e.anyOf):Tn(e)?dke(e.properties):St({})}function g4(e,t){return $t([e])?K.Update(dl(e),{},t):R1(e,t)}function mke(e,t,n,r){let i=Me(e,t,n);return g4(i,r)}function C1(e,t,n={}){return at("Pick",[e,t],n)}function fke(e,t,n={}){let r=S.IsArray(t)?Mx(t):t;return y4(e,r,n)}function h0t(e,t){return S.Keys(e).reduce((r,i)=>t.includes(i)?K.Assign(r,{[i]:e[i]}):r,{})}function hke(e,t){let n=Z1(e),r=$x(t),i=h0t(n,r);return St(i)}function y4(e,t,n){return $t([e,t])?K.Update(hke(e,t),{},n):C1(e,t,n)}function gke(e,t,n,r,i){let o=Me(e,t,n),a=Me(e,t,r);return y4(o,a,i)}function O1(e,t={}){return at("ReadonlyObject",[e],t)}function _4(e,t={}){return x4(e,t)}var yke=_4;function _ke(e){return _x(ws(e))}function xke(e,t){let n=pl(e,t),r=ml(n);return al(K.Assign(e,{[t]:r}),t)}function vke(e,t,n){let r=pu(e,t,n);return ml(r)}function bke(e){let t=gr(e);return ml(t)}function wke(e){let t=S.Keys(e).reduce((r,i)=>({...r,[i]:Mh(e[i])}),{});return St(t)}function Tke(e){return _x(si(e))}function Ike(e){let t=e.map(n=>ml(n));return Gt(t)}function ml(e){return hr(e)?_ke(e.items):co(e)?xke(e.$defs,e.$ref):Wr(e)?vke(e.if,e.then,e.else):Qt(e)?bke(e.allOf):Tn(e)?wke(e.properties):Xn(e)?Tke(e.items):rt(e)?Ike(e.anyOf):e}function x4(e,t){return $t([e])?K.Update(ml(e),{},t):O1(e)}function kke(e,t,n,r){let i=Me(e,t,n);return x4(i,r)}function Eke(e,t,n,r){return t.visited.includes(r)?n:r in e?Me(e,nr(t.callstack,[...t.visited,r]),e[r]):n}function Ske(e,t){let n=pl(e,t),r=fl(n);return al(K.Assign(e,{[t]:r}),t)}function Ake(e,t,n){let r=pu(e,t,n);return fl(r)}function Rke(e){let t=gr(e);return fl(t)}function Cke(e){let t=e.map(n=>fl(n));return Gt(t)}function Oke(e){let t=S.Keys(e).reduce((r,i)=>({...r,[i]:s1(e[i])}),{});return St(t)}function fl(e){return co(e)?Ske(e.$defs,e.$ref):Wr(e)?Ake(e.if,e.then,e.else):Qt(e)?Rke(e.allOf):rt(e)?Cke(e.anyOf):Tn(e)?Oke(e.properties):St({})}function P1(e,t={}){return at("Required",[e],t)}function Pke(e,t={}){return v4(e,t)}function v4(e,t){return $t([e])?K.Update(fl(e),{},t):P1(e,t)}function Lke(e,t,n,r){let i=Me(e,t,n);return v4(i,r)}function L1(e,t={}){return at("ReturnType",[e],t)}function Mke(e,t={}){return b4(e,t)}function g0t(e){return Mi(e)?e.returnType:Fn()}function b4(e,t){return $t([e])?K.Update(g0t(e),{},t):L1(e,t)}function Nke(e,t,n,r={}){let i=Me(e,t,n);return b4(i,r)}function M1(e,t){return at("With",[e,t],{})}function Dke(e,t){return w4(e,t)}function w4(e,t){return $t([e])?K.Update(e,{},t):M1(e,t)}function $ke(e,t,n,r){let i=Me(e,t,n);return w4(i,r)}function y0t(e){return Tm(e)?Xn(e.items)?T4(e.items.items):Jr(e.items)?[e]:Ni(e.items)?[e]:[Fn()]:[e]}function T4(e){return e.reduce((n,r)=>[...n,...y0t(r)],[])}function nr(e,t){return{callstack:e,visited:t}}function $t(e){return S.ShiftLeft(e,(t,n)=>Ni(t)?!1:$t(n),()=>!0)}function QT(e,t,n){return S.Keys(n).reduce((r,i)=>({...r,[i]:Me(e,t,n[i])}),{})}function Sm(e,t,n){let r=Ts(e,t,n);return T4(r)}function Ts(e,t,n){return n.map(r=>Me(e,t,r))}function _0t(e,t){let n=Ao(e)?OT(t,{}):t,r=Nh(e)?CT(n,{}):n;return Lh(e)?aI(r,{}):r}function x0t(e,t,n,r,i){return S.IsEqual(n,"AddImmutable")?Fke(e,t,r[0],i):S.IsEqual(n,"RemoveImmutable")?VTe(e,t,r[0],i):S.IsEqual(n,"AddReadonly")?P0e(e,t,r[0],i):S.IsEqual(n,"RemoveReadonly")?_xe(e,t,r[0],i):S.IsEqual(n,"AddOptional")?L0e(e,t,r[0],i):S.IsEqual(n,"RemoveOptional")?bxe(e,t,r[0],i):S.IsEqual(n,"Capitalize")?nIe(e,t,r[0],i):S.IsEqual(n,"Conditional")?sIe(e,t,r[0],r[1],r[2],r[3],i):S.IsEqual(n,"ConstructorParameters")?uIe(e,t,r[0],i):S.IsEqual(n,"Evaluate")?DTe(e,t,r[0],i):S.IsEqual(n,"Exclude")?pIe(e,t,r[0],r[1],i):S.IsEqual(n,"Extract")?hIe(e,t,r[0],r[1],i):S.IsEqual(n,"Index")?UIe(e,t,r[0],r[1],i):S.IsEqual(n,"InstanceType")?qIe(e,t,r[0],i):S.IsEqual(n,"Interface")?kTe(e,t,r[0],r[1],i):S.IsEqual(n,"KeyOf")?JIe(e,t,r[0],i):S.IsEqual(n,"Lowercase")?rIe(e,t,r[0],i):S.IsEqual(n,"Mapped")?ZIe(e,t,r[0],r[1],r[2],r[3],i):S.IsEqual(n,"Module")?Q1(e,t,r[0],i):S.IsEqual(n,"NonNullable")?tke(e,t,r[0],i):S.IsEqual(n,"Pick")?gke(e,t,r[0],r[1],i):S.IsEqual(n,"Parameters")?ake(e,t,r[0],i):S.IsEqual(n,"Partial")?mke(e,t,r[0],i):S.IsEqual(n,"Omit")?ike(e,t,r[0],r[1],i):S.IsEqual(n,"ReadonlyObject")?kke(e,t,r[0],i):S.IsEqual(n,"Record")?Fxe(e,t,r[0],r[1],i):S.IsEqual(n,"Required")?Lke(e,t,r[0],i):S.IsEqual(n,"ReturnType")?Nke(e,t,r[0],i):S.IsEqual(n,"TemplateLiteral")?Gwe(e,t,r[0],i):S.IsEqual(n,"Uncapitalize")?iIe(e,t,r[0],i):S.IsEqual(n,"Uppercase")?oIe(e,t,r[0],i):S.IsEqual(n,"With")?$ke(e,t,r[0],r[1]):at(n,r,i)}function v0t(e,t,n){let r=Ni(n)?Eke(e,t,n,n.$ref):hr(n)?ws(Me(e,t,n.items),zP(n)):Lx(n)?Y1(e,t,n.target,n.arguments):Li(n)?rl(Ts(e,t,n.parameters),Me(e,t,n.instanceType),M0e(n)):Mi(n)?il(Ts(e,t,n.parameters),Me(e,t,n.returnType),N0e(n)):Wr(n)?Ph(Me(e,t,n.if),Me(e,t,n.then),Me(e,t,n.else),q0e(n)):Qt(n)?fa(Ts(e,t,n.allOf),H0e(n)):Tn(n)?St(QT(e,t,n.properties),U0e(n)):po(n)?Uxe(lc(n),Me(e,t,Jo(n))):Tm(n)?Fh(Me(e,t,n.items)):Xn(n)?si(Sm(e,t,n.items),yxe(n)):rt(n)?Gt(Ts(e,t,n.anyOf),axe(n)):n;return _0t(n,r)}function Me(e,t,n){return ym(n)?x0t(e,t,n.action,n.parameters,n.options):v0t(e,t,n)}function I4(e,t){return Me(e,nr([],[]),t)}function b0t(e){return K.Update(e,{"~immutable":!0},{})}function aI(e,t){return K.Update(b0t(e),{},t)}function Fke(e,t,n,r){let i=Me(e,t,n);return aI(i,r)}function Ube(e,t={}){return at("AddImmutable",[e],t)}function _x(e,t={}){return aI(e,t)}function Wbe(e,t={}){return at("Evaluate",[e],t)}function Uke(e,t={}){return XB(e,t)}function qbe(e,t={}){return at("Module",[e],t)}function Wke(e,t={}){return Q1({},nr([],[]),e,t)}function qke(...e){let[t,n,r]=sl.Match(e,{2:(a,c)=>S.IsString(a)?[{},a,c]:[a,c,{}],3:(a,c,u)=>[a,c,u],1:a=>[{},a,{}]}),i=Fwe(n),o=S.IsArray(i)&&S.IsEqual(i.length,2)?Me(t,nr([],[]),i[0]):Fn();return K.Update(o,{},r)}var Fe={};On(Fe,{Any:()=>yx,Array:()=>ws,BigInt:()=>NT,Boolean:()=>e1,Call:()=>KTe,Capitalize:()=>QTe,Codec:()=>ZP,Conditional:()=>aIe,Constructor:()=>rl,ConstructorParameters:()=>cIe,Cyclic:()=>al,Decode:()=>Y0e,DecodeBuilder:()=>MT,Dependent:()=>Ph,Encode:()=>X0e,EncodeBuilder:()=>LT,Enum:()=>K0e,Evaluate:()=>Uke,Exclude:()=>lIe,Extends:()=>lo,ExtendsResult:()=>At,Extract:()=>dIe,Function:()=>il,Generic:()=>_m,Identifier:()=>DT,Immutable:()=>Q0e,Index:()=>gIe,Infer:()=>PT,InstanceType:()=>WIe,Instantiate:()=>I4,Integer:()=>Dh,Interface:()=>ETe,Intersect:()=>fa,IsAny:()=>Er,IsArray:()=>hr,IsBigInt:()=>ul,IsBoolean:()=>sc,IsCall:()=>Lx,IsCodec:()=>QP,IsConstructor:()=>Li,IsCyclic:()=>co,IsDependent:()=>Wr,IsEnum:()=>uo,IsEnumValue:()=>B0e,IsFunction:()=>Mi,IsGeneric:()=>gx,IsIdentifier:()=>nxe,IsImmutable:()=>Lh,IsInfer:()=>Jr,IsInteger:()=>Ho,IsIntersect:()=>Qt,IsKind:()=>Ze,IsLiteral:()=>In,IsNever:()=>uu,IsNull:()=>vx,IsNumber:()=>ai,IsObject:()=>Tn,IsOptional:()=>Ao,IsParameter:()=>oxe,IsReadonly:()=>Nh,IsRecord:()=>po,IsRef:()=>Ni,IsRefine:()=>vB,IsRest:()=>Tm,IsSchema:()=>gi,IsString:()=>Vo,IsSymbol:()=>xm,IsTemplateLiteral:()=>qr,IsThis:()=>f1,IsTuple:()=>Xn,IsUndefined:()=>Ex,IsUnion:()=>rt,IsUnknown:()=>zr,IsUnsafe:()=>XP,IsVoid:()=>ll,KeyOf:()=>jIe,Literal:()=>Zt,Lowercase:()=>ZTe,Mapped:()=>YIe,Module:()=>Wke,Never:()=>Fn,NonNullable:()=>eke,Null:()=>xx,Number:()=>Ba,Object:()=>St,Omit:()=>nke,Optional:()=>$0e,Parameter:()=>$h,Parameters:()=>oke,Partial:()=>ske,Pick:()=>fke,Readonly:()=>Z0e,ReadonlyObject:()=>_4,ReadonlyType:()=>yke,Record:()=>p1,RecordKey:()=>Ix,RecordPattern:()=>lc,RecordValue:()=>Jo,Ref:()=>Ap,Refine:()=>exe,Required:()=>Pke,Rest:()=>Fh,ReturnType:()=>Mke,Script:()=>qke,String:()=>cc,Symbol:()=>bx,TemplateLiteral:()=>Kwe,This:()=>m1,Tuple:()=>si,Uncapitalize:()=>eIe,Undefined:()=>kx,Union:()=>Gt,Unknown:()=>Ki,Unsafe:()=>W0e,Uppercase:()=>tIe,Void:()=>h1,With:()=>Dke});var jke=Fe.Object({candidateIndex:Fe.Number(),badDecision:Fe.String({minLength:1}),betterDecision:Fe.String({minLength:1}),rationale:Fe.String({minLength:1}),confidence:Fe.Number({minimum:0,maximum:1}),riskLevel:Fe.Union([Fe.Literal("low"),Fe.Literal("medium"),Fe.Literal("high")]),strategicPerspective:Fe.String({minLength:1})}),Gke=Fe.Object({valid:Fe.Boolean(),taskId:Fe.String({minLength:1}),candidates:Fe.Array(jke,{minItems:1,maxItems:5}),sourcePrincipleId:Fe.Optional(Fe.String()),sourcePainId:Fe.Optional(Fe.String()),contextRefs:Fe.Array(Fe.String()),generatedAt:Fe.String({minLength:1}),reason:Fe.Optional(Fe.String())});var Ixr=Fe.Object({}),kxr=Fe.Object({artifactId:Fe.Optional(Fe.String({description:"Specific artifact id to read."})),sourceTaskId:Fe.Optional(Fe.String({description:"Read artifacts produced by this task (e.g. the predecessor diagnostician task)."}))});var eL=Fe.Object({caseId:Fe.String({minLength:1}),kind:Fe.Union([Fe.Literal("positive"),Fe.Literal("negative")]),toolName:Fe.String({minLength:1}),params:Fe.Record(Fe.String(),Fe.Unknown()),expectedDecision:Fe.Union([Fe.Literal("allow"),Fe.Literal("block"),Fe.Literal("propose_correction")]),expectedProposedParams:Fe.Optional(Fe.Record(Fe.String(),Fe.Unknown())),expectedApplicationMode:Fe.Optional(Fe.Union([Fe.Literal("shadow"),Fe.Literal("live")])),ruleContext:Fe.Optional(Fe.Unknown())}),Bke=Fe.Object({scribeArtifactId:Fe.String({minLength:1}),philosopherArtifactId:Fe.Optional(Fe.String({minLength:1})),dreamerArtifactId:Fe.Optional(Fe.String({minLength:1}))}),Kke=Fe.Object({taskId:Fe.String({minLength:1}),sourceScribeArtifactId:Fe.String({minLength:1}),implementationCode:Fe.String({minLength:1}),goldenTraceCases:Fe.Array(eL,{minItems:2,maxItems:10}),affectedTools:Fe.Array(Fe.String({minLength:1}),{minItems:1}),implementationSummary:Fe.String({minLength:1}),risks:Fe.Array(Fe.String()),sourceTrace:Bke,generatedAt:Fe.String({minLength:1}),requiresContextVersion:Fe.Optional(Fe.Literal(2))});var jxr=Fe.Object({}),Gxr=Fe.Object({code:Fe.String({description:"The rule implementation source code to validate statically."})}),Bxr=Fe.Object({code:Fe.String({description:"The rule implementation source code to replay."}),goldenTraceCases:Fe.Array(eL,{minItems:2,maxItems:10,description:"Golden trace cases to replay against. At least 1 positive + 1 negative."})});var k0t=["=== RuleCode Dialect Spec (PRI-439) ===","","CANONICAL FORM:"," function evaluate(input, helpers) {"," // ... matcher logic ...",' return { decision: "allow"|"block"|"requireApproval"|"auto_correct", matched: <boolean>, reason: "<string>" };'," }",""," - Bare function (NO `export` keyword \u2014 export is forbidden)."," - Synchronous only (NO `async` / `await`)."," - The function MUST be named `evaluate` and take exactly (input, helpers).","","RETURN SHAPE (every return statement must include all three required fields):",' - decision: "allow" | "block" | "requireApproval" | "auto_correct"'," - matched: boolean (true if the rule applied to this input)"," - reason: non-empty string",' - correctionProposal?: required when decision === "auto_correct"',"","MATCHED=FALSE RULE:",' When matched === false, decision MUST be "allow". A "block" or "requireApproval"'," with matched=false is contradictory and will be rejected.","","FORBIDDEN PATTERNS (static check rejects these):"," require, import, export, async, await, fetch, eval, Function, process,"," globalThis, global, Reflect, Proxy, constructor, Buffer,"," setTimeout, setInterval, setImmediate, queueMicrotask,"," XMLHttpRequest, Math.random, crypto",' (also forbidden: bracket access like globalThis["require"])',"","INPUT SHAPE (input.action and input.context are the safe surfaces to inspect):"," input.action.toolName : string"," input.action.normalizedPath: string | null (posix-relative when available)"," input.action.paramsSummary : Record<string, unknown>"," input.workspace.isRiskPath : boolean"," input.derived.estimatedLineChanges: number",' input.derived.bashRisk : "safe"|"normal"|"dangerous"|"unknown"'," input.context : RuleContextV2 | undefined (optional, v2 only)","","CONTEXT (RuleContext v2 \u2014 optional, requiresContextVersion: 2):"," input.context.version : 2",' input.context.history.status : "available" | "unavailable"'," input.context.history.unavailableReason : string | undefined"," input.context.history.truncated: boolean"," input.context.history.calls : ReadonlyArray<RuleToolCallRecord>",' input.context.facts.priorReadOfTarget : "yes" | "no" | "unknown"'," input.context.facts.readCount : number | null"," input.context.facts.writeCount : number | null"," input.context.facts.uniqueWritePathCount : number | null"," input.context.facts.sameActionBlockCount : number | null","","CONTEXT RULES (critical for v2 rules):",' - When input.context is undefined or context.history.status === "unavailable",',' the rule MUST allow (decision: "allow", matched: false).',' Unavailable context must never be interpreted as "no history" or "not done".'," - Prefer context.facts (deterministic, host-computed) over raw context.history.calls."," Use canonicalKind from facts for kind-based logic; raw calls only when facts"," cannot express the needed pattern.",' - Do NOT infer "not done" from an empty calls array. An empty or truncated'," history window means the host did not provide enough data, not that the"," action did not happen."," - Rules declaring requiresContextVersion: 2 must handle context unavailability"," gracefully (return allow). v1 rules (no requiresContextVersion) must not"," read input.context and behave exactly as before.","","HELPERS (second argument):"," helpers.isRiskPath() : boolean"," helpers.getToolName() : string"," helpers.getEstimatedLineChanges() : number",' helpers.getBashRisk() : "safe"|"normal"|"dangerous"|"unknown"'," helpers.getEpTier() : number","","GOLDEN TRACE CASES (2-10 cases, at least 1 positive + 1 negative):",' - positive case: expectedDecision must be "allow"',' - negative case: expectedDecision is "block" or "propose_correction"'," - propose_correction cases MUST include expectedProposedParams + expectedApplicationMode","","WORKFLOW:"," 1. Call read_rulecode_spec once (or as needed) to ground your output."," 2. Call validate_rulecode with your draft code to catch static errors."," 3. Call replay_rulecode with your code + goldenTraceCases to verify sandbox replay."," 4. Call submit_rulecode with the full ArtificerRuleOutput once replay passes.",""].join(`
353
+ `);var A0t=new Set(["__proto__","constructor","prototype"]),Vke=3,R0t=5,C0t=new Set(["allow","block","propose_correction"]),O0t={valid:!0,errors:[]};function E4(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Yke(e){for(let t of Object.keys(e))if(A0t.has(t))return!1;return!0}function P0t(e){return e.length===0?O0t:{valid:!1,errors:e}}function S4(e){return typeof e=="string"&&e.trim().length>0}function zke(e,t,n){let r=[];return E4(e)?Yke(e)?((!Object.hasOwn(e,"caseId")||!S4(e.caseId))&&r.push(`${t}.caseId must be a non-empty string`),(!Object.hasOwn(e,"kind")||e.kind!==n)&&r.push(`${t}.kind must be '${n}'`),(!Object.hasOwn(e,"toolName")||!S4(e.toolName))&&r.push(`${t}.toolName must be a non-empty string`),(!Object.hasOwn(e,"params")||!E4(e.params))&&r.push(`${t}.params must be a plain object`),!Object.hasOwn(e,"expectedDecision")||typeof e.expectedDecision!="string"||!C0t.has(e.expectedDecision)?r.push(`${t}.expectedDecision must be one of allow|block|propose_correction`):n==="positive"&&e.expectedDecision!=="allow"&&r.push(`${t}: positive cases must expect allow`),r):(r.push(`${t} must not carry prototype-pollution keys`),r):(r.push(`${t} must be a plain object`),r)}function Jke(e,t){let{fieldName:n,maxLength:r,requireNonEmpty:i}=t,o=[];if(!Array.isArray(e))return o.push(`${n} must be an array`),o;i&&e.length===0&&o.push(`${n} must contain at least 1 item`),r!==void 0&&e.length>r&&o.push(`${n} must contain at most ${r} items, got ${e.length}`);for(let a=0;a<e.length;a++)typeof e[a]!="string"&&o.push(`${n}[${a}] must be a string`);return o}function tL(e){if(!E4(e))return{valid:!1,errors:["BehaviorExamplePack must be a plain object"]};if(!Yke(e))return{valid:!1,errors:["BehaviorExamplePack must not carry prototype-pollution keys"]};let t=[];if(Object.hasOwn(e,"sourceNegativeCase")?t.push(...zke(e.sourceNegativeCase,"sourceNegativeCase","negative")):t.push("sourceNegativeCase is required"),(!Object.hasOwn(e,"ownerDesiredOutcome")||!S4(e.ownerDesiredOutcome))&&t.push("ownerDesiredOutcome must be a non-empty string"),!Object.hasOwn(e,"positiveCounterexamples"))t.push("positiveCounterexamples is required");else if(!Array.isArray(e.positiveCounterexamples))t.push("positiveCounterexamples must be an array");else{let n=e.positiveCounterexamples;n.length===0&&t.push("positiveCounterexamples must contain at least 1 item"),n.length>Vke&&t.push(`positiveCounterexamples must contain at most ${Vke} items, got ${n.length}`);for(let r=0;r<n.length;r++)t.push(...zke(n[r],`positiveCounterexamples[${r}]`,"positive"))}return Object.hasOwn(e,"evidenceRefs")?t.push(...Jke(e.evidenceRefs,{fieldName:"evidenceRefs",maxLength:R0t,requireNonEmpty:!0})):t.push("evidenceRefs is required"),Object.hasOwn(e,"redactionNotes")?t.push(...Jke(e.redactionNotes,{fieldName:"redactionNotes"})):t.push("redactionNotes is required"),P0t(t)}var sI=Object.create(null);sI.principle="principle-ledger";sI.rule="rule-candidate";sI.implementation="implementation-candidate";sI.prompt="prompt-injection-candidate";sI.defer="deferred";go();go();go();wi();var nL={evaluatorRepairBudgetExhausted:"evaluator_repair_budget_exhausted",rolloutRevisionBudgetExhausted:"rollout_revision_budget_exhausted",evaluatorRepairSeedFailed:"evaluator_repair_seed_failed",rolloutActivationCandidateUnresolved:"rollout_activation_candidate_unresolved",rolloutDispatchNotWired:"rollout_dispatch_not_wired",rolloutDispatchRefused:"rollout_dispatch_refused",rolloutRevisionTargetUnresolved:"rollout_revision_target_unresolved",rolloutRevisionRoutingNotWired:"rollout_revision_routing_not_wired",rolloutRevisionReopenFailed:"rollout_revision_reopen_failed",rolloutRevisionIterationMissing:"rollout_revision_iteration_missing",workspaceDirtyStall:"workspace_dirty_stall"},K0t=new Set([nL.evaluatorRepairBudgetExhausted,nL.rolloutRevisionBudgetExhausted]);wi();wi();wi();go();var Q0t={canonicalDiagnosis:{workspaceDir:"/workspace/dogfood",painEvents:[{id:1,source:"manual",reason:"Before declaring a user journey complete verify full observable product surface",text:"Manual record: surface validation missing",created_at:"2026-06-13T10:00:00.000Z",score:90}],tasks:[{task_id:"diagnosis_manual_1",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:01:00.000Z",input_ref:"pain_1",diagnostic_json:JSON.stringify({rootCause:"Verifier checks static patterns but misses real runtime load."})}],candidates:[],dreamerTasks:[],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},subRunDiagnosis:{workspaceDir:"/workspace/dogfood",painEvents:[{id:"2",source:"manual",reason:"Verify config file updates before committing",text:"Manual record: verify config changes",created_at:"2026-06-13T10:02:00.000Z",score:80}],tasks:[{task_id:"diag_router-diagnosis_manual_2",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:03:00.000Z",input_ref:"pain_2",diagnostic_json:JSON.stringify({rootCause:"No pre-commit hook runs pd config verification."})}],candidates:[{candidate_id:"cand-subrun-2",task_id:"diag_router-diagnosis_manual_2",title:"Verify config changes before commit",description:"Verify all config files conform to parser constraints prior to commit.",confidence:.95,recommendation_kind:"principle"}],dreamerTasks:[],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},asyncPendingWithoutConsumer:{workspaceDir:"/workspace/dogfood",painEvents:[{id:3,source:"manual",reason:"Agent does not pause to clarify when command fails",created_at:"2026-06-13T10:04:00.000Z",score:75}],tasks:[{task_id:"diagnosis_manual_3",task_kind:"diagnostician",status:"pending",created_at:"2026-06-13T10:05:00.000Z",input_ref:"pain_3"}],candidates:[],dreamerTasks:[],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},candidateGeneratedNoDreamer:{workspaceDir:"/workspace/dogfood",painEvents:[{id:4,source:"manual",reason:"Auto-consumer should lease tasks correctly",created_at:"2026-06-13T10:06:00.000Z",score:70}],tasks:[{task_id:"diagnosis_manual_4",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:07:00.000Z",input_ref:"pain_4"}],candidates:[{candidate_id:"cand-4",task_id:"diagnosis_manual_4",title:"Lease tasks correctly in auto-consumer",description:"Prevent ready dreamer tasks from staying pending.",confidence:.85,recommendation_kind:"principle"}],dreamerTasks:[],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},dreamerPending:{workspaceDir:"/workspace/dogfood",painEvents:[{id:5,source:"manual",reason:"Dreamer pending task scenario",created_at:"2026-06-13T10:08:00.000Z",score:85}],tasks:[{task_id:"diagnosis_manual_5",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:09:00.000Z",input_ref:"pain_5"}],candidates:[{candidate_id:"cand-5",task_id:"diagnosis_manual_5",title:"Dreamer pending title",description:"Dreamer pending description",confidence:.9}],dreamerTasks:[{task_id:"dreamer-cand-5-prompt",task_kind:"dreamer",status:"pending"}],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},dreamerRunning:{workspaceDir:"/workspace/dogfood",painEvents:[{id:6,source:"manual",reason:"Dreamer running task scenario",created_at:"2026-06-13T10:10:00.000Z",score:85}],tasks:[{task_id:"diagnosis_manual_6",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:11:00.000Z",input_ref:"pain_6"}],candidates:[{candidate_id:"cand-6",task_id:"diagnosis_manual_6",title:"Dreamer running title",description:"Dreamer running description",confidence:.9}],dreamerTasks:[{task_id:"dreamer-cand-6-prompt",task_kind:"dreamer",status:"running"}],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},dreamerFailed:{workspaceDir:"/workspace/dogfood",painEvents:[{id:7,source:"manual",reason:"Dreamer failed task scenario",created_at:"2026-06-13T10:12:00.000Z",score:85}],tasks:[{task_id:"diagnosis_manual_7",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:13:00.000Z",input_ref:"pain_7"}],candidates:[{candidate_id:"cand-7",task_id:"diagnosis_manual_7",title:"Dreamer failed title",description:"Dreamer failed description",confidence:.9}],dreamerTasks:[{task_id:"dreamer-cand-7-prompt",task_kind:"dreamer",status:"failed"}],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},dreamerSucceeded:{workspaceDir:"/workspace/dogfood",painEvents:[{id:8,source:"manual",reason:"Dreamer succeeded task scenario",created_at:"2026-06-13T10:14:00.000Z",score:85}],tasks:[{task_id:"diagnosis_manual_8",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:15:00.000Z",input_ref:"pain_8"}],candidates:[{candidate_id:"cand-8",task_id:"diagnosis_manual_8",title:"Dreamer succeeded title",description:"Dreamer succeeded description",confidence:.9}],dreamerTasks:[{task_id:"dreamer-cand-8-prompt",task_kind:"dreamer",status:"succeeded"}],ledgerPrinciples:[{id:"principle-8",derivedFromPainIds:["pain_8"],status:"candidate",text:"Dreamer succeeded principle text"}],trajectoryDbAvailable:!0,stateDbAvailable:!0},malformedLedgerDegradedJson:{workspaceDir:"/workspace/dogfood",painEvents:[{id:9,source:"manual",reason:"Malformed data handling",created_at:"2026-06-13T10:16:00.000Z",score:80}],tasks:[{task_id:"diagnosis_manual_9",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:17:00.000Z",input_ref:"pain_9",diagnostic_json:"{invalid-json}"}],candidates:[],dreamerTasks:[],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},workspaceMismatchWarning:{workspaceDir:"/workspace/dogfood",painEvents:[{id:10,source:"hook",reason:"Workspace mismatch event",created_at:"2026-06-13T10:18:00.000Z",score:60}],tasks:[{task_id:"diagnosis_other_999",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:00:00.000Z",input_ref:"pain_999"}],candidates:[],dreamerTasks:[],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0},autoConsumerSuccess:{workspaceDir:"/workspace/dogfood",painEvents:[{id:11,source:"manual",reason:"Auto-consumer leasing and successor creation success",created_at:"2026-06-13T10:20:00.000Z",score:95}],tasks:[{task_id:"diagnosis_manual_11",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:21:00.000Z",input_ref:"pain_11"}],candidates:[{candidate_id:"cand-11",task_id:"diagnosis_manual_11",title:"Auto-consumer successor task",description:"Verifies that successor philosopher task is created after dreamer success.",confidence:.9}],dreamerTasks:[{task_id:"dreamer-cand-11-prompt",task_kind:"dreamer",status:"succeeded"}],ledgerPrinciples:[{id:"principle-11",derivedFromPainIds:["pain_11"],status:"active"}],trajectoryDbAvailable:!0,stateDbAvailable:!0},autoConsumerFailure:{workspaceDir:"/workspace/dogfood",painEvents:[{id:12,source:"manual",reason:"Auto-consumer failure persistence check",created_at:"2026-06-13T10:22:00.000Z",score:95}],tasks:[{task_id:"diagnosis_manual_12",task_kind:"diagnostician",status:"succeeded",created_at:"2026-06-13T10:23:00.000Z",input_ref:"pain_12"}],candidates:[{candidate_id:"cand-12",task_id:"diagnosis_manual_12",title:"Auto-consumer failure details",description:"Dreamer failed task description",confidence:.9}],dreamerTasks:[{task_id:"dreamer-cand-12-prompt",task_kind:"dreamer",status:"failed"}],ledgerPrinciples:[],trajectoryDbAvailable:!0,stateDbAvailable:!0}};wi();var nEe={manifestId:"dreamer.v1",schemaVersion:xv,runnerKind:"dreamer",tier0:["pain.summary.headline","diagnosis.summary.headline"],tier1:["pain.summary.category","pain.summary.severity","pain.summary.rootSymptom","diagnosis.summary.rootCause","diagnosis.summary.affectedComponents"],tier2:[],budgetTokens:1500,priority:["diagnosis.summary.rootCause","pain.summary.rootSymptom","pain.summary.category","pain.summary.severity","diagnosis.summary.affectedComponents","pain.summary.headline","diagnosis.summary.headline"]},rEe={manifestId:"scribe.v1",schemaVersion:xv,runnerKind:"scribe",tier0:["philosopher.summary.headline","philosopher.predecessorSummary.headline"],tier1:["philosopher.summary.thesis","philosopher.summary.principleTitle","philosopher.summary.principleScope","philosopher.predecessorSummary.badDecision","philosopher.predecessorSummary.betterDecision","philosopher.predecessorSummary.rationale","philosopher.predecessorSummary.riskLevel","philosopher.predecessorSummary.strategicPerspective"],tier2:[],budgetTokens:1800,priority:["philosopher.summary.principleTitle","philosopher.summary.thesis","philosopher.predecessorSummary.betterDecision","philosopher.predecessorSummary.riskLevel","philosopher.predecessorSummary.rationale","philosopher.summary.principleScope","philosopher.predecessorSummary.badDecision","philosopher.predecessorSummary.strategicPerspective","philosopher.summary.headline","philosopher.predecessorSummary.headline"]},iEe={manifestId:"artificer.v1",schemaVersion:xv,runnerKind:"artificer",tier0:["scribe.summary.headline","scribe.predecessorSummary.headline"],tier1:["scribe.summary.principleText","scribe.summary.scope","scribe.summary.exceptions"],tier2:["dreamer.raw.betterDecision","dreamer.raw.rationale","dreamer.raw.riskLevel"],budgetTokens:2e3,priority:["scribe.summary.principleText","dreamer.raw.betterDecision","scribe.summary.scope","dreamer.raw.rationale","dreamer.raw.riskLevel","scribe.summary.exceptions","scribe.summary.headline","scribe.predecessorSummary.headline"]},rL={manifestId:"evaluator.stage1.v1",schemaVersion:xv,runnerKind:"evaluator",tier0:["artificer.summary.headline","artificer.predecessorSummary.headline"],tier1:["scribe.summary.principleText","scribe.summary.scope","artificer.summary.changedFiles","artificer.summary.apiSurface","artificer.summary.risks","dreamer.summary.badDecision","dreamer.summary.betterDecision","dreamer.summary.rationale","dreamer.summary.riskLevel","pain.summary.rootSymptom","pain.summary.category"],tier2:[],budgetTokens:3e3,priority:["scribe.summary.principleText","dreamer.summary.betterDecision","pain.summary.rootSymptom","artificer.summary.apiSurface","dreamer.summary.riskLevel","dreamer.summary.rationale","scribe.summary.scope","artificer.summary.risks","pain.summary.category","artificer.summary.changedFiles","dreamer.summary.badDecision","artificer.summary.headline","artificer.predecessorSummary.headline"]},oEe={...rL,manifestId:"evaluator.stage2.v1",tier2:["pain.raw.evidence","dreamer.raw.candidates"],budgetTokens:4500,priority:[...rL.priority,"pain.raw.evidence","dreamer.raw.candidates"]},Z0t=[nEe,rEe,iEe,rL,oEe],Bvr=Array.from(new Set(Z0t.map(e=>e.runnerKind)));go();wi();go();wi();go();wi();go();wi();go();wi();go();go();wi();go();wi();wi();import XTr from"better-sqlite3";import iIr from"better-sqlite3";import pIr from"better-sqlite3";var ks;(function(e){e[e.Seed=1]="Seed",e[e.Sprout=2]="Sprout",e[e.Sapling=3]="Sapling",e[e.Tree=4]="Tree",e[e.Forest=5]="Forest"})(ks||(ks={}));var tvt=[{tier:ks.Seed,name:"Seed",requiredPoints:0,permissions:{maxLinesPerWrite:150,maxFilesPerTask:3,allowRiskPath:!1,allowSubagentSpawn:!0}},{tier:ks.Sprout,name:"Sprout",requiredPoints:50,permissions:{maxLinesPerWrite:300,maxFilesPerTask:5,allowRiskPath:!1,allowSubagentSpawn:!0}},{tier:ks.Sapling,name:"Sapling",requiredPoints:200,permissions:{maxLinesPerWrite:500,maxFilesPerTask:10,allowRiskPath:!0,allowSubagentSpawn:!0}},{tier:ks.Tree,name:"Tree",requiredPoints:500,permissions:{maxLinesPerWrite:1e3,maxFilesPerTask:20,allowRiskPath:!0,allowSubagentSpawn:!0}},{tier:ks.Forest,name:"Forest",requiredPoints:1e3,permissions:{maxLinesPerWrite:Number.MAX_SAFE_INTEGER,maxFilesPerTask:Number.MAX_SAFE_INTEGER,allowRiskPath:!0,allowSubagentSpawn:!0}}];var nvt={doubleRewardCooldownMs:3600*1e3,maxRecentEvents:50,difficultyPenalty:{tier4Trivial:.1,tier4Normal:.5,tier5Trivial:.1,tier5Normal:.5}};var jh=s.Union([s.Literal(ks.Seed),s.Literal(ks.Sprout),s.Literal(ks.Sapling),s.Literal(ks.Tree),s.Literal(ks.Forest)]),P4=s.Object({maxLinesPerWrite:s.Number(),maxFilesPerTask:s.Number(),allowRiskPath:s.Boolean(),allowSubagentSpawn:s.Boolean()}),rvt=s.Object({tier:jh,name:s.String(),requiredPoints:s.Number(),permissions:P4}),pEe=s.Union([s.Literal("trivial"),s.Literal("normal"),s.Literal("hard")]),ivt=s.Object({basePoints:s.Number(),description:s.String()}),dEe=s.Union([s.Literal("success"),s.Literal("failure")]),mEe=s.Object({id:s.String(),timestamp:s.String(),type:dEe,taskHash:s.String(),taskDifficulty:pEe,toolName:s.Optional(s.String()),filePath:s.Optional(s.String()),reason:s.Optional(s.String()),pointsAwarded:s.Number(),isDoubleReward:s.Boolean(),sessionId:s.Optional(s.String())}),fEe=s.Object({totalSuccesses:s.Number(),totalFailures:s.Number(),consecutiveSuccesses:s.Number(),consecutiveFailures:s.Number(),doubleRewardsEarned:s.Number(),tierPromotions:s.Number(),pointsByDifficulty:s.Object({trivial:s.Number(),normal:s.Number(),hard:s.Number()})}),hEe=s.Tuple([s.String(),s.String()]),gEe=s.Object({version:s.Literal("2.0"),agentId:s.String(),totalPoints:s.Number(),availablePoints:s.Number(),currentTier:jh,lastDoubleRewardTime:s.Optional(s.String()),recentFailureHashes:s.Array(hEe),stats:fEe,recentEvents:s.Array(mEe),lastUpdated:s.String()}),ovt=s.Object({scorecard:gEe,archivedStats:s.Object({totalEventsProcessed:s.Number(),pointsFromTrivial:s.Number(),pointsFromNormal:s.Number(),pointsFromHard:s.Number()})}),avt=s.Object({doubleRewardCooldownMs:s.Number(),maxRecentEvents:s.Number(),difficultyPenalty:s.Object({tier4Trivial:s.Number(),tier4Normal:s.Number(),tier5Trivial:s.Number(),tier5Normal:s.Number()})}),svt=s.Object({totalEventsProcessed:s.Number(),pointsFromTrivial:s.Number(),pointsFromNormal:s.Number(),pointsFromHard:s.Number()}),cvt=s.Object({allowed:s.Boolean(),reason:s.Optional(s.String()),currentTier:s.Optional(jh),requiredTier:s.Optional(jh)}),uvt=s.Object({toolName:s.String(),filePath:s.Optional(s.String()),content:s.Optional(s.String()),lineCount:s.Optional(s.Number()),isRiskPath:s.Optional(s.Boolean())}),lvt=s.Object({previousTier:jh,newTier:jh,totalPoints:s.Number(),timestamp:s.String(),newPermissions:P4}),aL=s.Union([s.Literal("candidate"),s.Literal("probation"),s.Literal("active"),s.Literal("deprecated"),s.Literal("archived")]),L4=s.Union([s.Literal("deterministic"),s.Literal("weak_heuristic"),s.Literal("manual_only")]);var M4=s.Object({applicabilityTags:s.Array(s.String()),positiveSignals:s.Array(s.String()),negativeSignals:s.Array(s.String()),toolSequenceHints:s.Array(s.Array(s.String())),confidence:s.Union([s.Literal("high"),s.Literal("medium"),s.Literal("low")])}),yEe=s.Object({name:s.String(),type:s.Union([s.Literal("hook"),s.Literal("gate"),s.Literal("skill"),s.Literal("test"),s.Literal("prompt")]),triggerCondition:s.String(),enforcement:s.Union([s.Literal("block"),s.Literal("warn"),s.Literal("log")]),action:s.String(),implementationHint:s.Optional(s.String())}),_Ee=s.Object({painPreventedCount:s.Number(),lastPainPreventedAt:s.Optional(s.String()),calculatedAt:s.String()}),pvt=s.Object({id:s.String(),version:s.Number(),text:s.String(),source:s.Object({painId:s.String(),painType:s.Union([s.Literal("tool_failure"),s.Literal("dispatch_error"),s.Literal("subagent_error"),s.Literal("user_frustration")]),timestamp:s.String()}),trigger:s.String(),action:s.String(),guardrails:s.Optional(s.Array(s.String())),contextTags:s.Array(s.String()),validation:s.Object({successCount:s.Number(),conflictCount:s.Number()}),status:aL,feedbackScore:s.Number(),usageCount:s.Number(),createdAt:s.String(),activatedAt:s.Optional(s.String()),deprecatedAt:s.Optional(s.String()),evaluability:L4,detectorMetadata:s.Optional(M4),abstractedPrinciple:s.Optional(s.String()),coreAxiomId:s.Optional(s.String()),priority:s.Optional(s.Union([s.Literal("P0"),s.Literal("P1"),s.Literal("P2")])),scope:s.Optional(s.Union([s.Literal("general"),s.Literal("domain")])),domain:s.Optional(s.String()),suggestedRules:s.Optional(s.Array(yEe)),valueMetrics:s.Optional(_Ee)}),dvt=s.Union([s.Literal("pain_detected"),s.Literal("candidate_created"),s.Literal("principle_promoted"),s.Literal("principle_deprecated"),s.Literal("principle_rolled_back"),s.Literal("circuit_breaker_opened"),s.Literal("legacy_import")]),O4=s.Object({painId:s.String(),painType:s.Union([s.Literal("tool_failure"),s.Literal("dispatch_error"),s.Literal("subagent_error"),s.Literal("user_frustration")]),source:s.String(),reason:s.String(),score:s.Optional(s.Number()),sessionId:s.Optional(s.String()),agentId:s.Optional(s.String()),taskId:s.Optional(s.String()),traceId:s.Optional(s.String()),provenance:s.Optional(s.Union([s.Literal("host_context_bound"),s.Literal("owner_reported_no_host_trace"),s.Literal("automatic_hook"),s.Literal("openclaw_context_bound")])),hostKind:s.Optional(s.Union([s.Literal("openclaw"),s.Literal("codex")]))}),xEe=s.Object({painId:s.String(),principleId:s.String(),trigger:s.String(),action:s.String(),status:s.Literal("candidate"),painType:s.Optional(s.Union([s.Literal("tool_failure"),s.Literal("dispatch_error"),s.Literal("subagent_error"),s.Literal("user_frustration")])),evaluability:s.Optional(L4),detectorMetadata:s.Optional(M4),abstractedPrinciple:s.Optional(s.String()),coreAxiomId:s.Optional(s.String())}),vEe=s.Object({principleId:s.String(),from:aL,to:aL,reason:s.String(),successCount:s.Optional(s.Number())}),bEe=s.Object({principleId:s.String(),reason:s.String(),triggeredBy:s.Union([s.Literal("auto"),s.Literal("manual")])}),wEe=s.Object({principleId:s.String(),reason:s.String(),triggeredBy:s.Union([s.Literal("user_command"),s.Literal("auto_conflict")]),blacklistPattern:s.Optional(s.String()),relatedPainId:s.Optional(s.String())}),TEe=s.Object({taskId:s.String(),painId:s.String(),failCount:s.Number(),reason:s.String(),requireHuman:s.Boolean(),nextRetryAt:s.Optional(s.String())}),IEe=s.Object({sourceFile:s.String(),content:s.String(),contentHash:s.Optional(s.String())}),mvt=s.Union([s.Object({ts:s.String(),type:s.Literal("pain_detected"),data:O4}),s.Object({ts:s.String(),type:s.Literal("pain_recorded"),data:O4}),s.Object({ts:s.String(),type:s.Literal("candidate_created"),data:xEe}),s.Object({ts:s.String(),type:s.Literal("principle_promoted"),data:vEe}),s.Object({ts:s.String(),type:s.Literal("principle_deprecated"),data:bEe}),s.Object({ts:s.String(),type:s.Literal("principle_rolled_back"),data:wEe}),s.Object({ts:s.String(),type:s.Literal("circuit_breaker_opened"),data:TEe}),s.Object({ts:s.String(),type:s.Literal("legacy_import"),data:IEe})]);var kEe=s.Object({term:s.String(),weight:s.Number(),source:s.Union([s.Literal("seed"),s.Literal("llm"),s.Literal("user")]),addedAt:s.String(),hitCount:s.Optional(s.Number({minimum:0})),truePositiveCount:s.Optional(s.Number({minimum:0})),falsePositiveCount:s.Optional(s.Number({minimum:0})),lastHitAt:s.Optional(s.String())}),fvt=s.Object({keywords:s.Array(kEe),version:s.Integer({minimum:0}),lastOptimizedAt:s.String()}),hvt=s.Object({matched:s.Boolean(),matchedTerms:s.Array(s.String()),score:s.Number({minimum:0,maximum:1}),confidence:s.Number({minimum:0,maximum:1})});var Bvt={on_change:"smoke",on_risk_change:"unit",commands:{}},WEe={enabled:!0,spiral_boost:20,min_threshold:15,max_threshold:70,backlog_trigger:6,hard_failure_trigger:1,low_recent_success_boost:15,high_recent_pain_boost:10},Kvt={soft_capture_threshold:30,adaptive:{...WEe}},Hvt={enabled:!0,heartbeat_stale_hours:72},Vvt={enabled:!0,max_file_size_bytes:10*1024*1024,fuzzy_match_enabled:!0,fuzzy_match_threshold:.8,skip_large_file_action:"warn"};var zvt={audit_level:"medium",risk_paths:[],evolution_mode:"realtime",tests:{...Bvt},pain:{soft_capture_threshold:Kvt.soft_capture_threshold,adaptive:{...WEe}},lifecycle:{...Hvt},edit_verification:{...Vvt},custom_guards:[]};import cwt from"better-sqlite3";import _i from"fs";import pc from"path";import ZEe from"crypto";import*as Yr from"fs";import*as JEe from"path";var D4=class extends Error{filePath;lockPath;constructor(t,n,r){super(t),this.name="LockAcquisitionError",this.filePath=n,this.lockPath=r}},zbt={maxRetries:50,baseRetryDelayMs:10,maxRetryDelayMs:500,lockStaleMs:1e4,lockSuffix:".lock"};function YEe(e){try{return process.kill(e,0),!0}catch{return!1}}function zEe(e,t){try{let n=JEe.dirname(e);Yr.existsSync(n)||Yr.mkdirSync(n,{recursive:!0});let r=Yr.constants.O_WRONLY|Yr.constants.O_CREAT|Yr.constants.O_EXCL,i=Yr.openSync(e,r);return Yr.writeSync(i,String(t)),Yr.fsyncSync(i),Yr.closeSync(i),!0}catch(n){if(n.code==="EEXIST")return!1;throw n}}function uI(e){try{let t=Yr.readFileSync(e,"utf8"),n=parseInt(t.trim(),10);return Number.isNaN(n)?null:n}catch{return null}}function Jbt(e,t){try{uI(e)===t&&Yr.unlinkSync(e)}catch{}}function Ybt(e,t){try{let n=Yr.statSync(e),r=uI(e),i=Date.now()-n.mtimeMs>t,o=r===null||!YEe(r);if(i||o)try{return Yr.unlinkSync(e),!0}catch{return!1}return!1}catch{return!1}}function Xbt(e,t,n){let r=Math.min(t*Math.pow(2,e),n),i=r*.2*Math.random();return Math.floor(r+i)}function Qbt(e){let t=Date.now()+e;for(;Date.now()<t;);}function Zbt(e,t){let n=uI(t),r=n!==null?YEe(n)?`alive (PID ${n})`:`dead (PID ${n})`:"unknown";return new D4(`Failed to acquire lock for ${e}. Lock holder: ${r}.`,e,t)}function ewt(e,t,n){let r=e+t.lockSuffix;return zEe(r,n)&&uI(r)===n?{lockPath:r,pid:n,acquiredAt:Date.now()}:(Ybt(r,t.lockStaleMs),zEe(r,n)&&uI(r)===n?{lockPath:r,pid:n,acquiredAt:Date.now()}:null)}function twt(e,t={}){let n={...zbt,...t},{pid:r}=process;for(let i=0;i<n.maxRetries;i++){let o=ewt(e,n,r);if(o)return o;if(i<n.maxRetries-1){let a=Xbt(i,n.baseRetryDelayMs,n.maxRetryDelayMs);Qbt(a)}}throw Zbt(e,e+n.lockSuffix)}function nwt(e){Jbt(e.lockPath,e.pid)}function XEe(e,t,n={}){let r=twt(e,n);try{return t()}finally{nwt(r)}}import*as Ux from"fs";var QEe=3,rwt=50;function sL(e,t){let n=e+".tmp";Ux.writeFileSync(n,t,"utf8");let r;for(let i=0;i<QEe;i++)try{Ux.renameSync(n,e);return}catch(o){r=o;let a=o.code;if(a==="EPERM"||a==="EBUSY"||a==="EACCES"){if(i<QEe-1){let c=rwt*Math.pow(2,i),u=Date.now()+c,l=!1;for(;Date.now()<u;)if(!l&&Date.now()>=u-10){try{$e("fs").accessSync?.(n)}catch{}l=!0}}continue}break}try{Ux.unlinkSync(n)}catch{}throw r}import*as Gh from"path";var Un=(...e)=>Gh.posix.join(...e);function iwt(e){return/^[A-Za-z]:[\\/]/.test(e)||e.startsWith("\\\\")}function owt(e,t){return iwt(e)?Gh.win32.join(e,t):e.startsWith("/")?Gh.posix.join(e,t):Gh.join(e,t)}var Kn={IDENTITY:".principles",MODELS:Un(".principles","models"),STATE:".state",MEMORY:"memory",OKR:Un("memory","okr"),LOGS:Un("memory","logs"),SESSIONS:Un(".state","sessions"),PAIN_SAMPLES:Un("memory","pain"),LOCKS:Un("memory",".locks"),IMPL_CODE_DIR:Un(".state","principles","implementations")},awt={PROFILE:Un(Kn.IDENTITY,"PROFILE.json"),PRINCIPLES:Un(Kn.IDENTITY,"PRINCIPLES.md"),THINKING_OS:Un(Kn.IDENTITY,"THINKING_OS.md"),DECISION_POLICY:Un(Kn.IDENTITY,"DECISION_POLICY.json"),MODELS_DIR:Kn.MODELS,STATE_DIR:Kn.STATE,EVOLUTION_QUEUE:Un(Kn.STATE,"evolution_queue.json"),EVOLUTION_DIRECTIVE:Un(Kn.STATE,"evolution_directive.json"),WORKBOARD:Un(Kn.STATE,"WORKBOARD.json"),AGENT_SCORECARD:Un(Kn.STATE,"AGENT_SCORECARD.json"),PAIN_FLAG:Un(Kn.STATE,".pain_flag"),SYSTEM_CAPABILITIES:Un(Kn.STATE,"SYSTEM_CAPABILITIES.json"),PAIN_SETTINGS:Un(Kn.STATE,"pain_settings.json"),PAIN_CANDIDATES:Un(Kn.STATE,"pain_candidates.json"),TRAJECTORY_DB:Un(Kn.STATE,"trajectory.db"),TRAJECTORY_BLOBS_DIR:Un(Kn.STATE,"blobs"),EXPORTS_DIR:Un(Kn.STATE,"exports"),SESSION_DIR:Kn.SESSIONS,DICTIONARY:Un(Kn.STATE,"pain_dictionary.json"),PRINCIPLE_BLACKLIST:Un(Kn.STATE,"principle_blacklist.json"),WORKFLOWS_YAML:Un(Kn.STATE,"workflows.yaml"),IMPL_CODE_DIR:Kn.IMPL_CODE_DIR,MEMORY_MD:"MEMORY.md",HEARTBEAT:"HEARTBEAT.md",SYSTEM_LOG:Un(Kn.LOGS,"SYSTEM.log"),REFLECTION_LOG:Un(Kn.MEMORY,"reflection-log.md"),USER_CONTEXT:Un(Kn.MEMORY,"USER_CONTEXT.md"),OKR_DIR:Kn.OKR,CURRENT_FOCUS:Un(Kn.OKR,"CURRENT_FOCUS.md"),WEEK_STATE:Un(Kn.OKR,"WEEK_STATE.json"),EVOLUTION_STREAM:Un(Kn.MEMORY,"evolution.jsonl"),EVOLUTION_LOCK:Un(Kn.LOCKS,"evolution")};function Bh(e,t){return owt(e,awt[t])}var swt={LOCK_UNAVAILABLE:"lease_conflict",PATH_RESOLUTION_ERROR:"workspace_invalid",WORKSPACE_NOT_FOUND:"workspace_invalid",SAMPLE_NOT_FOUND:"storage_unavailable",CONFIGURATION_ERROR:"input_invalid",DEPENDENCY_ERROR:"runtime_unavailable",EVOLUTION_PROCESSING_ERROR:"execution_failed",TRAJECTORY_ERROR:"storage_unavailable"},$4=class extends Error{constructor(n,r,i){super(n,i);this.code=r;this.name="PdError",this.category=swt[r]??"execution_failed"}code;category};var lI=class extends $4{constructor(t,n){super(`[PD:Sample] Correction sample not found: ${t}`,"SAMPLE_NOT_FOUND",n),this.name="SampleNotFoundError"}};var uwt=16*1024,lwt=5e3,pwt=7,F4=1;function dwt(e){return Object.hasOwn(e,"name")}function nSe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function mwt(e){return!nSe(e)||typeof e.id!="number"||typeof e.session_id!="string"?!1:Object.hasOwn(e,"source")&&Object.hasOwn(e,"score")&&Object.hasOwn(e,"reason")&&Object.hasOwn(e,"severity")&&Object.hasOwn(e,"origin")&&Object.hasOwn(e,"confidence")&&Object.hasOwn(e,"text")&&Object.hasOwn(e,"canonical_pain_id")&&Object.hasOwn(e,"runtime_task_id")&&Object.hasOwn(e,"created_at")}function fwt(e){let t=[],n=["schema_version","ingest_checkpoint","sessions","assistant_turns","user_turns","tool_calls","pain_events","gate_blocks","trust_changes","principle_events","task_outcomes","correction_samples","sample_reviews","exports_audit","evolution_tasks","evolution_events"];e.exec(`
354
354
  CREATE TABLE IF NOT EXISTS schema_version (version INTEGER NOT NULL);
355
355
  CREATE TABLE IF NOT EXISTS ingest_checkpoint (
356
356
  source_key TEXT PRIMARY KEY,