diffray 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +866 -250
  2. package/dist/defaults/agents/api-design.md +31 -0
  3. package/dist/defaults/agents/bug-hunter.md +0 -1
  4. package/dist/defaults/agents/consistency-check.md +27 -0
  5. package/dist/defaults/agents/data-privacy.md +30 -0
  6. package/dist/defaults/agents/database.md +30 -0
  7. package/dist/defaults/agents/general.md +0 -1
  8. package/dist/defaults/agents/i18n.md +29 -0
  9. package/dist/defaults/agents/observability.md +30 -0
  10. package/dist/defaults/agents/performance-check.md +0 -1
  11. package/dist/defaults/agents/security-scan.md +0 -1
  12. package/dist/defaults/agents/validation.md +0 -1
  13. package/dist/defaults/prompts/INDEX.md +178 -0
  14. package/dist/defaults/prompts/README.md +173 -0
  15. package/dist/defaults/prompts/SUMMARY.md +276 -0
  16. package/dist/defaults/prompts/USAGE.md +277 -0
  17. package/dist/defaults/prompts/api-design.md +119 -0
  18. package/dist/defaults/prompts/data-privacy.md +144 -0
  19. package/dist/defaults/prompts/database.md +105 -0
  20. package/dist/defaults/prompts/i18n.md +89 -0
  21. package/dist/defaults/prompts/observability.md +142 -0
  22. package/dist/defaults/rules/code-consistency.md +74 -0
  23. package/dist/defaults/rules/code-general.md +46 -0
  24. package/dist/diffray.cjs +347 -0
  25. package/package.json +29 -13
  26. package/src/defaults/agents/bug-hunter.md +0 -1
  27. package/src/defaults/agents/consistency-check.md +27 -0
  28. package/src/defaults/agents/general.md +0 -1
  29. package/src/defaults/agents/performance-check.md +0 -1
  30. package/src/defaults/agents/security-scan.md +0 -1
  31. package/src/defaults/agents/validation.md +0 -1
  32. package/src/defaults/rules/code-consistency.md +74 -0
  33. package/src/defaults/rules/code-general.md +46 -0
  34. package/dist/diffray.js +0 -337
package/dist/diffray.js DELETED
@@ -1,337 +0,0 @@
1
- #!/usr/bin/env bun
2
- // @bun
3
- import{createRequire as DX}from"node:module";var sq=Object.create;var{getPrototypeOf:oq,defineProperty:d1,getOwnPropertyNames:tq}=Object;var eq=Object.prototype.hasOwnProperty;var I7=(D,$,F)=>{F=D!=null?sq(oq(D)):{};let B=$||!D||!D.__esModule?d1(F,"default",{value:D,enumerable:!0}):F;for(let q of tq(D))if(!eq.call(B,q))d1(B,q,{get:()=>D[q],enumerable:!0});return B};var L=(D,$)=>()=>($||D(($={exports:{}}).exports,$),$.exports);var D8=(D,$)=>{for(var F in $)d1(D,F,{get:$[F],enumerable:!0,configurable:!0,set:(B)=>$[F]=()=>B})};var FD=(D,$)=>()=>(D&&($=D(D=0)),$);var c2=DX(import.meta.url);var Y4={};D8(Y4,{prompt:()=>J4,kCancel:()=>Q4});import PD,{stdin as wX,stdout as MX}from"node:process";import h7 from"node:readline";import{WriteStream as KX}from"node:tty";function EX(D){return D&&D.__esModule&&Object.prototype.hasOwnProperty.call(D,"default")?D.default:D}function OX(){if(g7)return t1;g7=1;let D="\x1B",$=`${D}[`,F="\x07",B={to(X,J){if(!J)return`${$}${X+1}G`;return`${$}${J+1};${X+1}H`},move(X,J){let Y="";if(X<0)Y+=`${$}${-X}D`;else if(X>0)Y+=`${$}${X}C`;if(J<0)Y+=`${$}${-J}A`;else if(J>0)Y+=`${$}${J}B`;return Y},up:(X=1)=>`${$}${X}A`,down:(X=1)=>`${$}${X}B`,forward:(X=1)=>`${$}${X}C`,backward:(X=1)=>`${$}${X}D`,nextLine:(X=1)=>`${$}E`.repeat(X),prevLine:(X=1)=>`${$}F`.repeat(X),left:`${$}G`,hide:`${$}?25l`,show:`${$}?25h`,save:`${D}7`,restore:`${D}8`},q={up:(X=1)=>`${$}S`.repeat(X),down:(X=1)=>`${$}T`.repeat(X)},Q={screen:`${$}2J`,up:(X=1)=>`${$}1J`.repeat(X),down:(X=1)=>`${$}J`.repeat(X),line:`${$}2K`,lineEnd:`${$}K`,lineStart:`${$}1K`,lines(X){let J="";for(let Y=0;Y<X;Y++)J+=this.line+(Y<X-1?B.up():"");if(X)J+=B.left;return J}};return t1={cursor:B,scroll:q,erase:Q,beep:F},t1}function jX(){if(m7)return B8.exports;m7=1;let D=process||{},$=D.argv||[],F=D.env||{},B=!(!!F.NO_COLOR||$.includes("--no-color"))&&(!!F.FORCE_COLOR||$.includes("--color")||D.platform==="win32"||(D.stdout||{}).isTTY&&F.TERM!=="dumb"||!!F.CI),q=(J,Y,H=J)=>(C)=>{let _=""+C,G=_.indexOf(Y,J.length);return~G?J+Q(_,Y,H,G)+Y:J+_+Y},Q=(J,Y,H,C)=>{let _="",G=0;do _+=J.substring(G,C)+H,G=C+Y.length,C=J.indexOf(Y,G);while(~C);return _+J.substring(G)},X=(J=B)=>{let Y=J?q:()=>String;return{isColorSupported:J,reset:Y("\x1B[0m","\x1B[0m"),bold:Y("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:Y("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:Y("\x1B[3m","\x1B[23m"),underline:Y("\x1B[4m","\x1B[24m"),inverse:Y("\x1B[7m","\x1B[27m"),hidden:Y("\x1B[8m","\x1B[28m"),strikethrough:Y("\x1B[9m","\x1B[29m"),black:Y("\x1B[30m","\x1B[39m"),red:Y("\x1B[31m","\x1B[39m"),green:Y("\x1B[32m","\x1B[39m"),yellow:Y("\x1B[33m","\x1B[39m"),blue:Y("\x1B[34m","\x1B[39m"),magenta:Y("\x1B[35m","\x1B[39m"),cyan:Y("\x1B[36m","\x1B[39m"),white:Y("\x1B[37m","\x1B[39m"),gray:Y("\x1B[90m","\x1B[39m"),bgBlack:Y("\x1B[40m","\x1B[49m"),bgRed:Y("\x1B[41m","\x1B[49m"),bgGreen:Y("\x1B[42m","\x1B[49m"),bgYellow:Y("\x1B[43m","\x1B[49m"),bgBlue:Y("\x1B[44m","\x1B[49m"),bgMagenta:Y("\x1B[45m","\x1B[49m"),bgCyan:Y("\x1B[46m","\x1B[49m"),bgWhite:Y("\x1B[47m","\x1B[49m"),blackBright:Y("\x1B[90m","\x1B[39m"),redBright:Y("\x1B[91m","\x1B[39m"),greenBright:Y("\x1B[92m","\x1B[39m"),yellowBright:Y("\x1B[93m","\x1B[39m"),blueBright:Y("\x1B[94m","\x1B[39m"),magentaBright:Y("\x1B[95m","\x1B[39m"),cyanBright:Y("\x1B[96m","\x1B[39m"),whiteBright:Y("\x1B[97m","\x1B[39m"),bgBlackBright:Y("\x1B[100m","\x1B[49m"),bgRedBright:Y("\x1B[101m","\x1B[49m"),bgGreenBright:Y("\x1B[102m","\x1B[49m"),bgYellowBright:Y("\x1B[103m","\x1B[49m"),bgBlueBright:Y("\x1B[104m","\x1B[49m"),bgMagentaBright:Y("\x1B[105m","\x1B[49m"),bgCyanBright:Y("\x1B[106m","\x1B[49m"),bgWhiteBright:Y("\x1B[107m","\x1B[49m")}};return B8.exports=X(),B8.exports.createColors=X,B8.exports}function NX({onlyFirst:D=!1}={}){let $=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp($,D?void 0:"g")}function o7(D){if(typeof D!="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(LX,"")}function t7(D){return D&&D.__esModule&&Object.prototype.hasOwnProperty.call(D,"default")?D.default:D}function i2(D,$={}){if(typeof D!="string"||D.length===0||($={ambiguousIsNarrow:!0,...$},D=o7(D),D.length===0))return 0;D=D.replace(SX()," ");let F=$.ambiguousIsNarrow?1:2,B=0;for(let q of D){let Q=q.codePointAt(0);if(Q<=31||Q>=127&&Q<=159||Q>=768&&Q<=879)continue;switch(ZX.eastAsianWidth(q)){case"F":case"W":B+=2;break;case"A":B+=F;break;default:B+=1}}return B}function vX(){let D=new Map;for(let[$,F]of Object.entries(a)){for(let[B,q]of Object.entries(F))a[B]={open:`\x1B[${q[0]}m`,close:`\x1B[${q[1]}m`},F[B]=a[B],D.set(q[0],q[1]);Object.defineProperty(a,$,{value:F,enumerable:!1})}return Object.defineProperty(a,"codes",{value:D,enumerable:!1}),a.color.close="\x1B[39m",a.bgColor.close="\x1B[49m",a.color.ansi=x7(),a.color.ansi256=l7(),a.color.ansi16m=d7(),a.bgColor.ansi=x7(e1),a.bgColor.ansi256=l7(e1),a.bgColor.ansi16m=d7(e1),Object.defineProperties(a,{rgbToAnsi256:{value:($,F,B)=>$===F&&F===B?$<8?16:$>248?231:Math.round(($-8)/247*24)+232:16+36*Math.round($/255*5)+6*Math.round(F/255*5)+Math.round(B/255*5),enumerable:!1},hexToRgb:{value:($)=>{let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec($.toString(16));if(!F)return[0,0,0];let[B]=F;B.length===3&&(B=[...B].map((Q)=>Q+Q).join(""));let q=Number.parseInt(B,16);return[q>>16&255,q>>8&255,q&255]},enumerable:!1},hexToAnsi256:{value:($)=>a.rgbToAnsi256(...a.hexToRgb($)),enumerable:!1},ansi256ToAnsi:{value:($)=>{if($<8)return 30+$;if($<16)return 90+($-8);let F,B,q;if($>=232)F=(($-232)*10+8)/255,B=F,q=F;else{$-=16;let J=$%36;F=Math.floor($/36)/5,B=Math.floor(J/6)/5,q=J%6/5}let Q=Math.max(F,B,q)*2;if(Q===0)return 30;let X=30+(Math.round(q)<<2|Math.round(B)<<1|Math.round(F));return Q===2&&(X+=60),X},enumerable:!1},rgbToAnsi:{value:($,F,B)=>a.ansi256ToAnsi(a.rgbToAnsi256($,F,B)),enumerable:!1},hexToAnsi:{value:($)=>a.ansi256ToAnsi(a.hexToAnsi256($)),enumerable:!1}}),a}function i7(D,$,F){return String(D).normalize().replace(/\r\n/g,`
4
- `).split(`
5
- `).map((B)=>mX(B,$,F)).join(`
6
- `)}function F4(D,$){if(typeof D=="string")return X8.aliases.get(D)===$;for(let F of D)if(F!==void 0&&F4(F,$))return!0;return!1}function lX(D,$){if(D===$)return;let F=D.split(`
7
- `),B=$.split(`
8
- `),q=[];for(let Q=0;Q<Math.max(F.length,B.length);Q++)F[Q]!==B[Q]&&q.push(Q);return q}function q8(D,$){let F=D;F.isTTY&&F.setRawMode($)}class n2{constructor(D,$=!0){wD(this,"input"),wD(this,"output"),wD(this,"_abortSignal"),wD(this,"rl"),wD(this,"opts"),wD(this,"_render"),wD(this,"_track",!1),wD(this,"_prevFrame",""),wD(this,"_subscribers",new Map),wD(this,"_cursor",0),wD(this,"state","initial"),wD(this,"error",""),wD(this,"value");let{input:F=wX,output:B=MX,render:q,signal:Q,...X}=D;this.opts=X,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=q.bind(this),this._track=$,this._abortSignal=Q,this.input=F,this.output=B}unsubscribe(){this._subscribers.clear()}setSubscriber(D,$){let F=this._subscribers.get(D)??[];F.push($),this._subscribers.set(D,F)}on(D,$){this.setSubscriber(D,{cb:$})}once(D,$){this.setSubscriber(D,{cb:$,once:!0})}emit(D,...$){let F=this._subscribers.get(D)??[],B=[];for(let q of F)q.cb(...$),q.once&&B.push(()=>F.splice(F.indexOf(q),1));for(let q of B)q()}prompt(){return new Promise((D,$)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),D(n7);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let F=new KX(0);F._write=(B,q,Q)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),Q()},this.input.pipe(F),this.rl=h7.createInterface({input:this.input,output:F,tabSize:2,prompt:"",escapeCodeTimeout:50}),h7.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),q8(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(vD.cursor.show),this.output.off("resize",this.render),q8(this.input,!1),D(this.value)}),this.once("cancel",()=>{this.output.write(vD.cursor.show),this.output.off("resize",this.render),q8(this.input,!1),D(n7)})})}onKeypress(D,$){if(this.state==="error"&&(this.state="active"),$?.name&&(!this._track&&X8.aliases.has($.name)&&this.emit("cursor",X8.aliases.get($.name)),X8.actions.has($.name)&&this.emit("cursor",$.name)),D&&(D.toLowerCase()==="y"||D.toLowerCase()==="n")&&this.emit("confirm",D.toLowerCase()==="y"),D==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),D&&this.emit("key",D.toLowerCase()),$?.name==="return"){if(this.opts.validate){let F=this.opts.validate(this.value);F&&(this.error=F instanceof Error?F.message:F,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}F4([D,$?.name,$?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
9
- `),q8(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let D=i7(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
10
- `).length-1;this.output.write(vD.cursor.move(-999,D*-1))}render(){let D=i7(this._render(this)??"",process.stdout.columns,{hard:!0});if(D!==this._prevFrame){if(this.state==="initial")this.output.write(vD.cursor.hide);else{let $=lX(this._prevFrame,D);if(this.restoreCursor(),$&&$?.length===1){let F=$[0];this.output.write(vD.cursor.move(0,F)),this.output.write(vD.erase.lines(1));let B=D.split(`
11
- `);this.output.write(B[F]),this._prevFrame=D,this.output.write(vD.cursor.move(0,B.length-F-1));return}if($&&$?.length>1){let F=$[0];this.output.write(vD.cursor.move(0,F)),this.output.write(vD.erase.down());let B=D.split(`
12
- `).slice(F);this.output.write(B.join(`
13
- `)),this._prevFrame=D;return}this.output.write(vD.erase.down())}this.output.write(D),this.state==="initial"&&(this.state="active"),this._prevFrame=D}}}function sX(){return PD.platform!=="win32"?PD.env.TERM!=="linux":!!PD.env.CI||!!PD.env.WT_SESSION||!!PD.env.TERMINUS_SUBLIME||PD.env.ConEmuTask==="{cmd::Cmder}"||PD.env.TERM_PROGRAM==="Terminus-Sublime"||PD.env.TERM_PROGRAM==="vscode"||PD.env.TERM==="xterm-256color"||PD.env.TERM==="alacritty"||PD.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}async function J4(D,$={}){let F=(B)=>{if(typeof B!=="symbol"||B.toString()!=="Symbol(clack:cancel)")return B;switch($.cancel){case"reject":{let q=Error("Prompt cancelled.");if(q.name="ConsolaPromptCancelledError",Error.captureStackTrace)Error.captureStackTrace(q,J4);throw q}case"undefined":return;case"null":return null;case"symbol":return Q4;default:case"default":return $.default??$.initial}};if(!$.type||$.type==="text")return await qQ({message:D,defaultValue:$.default,placeholder:$.placeholder,initialValue:$.initial}).then(F);if($.type==="confirm")return await XQ({message:D,initialValue:$.initial}).then(F);if($.type==="select")return await QQ({message:D,options:$.options.map((B)=>typeof B==="string"?{value:B,label:B}:B),initialValue:$.initial}).then(F);if($.type==="multiselect")return await JQ({message:D,options:$.options.map((B)=>typeof B==="string"?{value:B,label:B}:B),required:$.required,initialValues:$.initial}).then(F);throw Error(`Unknown prompt type: ${$.type}`)}var t1,g7,vD,B8,m7,RX,O,LX,e7,IX,ZX,bX=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},SX,e1=10,x7=(D=0)=>($)=>`\x1B[${$+D}m`,l7=(D=0)=>($)=>`\x1B[${38+D};5;${$}m`,d7=(D=0)=>($,F,B)=>`\x1B[${38+D};2;${$};${F};${B}m`,a,TX,PX,fX,Q8,kX=39,q6="\x07",D4="[",yX="]",$4="m",X6,p7=(D)=>`${Q8.values().next().value}${D4}${D}${$4}`,c7=(D)=>`${Q8.values().next().value}${X6}${D}${q6}`,hX=(D)=>D.split(" ").map(($)=>i2($)),D6=(D,$,F)=>{let B=[...$],q=!1,Q=!1,X=i2(o7(D[D.length-1]));for(let[J,Y]of B.entries()){let H=i2(Y);if(X+H<=F?D[D.length-1]+=Y:(D.push(Y),X=0),Q8.has(Y)&&(q=!0,Q=B.slice(J+1).join("").startsWith(X6)),q){Q?Y===q6&&(q=!1,Q=!1):Y===$4&&(q=!1);continue}X+=H,X===F&&J<B.length-1&&(D.push(""),X=0)}!X&&D[D.length-1].length>0&&D.length>1&&(D[D.length-2]+=D.pop())},gX=(D)=>{let $=D.split(" "),F=$.length;for(;F>0&&!(i2($[F-1])>0);)F--;return F===$.length?D:$.slice(0,F).join(" ")+$.slice(F).join("")},mX=(D,$,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let B="",q,Q,X=hX(D),J=[""];for(let[H,C]of D.split(" ").entries()){F.trim!==!1&&(J[J.length-1]=J[J.length-1].trimStart());let _=i2(J[J.length-1]);if(H!==0&&(_>=$&&(F.wordWrap===!1||F.trim===!1)&&(J.push(""),_=0),(_>0||F.trim===!1)&&(J[J.length-1]+=" ",_++)),F.hard&&X[H]>$){let G=$-_,u=1+Math.floor((X[H]-G-1)/$);Math.floor((X[H]-1)/$)<u&&J.push(""),D6(J,C,$);continue}if(_+X[H]>$&&_>0&&X[H]>0){if(F.wordWrap===!1&&_<$){D6(J,C,$);continue}J.push("")}if(_+X[H]>$&&F.wordWrap===!1){D6(J,C,$);continue}J[J.length-1]+=C}F.trim!==!1&&(J=J.map((H)=>gX(H)));let Y=[...J.join(`
14
- `)];for(let[H,C]of Y.entries()){if(B+=C,Q8.has(C)){let{groups:G}=new RegExp(`(?:\\${D4}(?<code>\\d+)m|\\${X6}(?<uri>.*)${q6})`).exec(Y.slice(H).join(""))||{groups:{}};if(G.code!==void 0){let u=Number.parseFloat(G.code);q=u===kX?void 0:u}else G.uri!==void 0&&(Q=G.uri.length===0?void 0:G.uri)}let _=fX.codes.get(Number(q));Y[H+1]===`
15
- `?(Q&&(B+=c7("")),q&&_&&(B+=p7(_))):C===`
16
- `&&(q&&_&&(B+=p7(q)),Q&&(B+=c7(Q)))}return B},xX,X8,n7,dX,pX=(D,$,F)=>($ in D)?dX(D,$,{enumerable:!0,configurable:!0,writable:!0,value:F}):D[$]=F,wD=(D,$,F)=>(pX(D,typeof $!="symbol"?$+"":$,F),F),B4,cX,iX=(D,$,F)=>($ in D)?cX(D,$,{enumerable:!0,configurable:!0,writable:!0,value:F}):D[$]=F,r7=(D,$,F)=>(iX(D,typeof $!="symbol"?$+"":$,F),F),nX,rX,aX=(D,$,F)=>($ in D)?rX(D,$,{enumerable:!0,configurable:!0,writable:!0,value:F}):D[$]=F,a7=(D,$,F)=>(aX(D,typeof $!="symbol"?$+"":$,F),F),q4,X4,oX,fD=(D,$)=>oX?D:$,tX,eX,DQ,$Q,n,q2,$6,F6,FQ,s7,BQ,J8=(D)=>{switch(D){case"initial":case"active":return O.cyan(tX);case"cancel":return O.red(eX);case"error":return O.yellow(DQ);case"submit":return O.green($Q)}},B6=(D)=>{let{cursor:$,options:F,style:B}=D,q=D.maxItems??Number.POSITIVE_INFINITY,Q=Math.max(process.stdout.rows-4,0),X=Math.min(Q,Math.max(q,5)),J=0;$>=J+X-3?J=Math.max(Math.min($-X+3,F.length-X),0):$<J+2&&(J=Math.max($-2,0));let Y=X<F.length&&J>0,H=X<F.length&&J+X<F.length;return F.slice(J,J+X).map((C,_,G)=>{let u=_===0&&Y,U=_===G.length-1&&H;return u||U?O.dim("..."):B(C,_+J===$)})},qQ=(D)=>new X4({validate:D.validate,placeholder:D.placeholder,defaultValue:D.defaultValue,initialValue:D.initialValue,render(){let $=`${O.gray(n)}
17
- ${J8(this.state)} ${D.message}
18
- `,F=D.placeholder?O.inverse(D.placeholder[0])+O.dim(D.placeholder.slice(1)):O.inverse(O.hidden("_")),B=this.value?this.valueWithCursor:F;switch(this.state){case"error":return`${$.trim()}
19
- ${O.yellow(n)} ${B}
20
- ${O.yellow(q2)} ${O.yellow(this.error)}
21
- `;case"submit":return`${$}${O.gray(n)} ${O.dim(this.value||D.placeholder)}`;case"cancel":return`${$}${O.gray(n)} ${O.strikethrough(O.dim(this.value??""))}${this.value?.trim()?`
22
- ${O.gray(n)}`:""}`;default:return`${$}${O.cyan(n)} ${B}
23
- ${O.cyan(q2)}
24
- `}}}).prompt(),XQ=(D)=>{let $=D.active??"Yes",F=D.inactive??"No";return new B4({active:$,inactive:F,initialValue:D.initialValue??!0,render(){let B=`${O.gray(n)}
25
- ${J8(this.state)} ${D.message}
26
- `,q=this.value?$:F;switch(this.state){case"submit":return`${B}${O.gray(n)} ${O.dim(q)}`;case"cancel":return`${B}${O.gray(n)} ${O.strikethrough(O.dim(q))}
27
- ${O.gray(n)}`;default:return`${B}${O.cyan(n)} ${this.value?`${O.green($6)} ${$}`:`${O.dim(F6)} ${O.dim($)}`} ${O.dim("/")} ${this.value?`${O.dim(F6)} ${O.dim(F)}`:`${O.green($6)} ${F}`}
28
- ${O.cyan(q2)}
29
- `}}}).prompt()},QQ=(D)=>{let $=(F,B)=>{let q=F.label??String(F.value);switch(B){case"selected":return`${O.dim(q)}`;case"active":return`${O.green($6)} ${q} ${F.hint?O.dim(`(${F.hint})`):""}`;case"cancelled":return`${O.strikethrough(O.dim(q))}`;default:return`${O.dim(F6)} ${O.dim(q)}`}};return new q4({options:D.options,initialValue:D.initialValue,render(){let F=`${O.gray(n)}
30
- ${J8(this.state)} ${D.message}
31
- `;switch(this.state){case"submit":return`${F}${O.gray(n)} ${$(this.options[this.cursor],"selected")}`;case"cancel":return`${F}${O.gray(n)} ${$(this.options[this.cursor],"cancelled")}
32
- ${O.gray(n)}`;default:return`${F}${O.cyan(n)} ${B6({cursor:this.cursor,options:this.options,maxItems:D.maxItems,style:(B,q)=>$(B,q?"active":"inactive")}).join(`
33
- ${O.cyan(n)} `)}
34
- ${O.cyan(q2)}
35
- `}}}).prompt()},JQ=(D)=>{let $=(F,B)=>{let q=F.label??String(F.value);return B==="active"?`${O.cyan(FQ)} ${q} ${F.hint?O.dim(`(${F.hint})`):""}`:B==="selected"?`${O.green(s7)} ${O.dim(q)}`:B==="cancelled"?`${O.strikethrough(O.dim(q))}`:B==="active-selected"?`${O.green(s7)} ${q} ${F.hint?O.dim(`(${F.hint})`):""}`:B==="submitted"?`${O.dim(q)}`:`${O.dim(BQ)} ${O.dim(q)}`};return new nX({options:D.options,initialValues:D.initialValues,required:D.required??!0,cursorAt:D.cursorAt,validate(F){if(this.required&&F.length===0)return`Please select at least one option.
36
- ${O.reset(O.dim(`Press ${O.gray(O.bgWhite(O.inverse(" space ")))} to select, ${O.gray(O.bgWhite(O.inverse(" enter ")))} to submit`))}`},render(){let F=`${O.gray(n)}
37
- ${J8(this.state)} ${D.message}
38
- `,B=(q,Q)=>{let X=this.value.includes(q.value);return Q&&X?$(q,"active-selected"):X?$(q,"selected"):$(q,Q?"active":"inactive")};switch(this.state){case"submit":return`${F}${O.gray(n)} ${this.options.filter(({value:q})=>this.value.includes(q)).map((q)=>$(q,"submitted")).join(O.dim(", "))||O.dim("none")}`;case"cancel":{let q=this.options.filter(({value:Q})=>this.value.includes(Q)).map((Q)=>$(Q,"cancelled")).join(O.dim(", "));return`${F}${O.gray(n)} ${q.trim()?`${q}
39
- ${O.gray(n)}`:""}`}case"error":{let q=this.error.split(`
40
- `).map((Q,X)=>X===0?`${O.yellow(q2)} ${O.yellow(Q)}`:` ${Q}`).join(`
41
- `);return`${F+O.yellow(n)} ${B6({options:this.options,cursor:this.cursor,maxItems:D.maxItems,style:B}).join(`
42
- ${O.yellow(n)} `)}
43
- ${q}
44
- `}default:return`${F}${O.cyan(n)} ${B6({options:this.options,cursor:this.cursor,maxItems:D.maxItems,style:B}).join(`
45
- ${O.cyan(n)} `)}
46
- ${O.cyan(q2)}
47
- `}}}).prompt()},Q4;var H4=FD(()=>{vD=OX(),B8={exports:{}};RX=jX(),O=EX(RX);LX=NX();e7={exports:{}};(function(D){var $={};D.exports=$,$.eastAsianWidth=function(B){var q=B.charCodeAt(0),Q=B.length==2?B.charCodeAt(1):0,X=q;return 55296<=q&&q<=56319&&56320<=Q&&Q<=57343&&(q&=1023,Q&=1023,X=q<<10|Q,X+=65536),X==12288||65281<=X&&X<=65376||65504<=X&&X<=65510?"F":X==8361||65377<=X&&X<=65470||65474<=X&&X<=65479||65482<=X&&X<=65487||65490<=X&&X<=65495||65498<=X&&X<=65500||65512<=X&&X<=65518?"H":4352<=X&&X<=4447||4515<=X&&X<=4519||4602<=X&&X<=4607||9001<=X&&X<=9002||11904<=X&&X<=11929||11931<=X&&X<=12019||12032<=X&&X<=12245||12272<=X&&X<=12283||12289<=X&&X<=12350||12353<=X&&X<=12438||12441<=X&&X<=12543||12549<=X&&X<=12589||12593<=X&&X<=12686||12688<=X&&X<=12730||12736<=X&&X<=12771||12784<=X&&X<=12830||12832<=X&&X<=12871||12880<=X&&X<=13054||13056<=X&&X<=19903||19968<=X&&X<=42124||42128<=X&&X<=42182||43360<=X&&X<=43388||44032<=X&&X<=55203||55216<=X&&X<=55238||55243<=X&&X<=55291||63744<=X&&X<=64255||65040<=X&&X<=65049||65072<=X&&X<=65106||65108<=X&&X<=65126||65128<=X&&X<=65131||110592<=X&&X<=110593||127488<=X&&X<=127490||127504<=X&&X<=127546||127552<=X&&X<=127560||127568<=X&&X<=127569||131072<=X&&X<=194367||177984<=X&&X<=196605||196608<=X&&X<=262141?"W":32<=X&&X<=126||162<=X&&X<=163||165<=X&&X<=166||X==172||X==175||10214<=X&&X<=10221||10629<=X&&X<=10630?"Na":X==161||X==164||167<=X&&X<=168||X==170||173<=X&&X<=174||176<=X&&X<=180||182<=X&&X<=186||188<=X&&X<=191||X==198||X==208||215<=X&&X<=216||222<=X&&X<=225||X==230||232<=X&&X<=234||236<=X&&X<=237||X==240||242<=X&&X<=243||247<=X&&X<=250||X==252||X==254||X==257||X==273||X==275||X==283||294<=X&&X<=295||X==299||305<=X&&X<=307||X==312||319<=X&&X<=322||X==324||328<=X&&X<=331||X==333||338<=X&&X<=339||358<=X&&X<=359||X==363||X==462||X==464||X==466||X==468||X==470||X==472||X==474||X==476||X==593||X==609||X==708||X==711||713<=X&&X<=715||X==717||X==720||728<=X&&X<=731||X==733||X==735||768<=X&&X<=879||913<=X&&X<=929||931<=X&&X<=937||945<=X&&X<=961||963<=X&&X<=969||X==1025||1040<=X&&X<=1103||X==1105||X==8208||8211<=X&&X<=8214||8216<=X&&X<=8217||8220<=X&&X<=8221||8224<=X&&X<=8226||8228<=X&&X<=8231||X==8240||8242<=X&&X<=8243||X==8245||X==8251||X==8254||X==8308||X==8319||8321<=X&&X<=8324||X==8364||X==8451||X==8453||X==8457||X==8467||X==8470||8481<=X&&X<=8482||X==8486||X==8491||8531<=X&&X<=8532||8539<=X&&X<=8542||8544<=X&&X<=8555||8560<=X&&X<=8569||X==8585||8592<=X&&X<=8601||8632<=X&&X<=8633||X==8658||X==8660||X==8679||X==8704||8706<=X&&X<=8707||8711<=X&&X<=8712||X==8715||X==8719||X==8721||X==8725||X==8730||8733<=X&&X<=8736||X==8739||X==8741||8743<=X&&X<=8748||X==8750||8756<=X&&X<=8759||8764<=X&&X<=8765||X==8776||X==8780||X==8786||8800<=X&&X<=8801||8804<=X&&X<=8807||8810<=X&&X<=8811||8814<=X&&X<=8815||8834<=X&&X<=8835||8838<=X&&X<=8839||X==8853||X==8857||X==8869||X==8895||X==8978||9312<=X&&X<=9449||9451<=X&&X<=9547||9552<=X&&X<=9587||9600<=X&&X<=9615||9618<=X&&X<=9621||9632<=X&&X<=9633||9635<=X&&X<=9641||9650<=X&&X<=9651||9654<=X&&X<=9655||9660<=X&&X<=9661||9664<=X&&X<=9665||9670<=X&&X<=9672||X==9675||9678<=X&&X<=9681||9698<=X&&X<=9701||X==9711||9733<=X&&X<=9734||X==9737||9742<=X&&X<=9743||9748<=X&&X<=9749||X==9756||X==9758||X==9792||X==9794||9824<=X&&X<=9825||9827<=X&&X<=9829||9831<=X&&X<=9834||9836<=X&&X<=9837||X==9839||9886<=X&&X<=9887||9918<=X&&X<=9919||9924<=X&&X<=9933||9935<=X&&X<=9953||X==9955||9960<=X&&X<=9983||X==10045||X==10071||10102<=X&&X<=10111||11093<=X&&X<=11097||12872<=X&&X<=12879||57344<=X&&X<=63743||65024<=X&&X<=65039||X==65533||127232<=X&&X<=127242||127248<=X&&X<=127277||127280<=X&&X<=127337||127344<=X&&X<=127386||917760<=X&&X<=917999||983040<=X&&X<=1048573||1048576<=X&&X<=1114109?"A":"N"},$.characterLength=function(B){var q=this.eastAsianWidth(B);return q=="F"||q=="W"||q=="A"?2:1};function F(B){return B.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}$.length=function(B){for(var q=F(B),Q=0,X=0;X<q.length;X++)Q=Q+this.characterLength(q[X]);return Q},$.slice=function(B,q,Q){textLen=$.length(B),q=q||0,Q=Q||1,q<0&&(q=textLen+q),Q<0&&(Q=textLen+Q);for(var X="",J=0,Y=F(B),H=0;H<Y.length;H++){var C=Y[H],_=$.length(C);if(J>=q-(_==2?1:0))if(J+_<=Q)X+=C;else break;J+=_}return X}})(e7);IX=e7.exports,ZX=t7(IX),SX=t7(bX);a={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]}};Object.keys(a.modifier);TX=Object.keys(a.color),PX=Object.keys(a.bgColor);[...TX,...PX];fX=vX(),Q8=new Set(["\x1B","›"]),X6=`${yX}8;;`;xX=["up","down","left","right","space","enter","cancel"],X8={actions:new Set(xX),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};globalThis.process.platform.startsWith("win");n7=Symbol("clack:cancel");dX=Object.defineProperty;B4=class B4 extends n2{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(D){super(D,!1),this.value=!!D.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",($)=>{this.output.write(vD.cursor.move(0,-1)),this.value=$,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};cX=Object.defineProperty,nX=class extends n2{constructor(D){super(D,!1),r7(this,"options"),r7(this,"cursor",0),this.options=D.options,this.value=[...D.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:$})=>$===D.cursorAt),0),this.on("key",($)=>{$==="a"&&this.toggleAll()}),this.on("cursor",($)=>{switch($){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let D=this.value.length===this.options.length;this.value=D?[]:this.options.map(($)=>$.value)}toggleValue(){let D=this.value.includes(this._value);this.value=D?this.value.filter(($)=>$!==this._value):[...this.value,this._value]}},rX=Object.defineProperty;q4=class q4 extends n2{constructor(D){super(D,!1),a7(this,"options"),a7(this,"cursor",0),this.options=D.options,this.cursor=this.options.findIndex(({value:$})=>$===D.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",($)=>{switch($){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}};X4=class X4 extends n2{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}█`;let D=this.value.slice(0,this.cursor),[$,...F]=this.value.slice(this.cursor);return`${D}${O.inverse($)}${F.join("")}`}get cursor(){return this._cursor}constructor(D){super(D),this.on("finalize",()=>{this.value||(this.value=D.defaultValue)})}};oX=sX(),tX=fD("❯",">"),eX=fD("■","x"),DQ=fD("▲","x"),$Q=fD("✔","√"),n=fD(""),q2=fD(""),$6=fD("●",">"),F6=fD("○"," "),FQ=fD("◻","[•]"),s7=fD("◼","[+]"),BQ=fD("◻","[ ]");`${O.gray(n)} `;Q4=Symbol.for("cancel")});import{homedir as MJ}from"node:os";function v4(){process.stdout.write("\x1B[?25h")}function t2(D){if(!D)return"-";if(D.startsWith("embedded:"))return D;let $=MJ(),F=process.cwd();if(D.startsWith($))return"~"+D.slice($.length);if(D.startsWith(F))return"."+D.slice(F.length);return D}class A6{frames=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];intervalId=null;frameIndex=0;message;isSpinning=!1;constructor(D){this.message=D}start(){if(this.isSpinning)return;this.isSpinning=!0,U8.add(this),this.frameIndex=0,process.stdout.write("\x1B[?25l"),this.intervalId=setInterval(()=>{let D=this.frames[this.frameIndex];process.stdout.write(`\r${S.cyan}${D}${S.reset} ${this.message}`),this.frameIndex=(this.frameIndex+1)%this.frames.length},80)}update(D){this.message=D}succeed(D){this.stop();let $=D||this.message;console.log(`${S.green}✓${S.reset} ${$}`)}fail(D){this.stop();let $=D||this.message;console.log(`${S.red}✗${S.reset} ${$}`)}warn(D){this.stop();let $=D||this.message;console.log(`${S.yellow}!${S.reset} ${$}`)}stop(){if(!this.isSpinning)return;if(U8.delete(this),this.isSpinning=!1,this.intervalId)clearInterval(this.intervalId),this.intervalId=null;process.stdout.write("\r\x1B[K"),process.stdout.write("\x1B[?25h")}}var S,U8,V;var s=FD(()=>{S={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",gray:"\x1B[90m"},U8=new Set;process.on("SIGINT",()=>{for(let D of U8)D.stop();v4(),console.log(`
48
- ${S.yellow}!${S.reset} Interrupted - shutting down gracefully`),process.exit(130)});process.on("SIGTERM",()=>{for(let D of U8)D.stop();v4(),console.log(`
49
- ${S.yellow}!${S.reset} Terminated - shutting down gracefully`),process.exit(143)});V={success:(D)=>{console.log(`${S.green}✓${S.reset} ${D}`)},error:(D,$)=>{let F=$?`${D} ${$}`:D;console.error(`${S.red}✗${S.reset} ${F}`)},warn:(D,$)=>{let F=$?`${D} ${$}`:D;console.warn(`${S.yellow}!${S.reset} ${F}`)},info:(D)=>{console.log(`${S.blue}○${S.reset} ${D}`)},debug:(D)=>{if(process.env.DEBUG)console.log(`${S.gray}·${S.reset} ${D}`)},plain:(D)=>{console.log(D)},load:(D)=>console.log(`${S.cyan}▸${S.reset} ${D}`),match:(D)=>console.log(`${S.magenta}◆${S.reset} ${D}`),execute:(D)=>console.log(`${S.blue}›${S.reset} ${D}`),agent:(D)=>console.log(`${S.cyan}◉${S.reset} ${D}`),done:(D)=>console.log(`${S.green}✓${S.reset} ${D}`),analyze:(D)=>console.log(`${S.blue}○${S.reset} ${D}`),run:(D)=>console.log(`${S.green}▶${S.reset} ${D}`),stats:(D)=>console.log(` ${D}`),rocket:(D)=>console.log(`${S.magenta}▲${S.reset} ${D}`),robot:(D)=>console.log(`${S.cyan}◉${S.reset} ${D}`),chart:(D)=>console.log(`${S.blue}■${S.reset} ${D}`),file:(D)=>console.log(`${S.gray}◇${S.reset} ${D}`),sync:(D)=>console.log(`${S.cyan}↻${S.reset} ${D}`),lightning:(D)=>console.log(`${S.yellow}⚡${S.reset} ${D}`),sparkles:(D)=>console.log(`${S.magenta}✦${S.reset} ${D}`),logo:()=>{console.log(`
50
- ██████╗ ██╗ ███████╗ ███████╗ ██████╗ █████╗ ██╗ ██╗
51
- ██╔══██╗ ██║ ██╔════╝ ██╔════╝ ██╔══██╗ ██╔══██╗ ╚██╗ ██╔╝
52
- ██║ ██║ ██║ █████╗ █████╗ ██████╔╝ ███████║ ╚████╔╝ ${S.bold}Multi-agent code review${S.reset}
53
- ██║ ██║ ██║ ██╔══╝ ██╔══╝ ██╔══██╗ ██╔══██║ ╚██╔╝
54
- ██████╔╝ ██║ ██║ ██║ ██║ ██║ ██║ ██║ ██║
55
- ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
56
- `)},separator:(D="=",$=80)=>{console.log(D.repeat($))},newline:()=>console.log()}});var L6=(D,$,F)=>{let B=D instanceof RegExp?J5(D,F):D,q=$ instanceof RegExp?J5($,F):$,Q=B!==null&&q!=null&&cY(B,q,F);return Q&&{start:Q[0],end:Q[1],pre:F.slice(0,Q[0]),body:F.slice(Q[0]+B.length,Q[1]),post:F.slice(Q[1]+q.length)}},J5=(D,$)=>{let F=$.match(D);return F?F[0]:null},cY=(D,$,F)=>{let B,q,Q,X=void 0,J,Y=F.indexOf(D),H=F.indexOf($,Y+1),C=Y;if(Y>=0&&H>0){if(D===$)return[Y,H];B=[],Q=F.length;while(C>=0&&!J){if(C===Y)B.push(C),Y=F.indexOf(D,C+1);else if(B.length===1){let _=B.pop();if(_!==void 0)J=[_,H]}else{if(q=B.pop(),q!==void 0&&q<Q)Q=q,X=H;H=F.indexOf($,C+1)}C=Y<H&&Y>=0?Y:H}if(B.length&&X!==void 0)J=[Q,X]}return J};function I6(D){return!isNaN(D)?parseInt(D,10):D.charCodeAt(0)}function FH(D){return D.replace(oY,Y5).replace(tY,H5).replace(eY,Z6).replace(DH,C5).replace($H,_5)}function BH(D){return D.replace(iY,"\\").replace(nY,"{").replace(rY,"}").replace(aY,",").replace(sY,".")}function G5(D){if(!D)return[""];let $=[],F=L6("{","}",D);if(!F)return D.split(",");let{pre:B,body:q,post:Q}=F,X=B.split(",");X[X.length-1]+="{"+q+"}";let J=G5(Q);if(Q.length)X[X.length-1]+=J.shift(),X.push.apply(X,J);return $.push.apply($,X),$}function V5(D){if(!D)return[];if(D.slice(0,2)==="{}")D="\\{\\}"+D.slice(2);return Y3(FH(D),!0).map(BH)}function qH(D){return"{"+D+"}"}function XH(D){return/^-?0\d/.test(D)}function QH(D,$){return D<=$}function JH(D,$){return D>=$}function Y3(D,$){let F=[],B=L6("{","}",D);if(!B)return[D];let q=B.pre,Q=B.post.length?Y3(B.post,!1):[""];if(/\$$/.test(B.pre))for(let X=0;X<Q.length;X++){let J=q+"{"+B.body+"}"+Q[X];F.push(J)}else{let X=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(B.body),J=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(B.body),Y=X||J,H=B.body.indexOf(",")>=0;if(!Y&&!H){if(B.post.match(/,(?!,).*\}/))return D=B.pre+"{"+B.body+Z6+B.post,Y3(D);return[D]}let C;if(Y)C=B.body.split(/\.\./);else if(C=G5(B.body),C.length===1&&C[0]!==void 0){if(C=Y3(C[0],!1).map(qH),C.length===1)return Q.map((G)=>B.pre+C[0]+G)}let _;if(Y&&C[0]!==void 0&&C[1]!==void 0){let G=I6(C[0]),u=I6(C[1]),U=Math.max(C[0].length,C[1].length),W=C.length===3&&C[2]!==void 0?Math.abs(I6(C[2])):1,A=QH;if(u<G)W*=-1,A=JH;let w=C.some(XH);_=[];for(let M=G;A(M,u);M+=W){let K;if(J){if(K=String.fromCharCode(M),K==="\\")K=""}else if(K=String(M),w){let R=U-K.length;if(R>0){let Z=Array(R+1).join("0");if(M<0)K="-"+Z+K.slice(1);else K=Z+K}}_.push(K)}}else{_=[];for(let G=0;G<C.length;G++)_.push.apply(_,Y3(C[G],!1))}for(let G=0;G<_.length;G++)for(let u=0;u<Q.length;u++){let U=q+_[G]+Q[u];if(!$||Y||U)F.push(U)}}return F}var Y5,H5,Z6,C5,_5,iY,nY,rY,aY,sY,oY,tY,eY,DH,$H;var W5=FD(()=>{Y5="\x00SLASH"+Math.random()+"\x00",H5="\x00OPEN"+Math.random()+"\x00",Z6="\x00CLOSE"+Math.random()+"\x00",C5="\x00COMMA"+Math.random()+"\x00",_5="\x00PERIOD"+Math.random()+"\x00",iY=new RegExp(Y5,"g"),nY=new RegExp(H5,"g"),rY=new RegExp(Z6,"g"),aY=new RegExp(C5,"g"),sY=new RegExp(_5,"g"),oY=/\\\\/g,tY=/\\{/g,eY=/\\}/g,DH=/\\,/g,$H=/\\./g});var H3=(D)=>{if(typeof D!=="string")throw TypeError("invalid pattern");if(D.length>65536)throw TypeError("pattern is too long")};var YH,C3=(D)=>D.replace(/[[\]\\-]/g,"\\$&"),HH=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),u5=(D)=>D.join(""),A5=(D,$)=>{let F=$;if(D.charAt(F)!=="[")throw Error("not in a brace expression");let B=[],q=[],Q=F+1,X=!1,J=!1,Y=!1,H=!1,C=F,_="";D:while(Q<D.length){let W=D.charAt(Q);if((W==="!"||W==="^")&&Q===F+1){H=!0,Q++;continue}if(W==="]"&&X&&!Y){C=Q+1;break}if(X=!0,W==="\\"){if(!Y){Y=!0,Q++;continue}}if(W==="["&&!Y){for(let[A,[z,w,M]]of Object.entries(YH))if(D.startsWith(A,Q)){if(_)return["$.",!1,D.length-F,!0];if(Q+=A.length,M)q.push(z);else B.push(z);J=J||w;continue D}}if(Y=!1,_){if(W>_)B.push(C3(_)+"-"+C3(W));else if(W===_)B.push(C3(W));_="",Q++;continue}if(D.startsWith("-]",Q+1)){B.push(C3(W+"-")),Q+=2;continue}if(D.startsWith("-",Q+1)){_=W,Q+=2;continue}B.push(C3(W)),Q++}if(C<Q)return["",!1,0,!1];if(!B.length&&!q.length)return["$.",!1,D.length-F,!0];if(q.length===0&&B.length===1&&/^\\?.$/.test(B[0])&&!H){let W=B[0].length===2?B[0].slice(-1):B[0];return[HH(W),!1,C-F,!1]}let G="["+(H?"^":"")+u5(B)+"]",u="["+(H?"":"^")+u5(q)+"]";return[B.length&&q.length?"("+G+"|"+u+")":B.length?G:u,J,C-F,!0]};var U5=FD(()=>{YH={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]}});var ND=(D,{windowsPathsNoEscape:$=!1,magicalBraces:F=!0}={})=>{if(F)return $?D.replace(/\[([^\/\\])\]/g,"$1"):D.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");return $?D.replace(/\[([^\/\\{}])\]/g,"$1"):D.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")};class CD{type;#D;#F;#X=!1;#q=[];#Q;#M;#U;#C=!1;#J;#G;#_=!1;constructor(D,$,F={}){if(this.type=D,D)this.#F=!0;if(this.#Q=$,this.#D=this.#Q?this.#Q.#D:this,this.#J=this.#D===this?F:this.#D.#J,this.#U=this.#D===this?[]:this.#D.#U,D==="!"&&!this.#D.#C)this.#U.push(this);this.#M=this.#Q?this.#Q.#q.length:0}get hasMagic(){if(this.#F!==void 0)return this.#F;for(let D of this.#q){if(typeof D==="string")continue;if(D.type||D.hasMagic)return this.#F=!0}return this.#F}toString(){if(this.#G!==void 0)return this.#G;if(!this.type)return this.#G=this.#q.map((D)=>String(D)).join("");else return this.#G=this.type+"("+this.#q.map((D)=>String(D)).join("|")+")"}#Y(){if(this!==this.#D)throw Error("should only call on root");if(this.#C)return this;this.toString(),this.#C=!0;let D;while(D=this.#U.pop()){if(D.type!=="!")continue;let $=D,F=$.#Q;while(F){for(let B=$.#M+1;!F.type&&B<F.#q.length;B++)for(let q of D.#q){if(typeof q==="string")throw Error("string part in extglob AST??");q.copyIn(F.#q[B])}$=F,F=$.#Q}}return this}push(...D){for(let $ of D){if($==="")continue;if(typeof $!=="string"&&!($ instanceof CD&&$.#Q===this))throw Error("invalid part: "+$);this.#q.push($)}}toJSON(){let D=this.type===null?this.#q.slice().map(($)=>typeof $==="string"?$:$.toJSON()):[this.type,...this.#q.map(($)=>$.toJSON())];if(this.isStart()&&!this.type)D.unshift([]);if(this.isEnd()&&(this===this.#D||this.#D.#C&&this.#Q?.type==="!"))D.push({});return D}isStart(){if(this.#D===this)return!0;if(!this.#Q?.isStart())return!1;if(this.#M===0)return!0;let D=this.#Q;for(let $=0;$<this.#M;$++){let F=D.#q[$];if(!(F instanceof CD&&F.type==="!"))return!1}return!0}isEnd(){if(this.#D===this)return!0;if(this.#Q?.type==="!")return!0;if(!this.#Q?.isEnd())return!1;if(!this.type)return this.#Q?.isEnd();let D=this.#Q?this.#Q.#q.length:0;return this.#M===D-1}copyIn(D){if(typeof D==="string")this.push(D);else this.push(D.clone(this))}clone(D){let $=new CD(this.type,D);for(let F of this.#q)$.copyIn(F);return $}static#B(D,$,F,B){let q=!1,Q=!1,X=-1,J=!1;if($.type===null){let G=F,u="";while(G<D.length){let U=D.charAt(G++);if(q||U==="\\"){q=!q,u+=U;continue}if(Q){if(G===X+1){if(U==="^"||U==="!")J=!0}else if(U==="]"&&!(G===X+2&&J))Q=!1;u+=U;continue}else if(U==="["){Q=!0,X=G,J=!1,u+=U;continue}if(!B.noext&&z5(U)&&D.charAt(G)==="("){$.push(u),u="";let W=new CD(U,$);G=CD.#B(D,W,G,B),$.push(W);continue}u+=U}return $.push(u),G}let Y=F+1,H=new CD(null,$),C=[],_="";while(Y<D.length){let G=D.charAt(Y++);if(q||G==="\\"){q=!q,_+=G;continue}if(Q){if(Y===X+1){if(G==="^"||G==="!")J=!0}else if(G==="]"&&!(Y===X+2&&J))Q=!1;_+=G;continue}else if(G==="["){Q=!0,X=Y,J=!1,_+=G;continue}if(z5(G)&&D.charAt(Y)==="("){H.push(_),_="";let u=new CD(G,H);H.push(u),Y=CD.#B(D,u,Y,B);continue}if(G==="|"){H.push(_),_="",C.push(H),H=new CD(null,$);continue}if(G===")"){if(_===""&&$.#q.length===0)$.#_=!0;return H.push(_),_="",$.push(...C,H),Y}_+=G}return $.type=null,$.#F=void 0,$.#q=[D.substring(F-1)],Y}static fromGlob(D,$={}){let F=new CD(null,void 0,$);return CD.#B(D,F,0,$),F}toMMPattern(){if(this!==this.#D)return this.#D.toMMPattern();let D=this.toString(),[$,F,B,q]=this.toRegExpSource();if(!(B||this.#F||this.#J.nocase&&!this.#J.nocaseMagicOnly&&D.toUpperCase()!==D.toLowerCase()))return F;let X=(this.#J.nocase?"i":"")+(q?"u":"");return Object.assign(new RegExp(`^${$}$`,X),{_src:$,_glob:D})}get options(){return this.#J}toRegExpSource(D){let $=D??!!this.#J.dot;if(this.#D===this)this.#Y();if(!this.type){let J=this.isStart()&&this.isEnd()&&!this.#q.some((G)=>typeof G!=="string"),Y=this.#q.map((G)=>{let[u,U,W,A]=typeof G==="string"?CD.#K(G,this.#F,J):G.toRegExpSource(D);return this.#F=this.#F||W,this.#X=this.#X||A,u}).join(""),H="";if(this.isStart()){if(typeof this.#q[0]==="string"){if(!(this.#q.length===1&&VH.has(this.#q[0]))){let u=GH,U=$&&u.has(Y.charAt(0))||Y.startsWith("\\.")&&u.has(Y.charAt(2))||Y.startsWith("\\.\\.")&&u.has(Y.charAt(4)),W=!$&&!D&&u.has(Y.charAt(0));H=U?_H:W?R8:""}}}let C="";if(this.isEnd()&&this.#D.#C&&this.#Q?.type==="!")C="(?:$|\\/)";return[H+Y+C,ND(Y),this.#F=!!this.#F,this.#X]}let F=this.type==="*"||this.type==="+",B=this.type==="!"?"(?:(?!(?:":"(?:",q=this.#V($);if(this.isStart()&&this.isEnd()&&!q&&this.type!=="!"){let J=this.toString();return this.#q=[J],this.type=null,this.#F=void 0,[J,ND(this.toString()),!1,!1]}let Q=!F||D||$||!R8?"":this.#V(!0);if(Q===q)Q="";if(Q)q=`(?:${q})(?:${Q})*?`;let X="";if(this.type==="!"&&this.#_)X=(this.isStart()&&!$?R8:"")+M5;else{let J=this.type==="!"?"))"+(this.isStart()&&!$&&!D?R8:"")+w5+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&Q?")":this.type==="*"&&Q?")?":`)${this.type}`;X=B+q+J}return[X,ND(q),this.#F=!!this.#F,this.#X]}#V(D){return this.#q.map(($)=>{if(typeof $==="string")throw Error("string type in extglob ast??");let[F,B,q,Q]=$.toRegExpSource(D);return this.#X=this.#X||Q,F}).filter(($)=>!(this.isStart()&&this.isEnd())||!!$).join("|")}static#K(D,$,F=!1){let B=!1,q="",Q=!1;for(let X=0;X<D.length;X++){let J=D.charAt(X);if(B){B=!1,q+=(WH.has(J)?"\\":"")+J;continue}if(J==="\\"){if(X===D.length-1)q+="\\\\";else B=!0;continue}if(J==="["){let[Y,H,C,_]=A5(D,X);if(C){q+=Y,Q=Q||H,X+=C-1,$=$||_;continue}}if(J==="*"){q+=F&&D==="*"?M5:w5,$=!0;continue}if(J==="?"){q+=b6,$=!0;continue}q+=uH(J)}return[q,ND(D),!!$,Q]}}var CH,z5=(D)=>CH.has(D),_H="(?!(?:^|/)\\.\\.?(?:$|/))",R8="(?!\\.)",GH,VH,WH,uH=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),b6="[^/]",w5,M5;var S6=FD(()=>{U5();CH=new Set(["!","?","+","*","@"]),GH=new Set(["[","."]),VH=new Set(["..","."]),WH=new Set("().*{}+?[]^$\\!"),w5=b6+"*?",M5=b6+"+?"});var c0=(D,{windowsPathsNoEscape:$=!1,magicalBraces:F=!1}={})=>{if(F)return $?D.replace(/[?*()[\]{}]/g,"[$&]"):D.replace(/[?*()[\]\\{}]/g,"\\$&");return $?D.replace(/[?*()[\]]/g,"[$&]"):D.replace(/[?*()[\]\\]/g,"\\$&")};class ID{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(D,$={}){if(H3(D),$=$||{},this.options=$,this.pattern=D,this.platform=$.platform||R5,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!$.windowsPathsNoEscape||$.allowWindowsEscape===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!$.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!$.nonegate,this.comment=!1,this.empty=!1,this.partial=!!$.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=$.windowsNoMagicRoot!==void 0?$.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let D of this.set)for(let $ of D)if(typeof $!=="string")return!0;return!1}debug(...D){}make(){let D=this.pattern,$=this.options;if(!$.nocomment&&D.charAt(0)==="#"){this.comment=!0;return}if(!D){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],$.debug)this.debug=(...q)=>console.error(...q);this.debug(this.pattern,this.globSet);let F=this.globSet.map((q)=>this.slashSplit(q));this.globParts=this.preprocess(F),this.debug(this.pattern,this.globParts);let B=this.globParts.map((q,Q,X)=>{if(this.isWindows&&this.windowsNoMagicRoot){let J=q[0]===""&&q[1]===""&&(q[2]==="?"||!E5.test(q[2]))&&!E5.test(q[3]),Y=/^[a-z]:/i.test(q[0]);if(J)return[...q.slice(0,4),...q.slice(4).map((H)=>this.parse(H))];else if(Y)return[q[0],...q.slice(1).map((H)=>this.parse(H))]}return q.map((J)=>this.parse(J))});if(this.debug(this.pattern,B),this.set=B.filter((q)=>q.indexOf(!1)===-1),this.isWindows)for(let q=0;q<this.set.length;q++){let Q=this.set[q];if(Q[0]===""&&Q[1]===""&&this.globParts[q][2]==="?"&&typeof Q[3]==="string"&&/^[a-z]:$/i.test(Q[3]))Q[2]="?"}this.debug(this.pattern,this.set)}preprocess(D){if(this.options.noglobstar){for(let F=0;F<D.length;F++)for(let B=0;B<D[F].length;B++)if(D[F][B]==="**")D[F][B]="*"}let{optimizationLevel:$=1}=this.options;if($>=2)D=this.firstPhasePreProcess(D),D=this.secondPhasePreProcess(D);else if($>=1)D=this.levelOneOptimize(D);else D=this.adjascentGlobstarOptimize(D);return D}adjascentGlobstarOptimize(D){return D.map(($)=>{let F=-1;while((F=$.indexOf("**",F+1))!==-1){let B=F;while($[B+1]==="**")B++;if(B!==F)$.splice(F,B-F)}return $})}levelOneOptimize(D){return D.map(($)=>{return $=$.reduce((F,B)=>{let q=F[F.length-1];if(B==="**"&&q==="**")return F;if(B===".."){if(q&&q!==".."&&q!=="."&&q!=="**")return F.pop(),F}return F.push(B),F},[]),$.length===0?[""]:$})}levelTwoFileOptimize(D){if(!Array.isArray(D))D=this.slashSplit(D);let $=!1;do{if($=!1,!this.preserveMultipleSlashes){for(let B=1;B<D.length-1;B++){let q=D[B];if(B===1&&q===""&&D[0]==="")continue;if(q==="."||q==="")$=!0,D.splice(B,1),B--}if(D[0]==="."&&D.length===2&&(D[1]==="."||D[1]===""))$=!0,D.pop()}let F=0;while((F=D.indexOf("..",F+1))!==-1){let B=D[F-1];if(B&&B!=="."&&B!==".."&&B!=="**")$=!0,D.splice(F-1,2),F-=2}}while($);return D.length===0?[""]:D}firstPhasePreProcess(D){let $=!1;do{$=!1;for(let F of D){let B=-1;while((B=F.indexOf("**",B+1))!==-1){let Q=B;while(F[Q+1]==="**")Q++;if(Q>B)F.splice(B+1,Q-B);let X=F[B+1],J=F[B+2],Y=F[B+3];if(X!=="..")continue;if(!J||J==="."||J===".."||!Y||Y==="."||Y==="..")continue;$=!0,F.splice(B,1);let H=F.slice(0);H[B]="**",D.push(H),B--}if(!this.preserveMultipleSlashes){for(let Q=1;Q<F.length-1;Q++){let X=F[Q];if(Q===1&&X===""&&F[0]==="")continue;if(X==="."||X==="")$=!0,F.splice(Q,1),Q--}if(F[0]==="."&&F.length===2&&(F[1]==="."||F[1]===""))$=!0,F.pop()}let q=0;while((q=F.indexOf("..",q+1))!==-1){let Q=F[q-1];if(Q&&Q!=="."&&Q!==".."&&Q!=="**"){$=!0;let J=q===1&&F[q+1]==="**"?["."]:[];if(F.splice(q-1,2,...J),F.length===0)F.push("");q-=2}}}}while($);return D}secondPhasePreProcess(D){for(let $=0;$<D.length-1;$++)for(let F=$+1;F<D.length;F++){let B=this.partsMatch(D[$],D[F],!this.preserveMultipleSlashes);if(B){D[$]=[],D[F]=B;break}}return D.filter(($)=>$.length)}partsMatch(D,$,F=!1){let B=0,q=0,Q=[],X="";while(B<D.length&&q<$.length)if(D[B]===$[q])Q.push(X==="b"?$[q]:D[B]),B++,q++;else if(F&&D[B]==="**"&&$[q]===D[B+1])Q.push(D[B]),B++;else if(F&&$[q]==="**"&&D[B]===$[q+1])Q.push($[q]),q++;else if(D[B]==="*"&&$[q]&&(this.options.dot||!$[q].startsWith("."))&&$[q]!=="**"){if(X==="b")return!1;X="a",Q.push(D[B]),B++,q++}else if($[q]==="*"&&D[B]&&(this.options.dot||!D[B].startsWith("."))&&D[B]!=="**"){if(X==="a")return!1;X="b",Q.push($[q]),B++,q++}else return!1;return D.length===$.length&&Q}parseNegate(){if(this.nonegate)return;let D=this.pattern,$=!1,F=0;for(let B=0;B<D.length&&D.charAt(B)==="!";B++)$=!$,F++;if(F)this.pattern=D.slice(F);this.negate=$}matchOne(D,$,F=!1){let B=this.options;if(this.isWindows){let U=typeof D[0]==="string"&&/^[a-z]:$/i.test(D[0]),W=!U&&D[0]===""&&D[1]===""&&D[2]==="?"&&/^[a-z]:$/i.test(D[3]),A=typeof $[0]==="string"&&/^[a-z]:$/i.test($[0]),z=!A&&$[0]===""&&$[1]===""&&$[2]==="?"&&typeof $[3]==="string"&&/^[a-z]:$/i.test($[3]),w=W?3:U?0:void 0,M=z?3:A?0:void 0;if(typeof w==="number"&&typeof M==="number"){let[K,R]=[D[w],$[M]];if(K.toLowerCase()===R.toLowerCase()){if($[M]=K,M>w)$=$.slice(M);else if(w>M)D=D.slice(w)}}}let{optimizationLevel:q=1}=this.options;if(q>=2)D=this.levelTwoFileOptimize(D);this.debug("matchOne",this,{file:D,pattern:$}),this.debug("matchOne",D.length,$.length);for(var Q=0,X=0,J=D.length,Y=$.length;Q<J&&X<Y;Q++,X++){this.debug("matchOne loop");var H=$[X],C=D[Q];if(this.debug($,H,C),H===!1)return!1;if(H===_D){this.debug("GLOBSTAR",[$,H,C]);var _=Q,G=X+1;if(G===Y){this.debug("** at the end");for(;Q<J;Q++)if(D[Q]==="."||D[Q]===".."||!B.dot&&D[Q].charAt(0)===".")return!1;return!0}while(_<J){var u=D[_];if(this.debug(`
57
- globstar while`,D,_,$,G,u),this.matchOne(D.slice(_),$.slice(G),F))return this.debug("globstar found match!",_,J,u),!0;else{if(u==="."||u===".."||!B.dot&&u.charAt(0)==="."){this.debug("dot detected!",D,_,$,G);break}this.debug("globstar swallow a segment, and continue"),_++}}if(F){if(this.debug(`
58
- >>> no match, partial?`,D,_,$,G),_===J)return!0}return!1}let U;if(typeof H==="string")U=C===H,this.debug("string match",H,C,U);else U=H.test(C),this.debug("pattern match",H,C,U);if(!U)return!1}if(Q===J&&X===Y)return!0;else if(Q===J)return F;else if(X===Y)return Q===J-1&&D[Q]==="";else throw Error("wtf?")}braceExpand(){return N5(this.pattern,this.options)}parse(D){H3(D);let $=this.options;if(D==="**")return _D;if(D==="")return"";let F,B=null;if(F=D.match(NH))B=$.dot?IH:LH;else if(F=D.match(AH))B=($.nocase?$.dot?MH:wH:$.dot?zH:UH)(F[1]);else if(F=D.match(ZH))B=($.nocase?$.dot?SH:bH:$.dot?TH:PH)(F);else if(F=D.match(KH))B=$.dot?OH:EH;else if(F=D.match(jH))B=RH;let q=CD.fromGlob(D,this.options).toMMPattern();if(B&&typeof q==="object")Reflect.defineProperty(q,"test",{value:B});return q}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let D=this.set;if(!D.length)return this.regexp=!1,this.regexp;let $=this.options,F=$.noglobstar?kH:$.dot?yH:hH,B=new Set($.nocase?["i"]:[]),q=D.map((J)=>{let Y=J.map((C)=>{if(C instanceof RegExp)for(let _ of C.flags.split(""))B.add(_);return typeof C==="string"?dH(C):C===_D?_D:C._src});Y.forEach((C,_)=>{let G=Y[_+1],u=Y[_-1];if(C!==_D||u===_D)return;if(u===void 0)if(G!==void 0&&G!==_D)Y[_+1]="(?:\\/|"+F+"\\/)?"+G;else Y[_]=F;else if(G===void 0)Y[_-1]=u+"(?:\\/|\\/"+F+")?";else if(G!==_D)Y[_-1]=u+"(?:\\/|\\/"+F+"\\/)"+G,Y[_+1]=_D});let H=Y.filter((C)=>C!==_D);if(this.partial&&H.length>=1){let C=[];for(let _=1;_<=H.length;_++)C.push(H.slice(0,_).join("/"));return"(?:"+C.join("|")+")"}return H.join("/")}).join("|"),[Q,X]=D.length>1?["(?:",")"]:["",""];if(q="^"+Q+q+X+"$",this.partial)q="^(?:\\/|"+Q+q.slice(1,-1)+X+")$";if(this.negate)q="^(?!"+q+").+$";try{this.regexp=new RegExp(q,[...B].join(""))}catch(J){this.regexp=!1}return this.regexp}slashSplit(D){if(this.preserveMultipleSlashes)return D.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(D))return["",...D.split(/\/+/)];else return D.split(/\/+/)}match(D,$=this.partial){if(this.debug("match",D,this.pattern),this.comment)return!1;if(this.empty)return D==="";if(D==="/"&&$)return!0;let F=this.options;if(this.isWindows)D=D.split("\\").join("/");let B=this.slashSplit(D);this.debug(this.pattern,"split",B);let q=this.set;this.debug(this.pattern,"set",q);let Q=B[B.length-1];if(!Q)for(let X=B.length-2;!Q&&X>=0;X--)Q=B[X];for(let X=0;X<q.length;X++){let J=q[X],Y=B;if(F.matchBase&&J.length===1)Y=[Q];if(this.matchOne(Y,J,$)){if(F.flipNegate)return!0;return!this.negate}}if(F.flipNegate)return!1;return this.negate}static defaults(D){return WD.defaults(D).Minimatch}}var WD=(D,$,F={})=>{if(H3($),!F.nocomment&&$.charAt(0)==="#")return!1;return new ID($,F).match(D)},AH,UH=(D)=>($)=>!$.startsWith(".")&&$.endsWith(D),zH=(D)=>($)=>$.endsWith(D),wH=(D)=>{return D=D.toLowerCase(),($)=>!$.startsWith(".")&&$.toLowerCase().endsWith(D)},MH=(D)=>{return D=D.toLowerCase(),($)=>$.toLowerCase().endsWith(D)},KH,EH=(D)=>!D.startsWith(".")&&D.includes("."),OH=(D)=>D!=="."&&D!==".."&&D.includes("."),jH,RH=(D)=>D!=="."&&D!==".."&&D.startsWith("."),NH,LH=(D)=>D.length!==0&&!D.startsWith("."),IH=(D)=>D.length!==0&&D!=="."&&D!=="..",ZH,bH=([D,$=""])=>{let F=O5([D]);if(!$)return F;return $=$.toLowerCase(),(B)=>F(B)&&B.toLowerCase().endsWith($)},SH=([D,$=""])=>{let F=j5([D]);if(!$)return F;return $=$.toLowerCase(),(B)=>F(B)&&B.toLowerCase().endsWith($)},TH=([D,$=""])=>{let F=j5([D]);return!$?F:(B)=>F(B)&&B.endsWith($)},PH=([D,$=""])=>{let F=O5([D]);return!$?F:(B)=>F(B)&&B.endsWith($)},O5=([D])=>{let $=D.length;return(F)=>F.length===$&&!F.startsWith(".")},j5=([D])=>{let $=D.length;return(F)=>F.length===$&&F!=="."&&F!==".."},R5,K5,vH,_D,fH="[^/]",kH,yH="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",hH="(?:(?!(?:\\/|^)\\.).)*?",gH=(D,$={})=>(F)=>WD(F,D,$),LD=(D,$={})=>Object.assign({},D,$),mH=(D)=>{if(!D||typeof D!=="object"||!Object.keys(D).length)return WD;let $=WD;return Object.assign((B,q,Q={})=>$(B,q,LD(D,Q)),{Minimatch:class extends $.Minimatch{constructor(q,Q={}){super(q,LD(D,Q))}static defaults(q){return $.defaults(LD(D,q)).Minimatch}},AST:class extends $.AST{constructor(q,Q,X={}){super(q,Q,LD(D,X))}static fromGlob(q,Q={}){return $.AST.fromGlob(q,LD(D,Q))}},unescape:(B,q={})=>$.unescape(B,LD(D,q)),escape:(B,q={})=>$.escape(B,LD(D,q)),filter:(B,q={})=>$.filter(B,LD(D,q)),defaults:(B)=>$.defaults(LD(D,B)),makeRe:(B,q={})=>$.makeRe(B,LD(D,q)),braceExpand:(B,q={})=>$.braceExpand(B,LD(D,q)),match:(B,q,Q={})=>$.match(B,q,LD(D,Q)),sep:$.sep,GLOBSTAR:_D})},N5=(D,$={})=>{if(H3(D),$.nobrace||!/\{(?:(?!\{).)*\}/.test(D))return[D];return V5(D)},xH=(D,$={})=>new ID(D,$).makeRe(),lH=(D,$,F={})=>{let B=new ID($,F);if(D=D.filter((q)=>B.match(q)),B.options.nonull&&!D.length)D.push($);return D},E5,dH=(D)=>D.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");var K0=FD(()=>{W5();S6();S6();AH=/^\*+([^+@!?\*\[\(]*)$/,KH=/^\*+\.\*+$/,jH=/^\.\*+$/,NH=/^\*+$/,ZH=/^\?+([^+@!?\*\[\(]*)?$/,R5=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",K5={win32:{sep:"\\"},posix:{sep:"/"}},vH=R5==="win32"?K5.win32.sep:K5.posix.sep;WD.sep=vH;_D=Symbol("globstar **");WD.GLOBSTAR=_D;kH=fH+"*?";WD.filter=gH;WD.defaults=mH;WD.braceExpand=N5;WD.makeRe=xH;WD.match=lH;E5=/[?*]|[+@!]\(.*?\)|\[|\]/;WD.AST=CD;WD.Minimatch=ID;WD.escape=c0;WD.unescape=ND});class E2{heap;length;static#D=!1;static create(D){let $=b5(D);if(!$)return[];E2.#D=!0;let F=new E2(D,$);return E2.#D=!1,F}constructor(D,$){if(!E2.#D)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new $(D),this.length=0}push(D){this.heap[this.length++]=D}pop(){return this.heap[--this.length]}}var pH,I5,T6,Z5=(D,$,F,B)=>{typeof T6.emitWarning==="function"?T6.emitWarning(D,$,F,B):console.error(`[${F}] ${$}: ${D}`)},N8,L5,cH=(D)=>!I5.has(D),bO,E0=(D)=>D&&D===Math.floor(D)&&D>0&&isFinite(D),b5=(D)=>!E0(D)?null:D<=Math.pow(2,8)?Uint8Array:D<=Math.pow(2,16)?Uint16Array:D<=Math.pow(2,32)?Uint32Array:D<=Number.MAX_SAFE_INTEGER?_3:null,_3,i0;var S5=FD(()=>{pH=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date,I5=new Set,T6=typeof process==="object"&&!!process?process:{},N8=globalThis.AbortController,L5=globalThis.AbortSignal;if(typeof N8>"u"){L5=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(B,q){this._onabort.push(q)}},N8=class{constructor(){$()}signal=new L5;abort(B){if(this.signal.aborted)return;this.signal.reason=B,this.signal.aborted=!0;for(let q of this.signal._onabort)q(B);this.signal.onabort?.(B)}};let D=T6.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",$=()=>{if(!D)return;D=!1,Z5("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",$)}}bO=Symbol("type");_3=class _3 extends Array{constructor(D){super(D);this.fill(0)}};i0=class i0{#D;#F;#X;#q;#Q;#M;#U;#C;get perf(){return this.#C}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#J;#G;#_;#Y;#B;#V;#K;#w;#W;#I;#u;#j;#R;#A;#z;#E;#N;#$;#v;static unsafeExposeInternals(D){return{starts:D.#R,ttls:D.#A,autopurgeTimers:D.#z,sizes:D.#j,keyMap:D.#_,keyList:D.#Y,valList:D.#B,next:D.#V,prev:D.#K,get head(){return D.#w},get tail(){return D.#W},free:D.#I,isBackgroundFetch:($)=>D.#H($),backgroundFetch:($,F,B,q)=>D.#l($,F,B,q),moveToTail:($)=>D.#k($),indexes:($)=>D.#b($),rindexes:($)=>D.#S($),isStale:($)=>D.#O($)}}get max(){return this.#D}get maxSize(){return this.#F}get calculatedSize(){return this.#G}get size(){return this.#J}get fetchMethod(){return this.#M}get memoMethod(){return this.#U}get dispose(){return this.#X}get onInsert(){return this.#q}get disposeAfter(){return this.#Q}constructor(D){let{max:$=0,ttl:F,ttlResolution:B=1,ttlAutopurge:q,updateAgeOnGet:Q,updateAgeOnHas:X,allowStale:J,dispose:Y,onInsert:H,disposeAfter:C,noDisposeOnSet:_,noUpdateTTL:G,maxSize:u=0,maxEntrySize:U=0,sizeCalculation:W,fetchMethod:A,memoMethod:z,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:M,allowStaleOnFetchRejection:K,allowStaleOnFetchAbort:R,ignoreFetchAbort:Z,perf:v}=D;if(v!==void 0){if(typeof v?.now!=="function")throw TypeError("perf option must have a now() method if specified")}if(this.#C=v??pH,$!==0&&!E0($))throw TypeError("max option must be a nonnegative integer");let I=$?b5($):Array;if(!I)throw Error("invalid max value: "+$);if(this.#D=$,this.#F=u,this.maxEntrySize=U||this.#F,this.sizeCalculation=W,this.sizeCalculation){if(!this.#F&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!=="function")throw TypeError("sizeCalculation set to non-function")}if(z!==void 0&&typeof z!=="function")throw TypeError("memoMethod must be a function if defined");if(this.#U=z,A!==void 0&&typeof A!=="function")throw TypeError("fetchMethod must be a function if specified");if(this.#M=A,this.#N=!!A,this.#_=new Map,this.#Y=Array($).fill(void 0),this.#B=Array($).fill(void 0),this.#V=new I($),this.#K=new I($),this.#w=0,this.#W=0,this.#I=E2.create($),this.#J=0,this.#G=0,typeof Y==="function")this.#X=Y;if(typeof H==="function")this.#q=H;if(typeof C==="function")this.#Q=C,this.#u=[];else this.#Q=void 0,this.#u=void 0;if(this.#E=!!this.#X,this.#v=!!this.#q,this.#$=!!this.#Q,this.noDisposeOnSet=!!_,this.noUpdateTTL=!!G,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!K,this.allowStaleOnFetchAbort=!!R,this.ignoreFetchAbort=!!Z,this.maxEntrySize!==0){if(this.#F!==0){if(!E0(this.#F))throw TypeError("maxSize must be a positive integer if specified")}if(!E0(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#p()}if(this.allowStale=!!J,this.noDeleteOnStaleGet=!!M,this.updateAgeOnGet=!!Q,this.updateAgeOnHas=!!X,this.ttlResolution=E0(B)||B===0?B:1,this.ttlAutopurge=!!q,this.ttl=F||0,this.ttl){if(!E0(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#T()}if(this.#D===0&&this.ttl===0&&this.#F===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#D&&!this.#F){if(cH("LRU_CACHE_UNBOUNDED"))I5.add("LRU_CACHE_UNBOUNDED"),Z5("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning","LRU_CACHE_UNBOUNDED",i0)}}getRemainingTTL(D){return this.#_.has(D)?1/0:0}#T(){let D=new _3(this.#D),$=new _3(this.#D);this.#A=D,this.#R=$;let F=this.ttlAutopurge?Array(this.#D):void 0;this.#z=F,this.#h=(Q,X,J=this.#C.now())=>{if($[Q]=X!==0?J:0,D[Q]=X,F?.[Q])clearTimeout(F[Q]),F[Q]=void 0;if(X!==0&&F){let Y=setTimeout(()=>{if(this.#O(Q))this.#Z(this.#Y[Q],"expire")},X+1);if(Y.unref)Y.unref();F[Q]=Y}},this.#L=(Q)=>{$[Q]=D[Q]!==0?this.#C.now():0},this.#P=(Q,X)=>{if(D[X]){let J=D[X],Y=$[X];if(!J||!Y)return;Q.ttl=J,Q.start=Y,Q.now=B||q();let H=Q.now-Y;Q.remainingTTL=J-H}};let B=0,q=()=>{let Q=this.#C.now();if(this.ttlResolution>0){B=Q;let X=setTimeout(()=>B=0,this.ttlResolution);if(X.unref)X.unref()}return Q};this.getRemainingTTL=(Q)=>{let X=this.#_.get(Q);if(X===void 0)return 0;let J=D[X],Y=$[X];if(!J||!Y)return 1/0;let H=(B||q())-Y;return J-H},this.#O=(Q)=>{let X=$[Q],J=D[Q];return!!J&&!!X&&(B||q())-X>J}}#L=()=>{};#P=()=>{};#h=()=>{};#O=()=>!1;#p(){let D=new _3(this.#D);this.#G=0,this.#j=D,this.#y=($)=>{this.#G-=D[$],D[$]=0},this.#g=($,F,B,q)=>{if(this.#H(F))return 0;if(!E0(B))if(q){if(typeof q!=="function")throw TypeError("sizeCalculation must be a function");if(B=q(F,$),!E0(B))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return B},this.#f=($,F,B)=>{if(D[$]=F,this.#F){let q=this.#F-D[$];while(this.#G>q)this.#x(!0)}if(this.#G+=D[$],B)B.entrySize=F,B.totalCalculatedSize=this.#G}}#y=(D)=>{};#f=(D,$,F)=>{};#g=(D,$,F,B)=>{if(F||B)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#b({allowStale:D=this.allowStale}={}){if(this.#J)for(let $=this.#W;;){if(!this.#m($))break;if(D||!this.#O($))yield $;if($===this.#w)break;else $=this.#K[$]}}*#S({allowStale:D=this.allowStale}={}){if(this.#J)for(let $=this.#w;;){if(!this.#m($))break;if(D||!this.#O($))yield $;if($===this.#W)break;else $=this.#V[$]}}#m(D){return D!==void 0&&this.#_.get(this.#Y[D])===D}*entries(){for(let D of this.#b())if(this.#B[D]!==void 0&&this.#Y[D]!==void 0&&!this.#H(this.#B[D]))yield[this.#Y[D],this.#B[D]]}*rentries(){for(let D of this.#S())if(this.#B[D]!==void 0&&this.#Y[D]!==void 0&&!this.#H(this.#B[D]))yield[this.#Y[D],this.#B[D]]}*keys(){for(let D of this.#b()){let $=this.#Y[D];if($!==void 0&&!this.#H(this.#B[D]))yield $}}*rkeys(){for(let D of this.#S()){let $=this.#Y[D];if($!==void 0&&!this.#H(this.#B[D]))yield $}}*values(){for(let D of this.#b())if(this.#B[D]!==void 0&&!this.#H(this.#B[D]))yield this.#B[D]}*rvalues(){for(let D of this.#S())if(this.#B[D]!==void 0&&!this.#H(this.#B[D]))yield this.#B[D]}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(D,$={}){for(let F of this.#b()){let B=this.#B[F],q=this.#H(B)?B.__staleWhileFetching:B;if(q===void 0)continue;if(D(q,this.#Y[F],this))return this.get(this.#Y[F],$)}}forEach(D,$=this){for(let F of this.#b()){let B=this.#B[F],q=this.#H(B)?B.__staleWhileFetching:B;if(q===void 0)continue;D.call($,q,this.#Y[F],this)}}rforEach(D,$=this){for(let F of this.#S()){let B=this.#B[F],q=this.#H(B)?B.__staleWhileFetching:B;if(q===void 0)continue;D.call($,q,this.#Y[F],this)}}purgeStale(){let D=!1;for(let $ of this.#S({allowStale:!0}))if(this.#O($))this.#Z(this.#Y[$],"expire"),D=!0;return D}info(D){let $=this.#_.get(D);if($===void 0)return;let F=this.#B[$],B=this.#H(F)?F.__staleWhileFetching:F;if(B===void 0)return;let q={value:B};if(this.#A&&this.#R){let Q=this.#A[$],X=this.#R[$];if(Q&&X){let J=Q-(this.#C.now()-X);q.ttl=J,q.start=Date.now()}}if(this.#j)q.size=this.#j[$];return q}dump(){let D=[];for(let $ of this.#b({allowStale:!0})){let F=this.#Y[$],B=this.#B[$],q=this.#H(B)?B.__staleWhileFetching:B;if(q===void 0||F===void 0)continue;let Q={value:q};if(this.#A&&this.#R){Q.ttl=this.#A[$];let X=this.#C.now()-this.#R[$];Q.start=Math.floor(Date.now()-X)}if(this.#j)Q.size=this.#j[$];D.unshift([F,Q])}return D}load(D){this.clear();for(let[$,F]of D){if(F.start){let B=Date.now()-F.start;F.start=this.#C.now()-B}this.set($,F.value,F)}}set(D,$,F={}){if($===void 0)return this.delete(D),this;let{ttl:B=this.ttl,start:q,noDisposeOnSet:Q=this.noDisposeOnSet,sizeCalculation:X=this.sizeCalculation,status:J}=F,{noUpdateTTL:Y=this.noUpdateTTL}=F,H=this.#g(D,$,F.size||0,X);if(this.maxEntrySize&&H>this.maxEntrySize){if(J)J.set="miss",J.maxEntrySizeExceeded=!0;return this.#Z(D,"set"),this}let C=this.#J===0?void 0:this.#_.get(D);if(C===void 0){if(C=this.#J===0?this.#W:this.#I.length!==0?this.#I.pop():this.#J===this.#D?this.#x(!1):this.#J,this.#Y[C]=D,this.#B[C]=$,this.#_.set(D,C),this.#V[this.#W]=C,this.#K[C]=this.#W,this.#W=C,this.#J++,this.#f(C,H,J),J)J.set="add";if(Y=!1,this.#v)this.#q?.($,D,"add")}else{this.#k(C);let _=this.#B[C];if($!==_){if(this.#N&&this.#H(_)){_.__abortController.abort(Error("replaced"));let{__staleWhileFetching:G}=_;if(G!==void 0&&!Q){if(this.#E)this.#X?.(G,D,"set");if(this.#$)this.#u?.push([G,D,"set"])}}else if(!Q){if(this.#E)this.#X?.(_,D,"set");if(this.#$)this.#u?.push([_,D,"set"])}if(this.#y(C),this.#f(C,H,J),this.#B[C]=$,J){J.set="replace";let G=_&&this.#H(_)?_.__staleWhileFetching:_;if(G!==void 0)J.oldValue=G}}else if(J)J.set="update";if(this.#v)this.onInsert?.($,D,$===_?"update":"replace")}if(B!==0&&!this.#A)this.#T();if(this.#A){if(!Y)this.#h(C,B,q);if(J)this.#P(J,C)}if(!Q&&this.#$&&this.#u){let _=this.#u,G;while(G=_?.shift())this.#Q?.(...G)}return this}pop(){try{while(this.#J){let D=this.#B[this.#w];if(this.#x(!0),this.#H(D)){if(D.__staleWhileFetching)return D.__staleWhileFetching}else if(D!==void 0)return D}}finally{if(this.#$&&this.#u){let D=this.#u,$;while($=D?.shift())this.#Q?.(...$)}}}#x(D){let $=this.#w,F=this.#Y[$],B=this.#B[$];if(this.#N&&this.#H(B))B.__abortController.abort(Error("evicted"));else if(this.#E||this.#$){if(this.#E)this.#X?.(B,F,"evict");if(this.#$)this.#u?.push([B,F,"evict"])}if(this.#y($),this.#z?.[$])clearTimeout(this.#z[$]),this.#z[$]=void 0;if(D)this.#Y[$]=void 0,this.#B[$]=void 0,this.#I.push($);if(this.#J===1)this.#w=this.#W=0,this.#I.length=0;else this.#w=this.#V[$];return this.#_.delete(F),this.#J--,$}has(D,$={}){let{updateAgeOnHas:F=this.updateAgeOnHas,status:B}=$,q=this.#_.get(D);if(q!==void 0){let Q=this.#B[q];if(this.#H(Q)&&Q.__staleWhileFetching===void 0)return!1;if(!this.#O(q)){if(F)this.#L(q);if(B)B.has="hit",this.#P(B,q);return!0}else if(B)B.has="stale",this.#P(B,q)}else if(B)B.has="miss";return!1}peek(D,$={}){let{allowStale:F=this.allowStale}=$,B=this.#_.get(D);if(B===void 0||!F&&this.#O(B))return;let q=this.#B[B];return this.#H(q)?q.__staleWhileFetching:q}#l(D,$,F,B){let q=$===void 0?void 0:this.#B[$];if(this.#H(q))return q;let Q=new N8,{signal:X}=F;X?.addEventListener("abort",()=>Q.abort(X.reason),{signal:Q.signal});let J={signal:Q.signal,options:F,context:B},Y=(U,W=!1)=>{let{aborted:A}=Q.signal,z=F.ignoreFetchAbort&&U!==void 0;if(F.status)if(A&&!W){if(F.status.fetchAborted=!0,F.status.fetchError=Q.signal.reason,z)F.status.fetchAbortIgnored=!0}else F.status.fetchResolved=!0;if(A&&!z&&!W)return C(Q.signal.reason);let w=G,M=this.#B[$];if(M===G||z&&W&&M===void 0)if(U===void 0)if(w.__staleWhileFetching!==void 0)this.#B[$]=w.__staleWhileFetching;else this.#Z(D,"fetch");else{if(F.status)F.status.fetchUpdated=!0;this.set(D,U,J.options)}return U},H=(U)=>{if(F.status)F.status.fetchRejected=!0,F.status.fetchError=U;return C(U)},C=(U)=>{let{aborted:W}=Q.signal,A=W&&F.allowStaleOnFetchAbort,z=A||F.allowStaleOnFetchRejection,w=z||F.noDeleteOnFetchRejection,M=G;if(this.#B[$]===G){if(!w||M.__staleWhileFetching===void 0)this.#Z(D,"fetch");else if(!A)this.#B[$]=M.__staleWhileFetching}if(z){if(F.status&&M.__staleWhileFetching!==void 0)F.status.returnedStale=!0;return M.__staleWhileFetching}else if(M.__returned===M)throw U},_=(U,W)=>{let A=this.#M?.(D,q,J);if(A&&A instanceof Promise)A.then((z)=>U(z===void 0?void 0:z),W);Q.signal.addEventListener("abort",()=>{if(!F.ignoreFetchAbort||F.allowStaleOnFetchAbort){if(U(void 0),F.allowStaleOnFetchAbort)U=(z)=>Y(z,!0)}})};if(F.status)F.status.fetchDispatched=!0;let G=new Promise(_).then(Y,H),u=Object.assign(G,{__abortController:Q,__staleWhileFetching:q,__returned:void 0});if($===void 0)this.set(D,u,{...J.options,status:void 0}),$=this.#_.get(D);else this.#B[$]=u;return u}#H(D){if(!this.#N)return!1;let $=D;return!!$&&$ instanceof Promise&&$.hasOwnProperty("__staleWhileFetching")&&$.__abortController instanceof N8}async fetch(D,$={}){let{allowStale:F=this.allowStale,updateAgeOnGet:B=this.updateAgeOnGet,noDeleteOnStaleGet:q=this.noDeleteOnStaleGet,ttl:Q=this.ttl,noDisposeOnSet:X=this.noDisposeOnSet,size:J=0,sizeCalculation:Y=this.sizeCalculation,noUpdateTTL:H=this.noUpdateTTL,noDeleteOnFetchRejection:C=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:_=this.allowStaleOnFetchRejection,ignoreFetchAbort:G=this.ignoreFetchAbort,allowStaleOnFetchAbort:u=this.allowStaleOnFetchAbort,context:U,forceRefresh:W=!1,status:A,signal:z}=$;if(!this.#N){if(A)A.fetch="get";return this.get(D,{allowStale:F,updateAgeOnGet:B,noDeleteOnStaleGet:q,status:A})}let w={allowStale:F,updateAgeOnGet:B,noDeleteOnStaleGet:q,ttl:Q,noDisposeOnSet:X,size:J,sizeCalculation:Y,noUpdateTTL:H,noDeleteOnFetchRejection:C,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:u,ignoreFetchAbort:G,status:A,signal:z},M=this.#_.get(D);if(M===void 0){if(A)A.fetch="miss";let K=this.#l(D,M,w,U);return K.__returned=K}else{let K=this.#B[M];if(this.#H(K)){let r=F&&K.__staleWhileFetching!==void 0;if(A){if(A.fetch="inflight",r)A.returnedStale=!0}return r?K.__staleWhileFetching:K.__returned=K}let R=this.#O(M);if(!W&&!R){if(A)A.fetch="hit";if(this.#k(M),B)this.#L(M);if(A)this.#P(A,M);return K}let Z=this.#l(D,M,w,U),I=Z.__staleWhileFetching!==void 0&&F;if(A){if(A.fetch=R?"stale":"refresh",I&&R)A.returnedStale=!0}return I?Z.__staleWhileFetching:Z.__returned=Z}}async forceFetch(D,$={}){let F=await this.fetch(D,$);if(F===void 0)throw Error("fetch() returned undefined");return F}memo(D,$={}){let F=this.#U;if(!F)throw Error("no memoMethod provided to constructor");let{context:B,forceRefresh:q,...Q}=$,X=this.get(D,Q);if(!q&&X!==void 0)return X;let J=F(D,X,{options:Q,context:B});return this.set(D,J,Q),J}get(D,$={}){let{allowStale:F=this.allowStale,updateAgeOnGet:B=this.updateAgeOnGet,noDeleteOnStaleGet:q=this.noDeleteOnStaleGet,status:Q}=$,X=this.#_.get(D);if(X!==void 0){let J=this.#B[X],Y=this.#H(J);if(Q)this.#P(Q,X);if(this.#O(X)){if(Q)Q.get="stale";if(!Y){if(!q)this.#Z(D,"expire");if(Q&&F)Q.returnedStale=!0;return F?J:void 0}else{if(Q&&F&&J.__staleWhileFetching!==void 0)Q.returnedStale=!0;return F?J.__staleWhileFetching:void 0}}else{if(Q)Q.get="hit";if(Y)return J.__staleWhileFetching;if(this.#k(X),B)this.#L(X);return J}}else if(Q)Q.get="miss"}#d(D,$){this.#K[$]=D,this.#V[D]=$}#k(D){if(D!==this.#W){if(D===this.#w)this.#w=this.#V[D];else this.#d(this.#K[D],this.#V[D]);this.#d(this.#W,D),this.#W=D}}delete(D){return this.#Z(D,"delete")}#Z(D,$){let F=!1;if(this.#J!==0){let B=this.#_.get(D);if(B!==void 0){if(this.#z?.[B])clearTimeout(this.#z?.[B]),this.#z[B]=void 0;if(F=!0,this.#J===1)this.#c($);else{this.#y(B);let q=this.#B[B];if(this.#H(q))q.__abortController.abort(Error("deleted"));else if(this.#E||this.#$){if(this.#E)this.#X?.(q,D,$);if(this.#$)this.#u?.push([q,D,$])}if(this.#_.delete(D),this.#Y[B]=void 0,this.#B[B]=void 0,B===this.#W)this.#W=this.#K[B];else if(B===this.#w)this.#w=this.#V[B];else{let Q=this.#K[B];this.#V[Q]=this.#V[B];let X=this.#V[B];this.#K[X]=this.#K[B]}this.#J--,this.#I.push(B)}}}if(this.#$&&this.#u?.length){let B=this.#u,q;while(q=B?.shift())this.#Q?.(...q)}return F}clear(){return this.#c("delete")}#c(D){for(let $ of this.#S({allowStale:!0})){let F=this.#B[$];if(this.#H(F))F.__abortController.abort(Error("deleted"));else{let B=this.#Y[$];if(this.#E)this.#X?.(F,B,D);if(this.#$)this.#u?.push([F,B,D])}}if(this.#_.clear(),this.#B.fill(void 0),this.#Y.fill(void 0),this.#A&&this.#R){this.#A.fill(0),this.#R.fill(0);for(let $ of this.#z??[])if($!==void 0)clearTimeout($);this.#z?.fill(void 0)}if(this.#j)this.#j.fill(0);if(this.#w=0,this.#W=0,this.#I.length=0,this.#G=0,this.#J=0,this.#$&&this.#u){let $=this.#u,F;while(F=$?.shift())this.#Q?.(...F)}}}});import{EventEmitter as h6}from"node:events";import k5 from"node:stream";import{StringDecoder as iH}from"node:string_decoder";class g6{src;dest;opts;ondrain;constructor(D,$,F){this.src=D,this.dest=$,this.opts=F,this.ondrain=()=>D[j2](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(D){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}var T5,nH=(D)=>!!D&&typeof D==="object"&&(D instanceof r0||D instanceof k5||rH(D)||aH(D)),rH=(D)=>!!D&&typeof D==="object"&&D instanceof h6&&typeof D.pipe==="function"&&D.pipe!==k5.Writable.prototype.pipe,aH=(D)=>!!D&&typeof D==="object"&&D instanceof h6&&typeof D.write==="function"&&typeof D.end==="function",C0,_0,O0,L8,G3,I8,P5,Z8,v5,lD,O2,XD,V3,j2,QD,uD,JD,P6,b8,VD,t,v6,f6,f5,k6,tD,y6,S8,W3,n0,jD,u3=(D)=>Promise.resolve().then(D),sH=(D)=>D(),oH=(D)=>D==="end"||D==="finish"||D==="prefinish",tH=(D)=>D instanceof ArrayBuffer||!!D&&typeof D==="object"&&D.constructor&&D.constructor.name==="ArrayBuffer"&&D.byteLength>=0,eH=(D)=>!Buffer.isBuffer(D)&&ArrayBuffer.isView(D),y5,DC=(D)=>!!D.objectMode,$C=(D)=>!D.objectMode&&!!D.encoding&&D.encoding!=="buffer",r0;var m6=FD(()=>{T5=typeof process==="object"&&process?process:{stdout:null,stderr:null},C0=Symbol("EOF"),_0=Symbol("maybeEmitEnd"),O0=Symbol("emittedEnd"),L8=Symbol("emittingEnd"),G3=Symbol("emittedError"),I8=Symbol("closed"),P5=Symbol("read"),Z8=Symbol("flush"),v5=Symbol("flushChunk"),lD=Symbol("encoding"),O2=Symbol("decoder"),XD=Symbol("flowing"),V3=Symbol("paused"),j2=Symbol("resume"),QD=Symbol("buffer"),uD=Symbol("pipes"),JD=Symbol("bufferLength"),P6=Symbol("bufferPush"),b8=Symbol("bufferShift"),VD=Symbol("objectMode"),t=Symbol("destroyed"),v6=Symbol("error"),f6=Symbol("emitData"),f5=Symbol("emitEnd"),k6=Symbol("emitEnd2"),tD=Symbol("async"),y6=Symbol("abort"),S8=Symbol("aborted"),W3=Symbol("signal"),n0=Symbol("dataListeners"),jD=Symbol("discarded");y5=class y5 extends g6{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(D,$,F){super(D,$,F);this.proxyErrors=(B)=>$.emit("error",B),D.on("error",this.proxyErrors)}};r0=class r0 extends h6{[XD]=!1;[V3]=!1;[uD]=[];[QD]=[];[VD];[lD];[tD];[O2];[C0]=!1;[O0]=!1;[L8]=!1;[I8]=!1;[G3]=null;[JD]=0;[t]=!1;[W3];[S8]=!1;[n0]=0;[jD]=!1;writable=!0;readable=!0;constructor(...D){let $=D[0]||{};super();if($.objectMode&&typeof $.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(DC($))this[VD]=!0,this[lD]=null;else if($C($))this[lD]=$.encoding,this[VD]=!1;else this[VD]=!1,this[lD]=null;if(this[tD]=!!$.async,this[O2]=this[lD]?new iH(this[lD]):null,$&&$.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[QD]});if($&&$.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[uD]});let{signal:F}=$;if(F)if(this[W3]=F,F.aborted)this[y6]();else F.addEventListener("abort",()=>this[y6]())}get bufferLength(){return this[JD]}get encoding(){return this[lD]}set encoding(D){throw Error("Encoding must be set at instantiation time")}setEncoding(D){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[VD]}set objectMode(D){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[tD]}set["async"](D){this[tD]=this[tD]||!!D}[y6](){this[S8]=!0,this.emit("abort",this[W3]?.reason),this.destroy(this[W3]?.reason)}get aborted(){return this[S8]}set aborted(D){}write(D,$,F){if(this[S8])return!1;if(this[C0])throw Error("write after end");if(this[t])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof $==="function")F=$,$="utf8";if(!$)$="utf8";let B=this[tD]?u3:sH;if(!this[VD]&&!Buffer.isBuffer(D)){if(eH(D))D=Buffer.from(D.buffer,D.byteOffset,D.byteLength);else if(tH(D))D=Buffer.from(D);else if(typeof D!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[VD]){if(this[XD]&&this[JD]!==0)this[Z8](!0);if(this[XD])this.emit("data",D);else this[P6](D);if(this[JD]!==0)this.emit("readable");if(F)B(F);return this[XD]}if(!D.length){if(this[JD]!==0)this.emit("readable");if(F)B(F);return this[XD]}if(typeof D==="string"&&!($===this[lD]&&!this[O2]?.lastNeed))D=Buffer.from(D,$);if(Buffer.isBuffer(D)&&this[lD])D=this[O2].write(D);if(this[XD]&&this[JD]!==0)this[Z8](!0);if(this[XD])this.emit("data",D);else this[P6](D);if(this[JD]!==0)this.emit("readable");if(F)B(F);return this[XD]}read(D){if(this[t])return null;if(this[jD]=!1,this[JD]===0||D===0||D&&D>this[JD])return this[_0](),null;if(this[VD])D=null;if(this[QD].length>1&&!this[VD])this[QD]=[this[lD]?this[QD].join(""):Buffer.concat(this[QD],this[JD])];let $=this[P5](D||null,this[QD][0]);return this[_0](),$}[P5](D,$){if(this[VD])this[b8]();else{let F=$;if(D===F.length||D===null)this[b8]();else if(typeof F==="string")this[QD][0]=F.slice(D),$=F.slice(0,D),this[JD]-=D;else this[QD][0]=F.subarray(D),$=F.subarray(0,D),this[JD]-=D}if(this.emit("data",$),!this[QD].length&&!this[C0])this.emit("drain");return $}end(D,$,F){if(typeof D==="function")F=D,D=void 0;if(typeof $==="function")F=$,$="utf8";if(D!==void 0)this.write(D,$);if(F)this.once("end",F);if(this[C0]=!0,this.writable=!1,this[XD]||!this[V3])this[_0]();return this}[j2](){if(this[t])return;if(!this[n0]&&!this[uD].length)this[jD]=!0;if(this[V3]=!1,this[XD]=!0,this.emit("resume"),this[QD].length)this[Z8]();else if(this[C0])this[_0]();else this.emit("drain")}resume(){return this[j2]()}pause(){this[XD]=!1,this[V3]=!0,this[jD]=!1}get destroyed(){return this[t]}get flowing(){return this[XD]}get paused(){return this[V3]}[P6](D){if(this[VD])this[JD]+=1;else this[JD]+=D.length;this[QD].push(D)}[b8](){if(this[VD])this[JD]-=1;else this[JD]-=this[QD][0].length;return this[QD].shift()}[Z8](D=!1){do;while(this[v5](this[b8]())&&this[QD].length);if(!D&&!this[QD].length&&!this[C0])this.emit("drain")}[v5](D){return this.emit("data",D),this[XD]}pipe(D,$){if(this[t])return D;this[jD]=!1;let F=this[O0];if($=$||{},D===T5.stdout||D===T5.stderr)$.end=!1;else $.end=$.end!==!1;if($.proxyErrors=!!$.proxyErrors,F){if($.end)D.end()}else if(this[uD].push(!$.proxyErrors?new g6(this,D,$):new y5(this,D,$)),this[tD])u3(()=>this[j2]());else this[j2]();return D}unpipe(D){let $=this[uD].find((F)=>F.dest===D);if($){if(this[uD].length===1){if(this[XD]&&this[n0]===0)this[XD]=!1;this[uD]=[]}else this[uD].splice(this[uD].indexOf($),1);$.unpipe()}}addListener(D,$){return this.on(D,$)}on(D,$){let F=super.on(D,$);if(D==="data"){if(this[jD]=!1,this[n0]++,!this[uD].length&&!this[XD])this[j2]()}else if(D==="readable"&&this[JD]!==0)super.emit("readable");else if(oH(D)&&this[O0])super.emit(D),this.removeAllListeners(D);else if(D==="error"&&this[G3]){let B=$;if(this[tD])u3(()=>B.call(this,this[G3]));else B.call(this,this[G3])}return F}removeListener(D,$){return this.off(D,$)}off(D,$){let F=super.off(D,$);if(D==="data"){if(this[n0]=this.listeners("data").length,this[n0]===0&&!this[jD]&&!this[uD].length)this[XD]=!1}return F}removeAllListeners(D){let $=super.removeAllListeners(D);if(D==="data"||D===void 0){if(this[n0]=0,!this[jD]&&!this[uD].length)this[XD]=!1}return $}get emittedEnd(){return this[O0]}[_0](){if(!this[L8]&&!this[O0]&&!this[t]&&this[QD].length===0&&this[C0]){if(this[L8]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[I8])this.emit("close");this[L8]=!1}}emit(D,...$){let F=$[0];if(D!=="error"&&D!=="close"&&D!==t&&this[t])return!1;else if(D==="data")return!this[VD]&&!F?!1:this[tD]?(u3(()=>this[f6](F)),!0):this[f6](F);else if(D==="end")return this[f5]();else if(D==="close"){if(this[I8]=!0,!this[O0]&&!this[t])return!1;let q=super.emit("close");return this.removeAllListeners("close"),q}else if(D==="error"){this[G3]=F,super.emit(v6,F);let q=!this[W3]||this.listeners("error").length?super.emit("error",F):!1;return this[_0](),q}else if(D==="resume"){let q=super.emit("resume");return this[_0](),q}else if(D==="finish"||D==="prefinish"){let q=super.emit(D);return this.removeAllListeners(D),q}let B=super.emit(D,...$);return this[_0](),B}[f6](D){for(let F of this[uD])if(F.dest.write(D)===!1)this.pause();let $=this[jD]?!1:super.emit("data",D);return this[_0](),$}[f5](){if(this[O0])return!1;return this[O0]=!0,this.readable=!1,this[tD]?(u3(()=>this[k6]()),!0):this[k6]()}[k6](){if(this[O2]){let $=this[O2].end();if($){for(let F of this[uD])F.dest.write($);if(!this[jD])super.emit("data",$)}}for(let $ of this[uD])$.end();let D=super.emit("end");return this.removeAllListeners("end"),D}async collect(){let D=Object.assign([],{dataLength:0});if(!this[VD])D.dataLength=0;let $=this.promise();return this.on("data",(F)=>{if(D.push(F),!this[VD])D.dataLength+=F.length}),await $,D}async concat(){if(this[VD])throw Error("cannot concat in objectMode");let D=await this.collect();return this[lD]?D.join(""):Buffer.concat(D,D.dataLength)}async promise(){return new Promise((D,$)=>{this.on(t,()=>$(Error("stream destroyed"))),this.on("error",(F)=>$(F)),this.on("end",()=>D())})}[Symbol.asyncIterator](){this[jD]=!1;let D=!1,$=async()=>{return this.pause(),D=!0,{value:void 0,done:!0}};return{next:()=>{if(D)return $();let B=this.read();if(B!==null)return Promise.resolve({done:!1,value:B});if(this[C0])return $();let q,Q,X=(C)=>{this.off("data",J),this.off("end",Y),this.off(t,H),$(),Q(C)},J=(C)=>{this.off("error",X),this.off("end",Y),this.off(t,H),this.pause(),q({value:C,done:!!this[C0]})},Y=()=>{this.off("error",X),this.off("data",J),this.off(t,H),$(),q({done:!0,value:void 0})},H=()=>X(Error("stream destroyed"));return new Promise((C,_)=>{Q=_,q=C,this.once(t,H),this.once("error",X),this.once("end",Y),this.once("data",J)})},throw:$,return:$,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[jD]=!1;let D=!1,$=()=>{return this.pause(),this.off(v6,$),this.off(t,$),this.off("end",$),D=!0,{done:!0,value:void 0}},F=()=>{if(D)return $();let B=this.read();return B===null?$():{done:!1,value:B}};return this.once("end",$),this.once(v6,$),this.once(t,$),{next:F,throw:$,return:$,[Symbol.iterator](){return this}}}destroy(D){if(this[t]){if(D)this.emit("error",D);else this.emit(t);return this}this[t]=!0,this[jD]=!0,this[QD].length=0,this[JD]=0;let $=this;if(typeof $.close==="function"&&!this[I8])$.close();if(D)this.emit("error",D);else this.emit(t);return this}static get isStream(){return nH}}});import{posix as FC,win32 as d6}from"node:path";import{fileURLToPath as BC}from"node:url";import{lstatSync as qC,readdir as XC,readdirSync as QC,readlinkSync as JC,realpathSync as YC}from"fs";import*as HC from"node:fs";import{lstat as _C,readdir as GC,readlink as VC,realpath as WC}from"node:fs/promises";var CC,U3,l5=(D)=>!D||D===U3||D===HC?U3:{...U3,...D,promises:{...U3.promises,...D.promises||{}}},d5,uC=(D)=>D.replace(/\//g,"\\").replace(d5,"$1\\"),AC,bD=0,p5=1,c5=2,eD=4,i5=6,n5=8,a0=10,r5=12,ZD=15,A3,x6=16,h5=32,z3=64,dD=128,T8=256,v8=512,g5,UC=1023,l6=(D)=>D.isFile()?n5:D.isDirectory()?eD:D.isSymbolicLink()?a0:D.isCharacterDevice()?c5:D.isBlockDevice()?i5:D.isSocket()?r5:D.isFIFO()?p5:bD,m5,w3=(D)=>{let $=m5.get(D);if($)return $;let F=D.normalize("NFKD");return m5.set(D,F),F},x5,P8=(D)=>{let $=x5.get(D);if($)return $;let F=w3(D.toLowerCase());return x5.set(D,F),F},p6,a5,s5,AD,f8,k8,c6,M3,K3,y8,lO,o5;var t5=FD(()=>{S5();m6();CC=YC.native,U3={lstatSync:qC,readdir:XC,readdirSync:QC,readlinkSync:JC,realpathSync:CC,promises:{lstat:_C,readdir:GC,readlink:VC,realpath:WC}},d5=/^\\\\\?\\([a-z]:)\\?$/i,AC=/[\\\/]/,A3=~ZD,g5=z3|dD|v8,m5=new i0({max:4096}),x5=new i0({max:4096});p6=class p6 extends i0{constructor(){super({max:256})}};a5=class a5 extends i0{constructor(D=16384){super({maxSize:D,sizeCalculation:($)=>$.length+1})}};s5=Symbol("PathScurry setAsCwd");AD=class AD{name;root;roots;parent;nocase;isCWD=!1;#D;#F;get dev(){return this.#F}#X;get mode(){return this.#X}#q;get nlink(){return this.#q}#Q;get uid(){return this.#Q}#M;get gid(){return this.#M}#U;get rdev(){return this.#U}#C;get blksize(){return this.#C}#J;get ino(){return this.#J}#G;get size(){return this.#G}#_;get blocks(){return this.#_}#Y;get atimeMs(){return this.#Y}#B;get mtimeMs(){return this.#B}#V;get ctimeMs(){return this.#V}#K;get birthtimeMs(){return this.#K}#w;get atime(){return this.#w}#W;get mtime(){return this.#W}#I;get ctime(){return this.#I}#u;get birthtime(){return this.#u}#j;#R;#A;#z;#E;#N;#$;#v;#T;#L;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(D,$=bD,F,B,q,Q,X){if(this.name=D,this.#j=q?P8(D):w3(D),this.#$=$&UC,this.nocase=q,this.roots=B,this.root=F||this,this.#v=Q,this.#A=X.fullpath,this.#E=X.relative,this.#N=X.relativePosix,this.parent=X.parent,this.parent)this.#D=this.parent.#D;else this.#D=l5(X.fs)}depth(){if(this.#R!==void 0)return this.#R;if(!this.parent)return this.#R=0;return this.#R=this.parent.depth()+1}childrenCache(){return this.#v}resolve(D){if(!D)return this;let $=this.getRootString(D),B=D.substring($.length).split(this.splitSep);return $?this.getRoot($).#P(B):this.#P(B)}#P(D){let $=this;for(let F of D)$=$.child(F);return $}children(){let D=this.#v.get(this);if(D)return D;let $=Object.assign([],{provisional:0});return this.#v.set(this,$),this.#$&=~x6,$}child(D,$){if(D===""||D===".")return this;if(D==="..")return this.parent||this;let F=this.children(),B=this.nocase?P8(D):w3(D);for(let J of F)if(J.#j===B)return J;let q=this.parent?this.sep:"",Q=this.#A?this.#A+q+D:void 0,X=this.newChild(D,bD,{...$,parent:this,fullpath:Q});if(!this.canReaddir())X.#$|=dD;return F.push(X),X}relative(){if(this.isCWD)return"";if(this.#E!==void 0)return this.#E;let D=this.name,$=this.parent;if(!$)return this.#E=this.name;let F=$.relative();return F+(!F||!$.parent?"":this.sep)+D}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#N!==void 0)return this.#N;let D=this.name,$=this.parent;if(!$)return this.#N=this.fullpathPosix();let F=$.relativePosix();return F+(!F||!$.parent?"":"/")+D}fullpath(){if(this.#A!==void 0)return this.#A;let D=this.name,$=this.parent;if(!$)return this.#A=this.name;let B=$.fullpath()+(!$.parent?"":this.sep)+D;return this.#A=B}fullpathPosix(){if(this.#z!==void 0)return this.#z;if(this.sep==="/")return this.#z=this.fullpath();if(!this.parent){let B=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(B))return this.#z=`//?/${B}`;else return this.#z=B}let D=this.parent,$=D.fullpathPosix(),F=$+(!$||!D.parent?"":"/")+this.name;return this.#z=F}isUnknown(){return(this.#$&ZD)===bD}isType(D){return this[`is${D}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#$&ZD)===n5}isDirectory(){return(this.#$&ZD)===eD}isCharacterDevice(){return(this.#$&ZD)===c5}isBlockDevice(){return(this.#$&ZD)===i5}isFIFO(){return(this.#$&ZD)===p5}isSocket(){return(this.#$&ZD)===r5}isSymbolicLink(){return(this.#$&a0)===a0}lstatCached(){return this.#$&h5?this:void 0}readlinkCached(){return this.#T}realpathCached(){return this.#L}readdirCached(){let D=this.children();return D.slice(0,D.provisional)}canReadlink(){if(this.#T)return!0;if(!this.parent)return!1;let D=this.#$&ZD;return!(D!==bD&&D!==a0||this.#$&T8||this.#$&dD)}calledReaddir(){return!!(this.#$&x6)}isENOENT(){return!!(this.#$&dD)}isNamed(D){return!this.nocase?this.#j===w3(D):this.#j===P8(D)}async readlink(){let D=this.#T;if(D)return D;if(!this.canReadlink())return;if(!this.parent)return;try{let $=await this.#D.promises.readlink(this.fullpath()),F=(await this.parent.realpath())?.resolve($);if(F)return this.#T=F}catch($){this.#S($.code);return}}readlinkSync(){let D=this.#T;if(D)return D;if(!this.canReadlink())return;if(!this.parent)return;try{let $=this.#D.readlinkSync(this.fullpath()),F=this.parent.realpathSync()?.resolve($);if(F)return this.#T=F}catch($){this.#S($.code);return}}#h(D){this.#$|=x6;for(let $=D.provisional;$<D.length;$++){let F=D[$];if(F)F.#O()}}#O(){if(this.#$&dD)return;this.#$=(this.#$|dD)&A3,this.#p()}#p(){let D=this.children();D.provisional=0;for(let $ of D)$.#O()}#y(){this.#$|=v8,this.#f()}#f(){if(this.#$&z3)return;let D=this.#$;if((D&ZD)===eD)D&=A3;this.#$=D|z3,this.#p()}#g(D=""){if(D==="ENOTDIR"||D==="EPERM")this.#f();else if(D==="ENOENT")this.#O();else this.children().provisional=0}#b(D=""){if(D==="ENOTDIR")this.parent.#f();else if(D==="ENOENT")this.#O()}#S(D=""){let $=this.#$;if($|=T8,D==="ENOENT")$|=dD;if(D==="EINVAL"||D==="UNKNOWN")$&=A3;if(this.#$=$,D==="ENOTDIR"&&this.parent)this.parent.#f()}#m(D,$){return this.#l(D,$)||this.#x(D,$)}#x(D,$){let F=l6(D),B=this.newChild(D.name,F,{parent:this}),q=B.#$&ZD;if(q!==eD&&q!==a0&&q!==bD)B.#$|=z3;return $.unshift(B),$.provisional++,B}#l(D,$){for(let F=$.provisional;F<$.length;F++){let B=$[F];if((this.nocase?P8(D.name):w3(D.name))!==B.#j)continue;return this.#H(D,B,F,$)}}#H(D,$,F,B){let q=$.name;if($.#$=$.#$&A3|l6(D),q!==D.name)$.name=D.name;if(F!==B.provisional){if(F===B.length-1)B.pop();else B.splice(F,1);B.unshift($)}return B.provisional++,$}async lstat(){if((this.#$&dD)===0)try{return this.#d(await this.#D.promises.lstat(this.fullpath())),this}catch(D){this.#b(D.code)}}lstatSync(){if((this.#$&dD)===0)try{return this.#d(this.#D.lstatSync(this.fullpath())),this}catch(D){this.#b(D.code)}}#d(D){let{atime:$,atimeMs:F,birthtime:B,birthtimeMs:q,blksize:Q,blocks:X,ctime:J,ctimeMs:Y,dev:H,gid:C,ino:_,mode:G,mtime:u,mtimeMs:U,nlink:W,rdev:A,size:z,uid:w}=D;this.#w=$,this.#Y=F,this.#u=B,this.#K=q,this.#C=Q,this.#_=X,this.#I=J,this.#V=Y,this.#F=H,this.#M=C,this.#J=_,this.#X=G,this.#W=u,this.#B=U,this.#q=W,this.#U=A,this.#G=z,this.#Q=w;let M=l6(D);if(this.#$=this.#$&A3|M|h5,M!==bD&&M!==eD&&M!==a0)this.#$|=z3}#k=[];#Z=!1;#c(D){this.#Z=!1;let $=this.#k.slice();this.#k.length=0,$.forEach((F)=>F(null,D))}readdirCB(D,$=!1){if(!this.canReaddir()){if($)D(null,[]);else queueMicrotask(()=>D(null,[]));return}let F=this.children();if(this.calledReaddir()){let q=F.slice(0,F.provisional);if($)D(null,q);else queueMicrotask(()=>D(null,q));return}if(this.#k.push(D),this.#Z)return;this.#Z=!0;let B=this.fullpath();this.#D.readdir(B,{withFileTypes:!0},(q,Q)=>{if(q)this.#g(q.code),F.provisional=0;else{for(let X of Q)this.#m(X,F);this.#h(F)}this.#c(F.slice(0,F.provisional));return})}#i;async readdir(){if(!this.canReaddir())return[];let D=this.children();if(this.calledReaddir())return D.slice(0,D.provisional);let $=this.fullpath();if(this.#i)await this.#i;else{let F=()=>{};this.#i=new Promise((B)=>F=B);try{for(let B of await this.#D.promises.readdir($,{withFileTypes:!0}))this.#m(B,D);this.#h(D)}catch(B){this.#g(B.code),D.provisional=0}this.#i=void 0,F()}return D.slice(0,D.provisional)}readdirSync(){if(!this.canReaddir())return[];let D=this.children();if(this.calledReaddir())return D.slice(0,D.provisional);let $=this.fullpath();try{for(let F of this.#D.readdirSync($,{withFileTypes:!0}))this.#m(F,D);this.#h(D)}catch(F){this.#g(F.code),D.provisional=0}return D.slice(0,D.provisional)}canReaddir(){if(this.#$&g5)return!1;let D=ZD&this.#$;if(!(D===bD||D===eD||D===a0))return!1;return!0}shouldWalk(D,$){return(this.#$&eD)===eD&&!(this.#$&g5)&&!D.has(this)&&(!$||$(this))}async realpath(){if(this.#L)return this.#L;if((v8|T8|dD)&this.#$)return;try{let D=await this.#D.promises.realpath(this.fullpath());return this.#L=this.resolve(D)}catch(D){this.#y()}}realpathSync(){if(this.#L)return this.#L;if((v8|T8|dD)&this.#$)return;try{let D=this.#D.realpathSync(this.fullpath());return this.#L=this.resolve(D)}catch(D){this.#y()}}[s5](D){if(D===this)return;D.isCWD=!1,this.isCWD=!0;let $=new Set([]),F=[],B=this;while(B&&B.parent)$.add(B),B.#E=F.join(this.sep),B.#N=F.join("/"),B=B.parent,F.push("..");B=D;while(B&&B.parent&&!$.has(B))B.#E=void 0,B.#N=void 0,B=B.parent}};f8=class f8 extends AD{sep="\\";splitSep=AC;constructor(D,$=bD,F,B,q,Q,X){super(D,$,F,B,q,Q,X)}newChild(D,$=bD,F={}){return new f8(D,$,this.root,this.roots,this.nocase,this.childrenCache(),F)}getRootString(D){return d6.parse(D).root}getRoot(D){if(D=uC(D.toUpperCase()),D===this.root.name)return this.root;for(let[$,F]of Object.entries(this.roots))if(this.sameRoot(D,$))return this.roots[D]=F;return this.roots[D]=new M3(D,this).root}sameRoot(D,$=this.root.name){return D=D.toUpperCase().replace(/\//g,"\\").replace(d5,"$1\\"),D===$}};k8=class k8 extends AD{splitSep="/";sep="/";constructor(D,$=bD,F,B,q,Q,X){super(D,$,F,B,q,Q,X)}getRootString(D){return D.startsWith("/")?"/":""}getRoot(D){return this.root}newChild(D,$=bD,F={}){return new k8(D,$,this.root,this.roots,this.nocase,this.childrenCache(),F)}};c6=class c6{root;rootPath;roots;cwd;#D;#F;#X;nocase;#q;constructor(D=process.cwd(),$,F,{nocase:B,childrenCacheSize:q=16384,fs:Q=U3}={}){if(this.#q=l5(Q),D instanceof URL||D.startsWith("file://"))D=BC(D);let X=$.resolve(D);this.roots=Object.create(null),this.rootPath=this.parseRootPath(X),this.#D=new p6,this.#F=new p6,this.#X=new a5(q);let J=X.substring(this.rootPath.length).split(F);if(J.length===1&&!J[0])J.pop();if(B===void 0)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=B,this.root=this.newRoot(this.#q),this.roots[this.rootPath]=this.root;let Y=this.root,H=J.length-1,C=$.sep,_=this.rootPath,G=!1;for(let u of J){let U=H--;Y=Y.child(u,{relative:Array(U).fill("..").join(C),relativePosix:Array(U).fill("..").join("/"),fullpath:_+=(G?"":C)+u}),G=!0}this.cwd=Y}depth(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.depth()}childrenCache(){return this.#X}resolve(...D){let $="";for(let q=D.length-1;q>=0;q--){let Q=D[q];if(!Q||Q===".")continue;if($=$?`${Q}/${$}`:Q,this.isAbsolute(Q))break}let F=this.#D.get($);if(F!==void 0)return F;let B=this.cwd.resolve($).fullpath();return this.#D.set($,B),B}resolvePosix(...D){let $="";for(let q=D.length-1;q>=0;q--){let Q=D[q];if(!Q||Q===".")continue;if($=$?`${Q}/${$}`:Q,this.isAbsolute(Q))break}let F=this.#F.get($);if(F!==void 0)return F;let B=this.cwd.resolve($).fullpathPosix();return this.#F.set($,B),B}relative(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.relative()}relativePosix(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.relativePosix()}basename(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.name}dirname(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return(D.parent||D).fullpath()}async readdir(D=this.cwd,$={withFileTypes:!0}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof AD))$=D,D=this.cwd;let{withFileTypes:F}=$;if(!D.canReaddir())return[];else{let B=await D.readdir();return F?B:B.map((q)=>q.name)}}readdirSync(D=this.cwd,$={withFileTypes:!0}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof AD))$=D,D=this.cwd;let{withFileTypes:F=!0}=$;if(!D.canReaddir())return[];else if(F)return D.readdirSync();else return D.readdirSync().map((B)=>B.name)}async lstat(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.lstat()}lstatSync(D=this.cwd){if(typeof D==="string")D=this.cwd.resolve(D);return D.lstatSync()}async readlink(D=this.cwd,{withFileTypes:$}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof AD))$=D.withFileTypes,D=this.cwd;let F=await D.readlink();return $?F:F?.fullpath()}readlinkSync(D=this.cwd,{withFileTypes:$}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof AD))$=D.withFileTypes,D=this.cwd;let F=D.readlinkSync();return $?F:F?.fullpath()}async realpath(D=this.cwd,{withFileTypes:$}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof AD))$=D.withFileTypes,D=this.cwd;let F=await D.realpath();return $?F:F?.fullpath()}realpathSync(D=this.cwd,{withFileTypes:$}={withFileTypes:!1}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof AD))$=D.withFileTypes,D=this.cwd;let F=D.realpathSync();return $?F:F?.fullpath()}async walk(D=this.cwd,$={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof AD))$=D,D=this.cwd;let{withFileTypes:F=!0,follow:B=!1,filter:q,walkFilter:Q}=$,X=[];if(!q||q(D))X.push(F?D:D.fullpath());let J=new Set,Y=(C,_)=>{J.add(C),C.readdirCB((G,u)=>{if(G)return _(G);let U=u.length;if(!U)return _();let W=()=>{if(--U===0)_()};for(let A of u){if(!q||q(A))X.push(F?A:A.fullpath());if(B&&A.isSymbolicLink())A.realpath().then((z)=>z?.isUnknown()?z.lstat():z).then((z)=>z?.shouldWalk(J,Q)?Y(z,W):W());else if(A.shouldWalk(J,Q))Y(A,W);else W()}},!0)},H=D;return new Promise((C,_)=>{Y(H,(G)=>{if(G)return _(G);C(X)})})}walkSync(D=this.cwd,$={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof AD))$=D,D=this.cwd;let{withFileTypes:F=!0,follow:B=!1,filter:q,walkFilter:Q}=$,X=[];if(!q||q(D))X.push(F?D:D.fullpath());let J=new Set([D]);for(let Y of J){let H=Y.readdirSync();for(let C of H){if(!q||q(C))X.push(F?C:C.fullpath());let _=C;if(C.isSymbolicLink()){if(!(B&&(_=C.realpathSync())))continue;if(_.isUnknown())_.lstatSync()}if(_.shouldWalk(J,Q))J.add(_)}}return X}[Symbol.asyncIterator](){return this.iterate()}iterate(D=this.cwd,$={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof AD))$=D,D=this.cwd;return this.stream(D,$)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(D=this.cwd,$={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof AD))$=D,D=this.cwd;let{withFileTypes:F=!0,follow:B=!1,filter:q,walkFilter:Q}=$;if(!q||q(D))yield F?D:D.fullpath();let X=new Set([D]);for(let J of X){let Y=J.readdirSync();for(let H of Y){if(!q||q(H))yield F?H:H.fullpath();let C=H;if(H.isSymbolicLink()){if(!(B&&(C=H.realpathSync())))continue;if(C.isUnknown())C.lstatSync()}if(C.shouldWalk(X,Q))X.add(C)}}}stream(D=this.cwd,$={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof AD))$=D,D=this.cwd;let{withFileTypes:F=!0,follow:B=!1,filter:q,walkFilter:Q}=$,X=new r0({objectMode:!0});if(!q||q(D))X.write(F?D:D.fullpath());let J=new Set,Y=[D],H=0,C=()=>{let _=!1;while(!_){let G=Y.shift();if(!G){if(H===0)X.end();return}H++,J.add(G);let u=(W,A,z=!1)=>{if(W)return X.emit("error",W);if(B&&!z){let w=[];for(let M of A)if(M.isSymbolicLink())w.push(M.realpath().then((K)=>K?.isUnknown()?K.lstat():K));if(w.length){Promise.all(w).then(()=>u(null,A,!0));return}}for(let w of A)if(w&&(!q||q(w))){if(!X.write(F?w:w.fullpath()))_=!0}H--;for(let w of A){let M=w.realpathCached()||w;if(M.shouldWalk(J,Q))Y.push(M)}if(_&&!X.flowing)X.once("drain",C);else if(!U)C()},U=!0;G.readdirCB(u,!0),U=!1}};return C(),X}streamSync(D=this.cwd,$={}){if(typeof D==="string")D=this.cwd.resolve(D);else if(!(D instanceof AD))$=D,D=this.cwd;let{withFileTypes:F=!0,follow:B=!1,filter:q,walkFilter:Q}=$,X=new r0({objectMode:!0}),J=new Set;if(!q||q(D))X.write(F?D:D.fullpath());let Y=[D],H=0,C=()=>{let _=!1;while(!_){let G=Y.shift();if(!G){if(H===0)X.end();return}H++,J.add(G);let u=G.readdirSync();for(let U of u)if(!q||q(U)){if(!X.write(F?U:U.fullpath()))_=!0}H--;for(let U of u){let W=U;if(U.isSymbolicLink()){if(!(B&&(W=U.realpathSync())))continue;if(W.isUnknown())W.lstatSync()}if(W.shouldWalk(J,Q))Y.push(W)}}if(_&&!X.flowing)X.once("drain",C)};return C(),X}chdir(D=this.cwd){let $=this.cwd;this.cwd=typeof D==="string"?this.cwd.resolve(D):D,this.cwd[s5]($)}};M3=class M3 extends c6{sep="\\";constructor(D=process.cwd(),$={}){let{nocase:F=!0}=$;super(D,d6,"\\",{...$,nocase:F});this.nocase=F;for(let B=this.cwd;B;B=B.parent)B.nocase=this.nocase}parseRootPath(D){return d6.parse(D).root.toUpperCase()}newRoot(D){return new f8(this.rootPath,eD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:D})}isAbsolute(D){return D.startsWith("/")||D.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(D)}};K3=class K3 extends c6{sep="/";constructor(D=process.cwd(),$={}){let{nocase:F=!1}=$;super(D,FC,"/",{...$,nocase:F});this.nocase=F}parseRootPath(D){return"/"}newRoot(D){return new k8(this.rootPath,eD,void 0,this.roots,this.nocase,this.childrenCache(),{fs:D})}isAbsolute(D){return D.startsWith("/")}};y8=class y8 extends K3{constructor(D=process.cwd(),$={}){let{nocase:F=!0}=$;super(D,{...$,nocase:F})}};lO=process.platform==="win32"?f8:k8,o5=process.platform==="win32"?M3:process.platform==="darwin"?y8:K3});class R2{#D;#F;#X;length;#q;#Q;#M;#U;#C;#J;#G=!0;constructor(D,$,F,B){if(!zC(D))throw TypeError("empty pattern list");if(!wC($))throw TypeError("empty glob list");if($.length!==D.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=D.length,F<0||F>=this.length)throw TypeError("index out of range");if(this.#D=D,this.#F=$,this.#X=F,this.#q=B,this.#X===0){if(this.isUNC()){let[q,Q,X,J,...Y]=this.#D,[H,C,_,G,...u]=this.#F;if(Y[0]==="")Y.shift(),u.shift();let U=[q,Q,X,J,""].join("/"),W=[H,C,_,G,""].join("/");this.#D=[U,...Y],this.#F=[W,...u],this.length=this.#D.length}else if(this.isDrive()||this.isAbsolute()){let[q,...Q]=this.#D,[X,...J]=this.#F;if(Q[0]==="")Q.shift(),J.shift();let Y=q+"/",H=X+"/";this.#D=[Y,...Q],this.#F=[H,...J],this.length=this.#D.length}}}pattern(){return this.#D[this.#X]}isString(){return typeof this.#D[this.#X]==="string"}isGlobstar(){return this.#D[this.#X]===_D}isRegExp(){return this.#D[this.#X]instanceof RegExp}globString(){return this.#M=this.#M||(this.#X===0?this.isAbsolute()?this.#F[0]+this.#F.slice(1).join("/"):this.#F.join("/"):this.#F.slice(this.#X).join("/"))}hasMore(){return this.length>this.#X+1}rest(){if(this.#Q!==void 0)return this.#Q;if(!this.hasMore())return this.#Q=null;return this.#Q=new R2(this.#D,this.#F,this.#X+1,this.#q),this.#Q.#J=this.#J,this.#Q.#C=this.#C,this.#Q.#U=this.#U,this.#Q}isUNC(){let D=this.#D;return this.#C!==void 0?this.#C:this.#C=this.#q==="win32"&&this.#X===0&&D[0]===""&&D[1]===""&&typeof D[2]==="string"&&!!D[2]&&typeof D[3]==="string"&&!!D[3]}isDrive(){let D=this.#D;return this.#U!==void 0?this.#U:this.#U=this.#q==="win32"&&this.#X===0&&this.length>1&&typeof D[0]==="string"&&/^[a-z]:$/i.test(D[0])}isAbsolute(){let D=this.#D;return this.#J!==void 0?this.#J:this.#J=D[0]===""&&D.length>1||this.isDrive()||this.isUNC()}root(){let D=this.#D[0];return typeof D==="string"&&this.isAbsolute()&&this.#X===0?D:""}checkFollowGlobstar(){return!(this.#X===0||!this.isGlobstar()||!this.#G)}markFollowGlobstar(){if(this.#X===0||!this.isGlobstar()||!this.#G)return!1;return this.#G=!1,!0}}var zC=(D)=>D.length>=1,wC=(D)=>D.length>=1;var i6=FD(()=>{K0()});class N2{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(D,{nobrace:$,nocase:F,noext:B,noglobstar:q,platform:Q=MC}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=Q,this.mmopts={dot:!0,nobrace:$,nocase:F,noext:B,noglobstar:q,optimizationLevel:2,platform:Q,nocomment:!0,nonegate:!0};for(let X of D)this.add(X)}add(D){let $=new ID(D,this.mmopts);for(let F=0;F<$.set.length;F++){let B=$.set[F],q=$.globParts[F];if(!B||!q)throw Error("invalid pattern object");while(B[0]==="."&&q[0]===".")B.shift(),q.shift();let Q=new R2(B,q,0,this.platform),X=new ID(Q.globString(),this.mmopts),J=q[q.length-1]==="**",Y=Q.isAbsolute();if(Y)this.absolute.push(X);else this.relative.push(X);if(J)if(Y)this.absoluteChildren.push(X);else this.relativeChildren.push(X)}}ignored(D){let $=D.fullpath(),F=`${$}/`,B=D.relative()||".",q=`${B}/`;for(let Q of this.relative)if(Q.match(B)||Q.match(q))return!0;for(let Q of this.absolute)if(Q.match($)||Q.match(F))return!0;return!1}childrenIgnored(D){let $=D.fullpath()+"/",F=(D.relative()||".")+"/";for(let B of this.relativeChildren)if(B.match(F))return!0;for(let B of this.absoluteChildren)if(B.match($))return!0;return!1}}var MC;var n6=FD(()=>{K0();i6();MC=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux"});class r6{store;constructor(D=new Map){this.store=D}copy(){return new r6(new Map(this.store))}hasWalked(D,$){return this.store.get(D.fullpath())?.has($.globString())}storeWalked(D,$){let F=D.fullpath(),B=this.store.get(F);if(B)B.add($.globString());else this.store.set(F,new Set([$.globString()]))}}class e5{store=new Map;add(D,$,F){let B=($?2:0)|(F?1:0),q=this.store.get(D);this.store.set(D,q===void 0?B:B&q)}entries(){return[...this.store.entries()].map(([D,$])=>[D,!!($&2),!!($&1)])}}class D${store=new Map;add(D,$){if(!D.canReaddir())return;let F=this.store.get(D);if(F){if(!F.find((B)=>B.globString()===$.globString()))F.push($)}else this.store.set(D,[$])}get(D){let $=this.store.get(D);if(!$)throw Error("attempting to walk unknown path");return $}entries(){return this.keys().map((D)=>[D,this.store.get(D)])}keys(){return[...this.store.keys()].filter((D)=>D.canReaddir())}}class E3{hasWalkedCache;matches=new e5;subwalks=new D$;patterns;follow;dot;opts;constructor(D,$){this.opts=D,this.follow=!!D.follow,this.dot=!!D.dot,this.hasWalkedCache=$?$.copy():new r6}processPatterns(D,$){this.patterns=$;let F=$.map((B)=>[D,B]);for(let[B,q]of F){this.hasWalkedCache.storeWalked(B,q);let Q=q.root(),X=q.isAbsolute()&&this.opts.absolute!==!1;if(Q){B=B.resolve(Q==="/"&&this.opts.root!==void 0?this.opts.root:Q);let C=q.rest();if(!C){this.matches.add(B,!0,!1);continue}else q=C}if(B.isENOENT())continue;let J,Y,H=!1;while(typeof(J=q.pattern())==="string"&&(Y=q.rest()))B=B.resolve(J),q=Y,H=!0;if(J=q.pattern(),Y=q.rest(),H){if(this.hasWalkedCache.hasWalked(B,q))continue;this.hasWalkedCache.storeWalked(B,q)}if(typeof J==="string"){let C=J===".."||J===""||J===".";this.matches.add(B.resolve(J),X,C);continue}else if(J===_D){if(!B.isSymbolicLink()||this.follow||q.checkFollowGlobstar())this.subwalks.add(B,q);let C=Y?.pattern(),_=Y?.rest();if(!Y||(C===""||C===".")&&!_)this.matches.add(B,X,C===""||C===".");else if(C===".."){let G=B.parent||B;if(!_)this.matches.add(G,X,!0);else if(!this.hasWalkedCache.hasWalked(G,_))this.subwalks.add(G,_)}}else if(J instanceof RegExp)this.subwalks.add(B,q)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new E3(this.opts,this.hasWalkedCache)}filterEntries(D,$){let F=this.subwalks.get(D),B=this.child();for(let q of $)for(let Q of F){let X=Q.isAbsolute(),J=Q.pattern(),Y=Q.rest();if(J===_D)B.testGlobstar(q,Q,Y,X);else if(J instanceof RegExp)B.testRegExp(q,J,Y,X);else B.testString(q,J,Y,X)}return B}testGlobstar(D,$,F,B){if(this.dot||!D.name.startsWith(".")){if(!$.hasMore())this.matches.add(D,B,!1);if(D.canReaddir()){if(this.follow||!D.isSymbolicLink())this.subwalks.add(D,$);else if(D.isSymbolicLink()){if(F&&$.checkFollowGlobstar())this.subwalks.add(D,F);else if($.markFollowGlobstar())this.subwalks.add(D,$)}}}if(F){let q=F.pattern();if(typeof q==="string"&&q!==".."&&q!==""&&q!==".")this.testString(D,q,F.rest(),B);else if(q===".."){let Q=D.parent||D;this.subwalks.add(Q,F)}else if(q instanceof RegExp)this.testRegExp(D,q,F.rest(),B)}}testRegExp(D,$,F,B){if(!$.test(D.name))return;if(!F)this.matches.add(D,B,!1);else this.subwalks.add(D,F)}testString(D,$,F,B){if(!D.isNamed($))return;if(!F)this.matches.add(D,B,!1);else this.subwalks.add(D,F)}}var $$=FD(()=>{K0()});class a6{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#D=[];#F;#X;signal;maxDepth;includeChildMatches;constructor(D,$,F){if(this.patterns=D,this.path=$,this.opts=F,this.#X=!F.posix&&F.platform==="win32"?"\\":"/",this.includeChildMatches=F.includeChildMatches!==!1,F.ignore||!this.includeChildMatches){if(this.#F=KC(F.ignore??[],F),!this.includeChildMatches&&typeof this.#F.add!=="function")throw Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=F.maxDepth||1/0,F.signal)this.signal=F.signal,this.signal.addEventListener("abort",()=>{this.#D.length=0})}#q(D){return this.seen.has(D)||!!this.#F?.ignored?.(D)}#Q(D){return!!this.#F?.childrenIgnored?.(D)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let D=void 0;while(!this.paused&&(D=this.#D.shift()))D()}onResume(D){if(this.signal?.aborted)return;if(!this.paused)D();else this.#D.push(D)}async matchCheck(D,$){if($&&this.opts.nodir)return;let F;if(this.opts.realpath){if(F=D.realpathCached()||await D.realpath(),!F)return;D=F}let q=D.isUnknown()||this.opts.stat?await D.lstat():D;if(this.opts.follow&&this.opts.nodir&&q?.isSymbolicLink()){let Q=await q.realpath();if(Q&&(Q.isUnknown()||this.opts.stat))await Q.lstat()}return this.matchCheckTest(q,$)}matchCheckTest(D,$){return D&&(this.maxDepth===1/0||D.depth()<=this.maxDepth)&&(!$||D.canReaddir())&&(!this.opts.nodir||!D.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!D.isSymbolicLink()||!D.realpathCached()?.isDirectory())&&!this.#q(D)?D:void 0}matchCheckSync(D,$){if($&&this.opts.nodir)return;let F;if(this.opts.realpath){if(F=D.realpathCached()||D.realpathSync(),!F)return;D=F}let q=D.isUnknown()||this.opts.stat?D.lstatSync():D;if(this.opts.follow&&this.opts.nodir&&q?.isSymbolicLink()){let Q=q.realpathSync();if(Q&&(Q?.isUnknown()||this.opts.stat))Q.lstatSync()}return this.matchCheckTest(q,$)}matchFinish(D,$){if(this.#q(D))return;if(!this.includeChildMatches&&this.#F?.add){let q=`${D.relativePosix()}/**`;this.#F.add(q)}let F=this.opts.absolute===void 0?$:this.opts.absolute;this.seen.add(D);let B=this.opts.mark&&D.isDirectory()?this.#X:"";if(this.opts.withFileTypes)this.matchEmit(D);else if(F){let q=this.opts.posix?D.fullpathPosix():D.fullpath();this.matchEmit(q+B)}else{let q=this.opts.posix?D.relativePosix():D.relative(),Q=this.opts.dotRelative&&!q.startsWith(".."+this.#X)?"."+this.#X:"";this.matchEmit(!q?"."+B:Q+q+B)}}async match(D,$,F){let B=await this.matchCheck(D,F);if(B)this.matchFinish(B,$)}matchSync(D,$,F){let B=this.matchCheckSync(D,F);if(B)this.matchFinish(B,$)}walkCB(D,$,F){if(this.signal?.aborted)F();this.walkCB2(D,$,new E3(this.opts),F)}walkCB2(D,$,F,B){if(this.#Q(D))return B();if(this.signal?.aborted)B();if(this.paused){this.onResume(()=>this.walkCB2(D,$,F,B));return}F.processPatterns(D,$);let q=1,Q=()=>{if(--q===0)B()};for(let[X,J,Y]of F.matches.entries()){if(this.#q(X))continue;q++,this.match(X,J,Y).then(()=>Q())}for(let X of F.subwalkTargets()){if(this.maxDepth!==1/0&&X.depth()>=this.maxDepth)continue;q++;let J=X.readdirCached();if(X.calledReaddir())this.walkCB3(X,J,F,Q);else X.readdirCB((Y,H)=>this.walkCB3(X,H,F,Q),!0)}Q()}walkCB3(D,$,F,B){F=F.filterEntries(D,$);let q=1,Q=()=>{if(--q===0)B()};for(let[X,J,Y]of F.matches.entries()){if(this.#q(X))continue;q++,this.match(X,J,Y).then(()=>Q())}for(let[X,J]of F.subwalks.entries())q++,this.walkCB2(X,J,F.child(),Q);Q()}walkCBSync(D,$,F){if(this.signal?.aborted)F();this.walkCB2Sync(D,$,new E3(this.opts),F)}walkCB2Sync(D,$,F,B){if(this.#Q(D))return B();if(this.signal?.aborted)B();if(this.paused){this.onResume(()=>this.walkCB2Sync(D,$,F,B));return}F.processPatterns(D,$);let q=1,Q=()=>{if(--q===0)B()};for(let[X,J,Y]of F.matches.entries()){if(this.#q(X))continue;this.matchSync(X,J,Y)}for(let X of F.subwalkTargets()){if(this.maxDepth!==1/0&&X.depth()>=this.maxDepth)continue;q++;let J=X.readdirSync();this.walkCB3Sync(X,J,F,Q)}Q()}walkCB3Sync(D,$,F,B){F=F.filterEntries(D,$);let q=1,Q=()=>{if(--q===0)B()};for(let[X,J,Y]of F.matches.entries()){if(this.#q(X))continue;this.matchSync(X,J,Y)}for(let[X,J]of F.subwalks.entries())q++,this.walkCB2Sync(X,J,F.child(),Q);Q()}}var KC=(D,$)=>typeof D==="string"?new N2([D],$):Array.isArray(D)?new N2(D,$):D,h8,g8;var F$=FD(()=>{m6();n6();$$();h8=class h8 extends a6{matches=new Set;constructor(D,$,F){super(D,$,F)}matchEmit(D){this.matches.add(D)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((D,$)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)$(this.signal.reason);else D(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}};g8=class g8 extends a6{results;constructor(D,$,F){super(D,$,F);this.results=new r0({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(D){if(this.results.write(D),!this.results.flowing)this.pause()}stream(){let D=this.path;if(D.isUnknown())D.lstat().then(()=>{this.walkCB(D,this.patterns,()=>this.results.end())});else this.walkCB(D,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}});import{fileURLToPath as EC}from"node:url";var OC,pD;var s6=FD(()=>{K0();t5();i6();F$();OC=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";pD=class pD{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(D,$){if(!$)throw TypeError("glob options required");if(this.withFileTypes=!!$.withFileTypes,this.signal=$.signal,this.follow=!!$.follow,this.dot=!!$.dot,this.dotRelative=!!$.dotRelative,this.nodir=!!$.nodir,this.mark=!!$.mark,!$.cwd)this.cwd="";else if($.cwd instanceof URL||$.cwd.startsWith("file://"))$.cwd=EC($.cwd);if(this.cwd=$.cwd||"",this.root=$.root,this.magicalBraces=!!$.magicalBraces,this.nobrace=!!$.nobrace,this.noext=!!$.noext,this.realpath=!!$.realpath,this.absolute=$.absolute,this.includeChildMatches=$.includeChildMatches!==!1,this.noglobstar=!!$.noglobstar,this.matchBase=!!$.matchBase,this.maxDepth=typeof $.maxDepth==="number"?$.maxDepth:1/0,this.stat=!!$.stat,this.ignore=$.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error("cannot set absolute and withFileTypes:true");if(typeof D==="string")D=[D];if(this.windowsPathsNoEscape=!!$.windowsPathsNoEscape||$.allowWindowsEscape===!1,this.windowsPathsNoEscape)D=D.map((J)=>J.replace(/\\/g,"/"));if(this.matchBase){if($.noglobstar)throw TypeError("base matching requires globstar");D=D.map((J)=>J.includes("/")?J:`./**/${J}`)}if(this.pattern=D,this.platform=$.platform||OC,this.opts={...$,platform:this.platform},$.scurry){if(this.scurry=$.scurry,$.nocase!==void 0&&$.nocase!==$.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let J=$.platform==="win32"?M3:$.platform==="darwin"?y8:$.platform?K3:o5;this.scurry=new J(this.cwd,{nocase:$.nocase,fs:$.fs})}this.nocase=this.scurry.nocase;let F=this.platform==="darwin"||this.platform==="win32",B={...$,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:F,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},q=this.pattern.map((J)=>new ID(J,B)),[Q,X]=q.reduce((J,Y)=>{return J[0].push(...Y.set),J[1].push(...Y.globParts),J},[[],[]]);this.patterns=Q.map((J,Y)=>{let H=X[Y];if(!H)throw Error("invalid pattern object");return new R2(J,H,0,this.platform)})}async walk(){return[...await new h8(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new h8(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new g8(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new g8(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}});var m8=(D,$={})=>{if(!Array.isArray(D))D=[D];for(let F of D)if(new ID(F,$).hasMagic())return!0;return!1};var o6=FD(()=>{K0()});var H$={};D8(H$,{unescape:()=>ND,sync:()=>Y$,streamSync:()=>q$,stream:()=>X$,iterateSync:()=>Q$,iterate:()=>J$,hasMagic:()=>m8,globSync:()=>e6,globStreamSync:()=>O3,globStream:()=>t6,globIterateSync:()=>j3,globIterate:()=>D9,glob:()=>L2,escape:()=>c0,Ignore:()=>N2,Glob:()=>pD});function O3(D,$={}){return new pD(D,$).streamSync()}function t6(D,$={}){return new pD(D,$).stream()}function e6(D,$={}){return new pD(D,$).walkSync()}async function B$(D,$={}){return new pD(D,$).walk()}function j3(D,$={}){return new pD(D,$).iterateSync()}function D9(D,$={}){return new pD(D,$).iterate()}var q$,X$,Q$,J$,Y$,L2;var $9=FD(()=>{K0();s6();o6();K0();s6();o6();n6();q$=O3,X$=Object.assign(t6,{sync:O3}),Q$=j3,J$=Object.assign(D9,{sync:j3}),Y$=Object.assign(e6,{stream:O3,iterate:j3}),L2=Object.assign(B$,{glob:B$,globSync:e6,sync:Y$,globStream:t6,stream:X$,globStreamSync:O3,streamSync:q$,globIterate:D9,iterate:J$,globIterateSync:j3,iterateSync:Q$,Glob:pD,hasMagic:m8,escape:c0,unescape:ND});L2.glob=L2});var d=L((SC)=>{var F9=Symbol.for("yaml.alias"),C$=Symbol.for("yaml.document"),x8=Symbol.for("yaml.map"),_$=Symbol.for("yaml.pair"),B9=Symbol.for("yaml.scalar"),l8=Symbol.for("yaml.seq"),G0=Symbol.for("yaml.node.type"),jC=(D)=>!!D&&typeof D==="object"&&D[G0]===F9,RC=(D)=>!!D&&typeof D==="object"&&D[G0]===C$,NC=(D)=>!!D&&typeof D==="object"&&D[G0]===x8,LC=(D)=>!!D&&typeof D==="object"&&D[G0]===_$,G$=(D)=>!!D&&typeof D==="object"&&D[G0]===B9,IC=(D)=>!!D&&typeof D==="object"&&D[G0]===l8;function V$(D){if(D&&typeof D==="object")switch(D[G0]){case x8:case l8:return!0}return!1}function ZC(D){if(D&&typeof D==="object")switch(D[G0]){case F9:case x8:case B9:case l8:return!0}return!1}var bC=(D)=>(G$(D)||V$(D))&&!!D.anchor;SC.ALIAS=F9;SC.DOC=C$;SC.MAP=x8;SC.NODE_TYPE=G0;SC.PAIR=_$;SC.SCALAR=B9;SC.SEQ=l8;SC.hasAnchor=bC;SC.isAlias=jC;SC.isCollection=V$;SC.isDocument=RC;SC.isMap=NC;SC.isNode=ZC;SC.isPair=LC;SC.isScalar=G$;SC.isSeq=IC});var R3=L((rC)=>{var $D=d(),zD=Symbol("break visit"),W$=Symbol("skip children"),D0=Symbol("remove node");function d8(D,$){let F=u$($);if($D.isDocument(D)){if(I2(null,D.contents,F,Object.freeze([D]))===D0)D.contents=null}else I2(null,D,F,Object.freeze([]))}d8.BREAK=zD;d8.SKIP=W$;d8.REMOVE=D0;function I2(D,$,F,B){let q=A$(D,$,F,B);if($D.isNode(q)||$D.isPair(q))return U$(D,B,q),I2(D,q,F,B);if(typeof q!=="symbol"){if($D.isCollection($)){B=Object.freeze(B.concat($));for(let Q=0;Q<$.items.length;++Q){let X=I2(Q,$.items[Q],F,B);if(typeof X==="number")Q=X-1;else if(X===zD)return zD;else if(X===D0)$.items.splice(Q,1),Q-=1}}else if($D.isPair($)){B=Object.freeze(B.concat($));let Q=I2("key",$.key,F,B);if(Q===zD)return zD;else if(Q===D0)$.key=null;let X=I2("value",$.value,F,B);if(X===zD)return zD;else if(X===D0)$.value=null}}return q}async function p8(D,$){let F=u$($);if($D.isDocument(D)){if(await Z2(null,D.contents,F,Object.freeze([D]))===D0)D.contents=null}else await Z2(null,D,F,Object.freeze([]))}p8.BREAK=zD;p8.SKIP=W$;p8.REMOVE=D0;async function Z2(D,$,F,B){let q=await A$(D,$,F,B);if($D.isNode(q)||$D.isPair(q))return U$(D,B,q),Z2(D,q,F,B);if(typeof q!=="symbol"){if($D.isCollection($)){B=Object.freeze(B.concat($));for(let Q=0;Q<$.items.length;++Q){let X=await Z2(Q,$.items[Q],F,B);if(typeof X==="number")Q=X-1;else if(X===zD)return zD;else if(X===D0)$.items.splice(Q,1),Q-=1}}else if($D.isPair($)){B=Object.freeze(B.concat($));let Q=await Z2("key",$.key,F,B);if(Q===zD)return zD;else if(Q===D0)$.key=null;let X=await Z2("value",$.value,F,B);if(X===zD)return zD;else if(X===D0)$.value=null}}return q}function u$(D){if(typeof D==="object"&&(D.Collection||D.Node||D.Value))return Object.assign({Alias:D.Node,Map:D.Node,Scalar:D.Node,Seq:D.Node},D.Value&&{Map:D.Value,Scalar:D.Value,Seq:D.Value},D.Collection&&{Map:D.Collection,Seq:D.Collection},D);return D}function A$(D,$,F,B){if(typeof F==="function")return F(D,$,B);if($D.isMap($))return F.Map?.(D,$,B);if($D.isSeq($))return F.Seq?.(D,$,B);if($D.isPair($))return F.Pair?.(D,$,B);if($D.isScalar($))return F.Scalar?.(D,$,B);if($D.isAlias($))return F.Alias?.(D,$,B);return}function U$(D,$,F){let B=$[$.length-1];if($D.isCollection(B))B.items[D]=F;else if($D.isPair(B))if(D==="key")B.key=F;else B.value=F;else if($D.isDocument(B))B.contents=F;else{let q=$D.isAlias(B)?"alias":"scalar";throw Error(`Cannot replace node with ${q} parent`)}}rC.visit=d8;rC.visitAsync=p8});var q9=L((D_)=>{var z$=d(),oC=R3(),tC={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},eC=(D)=>D.replace(/[!,[\]{}]/g,($)=>tC[$]);class SD{constructor(D,$){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},SD.defaultYaml,D),this.tags=Object.assign({},SD.defaultTags,$)}clone(){let D=new SD(this.yaml,this.tags);return D.docStart=this.docStart,D}atDocument(){let D=new SD(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:SD.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},SD.defaultTags);break}return D}add(D,$){if(this.atNextDocument)this.yaml={explicit:SD.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},SD.defaultTags),this.atNextDocument=!1;let F=D.trim().split(/[ \t]+/),B=F.shift();switch(B){case"%TAG":{if(F.length!==2){if($(0,"%TAG directive should contain exactly two parts"),F.length<2)return!1}let[q,Q]=F;return this.tags[q]=Q,!0}case"%YAML":{if(this.yaml.explicit=!0,F.length!==1)return $(0,"%YAML directive should contain exactly one part"),!1;let[q]=F;if(q==="1.1"||q==="1.2")return this.yaml.version=q,!0;else{let Q=/^\d+\.\d+$/.test(q);return $(6,`Unsupported YAML version ${q}`,Q),!1}}default:return $(0,`Unknown directive ${B}`,!0),!1}}tagName(D,$){if(D==="!")return"!";if(D[0]!=="!")return $(`Not a valid tag: ${D}`),null;if(D[1]==="<"){let Q=D.slice(2,-1);if(Q==="!"||Q==="!!")return $(`Verbatim tags aren't resolved, so ${D} is invalid.`),null;if(D[D.length-1]!==">")$("Verbatim tags must end with a >");return Q}let[,F,B]=D.match(/^(.*!)([^!]*)$/s);if(!B)$(`The ${D} tag has no suffix`);let q=this.tags[F];if(q)try{return q+decodeURIComponent(B)}catch(Q){return $(String(Q)),null}if(F==="!")return D;return $(`Could not resolve tag: ${D}`),null}tagString(D){for(let[$,F]of Object.entries(this.tags))if(D.startsWith(F))return $+eC(D.substring(F.length));return D[0]==="!"?D:`!<${D}>`}toString(D){let $=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],F=Object.entries(this.tags),B;if(D&&F.length>0&&z$.isNode(D.contents)){let q={};oC.visit(D.contents,(Q,X)=>{if(z$.isNode(X)&&X.tag)q[X.tag]=!0}),B=Object.keys(q)}else B=[];for(let[q,Q]of F){if(q==="!!"&&Q==="tag:yaml.org,2002:")continue;if(!D||B.some((X)=>X.startsWith(Q)))$.push(`%TAG ${q} ${Q}`)}return $.join(`
59
- `)}}SD.defaultYaml={explicit:!1,version:"1.2"};SD.defaultTags={"!!":"tag:yaml.org,2002:"};D_.Directives=SD});var c8=L((X_)=>{var w$=d(),F_=R3();function B_(D){if(/[\x00-\x19\s,[\]{}]/.test(D)){let F=`Anchor must not contain whitespace or control characters: ${JSON.stringify(D)}`;throw Error(F)}return!0}function M$(D){let $=new Set;return F_.visit(D,{Value(F,B){if(B.anchor)$.add(B.anchor)}}),$}function K$(D,$){for(let F=1;;++F){let B=`${D}${F}`;if(!$.has(B))return B}}function q_(D,$){let F=[],B=new Map,q=null;return{onAnchor:(Q)=>{F.push(Q),q??(q=M$(D));let X=K$($,q);return q.add(X),X},setAnchors:()=>{for(let Q of F){let X=B.get(Q);if(typeof X==="object"&&X.anchor&&(w$.isScalar(X.node)||w$.isCollection(X.node)))X.node.anchor=X.anchor;else{let J=Error("Failed to resolve repeated object (this should not happen)");throw J.source=Q,J}}},sourceObjects:B}}X_.anchorIsValid=B_;X_.anchorNames=M$;X_.createNodeAnchors=q_;X_.findNewAnchor=K$});var X9=L((C_)=>{function N3(D,$,F,B){if(B&&typeof B==="object")if(Array.isArray(B))for(let q=0,Q=B.length;q<Q;++q){let X=B[q],J=N3(D,B,String(q),X);if(J===void 0)delete B[q];else if(J!==X)B[q]=J}else if(B instanceof Map)for(let q of Array.from(B.keys())){let Q=B.get(q),X=N3(D,B,q,Q);if(X===void 0)B.delete(q);else if(X!==Q)B.set(q,X)}else if(B instanceof Set)for(let q of Array.from(B)){let Q=N3(D,B,q,q);if(Q===void 0)B.delete(q);else if(Q!==q)B.delete(q),B.add(Q)}else for(let[q,Q]of Object.entries(B)){let X=N3(D,B,q,Q);if(X===void 0)delete B[q];else if(X!==Q)B[q]=X}return D.call($,F,B)}C_.applyReviver=N3});var j0=L((V_)=>{var G_=d();function E$(D,$,F){if(Array.isArray(D))return D.map((B,q)=>E$(B,String(q),F));if(D&&typeof D.toJSON==="function"){if(!F||!G_.hasAnchor(D))return D.toJSON($,F);let B={aliasCount:0,count:1,res:void 0};F.anchors.set(D,B),F.onCreate=(Q)=>{B.res=Q,delete F.onCreate};let q=D.toJSON($,F);if(F.onCreate)F.onCreate(q);return q}if(typeof D==="bigint"&&!F?.keep)return Number(D);return D}V_.toJS=E$});var i8=L((U_)=>{var u_=X9(),O$=d(),A_=j0();class j${constructor(D){Object.defineProperty(this,O$.NODE_TYPE,{value:D})}clone(){let D=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)D.range=this.range.slice();return D}toJS(D,{mapAsMap:$,maxAliasCount:F,onAnchor:B,reviver:q}={}){if(!O$.isDocument(D))throw TypeError("A document argument is required");let Q={anchors:new Map,doc:D,keep:!0,mapAsMap:$===!0,mapKeyWarned:!1,maxAliasCount:typeof F==="number"?F:100},X=A_.toJS(this,"",Q);if(typeof B==="function")for(let{count:J,res:Y}of Q.anchors.values())B(Y,J);return typeof q==="function"?u_.applyReviver(q,{"":X},"",X):X}}U_.NodeBase=j$});var L3=L((O_)=>{var w_=c8(),M_=R3(),b2=d(),K_=i8(),E_=j0();class R$ extends K_.NodeBase{constructor(D){super(b2.ALIAS);this.source=D,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(D,$){let F;if($?.aliasResolveCache)F=$.aliasResolveCache;else if(F=[],M_.visit(D,{Node:(q,Q)=>{if(b2.isAlias(Q)||b2.hasAnchor(Q))F.push(Q)}}),$)$.aliasResolveCache=F;let B=void 0;for(let q of F){if(q===this)break;if(q.anchor===this.source)B=q}return B}toJSON(D,$){if(!$)return{source:this.source};let{anchors:F,doc:B,maxAliasCount:q}=$,Q=this.resolve(B,$);if(!Q){let J=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(J)}let X=F.get(Q);if(!X)E_.toJS(Q,null,$),X=F.get(Q);if(X?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(q>=0){if(X.count+=1,X.aliasCount===0)X.aliasCount=n8(B,Q,F);if(X.count*X.aliasCount>q)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return X.res}toString(D,$,F){let B=`*${this.source}`;if(D){if(w_.anchorIsValid(this.source),D.options.verifyAliasOrder&&!D.anchors.has(this.source)){let q=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(q)}if(D.implicitKey)return`${B} `}return B}}function n8(D,$,F){if(b2.isAlias($)){let B=$.resolve(D),q=F&&B&&F.get(B);return q?q.count*q.aliasCount:0}else if(b2.isCollection($)){let B=0;for(let q of $.items){let Q=n8(D,q,F);if(Q>B)B=Q}return B}else if(b2.isPair($)){let B=n8(D,$.key,F),q=n8(D,$.value,F);return Math.max(B,q)}return 1}O_.Alias=R$});var DD=L((Z_)=>{var R_=d(),N_=i8(),L_=j0(),I_=(D)=>!D||typeof D!=="function"&&typeof D!=="object";class s0 extends N_.NodeBase{constructor(D){super(R_.SCALAR);this.value=D}toJSON(D,$){return $?.keep?this.value:L_.toJS(this.value,D,$)}toString(){return String(this.value)}}s0.BLOCK_FOLDED="BLOCK_FOLDED";s0.BLOCK_LITERAL="BLOCK_LITERAL";s0.PLAIN="PLAIN";s0.QUOTE_DOUBLE="QUOTE_DOUBLE";s0.QUOTE_SINGLE="QUOTE_SINGLE";Z_.Scalar=s0;Z_.isScalarValue=I_});var I3=L((k_)=>{var T_=L3(),o0=d(),N$=DD(),P_="tag:yaml.org,2002:";function v_(D,$,F){if($){let B=F.filter((Q)=>Q.tag===$),q=B.find((Q)=>!Q.format)??B[0];if(!q)throw Error(`Tag ${$} not found`);return q}return F.find((B)=>B.identify?.(D)&&!B.format)}function f_(D,$,F){if(o0.isDocument(D))D=D.contents;if(o0.isNode(D))return D;if(o0.isPair(D)){let _=F.schema[o0.MAP].createNode?.(F.schema,null,F);return _.items.push(D),_}if(D instanceof String||D instanceof Number||D instanceof Boolean||typeof BigInt<"u"&&D instanceof BigInt)D=D.valueOf();let{aliasDuplicateObjects:B,onAnchor:q,onTagObj:Q,schema:X,sourceObjects:J}=F,Y=void 0;if(B&&D&&typeof D==="object")if(Y=J.get(D),Y)return Y.anchor??(Y.anchor=q(D)),new T_.Alias(Y.anchor);else Y={anchor:null,node:null},J.set(D,Y);if($?.startsWith("!!"))$=P_+$.slice(2);let H=v_(D,$,X.tags);if(!H){if(D&&typeof D.toJSON==="function")D=D.toJSON();if(!D||typeof D!=="object"){let _=new N$.Scalar(D);if(Y)Y.node=_;return _}H=D instanceof Map?X[o0.MAP]:(Symbol.iterator in Object(D))?X[o0.SEQ]:X[o0.MAP]}if(Q)Q(H),delete F.onTagObj;let C=H?.createNode?H.createNode(F.schema,D,F):typeof H?.nodeClass?.from==="function"?H.nodeClass.from(F.schema,D,F):new N$.Scalar(D);if($)C.tag=$;else if(!H.default)C.tag=H.tag;if(Y)Y.node=C;return C}k_.createNode=f_});var r8=L((m_)=>{var h_=I3(),$0=d(),g_=i8();function Q9(D,$,F){let B=F;for(let q=$.length-1;q>=0;--q){let Q=$[q];if(typeof Q==="number"&&Number.isInteger(Q)&&Q>=0){let X=[];X[Q]=B,B=X}else B=new Map([[Q,B]])}return h_.createNode(B,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:D,sourceObjects:new Map})}var L$=(D)=>D==null||typeof D==="object"&&!!D[Symbol.iterator]().next().done;class I$ extends g_.NodeBase{constructor(D,$){super(D);Object.defineProperty(this,"schema",{value:$,configurable:!0,enumerable:!1,writable:!0})}clone(D){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(D)$.schema=D;if($.items=$.items.map((F)=>$0.isNode(F)||$0.isPair(F)?F.clone(D):F),this.range)$.range=this.range.slice();return $}addIn(D,$){if(L$(D))this.add($);else{let[F,...B]=D,q=this.get(F,!0);if($0.isCollection(q))q.addIn(B,$);else if(q===void 0&&this.schema)this.set(F,Q9(this.schema,B,$));else throw Error(`Expected YAML collection at ${F}. Remaining path: ${B}`)}}deleteIn(D){let[$,...F]=D;if(F.length===0)return this.delete($);let B=this.get($,!0);if($0.isCollection(B))return B.deleteIn(F);else throw Error(`Expected YAML collection at ${$}. Remaining path: ${F}`)}getIn(D,$){let[F,...B]=D,q=this.get(F,!0);if(B.length===0)return!$&&$0.isScalar(q)?q.value:q;else return $0.isCollection(q)?q.getIn(B,$):void 0}hasAllNullValues(D){return this.items.every(($)=>{if(!$0.isPair($))return!1;let F=$.value;return F==null||D&&$0.isScalar(F)&&F.value==null&&!F.commentBefore&&!F.comment&&!F.tag})}hasIn(D){let[$,...F]=D;if(F.length===0)return this.has($);let B=this.get($,!0);return $0.isCollection(B)?B.hasIn(F):!1}setIn(D,$){let[F,...B]=D;if(B.length===0)this.set(F,$);else{let q=this.get(F,!0);if($0.isCollection(q))q.setIn(B,$);else if(q===void 0&&this.schema)this.set(F,Q9(this.schema,B,$));else throw Error(`Expected YAML collection at ${F}. Remaining path: ${B}`)}}}m_.Collection=I$;m_.collectionFromPath=Q9;m_.isEmptyPath=L$});var Z3=L((i_)=>{var p_=(D)=>D.replace(/^(?!$)(?: $)?/gm,"#");function J9(D,$){if(/^\n+$/.test(D))return D.substring(1);return $?D.replace(/^(?! *$)/gm,$):D}var c_=(D,$,F)=>D.endsWith(`
60
- `)?J9(F,$):F.includes(`
61
- `)?`
62
- `+J9(F,$):(D.endsWith(" ")?"":" ")+F;i_.indentComment=J9;i_.lineComment=c_;i_.stringifyComment=p_});var b$=L((o_)=>{function s_(D,$,F="flow",{indentAtStart:B,lineWidth:q=80,minContentWidth:Q=20,onFold:X,onOverflow:J}={}){if(!q||q<0)return D;if(q<Q)Q=0;let Y=Math.max(1+Q,1+q-$.length);if(D.length<=Y)return D;let H=[],C={},_=q-$.length;if(typeof B==="number")if(B>q-Math.max(2,Q))H.push(0);else _=q-B;let G=void 0,u=void 0,U=!1,W=-1,A=-1,z=-1;if(F==="block"){if(W=Z$(D,W,$.length),W!==-1)_=W+Y}for(let M;M=D[W+=1];){if(F==="quoted"&&M==="\\"){switch(A=W,D[W+1]){case"x":W+=3;break;case"u":W+=5;break;case"U":W+=9;break;default:W+=1}z=W}if(M===`
63
- `){if(F==="block")W=Z$(D,W,$.length);_=W+$.length+Y,G=void 0}else{if(M===" "&&u&&u!==" "&&u!==`
64
- `&&u!=="\t"){let K=D[W+1];if(K&&K!==" "&&K!==`
65
- `&&K!=="\t")G=W}if(W>=_)if(G)H.push(G),_=G+Y,G=void 0;else if(F==="quoted"){while(u===" "||u==="\t")u=M,M=D[W+=1],U=!0;let K=W>z+1?W-2:A-1;if(C[K])return D;H.push(K),C[K]=!0,_=K+Y,G=void 0}else U=!0}u=M}if(U&&J)J();if(H.length===0)return D;if(X)X();let w=D.slice(0,H[0]);for(let M=0;M<H.length;++M){let K=H[M],R=H[M+1]||D.length;if(K===0)w=`
66
- ${$}${D.slice(0,R)}`;else{if(F==="quoted"&&C[K])w+=`${D[K]}\\`;w+=`
67
- ${$}${D.slice(K+1,R)}`}}return w}function Z$(D,$,F){let B=$,q=$+1,Q=D[q];while(Q===" "||Q==="\t")if($<q+F)Q=D[++$];else{do Q=D[++$];while(Q&&Q!==`
68
- `);B=$,q=$+1,Q=D[q]}return B}o_.FOLD_BLOCK="block";o_.FOLD_FLOW="flow";o_.FOLD_QUOTED="quoted";o_.foldFlowLines=s_});var S3=L((XG)=>{var cD=DD(),R0=b$(),s8=(D,$)=>({indentAtStart:$?D.indent.length:D.indentAtStart,lineWidth:D.options.lineWidth,minContentWidth:D.options.minContentWidth}),o8=(D)=>/^(%|---|\.\.\.)/m.test(D);function FG(D,$,F){if(!$||$<0)return!1;let B=$-F,q=D.length;if(q<=B)return!1;for(let Q=0,X=0;Q<q;++Q)if(D[Q]===`
69
- `){if(Q-X>B)return!0;if(X=Q+1,q-X<=B)return!1}return!0}function b3(D,$){let F=JSON.stringify(D);if($.options.doubleQuotedAsJSON)return F;let{implicitKey:B}=$,q=$.options.doubleQuotedMinMultiLineLength,Q=$.indent||(o8(D)?" ":""),X="",J=0;for(let Y=0,H=F[Y];H;H=F[++Y]){if(H===" "&&F[Y+1]==="\\"&&F[Y+2]==="n")X+=F.slice(J,Y)+"\\ ",Y+=1,J=Y,H="\\";if(H==="\\")switch(F[Y+1]){case"u":{X+=F.slice(J,Y);let C=F.substr(Y+2,4);switch(C){case"0000":X+="\\0";break;case"0007":X+="\\a";break;case"000b":X+="\\v";break;case"001b":X+="\\e";break;case"0085":X+="\\N";break;case"00a0":X+="\\_";break;case"2028":X+="\\L";break;case"2029":X+="\\P";break;default:if(C.substr(0,2)==="00")X+="\\x"+C.substr(2);else X+=F.substr(Y,6)}Y+=5,J=Y+1}break;case"n":if(B||F[Y+2]==='"'||F.length<q)Y+=1;else{X+=F.slice(J,Y)+`
70
-
71
- `;while(F[Y+2]==="\\"&&F[Y+3]==="n"&&F[Y+4]!=='"')X+=`
72
- `,Y+=2;if(X+=Q,F[Y+2]===" ")X+="\\";Y+=1,J=Y+1}break;default:Y+=1}}return X=J?X+F.slice(J):F,B?X:R0.foldFlowLines(X,Q,R0.FOLD_QUOTED,s8($,!1))}function Y9(D,$){if($.options.singleQuote===!1||$.implicitKey&&D.includes(`
73
- `)||/[ \t]\n|\n[ \t]/.test(D))return b3(D,$);let F=$.indent||(o8(D)?" ":""),B="'"+D.replace(/'/g,"''").replace(/\n+/g,`$&
74
- ${F}`)+"'";return $.implicitKey?B:R0.foldFlowLines(B,F,R0.FOLD_FLOW,s8($,!1))}function S2(D,$){let{singleQuote:F}=$.options,B;if(F===!1)B=b3;else{let q=D.includes('"'),Q=D.includes("'");if(q&&!Q)B=Y9;else if(Q&&!q)B=b3;else B=F?Y9:b3}return B(D,$)}var H9;try{H9=new RegExp(`(^|(?<!
75
- ))
76
- +(?!
77
- |$)`,"g")}catch{H9=/\n+(?!\n|$)/g}function a8({comment:D,type:$,value:F},B,q,Q){let{blockQuote:X,commentString:J,lineWidth:Y}=B.options;if(!X||/\n[\t ]+$/.test(F))return S2(F,B);let H=B.indent||(B.forceBlockIndent||o8(F)?" ":""),C=X==="literal"?!0:X==="folded"||$===cD.Scalar.BLOCK_FOLDED?!1:$===cD.Scalar.BLOCK_LITERAL?!0:!FG(F,Y,H.length);if(!F)return C?`|
78
- `:`>
79
- `;let _,G;for(G=F.length;G>0;--G){let R=F[G-1];if(R!==`
80
- `&&R!=="\t"&&R!==" ")break}let u=F.substring(G),U=u.indexOf(`
81
- `);if(U===-1)_="-";else if(F===u||U!==u.length-1){if(_="+",Q)Q()}else _="";if(u){if(F=F.slice(0,-u.length),u[u.length-1]===`
82
- `)u=u.slice(0,-1);u=u.replace(H9,`$&${H}`)}let W=!1,A,z=-1;for(A=0;A<F.length;++A){let R=F[A];if(R===" ")W=!0;else if(R===`
83
- `)z=A;else break}let w=F.substring(0,z<A?z+1:A);if(w)F=F.substring(w.length),w=w.replace(/\n+/g,`$&${H}`);let K=(W?H?"2":"1":"")+_;if(D){if(K+=" "+J(D.replace(/ ?[\r\n]+/g," ")),q)q()}if(!C){let R=F.replace(/\n+/g,`
84
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${H}`),Z=!1,v=s8(B,!0);if(X!=="folded"&&$!==cD.Scalar.BLOCK_FOLDED)v.onOverflow=()=>{Z=!0};let I=R0.foldFlowLines(`${w}${R}${u}`,H,R0.FOLD_BLOCK,v);if(!Z)return`>${K}
85
- ${H}${I}`}return F=F.replace(/\n+/g,`$&${H}`),`|${K}
86
- ${H}${w}${F}${u}`}function BG(D,$,F,B){let{type:q,value:Q}=D,{actualString:X,implicitKey:J,indent:Y,indentStep:H,inFlow:C}=$;if(J&&Q.includes(`
87
- `)||C&&/[[\]{},]/.test(Q))return S2(Q,$);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(Q))return J||C||!Q.includes(`
88
- `)?S2(Q,$):a8(D,$,F,B);if(!J&&!C&&q!==cD.Scalar.PLAIN&&Q.includes(`
89
- `))return a8(D,$,F,B);if(o8(Q)){if(Y==="")return $.forceBlockIndent=!0,a8(D,$,F,B);else if(J&&Y===H)return S2(Q,$)}let _=Q.replace(/\n+/g,`$&
90
- ${Y}`);if(X){let G=(W)=>W.default&&W.tag!=="tag:yaml.org,2002:str"&&W.test?.test(_),{compat:u,tags:U}=$.doc.schema;if(U.some(G)||u?.some(G))return S2(Q,$)}return J?_:R0.foldFlowLines(_,Y,R0.FOLD_FLOW,s8($,!1))}function qG(D,$,F,B){let{implicitKey:q,inFlow:Q}=$,X=typeof D.value==="string"?D:Object.assign({},D,{value:String(D.value)}),{type:J}=D;if(J!==cD.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(X.value))J=cD.Scalar.QUOTE_DOUBLE}let Y=(C)=>{switch(C){case cD.Scalar.BLOCK_FOLDED:case cD.Scalar.BLOCK_LITERAL:return q||Q?S2(X.value,$):a8(X,$,F,B);case cD.Scalar.QUOTE_DOUBLE:return b3(X.value,$);case cD.Scalar.QUOTE_SINGLE:return Y9(X.value,$);case cD.Scalar.PLAIN:return BG(X,$,F,B);default:return null}},H=Y(J);if(H===null){let{defaultKeyType:C,defaultStringType:_}=$.options,G=q&&C||_;if(H=Y(G),H===null)throw Error(`Unsupported default string type ${G}`)}return H}XG.stringifyString=qG});var T3=L((WG)=>{var JG=c8(),N0=d(),YG=Z3(),HG=S3();function CG(D,$){let F=Object.assign({blockQuote:!0,commentString:YG.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},D.schema.toStringOptions,$),B;switch(F.collectionStyle){case"block":B=!1;break;case"flow":B=!0;break;default:B=null}return{anchors:new Set,doc:D,flowCollectionPadding:F.flowCollectionPadding?" ":"",indent:"",indentStep:typeof F.indent==="number"?" ".repeat(F.indent):" ",inFlow:B,options:F}}function _G(D,$){if($.tag){let q=D.filter((Q)=>Q.tag===$.tag);if(q.length>0)return q.find((Q)=>Q.format===$.format)??q[0]}let F=void 0,B;if(N0.isScalar($)){B=$.value;let q=D.filter((Q)=>Q.identify?.(B));if(q.length>1){let Q=q.filter((X)=>X.test);if(Q.length>0)q=Q}F=q.find((Q)=>Q.format===$.format)??q.find((Q)=>!Q.format)}else B=$,F=D.find((q)=>q.nodeClass&&B instanceof q.nodeClass);if(!F){let q=B?.constructor?.name??(B===null?"null":typeof B);throw Error(`Tag not resolved for ${q} value`)}return F}function GG(D,$,{anchors:F,doc:B}){if(!B.directives)return"";let q=[],Q=(N0.isScalar(D)||N0.isCollection(D))&&D.anchor;if(Q&&JG.anchorIsValid(Q))F.add(Q),q.push(`&${Q}`);let X=D.tag??($.default?null:$.tag);if(X)q.push(B.directives.tagString(X));return q.join(" ")}function VG(D,$,F,B){if(N0.isPair(D))return D.toString($,F,B);if(N0.isAlias(D)){if($.doc.directives)return D.toString($);if($.resolvedAliases?.has(D))throw TypeError("Cannot stringify circular structure without alias nodes");else{if($.resolvedAliases)$.resolvedAliases.add(D);else $.resolvedAliases=new Set([D]);D=D.resolve($.doc)}}let q=void 0,Q=N0.isNode(D)?D:$.doc.createNode(D,{onTagObj:(Y)=>q=Y});q??(q=_G($.doc.schema.tags,Q));let X=GG(Q,q,$);if(X.length>0)$.indentAtStart=($.indentAtStart??0)+X.length+1;let J=typeof q.stringify==="function"?q.stringify(Q,$,F,B):N0.isScalar(Q)?HG.stringifyString(Q,$,F,B):Q.toString($,F,B);if(!X)return J;return N0.isScalar(Q)||J[0]==="{"||J[0]==="["?`${X} ${J}`:`${X}
91
- ${$.indent}${J}`}WG.createStringifyContext=CG;WG.stringify=VG});var P$=L((zG)=>{var V0=d(),S$=DD(),T$=T3(),P3=Z3();function UG({key:D,value:$},F,B,q){let{allNullValues:Q,doc:X,indent:J,indentStep:Y,options:{commentString:H,indentSeq:C,simpleKeys:_}}=F,G=V0.isNode(D)&&D.comment||null;if(_){if(G)throw Error("With simple keys, key nodes cannot have comments");if(V0.isCollection(D)||!V0.isNode(D)&&typeof D==="object")throw Error("With simple keys, collection cannot be used as a key value")}let u=!_&&(!D||G&&$==null&&!F.inFlow||V0.isCollection(D)||(V0.isScalar(D)?D.type===S$.Scalar.BLOCK_FOLDED||D.type===S$.Scalar.BLOCK_LITERAL:typeof D==="object"));F=Object.assign({},F,{allNullValues:!1,implicitKey:!u&&(_||!Q),indent:J+Y});let U=!1,W=!1,A=T$.stringify(D,F,()=>U=!0,()=>W=!0);if(!u&&!F.inFlow&&A.length>1024){if(_)throw Error("With simple keys, single line scalar must not span more than 1024 characters");u=!0}if(F.inFlow){if(Q||$==null){if(U&&B)B();return A===""?"?":u?`? ${A}`:A}}else if(Q&&!_||$==null&&u){if(A=`? ${A}`,G&&!U)A+=P3.lineComment(A,F.indent,H(G));else if(W&&q)q();return A}if(U)G=null;if(u){if(G)A+=P3.lineComment(A,F.indent,H(G));A=`? ${A}
92
- ${J}:`}else if(A=`${A}:`,G)A+=P3.lineComment(A,F.indent,H(G));let z,w,M;if(V0.isNode($))z=!!$.spaceBefore,w=$.commentBefore,M=$.comment;else if(z=!1,w=null,M=null,$&&typeof $==="object")$=X.createNode($);if(F.implicitKey=!1,!u&&!G&&V0.isScalar($))F.indentAtStart=A.length+1;if(W=!1,!C&&Y.length>=2&&!F.inFlow&&!u&&V0.isSeq($)&&!$.flow&&!$.tag&&!$.anchor)F.indent=F.indent.substring(2);let K=!1,R=T$.stringify($,F,()=>K=!0,()=>W=!0),Z=" ";if(G||z||w){if(Z=z?`
93
- `:"",w){let v=H(w);Z+=`
94
- ${P3.indentComment(v,F.indent)}`}if(R===""&&!F.inFlow){if(Z===`
95
- `&&M)Z=`
96
-
97
- `}else Z+=`
98
- ${F.indent}`}else if(!u&&V0.isCollection($)){let v=R[0],I=R.indexOf(`
99
- `),r=I!==-1,e=F.inFlow??$.flow??$.items.length===0;if(r||!e){let B0=!1;if(r&&(v==="&"||v==="!")){let i=R.indexOf(" ");if(v==="&"&&i!==-1&&i<I&&R[i+1]==="!")i=R.indexOf(" ",i+1);if(i===-1||I<i)B0=!0}if(!B0)Z=`
100
- ${F.indent}`}}else if(R===""||R[0]===`
101
- `)Z="";if(A+=Z+R,F.inFlow){if(K&&B)B()}else if(M&&!K)A+=P3.lineComment(A,F.indent,H(M));else if(W&&q)q();return A}zG.stringifyPair=UG});var C9=L((EG)=>{var v$=c2("process");function MG(D,...$){if(D==="debug")console.log(...$)}function KG(D,$){if(D==="debug"||D==="warn")if(typeof v$.emitWarning==="function")v$.emitWarning($);else console.warn($)}EG.debug=MG;EG.warn=KG});var D1=L((NG)=>{var v3=d(),f$=DD(),t8="<<",e8={identify:(D)=>D===t8||typeof D==="symbol"&&D.description===t8,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new f$.Scalar(Symbol(t8)),{addToJSMap:k$}),stringify:()=>t8},RG=(D,$)=>(e8.identify($)||v3.isScalar($)&&(!$.type||$.type===f$.Scalar.PLAIN)&&e8.identify($.value))&&D?.doc.schema.tags.some((F)=>F.tag===e8.tag&&F.default);function k$(D,$,F){if(F=D&&v3.isAlias(F)?F.resolve(D.doc):F,v3.isSeq(F))for(let B of F.items)_9(D,$,B);else if(Array.isArray(F))for(let B of F)_9(D,$,B);else _9(D,$,F)}function _9(D,$,F){let B=D&&v3.isAlias(F)?F.resolve(D.doc):F;if(!v3.isMap(B))throw Error("Merge sources must be maps or map aliases");let q=B.toJSON(null,D,Map);for(let[Q,X]of q)if($ instanceof Map){if(!$.has(Q))$.set(Q,X)}else if($ instanceof Set)$.add(Q);else if(!Object.prototype.hasOwnProperty.call($,Q))Object.defineProperty($,Q,{value:X,writable:!0,enumerable:!0,configurable:!0});return $}NG.addMergeToJSMap=k$;NG.isMergeKey=RG;NG.merge=e8});var V9=L((vG)=>{var bG=C9(),y$=D1(),SG=T3(),h$=d(),G9=j0();function TG(D,$,{key:F,value:B}){if(h$.isNode(F)&&F.addToJSMap)F.addToJSMap(D,$,B);else if(y$.isMergeKey(D,F))y$.addMergeToJSMap(D,$,B);else{let q=G9.toJS(F,"",D);if($ instanceof Map)$.set(q,G9.toJS(B,q,D));else if($ instanceof Set)$.add(q);else{let Q=PG(F,q,D),X=G9.toJS(B,Q,D);if(Q in $)Object.defineProperty($,Q,{value:X,writable:!0,enumerable:!0,configurable:!0});else $[Q]=X}}return $}function PG(D,$,F){if($===null)return"";if(typeof $!=="object")return String($);if(h$.isNode(D)&&F?.doc){let B=SG.createStringifyContext(F.doc,{});B.anchors=new Set;for(let Q of F.anchors.keys())B.anchors.add(Q.anchor);B.inFlow=!0,B.inStringifyKey=!0;let q=D.toString(B);if(!F.mapKeyWarned){let Q=JSON.stringify(q);if(Q.length>40)Q=Q.substring(0,36)+'..."';bG.warn(F.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${Q}. Set mapAsMap: true to use object keys.`),F.mapKeyWarned=!0}return q}return JSON.stringify($)}vG.addPairToJSMap=TG});var L0=L((gG)=>{var g$=I3(),kG=P$(),yG=V9(),$1=d();function hG(D,$,F){let B=g$.createNode(D,void 0,F),q=g$.createNode($,void 0,F);return new F1(B,q)}class F1{constructor(D,$=null){Object.defineProperty(this,$1.NODE_TYPE,{value:$1.PAIR}),this.key=D,this.value=$}clone(D){let{key:$,value:F}=this;if($1.isNode($))$=$.clone(D);if($1.isNode(F))F=F.clone(D);return new F1($,F)}toJSON(D,$){let F=$?.mapAsMap?new Map:{};return yG.addPairToJSMap($,F,this)}toString(D,$,F){return D?.doc?kG.stringifyPair(this,D,$,F):JSON.stringify(this)}}gG.Pair=F1;gG.createPair=hG});var W9=L((cG)=>{var t0=d(),m$=T3(),B1=Z3();function lG(D,$,F){return($.inFlow??D.flow?pG:dG)(D,$,F)}function dG({comment:D,items:$},F,{blockItemPrefix:B,flowChars:q,itemIndent:Q,onChompKeep:X,onComment:J}){let{indent:Y,options:{commentString:H}}=F,C=Object.assign({},F,{indent:Q,type:null}),_=!1,G=[];for(let U=0;U<$.length;++U){let W=$[U],A=null;if(t0.isNode(W)){if(!_&&W.spaceBefore)G.push("");if(q1(F,G,W.commentBefore,_),W.comment)A=W.comment}else if(t0.isPair(W)){let w=t0.isNode(W.key)?W.key:null;if(w){if(!_&&w.spaceBefore)G.push("");q1(F,G,w.commentBefore,_)}}_=!1;let z=m$.stringify(W,C,()=>A=null,()=>_=!0);if(A)z+=B1.lineComment(z,Q,H(A));if(_&&A)_=!1;G.push(B+z)}let u;if(G.length===0)u=q.start+q.end;else{u=G[0];for(let U=1;U<G.length;++U){let W=G[U];u+=W?`
102
- ${Y}${W}`:`
103
- `}}if(D){if(u+=`
104
- `+B1.indentComment(H(D),Y),J)J()}else if(_&&X)X();return u}function pG({items:D},$,{flowChars:F,itemIndent:B}){let{indent:q,indentStep:Q,flowCollectionPadding:X,options:{commentString:J}}=$;B+=Q;let Y=Object.assign({},$,{indent:B,inFlow:!0,type:null}),H=!1,C=0,_=[];for(let U=0;U<D.length;++U){let W=D[U],A=null;if(t0.isNode(W)){if(W.spaceBefore)_.push("");if(q1($,_,W.commentBefore,!1),W.comment)A=W.comment}else if(t0.isPair(W)){let w=t0.isNode(W.key)?W.key:null;if(w){if(w.spaceBefore)_.push("");if(q1($,_,w.commentBefore,!1),w.comment)H=!0}let M=t0.isNode(W.value)?W.value:null;if(M){if(M.comment)A=M.comment;if(M.commentBefore)H=!0}else if(W.value==null&&w?.comment)A=w.comment}if(A)H=!0;let z=m$.stringify(W,Y,()=>A=null);if(U<D.length-1)z+=",";if(A)z+=B1.lineComment(z,B,J(A));if(!H&&(_.length>C||z.includes(`
105
- `)))H=!0;_.push(z),C=_.length}let{start:G,end:u}=F;if(_.length===0)return G+u;else{if(!H){let U=_.reduce((W,A)=>W+A.length+2,2);H=$.options.lineWidth>0&&U>$.options.lineWidth}if(H){let U=G;for(let W of _)U+=W?`
106
- ${Q}${q}${W}`:`
107
- `;return`${U}
108
- ${q}${u}`}else return`${G}${X}${_.join(" ")}${X}${u}`}}function q1({indent:D,options:{commentString:$}},F,B,q){if(B&&q)B=B.replace(/^\n+/,"");if(B){let Q=B1.indentComment($(B),D);F.push(Q.trimStart())}}cG.stringifyCollection=lG});var Z0=L((oG)=>{var nG=W9(),rG=V9(),aG=r8(),I0=d(),X1=L0(),sG=DD();function f3(D,$){let F=I0.isScalar($)?$.value:$;for(let B of D)if(I0.isPair(B)){if(B.key===$||B.key===F)return B;if(I0.isScalar(B.key)&&B.key.value===F)return B}return}class x$ extends aG.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(D){super(I0.MAP,D);this.items=[]}static from(D,$,F){let{keepUndefined:B,replacer:q}=F,Q=new this(D),X=(J,Y)=>{if(typeof q==="function")Y=q.call($,J,Y);else if(Array.isArray(q)&&!q.includes(J))return;if(Y!==void 0||B)Q.items.push(X1.createPair(J,Y,F))};if($ instanceof Map)for(let[J,Y]of $)X(J,Y);else if($&&typeof $==="object")for(let J of Object.keys($))X(J,$[J]);if(typeof D.sortMapEntries==="function")Q.items.sort(D.sortMapEntries);return Q}add(D,$){let F;if(I0.isPair(D))F=D;else if(!D||typeof D!=="object"||!("key"in D))F=new X1.Pair(D,D?.value);else F=new X1.Pair(D.key,D.value);let B=f3(this.items,F.key),q=this.schema?.sortMapEntries;if(B){if(!$)throw Error(`Key ${F.key} already set`);if(I0.isScalar(B.value)&&sG.isScalarValue(F.value))B.value.value=F.value;else B.value=F.value}else if(q){let Q=this.items.findIndex((X)=>q(F,X)<0);if(Q===-1)this.items.push(F);else this.items.splice(Q,0,F)}else this.items.push(F)}delete(D){let $=f3(this.items,D);if(!$)return!1;return this.items.splice(this.items.indexOf($),1).length>0}get(D,$){let B=f3(this.items,D)?.value;return(!$&&I0.isScalar(B)?B.value:B)??void 0}has(D){return!!f3(this.items,D)}set(D,$){this.add(new X1.Pair(D,$),!0)}toJSON(D,$,F){let B=F?new F:$?.mapAsMap?new Map:{};if($?.onCreate)$.onCreate(B);for(let q of this.items)rG.addPairToJSMap($,B,q);return B}toString(D,$,F){if(!D)return JSON.stringify(this);for(let B of this.items)if(!I0.isPair(B))throw Error(`Map items must all be pairs; found ${JSON.stringify(B)} instead`);if(!D.allNullValues&&this.hasAllNullValues(!1))D=Object.assign({},D,{allNullValues:!0});return nG.stringifyCollection(this,D,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:D.indent||"",onChompKeep:F,onComment:$})}}oG.YAMLMap=x$;oG.findPair=f3});var T2=L((FV)=>{var DV=d(),l$=Z0(),$V={collection:"map",default:!0,nodeClass:l$.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(D,$){if(!DV.isMap(D))$("Expected a mapping for this tag");return D},createNode:(D,$,F)=>l$.YAMLMap.from(D,$,F)};FV.map=$V});var b0=L((HV)=>{var qV=I3(),XV=W9(),QV=r8(),J1=d(),JV=DD(),YV=j0();class d$ extends QV.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(D){super(J1.SEQ,D);this.items=[]}add(D){this.items.push(D)}delete(D){let $=Q1(D);if(typeof $!=="number")return!1;return this.items.splice($,1).length>0}get(D,$){let F=Q1(D);if(typeof F!=="number")return;let B=this.items[F];return!$&&J1.isScalar(B)?B.value:B}has(D){let $=Q1(D);return typeof $==="number"&&$<this.items.length}set(D,$){let F=Q1(D);if(typeof F!=="number")throw Error(`Expected a valid index, not ${D}.`);let B=this.items[F];if(J1.isScalar(B)&&JV.isScalarValue($))B.value=$;else this.items[F]=$}toJSON(D,$){let F=[];if($?.onCreate)$.onCreate(F);let B=0;for(let q of this.items)F.push(YV.toJS(q,String(B++),$));return F}toString(D,$,F){if(!D)return JSON.stringify(this);return XV.stringifyCollection(this,D,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(D.indent||"")+" ",onChompKeep:F,onComment:$})}static from(D,$,F){let{replacer:B}=F,q=new this(D);if($&&Symbol.iterator in Object($)){let Q=0;for(let X of $){if(typeof B==="function"){let J=$ instanceof Set?X:String(Q++);X=B.call($,J,X)}q.items.push(qV.createNode(X,void 0,F))}}return q}}function Q1(D){let $=J1.isScalar(D)?D.value:D;if($&&typeof $==="string")$=Number($);return typeof $==="number"&&Number.isInteger($)&&$>=0?$:null}HV.YAMLSeq=d$});var P2=L((VV)=>{var _V=d(),p$=b0(),GV={collection:"seq",default:!0,nodeClass:p$.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(D,$){if(!_V.isSeq(D))$("Expected a sequence for this tag");return D},createNode:(D,$,F)=>p$.YAMLSeq.from(D,$,F)};VV.seq=GV});var k3=L((UV)=>{var uV=S3(),AV={identify:(D)=>typeof D==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(D)=>D,stringify(D,$,F,B){return $=Object.assign({actualString:!0},$),uV.stringifyString(D,$,F,B)}};UV.string=AV});var Y1=L((wV)=>{var c$=DD(),i$={identify:(D)=>D==null,createNode:()=>new c$.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new c$.Scalar(null),stringify:({source:D},$)=>typeof D==="string"&&i$.test.test(D)?D:$.options.nullStr};wV.nullTag=i$});var u9=L((EV)=>{var KV=DD(),n$={identify:(D)=>typeof D==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(D)=>new KV.Scalar(D[0]==="t"||D[0]==="T"),stringify({source:D,value:$},F){if(D&&n$.test.test(D)){let B=D[0]==="t"||D[0]==="T";if($===B)return D}return $?F.options.trueStr:F.options.falseStr}};EV.boolTag=n$});var v2=L((RV)=>{function jV({format:D,minFractionDigits:$,tag:F,value:B}){if(typeof B==="bigint")return String(B);let q=typeof B==="number"?B:Number(B);if(!isFinite(q))return isNaN(q)?".nan":q<0?"-.inf":".inf";let Q=Object.is(B,-0)?"-0":JSON.stringify(B);if(!D&&$&&(!F||F==="tag:yaml.org,2002:float")&&/^\d/.test(Q)){let X=Q.indexOf(".");if(X<0)X=Q.length,Q+=".";let J=$-(Q.length-X-1);while(J-- >0)Q+="0"}return Q}RV.stringifyNumber=jV});var U9=L((SV)=>{var LV=DD(),A9=v2(),IV={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(D)=>D.slice(-3).toLowerCase()==="nan"?NaN:D[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:A9.stringifyNumber},ZV={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(D)=>parseFloat(D),stringify(D){let $=Number(D.value);return isFinite($)?$.toExponential():A9.stringifyNumber(D)}},bV={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(D){let $=new LV.Scalar(parseFloat(D)),F=D.indexOf(".");if(F!==-1&&D[D.length-1]==="0")$.minFractionDigits=D.length-F-1;return $},stringify:A9.stringifyNumber};SV.float=bV;SV.floatExp=ZV;SV.floatNaN=IV});var w9=L((hV)=>{var r$=v2(),H1=(D)=>typeof D==="bigint"||Number.isInteger(D),z9=(D,$,F,{intAsBigInt:B})=>B?BigInt(D):parseInt(D.substring($),F);function a$(D,$,F){let{value:B}=D;if(H1(B)&&B>=0)return F+B.toString($);return r$.stringifyNumber(D)}var fV={identify:(D)=>H1(D)&&D>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(D,$,F)=>z9(D,2,8,F),stringify:(D)=>a$(D,8,"0o")},kV={identify:H1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(D,$,F)=>z9(D,0,10,F),stringify:r$.stringifyNumber},yV={identify:(D)=>H1(D)&&D>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(D,$,F)=>z9(D,2,16,F),stringify:(D)=>a$(D,16,"0x")};hV.int=kV;hV.intHex=yV;hV.intOct=fV});var s$=L((rV)=>{var lV=T2(),dV=Y1(),pV=P2(),cV=k3(),iV=u9(),M9=U9(),K9=w9(),nV=[lV.map,pV.seq,cV.string,dV.nullTag,iV.boolTag,K9.intOct,K9.int,K9.intHex,M9.floatNaN,M9.floatExp,M9.float];rV.schema=nV});var t$=L((FW)=>{var sV=DD(),oV=T2(),tV=P2();function o$(D){return typeof D==="bigint"||Number.isInteger(D)}var C1=({value:D})=>JSON.stringify(D),eV=[{identify:(D)=>typeof D==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(D)=>D,stringify:C1},{identify:(D)=>D==null,createNode:()=>new sV.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:C1},{identify:(D)=>typeof D==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(D)=>D==="true",stringify:C1},{identify:o$,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(D,$,{intAsBigInt:F})=>F?BigInt(D):parseInt(D,10),stringify:({value:D})=>o$(D)?D.toString():JSON.stringify(D)},{identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:(D)=>parseFloat(D),stringify:C1}],DW={default:!0,tag:"",test:/^/,resolve(D,$){return $(`Unresolved plain scalar ${JSON.stringify(D)}`),D}},$W=[oV.map,tV.seq].concat(eV,DW);FW.schema=$W});var O9=L((QW)=>{var y3=c2("buffer"),E9=DD(),qW=S3(),XW={identify:(D)=>D instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(D,$){if(typeof y3.Buffer==="function")return y3.Buffer.from(D,"base64");else if(typeof atob==="function"){let F=atob(D.replace(/[\n\r]/g,"")),B=new Uint8Array(F.length);for(let q=0;q<F.length;++q)B[q]=F.charCodeAt(q);return B}else return $("This environment does not support reading binary tags; either Buffer or atob is required"),D},stringify({comment:D,type:$,value:F},B,q,Q){if(!F)return"";let X=F,J;if(typeof y3.Buffer==="function")J=X instanceof y3.Buffer?X.toString("base64"):y3.Buffer.from(X.buffer).toString("base64");else if(typeof btoa==="function"){let Y="";for(let H=0;H<X.length;++H)Y+=String.fromCharCode(X[H]);J=btoa(Y)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if($??($=E9.Scalar.BLOCK_LITERAL),$!==E9.Scalar.QUOTE_DOUBLE){let Y=Math.max(B.options.lineWidth-B.indent.length,B.options.minContentWidth),H=Math.ceil(J.length/Y),C=Array(H);for(let _=0,G=0;_<H;++_,G+=Y)C[_]=J.substr(G,Y);J=C.join($===E9.Scalar.BLOCK_LITERAL?`
109
- `:" ")}return qW.stringifyString({comment:D,type:$,value:J},B,q,Q)}};QW.binary=XW});var G1=L((_W)=>{var _1=d(),j9=L0(),YW=DD(),HW=b0();function e$(D,$){if(_1.isSeq(D))for(let F=0;F<D.items.length;++F){let B=D.items[F];if(_1.isPair(B))continue;else if(_1.isMap(B)){if(B.items.length>1)$("Each pair must have its own sequence indicator");let q=B.items[0]||new j9.Pair(new YW.Scalar(null));if(B.commentBefore)q.key.commentBefore=q.key.commentBefore?`${B.commentBefore}
110
- ${q.key.commentBefore}`:B.commentBefore;if(B.comment){let Q=q.value??q.key;Q.comment=Q.comment?`${B.comment}
111
- ${Q.comment}`:B.comment}B=q}D.items[F]=_1.isPair(B)?B:new j9.Pair(B)}else $("Expected a sequence for this tag");return D}function DF(D,$,F){let{replacer:B}=F,q=new HW.YAMLSeq(D);q.tag="tag:yaml.org,2002:pairs";let Q=0;if($&&Symbol.iterator in Object($))for(let X of $){if(typeof B==="function")X=B.call($,String(Q++),X);let J,Y;if(Array.isArray(X))if(X.length===2)J=X[0],Y=X[1];else throw TypeError(`Expected [key, value] tuple: ${X}`);else if(X&&X instanceof Object){let H=Object.keys(X);if(H.length===1)J=H[0],Y=X[J];else throw TypeError(`Expected tuple with one key, not ${H.length} keys`)}else J=X;q.items.push(j9.createPair(J,Y,F))}return q}var CW={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:e$,createNode:DF};_W.createPairs=DF;_W.pairs=CW;_W.resolvePairs=e$});var N9=L((UW)=>{var $F=d(),R9=j0(),h3=Z0(),uW=b0(),FF=G1();class e0 extends uW.YAMLSeq{constructor(){super();this.add=h3.YAMLMap.prototype.add.bind(this),this.delete=h3.YAMLMap.prototype.delete.bind(this),this.get=h3.YAMLMap.prototype.get.bind(this),this.has=h3.YAMLMap.prototype.has.bind(this),this.set=h3.YAMLMap.prototype.set.bind(this),this.tag=e0.tag}toJSON(D,$){if(!$)return super.toJSON(D);let F=new Map;if($?.onCreate)$.onCreate(F);for(let B of this.items){let q,Q;if($F.isPair(B))q=R9.toJS(B.key,"",$),Q=R9.toJS(B.value,q,$);else q=R9.toJS(B,"",$);if(F.has(q))throw Error("Ordered maps must not include duplicate keys");F.set(q,Q)}return F}static from(D,$,F){let B=FF.createPairs(D,$,F),q=new this;return q.items=B.items,q}}e0.tag="tag:yaml.org,2002:omap";var AW={collection:"seq",identify:(D)=>D instanceof Map,nodeClass:e0,default:!1,tag:"tag:yaml.org,2002:omap",resolve(D,$){let F=FF.resolvePairs(D,$),B=[];for(let{key:q}of F.items)if($F.isScalar(q))if(B.includes(q.value))$(`Ordered maps must not include duplicate keys: ${q.value}`);else B.push(q.value);return Object.assign(new e0,F)},createNode:(D,$,F)=>e0.from(D,$,F)};UW.YAMLOMap=e0;UW.omap=AW});var JF=L((MW)=>{var BF=DD();function qF({value:D,source:$},F){if($&&(D?XF:QF).test.test($))return $;return D?F.options.trueStr:F.options.falseStr}var XF={identify:(D)=>D===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new BF.Scalar(!0),stringify:qF},QF={identify:(D)=>D===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new BF.Scalar(!1),stringify:qF};MW.falseTag=QF;MW.trueTag=XF});var YF=L((LW)=>{var OW=DD(),L9=v2(),jW={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(D)=>D.slice(-3).toLowerCase()==="nan"?NaN:D[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:L9.stringifyNumber},RW={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(D)=>parseFloat(D.replace(/_/g,"")),stringify(D){let $=Number(D.value);return isFinite($)?$.toExponential():L9.stringifyNumber(D)}},NW={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(D){let $=new OW.Scalar(parseFloat(D.replace(/_/g,""))),F=D.indexOf(".");if(F!==-1){let B=D.substring(F+1).replace(/_/g,"");if(B[B.length-1]==="0")$.minFractionDigits=B.length}return $},stringify:L9.stringifyNumber};LW.float=NW;LW.floatExp=RW;LW.floatNaN=jW});var CF=L((fW)=>{var HF=v2(),g3=(D)=>typeof D==="bigint"||Number.isInteger(D);function V1(D,$,F,{intAsBigInt:B}){let q=D[0];if(q==="-"||q==="+")$+=1;if(D=D.substring($).replace(/_/g,""),B){switch(F){case 2:D=`0b${D}`;break;case 8:D=`0o${D}`;break;case 16:D=`0x${D}`;break}let X=BigInt(D);return q==="-"?BigInt(-1)*X:X}let Q=parseInt(D,F);return q==="-"?-1*Q:Q}function I9(D,$,F){let{value:B}=D;if(g3(B)){let q=B.toString($);return B<0?"-"+F+q.substr(1):F+q}return HF.stringifyNumber(D)}var SW={identify:g3,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(D,$,F)=>V1(D,2,2,F),stringify:(D)=>I9(D,2,"0b")},TW={identify:g3,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(D,$,F)=>V1(D,1,8,F),stringify:(D)=>I9(D,8,"0")},PW={identify:g3,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(D,$,F)=>V1(D,0,10,F),stringify:HF.stringifyNumber},vW={identify:g3,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(D,$,F)=>V1(D,2,16,F),stringify:(D)=>I9(D,16,"0x")};fW.int=PW;fW.intBin=SW;fW.intHex=vW;fW.intOct=TW});var Z9=L((xW)=>{var A1=d(),W1=L0(),u1=Z0();class D2 extends u1.YAMLMap{constructor(D){super(D);this.tag=D2.tag}add(D){let $;if(A1.isPair(D))$=D;else if(D&&typeof D==="object"&&"key"in D&&"value"in D&&D.value===null)$=new W1.Pair(D.key,null);else $=new W1.Pair(D,null);if(!u1.findPair(this.items,$.key))this.items.push($)}get(D,$){let F=u1.findPair(this.items,D);return!$&&A1.isPair(F)?A1.isScalar(F.key)?F.key.value:F.key:F}set(D,$){if(typeof $!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof $}`);let F=u1.findPair(this.items,D);if(F&&!$)this.items.splice(this.items.indexOf(F),1);else if(!F&&$)this.items.push(new W1.Pair(D))}toJSON(D,$){return super.toJSON(D,$,Set)}toString(D,$,F){if(!D)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},D,{allNullValues:!0}),$,F);else throw Error("Set items must all have null values")}static from(D,$,F){let{replacer:B}=F,q=new this(D);if($&&Symbol.iterator in Object($))for(let Q of $){if(typeof B==="function")Q=B.call($,Q,Q);q.items.push(W1.createPair(Q,null,F))}return q}}D2.tag="tag:yaml.org,2002:set";var mW={collection:"map",identify:(D)=>D instanceof Set,nodeClass:D2,default:!1,tag:"tag:yaml.org,2002:set",createNode:(D,$,F)=>D2.from(D,$,F),resolve(D,$){if(A1.isMap(D))if(D.hasAllNullValues(!0))return Object.assign(new D2,D);else $("Set items must all have null values");else $("Expected a mapping for this tag");return D}};xW.YAMLSet=D2;xW.set=mW});var S9=L((nW)=>{var pW=v2();function b9(D,$){let F=D[0],B=F==="-"||F==="+"?D.substring(1):D,q=(X)=>$?BigInt(X):Number(X),Q=B.replace(/_/g,"").split(":").reduce((X,J)=>X*q(60)+q(J),q(0));return F==="-"?q(-1)*Q:Q}function _F(D){let{value:$}=D,F=(X)=>X;if(typeof $==="bigint")F=(X)=>BigInt(X);else if(isNaN($)||!isFinite($))return pW.stringifyNumber(D);let B="";if($<0)B="-",$*=F(-1);let q=F(60),Q=[$%q];if($<60)Q.unshift(0);else if($=($-Q[0])/q,Q.unshift($%q),$>=60)$=($-Q[0])/q,Q.unshift($);return B+Q.map((X)=>String(X).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var cW={identify:(D)=>typeof D==="bigint"||Number.isInteger(D),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(D,$,{intAsBigInt:F})=>b9(D,F),stringify:_F},iW={identify:(D)=>typeof D==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(D)=>b9(D,!1),stringify:_F},GF={identify:(D)=>D instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(D){let $=D.match(GF.test);if(!$)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,F,B,q,Q,X,J]=$.map(Number),Y=$[7]?Number(($[7]+"00").substr(1,3)):0,H=Date.UTC(F,B-1,q,Q||0,X||0,J||0,Y),C=$[8];if(C&&C!=="Z"){let _=b9(C,!1);if(Math.abs(_)<30)_*=60;H-=60000*_}return new Date(H)},stringify:({value:D})=>D?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};nW.floatTime=iW;nW.intTime=cW;nW.timestamp=GF});var WF=L((Ju)=>{var oW=T2(),tW=Y1(),eW=P2(),Du=k3(),$u=O9(),VF=JF(),T9=YF(),U1=CF(),Fu=D1(),Bu=N9(),qu=G1(),Xu=Z9(),P9=S9(),Qu=[oW.map,eW.seq,Du.string,tW.nullTag,VF.trueTag,VF.falseTag,U1.intBin,U1.intOct,U1.int,U1.intHex,T9.floatNaN,T9.floatExp,T9.float,$u.binary,Fu.merge,Bu.omap,qu.pairs,Xu.set,P9.intTime,P9.floatTime,P9.timestamp];Ju.schema=Qu});var jF=L((Au)=>{var zF=T2(),Hu=Y1(),wF=P2(),Cu=k3(),_u=u9(),v9=U9(),f9=w9(),Gu=s$(),Vu=t$(),MF=O9(),m3=D1(),KF=N9(),EF=G1(),uF=WF(),OF=Z9(),z1=S9(),AF=new Map([["core",Gu.schema],["failsafe",[zF.map,wF.seq,Cu.string]],["json",Vu.schema],["yaml11",uF.schema],["yaml-1.1",uF.schema]]),UF={binary:MF.binary,bool:_u.boolTag,float:v9.float,floatExp:v9.floatExp,floatNaN:v9.floatNaN,floatTime:z1.floatTime,int:f9.int,intHex:f9.intHex,intOct:f9.intOct,intTime:z1.intTime,map:zF.map,merge:m3.merge,null:Hu.nullTag,omap:KF.omap,pairs:EF.pairs,seq:wF.seq,set:OF.set,timestamp:z1.timestamp},Wu={"tag:yaml.org,2002:binary":MF.binary,"tag:yaml.org,2002:merge":m3.merge,"tag:yaml.org,2002:omap":KF.omap,"tag:yaml.org,2002:pairs":EF.pairs,"tag:yaml.org,2002:set":OF.set,"tag:yaml.org,2002:timestamp":z1.timestamp};function uu(D,$,F){let B=AF.get($);if(B&&!D)return F&&!B.includes(m3.merge)?B.concat(m3.merge):B.slice();let q=B;if(!q)if(Array.isArray(D))q=[];else{let Q=Array.from(AF.keys()).filter((X)=>X!=="yaml11").map((X)=>JSON.stringify(X)).join(", ");throw Error(`Unknown schema "${$}"; use one of ${Q} or define customTags array`)}if(Array.isArray(D))for(let Q of D)q=q.concat(Q);else if(typeof D==="function")q=D(q.slice());if(F)q=q.concat(m3.merge);return q.reduce((Q,X)=>{let J=typeof X==="string"?UF[X]:X;if(!J){let Y=JSON.stringify(X),H=Object.keys(UF).map((C)=>JSON.stringify(C)).join(", ");throw Error(`Unknown custom tag ${Y}; use one of ${H}`)}if(!Q.includes(J))Q.push(J);return Q},[])}Au.coreKnownTags=Wu;Au.getTags=uu});var h9=L((Ou)=>{var k9=d(),wu=T2(),Mu=P2(),Ku=k3(),w1=jF(),Eu=(D,$)=>D.key<$.key?-1:D.key>$.key?1:0;class y9{constructor({compat:D,customTags:$,merge:F,resolveKnownTags:B,schema:q,sortMapEntries:Q,toStringDefaults:X}){this.compat=Array.isArray(D)?w1.getTags(D,"compat"):D?w1.getTags(null,D):null,this.name=typeof q==="string"&&q||"core",this.knownTags=B?w1.coreKnownTags:{},this.tags=w1.getTags($,this.name,F),this.toStringOptions=X??null,Object.defineProperty(this,k9.MAP,{value:wu.map}),Object.defineProperty(this,k9.SCALAR,{value:Ku.string}),Object.defineProperty(this,k9.SEQ,{value:Mu.seq}),this.sortMapEntries=typeof Q==="function"?Q:Q===!0?Eu:null}clone(){let D=Object.create(y9.prototype,Object.getOwnPropertyDescriptors(this));return D.tags=this.tags.slice(),D}}Ou.Schema=y9});var RF=L((Lu)=>{var Ru=d(),g9=T3(),x3=Z3();function Nu(D,$){let F=[],B=$.directives===!0;if($.directives!==!1&&D.directives){let Y=D.directives.toString(D);if(Y)F.push(Y),B=!0;else if(D.directives.docStart)B=!0}if(B)F.push("---");let q=g9.createStringifyContext(D,$),{commentString:Q}=q.options;if(D.commentBefore){if(F.length!==1)F.unshift("");let Y=Q(D.commentBefore);F.unshift(x3.indentComment(Y,""))}let X=!1,J=null;if(D.contents){if(Ru.isNode(D.contents)){if(D.contents.spaceBefore&&B)F.push("");if(D.contents.commentBefore){let C=Q(D.contents.commentBefore);F.push(x3.indentComment(C,""))}q.forceBlockIndent=!!D.comment,J=D.contents.comment}let Y=J?void 0:()=>X=!0,H=g9.stringify(D.contents,q,()=>J=null,Y);if(J)H+=x3.lineComment(H,"",Q(J));if((H[0]==="|"||H[0]===">")&&F[F.length-1]==="---")F[F.length-1]=`--- ${H}`;else F.push(H)}else F.push(g9.stringify(D.contents,q));if(D.directives?.docEnd)if(D.comment){let Y=Q(D.comment);if(Y.includes(`
112
- `))F.push("..."),F.push(x3.indentComment(Y,""));else F.push(`... ${Y}`)}else F.push("...");else{let Y=D.comment;if(Y&&X)Y=Y.replace(/^\n+/,"");if(Y){if((!X||J)&&F[F.length-1]!=="")F.push("");F.push(x3.indentComment(Q(Y),""))}}return F.join(`
113
- `)+`
114
- `}Lu.stringifyDocument=Nu});var l3=L((ku)=>{var Zu=L3(),f2=r8(),TD=d(),bu=L0(),Su=j0(),Tu=h9(),Pu=RF(),m9=c8(),vu=X9(),fu=I3(),x9=q9();class l9{constructor(D,$,F){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,TD.NODE_TYPE,{value:TD.DOC});let B=null;if(typeof $==="function"||Array.isArray($))B=$;else if(F===void 0&&$)F=$,$=void 0;let q=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},F);this.options=q;let{version:Q}=q;if(F?._directives){if(this.directives=F._directives.atDocument(),this.directives.yaml.explicit)Q=this.directives.yaml.version}else this.directives=new x9.Directives({version:Q});this.setSchema(Q,F),this.contents=D===void 0?null:this.createNode(D,B,F)}clone(){let D=Object.create(l9.prototype,{[TD.NODE_TYPE]:{value:TD.DOC}});if(D.commentBefore=this.commentBefore,D.comment=this.comment,D.errors=this.errors.slice(),D.warnings=this.warnings.slice(),D.options=Object.assign({},this.options),this.directives)D.directives=this.directives.clone();if(D.schema=this.schema.clone(),D.contents=TD.isNode(this.contents)?this.contents.clone(D.schema):this.contents,this.range)D.range=this.range.slice();return D}add(D){if(k2(this.contents))this.contents.add(D)}addIn(D,$){if(k2(this.contents))this.contents.addIn(D,$)}createAlias(D,$){if(!D.anchor){let F=m9.anchorNames(this);D.anchor=!$||F.has($)?m9.findNewAnchor($||"a",F):$}return new Zu.Alias(D.anchor)}createNode(D,$,F){let B=void 0;if(typeof $==="function")D=$.call({"":D},"",D),B=$;else if(Array.isArray($)){let W=(z)=>typeof z==="number"||z instanceof String||z instanceof Number,A=$.filter(W).map(String);if(A.length>0)$=$.concat(A);B=$}else if(F===void 0&&$)F=$,$=void 0;let{aliasDuplicateObjects:q,anchorPrefix:Q,flow:X,keepUndefined:J,onTagObj:Y,tag:H}=F??{},{onAnchor:C,setAnchors:_,sourceObjects:G}=m9.createNodeAnchors(this,Q||"a"),u={aliasDuplicateObjects:q??!0,keepUndefined:J??!1,onAnchor:C,onTagObj:Y,replacer:B,schema:this.schema,sourceObjects:G},U=fu.createNode(D,H,u);if(X&&TD.isCollection(U))U.flow=!0;return _(),U}createPair(D,$,F={}){let B=this.createNode(D,null,F),q=this.createNode($,null,F);return new bu.Pair(B,q)}delete(D){return k2(this.contents)?this.contents.delete(D):!1}deleteIn(D){if(f2.isEmptyPath(D)){if(this.contents==null)return!1;return this.contents=null,!0}return k2(this.contents)?this.contents.deleteIn(D):!1}get(D,$){return TD.isCollection(this.contents)?this.contents.get(D,$):void 0}getIn(D,$){if(f2.isEmptyPath(D))return!$&&TD.isScalar(this.contents)?this.contents.value:this.contents;return TD.isCollection(this.contents)?this.contents.getIn(D,$):void 0}has(D){return TD.isCollection(this.contents)?this.contents.has(D):!1}hasIn(D){if(f2.isEmptyPath(D))return this.contents!==void 0;return TD.isCollection(this.contents)?this.contents.hasIn(D):!1}set(D,$){if(this.contents==null)this.contents=f2.collectionFromPath(this.schema,[D],$);else if(k2(this.contents))this.contents.set(D,$)}setIn(D,$){if(f2.isEmptyPath(D))this.contents=$;else if(this.contents==null)this.contents=f2.collectionFromPath(this.schema,Array.from(D),$);else if(k2(this.contents))this.contents.setIn(D,$)}setSchema(D,$={}){if(typeof D==="number")D=String(D);let F;switch(D){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new x9.Directives({version:"1.1"});F={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=D;else this.directives=new x9.Directives({version:D});F={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;F=null;break;default:{let B=JSON.stringify(D);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${B}`)}}if($.schema instanceof Object)this.schema=$.schema;else if(F)this.schema=new Tu.Schema(Object.assign(F,$));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:D,jsonArg:$,mapAsMap:F,maxAliasCount:B,onAnchor:q,reviver:Q}={}){let X={anchors:new Map,doc:this,keep:!D,mapAsMap:F===!0,mapKeyWarned:!1,maxAliasCount:typeof B==="number"?B:100},J=Su.toJS(this.contents,$??"",X);if(typeof q==="function")for(let{count:Y,res:H}of X.anchors.values())q(H,Y);return typeof Q==="function"?vu.applyReviver(Q,{"":J},"",J):J}toJSON(D,$){return this.toJS({json:!0,jsonArg:D,mapAsMap:!1,onAnchor:$})}toString(D={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in D&&(!Number.isInteger(D.indent)||Number(D.indent)<=0)){let $=JSON.stringify(D.indent);throw Error(`"indent" option must be a positive integer, not ${$}`)}return Pu.stringifyDocument(this,D)}}function k2(D){if(TD.isCollection(D))return!0;throw Error("Expected a YAML collection as document contents")}ku.Document=l9});var d3=L((gu)=>{class M1 extends Error{constructor(D,$,F,B){super();this.name=D,this.code=F,this.message=B,this.pos=$}}class NF extends M1{constructor(D,$,F){super("YAMLParseError",D,$,F)}}class LF extends M1{constructor(D,$,F){super("YAMLWarning",D,$,F)}}var hu=(D,$)=>(F)=>{if(F.pos[0]===-1)return;F.linePos=F.pos.map((J)=>$.linePos(J));let{line:B,col:q}=F.linePos[0];F.message+=` at line ${B}, column ${q}`;let Q=q-1,X=D.substring($.lineStarts[B-1],$.lineStarts[B]).replace(/[\n\r]+$/,"");if(Q>=60&&X.length>80){let J=Math.min(Q-39,X.length-79);X="…"+X.substring(J),Q-=J-1}if(X.length>80)X=X.substring(0,79)+"…";if(B>1&&/^ *$/.test(X.substring(0,Q))){let J=D.substring($.lineStarts[B-2],$.lineStarts[B-1]);if(J.length>80)J=J.substring(0,79)+`…
115
- `;X=J+X}if(/[^ ]/.test(X)){let J=1,Y=F.linePos[1];if(Y?.line===B&&Y.col>q)J=Math.max(1,Math.min(Y.col-q,80-Q));let H=" ".repeat(Q)+"^".repeat(J);F.message+=`:
116
-
117
- ${X}
118
- ${H}
119
- `}};gu.YAMLError=M1;gu.YAMLParseError=NF;gu.YAMLWarning=LF;gu.prettifyError=hu});var p3=L((cu)=>{function pu(D,{flow:$,indicator:F,next:B,offset:q,onError:Q,parentIndent:X,startOnNewline:J}){let Y=!1,H=J,C=J,_="",G="",u=!1,U=!1,W=null,A=null,z=null,w=null,M=null,K=null,R=null;for(let I of D){if(U){if(I.type!=="space"&&I.type!=="newline"&&I.type!=="comma")Q(I.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");U=!1}if(W){if(H&&I.type!=="comment"&&I.type!=="newline")Q(W,"TAB_AS_INDENT","Tabs are not allowed as indentation");W=null}switch(I.type){case"space":if(!$&&(F!=="doc-start"||B?.type!=="flow-collection")&&I.source.includes("\t"))W=I;C=!0;break;case"comment":{if(!C)Q(I,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let r=I.source.substring(1)||" ";if(!_)_=r;else _+=G+r;G="",H=!1;break}case"newline":if(H){if(_)_+=I.source;else if(!K||F!=="seq-item-ind")Y=!0}else G+=I.source;if(H=!0,u=!0,A||z)w=I;C=!0;break;case"anchor":if(A)Q(I,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(I.source.endsWith(":"))Q(I.offset+I.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);A=I,R??(R=I.offset),H=!1,C=!1,U=!0;break;case"tag":{if(z)Q(I,"MULTIPLE_TAGS","A node can have at most one tag");z=I,R??(R=I.offset),H=!1,C=!1,U=!0;break}case F:if(A||z)Q(I,"BAD_PROP_ORDER",`Anchors and tags must be after the ${I.source} indicator`);if(K)Q(I,"UNEXPECTED_TOKEN",`Unexpected ${I.source} in ${$??"collection"}`);K=I,H=F==="seq-item-ind"||F==="explicit-key-ind",C=!1;break;case"comma":if($){if(M)Q(I,"UNEXPECTED_TOKEN",`Unexpected , in ${$}`);M=I,H=!1,C=!1;break}default:Q(I,"UNEXPECTED_TOKEN",`Unexpected ${I.type} token`),H=!1,C=!1}}let Z=D[D.length-1],v=Z?Z.offset+Z.source.length:q;if(U&&B&&B.type!=="space"&&B.type!=="newline"&&B.type!=="comma"&&(B.type!=="scalar"||B.source!==""))Q(B.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(W&&(H&&W.indent<=X||B?.type==="block-map"||B?.type==="block-seq"))Q(W,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:M,found:K,spaceBefore:Y,comment:_,hasNewline:u,anchor:A,tag:z,newlineAfterProp:w,end:v,start:R??v}}cu.resolveProps=pu});var K1=L((nu)=>{function d9(D){if(!D)return null;switch(D.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(D.source.includes(`
120
- `))return!0;if(D.end){for(let $ of D.end)if($.type==="newline")return!0}return!1;case"flow-collection":for(let $ of D.items){for(let F of $.start)if(F.type==="newline")return!0;if($.sep){for(let F of $.sep)if(F.type==="newline")return!0}if(d9($.key)||d9($.value))return!0}return!1;default:return!0}}nu.containsNewline=d9});var p9=L((ou)=>{var au=K1();function su(D,$,F){if($?.type==="flow-collection"){let B=$.end[0];if(B.indent===D&&(B.source==="]"||B.source==="}")&&au.containsNewline($))F(B,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}ou.flowIndentCheck=su});var c9=L((DA)=>{var IF=d();function eu(D,$,F){let{uniqueKeys:B}=D.options;if(B===!1)return!1;let q=typeof B==="function"?B:(Q,X)=>Q===X||IF.isScalar(Q)&&IF.isScalar(X)&&Q.value===X.value;return $.some((Q)=>q(Q.key,F))}DA.mapIncludes=eu});var PF=L((QA)=>{var ZF=L0(),FA=Z0(),bF=p3(),BA=K1(),SF=p9(),qA=c9(),TF="All mapping items must start at the same column";function XA({composeNode:D,composeEmptyNode:$},F,B,q,Q){let J=new(Q?.nodeClass??FA.YAMLMap)(F.schema);if(F.atRoot)F.atRoot=!1;let Y=B.offset,H=null;for(let C of B.items){let{start:_,key:G,sep:u,value:U}=C,W=bF.resolveProps(_,{indicator:"explicit-key-ind",next:G??u?.[0],offset:Y,onError:q,parentIndent:B.indent,startOnNewline:!0}),A=!W.found;if(A){if(G){if(G.type==="block-seq")q(Y,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in G&&G.indent!==B.indent)q(Y,"BAD_INDENT",TF)}if(!W.anchor&&!W.tag&&!u){if(H=W.end,W.comment)if(J.comment)J.comment+=`
121
- `+W.comment;else J.comment=W.comment;continue}if(W.newlineAfterProp||BA.containsNewline(G))q(G??_[_.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(W.found?.indent!==B.indent)q(Y,"BAD_INDENT",TF);F.atKey=!0;let z=W.end,w=G?D(F,G,W,q):$(F,z,_,null,W,q);if(F.schema.compat)SF.flowIndentCheck(B.indent,G,q);if(F.atKey=!1,qA.mapIncludes(F,J.items,w))q(z,"DUPLICATE_KEY","Map keys must be unique");let M=bF.resolveProps(u??[],{indicator:"map-value-ind",next:U,offset:w.range[2],onError:q,parentIndent:B.indent,startOnNewline:!G||G.type==="block-scalar"});if(Y=M.end,M.found){if(A){if(U?.type==="block-map"&&!M.hasNewline)q(Y,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(F.options.strict&&W.start<M.found.offset-1024)q(w.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let K=U?D(F,U,M,q):$(F,Y,u,null,M,q);if(F.schema.compat)SF.flowIndentCheck(B.indent,U,q);Y=K.range[2];let R=new ZF.Pair(w,K);if(F.options.keepSourceTokens)R.srcToken=C;J.items.push(R)}else{if(A)q(w.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(M.comment)if(w.comment)w.comment+=`
122
- `+M.comment;else w.comment=M.comment;let K=new ZF.Pair(w);if(F.options.keepSourceTokens)K.srcToken=C;J.items.push(K)}}if(H&&H<Y)q(H,"IMPOSSIBLE","Map comment with trailing content");return J.range=[B.offset,Y,H??Y],J}QA.resolveBlockMap=XA});var vF=L((GA)=>{var YA=b0(),HA=p3(),CA=p9();function _A({composeNode:D,composeEmptyNode:$},F,B,q,Q){let J=new(Q?.nodeClass??YA.YAMLSeq)(F.schema);if(F.atRoot)F.atRoot=!1;if(F.atKey)F.atKey=!1;let Y=B.offset,H=null;for(let{start:C,value:_}of B.items){let G=HA.resolveProps(C,{indicator:"seq-item-ind",next:_,offset:Y,onError:q,parentIndent:B.indent,startOnNewline:!0});if(!G.found)if(G.anchor||G.tag||_)if(_?.type==="block-seq")q(G.end,"BAD_INDENT","All sequence items must start at the same column");else q(Y,"MISSING_CHAR","Sequence item without - indicator");else{if(H=G.end,G.comment)J.comment=G.comment;continue}let u=_?D(F,_,G,q):$(F,G.end,C,null,G,q);if(F.schema.compat)CA.flowIndentCheck(B.indent,_,q);Y=u.range[2],J.items.push(u)}return J.range=[B.offset,Y,H??Y],J}GA.resolveBlockSeq=_A});var y2=L((uA)=>{function WA(D,$,F,B){let q="";if(D){let Q=!1,X="";for(let J of D){let{source:Y,type:H}=J;switch(H){case"space":Q=!0;break;case"comment":{if(F&&!Q)B(J,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=Y.substring(1)||" ";if(!q)q=C;else q+=X+C;X="";break}case"newline":if(q)X+=Y;Q=!0;break;default:B(J,"UNEXPECTED_TOKEN",`Unexpected ${H} at node end`)}$+=Y.length}}return{comment:q,offset:$}}uA.resolveEnd=WA});var yF=L((jA)=>{var UA=d(),zA=L0(),fF=Z0(),wA=b0(),MA=y2(),kF=p3(),KA=K1(),EA=c9(),i9="Block collections are not allowed within flow collections",n9=(D)=>D&&(D.type==="block-map"||D.type==="block-seq");function OA({composeNode:D,composeEmptyNode:$},F,B,q,Q){let X=B.start.source==="{",J=X?"flow map":"flow sequence",H=new(Q?.nodeClass??(X?fF.YAMLMap:wA.YAMLSeq))(F.schema);H.flow=!0;let C=F.atRoot;if(C)F.atRoot=!1;if(F.atKey)F.atKey=!1;let _=B.offset+B.start.source.length;for(let A=0;A<B.items.length;++A){let z=B.items[A],{start:w,key:M,sep:K,value:R}=z,Z=kF.resolveProps(w,{flow:J,indicator:"explicit-key-ind",next:M??K?.[0],offset:_,onError:q,parentIndent:B.indent,startOnNewline:!1});if(!Z.found){if(!Z.anchor&&!Z.tag&&!K&&!R){if(A===0&&Z.comma)q(Z.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${J}`);else if(A<B.items.length-1)q(Z.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${J}`);if(Z.comment)if(H.comment)H.comment+=`
123
- `+Z.comment;else H.comment=Z.comment;_=Z.end;continue}if(!X&&F.options.strict&&KA.containsNewline(M))q(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(A===0){if(Z.comma)q(Z.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${J}`)}else{if(!Z.comma)q(Z.start,"MISSING_CHAR",`Missing , between ${J} items`);if(Z.comment){let v="";D:for(let I of w)switch(I.type){case"comma":case"space":break;case"comment":v=I.source.substring(1);break D;default:break D}if(v){let I=H.items[H.items.length-1];if(UA.isPair(I))I=I.value??I.key;if(I.comment)I.comment+=`
124
- `+v;else I.comment=v;Z.comment=Z.comment.substring(v.length+1)}}}if(!X&&!K&&!Z.found){let v=R?D(F,R,Z,q):$(F,Z.end,K,null,Z,q);if(H.items.push(v),_=v.range[2],n9(R))q(v.range,"BLOCK_IN_FLOW",i9)}else{F.atKey=!0;let v=Z.end,I=M?D(F,M,Z,q):$(F,v,w,null,Z,q);if(n9(M))q(I.range,"BLOCK_IN_FLOW",i9);F.atKey=!1;let r=kF.resolveProps(K??[],{flow:J,indicator:"map-value-ind",next:R,offset:I.range[2],onError:q,parentIndent:B.indent,startOnNewline:!1});if(r.found){if(!X&&!Z.found&&F.options.strict){if(K)for(let i of K){if(i===r.found)break;if(i.type==="newline"){q(i,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(Z.start<r.found.offset-1024)q(r.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(R)if("source"in R&&R.source?.[0]===":")q(R,"MISSING_CHAR",`Missing space after : in ${J}`);else q(r.start,"MISSING_CHAR",`Missing , or : between ${J} items`);let e=R?D(F,R,r,q):r.found?$(F,r.end,K,null,r,q):null;if(e){if(n9(R))q(e.range,"BLOCK_IN_FLOW",i9)}else if(r.comment)if(I.comment)I.comment+=`
125
- `+r.comment;else I.comment=r.comment;let B0=new zA.Pair(I,e);if(F.options.keepSourceTokens)B0.srcToken=z;if(X){let i=H;if(EA.mapIncludes(F,i.items,I))q(v,"DUPLICATE_KEY","Map keys must be unique");i.items.push(B0)}else{let i=new fF.YAMLMap(F.schema);i.flow=!0,i.items.push(B0);let k=(e??I).range;i.range=[I.range[0],k[1],k[2]],H.items.push(i)}_=e?e.range[2]:r.end}}let G=X?"}":"]",[u,...U]=B.end,W=_;if(u?.source===G)W=u.offset+u.source.length;else{let A=J[0].toUpperCase()+J.substring(1),z=C?`${A} must end with a ${G}`:`${A} in block collection must be sufficiently indented and end with a ${G}`;if(q(_,C?"MISSING_CHAR":"BAD_INDENT",z),u&&u.source.length!==1)U.unshift(u)}if(U.length>0){let A=MA.resolveEnd(U,W,F.options.strict,q);if(A.comment)if(H.comment)H.comment+=`
126
- `+A.comment;else H.comment=A.comment;H.range=[B.offset,W,A.offset]}else H.range=[B.offset,W,W];return H}jA.resolveFlowCollection=OA});var hF=L((vA)=>{var NA=d(),LA=DD(),IA=Z0(),ZA=b0(),bA=PF(),SA=vF(),TA=yF();function r9(D,$,F,B,q,Q){let X=F.type==="block-map"?bA.resolveBlockMap(D,$,F,B,Q):F.type==="block-seq"?SA.resolveBlockSeq(D,$,F,B,Q):TA.resolveFlowCollection(D,$,F,B,Q),J=X.constructor;if(q==="!"||q===J.tagName)return X.tag=J.tagName,X;if(q)X.tag=q;return X}function PA(D,$,F,B,q){let Q=B.tag,X=!Q?null:$.directives.tagName(Q.source,(G)=>q(Q,"TAG_RESOLVE_FAILED",G));if(F.type==="block-seq"){let{anchor:G,newlineAfterProp:u}=B,U=G&&Q?G.offset>Q.offset?G:Q:G??Q;if(U&&(!u||u.offset<U.offset))q(U,"MISSING_CHAR","Missing newline after block sequence props")}let J=F.type==="block-map"?"map":F.type==="block-seq"?"seq":F.start.source==="{"?"map":"seq";if(!Q||!X||X==="!"||X===IA.YAMLMap.tagName&&J==="map"||X===ZA.YAMLSeq.tagName&&J==="seq")return r9(D,$,F,q,X);let Y=$.schema.tags.find((G)=>G.tag===X&&G.collection===J);if(!Y){let G=$.schema.knownTags[X];if(G?.collection===J)$.schema.tags.push(Object.assign({},G,{default:!1})),Y=G;else{if(G)q(Q,"BAD_COLLECTION_TYPE",`${G.tag} used for ${J} collection, but expects ${G.collection??"scalar"}`,!0);else q(Q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${X}`,!0);return r9(D,$,F,q,X)}}let H=r9(D,$,F,q,X,Y),C=Y.resolve?.(H,(G)=>q(Q,"TAG_RESOLVE_FAILED",G),$.options)??H,_=NA.isNode(C)?C:new LA.Scalar(C);if(_.range=H.range,_.tag=X,Y?.format)_.format=Y.format;return _}vA.composeCollection=PA});var s9=L((gA)=>{var a9=DD();function kA(D,$,F){let B=$.offset,q=yA($,D.options.strict,F);if(!q)return{value:"",type:null,comment:"",range:[B,B,B]};let Q=q.mode===">"?a9.Scalar.BLOCK_FOLDED:a9.Scalar.BLOCK_LITERAL,X=$.source?hA($.source):[],J=X.length;for(let W=X.length-1;W>=0;--W){let A=X[W][1];if(A===""||A==="\r")J=W;else break}if(J===0){let W=q.chomp==="+"&&X.length>0?`
127
- `.repeat(Math.max(1,X.length-1)):"",A=B+q.length;if($.source)A+=$.source.length;return{value:W,type:Q,comment:q.comment,range:[B,A,A]}}let Y=$.indent+q.indent,H=$.offset+q.length,C=0;for(let W=0;W<J;++W){let[A,z]=X[W];if(z===""||z==="\r"){if(q.indent===0&&A.length>Y)Y=A.length}else{if(A.length<Y)F(H+A.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(q.indent===0)Y=A.length;if(C=W,Y===0&&!D.atRoot)F(H,"BAD_INDENT","Block scalar values in collections must be indented");break}H+=A.length+z.length+1}for(let W=X.length-1;W>=J;--W)if(X[W][0].length>Y)J=W+1;let _="",G="",u=!1;for(let W=0;W<C;++W)_+=X[W][0].slice(Y)+`
128
- `;for(let W=C;W<J;++W){let[A,z]=X[W];H+=A.length+z.length+1;let w=z[z.length-1]==="\r";if(w)z=z.slice(0,-1);if(z&&A.length<Y){let K=`Block scalar lines must not be less indented than their ${q.indent?"explicit indentation indicator":"first line"}`;F(H-z.length-(w?2:1),"BAD_INDENT",K),A=""}if(Q===a9.Scalar.BLOCK_LITERAL)_+=G+A.slice(Y)+z,G=`
129
- `;else if(A.length>Y||z[0]==="\t"){if(G===" ")G=`
130
- `;else if(!u&&G===`
131
- `)G=`
132
-
133
- `;_+=G+A.slice(Y)+z,G=`
134
- `,u=!0}else if(z==="")if(G===`
135
- `)_+=`
136
- `;else G=`
137
- `;else _+=G+z,G=" ",u=!1}switch(q.chomp){case"-":break;case"+":for(let W=J;W<X.length;++W)_+=`
138
- `+X[W][0].slice(Y);if(_[_.length-1]!==`
139
- `)_+=`
140
- `;break;default:_+=`
141
- `}let U=B+q.length+$.source.length;return{value:_,type:Q,comment:q.comment,range:[B,U,U]}}function yA({offset:D,props:$},F,B){if($[0].type!=="block-scalar-header")return B($[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:q}=$[0],Q=q[0],X=0,J="",Y=-1;for(let G=1;G<q.length;++G){let u=q[G];if(!J&&(u==="-"||u==="+"))J=u;else{let U=Number(u);if(!X&&U)X=U;else if(Y===-1)Y=D+G}}if(Y!==-1)B(Y,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${q}`);let H=!1,C="",_=q.length;for(let G=1;G<$.length;++G){let u=$[G];switch(u.type){case"space":H=!0;case"newline":_+=u.source.length;break;case"comment":if(F&&!H)B(u,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");_+=u.source.length,C=u.source.substring(1);break;case"error":B(u,"UNEXPECTED_TOKEN",u.message),_+=u.source.length;break;default:{let U=`Unexpected token in block scalar header: ${u.type}`;B(u,"UNEXPECTED_TOKEN",U);let W=u.source;if(W&&typeof W==="string")_+=W.length}}}return{mode:Q,indent:X,chomp:J,comment:C,length:_}}function hA(D){let $=D.split(/\n( *)/),F=$[0],B=F.match(/^( *)/),Q=[B?.[1]?[B[1],F.slice(B[1].length)]:["",F]];for(let X=1;X<$.length;X+=2)Q.push([$[X],$[X+1]]);return Q}gA.resolveBlockScalar=kA});var t9=L((aA)=>{var o9=DD(),xA=y2();function lA(D,$,F){let{offset:B,type:q,source:Q,end:X}=D,J,Y,H=(G,u,U)=>F(B+G,u,U);switch(q){case"scalar":J=o9.Scalar.PLAIN,Y=dA(Q,H);break;case"single-quoted-scalar":J=o9.Scalar.QUOTE_SINGLE,Y=pA(Q,H);break;case"double-quoted-scalar":J=o9.Scalar.QUOTE_DOUBLE,Y=cA(Q,H);break;default:return F(D,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${q}`),{value:"",type:null,comment:"",range:[B,B+Q.length,B+Q.length]}}let C=B+Q.length,_=xA.resolveEnd(X,C,$,F);return{value:Y,type:J,comment:_.comment,range:[B,C,_.offset]}}function dA(D,$){let F="";switch(D[0]){case"\t":F="a tab character";break;case",":F="flow indicator character ,";break;case"%":F="directive indicator character %";break;case"|":case">":{F=`block scalar indicator ${D[0]}`;break}case"@":case"`":{F=`reserved character ${D[0]}`;break}}if(F)$(0,"BAD_SCALAR_START",`Plain value cannot start with ${F}`);return gF(D)}function pA(D,$){if(D[D.length-1]!=="'"||D.length===1)$(D.length,"MISSING_CHAR","Missing closing 'quote");return gF(D.slice(1,-1)).replace(/''/g,"'")}function gF(D){let $,F;try{$=new RegExp(`(.*?)(?<![ ])[ ]*\r?
142
- `,"sy"),F=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
143
- `,"sy")}catch{$=/(.*?)[ \t]*\r?\n/sy,F=/[ \t]*(.*?)[ \t]*\r?\n/sy}let B=$.exec(D);if(!B)return D;let q=B[1],Q=" ",X=$.lastIndex;F.lastIndex=X;while(B=F.exec(D)){if(B[1]==="")if(Q===`
144
- `)q+=Q;else Q=`
145
- `;else q+=Q+B[1],Q=" ";X=F.lastIndex}let J=/[ \t]*(.*)/sy;return J.lastIndex=X,B=J.exec(D),q+Q+(B?.[1]??"")}function cA(D,$){let F="";for(let B=1;B<D.length-1;++B){let q=D[B];if(q==="\r"&&D[B+1]===`
146
- `)continue;if(q===`
147
- `){let{fold:Q,offset:X}=iA(D,B);F+=Q,B=X}else if(q==="\\"){let Q=D[++B],X=nA[Q];if(X)F+=X;else if(Q===`
148
- `){Q=D[B+1];while(Q===" "||Q==="\t")Q=D[++B+1]}else if(Q==="\r"&&D[B+1]===`
149
- `){Q=D[++B+1];while(Q===" "||Q==="\t")Q=D[++B+1]}else if(Q==="x"||Q==="u"||Q==="U"){let J={x:2,u:4,U:8}[Q];F+=rA(D,B+1,J,$),B+=J}else{let J=D.substr(B-1,2);$(B-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${J}`),F+=J}}else if(q===" "||q==="\t"){let Q=B,X=D[B+1];while(X===" "||X==="\t")X=D[++B+1];if(X!==`
150
- `&&!(X==="\r"&&D[B+2]===`
151
- `))F+=B>Q?D.slice(Q,B+1):q}else F+=q}if(D[D.length-1]!=='"'||D.length===1)$(D.length,"MISSING_CHAR",'Missing closing "quote');return F}function iA(D,$){let F="",B=D[$+1];while(B===" "||B==="\t"||B===`
152
- `||B==="\r"){if(B==="\r"&&D[$+2]!==`
153
- `)break;if(B===`
154
- `)F+=`
155
- `;$+=1,B=D[$+1]}if(!F)F=" ";return{fold:F,offset:$}}var nA={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
156
- `,r:"\r",t:"\t",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function rA(D,$,F,B){let q=D.substr($,F),X=q.length===F&&/^[0-9a-fA-F]+$/.test(q)?parseInt(q,16):NaN;if(isNaN(X)){let J=D.substr($-2,F+2);return B($-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${J}`),J}return String.fromCodePoint(X)}aA.resolveFlowScalar=lA});var xF=L((FU)=>{var $2=d(),mF=DD(),oA=s9(),tA=t9();function eA(D,$,F,B){let{value:q,type:Q,comment:X,range:J}=$.type==="block-scalar"?oA.resolveBlockScalar(D,$,B):tA.resolveFlowScalar($,D.options.strict,B),Y=F?D.directives.tagName(F.source,(_)=>B(F,"TAG_RESOLVE_FAILED",_)):null,H;if(D.options.stringKeys&&D.atKey)H=D.schema[$2.SCALAR];else if(Y)H=DU(D.schema,q,Y,F,B);else if($.type==="scalar")H=$U(D,q,$,B);else H=D.schema[$2.SCALAR];let C;try{let _=H.resolve(q,(G)=>B(F??$,"TAG_RESOLVE_FAILED",G),D.options);C=$2.isScalar(_)?_:new mF.Scalar(_)}catch(_){let G=_ instanceof Error?_.message:String(_);B(F??$,"TAG_RESOLVE_FAILED",G),C=new mF.Scalar(q)}if(C.range=J,C.source=q,Q)C.type=Q;if(Y)C.tag=Y;if(H.format)C.format=H.format;if(X)C.comment=X;return C}function DU(D,$,F,B,q){if(F==="!")return D[$2.SCALAR];let Q=[];for(let J of D.tags)if(!J.collection&&J.tag===F)if(J.default&&J.test)Q.push(J);else return J;for(let J of Q)if(J.test?.test($))return J;let X=D.knownTags[F];if(X&&!X.collection)return D.tags.push(Object.assign({},X,{default:!1,test:void 0})),X;return q(B,"TAG_RESOLVE_FAILED",`Unresolved tag: ${F}`,F!=="tag:yaml.org,2002:str"),D[$2.SCALAR]}function $U({atKey:D,directives:$,schema:F},B,q,Q){let X=F.tags.find((J)=>(J.default===!0||D&&J.default==="key")&&J.test?.test(B))||F[$2.SCALAR];if(F.compat){let J=F.compat.find((Y)=>Y.default&&Y.test?.test(B))??F[$2.SCALAR];if(X.tag!==J.tag){let Y=$.tagString(X.tag),H=$.tagString(J.tag),C=`Value may be parsed as either ${Y} or ${H}`;Q(q,"TAG_RESOLVE_FAILED",C,!0)}}return X}FU.composeScalar=eA});var lF=L((XU)=>{function qU(D,$,F){if($){F??(F=$.length);for(let B=F-1;B>=0;--B){let q=$[B];switch(q.type){case"space":case"comment":case"newline":D-=q.source.length;continue}q=$[++B];while(q?.type==="space")D+=q.source.length,q=$[++B];break}}return D}XU.emptyScalarPosition=qU});var cF=L((WU)=>{var JU=L3(),YU=d(),HU=hF(),dF=xF(),CU=y2(),_U=lF(),GU={composeNode:pF,composeEmptyNode:e9};function pF(D,$,F,B){let q=D.atKey,{spaceBefore:Q,comment:X,anchor:J,tag:Y}=F,H,C=!0;switch($.type){case"alias":if(H=VU(D,$,B),J||Y)B($,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(H=dF.composeScalar(D,$,Y,B),J)H.anchor=J.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":if(H=HU.composeCollection(GU,D,$,F,B),J)H.anchor=J.source.substring(1);break;default:{let _=$.type==="error"?$.message:`Unsupported token (type: ${$.type})`;B($,"UNEXPECTED_TOKEN",_),H=e9(D,$.offset,void 0,null,F,B),C=!1}}if(J&&H.anchor==="")B(J,"BAD_ALIAS","Anchor cannot be an empty string");if(q&&D.options.stringKeys&&(!YU.isScalar(H)||typeof H.value!=="string"||H.tag&&H.tag!=="tag:yaml.org,2002:str"))B(Y??$,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(Q)H.spaceBefore=!0;if(X)if($.type==="scalar"&&$.source==="")H.comment=X;else H.commentBefore=X;if(D.options.keepSourceTokens&&C)H.srcToken=$;return H}function e9(D,$,F,B,{spaceBefore:q,comment:Q,anchor:X,tag:J,end:Y},H){let C={type:"scalar",offset:_U.emptyScalarPosition($,F,B),indent:-1,source:""},_=dF.composeScalar(D,C,J,H);if(X){if(_.anchor=X.source.substring(1),_.anchor==="")H(X,"BAD_ALIAS","Anchor cannot be an empty string")}if(q)_.spaceBefore=!0;if(Q)_.comment=Q,_.range[2]=Y;return _}function VU({options:D},{offset:$,source:F,end:B},q){let Q=new JU.Alias(F.substring(1));if(Q.source==="")q($,"BAD_ALIAS","Alias cannot be an empty string");if(Q.source.endsWith(":"))q($+F.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let X=$+F.length,J=CU.resolveEnd(B,X,D.strict,q);if(Q.range=[$,X,J.offset],J.comment)Q.comment=J.comment;return Q}WU.composeEmptyNode=e9;WU.composeNode=pF});var nF=L((KU)=>{var UU=l3(),iF=cF(),zU=y2(),wU=p3();function MU(D,$,{offset:F,start:B,value:q,end:Q},X){let J=Object.assign({_directives:$},D),Y=new UU.Document(void 0,J),H={atKey:!1,atRoot:!0,directives:Y.directives,options:Y.options,schema:Y.schema},C=wU.resolveProps(B,{indicator:"doc-start",next:q??Q?.[0],offset:F,onError:X,parentIndent:0,startOnNewline:!0});if(C.found){if(Y.directives.docStart=!0,q&&(q.type==="block-map"||q.type==="block-seq")&&!C.hasNewline)X(C.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}Y.contents=q?iF.composeNode(H,q,C,X):iF.composeEmptyNode(H,C.end,B,null,C,X);let _=Y.contents.range[2],G=zU.resolveEnd(Q,_,!1,X);if(G.comment)Y.comment=G.comment;return Y.range=[F,_,G.offset],Y}KU.composeDoc=MU});var D7=L((IU)=>{var OU=c2("process"),jU=q9(),RU=l3(),c3=d3(),rF=d(),NU=nF(),LU=y2();function i3(D){if(typeof D==="number")return[D,D+1];if(Array.isArray(D))return D.length===2?D:[D[0],D[1]];let{offset:$,source:F}=D;return[$,$+(typeof F==="string"?F.length:1)]}function aF(D){let $="",F=!1,B=!1;for(let q=0;q<D.length;++q){let Q=D[q];switch(Q[0]){case"#":$+=($===""?"":B?`
157
-
158
- `:`
159
- `)+(Q.substring(1)||" "),F=!0,B=!1;break;case"%":if(D[q+1]?.[0]!=="#")q+=1;F=!1;break;default:if(!F)B=!0;F=!1}}return{comment:$,afterEmptyLine:B}}class sF{constructor(D={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=($,F,B,q)=>{let Q=i3($);if(q)this.warnings.push(new c3.YAMLWarning(Q,F,B));else this.errors.push(new c3.YAMLParseError(Q,F,B))},this.directives=new jU.Directives({version:D.version||"1.2"}),this.options=D}decorate(D,$){let{comment:F,afterEmptyLine:B}=aF(this.prelude);if(F){let q=D.contents;if($)D.comment=D.comment?`${D.comment}
160
- ${F}`:F;else if(B||D.directives.docStart||!q)D.commentBefore=F;else if(rF.isCollection(q)&&!q.flow&&q.items.length>0){let Q=q.items[0];if(rF.isPair(Q))Q=Q.key;let X=Q.commentBefore;Q.commentBefore=X?`${F}
161
- ${X}`:F}else{let Q=q.commentBefore;q.commentBefore=Q?`${F}
162
- ${Q}`:F}}if($)Array.prototype.push.apply(D.errors,this.errors),Array.prototype.push.apply(D.warnings,this.warnings);else D.errors=this.errors,D.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:aF(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(D,$=!1,F=-1){for(let B of D)yield*this.next(B);yield*this.end($,F)}*next(D){if(OU.env.LOG_STREAM)console.dir(D,{depth:null});switch(D.type){case"directive":this.directives.add(D.source,($,F,B)=>{let q=i3(D);q[0]+=$,this.onError(q,"BAD_DIRECTIVE",F,B)}),this.prelude.push(D.source),this.atDirectives=!0;break;case"document":{let $=NU.composeDoc(this.options,this.directives,D,this.onError);if(this.atDirectives&&!$.directives.docStart)this.onError(D,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate($,!1),this.doc)yield this.doc;this.doc=$,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(D.source);break;case"error":{let $=D.source?`${D.message}: ${JSON.stringify(D.source)}`:D.message,F=new c3.YAMLParseError(i3(D),"UNEXPECTED_TOKEN",$);if(this.atDirectives||!this.doc)this.errors.push(F);else this.doc.errors.push(F);break}case"doc-end":{if(!this.doc){this.errors.push(new c3.YAMLParseError(i3(D),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let $=LU.resolveEnd(D.end,D.offset+D.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),$.comment){let F=this.doc.comment;this.doc.comment=F?`${F}
163
- ${$.comment}`:$.comment}this.doc.range[2]=$.offset;break}default:this.errors.push(new c3.YAMLParseError(i3(D),"UNEXPECTED_TOKEN",`Unsupported token ${D.type}`))}}*end(D=!1,$=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(D){let F=Object.assign({_directives:this.directives},this.options),B=new RU.Document(void 0,F);if(this.atDirectives)this.onError($,"MISSING_CHAR","Missing directives-end indicator line");B.range=[0,$,$],this.decorate(B,!1),yield B}}}IU.Composer=sF});var eF=L((yU)=>{var bU=s9(),SU=t9(),TU=d3(),oF=S3();function PU(D,$=!0,F){if(D){let B=(q,Q,X)=>{let J=typeof q==="number"?q:Array.isArray(q)?q[0]:q.offset;if(F)F(J,Q,X);else throw new TU.YAMLParseError([J,J+1],Q,X)};switch(D.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return SU.resolveFlowScalar(D,$,B);case"block-scalar":return bU.resolveBlockScalar({options:{strict:$}},D,B)}}return null}function vU(D,$){let{implicitKey:F=!1,indent:B,inFlow:q=!1,offset:Q=-1,type:X="PLAIN"}=$,J=oF.stringifyString({type:X,value:D},{implicitKey:F,indent:B>0?" ".repeat(B):"",inFlow:q,options:{blockQuote:!0,lineWidth:-1}}),Y=$.end??[{type:"newline",offset:-1,indent:B,source:`
164
- `}];switch(J[0]){case"|":case">":{let H=J.indexOf(`
165
- `),C=J.substring(0,H),_=J.substring(H+1)+`
166
- `,G=[{type:"block-scalar-header",offset:Q,indent:B,source:C}];if(!tF(G,Y))G.push({type:"newline",offset:-1,indent:B,source:`
167
- `});return{type:"block-scalar",offset:Q,indent:B,props:G,source:_}}case'"':return{type:"double-quoted-scalar",offset:Q,indent:B,source:J,end:Y};case"'":return{type:"single-quoted-scalar",offset:Q,indent:B,source:J,end:Y};default:return{type:"scalar",offset:Q,indent:B,source:J,end:Y}}}function fU(D,$,F={}){let{afterKey:B=!1,implicitKey:q=!1,inFlow:Q=!1,type:X}=F,J="indent"in D?D.indent:null;if(B&&typeof J==="number")J+=2;if(!X)switch(D.type){case"single-quoted-scalar":X="QUOTE_SINGLE";break;case"double-quoted-scalar":X="QUOTE_DOUBLE";break;case"block-scalar":{let H=D.props[0];if(H.type!=="block-scalar-header")throw Error("Invalid block scalar header");X=H.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:X="PLAIN"}let Y=oF.stringifyString({type:X,value:$},{implicitKey:q||J===null,indent:J!==null&&J>0?" ".repeat(J):"",inFlow:Q,options:{blockQuote:!0,lineWidth:-1}});switch(Y[0]){case"|":case">":kU(D,Y);break;case'"':$7(D,Y,"double-quoted-scalar");break;case"'":$7(D,Y,"single-quoted-scalar");break;default:$7(D,Y,"scalar")}}function kU(D,$){let F=$.indexOf(`
168
- `),B=$.substring(0,F),q=$.substring(F+1)+`
169
- `;if(D.type==="block-scalar"){let Q=D.props[0];if(Q.type!=="block-scalar-header")throw Error("Invalid block scalar header");Q.source=B,D.source=q}else{let{offset:Q}=D,X="indent"in D?D.indent:-1,J=[{type:"block-scalar-header",offset:Q,indent:X,source:B}];if(!tF(J,"end"in D?D.end:void 0))J.push({type:"newline",offset:-1,indent:X,source:`
170
- `});for(let Y of Object.keys(D))if(Y!=="type"&&Y!=="offset")delete D[Y];Object.assign(D,{type:"block-scalar",indent:X,props:J,source:q})}}function tF(D,$){if($)for(let F of $)switch(F.type){case"space":case"comment":D.push(F);break;case"newline":return D.push(F),!0}return!1}function $7(D,$,F){switch(D.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":D.type=F,D.source=$;break;case"block-scalar":{let B=D.props.slice(1),q=$.length;if(D.props[0].type==="block-scalar-header")q-=D.props[0].source.length;for(let Q of B)Q.offset+=q;delete D.props,Object.assign(D,{type:F,source:$,end:B});break}case"block-map":case"block-seq":{let q={type:"newline",offset:D.offset+$.length,indent:D.indent,source:`
171
- `};delete D.items,Object.assign(D,{type:F,source:$,end:[q]});break}default:{let B="indent"in D?D.indent:-1,q="end"in D&&Array.isArray(D.end)?D.end.filter((Q)=>Q.type==="space"||Q.type==="comment"||Q.type==="newline"):[];for(let Q of Object.keys(D))if(Q!=="type"&&Q!=="offset")delete D[Q];Object.assign(D,{type:F,indent:B,source:$,end:q})}}}yU.createScalarToken=vU;yU.resolveAsScalar=PU;yU.setScalarValue=fU});var DB=L((lU)=>{var xU=(D)=>("type"in D)?O1(D):E1(D);function O1(D){switch(D.type){case"block-scalar":{let $="";for(let F of D.props)$+=O1(F);return $+D.source}case"block-map":case"block-seq":{let $="";for(let F of D.items)$+=E1(F);return $}case"flow-collection":{let $=D.start.source;for(let F of D.items)$+=E1(F);for(let F of D.end)$+=F.source;return $}case"document":{let $=E1(D);if(D.end)for(let F of D.end)$+=F.source;return $}default:{let $=D.source;if("end"in D&&D.end)for(let F of D.end)$+=F.source;return $}}}function E1({start:D,key:$,sep:F,value:B}){let q="";for(let Q of D)q+=Q.source;if($)q+=O1($);if(F)for(let Q of F)q+=Q.source;if(B)q+=O1(B);return q}lU.stringify=xU});var BB=L((cU)=>{var F7=Symbol("break visit"),pU=Symbol("skip children"),$B=Symbol("remove item");function F2(D,$){if("type"in D&&D.type==="document")D={start:D.start,value:D.value};FB(Object.freeze([]),D,$)}F2.BREAK=F7;F2.SKIP=pU;F2.REMOVE=$B;F2.itemAtPath=(D,$)=>{let F=D;for(let[B,q]of $){let Q=F?.[B];if(Q&&"items"in Q)F=Q.items[q];else return}return F};F2.parentCollection=(D,$)=>{let F=F2.itemAtPath(D,$.slice(0,-1)),B=$[$.length-1][0],q=F?.[B];if(q&&"items"in q)return q;throw Error("Parent collection not found")};function FB(D,$,F){let B=F($,D);if(typeof B==="symbol")return B;for(let q of["key","value"]){let Q=$[q];if(Q&&"items"in Q){for(let X=0;X<Q.items.length;++X){let J=FB(Object.freeze(D.concat([[q,X]])),Q.items[X],F);if(typeof J==="number")X=J-1;else if(J===F7)return F7;else if(J===$B)Q.items.splice(X,1),X-=1}if(typeof B==="function"&&q==="key")B=B($,D)}}return typeof B==="function"?B($,D):B}cU.visit=F2});var j1=L((eU)=>{var B7=eF(),nU=DB(),rU=BB(),q7="\uFEFF",X7="\x02",Q7="\x18",J7="\x1F",aU=(D)=>!!D&&("items"in D),sU=(D)=>!!D&&(D.type==="scalar"||D.type==="single-quoted-scalar"||D.type==="double-quoted-scalar"||D.type==="block-scalar");function oU(D){switch(D){case q7:return"<BOM>";case X7:return"<DOC>";case Q7:return"<FLOW_END>";case J7:return"<SCALAR>";default:return JSON.stringify(D)}}function tU(D){switch(D){case q7:return"byte-order-mark";case X7:return"doc-mode";case Q7:return"flow-error-end";case J7:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
172
- `:case`\r
173
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(D[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}eU.createScalarToken=B7.createScalarToken;eU.resolveAsScalar=B7.resolveAsScalar;eU.setScalarValue=B7.setScalarValue;eU.stringify=nU.stringify;eU.visit=rU.visit;eU.BOM=q7;eU.DOCUMENT=X7;eU.FLOW_END=Q7;eU.SCALAR=J7;eU.isCollection=aU;eU.isScalar=sU;eU.prettyToken=oU;eU.tokenType=tU});var H7=L((uz)=>{var n3=j1();function iD(D){switch(D){case void 0:case" ":case`
174
- `:case"\r":case"\t":return!0;default:return!1}}var qB=new Set("0123456789ABCDEFabcdef"),Vz=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),R1=new Set(",[]{}"),Wz=new Set(` ,[]{}
175
- \r `),Y7=(D)=>!D||Wz.has(D);class XB{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(D,$=!1){if(D){if(typeof D!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+D:D,this.lineEndPos=null}this.atEnd=!$;let F=this.next??"stream";while(F&&($||this.hasChars(1)))F=yield*this.parseNext(F)}atLineEnd(){let D=this.pos,$=this.buffer[D];while($===" "||$==="\t")$=this.buffer[++D];if(!$||$==="#"||$===`
176
- `)return!0;if($==="\r")return this.buffer[D+1]===`
177
- `;return!1}charAt(D){return this.buffer[this.pos+D]}continueScalar(D){let $=this.buffer[D];if(this.indentNext>0){let F=0;while($===" ")$=this.buffer[++F+D];if($==="\r"){let B=this.buffer[F+D+1];if(B===`
178
- `||!B&&!this.atEnd)return D+F+1}return $===`
179
- `||F>=this.indentNext||!$&&!this.atEnd?D+F:-1}if($==="-"||$==="."){let F=this.buffer.substr(D,3);if((F==="---"||F==="...")&&iD(this.buffer[D+3]))return-1}return D}getLine(){let D=this.lineEndPos;if(typeof D!=="number"||D!==-1&&D<this.pos)D=this.buffer.indexOf(`
180
- `,this.pos),this.lineEndPos=D;if(D===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[D-1]==="\r")D-=1;return this.buffer.substring(this.pos,D)}hasChars(D){return this.pos+D<=this.buffer.length}setNext(D){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=D,null}peek(D){return this.buffer.substr(this.pos,D)}*parseNext(D){switch(D){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let D=this.getLine();if(D===null)return this.setNext("stream");if(D[0]===n3.BOM)yield*this.pushCount(1),D=D.substring(1);if(D[0]==="%"){let $=D.length,F=D.indexOf("#");while(F!==-1){let q=D[F-1];if(q===" "||q==="\t"){$=F-1;break}else F=D.indexOf("#",F+1)}while(!0){let q=D[$-1];if(q===" "||q==="\t")$-=1;else break}let B=(yield*this.pushCount($))+(yield*this.pushSpaces(!0));return yield*this.pushCount(D.length-B),this.pushNewline(),"stream"}if(this.atLineEnd()){let $=yield*this.pushSpaces(!0);return yield*this.pushCount(D.length-$),yield*this.pushNewline(),"stream"}return yield n3.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let D=this.charAt(0);if(!D&&!this.atEnd)return this.setNext("line-start");if(D==="-"||D==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let $=this.peek(3);if(($==="---"||$==="...")&&iD(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,$==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!iD(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[D,$]=this.peek(2);if(!$&&!this.atEnd)return this.setNext("block-start");if((D==="-"||D==="?"||D===":")&&iD($)){let F=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=F,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let D=this.getLine();if(D===null)return this.setNext("doc");let $=yield*this.pushIndicators();switch(D[$]){case"#":yield*this.pushCount(D.length-$);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Y7),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return $+=yield*this.parseBlockScalarHeader(),$+=yield*this.pushSpaces(!0),yield*this.pushCount(D.length-$),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let D,$,F=-1;do{if(D=yield*this.pushNewline(),D>0)$=yield*this.pushSpaces(!1),this.indentValue=F=$;else $=0;$+=yield*this.pushSpaces(!0)}while(D+$>0);let B=this.getLine();if(B===null)return this.setNext("flow");if(F!==-1&&F<this.indentNext&&B[0]!=="#"||F===0&&(B.startsWith("---")||B.startsWith("..."))&&iD(B[3])){if(!(F===this.indentNext-1&&this.flowLevel===1&&(B[0]==="]"||B[0]==="}")))return this.flowLevel=0,yield n3.FLOW_END,yield*this.parseLineStart()}let q=0;while(B[q]===",")q+=yield*this.pushCount(1),q+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(q+=yield*this.pushIndicators(),B[q]){case void 0:return"flow";case"#":return yield*this.pushCount(B.length-q),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Y7),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let Q=this.charAt(1);if(this.flowKey||iD(Q)||Q===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let D=this.charAt(0),$=this.buffer.indexOf(D,this.pos+1);if(D==="'")while($!==-1&&this.buffer[$+1]==="'")$=this.buffer.indexOf("'",$+2);else while($!==-1){let q=0;while(this.buffer[$-1-q]==="\\")q+=1;if(q%2===0)break;$=this.buffer.indexOf('"',$+1)}let F=this.buffer.substring(0,$),B=F.indexOf(`
181
- `,this.pos);if(B!==-1){while(B!==-1){let q=this.continueScalar(B+1);if(q===-1)break;B=F.indexOf(`
182
- `,q)}if(B!==-1)$=B-(F[B-1]==="\r"?2:1)}if($===-1){if(!this.atEnd)return this.setNext("quoted-scalar");$=this.buffer.length}return yield*this.pushToIndex($+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let D=this.pos;while(!0){let $=this.buffer[++D];if($==="+")this.blockScalarKeep=!0;else if($>"0"&&$<="9")this.blockScalarIndent=Number($)-1;else if($!=="-")break}return yield*this.pushUntil(($)=>iD($)||$==="#")}*parseBlockScalar(){let D=this.pos-1,$=0,F;D:for(let q=this.pos;F=this.buffer[q];++q)switch(F){case" ":$+=1;break;case`
183
- `:D=q,$=0;break;case"\r":{let Q=this.buffer[q+1];if(!Q&&!this.atEnd)return this.setNext("block-scalar");if(Q===`
184
- `)break}default:break D}if(!F&&!this.atEnd)return this.setNext("block-scalar");if($>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=$;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let q=this.continueScalar(D+1);if(q===-1)break;D=this.buffer.indexOf(`
185
- `,q)}while(D!==-1);if(D===-1){if(!this.atEnd)return this.setNext("block-scalar");D=this.buffer.length}}let B=D+1;F=this.buffer[B];while(F===" ")F=this.buffer[++B];if(F==="\t"){while(F==="\t"||F===" "||F==="\r"||F===`
186
- `)F=this.buffer[++B];D=B-1}else if(!this.blockScalarKeep)do{let q=D-1,Q=this.buffer[q];if(Q==="\r")Q=this.buffer[--q];let X=q;while(Q===" ")Q=this.buffer[--q];if(Q===`
187
- `&&q>=this.pos&&q+1+$>X)D=q;else break}while(!0);return yield n3.SCALAR,yield*this.pushToIndex(D+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let D=this.flowLevel>0,$=this.pos-1,F=this.pos-1,B;while(B=this.buffer[++F])if(B===":"){let q=this.buffer[F+1];if(iD(q)||D&&R1.has(q))break;$=F}else if(iD(B)){let q=this.buffer[F+1];if(B==="\r")if(q===`
188
- `)F+=1,B=`
189
- `,q=this.buffer[F+1];else $=F;if(q==="#"||D&&R1.has(q))break;if(B===`
190
- `){let Q=this.continueScalar(F+1);if(Q===-1)break;F=Math.max(F,Q-2)}}else{if(D&&R1.has(B))break;$=F}if(!B&&!this.atEnd)return this.setNext("plain-scalar");return yield n3.SCALAR,yield*this.pushToIndex($+1,!0),D?"flow":"doc"}*pushCount(D){if(D>0)return yield this.buffer.substr(this.pos,D),this.pos+=D,D;return 0}*pushToIndex(D,$){let F=this.buffer.slice(this.pos,D);if(F)return yield F,this.pos+=F.length,F.length;else if($)yield"";return 0}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Y7))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let D=this.flowLevel>0,$=this.charAt(1);if(iD($)||D&&R1.has($)){if(!D)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;return(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}}return 0}*pushTag(){if(this.charAt(1)==="<"){let D=this.pos+2,$=this.buffer[D];while(!iD($)&&$!==">")$=this.buffer[++D];return yield*this.pushToIndex($===">"?D+1:D,!1)}else{let D=this.pos+1,$=this.buffer[D];while($)if(Vz.has($))$=this.buffer[++D];else if($==="%"&&qB.has(this.buffer[D+1])&&qB.has(this.buffer[D+2]))$=this.buffer[D+=3];else break;return yield*this.pushToIndex(D,!1)}}*pushNewline(){let D=this.buffer[this.pos];if(D===`
191
- `)return yield*this.pushCount(1);else if(D==="\r"&&this.charAt(1)===`
192
- `)return yield*this.pushCount(2);else return 0}*pushSpaces(D){let $=this.pos-1,F;do F=this.buffer[++$];while(F===" "||D&&F==="\t");let B=$-this.pos;if(B>0)yield this.buffer.substr(this.pos,B),this.pos=$;return B}*pushUntil(D){let $=this.pos,F=this.buffer[$];while(!D(F))F=this.buffer[++$];return yield*this.pushToIndex($,!1)}}uz.Lexer=XB});var C7=L((Uz)=>{class QB{constructor(){this.lineStarts=[],this.addNewLine=(D)=>this.lineStarts.push(D),this.linePos=(D)=>{let $=0,F=this.lineStarts.length;while($<F){let q=$+F>>1;if(this.lineStarts[q]<D)$=q+1;else F=q}if(this.lineStarts[$]===D)return{line:$+1,col:1};if($===0)return{line:0,col:D};let B=this.lineStarts[$-1];return{line:$,col:D-B+1}}}}Uz.LineCounter=QB});var _7=L((Kz)=>{var wz=c2("process"),JB=j1(),Mz=H7();function S0(D,$){for(let F=0;F<D.length;++F)if(D[F].type===$)return!0;return!1}function YB(D){for(let $=0;$<D.length;++$)switch(D[$].type){case"space":case"comment":case"newline":break;default:return $}return-1}function CB(D){switch(D?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function N1(D){switch(D.type){case"document":return D.start;case"block-map":{let $=D.items[D.items.length-1];return $.sep??$.start}case"block-seq":return D.items[D.items.length-1].start;default:return[]}}function h2(D){if(D.length===0)return[];let $=D.length;D:while(--$>=0)switch(D[$].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break D}while(D[++$]?.type==="space");return D.splice($,D.length)}function HB(D){if(D.start.type==="flow-seq-start"){for(let $ of D.items)if($.sep&&!$.value&&!S0($.start,"explicit-key-ind")&&!S0($.sep,"map-value-ind")){if($.key)$.value=$.key;if(delete $.key,CB($.value))if($.value.end)Array.prototype.push.apply($.value.end,$.sep);else $.value.end=$.sep;else Array.prototype.push.apply($.start,$.sep);delete $.sep}}}class _B{constructor(D){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Mz.Lexer,this.onNewLine=D}*parse(D,$=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let F of this.lexer.lex(D,$))yield*this.next(F);if(!$)yield*this.end()}*next(D){if(this.source=D,wz.env.LOG_TOKENS)console.log("|",JB.prettyToken(D));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=D.length;return}let $=JB.tokenType(D);if(!$){let F=`Not a YAML token: ${D}`;yield*this.pop({type:"error",offset:this.offset,message:F,source:D}),this.offset+=D.length}else if($==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=$,yield*this.step(),$){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+D.length);break;case"space":if(this.atNewLine&&D[0]===" ")this.indent+=D.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=D.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=D.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let D=this.peek(1);if(this.type==="doc-end"&&D?.type!=="doc-end"){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!D)return yield*this.stream();switch(D.type){case"document":return yield*this.document(D);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(D);case"block-scalar":return yield*this.blockScalar(D);case"block-map":return yield*this.blockMap(D);case"block-seq":return yield*this.blockSequence(D);case"flow-collection":return yield*this.flowCollection(D);case"doc-end":return yield*this.documentEnd(D)}yield*this.pop()}peek(D){return this.stack[this.stack.length-D]}*pop(D){let $=D??this.stack.pop();if(!$)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield $;else{let F=this.peek(1);if($.type==="block-scalar")$.indent="indent"in F?F.indent:0;else if($.type==="flow-collection"&&F.type==="document")$.indent=0;if($.type==="flow-collection")HB($);switch(F.type){case"document":F.value=$;break;case"block-scalar":F.props.push($);break;case"block-map":{let B=F.items[F.items.length-1];if(B.value){F.items.push({start:[],key:$,sep:[]}),this.onKeyLine=!0;return}else if(B.sep)B.value=$;else{Object.assign(B,{key:$,sep:[]}),this.onKeyLine=!B.explicitKey;return}break}case"block-seq":{let B=F.items[F.items.length-1];if(B.value)F.items.push({start:[],value:$});else B.value=$;break}case"flow-collection":{let B=F.items[F.items.length-1];if(!B||B.value)F.items.push({start:[],key:$,sep:[]});else if(B.sep)B.value=$;else Object.assign(B,{key:$,sep:[]});return}default:yield*this.pop(),yield*this.pop($)}if((F.type==="document"||F.type==="block-map"||F.type==="block-seq")&&($.type==="block-map"||$.type==="block-seq")){let B=$.items[$.items.length-1];if(B&&!B.sep&&!B.value&&B.start.length>0&&YB(B.start)===-1&&($.indent===0||B.start.every((q)=>q.type!=="comment"||q.indent<$.indent))){if(F.type==="document")F.end=B.start;else F.items.push({start:B.start});$.items.splice(-1,1)}}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let D={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")D.start.push(this.sourceToken);this.stack.push(D);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(D){if(D.value)return yield*this.lineEnd(D);switch(this.type){case"doc-start":{if(YB(D.start)!==-1)yield*this.pop(),yield*this.step();else D.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":D.start.push(this.sourceToken);return}let $=this.startBlockValue(D);if($)this.stack.push($);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(D){if(this.type==="map-value-ind"){let $=N1(this.peek(2)),F=h2($),B;if(D.end)B=D.end,B.push(this.sourceToken),delete D.end;else B=[this.sourceToken];let q={type:"block-map",offset:D.offset,indent:D.indent,items:[{start:F,key:D,sep:B}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=q}else yield*this.lineEnd(D)}*blockScalar(D){switch(this.type){case"space":case"comment":case"newline":D.props.push(this.sourceToken);return;case"scalar":if(D.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let $=this.source.indexOf(`
193
- `)+1;while($!==0)this.onNewLine(this.offset+$),$=this.source.indexOf(`
194
- `,$)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(D){let $=D.items[D.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,$.value){let F="end"in $.value?$.value.end:void 0;if((Array.isArray(F)?F[F.length-1]:void 0)?.type==="comment")F?.push(this.sourceToken);else D.items.push({start:[this.sourceToken]})}else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"space":case"comment":if($.value)D.items.push({start:[this.sourceToken]});else if($.sep)$.sep.push(this.sourceToken);else{if(this.atIndentedComment($.start,D.indent)){let B=D.items[D.items.length-2]?.value?.end;if(Array.isArray(B)){Array.prototype.push.apply(B,$.start),B.push(this.sourceToken),D.items.pop();return}}$.start.push(this.sourceToken)}return}if(this.indent>=D.indent){let F=!this.onKeyLine&&this.indent===D.indent,B=F&&($.sep||$.explicitKey)&&this.type!=="seq-item-ind",q=[];if(B&&$.sep&&!$.value){let Q=[];for(let X=0;X<$.sep.length;++X){let J=$.sep[X];switch(J.type){case"newline":Q.push(X);break;case"space":break;case"comment":if(J.indent>D.indent)Q.length=0;break;default:Q.length=0}}if(Q.length>=2)q=$.sep.splice(Q[1])}switch(this.type){case"anchor":case"tag":if(B||$.value)q.push(this.sourceToken),D.items.push({start:q}),this.onKeyLine=!0;else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"explicit-key-ind":if(!$.sep&&!$.explicitKey)$.start.push(this.sourceToken),$.explicitKey=!0;else if(B||$.value)q.push(this.sourceToken),D.items.push({start:q,explicitKey:!0});else 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($.explicitKey)if(!$.sep)if(S0($.start,"newline"))Object.assign($,{key:null,sep:[this.sourceToken]});else{let Q=h2($.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:null,sep:[this.sourceToken]}]})}else if($.value)D.items.push({start:[],key:null,sep:[this.sourceToken]});else if(S0($.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:q,key:null,sep:[this.sourceToken]}]});else if(CB($.key)&&!S0($.sep,"newline")){let Q=h2($.start),X=$.key,J=$.sep;J.push(this.sourceToken),delete $.key,delete $.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Q,key:X,sep:J}]})}else if(q.length>0)$.sep=$.sep.concat(q,this.sourceToken);else $.sep.push(this.sourceToken);else if(!$.sep)Object.assign($,{key:null,sep:[this.sourceToken]});else if($.value||B)D.items.push({start:q,key:null,sep:[this.sourceToken]});else if(S0($.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else $.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let Q=this.flowScalar(this.type);if(B||$.value)D.items.push({start:q,key:Q,sep:[]}),this.onKeyLine=!0;else if($.sep)this.stack.push(Q);else Object.assign($,{key:Q,sep:[]}),this.onKeyLine=!0;return}default:{let Q=this.startBlockValue(D);if(Q){if(Q.type==="block-seq"){if(!$.explicitKey&&$.sep&&!S0($.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 if(F)D.items.push({start:q});this.stack.push(Q);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(D){let $=D.items[D.items.length-1];switch(this.type){case"newline":if($.value){let F="end"in $.value?$.value.end:void 0;if((Array.isArray(F)?F[F.length-1]:void 0)?.type==="comment")F?.push(this.sourceToken);else D.items.push({start:[this.sourceToken]})}else $.start.push(this.sourceToken);return;case"space":case"comment":if($.value)D.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment($.start,D.indent)){let B=D.items[D.items.length-2]?.value?.end;if(Array.isArray(B)){Array.prototype.push.apply(B,$.start),B.push(this.sourceToken),D.items.pop();return}}$.start.push(this.sourceToken)}return;case"anchor":case"tag":if($.value||this.indent<=D.indent)break;$.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==D.indent)break;if($.value||S0($.start,"seq-item-ind"))D.items.push({start:[this.sourceToken]});else $.start.push(this.sourceToken);return}if(this.indent>D.indent){let F=this.startBlockValue(D);if(F){this.stack.push(F);return}}yield*this.pop(),yield*this.step()}*flowCollection(D){let $=D.items[D.items.length-1];if(this.type==="flow-error-end"){let F;do yield*this.pop(),F=this.peek(1);while(F?.type==="flow-collection")}else if(D.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!$||$.sep)D.items.push({start:[this.sourceToken]});else $.start.push(this.sourceToken);return;case"map-value-ind":if(!$||$.value)D.items.push({start:[],key:null,sep:[this.sourceToken]});else if($.sep)$.sep.push(this.sourceToken);else Object.assign($,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!$||$.value)D.items.push({start:[this.sourceToken]});else if($.sep)$.sep.push(this.sourceToken);else $.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let B=this.flowScalar(this.type);if(!$||$.value)D.items.push({start:[],key:B,sep:[]});else if($.sep)this.stack.push(B);else Object.assign($,{key:B,sep:[]});return}case"flow-map-end":case"flow-seq-end":D.end.push(this.sourceToken);return}let F=this.startBlockValue(D);if(F)this.stack.push(F);else yield*this.pop(),yield*this.step()}else{let F=this.peek(2);if(F.type==="block-map"&&(this.type==="map-value-ind"&&F.indent===D.indent||this.type==="newline"&&!F.items[F.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&F.type!=="flow-collection"){let B=N1(F),q=h2(B);HB(D);let Q=D.end.splice(1,D.end.length);Q.push(this.sourceToken);let X={type:"block-map",offset:D.offset,indent:D.indent,items:[{start:q,key:D,sep:Q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=X}else yield*this.lineEnd(D)}}flowScalar(D){if(this.onNewLine){let $=this.source.indexOf(`
195
- `)+1;while($!==0)this.onNewLine(this.offset+$),$=this.source.indexOf(`
196
- `,$)+1}return{type:D,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(D){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 $=N1(D),F=h2($);return F.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:F,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let $=N1(D),F=h2($);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:F,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(D,$){if(this.type!=="comment")return!1;if(this.indent<=$)return!1;return D.every((F)=>F.type==="newline"||F.type==="space")}*documentEnd(D){if(this.type!=="doc-mode"){if(D.end)D.end.push(this.sourceToken);else D.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(D){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;case"space":case"comment":default:if(D.end)D.end.push(this.sourceToken);else D.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}Kz.Parser=_B});var AB=L((bz)=>{var GB=D7(),Oz=l3(),r3=d3(),jz=C9(),Rz=d(),Nz=C7(),VB=_7();function WB(D){let $=D.prettyErrors!==!1;return{lineCounter:D.lineCounter||$&&new Nz.LineCounter||null,prettyErrors:$}}function Lz(D,$={}){let{lineCounter:F,prettyErrors:B}=WB($),q=new VB.Parser(F?.addNewLine),Q=new GB.Composer($),X=Array.from(Q.compose(q.parse(D)));if(B&&F)for(let J of X)J.errors.forEach(r3.prettifyError(D,F)),J.warnings.forEach(r3.prettifyError(D,F));if(X.length>0)return X;return Object.assign([],{empty:!0},Q.streamInfo())}function uB(D,$={}){let{lineCounter:F,prettyErrors:B}=WB($),q=new VB.Parser(F?.addNewLine),Q=new GB.Composer($),X=null;for(let J of Q.compose(q.parse(D),!0,D.length))if(!X)X=J;else if(X.options.logLevel!=="silent"){X.errors.push(new r3.YAMLParseError(J.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(B&&F)X.errors.forEach(r3.prettifyError(D,F)),X.warnings.forEach(r3.prettifyError(D,F));return X}function Iz(D,$,F){let B=void 0;if(typeof $==="function")B=$;else if(F===void 0&&$&&typeof $==="object")F=$;let q=uB(D,F);if(!q)return null;if(q.warnings.forEach((Q)=>jz.warn(q.options.logLevel,Q)),q.errors.length>0)if(q.options.logLevel!=="silent")throw q.errors[0];else q.errors=[];return q.toJS(Object.assign({reviver:B},F))}function Zz(D,$,F){let B=null;if(typeof $==="function"||Array.isArray($))B=$;else if(F===void 0&&$)F=$;if(typeof F==="string")F=F.length;if(typeof F==="number"){let q=Math.round(F);F=q<1?void 0:q>8?{indent:8}:{indent:q}}if(D===void 0){let{keepUndefined:q}=F??$??{};if(!q)return}if(Rz.isDocument(D)&&!B)return D.toString(F);return new Oz.Document(D,B,F).toString(F)}bz.parse=Iz;bz.parseAllDocuments=Lz;bz.parseDocument=uB;bz.stringify=Zz});var zB=L((nz)=>{var fz=D7(),kz=l3(),yz=h9(),G7=d3(),hz=L3(),T0=d(),gz=L0(),mz=DD(),xz=Z0(),lz=b0(),dz=j1(),pz=H7(),cz=C7(),iz=_7(),L1=AB(),UB=R3();nz.Composer=fz.Composer;nz.Document=kz.Document;nz.Schema=yz.Schema;nz.YAMLError=G7.YAMLError;nz.YAMLParseError=G7.YAMLParseError;nz.YAMLWarning=G7.YAMLWarning;nz.Alias=hz.Alias;nz.isAlias=T0.isAlias;nz.isCollection=T0.isCollection;nz.isDocument=T0.isDocument;nz.isMap=T0.isMap;nz.isNode=T0.isNode;nz.isPair=T0.isPair;nz.isScalar=T0.isScalar;nz.isSeq=T0.isSeq;nz.Pair=gz.Pair;nz.Scalar=mz.Scalar;nz.YAMLMap=xz.YAMLMap;nz.YAMLSeq=lz.YAMLSeq;nz.CST=dz;nz.Lexer=pz.Lexer;nz.LineCounter=cz.LineCounter;nz.Parser=iz.Parser;nz.parse=L1.parse;nz.parseAllDocuments=L1.parseAllDocuments;nz.parseDocument=L1.parseDocument;nz.stringify=L1.stringify;nz.visit=UB.visit;nz.visitAsync=UB.visitAsync});import{readFile as wB}from"node:fs/promises";import{join as a3,basename as hR,dirname as Ow}from"node:path";import{fileURLToPath as jw}from"node:url";import{homedir as Rw}from"node:os";function s3(D){if(!D||D.trim()==="")return{frontmatter:{},body:""};if(!D.startsWith("---"))return{frontmatter:{},body:D};let $=D.indexOf("---",3);if($===-1)throw Error("Invalid frontmatter: missing closing delimiter ---");let F=D.slice(3,$).trim(),B=D.slice($+3).trim();if(!F)return{frontmatter:{},body:B};let q;try{q=MB.default.parse(F)}catch(Q){throw Error(`Invalid YAML in frontmatter: ${Q instanceof Error?Q.message:String(Q)}`)}return{frontmatter:q,body:B}}function I1(D,$){try{let{frontmatter:F,body:B}=s3(D),q=$(F,B);return q?[q]:[]}catch(F){return V.error("Failed to parse markdown:",F),[]}}async function g2(D,$){try{let F=await wB(D,"utf-8");if(!$)return s3(F);return I1(F,$)}catch(F){if(F instanceof Error)throw Error(`Failed to load markdown file "${D}": ${F.message}`);throw Error(`Failed to load markdown file "${D}": Unknown error`)}}async function KB(D,$,F){try{let B=await L2("**/*.md",{cwd:D});if(B.length===0)return[];let q=[];for(let X of B){let J=a3(D,X);try{let Y=await g2(J,$);q.push(...Y)}catch(Y){V.error(`Error processing file ${X}:`,Y)}}let Q=F?F(q):q;return V.info(`Loaded ${Q.length} items from ${B.length} files in ${D} (recursive)`),Q}catch{return[]}}function Nw(...D){let $=new Map;for(let F of D)for(let B of F)$.set(B.name,B);return Array.from($.values())}function EB(D,$){let F=jw(import.meta.url),B=Ow(F);return{defaults:a3(B,"defaults",D),user:a3(Rw(),".diffray",D),project:a3($,".diffray",D)}}async function OB(D,$,F){let B=EB(D,F),[q,Q,X]=await Promise.all([$(B.defaults),$(B.user),$(B.project)]);return Nw(q,Q,X)}async function V7(D,$){try{let F=await L2("**/*.md",{cwd:D}),B=await Promise.all(F.map(async(Q)=>{let X=a3(D,Q);try{let J=await wB(X,"utf-8");return{filePath:X,content:J}}catch{return null}})),q=[];for(let Q of B){if(!Q)continue;try{let{frontmatter:X}=s3(Q.content),J=X.name,Y=X.description,H=X.agent,C=X.patterns;if(typeof J==="string"&&typeof H==="string"&&Array.isArray(C)&&C.length>0)q.push({name:J,description:typeof Y==="string"?Y:"",path:Q.filePath,patterns:C.filter((_)=>typeof _==="string"),agent:H,source:$})}catch{}}return q}catch{return[]}}async function jB(D){let $=EB("rules",D),[F,B,q]=await Promise.all([V7($.defaults,"defaults"),V7($.user,"user"),V7($.project,"project")]),Q=new Map;for(let X of[...F,...B,...q])Q.set(X.name,X);return Array.from(Q.values())}var MB;var Z1=FD(()=>{s();$9();MB=I7(zB(),1)});var bB={};D8(bB,{parseSingleRule:()=>bw,parseRuleMarkdown:()=>NB,matchRules:()=>Tw,matchRuleRefs:()=>ZB,matchPattern:()=>m2,matchAndLoadRules:()=>A7,loadRulesFromRefs:()=>LB,loadRulesFromDirectoryRecursive:()=>Zw,loadRules:()=>Sw,loadRuleRefs:()=>P0,loadRuleMarkdown:()=>Iw,loadRuleFromRef:()=>u7,expandBraces:()=>U7});import{readFile as Lw}from"node:fs/promises";function W7(D,$){let{name:F,agent:B,patterns:q}=D,Q=$.trim();if(typeof F!=="string"||typeof B!=="string")return null;if(!Array.isArray(q)||q.length===0)return null;if(!Q)return null;return{name:F,description:typeof D.description==="string"?D.description:"",patterns:q.filter((J)=>typeof J==="string"),agent:B,prompt:Q}}function NB(D){return I1(D,W7)}async function Iw(D){try{return await g2(D,W7)}catch($){return V.error(`Error loading rule markdown from ${D}:`,$),[]}}async function Zw(D){return KB(D,W7)}function bw(D){let $=NB(D);return $.length>0?$[0]??null:null}async function P0(D){let $=D||process.cwd();return jB($)}async function u7(D){try{let $=await Lw(D.path,"utf-8"),{body:F}=s3($);return{name:D.name,description:D.description,patterns:D.patterns,agent:D.agent,prompt:F.trim(),source:D.source,path:D.path}}catch($){return V.error(`Failed to load rule from ${D.path}:`,$),null}}async function LB(D){return(await Promise.all(D.map(u7))).filter((F)=>F!==null)}async function Sw(D){let $=await P0(D);return LB($)}function IB(D,$,F){let B=new Map(F.map((Q)=>[Q.name,Q])),q=[];for(let Q of D){let X=B.get(Q.agent);if(!X){V.warn(`Rule references unknown agent "${Q.agent}"`);continue}let J=$.filter((Y)=>Q.patterns.some((H)=>m2(Y.file,H))).map((Y)=>Y.file);if(J.length===0)continue;q.push({item:Q,files:J,agent:X})}return q}function ZB(D,$,F){return IB(D,$,F).map(({item:B,...q})=>({ref:B,...q}))}async function A7(D,$,F){let B=ZB(D,$,F);return(await Promise.all(B.map(async({ref:Q,files:X,agent:J})=>{let Y=await u7(Q);return Y?{rule:Y,files:X,agent:J}:null}))).filter((Q)=>Q!==null)}function Tw(D,$,F){return IB(D,$,F).map(({item:B,...q})=>({rule:B,...q}))}function U7(D){let $=D.match(Pw);if(!$||$.index===void 0||!$[1])return[D];let F=$[1].split(",").map((X)=>X.trim()),B=D.substring(0,$.index),q=D.substring($.index+$[0].length),Q=[];for(let X of F){let J=B+X+q;Q.push(...U7(J))}return Q}function m2(D,$){return U7($).some((B)=>vw(D,B))}function vw(D,$){let F=$.replace(/\*\*/g,"\x00DOUBLESTAR\x00").replace(/\*/g,"\x00STAR\x00").replace(/\?/g,"\x00QUESTION\x00");F=F.replace(/[.+^${}()|[\]\\]/g,"\\$&"),F=F.replace(/\x00DOUBLESTAR\x00\//g,"(?:.*\\/)?").replace(/\x00DOUBLESTAR\x00/g,".*").replace(/\x00STAR\x00/g,"[^/]*").replace(/\x00QUESTION\x00/g,".");let B=RB.get(F);if(!B)B=new RegExp(`^${F}$`),RB.set(F,B);return B.test(D)}var Pw,RB;var x2=FD(()=>{Z1();s();Pw=/\{([^}]+)\}/;RB=new Map});var YD={silent:Number.NEGATIVE_INFINITY,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:Number.POSITIVE_INFINITY},n1={silent:{level:-1},fatal:{level:YD.fatal},error:{level:YD.error},warn:{level:YD.warn},log:{level:YD.log},info:{level:YD.info},success:{level:YD.success},fail:{level:YD.fail},ready:{level:YD.info},start:{level:YD.info},box:{level:YD.info},debug:{level:YD.debug},trace:{level:YD.trace},verbose:{level:YD.verbose}};function p1(D){if(D===null||typeof D!=="object")return!1;let $=Object.getPrototypeOf(D);if($!==null&&$!==Object.prototype&&Object.getPrototypeOf($)!==null)return!1;if(Symbol.iterator in D)return!1;if(Symbol.toStringTag in D)return Object.prototype.toString.call(D)==="[object Module]";return!0}function r1(D,$,F=".",B){if(!p1($))return r1(D,{},F,B);let q=Object.assign({},$);for(let Q in D){if(Q==="__proto__"||Q==="constructor")continue;let X=D[Q];if(X===null||X===void 0)continue;if(B&&B(q,Q,X,F))continue;if(Array.isArray(X)&&Array.isArray(q[Q]))q[Q]=[...X,...q[Q]];else if(p1(X)&&p1(q[Q]))q[Q]=r1(X,q[Q],(F?`${F}.`:"")+Q.toString(),B);else q[Q]=X}return q}function $X(D){return(...$)=>$.reduce((F,B)=>r1(F,B,"",D),{})}var FX=$X();function BX(D){return Object.prototype.toString.call(D)==="[object Object]"}function qX(D){if(!BX(D))return!1;if(!D.message&&!D.args)return!1;if(D.stack)return!1;return!0}var c1=!1,Z7=[];class BD{options;_lastLog;_mockFn;constructor(D={}){let $=D.types||n1;this.options=FX({...D,defaults:{...D.defaults},level:i1(D.level,$),reporters:[...D.reporters||[]]},{types:n1,throttle:1000,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}});for(let F in $){let B={type:F,...this.options.defaults,...$[F]};this[F]=this._wrapLogFn(B),this[F].raw=this._wrapLogFn(B,!0)}if(this.options.mockFn)this.mockTypes();this._lastLog={}}get level(){return this.options.level}set level(D){this.options.level=i1(D,this.options.types,this.options.level)}prompt(D,$){if(!this.options.prompt)throw Error("prompt is not supported!");return this.options.prompt(D,$)}create(D){let $=new BD({...this.options,...D});if(this._mockFn)$.mockTypes(this._mockFn);return $}withDefaults(D){return this.create({...this.options,defaults:{...this.options.defaults,...D}})}withTag(D){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+":"+D:D})}addReporter(D){return this.options.reporters.push(D),this}removeReporter(D){if(D){let $=this.options.reporters.indexOf(D);if($!==-1)return this.options.reporters.splice($,1)}else this.options.reporters.splice(0);return this}setReporters(D){return this.options.reporters=Array.isArray(D)?D:[D],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let D in this.options.types){if(!console["__"+D])console["__"+D]=console[D];console[D]=this[D].raw}}restoreConsole(){for(let D in this.options.types)if(console["__"+D])console[D]=console["__"+D],delete console["__"+D]}wrapStd(){this._wrapStream(this.options.stdout,"log"),this._wrapStream(this.options.stderr,"log")}_wrapStream(D,$){if(!D)return;if(!D.__write)D.__write=D.write;D.write=(F)=>{this[$].raw(String(F).trim())}}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(D){if(!D)return;if(D.__write)D.write=D.__write,delete D.__write}pauseLogs(){c1=!0}resumeLogs(){c1=!1;let D=Z7.splice(0);for(let $ of D)$[0]._logFn($[1],$[2])}mockTypes(D){let $=D||this.options.mockFn;if(this._mockFn=$,typeof $!=="function")return;for(let F in this.options.types)this[F]=$(F,this.options.types[F])||this[F],this[F].raw=this[F]}_wrapLogFn(D,$){return(...F)=>{if(c1){Z7.push([this,D,F,$]);return}return this._logFn(D,F,$)}}_logFn(D,$,F){if((D.level||0)>this.level)return!1;let B={date:new Date,args:[],...D,level:i1(D.level,this.options.types)};if(!F&&$.length===1&&qX($[0]))Object.assign(B,$[0]);else B.args=[...$];if(B.message)B.args.unshift(B.message),delete B.message;if(B.additional){if(!Array.isArray(B.additional))B.additional=B.additional.split(`
197
- `);B.args.push(`
198
- `+B.additional.join(`
199
- `)),delete B.additional}B.type=typeof B.type==="string"?B.type.toLowerCase():"log",B.tag=typeof B.tag==="string"?B.tag:"";let q=(X=!1)=>{let J=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&J>0){let Y=[...this._lastLog.object.args];if(J>1)Y.push(`(repeated ${J} times)`);this._log({...this._lastLog.object,args:Y}),this._lastLog.count=1}if(X)this._lastLog.object=B,this._log(B)};clearTimeout(this._lastLog.timeout);let Q=this._lastLog.time&&B.date?B.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=B.date,Q<this.options.throttle)try{let X=JSON.stringify([B.type,B.tag,B.args]),J=this._lastLog.serialized===X;if(this._lastLog.serialized=X,J){if(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin){this._lastLog.timeout=setTimeout(q,this.options.throttle);return}}}catch{}q(!0)}_log(D){for(let $ of this.options.reporters)$.log(D,{options:this.options})}}function i1(D,$={},F=3){if(D===void 0)return F;if(typeof D==="number")return D;if($[D]&&$[D].level!==void 0)return $[D].level;return F}BD.prototype.add=BD.prototype.addReporter;BD.prototype.remove=BD.prototype.removeReporter;BD.prototype.clear=BD.prototype.removeReporter;BD.prototype.withScope=BD.prototype.withTag;BD.prototype.mock=BD.prototype.mockTypes;BD.prototype.pause=BD.prototype.pauseLogs;BD.prototype.resume=BD.prototype.resumeLogs;function b7(D={}){return new BD(D)}import{formatWithOptions as S7}from"node:util";import{sep as XX}from"node:path";function s1(D,$){let F=process.cwd()+XX;return D.split(`
200
- `).splice($.split(`
201
- `).length).map((q)=>q.trim().replace("file://","").replace(F,""))}function QX(D,$){return($.__write||$.write).call($,D)}var a1=(D)=>D?`[${D}]`:"";class $8{formatStack(D,$,F){let B=" ".repeat((F?.errorLevel||0)+1);return B+s1(D,$).join(`
202
- ${B}`)}formatError(D,$){let F=D.message??S7($,D),B=D.stack?this.formatStack(D.stack,F,$):"",q=$?.errorLevel||0,Q=q>0?`${" ".repeat(q)}[cause]: `:"",X=D.cause?`
203
-
204
- `+this.formatError(D.cause,{...$,errorLevel:q+1}):"";return Q+F+`
205
- `+B+X}formatArgs(D,$){let F=D.map((B)=>{if(B&&typeof B.stack==="string")return this.formatError(B,$);return B});return S7($,...F)}formatDate(D,$){return $.date?D.toLocaleTimeString():""}filterAndJoin(D){return D.filter(Boolean).join(" ")}formatLogObj(D,$){let F=this.formatArgs(D.args,$);if(D.type==="box")return`
206
- `+[a1(D.tag),D.title&&D.title,...F.split(`
207
- `)].filter(Boolean).map((B)=>" > "+B).join(`
208
- `)+`
209
- `;return this.filterAndJoin([a1(D.type),a1(D.tag),F])}log(D,$){let F=this.formatLogObj(D,{columns:$.options.stdout.columns||0,...$.options.formatOptions});return QX(F+`
210
- `,D.level<2?$.options.stderr||process.stderr:$.options.stdout||process.stdout)}}import C4 from"node:process";import*as F8 from"node:tty";var{env:W0={},argv:v7=[],platform:JX=""}=typeof process>"u"?{}:process,YX="NO_COLOR"in W0||v7.includes("--no-color"),HX="FORCE_COLOR"in W0||v7.includes("--color"),CX=JX==="win32",f7=W0.TERM==="dumb",_X=F8&&F8.isatty&&F8.isatty(1)&&W0.TERM&&!f7,GX="CI"in W0&&(("GITHUB_ACTIONS"in W0)||("GITLAB_CI"in W0)||("CIRCLECI"in W0)),VX=!YX&&(HX||CX&&!f7||_X||GX);function k7(D,$,F,B,q=$.slice(0,Math.max(0,D))+B,Q=$.slice(Math.max(0,D+F.length)),X=Q.indexOf(F)){return q+(X<0?Q:k7(X,Q,F,B))}function WX(D,$,F,B,q){return D<0?F+$+B:F+k7(D,$,B,q)+B}function uX(D,$,F=D,B=D.length+1){return(q)=>q||!(q===""||q===void 0)?WX((""+q).indexOf($,B),q,D,$,F):""}function h(D,$,F){return uX(`\x1B[${D}m`,`\x1B[${$}m`,F)}var T7={reset:h(0,0),bold:h(1,22,"\x1B[22m\x1B[1m"),dim:h(2,22,"\x1B[22m\x1B[2m"),italic:h(3,23),underline:h(4,24),inverse:h(7,27),hidden:h(8,28),strikethrough:h(9,29),black:h(30,39),red:h(31,39),green:h(32,39),yellow:h(33,39),blue:h(34,39),magenta:h(35,39),cyan:h(36,39),white:h(37,39),gray:h(90,39),bgBlack:h(40,49),bgRed:h(41,49),bgGreen:h(42,49),bgYellow:h(43,49),bgBlue:h(44,49),bgMagenta:h(45,49),bgCyan:h(46,49),bgWhite:h(47,49),blackBright:h(90,39),redBright:h(91,39),greenBright:h(92,39),yellowBright:h(93,39),blueBright:h(94,39),magentaBright:h(95,39),cyanBright:h(96,39),whiteBright:h(97,39),bgBlackBright:h(100,49),bgRedBright:h(101,49),bgGreenBright:h(102,49),bgYellowBright:h(103,49),bgBlueBright:h(104,49),bgMagentaBright:h(105,49),bgCyanBright:h(106,49),bgWhiteBright:h(107,49)};function AX(D=VX){return D?T7:Object.fromEntries(Object.keys(T7).map(($)=>[$,String]))}var c=AX();function y7(D,$="reset"){return c[D]||c[$]}var UX=[String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`].join("|");function q0(D){return D.replace(new RegExp(UX,"g"),"")}var P7={solid:{tl:"┌",tr:"┐",bl:"└",br:"┘",h:"─",v:"│"},double:{tl:"╔",tr:"╗",bl:"╚",br:"╝",h:"═",v:"║"},doubleSingle:{tl:"╓",tr:"╖",bl:"╙",br:"╜",h:"─",v:"║"},doubleSingleRounded:{tl:"╭",tr:"╮",bl:"╰",br:"╯",h:"─",v:"║"},singleThick:{tl:"┏",tr:"┓",bl:"┗",br:"┛",h:"━",v:"┃"},singleDouble:{tl:"╒",tr:"╕",bl:"╘",br:"╛",h:"═",v:"│"},singleDoubleRounded:{tl:"╭",tr:"╮",bl:"╰",br:"╯",h:"═",v:"│"},rounded:{tl:"╭",tr:"╮",bl:"╰",br:"╯",h:"─",v:"│"}},zX={borderColor:"white",borderStyle:"rounded",valign:"center",padding:2,marginLeft:1,marginTop:1,marginBottom:1};function o1(D,$={}){let F={...$,style:{...zX,...$.style}},B=D.split(`
211
- `),q=[],Q=y7(F.style.borderColor),X={...typeof F.style.borderStyle==="string"?P7[F.style.borderStyle]||P7.solid:F.style.borderStyle};if(Q)for(let u in X)X[u]=Q(X[u]);let J=F.style.padding%2===0?F.style.padding:F.style.padding+1,Y=B.length+J,H=Math.max(...B.map((u)=>q0(u).length),F.title?q0(F.title).length:0)+J,C=H+J,_=F.style.marginLeft>0?" ".repeat(F.style.marginLeft):"";if(F.style.marginTop>0)q.push("".repeat(F.style.marginTop));if(F.title){let u=Q?Q(F.title):F.title,U=X.h.repeat(Math.floor((H-q0(F.title).length)/2)),W=X.h.repeat(H-q0(F.title).length-q0(U).length+J);q.push(`${_}${X.tl}${U}${u}${W}${X.tr}`)}else q.push(`${_}${X.tl}${X.h.repeat(C)}${X.tr}`);let G=F.style.valign==="center"?Math.floor((Y-B.length)/2):F.style.valign==="top"?Y-B.length-J:Y-B.length;for(let u=0;u<Y;u++)if(u<G||u>=G+B.length)q.push(`${_}${X.v}${" ".repeat(C)}${X.v}`);else{let U=B[u-G],W=" ".repeat(J),A=" ".repeat(H-q0(U).length);q.push(`${_}${X.v}${W}${U}${A}${X.v}`)}if(q.push(`${_}${X.bl}${X.h.repeat(C)}${X.br}`),F.style.marginBottom>0)q.push("".repeat(F.style.marginBottom));return q.join(`
212
- `)}var H8=Object.create(null),r2=(D)=>globalThis.process?.env||import.meta.env||globalThis.Deno?.env.toObject()||globalThis.__env__||(D?H8:globalThis),u0=new Proxy(H8,{get(D,$){return r2()[$]??H8[$]},has(D,$){let F=r2();return $ in F||$ in H8},set(D,$,F){let B=r2(!0);return B[$]=F,!0},deleteProperty(D,$){if(!$)return!1;let F=r2(!0);return delete F[$],!0},ownKeys(){let D=r2(!0);return Object.keys(D)}}),YQ=typeof process<"u"&&process.env&&"development"||"",HQ=[["APPVEYOR"],["AWS_AMPLIFY","AWS_APP_ID",{ci:!0}],["AZURE_PIPELINES","SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],["AZURE_STATIC","INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],["APPCIRCLE","AC_APPCIRCLE"],["BAMBOO","bamboo_planKey"],["BITBUCKET","BITBUCKET_COMMIT"],["BITRISE","BITRISE_IO"],["BUDDY","BUDDY_WORKSPACE_ID"],["BUILDKITE"],["CIRCLE","CIRCLECI"],["CIRRUS","CIRRUS_CI"],["CLOUDFLARE_PAGES","CF_PAGES",{ci:!0}],["CODEBUILD","CODEBUILD_BUILD_ARN"],["CODEFRESH","CF_BUILD_ID"],["DRONE"],["DRONE","DRONE_BUILD_EVENT"],["DSARI"],["GITHUB_ACTIONS"],["GITLAB","GITLAB_CI"],["GITLAB","CI_MERGE_REQUEST_ID"],["GOCD","GO_PIPELINE_LABEL"],["LAYERCI"],["HUDSON","HUDSON_URL"],["JENKINS","JENKINS_URL"],["MAGNUM"],["NETLIFY"],["NETLIFY","NETLIFY_LOCAL",{ci:!1}],["NEVERCODE"],["RENDER"],["SAIL","SAILCI"],["SEMAPHORE"],["SCREWDRIVER"],["SHIPPABLE"],["SOLANO","TDDIUM"],["STRIDER"],["TEAMCITY","TEAMCITY_VERSION"],["TRAVIS"],["VERCEL","NOW_BUILDER"],["VERCEL","VERCEL",{ci:!1}],["VERCEL","VERCEL_ENV",{ci:!1}],["APPCENTER","APPCENTER_BUILD_ID"],["CODESANDBOX","CODESANDBOX_SSE",{ci:!1}],["CODESANDBOX","CODESANDBOX_HOST",{ci:!1}],["STACKBLITZ"],["STORMKIT"],["CLEAVR"],["ZEABUR"],["CODESPHERE","CODESPHERE_APP_ID",{ci:!0}],["RAILWAY","RAILWAY_PROJECT_ID"],["RAILWAY","RAILWAY_SERVICE_ID"],["DENO-DEPLOY","DENO_DEPLOYMENT_ID"],["FIREBASE_APP_HOSTING","FIREBASE_APP_HOSTING",{ci:!0}]];function CQ(){if(globalThis.process?.env)for(let D of HQ){let $=D[1]||D[0];if(globalThis.process?.env[$])return{name:D[0].toLowerCase(),...D[2]}}return globalThis.process?.env?.SHELL==="/bin/jsh"&&globalThis.process?.versions?.webcontainer?{name:"stackblitz",ci:!1}:{name:"",ci:!1}}var W4=CQ();W4.name;function f0(D){return D?D!=="false":!1}var _Q=globalThis.process?.platform||"",Q6=f0(u0.CI)||W4.ci!==!1,u4=f0(globalThis.process?.stdout&&globalThis.process?.stdout.isTTY),GQ=f0(u0.DEBUG),J6=YQ==="test"||f0(u0.TEST);f0(u0.MINIMAL);var VQ=/^win/i.test(_Q);!f0(u0.NO_COLOR)&&(f0(u0.FORCE_COLOR)||(u4||VQ)&&u0.TERM);var WQ=(globalThis.process?.versions?.node||"").replace(/^v/,"")||null;Number(WQ?.split(".")[0]);var uQ=globalThis.process||Object.create(null),_4={versions:{}};new Proxy(uQ,{get(D,$){if($==="env")return u0;if($ in D)return D[$];if($ in _4)return _4[$]}});var AQ=globalThis.process?.release?.name==="node",UQ=!!globalThis.Bun||!!globalThis.process?.versions?.bun,zQ=!!globalThis.Deno,wQ=!!globalThis.fastly,MQ=!!globalThis.Netlify,KQ=!!globalThis.EdgeRuntime,EQ=globalThis.navigator?.userAgent==="Cloudflare-Workers",OQ=[[MQ,"netlify"],[KQ,"edge-light"],[EQ,"workerd"],[wQ,"fastly"],[zQ,"deno"],[UQ,"bun"],[AQ,"node"]];function jQ(){let D=OQ.find(($)=>$[0]);if(D)return{name:D[1]}}var RQ=jQ();RQ?.name;function NQ({onlyFirst:D=!1}={}){let F=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(F,D?void 0:"g")}var LQ=NQ();function IQ(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);return D.replace(LQ,"")}function ZQ(D){return D===161||D===164||D===167||D===168||D===170||D===173||D===174||D>=176&&D<=180||D>=182&&D<=186||D>=188&&D<=191||D===198||D===208||D===215||D===216||D>=222&&D<=225||D===230||D>=232&&D<=234||D===236||D===237||D===240||D===242||D===243||D>=247&&D<=250||D===252||D===254||D===257||D===273||D===275||D===283||D===294||D===295||D===299||D>=305&&D<=307||D===312||D>=319&&D<=322||D===324||D>=328&&D<=331||D===333||D===338||D===339||D===358||D===359||D===363||D===462||D===464||D===466||D===468||D===470||D===472||D===474||D===476||D===593||D===609||D===708||D===711||D>=713&&D<=715||D===717||D===720||D>=728&&D<=731||D===733||D===735||D>=768&&D<=879||D>=913&&D<=929||D>=931&&D<=937||D>=945&&D<=961||D>=963&&D<=969||D===1025||D>=1040&&D<=1103||D===1105||D===8208||D>=8211&&D<=8214||D===8216||D===8217||D===8220||D===8221||D>=8224&&D<=8226||D>=8228&&D<=8231||D===8240||D===8242||D===8243||D===8245||D===8251||D===8254||D===8308||D===8319||D>=8321&&D<=8324||D===8364||D===8451||D===8453||D===8457||D===8467||D===8470||D===8481||D===8482||D===8486||D===8491||D===8531||D===8532||D>=8539&&D<=8542||D>=8544&&D<=8555||D>=8560&&D<=8569||D===8585||D>=8592&&D<=8601||D===8632||D===8633||D===8658||D===8660||D===8679||D===8704||D===8706||D===8707||D===8711||D===8712||D===8715||D===8719||D===8721||D===8725||D===8730||D>=8733&&D<=8736||D===8739||D===8741||D>=8743&&D<=8748||D===8750||D>=8756&&D<=8759||D===8764||D===8765||D===8776||D===8780||D===8786||D===8800||D===8801||D>=8804&&D<=8807||D===8810||D===8811||D===8814||D===8815||D===8834||D===8835||D===8838||D===8839||D===8853||D===8857||D===8869||D===8895||D===8978||D>=9312&&D<=9449||D>=9451&&D<=9547||D>=9552&&D<=9587||D>=9600&&D<=9615||D>=9618&&D<=9621||D===9632||D===9633||D>=9635&&D<=9641||D===9650||D===9651||D===9654||D===9655||D===9660||D===9661||D===9664||D===9665||D>=9670&&D<=9672||D===9675||D>=9678&&D<=9681||D>=9698&&D<=9701||D===9711||D===9733||D===9734||D===9737||D===9742||D===9743||D===9756||D===9758||D===9792||D===9794||D===9824||D===9825||D>=9827&&D<=9829||D>=9831&&D<=9834||D===9836||D===9837||D===9839||D===9886||D===9887||D===9919||D>=9926&&D<=9933||D>=9935&&D<=9939||D>=9941&&D<=9953||D===9955||D===9960||D===9961||D>=9963&&D<=9969||D===9972||D>=9974&&D<=9977||D===9979||D===9980||D===9982||D===9983||D===10045||D>=10102&&D<=10111||D>=11094&&D<=11097||D>=12872&&D<=12879||D>=57344&&D<=63743||D>=65024&&D<=65039||D===65533||D>=127232&&D<=127242||D>=127248&&D<=127277||D>=127280&&D<=127337||D>=127344&&D<=127373||D===127375||D===127376||D>=127387&&D<=127404||D>=917760&&D<=917999||D>=983040&&D<=1048573||D>=1048576&&D<=1114109}function bQ(D){return D===12288||D>=65281&&D<=65376||D>=65504&&D<=65510}function SQ(D){return D>=4352&&D<=4447||D===8986||D===8987||D===9001||D===9002||D>=9193&&D<=9196||D===9200||D===9203||D===9725||D===9726||D===9748||D===9749||D>=9776&&D<=9783||D>=9800&&D<=9811||D===9855||D>=9866&&D<=9871||D===9875||D===9889||D===9898||D===9899||D===9917||D===9918||D===9924||D===9925||D===9934||D===9940||D===9962||D===9970||D===9971||D===9973||D===9978||D===9981||D===9989||D===9994||D===9995||D===10024||D===10060||D===10062||D>=10067&&D<=10069||D===10071||D>=10133&&D<=10135||D===10160||D===10175||D===11035||D===11036||D===11088||D===11093||D>=11904&&D<=11929||D>=11931&&D<=12019||D>=12032&&D<=12245||D>=12272&&D<=12287||D>=12289&&D<=12350||D>=12353&&D<=12438||D>=12441&&D<=12543||D>=12549&&D<=12591||D>=12593&&D<=12686||D>=12688&&D<=12773||D>=12783&&D<=12830||D>=12832&&D<=12871||D>=12880&&D<=42124||D>=42128&&D<=42182||D>=43360&&D<=43388||D>=44032&&D<=55203||D>=63744&&D<=64255||D>=65040&&D<=65049||D>=65072&&D<=65106||D>=65108&&D<=65126||D>=65128&&D<=65131||D>=94176&&D<=94180||D===94192||D===94193||D>=94208&&D<=100343||D>=100352&&D<=101589||D>=101631&&D<=101640||D>=110576&&D<=110579||D>=110581&&D<=110587||D===110589||D===110590||D>=110592&&D<=110882||D===110898||D>=110928&&D<=110930||D===110933||D>=110948&&D<=110951||D>=110960&&D<=111355||D>=119552&&D<=119638||D>=119648&&D<=119670||D===126980||D===127183||D===127374||D>=127377&&D<=127386||D>=127488&&D<=127490||D>=127504&&D<=127547||D>=127552&&D<=127560||D===127568||D===127569||D>=127584&&D<=127589||D>=127744&&D<=127776||D>=127789&&D<=127797||D>=127799&&D<=127868||D>=127870&&D<=127891||D>=127904&&D<=127946||D>=127951&&D<=127955||D>=127968&&D<=127984||D===127988||D>=127992&&D<=128062||D===128064||D>=128066&&D<=128252||D>=128255&&D<=128317||D>=128331&&D<=128334||D>=128336&&D<=128359||D===128378||D===128405||D===128406||D===128420||D>=128507&&D<=128591||D>=128640&&D<=128709||D===128716||D>=128720&&D<=128722||D>=128725&&D<=128727||D>=128732&&D<=128735||D===128747||D===128748||D>=128756&&D<=128764||D>=128992&&D<=129003||D===129008||D>=129292&&D<=129338||D>=129340&&D<=129349||D>=129351&&D<=129535||D>=129648&&D<=129660||D>=129664&&D<=129673||D>=129679&&D<=129734||D>=129742&&D<=129756||D>=129759&&D<=129769||D>=129776&&D<=129784||D>=131072&&D<=196605||D>=196608&&D<=262141}function TQ(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function PQ(D,{ambiguousAsWide:$=!1}={}){if(TQ(D),bQ(D)||SQ(D)||$&&ZQ(D))return 2;return 1}var vQ=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g},fQ=globalThis.Intl?.Segmenter?new Intl.Segmenter:{segment:(D)=>D.split("")},kQ=/^\p{Default_Ignorable_Code_Point}$/u;function yQ(D,$={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:B=!1}=$;if(!B)D=IQ(D);if(D.length===0)return 0;let q=0,Q={ambiguousAsWide:!F};for(let{segment:X}of fQ.segment(D)){let J=X.codePointAt(0);if(J<=31||J>=127&&J<=159)continue;if(J>=8203&&J<=8207||J===65279)continue;if(J>=768&&J<=879||J>=6832&&J<=6911||J>=7616&&J<=7679||J>=8400&&J<=8447||J>=65056&&J<=65071)continue;if(J>=55296&&J<=57343)continue;if(J>=65024&&J<=65039)continue;if(kQ.test(X))continue;if(vQ().test(X)){q+=2;continue}q+=PQ(J,Q)}return q}function hQ(){let{env:D}=C4,{TERM:$,TERM_PROGRAM:F}=D;if(C4.platform!=="win32")return $!=="linux";return Boolean(D.WT_SESSION)||Boolean(D.TERMINUS_SUBLIME)||D.ConEmuTask==="{cmd::Cmder}"||F==="Terminus-Sublime"||F==="vscode"||$==="xterm-256color"||$==="alacritty"||$==="rxvt-unicode"||$==="rxvt-unicode-256color"||D.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var gQ={info:"cyan",fail:"red",success:"green",ready:"green",start:"magenta"},mQ={0:"red",1:"yellow"},xQ=hQ(),rD=(D,$)=>xQ?D:$,G4={error:rD("✖","×"),fatal:rD("✖","×"),ready:rD("✔","√"),warn:rD("⚠","‼"),info:rD("ℹ","i"),success:rD("✔","√"),debug:rD("⚙","D"),trace:rD("→","→"),fail:rD("✖","×"),start:rD("◐","o"),log:""};function V4(D){if(typeof Intl!=="object"||!Intl.Segmenter)return q0(D).length;return yQ(D)}class A4 extends $8{formatStack(D,$,F){let B=" ".repeat((F?.errorLevel||0)+1);return`
213
- ${B}`+s1(D,$).map((q)=>" "+q.replace(/^at +/,(Q)=>c.gray(Q)).replace(/\((.+)\)/,(Q,X)=>`(${c.cyan(X)})`)).join(`
214
- ${B}`)}formatType(D,$,F){let B=gQ[D.type]||mQ[D.level]||"gray";if($)return dQ(B)(c.black(` ${D.type.toUpperCase()} `));let q=typeof G4[D.type]==="string"?G4[D.type]:D.icon||D.type;return q?lQ(B)(q):""}formatLogObj(D,$){let[F,...B]=this.formatArgs(D.args,$).split(`
215
- `);if(D.type==="box")return o1(Y8(F+(B.length>0?`
216
- `+B.join(`
217
- `):"")),{title:D.title?Y8(D.title):void 0,style:D.style});let q=this.formatDate(D.date,$),Q=q&&c.gray(q),X=D.badge??D.level<2,J=this.formatType(D,X,$),Y=D.tag?c.gray(D.tag):"",H,C=this.filterAndJoin([J,Y8(F)]),_=this.filterAndJoin($.columns?[Y,Q]:[Y]),G=($.columns||0)-V4(C)-V4(_)-2;if(H=G>0&&($.columns||0)>=80?C+" ".repeat(G)+_:(_?`${c.gray(`[${_}]`)} `:"")+C,H+=Y8(B.length>0?`
218
- `+B.join(`
219
- `):""),D.type==="trace"){let u=Error("Trace: "+D.message);H+=this.formatStack(u.stack||"",u.message)}return X?`
220
- `+H+`
221
- `:H}}function Y8(D){return D.replace(/`([^`]+)`/gm,($,F)=>c.cyan(F)).replace(/\s+_([^_]+)_\s+/gm,($,F)=>` ${c.underline(F)} `)}function lQ(D="white"){return c[D]||c.white}function dQ(D="bgWhite"){return c[`bg${D[0].toUpperCase()}${D.slice(1)}`]||c.bgWhite}function pQ(D={}){let $=cQ();if(process.env.CONSOLA_LEVEL)$=Number.parseInt(process.env.CONSOLA_LEVEL)??$;return b7({level:$,defaults:{level:$},stdout:process.stdout,stderr:process.stderr,prompt:(...B)=>Promise.resolve().then(() => (H4(),Y4)).then((q)=>q.prompt(...B)),reporters:D.reporters||[D.fancy??!(Q6||J6)?new A4:new $8],...D})}function cQ(){if(GQ)return YD.debug;if(J6)return YD.warn;return YD.info}var k0=pQ();function iQ(D){if(Array.isArray(D))return D;return D===void 0?[]:[D]}function Y6(D,$=""){let F=[];for(let B of D)for(let[q,Q]of B.entries())F[q]=Math.max(F[q]||0,Q.length);return D.map((B)=>B.map((q,Q)=>$+q[Q===0?"padStart":"padEnd"](F[Q])).join(" ")).join(`
222
- `)}function kD(D){return typeof D==="function"?D():D}class y0 extends Error{constructor(D,$){super(D);this.code=$,this.name="CLIError"}}var nQ=/\d/,rQ=["-","_","/","."];function aQ(D=""){if(nQ.test(D))return;return D!==D.toLowerCase()}function U4(D,$){let F=$??rQ,B=[];if(!D||typeof D!=="string")return B;let q="",Q,X;for(let J of D){let Y=F.includes(J);if(Y===!0){B.push(q),q="",Q=void 0;continue}let H=aQ(J);if(X===!1){if(Q===!1&&H===!0){B.push(q),q=J,Q=H;continue}if(Q===!0&&H===!1&&q.length>1){let C=q.at(-1);B.push(q.slice(0,Math.max(0,q.length-1))),q=C+J,Q=H;continue}}q+=J,Q=H,X=Y}return B.push(q),B}function sQ(D){return D?D[0].toUpperCase()+D.slice(1):""}function oQ(D){return D?D[0].toLowerCase()+D.slice(1):""}function tQ(D,$){return D?(Array.isArray(D)?D:U4(D)).map((F)=>sQ($?.normalize?F.toLowerCase():F)).join(""):""}function eQ(D,$){return oQ(tQ(D||"",$))}function DJ(D,$){return D?(Array.isArray(D)?D:U4(D)).map((F)=>F.toLowerCase()).join($??"-"):""}function H6(D){return D==null?[]:Array.isArray(D)?D:[D]}function $J(D,$,F,B){let q,Q=D[$],X=~B.string.indexOf($)?F==null||F===!0?"":String(F):typeof F==="boolean"?F:~B.boolean.indexOf($)?F==="false"?!1:F==="true"||(D._.push((q=+F,q*0===0)?q:F),!!F):(q=+F,q*0===0)?q:F;D[$]=Q==null?X:Array.isArray(Q)?Q.concat(X):[Q,X]}function FJ(D=[],$={}){let F,B,q,Q,X,J={_:[]},Y=0,H=0,C=0,_=D.length,G=$.alias!==void 0,u=$.unknown!==void 0,U=$.default!==void 0;if($.alias=$.alias||{},$.string=H6($.string),$.boolean=H6($.boolean),G)for(F in $.alias){B=$.alias[F]=H6($.alias[F]);for(Y=0;Y<B.length;Y++)($.alias[B[Y]]=B.concat(F)).splice(Y,1)}for(Y=$.boolean.length;Y-- >0;){B=$.alias[$.boolean[Y]]||[];for(H=B.length;H-- >0;)$.boolean.push(B[H])}for(Y=$.string.length;Y-- >0;){B=$.alias[$.string[Y]]||[];for(H=B.length;H-- >0;)$.string.push(B[H])}if(U){for(F in $.default)if(Q=typeof $.default[F],B=$.alias[F]=$.alias[F]||[],$[Q]!==void 0){$[Q].push(F);for(Y=0;Y<B.length;Y++)$[Q].push(B[Y])}}let W=u?Object.keys($.alias):[];for(Y=0;Y<_;Y++){if(q=D[Y],q==="--"){J._=J._.concat(D.slice(++Y));break}for(H=0;H<q.length;H++)if(q.charCodeAt(H)!==45)break;if(H===0)J._.push(q);else if(q.substring(H,H+3)==="no-"){if(Q=q.slice(Math.max(0,H+3)),u&&!~W.indexOf(Q))return $.unknown(q);J[Q]=!1}else{for(C=H+1;C<q.length;C++)if(q.charCodeAt(C)===61)break;Q=q.substring(H,C),X=q.slice(Math.max(0,++C))||Y+1===_||(""+D[Y+1]).charCodeAt(0)===45||D[++Y],B=H===2?[Q]:Q;for(C=0;C<B.length;C++){if(Q=B[C],u&&!~W.indexOf(Q))return $.unknown("-".repeat(H)+Q);$J(J,Q,C+1<B.length||X,$)}}}if(U){for(F in $.default)if(J[F]===void 0)J[F]=$.default[F]}if(G)for(F in J){B=$.alias[F]||[];while(B.length>0)J[B.shift()]=J[F]}return J}function BJ(D,$){let F={boolean:[],string:[],mixed:[],alias:{},default:{}},B=z4($);for(let J of B){if(J.type==="positional")continue;if(J.type==="string")F.string.push(J.name);else if(J.type==="boolean")F.boolean.push(J.name);if(J.default!==void 0)F.default[J.name]=J.default;if(J.alias)F.alias[J.name]=J.alias}let q=FJ(D,F),[...Q]=q._,X=new Proxy(q,{get(J,Y){return J[Y]??J[eQ(Y)]??J[DJ(Y)]}});for(let[,J]of B.entries())if(J.type==="positional"){let Y=Q.shift();if(Y!==void 0)X[J.name]=Y;else if(J.default===void 0&&J.required!==!1)throw new y0(`Missing required positional argument: ${J.name.toUpperCase()}`,"EARG");else X[J.name]=J.default}else if(J.required&&X[J.name]===void 0)throw new y0(`Missing required argument: --${J.name}`,"EARG");return X}function z4(D){let $=[];for(let[F,B]of Object.entries(D||{}))$.push({...B,name:F,alias:iQ(B.alias)});return $}async function w4(D,$){let F=await kD(D.args||{}),B=BJ($.rawArgs,F),q={rawArgs:$.rawArgs,args:B,data:$.data,cmd:D};if(typeof D.setup==="function")await D.setup(q);let Q;try{let X=await kD(D.subCommands);if(X&&Object.keys(X).length>0){let J=$.rawArgs.findIndex((H)=>!H.startsWith("-")),Y=$.rawArgs[J];if(Y){if(!X[Y])throw new y0(`Unknown command \`${Y}\``,"E_UNKNOWN_COMMAND");let H=await kD(X[Y]);if(H)await w4(H,{rawArgs:$.rawArgs.slice(J+1)})}else if(!D.run)throw new y0("No command specified.","E_NO_COMMAND")}if(typeof D.run==="function")Q=await D.run(q)}finally{if(typeof D.cleanup==="function")await D.cleanup(q)}return{result:Q}}async function C6(D,$,F){let B=await kD(D.subCommands);if(B&&Object.keys(B).length>0){let q=$.findIndex((J)=>!J.startsWith("-")),Q=$[q],X=await kD(B[Q]);if(X)return C6(X,$.slice(q+1),D)}return[D,F]}async function qJ(D,$){try{k0.log(await XJ(D,$)+`
223
- `)}catch(F){k0.error(F)}}async function XJ(D,$){let F=await kD(D.meta||{}),B=z4(await kD(D.args||{})),q=await kD($?.meta||{}),Q=`${q.name?`${q.name} `:""}`+(F.name||process.argv[1]),X=[],J=[],Y=[],H=[];for(let u of B)if(u.type==="positional"){let U=u.name.toUpperCase(),W=u.required!==!1&&u.default===void 0,A=u.default?`="${u.default}"`:"";J.push(["`"+U+A+"`",u.description||"",u.valueHint?`<${u.valueHint}>`:""]),H.push(W?`<${U}>`:`[${U}]`)}else{let U=u.required===!0&&u.default===void 0,W=(u.type==="boolean"&&u.default===!0?[...(u.alias||[]).map((A)=>`--no-${A}`),`--no-${u.name}`].join(", "):[...(u.alias||[]).map((A)=>`-${A}`),`--${u.name}`].join(", "))+(u.type==="string"&&(u.valueHint||u.default)?`=${u.valueHint?`<${u.valueHint}>`:`"${u.default||""}"`}`:"");if(X.push(["`"+W+(U?" (required)":"")+"`",u.description||""]),U)H.push(W)}if(D.subCommands){let u=[],U=await kD(D.subCommands);for(let[W,A]of Object.entries(U)){let z=await kD(A),w=await kD(z?.meta);Y.push([`\`${W}\``,w?.description||""]),u.push(W)}H.push(u.join("|"))}let C=[],_=F.version||q.version;C.push(c.gray(`${F.description} (${Q+(_?` v${_}`:"")})`),"");let G=X.length>0||J.length>0;if(C.push(`${c.underline(c.bold("USAGE"))} \`${Q}${G?" [OPTIONS]":""} ${H.join(" ")}\``,""),J.length>0)C.push(c.underline(c.bold("ARGUMENTS")),""),C.push(Y6(J," ")),C.push("");if(X.length>0)C.push(c.underline(c.bold("OPTIONS")),""),C.push(Y6(X," ")),C.push("");if(Y.length>0)C.push(c.underline(c.bold("COMMANDS")),""),C.push(Y6(Y," ")),C.push("",`Use \`${Q} <command> --help\` for more information about a command.`);return C.filter((u)=>typeof u==="string").join(`
224
- `)}async function M4(D,$={}){let F=$.rawArgs||process.argv.slice(2),B=$.showUsage||qJ;try{if(F.includes("--help")||F.includes("-h"))await B(...await C6(D,F)),process.exit(0);else if(F.length===1&&F[0]==="--version"){let q=typeof D.meta==="function"?await D.meta():await D.meta;if(!q?.version)throw new y0("No version specified","E_NO_VERSION");k0.log(q.version)}else await w4(D,{rawArgs:F})}catch(q){let Q=q instanceof y0;if(!Q)k0.error(q,`
225
- `);if(Q)await B(...await C6(D,F));k0.error(q.message),process.exit(1)}}function MD(D){return D}var K4={name:"diffray",version:"0.1.2",description:"AI-powered code review CLI for git changes",author:"Ilya Strelov <strelov1@gmail.com>",license:"MIT",type:"module",bin:{diffray:"./dist/diffray.js"},files:["dist/diffray.js","dist/defaults","src/defaults"],scripts:{dev:"bun run ./bin/diffray.ts",build:"bun build ./bin/diffray.ts --outfile dist/diffray.js --target node --minify && cp -r src/defaults dist/","link:local":`node -e "const p=require('./package.json');p.bin.diffray='./bin/diffray.ts';require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')" && bun link`,"link:publish":`node -e "const p=require('./package.json');p.bin.diffray='./dist/diffray.js';require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')"`,link:"bun link",unlink:"bun unlink",test:"bun test","ts-check":"tsc --noEmit",lint:"eslint .","lint:fix":"eslint . --fix",format:"prettier --write .","format:check":"prettier --check .",prepublishOnly:"npm run build && npm run link:publish"},repository:{type:"git",url:"git+https://github.com/diffray/diffray.git"},homepage:"https://github.com/diffray/diffray#readme",bugs:{url:"https://github.com/diffray/diffray/issues"},keywords:["code-review","ai","cli","git","diff","llm","claude","cerebras","pull-request"],engines:{node:">=18.0.0"},os:["darwin","linux","win32"],cpu:["x64","arm64"],devDependencies:{"@eslint/js":"^9.39.2","@types/bun":"latest","@typescript-eslint/eslint-plugin":"^8.52.0","@typescript-eslint/parser":"^8.52.0",eslint:"^9.39.2","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4",prettier:"^3.7.4"},peerDependencies:{typescript:"^5"},dependencies:{citty:"^0.1.6",diff:"^8.0.2",glob:"^13.0.0",yaml:"^2.8.2",zod:"^3.22.4"}};class qD{diff(D,$,F={}){let B;if(typeof F==="function")B=F,F={};else if("callback"in F)B=F.callback;let q=this.castInput(D,F),Q=this.castInput($,F),X=this.removeEmpty(this.tokenize(q,F)),J=this.removeEmpty(this.tokenize(Q,F));return this.diffWithOptionsObj(X,J,F,B)}diffWithOptionsObj(D,$,F,B){var q;let Q=(z)=>{if(z=this.postProcess(z,F),B){setTimeout(function(){B(z)},0);return}else return z},X=$.length,J=D.length,Y=1,H=X+J;if(F.maxEditLength!=null)H=Math.min(H,F.maxEditLength);let C=(q=F.timeout)!==null&&q!==void 0?q:1/0,_=Date.now()+C,G=[{oldPos:-1,lastComponent:void 0}],u=this.extractCommon(G[0],$,D,0,F);if(G[0].oldPos+1>=J&&u+1>=X)return Q(this.buildValues(G[0].lastComponent,$,D));let U=-1/0,W=1/0,A=()=>{for(let z=Math.max(U,-Y);z<=Math.min(W,Y);z+=2){let w,M=G[z-1],K=G[z+1];if(M)G[z-1]=void 0;let R=!1;if(K){let v=K.oldPos-z;R=K&&0<=v&&v<X}let Z=M&&M.oldPos+1<J;if(!R&&!Z){G[z]=void 0;continue}if(!Z||R&&M.oldPos<K.oldPos)w=this.addToPath(K,!0,!1,0,F);else w=this.addToPath(M,!1,!0,1,F);if(u=this.extractCommon(w,$,D,z,F),w.oldPos+1>=J&&u+1>=X)return Q(this.buildValues(w.lastComponent,$,D))||!0;else{if(G[z]=w,w.oldPos+1>=J)W=Math.min(W,z-1);if(u+1>=X)U=Math.max(U,z+1)}}Y++};if(B)(function z(){setTimeout(function(){if(Y>H||Date.now()>_)return B(void 0);if(!A())z()},0)})();else while(Y<=H&&Date.now()<=_){let z=A();if(z)return z}}addToPath(D,$,F,B,q){let Q=D.lastComponent;if(Q&&!q.oneChangePerToken&&Q.added===$&&Q.removed===F)return{oldPos:D.oldPos+B,lastComponent:{count:Q.count+1,added:$,removed:F,previousComponent:Q.previousComponent}};else return{oldPos:D.oldPos+B,lastComponent:{count:1,added:$,removed:F,previousComponent:Q}}}extractCommon(D,$,F,B,q){let Q=$.length,X=F.length,J=D.oldPos,Y=J-B,H=0;while(Y+1<Q&&J+1<X&&this.equals(F[J+1],$[Y+1],q))if(Y++,J++,H++,q.oneChangePerToken)D.lastComponent={count:1,previousComponent:D.lastComponent,added:!1,removed:!1};if(H&&!q.oneChangePerToken)D.lastComponent={count:H,previousComponent:D.lastComponent,added:!1,removed:!1};return D.oldPos=J,Y}equals(D,$,F){if(F.comparator)return F.comparator(D,$);else return D===$||!!F.ignoreCase&&D.toLowerCase()===$.toLowerCase()}removeEmpty(D){let $=[];for(let F=0;F<D.length;F++)if(D[F])$.push(D[F]);return $}castInput(D,$){return D}tokenize(D,$){return Array.from(D)}join(D){return D.join("")}postProcess(D,$){return D}get useLongestToken(){return!1}buildValues(D,$,F){let B=[],q;while(D)B.push(D),q=D.previousComponent,delete D.previousComponent,D=q;B.reverse();let Q=B.length,X=0,J=0,Y=0;for(;X<Q;X++){let H=B[X];if(!H.removed){if(!H.added&&this.useLongestToken){let C=$.slice(J,J+H.count);C=C.map(function(_,G){let u=F[Y+G];return u.length>_.length?u:_}),H.value=this.join(C)}else H.value=this.join($.slice(J,J+H.count));if(J+=H.count,!H.added)Y+=H.count}else H.value=this.join(F.slice(Y,Y+H.count)),Y+=H.count}return B}}class E4 extends qD{}var JJ=new E4;function _6(D,$){let F;for(F=0;F<D.length&&F<$.length;F++)if(D[F]!=$[F])return D.slice(0,F);return D.slice(0,F)}function G6(D,$){let F;if(!D||!$||D[D.length-1]!=$[$.length-1])return"";for(F=0;F<D.length&&F<$.length;F++)if(D[D.length-(F+1)]!=$[$.length-(F+1)])return D.slice(-F);return D.slice(-F)}function C8(D,$,F){if(D.slice(0,$.length)!=$)throw Error(`string ${JSON.stringify(D)} doesn't start with prefix ${JSON.stringify($)}; this is a bug`);return F+D.slice($.length)}function _8(D,$,F){if(!$)return D+F;if(D.slice(-$.length)!=$)throw Error(`string ${JSON.stringify(D)} doesn't end with suffix ${JSON.stringify($)}; this is a bug`);return D.slice(0,-$.length)+F}function X2(D,$){return C8(D,$,"")}function a2(D,$){return _8(D,$,"")}function V6(D,$){return $.slice(0,YJ(D,$))}function YJ(D,$){let F=0;if(D.length>$.length)F=D.length-$.length;let B=$.length;if(D.length<$.length)B=D.length;let q=Array(B),Q=0;q[0]=0;for(let X=1;X<B;X++){if($[X]==$[Q])q[X]=q[Q];else q[X]=Q;while(Q>0&&$[X]!=$[Q])Q=q[Q];if($[X]==$[Q])Q++}Q=0;for(let X=F;X<D.length;X++){while(Q>0&&D[X]!=$[Q])Q=q[Q];if(D[X]==$[Q])Q++}return Q}function Q2(D){let $;for($=D.length-1;$>=0;$--)if(!D[$].match(/\s/))break;return D.substring($+1)}function X0(D){let $=D.match(/^\s*/);return $?$[0]:""}var G8="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",HJ=new RegExp(`[${G8}]+|\\s+|[^${G8}]`,"ug");class j4 extends qD{equals(D,$,F){if(F.ignoreCase)D=D.toLowerCase(),$=$.toLowerCase();return D.trim()===$.trim()}tokenize(D,$={}){let F;if($.intlSegmenter){let Q=$.intlSegmenter;if(Q.resolvedOptions().granularity!="word")throw Error('The segmenter passed must have a granularity of "word"');F=Array.from(Q.segment(D),(X)=>X.segment)}else F=D.match(HJ)||[];let B=[],q=null;return F.forEach((Q)=>{if(/\s/.test(Q))if(q==null)B.push(Q);else B.push(B.pop()+Q);else if(q!=null&&/\s/.test(q))if(B[B.length-1]==q)B.push(B.pop()+Q);else B.push(q+Q);else B.push(Q);q=Q}),B}join(D){return D.map(($,F)=>{if(F==0)return $;else return $.replace(/^\s+/,"")}).join("")}postProcess(D,$){if(!D||$.oneChangePerToken)return D;let F=null,B=null,q=null;if(D.forEach((Q)=>{if(Q.added)B=Q;else if(Q.removed)q=Q;else{if(B||q)O4(F,q,B,Q);F=Q,B=null,q=null}}),B||q)O4(F,q,B,null);return D}}var CJ=new j4;function O4(D,$,F,B){if($&&F){let q=X0($.value),Q=Q2($.value),X=X0(F.value),J=Q2(F.value);if(D){let Y=_6(q,X);D.value=_8(D.value,X,Y),$.value=X2($.value,Y),F.value=X2(F.value,Y)}if(B){let Y=G6(Q,J);B.value=C8(B.value,J,Y),$.value=a2($.value,Y),F.value=a2(F.value,Y)}}else if(F){if(D){let q=X0(F.value);F.value=F.value.substring(q.length)}if(B){let q=X0(B.value);B.value=B.value.substring(q.length)}}else if(D&&B){let q=X0(B.value),Q=X0($.value),X=Q2($.value),J=_6(q,Q);$.value=X2($.value,J);let Y=G6(X2(q,J),X);$.value=a2($.value,Y),B.value=C8(B.value,q,Y),D.value=_8(D.value,q,q.slice(0,q.length-Y.length))}else if(B){let q=X0(B.value),Q=Q2($.value),X=V6(Q,q);$.value=a2($.value,X)}else if(D){let q=Q2(D.value),Q=X0($.value),X=V6(q,Q);$.value=X2($.value,X)}}class R4 extends qD{tokenize(D){let $=new RegExp(`(\\r?\\n)|[${G8}]+|[^\\S\\n\\r]+|[^${G8}]`,"ug");return D.match($)||[]}}var _J=new R4;class N4 extends qD{constructor(){super(...arguments);this.tokenize=W6}equals(D,$,F){if(F.ignoreWhitespace){if(!F.newlineIsToken||!D.includes(`
226
- `))D=D.trim();if(!F.newlineIsToken||!$.includes(`
227
- `))$=$.trim()}else if(F.ignoreNewlineAtEof&&!F.newlineIsToken){if(D.endsWith(`
228
- `))D=D.slice(0,-1);if($.endsWith(`
229
- `))$=$.slice(0,-1)}return super.equals(D,$,F)}}var L4=new N4;function V8(D,$,F){return L4.diff(D,$,F)}function W6(D,$){if($.stripTrailingCr)D=D.replace(/\r\n/g,`
230
- `);let F=[],B=D.split(/(\n|\r\n)/);if(!B[B.length-1])B.pop();for(let q=0;q<B.length;q++){let Q=B[q];if(q%2&&!$.newlineIsToken)F[F.length-1]+=Q;else F.push(Q)}return F}function GJ(D){return D=="."||D=="!"||D=="?"}class I4 extends qD{tokenize(D){var $;let F=[],B=0;for(let q=0;q<D.length;q++){if(q==D.length-1){F.push(D.slice(B));break}if(GJ(D[q])&&D[q+1].match(/\s/)){F.push(D.slice(B,q+1)),q=B=q+1;while(($=D[q+1])===null||$===void 0?void 0:$.match(/\s/))q++;F.push(D.slice(B,q+1)),B=q+1}}return F}}var VJ=new I4;class Z4 extends qD{tokenize(D){return D.split(/([{}:;,]|\s+)/)}}var WJ=new Z4;class b4 extends qD{constructor(){super(...arguments);this.tokenize=W6}get useLongestToken(){return!0}castInput(D,$){let{undefinedReplacement:F,stringifyReplacer:B=(q,Q)=>typeof Q>"u"?F:Q}=$;return typeof D==="string"?D:JSON.stringify(W8(D,null,null,B),null," ")}equals(D,$,F){return super.equals(D.replace(/,([\r\n])/g,"$1"),$.replace(/,([\r\n])/g,"$1"),F)}}var uJ=new b4;function W8(D,$,F,B,q){if($=$||[],F=F||[],B)D=B(q===void 0?"":q,D);let Q;for(Q=0;Q<$.length;Q+=1)if($[Q]===D)return F[Q];let X;if(Object.prototype.toString.call(D)==="[object Array]"){$.push(D),X=Array(D.length),F.push(X);for(Q=0;Q<D.length;Q+=1)X[Q]=W8(D[Q],$,F,B,String(Q));return $.pop(),F.pop(),X}if(D&&D.toJSON)D=D.toJSON();if(typeof D==="object"&&D!==null){$.push(D),X={},F.push(X);let J=[],Y;for(Y in D)if(Object.prototype.hasOwnProperty.call(D,Y))J.push(Y);J.sort();for(Q=0;Q<J.length;Q+=1)Y=J[Q],X[Y]=W8(D[Y],$,F,B,Y);$.pop(),F.pop()}else X=D;return X}class S4 extends qD{tokenize(D){return D.slice()}join(D){return D}removeEmpty(D){return D}}var AJ=new S4;function u6(D,$,F,B,q,Q,X){let J;if(!X)J={};else if(typeof X==="function")J={callback:X};else J=X;if(typeof J.context>"u")J.context=4;let Y=J.context;if(J.newlineIsToken)throw Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(!J.callback)return H(V8(F,B,J));else{let{callback:C}=J;V8(F,B,Object.assign(Object.assign({},J),{callback:(_)=>{let G=H(_);C(G)}}))}function H(C){if(!C)return;C.push({value:"",lines:[]});function _(w){return w.map(function(M){return" "+M})}let G=[],u=0,U=0,W=[],A=1,z=1;for(let w=0;w<C.length;w++){let M=C[w],K=M.lines||zJ(M.value);if(M.lines=K,M.added||M.removed){if(!u){let R=C[w-1];if(u=A,U=z,R)W=Y>0?_(R.lines.slice(-Y)):[],u-=W.length,U-=W.length}for(let R of K)W.push((M.added?"+":"-")+R);if(M.added)z+=K.length;else A+=K.length}else{if(u)if(K.length<=Y*2&&w<C.length-2)for(let R of _(K))W.push(R);else{let R=Math.min(K.length,Y);for(let v of _(K.slice(0,R)))W.push(v);let Z={oldStart:u,oldLines:A-u+R,newStart:U,newLines:z-U+R,lines:W};G.push(Z),u=0,U=0,W=[]}A+=K.length,z+=K.length}}for(let w of G)for(let M=0;M<w.lines.length;M++)if(w.lines[M].endsWith(`
231
- `))w.lines[M]=w.lines[M].slice(0,-1);else w.lines.splice(M+1,0,"\"),M++;return{oldFileName:D,newFileName:$,oldHeader:q,newHeader:Q,hunks:G}}}function u8(D){if(Array.isArray(D))return D.map(u8).join(`
232
- `);let $=[];if(D.oldFileName==D.newFileName)$.push("Index: "+D.oldFileName);$.push("==================================================================="),$.push("--- "+D.oldFileName+(typeof D.oldHeader>"u"?"":"\t"+D.oldHeader)),$.push("+++ "+D.newFileName+(typeof D.newHeader>"u"?"":"\t"+D.newHeader));for(let F=0;F<D.hunks.length;F++){let B=D.hunks[F];if(B.oldLines===0)B.oldStart-=1;if(B.newLines===0)B.newStart-=1;$.push("@@ -"+B.oldStart+","+B.oldLines+" +"+B.newStart+","+B.newLines+" @@");for(let q of B.lines)$.push(q)}return $.join(`
233
- `)+`
234
- `}function T4(D,$,F,B,q,Q,X){if(typeof X==="function")X={callback:X};if(!(X===null||X===void 0?void 0:X.callback)){let J=u6(D,$,F,B,q,Q,X);if(!J)return;return u8(J)}else{let{callback:J}=X;u6(D,$,F,B,q,Q,Object.assign(Object.assign({},X),{callback:(Y)=>{if(!Y)J(void 0);else J(u8(Y))}}))}}function s2(D,$,F,B,q,Q){return T4(D,D,$,F,B,q,Q)}function zJ(D){let $=D.endsWith(`
235
- `),F=D.split(`
236
- `).map((B)=>B+`
237
- `);if($)F.pop();else F.push(F.pop().slice(0,-1));return F}import{spawn as KJ}from"node:child_process";import{readFile as EJ}from"node:fs/promises";var A8=new Map;async function Q0(D,$){let F=A8.get(D);if(F!==void 0)return F.value;let B=await $();return A8.set(D,{value:B,timestamp:Date.now()}),B}function P4(D,$){A8.set(D,{value:$,timestamp:Date.now()})}function o2(D){A8.delete(D)}var KD={CONFIG:"config",INSTRUCTIONS:"instructions",OUTPUT_FORMAT:"prompt:output-format",VALIDATION_PROMPT:"prompt:validation",GIT_STATUS:"git:status"};s();var f4=30000;async function ED(D,$=process.cwd()){return new Promise((F,B)=>{let q=KJ("git",D,{cwd:$}),Q=[],X=[];q.stdout.on("data",(Y)=>Q.push(Y)),q.stderr.on("data",(Y)=>X.push(Y));let J=setTimeout(()=>{q.kill(),B(Error(`git ${D[0]} timeout after ${f4/1000}s`))},f4);q.on("close",(Y)=>{if(clearTimeout(J),Y===0)F(Buffer.concat(Q).toString("utf-8"));else{let H=Buffer.concat(X).toString("utf-8");B(Error(`git ${D[0]} failed: ${H||`exit code ${Y}`}`))}}),q.on("error",(Y)=>{clearTimeout(J),B(Y)})})}async function OJ(){try{let $=(await ED(["rev-parse","--abbrev-ref","HEAD"])).trim();return $==="HEAD"?null:$}catch(D){return V.debug(`getCurrentBranch failed: ${D}`),null}}async function jJ(){return(await ED(["rev-parse","HEAD"])).trim()}async function RJ(D){return(await ED(["rev-parse",D])).trim()}async function z8(D){await ED(["checkout",D]),g4()}async function k4(D){let $=await jJ(),F=await RJ(D);if($===F)return{checkoutNeeded:!1,originalRef:null};let q=await OJ()||$;return await z8(D),{checkoutNeeded:!0,originalRef:q}}async function y4(){try{return(await ED(["status","--porcelain"])).trim().split(`
238
- `).filter((F)=>F&&!F.startsWith("??")).length>0}catch(D){return V.debug(`hasUncommittedChanges failed: ${D}`),!1}}function NJ(D){return D.trim().split(`
239
- `).filter(($)=>$.length>=3).map(($)=>({file:$.slice(3),index:$[0]??" ",worktree:$[1]??" "}))}async function h4(){return Q0(KD.GIT_STATUS,async()=>{let D=await ED(["status","--porcelain"]);return NJ(D)})}function g4(){o2(KD.GIT_STATUS)}async function m4(){try{return await ED(["rev-parse","--git-dir"]),!0}catch(D){return V.debug(`isGitRepository: not a git repo: ${D}`),!1}}async function LJ(){try{return(await h4()).map(($)=>$.file)}catch(D){throw Error(`Failed to get changed files: ${D}`)}}async function IJ(D){try{let $="",F="";try{$=await ED(["show",`HEAD:${D}`])}catch{$=""}try{F=await EJ(D,"utf-8")}catch{F=""}return s2(D,$,F,"HEAD","Working Directory")}catch($){throw Error(`Failed to get diff for ${D}: ${$}`)}}async function ZJ(D){try{let F=(await h4()).find((B)=>B.file===D);if(!F)return"modified";if(F.index==="A"||F.index==="?"||F.worktree==="?")return"added";if(F.index==="D"||F.worktree==="D")return"deleted";return"modified"}catch($){return V.debug(`getFileStatus failed for ${D}: ${$}`),"modified"}}function U6(D){let $=D.split(`
240
- `),F=0,B=0;for(let q of $)if(q.startsWith("+")&&!q.startsWith("+++"))F++;else if(q.startsWith("-")&&!q.startsWith("---"))B++;return{additions:F,deletions:B}}async function x4(){g4();let D=await LJ();return(await Promise.all(D.map(async(F)=>{try{let[B,q]=await Promise.all([IJ(F),ZJ(F)]),{additions:Q,deletions:X}=U6(B);return{file:F,status:q,diff:B,additions:Q,deletions:X}}catch(B){return V.debug(`getAllDiffs: skipping ${F}: ${B}`),null}}))).filter((F)=>F!==null).filter((F)=>F.diff.trim().length>0)}function l4(D){return D.trim().split(`
241
- `).filter(($)=>$.length>0).map(($)=>{let[F,...B]=$.split("\t"),q=B.join("\t"),Q="modified";if(F==="A")Q="added";else if(F==="D")Q="deleted";else if(F?.startsWith("R"))Q="modified";return{file:q,status:Q}}).filter(($)=>$.file)}async function d4(){try{let D=await ED(["diff","--name-status","HEAD~1","HEAD"]),$=l4(D);if($.length===0)return[];return(await Promise.all($.map(async({file:B,status:q})=>{try{let Q=await ED(["diff","HEAD~1","HEAD","--",B]),{additions:X,deletions:J}=U6(Q),Y=Q.startsWith("diff --git")?Q:s2(B,"","","HEAD~1","HEAD");return{file:B,status:q,diff:Y,additions:X,deletions:J}}catch(Q){return V.debug(`getLastCommitDiffs: skipping ${B}: ${Q}`),null}}))).filter((B)=>B!==null&&B.diff.trim().length>0)}catch(D){throw Error(`Failed to get last commit diffs: ${D}`)}}async function p4(D,$="HEAD"){try{return(await ED(["log","--format=%B%n---COMMIT_SEPARATOR---",`${D}..${$}`])).split("---COMMIT_SEPARATOR---").map((B)=>B.trim()).filter((B)=>B.length>0)}catch(F){return V.debug(`getCommitMessages failed: ${F}`),[]}}async function c4(D,$="HEAD"){try{let F=await ED(["diff","--name-status",D,$]),B=l4(F);if(B.length===0)return[];return(await Promise.all(B.map(async({file:Q,status:X})=>{try{let J=await ED(["diff",D,$,"--",Q]),{additions:Y,deletions:H}=U6(J),C=J.startsWith("diff --git")?J:s2(Q,"","",D,$);return{file:Q,status:X,diff:C,additions:Y,deletions:H}}catch(J){return V.debug(`getCommitDiffs: skipping ${Q}: ${J}`),null}}))).filter((Q)=>Q!==null&&Q.diff.trim().length>0)}catch(F){throw Error(`Failed to get diffs between ${D} and ${$}: ${F}`)}}var m={};D8(m,{void:()=>VY,util:()=>x,unknown:()=>_Y,union:()=>UY,undefined:()=>YY,tuple:()=>MY,transformer:()=>bY,symbol:()=>JY,string:()=>D5,strictObject:()=>AY,setErrorMap:()=>TJ,set:()=>OY,record:()=>KY,quotelessJson:()=>bJ,promise:()=>ZY,preprocess:()=>PY,pipeline:()=>vY,ostring:()=>fY,optional:()=>SY,onumber:()=>kY,oboolean:()=>yY,objectUtil:()=>z6,object:()=>uY,number:()=>$5,nullable:()=>TY,null:()=>HY,never:()=>GY,nativeEnum:()=>IY,nan:()=>qY,map:()=>EY,makeIssue:()=>e2,literal:()=>NY,lazy:()=>RY,late:()=>FY,isValid:()=>A0,isDirty:()=>M8,isAsync:()=>Y2,isAborted:()=>w8,intersection:()=>wY,instanceof:()=>BY,getParsedType:()=>aD,getErrorMap:()=>J2,function:()=>jY,enum:()=>LY,effect:()=>bY,discriminatedUnion:()=>zY,defaultErrorMap:()=>J0,datetimeRegex:()=>o4,date:()=>QY,custom:()=>e4,coerce:()=>hY,boolean:()=>F5,bigint:()=>XY,array:()=>WY,any:()=>CY,addIssueToContext:()=>N,ZodVoid:()=>$3,ZodUnknown:()=>U0,ZodUnion:()=>W2,ZodUndefined:()=>G2,ZodType:()=>g,ZodTuple:()=>oD,ZodTransformer:()=>xD,ZodSymbol:()=>D3,ZodString:()=>yD,ZodSet:()=>x0,ZodSchema:()=>g,ZodRecord:()=>F3,ZodReadonly:()=>K2,ZodPromise:()=>l0,ZodPipeline:()=>X3,ZodParsedType:()=>j,ZodOptional:()=>gD,ZodObject:()=>o,ZodNumber:()=>z0,ZodNullable:()=>H0,ZodNull:()=>V2,ZodNever:()=>sD,ZodNativeEnum:()=>z2,ZodNaN:()=>q3,ZodMap:()=>B3,ZodLiteral:()=>U2,ZodLazy:()=>A2,ZodIssueCode:()=>E,ZodIntersection:()=>u2,ZodFunction:()=>C2,ZodFirstPartyTypeKind:()=>P,ZodError:()=>UD,ZodEnum:()=>M0,ZodEffects:()=>xD,ZodDiscriminatedUnion:()=>K8,ZodDefault:()=>w2,ZodDate:()=>g0,ZodCatch:()=>M2,ZodBranded:()=>E8,ZodBoolean:()=>_2,ZodBigInt:()=>w0,ZodArray:()=>hD,ZodAny:()=>m0,Schema:()=>g,ParseStatus:()=>HD,OK:()=>GD,NEVER:()=>gY,INVALID:()=>T,EMPTY_PATH:()=>PJ,DIRTY:()=>h0,BRAND:()=>$Y});var x;(function(D){D.assertEqual=(q)=>{};function $(q){}D.assertIs=$;function F(q){throw Error()}D.assertNever=F,D.arrayToEnum=(q)=>{let Q={};for(let X of q)Q[X]=X;return Q},D.getValidEnumValues=(q)=>{let Q=D.objectKeys(q).filter((J)=>typeof q[q[J]]!=="number"),X={};for(let J of Q)X[J]=q[J];return D.objectValues(X)},D.objectValues=(q)=>{return D.objectKeys(q).map(function(Q){return q[Q]})},D.objectKeys=typeof Object.keys==="function"?(q)=>Object.keys(q):(q)=>{let Q=[];for(let X in q)if(Object.prototype.hasOwnProperty.call(q,X))Q.push(X);return Q},D.find=(q,Q)=>{for(let X of q)if(Q(X))return X;return},D.isInteger=typeof Number.isInteger==="function"?(q)=>Number.isInteger(q):(q)=>typeof q==="number"&&Number.isFinite(q)&&Math.floor(q)===q;function B(q,Q=" | "){return q.map((X)=>typeof X==="string"?`'${X}'`:X).join(Q)}D.joinValues=B,D.jsonStringifyReplacer=(q,Q)=>{if(typeof Q==="bigint")return Q.toString();return Q}})(x||(x={}));var z6;(function(D){D.mergeShapes=($,F)=>{return{...$,...F}}})(z6||(z6={}));var j=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),aD=(D)=>{switch(typeof D){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN(D)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":if(Array.isArray(D))return j.array;if(D===null)return j.null;if(D.then&&typeof D.then==="function"&&D.catch&&typeof D.catch==="function")return j.promise;if(typeof Map<"u"&&D instanceof Map)return j.map;if(typeof Set<"u"&&D instanceof Set)return j.set;if(typeof Date<"u"&&D instanceof Date)return j.date;return j.object;default:return j.unknown}};var E=x.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),bJ=(D)=>{return JSON.stringify(D,null,2).replace(/"([^"]+)":/g,"$1:")};class UD extends Error{get errors(){return this.issues}constructor(D){super();this.issues=[],this.addIssue=(F)=>{this.issues=[...this.issues,F]},this.addIssues=(F=[])=>{this.issues=[...this.issues,...F]};let $=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,$);else this.__proto__=$;this.name="ZodError",this.issues=D}format(D){let $=D||function(q){return q.message},F={_errors:[]},B=(q)=>{for(let Q of q.issues)if(Q.code==="invalid_union")Q.unionErrors.map(B);else if(Q.code==="invalid_return_type")B(Q.returnTypeError);else if(Q.code==="invalid_arguments")B(Q.argumentsError);else if(Q.path.length===0)F._errors.push($(Q));else{let X=F,J=0;while(J<Q.path.length){let Y=Q.path[J];if(J!==Q.path.length-1)X[Y]=X[Y]||{_errors:[]};else X[Y]=X[Y]||{_errors:[]},X[Y]._errors.push($(Q));X=X[Y],J++}}};return B(this),F}static assert(D){if(!(D instanceof UD))throw Error(`Not a ZodError: ${D}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(D=($)=>$.message){let $={},F=[];for(let B of this.issues)if(B.path.length>0){let q=B.path[0];$[q]=$[q]||[],$[q].push(D(B))}else F.push(D(B));return{formErrors:F,fieldErrors:$}}get formErrors(){return this.flatten()}}UD.create=(D)=>{return new UD(D)};var SJ=(D,$)=>{let F;switch(D.code){case E.invalid_type:if(D.received===j.undefined)F="Required";else F=`Expected ${D.expected}, received ${D.received}`;break;case E.invalid_literal:F=`Invalid literal value, expected ${JSON.stringify(D.expected,x.jsonStringifyReplacer)}`;break;case E.unrecognized_keys:F=`Unrecognized key(s) in object: ${x.joinValues(D.keys,", ")}`;break;case E.invalid_union:F="Invalid input";break;case E.invalid_union_discriminator:F=`Invalid discriminator value. Expected ${x.joinValues(D.options)}`;break;case E.invalid_enum_value:F=`Invalid enum value. Expected ${x.joinValues(D.options)}, received '${D.received}'`;break;case E.invalid_arguments:F="Invalid function arguments";break;case E.invalid_return_type:F="Invalid function return type";break;case E.invalid_date:F="Invalid date";break;case E.invalid_string:if(typeof D.validation==="object")if("includes"in D.validation){if(F=`Invalid input: must include "${D.validation.includes}"`,typeof D.validation.position==="number")F=`${F} at one or more positions greater than or equal to ${D.validation.position}`}else if("startsWith"in D.validation)F=`Invalid input: must start with "${D.validation.startsWith}"`;else if("endsWith"in D.validation)F=`Invalid input: must end with "${D.validation.endsWith}"`;else x.assertNever(D.validation);else if(D.validation!=="regex")F=`Invalid ${D.validation}`;else F="Invalid";break;case E.too_small:if(D.type==="array")F=`Array must contain ${D.exact?"exactly":D.inclusive?"at least":"more than"} ${D.minimum} element(s)`;else if(D.type==="string")F=`String must contain ${D.exact?"exactly":D.inclusive?"at least":"over"} ${D.minimum} character(s)`;else if(D.type==="number")F=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="bigint")F=`Number must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${D.minimum}`;else if(D.type==="date")F=`Date must be ${D.exact?"exactly equal to ":D.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(D.minimum))}`;else F="Invalid input";break;case E.too_big:if(D.type==="array")F=`Array must contain ${D.exact?"exactly":D.inclusive?"at most":"less than"} ${D.maximum} element(s)`;else if(D.type==="string")F=`String must contain ${D.exact?"exactly":D.inclusive?"at most":"under"} ${D.maximum} character(s)`;else if(D.type==="number")F=`Number must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="bigint")F=`BigInt must be ${D.exact?"exactly":D.inclusive?"less than or equal to":"less than"} ${D.maximum}`;else if(D.type==="date")F=`Date must be ${D.exact?"exactly":D.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(D.maximum))}`;else F="Invalid input";break;case E.custom:F="Invalid input";break;case E.invalid_intersection_types:F="Intersection results could not be merged";break;case E.not_multiple_of:F=`Number must be a multiple of ${D.multipleOf}`;break;case E.not_finite:F="Number must be finite";break;default:F=$.defaultError,x.assertNever(D)}return{message:F}},J0=SJ;var i4=J0;function TJ(D){i4=D}function J2(){return i4}var e2=(D)=>{let{data:$,path:F,errorMaps:B,issueData:q}=D,Q=[...F,...q.path||[]],X={...q,path:Q};if(q.message!==void 0)return{...q,path:Q,message:q.message};let J="",Y=B.filter((H)=>!!H).slice().reverse();for(let H of Y)J=H(X,{data:$,defaultError:J}).message;return{...q,path:Q,message:J}},PJ=[];function N(D,$){let F=J2(),B=e2({issueData:$,data:D.data,path:D.path,errorMaps:[D.common.contextualErrorMap,D.schemaErrorMap,F,F===J0?void 0:J0].filter((q)=>!!q)});D.common.issues.push(B)}class HD{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(D,$){let F=[];for(let B of $){if(B.status==="aborted")return T;if(B.status==="dirty")D.dirty();F.push(B.value)}return{status:D.value,value:F}}static async mergeObjectAsync(D,$){let F=[];for(let B of $){let q=await B.key,Q=await B.value;F.push({key:q,value:Q})}return HD.mergeObjectSync(D,F)}static mergeObjectSync(D,$){let F={};for(let B of $){let{key:q,value:Q}=B;if(q.status==="aborted")return T;if(Q.status==="aborted")return T;if(q.status==="dirty")D.dirty();if(Q.status==="dirty")D.dirty();if(q.value!=="__proto__"&&(typeof Q.value<"u"||B.alwaysSet))F[q.value]=Q.value}return{status:D.value,value:F}}}var T=Object.freeze({status:"aborted"}),h0=(D)=>({status:"dirty",value:D}),GD=(D)=>({status:"valid",value:D}),w8=(D)=>D.status==="aborted",M8=(D)=>D.status==="dirty",A0=(D)=>D.status==="valid",Y2=(D)=>typeof Promise<"u"&&D instanceof Promise;var b;(function(D){D.errToObj=($)=>typeof $==="string"?{message:$}:$||{},D.toString=($)=>typeof $==="string"?$:$?.message})(b||(b={}));class mD{constructor(D,$,F,B){this._cachedPath=[],this.parent=D,this.data=$,this._path=F,this._key=B}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var n4=(D,$)=>{if(A0($))return{success:!0,data:$.value};else{if(!D.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let F=new UD(D.common.issues);return this._error=F,this._error}}}};function y(D){if(!D)return{};let{errorMap:$,invalid_type_error:F,required_error:B,description:q}=D;if($&&(F||B))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if($)return{errorMap:$,description:q};return{errorMap:(X,J)=>{let{message:Y}=D;if(X.code==="invalid_enum_value")return{message:Y??J.defaultError};if(typeof J.data>"u")return{message:Y??B??J.defaultError};if(X.code!=="invalid_type")return{message:J.defaultError};return{message:Y??F??J.defaultError}},description:q}}class g{get description(){return this._def.description}_getType(D){return aD(D.data)}_getOrReturnCtx(D,$){return $||{common:D.parent.common,data:D.data,parsedType:aD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}_processInputParams(D){return{status:new HD,ctx:{common:D.parent.common,data:D.data,parsedType:aD(D.data),schemaErrorMap:this._def.errorMap,path:D.path,parent:D.parent}}}_parseSync(D){let $=this._parse(D);if(Y2($))throw Error("Synchronous parse encountered promise.");return $}_parseAsync(D){let $=this._parse(D);return Promise.resolve($)}parse(D,$){let F=this.safeParse(D,$);if(F.success)return F.data;throw F.error}safeParse(D,$){let F={common:{issues:[],async:$?.async??!1,contextualErrorMap:$?.errorMap},path:$?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:aD(D)},B=this._parseSync({data:D,path:F.path,parent:F});return n4(F,B)}"~validate"(D){let $={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:aD(D)};if(!this["~standard"].async)try{let F=this._parseSync({data:D,path:[],parent:$});return A0(F)?{value:F.value}:{issues:$.common.issues}}catch(F){if(F?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;$.common={issues:[],async:!0}}return this._parseAsync({data:D,path:[],parent:$}).then((F)=>A0(F)?{value:F.value}:{issues:$.common.issues})}async parseAsync(D,$){let F=await this.safeParseAsync(D,$);if(F.success)return F.data;throw F.error}async safeParseAsync(D,$){let F={common:{issues:[],contextualErrorMap:$?.errorMap,async:!0},path:$?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:D,parsedType:aD(D)},B=this._parse({data:D,path:F.path,parent:F}),q=await(Y2(B)?B:Promise.resolve(B));return n4(F,q)}refine(D,$){let F=(B)=>{if(typeof $==="string"||typeof $>"u")return{message:$};else if(typeof $==="function")return $(B);else return $};return this._refinement((B,q)=>{let Q=D(B),X=()=>q.addIssue({code:E.custom,...F(B)});if(typeof Promise<"u"&&Q instanceof Promise)return Q.then((J)=>{if(!J)return X(),!1;else return!0});if(!Q)return X(),!1;else return!0})}refinement(D,$){return this._refinement((F,B)=>{if(!D(F))return B.addIssue(typeof $==="function"?$(F,B):$),!1;else return!0})}_refinement(D){return new xD({schema:this,typeName:P.ZodEffects,effect:{type:"refinement",refinement:D}})}superRefine(D){return this._refinement(D)}constructor(D){this.spa=this.safeParseAsync,this._def=D,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:($)=>this["~validate"]($)}}optional(){return gD.create(this,this._def)}nullable(){return H0.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hD.create(this)}promise(){return l0.create(this,this._def)}or(D){return W2.create([this,D],this._def)}and(D){return u2.create(this,D,this._def)}transform(D){return new xD({...y(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:D}})}default(D){let $=typeof D==="function"?D:()=>D;return new w2({...y(this._def),innerType:this,defaultValue:$,typeName:P.ZodDefault})}brand(){return new E8({typeName:P.ZodBranded,type:this,...y(this._def)})}catch(D){let $=typeof D==="function"?D:()=>D;return new M2({...y(this._def),innerType:this,catchValue:$,typeName:P.ZodCatch})}describe(D){return new this.constructor({...this._def,description:D})}pipe(D){return X3.create(this,D)}readonly(){return K2.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var vJ=/^c[^\s-]{8,}$/i,fJ=/^[0-9a-z]+$/,kJ=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yJ=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,hJ=/^[a-z0-9_-]{21}$/i,gJ=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,mJ=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,xJ=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,lJ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",w6,dJ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pJ=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,cJ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,iJ=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nJ=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,rJ=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,a4="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",aJ=new RegExp(`^${a4}$`);function s4(D){let $="[0-5]\\d";if(D.precision)$=`${$}\\.\\d{${D.precision}}`;else if(D.precision==null)$=`${$}(\\.\\d+)?`;let F=D.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${$})${F}`}function sJ(D){return new RegExp(`^${s4(D)}$`)}function o4(D){let $=`${a4}T${s4(D)}`,F=[];if(F.push(D.local?"Z?":"Z"),D.offset)F.push("([+-]\\d{2}:?\\d{2})");return $=`${$}(${F.join("|")})`,new RegExp(`^${$}$`)}function oJ(D,$){if(($==="v4"||!$)&&dJ.test(D))return!0;if(($==="v6"||!$)&&cJ.test(D))return!0;return!1}function tJ(D,$){if(!gJ.test(D))return!1;try{let[F]=D.split(".");if(!F)return!1;let B=F.replace(/-/g,"+").replace(/_/g,"/").padEnd(F.length+(4-F.length%4)%4,"="),q=JSON.parse(atob(B));if(typeof q!=="object"||q===null)return!1;if("typ"in q&&q?.typ!=="JWT")return!1;if(!q.alg)return!1;if($&&q.alg!==$)return!1;return!0}catch{return!1}}function eJ(D,$){if(($==="v4"||!$)&&pJ.test(D))return!0;if(($==="v6"||!$)&&iJ.test(D))return!0;return!1}class yD extends g{_parse(D){if(this._def.coerce)D.data=String(D.data);if(this._getType(D)!==j.string){let q=this._getOrReturnCtx(D);return N(q,{code:E.invalid_type,expected:j.string,received:q.parsedType}),T}let F=new HD,B=void 0;for(let q of this._def.checks)if(q.kind==="min"){if(D.data.length<q.value)B=this._getOrReturnCtx(D,B),N(B,{code:E.too_small,minimum:q.value,type:"string",inclusive:!0,exact:!1,message:q.message}),F.dirty()}else if(q.kind==="max"){if(D.data.length>q.value)B=this._getOrReturnCtx(D,B),N(B,{code:E.too_big,maximum:q.value,type:"string",inclusive:!0,exact:!1,message:q.message}),F.dirty()}else if(q.kind==="length"){let Q=D.data.length>q.value,X=D.data.length<q.value;if(Q||X){if(B=this._getOrReturnCtx(D,B),Q)N(B,{code:E.too_big,maximum:q.value,type:"string",inclusive:!0,exact:!0,message:q.message});else if(X)N(B,{code:E.too_small,minimum:q.value,type:"string",inclusive:!0,exact:!0,message:q.message});F.dirty()}}else if(q.kind==="email"){if(!xJ.test(D.data))B=this._getOrReturnCtx(D,B),N(B,{validation:"email",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="emoji"){if(!w6)w6=new RegExp(lJ,"u");if(!w6.test(D.data))B=this._getOrReturnCtx(D,B),N(B,{validation:"emoji",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="uuid"){if(!yJ.test(D.data))B=this._getOrReturnCtx(D,B),N(B,{validation:"uuid",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="nanoid"){if(!hJ.test(D.data))B=this._getOrReturnCtx(D,B),N(B,{validation:"nanoid",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="cuid"){if(!vJ.test(D.data))B=this._getOrReturnCtx(D,B),N(B,{validation:"cuid",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="cuid2"){if(!fJ.test(D.data))B=this._getOrReturnCtx(D,B),N(B,{validation:"cuid2",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="ulid"){if(!kJ.test(D.data))B=this._getOrReturnCtx(D,B),N(B,{validation:"ulid",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="url")try{new URL(D.data)}catch{B=this._getOrReturnCtx(D,B),N(B,{validation:"url",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="regex"){if(q.regex.lastIndex=0,!q.regex.test(D.data))B=this._getOrReturnCtx(D,B),N(B,{validation:"regex",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="trim")D.data=D.data.trim();else if(q.kind==="includes"){if(!D.data.includes(q.value,q.position))B=this._getOrReturnCtx(D,B),N(B,{code:E.invalid_string,validation:{includes:q.value,position:q.position},message:q.message}),F.dirty()}else if(q.kind==="toLowerCase")D.data=D.data.toLowerCase();else if(q.kind==="toUpperCase")D.data=D.data.toUpperCase();else if(q.kind==="startsWith"){if(!D.data.startsWith(q.value))B=this._getOrReturnCtx(D,B),N(B,{code:E.invalid_string,validation:{startsWith:q.value},message:q.message}),F.dirty()}else if(q.kind==="endsWith"){if(!D.data.endsWith(q.value))B=this._getOrReturnCtx(D,B),N(B,{code:E.invalid_string,validation:{endsWith:q.value},message:q.message}),F.dirty()}else if(q.kind==="datetime"){if(!o4(q).test(D.data))B=this._getOrReturnCtx(D,B),N(B,{code:E.invalid_string,validation:"datetime",message:q.message}),F.dirty()}else if(q.kind==="date"){if(!aJ.test(D.data))B=this._getOrReturnCtx(D,B),N(B,{code:E.invalid_string,validation:"date",message:q.message}),F.dirty()}else if(q.kind==="time"){if(!sJ(q).test(D.data))B=this._getOrReturnCtx(D,B),N(B,{code:E.invalid_string,validation:"time",message:q.message}),F.dirty()}else if(q.kind==="duration"){if(!mJ.test(D.data))B=this._getOrReturnCtx(D,B),N(B,{validation:"duration",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="ip"){if(!oJ(D.data,q.version))B=this._getOrReturnCtx(D,B),N(B,{validation:"ip",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="jwt"){if(!tJ(D.data,q.alg))B=this._getOrReturnCtx(D,B),N(B,{validation:"jwt",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="cidr"){if(!eJ(D.data,q.version))B=this._getOrReturnCtx(D,B),N(B,{validation:"cidr",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="base64"){if(!nJ.test(D.data))B=this._getOrReturnCtx(D,B),N(B,{validation:"base64",code:E.invalid_string,message:q.message}),F.dirty()}else if(q.kind==="base64url"){if(!rJ.test(D.data))B=this._getOrReturnCtx(D,B),N(B,{validation:"base64url",code:E.invalid_string,message:q.message}),F.dirty()}else x.assertNever(q);return{status:F.value,value:D.data}}_regex(D,$,F){return this.refinement((B)=>D.test(B),{validation:$,code:E.invalid_string,...b.errToObj(F)})}_addCheck(D){return new yD({...this._def,checks:[...this._def.checks,D]})}email(D){return this._addCheck({kind:"email",...b.errToObj(D)})}url(D){return this._addCheck({kind:"url",...b.errToObj(D)})}emoji(D){return this._addCheck({kind:"emoji",...b.errToObj(D)})}uuid(D){return this._addCheck({kind:"uuid",...b.errToObj(D)})}nanoid(D){return this._addCheck({kind:"nanoid",...b.errToObj(D)})}cuid(D){return this._addCheck({kind:"cuid",...b.errToObj(D)})}cuid2(D){return this._addCheck({kind:"cuid2",...b.errToObj(D)})}ulid(D){return this._addCheck({kind:"ulid",...b.errToObj(D)})}base64(D){return this._addCheck({kind:"base64",...b.errToObj(D)})}base64url(D){return this._addCheck({kind:"base64url",...b.errToObj(D)})}jwt(D){return this._addCheck({kind:"jwt",...b.errToObj(D)})}ip(D){return this._addCheck({kind:"ip",...b.errToObj(D)})}cidr(D){return this._addCheck({kind:"cidr",...b.errToObj(D)})}datetime(D){if(typeof D==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:D});return this._addCheck({kind:"datetime",precision:typeof D?.precision>"u"?null:D?.precision,offset:D?.offset??!1,local:D?.local??!1,...b.errToObj(D?.message)})}date(D){return this._addCheck({kind:"date",message:D})}time(D){if(typeof D==="string")return this._addCheck({kind:"time",precision:null,message:D});return this._addCheck({kind:"time",precision:typeof D?.precision>"u"?null:D?.precision,...b.errToObj(D?.message)})}duration(D){return this._addCheck({kind:"duration",...b.errToObj(D)})}regex(D,$){return this._addCheck({kind:"regex",regex:D,...b.errToObj($)})}includes(D,$){return this._addCheck({kind:"includes",value:D,position:$?.position,...b.errToObj($?.message)})}startsWith(D,$){return this._addCheck({kind:"startsWith",value:D,...b.errToObj($)})}endsWith(D,$){return this._addCheck({kind:"endsWith",value:D,...b.errToObj($)})}min(D,$){return this._addCheck({kind:"min",value:D,...b.errToObj($)})}max(D,$){return this._addCheck({kind:"max",value:D,...b.errToObj($)})}length(D,$){return this._addCheck({kind:"length",value:D,...b.errToObj($)})}nonempty(D){return this.min(1,b.errToObj(D))}trim(){return new yD({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new yD({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new yD({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((D)=>D.kind==="datetime")}get isDate(){return!!this._def.checks.find((D)=>D.kind==="date")}get isTime(){return!!this._def.checks.find((D)=>D.kind==="time")}get isDuration(){return!!this._def.checks.find((D)=>D.kind==="duration")}get isEmail(){return!!this._def.checks.find((D)=>D.kind==="email")}get isURL(){return!!this._def.checks.find((D)=>D.kind==="url")}get isEmoji(){return!!this._def.checks.find((D)=>D.kind==="emoji")}get isUUID(){return!!this._def.checks.find((D)=>D.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((D)=>D.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((D)=>D.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((D)=>D.kind==="cuid2")}get isULID(){return!!this._def.checks.find((D)=>D.kind==="ulid")}get isIP(){return!!this._def.checks.find((D)=>D.kind==="ip")}get isCIDR(){return!!this._def.checks.find((D)=>D.kind==="cidr")}get isBase64(){return!!this._def.checks.find((D)=>D.kind==="base64")}get isBase64url(){return!!this._def.checks.find((D)=>D.kind==="base64url")}get minLength(){let D=null;for(let $ of this._def.checks)if($.kind==="min"){if(D===null||$.value>D)D=$.value}return D}get maxLength(){let D=null;for(let $ of this._def.checks)if($.kind==="max"){if(D===null||$.value<D)D=$.value}return D}}yD.create=(D)=>{return new yD({checks:[],typeName:P.ZodString,coerce:D?.coerce??!1,...y(D)})};function DY(D,$){let F=(D.toString().split(".")[1]||"").length,B=($.toString().split(".")[1]||"").length,q=F>B?F:B,Q=Number.parseInt(D.toFixed(q).replace(".","")),X=Number.parseInt($.toFixed(q).replace(".",""));return Q%X/10**q}class z0 extends g{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(D){if(this._def.coerce)D.data=Number(D.data);if(this._getType(D)!==j.number){let q=this._getOrReturnCtx(D);return N(q,{code:E.invalid_type,expected:j.number,received:q.parsedType}),T}let F=void 0,B=new HD;for(let q of this._def.checks)if(q.kind==="int"){if(!x.isInteger(D.data))F=this._getOrReturnCtx(D,F),N(F,{code:E.invalid_type,expected:"integer",received:"float",message:q.message}),B.dirty()}else if(q.kind==="min"){if(q.inclusive?D.data<q.value:D.data<=q.value)F=this._getOrReturnCtx(D,F),N(F,{code:E.too_small,minimum:q.value,type:"number",inclusive:q.inclusive,exact:!1,message:q.message}),B.dirty()}else if(q.kind==="max"){if(q.inclusive?D.data>q.value:D.data>=q.value)F=this._getOrReturnCtx(D,F),N(F,{code:E.too_big,maximum:q.value,type:"number",inclusive:q.inclusive,exact:!1,message:q.message}),B.dirty()}else if(q.kind==="multipleOf"){if(DY(D.data,q.value)!==0)F=this._getOrReturnCtx(D,F),N(F,{code:E.not_multiple_of,multipleOf:q.value,message:q.message}),B.dirty()}else if(q.kind==="finite"){if(!Number.isFinite(D.data))F=this._getOrReturnCtx(D,F),N(F,{code:E.not_finite,message:q.message}),B.dirty()}else x.assertNever(q);return{status:B.value,value:D.data}}gte(D,$){return this.setLimit("min",D,!0,b.toString($))}gt(D,$){return this.setLimit("min",D,!1,b.toString($))}lte(D,$){return this.setLimit("max",D,!0,b.toString($))}lt(D,$){return this.setLimit("max",D,!1,b.toString($))}setLimit(D,$,F,B){return new z0({...this._def,checks:[...this._def.checks,{kind:D,value:$,inclusive:F,message:b.toString(B)}]})}_addCheck(D){return new z0({...this._def,checks:[...this._def.checks,D]})}int(D){return this._addCheck({kind:"int",message:b.toString(D)})}positive(D){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(D)})}negative(D){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(D)})}multipleOf(D,$){return this._addCheck({kind:"multipleOf",value:D,message:b.toString($)})}finite(D){return this._addCheck({kind:"finite",message:b.toString(D)})}safe(D){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(D)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(D)})}get minValue(){let D=null;for(let $ of this._def.checks)if($.kind==="min"){if(D===null||$.value>D)D=$.value}return D}get maxValue(){let D=null;for(let $ of this._def.checks)if($.kind==="max"){if(D===null||$.value<D)D=$.value}return D}get isInt(){return!!this._def.checks.find((D)=>D.kind==="int"||D.kind==="multipleOf"&&x.isInteger(D.value))}get isFinite(){let D=null,$=null;for(let F of this._def.checks)if(F.kind==="finite"||F.kind==="int"||F.kind==="multipleOf")return!0;else if(F.kind==="min"){if($===null||F.value>$)$=F.value}else if(F.kind==="max"){if(D===null||F.value<D)D=F.value}return Number.isFinite($)&&Number.isFinite(D)}}z0.create=(D)=>{return new z0({checks:[],typeName:P.ZodNumber,coerce:D?.coerce||!1,...y(D)})};class w0 extends g{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(D){if(this._def.coerce)try{D.data=BigInt(D.data)}catch{return this._getInvalidInput(D)}if(this._getType(D)!==j.bigint)return this._getInvalidInput(D);let F=void 0,B=new HD;for(let q of this._def.checks)if(q.kind==="min"){if(q.inclusive?D.data<q.value:D.data<=q.value)F=this._getOrReturnCtx(D,F),N(F,{code:E.too_small,type:"bigint",minimum:q.value,inclusive:q.inclusive,message:q.message}),B.dirty()}else if(q.kind==="max"){if(q.inclusive?D.data>q.value:D.data>=q.value)F=this._getOrReturnCtx(D,F),N(F,{code:E.too_big,type:"bigint",maximum:q.value,inclusive:q.inclusive,message:q.message}),B.dirty()}else if(q.kind==="multipleOf"){if(D.data%q.value!==BigInt(0))F=this._getOrReturnCtx(D,F),N(F,{code:E.not_multiple_of,multipleOf:q.value,message:q.message}),B.dirty()}else x.assertNever(q);return{status:B.value,value:D.data}}_getInvalidInput(D){let $=this._getOrReturnCtx(D);return N($,{code:E.invalid_type,expected:j.bigint,received:$.parsedType}),T}gte(D,$){return this.setLimit("min",D,!0,b.toString($))}gt(D,$){return this.setLimit("min",D,!1,b.toString($))}lte(D,$){return this.setLimit("max",D,!0,b.toString($))}lt(D,$){return this.setLimit("max",D,!1,b.toString($))}setLimit(D,$,F,B){return new w0({...this._def,checks:[...this._def.checks,{kind:D,value:$,inclusive:F,message:b.toString(B)}]})}_addCheck(D){return new w0({...this._def,checks:[...this._def.checks,D]})}positive(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(D)})}negative(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(D)})}nonpositive(D){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(D)})}nonnegative(D){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(D)})}multipleOf(D,$){return this._addCheck({kind:"multipleOf",value:D,message:b.toString($)})}get minValue(){let D=null;for(let $ of this._def.checks)if($.kind==="min"){if(D===null||$.value>D)D=$.value}return D}get maxValue(){let D=null;for(let $ of this._def.checks)if($.kind==="max"){if(D===null||$.value<D)D=$.value}return D}}w0.create=(D)=>{return new w0({checks:[],typeName:P.ZodBigInt,coerce:D?.coerce??!1,...y(D)})};class _2 extends g{_parse(D){if(this._def.coerce)D.data=Boolean(D.data);if(this._getType(D)!==j.boolean){let F=this._getOrReturnCtx(D);return N(F,{code:E.invalid_type,expected:j.boolean,received:F.parsedType}),T}return GD(D.data)}}_2.create=(D)=>{return new _2({typeName:P.ZodBoolean,coerce:D?.coerce||!1,...y(D)})};class g0 extends g{_parse(D){if(this._def.coerce)D.data=new Date(D.data);if(this._getType(D)!==j.date){let q=this._getOrReturnCtx(D);return N(q,{code:E.invalid_type,expected:j.date,received:q.parsedType}),T}if(Number.isNaN(D.data.getTime())){let q=this._getOrReturnCtx(D);return N(q,{code:E.invalid_date}),T}let F=new HD,B=void 0;for(let q of this._def.checks)if(q.kind==="min"){if(D.data.getTime()<q.value)B=this._getOrReturnCtx(D,B),N(B,{code:E.too_small,message:q.message,inclusive:!0,exact:!1,minimum:q.value,type:"date"}),F.dirty()}else if(q.kind==="max"){if(D.data.getTime()>q.value)B=this._getOrReturnCtx(D,B),N(B,{code:E.too_big,message:q.message,inclusive:!0,exact:!1,maximum:q.value,type:"date"}),F.dirty()}else x.assertNever(q);return{status:F.value,value:new Date(D.data.getTime())}}_addCheck(D){return new g0({...this._def,checks:[...this._def.checks,D]})}min(D,$){return this._addCheck({kind:"min",value:D.getTime(),message:b.toString($)})}max(D,$){return this._addCheck({kind:"max",value:D.getTime(),message:b.toString($)})}get minDate(){let D=null;for(let $ of this._def.checks)if($.kind==="min"){if(D===null||$.value>D)D=$.value}return D!=null?new Date(D):null}get maxDate(){let D=null;for(let $ of this._def.checks)if($.kind==="max"){if(D===null||$.value<D)D=$.value}return D!=null?new Date(D):null}}g0.create=(D)=>{return new g0({checks:[],coerce:D?.coerce||!1,typeName:P.ZodDate,...y(D)})};class D3 extends g{_parse(D){if(this._getType(D)!==j.symbol){let F=this._getOrReturnCtx(D);return N(F,{code:E.invalid_type,expected:j.symbol,received:F.parsedType}),T}return GD(D.data)}}D3.create=(D)=>{return new D3({typeName:P.ZodSymbol,...y(D)})};class G2 extends g{_parse(D){if(this._getType(D)!==j.undefined){let F=this._getOrReturnCtx(D);return N(F,{code:E.invalid_type,expected:j.undefined,received:F.parsedType}),T}return GD(D.data)}}G2.create=(D)=>{return new G2({typeName:P.ZodUndefined,...y(D)})};class V2 extends g{_parse(D){if(this._getType(D)!==j.null){let F=this._getOrReturnCtx(D);return N(F,{code:E.invalid_type,expected:j.null,received:F.parsedType}),T}return GD(D.data)}}V2.create=(D)=>{return new V2({typeName:P.ZodNull,...y(D)})};class m0 extends g{constructor(){super(...arguments);this._any=!0}_parse(D){return GD(D.data)}}m0.create=(D)=>{return new m0({typeName:P.ZodAny,...y(D)})};class U0 extends g{constructor(){super(...arguments);this._unknown=!0}_parse(D){return GD(D.data)}}U0.create=(D)=>{return new U0({typeName:P.ZodUnknown,...y(D)})};class sD extends g{_parse(D){let $=this._getOrReturnCtx(D);return N($,{code:E.invalid_type,expected:j.never,received:$.parsedType}),T}}sD.create=(D)=>{return new sD({typeName:P.ZodNever,...y(D)})};class $3 extends g{_parse(D){if(this._getType(D)!==j.undefined){let F=this._getOrReturnCtx(D);return N(F,{code:E.invalid_type,expected:j.void,received:F.parsedType}),T}return GD(D.data)}}$3.create=(D)=>{return new $3({typeName:P.ZodVoid,...y(D)})};class hD extends g{_parse(D){let{ctx:$,status:F}=this._processInputParams(D),B=this._def;if($.parsedType!==j.array)return N($,{code:E.invalid_type,expected:j.array,received:$.parsedType}),T;if(B.exactLength!==null){let Q=$.data.length>B.exactLength.value,X=$.data.length<B.exactLength.value;if(Q||X)N($,{code:Q?E.too_big:E.too_small,minimum:X?B.exactLength.value:void 0,maximum:Q?B.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:B.exactLength.message}),F.dirty()}if(B.minLength!==null){if($.data.length<B.minLength.value)N($,{code:E.too_small,minimum:B.minLength.value,type:"array",inclusive:!0,exact:!1,message:B.minLength.message}),F.dirty()}if(B.maxLength!==null){if($.data.length>B.maxLength.value)N($,{code:E.too_big,maximum:B.maxLength.value,type:"array",inclusive:!0,exact:!1,message:B.maxLength.message}),F.dirty()}if($.common.async)return Promise.all([...$.data].map((Q,X)=>{return B.type._parseAsync(new mD($,Q,$.path,X))})).then((Q)=>{return HD.mergeArray(F,Q)});let q=[...$.data].map((Q,X)=>{return B.type._parseSync(new mD($,Q,$.path,X))});return HD.mergeArray(F,q)}get element(){return this._def.type}min(D,$){return new hD({...this._def,minLength:{value:D,message:b.toString($)}})}max(D,$){return new hD({...this._def,maxLength:{value:D,message:b.toString($)}})}length(D,$){return new hD({...this._def,exactLength:{value:D,message:b.toString($)}})}nonempty(D){return this.min(1,D)}}hD.create=(D,$)=>{return new hD({type:D,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...y($)})};function H2(D){if(D instanceof o){let $={};for(let F in D.shape){let B=D.shape[F];$[F]=gD.create(H2(B))}return new o({...D._def,shape:()=>$})}else if(D instanceof hD)return new hD({...D._def,type:H2(D.element)});else if(D instanceof gD)return gD.create(H2(D.unwrap()));else if(D instanceof H0)return H0.create(H2(D.unwrap()));else if(D instanceof oD)return oD.create(D.items.map(($)=>H2($)));else return D}class o extends g{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let D=this._def.shape(),$=x.objectKeys(D);return this._cached={shape:D,keys:$},this._cached}_parse(D){if(this._getType(D)!==j.object){let Y=this._getOrReturnCtx(D);return N(Y,{code:E.invalid_type,expected:j.object,received:Y.parsedType}),T}let{status:F,ctx:B}=this._processInputParams(D),{shape:q,keys:Q}=this._getCached(),X=[];if(!(this._def.catchall instanceof sD&&this._def.unknownKeys==="strip")){for(let Y in B.data)if(!Q.includes(Y))X.push(Y)}let J=[];for(let Y of Q){let H=q[Y],C=B.data[Y];J.push({key:{status:"valid",value:Y},value:H._parse(new mD(B,C,B.path,Y)),alwaysSet:Y in B.data})}if(this._def.catchall instanceof sD){let Y=this._def.unknownKeys;if(Y==="passthrough")for(let H of X)J.push({key:{status:"valid",value:H},value:{status:"valid",value:B.data[H]}});else if(Y==="strict"){if(X.length>0)N(B,{code:E.unrecognized_keys,keys:X}),F.dirty()}else if(Y==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let Y=this._def.catchall;for(let H of X){let C=B.data[H];J.push({key:{status:"valid",value:H},value:Y._parse(new mD(B,C,B.path,H)),alwaysSet:H in B.data})}}if(B.common.async)return Promise.resolve().then(async()=>{let Y=[];for(let H of J){let C=await H.key,_=await H.value;Y.push({key:C,value:_,alwaysSet:H.alwaysSet})}return Y}).then((Y)=>{return HD.mergeObjectSync(F,Y)});else return HD.mergeObjectSync(F,J)}get shape(){return this._def.shape()}strict(D){return b.errToObj,new o({...this._def,unknownKeys:"strict",...D!==void 0?{errorMap:($,F)=>{let B=this._def.errorMap?.($,F).message??F.defaultError;if($.code==="unrecognized_keys")return{message:b.errToObj(D).message??B};return{message:B}}}:{}})}strip(){return new o({...this._def,unknownKeys:"strip"})}passthrough(){return new o({...this._def,unknownKeys:"passthrough"})}extend(D){return new o({...this._def,shape:()=>({...this._def.shape(),...D})})}merge(D){return new o({unknownKeys:D._def.unknownKeys,catchall:D._def.catchall,shape:()=>({...this._def.shape(),...D._def.shape()}),typeName:P.ZodObject})}setKey(D,$){return this.augment({[D]:$})}catchall(D){return new o({...this._def,catchall:D})}pick(D){let $={};for(let F of x.objectKeys(D))if(D[F]&&this.shape[F])$[F]=this.shape[F];return new o({...this._def,shape:()=>$})}omit(D){let $={};for(let F of x.objectKeys(this.shape))if(!D[F])$[F]=this.shape[F];return new o({...this._def,shape:()=>$})}deepPartial(){return H2(this)}partial(D){let $={};for(let F of x.objectKeys(this.shape)){let B=this.shape[F];if(D&&!D[F])$[F]=B;else $[F]=B.optional()}return new o({...this._def,shape:()=>$})}required(D){let $={};for(let F of x.objectKeys(this.shape))if(D&&!D[F])$[F]=this.shape[F];else{let q=this.shape[F];while(q instanceof gD)q=q._def.innerType;$[F]=q}return new o({...this._def,shape:()=>$})}keyof(){return t4(x.objectKeys(this.shape))}}o.create=(D,$)=>{return new o({shape:()=>D,unknownKeys:"strip",catchall:sD.create(),typeName:P.ZodObject,...y($)})};o.strictCreate=(D,$)=>{return new o({shape:()=>D,unknownKeys:"strict",catchall:sD.create(),typeName:P.ZodObject,...y($)})};o.lazycreate=(D,$)=>{return new o({shape:D,unknownKeys:"strip",catchall:sD.create(),typeName:P.ZodObject,...y($)})};class W2 extends g{_parse(D){let{ctx:$}=this._processInputParams(D),F=this._def.options;function B(q){for(let X of q)if(X.result.status==="valid")return X.result;for(let X of q)if(X.result.status==="dirty")return $.common.issues.push(...X.ctx.common.issues),X.result;let Q=q.map((X)=>new UD(X.ctx.common.issues));return N($,{code:E.invalid_union,unionErrors:Q}),T}if($.common.async)return Promise.all(F.map(async(q)=>{let Q={...$,common:{...$.common,issues:[]},parent:null};return{result:await q._parseAsync({data:$.data,path:$.path,parent:Q}),ctx:Q}})).then(B);else{let q=void 0,Q=[];for(let J of F){let Y={...$,common:{...$.common,issues:[]},parent:null},H=J._parseSync({data:$.data,path:$.path,parent:Y});if(H.status==="valid")return H;else if(H.status==="dirty"&&!q)q={result:H,ctx:Y};if(Y.common.issues.length)Q.push(Y.common.issues)}if(q)return $.common.issues.push(...q.ctx.common.issues),q.result;let X=Q.map((J)=>new UD(J));return N($,{code:E.invalid_union,unionErrors:X}),T}}get options(){return this._def.options}}W2.create=(D,$)=>{return new W2({options:D,typeName:P.ZodUnion,...y($)})};var Y0=(D)=>{if(D instanceof A2)return Y0(D.schema);else if(D instanceof xD)return Y0(D.innerType());else if(D instanceof U2)return[D.value];else if(D instanceof M0)return D.options;else if(D instanceof z2)return x.objectValues(D.enum);else if(D instanceof w2)return Y0(D._def.innerType);else if(D instanceof G2)return[void 0];else if(D instanceof V2)return[null];else if(D instanceof gD)return[void 0,...Y0(D.unwrap())];else if(D instanceof H0)return[null,...Y0(D.unwrap())];else if(D instanceof E8)return Y0(D.unwrap());else if(D instanceof K2)return Y0(D.unwrap());else if(D instanceof M2)return Y0(D._def.innerType);else return[]};class K8 extends g{_parse(D){let{ctx:$}=this._processInputParams(D);if($.parsedType!==j.object)return N($,{code:E.invalid_type,expected:j.object,received:$.parsedType}),T;let F=this.discriminator,B=$.data[F],q=this.optionsMap.get(B);if(!q)return N($,{code:E.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[F]}),T;if($.common.async)return q._parseAsync({data:$.data,path:$.path,parent:$});else return q._parseSync({data:$.data,path:$.path,parent:$})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(D,$,F){let B=new Map;for(let q of $){let Q=Y0(q.shape[D]);if(!Q.length)throw Error(`A discriminator value for key \`${D}\` could not be extracted from all schema options`);for(let X of Q){if(B.has(X))throw Error(`Discriminator property ${String(D)} has duplicate value ${String(X)}`);B.set(X,q)}}return new K8({typeName:P.ZodDiscriminatedUnion,discriminator:D,options:$,optionsMap:B,...y(F)})}}function M6(D,$){let F=aD(D),B=aD($);if(D===$)return{valid:!0,data:D};else if(F===j.object&&B===j.object){let q=x.objectKeys($),Q=x.objectKeys(D).filter((J)=>q.indexOf(J)!==-1),X={...D,...$};for(let J of Q){let Y=M6(D[J],$[J]);if(!Y.valid)return{valid:!1};X[J]=Y.data}return{valid:!0,data:X}}else if(F===j.array&&B===j.array){if(D.length!==$.length)return{valid:!1};let q=[];for(let Q=0;Q<D.length;Q++){let X=D[Q],J=$[Q],Y=M6(X,J);if(!Y.valid)return{valid:!1};q.push(Y.data)}return{valid:!0,data:q}}else if(F===j.date&&B===j.date&&+D===+$)return{valid:!0,data:D};else return{valid:!1}}class u2 extends g{_parse(D){let{status:$,ctx:F}=this._processInputParams(D),B=(q,Q)=>{if(w8(q)||w8(Q))return T;let X=M6(q.value,Q.value);if(!X.valid)return N(F,{code:E.invalid_intersection_types}),T;if(M8(q)||M8(Q))$.dirty();return{status:$.value,value:X.data}};if(F.common.async)return Promise.all([this._def.left._parseAsync({data:F.data,path:F.path,parent:F}),this._def.right._parseAsync({data:F.data,path:F.path,parent:F})]).then(([q,Q])=>B(q,Q));else return B(this._def.left._parseSync({data:F.data,path:F.path,parent:F}),this._def.right._parseSync({data:F.data,path:F.path,parent:F}))}}u2.create=(D,$,F)=>{return new u2({left:D,right:$,typeName:P.ZodIntersection,...y(F)})};class oD extends g{_parse(D){let{status:$,ctx:F}=this._processInputParams(D);if(F.parsedType!==j.array)return N(F,{code:E.invalid_type,expected:j.array,received:F.parsedType}),T;if(F.data.length<this._def.items.length)return N(F,{code:E.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),T;if(!this._def.rest&&F.data.length>this._def.items.length)N(F,{code:E.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$.dirty();let q=[...F.data].map((Q,X)=>{let J=this._def.items[X]||this._def.rest;if(!J)return null;return J._parse(new mD(F,Q,F.path,X))}).filter((Q)=>!!Q);if(F.common.async)return Promise.all(q).then((Q)=>{return HD.mergeArray($,Q)});else return HD.mergeArray($,q)}get items(){return this._def.items}rest(D){return new oD({...this._def,rest:D})}}oD.create=(D,$)=>{if(!Array.isArray(D))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new oD({items:D,typeName:P.ZodTuple,rest:null,...y($)})};class F3 extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:$,ctx:F}=this._processInputParams(D);if(F.parsedType!==j.object)return N(F,{code:E.invalid_type,expected:j.object,received:F.parsedType}),T;let B=[],q=this._def.keyType,Q=this._def.valueType;for(let X in F.data)B.push({key:q._parse(new mD(F,X,F.path,X)),value:Q._parse(new mD(F,F.data[X],F.path,X)),alwaysSet:X in F.data});if(F.common.async)return HD.mergeObjectAsync($,B);else return HD.mergeObjectSync($,B)}get element(){return this._def.valueType}static create(D,$,F){if($ instanceof g)return new F3({keyType:D,valueType:$,typeName:P.ZodRecord,...y(F)});return new F3({keyType:yD.create(),valueType:D,typeName:P.ZodRecord,...y($)})}}class B3 extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(D){let{status:$,ctx:F}=this._processInputParams(D);if(F.parsedType!==j.map)return N(F,{code:E.invalid_type,expected:j.map,received:F.parsedType}),T;let B=this._def.keyType,q=this._def.valueType,Q=[...F.data.entries()].map(([X,J],Y)=>{return{key:B._parse(new mD(F,X,F.path,[Y,"key"])),value:q._parse(new mD(F,J,F.path,[Y,"value"]))}});if(F.common.async){let X=new Map;return Promise.resolve().then(async()=>{for(let J of Q){let Y=await J.key,H=await J.value;if(Y.status==="aborted"||H.status==="aborted")return T;if(Y.status==="dirty"||H.status==="dirty")$.dirty();X.set(Y.value,H.value)}return{status:$.value,value:X}})}else{let X=new Map;for(let J of Q){let{key:Y,value:H}=J;if(Y.status==="aborted"||H.status==="aborted")return T;if(Y.status==="dirty"||H.status==="dirty")$.dirty();X.set(Y.value,H.value)}return{status:$.value,value:X}}}}B3.create=(D,$,F)=>{return new B3({valueType:$,keyType:D,typeName:P.ZodMap,...y(F)})};class x0 extends g{_parse(D){let{status:$,ctx:F}=this._processInputParams(D);if(F.parsedType!==j.set)return N(F,{code:E.invalid_type,expected:j.set,received:F.parsedType}),T;let B=this._def;if(B.minSize!==null){if(F.data.size<B.minSize.value)N(F,{code:E.too_small,minimum:B.minSize.value,type:"set",inclusive:!0,exact:!1,message:B.minSize.message}),$.dirty()}if(B.maxSize!==null){if(F.data.size>B.maxSize.value)N(F,{code:E.too_big,maximum:B.maxSize.value,type:"set",inclusive:!0,exact:!1,message:B.maxSize.message}),$.dirty()}let q=this._def.valueType;function Q(J){let Y=new Set;for(let H of J){if(H.status==="aborted")return T;if(H.status==="dirty")$.dirty();Y.add(H.value)}return{status:$.value,value:Y}}let X=[...F.data.values()].map((J,Y)=>q._parse(new mD(F,J,F.path,Y)));if(F.common.async)return Promise.all(X).then((J)=>Q(J));else return Q(X)}min(D,$){return new x0({...this._def,minSize:{value:D,message:b.toString($)}})}max(D,$){return new x0({...this._def,maxSize:{value:D,message:b.toString($)}})}size(D,$){return this.min(D,$).max(D,$)}nonempty(D){return this.min(1,D)}}x0.create=(D,$)=>{return new x0({valueType:D,minSize:null,maxSize:null,typeName:P.ZodSet,...y($)})};class C2 extends g{constructor(){super(...arguments);this.validate=this.implement}_parse(D){let{ctx:$}=this._processInputParams(D);if($.parsedType!==j.function)return N($,{code:E.invalid_type,expected:j.function,received:$.parsedType}),T;function F(X,J){return e2({data:X,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,J2(),J0].filter((Y)=>!!Y),issueData:{code:E.invalid_arguments,argumentsError:J}})}function B(X,J){return e2({data:X,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,J2(),J0].filter((Y)=>!!Y),issueData:{code:E.invalid_return_type,returnTypeError:J}})}let q={errorMap:$.common.contextualErrorMap},Q=$.data;if(this._def.returns instanceof l0){let X=this;return GD(async function(...J){let Y=new UD([]),H=await X._def.args.parseAsync(J,q).catch((G)=>{throw Y.addIssue(F(J,G)),Y}),C=await Reflect.apply(Q,this,H);return await X._def.returns._def.type.parseAsync(C,q).catch((G)=>{throw Y.addIssue(B(C,G)),Y})})}else{let X=this;return GD(function(...J){let Y=X._def.args.safeParse(J,q);if(!Y.success)throw new UD([F(J,Y.error)]);let H=Reflect.apply(Q,this,Y.data),C=X._def.returns.safeParse(H,q);if(!C.success)throw new UD([B(H,C.error)]);return C.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...D){return new C2({...this._def,args:oD.create(D).rest(U0.create())})}returns(D){return new C2({...this._def,returns:D})}implement(D){return this.parse(D)}strictImplement(D){return this.parse(D)}static create(D,$,F){return new C2({args:D?D:oD.create([]).rest(U0.create()),returns:$||U0.create(),typeName:P.ZodFunction,...y(F)})}}class A2 extends g{get schema(){return this._def.getter()}_parse(D){let{ctx:$}=this._processInputParams(D);return this._def.getter()._parse({data:$.data,path:$.path,parent:$})}}A2.create=(D,$)=>{return new A2({getter:D,typeName:P.ZodLazy,...y($)})};class U2 extends g{_parse(D){if(D.data!==this._def.value){let $=this._getOrReturnCtx(D);return N($,{received:$.data,code:E.invalid_literal,expected:this._def.value}),T}return{status:"valid",value:D.data}}get value(){return this._def.value}}U2.create=(D,$)=>{return new U2({value:D,typeName:P.ZodLiteral,...y($)})};function t4(D,$){return new M0({values:D,typeName:P.ZodEnum,...y($)})}class M0 extends g{_parse(D){if(typeof D.data!=="string"){let $=this._getOrReturnCtx(D),F=this._def.values;return N($,{expected:x.joinValues(F),received:$.parsedType,code:E.invalid_type}),T}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(D.data)){let $=this._getOrReturnCtx(D),F=this._def.values;return N($,{received:$.data,code:E.invalid_enum_value,options:F}),T}return GD(D.data)}get options(){return this._def.values}get enum(){let D={};for(let $ of this._def.values)D[$]=$;return D}get Values(){let D={};for(let $ of this._def.values)D[$]=$;return D}get Enum(){let D={};for(let $ of this._def.values)D[$]=$;return D}extract(D,$=this._def){return M0.create(D,{...this._def,...$})}exclude(D,$=this._def){return M0.create(this.options.filter((F)=>!D.includes(F)),{...this._def,...$})}}M0.create=t4;class z2 extends g{_parse(D){let $=x.getValidEnumValues(this._def.values),F=this._getOrReturnCtx(D);if(F.parsedType!==j.string&&F.parsedType!==j.number){let B=x.objectValues($);return N(F,{expected:x.joinValues(B),received:F.parsedType,code:E.invalid_type}),T}if(!this._cache)this._cache=new Set(x.getValidEnumValues(this._def.values));if(!this._cache.has(D.data)){let B=x.objectValues($);return N(F,{received:F.data,code:E.invalid_enum_value,options:B}),T}return GD(D.data)}get enum(){return this._def.values}}z2.create=(D,$)=>{return new z2({values:D,typeName:P.ZodNativeEnum,...y($)})};class l0 extends g{unwrap(){return this._def.type}_parse(D){let{ctx:$}=this._processInputParams(D);if($.parsedType!==j.promise&&$.common.async===!1)return N($,{code:E.invalid_type,expected:j.promise,received:$.parsedType}),T;let F=$.parsedType===j.promise?$.data:Promise.resolve($.data);return GD(F.then((B)=>{return this._def.type.parseAsync(B,{path:$.path,errorMap:$.common.contextualErrorMap})}))}}l0.create=(D,$)=>{return new l0({type:D,typeName:P.ZodPromise,...y($)})};class xD extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(D){let{status:$,ctx:F}=this._processInputParams(D),B=this._def.effect||null,q={addIssue:(Q)=>{if(N(F,Q),Q.fatal)$.abort();else $.dirty()},get path(){return F.path}};if(q.addIssue=q.addIssue.bind(q),B.type==="preprocess"){let Q=B.transform(F.data,q);if(F.common.async)return Promise.resolve(Q).then(async(X)=>{if($.value==="aborted")return T;let J=await this._def.schema._parseAsync({data:X,path:F.path,parent:F});if(J.status==="aborted")return T;if(J.status==="dirty")return h0(J.value);if($.value==="dirty")return h0(J.value);return J});else{if($.value==="aborted")return T;let X=this._def.schema._parseSync({data:Q,path:F.path,parent:F});if(X.status==="aborted")return T;if(X.status==="dirty")return h0(X.value);if($.value==="dirty")return h0(X.value);return X}}if(B.type==="refinement"){let Q=(X)=>{let J=B.refinement(X,q);if(F.common.async)return Promise.resolve(J);if(J instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return X};if(F.common.async===!1){let X=this._def.schema._parseSync({data:F.data,path:F.path,parent:F});if(X.status==="aborted")return T;if(X.status==="dirty")$.dirty();return Q(X.value),{status:$.value,value:X.value}}else return this._def.schema._parseAsync({data:F.data,path:F.path,parent:F}).then((X)=>{if(X.status==="aborted")return T;if(X.status==="dirty")$.dirty();return Q(X.value).then(()=>{return{status:$.value,value:X.value}})})}if(B.type==="transform")if(F.common.async===!1){let Q=this._def.schema._parseSync({data:F.data,path:F.path,parent:F});if(!A0(Q))return T;let X=B.transform(Q.value,q);if(X instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:$.value,value:X}}else return this._def.schema._parseAsync({data:F.data,path:F.path,parent:F}).then((Q)=>{if(!A0(Q))return T;return Promise.resolve(B.transform(Q.value,q)).then((X)=>({status:$.value,value:X}))});x.assertNever(B)}}xD.create=(D,$,F)=>{return new xD({schema:D,typeName:P.ZodEffects,effect:$,...y(F)})};xD.createWithPreprocess=(D,$,F)=>{return new xD({schema:$,effect:{type:"preprocess",transform:D},typeName:P.ZodEffects,...y(F)})};class gD extends g{_parse(D){if(this._getType(D)===j.undefined)return GD(void 0);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}gD.create=(D,$)=>{return new gD({innerType:D,typeName:P.ZodOptional,...y($)})};class H0 extends g{_parse(D){if(this._getType(D)===j.null)return GD(null);return this._def.innerType._parse(D)}unwrap(){return this._def.innerType}}H0.create=(D,$)=>{return new H0({innerType:D,typeName:P.ZodNullable,...y($)})};class w2 extends g{_parse(D){let{ctx:$}=this._processInputParams(D),F=$.data;if($.parsedType===j.undefined)F=this._def.defaultValue();return this._def.innerType._parse({data:F,path:$.path,parent:$})}removeDefault(){return this._def.innerType}}w2.create=(D,$)=>{return new w2({innerType:D,typeName:P.ZodDefault,defaultValue:typeof $.default==="function"?$.default:()=>$.default,...y($)})};class M2 extends g{_parse(D){let{ctx:$}=this._processInputParams(D),F={...$,common:{...$.common,issues:[]}},B=this._def.innerType._parse({data:F.data,path:F.path,parent:{...F}});if(Y2(B))return B.then((q)=>{return{status:"valid",value:q.status==="valid"?q.value:this._def.catchValue({get error(){return new UD(F.common.issues)},input:F.data})}});else return{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new UD(F.common.issues)},input:F.data})}}removeCatch(){return this._def.innerType}}M2.create=(D,$)=>{return new M2({innerType:D,typeName:P.ZodCatch,catchValue:typeof $.catch==="function"?$.catch:()=>$.catch,...y($)})};class q3 extends g{_parse(D){if(this._getType(D)!==j.nan){let F=this._getOrReturnCtx(D);return N(F,{code:E.invalid_type,expected:j.nan,received:F.parsedType}),T}return{status:"valid",value:D.data}}}q3.create=(D)=>{return new q3({typeName:P.ZodNaN,...y(D)})};var $Y=Symbol("zod_brand");class E8 extends g{_parse(D){let{ctx:$}=this._processInputParams(D),F=$.data;return this._def.type._parse({data:F,path:$.path,parent:$})}unwrap(){return this._def.type}}class X3 extends g{_parse(D){let{status:$,ctx:F}=this._processInputParams(D);if(F.common.async)return(async()=>{let q=await this._def.in._parseAsync({data:F.data,path:F.path,parent:F});if(q.status==="aborted")return T;if(q.status==="dirty")return $.dirty(),h0(q.value);else return this._def.out._parseAsync({data:q.value,path:F.path,parent:F})})();else{let B=this._def.in._parseSync({data:F.data,path:F.path,parent:F});if(B.status==="aborted")return T;if(B.status==="dirty")return $.dirty(),{status:"dirty",value:B.value};else return this._def.out._parseSync({data:B.value,path:F.path,parent:F})}}static create(D,$){return new X3({in:D,out:$,typeName:P.ZodPipeline})}}class K2 extends g{_parse(D){let $=this._def.innerType._parse(D),F=(B)=>{if(A0(B))B.value=Object.freeze(B.value);return B};return Y2($)?$.then((B)=>F(B)):F($)}unwrap(){return this._def.innerType}}K2.create=(D,$)=>{return new K2({innerType:D,typeName:P.ZodReadonly,...y($)})};function r4(D,$){let F=typeof D==="function"?D($):typeof D==="string"?{message:D}:D;return typeof F==="string"?{message:F}:F}function e4(D,$={},F){if(D)return m0.create().superRefine((B,q)=>{let Q=D(B);if(Q instanceof Promise)return Q.then((X)=>{if(!X){let J=r4($,B),Y=J.fatal??F??!0;q.addIssue({code:"custom",...J,fatal:Y})}});if(!Q){let X=r4($,B),J=X.fatal??F??!0;q.addIssue({code:"custom",...X,fatal:J})}return});return m0.create()}var FY={object:o.lazycreate},P;(function(D){D.ZodString="ZodString",D.ZodNumber="ZodNumber",D.ZodNaN="ZodNaN",D.ZodBigInt="ZodBigInt",D.ZodBoolean="ZodBoolean",D.ZodDate="ZodDate",D.ZodSymbol="ZodSymbol",D.ZodUndefined="ZodUndefined",D.ZodNull="ZodNull",D.ZodAny="ZodAny",D.ZodUnknown="ZodUnknown",D.ZodNever="ZodNever",D.ZodVoid="ZodVoid",D.ZodArray="ZodArray",D.ZodObject="ZodObject",D.ZodUnion="ZodUnion",D.ZodDiscriminatedUnion="ZodDiscriminatedUnion",D.ZodIntersection="ZodIntersection",D.ZodTuple="ZodTuple",D.ZodRecord="ZodRecord",D.ZodMap="ZodMap",D.ZodSet="ZodSet",D.ZodFunction="ZodFunction",D.ZodLazy="ZodLazy",D.ZodLiteral="ZodLiteral",D.ZodEnum="ZodEnum",D.ZodEffects="ZodEffects",D.ZodNativeEnum="ZodNativeEnum",D.ZodOptional="ZodOptional",D.ZodNullable="ZodNullable",D.ZodDefault="ZodDefault",D.ZodCatch="ZodCatch",D.ZodPromise="ZodPromise",D.ZodBranded="ZodBranded",D.ZodPipeline="ZodPipeline",D.ZodReadonly="ZodReadonly"})(P||(P={}));var BY=(D,$={message:`Input not instance of ${D.name}`})=>e4((F)=>F instanceof D,$),D5=yD.create,$5=z0.create,qY=q3.create,XY=w0.create,F5=_2.create,QY=g0.create,JY=D3.create,YY=G2.create,HY=V2.create,CY=m0.create,_Y=U0.create,GY=sD.create,VY=$3.create,WY=hD.create,uY=o.create,AY=o.strictCreate,UY=W2.create,zY=K8.create,wY=u2.create,MY=oD.create,KY=F3.create,EY=B3.create,OY=x0.create,jY=C2.create,RY=A2.create,NY=U2.create,LY=M0.create,IY=z2.create,ZY=l0.create,bY=xD.create,SY=gD.create,TY=H0.create,PY=xD.createWithPreprocess,vY=X3.create,fY=()=>D5().optional(),kY=()=>$5().optional(),yY=()=>F5().optional(),hY={string:(D)=>yD.create({...D,coerce:!0}),number:(D)=>z0.create({...D,coerce:!0}),boolean:(D)=>_2.create({...D,coerce:!0}),bigint:(D)=>w0.create({...D,coerce:!0}),date:(D)=>g0.create({...D,coerce:!0})};var gY=T;import{join as E6}from"path";import{homedir as mY}from"os";import{readFile as q5,writeFile as xY,mkdir as lY,access as dY}from"node:fs/promises";var pY=m.object({name:m.string(),enabled:m.boolean().optional(),model:m.string().optional(),temperature:m.number().min(0).max(2).optional(),maxTokens:m.number().positive().optional(),timeout:m.number().positive().optional()}),O6=m.object({excludePatterns:m.array(m.string()).default(["*.min.js","*.min.css","*.map","*.d.ts","dist/**","build/**","out/**",".next/**","coverage/**","node_modules/**","vendor/**","*.generated.*","*.bundle.js"]),concurrency:m.number().min(1).max(10).default(3),output:m.object({colorize:m.boolean().default(!0),verbose:m.boolean().default(!1),format:m.enum(["terminal","markdown","json"]).default("terminal")}).default({}),executors:m.array(pY).default([]),stages:m.array(m.object({id:m.string(),enabled:m.boolean(),order:m.number().optional()})).default([])}),j6=E6(mY(),".diffray"),Q3=E6(j6,"config.json"),B5=E6(j6,"instructions.md");function K6(){return O6.parse({})}async function R6(D){try{return await dY(D),!0}catch($){if($ instanceof Error&&"code"in $&&$.code==="ENOENT")return!1;throw $}}async function OD(){return Q0(KD.CONFIG,async()=>{try{if(!await R6(Q3)){let B=K6();return await J3(B),B}let $=await q5(Q3,"utf-8"),F=JSON.parse($);return O6.parse(F)}catch(D){return console.warn(`Warning: Failed to load config, using defaults. Error: ${D}`),K6()}})}async function J3(D){try{await lY(j6,{recursive:!0}),await xY(Q3,JSON.stringify(D,null,2)),P4(KD.CONFIG,D)}catch($){throw Error(`Failed to save config: ${$}`)}}async function O8(D){let $=await OD(),F={...$,excludePatterns:D.excludePatterns!==void 0?D.excludePatterns:$.excludePatterns,output:D.output?{...$.output,...D.output}:$.output,executors:D.executors!==void 0?D.executors:$.executors,stages:D.stages!==void 0?D.stages:$.stages},B=O6.parse(F);return await J3(B),B}function d0(){return Q3}async function j8(){let D=K6();return await J3(D),D}async function N6(){return R6(Q3)}function X5(){o2(KD.CONFIG),o2(KD.INSTRUCTIONS)}async function Q5(){return Q0(KD.INSTRUCTIONS,async()=>{try{if(!await R6(B5))return"";return await q5(B5,"utf-8")}catch{return""}})}s();x2();Z1();s();function SB(D,$){let F=D.name;if(typeof F!=="string")return null;let B=$.trim();if(!B)return null;let q=D.executorSettings&&typeof D.executorSettings==="object"&&!Array.isArray(D.executorSettings)?D.executorSettings:void 0,Q=D.stage==="validation"?"validation":"review";return{name:F,description:typeof D.description==="string"?D.description:"",systemPrompt:B,enabled:typeof D.enabled==="boolean"?D.enabled:!0,order:typeof D.order==="number"?D.order:0,executor:typeof D.executor==="string"?D.executor:"test-cli",stage:Q,...q&&{executorSettings:q}}}async function TB(D){try{return await g2(D,SB)}catch($){return V.error(`Error loading agent markdown from ${D}:`,$),[]}}async function PB(D){let{glob:$}=await Promise.resolve().then(() => ($9(),H$)),{join:F}=await import("node:path");try{let B=await $("*.md",{cwd:D}),q=[],Q=[],X=await Promise.all(B.map(async(J)=>{let Y=F(D,J);try{return{agents:(await g2(Y,SB)).map((C)=>({...C,path:Y})),failed:null}}catch(H){return V.error(`Error loading agent from ${J}:`,H),{agents:[],failed:J}}}));if(q.push(...X.flatMap((J)=>J.agents)),Q.push(...X.map((J)=>J.failed).filter((J)=>J!==null)),Q.length>0)V.warn(`Loaded ${q.length}/${B.length} agents, ${Q.length} failed: ${Q.join(", ")}`);return q}catch(B){if(B.code==="ENOENT")return[];throw B}}Z1();async function B2(D){let $=D||process.cwd();return OB("agents",PB,$)}s();function vB(){return{id:"load-rules",name:"Load Rules",description:"Load matching rules and agents",enabled:!0,order:0,execute:async(D)=>{let $=Date.now(),[F,B]=await Promise.all([P0(),B2()]);if(D.ruleRefs=F,D.agents=B,!D.quiet)V.sync(`Loaded ${F.length} rule(s), ${B.length} agent(s)`);return{stageId:"load-rules",stageName:"Load Rules",success:!0,duration:Date.now()-$}}}}x2();s();function fB(){return{id:"match-rules",name:"Match Rules",description:"Match rules to files",enabled:!0,order:1,execute:async(D)=>{let $=Date.now(),F=D.ruleRefs??[],B=D.agents??[],q=await A7(F,D.diffs,B);if(D.matchedRules=q,!D.quiet){V.sync(`Matched ${q.length} rule(s)`);for(let Q of q)V.plain(` ${Q.rule.name}: ${Q.files.length} file(s) → ${Q.agent.name}`)}return{stageId:"match-rules",stageName:"Match Rules",success:!0,duration:Date.now()-$}}}}class z7{items=new Map;register(D){this.items.set(D.name,D)}get(D){return this.items.get(D)}list(){return Array.from(this.items.values())}remove(D){this.items.delete(D)}clear(){this.items.clear()}count(){return this.items.size}}class kB extends z7{listEnabled(){return this.list().filter((D)=>D.enabled)}enable(D){let $=this.get(D);if($)$.enabled=!0}disable(D){let $=this.get(D);if($)$.enabled=!1}setExecutor(D,$){let F=this.get(D);if(F)F.executor=$}countEnabled(){return this.list().filter((D)=>D.enabled).length}}var l2=new kB;s();s();import{readFile as fw}from"node:fs/promises";import{join as kw,dirname as yw}from"path";import{fileURLToPath as hw}from"url";var gw=3,yB=1000;async function hB(D){return new Promise(($)=>setTimeout($,D))}async function gB(D,$,F=gw){let B;for(let q=0;q<F;q++)try{let Q=await fetch(D,$);if(Q.ok||Q.status>=400&&Q.status<500&&Q.status!==429)return Q;if(B=Error(`HTTP ${Q.status}`),q<F-1){let X=yB*Math.pow(2,q);if(process.env.DEBUG)V.plain(`⏳ Retry ${q+1}/${F-1} after ${X}ms (${Q.status})`);await hB(X)}}catch(Q){if(B=Q instanceof Error?Q:Error(String(Q)),q<F-1){let X=yB*Math.pow(2,q);if(process.env.DEBUG)V.plain(`⏳ Retry ${q+1}/${F-1} after ${X}ms (${B.message})`);await hB(X)}}throw B||Error("Max retries exceeded")}var mw=`# Output Format
242
-
243
- Return your findings as a **JSON array** wrapped in \`<json>...</json>\` XML tags:
244
-
245
- <json>
246
- [
247
- {
248
- "file": "path/to/file.ts",
249
- "lineStart": 10,
250
- "lineEnd": 15,
251
- "severity": "critical|high|medium|low",
252
- "category": "security|performance|bug|quality|style|docs",
253
- "shortDescription": "Brief one-line description",
254
- "fullDescription": "Detailed description of the issue",
255
- "suggestion": "How to fix this issue (optional)"
256
- }
257
- ]
258
- </json>
259
-
260
- Return empty array if no issues found: \`<json>[]</json>\`
261
- `;async function b1(){return Q0(KD.OUTPUT_FORMAT,async()=>{try{let D=hw(import.meta.url),$=yw(D),F=kw($,"..","defaults","prompts","output-format.md");return await fw(F,"utf-8")}catch{return mw}})}function S1(D,$,F){return`${D}
262
-
263
- # Input:
264
- ${$}
265
-
266
- ${F}`}function T1(D,$){return`${D}
267
-
268
- ${$}`}function F0(D,$,F,B,q,Q){return{agent:D.agent.name,executor:D.executor.name,success:$,output:F,error:B,duration:q,prompt:Q}}var mB=m.object({model:m.string().optional(),temperature:m.number().min(0).max(2).optional(),maxTokens:m.number().positive().optional()});function xw(D,$){return{name:D.name,description:D.description,type:"llm-api",enabled:Boolean(D.apiKey),async execute(F){let B=Date.now();try{let q=await b1(),Q=T1(F.input,q);if(F.verbose)V.plain(`\uD83D\uDD27 API: ${D.name} (model: ${D.model})`);let X=await $(F.systemPrompt,Q,D);if(F.verbose)V.plain(`\uD83D\uDCE5 API raw response (${X.length} chars):`),V.plain(` ${X.slice(0,500)}${X.length>500?"...":""}`);return F0(F,!0,X,void 0,Date.now()-B,Q)}catch(q){return F0(F,!1,"",q instanceof Error?q.message:String(q),Date.now()-B)}},getInfo:()=>({name:D.name,description:D.description,type:"llm-api",provider:"custom",model:D.model,apiKey:D.apiKey,baseUrl:D.baseUrl,temperature:D.temperature,maxTokens:D.maxTokens,enabled:Boolean(D.apiKey)}),settingsSchema:mB,applySettings:(F)=>{let B=mB.safeParse(F),q=B.success?B.data:{};return{name:D.name,description:D.description,type:"llm-api",provider:"custom",model:q.model??D.model,apiKey:D.apiKey,baseUrl:D.baseUrl,temperature:q.temperature??D.temperature,maxTokens:q.maxTokens??D.maxTokens,enabled:Boolean(D.apiKey)}}}}var P1={model:"llama-3.3-70b",temperature:0.7,maxTokens:8192,baseUrl:"https://api.cerebras.ai/v1"};async function lw(D,$,F){if(!F.apiKey)throw Error("CEREBRAS_API_KEY not set");let B=await gB(`${F.baseUrl}/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${F.apiKey}`},body:JSON.stringify({model:F.model,messages:[{role:"system",content:D},{role:"user",content:$}],temperature:F.temperature||0.7,max_tokens:F.maxTokens||8192})});if(!B.ok){let Q=await B.text();throw Error(`Cerebras API: ${B.status} - ${Q}`)}return(await B.json()).choices?.[0]?.message?.content||""}var xB=xw({name:"cerebras-api",description:"Execute via Cerebras AI API",model:P1.model,apiKey:process.env.CEREBRAS_API_KEY,baseUrl:P1.baseUrl,temperature:P1.temperature,maxTokens:P1.maxTokens},lw);s();import{spawn as DM}from"node:child_process";var v1=new Set,lB=!1;function f1(D){v1.add(D),D.once("exit",()=>{v1.delete(D)})}function dB(D,$=3000){return D.kill("SIGTERM"),setTimeout(()=>{if(!D.killed)D.kill("SIGKILL")},$)}function dw(){let D=[...v1];v1.clear();for(let $ of D)$.kill("SIGTERM");setTimeout(()=>{for(let $ of D)if(!$.killed)$.kill("SIGKILL")},2000)}function k1(){if(!lB)lB=!0,process.on("SIGINT",()=>{dw(),process.exit(130)})}s();import{spawn as ow}from"node:child_process";function y1(D,$=1){if(D===void 0||D===null)return $;let F=typeof D==="number"?D:parseInt(String(D).trim(),10);return!isNaN(F)&&F>0?F:$}function pw(D){if(D.lineStart!==void 0)return y1(D.lineStart,0);if(D.line!==void 0)return y1(D.line,0);if(D.lineNumber!==void 0)return y1(D.lineNumber,0);return 1}function cw(D,$){let F=D.file||D.path||"",B=pw(D),q=y1(D.lineEnd,B),Q=D.category||D.type||"quality",X=D.shortDescription||D.short||D.message||D.issue||D.title||D.problem||"",J=D.fullDescription||D.description||D.evidence||D.detail||D.details||D.explanation||X,Y=D.suggestion||D.fix||D.recommendation||D.remediation||D.solution;return{file:F,lineStart:B,lineEnd:q,severity:D.severity||"medium",category:Q,shortDescription:X,fullDescription:J,suggestion:Y,agent:$??D.agent??"unknown"}}function iw(D){let $=D.match(/\[[\s\S]*\]/);if(!$)return null;try{let F=JSON.parse($[0]);return Array.isArray(F)?F:null}catch{return null}}function pB(D){return D.match(/<json>\s*([\s\S]*?)\s*<\/json>/)?.[1]?.trim()??null}function nw(D){try{let $=JSON.parse(D);if($.type==="result"&&typeof $.result==="string"){let F=$.result,B=pB(F);if(B)return B;let q=F.match(/```json\s*([\s\S]*?)```/);if(q)return q[1]?.trim()??F;let Q=F.matchAll(/```(?:\w*)?\s*([\s\S]*?)```/g);for(let X of Q){let J=X[1]?.trim();if(J?.startsWith("[")||J?.startsWith("{"))return J}return F}}catch($){if(process.env.DEBUG)console.warn("extractClaudeCliResult JSON parse failed:",$)}return null}function h1(D,$){try{let F=D,B=nw(D);if(B)F=B;else{let Q=pB(D);if(Q)F=Q}let q=null;try{let Q=JSON.parse(F);q=Array.isArray(Q)?Q:Q.issues??null}catch{q=iw(F)}if(!Array.isArray(q))return[];return q.map((Q)=>cw(Q,$)).filter((Q)=>Q.file&&(Q.shortDescription||Q.fullDescription)&&Q.lineStart>0)}catch{return[]}}var l={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",green:"\x1B[32m",gray:"\x1B[90m"};function rw(D){switch(D){case"critical":return l.red;case"high":return l.yellow;case"medium":return l.blue;case"low":return l.cyan}}function aw(D){switch(D){case"critical":return"✗";case"high":return"⚠";case"medium":return"○";case"low":return"◇"}}function sw(D){switch(D){case"security":return"\uD83D\uDD12";case"performance":return"⚡";case"bug":return"\uD83D\uDC1B";case"quality":return"✨";case"style":return"\uD83C\uDFA8";case"docs":return"\uD83D\uDCDD"}}function w7(D){switch(D){case"critical":return 0;case"high":return 1;case"medium":return 2;case"low":return 3}}function M7(D){return[...D].sort(($,F)=>{let B=w7($.severity),q=w7(F.severity);return B-q})}function K7(D,$=!1){let F=rw(D.severity),B=aw(D.severity),q=sw(D.category),Q=[];if($)Q.push(`${B} ${l.bold}${D.file}:${D.lineStart}${l.reset} - ${F}${D.shortDescription}${l.reset}`);else{if(Q.push(""),Q.push(`${B} ${F}${l.bold}${D.severity.toUpperCase()}${l.reset} ${q} ${l.dim}${D.category}${l.reset}`),Q.push(`${l.bold}${D.file}${l.reset}:${l.cyan}${D.lineStart}${D.lineEnd!==D.lineStart?`-${D.lineEnd}`:""}${l.reset}`),Q.push(""),Q.push(`${l.bold}${D.shortDescription}${l.reset}`),D.fullDescription&&D.fullDescription!==D.shortDescription)Q.push(""),Q.push(`${l.dim}${D.fullDescription}${l.reset}`);if(D.suggestion)Q.push(""),Q.push(`${l.green}→ Suggestion:${l.reset}`),Q.push(`${l.dim}${D.suggestion}${l.reset}`);Q.push(""),Q.push(`${l.gray}From: ${D.agent}${l.reset}`),Q.push(""),Q.push(l.gray+"─".repeat(80)+l.reset)}return Q.join(`
269
- `)}function iB(D){let $=new Map;for(let F of D){let B=$.get(F.file)||[];B.push(F),$.set(F.file,B)}return $}function cB(D){return Math.min(...D.map(($)=>w7($.severity)))}function nB(D){if(D.length===0)return`${l.green}✓ No issues found \uD83C\uDF89${l.reset}`;let $=iB(D),F=[];F.push(""),F.push(`${l.bold}Found ${D.length} issue(s) in ${$.size} file(s)${l.reset}`),F.push("");let B=Array.from($.entries()).sort(([,q],[,Q])=>cB(q)-cB(Q));for(let[q,Q]of B){F.push(`${l.bold}${l.cyan}${q}${l.reset} ${l.dim}(${Q.length} issue(s))${l.reset}`),F.push("");let X=M7(Q);for(let J of X)F.push(K7(J,!1))}return F.join(`
270
- `)}function rB(D,$,F,B,q,Q){let X=D.filter((U)=>U.severity==="critical").length,J=D.filter((U)=>U.severity==="high").length,Y=D.filter((U)=>U.severity==="medium").length,H=D.filter((U)=>U.severity==="low").length,C=M7(D),_=iB(C),G=Array.from(_.entries()).map(([U,W])=>({file:U,issueCount:W.length,issues:M7(W)})),u={success:$,totalDuration:F,stats:{totalIssues:D.length,critical:X,high:J,medium:Y,low:H,filesAnalyzed:Q,agentsExecuted:B,agentsSucceeded:q,agentsFailed:B-q},issues:C,files:G};return JSON.stringify(u,null,2)}function tw(D,$){let F=h1(D,$);if(F.length===0)return;V.plain(`
271
- \x1B[33m⚠ Preliminary issues (may be filtered):\x1B[0m`);for(let B of F)V.plain(K7(B,!0));V.plain("")}function ew(D,$,F){if(F.verbose)V.plain(`\x1B[90m${$}\x1B[0m`);if(F.stream&&!F.verbose){if(D.type==="system"){let B=D.tools?.length||0,q=D.model||"unknown";V.plain(`\x1B[90m\uD83D\uDCCB ${q}, ${B} tools\x1B[0m`)}else if(D.type==="assistant"&&D.message?.content){for(let B of D.message.content)if(B.type==="tool_use")V.plain(`\x1B[36m\uD83D\uDD27 ${B.name}\x1B[0m`);else if(B.type==="text"&&B.text){let q=B.text.slice(0,200),Q=B.text.length>200?"...":"";V.plain(`\x1B[90m\uD83D\uDCAD ${q}${Q}\x1B[0m`)}}}if(D.type==="result"){if(F.stream&&!F.verbose){let B=D.total_cost_usd?`$${D.total_cost_usd.toFixed(4)}`:"",q=D.duration_ms?`${(D.duration_ms/1000).toFixed(1)}s`:"";V.plain(`\x1B[90m\uD83D\uDCCA ${q} ${B}\x1B[0m`)}if(D.subtype==="success"&&D.result)return D.result;else if(D.subtype==="error")throw Error(D.error||"Claude CLI returned error")}return null}async function aB(D,$,F,B){if(D.length===0)throw Error("No command provided to streamClaudeCli");k1();let[q,...Q]=D,X=ow(q,Q,{stdio:["ignore","pipe","pipe"],env:{...process.env,...$},cwd:B.cwd});f1(X);let J=F*1000,Y=setTimeout(()=>dB(X,2000),J);return new Promise((H,C)=>{let _="",G="",u=[];X.stderr?.on("data",(U)=>u.push(U)),X.stdout?.on("data",(U)=>{G+=U.toString("utf-8");let W=G.split(`
272
- `);G=W.pop()||"";for(let A of W){if(!A.trim())continue;try{let z=JSON.parse(A),w=ew(z,A,B);if(w!==null){if(_=w,B.stream&&B.agentName)tw(_,B.agentName)}}catch{if(process.env.DEBUG)V.plain(`\uD83D\uDCE1 Stream parse error: ${A}`)}}}),X.on("close",(U)=>{if(clearTimeout(Y),G.trim())try{let A=JSON.parse(G);if(A.type==="result"&&A.subtype==="success"&&A.result)_=A.result}catch{}let W=Buffer.concat(u).toString("utf-8");if(U===null){C(Error(`Process killed (timeout after ${F}s or signal)${W?`: ${W}`:""}`));return}if(U!==0){C(Error(`Exit code ${U}: ${W}`));return}H(_)}),X.on("error",(U)=>{clearTimeout(Y),C(U)})})}var sB=m.object({model:m.string().optional(),timeout:m.number().positive().optional()}),oB={model:"sonnet",timeout:120};function tB(D,$){if(D.executor.type==="cli"&&D.executor.timeout!==void 0)return D.executor.timeout;return $||60}function eB(D,$){if(D.executor.type==="cli"&&D.executor.model!==void 0)return D.executor.model;return $}async function $M(D,$,F){let B=Date.now(),q=`${$.systemPrompt}
273
-
274
- ${F}`,Q=$.input,X=eB($,D.model),J=tB($,D.timeout),Y=D.args||[];if(X)Y=[...Y,"--model",X];let H=Y.map((u)=>u==="--output-format"?"--output-format":u),C=H.indexOf("json");if(C!==-1)H[C]="stream-json";H.push("--verbose");let _;if(D.systemPromptArg)_=[D.command,...H,D.systemPromptArg,q,Q];else{let u=S1(q,$.input,F);_=D.useStdin?[D.command,...H]:[D.command,...H,u]}let G=await aB(_,D.env||{},J,{stream:$.stream??!1,verbose:$.verbose??!1,agentName:$.agent.name,cwd:$.cwd});return F0($,!0,G,void 0,Date.now()-B,Q)}async function FM(D,$,F){let B=Date.now(),q=T1($.input,F),Q=$.systemPrompt,X=eB($,D.model),J=tB($,D.timeout),Y=D.args||[];if(X)Y=[...Y,"--model",X];let H;if(D.systemPromptArg)H=[...Y,D.systemPromptArg,Q,q];else{let C=S1(Q,$.input,F);H=D.useStdin?[...Y]:[...Y,C]}if($.verbose)V.plain(`\uD83D\uDD27 CLI: ${D.command} ${H.slice(0,-1).join(" ")} <prompt ${q.length} chars>`);return k1(),new Promise((C)=>{let _=DM(D.command,H,{stdio:[D.useStdin?"pipe":"ignore","pipe","pipe"],env:{...process.env,...D.env},cwd:$.cwd});f1(_);let G=[],u=[];if(_.stdout?.on("data",(A)=>G.push(A)),_.stderr?.on("data",(A)=>u.push(A)),D.useStdin&&_.stdin){let A=D.systemPromptArg?q:S1($.systemPrompt,$.input,F);_.stdin.write(A),_.stdin.end()}let U=J*1000,W=setTimeout(()=>_.kill(),U);_.on("close",(A)=>{clearTimeout(W);let z=Buffer.concat(G).toString("utf-8"),w=Buffer.concat(u).toString("utf-8");if($.verbose){if(V.plain(`\uD83D\uDCE5 CLI raw response (${z.length} chars):`),V.plain(` ${z.slice(0,500)}${z.length>500?"...":""}`),w)V.plain(` stderr: ${w.slice(0,200)}`)}if(A===null){C(F0($,!1,"",`Process killed (timeout after ${J}s or signal)${w?`: ${w}`:""}`,Date.now()-B,q));return}if(A!==0){C(F0($,!1,"",`Exit code ${A}: ${w}`,Date.now()-B,q));return}C(F0($,!0,z,void 0,Date.now()-B,q))}),_.on("error",(A)=>{clearTimeout(W),C(F0($,!1,"",`Process error: ${A.message}`,Date.now()-B,q))})})}function Dq(D){return{name:D.name,description:D.description,type:"cli",enabled:!0,async execute($){let F=Date.now();try{let B=await b1();if(D.name==="claude-cli")return await $M(D,$,B);return await FM(D,$,B)}catch(B){return F0($,!1,"",B instanceof Error?B.message:String(B),Date.now()-F)}},getInfo:()=>({name:D.name,description:D.description,type:"cli",command:D.command,args:D.args,env:D.env,timeout:D.timeout,model:D.model,enabled:!0}),settingsSchema:sB,applySettings:($)=>{let F=sB.safeParse($),B=F.success?F.data:{};return{name:D.name,description:D.description,type:"cli",command:D.command,args:D.args,env:D.env,timeout:B.timeout??D.timeout,model:B.model??D.model,enabled:!0}}}}var $q=Dq({name:"claude-cli",description:"Execute via Claude Code CLI",command:"claude",args:["-p","--output-format","json","--no-session-persistence"],timeout:oB.timeout,model:oB.model,useStdin:!1,systemPromptArg:"--system-prompt"}),Fq=Dq({name:"test-cli",description:"Test stub executor - returns empty array (for testing only)",command:"bash",args:["-c","cat > /dev/null; sleep 1; echo '[]'"],timeout:10,useStdin:!0});var o3=new Map([["cerebras-api",xB],["claude-cli",$q],["test-cli",Fq]]);function d2(D){return o3.get(D)}function Bq(){return[...o3.values()]}function qq(D){let $=o3.get(D.name);if($)$.enabled=D.enabled}async function Xq(D){let $=o3.get(D.executor.name);if(!$||!$.enabled){if(process.env.DEBUG)console.warn(`Executor "${D.executor.name}" not available, using test-cli`);$=o3.get("test-cli")}if(!$)throw Error(`No executor found: ${D.executor.name}`);return $.execute(D)}var nD={async autoDiscover(){},get:d2,listExecutors(){return Bq().map((D)=>D.getInfo())},registerExecutor:qq,executeAgent:Xq};async function v0(){await nD.autoDiscover();let D=nD.listExecutors(),F=(await OD()).executors||[];return D.map((B)=>{let q=F.find((Q)=>Q.name===B.name);if(q)return{...B,enabled:q.enabled??B.enabled,...q.model&&{model:q.model},...q.temperature!==void 0&&{temperature:q.temperature},...q.maxTokens!==void 0&&{maxTokens:q.maxTokens},...q.timeout!==void 0&&{timeout:q.timeout}};return B})}s();function t3(D){return Math.ceil(D.length/4)}function Qq(){return"simple (1 token ≈ 4 chars)"}function BM(D){let $=`File: ${D.file}
275
- ${D.diff}`;return t3($)}var Jq=1e4;function qM(){let D=process.env.DIFFRAY_BATCH_TOKENS,$=D?parseInt(D,10):Jq;return{maxTokensPerBatch:isNaN($)?Jq:$}}function Yq(D,$,F){let B=F||qM(),q=[],Q=t3($),X=B.maxTokensPerBatch-Q-1000,J=[],Y=0;for(let H of D){let C=BM(H);if(C>X){if(J.length>0)q.push({diffs:J,tokenCount:Y+Q,batchIndex:q.length}),J=[],Y=0;q.push({diffs:[H],tokenCount:C+Q,batchIndex:q.length});continue}if(Y+C>X&&J.length>0)q.push({diffs:J,tokenCount:Y+Q,batchIndex:q.length}),J=[],Y=0;J.push(H),Y+=C}if(J.length>0)q.push({diffs:J,tokenCount:Y+Q,batchIndex:q.length});return q}function Hq(D,$=!1){let F=D.diffs.length,B=D.tokenCount.toLocaleString();if($){let q=D.diffs.map((Q)=>Q.file).join(", ");return`Batch ${D.batchIndex+1}: ${F} file(s), ~${B} tokens
276
- Files: ${q}`}return`Batch ${D.batchIndex+1}: ${F} file(s), ~${B} tokens`}function g1(D){if(D<1)throw Error("Concurrency must be at least 1");let $=[],F=0,B=()=>{if(F--,$.length>0)$.shift()?.()};return(q)=>{return new Promise((Q,X)=>{let J=async()=>{F++;try{let Y=await q();Q(Y)}catch(Y){X(Y)}finally{B()}};if(F<D)J();else $.push(J)})}}s();function Cq(D,$){if($<1)throw Error("Chunk size must be at least 1");let F=[];for(let B=0;B<D.length;B+=$)F.push(D.slice(B,B+$));return F}function XM(D){let{label:$,batchIndex:F,totalBatches:B,itemCount:q}=D;if(B===1){if(q!==void 0)return`${$} (${q} item${q!==1?"s":""})...`;return`${$}...`}let Q=`batch ${F+1}/${B}`;if(q!==void 0)return`${$} (${Q}, ${q} item${q!==1?"s":""})...`;return`${$} (${Q})...`}function m1(D){let $=D.filter((B)=>Boolean(B));if($.length===0)return;let F=[...new Set($)];if(F.length===1&&$.length>1)return`${F[0]} (${$.length} batches)`;return F.join("; ")}async function _q(D,$,F){let B=g1(F.concurrency);return Promise.all(D.map((q,Q)=>B(()=>$(q,Q,D.length))))}async function x1(D,$,F,B,q){let Q=Date.now(),X=XM(D),J=$?null:new A6(X);try{J?.start();let Y=await F(),H=Date.now()-Q;if(Y.success){let C=B?B(Y.data,H):`${D.label} (${H}ms)`;J?.succeed(C)}else{let C=q?q(Y.error||"Unknown error"):`${D.label}: ${Y.error}`;J?.fail(C)}return{success:Y.success,data:Y.data,error:Y.error,duration:H}}catch(Y){let H=Date.now()-Q,C=Y instanceof Error?Y.message:String(Y),_=q?q(C):`${D.label}: ${C}`;return J?.fail(_),{success:!1,data:void 0,error:C,duration:H}}finally{J?.stop()}}function Gq(D){return D.every(($)=>$.success)}function Vq(D){return D.filter(($)=>!$.success)}async function QM(D,$,F){let B=new Map;for(let q of D){let Q=$.matchedRules?.filter((G)=>G.agent.name===q.name)||[];if(Q.length===0)continue;let X=new Set;for(let G of Q)for(let u of G.files)X.add(u);let J=$.diffs.filter((G)=>X.has(G.file)),Y=q.systemPrompt,H=Q.map((G)=>G.rule.prompt).filter(Boolean).join(`
277
-
278
- `);if(H)Y=`${Y}
279
-
280
- ${H}`;if(F)Y=`${Y}
281
-
282
- ${F}`;let C=Yq(J,Y),_=Q.map((G)=>G.rule.name);B.set(q.name,{batches:C,files:J.length,rules:Q.length,ruleNames:_,systemPrompt:Y})}return B}async function JM(D,$,F,B,q,Q,X,J){return J(async()=>{let C=`${["# Repository Context",`Base path: ${X.metadata.repository}`,"All file paths below are relative to this directory.","When using tools to read files, prepend this base path to get absolute paths.",X.metadata.baseRef?`Base ref: ${X.metadata.baseRef}`:null,X.metadata.headRef?`Head ref: ${X.metadata.headRef}`:null].filter(Boolean).join(`
283
- `)}
284
-
285
- ${D.diffs.map((u)=>`File: ${u.file}
286
- ${u.diff}`).join(`
287
-
288
- `)}`;if(X.verbose&&!X.quiet){let u=D.tokenCount-Q,U=D.diffs.map((A)=>`File: ${A.file} <diff ${A.diff.length} chars>`).join(`
289
- `),W=`${q}
290
-
291
- # Input:
292
- ${U}`;V.newline(),V.plain(`Prompt for ${F.name} (batch ${D.batchIndex+1}/${$.length}):`),V.plain(` Tokens: ${D.tokenCount.toLocaleString()} (~${Q.toLocaleString()} system + ~${u.toLocaleString()} input)`),V.plain("─".repeat(80)),V.plain(W),V.plain("─".repeat(80)),V.newline()}let _=F.executorSettings&&B.applySettings?B.applySettings(F.executorSettings):B.getInfo(),G={agent:F,executor:_,input:C,systemPrompt:q,verbose:X.verbose,quiet:X.quiet,stream:X.stream,cwd:X.metadata.repository};return x1({label:F.name,batchIndex:D.batchIndex,totalBatches:$.length},X.quiet??!1,async()=>{let u=await nD.executeAgent(G),U=h1(u.output,F.name);return{success:u.success,data:U,error:u.error}},(u,U)=>$.length>1?`${F.name} (batch ${D.batchIndex+1}/${$.length}, ${U}ms)`:`${F.name} (${U}ms)`,(u)=>$.length>1?`${F.name} (batch ${D.batchIndex+1}/${$.length}): ${u}`:`${F.name}: ${u}`)})}function YM(D,$,F){let B=[],q=0;for(let J of D)B.push(...J.data),q+=J.duration||0;let Q=D.every((J)=>J.success),X=m1(D.map((J)=>J.error));return{agent:$.name,executor:$.executor,success:Q,output:`Processed ${F.length} batch(es), found ${B.length} issue(s)`,duration:q,issues:B,error:X}}function Wq(){return{id:"review",name:"Review",description:"Run code review agents",enabled:!0,order:2,execute:async(D)=>{let $=Date.now(),F=g1(D.concurrency),B=await Q5();if(D.verbose&&!D.quiet)V.plain(`Token counter: ${Qq()}`);let q=l2.listEnabled();if(q.length===0){if(!D.quiet)V.warn("No enabled Agents found");return{stageId:"review",stageName:"Review",success:!0,duration:Date.now()-$}}let Q=await QM(q,D,B),X=0;for(let[,W]of Q)X+=W.batches.length;let J=q.filter((W)=>W.stage!=="validation"),Y=J.filter((W)=>Q.has(W.name)),H=J.filter((W)=>!Q.has(W.name));if(!D.quiet){if(V.sync(`Code Review: ${Y.length} agent${Y.length!==1?"s":""} (${X} batch${X!==1?"es":""} total)...`),Y.length>0||H.length>0){for(let W of Y){let A=Q.get(W.name);if(A){let z=A.batches.length>1?`${A.batches.length} batches, `:"",w=A.rules,M=5,R=A.ruleNames.slice(0,5).join(", "),v=w>5?`(${R}, ...)`:`(${R})`;V.plain(` • ${W.name}: ${z}${A.files} file${A.files!==1?"s":""} ← ${w} rule${w!==1?"s":""} ${v}`)}}for(let W of H)V.plain(` • ${W.name}: skipped (no matching rules)`)}}let C=await Promise.all(Y.map(async(W)=>{try{let A=nD.get(W.executor);if(!A){if(!D.quiet)V.warn(`Executor not found: ${W.executor}`);return null}let z=Q.get(W.name),{batches:w,systemPrompt:M}=z,K=t3(M);if(!D.quiet&&D.verbose)w.forEach((v)=>{V.plain(` ${Hq(v,!0)}`)});let R=await Promise.all(w.map((v)=>JM(v,w,W,A,M,K,D,F))),Z=YM(R,W,w);return D.issues.push(...Z.issues),D.results.push(Z),Z}catch(A){let z=A instanceof Error?A.message:String(A);if(!D.quiet)V.error(`${W.name}: ${z}`);let w={agent:W.name,executor:W.executor,success:!1,output:"",error:z,duration:0,issues:[]};return D.results.push(w),w}})),_=C.filter((W)=>W?.success).length,G=C.filter((W)=>W&&!W.success),u=G.length;if(!D.quiet){let W=Date.now()-$,A=W>=1000?`${(W/1000).toFixed(1)}s`:`${W}ms`;V.done(`Review complete: ${_}/${Y.length} agents (${A})`)}let U;if(u>0)U=G.map((A)=>`${A?.agent||"Unknown"}: ${A?.error||"execution failed"}`).filter(Boolean).join("; ");return{stageId:"review",stageName:"Review",success:u===0,duration:Date.now()-$,error:U}}}}s();function uq(){return{id:"aggregate-results",name:"Aggregate Results",description:"Collect results",enabled:!0,order:3,execute:async(D)=>{let $=Date.now(),F=D.results.filter((q)=>q.success).length,B=D.results.filter((q)=>!q.success).length;if(!D.quiet)V.sync(`Results: ${F} success, ${B} failed`);return{stageId:"aggregate-results",stageName:"Aggregate Results",success:!0,duration:Date.now()-$}}}}s();var HM=0.6;function Aq(D){let $=D.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter((F)=>F.length>2);return new Set($)}function CM(D,$){if(D.size===0&&$.size===0)return 1;if(D.size===0||$.size===0)return 0;let F=0;for(let q of D)if($.has(q))F++;let B=D.size+$.size-F;return F/B}function _M(D,$){if(D.file!==$.file)return!1;if(Math.min(Math.abs(D.lineStart-$.lineStart),Math.abs(D.lineEnd-$.lineEnd))>10)return!1;let B=Aq(D.shortDescription),q=Aq($.shortDescription);return CM(B,q)>=HM}function Uq(){return{id:"deduplication",name:"Deduplication",description:"Remove duplicate results and issues",enabled:!0,order:4,execute:async(D)=>{let $=Date.now(),F=D.results.flatMap((C)=>C.issues),B=F.length,q=new Set,Q=F.filter((C)=>{let _=`${C.file}:${C.lineStart}:${C.lineEnd}`;if(q.has(_))return!1;return q.add(_),!0}),X=[];for(let C of Q)if(!X.some((G)=>_M(G,C)))X.push(C);D.issues=X;let J=B-Q.length,Y=Q.length-X.length,H=J+Y;if(H>0&&!D.quiet){let C=[];if(J>0)C.push(`${J} by location`);if(Y>0)C.push(`${Y} by similarity`);V.sync(`Removed ${H} duplicate issue(s) (${C.join(", ")})`)}return{stageId:"deduplication",stageName:"Deduplication",success:!0,duration:Date.now()-$}}}}s();import{join as GM}from"path";import{fileURLToPath as VM}from"url";var WM=10,e3={FILE_EXACT_MATCH:40,FILE_PARTIAL_MATCH:30,LINE_OVERLAP:30,LINE_NEARBY:15,DESCRIPTION:30},E7={MINIMUM_SCORE:40,LINE_TOLERANCE:5,LINE_EXTENDED_TOLERANCE:20},zq={name:"validation",description:"Validates issues found by other agents",systemPrompt:`You are a code review validation agent. Your task is to validate issues found by other agents and filter out false positives.
293
-
294
- You may include your analysis and reasoning, but MUST include a JSON array of valid issues somewhere in your response.
295
- Be strict but fair. Only filter out clear false positives.`,enabled:!0,order:999,executor:"claude-cli",executorSettings:{model:"opus",timeout:180}};async function uM(){return Q0(KD.VALIDATION_PROMPT,async()=>{try{let D=VM(import.meta.url),$=GM(D,"..","..","defaults","agents","validation.md");return(await TB($))[0]??zq}catch{return zq}})}function AM(D){return D.map(($)=>{let F=[`<issue id="${$.id}">`,`**[${$.severity.toUpperCase()}] ${$.category}** in \`${$.file}:${$.lineStart}-${$.lineEnd}\``,`Agent: ${$.agent}`,"",`**Problem:** ${$.shortDescription}`,"",$.fullDescription];if($.suggestion)F.push("",`**Suggestion:** ${$.suggestion}`);return F.push("</issue>"),F.join(`
296
- `)}).join(`
297
-
298
- `)}function wq(D){return D.replace(/\\/g,"/").replace(/^\.\//,"").toLowerCase()}function UM(D,$,F,B,q=E7.LINE_TOLERANCE){if(D<=B&&F<=$)return!0;return Math.abs(D-F)<=q||Math.abs($-B)<=q||Math.abs(D-B)<=q||Math.abs($-F)<=q}function zM(D,$){let F=0;if(!$.file)return 0;let B=wq(D.file),q=wq($.file);if(B===q)F+=e3.FILE_EXACT_MATCH;else if(B.endsWith(q)||q.endsWith(B))F+=e3.FILE_PARTIAL_MATCH;else return 0;if(typeof $.lineStart==="number"){let Q=$.lineEnd??$.lineStart;if(UM(D.lineStart,D.lineEnd,$.lineStart,Q))F+=e3.LINE_OVERLAP;else if(Math.abs(D.lineStart-$.lineStart)<=E7.LINE_EXTENDED_TOLERANCE)F+=e3.LINE_NEARBY}if($.shortDescription&&D.shortDescription){let X=new Set(D.shortDescription.toLowerCase().split(/\W+/).filter((C)=>C.length>=3)),J=new Set($.shortDescription.toLowerCase().split(/\W+/).filter((C)=>C.length>=3)),H=[...X].filter((C)=>J.has(C)).length/Math.max(X.size,J.size,1);F+=Math.round(H*e3.DESCRIPTION)}return F}function wM(D,$){let F=D.match(/<valid-ids>\s*(\[[\s\S]*?\])\s*<\/valid-ids>/);if(F?.[1])try{let q=JSON.parse(F[1]);if(Array.isArray(q)&&q.every((Q)=>typeof Q==="number"))return q}catch{}let B=D.match(/\[\s*(\d+\s*(?:,\s*\d+\s*)*)\]/);if(B?.[1])try{let q=JSON.parse(`[${B[1]}]`);if(Array.isArray(q)){let Q=q.filter((X)=>typeof X==="number");if(Q.length>0)return Q}}catch{}if($&&$.length>0){let q=D.match(/<json>\s*([\s\S]*?)\s*<\/json>/);if(q?.[1])try{let Q=JSON.parse(q[1]);if(Array.isArray(Q)&&Q.length>0){let X=new Set;for(let J of Q){let Y=null,H=0;for(let C of $){if(X.has(C.id))continue;let _=zM(C,J);if(_>H&&_>=E7.MINIMUM_SCORE)H=_,Y=C}if(Y)X.add(Y.id)}if(X.size>0)return Array.from(X)}}catch{}}return[]}function MM(D,$,F){D.forEach((B)=>{B.issues=B.issues.filter((q)=>{let Q=F.get(q);return Q!==void 0&&$.has(Q)})})}function KM(D,$){let F=d2(D.executor);if(!F||!F.enabled){if(!$.quiet)V.warn(`Validation executor '${D.executor}' not found or disabled, skipping validation`);return null}if(D.executorSettings&&F.applySettings)return F.applySettings(D.executorSettings);return F.getInfo()}async function EM(D,$,F,B,q,Q){let X=AM(D),J=Q.metadata.repository,Y=Q.metadata.commitMessages?.length?["","## Commit Messages (IMPORTANT: Check these to understand change intent!)","These messages explain WHY the changes were made. Use them to identify INTENTIONAL trade-offs.","",...Q.metadata.commitMessages.map((G,u)=>`### Commit ${u+1}:
299
- ${G}`)].join(`
300
- `):null,C=`${["# Repository Context",`Base path: ${J}`,"All file paths below are relative to this directory.","When using tools to read files, prepend this base path to get absolute paths.",Q.metadata.baseRef?`Base ref: ${Q.metadata.baseRef}`:null,Q.metadata.headRef?`Head ref: ${Q.metadata.headRef}`:null,Y].filter(Boolean).join(`
301
- `)}
302
-
303
- # Issues to validate (${D.length} total):
304
-
305
- ${X}`,_={agent:B,executor:q,input:C,systemPrompt:B.systemPrompt,verbose:Q.verbose,quiet:Q.quiet,cwd:J};if(Q.verbose&&!Q.quiet){let G=F>1;V.plain(`
306
- Validation prompt${G?` (batch ${$+1}/${F})`:""}:`),V.plain(` Executor: ${q.name}`),V.plain(` Issues to validate: ${D.length}`),V.plain("─".repeat(80)),V.plain(C.slice(0,2000)+(C.length>2000?"...":"")),V.plain("─".repeat(80)),V.newline()}return x1({label:"Validating",batchIndex:$,totalBatches:F,itemCount:D.length},Q.quiet??!1,async()=>{let G=await nD.executeAgent(_);if(!G.success)return{success:!1,data:[],error:G.error};return{success:!0,data:wM(G.output,D)}},(G,u)=>F>1?`Validated batch ${$+1}/${F} (${G.length} valid, ${u}ms)`:`Validated ${G.length} issue(s) (${u}ms)`,(G)=>F>1?`Validation failed (batch ${$+1}): ${G}`:`Validation failed: ${G}`)}function Mq(){return{id:"validation",name:"Validation",description:"Validate issues and filter out false positives",enabled:!0,order:5,execute:async(D)=>{let $=Date.now();if(D.skipValidation){if(!D.quiet)V.sync("Skipping validation (--skip-validation)");return{stageId:"validation",stageName:"Validation",success:!0,duration:Date.now()-$}}let F=[],B=new Map;if(D.results.forEach((C)=>{C.issues.forEach((_)=>{let G=F.length+1;F.push(_),B.set(_,G)})}),F.length===0){if(!D.quiet)V.sync("No issues to validate");return{stageId:"validation",stageName:"Validation",success:!0,duration:Date.now()-$}}let q=F.map((C,_)=>({...C,id:_+1})),Q=await uM(),X=KM(Q,D);if(!X)return{stageId:"validation",stageName:"Validation",success:!0,duration:Date.now()-$};let J=Cq(q,WM),Y=J.length>1,H=X.type==="llm-api"||X.type==="cli"?X.model:void 0;if(!D.quiet){if(Y)V.sync(`Validating ${F.length} issues in ${J.length} batches...`);else V.sync(`Validating ${F.length} issue(s)...`);if(D.verbose)V.plain(` Executor: ${X.name}${H?` (model: ${H})`:""}`)}try{let C=await _q(J,(W,A,z)=>EM(W,A,z,Q,X,D),{concurrency:D.concurrency,quiet:D.quiet});if(!Gq(C)){let W=Vq(C),A=m1(W.map((z)=>z.error));return{stageId:"validation",stageName:"Validation",success:!1,duration:Date.now()-$,error:A}}let _=new Set(C.flatMap((W)=>W.data));MM(D.results,_,B);let G=_.size,u=F.length-G,U=Date.now()-$;if(!D.quiet)V.done(`Validation complete: ${G} valid, ${u} filtered out (${U}ms)`);return{stageId:"validation",stageName:"Validation",success:!0,duration:U}}catch(C){let _=C instanceof Error?C.message:String(C);if(!D.quiet)V.error(`Validation error: ${_}`);return{stageId:"validation",stageName:"Validation",success:!1,duration:Date.now()-$,error:_}}}}}var OL=m.object({id:m.string(),enabled:m.boolean().default(!0),order:m.number().optional()});function Kq(){return[vB(),fB(),Wq(),uq(),Uq(),Mq()]}class O7{agents=[];executors=new Map;stages=[];constructor(D=[],$=[],F){this.agents=[...D].sort((B,q)=>B.order-q.order);for(let B of $)this.executors.set(B.name,B),nD.registerExecutor(B);for(let B of D)l2.register(B);this.stages=F||Kq()}addAgent(D){this.agents.push(D),this.agents.sort(($,F)=>$.order-F.order),l2.register(D)}removeAgent(D){this.agents=this.agents.filter(($)=>$.name!==D),l2.remove(D)}getAgents(){return this.agents}getEnabledAgents(){return this.agents.filter((D)=>D.enabled)}addExecutor(D){this.executors.set(D.name,D),nD.registerExecutor(D)}getExecutor(D){return this.executors.get(D)}async execute(D,$={}){let{verbose:F=!1,quiet:B=!1,concurrency:q=3,skipValidation:Q=!1,stream:X=!1,baseRef:J,headRef:Y}=$,H=Date.now(),C=[];if(J&&Y){if(C=await p4(J,Y),F&&C.length>0)V.plain(`Fetched ${C.length} commit message(s) for context`)}let _={diffs:D,results:[],issues:[],metadata:{timestamp:Date.now(),repository:process.cwd(),baseRef:J,headRef:Y,commitMessages:C.length>0?C:void 0},verbose:F,quiet:B,stream:X,concurrency:q,skipValidation:Q},G=[];for(let U of this.stages){if(!U.enabled)continue;try{let W=await U.execute(_);if(G.push(W),!W.success){V.error(`Stage ${U.name} failed: ${W.error}`);break}}catch(W){let A=W instanceof Error?W.message:String(W);V.error(`Stage ${U.name} failed: ${A}`),G.push({stageId:U.id,stageName:U.name,success:!1,duration:0,error:A});break}}let u=Date.now()-H;return{success:G.every((U)=>U.success),context:_,totalDuration:u,stages:G}}}s();x2();import{spawnSync as OM}from"node:child_process";s();async function Eq(){let D=await OD(),$=d0();V.plain(`Current Configuration
307
- `),V.plain(`Location: ${$}
308
- `),V.plain(JSON.stringify(D,null,2))}async function j7(){if(await N6()){V.warn("Configuration file already exists"),V.plain(`Location: ${d0()}`),V.plain(`
309
- Use 'diffray config show' to view current configuration`),V.plain("Use 'diffray config reset' to reset to defaults");return}let $=await OD();V.success("Configuration file created"),V.plain(`Location: ${d0()}
310
- `),V.plain(JSON.stringify($,null,2))}async function Oq(){let D=await j8();V.success("Configuration reset to defaults"),V.plain(JSON.stringify(D,null,2))}async function jq(D,$){let F=await OD(),B=D.split("."),q=["concurrency"],Q=["output"],X=(Y,H)=>{let C=["apiKey","url","baseUrl"];if(Y==="true")return!0;if(Y==="false")return!1;if(!C.includes(H)&&!isNaN(Number(Y)))return Number(Y);return Y},J;if(B.length===1){let Y=B[0];if(!q.includes(Y))V.error(`Invalid root key: ${Y}`),V.plain(`Valid root keys: ${q.join(", ")}`),V.plain(`Valid sections: ${Q.join(", ")} (use section.key format)`),process.exit(1);let H=X($,Y);J={...F,[Y]:H}}else if(B.length===2){let[Y,H]=B;if(!Q.includes(Y))V.error(`Invalid section: ${Y}`),V.plain(`Valid root keys: ${q.join(", ")}`),V.plain(`Valid sections: ${Q.join(", ")}`),process.exit(1);let C=F[Y];if(typeof C!=="object"||C===null)V.error(`Invalid section: ${Y}`),process.exit(1);let _=X($,H);J={...F,[Y]:{...C,[H]:_}}}else V.error("Invalid key format. Use: key or section.key"),V.plain("Examples: concurrency, output.colorize"),process.exit(1);try{await J3(J),V.success(`Updated ${D} = ${$}`)}catch(Y){V.error(`Failed to update config: ${Y}`),process.exit(1)}}async function Rq(D){let $=await OD(),F=D.split(".");if(F.length!==2)V.error("Invalid key format. Use format: section.key (e.g., ai.provider)"),process.exit(1);let B=F[0],q=F[1];if(!B||!q)V.error("Invalid key format. Use format: section.key (e.g., ai.provider)"),process.exit(1);let Q=$[B];if(!Q||typeof Q!=="object")V.error(`Invalid section: ${B}`),process.exit(1);let X=Q[q];if(X===void 0)V.error(`Invalid key: ${q}`),process.exit(1);V.plain(String(X))}async function Nq(){let D=d0();if(!await N6())await j7();let F=process.env.EDITOR||"nano";V.info(`Opening ${D} in ${F}...`);let B=OM(F,[D],{stdio:"inherit"});if(B.error)V.error(`Failed to open editor: ${B.error.message}`),process.exit(1)}var Lq=MD({meta:{name:"config",description:"Manage configuration"},subCommands:{show:{meta:{description:"Show current configuration"},run:()=>{Eq()}},init:{meta:{description:"Initialize configuration file"},run:()=>{j7()}},reset:{meta:{description:"Reset to default configuration"},run:()=>{Oq()}},set:{meta:{description:"Set configuration value"},args:{key:{type:"positional",description:"Configuration key",required:!0},value:{type:"positional",description:"Configuration value",required:!0}},run:({args:D})=>{jq(D.key,D.value)}},get:{meta:{description:"Get configuration value"},args:{key:{type:"positional",description:"Configuration key",required:!0}},run:({args:D})=>{Rq(D.key)}},edit:{meta:{description:"Edit configuration in $EDITOR"},run:()=>{Nq()}}}});s();function jM(D){if(!D||Object.keys(D).length===0)return"-";return Object.entries(D).map(([$,F])=>`${$}=${F}`).join(", ")}async function Iq(){let D=await B2(process.cwd());if(V.robot("Available Agents"),V.newline(),D.length===0){V.plain("No Agents configured");return}for(let $ of D){let F=$.enabled?"●":"○",B=$.stage||"review",q=t2($.path);if(V.plain(`${F} ${$.name} (${B})`),V.plain(` executor: ${$.executor}`),$.executorSettings&&Object.keys($.executorSettings).length>0)V.plain(` settings: ${jM($.executorSettings)}`);V.plain(` path: ${q}`),V.newline()}}async function Zq(D){let F=(await B2(process.cwd())).find((B)=>B.name===D);if(!F)V.error(`Agent not found: ${D}`),process.exit(1);if(V.robot(`Agent: ${F.name}`),V.newline(),V.plain(`Description: ${F.description}`),V.plain(`Enabled: ${F.enabled?"Yes":"No"}`),V.plain(`Order: ${F.order}`),V.plain(`Stage: ${F.stage||"review"}`),V.plain(`Executor: ${F.executor}`),V.plain(`Path: ${t2(F.path)}`),F.executorSettings&&Object.keys(F.executorSettings).length>0){V.newline(),V.plain("Executor Settings:");for(let[B,q]of Object.entries(F.executorSettings))V.plain(` ${B}: ${q}`)}V.newline(),V.plain("System Prompt:"),V.separator("─"),V.plain(F.systemPrompt||"(no prompt)"),V.separator("─")}var bq=MD({meta:{name:"agents",description:`List agents or show agent details
311
-
312
- Examples:
313
- diffray agents # List all agents
314
- diffray agents validation # Show validation agent details
315
- diffray agents general # Show general agent details`},args:{name:{type:"positional",description:"Agent name (optional, shows details if provided)",required:!1}},run:async({args:D})=>{if(D.name)await Zq(D.name);else await Iq()}});s();function R7(D){return D.type==="llm-api"?D.model:D.type==="cli"?D.model:void 0}function Sq(D){return D.type==="cli"?D.timeout:void 0}function Tq(D){let $=d2(D);if(!$?.settingsSchema)return[];let F=$.settingsSchema;if("shape"in F&&typeof F.shape==="object")return Object.keys(F.shape);return[]}async function Pq(){let D=await v0();if(V.robot("Available Executors"),V.newline(),D.length===0){V.plain("No Executors configured");return}let $=new Map;for(let Q of D)$.set(Q.name,Tq(Q.name));let F={status:1,name:Math.max(8,...D.map((Q)=>Q.name.length)),model:Math.max(5,...D.map((Q)=>(R7(Q)||"-").length)),timeout:7,settings:20},B=["".padEnd(F.status),"Executor".padEnd(F.name),"Model".padEnd(F.model),"Timeout".padEnd(F.timeout),"Available Settings".padEnd(F.settings)].join(" "),q=["-".repeat(F.status),"-".repeat(F.name),"-".repeat(F.model),"-".repeat(F.timeout),"-".repeat(F.settings)].join(" ");V.plain(B),V.plain(q);for(let Q of D){let X=Q.enabled?"●":"○",J=R7(Q)||"-",Y=Sq(Q)?`${Sq(Q)}s`:"-",H=$.get(Q.name)?.join(", ")||"-",C=[X.padEnd(F.status),Q.name.padEnd(F.name),J.padEnd(F.model),Y.padEnd(F.timeout),H.padEnd(F.settings)].join(" ");V.plain(C)}V.newline()}async function vq(D){let F=(await v0()).find((q)=>q.name===D);if(!F)V.error(`Executor not found: ${D}`),process.exit(1);if(V.robot(`Executor: ${F.name}`),V.newline(),V.plain(`Name: ${F.name}`),V.plain(`Type: ${F.type}`),V.plain(`Description: ${F.description}`),V.plain(`Enabled: ${F.enabled?"Yes":"No"}`),F.type==="cli"){V.plain(`Command: ${F.command}`),V.plain(`Args: ${F.args?.join(" ")||"(none)"}`);let q=R7(F);if(q)V.plain(`Model: ${q}`);V.plain(`Timeout: ${F.timeout||60}s`)}else if(F.type==="llm-api")V.plain(`Provider: ${F.provider}`),V.plain(`Model: ${F.model}`),V.plain(`Temperature: ${F.temperature??0.7}`),V.plain(`Max Tokens: ${F.maxTokens??4096}`);if(F.type==="cli"&&F.env){V.newline(),V.plain("Environment Variables:");for(let[q,Q]of Object.entries(F.env)){let X=q.includes("KEY")||q.includes("TOKEN")?String(Q).substring(0,8)+"...":Q;V.plain(` ${q}: ${X}`)}}let B=Tq(D);if(B.length>0){V.newline(),V.plain("Available Settings (for executorSettings in agent frontmatter):");for(let q of B)V.plain(` - ${q}`)}}async function fq(D){let $=await v0(),F=$.find((B)=>B.name===D);if(!F)V.error(`Executor not found: ${D}`),process.exit(1);F.enabled=!0,await O8({executors:$}),V.success(`Enabled Executor: ${F.name}`)}async function kq(D){let $=await v0(),F=$.find((B)=>B.name===D);if(!F)V.error(`Executor not found: ${D}`),process.exit(1);F.enabled=!1,await O8({executors:$}),V.success(`Disabled Executor: ${F.name}`)}var yq=MD({meta:{name:"executors",description:"Manage code review executors"},subCommands:{list:{meta:{description:"List all executors"},run:()=>{Pq()}},show:{meta:{description:"Show executor details"},args:{id:{type:"positional",description:"Executor ID",required:!0}},run:({args:D})=>{vq(D.id)}},enable:{meta:{description:"Enable executor"},args:{id:{type:"positional",description:"Executor ID",required:!0}},run:({args:D})=>{fq(D.id)}},disable:{meta:{description:"Disable executor"},args:{id:{type:"positional",description:"Executor ID",required:!0}},run:({args:D})=>{kq(D.id)}}}});x2();s();function RM(D){switch(D){case"defaults":return"◆";case"user":return"◇";case"project":return"●";default:return"○"}}async function hq(){let D=await P0();if(D.length===0){V.warn("No rules configured");return}V.robot("Rules"),V.newline();for(let $ of D){let F=RM($.source),B=t2($.path);V.plain(`${F} ${$.name}`),V.plain(` agent: ${$.agent}`),V.plain(` patterns: ${$.patterns.join(", ")}`),V.plain(` path: ${B}`),V.newline()}V.plain("◆ defaults ◇ user ● project")}async function gq(D){let{loadRuleFromRef:$}=await Promise.resolve().then(() => (x2(),bB)),B=(await P0()).find((Q)=>Q.name===D);if(!B)V.error(`Rule not found: ${D}`),process.exit(1);let q=await $(B);if(!q)V.error(`Failed to load rule content from: ${B.path}`),process.exit(1);if(V.robot(`Rule: ${q.name}`),V.newline(),V.plain(`Source: ${B.source}`),V.plain(`Path: ${B.path}`),V.plain(`Description: ${q.description}`),V.plain(`Patterns: ${q.patterns.join(", ")}`),V.plain(`Agent: ${q.agent}`),q.prompt)V.newline(),V.plain("Prompt:"),V.separator("─"),V.plain(q.prompt),V.separator("─")}async function mq(D,$){let B=(await P0()).find((X)=>X.name===D);if(!B)V.error(`Rule not found: ${D}`),process.exit(1);V.robot(`Testing rule: ${B.name}`),V.plain(`Patterns: ${B.patterns.join(", ")}`),V.newline();let q=[],Q=[];for(let X of $)if(B.patterns.some((Y)=>m2(X,Y)))q.push(X);else Q.push(X);V.success(`Matched ${q.length} file(s):`);for(let X of q)V.plain(` ● ${X}`);if(Q.length>0){V.newline(),V.plain(`Not matched ${Q.length} file(s):`);for(let X of Q)V.plain(` ○ ${X}`)}}var xq=MD({meta:{name:"rules",description:`List rules or show rule details
316
-
317
- Examples:
318
- diffray rules # List all rules
319
- diffray rules simplicity # Show simplicity rule details
320
- diffray rules test simplicity src/*.ts # Test rule pattern matching`},args:{name:{type:"positional",description:'Rule name or "test" subcommand',required:!1},rest:{type:"positional",description:"For test: <rule-name> <files...>",required:!1}},run:async({args:D})=>{if(D.name==="test"){let $=D._||[],F=$[0],B=$.slice(1);if(!F||B.length===0)console.error("Usage: diffray rules test <rule-name> <files...>"),process.exit(1);await mq(F,B)}else if(D.name)await gq(D.name);else await hq()}});s();import{stat as NM}from"node:fs/promises";async function lq(){V.robot("Configuration Information"),V.newline();let D=d0();V.plain(`Location: ${D}`),V.newline();let $;try{$=await NM(D)}catch{V.info("Configuration file does not exist (using defaults)");return}let F=($.size/1024).toFixed(2),B=$.mtime.toLocaleString();V.success("config.json"),V.plain(` Size: ${F} KB`),V.plain(` Modified: ${B}`),V.newline();try{let q=await OD();if(V.plain("Contents:"),q.executors)V.plain(` • Executors: ${q.executors.length}`);if(q.stages)V.plain(` • Stages: ${q.stages.length}`);V.newline()}catch(q){V.warn(`Failed to parse configuration: ${q}`),V.newline()}}async function dq(){V.robot("Resetting configuration..."),V.newline();try{await j8(),X5(),V.success("Configuration reset to defaults"),V.success("In-memory cache cleared"),V.newline(),V.success("Configuration reset successfully")}catch(D){V.error(`Failed to reset configuration: ${D}`)}}async function pq(){V.robot("About diffray Configuration"),V.newline(),V.plain("diffray uses a configuration file (config.json) for settings:"),V.newline(),V.plain("Configuration Data:"),V.plain(" ▸ Executors - Executor configurations"),V.plain(" ▸ Stages - Pipeline stages configuration"),V.plain(" ▸ Validation - Validation settings"),V.newline(),V.plain("Dynamic Data (always loaded from MD files):"),V.plain(" ▸ Agents - Loaded from ~/.diffray/agents/ and .diffray/agents/"),V.plain(" ▸ Rules - Loaded from ~/.diffray/rules/ and .diffray/rules/"),V.newline(),V.plain("Location: ~/.diffray/config.json"),V.newline(),V.plain("When to reset:"),V.plain(" • To restore default settings"),V.plain(" • When troubleshooting configuration issues"),V.plain(" • If configuration becomes corrupted"),V.newline()}var cq=MD({meta:{name:"cache",description:"Manage cache"},subCommands:{show:{meta:{description:"Show cache contents"},run:()=>{lq()}},clear:{meta:{description:"Clear all cache"},run:()=>{dq()}},explain:{meta:{description:"Explain cache system"},run:()=>{pq()}}}});function LM(D){switch(D){case"modified":return"~";case"added":return"+";case"deleted":return"-";case"renamed":return"→";default:return"·"}}async function IM(D){let{verbose:$=!1,json:F=!1,stream:B=!1,severity:q,base:Q,head:X,skipValidation:J=!1,agent:Y}=D,H=Y?Y.split(",").map((k)=>k.trim()):void 0,C=q?q.split(",").map((k)=>k.trim()):void 0;if(!F)V.logo();let _=await OD();if(!await m4()){if(!F)V.error("Not a git repository");process.exit(1)}if(!F)V.chart("Analyzing changes...");let u,U="",W=null;if(Q){let k=X||"HEAD";if(!F)V.info(`Comparing ${Q}...${k}`);if(await y4()){if(!F)V.warn("Uncommitted changes detected - cannot checkout to head ref"),V.info("CLI tools will only see diff context, not full files")}else{let p=await k4(k);if(p.checkoutNeeded){if(W=p.originalRef,!F)V.info(`Checked out to ${k} for full file access`)}}if(u=await c4(Q,k),U=` (${Q}...${k})`,u.length===0){if(V.success("No changes between commits"),W)await z8(W);return}}else if(u=await x4(),u.length===0){if(!F)V.info("No uncommitted changes, reviewing last commit...");if(u=await d4(),U=" (last commit)",u.length===0){V.success("No changes to review");return}}let A=u.filter((k)=>{return!_.excludePatterns.some((p)=>{return m2(k.file,p)})});if(A.length===0){V.success("No changes (all excluded)");return}let z=A.reduce((k,p)=>k+p.additions,0),w=A.reduce((k,p)=>k+p.deletions,0),M=z+w,K=A.reduce((k,p)=>{return k[p.status]=(k[p.status]||0)+1,k},{});if(!F){let k=[];if(K.modified)k.push(`${K.modified} modified`);if(K.added)k.push(`${K.added} added`);if(K.deleted)k.push(`${K.deleted} deleted`);if(K.renamed)k.push(`${K.renamed} renamed`);if(V.file(`${A.length} files${U}: ${k.join(", ")}`),V.plain(` ${M} changes: +${z} -${w}`),$||A.length<=5){V.newline();for(let RD of A){let p2=LM(RD.status);V.plain(` ${p2} ${RD.file}: +${RD.additions} -${RD.deletions}`)}}V.newline(),V.robot("Loading executors and Agents...")}let R=await v0(),Z=R.filter((k)=>k.enabled);if(!F)V.success(`Loaded ${Z.length} executor(s)`);let v=await B2();if(H&&H.length>0){if(v=v.filter((k)=>H.includes(k.name)),!F)V.info(`Filtering agents: ${H.join(", ")}`)}let I=v.filter((k)=>k.enabled);if(!F)V.success(`Loaded ${I.length} Agent(s)`),V.newline();let e=await new O7(v,R).execute(A,{verbose:$,quiet:F,concurrency:_.concurrency,skipValidation:J,stream:B,baseRef:Q,headRef:X}),B0=e.context.results.flatMap((k)=>k.issues),i=B0;if(C&&C.length>0)i=B0.filter((k)=>C.includes(k.severity));if(F){let k=e.context.results.filter((RD)=>RD.success).length,p=rB(i,e.success,e.totalDuration,e.context.results.length,k,A.length);console.log(p)}else{if(V.separator(),e.success)V.success(`Pipeline completed successfully in ${e.totalDuration}ms`);else V.warn(`Pipeline completed with errors in ${e.totalDuration}ms`);let k=e.context.results.filter((p)=>p.success).length;if(V.chart(`${k}/${e.context.results.length} agents succeeded`),C&&C.length>0){let p=C.join(", ");V.info(`Filtering by severity: ${p}`)}if(i.length>0){let p=i.reduce((p2,L7)=>{return p2[L7.severity]=(p2[L7.severity]||0)+1,p2},{}),RD=[];if(p.critical)RD.push(`${p.critical} critical`);if(p.high)RD.push(`${p.high} high`);if(p.medium)RD.push(`${p.medium} medium`);if(p.low)RD.push(`${p.low} low`);V.chart(`${i.length} issue(s): ${RD.join(", ")}`),V.newline(),console.log(nB(i))}else if(V.newline(),C&&C.length>0){let p=C.join(", ");V.success(`No ${p} issues found \uD83C\uDF89`)}else V.success("No issues found \uD83C\uDF89");V.newline()}if(W){if(await z8(W),!F)V.info(`Restored to ${W}`)}}var ZM=MD({meta:{name:"review",description:`Run code review on current changes
321
-
322
- Examples:
323
- diffray review Review uncommitted changes
324
- diffray review --base main Compare current branch to main
325
- diffray review --agent general Run only general agent
326
- diffray review --agent bug-hunter,security-scan
327
- diffray review --severity critical,high
328
- diffray review --stream Show thinking and tool usage`},args:{stream:{type:"boolean",description:"Show streaming output (thinking, tools, preliminary issues)"},verbose:{type:"boolean",description:"Show raw JSON stream"},json:{type:"boolean",description:"Output results in JSON format"},severity:{type:"string",description:"Filter issues by severity (comma-separated: critical,high,medium,low)"},base:{type:"string",description:"Base commit/branch to compare from (e.g., main, HEAD~3)"},head:{type:"string",description:"Head commit/branch to compare to (default: HEAD)"},"skip-validation":{type:"boolean",description:"Skip validation stage (show all issues without filtering)"},agent:{type:"string",description:"Run only specific agents (comma-separated: bug-hunter,security-scan)"}},run:async({args:D})=>{await IM({...D,skipValidation:D["skip-validation"]})}}),iq=MD({meta:{name:"diffray",version:K4.version,description:"AI-powered code review CLI"},subCommands:{review:ZM,config:Lq,agents:bq,executors:yq,rules:xq,cache:cq}});var f={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",gray:"\x1B[90m"},nq=new Set;function rq(){process.stdout.write("\x1B[?25h")}process.on("SIGINT",()=>{for(let D of nq)D.stop();rq(),console.log(`
329
- ${f.yellow}!${f.reset} Interrupted - shutting down gracefully`),process.exit(130)});process.on("SIGTERM",()=>{for(let D of nq)D.stop();rq(),console.log(`
330
- ${f.yellow}!${f.reset} Terminated - shutting down gracefully`),process.exit(143)});var N7={success:(D)=>{console.log(`${f.green}✓${f.reset} ${D}`)},error:(D,$)=>{let F=$?`${D} ${$}`:D;console.error(`${f.red}✗${f.reset} ${F}`)},warn:(D,$)=>{let F=$?`${D} ${$}`:D;console.warn(`${f.yellow}!${f.reset} ${F}`)},info:(D)=>{console.log(`${f.blue}○${f.reset} ${D}`)},debug:(D)=>{if(process.env.DEBUG)console.log(`${f.gray}·${f.reset} ${D}`)},plain:(D)=>{console.log(D)},load:(D)=>console.log(`${f.cyan}▸${f.reset} ${D}`),match:(D)=>console.log(`${f.magenta}◆${f.reset} ${D}`),execute:(D)=>console.log(`${f.blue}›${f.reset} ${D}`),agent:(D)=>console.log(`${f.cyan}◉${f.reset} ${D}`),done:(D)=>console.log(`${f.green}✓${f.reset} ${D}`),analyze:(D)=>console.log(`${f.blue}○${f.reset} ${D}`),run:(D)=>console.log(`${f.green}▶${f.reset} ${D}`),stats:(D)=>console.log(` ${D}`),rocket:(D)=>console.log(`${f.magenta}▲${f.reset} ${D}`),robot:(D)=>console.log(`${f.cyan}◉${f.reset} ${D}`),chart:(D)=>console.log(`${f.blue}■${f.reset} ${D}`),file:(D)=>console.log(`${f.gray}◇${f.reset} ${D}`),sync:(D)=>console.log(`${f.cyan}↻${f.reset} ${D}`),lightning:(D)=>console.log(`${f.yellow}⚡${f.reset} ${D}`),sparkles:(D)=>console.log(`${f.magenta}✦${f.reset} ${D}`),logo:()=>{console.log(`
331
- ██████╗ ██╗ ███████╗ ███████╗ ██████╗ █████╗ ██╗ ██╗
332
- ██╔══██╗ ██║ ██╔════╝ ██╔════╝ ██╔══██╗ ██╔══██╗ ╚██╗ ██╔╝
333
- ██║ ██║ ██║ █████╗ █████╗ ██████╔╝ ███████║ ╚████╔╝ ${f.bold}Multi-agent code review${f.reset}
334
- ██║ ██║ ██║ ██╔══╝ ██╔══╝ ██╔══██╗ ██╔══██║ ╚██╔╝
335
- ██████╔╝ ██║ ██║ ██║ ██║ ██║ ██║ ██║ ██║
336
- ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝
337
- `)},separator:(D="=",$=80)=>{console.log(D.repeat($))},newline:()=>console.log()};var aq={name:"diffray",version:"0.1.2",description:"AI-powered code review CLI for git changes",author:"Ilya Strelov <strelov1@gmail.com>",license:"MIT",type:"module",bin:{diffray:"./dist/diffray.js"},files:["dist/diffray.js","dist/defaults","src/defaults"],scripts:{dev:"bun run ./bin/diffray.ts",build:"bun build ./bin/diffray.ts --outfile dist/diffray.js --target node --minify && cp -r src/defaults dist/","link:local":`node -e "const p=require('./package.json');p.bin.diffray='./bin/diffray.ts';require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')" && bun link`,"link:publish":`node -e "const p=require('./package.json');p.bin.diffray='./dist/diffray.js';require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')"`,link:"bun link",unlink:"bun unlink",test:"bun test","ts-check":"tsc --noEmit",lint:"eslint .","lint:fix":"eslint . --fix",format:"prettier --write .","format:check":"prettier --check .",prepublishOnly:"npm run build && npm run link:publish"},repository:{type:"git",url:"git+https://github.com/diffray/diffray.git"},homepage:"https://github.com/diffray/diffray#readme",bugs:{url:"https://github.com/diffray/diffray/issues"},keywords:["code-review","ai","cli","git","diff","llm","claude","cerebras","pull-request"],engines:{node:">=18.0.0"},os:["darwin","linux","win32"],cpu:["x64","arm64"],devDependencies:{"@eslint/js":"^9.39.2","@types/bun":"latest","@typescript-eslint/eslint-plugin":"^8.52.0","@typescript-eslint/parser":"^8.52.0",eslint:"^9.39.2","eslint-config-prettier":"^10.1.8","eslint-plugin-prettier":"^5.5.4",prettier:"^3.7.4"},peerDependencies:{typescript:"^5"},dependencies:{citty:"^0.1.6",diff:"^8.0.2",glob:"^13.0.0",yaml:"^2.8.2",zod:"^3.22.4"}};var l1=process.argv.slice(2),SM=["-v","--version","-h","--help"],TM=l1.length===0||l1.some((D)=>SM.includes(D));if(TM){if(N7.logo(),l1.includes("-v")||l1.includes("--version"))N7.plain(`v${aq.version}`),process.exit(0)}M4(iq);