@ai-agent-forge/agent-forge 0.85.18 → 0.85.19
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.
- package/CHANGELOG.md +26 -6
- package/dist/bundle/.build-manifest.json +3 -3
- package/dist/bundle/chunks/{chunk-2I2FZ6F3.js → chunk-NMLW4KE7.js} +1 -1
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/http-dispatcher.d.ts +10 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +21 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/package.json +1 -1
|
@@ -269,7 +269,7 @@ ${end.comment}`:end.comment}this.doc.range[2]=end.offset;break}default:this.erro
|
|
|
269
269
|
`)+1;for(;nl!==0;)this.onNewLine(this.offset+nl),nl=this.source.indexOf(`
|
|
270
270
|
`,nl)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(map){let it=map.items[map.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,it.value){let end="end"in it.value?it.value.end:void 0;(Array.isArray(end)?end[end.length-1]:void 0)?.type==="comment"?end?.push(this.sourceToken):map.items.push({start:[this.sourceToken]})}else it.sep?it.sep.push(this.sourceToken):it.start.push(this.sourceToken);return;case"space":case"comment":if(it.value)map.items.push({start:[this.sourceToken]});else if(it.sep)it.sep.push(this.sourceToken);else{if(this.atIndentedComment(it.start,map.indent)){let end=map.items[map.items.length-2]?.value?.end;if(Array.isArray(end)){arrayPushArray(end,it.start),end.push(this.sourceToken),map.items.pop();return}}it.start.push(this.sourceToken)}return}if(this.indent>=map.indent){let atMapIndent=!this.onKeyLine&&this.indent===map.indent,atNextItem=atMapIndent&&(it.sep||it.explicitKey)&&this.type!=="seq-item-ind",start=[];if(atNextItem&&it.sep&&!it.value){let nl=[];for(let i=0;i<it.sep.length;++i){let st2=it.sep[i];switch(st2.type){case"newline":nl.push(i);break;case"space":break;case"comment":st2.indent>map.indent&&(nl.length=0);break;default:nl.length=0}}nl.length>=2&&(start=it.sep.splice(nl[1]))}switch(this.type){case"anchor":case"tag":atNextItem||it.value?(start.push(this.sourceToken),map.items.push({start}),this.onKeyLine=!0):it.sep?it.sep.push(this.sourceToken):it.start.push(this.sourceToken);return;case"explicit-key-ind":!it.sep&&!it.explicitKey?(it.start.push(this.sourceToken),it.explicitKey=!0):atNextItem||it.value?(start.push(this.sourceToken),map.items.push({start,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(it.explicitKey)if(it.sep)if(it.value)map.items.push({start:[],key:null,sep:[this.sourceToken]});else if(includesToken(it.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start,key:null,sep:[this.sourceToken]}]});else if(isFlowToken(it.key)&&!includesToken(it.sep,"newline")){let start2=getFirstKeyStartProps(it.start),key=it.key,sep15=it.sep;sep15.push(this.sourceToken),delete it.key,delete it.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:start2,key,sep:sep15}]})}else start.length>0?it.sep=it.sep.concat(start,this.sourceToken):it.sep.push(this.sourceToken);else if(includesToken(it.start,"newline"))Object.assign(it,{key:null,sep:[this.sourceToken]});else{let start2=getFirstKeyStartProps(it.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:start2,key:null,sep:[this.sourceToken]}]})}else it.sep?it.value||atNextItem?map.items.push({start,key:null,sep:[this.sourceToken]}):includesToken(it.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):it.sep.push(this.sourceToken):Object.assign(it,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let fs6=this.flowScalar(this.type);atNextItem||it.value?(map.items.push({start,key:fs6,sep:[]}),this.onKeyLine=!0):it.sep?this.stack.push(fs6):(Object.assign(it,{key:fs6,sep:[]}),this.onKeyLine=!0);return}default:{let bv=this.startBlockValue(map);if(bv){if(bv.type==="block-seq"){if(!it.explicitKey&&it.sep&&!includesToken(it.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 atMapIndent&&map.items.push({start});this.stack.push(bv);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(seq){let it=seq.items[seq.items.length-1];switch(this.type){case"newline":if(it.value){let end="end"in it.value?it.value.end:void 0;(Array.isArray(end)?end[end.length-1]:void 0)?.type==="comment"?end?.push(this.sourceToken):seq.items.push({start:[this.sourceToken]})}else it.start.push(this.sourceToken);return;case"space":case"comment":if(it.value)seq.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(it.start,seq.indent)){let end=seq.items[seq.items.length-2]?.value?.end;if(Array.isArray(end)){arrayPushArray(end,it.start),end.push(this.sourceToken),seq.items.pop();return}}it.start.push(this.sourceToken)}return;case"anchor":case"tag":if(it.value||this.indent<=seq.indent)break;it.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==seq.indent)break;it.value||includesToken(it.start,"seq-item-ind")?seq.items.push({start:[this.sourceToken]}):it.start.push(this.sourceToken);return}if(this.indent>seq.indent){let bv=this.startBlockValue(seq);if(bv){this.stack.push(bv);return}}yield*this.pop(),yield*this.step()}*flowCollection(fc){let it=fc.items[fc.items.length-1];if(this.type==="flow-error-end"){let top;do yield*this.pop(),top=this.peek(1);while(top?.type==="flow-collection")}else if(fc.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!it||it.sep?fc.items.push({start:[this.sourceToken]}):it.start.push(this.sourceToken);return;case"map-value-ind":!it||it.value?fc.items.push({start:[],key:null,sep:[this.sourceToken]}):it.sep?it.sep.push(this.sourceToken):Object.assign(it,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!it||it.value?fc.items.push({start:[this.sourceToken]}):it.sep?it.sep.push(this.sourceToken):it.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let fs6=this.flowScalar(this.type);!it||it.value?fc.items.push({start:[],key:fs6,sep:[]}):it.sep?this.stack.push(fs6):Object.assign(it,{key:fs6,sep:[]});return}case"flow-map-end":case"flow-seq-end":fc.end.push(this.sourceToken);return}let bv=this.startBlockValue(fc);bv?this.stack.push(bv):(yield*this.pop(),yield*this.step())}else{let parent=this.peek(2);if(parent.type==="block-map"&&(this.type==="map-value-ind"&&parent.indent===fc.indent||this.type==="newline"&&!parent.items[parent.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&parent.type!=="flow-collection"){let prev=getPrevProps(parent),start=getFirstKeyStartProps(prev);fixFlowSeqItems(fc);let sep15=fc.end.splice(1,fc.end.length);sep15.push(this.sourceToken);let map={type:"block-map",offset:fc.offset,indent:fc.indent,items:[{start,key:fc,sep:sep15}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=map}else yield*this.lineEnd(fc)}}flowScalar(type){if(this.onNewLine){let nl=this.source.indexOf(`
|
|
271
271
|
`)+1;for(;nl!==0;)this.onNewLine(this.offset+nl),nl=this.source.indexOf(`
|
|
272
|
-
`,nl)+1}return{type,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(parent){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 prev=getPrevProps(parent),start=getFirstKeyStartProps(prev);return start.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let prev=getPrevProps(parent),start=getFirstKeyStartProps(prev);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(start,indent){return this.type!=="comment"||this.indent<=indent?!1:start.every(st2=>st2.type==="newline"||st2.type==="space")}*documentEnd(docEnd){this.type!=="doc-mode"&&(docEnd.end?docEnd.end.push(this.sourceToken):docEnd.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(token){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:token.end?token.end.push(this.sourceToken):token.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};exports.Parser=Parser2}});var require_public_api=__commonJS({"node_modules/yaml/dist/public-api.js"(exports){"use strict";var composer=require_composer(),Document=require_Document(),errors=require_errors2(),log=require_log(),identity=require_identity(),lineCounter=require_line_counter(),parser=require_parser();function parseOptions(options){let prettyErrors=options.prettyErrors!==!1;return{lineCounter:options.lineCounter||prettyErrors&&new lineCounter.LineCounter||null,prettyErrors}}function parseAllDocuments(source,options={}){let{lineCounter:lineCounter2,prettyErrors}=parseOptions(options),parser$1=new parser.Parser(lineCounter2?.addNewLine),composer$1=new composer.Composer(options),docs=Array.from(composer$1.compose(parser$1.parse(source)));if(prettyErrors&&lineCounter2)for(let doc of docs)doc.errors.forEach(errors.prettifyError(source,lineCounter2)),doc.warnings.forEach(errors.prettifyError(source,lineCounter2));return docs.length>0?docs:Object.assign([],{empty:!0},composer$1.streamInfo())}function parseDocument2(source,options={}){let{lineCounter:lineCounter2,prettyErrors}=parseOptions(options),parser$1=new parser.Parser(lineCounter2?.addNewLine),composer$1=new composer.Composer(options),doc=null;for(let _doc of composer$1.compose(parser$1.parse(source),!0,source.length))if(!doc)doc=_doc;else if(doc.options.logLevel!=="silent"){doc.errors.push(new errors.YAMLParseError(_doc.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return prettyErrors&&lineCounter2&&(doc.errors.forEach(errors.prettifyError(source,lineCounter2)),doc.warnings.forEach(errors.prettifyError(source,lineCounter2))),doc}function parse5(src,reviver,options){let _reviver;typeof reviver=="function"?_reviver=reviver:options===void 0&&reviver&&typeof reviver=="object"&&(options=reviver);let doc=parseDocument2(src,options);if(!doc)return null;if(doc.warnings.forEach(warning=>log.warn(doc.options.logLevel,warning)),doc.errors.length>0){if(doc.options.logLevel!=="silent")throw doc.errors[0];doc.errors=[]}return doc.toJS(Object.assign({reviver:_reviver},options))}function stringify(value,replacer,options){let _replacer=null;if(typeof replacer=="function"||Array.isArray(replacer)?_replacer=replacer:options===void 0&&replacer&&(options=replacer),typeof options=="string"&&(options=options.length),typeof options=="number"){let indent=Math.round(options);options=indent<1?void 0:indent>8?{indent:8}:{indent}}if(value===void 0){let{keepUndefined}=options??replacer??{};if(!keepUndefined)return}return identity.isDocument(value)&&!_replacer?value.toString(options):new Document.Document(value,_replacer,options).toString(options)}exports.parse=parse5;exports.parseAllDocuments=parseAllDocuments;exports.parseDocument=parseDocument2;exports.stringify=stringify}});var require_dist=__commonJS({"node_modules/yaml/dist/index.js"(exports){"use strict";var composer=require_composer(),Document=require_Document(),Schema=require_Schema(),errors=require_errors2(),Alias=require_Alias(),identity=require_identity(),Pair=require_Pair(),Scalar=require_Scalar(),YAMLMap=require_YAMLMap(),YAMLSeq=require_YAMLSeq(),cst=require_cst(),lexer=require_lexer(),lineCounter=require_line_counter(),parser=require_parser(),publicApi=require_public_api(),visit=require_visit();exports.Composer=composer.Composer;exports.Document=Document.Document;exports.Schema=Schema.Schema;exports.YAMLError=errors.YAMLError;exports.YAMLParseError=errors.YAMLParseError;exports.YAMLWarning=errors.YAMLWarning;exports.Alias=Alias.Alias;exports.isAlias=identity.isAlias;exports.isCollection=identity.isCollection;exports.isDocument=identity.isDocument;exports.isMap=identity.isMap;exports.isNode=identity.isNode;exports.isPair=identity.isPair;exports.isScalar=identity.isScalar;exports.isSeq=identity.isSeq;exports.Pair=Pair.Pair;exports.Scalar=Scalar.Scalar;exports.YAMLMap=YAMLMap.YAMLMap;exports.YAMLSeq=YAMLSeq.YAMLSeq;exports.CST=cst;exports.Lexer=lexer.Lexer;exports.LineCounter=lineCounter.LineCounter;exports.Parser=parser.Parser;exports.parse=publicApi.parse;exports.parseAllDocuments=publicApi.parseAllDocuments;exports.parseDocument=publicApi.parseDocument;exports.stringify=publicApi.stringify;exports.visit=visit.visit;exports.visitAsync=visit.visitAsync}});var require_ignore=__commonJS({"node_modules/ignore/index.js"(exports,module){function makeArray(subject){return Array.isArray(subject)?subject:[subject]}var UNDEFINED=void 0,EMPTY="",SPACE=" ",ESCAPE="\\",REGEX_LITERAL_SPECIAL=/[.*+?()[\]{}^$|\\/]/,REGEX_TEST_BLANK_LINE=/^ +$/,REGEX_INVALID_TRAILING_BACKSLASH=/(?:[^\\]|^)\\$/,REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION=/^\\!/,REGEX_REPLACE_LEADING_EXCAPED_HASH=/^\\#/,REGEX_SPLITALL_CRLF=/\r?\n/g,DOUBLE_SLASH="//",SLASH_CODE=47,DOT_CODE=46,SLASH="/",TMP_KEY_IGNORE="node-ignore";typeof Symbol<"u"&&(TMP_KEY_IGNORE=Symbol.for("node-ignore"));var KEY_IGNORE=TMP_KEY_IGNORE,define=(object,key,value)=>(Object.defineProperty(object,key,{value}),value),RETURN_FALSE=()=>!1,cleanRangeBackSlash=slashes=>{let{length}=slashes;return slashes.slice(0,length-length%2)},POSIX_CLASSES={alnum:"0-9A-Za-z",alpha:"A-Za-z",blank:" \\t",cntrl:"\\x00-\\x1f\\x7f",digit:"0-9",graph:"!-.0-~",lower:"a-z",print:" -.0-~",punct:"!-.:-@\\[-`{-~",space:" \\t\\n\\r",upper:"A-Z",xdigit:"0-9A-Fa-f"},CLASS_MEMBERS_TO_ESCAPE="\\]^-[",escapeMember=char=>CLASS_MEMBERS_TO_ESCAPE.indexOf(char)<0?char:ESCAPE+char,NON_SLASH="(?!\\/)",classSource=(negated,body)=>{if(negated)return`[^\\/${body}]`;let source=`[${body}]`;return new RegExp(source).test("/")?NON_SLASH+source:source},scanBracket=(pattern,start)=>{let{length}=pattern,index3=start+1,negated=EMPTY,lead=pattern[index3];(lead==="!"||lead==="^")&&(negated="^",index3++);let body=EMPTY,prev=EMPTY;for(;;){let char=pattern[index3];if(char===UNDEFINED)return null;if(char===ESCAPE){let escaped=pattern[index3+1];if(escaped===UNDEFINED)return null;body+=escapeMember(escaped),prev=escaped,index3++}else if(char==="-"&&prev&&index3+1<length&&pattern[index3+1]!=="]"){index3++;let to=pattern[index3];to===ESCAPE&&(to=pattern[index3+=1]),prev<=to&&(body+=`-${escapeMember(to)}`),prev=EMPTY}else if(char==="["&&pattern[index3+1]===":"){let nameStart=index3+2,end=nameStart;for(;end<length&&pattern[end]!=="]";)end++;if(end===length)return null;if(end>nameStart&&pattern[end-1]===":"){let expanded=POSIX_CLASSES[pattern.slice(nameStart,end-1)];if(expanded===UNDEFINED)return null;body+=expanded,prev=EMPTY,index3=end}else body+=escapeMember("["),prev="[",index3=nameStart-2}else body+=escapeMember(char),prev=char;if(index3++,pattern[index3]==="]")return{end:index3,source:classSource(negated,body)}}},NEVER_MATCH="[]",PLACEHOLDER="\0",REGEX_RESTORE_PLACEHOLDER=new RegExp(`${PLACEHOLDER}(\\d+)${PLACEHOLDER}`,"g"),TRAILING_WILDCARD="\uE000",extractBrackets=pattern=>{let sources=[],hold=source=>`${PLACEHOLDER}${sources.push(source)-1}${PLACEHOLDER}`,{length}=pattern,out=EMPTY,index3=0;for(;index3<length;){let char=pattern[index3];if(char===ESCAPE){let escaped=pattern[index3+1];escaped==="*"||escaped==="["||escaped===SPACE||escaped===ESCAPE?out+=pattern.slice(index3,index3+2):out+=hold(REGEX_LITERAL_SPECIAL.test(escaped)?ESCAPE+escaped:escaped),index3+=2}else if(char===PLACEHOLDER)out+=hold(`[${PLACEHOLDER}]`),index3++;else if(char==="["){let scanned=scanBracket(pattern,index3);scanned===null?(out+=hold(NEVER_MATCH),index3=length):(out+=hold(scanned.source),index3=scanned.end+1)}else out+=char,index3++}return{source:out,sources}},DIRECT=null,REGEX_INNER_SLASH=/\/(?!$)/,REPLACERS=[[/^\uFEFF/,()=>EMPTY,"\uFEFF"],[/[\r\n]+$/,()=>EMPTY],[/((?:\\\\)*?)(\\? +)$/,(_2,m1,m2)=>m1+(m2.indexOf("\\")===0?SPACE:EMPTY)],[/(\\+?) /g,(_2,m1)=>{let{length}=m1;return m1.slice(0,length-length%2)+SPACE}],[/[\\$.|*+(){^]/g,match2=>`\\${match2}`],[/(?!\\)\?/g,()=>"[^/]","?"],[/^\//,()=>"^",SLASH],[/\//g,()=>"\\/",SLASH],[/^\^*(?:\\\*\\\*\\\/)+/,()=>"^(?:.*\\/)?","*"],[DIRECT,(source,pattern)=>!source||source[0]==="^"?source:(REGEX_INNER_SLASH.test(pattern)?"^":"(?:^|\\/)")+source],[/\\\/\\\*\\\*(?=\\\/|$)/g,(_2,index3,str2)=>index3+6<str2.length?str2.slice(index3+6)==="\\/"?"(?:\\/[^\\/]+)+":"(?:\\/[^\\/]+)*":"\\/.+","*"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(_2,p1,p2)=>{let unescaped=p2.replace(/\\\*/g,"[^\\/]*");return p1+unescaped},"*"],[/(^|[^\\])((?:\\\\)*)\\\*$/,(match2,p1,p2)=>p2.length/2%2===0?p1+p2+TRAILING_WILDCARD:match2,"*"],[/\\\\\\(?=[$.|*+(){^])/g,()=>ESCAPE,ESCAPE+ESCAPE],[/\\\\/g,()=>ESCAPE,ESCAPE+ESCAPE],[/\\\[([^\]/]*?)(\\*)($|\])/g,(match2,range2,endEscape,close)=>`\\[${range2}${cleanRangeBackSlash(endEscape)}${close}`,"["],[DIRECT,source=>{let last=source[source.length-1];return!last||last===TRAILING_WILDCARD?source:last===SLASH?`${source}$`:`${source}(?=$|\\/$)`}]],REGEX_REPLACE_TRAILING_WILDCARD=/(^|\\\/)?\uE000$/,MODE_IGNORE="regex",MODE_CHECK_IGNORE="checkRegex",UNDERSCORE="_",TRAILING_WILD_CARD_REPLACERS={[MODE_IGNORE](_2,p1){return`${p1?`${p1}[^/]+`:"[^/]*"}(?=$|\\/$)`},[MODE_CHECK_IGNORE](_2,p1){return`${p1?`${p1}[^/]*`:"[^/]*"}(?=$|\\/$)`}},WILDCARD="[^\\/]*",pinWildcards=source=>{if(source.indexOf(WILDCARD)<0)return source;let tokens=[],{length}=source,index3=0;for(;index3<length;){let char=source[index3];if(source.startsWith(WILDCARD,index3))tokens.push({wildcard:!0}),index3+=WILDCARD.length;else if(char==="["){let end=index3+1;for(source[end]==="^"&&end++,source[end]==="]"&&end++;end<length&&source[end]!=="]";)end+=source[end]===ESCAPE?2:1;end++,tokens.push({single:source.slice(index3,end)}),index3=end}else if(char===ESCAPE)tokens.push({single:source.slice(index3,index3+2)}),index3+=2;else if(char==="("){let depth=0,end=index3;do source[end]===ESCAPE?end++:source[end]==="("?depth++:source[end]===")"&&depth--,end++;while(end<length&&depth>0);"*+?".indexOf(source[end])>=0&&end++,tokens.push({boundary:source.slice(index3,end)}),index3=end}else char==="^"||char==="$"?(tokens.push({boundary:char}),index3++):(tokens.push({single:char}),index3++)}let out=EMPTY,run=[],flush=()=>{let lastWildcard;run.forEach((token,at)=>{token.wildcard&&(lastWildcard=at)}),run.forEach((token,at)=>{if(!token.wildcard){out+=token.single;return}out+=at===lastWildcard?WILDCARD:`(?:(?!${run[at+1].single})[^\\/])*`}),run=[]};return tokens.forEach(token=>{if(token.boundary===void 0){run.push(token);return}flush(),out+=token.boundary}),flush(),out},makeRegexPrefix=pattern=>{let{source,sources}=extractBrackets(pattern),replaced=REPLACERS.reduce((prev,[matcher,replacer,required])=>matcher===DIRECT?replacer(prev,pattern):required!==UNDEFINED&&prev.indexOf(required)<0?prev:matcher.test(prev)?prev.replace(matcher,replacer.bind(pattern)):prev,source);return sources.length?replaced.replace(REGEX_RESTORE_PLACEHOLDER,(match2,index3)=>sources[index3]):replaced},matchesBasename=body=>{let index3=body.indexOf(SLASH);return index3<0||index3===body.length-1},basenameOf=path15=>{let end=path15.length-1,index3=path15.lastIndexOf(SLASH,path15[end]===SLASH?end-1:end);return index3<0?path15:path15.slice(index3+1)},parentOf=path15=>{if(path15.charCodeAt(0)===SLASH_CODE||path15.indexOf(DOUBLE_SLASH)>=0){let slices=path15.split(SLASH).filter(Boolean);return slices.pop(),slices.length?slices.join(SLASH)+SLASH:EMPTY}let end=path15.length-1,cut=path15.lastIndexOf(SLASH,path15.charCodeAt(end)===SLASH_CODE?end-1:end);return cut<0?EMPTY:path15.slice(0,cut+1)},isString2=subject=>typeof subject=="string",checkPattern=pattern=>pattern&&isString2(pattern)&&!REGEX_TEST_BLANK_LINE.test(pattern)&&!REGEX_INVALID_TRAILING_BACKSLASH.test(pattern)&&pattern.indexOf("#")!==0,splitPattern=pattern=>pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean),IgnoreRule=class{constructor(pattern,mark,body,ignoreCase,negative,prefix){this.pattern=pattern,this.mark=mark,this.negative=negative,define(this,"body",body),define(this,"ignoreCase",ignoreCase),define(this,"regexPrefix",prefix)}get _basenameOnly(){return define(this,"_basenameOnly",matchesBasename(this.body))}get regex(){let key=UNDERSCORE+MODE_IGNORE;return this[key]?this[key]:this._make(MODE_IGNORE,key)}get checkRegex(){let key=UNDERSCORE+MODE_CHECK_IGNORE;return this[key]?this[key]:this._make(MODE_CHECK_IGNORE,key)}_make(mode,key){let str2=pinWildcards(this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD,TRAILING_WILD_CARD_REPLACERS[mode])),regex2=this.ignoreCase?new RegExp(str2,"i"):new RegExp(str2);return define(this,key,regex2)}},createRule=({pattern,mark},ignoreCase)=>{let negative=!1,body=pattern;body.indexOf("!")===0&&(negative=!0,body=body.substr(1)),body=body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION,"!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH,"#");let regexPrefix=makeRegexPrefix(body);return new IgnoreRule(pattern,mark,body,ignoreCase,negative,regexPrefix)},RuleManager=class{constructor(ignoreCase){this._ignoreCase=ignoreCase,this._rules=[],this._basenameCount=0}_add(pattern){if(pattern&&pattern[KEY_IGNORE]){this._rules=this._rules.concat(pattern._rules._rules),this._basenameCount+=pattern._rules._basenameCount,this._added=!0;return}if(isString2(pattern)&&(pattern={pattern}),checkPattern(pattern.pattern)){let rule=createRule(pattern,this._ignoreCase);this._added=!0,this._rules.push(rule),matchesBasename(rule.body)&&this._basenameCount++}}add(pattern){return this._added=!1,makeArray(isString2(pattern)?splitPattern(pattern):pattern).forEach(this._add,this),this._added}test(path15,checkUnignored,mode){let ignored=!1,unignored=!1,matchedRule,rules=this._rules,{length}=rules,shortcut=this._basenameCount*2>=length,basename18=shortcut?basenameOf(path15):path15;for(let index3=0;index3<length;index3++){let rule=rules[index3],{negative}=rule;!(unignored===negative&&ignored!==unignored||negative&&!ignored&&!unignored&&!checkUnignored)&&rule[mode].test(shortcut&&rule._basenameOnly?basename18:path15)&&(ignored=!negative,unignored=negative,matchedRule=negative?UNDEFINED:rule)}let ret={ignored,unignored};return matchedRule&&(ret.rule=matchedRule),ret}},throwError=(message,Ctor)=>{throw new Ctor(message)},checkPath=(path15,originalPath,doThrow)=>isString2(path15)?path15?checkPath.isNotRelative(path15)?doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`,RangeError):!0:doThrow("path must not be empty",TypeError):doThrow(`path must be a string, but got \`${originalPath}\``,TypeError),isNotRelative=path15=>{let first=path15.charCodeAt(0);if(first===SLASH_CODE)return!0;if(first!==DOT_CODE)return!1;if(path15.length===1)return!0;let second=path15.charCodeAt(1);return second===SLASH_CODE?!0:second!==DOT_CODE?!1:path15.length===2||path15.charCodeAt(2)===SLASH_CODE};checkPath.isNotRelative=isNotRelative;checkPath.convert=p=>p;var Ignore=class{constructor({ignorecase=!0,ignoreCase=ignorecase,allowRelativePaths=!1}={}){define(this,KEY_IGNORE,!0),this._rules=new RuleManager(ignoreCase),this._strictPathCheck=!allowRelativePaths,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(pattern){return this._rules.add(pattern)&&this._initCache(),this}addPattern(pattern){return this.add(pattern)}_test(originalPath,cache,checkUnignored){let path15=originalPath&&checkPath.convert(originalPath);return checkPath(path15,originalPath,this._strictPathCheck?throwError:RETURN_FALSE),this._t(path15,cache,checkUnignored)}checkIgnore(path15){if(path15.charCodeAt(path15.length-1)!==SLASH_CODE)return this.test(path15);let parentPath=parentOf(path15);if(parentPath){let parent=this._t(parentPath,this._testCache,!0);if(parent.ignored)return parent}return this._rules.test(path15,!1,MODE_CHECK_IGNORE)}_t(path15,cache,checkUnignored){if(path15 in cache)return cache[path15];let parentPath=parentOf(path15),parent=parentPath?this._t(parentPath,cache,checkUnignored):UNDEFINED;return cache[path15]=parent&&parent.ignored?parent:this._rules.test(path15,checkUnignored,MODE_IGNORE)}ignores(path15){return this._test(path15,this._ignoreCache,!1).ignored}createFilter(){return path15=>!this.ignores(path15)}filter(paths){return makeArray(paths).filter(this.createFilter())}test(path15){return this._test(path15,this._testCache,!0)}},factory=options=>new Ignore(options),isPathValid=path15=>checkPath(path15&&checkPath.convert(path15),path15,RETURN_FALSE),setupWindows=()=>{let makePosix=str2=>/^\\\\\?\\/.test(str2)||/["<>|\u0000-\u001F]+/u.test(str2)?str2:str2.replace(/\\/g,"/");checkPath.convert=makePosix;let REGEX_TEST_WINDOWS_PATH_ABSOLUTE=/^[a-z]:\//i;checkPath.isNotRelative=path15=>REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path15)||isNotRelative(path15)};typeof process<"u"&&process.platform==="win32"&&setupWindows();module.exports=factory;factory.default=factory;module.exports.isPathValid=isPathValid;define(module.exports,Symbol.for("setupWindows"),setupWindows)}});var require_index_min=__commonJS({"node_modules/lru-cache/dist/commonjs/node/index.min.js"(exports){"use strict";var M2=(c2,t)=>()=>(t||c2((t={exports:{}}).exports,t),t.exports),U3=M2(O2=>{"use strict";Object.defineProperty(O2,"__esModule",{value:!0}),O2.tracing=O2.metrics=void 0;var j2=__require("node:diagnostics_channel");O2.metrics=(0,j2.channel)("lru-cache:metrics"),O2.tracing=(0,j2.tracingChannel)("lru-cache")}),I2=M2(R2=>{"use strict";Object.defineProperty(R2,"__esModule",{value:!0}),R2.defaultPerf=void 0,R2.defaultPerf=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date});Object.defineProperty(exports,"__esModule",{value:!0});exports.LRUCache=void 0;var d2=U3(),N2=I2(),C=()=>d2.metrics.hasSubscribers||d2.tracing.hasSubscribers,G=new Set,P2=typeof process=="object"&&process?process:{},V2=(c2,t,e,i)=>{typeof P2.emitWarning=="function"?P2.emitWarning(c2,t,e,i):console.error(`[${e}] ${t}: ${c2}`)},q2=c2=>!G.has(c2),T2=c2=>!!c2&&c2===Math.floor(c2)&&c2>0&&isFinite(c2),H2=c2=>T2(c2)?c2<=Math.pow(2,8)?Uint8Array:c2<=Math.pow(2,16)?Uint16Array:c2<=Math.pow(2,32)?Uint32Array:c2<=Number.MAX_SAFE_INTEGER?W2:null:null,W2=class extends Array{constructor(t){super(t),this.fill(0)}},x2=class c2{heap;length;static#o=!1;static create(t){let e=H2(t);if(!e)return[];c2.#o=!0;let i=new c2(t,e);return c2.#o=!1,i}constructor(t,e){if(!c2.#o)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},L3=class c2{#o;#c;#m;#W;#w;#M;#j;#S;get perf(){return this.#S}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#b;#s;#i;#t;#l;#u;#a;#h;#_;#r;#y;#F;#d;#g;#T;#U;#f;#D;static unsafeExposeInternals(t){return{starts:t.#F,ttls:t.#d,autopurgeTimers:t.#g,sizes:t.#y,keyMap:t.#s,keyList:t.#i,valList:t.#t,next:t.#l,prev:t.#u,get head(){return t.#a},get tail(){return t.#h},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,i,s,n)=>t.#G(e,i,s,n),moveToTail:e=>t.#L(e),indexes:e=>t.#A(e),rindexes:e=>t.#v(e),isStale:e=>t.#p(e)}}get max(){return this.#o}get maxSize(){return this.#c}get calculatedSize(){return this.#b}get size(){return this.#n}get fetchMethod(){return this.#M}get memoMethod(){return this.#j}get dispose(){return this.#m}get onInsert(){return this.#W}get disposeAfter(){return this.#w}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:r,updateAgeOnHas:h,allowStale:a,dispose:o,onInsert:m2,disposeAfter:S,noDisposeOnSet:y2,noUpdateTTL:u,maxSize:g2=0,maxEntrySize:f=0,sizeCalculation:_2,fetchMethod:l3,memoMethod:w2,noDeleteOnFetchRejection:F2,noDeleteOnStaleGet:b2,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:A2,ignoreFetchAbort:v2,perf:D3}=t;if(D3!==void 0&&typeof D3?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#S=D3??N2.defaultPerf,e!==0&&!T2(e))throw new TypeError("max option must be a nonnegative integer");let z2=e?H2(e):Array;if(!z2)throw new Error("invalid max value: "+e);if(this.#o=e,this.#c=g2,this.maxEntrySize=f||this.#c,this.sizeCalculation=_2,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(w2!==void 0&&typeof w2!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#j=w2,l3!==void 0&&typeof l3!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#M=l3,this.#U=!!l3,this.#s=new Map,this.#i=Array.from({length:e}).fill(void 0),this.#t=Array.from({length:e}).fill(void 0),this.#l=new z2(e),this.#u=new z2(e),this.#a=0,this.#h=0,this.#_=x2.create(e),this.#n=0,this.#b=0,typeof o=="function"&&(this.#m=o),typeof m2=="function"&&(this.#W=m2),typeof S=="function"?(this.#w=S,this.#r=[]):(this.#w=void 0,this.#r=void 0),this.#T=!!this.#m,this.#D=!!this.#W,this.#f=!!this.#w,this.noDisposeOnSet=!!y2,this.noUpdateTTL=!!u,this.noDeleteOnFetchRejection=!!F2,this.allowStaleOnFetchRejection=!!p,this.allowStaleOnFetchAbort=!!A2,this.ignoreFetchAbort=!!v2,this.maxEntrySize!==0){if(this.#c!==0&&!T2(this.#c))throw new TypeError("maxSize must be a positive integer if specified");if(!T2(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#X()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!b2,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!h,this.ttlResolution=T2(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!T2(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#H()}if(this.#o===0&&this.ttl===0&&this.#c===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#o&&!this.#c){let E2="LRU_CACHE_UNBOUNDED";q2(E2)&&(G.add(E2),V2("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",E2,c2))}}getRemainingTTL(t){return this.#s.has(t)?1/0:0}#H(){let t=new W2(this.#o),e=new W2(this.#o);this.#d=t,this.#F=e;let i=this.ttlAutopurge?Array.from({length:this.#o}):void 0;this.#g=i,this.#N=(h,a,o=this.#S.now())=>{e[h]=a!==0?o:0,t[h]=a,s(h,a)},this.#R=h=>{e[h]=t[h]!==0?this.#S.now():0,s(h,t[h])};let s=this.ttlAutopurge?(h,a)=>{if(i?.[h]&&(clearTimeout(i[h]),i[h]=void 0),a&&a!==0&&i){let o=setTimeout(()=>{this.#p(h)&&this.#z(this.#i[h],"expire")},a+1);o.unref&&o.unref(),i[h]=o}}:()=>{};this.#E=(h,a)=>{if(t[a]){let o=t[a],m2=e[a];if(!o||!m2)return;h.ttl=o,h.start=m2,h.now=n||r();let S=h.now-m2;h.remainingTTL=o-S}};let n=0,r=()=>{let h=this.#S.now();if(this.ttlResolution>0){n=h;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return h};this.getRemainingTTL=h=>{let a=this.#s.get(h);if(a===void 0)return 0;let o=t[a],m2=e[a];if(!o||!m2)return 1/0;let S=(n||r())-m2;return o-S},this.#p=h=>{let a=e[h],o=t[h];return!!o&&!!a&&(n||r())-a>o}}#R=()=>{};#E=()=>{};#N=()=>{};#p=()=>!1;#X(){let t=new W2(this.#o);this.#b=0,this.#y=t,this.#C=e=>{this.#b-=t[e],t[e]=0},this.#V=(e,i,s,n)=>{if(this.#e(i))return 0;if(!T2(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,e),!T2(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#I=(e,i,s)=>{if(t[e]=i,this.#c){let n=this.#c-t[e];for(;this.#b>n;)this.#P(!0)}this.#b+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#b)}}#C=t=>{};#I=(t,e,i)=>{};#V=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#A({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#h;this.#q(e)&&((t||!this.#p(e))&&(yield e),e!==this.#a);)e=this.#u[e]}*#v({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#a;this.#q(e)&&((t||!this.#p(e))&&(yield e),e!==this.#h);)e=this.#l[e]}#q(t){return t!==void 0&&this.#s.get(this.#i[t])===t}*entries(){for(let t of this.#A())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield[this.#i[t],this.#t[t]])}*rentries(){for(let t of this.#v())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield[this.#i[t],this.#t[t]])}*keys(){for(let t of this.#A()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e)}}*rkeys(){for(let t of this.#v()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e)}}*values(){for(let t of this.#A())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t])}*rvalues(){for(let t of this.#v())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;if(n!==void 0&&t(n,this.#i[i],this))return this.#x(this.#i[i],e)}}forEach(t,e=this){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#i[i],this)}}rforEach(t,e=this){for(let i of this.#v()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#i[i],this)}}purgeStale(){let t=!1;for(let e of this.#v({allowStale:!0}))this.#p(e)&&(this.#z(this.#i[e],"expire"),t=!0);return t}info(t){let e=this.#s.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#d&&this.#F){let r=this.#d[e],h=this.#F[e];if(r&&h){let a=r-(this.#S.now()-h);n.ttl=a,n.start=Date.now()}}return this.#y&&(n.size=this.#y[e]),n}dump(){let t=[];for(let e of this.#A({allowStale:!0})){let i=this.#i[e],s=this.#t[e],n=this.#e(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let r={value:n};if(this.#d&&this.#F){r.ttl=this.#d[e];let h=this.#S.now()-this.#F[e];r.start=Math.floor(Date.now()-h)}this.#y&&(r.size=this.#y[e]),t.unshift([i,r])}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=this.#S.now()-s}this.#O(e,i.value,i)}}set(t,e,i={}){let{status:s=d2.metrics.hasSubscribers?{}:void 0}=i;i.status=s,s&&(s.op="set",s.key=t,e!==void 0&&(s.value=e),s.cache=this);let n=this.#O(t,e,i);return s&&d2.metrics.hasSubscribers&&d2.metrics.publish(s),n}#O(t,e,i,s){let{ttl:n=this.ttl,start:r,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:o}=i;if(e===void 0)return o&&(o.set="deleted"),this.delete(t),this;let{noUpdateTTL:m2=this.noUpdateTTL}=i,S=this.#e(e);o&&!S&&(o.value=e);let y2=this.#V(t,e,i.size||0,a,o);if(this.maxEntrySize&&y2>this.maxEntrySize)return this.#z(t,"set"),o&&(o.set="miss",o.maxEntrySizeExceeded=!0),this;let u=this.#n===0?void 0:this.#s.get(t);if(u===void 0)u=this.#n===0?this.#h:this.#_.length!==0?this.#_.pop():this.#n===this.#o?this.#P(!1):this.#n,this.#i[u]=t,this.#t[u]=e,this.#s.set(t,u),this.#l[this.#h]=u,this.#u[u]=this.#h,this.#h=u,this.#n++,this.#I(u,y2,o),o&&(o.set="add"),m2=!1,this.#D&&!S&&this.#W?.(e,t,"add");else{this.#L(u);let g2=this.#t[u];if(e!==g2){if(!h)if(this.#e(g2)){g2!==s&&g2.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=g2;f!==void 0&&f!==e&&(this.#T&&this.#m?.(f,t,"set"),this.#f&&this.#r?.push([f,t,"set"]))}else this.#T&&this.#m?.(g2,t,"set"),this.#f&&this.#r?.push([g2,t,"set"]);if(this.#C(u),this.#I(u,y2,o),this.#t[u]=e,!S){let f=g2&&this.#e(g2)?g2.__staleWhileFetching:g2,_2=f===void 0?"add":e!==f?"replace":"update";o&&(o.set=_2,f!==void 0&&(o.oldValue=f)),this.#D&&this.onInsert?.(e,t,_2)}}else S||(o&&(o.set="update"),this.#D&&this.onInsert?.(e,t,"update"))}if(n!==0&&!this.#d&&this.#H(),this.#d&&(m2||this.#N(u,n,r),o&&this.#E(o,u)),!h&&this.#f&&this.#r){let g2=this.#r,f;for(;f=g2?.shift();)this.#w?.(...f)}return this}pop(){try{for(;this.#n;){let t=this.#t[this.#a];if(this.#P(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#f&&this.#r){let t=this.#r,e;for(;e=t?.shift();)this.#w?.(...e)}}}#P(t){let e=this.#a,i=this.#i[e],s=this.#t[e],n=this.#e(s);n&&s.__abortController.abort(new Error("evicted"));let r=n?s.__staleWhileFetching:s;return(this.#T||this.#f)&&r!==void 0&&(this.#T&&this.#m?.(r,i,"evict"),this.#f&&this.#r?.push([r,i,"evict"])),this.#C(e),this.#g?.[e]&&(clearTimeout(this.#g[e]),this.#g[e]=void 0),t&&(this.#i[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#n===1?(this.#a=this.#h=0,this.#_.length=0):this.#a=this.#l[e],this.#s.delete(i),this.#n--,e}has(t,e={}){let{status:i=d2.metrics.hasSubscribers?{}:void 0}=e;e.status=i,i&&(i.op="has",i.key=t,i.cache=this);let s=this.#Y(t,e);return d2.metrics.hasSubscribers&&d2.metrics.publish(i),s}#Y(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,n=this.#s.get(t);if(n!==void 0){let r=this.#t[n];if(this.#e(r)&&r.__staleWhileFetching===void 0)return!1;if(this.#p(n))s&&(s.has="stale",this.#E(s,n));else return i&&this.#R(n),s&&(s.has="hit",this.#E(s,n)),!0}else s&&(s.has="miss");return!1}peek(t,e={}){let{status:i=C()?{}:void 0}=e;i&&(i.op="peek",i.key=t,i.cache=this),e.status=i;let s=this.#J(t,e);return d2.metrics.hasSubscribers&&d2.metrics.publish(i),s}#J(t,e){let{status:i,allowStale:s=this.allowStale}=e,n=this.#s.get(t);if(n===void 0||!s&&this.#p(n)){i&&(i.peek=n===void 0?"miss":"stale");return}let r=this.#t[n],h=this.#e(r)?r.__staleWhileFetching:r;return i&&(h!==void 0?(i.peek="hit",i.value=h):i.peek="miss"),h}#G(t,e,i,s){let n=e===void 0?void 0:this.#t[e];if(this.#e(n))return n;let r=new AbortController,{signal:h}=i;h?.addEventListener("abort",()=>r.abort(h.reason),{signal:r.signal});let a={signal:r.signal,options:i,context:s},o=(f,_2=!1)=>{let{aborted:l3}=r.signal,w2=i.ignoreFetchAbort&&f!==void 0,F2=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&f!==void 0);if(i.status&&(l3&&!_2?(i.status.fetchAborted=!0,i.status.fetchError=r.signal.reason,w2&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),l3&&!w2&&!_2)return S(r.signal.reason,F2);let b2=u,p=this.#t[e];return(p===u||p===void 0&&w2&&_2)&&(f===void 0?b2.__staleWhileFetching!==void 0?this.#t[e]=b2.__staleWhileFetching:this.#z(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.#O(t,f,a.options,b2))),f},m2=f=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=f),S(f,!1)),S=(f,_2)=>{let{aborted:l3}=r.signal,w2=l3&&i.allowStaleOnFetchAbort,F2=w2||i.allowStaleOnFetchRejection,b2=F2||i.noDeleteOnFetchRejection,p=u;if(this.#t[e]===u&&(!b2||!_2&&p.__staleWhileFetching===void 0?this.#z(t,"fetch"):w2||(this.#t[e]=p.__staleWhileFetching)),F2)return i.status&&p.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),p.__staleWhileFetching;if(p.__returned===p)throw f},y2=(f,_2)=>{let l3=this.#M?.(t,n,a);r.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(f(void 0),i.allowStaleOnFetchAbort&&(f=w2=>o(w2,!0)))}),l3&&l3 instanceof Promise?l3.then(w2=>f(w2===void 0?void 0:w2),_2):l3!==void 0&&f(l3)};i.status&&(i.status.fetchDispatched=!0);let u=new Promise(y2).then(o,m2),g2=Object.assign(u,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.#O(t,g2,{...a.options,status:void 0}),e=this.#s.get(t)):this.#t[e]=g2,g2}#e(t){if(!this.#U)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}fetch(t,e={}){let i=d2.tracing.hasSubscribers,{status:s=C()?{}:void 0}=e;e.status=s,s&&e.context&&(s.context=e.context);let n=this.#B(t,e);return s&&i&&(s.trace=!0,d2.tracing.tracePromise(()=>n,s).catch(()=>{})),n}async#B(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:a=0,sizeCalculation:o=this.sizeCalculation,noUpdateTTL:m2=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y2=this.allowStaleOnFetchRejection,ignoreFetchAbort:u=this.ignoreFetchAbort,allowStaleOnFetchAbort:g2=this.allowStaleOnFetchAbort,context:f,forceRefresh:_2=!1,status:l3,signal:w2}=e;if(l3&&(l3.op="fetch",l3.key=t,_2&&(l3.forceRefresh=!0),l3.cache=this),!this.#U)return l3&&(l3.fetch="get"),this.#x(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:l3});let F2={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:h,size:a,sizeCalculation:o,noUpdateTTL:m2,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:y2,allowStaleOnFetchAbort:g2,ignoreFetchAbort:u,status:l3,signal:w2},b2=this.#s.get(t);if(b2===void 0){l3&&(l3.fetch="miss");let p=this.#G(t,b2,F2,f);return p.__returned=p}else{let p=this.#t[b2];if(this.#e(p)){let E2=i&&p.__staleWhileFetching!==void 0;return l3&&(l3.fetch="inflight",E2&&(l3.returnedStale=!0)),E2?p.__staleWhileFetching:p.__returned=p}let A2=this.#p(b2);if(!_2&&!A2)return l3&&(l3.fetch="hit"),this.#L(b2),s&&this.#R(b2),l3&&this.#E(l3,b2),p;let v2=this.#G(t,b2,F2,f),z2=v2.__staleWhileFetching!==void 0&&i;return l3&&(l3.fetch=A2?"stale":"refresh",z2&&A2&&(l3.returnedStale=!0)),z2?v2.__staleWhileFetching:v2.__returned=v2}}forceFetch(t,e={}){let i=d2.tracing.hasSubscribers,{status:s=C()?{}:void 0}=e;e.status=s,s&&e.context&&(s.context=e.context);let n=this.#K(t,e);return s&&i&&(s.trace=!0,d2.tracing.tracePromise(()=>n,s).catch(()=>{})),n}async#K(t,e={}){let i=await this.#B(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let{status:i=d2.metrics.hasSubscribers?{}:void 0}=e;e.status=i,i&&(i.op="memo",i.key=t,e.context&&(i.context=e.context),i.cache=this);let s=this.#Q(t,e);return i&&(i.value=s),d2.metrics.hasSubscribers&&d2.metrics.publish(i),s}#Q(t,e={}){let i=this.#j;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,status:n,forceRefresh:r,...h}=e;n&&r&&(n.forceRefresh=!0);let a=this.#x(t,h),o=r||a===void 0;if(n&&(n.memo=o?"miss":"hit",o||(n.value=a)),!o)return a;let m2=i(t,a,{options:h,context:s});return n&&(n.value=m2),this.#O(t,m2,h),m2}get(t,e={}){let{status:i=d2.metrics.hasSubscribers?{}:void 0}=e;e.status=i,i&&(i.op="get",i.key=t,i.cache=this);let s=this.#x(t,e);return i&&(s!==void 0&&(i.value=s),d2.metrics.hasSubscribers&&d2.metrics.publish(i)),s}#x(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=e,h=this.#s.get(t);if(h===void 0){r&&(r.get="miss");return}let a=this.#t[h],o=this.#e(a);return r&&this.#E(r,h),this.#p(h)?o?(r&&(r.get="stale-fetching"),i&&a.__staleWhileFetching!==void 0?(r&&(r.returnedStale=!0),a.__staleWhileFetching):void 0):(n||this.#z(t,"expire"),r&&(r.get="stale"),i?(r&&(r.returnedStale=!0),a):void 0):(r&&(r.get=o?"fetching":"hit"),this.#L(h),s&&this.#R(h),o?a.__staleWhileFetching:a)}#k(t,e){this.#u[e]=t,this.#l[t]=e}#L(t){t!==this.#h&&(t===this.#a?this.#a=this.#l[t]:this.#k(this.#u[t],this.#l[t]),this.#k(this.#h,t),this.#h=t)}delete(t){return this.#z(t,"delete")}#z(t,e){d2.metrics.hasSubscribers&&d2.metrics.publish({op:"delete",delete:e,key:t,cache:this});let i=!1;if(this.#n!==0){let s=this.#s.get(t);if(s!==void 0)if(this.#g?.[s]&&(clearTimeout(this.#g?.[s]),this.#g[s]=void 0),i=!0,this.#n===1)this.#$(e);else{this.#C(s);let n=this.#t[s];if(this.#e(n)?n.__abortController.abort(new Error("deleted")):(this.#T||this.#f)&&(this.#T&&this.#m?.(n,t,e),this.#f&&this.#r?.push([n,t,e])),this.#s.delete(t),this.#i[s]=void 0,this.#t[s]=void 0,s===this.#h)this.#h=this.#u[s];else if(s===this.#a)this.#a=this.#l[s];else{let r=this.#u[s];this.#l[r]=this.#l[s];let h=this.#l[s];this.#u[h]=this.#u[s]}this.#n--,this.#_.push(s)}}if(this.#f&&this.#r?.length){let s=this.#r,n;for(;n=s?.shift();)this.#w?.(...n)}return i}clear(){return this.#$("delete")}#$(t){for(let e of this.#v({allowStale:!0})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#i[e];this.#T&&this.#m?.(i,s,t),this.#f&&this.#r?.push([i,s,t])}}if(this.#s.clear(),this.#t.fill(void 0),this.#i.fill(void 0),this.#d&&this.#F){this.#d.fill(0),this.#F.fill(0);for(let e of this.#g??[])e!==void 0&&clearTimeout(e);this.#g?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#a=0,this.#h=0,this.#_.length=0,this.#b=0,this.#n=0,this.#f&&this.#r){let e=this.#r,i;for(;i=e?.shift();)this.#w?.(...i)}}};exports.LRUCache=L3}});var require_hosts=__commonJS({"node_modules/hosted-git-info/lib/hosts.js"(exports,module){"use strict";var maybeJoin=(...args)=>args.every(arg=>arg)?args.join(""):"",maybeEncode=arg=>arg?encodeURIComponent(arg):"",formatHashFragment=f=>f.toLowerCase().replace(/^\W+/g,"").replace(/(?<!\W)\W+$/,"").replace(/\//g,"").replace(/\W+/g,"-"),defaults2={sshtemplate:({domain,user,project,committish})=>`git@${domain}:${user}/${project}.git${maybeJoin("#",committish)}`,sshurltemplate:({domain,user,project,committish})=>`git+ssh://git@${domain}/${user}/${project}.git${maybeJoin("#",committish)}`,edittemplate:({domain,user,project,committish,editpath,path:path15})=>`https://${domain}/${user}/${project}${maybeJoin("/",editpath,"/",maybeEncode(committish||"HEAD"),"/",path15)}`,browsetemplate:({domain,user,project,committish,treepath})=>`https://${domain}/${user}/${project}${maybeJoin("/",treepath,"/",maybeEncode(committish))}`,browsetreetemplate:({domain,user,project,committish,treepath,path:path15,fragment,hashformat})=>`https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish||"HEAD")}/${path15}${maybeJoin("#",hashformat(fragment||""))}`,browseblobtemplate:({domain,user,project,committish,blobpath,path:path15,fragment,hashformat})=>`https://${domain}/${user}/${project}/${blobpath}/${maybeEncode(committish||"HEAD")}/${path15}${maybeJoin("#",hashformat(fragment||""))}`,docstemplate:({domain,user,project,treepath,committish})=>`https://${domain}/${user}/${project}${maybeJoin("/",treepath,"/",maybeEncode(committish))}#readme`,httpstemplate:({auth,domain,user,project,committish})=>`git+https://${maybeJoin(auth,"@")}${domain}/${user}/${project}.git${maybeJoin("#",committish)}`,filetemplate:({domain,user,project,committish,path:path15})=>`https://${domain}/${user}/${project}/raw/${maybeEncode(committish||"HEAD")}/${path15}`,shortcuttemplate:({type,user,project,committish})=>`${type}:${user}/${project}${maybeJoin("#",committish)}`,pathtemplate:({user,project,committish})=>`${user}/${project}${maybeJoin("#",committish)}`,bugstemplate:({domain,user,project})=>`https://${domain}/${user}/${project}/issues`,hashformat:formatHashFragment},hosts={};hosts.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth,user,project,committish,path:path15})=>`https://${maybeJoin(auth,"@")}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish||"HEAD")}/${path15}`,gittemplate:({auth,domain,user,project,committish})=>`git://${maybeJoin(auth,"@")}${domain}/${user}/${project}.git${maybeJoin("#",committish)}`,tarballtemplate:({domain,user,project,committish})=>`https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish||"HEAD")}`,extract:url=>{let[,user,project,type,committish]=url.pathname.split("/",5);if(!(type&&type!=="tree")&&(type||(committish=url.hash.slice(1)),project&&project.endsWith(".git")&&(project=project.slice(0,-4)),!(!user||!project)))return{user,project,committish}}};hosts.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain,user,project,committish,treepath,path:path15,editpath})=>`https://${domain}/${user}/${project}${maybeJoin("/",treepath,"/",maybeEncode(committish||"HEAD"),"/",path15,editpath)}`,tarballtemplate:({domain,user,project,committish})=>`https://${domain}/${user}/${project}/get/${maybeEncode(committish||"HEAD")}.tar.gz`,extract:url=>{let[,user,project,aux]=url.pathname.split("/",4);if(!["get"].includes(aux)&&(project&&project.endsWith(".git")&&(project=project.slice(0,-4)),!(!user||!project)))return{user,project,committish:url.hash.slice(1)}}};hosts.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",tarballtemplate:({domain,user,project,committish})=>`https://${domain}/api/v4/projects/${maybeEncode(user+"/"+project)}/repository/archive.tar.gz?sha=${maybeEncode(committish||"HEAD")}`,extract:url=>{let path15=url.pathname.slice(1);if(path15.includes("/-/")||path15.includes("/archive.tar.gz"))return;let segments=path15.split("/"),project=segments.pop();project.endsWith(".git")&&(project=project.slice(0,-4));let user=segments.join("/");if(!(!user||!project))return{user,project,committish:url.hash.slice(1)}}};hosts.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain,project,committish})=>`git@${domain}:${project}.git${maybeJoin("#",committish)}`,sshurltemplate:({domain,project,committish})=>`git+ssh://git@${domain}/${project}.git${maybeJoin("#",committish)}`,edittemplate:({domain,user,project,committish,editpath})=>`https://${domain}/${user}/${project}${maybeJoin("/",maybeEncode(committish))}/${editpath}`,browsetemplate:({domain,project,committish})=>`https://${domain}/${project}${maybeJoin("/",maybeEncode(committish))}`,browsetreetemplate:({domain,project,committish,path:path15,hashformat})=>`https://${domain}/${project}${maybeJoin("/",maybeEncode(committish))}${maybeJoin("#",hashformat(path15))}`,browseblobtemplate:({domain,project,committish,path:path15,hashformat})=>`https://${domain}/${project}${maybeJoin("/",maybeEncode(committish))}${maybeJoin("#",hashformat(path15))}`,docstemplate:({domain,project,committish})=>`https://${domain}/${project}${maybeJoin("/",maybeEncode(committish))}`,httpstemplate:({domain,project,committish})=>`git+https://${domain}/${project}.git${maybeJoin("#",committish)}`,filetemplate:({user,project,committish,path:path15})=>`https://gist.githubusercontent.com/${user}/${project}/raw${maybeJoin("/",maybeEncode(committish))}/${path15}`,shortcuttemplate:({type,project,committish})=>`${type}:${project}${maybeJoin("#",committish)}`,pathtemplate:({project,committish})=>`${project}${maybeJoin("#",committish)}`,bugstemplate:({domain,project})=>`https://${domain}/${project}`,gittemplate:({domain,project,committish})=>`git://${domain}/${project}.git${maybeJoin("#",committish)}`,tarballtemplate:({project,committish})=>`https://codeload.github.com/gist/${project}/tar.gz/${maybeEncode(committish||"HEAD")}`,extract:url=>{let[,user,project,aux]=url.pathname.split("/",4);if(aux!=="raw"){if(!project){if(!user)return;project=user,user=null}return project.endsWith(".git")&&(project=project.slice(0,-4)),{user,project,committish:url.hash.slice(1)}}},hashformat:function(fragment){return fragment&&"file-"+formatHashFragment(fragment)}};hosts.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain,user,project,committish,path:path15})=>`https://${domain}/${user}/${project}/blob/${maybeEncode(committish)||"HEAD"}/${path15}`,httpstemplate:({domain,user,project,committish})=>`https://${domain}/${user}/${project}${maybeJoin("#",committish)}`,tarballtemplate:({domain,user,project,committish})=>`https://${domain}/${user}/${project}/archive/${maybeEncode(committish)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:url=>{let[,user,project,aux]=url.pathname.split("/",4);if(!["archive"].includes(aux)&&(project&&project.endsWith(".git")&&(project=project.slice(0,-4)),!(!user||!project)))return{user,project,committish:url.hash.slice(1)}}};for(let[name,host]of Object.entries(hosts))hosts[name]=Object.assign({},defaults2,host);module.exports=hosts}});var require_parse_url=__commonJS({"node_modules/hosted-git-info/lib/parse-url.js"(exports,module){var url=__require("url"),lastIndexOfBefore=(str2,char,beforeChar)=>{let startPosition=str2.indexOf(beforeChar);return str2.lastIndexOf(char,startPosition>-1?startPosition:1/0)},safeUrl=u=>{try{return new url.URL(u)}catch{}},correctProtocol=(arg,protocols)=>{let firstColon=arg.indexOf(":"),proto2=arg.slice(0,firstColon+1);if(Object.prototype.hasOwnProperty.call(protocols,proto2)||arg.substr(firstColon,3)==="://")return arg;let firstAt=arg.indexOf("@");return firstAt>-1?firstAt>firstColon?`git+ssh://${arg}`:arg:`${arg.slice(0,firstColon+1)}//${arg.slice(firstColon+1)}`},correctUrl=giturl=>{let firstAt=lastIndexOfBefore(giturl,"@","#"),lastColonBeforeHash=lastIndexOfBefore(giturl,":","#");return lastColonBeforeHash>firstAt&&(giturl=giturl.slice(0,lastColonBeforeHash)+"/"+giturl.slice(lastColonBeforeHash+1)),lastIndexOfBefore(giturl,":","#")===-1&&giturl.indexOf("//")===-1&&(giturl=`git+ssh://${giturl}`),giturl};module.exports=(giturl,protocols)=>{let withProtocol=protocols?correctProtocol(giturl,protocols):giturl;return safeUrl(withProtocol)||safeUrl(correctUrl(withProtocol))}}});var require_from_url=__commonJS({"node_modules/hosted-git-info/lib/from-url.js"(exports,module){"use strict";var parseUrl=require_parse_url(),isGitHubShorthand=arg=>{let firstHash=arg.indexOf("#"),firstSlash=arg.indexOf("/"),secondSlash=arg.indexOf("/",firstSlash+1),firstColon=arg.indexOf(":"),firstSpace=/\s/.exec(arg),firstAt=arg.indexOf("@"),spaceOnlyAfterHash=!firstSpace||firstHash>-1&&firstSpace.index>firstHash,atOnlyAfterHash=firstAt===-1||firstHash>-1&&firstAt>firstHash,colonOnlyAfterHash=firstColon===-1||firstHash>-1&&firstColon>firstHash,secondSlashOnlyAfterHash=secondSlash===-1||firstHash>-1&&secondSlash>firstHash,hasSlash=firstSlash>0,doesNotEndWithSlash=firstHash>-1?arg[firstHash-1]!=="/":!arg.endsWith("/"),doesNotStartWithDot=!arg.startsWith(".");return spaceOnlyAfterHash&&hasSlash&&doesNotEndWithSlash&&doesNotStartWithDot&&atOnlyAfterHash&&colonOnlyAfterHash&&secondSlashOnlyAfterHash};module.exports=(giturl,opts,{gitHosts,protocols})=>{if(!giturl)return;let correctedUrl=isGitHubShorthand(giturl)?`github:${giturl}`:giturl,parsed=parseUrl(correctedUrl,protocols);if(!parsed)return;let gitHostShortcut=gitHosts.byShortcut[parsed.protocol],gitHostDomain=gitHosts.byDomain[parsed.hostname.startsWith("www.")?parsed.hostname.slice(4):parsed.hostname],gitHostName=gitHostShortcut||gitHostDomain;if(!gitHostName)return;let gitHostInfo=gitHosts[gitHostShortcut||gitHostDomain],auth=null;protocols[parsed.protocol]?.auth&&(parsed.username||parsed.password)&&(auth=`${parsed.username}${parsed.password?":"+parsed.password:""}`);let committish=null,user=null,project=null,defaultRepresentation=null;try{if(gitHostShortcut){let pathname=parsed.pathname.startsWith("/")?parsed.pathname.slice(1):parsed.pathname,firstAt=pathname.indexOf("@");firstAt>-1&&(pathname=pathname.slice(firstAt+1));let lastSlash=pathname.lastIndexOf("/");lastSlash>-1?(user=decodeURIComponent(pathname.slice(0,lastSlash)),user||(user=null),project=decodeURIComponent(pathname.slice(lastSlash+1))):project=decodeURIComponent(pathname),project.endsWith(".git")&&(project=project.slice(0,-4)),parsed.hash&&(committish=decodeURIComponent(parsed.hash.slice(1))),defaultRepresentation="shortcut"}else{if(!gitHostInfo.protocols.includes(parsed.protocol))return;let segments=gitHostInfo.extract(parsed);if(!segments)return;user=segments.user&&decodeURIComponent(segments.user),project=decodeURIComponent(segments.project),committish=decodeURIComponent(segments.committish),defaultRepresentation=protocols[parsed.protocol]?.name||parsed.protocol.slice(0,-1)}}catch(err2){if(err2 instanceof URIError)return;throw err2}return[gitHostName,user,auth,project,committish,defaultRepresentation,opts]}}});var require_lib=__commonJS({"node_modules/hosted-git-info/lib/index.js"(exports,module){"use strict";var{LRUCache}=require_index_min(),hosts=require_hosts(),fromUrl=require_from_url(),parseUrl=require_parse_url(),cache=new LRUCache({max:1e3});function unknownHostedUrl(url){try{let{protocol,hostname:hostname2,pathname}=new URL(url);if(!hostname2)return null;let proto2=/(?:git\+)http:$/.test(protocol)?"http:":"https:",path15=pathname.replace(/\.git$/,"");return`${proto2}//${hostname2}${path15}`}catch{return null}}var GitHost=class _GitHost{constructor(type,user,auth,project,committish,defaultRepresentation,opts={}){Object.assign(this,_GitHost.#gitHosts[type],{type,user,auth,project,committish,default:defaultRepresentation,opts})}static#gitHosts={byShortcut:{},byDomain:{}};static#protocols={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(name,host){_GitHost.#gitHosts[name]=host,_GitHost.#gitHosts.byDomain[host.domain]=name,_GitHost.#gitHosts.byShortcut[`${name}:`]=name,_GitHost.#protocols[`${name}:`]={name}}static fromUrl(giturl,opts){if(typeof giturl!="string")return;let key=giturl+JSON.stringify(opts||{});if(!cache.has(key)){let hostArgs=fromUrl(giturl,opts,{gitHosts:_GitHost.#gitHosts,protocols:_GitHost.#protocols});cache.set(key,hostArgs?new _GitHost(...hostArgs):void 0)}return cache.get(key)}static fromManifest(manifest,opts={}){if(!manifest||typeof manifest!="object")return;let r=manifest.repository,rurl=r&&(typeof r=="string"?r:typeof r=="object"&&typeof r.url=="string"?r.url:null);if(!rurl)throw new Error("no repository");let info=rurl&&_GitHost.fromUrl(rurl.replace(/^git\+/,""),opts)||null;if(info)return info;let unk=unknownHostedUrl(rurl);return _GitHost.fromUrl(unk,opts)||unk}static parseUrl(url){return parseUrl(url)}#fill(template,opts){if(typeof template!="function")return null;let options={...this,...this.opts,...opts};options.path||(options.path=""),options.path.startsWith("/")&&(options.path=options.path.slice(1)),options.noCommittish&&(options.committish=null);let result=template(options);return options.noGitPlus&&result.startsWith("git+")?result.slice(4):result}hash(){return this.committish?`#${this.committish}`:""}ssh(opts){return this.#fill(this.sshtemplate,opts)}sshurl(opts){return this.#fill(this.sshurltemplate,opts)}browse(path15,...args){return typeof path15!="string"?this.#fill(this.browsetemplate,path15):typeof args[0]!="string"?this.#fill(this.browsetreetemplate,{...args[0],path:path15}):this.#fill(this.browsetreetemplate,{...args[1],fragment:args[0],path:path15})}browseFile(path15,...args){return typeof args[0]!="string"?this.#fill(this.browseblobtemplate,{...args[0],path:path15}):this.#fill(this.browseblobtemplate,{...args[1],fragment:args[0],path:path15})}docs(opts){return this.#fill(this.docstemplate,opts)}bugs(opts){return this.#fill(this.bugstemplate,opts)}https(opts){return this.#fill(this.httpstemplate,opts)}git(opts){return this.#fill(this.gittemplate,opts)}shortcut(opts){return this.#fill(this.shortcuttemplate,opts)}path(opts){return this.#fill(this.pathtemplate,opts)}tarball(opts){return this.#fill(this.tarballtemplate,{...opts,noCommittish:!1})}file(path15,opts){return this.#fill(this.filetemplate,{...opts,path:path15})}edit(path15,opts){return this.#fill(this.edittemplate,{...opts,path:path15})}getDefaultRepresentation(){return this.default}toString(opts){return this.default&&typeof this[this.default]=="function"?this[this.default](opts):this.sshurl(opts)}};for(let[name,host]of Object.entries(hosts))GitHost.addHost(name,host);module.exports=GitHost}});import{accessSync,constants,existsSync,readFileSync,realpathSync as realpathSync2}from"fs";import{homedir as homedir2}from"os";import{basename,dirname,join as join2,resolve,sep as sep2,win32}from"path";import{fileURLToPath as fileURLToPath2}from"url";var import_cross_spawn=__toESM(require_cross_spawn(),1);import{spawn as nodeSpawn,spawnSync as nodeSpawnSync}from"node:child_process";var EXIT_STDIO_GRACE_MS=100;function spawnProcess(command,args,options){return process.platform==="win32"?(0,import_cross_spawn.default)(command,args,options):nodeSpawn(command,args,options)}function spawnProcessSync(command,args,options){return process.platform==="win32"?import_cross_spawn.default.sync(command,args,options):nodeSpawnSync(command,args,options)}function waitForChildProcess(child){return new Promise((resolve25,reject2)=>{let settled=!1,exited=!1,exitCode=null,postExitTimer,stdoutEnded=child.stdout===null,stderrEnded=child.stderr===null,cleanup=()=>{postExitTimer&&(clearTimeout(postExitTimer),postExitTimer=void 0),child.removeListener("error",onError),child.removeListener("exit",onExit),child.removeListener("close",onClose),child.stdout?.removeListener("end",onStdoutEnd),child.stderr?.removeListener("end",onStderrEnd),child.stdout?.removeListener("data",onData),child.stderr?.removeListener("data",onData)},finalize=code=>{settled||(settled=!0,cleanup(),child.stdout?.destroy(),child.stderr?.destroy(),resolve25(code))},maybeFinalizeAfterExit=()=>{!exited||settled||stdoutEnded&&stderrEnded&&finalize(exitCode)},armIdleTimer=()=>{postExitTimer&&clearTimeout(postExitTimer),postExitTimer=setTimeout(()=>finalize(exitCode),EXIT_STDIO_GRACE_MS)},onData=()=>{exited&&!settled&&armIdleTimer()},onStdoutEnd=()=>{stdoutEnded=!0,maybeFinalizeAfterExit()},onStderrEnd=()=>{stderrEnded=!0,maybeFinalizeAfterExit()},onError=err2=>{settled||(settled=!0,cleanup(),reject2(err2))},onExit=code=>{exited=!0,exitCode=code,maybeFinalizeAfterExit(),settled||armIdleTimer()},onClose=code=>{finalize(code)};child.stdout?.once("end",onStdoutEnd),child.stderr?.once("end",onStderrEnd),child.stdout?.on("data",onData),child.stderr?.on("data",onData),child.once("error",onError),child.once("exit",onExit),child.once("close",onClose)})}import{realpathSync,statSync}from"node:fs";import{homedir}from"node:os";import{isAbsolute,join,resolve as nodeResolvePath,relative,sep}from"node:path";import{fileURLToPath}from"node:url";var UNICODE_SPACES=/[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;function canonicalizePath(path15){try{return realpathSync(path15)}catch{return path15}}function getFileRevision(path15){try{let stats=statSync(path15,{bigint:!0});return`${stats.dev}:${stats.ino}:${stats.size}:${stats.mtimeNs}:${stats.ctimeNs}`}catch{return}}function isLocalPath(value){let trimmed=value.trim();return!(trimmed.startsWith("npm:")||trimmed.startsWith("git:")||trimmed.startsWith("github:")||trimmed.startsWith("http:")||trimmed.startsWith("https:")||trimmed.startsWith("ssh:"))}function normalizeWindowsShellPath(filePath){if(!filePath.startsWith("/")||filePath.startsWith("//")||filePath.includes("\\"))return filePath;let match2=filePath.match(/^\/(?:mnt\/|cygdrive\/)?([a-z])(?:\/(.*))?$/i);if(!match2)return filePath;let suffix=match2[2]?.replaceAll("/","\\");return`${match2[1].toUpperCase()}:\\${suffix??""}`}function normalizePath(input,options={}){let normalized=options.trim?input.trim():input;if(options.normalizeUnicodeSpaces&&(normalized=normalized.replace(UNICODE_SPACES," ")),options.stripAtPrefix&&normalized.startsWith("@")&&(normalized=normalized.slice(1)),process.platform==="win32"&&(normalized=normalizeWindowsShellPath(normalized)),options.expandTilde??!0){let home=options.homeDir??homedir();if(normalized==="~")return home;if(normalized.startsWith("~/")||process.platform==="win32"&&normalized.startsWith("~\\"))return join(home,normalized.slice(2))}return/^file:\/\//.test(normalized)?fileURLToPath(normalized):normalized}function resolvePath(input,baseDir=process.cwd(),options={}){let normalized=normalizePath(input,options),normalizedBaseDir=normalizePath(baseDir);return isAbsolute(normalized)?nodeResolvePath(normalized):nodeResolvePath(normalizedBaseDir,normalized)}function getCwdRelativePath(filePath,cwd){let resolvedCwd=resolvePath(cwd),resolvedPath=resolvePath(filePath,resolvedCwd),relativePath=relative(resolvedCwd,resolvedPath);return relativePath===""||relativePath!==".."&&!relativePath.startsWith(`..${sep}`)&&!isAbsolute(relativePath)?relativePath||".":void 0}function formatPathRelativeToCwdOrAbsolute(filePath,cwd){let absolutePath=resolvePath(filePath,cwd);return(getCwdRelativePath(absolutePath,cwd)??absolutePath).split(sep).join("/")}function markPathIgnoredByCloudSync(path15){let attrs=process.platform==="darwin"?["com.dropbox.ignored","com.apple.fileprovider.ignore#P"]:process.platform==="linux"?["user.com.dropbox.ignored"]:[];for(let attr of attrs)process.platform==="darwin"?spawnProcessSync("xattr",["-w",attr,"1",path15],{encoding:"utf-8",stdio:"ignore"}):spawnProcessSync("setfattr",["-n",attr,"-v","1",path15],{encoding:"utf-8",stdio:"ignore"})}function splitBom(content){return content.startsWith("\uFEFF")?{bom:"\uFEFF",text:content.slice(1)}:{bom:"",text:content}}function stripBom(content){return splitBom(content).text}var __filename2=fileURLToPath2(import.meta.url),__dirname=dirname(__filename2),isBunBinary=import.meta.url.includes("$bunfs")||import.meta.url.includes("~BUN")||import.meta.url.includes("%7EBUN"),isBunRuntime=!!process.versions.bun;function normalizeSelfUpdatePackageTarget(target){return typeof target=="string"?{packageName:target,installSpec:target}:{packageName:target.packageName,installSpec:target.installSpec??target.packageName}}function makeSelfUpdateCommand(installStep,uninstallStep){return uninstallStep?{...installStep,display:`${uninstallStep.display} && ${installStep.display}`,steps:[uninstallStep,installStep]}:installStep}function makeSelfUpdateCommandStep(command,args){return{command,args,display:[command,...args].map(arg=>/\s/.test(arg)?`"${arg}"`:arg).join(" ")}}function detectInstallMethod(){if(isBunBinary)return"bun-binary";let resolvedPath=`${__dirname}\0${process.execPath||""}`.toLowerCase().replace(/\\/g,"/");return resolvedPath.includes("/pnpm/")||resolvedPath.includes("/.pnpm/")?"pnpm":resolvedPath.includes("/yarn/")||resolvedPath.includes("/.yarn/")?"yarn":isBunRuntime||resolvedPath.includes("/install/global/node_modules/")?"bun":resolvedPath.includes("/npm/")||resolvedPath.includes("/node_modules/")?"npm":"unknown"}function getInferredNpmInstall(){let packageDir=getPackageDir(),path15=process.platform==="win32"||packageDir.includes("\\")?win32:{basename,dirname},parent=path15.dirname(packageDir),root;if(path15.basename(parent).startsWith("@")&&path15.basename(path15.dirname(parent))==="node_modules"?root=path15.dirname(parent):path15.basename(parent)==="node_modules"&&(root=parent),!root)return;let rootParent=path15.dirname(root);if(path15.basename(rootParent)==="lib")return{root,prefix:path15.dirname(rootParent)}}function getSelfUpdateCommandForMethod(method,installedPackageName,updatePackageTarget=installedPackageName,npmCommand){let target=normalizeSelfUpdatePackageTarget(updatePackageTarget);switch(method){case"bun-binary":return;case"pnpm":{let match2=readCommandOutput("pnpm",["root","-g"])?void 0:/^(.*[\\/]global[\\/][^\\/]+)[\\/]\.pnpm[\\/]/.exec(getPackageDir()),binDirArgs=match2?[`--config.global-bin-dir=${process.env.PNPM_HOME||dirname(dirname(match2[1]))}`]:[];return makeSelfUpdateCommand(makeSelfUpdateCommandStep("pnpm",["install","-g","--ignore-scripts","--config.minimumReleaseAge=0",...binDirArgs,target.installSpec]),target.packageName===installedPackageName?void 0:makeSelfUpdateCommandStep("pnpm",["remove","-g",...binDirArgs,installedPackageName]))}case"yarn":return makeSelfUpdateCommand(makeSelfUpdateCommandStep("yarn",["global","add","--ignore-scripts",target.installSpec]),target.packageName===installedPackageName?void 0:makeSelfUpdateCommandStep("yarn",["global","remove",installedPackageName]));case"bun":return makeSelfUpdateCommand(makeSelfUpdateCommandStep("bun",["install","-g","--ignore-scripts","--minimum-release-age=0",target.installSpec]),target.packageName===installedPackageName?void 0:makeSelfUpdateCommandStep("bun",["uninstall","-g",installedPackageName]));case"npm":{let[command="npm",...npmArgs]=npmCommand??[],inferred=npmCommand?.length?void 0:getInferredNpmInstall(),prefixArgs=[...npmArgs,...inferred?["--prefix",inferred.prefix]:[]],installStep=makeSelfUpdateCommandStep(command,[...prefixArgs,"install","-g","--ignore-scripts","--min-release-age=0",target.installSpec]),uninstallStep=target.packageName===installedPackageName?void 0:makeSelfUpdateCommandStep(command,[...prefixArgs,"uninstall","-g",installedPackageName]);return makeSelfUpdateCommand(installStep,uninstallStep)}case"unknown":return}}function readCommandOutput(command,args,options={}){let result=spawnProcessSync(command,args,{encoding:"utf-8",stdio:["ignore","pipe","pipe"]});if(result.status===0)return result.stdout.trim()||void 0;if(options.requireSuccess){let reason=result.error?.message||result.stderr.trim()||`exit code ${result.status??"unknown"}`;throw new Error(`Failed to run ${[command,...args].join(" ")}: ${reason}`)}}function getGlobalPackageRoots(method,_packageName,npmCommand){switch(method){case"npm":{let configured=!!npmCommand?.length,[command="npm",...npmArgs]=npmCommand??[];if(configured&&command==="bun"){let bunBin=readCommandOutput(command,[...npmArgs,"pm","bin","-g"],{requireSuccess:!0}),roots=[join2(homedir2(),".bun","install","global","node_modules")];return bunBin&&roots.push(join2(dirname(bunBin),"install","global","node_modules")),roots}let root=readCommandOutput(command,[...npmArgs,"root","-g"],{requireSuccess:configured}),inferred=configured?void 0:getInferredNpmInstall();return[root,inferred?.root].filter(x2=>!!x2)}case"pnpm":{let root=readCommandOutput("pnpm",["root","-g"]);if(root)return[root,dirname(root)];let match2=/^(.*[\\/]global[\\/][^\\/]+)[\\/]\.pnpm[\\/]/.exec(getPackageDir());return match2?[match2[1]]:[]}case"yarn":{let dir=readCommandOutput("yarn",["global","dir"]);return dir?[dir,join2(dir,"node_modules")]:[]}case"bun":{let bunBin=readCommandOutput("bun",["pm","bin","-g"]),roots=[join2(homedir2(),".bun","install","global","node_modules")];return bunBin&&roots.push(join2(dirname(bunBin),"install","global","node_modules")),roots}case"bun-binary":case"unknown":return[]}}function normalizeExistingPathForComparison(path15,resolveSymlinks){let resolvedPath=resolve(path15);if(!existsSync(resolvedPath))return;let normalizedPath=resolvedPath;if(resolveSymlinks)try{normalizedPath=realpathSync2(resolvedPath)}catch{return}return process.platform==="win32"&&(normalizedPath=normalizedPath.toLowerCase()),normalizedPath}function getPathComparisonCandidates(path15){return Array.from(new Set([normalizeExistingPathForComparison(path15,!1),normalizeExistingPathForComparison(path15,!0)].filter(candidate=>!!candidate)))}function getEntrypointPackageDir(){let entrypoint=process.argv[1];if(!entrypoint)return;let dir=dirname(entrypoint);for(;dir!==dirname(dir);){if(existsSync(join2(dir,"package.json")))return dir;dir=dirname(dir)}}function isSelfUpdatePathWritable(){let packageDir=getPackageDir();try{return accessSync(packageDir,constants.W_OK),accessSync(dirname(packageDir),constants.W_OK),!0}catch{return!1}}function isManagedByGlobalPackageManager(method,packageName,npmCommand){let packageDirCandidates=[getPackageDir(),getEntrypointPackageDir()].filter(dir=>!!dir).flatMap(dir=>getPathComparisonCandidates(dir));return getGlobalPackageRoots(method,packageName,npmCommand).some(root=>getPathComparisonCandidates(root).some(normalizedRoot=>{let rootPrefix=normalizedRoot.endsWith(sep2)?normalizedRoot:`${normalizedRoot}${sep2}`;return packageDirCandidates.some(packageDir=>packageDir.startsWith(rootPrefix))}))}function getSelfUpdateCommand(packageName,npmCommand,updatePackageTarget=packageName){let method=detectInstallMethod(),command=getSelfUpdateCommandForMethod(method,packageName,updatePackageTarget,npmCommand);if(!(!command||!isManagedByGlobalPackageManager(method,packageName,npmCommand)||!isSelfUpdatePathWritable()))return command}function getSelfUpdateUnavailableInstruction(packageName,npmCommand,updatePackageTarget=packageName){let method=detectInstallMethod(),target=normalizeSelfUpdatePackageTarget(updatePackageTarget);if(method==="bun-binary")return"This standalone binary has no configured update source. Update it using the release channel that installed it.";let command=getSelfUpdateCommandForMethod(method,packageName,target,npmCommand);return command?isManagedByGlobalPackageManager(method,packageName,npmCommand)&&!isSelfUpdatePathWritable()?`This installation is managed by a global ${method} install, but the install path is not writable. Update it yourself with: ${command.display}`:`This installation is not managed by a global ${method} install. Update it with the package manager, wrapper, or source checkout that provides it.`:`Update ${target.installSpec} using the package manager, wrapper, or source checkout that provides this installation.`}function findNodePackageDir(startDir){let dir=startDir;for(;dir!==dirname(dir);){if(existsSync(join2(dir,"package.json"))){let parent=dirname(dir);return basename(dir)==="dist"&&existsSync(join2(parent,"package.json"))?parent:dir}dir=dirname(dir)}return startDir}function getPackageDir(){let envDir=process.env.AGENT_FORGE_PACKAGE_DIR;return envDir?normalizePath(envDir):isBunBinary?dirname(process.execPath):findNodePackageDir(__dirname)}function getThemesDir(){if(isBunBinary)return join2(getPackageDir(),"theme");let packageDir=getPackageDir(),srcOrDist=existsSync(join2(packageDir,"src"))?"src":"dist";return join2(packageDir,srcOrDist,"modes","interactive","theme")}function getExportTemplateDir(){if(isBunBinary)return join2(getPackageDir(),"export-html");let packageDir=getPackageDir(),srcOrDist=existsSync(join2(packageDir,"src"))?"src":"dist";return join2(packageDir,srcOrDist,"core","export-html")}function getPackageJsonPath(){return join2(getPackageDir(),"package.json")}function getReadmePath(){return resolve(join2(getPackageDir(),"README.md"))}function getDocsPath(){return resolve(join2(getPackageDir(),"docs"))}function getExamplesPath(){return resolve(join2(getPackageDir(),"examples"))}function getChangelogPath(){return resolve(join2(getPackageDir(),"CHANGELOG.md"))}var pkg={};try{pkg=JSON.parse(stripBom(readFileSync(getPackageJsonPath(),"utf-8")))}catch(e){if(e.code!=="ENOENT")throw e}var agentForgeConfigName=pkg.agentForgeConfig?.name,PACKAGE_NAME=pkg.name||"@agent-forge/agent-forge",APP_NAME=agentForgeConfigName||"agent-forge",APP_TITLE=agentForgeConfigName?APP_NAME:"Agent Forge",CONFIG_DIR_NAME=pkg.agentForgeConfig?.configDir||".agent-forge",VERSION=pkg.version||"0.0.0",ENV_APP_PREFIX=APP_NAME.toUpperCase().replace(/[^A-Z0-9]+/g,"_"),ENV_AGENT_DIR=`${ENV_APP_PREFIX}_DIR`,ENV_SESSION_DIR=`${ENV_APP_PREFIX}_SESSION_DIR`;function expandTildePath(path15){return normalizePath(path15)}function getAgentDir(){let envDir=process.env[ENV_AGENT_DIR];return envDir?expandTildePath(envDir):join2(homedir2(),CONFIG_DIR_NAME,"agent")}function getCustomThemesDir(){return join2(getAgentDir(),"themes")}function getAuthPath(){return join2(getAgentDir(),"auth.json")}function getSettingsPath(){return join2(getAgentDir(),"settings.json")}function getBinDir(){return join2(getAgentDir(),"bin")}function getSessionsDir(){return join2(getAgentDir(),"sessions")}function getDebugLogPath(){return join2(getAgentDir(),`${APP_NAME}-debug.log`)}var undici=__toESM(require_undici(),1);import{EventEmitter}from"node:events";var DEFAULT_HTTP_IDLE_TIMEOUT_MS=3e5,DEFAULT_AUTO_SELECT_FAMILY_ATTEMPT_TIMEOUT_MS=2e3,HTTP_IDLE_TIMEOUT_CHOICES=[{label:"30 sec",timeoutMs:3e4},{label:"1 min",timeoutMs:6e4},{label:"2 min",timeoutMs:12e4},{label:"5 min",timeoutMs:3e5},{label:"disabled",timeoutMs:0}],originalGlobalFetch=globalThis.fetch,installedGlobalFetch;function parseHttpIdleTimeoutMs(value){if(typeof value=="string"){let trimmed=value.trim();return trimmed.toLowerCase()==="disabled"?0:trimmed.length===0?void 0:parseHttpIdleTimeoutMs(Number(trimmed))}if(!(typeof value!="number"||!Number.isFinite(value)||value<0))return Math.floor(value)}function formatHttpIdleTimeoutMs(timeoutMs){let choice=HTTP_IDLE_TIMEOUT_CHOICES.find(item=>item.timeoutMs===timeoutMs);return choice?choice.label:`${timeoutMs/1e3} sec`}function applyHttpProxySettings(httpProxy){let proxy=httpProxy?.trim();proxy&&(process.env.HTTP_PROXY??=proxy,process.env.HTTPS_PROXY??=proxy)}var ignoreUndiciDispatcherError=_error=>{};function withUndiciErrorListener(dispatcher){return dispatcher instanceof EventEmitter&&EventEmitter.prototype.on.call(dispatcher,"error",ignoreUndiciDispatcherError),dispatcher}function createUndiciClient(origin,options){return withUndiciErrorListener(new undici.Client(origin,options))}function createUndiciOriginDispatcher(origin,options){let dispatcherOptions=options;return dispatcherOptions.connections===1?createUndiciClient(origin,dispatcherOptions):withUndiciErrorListener(new undici.Pool(origin,{...dispatcherOptions,factory:createUndiciClient}))}function configureHttpDispatcher(timeoutMs=DEFAULT_HTTP_IDLE_TIMEOUT_MS){let normalizedTimeoutMs=parseHttpIdleTimeoutMs(timeoutMs);if(normalizedTimeoutMs===void 0)throw new Error(`Invalid HTTP idle timeout: ${String(timeoutMs)}`);let dispatcher=withUndiciErrorListener(new undici.EnvHttpProxyAgent({allowH2:!1,proxyTunnel:!0,bodyTimeout:normalizedTimeoutMs,connect:{autoSelectFamilyAttemptTimeout:DEFAULT_AUTO_SELECT_FAMILY_ATTEMPT_TIMEOUT_MS},headersTimeout:normalizedTimeoutMs,clientFactory:createUndiciClient,factory:createUndiciOriginDispatcher}));undici.setGlobalDispatcher(dispatcher),(installedGlobalFetch===void 0?globalThis.fetch===originalGlobalFetch:globalThis.fetch===installedGlobalFetch)&&(undici.install?.(),installedGlobalFetch=globalThis.fetch)}var EXPERIMENTAL_PUBLIC_API_VERSION="1-draft",LifecycleTransformError=class extends Error{report;cause;constructor(cause,report){super("Lifecycle transform failed"),this.name="LifecycleTransformError",this.cause=cause,this.report=report}},LifecycleExecuteError=class extends Error{report;cause;constructor(cause,report){super("Lifecycle execute failed"),this.name="LifecycleExecuteError",this.cause=cause,this.report=report}},AGENT_TASK_CHILD_PROFILE_KEY="agent-forge.agentTaskChildProfile",AGENT_TASK_PARENT_SESSION_KEY="agent-forge.agentTaskParentSession",AGENT_TASK_PARENT_TRACE_KEY="agent-forge.agentTaskParentTrace",AGENT_TASK_RESUME_SESSION_KEY="agent-forge.agentTaskResumeSession",CHILD_PROFILE_KEYS=["version","model","thinkingLevel","tools","mode","systemPromptAppend","roleId"],CHILD_PROFILE_TOOL_LIMIT=64,CHILD_PROFILE_APPEND_CHARS=8e3,CHILD_PROFILE_THINKING_LEVELS=["minimal","low","medium","high","xhigh","max"];function parseAgentTaskChildProfileV1(value){if(value===null||typeof value!="object"||Array.isArray(value))return{ok:!1,message:"child task profile must be an object"};let record=value;for(let key of Object.keys(record))if(!CHILD_PROFILE_KEYS.includes(key))return{ok:!1,message:`child task profile has unknown key ${JSON.stringify(key)} (known: ${CHILD_PROFILE_KEYS.join(", ")})`};if(record.version!==1)return{ok:!1,message:`child task profile version must be 1, found ${JSON.stringify(record.version)}`};let model;if(record.model!==void 0){if(typeof record.model!="string"||record.model.trim()==="")return{ok:!1,message:"child task profile model must be a non-empty string"};model=record.model}let thinkingLevel;if(record.thinkingLevel!==void 0){if(typeof record.thinkingLevel!="string"||!CHILD_PROFILE_THINKING_LEVELS.includes(record.thinkingLevel))return{ok:!1,message:`child task profile thinkingLevel must be one of ${CHILD_PROFILE_THINKING_LEVELS.join(", ")}, found `+JSON.stringify(record.thinkingLevel)};thinkingLevel=record.thinkingLevel}let tools;if(record.tools!==void 0){if(!Array.isArray(record.tools)||record.tools.length>CHILD_PROFILE_TOOL_LIMIT)return{ok:!1,message:`child task profile tools must be an array of at most ${CHILD_PROFILE_TOOL_LIMIT} names`};let names2=new Set;for(let entry of record.tools){if(typeof entry!="string"||entry.trim()==="")return{ok:!1,message:"child task profile tools entries must be non-empty strings"};names2.add(entry)}tools=Object.freeze([...names2])}let mode;if(record.mode!==void 0){if(record.mode!=="readonly"&&record.mode!=="full-control")return{ok:!1,message:'child task profile mode must be "readonly" or "full-control"'};mode=record.mode}let roleId;if(record.roleId!==void 0){if(typeof record.roleId!="string"||record.roleId.trim()==="")return{ok:!1,message:"child task profile roleId must be a non-empty string"};roleId=record.roleId}let systemPromptAppend;if(record.systemPromptAppend!==void 0){if(typeof record.systemPromptAppend!="string"||record.systemPromptAppend.trim()===""||record.systemPromptAppend.length>CHILD_PROFILE_APPEND_CHARS)return{ok:!1,message:`child task profile systemPromptAppend must be a non-empty string of at most ${CHILD_PROFILE_APPEND_CHARS} chars`};systemPromptAppend=record.systemPromptAppend}return{ok:!0,profile:Object.freeze({version:1,...model===void 0?{}:{model},...thinkingLevel===void 0?{}:{thinkingLevel},...tools===void 0?{}:{tools},...mode===void 0?{}:{mode},...systemPromptAppend===void 0?{}:{systemPromptAppend},...roleId===void 0?{}:{roleId}})}}function readAgentTaskChildProfileV1(metadata){let raw=metadata?.[AGENT_TASK_CHILD_PROFILE_KEY];if(raw!==void 0)return parseAgentTaskChildProfileV1(raw)}var SUMMARY_MODEL_INVOCATION_ERROR_CODES={providerError:"summary_provider_error",lengthCap:"summary_length_cap",toolCall:"summary_tool_call",transportError:"summary_transport_error"};function createDisposableRegistration(kind,dispose,id){let disposed=!1;return{id,kind,dispose:()=>{if(!disposed)return disposed=!0,dispose()}}}function createEventEnvelope(event,options){return{...event,id:options.id,timestamp:options.timestamp??0}}function detachedSessionSnapshot(value){let clone=structuredClone(value),freeze=candidate=>{if(!(!candidate||typeof candidate!="object")&&!ArrayBuffer.isView(candidate)){for(let child of Object.values(candidate))freeze(child);Object.freeze(candidate)}};return freeze(clone),clone}var import_semver=__toESM(require_semver2(),1);function isStringArray(value){return Array.isArray(value)&&value.every(entry=>typeof entry=="string")}function isObject(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}function isJsonConfigValue(value){return value===null||typeof value=="boolean"||typeof value=="string"?!0:typeof value=="number"?Number.isFinite(value):Array.isArray(value)?value.every(isJsonConfigValue):isObject(value)?Object.values(value).every(isJsonConfigValue):!1}function assertPluginCapabilityId(value,field2,manifestPath){if(typeof value!="string"||!value.trim())throw new Error(`Capability plugin ${field2} must be a non-empty string: ${manifestPath}`)}function assertPluginCapabilityVersion(value,field2,manifestPath){if(typeof value!="number"||!Number.isSafeInteger(value)||value<1)throw new Error(`Capability plugin ${field2} must be a positive safe integer: ${manifestPath}`)}function capabilityKey(id,version){return`${id}\0${version}`}function parsePluginAgentRoles(value,manifestPath){if(value===void 0)return;if(!Array.isArray(value))throw new Error(`Capability plugin roles must be an array: ${manifestPath}`);let roles=[],seen=new Set;for(let[index3,role]of value.entries()){if(role!=="root-agent-controller"&&role!=="child-agent-controller")throw new Error(`Capability plugin roles[${index3}] is invalid: ${manifestPath}`);if(seen.has(role))throw new Error(`Capability plugin roles duplicates ${role}: ${manifestPath}`);seen.add(role),roles.push(role)}return roles}function parsePluginAgentDeclarations(value,roles,manifestPath){if(value===void 0)return;if(!Array.isArray(value))throw new Error(`Capability plugin agents must be an array: ${manifestPath}`);let declarations=[],seen=new Set;for(let[index3,candidate]of value.entries()){if(!isObject(candidate))throw new Error(`Capability plugin agents[${index3}] must be an object: ${manifestPath}`);let{id,version,role,entry}=candidate;if(assertPluginCapabilityId(id,`agents[${index3}].id`,manifestPath),assertPluginCapabilityVersion(version,`agents[${index3}].version`,manifestPath),role!=="root-agent-controller"&&role!=="child-agent-controller")throw new Error(`Capability plugin agents[${index3}].role is invalid: ${manifestPath}`);if(typeof entry!="string"||!entry.trim())throw new Error(`Capability plugin agents[${index3}].entry must be a non-empty string: ${manifestPath}`);if(roles!==void 0&&!roles.includes(role))throw new Error(`Capability plugin agents[${index3}].role is not declared in roles: ${manifestPath}`);let key=capabilityKey(id,version);if(seen.has(key))throw new Error(`Capability plugin agents duplicates ${id}@${version}: ${manifestPath}`);seen.add(key),declarations.push({id,version,role,entry})}return declarations}function parsePluginCapabilityDeclarations(value,manifestPath){if(value===void 0)return;if(!Array.isArray(value))throw new Error(`Capability plugin provides must be an array: ${manifestPath}`);let declarations=[],seen=new Set;for(let[index3,candidate]of value.entries()){if(!isObject(candidate))throw new Error(`Capability plugin provides[${index3}] must be an object: ${manifestPath}`);let{id,version,kind}=candidate;if(assertPluginCapabilityId(id,`provides[${index3}].id`,manifestPath),assertPluginCapabilityVersion(version,`provides[${index3}].version`,manifestPath),kind!=="service"&&kind!=="contribution"&&kind!=="transform")throw new Error(`Capability plugin provides[${index3}].kind is invalid: ${manifestPath}`);let key=capabilityKey(id,version);if(seen.has(key))throw new Error(`Capability plugin provides duplicates ${id}@${version}: ${manifestPath}`);seen.add(key),declarations.push({id,version,kind})}return declarations}function parsePluginCapabilityRequirements(value,manifestPath){if(value===void 0)return;if(!Array.isArray(value))throw new Error(`Capability plugin requires must be an array: ${manifestPath}`);let requirements=[],seen=new Set;for(let[index3,candidate]of value.entries()){if(!isObject(candidate))throw new Error(`Capability plugin requires[${index3}] must be an object: ${manifestPath}`);let{id,version,optional}=candidate;if(assertPluginCapabilityId(id,`requires[${index3}].id`,manifestPath),assertPluginCapabilityVersion(version,`requires[${index3}].version`,manifestPath),optional!==void 0&&typeof optional!="boolean")throw new Error(`Capability plugin requires[${index3}].optional must be a boolean: ${manifestPath}`);let key=capabilityKey(id,version);if(seen.has(key))throw new Error(`Capability plugin requires duplicates ${id}@${version}: ${manifestPath}`);seen.add(key),requirements.push(optional===void 0?{id,version}:{id,version,optional})}return requirements}function parseCapabilityPluginManifest(value,manifestPath="<manifest>"){if(!isObject(value))throw new Error(`Capability plugin manifest must be an object: ${manifestPath}`);let{id,version,hostVersion,apiVersion,entry,requiredCapabilities,optionalCapabilities,provides,requires,roles,agents,config}=value;if(typeof id!="string"||typeof version!="string"||typeof apiVersion!="string"||typeof entry!="string")throw new Error(`Capability plugin manifest requires string id, version, apiVersion, and entry: ${manifestPath}`);if(apiVersion!==EXPERIMENTAL_PUBLIC_API_VERSION)throw new Error(`Unsupported plugin API version: ${apiVersion}: ${manifestPath}`);if(hostVersion!==void 0&&(typeof hostVersion!="string"||hostVersion.trim()===""||(0,import_semver.validRange)(hostVersion)===null))throw new Error(`Capability plugin hostVersion must be a non-empty string containing a valid semver range (e.g. ">=0.84.0"): ${manifestPath}`);if(requiredCapabilities!==void 0&&!isStringArray(requiredCapabilities))throw new Error(`Capability plugin requiredCapabilities must be a string array: ${manifestPath}`);if(optionalCapabilities!==void 0&&!isStringArray(optionalCapabilities))throw new Error(`Capability plugin optionalCapabilities must be a string array: ${manifestPath}`);if(config!==void 0&&(!isObject(config)||!isJsonConfigValue(config)))throw new Error(`Capability plugin config must be a JSON object: ${manifestPath}`);let parsedProvides=parsePluginCapabilityDeclarations(provides,manifestPath),parsedRequires=parsePluginCapabilityRequirements(requires,manifestPath),parsedRoles=parsePluginAgentRoles(roles,manifestPath),parsedAgents=parsePluginAgentDeclarations(agents,parsedRoles,manifestPath);return{id,version,apiVersion,entry,requiredCapabilities,optionalCapabilities,...hostVersion===void 0?{}:{hostVersion},...parsedProvides===void 0?{}:{provides:parsedProvides},...parsedRequires===void 0?{}:{requires:parsedRequires},...parsedRoles===void 0?{}:{roles:parsedRoles},...parsedAgents===void 0?{}:{agents:parsedAgents},...config===void 0?{}:{config}}}var MEMORY_RECALL_TOOL_NAME="memory_recall";var dist_exports={};__export(dist_exports,{AGENT_TASK_CHILD_PROFILE_KEY:()=>AGENT_TASK_CHILD_PROFILE_KEY,AGENT_TASK_PARENT_SESSION_KEY:()=>AGENT_TASK_PARENT_SESSION_KEY,AGENT_TASK_PARENT_TRACE_KEY:()=>AGENT_TASK_PARENT_TRACE_KEY,AGENT_TASK_RESUME_SESSION_KEY:()=>AGENT_TASK_RESUME_SESSION_KEY,DEFAULT_PLUGIN_CONTEXT_BUDGET_V1:()=>DEFAULT_PLUGIN_CONTEXT_BUDGET_V1,EXPERIMENTAL_PUBLIC_API_VERSION:()=>EXPERIMENTAL_PUBLIC_API_VERSION,LifecycleExecuteError:()=>LifecycleExecuteError,LifecycleTransformError:()=>LifecycleTransformError,MAX_ARTIFACT_METADATA_CHARS_V1:()=>MAX_ARTIFACT_METADATA_CHARS_V1,MAX_ARTIFACT_REF_CHARS_V1:()=>MAX_ARTIFACT_REF_CHARS_V1,MEMORY_RECALL_TOOL_NAME:()=>MEMORY_RECALL_TOOL_NAME,PLUGIN_OPERATION_TERMINAL_STATUSES_V1:()=>PLUGIN_OPERATION_TERMINAL_STATUSES_V1,PLUGIN_SHARED_CONTRACT_VERSION_V1:()=>PLUGIN_SHARED_CONTRACT_VERSION_V1,SUMMARY_MODEL_INVOCATION_ERROR_CODES:()=>SUMMARY_MODEL_INVOCATION_ERROR_CODES,TRACE_KINDS_V1:()=>TRACE_KINDS_V1,artifactRefKeyV1:()=>artifactRefKeyV1,assertExactKeys:()=>assertExactKeys,assertFiniteNumber:()=>assertFiniteNumber,assertJsonResultInputV1:()=>assertJsonResultInputV1,assertJsonValue:()=>assertJsonValue,assertNonEmptyString:()=>assertNonEmptyString,assertNonNegativeNumber:()=>assertNonNegativeNumber,assertNonNegativeSafeInteger:()=>assertNonNegativeSafeInteger,assertOptionalString:()=>assertOptionalString,assertPlainRecord:()=>assertPlainRecord,assertPositiveSafeInteger:()=>assertPositiveSafeInteger,buildArtifactRefV1:()=>buildArtifactRefV1,buildDiffRequestV1:()=>buildDiffRequestV1,buildDiffResultV1:()=>buildDiffResultV1,buildEvidenceRefV1:()=>buildEvidenceRefV1,buildPluginErrorV1:()=>buildPluginErrorV1,buildPluginOperationV1:()=>buildPluginOperationV1,buildPluginResultV1:()=>buildPluginResultV1,buildRenderRequestV1:()=>buildRenderRequestV1,buildRenderResultV1:()=>buildRenderResultV1,buildVerificationV1:()=>buildVerificationV1,createDisposableRegistration:()=>createDisposableRegistration,createEventEnvelope:()=>createEventEnvelope,detachedFreeze:()=>detachedFreeze,detachedSessionSnapshot:()=>detachedSessionSnapshot,isArtifactRefV1:()=>isArtifactRefV1,isPlainRecord:()=>isPlainRecord,parseAgentTaskChildProfileV1:()=>parseAgentTaskChildProfileV1,parseCapabilityPluginManifest:()=>parseCapabilityPluginManifest,projectPluginContextV1:()=>projectPluginContextV1,readAgentTaskChildProfileV1:()=>readAgentTaskChildProfileV1,sortByKey:()=>sortByKey,stableStringifyV1:()=>stableStringifyV1,validateArtifactRefV1:()=>validateArtifactRefV1,validateDiffRequestV1:()=>validateDiffRequestV1,validateDiffResultV1:()=>validateDiffResultV1,validateEvidenceRefV1:()=>validateEvidenceRefV1,validatePluginErrorV1:()=>validatePluginErrorV1,validatePluginOperationV1:()=>validatePluginOperationV1,validatePluginResultV1:()=>validatePluginResultV1,validateRenderRequestV1:()=>validateRenderRequestV1,validateRenderResultV1:()=>validateRenderResultV1,validateVerificationV1:()=>validateVerificationV1});var PLUGIN_SHARED_CONTRACT_VERSION_V1=1;function isPlainRecord(value){if(value===null||typeof value!="object"||Array.isArray(value))return!1;let prototype=Object.getPrototypeOf(value);return prototype===Object.prototype||prototype===null}function assertPlainRecord(value,label){if(!isPlainRecord(value))throw new Error(`${label} must be a plain object`)}function assertExactKeys(value,required,optional,label){let allowed=new Set([...required,...optional]),unsupported=Object.keys(value).filter(key=>!allowed.has(key)).sort();if(unsupported.length>0)throw new Error(`${label} has unsupported fields: ${unsupported.join(", ")}`);for(let key of required)if(!(key in value))throw new Error(`${label} is missing required field: ${key}`)}function assertNonEmptyString(value,label){if(typeof value!="string"||value.trim().length===0)throw new Error(`${label} must be a non-empty string`)}function assertOptionalString(value,label){value!==void 0&&assertNonEmptyString(value,label)}function assertFiniteNumber(value,label){if(typeof value!="number"||!Number.isFinite(value))throw new Error(`${label} must be a finite number`)}function assertNonNegativeNumber(value,label){if(assertFiniteNumber(value,label),value<0)throw new Error(`${label} must be non-negative`)}function assertPositiveSafeInteger(value,label){if(typeof value!="number"||!Number.isSafeInteger(value)||value<1)throw new Error(`${label} must be a positive safe integer`)}function assertNonNegativeSafeInteger(value,label){if(typeof value!="number"||!Number.isSafeInteger(value)||value<0)throw new Error(`${label} must be a non-negative safe integer`)}function assertJsonValue(value,label,seen=new WeakSet){if(!(value===null||typeof value=="boolean"||typeof value=="string")){if(typeof value=="number"){if(Number.isFinite(value))return;throw new Error(`${label} must contain finite JSON numbers`)}if(typeof value!="object")throw new Error(`${label} must be JSON-compatible`);if(seen.has(value))throw new Error(`${label} must not contain cycles`);if(seen.add(value),Array.isArray(value))for(let[index3,child]of value.entries())assertJsonValue(child,`${label}[${index3}]`,seen);else{if(!isPlainRecord(value))throw new Error(`${label} must contain only plain JSON objects`);for(let[key,child]of Object.entries(value))assertJsonValue(child,`${label}.${key}`,seen)}seen.delete(value)}}function detachedFreeze(value,seen=new WeakMap){if(value===null||typeof value!="object")return value;let existing=seen.get(value);if(existing!==void 0)return existing;if(Array.isArray(value)){let result2=[];seen.set(value,result2);for(let child of value)result2.push(detachedFreeze(child,seen));return Object.freeze(result2)}let result={};seen.set(value,result);for(let key of Object.keys(value).sort())result[key]=detachedFreeze(value[key],seen);return Object.freeze(result)}function sortByKey(values,key){return[...values].sort((left,right)=>{let a=key(left),b2=key(right);return a<b2?-1:a>b2?1:0})}function stableStringifyV1(value){return value===null||typeof value=="boolean"||typeof value=="number"||typeof value=="string"?JSON.stringify(value):Array.isArray(value)?`[${value.map(item=>stableStringifyV1(item)).join(",")}]`:`{${Object.entries(value).sort(([a],[b2])=>a<b2?-1:a>b2?1:0).map(([key,item])=>`${JSON.stringify(key)}:${stableStringifyV1(item)}`).join(",")}}`}var MAX_ARTIFACT_REF_CHARS_V1=2048,MAX_ARTIFACT_METADATA_CHARS_V1=256;function validateBoundedString(value,label,maximum){if(assertNonEmptyString(value,label),value.length>maximum)throw new Error(`${label} exceeds the context budget (${maximum} characters)`);return value}function validateDigest(value,label){if(value!==void 0)return validateBoundedString(value,label,MAX_ARTIFACT_METADATA_CHARS_V1)}function validateArtifactRefV1(value,label="Artifact reference"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","artifactRef","kind","mimeType"],["digest","sizeBytes","operationId","pluginId"],label),value.version!==1)throw new Error(`${label}.version must be 1`);let artifactRef=validateBoundedString(value.artifactRef,`${label}.artifactRef`,MAX_ARTIFACT_REF_CHARS_V1);if(/^(?:file:|[a-zA-Z]:[\\/]|[\\/]{1,2}|\\\\)/iu.test(artifactRef))throw new Error(`${label}.artifactRef must be an opaque reference, not a local path`);let kind=validateBoundedString(value.kind,`${label}.kind`,MAX_ARTIFACT_METADATA_CHARS_V1),mimeType=validateBoundedString(value.mimeType,`${label}.mimeType`,MAX_ARTIFACT_METADATA_CHARS_V1),digest=validateDigest(value.digest,`${label}.digest`);value.sizeBytes!==void 0&&assertNonNegativeSafeInteger(value.sizeBytes,`${label}.sizeBytes`);let operationId=value.operationId===void 0?void 0:validateBoundedString(value.operationId,`${label}.operationId`,MAX_ARTIFACT_METADATA_CHARS_V1),pluginId=value.pluginId===void 0?void 0:validateBoundedString(value.pluginId,`${label}.pluginId`,MAX_ARTIFACT_METADATA_CHARS_V1);return detachedFreeze({version:1,artifactRef,kind,mimeType,...digest===void 0?{}:{digest},...value.sizeBytes===void 0?{}:{sizeBytes:value.sizeBytes},...operationId===void 0?{}:{operationId},...pluginId===void 0?{}:{pluginId}})}function buildArtifactRefV1(input){return validateArtifactRefV1(input)}function isArtifactRefV1(value){try{return validateArtifactRefV1(value),!0}catch{return!1}}function artifactRefKeyV1(ref){return ref.artifactRef}var DEFAULT_PLUGIN_CONTEXT_BUDGET_V1=Object.freeze({maxOutputBytes:65536,maxInlineItems:20,maxCellChars:256});function error(code,message){return{version:1,code,message}}function isRecord(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}function assertPositiveInteger(value,label){if(!Number.isSafeInteger(value)||value<=0)throw new Error(`${label} must be a positive safe integer`)}function assertNonNegativeInteger(value,label){if(!Number.isSafeInteger(value)||value<0)throw new Error(`${label} must be a non-negative safe integer`)}function isJsonValue(value){return value===null||typeof value=="string"||typeof value=="boolean"?!0:typeof value=="number"?Number.isFinite(value):Array.isArray(value)?value.every(isJsonValue):isRecord(value)?Object.values(value).every(isJsonValue):!1}function containsRawPayload(value,seen=new Set){if(!isRecord(value)&&!Array.isArray(value)||seen.has(value))return!1;if(seen.add(value),isRecord(value)){for(let[key,child]of Object.entries(value))if((key==="rows"||key==="rawRows"||key==="rawPayload"||key==="payload")&&child!==void 0||containsRawPayload(child,seen))return!0;return!1}return value.some(child=>containsRawPayload(child,seen))}function validateBudget(input){let budget={...DEFAULT_PLUGIN_CONTEXT_BUDGET_V1,...input??{}};return assertPositiveInteger(budget.maxOutputBytes,"maxOutputBytes"),assertNonNegativeInteger(budget.maxInlineItems,"maxInlineItems"),assertPositiveInteger(budget.maxCellChars,"maxCellChars"),Object.freeze(budget)}function boundStrings(value,maxCellChars){if(typeof value=="string"){if([...value].length>maxCellChars)throw new Error("context string exceeds maxCellChars");return value}return Array.isArray(value)?Object.freeze(value.map(child=>boundStrings(child,maxCellChars))):isRecord(value)?Object.freeze(Object.fromEntries(Object.entries(value).map(([key,child])=>[key,boundStrings(child,maxCellChars)]))):value}function invalid(operationId,code,message){return Object.freeze({version:1,operationId,status:"failed",inlineItems:Object.freeze([]),truncated:!1,error:error(code,message)})}function projectPluginContextV1(input,limits){let operationId=isRecord(input)&&typeof input.operationId=="string"?input.operationId:"invalid";try{if(!isRecord(input)||input.version!==1)throw new Error("input must have version 1");if(typeof input.operationId!="string"||input.operationId.trim()==="")throw new Error("operationId must be a non-empty string");if(!Array.isArray(input.items))throw new Error("items must be an array");let budget=validateBudget(limits);if(containsRawPayload(input.items))throw new Error("raw payloads are not allowed in plugin context");if(input.outputArtifactRef!==void 0){if(typeof input.outputArtifactRef!="string"||input.outputArtifactRef.trim()==="")throw new Error("outputArtifactRef must be a non-empty string");if(/^(?:[a-zA-Z]:[\\/]|[\\/]{1,2}|\\\\)/.test(input.outputArtifactRef))throw new Error("outputArtifactRef must be opaque")}let items=input.items.map((item,index3)=>{if(!isJsonValue(item))throw new Error(`items[${index3}] must be JSON-safe`);return boundStrings(item,budget.maxCellChars)}),truncated=input.truncated===!0||items.length>budget.maxInlineItems,inlineItems=Object.freeze(items.slice(0,budget.maxInlineItems)),result=Object.freeze({version:1,operationId:input.operationId,status:"succeeded",inlineItems,truncated,...input.outputArtifactRef===void 0?{}:{outputArtifactRef:input.outputArtifactRef}});if(new TextEncoder().encode(JSON.stringify(result)).byteLength>budget.maxOutputBytes)throw new Error("projected context exceeds maxOutputBytes");return result}catch(cause){return invalid(operationId,"context_projection_rejected",cause instanceof Error?cause.message:"Context projection rejected")}}var PLUGIN_OPERATION_TERMINAL_STATUSES_V1=["succeeded","failed","cancelled","needs_user","unsupported"],EVIDENCE_KINDS_V1=["screenshot","dom","render","diff","log","assertion","trace","network","structure"],OPERATION_STATUSES_V1=["queued","running","succeeded","failed","cancelled","needs_user","unsupported"],RESULT_STATUSES_V1=["succeeded","failed","cancelled","needs_user","unsupported"];function validateStatus(value,label,values){if(typeof value!="string"||!values.includes(value))throw new Error(`${label} is invalid`);return value}function validateIsoLike(value,label){if(value!==void 0)return assertNonEmptyString(value,label),value}function validateArtifactArray(value,label){if(!Array.isArray(value))throw new Error(`${label} must be an array`);let result=value.map((item,index3)=>validateArtifactRefV1(item,`${label}[${index3}]`));if(new Set(result.map(item=>item.artifactRef)).size!==result.length)throw new Error(`${label} must not contain duplicate artifactRef values`);return Object.freeze(sortByKey(result,item=>item.artifactRef))}function validatePluginOperationV1(value,label="Plugin operation"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","operationId","pluginId","kind","status"],["inputArtifacts","outputArtifacts","startedAt","endedAt"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.operationId,`${label}.operationId`),assertNonEmptyString(value.pluginId,`${label}.pluginId`),assertNonEmptyString(value.kind,`${label}.kind`);let status2=validateStatus(value.status,`${label}.status`,OPERATION_STATUSES_V1),inputArtifacts=value.inputArtifacts===void 0?void 0:validateArtifactArray(value.inputArtifacts,`${label}.inputArtifacts`),outputArtifacts=value.outputArtifacts===void 0?void 0:validateArtifactArray(value.outputArtifacts,`${label}.outputArtifacts`),startedAt=validateIsoLike(value.startedAt,`${label}.startedAt`),endedAt=validateIsoLike(value.endedAt,`${label}.endedAt`);if(endedAt!==void 0&&startedAt===void 0)throw new Error(`${label}.endedAt requires startedAt`);if(status2==="running"&&endedAt!==void 0)throw new Error(`${label}.running must not have endedAt`);return detachedFreeze({version:1,operationId:value.operationId,pluginId:value.pluginId,kind:value.kind,status:status2,...inputArtifacts===void 0?{}:{inputArtifacts},...outputArtifacts===void 0?{}:{outputArtifacts},...startedAt===void 0?{}:{startedAt},...endedAt===void 0?{}:{endedAt}})}function buildPluginOperationV1(input){return validatePluginOperationV1(input)}function validateEvidenceRefV1(value,label="Evidence reference"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","evidenceId","kind","operationId"],["artifactRef","summary","observedAt"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.evidenceId,`${label}.evidenceId`);let kind=validateStatus(value.kind,`${label}.kind`,EVIDENCE_KINDS_V1);assertNonEmptyString(value.operationId,`${label}.operationId`);let artifactRef=value.artifactRef===void 0?void 0:validateArtifactRefV1(value.artifactRef,`${label}.artifactRef`);assertOptionalString(value.summary,`${label}.summary`);let observedAt=validateIsoLike(value.observedAt,`${label}.observedAt`);return detachedFreeze({version:1,evidenceId:value.evidenceId,kind,operationId:value.operationId,...artifactRef===void 0?{}:{artifactRef},...value.summary===void 0?{}:{summary:value.summary},...observedAt===void 0?{}:{observedAt}})}function buildEvidenceRefV1(input){return validateEvidenceRefV1(input)}function validateVerificationV1(value,label="Verification"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","status","checks"],[],label),value.version!==1)throw new Error(`${label}.version must be 1`);let status2=validateStatus(value.status,`${label}.status`,["passed","failed","unknown"]);if(!Array.isArray(value.checks)||value.checks.some(item=>typeof item!="string"||item.trim()===""))throw new Error(`${label}.checks must contain non-empty strings`);if(new Set(value.checks).size!==value.checks.length)throw new Error(`${label}.checks must not contain duplicates`);return detachedFreeze({version:1,status:status2,checks:[...value.checks].sort()})}function buildVerificationV1(input){return validateVerificationV1(input)}function validatePluginErrorV1(value,label="Plugin error"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","code","message"],["causeCode","diagnosticRef"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.code,`${label}.code`),assertNonEmptyString(value.message,`${label}.message`),assertOptionalString(value.causeCode,`${label}.causeCode`);let diagnosticRef=value.diagnosticRef===void 0?void 0:validateArtifactRefV1(value.diagnosticRef,`${label}.diagnosticRef`);return detachedFreeze({version:1,code:value.code,message:value.message,...value.causeCode===void 0?{}:{causeCode:value.causeCode},...diagnosticRef===void 0?{}:{diagnosticRef}})}function buildPluginErrorV1(input){return validatePluginErrorV1(input)}function validatePluginResultV1(value,label="Plugin result"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","operationId","status","summary","artifacts","evidence"],["verification","error"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.operationId,`${label}.operationId`);let status2=validateStatus(value.status,`${label}.status`,RESULT_STATUSES_V1);assertNonEmptyString(value.summary,`${label}.summary`);let artifacts=validateArtifactArray(value.artifacts,`${label}.artifacts`);if(!Array.isArray(value.evidence))throw new Error(`${label}.evidence must be an array`);let evidence=value.evidence.map((item,index3)=>validateEvidenceRefV1(item,`${label}.evidence[${index3}]`));if(new Set(evidence.map(item=>item.evidenceId)).size!==evidence.length)throw new Error(`${label}.evidence must not contain duplicate evidenceId values`);let orderedEvidence=Object.freeze(sortByKey(evidence,item=>item.evidenceId)),verification=value.verification===void 0?void 0:validateVerificationV1(value.verification,`${label}.verification`),error2=value.error===void 0?void 0:validatePluginErrorV1(value.error,`${label}.error`);if(status2!=="succeeded"&&error2===void 0)throw new Error(`${label}.error is required for status ${status2}`);if(status2==="succeeded"&&error2!==void 0)throw new Error(`${label}.succeeded must not include error`);if(status2==="succeeded"&&verification?.status==="failed")throw new Error(`${label}.succeeded cannot have failed verification`);return detachedFreeze({version:1,operationId:value.operationId,status:status2,summary:value.summary,artifacts,evidence:orderedEvidence,...verification===void 0?{}:{verification},...error2===void 0?{}:{error:error2}})}function buildPluginResultV1(input){return validatePluginResultV1(input)}function assertJsonResultInputV1(value,label="Result input"){return assertJsonValue(value,label),detachedFreeze(value)}var DIFF_MAX_ITEMS_V1=64,DIFF_MAX_STRING_CHARS_V1=2048,DIFF_MAX_RESULT_BYTES_V1=64*1024;function validateBoundedString2(value,label){if(assertNonEmptyString(value,label),value.length>DIFF_MAX_STRING_CHARS_V1)throw new Error(`${label} exceeds the context budget`)}var DIFF_KINDS_V1=["text","dom","structure","pixel","style"],RESULT_STATUSES_V12=["succeeded","failed","cancelled","needs_user","unsupported"];function validateKind(value,label){if(typeof value!="string"||!DIFF_KINDS_V1.includes(value))throw new Error(`${label} is invalid`);return value}function validateStatus2(value,label){if(typeof value!="string"||!RESULT_STATUSES_V12.includes(value))throw new Error(`${label} is invalid`);return value}function validateMetrics(value,label){if(assertPlainRecord(value,label),assertExactKeys(value,[],["changedPixels","changedRatio","selector"],label),value.changedPixels!==void 0&&(typeof value.changedPixels!="number"||!Number.isSafeInteger(value.changedPixels)||value.changedPixels<0))throw new Error(`${label}.changedPixels must be a non-negative safe integer`);if(value.changedRatio!==void 0&&(assertNonNegativeNumber(value.changedRatio,`${label}.changedRatio`),value.changedRatio>1))throw new Error(`${label}.changedRatio must be at most 1`);return value.selector!==void 0&&validateBoundedString2(value.selector,`${label}.selector`),detachedFreeze({...value.changedPixels===void 0?{}:{changedPixels:value.changedPixels},...value.changedRatio===void 0?{}:{changedRatio:value.changedRatio},...value.selector===void 0?{}:{selector:value.selector}})}function validateThreshold(value,label){if(assertPlainRecord(value,label),assertExactKeys(value,[],["maxChangedPixels","maxChangedRatio","allowedSelectors"],label),value.maxChangedPixels!==void 0&&(typeof value.maxChangedPixels!="number"||!Number.isSafeInteger(value.maxChangedPixels)||value.maxChangedPixels<0))throw new Error(`${label}.maxChangedPixels must be a non-negative safe integer`);if(value.maxChangedRatio!==void 0&&(assertNonNegativeNumber(value.maxChangedRatio,`${label}.maxChangedRatio`),value.maxChangedRatio>1))throw new Error(`${label}.maxChangedRatio must be at most 1`);if(value.allowedSelectors!==void 0){if(!Array.isArray(value.allowedSelectors)||value.allowedSelectors.some(item=>typeof item!="string"||item.trim()===""))throw new Error(`${label}.allowedSelectors must contain non-empty strings`);if(new Set(value.allowedSelectors).size!==value.allowedSelectors.length)throw new Error(`${label}.allowedSelectors must not contain duplicates`);if(value.allowedSelectors.length>DIFF_MAX_ITEMS_V1)throw new Error(`${label}.allowedSelectors must contain at most ${DIFF_MAX_ITEMS_V1} items`);for(let[index3,selector]of value.allowedSelectors.entries())validateBoundedString2(selector,`${label}.allowedSelectors[${index3}]`)}return detachedFreeze({...value.maxChangedPixels===void 0?{}:{maxChangedPixels:value.maxChangedPixels},...value.maxChangedRatio===void 0?{}:{maxChangedRatio:value.maxChangedRatio},...value.allowedSelectors===void 0?{}:{allowedSelectors:[...value.allowedSelectors].sort()}})}function validateDiffRequestV1(value,label="Diff request"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","operationId","kind","before","after"],["threshold"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.operationId,`${label}.operationId`);let kind=validateKind(value.kind,`${label}.kind`),before=validateArtifactRefV1(value.before,`${label}.before`),after=validateArtifactRefV1(value.after,`${label}.after`);if(before.artifactRef===after.artifactRef)throw new Error(`${label}.before and after must differ`);let threshold=value.threshold===void 0?void 0:validateThreshold(value.threshold,`${label}.threshold`);return detachedFreeze({version:1,operationId:value.operationId,kind,before,after,...threshold===void 0?{}:{threshold}})}function buildDiffRequestV1(input){return validateDiffRequestV1(input)}function validateDiffResultV1(value,label="Diff result"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","operationId","status","kind","summary","evidence"],["diffArtifact","metrics","verification","error"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.operationId,`${label}.operationId`);let resultStatus=validateStatus2(value.status,`${label}.status`),kind=validateKind(value.kind,`${label}.kind`);validateBoundedString2(value.summary,`${label}.summary`);let metrics=value.metrics===void 0?void 0:validateMetrics(value.metrics,`${label}.metrics`),diffArtifact=value.diffArtifact===void 0?void 0:validateArtifactRefV1(value.diffArtifact,`${label}.diffArtifact`);if(!Array.isArray(value.evidence))throw new Error(`${label}.evidence must be an array`);if(value.evidence.length>DIFF_MAX_ITEMS_V1)throw new Error(`${label}.evidence must contain at most ${DIFF_MAX_ITEMS_V1} items`);let evidence=value.evidence.map((item,index3)=>validateEvidenceRefV1(item,`${label}.evidence[${index3}]`));if(new Set(evidence.map(item=>item.evidenceId)).size!==evidence.length)throw new Error(`${label}.evidence must not contain duplicate evidenceId values`);for(let[index3,item]of evidence.entries())validateBoundedString2(item.evidenceId,`${label}.evidence[${index3}].evidenceId`),item.summary!==void 0&&validateBoundedString2(item.summary,`${label}.evidence[${index3}].summary`),item.observedAt!==void 0&&validateBoundedString2(item.observedAt,`${label}.evidence[${index3}].observedAt`);let orderedEvidence=Object.freeze([...evidence].sort((a,b2)=>a.evidenceId.localeCompare(b2.evidenceId))),verification=value.verification===void 0?void 0:validateVerificationV1(value.verification,`${label}.verification`),error2=value.error===void 0?void 0:validatePluginErrorV1(value.error,`${label}.error`);if(resultStatus!=="succeeded"&&error2===void 0)throw new Error(`${label}.error is required for status ${resultStatus}`);if(resultStatus==="succeeded"&&error2!==void 0)throw new Error(`${label}.succeeded must not include error`);if(resultStatus==="succeeded"&&verification?.status==="failed")throw new Error(`${label}.succeeded cannot have failed verification`);let result={version:1,operationId:value.operationId,status:resultStatus,kind,summary:value.summary,...metrics===void 0?{}:{metrics},...diffArtifact===void 0?{}:{diffArtifact},evidence:orderedEvidence,...verification===void 0?{}:{verification},...error2===void 0?{}:{error:error2}};if(new TextEncoder().encode(JSON.stringify(result)).byteLength>DIFF_MAX_RESULT_BYTES_V1)throw new Error(`${label} exceeds the context budget`);return detachedFreeze(result)}function buildDiffResultV1(input){return validateDiffResultV1(input)}var TRACE_KINDS_V1=["session.start","turn.span","llm.request","llm.response","tool.span","lifecycle","error","decision","plugin.log"];var SURFACES_V1=["html","browser","docx","xlsx","pdf","pptx","image"],STATUSES_V1=["succeeded","failed","cancelled","needs_user","unsupported"];function status(value,label){if(typeof value!="string"||!STATUSES_V1.includes(value))throw new Error(`${label} is invalid`);return value}function artifactArray(value,label){if(!Array.isArray(value))throw new Error(`${label} must be an array`);let items=value.map((item,index3)=>validateArtifactRefV1(item,`${label}[${index3}]`));if(new Set(items.map(item=>item.artifactRef)).size!==items.length)throw new Error(`${label} must not contain duplicate artifactRef values`);return Object.freeze([...items].sort((a,b2)=>a.artifactRef.localeCompare(b2.artifactRef)))}function evidenceArray(value,label){if(!Array.isArray(value))throw new Error(`${label} must be an array`);let items=value.map((item,index3)=>validateEvidenceRefV1(item,`${label}[${index3}]`));if(new Set(items.map(item=>item.evidenceId)).size!==items.length)throw new Error(`${label} must not contain duplicate evidenceId values`);return Object.freeze([...items].sort((a,b2)=>a.evidenceId.localeCompare(b2.evidenceId)))}function validateViewport(value,label){if(assertPlainRecord(value,label),assertExactKeys(value,["width","height"],["deviceScaleFactor"],label),assertNonNegativeNumber(value.width,`${label}.width`),assertNonNegativeNumber(value.height,`${label}.height`),value.width===0||value.height===0)throw new Error(`${label} dimensions must be greater than zero`);if(value.deviceScaleFactor!==void 0&&(assertFiniteNumber(value.deviceScaleFactor,`${label}.deviceScaleFactor`),value.deviceScaleFactor<=0))throw new Error(`${label}.deviceScaleFactor must be greater than zero`);return detachedFreeze({width:value.width,height:value.height,...value.deviceScaleFactor===void 0?{}:{deviceScaleFactor:value.deviceScaleFactor}})}function validateRenderRequestV1(value,label="Render request"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","operationId","source","surface"],["page","viewport","options"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.operationId,`${label}.operationId`);let source=validateArtifactRefV1(value.source,`${label}.source`);if(typeof value.surface!="string"||!SURFACES_V1.includes(value.surface))throw new Error(`${label}.surface is invalid`);let surface=value.surface;value.page!==void 0&&assertNonNegativeSafeInteger(value.page,`${label}.page`);let viewport=value.viewport===void 0?void 0:validateViewport(value.viewport,`${label}.viewport`);return value.options!==void 0&&assertJsonValue(value.options,`${label}.options`),detachedFreeze({version:1,operationId:value.operationId,source,surface,...value.page===void 0?{}:{page:value.page},...viewport===void 0?{}:{viewport},...value.options===void 0?{}:{options:value.options}})}function buildRenderRequestV1(input){return validateRenderRequestV1(input)}function validateRenderResultV1(value,label="Render result"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","operationId","status","renderer","artifacts","evidence","summary"],["verification","error"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.operationId,`${label}.operationId`);let resultStatus=status(value.status,`${label}.status`);assertPlainRecord(value.renderer,`${label}.renderer`),assertExactKeys(value.renderer,["id","version"],[],`${label}.renderer`),assertNonEmptyString(value.renderer.id,`${label}.renderer.id`),assertNonEmptyString(value.renderer.version,`${label}.renderer.version`);let artifacts=artifactArray(value.artifacts,`${label}.artifacts`),evidence=evidenceArray(value.evidence,`${label}.evidence`);assertNonEmptyString(value.summary,`${label}.summary`);let verification=value.verification===void 0?void 0:validateVerificationV1(value.verification,`${label}.verification`),error2=value.error===void 0?void 0:validatePluginErrorV1(value.error,`${label}.error`);if(resultStatus!=="succeeded"&&error2===void 0)throw new Error(`${label}.error is required for status ${resultStatus}`);if(resultStatus==="succeeded"&&error2!==void 0)throw new Error(`${label}.succeeded must not include error`);if(resultStatus==="succeeded"&&verification?.status==="failed")throw new Error(`${label}.succeeded cannot have failed verification`);return detachedFreeze({version:1,operationId:value.operationId,status:resultStatus,renderer:{id:value.renderer.id,version:value.renderer.version},artifacts,evidence,summary:value.summary,...verification===void 0?{}:{verification},...error2===void 0?{}:{error:error2}})}function buildRenderResultV1(input){return validateRenderResultV1(input)}var wrapAnsi16=(offset=0)=>code=>`\x1B[${code+offset}m`,wrapAnsi256=(offset=0)=>code=>`\x1B[${38+offset};5;${code}m`,wrapAnsi16m=(offset=0)=>(red,green,blue)=>`\x1B[${38+offset};2;${red};${green};${blue}m`,styles={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},modifierNames=Object.keys(styles.modifier),foregroundColorNames=Object.keys(styles.color),backgroundColorNames=Object.keys(styles.bgColor),colorNames=[...foregroundColorNames,...backgroundColorNames];function assembleStyles(){let codes=new Map;for(let[groupName,group]of Object.entries(styles)){for(let[styleName,style]of Object.entries(group))styles[styleName]={open:`\x1B[${style[0]}m`,close:`\x1B[${style[1]}m`},group[styleName]=styles[styleName],codes.set(style[0],style[1]);Object.defineProperty(styles,groupName,{value:group,enumerable:!1})}return Object.defineProperty(styles,"codes",{value:codes,enumerable:!1}),styles.color.close="\x1B[39m",styles.bgColor.close="\x1B[49m",styles.color.ansi=wrapAnsi16(),styles.color.ansi256=wrapAnsi256(),styles.color.ansi16m=wrapAnsi16m(),styles.bgColor.ansi=wrapAnsi16(10),styles.bgColor.ansi256=wrapAnsi256(10),styles.bgColor.ansi16m=wrapAnsi16m(10),Object.defineProperties(styles,{rgbToAnsi256:{value(red,green,blue){return red===green&&green===blue?red<8?16:red>248?231:Math.round((red-8)/247*24)+232:16+36*Math.round(red/255*5)+6*Math.round(green/255*5)+Math.round(blue/255*5)},enumerable:!1},hexToRgb:{value(hex){let matches=/[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));if(!matches)return[0,0,0];let[colorString]=matches;colorString.length===3&&(colorString=[...colorString].map(character=>character+character).join(""));let integer=Number.parseInt(colorString,16);return[integer>>16&255,integer>>8&255,integer&255]},enumerable:!1},hexToAnsi256:{value:hex=>styles.rgbToAnsi256(...styles.hexToRgb(hex)),enumerable:!1},ansi256ToAnsi:{value(code){if(code<8)return 30+code;if(code<16)return 90+(code-8);let red,green,blue;if(code>=232)red=((code-232)*10+8)/255,green=red,blue=red;else{code-=16;let remainder=code%36;red=Math.floor(code/36)/5,green=Math.floor(remainder/6)/5,blue=remainder%6/5}let value=Math.max(red,green,blue)*2;if(value===0)return 30;let result=30+(Math.round(blue)<<2|Math.round(green)<<1|Math.round(red));return value===2&&(result+=60),result},enumerable:!1},rgbToAnsi:{value:(red,green,blue)=>styles.ansi256ToAnsi(styles.rgbToAnsi256(red,green,blue)),enumerable:!1},hexToAnsi:{value:hex=>styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),enumerable:!1}}),styles}var ansiStyles=assembleStyles(),ansi_styles_default=ansiStyles;import process2 from"node:process";import os from"node:os";import tty from"node:tty";function hasFlag(flag,argv=globalThis.Deno?globalThis.Deno.args:process2.argv){let prefix=flag.startsWith("-")?"":flag.length===1?"-":"--",position=argv.indexOf(prefix+flag),terminatorPosition=argv.indexOf("--");return position!==-1&&(terminatorPosition===-1||position<terminatorPosition)}var{env}=process2,flagForceColor;hasFlag("no-color")||hasFlag("no-colors")||hasFlag("color=false")||hasFlag("color=never")?flagForceColor=0:(hasFlag("color")||hasFlag("colors")||hasFlag("color=true")||hasFlag("color=always"))&&(flagForceColor=1);function envForceColor(){if("FORCE_COLOR"in env)return env.FORCE_COLOR==="true"?1:env.FORCE_COLOR==="false"?0:env.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(env.FORCE_COLOR,10),3)}function translateLevel(level){return level===0?!1:{level,hasBasic:!0,has256:level>=2,has16m:level>=3}}function _supportsColor(haveStream,{streamIsTTY,sniffFlags=!0}={}){let noFlagForceColor=envForceColor();noFlagForceColor!==void 0&&(flagForceColor=noFlagForceColor);let forceColor=sniffFlags?flagForceColor:noFlagForceColor;if(forceColor===0)return 0;if(sniffFlags){if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor"))return 3;if(hasFlag("color=256"))return 2}if("TF_BUILD"in env&&"AGENT_NAME"in env)return 1;if(haveStream&&!streamIsTTY&&forceColor===void 0)return 0;let min=forceColor||0;if(env.TERM==="dumb")return min;if(process2.platform==="win32"){let osRelease=os.release().split(".");return Number(osRelease[0])>=10&&Number(osRelease[2])>=10586?Number(osRelease[2])>=14931?3:2:1}if("CI"in env)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(key=>key in env)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(sign=>sign in env)||env.CI_NAME==="codeship"?1:min;if("TEAMCITY_VERSION"in env)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION)?1:0;if(env.COLORTERM==="truecolor"||env.TERM==="xterm-kitty"||env.TERM==="xterm-ghostty"||env.TERM==="wezterm")return 3;if("TERM_PROGRAM"in env){let version=Number.parseInt((env.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(env.TERM_PROGRAM){case"iTerm.app":return version>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(env.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)||"COLORTERM"in env?1:min}function createSupportsColor(stream,options={}){let level=_supportsColor(stream,{streamIsTTY:stream&&stream.isTTY,...options});return translateLevel(level)}var supportsColor={stdout:createSupportsColor({isTTY:tty.isatty(1)}),stderr:createSupportsColor({isTTY:tty.isatty(2)})},supports_color_default=supportsColor;function stringReplaceAll(string,substring,replacer){let index3=string.indexOf(substring);if(index3===-1)return string;let substringLength=substring.length,endIndex=0,returnValue="";do returnValue+=string.slice(endIndex,index3)+substring+replacer,endIndex=index3+substringLength,index3=string.indexOf(substring,endIndex);while(index3!==-1);return returnValue+=string.slice(endIndex),returnValue}function stringEncaseCRLFWithFirstIndex(string,prefix,postfix,index3){let endIndex=0,returnValue="";do{let gotCR=string[index3-1]==="\r";returnValue+=string.slice(endIndex,gotCR?index3-1:index3)+prefix+(gotCR?`\r
|
|
272
|
+
`,nl)+1}return{type,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(parent){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 prev=getPrevProps(parent),start=getFirstKeyStartProps(prev);return start.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let prev=getPrevProps(parent),start=getFirstKeyStartProps(prev);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(start,indent){return this.type!=="comment"||this.indent<=indent?!1:start.every(st2=>st2.type==="newline"||st2.type==="space")}*documentEnd(docEnd){this.type!=="doc-mode"&&(docEnd.end?docEnd.end.push(this.sourceToken):docEnd.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(token){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:token.end?token.end.push(this.sourceToken):token.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};exports.Parser=Parser2}});var require_public_api=__commonJS({"node_modules/yaml/dist/public-api.js"(exports){"use strict";var composer=require_composer(),Document=require_Document(),errors=require_errors2(),log=require_log(),identity=require_identity(),lineCounter=require_line_counter(),parser=require_parser();function parseOptions(options){let prettyErrors=options.prettyErrors!==!1;return{lineCounter:options.lineCounter||prettyErrors&&new lineCounter.LineCounter||null,prettyErrors}}function parseAllDocuments(source,options={}){let{lineCounter:lineCounter2,prettyErrors}=parseOptions(options),parser$1=new parser.Parser(lineCounter2?.addNewLine),composer$1=new composer.Composer(options),docs=Array.from(composer$1.compose(parser$1.parse(source)));if(prettyErrors&&lineCounter2)for(let doc of docs)doc.errors.forEach(errors.prettifyError(source,lineCounter2)),doc.warnings.forEach(errors.prettifyError(source,lineCounter2));return docs.length>0?docs:Object.assign([],{empty:!0},composer$1.streamInfo())}function parseDocument2(source,options={}){let{lineCounter:lineCounter2,prettyErrors}=parseOptions(options),parser$1=new parser.Parser(lineCounter2?.addNewLine),composer$1=new composer.Composer(options),doc=null;for(let _doc of composer$1.compose(parser$1.parse(source),!0,source.length))if(!doc)doc=_doc;else if(doc.options.logLevel!=="silent"){doc.errors.push(new errors.YAMLParseError(_doc.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return prettyErrors&&lineCounter2&&(doc.errors.forEach(errors.prettifyError(source,lineCounter2)),doc.warnings.forEach(errors.prettifyError(source,lineCounter2))),doc}function parse5(src,reviver,options){let _reviver;typeof reviver=="function"?_reviver=reviver:options===void 0&&reviver&&typeof reviver=="object"&&(options=reviver);let doc=parseDocument2(src,options);if(!doc)return null;if(doc.warnings.forEach(warning=>log.warn(doc.options.logLevel,warning)),doc.errors.length>0){if(doc.options.logLevel!=="silent")throw doc.errors[0];doc.errors=[]}return doc.toJS(Object.assign({reviver:_reviver},options))}function stringify(value,replacer,options){let _replacer=null;if(typeof replacer=="function"||Array.isArray(replacer)?_replacer=replacer:options===void 0&&replacer&&(options=replacer),typeof options=="string"&&(options=options.length),typeof options=="number"){let indent=Math.round(options);options=indent<1?void 0:indent>8?{indent:8}:{indent}}if(value===void 0){let{keepUndefined}=options??replacer??{};if(!keepUndefined)return}return identity.isDocument(value)&&!_replacer?value.toString(options):new Document.Document(value,_replacer,options).toString(options)}exports.parse=parse5;exports.parseAllDocuments=parseAllDocuments;exports.parseDocument=parseDocument2;exports.stringify=stringify}});var require_dist=__commonJS({"node_modules/yaml/dist/index.js"(exports){"use strict";var composer=require_composer(),Document=require_Document(),Schema=require_Schema(),errors=require_errors2(),Alias=require_Alias(),identity=require_identity(),Pair=require_Pair(),Scalar=require_Scalar(),YAMLMap=require_YAMLMap(),YAMLSeq=require_YAMLSeq(),cst=require_cst(),lexer=require_lexer(),lineCounter=require_line_counter(),parser=require_parser(),publicApi=require_public_api(),visit=require_visit();exports.Composer=composer.Composer;exports.Document=Document.Document;exports.Schema=Schema.Schema;exports.YAMLError=errors.YAMLError;exports.YAMLParseError=errors.YAMLParseError;exports.YAMLWarning=errors.YAMLWarning;exports.Alias=Alias.Alias;exports.isAlias=identity.isAlias;exports.isCollection=identity.isCollection;exports.isDocument=identity.isDocument;exports.isMap=identity.isMap;exports.isNode=identity.isNode;exports.isPair=identity.isPair;exports.isScalar=identity.isScalar;exports.isSeq=identity.isSeq;exports.Pair=Pair.Pair;exports.Scalar=Scalar.Scalar;exports.YAMLMap=YAMLMap.YAMLMap;exports.YAMLSeq=YAMLSeq.YAMLSeq;exports.CST=cst;exports.Lexer=lexer.Lexer;exports.LineCounter=lineCounter.LineCounter;exports.Parser=parser.Parser;exports.parse=publicApi.parse;exports.parseAllDocuments=publicApi.parseAllDocuments;exports.parseDocument=publicApi.parseDocument;exports.stringify=publicApi.stringify;exports.visit=visit.visit;exports.visitAsync=visit.visitAsync}});var require_ignore=__commonJS({"node_modules/ignore/index.js"(exports,module){function makeArray(subject){return Array.isArray(subject)?subject:[subject]}var UNDEFINED=void 0,EMPTY="",SPACE=" ",ESCAPE="\\",REGEX_LITERAL_SPECIAL=/[.*+?()[\]{}^$|\\/]/,REGEX_TEST_BLANK_LINE=/^ +$/,REGEX_INVALID_TRAILING_BACKSLASH=/(?:[^\\]|^)\\$/,REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION=/^\\!/,REGEX_REPLACE_LEADING_EXCAPED_HASH=/^\\#/,REGEX_SPLITALL_CRLF=/\r?\n/g,DOUBLE_SLASH="//",SLASH_CODE=47,DOT_CODE=46,SLASH="/",TMP_KEY_IGNORE="node-ignore";typeof Symbol<"u"&&(TMP_KEY_IGNORE=Symbol.for("node-ignore"));var KEY_IGNORE=TMP_KEY_IGNORE,define=(object,key,value)=>(Object.defineProperty(object,key,{value}),value),RETURN_FALSE=()=>!1,cleanRangeBackSlash=slashes=>{let{length}=slashes;return slashes.slice(0,length-length%2)},POSIX_CLASSES={alnum:"0-9A-Za-z",alpha:"A-Za-z",blank:" \\t",cntrl:"\\x00-\\x1f\\x7f",digit:"0-9",graph:"!-.0-~",lower:"a-z",print:" -.0-~",punct:"!-.:-@\\[-`{-~",space:" \\t\\n\\r",upper:"A-Z",xdigit:"0-9A-Fa-f"},CLASS_MEMBERS_TO_ESCAPE="\\]^-[",escapeMember=char=>CLASS_MEMBERS_TO_ESCAPE.indexOf(char)<0?char:ESCAPE+char,NON_SLASH="(?!\\/)",classSource=(negated,body)=>{if(negated)return`[^\\/${body}]`;let source=`[${body}]`;return new RegExp(source).test("/")?NON_SLASH+source:source},scanBracket=(pattern,start)=>{let{length}=pattern,index3=start+1,negated=EMPTY,lead=pattern[index3];(lead==="!"||lead==="^")&&(negated="^",index3++);let body=EMPTY,prev=EMPTY;for(;;){let char=pattern[index3];if(char===UNDEFINED)return null;if(char===ESCAPE){let escaped=pattern[index3+1];if(escaped===UNDEFINED)return null;body+=escapeMember(escaped),prev=escaped,index3++}else if(char==="-"&&prev&&index3+1<length&&pattern[index3+1]!=="]"){index3++;let to=pattern[index3];to===ESCAPE&&(to=pattern[index3+=1]),prev<=to&&(body+=`-${escapeMember(to)}`),prev=EMPTY}else if(char==="["&&pattern[index3+1]===":"){let nameStart=index3+2,end=nameStart;for(;end<length&&pattern[end]!=="]";)end++;if(end===length)return null;if(end>nameStart&&pattern[end-1]===":"){let expanded=POSIX_CLASSES[pattern.slice(nameStart,end-1)];if(expanded===UNDEFINED)return null;body+=expanded,prev=EMPTY,index3=end}else body+=escapeMember("["),prev="[",index3=nameStart-2}else body+=escapeMember(char),prev=char;if(index3++,pattern[index3]==="]")return{end:index3,source:classSource(negated,body)}}},NEVER_MATCH="[]",PLACEHOLDER="\0",REGEX_RESTORE_PLACEHOLDER=new RegExp(`${PLACEHOLDER}(\\d+)${PLACEHOLDER}`,"g"),TRAILING_WILDCARD="\uE000",extractBrackets=pattern=>{let sources=[],hold=source=>`${PLACEHOLDER}${sources.push(source)-1}${PLACEHOLDER}`,{length}=pattern,out=EMPTY,index3=0;for(;index3<length;){let char=pattern[index3];if(char===ESCAPE){let escaped=pattern[index3+1];escaped==="*"||escaped==="["||escaped===SPACE||escaped===ESCAPE?out+=pattern.slice(index3,index3+2):out+=hold(REGEX_LITERAL_SPECIAL.test(escaped)?ESCAPE+escaped:escaped),index3+=2}else if(char===PLACEHOLDER)out+=hold(`[${PLACEHOLDER}]`),index3++;else if(char==="["){let scanned=scanBracket(pattern,index3);scanned===null?(out+=hold(NEVER_MATCH),index3=length):(out+=hold(scanned.source),index3=scanned.end+1)}else out+=char,index3++}return{source:out,sources}},DIRECT=null,REGEX_INNER_SLASH=/\/(?!$)/,REPLACERS=[[/^\uFEFF/,()=>EMPTY,"\uFEFF"],[/[\r\n]+$/,()=>EMPTY],[/((?:\\\\)*?)(\\? +)$/,(_2,m1,m2)=>m1+(m2.indexOf("\\")===0?SPACE:EMPTY)],[/(\\+?) /g,(_2,m1)=>{let{length}=m1;return m1.slice(0,length-length%2)+SPACE}],[/[\\$.|*+(){^]/g,match2=>`\\${match2}`],[/(?!\\)\?/g,()=>"[^/]","?"],[/^\//,()=>"^",SLASH],[/\//g,()=>"\\/",SLASH],[/^\^*(?:\\\*\\\*\\\/)+/,()=>"^(?:.*\\/)?","*"],[DIRECT,(source,pattern)=>!source||source[0]==="^"?source:(REGEX_INNER_SLASH.test(pattern)?"^":"(?:^|\\/)")+source],[/\\\/\\\*\\\*(?=\\\/|$)/g,(_2,index3,str2)=>index3+6<str2.length?str2.slice(index3+6)==="\\/"?"(?:\\/[^\\/]+)+":"(?:\\/[^\\/]+)*":"\\/.+","*"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(_2,p1,p2)=>{let unescaped=p2.replace(/\\\*/g,"[^\\/]*");return p1+unescaped},"*"],[/(^|[^\\])((?:\\\\)*)\\\*$/,(match2,p1,p2)=>p2.length/2%2===0?p1+p2+TRAILING_WILDCARD:match2,"*"],[/\\\\\\(?=[$.|*+(){^])/g,()=>ESCAPE,ESCAPE+ESCAPE],[/\\\\/g,()=>ESCAPE,ESCAPE+ESCAPE],[/\\\[([^\]/]*?)(\\*)($|\])/g,(match2,range2,endEscape,close)=>`\\[${range2}${cleanRangeBackSlash(endEscape)}${close}`,"["],[DIRECT,source=>{let last=source[source.length-1];return!last||last===TRAILING_WILDCARD?source:last===SLASH?`${source}$`:`${source}(?=$|\\/$)`}]],REGEX_REPLACE_TRAILING_WILDCARD=/(^|\\\/)?\uE000$/,MODE_IGNORE="regex",MODE_CHECK_IGNORE="checkRegex",UNDERSCORE="_",TRAILING_WILD_CARD_REPLACERS={[MODE_IGNORE](_2,p1){return`${p1?`${p1}[^/]+`:"[^/]*"}(?=$|\\/$)`},[MODE_CHECK_IGNORE](_2,p1){return`${p1?`${p1}[^/]*`:"[^/]*"}(?=$|\\/$)`}},WILDCARD="[^\\/]*",pinWildcards=source=>{if(source.indexOf(WILDCARD)<0)return source;let tokens=[],{length}=source,index3=0;for(;index3<length;){let char=source[index3];if(source.startsWith(WILDCARD,index3))tokens.push({wildcard:!0}),index3+=WILDCARD.length;else if(char==="["){let end=index3+1;for(source[end]==="^"&&end++,source[end]==="]"&&end++;end<length&&source[end]!=="]";)end+=source[end]===ESCAPE?2:1;end++,tokens.push({single:source.slice(index3,end)}),index3=end}else if(char===ESCAPE)tokens.push({single:source.slice(index3,index3+2)}),index3+=2;else if(char==="("){let depth=0,end=index3;do source[end]===ESCAPE?end++:source[end]==="("?depth++:source[end]===")"&&depth--,end++;while(end<length&&depth>0);"*+?".indexOf(source[end])>=0&&end++,tokens.push({boundary:source.slice(index3,end)}),index3=end}else char==="^"||char==="$"?(tokens.push({boundary:char}),index3++):(tokens.push({single:char}),index3++)}let out=EMPTY,run=[],flush=()=>{let lastWildcard;run.forEach((token,at)=>{token.wildcard&&(lastWildcard=at)}),run.forEach((token,at)=>{if(!token.wildcard){out+=token.single;return}out+=at===lastWildcard?WILDCARD:`(?:(?!${run[at+1].single})[^\\/])*`}),run=[]};return tokens.forEach(token=>{if(token.boundary===void 0){run.push(token);return}flush(),out+=token.boundary}),flush(),out},makeRegexPrefix=pattern=>{let{source,sources}=extractBrackets(pattern),replaced=REPLACERS.reduce((prev,[matcher,replacer,required])=>matcher===DIRECT?replacer(prev,pattern):required!==UNDEFINED&&prev.indexOf(required)<0?prev:matcher.test(prev)?prev.replace(matcher,replacer.bind(pattern)):prev,source);return sources.length?replaced.replace(REGEX_RESTORE_PLACEHOLDER,(match2,index3)=>sources[index3]):replaced},matchesBasename=body=>{let index3=body.indexOf(SLASH);return index3<0||index3===body.length-1},basenameOf=path15=>{let end=path15.length-1,index3=path15.lastIndexOf(SLASH,path15[end]===SLASH?end-1:end);return index3<0?path15:path15.slice(index3+1)},parentOf=path15=>{if(path15.charCodeAt(0)===SLASH_CODE||path15.indexOf(DOUBLE_SLASH)>=0){let slices=path15.split(SLASH).filter(Boolean);return slices.pop(),slices.length?slices.join(SLASH)+SLASH:EMPTY}let end=path15.length-1,cut=path15.lastIndexOf(SLASH,path15.charCodeAt(end)===SLASH_CODE?end-1:end);return cut<0?EMPTY:path15.slice(0,cut+1)},isString2=subject=>typeof subject=="string",checkPattern=pattern=>pattern&&isString2(pattern)&&!REGEX_TEST_BLANK_LINE.test(pattern)&&!REGEX_INVALID_TRAILING_BACKSLASH.test(pattern)&&pattern.indexOf("#")!==0,splitPattern=pattern=>pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean),IgnoreRule=class{constructor(pattern,mark,body,ignoreCase,negative,prefix){this.pattern=pattern,this.mark=mark,this.negative=negative,define(this,"body",body),define(this,"ignoreCase",ignoreCase),define(this,"regexPrefix",prefix)}get _basenameOnly(){return define(this,"_basenameOnly",matchesBasename(this.body))}get regex(){let key=UNDERSCORE+MODE_IGNORE;return this[key]?this[key]:this._make(MODE_IGNORE,key)}get checkRegex(){let key=UNDERSCORE+MODE_CHECK_IGNORE;return this[key]?this[key]:this._make(MODE_CHECK_IGNORE,key)}_make(mode,key){let str2=pinWildcards(this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD,TRAILING_WILD_CARD_REPLACERS[mode])),regex2=this.ignoreCase?new RegExp(str2,"i"):new RegExp(str2);return define(this,key,regex2)}},createRule=({pattern,mark},ignoreCase)=>{let negative=!1,body=pattern;body.indexOf("!")===0&&(negative=!0,body=body.substr(1)),body=body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION,"!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH,"#");let regexPrefix=makeRegexPrefix(body);return new IgnoreRule(pattern,mark,body,ignoreCase,negative,regexPrefix)},RuleManager=class{constructor(ignoreCase){this._ignoreCase=ignoreCase,this._rules=[],this._basenameCount=0}_add(pattern){if(pattern&&pattern[KEY_IGNORE]){this._rules=this._rules.concat(pattern._rules._rules),this._basenameCount+=pattern._rules._basenameCount,this._added=!0;return}if(isString2(pattern)&&(pattern={pattern}),checkPattern(pattern.pattern)){let rule=createRule(pattern,this._ignoreCase);this._added=!0,this._rules.push(rule),matchesBasename(rule.body)&&this._basenameCount++}}add(pattern){return this._added=!1,makeArray(isString2(pattern)?splitPattern(pattern):pattern).forEach(this._add,this),this._added}test(path15,checkUnignored,mode){let ignored=!1,unignored=!1,matchedRule,rules=this._rules,{length}=rules,shortcut=this._basenameCount*2>=length,basename18=shortcut?basenameOf(path15):path15;for(let index3=0;index3<length;index3++){let rule=rules[index3],{negative}=rule;!(unignored===negative&&ignored!==unignored||negative&&!ignored&&!unignored&&!checkUnignored)&&rule[mode].test(shortcut&&rule._basenameOnly?basename18:path15)&&(ignored=!negative,unignored=negative,matchedRule=negative?UNDEFINED:rule)}let ret={ignored,unignored};return matchedRule&&(ret.rule=matchedRule),ret}},throwError=(message,Ctor)=>{throw new Ctor(message)},checkPath=(path15,originalPath,doThrow)=>isString2(path15)?path15?checkPath.isNotRelative(path15)?doThrow(`path should be a \`path.relative()\`d string, but got "${originalPath}"`,RangeError):!0:doThrow("path must not be empty",TypeError):doThrow(`path must be a string, but got \`${originalPath}\``,TypeError),isNotRelative=path15=>{let first=path15.charCodeAt(0);if(first===SLASH_CODE)return!0;if(first!==DOT_CODE)return!1;if(path15.length===1)return!0;let second=path15.charCodeAt(1);return second===SLASH_CODE?!0:second!==DOT_CODE?!1:path15.length===2||path15.charCodeAt(2)===SLASH_CODE};checkPath.isNotRelative=isNotRelative;checkPath.convert=p=>p;var Ignore=class{constructor({ignorecase=!0,ignoreCase=ignorecase,allowRelativePaths=!1}={}){define(this,KEY_IGNORE,!0),this._rules=new RuleManager(ignoreCase),this._strictPathCheck=!allowRelativePaths,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(pattern){return this._rules.add(pattern)&&this._initCache(),this}addPattern(pattern){return this.add(pattern)}_test(originalPath,cache,checkUnignored){let path15=originalPath&&checkPath.convert(originalPath);return checkPath(path15,originalPath,this._strictPathCheck?throwError:RETURN_FALSE),this._t(path15,cache,checkUnignored)}checkIgnore(path15){if(path15.charCodeAt(path15.length-1)!==SLASH_CODE)return this.test(path15);let parentPath=parentOf(path15);if(parentPath){let parent=this._t(parentPath,this._testCache,!0);if(parent.ignored)return parent}return this._rules.test(path15,!1,MODE_CHECK_IGNORE)}_t(path15,cache,checkUnignored){if(path15 in cache)return cache[path15];let parentPath=parentOf(path15),parent=parentPath?this._t(parentPath,cache,checkUnignored):UNDEFINED;return cache[path15]=parent&&parent.ignored?parent:this._rules.test(path15,checkUnignored,MODE_IGNORE)}ignores(path15){return this._test(path15,this._ignoreCache,!1).ignored}createFilter(){return path15=>!this.ignores(path15)}filter(paths){return makeArray(paths).filter(this.createFilter())}test(path15){return this._test(path15,this._testCache,!0)}},factory=options=>new Ignore(options),isPathValid=path15=>checkPath(path15&&checkPath.convert(path15),path15,RETURN_FALSE),setupWindows=()=>{let makePosix=str2=>/^\\\\\?\\/.test(str2)||/["<>|\u0000-\u001F]+/u.test(str2)?str2:str2.replace(/\\/g,"/");checkPath.convert=makePosix;let REGEX_TEST_WINDOWS_PATH_ABSOLUTE=/^[a-z]:\//i;checkPath.isNotRelative=path15=>REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path15)||isNotRelative(path15)};typeof process<"u"&&process.platform==="win32"&&setupWindows();module.exports=factory;factory.default=factory;module.exports.isPathValid=isPathValid;define(module.exports,Symbol.for("setupWindows"),setupWindows)}});var require_index_min=__commonJS({"node_modules/lru-cache/dist/commonjs/node/index.min.js"(exports){"use strict";var M2=(c2,t)=>()=>(t||c2((t={exports:{}}).exports,t),t.exports),U3=M2(O2=>{"use strict";Object.defineProperty(O2,"__esModule",{value:!0}),O2.tracing=O2.metrics=void 0;var j2=__require("node:diagnostics_channel");O2.metrics=(0,j2.channel)("lru-cache:metrics"),O2.tracing=(0,j2.tracingChannel)("lru-cache")}),I2=M2(R2=>{"use strict";Object.defineProperty(R2,"__esModule",{value:!0}),R2.defaultPerf=void 0,R2.defaultPerf=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date});Object.defineProperty(exports,"__esModule",{value:!0});exports.LRUCache=void 0;var d2=U3(),N2=I2(),C=()=>d2.metrics.hasSubscribers||d2.tracing.hasSubscribers,G=new Set,P2=typeof process=="object"&&process?process:{},V2=(c2,t,e,i)=>{typeof P2.emitWarning=="function"?P2.emitWarning(c2,t,e,i):console.error(`[${e}] ${t}: ${c2}`)},q2=c2=>!G.has(c2),T2=c2=>!!c2&&c2===Math.floor(c2)&&c2>0&&isFinite(c2),H2=c2=>T2(c2)?c2<=Math.pow(2,8)?Uint8Array:c2<=Math.pow(2,16)?Uint16Array:c2<=Math.pow(2,32)?Uint32Array:c2<=Number.MAX_SAFE_INTEGER?W2:null:null,W2=class extends Array{constructor(t){super(t),this.fill(0)}},x2=class c2{heap;length;static#o=!1;static create(t){let e=H2(t);if(!e)return[];c2.#o=!0;let i=new c2(t,e);return c2.#o=!1,i}constructor(t,e){if(!c2.#o)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},L3=class c2{#o;#c;#m;#W;#w;#M;#j;#S;get perf(){return this.#S}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#b;#s;#i;#t;#l;#u;#a;#h;#_;#r;#y;#F;#d;#g;#T;#U;#f;#D;static unsafeExposeInternals(t){return{starts:t.#F,ttls:t.#d,autopurgeTimers:t.#g,sizes:t.#y,keyMap:t.#s,keyList:t.#i,valList:t.#t,next:t.#l,prev:t.#u,get head(){return t.#a},get tail(){return t.#h},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,i,s,n)=>t.#G(e,i,s,n),moveToTail:e=>t.#L(e),indexes:e=>t.#A(e),rindexes:e=>t.#v(e),isStale:e=>t.#p(e)}}get max(){return this.#o}get maxSize(){return this.#c}get calculatedSize(){return this.#b}get size(){return this.#n}get fetchMethod(){return this.#M}get memoMethod(){return this.#j}get dispose(){return this.#m}get onInsert(){return this.#W}get disposeAfter(){return this.#w}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:r,updateAgeOnHas:h,allowStale:a,dispose:o,onInsert:m2,disposeAfter:S,noDisposeOnSet:y2,noUpdateTTL:u,maxSize:g2=0,maxEntrySize:f=0,sizeCalculation:_2,fetchMethod:l3,memoMethod:w2,noDeleteOnFetchRejection:F2,noDeleteOnStaleGet:b2,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:A2,ignoreFetchAbort:v2,perf:D3}=t;if(D3!==void 0&&typeof D3?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#S=D3??N2.defaultPerf,e!==0&&!T2(e))throw new TypeError("max option must be a nonnegative integer");let z2=e?H2(e):Array;if(!z2)throw new Error("invalid max value: "+e);if(this.#o=e,this.#c=g2,this.maxEntrySize=f||this.#c,this.sizeCalculation=_2,this.sizeCalculation){if(!this.#c&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(w2!==void 0&&typeof w2!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#j=w2,l3!==void 0&&typeof l3!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#M=l3,this.#U=!!l3,this.#s=new Map,this.#i=Array.from({length:e}).fill(void 0),this.#t=Array.from({length:e}).fill(void 0),this.#l=new z2(e),this.#u=new z2(e),this.#a=0,this.#h=0,this.#_=x2.create(e),this.#n=0,this.#b=0,typeof o=="function"&&(this.#m=o),typeof m2=="function"&&(this.#W=m2),typeof S=="function"?(this.#w=S,this.#r=[]):(this.#w=void 0,this.#r=void 0),this.#T=!!this.#m,this.#D=!!this.#W,this.#f=!!this.#w,this.noDisposeOnSet=!!y2,this.noUpdateTTL=!!u,this.noDeleteOnFetchRejection=!!F2,this.allowStaleOnFetchRejection=!!p,this.allowStaleOnFetchAbort=!!A2,this.ignoreFetchAbort=!!v2,this.maxEntrySize!==0){if(this.#c!==0&&!T2(this.#c))throw new TypeError("maxSize must be a positive integer if specified");if(!T2(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#X()}if(this.allowStale=!!a,this.noDeleteOnStaleGet=!!b2,this.updateAgeOnGet=!!r,this.updateAgeOnHas=!!h,this.ttlResolution=T2(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!T2(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#H()}if(this.#o===0&&this.ttl===0&&this.#c===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#o&&!this.#c){let E2="LRU_CACHE_UNBOUNDED";q2(E2)&&(G.add(E2),V2("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",E2,c2))}}getRemainingTTL(t){return this.#s.has(t)?1/0:0}#H(){let t=new W2(this.#o),e=new W2(this.#o);this.#d=t,this.#F=e;let i=this.ttlAutopurge?Array.from({length:this.#o}):void 0;this.#g=i,this.#N=(h,a,o=this.#S.now())=>{e[h]=a!==0?o:0,t[h]=a,s(h,a)},this.#R=h=>{e[h]=t[h]!==0?this.#S.now():0,s(h,t[h])};let s=this.ttlAutopurge?(h,a)=>{if(i?.[h]&&(clearTimeout(i[h]),i[h]=void 0),a&&a!==0&&i){let o=setTimeout(()=>{this.#p(h)&&this.#z(this.#i[h],"expire")},a+1);o.unref&&o.unref(),i[h]=o}}:()=>{};this.#E=(h,a)=>{if(t[a]){let o=t[a],m2=e[a];if(!o||!m2)return;h.ttl=o,h.start=m2,h.now=n||r();let S=h.now-m2;h.remainingTTL=o-S}};let n=0,r=()=>{let h=this.#S.now();if(this.ttlResolution>0){n=h;let a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return h};this.getRemainingTTL=h=>{let a=this.#s.get(h);if(a===void 0)return 0;let o=t[a],m2=e[a];if(!o||!m2)return 1/0;let S=(n||r())-m2;return o-S},this.#p=h=>{let a=e[h],o=t[h];return!!o&&!!a&&(n||r())-a>o}}#R=()=>{};#E=()=>{};#N=()=>{};#p=()=>!1;#X(){let t=new W2(this.#o);this.#b=0,this.#y=t,this.#C=e=>{this.#b-=t[e],t[e]=0},this.#V=(e,i,s,n)=>{if(this.#e(i))return 0;if(!T2(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,e),!T2(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#I=(e,i,s)=>{if(t[e]=i,this.#c){let n=this.#c-t[e];for(;this.#b>n;)this.#P(!0)}this.#b+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#b)}}#C=t=>{};#I=(t,e,i)=>{};#V=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#A({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#h;this.#q(e)&&((t||!this.#p(e))&&(yield e),e!==this.#a);)e=this.#u[e]}*#v({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#a;this.#q(e)&&((t||!this.#p(e))&&(yield e),e!==this.#h);)e=this.#l[e]}#q(t){return t!==void 0&&this.#s.get(this.#i[t])===t}*entries(){for(let t of this.#A())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield[this.#i[t],this.#t[t]])}*rentries(){for(let t of this.#v())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield[this.#i[t],this.#t[t]])}*keys(){for(let t of this.#A()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e)}}*rkeys(){for(let t of this.#v()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e)}}*values(){for(let t of this.#A())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t])}*rvalues(){for(let t of this.#v())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;if(n!==void 0&&t(n,this.#i[i],this))return this.#x(this.#i[i],e)}}forEach(t,e=this){for(let i of this.#A()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#i[i],this)}}rforEach(t,e=this){for(let i of this.#v()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#i[i],this)}}purgeStale(){let t=!1;for(let e of this.#v({allowStale:!0}))this.#p(e)&&(this.#z(this.#i[e],"expire"),t=!0);return t}info(t){let e=this.#s.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#d&&this.#F){let r=this.#d[e],h=this.#F[e];if(r&&h){let a=r-(this.#S.now()-h);n.ttl=a,n.start=Date.now()}}return this.#y&&(n.size=this.#y[e]),n}dump(){let t=[];for(let e of this.#A({allowStale:!0})){let i=this.#i[e],s=this.#t[e],n=this.#e(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let r={value:n};if(this.#d&&this.#F){r.ttl=this.#d[e];let h=this.#S.now()-this.#F[e];r.start=Math.floor(Date.now()-h)}this.#y&&(r.size=this.#y[e]),t.unshift([i,r])}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=this.#S.now()-s}this.#O(e,i.value,i)}}set(t,e,i={}){let{status:s=d2.metrics.hasSubscribers?{}:void 0}=i;i.status=s,s&&(s.op="set",s.key=t,e!==void 0&&(s.value=e),s.cache=this);let n=this.#O(t,e,i);return s&&d2.metrics.hasSubscribers&&d2.metrics.publish(s),n}#O(t,e,i,s){let{ttl:n=this.ttl,start:r,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:o}=i;if(e===void 0)return o&&(o.set="deleted"),this.delete(t),this;let{noUpdateTTL:m2=this.noUpdateTTL}=i,S=this.#e(e);o&&!S&&(o.value=e);let y2=this.#V(t,e,i.size||0,a,o);if(this.maxEntrySize&&y2>this.maxEntrySize)return this.#z(t,"set"),o&&(o.set="miss",o.maxEntrySizeExceeded=!0),this;let u=this.#n===0?void 0:this.#s.get(t);if(u===void 0)u=this.#n===0?this.#h:this.#_.length!==0?this.#_.pop():this.#n===this.#o?this.#P(!1):this.#n,this.#i[u]=t,this.#t[u]=e,this.#s.set(t,u),this.#l[this.#h]=u,this.#u[u]=this.#h,this.#h=u,this.#n++,this.#I(u,y2,o),o&&(o.set="add"),m2=!1,this.#D&&!S&&this.#W?.(e,t,"add");else{this.#L(u);let g2=this.#t[u];if(e!==g2){if(!h)if(this.#e(g2)){g2!==s&&g2.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:f}=g2;f!==void 0&&f!==e&&(this.#T&&this.#m?.(f,t,"set"),this.#f&&this.#r?.push([f,t,"set"]))}else this.#T&&this.#m?.(g2,t,"set"),this.#f&&this.#r?.push([g2,t,"set"]);if(this.#C(u),this.#I(u,y2,o),this.#t[u]=e,!S){let f=g2&&this.#e(g2)?g2.__staleWhileFetching:g2,_2=f===void 0?"add":e!==f?"replace":"update";o&&(o.set=_2,f!==void 0&&(o.oldValue=f)),this.#D&&this.onInsert?.(e,t,_2)}}else S||(o&&(o.set="update"),this.#D&&this.onInsert?.(e,t,"update"))}if(n!==0&&!this.#d&&this.#H(),this.#d&&(m2||this.#N(u,n,r),o&&this.#E(o,u)),!h&&this.#f&&this.#r){let g2=this.#r,f;for(;f=g2?.shift();)this.#w?.(...f)}return this}pop(){try{for(;this.#n;){let t=this.#t[this.#a];if(this.#P(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#f&&this.#r){let t=this.#r,e;for(;e=t?.shift();)this.#w?.(...e)}}}#P(t){let e=this.#a,i=this.#i[e],s=this.#t[e],n=this.#e(s);n&&s.__abortController.abort(new Error("evicted"));let r=n?s.__staleWhileFetching:s;return(this.#T||this.#f)&&r!==void 0&&(this.#T&&this.#m?.(r,i,"evict"),this.#f&&this.#r?.push([r,i,"evict"])),this.#C(e),this.#g?.[e]&&(clearTimeout(this.#g[e]),this.#g[e]=void 0),t&&(this.#i[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#n===1?(this.#a=this.#h=0,this.#_.length=0):this.#a=this.#l[e],this.#s.delete(i),this.#n--,e}has(t,e={}){let{status:i=d2.metrics.hasSubscribers?{}:void 0}=e;e.status=i,i&&(i.op="has",i.key=t,i.cache=this);let s=this.#Y(t,e);return d2.metrics.hasSubscribers&&d2.metrics.publish(i),s}#Y(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,n=this.#s.get(t);if(n!==void 0){let r=this.#t[n];if(this.#e(r)&&r.__staleWhileFetching===void 0)return!1;if(this.#p(n))s&&(s.has="stale",this.#E(s,n));else return i&&this.#R(n),s&&(s.has="hit",this.#E(s,n)),!0}else s&&(s.has="miss");return!1}peek(t,e={}){let{status:i=C()?{}:void 0}=e;i&&(i.op="peek",i.key=t,i.cache=this),e.status=i;let s=this.#J(t,e);return d2.metrics.hasSubscribers&&d2.metrics.publish(i),s}#J(t,e){let{status:i,allowStale:s=this.allowStale}=e,n=this.#s.get(t);if(n===void 0||!s&&this.#p(n)){i&&(i.peek=n===void 0?"miss":"stale");return}let r=this.#t[n],h=this.#e(r)?r.__staleWhileFetching:r;return i&&(h!==void 0?(i.peek="hit",i.value=h):i.peek="miss"),h}#G(t,e,i,s){let n=e===void 0?void 0:this.#t[e];if(this.#e(n))return n;let r=new AbortController,{signal:h}=i;h?.addEventListener("abort",()=>r.abort(h.reason),{signal:r.signal});let a={signal:r.signal,options:i,context:s},o=(f,_2=!1)=>{let{aborted:l3}=r.signal,w2=i.ignoreFetchAbort&&f!==void 0,F2=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&f!==void 0);if(i.status&&(l3&&!_2?(i.status.fetchAborted=!0,i.status.fetchError=r.signal.reason,w2&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),l3&&!w2&&!_2)return S(r.signal.reason,F2);let b2=u,p=this.#t[e];return(p===u||p===void 0&&w2&&_2)&&(f===void 0?b2.__staleWhileFetching!==void 0?this.#t[e]=b2.__staleWhileFetching:this.#z(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.#O(t,f,a.options,b2))),f},m2=f=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=f),S(f,!1)),S=(f,_2)=>{let{aborted:l3}=r.signal,w2=l3&&i.allowStaleOnFetchAbort,F2=w2||i.allowStaleOnFetchRejection,b2=F2||i.noDeleteOnFetchRejection,p=u;if(this.#t[e]===u&&(!b2||!_2&&p.__staleWhileFetching===void 0?this.#z(t,"fetch"):w2||(this.#t[e]=p.__staleWhileFetching)),F2)return i.status&&p.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),p.__staleWhileFetching;if(p.__returned===p)throw f},y2=(f,_2)=>{let l3=this.#M?.(t,n,a);r.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(f(void 0),i.allowStaleOnFetchAbort&&(f=w2=>o(w2,!0)))}),l3&&l3 instanceof Promise?l3.then(w2=>f(w2===void 0?void 0:w2),_2):l3!==void 0&&f(l3)};i.status&&(i.status.fetchDispatched=!0);let u=new Promise(y2).then(o,m2),g2=Object.assign(u,{__abortController:r,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.#O(t,g2,{...a.options,status:void 0}),e=this.#s.get(t)):this.#t[e]=g2,g2}#e(t){if(!this.#U)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}fetch(t,e={}){let i=d2.tracing.hasSubscribers,{status:s=C()?{}:void 0}=e;e.status=s,s&&e.context&&(s.context=e.context);let n=this.#B(t,e);return s&&i&&(s.trace=!0,d2.tracing.tracePromise(()=>n,s).catch(()=>{})),n}async#B(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:a=0,sizeCalculation:o=this.sizeCalculation,noUpdateTTL:m2=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y2=this.allowStaleOnFetchRejection,ignoreFetchAbort:u=this.ignoreFetchAbort,allowStaleOnFetchAbort:g2=this.allowStaleOnFetchAbort,context:f,forceRefresh:_2=!1,status:l3,signal:w2}=e;if(l3&&(l3.op="fetch",l3.key=t,_2&&(l3.forceRefresh=!0),l3.cache=this),!this.#U)return l3&&(l3.fetch="get"),this.#x(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:l3});let F2={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:r,noDisposeOnSet:h,size:a,sizeCalculation:o,noUpdateTTL:m2,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:y2,allowStaleOnFetchAbort:g2,ignoreFetchAbort:u,status:l3,signal:w2},b2=this.#s.get(t);if(b2===void 0){l3&&(l3.fetch="miss");let p=this.#G(t,b2,F2,f);return p.__returned=p}else{let p=this.#t[b2];if(this.#e(p)){let E2=i&&p.__staleWhileFetching!==void 0;return l3&&(l3.fetch="inflight",E2&&(l3.returnedStale=!0)),E2?p.__staleWhileFetching:p.__returned=p}let A2=this.#p(b2);if(!_2&&!A2)return l3&&(l3.fetch="hit"),this.#L(b2),s&&this.#R(b2),l3&&this.#E(l3,b2),p;let v2=this.#G(t,b2,F2,f),z2=v2.__staleWhileFetching!==void 0&&i;return l3&&(l3.fetch=A2?"stale":"refresh",z2&&A2&&(l3.returnedStale=!0)),z2?v2.__staleWhileFetching:v2.__returned=v2}}forceFetch(t,e={}){let i=d2.tracing.hasSubscribers,{status:s=C()?{}:void 0}=e;e.status=s,s&&e.context&&(s.context=e.context);let n=this.#K(t,e);return s&&i&&(s.trace=!0,d2.tracing.tracePromise(()=>n,s).catch(()=>{})),n}async#K(t,e={}){let i=await this.#B(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let{status:i=d2.metrics.hasSubscribers?{}:void 0}=e;e.status=i,i&&(i.op="memo",i.key=t,e.context&&(i.context=e.context),i.cache=this);let s=this.#Q(t,e);return i&&(i.value=s),d2.metrics.hasSubscribers&&d2.metrics.publish(i),s}#Q(t,e={}){let i=this.#j;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,status:n,forceRefresh:r,...h}=e;n&&r&&(n.forceRefresh=!0);let a=this.#x(t,h),o=r||a===void 0;if(n&&(n.memo=o?"miss":"hit",o||(n.value=a)),!o)return a;let m2=i(t,a,{options:h,context:s});return n&&(n.value=m2),this.#O(t,m2,h),m2}get(t,e={}){let{status:i=d2.metrics.hasSubscribers?{}:void 0}=e;e.status=i,i&&(i.op="get",i.key=t,i.cache=this);let s=this.#x(t,e);return i&&(s!==void 0&&(i.value=s),d2.metrics.hasSubscribers&&d2.metrics.publish(i)),s}#x(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:r}=e,h=this.#s.get(t);if(h===void 0){r&&(r.get="miss");return}let a=this.#t[h],o=this.#e(a);return r&&this.#E(r,h),this.#p(h)?o?(r&&(r.get="stale-fetching"),i&&a.__staleWhileFetching!==void 0?(r&&(r.returnedStale=!0),a.__staleWhileFetching):void 0):(n||this.#z(t,"expire"),r&&(r.get="stale"),i?(r&&(r.returnedStale=!0),a):void 0):(r&&(r.get=o?"fetching":"hit"),this.#L(h),s&&this.#R(h),o?a.__staleWhileFetching:a)}#k(t,e){this.#u[e]=t,this.#l[t]=e}#L(t){t!==this.#h&&(t===this.#a?this.#a=this.#l[t]:this.#k(this.#u[t],this.#l[t]),this.#k(this.#h,t),this.#h=t)}delete(t){return this.#z(t,"delete")}#z(t,e){d2.metrics.hasSubscribers&&d2.metrics.publish({op:"delete",delete:e,key:t,cache:this});let i=!1;if(this.#n!==0){let s=this.#s.get(t);if(s!==void 0)if(this.#g?.[s]&&(clearTimeout(this.#g?.[s]),this.#g[s]=void 0),i=!0,this.#n===1)this.#$(e);else{this.#C(s);let n=this.#t[s];if(this.#e(n)?n.__abortController.abort(new Error("deleted")):(this.#T||this.#f)&&(this.#T&&this.#m?.(n,t,e),this.#f&&this.#r?.push([n,t,e])),this.#s.delete(t),this.#i[s]=void 0,this.#t[s]=void 0,s===this.#h)this.#h=this.#u[s];else if(s===this.#a)this.#a=this.#l[s];else{let r=this.#u[s];this.#l[r]=this.#l[s];let h=this.#l[s];this.#u[h]=this.#u[s]}this.#n--,this.#_.push(s)}}if(this.#f&&this.#r?.length){let s=this.#r,n;for(;n=s?.shift();)this.#w?.(...n)}return i}clear(){return this.#$("delete")}#$(t){for(let e of this.#v({allowStale:!0})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#i[e];this.#T&&this.#m?.(i,s,t),this.#f&&this.#r?.push([i,s,t])}}if(this.#s.clear(),this.#t.fill(void 0),this.#i.fill(void 0),this.#d&&this.#F){this.#d.fill(0),this.#F.fill(0);for(let e of this.#g??[])e!==void 0&&clearTimeout(e);this.#g?.fill(void 0)}if(this.#y&&this.#y.fill(0),this.#a=0,this.#h=0,this.#_.length=0,this.#b=0,this.#n=0,this.#f&&this.#r){let e=this.#r,i;for(;i=e?.shift();)this.#w?.(...i)}}};exports.LRUCache=L3}});var require_hosts=__commonJS({"node_modules/hosted-git-info/lib/hosts.js"(exports,module){"use strict";var maybeJoin=(...args)=>args.every(arg=>arg)?args.join(""):"",maybeEncode=arg=>arg?encodeURIComponent(arg):"",formatHashFragment=f=>f.toLowerCase().replace(/^\W+/g,"").replace(/(?<!\W)\W+$/,"").replace(/\//g,"").replace(/\W+/g,"-"),defaults2={sshtemplate:({domain,user,project,committish})=>`git@${domain}:${user}/${project}.git${maybeJoin("#",committish)}`,sshurltemplate:({domain,user,project,committish})=>`git+ssh://git@${domain}/${user}/${project}.git${maybeJoin("#",committish)}`,edittemplate:({domain,user,project,committish,editpath,path:path15})=>`https://${domain}/${user}/${project}${maybeJoin("/",editpath,"/",maybeEncode(committish||"HEAD"),"/",path15)}`,browsetemplate:({domain,user,project,committish,treepath})=>`https://${domain}/${user}/${project}${maybeJoin("/",treepath,"/",maybeEncode(committish))}`,browsetreetemplate:({domain,user,project,committish,treepath,path:path15,fragment,hashformat})=>`https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish||"HEAD")}/${path15}${maybeJoin("#",hashformat(fragment||""))}`,browseblobtemplate:({domain,user,project,committish,blobpath,path:path15,fragment,hashformat})=>`https://${domain}/${user}/${project}/${blobpath}/${maybeEncode(committish||"HEAD")}/${path15}${maybeJoin("#",hashformat(fragment||""))}`,docstemplate:({domain,user,project,treepath,committish})=>`https://${domain}/${user}/${project}${maybeJoin("/",treepath,"/",maybeEncode(committish))}#readme`,httpstemplate:({auth,domain,user,project,committish})=>`git+https://${maybeJoin(auth,"@")}${domain}/${user}/${project}.git${maybeJoin("#",committish)}`,filetemplate:({domain,user,project,committish,path:path15})=>`https://${domain}/${user}/${project}/raw/${maybeEncode(committish||"HEAD")}/${path15}`,shortcuttemplate:({type,user,project,committish})=>`${type}:${user}/${project}${maybeJoin("#",committish)}`,pathtemplate:({user,project,committish})=>`${user}/${project}${maybeJoin("#",committish)}`,bugstemplate:({domain,user,project})=>`https://${domain}/${user}/${project}/issues`,hashformat:formatHashFragment},hosts={};hosts.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth,user,project,committish,path:path15})=>`https://${maybeJoin(auth,"@")}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish||"HEAD")}/${path15}`,gittemplate:({auth,domain,user,project,committish})=>`git://${maybeJoin(auth,"@")}${domain}/${user}/${project}.git${maybeJoin("#",committish)}`,tarballtemplate:({domain,user,project,committish})=>`https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish||"HEAD")}`,extract:url=>{let[,user,project,type,committish]=url.pathname.split("/",5);if(!(type&&type!=="tree")&&(type||(committish=url.hash.slice(1)),project&&project.endsWith(".git")&&(project=project.slice(0,-4)),!(!user||!project)))return{user,project,committish}}};hosts.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain,user,project,committish,treepath,path:path15,editpath})=>`https://${domain}/${user}/${project}${maybeJoin("/",treepath,"/",maybeEncode(committish||"HEAD"),"/",path15,editpath)}`,tarballtemplate:({domain,user,project,committish})=>`https://${domain}/${user}/${project}/get/${maybeEncode(committish||"HEAD")}.tar.gz`,extract:url=>{let[,user,project,aux]=url.pathname.split("/",4);if(!["get"].includes(aux)&&(project&&project.endsWith(".git")&&(project=project.slice(0,-4)),!(!user||!project)))return{user,project,committish:url.hash.slice(1)}}};hosts.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",tarballtemplate:({domain,user,project,committish})=>`https://${domain}/api/v4/projects/${maybeEncode(user+"/"+project)}/repository/archive.tar.gz?sha=${maybeEncode(committish||"HEAD")}`,extract:url=>{let path15=url.pathname.slice(1);if(path15.includes("/-/")||path15.includes("/archive.tar.gz"))return;let segments=path15.split("/"),project=segments.pop();project.endsWith(".git")&&(project=project.slice(0,-4));let user=segments.join("/");if(!(!user||!project))return{user,project,committish:url.hash.slice(1)}}};hosts.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain,project,committish})=>`git@${domain}:${project}.git${maybeJoin("#",committish)}`,sshurltemplate:({domain,project,committish})=>`git+ssh://git@${domain}/${project}.git${maybeJoin("#",committish)}`,edittemplate:({domain,user,project,committish,editpath})=>`https://${domain}/${user}/${project}${maybeJoin("/",maybeEncode(committish))}/${editpath}`,browsetemplate:({domain,project,committish})=>`https://${domain}/${project}${maybeJoin("/",maybeEncode(committish))}`,browsetreetemplate:({domain,project,committish,path:path15,hashformat})=>`https://${domain}/${project}${maybeJoin("/",maybeEncode(committish))}${maybeJoin("#",hashformat(path15))}`,browseblobtemplate:({domain,project,committish,path:path15,hashformat})=>`https://${domain}/${project}${maybeJoin("/",maybeEncode(committish))}${maybeJoin("#",hashformat(path15))}`,docstemplate:({domain,project,committish})=>`https://${domain}/${project}${maybeJoin("/",maybeEncode(committish))}`,httpstemplate:({domain,project,committish})=>`git+https://${domain}/${project}.git${maybeJoin("#",committish)}`,filetemplate:({user,project,committish,path:path15})=>`https://gist.githubusercontent.com/${user}/${project}/raw${maybeJoin("/",maybeEncode(committish))}/${path15}`,shortcuttemplate:({type,project,committish})=>`${type}:${project}${maybeJoin("#",committish)}`,pathtemplate:({project,committish})=>`${project}${maybeJoin("#",committish)}`,bugstemplate:({domain,project})=>`https://${domain}/${project}`,gittemplate:({domain,project,committish})=>`git://${domain}/${project}.git${maybeJoin("#",committish)}`,tarballtemplate:({project,committish})=>`https://codeload.github.com/gist/${project}/tar.gz/${maybeEncode(committish||"HEAD")}`,extract:url=>{let[,user,project,aux]=url.pathname.split("/",4);if(aux!=="raw"){if(!project){if(!user)return;project=user,user=null}return project.endsWith(".git")&&(project=project.slice(0,-4)),{user,project,committish:url.hash.slice(1)}}},hashformat:function(fragment){return fragment&&"file-"+formatHashFragment(fragment)}};hosts.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain,user,project,committish,path:path15})=>`https://${domain}/${user}/${project}/blob/${maybeEncode(committish)||"HEAD"}/${path15}`,httpstemplate:({domain,user,project,committish})=>`https://${domain}/${user}/${project}${maybeJoin("#",committish)}`,tarballtemplate:({domain,user,project,committish})=>`https://${domain}/${user}/${project}/archive/${maybeEncode(committish)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:url=>{let[,user,project,aux]=url.pathname.split("/",4);if(!["archive"].includes(aux)&&(project&&project.endsWith(".git")&&(project=project.slice(0,-4)),!(!user||!project)))return{user,project,committish:url.hash.slice(1)}}};for(let[name,host]of Object.entries(hosts))hosts[name]=Object.assign({},defaults2,host);module.exports=hosts}});var require_parse_url=__commonJS({"node_modules/hosted-git-info/lib/parse-url.js"(exports,module){var url=__require("url"),lastIndexOfBefore=(str2,char,beforeChar)=>{let startPosition=str2.indexOf(beforeChar);return str2.lastIndexOf(char,startPosition>-1?startPosition:1/0)},safeUrl=u=>{try{return new url.URL(u)}catch{}},correctProtocol=(arg,protocols)=>{let firstColon=arg.indexOf(":"),proto2=arg.slice(0,firstColon+1);if(Object.prototype.hasOwnProperty.call(protocols,proto2)||arg.substr(firstColon,3)==="://")return arg;let firstAt=arg.indexOf("@");return firstAt>-1?firstAt>firstColon?`git+ssh://${arg}`:arg:`${arg.slice(0,firstColon+1)}//${arg.slice(firstColon+1)}`},correctUrl=giturl=>{let firstAt=lastIndexOfBefore(giturl,"@","#"),lastColonBeforeHash=lastIndexOfBefore(giturl,":","#");return lastColonBeforeHash>firstAt&&(giturl=giturl.slice(0,lastColonBeforeHash)+"/"+giturl.slice(lastColonBeforeHash+1)),lastIndexOfBefore(giturl,":","#")===-1&&giturl.indexOf("//")===-1&&(giturl=`git+ssh://${giturl}`),giturl};module.exports=(giturl,protocols)=>{let withProtocol=protocols?correctProtocol(giturl,protocols):giturl;return safeUrl(withProtocol)||safeUrl(correctUrl(withProtocol))}}});var require_from_url=__commonJS({"node_modules/hosted-git-info/lib/from-url.js"(exports,module){"use strict";var parseUrl=require_parse_url(),isGitHubShorthand=arg=>{let firstHash=arg.indexOf("#"),firstSlash=arg.indexOf("/"),secondSlash=arg.indexOf("/",firstSlash+1),firstColon=arg.indexOf(":"),firstSpace=/\s/.exec(arg),firstAt=arg.indexOf("@"),spaceOnlyAfterHash=!firstSpace||firstHash>-1&&firstSpace.index>firstHash,atOnlyAfterHash=firstAt===-1||firstHash>-1&&firstAt>firstHash,colonOnlyAfterHash=firstColon===-1||firstHash>-1&&firstColon>firstHash,secondSlashOnlyAfterHash=secondSlash===-1||firstHash>-1&&secondSlash>firstHash,hasSlash=firstSlash>0,doesNotEndWithSlash=firstHash>-1?arg[firstHash-1]!=="/":!arg.endsWith("/"),doesNotStartWithDot=!arg.startsWith(".");return spaceOnlyAfterHash&&hasSlash&&doesNotEndWithSlash&&doesNotStartWithDot&&atOnlyAfterHash&&colonOnlyAfterHash&&secondSlashOnlyAfterHash};module.exports=(giturl,opts,{gitHosts,protocols})=>{if(!giturl)return;let correctedUrl=isGitHubShorthand(giturl)?`github:${giturl}`:giturl,parsed=parseUrl(correctedUrl,protocols);if(!parsed)return;let gitHostShortcut=gitHosts.byShortcut[parsed.protocol],gitHostDomain=gitHosts.byDomain[parsed.hostname.startsWith("www.")?parsed.hostname.slice(4):parsed.hostname],gitHostName=gitHostShortcut||gitHostDomain;if(!gitHostName)return;let gitHostInfo=gitHosts[gitHostShortcut||gitHostDomain],auth=null;protocols[parsed.protocol]?.auth&&(parsed.username||parsed.password)&&(auth=`${parsed.username}${parsed.password?":"+parsed.password:""}`);let committish=null,user=null,project=null,defaultRepresentation=null;try{if(gitHostShortcut){let pathname=parsed.pathname.startsWith("/")?parsed.pathname.slice(1):parsed.pathname,firstAt=pathname.indexOf("@");firstAt>-1&&(pathname=pathname.slice(firstAt+1));let lastSlash=pathname.lastIndexOf("/");lastSlash>-1?(user=decodeURIComponent(pathname.slice(0,lastSlash)),user||(user=null),project=decodeURIComponent(pathname.slice(lastSlash+1))):project=decodeURIComponent(pathname),project.endsWith(".git")&&(project=project.slice(0,-4)),parsed.hash&&(committish=decodeURIComponent(parsed.hash.slice(1))),defaultRepresentation="shortcut"}else{if(!gitHostInfo.protocols.includes(parsed.protocol))return;let segments=gitHostInfo.extract(parsed);if(!segments)return;user=segments.user&&decodeURIComponent(segments.user),project=decodeURIComponent(segments.project),committish=decodeURIComponent(segments.committish),defaultRepresentation=protocols[parsed.protocol]?.name||parsed.protocol.slice(0,-1)}}catch(err2){if(err2 instanceof URIError)return;throw err2}return[gitHostName,user,auth,project,committish,defaultRepresentation,opts]}}});var require_lib=__commonJS({"node_modules/hosted-git-info/lib/index.js"(exports,module){"use strict";var{LRUCache}=require_index_min(),hosts=require_hosts(),fromUrl=require_from_url(),parseUrl=require_parse_url(),cache=new LRUCache({max:1e3});function unknownHostedUrl(url){try{let{protocol,hostname:hostname2,pathname}=new URL(url);if(!hostname2)return null;let proto2=/(?:git\+)http:$/.test(protocol)?"http:":"https:",path15=pathname.replace(/\.git$/,"");return`${proto2}//${hostname2}${path15}`}catch{return null}}var GitHost=class _GitHost{constructor(type,user,auth,project,committish,defaultRepresentation,opts={}){Object.assign(this,_GitHost.#gitHosts[type],{type,user,auth,project,committish,default:defaultRepresentation,opts})}static#gitHosts={byShortcut:{},byDomain:{}};static#protocols={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(name,host){_GitHost.#gitHosts[name]=host,_GitHost.#gitHosts.byDomain[host.domain]=name,_GitHost.#gitHosts.byShortcut[`${name}:`]=name,_GitHost.#protocols[`${name}:`]={name}}static fromUrl(giturl,opts){if(typeof giturl!="string")return;let key=giturl+JSON.stringify(opts||{});if(!cache.has(key)){let hostArgs=fromUrl(giturl,opts,{gitHosts:_GitHost.#gitHosts,protocols:_GitHost.#protocols});cache.set(key,hostArgs?new _GitHost(...hostArgs):void 0)}return cache.get(key)}static fromManifest(manifest,opts={}){if(!manifest||typeof manifest!="object")return;let r=manifest.repository,rurl=r&&(typeof r=="string"?r:typeof r=="object"&&typeof r.url=="string"?r.url:null);if(!rurl)throw new Error("no repository");let info=rurl&&_GitHost.fromUrl(rurl.replace(/^git\+/,""),opts)||null;if(info)return info;let unk=unknownHostedUrl(rurl);return _GitHost.fromUrl(unk,opts)||unk}static parseUrl(url){return parseUrl(url)}#fill(template,opts){if(typeof template!="function")return null;let options={...this,...this.opts,...opts};options.path||(options.path=""),options.path.startsWith("/")&&(options.path=options.path.slice(1)),options.noCommittish&&(options.committish=null);let result=template(options);return options.noGitPlus&&result.startsWith("git+")?result.slice(4):result}hash(){return this.committish?`#${this.committish}`:""}ssh(opts){return this.#fill(this.sshtemplate,opts)}sshurl(opts){return this.#fill(this.sshurltemplate,opts)}browse(path15,...args){return typeof path15!="string"?this.#fill(this.browsetemplate,path15):typeof args[0]!="string"?this.#fill(this.browsetreetemplate,{...args[0],path:path15}):this.#fill(this.browsetreetemplate,{...args[1],fragment:args[0],path:path15})}browseFile(path15,...args){return typeof args[0]!="string"?this.#fill(this.browseblobtemplate,{...args[0],path:path15}):this.#fill(this.browseblobtemplate,{...args[1],fragment:args[0],path:path15})}docs(opts){return this.#fill(this.docstemplate,opts)}bugs(opts){return this.#fill(this.bugstemplate,opts)}https(opts){return this.#fill(this.httpstemplate,opts)}git(opts){return this.#fill(this.gittemplate,opts)}shortcut(opts){return this.#fill(this.shortcuttemplate,opts)}path(opts){return this.#fill(this.pathtemplate,opts)}tarball(opts){return this.#fill(this.tarballtemplate,{...opts,noCommittish:!1})}file(path15,opts){return this.#fill(this.filetemplate,{...opts,path:path15})}edit(path15,opts){return this.#fill(this.edittemplate,{...opts,path:path15})}getDefaultRepresentation(){return this.default}toString(opts){return this.default&&typeof this[this.default]=="function"?this[this.default](opts):this.sshurl(opts)}};for(let[name,host]of Object.entries(hosts))GitHost.addHost(name,host);module.exports=GitHost}});import{accessSync,constants,existsSync,readFileSync,realpathSync as realpathSync2}from"fs";import{homedir as homedir2}from"os";import{basename,dirname,join as join2,resolve,sep as sep2,win32}from"path";import{fileURLToPath as fileURLToPath2}from"url";var import_cross_spawn=__toESM(require_cross_spawn(),1);import{spawn as nodeSpawn,spawnSync as nodeSpawnSync}from"node:child_process";var EXIT_STDIO_GRACE_MS=100;function spawnProcess(command,args,options){return process.platform==="win32"?(0,import_cross_spawn.default)(command,args,options):nodeSpawn(command,args,options)}function spawnProcessSync(command,args,options){return process.platform==="win32"?import_cross_spawn.default.sync(command,args,options):nodeSpawnSync(command,args,options)}function waitForChildProcess(child){return new Promise((resolve25,reject2)=>{let settled=!1,exited=!1,exitCode=null,postExitTimer,stdoutEnded=child.stdout===null,stderrEnded=child.stderr===null,cleanup=()=>{postExitTimer&&(clearTimeout(postExitTimer),postExitTimer=void 0),child.removeListener("error",onError),child.removeListener("exit",onExit),child.removeListener("close",onClose),child.stdout?.removeListener("end",onStdoutEnd),child.stderr?.removeListener("end",onStderrEnd),child.stdout?.removeListener("data",onData),child.stderr?.removeListener("data",onData)},finalize=code=>{settled||(settled=!0,cleanup(),child.stdout?.destroy(),child.stderr?.destroy(),resolve25(code))},maybeFinalizeAfterExit=()=>{!exited||settled||stdoutEnded&&stderrEnded&&finalize(exitCode)},armIdleTimer=()=>{postExitTimer&&clearTimeout(postExitTimer),postExitTimer=setTimeout(()=>finalize(exitCode),EXIT_STDIO_GRACE_MS)},onData=()=>{exited&&!settled&&armIdleTimer()},onStdoutEnd=()=>{stdoutEnded=!0,maybeFinalizeAfterExit()},onStderrEnd=()=>{stderrEnded=!0,maybeFinalizeAfterExit()},onError=err2=>{settled||(settled=!0,cleanup(),reject2(err2))},onExit=code=>{exited=!0,exitCode=code,maybeFinalizeAfterExit(),settled||armIdleTimer()},onClose=code=>{finalize(code)};child.stdout?.once("end",onStdoutEnd),child.stderr?.once("end",onStderrEnd),child.stdout?.on("data",onData),child.stderr?.on("data",onData),child.once("error",onError),child.once("exit",onExit),child.once("close",onClose)})}import{realpathSync,statSync}from"node:fs";import{homedir}from"node:os";import{isAbsolute,join,resolve as nodeResolvePath,relative,sep}from"node:path";import{fileURLToPath}from"node:url";var UNICODE_SPACES=/[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;function canonicalizePath(path15){try{return realpathSync(path15)}catch{return path15}}function getFileRevision(path15){try{let stats=statSync(path15,{bigint:!0});return`${stats.dev}:${stats.ino}:${stats.size}:${stats.mtimeNs}:${stats.ctimeNs}`}catch{return}}function isLocalPath(value){let trimmed=value.trim();return!(trimmed.startsWith("npm:")||trimmed.startsWith("git:")||trimmed.startsWith("github:")||trimmed.startsWith("http:")||trimmed.startsWith("https:")||trimmed.startsWith("ssh:"))}function normalizeWindowsShellPath(filePath){if(!filePath.startsWith("/")||filePath.startsWith("//")||filePath.includes("\\"))return filePath;let match2=filePath.match(/^\/(?:mnt\/|cygdrive\/)?([a-z])(?:\/(.*))?$/i);if(!match2)return filePath;let suffix=match2[2]?.replaceAll("/","\\");return`${match2[1].toUpperCase()}:\\${suffix??""}`}function normalizePath(input,options={}){let normalized=options.trim?input.trim():input;if(options.normalizeUnicodeSpaces&&(normalized=normalized.replace(UNICODE_SPACES," ")),options.stripAtPrefix&&normalized.startsWith("@")&&(normalized=normalized.slice(1)),process.platform==="win32"&&(normalized=normalizeWindowsShellPath(normalized)),options.expandTilde??!0){let home=options.homeDir??homedir();if(normalized==="~")return home;if(normalized.startsWith("~/")||process.platform==="win32"&&normalized.startsWith("~\\"))return join(home,normalized.slice(2))}return/^file:\/\//.test(normalized)?fileURLToPath(normalized):normalized}function resolvePath(input,baseDir=process.cwd(),options={}){let normalized=normalizePath(input,options),normalizedBaseDir=normalizePath(baseDir);return isAbsolute(normalized)?nodeResolvePath(normalized):nodeResolvePath(normalizedBaseDir,normalized)}function getCwdRelativePath(filePath,cwd){let resolvedCwd=resolvePath(cwd),resolvedPath=resolvePath(filePath,resolvedCwd),relativePath=relative(resolvedCwd,resolvedPath);return relativePath===""||relativePath!==".."&&!relativePath.startsWith(`..${sep}`)&&!isAbsolute(relativePath)?relativePath||".":void 0}function formatPathRelativeToCwdOrAbsolute(filePath,cwd){let absolutePath=resolvePath(filePath,cwd);return(getCwdRelativePath(absolutePath,cwd)??absolutePath).split(sep).join("/")}function markPathIgnoredByCloudSync(path15){let attrs=process.platform==="darwin"?["com.dropbox.ignored","com.apple.fileprovider.ignore#P"]:process.platform==="linux"?["user.com.dropbox.ignored"]:[];for(let attr of attrs)process.platform==="darwin"?spawnProcessSync("xattr",["-w",attr,"1",path15],{encoding:"utf-8",stdio:"ignore"}):spawnProcessSync("setfattr",["-n",attr,"-v","1",path15],{encoding:"utf-8",stdio:"ignore"})}function splitBom(content){return content.startsWith("\uFEFF")?{bom:"\uFEFF",text:content.slice(1)}:{bom:"",text:content}}function stripBom(content){return splitBom(content).text}var __filename2=fileURLToPath2(import.meta.url),__dirname=dirname(__filename2),isBunBinary=import.meta.url.includes("$bunfs")||import.meta.url.includes("~BUN")||import.meta.url.includes("%7EBUN"),isBunRuntime=!!process.versions.bun;function normalizeSelfUpdatePackageTarget(target){return typeof target=="string"?{packageName:target,installSpec:target}:{packageName:target.packageName,installSpec:target.installSpec??target.packageName}}function makeSelfUpdateCommand(installStep,uninstallStep){return uninstallStep?{...installStep,display:`${uninstallStep.display} && ${installStep.display}`,steps:[uninstallStep,installStep]}:installStep}function makeSelfUpdateCommandStep(command,args){return{command,args,display:[command,...args].map(arg=>/\s/.test(arg)?`"${arg}"`:arg).join(" ")}}function detectInstallMethod(){if(isBunBinary)return"bun-binary";let resolvedPath=`${__dirname}\0${process.execPath||""}`.toLowerCase().replace(/\\/g,"/");return resolvedPath.includes("/pnpm/")||resolvedPath.includes("/.pnpm/")?"pnpm":resolvedPath.includes("/yarn/")||resolvedPath.includes("/.yarn/")?"yarn":isBunRuntime||resolvedPath.includes("/install/global/node_modules/")?"bun":resolvedPath.includes("/npm/")||resolvedPath.includes("/node_modules/")?"npm":"unknown"}function getInferredNpmInstall(){let packageDir=getPackageDir(),path15=process.platform==="win32"||packageDir.includes("\\")?win32:{basename,dirname},parent=path15.dirname(packageDir),root;if(path15.basename(parent).startsWith("@")&&path15.basename(path15.dirname(parent))==="node_modules"?root=path15.dirname(parent):path15.basename(parent)==="node_modules"&&(root=parent),!root)return;let rootParent=path15.dirname(root);if(path15.basename(rootParent)==="lib")return{root,prefix:path15.dirname(rootParent)}}function getSelfUpdateCommandForMethod(method,installedPackageName,updatePackageTarget=installedPackageName,npmCommand){let target=normalizeSelfUpdatePackageTarget(updatePackageTarget);switch(method){case"bun-binary":return;case"pnpm":{let match2=readCommandOutput("pnpm",["root","-g"])?void 0:/^(.*[\\/]global[\\/][^\\/]+)[\\/]\.pnpm[\\/]/.exec(getPackageDir()),binDirArgs=match2?[`--config.global-bin-dir=${process.env.PNPM_HOME||dirname(dirname(match2[1]))}`]:[];return makeSelfUpdateCommand(makeSelfUpdateCommandStep("pnpm",["install","-g","--ignore-scripts","--config.minimumReleaseAge=0",...binDirArgs,target.installSpec]),target.packageName===installedPackageName?void 0:makeSelfUpdateCommandStep("pnpm",["remove","-g",...binDirArgs,installedPackageName]))}case"yarn":return makeSelfUpdateCommand(makeSelfUpdateCommandStep("yarn",["global","add","--ignore-scripts",target.installSpec]),target.packageName===installedPackageName?void 0:makeSelfUpdateCommandStep("yarn",["global","remove",installedPackageName]));case"bun":return makeSelfUpdateCommand(makeSelfUpdateCommandStep("bun",["install","-g","--ignore-scripts","--minimum-release-age=0",target.installSpec]),target.packageName===installedPackageName?void 0:makeSelfUpdateCommandStep("bun",["uninstall","-g",installedPackageName]));case"npm":{let[command="npm",...npmArgs]=npmCommand??[],inferred=npmCommand?.length?void 0:getInferredNpmInstall(),prefixArgs=[...npmArgs,...inferred?["--prefix",inferred.prefix]:[]],installStep=makeSelfUpdateCommandStep(command,[...prefixArgs,"install","-g","--ignore-scripts","--min-release-age=0",target.installSpec]),uninstallStep=target.packageName===installedPackageName?void 0:makeSelfUpdateCommandStep(command,[...prefixArgs,"uninstall","-g",installedPackageName]);return makeSelfUpdateCommand(installStep,uninstallStep)}case"unknown":return}}function readCommandOutput(command,args,options={}){let result=spawnProcessSync(command,args,{encoding:"utf-8",stdio:["ignore","pipe","pipe"]});if(result.status===0)return result.stdout.trim()||void 0;if(options.requireSuccess){let reason=result.error?.message||result.stderr.trim()||`exit code ${result.status??"unknown"}`;throw new Error(`Failed to run ${[command,...args].join(" ")}: ${reason}`)}}function getGlobalPackageRoots(method,_packageName,npmCommand){switch(method){case"npm":{let configured=!!npmCommand?.length,[command="npm",...npmArgs]=npmCommand??[];if(configured&&command==="bun"){let bunBin=readCommandOutput(command,[...npmArgs,"pm","bin","-g"],{requireSuccess:!0}),roots=[join2(homedir2(),".bun","install","global","node_modules")];return bunBin&&roots.push(join2(dirname(bunBin),"install","global","node_modules")),roots}let root=readCommandOutput(command,[...npmArgs,"root","-g"],{requireSuccess:configured}),inferred=configured?void 0:getInferredNpmInstall();return[root,inferred?.root].filter(x2=>!!x2)}case"pnpm":{let root=readCommandOutput("pnpm",["root","-g"]);if(root)return[root,dirname(root)];let match2=/^(.*[\\/]global[\\/][^\\/]+)[\\/]\.pnpm[\\/]/.exec(getPackageDir());return match2?[match2[1]]:[]}case"yarn":{let dir=readCommandOutput("yarn",["global","dir"]);return dir?[dir,join2(dir,"node_modules")]:[]}case"bun":{let bunBin=readCommandOutput("bun",["pm","bin","-g"]),roots=[join2(homedir2(),".bun","install","global","node_modules")];return bunBin&&roots.push(join2(dirname(bunBin),"install","global","node_modules")),roots}case"bun-binary":case"unknown":return[]}}function normalizeExistingPathForComparison(path15,resolveSymlinks){let resolvedPath=resolve(path15);if(!existsSync(resolvedPath))return;let normalizedPath=resolvedPath;if(resolveSymlinks)try{normalizedPath=realpathSync2(resolvedPath)}catch{return}return process.platform==="win32"&&(normalizedPath=normalizedPath.toLowerCase()),normalizedPath}function getPathComparisonCandidates(path15){return Array.from(new Set([normalizeExistingPathForComparison(path15,!1),normalizeExistingPathForComparison(path15,!0)].filter(candidate=>!!candidate)))}function getEntrypointPackageDir(){let entrypoint=process.argv[1];if(!entrypoint)return;let dir=dirname(entrypoint);for(;dir!==dirname(dir);){if(existsSync(join2(dir,"package.json")))return dir;dir=dirname(dir)}}function isSelfUpdatePathWritable(){let packageDir=getPackageDir();try{return accessSync(packageDir,constants.W_OK),accessSync(dirname(packageDir),constants.W_OK),!0}catch{return!1}}function isManagedByGlobalPackageManager(method,packageName,npmCommand){let packageDirCandidates=[getPackageDir(),getEntrypointPackageDir()].filter(dir=>!!dir).flatMap(dir=>getPathComparisonCandidates(dir));return getGlobalPackageRoots(method,packageName,npmCommand).some(root=>getPathComparisonCandidates(root).some(normalizedRoot=>{let rootPrefix=normalizedRoot.endsWith(sep2)?normalizedRoot:`${normalizedRoot}${sep2}`;return packageDirCandidates.some(packageDir=>packageDir.startsWith(rootPrefix))}))}function getSelfUpdateCommand(packageName,npmCommand,updatePackageTarget=packageName){let method=detectInstallMethod(),command=getSelfUpdateCommandForMethod(method,packageName,updatePackageTarget,npmCommand);if(!(!command||!isManagedByGlobalPackageManager(method,packageName,npmCommand)||!isSelfUpdatePathWritable()))return command}function getSelfUpdateUnavailableInstruction(packageName,npmCommand,updatePackageTarget=packageName){let method=detectInstallMethod(),target=normalizeSelfUpdatePackageTarget(updatePackageTarget);if(method==="bun-binary")return"This standalone binary has no configured update source. Update it using the release channel that installed it.";let command=getSelfUpdateCommandForMethod(method,packageName,target,npmCommand);return command?isManagedByGlobalPackageManager(method,packageName,npmCommand)&&!isSelfUpdatePathWritable()?`This installation is managed by a global ${method} install, but the install path is not writable. Update it yourself with: ${command.display}`:`This installation is not managed by a global ${method} install. Update it with the package manager, wrapper, or source checkout that provides it.`:`Update ${target.installSpec} using the package manager, wrapper, or source checkout that provides this installation.`}function findNodePackageDir(startDir){let dir=startDir;for(;dir!==dirname(dir);){if(existsSync(join2(dir,"package.json"))){let parent=dirname(dir);return basename(dir)==="dist"&&existsSync(join2(parent,"package.json"))?parent:dir}dir=dirname(dir)}return startDir}function getPackageDir(){let envDir=process.env.AGENT_FORGE_PACKAGE_DIR;return envDir?normalizePath(envDir):isBunBinary?dirname(process.execPath):findNodePackageDir(__dirname)}function getThemesDir(){if(isBunBinary)return join2(getPackageDir(),"theme");let packageDir=getPackageDir(),srcOrDist=existsSync(join2(packageDir,"src"))?"src":"dist";return join2(packageDir,srcOrDist,"modes","interactive","theme")}function getExportTemplateDir(){if(isBunBinary)return join2(getPackageDir(),"export-html");let packageDir=getPackageDir(),srcOrDist=existsSync(join2(packageDir,"src"))?"src":"dist";return join2(packageDir,srcOrDist,"core","export-html")}function getPackageJsonPath(){return join2(getPackageDir(),"package.json")}function getReadmePath(){return resolve(join2(getPackageDir(),"README.md"))}function getDocsPath(){return resolve(join2(getPackageDir(),"docs"))}function getExamplesPath(){return resolve(join2(getPackageDir(),"examples"))}function getChangelogPath(){return resolve(join2(getPackageDir(),"CHANGELOG.md"))}var pkg={};try{pkg=JSON.parse(stripBom(readFileSync(getPackageJsonPath(),"utf-8")))}catch(e){if(e.code!=="ENOENT")throw e}var agentForgeConfigName=pkg.agentForgeConfig?.name,PACKAGE_NAME=pkg.name||"@agent-forge/agent-forge",APP_NAME=agentForgeConfigName||"agent-forge",APP_TITLE=agentForgeConfigName?APP_NAME:"Agent Forge",CONFIG_DIR_NAME=pkg.agentForgeConfig?.configDir||".agent-forge",VERSION=pkg.version||"0.0.0",ENV_APP_PREFIX=APP_NAME.toUpperCase().replace(/[^A-Z0-9]+/g,"_"),ENV_AGENT_DIR=`${ENV_APP_PREFIX}_DIR`,ENV_SESSION_DIR=`${ENV_APP_PREFIX}_SESSION_DIR`;function expandTildePath(path15){return normalizePath(path15)}function getAgentDir(){let envDir=process.env[ENV_AGENT_DIR];return envDir?expandTildePath(envDir):join2(homedir2(),CONFIG_DIR_NAME,"agent")}function getCustomThemesDir(){return join2(getAgentDir(),"themes")}function getAuthPath(){return join2(getAgentDir(),"auth.json")}function getSettingsPath(){return join2(getAgentDir(),"settings.json")}function getBinDir(){return join2(getAgentDir(),"bin")}function getSessionsDir(){return join2(getAgentDir(),"sessions")}function getDebugLogPath(){return join2(getAgentDir(),`${APP_NAME}-debug.log`)}var undici=__toESM(require_undici(),1);import{EventEmitter}from"node:events";var DEFAULT_HTTP_IDLE_TIMEOUT_MS=3e5,DEFAULT_AUTO_SELECT_FAMILY_ATTEMPT_TIMEOUT_MS=2e3,HTTP_IDLE_TIMEOUT_CHOICES=[{label:"30 sec",timeoutMs:3e4},{label:"1 min",timeoutMs:6e4},{label:"2 min",timeoutMs:12e4},{label:"5 min",timeoutMs:3e5},{label:"disabled",timeoutMs:0}],originalGlobalFetch=globalThis.fetch,installedGlobalFetch;function parseHttpIdleTimeoutMs(value){if(typeof value=="string"){let trimmed=value.trim();return trimmed.toLowerCase()==="disabled"?0:trimmed.length===0?void 0:parseHttpIdleTimeoutMs(Number(trimmed))}if(!(typeof value!="number"||!Number.isFinite(value)||value<0))return Math.floor(value)}function formatHttpIdleTimeoutMs(timeoutMs){let choice=HTTP_IDLE_TIMEOUT_CHOICES.find(item=>item.timeoutMs===timeoutMs);return choice?choice.label:`${timeoutMs/1e3} sec`}function applyHttpProxySettings(httpProxy){let proxy=httpProxy?.trim();proxy&&(process.env.HTTP_PROXY??=proxy,process.env.HTTPS_PROXY??=proxy)}var PROXY_ENV_KEYS=["HTTP_PROXY","http_proxy","HTTPS_PROXY","https_proxy"],SOCKS_URL_PATTERN=/^socks[45]?[ah]?:\/\//iu;function dropUnsupportedSocksProxyEnv(){for(let key of PROXY_ENV_KEYS){let value=process.env[key];typeof value!="string"||!SOCKS_URL_PATTERN.test(value.trim())||(console.error(`warning: ${key}=${value.trim()} is a socks proxy URL, which this tool does not support; ignoring it and connecting directly. Set it to your VPN client's http/mixed port instead (e.g. http://127.0.0.1:7897).`),delete process.env[key])}}var ignoreUndiciDispatcherError=_error=>{};function withUndiciErrorListener(dispatcher){return dispatcher instanceof EventEmitter&&EventEmitter.prototype.on.call(dispatcher,"error",ignoreUndiciDispatcherError),dispatcher}function createUndiciClient(origin,options){return withUndiciErrorListener(new undici.Client(origin,options))}function createUndiciOriginDispatcher(origin,options){let dispatcherOptions=options;return dispatcherOptions.connections===1?createUndiciClient(origin,dispatcherOptions):withUndiciErrorListener(new undici.Pool(origin,{...dispatcherOptions,factory:createUndiciClient}))}function configureHttpDispatcher(timeoutMs=DEFAULT_HTTP_IDLE_TIMEOUT_MS){let normalizedTimeoutMs=parseHttpIdleTimeoutMs(timeoutMs);if(normalizedTimeoutMs===void 0)throw new Error(`Invalid HTTP idle timeout: ${String(timeoutMs)}`);dropUnsupportedSocksProxyEnv();let dispatcher=withUndiciErrorListener(new undici.EnvHttpProxyAgent({allowH2:!1,proxyTunnel:!0,bodyTimeout:normalizedTimeoutMs,connect:{autoSelectFamilyAttemptTimeout:DEFAULT_AUTO_SELECT_FAMILY_ATTEMPT_TIMEOUT_MS},headersTimeout:normalizedTimeoutMs,clientFactory:createUndiciClient,factory:createUndiciOriginDispatcher}));undici.setGlobalDispatcher(dispatcher),(installedGlobalFetch===void 0?globalThis.fetch===originalGlobalFetch:globalThis.fetch===installedGlobalFetch)&&(undici.install?.(),installedGlobalFetch=globalThis.fetch)}var EXPERIMENTAL_PUBLIC_API_VERSION="1-draft",LifecycleTransformError=class extends Error{report;cause;constructor(cause,report){super("Lifecycle transform failed"),this.name="LifecycleTransformError",this.cause=cause,this.report=report}},LifecycleExecuteError=class extends Error{report;cause;constructor(cause,report){super("Lifecycle execute failed"),this.name="LifecycleExecuteError",this.cause=cause,this.report=report}},AGENT_TASK_CHILD_PROFILE_KEY="agent-forge.agentTaskChildProfile",AGENT_TASK_PARENT_SESSION_KEY="agent-forge.agentTaskParentSession",AGENT_TASK_PARENT_TRACE_KEY="agent-forge.agentTaskParentTrace",AGENT_TASK_RESUME_SESSION_KEY="agent-forge.agentTaskResumeSession",CHILD_PROFILE_KEYS=["version","model","thinkingLevel","tools","mode","systemPromptAppend","roleId"],CHILD_PROFILE_TOOL_LIMIT=64,CHILD_PROFILE_APPEND_CHARS=8e3,CHILD_PROFILE_THINKING_LEVELS=["minimal","low","medium","high","xhigh","max"];function parseAgentTaskChildProfileV1(value){if(value===null||typeof value!="object"||Array.isArray(value))return{ok:!1,message:"child task profile must be an object"};let record=value;for(let key of Object.keys(record))if(!CHILD_PROFILE_KEYS.includes(key))return{ok:!1,message:`child task profile has unknown key ${JSON.stringify(key)} (known: ${CHILD_PROFILE_KEYS.join(", ")})`};if(record.version!==1)return{ok:!1,message:`child task profile version must be 1, found ${JSON.stringify(record.version)}`};let model;if(record.model!==void 0){if(typeof record.model!="string"||record.model.trim()==="")return{ok:!1,message:"child task profile model must be a non-empty string"};model=record.model}let thinkingLevel;if(record.thinkingLevel!==void 0){if(typeof record.thinkingLevel!="string"||!CHILD_PROFILE_THINKING_LEVELS.includes(record.thinkingLevel))return{ok:!1,message:`child task profile thinkingLevel must be one of ${CHILD_PROFILE_THINKING_LEVELS.join(", ")}, found `+JSON.stringify(record.thinkingLevel)};thinkingLevel=record.thinkingLevel}let tools;if(record.tools!==void 0){if(!Array.isArray(record.tools)||record.tools.length>CHILD_PROFILE_TOOL_LIMIT)return{ok:!1,message:`child task profile tools must be an array of at most ${CHILD_PROFILE_TOOL_LIMIT} names`};let names2=new Set;for(let entry of record.tools){if(typeof entry!="string"||entry.trim()==="")return{ok:!1,message:"child task profile tools entries must be non-empty strings"};names2.add(entry)}tools=Object.freeze([...names2])}let mode;if(record.mode!==void 0){if(record.mode!=="readonly"&&record.mode!=="full-control")return{ok:!1,message:'child task profile mode must be "readonly" or "full-control"'};mode=record.mode}let roleId;if(record.roleId!==void 0){if(typeof record.roleId!="string"||record.roleId.trim()==="")return{ok:!1,message:"child task profile roleId must be a non-empty string"};roleId=record.roleId}let systemPromptAppend;if(record.systemPromptAppend!==void 0){if(typeof record.systemPromptAppend!="string"||record.systemPromptAppend.trim()===""||record.systemPromptAppend.length>CHILD_PROFILE_APPEND_CHARS)return{ok:!1,message:`child task profile systemPromptAppend must be a non-empty string of at most ${CHILD_PROFILE_APPEND_CHARS} chars`};systemPromptAppend=record.systemPromptAppend}return{ok:!0,profile:Object.freeze({version:1,...model===void 0?{}:{model},...thinkingLevel===void 0?{}:{thinkingLevel},...tools===void 0?{}:{tools},...mode===void 0?{}:{mode},...systemPromptAppend===void 0?{}:{systemPromptAppend},...roleId===void 0?{}:{roleId}})}}function readAgentTaskChildProfileV1(metadata){let raw=metadata?.[AGENT_TASK_CHILD_PROFILE_KEY];if(raw!==void 0)return parseAgentTaskChildProfileV1(raw)}var SUMMARY_MODEL_INVOCATION_ERROR_CODES={providerError:"summary_provider_error",lengthCap:"summary_length_cap",toolCall:"summary_tool_call",transportError:"summary_transport_error"};function createDisposableRegistration(kind,dispose,id){let disposed=!1;return{id,kind,dispose:()=>{if(!disposed)return disposed=!0,dispose()}}}function createEventEnvelope(event,options){return{...event,id:options.id,timestamp:options.timestamp??0}}function detachedSessionSnapshot(value){let clone=structuredClone(value),freeze=candidate=>{if(!(!candidate||typeof candidate!="object")&&!ArrayBuffer.isView(candidate)){for(let child of Object.values(candidate))freeze(child);Object.freeze(candidate)}};return freeze(clone),clone}var import_semver=__toESM(require_semver2(),1);function isStringArray(value){return Array.isArray(value)&&value.every(entry=>typeof entry=="string")}function isObject(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}function isJsonConfigValue(value){return value===null||typeof value=="boolean"||typeof value=="string"?!0:typeof value=="number"?Number.isFinite(value):Array.isArray(value)?value.every(isJsonConfigValue):isObject(value)?Object.values(value).every(isJsonConfigValue):!1}function assertPluginCapabilityId(value,field2,manifestPath){if(typeof value!="string"||!value.trim())throw new Error(`Capability plugin ${field2} must be a non-empty string: ${manifestPath}`)}function assertPluginCapabilityVersion(value,field2,manifestPath){if(typeof value!="number"||!Number.isSafeInteger(value)||value<1)throw new Error(`Capability plugin ${field2} must be a positive safe integer: ${manifestPath}`)}function capabilityKey(id,version){return`${id}\0${version}`}function parsePluginAgentRoles(value,manifestPath){if(value===void 0)return;if(!Array.isArray(value))throw new Error(`Capability plugin roles must be an array: ${manifestPath}`);let roles=[],seen=new Set;for(let[index3,role]of value.entries()){if(role!=="root-agent-controller"&&role!=="child-agent-controller")throw new Error(`Capability plugin roles[${index3}] is invalid: ${manifestPath}`);if(seen.has(role))throw new Error(`Capability plugin roles duplicates ${role}: ${manifestPath}`);seen.add(role),roles.push(role)}return roles}function parsePluginAgentDeclarations(value,roles,manifestPath){if(value===void 0)return;if(!Array.isArray(value))throw new Error(`Capability plugin agents must be an array: ${manifestPath}`);let declarations=[],seen=new Set;for(let[index3,candidate]of value.entries()){if(!isObject(candidate))throw new Error(`Capability plugin agents[${index3}] must be an object: ${manifestPath}`);let{id,version,role,entry}=candidate;if(assertPluginCapabilityId(id,`agents[${index3}].id`,manifestPath),assertPluginCapabilityVersion(version,`agents[${index3}].version`,manifestPath),role!=="root-agent-controller"&&role!=="child-agent-controller")throw new Error(`Capability plugin agents[${index3}].role is invalid: ${manifestPath}`);if(typeof entry!="string"||!entry.trim())throw new Error(`Capability plugin agents[${index3}].entry must be a non-empty string: ${manifestPath}`);if(roles!==void 0&&!roles.includes(role))throw new Error(`Capability plugin agents[${index3}].role is not declared in roles: ${manifestPath}`);let key=capabilityKey(id,version);if(seen.has(key))throw new Error(`Capability plugin agents duplicates ${id}@${version}: ${manifestPath}`);seen.add(key),declarations.push({id,version,role,entry})}return declarations}function parsePluginCapabilityDeclarations(value,manifestPath){if(value===void 0)return;if(!Array.isArray(value))throw new Error(`Capability plugin provides must be an array: ${manifestPath}`);let declarations=[],seen=new Set;for(let[index3,candidate]of value.entries()){if(!isObject(candidate))throw new Error(`Capability plugin provides[${index3}] must be an object: ${manifestPath}`);let{id,version,kind}=candidate;if(assertPluginCapabilityId(id,`provides[${index3}].id`,manifestPath),assertPluginCapabilityVersion(version,`provides[${index3}].version`,manifestPath),kind!=="service"&&kind!=="contribution"&&kind!=="transform")throw new Error(`Capability plugin provides[${index3}].kind is invalid: ${manifestPath}`);let key=capabilityKey(id,version);if(seen.has(key))throw new Error(`Capability plugin provides duplicates ${id}@${version}: ${manifestPath}`);seen.add(key),declarations.push({id,version,kind})}return declarations}function parsePluginCapabilityRequirements(value,manifestPath){if(value===void 0)return;if(!Array.isArray(value))throw new Error(`Capability plugin requires must be an array: ${manifestPath}`);let requirements=[],seen=new Set;for(let[index3,candidate]of value.entries()){if(!isObject(candidate))throw new Error(`Capability plugin requires[${index3}] must be an object: ${manifestPath}`);let{id,version,optional}=candidate;if(assertPluginCapabilityId(id,`requires[${index3}].id`,manifestPath),assertPluginCapabilityVersion(version,`requires[${index3}].version`,manifestPath),optional!==void 0&&typeof optional!="boolean")throw new Error(`Capability plugin requires[${index3}].optional must be a boolean: ${manifestPath}`);let key=capabilityKey(id,version);if(seen.has(key))throw new Error(`Capability plugin requires duplicates ${id}@${version}: ${manifestPath}`);seen.add(key),requirements.push(optional===void 0?{id,version}:{id,version,optional})}return requirements}function parseCapabilityPluginManifest(value,manifestPath="<manifest>"){if(!isObject(value))throw new Error(`Capability plugin manifest must be an object: ${manifestPath}`);let{id,version,hostVersion,apiVersion,entry,requiredCapabilities,optionalCapabilities,provides,requires,roles,agents,config}=value;if(typeof id!="string"||typeof version!="string"||typeof apiVersion!="string"||typeof entry!="string")throw new Error(`Capability plugin manifest requires string id, version, apiVersion, and entry: ${manifestPath}`);if(apiVersion!==EXPERIMENTAL_PUBLIC_API_VERSION)throw new Error(`Unsupported plugin API version: ${apiVersion}: ${manifestPath}`);if(hostVersion!==void 0&&(typeof hostVersion!="string"||hostVersion.trim()===""||(0,import_semver.validRange)(hostVersion)===null))throw new Error(`Capability plugin hostVersion must be a non-empty string containing a valid semver range (e.g. ">=0.84.0"): ${manifestPath}`);if(requiredCapabilities!==void 0&&!isStringArray(requiredCapabilities))throw new Error(`Capability plugin requiredCapabilities must be a string array: ${manifestPath}`);if(optionalCapabilities!==void 0&&!isStringArray(optionalCapabilities))throw new Error(`Capability plugin optionalCapabilities must be a string array: ${manifestPath}`);if(config!==void 0&&(!isObject(config)||!isJsonConfigValue(config)))throw new Error(`Capability plugin config must be a JSON object: ${manifestPath}`);let parsedProvides=parsePluginCapabilityDeclarations(provides,manifestPath),parsedRequires=parsePluginCapabilityRequirements(requires,manifestPath),parsedRoles=parsePluginAgentRoles(roles,manifestPath),parsedAgents=parsePluginAgentDeclarations(agents,parsedRoles,manifestPath);return{id,version,apiVersion,entry,requiredCapabilities,optionalCapabilities,...hostVersion===void 0?{}:{hostVersion},...parsedProvides===void 0?{}:{provides:parsedProvides},...parsedRequires===void 0?{}:{requires:parsedRequires},...parsedRoles===void 0?{}:{roles:parsedRoles},...parsedAgents===void 0?{}:{agents:parsedAgents},...config===void 0?{}:{config}}}var MEMORY_RECALL_TOOL_NAME="memory_recall";var dist_exports={};__export(dist_exports,{AGENT_TASK_CHILD_PROFILE_KEY:()=>AGENT_TASK_CHILD_PROFILE_KEY,AGENT_TASK_PARENT_SESSION_KEY:()=>AGENT_TASK_PARENT_SESSION_KEY,AGENT_TASK_PARENT_TRACE_KEY:()=>AGENT_TASK_PARENT_TRACE_KEY,AGENT_TASK_RESUME_SESSION_KEY:()=>AGENT_TASK_RESUME_SESSION_KEY,DEFAULT_PLUGIN_CONTEXT_BUDGET_V1:()=>DEFAULT_PLUGIN_CONTEXT_BUDGET_V1,EXPERIMENTAL_PUBLIC_API_VERSION:()=>EXPERIMENTAL_PUBLIC_API_VERSION,LifecycleExecuteError:()=>LifecycleExecuteError,LifecycleTransformError:()=>LifecycleTransformError,MAX_ARTIFACT_METADATA_CHARS_V1:()=>MAX_ARTIFACT_METADATA_CHARS_V1,MAX_ARTIFACT_REF_CHARS_V1:()=>MAX_ARTIFACT_REF_CHARS_V1,MEMORY_RECALL_TOOL_NAME:()=>MEMORY_RECALL_TOOL_NAME,PLUGIN_OPERATION_TERMINAL_STATUSES_V1:()=>PLUGIN_OPERATION_TERMINAL_STATUSES_V1,PLUGIN_SHARED_CONTRACT_VERSION_V1:()=>PLUGIN_SHARED_CONTRACT_VERSION_V1,SUMMARY_MODEL_INVOCATION_ERROR_CODES:()=>SUMMARY_MODEL_INVOCATION_ERROR_CODES,TRACE_KINDS_V1:()=>TRACE_KINDS_V1,artifactRefKeyV1:()=>artifactRefKeyV1,assertExactKeys:()=>assertExactKeys,assertFiniteNumber:()=>assertFiniteNumber,assertJsonResultInputV1:()=>assertJsonResultInputV1,assertJsonValue:()=>assertJsonValue,assertNonEmptyString:()=>assertNonEmptyString,assertNonNegativeNumber:()=>assertNonNegativeNumber,assertNonNegativeSafeInteger:()=>assertNonNegativeSafeInteger,assertOptionalString:()=>assertOptionalString,assertPlainRecord:()=>assertPlainRecord,assertPositiveSafeInteger:()=>assertPositiveSafeInteger,buildArtifactRefV1:()=>buildArtifactRefV1,buildDiffRequestV1:()=>buildDiffRequestV1,buildDiffResultV1:()=>buildDiffResultV1,buildEvidenceRefV1:()=>buildEvidenceRefV1,buildPluginErrorV1:()=>buildPluginErrorV1,buildPluginOperationV1:()=>buildPluginOperationV1,buildPluginResultV1:()=>buildPluginResultV1,buildRenderRequestV1:()=>buildRenderRequestV1,buildRenderResultV1:()=>buildRenderResultV1,buildVerificationV1:()=>buildVerificationV1,createDisposableRegistration:()=>createDisposableRegistration,createEventEnvelope:()=>createEventEnvelope,detachedFreeze:()=>detachedFreeze,detachedSessionSnapshot:()=>detachedSessionSnapshot,isArtifactRefV1:()=>isArtifactRefV1,isPlainRecord:()=>isPlainRecord,parseAgentTaskChildProfileV1:()=>parseAgentTaskChildProfileV1,parseCapabilityPluginManifest:()=>parseCapabilityPluginManifest,projectPluginContextV1:()=>projectPluginContextV1,readAgentTaskChildProfileV1:()=>readAgentTaskChildProfileV1,sortByKey:()=>sortByKey,stableStringifyV1:()=>stableStringifyV1,validateArtifactRefV1:()=>validateArtifactRefV1,validateDiffRequestV1:()=>validateDiffRequestV1,validateDiffResultV1:()=>validateDiffResultV1,validateEvidenceRefV1:()=>validateEvidenceRefV1,validatePluginErrorV1:()=>validatePluginErrorV1,validatePluginOperationV1:()=>validatePluginOperationV1,validatePluginResultV1:()=>validatePluginResultV1,validateRenderRequestV1:()=>validateRenderRequestV1,validateRenderResultV1:()=>validateRenderResultV1,validateVerificationV1:()=>validateVerificationV1});var PLUGIN_SHARED_CONTRACT_VERSION_V1=1;function isPlainRecord(value){if(value===null||typeof value!="object"||Array.isArray(value))return!1;let prototype=Object.getPrototypeOf(value);return prototype===Object.prototype||prototype===null}function assertPlainRecord(value,label){if(!isPlainRecord(value))throw new Error(`${label} must be a plain object`)}function assertExactKeys(value,required,optional,label){let allowed=new Set([...required,...optional]),unsupported=Object.keys(value).filter(key=>!allowed.has(key)).sort();if(unsupported.length>0)throw new Error(`${label} has unsupported fields: ${unsupported.join(", ")}`);for(let key of required)if(!(key in value))throw new Error(`${label} is missing required field: ${key}`)}function assertNonEmptyString(value,label){if(typeof value!="string"||value.trim().length===0)throw new Error(`${label} must be a non-empty string`)}function assertOptionalString(value,label){value!==void 0&&assertNonEmptyString(value,label)}function assertFiniteNumber(value,label){if(typeof value!="number"||!Number.isFinite(value))throw new Error(`${label} must be a finite number`)}function assertNonNegativeNumber(value,label){if(assertFiniteNumber(value,label),value<0)throw new Error(`${label} must be non-negative`)}function assertPositiveSafeInteger(value,label){if(typeof value!="number"||!Number.isSafeInteger(value)||value<1)throw new Error(`${label} must be a positive safe integer`)}function assertNonNegativeSafeInteger(value,label){if(typeof value!="number"||!Number.isSafeInteger(value)||value<0)throw new Error(`${label} must be a non-negative safe integer`)}function assertJsonValue(value,label,seen=new WeakSet){if(!(value===null||typeof value=="boolean"||typeof value=="string")){if(typeof value=="number"){if(Number.isFinite(value))return;throw new Error(`${label} must contain finite JSON numbers`)}if(typeof value!="object")throw new Error(`${label} must be JSON-compatible`);if(seen.has(value))throw new Error(`${label} must not contain cycles`);if(seen.add(value),Array.isArray(value))for(let[index3,child]of value.entries())assertJsonValue(child,`${label}[${index3}]`,seen);else{if(!isPlainRecord(value))throw new Error(`${label} must contain only plain JSON objects`);for(let[key,child]of Object.entries(value))assertJsonValue(child,`${label}.${key}`,seen)}seen.delete(value)}}function detachedFreeze(value,seen=new WeakMap){if(value===null||typeof value!="object")return value;let existing=seen.get(value);if(existing!==void 0)return existing;if(Array.isArray(value)){let result2=[];seen.set(value,result2);for(let child of value)result2.push(detachedFreeze(child,seen));return Object.freeze(result2)}let result={};seen.set(value,result);for(let key of Object.keys(value).sort())result[key]=detachedFreeze(value[key],seen);return Object.freeze(result)}function sortByKey(values,key){return[...values].sort((left,right)=>{let a=key(left),b2=key(right);return a<b2?-1:a>b2?1:0})}function stableStringifyV1(value){return value===null||typeof value=="boolean"||typeof value=="number"||typeof value=="string"?JSON.stringify(value):Array.isArray(value)?`[${value.map(item=>stableStringifyV1(item)).join(",")}]`:`{${Object.entries(value).sort(([a],[b2])=>a<b2?-1:a>b2?1:0).map(([key,item])=>`${JSON.stringify(key)}:${stableStringifyV1(item)}`).join(",")}}`}var MAX_ARTIFACT_REF_CHARS_V1=2048,MAX_ARTIFACT_METADATA_CHARS_V1=256;function validateBoundedString(value,label,maximum){if(assertNonEmptyString(value,label),value.length>maximum)throw new Error(`${label} exceeds the context budget (${maximum} characters)`);return value}function validateDigest(value,label){if(value!==void 0)return validateBoundedString(value,label,MAX_ARTIFACT_METADATA_CHARS_V1)}function validateArtifactRefV1(value,label="Artifact reference"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","artifactRef","kind","mimeType"],["digest","sizeBytes","operationId","pluginId"],label),value.version!==1)throw new Error(`${label}.version must be 1`);let artifactRef=validateBoundedString(value.artifactRef,`${label}.artifactRef`,MAX_ARTIFACT_REF_CHARS_V1);if(/^(?:file:|[a-zA-Z]:[\\/]|[\\/]{1,2}|\\\\)/iu.test(artifactRef))throw new Error(`${label}.artifactRef must be an opaque reference, not a local path`);let kind=validateBoundedString(value.kind,`${label}.kind`,MAX_ARTIFACT_METADATA_CHARS_V1),mimeType=validateBoundedString(value.mimeType,`${label}.mimeType`,MAX_ARTIFACT_METADATA_CHARS_V1),digest=validateDigest(value.digest,`${label}.digest`);value.sizeBytes!==void 0&&assertNonNegativeSafeInteger(value.sizeBytes,`${label}.sizeBytes`);let operationId=value.operationId===void 0?void 0:validateBoundedString(value.operationId,`${label}.operationId`,MAX_ARTIFACT_METADATA_CHARS_V1),pluginId=value.pluginId===void 0?void 0:validateBoundedString(value.pluginId,`${label}.pluginId`,MAX_ARTIFACT_METADATA_CHARS_V1);return detachedFreeze({version:1,artifactRef,kind,mimeType,...digest===void 0?{}:{digest},...value.sizeBytes===void 0?{}:{sizeBytes:value.sizeBytes},...operationId===void 0?{}:{operationId},...pluginId===void 0?{}:{pluginId}})}function buildArtifactRefV1(input){return validateArtifactRefV1(input)}function isArtifactRefV1(value){try{return validateArtifactRefV1(value),!0}catch{return!1}}function artifactRefKeyV1(ref){return ref.artifactRef}var DEFAULT_PLUGIN_CONTEXT_BUDGET_V1=Object.freeze({maxOutputBytes:65536,maxInlineItems:20,maxCellChars:256});function error(code,message){return{version:1,code,message}}function isRecord(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)}function assertPositiveInteger(value,label){if(!Number.isSafeInteger(value)||value<=0)throw new Error(`${label} must be a positive safe integer`)}function assertNonNegativeInteger(value,label){if(!Number.isSafeInteger(value)||value<0)throw new Error(`${label} must be a non-negative safe integer`)}function isJsonValue(value){return value===null||typeof value=="string"||typeof value=="boolean"?!0:typeof value=="number"?Number.isFinite(value):Array.isArray(value)?value.every(isJsonValue):isRecord(value)?Object.values(value).every(isJsonValue):!1}function containsRawPayload(value,seen=new Set){if(!isRecord(value)&&!Array.isArray(value)||seen.has(value))return!1;if(seen.add(value),isRecord(value)){for(let[key,child]of Object.entries(value))if((key==="rows"||key==="rawRows"||key==="rawPayload"||key==="payload")&&child!==void 0||containsRawPayload(child,seen))return!0;return!1}return value.some(child=>containsRawPayload(child,seen))}function validateBudget(input){let budget={...DEFAULT_PLUGIN_CONTEXT_BUDGET_V1,...input??{}};return assertPositiveInteger(budget.maxOutputBytes,"maxOutputBytes"),assertNonNegativeInteger(budget.maxInlineItems,"maxInlineItems"),assertPositiveInteger(budget.maxCellChars,"maxCellChars"),Object.freeze(budget)}function boundStrings(value,maxCellChars){if(typeof value=="string"){if([...value].length>maxCellChars)throw new Error("context string exceeds maxCellChars");return value}return Array.isArray(value)?Object.freeze(value.map(child=>boundStrings(child,maxCellChars))):isRecord(value)?Object.freeze(Object.fromEntries(Object.entries(value).map(([key,child])=>[key,boundStrings(child,maxCellChars)]))):value}function invalid(operationId,code,message){return Object.freeze({version:1,operationId,status:"failed",inlineItems:Object.freeze([]),truncated:!1,error:error(code,message)})}function projectPluginContextV1(input,limits){let operationId=isRecord(input)&&typeof input.operationId=="string"?input.operationId:"invalid";try{if(!isRecord(input)||input.version!==1)throw new Error("input must have version 1");if(typeof input.operationId!="string"||input.operationId.trim()==="")throw new Error("operationId must be a non-empty string");if(!Array.isArray(input.items))throw new Error("items must be an array");let budget=validateBudget(limits);if(containsRawPayload(input.items))throw new Error("raw payloads are not allowed in plugin context");if(input.outputArtifactRef!==void 0){if(typeof input.outputArtifactRef!="string"||input.outputArtifactRef.trim()==="")throw new Error("outputArtifactRef must be a non-empty string");if(/^(?:[a-zA-Z]:[\\/]|[\\/]{1,2}|\\\\)/.test(input.outputArtifactRef))throw new Error("outputArtifactRef must be opaque")}let items=input.items.map((item,index3)=>{if(!isJsonValue(item))throw new Error(`items[${index3}] must be JSON-safe`);return boundStrings(item,budget.maxCellChars)}),truncated=input.truncated===!0||items.length>budget.maxInlineItems,inlineItems=Object.freeze(items.slice(0,budget.maxInlineItems)),result=Object.freeze({version:1,operationId:input.operationId,status:"succeeded",inlineItems,truncated,...input.outputArtifactRef===void 0?{}:{outputArtifactRef:input.outputArtifactRef}});if(new TextEncoder().encode(JSON.stringify(result)).byteLength>budget.maxOutputBytes)throw new Error("projected context exceeds maxOutputBytes");return result}catch(cause){return invalid(operationId,"context_projection_rejected",cause instanceof Error?cause.message:"Context projection rejected")}}var PLUGIN_OPERATION_TERMINAL_STATUSES_V1=["succeeded","failed","cancelled","needs_user","unsupported"],EVIDENCE_KINDS_V1=["screenshot","dom","render","diff","log","assertion","trace","network","structure"],OPERATION_STATUSES_V1=["queued","running","succeeded","failed","cancelled","needs_user","unsupported"],RESULT_STATUSES_V1=["succeeded","failed","cancelled","needs_user","unsupported"];function validateStatus(value,label,values){if(typeof value!="string"||!values.includes(value))throw new Error(`${label} is invalid`);return value}function validateIsoLike(value,label){if(value!==void 0)return assertNonEmptyString(value,label),value}function validateArtifactArray(value,label){if(!Array.isArray(value))throw new Error(`${label} must be an array`);let result=value.map((item,index3)=>validateArtifactRefV1(item,`${label}[${index3}]`));if(new Set(result.map(item=>item.artifactRef)).size!==result.length)throw new Error(`${label} must not contain duplicate artifactRef values`);return Object.freeze(sortByKey(result,item=>item.artifactRef))}function validatePluginOperationV1(value,label="Plugin operation"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","operationId","pluginId","kind","status"],["inputArtifacts","outputArtifacts","startedAt","endedAt"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.operationId,`${label}.operationId`),assertNonEmptyString(value.pluginId,`${label}.pluginId`),assertNonEmptyString(value.kind,`${label}.kind`);let status2=validateStatus(value.status,`${label}.status`,OPERATION_STATUSES_V1),inputArtifacts=value.inputArtifacts===void 0?void 0:validateArtifactArray(value.inputArtifacts,`${label}.inputArtifacts`),outputArtifacts=value.outputArtifacts===void 0?void 0:validateArtifactArray(value.outputArtifacts,`${label}.outputArtifacts`),startedAt=validateIsoLike(value.startedAt,`${label}.startedAt`),endedAt=validateIsoLike(value.endedAt,`${label}.endedAt`);if(endedAt!==void 0&&startedAt===void 0)throw new Error(`${label}.endedAt requires startedAt`);if(status2==="running"&&endedAt!==void 0)throw new Error(`${label}.running must not have endedAt`);return detachedFreeze({version:1,operationId:value.operationId,pluginId:value.pluginId,kind:value.kind,status:status2,...inputArtifacts===void 0?{}:{inputArtifacts},...outputArtifacts===void 0?{}:{outputArtifacts},...startedAt===void 0?{}:{startedAt},...endedAt===void 0?{}:{endedAt}})}function buildPluginOperationV1(input){return validatePluginOperationV1(input)}function validateEvidenceRefV1(value,label="Evidence reference"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","evidenceId","kind","operationId"],["artifactRef","summary","observedAt"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.evidenceId,`${label}.evidenceId`);let kind=validateStatus(value.kind,`${label}.kind`,EVIDENCE_KINDS_V1);assertNonEmptyString(value.operationId,`${label}.operationId`);let artifactRef=value.artifactRef===void 0?void 0:validateArtifactRefV1(value.artifactRef,`${label}.artifactRef`);assertOptionalString(value.summary,`${label}.summary`);let observedAt=validateIsoLike(value.observedAt,`${label}.observedAt`);return detachedFreeze({version:1,evidenceId:value.evidenceId,kind,operationId:value.operationId,...artifactRef===void 0?{}:{artifactRef},...value.summary===void 0?{}:{summary:value.summary},...observedAt===void 0?{}:{observedAt}})}function buildEvidenceRefV1(input){return validateEvidenceRefV1(input)}function validateVerificationV1(value,label="Verification"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","status","checks"],[],label),value.version!==1)throw new Error(`${label}.version must be 1`);let status2=validateStatus(value.status,`${label}.status`,["passed","failed","unknown"]);if(!Array.isArray(value.checks)||value.checks.some(item=>typeof item!="string"||item.trim()===""))throw new Error(`${label}.checks must contain non-empty strings`);if(new Set(value.checks).size!==value.checks.length)throw new Error(`${label}.checks must not contain duplicates`);return detachedFreeze({version:1,status:status2,checks:[...value.checks].sort()})}function buildVerificationV1(input){return validateVerificationV1(input)}function validatePluginErrorV1(value,label="Plugin error"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","code","message"],["causeCode","diagnosticRef"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.code,`${label}.code`),assertNonEmptyString(value.message,`${label}.message`),assertOptionalString(value.causeCode,`${label}.causeCode`);let diagnosticRef=value.diagnosticRef===void 0?void 0:validateArtifactRefV1(value.diagnosticRef,`${label}.diagnosticRef`);return detachedFreeze({version:1,code:value.code,message:value.message,...value.causeCode===void 0?{}:{causeCode:value.causeCode},...diagnosticRef===void 0?{}:{diagnosticRef}})}function buildPluginErrorV1(input){return validatePluginErrorV1(input)}function validatePluginResultV1(value,label="Plugin result"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","operationId","status","summary","artifacts","evidence"],["verification","error"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.operationId,`${label}.operationId`);let status2=validateStatus(value.status,`${label}.status`,RESULT_STATUSES_V1);assertNonEmptyString(value.summary,`${label}.summary`);let artifacts=validateArtifactArray(value.artifacts,`${label}.artifacts`);if(!Array.isArray(value.evidence))throw new Error(`${label}.evidence must be an array`);let evidence=value.evidence.map((item,index3)=>validateEvidenceRefV1(item,`${label}.evidence[${index3}]`));if(new Set(evidence.map(item=>item.evidenceId)).size!==evidence.length)throw new Error(`${label}.evidence must not contain duplicate evidenceId values`);let orderedEvidence=Object.freeze(sortByKey(evidence,item=>item.evidenceId)),verification=value.verification===void 0?void 0:validateVerificationV1(value.verification,`${label}.verification`),error2=value.error===void 0?void 0:validatePluginErrorV1(value.error,`${label}.error`);if(status2!=="succeeded"&&error2===void 0)throw new Error(`${label}.error is required for status ${status2}`);if(status2==="succeeded"&&error2!==void 0)throw new Error(`${label}.succeeded must not include error`);if(status2==="succeeded"&&verification?.status==="failed")throw new Error(`${label}.succeeded cannot have failed verification`);return detachedFreeze({version:1,operationId:value.operationId,status:status2,summary:value.summary,artifacts,evidence:orderedEvidence,...verification===void 0?{}:{verification},...error2===void 0?{}:{error:error2}})}function buildPluginResultV1(input){return validatePluginResultV1(input)}function assertJsonResultInputV1(value,label="Result input"){return assertJsonValue(value,label),detachedFreeze(value)}var DIFF_MAX_ITEMS_V1=64,DIFF_MAX_STRING_CHARS_V1=2048,DIFF_MAX_RESULT_BYTES_V1=64*1024;function validateBoundedString2(value,label){if(assertNonEmptyString(value,label),value.length>DIFF_MAX_STRING_CHARS_V1)throw new Error(`${label} exceeds the context budget`)}var DIFF_KINDS_V1=["text","dom","structure","pixel","style"],RESULT_STATUSES_V12=["succeeded","failed","cancelled","needs_user","unsupported"];function validateKind(value,label){if(typeof value!="string"||!DIFF_KINDS_V1.includes(value))throw new Error(`${label} is invalid`);return value}function validateStatus2(value,label){if(typeof value!="string"||!RESULT_STATUSES_V12.includes(value))throw new Error(`${label} is invalid`);return value}function validateMetrics(value,label){if(assertPlainRecord(value,label),assertExactKeys(value,[],["changedPixels","changedRatio","selector"],label),value.changedPixels!==void 0&&(typeof value.changedPixels!="number"||!Number.isSafeInteger(value.changedPixels)||value.changedPixels<0))throw new Error(`${label}.changedPixels must be a non-negative safe integer`);if(value.changedRatio!==void 0&&(assertNonNegativeNumber(value.changedRatio,`${label}.changedRatio`),value.changedRatio>1))throw new Error(`${label}.changedRatio must be at most 1`);return value.selector!==void 0&&validateBoundedString2(value.selector,`${label}.selector`),detachedFreeze({...value.changedPixels===void 0?{}:{changedPixels:value.changedPixels},...value.changedRatio===void 0?{}:{changedRatio:value.changedRatio},...value.selector===void 0?{}:{selector:value.selector}})}function validateThreshold(value,label){if(assertPlainRecord(value,label),assertExactKeys(value,[],["maxChangedPixels","maxChangedRatio","allowedSelectors"],label),value.maxChangedPixels!==void 0&&(typeof value.maxChangedPixels!="number"||!Number.isSafeInteger(value.maxChangedPixels)||value.maxChangedPixels<0))throw new Error(`${label}.maxChangedPixels must be a non-negative safe integer`);if(value.maxChangedRatio!==void 0&&(assertNonNegativeNumber(value.maxChangedRatio,`${label}.maxChangedRatio`),value.maxChangedRatio>1))throw new Error(`${label}.maxChangedRatio must be at most 1`);if(value.allowedSelectors!==void 0){if(!Array.isArray(value.allowedSelectors)||value.allowedSelectors.some(item=>typeof item!="string"||item.trim()===""))throw new Error(`${label}.allowedSelectors must contain non-empty strings`);if(new Set(value.allowedSelectors).size!==value.allowedSelectors.length)throw new Error(`${label}.allowedSelectors must not contain duplicates`);if(value.allowedSelectors.length>DIFF_MAX_ITEMS_V1)throw new Error(`${label}.allowedSelectors must contain at most ${DIFF_MAX_ITEMS_V1} items`);for(let[index3,selector]of value.allowedSelectors.entries())validateBoundedString2(selector,`${label}.allowedSelectors[${index3}]`)}return detachedFreeze({...value.maxChangedPixels===void 0?{}:{maxChangedPixels:value.maxChangedPixels},...value.maxChangedRatio===void 0?{}:{maxChangedRatio:value.maxChangedRatio},...value.allowedSelectors===void 0?{}:{allowedSelectors:[...value.allowedSelectors].sort()}})}function validateDiffRequestV1(value,label="Diff request"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","operationId","kind","before","after"],["threshold"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.operationId,`${label}.operationId`);let kind=validateKind(value.kind,`${label}.kind`),before=validateArtifactRefV1(value.before,`${label}.before`),after=validateArtifactRefV1(value.after,`${label}.after`);if(before.artifactRef===after.artifactRef)throw new Error(`${label}.before and after must differ`);let threshold=value.threshold===void 0?void 0:validateThreshold(value.threshold,`${label}.threshold`);return detachedFreeze({version:1,operationId:value.operationId,kind,before,after,...threshold===void 0?{}:{threshold}})}function buildDiffRequestV1(input){return validateDiffRequestV1(input)}function validateDiffResultV1(value,label="Diff result"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","operationId","status","kind","summary","evidence"],["diffArtifact","metrics","verification","error"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.operationId,`${label}.operationId`);let resultStatus=validateStatus2(value.status,`${label}.status`),kind=validateKind(value.kind,`${label}.kind`);validateBoundedString2(value.summary,`${label}.summary`);let metrics=value.metrics===void 0?void 0:validateMetrics(value.metrics,`${label}.metrics`),diffArtifact=value.diffArtifact===void 0?void 0:validateArtifactRefV1(value.diffArtifact,`${label}.diffArtifact`);if(!Array.isArray(value.evidence))throw new Error(`${label}.evidence must be an array`);if(value.evidence.length>DIFF_MAX_ITEMS_V1)throw new Error(`${label}.evidence must contain at most ${DIFF_MAX_ITEMS_V1} items`);let evidence=value.evidence.map((item,index3)=>validateEvidenceRefV1(item,`${label}.evidence[${index3}]`));if(new Set(evidence.map(item=>item.evidenceId)).size!==evidence.length)throw new Error(`${label}.evidence must not contain duplicate evidenceId values`);for(let[index3,item]of evidence.entries())validateBoundedString2(item.evidenceId,`${label}.evidence[${index3}].evidenceId`),item.summary!==void 0&&validateBoundedString2(item.summary,`${label}.evidence[${index3}].summary`),item.observedAt!==void 0&&validateBoundedString2(item.observedAt,`${label}.evidence[${index3}].observedAt`);let orderedEvidence=Object.freeze([...evidence].sort((a,b2)=>a.evidenceId.localeCompare(b2.evidenceId))),verification=value.verification===void 0?void 0:validateVerificationV1(value.verification,`${label}.verification`),error2=value.error===void 0?void 0:validatePluginErrorV1(value.error,`${label}.error`);if(resultStatus!=="succeeded"&&error2===void 0)throw new Error(`${label}.error is required for status ${resultStatus}`);if(resultStatus==="succeeded"&&error2!==void 0)throw new Error(`${label}.succeeded must not include error`);if(resultStatus==="succeeded"&&verification?.status==="failed")throw new Error(`${label}.succeeded cannot have failed verification`);let result={version:1,operationId:value.operationId,status:resultStatus,kind,summary:value.summary,...metrics===void 0?{}:{metrics},...diffArtifact===void 0?{}:{diffArtifact},evidence:orderedEvidence,...verification===void 0?{}:{verification},...error2===void 0?{}:{error:error2}};if(new TextEncoder().encode(JSON.stringify(result)).byteLength>DIFF_MAX_RESULT_BYTES_V1)throw new Error(`${label} exceeds the context budget`);return detachedFreeze(result)}function buildDiffResultV1(input){return validateDiffResultV1(input)}var TRACE_KINDS_V1=["session.start","turn.span","llm.request","llm.response","tool.span","lifecycle","error","decision","plugin.log"];var SURFACES_V1=["html","browser","docx","xlsx","pdf","pptx","image"],STATUSES_V1=["succeeded","failed","cancelled","needs_user","unsupported"];function status(value,label){if(typeof value!="string"||!STATUSES_V1.includes(value))throw new Error(`${label} is invalid`);return value}function artifactArray(value,label){if(!Array.isArray(value))throw new Error(`${label} must be an array`);let items=value.map((item,index3)=>validateArtifactRefV1(item,`${label}[${index3}]`));if(new Set(items.map(item=>item.artifactRef)).size!==items.length)throw new Error(`${label} must not contain duplicate artifactRef values`);return Object.freeze([...items].sort((a,b2)=>a.artifactRef.localeCompare(b2.artifactRef)))}function evidenceArray(value,label){if(!Array.isArray(value))throw new Error(`${label} must be an array`);let items=value.map((item,index3)=>validateEvidenceRefV1(item,`${label}[${index3}]`));if(new Set(items.map(item=>item.evidenceId)).size!==items.length)throw new Error(`${label} must not contain duplicate evidenceId values`);return Object.freeze([...items].sort((a,b2)=>a.evidenceId.localeCompare(b2.evidenceId)))}function validateViewport(value,label){if(assertPlainRecord(value,label),assertExactKeys(value,["width","height"],["deviceScaleFactor"],label),assertNonNegativeNumber(value.width,`${label}.width`),assertNonNegativeNumber(value.height,`${label}.height`),value.width===0||value.height===0)throw new Error(`${label} dimensions must be greater than zero`);if(value.deviceScaleFactor!==void 0&&(assertFiniteNumber(value.deviceScaleFactor,`${label}.deviceScaleFactor`),value.deviceScaleFactor<=0))throw new Error(`${label}.deviceScaleFactor must be greater than zero`);return detachedFreeze({width:value.width,height:value.height,...value.deviceScaleFactor===void 0?{}:{deviceScaleFactor:value.deviceScaleFactor}})}function validateRenderRequestV1(value,label="Render request"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","operationId","source","surface"],["page","viewport","options"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.operationId,`${label}.operationId`);let source=validateArtifactRefV1(value.source,`${label}.source`);if(typeof value.surface!="string"||!SURFACES_V1.includes(value.surface))throw new Error(`${label}.surface is invalid`);let surface=value.surface;value.page!==void 0&&assertNonNegativeSafeInteger(value.page,`${label}.page`);let viewport=value.viewport===void 0?void 0:validateViewport(value.viewport,`${label}.viewport`);return value.options!==void 0&&assertJsonValue(value.options,`${label}.options`),detachedFreeze({version:1,operationId:value.operationId,source,surface,...value.page===void 0?{}:{page:value.page},...viewport===void 0?{}:{viewport},...value.options===void 0?{}:{options:value.options}})}function buildRenderRequestV1(input){return validateRenderRequestV1(input)}function validateRenderResultV1(value,label="Render result"){if(assertPlainRecord(value,label),assertExactKeys(value,["version","operationId","status","renderer","artifacts","evidence","summary"],["verification","error"],label),value.version!==1)throw new Error(`${label}.version must be 1`);assertNonEmptyString(value.operationId,`${label}.operationId`);let resultStatus=status(value.status,`${label}.status`);assertPlainRecord(value.renderer,`${label}.renderer`),assertExactKeys(value.renderer,["id","version"],[],`${label}.renderer`),assertNonEmptyString(value.renderer.id,`${label}.renderer.id`),assertNonEmptyString(value.renderer.version,`${label}.renderer.version`);let artifacts=artifactArray(value.artifacts,`${label}.artifacts`),evidence=evidenceArray(value.evidence,`${label}.evidence`);assertNonEmptyString(value.summary,`${label}.summary`);let verification=value.verification===void 0?void 0:validateVerificationV1(value.verification,`${label}.verification`),error2=value.error===void 0?void 0:validatePluginErrorV1(value.error,`${label}.error`);if(resultStatus!=="succeeded"&&error2===void 0)throw new Error(`${label}.error is required for status ${resultStatus}`);if(resultStatus==="succeeded"&&error2!==void 0)throw new Error(`${label}.succeeded must not include error`);if(resultStatus==="succeeded"&&verification?.status==="failed")throw new Error(`${label}.succeeded cannot have failed verification`);return detachedFreeze({version:1,operationId:value.operationId,status:resultStatus,renderer:{id:value.renderer.id,version:value.renderer.version},artifacts,evidence,summary:value.summary,...verification===void 0?{}:{verification},...error2===void 0?{}:{error:error2}})}function buildRenderResultV1(input){return validateRenderResultV1(input)}var wrapAnsi16=(offset=0)=>code=>`\x1B[${code+offset}m`,wrapAnsi256=(offset=0)=>code=>`\x1B[${38+offset};5;${code}m`,wrapAnsi16m=(offset=0)=>(red,green,blue)=>`\x1B[${38+offset};2;${red};${green};${blue}m`,styles={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},modifierNames=Object.keys(styles.modifier),foregroundColorNames=Object.keys(styles.color),backgroundColorNames=Object.keys(styles.bgColor),colorNames=[...foregroundColorNames,...backgroundColorNames];function assembleStyles(){let codes=new Map;for(let[groupName,group]of Object.entries(styles)){for(let[styleName,style]of Object.entries(group))styles[styleName]={open:`\x1B[${style[0]}m`,close:`\x1B[${style[1]}m`},group[styleName]=styles[styleName],codes.set(style[0],style[1]);Object.defineProperty(styles,groupName,{value:group,enumerable:!1})}return Object.defineProperty(styles,"codes",{value:codes,enumerable:!1}),styles.color.close="\x1B[39m",styles.bgColor.close="\x1B[49m",styles.color.ansi=wrapAnsi16(),styles.color.ansi256=wrapAnsi256(),styles.color.ansi16m=wrapAnsi16m(),styles.bgColor.ansi=wrapAnsi16(10),styles.bgColor.ansi256=wrapAnsi256(10),styles.bgColor.ansi16m=wrapAnsi16m(10),Object.defineProperties(styles,{rgbToAnsi256:{value(red,green,blue){return red===green&&green===blue?red<8?16:red>248?231:Math.round((red-8)/247*24)+232:16+36*Math.round(red/255*5)+6*Math.round(green/255*5)+Math.round(blue/255*5)},enumerable:!1},hexToRgb:{value(hex){let matches=/[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));if(!matches)return[0,0,0];let[colorString]=matches;colorString.length===3&&(colorString=[...colorString].map(character=>character+character).join(""));let integer=Number.parseInt(colorString,16);return[integer>>16&255,integer>>8&255,integer&255]},enumerable:!1},hexToAnsi256:{value:hex=>styles.rgbToAnsi256(...styles.hexToRgb(hex)),enumerable:!1},ansi256ToAnsi:{value(code){if(code<8)return 30+code;if(code<16)return 90+(code-8);let red,green,blue;if(code>=232)red=((code-232)*10+8)/255,green=red,blue=red;else{code-=16;let remainder=code%36;red=Math.floor(code/36)/5,green=Math.floor(remainder/6)/5,blue=remainder%6/5}let value=Math.max(red,green,blue)*2;if(value===0)return 30;let result=30+(Math.round(blue)<<2|Math.round(green)<<1|Math.round(red));return value===2&&(result+=60),result},enumerable:!1},rgbToAnsi:{value:(red,green,blue)=>styles.ansi256ToAnsi(styles.rgbToAnsi256(red,green,blue)),enumerable:!1},hexToAnsi:{value:hex=>styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),enumerable:!1}}),styles}var ansiStyles=assembleStyles(),ansi_styles_default=ansiStyles;import process2 from"node:process";import os from"node:os";import tty from"node:tty";function hasFlag(flag,argv=globalThis.Deno?globalThis.Deno.args:process2.argv){let prefix=flag.startsWith("-")?"":flag.length===1?"-":"--",position=argv.indexOf(prefix+flag),terminatorPosition=argv.indexOf("--");return position!==-1&&(terminatorPosition===-1||position<terminatorPosition)}var{env}=process2,flagForceColor;hasFlag("no-color")||hasFlag("no-colors")||hasFlag("color=false")||hasFlag("color=never")?flagForceColor=0:(hasFlag("color")||hasFlag("colors")||hasFlag("color=true")||hasFlag("color=always"))&&(flagForceColor=1);function envForceColor(){if("FORCE_COLOR"in env)return env.FORCE_COLOR==="true"?1:env.FORCE_COLOR==="false"?0:env.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(env.FORCE_COLOR,10),3)}function translateLevel(level){return level===0?!1:{level,hasBasic:!0,has256:level>=2,has16m:level>=3}}function _supportsColor(haveStream,{streamIsTTY,sniffFlags=!0}={}){let noFlagForceColor=envForceColor();noFlagForceColor!==void 0&&(flagForceColor=noFlagForceColor);let forceColor=sniffFlags?flagForceColor:noFlagForceColor;if(forceColor===0)return 0;if(sniffFlags){if(hasFlag("color=16m")||hasFlag("color=full")||hasFlag("color=truecolor"))return 3;if(hasFlag("color=256"))return 2}if("TF_BUILD"in env&&"AGENT_NAME"in env)return 1;if(haveStream&&!streamIsTTY&&forceColor===void 0)return 0;let min=forceColor||0;if(env.TERM==="dumb")return min;if(process2.platform==="win32"){let osRelease=os.release().split(".");return Number(osRelease[0])>=10&&Number(osRelease[2])>=10586?Number(osRelease[2])>=14931?3:2:1}if("CI"in env)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(key=>key in env)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(sign=>sign in env)||env.CI_NAME==="codeship"?1:min;if("TEAMCITY_VERSION"in env)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION)?1:0;if(env.COLORTERM==="truecolor"||env.TERM==="xterm-kitty"||env.TERM==="xterm-ghostty"||env.TERM==="wezterm")return 3;if("TERM_PROGRAM"in env){let version=Number.parseInt((env.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(env.TERM_PROGRAM){case"iTerm.app":return version>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(env.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)||"COLORTERM"in env?1:min}function createSupportsColor(stream,options={}){let level=_supportsColor(stream,{streamIsTTY:stream&&stream.isTTY,...options});return translateLevel(level)}var supportsColor={stdout:createSupportsColor({isTTY:tty.isatty(1)}),stderr:createSupportsColor({isTTY:tty.isatty(2)})},supports_color_default=supportsColor;function stringReplaceAll(string,substring,replacer){let index3=string.indexOf(substring);if(index3===-1)return string;let substringLength=substring.length,endIndex=0,returnValue="";do returnValue+=string.slice(endIndex,index3)+substring+replacer,endIndex=index3+substringLength,index3=string.indexOf(substring,endIndex);while(index3!==-1);return returnValue+=string.slice(endIndex),returnValue}function stringEncaseCRLFWithFirstIndex(string,prefix,postfix,index3){let endIndex=0,returnValue="";do{let gotCR=string[index3-1]==="\r";returnValue+=string.slice(endIndex,gotCR?index3-1:index3)+prefix+(gotCR?`\r
|
|
273
273
|
`:`
|
|
274
274
|
`)+postfix,endIndex=index3+1,index3=string.indexOf(`
|
|
275
275
|
`,endIndex)}while(index3!==-1);return returnValue+=string.slice(endIndex),returnValue}var{stdout:stdoutColor,stderr:stderrColor}=supports_color_default,GENERATOR=Symbol("GENERATOR"),STYLER=Symbol("STYLER"),IS_EMPTY=Symbol("IS_EMPTY"),levelMapping=["ansi","ansi","ansi256","ansi16m"],styles2=Object.create(null),applyOptions=(object,options={})=>{if(options.level&&!(Number.isInteger(options.level)&&options.level>=0&&options.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let colorLevel=stdoutColor?stdoutColor.level:0;object.level=options.level===void 0?colorLevel:options.level};var chalkFactory=options=>{let chalk2=(...strings)=>strings.join(" ");return applyOptions(chalk2,options),Object.setPrototypeOf(chalk2,createChalk.prototype),chalk2};function createChalk(options){return chalkFactory(options)}Object.setPrototypeOf(createChalk.prototype,Function.prototype);for(let[styleName,style]of Object.entries(ansi_styles_default))styles2[styleName]={get(){let builder=createBuilder(this,createStyler(style.open,style.close,this[STYLER]),this[IS_EMPTY]);return Object.defineProperty(this,styleName,{value:builder}),builder}};styles2.visible={get(){let builder=createBuilder(this,this[STYLER],!0);return Object.defineProperty(this,"visible",{value:builder}),builder}};var getModelAnsi=(model,level,type,...arguments_)=>model==="rgb"?level==="ansi16m"?ansi_styles_default[type].ansi16m(...arguments_):level==="ansi256"?ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_)):ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_)):model==="hex"?getModelAnsi("rgb",level,type,...ansi_styles_default.hexToRgb(...arguments_)):ansi_styles_default[type][model](...arguments_),usedModels=["rgb","hex","ansi256"];for(let model of usedModels){styles2[model]={get(){let{level}=this;return function(...arguments_){let styler=createStyler(getModelAnsi(model,levelMapping[level],"color",...arguments_),ansi_styles_default.color.close,this[STYLER]);return createBuilder(this,styler,this[IS_EMPTY])}}};let bgModel="bg"+model[0].toUpperCase()+model.slice(1);styles2[bgModel]={get(){let{level}=this;return function(...arguments_){let styler=createStyler(getModelAnsi(model,levelMapping[level],"bgColor",...arguments_),ansi_styles_default.bgColor.close,this[STYLER]);return createBuilder(this,styler,this[IS_EMPTY])}}}}var proto=Object.defineProperties(()=>{},{...styles2,level:{enumerable:!0,get(){return this[GENERATOR].level},set(level){this[GENERATOR].level=level}}}),createStyler=(open5,close,parent)=>{let openAll,closeAll;return parent===void 0?(openAll=open5,closeAll=close):(openAll=parent.openAll+open5,closeAll=close+parent.closeAll),{open:open5,close,openAll,closeAll,parent}},createBuilder=(self,_styler,_isEmpty)=>{let builder=(...arguments_)=>applyStyle(builder,arguments_.length===1?""+arguments_[0]:arguments_.join(" "));return Object.setPrototypeOf(builder,proto),builder[GENERATOR]=self,builder[STYLER]=_styler,builder[IS_EMPTY]=_isEmpty,builder},applyStyle=(self,string)=>{if(self.level<=0||!string)return self[IS_EMPTY]?"":string;let styler=self[STYLER];if(styler===void 0)return string;let{openAll,closeAll}=styler;if(string.includes("\x1B"))for(;styler!==void 0;)string=stringReplaceAll(string,styler.close,styler.open),styler=styler.parent;let lfIndex=string.indexOf(`
|