@pickled-dev/cli 0.13.0 → 0.15.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 (3) hide show
  1. package/README.md +26 -0
  2. package/dist/index.js +154 -151
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,175 +1,175 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var yZ=Object.create;var{getPrototypeOf:xZ,defineProperty:n4,getOwnPropertyNames:fZ}=Object;var kZ=Object.prototype.hasOwnProperty;function gZ($){return this[$]}var hZ,vZ,r4=($,X,Z)=>{var q=$!=null&&typeof $==="object";if(q){var z=X?hZ??=new WeakMap:vZ??=new WeakMap,G=z.get($);if(G)return G}Z=$!=null?yZ(xZ($)):{};let J=X||!$||!$.__esModule?n4(Z,"default",{value:$,enumerable:!0}):Z;for(let Q of fZ($))if(!kZ.call(J,Q))n4(J,Q,{get:gZ.bind($,Q),enumerable:!0});if(q)z.set($,J);return J};var K=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var Q0=import.meta.require;var _$=K((uZ)=>{class p2 extends Error{constructor($,X,Z){super(Z);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=X,this.exitCode=$,this.nestedError=void 0}}class o4 extends p2{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}uZ.CommanderError=p2;uZ.InvalidArgumentError=o4});var T1=K((lZ)=>{var{InvalidArgumentError:pZ}=_$();class t4{constructor($,X){switch(this.description=X||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue($,X){if(X===this.defaultValue||!Array.isArray(X))return[$];return X.push($),X}default($,X){return this.defaultValue=$,this.defaultValueDescription=X,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(X,Z)=>{if(!this.argChoices.includes(X))throw new pZ(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(X,Z);return X},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function cZ($){let X=$.name()+($.variadic===!0?"...":"");return $.required?"<"+X+">":"["+X+"]"}lZ.Argument=t4;lZ.humanReadableArgName=cZ});var c2=K((nZ)=>{var{humanReadableArgName:sZ}=T1();class e4{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let X=$.commands.filter((q)=>!q._hidden),Z=$._getHelpCommand();if(Z&&!Z._hidden)X.push(Z);if(this.sortSubcommands)X.sort((q,z)=>{return q.name().localeCompare(z.name())});return X}compareOptions($,X){let Z=(q)=>{return q.short?q.short.replace(/^-/,""):q.long.replace(/^--/,"")};return Z($).localeCompare(Z(X))}visibleOptions($){let X=$.options.filter((q)=>!q.hidden),Z=$._getHelpOption();if(Z&&!Z.hidden){let q=Z.short&&$._findOption(Z.short),z=Z.long&&$._findOption(Z.long);if(!q&&!z)X.push(Z);else if(Z.long&&!z)X.push($.createOption(Z.long,Z.description));else if(Z.short&&!q)X.push($.createOption(Z.short,Z.description))}if(this.sortOptions)X.sort(this.compareOptions);return X}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let X=[];for(let Z=$.parent;Z;Z=Z.parent){let q=Z.options.filter((z)=>!z.hidden);X.push(...q)}if(this.sortOptions)X.sort(this.compareOptions);return X}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((X)=>{X.description=X.description||$._argsDescription[X.name()]||""});if($.registeredArguments.find((X)=>X.description))return $.registeredArguments;return[]}subcommandTerm($){let X=$.registeredArguments.map((Z)=>sZ(Z)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(X?" "+X:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,X){return X.visibleCommands($).reduce((Z,q)=>{return Math.max(Z,this.displayWidth(X.styleSubcommandTerm(X.subcommandTerm(q))))},0)}longestOptionTermLength($,X){return X.visibleOptions($).reduce((Z,q)=>{return Math.max(Z,this.displayWidth(X.styleOptionTerm(X.optionTerm(q))))},0)}longestGlobalOptionTermLength($,X){return X.visibleGlobalOptions($).reduce((Z,q)=>{return Math.max(Z,this.displayWidth(X.styleOptionTerm(X.optionTerm(q))))},0)}longestArgumentTermLength($,X){return X.visibleArguments($).reduce((Z,q)=>{return Math.max(Z,this.displayWidth(X.styleArgumentTerm(X.argumentTerm(q))))},0)}commandUsage($){let X=$._name;if($._aliases[0])X=X+"|"+$._aliases[0];let Z="";for(let q=$.parent;q;q=q.parent)Z=q.name()+" "+Z;return Z+X+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let X=[];if($.argChoices)X.push(`choices: ${$.argChoices.map((Z)=>JSON.stringify(Z)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")X.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)X.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)X.push(`env: ${$.envVar}`);if(X.length>0){let Z=`(${X.join(", ")})`;if($.description)return`${$.description} ${Z}`;return Z}return $.description}argumentDescription($){let X=[];if($.argChoices)X.push(`choices: ${$.argChoices.map((Z)=>JSON.stringify(Z)).join(", ")}`);if($.defaultValue!==void 0)X.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(X.length>0){let Z=`(${X.join(", ")})`;if($.description)return`${$.description} ${Z}`;return Z}return $.description}formatItemList($,X,Z){if(X.length===0)return[];return[Z.styleTitle($),...X,""]}groupItems($,X,Z){let q=new Map;return $.forEach((z)=>{let G=Z(z);if(!q.has(G))q.set(G,[])}),X.forEach((z)=>{let G=Z(z);if(!q.has(G))q.set(G,[]);q.get(G).push(z)}),q}formatHelp($,X){let Z=X.padWidth($,X),q=X.helpWidth??80;function z(W,H){return X.formatItem(W,Z,H,X)}let G=[`${X.styleTitle("Usage:")} ${X.styleUsage(X.commandUsage($))}`,""],J=X.commandDescription($);if(J.length>0)G=G.concat([X.boxWrap(X.styleCommandDescription(J),q),""]);let Q=X.visibleArguments($).map((W)=>{return z(X.styleArgumentTerm(X.argumentTerm(W)),X.styleArgumentDescription(X.argumentDescription(W)))});if(G=G.concat(this.formatItemList("Arguments:",Q,X)),this.groupItems($.options,X.visibleOptions($),(W)=>W.helpGroupHeading??"Options:").forEach((W,H)=>{let V=W.map((w)=>{return z(X.styleOptionTerm(X.optionTerm(w)),X.styleOptionDescription(X.optionDescription(w)))});G=G.concat(this.formatItemList(H,V,X))}),X.showGlobalOptions){let W=X.visibleGlobalOptions($).map((H)=>{return z(X.styleOptionTerm(X.optionTerm(H)),X.styleOptionDescription(X.optionDescription(H)))});G=G.concat(this.formatItemList("Global Options:",W,X))}return this.groupItems($.commands,X.visibleCommands($),(W)=>W.helpGroup()||"Commands:").forEach((W,H)=>{let V=W.map((w)=>{return z(X.styleSubcommandTerm(X.subcommandTerm(w)),X.styleSubcommandDescription(X.subcommandDescription(w)))});G=G.concat(this.formatItemList(H,V,X))}),G.join(`
4
- `)}displayWidth($){return $X($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((X)=>{if(X==="[options]")return this.styleOptionText(X);if(X==="[command]")return this.styleSubcommandText(X);if(X[0]==="["||X[0]==="<")return this.styleArgumentText(X);return this.styleCommandText(X)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((X)=>{if(X==="[options]")return this.styleOptionText(X);if(X[0]==="["||X[0]==="<")return this.styleArgumentText(X);return this.styleSubcommandText(X)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,X){return Math.max(X.longestOptionTermLength($,X),X.longestGlobalOptionTermLength($,X),X.longestSubcommandTermLength($,X),X.longestArgumentTermLength($,X))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,X,Z,q){let G=" ".repeat(2);if(!Z)return G+$;let J=$.padEnd(X+$.length-q.displayWidth($)),Q=2,U=(this.helpWidth??80)-X-Q-2,W;if(U<this.minWidthToWrap||q.preformatted(Z))W=Z;else W=q.boxWrap(Z,U).replace(/\n/g,`
3
+ var y8=Object.create;var{getPrototypeOf:k8,defineProperty:n9,getOwnPropertyNames:f8}=Object;var g8=Object.prototype.hasOwnProperty;function h8($){return this[$]}var v8,u8,r9=($,X,Z)=>{var z=$!=null&&typeof $==="object";if(z){var q=X?v8??=new WeakMap:u8??=new WeakMap,G=q.get($);if(G)return G}Z=$!=null?y8(k8($)):{};let J=X||!$||!$.__esModule?n9(Z,"default",{value:$,enumerable:!0}):Z;for(let Q of f8($))if(!g8.call(J,Q))n9(J,Q,{get:h8.bind($,Q),enumerable:!0});if(z)q.set($,J);return J};var D=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var Q0=import.meta.require;var F$=D((m8)=>{class l2 extends Error{constructor($,X,Z){super(Z);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=X,this.exitCode=$,this.nestedError=void 0}}class o9 extends l2{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}m8.CommanderError=l2;m8.InvalidArgumentError=o9});var T1=D((i8)=>{var{InvalidArgumentError:l8}=F$();class t9{constructor($,X){switch(this.description=X||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.endsWith("..."))this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_collectValue($,X){if(X===this.defaultValue||!Array.isArray(X))return[$];return X.push($),X}default($,X){return this.defaultValue=$,this.defaultValueDescription=X,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(X,Z)=>{if(!this.argChoices.includes(X))throw new l8(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(X,Z);return X},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function c8($){let X=$.name()+($.variadic===!0?"...":"");return $.required?"<"+X+">":"["+X+"]"}i8.Argument=t9;i8.humanReadableArgName=c8});var c2=D((r8)=>{var{humanReadableArgName:n8}=T1();class e9{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext($){this.helpWidth=this.helpWidth??$.helpWidth??80}visibleCommands($){let X=$.commands.filter((z)=>!z._hidden),Z=$._getHelpCommand();if(Z&&!Z._hidden)X.push(Z);if(this.sortSubcommands)X.sort((z,q)=>{return z.name().localeCompare(q.name())});return X}compareOptions($,X){let Z=(z)=>{return z.short?z.short.replace(/^-/,""):z.long.replace(/^--/,"")};return Z($).localeCompare(Z(X))}visibleOptions($){let X=$.options.filter((z)=>!z.hidden),Z=$._getHelpOption();if(Z&&!Z.hidden){let z=Z.short&&$._findOption(Z.short),q=Z.long&&$._findOption(Z.long);if(!z&&!q)X.push(Z);else if(Z.long&&!q)X.push($.createOption(Z.long,Z.description));else if(Z.short&&!z)X.push($.createOption(Z.short,Z.description))}if(this.sortOptions)X.sort(this.compareOptions);return X}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let X=[];for(let Z=$.parent;Z;Z=Z.parent){let z=Z.options.filter((q)=>!q.hidden);X.push(...z)}if(this.sortOptions)X.sort(this.compareOptions);return X}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((X)=>{X.description=X.description||$._argsDescription[X.name()]||""});if($.registeredArguments.find((X)=>X.description))return $.registeredArguments;return[]}subcommandTerm($){let X=$.registeredArguments.map((Z)=>n8(Z)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(X?" "+X:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,X){return X.visibleCommands($).reduce((Z,z)=>{return Math.max(Z,this.displayWidth(X.styleSubcommandTerm(X.subcommandTerm(z))))},0)}longestOptionTermLength($,X){return X.visibleOptions($).reduce((Z,z)=>{return Math.max(Z,this.displayWidth(X.styleOptionTerm(X.optionTerm(z))))},0)}longestGlobalOptionTermLength($,X){return X.visibleGlobalOptions($).reduce((Z,z)=>{return Math.max(Z,this.displayWidth(X.styleOptionTerm(X.optionTerm(z))))},0)}longestArgumentTermLength($,X){return X.visibleArguments($).reduce((Z,z)=>{return Math.max(Z,this.displayWidth(X.styleArgumentTerm(X.argumentTerm(z))))},0)}commandUsage($){let X=$._name;if($._aliases[0])X=X+"|"+$._aliases[0];let Z="";for(let z=$.parent;z;z=z.parent)Z=z.name()+" "+Z;return Z+X+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let X=[];if($.argChoices)X.push(`choices: ${$.argChoices.map((Z)=>JSON.stringify(Z)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")X.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)X.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)X.push(`env: ${$.envVar}`);if(X.length>0){let Z=`(${X.join(", ")})`;if($.description)return`${$.description} ${Z}`;return Z}return $.description}argumentDescription($){let X=[];if($.argChoices)X.push(`choices: ${$.argChoices.map((Z)=>JSON.stringify(Z)).join(", ")}`);if($.defaultValue!==void 0)X.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(X.length>0){let Z=`(${X.join(", ")})`;if($.description)return`${$.description} ${Z}`;return Z}return $.description}formatItemList($,X,Z){if(X.length===0)return[];return[Z.styleTitle($),...X,""]}groupItems($,X,Z){let z=new Map;return $.forEach((q)=>{let G=Z(q);if(!z.has(G))z.set(G,[])}),X.forEach((q)=>{let G=Z(q);if(!z.has(G))z.set(G,[]);z.get(G).push(q)}),z}formatHelp($,X){let Z=X.padWidth($,X),z=X.helpWidth??80;function q(W,H){return X.formatItem(W,Z,H,X)}let G=[`${X.styleTitle("Usage:")} ${X.styleUsage(X.commandUsage($))}`,""],J=X.commandDescription($);if(J.length>0)G=G.concat([X.boxWrap(X.styleCommandDescription(J),z),""]);let Q=X.visibleArguments($).map((W)=>{return q(X.styleArgumentTerm(X.argumentTerm(W)),X.styleArgumentDescription(X.argumentDescription(W)))});if(G=G.concat(this.formatItemList("Arguments:",Q,X)),this.groupItems($.options,X.visibleOptions($),(W)=>W.helpGroupHeading??"Options:").forEach((W,H)=>{let V=W.map((B)=>{return q(X.styleOptionTerm(X.optionTerm(B)),X.styleOptionDescription(X.optionDescription(B)))});G=G.concat(this.formatItemList(H,V,X))}),X.showGlobalOptions){let W=X.visibleGlobalOptions($).map((H)=>{return q(X.styleOptionTerm(X.optionTerm(H)),X.styleOptionDescription(X.optionDescription(H)))});G=G.concat(this.formatItemList("Global Options:",W,X))}return this.groupItems($.commands,X.visibleCommands($),(W)=>W.helpGroup()||"Commands:").forEach((W,H)=>{let V=W.map((B)=>{return q(X.styleSubcommandTerm(X.subcommandTerm(B)),X.styleSubcommandDescription(X.subcommandDescription(B)))});G=G.concat(this.formatItemList(H,V,X))}),G.join(`
4
+ `)}displayWidth($){return $5($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((X)=>{if(X==="[options]")return this.styleOptionText(X);if(X==="[command]")return this.styleSubcommandText(X);if(X[0]==="["||X[0]==="<")return this.styleArgumentText(X);return this.styleCommandText(X)}).join(" ")}styleCommandDescription($){return this.styleDescriptionText($)}styleOptionDescription($){return this.styleDescriptionText($)}styleSubcommandDescription($){return this.styleDescriptionText($)}styleArgumentDescription($){return this.styleDescriptionText($)}styleDescriptionText($){return $}styleOptionTerm($){return this.styleOptionText($)}styleSubcommandTerm($){return $.split(" ").map((X)=>{if(X==="[options]")return this.styleOptionText(X);if(X[0]==="["||X[0]==="<")return this.styleArgumentText(X);return this.styleSubcommandText(X)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,X){return Math.max(X.longestOptionTermLength($,X),X.longestGlobalOptionTermLength($,X),X.longestSubcommandTermLength($,X),X.longestArgumentTermLength($,X))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,X,Z,z){let G=" ".repeat(2);if(!Z)return G+$;let J=$.padEnd(X+$.length-z.displayWidth($)),Q=2,U=(this.helpWidth??80)-X-Q-2,W;if(U<this.minWidthToWrap||z.preformatted(Z))W=Z;else W=z.boxWrap(Z,U).replace(/\n/g,`
5
5
  `+" ".repeat(X+Q));return G+J+" ".repeat(Q)+W.replace(/\n/g,`
6
- ${G}`)}boxWrap($,X){if(X<this.minWidthToWrap)return $;let Z=$.split(/\r\n|\n/),q=/[\s]*[^\s]+/g,z=[];return Z.forEach((G)=>{let J=G.match(q);if(J===null){z.push("");return}let Q=[J.shift()],Y=this.displayWidth(Q[0]);J.forEach((U)=>{let W=this.displayWidth(U);if(Y+W<=X){Q.push(U),Y+=W;return}z.push(Q.join(""));let H=U.trimStart();Q=[H],Y=this.displayWidth(H)}),z.push(Q.join(""))}),z.join(`
7
- `)}}function $X($){let X=/\x1b\[\d*(;\d*)*m/g;return $.replace(X,"")}nZ.Help=e4;nZ.stripColor=$X});var l2=K(($6)=>{var{InvalidArgumentError:tZ}=_$();class ZX{constructor($,X){this.flags=$,this.description=X||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let Z=eZ($);if(this.short=Z.shortFlag,this.long=Z.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default($,X){return this.defaultValue=$,this.defaultValueDescription=X,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let X=$;if(typeof $==="string")X={[$]:!0};return this.implied=Object.assign(this.implied||{},X),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_collectValue($,X){if(X===this.defaultValue||!Array.isArray(X))return[$];return X.push($),X}choices($){return this.argChoices=$.slice(),this.parseArg=(X,Z)=>{if(!this.argChoices.includes(X))throw new tZ(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(X,Z);return X},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return XX(this.name().replace(/^no-/,""));return XX(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class qX{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((X)=>{if(X.negate)this.negativeOptions.set(X.attributeName(),X);else this.positiveOptions.set(X.attributeName(),X)}),this.negativeOptions.forEach((X,Z)=>{if(this.positiveOptions.has(Z))this.dualOptions.add(Z)})}valueFromOption($,X){let Z=X.attributeName();if(!this.dualOptions.has(Z))return!0;let q=this.negativeOptions.get(Z).presetArg,z=q!==void 0?q:!1;return X.negate===(z===$)}}function XX($){return $.split("-").reduce((X,Z)=>{return X+Z[0].toUpperCase()+Z.slice(1)})}function eZ($){let X,Z,q=/^-[^-]$/,z=/^--[^-]/,G=$.split(/[ |,]+/).concat("guard");if(q.test(G[0]))X=G.shift();if(z.test(G[0]))Z=G.shift();if(!X&&q.test(G[0]))X=G.shift();if(!X&&z.test(G[0]))X=Z,Z=G.shift();if(G[0].startsWith("-")){let J=G[0],Q=`option creation failed due to '${J}' in option flags '${$}'`;if(/^-[^-][^-]/.test(J))throw Error(`${Q}
6
+ ${G}`)}boxWrap($,X){if(X<this.minWidthToWrap)return $;let Z=$.split(/\r\n|\n/),z=/[\s]*[^\s]+/g,q=[];return Z.forEach((G)=>{let J=G.match(z);if(J===null){q.push("");return}let Q=[J.shift()],Y=this.displayWidth(Q[0]);J.forEach((U)=>{let W=this.displayWidth(U);if(Y+W<=X){Q.push(U),Y+=W;return}q.push(Q.join(""));let H=U.trimStart();Q=[H],Y=this.displayWidth(H)}),q.push(Q.join(""))}),q.join(`
7
+ `)}}function $5($){let X=/\x1b\[\d*(;\d*)*m/g;return $.replace(X,"")}r8.Help=e9;r8.stripColor=$5});var i2=D((XZ)=>{var{InvalidArgumentError:e8}=F$();class Z5{constructor($,X){this.flags=$,this.description=X||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let Z=$Z($);if(this.short=Z.shortFlag,this.long=Z.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default($,X){return this.defaultValue=$,this.defaultValueDescription=X,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let X=$;if(typeof $==="string")X={[$]:!0};return this.implied=Object.assign(this.implied||{},X),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_collectValue($,X){if(X===this.defaultValue||!Array.isArray(X))return[$];return X.push($),X}choices($){return this.argChoices=$.slice(),this.parseArg=(X,Z)=>{if(!this.argChoices.includes(X))throw new e8(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(X,Z);return X},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return X5(this.name().replace(/^no-/,""));return X5(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class z5{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((X)=>{if(X.negate)this.negativeOptions.set(X.attributeName(),X);else this.positiveOptions.set(X.attributeName(),X)}),this.negativeOptions.forEach((X,Z)=>{if(this.positiveOptions.has(Z))this.dualOptions.add(Z)})}valueFromOption($,X){let Z=X.attributeName();if(!this.dualOptions.has(Z))return!0;let z=this.negativeOptions.get(Z).presetArg,q=z!==void 0?z:!1;return X.negate===(q===$)}}function X5($){return $.split("-").reduce((X,Z)=>{return X+Z[0].toUpperCase()+Z.slice(1)})}function $Z($){let X,Z,z=/^-[^-]$/,q=/^--[^-]/,G=$.split(/[ |,]+/).concat("guard");if(z.test(G[0]))X=G.shift();if(q.test(G[0]))Z=G.shift();if(!X&&z.test(G[0]))X=G.shift();if(!X&&q.test(G[0]))X=Z,Z=G.shift();if(G[0].startsWith("-")){let J=G[0],Q=`option creation failed due to '${J}' in option flags '${$}'`;if(/^-[^-][^-]/.test(J))throw Error(`${Q}
8
8
  - a short flag is a single dash and a single character
9
9
  - either use a single dash and a single character (for a short flag)
10
- - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(q.test(J))throw Error(`${Q}
11
- - too many short flags`);if(z.test(J))throw Error(`${Q}
10
+ - or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(z.test(J))throw Error(`${Q}
11
+ - too many short flags`);if(q.test(J))throw Error(`${Q}
12
12
  - too many long flags`);throw Error(`${Q}
13
- - unrecognised flag format`)}if(X===void 0&&Z===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:X,longFlag:Z}}$6.Option=ZX;$6.DualOptions=qX});var zX=K((G6)=>{function q6($,X){if(Math.abs($.length-X.length)>3)return Math.max($.length,X.length);let Z=[];for(let q=0;q<=$.length;q++)Z[q]=[q];for(let q=0;q<=X.length;q++)Z[0][q]=q;for(let q=1;q<=X.length;q++)for(let z=1;z<=$.length;z++){let G=1;if($[z-1]===X[q-1])G=0;else G=1;if(Z[z][q]=Math.min(Z[z-1][q]+1,Z[z][q-1]+1,Z[z-1][q-1]+G),z>1&&q>1&&$[z-1]===X[q-2]&&$[z-2]===X[q-1])Z[z][q]=Math.min(Z[z][q],Z[z-2][q-2]+1)}return Z[$.length][X.length]}function z6($,X){if(!X||X.length===0)return"";X=Array.from(new Set(X));let Z=$.startsWith("--");if(Z)$=$.slice(2),X=X.map((J)=>J.slice(2));let q=[],z=3,G=0.4;if(X.forEach((J)=>{if(J.length<=1)return;let Q=q6($,J),Y=Math.max($.length,J.length);if((Y-Q)/Y>G){if(Q<z)z=Q,q=[J];else if(Q===z)q.push(J)}}),q.sort((J,Q)=>J.localeCompare(Q)),Z)q=q.map((J)=>`--${J}`);if(q.length>1)return`
14
- (Did you mean one of ${q.join(", ")}?)`;if(q.length===1)return`
15
- (Did you mean ${q[0]}?)`;return""}G6.suggestSimilar=z6});var YX=K((T6)=>{var Q6=Q0("events").EventEmitter,i2=Q0("child_process"),Y0=Q0("path"),w1=Q0("fs"),E=Q0("process"),{Argument:Y6,humanReadableArgName:U6}=T1(),{CommanderError:a2}=_$(),{Help:H6,stripColor:W6}=c2(),{Option:GX,DualOptions:V6}=l2(),{suggestSimilar:JX}=zX();class n2 extends Q6{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(X)=>E.stdout.write(X),writeErr:(X)=>E.stderr.write(X),outputError:(X,Z)=>Z(X),getOutHelpWidth:()=>E.stdout.isTTY?E.stdout.columns:void 0,getErrHelpWidth:()=>E.stderr.isTTY?E.stderr.columns:void 0,getOutHasColors:()=>s2()??(E.stdout.isTTY&&E.stdout.hasColors?.()),getErrHasColors:()=>s2()??(E.stderr.isTTY&&E.stderr.hasColors?.()),stripColor:(X)=>W6(X)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let X=this;X;X=X.parent)$.push(X);return $}command($,X,Z){let q=X,z=Z;if(typeof q==="object"&&q!==null)z=q,q=null;z=z||{};let[,G,J]=$.match(/([^ ]+) *(.*)/),Q=this.createCommand(G);if(q)Q.description(q),Q._executableHandler=!0;if(z.isDefault)this._defaultCommandName=Q._name;if(Q._hidden=!!(z.noHelp||z.hidden),Q._executableFile=z.executableFile||null,J)Q.arguments(J);if(this._registerCommand(Q),Q.parent=this,Q.copyInheritedSettings(this),q)return this;return Q}createCommand($){return new n2($)}createHelp(){return Object.assign(new H6,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...$},this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,X){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
16
- - specify the name in Command constructor or using .name()`);if(X=X||{},X.isDefault)this._defaultCommandName=$._name;if(X.noHelp||X.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,X){return new Y6($,X)}argument($,X,Z,q){let z=this.createArgument($,X);if(typeof Z==="function")z.default(q).argParser(Z);else z.default(Z);return this.addArgument(z),this}arguments($){return $.trim().split(/ +/).forEach((X)=>{this.argument(X)}),this}addArgument($){let X=this.registeredArguments.slice(-1)[0];if(X?.variadic)throw Error(`only the last argument can be variadic '${X.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,X){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let Z=$??"help [command]",[,q,z]=Z.match(/([^ ]+) *(.*)/),G=X??"display help for command",J=this.createCommand(q);if(J.helpOption(!1),z)J.arguments(z);if(G)J.description(G);if(this._addImplicitHelpCommand=!0,this._helpCommand=J,$||X)this._initCommandGroup(J);return this}addHelpCommand($,X){if(typeof $!=="object")return this.helpCommand($,X),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this._initCommandGroup($),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook($,X){let Z=["preSubcommand","preAction","postAction"];if(!Z.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
17
- Expecting one of '${Z.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(X);else this._lifeCycleHooks[$]=[X];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(X)=>{if(X.code!=="commander.executeSubCommandAsync")throw X};return this}_exit($,X,Z){if(this._exitCallback)this._exitCallback(new a2($,X,Z));E.exit($)}action($){let X=(Z)=>{let q=this.registeredArguments.length,z=Z.slice(0,q);if(this._storeOptionsAsProperties)z[q]=this;else z[q]=this.opts();return z.push(this),$.apply(this,z)};return this._actionHandler=X,this}createOption($,X){return new GX($,X)}_callParseArg($,X,Z,q){try{return $.parseArg(X,Z)}catch(z){if(z.code==="commander.invalidArgument"){let G=`${q} ${z.message}`;this.error(G,{exitCode:z.exitCode,code:z.code})}throw z}}_registerOption($){let X=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(X){let Z=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${Z}'
18
- - already used by option '${X.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let X=(q)=>{return[q.name()].concat(q.aliases())},Z=X($).find((q)=>this._findCommand(q));if(Z){let q=X(this._findCommand(Z)).join("|"),z=X($).join("|");throw Error(`cannot add command '${z}' as already have command '${q}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let X=$.name(),Z=$.attributeName();if($.negate){let z=$.long.replace(/^--no-/,"--");if(!this._findOption(z))this.setOptionValueWithSource(Z,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(Z,$.defaultValue,"default");let q=(z,G,J)=>{if(z==null&&$.presetArg!==void 0)z=$.presetArg;let Q=this.getOptionValue(Z);if(z!==null&&$.parseArg)z=this._callParseArg($,z,Q,G);else if(z!==null&&$.variadic)z=$._collectValue(z,Q);if(z==null)if($.negate)z=!1;else if($.isBoolean()||$.optional)z=!0;else z="";this.setOptionValueWithSource(Z,z,J)};if(this.on("option:"+X,(z)=>{let G=`error: option '${$.flags}' argument '${z}' is invalid.`;q(z,G,"cli")}),$.envVar)this.on("optionEnv:"+X,(z)=>{let G=`error: option '${$.flags}' value '${z}' from env '${$.envVar}' is invalid.`;q(z,G,"env")});return this}_optionEx($,X,Z,q,z){if(typeof X==="object"&&X instanceof GX)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let G=this.createOption(X,Z);if(G.makeOptionMandatory(!!$.mandatory),typeof q==="function")G.default(z).argParser(q);else if(q instanceof RegExp){let J=q;q=(Q,Y)=>{let U=J.exec(Q);return U?U[0]:Y},G.default(z).argParser(q)}else G.default(q);return this.addOption(G)}option($,X,Z,q){return this._optionEx({},$,X,Z,q)}requiredOption($,X,Z,q){return this._optionEx({mandatory:!0},$,X,Z,q)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,X){return this.setOptionValueWithSource($,X,void 0)}setOptionValueWithSource($,X,Z){if(this._storeOptionsAsProperties)this[$]=X;else this._optionValues[$]=X;return this._optionValueSources[$]=Z,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let X;return this._getCommandAndAncestors().forEach((Z)=>{if(Z.getOptionValueSource($)!==void 0)X=Z.getOptionValueSource($)}),X}_prepareUserArgs($,X){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(X=X||{},$===void 0&&X.from===void 0){if(E.versions?.electron)X.from="electron";let q=E.execArgv??[];if(q.includes("-e")||q.includes("--eval")||q.includes("-p")||q.includes("--print"))X.from="eval"}if($===void 0)$=E.argv;this.rawArgs=$.slice();let Z;switch(X.from){case void 0:case"node":this._scriptPath=$[1],Z=$.slice(2);break;case"electron":if(E.defaultApp)this._scriptPath=$[1],Z=$.slice(2);else Z=$.slice(1);break;case"user":Z=$.slice(0);break;case"eval":Z=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${X.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",Z}parse($,X){this._prepareForParse();let Z=this._prepareUserArgs($,X);return this._parseCommand([],Z),this}async parseAsync($,X){this._prepareForParse();let Z=this._prepareUserArgs($,X);return await this._parseCommand([],Z),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
19
- - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,X,Z){if(w1.existsSync($))return;let q=X?`searched for local subcommand relative to directory '${X}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",z=`'${$}' does not exist
13
+ - unrecognised flag format`)}if(X===void 0&&Z===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:X,longFlag:Z}}XZ.Option=Z5;XZ.DualOptions=z5});var q5=D((JZ)=>{function qZ($,X){if(Math.abs($.length-X.length)>3)return Math.max($.length,X.length);let Z=[];for(let z=0;z<=$.length;z++)Z[z]=[z];for(let z=0;z<=X.length;z++)Z[0][z]=z;for(let z=1;z<=X.length;z++)for(let q=1;q<=$.length;q++){let G=1;if($[q-1]===X[z-1])G=0;else G=1;if(Z[q][z]=Math.min(Z[q-1][z]+1,Z[q][z-1]+1,Z[q-1][z-1]+G),q>1&&z>1&&$[q-1]===X[z-2]&&$[q-2]===X[z-1])Z[q][z]=Math.min(Z[q][z],Z[q-2][z-2]+1)}return Z[$.length][X.length]}function GZ($,X){if(!X||X.length===0)return"";X=Array.from(new Set(X));let Z=$.startsWith("--");if(Z)$=$.slice(2),X=X.map((J)=>J.slice(2));let z=[],q=3,G=0.4;if(X.forEach((J)=>{if(J.length<=1)return;let Q=qZ($,J),Y=Math.max($.length,J.length);if((Y-Q)/Y>G){if(Q<q)q=Q,z=[J];else if(Q===q)z.push(J)}}),z.sort((J,Q)=>J.localeCompare(Q)),Z)z=z.map((J)=>`--${J}`);if(z.length>1)return`
14
+ (Did you mean one of ${z.join(", ")}?)`;if(z.length===1)return`
15
+ (Did you mean ${z[0]}?)`;return""}JZ.suggestSimilar=GZ});var Y5=D((BZ)=>{var YZ=Q0("events").EventEmitter,a2=Q0("child_process"),Y0=Q0("path"),B1=Q0("fs"),C=Q0("process"),{Argument:UZ,humanReadableArgName:HZ}=T1(),{CommanderError:s2}=F$(),{Help:WZ,stripColor:VZ}=c2(),{Option:G5,DualOptions:TZ}=i2(),{suggestSimilar:J5}=q5();class r2 extends YZ{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:(X)=>C.stdout.write(X),writeErr:(X)=>C.stderr.write(X),outputError:(X,Z)=>Z(X),getOutHelpWidth:()=>C.stdout.isTTY?C.stdout.columns:void 0,getErrHelpWidth:()=>C.stderr.isTTY?C.stderr.columns:void 0,getOutHasColors:()=>n2()??(C.stdout.isTTY&&C.stdout.hasColors?.()),getErrHasColors:()=>n2()??(C.stderr.isTTY&&C.stderr.hasColors?.()),stripColor:(X)=>VZ(X)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._helpOption=$._helpOption,this._helpCommand=$._helpCommand,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let X=this;X;X=X.parent)$.push(X);return $}command($,X,Z){let z=X,q=Z;if(typeof z==="object"&&z!==null)q=z,z=null;q=q||{};let[,G,J]=$.match(/([^ ]+) *(.*)/),Q=this.createCommand(G);if(z)Q.description(z),Q._executableHandler=!0;if(q.isDefault)this._defaultCommandName=Q._name;if(Q._hidden=!!(q.noHelp||q.hidden),Q._executableFile=q.executableFile||null,J)Q.arguments(J);if(this._registerCommand(Q),Q.parent=this,Q.copyInheritedSettings(this),z)return this;return Q}createCommand($){return new r2($)}createHelp(){return Object.assign(new WZ,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return this._outputConfiguration={...this._outputConfiguration,...$},this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,X){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
16
+ - specify the name in Command constructor or using .name()`);if(X=X||{},X.isDefault)this._defaultCommandName=$._name;if(X.noHelp||X.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,X){return new UZ($,X)}argument($,X,Z,z){let q=this.createArgument($,X);if(typeof Z==="function")q.default(z).argParser(Z);else q.default(Z);return this.addArgument(q),this}arguments($){return $.trim().split(/ +/).forEach((X)=>{this.argument(X)}),this}addArgument($){let X=this.registeredArguments.slice(-1)[0];if(X?.variadic)throw Error(`only the last argument can be variadic '${X.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}helpCommand($,X){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let Z=$??"help [command]",[,z,q]=Z.match(/([^ ]+) *(.*)/),G=X??"display help for command",J=this.createCommand(z);if(J.helpOption(!1),q)J.arguments(q);if(G)J.description(G);if(this._addImplicitHelpCommand=!0,this._helpCommand=J,$||X)this._initCommandGroup(J);return this}addHelpCommand($,X){if(typeof $!=="object")return this.helpCommand($,X),this;return this._addImplicitHelpCommand=!0,this._helpCommand=$,this._initCommandGroup($),this}_getHelpCommand(){if(this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))){if(this._helpCommand===void 0)this.helpCommand(void 0,void 0);return this._helpCommand}return null}hook($,X){let Z=["preSubcommand","preAction","postAction"];if(!Z.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
17
+ Expecting one of '${Z.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(X);else this._lifeCycleHooks[$]=[X];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(X)=>{if(X.code!=="commander.executeSubCommandAsync")throw X};return this}_exit($,X,Z){if(this._exitCallback)this._exitCallback(new s2($,X,Z));C.exit($)}action($){let X=(Z)=>{let z=this.registeredArguments.length,q=Z.slice(0,z);if(this._storeOptionsAsProperties)q[z]=this;else q[z]=this.opts();return q.push(this),$.apply(this,q)};return this._actionHandler=X,this}createOption($,X){return new G5($,X)}_callParseArg($,X,Z,z){try{return $.parseArg(X,Z)}catch(q){if(q.code==="commander.invalidArgument"){let G=`${z} ${q.message}`;this.error(G,{exitCode:q.exitCode,code:q.code})}throw q}}_registerOption($){let X=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(X){let Z=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${Z}'
18
+ - already used by option '${X.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let X=(z)=>{return[z.name()].concat(z.aliases())},Z=X($).find((z)=>this._findCommand(z));if(Z){let z=X(this._findCommand(Z)).join("|"),q=X($).join("|");throw Error(`cannot add command '${q}' as already have command '${z}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let X=$.name(),Z=$.attributeName();if($.negate){let q=$.long.replace(/^--no-/,"--");if(!this._findOption(q))this.setOptionValueWithSource(Z,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(Z,$.defaultValue,"default");let z=(q,G,J)=>{if(q==null&&$.presetArg!==void 0)q=$.presetArg;let Q=this.getOptionValue(Z);if(q!==null&&$.parseArg)q=this._callParseArg($,q,Q,G);else if(q!==null&&$.variadic)q=$._collectValue(q,Q);if(q==null)if($.negate)q=!1;else if($.isBoolean()||$.optional)q=!0;else q="";this.setOptionValueWithSource(Z,q,J)};if(this.on("option:"+X,(q)=>{let G=`error: option '${$.flags}' argument '${q}' is invalid.`;z(q,G,"cli")}),$.envVar)this.on("optionEnv:"+X,(q)=>{let G=`error: option '${$.flags}' value '${q}' from env '${$.envVar}' is invalid.`;z(q,G,"env")});return this}_optionEx($,X,Z,z,q){if(typeof X==="object"&&X instanceof G5)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let G=this.createOption(X,Z);if(G.makeOptionMandatory(!!$.mandatory),typeof z==="function")G.default(q).argParser(z);else if(z instanceof RegExp){let J=z;z=(Q,Y)=>{let U=J.exec(Q);return U?U[0]:Y},G.default(q).argParser(z)}else G.default(z);return this.addOption(G)}option($,X,Z,z){return this._optionEx({},$,X,Z,z)}requiredOption($,X,Z,z){return this._optionEx({mandatory:!0},$,X,Z,z)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,X){return this.setOptionValueWithSource($,X,void 0)}setOptionValueWithSource($,X,Z){if(this._storeOptionsAsProperties)this[$]=X;else this._optionValues[$]=X;return this._optionValueSources[$]=Z,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let X;return this._getCommandAndAncestors().forEach((Z)=>{if(Z.getOptionValueSource($)!==void 0)X=Z.getOptionValueSource($)}),X}_prepareUserArgs($,X){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(X=X||{},$===void 0&&X.from===void 0){if(C.versions?.electron)X.from="electron";let z=C.execArgv??[];if(z.includes("-e")||z.includes("--eval")||z.includes("-p")||z.includes("--print"))X.from="eval"}if($===void 0)$=C.argv;this.rawArgs=$.slice();let Z;switch(X.from){case void 0:case"node":this._scriptPath=$[1],Z=$.slice(2);break;case"electron":if(C.defaultApp)this._scriptPath=$[1],Z=$.slice(2);else Z=$.slice(1);break;case"user":Z=$.slice(0);break;case"eval":Z=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${X.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",Z}parse($,X){this._prepareForParse();let Z=this._prepareUserArgs($,X);return this._parseCommand([],Z),this}async parseAsync($,X){this._prepareForParse();let Z=this._prepareUserArgs($,X);return await this._parseCommand([],Z),this}_prepareForParse(){if(this._savedState===null)this.saveStateBeforeParse();else this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
19
+ - either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable($,X,Z){if(B1.existsSync($))return;let z=X?`searched for local subcommand relative to directory '${X}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",q=`'${$}' does not exist
20
20
  - if '${Z}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
21
21
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
22
- - ${q}`;throw Error(z)}_executeSubCommand($,X){X=X.slice();let Z=!1,q=[".js",".ts",".tsx",".mjs",".cjs"];function z(U,W){let H=Y0.resolve(U,W);if(w1.existsSync(H))return H;if(q.includes(Y0.extname(W)))return;let V=q.find((w)=>w1.existsSync(`${H}${w}`));if(V)return`${H}${V}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let G=$._executableFile||`${this._name}-${$._name}`,J=this._executableDir||"";if(this._scriptPath){let U;try{U=w1.realpathSync(this._scriptPath)}catch{U=this._scriptPath}J=Y0.resolve(Y0.dirname(U),J)}if(J){let U=z(J,G);if(!U&&!$._executableFile&&this._scriptPath){let W=Y0.basename(this._scriptPath,Y0.extname(this._scriptPath));if(W!==this._name)U=z(J,`${W}-${$._name}`)}G=U||G}Z=q.includes(Y0.extname(G));let Q;if(E.platform!=="win32")if(Z)X.unshift(G),X=QX(E.execArgv).concat(X),Q=i2.spawn(E.argv[0],X,{stdio:"inherit"});else Q=i2.spawn(G,X,{stdio:"inherit"});else this._checkForMissingExecutable(G,J,$._name),X.unshift(G),X=QX(E.execArgv).concat(X),Q=i2.spawn(E.execPath,X,{stdio:"inherit"});if(!Q.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((W)=>{E.on(W,()=>{if(Q.killed===!1&&Q.exitCode===null)Q.kill(W)})});let Y=this._exitCallback;Q.on("close",(U)=>{if(U=U??1,!Y)E.exit(U);else Y(new a2(U,"commander.executeSubCommandAsync","(close)"))}),Q.on("error",(U)=>{if(U.code==="ENOENT")this._checkForMissingExecutable(G,J,$._name);else if(U.code==="EACCES")throw Error(`'${G}' not executable`);if(!Y)E.exit(1);else{let W=new a2(1,"commander.executeSubCommandAsync","(error)");W.nestedError=U,Y(W)}}),this.runningCommand=Q}_dispatchSubcommand($,X,Z){let q=this._findCommand($);if(!q)this.help({error:!0});q._prepareForParse();let z;return z=this._chainOrCallSubCommandHook(z,q,"preSubcommand"),z=this._chainOrCall(z,()=>{if(q._executableHandler)this._executeSubCommand(q,X.concat(Z));else return q._parseCommand(X,Z)}),z}_dispatchHelpCommand($){if(!$)this.help();let X=this._findCommand($);if(X&&!X._executableHandler)X.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,X)=>{if($.required&&this.args[X]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(Z,q,z)=>{let G=q;if(q!==null&&Z.parseArg){let J=`error: command-argument value '${q}' is invalid for argument '${Z.name()}'.`;G=this._callParseArg(Z,q,z,J)}return G};this._checkNumberOfArguments();let X=[];this.registeredArguments.forEach((Z,q)=>{let z=Z.defaultValue;if(Z.variadic){if(q<this.args.length){if(z=this.args.slice(q),Z.parseArg)z=z.reduce((G,J)=>{return $(Z,J,G)},Z.defaultValue)}else if(z===void 0)z=[]}else if(q<this.args.length){if(z=this.args[q],Z.parseArg)z=$(Z,z,Z.defaultValue)}X[q]=z}),this.processedArgs=X}_chainOrCall($,X){if($?.then&&typeof $.then==="function")return $.then(()=>X());return X()}_chainOrCallHooks($,X){let Z=$,q=[];if(this._getCommandAndAncestors().reverse().filter((z)=>z._lifeCycleHooks[X]!==void 0).forEach((z)=>{z._lifeCycleHooks[X].forEach((G)=>{q.push({hookedCommand:z,callback:G})})}),X==="postAction")q.reverse();return q.forEach((z)=>{Z=this._chainOrCall(Z,()=>{return z.callback(z.hookedCommand,this)})}),Z}_chainOrCallSubCommandHook($,X,Z){let q=$;if(this._lifeCycleHooks[Z]!==void 0)this._lifeCycleHooks[Z].forEach((z)=>{q=this._chainOrCall(q,()=>{return z(this,X)})});return q}_parseCommand($,X){let Z=this.parseOptions(X);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(Z.operands),X=Z.unknown,this.args=$.concat(X),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),X);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(X),this._dispatchSubcommand(this._defaultCommandName,$,X);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(Z.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let q=()=>{if(Z.unknown.length>0)this.unknownOption(Z.unknown[0])},z=`command:${this.name()}`;if(this._actionHandler){q(),this._processArguments();let G;if(G=this._chainOrCallHooks(G,"preAction"),G=this._chainOrCall(G,()=>this._actionHandler(this.processedArgs)),this.parent)G=this._chainOrCall(G,()=>{this.parent.emit(z,$,X)});return G=this._chainOrCallHooks(G,"postAction"),G}if(this.parent?.listenerCount(z))q(),this._processArguments(),this.parent.emit(z,$,X);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,X);if(this.listenerCount("command:*"))this.emit("command:*",$,X);else if(this.commands.length)this.unknownCommand();else q(),this._processArguments()}else if(this.commands.length)q(),this.help({error:!0});else q(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((X)=>X._name===$||X._aliases.includes($))}_findOption($){return this.options.find((X)=>X.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((X)=>{if(X.mandatory&&$.getOptionValue(X.attributeName())===void 0)$.missingMandatoryOptionValue(X)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((Z)=>{let q=Z.attributeName();if(this.getOptionValue(q)===void 0)return!1;return this.getOptionValueSource(q)!=="default"});$.filter((Z)=>Z.conflictsWith.length>0).forEach((Z)=>{let q=$.find((z)=>Z.conflictsWith.includes(z.attributeName()));if(q)this._conflictingOption(Z,q)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let X=[],Z=[],q=X;function z(U){return U.length>1&&U[0]==="-"}let G=(U)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(U))return!1;return!this._getCommandAndAncestors().some((W)=>W.options.map((H)=>H.short).some((H)=>/^-\d$/.test(H)))},J=null,Q=null,Y=0;while(Y<$.length||Q){let U=Q??$[Y++];if(Q=null,U==="--"){if(q===Z)q.push(U);q.push(...$.slice(Y));break}if(J&&(!z(U)||G(U))){this.emit(`option:${J.name()}`,U);continue}if(J=null,z(U)){let W=this._findOption(U);if(W){if(W.required){let H=$[Y++];if(H===void 0)this.optionMissingArgument(W);this.emit(`option:${W.name()}`,H)}else if(W.optional){let H=null;if(Y<$.length&&(!z($[Y])||G($[Y])))H=$[Y++];this.emit(`option:${W.name()}`,H)}else this.emit(`option:${W.name()}`);J=W.variadic?W:null;continue}}if(U.length>2&&U[0]==="-"&&U[1]!=="-"){let W=this._findOption(`-${U[1]}`);if(W){if(W.required||W.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${W.name()}`,U.slice(2));else this.emit(`option:${W.name()}`),Q=`-${U.slice(2)}`;continue}}if(/^--[^=]+=/.test(U)){let W=U.indexOf("="),H=this._findOption(U.slice(0,W));if(H&&(H.required||H.optional)){this.emit(`option:${H.name()}`,U.slice(W+1));continue}}if(q===X&&z(U)&&!(this.commands.length===0&&G(U)))q=Z;if((this._enablePositionalOptions||this._passThroughOptions)&&X.length===0&&Z.length===0){if(this._findCommand(U)){X.push(U),Z.push(...$.slice(Y));break}else if(this._getHelpCommand()&&U===this._getHelpCommand().name()){X.push(U,...$.slice(Y));break}else if(this._defaultCommandName){Z.push(U,...$.slice(Y));break}}if(this._passThroughOptions){q.push(U,...$.slice(Y));break}q.push(U)}return{operands:X,unknown:Z}}opts(){if(this._storeOptionsAsProperties){let $={},X=this.options.length;for(let Z=0;Z<X;Z++){let q=this.options[Z].attributeName();$[q]=q===this._versionOptionName?this._version:this[q]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,X)=>Object.assign($,X.opts()),{})}error($,X){if(this._outputConfiguration.outputError(`${$}
22
+ - ${z}`;throw Error(q)}_executeSubCommand($,X){X=X.slice();let Z=!1,z=[".js",".ts",".tsx",".mjs",".cjs"];function q(U,W){let H=Y0.resolve(U,W);if(B1.existsSync(H))return H;if(z.includes(Y0.extname(W)))return;let V=z.find((B)=>B1.existsSync(`${H}${B}`));if(V)return`${H}${V}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let G=$._executableFile||`${this._name}-${$._name}`,J=this._executableDir||"";if(this._scriptPath){let U;try{U=B1.realpathSync(this._scriptPath)}catch{U=this._scriptPath}J=Y0.resolve(Y0.dirname(U),J)}if(J){let U=q(J,G);if(!U&&!$._executableFile&&this._scriptPath){let W=Y0.basename(this._scriptPath,Y0.extname(this._scriptPath));if(W!==this._name)U=q(J,`${W}-${$._name}`)}G=U||G}Z=z.includes(Y0.extname(G));let Q;if(C.platform!=="win32")if(Z)X.unshift(G),X=Q5(C.execArgv).concat(X),Q=a2.spawn(C.argv[0],X,{stdio:"inherit"});else Q=a2.spawn(G,X,{stdio:"inherit"});else this._checkForMissingExecutable(G,J,$._name),X.unshift(G),X=Q5(C.execArgv).concat(X),Q=a2.spawn(C.execPath,X,{stdio:"inherit"});if(!Q.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((W)=>{C.on(W,()=>{if(Q.killed===!1&&Q.exitCode===null)Q.kill(W)})});let Y=this._exitCallback;Q.on("close",(U)=>{if(U=U??1,!Y)C.exit(U);else Y(new s2(U,"commander.executeSubCommandAsync","(close)"))}),Q.on("error",(U)=>{if(U.code==="ENOENT")this._checkForMissingExecutable(G,J,$._name);else if(U.code==="EACCES")throw Error(`'${G}' not executable`);if(!Y)C.exit(1);else{let W=new s2(1,"commander.executeSubCommandAsync","(error)");W.nestedError=U,Y(W)}}),this.runningCommand=Q}_dispatchSubcommand($,X,Z){let z=this._findCommand($);if(!z)this.help({error:!0});z._prepareForParse();let q;return q=this._chainOrCallSubCommandHook(q,z,"preSubcommand"),q=this._chainOrCall(q,()=>{if(z._executableHandler)this._executeSubCommand(z,X.concat(Z));else return z._parseCommand(X,Z)}),q}_dispatchHelpCommand($){if(!$)this.help();let X=this._findCommand($);if(X&&!X._executableHandler)X.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,X)=>{if($.required&&this.args[X]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(Z,z,q)=>{let G=z;if(z!==null&&Z.parseArg){let J=`error: command-argument value '${z}' is invalid for argument '${Z.name()}'.`;G=this._callParseArg(Z,z,q,J)}return G};this._checkNumberOfArguments();let X=[];this.registeredArguments.forEach((Z,z)=>{let q=Z.defaultValue;if(Z.variadic){if(z<this.args.length){if(q=this.args.slice(z),Z.parseArg)q=q.reduce((G,J)=>{return $(Z,J,G)},Z.defaultValue)}else if(q===void 0)q=[]}else if(z<this.args.length){if(q=this.args[z],Z.parseArg)q=$(Z,q,Z.defaultValue)}X[z]=q}),this.processedArgs=X}_chainOrCall($,X){if($?.then&&typeof $.then==="function")return $.then(()=>X());return X()}_chainOrCallHooks($,X){let Z=$,z=[];if(this._getCommandAndAncestors().reverse().filter((q)=>q._lifeCycleHooks[X]!==void 0).forEach((q)=>{q._lifeCycleHooks[X].forEach((G)=>{z.push({hookedCommand:q,callback:G})})}),X==="postAction")z.reverse();return z.forEach((q)=>{Z=this._chainOrCall(Z,()=>{return q.callback(q.hookedCommand,this)})}),Z}_chainOrCallSubCommandHook($,X,Z){let z=$;if(this._lifeCycleHooks[Z]!==void 0)this._lifeCycleHooks[Z].forEach((q)=>{z=this._chainOrCall(z,()=>{return q(this,X)})});return z}_parseCommand($,X){let Z=this.parseOptions(X);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(Z.operands),X=Z.unknown,this.args=$.concat(X),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),X);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(X),this._dispatchSubcommand(this._defaultCommandName,$,X);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(Z.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=()=>{if(Z.unknown.length>0)this.unknownOption(Z.unknown[0])},q=`command:${this.name()}`;if(this._actionHandler){z(),this._processArguments();let G;if(G=this._chainOrCallHooks(G,"preAction"),G=this._chainOrCall(G,()=>this._actionHandler(this.processedArgs)),this.parent)G=this._chainOrCall(G,()=>{this.parent.emit(q,$,X)});return G=this._chainOrCallHooks(G,"postAction"),G}if(this.parent?.listenerCount(q))z(),this._processArguments(),this.parent.emit(q,$,X);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,X);if(this.listenerCount("command:*"))this.emit("command:*",$,X);else if(this.commands.length)this.unknownCommand();else z(),this._processArguments()}else if(this.commands.length)z(),this.help({error:!0});else z(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((X)=>X._name===$||X._aliases.includes($))}_findOption($){return this.options.find((X)=>X.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((X)=>{if(X.mandatory&&$.getOptionValue(X.attributeName())===void 0)$.missingMandatoryOptionValue(X)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((Z)=>{let z=Z.attributeName();if(this.getOptionValue(z)===void 0)return!1;return this.getOptionValueSource(z)!=="default"});$.filter((Z)=>Z.conflictsWith.length>0).forEach((Z)=>{let z=$.find((q)=>Z.conflictsWith.includes(q.attributeName()));if(z)this._conflictingOption(Z,z)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let X=[],Z=[],z=X;function q(U){return U.length>1&&U[0]==="-"}let G=(U)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(U))return!1;return!this._getCommandAndAncestors().some((W)=>W.options.map((H)=>H.short).some((H)=>/^-\d$/.test(H)))},J=null,Q=null,Y=0;while(Y<$.length||Q){let U=Q??$[Y++];if(Q=null,U==="--"){if(z===Z)z.push(U);z.push(...$.slice(Y));break}if(J&&(!q(U)||G(U))){this.emit(`option:${J.name()}`,U);continue}if(J=null,q(U)){let W=this._findOption(U);if(W){if(W.required){let H=$[Y++];if(H===void 0)this.optionMissingArgument(W);this.emit(`option:${W.name()}`,H)}else if(W.optional){let H=null;if(Y<$.length&&(!q($[Y])||G($[Y])))H=$[Y++];this.emit(`option:${W.name()}`,H)}else this.emit(`option:${W.name()}`);J=W.variadic?W:null;continue}}if(U.length>2&&U[0]==="-"&&U[1]!=="-"){let W=this._findOption(`-${U[1]}`);if(W){if(W.required||W.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${W.name()}`,U.slice(2));else this.emit(`option:${W.name()}`),Q=`-${U.slice(2)}`;continue}}if(/^--[^=]+=/.test(U)){let W=U.indexOf("="),H=this._findOption(U.slice(0,W));if(H&&(H.required||H.optional)){this.emit(`option:${H.name()}`,U.slice(W+1));continue}}if(z===X&&q(U)&&!(this.commands.length===0&&G(U)))z=Z;if((this._enablePositionalOptions||this._passThroughOptions)&&X.length===0&&Z.length===0){if(this._findCommand(U)){X.push(U),Z.push(...$.slice(Y));break}else if(this._getHelpCommand()&&U===this._getHelpCommand().name()){X.push(U,...$.slice(Y));break}else if(this._defaultCommandName){Z.push(U,...$.slice(Y));break}}if(this._passThroughOptions){z.push(U,...$.slice(Y));break}z.push(U)}return{operands:X,unknown:Z}}opts(){if(this._storeOptionsAsProperties){let $={},X=this.options.length;for(let Z=0;Z<X;Z++){let z=this.options[Z].attributeName();$[z]=z===this._versionOptionName?this._version:this[z]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,X)=>Object.assign($,X.opts()),{})}error($,X){if(this._outputConfiguration.outputError(`${$}
23
23
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
24
24
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
25
- `),this.outputHelp({error:!0});let Z=X||{},q=Z.exitCode||1,z=Z.code||"commander.error";this._exit(q,z,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in E.env){let X=$.attributeName();if(this.getOptionValue(X)===void 0||["default","config","env"].includes(this.getOptionValueSource(X)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,E.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new V6(this.options),X=(Z)=>{return this.getOptionValue(Z)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(Z))};this.options.filter((Z)=>Z.implied!==void 0&&X(Z.attributeName())&&$.valueFromOption(this.getOptionValue(Z.attributeName()),Z)).forEach((Z)=>{Object.keys(Z.implied).filter((q)=>!X(q)).forEach((q)=>{this.setOptionValueWithSource(q,Z.implied[q],"implied")})})}missingArgument($){let X=`error: missing required argument '${$}'`;this.error(X,{code:"commander.missingArgument"})}optionMissingArgument($){let X=`error: option '${$.flags}' argument missing`;this.error(X,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let X=`error: required option '${$.flags}' not specified`;this.error(X,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,X){let Z=(G)=>{let J=G.attributeName(),Q=this.getOptionValue(J),Y=this.options.find((W)=>W.negate&&J===W.attributeName()),U=this.options.find((W)=>!W.negate&&J===W.attributeName());if(Y&&(Y.presetArg===void 0&&Q===!1||Y.presetArg!==void 0&&Q===Y.presetArg))return Y;return U||G},q=(G)=>{let J=Z(G),Q=J.attributeName();if(this.getOptionValueSource(Q)==="env")return`environment variable '${J.envVar}'`;return`option '${J.flags}'`},z=`error: ${q($)} cannot be used with ${q(X)}`;this.error(z,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let X="";if($.startsWith("--")&&this._showSuggestionAfterError){let q=[],z=this;do{let G=z.createHelp().visibleOptions(z).filter((J)=>J.long).map((J)=>J.long);q=q.concat(G),z=z.parent}while(z&&!z._enablePositionalOptions);X=JX($,q)}let Z=`error: unknown option '${$}'${X}`;this.error(Z,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let X=this.registeredArguments.length,Z=X===1?"":"s",z=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${X} argument${Z} but got ${$.length}.`;this.error(z,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],X="";if(this._showSuggestionAfterError){let q=[];this.createHelp().visibleCommands(this).forEach((z)=>{if(q.push(z.name()),z.alias())q.push(z.alias())}),X=JX($,q)}let Z=`error: unknown command '${$}'${X}`;this.error(Z,{code:"commander.unknownCommand"})}version($,X,Z){if($===void 0)return this._version;this._version=$,X=X||"-V, --version",Z=Z||"output the version number";let q=this.createOption(X,Z);return this._versionOptionName=q.attributeName(),this._registerOption(q),this.on("option:"+q.name(),()=>{this._outputConfiguration.writeOut(`${$}
26
- `),this._exit(0,"commander.version",$)}),this}description($,X){if($===void 0&&X===void 0)return this._description;if(this._description=$,X)this._argsDescription=X;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let X=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)X=this.commands[this.commands.length-1];if($===X._name)throw Error("Command alias can't be the same as its name");let Z=this.parent?._findCommand($);if(Z){let q=[Z.name()].concat(Z.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${q}'`)}return X._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((X)=>this.alias(X)),this}usage($){if($===void 0){if(this._usage)return this._usage;let X=this.registeredArguments.map((Z)=>{return U6(Z)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?X:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=Y0.basename($,Y0.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let X=this.createHelp(),Z=this._getOutputContext($);X.prepareContext({error:Z.error,helpWidth:Z.helpWidth,outputHasColors:Z.hasColors});let q=X.formatHelp(this,X);if(Z.hasColors)return q;return this._outputConfiguration.stripColor(q)}_getOutputContext($){$=$||{};let X=!!$.error,Z,q,z;if(X)Z=(J)=>this._outputConfiguration.writeErr(J),q=this._outputConfiguration.getErrHasColors(),z=this._outputConfiguration.getErrHelpWidth();else Z=(J)=>this._outputConfiguration.writeOut(J),q=this._outputConfiguration.getOutHasColors(),z=this._outputConfiguration.getOutHelpWidth();return{error:X,write:(J)=>{if(!q)J=this._outputConfiguration.stripColor(J);return Z(J)},hasColors:q,helpWidth:z}}outputHelp($){let X;if(typeof $==="function")X=$,$=void 0;let Z=this._getOutputContext($),q={error:Z.error,write:Z.write,command:this};this._getCommandAndAncestors().reverse().forEach((G)=>G.emit("beforeAllHelp",q)),this.emit("beforeHelp",q);let z=this.helpInformation({error:Z.error});if(X){if(z=X(z),typeof z!=="string"&&!Buffer.isBuffer(z))throw Error("outputHelp callback must return a string or a Buffer")}if(Z.write(z),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",q),this._getCommandAndAncestors().forEach((G)=>G.emit("afterAllHelp",q))}helpOption($,X){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",X??"display help for command"),$||X)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let X=Number(E.exitCode??0);if(X===0&&$&&typeof $!=="function"&&$.error)X=1;this._exit(X,"commander.help","(outputHelp)")}addHelpText($,X){let Z=["beforeAll","before","after","afterAll"];if(!Z.includes($))throw Error(`Unexpected value for position to addHelpText.
27
- Expecting one of '${Z.join("', '")}'`);let q=`${$}Help`;return this.on(q,(z)=>{let G;if(typeof X==="function")G=X({error:z.error,command:z.command});else G=X;if(G)z.write(`${G}
28
- `)}),this}_outputHelpIfRequested($){let X=this._getHelpOption();if(X&&$.find((q)=>X.is(q)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function QX($){return $.map((X)=>{if(!X.startsWith("--inspect"))return X;let Z,q="127.0.0.1",z="9229",G;if((G=X.match(/^(--inspect(-brk)?)$/))!==null)Z=G[1];else if((G=X.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(Z=G[1],/^\d+$/.test(G[3]))z=G[3];else q=G[3];else if((G=X.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)Z=G[1],q=G[3],z=G[4];if(Z&&z!=="0")return`${Z}=${q}:${parseInt(z)+1}`;return X})}function s2(){if(E.env.NO_COLOR||E.env.FORCE_COLOR==="0"||E.env.FORCE_COLOR==="false")return!1;if(E.env.FORCE_COLOR||E.env.CLICOLOR_FORCE!==void 0)return!0;return}T6.Command=n2;T6.useColor=s2});var VX=K((D6)=>{var{Argument:UX}=T1(),{Command:r2}=YX(),{CommanderError:B6,InvalidArgumentError:HX}=_$(),{Help:K6}=c2(),{Option:WX}=l2();D6.program=new r2;D6.createCommand=($)=>new r2($);D6.createOption=($,X)=>new WX($,X);D6.createArgument=($,X)=>new UX($,X);D6.Command=r2;D6.Option=WX;D6.Argument=UX;D6.Help=K6;D6.CommanderError=B6;D6.InvalidArgumentError=HX;D6.InvalidOptionArgumentError=HX});var j=K((h6)=>{var $9=Symbol.for("yaml.alias"),LX=Symbol.for("yaml.document"),L1=Symbol.for("yaml.map"),BX=Symbol.for("yaml.pair"),X9=Symbol.for("yaml.scalar"),B1=Symbol.for("yaml.seq"),U0=Symbol.for("yaml.node.type"),C6=($)=>!!$&&typeof $==="object"&&$[U0]===$9,b6=($)=>!!$&&typeof $==="object"&&$[U0]===LX,y6=($)=>!!$&&typeof $==="object"&&$[U0]===L1,x6=($)=>!!$&&typeof $==="object"&&$[U0]===BX,KX=($)=>!!$&&typeof $==="object"&&$[U0]===X9,f6=($)=>!!$&&typeof $==="object"&&$[U0]===B1;function DX($){if($&&typeof $==="object")switch($[U0]){case L1:case B1:return!0}return!1}function k6($){if($&&typeof $==="object")switch($[U0]){case $9:case L1:case X9:case B1:return!0}return!1}var g6=($)=>(KX($)||DX($))&&!!$.anchor;h6.ALIAS=$9;h6.DOC=LX;h6.MAP=L1;h6.NODE_TYPE=U0;h6.PAIR=BX;h6.SCALAR=X9;h6.SEQ=B1;h6.hasAnchor=g6;h6.isAlias=C6;h6.isCollection=DX;h6.isDocument=b6;h6.isMap=y6;h6.isNode=k6;h6.isPair=x6;h6.isScalar=KX;h6.isSeq=f6});var F$=K((Xq)=>{var h=j(),c=Symbol("break visit"),_X=Symbol("skip children"),G0=Symbol("remove node");function K1($,X){let Z=FX(X);if(h.isDocument($)){if(l0(null,$.contents,Z,Object.freeze([$]))===G0)$.contents=null}else l0(null,$,Z,Object.freeze([]))}K1.BREAK=c;K1.SKIP=_X;K1.REMOVE=G0;function l0($,X,Z,q){let z=OX($,X,Z,q);if(h.isNode(z)||h.isPair(z))return MX($,q,z),l0($,z,Z,q);if(typeof z!=="symbol"){if(h.isCollection(X)){q=Object.freeze(q.concat(X));for(let G=0;G<X.items.length;++G){let J=l0(G,X.items[G],Z,q);if(typeof J==="number")G=J-1;else if(J===c)return c;else if(J===G0)X.items.splice(G,1),G-=1}}else if(h.isPair(X)){q=Object.freeze(q.concat(X));let G=l0("key",X.key,Z,q);if(G===c)return c;else if(G===G0)X.key=null;let J=l0("value",X.value,Z,q);if(J===c)return c;else if(J===G0)X.value=null}}return z}async function D1($,X){let Z=FX(X);if(h.isDocument($)){if(await i0(null,$.contents,Z,Object.freeze([$]))===G0)$.contents=null}else await i0(null,$,Z,Object.freeze([]))}D1.BREAK=c;D1.SKIP=_X;D1.REMOVE=G0;async function i0($,X,Z,q){let z=await OX($,X,Z,q);if(h.isNode(z)||h.isPair(z))return MX($,q,z),i0($,z,Z,q);if(typeof z!=="symbol"){if(h.isCollection(X)){q=Object.freeze(q.concat(X));for(let G=0;G<X.items.length;++G){let J=await i0(G,X.items[G],Z,q);if(typeof J==="number")G=J-1;else if(J===c)return c;else if(J===G0)X.items.splice(G,1),G-=1}}else if(h.isPair(X)){q=Object.freeze(q.concat(X));let G=await i0("key",X.key,Z,q);if(G===c)return c;else if(G===G0)X.key=null;let J=await i0("value",X.value,Z,q);if(J===c)return c;else if(J===G0)X.value=null}}return z}function FX($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function OX($,X,Z,q){if(typeof Z==="function")return Z($,X,q);if(h.isMap(X))return Z.Map?.($,X,q);if(h.isSeq(X))return Z.Seq?.($,X,q);if(h.isPair(X))return Z.Pair?.($,X,q);if(h.isScalar(X))return Z.Scalar?.($,X,q);if(h.isAlias(X))return Z.Alias?.($,X,q);return}function MX($,X,Z){let q=X[X.length-1];if(h.isCollection(q))q.items[$]=Z;else if(h.isPair(q))if($==="key")q.key=Z;else q.value=Z;else if(h.isDocument(q))q.contents=Z;else{let z=h.isAlias(q)?"alias":"scalar";throw Error(`Cannot replace node with ${z} parent`)}}Xq.visit=K1;Xq.visitAsync=D1});var Z9=K((Qq)=>{var IX=j(),zq=F$(),Gq={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Jq=($)=>$.replace(/[!,[\]{}]/g,(X)=>Gq[X]);class s{constructor($,X){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,$),this.tags=Object.assign({},s.defaultTags,X)}clone(){let $=new s(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return $}add($,X){if(this.atNextDocument)this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1;let Z=$.trim().split(/[ \t]+/),q=Z.shift();switch(q){case"%TAG":{if(Z.length!==2){if(X(0,"%TAG directive should contain exactly two parts"),Z.length<2)return!1}let[z,G]=Z;return this.tags[z]=G,!0}case"%YAML":{if(this.yaml.explicit=!0,Z.length!==1)return X(0,"%YAML directive should contain exactly one part"),!1;let[z]=Z;if(z==="1.1"||z==="1.2")return this.yaml.version=z,!0;else{let G=/^\d+\.\d+$/.test(z);return X(6,`Unsupported YAML version ${z}`,G),!1}}default:return X(0,`Unknown directive ${q}`,!0),!1}}tagName($,X){if($==="!")return"!";if($[0]!=="!")return X(`Not a valid tag: ${$}`),null;if($[1]==="<"){let G=$.slice(2,-1);if(G==="!"||G==="!!")return X(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")X("Verbatim tags must end with a >");return G}let[,Z,q]=$.match(/^(.*!)([^!]*)$/s);if(!q)X(`The ${$} tag has no suffix`);let z=this.tags[Z];if(z)try{return z+decodeURIComponent(q)}catch(G){return X(String(G)),null}if(Z==="!")return $;return X(`Could not resolve tag: ${$}`),null}tagString($){for(let[X,Z]of Object.entries(this.tags))if($.startsWith(Z))return X+Jq($.substring(Z.length));return $[0]==="!"?$:`!<${$}>`}toString($){let X=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],Z=Object.entries(this.tags),q;if($&&Z.length>0&&IX.isNode($.contents)){let z={};zq.visit($.contents,(G,J)=>{if(IX.isNode(J)&&J.tag)z[J.tag]=!0}),q=Object.keys(z)}else q=[];for(let[z,G]of Z){if(z==="!!"&&G==="tag:yaml.org,2002:")continue;if(!$||q.some((J)=>J.startsWith(G)))X.push(`%TAG ${z} ${G}`)}return X.join(`
29
- `)}}s.defaultYaml={explicit:!1,version:"1.2"};s.defaultTags={"!!":"tag:yaml.org,2002:"};Qq.Directives=s});var _1=K((Vq)=>{var RX=j(),Uq=F$();function Hq($){if(/[\x00-\x19\s,[\]{}]/.test($)){let Z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(Z)}return!0}function PX($){let X=new Set;return Uq.visit($,{Value(Z,q){if(q.anchor)X.add(q.anchor)}}),X}function NX($,X){for(let Z=1;;++Z){let q=`${$}${Z}`;if(!X.has(q))return q}}function Wq($,X){let Z=[],q=new Map,z=null;return{onAnchor:(G)=>{Z.push(G),z??(z=PX($));let J=NX(X,z);return z.add(J),J},setAnchors:()=>{for(let G of Z){let J=q.get(G);if(typeof J==="object"&&J.anchor&&(RX.isScalar(J.node)||RX.isCollection(J.node)))J.node.anchor=J.anchor;else{let Q=Error("Failed to resolve repeated object (this should not happen)");throw Q.source=G,Q}}},sourceObjects:q}}Vq.anchorIsValid=Hq;Vq.anchorNames=PX;Vq.createNodeAnchors=Wq;Vq.findNewAnchor=NX});var q9=K((Kq)=>{function O$($,X,Z,q){if(q&&typeof q==="object")if(Array.isArray(q))for(let z=0,G=q.length;z<G;++z){let J=q[z],Q=O$($,q,String(z),J);if(Q===void 0)delete q[z];else if(Q!==J)q[z]=Q}else if(q instanceof Map)for(let z of Array.from(q.keys())){let G=q.get(z),J=O$($,q,z,G);if(J===void 0)q.delete(z);else if(J!==G)q.set(z,J)}else if(q instanceof Set)for(let z of Array.from(q)){let G=O$($,q,z,z);if(G===void 0)q.delete(z);else if(G!==z)q.delete(z),q.add(G)}else for(let[z,G]of Object.entries(q)){let J=O$($,q,z,G);if(J===void 0)delete q[z];else if(J!==G)q[z]=J}return $.call(X,Z,q)}Kq.applyReviver=O$});var L0=K((Fq)=>{var _q=j();function AX($,X,Z){if(Array.isArray($))return $.map((q,z)=>AX(q,String(z),Z));if($&&typeof $.toJSON==="function"){if(!Z||!_q.hasAnchor($))return $.toJSON(X,Z);let q={aliasCount:0,count:1,res:void 0};Z.anchors.set($,q),Z.onCreate=(G)=>{q.res=G,delete Z.onCreate};let z=$.toJSON(X,Z);if(Z.onCreate)Z.onCreate(z);return z}if(typeof $==="bigint"&&!Z?.keep)return Number($);return $}Fq.toJS=AX});var F1=K((Rq)=>{var Mq=q9(),SX=j(),Iq=L0();class jX{constructor($){Object.defineProperty(this,SX.NODE_TYPE,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:X,maxAliasCount:Z,onAnchor:q,reviver:z}={}){if(!SX.isDocument($))throw TypeError("A document argument is required");let G={anchors:new Map,doc:$,keep:!0,mapAsMap:X===!0,mapKeyWarned:!1,maxAliasCount:typeof Z==="number"?Z:100},J=Iq.toJS(this,"",G);if(typeof q==="function")for(let{count:Q,res:Y}of G.anchors.values())q(Y,Q);return typeof z==="function"?Mq.applyReviver(z,{"":J},"",J):J}}Rq.NodeBase=jX});var M$=K((Eq)=>{var Nq=_1(),Aq=F$(),a0=j(),Sq=F1(),jq=L0();class EX extends Sq.NodeBase{constructor($){super(a0.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,X){let Z;if(X?.aliasResolveCache)Z=X.aliasResolveCache;else if(Z=[],Aq.visit($,{Node:(z,G)=>{if(a0.isAlias(G)||a0.hasAnchor(G))Z.push(G)}}),X)X.aliasResolveCache=Z;let q=void 0;for(let z of Z){if(z===this)break;if(z.anchor===this.source)q=z}return q}toJSON($,X){if(!X)return{source:this.source};let{anchors:Z,doc:q,maxAliasCount:z}=X,G=this.resolve(q,X);if(!G){let Q=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(Q)}let J=Z.get(G);if(!J)jq.toJS(G,null,X),J=Z.get(G);if(J?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(z>=0){if(J.count+=1,J.aliasCount===0)J.aliasCount=O1(q,G,Z);if(J.count*J.aliasCount>z)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return J.res}toString($,X,Z){let q=`*${this.source}`;if($){if(Nq.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let z=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(z)}if($.implicitKey)return`${q} `}return q}}function O1($,X,Z){if(a0.isAlias(X)){let q=X.resolve($),z=Z&&q&&Z.get(q);return z?z.count*z.aliasCount:0}else if(a0.isCollection(X)){let q=0;for(let z of X.items){let G=O1($,z,Z);if(G>q)q=G}return q}else if(a0.isPair(X)){let q=O1($,X.key,Z),z=O1($,X.value,Z);return Math.max(q,z)}return 1}Eq.Alias=EX});var g=K((kq)=>{var bq=j(),yq=F1(),xq=L0(),fq=($)=>!$||typeof $!=="function"&&typeof $!=="object";class S0 extends yq.NodeBase{constructor($){super(bq.SCALAR);this.value=$}toJSON($,X){return X?.keep?this.value:xq.toJS(this.value,$,X)}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";kq.Scalar=S0;kq.isScalarValue=fq});var I$=K((pq)=>{var vq=M$(),j0=j(),CX=g(),uq="tag:yaml.org,2002:";function mq($,X,Z){if(X){let q=Z.filter((G)=>G.tag===X),z=q.find((G)=>!G.format)??q[0];if(!z)throw Error(`Tag ${X} not found`);return z}return Z.find((q)=>q.identify?.($)&&!q.format)}function dq($,X,Z){if(j0.isDocument($))$=$.contents;if(j0.isNode($))return $;if(j0.isPair($)){let H=Z.schema[j0.MAP].createNode?.(Z.schema,null,Z);return H.items.push($),H}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:q,onAnchor:z,onTagObj:G,schema:J,sourceObjects:Q}=Z,Y=void 0;if(q&&$&&typeof $==="object")if(Y=Q.get($),Y)return Y.anchor??(Y.anchor=z($)),new vq.Alias(Y.anchor);else Y={anchor:null,node:null},Q.set($,Y);if(X?.startsWith("!!"))X=uq+X.slice(2);let U=mq($,X,J.tags);if(!U){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let H=new CX.Scalar($);if(Y)Y.node=H;return H}U=$ instanceof Map?J[j0.MAP]:(Symbol.iterator in Object($))?J[j0.SEQ]:J[j0.MAP]}if(G)G(U),delete Z.onTagObj;let W=U?.createNode?U.createNode(Z.schema,$,Z):typeof U?.nodeClass?.from==="function"?U.nodeClass.from(Z.schema,$,Z):new CX.Scalar($);if(X)W.tag=X;else if(!U.default)W.tag=U.tag;if(Y)Y.node=W;return W}pq.createNode=dq});var M1=K((aq)=>{var lq=I$(),J0=j(),iq=F1();function z9($,X,Z){let q=Z;for(let z=X.length-1;z>=0;--z){let G=X[z];if(typeof G==="number"&&Number.isInteger(G)&&G>=0){let J=[];J[G]=q,q=J}else q=new Map([[G,q]])}return lq.createNode(q,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var bX=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class yX extends iq.NodeBase{constructor($,X){super($);Object.defineProperty(this,"schema",{value:X,configurable:!0,enumerable:!1,writable:!0})}clone($){let X=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)X.schema=$;if(X.items=X.items.map((Z)=>J0.isNode(Z)||J0.isPair(Z)?Z.clone($):Z),this.range)X.range=this.range.slice();return X}addIn($,X){if(bX($))this.add(X);else{let[Z,...q]=$,z=this.get(Z,!0);if(J0.isCollection(z))z.addIn(q,X);else if(z===void 0&&this.schema)this.set(Z,z9(this.schema,q,X));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${q}`)}}deleteIn($){let[X,...Z]=$;if(Z.length===0)return this.delete(X);let q=this.get(X,!0);if(J0.isCollection(q))return q.deleteIn(Z);else throw Error(`Expected YAML collection at ${X}. Remaining path: ${Z}`)}getIn($,X){let[Z,...q]=$,z=this.get(Z,!0);if(q.length===0)return!X&&J0.isScalar(z)?z.value:z;else return J0.isCollection(z)?z.getIn(q,X):void 0}hasAllNullValues($){return this.items.every((X)=>{if(!J0.isPair(X))return!1;let Z=X.value;return Z==null||$&&J0.isScalar(Z)&&Z.value==null&&!Z.commentBefore&&!Z.comment&&!Z.tag})}hasIn($){let[X,...Z]=$;if(Z.length===0)return this.has(X);let q=this.get(X,!0);return J0.isCollection(q)?q.hasIn(Z):!1}setIn($,X){let[Z,...q]=$;if(q.length===0)this.set(Z,X);else{let z=this.get(Z,!0);if(J0.isCollection(z))z.setIn(q,X);else if(z===void 0&&this.schema)this.set(Z,z9(this.schema,q,X));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${q}`)}}}aq.Collection=yX;aq.collectionFromPath=z9;aq.isEmptyPath=bX});var R$=K((eq)=>{var oq=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function G9($,X){if(/^\n+$/.test($))return $.substring(1);return X?$.replace(/^(?! *$)/gm,X):$}var tq=($,X,Z)=>$.endsWith(`
30
- `)?G9(Z,X):Z.includes(`
25
+ `),this.outputHelp({error:!0});let Z=X||{},z=Z.exitCode||1,q=Z.code||"commander.error";this._exit(z,q,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in C.env){let X=$.attributeName();if(this.getOptionValue(X)===void 0||["default","config","env"].includes(this.getOptionValueSource(X)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,C.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new TZ(this.options),X=(Z)=>{return this.getOptionValue(Z)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(Z))};this.options.filter((Z)=>Z.implied!==void 0&&X(Z.attributeName())&&$.valueFromOption(this.getOptionValue(Z.attributeName()),Z)).forEach((Z)=>{Object.keys(Z.implied).filter((z)=>!X(z)).forEach((z)=>{this.setOptionValueWithSource(z,Z.implied[z],"implied")})})}missingArgument($){let X=`error: missing required argument '${$}'`;this.error(X,{code:"commander.missingArgument"})}optionMissingArgument($){let X=`error: option '${$.flags}' argument missing`;this.error(X,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let X=`error: required option '${$.flags}' not specified`;this.error(X,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,X){let Z=(G)=>{let J=G.attributeName(),Q=this.getOptionValue(J),Y=this.options.find((W)=>W.negate&&J===W.attributeName()),U=this.options.find((W)=>!W.negate&&J===W.attributeName());if(Y&&(Y.presetArg===void 0&&Q===!1||Y.presetArg!==void 0&&Q===Y.presetArg))return Y;return U||G},z=(G)=>{let J=Z(G),Q=J.attributeName();if(this.getOptionValueSource(Q)==="env")return`environment variable '${J.envVar}'`;return`option '${J.flags}'`},q=`error: ${z($)} cannot be used with ${z(X)}`;this.error(q,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let X="";if($.startsWith("--")&&this._showSuggestionAfterError){let z=[],q=this;do{let G=q.createHelp().visibleOptions(q).filter((J)=>J.long).map((J)=>J.long);z=z.concat(G),q=q.parent}while(q&&!q._enablePositionalOptions);X=J5($,z)}let Z=`error: unknown option '${$}'${X}`;this.error(Z,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let X=this.registeredArguments.length,Z=X===1?"":"s",q=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${X} argument${Z} but got ${$.length}.`;this.error(q,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],X="";if(this._showSuggestionAfterError){let z=[];this.createHelp().visibleCommands(this).forEach((q)=>{if(z.push(q.name()),q.alias())z.push(q.alias())}),X=J5($,z)}let Z=`error: unknown command '${$}'${X}`;this.error(Z,{code:"commander.unknownCommand"})}version($,X,Z){if($===void 0)return this._version;this._version=$,X=X||"-V, --version",Z=Z||"output the version number";let z=this.createOption(X,Z);return this._versionOptionName=z.attributeName(),this._registerOption(z),this.on("option:"+z.name(),()=>{this._outputConfiguration.writeOut(`${$}
26
+ `),this._exit(0,"commander.version",$)}),this}description($,X){if($===void 0&&X===void 0)return this._description;if(this._description=$,X)this._argsDescription=X;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let X=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)X=this.commands[this.commands.length-1];if($===X._name)throw Error("Command alias can't be the same as its name");let Z=this.parent?._findCommand($);if(Z){let z=[Z.name()].concat(Z.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${z}'`)}return X._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((X)=>this.alias(X)),this}usage($){if($===void 0){if(this._usage)return this._usage;let X=this.registeredArguments.map((Z)=>{return HZ(Z)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?X:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=Y0.basename($,Y0.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let X=this.createHelp(),Z=this._getOutputContext($);X.prepareContext({error:Z.error,helpWidth:Z.helpWidth,outputHasColors:Z.hasColors});let z=X.formatHelp(this,X);if(Z.hasColors)return z;return this._outputConfiguration.stripColor(z)}_getOutputContext($){$=$||{};let X=!!$.error,Z,z,q;if(X)Z=(J)=>this._outputConfiguration.writeErr(J),z=this._outputConfiguration.getErrHasColors(),q=this._outputConfiguration.getErrHelpWidth();else Z=(J)=>this._outputConfiguration.writeOut(J),z=this._outputConfiguration.getOutHasColors(),q=this._outputConfiguration.getOutHelpWidth();return{error:X,write:(J)=>{if(!z)J=this._outputConfiguration.stripColor(J);return Z(J)},hasColors:z,helpWidth:q}}outputHelp($){let X;if(typeof $==="function")X=$,$=void 0;let Z=this._getOutputContext($),z={error:Z.error,write:Z.write,command:this};this._getCommandAndAncestors().reverse().forEach((G)=>G.emit("beforeAllHelp",z)),this.emit("beforeHelp",z);let q=this.helpInformation({error:Z.error});if(X){if(q=X(q),typeof q!=="string"&&!Buffer.isBuffer(q))throw Error("outputHelp callback must return a string or a Buffer")}if(Z.write(q),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",z),this._getCommandAndAncestors().forEach((G)=>G.emit("afterAllHelp",z))}helpOption($,X){if(typeof $==="boolean"){if($){if(this._helpOption===null)this._helpOption=void 0;if(this._defaultOptionGroup)this._initOptionGroup(this._getHelpOption())}else this._helpOption=null;return this}if(this._helpOption=this.createOption($??"-h, --help",X??"display help for command"),$||X)this._initOptionGroup(this._helpOption);return this}_getHelpOption(){if(this._helpOption===void 0)this.helpOption(void 0,void 0);return this._helpOption}addHelpOption($){return this._helpOption=$,this._initOptionGroup($),this}help($){this.outputHelp($);let X=Number(C.exitCode??0);if(X===0&&$&&typeof $!=="function"&&$.error)X=1;this._exit(X,"commander.help","(outputHelp)")}addHelpText($,X){let Z=["beforeAll","before","after","afterAll"];if(!Z.includes($))throw Error(`Unexpected value for position to addHelpText.
27
+ Expecting one of '${Z.join("', '")}'`);let z=`${$}Help`;return this.on(z,(q)=>{let G;if(typeof X==="function")G=X({error:q.error,command:q.command});else G=X;if(G)q.write(`${G}
28
+ `)}),this}_outputHelpIfRequested($){let X=this._getHelpOption();if(X&&$.find((z)=>X.is(z)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function Q5($){return $.map((X)=>{if(!X.startsWith("--inspect"))return X;let Z,z="127.0.0.1",q="9229",G;if((G=X.match(/^(--inspect(-brk)?)$/))!==null)Z=G[1];else if((G=X.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(Z=G[1],/^\d+$/.test(G[3]))q=G[3];else z=G[3];else if((G=X.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)Z=G[1],z=G[3],q=G[4];if(Z&&q!=="0")return`${Z}=${z}:${parseInt(q)+1}`;return X})}function n2(){if(C.env.NO_COLOR||C.env.FORCE_COLOR==="0"||C.env.FORCE_COLOR==="false")return!1;if(C.env.FORCE_COLOR||C.env.CLICOLOR_FORCE!==void 0)return!0;return}BZ.Command=r2;BZ.useColor=n2});var V5=D((FZ)=>{var{Argument:U5}=T1(),{Command:o2}=Y5(),{CommanderError:DZ,InvalidArgumentError:H5}=F$(),{Help:_Z}=c2(),{Option:W5}=i2();FZ.program=new o2;FZ.createCommand=($)=>new o2($);FZ.createOption=($,X)=>new W5($,X);FZ.createArgument=($,X)=>new U5($,X);FZ.Command=o2;FZ.Option=W5;FZ.Argument=U5;FZ.Help=_Z;FZ.CommanderError=DZ;FZ.InvalidArgumentError=H5;FZ.InvalidOptionArgumentError=H5});var S=D((vZ)=>{var X4=Symbol.for("yaml.alias"),K5=Symbol.for("yaml.document"),K1=Symbol.for("yaml.map"),L5=Symbol.for("yaml.pair"),Z4=Symbol.for("yaml.scalar"),L1=Symbol.for("yaml.seq"),U0=Symbol.for("yaml.node.type"),bZ=($)=>!!$&&typeof $==="object"&&$[U0]===X4,xZ=($)=>!!$&&typeof $==="object"&&$[U0]===K5,yZ=($)=>!!$&&typeof $==="object"&&$[U0]===K1,kZ=($)=>!!$&&typeof $==="object"&&$[U0]===L5,D5=($)=>!!$&&typeof $==="object"&&$[U0]===Z4,fZ=($)=>!!$&&typeof $==="object"&&$[U0]===L1;function _5($){if($&&typeof $==="object")switch($[U0]){case K1:case L1:return!0}return!1}function gZ($){if($&&typeof $==="object")switch($[U0]){case X4:case K1:case Z4:case L1:return!0}return!1}var hZ=($)=>(D5($)||_5($))&&!!$.anchor;vZ.ALIAS=X4;vZ.DOC=K5;vZ.MAP=K1;vZ.NODE_TYPE=U0;vZ.PAIR=L5;vZ.SCALAR=Z4;vZ.SEQ=L1;vZ.hasAnchor=hZ;vZ.isAlias=bZ;vZ.isCollection=_5;vZ.isDocument=xZ;vZ.isMap=yZ;vZ.isNode=gZ;vZ.isPair=kZ;vZ.isScalar=D5;vZ.isSeq=fZ});var M$=D((Zz)=>{var h=S(),l=Symbol("break visit"),F5=Symbol("skip children"),G0=Symbol("remove node");function D1($,X){let Z=M5(X);if(h.isDocument($)){if(c0(null,$.contents,Z,Object.freeze([$]))===G0)$.contents=null}else c0(null,$,Z,Object.freeze([]))}D1.BREAK=l;D1.SKIP=F5;D1.REMOVE=G0;function c0($,X,Z,z){let q=O5($,X,Z,z);if(h.isNode(q)||h.isPair(q))return w5($,z,q),c0($,q,Z,z);if(typeof q!=="symbol"){if(h.isCollection(X)){z=Object.freeze(z.concat(X));for(let G=0;G<X.items.length;++G){let J=c0(G,X.items[G],Z,z);if(typeof J==="number")G=J-1;else if(J===l)return l;else if(J===G0)X.items.splice(G,1),G-=1}}else if(h.isPair(X)){z=Object.freeze(z.concat(X));let G=c0("key",X.key,Z,z);if(G===l)return l;else if(G===G0)X.key=null;let J=c0("value",X.value,Z,z);if(J===l)return l;else if(J===G0)X.value=null}}return q}async function _1($,X){let Z=M5(X);if(h.isDocument($)){if(await i0(null,$.contents,Z,Object.freeze([$]))===G0)$.contents=null}else await i0(null,$,Z,Object.freeze([]))}_1.BREAK=l;_1.SKIP=F5;_1.REMOVE=G0;async function i0($,X,Z,z){let q=await O5($,X,Z,z);if(h.isNode(q)||h.isPair(q))return w5($,z,q),i0($,q,Z,z);if(typeof q!=="symbol"){if(h.isCollection(X)){z=Object.freeze(z.concat(X));for(let G=0;G<X.items.length;++G){let J=await i0(G,X.items[G],Z,z);if(typeof J==="number")G=J-1;else if(J===l)return l;else if(J===G0)X.items.splice(G,1),G-=1}}else if(h.isPair(X)){z=Object.freeze(z.concat(X));let G=await i0("key",X.key,Z,z);if(G===l)return l;else if(G===G0)X.key=null;let J=await i0("value",X.value,Z,z);if(J===l)return l;else if(J===G0)X.value=null}}return q}function M5($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function O5($,X,Z,z){if(typeof Z==="function")return Z($,X,z);if(h.isMap(X))return Z.Map?.($,X,z);if(h.isSeq(X))return Z.Seq?.($,X,z);if(h.isPair(X))return Z.Pair?.($,X,z);if(h.isScalar(X))return Z.Scalar?.($,X,z);if(h.isAlias(X))return Z.Alias?.($,X,z);return}function w5($,X,Z){let z=X[X.length-1];if(h.isCollection(z))z.items[$]=Z;else if(h.isPair(z))if($==="key")z.key=Z;else z.value=Z;else if(h.isDocument(z))z.contents=Z;else{let q=h.isAlias(z)?"alias":"scalar";throw Error(`Cannot replace node with ${q} parent`)}}Zz.visit=D1;Zz.visitAsync=_1});var z4=D((Yz)=>{var I5=S(),Gz=M$(),Jz={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Qz=($)=>$.replace(/[!,[\]{}]/g,(X)=>Jz[X]);class s{constructor($,X){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,$),this.tags=Object.assign({},s.defaultTags,X)}clone(){let $=new s(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return $}add($,X){if(this.atNextDocument)this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1;let Z=$.trim().split(/[ \t]+/),z=Z.shift();switch(z){case"%TAG":{if(Z.length!==2){if(X(0,"%TAG directive should contain exactly two parts"),Z.length<2)return!1}let[q,G]=Z;return this.tags[q]=G,!0}case"%YAML":{if(this.yaml.explicit=!0,Z.length!==1)return X(0,"%YAML directive should contain exactly one part"),!1;let[q]=Z;if(q==="1.1"||q==="1.2")return this.yaml.version=q,!0;else{let G=/^\d+\.\d+$/.test(q);return X(6,`Unsupported YAML version ${q}`,G),!1}}default:return X(0,`Unknown directive ${z}`,!0),!1}}tagName($,X){if($==="!")return"!";if($[0]!=="!")return X(`Not a valid tag: ${$}`),null;if($[1]==="<"){let G=$.slice(2,-1);if(G==="!"||G==="!!")return X(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")X("Verbatim tags must end with a >");return G}let[,Z,z]=$.match(/^(.*!)([^!]*)$/s);if(!z)X(`The ${$} tag has no suffix`);let q=this.tags[Z];if(q)try{return q+decodeURIComponent(z)}catch(G){return X(String(G)),null}if(Z==="!")return $;return X(`Could not resolve tag: ${$}`),null}tagString($){for(let[X,Z]of Object.entries(this.tags))if($.startsWith(Z))return X+Qz($.substring(Z.length));return $[0]==="!"?$:`!<${$}>`}toString($){let X=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],Z=Object.entries(this.tags),z;if($&&Z.length>0&&I5.isNode($.contents)){let q={};Gz.visit($.contents,(G,J)=>{if(I5.isNode(J)&&J.tag)q[J.tag]=!0}),z=Object.keys(q)}else z=[];for(let[q,G]of Z){if(q==="!!"&&G==="tag:yaml.org,2002:")continue;if(!$||z.some((J)=>J.startsWith(G)))X.push(`%TAG ${q} ${G}`)}return X.join(`
29
+ `)}}s.defaultYaml={explicit:!1,version:"1.2"};s.defaultTags={"!!":"tag:yaml.org,2002:"};Yz.Directives=s});var F1=D((Tz)=>{var R5=S(),Hz=M$();function Wz($){if(/[\x00-\x19\s,[\]{}]/.test($)){let Z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(Z)}return!0}function P5($){let X=new Set;return Hz.visit($,{Value(Z,z){if(z.anchor)X.add(z.anchor)}}),X}function N5($,X){for(let Z=1;;++Z){let z=`${$}${Z}`;if(!X.has(z))return z}}function Vz($,X){let Z=[],z=new Map,q=null;return{onAnchor:(G)=>{Z.push(G),q??(q=P5($));let J=N5(X,q);return q.add(J),J},setAnchors:()=>{for(let G of Z){let J=z.get(G);if(typeof J==="object"&&J.anchor&&(R5.isScalar(J.node)||R5.isCollection(J.node)))J.node.anchor=J.anchor;else{let Q=Error("Failed to resolve repeated object (this should not happen)");throw Q.source=G,Q}}},sourceObjects:z}}Tz.anchorIsValid=Wz;Tz.anchorNames=P5;Tz.createNodeAnchors=Vz;Tz.findNewAnchor=N5});var q4=D((_z)=>{function O$($,X,Z,z){if(z&&typeof z==="object")if(Array.isArray(z))for(let q=0,G=z.length;q<G;++q){let J=z[q],Q=O$($,z,String(q),J);if(Q===void 0)delete z[q];else if(Q!==J)z[q]=Q}else if(z instanceof Map)for(let q of Array.from(z.keys())){let G=z.get(q),J=O$($,z,q,G);if(J===void 0)z.delete(q);else if(J!==G)z.set(q,J)}else if(z instanceof Set)for(let q of Array.from(z)){let G=O$($,z,q,q);if(G===void 0)z.delete(q);else if(G!==q)z.delete(q),z.add(G)}else for(let[q,G]of Object.entries(z)){let J=O$($,z,q,G);if(J===void 0)delete z[q];else if(J!==G)z[q]=J}return $.call(X,Z,z)}_z.applyReviver=O$});var K0=D((Oz)=>{var Mz=S();function A5($,X,Z){if(Array.isArray($))return $.map((z,q)=>A5(z,String(q),Z));if($&&typeof $.toJSON==="function"){if(!Z||!Mz.hasAnchor($))return $.toJSON(X,Z);let z={aliasCount:0,count:1,res:void 0};Z.anchors.set($,z),Z.onCreate=(G)=>{z.res=G,delete Z.onCreate};let q=$.toJSON(X,Z);if(Z.onCreate)Z.onCreate(q);return q}if(typeof $==="bigint"&&!Z?.keep)return Number($);return $}Oz.toJS=A5});var M1=D((Pz)=>{var Iz=q4(),j5=S(),Rz=K0();class S5{constructor($){Object.defineProperty(this,j5.NODE_TYPE,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:X,maxAliasCount:Z,onAnchor:z,reviver:q}={}){if(!j5.isDocument($))throw TypeError("A document argument is required");let G={anchors:new Map,doc:$,keep:!0,mapAsMap:X===!0,mapKeyWarned:!1,maxAliasCount:typeof Z==="number"?Z:100},J=Rz.toJS(this,"",G);if(typeof z==="function")for(let{count:Q,res:Y}of G.anchors.values())z(Y,Q);return typeof q==="function"?Iz.applyReviver(q,{"":J},"",J):J}}Pz.NodeBase=S5});var w$=D((Ez)=>{var Az=F1(),jz=M$(),a0=S(),Sz=M1(),Cz=K0();class C5 extends Sz.NodeBase{constructor($){super(a0.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,X){let Z;if(X?.aliasResolveCache)Z=X.aliasResolveCache;else if(Z=[],jz.visit($,{Node:(q,G)=>{if(a0.isAlias(G)||a0.hasAnchor(G))Z.push(G)}}),X)X.aliasResolveCache=Z;let z=void 0;for(let q of Z){if(q===this)break;if(q.anchor===this.source)z=q}return z}toJSON($,X){if(!X)return{source:this.source};let{anchors:Z,doc:z,maxAliasCount:q}=X,G=this.resolve(z,X);if(!G){let Q=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(Q)}let J=Z.get(G);if(!J)Cz.toJS(G,null,X),J=Z.get(G);if(J?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(q>=0){if(J.count+=1,J.aliasCount===0)J.aliasCount=O1(z,G,Z);if(J.count*J.aliasCount>q)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return J.res}toString($,X,Z){let z=`*${this.source}`;if($){if(Az.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let q=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(q)}if($.implicitKey)return`${z} `}return z}}function O1($,X,Z){if(a0.isAlias(X)){let z=X.resolve($),q=Z&&z&&Z.get(z);return q?q.count*q.aliasCount:0}else if(a0.isCollection(X)){let z=0;for(let q of X.items){let G=O1($,q,Z);if(G>z)z=G}return z}else if(a0.isPair(X)){let z=O1($,X.key,Z),q=O1($,X.value,Z);return Math.max(z,q)}return 1}Ez.Alias=C5});var g=D((gz)=>{var xz=S(),yz=M1(),kz=K0(),fz=($)=>!$||typeof $!=="function"&&typeof $!=="object";class j0 extends yz.NodeBase{constructor($){super(xz.SCALAR);this.value=$}toJSON($,X){return X?.keep?this.value:kz.toJS(this.value,$,X)}toString(){return String(this.value)}}j0.BLOCK_FOLDED="BLOCK_FOLDED";j0.BLOCK_LITERAL="BLOCK_LITERAL";j0.PLAIN="PLAIN";j0.QUOTE_DOUBLE="QUOTE_DOUBLE";j0.QUOTE_SINGLE="QUOTE_SINGLE";gz.Scalar=j0;gz.isScalarValue=fz});var I$=D((lz)=>{var uz=w$(),S0=S(),E5=g(),mz="tag:yaml.org,2002:";function dz($,X,Z){if(X){let z=Z.filter((G)=>G.tag===X),q=z.find((G)=>!G.format)??z[0];if(!q)throw Error(`Tag ${X} not found`);return q}return Z.find((z)=>z.identify?.($)&&!z.format)}function pz($,X,Z){if(S0.isDocument($))$=$.contents;if(S0.isNode($))return $;if(S0.isPair($)){let H=Z.schema[S0.MAP].createNode?.(Z.schema,null,Z);return H.items.push($),H}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:z,onAnchor:q,onTagObj:G,schema:J,sourceObjects:Q}=Z,Y=void 0;if(z&&$&&typeof $==="object")if(Y=Q.get($),Y)return Y.anchor??(Y.anchor=q($)),new uz.Alias(Y.anchor);else Y={anchor:null,node:null},Q.set($,Y);if(X?.startsWith("!!"))X=mz+X.slice(2);let U=dz($,X,J.tags);if(!U){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let H=new E5.Scalar($);if(Y)Y.node=H;return H}U=$ instanceof Map?J[S0.MAP]:(Symbol.iterator in Object($))?J[S0.SEQ]:J[S0.MAP]}if(G)G(U),delete Z.onTagObj;let W=U?.createNode?U.createNode(Z.schema,$,Z):typeof U?.nodeClass?.from==="function"?U.nodeClass.from(Z.schema,$,Z):new E5.Scalar($);if(X)W.tag=X;else if(!U.default)W.tag=U.tag;if(Y)Y.node=W;return W}lz.createNode=pz});var w1=D((sz)=>{var iz=I$(),J0=S(),az=M1();function G4($,X,Z){let z=Z;for(let q=X.length-1;q>=0;--q){let G=X[q];if(typeof G==="number"&&Number.isInteger(G)&&G>=0){let J=[];J[G]=z,z=J}else z=new Map([[G,z]])}return iz.createNode(z,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var b5=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class x5 extends az.NodeBase{constructor($,X){super($);Object.defineProperty(this,"schema",{value:X,configurable:!0,enumerable:!1,writable:!0})}clone($){let X=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)X.schema=$;if(X.items=X.items.map((Z)=>J0.isNode(Z)||J0.isPair(Z)?Z.clone($):Z),this.range)X.range=this.range.slice();return X}addIn($,X){if(b5($))this.add(X);else{let[Z,...z]=$,q=this.get(Z,!0);if(J0.isCollection(q))q.addIn(z,X);else if(q===void 0&&this.schema)this.set(Z,G4(this.schema,z,X));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${z}`)}}deleteIn($){let[X,...Z]=$;if(Z.length===0)return this.delete(X);let z=this.get(X,!0);if(J0.isCollection(z))return z.deleteIn(Z);else throw Error(`Expected YAML collection at ${X}. Remaining path: ${Z}`)}getIn($,X){let[Z,...z]=$,q=this.get(Z,!0);if(z.length===0)return!X&&J0.isScalar(q)?q.value:q;else return J0.isCollection(q)?q.getIn(z,X):void 0}hasAllNullValues($){return this.items.every((X)=>{if(!J0.isPair(X))return!1;let Z=X.value;return Z==null||$&&J0.isScalar(Z)&&Z.value==null&&!Z.commentBefore&&!Z.comment&&!Z.tag})}hasIn($){let[X,...Z]=$;if(Z.length===0)return this.has(X);let z=this.get(X,!0);return J0.isCollection(z)?z.hasIn(Z):!1}setIn($,X){let[Z,...z]=$;if(z.length===0)this.set(Z,X);else{let q=this.get(Z,!0);if(J0.isCollection(q))q.setIn(z,X);else if(q===void 0&&this.schema)this.set(Z,G4(this.schema,z,X));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${z}`)}}}sz.Collection=x5;sz.collectionFromPath=G4;sz.isEmptyPath=b5});var R$=D(($q)=>{var tz=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function J4($,X){if(/^\n+$/.test($))return $.substring(1);return X?$.replace(/^(?! *$)/gm,X):$}var ez=($,X,Z)=>$.endsWith(`
30
+ `)?J4(Z,X):Z.includes(`
31
31
  `)?`
32
- `+G9(Z,X):($.endsWith(" ")?"":" ")+Z;eq.indentComment=G9;eq.lineComment=tq;eq.stringifyComment=oq});var fX=K((zz)=>{function qz($,X,Z="flow",{indentAtStart:q,lineWidth:z=80,minContentWidth:G=20,onFold:J,onOverflow:Q}={}){if(!z||z<0)return $;if(z<G)G=0;let Y=Math.max(1+G,1+z-X.length);if($.length<=Y)return $;let U=[],W={},H=z-X.length;if(typeof q==="number")if(q>z-Math.max(2,G))U.push(0);else H=z-q;let V=void 0,w=void 0,B=!1,T=-1,L=-1,D=-1;if(Z==="block"){if(T=xX($,T,X.length),T!==-1)H=T+Y}for(let O;O=$[T+=1];){if(Z==="quoted"&&O==="\\"){switch(L=T,$[T+1]){case"x":T+=3;break;case"u":T+=5;break;case"U":T+=9;break;default:T+=1}D=T}if(O===`
33
- `){if(Z==="block")T=xX($,T,X.length);H=T+X.length+Y,V=void 0}else{if(O===" "&&w&&w!==" "&&w!==`
34
- `&&w!=="\t"){let I=$[T+1];if(I&&I!==" "&&I!==`
35
- `&&I!=="\t")V=T}if(T>=H)if(V)U.push(V),H=V+Y,V=void 0;else if(Z==="quoted"){while(w===" "||w==="\t")w=O,O=$[T+=1],B=!0;let I=T>D+1?T-2:L-1;if(W[I])return $;U.push(I),W[I]=!0,H=I+Y,V=void 0}else B=!0}w=O}if(B&&Q)Q();if(U.length===0)return $;if(J)J();let _=$.slice(0,U[0]);for(let O=0;O<U.length;++O){let I=U[O],R=U[O+1]||$.length;if(I===0)_=`
36
- ${X}${$.slice(0,R)}`;else{if(Z==="quoted"&&W[I])_+=`${$[I]}\\`;_+=`
37
- ${X}${$.slice(I+1,R)}`}}return _}function xX($,X,Z){let q=X,z=X+1,G=$[z];while(G===" "||G==="\t")if(X<z+Z)G=$[++X];else{do G=$[++X];while(G&&G!==`
38
- `);q=X,z=X+1,G=$[z]}return q}zz.FOLD_BLOCK="block";zz.FOLD_FLOW="flow";zz.FOLD_QUOTED="quoted";zz.foldFlowLines=qz});var N$=K((Vz)=>{var $0=g(),B0=fX(),R1=($,X)=>({indentAtStart:X?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),P1=($)=>/^(%|---|\.\.\.)/m.test($);function Uz($,X,Z){if(!X||X<0)return!1;let q=X-Z,z=$.length;if(z<=q)return!1;for(let G=0,J=0;G<z;++G)if($[G]===`
39
- `){if(G-J>q)return!0;if(J=G+1,z-J<=q)return!1}return!0}function P$($,X){let Z=JSON.stringify($);if(X.options.doubleQuotedAsJSON)return Z;let{implicitKey:q}=X,z=X.options.doubleQuotedMinMultiLineLength,G=X.indent||(P1($)?" ":""),J="",Q=0;for(let Y=0,U=Z[Y];U;U=Z[++Y]){if(U===" "&&Z[Y+1]==="\\"&&Z[Y+2]==="n")J+=Z.slice(Q,Y)+"\\ ",Y+=1,Q=Y,U="\\";if(U==="\\")switch(Z[Y+1]){case"u":{J+=Z.slice(Q,Y);let W=Z.substr(Y+2,4);switch(W){case"0000":J+="\\0";break;case"0007":J+="\\a";break;case"000b":J+="\\v";break;case"001b":J+="\\e";break;case"0085":J+="\\N";break;case"00a0":J+="\\_";break;case"2028":J+="\\L";break;case"2029":J+="\\P";break;default:if(W.substr(0,2)==="00")J+="\\x"+W.substr(2);else J+=Z.substr(Y,6)}Y+=5,Q=Y+1}break;case"n":if(q||Z[Y+2]==='"'||Z.length<z)Y+=1;else{J+=Z.slice(Q,Y)+`
32
+ `+J4(Z,X):($.endsWith(" ")?"":" ")+Z;$q.indentComment=J4;$q.lineComment=ez;$q.stringifyComment=tz});var k5=D((Gq)=>{function qq($,X,Z="flow",{indentAtStart:z,lineWidth:q=80,minContentWidth:G=20,onFold:J,onOverflow:Q}={}){if(!q||q<0)return $;if(q<G)G=0;let Y=Math.max(1+G,1+q-X.length);if($.length<=Y)return $;let U=[],W={},H=q-X.length;if(typeof z==="number")if(z>q-Math.max(2,G))U.push(0);else H=q-z;let V=void 0,B=void 0,L=!1,T=-1,K=-1,_=-1;if(Z==="block"){if(T=y5($,T,X.length),T!==-1)H=T+Y}for(let O;O=$[T+=1];){if(Z==="quoted"&&O==="\\"){switch(K=T,$[T+1]){case"x":T+=3;break;case"u":T+=5;break;case"U":T+=9;break;default:T+=1}_=T}if(O===`
33
+ `){if(Z==="block")T=y5($,T,X.length);H=T+X.length+Y,V=void 0}else{if(O===" "&&B&&B!==" "&&B!==`
34
+ `&&B!=="\t"){let I=$[T+1];if(I&&I!==" "&&I!==`
35
+ `&&I!=="\t")V=T}if(T>=H)if(V)U.push(V),H=V+Y,V=void 0;else if(Z==="quoted"){while(B===" "||B==="\t")B=O,O=$[T+=1],L=!0;let I=T>_+1?T-2:K-1;if(W[I])return $;U.push(I),W[I]=!0,H=I+Y,V=void 0}else L=!0}B=O}if(L&&Q)Q();if(U.length===0)return $;if(J)J();let F=$.slice(0,U[0]);for(let O=0;O<U.length;++O){let I=U[O],R=U[O+1]||$.length;if(I===0)F=`
36
+ ${X}${$.slice(0,R)}`;else{if(Z==="quoted"&&W[I])F+=`${$[I]}\\`;F+=`
37
+ ${X}${$.slice(I+1,R)}`}}return F}function y5($,X,Z){let z=X,q=X+1,G=$[q];while(G===" "||G==="\t")if(X<q+Z)G=$[++X];else{do G=$[++X];while(G&&G!==`
38
+ `);z=X,q=X+1,G=$[q]}return z}Gq.FOLD_BLOCK="block";Gq.FOLD_FLOW="flow";Gq.FOLD_QUOTED="quoted";Gq.foldFlowLines=qq});var N$=D((Tq)=>{var $0=g(),L0=k5(),R1=($,X)=>({indentAtStart:X?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),P1=($)=>/^(%|---|\.\.\.)/m.test($);function Hq($,X,Z){if(!X||X<0)return!1;let z=X-Z,q=$.length;if(q<=z)return!1;for(let G=0,J=0;G<q;++G)if($[G]===`
39
+ `){if(G-J>z)return!0;if(J=G+1,q-J<=z)return!1}return!0}function P$($,X){let Z=JSON.stringify($);if(X.options.doubleQuotedAsJSON)return Z;let{implicitKey:z}=X,q=X.options.doubleQuotedMinMultiLineLength,G=X.indent||(P1($)?" ":""),J="",Q=0;for(let Y=0,U=Z[Y];U;U=Z[++Y]){if(U===" "&&Z[Y+1]==="\\"&&Z[Y+2]==="n")J+=Z.slice(Q,Y)+"\\ ",Y+=1,Q=Y,U="\\";if(U==="\\")switch(Z[Y+1]){case"u":{J+=Z.slice(Q,Y);let W=Z.substr(Y+2,4);switch(W){case"0000":J+="\\0";break;case"0007":J+="\\a";break;case"000b":J+="\\v";break;case"001b":J+="\\e";break;case"0085":J+="\\N";break;case"00a0":J+="\\_";break;case"2028":J+="\\L";break;case"2029":J+="\\P";break;default:if(W.substr(0,2)==="00")J+="\\x"+W.substr(2);else J+=Z.substr(Y,6)}Y+=5,Q=Y+1}break;case"n":if(z||Z[Y+2]==='"'||Z.length<q)Y+=1;else{J+=Z.slice(Q,Y)+`
40
40
 
41
41
  `;while(Z[Y+2]==="\\"&&Z[Y+3]==="n"&&Z[Y+4]!=='"')J+=`
42
- `,Y+=2;if(J+=G,Z[Y+2]===" ")J+="\\";Y+=1,Q=Y+1}break;default:Y+=1}}return J=Q?J+Z.slice(Q):Z,q?J:B0.foldFlowLines(J,G,B0.FOLD_QUOTED,R1(X,!1))}function J9($,X){if(X.options.singleQuote===!1||X.implicitKey&&$.includes(`
43
- `)||/[ \t]\n|\n[ \t]/.test($))return P$($,X);let Z=X.indent||(P1($)?" ":""),q="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
44
- ${Z}`)+"'";return X.implicitKey?q:B0.foldFlowLines(q,Z,B0.FOLD_FLOW,R1(X,!1))}function s0($,X){let{singleQuote:Z}=X.options,q;if(Z===!1)q=P$;else{let z=$.includes('"'),G=$.includes("'");if(z&&!G)q=J9;else if(G&&!z)q=P$;else q=Z?J9:P$}return q($,X)}var Q9;try{Q9=new RegExp(`(^|(?<!
42
+ `,Y+=2;if(J+=G,Z[Y+2]===" ")J+="\\";Y+=1,Q=Y+1}break;default:Y+=1}}return J=Q?J+Z.slice(Q):Z,z?J:L0.foldFlowLines(J,G,L0.FOLD_QUOTED,R1(X,!1))}function Q4($,X){if(X.options.singleQuote===!1||X.implicitKey&&$.includes(`
43
+ `)||/[ \t]\n|\n[ \t]/.test($))return P$($,X);let Z=X.indent||(P1($)?" ":""),z="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
44
+ ${Z}`)+"'";return X.implicitKey?z:L0.foldFlowLines(z,Z,L0.FOLD_FLOW,R1(X,!1))}function s0($,X){let{singleQuote:Z}=X.options,z;if(Z===!1)z=P$;else{let q=$.includes('"'),G=$.includes("'");if(q&&!G)z=Q4;else if(G&&!q)z=P$;else z=Z?Q4:P$}return z($,X)}var Y4;try{Y4=new RegExp(`(^|(?<!
45
45
  ))
46
46
  +(?!
47
- |$)`,"g")}catch{Q9=/\n+(?!\n|$)/g}function I1({comment:$,type:X,value:Z},q,z,G){let{blockQuote:J,commentString:Q,lineWidth:Y}=q.options;if(!J||/\n[\t ]+$/.test(Z))return s0(Z,q);let U=q.indent||(q.forceBlockIndent||P1(Z)?" ":""),W=J==="literal"?!0:J==="folded"||X===$0.Scalar.BLOCK_FOLDED?!1:X===$0.Scalar.BLOCK_LITERAL?!0:!Uz(Z,Y,U.length);if(!Z)return W?`|
47
+ |$)`,"g")}catch{Y4=/\n+(?!\n|$)/g}function I1({comment:$,type:X,value:Z},z,q,G){let{blockQuote:J,commentString:Q,lineWidth:Y}=z.options;if(!J||/\n[\t ]+$/.test(Z))return s0(Z,z);let U=z.indent||(z.forceBlockIndent||P1(Z)?" ":""),W=J==="literal"?!0:J==="folded"||X===$0.Scalar.BLOCK_FOLDED?!1:X===$0.Scalar.BLOCK_LITERAL?!0:!Hq(Z,Y,U.length);if(!Z)return W?`|
48
48
  `:`>
49
49
  `;let H,V;for(V=Z.length;V>0;--V){let R=Z[V-1];if(R!==`
50
- `&&R!=="\t"&&R!==" ")break}let w=Z.substring(V),B=w.indexOf(`
51
- `);if(B===-1)H="-";else if(Z===w||B!==w.length-1){if(H="+",G)G()}else H="";if(w){if(Z=Z.slice(0,-w.length),w[w.length-1]===`
52
- `)w=w.slice(0,-1);w=w.replace(Q9,`$&${U}`)}let T=!1,L,D=-1;for(L=0;L<Z.length;++L){let R=Z[L];if(R===" ")T=!0;else if(R===`
53
- `)D=L;else break}let _=Z.substring(0,D<L?D+1:L);if(_)Z=Z.substring(_.length),_=_.replace(/\n+/g,`$&${U}`);let I=(T?U?"2":"1":"")+H;if($){if(I+=" "+Q($.replace(/ ?[\r\n]+/g," ")),z)z()}if(!W){let R=Z.replace(/\n+/g,`
54
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${U}`),N=!1,C=R1(q,!0);if(J!=="folded"&&X!==$0.Scalar.BLOCK_FOLDED)C.onOverflow=()=>{N=!0};let F=B0.foldFlowLines(`${_}${R}${w}`,U,B0.FOLD_BLOCK,C);if(!N)return`>${I}
55
- ${U}${F}`}return Z=Z.replace(/\n+/g,`$&${U}`),`|${I}
56
- ${U}${_}${Z}${w}`}function Hz($,X,Z,q){let{type:z,value:G}=$,{actualString:J,implicitKey:Q,indent:Y,indentStep:U,inFlow:W}=X;if(Q&&G.includes(`
50
+ `&&R!=="\t"&&R!==" ")break}let B=Z.substring(V),L=B.indexOf(`
51
+ `);if(L===-1)H="-";else if(Z===B||L!==B.length-1){if(H="+",G)G()}else H="";if(B){if(Z=Z.slice(0,-B.length),B[B.length-1]===`
52
+ `)B=B.slice(0,-1);B=B.replace(Y4,`$&${U}`)}let T=!1,K,_=-1;for(K=0;K<Z.length;++K){let R=Z[K];if(R===" ")T=!0;else if(R===`
53
+ `)_=K;else break}let F=Z.substring(0,_<K?_+1:K);if(F)Z=Z.substring(F.length),F=F.replace(/\n+/g,`$&${U}`);let I=(T?U?"2":"1":"")+H;if($){if(I+=" "+Q($.replace(/ ?[\r\n]+/g," ")),q)q()}if(!W){let R=Z.replace(/\n+/g,`
54
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${U}`),N=!1,E=R1(z,!0);if(J!=="folded"&&X!==$0.Scalar.BLOCK_FOLDED)E.onOverflow=()=>{N=!0};let M=L0.foldFlowLines(`${F}${R}${B}`,U,L0.FOLD_BLOCK,E);if(!N)return`>${I}
55
+ ${U}${M}`}return Z=Z.replace(/\n+/g,`$&${U}`),`|${I}
56
+ ${U}${F}${Z}${B}`}function Wq($,X,Z,z){let{type:q,value:G}=$,{actualString:J,implicitKey:Q,indent:Y,indentStep:U,inFlow:W}=X;if(Q&&G.includes(`
57
57
  `)||W&&/[[\]{},]/.test(G))return s0(G,X);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(G))return Q||W||!G.includes(`
58
- `)?s0(G,X):I1($,X,Z,q);if(!Q&&!W&&z!==$0.Scalar.PLAIN&&G.includes(`
59
- `))return I1($,X,Z,q);if(P1(G)){if(Y==="")return X.forceBlockIndent=!0,I1($,X,Z,q);else if(Q&&Y===U)return s0(G,X)}let H=G.replace(/\n+/g,`$&
60
- ${Y}`);if(J){let V=(T)=>T.default&&T.tag!=="tag:yaml.org,2002:str"&&T.test?.test(H),{compat:w,tags:B}=X.doc.schema;if(B.some(V)||w?.some(V))return s0(G,X)}return Q?H:B0.foldFlowLines(H,Y,B0.FOLD_FLOW,R1(X,!1))}function Wz($,X,Z,q){let{implicitKey:z,inFlow:G}=X,J=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:Q}=$;if(Q!==$0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(J.value))Q=$0.Scalar.QUOTE_DOUBLE}let Y=(W)=>{switch(W){case $0.Scalar.BLOCK_FOLDED:case $0.Scalar.BLOCK_LITERAL:return z||G?s0(J.value,X):I1(J,X,Z,q);case $0.Scalar.QUOTE_DOUBLE:return P$(J.value,X);case $0.Scalar.QUOTE_SINGLE:return J9(J.value,X);case $0.Scalar.PLAIN:return Hz(J,X,Z,q);default:return null}},U=Y(Q);if(U===null){let{defaultKeyType:W,defaultStringType:H}=X.options,V=z&&W||H;if(U=Y(V),U===null)throw Error(`Unsupported default string type ${V}`)}return U}Vz.stringifyString=Wz});var A$=K((Oz)=>{var wz=_1(),K0=j(),Lz=R$(),Bz=N$();function Kz($,X){let Z=Object.assign({blockQuote:!0,commentString:Lz.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},$.schema.toStringOptions,X),q;switch(Z.collectionStyle){case"block":q=!1;break;case"flow":q=!0;break;default:q=null}return{anchors:new Set,doc:$,flowCollectionPadding:Z.flowCollectionPadding?" ":"",indent:"",indentStep:typeof Z.indent==="number"?" ".repeat(Z.indent):" ",inFlow:q,options:Z}}function Dz($,X){if(X.tag){let z=$.filter((G)=>G.tag===X.tag);if(z.length>0)return z.find((G)=>G.format===X.format)??z[0]}let Z=void 0,q;if(K0.isScalar(X)){q=X.value;let z=$.filter((G)=>G.identify?.(q));if(z.length>1){let G=z.filter((J)=>J.test);if(G.length>0)z=G}Z=z.find((G)=>G.format===X.format)??z.find((G)=>!G.format)}else q=X,Z=$.find((z)=>z.nodeClass&&q instanceof z.nodeClass);if(!Z){let z=q?.constructor?.name??(q===null?"null":typeof q);throw Error(`Tag not resolved for ${z} value`)}return Z}function _z($,X,{anchors:Z,doc:q}){if(!q.directives)return"";let z=[],G=(K0.isScalar($)||K0.isCollection($))&&$.anchor;if(G&&wz.anchorIsValid(G))Z.add(G),z.push(`&${G}`);let J=$.tag??(X.default?null:X.tag);if(J)z.push(q.directives.tagString(J));return z.join(" ")}function Fz($,X,Z,q){if(K0.isPair($))return $.toString(X,Z,q);if(K0.isAlias($)){if(X.doc.directives)return $.toString(X);if(X.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(X.resolvedAliases)X.resolvedAliases.add($);else X.resolvedAliases=new Set([$]);$=$.resolve(X.doc)}}let z=void 0,G=K0.isNode($)?$:X.doc.createNode($,{onTagObj:(Y)=>z=Y});z??(z=Dz(X.doc.schema.tags,G));let J=_z(G,z,X);if(J.length>0)X.indentAtStart=(X.indentAtStart??0)+J.length+1;let Q=typeof z.stringify==="function"?z.stringify(G,X,Z,q):K0.isScalar(G)?Bz.stringifyString(G,X,Z,q):G.toString(X,Z,q);if(!J)return Q;return K0.isScalar(G)||Q[0]==="{"||Q[0]==="["?`${J} ${Q}`:`${J}
61
- ${X.indent}${Q}`}Oz.createStringifyContext=Kz;Oz.stringify=Fz});var hX=K((Pz)=>{var H0=j(),kX=g(),gX=A$(),S$=R$();function Rz({key:$,value:X},Z,q,z){let{allNullValues:G,doc:J,indent:Q,indentStep:Y,options:{commentString:U,indentSeq:W,simpleKeys:H}}=Z,V=H0.isNode($)&&$.comment||null;if(H){if(V)throw Error("With simple keys, key nodes cannot have comments");if(H0.isCollection($)||!H0.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let w=!H&&(!$||V&&X==null&&!Z.inFlow||H0.isCollection($)||(H0.isScalar($)?$.type===kX.Scalar.BLOCK_FOLDED||$.type===kX.Scalar.BLOCK_LITERAL:typeof $==="object"));Z=Object.assign({},Z,{allNullValues:!1,implicitKey:!w&&(H||!G),indent:Q+Y});let B=!1,T=!1,L=gX.stringify($,Z,()=>B=!0,()=>T=!0);if(!w&&!Z.inFlow&&L.length>1024){if(H)throw Error("With simple keys, single line scalar must not span more than 1024 characters");w=!0}if(Z.inFlow){if(G||X==null){if(B&&q)q();return L===""?"?":w?`? ${L}`:L}}else if(G&&!H||X==null&&w){if(L=`? ${L}`,V&&!B)L+=S$.lineComment(L,Z.indent,U(V));else if(T&&z)z();return L}if(B)V=null;if(w){if(V)L+=S$.lineComment(L,Z.indent,U(V));L=`? ${L}
62
- ${Q}:`}else if(L=`${L}:`,V)L+=S$.lineComment(L,Z.indent,U(V));let D,_,O;if(H0.isNode(X))D=!!X.spaceBefore,_=X.commentBefore,O=X.comment;else if(D=!1,_=null,O=null,X&&typeof X==="object")X=J.createNode(X);if(Z.implicitKey=!1,!w&&!V&&H0.isScalar(X))Z.indentAtStart=L.length+1;if(T=!1,!W&&Y.length>=2&&!Z.inFlow&&!w&&H0.isSeq(X)&&!X.flow&&!X.tag&&!X.anchor)Z.indent=Z.indent.substring(2);let I=!1,R=gX.stringify(X,Z,()=>I=!0,()=>T=!0),N=" ";if(V||D||_){if(N=D?`
63
- `:"",_){let C=U(_);N+=`
64
- ${S$.indentComment(C,Z.indent)}`}if(R===""&&!Z.inFlow){if(N===`
58
+ `)?s0(G,X):I1($,X,Z,z);if(!Q&&!W&&q!==$0.Scalar.PLAIN&&G.includes(`
59
+ `))return I1($,X,Z,z);if(P1(G)){if(Y==="")return X.forceBlockIndent=!0,I1($,X,Z,z);else if(Q&&Y===U)return s0(G,X)}let H=G.replace(/\n+/g,`$&
60
+ ${Y}`);if(J){let V=(T)=>T.default&&T.tag!=="tag:yaml.org,2002:str"&&T.test?.test(H),{compat:B,tags:L}=X.doc.schema;if(L.some(V)||B?.some(V))return s0(G,X)}return Q?H:L0.foldFlowLines(H,Y,L0.FOLD_FLOW,R1(X,!1))}function Vq($,X,Z,z){let{implicitKey:q,inFlow:G}=X,J=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:Q}=$;if(Q!==$0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(J.value))Q=$0.Scalar.QUOTE_DOUBLE}let Y=(W)=>{switch(W){case $0.Scalar.BLOCK_FOLDED:case $0.Scalar.BLOCK_LITERAL:return q||G?s0(J.value,X):I1(J,X,Z,z);case $0.Scalar.QUOTE_DOUBLE:return P$(J.value,X);case $0.Scalar.QUOTE_SINGLE:return Q4(J.value,X);case $0.Scalar.PLAIN:return Wq(J,X,Z,z);default:return null}},U=Y(Q);if(U===null){let{defaultKeyType:W,defaultStringType:H}=X.options,V=q&&W||H;if(U=Y(V),U===null)throw Error(`Unsupported default string type ${V}`)}return U}Tq.stringifyString=Vq});var A$=D((wq)=>{var Kq=F1(),D0=S(),Lq=R$(),Dq=N$();function _q($,X){let Z=Object.assign({blockQuote:!0,commentString:Lq.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},$.schema.toStringOptions,X),z;switch(Z.collectionStyle){case"block":z=!1;break;case"flow":z=!0;break;default:z=null}return{anchors:new Set,doc:$,flowCollectionPadding:Z.flowCollectionPadding?" ":"",indent:"",indentStep:typeof Z.indent==="number"?" ".repeat(Z.indent):" ",inFlow:z,options:Z}}function Fq($,X){if(X.tag){let q=$.filter((G)=>G.tag===X.tag);if(q.length>0)return q.find((G)=>G.format===X.format)??q[0]}let Z=void 0,z;if(D0.isScalar(X)){z=X.value;let q=$.filter((G)=>G.identify?.(z));if(q.length>1){let G=q.filter((J)=>J.test);if(G.length>0)q=G}Z=q.find((G)=>G.format===X.format)??q.find((G)=>!G.format)}else z=X,Z=$.find((q)=>q.nodeClass&&z instanceof q.nodeClass);if(!Z){let q=z?.constructor?.name??(z===null?"null":typeof z);throw Error(`Tag not resolved for ${q} value`)}return Z}function Mq($,X,{anchors:Z,doc:z}){if(!z.directives)return"";let q=[],G=(D0.isScalar($)||D0.isCollection($))&&$.anchor;if(G&&Kq.anchorIsValid(G))Z.add(G),q.push(`&${G}`);let J=$.tag??(X.default?null:X.tag);if(J)q.push(z.directives.tagString(J));return q.join(" ")}function Oq($,X,Z,z){if(D0.isPair($))return $.toString(X,Z,z);if(D0.isAlias($)){if(X.doc.directives)return $.toString(X);if(X.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(X.resolvedAliases)X.resolvedAliases.add($);else X.resolvedAliases=new Set([$]);$=$.resolve(X.doc)}}let q=void 0,G=D0.isNode($)?$:X.doc.createNode($,{onTagObj:(Y)=>q=Y});q??(q=Fq(X.doc.schema.tags,G));let J=Mq(G,q,X);if(J.length>0)X.indentAtStart=(X.indentAtStart??0)+J.length+1;let Q=typeof q.stringify==="function"?q.stringify(G,X,Z,z):D0.isScalar(G)?Dq.stringifyString(G,X,Z,z):G.toString(X,Z,z);if(!J)return Q;return D0.isScalar(G)||Q[0]==="{"||Q[0]==="["?`${J} ${Q}`:`${J}
61
+ ${X.indent}${Q}`}wq.createStringifyContext=_q;wq.stringify=Oq});var h5=D((Nq)=>{var H0=S(),f5=g(),g5=A$(),j$=R$();function Pq({key:$,value:X},Z,z,q){let{allNullValues:G,doc:J,indent:Q,indentStep:Y,options:{commentString:U,indentSeq:W,simpleKeys:H}}=Z,V=H0.isNode($)&&$.comment||null;if(H){if(V)throw Error("With simple keys, key nodes cannot have comments");if(H0.isCollection($)||!H0.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let B=!H&&(!$||V&&X==null&&!Z.inFlow||H0.isCollection($)||(H0.isScalar($)?$.type===f5.Scalar.BLOCK_FOLDED||$.type===f5.Scalar.BLOCK_LITERAL:typeof $==="object"));Z=Object.assign({},Z,{allNullValues:!1,implicitKey:!B&&(H||!G),indent:Q+Y});let L=!1,T=!1,K=g5.stringify($,Z,()=>L=!0,()=>T=!0);if(!B&&!Z.inFlow&&K.length>1024){if(H)throw Error("With simple keys, single line scalar must not span more than 1024 characters");B=!0}if(Z.inFlow){if(G||X==null){if(L&&z)z();return K===""?"?":B?`? ${K}`:K}}else if(G&&!H||X==null&&B){if(K=`? ${K}`,V&&!L)K+=j$.lineComment(K,Z.indent,U(V));else if(T&&q)q();return K}if(L)V=null;if(B){if(V)K+=j$.lineComment(K,Z.indent,U(V));K=`? ${K}
62
+ ${Q}:`}else if(K=`${K}:`,V)K+=j$.lineComment(K,Z.indent,U(V));let _,F,O;if(H0.isNode(X))_=!!X.spaceBefore,F=X.commentBefore,O=X.comment;else if(_=!1,F=null,O=null,X&&typeof X==="object")X=J.createNode(X);if(Z.implicitKey=!1,!B&&!V&&H0.isScalar(X))Z.indentAtStart=K.length+1;if(T=!1,!W&&Y.length>=2&&!Z.inFlow&&!B&&H0.isSeq(X)&&!X.flow&&!X.tag&&!X.anchor)Z.indent=Z.indent.substring(2);let I=!1,R=g5.stringify(X,Z,()=>I=!0,()=>T=!0),N=" ";if(V||_||F){if(N=_?`
63
+ `:"",F){let E=U(F);N+=`
64
+ ${j$.indentComment(E,Z.indent)}`}if(R===""&&!Z.inFlow){if(N===`
65
65
  `&&O)N=`
66
66
 
67
67
  `}else N+=`
68
- ${Z.indent}`}else if(!w&&H0.isCollection(X)){let C=R[0],F=R.indexOf(`
69
- `),y=F!==-1,a=Z.inFlow??X.flow??X.items.length===0;if(y||!a){let q0=!1;if(y&&(C==="&"||C==="!")){let k=R.indexOf(" ");if(C==="&"&&k!==-1&&k<F&&R[k+1]==="!")k=R.indexOf(" ",k+1);if(k===-1||F<k)q0=!0}if(!q0)N=`
68
+ ${Z.indent}`}else if(!B&&H0.isCollection(X)){let E=R[0],M=R.indexOf(`
69
+ `),x=M!==-1,a=Z.inFlow??X.flow??X.items.length===0;if(x||!a){let z0=!1;if(x&&(E==="&"||E==="!")){let f=R.indexOf(" ");if(E==="&"&&f!==-1&&f<M&&R[f+1]==="!")f=R.indexOf(" ",f+1);if(f===-1||M<f)z0=!0}if(!z0)N=`
70
70
  ${Z.indent}`}}else if(R===""||R[0]===`
71
- `)N="";if(L+=N+R,Z.inFlow){if(I&&q)q()}else if(O&&!I)L+=S$.lineComment(L,Z.indent,U(O));else if(T&&z)z();return L}Pz.stringifyPair=Rz});var Y9=K((jz)=>{var vX=Q0("process");function Az($,...X){if($==="debug")console.log(...X)}function Sz($,X){if($==="debug"||$==="warn")if(typeof vX.emitWarning==="function")vX.emitWarning(X);else console.warn(X)}jz.debug=Az;jz.warn=Sz});var S1=K((yz)=>{var j$=j(),uX=g(),N1="<<",A1={identify:($)=>$===N1||typeof $==="symbol"&&$.description===N1,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new uX.Scalar(Symbol(N1)),{addToJSMap:mX}),stringify:()=>N1},bz=($,X)=>(A1.identify(X)||j$.isScalar(X)&&(!X.type||X.type===uX.Scalar.PLAIN)&&A1.identify(X.value))&&$?.doc.schema.tags.some((Z)=>Z.tag===A1.tag&&Z.default);function mX($,X,Z){if(Z=$&&j$.isAlias(Z)?Z.resolve($.doc):Z,j$.isSeq(Z))for(let q of Z.items)U9($,X,q);else if(Array.isArray(Z))for(let q of Z)U9($,X,q);else U9($,X,Z)}function U9($,X,Z){let q=$&&j$.isAlias(Z)?Z.resolve($.doc):Z;if(!j$.isMap(q))throw Error("Merge sources must be maps or map aliases");let z=q.toJSON(null,$,Map);for(let[G,J]of z)if(X instanceof Map){if(!X.has(G))X.set(G,J)}else if(X instanceof Set)X.add(G);else if(!Object.prototype.hasOwnProperty.call(X,G))Object.defineProperty(X,G,{value:J,writable:!0,enumerable:!0,configurable:!0});return X}yz.addMergeToJSMap=mX;yz.isMergeKey=bz;yz.merge=A1});var W9=K((mz)=>{var gz=Y9(),dX=S1(),hz=A$(),pX=j(),H9=L0();function vz($,X,{key:Z,value:q}){if(pX.isNode(Z)&&Z.addToJSMap)Z.addToJSMap($,X,q);else if(dX.isMergeKey($,Z))dX.addMergeToJSMap($,X,q);else{let z=H9.toJS(Z,"",$);if(X instanceof Map)X.set(z,H9.toJS(q,z,$));else if(X instanceof Set)X.add(z);else{let G=uz(Z,z,$),J=H9.toJS(q,G,$);if(G in X)Object.defineProperty(X,G,{value:J,writable:!0,enumerable:!0,configurable:!0});else X[G]=J}}return X}function uz($,X,Z){if(X===null)return"";if(typeof X!=="object")return String(X);if(pX.isNode($)&&Z?.doc){let q=hz.createStringifyContext(Z.doc,{});q.anchors=new Set;for(let G of Z.anchors.keys())q.anchors.add(G.anchor);q.inFlow=!0,q.inStringifyKey=!0;let z=$.toString(q);if(!Z.mapKeyWarned){let G=JSON.stringify(z);if(G.length>40)G=G.substring(0,36)+'..."';gz.warn(Z.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${G}. Set mapAsMap: true to use object keys.`),Z.mapKeyWarned=!0}return z}return JSON.stringify(X)}mz.addPairToJSMap=vz});var D0=K((iz)=>{var cX=I$(),pz=hX(),cz=W9(),j1=j();function lz($,X,Z){let q=cX.createNode($,void 0,Z),z=cX.createNode(X,void 0,Z);return new E1(q,z)}class E1{constructor($,X=null){Object.defineProperty(this,j1.NODE_TYPE,{value:j1.PAIR}),this.key=$,this.value=X}clone($){let{key:X,value:Z}=this;if(j1.isNode(X))X=X.clone($);if(j1.isNode(Z))Z=Z.clone($);return new E1(X,Z)}toJSON($,X){let Z=X?.mapAsMap?new Map:{};return cz.addPairToJSMap(X,Z,this)}toString($,X,Z){return $?.doc?pz.stringifyPair(this,$,X,Z):JSON.stringify(this)}}iz.Pair=E1;iz.createPair=lz});var V9=K((tz)=>{var E0=j(),lX=A$(),C1=R$();function nz($,X,Z){return(X.inFlow??$.flow?oz:rz)($,X,Z)}function rz({comment:$,items:X},Z,{blockItemPrefix:q,flowChars:z,itemIndent:G,onChompKeep:J,onComment:Q}){let{indent:Y,options:{commentString:U}}=Z,W=Object.assign({},Z,{indent:G,type:null}),H=!1,V=[];for(let B=0;B<X.length;++B){let T=X[B],L=null;if(E0.isNode(T)){if(!H&&T.spaceBefore)V.push("");if(b1(Z,V,T.commentBefore,H),T.comment)L=T.comment}else if(E0.isPair(T)){let _=E0.isNode(T.key)?T.key:null;if(_){if(!H&&_.spaceBefore)V.push("");b1(Z,V,_.commentBefore,H)}}H=!1;let D=lX.stringify(T,W,()=>L=null,()=>H=!0);if(L)D+=C1.lineComment(D,G,U(L));if(H&&L)H=!1;V.push(q+D)}let w;if(V.length===0)w=z.start+z.end;else{w=V[0];for(let B=1;B<V.length;++B){let T=V[B];w+=T?`
71
+ `)N="";if(K+=N+R,Z.inFlow){if(I&&z)z()}else if(O&&!I)K+=j$.lineComment(K,Z.indent,U(O));else if(T&&q)q();return K}Nq.stringifyPair=Pq});var U4=D((Cq)=>{var v5=Q0("process");function jq($,...X){if($==="debug")console.log(...X)}function Sq($,X){if($==="debug"||$==="warn")if(typeof v5.emitWarning==="function")v5.emitWarning(X);else console.warn(X)}Cq.debug=jq;Cq.warn=Sq});var j1=D((yq)=>{var S$=S(),u5=g(),N1="<<",A1={identify:($)=>$===N1||typeof $==="symbol"&&$.description===N1,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new u5.Scalar(Symbol(N1)),{addToJSMap:m5}),stringify:()=>N1},xq=($,X)=>(A1.identify(X)||S$.isScalar(X)&&(!X.type||X.type===u5.Scalar.PLAIN)&&A1.identify(X.value))&&$?.doc.schema.tags.some((Z)=>Z.tag===A1.tag&&Z.default);function m5($,X,Z){if(Z=$&&S$.isAlias(Z)?Z.resolve($.doc):Z,S$.isSeq(Z))for(let z of Z.items)H4($,X,z);else if(Array.isArray(Z))for(let z of Z)H4($,X,z);else H4($,X,Z)}function H4($,X,Z){let z=$&&S$.isAlias(Z)?Z.resolve($.doc):Z;if(!S$.isMap(z))throw Error("Merge sources must be maps or map aliases");let q=z.toJSON(null,$,Map);for(let[G,J]of q)if(X instanceof Map){if(!X.has(G))X.set(G,J)}else if(X instanceof Set)X.add(G);else if(!Object.prototype.hasOwnProperty.call(X,G))Object.defineProperty(X,G,{value:J,writable:!0,enumerable:!0,configurable:!0});return X}yq.addMergeToJSMap=m5;yq.isMergeKey=xq;yq.merge=A1});var V4=D((dq)=>{var hq=U4(),d5=j1(),vq=A$(),p5=S(),W4=K0();function uq($,X,{key:Z,value:z}){if(p5.isNode(Z)&&Z.addToJSMap)Z.addToJSMap($,X,z);else if(d5.isMergeKey($,Z))d5.addMergeToJSMap($,X,z);else{let q=W4.toJS(Z,"",$);if(X instanceof Map)X.set(q,W4.toJS(z,q,$));else if(X instanceof Set)X.add(q);else{let G=mq(Z,q,$),J=W4.toJS(z,G,$);if(G in X)Object.defineProperty(X,G,{value:J,writable:!0,enumerable:!0,configurable:!0});else X[G]=J}}return X}function mq($,X,Z){if(X===null)return"";if(typeof X!=="object")return String(X);if(p5.isNode($)&&Z?.doc){let z=vq.createStringifyContext(Z.doc,{});z.anchors=new Set;for(let G of Z.anchors.keys())z.anchors.add(G.anchor);z.inFlow=!0,z.inStringifyKey=!0;let q=$.toString(z);if(!Z.mapKeyWarned){let G=JSON.stringify(q);if(G.length>40)G=G.substring(0,36)+'..."';hq.warn(Z.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${G}. Set mapAsMap: true to use object keys.`),Z.mapKeyWarned=!0}return q}return JSON.stringify(X)}dq.addPairToJSMap=uq});var _0=D((aq)=>{var l5=I$(),lq=h5(),cq=V4(),S1=S();function iq($,X,Z){let z=l5.createNode($,void 0,Z),q=l5.createNode(X,void 0,Z);return new C1(z,q)}class C1{constructor($,X=null){Object.defineProperty(this,S1.NODE_TYPE,{value:S1.PAIR}),this.key=$,this.value=X}clone($){let{key:X,value:Z}=this;if(S1.isNode(X))X=X.clone($);if(S1.isNode(Z))Z=Z.clone($);return new C1(X,Z)}toJSON($,X){let Z=X?.mapAsMap?new Map:{};return cq.addPairToJSMap(X,Z,this)}toString($,X,Z){return $?.doc?lq.stringifyPair(this,$,X,Z):JSON.stringify(this)}}aq.Pair=C1;aq.createPair=iq});var T4=D((eq)=>{var C0=S(),c5=A$(),E1=R$();function rq($,X,Z){return(X.inFlow??$.flow?tq:oq)($,X,Z)}function oq({comment:$,items:X},Z,{blockItemPrefix:z,flowChars:q,itemIndent:G,onChompKeep:J,onComment:Q}){let{indent:Y,options:{commentString:U}}=Z,W=Object.assign({},Z,{indent:G,type:null}),H=!1,V=[];for(let L=0;L<X.length;++L){let T=X[L],K=null;if(C0.isNode(T)){if(!H&&T.spaceBefore)V.push("");if(b1(Z,V,T.commentBefore,H),T.comment)K=T.comment}else if(C0.isPair(T)){let F=C0.isNode(T.key)?T.key:null;if(F){if(!H&&F.spaceBefore)V.push("");b1(Z,V,F.commentBefore,H)}}H=!1;let _=c5.stringify(T,W,()=>K=null,()=>H=!0);if(K)_+=E1.lineComment(_,G,U(K));if(H&&K)H=!1;V.push(z+_)}let B;if(V.length===0)B=q.start+q.end;else{B=V[0];for(let L=1;L<V.length;++L){let T=V[L];B+=T?`
72
72
  ${Y}${T}`:`
73
- `}}if($){if(w+=`
74
- `+C1.indentComment(U($),Y),Q)Q()}else if(H&&J)J();return w}function oz({items:$},X,{flowChars:Z,itemIndent:q}){let{indent:z,indentStep:G,flowCollectionPadding:J,options:{commentString:Q}}=X;q+=G;let Y=Object.assign({},X,{indent:q,inFlow:!0,type:null}),U=!1,W=0,H=[];for(let B=0;B<$.length;++B){let T=$[B],L=null;if(E0.isNode(T)){if(T.spaceBefore)H.push("");if(b1(X,H,T.commentBefore,!1),T.comment)L=T.comment}else if(E0.isPair(T)){let _=E0.isNode(T.key)?T.key:null;if(_){if(_.spaceBefore)H.push("");if(b1(X,H,_.commentBefore,!1),_.comment)U=!0}let O=E0.isNode(T.value)?T.value:null;if(O){if(O.comment)L=O.comment;if(O.commentBefore)U=!0}else if(T.value==null&&_?.comment)L=_.comment}if(L)U=!0;let D=lX.stringify(T,Y,()=>L=null);if(B<$.length-1)D+=",";if(L)D+=C1.lineComment(D,q,Q(L));if(!U&&(H.length>W||D.includes(`
75
- `)))U=!0;H.push(D),W=H.length}let{start:V,end:w}=Z;if(H.length===0)return V+w;else{if(!U){let B=H.reduce((T,L)=>T+L.length+2,2);U=X.options.lineWidth>0&&B>X.options.lineWidth}if(U){let B=V;for(let T of H)B+=T?`
76
- ${G}${z}${T}`:`
77
- `;return`${B}
78
- ${z}${w}`}else return`${V}${J}${H.join(" ")}${J}${w}`}}function b1({indent:$,options:{commentString:X}},Z,q,z){if(q&&z)q=q.replace(/^\n+/,"");if(q){let G=C1.indentComment(X(q),$);Z.push(G.trimStart())}}tz.stringifyCollection=nz});var F0=K((z3)=>{var $3=V9(),X3=W9(),Z3=M1(),_0=j(),y1=D0(),q3=g();function E$($,X){let Z=_0.isScalar(X)?X.value:X;for(let q of $)if(_0.isPair(q)){if(q.key===X||q.key===Z)return q;if(_0.isScalar(q.key)&&q.key.value===Z)return q}return}class iX extends Z3.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(_0.MAP,$);this.items=[]}static from($,X,Z){let{keepUndefined:q,replacer:z}=Z,G=new this($),J=(Q,Y)=>{if(typeof z==="function")Y=z.call(X,Q,Y);else if(Array.isArray(z)&&!z.includes(Q))return;if(Y!==void 0||q)G.items.push(y1.createPair(Q,Y,Z))};if(X instanceof Map)for(let[Q,Y]of X)J(Q,Y);else if(X&&typeof X==="object")for(let Q of Object.keys(X))J(Q,X[Q]);if(typeof $.sortMapEntries==="function")G.items.sort($.sortMapEntries);return G}add($,X){let Z;if(_0.isPair($))Z=$;else if(!$||typeof $!=="object"||!("key"in $))Z=new y1.Pair($,$?.value);else Z=new y1.Pair($.key,$.value);let q=E$(this.items,Z.key),z=this.schema?.sortMapEntries;if(q){if(!X)throw Error(`Key ${Z.key} already set`);if(_0.isScalar(q.value)&&q3.isScalarValue(Z.value))q.value.value=Z.value;else q.value=Z.value}else if(z){let G=this.items.findIndex((J)=>z(Z,J)<0);if(G===-1)this.items.push(Z);else this.items.splice(G,0,Z)}else this.items.push(Z)}delete($){let X=E$(this.items,$);if(!X)return!1;return this.items.splice(this.items.indexOf(X),1).length>0}get($,X){let q=E$(this.items,$)?.value;return(!X&&_0.isScalar(q)?q.value:q)??void 0}has($){return!!E$(this.items,$)}set($,X){this.add(new y1.Pair($,X),!0)}toJSON($,X,Z){let q=Z?new Z:X?.mapAsMap?new Map:{};if(X?.onCreate)X.onCreate(q);for(let z of this.items)X3.addPairToJSMap(X,q,z);return q}toString($,X,Z){if(!$)return JSON.stringify(this);for(let q of this.items)if(!_0.isPair(q))throw Error(`Map items must all be pairs; found ${JSON.stringify(q)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return $3.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:Z,onComment:X})}}z3.YAMLMap=iX;z3.findPair=E$});var n0=K((U3)=>{var Q3=j(),aX=F0(),Y3={collection:"map",default:!0,nodeClass:aX.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,X){if(!Q3.isMap($))X("Expected a mapping for this tag");return $},createNode:($,X,Z)=>aX.YAMLMap.from($,X,Z)};U3.map=Y3});var O0=K((B3)=>{var W3=I$(),V3=V9(),T3=M1(),f1=j(),w3=g(),L3=L0();class sX extends T3.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(f1.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let X=x1($);if(typeof X!=="number")return!1;return this.items.splice(X,1).length>0}get($,X){let Z=x1($);if(typeof Z!=="number")return;let q=this.items[Z];return!X&&f1.isScalar(q)?q.value:q}has($){let X=x1($);return typeof X==="number"&&X<this.items.length}set($,X){let Z=x1($);if(typeof Z!=="number")throw Error(`Expected a valid index, not ${$}.`);let q=this.items[Z];if(f1.isScalar(q)&&w3.isScalarValue(X))q.value=X;else this.items[Z]=X}toJSON($,X){let Z=[];if(X?.onCreate)X.onCreate(Z);let q=0;for(let z of this.items)Z.push(L3.toJS(z,String(q++),X));return Z}toString($,X,Z){if(!$)return JSON.stringify(this);return V3.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:Z,onComment:X})}static from($,X,Z){let{replacer:q}=Z,z=new this($);if(X&&Symbol.iterator in Object(X)){let G=0;for(let J of X){if(typeof q==="function"){let Q=X instanceof Set?J:String(G++);J=q.call(X,Q,J)}z.items.push(W3.createNode(J,void 0,Z))}}return z}}function x1($){let X=f1.isScalar($)?$.value:$;if(X&&typeof X==="string")X=Number(X);return typeof X==="number"&&Number.isInteger(X)&&X>=0?X:null}B3.YAMLSeq=sX});var r0=K((F3)=>{var D3=j(),nX=O0(),_3={collection:"seq",default:!0,nodeClass:nX.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,X){if(!D3.isSeq($))X("Expected a sequence for this tag");return $},createNode:($,X,Z)=>nX.YAMLSeq.from($,X,Z)};F3.seq=_3});var C$=K((R3)=>{var M3=N$(),I3={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,X,Z,q){return X=Object.assign({actualString:!0},X),M3.stringifyString($,X,Z,q)}};R3.string=I3});var k1=K((N3)=>{var rX=g(),oX={identify:($)=>$==null,createNode:()=>new rX.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new rX.Scalar(null),stringify:({source:$},X)=>typeof $==="string"&&oX.test.test($)?$:X.options.nullStr};N3.nullTag=oX});var T9=K((j3)=>{var S3=g(),tX={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new S3.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:X},Z){if($&&tX.test.test($)){let q=$[0]==="t"||$[0]==="T";if(X===q)return $}return X?Z.options.trueStr:Z.options.falseStr}};j3.boolTag=tX});var o0=K((b3)=>{function C3({format:$,minFractionDigits:X,tag:Z,value:q}){if(typeof q==="bigint")return String(q);let z=typeof q==="number"?q:Number(q);if(!isFinite(z))return isNaN(z)?".nan":z<0?"-.inf":".inf";let G=Object.is(q,-0)?"-0":JSON.stringify(q);if(!$&&X&&(!Z||Z==="tag:yaml.org,2002:float")&&/^\d/.test(G)){let J=G.indexOf(".");if(J<0)J=G.length,G+=".";let Q=X-(G.length-J-1);while(Q-- >0)G+="0"}return G}b3.stringifyNumber=C3});var L9=K((h3)=>{var x3=g(),w9=o0(),f3={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:w9.stringifyNumber},k3={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($),stringify($){let X=Number($.value);return isFinite(X)?X.toExponential():w9.stringifyNumber($)}},g3={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let X=new x3.Scalar(parseFloat($)),Z=$.indexOf(".");if(Z!==-1&&$[$.length-1]==="0")X.minFractionDigits=$.length-Z-1;return X},stringify:w9.stringifyNumber};h3.float=g3;h3.floatExp=k3;h3.floatNaN=f3});var K9=K((l3)=>{var eX=o0(),g1=($)=>typeof $==="bigint"||Number.isInteger($),B9=($,X,Z,{intAsBigInt:q})=>q?BigInt($):parseInt($.substring(X),Z);function $5($,X,Z){let{value:q}=$;if(g1(q)&&q>=0)return Z+q.toString(X);return eX.stringifyNumber($)}var d3={identify:($)=>g1($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,X,Z)=>B9($,2,8,Z),stringify:($)=>$5($,8,"0o")},p3={identify:g1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,X,Z)=>B9($,0,10,Z),stringify:eX.stringifyNumber},c3={identify:($)=>g1($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,X,Z)=>B9($,2,16,Z),stringify:($)=>$5($,16,"0x")};l3.int=p3;l3.intHex=c3;l3.intOct=d3});var X5=K((X7)=>{var n3=n0(),r3=k1(),o3=r0(),t3=C$(),e3=T9(),D9=L9(),_9=K9(),$7=[n3.map,o3.seq,t3.string,r3.nullTag,e3.boolTag,_9.intOct,_9.int,_9.intHex,D9.floatNaN,D9.floatExp,D9.float];X7.schema=$7});var q5=K((U7)=>{var q7=g(),z7=n0(),G7=r0();function Z5($){return typeof $==="bigint"||Number.isInteger($)}var h1=({value:$})=>JSON.stringify($),J7=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:h1},{identify:($)=>$==null,createNode:()=>new q7.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:h1},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:h1},{identify:Z5,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,X,{intAsBigInt:Z})=>Z?BigInt($):parseInt($,10),stringify:({value:$})=>Z5($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:h1}],Q7={default:!0,tag:"",test:/^/,resolve($,X){return X(`Unresolved plain scalar ${JSON.stringify($)}`),$}},Y7=[z7.map,G7.seq].concat(J7,Q7);U7.schema=Y7});var O9=K((T7)=>{var b$=Q0("buffer"),F9=g(),W7=N$(),V7={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,X){if(typeof b$.Buffer==="function")return b$.Buffer.from($,"base64");else if(typeof atob==="function"){let Z=atob($.replace(/[\n\r]/g,"")),q=new Uint8Array(Z.length);for(let z=0;z<Z.length;++z)q[z]=Z.charCodeAt(z);return q}else return X("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:X,value:Z},q,z,G){if(!Z)return"";let J=Z,Q;if(typeof b$.Buffer==="function")Q=J instanceof b$.Buffer?J.toString("base64"):b$.Buffer.from(J.buffer).toString("base64");else if(typeof btoa==="function"){let Y="";for(let U=0;U<J.length;++U)Y+=String.fromCharCode(J[U]);Q=btoa(Y)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(X??(X=F9.Scalar.BLOCK_LITERAL),X!==F9.Scalar.QUOTE_DOUBLE){let Y=Math.max(q.options.lineWidth-q.indent.length,q.options.minContentWidth),U=Math.ceil(Q.length/Y),W=Array(U);for(let H=0,V=0;H<U;++H,V+=Y)W[H]=Q.substr(V,Y);Q=W.join(X===F9.Scalar.BLOCK_LITERAL?`
79
- `:" ")}return W7.stringifyString({comment:$,type:X,value:Q},q,z,G)}};T7.binary=V7});var u1=K((D7)=>{var v1=j(),M9=D0(),L7=g(),B7=O0();function z5($,X){if(v1.isSeq($))for(let Z=0;Z<$.items.length;++Z){let q=$.items[Z];if(v1.isPair(q))continue;else if(v1.isMap(q)){if(q.items.length>1)X("Each pair must have its own sequence indicator");let z=q.items[0]||new M9.Pair(new L7.Scalar(null));if(q.commentBefore)z.key.commentBefore=z.key.commentBefore?`${q.commentBefore}
80
- ${z.key.commentBefore}`:q.commentBefore;if(q.comment){let G=z.value??z.key;G.comment=G.comment?`${q.comment}
81
- ${G.comment}`:q.comment}q=z}$.items[Z]=v1.isPair(q)?q:new M9.Pair(q)}else X("Expected a sequence for this tag");return $}function G5($,X,Z){let{replacer:q}=Z,z=new B7.YAMLSeq($);z.tag="tag:yaml.org,2002:pairs";let G=0;if(X&&Symbol.iterator in Object(X))for(let J of X){if(typeof q==="function")J=q.call(X,String(G++),J);let Q,Y;if(Array.isArray(J))if(J.length===2)Q=J[0],Y=J[1];else throw TypeError(`Expected [key, value] tuple: ${J}`);else if(J&&J instanceof Object){let U=Object.keys(J);if(U.length===1)Q=U[0],Y=J[Q];else throw TypeError(`Expected tuple with one key, not ${U.length} keys`)}else Q=J;z.items.push(M9.createPair(Q,Y,Z))}return z}var K7={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:z5,createNode:G5};D7.createPairs=G5;D7.pairs=K7;D7.resolvePairs=z5});var R9=K((R7)=>{var J5=j(),I9=L0(),y$=F0(),M7=O0(),Q5=u1();class C0 extends M7.YAMLSeq{constructor(){super();this.add=y$.YAMLMap.prototype.add.bind(this),this.delete=y$.YAMLMap.prototype.delete.bind(this),this.get=y$.YAMLMap.prototype.get.bind(this),this.has=y$.YAMLMap.prototype.has.bind(this),this.set=y$.YAMLMap.prototype.set.bind(this),this.tag=C0.tag}toJSON($,X){if(!X)return super.toJSON($);let Z=new Map;if(X?.onCreate)X.onCreate(Z);for(let q of this.items){let z,G;if(J5.isPair(q))z=I9.toJS(q.key,"",X),G=I9.toJS(q.value,z,X);else z=I9.toJS(q,"",X);if(Z.has(z))throw Error("Ordered maps must not include duplicate keys");Z.set(z,G)}return Z}static from($,X,Z){let q=Q5.createPairs($,X,Z),z=new this;return z.items=q.items,z}}C0.tag="tag:yaml.org,2002:omap";var I7={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:C0,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,X){let Z=Q5.resolvePairs($,X),q=[];for(let{key:z}of Z.items)if(J5.isScalar(z))if(q.includes(z.value))X(`Ordered maps must not include duplicate keys: ${z.value}`);else q.push(z.value);return Object.assign(new C0,Z)},createNode:($,X,Z)=>C0.from($,X,Z)};R7.YAMLOMap=C0;R7.omap=I7});var V5=K((A7)=>{var Y5=g();function U5({value:$,source:X},Z){if(X&&($?H5:W5).test.test(X))return X;return $?Z.options.trueStr:Z.options.falseStr}var H5={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Y5.Scalar(!0),stringify:U5},W5={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Y5.Scalar(!1),stringify:U5};A7.falseTag=W5;A7.trueTag=H5});var T5=K((x7)=>{var E7=g(),P9=o0(),C7={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:P9.stringifyNumber},b7={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let X=Number($.value);return isFinite(X)?X.toExponential():P9.stringifyNumber($)}},y7={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let X=new E7.Scalar(parseFloat($.replace(/_/g,""))),Z=$.indexOf(".");if(Z!==-1){let q=$.substring(Z+1).replace(/_/g,"");if(q[q.length-1]==="0")X.minFractionDigits=q.length}return X},stringify:P9.stringifyNumber};x7.float=y7;x7.floatExp=b7;x7.floatNaN=C7});var L5=K((d7)=>{var w5=o0(),x$=($)=>typeof $==="bigint"||Number.isInteger($);function m1($,X,Z,{intAsBigInt:q}){let z=$[0];if(z==="-"||z==="+")X+=1;if($=$.substring(X).replace(/_/g,""),q){switch(Z){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let J=BigInt($);return z==="-"?BigInt(-1)*J:J}let G=parseInt($,Z);return z==="-"?-1*G:G}function N9($,X,Z){let{value:q}=$;if(x$(q)){let z=q.toString(X);return q<0?"-"+Z+z.substr(1):Z+z}return w5.stringifyNumber($)}var h7={identify:x$,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,X,Z)=>m1($,2,2,Z),stringify:($)=>N9($,2,"0b")},v7={identify:x$,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,X,Z)=>m1($,1,8,Z),stringify:($)=>N9($,8,"0")},u7={identify:x$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,X,Z)=>m1($,0,10,Z),stringify:w5.stringifyNumber},m7={identify:x$,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,X,Z)=>m1($,2,16,Z),stringify:($)=>N9($,16,"0x")};d7.int=u7;d7.intBin=h7;d7.intHex=m7;d7.intOct=v7});var A9=K((s7)=>{var c1=j(),d1=D0(),p1=F0();class b0 extends p1.YAMLMap{constructor($){super($);this.tag=b0.tag}add($){let X;if(c1.isPair($))X=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)X=new d1.Pair($.key,null);else X=new d1.Pair($,null);if(!p1.findPair(this.items,X.key))this.items.push(X)}get($,X){let Z=p1.findPair(this.items,$);return!X&&c1.isPair(Z)?c1.isScalar(Z.key)?Z.key.value:Z.key:Z}set($,X){if(typeof X!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof X}`);let Z=p1.findPair(this.items,$);if(Z&&!X)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&X)this.items.push(new d1.Pair($))}toJSON($,X){return super.toJSON($,X,Set)}toString($,X,Z){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),X,Z);else throw Error("Set items must all have null values")}static from($,X,Z){let{replacer:q}=Z,z=new this($);if(X&&Symbol.iterator in Object(X))for(let G of X){if(typeof q==="function")G=q.call(X,G,G);z.items.push(d1.createPair(G,null,Z))}return z}}b0.tag="tag:yaml.org,2002:set";var a7={collection:"map",identify:($)=>$ instanceof Set,nodeClass:b0,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,X,Z)=>b0.from($,X,Z),resolve($,X){if(c1.isMap($))if($.hasAllNullValues(!0))return Object.assign(new b0,$);else X("Set items must all have null values");else X("Expected a mapping for this tag");return $}};s7.YAMLSet=b0;s7.set=a7});var j9=K(($G)=>{var o7=o0();function S9($,X){let Z=$[0],q=Z==="-"||Z==="+"?$.substring(1):$,z=(J)=>X?BigInt(J):Number(J),G=q.replace(/_/g,"").split(":").reduce((J,Q)=>J*z(60)+z(Q),z(0));return Z==="-"?z(-1)*G:G}function B5($){let{value:X}=$,Z=(J)=>J;if(typeof X==="bigint")Z=(J)=>BigInt(J);else if(isNaN(X)||!isFinite(X))return o7.stringifyNumber($);let q="";if(X<0)q="-",X*=Z(-1);let z=Z(60),G=[X%z];if(X<60)G.unshift(0);else if(X=(X-G[0])/z,G.unshift(X%z),X>=60)X=(X-G[0])/z,G.unshift(X);return q+G.map((J)=>String(J).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var t7={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,X,{intAsBigInt:Z})=>S9($,Z),stringify:B5},e7={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>S9($,!1),stringify:B5},K5={identify:($)=>$ 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($){let X=$.match(K5.test);if(!X)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,Z,q,z,G,J,Q]=X.map(Number),Y=X[7]?Number((X[7]+"00").substr(1,3)):0,U=Date.UTC(Z,q-1,z,G||0,J||0,Q||0,Y),W=X[8];if(W&&W!=="Z"){let H=S9(W,!1);if(Math.abs(H)<30)H*=60;U-=60000*H}return new Date(U)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};$G.floatTime=e7;$G.intTime=t7;$G.timestamp=K5});var _5=K((wG)=>{var zG=n0(),GG=k1(),JG=r0(),QG=C$(),YG=O9(),D5=V5(),E9=T5(),l1=L5(),UG=S1(),HG=R9(),WG=u1(),VG=A9(),C9=j9(),TG=[zG.map,JG.seq,QG.string,GG.nullTag,D5.trueTag,D5.falseTag,l1.intBin,l1.intOct,l1.int,l1.intHex,E9.floatNaN,E9.floatExp,E9.float,YG.binary,UG.merge,HG.omap,WG.pairs,VG.set,C9.intTime,C9.floatTime,C9.timestamp];wG.schema=TG});var j5=K((IG)=>{var I5=n0(),BG=k1(),R5=r0(),KG=C$(),DG=T9(),b9=L9(),y9=K9(),_G=X5(),FG=q5(),P5=O9(),f$=S1(),N5=R9(),A5=u1(),F5=_5(),S5=A9(),i1=j9(),O5=new Map([["core",_G.schema],["failsafe",[I5.map,R5.seq,KG.string]],["json",FG.schema],["yaml11",F5.schema],["yaml-1.1",F5.schema]]),M5={binary:P5.binary,bool:DG.boolTag,float:b9.float,floatExp:b9.floatExp,floatNaN:b9.floatNaN,floatTime:i1.floatTime,int:y9.int,intHex:y9.intHex,intOct:y9.intOct,intTime:i1.intTime,map:I5.map,merge:f$.merge,null:BG.nullTag,omap:N5.omap,pairs:A5.pairs,seq:R5.seq,set:S5.set,timestamp:i1.timestamp},OG={"tag:yaml.org,2002:binary":P5.binary,"tag:yaml.org,2002:merge":f$.merge,"tag:yaml.org,2002:omap":N5.omap,"tag:yaml.org,2002:pairs":A5.pairs,"tag:yaml.org,2002:set":S5.set,"tag:yaml.org,2002:timestamp":i1.timestamp};function MG($,X,Z){let q=O5.get(X);if(q&&!$)return Z&&!q.includes(f$.merge)?q.concat(f$.merge):q.slice();let z=q;if(!z)if(Array.isArray($))z=[];else{let G=Array.from(O5.keys()).filter((J)=>J!=="yaml11").map((J)=>JSON.stringify(J)).join(", ");throw Error(`Unknown schema "${X}"; use one of ${G} or define customTags array`)}if(Array.isArray($))for(let G of $)z=z.concat(G);else if(typeof $==="function")z=$(z.slice());if(Z)z=z.concat(f$.merge);return z.reduce((G,J)=>{let Q=typeof J==="string"?M5[J]:J;if(!Q){let Y=JSON.stringify(J),U=Object.keys(M5).map((W)=>JSON.stringify(W)).join(", ");throw Error(`Unknown custom tag ${Y}; use one of ${U}`)}if(!G.includes(Q))G.push(Q);return G},[])}IG.coreKnownTags=OG;IG.getTags=MG});var k9=K((EG)=>{var x9=j(),NG=n0(),AG=r0(),SG=C$(),a1=j5(),jG=($,X)=>$.key<X.key?-1:$.key>X.key?1:0;class f9{constructor({compat:$,customTags:X,merge:Z,resolveKnownTags:q,schema:z,sortMapEntries:G,toStringDefaults:J}){this.compat=Array.isArray($)?a1.getTags($,"compat"):$?a1.getTags(null,$):null,this.name=typeof z==="string"&&z||"core",this.knownTags=q?a1.coreKnownTags:{},this.tags=a1.getTags(X,this.name,Z),this.toStringOptions=J??null,Object.defineProperty(this,x9.MAP,{value:NG.map}),Object.defineProperty(this,x9.SCALAR,{value:SG.string}),Object.defineProperty(this,x9.SEQ,{value:AG.seq}),this.sortMapEntries=typeof G==="function"?G:G===!0?jG:null}clone(){let $=Object.create(f9.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}EG.Schema=f9});var E5=K((xG)=>{var bG=j(),g9=A$(),k$=R$();function yG($,X){let Z=[],q=X.directives===!0;if(X.directives!==!1&&$.directives){let Y=$.directives.toString($);if(Y)Z.push(Y),q=!0;else if($.directives.docStart)q=!0}if(q)Z.push("---");let z=g9.createStringifyContext($,X),{commentString:G}=z.options;if($.commentBefore){if(Z.length!==1)Z.unshift("");let Y=G($.commentBefore);Z.unshift(k$.indentComment(Y,""))}let J=!1,Q=null;if($.contents){if(bG.isNode($.contents)){if($.contents.spaceBefore&&q)Z.push("");if($.contents.commentBefore){let W=G($.contents.commentBefore);Z.push(k$.indentComment(W,""))}z.forceBlockIndent=!!$.comment,Q=$.contents.comment}let Y=Q?void 0:()=>J=!0,U=g9.stringify($.contents,z,()=>Q=null,Y);if(Q)U+=k$.lineComment(U,"",G(Q));if((U[0]==="|"||U[0]===">")&&Z[Z.length-1]==="---")Z[Z.length-1]=`--- ${U}`;else Z.push(U)}else Z.push(g9.stringify($.contents,z));if($.directives?.docEnd)if($.comment){let Y=G($.comment);if(Y.includes(`
82
- `))Z.push("..."),Z.push(k$.indentComment(Y,""));else Z.push(`... ${Y}`)}else Z.push("...");else{let Y=$.comment;if(Y&&J)Y=Y.replace(/^\n+/,"");if(Y){if((!J||Q)&&Z[Z.length-1]!=="")Z.push("");Z.push(k$.indentComment(G(Y),""))}}return Z.join(`
73
+ `}}if($){if(B+=`
74
+ `+E1.indentComment(U($),Y),Q)Q()}else if(H&&J)J();return B}function tq({items:$},X,{flowChars:Z,itemIndent:z}){let{indent:q,indentStep:G,flowCollectionPadding:J,options:{commentString:Q}}=X;z+=G;let Y=Object.assign({},X,{indent:z,inFlow:!0,type:null}),U=!1,W=0,H=[];for(let L=0;L<$.length;++L){let T=$[L],K=null;if(C0.isNode(T)){if(T.spaceBefore)H.push("");if(b1(X,H,T.commentBefore,!1),T.comment)K=T.comment}else if(C0.isPair(T)){let F=C0.isNode(T.key)?T.key:null;if(F){if(F.spaceBefore)H.push("");if(b1(X,H,F.commentBefore,!1),F.comment)U=!0}let O=C0.isNode(T.value)?T.value:null;if(O){if(O.comment)K=O.comment;if(O.commentBefore)U=!0}else if(T.value==null&&F?.comment)K=F.comment}if(K)U=!0;let _=c5.stringify(T,Y,()=>K=null);if(L<$.length-1)_+=",";if(K)_+=E1.lineComment(_,z,Q(K));if(!U&&(H.length>W||_.includes(`
75
+ `)))U=!0;H.push(_),W=H.length}let{start:V,end:B}=Z;if(H.length===0)return V+B;else{if(!U){let L=H.reduce((T,K)=>T+K.length+2,2);U=X.options.lineWidth>0&&L>X.options.lineWidth}if(U){let L=V;for(let T of H)L+=T?`
76
+ ${G}${q}${T}`:`
77
+ `;return`${L}
78
+ ${q}${B}`}else return`${V}${J}${H.join(" ")}${J}${B}`}}function b1({indent:$,options:{commentString:X}},Z,z,q){if(z&&q)z=z.replace(/^\n+/,"");if(z){let G=E1.indentComment(X(z),$);Z.push(G.trimStart())}}eq.stringifyCollection=rq});var M0=D((G3)=>{var X3=T4(),Z3=V4(),z3=w1(),F0=S(),x1=_0(),q3=g();function C$($,X){let Z=F0.isScalar(X)?X.value:X;for(let z of $)if(F0.isPair(z)){if(z.key===X||z.key===Z)return z;if(F0.isScalar(z.key)&&z.key.value===Z)return z}return}class i5 extends z3.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(F0.MAP,$);this.items=[]}static from($,X,Z){let{keepUndefined:z,replacer:q}=Z,G=new this($),J=(Q,Y)=>{if(typeof q==="function")Y=q.call(X,Q,Y);else if(Array.isArray(q)&&!q.includes(Q))return;if(Y!==void 0||z)G.items.push(x1.createPair(Q,Y,Z))};if(X instanceof Map)for(let[Q,Y]of X)J(Q,Y);else if(X&&typeof X==="object")for(let Q of Object.keys(X))J(Q,X[Q]);if(typeof $.sortMapEntries==="function")G.items.sort($.sortMapEntries);return G}add($,X){let Z;if(F0.isPair($))Z=$;else if(!$||typeof $!=="object"||!("key"in $))Z=new x1.Pair($,$?.value);else Z=new x1.Pair($.key,$.value);let z=C$(this.items,Z.key),q=this.schema?.sortMapEntries;if(z){if(!X)throw Error(`Key ${Z.key} already set`);if(F0.isScalar(z.value)&&q3.isScalarValue(Z.value))z.value.value=Z.value;else z.value=Z.value}else if(q){let G=this.items.findIndex((J)=>q(Z,J)<0);if(G===-1)this.items.push(Z);else this.items.splice(G,0,Z)}else this.items.push(Z)}delete($){let X=C$(this.items,$);if(!X)return!1;return this.items.splice(this.items.indexOf(X),1).length>0}get($,X){let z=C$(this.items,$)?.value;return(!X&&F0.isScalar(z)?z.value:z)??void 0}has($){return!!C$(this.items,$)}set($,X){this.add(new x1.Pair($,X),!0)}toJSON($,X,Z){let z=Z?new Z:X?.mapAsMap?new Map:{};if(X?.onCreate)X.onCreate(z);for(let q of this.items)Z3.addPairToJSMap(X,z,q);return z}toString($,X,Z){if(!$)return JSON.stringify(this);for(let z of this.items)if(!F0.isPair(z))throw Error(`Map items must all be pairs; found ${JSON.stringify(z)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return X3.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:Z,onComment:X})}}G3.YAMLMap=i5;G3.findPair=C$});var n0=D((H3)=>{var Y3=S(),a5=M0(),U3={collection:"map",default:!0,nodeClass:a5.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,X){if(!Y3.isMap($))X("Expected a mapping for this tag");return $},createNode:($,X,Z)=>a5.YAMLMap.from($,X,Z)};H3.map=U3});var O0=D((D3)=>{var V3=I$(),T3=T4(),B3=w1(),k1=S(),K3=g(),L3=K0();class s5 extends B3.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(k1.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let X=y1($);if(typeof X!=="number")return!1;return this.items.splice(X,1).length>0}get($,X){let Z=y1($);if(typeof Z!=="number")return;let z=this.items[Z];return!X&&k1.isScalar(z)?z.value:z}has($){let X=y1($);return typeof X==="number"&&X<this.items.length}set($,X){let Z=y1($);if(typeof Z!=="number")throw Error(`Expected a valid index, not ${$}.`);let z=this.items[Z];if(k1.isScalar(z)&&K3.isScalarValue(X))z.value=X;else this.items[Z]=X}toJSON($,X){let Z=[];if(X?.onCreate)X.onCreate(Z);let z=0;for(let q of this.items)Z.push(L3.toJS(q,String(z++),X));return Z}toString($,X,Z){if(!$)return JSON.stringify(this);return T3.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:Z,onComment:X})}static from($,X,Z){let{replacer:z}=Z,q=new this($);if(X&&Symbol.iterator in Object(X)){let G=0;for(let J of X){if(typeof z==="function"){let Q=X instanceof Set?J:String(G++);J=z.call(X,Q,J)}q.items.push(V3.createNode(J,void 0,Z))}}return q}}function y1($){let X=k1.isScalar($)?$.value:$;if(X&&typeof X==="string")X=Number(X);return typeof X==="number"&&Number.isInteger(X)&&X>=0?X:null}D3.YAMLSeq=s5});var r0=D((O3)=>{var F3=S(),n5=O0(),M3={collection:"seq",default:!0,nodeClass:n5.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,X){if(!F3.isSeq($))X("Expected a sequence for this tag");return $},createNode:($,X,Z)=>n5.YAMLSeq.from($,X,Z)};O3.seq=M3});var E$=D((P3)=>{var I3=N$(),R3={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,X,Z,z){return X=Object.assign({actualString:!0},X),I3.stringifyString($,X,Z,z)}};P3.string=R3});var f1=D((A3)=>{var r5=g(),o5={identify:($)=>$==null,createNode:()=>new r5.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new r5.Scalar(null),stringify:({source:$},X)=>typeof $==="string"&&o5.test.test($)?$:X.options.nullStr};A3.nullTag=o5});var B4=D((C3)=>{var S3=g(),t5={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new S3.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:X},Z){if($&&t5.test.test($)){let z=$[0]==="t"||$[0]==="T";if(X===z)return $}return X?Z.options.trueStr:Z.options.falseStr}};C3.boolTag=t5});var o0=D((x3)=>{function b3({format:$,minFractionDigits:X,tag:Z,value:z}){if(typeof z==="bigint")return String(z);let q=typeof z==="number"?z:Number(z);if(!isFinite(q))return isNaN(q)?".nan":q<0?"-.inf":".inf";let G=Object.is(z,-0)?"-0":JSON.stringify(z);if(!$&&X&&(!Z||Z==="tag:yaml.org,2002:float")&&/^\d/.test(G)){let J=G.indexOf(".");if(J<0)J=G.length,G+=".";let Q=X-(G.length-J-1);while(Q-- >0)G+="0"}return G}x3.stringifyNumber=b3});var L4=D((v3)=>{var k3=g(),K4=o0(),f3={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:K4.stringifyNumber},g3={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($),stringify($){let X=Number($.value);return isFinite(X)?X.toExponential():K4.stringifyNumber($)}},h3={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let X=new k3.Scalar(parseFloat($)),Z=$.indexOf(".");if(Z!==-1&&$[$.length-1]==="0")X.minFractionDigits=$.length-Z-1;return X},stringify:K4.stringifyNumber};v3.float=h3;v3.floatExp=g3;v3.floatNaN=f3});var _4=D((i3)=>{var e5=o0(),g1=($)=>typeof $==="bigint"||Number.isInteger($),D4=($,X,Z,{intAsBigInt:z})=>z?BigInt($):parseInt($.substring(X),Z);function $X($,X,Z){let{value:z}=$;if(g1(z)&&z>=0)return Z+z.toString(X);return e5.stringifyNumber($)}var p3={identify:($)=>g1($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,X,Z)=>D4($,2,8,Z),stringify:($)=>$X($,8,"0o")},l3={identify:g1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,X,Z)=>D4($,0,10,Z),stringify:e5.stringifyNumber},c3={identify:($)=>g1($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,X,Z)=>D4($,2,16,Z),stringify:($)=>$X($,16,"0x")};i3.int=l3;i3.intHex=c3;i3.intOct=p3});var XX=D((Z7)=>{var r3=n0(),o3=f1(),t3=r0(),e3=E$(),$7=B4(),F4=L4(),M4=_4(),X7=[r3.map,t3.seq,e3.string,o3.nullTag,$7.boolTag,M4.intOct,M4.int,M4.intHex,F4.floatNaN,F4.floatExp,F4.float];Z7.schema=X7});var zX=D((H7)=>{var q7=g(),G7=n0(),J7=r0();function ZX($){return typeof $==="bigint"||Number.isInteger($)}var h1=({value:$})=>JSON.stringify($),Q7=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:h1},{identify:($)=>$==null,createNode:()=>new q7.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:h1},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:h1},{identify:ZX,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,X,{intAsBigInt:Z})=>Z?BigInt($):parseInt($,10),stringify:({value:$})=>ZX($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:h1}],Y7={default:!0,tag:"",test:/^/,resolve($,X){return X(`Unresolved plain scalar ${JSON.stringify($)}`),$}},U7=[G7.map,J7.seq].concat(Q7,Y7);H7.schema=U7});var w4=D((B7)=>{var b$=Q0("buffer"),O4=g(),V7=N$(),T7={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,X){if(typeof b$.Buffer==="function")return b$.Buffer.from($,"base64");else if(typeof atob==="function"){let Z=atob($.replace(/[\n\r]/g,"")),z=new Uint8Array(Z.length);for(let q=0;q<Z.length;++q)z[q]=Z.charCodeAt(q);return z}else return X("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:X,value:Z},z,q,G){if(!Z)return"";let J=Z,Q;if(typeof b$.Buffer==="function")Q=J instanceof b$.Buffer?J.toString("base64"):b$.Buffer.from(J.buffer).toString("base64");else if(typeof btoa==="function"){let Y="";for(let U=0;U<J.length;++U)Y+=String.fromCharCode(J[U]);Q=btoa(Y)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(X??(X=O4.Scalar.BLOCK_LITERAL),X!==O4.Scalar.QUOTE_DOUBLE){let Y=Math.max(z.options.lineWidth-z.indent.length,z.options.minContentWidth),U=Math.ceil(Q.length/Y),W=Array(U);for(let H=0,V=0;H<U;++H,V+=Y)W[H]=Q.substr(V,Y);Q=W.join(X===O4.Scalar.BLOCK_LITERAL?`
79
+ `:" ")}return V7.stringifyString({comment:$,type:X,value:Q},z,q,G)}};B7.binary=T7});var u1=D((F7)=>{var v1=S(),I4=_0(),L7=g(),D7=O0();function qX($,X){if(v1.isSeq($))for(let Z=0;Z<$.items.length;++Z){let z=$.items[Z];if(v1.isPair(z))continue;else if(v1.isMap(z)){if(z.items.length>1)X("Each pair must have its own sequence indicator");let q=z.items[0]||new I4.Pair(new L7.Scalar(null));if(z.commentBefore)q.key.commentBefore=q.key.commentBefore?`${z.commentBefore}
80
+ ${q.key.commentBefore}`:z.commentBefore;if(z.comment){let G=q.value??q.key;G.comment=G.comment?`${z.comment}
81
+ ${G.comment}`:z.comment}z=q}$.items[Z]=v1.isPair(z)?z:new I4.Pair(z)}else X("Expected a sequence for this tag");return $}function GX($,X,Z){let{replacer:z}=Z,q=new D7.YAMLSeq($);q.tag="tag:yaml.org,2002:pairs";let G=0;if(X&&Symbol.iterator in Object(X))for(let J of X){if(typeof z==="function")J=z.call(X,String(G++),J);let Q,Y;if(Array.isArray(J))if(J.length===2)Q=J[0],Y=J[1];else throw TypeError(`Expected [key, value] tuple: ${J}`);else if(J&&J instanceof Object){let U=Object.keys(J);if(U.length===1)Q=U[0],Y=J[Q];else throw TypeError(`Expected tuple with one key, not ${U.length} keys`)}else Q=J;q.items.push(I4.createPair(Q,Y,Z))}return q}var _7={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:qX,createNode:GX};F7.createPairs=GX;F7.pairs=_7;F7.resolvePairs=qX});var P4=D((P7)=>{var JX=S(),R4=K0(),x$=M0(),I7=O0(),QX=u1();class E0 extends I7.YAMLSeq{constructor(){super();this.add=x$.YAMLMap.prototype.add.bind(this),this.delete=x$.YAMLMap.prototype.delete.bind(this),this.get=x$.YAMLMap.prototype.get.bind(this),this.has=x$.YAMLMap.prototype.has.bind(this),this.set=x$.YAMLMap.prototype.set.bind(this),this.tag=E0.tag}toJSON($,X){if(!X)return super.toJSON($);let Z=new Map;if(X?.onCreate)X.onCreate(Z);for(let z of this.items){let q,G;if(JX.isPair(z))q=R4.toJS(z.key,"",X),G=R4.toJS(z.value,q,X);else q=R4.toJS(z,"",X);if(Z.has(q))throw Error("Ordered maps must not include duplicate keys");Z.set(q,G)}return Z}static from($,X,Z){let z=QX.createPairs($,X,Z),q=new this;return q.items=z.items,q}}E0.tag="tag:yaml.org,2002:omap";var R7={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:E0,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,X){let Z=QX.resolvePairs($,X),z=[];for(let{key:q}of Z.items)if(JX.isScalar(q))if(z.includes(q.value))X(`Ordered maps must not include duplicate keys: ${q.value}`);else z.push(q.value);return Object.assign(new E0,Z)},createNode:($,X,Z)=>E0.from($,X,Z)};P7.YAMLOMap=E0;P7.omap=R7});var VX=D((j7)=>{var YX=g();function UX({value:$,source:X},Z){if(X&&($?HX:WX).test.test(X))return X;return $?Z.options.trueStr:Z.options.falseStr}var HX={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new YX.Scalar(!0),stringify:UX},WX={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new YX.Scalar(!1),stringify:UX};j7.falseTag=WX;j7.trueTag=HX});var TX=D((k7)=>{var E7=g(),N4=o0(),b7={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:N4.stringifyNumber},x7={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let X=Number($.value);return isFinite(X)?X.toExponential():N4.stringifyNumber($)}},y7={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let X=new E7.Scalar(parseFloat($.replace(/_/g,""))),Z=$.indexOf(".");if(Z!==-1){let z=$.substring(Z+1).replace(/_/g,"");if(z[z.length-1]==="0")X.minFractionDigits=z.length}return X},stringify:N4.stringifyNumber};k7.float=y7;k7.floatExp=x7;k7.floatNaN=b7});var KX=D((p7)=>{var BX=o0(),y$=($)=>typeof $==="bigint"||Number.isInteger($);function m1($,X,Z,{intAsBigInt:z}){let q=$[0];if(q==="-"||q==="+")X+=1;if($=$.substring(X).replace(/_/g,""),z){switch(Z){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let J=BigInt($);return q==="-"?BigInt(-1)*J:J}let G=parseInt($,Z);return q==="-"?-1*G:G}function A4($,X,Z){let{value:z}=$;if(y$(z)){let q=z.toString(X);return z<0?"-"+Z+q.substr(1):Z+q}return BX.stringifyNumber($)}var v7={identify:y$,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,X,Z)=>m1($,2,2,Z),stringify:($)=>A4($,2,"0b")},u7={identify:y$,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,X,Z)=>m1($,1,8,Z),stringify:($)=>A4($,8,"0")},m7={identify:y$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,X,Z)=>m1($,0,10,Z),stringify:BX.stringifyNumber},d7={identify:y$,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,X,Z)=>m1($,2,16,Z),stringify:($)=>A4($,16,"0x")};p7.int=m7;p7.intBin=v7;p7.intHex=d7;p7.intOct=u7});var j4=D((n7)=>{var l1=S(),d1=_0(),p1=M0();class b0 extends p1.YAMLMap{constructor($){super($);this.tag=b0.tag}add($){let X;if(l1.isPair($))X=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)X=new d1.Pair($.key,null);else X=new d1.Pair($,null);if(!p1.findPair(this.items,X.key))this.items.push(X)}get($,X){let Z=p1.findPair(this.items,$);return!X&&l1.isPair(Z)?l1.isScalar(Z.key)?Z.key.value:Z.key:Z}set($,X){if(typeof X!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof X}`);let Z=p1.findPair(this.items,$);if(Z&&!X)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&X)this.items.push(new d1.Pair($))}toJSON($,X){return super.toJSON($,X,Set)}toString($,X,Z){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),X,Z);else throw Error("Set items must all have null values")}static from($,X,Z){let{replacer:z}=Z,q=new this($);if(X&&Symbol.iterator in Object(X))for(let G of X){if(typeof z==="function")G=z.call(X,G,G);q.items.push(d1.createPair(G,null,Z))}return q}}b0.tag="tag:yaml.org,2002:set";var s7={collection:"map",identify:($)=>$ instanceof Set,nodeClass:b0,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,X,Z)=>b0.from($,X,Z),resolve($,X){if(l1.isMap($))if($.hasAllNullValues(!0))return Object.assign(new b0,$);else X("Set items must all have null values");else X("Expected a mapping for this tag");return $}};n7.YAMLSet=b0;n7.set=s7});var C4=D((XG)=>{var t7=o0();function S4($,X){let Z=$[0],z=Z==="-"||Z==="+"?$.substring(1):$,q=(J)=>X?BigInt(J):Number(J),G=z.replace(/_/g,"").split(":").reduce((J,Q)=>J*q(60)+q(Q),q(0));return Z==="-"?q(-1)*G:G}function LX($){let{value:X}=$,Z=(J)=>J;if(typeof X==="bigint")Z=(J)=>BigInt(J);else if(isNaN(X)||!isFinite(X))return t7.stringifyNumber($);let z="";if(X<0)z="-",X*=Z(-1);let q=Z(60),G=[X%q];if(X<60)G.unshift(0);else if(X=(X-G[0])/q,G.unshift(X%q),X>=60)X=(X-G[0])/q,G.unshift(X);return z+G.map((J)=>String(J).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var e7={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,X,{intAsBigInt:Z})=>S4($,Z),stringify:LX},$G={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>S4($,!1),stringify:LX},DX={identify:($)=>$ 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($){let X=$.match(DX.test);if(!X)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,Z,z,q,G,J,Q]=X.map(Number),Y=X[7]?Number((X[7]+"00").substr(1,3)):0,U=Date.UTC(Z,z-1,q,G||0,J||0,Q||0,Y),W=X[8];if(W&&W!=="Z"){let H=S4(W,!1);if(Math.abs(H)<30)H*=60;U-=60000*H}return new Date(U)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};XG.floatTime=$G;XG.intTime=e7;XG.timestamp=DX});var FX=D((KG)=>{var GG=n0(),JG=f1(),QG=r0(),YG=E$(),UG=w4(),_X=VX(),E4=TX(),c1=KX(),HG=j1(),WG=P4(),VG=u1(),TG=j4(),b4=C4(),BG=[GG.map,QG.seq,YG.string,JG.nullTag,_X.trueTag,_X.falseTag,c1.intBin,c1.intOct,c1.int,c1.intHex,E4.floatNaN,E4.floatExp,E4.float,UG.binary,HG.merge,WG.omap,VG.pairs,TG.set,b4.intTime,b4.floatTime,b4.timestamp];KG.schema=BG});var SX=D((RG)=>{var IX=n0(),DG=f1(),RX=r0(),_G=E$(),FG=B4(),x4=L4(),y4=_4(),MG=XX(),OG=zX(),PX=w4(),k$=j1(),NX=P4(),AX=u1(),MX=FX(),jX=j4(),i1=C4(),OX=new Map([["core",MG.schema],["failsafe",[IX.map,RX.seq,_G.string]],["json",OG.schema],["yaml11",MX.schema],["yaml-1.1",MX.schema]]),wX={binary:PX.binary,bool:FG.boolTag,float:x4.float,floatExp:x4.floatExp,floatNaN:x4.floatNaN,floatTime:i1.floatTime,int:y4.int,intHex:y4.intHex,intOct:y4.intOct,intTime:i1.intTime,map:IX.map,merge:k$.merge,null:DG.nullTag,omap:NX.omap,pairs:AX.pairs,seq:RX.seq,set:jX.set,timestamp:i1.timestamp},wG={"tag:yaml.org,2002:binary":PX.binary,"tag:yaml.org,2002:merge":k$.merge,"tag:yaml.org,2002:omap":NX.omap,"tag:yaml.org,2002:pairs":AX.pairs,"tag:yaml.org,2002:set":jX.set,"tag:yaml.org,2002:timestamp":i1.timestamp};function IG($,X,Z){let z=OX.get(X);if(z&&!$)return Z&&!z.includes(k$.merge)?z.concat(k$.merge):z.slice();let q=z;if(!q)if(Array.isArray($))q=[];else{let G=Array.from(OX.keys()).filter((J)=>J!=="yaml11").map((J)=>JSON.stringify(J)).join(", ");throw Error(`Unknown schema "${X}"; use one of ${G} or define customTags array`)}if(Array.isArray($))for(let G of $)q=q.concat(G);else if(typeof $==="function")q=$(q.slice());if(Z)q=q.concat(k$.merge);return q.reduce((G,J)=>{let Q=typeof J==="string"?wX[J]:J;if(!Q){let Y=JSON.stringify(J),U=Object.keys(wX).map((W)=>JSON.stringify(W)).join(", ");throw Error(`Unknown custom tag ${Y}; use one of ${U}`)}if(!G.includes(Q))G.push(Q);return G},[])}RG.coreKnownTags=wG;RG.getTags=IG});var g4=D((EG)=>{var k4=S(),AG=n0(),jG=r0(),SG=E$(),a1=SX(),CG=($,X)=>$.key<X.key?-1:$.key>X.key?1:0;class f4{constructor({compat:$,customTags:X,merge:Z,resolveKnownTags:z,schema:q,sortMapEntries:G,toStringDefaults:J}){this.compat=Array.isArray($)?a1.getTags($,"compat"):$?a1.getTags(null,$):null,this.name=typeof q==="string"&&q||"core",this.knownTags=z?a1.coreKnownTags:{},this.tags=a1.getTags(X,this.name,Z),this.toStringOptions=J??null,Object.defineProperty(this,k4.MAP,{value:AG.map}),Object.defineProperty(this,k4.SCALAR,{value:SG.string}),Object.defineProperty(this,k4.SEQ,{value:jG.seq}),this.sortMapEntries=typeof G==="function"?G:G===!0?CG:null}clone(){let $=Object.create(f4.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}EG.Schema=f4});var CX=D((kG)=>{var xG=S(),h4=A$(),f$=R$();function yG($,X){let Z=[],z=X.directives===!0;if(X.directives!==!1&&$.directives){let Y=$.directives.toString($);if(Y)Z.push(Y),z=!0;else if($.directives.docStart)z=!0}if(z)Z.push("---");let q=h4.createStringifyContext($,X),{commentString:G}=q.options;if($.commentBefore){if(Z.length!==1)Z.unshift("");let Y=G($.commentBefore);Z.unshift(f$.indentComment(Y,""))}let J=!1,Q=null;if($.contents){if(xG.isNode($.contents)){if($.contents.spaceBefore&&z)Z.push("");if($.contents.commentBefore){let W=G($.contents.commentBefore);Z.push(f$.indentComment(W,""))}q.forceBlockIndent=!!$.comment,Q=$.contents.comment}let Y=Q?void 0:()=>J=!0,U=h4.stringify($.contents,q,()=>Q=null,Y);if(Q)U+=f$.lineComment(U,"",G(Q));if((U[0]==="|"||U[0]===">")&&Z[Z.length-1]==="---")Z[Z.length-1]=`--- ${U}`;else Z.push(U)}else Z.push(h4.stringify($.contents,q));if($.directives?.docEnd)if($.comment){let Y=G($.comment);if(Y.includes(`
82
+ `))Z.push("..."),Z.push(f$.indentComment(Y,""));else Z.push(`... ${Y}`)}else Z.push("...");else{let Y=$.comment;if(Y&&J)Y=Y.replace(/^\n+/,"");if(Y){if((!J||Q)&&Z[Z.length-1]!=="")Z.push("");Z.push(f$.indentComment(G(Y),""))}}return Z.join(`
83
83
  `)+`
84
- `}xG.stringifyDocument=yG});var g$=K((pG)=>{var kG=M$(),t0=M1(),n=j(),gG=D0(),hG=L0(),vG=k9(),uG=E5(),h9=_1(),mG=q9(),dG=I$(),v9=Z9();class u9{constructor($,X,Z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,n.NODE_TYPE,{value:n.DOC});let q=null;if(typeof X==="function"||Array.isArray(X))q=X;else if(Z===void 0&&X)Z=X,X=void 0;let z=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},Z);this.options=z;let{version:G}=z;if(Z?._directives){if(this.directives=Z._directives.atDocument(),this.directives.yaml.explicit)G=this.directives.yaml.version}else this.directives=new v9.Directives({version:G});this.setSchema(G,Z),this.contents=$===void 0?null:this.createNode($,q,Z)}clone(){let $=Object.create(u9.prototype,{[n.NODE_TYPE]:{value:n.DOC}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=n.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(e0(this.contents))this.contents.add($)}addIn($,X){if(e0(this.contents))this.contents.addIn($,X)}createAlias($,X){if(!$.anchor){let Z=h9.anchorNames(this);$.anchor=!X||Z.has(X)?h9.findNewAnchor(X||"a",Z):X}return new kG.Alias($.anchor)}createNode($,X,Z){let q=void 0;if(typeof X==="function")$=X.call({"":$},"",$),q=X;else if(Array.isArray(X)){let T=(D)=>typeof D==="number"||D instanceof String||D instanceof Number,L=X.filter(T).map(String);if(L.length>0)X=X.concat(L);q=X}else if(Z===void 0&&X)Z=X,X=void 0;let{aliasDuplicateObjects:z,anchorPrefix:G,flow:J,keepUndefined:Q,onTagObj:Y,tag:U}=Z??{},{onAnchor:W,setAnchors:H,sourceObjects:V}=h9.createNodeAnchors(this,G||"a"),w={aliasDuplicateObjects:z??!0,keepUndefined:Q??!1,onAnchor:W,onTagObj:Y,replacer:q,schema:this.schema,sourceObjects:V},B=dG.createNode($,U,w);if(J&&n.isCollection(B))B.flow=!0;return H(),B}createPair($,X,Z={}){let q=this.createNode($,null,Z),z=this.createNode(X,null,Z);return new gG.Pair(q,z)}delete($){return e0(this.contents)?this.contents.delete($):!1}deleteIn($){if(t0.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return e0(this.contents)?this.contents.deleteIn($):!1}get($,X){return n.isCollection(this.contents)?this.contents.get($,X):void 0}getIn($,X){if(t0.isEmptyPath($))return!X&&n.isScalar(this.contents)?this.contents.value:this.contents;return n.isCollection(this.contents)?this.contents.getIn($,X):void 0}has($){return n.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(t0.isEmptyPath($))return this.contents!==void 0;return n.isCollection(this.contents)?this.contents.hasIn($):!1}set($,X){if(this.contents==null)this.contents=t0.collectionFromPath(this.schema,[$],X);else if(e0(this.contents))this.contents.set($,X)}setIn($,X){if(t0.isEmptyPath($))this.contents=X;else if(this.contents==null)this.contents=t0.collectionFromPath(this.schema,Array.from($),X);else if(e0(this.contents))this.contents.setIn($,X)}setSchema($,X={}){if(typeof $==="number")$=String($);let Z;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new v9.Directives({version:"1.1"});Z={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new v9.Directives({version:$});Z={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;Z=null;break;default:{let q=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${q}`)}}if(X.schema instanceof Object)this.schema=X.schema;else if(Z)this.schema=new vG.Schema(Object.assign(Z,X));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:X,mapAsMap:Z,maxAliasCount:q,onAnchor:z,reviver:G}={}){let J={anchors:new Map,doc:this,keep:!$,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof q==="number"?q:100},Q=hG.toJS(this.contents,X??"",J);if(typeof z==="function")for(let{count:Y,res:U}of J.anchors.values())z(U,Y);return typeof G==="function"?mG.applyReviver(G,{"":Q},"",Q):Q}toJSON($,X){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:X})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let X=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${X}`)}return uG.stringifyDocument(this,$)}}function e0($){if(n.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}pG.Document=u9});var h$=K((iG)=>{class s1 extends Error{constructor($,X,Z,q){super();this.name=$,this.code=Z,this.message=q,this.pos=X}}class C5 extends s1{constructor($,X,Z){super("YAMLParseError",$,X,Z)}}class b5 extends s1{constructor($,X,Z){super("YAMLWarning",$,X,Z)}}var lG=($,X)=>(Z)=>{if(Z.pos[0]===-1)return;Z.linePos=Z.pos.map((Q)=>X.linePos(Q));let{line:q,col:z}=Z.linePos[0];Z.message+=` at line ${q}, column ${z}`;let G=z-1,J=$.substring(X.lineStarts[q-1],X.lineStarts[q]).replace(/[\n\r]+$/,"");if(G>=60&&J.length>80){let Q=Math.min(G-39,J.length-79);J="\u2026"+J.substring(Q),G-=Q-1}if(J.length>80)J=J.substring(0,79)+"\u2026";if(q>1&&/^ *$/.test(J.substring(0,G))){let Q=$.substring(X.lineStarts[q-2],X.lineStarts[q-1]);if(Q.length>80)Q=Q.substring(0,79)+`\u2026
85
- `;J=Q+J}if(/[^ ]/.test(J)){let Q=1,Y=Z.linePos[1];if(Y?.line===q&&Y.col>z)Q=Math.max(1,Math.min(Y.col-z,80-G));let U=" ".repeat(G)+"^".repeat(Q);Z.message+=`:
84
+ `}kG.stringifyDocument=yG});var g$=D((lG)=>{var gG=w$(),t0=w1(),n=S(),hG=_0(),vG=K0(),uG=g4(),mG=CX(),v4=F1(),dG=q4(),pG=I$(),u4=z4();class m4{constructor($,X,Z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,n.NODE_TYPE,{value:n.DOC});let z=null;if(typeof X==="function"||Array.isArray(X))z=X;else if(Z===void 0&&X)Z=X,X=void 0;let q=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},Z);this.options=q;let{version:G}=q;if(Z?._directives){if(this.directives=Z._directives.atDocument(),this.directives.yaml.explicit)G=this.directives.yaml.version}else this.directives=new u4.Directives({version:G});this.setSchema(G,Z),this.contents=$===void 0?null:this.createNode($,z,Z)}clone(){let $=Object.create(m4.prototype,{[n.NODE_TYPE]:{value:n.DOC}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=n.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(e0(this.contents))this.contents.add($)}addIn($,X){if(e0(this.contents))this.contents.addIn($,X)}createAlias($,X){if(!$.anchor){let Z=v4.anchorNames(this);$.anchor=!X||Z.has(X)?v4.findNewAnchor(X||"a",Z):X}return new gG.Alias($.anchor)}createNode($,X,Z){let z=void 0;if(typeof X==="function")$=X.call({"":$},"",$),z=X;else if(Array.isArray(X)){let T=(_)=>typeof _==="number"||_ instanceof String||_ instanceof Number,K=X.filter(T).map(String);if(K.length>0)X=X.concat(K);z=X}else if(Z===void 0&&X)Z=X,X=void 0;let{aliasDuplicateObjects:q,anchorPrefix:G,flow:J,keepUndefined:Q,onTagObj:Y,tag:U}=Z??{},{onAnchor:W,setAnchors:H,sourceObjects:V}=v4.createNodeAnchors(this,G||"a"),B={aliasDuplicateObjects:q??!0,keepUndefined:Q??!1,onAnchor:W,onTagObj:Y,replacer:z,schema:this.schema,sourceObjects:V},L=pG.createNode($,U,B);if(J&&n.isCollection(L))L.flow=!0;return H(),L}createPair($,X,Z={}){let z=this.createNode($,null,Z),q=this.createNode(X,null,Z);return new hG.Pair(z,q)}delete($){return e0(this.contents)?this.contents.delete($):!1}deleteIn($){if(t0.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return e0(this.contents)?this.contents.deleteIn($):!1}get($,X){return n.isCollection(this.contents)?this.contents.get($,X):void 0}getIn($,X){if(t0.isEmptyPath($))return!X&&n.isScalar(this.contents)?this.contents.value:this.contents;return n.isCollection(this.contents)?this.contents.getIn($,X):void 0}has($){return n.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(t0.isEmptyPath($))return this.contents!==void 0;return n.isCollection(this.contents)?this.contents.hasIn($):!1}set($,X){if(this.contents==null)this.contents=t0.collectionFromPath(this.schema,[$],X);else if(e0(this.contents))this.contents.set($,X)}setIn($,X){if(t0.isEmptyPath($))this.contents=X;else if(this.contents==null)this.contents=t0.collectionFromPath(this.schema,Array.from($),X);else if(e0(this.contents))this.contents.setIn($,X)}setSchema($,X={}){if(typeof $==="number")$=String($);let Z;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new u4.Directives({version:"1.1"});Z={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new u4.Directives({version:$});Z={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;Z=null;break;default:{let z=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${z}`)}}if(X.schema instanceof Object)this.schema=X.schema;else if(Z)this.schema=new uG.Schema(Object.assign(Z,X));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:X,mapAsMap:Z,maxAliasCount:z,onAnchor:q,reviver:G}={}){let J={anchors:new Map,doc:this,keep:!$,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof z==="number"?z:100},Q=vG.toJS(this.contents,X??"",J);if(typeof q==="function")for(let{count:Y,res:U}of J.anchors.values())q(U,Y);return typeof G==="function"?dG.applyReviver(G,{"":Q},"",Q):Q}toJSON($,X){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:X})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let X=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${X}`)}return mG.stringifyDocument(this,$)}}function e0($){if(n.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}lG.Document=m4});var h$=D((aG)=>{class s1 extends Error{constructor($,X,Z,z){super();this.name=$,this.code=Z,this.message=z,this.pos=X}}class EX extends s1{constructor($,X,Z){super("YAMLParseError",$,X,Z)}}class bX extends s1{constructor($,X,Z){super("YAMLWarning",$,X,Z)}}var iG=($,X)=>(Z)=>{if(Z.pos[0]===-1)return;Z.linePos=Z.pos.map((Q)=>X.linePos(Q));let{line:z,col:q}=Z.linePos[0];Z.message+=` at line ${z}, column ${q}`;let G=q-1,J=$.substring(X.lineStarts[z-1],X.lineStarts[z]).replace(/[\n\r]+$/,"");if(G>=60&&J.length>80){let Q=Math.min(G-39,J.length-79);J="\u2026"+J.substring(Q),G-=Q-1}if(J.length>80)J=J.substring(0,79)+"\u2026";if(z>1&&/^ *$/.test(J.substring(0,G))){let Q=$.substring(X.lineStarts[z-2],X.lineStarts[z-1]);if(Q.length>80)Q=Q.substring(0,79)+`\u2026
85
+ `;J=Q+J}if(/[^ ]/.test(J)){let Q=1,Y=Z.linePos[1];if(Y?.line===z&&Y.col>q)Q=Math.max(1,Math.min(Y.col-q,80-G));let U=" ".repeat(G)+"^".repeat(Q);Z.message+=`:
86
86
 
87
87
  ${J}
88
88
  ${U}
89
- `}};iG.YAMLError=s1;iG.YAMLParseError=C5;iG.YAMLWarning=b5;iG.prettifyError=lG});var v$=K((tG)=>{function oG($,{flow:X,indicator:Z,next:q,offset:z,onError:G,parentIndent:J,startOnNewline:Q}){let Y=!1,U=Q,W=Q,H="",V="",w=!1,B=!1,T=null,L=null,D=null,_=null,O=null,I=null,R=null;for(let F of $){if(B){if(F.type!=="space"&&F.type!=="newline"&&F.type!=="comma")G(F.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");B=!1}if(T){if(U&&F.type!=="comment"&&F.type!=="newline")G(T,"TAB_AS_INDENT","Tabs are not allowed as indentation");T=null}switch(F.type){case"space":if(!X&&(Z!=="doc-start"||q?.type!=="flow-collection")&&F.source.includes("\t"))T=F;W=!0;break;case"comment":{if(!W)G(F,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let y=F.source.substring(1)||" ";if(!H)H=y;else H+=V+y;V="",U=!1;break}case"newline":if(U){if(H)H+=F.source;else if(!I||Z!=="seq-item-ind")Y=!0}else V+=F.source;if(U=!0,w=!0,L||D)_=F;W=!0;break;case"anchor":if(L)G(F,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(F.source.endsWith(":"))G(F.offset+F.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);L=F,R??(R=F.offset),U=!1,W=!1,B=!0;break;case"tag":{if(D)G(F,"MULTIPLE_TAGS","A node can have at most one tag");D=F,R??(R=F.offset),U=!1,W=!1,B=!0;break}case Z:if(L||D)G(F,"BAD_PROP_ORDER",`Anchors and tags must be after the ${F.source} indicator`);if(I)G(F,"UNEXPECTED_TOKEN",`Unexpected ${F.source} in ${X??"collection"}`);I=F,U=Z==="seq-item-ind"||Z==="explicit-key-ind",W=!1;break;case"comma":if(X){if(O)G(F,"UNEXPECTED_TOKEN",`Unexpected , in ${X}`);O=F,U=!1,W=!1;break}default:G(F,"UNEXPECTED_TOKEN",`Unexpected ${F.type} token`),U=!1,W=!1}}let N=$[$.length-1],C=N?N.offset+N.source.length:z;if(B&&q&&q.type!=="space"&&q.type!=="newline"&&q.type!=="comma"&&(q.type!=="scalar"||q.source!==""))G(q.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(T&&(U&&T.indent<=J||q?.type==="block-map"||q?.type==="block-seq"))G(T,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:O,found:I,spaceBefore:Y,comment:H,hasNewline:w,anchor:L,tag:D,newlineAfterProp:_,end:C,start:R??C}}tG.resolveProps=oG});var n1=K(($J)=>{function m9($){if(!$)return null;switch($.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if($.source.includes(`
90
- `))return!0;if($.end){for(let X of $.end)if(X.type==="newline")return!0}return!1;case"flow-collection":for(let X of $.items){for(let Z of X.start)if(Z.type==="newline")return!0;if(X.sep){for(let Z of X.sep)if(Z.type==="newline")return!0}if(m9(X.key)||m9(X.value))return!0}return!1;default:return!0}}$J.containsNewline=m9});var d9=K((zJ)=>{var ZJ=n1();function qJ($,X,Z){if(X?.type==="flow-collection"){let q=X.end[0];if(q.indent===$&&(q.source==="]"||q.source==="}")&&ZJ.containsNewline(X))Z(q,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}zJ.flowIndentCheck=qJ});var p9=K((QJ)=>{var y5=j();function JJ($,X,Z){let{uniqueKeys:q}=$.options;if(q===!1)return!1;let z=typeof q==="function"?q:(G,J)=>G===J||y5.isScalar(G)&&y5.isScalar(J)&&G.value===J.value;return X.some((G)=>z(G.key,Z))}QJ.mapIncludes=JJ});var h5=K((TJ)=>{var x5=D0(),UJ=F0(),f5=v$(),HJ=n1(),k5=d9(),WJ=p9(),g5="All mapping items must start at the same column";function VJ({composeNode:$,composeEmptyNode:X},Z,q,z,G){let Q=new(G?.nodeClass??UJ.YAMLMap)(Z.schema);if(Z.atRoot)Z.atRoot=!1;let Y=q.offset,U=null;for(let W of q.items){let{start:H,key:V,sep:w,value:B}=W,T=f5.resolveProps(H,{indicator:"explicit-key-ind",next:V??w?.[0],offset:Y,onError:z,parentIndent:q.indent,startOnNewline:!0}),L=!T.found;if(L){if(V){if(V.type==="block-seq")z(Y,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in V&&V.indent!==q.indent)z(Y,"BAD_INDENT",g5)}if(!T.anchor&&!T.tag&&!w){if(U=T.end,T.comment)if(Q.comment)Q.comment+=`
91
- `+T.comment;else Q.comment=T.comment;continue}if(T.newlineAfterProp||HJ.containsNewline(V))z(V??H[H.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(T.found?.indent!==q.indent)z(Y,"BAD_INDENT",g5);Z.atKey=!0;let D=T.end,_=V?$(Z,V,T,z):X(Z,D,H,null,T,z);if(Z.schema.compat)k5.flowIndentCheck(q.indent,V,z);if(Z.atKey=!1,WJ.mapIncludes(Z,Q.items,_))z(D,"DUPLICATE_KEY","Map keys must be unique");let O=f5.resolveProps(w??[],{indicator:"map-value-ind",next:B,offset:_.range[2],onError:z,parentIndent:q.indent,startOnNewline:!V||V.type==="block-scalar"});if(Y=O.end,O.found){if(L){if(B?.type==="block-map"&&!O.hasNewline)z(Y,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(Z.options.strict&&T.start<O.found.offset-1024)z(_.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let I=B?$(Z,B,O,z):X(Z,Y,w,null,O,z);if(Z.schema.compat)k5.flowIndentCheck(q.indent,B,z);Y=I.range[2];let R=new x5.Pair(_,I);if(Z.options.keepSourceTokens)R.srcToken=W;Q.items.push(R)}else{if(L)z(_.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(O.comment)if(_.comment)_.comment+=`
92
- `+O.comment;else _.comment=O.comment;let I=new x5.Pair(_);if(Z.options.keepSourceTokens)I.srcToken=W;Q.items.push(I)}}if(U&&U<Y)z(U,"IMPOSSIBLE","Map comment with trailing content");return Q.range=[q.offset,Y,U??Y],Q}TJ.resolveBlockMap=VJ});var v5=K((_J)=>{var LJ=O0(),BJ=v$(),KJ=d9();function DJ({composeNode:$,composeEmptyNode:X},Z,q,z,G){let Q=new(G?.nodeClass??LJ.YAMLSeq)(Z.schema);if(Z.atRoot)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let Y=q.offset,U=null;for(let{start:W,value:H}of q.items){let V=BJ.resolveProps(W,{indicator:"seq-item-ind",next:H,offset:Y,onError:z,parentIndent:q.indent,startOnNewline:!0});if(!V.found)if(V.anchor||V.tag||H)if(H?.type==="block-seq")z(V.end,"BAD_INDENT","All sequence items must start at the same column");else z(Y,"MISSING_CHAR","Sequence item without - indicator");else{if(U=V.end,V.comment)Q.comment=V.comment;continue}let w=H?$(Z,H,V,z):X(Z,V.end,W,null,V,z);if(Z.schema.compat)KJ.flowIndentCheck(q.indent,H,z);Y=w.range[2],Q.items.push(w)}return Q.range=[q.offset,Y,U??Y],Q}_J.resolveBlockSeq=DJ});var $$=K((MJ)=>{function OJ($,X,Z,q){let z="";if($){let G=!1,J="";for(let Q of $){let{source:Y,type:U}=Q;switch(U){case"space":G=!0;break;case"comment":{if(Z&&!G)q(Q,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let W=Y.substring(1)||" ";if(!z)z=W;else z+=J+W;J="";break}case"newline":if(z)J+=Y;G=!0;break;default:q(Q,"UNEXPECTED_TOKEN",`Unexpected ${U} at node end`)}X+=Y.length}}return{comment:z,offset:X}}MJ.resolveEnd=OJ});var d5=K((CJ)=>{var RJ=j(),PJ=D0(),u5=F0(),NJ=O0(),AJ=$$(),m5=v$(),SJ=n1(),jJ=p9(),c9="Block collections are not allowed within flow collections",l9=($)=>$&&($.type==="block-map"||$.type==="block-seq");function EJ({composeNode:$,composeEmptyNode:X},Z,q,z,G){let J=q.start.source==="{",Q=J?"flow map":"flow sequence",U=new(G?.nodeClass??(J?u5.YAMLMap:NJ.YAMLSeq))(Z.schema);U.flow=!0;let W=Z.atRoot;if(W)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let H=q.offset+q.start.source.length;for(let L=0;L<q.items.length;++L){let D=q.items[L],{start:_,key:O,sep:I,value:R}=D,N=m5.resolveProps(_,{flow:Q,indicator:"explicit-key-ind",next:O??I?.[0],offset:H,onError:z,parentIndent:q.indent,startOnNewline:!1});if(!N.found){if(!N.anchor&&!N.tag&&!I&&!R){if(L===0&&N.comma)z(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${Q}`);else if(L<q.items.length-1)z(N.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${Q}`);if(N.comment)if(U.comment)U.comment+=`
93
- `+N.comment;else U.comment=N.comment;H=N.end;continue}if(!J&&Z.options.strict&&SJ.containsNewline(O))z(O,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(L===0){if(N.comma)z(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${Q}`)}else{if(!N.comma)z(N.start,"MISSING_CHAR",`Missing , between ${Q} items`);if(N.comment){let C="";$:for(let F of _)switch(F.type){case"comma":case"space":break;case"comment":C=F.source.substring(1);break $;default:break $}if(C){let F=U.items[U.items.length-1];if(RJ.isPair(F))F=F.value??F.key;if(F.comment)F.comment+=`
94
- `+C;else F.comment=C;N.comment=N.comment.substring(C.length+1)}}}if(!J&&!I&&!N.found){let C=R?$(Z,R,N,z):X(Z,N.end,I,null,N,z);if(U.items.push(C),H=C.range[2],l9(R))z(C.range,"BLOCK_IN_FLOW",c9)}else{Z.atKey=!0;let C=N.end,F=O?$(Z,O,N,z):X(Z,C,_,null,N,z);if(l9(O))z(F.range,"BLOCK_IN_FLOW",c9);Z.atKey=!1;let y=m5.resolveProps(I??[],{flow:Q,indicator:"map-value-ind",next:R,offset:F.range[2],onError:z,parentIndent:q.indent,startOnNewline:!1});if(y.found){if(!J&&!N.found&&Z.options.strict){if(I)for(let k of I){if(k===y.found)break;if(k.type==="newline"){z(k,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(N.start<y.found.offset-1024)z(y.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]===":")z(R,"MISSING_CHAR",`Missing space after : in ${Q}`);else z(y.start,"MISSING_CHAR",`Missing , or : between ${Q} items`);let a=R?$(Z,R,y,z):y.found?X(Z,y.end,I,null,y,z):null;if(a){if(l9(R))z(a.range,"BLOCK_IN_FLOW",c9)}else if(y.comment)if(F.comment)F.comment+=`
95
- `+y.comment;else F.comment=y.comment;let q0=new PJ.Pair(F,a);if(Z.options.keepSourceTokens)q0.srcToken=D;if(J){let k=U;if(jJ.mapIncludes(Z,k.items,F))z(C,"DUPLICATE_KEY","Map keys must be unique");k.items.push(q0)}else{let k=new u5.YAMLMap(Z.schema);k.flow=!0,k.items.push(q0);let V1=(a??F).range;k.range=[F.range[0],V1[1],V1[2]],U.items.push(k)}H=a?a.range[2]:y.end}}let V=J?"}":"]",[w,...B]=q.end,T=H;if(w?.source===V)T=w.offset+w.source.length;else{let L=Q[0].toUpperCase()+Q.substring(1),D=W?`${L} must end with a ${V}`:`${L} in block collection must be sufficiently indented and end with a ${V}`;if(z(H,W?"MISSING_CHAR":"BAD_INDENT",D),w&&w.source.length!==1)B.unshift(w)}if(B.length>0){let L=AJ.resolveEnd(B,T,Z.options.strict,z);if(L.comment)if(U.comment)U.comment+=`
96
- `+L.comment;else U.comment=L.comment;U.range=[q.offset,T,L.offset]}else U.range=[q.offset,T,T];return U}CJ.resolveFlowCollection=EJ});var p5=K((mJ)=>{var yJ=j(),xJ=g(),fJ=F0(),kJ=O0(),gJ=h5(),hJ=v5(),vJ=d5();function i9($,X,Z,q,z,G){let J=Z.type==="block-map"?gJ.resolveBlockMap($,X,Z,q,G):Z.type==="block-seq"?hJ.resolveBlockSeq($,X,Z,q,G):vJ.resolveFlowCollection($,X,Z,q,G),Q=J.constructor;if(z==="!"||z===Q.tagName)return J.tag=Q.tagName,J;if(z)J.tag=z;return J}function uJ($,X,Z,q,z){let G=q.tag,J=!G?null:X.directives.tagName(G.source,(V)=>z(G,"TAG_RESOLVE_FAILED",V));if(Z.type==="block-seq"){let{anchor:V,newlineAfterProp:w}=q,B=V&&G?V.offset>G.offset?V:G:V??G;if(B&&(!w||w.offset<B.offset))z(B,"MISSING_CHAR","Missing newline after block sequence props")}let Q=Z.type==="block-map"?"map":Z.type==="block-seq"?"seq":Z.start.source==="{"?"map":"seq";if(!G||!J||J==="!"||J===fJ.YAMLMap.tagName&&Q==="map"||J===kJ.YAMLSeq.tagName&&Q==="seq")return i9($,X,Z,z,J);let Y=X.schema.tags.find((V)=>V.tag===J&&V.collection===Q);if(!Y){let V=X.schema.knownTags[J];if(V?.collection===Q)X.schema.tags.push(Object.assign({},V,{default:!1})),Y=V;else{if(V)z(G,"BAD_COLLECTION_TYPE",`${V.tag} used for ${Q} collection, but expects ${V.collection??"scalar"}`,!0);else z(G,"TAG_RESOLVE_FAILED",`Unresolved tag: ${J}`,!0);return i9($,X,Z,z,J)}}let U=i9($,X,Z,z,J,Y),W=Y.resolve?.(U,(V)=>z(G,"TAG_RESOLVE_FAILED",V),X.options)??U,H=yJ.isNode(W)?W:new xJ.Scalar(W);if(H.range=U.range,H.tag=J,Y?.format)H.format=Y.format;return H}mJ.composeCollection=uJ});var s9=K((iJ)=>{var a9=g();function pJ($,X,Z){let q=X.offset,z=cJ(X,$.options.strict,Z);if(!z)return{value:"",type:null,comment:"",range:[q,q,q]};let G=z.mode===">"?a9.Scalar.BLOCK_FOLDED:a9.Scalar.BLOCK_LITERAL,J=X.source?lJ(X.source):[],Q=J.length;for(let T=J.length-1;T>=0;--T){let L=J[T][1];if(L===""||L==="\r")Q=T;else break}if(Q===0){let T=z.chomp==="+"&&J.length>0?`
97
- `.repeat(Math.max(1,J.length-1)):"",L=q+z.length;if(X.source)L+=X.source.length;return{value:T,type:G,comment:z.comment,range:[q,L,L]}}let Y=X.indent+z.indent,U=X.offset+z.length,W=0;for(let T=0;T<Q;++T){let[L,D]=J[T];if(D===""||D==="\r"){if(z.indent===0&&L.length>Y)Y=L.length}else{if(L.length<Y)Z(U+L.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(z.indent===0)Y=L.length;if(W=T,Y===0&&!$.atRoot)Z(U,"BAD_INDENT","Block scalar values in collections must be indented");break}U+=L.length+D.length+1}for(let T=J.length-1;T>=Q;--T)if(J[T][0].length>Y)Q=T+1;let H="",V="",w=!1;for(let T=0;T<W;++T)H+=J[T][0].slice(Y)+`
98
- `;for(let T=W;T<Q;++T){let[L,D]=J[T];U+=L.length+D.length+1;let _=D[D.length-1]==="\r";if(_)D=D.slice(0,-1);if(D&&L.length<Y){let I=`Block scalar lines must not be less indented than their ${z.indent?"explicit indentation indicator":"first line"}`;Z(U-D.length-(_?2:1),"BAD_INDENT",I),L=""}if(G===a9.Scalar.BLOCK_LITERAL)H+=V+L.slice(Y)+D,V=`
99
- `;else if(L.length>Y||D[0]==="\t"){if(V===" ")V=`
100
- `;else if(!w&&V===`
89
+ `}};aG.YAMLError=s1;aG.YAMLParseError=EX;aG.YAMLWarning=bX;aG.prettifyError=iG});var v$=D((eG)=>{function tG($,{flow:X,indicator:Z,next:z,offset:q,onError:G,parentIndent:J,startOnNewline:Q}){let Y=!1,U=Q,W=Q,H="",V="",B=!1,L=!1,T=null,K=null,_=null,F=null,O=null,I=null,R=null;for(let M of $){if(L){if(M.type!=="space"&&M.type!=="newline"&&M.type!=="comma")G(M.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");L=!1}if(T){if(U&&M.type!=="comment"&&M.type!=="newline")G(T,"TAB_AS_INDENT","Tabs are not allowed as indentation");T=null}switch(M.type){case"space":if(!X&&(Z!=="doc-start"||z?.type!=="flow-collection")&&M.source.includes("\t"))T=M;W=!0;break;case"comment":{if(!W)G(M,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let x=M.source.substring(1)||" ";if(!H)H=x;else H+=V+x;V="",U=!1;break}case"newline":if(U){if(H)H+=M.source;else if(!I||Z!=="seq-item-ind")Y=!0}else V+=M.source;if(U=!0,B=!0,K||_)F=M;W=!0;break;case"anchor":if(K)G(M,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(M.source.endsWith(":"))G(M.offset+M.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);K=M,R??(R=M.offset),U=!1,W=!1,L=!0;break;case"tag":{if(_)G(M,"MULTIPLE_TAGS","A node can have at most one tag");_=M,R??(R=M.offset),U=!1,W=!1,L=!0;break}case Z:if(K||_)G(M,"BAD_PROP_ORDER",`Anchors and tags must be after the ${M.source} indicator`);if(I)G(M,"UNEXPECTED_TOKEN",`Unexpected ${M.source} in ${X??"collection"}`);I=M,U=Z==="seq-item-ind"||Z==="explicit-key-ind",W=!1;break;case"comma":if(X){if(O)G(M,"UNEXPECTED_TOKEN",`Unexpected , in ${X}`);O=M,U=!1,W=!1;break}default:G(M,"UNEXPECTED_TOKEN",`Unexpected ${M.type} token`),U=!1,W=!1}}let N=$[$.length-1],E=N?N.offset+N.source.length:q;if(L&&z&&z.type!=="space"&&z.type!=="newline"&&z.type!=="comma"&&(z.type!=="scalar"||z.source!==""))G(z.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(T&&(U&&T.indent<=J||z?.type==="block-map"||z?.type==="block-seq"))G(T,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:O,found:I,spaceBefore:Y,comment:H,hasNewline:B,anchor:K,tag:_,newlineAfterProp:F,end:E,start:R??E}}eG.resolveProps=tG});var n1=D((XJ)=>{function d4($){if(!$)return null;switch($.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if($.source.includes(`
90
+ `))return!0;if($.end){for(let X of $.end)if(X.type==="newline")return!0}return!1;case"flow-collection":for(let X of $.items){for(let Z of X.start)if(Z.type==="newline")return!0;if(X.sep){for(let Z of X.sep)if(Z.type==="newline")return!0}if(d4(X.key)||d4(X.value))return!0}return!1;default:return!0}}XJ.containsNewline=d4});var p4=D((GJ)=>{var zJ=n1();function qJ($,X,Z){if(X?.type==="flow-collection"){let z=X.end[0];if(z.indent===$&&(z.source==="]"||z.source==="}")&&zJ.containsNewline(X))Z(z,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}GJ.flowIndentCheck=qJ});var l4=D((YJ)=>{var xX=S();function QJ($,X,Z){let{uniqueKeys:z}=$.options;if(z===!1)return!1;let q=typeof z==="function"?z:(G,J)=>G===J||xX.isScalar(G)&&xX.isScalar(J)&&G.value===J.value;return X.some((G)=>q(G.key,Z))}YJ.mapIncludes=QJ});var hX=D((BJ)=>{var yX=_0(),HJ=M0(),kX=v$(),WJ=n1(),fX=p4(),VJ=l4(),gX="All mapping items must start at the same column";function TJ({composeNode:$,composeEmptyNode:X},Z,z,q,G){let Q=new(G?.nodeClass??HJ.YAMLMap)(Z.schema);if(Z.atRoot)Z.atRoot=!1;let Y=z.offset,U=null;for(let W of z.items){let{start:H,key:V,sep:B,value:L}=W,T=kX.resolveProps(H,{indicator:"explicit-key-ind",next:V??B?.[0],offset:Y,onError:q,parentIndent:z.indent,startOnNewline:!0}),K=!T.found;if(K){if(V){if(V.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 V&&V.indent!==z.indent)q(Y,"BAD_INDENT",gX)}if(!T.anchor&&!T.tag&&!B){if(U=T.end,T.comment)if(Q.comment)Q.comment+=`
91
+ `+T.comment;else Q.comment=T.comment;continue}if(T.newlineAfterProp||WJ.containsNewline(V))q(V??H[H.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(T.found?.indent!==z.indent)q(Y,"BAD_INDENT",gX);Z.atKey=!0;let _=T.end,F=V?$(Z,V,T,q):X(Z,_,H,null,T,q);if(Z.schema.compat)fX.flowIndentCheck(z.indent,V,q);if(Z.atKey=!1,VJ.mapIncludes(Z,Q.items,F))q(_,"DUPLICATE_KEY","Map keys must be unique");let O=kX.resolveProps(B??[],{indicator:"map-value-ind",next:L,offset:F.range[2],onError:q,parentIndent:z.indent,startOnNewline:!V||V.type==="block-scalar"});if(Y=O.end,O.found){if(K){if(L?.type==="block-map"&&!O.hasNewline)q(Y,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(Z.options.strict&&T.start<O.found.offset-1024)q(F.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let I=L?$(Z,L,O,q):X(Z,Y,B,null,O,q);if(Z.schema.compat)fX.flowIndentCheck(z.indent,L,q);Y=I.range[2];let R=new yX.Pair(F,I);if(Z.options.keepSourceTokens)R.srcToken=W;Q.items.push(R)}else{if(K)q(F.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(O.comment)if(F.comment)F.comment+=`
92
+ `+O.comment;else F.comment=O.comment;let I=new yX.Pair(F);if(Z.options.keepSourceTokens)I.srcToken=W;Q.items.push(I)}}if(U&&U<Y)q(U,"IMPOSSIBLE","Map comment with trailing content");return Q.range=[z.offset,Y,U??Y],Q}BJ.resolveBlockMap=TJ});var vX=D((MJ)=>{var LJ=O0(),DJ=v$(),_J=p4();function FJ({composeNode:$,composeEmptyNode:X},Z,z,q,G){let Q=new(G?.nodeClass??LJ.YAMLSeq)(Z.schema);if(Z.atRoot)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let Y=z.offset,U=null;for(let{start:W,value:H}of z.items){let V=DJ.resolveProps(W,{indicator:"seq-item-ind",next:H,offset:Y,onError:q,parentIndent:z.indent,startOnNewline:!0});if(!V.found)if(V.anchor||V.tag||H)if(H?.type==="block-seq")q(V.end,"BAD_INDENT","All sequence items must start at the same column");else q(Y,"MISSING_CHAR","Sequence item without - indicator");else{if(U=V.end,V.comment)Q.comment=V.comment;continue}let B=H?$(Z,H,V,q):X(Z,V.end,W,null,V,q);if(Z.schema.compat)_J.flowIndentCheck(z.indent,H,q);Y=B.range[2],Q.items.push(B)}return Q.range=[z.offset,Y,U??Y],Q}MJ.resolveBlockSeq=FJ});var $$=D((IJ)=>{function wJ($,X,Z,z){let q="";if($){let G=!1,J="";for(let Q of $){let{source:Y,type:U}=Q;switch(U){case"space":G=!0;break;case"comment":{if(Z&&!G)z(Q,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let W=Y.substring(1)||" ";if(!q)q=W;else q+=J+W;J="";break}case"newline":if(q)J+=Y;G=!0;break;default:z(Q,"UNEXPECTED_TOKEN",`Unexpected ${U} at node end`)}X+=Y.length}}return{comment:q,offset:X}}IJ.resolveEnd=wJ});var dX=D((bJ)=>{var PJ=S(),NJ=_0(),uX=M0(),AJ=O0(),jJ=$$(),mX=v$(),SJ=n1(),CJ=l4(),c4="Block collections are not allowed within flow collections",i4=($)=>$&&($.type==="block-map"||$.type==="block-seq");function EJ({composeNode:$,composeEmptyNode:X},Z,z,q,G){let J=z.start.source==="{",Q=J?"flow map":"flow sequence",U=new(G?.nodeClass??(J?uX.YAMLMap:AJ.YAMLSeq))(Z.schema);U.flow=!0;let W=Z.atRoot;if(W)Z.atRoot=!1;if(Z.atKey)Z.atKey=!1;let H=z.offset+z.start.source.length;for(let K=0;K<z.items.length;++K){let _=z.items[K],{start:F,key:O,sep:I,value:R}=_,N=mX.resolveProps(F,{flow:Q,indicator:"explicit-key-ind",next:O??I?.[0],offset:H,onError:q,parentIndent:z.indent,startOnNewline:!1});if(!N.found){if(!N.anchor&&!N.tag&&!I&&!R){if(K===0&&N.comma)q(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${Q}`);else if(K<z.items.length-1)q(N.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${Q}`);if(N.comment)if(U.comment)U.comment+=`
93
+ `+N.comment;else U.comment=N.comment;H=N.end;continue}if(!J&&Z.options.strict&&SJ.containsNewline(O))q(O,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(K===0){if(N.comma)q(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${Q}`)}else{if(!N.comma)q(N.start,"MISSING_CHAR",`Missing , between ${Q} items`);if(N.comment){let E="";$:for(let M of F)switch(M.type){case"comma":case"space":break;case"comment":E=M.source.substring(1);break $;default:break $}if(E){let M=U.items[U.items.length-1];if(PJ.isPair(M))M=M.value??M.key;if(M.comment)M.comment+=`
94
+ `+E;else M.comment=E;N.comment=N.comment.substring(E.length+1)}}}if(!J&&!I&&!N.found){let E=R?$(Z,R,N,q):X(Z,N.end,I,null,N,q);if(U.items.push(E),H=E.range[2],i4(R))q(E.range,"BLOCK_IN_FLOW",c4)}else{Z.atKey=!0;let E=N.end,M=O?$(Z,O,N,q):X(Z,E,F,null,N,q);if(i4(O))q(M.range,"BLOCK_IN_FLOW",c4);Z.atKey=!1;let x=mX.resolveProps(I??[],{flow:Q,indicator:"map-value-ind",next:R,offset:M.range[2],onError:q,parentIndent:z.indent,startOnNewline:!1});if(x.found){if(!J&&!N.found&&Z.options.strict){if(I)for(let f of I){if(f===x.found)break;if(f.type==="newline"){q(f,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(N.start<x.found.offset-1024)q(x.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 ${Q}`);else q(x.start,"MISSING_CHAR",`Missing , or : between ${Q} items`);let a=R?$(Z,R,x,q):x.found?X(Z,x.end,I,null,x,q):null;if(a){if(i4(R))q(a.range,"BLOCK_IN_FLOW",c4)}else if(x.comment)if(M.comment)M.comment+=`
95
+ `+x.comment;else M.comment=x.comment;let z0=new NJ.Pair(M,a);if(Z.options.keepSourceTokens)z0.srcToken=_;if(J){let f=U;if(CJ.mapIncludes(Z,f.items,M))q(E,"DUPLICATE_KEY","Map keys must be unique");f.items.push(z0)}else{let f=new uX.YAMLMap(Z.schema);f.flow=!0,f.items.push(z0);let V1=(a??M).range;f.range=[M.range[0],V1[1],V1[2]],U.items.push(f)}H=a?a.range[2]:x.end}}let V=J?"}":"]",[B,...L]=z.end,T=H;if(B?.source===V)T=B.offset+B.source.length;else{let K=Q[0].toUpperCase()+Q.substring(1),_=W?`${K} must end with a ${V}`:`${K} in block collection must be sufficiently indented and end with a ${V}`;if(q(H,W?"MISSING_CHAR":"BAD_INDENT",_),B&&B.source.length!==1)L.unshift(B)}if(L.length>0){let K=jJ.resolveEnd(L,T,Z.options.strict,q);if(K.comment)if(U.comment)U.comment+=`
96
+ `+K.comment;else U.comment=K.comment;U.range=[z.offset,T,K.offset]}else U.range=[z.offset,T,T];return U}bJ.resolveFlowCollection=EJ});var pX=D((dJ)=>{var yJ=S(),kJ=g(),fJ=M0(),gJ=O0(),hJ=hX(),vJ=vX(),uJ=dX();function a4($,X,Z,z,q,G){let J=Z.type==="block-map"?hJ.resolveBlockMap($,X,Z,z,G):Z.type==="block-seq"?vJ.resolveBlockSeq($,X,Z,z,G):uJ.resolveFlowCollection($,X,Z,z,G),Q=J.constructor;if(q==="!"||q===Q.tagName)return J.tag=Q.tagName,J;if(q)J.tag=q;return J}function mJ($,X,Z,z,q){let G=z.tag,J=!G?null:X.directives.tagName(G.source,(V)=>q(G,"TAG_RESOLVE_FAILED",V));if(Z.type==="block-seq"){let{anchor:V,newlineAfterProp:B}=z,L=V&&G?V.offset>G.offset?V:G:V??G;if(L&&(!B||B.offset<L.offset))q(L,"MISSING_CHAR","Missing newline after block sequence props")}let Q=Z.type==="block-map"?"map":Z.type==="block-seq"?"seq":Z.start.source==="{"?"map":"seq";if(!G||!J||J==="!"||J===fJ.YAMLMap.tagName&&Q==="map"||J===gJ.YAMLSeq.tagName&&Q==="seq")return a4($,X,Z,q,J);let Y=X.schema.tags.find((V)=>V.tag===J&&V.collection===Q);if(!Y){let V=X.schema.knownTags[J];if(V?.collection===Q)X.schema.tags.push(Object.assign({},V,{default:!1})),Y=V;else{if(V)q(G,"BAD_COLLECTION_TYPE",`${V.tag} used for ${Q} collection, but expects ${V.collection??"scalar"}`,!0);else q(G,"TAG_RESOLVE_FAILED",`Unresolved tag: ${J}`,!0);return a4($,X,Z,q,J)}}let U=a4($,X,Z,q,J,Y),W=Y.resolve?.(U,(V)=>q(G,"TAG_RESOLVE_FAILED",V),X.options)??U,H=yJ.isNode(W)?W:new kJ.Scalar(W);if(H.range=U.range,H.tag=J,Y?.format)H.format=Y.format;return H}dJ.composeCollection=mJ});var n4=D((aJ)=>{var s4=g();function lJ($,X,Z){let z=X.offset,q=cJ(X,$.options.strict,Z);if(!q)return{value:"",type:null,comment:"",range:[z,z,z]};let G=q.mode===">"?s4.Scalar.BLOCK_FOLDED:s4.Scalar.BLOCK_LITERAL,J=X.source?iJ(X.source):[],Q=J.length;for(let T=J.length-1;T>=0;--T){let K=J[T][1];if(K===""||K==="\r")Q=T;else break}if(Q===0){let T=q.chomp==="+"&&J.length>0?`
97
+ `.repeat(Math.max(1,J.length-1)):"",K=z+q.length;if(X.source)K+=X.source.length;return{value:T,type:G,comment:q.comment,range:[z,K,K]}}let Y=X.indent+q.indent,U=X.offset+q.length,W=0;for(let T=0;T<Q;++T){let[K,_]=J[T];if(_===""||_==="\r"){if(q.indent===0&&K.length>Y)Y=K.length}else{if(K.length<Y)Z(U+K.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(q.indent===0)Y=K.length;if(W=T,Y===0&&!$.atRoot)Z(U,"BAD_INDENT","Block scalar values in collections must be indented");break}U+=K.length+_.length+1}for(let T=J.length-1;T>=Q;--T)if(J[T][0].length>Y)Q=T+1;let H="",V="",B=!1;for(let T=0;T<W;++T)H+=J[T][0].slice(Y)+`
98
+ `;for(let T=W;T<Q;++T){let[K,_]=J[T];U+=K.length+_.length+1;let F=_[_.length-1]==="\r";if(F)_=_.slice(0,-1);if(_&&K.length<Y){let I=`Block scalar lines must not be less indented than their ${q.indent?"explicit indentation indicator":"first line"}`;Z(U-_.length-(F?2:1),"BAD_INDENT",I),K=""}if(G===s4.Scalar.BLOCK_LITERAL)H+=V+K.slice(Y)+_,V=`
99
+ `;else if(K.length>Y||_[0]==="\t"){if(V===" ")V=`
100
+ `;else if(!B&&V===`
101
101
  `)V=`
102
102
 
103
- `;H+=V+L.slice(Y)+D,V=`
104
- `,w=!0}else if(D==="")if(V===`
103
+ `;H+=V+K.slice(Y)+_,V=`
104
+ `,B=!0}else if(_==="")if(V===`
105
105
  `)H+=`
106
106
  `;else V=`
107
- `;else H+=V+D,V=" ",w=!1}switch(z.chomp){case"-":break;case"+":for(let T=Q;T<J.length;++T)H+=`
107
+ `;else H+=V+_,V=" ",B=!1}switch(q.chomp){case"-":break;case"+":for(let T=Q;T<J.length;++T)H+=`
108
108
  `+J[T][0].slice(Y);if(H[H.length-1]!==`
109
109
  `)H+=`
110
110
  `;break;default:H+=`
111
- `}let B=q+z.length+X.source.length;return{value:H,type:G,comment:z.comment,range:[q,B,B]}}function cJ({offset:$,props:X},Z,q){if(X[0].type!=="block-scalar-header")return q(X[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:z}=X[0],G=z[0],J=0,Q="",Y=-1;for(let V=1;V<z.length;++V){let w=z[V];if(!Q&&(w==="-"||w==="+"))Q=w;else{let B=Number(w);if(!J&&B)J=B;else if(Y===-1)Y=$+V}}if(Y!==-1)q(Y,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${z}`);let U=!1,W="",H=z.length;for(let V=1;V<X.length;++V){let w=X[V];switch(w.type){case"space":U=!0;case"newline":H+=w.source.length;break;case"comment":if(Z&&!U)q(w,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");H+=w.source.length,W=w.source.substring(1);break;case"error":q(w,"UNEXPECTED_TOKEN",w.message),H+=w.source.length;break;default:{let B=`Unexpected token in block scalar header: ${w.type}`;q(w,"UNEXPECTED_TOKEN",B);let T=w.source;if(T&&typeof T==="string")H+=T.length}}}return{mode:G,indent:J,chomp:Q,comment:W,length:H}}function lJ($){let X=$.split(/\n( *)/),Z=X[0],q=Z.match(/^( *)/),G=[q?.[1]?[q[1],Z.slice(q[1].length)]:["",Z]];for(let J=1;J<X.length;J+=2)G.push([X[J],X[J+1]]);return G}iJ.resolveBlockScalar=pJ});var r9=K((ZQ)=>{var n9=g(),sJ=$$();function nJ($,X,Z){let{offset:q,type:z,source:G,end:J}=$,Q,Y,U=(V,w,B)=>Z(q+V,w,B);switch(z){case"scalar":Q=n9.Scalar.PLAIN,Y=rJ(G,U);break;case"single-quoted-scalar":Q=n9.Scalar.QUOTE_SINGLE,Y=oJ(G,U);break;case"double-quoted-scalar":Q=n9.Scalar.QUOTE_DOUBLE,Y=tJ(G,U);break;default:return Z($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${z}`),{value:"",type:null,comment:"",range:[q,q+G.length,q+G.length]}}let W=q+G.length,H=sJ.resolveEnd(J,W,X,Z);return{value:Y,type:Q,comment:H.comment,range:[q,W,H.offset]}}function rJ($,X){let Z="";switch($[0]){case"\t":Z="a tab character";break;case",":Z="flow indicator character ,";break;case"%":Z="directive indicator character %";break;case"|":case">":{Z=`block scalar indicator ${$[0]}`;break}case"@":case"`":{Z=`reserved character ${$[0]}`;break}}if(Z)X(0,"BAD_SCALAR_START",`Plain value cannot start with ${Z}`);return c5($)}function oJ($,X){if($[$.length-1]!=="'"||$.length===1)X($.length,"MISSING_CHAR","Missing closing 'quote");return c5($.slice(1,-1)).replace(/''/g,"'")}function c5($){let X,Z;try{X=new RegExp(`(.*?)(?<![ ])[ ]*\r?
111
+ `}let L=z+q.length+X.source.length;return{value:H,type:G,comment:q.comment,range:[z,L,L]}}function cJ({offset:$,props:X},Z,z){if(X[0].type!=="block-scalar-header")return z(X[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:q}=X[0],G=q[0],J=0,Q="",Y=-1;for(let V=1;V<q.length;++V){let B=q[V];if(!Q&&(B==="-"||B==="+"))Q=B;else{let L=Number(B);if(!J&&L)J=L;else if(Y===-1)Y=$+V}}if(Y!==-1)z(Y,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${q}`);let U=!1,W="",H=q.length;for(let V=1;V<X.length;++V){let B=X[V];switch(B.type){case"space":U=!0;case"newline":H+=B.source.length;break;case"comment":if(Z&&!U)z(B,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");H+=B.source.length,W=B.source.substring(1);break;case"error":z(B,"UNEXPECTED_TOKEN",B.message),H+=B.source.length;break;default:{let L=`Unexpected token in block scalar header: ${B.type}`;z(B,"UNEXPECTED_TOKEN",L);let T=B.source;if(T&&typeof T==="string")H+=T.length}}}return{mode:G,indent:J,chomp:Q,comment:W,length:H}}function iJ($){let X=$.split(/\n( *)/),Z=X[0],z=Z.match(/^( *)/),G=[z?.[1]?[z[1],Z.slice(z[1].length)]:["",Z]];for(let J=1;J<X.length;J+=2)G.push([X[J],X[J+1]]);return G}aJ.resolveBlockScalar=lJ});var o4=D((zQ)=>{var r4=g(),nJ=$$();function rJ($,X,Z){let{offset:z,type:q,source:G,end:J}=$,Q,Y,U=(V,B,L)=>Z(z+V,B,L);switch(q){case"scalar":Q=r4.Scalar.PLAIN,Y=oJ(G,U);break;case"single-quoted-scalar":Q=r4.Scalar.QUOTE_SINGLE,Y=tJ(G,U);break;case"double-quoted-scalar":Q=r4.Scalar.QUOTE_DOUBLE,Y=eJ(G,U);break;default:return Z($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${q}`),{value:"",type:null,comment:"",range:[z,z+G.length,z+G.length]}}let W=z+G.length,H=nJ.resolveEnd(J,W,X,Z);return{value:Y,type:Q,comment:H.comment,range:[z,W,H.offset]}}function oJ($,X){let Z="";switch($[0]){case"\t":Z="a tab character";break;case",":Z="flow indicator character ,";break;case"%":Z="directive indicator character %";break;case"|":case">":{Z=`block scalar indicator ${$[0]}`;break}case"@":case"`":{Z=`reserved character ${$[0]}`;break}}if(Z)X(0,"BAD_SCALAR_START",`Plain value cannot start with ${Z}`);return lX($)}function tJ($,X){if($[$.length-1]!=="'"||$.length===1)X($.length,"MISSING_CHAR","Missing closing 'quote");return lX($.slice(1,-1)).replace(/''/g,"'")}function lX($){let X,Z;try{X=new RegExp(`(.*?)(?<![ ])[ ]*\r?
112
112
  `,"sy"),Z=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
113
- `,"sy")}catch{X=/(.*?)[ \t]*\r?\n/sy,Z=/[ \t]*(.*?)[ \t]*\r?\n/sy}let q=X.exec($);if(!q)return $;let z=q[1],G=" ",J=X.lastIndex;Z.lastIndex=J;while(q=Z.exec($)){if(q[1]==="")if(G===`
114
- `)z+=G;else G=`
115
- `;else z+=G+q[1],G=" ";J=Z.lastIndex}let Q=/[ \t]*(.*)/sy;return Q.lastIndex=J,q=Q.exec($),z+G+(q?.[1]??"")}function tJ($,X){let Z="";for(let q=1;q<$.length-1;++q){let z=$[q];if(z==="\r"&&$[q+1]===`
116
- `)continue;if(z===`
117
- `){let{fold:G,offset:J}=eJ($,q);Z+=G,q=J}else if(z==="\\"){let G=$[++q],J=$Q[G];if(J)Z+=J;else if(G===`
118
- `){G=$[q+1];while(G===" "||G==="\t")G=$[++q+1]}else if(G==="\r"&&$[q+1]===`
119
- `){G=$[++q+1];while(G===" "||G==="\t")G=$[++q+1]}else if(G==="x"||G==="u"||G==="U"){let Q={x:2,u:4,U:8}[G];Z+=XQ($,q+1,Q,X),q+=Q}else{let Q=$.substr(q-1,2);X(q-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${Q}`),Z+=Q}}else if(z===" "||z==="\t"){let G=q,J=$[q+1];while(J===" "||J==="\t")J=$[++q+1];if(J!==`
120
- `&&!(J==="\r"&&$[q+2]===`
121
- `))Z+=q>G?$.slice(G,q+1):z}else Z+=z}if($[$.length-1]!=='"'||$.length===1)X($.length,"MISSING_CHAR",'Missing closing "quote');return Z}function eJ($,X){let Z="",q=$[X+1];while(q===" "||q==="\t"||q===`
122
- `||q==="\r"){if(q==="\r"&&$[X+2]!==`
123
- `)break;if(q===`
113
+ `,"sy")}catch{X=/(.*?)[ \t]*\r?\n/sy,Z=/[ \t]*(.*?)[ \t]*\r?\n/sy}let z=X.exec($);if(!z)return $;let q=z[1],G=" ",J=X.lastIndex;Z.lastIndex=J;while(z=Z.exec($)){if(z[1]==="")if(G===`
114
+ `)q+=G;else G=`
115
+ `;else q+=G+z[1],G=" ";J=Z.lastIndex}let Q=/[ \t]*(.*)/sy;return Q.lastIndex=J,z=Q.exec($),q+G+(z?.[1]??"")}function eJ($,X){let Z="";for(let z=1;z<$.length-1;++z){let q=$[z];if(q==="\r"&&$[z+1]===`
116
+ `)continue;if(q===`
117
+ `){let{fold:G,offset:J}=$Q($,z);Z+=G,z=J}else if(q==="\\"){let G=$[++z],J=XQ[G];if(J)Z+=J;else if(G===`
118
+ `){G=$[z+1];while(G===" "||G==="\t")G=$[++z+1]}else if(G==="\r"&&$[z+1]===`
119
+ `){G=$[++z+1];while(G===" "||G==="\t")G=$[++z+1]}else if(G==="x"||G==="u"||G==="U"){let Q={x:2,u:4,U:8}[G];Z+=ZQ($,z+1,Q,X),z+=Q}else{let Q=$.substr(z-1,2);X(z-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${Q}`),Z+=Q}}else if(q===" "||q==="\t"){let G=z,J=$[z+1];while(J===" "||J==="\t")J=$[++z+1];if(J!==`
120
+ `&&!(J==="\r"&&$[z+2]===`
121
+ `))Z+=z>G?$.slice(G,z+1):q}else Z+=q}if($[$.length-1]!=='"'||$.length===1)X($.length,"MISSING_CHAR",'Missing closing "quote');return Z}function $Q($,X){let Z="",z=$[X+1];while(z===" "||z==="\t"||z===`
122
+ `||z==="\r"){if(z==="\r"&&$[X+2]!==`
123
+ `)break;if(z===`
124
124
  `)Z+=`
125
- `;X+=1,q=$[X+1]}if(!Z)Z=" ";return{fold:Z,offset:X}}var $Q={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
126
- `,r:"\r",t:"\t",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function XQ($,X,Z,q){let z=$.substr(X,Z),J=z.length===Z&&/^[0-9a-fA-F]+$/.test(z)?parseInt(z,16):NaN;if(isNaN(J)){let Q=$.substr(X-2,Z+2);return q(X-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${Q}`),Q}return String.fromCodePoint(J)}ZQ.resolveFlowScalar=nJ});var i5=K((UQ)=>{var y0=j(),l5=g(),zQ=s9(),GQ=r9();function JQ($,X,Z,q){let{value:z,type:G,comment:J,range:Q}=X.type==="block-scalar"?zQ.resolveBlockScalar($,X,q):GQ.resolveFlowScalar(X,$.options.strict,q),Y=Z?$.directives.tagName(Z.source,(H)=>q(Z,"TAG_RESOLVE_FAILED",H)):null,U;if($.options.stringKeys&&$.atKey)U=$.schema[y0.SCALAR];else if(Y)U=QQ($.schema,z,Y,Z,q);else if(X.type==="scalar")U=YQ($,z,X,q);else U=$.schema[y0.SCALAR];let W;try{let H=U.resolve(z,(V)=>q(Z??X,"TAG_RESOLVE_FAILED",V),$.options);W=y0.isScalar(H)?H:new l5.Scalar(H)}catch(H){let V=H instanceof Error?H.message:String(H);q(Z??X,"TAG_RESOLVE_FAILED",V),W=new l5.Scalar(z)}if(W.range=Q,W.source=z,G)W.type=G;if(Y)W.tag=Y;if(U.format)W.format=U.format;if(J)W.comment=J;return W}function QQ($,X,Z,q,z){if(Z==="!")return $[y0.SCALAR];let G=[];for(let Q of $.tags)if(!Q.collection&&Q.tag===Z)if(Q.default&&Q.test)G.push(Q);else return Q;for(let Q of G)if(Q.test?.test(X))return Q;let J=$.knownTags[Z];if(J&&!J.collection)return $.tags.push(Object.assign({},J,{default:!1,test:void 0})),J;return z(q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Z}`,Z!=="tag:yaml.org,2002:str"),$[y0.SCALAR]}function YQ({atKey:$,directives:X,schema:Z},q,z,G){let J=Z.tags.find((Q)=>(Q.default===!0||$&&Q.default==="key")&&Q.test?.test(q))||Z[y0.SCALAR];if(Z.compat){let Q=Z.compat.find((Y)=>Y.default&&Y.test?.test(q))??Z[y0.SCALAR];if(J.tag!==Q.tag){let Y=X.tagString(J.tag),U=X.tagString(Q.tag),W=`Value may be parsed as either ${Y} or ${U}`;G(z,"TAG_RESOLVE_FAILED",W,!0)}}return J}UQ.composeScalar=JQ});var a5=K((VQ)=>{function WQ($,X,Z){if(X){Z??(Z=X.length);for(let q=Z-1;q>=0;--q){let z=X[q];switch(z.type){case"space":case"comment":case"newline":$-=z.source.length;continue}z=X[++q];while(z?.type==="space")$+=z.source.length,z=X[++q];break}}return $}VQ.emptyScalarPosition=WQ});var r5=K((OQ)=>{var wQ=M$(),LQ=j(),BQ=p5(),s5=i5(),KQ=$$(),DQ=a5(),_Q={composeNode:n5,composeEmptyNode:o9};function n5($,X,Z,q){let z=$.atKey,{spaceBefore:G,comment:J,anchor:Q,tag:Y}=Z,U,W=!0;switch(X.type){case"alias":if(U=FQ($,X,q),Q||Y)q(X,"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(U=s5.composeScalar($,X,Y,q),Q)U.anchor=Q.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":if(U=BQ.composeCollection(_Q,$,X,Z,q),Q)U.anchor=Q.source.substring(1);break;default:{let H=X.type==="error"?X.message:`Unsupported token (type: ${X.type})`;q(X,"UNEXPECTED_TOKEN",H),U=o9($,X.offset,void 0,null,Z,q),W=!1}}if(Q&&U.anchor==="")q(Q,"BAD_ALIAS","Anchor cannot be an empty string");if(z&&$.options.stringKeys&&(!LQ.isScalar(U)||typeof U.value!=="string"||U.tag&&U.tag!=="tag:yaml.org,2002:str"))q(Y??X,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(G)U.spaceBefore=!0;if(J)if(X.type==="scalar"&&X.source==="")U.comment=J;else U.commentBefore=J;if($.options.keepSourceTokens&&W)U.srcToken=X;return U}function o9($,X,Z,q,{spaceBefore:z,comment:G,anchor:J,tag:Q,end:Y},U){let W={type:"scalar",offset:DQ.emptyScalarPosition(X,Z,q),indent:-1,source:""},H=s5.composeScalar($,W,Q,U);if(J){if(H.anchor=J.source.substring(1),H.anchor==="")U(J,"BAD_ALIAS","Anchor cannot be an empty string")}if(z)H.spaceBefore=!0;if(G)H.comment=G,H.range[2]=Y;return H}function FQ({options:$},{offset:X,source:Z,end:q},z){let G=new wQ.Alias(Z.substring(1));if(G.source==="")z(X,"BAD_ALIAS","Alias cannot be an empty string");if(G.source.endsWith(":"))z(X+Z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let J=X+Z.length,Q=KQ.resolveEnd(q,J,$.strict,z);if(G.range=[X,J,Q.offset],Q.comment)G.comment=Q.comment;return G}OQ.composeEmptyNode=o9;OQ.composeNode=n5});var t5=K((SQ)=>{var RQ=g$(),o5=r5(),PQ=$$(),NQ=v$();function AQ($,X,{offset:Z,start:q,value:z,end:G},J){let Q=Object.assign({_directives:X},$),Y=new RQ.Document(void 0,Q),U={atKey:!1,atRoot:!0,directives:Y.directives,options:Y.options,schema:Y.schema},W=NQ.resolveProps(q,{indicator:"doc-start",next:z??G?.[0],offset:Z,onError:J,parentIndent:0,startOnNewline:!0});if(W.found){if(Y.directives.docStart=!0,z&&(z.type==="block-map"||z.type==="block-seq")&&!W.hasNewline)J(W.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}Y.contents=z?o5.composeNode(U,z,W,J):o5.composeEmptyNode(U,W.end,q,null,W,J);let H=Y.contents.range[2],V=PQ.resolveEnd(G,H,!1,J);if(V.comment)Y.comment=V.comment;return Y.range=[Z,H,V.offset],Y}SQ.composeDoc=AQ});var t9=K((fQ)=>{var EQ=Q0("process"),CQ=Z9(),bQ=g$(),u$=h$(),e5=j(),yQ=t5(),xQ=$$();function m$($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:X,source:Z}=$;return[X,X+(typeof Z==="string"?Z.length:1)]}function $8($){let X="",Z=!1,q=!1;for(let z=0;z<$.length;++z){let G=$[z];switch(G[0]){case"#":X+=(X===""?"":q?`
125
+ `;X+=1,z=$[X+1]}if(!Z)Z=" ";return{fold:Z,offset:X}}var XQ={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
126
+ `,r:"\r",t:"\t",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function ZQ($,X,Z,z){let q=$.substr(X,Z),J=q.length===Z&&/^[0-9a-fA-F]+$/.test(q)?parseInt(q,16):NaN;if(isNaN(J)){let Q=$.substr(X-2,Z+2);return z(X-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${Q}`),Q}return String.fromCodePoint(J)}zQ.resolveFlowScalar=rJ});var iX=D((HQ)=>{var x0=S(),cX=g(),GQ=n4(),JQ=o4();function QQ($,X,Z,z){let{value:q,type:G,comment:J,range:Q}=X.type==="block-scalar"?GQ.resolveBlockScalar($,X,z):JQ.resolveFlowScalar(X,$.options.strict,z),Y=Z?$.directives.tagName(Z.source,(H)=>z(Z,"TAG_RESOLVE_FAILED",H)):null,U;if($.options.stringKeys&&$.atKey)U=$.schema[x0.SCALAR];else if(Y)U=YQ($.schema,q,Y,Z,z);else if(X.type==="scalar")U=UQ($,q,X,z);else U=$.schema[x0.SCALAR];let W;try{let H=U.resolve(q,(V)=>z(Z??X,"TAG_RESOLVE_FAILED",V),$.options);W=x0.isScalar(H)?H:new cX.Scalar(H)}catch(H){let V=H instanceof Error?H.message:String(H);z(Z??X,"TAG_RESOLVE_FAILED",V),W=new cX.Scalar(q)}if(W.range=Q,W.source=q,G)W.type=G;if(Y)W.tag=Y;if(U.format)W.format=U.format;if(J)W.comment=J;return W}function YQ($,X,Z,z,q){if(Z==="!")return $[x0.SCALAR];let G=[];for(let Q of $.tags)if(!Q.collection&&Q.tag===Z)if(Q.default&&Q.test)G.push(Q);else return Q;for(let Q of G)if(Q.test?.test(X))return Q;let J=$.knownTags[Z];if(J&&!J.collection)return $.tags.push(Object.assign({},J,{default:!1,test:void 0})),J;return q(z,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Z}`,Z!=="tag:yaml.org,2002:str"),$[x0.SCALAR]}function UQ({atKey:$,directives:X,schema:Z},z,q,G){let J=Z.tags.find((Q)=>(Q.default===!0||$&&Q.default==="key")&&Q.test?.test(z))||Z[x0.SCALAR];if(Z.compat){let Q=Z.compat.find((Y)=>Y.default&&Y.test?.test(z))??Z[x0.SCALAR];if(J.tag!==Q.tag){let Y=X.tagString(J.tag),U=X.tagString(Q.tag),W=`Value may be parsed as either ${Y} or ${U}`;G(q,"TAG_RESOLVE_FAILED",W,!0)}}return J}HQ.composeScalar=QQ});var aX=D((TQ)=>{function VQ($,X,Z){if(X){Z??(Z=X.length);for(let z=Z-1;z>=0;--z){let q=X[z];switch(q.type){case"space":case"comment":case"newline":$-=q.source.length;continue}q=X[++z];while(q?.type==="space")$+=q.source.length,q=X[++z];break}}return $}TQ.emptyScalarPosition=VQ});var rX=D((wQ)=>{var KQ=w$(),LQ=S(),DQ=pX(),sX=iX(),_Q=$$(),FQ=aX(),MQ={composeNode:nX,composeEmptyNode:t4};function nX($,X,Z,z){let q=$.atKey,{spaceBefore:G,comment:J,anchor:Q,tag:Y}=Z,U,W=!0;switch(X.type){case"alias":if(U=OQ($,X,z),Q||Y)z(X,"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(U=sX.composeScalar($,X,Y,z),Q)U.anchor=Q.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":if(U=DQ.composeCollection(MQ,$,X,Z,z),Q)U.anchor=Q.source.substring(1);break;default:{let H=X.type==="error"?X.message:`Unsupported token (type: ${X.type})`;z(X,"UNEXPECTED_TOKEN",H),U=t4($,X.offset,void 0,null,Z,z),W=!1}}if(Q&&U.anchor==="")z(Q,"BAD_ALIAS","Anchor cannot be an empty string");if(q&&$.options.stringKeys&&(!LQ.isScalar(U)||typeof U.value!=="string"||U.tag&&U.tag!=="tag:yaml.org,2002:str"))z(Y??X,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(G)U.spaceBefore=!0;if(J)if(X.type==="scalar"&&X.source==="")U.comment=J;else U.commentBefore=J;if($.options.keepSourceTokens&&W)U.srcToken=X;return U}function t4($,X,Z,z,{spaceBefore:q,comment:G,anchor:J,tag:Q,end:Y},U){let W={type:"scalar",offset:FQ.emptyScalarPosition(X,Z,z),indent:-1,source:""},H=sX.composeScalar($,W,Q,U);if(J){if(H.anchor=J.source.substring(1),H.anchor==="")U(J,"BAD_ALIAS","Anchor cannot be an empty string")}if(q)H.spaceBefore=!0;if(G)H.comment=G,H.range[2]=Y;return H}function OQ({options:$},{offset:X,source:Z,end:z},q){let G=new KQ.Alias(Z.substring(1));if(G.source==="")q(X,"BAD_ALIAS","Alias cannot be an empty string");if(G.source.endsWith(":"))q(X+Z.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let J=X+Z.length,Q=_Q.resolveEnd(z,J,$.strict,q);if(G.range=[X,J,Q.offset],Q.comment)G.comment=Q.comment;return G}wQ.composeEmptyNode=t4;wQ.composeNode=nX});var tX=D((SQ)=>{var PQ=g$(),oX=rX(),NQ=$$(),AQ=v$();function jQ($,X,{offset:Z,start:z,value:q,end:G},J){let Q=Object.assign({_directives:X},$),Y=new PQ.Document(void 0,Q),U={atKey:!1,atRoot:!0,directives:Y.directives,options:Y.options,schema:Y.schema},W=AQ.resolveProps(z,{indicator:"doc-start",next:q??G?.[0],offset:Z,onError:J,parentIndent:0,startOnNewline:!0});if(W.found){if(Y.directives.docStart=!0,q&&(q.type==="block-map"||q.type==="block-seq")&&!W.hasNewline)J(W.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}Y.contents=q?oX.composeNode(U,q,W,J):oX.composeEmptyNode(U,W.end,z,null,W,J);let H=Y.contents.range[2],V=NQ.resolveEnd(G,H,!1,J);if(V.comment)Y.comment=V.comment;return Y.range=[Z,H,V.offset],Y}SQ.composeDoc=jQ});var e4=D((fQ)=>{var EQ=Q0("process"),bQ=z4(),xQ=g$(),u$=h$(),eX=S(),yQ=tX(),kQ=$$();function m$($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:X,source:Z}=$;return[X,X+(typeof Z==="string"?Z.length:1)]}function $6($){let X="",Z=!1,z=!1;for(let q=0;q<$.length;++q){let G=$[q];switch(G[0]){case"#":X+=(X===""?"":z?`
127
127
 
128
128
  `:`
129
- `)+(G.substring(1)||" "),Z=!0,q=!1;break;case"%":if($[z+1]?.[0]!=="#")z+=1;Z=!1;break;default:if(!Z)q=!0;Z=!1}}return{comment:X,afterEmptyLine:q}}class X8{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(X,Z,q,z)=>{let G=m$(X);if(z)this.warnings.push(new u$.YAMLWarning(G,Z,q));else this.errors.push(new u$.YAMLParseError(G,Z,q))},this.directives=new CQ.Directives({version:$.version||"1.2"}),this.options=$}decorate($,X){let{comment:Z,afterEmptyLine:q}=$8(this.prelude);if(Z){let z=$.contents;if(X)$.comment=$.comment?`${$.comment}
130
- ${Z}`:Z;else if(q||$.directives.docStart||!z)$.commentBefore=Z;else if(e5.isCollection(z)&&!z.flow&&z.items.length>0){let G=z.items[0];if(e5.isPair(G))G=G.key;let J=G.commentBefore;G.commentBefore=J?`${Z}
131
- ${J}`:Z}else{let G=z.commentBefore;z.commentBefore=G?`${Z}
132
- ${G}`:Z}}if(X)Array.prototype.push.apply($.errors,this.errors),Array.prototype.push.apply($.warnings,this.warnings);else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:$8(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,X=!1,Z=-1){for(let q of $)yield*this.next(q);yield*this.end(X,Z)}*next($){if(EQ.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(X,Z,q)=>{let z=m$($);z[0]+=X,this.onError(z,"BAD_DIRECTIVE",Z,q)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let X=yQ.composeDoc(this.options,this.directives,$,this.onError);if(this.atDirectives&&!X.directives.docStart)this.onError($,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(X,!1),this.doc)yield this.doc;this.doc=X,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push($.source);break;case"error":{let X=$.source?`${$.message}: ${JSON.stringify($.source)}`:$.message,Z=new u$.YAMLParseError(m$($),"UNEXPECTED_TOKEN",X);if(this.atDirectives||!this.doc)this.errors.push(Z);else this.doc.errors.push(Z);break}case"doc-end":{if(!this.doc){this.errors.push(new u$.YAMLParseError(m$($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let X=xQ.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),X.comment){let Z=this.doc.comment;this.doc.comment=Z?`${Z}
133
- ${X.comment}`:X.comment}this.doc.range[2]=X.offset;break}default:this.errors.push(new u$.YAMLParseError(m$($),"UNEXPECTED_TOKEN",`Unsupported token ${$.type}`))}}*end($=!1,X=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if($){let Z=Object.assign({_directives:this.directives},this.options),q=new bQ.Document(void 0,Z);if(this.atDirectives)this.onError(X,"MISSING_CHAR","Missing directives-end indicator line");q.range=[0,X,X],this.decorate(q,!1),yield q}}}fQ.Composer=X8});var z8=K((cQ)=>{var gQ=s9(),hQ=r9(),vQ=h$(),Z8=N$();function uQ($,X=!0,Z){if($){let q=(z,G,J)=>{let Q=typeof z==="number"?z:Array.isArray(z)?z[0]:z.offset;if(Z)Z(Q,G,J);else throw new vQ.YAMLParseError([Q,Q+1],G,J)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return hQ.resolveFlowScalar($,X,q);case"block-scalar":return gQ.resolveBlockScalar({options:{strict:X}},$,q)}}return null}function mQ($,X){let{implicitKey:Z=!1,indent:q,inFlow:z=!1,offset:G=-1,type:J="PLAIN"}=X,Q=Z8.stringifyString({type:J,value:$},{implicitKey:Z,indent:q>0?" ".repeat(q):"",inFlow:z,options:{blockQuote:!0,lineWidth:-1}}),Y=X.end??[{type:"newline",offset:-1,indent:q,source:`
129
+ `)+(G.substring(1)||" "),Z=!0,z=!1;break;case"%":if($[q+1]?.[0]!=="#")q+=1;Z=!1;break;default:if(!Z)z=!0;Z=!1}}return{comment:X,afterEmptyLine:z}}class X6{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(X,Z,z,q)=>{let G=m$(X);if(q)this.warnings.push(new u$.YAMLWarning(G,Z,z));else this.errors.push(new u$.YAMLParseError(G,Z,z))},this.directives=new bQ.Directives({version:$.version||"1.2"}),this.options=$}decorate($,X){let{comment:Z,afterEmptyLine:z}=$6(this.prelude);if(Z){let q=$.contents;if(X)$.comment=$.comment?`${$.comment}
130
+ ${Z}`:Z;else if(z||$.directives.docStart||!q)$.commentBefore=Z;else if(eX.isCollection(q)&&!q.flow&&q.items.length>0){let G=q.items[0];if(eX.isPair(G))G=G.key;let J=G.commentBefore;G.commentBefore=J?`${Z}
131
+ ${J}`:Z}else{let G=q.commentBefore;q.commentBefore=G?`${Z}
132
+ ${G}`:Z}}if(X)Array.prototype.push.apply($.errors,this.errors),Array.prototype.push.apply($.warnings,this.warnings);else $.errors=this.errors,$.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:$6(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,X=!1,Z=-1){for(let z of $)yield*this.next(z);yield*this.end(X,Z)}*next($){if(EQ.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(X,Z,z)=>{let q=m$($);q[0]+=X,this.onError(q,"BAD_DIRECTIVE",Z,z)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let X=yQ.composeDoc(this.options,this.directives,$,this.onError);if(this.atDirectives&&!X.directives.docStart)this.onError($,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(X,!1),this.doc)yield this.doc;this.doc=X,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push($.source);break;case"error":{let X=$.source?`${$.message}: ${JSON.stringify($.source)}`:$.message,Z=new u$.YAMLParseError(m$($),"UNEXPECTED_TOKEN",X);if(this.atDirectives||!this.doc)this.errors.push(Z);else this.doc.errors.push(Z);break}case"doc-end":{if(!this.doc){this.errors.push(new u$.YAMLParseError(m$($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let X=kQ.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),X.comment){let Z=this.doc.comment;this.doc.comment=Z?`${Z}
133
+ ${X.comment}`:X.comment}this.doc.range[2]=X.offset;break}default:this.errors.push(new u$.YAMLParseError(m$($),"UNEXPECTED_TOKEN",`Unsupported token ${$.type}`))}}*end($=!1,X=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if($){let Z=Object.assign({_directives:this.directives},this.options),z=new xQ.Document(void 0,Z);if(this.atDirectives)this.onError(X,"MISSING_CHAR","Missing directives-end indicator line");z.range=[0,X,X],this.decorate(z,!1),yield z}}}fQ.Composer=X6});var q6=D((cQ)=>{var hQ=n4(),vQ=o4(),uQ=h$(),Z6=N$();function mQ($,X=!0,Z){if($){let z=(q,G,J)=>{let Q=typeof q==="number"?q:Array.isArray(q)?q[0]:q.offset;if(Z)Z(Q,G,J);else throw new uQ.YAMLParseError([Q,Q+1],G,J)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return vQ.resolveFlowScalar($,X,z);case"block-scalar":return hQ.resolveBlockScalar({options:{strict:X}},$,z)}}return null}function dQ($,X){let{implicitKey:Z=!1,indent:z,inFlow:q=!1,offset:G=-1,type:J="PLAIN"}=X,Q=Z6.stringifyString({type:J,value:$},{implicitKey:Z,indent:z>0?" ".repeat(z):"",inFlow:q,options:{blockQuote:!0,lineWidth:-1}}),Y=X.end??[{type:"newline",offset:-1,indent:z,source:`
134
134
  `}];switch(Q[0]){case"|":case">":{let U=Q.indexOf(`
135
135
  `),W=Q.substring(0,U),H=Q.substring(U+1)+`
136
- `,V=[{type:"block-scalar-header",offset:G,indent:q,source:W}];if(!q8(V,Y))V.push({type:"newline",offset:-1,indent:q,source:`
137
- `});return{type:"block-scalar",offset:G,indent:q,props:V,source:H}}case'"':return{type:"double-quoted-scalar",offset:G,indent:q,source:Q,end:Y};case"'":return{type:"single-quoted-scalar",offset:G,indent:q,source:Q,end:Y};default:return{type:"scalar",offset:G,indent:q,source:Q,end:Y}}}function dQ($,X,Z={}){let{afterKey:q=!1,implicitKey:z=!1,inFlow:G=!1,type:J}=Z,Q="indent"in $?$.indent:null;if(q&&typeof Q==="number")Q+=2;if(!J)switch($.type){case"single-quoted-scalar":J="QUOTE_SINGLE";break;case"double-quoted-scalar":J="QUOTE_DOUBLE";break;case"block-scalar":{let U=$.props[0];if(U.type!=="block-scalar-header")throw Error("Invalid block scalar header");J=U.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:J="PLAIN"}let Y=Z8.stringifyString({type:J,value:X},{implicitKey:z||Q===null,indent:Q!==null&&Q>0?" ".repeat(Q):"",inFlow:G,options:{blockQuote:!0,lineWidth:-1}});switch(Y[0]){case"|":case">":pQ($,Y);break;case'"':e9($,Y,"double-quoted-scalar");break;case"'":e9($,Y,"single-quoted-scalar");break;default:e9($,Y,"scalar")}}function pQ($,X){let Z=X.indexOf(`
138
- `),q=X.substring(0,Z),z=X.substring(Z+1)+`
139
- `;if($.type==="block-scalar"){let G=$.props[0];if(G.type!=="block-scalar-header")throw Error("Invalid block scalar header");G.source=q,$.source=z}else{let{offset:G}=$,J="indent"in $?$.indent:-1,Q=[{type:"block-scalar-header",offset:G,indent:J,source:q}];if(!q8(Q,"end"in $?$.end:void 0))Q.push({type:"newline",offset:-1,indent:J,source:`
140
- `});for(let Y of Object.keys($))if(Y!=="type"&&Y!=="offset")delete $[Y];Object.assign($,{type:"block-scalar",indent:J,props:Q,source:z})}}function q8($,X){if(X)for(let Z of X)switch(Z.type){case"space":case"comment":$.push(Z);break;case"newline":return $.push(Z),!0}return!1}function e9($,X,Z){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=Z,$.source=X;break;case"block-scalar":{let q=$.props.slice(1),z=X.length;if($.props[0].type==="block-scalar-header")z-=$.props[0].source.length;for(let G of q)G.offset+=z;delete $.props,Object.assign($,{type:Z,source:X,end:q});break}case"block-map":case"block-seq":{let z={type:"newline",offset:$.offset+X.length,indent:$.indent,source:`
141
- `};delete $.items,Object.assign($,{type:Z,source:X,end:[z]});break}default:{let q="indent"in $?$.indent:-1,z="end"in $&&Array.isArray($.end)?$.end.filter((G)=>G.type==="space"||G.type==="comment"||G.type==="newline"):[];for(let G of Object.keys($))if(G!=="type"&&G!=="offset")delete $[G];Object.assign($,{type:Z,indent:q,source:X,end:z})}}}cQ.createScalarToken=mQ;cQ.resolveAsScalar=uQ;cQ.setScalarValue=dQ});var G8=K((nQ)=>{var sQ=($)=>("type"in $)?o1($):r1($);function o1($){switch($.type){case"block-scalar":{let X="";for(let Z of $.props)X+=o1(Z);return X+$.source}case"block-map":case"block-seq":{let X="";for(let Z of $.items)X+=r1(Z);return X}case"flow-collection":{let X=$.start.source;for(let Z of $.items)X+=r1(Z);for(let Z of $.end)X+=Z.source;return X}case"document":{let X=r1($);if($.end)for(let Z of $.end)X+=Z.source;return X}default:{let X=$.source;if("end"in $&&$.end)for(let Z of $.end)X+=Z.source;return X}}}function r1({start:$,key:X,sep:Z,value:q}){let z="";for(let G of $)z+=G.source;if(X)z+=o1(X);if(Z)for(let G of Z)z+=G.source;if(q)z+=o1(q);return z}nQ.stringify=sQ});var Y8=K((tQ)=>{var $4=Symbol("break visit"),oQ=Symbol("skip children"),J8=Symbol("remove item");function x0($,X){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};Q8(Object.freeze([]),$,X)}x0.BREAK=$4;x0.SKIP=oQ;x0.REMOVE=J8;x0.itemAtPath=($,X)=>{let Z=$;for(let[q,z]of X){let G=Z?.[q];if(G&&"items"in G)Z=G.items[z];else return}return Z};x0.parentCollection=($,X)=>{let Z=x0.itemAtPath($,X.slice(0,-1)),q=X[X.length-1][0],z=Z?.[q];if(z&&"items"in z)return z;throw Error("Parent collection not found")};function Q8($,X,Z){let q=Z(X,$);if(typeof q==="symbol")return q;for(let z of["key","value"]){let G=X[z];if(G&&"items"in G){for(let J=0;J<G.items.length;++J){let Q=Q8(Object.freeze($.concat([[z,J]])),G.items[J],Z);if(typeof Q==="number")J=Q-1;else if(Q===$4)return $4;else if(Q===J8)G.items.splice(J,1),J-=1}if(typeof q==="function"&&z==="key")q=q(X,$)}}return typeof q==="function"?q(X,$):q}tQ.visit=x0});var t1=K((JY)=>{var X4=z8(),$Y=G8(),XY=Y8(),Z4="\uFEFF",q4="\x02",z4="\x18",G4="\x1F",ZY=($)=>!!$&&("items"in $),qY=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function zY($){switch($){case Z4:return"<BOM>";case q4:return"<DOC>";case z4:return"<FLOW_END>";case G4:return"<SCALAR>";default:return JSON.stringify($)}}function GY($){switch($){case Z4:return"byte-order-mark";case q4:return"doc-mode";case z4:return"flow-error-end";case G4:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
136
+ `,V=[{type:"block-scalar-header",offset:G,indent:z,source:W}];if(!z6(V,Y))V.push({type:"newline",offset:-1,indent:z,source:`
137
+ `});return{type:"block-scalar",offset:G,indent:z,props:V,source:H}}case'"':return{type:"double-quoted-scalar",offset:G,indent:z,source:Q,end:Y};case"'":return{type:"single-quoted-scalar",offset:G,indent:z,source:Q,end:Y};default:return{type:"scalar",offset:G,indent:z,source:Q,end:Y}}}function pQ($,X,Z={}){let{afterKey:z=!1,implicitKey:q=!1,inFlow:G=!1,type:J}=Z,Q="indent"in $?$.indent:null;if(z&&typeof Q==="number")Q+=2;if(!J)switch($.type){case"single-quoted-scalar":J="QUOTE_SINGLE";break;case"double-quoted-scalar":J="QUOTE_DOUBLE";break;case"block-scalar":{let U=$.props[0];if(U.type!=="block-scalar-header")throw Error("Invalid block scalar header");J=U.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:J="PLAIN"}let Y=Z6.stringifyString({type:J,value:X},{implicitKey:q||Q===null,indent:Q!==null&&Q>0?" ".repeat(Q):"",inFlow:G,options:{blockQuote:!0,lineWidth:-1}});switch(Y[0]){case"|":case">":lQ($,Y);break;case'"':$9($,Y,"double-quoted-scalar");break;case"'":$9($,Y,"single-quoted-scalar");break;default:$9($,Y,"scalar")}}function lQ($,X){let Z=X.indexOf(`
138
+ `),z=X.substring(0,Z),q=X.substring(Z+1)+`
139
+ `;if($.type==="block-scalar"){let G=$.props[0];if(G.type!=="block-scalar-header")throw Error("Invalid block scalar header");G.source=z,$.source=q}else{let{offset:G}=$,J="indent"in $?$.indent:-1,Q=[{type:"block-scalar-header",offset:G,indent:J,source:z}];if(!z6(Q,"end"in $?$.end:void 0))Q.push({type:"newline",offset:-1,indent:J,source:`
140
+ `});for(let Y of Object.keys($))if(Y!=="type"&&Y!=="offset")delete $[Y];Object.assign($,{type:"block-scalar",indent:J,props:Q,source:q})}}function z6($,X){if(X)for(let Z of X)switch(Z.type){case"space":case"comment":$.push(Z);break;case"newline":return $.push(Z),!0}return!1}function $9($,X,Z){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=Z,$.source=X;break;case"block-scalar":{let z=$.props.slice(1),q=X.length;if($.props[0].type==="block-scalar-header")q-=$.props[0].source.length;for(let G of z)G.offset+=q;delete $.props,Object.assign($,{type:Z,source:X,end:z});break}case"block-map":case"block-seq":{let q={type:"newline",offset:$.offset+X.length,indent:$.indent,source:`
141
+ `};delete $.items,Object.assign($,{type:Z,source:X,end:[q]});break}default:{let z="indent"in $?$.indent:-1,q="end"in $&&Array.isArray($.end)?$.end.filter((G)=>G.type==="space"||G.type==="comment"||G.type==="newline"):[];for(let G of Object.keys($))if(G!=="type"&&G!=="offset")delete $[G];Object.assign($,{type:Z,indent:z,source:X,end:q})}}}cQ.createScalarToken=dQ;cQ.resolveAsScalar=mQ;cQ.setScalarValue=pQ});var G6=D((rQ)=>{var nQ=($)=>("type"in $)?o1($):r1($);function o1($){switch($.type){case"block-scalar":{let X="";for(let Z of $.props)X+=o1(Z);return X+$.source}case"block-map":case"block-seq":{let X="";for(let Z of $.items)X+=r1(Z);return X}case"flow-collection":{let X=$.start.source;for(let Z of $.items)X+=r1(Z);for(let Z of $.end)X+=Z.source;return X}case"document":{let X=r1($);if($.end)for(let Z of $.end)X+=Z.source;return X}default:{let X=$.source;if("end"in $&&$.end)for(let Z of $.end)X+=Z.source;return X}}}function r1({start:$,key:X,sep:Z,value:z}){let q="";for(let G of $)q+=G.source;if(X)q+=o1(X);if(Z)for(let G of Z)q+=G.source;if(z)q+=o1(z);return q}rQ.stringify=nQ});var Y6=D((eQ)=>{var X9=Symbol("break visit"),tQ=Symbol("skip children"),J6=Symbol("remove item");function y0($,X){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};Q6(Object.freeze([]),$,X)}y0.BREAK=X9;y0.SKIP=tQ;y0.REMOVE=J6;y0.itemAtPath=($,X)=>{let Z=$;for(let[z,q]of X){let G=Z?.[z];if(G&&"items"in G)Z=G.items[q];else return}return Z};y0.parentCollection=($,X)=>{let Z=y0.itemAtPath($,X.slice(0,-1)),z=X[X.length-1][0],q=Z?.[z];if(q&&"items"in q)return q;throw Error("Parent collection not found")};function Q6($,X,Z){let z=Z(X,$);if(typeof z==="symbol")return z;for(let q of["key","value"]){let G=X[q];if(G&&"items"in G){for(let J=0;J<G.items.length;++J){let Q=Q6(Object.freeze($.concat([[q,J]])),G.items[J],Z);if(typeof Q==="number")J=Q-1;else if(Q===X9)return X9;else if(Q===J6)G.items.splice(J,1),J-=1}if(typeof z==="function"&&q==="key")z=z(X,$)}}return typeof z==="function"?z(X,$):z}eQ.visit=y0});var t1=D((QY)=>{var Z9=q6(),XY=G6(),ZY=Y6(),z9="\uFEFF",q9="\x02",G9="\x18",J9="\x1F",zY=($)=>!!$&&("items"in $),qY=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function GY($){switch($){case z9:return"<BOM>";case q9:return"<DOC>";case G9:return"<FLOW_END>";case J9:return"<SCALAR>";default:return JSON.stringify($)}}function JY($){switch($){case z9:return"byte-order-mark";case q9:return"doc-mode";case G9:return"flow-error-end";case J9:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
142
142
  `:case`\r
143
- `: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($[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}JY.createScalarToken=X4.createScalarToken;JY.resolveAsScalar=X4.resolveAsScalar;JY.setScalarValue=X4.setScalarValue;JY.stringify=$Y.stringify;JY.visit=XY.visit;JY.BOM=Z4;JY.DOCUMENT=q4;JY.FLOW_END=z4;JY.SCALAR=G4;JY.isCollection=ZY;JY.isScalar=qY;JY.prettyToken=zY;JY.tokenType=GY});var Q4=K((MY)=>{var d$=t1();function X0($){switch($){case void 0:case" ":case`
144
- `:case"\r":case"\t":return!0;default:return!1}}var U8=new Set("0123456789ABCDEFabcdef"),FY=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),e1=new Set(",[]{}"),OY=new Set(` ,[]{}
145
- \r `),J4=($)=>!$||OY.has($);class H8{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($,X=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!X;let Z=this.next??"stream";while(Z&&(X||this.hasChars(1)))Z=yield*this.parseNext(Z)}atLineEnd(){let $=this.pos,X=this.buffer[$];while(X===" "||X==="\t")X=this.buffer[++$];if(!X||X==="#"||X===`
143
+ `: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($[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}QY.createScalarToken=Z9.createScalarToken;QY.resolveAsScalar=Z9.resolveAsScalar;QY.setScalarValue=Z9.setScalarValue;QY.stringify=XY.stringify;QY.visit=ZY.visit;QY.BOM=z9;QY.DOCUMENT=q9;QY.FLOW_END=G9;QY.SCALAR=J9;QY.isCollection=zY;QY.isScalar=qY;QY.prettyToken=GY;QY.tokenType=JY});var Y9=D((IY)=>{var d$=t1();function X0($){switch($){case void 0:case" ":case`
144
+ `:case"\r":case"\t":return!0;default:return!1}}var U6=new Set("0123456789ABCDEFabcdef"),OY=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),e1=new Set(",[]{}"),wY=new Set(` ,[]{}
145
+ \r `),Q9=($)=>!$||wY.has($);class H6{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($,X=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!X;let Z=this.next??"stream";while(Z&&(X||this.hasChars(1)))Z=yield*this.parseNext(Z)}atLineEnd(){let $=this.pos,X=this.buffer[$];while(X===" "||X==="\t")X=this.buffer[++$];if(!X||X==="#"||X===`
146
146
  `)return!0;if(X==="\r")return this.buffer[$+1]===`
147
- `;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let X=this.buffer[$];if(this.indentNext>0){let Z=0;while(X===" ")X=this.buffer[++Z+$];if(X==="\r"){let q=this.buffer[Z+$+1];if(q===`
148
- `||!q&&!this.atEnd)return $+Z+1}return X===`
147
+ `;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let X=this.buffer[$];if(this.indentNext>0){let Z=0;while(X===" ")X=this.buffer[++Z+$];if(X==="\r"){let z=this.buffer[Z+$+1];if(z===`
148
+ `||!z&&!this.atEnd)return $+Z+1}return X===`
149
149
  `||Z>=this.indentNext||!X&&!this.atEnd?$+Z:-1}if(X==="-"||X==="."){let Z=this.buffer.substr($,3);if((Z==="---"||Z==="...")&&X0(this.buffer[$+3]))return-1}return $}getLine(){let $=this.lineEndPos;if(typeof $!=="number"||$!==-1&&$<this.pos)$=this.buffer.indexOf(`
150
- `,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){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 $=this.getLine();if($===null)return this.setNext("stream");if($[0]===d$.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let X=$.length,Z=$.indexOf("#");while(Z!==-1){let z=$[Z-1];if(z===" "||z==="\t"){X=Z-1;break}else Z=$.indexOf("#",Z+1)}while(!0){let z=$[X-1];if(z===" "||z==="\t")X-=1;else break}let q=(yield*this.pushCount(X))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-q),this.pushNewline(),"stream"}if(this.atLineEnd()){let X=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-X),yield*this.pushNewline(),"stream"}return yield d$.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let $=this.charAt(0);if(!$&&!this.atEnd)return this.setNext("line-start");if($==="-"||$==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let X=this.peek(3);if((X==="---"||X==="...")&&X0(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,X==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!X0(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[$,X]=this.peek(2);if(!X&&!this.atEnd)return this.setNext("block-start");if(($==="-"||$==="?"||$===":")&&X0(X)){let Z=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=Z,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let $=this.getLine();if($===null)return this.setNext("doc");let X=yield*this.pushIndicators();switch($[X]){case"#":yield*this.pushCount($.length-X);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(J4),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return X+=yield*this.parseBlockScalarHeader(),X+=yield*this.pushSpaces(!0),yield*this.pushCount($.length-X),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let $,X,Z=-1;do{if($=yield*this.pushNewline(),$>0)X=yield*this.pushSpaces(!1),this.indentValue=Z=X;else X=0;X+=yield*this.pushSpaces(!0)}while($+X>0);let q=this.getLine();if(q===null)return this.setNext("flow");if(Z!==-1&&Z<this.indentNext&&q[0]!=="#"||Z===0&&(q.startsWith("---")||q.startsWith("..."))&&X0(q[3])){if(!(Z===this.indentNext-1&&this.flowLevel===1&&(q[0]==="]"||q[0]==="}")))return this.flowLevel=0,yield d$.FLOW_END,yield*this.parseLineStart()}let z=0;while(q[z]===",")z+=yield*this.pushCount(1),z+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(z+=yield*this.pushIndicators(),q[z]){case void 0:return"flow";case"#":return yield*this.pushCount(q.length-z),"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(J4),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let G=this.charAt(1);if(this.flowKey||X0(G)||G===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),X=this.buffer.indexOf($,this.pos+1);if($==="'")while(X!==-1&&this.buffer[X+1]==="'")X=this.buffer.indexOf("'",X+2);else while(X!==-1){let z=0;while(this.buffer[X-1-z]==="\\")z+=1;if(z%2===0)break;X=this.buffer.indexOf('"',X+1)}let Z=this.buffer.substring(0,X),q=Z.indexOf(`
151
- `,this.pos);if(q!==-1){while(q!==-1){let z=this.continueScalar(q+1);if(z===-1)break;q=Z.indexOf(`
152
- `,z)}if(q!==-1)X=q-(Z[q-1]==="\r"?2:1)}if(X===-1){if(!this.atEnd)return this.setNext("quoted-scalar");X=this.buffer.length}return yield*this.pushToIndex(X+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let X=this.buffer[++$];if(X==="+")this.blockScalarKeep=!0;else if(X>"0"&&X<="9")this.blockScalarIndent=Number(X)-1;else if(X!=="-")break}return yield*this.pushUntil((X)=>X0(X)||X==="#")}*parseBlockScalar(){let $=this.pos-1,X=0,Z;$:for(let z=this.pos;Z=this.buffer[z];++z)switch(Z){case" ":X+=1;break;case`
153
- `:$=z,X=0;break;case"\r":{let G=this.buffer[z+1];if(!G&&!this.atEnd)return this.setNext("block-scalar");if(G===`
154
- `)break}default:break $}if(!Z&&!this.atEnd)return this.setNext("block-scalar");if(X>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=X;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let z=this.continueScalar($+1);if(z===-1)break;$=this.buffer.indexOf(`
155
- `,z)}while($!==-1);if($===-1){if(!this.atEnd)return this.setNext("block-scalar");$=this.buffer.length}}let q=$+1;Z=this.buffer[q];while(Z===" ")Z=this.buffer[++q];if(Z==="\t"){while(Z==="\t"||Z===" "||Z==="\r"||Z===`
156
- `)Z=this.buffer[++q];$=q-1}else if(!this.blockScalarKeep)do{let z=$-1,G=this.buffer[z];if(G==="\r")G=this.buffer[--z];let J=z;while(G===" ")G=this.buffer[--z];if(G===`
157
- `&&z>=this.pos&&z+1+X>J)$=z;else break}while(!0);return yield d$.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,X=this.pos-1,Z=this.pos-1,q;while(q=this.buffer[++Z])if(q===":"){let z=this.buffer[Z+1];if(X0(z)||$&&e1.has(z))break;X=Z}else if(X0(q)){let z=this.buffer[Z+1];if(q==="\r")if(z===`
158
- `)Z+=1,q=`
159
- `,z=this.buffer[Z+1];else X=Z;if(z==="#"||$&&e1.has(z))break;if(q===`
160
- `){let G=this.continueScalar(Z+1);if(G===-1)break;Z=Math.max(Z,G-2)}}else{if($&&e1.has(q))break;X=Z}if(!q&&!this.atEnd)return this.setNext("plain-scalar");return yield d$.SCALAR,yield*this.pushToIndex(X+1,!0),$?"flow":"doc"}*pushCount($){if($>0)return yield this.buffer.substr(this.pos,$),this.pos+=$,$;return 0}*pushToIndex($,X){let Z=this.buffer.slice(this.pos,$);if(Z)return yield Z,this.pos+=Z.length,Z.length;else if(X)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(J4))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let $=this.flowLevel>0,X=this.charAt(1);if(X0(X)||$&&e1.has(X)){if(!$)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 $=this.pos+2,X=this.buffer[$];while(!X0(X)&&X!==">")X=this.buffer[++$];return yield*this.pushToIndex(X===">"?$+1:$,!1)}else{let $=this.pos+1,X=this.buffer[$];while(X)if(FY.has(X))X=this.buffer[++$];else if(X==="%"&&U8.has(this.buffer[$+1])&&U8.has(this.buffer[$+2]))X=this.buffer[$+=3];else break;return yield*this.pushToIndex($,!1)}}*pushNewline(){let $=this.buffer[this.pos];if($===`
150
+ `,this.pos),this.lineEndPos=$;if($===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[$-1]==="\r")$-=1;return this.buffer.substring(this.pos,$)}hasChars($){return this.pos+$<=this.buffer.length}setNext($){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=$,null}peek($){return this.buffer.substr(this.pos,$)}*parseNext($){switch($){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 $=this.getLine();if($===null)return this.setNext("stream");if($[0]===d$.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let X=$.length,Z=$.indexOf("#");while(Z!==-1){let q=$[Z-1];if(q===" "||q==="\t"){X=Z-1;break}else Z=$.indexOf("#",Z+1)}while(!0){let q=$[X-1];if(q===" "||q==="\t")X-=1;else break}let z=(yield*this.pushCount(X))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-z),this.pushNewline(),"stream"}if(this.atLineEnd()){let X=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-X),yield*this.pushNewline(),"stream"}return yield d$.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let $=this.charAt(0);if(!$&&!this.atEnd)return this.setNext("line-start");if($==="-"||$==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let X=this.peek(3);if((X==="---"||X==="...")&&X0(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,X==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!X0(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[$,X]=this.peek(2);if(!X&&!this.atEnd)return this.setNext("block-start");if(($==="-"||$==="?"||$===":")&&X0(X)){let Z=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=Z,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let $=this.getLine();if($===null)return this.setNext("doc");let X=yield*this.pushIndicators();switch($[X]){case"#":yield*this.pushCount($.length-X);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(Q9),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return X+=yield*this.parseBlockScalarHeader(),X+=yield*this.pushSpaces(!0),yield*this.pushCount($.length-X),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let $,X,Z=-1;do{if($=yield*this.pushNewline(),$>0)X=yield*this.pushSpaces(!1),this.indentValue=Z=X;else X=0;X+=yield*this.pushSpaces(!0)}while($+X>0);let z=this.getLine();if(z===null)return this.setNext("flow");if(Z!==-1&&Z<this.indentNext&&z[0]!=="#"||Z===0&&(z.startsWith("---")||z.startsWith("..."))&&X0(z[3])){if(!(Z===this.indentNext-1&&this.flowLevel===1&&(z[0]==="]"||z[0]==="}")))return this.flowLevel=0,yield d$.FLOW_END,yield*this.parseLineStart()}let q=0;while(z[q]===",")q+=yield*this.pushCount(1),q+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(q+=yield*this.pushIndicators(),z[q]){case void 0:return"flow";case"#":return yield*this.pushCount(z.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(Q9),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let G=this.charAt(1);if(this.flowKey||X0(G)||G===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=this.charAt(0),X=this.buffer.indexOf($,this.pos+1);if($==="'")while(X!==-1&&this.buffer[X+1]==="'")X=this.buffer.indexOf("'",X+2);else while(X!==-1){let q=0;while(this.buffer[X-1-q]==="\\")q+=1;if(q%2===0)break;X=this.buffer.indexOf('"',X+1)}let Z=this.buffer.substring(0,X),z=Z.indexOf(`
151
+ `,this.pos);if(z!==-1){while(z!==-1){let q=this.continueScalar(z+1);if(q===-1)break;z=Z.indexOf(`
152
+ `,q)}if(z!==-1)X=z-(Z[z-1]==="\r"?2:1)}if(X===-1){if(!this.atEnd)return this.setNext("quoted-scalar");X=this.buffer.length}return yield*this.pushToIndex(X+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let X=this.buffer[++$];if(X==="+")this.blockScalarKeep=!0;else if(X>"0"&&X<="9")this.blockScalarIndent=Number(X)-1;else if(X!=="-")break}return yield*this.pushUntil((X)=>X0(X)||X==="#")}*parseBlockScalar(){let $=this.pos-1,X=0,Z;$:for(let q=this.pos;Z=this.buffer[q];++q)switch(Z){case" ":X+=1;break;case`
153
+ `:$=q,X=0;break;case"\r":{let G=this.buffer[q+1];if(!G&&!this.atEnd)return this.setNext("block-scalar");if(G===`
154
+ `)break}default:break $}if(!Z&&!this.atEnd)return this.setNext("block-scalar");if(X>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=X;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let q=this.continueScalar($+1);if(q===-1)break;$=this.buffer.indexOf(`
155
+ `,q)}while($!==-1);if($===-1){if(!this.atEnd)return this.setNext("block-scalar");$=this.buffer.length}}let z=$+1;Z=this.buffer[z];while(Z===" ")Z=this.buffer[++z];if(Z==="\t"){while(Z==="\t"||Z===" "||Z==="\r"||Z===`
156
+ `)Z=this.buffer[++z];$=z-1}else if(!this.blockScalarKeep)do{let q=$-1,G=this.buffer[q];if(G==="\r")G=this.buffer[--q];let J=q;while(G===" ")G=this.buffer[--q];if(G===`
157
+ `&&q>=this.pos&&q+1+X>J)$=q;else break}while(!0);return yield d$.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,X=this.pos-1,Z=this.pos-1,z;while(z=this.buffer[++Z])if(z===":"){let q=this.buffer[Z+1];if(X0(q)||$&&e1.has(q))break;X=Z}else if(X0(z)){let q=this.buffer[Z+1];if(z==="\r")if(q===`
158
+ `)Z+=1,z=`
159
+ `,q=this.buffer[Z+1];else X=Z;if(q==="#"||$&&e1.has(q))break;if(z===`
160
+ `){let G=this.continueScalar(Z+1);if(G===-1)break;Z=Math.max(Z,G-2)}}else{if($&&e1.has(z))break;X=Z}if(!z&&!this.atEnd)return this.setNext("plain-scalar");return yield d$.SCALAR,yield*this.pushToIndex(X+1,!0),$?"flow":"doc"}*pushCount($){if($>0)return yield this.buffer.substr(this.pos,$),this.pos+=$,$;return 0}*pushToIndex($,X){let Z=this.buffer.slice(this.pos,$);if(Z)return yield Z,this.pos+=Z.length,Z.length;else if(X)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(Q9))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let $=this.flowLevel>0,X=this.charAt(1);if(X0(X)||$&&e1.has(X)){if(!$)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 $=this.pos+2,X=this.buffer[$];while(!X0(X)&&X!==">")X=this.buffer[++$];return yield*this.pushToIndex(X===">"?$+1:$,!1)}else{let $=this.pos+1,X=this.buffer[$];while(X)if(OY.has(X))X=this.buffer[++$];else if(X==="%"&&U6.has(this.buffer[$+1])&&U6.has(this.buffer[$+2]))X=this.buffer[$+=3];else break;return yield*this.pushToIndex($,!1)}}*pushNewline(){let $=this.buffer[this.pos];if($===`
161
161
  `)return yield*this.pushCount(1);else if($==="\r"&&this.charAt(1)===`
162
- `)return yield*this.pushCount(2);else return 0}*pushSpaces($){let X=this.pos-1,Z;do Z=this.buffer[++X];while(Z===" "||$&&Z==="\t");let q=X-this.pos;if(q>0)yield this.buffer.substr(this.pos,q),this.pos=X;return q}*pushUntil($){let X=this.pos,Z=this.buffer[X];while(!$(Z))Z=this.buffer[++X];return yield*this.pushToIndex(X,!1)}}MY.Lexer=H8});var Y4=K((RY)=>{class W8{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let X=0,Z=this.lineStarts.length;while(X<Z){let z=X+Z>>1;if(this.lineStarts[z]<$)X=z+1;else Z=z}if(this.lineStarts[X]===$)return{line:X+1,col:1};if(X===0)return{line:0,col:$};let q=this.lineStarts[X-1];return{line:X,col:$-q+1}}}}RY.LineCounter=W8});var U4=K((SY)=>{var NY=Q0("process"),V8=t1(),AY=Q4();function M0($,X){for(let Z=0;Z<$.length;++Z)if($[Z].type===X)return!0;return!1}function T8($){for(let X=0;X<$.length;++X)switch($[X].type){case"space":case"comment":case"newline":break;default:return X}return-1}function L8($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function $2($){switch($.type){case"document":return $.start;case"block-map":{let X=$.items[$.items.length-1];return X.sep??X.start}case"block-seq":return $.items[$.items.length-1].start;default:return[]}}function X$($){if($.length===0)return[];let X=$.length;$:while(--X>=0)switch($[X].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break $}while($[++X]?.type==="space");return $.splice(X,$.length)}function w8($){if($.start.type==="flow-seq-start"){for(let X of $.items)if(X.sep&&!X.value&&!M0(X.start,"explicit-key-ind")&&!M0(X.sep,"map-value-ind")){if(X.key)X.value=X.key;if(delete X.key,L8(X.value))if(X.value.end)Array.prototype.push.apply(X.value.end,X.sep);else X.value.end=X.sep;else Array.prototype.push.apply(X.start,X.sep);delete X.sep}}}class B8{constructor($){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new AY.Lexer,this.onNewLine=$}*parse($,X=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let Z of this.lexer.lex($,X))yield*this.next(Z);if(!X)yield*this.end()}*next($){if(this.source=$,NY.env.LOG_TOKENS)console.log("|",V8.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let X=V8.tokenType($);if(!X){let Z=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:Z,source:$}),this.offset+=$.length}else if(X==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=X,yield*this.step(),X){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+$.length);break;case"space":if(this.atNewLine&&$[0]===" ")this.indent+=$.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=$.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=$.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 $=this.peek(1);if(this.type==="doc-end"&&$?.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(!$)return yield*this.stream();switch($.type){case"document":return yield*this.document($);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar($);case"block-scalar":return yield*this.blockScalar($);case"block-map":return yield*this.blockMap($);case"block-seq":return yield*this.blockSequence($);case"flow-collection":return yield*this.flowCollection($);case"doc-end":return yield*this.documentEnd($)}yield*this.pop()}peek($){return this.stack[this.stack.length-$]}*pop($){let X=$??this.stack.pop();if(!X)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield X;else{let Z=this.peek(1);if(X.type==="block-scalar")X.indent="indent"in Z?Z.indent:0;else if(X.type==="flow-collection"&&Z.type==="document")X.indent=0;if(X.type==="flow-collection")w8(X);switch(Z.type){case"document":Z.value=X;break;case"block-scalar":Z.props.push(X);break;case"block-map":{let q=Z.items[Z.items.length-1];if(q.value){Z.items.push({start:[],key:X,sep:[]}),this.onKeyLine=!0;return}else if(q.sep)q.value=X;else{Object.assign(q,{key:X,sep:[]}),this.onKeyLine=!q.explicitKey;return}break}case"block-seq":{let q=Z.items[Z.items.length-1];if(q.value)Z.items.push({start:[],value:X});else q.value=X;break}case"flow-collection":{let q=Z.items[Z.items.length-1];if(!q||q.value)Z.items.push({start:[],key:X,sep:[]});else if(q.sep)q.value=X;else Object.assign(q,{key:X,sep:[]});return}default:yield*this.pop(),yield*this.pop(X)}if((Z.type==="document"||Z.type==="block-map"||Z.type==="block-seq")&&(X.type==="block-map"||X.type==="block-seq")){let q=X.items[X.items.length-1];if(q&&!q.sep&&!q.value&&q.start.length>0&&T8(q.start)===-1&&(X.indent===0||q.start.every((z)=>z.type!=="comment"||z.indent<X.indent))){if(Z.type==="document")Z.end=q.start;else Z.items.push({start:q.start});X.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 $={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")$.start.push(this.sourceToken);this.stack.push($);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document($){if($.value)return yield*this.lineEnd($);switch(this.type){case"doc-start":{if(T8($.start)!==-1)yield*this.pop(),yield*this.step();else $.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":$.start.push(this.sourceToken);return}let X=this.startBlockValue($);if(X)this.stack.push(X);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar($){if(this.type==="map-value-ind"){let X=$2(this.peek(2)),Z=X$(X),q;if($.end)q=$.end,q.push(this.sourceToken),delete $.end;else q=[this.sourceToken];let z={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:Z,key:$,sep:q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=z}else yield*this.lineEnd($)}*blockScalar($){switch(this.type){case"space":case"comment":case"newline":$.props.push(this.sourceToken);return;case"scalar":if($.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let X=this.source.indexOf(`
162
+ `)return yield*this.pushCount(2);else return 0}*pushSpaces($){let X=this.pos-1,Z;do Z=this.buffer[++X];while(Z===" "||$&&Z==="\t");let z=X-this.pos;if(z>0)yield this.buffer.substr(this.pos,z),this.pos=X;return z}*pushUntil($){let X=this.pos,Z=this.buffer[X];while(!$(Z))Z=this.buffer[++X];return yield*this.pushToIndex(X,!1)}}IY.Lexer=H6});var U9=D((PY)=>{class W6{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let X=0,Z=this.lineStarts.length;while(X<Z){let q=X+Z>>1;if(this.lineStarts[q]<$)X=q+1;else Z=q}if(this.lineStarts[X]===$)return{line:X+1,col:1};if(X===0)return{line:0,col:$};let z=this.lineStarts[X-1];return{line:X,col:$-z+1}}}}PY.LineCounter=W6});var H9=D((SY)=>{var AY=Q0("process"),V6=t1(),jY=Y9();function w0($,X){for(let Z=0;Z<$.length;++Z)if($[Z].type===X)return!0;return!1}function T6($){for(let X=0;X<$.length;++X)switch($[X].type){case"space":case"comment":case"newline":break;default:return X}return-1}function K6($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function $2($){switch($.type){case"document":return $.start;case"block-map":{let X=$.items[$.items.length-1];return X.sep??X.start}case"block-seq":return $.items[$.items.length-1].start;default:return[]}}function X$($){if($.length===0)return[];let X=$.length;$:while(--X>=0)switch($[X].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break $}while($[++X]?.type==="space");return $.splice(X,$.length)}function B6($){if($.start.type==="flow-seq-start"){for(let X of $.items)if(X.sep&&!X.value&&!w0(X.start,"explicit-key-ind")&&!w0(X.sep,"map-value-ind")){if(X.key)X.value=X.key;if(delete X.key,K6(X.value))if(X.value.end)Array.prototype.push.apply(X.value.end,X.sep);else X.value.end=X.sep;else Array.prototype.push.apply(X.start,X.sep);delete X.sep}}}class L6{constructor($){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new jY.Lexer,this.onNewLine=$}*parse($,X=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let Z of this.lexer.lex($,X))yield*this.next(Z);if(!X)yield*this.end()}*next($){if(this.source=$,AY.env.LOG_TOKENS)console.log("|",V6.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let X=V6.tokenType($);if(!X){let Z=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:Z,source:$}),this.offset+=$.length}else if(X==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=X,yield*this.step(),X){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+$.length);break;case"space":if(this.atNewLine&&$[0]===" ")this.indent+=$.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=$.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=$.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 $=this.peek(1);if(this.type==="doc-end"&&$?.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(!$)return yield*this.stream();switch($.type){case"document":return yield*this.document($);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar($);case"block-scalar":return yield*this.blockScalar($);case"block-map":return yield*this.blockMap($);case"block-seq":return yield*this.blockSequence($);case"flow-collection":return yield*this.flowCollection($);case"doc-end":return yield*this.documentEnd($)}yield*this.pop()}peek($){return this.stack[this.stack.length-$]}*pop($){let X=$??this.stack.pop();if(!X)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield X;else{let Z=this.peek(1);if(X.type==="block-scalar")X.indent="indent"in Z?Z.indent:0;else if(X.type==="flow-collection"&&Z.type==="document")X.indent=0;if(X.type==="flow-collection")B6(X);switch(Z.type){case"document":Z.value=X;break;case"block-scalar":Z.props.push(X);break;case"block-map":{let z=Z.items[Z.items.length-1];if(z.value){Z.items.push({start:[],key:X,sep:[]}),this.onKeyLine=!0;return}else if(z.sep)z.value=X;else{Object.assign(z,{key:X,sep:[]}),this.onKeyLine=!z.explicitKey;return}break}case"block-seq":{let z=Z.items[Z.items.length-1];if(z.value)Z.items.push({start:[],value:X});else z.value=X;break}case"flow-collection":{let z=Z.items[Z.items.length-1];if(!z||z.value)Z.items.push({start:[],key:X,sep:[]});else if(z.sep)z.value=X;else Object.assign(z,{key:X,sep:[]});return}default:yield*this.pop(),yield*this.pop(X)}if((Z.type==="document"||Z.type==="block-map"||Z.type==="block-seq")&&(X.type==="block-map"||X.type==="block-seq")){let z=X.items[X.items.length-1];if(z&&!z.sep&&!z.value&&z.start.length>0&&T6(z.start)===-1&&(X.indent===0||z.start.every((q)=>q.type!=="comment"||q.indent<X.indent))){if(Z.type==="document")Z.end=z.start;else Z.items.push({start:z.start});X.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 $={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")$.start.push(this.sourceToken);this.stack.push($);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document($){if($.value)return yield*this.lineEnd($);switch(this.type){case"doc-start":{if(T6($.start)!==-1)yield*this.pop(),yield*this.step();else $.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":$.start.push(this.sourceToken);return}let X=this.startBlockValue($);if(X)this.stack.push(X);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar($){if(this.type==="map-value-ind"){let X=$2(this.peek(2)),Z=X$(X),z;if($.end)z=$.end,z.push(this.sourceToken),delete $.end;else z=[this.sourceToken];let q={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:Z,key:$,sep:z}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=q}else yield*this.lineEnd($)}*blockScalar($){switch(this.type){case"space":case"comment":case"newline":$.props.push(this.sourceToken);return;case"scalar":if($.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let X=this.source.indexOf(`
163
163
  `)+1;while(X!==0)this.onNewLine(this.offset+X),X=this.source.indexOf(`
164
- `,X)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let X=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,X.value){let Z="end"in X.value?X.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(X.sep)X.sep.push(this.sourceToken);else X.start.push(this.sourceToken);return;case"space":case"comment":if(X.value)$.items.push({start:[this.sourceToken]});else if(X.sep)X.sep.push(this.sourceToken);else{if(this.atIndentedComment(X.start,$.indent)){let q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(q)){Array.prototype.push.apply(q,X.start),q.push(this.sourceToken),$.items.pop();return}}X.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let Z=!this.onKeyLine&&this.indent===$.indent,q=Z&&(X.sep||X.explicitKey)&&this.type!=="seq-item-ind",z=[];if(q&&X.sep&&!X.value){let G=[];for(let J=0;J<X.sep.length;++J){let Q=X.sep[J];switch(Q.type){case"newline":G.push(J);break;case"space":break;case"comment":if(Q.indent>$.indent)G.length=0;break;default:G.length=0}}if(G.length>=2)z=X.sep.splice(G[1])}switch(this.type){case"anchor":case"tag":if(q||X.value)z.push(this.sourceToken),$.items.push({start:z}),this.onKeyLine=!0;else if(X.sep)X.sep.push(this.sourceToken);else X.start.push(this.sourceToken);return;case"explicit-key-ind":if(!X.sep&&!X.explicitKey)X.start.push(this.sourceToken),X.explicitKey=!0;else if(q||X.value)z.push(this.sourceToken),$.items.push({start:z,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(X.explicitKey)if(!X.sep)if(M0(X.start,"newline"))Object.assign(X,{key:null,sep:[this.sourceToken]});else{let G=X$(X.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:G,key:null,sep:[this.sourceToken]}]})}else if(X.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(M0(X.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:z,key:null,sep:[this.sourceToken]}]});else if(L8(X.key)&&!M0(X.sep,"newline")){let G=X$(X.start),J=X.key,Q=X.sep;Q.push(this.sourceToken),delete X.key,delete X.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:G,key:J,sep:Q}]})}else if(z.length>0)X.sep=X.sep.concat(z,this.sourceToken);else X.sep.push(this.sourceToken);else if(!X.sep)Object.assign(X,{key:null,sep:[this.sourceToken]});else if(X.value||q)$.items.push({start:z,key:null,sep:[this.sourceToken]});else if(M0(X.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else X.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let G=this.flowScalar(this.type);if(q||X.value)$.items.push({start:z,key:G,sep:[]}),this.onKeyLine=!0;else if(X.sep)this.stack.push(G);else Object.assign(X,{key:G,sep:[]}),this.onKeyLine=!0;return}default:{let G=this.startBlockValue($);if(G){if(G.type==="block-seq"){if(!X.explicitKey&&X.sep&&!M0(X.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(Z)$.items.push({start:z});this.stack.push(G);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let X=$.items[$.items.length-1];switch(this.type){case"newline":if(X.value){let Z="end"in X.value?X.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else X.start.push(this.sourceToken);return;case"space":case"comment":if(X.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(X.start,$.indent)){let q=$.items[$.items.length-2]?.value?.end;if(Array.isArray(q)){Array.prototype.push.apply(q,X.start),q.push(this.sourceToken),$.items.pop();return}}X.start.push(this.sourceToken)}return;case"anchor":case"tag":if(X.value||this.indent<=$.indent)break;X.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(X.value||M0(X.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else X.start.push(this.sourceToken);return}if(this.indent>$.indent){let Z=this.startBlockValue($);if(Z){this.stack.push(Z);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let X=$.items[$.items.length-1];if(this.type==="flow-error-end"){let Z;do yield*this.pop(),Z=this.peek(1);while(Z?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!X||X.sep)$.items.push({start:[this.sourceToken]});else X.start.push(this.sourceToken);return;case"map-value-ind":if(!X||X.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(X.sep)X.sep.push(this.sourceToken);else Object.assign(X,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!X||X.value)$.items.push({start:[this.sourceToken]});else if(X.sep)X.sep.push(this.sourceToken);else X.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let q=this.flowScalar(this.type);if(!X||X.value)$.items.push({start:[],key:q,sep:[]});else if(X.sep)this.stack.push(q);else Object.assign(X,{key:q,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let Z=this.startBlockValue($);if(Z)this.stack.push(Z);else yield*this.pop(),yield*this.step()}else{let Z=this.peek(2);if(Z.type==="block-map"&&(this.type==="map-value-ind"&&Z.indent===$.indent||this.type==="newline"&&!Z.items[Z.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&Z.type!=="flow-collection"){let q=$2(Z),z=X$(q);w8($);let G=$.end.splice(1,$.end.length);G.push(this.sourceToken);let J={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:z,key:$,sep:G}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let X=this.source.indexOf(`
164
+ `,X)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let X=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,X.value){let Z="end"in X.value?X.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(X.sep)X.sep.push(this.sourceToken);else X.start.push(this.sourceToken);return;case"space":case"comment":if(X.value)$.items.push({start:[this.sourceToken]});else if(X.sep)X.sep.push(this.sourceToken);else{if(this.atIndentedComment(X.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){Array.prototype.push.apply(z,X.start),z.push(this.sourceToken),$.items.pop();return}}X.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let Z=!this.onKeyLine&&this.indent===$.indent,z=Z&&(X.sep||X.explicitKey)&&this.type!=="seq-item-ind",q=[];if(z&&X.sep&&!X.value){let G=[];for(let J=0;J<X.sep.length;++J){let Q=X.sep[J];switch(Q.type){case"newline":G.push(J);break;case"space":break;case"comment":if(Q.indent>$.indent)G.length=0;break;default:G.length=0}}if(G.length>=2)q=X.sep.splice(G[1])}switch(this.type){case"anchor":case"tag":if(z||X.value)q.push(this.sourceToken),$.items.push({start:q}),this.onKeyLine=!0;else if(X.sep)X.sep.push(this.sourceToken);else X.start.push(this.sourceToken);return;case"explicit-key-ind":if(!X.sep&&!X.explicitKey)X.start.push(this.sourceToken),X.explicitKey=!0;else if(z||X.value)q.push(this.sourceToken),$.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(X.explicitKey)if(!X.sep)if(w0(X.start,"newline"))Object.assign(X,{key:null,sep:[this.sourceToken]});else{let G=X$(X.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:G,key:null,sep:[this.sourceToken]}]})}else if(X.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(w0(X.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(K6(X.key)&&!w0(X.sep,"newline")){let G=X$(X.start),J=X.key,Q=X.sep;Q.push(this.sourceToken),delete X.key,delete X.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:G,key:J,sep:Q}]})}else if(q.length>0)X.sep=X.sep.concat(q,this.sourceToken);else X.sep.push(this.sourceToken);else if(!X.sep)Object.assign(X,{key:null,sep:[this.sourceToken]});else if(X.value||z)$.items.push({start:q,key:null,sep:[this.sourceToken]});else if(w0(X.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else X.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let G=this.flowScalar(this.type);if(z||X.value)$.items.push({start:q,key:G,sep:[]}),this.onKeyLine=!0;else if(X.sep)this.stack.push(G);else Object.assign(X,{key:G,sep:[]}),this.onKeyLine=!0;return}default:{let G=this.startBlockValue($);if(G){if(G.type==="block-seq"){if(!X.explicitKey&&X.sep&&!w0(X.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(Z)$.items.push({start:q});this.stack.push(G);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let X=$.items[$.items.length-1];switch(this.type){case"newline":if(X.value){let Z="end"in X.value?X.value.end:void 0;if((Array.isArray(Z)?Z[Z.length-1]:void 0)?.type==="comment")Z?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else X.start.push(this.sourceToken);return;case"space":case"comment":if(X.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(X.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){Array.prototype.push.apply(z,X.start),z.push(this.sourceToken),$.items.pop();return}}X.start.push(this.sourceToken)}return;case"anchor":case"tag":if(X.value||this.indent<=$.indent)break;X.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(X.value||w0(X.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else X.start.push(this.sourceToken);return}if(this.indent>$.indent){let Z=this.startBlockValue($);if(Z){this.stack.push(Z);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let X=$.items[$.items.length-1];if(this.type==="flow-error-end"){let Z;do yield*this.pop(),Z=this.peek(1);while(Z?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!X||X.sep)$.items.push({start:[this.sourceToken]});else X.start.push(this.sourceToken);return;case"map-value-ind":if(!X||X.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(X.sep)X.sep.push(this.sourceToken);else Object.assign(X,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!X||X.value)$.items.push({start:[this.sourceToken]});else if(X.sep)X.sep.push(this.sourceToken);else X.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let z=this.flowScalar(this.type);if(!X||X.value)$.items.push({start:[],key:z,sep:[]});else if(X.sep)this.stack.push(z);else Object.assign(X,{key:z,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let Z=this.startBlockValue($);if(Z)this.stack.push(Z);else yield*this.pop(),yield*this.step()}else{let Z=this.peek(2);if(Z.type==="block-map"&&(this.type==="map-value-ind"&&Z.indent===$.indent||this.type==="newline"&&!Z.items[Z.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&Z.type!=="flow-collection"){let z=$2(Z),q=X$(z);B6($);let G=$.end.splice(1,$.end.length);G.push(this.sourceToken);let J={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:q,key:$,sep:G}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let X=this.source.indexOf(`
165
165
  `)+1;while(X!==0)this.onNewLine(this.offset+X),X=this.source.indexOf(`
166
- `,X)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){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 X=$2($),Z=X$(X);return Z.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Z,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let X=$2($),Z=X$(X);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Z,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,X){if(this.type!=="comment")return!1;if(this.indent<=X)return!1;return $.every((Z)=>Z.type==="newline"||Z.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){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($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}SY.Parser=B8});var O8=K((gY)=>{var K8=t9(),EY=g$(),p$=h$(),CY=Y9(),bY=j(),yY=Y4(),D8=U4();function _8($){let X=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||X&&new yY.LineCounter||null,prettyErrors:X}}function xY($,X={}){let{lineCounter:Z,prettyErrors:q}=_8(X),z=new D8.Parser(Z?.addNewLine),G=new K8.Composer(X),J=Array.from(G.compose(z.parse($)));if(q&&Z)for(let Q of J)Q.errors.forEach(p$.prettifyError($,Z)),Q.warnings.forEach(p$.prettifyError($,Z));if(J.length>0)return J;return Object.assign([],{empty:!0},G.streamInfo())}function F8($,X={}){let{lineCounter:Z,prettyErrors:q}=_8(X),z=new D8.Parser(Z?.addNewLine),G=new K8.Composer(X),J=null;for(let Q of G.compose(z.parse($),!0,$.length))if(!J)J=Q;else if(J.options.logLevel!=="silent"){J.errors.push(new p$.YAMLParseError(Q.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(q&&Z)J.errors.forEach(p$.prettifyError($,Z)),J.warnings.forEach(p$.prettifyError($,Z));return J}function fY($,X,Z){let q=void 0;if(typeof X==="function")q=X;else if(Z===void 0&&X&&typeof X==="object")Z=X;let z=F8($,Z);if(!z)return null;if(z.warnings.forEach((G)=>CY.warn(z.options.logLevel,G)),z.errors.length>0)if(z.options.logLevel!=="silent")throw z.errors[0];else z.errors=[];return z.toJS(Object.assign({reviver:q},Z))}function kY($,X,Z){let q=null;if(typeof X==="function"||Array.isArray(X))q=X;else if(Z===void 0&&X)Z=X;if(typeof Z==="string")Z=Z.length;if(typeof Z==="number"){let z=Math.round(Z);Z=z<1?void 0:z>8?{indent:8}:{indent:z}}if($===void 0){let{keepUndefined:z}=Z??X??{};if(!z)return}if(bY.isDocument($)&&!q)return $.toString(Z);return new EY.Document($,q,Z).toString(Z)}gY.parse=fY;gY.parseAllDocuments=xY;gY.parseDocument=F8;gY.stringify=kY});var I8=K(($U)=>{var dY=t9(),pY=g$(),cY=k9(),H4=h$(),lY=M$(),I0=j(),iY=D0(),aY=g(),sY=F0(),nY=O0(),rY=t1(),oY=Q4(),tY=Y4(),eY=U4(),X2=O8(),M8=F$();$U.Composer=dY.Composer;$U.Document=pY.Document;$U.Schema=cY.Schema;$U.YAMLError=H4.YAMLError;$U.YAMLParseError=H4.YAMLParseError;$U.YAMLWarning=H4.YAMLWarning;$U.Alias=lY.Alias;$U.isAlias=I0.isAlias;$U.isCollection=I0.isCollection;$U.isDocument=I0.isDocument;$U.isMap=I0.isMap;$U.isNode=I0.isNode;$U.isPair=I0.isPair;$U.isScalar=I0.isScalar;$U.isSeq=I0.isSeq;$U.Pair=iY.Pair;$U.Scalar=aY.Scalar;$U.YAMLMap=sY.YAMLMap;$U.YAMLSeq=nY.YAMLSeq;$U.CST=rY;$U.Lexer=oY.Lexer;$U.LineCounter=tY.LineCounter;$U.Parser=eY.Parser;$U.parse=X2.parse;$U.parseAllDocuments=X2.parseAllDocuments;$U.parseDocument=X2.parseDocument;$U.stringify=X2.stringify;$U.visit=M8.visit;$U.visitAsync=M8.visitAsync});var TX=r4(VX(),1),{program:c0,createCommand:sW,createArgument:nW,createOption:rW,CommanderError:oW,InvalidArgumentError:tW,InvalidOptionArgumentError:eW,Command:$V,Argument:XV,Option:o2,Help:ZV}=TX.default;var wX={name:"@pickled-dev/cli",version:"0.12.0",description:"Test what agents actually understand about your product",module:"dist/index.js",type:"module",bin:{pickled:"./dist/index.js"},files:["dist"],scripts:{dev:"bun run ./src/index.ts",build:"bun build ./src/index.ts --outdir ./dist --target bun --minify --external @anthropic-ai/claude-agent-sdk",release:"semantic-release"},dependencies:{commander:"^14.0.2",chalk:"^5.6.2","@anthropic-ai/claude-agent-sdk":"^0.3.0"},devDependencies:{"@pickled-dev/config":"workspace:*","@pickled-dev/core":"workspace:*","semantic-release":"^25.0.2","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/exec":"^7.1.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","semantic-release-ai-notes":"^0.3.0"}};import yW from"path";var z0={category:"cli",provider:"claude-code",model:"sonnet"},t2=["Read","Glob","Grep","Bash"],e2=["Edit","MultiEdit","Write","NotebookEdit"];var R8=r4(I8(),1);async function Z$($){let X=`${$}/pickled.yml`,Z=Bun.file(X);if(!await Z.exists())throw Error(`pickled.yml not found in ${$}`);let q;try{let z=await Z.text();q=R8.default.parse(z)}catch(z){throw Error(`Failed to parse pickled.yml: ${z}`)}return EU(q),q}function EU($){if(!$.tool?.name)throw Error("pickled.yml: 'tool.name' is required");if(!Array.isArray($.scenarios)||$.scenarios.length===0)throw Error("pickled.yml: 'scenarios' must be a non-empty array");if($.docs?.sources)for(let[Z,q]of Object.entries($.docs.sources))bU(Z,q);if($.targets)for(let[Z,q]of Object.entries($.targets)){if(q.systemPrompt!==void 0)throw Error(`pickled.yml: target "${Z}" sets 'systemPrompt', which bypasses the citation contract. Remove it; custom prompts are not supported in citation mode.`);if(q.provider==="codex-cli"){if(!q.model)throw Error(`pickled.yml: target "${Z}" (codex-cli) requires an explicit 'model' field. Codex's default model can change without notice; pin it for reproducible evals.`);if(q.maxTurns!==void 0)throw Error(`pickled.yml: target "${Z}" (codex-cli) sets 'maxTurns', but the codex CLI does not support a turn cap. Remove the field.`)}if(q.category==="api"){if(!q.model)throw Error(`pickled.yml: target "${Z}" (api/${q.provider}) requires an explicit 'model' field. Pickled does not substitute a default; reproducible evals depend on pinning the model.`);let z=["allowedTools","disallowedTools","mcpServers","permissionMode","maxTurns","maxThinkingTokens","maxBudgetUsd"];for(let G of z)if(q[G]!==void 0)throw Error(`pickled.yml: target "${Z}" (api/${q.provider}) sets '${G}', which only applies to CLI/Agent SDK targets. Remove the field; API targets accept only model/temperature/maxTokens/threshold.`);if(q.workspaceContext!==void 0)throw Error(`pickled.yml: target "${Z}" (api/${q.provider}) sets 'workspaceContext', which only applies to IDE targets. Remove the field.`)}}let X=new Set(Object.keys($.docs?.sources??{}));for(let Z of $.scenarios){if(!Z.name||!Z.prompt)throw Error("pickled.yml: every scenario needs 'name' and 'prompt'");if(!Array.isArray(Z.requiredSources))throw Error(`pickled.yml: scenario "${Z.name}" is missing 'requiredSources' (use [] to allow any citation)`);for(let q of Z.requiredSources)if(!X.has(q))throw Error(`pickled.yml: scenario "${Z.name}" references unknown source "${q}". Declared sources: ${[...X].join(", ")||"(none)"}`);fU(Z.name,Z.traps),CU(Z.name,Z.compareSurfaces,X)}}function CU($,X,Z){if(X===void 0)return;if(!Array.isArray(X))throw Error(`pickled.yml: scenario "${$}" compareSurfaces must be an array of source-id lists`);if(X.length===0)throw Error(`pickled.yml: scenario "${$}" compareSurfaces cannot be empty (use a non-empty list of surfaces, or remove the field)`);for(let q=0;q<X.length;q++){let z=X[q];if(!Array.isArray(z))throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${q}] must be an array of source ids`);if(z.length===0)throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${q}] must be a non-empty list of source ids`);for(let G of z){if(typeof G!=="string")throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${q}] entries must be string source ids`);if(!Z.has(G))throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${q}] references unknown source "${G}". Declared sources: ${[...Z].join(", ")||"(none)"}`)}}}function bU($,X){if(typeof X==="string"){if(X.length===0)throw Error(`pickled.yml: docs.sources["${$}"] string form must be a non-empty file path or URL`);return}if(!X||typeof X!=="object")throw Error(`pickled.yml: docs.sources["${$}"] must be a string (path/URL) or an object with a 'path' field`);let Z=X;if(typeof Z.path!=="string"||Z.path.length===0)throw Error(`pickled.yml: docs.sources["${$}"] object form requires a non-empty 'path' field`);if(Z.audit!==void 0){if(typeof Z.audit!=="object"||Z.audit===null)throw Error(`pickled.yml: docs.sources["${$}"].audit must be an object`);let q=Z.audit;if(q.traps!==void 0&&typeof q.traps!=="boolean")throw Error(`pickled.yml: docs.sources["${$}"].audit.traps must be a boolean`);for(let z of Object.keys(q))if(z!=="traps")throw Error(`pickled.yml: docs.sources["${$}"].audit has unknown field "${z}"`)}for(let q of Object.keys(Z))if(q!=="path"&&q!=="audit")throw Error(`pickled.yml: docs.sources["${$}"] has unknown field "${q}"`)}var yU=new Set(["g","y"]),xU=new Set(["i","m","s","u","v"]);function fU($,X){if(X===void 0)return;if(!Array.isArray(X))throw Error(`pickled.yml: scenario "${$}" has non-array 'traps'`);let Z=new Set;for(let q of X){if(!q.id||typeof q.id!=="string")throw Error(`pickled.yml: scenario "${$}" has a trap missing 'id'`);if(Z.has(q.id))throw Error(`pickled.yml: scenario "${$}" has duplicate trap id "${q.id}"`);if(Z.add(q.id),!q.reason||typeof q.reason!=="string")throw Error(`pickled.yml: scenario "${$}" trap "${q.id}" requires non-empty 'reason'`);if(q.auditSeverity!==void 0&&q.auditSeverity!=="warning"&&q.auditSeverity!=="error")throw Error(`pickled.yml: scenario "${$}" trap "${q.id}" auditSeverity must be "warning" or "error"`);let z=typeof q.match==="string",G=typeof q.pattern==="string";if(z===G)throw Error(`pickled.yml: scenario "${$}" trap "${q.id}" must set exactly one of 'match' or 'pattern'`);if(z){if(q.match==="")throw Error(`pickled.yml: scenario "${$}" trap "${q.id}" has empty 'match'`);if(q.flags!==void 0)throw Error(`pickled.yml: scenario "${$}" trap "${q.id}" sets 'flags' without 'pattern'`)}else{let J=q.pattern;if(typeof J!=="string")throw Error(`pickled.yml: scenario "${$}" trap "${q.id}" must set 'pattern'`);if(J==="")throw Error(`pickled.yml: scenario "${$}" trap "${q.id}" has empty 'pattern'`);if(q.flags!==void 0){if(typeof q.flags!=="string")throw Error(`pickled.yml: scenario "${$}" trap "${q.id}" has non-string 'flags'`);for(let Q of q.flags){if(yU.has(Q))throw Error(`pickled.yml: scenario "${$}" trap "${q.id}" uses forbidden regex flag "${Q}" (g and y are not allowed)`);if(!xU.has(Q))throw Error(`pickled.yml: scenario "${$}" trap "${q.id}" uses unsupported regex flag "${Q}"`)}}try{new RegExp(J,q.flags??"")}catch(Q){throw Error(`pickled.yml: scenario "${$}" trap "${q.id}" has invalid regex pattern: ${Q instanceof Error?Q.message:Q}`)}}}}function W4($,X){let Z=new Set([...Object.keys($.targets??{}),"default"]);if(!Z.has(X)){let q=[...Z].sort().join(", ");throw Error(`Unknown target: "${X}". Available targets: ${q}`)}return{...$,matrix:{...$.matrix,target:[X]},scenarios:$.scenarios.filter((q)=>!q.target||q.target===X)}}function V4($){if(typeof $==="string")return{path:$,auditTraps:!0};return{path:$.path,auditTraps:$.audit?.traps??!0}}function Z2($){let{config:X,files:Z,pairs:q,findings:z}=$,G=[],J=z.filter((H)=>H.severity==="error").length,Q=z.filter((H)=>H.severity==="warning").length;if(G.push(`# Agent-context audit
166
+ `,X)+1}return{type:$,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue($){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 X=$2($),Z=X$(X);return Z.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Z,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let X=$2($),Z=X$(X);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:Z,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,X){if(this.type!=="comment")return!1;if(this.indent<=X)return!1;return $.every((Z)=>Z.type==="newline"||Z.type==="space")}*documentEnd($){if(this.type!=="doc-mode"){if($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd($){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($.end)$.end.push(this.sourceToken);else $.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}SY.Parser=L6});var O6=D((hY)=>{var D6=e4(),EY=g$(),p$=h$(),bY=U4(),xY=S(),yY=U9(),_6=H9();function F6($){let X=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||X&&new yY.LineCounter||null,prettyErrors:X}}function kY($,X={}){let{lineCounter:Z,prettyErrors:z}=F6(X),q=new _6.Parser(Z?.addNewLine),G=new D6.Composer(X),J=Array.from(G.compose(q.parse($)));if(z&&Z)for(let Q of J)Q.errors.forEach(p$.prettifyError($,Z)),Q.warnings.forEach(p$.prettifyError($,Z));if(J.length>0)return J;return Object.assign([],{empty:!0},G.streamInfo())}function M6($,X={}){let{lineCounter:Z,prettyErrors:z}=F6(X),q=new _6.Parser(Z?.addNewLine),G=new D6.Composer(X),J=null;for(let Q of G.compose(q.parse($),!0,$.length))if(!J)J=Q;else if(J.options.logLevel!=="silent"){J.errors.push(new p$.YAMLParseError(Q.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&Z)J.errors.forEach(p$.prettifyError($,Z)),J.warnings.forEach(p$.prettifyError($,Z));return J}function fY($,X,Z){let z=void 0;if(typeof X==="function")z=X;else if(Z===void 0&&X&&typeof X==="object")Z=X;let q=M6($,Z);if(!q)return null;if(q.warnings.forEach((G)=>bY.warn(q.options.logLevel,G)),q.errors.length>0)if(q.options.logLevel!=="silent")throw q.errors[0];else q.errors=[];return q.toJS(Object.assign({reviver:z},Z))}function gY($,X,Z){let z=null;if(typeof X==="function"||Array.isArray(X))z=X;else if(Z===void 0&&X)Z=X;if(typeof Z==="string")Z=Z.length;if(typeof Z==="number"){let q=Math.round(Z);Z=q<1?void 0:q>8?{indent:8}:{indent:q}}if($===void 0){let{keepUndefined:q}=Z??X??{};if(!q)return}if(xY.isDocument($)&&!z)return $.toString(Z);return new EY.Document($,z,Z).toString(Z)}hY.parse=fY;hY.parseAllDocuments=kY;hY.parseDocument=M6;hY.stringify=gY});var I6=D((XU)=>{var pY=e4(),lY=g$(),cY=g4(),W9=h$(),iY=w$(),I0=S(),aY=_0(),sY=g(),nY=M0(),rY=O0(),oY=t1(),tY=Y9(),eY=U9(),$U=H9(),X2=O6(),w6=M$();XU.Composer=pY.Composer;XU.Document=lY.Document;XU.Schema=cY.Schema;XU.YAMLError=W9.YAMLError;XU.YAMLParseError=W9.YAMLParseError;XU.YAMLWarning=W9.YAMLWarning;XU.Alias=iY.Alias;XU.isAlias=I0.isAlias;XU.isCollection=I0.isCollection;XU.isDocument=I0.isDocument;XU.isMap=I0.isMap;XU.isNode=I0.isNode;XU.isPair=I0.isPair;XU.isScalar=I0.isScalar;XU.isSeq=I0.isSeq;XU.Pair=aY.Pair;XU.Scalar=sY.Scalar;XU.YAMLMap=nY.YAMLMap;XU.YAMLSeq=rY.YAMLSeq;XU.CST=oY;XU.Lexer=tY.Lexer;XU.LineCounter=eY.LineCounter;XU.Parser=$U.Parser;XU.parse=X2.parse;XU.parseAllDocuments=X2.parseAllDocuments;XU.parseDocument=X2.parseDocument;XU.stringify=X2.stringify;XU.visit=w6.visit;XU.visitAsync=w6.visitAsync});var T5=r9(V5(),1),{program:l0,createCommand:XV,createArgument:ZV,createOption:zV,CommanderError:qV,InvalidArgumentError:GV,InvalidOptionArgumentError:JV,Command:QV,Argument:YV,Option:t2,Help:UV}=T5.default;var B5={name:"@pickled-dev/cli",version:"0.14.0",description:"Test what agents actually understand about your product",module:"dist/index.js",type:"module",bin:{pickled:"./dist/index.js"},files:["dist"],scripts:{dev:"bun run ./src/index.ts",build:"bun build ./src/index.ts --outdir ./dist --target bun --minify --external @anthropic-ai/claude-agent-sdk",release:"semantic-release"},dependencies:{commander:"^14.0.2",chalk:"^5.6.2","@anthropic-ai/claude-agent-sdk":"^0.3.0"},devDependencies:{"@pickled-dev/config":"workspace:*","@pickled-dev/core":"workspace:*","semantic-release":"^25.0.2","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/exec":"^7.1.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","semantic-release-ai-notes":"^0.3.0"}};import uW from"path";var q0={category:"cli",provider:"claude-code",model:"sonnet"},e2=["Read","Glob","Grep","Bash"],$4=["Edit","MultiEdit","Write","NotebookEdit"];var R6=r9(I6(),1);async function Z$($){let X=`${$}/pickled.yml`,Z=Bun.file(X);if(!await Z.exists())throw Error(`pickled.yml not found in ${$}`);let z;try{let q=await Z.text();z=R6.default.parse(q)}catch(q){throw Error(`Failed to parse pickled.yml: ${q}`)}return EU(z),z}function EU($){if(!$.tool?.name)throw Error("pickled.yml: 'tool.name' is required");if(!Array.isArray($.scenarios)||$.scenarios.length===0)throw Error("pickled.yml: 'scenarios' must be a non-empty array");if($.docs?.sources)for(let[Z,z]of Object.entries($.docs.sources))yU(Z,z);if($.targets)for(let[Z,z]of Object.entries($.targets)){if(z.systemPrompt!==void 0)throw Error(`pickled.yml: target "${Z}" sets 'systemPrompt', which bypasses the citation contract. Remove it; custom prompts are not supported in citation mode.`);if(z.provider==="codex-cli"){if(!z.model)throw Error(`pickled.yml: target "${Z}" (codex-cli) requires an explicit 'model' field. Codex's default model can change without notice; pin it for reproducible evals.`);if(z.maxTurns!==void 0)throw Error(`pickled.yml: target "${Z}" (codex-cli) sets 'maxTurns', but the codex CLI does not support a turn cap. Remove the field.`)}if(z.category==="api"){if(!z.model)throw Error(`pickled.yml: target "${Z}" (api/${z.provider}) requires an explicit 'model' field. Pickled does not substitute a default; reproducible evals depend on pinning the model.`);let q=["allowedTools","disallowedTools","mcpServers","permissionMode","maxTurns","maxThinkingTokens","maxBudgetUsd"];for(let G of q)if(z[G]!==void 0)throw Error(`pickled.yml: target "${Z}" (api/${z.provider}) sets '${G}', which only applies to CLI/Agent SDK targets. Remove the field; API targets accept only model/temperature/maxTokens/threshold.`);if(z.workspaceContext!==void 0)throw Error(`pickled.yml: target "${Z}" (api/${z.provider}) sets 'workspaceContext', which only applies to IDE targets. Remove the field.`)}}let X=new Set(Object.keys($.docs?.sources??{}));for(let Z of $.scenarios){if(!Z.name||!Z.prompt)throw Error("pickled.yml: every scenario needs 'name' and 'prompt'");if(!Array.isArray(Z.requiredSources))throw Error(`pickled.yml: scenario "${Z.name}" is missing 'requiredSources' (use [] to allow any citation)`);for(let z of Z.requiredSources)if(!X.has(z))throw Error(`pickled.yml: scenario "${Z.name}" references unknown source "${z}". Declared sources: ${[...X].join(", ")||"(none)"}`);gU(Z.name,Z.traps),xU(Z.name,Z.compareSurfaces,X)}bU($)}function bU($){if(!$.docs?.sources)return;let X=[];for(let[z,q]of Object.entries($.docs.sources)){if(typeof q==="string")continue;let G=q.audit?.traps;if(Array.isArray(G))X.push({id:z,list:G})}if(X.length===0)return;let Z=new Map;for(let z of $.scenarios)for(let q of z.traps??[]){let G=Z.get(q.id);if(G!==void 0)throw Error(`pickled.yml: trap id "${q.id}" is declared in both scenario "${G}" and scenario "${z.name}". Globally unique trap ids are required when any source uses list-form audit.traps suppression. Rename one of the traps.`);Z.set(q.id,z.name)}for(let{id:z,list:q}of X)for(let G of q)if(!Z.has(G)){let J=[...Z.keys()].join(", ")||"(none)";throw Error(`pickled.yml: docs.sources["${z}"].audit.traps lists unknown trap id "${G}". Declared trap ids: ${J}`)}}function xU($,X,Z){if(X===void 0)return;if(!Array.isArray(X))throw Error(`pickled.yml: scenario "${$}" compareSurfaces must be an array of source-id lists`);if(X.length===0)throw Error(`pickled.yml: scenario "${$}" compareSurfaces cannot be empty (use a non-empty list of surfaces, or remove the field)`);for(let z=0;z<X.length;z++){let q=X[z];if(!Array.isArray(q))throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] must be an array of source ids`);if(q.length===0)throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] must be a non-empty list of source ids`);for(let G of q){if(typeof G!=="string")throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] entries must be string source ids`);if(!Z.has(G))throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] references unknown source "${G}". Declared sources: ${[...Z].join(", ")||"(none)"}`)}}}function yU($,X){if(typeof X==="string"){if(X.length===0)throw Error(`pickled.yml: docs.sources["${$}"] string form must be a non-empty file path or URL`);return}if(!X||typeof X!=="object")throw Error(`pickled.yml: docs.sources["${$}"] must be a string (path/URL) or an object with a 'path' field`);let Z=X;if(typeof Z.path!=="string"||Z.path.length===0)throw Error(`pickled.yml: docs.sources["${$}"] object form requires a non-empty 'path' field`);if(Z.audit!==void 0){if(typeof Z.audit!=="object"||Z.audit===null)throw Error(`pickled.yml: docs.sources["${$}"].audit must be an object`);let z=Z.audit;if(z.traps!==void 0){let q=z.traps;if(typeof q==="boolean");else if(Array.isArray(q)){if(q.length===0)throw Error(`pickled.yml: docs.sources["${$}"].audit.traps cannot be an empty array; use true (scan all) or false (skip all) instead`);for(let G=0;G<q.length;G++)if(typeof q[G]!=="string")throw Error(`pickled.yml: docs.sources["${$}"].audit.traps[${G}] must be a string trap id`)}else throw Error(`pickled.yml: docs.sources["${$}"].audit.traps must be a boolean or an array of trap ids`)}for(let q of Object.keys(z))if(q!=="traps")throw Error(`pickled.yml: docs.sources["${$}"].audit has unknown field "${q}"`)}if(Z.type!==void 0){if(Z.type!=="file"&&Z.type!=="url"&&Z.type!=="codebase")throw Error(`pickled.yml: docs.sources["${$}"].type must be "file", "url", or "codebase"`)}if(Z.type==="codebase"){if(typeof Z.path==="string"&&Z.path.split("/").includes(".."))throw Error(`pickled.yml: docs.sources["${$}"].path must not contain ".." segments. Codebase loader stays within the project root.`);if(Z.exclude!==void 0){if(!Array.isArray(Z.exclude))throw Error(`pickled.yml: docs.sources["${$}"].exclude must be an array of glob patterns`);for(let z=0;z<Z.exclude.length;z++)if(typeof Z.exclude[z]!=="string")throw Error(`pickled.yml: docs.sources["${$}"].exclude[${z}] must be a string glob pattern`)}if(Z.maxBytes!==void 0){if(typeof Z.maxBytes!=="number"||!Number.isFinite(Z.maxBytes)||Z.maxBytes<=0)throw Error(`pickled.yml: docs.sources["${$}"].maxBytes must be a positive number of bytes`)}}else{if(Z.exclude!==void 0)throw Error(`pickled.yml: docs.sources["${$}"].exclude only applies to type: codebase sources`);if(Z.maxBytes!==void 0)throw Error(`pickled.yml: docs.sources["${$}"].maxBytes only applies to type: codebase sources`)}for(let z of Object.keys(Z))if(z!=="path"&&z!=="audit"&&z!=="type"&&z!=="exclude"&&z!=="maxBytes")throw Error(`pickled.yml: docs.sources["${$}"] has unknown field "${z}"`)}var kU=new Set(["g","y"]),fU=new Set(["i","m","s","u","v"]);function gU($,X){if(X===void 0)return;if(!Array.isArray(X))throw Error(`pickled.yml: scenario "${$}" has non-array 'traps'`);let Z=new Set;for(let z of X){if(!z.id||typeof z.id!=="string")throw Error(`pickled.yml: scenario "${$}" has a trap missing 'id'`);if(Z.has(z.id))throw Error(`pickled.yml: scenario "${$}" has duplicate trap id "${z.id}"`);if(Z.add(z.id),!z.reason||typeof z.reason!=="string")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" requires non-empty 'reason'`);if(z.auditSeverity!==void 0&&z.auditSeverity!=="warning"&&z.auditSeverity!=="error")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" auditSeverity must be "warning" or "error"`);let q=typeof z.match==="string",G=typeof z.pattern==="string";if(q===G)throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" must set exactly one of 'match' or 'pattern'`);if(q){if(z.match==="")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" has empty 'match'`);if(z.flags!==void 0)throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" sets 'flags' without 'pattern'`)}else{let J=z.pattern;if(typeof J!=="string")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" must set 'pattern'`);if(J==="")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" has empty 'pattern'`);if(z.flags!==void 0){if(typeof z.flags!=="string")throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" has non-string 'flags'`);for(let Q of z.flags){if(kU.has(Q))throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" uses forbidden regex flag "${Q}" (g and y are not allowed)`);if(!fU.has(Q))throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" uses unsupported regex flag "${Q}"`)}}try{new RegExp(J,z.flags??"")}catch(Q){throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" has invalid regex pattern: ${Q instanceof Error?Q.message:Q}`)}}}}function V9($,X){let Z=new Set([...Object.keys($.targets??{}),"default"]);if(!Z.has(X)){let z=[...Z].sort().join(", ");throw Error(`Unknown target: "${X}". Available targets: ${z}`)}return{...$,matrix:{...$.matrix,target:[X]},scenarios:$.scenarios.filter((z)=>!z.target||z.target===X)}}function T9($){if(typeof $==="string")return{path:$,auditTraps:!0};return{path:$.path,auditTraps:$.audit?.traps??!0}}function Z2($){let{config:X,files:Z,pairs:z,findings:q}=$,G=[],J=q.filter((H)=>H.severity==="error").length,Q=q.filter((H)=>H.severity==="warning").length;if(G.push(`# Agent-context audit
167
167
  `),G.push(`Target: \`${X.targetRepo}\``),G.push(`Budgets: root \u2264 ${X.budgets.rootLines} lines, nested warn at ${X.budgets.nestedWarnLines} lines.`),G.push(`Found ${Z.length} agent-doc files. ${J} error(s), ${Q} warning(s).
168
168
  `),G.push(`## Inventory
169
169
  `),Z.length===0)G.push(`No agent-doc files found.
170
- `);else{G.push("| File | Lines | Kind | Notes |"),G.push("|---|---|---|---|");let H=[...Z].sort((V,w)=>w.lineCount-V.lineCount);for(let V of H){let w=!V.relPath.includes("/"),B=P8(V.lineCount,w,X),T=V.isSymlink?`symlink \u2192 ${V.symlinkTarget?.replace(`${X.targetRepo}/`,"")??"?"}`:"file";G.push(`| \`${V.relPath}\` | ${V.lineCount} | ${T} | ${B} |`)}G.push("")}if(G.push(`## AGENTS.md / CLAUDE.md pairs
171
- `),q.length===0)G.push(`No pairs found.
172
- `);else{G.push("| Directory | A | C | Class | Detail |"),G.push("|---|---|---|---|---|");for(let H of q)G.push(`| \`${H.dir||"(root)"}\` | ${H.agentsExists?"\u2713":"\xB7"} | ${H.claudeExists?"\u2713":"\xB7"} | ${H.classification} | ${H.detail} |`);G.push("")}let Y=Z.filter((H)=>!H.isSymlink&&H.brokenPathRefs.length+H.brokenImports.length>0);if(G.push(`## Broken references
170
+ `);else{G.push("| File | Lines | Kind | Notes |"),G.push("|---|---|---|---|");let H=[...Z].sort((V,B)=>B.lineCount-V.lineCount);for(let V of H){let B=!V.relPath.includes("/"),L=P6(V.lineCount,B,X),T=V.isSymlink?`symlink \u2192 ${V.symlinkTarget?.replace(`${X.targetRepo}/`,"")??"?"}`:"file";G.push(`| \`${V.relPath}\` | ${V.lineCount} | ${T} | ${L} |`)}G.push("")}if(G.push(`## AGENTS.md / CLAUDE.md pairs
171
+ `),z.length===0)G.push(`No pairs found.
172
+ `);else{G.push("| Directory | A | C | Class | Detail |"),G.push("|---|---|---|---|---|");for(let H of z)G.push(`| \`${H.dir||"(root)"}\` | ${H.agentsExists?"\u2713":"\xB7"} | ${H.claudeExists?"\u2713":"\xB7"} | ${H.classification} | ${H.detail} |`);G.push("")}let Y=Z.filter((H)=>!H.isSymlink&&H.brokenPathRefs.length+H.brokenImports.length>0);if(G.push(`## Broken references
173
173
  `),Y.length===0)G.push(`None detected.
174
174
  `);else for(let H of Y){if(G.push(`### \`${H.relPath}\`
175
175
  `),H.brokenPathRefs.length>0){G.push("Broken path references:");for(let V of H.brokenPathRefs)G.push(` - \`${V}\``);G.push("")}if(H.brokenImports.length>0){G.push("Broken `@`-imports:");for(let V of H.brokenImports)G.push(` - \`${V}\``);G.push("")}}let U=Z.filter((H)=>!H.isSymlink&&H.unresolvedCommands.length>0);if(G.push(`## Unresolved package-manager commands (advisory)
@@ -180,31 +180,34 @@ ${X.comment}`:X.comment}this.doc.range[2]=X.offset;break}default:this.errors.pus
180
180
  `);else for(let H of W){G.push(`### \`${H.relPath}\` (${H.lineCount} lines)
181
181
  `),G.push(`Largest H2 sections (lines including any subsections):
182
182
  `),G.push("| Section | Lines |"),G.push("|---|---|");for(let V of H.sections.slice(0,10))G.push(`| ${V.header} | ${V.lines} |`);G.push("")}if(G.push(`## Registered-source trap matches
183
- `),G.push("Catches stale claims in `docs.sources` against declared traps. Sources with `audit.traps: false` are excluded.\n"),$.sourceTrapMatches.length===0)G.push(`None.
184
- `);else{for(let H of $.sourceTrapMatches)G.push(`- **${H.sourceId}** (\`${H.sourcePath}:L${H.line}\`) \u2014 trap \`${H.trapId}\` matched \`${H.matched}\` (${H.severity})`),G.push(` - reason: ${H.trapReason}`),G.push(" - fix: remove the stale claim, retire the trap, or set `audit.traps: false` on the source");G.push("")}return G.join(`
185
- `)}function q2($){return JSON.stringify($,null,2)}function z2($){let{config:X,files:Z,pairs:q,findings:z}=$,G=[],J=z.filter((H)=>H.severity==="error").length,Q=z.filter((H)=>H.severity==="warning").length;if(G.push("pickled audit"),G.push(`Target: ${X.targetRepo}`),G.push(`Budgets: root \u2264 ${X.budgets.rootLines} lines, nested warn at ${X.budgets.nestedWarnLines} lines.`),G.push(`Found: ${Z.length} agent-doc file(s) \xB7 ${J} error(s) \xB7 ${Q} warning(s)`),G.push(""),G.push("Inventory"),Z.length===0)G.push(" none");else{let H=[...Z].sort((w,B)=>B.lineCount-w.lineCount),V=Math.max(...H.map((w)=>w.relPath.length));for(let w of H){let B=!w.relPath.includes("/"),T=P8(w.lineCount,B,X),L=w.isSymlink?`symlink \u2192 ${w.symlinkTarget?.replace(`${X.targetRepo}/`,"")??"?"}`:"file",D=`${w.lineCount}`.padStart(4),_=w.relPath.padEnd(V),O=T?` (${T})`:"";G.push(` ${_} ${D} lines ${L}${O}`)}}if(G.push(""),G.push("AGENTS.md / CLAUDE.md pairs"),q.length===0)G.push(" none");else for(let H of q){let V=H.dir||"(root)";G.push(` ${V}: ${H.classification} \xB7 ${H.detail}`)}G.push("");let Y=Z.filter((H)=>!H.isSymlink&&H.brokenPathRefs.length+H.brokenImports.length>0);if(G.push("Broken references"),Y.length===0)G.push(" none");else for(let H of Y){G.push(` ${H.relPath}:`);for(let V of H.brokenPathRefs)G.push(` path: ${V}`);for(let V of H.brokenImports)G.push(` @-import: ${V}`)}G.push("");let U=Z.filter((H)=>!H.isSymlink&&H.unresolvedCommands.length>0);if(G.push("Unresolved package-manager commands (advisory)"),U.length===0)G.push(" none");else for(let H of U){G.push(` ${H.relPath}:`);for(let V of H.unresolvedCommands)G.push(` ${V}`)}G.push("");let W=Z.filter((H)=>{if(H.isSymlink)return!1;return!H.relPath.includes("/")?H.lineCount>X.budgets.rootLines:H.lineCount>X.budgets.nestedWarnLines});if(G.push("Section breakdown for files over budget"),W.length===0)G.push(" all files within budget");else for(let H of W){G.push(` ${H.relPath} (${H.lineCount} lines):`);for(let V of H.sections.slice(0,10))G.push(` ${V.header.padEnd(40)} ${V.lines} lines`)}if(G.push(""),G.push("Registered-source trap matches"),$.sourceTrapMatches.length===0)G.push(" none");else for(let H of $.sourceTrapMatches){let V=H.severity==="error"?"error":"warning";G.push(` [${V}] ${H.sourceId} (${H.sourcePath}:L${H.line}): trap ${H.trapId} matched "${H.matched}"`),G.push(` reason: ${H.trapReason}`),G.push(" fix: remove the stale claim, retire the trap, or set audit.traps: false on the source")}return G.join(`
186
- `)}function P8($,X,Z){if(X&&$>Z.budgets.rootLines)return`over root budget (${$} > ${Z.budgets.rootLines})`;if(!X&&$>Z.budgets.nestedWarnLines)return`over nested-warn (${$} > ${Z.budgets.nestedWarnLines})`;return""}import{existsSync as z$,lstatSync as E8,readFileSync as Q2,readlinkSync as pU,statSync as cU}from"fs";import{dirname as Y2,isAbsolute as lU,join as w4,relative as iU,resolve as L4}from"path";var{Glob:j8}=globalThis.Bun;var G2=["node_modules/**","**/node_modules/**",".git/**","**/.git/**","dist/**","**/dist/**","build/**","**/build/**",".next/**","**/.next/**",".turbo/**","**/.turbo/**",".cache/**","**/.cache/**",".runs/**","**/.runs/**","coverage/**","**/coverage/**","**/__fixtures__/**","**/tests/**/fixture/**","**/tests/**/fixtures/**","**/test/**/fixture/**","**/test/**/fixtures/**"],q$={targetRepo:".",budgets:{rootLines:120,nestedWarnLines:200},ignore:G2,intentionalDifferentPairs:[],knownCommands:[]};function J2($){if(!$)return q$;return{targetRepo:$.targetRepo??q$.targetRepo,budgets:{rootLines:$.budgets?.rootLines??q$.budgets.rootLines,nestedWarnLines:$.budgets?.nestedWarnLines??q$.budgets.nestedWarnLines},ignore:$.ignore??G2,intentionalDifferentPairs:$.intentionalDifferentPairs??[],knownCommands:$.knownCommands??[]}}import{existsSync as uU}from"fs";import{join as mU}from"path";function f0($){let X=[],Z=[];for(let q of $.traps){let z=kU($.response,q);if(z)X.push(z);else Z.push(q.id)}return{fired:X,avoided:Z}}function kU($,X){if(X.match!==void 0){let Z=$.indexOf(X.match);if(Z===-1)return null;return{id:X.id,reason:X.reason,matched:X.match,snippet:N8($,Z,X.match.length),index:Z}}if(X.pattern!==void 0){let q=new RegExp(X.pattern,X.flags??"").exec($);if(!q)return null;return{id:X.id,reason:X.reason,matched:q[0],snippet:N8($,q.index,q[0].length),index:q.index}}return null}function N8($,X,Z){let q=Math.max(0,X-40),z=Math.min($.length,X+Z+40),G=$.slice(q,z).replace(/\s+/g," ").trim();if(q>0)G=`...${G}`;if(z<$.length)G=`${G}...`;return G}import T4 from"path";function gU($){return $.startsWith("http://")||$.startsWith("https://")}async function hU($,X,Z){let q=await fetch(X);if(!q.ok)throw Error(`Failed to fetch source "${$}" from ${X}: ${q.status} ${q.statusText}`);let z=await q.text();return{id:$,source:X,content:z,name:new URL(X).hostname+new URL(X).pathname,type:"url",auditTraps:Z}}async function vU($,X,Z,q){let z=T4.isAbsolute(X)?X:T4.resolve(Z,X),G=Bun.file(z);if(!await G.exists())throw Error(`Source "${$}" not found at ${z}`);let J=await G.text();return{id:$,source:X,content:J,name:T4.basename(z),type:"file",auditTraps:q}}async function A8($,X,Z){let{path:q,auditTraps:z}=V4(X);if(gU(q))return hU($,q,z);return vU($,q,Z,z)}async function c$($,X){let Z=Object.entries($);return await Promise.all(Z.map(([z,G])=>A8(z,G,X)))}async function S8($){if(!uU(mU($,"pickled.yml")))return{matches:[],findings:[]};let X=await Z$($),Z=X.docs?.sources;if(!Z||Object.keys(Z).length===0)return{matches:[],findings:[]};let q={};for(let[U,W]of Object.entries(Z)){let H=typeof W==="string"?W:W.path;if(H.startsWith("http://")||H.startsWith("https://"))continue;q[U]=W}if(Object.keys(q).length===0)return{matches:[],findings:[]};let z=[],G=new Map;for(let U of X.scenarios)for(let W of U.traps??[])z.push(W),G.set(W,W.auditSeverity??"warning");if(z.length===0)return{matches:[],findings:[]};let J=await c$(q,$),Q=[],Y=[];for(let U of J){if(U.auditTraps===!1)continue;for(let W of z){let{fired:H}=f0({response:U.content,traps:[W]}),V=H[0];if(!V)continue;let w=dU(U.content,V.index),B=G.get(W)??"warning";Q.push({sourceId:U.id,sourcePath:U.source,trapId:V.id,trapReason:V.reason,matched:V.matched,snippet:V.snippet,line:w,severity:B}),Y.push({severity:B,category:"trap-source-match",file:U.source,message:`source [${U.id}] matches trap '${V.id}' ("${V.matched}"). ${V.reason} Fix: remove the stale claim from the source, retire the trap if no longer relevant, or set audit.traps: false on the source if it is deliberately stale or test-only.`})}}return{matches:Q,findings:Y}}function dU($,X){let Z=1,q=Math.min(X,$.length);for(let z=0;z<q;z++)if($[z]===`
187
- `)Z++;return Z}var aU=["AGENTS.md","CLAUDE.md","CLAUDE.local.md","llms.txt","llms-full.txt",".claude/CLAUDE.md",".claude/rules/*.md","**/AGENTS.md","**/CLAUDE.md","**/CLAUDE.local.md","**/llms.txt","**/llms-full.txt","**/.claude/CLAUDE.md","**/.claude/rules/*.md"];async function U2($){let X=J2($),Z=L4(X.targetRepo);if(!z$(Z))throw Error(`targetRepo does not exist: ${Z}`);let q=new Set;for(let U of aU){let W=new j8(U);for await(let H of W.scan({cwd:Z,dot:!0,onlyFiles:!1,followSymlinks:!1})){if(X.ignore.some((B)=>new j8(B).match(H)))continue;let V=w4(Z,H),w=E8(V);if(w.isFile()){q.add(H);continue}if(w.isSymbolicLink())try{if(cU(V).isFile())q.add(H)}catch{}}}let z=[];for(let U of[...q].sort())z.push(await sU(Z,U,w4(Z,U),X));let G=JH(z,X),J=QH(z,G,X),{matches:Q,findings:Y}=await S8(Z);return{config:X,files:z,pairs:G,findings:[...J,...Y],sourceTrapMatches:Q}}async function sU($,X,Z,q){let G=E8(Z).isSymbolicLink(),J=null,Q=X;if(G){let V=pU(Z),w=lU(V)?V:L4(Y2(Z),V);if(J=w,z$(w))Q=iU($,w)}let Y=G&&J&&z$(J)?J:Z,U=Q2(Y,"utf8"),W=(U.match(/\n/g)??[]).length,H=U.endsWith(`
188
- `)?W:W+1;return{relPath:X,absPath:Z,isSymlink:G,symlinkTarget:J,realRelPath:Q,lineCount:H,brokenPathRefs:rU(U,$,X),brokenImports:tU(U,Y2(Z)),unresolvedCommands:ZH(U,$,q.knownCommands),sections:qH(U)}}function nU($){let X=$.split("/");if(X.length<2)return null;if(X[0]==="packages"||X[0]==="apps"||X[0]==="shared")return`${X[0]}/${X[1]}`;if(X[0]==="tests")return X.slice(0,2).join("/");return null}function rU($,X,Z){let q=GH($),z=Y2(Z),G=nU(Z),J=new Set,Q=/`([^`\n]{2,200})`/g,Y;Y=Q.exec(q);while(Y!==null){let U=Y[1].trim().replace(/[#?].*$/,"");if(zH(U)&&!oU(X,U,z,G).found)J.add(U);Y=Q.exec(q)}return[...J].sort()}function oU($,X,Z,q){let z=[X];if(Z&&Z!==".")z.push(`${Z}/${X}`);if(q)z.push(`${q}/${X}`);z.push(`packages/${X}`,`apps/${X}`,`shared/${X}`);for(let G of z){let J=G.replace(/\/+/g,"/");if(z$(`${$}/${J}`))return{found:!0,resolvedAs:J}}return{found:!1}}function tU($,X){let Z=new Set,q=/@([\w./@~-]+\.md)/g,z;z=q.exec($);while(z!==null){let G=z[1];if(G.startsWith("~/")){z=q.exec($);continue}let J=G.startsWith("/")?G:L4(X,G);if(!z$(J))Z.add(G);z=q.exec($)}return[...Z].sort()}var eU=["bun","pnpm","npm","yarn"],$H=new Set(["install","add","remove","update","i","audit","list","ls","why","outdated","exec","run","create","init","x"]),XH={bun:new Set(["build","test","link","unlink","upgrade"])};function ZH($,X,Z){let q=new Set,z=w4(X,"package.json"),G=new Set;if(z$(z))try{let Q=JSON.parse(Q2(z,"utf8"));G=new Set(Object.keys(Q.scripts??{}))}catch{}let J=new Set(Z.map((Q)=>Q.trim()));for(let Q of eU){let Y=new RegExp(`\\b${Q}\\s+(?:run\\s+|--filter\\s+\\S+\\s+(?:run\\s+)?)?([a-zA-Z][\\w:.\\-]*)`,"g"),U;U=Y.exec($);while(U!==null){let W=U[1];if(!G.has(W)&&!J.has(`${Q} ${W}`)&&!J.has(`${Q} run ${W}`)&&!$H.has(W)&&!XH[Q]?.has(W))q.add(`${Q} ${W}`);U=Y.exec($)}}return[...q].sort()}function qH($){let X=$.split(`
189
- `),Z=[],q=null;if(X.forEach((z,G)=>{if(/^##\s+/.test(z)){if(q)Z.push({header:q.header,lines:G-q.start});q={header:z.replace(/^##\s+/,"").trim(),start:G}}}),q){let z=q;Z.push({header:z.header,lines:X.length-z.start})}return Z.sort((z,G)=>G.lines-z.lines)}function zH($){if($.length===0||$.length>160)return!1;if(!$.includes("/"))return!1;if(/\s/.test($))return!1;if(/^https?:\/\//.test($))return!1;if(/[*?{}[\]<>]/.test($))return!1;if($.startsWith("@"))return!1;if($.startsWith("~/"))return!1;if(/^[a-z]+:\/\//i.test($))return!1;if(/^cdn\./.test($)||/^unpkg\./.test($)||/^npm\./.test($))return!1;if(/^\/[a-z]/.test($)&&/(?:icon|image|img|asset|file|path)/i.test($))return!1;if(/^(cd|pnpm|npm|yarn|bun|node|git|ls|cat|grep|find|sed|awk|mkdir|rm|mv|cp|echo|export|source|sudo|brew|docker|curl|wget)\b/.test($))return!1;return/[a-zA-Z0-9_.-]\/[a-zA-Z0-9_.-]/.test($)}function GH($){return $.replace(/```[\s\S]*?```/g,"")}function JH($,X){let Z=new Map;for(let G of $){let J=G.relPath.split("/").pop()??"";if(J!=="AGENTS.md"&&J!=="CLAUDE.md")continue;let Q=Y2(G.relPath),Y=Z.get(Q)??{};if(J==="AGENTS.md")Y.agents=G;if(J==="CLAUDE.md")Y.claude=G;Z.set(Q,Y)}let q=new Set(X.intentionalDifferentPairs),z=[];for(let[G,J]of Z){let Q=!!J.agents,Y=!!J.claude;if(!Q&&!Y)continue;if(!Q||!Y){z.push({dir:G,agentsExists:Q,claudeExists:Y,classification:"single",detail:Q?"only AGENTS.md":"only CLAUDE.md"});continue}let{agents:U,claude:W}=J,H=`${U.relPath}:${W.relPath}`,V=`${W.relPath}:${U.relPath}`;if(q.has(H)||q.has(V)){z.push({dir:G,agentsExists:Q,claudeExists:Y,classification:"intentional-different",detail:`allowlisted: ${U.lineCount}L vs ${W.lineCount}L`});continue}if(U.isSymlink&&U.symlinkTarget===W.absPath||W.isSymlink&&W.symlinkTarget===U.absPath){let L=U.isSymlink?"CLAUDE.md":"AGENTS.md";z.push({dir:G,agentsExists:Q,claudeExists:Y,classification:"linked",detail:`canonical: ${L}`});continue}let B=Q2(U.absPath,"utf8"),T=Q2(W.absPath,"utf8");if(B===T)z.push({dir:G,agentsExists:Q,claudeExists:Y,classification:"unexpected-duplicate",detail:`byte-for-byte duplicate (${U.lineCount}L), not symlinked`});else z.push({dir:G,agentsExists:Q,claudeExists:Y,classification:"unexpected-duplicate",detail:`divergent (${U.lineCount}L vs ${W.lineCount}L), not in intentional-different allowlist`})}return z.sort((G,J)=>G.dir.localeCompare(J.dir)),z}function QH($,X,Z){let q=[];for(let z of $){if(z.isSymlink)continue;for(let Q of z.brokenImports)q.push({severity:"error",category:"broken-import",file:z.relPath,message:`broken @-import: ${Q}`});for(let Q of z.brokenPathRefs)q.push({severity:"error",category:"broken-path-ref",file:z.relPath,message:`broken path reference: ${Q}`});for(let Q of z.unresolvedCommands)q.push({severity:"warning",category:"unresolved-command",file:z.relPath,message:`unresolved command: ${Q}`});let G=!z.relPath.includes("/"),J=G?Z.budgets.rootLines:Z.budgets.nestedWarnLines;if(z.lineCount>J)q.push({severity:"warning",category:"over-budget",file:z.relPath,message:`${z.lineCount} lines exceeds ${G?"root":"nested"} budget of ${J}`})}for(let z of X)if(z.classification==="unexpected-duplicate"){let G=z.detail.startsWith("divergent")?"error":"warning";q.push({severity:G,category:G==="error"?"divergent-pair":"duplicate-pair",file:z.dir||"(root)",message:`AGENTS.md / CLAUDE.md ${z.detail}`})}return q}function k0($){let X=$.confidence;if($.error)return{icon:"\u2717",label:"Error",confidence:X,tone:"error"};if($.traps.fired.length>0)return{icon:"\u2717",label:"Trap fired",confidence:X,tone:"error"};if($.answerable==="YES")return{icon:"\u2713",label:X>=90?"Well grounded":"Grounded",confidence:X,tone:"success"};if($.answerable==="PARTIAL")return{icon:"\u26A0",label:"Partially grounded",confidence:X,tone:"warning"};return{icon:"\u2717",label:"Ungrounded",confidence:X,tone:"error"}}function B4($){let X=YH($);if(X===null)return[];let Z=[],q=/^\s*-\s+\[([^\]]+)\]\s*(.*)$/gm,z=q.exec(X);while(z!==null)Z.push({id:z[1].trim(),note:z[2].trim()||void 0}),z=q.exec(X);return Z}function YH($){let Z=/^##\s+Sources\s*$/im.exec($);if(!Z)return null;let q=Z.index+Z[0].length,z=$.slice(q),G=/^##\s+/m.exec(z);return G?z.slice(0,G.index):z}function l$($){let X=B4($.response),Z=new Set(X.map((V)=>V.id)),q=new Set($.registeredIds),z=new Set($.requiredSources),G=[...Z],J=[...z].filter((V)=>!Z.has(V)),Q=[...Z].filter((V)=>!q.has(V)),Y=[...z],U,W,H;if(G.length===0)U="NO",W=0,H="No citations in response";else if(Q.length===G.length)U="NO",W=0,H=`All cited sources are unknown: ${Q.join(", ")}`;else if(J.length===0&&Q.length===0)U="YES",W=100,H=Y.length>0?`All required sources cited: ${Y.join(", ")}`:`Cited registered sources: ${G.join(", ")}`;else{U="PARTIAL";let V=Y.length>0?Y.length:1,w=Y.length-J.length,B=Y.length>0?w/V*100:60,T=Q.length*15;W=Math.max(0,Math.min(100,Math.round(B-T)));let L=[];if(J.length>0)L.push(`missing: ${J.join(", ")}`);if(Q.length>0)L.push(`unknown: ${Q.join(", ")}`);H=L.join("; ")}return{answerable:U,confidence:W,reason:H,citations:{cited:G,required:Y,missing:J,unknown:Q}}}var g0="0.40.1";var C8=!1,h0=void 0,K4=void 0,UH=void 0,HH=void 0,WH=void 0,b8=void 0,VH=void 0,H2=void 0,D4=void 0,y8=void 0,_4=void 0,W2=void 0,x8=void 0;function f8($,X={auto:!1}){if(C8)throw Error(`you must \`import '@anthropic-ai/sdk/shims/${$.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(h0)throw Error(`can't \`import '@anthropic-ai/sdk/shims/${$.kind}'\` after \`import '@anthropic-ai/sdk/shims/${h0}'\``);C8=X.auto,h0=$.kind,K4=$.fetch,UH=$.Request,HH=$.Response,WH=$.Headers,b8=$.FormData,VH=$.Blob,H2=$.File,D4=$.ReadableStream,y8=$.getMultipartRequestOptions,_4=$.getDefaultAgent,W2=$.fileFromPath,x8=$.isFsReadStream}class F4{constructor($){this.body=$}get[Symbol.toStringTag](){return"MultipartBody"}}function k8({manuallyImported:$}={}){let X=$?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from '@anthropic-ai/sdk'`:\n- `import '@anthropic-ai/sdk/shims/node'` (if you're running on Node)\n- `import '@anthropic-ai/sdk/shims/web'` (otherwise)\n",Z,q,z,G;try{Z=fetch,q=Request,z=Response,G=Headers}catch(J){throw Error(`this environment is missing the following Web Fetch API type: ${J.message}. ${X}`)}return{kind:"web",fetch:Z,Request:q,Response:z,Headers:G,FormData:typeof FormData<"u"?FormData:class{constructor(){throw Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${X}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${X}`)}},File:typeof File<"u"?File:class{constructor(){throw Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${X}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${X}`)}},getMultipartRequestOptions:async(J,Q)=>({...Q,body:new F4(J)}),getDefaultAgent:(J)=>{return},fileFromPath:()=>{throw Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/anthropics/anthropic-sdk-typescript#file-uploads")},isFsReadStream:(J)=>!1}}import{ReadStream as wH}from"fs";function g8(){let $=k8();function X(Z){return Z instanceof wH}return{...$,isFsReadStream:X}}var O4=()=>{if(!h0)f8(g8(),{auto:!0})};O4();class P extends Error{}class v extends P{constructor($,X,Z,q){super(`${v.makeMessage($,X,Z)}`);this.status=$,this.headers=q,this.request_id=q?.["request-id"],this.error=X}static makeMessage($,X,Z){let q=X?.message?typeof X.message==="string"?X.message:JSON.stringify(X.message):X?JSON.stringify(X):Z;if($&&q)return`${$} ${q}`;if($)return`${$} status code (no body)`;if(q)return q;return"(no status code or body)"}static generate($,X,Z,q){if(!$||!q)return new v0({message:Z,cause:F2(X)});let z=X;if($===400)return new V2($,z,Z,q);if($===401)return new T2($,z,Z,q);if($===403)return new w2($,z,Z,q);if($===404)return new L2($,z,Z,q);if($===409)return new B2($,z,Z,q);if($===422)return new K2($,z,Z,q);if($===429)return new D2($,z,Z,q);if($>=500)return new _2($,z,Z,q);return new v($,z,Z,q)}}class m extends v{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class v0 extends v{constructor({message:$,cause:X}){super(void 0,void 0,$||"Connection error.",void 0);if(X)this.cause=X}}class i$ extends v0{constructor({message:$}={}){super({message:$??"Request timed out."})}}class V2 extends v{}class T2 extends v{}class w2 extends v{}class L2 extends v{}class B2 extends v{}class K2 extends v{}class D2 extends v{}class _2 extends v{}var O2=function($,X,Z,q,z){if(q==="m")throw TypeError("Private method is not writable");if(q==="a"&&!z)throw TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!z:!X.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return q==="a"?z.call($,Z):z?z.value=Z:X.set($,Z),Z},u0=function($,X,Z,q){if(Z==="a"&&!q)throw TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!q:!X.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return Z==="m"?q:Z==="a"?q.call($):q?q.value:X.get($)},l;class R0{constructor(){l.set(this,void 0),this.buffer=new Uint8Array,O2(this,l,null,"f")}decode($){if($==null)return[];let X=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?new TextEncoder().encode($):$,Z=new Uint8Array(this.buffer.length+X.length);Z.set(this.buffer),Z.set(X,this.buffer.length),this.buffer=Z;let q=[],z;while((z=BH(this.buffer,u0(this,l,"f")))!=null){if(z.carriage&&u0(this,l,"f")==null){O2(this,l,z.index,"f");continue}if(u0(this,l,"f")!=null&&(z.index!==u0(this,l,"f")+1||z.carriage)){q.push(this.decodeText(this.buffer.slice(0,u0(this,l,"f")-1))),this.buffer=this.buffer.slice(u0(this,l,"f")),O2(this,l,null,"f");continue}let G=u0(this,l,"f")!==null?z.preceding-1:z.preceding,J=this.decodeText(this.buffer.slice(0,G));q.push(J),this.buffer=this.buffer.slice(z.index),O2(this,l,null,"f")}return q}decodeText($){if($==null)return"";if(typeof $==="string")return $;if(typeof Buffer<"u"){if($ instanceof Buffer)return $.toString();if($ instanceof Uint8Array)return Buffer.from($).toString();throw new P(`Unexpected: received non-Uint8Array (${$.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if($ instanceof Uint8Array||$ instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode($);throw new P(`Unexpected: received non-Uint8Array/ArrayBuffer (${$.constructor.name}) in a web platform. Please report this error.`)}throw new P("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length)return[];return this.decode(`
190
- `)}}l=new WeakMap;R0.NEWLINE_CHARS=new Set([`
191
- `,"\r"]);R0.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function BH($,X){for(let z=X??0;z<$.length;z++){if($[z]===10)return{preceding:z,index:z+1,carriage:!1};if($[z]===13)return{preceding:z,index:z+1,carriage:!0}}return null}function h8($){for(let q=0;q<$.length-1;q++){if($[q]===10&&$[q+1]===10)return q+2;if($[q]===13&&$[q+1]===13)return q+2;if($[q]===13&&$[q+1]===10&&q+3<$.length&&$[q+2]===13&&$[q+3]===10)return q+4}return-1}function a$($){if($[Symbol.asyncIterator])return $;let X=$.getReader();return{async next(){try{let Z=await X.read();if(Z?.done)X.releaseLock();return Z}catch(Z){throw X.releaseLock(),Z}},async return(){let Z=X.cancel();return X.releaseLock(),await Z,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}class i{constructor($,X){this.iterator=$,this.controller=X}static fromSSEResponse($,X){let Z=!1;async function*q(){if(Z)throw Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Z=!0;let z=!1;try{for await(let G of KH($,X)){if(G.event==="completion")try{yield JSON.parse(G.data)}catch(J){throw console.error("Could not parse message into JSON:",G.data),console.error("From chunk:",G.raw),J}if(G.event==="message_start"||G.event==="message_delta"||G.event==="message_stop"||G.event==="content_block_start"||G.event==="content_block_delta"||G.event==="content_block_stop")try{yield JSON.parse(G.data)}catch(J){throw console.error("Could not parse message into JSON:",G.data),console.error("From chunk:",G.raw),J}if(G.event==="ping")continue;if(G.event==="error")throw v.generate(void 0,`SSE Error: ${G.data}`,G.data,M4($.headers))}z=!0}catch(G){if(G instanceof Error&&G.name==="AbortError")return;throw G}finally{if(!z)X.abort()}}return new i(q,X)}static fromReadableStream($,X){let Z=!1;async function*q(){let G=new R0,J=a$($);for await(let Q of J)for(let Y of G.decode(Q))yield Y;for(let Q of G.flush())yield Q}async function*z(){if(Z)throw Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Z=!0;let G=!1;try{for await(let J of q()){if(G)continue;if(J)yield JSON.parse(J)}G=!0}catch(J){if(J instanceof Error&&J.name==="AbortError")return;throw J}finally{if(!G)X.abort()}}return new i(z,X)}[Symbol.asyncIterator](){return this.iterator()}tee(){let $=[],X=[],Z=this.iterator(),q=(z)=>{return{next:()=>{if(z.length===0){let G=Z.next();$.push(G),X.push(G)}return z.shift()}}};return[new i(()=>q($),this.controller),new i(()=>q(X),this.controller)]}toReadableStream(){let $=this,X,Z=new TextEncoder;return new D4({async start(){X=$[Symbol.asyncIterator]()},async pull(q){try{let{value:z,done:G}=await X.next();if(G)return q.close();let J=Z.encode(JSON.stringify(z)+`
192
- `);q.enqueue(J)}catch(z){q.error(z)}},async cancel(){await X.return?.()}})}}async function*KH($,X){if(!$.body)throw X.abort(),new P("Attempted to iterate over a response with no body");let Z=new v8,q=new R0,z=a$($.body);for await(let G of DH(z))for(let J of q.decode(G)){let Q=Z.decode(J);if(Q)yield Q}for(let G of q.flush()){let J=Z.decode(G);if(J)yield J}}async function*DH($){let X=new Uint8Array;for await(let Z of $){if(Z==null)continue;let q=Z instanceof ArrayBuffer?new Uint8Array(Z):typeof Z==="string"?new TextEncoder().encode(Z):Z,z=new Uint8Array(X.length+q.length);z.set(X),z.set(q,X.length),X=z;let G;while((G=h8(X))!==-1)yield X.slice(0,G),X=X.slice(G)}if(X.length>0)yield X}class v8{constructor(){this.event=null,this.data=[],this.chunks=[]}decode($){if($.endsWith("\r"))$=$.substring(0,$.length-1);if(!$){if(!this.event&&!this.data.length)return null;let z={event:this.event,data:this.data.join(`
193
- `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],z}if(this.chunks.push($),$.startsWith(":"))return null;let[X,Z,q]=_H($,":");if(q.startsWith(" "))q=q.substring(1);if(X==="event")this.event=q;else if(X==="data")this.data.push(q);return null}}function _H($,X){let Z=$.indexOf(X);if(Z!==-1)return[$.substring(0,Z),X,$.substring(Z+X.length)];return[$,"",""]}var FH=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function",OH=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&s$($),s$=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function";async function u8($,X,Z){if($=await $,OH($))return $;if(FH($)){let z=await $.blob();X||(X=new URL($.url).pathname.split(/[\\/]/).pop()??"unknown_file");let G=s$(z)?[await z.arrayBuffer()]:[z];return new H2(G,X,Z)}let q=await MH($);if(X||(X=RH($)??"unknown_file"),!Z?.type){let z=q[0]?.type;if(typeof z==="string")Z={...Z,type:z}}return new H2(q,X,Z)}async function MH($){let X=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)X.push($);else if(s$($))X.push(await $.arrayBuffer());else if(PH($))for await(let Z of $)X.push(Z);else throw Error(`Unexpected data type: ${typeof $}; constructor: ${$?.constructor?.name}; props: ${IH($)}`);return X}function IH($){return`[${Object.getOwnPropertyNames($).map((Z)=>`"${Z}"`).join(", ")}]`}function RH($){return I4($.name)||I4($.filename)||I4($.path)?.split(/[\\/]/).pop()}var I4=($)=>{if(typeof $==="string")return $;if(typeof Buffer<"u"&&$ instanceof Buffer)return String($);return},PH=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",R4=($)=>$&&typeof $==="object"&&$.body&&$[Symbol.toStringTag]==="MultipartBody";var AH=function($,X,Z,q,z){if(q==="m")throw TypeError("Private method is not writable");if(q==="a"&&!z)throw TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!z:!X.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return q==="a"?z.call($,Z):z?z.value=Z:X.set($,Z),Z},SH=function($,X,Z,q){if(Z==="a"&&!q)throw TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!q:!X.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return Z==="m"?q:Z==="a"?q.call($):q?q.value:X.get($)},M2;O4();async function l8($){let{response:X}=$;if($.options.stream){if(G$("response",X.status,X.url,X.headers,X.body),$.options.__streamClass)return $.options.__streamClass.fromSSEResponse(X,$.controller);return i.fromSSEResponse(X,$.controller)}if(X.status===204)return null;if($.options.__binaryResponse)return X;let q=X.headers.get("content-type")?.split(";")[0]?.trim();if(q?.includes("application/json")||q?.endsWith("+json")){let J=await X.json();return G$("response",X.status,X.url,X.headers,J),i8(J,X)}let G=await X.text();return G$("response",X.status,X.url,X.headers,G),G}function i8($,X){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:X.headers.get("request-id"),enumerable:!1})}class R2 extends Promise{constructor($,X=l8){super((Z)=>{Z(null)});this.responsePromise=$,this.parseResponse=X}_thenUnwrap($){return new R2(this.responsePromise,async(X)=>i8($(await this.parseResponse(X),X),X.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,X]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:X,request_id:X.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(this.parseResponse);return this.parsedPromise}then($,X){return this.parse().then($,X)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}}class N4{constructor({baseURL:$,maxRetries:X=2,timeout:Z=600000,httpAgent:q,fetch:z}){this.baseURL=$,this.maxRetries=P4("maxRetries",X),this.timeout=P4("timeout",Z),this.httpAgent=q,this.fetch=z??K4}authHeaders($){return{}}defaultHeaders($){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...bH(),...this.authHeaders($)}}validateHeaders($,X){}defaultIdempotencyKey(){return`stainless-node-retry-${gH()}`}get($,X){return this.methodRequest("get",$,X)}post($,X){return this.methodRequest("post",$,X)}patch($,X){return this.methodRequest("patch",$,X)}put($,X){return this.methodRequest("put",$,X)}delete($,X){return this.methodRequest("delete",$,X)}methodRequest($,X,Z){return this.request(Promise.resolve(Z).then(async(q)=>{let z=q&&s$(q?.body)?new DataView(await q.body.arrayBuffer()):q?.body instanceof DataView?q.body:q?.body instanceof ArrayBuffer?new DataView(q.body):q&&ArrayBuffer.isView(q?.body)?new DataView(q.body.buffer):q?.body;return{method:$,path:X,...q,body:z}}))}getAPIList($,X,Z){return this.requestAPIList(X,{method:"get",path:$,...Z})}calculateContentLength($){if(typeof $==="string"){if(typeof Buffer<"u")return Buffer.byteLength($,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode($).length.toString()}else if(ArrayBuffer.isView($))return $.byteLength.toString();return null}buildRequest($,{retryCount:X=0}={}){let Z={...$},{method:q,path:z,query:G,headers:J={}}=Z,Q=ArrayBuffer.isView(Z.body)||Z.__binaryRequest&&typeof Z.body==="string"?Z.body:R4(Z.body)?Z.body.body:Z.body?JSON.stringify(Z.body,null,2):null,Y=this.calculateContentLength(Q),U=this.buildURL(z,G);if("timeout"in Z)P4("timeout",Z.timeout);Z.timeout=Z.timeout??this.timeout;let W=Z.httpAgent??this.httpAgent??_4(U),H=Z.timeout+1000;if(typeof W?.options?.timeout==="number"&&H>(W.options.timeout??0))W.options.timeout=H;if(this.idempotencyHeader&&q!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();J[this.idempotencyHeader]=$.idempotencyKey}let V=this.buildHeaders({options:Z,headers:J,contentLength:Y,retryCount:X});return{req:{method:q,...Q&&{body:Q},headers:V,...W&&{agent:W},signal:Z.signal??null},url:U,timeout:Z.timeout}}buildHeaders({options:$,headers:X,contentLength:Z,retryCount:q}){let z={};if(Z)z["content-length"]=Z;let G=this.defaultHeaders($);if(c8(z,G),c8(z,X),R4($.body)&&h0!=="node")delete z["content-type"];if(I2(G,"x-stainless-retry-count")===void 0&&I2(X,"x-stainless-retry-count")===void 0)z["x-stainless-retry-count"]=String(q);if(I2(G,"x-stainless-timeout")===void 0&&I2(X,"x-stainless-timeout")===void 0&&$.timeout)z["x-stainless-timeout"]=String(Math.trunc($.timeout/1000));return this.validateHeaders(z,X),z}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new P("Streaming is strongly recommended for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-python#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:X,options:Z}){}parseHeaders($){return!$?{}:(Symbol.iterator in $)?Object.fromEntries(Array.from($).map((X)=>[...X])):{...$}}makeStatusError($,X,Z,q){return v.generate($,X,Z,q)}request($,X=null){return new R2(this.makeRequest($,X))}async makeRequest($,X){let Z=await $,q=Z.maxRetries??this.maxRetries;if(X==null)X=q;await this.prepareOptions(Z);let{req:z,url:G,timeout:J}=this.buildRequest(Z,{retryCount:q-X});if(await this.prepareRequest(z,{url:G,options:Z}),G$("request",G,Z,z.headers),Z.signal?.aborted)throw new m;let Q=new AbortController,Y=await this.fetchWithTimeout(G,z,J,Q).catch(F2);if(Y instanceof Error){if(Z.signal?.aborted)throw new m;if(X)return this.retryRequest(Z,X);if(Y.name==="AbortError")throw new i$;throw new v0({cause:Y})}let U=M4(Y.headers);if(!Y.ok){if(X&&this.shouldRetry(Y)){let T=`retrying, ${X} attempts remaining`;return G$(`response (error; ${T})`,Y.status,G,U),this.retryRequest(Z,X,U)}let W=await Y.text().catch((T)=>F2(T).message),H=yH(W),V=H?void 0:W;throw G$(`response (error; ${X?"(error; no more retries left)":"(error; not retryable)"})`,Y.status,G,U,V),this.makeStatusError(Y.status,H,V,U)}return{response:Y,options:Z,controller:Q}}requestAPIList($,X){let Z=this.makeRequest(X,null);return new a8(this,Z,$)}buildURL($,X){let Z=fH($)?new URL($):new URL(this.baseURL+(this.baseURL.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),q=this.defaultQuery();if(!s8(q))X={...q,...X};if(typeof X==="object"&&X&&!Array.isArray(X))Z.search=this.stringifyQuery(X);return Z.toString()}stringifyQuery($){return Object.entries($).filter(([X,Z])=>typeof Z<"u").map(([X,Z])=>{if(typeof Z==="string"||typeof Z==="number"||typeof Z==="boolean")return`${encodeURIComponent(X)}=${encodeURIComponent(Z)}`;if(Z===null)return`${encodeURIComponent(X)}=`;throw new P(`Cannot stringify type ${typeof Z}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout($,X,Z,q){let{signal:z,...G}=X||{};if(z)z.addEventListener("abort",()=>q.abort());let J=setTimeout(()=>q.abort(),Z),Q={signal:q.signal,...G};if(Q.method)Q.method=Q.method.toUpperCase();let Y=60000,U=setTimeout(()=>{if(Q&&Q?.agent?.sockets){for(let W of Object.values(Q?.agent?.sockets).flat())if(W?.setKeepAlive)W.setKeepAlive(!0,Y)}},Y);return this.fetch.call(void 0,$,Q).finally(()=>{clearTimeout(J),clearTimeout(U)})}shouldRetry($){let X=$.headers.get("x-should-retry");if(X==="true")return!0;if(X==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,X,Z){let q,z=Z?.["retry-after-ms"];if(z){let J=parseFloat(z);if(!Number.isNaN(J))q=J}let G=Z?.["retry-after"];if(G&&!q){let J=parseFloat(G);if(!Number.isNaN(J))q=J*1000;else q=Date.parse(G)-Date.now()}if(!(q&&0<=q&&q<60000)){let J=$.maxRetries??this.maxRetries;q=this.calculateDefaultRetryTimeoutMillis(X,J)}return await kH(q),this.makeRequest($,X-1)}calculateDefaultRetryTimeoutMillis($,X){let z=X-$,G=Math.min(0.5*Math.pow(2,z),8),J=1-Math.random()*0.25;return G*J*1000}getUserAgent(){return`${this.constructor.name}/JS ${g0}`}}class A4{constructor($,X,Z,q){M2.set(this,void 0),AH(this,M2,$,"f"),this.options=q,this.response=X,this.body=Z}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageInfo()!=null}async getNextPage(){let $=this.nextPageInfo();if(!$)throw new P("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let X={...this.options};if("params"in $&&typeof X.query==="object")X.query={...X.query,...$.params};else if("url"in $){let Z=[...Object.entries(X.query||{}),...$.url.searchParams.entries()];for(let[q,z]of Z)$.url.searchParams.set(q,z);X.query=void 0,X.path=$.url.toString()}return await SH(this,M2,"f").requestAPIList(this.constructor,X)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(M2=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let X of $.getPaginatedItems())yield X}}class a8 extends R2{constructor($,X,Z){super(X,async(q)=>new Z($,q.response,await l8(q),q.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let X of $)yield X}}var M4=($)=>{return new Proxy(Object.fromEntries($.entries()),{get(X,Z){let q=Z.toString();return X[q.toLowerCase()]||X[q]}})},jH={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__binaryRequest:!0,__binaryResponse:!0,__streamClass:!0},r=($)=>{return typeof $==="object"&&$!==null&&!s8($)&&Object.keys($).every((X)=>n8(jH,X))},EH=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":g0,"X-Stainless-OS":d8(Deno.build.os),"X-Stainless-Arch":m8(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":g0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":g0,"X-Stainless-OS":d8(process.platform),"X-Stainless-Arch":m8(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let $=CH();if($)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":g0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${$.browser}`,"X-Stainless-Runtime-Version":$.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":g0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function CH(){if(typeof navigator>"u"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:X,pattern:Z}of $){let q=Z.exec(navigator.userAgent);if(q){let z=q[1]||0,G=q[2]||0,J=q[3]||0;return{browser:X,version:`${z}.${G}.${J}`}}}return null}var m8=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},d8=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},p8,bH=()=>{return p8??(p8=EH())},yH=($)=>{try{return JSON.parse($)}catch(X){return}},xH=/^[a-z][a-z0-9+.-]*:/i,fH=($)=>{return xH.test($)},kH=($)=>new Promise((X)=>setTimeout(X,$)),P4=($,X)=>{if(typeof X!=="number"||!Number.isInteger(X))throw new P(`${$} must be an integer`);if(X<0)throw new P(`${$} must be a positive integer`);return X},F2=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null)try{return Error(JSON.stringify($))}catch{}return Error(String($))};var P2=($)=>{if(typeof process<"u")return process.env?.[$]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.($)?.trim();return};function s8($){if(!$)return!0;for(let X in $)return!1;return!0}function n8($,X){return Object.prototype.hasOwnProperty.call($,X)}function c8($,X){for(let Z in X){if(!n8(X,Z))continue;let q=Z.toLowerCase();if(!q)continue;let z=X[Z];if(z===null)delete $[q];else if(z!==void 0)$[q]=z}}function G$($,...X){if(typeof process<"u"&&process?.env?.DEBUG==="true")console.log(`Anthropic:DEBUG:${$}`,...X)}var gH=()=>{return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,($)=>{let X=Math.random()*16|0;return($==="x"?X:X&3|8).toString(16)})},r8=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},hH=($)=>{return typeof $?.get==="function"};var I2=($,X)=>{let Z=X.toLowerCase();if(hH($)){let q=X[0]?.toUpperCase()+X.substring(1).replace(/([^\w])(\w)/g,(z,G,J)=>G+J.toUpperCase());for(let z of[X,Z,X.toUpperCase(),q]){let G=$.get(z);if(G)return G}}for(let[q,z]of Object.entries($))if(q.toLowerCase()===Z){if(Array.isArray(z)){if(z.length<=1)return z[0];return console.warn(`Received ${z.length} entries for the ${X} header, using the first entry.`),z[0]}return z}return};class W0 extends A4{constructor($,X,Z,q){super($,X,Z,q);this.data=Z.data||[],this.has_more=Z.has_more||!1,this.first_id=Z.first_id||null,this.last_id=Z.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageParams(){let $=this.nextPageInfo();if(!$)return null;if("params"in $)return $.params;let X=Object.fromEntries($.url.searchParams);if(!Object.keys(X).length)return null;return X}nextPageInfo(){if(this.options.query?.before_id){let X=this.first_id;if(!X)return null;return{params:{before_id:X}}}let $=this.last_id;if(!$)return null;return{params:{after_id:$}}}}class u{constructor($){this._client=$}}class J$ extends u{retrieve($,X){return this._client.get(`/v1/models/${$}?beta=true`,X)}list($={},X){if(r($))return this.list({},$);return this._client.getAPIList("/v1/models?beta=true",n$,{query:$,...X})}}class n$ extends W0{}J$.BetaModelInfosPage=n$;class Q${constructor($,X){this.iterator=$,this.controller=X}async*decoder(){let $=new R0;for await(let X of this.iterator)for(let Z of $.decode(X))yield JSON.parse(Z);for(let X of $.flush())yield JSON.parse(X)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,X){if(!$.body)throw X.abort(),new P("Attempted to iterate over a response with no body");return new Q$(a$($.body),X)}}class Y$ extends u{create($,X){let{betas:Z,...q}=$;return this._client.post("/v1/messages/batches?beta=true",{body:q,...X,headers:{"anthropic-beta":[...Z??[],"message-batches-2024-09-24"].toString(),...X?.headers}})}retrieve($,X={},Z){if(r(X))return this.retrieve($,{},X);let{betas:q}=X;return this._client.get(`/v1/messages/batches/${$}?beta=true`,{...Z,headers:{"anthropic-beta":[...q??[],"message-batches-2024-09-24"].toString(),...Z?.headers}})}list($={},X){if(r($))return this.list({},$);let{betas:Z,...q}=$;return this._client.getAPIList("/v1/messages/batches?beta=true",r$,{query:q,...X,headers:{"anthropic-beta":[...Z??[],"message-batches-2024-09-24"].toString(),...X?.headers}})}delete($,X={},Z){if(r(X))return this.delete($,{},X);let{betas:q}=X;return this._client.delete(`/v1/messages/batches/${$}?beta=true`,{...Z,headers:{"anthropic-beta":[...q??[],"message-batches-2024-09-24"].toString(),...Z?.headers}})}cancel($,X={},Z){if(r(X))return this.cancel($,{},X);let{betas:q}=X;return this._client.post(`/v1/messages/batches/${$}/cancel?beta=true`,{...Z,headers:{"anthropic-beta":[...q??[],"message-batches-2024-09-24"].toString(),...Z?.headers}})}async results($,X={},Z){if(r(X))return this.results($,{},X);let q=await this.retrieve($);if(!q.results_url)throw new P(`No batch \`results_url\`; Has it finished processing? ${q.processing_status} - ${q.id}`);let{betas:z}=X;return this._client.get(q.results_url,{...Z,headers:{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary",...Z?.headers},stream:!0,__binaryResponse:!0})._thenUnwrap((G,J)=>Q$.fromResponse(J.response,J.controller))}}class r$ extends W0{}Y$.BetaMessageBatchesPage=r$;var dH=($)=>{let X=0,Z=[];while(X<$.length){let q=$[X];if(q==="\\"){X++;continue}if(q==="{"){Z.push({type:"brace",value:"{"}),X++;continue}if(q==="}"){Z.push({type:"brace",value:"}"}),X++;continue}if(q==="["){Z.push({type:"paren",value:"["}),X++;continue}if(q==="]"){Z.push({type:"paren",value:"]"}),X++;continue}if(q===":"){Z.push({type:"separator",value:":"}),X++;continue}if(q===","){Z.push({type:"delimiter",value:","}),X++;continue}if(q==='"'){let Q="",Y=!1;q=$[++X];while(q!=='"'){if(X===$.length){Y=!0;break}if(q==="\\"){if(X++,X===$.length){Y=!0;break}Q+=q+$[X],q=$[++X]}else Q+=q,q=$[++X]}if(q=$[++X],!Y)Z.push({type:"string",value:Q});continue}if(q&&/\s/.test(q)){X++;continue}let G=/[0-9]/;if(q&&G.test(q)||q==="-"||q==="."){let Q="";if(q==="-")Q+=q,q=$[++X];while(q&&G.test(q)||q===".")Q+=q,q=$[++X];Z.push({type:"number",value:Q});continue}let J=/[a-z]/i;if(q&&J.test(q)){let Q="";while(q&&J.test(q)){if(X===$.length)break;Q+=q,q=$[++X]}if(Q=="true"||Q=="false"||Q==="null")Z.push({type:"name",value:Q});else{X++;continue}continue}X++}return Z},U$=($)=>{if($.length===0)return $;let X=$[$.length-1];switch(X.type){case"separator":return $=$.slice(0,$.length-1),U$($);break;case"number":let Z=X.value[X.value.length-1];if(Z==="."||Z==="-")return $=$.slice(0,$.length-1),U$($);case"string":let q=$[$.length-2];if(q?.type==="delimiter")return $=$.slice(0,$.length-1),U$($);else if(q?.type==="brace"&&q.value==="{")return $=$.slice(0,$.length-1),U$($);break;case"delimiter":return $=$.slice(0,$.length-1),U$($);break}return $},pH=($)=>{let X=[];if($.map((Z)=>{if(Z.type==="brace")if(Z.value==="{")X.push("}");else X.splice(X.lastIndexOf("}"),1);if(Z.type==="paren")if(Z.value==="[")X.push("]");else X.splice(X.lastIndexOf("]"),1)}),X.length>0)X.reverse().map((Z)=>{if(Z==="}")$.push({type:"brace",value:"}"});else if(Z==="]")$.push({type:"paren",value:"]"})});return $},cH=($)=>{let X="";return $.map((Z)=>{switch(Z.type){case"string":X+='"'+Z.value+'"';break;default:X+=Z.value;break}}),X},N2=($)=>JSON.parse(cH(pH(U$(dH($)))));var d=function($,X,Z,q,z){if(q==="m")throw TypeError("Private method is not writable");if(q==="a"&&!z)throw TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!z:!X.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return q==="a"?z.call($,Z):z?z.value=Z:X.set($,Z),Z},A=function($,X,Z,q){if(Z==="a"&&!q)throw TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!q:!X.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return Z==="m"?q:Z==="a"?q.call($):q?q.value:X.get($)},o,P0,o$,A2,t$,e$,S2,$1,V0,X1,j2,E2,H$,C2,b2,S4,o8,j4,E4,C4,b4,t8,e8="__json_buf";class Z1{constructor(){o.add(this),this.messages=[],this.receivedMessages=[],P0.set(this,void 0),this.controller=new AbortController,o$.set(this,void 0),A2.set(this,()=>{}),t$.set(this,()=>{}),e$.set(this,void 0),S2.set(this,()=>{}),$1.set(this,()=>{}),V0.set(this,{}),X1.set(this,!1),j2.set(this,!1),E2.set(this,!1),H$.set(this,!1),C2.set(this,void 0),b2.set(this,void 0),j4.set(this,($)=>{if(d(this,j2,!0,"f"),$ instanceof Error&&$.name==="AbortError")$=new m;if($ instanceof m)return d(this,E2,!0,"f"),this._emit("abort",$);if($ instanceof P)return this._emit("error",$);if($ instanceof Error){let X=new P($.message);return X.cause=$,this._emit("error",X)}return this._emit("error",new P(String($)))}),d(this,o$,new Promise(($,X)=>{d(this,A2,$,"f"),d(this,t$,X,"f")}),"f"),d(this,e$,new Promise(($,X)=>{d(this,S2,$,"f"),d(this,$1,X,"f")}),"f"),A(this,o$,"f").catch(()=>{}),A(this,e$,"f").catch(()=>{})}get response(){return A(this,C2,"f")}get request_id(){return A(this,b2,"f")}async withResponse(){let $=await A(this,o$,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let X=new Z1;return X._run(()=>X._fromReadableStream($)),X}static createMessage($,X,Z){let q=new Z1;for(let z of X.messages)q._addMessageParam(z);return q._run(()=>q._createMessage($,{...X,stream:!0},{...Z,headers:{...Z?.headers,"X-Stainless-Helper-Method":"stream"}})),q}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},A(this,j4,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,X=!0){if(this.receivedMessages.push($),X)this._emit("message",$)}async _createMessage($,X,Z){let q=Z?.signal;if(q){if(q.aborted)this.controller.abort();q.addEventListener("abort",()=>this.controller.abort())}A(this,o,"m",E4).call(this);let{response:z,data:G}=await $.create({...X,stream:!0},{...Z,signal:this.controller.signal}).withResponse();this._connected(z);for await(let J of G)A(this,o,"m",C4).call(this,J);if(G.controller.signal?.aborted)throw new m;A(this,o,"m",b4).call(this)}_connected($){if(this.ended)return;d(this,C2,$,"f"),d(this,b2,$?.headers.get("request-id"),"f"),A(this,A2,"f").call(this,$),this._emit("connect")}get ended(){return A(this,X1,"f")}get errored(){return A(this,j2,"f")}get aborted(){return A(this,E2,"f")}abort(){this.controller.abort()}on($,X){return(A(this,V0,"f")[$]||(A(this,V0,"f")[$]=[])).push({listener:X}),this}off($,X){let Z=A(this,V0,"f")[$];if(!Z)return this;let q=Z.findIndex((z)=>z.listener===X);if(q>=0)Z.splice(q,1);return this}once($,X){return(A(this,V0,"f")[$]||(A(this,V0,"f")[$]=[])).push({listener:X,once:!0}),this}emitted($){return new Promise((X,Z)=>{if(d(this,H$,!0,"f"),$!=="error")this.once("error",Z);this.once($,X)})}async done(){d(this,H$,!0,"f"),await A(this,e$,"f")}get currentMessage(){return A(this,P0,"f")}async finalMessage(){return await this.done(),A(this,o,"m",S4).call(this)}async finalText(){return await this.done(),A(this,o,"m",o8).call(this)}_emit($,...X){if(A(this,X1,"f"))return;if($==="end")d(this,X1,!0,"f"),A(this,S2,"f").call(this);let Z=A(this,V0,"f")[$];if(Z)A(this,V0,"f")[$]=Z.filter((q)=>!q.once),Z.forEach(({listener:q})=>q(...X));if($==="abort"){let q=X[0];if(!A(this,H$,"f")&&!Z?.length)Promise.reject(q);A(this,t$,"f").call(this,q),A(this,$1,"f").call(this,q),this._emit("end");return}if($==="error"){let q=X[0];if(!A(this,H$,"f")&&!Z?.length)Promise.reject(q);A(this,t$,"f").call(this,q),A(this,$1,"f").call(this,q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",A(this,o,"m",S4).call(this))}async _fromReadableStream($,X){let Z=X?.signal;if(Z){if(Z.aborted)this.controller.abort();Z.addEventListener("abort",()=>this.controller.abort())}A(this,o,"m",E4).call(this),this._connected(null);let q=i.fromReadableStream($,this.controller);for await(let z of q)A(this,o,"m",C4).call(this,z);if(q.controller.signal?.aborted)throw new m;A(this,o,"m",b4).call(this)}[(P0=new WeakMap,o$=new WeakMap,A2=new WeakMap,t$=new WeakMap,e$=new WeakMap,S2=new WeakMap,$1=new WeakMap,V0=new WeakMap,X1=new WeakMap,j2=new WeakMap,E2=new WeakMap,H$=new WeakMap,C2=new WeakMap,b2=new WeakMap,j4=new WeakMap,o=new WeakSet,S4=function(){if(this.receivedMessages.length===0)throw new P("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},o8=function(){if(this.receivedMessages.length===0)throw new P("stream ended without producing a Message with role=assistant");let X=this.receivedMessages.at(-1).content.filter((Z)=>Z.type==="text").map((Z)=>Z.text);if(X.length===0)throw new P("stream ended without producing a content block with type=text");return X.join(" ")},E4=function(){if(this.ended)return;d(this,P0,void 0,"f")},C4=function(X){if(this.ended)return;let Z=A(this,o,"m",t8).call(this,X);switch(this._emit("streamEvent",X,Z),X.type){case"content_block_delta":{let q=Z.content.at(-1);switch(X.delta.type){case"text_delta":{if(q.type==="text")this._emit("text",X.delta.text,q.text||"");break}case"citations_delta":{if(q.type==="text")this._emit("citation",X.delta.citation,q.citations??[]);break}case"input_json_delta":{if(q.type==="tool_use"&&q.input)this._emit("inputJson",X.delta.partial_json,q.input);break}case"thinking_delta":{if(q.type==="thinking")this._emit("thinking",X.delta.thinking,q.thinking);break}case"signature_delta":{if(q.type==="thinking")this._emit("signature",q.signature);break}default:$Z(X.delta)}break}case"message_stop":{this._addMessageParam(Z),this._addMessage(Z,!0);break}case"content_block_stop":{this._emit("contentBlock",Z.content.at(-1));break}case"message_start":{d(this,P0,Z,"f");break}case"content_block_start":case"message_delta":break}},b4=function(){if(this.ended)throw new P("stream has ended, this shouldn't happen");let X=A(this,P0,"f");if(!X)throw new P("request ended without sending any chunks");return d(this,P0,void 0,"f"),X},t8=function(X){let Z=A(this,P0,"f");if(X.type==="message_start"){if(Z)throw new P(`Unexpected event order, got ${X.type} before receiving "message_stop"`);return X.message}if(!Z)throw new P(`Unexpected event order, got ${X.type} before "message_start"`);switch(X.type){case"message_stop":return Z;case"message_delta":return Z.stop_reason=X.delta.stop_reason,Z.stop_sequence=X.delta.stop_sequence,Z.usage.output_tokens=X.usage.output_tokens,Z;case"content_block_start":return Z.content.push(X.content_block),Z;case"content_block_delta":{let q=Z.content.at(X.index);switch(X.delta.type){case"text_delta":{if(q?.type==="text")q.text+=X.delta.text;break}case"citations_delta":{if(q?.type==="text")q.citations??(q.citations=[]),q.citations.push(X.delta.citation);break}case"input_json_delta":{if(q?.type==="tool_use"){let z=q[e8]||"";if(z+=X.delta.partial_json,Object.defineProperty(q,e8,{value:z,enumerable:!1,writable:!0}),z)q.input=N2(z)}break}case"thinking_delta":{if(q?.type==="thinking")q.thinking+=X.delta.thinking;break}case"signature_delta":{if(q?.type==="thinking")q.signature=X.delta.signature;break}default:$Z(X.delta)}return Z}case"content_block_stop":return Z}},Symbol.asyncIterator)](){let $=[],X=[],Z=!1;return this.on("streamEvent",(q)=>{let z=X.shift();if(z)z.resolve(q);else $.push(q)}),this.on("end",()=>{Z=!0;for(let q of X)q.resolve(void 0);X.length=0}),this.on("abort",(q)=>{Z=!0;for(let z of X)z.reject(q);X.length=0}),this.on("error",(q)=>{Z=!0;for(let z of X)z.reject(q);X.length=0}),{next:async()=>{if(!$.length){if(Z)return{value:void 0,done:!0};return new Promise((z,G)=>X.push({resolve:z,reject:G})).then((z)=>z?{value:z,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new i(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function $Z($){}var XZ={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025"};class m0 extends u{constructor(){super(...arguments);this.batches=new Y$(this._client)}create($,X){let{betas:Z,...q}=$;if(q.model in XZ)console.warn(`The model '${q.model}' is deprecated and will reach end-of-life on ${XZ[q.model]}
194
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);return this._client.post("/v1/messages?beta=true",{body:q,timeout:this._client._options.timeout??(q.stream?600000:this._client._calculateNonstreamingTimeout(q.max_tokens)),...X,headers:{...Z?.toString()!=null?{"anthropic-beta":Z?.toString()}:void 0,...X?.headers},stream:$.stream??!1})}stream($,X){return Z1.createMessage(this,$,X)}countTokens($,X){let{betas:Z,...q}=$;return this._client.post("/v1/messages/count_tokens?beta=true",{body:q,...X,headers:{"anthropic-beta":[...Z??[],"token-counting-2024-11-01"].toString(),...X?.headers}})}}m0.Batches=Y$;m0.BetaMessageBatchesPage=r$;class T0 extends u{constructor(){super(...arguments);this.models=new J$(this._client),this.messages=new m0(this._client)}}T0.Models=J$;T0.BetaModelInfosPage=n$;T0.Messages=m0;class W$ extends u{create($,X){return this._client.post("/v1/complete",{body:$,timeout:this._client._options.timeout??600000,...X,stream:$.stream??!1})}}class V$ extends u{create($,X){return this._client.post("/v1/messages/batches",{body:$,...X})}retrieve($,X){return this._client.get(`/v1/messages/batches/${$}`,X)}list($={},X){if(r($))return this.list({},$);return this._client.getAPIList("/v1/messages/batches",q1,{query:$,...X})}delete($,X){return this._client.delete(`/v1/messages/batches/${$}`,X)}cancel($,X){return this._client.post(`/v1/messages/batches/${$}/cancel`,X)}async results($,X){let Z=await this.retrieve($);if(!Z.results_url)throw new P(`No batch \`results_url\`; Has it finished processing? ${Z.processing_status} - ${Z.id}`);return this._client.get(Z.results_url,{...X,headers:{Accept:"application/binary",...X?.headers},__binaryResponse:!0})._thenUnwrap((q,z)=>Q$.fromResponse(z.response,z.controller))}}class q1 extends W0{}V$.MessageBatchesPage=q1;var p=function($,X,Z,q,z){if(q==="m")throw TypeError("Private method is not writable");if(q==="a"&&!z)throw TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!z:!X.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return q==="a"?z.call($,Z):z?z.value=Z:X.set($,Z),Z},S=function($,X,Z,q){if(Z==="a"&&!q)throw TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!q:!X.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return Z==="m"?q:Z==="a"?q.call($):q?q.value:X.get($)},t,N0,z1,y2,G1,J1,x2,Q1,w0,Y1,f2,k2,T$,g2,h2,y4,ZZ,x4,f4,k4,g4,qZ,zZ="__json_buf";class U1{constructor(){t.add(this),this.messages=[],this.receivedMessages=[],N0.set(this,void 0),this.controller=new AbortController,z1.set(this,void 0),y2.set(this,()=>{}),G1.set(this,()=>{}),J1.set(this,void 0),x2.set(this,()=>{}),Q1.set(this,()=>{}),w0.set(this,{}),Y1.set(this,!1),f2.set(this,!1),k2.set(this,!1),T$.set(this,!1),g2.set(this,void 0),h2.set(this,void 0),x4.set(this,($)=>{if(p(this,f2,!0,"f"),$ instanceof Error&&$.name==="AbortError")$=new m;if($ instanceof m)return p(this,k2,!0,"f"),this._emit("abort",$);if($ instanceof P)return this._emit("error",$);if($ instanceof Error){let X=new P($.message);return X.cause=$,this._emit("error",X)}return this._emit("error",new P(String($)))}),p(this,z1,new Promise(($,X)=>{p(this,y2,$,"f"),p(this,G1,X,"f")}),"f"),p(this,J1,new Promise(($,X)=>{p(this,x2,$,"f"),p(this,Q1,X,"f")}),"f"),S(this,z1,"f").catch(()=>{}),S(this,J1,"f").catch(()=>{})}get response(){return S(this,g2,"f")}get request_id(){return S(this,h2,"f")}async withResponse(){let $=await S(this,z1,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let X=new U1;return X._run(()=>X._fromReadableStream($)),X}static createMessage($,X,Z){let q=new U1;for(let z of X.messages)q._addMessageParam(z);return q._run(()=>q._createMessage($,{...X,stream:!0},{...Z,headers:{...Z?.headers,"X-Stainless-Helper-Method":"stream"}})),q}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},S(this,x4,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,X=!0){if(this.receivedMessages.push($),X)this._emit("message",$)}async _createMessage($,X,Z){let q=Z?.signal;if(q){if(q.aborted)this.controller.abort();q.addEventListener("abort",()=>this.controller.abort())}S(this,t,"m",f4).call(this);let{response:z,data:G}=await $.create({...X,stream:!0},{...Z,signal:this.controller.signal}).withResponse();this._connected(z);for await(let J of G)S(this,t,"m",k4).call(this,J);if(G.controller.signal?.aborted)throw new m;S(this,t,"m",g4).call(this)}_connected($){if(this.ended)return;p(this,g2,$,"f"),p(this,h2,$?.headers.get("request-id"),"f"),S(this,y2,"f").call(this,$),this._emit("connect")}get ended(){return S(this,Y1,"f")}get errored(){return S(this,f2,"f")}get aborted(){return S(this,k2,"f")}abort(){this.controller.abort()}on($,X){return(S(this,w0,"f")[$]||(S(this,w0,"f")[$]=[])).push({listener:X}),this}off($,X){let Z=S(this,w0,"f")[$];if(!Z)return this;let q=Z.findIndex((z)=>z.listener===X);if(q>=0)Z.splice(q,1);return this}once($,X){return(S(this,w0,"f")[$]||(S(this,w0,"f")[$]=[])).push({listener:X,once:!0}),this}emitted($){return new Promise((X,Z)=>{if(p(this,T$,!0,"f"),$!=="error")this.once("error",Z);this.once($,X)})}async done(){p(this,T$,!0,"f"),await S(this,J1,"f")}get currentMessage(){return S(this,N0,"f")}async finalMessage(){return await this.done(),S(this,t,"m",y4).call(this)}async finalText(){return await this.done(),S(this,t,"m",ZZ).call(this)}_emit($,...X){if(S(this,Y1,"f"))return;if($==="end")p(this,Y1,!0,"f"),S(this,x2,"f").call(this);let Z=S(this,w0,"f")[$];if(Z)S(this,w0,"f")[$]=Z.filter((q)=>!q.once),Z.forEach(({listener:q})=>q(...X));if($==="abort"){let q=X[0];if(!S(this,T$,"f")&&!Z?.length)Promise.reject(q);S(this,G1,"f").call(this,q),S(this,Q1,"f").call(this,q),this._emit("end");return}if($==="error"){let q=X[0];if(!S(this,T$,"f")&&!Z?.length)Promise.reject(q);S(this,G1,"f").call(this,q),S(this,Q1,"f").call(this,q),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",S(this,t,"m",y4).call(this))}async _fromReadableStream($,X){let Z=X?.signal;if(Z){if(Z.aborted)this.controller.abort();Z.addEventListener("abort",()=>this.controller.abort())}S(this,t,"m",f4).call(this),this._connected(null);let q=i.fromReadableStream($,this.controller);for await(let z of q)S(this,t,"m",k4).call(this,z);if(q.controller.signal?.aborted)throw new m;S(this,t,"m",g4).call(this)}[(N0=new WeakMap,z1=new WeakMap,y2=new WeakMap,G1=new WeakMap,J1=new WeakMap,x2=new WeakMap,Q1=new WeakMap,w0=new WeakMap,Y1=new WeakMap,f2=new WeakMap,k2=new WeakMap,T$=new WeakMap,g2=new WeakMap,h2=new WeakMap,x4=new WeakMap,t=new WeakSet,y4=function(){if(this.receivedMessages.length===0)throw new P("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},ZZ=function(){if(this.receivedMessages.length===0)throw new P("stream ended without producing a Message with role=assistant");let X=this.receivedMessages.at(-1).content.filter((Z)=>Z.type==="text").map((Z)=>Z.text);if(X.length===0)throw new P("stream ended without producing a content block with type=text");return X.join(" ")},f4=function(){if(this.ended)return;p(this,N0,void 0,"f")},k4=function(X){if(this.ended)return;let Z=S(this,t,"m",qZ).call(this,X);switch(this._emit("streamEvent",X,Z),X.type){case"content_block_delta":{let q=Z.content.at(-1);switch(X.delta.type){case"text_delta":{if(q.type==="text")this._emit("text",X.delta.text,q.text||"");break}case"citations_delta":{if(q.type==="text")this._emit("citation",X.delta.citation,q.citations??[]);break}case"input_json_delta":{if(q.type==="tool_use"&&q.input)this._emit("inputJson",X.delta.partial_json,q.input);break}case"thinking_delta":{if(q.type==="thinking")this._emit("thinking",X.delta.thinking,q.thinking);break}case"signature_delta":{if(q.type==="thinking")this._emit("signature",q.signature);break}default:GZ(X.delta)}break}case"message_stop":{this._addMessageParam(Z),this._addMessage(Z,!0);break}case"content_block_stop":{this._emit("contentBlock",Z.content.at(-1));break}case"message_start":{p(this,N0,Z,"f");break}case"content_block_start":case"message_delta":break}},g4=function(){if(this.ended)throw new P("stream has ended, this shouldn't happen");let X=S(this,N0,"f");if(!X)throw new P("request ended without sending any chunks");return p(this,N0,void 0,"f"),X},qZ=function(X){let Z=S(this,N0,"f");if(X.type==="message_start"){if(Z)throw new P(`Unexpected event order, got ${X.type} before receiving "message_stop"`);return X.message}if(!Z)throw new P(`Unexpected event order, got ${X.type} before "message_start"`);switch(X.type){case"message_stop":return Z;case"message_delta":return Z.stop_reason=X.delta.stop_reason,Z.stop_sequence=X.delta.stop_sequence,Z.usage.output_tokens=X.usage.output_tokens,Z;case"content_block_start":return Z.content.push(X.content_block),Z;case"content_block_delta":{let q=Z.content.at(X.index);switch(X.delta.type){case"text_delta":{if(q?.type==="text")q.text+=X.delta.text;break}case"citations_delta":{if(q?.type==="text")q.citations??(q.citations=[]),q.citations.push(X.delta.citation);break}case"input_json_delta":{if(q?.type==="tool_use"){let z=q[zZ]||"";if(z+=X.delta.partial_json,Object.defineProperty(q,zZ,{value:z,enumerable:!1,writable:!0}),z)q.input=N2(z)}break}case"thinking_delta":{if(q?.type==="thinking")q.thinking+=X.delta.thinking;break}case"signature_delta":{if(q?.type==="thinking")q.signature=X.delta.signature;break}default:GZ(X.delta)}return Z}case"content_block_stop":return Z}},Symbol.asyncIterator)](){let $=[],X=[],Z=!1;return this.on("streamEvent",(q)=>{let z=X.shift();if(z)z.resolve(q);else $.push(q)}),this.on("end",()=>{Z=!0;for(let q of X)q.resolve(void 0);X.length=0}),this.on("abort",(q)=>{Z=!0;for(let z of X)z.reject(q);X.length=0}),this.on("error",(q)=>{Z=!0;for(let z of X)z.reject(q);X.length=0}),{next:async()=>{if(!$.length){if(Z)return{value:void 0,done:!0};return new Promise((z,G)=>X.push({resolve:z,reject:G})).then((z)=>z?{value:z,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new i(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function GZ($){}class A0 extends u{constructor(){super(...arguments);this.batches=new V$(this._client)}create($,X){if($.model in JZ)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${JZ[$.model]}
195
- Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);return this._client.post("/v1/messages",{body:$,timeout:this._client._options.timeout??($.stream?600000:this._client._calculateNonstreamingTimeout($.max_tokens)),...X,stream:$.stream??!1})}stream($,X){return U1.createMessage(this,$,X)}countTokens($,X){return this._client.post("/v1/messages/count_tokens",{body:$,...X})}}var JZ={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025"};A0.Batches=V$;A0.MessageBatchesPage=q1;class d0 extends u{retrieve($,X){return this._client.get(`/v1/models/${$}`,X)}list($={},X){if(r($))return this.list({},$);return this._client.getAPIList("/v1/models",w$,{query:$,...X})}}class w$ extends W0{}d0.ModelInfosPage=w$;var QZ;class b extends N4{constructor({baseURL:$=P2("ANTHROPIC_BASE_URL"),apiKey:X=P2("ANTHROPIC_API_KEY")??null,authToken:Z=P2("ANTHROPIC_AUTH_TOKEN")??null,...q}={}){let z={apiKey:X,authToken:Z,...q,baseURL:$||"https://api.anthropic.com"};if(!z.dangerouslyAllowBrowser&&r8())throw new P(`It looks like you're running in a browser-like environment.
183
+ `),G.push("Catches stale claims in `docs.sources` against declared traps. Per-source suppression: `audit.traps: false` skips all traps; `audit.traps: [<trap_id>, ...]` skips only the listed traps and keeps scanning the rest.\n"),$.sourceTrapMatches.length===0)G.push(`None.
184
+ `);else{for(let H of $.sourceTrapMatches)G.push(`- **${H.sourceId}** (\`${H.sourcePath}:L${H.line}\`) \u2014 trap \`${H.trapId}\` matched \`${H.matched}\` (${H.severity})`),G.push(` - reason: ${H.trapReason}`),G.push(` - fix: remove the stale claim, retire the trap, set \`audit.traps: ['${H.trapId}']\` to suppress just this one (other traps still apply), or set \`audit.traps: false\` if the source is deliberately stale`);G.push("")}return G.join(`
185
+ `)}function z2($){return JSON.stringify($,null,2)}function q2($){let{config:X,files:Z,pairs:z,findings:q}=$,G=[],J=q.filter((H)=>H.severity==="error").length,Q=q.filter((H)=>H.severity==="warning").length;if(G.push("pickled audit"),G.push(`Target: ${X.targetRepo}`),G.push(`Budgets: root \u2264 ${X.budgets.rootLines} lines, nested warn at ${X.budgets.nestedWarnLines} lines.`),G.push(`Found: ${Z.length} agent-doc file(s) \xB7 ${J} error(s) \xB7 ${Q} warning(s)`),G.push(""),G.push("Inventory"),Z.length===0)G.push(" none");else{let H=[...Z].sort((B,L)=>L.lineCount-B.lineCount),V=Math.max(...H.map((B)=>B.relPath.length));for(let B of H){let L=!B.relPath.includes("/"),T=P6(B.lineCount,L,X),K=B.isSymlink?`symlink \u2192 ${B.symlinkTarget?.replace(`${X.targetRepo}/`,"")??"?"}`:"file",_=`${B.lineCount}`.padStart(4),F=B.relPath.padEnd(V),O=T?` (${T})`:"";G.push(` ${F} ${_} lines ${K}${O}`)}}if(G.push(""),G.push("AGENTS.md / CLAUDE.md pairs"),z.length===0)G.push(" none");else for(let H of z){let V=H.dir||"(root)";G.push(` ${V}: ${H.classification} \xB7 ${H.detail}`)}G.push("");let Y=Z.filter((H)=>!H.isSymlink&&H.brokenPathRefs.length+H.brokenImports.length>0);if(G.push("Broken references"),Y.length===0)G.push(" none");else for(let H of Y){G.push(` ${H.relPath}:`);for(let V of H.brokenPathRefs)G.push(` path: ${V}`);for(let V of H.brokenImports)G.push(` @-import: ${V}`)}G.push("");let U=Z.filter((H)=>!H.isSymlink&&H.unresolvedCommands.length>0);if(G.push("Unresolved package-manager commands (advisory)"),U.length===0)G.push(" none");else for(let H of U){G.push(` ${H.relPath}:`);for(let V of H.unresolvedCommands)G.push(` ${V}`)}G.push("");let W=Z.filter((H)=>{if(H.isSymlink)return!1;return!H.relPath.includes("/")?H.lineCount>X.budgets.rootLines:H.lineCount>X.budgets.nestedWarnLines});if(G.push("Section breakdown for files over budget"),W.length===0)G.push(" all files within budget");else for(let H of W){G.push(` ${H.relPath} (${H.lineCount} lines):`);for(let V of H.sections.slice(0,10))G.push(` ${V.header.padEnd(40)} ${V.lines} lines`)}if(G.push(""),G.push("Registered-source trap matches"),$.sourceTrapMatches.length===0)G.push(" none");else for(let H of $.sourceTrapMatches){let V=H.severity==="error"?"error":"warning";G.push(` [${V}] ${H.sourceId} (${H.sourcePath}:L${H.line}): trap ${H.trapId} matched "${H.matched}"`),G.push(` reason: ${H.trapReason}`),G.push(` fix: remove the stale claim, retire the trap, set audit.traps: ['${H.trapId}'] to suppress just this trap (others still apply), or set audit.traps: false if deliberately stale`)}return G.join(`
186
+ `)}function P6($,X,Z){if(X&&$>Z.budgets.rootLines)return`over root budget (${$} > ${Z.budgets.rootLines})`;if(!X&&$>Z.budgets.nestedWarnLines)return`over nested-warn (${$} > ${Z.budgets.nestedWarnLines})`;return""}import{existsSync as q$,lstatSync as E6,readFileSync as Y2,readlinkSync as rU,statSync as oU}from"fs";import{dirname as U2,isAbsolute as tU,join as B9,relative as eU,resolve as K9}from"path";var{Glob:C6}=globalThis.Bun;var G2=["node_modules/**","**/node_modules/**",".git/**","**/.git/**","dist/**","**/dist/**","build/**","**/build/**",".next/**","**/.next/**",".turbo/**","**/.turbo/**",".cache/**","**/.cache/**",".runs/**","**/.runs/**","coverage/**","**/coverage/**","**/__fixtures__/**","**/tests/**/fixture/**","**/tests/**/fixtures/**","**/test/**/fixture/**","**/test/**/fixtures/**"],z$={targetRepo:".",budgets:{rootLines:120,nestedWarnLines:200},ignore:G2,intentionalDifferentPairs:[],knownCommands:[]};function J2($){if(!$)return z$;return{targetRepo:$.targetRepo??z$.targetRepo,budgets:{rootLines:$.budgets?.rootLines??z$.budgets.rootLines,nestedWarnLines:$.budgets?.nestedWarnLines??z$.budgets.nestedWarnLines},ignore:$.ignore??G2,intentionalDifferentPairs:$.intentionalDifferentPairs??[],knownCommands:$.knownCommands??[]}}import{existsSync as cU}from"fs";import{join as iU,resolve as aU}from"path";function k0($){let X=[],Z=[];for(let z of $.traps){let q=hU($.response,z);if(q)X.push(q);else Z.push(z.id)}return{fired:X,avoided:Z}}function hU($,X){if(X.match!==void 0){let Z=$.indexOf(X.match);if(Z===-1)return null;return{id:X.id,reason:X.reason,matched:X.match,snippet:N6($,Z,X.match.length),index:Z}}if(X.pattern!==void 0){let z=new RegExp(X.pattern,X.flags??"").exec($);if(!z)return null;return{id:X.id,reason:X.reason,matched:z[0],snippet:N6($,z.index,z[0].length),index:z.index}}return null}function N6($,X,Z){let z=Math.max(0,X-40),q=Math.min($.length,X+Z+40),G=$.slice(z,q).replace(/\s+/g," ").trim();if(z>0)G=`...${G}`;if(q<$.length)G=`${G}...`;return G}import Q2 from"path";var{Glob:A6}=globalThis.Bun;var vU=262144,uU=4194304;function mU($){return $.startsWith("http://")||$.startsWith("https://")}async function dU($,X,Z){let z=await fetch(X);if(!z.ok)throw Error(`Failed to fetch source "${$}" from ${X}: ${z.status} ${z.statusText}`);let q=await z.text();return{id:$,source:X,content:q,name:new URL(X).hostname+new URL(X).pathname,type:"url",auditTraps:Z}}async function pU($,X,Z,z){let q=Q2.isAbsolute(X)?X:Q2.resolve(Z,X),G=Bun.file(q);if(!await G.exists())throw Error(`Source "${$}" not found at ${q}`);let J=await G.text();return{id:$,source:X,content:J,name:Q2.basename(q),type:"file",auditTraps:z}}async function lU($,X,Z,z,q){let G=new A6(X.path),J=(X.exclude??[]).map((B)=>new A6(B)),Q=[];for await(let B of G.scan({cwd:Z,onlyFiles:!0,followSymlinks:!1})){if(J.some((L)=>L.match(B)))continue;Q.push(B)}Q.sort();let Y=X.maxBytes??vU,U=Math.max(Y,uU),W=[],H=0;for(let B of Q){let L=Q2.resolve(Z,B),T=await Bun.file(L).text(),K=`// === ${B} ===
187
+ `;if(W.push(K,T),!T.endsWith(`
188
+ `))W.push(`
189
+ `);if(H+=K.length+T.length,H>U)throw Error(`Codebase source "${$}" exceeded hard cap of ${U} bytes (matched glob ${X.path}). Tighten the glob or raise the limit via maxBytes (and accept the request-size risk).`)}if(H>Y)q?.(` warn: codebase source [${$}] is ${H} bytes (soft cap ${Y}); consider tightening the glob`);let V=W.join("");return{id:$,source:X.path,content:V,name:`${Q.length} file${Q.length===1?"":"s"} in ${X.path}`,type:"codebase",auditTraps:z,matchedFiles:Q}}async function j6($,X,Z,z){let{path:q,auditTraps:G}=T9(X);if(typeof X!=="string"&&X.type==="codebase")return lU($,X,Z,G,z);if(mU(q))return dU($,q,G);return pU($,q,Z,G)}async function l$($,X,Z){let z=Object.entries($);return await Promise.all(z.map(([G,J])=>j6(G,J,X,Z)))}async function S6($){if(!cU(iU($,"pickled.yml")))return{matches:[],findings:[]};let X=await Z$($),Z=X.docs?.sources;if(!Z||Object.keys(Z).length===0)return{matches:[],findings:[]};let z={};for(let[U,W]of Object.entries(Z)){let H=typeof W==="string"?W:W.path;if(H.startsWith("http://")||H.startsWith("https://"))continue;z[U]=W}if(Object.keys(z).length===0)return{matches:[],findings:[]};let q=[],G=new Map;for(let U of X.scenarios)for(let W of U.traps??[])q.push(W),G.set(W,W.auditSeverity??"warning");if(q.length===0)return{matches:[],findings:[]};let J=await l$(z,$),Q=[],Y=[];for(let U of J){let W=U.auditTraps;if(W===!1)continue;let H=Array.isArray(W)?new Set(W):null,V=U.type==="codebase"&&U.matchedFiles?await sU(U.matchedFiles,$,U.source):[{path:U.source,content:U.content}];for(let B of V)for(let L of q){if(H?.has(L.id))continue;let{fired:T}=k0({response:B.content,traps:[L]}),K=T[0];if(!K)continue;let _=nU(B.content,K.index),F=G.get(L)??"warning";Q.push({sourceId:U.id,sourcePath:B.path,trapId:K.id,trapReason:K.reason,matched:K.matched,snippet:K.snippet,line:_,severity:F}),Y.push({severity:F,category:"trap-source-match",file:B.path,message:`source [${U.id}] matches trap '${K.id}' ("${K.matched}") in ${B.path}. ${K.reason} Fix: remove the stale claim from the source, retire the trap if no longer relevant, set audit.traps: ['${K.id}'] on the source to suppress just this trap (other traps still apply), or set audit.traps: false if the source is deliberately stale or test-only.`})}}return{matches:Q,findings:Y}}async function sU($,X,Z){let z=[];for(let q of $)try{let G=await Bun.file(aU(X,q)).text();z.push({path:q,content:G})}catch{}return z}function nU($,X){let Z=1,z=Math.min(X,$.length);for(let q=0;q<z;q++)if($[q]===`
190
+ `)Z++;return Z}var $H=["AGENTS.md","CLAUDE.md","CLAUDE.local.md","llms.txt","llms-full.txt",".claude/CLAUDE.md",".claude/rules/*.md","**/AGENTS.md","**/CLAUDE.md","**/CLAUDE.local.md","**/llms.txt","**/llms-full.txt","**/.claude/CLAUDE.md","**/.claude/rules/*.md"];async function H2($){let X=J2($),Z=K9(X.targetRepo);if(!q$(Z))throw Error(`targetRepo does not exist: ${Z}`);let z=new Set;for(let U of $H){let W=new C6(U);for await(let H of W.scan({cwd:Z,dot:!0,onlyFiles:!1,followSymlinks:!1})){if(X.ignore.some((L)=>new C6(L).match(H)))continue;let V=B9(Z,H),B=E6(V);if(B.isFile()){z.add(H);continue}if(B.isSymbolicLink())try{if(oU(V).isFile())z.add(H)}catch{}}}let q=[];for(let U of[...z].sort())q.push(await XH(Z,U,B9(Z,U),X));let G=TH(q,X),J=BH(q,G,X),{matches:Q,findings:Y}=await S6(Z);return{config:X,files:q,pairs:G,findings:[...J,...Y],sourceTrapMatches:Q}}async function XH($,X,Z,z){let G=E6(Z).isSymbolicLink(),J=null,Q=X;if(G){let V=rU(Z),B=tU(V)?V:K9(U2(Z),V);if(J=B,q$(B))Q=eU($,B)}let Y=G&&J&&q$(J)?J:Z,U=Y2(Y,"utf8"),W=(U.match(/\n/g)??[]).length,H=U.endsWith(`
191
+ `)?W:W+1;return{relPath:X,absPath:Z,isSymlink:G,symlinkTarget:J,realRelPath:Q,lineCount:H,brokenPathRefs:zH(U,$,X),brokenImports:GH(U,U2(Z)),unresolvedCommands:UH(U,$,z.knownCommands),sections:HH(U)}}function ZH($){let X=$.split("/");if(X.length<2)return null;if(X[0]==="packages"||X[0]==="apps"||X[0]==="shared")return`${X[0]}/${X[1]}`;if(X[0]==="tests")return X.slice(0,2).join("/");return null}function zH($,X,Z){let z=VH($),q=U2(Z),G=ZH(Z),J=new Set,Q=/`([^`\n]{2,200})`/g,Y;Y=Q.exec(z);while(Y!==null){let U=Y[1].trim().replace(/[#?].*$/,"");if(WH(U)&&!qH(X,U,q,G).found)J.add(U);Y=Q.exec(z)}return[...J].sort()}function qH($,X,Z,z){let q=[X];if(Z&&Z!==".")q.push(`${Z}/${X}`);if(z)q.push(`${z}/${X}`);q.push(`packages/${X}`,`apps/${X}`,`shared/${X}`);for(let G of q){let J=G.replace(/\/+/g,"/");if(q$(`${$}/${J}`))return{found:!0,resolvedAs:J}}return{found:!1}}function GH($,X){let Z=new Set,z=/@([\w./@~-]+\.md)/g,q;q=z.exec($);while(q!==null){let G=q[1];if(G.startsWith("~/")){q=z.exec($);continue}let J=G.startsWith("/")?G:K9(X,G);if(!q$(J))Z.add(G);q=z.exec($)}return[...Z].sort()}var JH=["bun","pnpm","npm","yarn"],QH=new Set(["install","add","remove","update","i","audit","list","ls","why","outdated","exec","run","create","init","x"]),YH={bun:new Set(["build","test","link","unlink","upgrade"])};function UH($,X,Z){let z=new Set,q=B9(X,"package.json"),G=new Set;if(q$(q))try{let Q=JSON.parse(Y2(q,"utf8"));G=new Set(Object.keys(Q.scripts??{}))}catch{}let J=new Set(Z.map((Q)=>Q.trim()));for(let Q of JH){let Y=new RegExp(`\\b${Q}\\s+(?:run\\s+|--filter\\s+\\S+\\s+(?:run\\s+)?)?([a-zA-Z][\\w:.\\-]*)`,"g"),U;U=Y.exec($);while(U!==null){let W=U[1];if(!G.has(W)&&!J.has(`${Q} ${W}`)&&!J.has(`${Q} run ${W}`)&&!QH.has(W)&&!YH[Q]?.has(W))z.add(`${Q} ${W}`);U=Y.exec($)}}return[...z].sort()}function HH($){let X=$.split(`
192
+ `),Z=[],z=null;if(X.forEach((q,G)=>{if(/^##\s+/.test(q)){if(z)Z.push({header:z.header,lines:G-z.start});z={header:q.replace(/^##\s+/,"").trim(),start:G}}}),z){let q=z;Z.push({header:q.header,lines:X.length-q.start})}return Z.sort((q,G)=>G.lines-q.lines)}function WH($){if($.length===0||$.length>160)return!1;if(!$.includes("/"))return!1;if(/\s/.test($))return!1;if(/^https?:\/\//.test($))return!1;if(/[*?{}[\]<>]/.test($))return!1;if($.startsWith("@"))return!1;if($.startsWith("~/"))return!1;if(/^[a-z]+:\/\//i.test($))return!1;if(/^cdn\./.test($)||/^unpkg\./.test($)||/^npm\./.test($))return!1;if(/^\/[a-z]/.test($)&&/(?:icon|image|img|asset|file|path)/i.test($))return!1;if(/^(cd|pnpm|npm|yarn|bun|node|git|ls|cat|grep|find|sed|awk|mkdir|rm|mv|cp|echo|export|source|sudo|brew|docker|curl|wget)\b/.test($))return!1;return/[a-zA-Z0-9_.-]\/[a-zA-Z0-9_.-]/.test($)}function VH($){return $.replace(/```[\s\S]*?```/g,"")}function TH($,X){let Z=new Map;for(let G of $){let J=G.relPath.split("/").pop()??"";if(J!=="AGENTS.md"&&J!=="CLAUDE.md")continue;let Q=U2(G.relPath),Y=Z.get(Q)??{};if(J==="AGENTS.md")Y.agents=G;if(J==="CLAUDE.md")Y.claude=G;Z.set(Q,Y)}let z=new Set(X.intentionalDifferentPairs),q=[];for(let[G,J]of Z){let Q=!!J.agents,Y=!!J.claude;if(!Q&&!Y)continue;if(!Q||!Y){q.push({dir:G,agentsExists:Q,claudeExists:Y,classification:"single",detail:Q?"only AGENTS.md":"only CLAUDE.md"});continue}let{agents:U,claude:W}=J,H=`${U.relPath}:${W.relPath}`,V=`${W.relPath}:${U.relPath}`;if(z.has(H)||z.has(V)){q.push({dir:G,agentsExists:Q,claudeExists:Y,classification:"intentional-different",detail:`allowlisted: ${U.lineCount}L vs ${W.lineCount}L`});continue}if(U.isSymlink&&U.symlinkTarget===W.absPath||W.isSymlink&&W.symlinkTarget===U.absPath){let K=U.isSymlink?"CLAUDE.md":"AGENTS.md";q.push({dir:G,agentsExists:Q,claudeExists:Y,classification:"linked",detail:`canonical: ${K}`});continue}let L=Y2(U.absPath,"utf8"),T=Y2(W.absPath,"utf8");if(L===T)q.push({dir:G,agentsExists:Q,claudeExists:Y,classification:"unexpected-duplicate",detail:`byte-for-byte duplicate (${U.lineCount}L), not symlinked`});else q.push({dir:G,agentsExists:Q,claudeExists:Y,classification:"unexpected-duplicate",detail:`divergent (${U.lineCount}L vs ${W.lineCount}L), not in intentional-different allowlist`})}return q.sort((G,J)=>G.dir.localeCompare(J.dir)),q}function BH($,X,Z){let z=[];for(let q of $){if(q.isSymlink)continue;for(let Q of q.brokenImports)z.push({severity:"error",category:"broken-import",file:q.relPath,message:`broken @-import: ${Q}`});for(let Q of q.brokenPathRefs)z.push({severity:"error",category:"broken-path-ref",file:q.relPath,message:`broken path reference: ${Q}`});for(let Q of q.unresolvedCommands)z.push({severity:"warning",category:"unresolved-command",file:q.relPath,message:`unresolved command: ${Q}`});let G=!q.relPath.includes("/"),J=G?Z.budgets.rootLines:Z.budgets.nestedWarnLines;if(q.lineCount>J)z.push({severity:"warning",category:"over-budget",file:q.relPath,message:`${q.lineCount} lines exceeds ${G?"root":"nested"} budget of ${J}`})}for(let q of X)if(q.classification==="unexpected-duplicate"){let G=q.detail.startsWith("divergent")?"error":"warning";z.push({severity:G,category:G==="error"?"divergent-pair":"duplicate-pair",file:q.dir||"(root)",message:`AGENTS.md / CLAUDE.md ${q.detail}`})}return z}function f0($){let X=$.confidence;if($.error)return{icon:"\u2717",label:"Error",confidence:X,tone:"error"};if($.traps.fired.length>0)return{icon:"\u2717",label:"Trap fired",confidence:X,tone:"error"};if($.answerable==="YES")return{icon:"\u2713",label:X>=90?"Well grounded":"Grounded",confidence:X,tone:"success"};if($.answerable==="PARTIAL")return{icon:"\u26A0",label:"Partially grounded",confidence:X,tone:"warning"};return{icon:"\u2717",label:"Ungrounded",confidence:X,tone:"error"}}function L9($){let X=KH($);if(X===null)return[];let Z=[],z=/^\s*-\s+\[([^\]]+)\]\s*(.*)$/gm,q=z.exec(X);while(q!==null)Z.push({id:q[1].trim(),note:q[2].trim()||void 0}),q=z.exec(X);return Z}function KH($){let Z=/^##\s+Sources\s*$/im.exec($);if(!Z)return null;let z=Z.index+Z[0].length,q=$.slice(z),G=/^##\s+/m.exec(q);return G?q.slice(0,G.index):q}function c$($){let X=L9($.response),Z=new Set(X.map((V)=>V.id)),z=new Set($.registeredIds),q=new Set($.requiredSources),G=[...Z],J=[...q].filter((V)=>!Z.has(V)),Q=[...Z].filter((V)=>!z.has(V)),Y=[...q],U,W,H;if(G.length===0)U="NO",W=0,H="No citations in response";else if(Q.length===G.length)U="NO",W=0,H=`All cited sources are unknown: ${Q.join(", ")}`;else if(J.length===0&&Q.length===0)U="YES",W=100,H=Y.length>0?`All required sources cited: ${Y.join(", ")}`:`Cited registered sources: ${G.join(", ")}`;else{U="PARTIAL";let V=Y.length>0?Y.length:1,B=Y.length-J.length,L=Y.length>0?B/V*100:60,T=Q.length*15;W=Math.max(0,Math.min(100,Math.round(L-T)));let K=[];if(J.length>0)K.push(`missing: ${J.join(", ")}`);if(Q.length>0)K.push(`unknown: ${Q.join(", ")}`);H=K.join("; ")}return{answerable:U,confidence:W,reason:H,citations:{cited:G,required:Y,missing:J,unknown:Q}}}var g0="0.40.1";var b6=!1,h0=void 0,D9=void 0,LH=void 0,DH=void 0,_H=void 0,x6=void 0,FH=void 0,W2=void 0,_9=void 0,y6=void 0,F9=void 0,V2=void 0,k6=void 0;function f6($,X={auto:!1}){if(b6)throw Error(`you must \`import '@anthropic-ai/sdk/shims/${$.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(h0)throw Error(`can't \`import '@anthropic-ai/sdk/shims/${$.kind}'\` after \`import '@anthropic-ai/sdk/shims/${h0}'\``);b6=X.auto,h0=$.kind,D9=$.fetch,LH=$.Request,DH=$.Response,_H=$.Headers,x6=$.FormData,FH=$.Blob,W2=$.File,_9=$.ReadableStream,y6=$.getMultipartRequestOptions,F9=$.getDefaultAgent,V2=$.fileFromPath,k6=$.isFsReadStream}class M9{constructor($){this.body=$}get[Symbol.toStringTag](){return"MultipartBody"}}function g6({manuallyImported:$}={}){let X=$?"You may need to use polyfills":"Add one of these imports before your first `import \u2026 from '@anthropic-ai/sdk'`:\n- `import '@anthropic-ai/sdk/shims/node'` (if you're running on Node)\n- `import '@anthropic-ai/sdk/shims/web'` (otherwise)\n",Z,z,q,G;try{Z=fetch,z=Request,q=Response,G=Headers}catch(J){throw Error(`this environment is missing the following Web Fetch API type: ${J.message}. ${X}`)}return{kind:"web",fetch:Z,Request:z,Response:q,Headers:G,FormData:typeof FormData<"u"?FormData:class{constructor(){throw Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${X}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${X}`)}},File:typeof File<"u"?File:class{constructor(){throw Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${X}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${X}`)}},getMultipartRequestOptions:async(J,Q)=>({...Q,body:new M9(J)}),getDefaultAgent:(J)=>{return},fileFromPath:()=>{throw Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/anthropics/anthropic-sdk-typescript#file-uploads")},isFsReadStream:(J)=>!1}}import{ReadStream as OH}from"fs";function h6(){let $=g6();function X(Z){return Z instanceof OH}return{...$,isFsReadStream:X}}var O9=()=>{if(!h0)f6(h6(),{auto:!0})};O9();class P extends Error{}class v extends P{constructor($,X,Z,z){super(`${v.makeMessage($,X,Z)}`);this.status=$,this.headers=z,this.request_id=z?.["request-id"],this.error=X}static makeMessage($,X,Z){let z=X?.message?typeof X.message==="string"?X.message:JSON.stringify(X.message):X?JSON.stringify(X):Z;if($&&z)return`${$} ${z}`;if($)return`${$} status code (no body)`;if(z)return z;return"(no status code or body)"}static generate($,X,Z,z){if(!$||!z)return new v0({message:Z,cause:O2(X)});let q=X;if($===400)return new T2($,q,Z,z);if($===401)return new B2($,q,Z,z);if($===403)return new K2($,q,Z,z);if($===404)return new L2($,q,Z,z);if($===409)return new D2($,q,Z,z);if($===422)return new _2($,q,Z,z);if($===429)return new F2($,q,Z,z);if($>=500)return new M2($,q,Z,z);return new v($,q,Z,z)}}class m extends v{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class v0 extends v{constructor({message:$,cause:X}){super(void 0,void 0,$||"Connection error.",void 0);if(X)this.cause=X}}class i$ extends v0{constructor({message:$}={}){super({message:$??"Request timed out."})}}class T2 extends v{}class B2 extends v{}class K2 extends v{}class L2 extends v{}class D2 extends v{}class _2 extends v{}class F2 extends v{}class M2 extends v{}var w2=function($,X,Z,z,q){if(z==="m")throw TypeError("Private method is not writable");if(z==="a"&&!q)throw TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!q:!X.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?q.call($,Z):q?q.value=Z:X.set($,Z),Z},u0=function($,X,Z,z){if(Z==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!z:!X.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return Z==="m"?z:Z==="a"?z.call($):z?z.value:X.get($)},c;class R0{constructor(){c.set(this,void 0),this.buffer=new Uint8Array,w2(this,c,null,"f")}decode($){if($==null)return[];let X=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?new TextEncoder().encode($):$,Z=new Uint8Array(this.buffer.length+X.length);Z.set(this.buffer),Z.set(X,this.buffer.length),this.buffer=Z;let z=[],q;while((q=IH(this.buffer,u0(this,c,"f")))!=null){if(q.carriage&&u0(this,c,"f")==null){w2(this,c,q.index,"f");continue}if(u0(this,c,"f")!=null&&(q.index!==u0(this,c,"f")+1||q.carriage)){z.push(this.decodeText(this.buffer.slice(0,u0(this,c,"f")-1))),this.buffer=this.buffer.slice(u0(this,c,"f")),w2(this,c,null,"f");continue}let G=u0(this,c,"f")!==null?q.preceding-1:q.preceding,J=this.decodeText(this.buffer.slice(0,G));z.push(J),this.buffer=this.buffer.slice(q.index),w2(this,c,null,"f")}return z}decodeText($){if($==null)return"";if(typeof $==="string")return $;if(typeof Buffer<"u"){if($ instanceof Buffer)return $.toString();if($ instanceof Uint8Array)return Buffer.from($).toString();throw new P(`Unexpected: received non-Uint8Array (${$.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if($ instanceof Uint8Array||$ instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode($);throw new P(`Unexpected: received non-Uint8Array/ArrayBuffer (${$.constructor.name}) in a web platform. Please report this error.`)}throw new P("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length)return[];return this.decode(`
193
+ `)}}c=new WeakMap;R0.NEWLINE_CHARS=new Set([`
194
+ `,"\r"]);R0.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function IH($,X){for(let q=X??0;q<$.length;q++){if($[q]===10)return{preceding:q,index:q+1,carriage:!1};if($[q]===13)return{preceding:q,index:q+1,carriage:!0}}return null}function v6($){for(let z=0;z<$.length-1;z++){if($[z]===10&&$[z+1]===10)return z+2;if($[z]===13&&$[z+1]===13)return z+2;if($[z]===13&&$[z+1]===10&&z+3<$.length&&$[z+2]===13&&$[z+3]===10)return z+4}return-1}function a$($){if($[Symbol.asyncIterator])return $;let X=$.getReader();return{async next(){try{let Z=await X.read();if(Z?.done)X.releaseLock();return Z}catch(Z){throw X.releaseLock(),Z}},async return(){let Z=X.cancel();return X.releaseLock(),await Z,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}class i{constructor($,X){this.iterator=$,this.controller=X}static fromSSEResponse($,X){let Z=!1;async function*z(){if(Z)throw Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Z=!0;let q=!1;try{for await(let G of RH($,X)){if(G.event==="completion")try{yield JSON.parse(G.data)}catch(J){throw console.error("Could not parse message into JSON:",G.data),console.error("From chunk:",G.raw),J}if(G.event==="message_start"||G.event==="message_delta"||G.event==="message_stop"||G.event==="content_block_start"||G.event==="content_block_delta"||G.event==="content_block_stop")try{yield JSON.parse(G.data)}catch(J){throw console.error("Could not parse message into JSON:",G.data),console.error("From chunk:",G.raw),J}if(G.event==="ping")continue;if(G.event==="error")throw v.generate(void 0,`SSE Error: ${G.data}`,G.data,w9($.headers))}q=!0}catch(G){if(G instanceof Error&&G.name==="AbortError")return;throw G}finally{if(!q)X.abort()}}return new i(z,X)}static fromReadableStream($,X){let Z=!1;async function*z(){let G=new R0,J=a$($);for await(let Q of J)for(let Y of G.decode(Q))yield Y;for(let Q of G.flush())yield Q}async function*q(){if(Z)throw Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");Z=!0;let G=!1;try{for await(let J of z()){if(G)continue;if(J)yield JSON.parse(J)}G=!0}catch(J){if(J instanceof Error&&J.name==="AbortError")return;throw J}finally{if(!G)X.abort()}}return new i(q,X)}[Symbol.asyncIterator](){return this.iterator()}tee(){let $=[],X=[],Z=this.iterator(),z=(q)=>{return{next:()=>{if(q.length===0){let G=Z.next();$.push(G),X.push(G)}return q.shift()}}};return[new i(()=>z($),this.controller),new i(()=>z(X),this.controller)]}toReadableStream(){let $=this,X,Z=new TextEncoder;return new _9({async start(){X=$[Symbol.asyncIterator]()},async pull(z){try{let{value:q,done:G}=await X.next();if(G)return z.close();let J=Z.encode(JSON.stringify(q)+`
195
+ `);z.enqueue(J)}catch(q){z.error(q)}},async cancel(){await X.return?.()}})}}async function*RH($,X){if(!$.body)throw X.abort(),new P("Attempted to iterate over a response with no body");let Z=new u6,z=new R0,q=a$($.body);for await(let G of PH(q))for(let J of z.decode(G)){let Q=Z.decode(J);if(Q)yield Q}for(let G of z.flush()){let J=Z.decode(G);if(J)yield J}}async function*PH($){let X=new Uint8Array;for await(let Z of $){if(Z==null)continue;let z=Z instanceof ArrayBuffer?new Uint8Array(Z):typeof Z==="string"?new TextEncoder().encode(Z):Z,q=new Uint8Array(X.length+z.length);q.set(X),q.set(z,X.length),X=q;let G;while((G=v6(X))!==-1)yield X.slice(0,G),X=X.slice(G)}if(X.length>0)yield X}class u6{constructor(){this.event=null,this.data=[],this.chunks=[]}decode($){if($.endsWith("\r"))$=$.substring(0,$.length-1);if(!$){if(!this.event&&!this.data.length)return null;let q={event:this.event,data:this.data.join(`
196
+ `),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],q}if(this.chunks.push($),$.startsWith(":"))return null;let[X,Z,z]=NH($,":");if(z.startsWith(" "))z=z.substring(1);if(X==="event")this.event=z;else if(X==="data")this.data.push(z);return null}}function NH($,X){let Z=$.indexOf(X);if(Z!==-1)return[$.substring(0,Z),X,$.substring(Z+X.length)];return[$,"",""]}var AH=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function",jH=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&s$($),s$=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function";async function m6($,X,Z){if($=await $,jH($))return $;if(AH($)){let q=await $.blob();X||(X=new URL($.url).pathname.split(/[\\/]/).pop()??"unknown_file");let G=s$(q)?[await q.arrayBuffer()]:[q];return new W2(G,X,Z)}let z=await SH($);if(X||(X=EH($)??"unknown_file"),!Z?.type){let q=z[0]?.type;if(typeof q==="string")Z={...Z,type:q}}return new W2(z,X,Z)}async function SH($){let X=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)X.push($);else if(s$($))X.push(await $.arrayBuffer());else if(bH($))for await(let Z of $)X.push(Z);else throw Error(`Unexpected data type: ${typeof $}; constructor: ${$?.constructor?.name}; props: ${CH($)}`);return X}function CH($){return`[${Object.getOwnPropertyNames($).map((Z)=>`"${Z}"`).join(", ")}]`}function EH($){return I9($.name)||I9($.filename)||I9($.path)?.split(/[\\/]/).pop()}var I9=($)=>{if(typeof $==="string")return $;if(typeof Buffer<"u"&&$ instanceof Buffer)return String($);return},bH=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",R9=($)=>$&&typeof $==="object"&&$.body&&$[Symbol.toStringTag]==="MultipartBody";var yH=function($,X,Z,z,q){if(z==="m")throw TypeError("Private method is not writable");if(z==="a"&&!q)throw TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!q:!X.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?q.call($,Z):q?q.value=Z:X.set($,Z),Z},kH=function($,X,Z,z){if(Z==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!z:!X.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return Z==="m"?z:Z==="a"?z.call($):z?z.value:X.get($)},I2;O9();async function i6($){let{response:X}=$;if($.options.stream){if(G$("response",X.status,X.url,X.headers,X.body),$.options.__streamClass)return $.options.__streamClass.fromSSEResponse(X,$.controller);return i.fromSSEResponse(X,$.controller)}if(X.status===204)return null;if($.options.__binaryResponse)return X;let z=X.headers.get("content-type")?.split(";")[0]?.trim();if(z?.includes("application/json")||z?.endsWith("+json")){let J=await X.json();return G$("response",X.status,X.url,X.headers,J),a6(J,X)}let G=await X.text();return G$("response",X.status,X.url,X.headers,G),G}function a6($,X){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:X.headers.get("request-id"),enumerable:!1})}class P2 extends Promise{constructor($,X=i6){super((Z)=>{Z(null)});this.responsePromise=$,this.parseResponse=X}_thenUnwrap($){return new P2(this.responsePromise,async(X)=>a6($(await this.parseResponse(X),X),X.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,X]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:X,request_id:X.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(this.parseResponse);return this.parsedPromise}then($,X){return this.parse().then($,X)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}}class N9{constructor({baseURL:$,maxRetries:X=2,timeout:Z=600000,httpAgent:z,fetch:q}){this.baseURL=$,this.maxRetries=P9("maxRetries",X),this.timeout=P9("timeout",Z),this.httpAgent=z,this.fetch=q??D9}authHeaders($){return{}}defaultHeaders($){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...vH(),...this.authHeaders($)}}validateHeaders($,X){}defaultIdempotencyKey(){return`stainless-node-retry-${lH()}`}get($,X){return this.methodRequest("get",$,X)}post($,X){return this.methodRequest("post",$,X)}patch($,X){return this.methodRequest("patch",$,X)}put($,X){return this.methodRequest("put",$,X)}delete($,X){return this.methodRequest("delete",$,X)}methodRequest($,X,Z){return this.request(Promise.resolve(Z).then(async(z)=>{let q=z&&s$(z?.body)?new DataView(await z.body.arrayBuffer()):z?.body instanceof DataView?z.body:z?.body instanceof ArrayBuffer?new DataView(z.body):z&&ArrayBuffer.isView(z?.body)?new DataView(z.body.buffer):z?.body;return{method:$,path:X,...z,body:q}}))}getAPIList($,X,Z){return this.requestAPIList(X,{method:"get",path:$,...Z})}calculateContentLength($){if(typeof $==="string"){if(typeof Buffer<"u")return Buffer.byteLength($,"utf8").toString();if(typeof TextEncoder<"u")return new TextEncoder().encode($).length.toString()}else if(ArrayBuffer.isView($))return $.byteLength.toString();return null}buildRequest($,{retryCount:X=0}={}){let Z={...$},{method:z,path:q,query:G,headers:J={}}=Z,Q=ArrayBuffer.isView(Z.body)||Z.__binaryRequest&&typeof Z.body==="string"?Z.body:R9(Z.body)?Z.body.body:Z.body?JSON.stringify(Z.body,null,2):null,Y=this.calculateContentLength(Q),U=this.buildURL(q,G);if("timeout"in Z)P9("timeout",Z.timeout);Z.timeout=Z.timeout??this.timeout;let W=Z.httpAgent??this.httpAgent??F9(U),H=Z.timeout+1000;if(typeof W?.options?.timeout==="number"&&H>(W.options.timeout??0))W.options.timeout=H;if(this.idempotencyHeader&&z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();J[this.idempotencyHeader]=$.idempotencyKey}let V=this.buildHeaders({options:Z,headers:J,contentLength:Y,retryCount:X});return{req:{method:z,...Q&&{body:Q},headers:V,...W&&{agent:W},signal:Z.signal??null},url:U,timeout:Z.timeout}}buildHeaders({options:$,headers:X,contentLength:Z,retryCount:z}){let q={};if(Z)q["content-length"]=Z;let G=this.defaultHeaders($);if(c6(q,G),c6(q,X),R9($.body)&&h0!=="node")delete q["content-type"];if(R2(G,"x-stainless-retry-count")===void 0&&R2(X,"x-stainless-retry-count")===void 0)q["x-stainless-retry-count"]=String(z);if(R2(G,"x-stainless-timeout")===void 0&&R2(X,"x-stainless-timeout")===void 0&&$.timeout)q["x-stainless-timeout"]=String(Math.trunc($.timeout/1000));return this.validateHeaders(q,X),q}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new P("Streaming is strongly recommended for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-python#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:X,options:Z}){}parseHeaders($){return!$?{}:(Symbol.iterator in $)?Object.fromEntries(Array.from($).map((X)=>[...X])):{...$}}makeStatusError($,X,Z,z){return v.generate($,X,Z,z)}request($,X=null){return new P2(this.makeRequest($,X))}async makeRequest($,X){let Z=await $,z=Z.maxRetries??this.maxRetries;if(X==null)X=z;await this.prepareOptions(Z);let{req:q,url:G,timeout:J}=this.buildRequest(Z,{retryCount:z-X});if(await this.prepareRequest(q,{url:G,options:Z}),G$("request",G,Z,q.headers),Z.signal?.aborted)throw new m;let Q=new AbortController,Y=await this.fetchWithTimeout(G,q,J,Q).catch(O2);if(Y instanceof Error){if(Z.signal?.aborted)throw new m;if(X)return this.retryRequest(Z,X);if(Y.name==="AbortError")throw new i$;throw new v0({cause:Y})}let U=w9(Y.headers);if(!Y.ok){if(X&&this.shouldRetry(Y)){let T=`retrying, ${X} attempts remaining`;return G$(`response (error; ${T})`,Y.status,G,U),this.retryRequest(Z,X,U)}let W=await Y.text().catch((T)=>O2(T).message),H=uH(W),V=H?void 0:W;throw G$(`response (error; ${X?"(error; no more retries left)":"(error; not retryable)"})`,Y.status,G,U,V),this.makeStatusError(Y.status,H,V,U)}return{response:Y,options:Z,controller:Q}}requestAPIList($,X){let Z=this.makeRequest(X,null);return new s6(this,Z,$)}buildURL($,X){let Z=dH($)?new URL($):new URL(this.baseURL+(this.baseURL.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),z=this.defaultQuery();if(!n6(z))X={...z,...X};if(typeof X==="object"&&X&&!Array.isArray(X))Z.search=this.stringifyQuery(X);return Z.toString()}stringifyQuery($){return Object.entries($).filter(([X,Z])=>typeof Z<"u").map(([X,Z])=>{if(typeof Z==="string"||typeof Z==="number"||typeof Z==="boolean")return`${encodeURIComponent(X)}=${encodeURIComponent(Z)}`;if(Z===null)return`${encodeURIComponent(X)}=`;throw new P(`Cannot stringify type ${typeof Z}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}async fetchWithTimeout($,X,Z,z){let{signal:q,...G}=X||{};if(q)q.addEventListener("abort",()=>z.abort());let J=setTimeout(()=>z.abort(),Z),Q={signal:z.signal,...G};if(Q.method)Q.method=Q.method.toUpperCase();let Y=60000,U=setTimeout(()=>{if(Q&&Q?.agent?.sockets){for(let W of Object.values(Q?.agent?.sockets).flat())if(W?.setKeepAlive)W.setKeepAlive(!0,Y)}},Y);return this.fetch.call(void 0,$,Q).finally(()=>{clearTimeout(J),clearTimeout(U)})}shouldRetry($){let X=$.headers.get("x-should-retry");if(X==="true")return!0;if(X==="false")return!1;if($.status===408)return!0;if($.status===409)return!0;if($.status===429)return!0;if($.status>=500)return!0;return!1}async retryRequest($,X,Z){let z,q=Z?.["retry-after-ms"];if(q){let J=parseFloat(q);if(!Number.isNaN(J))z=J}let G=Z?.["retry-after"];if(G&&!z){let J=parseFloat(G);if(!Number.isNaN(J))z=J*1000;else z=Date.parse(G)-Date.now()}if(!(z&&0<=z&&z<60000)){let J=$.maxRetries??this.maxRetries;z=this.calculateDefaultRetryTimeoutMillis(X,J)}return await pH(z),this.makeRequest($,X-1)}calculateDefaultRetryTimeoutMillis($,X){let q=X-$,G=Math.min(0.5*Math.pow(2,q),8),J=1-Math.random()*0.25;return G*J*1000}getUserAgent(){return`${this.constructor.name}/JS ${g0}`}}class A9{constructor($,X,Z,z){I2.set(this,void 0),yH(this,I2,$,"f"),this.options=z,this.response=X,this.body=Z}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageInfo()!=null}async getNextPage(){let $=this.nextPageInfo();if(!$)throw new P("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let X={...this.options};if("params"in $&&typeof X.query==="object")X.query={...X.query,...$.params};else if("url"in $){let Z=[...Object.entries(X.query||{}),...$.url.searchParams.entries()];for(let[z,q]of Z)$.url.searchParams.set(z,q);X.query=void 0,X.path=$.url.toString()}return await kH(this,I2,"f").requestAPIList(this.constructor,X)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(I2=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let X of $.getPaginatedItems())yield X}}class s6 extends P2{constructor($,X,Z){super(X,async(z)=>new Z($,z.response,await i6(z),z.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let X of $)yield X}}var w9=($)=>{return new Proxy(Object.fromEntries($.entries()),{get(X,Z){let z=Z.toString();return X[z.toLowerCase()]||X[z]}})},fH={method:!0,path:!0,query:!0,body:!0,headers:!0,maxRetries:!0,stream:!0,timeout:!0,httpAgent:!0,signal:!0,idempotencyKey:!0,__binaryRequest:!0,__binaryResponse:!0,__streamClass:!0},r=($)=>{return typeof $==="object"&&$!==null&&!n6($)&&Object.keys($).every((X)=>r6(fH,X))},gH=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":g0,"X-Stainless-OS":p6(Deno.build.os),"X-Stainless-Arch":d6(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":g0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":process.version};if(Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":g0,"X-Stainless-OS":p6(process.platform),"X-Stainless-Arch":d6(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let $=hH();if($)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":g0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${$.browser}`,"X-Stainless-Runtime-Version":$.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":g0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function hH(){if(typeof navigator>"u"||!navigator)return null;let $=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:X,pattern:Z}of $){let z=Z.exec(navigator.userAgent);if(z){let q=z[1]||0,G=z[2]||0,J=z[3]||0;return{browser:X,version:`${q}.${G}.${J}`}}}return null}var d6=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},p6=($)=>{if($=$.toLowerCase(),$.includes("ios"))return"iOS";if($==="android")return"Android";if($==="darwin")return"MacOS";if($==="win32")return"Windows";if($==="freebsd")return"FreeBSD";if($==="openbsd")return"OpenBSD";if($==="linux")return"Linux";if($)return`Other:${$}`;return"Unknown"},l6,vH=()=>{return l6??(l6=gH())},uH=($)=>{try{return JSON.parse($)}catch(X){return}},mH=/^[a-z][a-z0-9+.-]*:/i,dH=($)=>{return mH.test($)},pH=($)=>new Promise((X)=>setTimeout(X,$)),P9=($,X)=>{if(typeof X!=="number"||!Number.isInteger(X))throw new P(`${$} must be an integer`);if(X<0)throw new P(`${$} must be a positive integer`);return X},O2=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null)try{return Error(JSON.stringify($))}catch{}return Error(String($))};var N2=($)=>{if(typeof process<"u")return process.env?.[$]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.($)?.trim();return};function n6($){if(!$)return!0;for(let X in $)return!1;return!0}function r6($,X){return Object.prototype.hasOwnProperty.call($,X)}function c6($,X){for(let Z in X){if(!r6(X,Z))continue;let z=Z.toLowerCase();if(!z)continue;let q=X[Z];if(q===null)delete $[z];else if(q!==void 0)$[z]=q}}function G$($,...X){if(typeof process<"u"&&process?.env?.DEBUG==="true")console.log(`Anthropic:DEBUG:${$}`,...X)}var lH=()=>{return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,($)=>{let X=Math.random()*16|0;return($==="x"?X:X&3|8).toString(16)})},o6=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},cH=($)=>{return typeof $?.get==="function"};var R2=($,X)=>{let Z=X.toLowerCase();if(cH($)){let z=X[0]?.toUpperCase()+X.substring(1).replace(/([^\w])(\w)/g,(q,G,J)=>G+J.toUpperCase());for(let q of[X,Z,X.toUpperCase(),z]){let G=$.get(q);if(G)return G}}for(let[z,q]of Object.entries($))if(z.toLowerCase()===Z){if(Array.isArray(q)){if(q.length<=1)return q[0];return console.warn(`Received ${q.length} entries for the ${X} header, using the first entry.`),q[0]}return q}return};class W0 extends A9{constructor($,X,Z,z){super($,X,Z,z);this.data=Z.data||[],this.has_more=Z.has_more||!1,this.first_id=Z.first_id||null,this.last_id=Z.last_id||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageParams(){let $=this.nextPageInfo();if(!$)return null;if("params"in $)return $.params;let X=Object.fromEntries($.url.searchParams);if(!Object.keys(X).length)return null;return X}nextPageInfo(){if(this.options.query?.before_id){let X=this.first_id;if(!X)return null;return{params:{before_id:X}}}let $=this.last_id;if(!$)return null;return{params:{after_id:$}}}}class u{constructor($){this._client=$}}class J$ extends u{retrieve($,X){return this._client.get(`/v1/models/${$}?beta=true`,X)}list($={},X){if(r($))return this.list({},$);return this._client.getAPIList("/v1/models?beta=true",n$,{query:$,...X})}}class n$ extends W0{}J$.BetaModelInfosPage=n$;class Q${constructor($,X){this.iterator=$,this.controller=X}async*decoder(){let $=new R0;for await(let X of this.iterator)for(let Z of $.decode(X))yield JSON.parse(Z);for(let X of $.flush())yield JSON.parse(X)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,X){if(!$.body)throw X.abort(),new P("Attempted to iterate over a response with no body");return new Q$(a$($.body),X)}}class Y$ extends u{create($,X){let{betas:Z,...z}=$;return this._client.post("/v1/messages/batches?beta=true",{body:z,...X,headers:{"anthropic-beta":[...Z??[],"message-batches-2024-09-24"].toString(),...X?.headers}})}retrieve($,X={},Z){if(r(X))return this.retrieve($,{},X);let{betas:z}=X;return this._client.get(`/v1/messages/batches/${$}?beta=true`,{...Z,headers:{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString(),...Z?.headers}})}list($={},X){if(r($))return this.list({},$);let{betas:Z,...z}=$;return this._client.getAPIList("/v1/messages/batches?beta=true",r$,{query:z,...X,headers:{"anthropic-beta":[...Z??[],"message-batches-2024-09-24"].toString(),...X?.headers}})}delete($,X={},Z){if(r(X))return this.delete($,{},X);let{betas:z}=X;return this._client.delete(`/v1/messages/batches/${$}?beta=true`,{...Z,headers:{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString(),...Z?.headers}})}cancel($,X={},Z){if(r(X))return this.cancel($,{},X);let{betas:z}=X;return this._client.post(`/v1/messages/batches/${$}/cancel?beta=true`,{...Z,headers:{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString(),...Z?.headers}})}async results($,X={},Z){if(r(X))return this.results($,{},X);let z=await this.retrieve($);if(!z.results_url)throw new P(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);let{betas:q}=X;return this._client.get(z.results_url,{...Z,headers:{"anthropic-beta":[...q??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary",...Z?.headers},stream:!0,__binaryResponse:!0})._thenUnwrap((G,J)=>Q$.fromResponse(J.response,J.controller))}}class r$ extends W0{}Y$.BetaMessageBatchesPage=r$;var nH=($)=>{let X=0,Z=[];while(X<$.length){let z=$[X];if(z==="\\"){X++;continue}if(z==="{"){Z.push({type:"brace",value:"{"}),X++;continue}if(z==="}"){Z.push({type:"brace",value:"}"}),X++;continue}if(z==="["){Z.push({type:"paren",value:"["}),X++;continue}if(z==="]"){Z.push({type:"paren",value:"]"}),X++;continue}if(z===":"){Z.push({type:"separator",value:":"}),X++;continue}if(z===","){Z.push({type:"delimiter",value:","}),X++;continue}if(z==='"'){let Q="",Y=!1;z=$[++X];while(z!=='"'){if(X===$.length){Y=!0;break}if(z==="\\"){if(X++,X===$.length){Y=!0;break}Q+=z+$[X],z=$[++X]}else Q+=z,z=$[++X]}if(z=$[++X],!Y)Z.push({type:"string",value:Q});continue}if(z&&/\s/.test(z)){X++;continue}let G=/[0-9]/;if(z&&G.test(z)||z==="-"||z==="."){let Q="";if(z==="-")Q+=z,z=$[++X];while(z&&G.test(z)||z===".")Q+=z,z=$[++X];Z.push({type:"number",value:Q});continue}let J=/[a-z]/i;if(z&&J.test(z)){let Q="";while(z&&J.test(z)){if(X===$.length)break;Q+=z,z=$[++X]}if(Q=="true"||Q=="false"||Q==="null")Z.push({type:"name",value:Q});else{X++;continue}continue}X++}return Z},U$=($)=>{if($.length===0)return $;let X=$[$.length-1];switch(X.type){case"separator":return $=$.slice(0,$.length-1),U$($);break;case"number":let Z=X.value[X.value.length-1];if(Z==="."||Z==="-")return $=$.slice(0,$.length-1),U$($);case"string":let z=$[$.length-2];if(z?.type==="delimiter")return $=$.slice(0,$.length-1),U$($);else if(z?.type==="brace"&&z.value==="{")return $=$.slice(0,$.length-1),U$($);break;case"delimiter":return $=$.slice(0,$.length-1),U$($);break}return $},rH=($)=>{let X=[];if($.map((Z)=>{if(Z.type==="brace")if(Z.value==="{")X.push("}");else X.splice(X.lastIndexOf("}"),1);if(Z.type==="paren")if(Z.value==="[")X.push("]");else X.splice(X.lastIndexOf("]"),1)}),X.length>0)X.reverse().map((Z)=>{if(Z==="}")$.push({type:"brace",value:"}"});else if(Z==="]")$.push({type:"paren",value:"]"})});return $},oH=($)=>{let X="";return $.map((Z)=>{switch(Z.type){case"string":X+='"'+Z.value+'"';break;default:X+=Z.value;break}}),X},A2=($)=>JSON.parse(oH(rH(U$(nH($)))));var d=function($,X,Z,z,q){if(z==="m")throw TypeError("Private method is not writable");if(z==="a"&&!q)throw TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!q:!X.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?q.call($,Z):q?q.value=Z:X.set($,Z),Z},A=function($,X,Z,z){if(Z==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!z:!X.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return Z==="m"?z:Z==="a"?z.call($):z?z.value:X.get($)},o,P0,o$,j2,t$,e$,S2,$1,V0,X1,C2,E2,H$,b2,x2,j9,t6,S9,C9,E9,b9,e6,$8="__json_buf";class Z1{constructor(){o.add(this),this.messages=[],this.receivedMessages=[],P0.set(this,void 0),this.controller=new AbortController,o$.set(this,void 0),j2.set(this,()=>{}),t$.set(this,()=>{}),e$.set(this,void 0),S2.set(this,()=>{}),$1.set(this,()=>{}),V0.set(this,{}),X1.set(this,!1),C2.set(this,!1),E2.set(this,!1),H$.set(this,!1),b2.set(this,void 0),x2.set(this,void 0),S9.set(this,($)=>{if(d(this,C2,!0,"f"),$ instanceof Error&&$.name==="AbortError")$=new m;if($ instanceof m)return d(this,E2,!0,"f"),this._emit("abort",$);if($ instanceof P)return this._emit("error",$);if($ instanceof Error){let X=new P($.message);return X.cause=$,this._emit("error",X)}return this._emit("error",new P(String($)))}),d(this,o$,new Promise(($,X)=>{d(this,j2,$,"f"),d(this,t$,X,"f")}),"f"),d(this,e$,new Promise(($,X)=>{d(this,S2,$,"f"),d(this,$1,X,"f")}),"f"),A(this,o$,"f").catch(()=>{}),A(this,e$,"f").catch(()=>{})}get response(){return A(this,b2,"f")}get request_id(){return A(this,x2,"f")}async withResponse(){let $=await A(this,o$,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let X=new Z1;return X._run(()=>X._fromReadableStream($)),X}static createMessage($,X,Z){let z=new Z1;for(let q of X.messages)z._addMessageParam(q);return z._run(()=>z._createMessage($,{...X,stream:!0},{...Z,headers:{...Z?.headers,"X-Stainless-Helper-Method":"stream"}})),z}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},A(this,S9,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,X=!0){if(this.receivedMessages.push($),X)this._emit("message",$)}async _createMessage($,X,Z){let z=Z?.signal;if(z){if(z.aborted)this.controller.abort();z.addEventListener("abort",()=>this.controller.abort())}A(this,o,"m",C9).call(this);let{response:q,data:G}=await $.create({...X,stream:!0},{...Z,signal:this.controller.signal}).withResponse();this._connected(q);for await(let J of G)A(this,o,"m",E9).call(this,J);if(G.controller.signal?.aborted)throw new m;A(this,o,"m",b9).call(this)}_connected($){if(this.ended)return;d(this,b2,$,"f"),d(this,x2,$?.headers.get("request-id"),"f"),A(this,j2,"f").call(this,$),this._emit("connect")}get ended(){return A(this,X1,"f")}get errored(){return A(this,C2,"f")}get aborted(){return A(this,E2,"f")}abort(){this.controller.abort()}on($,X){return(A(this,V0,"f")[$]||(A(this,V0,"f")[$]=[])).push({listener:X}),this}off($,X){let Z=A(this,V0,"f")[$];if(!Z)return this;let z=Z.findIndex((q)=>q.listener===X);if(z>=0)Z.splice(z,1);return this}once($,X){return(A(this,V0,"f")[$]||(A(this,V0,"f")[$]=[])).push({listener:X,once:!0}),this}emitted($){return new Promise((X,Z)=>{if(d(this,H$,!0,"f"),$!=="error")this.once("error",Z);this.once($,X)})}async done(){d(this,H$,!0,"f"),await A(this,e$,"f")}get currentMessage(){return A(this,P0,"f")}async finalMessage(){return await this.done(),A(this,o,"m",j9).call(this)}async finalText(){return await this.done(),A(this,o,"m",t6).call(this)}_emit($,...X){if(A(this,X1,"f"))return;if($==="end")d(this,X1,!0,"f"),A(this,S2,"f").call(this);let Z=A(this,V0,"f")[$];if(Z)A(this,V0,"f")[$]=Z.filter((z)=>!z.once),Z.forEach(({listener:z})=>z(...X));if($==="abort"){let z=X[0];if(!A(this,H$,"f")&&!Z?.length)Promise.reject(z);A(this,t$,"f").call(this,z),A(this,$1,"f").call(this,z),this._emit("end");return}if($==="error"){let z=X[0];if(!A(this,H$,"f")&&!Z?.length)Promise.reject(z);A(this,t$,"f").call(this,z),A(this,$1,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",A(this,o,"m",j9).call(this))}async _fromReadableStream($,X){let Z=X?.signal;if(Z){if(Z.aborted)this.controller.abort();Z.addEventListener("abort",()=>this.controller.abort())}A(this,o,"m",C9).call(this),this._connected(null);let z=i.fromReadableStream($,this.controller);for await(let q of z)A(this,o,"m",E9).call(this,q);if(z.controller.signal?.aborted)throw new m;A(this,o,"m",b9).call(this)}[(P0=new WeakMap,o$=new WeakMap,j2=new WeakMap,t$=new WeakMap,e$=new WeakMap,S2=new WeakMap,$1=new WeakMap,V0=new WeakMap,X1=new WeakMap,C2=new WeakMap,E2=new WeakMap,H$=new WeakMap,b2=new WeakMap,x2=new WeakMap,S9=new WeakMap,o=new WeakSet,j9=function(){if(this.receivedMessages.length===0)throw new P("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},t6=function(){if(this.receivedMessages.length===0)throw new P("stream ended without producing a Message with role=assistant");let X=this.receivedMessages.at(-1).content.filter((Z)=>Z.type==="text").map((Z)=>Z.text);if(X.length===0)throw new P("stream ended without producing a content block with type=text");return X.join(" ")},C9=function(){if(this.ended)return;d(this,P0,void 0,"f")},E9=function(X){if(this.ended)return;let Z=A(this,o,"m",e6).call(this,X);switch(this._emit("streamEvent",X,Z),X.type){case"content_block_delta":{let z=Z.content.at(-1);switch(X.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",X.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",X.delta.citation,z.citations??[]);break}case"input_json_delta":{if(z.type==="tool_use"&&z.input)this._emit("inputJson",X.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",X.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}default:X8(X.delta)}break}case"message_stop":{this._addMessageParam(Z),this._addMessage(Z,!0);break}case"content_block_stop":{this._emit("contentBlock",Z.content.at(-1));break}case"message_start":{d(this,P0,Z,"f");break}case"content_block_start":case"message_delta":break}},b9=function(){if(this.ended)throw new P("stream has ended, this shouldn't happen");let X=A(this,P0,"f");if(!X)throw new P("request ended without sending any chunks");return d(this,P0,void 0,"f"),X},e6=function(X){let Z=A(this,P0,"f");if(X.type==="message_start"){if(Z)throw new P(`Unexpected event order, got ${X.type} before receiving "message_stop"`);return X.message}if(!Z)throw new P(`Unexpected event order, got ${X.type} before "message_start"`);switch(X.type){case"message_stop":return Z;case"message_delta":return Z.stop_reason=X.delta.stop_reason,Z.stop_sequence=X.delta.stop_sequence,Z.usage.output_tokens=X.usage.output_tokens,Z;case"content_block_start":return Z.content.push(X.content_block),Z;case"content_block_delta":{let z=Z.content.at(X.index);switch(X.delta.type){case"text_delta":{if(z?.type==="text")z.text+=X.delta.text;break}case"citations_delta":{if(z?.type==="text")z.citations??(z.citations=[]),z.citations.push(X.delta.citation);break}case"input_json_delta":{if(z?.type==="tool_use"){let q=z[$8]||"";if(q+=X.delta.partial_json,Object.defineProperty(z,$8,{value:q,enumerable:!1,writable:!0}),q)z.input=A2(q)}break}case"thinking_delta":{if(z?.type==="thinking")z.thinking+=X.delta.thinking;break}case"signature_delta":{if(z?.type==="thinking")z.signature=X.delta.signature;break}default:X8(X.delta)}return Z}case"content_block_stop":return Z}},Symbol.asyncIterator)](){let $=[],X=[],Z=!1;return this.on("streamEvent",(z)=>{let q=X.shift();if(q)q.resolve(z);else $.push(z)}),this.on("end",()=>{Z=!0;for(let z of X)z.resolve(void 0);X.length=0}),this.on("abort",(z)=>{Z=!0;for(let q of X)q.reject(z);X.length=0}),this.on("error",(z)=>{Z=!0;for(let q of X)q.reject(z);X.length=0}),{next:async()=>{if(!$.length){if(Z)return{value:void 0,done:!0};return new Promise((q,G)=>X.push({resolve:q,reject:G})).then((q)=>q?{value:q,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new i(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function X8($){}var Z8={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025"};class m0 extends u{constructor(){super(...arguments);this.batches=new Y$(this._client)}create($,X){let{betas:Z,...z}=$;if(z.model in Z8)console.warn(`The model '${z.model}' is deprecated and will reach end-of-life on ${Z8[z.model]}
197
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);return this._client.post("/v1/messages?beta=true",{body:z,timeout:this._client._options.timeout??(z.stream?600000:this._client._calculateNonstreamingTimeout(z.max_tokens)),...X,headers:{...Z?.toString()!=null?{"anthropic-beta":Z?.toString()}:void 0,...X?.headers},stream:$.stream??!1})}stream($,X){return Z1.createMessage(this,$,X)}countTokens($,X){let{betas:Z,...z}=$;return this._client.post("/v1/messages/count_tokens?beta=true",{body:z,...X,headers:{"anthropic-beta":[...Z??[],"token-counting-2024-11-01"].toString(),...X?.headers}})}}m0.Batches=Y$;m0.BetaMessageBatchesPage=r$;class T0 extends u{constructor(){super(...arguments);this.models=new J$(this._client),this.messages=new m0(this._client)}}T0.Models=J$;T0.BetaModelInfosPage=n$;T0.Messages=m0;class W$ extends u{create($,X){return this._client.post("/v1/complete",{body:$,timeout:this._client._options.timeout??600000,...X,stream:$.stream??!1})}}class V$ extends u{create($,X){return this._client.post("/v1/messages/batches",{body:$,...X})}retrieve($,X){return this._client.get(`/v1/messages/batches/${$}`,X)}list($={},X){if(r($))return this.list({},$);return this._client.getAPIList("/v1/messages/batches",z1,{query:$,...X})}delete($,X){return this._client.delete(`/v1/messages/batches/${$}`,X)}cancel($,X){return this._client.post(`/v1/messages/batches/${$}/cancel`,X)}async results($,X){let Z=await this.retrieve($);if(!Z.results_url)throw new P(`No batch \`results_url\`; Has it finished processing? ${Z.processing_status} - ${Z.id}`);return this._client.get(Z.results_url,{...X,headers:{Accept:"application/binary",...X?.headers},__binaryResponse:!0})._thenUnwrap((z,q)=>Q$.fromResponse(q.response,q.controller))}}class z1 extends W0{}V$.MessageBatchesPage=z1;var p=function($,X,Z,z,q){if(z==="m")throw TypeError("Private method is not writable");if(z==="a"&&!q)throw TypeError("Private accessor was defined without a setter");if(typeof X==="function"?$!==X||!q:!X.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?q.call($,Z):q?q.value=Z:X.set($,Z),Z},j=function($,X,Z,z){if(Z==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof X==="function"?$!==X||!z:!X.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return Z==="m"?z:Z==="a"?z.call($):z?z.value:X.get($)},t,N0,q1,y2,G1,J1,k2,Q1,B0,Y1,f2,g2,T$,h2,v2,x9,z8,y9,k9,f9,g9,q8,G8="__json_buf";class U1{constructor(){t.add(this),this.messages=[],this.receivedMessages=[],N0.set(this,void 0),this.controller=new AbortController,q1.set(this,void 0),y2.set(this,()=>{}),G1.set(this,()=>{}),J1.set(this,void 0),k2.set(this,()=>{}),Q1.set(this,()=>{}),B0.set(this,{}),Y1.set(this,!1),f2.set(this,!1),g2.set(this,!1),T$.set(this,!1),h2.set(this,void 0),v2.set(this,void 0),y9.set(this,($)=>{if(p(this,f2,!0,"f"),$ instanceof Error&&$.name==="AbortError")$=new m;if($ instanceof m)return p(this,g2,!0,"f"),this._emit("abort",$);if($ instanceof P)return this._emit("error",$);if($ instanceof Error){let X=new P($.message);return X.cause=$,this._emit("error",X)}return this._emit("error",new P(String($)))}),p(this,q1,new Promise(($,X)=>{p(this,y2,$,"f"),p(this,G1,X,"f")}),"f"),p(this,J1,new Promise(($,X)=>{p(this,k2,$,"f"),p(this,Q1,X,"f")}),"f"),j(this,q1,"f").catch(()=>{}),j(this,J1,"f").catch(()=>{})}get response(){return j(this,h2,"f")}get request_id(){return j(this,v2,"f")}async withResponse(){let $=await j(this,q1,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let X=new U1;return X._run(()=>X._fromReadableStream($)),X}static createMessage($,X,Z){let z=new U1;for(let q of X.messages)z._addMessageParam(q);return z._run(()=>z._createMessage($,{...X,stream:!0},{...Z,headers:{...Z?.headers,"X-Stainless-Helper-Method":"stream"}})),z}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},j(this,y9,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,X=!0){if(this.receivedMessages.push($),X)this._emit("message",$)}async _createMessage($,X,Z){let z=Z?.signal;if(z){if(z.aborted)this.controller.abort();z.addEventListener("abort",()=>this.controller.abort())}j(this,t,"m",k9).call(this);let{response:q,data:G}=await $.create({...X,stream:!0},{...Z,signal:this.controller.signal}).withResponse();this._connected(q);for await(let J of G)j(this,t,"m",f9).call(this,J);if(G.controller.signal?.aborted)throw new m;j(this,t,"m",g9).call(this)}_connected($){if(this.ended)return;p(this,h2,$,"f"),p(this,v2,$?.headers.get("request-id"),"f"),j(this,y2,"f").call(this,$),this._emit("connect")}get ended(){return j(this,Y1,"f")}get errored(){return j(this,f2,"f")}get aborted(){return j(this,g2,"f")}abort(){this.controller.abort()}on($,X){return(j(this,B0,"f")[$]||(j(this,B0,"f")[$]=[])).push({listener:X}),this}off($,X){let Z=j(this,B0,"f")[$];if(!Z)return this;let z=Z.findIndex((q)=>q.listener===X);if(z>=0)Z.splice(z,1);return this}once($,X){return(j(this,B0,"f")[$]||(j(this,B0,"f")[$]=[])).push({listener:X,once:!0}),this}emitted($){return new Promise((X,Z)=>{if(p(this,T$,!0,"f"),$!=="error")this.once("error",Z);this.once($,X)})}async done(){p(this,T$,!0,"f"),await j(this,J1,"f")}get currentMessage(){return j(this,N0,"f")}async finalMessage(){return await this.done(),j(this,t,"m",x9).call(this)}async finalText(){return await this.done(),j(this,t,"m",z8).call(this)}_emit($,...X){if(j(this,Y1,"f"))return;if($==="end")p(this,Y1,!0,"f"),j(this,k2,"f").call(this);let Z=j(this,B0,"f")[$];if(Z)j(this,B0,"f")[$]=Z.filter((z)=>!z.once),Z.forEach(({listener:z})=>z(...X));if($==="abort"){let z=X[0];if(!j(this,T$,"f")&&!Z?.length)Promise.reject(z);j(this,G1,"f").call(this,z),j(this,Q1,"f").call(this,z),this._emit("end");return}if($==="error"){let z=X[0];if(!j(this,T$,"f")&&!Z?.length)Promise.reject(z);j(this,G1,"f").call(this,z),j(this,Q1,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",j(this,t,"m",x9).call(this))}async _fromReadableStream($,X){let Z=X?.signal;if(Z){if(Z.aborted)this.controller.abort();Z.addEventListener("abort",()=>this.controller.abort())}j(this,t,"m",k9).call(this),this._connected(null);let z=i.fromReadableStream($,this.controller);for await(let q of z)j(this,t,"m",f9).call(this,q);if(z.controller.signal?.aborted)throw new m;j(this,t,"m",g9).call(this)}[(N0=new WeakMap,q1=new WeakMap,y2=new WeakMap,G1=new WeakMap,J1=new WeakMap,k2=new WeakMap,Q1=new WeakMap,B0=new WeakMap,Y1=new WeakMap,f2=new WeakMap,g2=new WeakMap,T$=new WeakMap,h2=new WeakMap,v2=new WeakMap,y9=new WeakMap,t=new WeakSet,x9=function(){if(this.receivedMessages.length===0)throw new P("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},z8=function(){if(this.receivedMessages.length===0)throw new P("stream ended without producing a Message with role=assistant");let X=this.receivedMessages.at(-1).content.filter((Z)=>Z.type==="text").map((Z)=>Z.text);if(X.length===0)throw new P("stream ended without producing a content block with type=text");return X.join(" ")},k9=function(){if(this.ended)return;p(this,N0,void 0,"f")},f9=function(X){if(this.ended)return;let Z=j(this,t,"m",q8).call(this,X);switch(this._emit("streamEvent",X,Z),X.type){case"content_block_delta":{let z=Z.content.at(-1);switch(X.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",X.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",X.delta.citation,z.citations??[]);break}case"input_json_delta":{if(z.type==="tool_use"&&z.input)this._emit("inputJson",X.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",X.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}default:J8(X.delta)}break}case"message_stop":{this._addMessageParam(Z),this._addMessage(Z,!0);break}case"content_block_stop":{this._emit("contentBlock",Z.content.at(-1));break}case"message_start":{p(this,N0,Z,"f");break}case"content_block_start":case"message_delta":break}},g9=function(){if(this.ended)throw new P("stream has ended, this shouldn't happen");let X=j(this,N0,"f");if(!X)throw new P("request ended without sending any chunks");return p(this,N0,void 0,"f"),X},q8=function(X){let Z=j(this,N0,"f");if(X.type==="message_start"){if(Z)throw new P(`Unexpected event order, got ${X.type} before receiving "message_stop"`);return X.message}if(!Z)throw new P(`Unexpected event order, got ${X.type} before "message_start"`);switch(X.type){case"message_stop":return Z;case"message_delta":return Z.stop_reason=X.delta.stop_reason,Z.stop_sequence=X.delta.stop_sequence,Z.usage.output_tokens=X.usage.output_tokens,Z;case"content_block_start":return Z.content.push(X.content_block),Z;case"content_block_delta":{let z=Z.content.at(X.index);switch(X.delta.type){case"text_delta":{if(z?.type==="text")z.text+=X.delta.text;break}case"citations_delta":{if(z?.type==="text")z.citations??(z.citations=[]),z.citations.push(X.delta.citation);break}case"input_json_delta":{if(z?.type==="tool_use"){let q=z[G8]||"";if(q+=X.delta.partial_json,Object.defineProperty(z,G8,{value:q,enumerable:!1,writable:!0}),q)z.input=A2(q)}break}case"thinking_delta":{if(z?.type==="thinking")z.thinking+=X.delta.thinking;break}case"signature_delta":{if(z?.type==="thinking")z.signature=X.delta.signature;break}default:J8(X.delta)}return Z}case"content_block_stop":return Z}},Symbol.asyncIterator)](){let $=[],X=[],Z=!1;return this.on("streamEvent",(z)=>{let q=X.shift();if(q)q.resolve(z);else $.push(z)}),this.on("end",()=>{Z=!0;for(let z of X)z.resolve(void 0);X.length=0}),this.on("abort",(z)=>{Z=!0;for(let q of X)q.reject(z);X.length=0}),this.on("error",(z)=>{Z=!0;for(let q of X)q.reject(z);X.length=0}),{next:async()=>{if(!$.length){if(Z)return{value:void 0,done:!0};return new Promise((q,G)=>X.push({resolve:q,reject:G})).then((q)=>q?{value:q,done:!1}:{value:void 0,done:!0})}return{value:$.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new i(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function J8($){}class A0 extends u{constructor(){super(...arguments);this.batches=new V$(this._client)}create($,X){if($.model in Q8)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${Q8[$.model]}
198
+ Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);return this._client.post("/v1/messages",{body:$,timeout:this._client._options.timeout??($.stream?600000:this._client._calculateNonstreamingTimeout($.max_tokens)),...X,stream:$.stream??!1})}stream($,X){return U1.createMessage(this,$,X)}countTokens($,X){return this._client.post("/v1/messages/count_tokens",{body:$,...X})}}var Q8={"claude-1.3":"November 6th, 2024","claude-1.3-100k":"November 6th, 2024","claude-instant-1.1":"November 6th, 2024","claude-instant-1.1-100k":"November 6th, 2024","claude-instant-1.2":"November 6th, 2024","claude-3-sonnet-20240229":"July 21st, 2025","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025"};A0.Batches=V$;A0.MessageBatchesPage=z1;class d0 extends u{retrieve($,X){return this._client.get(`/v1/models/${$}`,X)}list($={},X){if(r($))return this.list({},$);return this._client.getAPIList("/v1/models",B$,{query:$,...X})}}class B$ extends W0{}d0.ModelInfosPage=B$;var Y8;class b extends N9{constructor({baseURL:$=N2("ANTHROPIC_BASE_URL"),apiKey:X=N2("ANTHROPIC_API_KEY")??null,authToken:Z=N2("ANTHROPIC_AUTH_TOKEN")??null,...z}={}){let q={apiKey:X,authToken:Z,...z,baseURL:$||"https://api.anthropic.com"};if(!q.dangerouslyAllowBrowser&&o6())throw new P(`It looks like you're running in a browser-like environment.
196
199
 
197
200
  This is disabled by default, as it risks exposing your secret API credentials to attackers.
198
201
  If you understand the risks and have appropriate mitigations in place,
199
202
  you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
200
203
 
201
204
  new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
202
- `);super({baseURL:z.baseURL,timeout:z.timeout??600000,httpAgent:z.httpAgent,maxRetries:z.maxRetries,fetch:z.fetch});this.completions=new W$(this),this.messages=new A0(this),this.models=new d0(this),this.beta=new T0(this),this._options=z,this.apiKey=X,this.authToken=Z}defaultQuery(){return this._options.defaultQuery}defaultHeaders($){return{...super.defaultHeaders($),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01",...this._options.defaultHeaders}}validateHeaders($,X){if(this.apiKey&&$["x-api-key"])return;if(X["x-api-key"]===null)return;if(this.authToken&&$.authorization)return;if(X.authorization===null)return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}authHeaders($){return{...this.apiKeyAuth($),...this.bearerAuth($)}}apiKeyAuth($){if(this.apiKey==null)return{};return{"X-Api-Key":this.apiKey}}bearerAuth($){if(this.authToken==null)return{};return{Authorization:`Bearer ${this.authToken}`}}}QZ=b;b.Anthropic=QZ;b.HUMAN_PROMPT=`
205
+ `);super({baseURL:q.baseURL,timeout:q.timeout??600000,httpAgent:q.httpAgent,maxRetries:q.maxRetries,fetch:q.fetch});this.completions=new W$(this),this.messages=new A0(this),this.models=new d0(this),this.beta=new T0(this),this._options=q,this.apiKey=X,this.authToken=Z}defaultQuery(){return this._options.defaultQuery}defaultHeaders($){return{...super.defaultHeaders($),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01",...this._options.defaultHeaders}}validateHeaders($,X){if(this.apiKey&&$["x-api-key"])return;if(X["x-api-key"]===null)return;if(this.authToken&&$.authorization)return;if(X.authorization===null)return;throw Error('Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted')}authHeaders($){return{...this.apiKeyAuth($),...this.bearerAuth($)}}apiKeyAuth($){if(this.apiKey==null)return{};return{"X-Api-Key":this.apiKey}}bearerAuth($){if(this.authToken==null)return{};return{Authorization:`Bearer ${this.authToken}`}}}Y8=b;b.Anthropic=Y8;b.HUMAN_PROMPT=`
203
206
 
204
207
  Human:`;b.AI_PROMPT=`
205
208
 
206
- Assistant:`;b.DEFAULT_TIMEOUT=600000;b.AnthropicError=P;b.APIError=v;b.APIConnectionError=v0;b.APIConnectionTimeoutError=i$;b.APIUserAbortError=m;b.NotFoundError=L2;b.ConflictError=B2;b.RateLimitError=D2;b.BadRequestError=V2;b.AuthenticationError=T2;b.InternalServerError=_2;b.PermissionDeniedError=w2;b.UnprocessableEntityError=K2;b.toFile=u8;b.fileFromPath=W2;b.Completions=W$;b.Messages=A0;b.Models=d0;b.ModelInfosPage=w$;b.Beta=T0;var YZ=b;function L$($,X,Z){let q=X.length>0?X.map((J)=>`- ${J.id}: ${J.name} (${J.source})`).join(`
207
- `):"(no sources provided)",z=X.map((J)=>`<source id="${J.id}">
209
+ Assistant:`;b.DEFAULT_TIMEOUT=600000;b.AnthropicError=P;b.APIError=v;b.APIConnectionError=v0;b.APIConnectionTimeoutError=i$;b.APIUserAbortError=m;b.NotFoundError=L2;b.ConflictError=D2;b.RateLimitError=F2;b.BadRequestError=T2;b.AuthenticationError=B2;b.InternalServerError=M2;b.PermissionDeniedError=K2;b.UnprocessableEntityError=_2;b.toFile=m6;b.fileFromPath=V2;b.Completions=W$;b.Messages=A0;b.Models=d0;b.ModelInfosPage=B$;b.Beta=T0;var U8=b;function K$($,X,Z){let z=X.length>0?X.map((J)=>`- ${J.id}: ${J.name} (${J.source})`).join(`
210
+ `):"(no sources provided)",q=X.map((J)=>`<source id="${J.id}">
208
211
  ${J.content.trimEnd()}
209
212
  </source>`).join(`
210
213
 
@@ -213,10 +216,10 @@ ${J.content.trimEnd()}
213
216
  Answer using ONLY information from the provided sources below. Do not draw on general knowledge.
214
217
 
215
218
  Available sources:
216
- ${q}
217
-
218
219
  ${z}
219
220
 
221
+ ${q}
222
+
220
223
  ${G}
221
224
 
222
225
  End your response with a "## Sources" section that lists every source you actually used. Use this exact format:
@@ -228,19 +231,19 @@ End your response with a "## Sources" section that lists every source you actual
228
231
  Rules:
229
232
  - Only cite IDs that appear in the inventory above. Do not invent IDs.
230
233
  - If you cannot answer from the provided sources, say so explicitly and write an empty "## Sources" section (just the heading, no bullets).
231
- - The "## Sources" heading must be the last heading in your response.`}class h4{category="api";provider="anthropic";name;config;clientFactory;constructor($,X,Z){this.name=$,this.config=X,this.clientFactory=Z??(()=>new YZ)}async run($,X){let{tool:Z,docs:q,requiredSources:z}=X;if(!this.config.model)throw Error(`API target "${this.name}" missing 'model'. API targets must declare an explicit model.`);let G=L$(Z,q,z),Q=await this.clientFactory().messages.create({model:this.config.model,max_tokens:this.config.maxTokens??4096,temperature:this.config.temperature??0,system:G,messages:[{role:"user",content:$}]}),Y=sH(Q.content);return{response:Y,allResponses:Y?[{type:"final",text:Y}]:[],toolsUsed:[],sources:[],metadata:{model:this.config.model,category:this.category,provider:this.provider,target:this.name}}}}function sH($){if(!Array.isArray($))return"";let X=[];for(let Z of $)if(Z.type==="text"&&typeof Z.text==="string")X.push(Z.text);return X.join("")}import{query as nH}from"@anthropic-ai/claude-agent-sdk";class v4{category="cli";provider="claude-code";name;config;constructor($,X){this.name=$,this.config=X}async run($,X){let{tool:Z,cwd:q,context:z,docs:G,requiredSources:J}=X,Q=[],Y=[],U=L$(Z,G,J),W={cwd:q,model:this.config.model??"sonnet",systemPrompt:U,allowedTools:z?.allowedTools??this.config.allowedTools??t2,disallowedTools:z?.disallowedTools??this.config.disallowedTools??e2,permissionMode:this.config.permissionMode??"acceptEdits",maxTurns:this.config.maxTurns??10,maxThinkingTokens:this.config.maxThinkingTokens,maxBudgetUsd:this.config.maxBudgetUsd,mcpServers:z?.mcpServers??this.config.mcpServers,settingSources:[]},H=[],V="",w="";for await(let B of nH({prompt:$,options:W})){if(B.type==="assistant"){let T=B.message?.content;if(Array.isArray(T)){let L="";for(let D of T){if(D.type==="text")L+=D.text;if(D.type==="tool_use"){let _=D;if(!Q.includes(_.name))Q.push(_.name)}}if(L){let D=H.length===0?"initial":"intermediate";H.push({type:D,text:L}),V=L}}}if(B.type==="result"){let T=B;if(T.result)w=T.result}}if(H.length>0)H[H.length-1].type="final";return{response:w||V,allResponses:H,toolsUsed:Q,sources:Y,metadata:{model:this.config.model??"sonnet",category:this.category,provider:this.provider,target:this.name}}}}import{randomUUID as rH}from"crypto";import{rm as oH}from"fs/promises";import{tmpdir as tH}from"os";import{join as eH}from"path";var $W="codex";class u4{category="cli";provider="codex-cli";name;config;spawnFn;readFileFn;binary;constructor($,X,Z={}){this.name=$,this.config=X,this.spawnFn=Z.spawn??zW,this.readFileFn=Z.readFile??GW,this.binary=Z.binary??$W}async run($,X){let{tool:Z,cwd:q,docs:z,requiredSources:G}=X,J=this.config.model;if(!J)throw Error(`CodexCliTarget "${this.name}" requires an explicit model. Validation should have caught this at config load.`);let Y=`${L$(Z,z,G)}
234
+ - The "## Sources" heading must be the last heading in your response.`}class h9{category="api";provider="anthropic";name;config;clientFactory;constructor($,X,Z){this.name=$,this.config=X,this.clientFactory=Z??(()=>new U8)}async run($,X){let{tool:Z,docs:z,requiredSources:q}=X;if(!this.config.model)throw Error(`API target "${this.name}" missing 'model'. API targets must declare an explicit model.`);let G=K$(Z,z,q),Q=await this.clientFactory().messages.create({model:this.config.model,max_tokens:this.config.maxTokens??4096,temperature:this.config.temperature??0,system:G,messages:[{role:"user",content:$}]}),Y=XW(Q.content);return{response:Y,allResponses:Y?[{type:"final",text:Y}]:[],toolsUsed:[],sources:[],metadata:{model:this.config.model,category:this.category,provider:this.provider,target:this.name}}}}function XW($){if(!Array.isArray($))return"";let X=[];for(let Z of $)if(Z.type==="text"&&typeof Z.text==="string")X.push(Z.text);return X.join("")}import{query as ZW}from"@anthropic-ai/claude-agent-sdk";class v9{category="cli";provider="claude-code";name;config;constructor($,X){this.name=$,this.config=X}async run($,X){let{tool:Z,cwd:z,context:q,docs:G,requiredSources:J}=X,Q=[],Y=[],U=K$(Z,G,J),W={cwd:z,model:this.config.model??"sonnet",systemPrompt:U,allowedTools:q?.allowedTools??this.config.allowedTools??e2,disallowedTools:q?.disallowedTools??this.config.disallowedTools??$4,permissionMode:this.config.permissionMode??"acceptEdits",maxTurns:this.config.maxTurns??10,maxThinkingTokens:this.config.maxThinkingTokens,maxBudgetUsd:this.config.maxBudgetUsd,mcpServers:q?.mcpServers??this.config.mcpServers,settingSources:[]},H=[],V="",B="";for await(let L of ZW({prompt:$,options:W})){if(L.type==="assistant"){let T=L.message?.content;if(Array.isArray(T)){let K="";for(let _ of T){if(_.type==="text")K+=_.text;if(_.type==="tool_use"){let F=_;if(!Q.includes(F.name))Q.push(F.name)}}if(K){let _=H.length===0?"initial":"intermediate";H.push({type:_,text:K}),V=K}}}if(L.type==="result"){let T=L;if(T.result)B=T.result}}if(H.length>0)H[H.length-1].type="final";return{response:B||V,allResponses:H,toolsUsed:Q,sources:Y,metadata:{model:this.config.model??"sonnet",category:this.category,provider:this.provider,target:this.name}}}}import{randomUUID as zW}from"crypto";import{rm as qW}from"fs/promises";import{tmpdir as GW}from"os";import{join as JW}from"path";var QW="codex";class u9{category="cli";provider="codex-cli";name;config;spawnFn;readFileFn;binary;constructor($,X,Z={}){this.name=$,this.config=X,this.spawnFn=Z.spawn??WW,this.readFileFn=Z.readFile??VW,this.binary=Z.binary??QW}async run($,X){let{tool:Z,cwd:z,docs:q,requiredSources:G}=X,J=this.config.model;if(!J)throw Error(`CodexCliTarget "${this.name}" requires an explicit model. Validation should have caught this at config load.`);let Y=`${K$(Z,q,G)}
232
235
 
233
236
  ---
234
237
 
235
- ${$}`,U=eH(tH(),`pickled-codex-${rH()}.txt`),W=["--ask-for-approval","never","exec","--json","--sandbox","read-only","--ignore-user-config","--ignore-rules","--ephemeral","--skip-git-repo-check","--cd",q,"--model",J,"--output-last-message",U,"-"];try{let H=await this.spawnFn(this.binary,W,{cwd:q,stdin:Y}),{allResponses:V,toolsUsed:w}=XW(H.stdout);if(H.exitCode!==0)throw Error(`codex exec failed (exit ${H.exitCode}): ${H.stderr.trim()||"no stderr output"}`);let B="";try{B=(await this.readFileFn(U)).trim()}catch{B=V.length>0?V[V.length-1].text:""}if(V.length>0)V[V.length-1].type="final";return{response:B,allResponses:V,toolsUsed:w,sources:[],metadata:{model:J,category:this.category,provider:this.provider,target:this.name}}}finally{await oH(U,{force:!0})}}}function XW($){let X=[],Z=[];for(let q of $.split(`
236
- `)){let z=q.trim();if(!z)continue;let G;try{G=JSON.parse(z)}catch{continue}let J=ZW(G);if(J){let Y=X.length===0?"initial":"intermediate";X.push({type:Y,text:J})}let Q=qW(G);if(Q&&!Z.includes(Q))Z.push(Q)}return{allResponses:X,toolsUsed:Z}}function ZW($){if(!$||typeof $!=="object")return null;let X=$;if(typeof X.message==="string")return X.message;if(typeof X.content==="string")return X.content;if(typeof X.type==="string"&&(X.type==="assistant_message"||X.type==="agent_message")&&typeof X.text==="string")return X.text;if(X.type==="message"&&typeof X.text==="string")return X.text;return null}function qW($){if(!$||typeof $!=="object")return null;let X=$;if(typeof X.tool==="string")return X.tool;if(typeof X.type==="string"&&(X.type==="tool_call"||X.type==="function_call")&&typeof X.name==="string")return X.name;return null}var zW=async($,X,Z)=>{let q=Bun.spawn([$,...X],{cwd:Z.cwd,stdin:"pipe",stdout:"pipe",stderr:"pipe"});q.stdin.write(Z.stdin),await q.stdin.end();let[z,G,J]=await Promise.all([new Response(q.stdout).text(),new Response(q.stderr).text(),q.exited]);return{exitCode:J,stdout:z,stderr:G}},GW=async($)=>{let X=Bun.file($);if(!await X.exists())throw Error(`Last-message file not found: ${$}`);return X.text()};function m4($,X){let Z=X??z0;switch(Z.category){case"cli":return JW($,Z);case"api":return QW($,Z);case"ide":throw Error("IDE targets not yet implemented. Coming soon!");default:throw Error(`Unknown target category: ${Z.category}`)}}function JW($,X){switch(X.provider){case"claude-code":return new v4($,X);case"codex-cli":return new u4($,X);case"gemini-cli":throw Error("Gemini CLI target not yet implemented. Coming soon!");case"amazon-q":throw Error("Amazon Q target not yet implemented. Coming soon!");default:throw Error(`Unknown CLI provider: ${X.provider}`)}}function QW($,X){switch(X.provider){case"anthropic":return new h4($,X);case"openai":throw Error("OpenAI API target not yet implemented. Coming soon!");case"google":throw Error("Google API target not yet implemented. Coming soon!");default:throw Error(`Unknown API provider: ${X.provider}`)}}var B$="default";function d4($,X){if(!$||$===B$)return{name:B$,config:z0};if(X?.[$])return{name:$,config:X[$]};return console.warn(`Target "${$}" not found, using default`),{name:B$,config:z0}}function UZ($,X){if(!$||$===B$)return{name:B$,config:{}};if(X?.[$])return{name:$,config:X[$]};return console.warn(`Context "${$}" not found, using default`),{name:B$,config:{}}}function YW($){let X=[],Z=$.matrix?.target??["default"],q=$.matrix?.context??["default"];for(let z of $.scenarios){let G=z.target?[z.target]:Z,J=z.context?[z.context]:q;for(let Q of G)for(let Y of J)X.push({scenario:z,targetName:Q,contextName:Y})}return X}async function p4($,X,Z={}){let{onProgress:q}=Z,z=[];if(X.scenarios.length===0)throw Error("No scenarios defined in config");let G=X.docs?.sources??{},J=[];if(Object.keys(G).length>0){q?.("Loading sources..."),J=await c$(G,$.path);for(let W of J)q?.(` [${W.id}] ${W.name}`);q?.("")}let Q=J.map((W)=>W.id),Y=YW(X),U="";for(let{scenario:W,targetName:H,contextName:V}of Y){let w=UW(H,V);if(W.name!==U){if(U)q?.("");q?.(`"${W.name}"`),U=W.name}try{let B=await HW(W,H,V,$,X,J,Q,Z);z.push(B);let T=w?w.padEnd(18):"";if(B.surfaces){q?.(` ${T} (compare-surfaces mode)`);for(let L of B.surfaces){let D=k0(L),_=` [${L.active.join(",")}]`.padEnd(22);q?.(`${_} ${D.icon} ${D.label} (${D.confidence}%)`)}}else{let L=k0({answerable:B.answerable??"NO",confidence:B.confidence??0,traps:B.traps??{fired:[],avoided:[]},error:B.error});q?.(` ${T} ${L.icon} ${L.label} (${L.confidence}%)`)}}catch(B){let T=H==="default"?z0:X.targets?.[H]??z0,L={scenario:W,answerable:"NO",confidence:0,response:"",reason:"Error during run",citations:{cited:[],required:W.requiredSources,missing:W.requiredSources,unknown:[]},traps:{fired:[],avoided:(W.traps??[]).map((_)=>_.id)},error:B instanceof Error?B.message:String(B),target:{target:H,category:T.category,provider:T.provider,model:T.model??"unknown"},context:{name:V}};z.push(L);let D=w?w.padEnd(18):"";q?.(` ${D} \u2717 Error`)}}return q?.(""),WW($,J,z)}function UW($,X){if($==="default"&&X==="default")return"";if(X==="default")return`[${$}]`;return`[${$}/${X}]`}async function HW($,X,Z,q,z,G,J,Q){let{config:Y}=d4(X,z.targets),{config:U}=UZ(Z,z.contexts),W=Q.targetFactory?Q.targetFactory(X,Y):m4(X,Y);if($.compareSurfaces&&$.compareSurfaces.length>0){let _=[],O;for(let I of $.compareSurfaces){let R=new Set(I),N=G.filter((p0)=>R.has(p0.id)),C=$.requiredSources.filter((p0)=>R.has(p0)),F=await W.run($.prompt,{tool:q,cwd:q.path,context:U,docs:N,requiredSources:C,onProgress:Q.onProgress}),y=l$({response:F.response,requiredSources:C,registeredIds:I}),a=f0({response:F.response,traps:$.traps??[]}),q0=a.fired.length>0,k=q0?"NO":y.answerable,V1=q0?0:y.confidence,bZ=q0?`Trap fired: ${a.fired.map((p0)=>`"${p0.id}" (${p0.reason})`).join("; ")}`:y.reason;_.push({active:I,answerable:k,confidence:V1,response:F.response,reason:bZ,citations:y.citations,traps:a,allResponses:F.allResponses}),O=F.metadata??O}return{scenario:$,answerable:null,confidence:null,response:null,reason:null,citations:null,traps:null,surfaces:_,target:O,context:{name:Z}}}let H=await W.run($.prompt,{tool:q,cwd:q.path,context:U,docs:G,requiredSources:$.requiredSources,onProgress:Q.onProgress}),V=l$({response:H.response,requiredSources:$.requiredSources,registeredIds:J}),w=f0({response:H.response,traps:$.traps??[]}),B=w.fired.length>0,T=B?"NO":V.answerable,L=B?0:V.confidence,D=B?`Trap fired: ${w.fired.map((_)=>`"${_.id}" (${_.reason})`).join("; ")}`:V.reason;return{scenario:$,answerable:T,confidence:L,response:H.response,reason:D,citations:V.citations,traps:w,target:H.metadata,context:{name:Z},toolsUsed:H.toolsUsed,sources:H.sources,allResponses:H.allResponses}}function WW($,X,Z){let q=[];for(let Q of Z){if(Q.surfaces){for(let Y of Q.surfaces)q.push({answerable:Y.answerable,confidence:Y.confidence});continue}if(Q.answerable!==null&&Q.confidence!==null)q.push({answerable:Q.answerable,confidence:Q.confidence})}let z=q.length,G=q.filter((Q)=>Q.answerable==="YES"||Q.answerable==="PARTIAL").length,J=z>0?Math.round(q.reduce((Q,Y)=>{if(Y.answerable==="YES")return Q+Y.confidence;if(Y.answerable==="PARTIAL")return Q+Y.confidence*0.5;return Q},0)/z):0;return{tool:{name:$.name,description:$.description,path:$.path},docs:X,scenarios:Z,summary:{total:z,answered:G,unanswered:z-G,score:J}}}var HZ=($=0)=>(X)=>`\x1B[${X+$}m`,WZ=($=0)=>(X)=>`\x1B[${38+$};5;${X}m`,VZ=($=0)=>(X,Z,q)=>`\x1B[${38+$};2;${X};${Z};${q}m`,x={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]}},JB=Object.keys(x.modifier),VW=Object.keys(x.color),TW=Object.keys(x.bgColor),QB=[...VW,...TW];function wW(){let $=new Map;for(let[X,Z]of Object.entries(x)){for(let[q,z]of Object.entries(Z))x[q]={open:`\x1B[${z[0]}m`,close:`\x1B[${z[1]}m`},Z[q]=x[q],$.set(z[0],z[1]);Object.defineProperty(x,X,{value:Z,enumerable:!1})}return Object.defineProperty(x,"codes",{value:$,enumerable:!1}),x.color.close="\x1B[39m",x.bgColor.close="\x1B[49m",x.color.ansi=HZ(),x.color.ansi256=WZ(),x.color.ansi16m=VZ(),x.bgColor.ansi=HZ(10),x.bgColor.ansi256=WZ(10),x.bgColor.ansi16m=VZ(10),Object.defineProperties(x,{rgbToAnsi256:{value(X,Z,q){if(X===Z&&Z===q){if(X<8)return 16;if(X>248)return 231;return Math.round((X-8)/247*24)+232}return 16+36*Math.round(X/255*5)+6*Math.round(Z/255*5)+Math.round(q/255*5)},enumerable:!1},hexToRgb:{value(X){let Z=/[a-f\d]{6}|[a-f\d]{3}/i.exec(X.toString(16));if(!Z)return[0,0,0];let[q]=Z;if(q.length===3)q=[...q].map((G)=>G+G).join("");let z=Number.parseInt(q,16);return[z>>16&255,z>>8&255,z&255]},enumerable:!1},hexToAnsi256:{value:(X)=>x.rgbToAnsi256(...x.hexToRgb(X)),enumerable:!1},ansi256ToAnsi:{value(X){if(X<8)return 30+X;if(X<16)return 90+(X-8);let Z,q,z;if(X>=232)Z=((X-232)*10+8)/255,q=Z,z=Z;else{X-=16;let Q=X%36;Z=Math.floor(X/36)/5,q=Math.floor(Q/6)/5,z=Q%6/5}let G=Math.max(Z,q,z)*2;if(G===0)return 30;let J=30+(Math.round(z)<<2|Math.round(q)<<1|Math.round(Z));if(G===2)J+=60;return J},enumerable:!1},rgbToAnsi:{value:(X,Z,q)=>x.ansi256ToAnsi(x.rgbToAnsi256(X,Z,q)),enumerable:!1},hexToAnsi:{value:(X)=>x.ansi256ToAnsi(x.hexToAnsi256(X)),enumerable:!1}}),x}var LW=wW(),Z0=LW;import c4 from"process";import BW from"os";import TZ from"tty";function e($,X=globalThis.Deno?globalThis.Deno.args:c4.argv){let Z=$.startsWith("-")?"":$.length===1?"-":"--",q=X.indexOf(Z+$),z=X.indexOf("--");return q!==-1&&(z===-1||q<z)}var{env:f}=c4,v2;if(e("no-color")||e("no-colors")||e("color=false")||e("color=never"))v2=0;else if(e("color")||e("colors")||e("color=true")||e("color=always"))v2=1;function KW(){if("FORCE_COLOR"in f){if(f.FORCE_COLOR==="true")return 1;if(f.FORCE_COLOR==="false")return 0;return f.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(f.FORCE_COLOR,10),3)}}function DW($){if($===0)return!1;return{level:$,hasBasic:!0,has256:$>=2,has16m:$>=3}}function _W($,{streamIsTTY:X,sniffFlags:Z=!0}={}){let q=KW();if(q!==void 0)v2=q;let z=Z?v2:q;if(z===0)return 0;if(Z){if(e("color=16m")||e("color=full")||e("color=truecolor"))return 3;if(e("color=256"))return 2}if("TF_BUILD"in f&&"AGENT_NAME"in f)return 1;if($&&!X&&z===void 0)return 0;let G=z||0;if(f.TERM==="dumb")return G;if(c4.platform==="win32"){let J=BW.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in f){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((J)=>(J in f)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((J)=>(J in f))||f.CI_NAME==="codeship")return 1;return G}if("TEAMCITY_VERSION"in f)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(f.TEAMCITY_VERSION)?1:0;if(f.COLORTERM==="truecolor")return 3;if(f.TERM==="xterm-kitty")return 3;if(f.TERM==="xterm-ghostty")return 3;if(f.TERM==="wezterm")return 3;if("TERM_PROGRAM"in f){let J=Number.parseInt((f.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(f.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(f.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(f.TERM))return 1;if("COLORTERM"in f)return 1;return G}function wZ($,X={}){let Z=_W($,{streamIsTTY:$&&$.isTTY,...X});return DW(Z)}var FW={stdout:wZ({isTTY:TZ.isatty(1)}),stderr:wZ({isTTY:TZ.isatty(2)})},LZ=FW;function BZ($,X,Z){let q=$.indexOf(X);if(q===-1)return $;let z=X.length,G=0,J="";do J+=$.slice(G,q)+X+Z,G=q+z,q=$.indexOf(X,G);while(q!==-1);return J+=$.slice(G),J}function KZ($,X,Z,q){let z=0,G="";do{let J=$[q-1]==="\r";G+=$.slice(z,J?q-1:q)+X+(J?`\r
238
+ ${$}`,U=JW(GW(),`pickled-codex-${zW()}.txt`),W=["--ask-for-approval","never","exec","--json","--sandbox","read-only","--ignore-user-config","--ignore-rules","--ephemeral","--skip-git-repo-check","--cd",z,"--model",J,"--output-last-message",U,"-"];try{let H=await this.spawnFn(this.binary,W,{cwd:z,stdin:Y}),{allResponses:V,toolsUsed:B}=YW(H.stdout);if(H.exitCode!==0)throw Error(`codex exec failed (exit ${H.exitCode}): ${H.stderr.trim()||"no stderr output"}`);let L="";try{L=(await this.readFileFn(U)).trim()}catch{L=V.length>0?V[V.length-1].text:""}if(V.length>0)V[V.length-1].type="final";return{response:L,allResponses:V,toolsUsed:B,sources:[],metadata:{model:J,category:this.category,provider:this.provider,target:this.name}}}finally{await qW(U,{force:!0})}}}function YW($){let X=[],Z=[];for(let z of $.split(`
239
+ `)){let q=z.trim();if(!q)continue;let G;try{G=JSON.parse(q)}catch{continue}let J=UW(G);if(J){let Y=X.length===0?"initial":"intermediate";X.push({type:Y,text:J})}let Q=HW(G);if(Q&&!Z.includes(Q))Z.push(Q)}return{allResponses:X,toolsUsed:Z}}function UW($){if(!$||typeof $!=="object")return null;let X=$;if(typeof X.message==="string")return X.message;if(typeof X.content==="string")return X.content;if(typeof X.type==="string"&&(X.type==="assistant_message"||X.type==="agent_message")&&typeof X.text==="string")return X.text;if(X.type==="message"&&typeof X.text==="string")return X.text;return null}function HW($){if(!$||typeof $!=="object")return null;let X=$;if(typeof X.tool==="string")return X.tool;if(typeof X.type==="string"&&(X.type==="tool_call"||X.type==="function_call")&&typeof X.name==="string")return X.name;return null}var WW=async($,X,Z)=>{let z=Bun.spawn([$,...X],{cwd:Z.cwd,stdin:"pipe",stdout:"pipe",stderr:"pipe"});z.stdin.write(Z.stdin),await z.stdin.end();let[q,G,J]=await Promise.all([new Response(z.stdout).text(),new Response(z.stderr).text(),z.exited]);return{exitCode:J,stdout:q,stderr:G}},VW=async($)=>{let X=Bun.file($);if(!await X.exists())throw Error(`Last-message file not found: ${$}`);return X.text()};function m9($,X){let Z=X??q0;switch(Z.category){case"cli":return TW($,Z);case"api":return BW($,Z);case"ide":throw Error("IDE targets not yet implemented. Coming soon!");default:throw Error(`Unknown target category: ${Z.category}`)}}function TW($,X){switch(X.provider){case"claude-code":return new v9($,X);case"codex-cli":return new u9($,X);case"gemini-cli":throw Error("Gemini CLI target not yet implemented. Coming soon!");case"amazon-q":throw Error("Amazon Q target not yet implemented. Coming soon!");default:throw Error(`Unknown CLI provider: ${X.provider}`)}}function BW($,X){switch(X.provider){case"anthropic":return new h9($,X);case"openai":throw Error("OpenAI API target not yet implemented. Coming soon!");case"google":throw Error("Google API target not yet implemented. Coming soon!");default:throw Error(`Unknown API provider: ${X.provider}`)}}var L$="default";function d9($,X){if(!$||$===L$)return{name:L$,config:q0};if(X?.[$])return{name:$,config:X[$]};return console.warn(`Target "${$}" not found, using default`),{name:L$,config:q0}}function H8($,X){if(!$||$===L$)return{name:L$,config:{}};if(X?.[$])return{name:$,config:X[$]};return console.warn(`Context "${$}" not found, using default`),{name:L$,config:{}}}function KW($){let X=[],Z=$.matrix?.target??["default"],z=$.matrix?.context??["default"];for(let q of $.scenarios){let G=q.target?[q.target]:Z,J=q.context?[q.context]:z;for(let Q of G)for(let Y of J)X.push({scenario:q,targetName:Q,contextName:Y})}return X}async function p9($,X,Z={}){let{onProgress:z}=Z,q=[];if(X.scenarios.length===0)throw Error("No scenarios defined in config");let G=X.docs?.sources??{},J=[];if(Object.keys(G).length>0){z?.("Loading sources..."),J=await l$(G,$.path);for(let W of J)z?.(` [${W.id}] ${W.name}`);z?.("")}let Q=J.map((W)=>W.id),Y=KW(X),U="";for(let{scenario:W,targetName:H,contextName:V}of Y){let B=LW(H,V);if(W.name!==U){if(U)z?.("");z?.(`"${W.name}"`),U=W.name}try{let L=await DW(W,H,V,$,X,J,Q,Z);q.push(L);let T=B?B.padEnd(18):"";if(L.surfaces){z?.(` ${T} (compare-surfaces mode)`);for(let K of L.surfaces){let _=f0(K),F=` [${K.active.join(",")}]`.padEnd(22);z?.(`${F} ${_.icon} ${_.label} (${_.confidence}%)`)}}else{let K=f0({answerable:L.answerable??"NO",confidence:L.confidence??0,traps:L.traps??{fired:[],avoided:[]},error:L.error});z?.(` ${T} ${K.icon} ${K.label} (${K.confidence}%)`)}}catch(L){let T=H==="default"?q0:X.targets?.[H]??q0,K={scenario:W,answerable:"NO",confidence:0,response:"",reason:"Error during run",citations:{cited:[],required:W.requiredSources,missing:W.requiredSources,unknown:[]},traps:{fired:[],avoided:(W.traps??[]).map((F)=>F.id)},error:L instanceof Error?L.message:String(L),target:{target:H,category:T.category,provider:T.provider,model:T.model??"unknown"},context:{name:V}};q.push(K);let _=B?B.padEnd(18):"";z?.(` ${_} \u2717 Error`)}}return z?.(""),_W($,J,q)}function LW($,X){if($==="default"&&X==="default")return"";if(X==="default")return`[${$}]`;return`[${$}/${X}]`}async function DW($,X,Z,z,q,G,J,Q){let{config:Y}=d9(X,q.targets),{config:U}=H8(Z,q.contexts),W=Q.targetFactory?Q.targetFactory(X,Y):m9(X,Y);if($.compareSurfaces&&$.compareSurfaces.length>0){let F=[],O;for(let I of $.compareSurfaces){let R=new Set(I),N=G.filter((p0)=>R.has(p0.id)),E=$.requiredSources.filter((p0)=>R.has(p0)),M=await W.run($.prompt,{tool:z,cwd:z.path,context:U,docs:N,requiredSources:E,onProgress:Q.onProgress}),x=c$({response:M.response,requiredSources:E,registeredIds:I}),a=k0({response:M.response,traps:$.traps??[]}),z0=a.fired.length>0,f=z0?"NO":x.answerable,V1=z0?0:x.confidence,x8=z0?`Trap fired: ${a.fired.map((p0)=>`"${p0.id}" (${p0.reason})`).join("; ")}`:x.reason;F.push({active:I,answerable:f,confidence:V1,response:M.response,reason:x8,citations:x.citations,traps:a,allResponses:M.allResponses}),O=M.metadata??O}return{scenario:$,answerable:null,confidence:null,response:null,reason:null,citations:null,traps:null,surfaces:F,target:O,context:{name:Z}}}let H=await W.run($.prompt,{tool:z,cwd:z.path,context:U,docs:G,requiredSources:$.requiredSources,onProgress:Q.onProgress}),V=c$({response:H.response,requiredSources:$.requiredSources,registeredIds:J}),B=k0({response:H.response,traps:$.traps??[]}),L=B.fired.length>0,T=L?"NO":V.answerable,K=L?0:V.confidence,_=L?`Trap fired: ${B.fired.map((F)=>`"${F.id}" (${F.reason})`).join("; ")}`:V.reason;return{scenario:$,answerable:T,confidence:K,response:H.response,reason:_,citations:V.citations,traps:B,target:H.metadata,context:{name:Z},toolsUsed:H.toolsUsed,sources:H.sources,allResponses:H.allResponses}}function _W($,X,Z){let z=[];for(let Q of Z){if(Q.surfaces){for(let Y of Q.surfaces)z.push({answerable:Y.answerable,confidence:Y.confidence});continue}if(Q.answerable!==null&&Q.confidence!==null)z.push({answerable:Q.answerable,confidence:Q.confidence})}let q=z.length,G=z.filter((Q)=>Q.answerable==="YES"||Q.answerable==="PARTIAL").length,J=q>0?Math.round(z.reduce((Q,Y)=>{if(Y.answerable==="YES")return Q+Y.confidence;if(Y.answerable==="PARTIAL")return Q+Y.confidence*0.5;return Q},0)/q):0;return{tool:{name:$.name,description:$.description,path:$.path},docs:X,scenarios:Z,summary:{total:q,answered:G,unanswered:q-G,score:J}}}var W8=($=0)=>(X)=>`\x1B[${X+$}m`,V8=($=0)=>(X)=>`\x1B[${38+$};5;${X}m`,T8=($=0)=>(X,Z,z)=>`\x1B[${38+$};2;${X};${Z};${z}m`,y={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]}},BL=Object.keys(y.modifier),FW=Object.keys(y.color),MW=Object.keys(y.bgColor),KL=[...FW,...MW];function OW(){let $=new Map;for(let[X,Z]of Object.entries(y)){for(let[z,q]of Object.entries(Z))y[z]={open:`\x1B[${q[0]}m`,close:`\x1B[${q[1]}m`},Z[z]=y[z],$.set(q[0],q[1]);Object.defineProperty(y,X,{value:Z,enumerable:!1})}return Object.defineProperty(y,"codes",{value:$,enumerable:!1}),y.color.close="\x1B[39m",y.bgColor.close="\x1B[49m",y.color.ansi=W8(),y.color.ansi256=V8(),y.color.ansi16m=T8(),y.bgColor.ansi=W8(10),y.bgColor.ansi256=V8(10),y.bgColor.ansi16m=T8(10),Object.defineProperties(y,{rgbToAnsi256:{value(X,Z,z){if(X===Z&&Z===z){if(X<8)return 16;if(X>248)return 231;return Math.round((X-8)/247*24)+232}return 16+36*Math.round(X/255*5)+6*Math.round(Z/255*5)+Math.round(z/255*5)},enumerable:!1},hexToRgb:{value(X){let Z=/[a-f\d]{6}|[a-f\d]{3}/i.exec(X.toString(16));if(!Z)return[0,0,0];let[z]=Z;if(z.length===3)z=[...z].map((G)=>G+G).join("");let q=Number.parseInt(z,16);return[q>>16&255,q>>8&255,q&255]},enumerable:!1},hexToAnsi256:{value:(X)=>y.rgbToAnsi256(...y.hexToRgb(X)),enumerable:!1},ansi256ToAnsi:{value(X){if(X<8)return 30+X;if(X<16)return 90+(X-8);let Z,z,q;if(X>=232)Z=((X-232)*10+8)/255,z=Z,q=Z;else{X-=16;let Q=X%36;Z=Math.floor(X/36)/5,z=Math.floor(Q/6)/5,q=Q%6/5}let G=Math.max(Z,z,q)*2;if(G===0)return 30;let J=30+(Math.round(q)<<2|Math.round(z)<<1|Math.round(Z));if(G===2)J+=60;return J},enumerable:!1},rgbToAnsi:{value:(X,Z,z)=>y.ansi256ToAnsi(y.rgbToAnsi256(X,Z,z)),enumerable:!1},hexToAnsi:{value:(X)=>y.ansi256ToAnsi(y.hexToAnsi256(X)),enumerable:!1}}),y}var wW=OW(),Z0=wW;import l9 from"process";import IW from"os";import B8 from"tty";function e($,X=globalThis.Deno?globalThis.Deno.args:l9.argv){let Z=$.startsWith("-")?"":$.length===1?"-":"--",z=X.indexOf(Z+$),q=X.indexOf("--");return z!==-1&&(q===-1||z<q)}var{env:k}=l9,u2;if(e("no-color")||e("no-colors")||e("color=false")||e("color=never"))u2=0;else if(e("color")||e("colors")||e("color=true")||e("color=always"))u2=1;function RW(){if("FORCE_COLOR"in k){if(k.FORCE_COLOR==="true")return 1;if(k.FORCE_COLOR==="false")return 0;return k.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(k.FORCE_COLOR,10),3)}}function PW($){if($===0)return!1;return{level:$,hasBasic:!0,has256:$>=2,has16m:$>=3}}function NW($,{streamIsTTY:X,sniffFlags:Z=!0}={}){let z=RW();if(z!==void 0)u2=z;let q=Z?u2:z;if(q===0)return 0;if(Z){if(e("color=16m")||e("color=full")||e("color=truecolor"))return 3;if(e("color=256"))return 2}if("TF_BUILD"in k&&"AGENT_NAME"in k)return 1;if($&&!X&&q===void 0)return 0;let G=q||0;if(k.TERM==="dumb")return G;if(l9.platform==="win32"){let J=IW.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in k){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((J)=>(J in k)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((J)=>(J in k))||k.CI_NAME==="codeship")return 1;return G}if("TEAMCITY_VERSION"in k)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(k.TEAMCITY_VERSION)?1:0;if(k.COLORTERM==="truecolor")return 3;if(k.TERM==="xterm-kitty")return 3;if(k.TERM==="xterm-ghostty")return 3;if(k.TERM==="wezterm")return 3;if("TERM_PROGRAM"in k){let J=Number.parseInt((k.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(k.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(k.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(k.TERM))return 1;if("COLORTERM"in k)return 1;return G}function K8($,X={}){let Z=NW($,{streamIsTTY:$&&$.isTTY,...X});return PW(Z)}var AW={stdout:K8({isTTY:B8.isatty(1)}),stderr:K8({isTTY:B8.isatty(2)})},L8=AW;function D8($,X,Z){let z=$.indexOf(X);if(z===-1)return $;let q=X.length,G=0,J="";do J+=$.slice(G,z)+X+Z,G=z+q,z=$.indexOf(X,G);while(z!==-1);return J+=$.slice(G),J}function _8($,X,Z,z){let q=0,G="";do{let J=$[z-1]==="\r";G+=$.slice(q,J?z-1:z)+X+(J?`\r
237
240
  `:`
238
- `)+Z,z=q+1,q=$.indexOf(`
239
- `,z)}while(q!==-1);return G+=$.slice(z),G}var{stdout:DZ,stderr:_Z}=LZ,l4=Symbol("GENERATOR"),K$=Symbol("STYLER"),H1=Symbol("IS_EMPTY"),FZ=["ansi","ansi","ansi256","ansi16m"],D$=Object.create(null),OW=($,X={})=>{if(X.level&&!(Number.isInteger(X.level)&&X.level>=0&&X.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let Z=DZ?DZ.level:0;$.level=X.level===void 0?Z:X.level};var MW=($)=>{let X=(...Z)=>Z.join(" ");return OW(X,$),Object.setPrototypeOf(X,W1.prototype),X};function W1($){return MW($)}Object.setPrototypeOf(W1.prototype,Function.prototype);for(let[$,X]of Object.entries(Z0))D$[$]={get(){let Z=u2(this,a4(X.open,X.close,this[K$]),this[H1]);return Object.defineProperty(this,$,{value:Z}),Z}};D$.visible={get(){let $=u2(this,this[K$],!0);return Object.defineProperty(this,"visible",{value:$}),$}};var i4=($,X,Z,...q)=>{if($==="rgb"){if(X==="ansi16m")return Z0[Z].ansi16m(...q);if(X==="ansi256")return Z0[Z].ansi256(Z0.rgbToAnsi256(...q));return Z0[Z].ansi(Z0.rgbToAnsi(...q))}if($==="hex")return i4("rgb",X,Z,...Z0.hexToRgb(...q));return Z0[Z][$](...q)},IW=["rgb","hex","ansi256"];for(let $ of IW){D$[$]={get(){let{level:Z}=this;return function(...q){let z=a4(i4($,FZ[Z],"color",...q),Z0.color.close,this[K$]);return u2(this,z,this[H1])}}};let X="bg"+$[0].toUpperCase()+$.slice(1);D$[X]={get(){let{level:Z}=this;return function(...q){let z=a4(i4($,FZ[Z],"bgColor",...q),Z0.bgColor.close,this[K$]);return u2(this,z,this[H1])}}}}var RW=Object.defineProperties(()=>{},{...D$,level:{enumerable:!0,get(){return this[l4].level},set($){this[l4].level=$}}}),a4=($,X,Z)=>{let q,z;if(Z===void 0)q=$,z=X;else q=Z.openAll+$,z=X+Z.closeAll;return{open:$,close:X,openAll:q,closeAll:z,parent:Z}},u2=($,X,Z)=>{let q=(...z)=>PW(q,z.length===1?""+z[0]:z.join(" "));return Object.setPrototypeOf(q,RW),q[l4]=$,q[K$]=X,q[H1]=Z,q},PW=($,X)=>{if($.level<=0||!X)return $[H1]?"":X;let Z=$[K$];if(Z===void 0)return X;let{openAll:q,closeAll:z}=Z;if(X.includes("\x1B"))while(Z!==void 0)X=BZ(X,Z.close,Z.open),Z=Z.parent;let G=X.indexOf(`
240
- `);if(G!==-1)X=KZ(X,z,q,G);return q+X+z};Object.defineProperties(W1.prototype,D$);var NW=W1(),KB=W1({level:_Z?_Z.level:0});var M=NW;var OZ="\u2500".repeat(55);function PZ($){if($==="success")return M.green;if($==="warning")return M.yellow;return M.red}function AW($){if($>=70)return M.green;if($>=50)return M.yellow;return M.red}function NZ($){if($.label==="Error")return $.label;return`${$.label} (${$.confidence}%)`}function SW($){let X=k0({answerable:$.answerable??"NO",confidence:$.confidence??0,traps:$.traps??{fired:[],avoided:[]},error:$.error}),Z=PZ(X.tone);return{icon:Z(X.icon),status:NZ(X),color:Z}}function jW($){let X=$.target?.target??"default",Z=$.context?.name??"default";if(X==="default"&&Z==="default")return"";if(Z==="default")return M.dim(`[${X}]`);return M.dim(`[${X}/${Z}]`)}function EW($){let X=$.map((Z)=>Z.scenario.name);return new Set(X).size!==X.length}function m2($){return $.map((X)=>`[${X}]`).join(", ")}function AZ($,X){let Z=[];if($.error)return Z.push(M.dim(`${X}error: ${$.error}`)),Z;if($.traps.fired.length>0)for(let q of $.traps.fired)Z.push(M.red(`${X}trap: ${q.id}`)),Z.push(M.dim(`${X}reason: ${q.reason}`)),Z.push(M.dim(`${X}match: "${q.matched}"`));else if($.reason&&$.answerable!=="YES")Z.push(M.dim(`${X}reason: ${$.reason}`));if($.citations.cited.length>0)Z.push(M.dim(`${X}cited: ${m2($.citations.cited)}`));if($.citations.missing.length>0)Z.push(M.dim(`${X}missing: ${m2($.citations.missing)}`));if($.citations.unknown.length>0)Z.push(M.dim(`${X}unknown: ${m2($.citations.unknown)}`));return Z}function MZ($,X){if(!$.traps||!$.citations)return[];return AZ({error:$.error,traps:$.traps,reason:$.reason??"",answerable:$.answerable??"NO",citations:$.citations},X)}function IZ($){let{icon:X,status:Z,color:q}=SW($),z=jW($),G=`${X} ${Z}`;return z?`${z} ${q(G)}`:q(G)}function RZ($,X){if(!$.surfaces)return[];let Z=[];Z.push(`${X}${M.dim("Citations scoped to active surface (compare mode)")}`);for(let q of $.surfaces){let z=k0(q),G=PZ(z.tone),J=M.dim(`[${q.active.join(",")}]`),Q=`${G(z.icon)} ${G(NZ(z))}`;Z.push(`${X}${J} ${Q}`),Z.push(...AZ({traps:q.traps,reason:q.reason,answerable:q.answerable,citations:q.citations},`${X} `))}return Z}function CW($){let X=0,Z=0,q=0;for(let z of $){if(z.surfaces){for(let G of z.surfaces)X+=G.traps.fired.length,Z+=G.citations.missing.length,q+=G.citations.unknown.length;continue}if(z.traps)X+=z.traps.fired.length;if(z.citations)Z+=z.citations.missing.length,q+=z.citations.unknown.length}if(X>0&&Z+q>0)return"Review fired traps and citation gaps.";if(X>0)return"Review fired traps before trusting this surface.";if(Z+q>0)return"Review missing and unknown citations.";return"Citations hold. No declared traps fired."}function bW($,X){let Z=$.summary.score,z=`Overall: ${AW(Z)(`${Z}`)} / 100`;if(X===void 0||X<=0)return z;let J=Z>=X?M.green("run passes"):M.red("run fails");return`${z} \xB7 threshold ${X} \xB7 ${J}`}function SZ($,X={}){let{tool:Z,scenarios:q,summary:z}=$,G=q,J=[];if(J.push(M.bold("pickled check")),J.push(OZ),J.push(`Tool: ${M.cyan(Z.name)}`),$.docs.length>0)J.push(`Sources: ${M.dim(m2($.docs.map((Q)=>Q.id)))}`);else J.push(`Sources: ${M.dim("none registered")}`);if(J.push(`Scenarios: ${M.dim(String(z.total))}`),J.push(""),EW(G)){let Q=new Map;for(let Y of G){let U=Y.scenario.name;if(!Q.has(U))Q.set(U,[]);Q.get(U)?.push(Y)}for(let[Y,U]of Q){J.push(`Scenario: ${Y}`);for(let W of U)if(W.surfaces)J.push(...RZ(W," "));else J.push(` ${IZ(W)}`),J.push(...MZ(W," "));J.push("")}}else for(let Q of G){if(J.push(`Scenario: ${Q.scenario.name}`),Q.surfaces)J.push(...RZ(Q," "));else J.push(` ${IZ(Q)}`),J.push(...MZ(Q," "));J.push("")}return J.push(OZ),J.push(bW($,X.threshold)),J.push(M.dim(CW(q))),J.join(`
241
- `)}function s4($,X={}){console.log(SZ($,X)),console.log()}function d2($,X={}){if(X.verbose)return JSON.stringify($,null,2);let Z={...$,docs:$.docs.map((q)=>({...q,content:""})),scenarios:$.scenarios.map((q)=>{let{allResponses:z,...G}=q;return G})};return JSON.stringify(Z,null,2)}function xW($){if($.format&&$.format!=="terminal")return $.format;if($.json)return"json";return $.format??"terminal"}async function jZ($,X){let{output:Z}=X,q=xW(X),z=yW.resolve($),G;try{G=await U2({targetRepo:z})}catch(H){console.error(M.red(H instanceof Error?H.message:H)),process.exit(1)}let J;if(q==="json")J=q2(G);else if(q==="markdown")J=Z2(G);else J=z2(G);if(Z)await Bun.write(Z,J);else await fW(`${J}
242
- `);let Q=G.findings.filter((H)=>H.severity==="error").length,Y=G.findings.filter((H)=>H.severity==="warning").length;if(q!=="json"&&!Z)if(console.log(),Q===0&&Y===0)console.log(M.green("Audit clean. No issues found."));else{let H=Q>0?M.red:M.yellow;console.log(H(`Audit found ${Q} error(s), ${Y} warning(s).`))}if((X.failOn??"error")==="warning"?Q+Y>0:Q>0)process.exit(1)}function fW($){return new Promise((X,Z)=>{process.stdout.write($,(q)=>{if(q)Z(q);else X()})})}import kW from"path";async function EZ($,X){let{json:Z,output:q,verbose:z}=X,G=(V)=>!Z&&console.log(V),J=kW.resolve($),Q;try{Q=await Z$(J)}catch(V){console.error(M.red(V instanceof Error?V.message:V)),console.error(),console.error(M.dim("Run `pickled init` to create a config file")),process.exit(1)}if(X.target){let V=Q.scenarios.length;try{Q=W4(Q,X.target)}catch(B){console.error(M.red(B instanceof Error?B.message:String(B))),process.exit(1)}let w=V-Q.scenarios.length;if(w>0&&!Z)G(M.dim(`Skipping ${w} scenario(s) with explicit target != "${X.target}"`))}let Y={name:Q.tool.name,description:Q.tool.description,path:J};if(z){G(M.bold("pickled check")),G(""),G(M.dim(` Tool: ${Y.name}`)),G(M.dim(` Scenarios: ${Q.scenarios.length}`));for(let V of Q.scenarios)G(M.dim(` - ${V.name}`))}let U=await p4(Y,Q,{onProgress:z?(V)=>{if(!Z)G(M.dim(` ${V}`))}:void 0}),W=X.threshold?parseInt(X.threshold,10):Q.threshold??0,H=W>0&&U.summary.score<W;if(q)await Bun.write(q,d2(U,{verbose:z}));else if(Z)await gW(`${d2(U,{verbose:z})}
243
- `);else s4(U,{threshold:W});if(H){if(Z||q)console.error(M.red(`Overall: ${U.summary.score} / 100 \xB7 threshold ${W} \xB7 run fails`)),console.error(M.dim("Review failed scenarios before trusting this surface."));process.exit(1)}}function gW($){return new Promise((X,Z)=>{process.stdout.write($,(q)=>{if(q)Z(q);else X()})})}import hW from"path";var vW=`# pickled.yml - Agent legibility check for your product
241
+ `)+Z,q=z+1,z=$.indexOf(`
242
+ `,q)}while(z!==-1);return G+=$.slice(q),G}var{stdout:F8,stderr:M8}=L8,c9=Symbol("GENERATOR"),D$=Symbol("STYLER"),H1=Symbol("IS_EMPTY"),O8=["ansi","ansi","ansi256","ansi16m"],_$=Object.create(null),jW=($,X={})=>{if(X.level&&!(Number.isInteger(X.level)&&X.level>=0&&X.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let Z=F8?F8.level:0;$.level=X.level===void 0?Z:X.level};var SW=($)=>{let X=(...Z)=>Z.join(" ");return jW(X,$),Object.setPrototypeOf(X,W1.prototype),X};function W1($){return SW($)}Object.setPrototypeOf(W1.prototype,Function.prototype);for(let[$,X]of Object.entries(Z0))_$[$]={get(){let Z=m2(this,a9(X.open,X.close,this[D$]),this[H1]);return Object.defineProperty(this,$,{value:Z}),Z}};_$.visible={get(){let $=m2(this,this[D$],!0);return Object.defineProperty(this,"visible",{value:$}),$}};var i9=($,X,Z,...z)=>{if($==="rgb"){if(X==="ansi16m")return Z0[Z].ansi16m(...z);if(X==="ansi256")return Z0[Z].ansi256(Z0.rgbToAnsi256(...z));return Z0[Z].ansi(Z0.rgbToAnsi(...z))}if($==="hex")return i9("rgb",X,Z,...Z0.hexToRgb(...z));return Z0[Z][$](...z)},CW=["rgb","hex","ansi256"];for(let $ of CW){_$[$]={get(){let{level:Z}=this;return function(...z){let q=a9(i9($,O8[Z],"color",...z),Z0.color.close,this[D$]);return m2(this,q,this[H1])}}};let X="bg"+$[0].toUpperCase()+$.slice(1);_$[X]={get(){let{level:Z}=this;return function(...z){let q=a9(i9($,O8[Z],"bgColor",...z),Z0.bgColor.close,this[D$]);return m2(this,q,this[H1])}}}}var EW=Object.defineProperties(()=>{},{..._$,level:{enumerable:!0,get(){return this[c9].level},set($){this[c9].level=$}}}),a9=($,X,Z)=>{let z,q;if(Z===void 0)z=$,q=X;else z=Z.openAll+$,q=X+Z.closeAll;return{open:$,close:X,openAll:z,closeAll:q,parent:Z}},m2=($,X,Z)=>{let z=(...q)=>bW(z,q.length===1?""+q[0]:q.join(" "));return Object.setPrototypeOf(z,EW),z[c9]=$,z[D$]=X,z[H1]=Z,z},bW=($,X)=>{if($.level<=0||!X)return $[H1]?"":X;let Z=$[D$];if(Z===void 0)return X;let{openAll:z,closeAll:q}=Z;if(X.includes("\x1B"))while(Z!==void 0)X=D8(X,Z.close,Z.open),Z=Z.parent;let G=X.indexOf(`
243
+ `);if(G!==-1)X=_8(X,q,z,G);return z+X+q};Object.defineProperties(W1.prototype,_$);var xW=W1(),PL=W1({level:M8?M8.level:0});var w=xW;var w8="\u2500".repeat(55);function N8($){if($==="success")return w.green;if($==="warning")return w.yellow;return w.red}function yW($){if($>=70)return w.green;if($>=50)return w.yellow;return w.red}function A8($){if($.label==="Error")return $.label;return`${$.label} (${$.confidence}%)`}function kW($){let X=f0({answerable:$.answerable??"NO",confidence:$.confidence??0,traps:$.traps??{fired:[],avoided:[]},error:$.error}),Z=N8(X.tone);return{icon:Z(X.icon),status:A8(X),color:Z}}function fW($){let X=$.target?.target??"default",Z=$.context?.name??"default";if(X==="default"&&Z==="default")return"";if(Z==="default")return w.dim(`[${X}]`);return w.dim(`[${X}/${Z}]`)}function gW($){let X=$.map((Z)=>Z.scenario.name);return new Set(X).size!==X.length}function d2($){return $.map((X)=>`[${X}]`).join(", ")}function j8($,X){let Z=[];if($.error)return Z.push(w.dim(`${X}error: ${$.error}`)),Z;if($.traps.fired.length>0)for(let z of $.traps.fired)Z.push(w.red(`${X}trap: ${z.id}`)),Z.push(w.dim(`${X}reason: ${z.reason}`)),Z.push(w.dim(`${X}match: "${z.matched}"`));else if($.reason&&$.answerable!=="YES")Z.push(w.dim(`${X}reason: ${$.reason}`));if($.citations.cited.length>0)Z.push(w.dim(`${X}cited: ${d2($.citations.cited)}`));if($.citations.missing.length>0)Z.push(w.dim(`${X}missing: ${d2($.citations.missing)}`));if($.citations.unknown.length>0)Z.push(w.dim(`${X}unknown: ${d2($.citations.unknown)}`));return Z}function I8($,X){if(!$.traps||!$.citations)return[];return j8({error:$.error,traps:$.traps,reason:$.reason??"",answerable:$.answerable??"NO",citations:$.citations},X)}function R8($){let{icon:X,status:Z,color:z}=kW($),q=fW($),G=`${X} ${Z}`;return q?`${q} ${z(G)}`:z(G)}function P8($,X){if(!$.surfaces)return[];let Z=[];Z.push(`${X}${w.dim("Citations scoped to active surface (compare mode)")}`);for(let z of $.surfaces){let q=f0(z),G=N8(q.tone),J=w.dim(`[${z.active.join(",")}]`),Q=`${G(q.icon)} ${G(A8(q))}`;Z.push(`${X}${J} ${Q}`),Z.push(...j8({traps:z.traps,reason:z.reason,answerable:z.answerable,citations:z.citations},`${X} `))}return Z}function hW($){let X=0,Z=0,z=0;for(let q of $){if(q.surfaces){for(let G of q.surfaces)X+=G.traps.fired.length,Z+=G.citations.missing.length,z+=G.citations.unknown.length;continue}if(q.traps)X+=q.traps.fired.length;if(q.citations)Z+=q.citations.missing.length,z+=q.citations.unknown.length}if(X>0&&Z+z>0)return"Review fired traps and citation gaps.";if(X>0)return"Review fired traps before trusting this surface.";if(Z+z>0)return"Review missing and unknown citations.";return"Citations hold. No declared traps fired."}function vW($,X){let Z=$.summary.score,q=`Overall: ${yW(Z)(`${Z}`)} / 100`;if(X===void 0||X<=0)return q;let J=Z>=X?w.green("run passes"):w.red("run fails");return`${q} \xB7 threshold ${X} \xB7 ${J}`}function S8($,X={}){let{tool:Z,scenarios:z,summary:q}=$,G=z,J=[];if(J.push(w.bold("pickled check")),J.push(w8),J.push(`Tool: ${w.cyan(Z.name)}`),$.docs.length>0)J.push(`Sources: ${w.dim(d2($.docs.map((Q)=>Q.id)))}`);else J.push(`Sources: ${w.dim("none registered")}`);if(J.push(`Scenarios: ${w.dim(String(q.total))}`),J.push(""),gW(G)){let Q=new Map;for(let Y of G){let U=Y.scenario.name;if(!Q.has(U))Q.set(U,[]);Q.get(U)?.push(Y)}for(let[Y,U]of Q){J.push(`Scenario: ${Y}`);for(let W of U)if(W.surfaces)J.push(...P8(W," "));else J.push(` ${R8(W)}`),J.push(...I8(W," "));J.push("")}}else for(let Q of G){if(J.push(`Scenario: ${Q.scenario.name}`),Q.surfaces)J.push(...P8(Q," "));else J.push(` ${R8(Q)}`),J.push(...I8(Q," "));J.push("")}return J.push(w8),J.push(vW($,X.threshold)),J.push(w.dim(hW(z))),J.join(`
244
+ `)}function s9($,X={}){console.log(S8($,X)),console.log()}function p2($,X={}){if(X.verbose)return JSON.stringify($,null,2);let Z={...$,docs:$.docs.map((z)=>({...z,content:""})),scenarios:$.scenarios.map((z)=>{let{allResponses:q,...G}=z;return G})};return JSON.stringify(Z,null,2)}function mW($){if($.format&&$.format!=="terminal")return $.format;if($.json)return"json";return $.format??"terminal"}async function C8($,X){let{output:Z}=X,z=mW(X),q=uW.resolve($),G;try{G=await H2({targetRepo:q})}catch(H){console.error(w.red(H instanceof Error?H.message:H)),process.exit(1)}let J;if(z==="json")J=z2(G);else if(z==="markdown")J=Z2(G);else J=q2(G);if(Z)await Bun.write(Z,J);else await dW(`${J}
245
+ `);let Q=G.findings.filter((H)=>H.severity==="error").length,Y=G.findings.filter((H)=>H.severity==="warning").length;if(z!=="json"&&!Z)if(console.log(),Q===0&&Y===0)console.log(w.green("Audit clean. No issues found."));else{let H=Q>0?w.red:w.yellow;console.log(H(`Audit found ${Q} error(s), ${Y} warning(s).`))}if((X.failOn??"error")==="warning"?Q+Y>0:Q>0)process.exit(1)}function dW($){return new Promise((X,Z)=>{process.stdout.write($,(z)=>{if(z)Z(z);else X()})})}import pW from"path";async function E8($,X){let{json:Z,output:z,verbose:q}=X,G=(V)=>!Z&&console.log(V),J=pW.resolve($),Q;try{Q=await Z$(J)}catch(V){console.error(w.red(V instanceof Error?V.message:V)),console.error(),console.error(w.dim("Run `pickled init` to create a config file")),process.exit(1)}if(X.target){let V=Q.scenarios.length;try{Q=V9(Q,X.target)}catch(L){console.error(w.red(L instanceof Error?L.message:String(L))),process.exit(1)}let B=V-Q.scenarios.length;if(B>0&&!Z)G(w.dim(`Skipping ${B} scenario(s) with explicit target != "${X.target}"`))}let Y={name:Q.tool.name,description:Q.tool.description,path:J};if(q){G(w.bold("pickled check")),G(""),G(w.dim(` Tool: ${Y.name}`)),G(w.dim(` Scenarios: ${Q.scenarios.length}`));for(let V of Q.scenarios)G(w.dim(` - ${V.name}`))}let U=await p9(Y,Q,{onProgress:q?(V)=>{if(!Z)G(w.dim(` ${V}`))}:void 0}),W=X.threshold?parseInt(X.threshold,10):Q.threshold??0,H=W>0&&U.summary.score<W;if(z)await Bun.write(z,p2(U,{verbose:q}));else if(Z)await lW(`${p2(U,{verbose:q})}
246
+ `);else s9(U,{threshold:W});if(H){if(Z||z)console.error(w.red(`Overall: ${U.summary.score} / 100 \xB7 threshold ${W} \xB7 run fails`)),console.error(w.dim("Review failed scenarios before trusting this surface."));process.exit(1)}}function lW($){return new Promise((X,Z)=>{process.stdout.write($,(z)=>{if(z)Z(z);else X()})})}import cW from"path";var iW=`# pickled.yml - Agent legibility check for your product
244
247
 
245
248
  tool:
246
249
  name: "your-product"
@@ -262,4 +265,4 @@ scenarios:
262
265
 
263
266
  # Optional: fail CI if score falls below threshold
264
267
  # threshold: 80
265
- `;async function CZ($){let Z=`${hW.resolve($)}/pickled.yml`;if(await Bun.file(Z).exists())console.error(M.red("pickled.yml already exists")),process.exit(1);await Bun.write(Z,vW),console.log(M.green("Created pickled.yml")),console.log(),console.log(M.dim("Next steps:")),console.log(M.dim(" 1. Edit pickled.yml: list your sources and scenarios")),console.log(M.dim(" 2. Run: pickled check")),console.log()}c0.name("pickled").description("Test what agents actually understand about your product").version(wX.version);c0.command("init").description("Create a pickled.yml config file").argument("[path]","Path to your project (default: current directory)",".").action(CZ);c0.command("audit").description("Static scan of agent-context files (CLAUDE.md, AGENTS.md, llms.txt). No LLM calls.").argument("[path]","Path to your project (default: current directory)",".").addOption(new o2("--format <name>","Output format").choices(["terminal","markdown","json"]).default("terminal")).option("--json","Shorthand for --format json").option("-o, --output <file>","Save report to file").addOption(new o2("--fail-on <level>","Exit non-zero on this severity or higher").choices(["error","warning"]).default("error")).action(jZ);c0.command("check").description("Run agent scenarios against registered sources").argument("[path]","Path to your project (default: current directory)",".").option("--json","Output as JSON").option("-o, --output <file>","Save report to file").option("-v, --verbose","Show detailed progress").option("-t, --threshold <percent>","Minimum score % to pass (overrides config)").option("--target <name>","Run only the named target (overrides matrix.target)").action(EZ);await c0.parseAsync();
268
+ `;async function b8($){let Z=`${cW.resolve($)}/pickled.yml`;if(await Bun.file(Z).exists())console.error(w.red("pickled.yml already exists")),process.exit(1);await Bun.write(Z,iW),console.log(w.green("Created pickled.yml")),console.log(),console.log(w.dim("Next steps:")),console.log(w.dim(" 1. Edit pickled.yml: list your sources and scenarios")),console.log(w.dim(" 2. Run: pickled check")),console.log()}l0.name("pickled").description("Test what agents actually understand about your product").version(B5.version);l0.command("init").description("Create a pickled.yml config file").argument("[path]","Path to your project (default: current directory)",".").action(b8);l0.command("audit").description("Static scan of agent-context files (CLAUDE.md, AGENTS.md, llms.txt). No LLM calls.").argument("[path]","Path to your project (default: current directory)",".").addOption(new t2("--format <name>","Output format").choices(["terminal","markdown","json"]).default("terminal")).option("--json","Shorthand for --format json").option("-o, --output <file>","Save report to file").addOption(new t2("--fail-on <level>","Exit non-zero on this severity or higher").choices(["error","warning"]).default("error")).action(C8);l0.command("check").description("Run agent scenarios against registered sources").argument("[path]","Path to your project (default: current directory)",".").option("--json","Output as JSON").option("-o, --output <file>","Save report to file").option("-v, --verbose","Show detailed progress").option("-t, --threshold <percent>","Minimum score % to pass (overrides config)").option("--target <name>","Run only the named target (overrides matrix.target)").action(E8);await l0.parseAsync();