@pickled-dev/cli 0.15.0 → 0.16.1

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 +31 -7
  2. package/dist/index.js +154 -154
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,217 +1,217 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
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
- `+" ".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/),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}
3
+ var iZ=Object.create;var{getPrototypeOf:aZ,defineProperty:W5,getOwnPropertyNames:nZ}=Object;var sZ=Object.prototype.hasOwnProperty;function rZ($){return this[$]}var oZ,tZ,V5=($,Z,X)=>{var z=$!=null&&typeof $==="object";if(z){var q=Z?oZ??=new WeakMap:tZ??=new WeakMap,G=q.get($);if(G)return G}X=$!=null?iZ(aZ($)):{};let J=Z||!$||!$.__esModule?W5(X,"default",{value:$,enumerable:!0}):X;for(let Q of nZ($))if(!sZ.call(J,Q))W5(J,Q,{get:rZ.bind($,Q),enumerable:!0});if(z)q.set($,J);return J};var _=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var W0=import.meta.require;var S$=_((eZ)=>{class X4 extends Error{constructor($,Z,X){super(X);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=Z,this.exitCode=$,this.nestedError=void 0}}class T5 extends X4{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}eZ.CommanderError=X4;eZ.InvalidArgumentError=T5});var w1=_((qX)=>{var{InvalidArgumentError:XX}=S$();class B5{constructor($,Z){switch(this.description=Z||"",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($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.push($),Z}default($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,X)=>{if(!this.argChoices.includes(Z))throw new XX(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,X);return Z},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function zX($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}qX.Argument=B5;qX.humanReadableArgName=zX});var z4=_((YX)=>{var{humanReadableArgName:QX}=w1();class K5{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 Z=$.commands.filter((z)=>!z._hidden),X=$._getHelpCommand();if(X&&!X._hidden)Z.push(X);if(this.sortSubcommands)Z.sort((z,q)=>{return z.name().localeCompare(q.name())});return Z}compareOptions($,Z){let X=(z)=>{return z.short?z.short.replace(/^-/,""):z.long.replace(/^--/,"")};return X($).localeCompare(X(Z))}visibleOptions($){let Z=$.options.filter((z)=>!z.hidden),X=$._getHelpOption();if(X&&!X.hidden){let z=X.short&&$._findOption(X.short),q=X.long&&$._findOption(X.long);if(!z&&!q)Z.push(X);else if(X.long&&!q)Z.push($.createOption(X.long,X.description));else if(X.short&&!z)Z.push($.createOption(X.short,X.description))}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let Z=[];for(let X=$.parent;X;X=X.parent){let z=X.options.filter((q)=>!q.hidden);Z.push(...z)}if(this.sortOptions)Z.sort(this.compareOptions);return Z}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((Z)=>{Z.description=Z.description||$._argsDescription[Z.name()]||""});if($.registeredArguments.find((Z)=>Z.description))return $.registeredArguments;return[]}subcommandTerm($){let Z=$.registeredArguments.map((X)=>QX(X)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(Z?" "+Z:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,Z){return Z.visibleCommands($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(z))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(z))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(z))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((X,z)=>{return Math.max(X,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(z))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let X="";for(let z=$.parent;z;z=z.parent)X=z.name()+" "+X;return X+Z+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)Z.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)Z.push(`env: ${$.envVar}`);if(Z.length>0){let X=`(${Z.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}argumentDescription($){let Z=[];if($.argChoices)Z.push(`choices: ${$.argChoices.map((X)=>JSON.stringify(X)).join(", ")}`);if($.defaultValue!==void 0)Z.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(Z.length>0){let X=`(${Z.join(", ")})`;if($.description)return`${$.description} ${X}`;return X}return $.description}formatItemList($,Z,X){if(Z.length===0)return[];return[X.styleTitle($),...Z,""]}groupItems($,Z,X){let z=new Map;return $.forEach((q)=>{let G=X(q);if(!z.has(G))z.set(G,[])}),Z.forEach((q)=>{let G=X(q);if(!z.has(G))z.set(G,[]);z.get(G).push(q)}),z}formatHelp($,Z){let X=Z.padWidth($,Z),z=Z.helpWidth??80;function q(W,H){return Z.formatItem(W,X,H,Z)}let G=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],J=Z.commandDescription($);if(J.length>0)G=G.concat([Z.boxWrap(Z.styleCommandDescription(J),z),""]);let Q=Z.visibleArguments($).map((W)=>{return q(Z.styleArgumentTerm(Z.argumentTerm(W)),Z.styleArgumentDescription(Z.argumentDescription(W)))});if(G=G.concat(this.formatItemList("Arguments:",Q,Z)),this.groupItems($.options,Z.visibleOptions($),(W)=>W.helpGroupHeading??"Options:").forEach((W,H)=>{let V=W.map((B)=>{return q(Z.styleOptionTerm(Z.optionTerm(B)),Z.styleOptionDescription(Z.optionDescription(B)))});G=G.concat(this.formatItemList(H,V,Z))}),Z.showGlobalOptions){let W=Z.visibleGlobalOptions($).map((H)=>{return q(Z.styleOptionTerm(Z.optionTerm(H)),Z.styleOptionDescription(Z.optionDescription(H)))});G=G.concat(this.formatItemList("Global Options:",W,Z))}return this.groupItems($.commands,Z.visibleCommands($),(W)=>W.helpGroup()||"Commands:").forEach((W,H)=>{let V=W.map((B)=>{return q(Z.styleSubcommandTerm(Z.subcommandTerm(B)),Z.styleSubcommandDescription(Z.subcommandDescription(B)))});G=G.concat(this.formatItemList(H,V,Z))}),G.join(`
4
+ `)}displayWidth($){return L5($).length}styleTitle($){return $}styleUsage($){return $.split(" ").map((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z==="[command]")return this.styleSubcommandText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleCommandText(Z)}).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((Z)=>{if(Z==="[options]")return this.styleOptionText(Z);if(Z[0]==="["||Z[0]==="<")return this.styleArgumentText(Z);return this.styleSubcommandText(Z)}).join(" ")}styleArgumentTerm($){return this.styleArgumentText($)}styleOptionText($){return $}styleArgumentText($){return $}styleSubcommandText($){return $}styleCommandText($){return $}padWidth($,Z){return Math.max(Z.longestOptionTermLength($,Z),Z.longestGlobalOptionTermLength($,Z),Z.longestSubcommandTermLength($,Z),Z.longestArgumentTermLength($,Z))}preformatted($){return/\n[^\S\r\n]/.test($)}formatItem($,Z,X,z){let G=" ".repeat(2);if(!X)return G+$;let J=$.padEnd(Z+$.length-z.displayWidth($)),Q=2,U=(this.helpWidth??80)-Z-Q-2,W;if(U<this.minWidthToWrap||z.preformatted(X))W=X;else W=z.boxWrap(X,U).replace(/\n/g,`
5
+ `+" ".repeat(Z+Q));return G+J+" ".repeat(Q)+W.replace(/\n/g,`
6
+ ${G}`)}boxWrap($,Z){if(Z<this.minWidthToWrap)return $;let X=$.split(/\r\n|\n/),z=/[\s]*[^\s]+/g,q=[];return X.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<=Z){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 L5($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}YX.Help=K5;YX.stripColor=L5});var q4=_((TX)=>{var{InvalidArgumentError:WX}=S$();class _5{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let X=VX($);if(this.short=X.shortFlag,this.long=X.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($,Z){return this.defaultValue=$,this.defaultValueDescription=Z,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let Z=$;if(typeof $==="string")Z={[$]:!0};return this.implied=Object.assign(this.implied||{},Z),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_collectValue($,Z){if(Z===this.defaultValue||!Array.isArray(Z))return[$];return Z.push($),Z}choices($){return this.argChoices=$.slice(),this.parseArg=(Z,X)=>{if(!this.argChoices.includes(Z))throw new WX(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._collectValue(Z,X);return Z},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){if(this.negate)return D5(this.name().replace(/^no-/,""));return D5(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class O5{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((Z)=>{if(Z.negate)this.negativeOptions.set(Z.attributeName(),Z);else this.positiveOptions.set(Z.attributeName(),Z)}),this.negativeOptions.forEach((Z,X)=>{if(this.positiveOptions.has(X))this.dualOptions.add(X)})}valueFromOption($,Z){let X=Z.attributeName();if(!this.dualOptions.has(X))return!0;let z=this.negativeOptions.get(X).presetArg,q=z!==void 0?z:!1;return Z.negate===(q===$)}}function D5($){return $.split("-").reduce((Z,X)=>{return Z+X[0].toUpperCase()+X.slice(1)})}function VX($){let Z,X,z=/^-[^-]$/,q=/^--[^-]/,G=$.split(/[ |,]+/).concat("guard");if(z.test(G[0]))Z=G.shift();if(q.test(G[0]))X=G.shift();if(!Z&&z.test(G[0]))Z=G.shift();if(!Z&&q.test(G[0]))Z=X,X=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
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
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}}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`
13
+ - unrecognised flag format`)}if(Z===void 0&&X===void 0)throw Error(`option creation failed due to no flags found in '${$}'.`);return{shortFlag:Z,longFlag:X}}TX.Option=_5;TX.DualOptions=O5});var F5=_((_X)=>{function LX($,Z){if(Math.abs($.length-Z.length)>3)return Math.max($.length,Z.length);let X=[];for(let z=0;z<=$.length;z++)X[z]=[z];for(let z=0;z<=Z.length;z++)X[0][z]=z;for(let z=1;z<=Z.length;z++)for(let q=1;q<=$.length;q++){let G=1;if($[q-1]===Z[z-1])G=0;else G=1;if(X[q][z]=Math.min(X[q-1][z]+1,X[q][z-1]+1,X[q-1][z-1]+G),q>1&&z>1&&$[q-1]===Z[z-2]&&$[q-2]===Z[z-1])X[q][z]=Math.min(X[q][z],X[q-2][z-2]+1)}return X[$.length][Z.length]}function DX($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let X=$.startsWith("--");if(X)$=$.slice(2),Z=Z.map((J)=>J.slice(2));let z=[],q=3,G=0.4;if(Z.forEach((J)=>{if(J.length<=1)return;let Q=LX($,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)),X)z=z.map((J)=>`--${J}`);if(z.length>1)return`
14
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
- - if '${Z}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
15
+ (Did you mean ${z[0]}?)`;return""}_X.suggestSimilar=DX});var R5=_((AX)=>{var FX=W0("events").EventEmitter,G4=W0("child_process"),V0=W0("path"),P1=W0("fs"),y=W0("process"),{Argument:MX,humanReadableArgName:wX}=w1(),{CommanderError:J4}=S$(),{Help:PX,stripColor:RX}=z4(),{Option:M5,DualOptions:IX}=q4(),{suggestSimilar:w5}=F5();class Y4 extends FX{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:(Z)=>y.stdout.write(Z),writeErr:(Z)=>y.stderr.write(Z),outputError:(Z,X)=>X(Z),getOutHelpWidth:()=>y.stdout.isTTY?y.stdout.columns:void 0,getErrHelpWidth:()=>y.stderr.isTTY?y.stderr.columns:void 0,getOutHasColors:()=>Q4()??(y.stdout.isTTY&&y.stdout.hasColors?.()),getErrHasColors:()=>Q4()??(y.stderr.isTTY&&y.stderr.hasColors?.()),stripColor:(Z)=>RX(Z)},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 Z=this;Z;Z=Z.parent)$.push(Z);return $}command($,Z,X){let z=Z,q=X;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 Y4($)}createHelp(){return Object.assign(new PX,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($,Z){if(!$._name)throw Error(`Command passed to .addCommand() must have a name
16
+ - specify the name in Command constructor or using .name()`);if(Z=Z||{},Z.isDefault)this._defaultCommandName=$._name;if(Z.noHelp||Z.hidden)$._hidden=!0;return this._registerCommand($),$.parent=this,$._checkForBrokenPassThrough(),this}createArgument($,Z){return new MX($,Z)}argument($,Z,X,z){let q=this.createArgument($,Z);if(typeof X==="function")q.default(z).argParser(X);else q.default(X);return this.addArgument(q),this}arguments($){return $.trim().split(/ +/).forEach((Z)=>{this.argument(Z)}),this}addArgument($){let Z=this.registeredArguments.slice(-1)[0];if(Z?.variadic)throw Error(`only the last argument can be variadic '${Z.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($,Z){if(typeof $==="boolean"){if(this._addImplicitHelpCommand=$,$&&this._defaultCommandGroup)this._initCommandGroup(this._getHelpCommand());return this}let X=$??"help [command]",[,z,q]=X.match(/([^ ]+) *(.*)/),G=Z??"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,$||Z)this._initCommandGroup(J);return this}addHelpCommand($,Z){if(typeof $!=="object")return this.helpCommand($,Z),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($,Z){let X=["preSubcommand","preAction","postAction"];if(!X.includes($))throw Error(`Unexpected value for event passed to hook : '${$}'.
17
+ Expecting one of '${X.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(Z);else this._lifeCycleHooks[$]=[Z];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(Z)=>{if(Z.code!=="commander.executeSubCommandAsync")throw Z};return this}_exit($,Z,X){if(this._exitCallback)this._exitCallback(new J4($,Z,X));y.exit($)}action($){let Z=(X)=>{let z=this.registeredArguments.length,q=X.slice(0,z);if(this._storeOptionsAsProperties)q[z]=this;else q[z]=this.opts();return q.push(this),$.apply(this,q)};return this._actionHandler=Z,this}createOption($,Z){return new M5($,Z)}_callParseArg($,Z,X,z){try{return $.parseArg(Z,X)}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 Z=$.short&&this._findOption($.short)||$.long&&this._findOption($.long);if(Z){let X=$.long&&this._findOption($.long)?$.long:$.short;throw Error(`Cannot add option '${$.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${X}'
18
+ - already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(z)=>{return[z.name()].concat(z.aliases())},X=Z($).find((z)=>this._findCommand(z));if(X){let z=Z(this._findCommand(X)).join("|"),q=Z($).join("|");throw Error(`cannot add command '${q}' as already have command '${z}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),X=$.attributeName();if($.negate){let q=$.long.replace(/^--no-/,"--");if(!this._findOption(q))this.setOptionValueWithSource(X,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(X,$.defaultValue,"default");let z=(q,G,J)=>{if(q==null&&$.presetArg!==void 0)q=$.presetArg;let Q=this.getOptionValue(X);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(X,q,J)};if(this.on("option:"+Z,(q)=>{let G=`error: option '${$.flags}' argument '${q}' is invalid.`;z(q,G,"cli")}),$.envVar)this.on("optionEnv:"+Z,(q)=>{let G=`error: option '${$.flags}' value '${q}' from env '${$.envVar}' is invalid.`;z(q,G,"env")});return this}_optionEx($,Z,X,z,q){if(typeof Z==="object"&&Z instanceof M5)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let G=this.createOption(Z,X);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($,Z,X,z){return this._optionEx({},$,Z,X,z)}requiredOption($,Z,X,z){return this._optionEx({mandatory:!0},$,Z,X,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($,Z){return this.setOptionValueWithSource($,Z,void 0)}setOptionValueWithSource($,Z,X){if(this._storeOptionsAsProperties)this[$]=Z;else this._optionValues[$]=Z;return this._optionValueSources[$]=X,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let Z;return this._getCommandAndAncestors().forEach((X)=>{if(X.getOptionValueSource($)!==void 0)Z=X.getOptionValueSource($)}),Z}_prepareUserArgs($,Z){if($!==void 0&&!Array.isArray($))throw Error("first parameter to parse must be array or undefined");if(Z=Z||{},$===void 0&&Z.from===void 0){if(y.versions?.electron)Z.from="electron";let z=y.execArgv??[];if(z.includes("-e")||z.includes("--eval")||z.includes("-p")||z.includes("--print"))Z.from="eval"}if($===void 0)$=y.argv;this.rawArgs=$.slice();let X;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],X=$.slice(2);break;case"electron":if(y.defaultApp)this._scriptPath=$[1],X=$.slice(2);else X=$.slice(1);break;case"user":X=$.slice(0);break;case"eval":X=$.slice(1);break;default:throw Error(`unexpected parse option { from: '${Z.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",X}parse($,Z){this._prepareForParse();let X=this._prepareUserArgs($,Z);return this._parseCommand([],X),this}async parseAsync($,Z){this._prepareForParse();let X=this._prepareUserArgs($,Z);return await this._parseCommand([],X),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($,Z,X){if(P1.existsSync($))return;let z=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",q=`'${$}' does not exist
20
+ - if '${X}' 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
- - ${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(`${$}
22
+ - ${z}`;throw Error(q)}_executeSubCommand($,Z){Z=Z.slice();let X=!1,z=[".js",".ts",".tsx",".mjs",".cjs"];function q(U,W){let H=V0.resolve(U,W);if(P1.existsSync(H))return H;if(z.includes(V0.extname(W)))return;let V=z.find((B)=>P1.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=P1.realpathSync(this._scriptPath)}catch{U=this._scriptPath}J=V0.resolve(V0.dirname(U),J)}if(J){let U=q(J,G);if(!U&&!$._executableFile&&this._scriptPath){let W=V0.basename(this._scriptPath,V0.extname(this._scriptPath));if(W!==this._name)U=q(J,`${W}-${$._name}`)}G=U||G}X=z.includes(V0.extname(G));let Q;if(y.platform!=="win32")if(X)Z.unshift(G),Z=P5(y.execArgv).concat(Z),Q=G4.spawn(y.argv[0],Z,{stdio:"inherit"});else Q=G4.spawn(G,Z,{stdio:"inherit"});else this._checkForMissingExecutable(G,J,$._name),Z.unshift(G),Z=P5(y.execArgv).concat(Z),Q=G4.spawn(y.execPath,Z,{stdio:"inherit"});if(!Q.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((W)=>{y.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)y.exit(U);else Y(new J4(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)y.exit(1);else{let W=new J4(1,"commander.executeSubCommandAsync","(error)");W.nestedError=U,Y(W)}}),this.runningCommand=Q}_dispatchSubcommand($,Z,X){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,Z.concat(X));else return z._parseCommand(Z,X)}),q}_dispatchHelpCommand($){if(!$)this.help();let Z=this._findCommand($);if(Z&&!Z._executableHandler)Z.help();return this._dispatchSubcommand($,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,Z)=>{if($.required&&this.args[Z]==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 $=(X,z,q)=>{let G=z;if(z!==null&&X.parseArg){let J=`error: command-argument value '${z}' is invalid for argument '${X.name()}'.`;G=this._callParseArg(X,z,q,J)}return G};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((X,z)=>{let q=X.defaultValue;if(X.variadic){if(z<this.args.length){if(q=this.args.slice(z),X.parseArg)q=q.reduce((G,J)=>{return $(X,J,G)},X.defaultValue)}else if(q===void 0)q=[]}else if(z<this.args.length){if(q=this.args[z],X.parseArg)q=$(X,q,X.defaultValue)}Z[z]=q}),this.processedArgs=Z}_chainOrCall($,Z){if($?.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let X=$,z=[];if(this._getCommandAndAncestors().reverse().filter((q)=>q._lifeCycleHooks[Z]!==void 0).forEach((q)=>{q._lifeCycleHooks[Z].forEach((G)=>{z.push({hookedCommand:q,callback:G})})}),Z==="postAction")z.reverse();return z.forEach((q)=>{X=this._chainOrCall(X,()=>{return q.callback(q.hookedCommand,this)})}),X}_chainOrCallSubCommandHook($,Z,X){let z=$;if(this._lifeCycleHooks[X]!==void 0)this._lifeCycleHooks[X].forEach((q)=>{z=this._chainOrCall(z,()=>{return q(this,Z)})});return z}_parseCommand($,Z){let X=this.parseOptions(Z);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(X.operands),Z=X.unknown,this.args=$.concat(Z),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),Z);if(this._getHelpCommand()&&$[0]===this._getHelpCommand().name())return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(Z),this._dispatchSubcommand(this._defaultCommandName,$,Z);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});this._outputHelpIfRequested(X.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=()=>{if(X.unknown.length>0)this.unknownOption(X.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,$,Z)});return G=this._chainOrCallHooks(G,"postAction"),G}if(this.parent?.listenerCount(q))z(),this._processArguments(),this.parent.emit(q,$,Z);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,Z);if(this.listenerCount("command:*"))this.emit("command:*",$,Z);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((Z)=>Z._name===$||Z._aliases.includes($))}_findOption($){return this.options.find((Z)=>Z.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((Z)=>{if(Z.mandatory&&$.getOptionValue(Z.attributeName())===void 0)$.missingMandatoryOptionValue(Z)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((X)=>{let z=X.attributeName();if(this.getOptionValue(z)===void 0)return!1;return this.getOptionValueSource(z)!=="default"});$.filter((X)=>X.conflictsWith.length>0).forEach((X)=>{let z=$.find((q)=>X.conflictsWith.includes(q.attributeName()));if(z)this._conflictingOption(X,z)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],X=[],z=Z;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===X)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===Z&&q(U)&&!(this.commands.length===0&&G(U)))z=X;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&X.length===0){if(this._findCommand(U)){Z.push(U),X.push(...$.slice(Y));break}else if(this._getHelpCommand()&&U===this._getHelpCommand().name()){Z.push(U,...$.slice(Y));break}else if(this._defaultCommandName){X.push(U,...$.slice(Y));break}}if(this._passThroughOptions){z.push(U,...$.slice(Y));break}z.push(U)}return{operands:Z,unknown:X}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let X=0;X<Z;X++){let z=this.options[X].attributeName();$[z]=z===this._versionOptionName?this._version:this[z]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,Z)=>Object.assign($,Z.opts()),{})}error($,Z){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||{},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(`
25
+ `),this.outputHelp({error:!0});let X=Z||{},z=X.exitCode||1,q=X.code||"commander.error";this._exit(z,q,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in y.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,y.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new IX(this.options),Z=(X)=>{return this.getOptionValue(X)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(X))};this.options.filter((X)=>X.implied!==void 0&&Z(X.attributeName())&&$.valueFromOption(this.getOptionValue(X.attributeName()),X)).forEach((X)=>{Object.keys(X.implied).filter((z)=>!Z(z)).forEach((z)=>{this.setOptionValueWithSource(z,X.implied[z],"implied")})})}missingArgument($){let Z=`error: missing required argument '${$}'`;this.error(Z,{code:"commander.missingArgument"})}optionMissingArgument($){let Z=`error: option '${$.flags}' argument missing`;this.error(Z,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let Z=`error: required option '${$.flags}' not specified`;this.error(Z,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,Z){let X=(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=X(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(Z)}`;this.error(q,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";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);Z=w5($,z)}let X=`error: unknown option '${$}'${Z}`;this.error(X,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let Z=this.registeredArguments.length,X=Z===1?"":"s",q=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Z} argument${X} but got ${$.length}.`;this.error(q,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],Z="";if(this._showSuggestionAfterError){let z=[];this.createHelp().visibleCommands(this).forEach((q)=>{if(z.push(q.name()),q.alias())z.push(q.alias())}),Z=w5($,z)}let X=`error: unknown command '${$}'${Z}`;this.error(X,{code:"commander.unknownCommand"})}version($,Z,X){if($===void 0)return this._version;this._version=$,Z=Z||"-V, --version",X=X||"output the version number";let z=this.createOption(Z,X);return this._versionOptionName=z.attributeName(),this._registerOption(z),this.on("option:"+z.name(),()=>{this._outputConfiguration.writeOut(`${$}
26
+ `),this._exit(0,"commander.version",$)}),this}description($,Z){if($===void 0&&Z===void 0)return this._description;if(this._description=$,Z)this._argsDescription=Z;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let Z=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)Z=this.commands[this.commands.length-1];if($===Z._name)throw Error("Command alias can't be the same as its name");let X=this.parent?._findCommand($);if(X){let z=[X.name()].concat(X.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${z}'`)}return Z._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((Z)=>this.alias(Z)),this}usage($){if($===void 0){if(this._usage)return this._usage;let Z=this.registeredArguments.map((X)=>{return wX(X)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Z:[]).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=V0.basename($,V0.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),X=this._getOutputContext($);Z.prepareContext({error:X.error,helpWidth:X.helpWidth,outputHasColors:X.hasColors});let z=Z.formatHelp(this,Z);if(X.hasColors)return z;return this._outputConfiguration.stripColor(z)}_getOutputContext($){$=$||{};let Z=!!$.error,X,z,q;if(Z)X=(J)=>this._outputConfiguration.writeErr(J),z=this._outputConfiguration.getErrHasColors(),q=this._outputConfiguration.getErrHelpWidth();else X=(J)=>this._outputConfiguration.writeOut(J),z=this._outputConfiguration.getOutHasColors(),q=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(J)=>{if(!z)J=this._outputConfiguration.stripColor(J);return X(J)},hasColors:z,helpWidth:q}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let X=this._getOutputContext($),z={error:X.error,write:X.write,command:this};this._getCommandAndAncestors().reverse().forEach((G)=>G.emit("beforeAllHelp",z)),this.emit("beforeHelp",z);let q=this.helpInformation({error:X.error});if(Z){if(q=Z(q),typeof q!=="string"&&!Buffer.isBuffer(q))throw Error("outputHelp callback must return a string or a Buffer")}if(X.write(q),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",z),this._getCommandAndAncestors().forEach((G)=>G.emit("afterAllHelp",z))}helpOption($,Z){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",Z??"display help for command"),$||Z)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 Z=Number(y.exitCode??0);if(Z===0&&$&&typeof $!=="function"&&$.error)Z=1;this._exit(Z,"commander.help","(outputHelp)")}addHelpText($,Z){let X=["beforeAll","before","after","afterAll"];if(!X.includes($))throw Error(`Unexpected value for position to addHelpText.
27
+ Expecting one of '${X.join("', '")}'`);let z=`${$}Help`;return this.on(z,(q)=>{let G;if(typeof Z==="function")G=Z({error:q.error,command:q.command});else G=Z;if(G)q.write(`${G}
28
+ `)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((z)=>Z.is(z)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function P5($){return $.map((Z)=>{if(!Z.startsWith("--inspect"))return Z;let X,z="127.0.0.1",q="9229",G;if((G=Z.match(/^(--inspect(-brk)?)$/))!==null)X=G[1];else if((G=Z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(X=G[1],/^\d+$/.test(G[3]))q=G[3];else z=G[3];else if((G=Z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)X=G[1],z=G[3],q=G[4];if(X&&q!=="0")return`${X}=${z}:${parseInt(q)+1}`;return Z})}function Q4(){if(y.env.NO_COLOR||y.env.FORCE_COLOR==="0"||y.env.FORCE_COLOR==="false")return!1;if(y.env.FORCE_COLOR||y.env.CLICOLOR_FORCE!==void 0)return!0;return}AX.Command=Y4;AX.useColor=Q4});var j5=_((EX)=>{var{Argument:I5}=w1(),{Command:U4}=R5(),{CommanderError:SX,InvalidArgumentError:A5}=S$(),{Help:CX}=z4(),{Option:N5}=q4();EX.program=new U4;EX.createCommand=($)=>new U4($);EX.createOption=($,Z)=>new N5($,Z);EX.createArgument=($,Z)=>new I5($,Z);EX.Command=U4;EX.Option=N5;EX.Argument=I5;EX.Help=CX;EX.CommanderError=SX;EX.InvalidArgumentError=A5;EX.InvalidOptionArgumentError=A5});var S=_((oX)=>{var T4=Symbol.for("yaml.alias"),E5=Symbol.for("yaml.document"),R1=Symbol.for("yaml.map"),b5=Symbol.for("yaml.pair"),B4=Symbol.for("yaml.scalar"),I1=Symbol.for("yaml.seq"),T0=Symbol.for("yaml.node.type"),lX=($)=>!!$&&typeof $==="object"&&$[T0]===T4,cX=($)=>!!$&&typeof $==="object"&&$[T0]===E5,iX=($)=>!!$&&typeof $==="object"&&$[T0]===R1,aX=($)=>!!$&&typeof $==="object"&&$[T0]===b5,y5=($)=>!!$&&typeof $==="object"&&$[T0]===B4,nX=($)=>!!$&&typeof $==="object"&&$[T0]===I1;function x5($){if($&&typeof $==="object")switch($[T0]){case R1:case I1:return!0}return!1}function sX($){if($&&typeof $==="object")switch($[T0]){case T4:case R1:case B4:case I1:return!0}return!1}var rX=($)=>(y5($)||x5($))&&!!$.anchor;oX.ALIAS=T4;oX.DOC=E5;oX.MAP=R1;oX.NODE_TYPE=T0;oX.PAIR=b5;oX.SCALAR=B4;oX.SEQ=I1;oX.hasAnchor=rX;oX.isAlias=lX;oX.isCollection=x5;oX.isDocument=cX;oX.isMap=iX;oX.isNode=sX;oX.isPair=aX;oX.isScalar=y5;oX.isSeq=nX});var C$=_((Bz)=>{var v=S(),n=Symbol("break visit"),k5=Symbol("skip children"),Y0=Symbol("remove node");function A1($,Z){let X=f5(Z);if(v.isDocument($)){if($$(null,$.contents,X,Object.freeze([$]))===Y0)$.contents=null}else $$(null,$,X,Object.freeze([]))}A1.BREAK=n;A1.SKIP=k5;A1.REMOVE=Y0;function $$($,Z,X,z){let q=h5($,Z,X,z);if(v.isNode(q)||v.isPair(q))return g5($,z,q),$$($,q,X,z);if(typeof q!=="symbol"){if(v.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let G=0;G<Z.items.length;++G){let J=$$(G,Z.items[G],X,z);if(typeof J==="number")G=J-1;else if(J===n)return n;else if(J===Y0)Z.items.splice(G,1),G-=1}}else if(v.isPair(Z)){z=Object.freeze(z.concat(Z));let G=$$("key",Z.key,X,z);if(G===n)return n;else if(G===Y0)Z.key=null;let J=$$("value",Z.value,X,z);if(J===n)return n;else if(J===Y0)Z.value=null}}return q}async function N1($,Z){let X=f5(Z);if(v.isDocument($)){if(await Z$(null,$.contents,X,Object.freeze([$]))===Y0)$.contents=null}else await Z$(null,$,X,Object.freeze([]))}N1.BREAK=n;N1.SKIP=k5;N1.REMOVE=Y0;async function Z$($,Z,X,z){let q=await h5($,Z,X,z);if(v.isNode(q)||v.isPair(q))return g5($,z,q),Z$($,q,X,z);if(typeof q!=="symbol"){if(v.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let G=0;G<Z.items.length;++G){let J=await Z$(G,Z.items[G],X,z);if(typeof J==="number")G=J-1;else if(J===n)return n;else if(J===Y0)Z.items.splice(G,1),G-=1}}else if(v.isPair(Z)){z=Object.freeze(z.concat(Z));let G=await Z$("key",Z.key,X,z);if(G===n)return n;else if(G===Y0)Z.key=null;let J=await Z$("value",Z.value,X,z);if(J===n)return n;else if(J===Y0)Z.value=null}}return q}function f5($){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 h5($,Z,X,z){if(typeof X==="function")return X($,Z,z);if(v.isMap(Z))return X.Map?.($,Z,z);if(v.isSeq(Z))return X.Seq?.($,Z,z);if(v.isPair(Z))return X.Pair?.($,Z,z);if(v.isScalar(Z))return X.Scalar?.($,Z,z);if(v.isAlias(Z))return X.Alias?.($,Z,z);return}function g5($,Z,X){let z=Z[Z.length-1];if(v.isCollection(z))z.items[$]=X;else if(v.isPair(z))if($==="key")z.key=X;else z.value=X;else if(v.isDocument(z))z.contents=X;else{let q=v.isAlias(z)?"alias":"scalar";throw Error(`Cannot replace node with ${q} parent`)}}Bz.visit=A1;Bz.visitAsync=N1});var K4=_((Fz)=>{var v5=S(),Dz=C$(),_z={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Oz=($)=>$.replace(/[!,[\]{}]/g,(Z)=>_z[Z]);class o{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},o.defaultYaml,$),this.tags=Object.assign({},o.defaultTags,Z)}clone(){let $=new o(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new o(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:o.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},o.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:o.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},o.defaultTags),this.atNextDocument=!1;let X=$.trim().split(/[ \t]+/),z=X.shift();switch(z){case"%TAG":{if(X.length!==2){if(Z(0,"%TAG directive should contain exactly two parts"),X.length<2)return!1}let[q,G]=X;return this.tags[q]=G,!0}case"%YAML":{if(this.yaml.explicit=!0,X.length!==1)return Z(0,"%YAML directive should contain exactly one part"),!1;let[q]=X;if(q==="1.1"||q==="1.2")return this.yaml.version=q,!0;else{let G=/^\d+\.\d+$/.test(q);return Z(6,`Unsupported YAML version ${q}`,G),!1}}default:return Z(0,`Unknown directive ${z}`,!0),!1}}tagName($,Z){if($==="!")return"!";if($[0]!=="!")return Z(`Not a valid tag: ${$}`),null;if($[1]==="<"){let G=$.slice(2,-1);if(G==="!"||G==="!!")return Z(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")Z("Verbatim tags must end with a >");return G}let[,X,z]=$.match(/^(.*!)([^!]*)$/s);if(!z)Z(`The ${$} tag has no suffix`);let q=this.tags[X];if(q)try{return q+decodeURIComponent(z)}catch(G){return Z(String(G)),null}if(X==="!")return $;return Z(`Could not resolve tag: ${$}`),null}tagString($){for(let[Z,X]of Object.entries(this.tags))if($.startsWith(X))return Z+Oz($.substring(X.length));return $[0]==="!"?$:`!<${$}>`}toString($){let Z=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],X=Object.entries(this.tags),z;if($&&X.length>0&&v5.isNode($.contents)){let q={};Dz.visit($.contents,(G,J)=>{if(v5.isNode(J)&&J.tag)q[J.tag]=!0}),z=Object.keys(q)}else z=[];for(let[q,G]of X){if(q==="!!"&&G==="tag:yaml.org,2002:")continue;if(!$||z.some((J)=>J.startsWith(G)))Z.push(`%TAG ${q} ${G}`)}return Z.join(`
29
+ `)}}o.defaultYaml={explicit:!1,version:"1.2"};o.defaultTags={"!!":"tag:yaml.org,2002:"};Fz.Directives=o});var j1=_((Iz)=>{var u5=S(),wz=C$();function Pz($){if(/[\x00-\x19\s,[\]{}]/.test($)){let X=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(X)}return!0}function m5($){let Z=new Set;return wz.visit($,{Value(X,z){if(z.anchor)Z.add(z.anchor)}}),Z}function d5($,Z){for(let X=1;;++X){let z=`${$}${X}`;if(!Z.has(z))return z}}function Rz($,Z){let X=[],z=new Map,q=null;return{onAnchor:(G)=>{X.push(G),q??(q=m5($));let J=d5(Z,q);return q.add(J),J},setAnchors:()=>{for(let G of X){let J=z.get(G);if(typeof J==="object"&&J.anchor&&(u5.isScalar(J.node)||u5.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}}Iz.anchorIsValid=Pz;Iz.anchorNames=m5;Iz.createNodeAnchors=Rz;Iz.findNewAnchor=d5});var L4=_((Cz)=>{function E$($,Z,X,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=E$($,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=E$($,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=E$($,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=E$($,z,q,G);if(J===void 0)delete z[q];else if(J!==G)z[q]=J}return $.call(Z,X,z)}Cz.applyReviver=E$});var M0=_((yz)=>{var bz=S();function p5($,Z,X){if(Array.isArray($))return $.map((z,q)=>p5(z,String(q),X));if($&&typeof $.toJSON==="function"){if(!X||!bz.hasAnchor($))return $.toJSON(Z,X);let z={aliasCount:0,count:1,res:void 0};X.anchors.set($,z),X.onCreate=(G)=>{z.res=G,delete X.onCreate};let q=$.toJSON(Z,X);if(X.onCreate)X.onCreate(q);return q}if(typeof $==="bigint"&&!X?.keep)return Number($);return $}yz.toJS=p5});var S1=_((hz)=>{var kz=L4(),l5=S(),fz=M0();class c5{constructor($){Object.defineProperty(this,l5.NODE_TYPE,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:Z,maxAliasCount:X,onAnchor:z,reviver:q}={}){if(!l5.isDocument($))throw TypeError("A document argument is required");let G={anchors:new Map,doc:$,keep:!0,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof X==="number"?X:100},J=fz.toJS(this,"",G);if(typeof z==="function")for(let{count:Q,res:Y}of G.anchors.values())z(Y,Q);return typeof q==="function"?kz.applyReviver(q,{"":J},"",J):J}}hz.NodeBase=c5});var b$=_((pz)=>{var vz=j1(),uz=C$(),X$=S(),mz=S1(),dz=M0();class i5 extends mz.NodeBase{constructor($){super(X$.ALIAS);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,Z){let X;if(Z?.aliasResolveCache)X=Z.aliasResolveCache;else if(X=[],uz.visit($,{Node:(q,G)=>{if(X$.isAlias(G)||X$.hasAnchor(G))X.push(G)}}),Z)Z.aliasResolveCache=X;let z=void 0;for(let q of X){if(q===this)break;if(q.anchor===this.source)z=q}return z}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:X,doc:z,maxAliasCount:q}=Z,G=this.resolve(z,Z);if(!G){let Q=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(Q)}let J=X.get(G);if(!J)dz.toJS(G,null,Z),J=X.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=C1(z,G,X);if(J.count*J.aliasCount>q)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return J.res}toString($,Z,X){let z=`*${this.source}`;if($){if(vz.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 C1($,Z,X){if(X$.isAlias(Z)){let z=Z.resolve($),q=X&&z&&X.get(z);return q?q.count*q.aliasCount:0}else if(X$.isCollection(Z)){let z=0;for(let q of Z.items){let G=C1($,q,X);if(G>z)z=G}return z}else if(X$.isPair(Z)){let z=C1($,Z.key,X),q=C1($,Z.value,X);return Math.max(z,q)}return 1}pz.Alias=i5});var g=_((sz)=>{var cz=S(),iz=S1(),az=M0(),nz=($)=>!$||typeof $!=="function"&&typeof $!=="object";class h0 extends iz.NodeBase{constructor($){super(cz.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:az.toJS(this.value,$,Z)}toString(){return String(this.value)}}h0.BLOCK_FOLDED="BLOCK_FOLDED";h0.BLOCK_LITERAL="BLOCK_LITERAL";h0.PLAIN="PLAIN";h0.QUOTE_DOUBLE="QUOTE_DOUBLE";h0.QUOTE_SINGLE="QUOTE_SINGLE";sz.Scalar=h0;sz.isScalarValue=nz});var y$=_((X3)=>{var tz=b$(),g0=S(),a5=g(),ez="tag:yaml.org,2002:";function $3($,Z,X){if(Z){let z=X.filter((G)=>G.tag===Z),q=z.find((G)=>!G.format)??z[0];if(!q)throw Error(`Tag ${Z} not found`);return q}return X.find((z)=>z.identify?.($)&&!z.format)}function Z3($,Z,X){if(g0.isDocument($))$=$.contents;if(g0.isNode($))return $;if(g0.isPair($)){let H=X.schema[g0.MAP].createNode?.(X.schema,null,X);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}=X,Y=void 0;if(z&&$&&typeof $==="object")if(Y=Q.get($),Y)return Y.anchor??(Y.anchor=q($)),new tz.Alias(Y.anchor);else Y={anchor:null,node:null},Q.set($,Y);if(Z?.startsWith("!!"))Z=ez+Z.slice(2);let U=$3($,Z,J.tags);if(!U){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let H=new a5.Scalar($);if(Y)Y.node=H;return H}U=$ instanceof Map?J[g0.MAP]:(Symbol.iterator in Object($))?J[g0.SEQ]:J[g0.MAP]}if(G)G(U),delete X.onTagObj;let W=U?.createNode?U.createNode(X.schema,$,X):typeof U?.nodeClass?.from==="function"?U.nodeClass.from(X.schema,$,X):new a5.Scalar($);if(Z)W.tag=Z;else if(!U.default)W.tag=U.tag;if(Y)Y.node=W;return W}X3.createNode=Z3});var E1=_((J3)=>{var q3=y$(),U0=S(),G3=S1();function D4($,Z,X){let z=X;for(let q=Z.length-1;q>=0;--q){let G=Z[q];if(typeof G==="number"&&Number.isInteger(G)&&G>=0){let J=[];J[G]=z,z=J}else z=new Map([[G,z]])}return q3.createNode(z,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var n5=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class s5 extends G3.NodeBase{constructor($,Z){super($);Object.defineProperty(this,"schema",{value:Z,configurable:!0,enumerable:!1,writable:!0})}clone($){let Z=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)Z.schema=$;if(Z.items=Z.items.map((X)=>U0.isNode(X)||U0.isPair(X)?X.clone($):X),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(n5($))this.add(Z);else{let[X,...z]=$,q=this.get(X,!0);if(U0.isCollection(q))q.addIn(z,Z);else if(q===void 0&&this.schema)this.set(X,D4(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}deleteIn($){let[Z,...X]=$;if(X.length===0)return this.delete(Z);let z=this.get(Z,!0);if(U0.isCollection(z))return z.deleteIn(X);else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${X}`)}getIn($,Z){let[X,...z]=$,q=this.get(X,!0);if(z.length===0)return!Z&&U0.isScalar(q)?q.value:q;else return U0.isCollection(q)?q.getIn(z,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!U0.isPair(Z))return!1;let X=Z.value;return X==null||$&&U0.isScalar(X)&&X.value==null&&!X.commentBefore&&!X.comment&&!X.tag})}hasIn($){let[Z,...X]=$;if(X.length===0)return this.has(Z);let z=this.get(Z,!0);return U0.isCollection(z)?z.hasIn(X):!1}setIn($,Z){let[X,...z]=$;if(z.length===0)this.set(X,Z);else{let q=this.get(X,!0);if(U0.isCollection(q))q.setIn(z,Z);else if(q===void 0&&this.schema)this.set(X,D4(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}}J3.Collection=s5;J3.collectionFromPath=D4;J3.isEmptyPath=n5});var x$=_((V3)=>{var H3=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function _4($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var W3=($,Z,X)=>$.endsWith(`
30
+ `)?_4(X,Z):X.includes(`
31
31
  `)?`
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)+`
32
+ `+_4(X,Z):($.endsWith(" ")?"":" ")+X;V3.indentComment=_4;V3.lineComment=W3;V3.stringifyComment=H3});var o5=_((D3)=>{function L3($,Z,X="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-Z.length);if($.length<=Y)return $;let U=[],W={},H=q-Z.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,D=-1;if(X==="block"){if(T=r5($,T,Z.length),T!==-1)H=T+Y}for(let M;M=$[T+=1];){if(X==="quoted"&&M==="\\"){switch(K=T,$[T+1]){case"x":T+=3;break;case"u":T+=5;break;case"U":T+=9;break;default:T+=1}D=T}if(M===`
33
+ `){if(X==="block")T=r5($,T,Z.length);H=T+Z.length+Y,V=void 0}else{if(M===" "&&B&&B!==" "&&B!==`
34
+ `&&B!=="\t"){let w=$[T+1];if(w&&w!==" "&&w!==`
35
+ `&&w!=="\t")V=T}if(T>=H)if(V)U.push(V),H=V+Y,V=void 0;else if(X==="quoted"){while(B===" "||B==="\t")B=M,M=$[T+=1],L=!0;let w=T>D+1?T-2:K-1;if(W[w])return $;U.push(w),W[w]=!0,H=w+Y,V=void 0}else L=!0}B=M}if(L&&Q)Q();if(U.length===0)return $;if(J)J();let O=$.slice(0,U[0]);for(let M=0;M<U.length;++M){let w=U[M],I=U[M+1]||$.length;if(w===0)O=`
36
+ ${Z}${$.slice(0,I)}`;else{if(X==="quoted"&&W[w])O+=`${$[w]}\\`;O+=`
37
+ ${Z}${$.slice(w+1,I)}`}}return O}function r5($,Z,X){let z=Z,q=Z+1,G=$[q];while(G===" "||G==="\t")if(Z<q+X)G=$[++Z];else{do G=$[++Z];while(G&&G!==`
38
+ `);z=Z,q=Z+1,G=$[q]}return z}D3.FOLD_BLOCK="block";D3.FOLD_FLOW="flow";D3.FOLD_QUOTED="quoted";D3.foldFlowLines=L3});var f$=_((I3)=>{var z0=g(),w0=o5(),y1=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),x1=($)=>/^(%|---|\.\.\.)/m.test($);function w3($,Z,X){if(!Z||Z<0)return!1;let z=Z-X,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 k$($,Z){let X=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return X;let{implicitKey:z}=Z,q=Z.options.doubleQuotedMinMultiLineLength,G=Z.indent||(x1($)?" ":""),J="",Q=0;for(let Y=0,U=X[Y];U;U=X[++Y]){if(U===" "&&X[Y+1]==="\\"&&X[Y+2]==="n")J+=X.slice(Q,Y)+"\\ ",Y+=1,Q=Y,U="\\";if(U==="\\")switch(X[Y+1]){case"u":{J+=X.slice(Q,Y);let W=X.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+=X.substr(Y,6)}Y+=5,Q=Y+1}break;case"n":if(z||X[Y+2]==='"'||X.length<q)Y+=1;else{J+=X.slice(Q,Y)+`
40
40
 
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,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(`(^|(?<!
41
+ `;while(X[Y+2]==="\\"&&X[Y+3]==="n"&&X[Y+4]!=='"')J+=`
42
+ `,Y+=2;if(J+=G,X[Y+2]===" ")J+="\\";Y+=1,Q=Y+1}break;default:Y+=1}}return J=Q?J+X.slice(Q):X,z?J:w0.foldFlowLines(J,G,w0.FOLD_QUOTED,y1(Z,!1))}function O4($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
43
+ `)||/[ \t]\n|\n[ \t]/.test($))return k$($,Z);let X=Z.indent||(x1($)?" ":""),z="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
44
+ ${X}`)+"'";return Z.implicitKey?z:w0.foldFlowLines(z,X,w0.FOLD_FLOW,y1(Z,!1))}function z$($,Z){let{singleQuote:X}=Z.options,z;if(X===!1)z=k$;else{let q=$.includes('"'),G=$.includes("'");if(q&&!G)z=O4;else if(G&&!q)z=k$;else z=X?O4:k$}return z($,Z)}var F4;try{F4=new RegExp(`(^|(?<!
45
45
  ))
46
46
  +(?!
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?`|
47
+ |$)`,"g")}catch{F4=/\n+(?!\n|$)/g}function b1({comment:$,type:Z,value:X},z,q,G){let{blockQuote:J,commentString:Q,lineWidth:Y}=z.options;if(!J||/\n[\t ]+$/.test(X))return z$(X,z);let U=z.indent||(z.forceBlockIndent||x1(X)?" ":""),W=J==="literal"?!0:J==="folded"||Z===z0.Scalar.BLOCK_FOLDED?!1:Z===z0.Scalar.BLOCK_LITERAL?!0:!w3(X,Y,U.length);if(!X)return W?`|
48
48
  `:`>
49
- `;let H,V;for(V=Z.length;V>0;--V){let R=Z[V-1];if(R!==`
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
- `)||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,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
- `&&O)N=`
49
+ `;let H,V;for(V=X.length;V>0;--V){let I=X[V-1];if(I!==`
50
+ `&&I!=="\t"&&I!==" ")break}let B=X.substring(V),L=B.indexOf(`
51
+ `);if(L===-1)H="-";else if(X===B||L!==B.length-1){if(H="+",G)G()}else H="";if(B){if(X=X.slice(0,-B.length),B[B.length-1]===`
52
+ `)B=B.slice(0,-1);B=B.replace(F4,`$&${U}`)}let T=!1,K,D=-1;for(K=0;K<X.length;++K){let I=X[K];if(I===" ")T=!0;else if(I===`
53
+ `)D=K;else break}let O=X.substring(0,D<K?D+1:K);if(O)X=X.substring(O.length),O=O.replace(/\n+/g,`$&${U}`);let w=(T?U?"2":"1":"")+H;if($){if(w+=" "+Q($.replace(/ ?[\r\n]+/g," ")),q)q()}if(!W){let I=X.replace(/\n+/g,`
54
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${U}`),R=!1,C=y1(z,!0);if(J!=="folded"&&Z!==z0.Scalar.BLOCK_FOLDED)C.onOverflow=()=>{R=!0};let F=w0.foldFlowLines(`${O}${I}${B}`,U,w0.FOLD_BLOCK,C);if(!R)return`>${w}
55
+ ${U}${F}`}return X=X.replace(/\n+/g,`$&${U}`),`|${w}
56
+ ${U}${O}${X}${B}`}function P3($,Z,X,z){let{type:q,value:G}=$,{actualString:J,implicitKey:Q,indent:Y,indentStep:U,inFlow:W}=Z;if(Q&&G.includes(`
57
+ `)||W&&/[[\]{},]/.test(G))return z$(G,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(G))return Q||W||!G.includes(`
58
+ `)?z$(G,Z):b1($,Z,X,z);if(!Q&&!W&&q!==z0.Scalar.PLAIN&&G.includes(`
59
+ `))return b1($,Z,X,z);if(x1(G)){if(Y==="")return Z.forceBlockIndent=!0,b1($,Z,X,z);else if(Q&&Y===U)return z$(G,Z)}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}=Z.doc.schema;if(L.some(V)||B?.some(V))return z$(G,Z)}return Q?H:w0.foldFlowLines(H,Y,w0.FOLD_FLOW,y1(Z,!1))}function R3($,Z,X,z){let{implicitKey:q,inFlow:G}=Z,J=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:Q}=$;if(Q!==z0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(J.value))Q=z0.Scalar.QUOTE_DOUBLE}let Y=(W)=>{switch(W){case z0.Scalar.BLOCK_FOLDED:case z0.Scalar.BLOCK_LITERAL:return q||G?z$(J.value,Z):b1(J,Z,X,z);case z0.Scalar.QUOTE_DOUBLE:return k$(J.value,Z);case z0.Scalar.QUOTE_SINGLE:return O4(J.value,Z);case z0.Scalar.PLAIN:return P3(J,Z,X,z);default:return null}},U=Y(Q);if(U===null){let{defaultKeyType:W,defaultStringType:H}=Z.options,V=q&&W||H;if(U=Y(V),U===null)throw Error(`Unsupported default string type ${V}`)}return U}I3.stringifyString=R3});var h$=_((x3)=>{var N3=j1(),P0=S(),j3=x$(),S3=f$();function C3($,Z){let X=Object.assign({blockQuote:!0,commentString:j3.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,Z),z;switch(X.collectionStyle){case"block":z=!1;break;case"flow":z=!0;break;default:z=null}return{anchors:new Set,doc:$,flowCollectionPadding:X.flowCollectionPadding?" ":"",indent:"",indentStep:typeof X.indent==="number"?" ".repeat(X.indent):" ",inFlow:z,options:X}}function E3($,Z){if(Z.tag){let q=$.filter((G)=>G.tag===Z.tag);if(q.length>0)return q.find((G)=>G.format===Z.format)??q[0]}let X=void 0,z;if(P0.isScalar(Z)){z=Z.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}X=q.find((G)=>G.format===Z.format)??q.find((G)=>!G.format)}else z=Z,X=$.find((q)=>q.nodeClass&&z instanceof q.nodeClass);if(!X){let q=z?.constructor?.name??(z===null?"null":typeof z);throw Error(`Tag not resolved for ${q} value`)}return X}function b3($,Z,{anchors:X,doc:z}){if(!z.directives)return"";let q=[],G=(P0.isScalar($)||P0.isCollection($))&&$.anchor;if(G&&N3.anchorIsValid(G))X.add(G),q.push(`&${G}`);let J=$.tag??(Z.default?null:Z.tag);if(J)q.push(z.directives.tagString(J));return q.join(" ")}function y3($,Z,X,z){if(P0.isPair($))return $.toString(Z,X,z);if(P0.isAlias($)){if(Z.doc.directives)return $.toString(Z);if(Z.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(Z.resolvedAliases)Z.resolvedAliases.add($);else Z.resolvedAliases=new Set([$]);$=$.resolve(Z.doc)}}let q=void 0,G=P0.isNode($)?$:Z.doc.createNode($,{onTagObj:(Y)=>q=Y});q??(q=E3(Z.doc.schema.tags,G));let J=b3(G,q,Z);if(J.length>0)Z.indentAtStart=(Z.indentAtStart??0)+J.length+1;let Q=typeof q.stringify==="function"?q.stringify(G,Z,X,z):P0.isScalar(G)?S3.stringifyString(G,Z,X,z):G.toString(Z,X,z);if(!J)return Q;return P0.isScalar(G)||Q[0]==="{"||Q[0]==="["?`${J} ${Q}`:`${J}
61
+ ${Z.indent}${Q}`}x3.createStringifyContext=C3;x3.stringify=y3});var $6=_((g3)=>{var B0=S(),t5=g(),e5=h$(),g$=x$();function h3({key:$,value:Z},X,z,q){let{allNullValues:G,doc:J,indent:Q,indentStep:Y,options:{commentString:U,indentSeq:W,simpleKeys:H}}=X,V=B0.isNode($)&&$.comment||null;if(H){if(V)throw Error("With simple keys, key nodes cannot have comments");if(B0.isCollection($)||!B0.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let B=!H&&(!$||V&&Z==null&&!X.inFlow||B0.isCollection($)||(B0.isScalar($)?$.type===t5.Scalar.BLOCK_FOLDED||$.type===t5.Scalar.BLOCK_LITERAL:typeof $==="object"));X=Object.assign({},X,{allNullValues:!1,implicitKey:!B&&(H||!G),indent:Q+Y});let L=!1,T=!1,K=e5.stringify($,X,()=>L=!0,()=>T=!0);if(!B&&!X.inFlow&&K.length>1024){if(H)throw Error("With simple keys, single line scalar must not span more than 1024 characters");B=!0}if(X.inFlow){if(G||Z==null){if(L&&z)z();return K===""?"?":B?`? ${K}`:K}}else if(G&&!H||Z==null&&B){if(K=`? ${K}`,V&&!L)K+=g$.lineComment(K,X.indent,U(V));else if(T&&q)q();return K}if(L)V=null;if(B){if(V)K+=g$.lineComment(K,X.indent,U(V));K=`? ${K}
62
+ ${Q}:`}else if(K=`${K}:`,V)K+=g$.lineComment(K,X.indent,U(V));let D,O,M;if(B0.isNode(Z))D=!!Z.spaceBefore,O=Z.commentBefore,M=Z.comment;else if(D=!1,O=null,M=null,Z&&typeof Z==="object")Z=J.createNode(Z);if(X.implicitKey=!1,!B&&!V&&B0.isScalar(Z))X.indentAtStart=K.length+1;if(T=!1,!W&&Y.length>=2&&!X.inFlow&&!B&&B0.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)X.indent=X.indent.substring(2);let w=!1,I=e5.stringify(Z,X,()=>w=!0,()=>T=!0),R=" ";if(V||D||O){if(R=D?`
63
+ `:"",O){let C=U(O);R+=`
64
+ ${g$.indentComment(C,X.indent)}`}if(I===""&&!X.inFlow){if(R===`
65
+ `&&M)R=`
66
66
 
67
- `}else 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
- ${Z.indent}`}}else if(R===""||R[0]===`
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?`
67
+ `}else R+=`
68
+ ${X.indent}`}else if(!B&&B0.isCollection(Z)){let C=I[0],F=I.indexOf(`
69
+ `),E=F!==-1,i=X.inFlow??Z.flow??Z.items.length===0;if(E||!i){let a=!1;if(E&&(C==="&"||C==="!")){let b=I.indexOf(" ");if(C==="&"&&b!==-1&&b<F&&I[b+1]==="!")b=I.indexOf(" ",b+1);if(b===-1||F<b)a=!0}if(!a)R=`
70
+ ${X.indent}`}}else if(I===""||I[0]===`
71
+ `)R="";if(K+=R+I,X.inFlow){if(w&&z)z()}else if(M&&!w)K+=g$.lineComment(K,X.indent,U(M));else if(T&&q)q();return K}g3.stringifyPair=h3});var M4=_((d3)=>{var Z6=W0("process");function u3($,...Z){if($==="debug")console.log(...Z)}function m3($,Z){if($==="debug"||$==="warn")if(typeof Z6.emitWarning==="function")Z6.emitWarning(Z);else console.warn(Z)}d3.debug=u3;d3.warn=m3});var h1=_((i3)=>{var v$=S(),X6=g(),k1="<<",f1={identify:($)=>$===k1||typeof $==="symbol"&&$.description===k1,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new X6.Scalar(Symbol(k1)),{addToJSMap:z6}),stringify:()=>k1},c3=($,Z)=>(f1.identify(Z)||v$.isScalar(Z)&&(!Z.type||Z.type===X6.Scalar.PLAIN)&&f1.identify(Z.value))&&$?.doc.schema.tags.some((X)=>X.tag===f1.tag&&X.default);function z6($,Z,X){if(X=$&&v$.isAlias(X)?X.resolve($.doc):X,v$.isSeq(X))for(let z of X.items)w4($,Z,z);else if(Array.isArray(X))for(let z of X)w4($,Z,z);else w4($,Z,X)}function w4($,Z,X){let z=$&&v$.isAlias(X)?X.resolve($.doc):X;if(!v$.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(Z instanceof Map){if(!Z.has(G))Z.set(G,J)}else if(Z instanceof Set)Z.add(G);else if(!Object.prototype.hasOwnProperty.call(Z,G))Object.defineProperty(Z,G,{value:J,writable:!0,enumerable:!0,configurable:!0});return Z}i3.addMergeToJSMap=z6;i3.isMergeKey=c3;i3.merge=f1});var R4=_(($7)=>{var r3=M4(),q6=h1(),o3=h$(),G6=S(),P4=M0();function t3($,Z,{key:X,value:z}){if(G6.isNode(X)&&X.addToJSMap)X.addToJSMap($,Z,z);else if(q6.isMergeKey($,X))q6.addMergeToJSMap($,Z,z);else{let q=P4.toJS(X,"",$);if(Z instanceof Map)Z.set(q,P4.toJS(z,q,$));else if(Z instanceof Set)Z.add(q);else{let G=e3(X,q,$),J=P4.toJS(z,G,$);if(G in Z)Object.defineProperty(Z,G,{value:J,writable:!0,enumerable:!0,configurable:!0});else Z[G]=J}}return Z}function e3($,Z,X){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(G6.isNode($)&&X?.doc){let z=o3.createStringifyContext(X.doc,{});z.anchors=new Set;for(let G of X.anchors.keys())z.anchors.add(G.anchor);z.inFlow=!0,z.inStringifyKey=!0;let q=$.toString(z);if(!X.mapKeyWarned){let G=JSON.stringify(q);if(G.length>40)G=G.substring(0,36)+'..."';r3.warn(X.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${G}. Set mapAsMap: true to use object keys.`),X.mapKeyWarned=!0}return q}return JSON.stringify(Z)}$7.addPairToJSMap=t3});var R0=_((G7)=>{var J6=y$(),X7=$6(),z7=R4(),g1=S();function q7($,Z,X){let z=J6.createNode($,void 0,X),q=J6.createNode(Z,void 0,X);return new v1(z,q)}class v1{constructor($,Z=null){Object.defineProperty(this,g1.NODE_TYPE,{value:g1.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:X}=this;if(g1.isNode(Z))Z=Z.clone($);if(g1.isNode(X))X=X.clone($);return new v1(Z,X)}toJSON($,Z){let X=Z?.mapAsMap?new Map:{};return z7.addPairToJSMap(Z,X,this)}toString($,Z,X){return $?.doc?X7.stringifyPair(this,$,Z,X):JSON.stringify(this)}}G7.Pair=v1;G7.createPair=q7});var I4=_((W7)=>{var v0=S(),Q6=h$(),u1=x$();function Y7($,Z,X){return(Z.inFlow??$.flow?H7:U7)($,Z,X)}function U7({comment:$,items:Z},X,{blockItemPrefix:z,flowChars:q,itemIndent:G,onChompKeep:J,onComment:Q}){let{indent:Y,options:{commentString:U}}=X,W=Object.assign({},X,{indent:G,type:null}),H=!1,V=[];for(let L=0;L<Z.length;++L){let T=Z[L],K=null;if(v0.isNode(T)){if(!H&&T.spaceBefore)V.push("");if(m1(X,V,T.commentBefore,H),T.comment)K=T.comment}else if(v0.isPair(T)){let O=v0.isNode(T.key)?T.key:null;if(O){if(!H&&O.spaceBefore)V.push("");m1(X,V,O.commentBefore,H)}}H=!1;let D=Q6.stringify(T,W,()=>K=null,()=>H=!0);if(K)D+=u1.lineComment(D,G,U(K));if(H&&K)H=!1;V.push(z+D)}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
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?`
74
+ `+u1.indentComment(U($),Y),Q)Q()}else if(H&&J)J();return B}function H7({items:$},Z,{flowChars:X,itemIndent:z}){let{indent:q,indentStep:G,flowCollectionPadding:J,options:{commentString:Q}}=Z;z+=G;let Y=Object.assign({},Z,{indent:z,inFlow:!0,type:null}),U=!1,W=0,H=[];for(let L=0;L<$.length;++L){let T=$[L],K=null;if(v0.isNode(T)){if(T.spaceBefore)H.push("");if(m1(Z,H,T.commentBefore,!1),T.comment)K=T.comment}else if(v0.isPair(T)){let O=v0.isNode(T.key)?T.key:null;if(O){if(O.spaceBefore)H.push("");if(m1(Z,H,O.commentBefore,!1),O.comment)U=!0}let M=v0.isNode(T.value)?T.value:null;if(M){if(M.comment)K=M.comment;if(M.commentBefore)U=!0}else if(T.value==null&&O?.comment)K=O.comment}if(K)U=!0;let D=Q6.stringify(T,Y,()=>K=null);if(L<$.length-1)D+=",";if(K)D+=u1.lineComment(D,z,Q(K));if(!U&&(H.length>W||D.includes(`
75
+ `)))U=!0;H.push(D),W=H.length}let{start:V,end:B}=X;if(H.length===0)return V+B;else{if(!U){let L=H.reduce((T,K)=>T+K.length+2,2);U=Z.options.lineWidth>0&&L>Z.options.lineWidth}if(U){let L=V;for(let T of H)L+=T?`
76
76
  ${G}${q}${T}`:`
77
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}
78
+ ${q}${B}`}else return`${V}${J}${H.join(" ")}${J}${B}`}}function m1({indent:$,options:{commentString:Z}},X,z,q){if(z&&q)z=z.replace(/^\n+/,"");if(z){let G=u1.indentComment(Z(z),$);X.push(G.trimStart())}}W7.stringifyCollection=Y7});var A0=_((D7)=>{var T7=I4(),B7=R4(),K7=E1(),I0=S(),d1=R0(),L7=g();function u$($,Z){let X=I0.isScalar(Z)?Z.value:Z;for(let z of $)if(I0.isPair(z)){if(z.key===Z||z.key===X)return z;if(I0.isScalar(z.key)&&z.key.value===X)return z}return}class Y6 extends K7.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(I0.MAP,$);this.items=[]}static from($,Z,X){let{keepUndefined:z,replacer:q}=X,G=new this($),J=(Q,Y)=>{if(typeof q==="function")Y=q.call(Z,Q,Y);else if(Array.isArray(q)&&!q.includes(Q))return;if(Y!==void 0||z)G.items.push(d1.createPair(Q,Y,X))};if(Z instanceof Map)for(let[Q,Y]of Z)J(Q,Y);else if(Z&&typeof Z==="object")for(let Q of Object.keys(Z))J(Q,Z[Q]);if(typeof $.sortMapEntries==="function")G.items.sort($.sortMapEntries);return G}add($,Z){let X;if(I0.isPair($))X=$;else if(!$||typeof $!=="object"||!("key"in $))X=new d1.Pair($,$?.value);else X=new d1.Pair($.key,$.value);let z=u$(this.items,X.key),q=this.schema?.sortMapEntries;if(z){if(!Z)throw Error(`Key ${X.key} already set`);if(I0.isScalar(z.value)&&L7.isScalarValue(X.value))z.value.value=X.value;else z.value=X.value}else if(q){let G=this.items.findIndex((J)=>q(X,J)<0);if(G===-1)this.items.push(X);else this.items.splice(G,0,X)}else this.items.push(X)}delete($){let Z=u$(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let z=u$(this.items,$)?.value;return(!Z&&I0.isScalar(z)?z.value:z)??void 0}has($){return!!u$(this.items,$)}set($,Z){this.add(new d1.Pair($,Z),!0)}toJSON($,Z,X){let z=X?new X:Z?.mapAsMap?new Map:{};if(Z?.onCreate)Z.onCreate(z);for(let q of this.items)B7.addPairToJSMap(Z,z,q);return z}toString($,Z,X){if(!$)return JSON.stringify(this);for(let z of this.items)if(!I0.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 T7.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:X,onComment:Z})}}D7.YAMLMap=Y6;D7.findPair=u$});var q$=_((w7)=>{var F7=S(),U6=A0(),M7={collection:"map",default:!0,nodeClass:U6.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!F7.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,X)=>U6.YAMLMap.from($,Z,X)};w7.map=M7});var N0=_((S7)=>{var R7=y$(),I7=I4(),A7=E1(),l1=S(),N7=g(),j7=M0();class H6 extends A7.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(l1.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=p1($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let X=p1($);if(typeof X!=="number")return;let z=this.items[X];return!Z&&l1.isScalar(z)?z.value:z}has($){let Z=p1($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let X=p1($);if(typeof X!=="number")throw Error(`Expected a valid index, not ${$}.`);let z=this.items[X];if(l1.isScalar(z)&&N7.isScalarValue(Z))z.value=Z;else this.items[X]=Z}toJSON($,Z){let X=[];if(Z?.onCreate)Z.onCreate(X);let z=0;for(let q of this.items)X.push(j7.toJS(q,String(z++),Z));return X}toString($,Z,X){if(!$)return JSON.stringify(this);return I7.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:X,onComment:Z})}static from($,Z,X){let{replacer:z}=X,q=new this($);if(Z&&Symbol.iterator in Object(Z)){let G=0;for(let J of Z){if(typeof z==="function"){let Q=Z instanceof Set?J:String(G++);J=z.call(Z,Q,J)}q.items.push(R7.createNode(J,void 0,X))}}return q}}function p1($){let Z=l1.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}S7.YAMLSeq=H6});var G$=_((y7)=>{var E7=S(),W6=N0(),b7={collection:"seq",default:!0,nodeClass:W6.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!E7.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,X)=>W6.YAMLSeq.from($,Z,X)};y7.seq=b7});var m$=_((h7)=>{var k7=f$(),f7={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,X,z){return Z=Object.assign({actualString:!0},Z),k7.stringifyString($,Z,X,z)}};h7.string=f7});var c1=_((v7)=>{var V6=g(),T6={identify:($)=>$==null,createNode:()=>new V6.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new V6.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&T6.test.test($)?$:Z.options.nullStr};v7.nullTag=T6});var A4=_((d7)=>{var m7=g(),B6={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new m7.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},X){if($&&B6.test.test($)){let z=$[0]==="t"||$[0]==="T";if(Z===z)return $}return Z?X.options.trueStr:X.options.falseStr}};d7.boolTag=B6});var J$=_((c7)=>{function l7({format:$,minFractionDigits:Z,tag:X,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(!$&&Z&&(!X||X==="tag:yaml.org,2002:float")&&/^\d/.test(G)){let J=G.indexOf(".");if(J<0)J=G.length,G+=".";let Q=Z-(G.length-J-1);while(Q-- >0)G+="0"}return G}c7.stringifyNumber=l7});var j4=_((o7)=>{var a7=g(),N4=J$(),n7={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},s7={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 Z=Number($.value);return isFinite(Z)?Z.toExponential():N4.stringifyNumber($)}},r7={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new a7.Scalar(parseFloat($)),X=$.indexOf(".");if(X!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-X-1;return Z},stringify:N4.stringifyNumber};o7.float=r7;o7.floatExp=s7;o7.floatNaN=n7});var C4=_((qq)=>{var K6=J$(),i1=($)=>typeof $==="bigint"||Number.isInteger($),S4=($,Z,X,{intAsBigInt:z})=>z?BigInt($):parseInt($.substring(Z),X);function L6($,Z,X){let{value:z}=$;if(i1(z)&&z>=0)return X+z.toString(Z);return K6.stringifyNumber($)}var Zq={identify:($)=>i1($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,X)=>S4($,2,8,X),stringify:($)=>L6($,8,"0o")},Xq={identify:i1,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,X)=>S4($,0,10,X),stringify:K6.stringifyNumber},zq={identify:($)=>i1($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,X)=>S4($,2,16,X),stringify:($)=>L6($,16,"0x")};qq.int=Xq;qq.intHex=zq;qq.intOct=Zq});var D6=_((Bq)=>{var Yq=q$(),Uq=c1(),Hq=G$(),Wq=m$(),Vq=A4(),E4=j4(),b4=C4(),Tq=[Yq.map,Hq.seq,Wq.string,Uq.nullTag,Vq.boolTag,b4.intOct,b4.int,b4.intHex,E4.floatNaN,E4.floatExp,E4.float];Bq.schema=Tq});var O6=_((wq)=>{var Lq=g(),Dq=q$(),_q=G$();function _6($){return typeof $==="bigint"||Number.isInteger($)}var a1=({value:$})=>JSON.stringify($),Oq=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:a1},{identify:($)=>$==null,createNode:()=>new Lq.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:a1},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:a1},{identify:_6,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:X})=>X?BigInt($):parseInt($,10),stringify:({value:$})=>_6($)?$.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:a1}],Fq={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},Mq=[Dq.map,_q.seq].concat(Oq,Fq);wq.schema=Mq});var x4=_((Aq)=>{var d$=W0("buffer"),y4=g(),Rq=f$(),Iq={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof d$.Buffer==="function")return d$.Buffer.from($,"base64");else if(typeof atob==="function"){let X=atob($.replace(/[\n\r]/g,"")),z=new Uint8Array(X.length);for(let q=0;q<X.length;++q)z[q]=X.charCodeAt(q);return z}else return Z("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:Z,value:X},z,q,G){if(!X)return"";let J=X,Q;if(typeof d$.Buffer==="function")Q=J instanceof d$.Buffer?J.toString("base64"):d$.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(Z??(Z=y4.Scalar.BLOCK_LITERAL),Z!==y4.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(Z===y4.Scalar.BLOCK_LITERAL?`
79
+ `:" ")}return Rq.stringifyString({comment:$,type:Z,value:Q},z,q,G)}};Aq.binary=Iq});var s1=_((Eq)=>{var n1=S(),k4=R0(),jq=g(),Sq=N0();function F6($,Z){if(n1.isSeq($))for(let X=0;X<$.items.length;++X){let z=$.items[X];if(n1.isPair(z))continue;else if(n1.isMap(z)){if(z.items.length>1)Z("Each pair must have its own sequence indicator");let q=z.items[0]||new k4.Pair(new jq.Scalar(null));if(z.commentBefore)q.key.commentBefore=q.key.commentBefore?`${z.commentBefore}
80
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(`
81
+ ${G.comment}`:z.comment}z=q}$.items[X]=n1.isPair(z)?z:new k4.Pair(z)}else Z("Expected a sequence for this tag");return $}function M6($,Z,X){let{replacer:z}=X,q=new Sq.YAMLSeq($);q.tag="tag:yaml.org,2002:pairs";let G=0;if(Z&&Symbol.iterator in Object(Z))for(let J of Z){if(typeof z==="function")J=z.call(Z,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(k4.createPair(Q,Y,X))}return q}var Cq={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:F6,createNode:M6};Eq.createPairs=M6;Eq.pairs=Cq;Eq.resolvePairs=F6});var h4=_((hq)=>{var w6=S(),f4=M0(),p$=A0(),kq=N0(),P6=s1();class u0 extends kq.YAMLSeq{constructor(){super();this.add=p$.YAMLMap.prototype.add.bind(this),this.delete=p$.YAMLMap.prototype.delete.bind(this),this.get=p$.YAMLMap.prototype.get.bind(this),this.has=p$.YAMLMap.prototype.has.bind(this),this.set=p$.YAMLMap.prototype.set.bind(this),this.tag=u0.tag}toJSON($,Z){if(!Z)return super.toJSON($);let X=new Map;if(Z?.onCreate)Z.onCreate(X);for(let z of this.items){let q,G;if(w6.isPair(z))q=f4.toJS(z.key,"",Z),G=f4.toJS(z.value,q,Z);else q=f4.toJS(z,"",Z);if(X.has(q))throw Error("Ordered maps must not include duplicate keys");X.set(q,G)}return X}static from($,Z,X){let z=P6.createPairs($,Z,X),q=new this;return q.items=z.items,q}}u0.tag="tag:yaml.org,2002:omap";var fq={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:u0,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let X=P6.resolvePairs($,Z),z=[];for(let{key:q}of X.items)if(w6.isScalar(q))if(z.includes(q.value))Z(`Ordered maps must not include duplicate keys: ${q.value}`);else z.push(q.value);return Object.assign(new u0,X)},createNode:($,Z,X)=>u0.from($,Z,X)};hq.YAMLOMap=u0;hq.omap=fq});var j6=_((uq)=>{var R6=g();function I6({value:$,source:Z},X){if(Z&&($?A6:N6).test.test(Z))return Z;return $?X.options.trueStr:X.options.falseStr}var A6={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new R6.Scalar(!0),stringify:I6},N6={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new R6.Scalar(!1),stringify:I6};uq.falseTag=N6;uq.trueTag=A6});var S6=_((aq)=>{var pq=g(),g4=J$(),lq={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:g4.stringifyNumber},cq={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 Z=Number($.value);return isFinite(Z)?Z.toExponential():g4.stringifyNumber($)}},iq={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new pq.Scalar(parseFloat($.replace(/_/g,""))),X=$.indexOf(".");if(X!==-1){let z=$.substring(X+1).replace(/_/g,"");if(z[z.length-1]==="0")Z.minFractionDigits=z.length}return Z},stringify:g4.stringifyNumber};aq.float=iq;aq.floatExp=cq;aq.floatNaN=lq});var E6=_((ZG)=>{var C6=J$(),l$=($)=>typeof $==="bigint"||Number.isInteger($);function r1($,Z,X,{intAsBigInt:z}){let q=$[0];if(q==="-"||q==="+")Z+=1;if($=$.substring(Z).replace(/_/g,""),z){switch(X){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let J=BigInt($);return q==="-"?BigInt(-1)*J:J}let G=parseInt($,X);return q==="-"?-1*G:G}function v4($,Z,X){let{value:z}=$;if(l$(z)){let q=z.toString(Z);return z<0?"-"+X+q.substr(1):X+q}return C6.stringifyNumber($)}var oq={identify:l$,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,X)=>r1($,2,2,X),stringify:($)=>v4($,2,"0b")},tq={identify:l$,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,X)=>r1($,1,8,X),stringify:($)=>v4($,8,"0")},eq={identify:l$,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,X)=>r1($,0,10,X),stringify:C6.stringifyNumber},$G={identify:l$,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,X)=>r1($,2,16,X),stringify:($)=>v4($,16,"0x")};ZG.int=eq;ZG.intBin=oq;ZG.intHex=$G;ZG.intOct=tq});var u4=_((QG)=>{var e1=S(),o1=R0(),t1=A0();class m0 extends t1.YAMLMap{constructor($){super($);this.tag=m0.tag}add($){let Z;if(e1.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new o1.Pair($.key,null);else Z=new o1.Pair($,null);if(!t1.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let X=t1.findPair(this.items,$);return!Z&&e1.isPair(X)?e1.isScalar(X.key)?X.key.value:X.key:X}set($,Z){if(typeof Z!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof Z}`);let X=t1.findPair(this.items,$);if(X&&!Z)this.items.splice(this.items.indexOf(X),1);else if(!X&&Z)this.items.push(new o1.Pair($))}toJSON($,Z){return super.toJSON($,Z,Set)}toString($,Z,X){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),Z,X);else throw Error("Set items must all have null values")}static from($,Z,X){let{replacer:z}=X,q=new this($);if(Z&&Symbol.iterator in Object(Z))for(let G of Z){if(typeof z==="function")G=z.call(Z,G,G);q.items.push(o1.createPair(G,null,X))}return q}}m0.tag="tag:yaml.org,2002:set";var JG={collection:"map",identify:($)=>$ instanceof Set,nodeClass:m0,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,X)=>m0.from($,Z,X),resolve($,Z){if(e1.isMap($))if($.hasAllNullValues(!0))return Object.assign(new m0,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};QG.YAMLSet=m0;QG.set=JG});var d4=_((TG)=>{var HG=J$();function m4($,Z){let X=$[0],z=X==="-"||X==="+"?$.substring(1):$,q=(J)=>Z?BigInt(J):Number(J),G=z.replace(/_/g,"").split(":").reduce((J,Q)=>J*q(60)+q(Q),q(0));return X==="-"?q(-1)*G:G}function b6($){let{value:Z}=$,X=(J)=>J;if(typeof Z==="bigint")X=(J)=>BigInt(J);else if(isNaN(Z)||!isFinite(Z))return HG.stringifyNumber($);let z="";if(Z<0)z="-",Z*=X(-1);let q=X(60),G=[Z%q];if(Z<60)G.unshift(0);else if(Z=(Z-G[0])/q,G.unshift(Z%q),Z>=60)Z=(Z-G[0])/q,G.unshift(Z);return z+G.map((J)=>String(J).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var WG={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:($,Z,{intAsBigInt:X})=>m4($,X),stringify:b6},VG={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:($)=>m4($,!1),stringify:b6},y6={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 Z=$.match(y6.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,X,z,q,G,J,Q]=Z.map(Number),Y=Z[7]?Number((Z[7]+"00").substr(1,3)):0,U=Date.UTC(X,z-1,q,G||0,J||0,Q||0,Y),W=Z[8];if(W&&W!=="Z"){let H=m4(W,!1);if(Math.abs(H)<30)H*=60;U-=60000*H}return new Date(U)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};TG.floatTime=VG;TG.intTime=WG;TG.timestamp=y6});var k6=_((NG)=>{var DG=q$(),_G=c1(),OG=G$(),FG=m$(),MG=x4(),x6=j6(),p4=S6(),$2=E6(),wG=h1(),PG=h4(),RG=s1(),IG=u4(),l4=d4(),AG=[DG.map,OG.seq,FG.string,_G.nullTag,x6.trueTag,x6.falseTag,$2.intBin,$2.intOct,$2.int,$2.intHex,p4.floatNaN,p4.floatExp,p4.float,MG.binary,wG.merge,PG.omap,RG.pairs,IG.set,l4.intTime,l4.floatTime,l4.timestamp];NG.schema=AG});var c6=_((fG)=>{var v6=q$(),SG=c1(),u6=G$(),CG=m$(),EG=A4(),c4=j4(),i4=C4(),bG=D6(),yG=O6(),m6=x4(),c$=h1(),d6=h4(),p6=s1(),f6=k6(),l6=u4(),Z2=d4(),h6=new Map([["core",bG.schema],["failsafe",[v6.map,u6.seq,CG.string]],["json",yG.schema],["yaml11",f6.schema],["yaml-1.1",f6.schema]]),g6={binary:m6.binary,bool:EG.boolTag,float:c4.float,floatExp:c4.floatExp,floatNaN:c4.floatNaN,floatTime:Z2.floatTime,int:i4.int,intHex:i4.intHex,intOct:i4.intOct,intTime:Z2.intTime,map:v6.map,merge:c$.merge,null:SG.nullTag,omap:d6.omap,pairs:p6.pairs,seq:u6.seq,set:l6.set,timestamp:Z2.timestamp},xG={"tag:yaml.org,2002:binary":m6.binary,"tag:yaml.org,2002:merge":c$.merge,"tag:yaml.org,2002:omap":d6.omap,"tag:yaml.org,2002:pairs":p6.pairs,"tag:yaml.org,2002:set":l6.set,"tag:yaml.org,2002:timestamp":Z2.timestamp};function kG($,Z,X){let z=h6.get(Z);if(z&&!$)return X&&!z.includes(c$.merge)?z.concat(c$.merge):z.slice();let q=z;if(!q)if(Array.isArray($))q=[];else{let G=Array.from(h6.keys()).filter((J)=>J!=="yaml11").map((J)=>JSON.stringify(J)).join(", ");throw Error(`Unknown schema "${Z}"; 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(X)q=q.concat(c$.merge);return q.reduce((G,J)=>{let Q=typeof J==="string"?g6[J]:J;if(!Q){let Y=JSON.stringify(J),U=Object.keys(g6).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},[])}fG.coreKnownTags=xG;fG.getTags=kG});var s4=_((pG)=>{var a4=S(),vG=q$(),uG=G$(),mG=m$(),X2=c6(),dG=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class n4{constructor({compat:$,customTags:Z,merge:X,resolveKnownTags:z,schema:q,sortMapEntries:G,toStringDefaults:J}){this.compat=Array.isArray($)?X2.getTags($,"compat"):$?X2.getTags(null,$):null,this.name=typeof q==="string"&&q||"core",this.knownTags=z?X2.coreKnownTags:{},this.tags=X2.getTags(Z,this.name,X),this.toStringOptions=J??null,Object.defineProperty(this,a4.MAP,{value:vG.map}),Object.defineProperty(this,a4.SCALAR,{value:mG.string}),Object.defineProperty(this,a4.SEQ,{value:uG.seq}),this.sortMapEntries=typeof G==="function"?G:G===!0?dG:null}clone(){let $=Object.create(n4.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}pG.Schema=n4});var i6=_((aG)=>{var cG=S(),r4=h$(),i$=x$();function iG($,Z){let X=[],z=Z.directives===!0;if(Z.directives!==!1&&$.directives){let Y=$.directives.toString($);if(Y)X.push(Y),z=!0;else if($.directives.docStart)z=!0}if(z)X.push("---");let q=r4.createStringifyContext($,Z),{commentString:G}=q.options;if($.commentBefore){if(X.length!==1)X.unshift("");let Y=G($.commentBefore);X.unshift(i$.indentComment(Y,""))}let J=!1,Q=null;if($.contents){if(cG.isNode($.contents)){if($.contents.spaceBefore&&z)X.push("");if($.contents.commentBefore){let W=G($.contents.commentBefore);X.push(i$.indentComment(W,""))}q.forceBlockIndent=!!$.comment,Q=$.contents.comment}let Y=Q?void 0:()=>J=!0,U=r4.stringify($.contents,q,()=>Q=null,Y);if(Q)U+=i$.lineComment(U,"",G(Q));if((U[0]==="|"||U[0]===">")&&X[X.length-1]==="---")X[X.length-1]=`--- ${U}`;else X.push(U)}else X.push(r4.stringify($.contents,q));if($.directives?.docEnd)if($.comment){let Y=G($.comment);if(Y.includes(`
82
+ `))X.push("..."),X.push(i$.indentComment(Y,""));else X.push(`... ${Y}`)}else X.push("...");else{let Y=$.comment;if(Y&&J)Y=Y.replace(/^\n+/,"");if(Y){if((!J||Q)&&X[X.length-1]!=="")X.push("");X.push(i$.indentComment(G(Y),""))}}return X.join(`
83
83
  `)+`
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+=`:
84
+ `}aG.stringifyDocument=iG});var a$=_((XJ)=>{var sG=b$(),Q$=E1(),t=S(),rG=R0(),oG=M0(),tG=s4(),eG=i6(),o4=j1(),$J=L4(),ZJ=y$(),t4=K4();class e4{constructor($,Z,X){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,t.NODE_TYPE,{value:t.DOC});let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z,Z=void 0;let q=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},X);this.options=q;let{version:G}=q;if(X?._directives){if(this.directives=X._directives.atDocument(),this.directives.yaml.explicit)G=this.directives.yaml.version}else this.directives=new t4.Directives({version:G});this.setSchema(G,X),this.contents=$===void 0?null:this.createNode($,z,X)}clone(){let $=Object.create(e4.prototype,{[t.NODE_TYPE]:{value:t.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=t.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(Y$(this.contents))this.contents.add($)}addIn($,Z){if(Y$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let X=o4.anchorNames(this);$.anchor=!Z||X.has(Z)?o4.findNewAnchor(Z||"a",X):Z}return new sG.Alias($.anchor)}createNode($,Z,X){let z=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),z=Z;else if(Array.isArray(Z)){let T=(D)=>typeof D==="number"||D instanceof String||D instanceof Number,K=Z.filter(T).map(String);if(K.length>0)Z=Z.concat(K);z=Z}else if(X===void 0&&Z)X=Z,Z=void 0;let{aliasDuplicateObjects:q,anchorPrefix:G,flow:J,keepUndefined:Q,onTagObj:Y,tag:U}=X??{},{onAnchor:W,setAnchors:H,sourceObjects:V}=o4.createNodeAnchors(this,G||"a"),B={aliasDuplicateObjects:q??!0,keepUndefined:Q??!1,onAnchor:W,onTagObj:Y,replacer:z,schema:this.schema,sourceObjects:V},L=ZJ.createNode($,U,B);if(J&&t.isCollection(L))L.flow=!0;return H(),L}createPair($,Z,X={}){let z=this.createNode($,null,X),q=this.createNode(Z,null,X);return new rG.Pair(z,q)}delete($){return Y$(this.contents)?this.contents.delete($):!1}deleteIn($){if(Q$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return Y$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return t.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(Q$.isEmptyPath($))return!Z&&t.isScalar(this.contents)?this.contents.value:this.contents;return t.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return t.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(Q$.isEmptyPath($))return this.contents!==void 0;return t.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=Q$.collectionFromPath(this.schema,[$],Z);else if(Y$(this.contents))this.contents.set($,Z)}setIn($,Z){if(Q$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=Q$.collectionFromPath(this.schema,Array.from($),Z);else if(Y$(this.contents))this.contents.setIn($,Z)}setSchema($,Z={}){if(typeof $==="number")$=String($);let X;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new t4.Directives({version:"1.1"});X={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new t4.Directives({version:$});X={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;X=null;break;default:{let z=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${z}`)}}if(Z.schema instanceof Object)this.schema=Z.schema;else if(X)this.schema=new tG.Schema(Object.assign(X,Z));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:Z,mapAsMap:X,maxAliasCount:z,onAnchor:q,reviver:G}={}){let J={anchors:new Map,doc:this,keep:!$,mapAsMap:X===!0,mapKeyWarned:!1,maxAliasCount:typeof z==="number"?z:100},Q=oG.toJS(this.contents,Z??"",J);if(typeof q==="function")for(let{count:Y,res:U}of J.anchors.values())q(U,Y);return typeof G==="function"?$J.applyReviver(G,{"":Q},"",Q):Q}toJSON($,Z){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:Z})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let Z=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${Z}`)}return eG.stringifyDocument(this,$)}}function Y$($){if(t.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}XJ.Document=e4});var n$=_((GJ)=>{class z2 extends Error{constructor($,Z,X,z){super();this.name=$,this.code=X,this.message=z,this.pos=Z}}class a6 extends z2{constructor($,Z,X){super("YAMLParseError",$,Z,X)}}class n6 extends z2{constructor($,Z,X){super("YAMLWarning",$,Z,X)}}var qJ=($,Z)=>(X)=>{if(X.pos[0]===-1)return;X.linePos=X.pos.map((Q)=>Z.linePos(Q));let{line:z,col:q}=X.linePos[0];X.message+=` at line ${z}, column ${q}`;let G=q-1,J=$.substring(Z.lineStarts[z-1],Z.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(Z.lineStarts[z-2],Z.lineStarts[z-1]);if(Q.length>80)Q=Q.substring(0,79)+`\u2026
85
+ `;J=Q+J}if(/[^ ]/.test(J)){let Q=1,Y=X.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);X.message+=`:
86
86
 
87
87
  ${J}
88
88
  ${U}
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=`
89
+ `}};GJ.YAMLError=z2;GJ.YAMLParseError=a6;GJ.YAMLWarning=n6;GJ.prettifyError=qJ});var s$=_((WJ)=>{function HJ($,{flow:Z,indicator:X,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,D=null,O=null,M=null,w=null,I=null;for(let F of $){if(L){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");L=!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(!Z&&(X!=="doc-start"||z?.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 E=F.source.substring(1)||" ";if(!H)H=E;else H+=V+E;V="",U=!1;break}case"newline":if(U){if(H)H+=F.source;else if(!w||X!=="seq-item-ind")Y=!0}else V+=F.source;if(U=!0,B=!0,K||D)O=F;W=!0;break;case"anchor":if(K)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);K=F,I??(I=F.offset),U=!1,W=!1,L=!0;break;case"tag":{if(D)G(F,"MULTIPLE_TAGS","A node can have at most one tag");D=F,I??(I=F.offset),U=!1,W=!1,L=!0;break}case X:if(K||D)G(F,"BAD_PROP_ORDER",`Anchors and tags must be after the ${F.source} indicator`);if(w)G(F,"UNEXPECTED_TOKEN",`Unexpected ${F.source} in ${Z??"collection"}`);w=F,U=X==="seq-item-ind"||X==="explicit-key-ind",W=!1;break;case"comma":if(Z){if(M)G(F,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);M=F,U=!1,W=!1;break}default:G(F,"UNEXPECTED_TOKEN",`Unexpected ${F.type} token`),U=!1,W=!1}}let R=$[$.length-1],C=R?R.offset+R.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:M,found:w,spaceBefore:Y,comment:H,hasNewline:B,anchor:K,tag:D,newlineAfterProp:O,end:C,start:I??C}}WJ.resolveProps=HJ});var q2=_((TJ)=>{function $9($){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 Z of $.end)if(Z.type==="newline")return!0}return!1;case"flow-collection":for(let Z of $.items){for(let X of Z.start)if(X.type==="newline")return!0;if(Z.sep){for(let X of Z.sep)if(X.type==="newline")return!0}if($9(Z.key)||$9(Z.value))return!0}return!1;default:return!0}}TJ.containsNewline=$9});var Z9=_((DJ)=>{var KJ=q2();function LJ($,Z,X){if(Z?.type==="flow-collection"){let z=Z.end[0];if(z.indent===$&&(z.source==="]"||z.source==="}")&&KJ.containsNewline(Z))X(z,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}DJ.flowIndentCheck=LJ});var X9=_((FJ)=>{var s6=S();function OJ($,Z,X){let{uniqueKeys:z}=$.options;if(z===!1)return!1;let q=typeof z==="function"?z:(G,J)=>G===J||s6.isScalar(G)&&s6.isScalar(J)&&G.value===J.value;return Z.some((G)=>q(G.key,X))}FJ.mapIncludes=OJ});var $8=_((AJ)=>{var r6=R0(),wJ=A0(),o6=s$(),PJ=q2(),t6=Z9(),RJ=X9(),e6="All mapping items must start at the same column";function IJ({composeNode:$,composeEmptyNode:Z},X,z,q,G){let Q=new(G?.nodeClass??wJ.YAMLMap)(X.schema);if(X.atRoot)X.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=o6.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",e6)}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||PJ.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",e6);X.atKey=!0;let D=T.end,O=V?$(X,V,T,q):Z(X,D,H,null,T,q);if(X.schema.compat)t6.flowIndentCheck(z.indent,V,q);if(X.atKey=!1,RJ.mapIncludes(X,Q.items,O))q(D,"DUPLICATE_KEY","Map keys must be unique");let M=o6.resolveProps(B??[],{indicator:"map-value-ind",next:L,offset:O.range[2],onError:q,parentIndent:z.indent,startOnNewline:!V||V.type==="block-scalar"});if(Y=M.end,M.found){if(K){if(L?.type==="block-map"&&!M.hasNewline)q(Y,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(X.options.strict&&T.start<M.found.offset-1024)q(O.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let w=L?$(X,L,M,q):Z(X,Y,B,null,M,q);if(X.schema.compat)t6.flowIndentCheck(z.indent,L,q);Y=w.range[2];let I=new r6.Pair(O,w);if(X.options.keepSourceTokens)I.srcToken=W;Q.items.push(I)}else{if(K)q(O.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(M.comment)if(O.comment)O.comment+=`
92
+ `+M.comment;else O.comment=M.comment;let w=new r6.Pair(O);if(X.options.keepSourceTokens)w.srcToken=W;Q.items.push(w)}}if(U&&U<Y)q(U,"IMPOSSIBLE","Map comment with trailing content");return Q.range=[z.offset,Y,U??Y],Q}AJ.resolveBlockMap=IJ});var Z8=_((bJ)=>{var jJ=N0(),SJ=s$(),CJ=Z9();function EJ({composeNode:$,composeEmptyNode:Z},X,z,q,G){let Q=new(G?.nodeClass??jJ.YAMLSeq)(X.schema);if(X.atRoot)X.atRoot=!1;if(X.atKey)X.atKey=!1;let Y=z.offset,U=null;for(let{start:W,value:H}of z.items){let V=SJ.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?$(X,H,V,q):Z(X,V.end,W,null,V,q);if(X.schema.compat)CJ.flowIndentCheck(z.indent,H,q);Y=B.range[2],Q.items.push(B)}return Q.range=[z.offset,Y,U??Y],Q}bJ.resolveBlockSeq=EJ});var U$=_((kJ)=>{function xJ($,Z,X,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(X&&!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`)}Z+=Y.length}}return{comment:q,offset:Z}}kJ.resolveEnd=xJ});var q8=_((lJ)=>{var hJ=S(),gJ=R0(),X8=A0(),vJ=N0(),uJ=U$(),z8=s$(),mJ=q2(),dJ=X9(),z9="Block collections are not allowed within flow collections",q9=($)=>$&&($.type==="block-map"||$.type==="block-seq");function pJ({composeNode:$,composeEmptyNode:Z},X,z,q,G){let J=z.start.source==="{",Q=J?"flow map":"flow sequence",U=new(G?.nodeClass??(J?X8.YAMLMap:vJ.YAMLSeq))(X.schema);U.flow=!0;let W=X.atRoot;if(W)X.atRoot=!1;if(X.atKey)X.atKey=!1;let H=z.offset+z.start.source.length;for(let K=0;K<z.items.length;++K){let D=z.items[K],{start:O,key:M,sep:w,value:I}=D,R=z8.resolveProps(O,{flow:Q,indicator:"explicit-key-ind",next:M??w?.[0],offset:H,onError:q,parentIndent:z.indent,startOnNewline:!1});if(!R.found){if(!R.anchor&&!R.tag&&!w&&!I){if(K===0&&R.comma)q(R.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${Q}`);else if(K<z.items.length-1)q(R.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${Q}`);if(R.comment)if(U.comment)U.comment+=`
93
+ `+R.comment;else U.comment=R.comment;H=R.end;continue}if(!J&&X.options.strict&&mJ.containsNewline(M))q(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(K===0){if(R.comma)q(R.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${Q}`)}else{if(!R.comma)q(R.start,"MISSING_CHAR",`Missing , between ${Q} items`);if(R.comment){let C="";$:for(let F of O)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(hJ.isPair(F))F=F.value??F.key;if(F.comment)F.comment+=`
94
+ `+C;else F.comment=C;R.comment=R.comment.substring(C.length+1)}}}if(!J&&!w&&!R.found){let C=I?$(X,I,R,q):Z(X,R.end,w,null,R,q);if(U.items.push(C),H=C.range[2],q9(I))q(C.range,"BLOCK_IN_FLOW",z9)}else{X.atKey=!0;let C=R.end,F=M?$(X,M,R,q):Z(X,C,O,null,R,q);if(q9(M))q(F.range,"BLOCK_IN_FLOW",z9);X.atKey=!1;let E=z8.resolveProps(w??[],{flow:Q,indicator:"map-value-ind",next:I,offset:F.range[2],onError:q,parentIndent:z.indent,startOnNewline:!1});if(E.found){if(!J&&!R.found&&X.options.strict){if(w)for(let b of w){if(b===E.found)break;if(b.type==="newline"){q(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(R.start<E.found.offset-1024)q(E.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(I)if("source"in I&&I.source?.[0]===":")q(I,"MISSING_CHAR",`Missing space after : in ${Q}`);else q(E.start,"MISSING_CHAR",`Missing , or : between ${Q} items`);let i=I?$(X,I,E,q):E.found?Z(X,E.end,w,null,E,q):null;if(i){if(q9(I))q(i.range,"BLOCK_IN_FLOW",z9)}else if(E.comment)if(F.comment)F.comment+=`
95
+ `+E.comment;else F.comment=E.comment;let a=new gJ.Pair(F,i);if(X.options.keepSourceTokens)a.srcToken=D;if(J){let b=U;if(dJ.mapIncludes(X,b.items,F))q(C,"DUPLICATE_KEY","Map keys must be unique");b.items.push(a)}else{let b=new X8.YAMLMap(X.schema);b.flow=!0,b.items.push(a);let h=(i??F).range;b.range=[F.range[0],h[1],h[2]],U.items.push(b)}H=i?i.range[2]:E.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),D=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",D),B&&B.source.length!==1)L.unshift(B)}if(L.length>0){let K=uJ.resolveEnd(L,T,X.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}lJ.resolveFlowCollection=pJ});var G8=_(($Q)=>{var iJ=S(),aJ=g(),nJ=A0(),sJ=N0(),rJ=$8(),oJ=Z8(),tJ=q8();function G9($,Z,X,z,q,G){let J=X.type==="block-map"?rJ.resolveBlockMap($,Z,X,z,G):X.type==="block-seq"?oJ.resolveBlockSeq($,Z,X,z,G):tJ.resolveFlowCollection($,Z,X,z,G),Q=J.constructor;if(q==="!"||q===Q.tagName)return J.tag=Q.tagName,J;if(q)J.tag=q;return J}function eJ($,Z,X,z,q){let G=z.tag,J=!G?null:Z.directives.tagName(G.source,(V)=>q(G,"TAG_RESOLVE_FAILED",V));if(X.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=X.type==="block-map"?"map":X.type==="block-seq"?"seq":X.start.source==="{"?"map":"seq";if(!G||!J||J==="!"||J===nJ.YAMLMap.tagName&&Q==="map"||J===sJ.YAMLSeq.tagName&&Q==="seq")return G9($,Z,X,q,J);let Y=Z.schema.tags.find((V)=>V.tag===J&&V.collection===Q);if(!Y){let V=Z.schema.knownTags[J];if(V?.collection===Q)Z.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 G9($,Z,X,q,J)}}let U=G9($,Z,X,q,J,Y),W=Y.resolve?.(U,(V)=>q(G,"TAG_RESOLVE_FAILED",V),Z.options)??U,H=iJ.isNode(W)?W:new aJ.Scalar(W);if(H.range=U.range,H.tag=J,Y?.format)H.format=Y.format;return H}$Q.composeCollection=eJ});var Q9=_((GQ)=>{var J9=g();function XQ($,Z,X){let z=Z.offset,q=zQ(Z,$.options.strict,X);if(!q)return{value:"",type:null,comment:"",range:[z,z,z]};let G=q.mode===">"?J9.Scalar.BLOCK_FOLDED:J9.Scalar.BLOCK_LITERAL,J=Z.source?qQ(Z.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(Z.source)K+=Z.source.length;return{value:T,type:G,comment:q.comment,range:[z,K,K]}}let Y=Z.indent+q.indent,U=Z.offset+q.length,W=0;for(let T=0;T<Q;++T){let[K,D]=J[T];if(D===""||D==="\r"){if(q.indent===0&&K.length>Y)Y=K.length}else{if(K.length<Y)X(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)X(U,"BAD_INDENT","Block scalar values in collections must be indented");break}U+=K.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="",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,D]=J[T];U+=K.length+D.length+1;let O=D[D.length-1]==="\r";if(O)D=D.slice(0,-1);if(D&&K.length<Y){let w=`Block scalar lines must not be less indented than their ${q.indent?"explicit indentation indicator":"first line"}`;X(U-D.length-(O?2:1),"BAD_INDENT",w),K=""}if(G===J9.Scalar.BLOCK_LITERAL)H+=V+K.slice(Y)+D,V=`
99
+ `;else if(K.length>Y||D[0]==="\t"){if(V===" ")V=`
100
100
  `;else if(!B&&V===`
101
101
  `)V=`
102
102
 
103
- `;H+=V+K.slice(Y)+_,V=`
104
- `,B=!0}else if(_==="")if(V===`
103
+ `;H+=V+K.slice(Y)+D,V=`
104
+ `,B=!0}else if(D==="")if(V===`
105
105
  `)H+=`
106
106
  `;else V=`
107
- `;else H+=V+_,V=" ",B=!1}switch(q.chomp){case"-":break;case"+":for(let T=Q;T<J.length;++T)H+=`
107
+ `;else H+=V+D,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 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
- `,"sy"),Z=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
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===`
111
+ `}let L=z+q.length+Z.source.length;return{value:H,type:G,comment:q.comment,range:[z,L,L]}}function zQ({offset:$,props:Z},X,z){if(Z[0].type!=="block-scalar-header")return z(Z[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:q}=Z[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<Z.length;++V){let B=Z[V];switch(B.type){case"space":U=!0;case"newline":H+=B.source.length;break;case"comment":if(X&&!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 qQ($){let Z=$.split(/\n( *)/),X=Z[0],z=X.match(/^( *)/),G=[z?.[1]?[z[1],X.slice(z[1].length)]:["",X]];for(let J=1;J<Z.length;J+=2)G.push([Z[J],Z[J+1]]);return G}GQ.resolveBlockScalar=XQ});var U9=_((KQ)=>{var Y9=g(),QQ=U$();function YQ($,Z,X){let{offset:z,type:q,source:G,end:J}=$,Q,Y,U=(V,B,L)=>X(z+V,B,L);switch(q){case"scalar":Q=Y9.Scalar.PLAIN,Y=UQ(G,U);break;case"single-quoted-scalar":Q=Y9.Scalar.QUOTE_SINGLE,Y=HQ(G,U);break;case"double-quoted-scalar":Q=Y9.Scalar.QUOTE_DOUBLE,Y=WQ(G,U);break;default:return X($,"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=QQ.resolveEnd(J,W,Z,X);return{value:Y,type:Q,comment:H.comment,range:[z,W,H.offset]}}function UQ($,Z){let X="";switch($[0]){case"\t":X="a tab character";break;case",":X="flow indicator character ,";break;case"%":X="directive indicator character %";break;case"|":case">":{X=`block scalar indicator ${$[0]}`;break}case"@":case"`":{X=`reserved character ${$[0]}`;break}}if(X)Z(0,"BAD_SCALAR_START",`Plain value cannot start with ${X}`);return J8($)}function HQ($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return J8($.slice(1,-1)).replace(/''/g,"'")}function J8($){let Z,X;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
112
+ `,"sy"),X=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
113
+ `,"sy")}catch{Z=/(.*?)[ \t]*\r?\n/sy,X=/[ \t]*(.*?)[ \t]*\r?\n/sy}let z=Z.exec($);if(!z)return $;let q=z[1],G=" ",J=Z.lastIndex;X.lastIndex=J;while(z=X.exec($)){if(z[1]==="")if(G===`
114
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]===`
115
+ `;else q+=G+z[1],G=" ";J=X.lastIndex}let Q=/[ \t]*(.*)/sy;return Q.lastIndex=J,z=Q.exec($),q+G+(z?.[1]??"")}function WQ($,Z){let X="";for(let z=1;z<$.length-1;++z){let q=$[z];if(q==="\r"&&$[z+1]===`
116
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===`
117
+ `){let{fold:G,offset:J}=VQ($,z);X+=G,z=J}else if(q==="\\"){let G=$[++z],J=TQ[G];if(J)X+=J;else if(G===`
118
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!==`
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];X+=BQ($,z+1,Q,Z),z+=Q}else{let Q=$.substr(z-1,2);Z(z-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${Q}`),X+=Q}}else if(q===" "||q==="\t"){let G=z,J=$[z+1];while(J===" "||J==="\t")J=$[++z+1];if(J!==`
120
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]!==`
121
+ `))X+=z>G?$.slice(G,z+1):q}else X+=q}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return X}function VQ($,Z){let X="",z=$[Z+1];while(z===" "||z==="\t"||z===`
122
+ `||z==="\r"){if(z==="\r"&&$[Z+2]!==`
123
123
  `)break;if(z===`
124
- `)Z+=`
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?`
124
+ `)X+=`
125
+ `;Z+=1,z=$[Z+1]}if(!X)X=" ";return{fold:X,offset:Z}}var TQ={"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 BQ($,Z,X,z){let q=$.substr(Z,X),J=q.length===X&&/^[0-9a-fA-F]+$/.test(q)?parseInt(q,16):NaN;if(isNaN(J)){let Q=$.substr(Z-2,X+2);return z(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${Q}`),Q}return String.fromCodePoint(J)}KQ.resolveFlowScalar=YQ});var Y8=_((wQ)=>{var d0=S(),Q8=g(),DQ=Q9(),_Q=U9();function OQ($,Z,X,z){let{value:q,type:G,comment:J,range:Q}=Z.type==="block-scalar"?DQ.resolveBlockScalar($,Z,z):_Q.resolveFlowScalar(Z,$.options.strict,z),Y=X?$.directives.tagName(X.source,(H)=>z(X,"TAG_RESOLVE_FAILED",H)):null,U;if($.options.stringKeys&&$.atKey)U=$.schema[d0.SCALAR];else if(Y)U=FQ($.schema,q,Y,X,z);else if(Z.type==="scalar")U=MQ($,q,Z,z);else U=$.schema[d0.SCALAR];let W;try{let H=U.resolve(q,(V)=>z(X??Z,"TAG_RESOLVE_FAILED",V),$.options);W=d0.isScalar(H)?H:new Q8.Scalar(H)}catch(H){let V=H instanceof Error?H.message:String(H);z(X??Z,"TAG_RESOLVE_FAILED",V),W=new Q8.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 FQ($,Z,X,z,q){if(X==="!")return $[d0.SCALAR];let G=[];for(let Q of $.tags)if(!Q.collection&&Q.tag===X)if(Q.default&&Q.test)G.push(Q);else return Q;for(let Q of G)if(Q.test?.test(Z))return Q;let J=$.knownTags[X];if(J&&!J.collection)return $.tags.push(Object.assign({},J,{default:!1,test:void 0})),J;return q(z,"TAG_RESOLVE_FAILED",`Unresolved tag: ${X}`,X!=="tag:yaml.org,2002:str"),$[d0.SCALAR]}function MQ({atKey:$,directives:Z,schema:X},z,q,G){let J=X.tags.find((Q)=>(Q.default===!0||$&&Q.default==="key")&&Q.test?.test(z))||X[d0.SCALAR];if(X.compat){let Q=X.compat.find((Y)=>Y.default&&Y.test?.test(z))??X[d0.SCALAR];if(J.tag!==Q.tag){let Y=Z.tagString(J.tag),U=Z.tagString(Q.tag),W=`Value may be parsed as either ${Y} or ${U}`;G(q,"TAG_RESOLVE_FAILED",W,!0)}}return J}wQ.composeScalar=OQ});var U8=_((IQ)=>{function RQ($,Z,X){if(Z){X??(X=Z.length);for(let z=X-1;z>=0;--z){let q=Z[z];switch(q.type){case"space":case"comment":case"newline":$-=q.source.length;continue}q=Z[++z];while(q?.type==="space")$+=q.source.length,q=Z[++z];break}}return $}IQ.emptyScalarPosition=RQ});var V8=_((xQ)=>{var NQ=b$(),jQ=S(),SQ=G8(),H8=Y8(),CQ=U$(),EQ=U8(),bQ={composeNode:W8,composeEmptyNode:H9};function W8($,Z,X,z){let q=$.atKey,{spaceBefore:G,comment:J,anchor:Q,tag:Y}=X,U,W=!0;switch(Z.type){case"alias":if(U=yQ($,Z,z),Q||Y)z(Z,"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=H8.composeScalar($,Z,Y,z),Q)U.anchor=Q.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":if(U=SQ.composeCollection(bQ,$,Z,X,z),Q)U.anchor=Q.source.substring(1);break;default:{let H=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;z(Z,"UNEXPECTED_TOKEN",H),U=H9($,Z.offset,void 0,null,X,z),W=!1}}if(Q&&U.anchor==="")z(Q,"BAD_ALIAS","Anchor cannot be an empty string");if(q&&$.options.stringKeys&&(!jQ.isScalar(U)||typeof U.value!=="string"||U.tag&&U.tag!=="tag:yaml.org,2002:str"))z(Y??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(G)U.spaceBefore=!0;if(J)if(Z.type==="scalar"&&Z.source==="")U.comment=J;else U.commentBefore=J;if($.options.keepSourceTokens&&W)U.srcToken=Z;return U}function H9($,Z,X,z,{spaceBefore:q,comment:G,anchor:J,tag:Q,end:Y},U){let W={type:"scalar",offset:EQ.emptyScalarPosition(Z,X,z),indent:-1,source:""},H=H8.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 yQ({options:$},{offset:Z,source:X,end:z},q){let G=new NQ.Alias(X.substring(1));if(G.source==="")q(Z,"BAD_ALIAS","Alias cannot be an empty string");if(G.source.endsWith(":"))q(Z+X.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let J=Z+X.length,Q=CQ.resolveEnd(z,J,$.strict,q);if(G.range=[Z,J,Q.offset],Q.comment)G.comment=Q.comment;return G}xQ.composeEmptyNode=H9;xQ.composeNode=W8});var B8=_((mQ)=>{var hQ=a$(),T8=V8(),gQ=U$(),vQ=s$();function uQ($,Z,{offset:X,start:z,value:q,end:G},J){let Q=Object.assign({_directives:Z},$),Y=new hQ.Document(void 0,Q),U={atKey:!1,atRoot:!0,directives:Y.directives,options:Y.options,schema:Y.schema},W=vQ.resolveProps(z,{indicator:"doc-start",next:q??G?.[0],offset:X,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?T8.composeNode(U,q,W,J):T8.composeEmptyNode(U,W.end,z,null,W,J);let H=Y.contents.range[2],V=gQ.resolveEnd(G,H,!1,J);if(V.comment)Y.comment=V.comment;return Y.range=[X,H,V.offset],Y}mQ.composeDoc=uQ});var W9=_((nQ)=>{var pQ=W0("process"),lQ=K4(),cQ=a$(),r$=n$(),K8=S(),iQ=B8(),aQ=U$();function o$($){if(typeof $==="number")return[$,$+1];if(Array.isArray($))return $.length===2?$:[$[0],$[1]];let{offset:Z,source:X}=$;return[Z,Z+(typeof X==="string"?X.length:1)]}function L8($){let Z="",X=!1,z=!1;for(let q=0;q<$.length;++q){let G=$[q];switch(G[0]){case"#":Z+=(Z===""?"":z?`
127
127
 
128
128
  `:`
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:`
129
+ `)+(G.substring(1)||" "),X=!0,z=!1;break;case"%":if($[q+1]?.[0]!=="#")q+=1;X=!1;break;default:if(!X)z=!0;X=!1}}return{comment:Z,afterEmptyLine:z}}class D8{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,X,z,q)=>{let G=o$(Z);if(q)this.warnings.push(new r$.YAMLWarning(G,X,z));else this.errors.push(new r$.YAMLParseError(G,X,z))},this.directives=new lQ.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:X,afterEmptyLine:z}=L8(this.prelude);if(X){let q=$.contents;if(Z)$.comment=$.comment?`${$.comment}
130
+ ${X}`:X;else if(z||$.directives.docStart||!q)$.commentBefore=X;else if(K8.isCollection(q)&&!q.flow&&q.items.length>0){let G=q.items[0];if(K8.isPair(G))G=G.key;let J=G.commentBefore;G.commentBefore=J?`${X}
131
+ ${J}`:X}else{let G=q.commentBefore;q.commentBefore=G?`${X}
132
+ ${G}`:X}}if(Z)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:L8(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose($,Z=!1,X=-1){for(let z of $)yield*this.next(z);yield*this.end(Z,X)}*next($){if(pQ.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,X,z)=>{let q=o$($);q[0]+=Z,this.onError(q,"BAD_DIRECTIVE",X,z)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=iQ.composeDoc(this.options,this.directives,$,this.onError);if(this.atDirectives&&!Z.directives.docStart)this.onError($,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(Z,!1),this.doc)yield this.doc;this.doc=Z,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push($.source);break;case"error":{let Z=$.source?`${$.message}: ${JSON.stringify($.source)}`:$.message,X=new r$.YAMLParseError(o$($),"UNEXPECTED_TOKEN",Z);if(this.atDirectives||!this.doc)this.errors.push(X);else this.doc.errors.push(X);break}case"doc-end":{if(!this.doc){this.errors.push(new r$.YAMLParseError(o$($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=aQ.resolveEnd($.end,$.offset+$.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),Z.comment){let X=this.doc.comment;this.doc.comment=X?`${X}
133
+ ${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new r$.YAMLParseError(o$($),"UNEXPECTED_TOKEN",`Unsupported token ${$.type}`))}}*end($=!1,Z=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if($){let X=Object.assign({_directives:this.directives},this.options),z=new cQ.Document(void 0,X);if(this.atDirectives)this.onError(Z,"MISSING_CHAR","Missing directives-end indicator line");z.range=[0,Z,Z],this.decorate(z,!1),yield z}}}nQ.Composer=D8});var F8=_((zY)=>{var rQ=Q9(),oQ=U9(),tQ=n$(),_8=f$();function eQ($,Z=!0,X){if($){let z=(q,G,J)=>{let Q=typeof q==="number"?q:Array.isArray(q)?q[0]:q.offset;if(X)X(Q,G,J);else throw new tQ.YAMLParseError([Q,Q+1],G,J)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return oQ.resolveFlowScalar($,Z,z);case"block-scalar":return rQ.resolveBlockScalar({options:{strict:Z}},$,z)}}return null}function $Y($,Z){let{implicitKey:X=!1,indent:z,inFlow:q=!1,offset:G=-1,type:J="PLAIN"}=Z,Q=_8.stringifyString({type:J,value:$},{implicitKey:X,indent:z>0?" ".repeat(z):"",inFlow:q,options:{blockQuote:!0,lineWidth:-1}}),Y=Z.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: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`
136
+ `,V=[{type:"block-scalar-header",offset:G,indent:z,source:W}];if(!O8(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 ZY($,Z,X={}){let{afterKey:z=!1,implicitKey:q=!1,inFlow:G=!1,type:J}=X,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=_8.stringifyString({type:J,value:Z},{implicitKey:q||Q===null,indent:Q!==null&&Q>0?" ".repeat(Q):"",inFlow:G,options:{blockQuote:!0,lineWidth:-1}});switch(Y[0]){case"|":case">":XY($,Y);break;case'"':V9($,Y,"double-quoted-scalar");break;case"'":V9($,Y,"single-quoted-scalar");break;default:V9($,Y,"scalar")}}function XY($,Z){let X=Z.indexOf(`
138
+ `),z=Z.substring(0,X),q=Z.substring(X+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(!O8(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 O8($,Z){if(Z)for(let X of Z)switch(X.type){case"space":case"comment":$.push(X);break;case"newline":return $.push(X),!0}return!1}function V9($,Z,X){switch($.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":$.type=X,$.source=Z;break;case"block-scalar":{let z=$.props.slice(1),q=Z.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:X,source:Z,end:z});break}case"block-map":case"block-seq":{let q={type:"newline",offset:$.offset+Z.length,indent:$.indent,source:`
141
+ `};delete $.items,Object.assign($,{type:X,source:Z,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:X,indent:z,source:Z,end:q})}}}zY.createScalarToken=$Y;zY.resolveAsScalar=eQ;zY.setScalarValue=ZY});var M8=_((YY)=>{var QY=($)=>("type"in $)?J2($):G2($);function J2($){switch($.type){case"block-scalar":{let Z="";for(let X of $.props)Z+=J2(X);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let X of $.items)Z+=G2(X);return Z}case"flow-collection":{let Z=$.start.source;for(let X of $.items)Z+=G2(X);for(let X of $.end)Z+=X.source;return Z}case"document":{let Z=G2($);if($.end)for(let X of $.end)Z+=X.source;return Z}default:{let Z=$.source;if("end"in $&&$.end)for(let X of $.end)Z+=X.source;return Z}}}function G2({start:$,key:Z,sep:X,value:z}){let q="";for(let G of $)q+=G.source;if(Z)q+=J2(Z);if(X)for(let G of X)q+=G.source;if(z)q+=J2(z);return q}YY.stringify=QY});var R8=_((WY)=>{var T9=Symbol("break visit"),HY=Symbol("skip children"),w8=Symbol("remove item");function p0($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};P8(Object.freeze([]),$,Z)}p0.BREAK=T9;p0.SKIP=HY;p0.REMOVE=w8;p0.itemAtPath=($,Z)=>{let X=$;for(let[z,q]of Z){let G=X?.[z];if(G&&"items"in G)X=G.items[q];else return}return X};p0.parentCollection=($,Z)=>{let X=p0.itemAtPath($,Z.slice(0,-1)),z=Z[Z.length-1][0],q=X?.[z];if(q&&"items"in q)return q;throw Error("Parent collection not found")};function P8($,Z,X){let z=X(Z,$);if(typeof z==="symbol")return z;for(let q of["key","value"]){let G=Z[q];if(G&&"items"in G){for(let J=0;J<G.items.length;++J){let Q=P8(Object.freeze($.concat([[q,J]])),G.items[J],X);if(typeof Q==="number")J=Q-1;else if(Q===T9)return T9;else if(Q===w8)G.items.splice(J,1),J-=1}if(typeof z==="function"&&q==="key")z=z(Z,$)}}return typeof z==="function"?z(Z,$):z}WY.visit=p0});var Q2=_((OY)=>{var B9=F8(),TY=M8(),BY=R8(),K9="\uFEFF",L9="\x02",D9="\x18",_9="\x1F",KY=($)=>!!$&&("items"in $),LY=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function DY($){switch($){case K9:return"<BOM>";case L9:return"<DOC>";case D9:return"<FLOW_END>";case _9:return"<SCALAR>";default:return JSON.stringify($)}}function _Y($){switch($){case K9:return"byte-order-mark";case L9:return"doc-mode";case D9:return"flow-error-end";case _9: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}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
- `)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 z=this.buffer[Z+$+1];if(z===`
148
- `||!z&&!this.atEnd)return $+Z+1}return X===`
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 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($===`
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}OY.createScalarToken=B9.createScalarToken;OY.resolveAsScalar=B9.resolveAsScalar;OY.setScalarValue=B9.setScalarValue;OY.stringify=TY.stringify;OY.visit=BY.visit;OY.BOM=K9;OY.DOCUMENT=L9;OY.FLOW_END=D9;OY.SCALAR=_9;OY.isCollection=KY;OY.isScalar=LY;OY.prettyToken=DY;OY.tokenType=_Y});var F9=_((kY)=>{var t$=Q2();function q0($){switch($){case void 0:case" ":case`
144
+ `:case"\r":case"\t":return!0;default:return!1}}var I8=new Set("0123456789ABCDEFabcdef"),yY=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Y2=new Set(",[]{}"),xY=new Set(` ,[]{}
145
+ \r `),O9=($)=>!$||xY.has($);class A8{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($,Z=!1){if($){if(typeof $!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+$:$,this.lineEndPos=null}this.atEnd=!Z;let X=this.next??"stream";while(X&&(Z||this.hasChars(1)))X=yield*this.parseNext(X)}atLineEnd(){let $=this.pos,Z=this.buffer[$];while(Z===" "||Z==="\t")Z=this.buffer[++$];if(!Z||Z==="#"||Z===`
146
+ `)return!0;if(Z==="\r")return this.buffer[$+1]===`
147
+ `;return!1}charAt($){return this.buffer[this.pos+$]}continueScalar($){let Z=this.buffer[$];if(this.indentNext>0){let X=0;while(Z===" ")Z=this.buffer[++X+$];if(Z==="\r"){let z=this.buffer[X+$+1];if(z===`
148
+ `||!z&&!this.atEnd)return $+X+1}return Z===`
149
+ `||X>=this.indentNext||!Z&&!this.atEnd?$+X:-1}if(Z==="-"||Z==="."){let X=this.buffer.substr($,3);if((X==="---"||X==="...")&&q0(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]===t$.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let Z=$.length,X=$.indexOf("#");while(X!==-1){let q=$[X-1];if(q===" "||q==="\t"){Z=X-1;break}else X=$.indexOf("#",X+1)}while(!0){let q=$[Z-1];if(q===" "||q==="\t")Z-=1;else break}let z=(yield*this.pushCount(Z))+(yield*this.pushSpaces(!0));return yield*this.pushCount($.length-z),this.pushNewline(),"stream"}if(this.atLineEnd()){let Z=yield*this.pushSpaces(!0);return yield*this.pushCount($.length-Z),yield*this.pushNewline(),"stream"}return yield t$.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 Z=this.peek(3);if((Z==="---"||Z==="...")&&q0(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,Z==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!q0(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[$,Z]=this.peek(2);if(!Z&&!this.atEnd)return this.setNext("block-start");if(($==="-"||$==="?"||$===":")&&q0(Z)){let X=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=X,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let $=this.getLine();if($===null)return this.setNext("doc");let Z=yield*this.pushIndicators();switch($[Z]){case"#":yield*this.pushCount($.length-Z);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(O9),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return Z+=yield*this.parseBlockScalarHeader(),Z+=yield*this.pushSpaces(!0),yield*this.pushCount($.length-Z),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let $,Z,X=-1;do{if($=yield*this.pushNewline(),$>0)Z=yield*this.pushSpaces(!1),this.indentValue=X=Z;else Z=0;Z+=yield*this.pushSpaces(!0)}while($+Z>0);let z=this.getLine();if(z===null)return this.setNext("flow");if(X!==-1&&X<this.indentNext&&z[0]!=="#"||X===0&&(z.startsWith("---")||z.startsWith("..."))&&q0(z[3])){if(!(X===this.indentNext-1&&this.flowLevel===1&&(z[0]==="]"||z[0]==="}")))return this.flowLevel=0,yield t$.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(O9),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let G=this.charAt(1);if(this.flowKey||q0(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),Z=this.buffer.indexOf($,this.pos+1);if($==="'")while(Z!==-1&&this.buffer[Z+1]==="'")Z=this.buffer.indexOf("'",Z+2);else while(Z!==-1){let q=0;while(this.buffer[Z-1-q]==="\\")q+=1;if(q%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let X=this.buffer.substring(0,Z),z=X.indexOf(`
151
+ `,this.pos);if(z!==-1){while(z!==-1){let q=this.continueScalar(z+1);if(q===-1)break;z=X.indexOf(`
152
+ `,q)}if(z!==-1)Z=z-(X[z-1]==="\r"?2:1)}if(Z===-1){if(!this.atEnd)return this.setNext("quoted-scalar");Z=this.buffer.length}return yield*this.pushToIndex(Z+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let $=this.pos;while(!0){let Z=this.buffer[++$];if(Z==="+")this.blockScalarKeep=!0;else if(Z>"0"&&Z<="9")this.blockScalarIndent=Number(Z)-1;else if(Z!=="-")break}return yield*this.pushUntil((Z)=>q0(Z)||Z==="#")}*parseBlockScalar(){let $=this.pos-1,Z=0,X;$:for(let q=this.pos;X=this.buffer[q];++q)switch(X){case" ":Z+=1;break;case`
153
+ `:$=q,Z=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(!X&&!this.atEnd)return this.setNext("block-scalar");if(Z>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=Z;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;X=this.buffer[z];while(X===" ")X=this.buffer[++z];if(X==="\t"){while(X==="\t"||X===" "||X==="\r"||X===`
156
+ `)X=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+Z>J)$=q;else break}while(!0);return yield t$.SCALAR,yield*this.pushToIndex($+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let $=this.flowLevel>0,Z=this.pos-1,X=this.pos-1,z;while(z=this.buffer[++X])if(z===":"){let q=this.buffer[X+1];if(q0(q)||$&&Y2.has(q))break;Z=X}else if(q0(z)){let q=this.buffer[X+1];if(z==="\r")if(q===`
158
+ `)X+=1,z=`
159
+ `,q=this.buffer[X+1];else Z=X;if(q==="#"||$&&Y2.has(q))break;if(z===`
160
+ `){let G=this.continueScalar(X+1);if(G===-1)break;X=Math.max(X,G-2)}}else{if($&&Y2.has(z))break;Z=X}if(!z&&!this.atEnd)return this.setNext("plain-scalar");return yield t$.SCALAR,yield*this.pushToIndex(Z+1,!0),$?"flow":"doc"}*pushCount($){if($>0)return yield this.buffer.substr(this.pos,$),this.pos+=$,$;return 0}*pushToIndex($,Z){let X=this.buffer.slice(this.pos,$);if(X)return yield X,this.pos+=X.length,X.length;else if(Z)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(O9))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let $=this.flowLevel>0,Z=this.charAt(1);if(q0(Z)||$&&Y2.has(Z)){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,Z=this.buffer[$];while(!q0(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(yY.has(Z))Z=this.buffer[++$];else if(Z==="%"&&I8.has(this.buffer[$+1])&&I8.has(this.buffer[$+2]))Z=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 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
- `)+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 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
- `)+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=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
- `),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).
162
+ `)return yield*this.pushCount(2);else return 0}*pushSpaces($){let Z=this.pos-1,X;do X=this.buffer[++Z];while(X===" "||$&&X==="\t");let z=Z-this.pos;if(z>0)yield this.buffer.substr(this.pos,z),this.pos=Z;return z}*pushUntil($){let Z=this.pos,X=this.buffer[Z];while(!$(X))X=this.buffer[++Z];return yield*this.pushToIndex(Z,!1)}}kY.Lexer=A8});var M9=_((hY)=>{class N8{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let Z=0,X=this.lineStarts.length;while(Z<X){let q=Z+X>>1;if(this.lineStarts[q]<$)Z=q+1;else X=q}if(this.lineStarts[Z]===$)return{line:Z+1,col:1};if(Z===0)return{line:0,col:$};let z=this.lineStarts[Z-1];return{line:Z,col:$-z+1}}}}hY.LineCounter=N8});var w9=_((mY)=>{var vY=W0("process"),j8=Q2(),uY=F9();function j0($,Z){for(let X=0;X<$.length;++X)if($[X].type===Z)return!0;return!1}function S8($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function E8($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function U2($){switch($.type){case"document":return $.start;case"block-map":{let Z=$.items[$.items.length-1];return Z.sep??Z.start}case"block-seq":return $.items[$.items.length-1].start;default:return[]}}function H$($){if($.length===0)return[];let Z=$.length;$:while(--Z>=0)switch($[Z].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break $}while($[++Z]?.type==="space");return $.splice(Z,$.length)}function C8($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!j0(Z.start,"explicit-key-ind")&&!j0(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,E8(Z.value))if(Z.value.end)Array.prototype.push.apply(Z.value.end,Z.sep);else Z.value.end=Z.sep;else Array.prototype.push.apply(Z.start,Z.sep);delete Z.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 uY.Lexer,this.onNewLine=$}*parse($,Z=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let X of this.lexer.lex($,Z))yield*this.next(X);if(!Z)yield*this.end()}*next($){if(this.source=$,vY.env.LOG_TOKENS)console.log("|",j8.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=j8.tokenType($);if(!Z){let X=`Not a YAML token: ${$}`;yield*this.pop({type:"error",offset:this.offset,message:X,source:$}),this.offset+=$.length}else if(Z==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=Z,yield*this.step(),Z){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 Z=$??this.stack.pop();if(!Z)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield Z;else{let X=this.peek(1);if(Z.type==="block-scalar")Z.indent="indent"in X?X.indent:0;else if(Z.type==="flow-collection"&&X.type==="document")Z.indent=0;if(Z.type==="flow-collection")C8(Z);switch(X.type){case"document":X.value=Z;break;case"block-scalar":X.props.push(Z);break;case"block-map":{let z=X.items[X.items.length-1];if(z.value){X.items.push({start:[],key:Z,sep:[]}),this.onKeyLine=!0;return}else if(z.sep)z.value=Z;else{Object.assign(z,{key:Z,sep:[]}),this.onKeyLine=!z.explicitKey;return}break}case"block-seq":{let z=X.items[X.items.length-1];if(z.value)X.items.push({start:[],value:Z});else z.value=Z;break}case"flow-collection":{let z=X.items[X.items.length-1];if(!z||z.value)X.items.push({start:[],key:Z,sep:[]});else if(z.sep)z.value=Z;else Object.assign(z,{key:Z,sep:[]});return}default:yield*this.pop(),yield*this.pop(Z)}if((X.type==="document"||X.type==="block-map"||X.type==="block-seq")&&(Z.type==="block-map"||Z.type==="block-seq")){let z=Z.items[Z.items.length-1];if(z&&!z.sep&&!z.value&&z.start.length>0&&S8(z.start)===-1&&(Z.indent===0||z.start.every((q)=>q.type!=="comment"||q.indent<Z.indent))){if(X.type==="document")X.end=z.start;else X.items.push({start:z.start});Z.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(S8($.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 Z=this.startBlockValue($);if(Z)this.stack.push(Z);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 Z=U2(this.peek(2)),X=H$(Z),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:X,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 Z=this.source.indexOf(`
163
+ `)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
164
+ `,Z)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){Array.prototype.push.apply(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return}if(this.indent>=$.indent){let X=!this.onKeyLine&&this.indent===$.indent,z=X&&(Z.sep||Z.explicitKey)&&this.type!=="seq-item-ind",q=[];if(z&&Z.sep&&!Z.value){let G=[];for(let J=0;J<Z.sep.length;++J){let Q=Z.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=Z.sep.splice(G[1])}switch(this.type){case"anchor":case"tag":if(z||Z.value)q.push(this.sourceToken),$.items.push({start:q}),this.onKeyLine=!0;else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"explicit-key-ind":if(!Z.sep&&!Z.explicitKey)Z.start.push(this.sourceToken),Z.explicitKey=!0;else if(z||Z.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(Z.explicitKey)if(!Z.sep)if(j0(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let G=H$(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:G,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(j0(Z.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(E8(Z.key)&&!j0(Z.sep,"newline")){let G=H$(Z.start),J=Z.key,Q=Z.sep;Q.push(this.sourceToken),delete Z.key,delete Z.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)Z.sep=Z.sep.concat(q,this.sourceToken);else Z.sep.push(this.sourceToken);else if(!Z.sep)Object.assign(Z,{key:null,sep:[this.sourceToken]});else if(Z.value||z)$.items.push({start:q,key:null,sep:[this.sourceToken]});else if(j0(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else Z.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||Z.value)$.items.push({start:q,key:G,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(G);else Object.assign(Z,{key:G,sep:[]}),this.onKeyLine=!0;return}default:{let G=this.startBlockValue($);if(G){if(G.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!j0(Z.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(X)$.items.push({start:q});this.stack.push(G);return}}}}yield*this.pop(),yield*this.step()}*blockSequence($){let Z=$.items[$.items.length-1];switch(this.type){case"newline":if(Z.value){let X="end"in Z.value?Z.value.end:void 0;if((Array.isArray(X)?X[X.length-1]:void 0)?.type==="comment")X?.push(this.sourceToken);else $.items.push({start:[this.sourceToken]})}else Z.start.push(this.sourceToken);return;case"space":case"comment":if(Z.value)$.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(Z.start,$.indent)){let z=$.items[$.items.length-2]?.value?.end;if(Array.isArray(z)){Array.prototype.push.apply(z,Z.start),z.push(this.sourceToken),$.items.pop();return}}Z.start.push(this.sourceToken)}return;case"anchor":case"tag":if(Z.value||this.indent<=$.indent)break;Z.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==$.indent)break;if(Z.value||j0(Z.start,"seq-item-ind"))$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return}if(this.indent>$.indent){let X=this.startBlockValue($);if(X){this.stack.push(X);return}}yield*this.pop(),yield*this.step()}*flowCollection($){let Z=$.items[$.items.length-1];if(this.type==="flow-error-end"){let X;do yield*this.pop(),X=this.peek(1);while(X?.type==="flow-collection")}else if($.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!Z||Z.sep)$.items.push({start:[this.sourceToken]});else Z.start.push(this.sourceToken);return;case"map-value-ind":if(!Z||Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Object.assign(Z,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!Z||Z.value)$.items.push({start:[this.sourceToken]});else if(Z.sep)Z.sep.push(this.sourceToken);else Z.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let z=this.flowScalar(this.type);if(!Z||Z.value)$.items.push({start:[],key:z,sep:[]});else if(Z.sep)this.stack.push(z);else Object.assign(Z,{key:z,sep:[]});return}case"flow-map-end":case"flow-seq-end":$.end.push(this.sourceToken);return}let X=this.startBlockValue($);if(X)this.stack.push(X);else yield*this.pop(),yield*this.step()}else{let X=this.peek(2);if(X.type==="block-map"&&(this.type==="map-value-ind"&&X.indent===$.indent||this.type==="newline"&&!X.items[X.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&X.type!=="flow-collection"){let z=U2(X),q=H$(z);C8($);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 Z=this.source.indexOf(`
165
+ `)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
166
+ `,Z)+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 Z=U2($),X=H$(Z);return X.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let Z=U2($),X=H$(Z);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:X,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment($,Z){if(this.type!=="comment")return!1;if(this.indent<=Z)return!1;return $.every((X)=>X.type==="newline"||X.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()}}}mY.Parser=b8});var h8=_((rY)=>{var y8=W9(),pY=a$(),e$=n$(),lY=M4(),cY=S(),iY=M9(),x8=w9();function k8($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new iY.LineCounter||null,prettyErrors:Z}}function aY($,Z={}){let{lineCounter:X,prettyErrors:z}=k8(Z),q=new x8.Parser(X?.addNewLine),G=new y8.Composer(Z),J=Array.from(G.compose(q.parse($)));if(z&&X)for(let Q of J)Q.errors.forEach(e$.prettifyError($,X)),Q.warnings.forEach(e$.prettifyError($,X));if(J.length>0)return J;return Object.assign([],{empty:!0},G.streamInfo())}function f8($,Z={}){let{lineCounter:X,prettyErrors:z}=k8(Z),q=new x8.Parser(X?.addNewLine),G=new y8.Composer(Z),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 e$.YAMLParseError(Q.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)J.errors.forEach(e$.prettifyError($,X)),J.warnings.forEach(e$.prettifyError($,X));return J}function nY($,Z,X){let z=void 0;if(typeof Z==="function")z=Z;else if(X===void 0&&Z&&typeof Z==="object")X=Z;let q=f8($,X);if(!q)return null;if(q.warnings.forEach((G)=>lY.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},X))}function sY($,Z,X){let z=null;if(typeof Z==="function"||Array.isArray(Z))z=Z;else if(X===void 0&&Z)X=Z;if(typeof X==="string")X=X.length;if(typeof X==="number"){let q=Math.round(X);X=q<1?void 0:q>8?{indent:8}:{indent:q}}if($===void 0){let{keepUndefined:q}=X??Z??{};if(!q)return}if(cY.isDocument($)&&!z)return $.toString(X);return new pY.Document($,z,X).toString(X)}rY.parse=nY;rY.parseAllDocuments=aY;rY.parseDocument=f8;rY.stringify=sY});var v8=_((TU)=>{var ZU=W9(),XU=a$(),zU=s4(),P9=n$(),qU=b$(),S0=S(),GU=R0(),JU=g(),QU=A0(),YU=N0(),UU=Q2(),HU=F9(),WU=M9(),VU=w9(),H2=h8(),g8=C$();TU.Composer=ZU.Composer;TU.Document=XU.Document;TU.Schema=zU.Schema;TU.YAMLError=P9.YAMLError;TU.YAMLParseError=P9.YAMLParseError;TU.YAMLWarning=P9.YAMLWarning;TU.Alias=qU.Alias;TU.isAlias=S0.isAlias;TU.isCollection=S0.isCollection;TU.isDocument=S0.isDocument;TU.isMap=S0.isMap;TU.isNode=S0.isNode;TU.isPair=S0.isPair;TU.isScalar=S0.isScalar;TU.isSeq=S0.isSeq;TU.Pair=GU.Pair;TU.Scalar=JU.Scalar;TU.YAMLMap=QU.YAMLMap;TU.YAMLSeq=YU.YAMLSeq;TU.CST=UU;TU.Lexer=HU.Lexer;TU.LineCounter=WU.LineCounter;TU.Parser=VU.Parser;TU.parse=H2.parse;TU.parseAllDocuments=H2.parseAllDocuments;TU.parseDocument=H2.parseDocument;TU.stringify=H2.stringify;TU.visit=g8.visit;TU.visitAsync=g8.visitAsync});var S5=V5(j5(),1),{program:e0,createCommand:OV,createArgument:FV,createOption:MV,CommanderError:wV,InvalidArgumentError:PV,InvalidOptionArgumentError:RV,Command:IV,Argument:AV,Option:H4,Help:NV}=S5.default;var C5={name:"@pickled-dev/cli",version:"0.16.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 qV from"path";var Q0={category:"cli",provider:"claude-code",model:"sonnet"},W4=["Read","Glob","Grep","Bash"],V4=["Edit","MultiEdit","Write","NotebookEdit"];var u8=V5(v8(),1);async function W$($){let Z=`${$}/pickled.yml`,X=Bun.file(Z);if(!await X.exists())throw Error(`pickled.yml not found in ${$}`);let z;try{let q=await X.text();z=u8.default.parse(q)}catch(q){throw Error(`Failed to parse pickled.yml: ${q}`)}return pU(z),z}function pU($){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[X,z]of Object.entries($.docs.sources))rU(X,z);if($.toolsets){if(typeof $.toolsets!=="object"||Array.isArray($.toolsets))throw Error("pickled.yml: 'toolsets' must be an object mapping name to configuration");for(let[X,z]of Object.entries($.toolsets))if(typeof z!=="object"||z===null||Array.isArray(z))throw Error(`pickled.yml: toolsets["${X}"] must be an object`)}if($.targets)for(let[X,z]of Object.entries($.targets)){if(z.systemPrompt!==void 0)throw Error(`pickled.yml: target "${X}" 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 "${X}" (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 "${X}" (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 "${X}" (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 "${X}" (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 "${X}" (api/${z.provider}) sets 'workspaceContext', which only applies to IDE targets. Remove the field.`)}}let Z=new Set(Object.keys($.docs?.sources??{}));for(let X of $.scenarios){if(!X.name||!X.prompt)throw Error("pickled.yml: every scenario needs 'name' and 'prompt'");if(X.requiredSources!==void 0){if(!Array.isArray(X.requiredSources))throw Error(`pickled.yml: scenario "${X.name}" has non-array 'requiredSources'. Omit the field to skip citation scoring, or set [] for "any cited source counts".`);for(let z of X.requiredSources)if(!Z.has(z))throw Error(`pickled.yml: scenario "${X.name}" references unknown source "${z}". Declared sources: ${[...Z].join(", ")||"(none)"}`)}eU(X.name,X.traps),sU(X.name,X.compareSurfaces,Z),cU(X.name,X.matrix,Z,new Set(Object.keys($.targets??{})),new Set(Object.keys($.toolsets??{none:{}}))),iU(X.name,X.expected),aU(X.name,X.verifiers,Z),nU(X)}lU($)}function lU($){if(!$.docs?.sources)return;let Z=[];for(let[z,q]of Object.entries($.docs.sources)){if(typeof q==="string")continue;let G=q.audit?.traps;if(Array.isArray(G))Z.push({id:z,list:G})}if(Z.length===0)return;let X=new Map;for(let z of $.scenarios)for(let q of z.traps??[]){let G=X.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.`);X.set(q.id,z.name)}for(let{id:z,list:q}of Z)for(let G of q)if(!X.has(G)){let J=[...X.keys()].join(", ")||"(none)";throw Error(`pickled.yml: docs.sources["${z}"].audit.traps lists unknown trap id "${G}". Declared trap ids: ${J}`)}}function cU($,Z,X,z,q){if(Z===void 0)return;if(typeof Z!=="object"||Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" matrix must be an object with optional interfaces/sources/toolsets arrays`);let G=(J,Q,Y)=>{let U=Z[J];if(U===void 0)return;if(!Array.isArray(U))throw Error(`pickled.yml: scenario "${$}" matrix.${J} must be an array of ${Y} names`);if(U.length===0)throw Error(`pickled.yml: scenario "${$}" matrix.${J} cannot be empty (omit the field to use defaults)`);for(let W of U){if(typeof W!=="string")throw Error(`pickled.yml: scenario "${$}" matrix.${J} entries must be strings`);if(!Q.has(W))throw Error(`pickled.yml: scenario "${$}" matrix.${J} references unknown ${Y} "${W}". Declared: ${[...Q].join(", ")||"(none)"}`)}};G("interfaces",z,"target"),G("sources",X,"source"),G("toolsets",q,"toolset")}function iU($,Z){if(Z===void 0)return;if(typeof Z!=="object"||Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" expected must be an object with optional includes/excludes arrays`);let X=(z)=>{let q=Z[z];if(q===void 0)return;if(!Array.isArray(q))throw Error(`pickled.yml: scenario "${$}" expected.${z} must be an array of strings`);if(q.length===0)throw Error(`pickled.yml: scenario "${$}" expected.${z} cannot be empty (omit the field instead)`);for(let G=0;G<q.length;G++)if(typeof q[G]!=="string"||q[G].length===0)throw Error(`pickled.yml: scenario "${$}" expected.${z}[${G}] must be a non-empty string`)};X("includes"),X("excludes")}function aU($,Z,X){if(Z===void 0)return;if(typeof Z!=="object"||Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" verifiers must be an object`);let z=Z.sources;if(z===void 0)return;if(!Array.isArray(z))throw Error(`pickled.yml: scenario "${$}" verifiers.sources must be an array of source IDs`);for(let q of z){if(typeof q!=="string")throw Error(`pickled.yml: scenario "${$}" verifiers.sources entries must be strings`);if(!X.has(q))throw Error(`pickled.yml: scenario "${$}" verifiers.sources references unknown source "${q}"`)}}function nU($){let Z=$.requiredSources!==void 0,X=$.expected!==void 0&&($.expected.includes!==void 0&&$.expected.includes.length>0||$.expected.excludes!==void 0&&$.expected.excludes.length>0),z=$.traps!==void 0&&$.traps.length>0;if(!Z&&!X&&!z)throw Error(`pickled.yml: scenario "${$.name}" must declare at least one of requiredSources, expected.includes/excludes, or traps. A scenario with nothing to check has no verdict.`)}function sU($,Z,X){if(Z===void 0)return;if(!Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" compareSurfaces must be an array of source-id lists`);if(Z.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<Z.length;z++){let q=Z[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(!X.has(G))throw Error(`pickled.yml: scenario "${$}" compareSurfaces[${z}] references unknown source "${G}". Declared sources: ${[...X].join(", ")||"(none)"}`)}}}function rU($,Z){if(typeof Z==="string"){if(Z.length===0)throw Error(`pickled.yml: docs.sources["${$}"] string form must be a non-empty file path or URL`);return}if(!Z||typeof Z!=="object")throw Error(`pickled.yml: docs.sources["${$}"] must be a string (path/URL) or an object with a 'path' field`);let X=Z;if(typeof X.path!=="string"||X.path.length===0)throw Error(`pickled.yml: docs.sources["${$}"] object form requires a non-empty 'path' field`);if(X.audit!==void 0){if(typeof X.audit!=="object"||X.audit===null)throw Error(`pickled.yml: docs.sources["${$}"].audit must be an object`);let z=X.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(X.type!==void 0){if(X.type!=="file"&&X.type!=="url"&&X.type!=="codebase")throw Error(`pickled.yml: docs.sources["${$}"].type must be "file", "url", or "codebase"`)}if(X.type==="codebase"){if(typeof X.path==="string"&&X.path.split("/").includes(".."))throw Error(`pickled.yml: docs.sources["${$}"].path must not contain ".." segments. Codebase loader stays within the project root.`);if(X.exclude!==void 0){if(!Array.isArray(X.exclude))throw Error(`pickled.yml: docs.sources["${$}"].exclude must be an array of glob patterns`);for(let z=0;z<X.exclude.length;z++)if(typeof X.exclude[z]!=="string")throw Error(`pickled.yml: docs.sources["${$}"].exclude[${z}] must be a string glob pattern`)}if(X.maxBytes!==void 0){if(typeof X.maxBytes!=="number"||!Number.isFinite(X.maxBytes)||X.maxBytes<=0)throw Error(`pickled.yml: docs.sources["${$}"].maxBytes must be a positive number of bytes`)}}else{if(X.exclude!==void 0)throw Error(`pickled.yml: docs.sources["${$}"].exclude only applies to type: codebase sources`);if(X.maxBytes!==void 0)throw Error(`pickled.yml: docs.sources["${$}"].maxBytes only applies to type: codebase sources`)}for(let z of Object.keys(X))if(z!=="path"&&z!=="audit"&&z!=="type"&&z!=="exclude"&&z!=="maxBytes")throw Error(`pickled.yml: docs.sources["${$}"] has unknown field "${z}"`)}var oU=new Set(["g","y"]),tU=new Set(["i","m","s","u","v"]);function eU($,Z){if(Z===void 0)return;if(!Array.isArray(Z))throw Error(`pickled.yml: scenario "${$}" has non-array 'traps'`);let X=new Set;for(let z of Z){if(!z.id||typeof z.id!=="string")throw Error(`pickled.yml: scenario "${$}" has a trap missing 'id'`);if(X.has(z.id))throw Error(`pickled.yml: scenario "${$}" has duplicate trap id "${z.id}"`);if(X.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(oU.has(Q))throw Error(`pickled.yml: scenario "${$}" trap "${z.id}" uses forbidden regex flag "${Q}" (g and y are not allowed)`);if(!tU.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 R9($,Z){let X=new Set([...Object.keys($.targets??{}),"default"]);if(!X.has(Z)){let z=[...X].sort().join(", ");throw Error(`Unknown target: "${Z}". Available targets: ${z}`)}return{...$,matrix:{...$.matrix,target:[Z]},scenarios:$.scenarios.filter((z)=>!z.target||z.target===Z)}}function I9($){if(typeof $==="string")return{path:$,auditTraps:!0};return{path:$.path,auditTraps:$.audit?.traps??!0}}function W2($){let{config:Z,files:X,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
+ `),G.push(`Target: \`${Z.targetRepo}\``),G.push(`Budgets: root \u2264 ${Z.budgets.rootLines} lines, nested warn at ${Z.budgets.nestedWarnLines} lines.`),G.push(`Found ${X.length} agent-doc files. ${J} error(s), ${Q} warning(s).
168
168
  `),G.push(`## Inventory
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,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
169
+ `),X.length===0)G.push(`No agent-doc files found.
170
+ `);else{G.push("| File | Lines | Kind | Notes |"),G.push("|---|---|---|---|");let H=[...X].sort((V,B)=>B.lineCount-V.lineCount);for(let V of H){let B=!V.relPath.includes("/"),L=m8(V.lineCount,B,Z),T=V.isSymlink?`symlink \u2192 ${V.symlinkTarget?.replace(`${Z.targetRepo}/`,"")??"?"}`:"file";G.push(`| \`${V.relPath}\` | ${V.lineCount} | ${T} | ${L} |`)}G.push("")}if(G.push(`## AGENTS.md / CLAUDE.md pairs
171
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
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=X.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
- `),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)
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=X.filter((H)=>!H.isSymlink&&H.unresolvedCommands.length>0);if(G.push(`## Unresolved package-manager commands (advisory)
176
176
  `),G.push("Looks like a script command in markdown that did not match anything in the target `package.json` `scripts` or the `knownCommands` allowlist. Workspace-filtered commands check against root scripts, so false positives are expected. Review, do not fail CI on this.\n"),U.length===0)G.push(`None flagged.
177
177
  `);else for(let H of U){G.push(`### \`${H.relPath}\`
178
- `);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
178
+ `);for(let V of H.unresolvedCommands)G.push(` - \`${V}\``);G.push("")}let W=X.filter((H)=>{if(H.isSymlink)return!1;return!H.relPath.includes("/")?H.lineCount>Z.budgets.rootLines:H.lineCount>Z.budgets.nestedWarnLines});if(G.push(`## Section breakdown for files over budget
179
179
  `),W.length===0)G.push(`All files within budget.
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
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
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} ===
185
+ `)}function V2($){return JSON.stringify($,null,2)}function T2($){let{config:Z,files:X,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: ${Z.targetRepo}`),G.push(`Budgets: root \u2264 ${Z.budgets.rootLines} lines, nested warn at ${Z.budgets.nestedWarnLines} lines.`),G.push(`Found: ${X.length} agent-doc file(s) \xB7 ${J} error(s) \xB7 ${Q} warning(s)`),G.push(""),G.push("Inventory"),X.length===0)G.push(" none");else{let H=[...X].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=m8(B.lineCount,L,Z),K=B.isSymlink?`symlink \u2192 ${B.symlinkTarget?.replace(`${Z.targetRepo}/`,"")??"?"}`:"file",D=`${B.lineCount}`.padStart(4),O=B.relPath.padEnd(V),M=T?` (${T})`:"";G.push(` ${O} ${D} lines ${K}${M}`)}}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=X.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=X.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=X.filter((H)=>{if(H.isSymlink)return!1;return!H.relPath.includes("/")?H.lineCount>Z.budgets.rootLines:H.lineCount>Z.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 m8($,Z,X){if(Z&&$>X.budgets.rootLines)return`over root budget (${$} > ${X.budgets.rootLines})`;if(!Z&&$>X.budgets.nestedWarnLines)return`over nested-warn (${$} > ${X.budgets.nestedWarnLines})`;return""}import{existsSync as T$,lstatSync as a8,readFileSync as D2,readlinkSync as VH,statSync as TH}from"fs";import{dirname as _2,isAbsolute as BH,join as A9,relative as KH,resolve as N9}from"path";var{Glob:i8}=globalThis.Bun;var B2=["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/**"],V$={targetRepo:".",budgets:{rootLines:120,nestedWarnLines:200},ignore:B2,intentionalDifferentPairs:[],knownCommands:[]};function K2($){if(!$)return V$;return{targetRepo:$.targetRepo??V$.targetRepo,budgets:{rootLines:$.budgets?.rootLines??V$.budgets.rootLines,nestedWarnLines:$.budgets?.nestedWarnLines??V$.budgets.nestedWarnLines},ignore:$.ignore??B2,intentionalDifferentPairs:$.intentionalDifferentPairs??[],knownCommands:$.knownCommands??[]}}import{existsSync as QH}from"fs";import{join as YH,resolve as UH}from"path";function C0($){let Z=[],X=[];for(let z of $.traps){let q=$H($.response,z);if(q)Z.push(q);else X.push(z.id)}return{fired:Z,avoided:X}}function $H($,Z){if(Z.match!==void 0){let X=$.indexOf(Z.match);if(X===-1)return null;return{id:Z.id,reason:Z.reason,matched:Z.match,snippet:d8($,X,Z.match.length),index:X}}if(Z.pattern!==void 0){let z=new RegExp(Z.pattern,Z.flags??"").exec($);if(!z)return null;return{id:Z.id,reason:Z.reason,matched:z[0],snippet:d8($,z.index,z[0].length),index:z.index}}return null}function d8($,Z,X){let z=Math.max(0,Z-40),q=Math.min($.length,Z+X+40),G=$.slice(z,q).replace(/\s+/g," ").trim();if(z>0)G=`...${G}`;if(q<$.length)G=`${G}...`;return G}import L2 from"path";var{Glob:p8}=globalThis.Bun;var ZH=262144,XH=4194304;function zH($){return $.startsWith("http://")||$.startsWith("https://")}async function qH($,Z,X){let z=await fetch(Z);if(!z.ok)throw Error(`Failed to fetch source "${$}" from ${Z}: ${z.status} ${z.statusText}`);let q=await z.text();return{id:$,source:Z,content:q,name:new URL(Z).hostname+new URL(Z).pathname,type:"url",auditTraps:X}}async function GH($,Z,X,z){let q=L2.isAbsolute(Z)?Z:L2.resolve(X,Z),G=Bun.file(q);if(!await G.exists())throw Error(`Source "${$}" not found at ${q}`);let J=await G.text();return{id:$,source:Z,content:J,name:L2.basename(q),type:"file",auditTraps:z}}async function JH($,Z,X,z,q){let G=new p8(Z.path),J=(Z.exclude??[]).map((B)=>new p8(B)),Q=[];for await(let B of G.scan({cwd:X,onlyFiles:!0,followSymlinks:!1})){if(J.some((L)=>L.match(B)))continue;Q.push(B)}Q.sort();let Y=Z.maxBytes??ZH,U=Math.max(Y,XH),W=[],H=0;for(let B of Q){let L=L2.resolve(X,B),T=await Bun.file(L).text(),K=`// === ${B} ===
187
187
  `;if(W.push(K,T),!T.endsWith(`
188
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.
189
+ `);if(H+=K.length+T.length,H>U)throw Error(`Codebase source "${$}" exceeded hard cap of ${U} bytes (matched glob ${Z.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:Z.path,content:V,name:`${Q.length} file${Q.length===1?"":"s"} in ${Z.path}`,type:"codebase",auditTraps:z,matchedFiles:Q}}async function l8($,Z,X,z){let{path:q,auditTraps:G}=I9(Z);if(typeof Z!=="string"&&Z.type==="codebase")return JH($,Z,X,G,z);if(zH(q))return qH($,q,G);return GH($,q,X,G)}async function $1($,Z,X){let z=Object.entries($);return await Promise.all(z.map(([G,J])=>l8(G,J,Z,X)))}async function c8($){if(!QH(YH($,"pickled.yml")))return{matches:[],findings:[]};let Z=await W$($),X=Z.docs?.sources;if(!X||Object.keys(X).length===0)return{matches:[],findings:[]};let z={};for(let[U,W]of Object.entries(X)){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 Z.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 $1(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 HH(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}=C0({response:B.content,traps:[L]}),K=T[0];if(!K)continue;let D=WH(B.content,K.index),O=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:D,severity:O}),Y.push({severity:O,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 HH($,Z,X){let z=[];for(let q of $)try{let G=await Bun.file(UH(Z,q)).text();z.push({path:q,content:G})}catch{}return z}function WH($,Z){let X=1,z=Math.min(Z,$.length);for(let q=0;q<z;q++)if($[q]===`
190
+ `)X++;return X}var LH=["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 O2($){let Z=K2($),X=N9(Z.targetRepo);if(!T$(X))throw Error(`targetRepo does not exist: ${X}`);let z=new Set;for(let U of LH){let W=new i8(U);for await(let H of W.scan({cwd:X,dot:!0,onlyFiles:!1,followSymlinks:!1})){if(Z.ignore.some((L)=>new i8(L).match(H)))continue;let V=A9(X,H),B=a8(V);if(B.isFile()){z.add(H);continue}if(B.isSymbolicLink())try{if(TH(V).isFile())z.add(H)}catch{}}}let q=[];for(let U of[...z].sort())q.push(await DH(X,U,A9(X,U),Z));let G=SH(q,Z),J=CH(q,G,Z),{matches:Q,findings:Y}=await c8(X);return{config:Z,files:q,pairs:G,findings:[...J,...Y],sourceTrapMatches:Q}}async function DH($,Z,X,z){let G=a8(X).isSymbolicLink(),J=null,Q=Z;if(G){let V=VH(X),B=BH(V)?V:N9(_2(X),V);if(J=B,T$(B))Q=KH($,B)}let Y=G&&J&&T$(J)?J:X,U=D2(Y,"utf8"),W=(U.match(/\n/g)??[]).length,H=U.endsWith(`
191
+ `)?W:W+1;return{relPath:Z,absPath:X,isSymlink:G,symlinkTarget:J,realRelPath:Q,lineCount:H,brokenPathRefs:OH(U,$,Z),brokenImports:MH(U,_2(X)),unresolvedCommands:IH(U,$,z.knownCommands),sections:AH(U)}}function _H($){let Z=$.split("/");if(Z.length<2)return null;if(Z[0]==="packages"||Z[0]==="apps"||Z[0]==="shared")return`${Z[0]}/${Z[1]}`;if(Z[0]==="tests")return Z.slice(0,2).join("/");return null}function OH($,Z,X){let z=jH($),q=_2(X),G=_H(X),J=new Set,Q=/`([^`\n]{2,200})`/g,Y;Y=Q.exec(z);while(Y!==null){let U=Y[1].trim().replace(/[#?].*$/,"");if(NH(U)&&!FH(Z,U,q,G).found)J.add(U);Y=Q.exec(z)}return[...J].sort()}function FH($,Z,X,z){let q=[Z];if(X&&X!==".")q.push(`${X}/${Z}`);if(z)q.push(`${z}/${Z}`);q.push(`packages/${Z}`,`apps/${Z}`,`shared/${Z}`);for(let G of q){let J=G.replace(/\/+/g,"/");if(T$(`${$}/${J}`))return{found:!0,resolvedAs:J}}return{found:!1}}function MH($,Z){let X=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:N9(Z,G);if(!T$(J))X.add(G);q=z.exec($)}return[...X].sort()}var wH=["bun","pnpm","npm","yarn"],PH=new Set(["install","add","remove","update","i","audit","list","ls","why","outdated","exec","run","create","init","x"]),RH={bun:new Set(["build","test","link","unlink","upgrade"])};function IH($,Z,X){let z=new Set,q=A9(Z,"package.json"),G=new Set;if(T$(q))try{let Q=JSON.parse(D2(q,"utf8"));G=new Set(Object.keys(Q.scripts??{}))}catch{}let J=new Set(X.map((Q)=>Q.trim()));for(let Q of wH){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}`)&&!PH.has(W)&&!RH[Q]?.has(W))z.add(`${Q} ${W}`);U=Y.exec($)}}return[...z].sort()}function AH($){let Z=$.split(`
192
+ `),X=[],z=null;if(Z.forEach((q,G)=>{if(/^##\s+/.test(q)){if(z)X.push({header:z.header,lines:G-z.start});z={header:q.replace(/^##\s+/,"").trim(),start:G}}}),z){let q=z;X.push({header:q.header,lines:Z.length-q.start})}return X.sort((q,G)=>G.lines-q.lines)}function NH($){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 jH($){return $.replace(/```[\s\S]*?```/g,"")}function SH($,Z){let X=new Map;for(let G of $){let J=G.relPath.split("/").pop()??"";if(J!=="AGENTS.md"&&J!=="CLAUDE.md")continue;let Q=_2(G.relPath),Y=X.get(Q)??{};if(J==="AGENTS.md")Y.agents=G;if(J==="CLAUDE.md")Y.claude=G;X.set(Q,Y)}let z=new Set(Z.intentionalDifferentPairs),q=[];for(let[G,J]of X){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=D2(U.absPath,"utf8"),T=D2(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 CH($,Z,X){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?X.budgets.rootLines:X.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 Z)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 K0($){let Z=$.confidence;if($.error)return{icon:"\u2717",label:"Error",confidence:Z,tone:"error"};if($.traps.fired.length>0)return{icon:"\u2717",label:"Trap fired",confidence:Z,tone:"error"};if($.answerable==="YES")return{icon:"\u2713",label:Z>=90?"Well grounded":"Grounded",confidence:Z,tone:"success"};if($.answerable==="PARTIAL")return{icon:"\u26A0",label:"Partially grounded",confidence:Z,tone:"warning"};return{icon:"\u2717",label:"Ungrounded",confidence:Z,tone:"error"}}function j9($){let Z=EH($);if(Z===null)return[];let X=[],z=/^\s*-\s+\[([^\]]+)\]\s*(.*)$/gm,q=z.exec(Z);while(q!==null)X.push({id:q[1].trim(),note:q[2].trim()||void 0}),q=z.exec(Z);return X}function EH($){let X=/^##\s+Sources\s*$/im.exec($);if(!X)return null;let z=X.index+X[0].length,q=$.slice(z),G=/^##\s+/m.exec(q);return G?q.slice(0,G.index):q}function B$($){let Z=j9($.response),X=new Set(Z.map((V)=>V.id)),z=new Set($.registeredIds),q=new Set($.requiredSources),G=[...X],J=[...q].filter((V)=>!X.has(V)),Q=[...X].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}}}function F2($){let Z=$.expected,X=(Z?.includes??[]).map((J)=>({value:J,satisfied:$.response.includes(J)})),z=(Z?.excludes??[]).map((J)=>({value:J,satisfied:!$.response.includes(J)})),q=X.filter((J)=>J.satisfied).length+z.filter((J)=>J.satisfied).length,G=X.length+z.length;return{includes:X,excludes:z,satisfied:q,total:G}}var l0="0.40.1";var n8=!1,c0=void 0,S9=void 0,bH=void 0,yH=void 0,xH=void 0,s8=void 0,kH=void 0,M2=void 0,C9=void 0,r8=void 0,E9=void 0,w2=void 0,o8=void 0;function t8($,Z={auto:!1}){if(n8)throw Error(`you must \`import '@anthropic-ai/sdk/shims/${$.kind}'\` before importing anything else from @anthropic-ai/sdk`);if(c0)throw Error(`can't \`import '@anthropic-ai/sdk/shims/${$.kind}'\` after \`import '@anthropic-ai/sdk/shims/${c0}'\``);n8=Z.auto,c0=$.kind,S9=$.fetch,bH=$.Request,yH=$.Response,xH=$.Headers,s8=$.FormData,kH=$.Blob,M2=$.File,C9=$.ReadableStream,r8=$.getMultipartRequestOptions,E9=$.getDefaultAgent,w2=$.fileFromPath,o8=$.isFsReadStream}class b9{constructor($){this.body=$}get[Symbol.toStringTag](){return"MultipartBody"}}function e8({manuallyImported:$}={}){let Z=$?"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",X,z,q,G;try{X=fetch,z=Request,q=Response,G=Headers}catch(J){throw Error(`this environment is missing the following Web Fetch API type: ${J.message}. ${Z}`)}return{kind:"web",fetch:X,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. ${Z}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${Z}`)}},File:typeof File<"u"?File:class{constructor(){throw Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${Z}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${Z}`)}},getMultipartRequestOptions:async(J,Q)=>({...Q,body:new b9(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 hH}from"fs";function $Z(){let $=e8();function Z(X){return X instanceof hH}return{...$,isFsReadStream:Z}}var y9=()=>{if(!c0)t8($Z(),{auto:!0})};y9();class A extends Error{}class u extends A{constructor($,Z,X,z){super(`${u.makeMessage($,Z,X)}`);this.status=$,this.headers=z,this.request_id=z?.["request-id"],this.error=Z}static makeMessage($,Z,X){let z=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):X;if($&&z)return`${$} ${z}`;if($)return`${$} status code (no body)`;if(z)return z;return"(no status code or body)"}static generate($,Z,X,z){if(!$||!z)return new i0({message:X,cause:E2(Z)});let q=Z;if($===400)return new P2($,q,X,z);if($===401)return new R2($,q,X,z);if($===403)return new I2($,q,X,z);if($===404)return new A2($,q,X,z);if($===409)return new N2($,q,X,z);if($===422)return new j2($,q,X,z);if($===429)return new S2($,q,X,z);if($>=500)return new C2($,q,X,z);return new u($,q,X,z)}}class p extends u{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}}class i0 extends u{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}}class Z1 extends i0{constructor({message:$}={}){super({message:$??"Request timed out."})}}class P2 extends u{}class R2 extends u{}class I2 extends u{}class A2 extends u{}class N2 extends u{}class j2 extends u{}class S2 extends u{}class C2 extends u{}var b2=function($,Z,X,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 Z==="function"?$!==Z||!q:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?q.call($,X):q?q.value=X:Z.set($,X),X},a0=function($,Z,X,z){if(X==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!z:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?z:X==="a"?z.call($):z?z.value:Z.get($)},s;class E0{constructor(){s.set(this,void 0),this.buffer=new Uint8Array,b2(this,s,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?new TextEncoder().encode($):$,X=new Uint8Array(this.buffer.length+Z.length);X.set(this.buffer),X.set(Z,this.buffer.length),this.buffer=X;let z=[],q;while((q=vH(this.buffer,a0(this,s,"f")))!=null){if(q.carriage&&a0(this,s,"f")==null){b2(this,s,q.index,"f");continue}if(a0(this,s,"f")!=null&&(q.index!==a0(this,s,"f")+1||q.carriage)){z.push(this.decodeText(this.buffer.slice(0,a0(this,s,"f")-1))),this.buffer=this.buffer.slice(a0(this,s,"f")),b2(this,s,null,"f");continue}let G=a0(this,s,"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),b2(this,s,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 A(`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 A(`Unexpected: received non-Uint8Array/ArrayBuffer (${$.constructor.name}) in a web platform. Please report this error.`)}throw new A("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){if(!this.buffer.length)return[];return this.decode(`
193
+ `)}}s=new WeakMap;E0.NEWLINE_CHARS=new Set([`
194
+ `,"\r"]);E0.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function vH($,Z){for(let q=Z??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 ZZ($){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 X1($){if($[Symbol.asyncIterator])return $;let Z=$.getReader();return{async next(){try{let X=await Z.read();if(X?.done)Z.releaseLock();return X}catch(X){throw Z.releaseLock(),X}},async return(){let X=Z.cancel();return Z.releaseLock(),await X,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}class r{constructor($,Z){this.iterator=$,this.controller=Z}static fromSSEResponse($,Z){let X=!1;async function*z(){if(X)throw Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");X=!0;let q=!1;try{for await(let G of uH($,Z)){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 u.generate(void 0,`SSE Error: ${G.data}`,G.data,x9($.headers))}q=!0}catch(G){if(G instanceof Error&&G.name==="AbortError")return;throw G}finally{if(!q)Z.abort()}}return new r(z,Z)}static fromReadableStream($,Z){let X=!1;async function*z(){let G=new E0,J=X1($);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(X)throw Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");X=!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)Z.abort()}}return new r(q,Z)}[Symbol.asyncIterator](){return this.iterator()}tee(){let $=[],Z=[],X=this.iterator(),z=(q)=>{return{next:()=>{if(q.length===0){let G=X.next();$.push(G),Z.push(G)}return q.shift()}}};return[new r(()=>z($),this.controller),new r(()=>z(Z),this.controller)]}toReadableStream(){let $=this,Z,X=new TextEncoder;return new C9({async start(){Z=$[Symbol.asyncIterator]()},async pull(z){try{let{value:q,done:G}=await Z.next();if(G)return z.close();let J=X.encode(JSON.stringify(q)+`
195
+ `);z.enqueue(J)}catch(q){z.error(q)}},async cancel(){await Z.return?.()}})}}async function*uH($,Z){if(!$.body)throw Z.abort(),new A("Attempted to iterate over a response with no body");let X=new XZ,z=new E0,q=X1($.body);for await(let G of mH(q))for(let J of z.decode(G)){let Q=X.decode(J);if(Q)yield Q}for(let G of z.flush()){let J=X.decode(G);if(J)yield J}}async function*mH($){let Z=new Uint8Array;for await(let X of $){if(X==null)continue;let z=X instanceof ArrayBuffer?new Uint8Array(X):typeof X==="string"?new TextEncoder().encode(X):X,q=new Uint8Array(Z.length+z.length);q.set(Z),q.set(z,Z.length),Z=q;let G;while((G=ZZ(Z))!==-1)yield Z.slice(0,G),Z=Z.slice(G)}if(Z.length>0)yield Z}class XZ{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[Z,X,z]=dH($,":");if(z.startsWith(" "))z=z.substring(1);if(Z==="event")this.event=z;else if(Z==="data")this.data.push(z);return null}}function dH($,Z){let X=$.indexOf(Z);if(X!==-1)return[$.substring(0,X),Z,$.substring(X+Z.length)];return[$,"",""]}var pH=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function",lH=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&z1($),z1=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function";async function zZ($,Z,X){if($=await $,lH($))return $;if(pH($)){let q=await $.blob();Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()??"unknown_file");let G=z1(q)?[await q.arrayBuffer()]:[q];return new M2(G,Z,X)}let z=await cH($);if(Z||(Z=aH($)??"unknown_file"),!X?.type){let q=z[0]?.type;if(typeof q==="string")X={...X,type:q}}return new M2(z,Z,X)}async function cH($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(z1($))Z.push(await $.arrayBuffer());else if(nH($))for await(let X of $)Z.push(X);else throw Error(`Unexpected data type: ${typeof $}; constructor: ${$?.constructor?.name}; props: ${iH($)}`);return Z}function iH($){return`[${Object.getOwnPropertyNames($).map((X)=>`"${X}"`).join(", ")}]`}function aH($){return k9($.name)||k9($.filename)||k9($.path)?.split(/[\\/]/).pop()}var k9=($)=>{if(typeof $==="string")return $;if(typeof Buffer<"u"&&$ instanceof Buffer)return String($);return},nH=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",f9=($)=>$&&typeof $==="object"&&$.body&&$[Symbol.toStringTag]==="MultipartBody";var rH=function($,Z,X,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 Z==="function"?$!==Z||!q:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?q.call($,X):q?q.value=X:Z.set($,X),X},oH=function($,Z,X,z){if(X==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!z:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?z:X==="a"?z.call($):z?z.value:Z.get($)},y2;y9();async function YZ($){let{response:Z}=$;if($.options.stream){if(K$("response",Z.status,Z.url,Z.headers,Z.body),$.options.__streamClass)return $.options.__streamClass.fromSSEResponse(Z,$.controller);return r.fromSSEResponse(Z,$.controller)}if(Z.status===204)return null;if($.options.__binaryResponse)return Z;let z=Z.headers.get("content-type")?.split(";")[0]?.trim();if(z?.includes("application/json")||z?.endsWith("+json")){let J=await Z.json();return K$("response",Z.status,Z.url,Z.headers,J),UZ(J,Z)}let G=await Z.text();return K$("response",Z.status,Z.url,Z.headers,G),G}function UZ($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}class k2 extends Promise{constructor($,Z=YZ){super((X)=>{X(null)});this.responsePromise=$,this.parseResponse=Z}_thenUnwrap($){return new k2(this.responsePromise,async(Z)=>UZ($(await this.parseResponse(Z),Z),Z.response))}asResponse(){return this.responsePromise.then(($)=>$.response)}async withResponse(){let[$,Z]=await Promise.all([this.parse(),this.asResponse()]);return{data:$,response:Z,request_id:Z.headers.get("request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then(this.parseResponse);return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}}class g9{constructor({baseURL:$,maxRetries:Z=2,timeout:X=600000,httpAgent:z,fetch:q}){this.baseURL=$,this.maxRetries=h9("maxRetries",Z),this.timeout=h9("timeout",X),this.httpAgent=z,this.fetch=q??S9}authHeaders($){return{}}defaultHeaders($){return{Accept:"application/json","Content-Type":"application/json","User-Agent":this.getUserAgent(),...ZW(),...this.authHeaders($)}}validateHeaders($,Z){}defaultIdempotencyKey(){return`stainless-node-retry-${JW()}`}get($,Z){return this.methodRequest("get",$,Z)}post($,Z){return this.methodRequest("post",$,Z)}patch($,Z){return this.methodRequest("patch",$,Z)}put($,Z){return this.methodRequest("put",$,Z)}delete($,Z){return this.methodRequest("delete",$,Z)}methodRequest($,Z,X){return this.request(Promise.resolve(X).then(async(z)=>{let q=z&&z1(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:Z,...z,body:q}}))}getAPIList($,Z,X){return this.requestAPIList(Z,{method:"get",path:$,...X})}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:Z=0}={}){let X={...$},{method:z,path:q,query:G,headers:J={}}=X,Q=ArrayBuffer.isView(X.body)||X.__binaryRequest&&typeof X.body==="string"?X.body:f9(X.body)?X.body.body:X.body?JSON.stringify(X.body,null,2):null,Y=this.calculateContentLength(Q),U=this.buildURL(q,G);if("timeout"in X)h9("timeout",X.timeout);X.timeout=X.timeout??this.timeout;let W=X.httpAgent??this.httpAgent??E9(U),H=X.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:X,headers:J,contentLength:Y,retryCount:Z});return{req:{method:z,...Q&&{body:Q},headers:V,...W&&{agent:W},signal:X.signal??null},url:U,timeout:X.timeout}}buildHeaders({options:$,headers:Z,contentLength:X,retryCount:z}){let q={};if(X)q["content-length"]=X;let G=this.defaultHeaders($);if(QZ(q,G),QZ(q,Z),f9($.body)&&c0!=="node")delete q["content-type"];if(x2(G,"x-stainless-retry-count")===void 0&&x2(Z,"x-stainless-retry-count")===void 0)q["x-stainless-retry-count"]=String(z);if(x2(G,"x-stainless-timeout")===void 0&&x2(Z,"x-stainless-timeout")===void 0&&$.timeout)q["x-stainless-timeout"]=String(Math.trunc($.timeout/1000));return this.validateHeaders(q,Z),q}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new A("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:Z,options:X}){}parseHeaders($){return!$?{}:(Symbol.iterator in $)?Object.fromEntries(Array.from($).map((Z)=>[...Z])):{...$}}makeStatusError($,Z,X,z){return u.generate($,Z,X,z)}request($,Z=null){return new k2(this.makeRequest($,Z))}async makeRequest($,Z){let X=await $,z=X.maxRetries??this.maxRetries;if(Z==null)Z=z;await this.prepareOptions(X);let{req:q,url:G,timeout:J}=this.buildRequest(X,{retryCount:z-Z});if(await this.prepareRequest(q,{url:G,options:X}),K$("request",G,X,q.headers),X.signal?.aborted)throw new p;let Q=new AbortController,Y=await this.fetchWithTimeout(G,q,J,Q).catch(E2);if(Y instanceof Error){if(X.signal?.aborted)throw new p;if(Z)return this.retryRequest(X,Z);if(Y.name==="AbortError")throw new Z1;throw new i0({cause:Y})}let U=x9(Y.headers);if(!Y.ok){if(Z&&this.shouldRetry(Y)){let T=`retrying, ${Z} attempts remaining`;return K$(`response (error; ${T})`,Y.status,G,U),this.retryRequest(X,Z,U)}let W=await Y.text().catch((T)=>E2(T).message),H=XW(W),V=H?void 0:W;throw K$(`response (error; ${Z?"(error; no more retries left)":"(error; not retryable)"})`,Y.status,G,U,V),this.makeStatusError(Y.status,H,V,U)}return{response:Y,options:X,controller:Q}}requestAPIList($,Z){let X=this.makeRequest(Z,null);return new HZ(this,X,$)}buildURL($,Z){let X=qW($)?new URL($):new URL(this.baseURL+(this.baseURL.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),z=this.defaultQuery();if(!WZ(z))Z={...z,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))X.search=this.stringifyQuery(Z);return X.toString()}stringifyQuery($){return Object.entries($).filter(([Z,X])=>typeof X<"u").map(([Z,X])=>{if(typeof X==="string"||typeof X==="number"||typeof X==="boolean")return`${encodeURIComponent(Z)}=${encodeURIComponent(X)}`;if(X===null)return`${encodeURIComponent(Z)}=`;throw new A(`Cannot stringify type ${typeof X}; 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($,Z,X,z){let{signal:q,...G}=Z||{};if(q)q.addEventListener("abort",()=>z.abort());let J=setTimeout(()=>z.abort(),X),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 Z=$.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="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($,Z,X){let z,q=X?.["retry-after-ms"];if(q){let J=parseFloat(q);if(!Number.isNaN(J))z=J}let G=X?.["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(Z,J)}return await GW(z),this.makeRequest($,Z-1)}calculateDefaultRetryTimeoutMillis($,Z){let q=Z-$,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 ${l0}`}}class v9{constructor($,Z,X,z){y2.set(this,void 0),rH(this,y2,$,"f"),this.options=z,this.response=Z,this.body=X}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageInfo()!=null}async getNextPage(){let $=this.nextPageInfo();if(!$)throw new A("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");let Z={...this.options};if("params"in $&&typeof Z.query==="object")Z.query={...Z.query,...$.params};else if("url"in $){let X=[...Object.entries(Z.query||{}),...$.url.searchParams.entries()];for(let[z,q]of X)$.url.searchParams.set(z,q);Z.query=void 0,Z.path=$.url.toString()}return await oH(this,y2,"f").requestAPIList(this.constructor,Z)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(y2=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}}class HZ extends k2{constructor($,Z,X){super(Z,async(z)=>new X($,z.response,await YZ(z),z.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}}var x9=($)=>{return new Proxy(Object.fromEntries($.entries()),{get(Z,X){let z=X.toString();return Z[z.toLowerCase()]||Z[z]}})},tH={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},e=($)=>{return typeof $==="object"&&$!==null&&!WZ($)&&Object.keys($).every((Z)=>VZ(tH,Z))},eH=()=>{if(typeof Deno<"u"&&Deno.build!=null)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":l0,"X-Stainless-OS":GZ(Deno.build.os),"X-Stainless-Arch":qZ(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":l0,"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":l0,"X-Stainless-OS":GZ(process.platform),"X-Stainless-Arch":qZ(process.arch),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":process.version};let $=$W();if($)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":l0,"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":l0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function $W(){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:Z,pattern:X}of $){let z=X.exec(navigator.userAgent);if(z){let q=z[1]||0,G=z[2]||0,J=z[3]||0;return{browser:Z,version:`${q}.${G}.${J}`}}}return null}var qZ=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},GZ=($)=>{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"},JZ,ZW=()=>{return JZ??(JZ=eH())},XW=($)=>{try{return JSON.parse($)}catch(Z){return}},zW=/^[a-z][a-z0-9+.-]*:/i,qW=($)=>{return zW.test($)},GW=($)=>new Promise((Z)=>setTimeout(Z,$)),h9=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new A(`${$} must be an integer`);if(Z<0)throw new A(`${$} must be a positive integer`);return Z},E2=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null)try{return Error(JSON.stringify($))}catch{}return Error(String($))};var f2=($)=>{if(typeof process<"u")return process.env?.[$]?.trim()??void 0;if(typeof Deno<"u")return Deno.env?.get?.($)?.trim();return};function WZ($){if(!$)return!0;for(let Z in $)return!1;return!0}function VZ($,Z){return Object.prototype.hasOwnProperty.call($,Z)}function QZ($,Z){for(let X in Z){if(!VZ(Z,X))continue;let z=X.toLowerCase();if(!z)continue;let q=Z[X];if(q===null)delete $[z];else if(q!==void 0)$[z]=q}}function K$($,...Z){if(typeof process<"u"&&process?.env?.DEBUG==="true")console.log(`Anthropic:DEBUG:${$}`,...Z)}var JW=()=>{return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,($)=>{let Z=Math.random()*16|0;return($==="x"?Z:Z&3|8).toString(16)})},TZ=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},QW=($)=>{return typeof $?.get==="function"};var x2=($,Z)=>{let X=Z.toLowerCase();if(QW($)){let z=Z[0]?.toUpperCase()+Z.substring(1).replace(/([^\w])(\w)/g,(q,G,J)=>G+J.toUpperCase());for(let q of[Z,X,Z.toUpperCase(),z]){let G=$.get(q);if(G)return G}}for(let[z,q]of Object.entries($))if(z.toLowerCase()===X){if(Array.isArray(q)){if(q.length<=1)return q[0];return console.warn(`Received ${q.length} entries for the ${Z} header, using the first entry.`),q[0]}return q}return};class L0 extends v9{constructor($,Z,X,z){super($,Z,X,z);this.data=X.data||[],this.has_more=X.has_more||!1,this.first_id=X.first_id||null,this.last_id=X.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 Z=Object.fromEntries($.url.searchParams);if(!Object.keys(Z).length)return null;return Z}nextPageInfo(){if(this.options.query?.before_id){let Z=this.first_id;if(!Z)return null;return{params:{before_id:Z}}}let $=this.last_id;if(!$)return null;return{params:{after_id:$}}}}class d{constructor($){this._client=$}}class L$ extends d{retrieve($,Z){return this._client.get(`/v1/models/${$}?beta=true`,Z)}list($={},Z){if(e($))return this.list({},$);return this._client.getAPIList("/v1/models?beta=true",q1,{query:$,...Z})}}class q1 extends L0{}L$.BetaModelInfosPage=q1;class D${constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new E0;for await(let Z of this.iterator)for(let X of $.decode(Z))yield JSON.parse(X);for(let Z of $.flush())yield JSON.parse(Z)}[Symbol.asyncIterator](){return this.decoder()}static fromResponse($,Z){if(!$.body)throw Z.abort(),new A("Attempted to iterate over a response with no body");return new D$(X1($.body),Z)}}class _$ extends d{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/messages/batches?beta=true",{body:z,...Z,headers:{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString(),...Z?.headers}})}retrieve($,Z={},X){if(e(Z))return this.retrieve($,{},Z);let{betas:z}=Z;return this._client.get(`/v1/messages/batches/${$}?beta=true`,{...X,headers:{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString(),...X?.headers}})}list($={},Z){if(e($))return this.list({},$);let{betas:X,...z}=$;return this._client.getAPIList("/v1/messages/batches?beta=true",G1,{query:z,...Z,headers:{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString(),...Z?.headers}})}delete($,Z={},X){if(e(Z))return this.delete($,{},Z);let{betas:z}=Z;return this._client.delete(`/v1/messages/batches/${$}?beta=true`,{...X,headers:{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString(),...X?.headers}})}cancel($,Z={},X){if(e(Z))return this.cancel($,{},Z);let{betas:z}=Z;return this._client.post(`/v1/messages/batches/${$}/cancel?beta=true`,{...X,headers:{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString(),...X?.headers}})}async results($,Z={},X){if(e(Z))return this.results($,{},Z);let z=await this.retrieve($);if(!z.results_url)throw new A(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);let{betas:q}=Z;return this._client.get(z.results_url,{...X,headers:{"anthropic-beta":[...q??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary",...X?.headers},stream:!0,__binaryResponse:!0})._thenUnwrap((G,J)=>D$.fromResponse(J.response,J.controller))}}class G1 extends L0{}_$.BetaMessageBatchesPage=G1;var WW=($)=>{let Z=0,X=[];while(Z<$.length){let z=$[Z];if(z==="\\"){Z++;continue}if(z==="{"){X.push({type:"brace",value:"{"}),Z++;continue}if(z==="}"){X.push({type:"brace",value:"}"}),Z++;continue}if(z==="["){X.push({type:"paren",value:"["}),Z++;continue}if(z==="]"){X.push({type:"paren",value:"]"}),Z++;continue}if(z===":"){X.push({type:"separator",value:":"}),Z++;continue}if(z===","){X.push({type:"delimiter",value:","}),Z++;continue}if(z==='"'){let Q="",Y=!1;z=$[++Z];while(z!=='"'){if(Z===$.length){Y=!0;break}if(z==="\\"){if(Z++,Z===$.length){Y=!0;break}Q+=z+$[Z],z=$[++Z]}else Q+=z,z=$[++Z]}if(z=$[++Z],!Y)X.push({type:"string",value:Q});continue}if(z&&/\s/.test(z)){Z++;continue}let G=/[0-9]/;if(z&&G.test(z)||z==="-"||z==="."){let Q="";if(z==="-")Q+=z,z=$[++Z];while(z&&G.test(z)||z===".")Q+=z,z=$[++Z];X.push({type:"number",value:Q});continue}let J=/[a-z]/i;if(z&&J.test(z)){let Q="";while(z&&J.test(z)){if(Z===$.length)break;Q+=z,z=$[++Z]}if(Q=="true"||Q=="false"||Q==="null")X.push({type:"name",value:Q});else{Z++;continue}continue}Z++}return X},O$=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),O$($);break;case"number":let X=Z.value[Z.value.length-1];if(X==="."||X==="-")return $=$.slice(0,$.length-1),O$($);case"string":let z=$[$.length-2];if(z?.type==="delimiter")return $=$.slice(0,$.length-1),O$($);else if(z?.type==="brace"&&z.value==="{")return $=$.slice(0,$.length-1),O$($);break;case"delimiter":return $=$.slice(0,$.length-1),O$($);break}return $},VW=($)=>{let Z=[];if($.map((X)=>{if(X.type==="brace")if(X.value==="{")Z.push("}");else Z.splice(Z.lastIndexOf("}"),1);if(X.type==="paren")if(X.value==="[")Z.push("]");else Z.splice(Z.lastIndexOf("]"),1)}),Z.length>0)Z.reverse().map((X)=>{if(X==="}")$.push({type:"brace",value:"}"});else if(X==="]")$.push({type:"paren",value:"]"})});return $},TW=($)=>{let Z="";return $.map((X)=>{switch(X.type){case"string":Z+='"'+X.value+'"';break;default:Z+=X.value;break}}),Z},h2=($)=>JSON.parse(TW(VW(O$(WW($)))));var l=function($,Z,X,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 Z==="function"?$!==Z||!q:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?q.call($,X):q?q.value=X:Z.set($,X),X},N=function($,Z,X,z){if(X==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!z:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?z:X==="a"?z.call($):z?z.value:Z.get($)},$0,b0,J1,g2,Q1,Y1,v2,U1,D0,H1,u2,m2,F$,d2,p2,u9,BZ,m9,d9,p9,l9,KZ,LZ="__json_buf";class W1{constructor(){$0.add(this),this.messages=[],this.receivedMessages=[],b0.set(this,void 0),this.controller=new AbortController,J1.set(this,void 0),g2.set(this,()=>{}),Q1.set(this,()=>{}),Y1.set(this,void 0),v2.set(this,()=>{}),U1.set(this,()=>{}),D0.set(this,{}),H1.set(this,!1),u2.set(this,!1),m2.set(this,!1),F$.set(this,!1),d2.set(this,void 0),p2.set(this,void 0),m9.set(this,($)=>{if(l(this,u2,!0,"f"),$ instanceof Error&&$.name==="AbortError")$=new p;if($ instanceof p)return l(this,m2,!0,"f"),this._emit("abort",$);if($ instanceof A)return this._emit("error",$);if($ instanceof Error){let Z=new A($.message);return Z.cause=$,this._emit("error",Z)}return this._emit("error",new A(String($)))}),l(this,J1,new Promise(($,Z)=>{l(this,g2,$,"f"),l(this,Q1,Z,"f")}),"f"),l(this,Y1,new Promise(($,Z)=>{l(this,v2,$,"f"),l(this,U1,Z,"f")}),"f"),N(this,J1,"f").catch(()=>{}),N(this,Y1,"f").catch(()=>{})}get response(){return N(this,d2,"f")}get request_id(){return N(this,p2,"f")}async withResponse(){let $=await N(this,J1,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new W1;return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X){let z=new W1;for(let q of Z.messages)z._addMessageParam(q);return z._run(()=>z._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),z}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},N(this,m9,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal;if(z){if(z.aborted)this.controller.abort();z.addEventListener("abort",()=>this.controller.abort())}N(this,$0,"m",d9).call(this);let{response:q,data:G}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(q);for await(let J of G)N(this,$0,"m",p9).call(this,J);if(G.controller.signal?.aborted)throw new p;N(this,$0,"m",l9).call(this)}_connected($){if(this.ended)return;l(this,d2,$,"f"),l(this,p2,$?.headers.get("request-id"),"f"),N(this,g2,"f").call(this,$),this._emit("connect")}get ended(){return N(this,H1,"f")}get errored(){return N(this,u2,"f")}get aborted(){return N(this,m2,"f")}abort(){this.controller.abort()}on($,Z){return(N(this,D0,"f")[$]||(N(this,D0,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=N(this,D0,"f")[$];if(!X)return this;let z=X.findIndex((q)=>q.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(N(this,D0,"f")[$]||(N(this,D0,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(l(this,F$,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){l(this,F$,!0,"f"),await N(this,Y1,"f")}get currentMessage(){return N(this,b0,"f")}async finalMessage(){return await this.done(),N(this,$0,"m",u9).call(this)}async finalText(){return await this.done(),N(this,$0,"m",BZ).call(this)}_emit($,...Z){if(N(this,H1,"f"))return;if($==="end")l(this,H1,!0,"f"),N(this,v2,"f").call(this);let X=N(this,D0,"f")[$];if(X)N(this,D0,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!N(this,F$,"f")&&!X?.length)Promise.reject(z);N(this,Q1,"f").call(this,z),N(this,U1,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!N(this,F$,"f")&&!X?.length)Promise.reject(z);N(this,Q1,"f").call(this,z),N(this,U1,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",N(this,$0,"m",u9).call(this))}async _fromReadableStream($,Z){let X=Z?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}N(this,$0,"m",d9).call(this),this._connected(null);let z=r.fromReadableStream($,this.controller);for await(let q of z)N(this,$0,"m",p9).call(this,q);if(z.controller.signal?.aborted)throw new p;N(this,$0,"m",l9).call(this)}[(b0=new WeakMap,J1=new WeakMap,g2=new WeakMap,Q1=new WeakMap,Y1=new WeakMap,v2=new WeakMap,U1=new WeakMap,D0=new WeakMap,H1=new WeakMap,u2=new WeakMap,m2=new WeakMap,F$=new WeakMap,d2=new WeakMap,p2=new WeakMap,m9=new WeakMap,$0=new WeakSet,u9=function(){if(this.receivedMessages.length===0)throw new A("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},BZ=function(){if(this.receivedMessages.length===0)throw new A("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new A("stream ended without producing a content block with type=text");return Z.join(" ")},d9=function(){if(this.ended)return;l(this,b0,void 0,"f")},p9=function(Z){if(this.ended)return;let X=N(this,$0,"m",KZ).call(this,Z);switch(this._emit("streamEvent",Z,X),Z.type){case"content_block_delta":{let z=X.content.at(-1);switch(Z.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",Z.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",Z.delta.citation,z.citations??[]);break}case"input_json_delta":{if(z.type==="tool_use"&&z.input)this._emit("inputJson",Z.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",Z.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}default:DZ(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(X,!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{l(this,b0,X,"f");break}case"content_block_start":case"message_delta":break}},l9=function(){if(this.ended)throw new A("stream has ended, this shouldn't happen");let Z=N(this,b0,"f");if(!Z)throw new A("request ended without sending any chunks");return l(this,b0,void 0,"f"),Z},KZ=function(Z){let X=N(this,b0,"f");if(Z.type==="message_start"){if(X)throw new A(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new A(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":return X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,X;case"content_block_start":return X.content.push(Z.content_block),X;case"content_block_delta":{let z=X.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(z?.type==="text")z.text+=Z.delta.text;break}case"citations_delta":{if(z?.type==="text")z.citations??(z.citations=[]),z.citations.push(Z.delta.citation);break}case"input_json_delta":{if(z?.type==="tool_use"){let q=z[LZ]||"";if(q+=Z.delta.partial_json,Object.defineProperty(z,LZ,{value:q,enumerable:!1,writable:!0}),q)z.input=h2(q)}break}case"thinking_delta":{if(z?.type==="thinking")z.thinking+=Z.delta.thinking;break}case"signature_delta":{if(z?.type==="thinking")z.signature=Z.delta.signature;break}default:DZ(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let q=Z.shift();if(q)q.resolve(z);else $.push(z)}),this.on("end",()=>{X=!0;for(let z of Z)z.resolve(void 0);Z.length=0}),this.on("abort",(z)=>{X=!0;for(let q of Z)q.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let q of Z)q.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((q,G)=>Z.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 r(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function DZ($){}var _Z={"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 n0 extends d{constructor(){super(...arguments);this.batches=new _$(this._client)}create($,Z){let{betas:X,...z}=$;if(z.model in _Z)console.warn(`The model '${z.model}' is deprecated and will reach end-of-life on ${_Z[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)),...Z,headers:{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0,...Z?.headers},stream:$.stream??!1})}stream($,Z){return W1.createMessage(this,$,Z)}countTokens($,Z){let{betas:X,...z}=$;return this._client.post("/v1/messages/count_tokens?beta=true",{body:z,...Z,headers:{"anthropic-beta":[...X??[],"token-counting-2024-11-01"].toString(),...Z?.headers}})}}n0.Batches=_$;n0.BetaMessageBatchesPage=G1;class _0 extends d{constructor(){super(...arguments);this.models=new L$(this._client),this.messages=new n0(this._client)}}_0.Models=L$;_0.BetaModelInfosPage=q1;_0.Messages=n0;class M$ extends d{create($,Z){return this._client.post("/v1/complete",{body:$,timeout:this._client._options.timeout??600000,...Z,stream:$.stream??!1})}}class w$ extends d{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(`/v1/messages/batches/${$}`,Z)}list($={},Z){if(e($))return this.list({},$);return this._client.getAPIList("/v1/messages/batches",V1,{query:$,...Z})}delete($,Z){return this._client.delete(`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let X=await this.retrieve($);if(!X.results_url)throw new A(`No batch \`results_url\`; Has it finished processing? ${X.processing_status} - ${X.id}`);return this._client.get(X.results_url,{...Z,headers:{Accept:"application/binary",...Z?.headers},__binaryResponse:!0})._thenUnwrap((z,q)=>D$.fromResponse(q.response,q.controller))}}class V1 extends L0{}w$.MessageBatchesPage=V1;var c=function($,Z,X,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 Z==="function"?$!==Z||!q:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?q.call($,X):q?q.value=X:Z.set($,X),X},j=function($,Z,X,z){if(X==="a"&&!z)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?$!==Z||!z:!Z.has($))throw TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?z:X==="a"?z.call($):z?z.value:Z.get($)},Z0,y0,T1,l2,B1,K1,c2,L1,O0,D1,i2,a2,P$,n2,s2,c9,OZ,i9,a9,n9,s9,FZ,MZ="__json_buf";class _1{constructor(){Z0.add(this),this.messages=[],this.receivedMessages=[],y0.set(this,void 0),this.controller=new AbortController,T1.set(this,void 0),l2.set(this,()=>{}),B1.set(this,()=>{}),K1.set(this,void 0),c2.set(this,()=>{}),L1.set(this,()=>{}),O0.set(this,{}),D1.set(this,!1),i2.set(this,!1),a2.set(this,!1),P$.set(this,!1),n2.set(this,void 0),s2.set(this,void 0),i9.set(this,($)=>{if(c(this,i2,!0,"f"),$ instanceof Error&&$.name==="AbortError")$=new p;if($ instanceof p)return c(this,a2,!0,"f"),this._emit("abort",$);if($ instanceof A)return this._emit("error",$);if($ instanceof Error){let Z=new A($.message);return Z.cause=$,this._emit("error",Z)}return this._emit("error",new A(String($)))}),c(this,T1,new Promise(($,Z)=>{c(this,l2,$,"f"),c(this,B1,Z,"f")}),"f"),c(this,K1,new Promise(($,Z)=>{c(this,c2,$,"f"),c(this,L1,Z,"f")}),"f"),j(this,T1,"f").catch(()=>{}),j(this,K1,"f").catch(()=>{})}get response(){return j(this,n2,"f")}get request_id(){return j(this,s2,"f")}async withResponse(){let $=await j(this,T1,"f");if(!$)throw Error("Could not resolve a `Response` object");return{data:this,response:$,request_id:$.headers.get("request-id")}}static fromReadableStream($){let Z=new _1;return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X){let z=new _1;for(let q of Z.messages)z._addMessageParam(q);return z._run(()=>z._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),z}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},j(this,i9,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal;if(z){if(z.aborted)this.controller.abort();z.addEventListener("abort",()=>this.controller.abort())}j(this,Z0,"m",a9).call(this);let{response:q,data:G}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(q);for await(let J of G)j(this,Z0,"m",n9).call(this,J);if(G.controller.signal?.aborted)throw new p;j(this,Z0,"m",s9).call(this)}_connected($){if(this.ended)return;c(this,n2,$,"f"),c(this,s2,$?.headers.get("request-id"),"f"),j(this,l2,"f").call(this,$),this._emit("connect")}get ended(){return j(this,D1,"f")}get errored(){return j(this,i2,"f")}get aborted(){return j(this,a2,"f")}abort(){this.controller.abort()}on($,Z){return(j(this,O0,"f")[$]||(j(this,O0,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=j(this,O0,"f")[$];if(!X)return this;let z=X.findIndex((q)=>q.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(j(this,O0,"f")[$]||(j(this,O0,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(c(this,P$,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){c(this,P$,!0,"f"),await j(this,K1,"f")}get currentMessage(){return j(this,y0,"f")}async finalMessage(){return await this.done(),j(this,Z0,"m",c9).call(this)}async finalText(){return await this.done(),j(this,Z0,"m",OZ).call(this)}_emit($,...Z){if(j(this,D1,"f"))return;if($==="end")c(this,D1,!0,"f"),j(this,c2,"f").call(this);let X=j(this,O0,"f")[$];if(X)j(this,O0,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!j(this,P$,"f")&&!X?.length)Promise.reject(z);j(this,B1,"f").call(this,z),j(this,L1,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!j(this,P$,"f")&&!X?.length)Promise.reject(z);j(this,B1,"f").call(this,z),j(this,L1,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",j(this,Z0,"m",c9).call(this))}async _fromReadableStream($,Z){let X=Z?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}j(this,Z0,"m",a9).call(this),this._connected(null);let z=r.fromReadableStream($,this.controller);for await(let q of z)j(this,Z0,"m",n9).call(this,q);if(z.controller.signal?.aborted)throw new p;j(this,Z0,"m",s9).call(this)}[(y0=new WeakMap,T1=new WeakMap,l2=new WeakMap,B1=new WeakMap,K1=new WeakMap,c2=new WeakMap,L1=new WeakMap,O0=new WeakMap,D1=new WeakMap,i2=new WeakMap,a2=new WeakMap,P$=new WeakMap,n2=new WeakMap,s2=new WeakMap,i9=new WeakMap,Z0=new WeakSet,c9=function(){if(this.receivedMessages.length===0)throw new A("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},OZ=function(){if(this.receivedMessages.length===0)throw new A("stream ended without producing a Message with role=assistant");let Z=this.receivedMessages.at(-1).content.filter((X)=>X.type==="text").map((X)=>X.text);if(Z.length===0)throw new A("stream ended without producing a content block with type=text");return Z.join(" ")},a9=function(){if(this.ended)return;c(this,y0,void 0,"f")},n9=function(Z){if(this.ended)return;let X=j(this,Z0,"m",FZ).call(this,Z);switch(this._emit("streamEvent",Z,X),Z.type){case"content_block_delta":{let z=X.content.at(-1);switch(Z.delta.type){case"text_delta":{if(z.type==="text")this._emit("text",Z.delta.text,z.text||"");break}case"citations_delta":{if(z.type==="text")this._emit("citation",Z.delta.citation,z.citations??[]);break}case"input_json_delta":{if(z.type==="tool_use"&&z.input)this._emit("inputJson",Z.delta.partial_json,z.input);break}case"thinking_delta":{if(z.type==="thinking")this._emit("thinking",Z.delta.thinking,z.thinking);break}case"signature_delta":{if(z.type==="thinking")this._emit("signature",z.signature);break}default:wZ(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(X,!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{c(this,y0,X,"f");break}case"content_block_start":case"message_delta":break}},s9=function(){if(this.ended)throw new A("stream has ended, this shouldn't happen");let Z=j(this,y0,"f");if(!Z)throw new A("request ended without sending any chunks");return c(this,y0,void 0,"f"),Z},FZ=function(Z){let X=j(this,y0,"f");if(Z.type==="message_start"){if(X)throw new A(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new A(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":return X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,X;case"content_block_start":return X.content.push(Z.content_block),X;case"content_block_delta":{let z=X.content.at(Z.index);switch(Z.delta.type){case"text_delta":{if(z?.type==="text")z.text+=Z.delta.text;break}case"citations_delta":{if(z?.type==="text")z.citations??(z.citations=[]),z.citations.push(Z.delta.citation);break}case"input_json_delta":{if(z?.type==="tool_use"){let q=z[MZ]||"";if(q+=Z.delta.partial_json,Object.defineProperty(z,MZ,{value:q,enumerable:!1,writable:!0}),q)z.input=h2(q)}break}case"thinking_delta":{if(z?.type==="thinking")z.thinking+=Z.delta.thinking;break}case"signature_delta":{if(z?.type==="thinking")z.signature=Z.delta.signature;break}default:wZ(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let q=Z.shift();if(q)q.resolve(z);else $.push(z)}),this.on("end",()=>{X=!0;for(let z of Z)z.resolve(void 0);Z.length=0}),this.on("abort",(z)=>{X=!0;for(let q of Z)q.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let q of Z)q.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((q,G)=>Z.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 r(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}function wZ($){}class x0 extends d{constructor(){super(...arguments);this.batches=new w$(this._client)}create($,Z){if($.model in PZ)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${PZ[$.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)),...Z,stream:$.stream??!1})}stream($,Z){return _1.createMessage(this,$,Z)}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}}var PZ={"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"};x0.Batches=w$;x0.MessageBatchesPage=V1;class s0 extends d{retrieve($,Z){return this._client.get(`/v1/models/${$}`,Z)}list($={},Z){if(e($))return this.list({},$);return this._client.getAPIList("/v1/models",R$,{query:$,...Z})}}class R$ extends L0{}s0.ModelInfosPage=R$;var RZ;class x extends g9{constructor({baseURL:$=f2("ANTHROPIC_BASE_URL"),apiKey:Z=f2("ANTHROPIC_API_KEY")??null,authToken:X=f2("ANTHROPIC_AUTH_TOKEN")??null,...z}={}){let q={apiKey:Z,authToken:X,...z,baseURL:$||"https://api.anthropic.com"};if(!q.dangerouslyAllowBrowser&&TZ())throw new A(`It looks like you're running in a browser-like environment.
199
199
 
200
200
  This is disabled by default, as it risks exposing your secret API credentials to attackers.
201
201
  If you understand the risks and have appropriate mitigations in place,
202
202
  you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
203
203
 
204
204
  new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
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=`
205
+ `);super({baseURL:q.baseURL,timeout:q.timeout??600000,httpAgent:q.httpAgent,maxRetries:q.maxRetries,fetch:q.fetch});this.completions=new M$(this),this.messages=new x0(this),this.models=new s0(this),this.beta=new _0(this),this._options=q,this.apiKey=Z,this.authToken=X}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($,Z){if(this.apiKey&&$["x-api-key"])return;if(Z["x-api-key"]===null)return;if(this.authToken&&$.authorization)return;if(Z.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}`}}}RZ=x;x.Anthropic=RZ;x.HUMAN_PROMPT=`
206
206
 
207
- Human:`;b.AI_PROMPT=`
207
+ Human:`;x.AI_PROMPT=`
208
208
 
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}">
209
+ Assistant:`;x.DEFAULT_TIMEOUT=600000;x.AnthropicError=A;x.APIError=u;x.APIConnectionError=i0;x.APIConnectionTimeoutError=Z1;x.APIUserAbortError=p;x.NotFoundError=A2;x.ConflictError=N2;x.RateLimitError=S2;x.BadRequestError=P2;x.AuthenticationError=R2;x.InternalServerError=C2;x.PermissionDeniedError=I2;x.UnprocessableEntityError=j2;x.toFile=zZ;x.fileFromPath=w2;x.Completions=M$;x.Messages=x0;x.Models=s0;x.ModelInfosPage=R$;x.Beta=_0;var IZ=x;function I$($,Z,X){let z=Z.length>0?Z.map((J)=>`- ${J.id}: ${J.name} (${J.source})`).join(`
210
+ `):"(no sources provided)",q=Z.map((J)=>`<source id="${J.id}">
211
211
  ${J.content.trimEnd()}
212
212
  </source>`).join(`
213
213
 
214
- `),G=Z.length>0?`The scenario REQUIRES citations from: ${Z.join(", ")}.`:"No specific source is required, but every claim must cite a registered source.";return`You are answering a question about the tool "${$.name}": ${$.description}.
214
+ `),G=X.length>0?`The scenario REQUIRES citations from: ${X.join(", ")}.`:"No specific source is required, but every claim must cite a registered source.";return`You are answering a question about the tool "${$.name}": ${$.description}.
215
215
 
216
216
  Answer using ONLY information from the provided sources below. Do not draw on general knowledge.
217
217
 
@@ -231,19 +231,19 @@ End your response with a "## Sources" section that lists every source you actual
231
231
  Rules:
232
232
  - Only cite IDs that appear in the inventory above. Do not invent IDs.
233
233
  - If you cannot answer from the provided sources, say so explicitly and write an empty "## Sources" section (just the heading, no bullets).
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)}
234
+ - The "## Sources" heading must be the last heading in your response.`}class r9{category="api";provider="anthropic";name;config;clientFactory;constructor($,Z,X){this.name=$,this.config=Z,this.clientFactory=X??(()=>new IZ)}async run($,Z){let{tool:X,docs:z,requiredSources:q}=Z;if(!this.config.model)throw Error(`API target "${this.name}" missing 'model'. API targets must declare an explicit model.`);let G=I$(X,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=DW(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 DW($){if(!Array.isArray($))return"";let Z=[];for(let X of $)if(X.type==="text"&&typeof X.text==="string")Z.push(X.text);return Z.join("")}import{query as _W}from"@anthropic-ai/claude-agent-sdk";class o9{category="cli";provider="claude-code";name;config;constructor($,Z){this.name=$,this.config=Z}async run($,Z){let{tool:X,cwd:z,context:q,docs:G,requiredSources:J}=Z,Q=[],Y=[],U=I$(X,G,J),W={cwd:z,model:this.config.model??"sonnet",systemPrompt:U,allowedTools:q?.allowedTools??this.config.allowedTools??W4,disallowedTools:q?.disallowedTools??this.config.disallowedTools??V4,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 _W({prompt:$,options:W})){if(L.type==="assistant"){let T=L.message?.content;if(Array.isArray(T)){let K="";for(let D of T){if(D.type==="text")K+=D.text;if(D.type==="tool_use"){let O=D;if(!Q.includes(O.name))Q.push(O.name)}}if(K){let D=H.length===0?"initial":"intermediate";H.push({type:D,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 OW}from"crypto";import{rm as FW}from"fs/promises";import{tmpdir as MW}from"os";import{join as wW}from"path";var PW="codex";class t9{category="cli";provider="codex-cli";name;config;spawnFn;readFileFn;binary;constructor($,Z,X={}){this.name=$,this.config=Z,this.spawnFn=X.spawn??NW,this.readFileFn=X.readFile??jW,this.binary=X.binary??PW}async run($,Z){let{tool:X,cwd:z,docs:q,requiredSources:G}=Z,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=`${I$(X,q,G)}
235
235
 
236
236
  ---
237
237
 
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
238
+ ${$}`,U=wW(MW(),`pickled-codex-${OW()}.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}=RW(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 FW(U,{force:!0})}}}function RW($){let Z=[],X=[];for(let z of $.split(`
239
+ `)){let q=z.trim();if(!q)continue;let G;try{G=JSON.parse(q)}catch{continue}let J=IW(G);if(J){let Y=Z.length===0?"initial":"intermediate";Z.push({type:Y,text:J})}let Q=AW(G);if(Q&&!X.includes(Q))X.push(Q)}return{allResponses:Z,toolsUsed:X}}function IW($){if(!$||typeof $!=="object")return null;let Z=$;if(typeof Z.message==="string")return Z.message;if(typeof Z.content==="string")return Z.content;if(typeof Z.type==="string"&&(Z.type==="assistant_message"||Z.type==="agent_message")&&typeof Z.text==="string")return Z.text;if(Z.type==="message"&&typeof Z.text==="string")return Z.text;return null}function AW($){if(!$||typeof $!=="object")return null;let Z=$;if(typeof Z.tool==="string")return Z.tool;if(typeof Z.type==="string"&&(Z.type==="tool_call"||Z.type==="function_call")&&typeof Z.name==="string")return Z.name;return null}var NW=async($,Z,X)=>{let z=Bun.spawn([$,...Z],{cwd:X.cwd,stdin:"pipe",stdout:"pipe",stderr:"pipe"});z.stdin.write(X.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}},jW=async($)=>{let Z=Bun.file($);if(!await Z.exists())throw Error(`Last-message file not found: ${$}`);return Z.text()};function r2($,Z){let X=Z??Q0;switch(X.category){case"cli":return SW($,X);case"api":return CW($,X);case"ide":throw Error("IDE targets not yet implemented. Coming soon!");default:throw Error(`Unknown target category: ${X.category}`)}}function SW($,Z){switch(Z.provider){case"claude-code":return new o9($,Z);case"codex-cli":return new t9($,Z);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: ${Z.provider}`)}}function CW($,Z){switch(Z.provider){case"anthropic":return new r9($,Z);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: ${Z.provider}`)}}var A$="default";function o2($,Z){if(!$||$===A$)return{name:A$,config:Q0};if(Z?.[$])return{name:$,config:Z[$]};return console.warn(`Target "${$}" not found, using default`),{name:A$,config:Q0}}function e9($,Z){if(!$||$===A$)return{name:A$,config:{}};if(Z?.[$])return{name:$,config:Z[$]};return console.warn(`Context "${$}" not found, using default`),{name:A$,config:{}}}var $5="__matrix__";function EW($){let Z=[],X=$.matrix?.target??["default"],z=$.matrix?.context??["default"];for(let q of $.scenarios){let G=q.context?[q.context]:z;if(q.matrix){for(let Q of G)Z.push({scenario:q,targetName:$5,contextName:Q});continue}let J=q.target?[q.target]:X;for(let Q of J)for(let Y of G)Z.push({scenario:q,targetName:Q,contextName:Y})}return Z}async function Z5($,Z,X={}){let{onProgress:z}=X,q=[];if(Z.scenarios.length===0)throw Error("No scenarios defined in config");let G=Z.docs?.sources??{},J=[];if(Object.keys(G).length>0){z?.("Loading sources..."),J=await $1(G,$.path);for(let W of J)z?.(` [${W.id}] ${W.name}`);z?.("")}let Q=J.map((W)=>W.id),Y=EW(Z);if(X.scenarioFilter&&X.scenarioFilter.length>0){let W=new Set(X.scenarioFilter);if(Y=Y.filter((H)=>W.has(H.scenario.name)),Y.length===0)throw Error(`No scenarios matched filter: ${[...W].join(", ")}. Declared scenarios: ${Z.scenarios.map((H)=>H.name).join(", ")}`)}let U="";for(let{scenario:W,targetName:H,contextName:V}of Y){let B=bW(H,V);if(W.name!==U){if(U)z?.("");z?.(`"${W.name}"`),U=W.name}try{let L=await yW(W,H,V,$,Z,J,Q,X);q.push(L);let T=B?B.padEnd(18):"";if(L.cells){z?.(` ${T} (matrix mode)`);for(let K of L.cells){let D=K0(K),M=` [${[K.cell.interface,K.cell.source??"-",K.cell.toolset].join(" \xB7 ")}]`.padEnd(40);z?.(`${M} ${D.icon} ${D.label} (${D.confidence}%)`)}}else if(L.surfaces){z?.(` ${T} (compare-surfaces mode)`);for(let K of L.surfaces){let D=K0(K),O=` [${K.active.join(",")}]`.padEnd(22);z?.(`${O} ${D.icon} ${D.label} (${D.confidence}%)`)}}else{let K=K0({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:Z.targets?.[H]??Q0,K=W.requiredSources??[],D={scenario:W,answerable:"NO",confidence:0,response:"",reason:"Error during run",citations:{cited:[],required:K,missing:K,unknown:[]},traps:{fired:[],avoided:(W.traps??[]).map((M)=>M.id)},error:L instanceof Error?L.message:String(L),target:{target:H===$5?"matrix":H,category:T.category,provider:T.provider,model:T.model??"unknown"},context:{name:V}};q.push(D);let O=B?B.padEnd(18):"";z?.(` ${O} \u2717 Error`)}}return z?.(""),xW($,J,q)}function bW($,Z){if($==="default"&&Z==="default")return"";if(Z==="default")return`[${$}]`;return`[${$}/${Z}]`}async function yW($,Z,X,z,q,G,J,Q){if($.matrix&&Z===$5)return kW($,X,z,q,G,Q);let{config:Y}=o2(Z,q.targets),{config:U}=e9(X,q.contexts),W=Q.targetFactory?Q.targetFactory(Z,Y):r2(Z,Y);if($.compareSurfaces&&$.compareSurfaces.length>0){let w=[],I;for(let R of $.compareSurfaces){let C=new Set(R),F=G.filter((J0)=>C.has(J0.id)),i=($.requiredSources??[]).filter((J0)=>C.has(J0)),a=await W.run($.prompt,{tool:z,cwd:z.path,context:U,docs:F,requiredSources:i,onProgress:Q.onProgress}),b=B$({response:a.response,requiredSources:i,registeredIds:R}),h=C0({response:a.response,traps:$.traps??[]}),F0=h.fired.length>0,r0=F0?"NO":b.answerable,o0=F0?0:b.confidence,m=F0?`Trap fired: ${h.fired.map((J0)=>`"${J0.id}" (${J0.reason})`).join("; ")}`:b.reason;w.push({active:R,answerable:r0,confidence:o0,response:a.response,reason:m,citations:b.citations,traps:h,allResponses:a.allResponses}),I=a.metadata??I}return{scenario:$,answerable:null,confidence:null,response:null,reason:null,citations:null,traps:null,surfaces:w,target:I,context:{name:X}}}let H=$.requiredSources??[],V=await W.run($.prompt,{tool:z,cwd:z.path,context:U,docs:G,requiredSources:H,onProgress:Q.onProgress}),B=C0({response:V.response,traps:$.traps??[]}),L=B.fired.length>0,T=$.requiredSources!==void 0?B$({response:V.response,requiredSources:H,registeredIds:J}):null,K=$.expected!==void 0?F2({response:V.response,expected:$.expected}):null,D,O,M;if(L)D="NO",O=0,M=`Trap fired: ${B.fired.map((w)=>`"${w.id}" (${w.reason})`).join("; ")}`;else{let w=[],I=[];if(T)w.push({answerable:T.answerable,confidence:T.confidence}),I.push(T.reason);if(K){let R=K.total===0?100:Math.round(K.satisfied/K.total*100),C=R===100?"YES":R===0?"NO":"PARTIAL";w.push({answerable:C,confidence:R})}if(w.length===0)D="YES",O=100,M="No traps fired; no other contract declared";else{let R={YES:0,PARTIAL:1,NO:2};D=w.reduce((F,E)=>R[E.answerable]>R[F.answerable]?E:F).answerable,O=Math.round(w.reduce((F,E)=>F+E.confidence,0)/w.length),M=I.filter((F)=>F.length>0).join(" | ")}}return{scenario:$,answerable:D,confidence:O,response:V.response,reason:M,citations:T?T.citations:{cited:[],required:H,missing:[],unknown:[]},traps:B,target:V.metadata,context:{name:X},toolsUsed:V.toolsUsed,sources:V.sources,allResponses:V.allResponses}}function xW($,Z,X){let z=[];for(let Q of X){if(Q.surfaces){for(let Y of Q.surfaces)z.push({answerable:Y.answerable,confidence:Y.confidence});continue}if(Q.cells){for(let Y of Q.cells)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:Z,scenarios:X,summary:{total:q,answered:G,unanswered:q-G,score:J}}}async function kW($,Z,X,z,q,G){let{config:J}=e9(Z,z.contexts),Q=$.matrix??{},Y=$.target??"default",U=Q.interfaces??[Y],W=Q.sources??[null],H=Q.toolsets??["none"],V=G.cellFilter??{},B=[],L;for(let K of U){if(V.interface&&V.interface!==K)continue;for(let D of W){if(V.source!==void 0&&V.source!==(D??""))continue;for(let O of H){if(V.toolset&&V.toolset!==O)continue;if(O!=="none")throw Error(`Toolset "${O}" is declared but not yet implemented in this CLI version. v0.16.0 supports only "none" (the deterministic baseline cell). Tool-enabled adapters (WebSearch+WebFetch, Context7 MCP, Firecrawl, native API search) land in follow-up commits.`);let{config:M}=o2(K,z.targets),w=G.targetFactory?G.targetFactory(K,M):r2(K,M),I=D===null?q:q.filter((m)=>m.id===D),R=D===null?q.map((m)=>m.id):[D],F=($.requiredSources??[]).filter((m)=>R.includes(m)),E=await w.run($.prompt,{tool:X,cwd:X.path,context:J,docs:I,requiredSources:F,onProgress:G.onProgress}),i=C0({response:E.response,traps:$.traps??[]}),a=i.fired.length>0,b=$.requiredSources!==void 0?B$({response:E.response,requiredSources:F,registeredIds:R}):null,h=$.expected!==void 0?F2({response:E.response,expected:$.expected}):null,F0,r0,o0;if(a)F0="NO",r0=0,o0=`Trap fired: ${i.fired.map((m)=>`"${m.id}" (${m.reason})`).join("; ")}`;else{let m=[],J0=[];if(b)m.push({answerable:b.answerable,confidence:b.confidence}),J0.push(b.reason);if(h){let t0=h.total===0?100:Math.round(h.satisfied/h.total*100),H5=t0===100?"YES":t0===0?"NO":"PARTIAL";m.push({answerable:H5,confidence:t0});let H0=h.includes.filter((f0)=>!f0.satisfied).map((f0)=>`"${f0.value}"`),k0=h.excludes.filter((f0)=>!f0.satisfied).map((f0)=>`"${f0.value}"`),M1=[];if(H0.length>0)M1.push(`missing includes: ${H0.join(", ")}`);if(k0.length>0)M1.push(`hit excludes: ${k0.join(", ")}`);J0.push(M1.length>0?M1.join("; "):`expected checks satisfied (${h.satisfied}/${h.total})`)}if(m.length===0)F0="YES",r0=100,o0="No traps fired; no other contract declared";else{let t0={YES:0,PARTIAL:1,NO:2};F0=m.reduce((H0,k0)=>t0[k0.answerable]>t0[H0.answerable]?k0:H0).answerable,r0=Math.round(m.reduce((H0,k0)=>H0+k0.confidence,0)/m.length),o0=J0.filter((H0)=>H0.length>0).join(" | ")}}B.push({cell:{interface:K,source:D,toolset:O},answerable:F0,confidence:r0,response:E.response,reason:o0,citations:b?b.citations:null,traps:i,expected:h?{includes:h.includes,excludes:h.excludes,satisfied:h.satisfied,total:h.total}:void 0,allResponses:E.allResponses}),L=E.metadata??L}}}let T=fW($,q);return{scenario:$,answerable:null,confidence:null,response:null,reason:null,citations:null,traps:null,cells:B,verifierSamples:T,target:L,context:{name:Z}}}function fW($,Z){let X=$.verifiers?.sources;if(!X||X.length===0)return;let z=new Map(Z.map((G)=>[G.id,G])),q=[];for(let G of X){let J=z.get(G);if(!J)continue;q.push({id:J.id,name:J.name,content:J.content})}return q.length>0?q:void 0}var AZ=($=0)=>(Z)=>`\x1B[${Z+$}m`,NZ=($=0)=>(Z)=>`\x1B[${38+$};5;${Z}m`,jZ=($=0)=>(Z,X,z)=>`\x1B[${38+$};2;${Z};${X};${z}m`,k={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]}},xL=Object.keys(k.modifier),hW=Object.keys(k.color),gW=Object.keys(k.bgColor),kL=[...hW,...gW];function vW(){let $=new Map;for(let[Z,X]of Object.entries(k)){for(let[z,q]of Object.entries(X))k[z]={open:`\x1B[${q[0]}m`,close:`\x1B[${q[1]}m`},X[z]=k[z],$.set(q[0],q[1]);Object.defineProperty(k,Z,{value:X,enumerable:!1})}return Object.defineProperty(k,"codes",{value:$,enumerable:!1}),k.color.close="\x1B[39m",k.bgColor.close="\x1B[49m",k.color.ansi=AZ(),k.color.ansi256=NZ(),k.color.ansi16m=jZ(),k.bgColor.ansi=AZ(10),k.bgColor.ansi256=NZ(10),k.bgColor.ansi16m=jZ(10),Object.defineProperties(k,{rgbToAnsi256:{value(Z,X,z){if(Z===X&&X===z){if(Z<8)return 16;if(Z>248)return 231;return Math.round((Z-8)/247*24)+232}return 16+36*Math.round(Z/255*5)+6*Math.round(X/255*5)+Math.round(z/255*5)},enumerable:!1},hexToRgb:{value(Z){let X=/[a-f\d]{6}|[a-f\d]{3}/i.exec(Z.toString(16));if(!X)return[0,0,0];let[z]=X;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:(Z)=>k.rgbToAnsi256(...k.hexToRgb(Z)),enumerable:!1},ansi256ToAnsi:{value(Z){if(Z<8)return 30+Z;if(Z<16)return 90+(Z-8);let X,z,q;if(Z>=232)X=((Z-232)*10+8)/255,z=X,q=X;else{Z-=16;let Q=Z%36;X=Math.floor(Z/36)/5,z=Math.floor(Q/6)/5,q=Q%6/5}let G=Math.max(X,z,q)*2;if(G===0)return 30;let J=30+(Math.round(q)<<2|Math.round(z)<<1|Math.round(X));if(G===2)J+=60;return J},enumerable:!1},rgbToAnsi:{value:(Z,X,z)=>k.ansi256ToAnsi(k.rgbToAnsi256(Z,X,z)),enumerable:!1},hexToAnsi:{value:(Z)=>k.ansi256ToAnsi(k.hexToAnsi256(Z)),enumerable:!1}}),k}var uW=vW(),G0=uW;import X5 from"process";import mW from"os";import SZ from"tty";function X0($,Z=globalThis.Deno?globalThis.Deno.args:X5.argv){let X=$.startsWith("-")?"":$.length===1?"-":"--",z=Z.indexOf(X+$),q=Z.indexOf("--");return z!==-1&&(q===-1||z<q)}var{env:f}=X5,t2;if(X0("no-color")||X0("no-colors")||X0("color=false")||X0("color=never"))t2=0;else if(X0("color")||X0("colors")||X0("color=true")||X0("color=always"))t2=1;function dW(){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 pW($){if($===0)return!1;return{level:$,hasBasic:!0,has256:$>=2,has16m:$>=3}}function lW($,{streamIsTTY:Z,sniffFlags:X=!0}={}){let z=dW();if(z!==void 0)t2=z;let q=X?t2:z;if(q===0)return 0;if(X){if(X0("color=16m")||X0("color=full")||X0("color=truecolor"))return 3;if(X0("color=256"))return 2}if("TF_BUILD"in f&&"AGENT_NAME"in f)return 1;if($&&!Z&&q===void 0)return 0;let G=q||0;if(f.TERM==="dumb")return G;if(X5.platform==="win32"){let J=mW.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 CZ($,Z={}){let X=lW($,{streamIsTTY:$&&$.isTTY,...Z});return pW(X)}var cW={stdout:CZ({isTTY:SZ.isatty(1)}),stderr:CZ({isTTY:SZ.isatty(2)})},EZ=cW;function bZ($,Z,X){let z=$.indexOf(Z);if(z===-1)return $;let q=Z.length,G=0,J="";do J+=$.slice(G,z)+Z+X,G=z+q,z=$.indexOf(Z,G);while(z!==-1);return J+=$.slice(G),J}function yZ($,Z,X,z){let q=0,G="";do{let J=$[z-1]==="\r";G+=$.slice(q,J?z-1:z)+Z+(J?`\r
240
240
  `:`
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
241
+ `)+X,q=z+1,z=$.indexOf(`
242
+ `,q)}while(z!==-1);return G+=$.slice(q),G}var{stdout:xZ,stderr:kZ}=EZ,z5=Symbol("GENERATOR"),N$=Symbol("STYLER"),O1=Symbol("IS_EMPTY"),fZ=["ansi","ansi","ansi256","ansi16m"],j$=Object.create(null),iW=($,Z={})=>{if(Z.level&&!(Number.isInteger(Z.level)&&Z.level>=0&&Z.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let X=xZ?xZ.level:0;$.level=Z.level===void 0?X:Z.level};var aW=($)=>{let Z=(...X)=>X.join(" ");return iW(Z,$),Object.setPrototypeOf(Z,F1.prototype),Z};function F1($){return aW($)}Object.setPrototypeOf(F1.prototype,Function.prototype);for(let[$,Z]of Object.entries(G0))j$[$]={get(){let X=e2(this,G5(Z.open,Z.close,this[N$]),this[O1]);return Object.defineProperty(this,$,{value:X}),X}};j$.visible={get(){let $=e2(this,this[N$],!0);return Object.defineProperty(this,"visible",{value:$}),$}};var q5=($,Z,X,...z)=>{if($==="rgb"){if(Z==="ansi16m")return G0[X].ansi16m(...z);if(Z==="ansi256")return G0[X].ansi256(G0.rgbToAnsi256(...z));return G0[X].ansi(G0.rgbToAnsi(...z))}if($==="hex")return q5("rgb",Z,X,...G0.hexToRgb(...z));return G0[X][$](...z)},nW=["rgb","hex","ansi256"];for(let $ of nW){j$[$]={get(){let{level:X}=this;return function(...z){let q=G5(q5($,fZ[X],"color",...z),G0.color.close,this[N$]);return e2(this,q,this[O1])}}};let Z="bg"+$[0].toUpperCase()+$.slice(1);j$[Z]={get(){let{level:X}=this;return function(...z){let q=G5(q5($,fZ[X],"bgColor",...z),G0.bgColor.close,this[N$]);return e2(this,q,this[O1])}}}}var sW=Object.defineProperties(()=>{},{...j$,level:{enumerable:!0,get(){return this[z5].level},set($){this[z5].level=$}}}),G5=($,Z,X)=>{let z,q;if(X===void 0)z=$,q=Z;else z=X.openAll+$,q=Z+X.closeAll;return{open:$,close:Z,openAll:z,closeAll:q,parent:X}},e2=($,Z,X)=>{let z=(...q)=>rW(z,q.length===1?""+q[0]:q.join(" "));return Object.setPrototypeOf(z,sW),z[z5]=$,z[N$]=Z,z[O1]=X,z},rW=($,Z)=>{if($.level<=0||!Z)return $[O1]?"":Z;let X=$[N$];if(X===void 0)return Z;let{openAll:z,closeAll:q}=X;if(Z.includes("\x1B"))while(X!==void 0)Z=bZ(Z,X.close,X.open),X=X.parent;let G=Z.indexOf(`
243
+ `);if(G!==-1)Z=yZ(Z,q,z,G);return z+Z+q};Object.defineProperties(F1.prototype,j$);var oW=F1(),cL=F1({level:kZ?kZ.level:0});var P=oW;var hZ="\u2500".repeat(55);function J5($){if($==="success")return P.green;if($==="warning")return P.yellow;return P.red}function tW($){if($>=70)return P.green;if($>=50)return P.yellow;return P.red}function Q5($){if($.label==="Error")return $.label;return`${$.label} (${$.confidence}%)`}function eW($){let Z=K0({answerable:$.answerable??"NO",confidence:$.confidence??0,traps:$.traps??{fired:[],avoided:[]},error:$.error}),X=J5(Z.tone);return{icon:X(Z.icon),status:Q5(Z),color:X}}function $V($){let Z=$.target?.target??"default",X=$.context?.name??"default";if(Z==="default"&&X==="default")return"";if(X==="default")return P.dim(`[${Z}]`);return P.dim(`[${Z}/${X}]`)}function ZV($){let Z=$.map((X)=>X.scenario.name);return new Set(Z).size!==Z.length}function $4($){return $.map((Z)=>`[${Z}]`).join(", ")}function Y5($,Z){let X=[];if($.error)return X.push(P.dim(`${Z}error: ${$.error}`)),X;if($.traps.fired.length>0)for(let z of $.traps.fired)X.push(P.red(`${Z}trap: ${z.id}`)),X.push(P.dim(`${Z}reason: ${z.reason}`)),X.push(P.dim(`${Z}match: "${z.matched}"`));else if($.reason&&$.answerable!=="YES")X.push(P.dim(`${Z}reason: ${$.reason}`));if($.citations.cited.length>0)X.push(P.dim(`${Z}cited: ${$4($.citations.cited)}`));if($.citations.missing.length>0)X.push(P.dim(`${Z}missing: ${$4($.citations.missing)}`));if($.citations.unknown.length>0)X.push(P.dim(`${Z}unknown: ${$4($.citations.unknown)}`));return X}function gZ($,Z){if(!$.traps||!$.citations)return[];return Y5({error:$.error,traps:$.traps,reason:$.reason??"",answerable:$.answerable??"NO",citations:$.citations},Z)}function vZ($){let{icon:Z,status:X,color:z}=eW($),q=$V($),G=`${Z} ${X}`;return q?`${q} ${z(G)}`:z(G)}function uZ($,Z){if(!$.cells)return[];let X=[];X.push(`${Z}${P.dim("Matrix cells (interface \xB7 source \xB7 toolset)")}`);for(let z of $.cells){let q=K0(z),G=J5(q.tone),J=`[${z.cell.interface} \xB7 ${z.cell.source??"-"} \xB7 ${z.cell.toolset}]`,Q=P.dim(J),Y=`${G(q.icon)} ${G(Q5(q))}`;if(X.push(`${Z}${Q} ${Y}`),X.push(...Y5({traps:z.traps,reason:z.reason,answerable:z.answerable,citations:z.citations??{cited:[],required:[],missing:[],unknown:[]}},`${Z} `)),z.expected){let U=z.expected.includes.filter((H)=>!H.satisfied).map((H)=>`"${H.value}"`),W=z.expected.excludes.filter((H)=>!H.satisfied).map((H)=>`"${H.value}"`);if(U.length>0)X.push(P.dim(`${Z} expected.includes missing: ${U.join(", ")}`));if(W.length>0)X.push(P.dim(`${Z} expected.excludes hit: ${W.join(", ")}`))}}if($.verifierSamples&&$.verifierSamples.length>0){X.push(`${Z}${P.dim("Verifier samples (human review; never LLM-judged)")}`);for(let z of $.verifierSamples){let q=z.content.slice(0,200).replace(/\s+/g," ").trim(),G=z.content.length>200?"...":"";X.push(P.dim(`${Z} [${z.id}] ${z.name}`)),X.push(P.dim(`${Z} ${q}${G}`))}}return X}function mZ($,Z){if(!$.surfaces)return[];let X=[];X.push(`${Z}${P.dim("Citations scoped to active surface (compare mode)")}`);for(let z of $.surfaces){let q=K0(z),G=J5(q.tone),J=P.dim(`[${z.active.join(",")}]`),Q=`${G(q.icon)} ${G(Q5(q))}`;X.push(`${Z}${J} ${Q}`),X.push(...Y5({traps:z.traps,reason:z.reason,answerable:z.answerable,citations:z.citations},`${Z} `))}return X}function XV($){let Z=0,X=0,z=0;for(let q of $){if(q.surfaces){for(let G of q.surfaces)Z+=G.traps.fired.length,X+=G.citations.missing.length,z+=G.citations.unknown.length;continue}if(q.traps)Z+=q.traps.fired.length;if(q.citations)X+=q.citations.missing.length,z+=q.citations.unknown.length}if(Z>0&&X+z>0)return"Review fired traps and citation gaps.";if(Z>0)return"Review fired traps before trusting this surface.";if(X+z>0)return"Review missing and unknown citations.";return"Citations hold. No declared traps fired."}function zV($,Z){let X=$.summary.score,q=`Overall: ${tW(X)(`${X}`)} / 100`;if(Z===void 0||Z<=0)return q;let J=X>=Z?P.green("run passes"):P.red("run fails");return`${q} \xB7 threshold ${Z} \xB7 ${J}`}function dZ($,Z={}){let{tool:X,scenarios:z,summary:q}=$,G=z,J=[];if(J.push(P.bold("pickled check")),J.push(hZ),J.push(`Tool: ${P.cyan(X.name)}`),$.docs.length>0)J.push(`Sources: ${P.dim($4($.docs.map((Q)=>Q.id)))}`);else J.push(`Sources: ${P.dim("none registered")}`);if(J.push(`Scenarios: ${P.dim(String(q.total))}`),J.push(""),ZV(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.cells)J.push(...uZ(W," "));else if(W.surfaces)J.push(...mZ(W," "));else J.push(` ${vZ(W)}`),J.push(...gZ(W," "));J.push("")}}else for(let Q of G){if(J.push(`Scenario: ${Q.scenario.name}`),Q.cells)J.push(...uZ(Q," "));else if(Q.surfaces)J.push(...mZ(Q," "));else J.push(` ${vZ(Q)}`),J.push(...gZ(Q," "));J.push("")}return J.push(hZ),J.push(zV($,Z.threshold)),J.push(P.dim(XV(z))),J.join(`
244
+ `)}function U5($,Z={}){console.log(dZ($,Z)),console.log()}function Z4($,Z={}){if(Z.verbose)return JSON.stringify($,null,2);let X={...$,docs:$.docs.map((z)=>({...z,content:""})),scenarios:$.scenarios.map((z)=>{let{allResponses:q,...G}=z;return G})};return JSON.stringify(X,null,2)}function GV($){if($.format&&$.format!=="terminal")return $.format;if($.json)return"json";return $.format??"terminal"}async function pZ($,Z){let{output:X}=Z,z=GV(Z),q=qV.resolve($),G;try{G=await O2({targetRepo:q})}catch(H){console.error(P.red(H instanceof Error?H.message:H)),process.exit(1)}let J;if(z==="json")J=V2(G);else if(z==="markdown")J=W2(G);else J=T2(G);if(X)await Bun.write(X,J);else await JV(`${J}
245
+ `);let Q=G.findings.filter((H)=>H.severity==="error").length,Y=G.findings.filter((H)=>H.severity==="warning").length;if(z!=="json"&&!X)if(console.log(),Q===0&&Y===0)console.log(P.green("Audit clean. No issues found."));else{let H=Q>0?P.red:P.yellow;console.log(H(`Audit found ${Q} error(s), ${Y} warning(s).`))}if((Z.failOn??"error")==="warning"?Q+Y>0:Q>0)process.exit(1)}function JV($){return new Promise((Z,X)=>{process.stdout.write($,(z)=>{if(z)X(z);else Z()})})}import QV from"path";async function lZ($,Z){let{json:X,output:z,verbose:q}=Z,G=(T)=>!X&&console.log(T),J=QV.resolve($),Q;try{Q=await W$(J)}catch(T){console.error(P.red(T instanceof Error?T.message:T)),console.error(),console.error(P.dim("Run `pickled init` to create a config file")),process.exit(1)}if(Z.target){let T=Q.scenarios.length;try{Q=R9(Q,Z.target)}catch(D){console.error(P.red(D instanceof Error?D.message:String(D))),process.exit(1)}let K=T-Q.scenarios.length;if(K>0&&!X)G(P.dim(`Skipping ${K} scenario(s) with explicit target != "${Z.target}"`))}let Y={name:Q.tool.name,description:Q.tool.description,path:J};if(q){G(P.bold("pickled check")),G(""),G(P.dim(` Tool: ${Y.name}`)),G(P.dim(` Scenarios: ${Q.scenarios.length}`));for(let T of Q.scenarios)G(P.dim(` - ${T.name}`))}let U=Z.interface??Z.target,W=U||Z.source||Z.toolset?{interface:U,source:Z.source,toolset:Z.toolset}:void 0,H=Z.scenario?[Z.scenario]:void 0,V=await Z5(Y,Q,{onProgress:q?(T)=>{if(!X)G(P.dim(` ${T}`))}:void 0,cellFilter:W,scenarioFilter:H}),B=Z.threshold?parseInt(Z.threshold,10):Q.threshold??0,L=B>0&&V.summary.score<B;if(z)await Bun.write(z,Z4(V,{verbose:q}));else if(X)await YV(`${Z4(V,{verbose:q})}
246
+ `);else U5(V,{threshold:B});if(L){if(X||z)console.error(P.red(`Overall: ${V.summary.score} / 100 \xB7 threshold ${B} \xB7 run fails`)),console.error(P.dim("Review failed scenarios before trusting this surface."));process.exit(1)}}function YV($){return new Promise((Z,X)=>{process.stdout.write($,(z)=>{if(z)X(z);else Z()})})}import UV from"path";var HV=`# pickled.yml - Agent legibility check for your product
247
247
 
248
248
  tool:
249
249
  name: "your-product"
@@ -265,4 +265,4 @@ scenarios:
265
265
 
266
266
  # Optional: fail CI if score falls below threshold
267
267
  # threshold: 80
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();
268
+ `;async function cZ($){let X=`${UV.resolve($)}/pickled.yml`;if(await Bun.file(X).exists())console.error(P.red("pickled.yml already exists")),process.exit(1);await Bun.write(X,HV),console.log(P.green("Created pickled.yml")),console.log(),console.log(P.dim("Next steps:")),console.log(P.dim(" 1. Edit pickled.yml: list your sources and scenarios")),console.log(P.dim(" 2. Run: pickled check")),console.log()}e0.name("pickled").description("Test what agents actually understand about your product").version(C5.version);e0.command("init").description("Create a pickled.yml config file").argument("[path]","Path to your project (default: current directory)",".").action(cZ);e0.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 H4("--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 H4("--fail-on <level>","Exit non-zero on this severity or higher").choices(["error","warning"]).default("error")).action(pZ);e0.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>","Restrict to the named target. Overrides matrix.target for non-matrix scenarios; for matrix scenarios, also filters cells by interface unless --interface is explicitly set.").option("--scenario <name>","Run only the named scenario (for CI matrix one-job-per-cell usage)").option("--interface <name>","Matrix cell filter: run only cells with this interface. Takes precedence over --target for matrix cells.").option("--source <name>","Matrix cell filter: run only cells with this source id").option("--toolset <name>","Matrix cell filter: run only cells with this toolset name").action(lZ);await e0.parseAsync();