faf-cli 6.0.9 → 6.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -4
- package/dist/cli.js +169 -168
- package/package.json +5 -4
package/dist/cli.js
CHANGED
|
@@ -1,176 +1,181 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as
|
|
3
|
-
`)}displayWidth($){return
|
|
2
|
+
import{createRequire as Qq}from"node:module";var Zq=Object.create;var{getPrototypeOf:Xq,defineProperty:qZ,getOwnPropertyNames:zq}=Object;var Jq=Object.prototype.hasOwnProperty;var qq=($,Z,X)=>{X=$!=null?Zq(Xq($)):{};let z=Z||!$||!$.__esModule?qZ(X,"default",{value:$,enumerable:!0}):X;for(let J of zq($))if(!Jq.call(z,J))qZ(z,J,{get:()=>$[J],enumerable:!0});return z};var I=($,Z)=>()=>(Z||$((Z={exports:{}}).exports,Z),Z.exports);var QZ=($,Z)=>{for(var X in Z)qZ($,X,{get:Z[X],enumerable:!0,configurable:!0,set:(z)=>Z[X]=()=>z})};var _=($,Z)=>()=>($&&(Z=$($=0)),Z);var G0=Qq(import.meta.url);var D6=I((Yq)=>{class YZ 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 X7 extends YZ{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}Yq.CommanderError=YZ;Yq.InvalidArgumentError=X7});var E8=I((Vq)=>{var{InvalidArgumentError:Wq}=D6();class z7{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 Wq(`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 Hq($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}Vq.Argument=z7;Vq.humanReadableArgName=Hq});var GZ=I((Lq)=>{var{humanReadableArgName:Dq}=E8();class J7{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,J)=>{return z.name().localeCompare(J.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),J=X.long&&$._findOption(X.long);if(!z&&!J)Z.push(X);else if(X.long&&!J)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((J)=>!J.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)=>Dq(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((J)=>{let q=X(J);if(!z.has(q))z.set(q,[])}),Z.forEach((J)=>{let q=X(J);if(!z.has(q))z.set(q,[]);z.get(q).push(J)}),z}formatHelp($,Z){let X=Z.padWidth($,Z),z=Z.helpWidth??80;function J(W,V){return Z.formatItem(W,X,V,Z)}let q=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Q=Z.commandDescription($);if(Q.length>0)q=q.concat([Z.boxWrap(Z.styleCommandDescription(Q),z),""]);let Y=Z.visibleArguments($).map((W)=>{return J(Z.styleArgumentTerm(Z.argumentTerm(W)),Z.styleArgumentDescription(Z.argumentDescription(W)))});if(q=q.concat(this.formatItemList("Arguments:",Y,Z)),this.groupItems($.options,Z.visibleOptions($),(W)=>W.helpGroupHeading??"Options:").forEach((W,V)=>{let H=W.map((D)=>{return J(Z.styleOptionTerm(Z.optionTerm(D)),Z.styleOptionDescription(Z.optionDescription(D)))});q=q.concat(this.formatItemList(V,H,Z))}),Z.showGlobalOptions){let W=Z.visibleGlobalOptions($).map((V)=>{return J(Z.styleOptionTerm(Z.optionTerm(V)),Z.styleOptionDescription(Z.optionDescription(V)))});q=q.concat(this.formatItemList("Global Options:",W,Z))}return this.groupItems($.commands,Z.visibleCommands($),(W)=>W.helpGroup()||"Commands:").forEach((W,V)=>{let H=W.map((D)=>{return J(Z.styleSubcommandTerm(Z.subcommandTerm(D)),Z.styleSubcommandDescription(Z.subcommandDescription(D)))});q=q.concat(this.formatItemList(V,H,Z))}),q.join(`
|
|
3
|
+
`)}displayWidth($){return q7($).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 q=" ".repeat(2);if(!X)return q+$;let Q=$.padEnd(Z+$.length-z.displayWidth($)),Y=2,U=(this.helpWidth??80)-Z-Y-2,W;if(U<this.minWidthToWrap||z.preformatted(X))W=X;else W=z.boxWrap(X,U).replace(/\n/g,`
|
|
4
4
|
`+" ".repeat(Z+Y));return q+Q+" ".repeat(Y)+W.replace(/\n/g,`
|
|
5
5
|
${q}`)}boxWrap($,Z){if(Z<this.minWidthToWrap)return $;let X=$.split(/\r\n|\n/),z=/[\s]*[^\s]+/g,J=[];return X.forEach((q)=>{let Q=q.match(z);if(Q===null){J.push("");return}let Y=[Q.shift()],G=this.displayWidth(Y[0]);Q.forEach((U)=>{let W=this.displayWidth(U);if(G+W<=Z){Y.push(U),G+=W;return}J.push(Y.join(""));let V=U.trimStart();Y=[V],G=this.displayWidth(V)}),J.push(Y.join(""))}),J.join(`
|
|
6
|
-
`)}}function
|
|
6
|
+
`)}}function q7($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}Lq.Help=J7;Lq.stripColor=q7});var UZ=I((Oq)=>{var{InvalidArgumentError:Tq}=D6();class Y7{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let X=Mq($);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 Tq(`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 Q7(this.name().replace(/^no-/,""));return Q7(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class G7{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,J=z!==void 0?z:!1;return Z.negate===(J===$)}}function Q7($){return $.split("-").reduce((Z,X)=>{return Z+X[0].toUpperCase()+X.slice(1)})}function Mq($){let Z,X,z=/^-[^-]$/,J=/^--[^-]/,q=$.split(/[ |,]+/).concat("guard");if(z.test(q[0]))Z=q.shift();if(J.test(q[0]))X=q.shift();if(!Z&&z.test(q[0]))Z=q.shift();if(!Z&&J.test(q[0]))Z=X,X=q.shift();if(q[0].startsWith("-")){let Q=q[0],Y=`option creation failed due to '${Q}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Q))throw Error(`${Y}
|
|
7
7
|
- a short flag is a single dash and a single character
|
|
8
8
|
- either use a single dash and a single character (for a short flag)
|
|
9
9
|
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(z.test(Q))throw Error(`${Y}
|
|
10
10
|
- too many short flags`);if(J.test(Q))throw Error(`${Y}
|
|
11
11
|
- too many long flags`);throw Error(`${Y}
|
|
12
|
-
- 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}}
|
|
12
|
+
- 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}}Oq.Option=Y7;Oq.DualOptions=G7});var U7=I((Pq)=>{function Fq($,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 J=1;J<=$.length;J++){let q=1;if($[J-1]===Z[z-1])q=0;else q=1;if(X[J][z]=Math.min(X[J-1][z]+1,X[J][z-1]+1,X[J-1][z-1]+q),J>1&&z>1&&$[J-1]===Z[z-2]&&$[J-2]===Z[z-1])X[J][z]=Math.min(X[J][z],X[J-2][z-2]+1)}return X[$.length][Z.length]}function Aq($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let X=$.startsWith("--");if(X)$=$.slice(2),Z=Z.map((Q)=>Q.slice(2));let z=[],J=3,q=0.4;if(Z.forEach((Q)=>{if(Q.length<=1)return;let Y=Fq($,Q),G=Math.max($.length,Q.length);if((G-Y)/G>q){if(Y<J)J=Y,z=[Q];else if(Y===J)z.push(Q)}}),z.sort((Q,Y)=>Q.localeCompare(Y)),X)z=z.map((Q)=>`--${Q}`);if(z.length>1)return`
|
|
13
13
|
(Did you mean one of ${z.join(", ")}?)`;if(z.length===1)return`
|
|
14
|
-
(Did you mean ${z[0]}?)`;return""}
|
|
15
|
-
- 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
|
|
16
|
-
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
|
|
17
|
-
- 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("|"),J=Z($).join("|");throw Error(`cannot add command '${J}' as already have command '${z}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),X=$.attributeName();if($.negate){let J=$.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(X,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(X,$.defaultValue,"default");let z=(J,q,Q)=>{if(J==null&&$.presetArg!==void 0)J=$.presetArg;let Y=this.getOptionValue(X);if(J!==null&&$.parseArg)J=this._callParseArg($,J,Y,q);else if(J!==null&&$.variadic)J=$._collectValue(J,Y);if(J==null)if($.negate)J=!1;else if($.isBoolean()||$.optional)J=!0;else J="";this.setOptionValueWithSource(X,J,Q)};if(this.on("option:"+Z,(J)=>{let q=`error: option '${$.flags}' argument '${J}' is invalid.`;z(J,q,"cli")}),$.envVar)this.on("optionEnv:"+Z,(J)=>{let q=`error: option '${$.flags}' value '${J}' from env '${$.envVar}' is invalid.`;z(J,q,"env")});return this}_optionEx($,Z,X,z,J){if(typeof Z==="object"&&Z instanceof
|
|
18
|
-
- 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(
|
|
14
|
+
(Did you mean ${z[0]}?)`;return""}Pq.suggestSimilar=Aq});var K7=I((kq)=>{var Cq=G0("node:events").EventEmitter,WZ=G0("node:child_process"),y0=G0("node:path"),S8=G0("node:fs"),v=G0("node:process"),{Argument:Eq,humanReadableArgName:Sq}=E8(),{CommanderError:HZ}=D6(),{Help:jq,stripColor:bq}=GZ(),{Option:W7,DualOptions:xq}=UZ(),{suggestSimilar:H7}=U7();class KZ extends Cq{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)=>v.stdout.write(Z),writeErr:(Z)=>v.stderr.write(Z),outputError:(Z,X)=>X(Z),getOutHelpWidth:()=>v.stdout.isTTY?v.stdout.columns:void 0,getErrHelpWidth:()=>v.stderr.isTTY?v.stderr.columns:void 0,getOutHasColors:()=>VZ()??(v.stdout.isTTY&&v.stdout.hasColors?.()),getErrHasColors:()=>VZ()??(v.stderr.isTTY&&v.stderr.hasColors?.()),stripColor:(Z)=>bq(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,J=X;if(typeof z==="object"&&z!==null)J=z,z=null;J=J||{};let[,q,Q]=$.match(/([^ ]+) *(.*)/),Y=this.createCommand(q);if(z)Y.description(z),Y._executableHandler=!0;if(J.isDefault)this._defaultCommandName=Y._name;if(Y._hidden=!!(J.noHelp||J.hidden),Y._executableFile=J.executableFile||null,Q)Y.arguments(Q);if(this._registerCommand(Y),Y.parent=this,Y.copyInheritedSettings(this),z)return this;return Y}createCommand($){return new KZ($)}createHelp(){return Object.assign(new jq,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
|
|
15
|
+
- 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 Eq($,Z)}argument($,Z,X,z){let J=this.createArgument($,Z);if(typeof X==="function")J.default(z).argParser(X);else J.default(X);return this.addArgument(J),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,J]=X.match(/([^ ]+) *(.*)/),q=Z??"display help for command",Q=this.createCommand(z);if(Q.helpOption(!1),J)Q.arguments(J);if(q)Q.description(q);if(this._addImplicitHelpCommand=!0,this._helpCommand=Q,$||Z)this._initCommandGroup(Q);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 : '${$}'.
|
|
16
|
+
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 HZ($,Z,X));v.exit($)}action($){let Z=(X)=>{let z=this.registeredArguments.length,J=X.slice(0,z);if(this._storeOptionsAsProperties)J[z]=this;else J[z]=this.opts();return J.push(this),$.apply(this,J)};return this._actionHandler=Z,this}createOption($,Z){return new W7($,Z)}_callParseArg($,Z,X,z){try{return $.parseArg(Z,X)}catch(J){if(J.code==="commander.invalidArgument"){let q=`${z} ${J.message}`;this.error(q,{exitCode:J.exitCode,code:J.code})}throw J}}_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}'
|
|
17
|
+
- 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("|"),J=Z($).join("|");throw Error(`cannot add command '${J}' as already have command '${z}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),X=$.attributeName();if($.negate){let J=$.long.replace(/^--no-/,"--");if(!this._findOption(J))this.setOptionValueWithSource(X,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(X,$.defaultValue,"default");let z=(J,q,Q)=>{if(J==null&&$.presetArg!==void 0)J=$.presetArg;let Y=this.getOptionValue(X);if(J!==null&&$.parseArg)J=this._callParseArg($,J,Y,q);else if(J!==null&&$.variadic)J=$._collectValue(J,Y);if(J==null)if($.negate)J=!1;else if($.isBoolean()||$.optional)J=!0;else J="";this.setOptionValueWithSource(X,J,Q)};if(this.on("option:"+Z,(J)=>{let q=`error: option '${$.flags}' argument '${J}' is invalid.`;z(J,q,"cli")}),$.envVar)this.on("optionEnv:"+Z,(J)=>{let q=`error: option '${$.flags}' value '${J}' from env '${$.envVar}' is invalid.`;z(J,q,"env")});return this}_optionEx($,Z,X,z,J){if(typeof Z==="object"&&Z instanceof W7)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let q=this.createOption(Z,X);if(q.makeOptionMandatory(!!$.mandatory),typeof z==="function")q.default(J).argParser(z);else if(z instanceof RegExp){let Q=z;z=(Y,G)=>{let U=Q.exec(Y);return U?U[0]:G},q.default(J).argParser(z)}else q.default(z);return this.addOption(q)}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(v.versions?.electron)Z.from="electron";let z=v.execArgv??[];if(z.includes("-e")||z.includes("--eval")||z.includes("-p")||z.includes("--print"))Z.from="eval"}if($===void 0)$=v.argv;this.rawArgs=$.slice();let X;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],X=$.slice(2);break;case"electron":if(v.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.
|
|
18
|
+
- 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(S8.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",J=`'${$}' does not exist
|
|
19
19
|
- if '${X}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
20
20
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
21
|
-
- ${z}`;throw Error(J)}_executeSubCommand($,Z){Z=Z.slice();let X=!1,z=[".js",".ts",".tsx",".mjs",".cjs"];function J(U,W){let V=
|
|
21
|
+
- ${z}`;throw Error(J)}_executeSubCommand($,Z){Z=Z.slice();let X=!1,z=[".js",".ts",".tsx",".mjs",".cjs"];function J(U,W){let V=y0.resolve(U,W);if(S8.existsSync(V))return V;if(z.includes(y0.extname(W)))return;let H=z.find((D)=>S8.existsSync(`${V}${D}`));if(H)return`${V}${H}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let q=$._executableFile||`${this._name}-${$._name}`,Q=this._executableDir||"";if(this._scriptPath){let U;try{U=S8.realpathSync(this._scriptPath)}catch{U=this._scriptPath}Q=y0.resolve(y0.dirname(U),Q)}if(Q){let U=J(Q,q);if(!U&&!$._executableFile&&this._scriptPath){let W=y0.basename(this._scriptPath,y0.extname(this._scriptPath));if(W!==this._name)U=J(Q,`${W}-${$._name}`)}q=U||q}X=z.includes(y0.extname(q));let Y;if(v.platform!=="win32")if(X)Z.unshift(q),Z=V7(v.execArgv).concat(Z),Y=WZ.spawn(v.argv[0],Z,{stdio:"inherit"});else Y=WZ.spawn(q,Z,{stdio:"inherit"});else this._checkForMissingExecutable(q,Q,$._name),Z.unshift(q),Z=V7(v.execArgv).concat(Z),Y=WZ.spawn(v.execPath,Z,{stdio:"inherit"});if(!Y.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((W)=>{v.on(W,()=>{if(Y.killed===!1&&Y.exitCode===null)Y.kill(W)})});let G=this._exitCallback;Y.on("close",(U)=>{if(U=U??1,!G)v.exit(U);else G(new HZ(U,"commander.executeSubCommandAsync","(close)"))}),Y.on("error",(U)=>{if(U.code==="ENOENT")this._checkForMissingExecutable(q,Q,$._name);else if(U.code==="EACCES")throw Error(`'${q}' not executable`);if(!G)v.exit(1);else{let W=new HZ(1,"commander.executeSubCommandAsync","(error)");W.nestedError=U,G(W)}}),this.runningCommand=Y}_dispatchSubcommand($,Z,X){let z=this._findCommand($);if(!z)this.help({error:!0});z._prepareForParse();let J;return J=this._chainOrCallSubCommandHook(J,z,"preSubcommand"),J=this._chainOrCall(J,()=>{if(z._executableHandler)this._executeSubCommand(z,Z.concat(X));else return z._parseCommand(Z,X)}),J}_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,J)=>{let q=z;if(z!==null&&X.parseArg){let Q=`error: command-argument value '${z}' is invalid for argument '${X.name()}'.`;q=this._callParseArg(X,z,J,Q)}return q};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((X,z)=>{let J=X.defaultValue;if(X.variadic){if(z<this.args.length){if(J=this.args.slice(z),X.parseArg)J=J.reduce((q,Q)=>{return $(X,Q,q)},X.defaultValue)}else if(J===void 0)J=[]}else if(z<this.args.length){if(J=this.args[z],X.parseArg)J=$(X,J,X.defaultValue)}Z[z]=J}),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((J)=>J._lifeCycleHooks[Z]!==void 0).forEach((J)=>{J._lifeCycleHooks[Z].forEach((q)=>{z.push({hookedCommand:J,callback:q})})}),Z==="postAction")z.reverse();return z.forEach((J)=>{X=this._chainOrCall(X,()=>{return J.callback(J.hookedCommand,this)})}),X}_chainOrCallSubCommandHook($,Z,X){let z=$;if(this._lifeCycleHooks[X]!==void 0)this._lifeCycleHooks[X].forEach((J)=>{z=this._chainOrCall(z,()=>{return J(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])},J=`command:${this.name()}`;if(this._actionHandler){z(),this._processArguments();let q;if(q=this._chainOrCallHooks(q,"preAction"),q=this._chainOrCall(q,()=>this._actionHandler(this.processedArgs)),this.parent)q=this._chainOrCall(q,()=>{this.parent.emit(J,$,Z)});return q=this._chainOrCallHooks(q,"postAction"),q}if(this.parent?.listenerCount(J))z(),this._processArguments(),this.parent.emit(J,$,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((J)=>X.conflictsWith.includes(J.attributeName()));if(z)this._conflictingOption(X,z)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],X=[],z=Z;function J(U){return U.length>1&&U[0]==="-"}let q=(U)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(U))return!1;return!this._getCommandAndAncestors().some((W)=>W.options.map((V)=>V.short).some((V)=>/^-\d$/.test(V)))},Q=null,Y=null,G=0;while(G<$.length||Y){let U=Y??$[G++];if(Y=null,U==="--"){if(z===X)z.push(U);z.push(...$.slice(G));break}if(Q&&(!J(U)||q(U))){this.emit(`option:${Q.name()}`,U);continue}if(Q=null,J(U)){let W=this._findOption(U);if(W){if(W.required){let V=$[G++];if(V===void 0)this.optionMissingArgument(W);this.emit(`option:${W.name()}`,V)}else if(W.optional){let V=null;if(G<$.length&&(!J($[G])||q($[G])))V=$[G++];this.emit(`option:${W.name()}`,V)}else this.emit(`option:${W.name()}`);Q=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()}`),Y=`-${U.slice(2)}`;continue}}if(/^--[^=]+=/.test(U)){let W=U.indexOf("="),V=this._findOption(U.slice(0,W));if(V&&(V.required||V.optional)){this.emit(`option:${V.name()}`,U.slice(W+1));continue}}if(z===Z&&J(U)&&!(this.commands.length===0&&q(U)))z=X;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&X.length===0){if(this._findCommand(U)){Z.push(U),X.push(...$.slice(G));break}else if(this._getHelpCommand()&&U===this._getHelpCommand().name()){Z.push(U,...$.slice(G));break}else if(this._defaultCommandName){X.push(U,...$.slice(G));break}}if(this._passThroughOptions){z.push(U,...$.slice(G));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(`${$}
|
|
22
22
|
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
23
23
|
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
|
|
24
|
-
`),this.outputHelp({error:!0});let X=Z||{},z=X.exitCode||1,J=X.code||"commander.error";this._exit(z,J,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in
|
|
25
|
-
`),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
|
|
24
|
+
`),this.outputHelp({error:!0});let X=Z||{},z=X.exitCode||1,J=X.code||"commander.error";this._exit(z,J,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in v.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,v.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new xq(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=(q)=>{let Q=q.attributeName(),Y=this.getOptionValue(Q),G=this.options.find((W)=>W.negate&&Q===W.attributeName()),U=this.options.find((W)=>!W.negate&&Q===W.attributeName());if(G&&(G.presetArg===void 0&&Y===!1||G.presetArg!==void 0&&Y===G.presetArg))return G;return U||q},z=(q)=>{let Q=X(q),Y=Q.attributeName();if(this.getOptionValueSource(Y)==="env")return`environment variable '${Q.envVar}'`;return`option '${Q.flags}'`},J=`error: ${z($)} cannot be used with ${z(Z)}`;this.error(J,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let z=[],J=this;do{let q=J.createHelp().visibleOptions(J).filter((Q)=>Q.long).map((Q)=>Q.long);z=z.concat(q),J=J.parent}while(J&&!J._enablePositionalOptions);Z=H7($,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",J=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Z} argument${X} but got ${$.length}.`;this.error(J,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],Z="";if(this._showSuggestionAfterError){let z=[];this.createHelp().visibleCommands(this).forEach((J)=>{if(z.push(J.name()),J.alias())z.push(J.alias())}),Z=H7($,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(`${$}
|
|
25
|
+
`),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 Sq(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=y0.basename($,y0.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,J;if(Z)X=(Q)=>this._outputConfiguration.writeErr(Q),z=this._outputConfiguration.getErrHasColors(),J=this._outputConfiguration.getErrHelpWidth();else X=(Q)=>this._outputConfiguration.writeOut(Q),z=this._outputConfiguration.getOutHasColors(),J=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Q)=>{if(!z)Q=this._outputConfiguration.stripColor(Q);return X(Q)},hasColors:z,helpWidth:J}}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((q)=>q.emit("beforeAllHelp",z)),this.emit("beforeHelp",z);let J=this.helpInformation({error:X.error});if(Z){if(J=Z(J),typeof J!=="string"&&!Buffer.isBuffer(J))throw Error("outputHelp callback must return a string or a Buffer")}if(X.write(J),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",z),this._getCommandAndAncestors().forEach((q)=>q.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(v.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.
|
|
26
26
|
Expecting one of '${X.join("', '")}'`);let z=`${$}Help`;return this.on(z,(J)=>{let q;if(typeof Z==="function")q=Z({error:J.error,command:J.command});else q=Z;if(q)J.write(`${q}
|
|
27
|
-
`)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((z)=>Z.is(z)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function
|
|
28
|
-
`)}}
|
|
29
|
-
`)?
|
|
27
|
+
`)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((z)=>Z.is(z)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function V7($){return $.map((Z)=>{if(!Z.startsWith("--inspect"))return Z;let X,z="127.0.0.1",J="9229",q;if((q=Z.match(/^(--inspect(-brk)?)$/))!==null)X=q[1];else if((q=Z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(X=q[1],/^\d+$/.test(q[3]))J=q[3];else z=q[3];else if((q=Z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)X=q[1],z=q[3],J=q[4];if(X&&J!=="0")return`${X}=${z}:${parseInt(J)+1}`;return Z})}function VZ(){if(v.env.NO_COLOR||v.env.FORCE_COLOR==="0"||v.env.FORCE_COLOR==="false")return!1;if(v.env.FORCE_COLOR||v.env.CLICOLOR_FORCE!==void 0)return!0;return}kq.Command=KZ;kq.useColor=VZ});var N7=I((vq)=>{var{Argument:B7}=E8(),{Command:BZ}=K7(),{CommanderError:gq,InvalidArgumentError:D7}=D6(),{Help:hq}=GZ(),{Option:L7}=UZ();vq.program=new BZ;vq.createCommand=($)=>new BZ($);vq.createOption=($,Z)=>new L7($,Z);vq.createArgument=($,Z)=>new B7($,Z);vq.Command=BZ;vq.Option=L7;vq.Argument=B7;vq.Help=hq;vq.CommanderError=gq;vq.InvalidArgumentError=D7;vq.InvalidOptionArgumentError=D7});var f=I((JQ)=>{var DZ=Symbol.for("yaml.alias"),M7=Symbol.for("yaml.document"),j8=Symbol.for("yaml.map"),O7=Symbol.for("yaml.pair"),LZ=Symbol.for("yaml.scalar"),b8=Symbol.for("yaml.seq"),f0=Symbol.for("yaml.node.type"),oq=($)=>!!$&&typeof $==="object"&&$[f0]===DZ,tq=($)=>!!$&&typeof $==="object"&&$[f0]===M7,eq=($)=>!!$&&typeof $==="object"&&$[f0]===j8,$Q=($)=>!!$&&typeof $==="object"&&$[f0]===O7,w7=($)=>!!$&&typeof $==="object"&&$[f0]===LZ,ZQ=($)=>!!$&&typeof $==="object"&&$[f0]===b8;function R7($){if($&&typeof $==="object")switch($[f0]){case j8:case b8:return!0}return!1}function XQ($){if($&&typeof $==="object")switch($[f0]){case DZ:case j8:case LZ:case b8:return!0}return!1}var zQ=($)=>(w7($)||R7($))&&!!$.anchor;JQ.ALIAS=DZ;JQ.DOC=M7;JQ.MAP=j8;JQ.NODE_TYPE=f0;JQ.PAIR=O7;JQ.SCALAR=LZ;JQ.SEQ=b8;JQ.hasAnchor=zQ;JQ.isAlias=oq;JQ.isCollection=R7;JQ.isDocument=tq;JQ.isMap=eq;JQ.isNode=XQ;JQ.isPair=$Q;JQ.isScalar=w7;JQ.isSeq=ZQ});var L6=I((OQ)=>{var Q0=f(),V0=Symbol("break visit"),F7=Symbol("skip children"),E0=Symbol("remove node");function x8($,Z){let X=A7(Z);if(Q0.isDocument($)){if(E$(null,$.contents,X,Object.freeze([$]))===E0)$.contents=null}else E$(null,$,X,Object.freeze([]))}x8.BREAK=V0;x8.SKIP=F7;x8.REMOVE=E0;function E$($,Z,X,z){let J=P7($,Z,X,z);if(Q0.isNode(J)||Q0.isPair(J))return _7($,z,J),E$($,J,X,z);if(typeof J!=="symbol"){if(Q0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let q=0;q<Z.items.length;++q){let Q=E$(q,Z.items[q],X,z);if(typeof Q==="number")q=Q-1;else if(Q===V0)return V0;else if(Q===E0)Z.items.splice(q,1),q-=1}}else if(Q0.isPair(Z)){z=Object.freeze(z.concat(Z));let q=E$("key",Z.key,X,z);if(q===V0)return V0;else if(q===E0)Z.key=null;let Q=E$("value",Z.value,X,z);if(Q===V0)return V0;else if(Q===E0)Z.value=null}}return J}async function k8($,Z){let X=A7(Z);if(Q0.isDocument($)){if(await S$(null,$.contents,X,Object.freeze([$]))===E0)$.contents=null}else await S$(null,$,X,Object.freeze([]))}k8.BREAK=V0;k8.SKIP=F7;k8.REMOVE=E0;async function S$($,Z,X,z){let J=await P7($,Z,X,z);if(Q0.isNode(J)||Q0.isPair(J))return _7($,z,J),S$($,J,X,z);if(typeof J!=="symbol"){if(Q0.isCollection(Z)){z=Object.freeze(z.concat(Z));for(let q=0;q<Z.items.length;++q){let Q=await S$(q,Z.items[q],X,z);if(typeof Q==="number")q=Q-1;else if(Q===V0)return V0;else if(Q===E0)Z.items.splice(q,1),q-=1}}else if(Q0.isPair(Z)){z=Object.freeze(z.concat(Z));let q=await S$("key",Z.key,X,z);if(q===V0)return V0;else if(q===E0)Z.key=null;let Q=await S$("value",Z.value,X,z);if(Q===V0)return V0;else if(Q===E0)Z.value=null}}return J}function A7($){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 P7($,Z,X,z){if(typeof X==="function")return X($,Z,z);if(Q0.isMap(Z))return X.Map?.($,Z,z);if(Q0.isSeq(Z))return X.Seq?.($,Z,z);if(Q0.isPair(Z))return X.Pair?.($,Z,z);if(Q0.isScalar(Z))return X.Scalar?.($,Z,z);if(Q0.isAlias(Z))return X.Alias?.($,Z,z);return}function _7($,Z,X){let z=Z[Z.length-1];if(Q0.isCollection(z))z.items[$]=X;else if(Q0.isPair(z))if($==="key")z.key=X;else z.value=X;else if(Q0.isDocument(z))z.contents=X;else{let J=Q0.isAlias(z)?"alias":"scalar";throw Error(`Cannot replace node with ${J} parent`)}}OQ.visit=x8;OQ.visitAsync=k8});var NZ=I((_Q)=>{var C7=f(),FQ=L6(),AQ={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},PQ=($)=>$.replace(/[!,[\]{}]/g,(Z)=>AQ[Z]);class M0{constructor($,Z){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},M0.defaultYaml,$),this.tags=Object.assign({},M0.defaultTags,Z)}clone(){let $=new M0(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new M0(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:M0.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},M0.defaultTags);break}return $}add($,Z){if(this.atNextDocument)this.yaml={explicit:M0.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},M0.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[J,q]=X;return this.tags[J]=q,!0}case"%YAML":{if(this.yaml.explicit=!0,X.length!==1)return Z(0,"%YAML directive should contain exactly one part"),!1;let[J]=X;if(J==="1.1"||J==="1.2")return this.yaml.version=J,!0;else{let q=/^\d+\.\d+$/.test(J);return Z(6,`Unsupported YAML version ${J}`,q),!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 q=$.slice(2,-1);if(q==="!"||q==="!!")return Z(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")Z("Verbatim tags must end with a >");return q}let[,X,z]=$.match(/^(.*!)([^!]*)$/s);if(!z)Z(`The ${$} tag has no suffix`);let J=this.tags[X];if(J)try{return J+decodeURIComponent(z)}catch(q){return Z(String(q)),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+PQ($.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&&C7.isNode($.contents)){let J={};FQ.visit($.contents,(q,Q)=>{if(C7.isNode(Q)&&Q.tag)J[Q.tag]=!0}),z=Object.keys(J)}else z=[];for(let[J,q]of X){if(J==="!!"&&q==="tag:yaml.org,2002:")continue;if(!$||z.some((Q)=>Q.startsWith(q)))Z.push(`%TAG ${J} ${q}`)}return Z.join(`
|
|
28
|
+
`)}}M0.defaultYaml={explicit:!1,version:"1.2"};M0.defaultTags={"!!":"tag:yaml.org,2002:"};_Q.Directives=M0});var y8=I((bQ)=>{var E7=f(),EQ=L6();function SQ($){if(/[\x00-\x19\s,[\]{}]/.test($)){let X=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(X)}return!0}function S7($){let Z=new Set;return EQ.visit($,{Value(X,z){if(z.anchor)Z.add(z.anchor)}}),Z}function j7($,Z){for(let X=1;;++X){let z=`${$}${X}`;if(!Z.has(z))return z}}function jQ($,Z){let X=[],z=new Map,J=null;return{onAnchor:(q)=>{X.push(q),J??(J=S7($));let Q=j7(Z,J);return J.add(Q),Q},setAnchors:()=>{for(let q of X){let Q=z.get(q);if(typeof Q==="object"&&Q.anchor&&(E7.isScalar(Q.node)||E7.isCollection(Q.node)))Q.node.anchor=Q.anchor;else{let Y=Error("Failed to resolve repeated object (this should not happen)");throw Y.source=q,Y}}},sourceObjects:z}}bQ.anchorIsValid=SQ;bQ.anchorNames=S7;bQ.createNodeAnchors=jQ;bQ.findNewAnchor=j7});var IZ=I((gQ)=>{function N6($,Z,X,z){if(z&&typeof z==="object")if(Array.isArray(z))for(let J=0,q=z.length;J<q;++J){let Q=z[J],Y=N6($,z,String(J),Q);if(Y===void 0)delete z[J];else if(Y!==Q)z[J]=Y}else if(z instanceof Map)for(let J of Array.from(z.keys())){let q=z.get(J),Q=N6($,z,J,q);if(Q===void 0)z.delete(J);else if(Q!==q)z.set(J,Q)}else if(z instanceof Set)for(let J of Array.from(z)){let q=N6($,z,J,J);if(q===void 0)z.delete(J);else if(q!==J)z.delete(J),z.add(q)}else for(let[J,q]of Object.entries(z)){let Q=N6($,z,J,q);if(Q===void 0)delete z[J];else if(Q!==q)z[J]=Q}return $.call(Z,X,z)}gQ.applyReviver=N6});var l0=I((uQ)=>{var vQ=f();function b7($,Z,X){if(Array.isArray($))return $.map((z,J)=>b7(z,String(J),X));if($&&typeof $.toJSON==="function"){if(!X||!vQ.hasAnchor($))return $.toJSON(Z,X);let z={aliasCount:0,count:1,res:void 0};X.anchors.set($,z),X.onCreate=(q)=>{z.res=q,delete X.onCreate};let J=$.toJSON(Z,X);if(X.onCreate)X.onCreate(J);return J}if(typeof $==="bigint"&&!X?.keep)return Number($);return $}uQ.toJS=b7});var f8=I((pQ)=>{var dQ=IZ(),x7=f(),cQ=l0();class k7{constructor($){Object.defineProperty(this,x7.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:J}={}){if(!x7.isDocument($))throw TypeError("A document argument is required");let q={anchors:new Map,doc:$,keep:!0,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof X==="number"?X:100},Q=cQ.toJS(this,"",q);if(typeof z==="function")for(let{count:Y,res:G}of q.anchors.values())z(G,Y);return typeof J==="function"?dQ.applyReviver(J,{"":Q},"",Q):Q}}pQ.NodeBase=k7});var I6=I((aQ)=>{var iQ=y8(),nQ=L6(),j$=f(),sQ=f8(),rQ=l0();class y7 extends sQ.NodeBase{constructor($){super(j$.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=[],nQ.visit($,{Node:(J,q)=>{if(j$.isAlias(q)||j$.hasAnchor(q))X.push(q)}}),Z)Z.aliasResolveCache=X;let z=void 0;for(let J of X){if(J===this)break;if(J.anchor===this.source)z=J}return z}toJSON($,Z){if(!Z)return{source:this.source};let{anchors:X,doc:z,maxAliasCount:J}=Z,q=this.resolve(z,Z);if(!q){let Y=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(Y)}let Q=X.get(q);if(!Q)rQ.toJS(q,null,Z),Q=X.get(q);if(Q?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(J>=0){if(Q.count+=1,Q.aliasCount===0)Q.aliasCount=g8(z,q,X);if(Q.count*Q.aliasCount>J)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return Q.res}toString($,Z,X){let z=`*${this.source}`;if($){if(iQ.anchorIsValid(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let J=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(J)}if($.implicitKey)return`${z} `}return z}}function g8($,Z,X){if(j$.isAlias(Z)){let z=Z.resolve($),J=X&&z&&X.get(z);return J?J.count*J.aliasCount:0}else if(j$.isCollection(Z)){let z=0;for(let J of Z.items){let q=g8($,J,X);if(q>z)z=q}return z}else if(j$.isPair(Z)){let z=g8($,Z.key,X),J=g8($,Z.value,X);return Math.max(z,J)}return 1}aQ.Alias=y7});var z0=I((X1)=>{var tQ=f(),eQ=f8(),$1=l0(),Z1=($)=>!$||typeof $!=="function"&&typeof $!=="object";class K$ extends eQ.NodeBase{constructor($){super(tQ.SCALAR);this.value=$}toJSON($,Z){return Z?.keep?this.value:$1.toJS(this.value,$,Z)}toString(){return String(this.value)}}K$.BLOCK_FOLDED="BLOCK_FOLDED";K$.BLOCK_LITERAL="BLOCK_LITERAL";K$.PLAIN="PLAIN";K$.QUOTE_DOUBLE="QUOTE_DOUBLE";K$.QUOTE_SINGLE="QUOTE_SINGLE";X1.Scalar=K$;X1.isScalarValue=Z1});var T6=I((U1)=>{var q1=I6(),B$=f(),f7=z0(),Q1="tag:yaml.org,2002:";function Y1($,Z,X){if(Z){let z=X.filter((q)=>q.tag===Z),J=z.find((q)=>!q.format)??z[0];if(!J)throw Error(`Tag ${Z} not found`);return J}return X.find((z)=>z.identify?.($)&&!z.format)}function G1($,Z,X){if(B$.isDocument($))$=$.contents;if(B$.isNode($))return $;if(B$.isPair($)){let V=X.schema[B$.MAP].createNode?.(X.schema,null,X);return V.items.push($),V}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:z,onAnchor:J,onTagObj:q,schema:Q,sourceObjects:Y}=X,G=void 0;if(z&&$&&typeof $==="object")if(G=Y.get($),G)return G.anchor??(G.anchor=J($)),new q1.Alias(G.anchor);else G={anchor:null,node:null},Y.set($,G);if(Z?.startsWith("!!"))Z=Q1+Z.slice(2);let U=Y1($,Z,Q.tags);if(!U){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let V=new f7.Scalar($);if(G)G.node=V;return V}U=$ instanceof Map?Q[B$.MAP]:(Symbol.iterator in Object($))?Q[B$.SEQ]:Q[B$.MAP]}if(q)q(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 f7.Scalar($);if(Z)W.tag=Z;else if(!U.default)W.tag=U.tag;if(G)G.node=W;return W}U1.createNode=G1});var h8=I((K1)=>{var H1=T6(),S0=f(),V1=f8();function TZ($,Z,X){let z=X;for(let J=Z.length-1;J>=0;--J){let q=Z[J];if(typeof q==="number"&&Number.isInteger(q)&&q>=0){let Q=[];Q[q]=z,z=Q}else z=new Map([[q,z]])}return H1.createNode(z,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var g7=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class h7 extends V1.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)=>S0.isNode(X)||S0.isPair(X)?X.clone($):X),this.range)Z.range=this.range.slice();return Z}addIn($,Z){if(g7($))this.add(Z);else{let[X,...z]=$,J=this.get(X,!0);if(S0.isCollection(J))J.addIn(z,Z);else if(J===void 0&&this.schema)this.set(X,TZ(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(S0.isCollection(z))return z.deleteIn(X);else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${X}`)}getIn($,Z){let[X,...z]=$,J=this.get(X,!0);if(z.length===0)return!Z&&S0.isScalar(J)?J.value:J;else return S0.isCollection(J)?J.getIn(z,Z):void 0}hasAllNullValues($){return this.items.every((Z)=>{if(!S0.isPair(Z))return!1;let X=Z.value;return X==null||$&&S0.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 S0.isCollection(z)?z.hasIn(X):!1}setIn($,Z){let[X,...z]=$;if(z.length===0)this.set(X,Z);else{let J=this.get(X,!0);if(S0.isCollection(J))J.setIn(z,Z);else if(J===void 0&&this.schema)this.set(X,TZ(this.schema,z,Z));else throw Error(`Expected YAML collection at ${X}. Remaining path: ${z}`)}}}K1.Collection=h7;K1.collectionFromPath=TZ;K1.isEmptyPath=g7});var M6=I((T1)=>{var N1=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function MZ($,Z){if(/^\n+$/.test($))return $.substring(1);return Z?$.replace(/^(?! *$)/gm,Z):$}var I1=($,Z,X)=>$.endsWith(`
|
|
29
|
+
`)?MZ(X,Z):X.includes(`
|
|
30
30
|
`)?`
|
|
31
|
-
`+
|
|
32
|
-
`){if(X==="block")
|
|
33
|
-
`&&
|
|
34
|
-
`&&
|
|
35
|
-
${Z}${$.slice(0,S)}`;else{if(X==="quoted"&&W[
|
|
36
|
-
${Z}${$.slice(
|
|
37
|
-
`);z=Z,J=Z+1,q=$[J]}return z}
|
|
38
|
-
`){if(q-Q>z)return!0;if(Q=q+1,J-Q<=z)return!1}return!0}function
|
|
31
|
+
`+MZ(X,Z):($.endsWith(" ")?"":" ")+X;T1.indentComment=MZ;T1.lineComment=I1;T1.stringifyComment=N1});var u7=I((F1)=>{function R1($,Z,X="flow",{indentAtStart:z,lineWidth:J=80,minContentWidth:q=20,onFold:Q,onOverflow:Y}={}){if(!J||J<0)return $;if(J<q)q=0;let G=Math.max(1+q,1+J-Z.length);if($.length<=G)return $;let U=[],W={},V=J-Z.length;if(typeof z==="number")if(z>J-Math.max(2,q))U.push(0);else V=J-z;let H=void 0,D=void 0,T=!1,B=-1,L=-1,w=-1;if(X==="block"){if(B=v7($,B,Z.length),B!==-1)V=B+G}for(let P;P=$[B+=1];){if(X==="quoted"&&P==="\\"){switch(L=B,$[B+1]){case"x":B+=3;break;case"u":B+=5;break;case"U":B+=9;break;default:B+=1}w=B}if(P===`
|
|
32
|
+
`){if(X==="block")B=v7($,B,Z.length);V=B+Z.length+G,H=void 0}else{if(P===" "&&D&&D!==" "&&D!==`
|
|
33
|
+
`&&D!=="\t"){let C=$[B+1];if(C&&C!==" "&&C!==`
|
|
34
|
+
`&&C!=="\t")H=B}if(B>=V)if(H)U.push(H),V=H+G,H=void 0;else if(X==="quoted"){while(D===" "||D==="\t")D=P,P=$[B+=1],T=!0;let C=B>w+1?B-2:L-1;if(W[C])return $;U.push(C),W[C]=!0,V=C+G,H=void 0}else T=!0}D=P}if(T&&Y)Y();if(U.length===0)return $;if(Q)Q();let A=$.slice(0,U[0]);for(let P=0;P<U.length;++P){let C=U[P],S=U[P+1]||$.length;if(C===0)A=`
|
|
35
|
+
${Z}${$.slice(0,S)}`;else{if(X==="quoted"&&W[C])A+=`${$[C]}\\`;A+=`
|
|
36
|
+
${Z}${$.slice(C+1,S)}`}}return A}function v7($,Z,X){let z=Z,J=Z+1,q=$[J];while(q===" "||q==="\t")if(Z<J+X)q=$[++Z];else{do q=$[++Z];while(q&&q!==`
|
|
37
|
+
`);z=Z,J=Z+1,q=$[J]}return z}F1.FOLD_BLOCK="block";F1.FOLD_FLOW="flow";F1.FOLD_QUOTED="quoted";F1.foldFlowLines=R1});var w6=I((b1)=>{var F0=z0(),i0=u7(),u8=($,Z)=>({indentAtStart:Z?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),m8=($)=>/^(%|---|\.\.\.)/m.test($);function E1($,Z,X){if(!Z||Z<0)return!1;let z=Z-X,J=$.length;if(J<=z)return!1;for(let q=0,Q=0;q<J;++q)if($[q]===`
|
|
38
|
+
`){if(q-Q>z)return!0;if(Q=q+1,J-Q<=z)return!1}return!0}function O6($,Z){let X=JSON.stringify($);if(Z.options.doubleQuotedAsJSON)return X;let{implicitKey:z}=Z,J=Z.options.doubleQuotedMinMultiLineLength,q=Z.indent||(m8($)?" ":""),Q="",Y=0;for(let G=0,U=X[G];U;U=X[++G]){if(U===" "&&X[G+1]==="\\"&&X[G+2]==="n")Q+=X.slice(Y,G)+"\\ ",G+=1,Y=G,U="\\";if(U==="\\")switch(X[G+1]){case"u":{Q+=X.slice(Y,G);let W=X.substr(G+2,4);switch(W){case"0000":Q+="\\0";break;case"0007":Q+="\\a";break;case"000b":Q+="\\v";break;case"001b":Q+="\\e";break;case"0085":Q+="\\N";break;case"00a0":Q+="\\_";break;case"2028":Q+="\\L";break;case"2029":Q+="\\P";break;default:if(W.substr(0,2)==="00")Q+="\\x"+W.substr(2);else Q+=X.substr(G,6)}G+=5,Y=G+1}break;case"n":if(z||X[G+2]==='"'||X.length<J)G+=1;else{Q+=X.slice(Y,G)+`
|
|
39
39
|
|
|
40
40
|
`;while(X[G+2]==="\\"&&X[G+3]==="n"&&X[G+4]!=='"')Q+=`
|
|
41
|
-
`,G+=2;if(Q+=q,X[G+2]===" ")Q+="\\";G+=1,Y=G+1}break;default:G+=1}}return Q=Y?Q+X.slice(Y):X,z?Q:
|
|
42
|
-
`)||/[ \t]\n|\n[ \t]/.test($))return
|
|
43
|
-
${X}`)+"'";return Z.implicitKey?z:
|
|
41
|
+
`,G+=2;if(Q+=q,X[G+2]===" ")Q+="\\";G+=1,Y=G+1}break;default:G+=1}}return Q=Y?Q+X.slice(Y):X,z?Q:i0.foldFlowLines(Q,q,i0.FOLD_QUOTED,u8(Z,!1))}function OZ($,Z){if(Z.options.singleQuote===!1||Z.implicitKey&&$.includes(`
|
|
42
|
+
`)||/[ \t]\n|\n[ \t]/.test($))return O6($,Z);let X=Z.indent||(m8($)?" ":""),z="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
43
|
+
${X}`)+"'";return Z.implicitKey?z:i0.foldFlowLines(z,X,i0.FOLD_FLOW,u8(Z,!1))}function b$($,Z){let{singleQuote:X}=Z.options,z;if(X===!1)z=O6;else{let J=$.includes('"'),q=$.includes("'");if(J&&!q)z=OZ;else if(q&&!J)z=O6;else z=X?OZ:O6}return z($,Z)}var wZ;try{wZ=new RegExp(`(^|(?<!
|
|
44
44
|
))
|
|
45
45
|
+(?!
|
|
46
|
-
|$)`,"g")}catch{
|
|
46
|
+
|$)`,"g")}catch{wZ=/\n+(?!\n|$)/g}function v8({comment:$,type:Z,value:X},z,J,q){let{blockQuote:Q,commentString:Y,lineWidth:G}=z.options;if(!Q||/\n[\t ]+$/.test(X))return b$(X,z);let U=z.indent||(z.forceBlockIndent||m8(X)?" ":""),W=Q==="literal"?!0:Q==="folded"||Z===F0.Scalar.BLOCK_FOLDED?!1:Z===F0.Scalar.BLOCK_LITERAL?!0:!E1(X,G,U.length);if(!X)return W?`|
|
|
47
47
|
`:`>
|
|
48
48
|
`;let V,H;for(H=X.length;H>0;--H){let S=X[H-1];if(S!==`
|
|
49
|
-
`&&S!=="\t"&&S!==" ")break}let
|
|
50
|
-
`);if(T===-1)V="-";else if(X===
|
|
51
|
-
`)
|
|
52
|
-
`)
|
|
53
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${U}`),
|
|
54
|
-
${U}${
|
|
55
|
-
${U}${A}${X}${
|
|
56
|
-
`)||W&&/[[\]{},]/.test(q))return
|
|
57
|
-
`)?
|
|
58
|
-
`))return
|
|
59
|
-
${G}`);if(Q){let H=(
|
|
60
|
-
${Z.indent}${Y}`}
|
|
61
|
-
${Y}:`}else if(
|
|
62
|
-
`:"",A){let
|
|
63
|
-
${
|
|
64
|
-
`&&
|
|
65
|
-
|
|
66
|
-
`}else
|
|
67
|
-
${X.indent}`}else if(!
|
|
68
|
-
`),
|
|
49
|
+
`&&S!=="\t"&&S!==" ")break}let D=X.substring(H),T=D.indexOf(`
|
|
50
|
+
`);if(T===-1)V="-";else if(X===D||T!==D.length-1){if(V="+",q)q()}else V="";if(D){if(X=X.slice(0,-D.length),D[D.length-1]===`
|
|
51
|
+
`)D=D.slice(0,-1);D=D.replace(wZ,`$&${U}`)}let B=!1,L,w=-1;for(L=0;L<X.length;++L){let S=X[L];if(S===" ")B=!0;else if(S===`
|
|
52
|
+
`)w=L;else break}let A=X.substring(0,w<L?w+1:L);if(A)X=X.substring(A.length),A=A.replace(/\n+/g,`$&${U}`);let C=(B?U?"2":"1":"")+V;if($){if(C+=" "+Y($.replace(/ ?[\r\n]+/g," ")),J)J()}if(!W){let S=X.replace(/\n+/g,`
|
|
53
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${U}`),E=!1,h=u8(z,!0);if(Q!=="folded"&&Z!==F0.Scalar.BLOCK_FOLDED)h.onOverflow=()=>{E=!0};let R=i0.foldFlowLines(`${A}${S}${D}`,U,i0.FOLD_BLOCK,h);if(!E)return`>${C}
|
|
54
|
+
${U}${R}`}return X=X.replace(/\n+/g,`$&${U}`),`|${C}
|
|
55
|
+
${U}${A}${X}${D}`}function S1($,Z,X,z){let{type:J,value:q}=$,{actualString:Q,implicitKey:Y,indent:G,indentStep:U,inFlow:W}=Z;if(Y&&q.includes(`
|
|
56
|
+
`)||W&&/[[\]{},]/.test(q))return b$(q,Z);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(q))return Y||W||!q.includes(`
|
|
57
|
+
`)?b$(q,Z):v8($,Z,X,z);if(!Y&&!W&&J!==F0.Scalar.PLAIN&&q.includes(`
|
|
58
|
+
`))return v8($,Z,X,z);if(m8(q)){if(G==="")return Z.forceBlockIndent=!0,v8($,Z,X,z);else if(Y&&G===U)return b$(q,Z)}let V=q.replace(/\n+/g,`$&
|
|
59
|
+
${G}`);if(Q){let H=(B)=>B.default&&B.tag!=="tag:yaml.org,2002:str"&&B.test?.test(V),{compat:D,tags:T}=Z.doc.schema;if(T.some(H)||D?.some(H))return b$(q,Z)}return Y?V:i0.foldFlowLines(V,G,i0.FOLD_FLOW,u8(Z,!1))}function j1($,Z,X,z){let{implicitKey:J,inFlow:q}=Z,Q=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:Y}=$;if(Y!==F0.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(Q.value))Y=F0.Scalar.QUOTE_DOUBLE}let G=(W)=>{switch(W){case F0.Scalar.BLOCK_FOLDED:case F0.Scalar.BLOCK_LITERAL:return J||q?b$(Q.value,Z):v8(Q,Z,X,z);case F0.Scalar.QUOTE_DOUBLE:return O6(Q.value,Z);case F0.Scalar.QUOTE_SINGLE:return OZ(Q.value,Z);case F0.Scalar.PLAIN:return S1(Q,Z,X,z);default:return null}},U=G(Y);if(U===null){let{defaultKeyType:W,defaultStringType:V}=Z.options,H=J&&W||V;if(U=G(H),U===null)throw Error(`Unsupported default string type ${H}`)}return U}b1.stringifyString=j1});var R6=I((m1)=>{var k1=y8(),n0=f(),y1=M6(),f1=w6();function g1($,Z){let X=Object.assign({blockQuote:!0,commentString:y1.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,trailingComma:!1,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 h1($,Z){if(Z.tag){let J=$.filter((q)=>q.tag===Z.tag);if(J.length>0)return J.find((q)=>q.format===Z.format)??J[0]}let X=void 0,z;if(n0.isScalar(Z)){z=Z.value;let J=$.filter((q)=>q.identify?.(z));if(J.length>1){let q=J.filter((Q)=>Q.test);if(q.length>0)J=q}X=J.find((q)=>q.format===Z.format)??J.find((q)=>!q.format)}else z=Z,X=$.find((J)=>J.nodeClass&&z instanceof J.nodeClass);if(!X){let J=z?.constructor?.name??(z===null?"null":typeof z);throw Error(`Tag not resolved for ${J} value`)}return X}function v1($,Z,{anchors:X,doc:z}){if(!z.directives)return"";let J=[],q=(n0.isScalar($)||n0.isCollection($))&&$.anchor;if(q&&k1.anchorIsValid(q))X.add(q),J.push(`&${q}`);let Q=$.tag??(Z.default?null:Z.tag);if(Q)J.push(z.directives.tagString(Q));return J.join(" ")}function u1($,Z,X,z){if(n0.isPair($))return $.toString(Z,X,z);if(n0.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 J=void 0,q=n0.isNode($)?$:Z.doc.createNode($,{onTagObj:(G)=>J=G});J??(J=h1(Z.doc.schema.tags,q));let Q=v1(q,J,Z);if(Q.length>0)Z.indentAtStart=(Z.indentAtStart??0)+Q.length+1;let Y=typeof J.stringify==="function"?J.stringify(q,Z,X,z):n0.isScalar(q)?f1.stringifyString(q,Z,X,z):q.toString(Z,X,z);if(!Q)return Y;return n0.isScalar(q)||Y[0]==="{"||Y[0]==="["?`${Q} ${Y}`:`${Q}
|
|
60
|
+
${Z.indent}${Y}`}m1.createStringifyContext=g1;m1.stringify=u1});var c7=I((l1)=>{var g0=f(),m7=z0(),d7=R6(),F6=M6();function p1({key:$,value:Z},X,z,J){let{allNullValues:q,doc:Q,indent:Y,indentStep:G,options:{commentString:U,indentSeq:W,simpleKeys:V}}=X,H=g0.isNode($)&&$.comment||null;if(V){if(H)throw Error("With simple keys, key nodes cannot have comments");if(g0.isCollection($)||!g0.isNode($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let D=!V&&(!$||H&&Z==null&&!X.inFlow||g0.isCollection($)||(g0.isScalar($)?$.type===m7.Scalar.BLOCK_FOLDED||$.type===m7.Scalar.BLOCK_LITERAL:typeof $==="object"));X=Object.assign({},X,{allNullValues:!1,implicitKey:!D&&(V||!q),indent:Y+G});let T=!1,B=!1,L=d7.stringify($,X,()=>T=!0,()=>B=!0);if(!D&&!X.inFlow&&L.length>1024){if(V)throw Error("With simple keys, single line scalar must not span more than 1024 characters");D=!0}if(X.inFlow){if(q||Z==null){if(T&&z)z();return L===""?"?":D?`? ${L}`:L}}else if(q&&!V||Z==null&&D){if(L=`? ${L}`,H&&!T)L+=F6.lineComment(L,X.indent,U(H));else if(B&&J)J();return L}if(T)H=null;if(D){if(H)L+=F6.lineComment(L,X.indent,U(H));L=`? ${L}
|
|
61
|
+
${Y}:`}else if(L=`${L}:`,H)L+=F6.lineComment(L,X.indent,U(H));let w,A,P;if(g0.isNode(Z))w=!!Z.spaceBefore,A=Z.commentBefore,P=Z.comment;else if(w=!1,A=null,P=null,Z&&typeof Z==="object")Z=Q.createNode(Z);if(X.implicitKey=!1,!D&&!H&&g0.isScalar(Z))X.indentAtStart=L.length+1;if(B=!1,!W&&G.length>=2&&!X.inFlow&&!D&&g0.isSeq(Z)&&!Z.flow&&!Z.tag&&!Z.anchor)X.indent=X.indent.substring(2);let C=!1,S=d7.stringify(Z,X,()=>C=!0,()=>B=!0),E=" ";if(H||w||A){if(E=w?`
|
|
62
|
+
`:"",A){let h=U(A);E+=`
|
|
63
|
+
${F6.indentComment(h,X.indent)}`}if(S===""&&!X.inFlow){if(E===`
|
|
64
|
+
`&&P)E=`
|
|
65
|
+
|
|
66
|
+
`}else E+=`
|
|
67
|
+
${X.indent}`}else if(!D&&g0.isCollection(Z)){let h=S[0],R=S.indexOf(`
|
|
68
|
+
`),o=R!==-1,C0=X.inFlow??Z.flow??Z.items.length===0;if(o||!C0){let d=!1;if(o&&(h==="&"||h==="!")){let $0=S.indexOf(" ");if(h==="&"&&$0!==-1&&$0<R&&S[$0+1]==="!")$0=S.indexOf(" ",$0+1);if($0===-1||R<$0)d=!0}if(!d)E=`
|
|
69
69
|
${X.indent}`}}else if(S===""||S[0]===`
|
|
70
|
-
`)
|
|
71
|
-
${G}${
|
|
72
|
-
`}}if($){if(
|
|
73
|
-
`+
|
|
74
|
-
`)))U
|
|
75
|
-
${q}${J}${
|
|
70
|
+
`)E="";if(L+=E+S,X.inFlow){if(C&&z)z()}else if(P&&!C)L+=F6.lineComment(L,X.indent,U(P));else if(B&&J)J();return L}l1.stringifyPair=p1});var RZ=I((r1)=>{var p7=G0("process");function n1($,...Z){if($==="debug")console.log(...Z)}function s1($,Z){if($==="debug"||$==="warn")if(typeof p7.emitWarning==="function")p7.emitWarning(Z);else console.warn(Z)}r1.debug=n1;r1.warn=s1});var p8=I((e1)=>{var A6=f(),l7=z0(),d8="<<",c8={identify:($)=>$===d8||typeof $==="symbol"&&$.description===d8,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new l7.Scalar(Symbol(d8)),{addToJSMap:i7}),stringify:()=>d8},t1=($,Z)=>(c8.identify(Z)||A6.isScalar(Z)&&(!Z.type||Z.type===l7.Scalar.PLAIN)&&c8.identify(Z.value))&&$?.doc.schema.tags.some((X)=>X.tag===c8.tag&&X.default);function i7($,Z,X){if(X=$&&A6.isAlias(X)?X.resolve($.doc):X,A6.isSeq(X))for(let z of X.items)FZ($,Z,z);else if(Array.isArray(X))for(let z of X)FZ($,Z,z);else FZ($,Z,X)}function FZ($,Z,X){let z=$&&A6.isAlias(X)?X.resolve($.doc):X;if(!A6.isMap(z))throw Error("Merge sources must be maps or map aliases");let J=z.toJSON(null,$,Map);for(let[q,Q]of J)if(Z instanceof Map){if(!Z.has(q))Z.set(q,Q)}else if(Z instanceof Set)Z.add(q);else if(!Object.prototype.hasOwnProperty.call(Z,q))Object.defineProperty(Z,q,{value:Q,writable:!0,enumerable:!0,configurable:!0});return Z}e1.addMergeToJSMap=i7;e1.isMergeKey=t1;e1.merge=c8});var PZ=I((YY)=>{var zY=RZ(),n7=p8(),JY=R6(),s7=f(),AZ=l0();function qY($,Z,{key:X,value:z}){if(s7.isNode(X)&&X.addToJSMap)X.addToJSMap($,Z,z);else if(n7.isMergeKey($,X))n7.addMergeToJSMap($,Z,z);else{let J=AZ.toJS(X,"",$);if(Z instanceof Map)Z.set(J,AZ.toJS(z,J,$));else if(Z instanceof Set)Z.add(J);else{let q=QY(X,J,$),Q=AZ.toJS(z,q,$);if(q in Z)Object.defineProperty(Z,q,{value:Q,writable:!0,enumerable:!0,configurable:!0});else Z[q]=Q}}return Z}function QY($,Z,X){if(Z===null)return"";if(typeof Z!=="object")return String(Z);if(s7.isNode($)&&X?.doc){let z=JY.createStringifyContext(X.doc,{});z.anchors=new Set;for(let q of X.anchors.keys())z.anchors.add(q.anchor);z.inFlow=!0,z.inStringifyKey=!0;let J=$.toString(z);if(!X.mapKeyWarned){let q=JSON.stringify(J);if(q.length>40)q=q.substring(0,36)+'..."';zY.warn(X.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${q}. Set mapAsMap: true to use object keys.`),X.mapKeyWarned=!0}return J}return JSON.stringify(Z)}YY.addPairToJSMap=qY});var s0=I((VY)=>{var r7=T6(),UY=c7(),WY=PZ(),l8=f();function HY($,Z,X){let z=r7.createNode($,void 0,X),J=r7.createNode(Z,void 0,X);return new i8(z,J)}class i8{constructor($,Z=null){Object.defineProperty(this,l8.NODE_TYPE,{value:l8.PAIR}),this.key=$,this.value=Z}clone($){let{key:Z,value:X}=this;if(l8.isNode(Z))Z=Z.clone($);if(l8.isNode(X))X=X.clone($);return new i8(Z,X)}toJSON($,Z){let X=Z?.mapAsMap?new Map:{};return WY.addPairToJSMap(Z,X,this)}toString($,Z,X){return $?.doc?UY.stringifyPair(this,$,Z,X):JSON.stringify(this)}}VY.Pair=i8;VY.createPair=HY});var _Z=I((IY)=>{var D$=f(),a7=R6(),n8=M6();function DY($,Z,X){return(Z.inFlow??$.flow?NY:LY)($,Z,X)}function LY({comment:$,items:Z},X,{blockItemPrefix:z,flowChars:J,itemIndent:q,onChompKeep:Q,onComment:Y}){let{indent:G,options:{commentString:U}}=X,W=Object.assign({},X,{indent:q,type:null}),V=!1,H=[];for(let T=0;T<Z.length;++T){let B=Z[T],L=null;if(D$.isNode(B)){if(!V&&B.spaceBefore)H.push("");if(s8(X,H,B.commentBefore,V),B.comment)L=B.comment}else if(D$.isPair(B)){let A=D$.isNode(B.key)?B.key:null;if(A){if(!V&&A.spaceBefore)H.push("");s8(X,H,A.commentBefore,V)}}V=!1;let w=a7.stringify(B,W,()=>L=null,()=>V=!0);if(L)w+=n8.lineComment(w,q,U(L));if(V&&L)V=!1;H.push(z+w)}let D;if(H.length===0)D=J.start+J.end;else{D=H[0];for(let T=1;T<H.length;++T){let B=H[T];D+=B?`
|
|
71
|
+
${G}${B}`:`
|
|
72
|
+
`}}if($){if(D+=`
|
|
73
|
+
`+n8.indentComment(U($),G),Y)Y()}else if(V&&Q)Q();return D}function NY({items:$},Z,{flowChars:X,itemIndent:z}){let{indent:J,indentStep:q,flowCollectionPadding:Q,options:{commentString:Y}}=Z;z+=q;let G=Object.assign({},Z,{indent:z,inFlow:!0,type:null}),U=!1,W=0,V=[];for(let T=0;T<$.length;++T){let B=$[T],L=null;if(D$.isNode(B)){if(B.spaceBefore)V.push("");if(s8(Z,V,B.commentBefore,!1),B.comment)L=B.comment}else if(D$.isPair(B)){let A=D$.isNode(B.key)?B.key:null;if(A){if(A.spaceBefore)V.push("");if(s8(Z,V,A.commentBefore,!1),A.comment)U=!0}let P=D$.isNode(B.value)?B.value:null;if(P){if(P.comment)L=P.comment;if(P.commentBefore)U=!0}else if(B.value==null&&A?.comment)L=A.comment}if(L)U=!0;let w=a7.stringify(B,G,()=>L=null);if(U||(U=V.length>W||w.includes(`
|
|
74
|
+
`)),T<$.length-1)w+=",";else if(Z.options.trailingComma){if(Z.options.lineWidth>0)U||(U=V.reduce((A,P)=>A+P.length+2,2)+(w.length+2)>Z.options.lineWidth);if(U)w+=","}if(L)w+=n8.lineComment(w,z,Y(L));V.push(w),W=V.length}let{start:H,end:D}=X;if(V.length===0)return H+D;else{if(!U){let T=V.reduce((B,L)=>B+L.length+2,2);U=Z.options.lineWidth>0&&T>Z.options.lineWidth}if(U){let T=H;for(let B of V)T+=B?`
|
|
75
|
+
${q}${J}${B}`:`
|
|
76
76
|
`;return`${T}
|
|
77
|
-
${J}${
|
|
78
|
-
`:" ")}return
|
|
77
|
+
${J}${D}`}else return`${H}${Q}${V.join(" ")}${Q}${D}`}}function s8({indent:$,options:{commentString:Z}},X,z,J){if(z&&J)z=z.replace(/^\n+/,"");if(z){let q=n8.indentComment(Z(z),$);X.push(q.trimStart())}}IY.stringifyCollection=DY});var a0=I((FY)=>{var MY=_Z(),OY=PZ(),wY=h8(),r0=f(),r8=s0(),RY=z0();function P6($,Z){let X=r0.isScalar(Z)?Z.value:Z;for(let z of $)if(r0.isPair(z)){if(z.key===Z||z.key===X)return z;if(r0.isScalar(z.key)&&z.key.value===X)return z}return}class o7 extends wY.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(r0.MAP,$);this.items=[]}static from($,Z,X){let{keepUndefined:z,replacer:J}=X,q=new this($),Q=(Y,G)=>{if(typeof J==="function")G=J.call(Z,Y,G);else if(Array.isArray(J)&&!J.includes(Y))return;if(G!==void 0||z)q.items.push(r8.createPair(Y,G,X))};if(Z instanceof Map)for(let[Y,G]of Z)Q(Y,G);else if(Z&&typeof Z==="object")for(let Y of Object.keys(Z))Q(Y,Z[Y]);if(typeof $.sortMapEntries==="function")q.items.sort($.sortMapEntries);return q}add($,Z){let X;if(r0.isPair($))X=$;else if(!$||typeof $!=="object"||!("key"in $))X=new r8.Pair($,$?.value);else X=new r8.Pair($.key,$.value);let z=P6(this.items,X.key),J=this.schema?.sortMapEntries;if(z){if(!Z)throw Error(`Key ${X.key} already set`);if(r0.isScalar(z.value)&&RY.isScalarValue(X.value))z.value.value=X.value;else z.value=X.value}else if(J){let q=this.items.findIndex((Q)=>J(X,Q)<0);if(q===-1)this.items.push(X);else this.items.splice(q,0,X)}else this.items.push(X)}delete($){let Z=P6(this.items,$);if(!Z)return!1;return this.items.splice(this.items.indexOf(Z),1).length>0}get($,Z){let z=P6(this.items,$)?.value;return(!Z&&r0.isScalar(z)?z.value:z)??void 0}has($){return!!P6(this.items,$)}set($,Z){this.add(new r8.Pair($,Z),!0)}toJSON($,Z,X){let z=X?new X:Z?.mapAsMap?new Map:{};if(Z?.onCreate)Z.onCreate(z);for(let J of this.items)OY.addPairToJSMap(Z,z,J);return z}toString($,Z,X){if(!$)return JSON.stringify(this);for(let z of this.items)if(!r0.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 MY.stringifyCollection(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:X,onComment:Z})}}FY.YAMLMap=o7;FY.findPair=P6});var x$=I((EY)=>{var _Y=f(),t7=a0(),CY={collection:"map",default:!0,nodeClass:t7.YAMLMap,tag:"tag:yaml.org,2002:map",resolve($,Z){if(!_Y.isMap($))Z("Expected a mapping for this tag");return $},createNode:($,Z,X)=>t7.YAMLMap.from($,Z,X)};EY.map=CY});var o0=I((fY)=>{var jY=T6(),bY=_Z(),xY=h8(),o8=f(),kY=z0(),yY=l0();class e7 extends xY.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(o8.SEQ,$);this.items=[]}add($){this.items.push($)}delete($){let Z=a8($);if(typeof Z!=="number")return!1;return this.items.splice(Z,1).length>0}get($,Z){let X=a8($);if(typeof X!=="number")return;let z=this.items[X];return!Z&&o8.isScalar(z)?z.value:z}has($){let Z=a8($);return typeof Z==="number"&&Z<this.items.length}set($,Z){let X=a8($);if(typeof X!=="number")throw Error(`Expected a valid index, not ${$}.`);let z=this.items[X];if(o8.isScalar(z)&&kY.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 J of this.items)X.push(yY.toJS(J,String(z++),Z));return X}toString($,Z,X){if(!$)return JSON.stringify(this);return bY.stringifyCollection(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:X,onComment:Z})}static from($,Z,X){let{replacer:z}=X,J=new this($);if(Z&&Symbol.iterator in Object(Z)){let q=0;for(let Q of Z){if(typeof z==="function"){let Y=Z instanceof Set?Q:String(q++);Q=z.call(Z,Y,Q)}J.items.push(jY.createNode(Q,void 0,X))}}return J}}function a8($){let Z=o8.isScalar($)?$.value:$;if(Z&&typeof Z==="string")Z=Number(Z);return typeof Z==="number"&&Number.isInteger(Z)&&Z>=0?Z:null}fY.YAMLSeq=e7});var k$=I((uY)=>{var hY=f(),$X=o0(),vY={collection:"seq",default:!0,nodeClass:$X.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve($,Z){if(!hY.isSeq($))Z("Expected a sequence for this tag");return $},createNode:($,Z,X)=>$X.YAMLSeq.from($,Z,X)};uY.seq=vY});var _6=I((pY)=>{var dY=w6(),cY={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,Z,X,z){return Z=Object.assign({actualString:!0},Z),dY.stringifyString($,Z,X,z)}};pY.string=cY});var t8=I((iY)=>{var ZX=z0(),XX={identify:($)=>$==null,createNode:()=>new ZX.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ZX.Scalar(null),stringify:({source:$},Z)=>typeof $==="string"&&XX.test.test($)?$:Z.options.nullStr};iY.nullTag=XX});var CZ=I((rY)=>{var sY=z0(),zX={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new sY.Scalar($[0]==="t"||$[0]==="T"),stringify({source:$,value:Z},X){if($&&zX.test.test($)){let z=$[0]==="t"||$[0]==="T";if(Z===z)return $}return Z?X.options.trueStr:X.options.falseStr}};rY.boolTag=zX});var y$=I((tY)=>{function oY({format:$,minFractionDigits:Z,tag:X,value:z}){if(typeof z==="bigint")return String(z);let J=typeof z==="number"?z:Number(z);if(!isFinite(J))return isNaN(J)?".nan":J<0?"-.inf":".inf";let q=Object.is(z,-0)?"-0":JSON.stringify(z);if(!$&&Z&&(!X||X==="tag:yaml.org,2002:float")&&/^\d/.test(q)){let Q=q.indexOf(".");if(Q<0)Q=q.length,q+=".";let Y=Z-(q.length-Q-1);while(Y-- >0)q+="0"}return q}tY.stringifyNumber=oY});var SZ=I((J3)=>{var $3=z0(),EZ=y$(),Z3={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:EZ.stringifyNumber},X3={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():EZ.stringifyNumber($)}},z3={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let Z=new $3.Scalar(parseFloat($)),X=$.indexOf(".");if(X!==-1&&$[$.length-1]==="0")Z.minFractionDigits=$.length-X-1;return Z},stringify:EZ.stringifyNumber};J3.float=z3;J3.floatExp=X3;J3.floatNaN=Z3});var bZ=I((H3)=>{var JX=y$(),e8=($)=>typeof $==="bigint"||Number.isInteger($),jZ=($,Z,X,{intAsBigInt:z})=>z?BigInt($):parseInt($.substring(Z),X);function qX($,Z,X){let{value:z}=$;if(e8(z)&&z>=0)return X+z.toString(Z);return JX.stringifyNumber($)}var G3={identify:($)=>e8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,Z,X)=>jZ($,2,8,X),stringify:($)=>qX($,8,"0o")},U3={identify:e8,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,Z,X)=>jZ($,0,10,X),stringify:JX.stringifyNumber},W3={identify:($)=>e8($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,Z,X)=>jZ($,2,16,X),stringify:($)=>qX($,16,"0x")};H3.int=U3;H3.intHex=W3;H3.intOct=G3});var QX=I((O3)=>{var D3=x$(),L3=t8(),N3=k$(),I3=_6(),T3=CZ(),xZ=SZ(),kZ=bZ(),M3=[D3.map,N3.seq,I3.string,L3.nullTag,T3.boolTag,kZ.intOct,kZ.int,kZ.intHex,xZ.floatNaN,xZ.floatExp,xZ.float];O3.schema=M3});var GX=I((E3)=>{var R3=z0(),F3=x$(),A3=k$();function YX($){return typeof $==="bigint"||Number.isInteger($)}var $2=({value:$})=>JSON.stringify($),P3=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:$2},{identify:($)=>$==null,createNode:()=>new R3.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:$2},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:$2},{identify:YX,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,Z,{intAsBigInt:X})=>X?BigInt($):parseInt($,10),stringify:({value:$})=>YX($)?$.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:$2}],_3={default:!0,tag:"",test:/^/,resolve($,Z){return Z(`Unresolved plain scalar ${JSON.stringify($)}`),$}},C3=[F3.map,A3.seq].concat(P3,_3);E3.schema=C3});var fZ=I((x3)=>{var C6=G0("buffer"),yZ=z0(),j3=w6(),b3={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,Z){if(typeof C6.Buffer==="function")return C6.Buffer.from($,"base64");else if(typeof atob==="function"){let X=atob($.replace(/[\n\r]/g,"")),z=new Uint8Array(X.length);for(let J=0;J<X.length;++J)z[J]=X.charCodeAt(J);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,J,q){if(!X)return"";let Q=X,Y;if(typeof C6.Buffer==="function")Y=Q instanceof C6.Buffer?Q.toString("base64"):C6.Buffer.from(Q.buffer).toString("base64");else if(typeof btoa==="function"){let G="";for(let U=0;U<Q.length;++U)G+=String.fromCharCode(Q[U]);Y=btoa(G)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(Z??(Z=yZ.Scalar.BLOCK_LITERAL),Z!==yZ.Scalar.QUOTE_DOUBLE){let G=Math.max(z.options.lineWidth-z.indent.length,z.options.minContentWidth),U=Math.ceil(Y.length/G),W=Array(U);for(let V=0,H=0;V<U;++V,H+=G)W[V]=Y.substr(H,G);Y=W.join(Z===yZ.Scalar.BLOCK_LITERAL?`
|
|
78
|
+
`:" ")}return j3.stringifyString({comment:$,type:Z,value:Y},z,J,q)}};x3.binary=b3});var X2=I((h3)=>{var Z2=f(),gZ=s0(),y3=z0(),f3=o0();function UX($,Z){if(Z2.isSeq($))for(let X=0;X<$.items.length;++X){let z=$.items[X];if(Z2.isPair(z))continue;else if(Z2.isMap(z)){if(z.items.length>1)Z("Each pair must have its own sequence indicator");let J=z.items[0]||new gZ.Pair(new y3.Scalar(null));if(z.commentBefore)J.key.commentBefore=J.key.commentBefore?`${z.commentBefore}
|
|
79
79
|
${J.key.commentBefore}`:z.commentBefore;if(z.comment){let q=J.value??J.key;q.comment=q.comment?`${z.comment}
|
|
80
|
-
${q.comment}`:z.comment}z=J}$.items[X]=r8.isPair(z)?z:new CZ.Pair(z)}else Z("Expected a sequence for this tag");return $}function o7($,Z,X){let{replacer:z}=X,J=new M3.YAMLSeq($);J.tag="tag:yaml.org,2002:pairs";let q=0;if(Z&&Symbol.iterator in Object(Z))for(let Q of Z){if(typeof z==="function")Q=z.call(Z,String(q++),Q);let Y,G;if(Array.isArray(Q))if(Q.length===2)Y=Q[0],G=Q[1];else throw TypeError(`Expected [key, value] tuple: ${Q}`);else if(Q&&Q instanceof Object){let U=Object.keys(Q);if(U.length===1)Y=U[0],G=Q[Y];else throw TypeError(`Expected tuple with one key, not ${U.length} keys`)}else Y=Q;J.items.push(CZ.createPair(Y,G,X))}return J}var O3={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:a7,createNode:o7};w3.createPairs=o7;w3.pairs=O3;w3.resolvePairs=a7});var EZ=I((C3)=>{var t7=f(),SZ=m0(),F6=i0(),P3=n0(),e7=a8();class H$ extends P3.YAMLSeq{constructor(){super();this.add=F6.YAMLMap.prototype.add.bind(this),this.delete=F6.YAMLMap.prototype.delete.bind(this),this.get=F6.YAMLMap.prototype.get.bind(this),this.has=F6.YAMLMap.prototype.has.bind(this),this.set=F6.YAMLMap.prototype.set.bind(this),this.tag=H$.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 J,q;if(t7.isPair(z))J=SZ.toJS(z.key,"",Z),q=SZ.toJS(z.value,J,Z);else J=SZ.toJS(z,"",Z);if(X.has(J))throw Error("Ordered maps must not include duplicate keys");X.set(J,q)}return X}static from($,Z,X){let z=e7.createPairs($,Z,X),J=new this;return J.items=z.items,J}}H$.tag="tag:yaml.org,2002:omap";var _3={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:H$,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let X=e7.resolvePairs($,Z),z=[];for(let{key:J}of X.items)if(t7.isScalar(J))if(z.includes(J.value))Z(`Ordered maps must not include duplicate keys: ${J.value}`);else z.push(J.value);return Object.assign(new H$,X)},createNode:($,Z,X)=>H$.from($,Z,X)};C3.YAMLOMap=H$;C3.omap=_3});var JX=I((j3)=>{var $X=$0();function ZX({value:$,source:Z},X){if(Z&&($?XX:zX).test.test(Z))return Z;return $?X.options.trueStr:X.options.falseStr}var XX={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new $X.Scalar(!0),stringify:ZX},zX={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new $X.Scalar(!1),stringify:ZX};j3.falseTag=zX;j3.trueTag=XX});var qX=I((h3)=>{var k3=$0(),jZ=E$(),y3={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:jZ.stringifyNumber},f3={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():jZ.stringifyNumber($)}},g3={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new k3.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:jZ.stringifyNumber};h3.float=g3;h3.floatExp=f3;h3.floatNaN=y3});var YX=I((i3)=>{var QX=E$(),R6=($)=>typeof $==="bigint"||Number.isInteger($);function o8($,Z,X,{intAsBigInt:z}){let J=$[0];if(J==="-"||J==="+")Z+=1;if($=$.substring(Z).replace(/_/g,""),z){switch(X){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let Q=BigInt($);return J==="-"?BigInt(-1)*Q:Q}let q=parseInt($,X);return J==="-"?-1*q:q}function bZ($,Z,X){let{value:z}=$;if(R6(z)){let J=z.toString(Z);return z<0?"-"+X+J.substr(1):X+J}return QX.stringifyNumber($)}var d3={identify:R6,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,X)=>o8($,2,2,X),stringify:($)=>bZ($,2,"0b")},c3={identify:R6,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,X)=>o8($,1,8,X),stringify:($)=>bZ($,8,"0")},p3={identify:R6,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,X)=>o8($,0,10,X),stringify:QX.stringifyNumber},l3={identify:R6,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,X)=>o8($,2,16,X),stringify:($)=>bZ($,16,"0x")};i3.int=p3;i3.intBin=d3;i3.intHex=l3;i3.intOct=c3});var xZ=I((t3)=>{var $2=f(),t8=p0(),e8=i0();class V$ extends e8.YAMLMap{constructor($){super($);this.tag=V$.tag}add($){let Z;if($2.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new t8.Pair($.key,null);else Z=new t8.Pair($,null);if(!e8.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let X=e8.findPair(this.items,$);return!Z&&$2.isPair(X)?$2.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=e8.findPair(this.items,$);if(X&&!Z)this.items.splice(this.items.indexOf(X),1);else if(!X&&Z)this.items.push(new t8.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,J=new this($);if(Z&&Symbol.iterator in Object(Z))for(let q of Z){if(typeof z==="function")q=z.call(Z,q,q);J.items.push(t8.createPair(q,null,X))}return J}}V$.tag="tag:yaml.org,2002:set";var o3={collection:"map",identify:($)=>$ instanceof Set,nodeClass:V$,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,X)=>V$.from($,Z,X),resolve($,Z){if($2.isMap($))if($.hasAllNullValues(!0))return Object.assign(new V$,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};t3.YAMLSet=V$;t3.set=o3});var yZ=I((JG)=>{var ZG=E$();function kZ($,Z){let X=$[0],z=X==="-"||X==="+"?$.substring(1):$,J=(Q)=>Z?BigInt(Q):Number(Q),q=z.replace(/_/g,"").split(":").reduce((Q,Y)=>Q*J(60)+J(Y),J(0));return X==="-"?J(-1)*q:q}function GX($){let{value:Z}=$,X=(Q)=>Q;if(typeof Z==="bigint")X=(Q)=>BigInt(Q);else if(isNaN(Z)||!isFinite(Z))return ZG.stringifyNumber($);let z="";if(Z<0)z="-",Z*=X(-1);let J=X(60),q=[Z%J];if(Z<60)q.unshift(0);else if(Z=(Z-q[0])/J,q.unshift(Z%J),Z>=60)Z=(Z-q[0])/J,q.unshift(Z);return z+q.map((Q)=>String(Q).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var XG={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})=>kZ($,X),stringify:GX},zG={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:($)=>kZ($,!1),stringify:GX},UX={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(UX.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,X,z,J,q,Q,Y]=Z.map(Number),G=Z[7]?Number((Z[7]+"00").substr(1,3)):0,U=Date.UTC(X,z-1,J,q||0,Q||0,Y||0,G),W=Z[8];if(W&&W!=="Z"){let V=kZ(W,!1);if(Math.abs(V)<30)V*=60;U-=60000*V}return new Date(U)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};JG.floatTime=zG;JG.intTime=XG;JG.timestamp=UX});var HX=I((IG)=>{var GG=C$(),UG=i8(),WG=S$(),HG=O6(),VG=_Z(),WX=JX(),fZ=qX(),Z2=YX(),KG=h8(),DG=EZ(),BG=a8(),NG=xZ(),gZ=yZ(),LG=[GG.map,WG.seq,HG.string,UG.nullTag,WX.trueTag,WX.falseTag,Z2.intBin,Z2.intOct,Z2.int,Z2.intHex,fZ.floatNaN,fZ.floatExp,fZ.float,VG.binary,KG.merge,DG.omap,BG.pairs,NG.set,gZ.intTime,gZ.floatTime,gZ.timestamp];IG.schema=LG});var OX=I((_G)=>{var BX=C$(),MG=i8(),NX=S$(),OG=O6(),wG=TZ(),hZ=OZ(),vZ=FZ(),FG=n7(),RG=r7(),LX=_Z(),A6=h8(),IX=EZ(),TX=a8(),VX=HX(),MX=xZ(),X2=yZ(),KX=new Map([["core",FG.schema],["failsafe",[BX.map,NX.seq,OG.string]],["json",RG.schema],["yaml11",VX.schema],["yaml-1.1",VX.schema]]),DX={binary:LX.binary,bool:wG.boolTag,float:hZ.float,floatExp:hZ.floatExp,floatNaN:hZ.floatNaN,floatTime:X2.floatTime,int:vZ.int,intHex:vZ.intHex,intOct:vZ.intOct,intTime:X2.intTime,map:BX.map,merge:A6.merge,null:MG.nullTag,omap:IX.omap,pairs:TX.pairs,seq:NX.seq,set:MX.set,timestamp:X2.timestamp},AG={"tag:yaml.org,2002:binary":LX.binary,"tag:yaml.org,2002:merge":A6.merge,"tag:yaml.org,2002:omap":IX.omap,"tag:yaml.org,2002:pairs":TX.pairs,"tag:yaml.org,2002:set":MX.set,"tag:yaml.org,2002:timestamp":X2.timestamp};function PG($,Z,X){let z=KX.get(Z);if(z&&!$)return X&&!z.includes(A6.merge)?z.concat(A6.merge):z.slice();let J=z;if(!J)if(Array.isArray($))J=[];else{let q=Array.from(KX.keys()).filter((Q)=>Q!=="yaml11").map((Q)=>JSON.stringify(Q)).join(", ");throw Error(`Unknown schema "${Z}"; use one of ${q} or define customTags array`)}if(Array.isArray($))for(let q of $)J=J.concat(q);else if(typeof $==="function")J=$(J.slice());if(X)J=J.concat(A6.merge);return J.reduce((q,Q)=>{let Y=typeof Q==="string"?DX[Q]:Q;if(!Y){let G=JSON.stringify(Q),U=Object.keys(DX).map((W)=>JSON.stringify(W)).join(", ");throw Error(`Unknown custom tag ${G}; use one of ${U}`)}if(!q.includes(Y))q.push(Y);return q},[])}_G.coreKnownTags=AG;_G.getTags=PG});var dZ=I((kG)=>{var uZ=f(),EG=C$(),jG=S$(),bG=O6(),z2=OX(),xG=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class mZ{constructor({compat:$,customTags:Z,merge:X,resolveKnownTags:z,schema:J,sortMapEntries:q,toStringDefaults:Q}){this.compat=Array.isArray($)?z2.getTags($,"compat"):$?z2.getTags(null,$):null,this.name=typeof J==="string"&&J||"core",this.knownTags=z?z2.coreKnownTags:{},this.tags=z2.getTags(Z,this.name,X),this.toStringOptions=Q??null,Object.defineProperty(this,uZ.MAP,{value:EG.map}),Object.defineProperty(this,uZ.SCALAR,{value:bG.string}),Object.defineProperty(this,uZ.SEQ,{value:jG.seq}),this.sortMapEntries=typeof q==="function"?q:q===!0?xG:null}clone(){let $=Object.create(mZ.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}kG.Schema=mZ});var wX=I((hG)=>{var fG=f(),cZ=L6(),P6=D6();function gG($,Z){let X=[],z=Z.directives===!0;if(Z.directives!==!1&&$.directives){let G=$.directives.toString($);if(G)X.push(G),z=!0;else if($.directives.docStart)z=!0}if(z)X.push("---");let J=cZ.createStringifyContext($,Z),{commentString:q}=J.options;if($.commentBefore){if(X.length!==1)X.unshift("");let G=q($.commentBefore);X.unshift(P6.indentComment(G,""))}let Q=!1,Y=null;if($.contents){if(fG.isNode($.contents)){if($.contents.spaceBefore&&z)X.push("");if($.contents.commentBefore){let W=q($.contents.commentBefore);X.push(P6.indentComment(W,""))}J.forceBlockIndent=!!$.comment,Y=$.contents.comment}let G=Y?void 0:()=>Q=!0,U=cZ.stringify($.contents,J,()=>Y=null,G);if(Y)U+=P6.lineComment(U,"",q(Y));if((U[0]==="|"||U[0]===">")&&X[X.length-1]==="---")X[X.length-1]=`--- ${U}`;else X.push(U)}else X.push(cZ.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let G=q($.comment);if(G.includes(`
|
|
81
|
-
`))X.push("..."),X.push(
|
|
80
|
+
${q.comment}`:z.comment}z=J}$.items[X]=Z2.isPair(z)?z:new gZ.Pair(z)}else Z("Expected a sequence for this tag");return $}function WX($,Z,X){let{replacer:z}=X,J=new f3.YAMLSeq($);J.tag="tag:yaml.org,2002:pairs";let q=0;if(Z&&Symbol.iterator in Object(Z))for(let Q of Z){if(typeof z==="function")Q=z.call(Z,String(q++),Q);let Y,G;if(Array.isArray(Q))if(Q.length===2)Y=Q[0],G=Q[1];else throw TypeError(`Expected [key, value] tuple: ${Q}`);else if(Q&&Q instanceof Object){let U=Object.keys(Q);if(U.length===1)Y=U[0],G=Q[Y];else throw TypeError(`Expected tuple with one key, not ${U.length} keys`)}else Y=Q;J.items.push(gZ.createPair(Y,G,X))}return J}var g3={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:UX,createNode:WX};h3.createPairs=WX;h3.pairs=g3;h3.resolvePairs=UX});var vZ=I((p3)=>{var HX=f(),hZ=l0(),E6=a0(),d3=o0(),VX=X2();class L$ extends d3.YAMLSeq{constructor(){super();this.add=E6.YAMLMap.prototype.add.bind(this),this.delete=E6.YAMLMap.prototype.delete.bind(this),this.get=E6.YAMLMap.prototype.get.bind(this),this.has=E6.YAMLMap.prototype.has.bind(this),this.set=E6.YAMLMap.prototype.set.bind(this),this.tag=L$.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 J,q;if(HX.isPair(z))J=hZ.toJS(z.key,"",Z),q=hZ.toJS(z.value,J,Z);else J=hZ.toJS(z,"",Z);if(X.has(J))throw Error("Ordered maps must not include duplicate keys");X.set(J,q)}return X}static from($,Z,X){let z=VX.createPairs($,Z,X),J=new this;return J.items=z.items,J}}L$.tag="tag:yaml.org,2002:omap";var c3={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:L$,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,Z){let X=VX.resolvePairs($,Z),z=[];for(let{key:J}of X.items)if(HX.isScalar(J))if(z.includes(J.value))Z(`Ordered maps must not include duplicate keys: ${J.value}`);else z.push(J.value);return Object.assign(new L$,X)},createNode:($,Z,X)=>L$.from($,Z,X)};p3.YAMLOMap=L$;p3.omap=c3});var NX=I((n3)=>{var KX=z0();function BX({value:$,source:Z},X){if(Z&&($?DX:LX).test.test(Z))return Z;return $?X.options.trueStr:X.options.falseStr}var DX={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new KX.Scalar(!0),stringify:BX},LX={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new KX.Scalar(!1),stringify:BX};n3.falseTag=LX;n3.trueTag=DX});var IX=I(($G)=>{var a3=z0(),uZ=y$(),o3={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:uZ.stringifyNumber},t3={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():uZ.stringifyNumber($)}},e3={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let Z=new a3.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:uZ.stringifyNumber};$G.float=e3;$G.floatExp=t3;$G.floatNaN=o3});var MX=I((GG)=>{var TX=y$(),S6=($)=>typeof $==="bigint"||Number.isInteger($);function z2($,Z,X,{intAsBigInt:z}){let J=$[0];if(J==="-"||J==="+")Z+=1;if($=$.substring(Z).replace(/_/g,""),z){switch(X){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let Q=BigInt($);return J==="-"?BigInt(-1)*Q:Q}let q=parseInt($,X);return J==="-"?-1*q:q}function mZ($,Z,X){let{value:z}=$;if(S6(z)){let J=z.toString(Z);return z<0?"-"+X+J.substr(1):X+J}return TX.stringifyNumber($)}var JG={identify:S6,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,Z,X)=>z2($,2,2,X),stringify:($)=>mZ($,2,"0b")},qG={identify:S6,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,Z,X)=>z2($,1,8,X),stringify:($)=>mZ($,8,"0")},QG={identify:S6,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,Z,X)=>z2($,0,10,X),stringify:TX.stringifyNumber},YG={identify:S6,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,Z,X)=>z2($,2,16,X),stringify:($)=>mZ($,16,"0x")};GG.int=QG;GG.intBin=JG;GG.intHex=YG;GG.intOct=qG});var dZ=I((BG)=>{var Q2=f(),J2=s0(),q2=a0();class N$ extends q2.YAMLMap{constructor($){super($);this.tag=N$.tag}add($){let Z;if(Q2.isPair($))Z=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)Z=new J2.Pair($.key,null);else Z=new J2.Pair($,null);if(!q2.findPair(this.items,Z.key))this.items.push(Z)}get($,Z){let X=q2.findPair(this.items,$);return!Z&&Q2.isPair(X)?Q2.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=q2.findPair(this.items,$);if(X&&!Z)this.items.splice(this.items.indexOf(X),1);else if(!X&&Z)this.items.push(new J2.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,J=new this($);if(Z&&Symbol.iterator in Object(Z))for(let q of Z){if(typeof z==="function")q=z.call(Z,q,q);J.items.push(J2.createPair(q,null,X))}return J}}N$.tag="tag:yaml.org,2002:set";var KG={collection:"map",identify:($)=>$ instanceof Set,nodeClass:N$,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,Z,X)=>N$.from($,Z,X),resolve($,Z){if(Q2.isMap($))if($.hasAllNullValues(!0))return Object.assign(new N$,$);else Z("Set items must all have null values");else Z("Expected a mapping for this tag");return $}};BG.YAMLSet=N$;BG.set=KG});var pZ=I((MG)=>{var NG=y$();function cZ($,Z){let X=$[0],z=X==="-"||X==="+"?$.substring(1):$,J=(Q)=>Z?BigInt(Q):Number(Q),q=z.replace(/_/g,"").split(":").reduce((Q,Y)=>Q*J(60)+J(Y),J(0));return X==="-"?J(-1)*q:q}function OX($){let{value:Z}=$,X=(Q)=>Q;if(typeof Z==="bigint")X=(Q)=>BigInt(Q);else if(isNaN(Z)||!isFinite(Z))return NG.stringifyNumber($);let z="";if(Z<0)z="-",Z*=X(-1);let J=X(60),q=[Z%J];if(Z<60)q.unshift(0);else if(Z=(Z-q[0])/J,q.unshift(Z%J),Z>=60)Z=(Z-q[0])/J,q.unshift(Z);return z+q.map((Q)=>String(Q).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var IG={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})=>cZ($,X),stringify:OX},TG={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:($)=>cZ($,!1),stringify:OX},wX={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(wX.test);if(!Z)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,X,z,J,q,Q,Y]=Z.map(Number),G=Z[7]?Number((Z[7]+"00").substr(1,3)):0,U=Date.UTC(X,z-1,J,q||0,Q||0,Y||0,G),W=Z[8];if(W&&W!=="Z"){let V=cZ(W,!1);if(Math.abs(V)<30)V*=60;U-=60000*V}return new Date(U)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};MG.floatTime=TG;MG.intTime=IG;MG.timestamp=wX});var FX=I((kG)=>{var FG=x$(),AG=t8(),PG=k$(),_G=_6(),CG=fZ(),RX=NX(),lZ=IX(),Y2=MX(),EG=p8(),SG=vZ(),jG=X2(),bG=dZ(),iZ=pZ(),xG=[FG.map,PG.seq,_G.string,AG.nullTag,RX.trueTag,RX.falseTag,Y2.intBin,Y2.intOct,Y2.int,Y2.intHex,lZ.floatNaN,lZ.floatExp,lZ.float,CG.binary,EG.merge,SG.omap,jG.pairs,bG.set,iZ.intTime,iZ.floatTime,iZ.timestamp];kG.schema=xG});var kX=I((cG)=>{var CX=x$(),fG=t8(),EX=k$(),gG=_6(),hG=CZ(),nZ=SZ(),sZ=bZ(),vG=QX(),uG=GX(),SX=fZ(),j6=p8(),jX=vZ(),bX=X2(),AX=FX(),xX=dZ(),G2=pZ(),PX=new Map([["core",vG.schema],["failsafe",[CX.map,EX.seq,gG.string]],["json",uG.schema],["yaml11",AX.schema],["yaml-1.1",AX.schema]]),_X={binary:SX.binary,bool:hG.boolTag,float:nZ.float,floatExp:nZ.floatExp,floatNaN:nZ.floatNaN,floatTime:G2.floatTime,int:sZ.int,intHex:sZ.intHex,intOct:sZ.intOct,intTime:G2.intTime,map:CX.map,merge:j6.merge,null:fG.nullTag,omap:jX.omap,pairs:bX.pairs,seq:EX.seq,set:xX.set,timestamp:G2.timestamp},mG={"tag:yaml.org,2002:binary":SX.binary,"tag:yaml.org,2002:merge":j6.merge,"tag:yaml.org,2002:omap":jX.omap,"tag:yaml.org,2002:pairs":bX.pairs,"tag:yaml.org,2002:set":xX.set,"tag:yaml.org,2002:timestamp":G2.timestamp};function dG($,Z,X){let z=PX.get(Z);if(z&&!$)return X&&!z.includes(j6.merge)?z.concat(j6.merge):z.slice();let J=z;if(!J)if(Array.isArray($))J=[];else{let q=Array.from(PX.keys()).filter((Q)=>Q!=="yaml11").map((Q)=>JSON.stringify(Q)).join(", ");throw Error(`Unknown schema "${Z}"; use one of ${q} or define customTags array`)}if(Array.isArray($))for(let q of $)J=J.concat(q);else if(typeof $==="function")J=$(J.slice());if(X)J=J.concat(j6.merge);return J.reduce((q,Q)=>{let Y=typeof Q==="string"?_X[Q]:Q;if(!Y){let G=JSON.stringify(Q),U=Object.keys(_X).map((W)=>JSON.stringify(W)).join(", ");throw Error(`Unknown custom tag ${G}; use one of ${U}`)}if(!q.includes(Y))q.push(Y);return q},[])}cG.coreKnownTags=mG;cG.getTags=dG});var oZ=I((aG)=>{var rZ=f(),iG=x$(),nG=k$(),sG=_6(),U2=kX(),rG=($,Z)=>$.key<Z.key?-1:$.key>Z.key?1:0;class aZ{constructor({compat:$,customTags:Z,merge:X,resolveKnownTags:z,schema:J,sortMapEntries:q,toStringDefaults:Q}){this.compat=Array.isArray($)?U2.getTags($,"compat"):$?U2.getTags(null,$):null,this.name=typeof J==="string"&&J||"core",this.knownTags=z?U2.coreKnownTags:{},this.tags=U2.getTags(Z,this.name,X),this.toStringOptions=Q??null,Object.defineProperty(this,rZ.MAP,{value:iG.map}),Object.defineProperty(this,rZ.SCALAR,{value:sG.string}),Object.defineProperty(this,rZ.SEQ,{value:nG.seq}),this.sortMapEntries=typeof q==="function"?q:q===!0?rG:null}clone(){let $=Object.create(aZ.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}aG.Schema=aZ});var yX=I(($U)=>{var tG=f(),tZ=R6(),b6=M6();function eG($,Z){let X=[],z=Z.directives===!0;if(Z.directives!==!1&&$.directives){let G=$.directives.toString($);if(G)X.push(G),z=!0;else if($.directives.docStart)z=!0}if(z)X.push("---");let J=tZ.createStringifyContext($,Z),{commentString:q}=J.options;if($.commentBefore){if(X.length!==1)X.unshift("");let G=q($.commentBefore);X.unshift(b6.indentComment(G,""))}let Q=!1,Y=null;if($.contents){if(tG.isNode($.contents)){if($.contents.spaceBefore&&z)X.push("");if($.contents.commentBefore){let W=q($.contents.commentBefore);X.push(b6.indentComment(W,""))}J.forceBlockIndent=!!$.comment,Y=$.contents.comment}let G=Y?void 0:()=>Q=!0,U=tZ.stringify($.contents,J,()=>Y=null,G);if(Y)U+=b6.lineComment(U,"",q(Y));if((U[0]==="|"||U[0]===">")&&X[X.length-1]==="---")X[X.length-1]=`--- ${U}`;else X.push(U)}else X.push(tZ.stringify($.contents,J));if($.directives?.docEnd)if($.comment){let G=q($.comment);if(G.includes(`
|
|
81
|
+
`))X.push("..."),X.push(b6.indentComment(G,""));else X.push(`... ${G}`)}else X.push("...");else{let G=$.comment;if(G&&Q)G=G.replace(/^\n+/,"");if(G){if((!Q||Y)&&X[X.length-1]!=="")X.push("");X.push(b6.indentComment(q(G),""))}}return X.join(`
|
|
82
82
|
`)+`
|
|
83
|
-
`}
|
|
83
|
+
`}$U.stringifyDocument=eG});var x6=I((UU)=>{var XU=I6(),f$=h8(),O0=f(),zU=s0(),JU=l0(),qU=oZ(),QU=yX(),eZ=y8(),YU=IZ(),GU=T6(),$5=NZ();class Z5{constructor($,Z,X){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,O0.NODE_TYPE,{value:O0.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 J=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},X);this.options=J;let{version:q}=J;if(X?._directives){if(this.directives=X._directives.atDocument(),this.directives.yaml.explicit)q=this.directives.yaml.version}else this.directives=new $5.Directives({version:q});this.setSchema(q,X),this.contents=$===void 0?null:this.createNode($,z,X)}clone(){let $=Object.create(Z5.prototype,{[O0.NODE_TYPE]:{value:O0.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=O0.isNode(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(g$(this.contents))this.contents.add($)}addIn($,Z){if(g$(this.contents))this.contents.addIn($,Z)}createAlias($,Z){if(!$.anchor){let X=eZ.anchorNames(this);$.anchor=!Z||X.has(Z)?eZ.findNewAnchor(Z||"a",X):Z}return new XU.Alias($.anchor)}createNode($,Z,X){let z=void 0;if(typeof Z==="function")$=Z.call({"":$},"",$),z=Z;else if(Array.isArray(Z)){let B=(w)=>typeof w==="number"||w instanceof String||w instanceof Number,L=Z.filter(B).map(String);if(L.length>0)Z=Z.concat(L);z=Z}else if(X===void 0&&Z)X=Z,Z=void 0;let{aliasDuplicateObjects:J,anchorPrefix:q,flow:Q,keepUndefined:Y,onTagObj:G,tag:U}=X??{},{onAnchor:W,setAnchors:V,sourceObjects:H}=eZ.createNodeAnchors(this,q||"a"),D={aliasDuplicateObjects:J??!0,keepUndefined:Y??!1,onAnchor:W,onTagObj:G,replacer:z,schema:this.schema,sourceObjects:H},T=GU.createNode($,U,D);if(Q&&O0.isCollection(T))T.flow=!0;return V(),T}createPair($,Z,X={}){let z=this.createNode($,null,X),J=this.createNode(Z,null,X);return new zU.Pair(z,J)}delete($){return g$(this.contents)?this.contents.delete($):!1}deleteIn($){if(f$.isEmptyPath($)){if(this.contents==null)return!1;return this.contents=null,!0}return g$(this.contents)?this.contents.deleteIn($):!1}get($,Z){return O0.isCollection(this.contents)?this.contents.get($,Z):void 0}getIn($,Z){if(f$.isEmptyPath($))return!Z&&O0.isScalar(this.contents)?this.contents.value:this.contents;return O0.isCollection(this.contents)?this.contents.getIn($,Z):void 0}has($){return O0.isCollection(this.contents)?this.contents.has($):!1}hasIn($){if(f$.isEmptyPath($))return this.contents!==void 0;return O0.isCollection(this.contents)?this.contents.hasIn($):!1}set($,Z){if(this.contents==null)this.contents=f$.collectionFromPath(this.schema,[$],Z);else if(g$(this.contents))this.contents.set($,Z)}setIn($,Z){if(f$.isEmptyPath($))this.contents=Z;else if(this.contents==null)this.contents=f$.collectionFromPath(this.schema,Array.from($),Z);else if(g$(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 $5.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 $5.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 qU.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:J,reviver:q}={}){let Q={anchors:new Map,doc:this,keep:!$,mapAsMap:X===!0,mapKeyWarned:!1,maxAliasCount:typeof z==="number"?z:100},Y=JU.toJS(this.contents,Z??"",Q);if(typeof J==="function")for(let{count:G,res:U}of Q.anchors.values())J(U,G);return typeof q==="function"?YU.applyReviver(q,{"":Y},"",Y):Y}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 QU.stringifyDocument(this,$)}}function g$($){if(O0.isCollection($))return!0;throw Error("Expected a YAML collection as document contents")}UU.Document=Z5});var k6=I((VU)=>{class W2 extends Error{constructor($,Z,X,z){super();this.name=$,this.code=X,this.message=z,this.pos=Z}}class fX extends W2{constructor($,Z,X){super("YAMLParseError",$,Z,X)}}class gX extends W2{constructor($,Z,X){super("YAMLWarning",$,Z,X)}}var HU=($,Z)=>(X)=>{if(X.pos[0]===-1)return;X.linePos=X.pos.map((Y)=>Z.linePos(Y));let{line:z,col:J}=X.linePos[0];X.message+=` at line ${z}, column ${J}`;let q=J-1,Q=$.substring(Z.lineStarts[z-1],Z.lineStarts[z]).replace(/[\n\r]+$/,"");if(q>=60&&Q.length>80){let Y=Math.min(q-39,Q.length-79);Q="…"+Q.substring(Y),q-=Y-1}if(Q.length>80)Q=Q.substring(0,79)+"…";if(z>1&&/^ *$/.test(Q.substring(0,q))){let Y=$.substring(Z.lineStarts[z-2],Z.lineStarts[z-1]);if(Y.length>80)Y=Y.substring(0,79)+`…
|
|
84
84
|
`;Q=Y+Q}if(/[^ ]/.test(Q)){let Y=1,G=X.linePos[1];if(G?.line===z&&G.col>J)Y=Math.max(1,Math.min(G.col-J,80-q));let U=" ".repeat(q)+"^".repeat(Y);X.message+=`:
|
|
85
85
|
|
|
86
86
|
${Q}
|
|
87
87
|
${U}
|
|
88
|
-
`}};
|
|
89
|
-
`))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(
|
|
90
|
-
`+
|
|
91
|
-
`+
|
|
92
|
-
`+
|
|
93
|
-
`+
|
|
94
|
-
`+
|
|
95
|
-
`+
|
|
96
|
-
`.repeat(Math.max(1,Q.length-1)):"",
|
|
97
|
-
`;for(let
|
|
98
|
-
`;else if(
|
|
99
|
-
`;else if(!
|
|
88
|
+
`}};VU.YAMLError=W2;VU.YAMLParseError=fX;VU.YAMLWarning=gX;VU.prettifyError=HU});var y6=I((IU)=>{function NU($,{flow:Z,indicator:X,next:z,offset:J,onError:q,parentIndent:Q,startOnNewline:Y}){let G=!1,U=Y,W=Y,V="",H="",D=!1,T=!1,B=null,L=null,w=null,A=null,P=null,C=null,S=null;for(let R of $){if(T){if(R.type!=="space"&&R.type!=="newline"&&R.type!=="comma")q(R.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");T=!1}if(B){if(U&&R.type!=="comment"&&R.type!=="newline")q(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");B=null}switch(R.type){case"space":if(!Z&&(X!=="doc-start"||z?.type!=="flow-collection")&&R.source.includes("\t"))B=R;W=!0;break;case"comment":{if(!W)q(R,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let o=R.source.substring(1)||" ";if(!V)V=o;else V+=H+o;H="",U=!1;break}case"newline":if(U){if(V)V+=R.source;else if(!C||X!=="seq-item-ind")G=!0}else H+=R.source;if(U=!0,D=!0,L||w)A=R;W=!0;break;case"anchor":if(L)q(R,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(R.source.endsWith(":"))q(R.offset+R.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);L=R,S??(S=R.offset),U=!1,W=!1,T=!0;break;case"tag":{if(w)q(R,"MULTIPLE_TAGS","A node can have at most one tag");w=R,S??(S=R.offset),U=!1,W=!1,T=!0;break}case X:if(L||w)q(R,"BAD_PROP_ORDER",`Anchors and tags must be after the ${R.source} indicator`);if(C)q(R,"UNEXPECTED_TOKEN",`Unexpected ${R.source} in ${Z??"collection"}`);C=R,U=X==="seq-item-ind"||X==="explicit-key-ind",W=!1;break;case"comma":if(Z){if(P)q(R,"UNEXPECTED_TOKEN",`Unexpected , in ${Z}`);P=R,U=!1,W=!1;break}default:q(R,"UNEXPECTED_TOKEN",`Unexpected ${R.type} token`),U=!1,W=!1}}let E=$[$.length-1],h=E?E.offset+E.source.length:J;if(T&&z&&z.type!=="space"&&z.type!=="newline"&&z.type!=="comma"&&(z.type!=="scalar"||z.source!==""))q(z.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(B&&(U&&B.indent<=Q||z?.type==="block-map"||z?.type==="block-seq"))q(B,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:P,found:C,spaceBefore:G,comment:V,hasNewline:D,anchor:L,tag:w,newlineAfterProp:A,end:h,start:S??h}}IU.resolveProps=NU});var H2=I((MU)=>{function X5($){if(!$)return null;switch($.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if($.source.includes(`
|
|
89
|
+
`))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(X5(Z.key)||X5(Z.value))return!0}return!1;default:return!0}}MU.containsNewline=X5});var z5=I((FU)=>{var wU=H2();function RU($,Z,X){if(Z?.type==="flow-collection"){let z=Z.end[0];if(z.indent===$&&(z.source==="]"||z.source==="}")&&wU.containsNewline(Z))X(z,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}FU.flowIndentCheck=RU});var J5=I((_U)=>{var hX=f();function PU($,Z,X){let{uniqueKeys:z}=$.options;if(z===!1)return!1;let J=typeof z==="function"?z:(q,Q)=>q===Q||hX.isScalar(q)&&hX.isScalar(Q)&&q.value===Q.value;return Z.some((q)=>J(q.key,X))}_U.mapIncludes=PU});var cX=I((xU)=>{var vX=s0(),EU=a0(),uX=y6(),SU=H2(),mX=z5(),jU=J5(),dX="All mapping items must start at the same column";function bU({composeNode:$,composeEmptyNode:Z},X,z,J,q){let Y=new(q?.nodeClass??EU.YAMLMap)(X.schema);if(X.atRoot)X.atRoot=!1;let G=z.offset,U=null;for(let W of z.items){let{start:V,key:H,sep:D,value:T}=W,B=uX.resolveProps(V,{indicator:"explicit-key-ind",next:H??D?.[0],offset:G,onError:J,parentIndent:z.indent,startOnNewline:!0}),L=!B.found;if(L){if(H){if(H.type==="block-seq")J(G,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in H&&H.indent!==z.indent)J(G,"BAD_INDENT",dX)}if(!B.anchor&&!B.tag&&!D){if(U=B.end,B.comment)if(Y.comment)Y.comment+=`
|
|
90
|
+
`+B.comment;else Y.comment=B.comment;continue}if(B.newlineAfterProp||SU.containsNewline(H))J(H??V[V.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(B.found?.indent!==z.indent)J(G,"BAD_INDENT",dX);X.atKey=!0;let w=B.end,A=H?$(X,H,B,J):Z(X,w,V,null,B,J);if(X.schema.compat)mX.flowIndentCheck(z.indent,H,J);if(X.atKey=!1,jU.mapIncludes(X,Y.items,A))J(w,"DUPLICATE_KEY","Map keys must be unique");let P=uX.resolveProps(D??[],{indicator:"map-value-ind",next:T,offset:A.range[2],onError:J,parentIndent:z.indent,startOnNewline:!H||H.type==="block-scalar"});if(G=P.end,P.found){if(L){if(T?.type==="block-map"&&!P.hasNewline)J(G,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(X.options.strict&&B.start<P.found.offset-1024)J(A.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let C=T?$(X,T,P,J):Z(X,G,D,null,P,J);if(X.schema.compat)mX.flowIndentCheck(z.indent,T,J);G=C.range[2];let S=new vX.Pair(A,C);if(X.options.keepSourceTokens)S.srcToken=W;Y.items.push(S)}else{if(L)J(A.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(P.comment)if(A.comment)A.comment+=`
|
|
91
|
+
`+P.comment;else A.comment=P.comment;let C=new vX.Pair(A);if(X.options.keepSourceTokens)C.srcToken=W;Y.items.push(C)}}if(U&&U<G)J(U,"IMPOSSIBLE","Map comment with trailing content");return Y.range=[z.offset,G,U??G],Y}xU.resolveBlockMap=bU});var pX=I((vU)=>{var yU=o0(),fU=y6(),gU=z5();function hU({composeNode:$,composeEmptyNode:Z},X,z,J,q){let Y=new(q?.nodeClass??yU.YAMLSeq)(X.schema);if(X.atRoot)X.atRoot=!1;if(X.atKey)X.atKey=!1;let G=z.offset,U=null;for(let{start:W,value:V}of z.items){let H=fU.resolveProps(W,{indicator:"seq-item-ind",next:V,offset:G,onError:J,parentIndent:z.indent,startOnNewline:!0});if(!H.found)if(H.anchor||H.tag||V)if(V?.type==="block-seq")J(H.end,"BAD_INDENT","All sequence items must start at the same column");else J(G,"MISSING_CHAR","Sequence item without - indicator");else{if(U=H.end,H.comment)Y.comment=H.comment;continue}let D=V?$(X,V,H,J):Z(X,H.end,W,null,H,J);if(X.schema.compat)gU.flowIndentCheck(z.indent,V,J);G=D.range[2],Y.items.push(D)}return Y.range=[z.offset,G,U??G],Y}vU.resolveBlockSeq=hU});var h$=I((dU)=>{function mU($,Z,X,z){let J="";if($){let q=!1,Q="";for(let Y of $){let{source:G,type:U}=Y;switch(U){case"space":q=!0;break;case"comment":{if(X&&!q)z(Y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let W=G.substring(1)||" ";if(!J)J=W;else J+=Q+W;Q="";break}case"newline":if(J)Q+=G;q=!0;break;default:z(Y,"UNEXPECTED_TOKEN",`Unexpected ${U} at node end`)}Z+=G.length}}return{comment:J,offset:Z}}dU.resolveEnd=mU});var nX=I((oU)=>{var pU=f(),lU=s0(),lX=a0(),iU=o0(),nU=h$(),iX=y6(),sU=H2(),rU=J5(),q5="Block collections are not allowed within flow collections",Q5=($)=>$&&($.type==="block-map"||$.type==="block-seq");function aU({composeNode:$,composeEmptyNode:Z},X,z,J,q){let Q=z.start.source==="{",Y=Q?"flow map":"flow sequence",U=new(q?.nodeClass??(Q?lX.YAMLMap:iU.YAMLSeq))(X.schema);U.flow=!0;let W=X.atRoot;if(W)X.atRoot=!1;if(X.atKey)X.atKey=!1;let V=z.offset+z.start.source.length;for(let L=0;L<z.items.length;++L){let w=z.items[L],{start:A,key:P,sep:C,value:S}=w,E=iX.resolveProps(A,{flow:Y,indicator:"explicit-key-ind",next:P??C?.[0],offset:V,onError:J,parentIndent:z.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!C&&!S){if(L===0&&E.comma)J(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${Y}`);else if(L<z.items.length-1)J(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${Y}`);if(E.comment)if(U.comment)U.comment+=`
|
|
92
|
+
`+E.comment;else U.comment=E.comment;V=E.end;continue}if(!Q&&X.options.strict&&sU.containsNewline(P))J(P,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(L===0){if(E.comma)J(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${Y}`)}else{if(!E.comma)J(E.start,"MISSING_CHAR",`Missing , between ${Y} items`);if(E.comment){let h="";$:for(let R of A)switch(R.type){case"comma":case"space":break;case"comment":h=R.source.substring(1);break $;default:break $}if(h){let R=U.items[U.items.length-1];if(pU.isPair(R))R=R.value??R.key;if(R.comment)R.comment+=`
|
|
93
|
+
`+h;else R.comment=h;E.comment=E.comment.substring(h.length+1)}}}if(!Q&&!C&&!E.found){let h=S?$(X,S,E,J):Z(X,E.end,C,null,E,J);if(U.items.push(h),V=h.range[2],Q5(S))J(h.range,"BLOCK_IN_FLOW",q5)}else{X.atKey=!0;let h=E.end,R=P?$(X,P,E,J):Z(X,h,A,null,E,J);if(Q5(P))J(R.range,"BLOCK_IN_FLOW",q5);X.atKey=!1;let o=iX.resolveProps(C??[],{flow:Y,indicator:"map-value-ind",next:S,offset:R.range[2],onError:J,parentIndent:z.indent,startOnNewline:!1});if(o.found){if(!Q&&!E.found&&X.options.strict){if(C)for(let $0 of C){if($0===o.found)break;if($0.type==="newline"){J($0,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(E.start<o.found.offset-1024)J(o.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(S)if("source"in S&&S.source?.[0]===":")J(S,"MISSING_CHAR",`Missing space after : in ${Y}`);else J(o.start,"MISSING_CHAR",`Missing , or : between ${Y} items`);let C0=S?$(X,S,o,J):o.found?Z(X,o.end,C,null,o,J):null;if(C0){if(Q5(S))J(C0.range,"BLOCK_IN_FLOW",q5)}else if(o.comment)if(R.comment)R.comment+=`
|
|
94
|
+
`+o.comment;else R.comment=o.comment;let d=new lU.Pair(R,C0);if(X.options.keepSourceTokens)d.srcToken=w;if(Q){let $0=U;if(rU.mapIncludes(X,$0.items,R))J(h,"DUPLICATE_KEY","Map keys must be unique");$0.items.push(d)}else{let $0=new lX.YAMLMap(X.schema);$0.flow=!0,$0.items.push(d);let C$=(C0??R).range;$0.range=[R.range[0],C$[1],C$[2]],U.items.push($0)}V=C0?C0.range[2]:o.end}}let H=Q?"}":"]",[D,...T]=z.end,B=V;if(D?.source===H)B=D.offset+D.source.length;else{let L=Y[0].toUpperCase()+Y.substring(1),w=W?`${L} must end with a ${H}`:`${L} in block collection must be sufficiently indented and end with a ${H}`;if(J(V,W?"MISSING_CHAR":"BAD_INDENT",w),D&&D.source.length!==1)T.unshift(D)}if(T.length>0){let L=nU.resolveEnd(T,B,X.options.strict,J);if(L.comment)if(U.comment)U.comment+=`
|
|
95
|
+
`+L.comment;else U.comment=L.comment;U.range=[z.offset,B,L.offset]}else U.range=[z.offset,B,B];return U}oU.resolveFlowCollection=aU});var sX=I((YW)=>{var eU=f(),$W=z0(),ZW=a0(),XW=o0(),zW=cX(),JW=pX(),qW=nX();function Y5($,Z,X,z,J,q){let Q=X.type==="block-map"?zW.resolveBlockMap($,Z,X,z,q):X.type==="block-seq"?JW.resolveBlockSeq($,Z,X,z,q):qW.resolveFlowCollection($,Z,X,z,q),Y=Q.constructor;if(J==="!"||J===Y.tagName)return Q.tag=Y.tagName,Q;if(J)Q.tag=J;return Q}function QW($,Z,X,z,J){let q=z.tag,Q=!q?null:Z.directives.tagName(q.source,(H)=>J(q,"TAG_RESOLVE_FAILED",H));if(X.type==="block-seq"){let{anchor:H,newlineAfterProp:D}=z,T=H&&q?H.offset>q.offset?H:q:H??q;if(T&&(!D||D.offset<T.offset))J(T,"MISSING_CHAR","Missing newline after block sequence props")}let Y=X.type==="block-map"?"map":X.type==="block-seq"?"seq":X.start.source==="{"?"map":"seq";if(!q||!Q||Q==="!"||Q===ZW.YAMLMap.tagName&&Y==="map"||Q===XW.YAMLSeq.tagName&&Y==="seq")return Y5($,Z,X,J,Q);let G=Z.schema.tags.find((H)=>H.tag===Q&&H.collection===Y);if(!G){let H=Z.schema.knownTags[Q];if(H?.collection===Y)Z.schema.tags.push(Object.assign({},H,{default:!1})),G=H;else{if(H)J(q,"BAD_COLLECTION_TYPE",`${H.tag} used for ${Y} collection, but expects ${H.collection??"scalar"}`,!0);else J(q,"TAG_RESOLVE_FAILED",`Unresolved tag: ${Q}`,!0);return Y5($,Z,X,J,Q)}}let U=Y5($,Z,X,J,Q,G),W=G.resolve?.(U,(H)=>J(q,"TAG_RESOLVE_FAILED",H),Z.options)??U,V=eU.isNode(W)?W:new $W.Scalar(W);if(V.range=U.range,V.tag=Q,G?.format)V.format=G.format;return V}YW.composeCollection=QW});var U5=I((VW)=>{var G5=z0();function UW($,Z,X){let z=Z.offset,J=WW(Z,$.options.strict,X);if(!J)return{value:"",type:null,comment:"",range:[z,z,z]};let q=J.mode===">"?G5.Scalar.BLOCK_FOLDED:G5.Scalar.BLOCK_LITERAL,Q=Z.source?HW(Z.source):[],Y=Q.length;for(let B=Q.length-1;B>=0;--B){let L=Q[B][1];if(L===""||L==="\r")Y=B;else break}if(Y===0){let B=J.chomp==="+"&&Q.length>0?`
|
|
96
|
+
`.repeat(Math.max(1,Q.length-1)):"",L=z+J.length;if(Z.source)L+=Z.source.length;return{value:B,type:q,comment:J.comment,range:[z,L,L]}}let G=Z.indent+J.indent,U=Z.offset+J.length,W=0;for(let B=0;B<Y;++B){let[L,w]=Q[B];if(w===""||w==="\r"){if(J.indent===0&&L.length>G)G=L.length}else{if(L.length<G)X(U+L.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(J.indent===0)G=L.length;if(W=B,G===0&&!$.atRoot)X(U,"BAD_INDENT","Block scalar values in collections must be indented");break}U+=L.length+w.length+1}for(let B=Q.length-1;B>=Y;--B)if(Q[B][0].length>G)Y=B+1;let V="",H="",D=!1;for(let B=0;B<W;++B)V+=Q[B][0].slice(G)+`
|
|
97
|
+
`;for(let B=W;B<Y;++B){let[L,w]=Q[B];U+=L.length+w.length+1;let A=w[w.length-1]==="\r";if(A)w=w.slice(0,-1);if(w&&L.length<G){let C=`Block scalar lines must not be less indented than their ${J.indent?"explicit indentation indicator":"first line"}`;X(U-w.length-(A?2:1),"BAD_INDENT",C),L=""}if(q===G5.Scalar.BLOCK_LITERAL)V+=H+L.slice(G)+w,H=`
|
|
98
|
+
`;else if(L.length>G||w[0]==="\t"){if(H===" ")H=`
|
|
99
|
+
`;else if(!D&&H===`
|
|
100
100
|
`)H=`
|
|
101
101
|
|
|
102
|
-
`;V+=H+
|
|
103
|
-
`,
|
|
102
|
+
`;V+=H+L.slice(G)+w,H=`
|
|
103
|
+
`,D=!0}else if(w==="")if(H===`
|
|
104
104
|
`)V+=`
|
|
105
105
|
`;else H=`
|
|
106
|
-
`;else V+=H+
|
|
107
|
-
`+Q[
|
|
106
|
+
`;else V+=H+w,H=" ",D=!1}switch(J.chomp){case"-":break;case"+":for(let B=Y;B<Q.length;++B)V+=`
|
|
107
|
+
`+Q[B][0].slice(G);if(V[V.length-1]!==`
|
|
108
108
|
`)V+=`
|
|
109
109
|
`;break;default:V+=`
|
|
110
|
-
`}let T=z+J.length+Z.source.length;return{value:V,type:q,comment:J.comment,range:[z,T,T]}}function
|
|
110
|
+
`}let T=z+J.length+Z.source.length;return{value:V,type:q,comment:J.comment,range:[z,T,T]}}function WW({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:J}=Z[0],q=J[0],Q=0,Y="",G=-1;for(let H=1;H<J.length;++H){let D=J[H];if(!Y&&(D==="-"||D==="+"))Y=D;else{let T=Number(D);if(!Q&&T)Q=T;else if(G===-1)G=$+H}}if(G!==-1)z(G,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${J}`);let U=!1,W="",V=J.length;for(let H=1;H<Z.length;++H){let D=Z[H];switch(D.type){case"space":U=!0;case"newline":V+=D.source.length;break;case"comment":if(X&&!U)z(D,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");V+=D.source.length,W=D.source.substring(1);break;case"error":z(D,"UNEXPECTED_TOKEN",D.message),V+=D.source.length;break;default:{let T=`Unexpected token in block scalar header: ${D.type}`;z(D,"UNEXPECTED_TOKEN",T);let B=D.source;if(B&&typeof B==="string")V+=B.length}}}return{mode:q,indent:Q,chomp:Y,comment:W,length:V}}function HW($){let Z=$.split(/\n( *)/),X=Z[0],z=X.match(/^( *)/),q=[z?.[1]?[z[1],X.slice(z[1].length)]:["",X]];for(let Q=1;Q<Z.length;Q+=2)q.push([Z[Q],Z[Q+1]]);return q}VW.resolveBlockScalar=UW});var H5=I((wW)=>{var W5=z0(),BW=h$();function DW($,Z,X){let{offset:z,type:J,source:q,end:Q}=$,Y,G,U=(H,D,T)=>X(z+H,D,T);switch(J){case"scalar":Y=W5.Scalar.PLAIN,G=LW(q,U);break;case"single-quoted-scalar":Y=W5.Scalar.QUOTE_SINGLE,G=NW(q,U);break;case"double-quoted-scalar":Y=W5.Scalar.QUOTE_DOUBLE,G=IW(q,U);break;default:return X($,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${J}`),{value:"",type:null,comment:"",range:[z,z+q.length,z+q.length]}}let W=z+q.length,V=BW.resolveEnd(Q,W,Z,X);return{value:G,type:Y,comment:V.comment,range:[z,W,V.offset]}}function LW($,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 rX($)}function NW($,Z){if($[$.length-1]!=="'"||$.length===1)Z($.length,"MISSING_CHAR","Missing closing 'quote");return rX($.slice(1,-1)).replace(/''/g,"'")}function rX($){let Z,X;try{Z=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
111
111
|
`,"sy"),X=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
112
112
|
`,"sy")}catch{Z=/(.*?)[ \t]*\r?\n/sy,X=/[ \t]*(.*?)[ \t]*\r?\n/sy}let z=Z.exec($);if(!z)return $;let J=z[1],q=" ",Q=Z.lastIndex;X.lastIndex=Q;while(z=X.exec($)){if(z[1]==="")if(q===`
|
|
113
113
|
`)J+=q;else q=`
|
|
114
|
-
`;else J+=q+z[1],q=" ";Q=X.lastIndex}let Y=/[ \t]*(.*)/sy;return Y.lastIndex=Q,z=Y.exec($),J+q+(z?.[1]??"")}function
|
|
114
|
+
`;else J+=q+z[1],q=" ";Q=X.lastIndex}let Y=/[ \t]*(.*)/sy;return Y.lastIndex=Q,z=Y.exec($),J+q+(z?.[1]??"")}function IW($,Z){let X="";for(let z=1;z<$.length-1;++z){let J=$[z];if(J==="\r"&&$[z+1]===`
|
|
115
115
|
`)continue;if(J===`
|
|
116
|
-
`){let{fold:q,offset:Q}=
|
|
116
|
+
`){let{fold:q,offset:Q}=TW($,z);X+=q,z=Q}else if(J==="\\"){let q=$[++z],Q=MW[q];if(Q)X+=Q;else if(q===`
|
|
117
117
|
`){q=$[z+1];while(q===" "||q==="\t")q=$[++z+1]}else if(q==="\r"&&$[z+1]===`
|
|
118
|
-
`){q=$[++z+1];while(q===" "||q==="\t")q=$[++z+1]}else if(q==="x"||q==="u"||q==="U"){let Y={x:2,u:4,U:8}[q];X+=
|
|
118
|
+
`){q=$[++z+1];while(q===" "||q==="\t")q=$[++z+1]}else if(q==="x"||q==="u"||q==="U"){let Y={x:2,u:4,U:8}[q];X+=OW($,z+1,Y,Z),z+=Y}else{let Y=$.substr(z-1,2);Z(z-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${Y}`),X+=Y}}else if(J===" "||J==="\t"){let q=z,Q=$[z+1];while(Q===" "||Q==="\t")Q=$[++z+1];if(Q!==`
|
|
119
119
|
`&&!(Q==="\r"&&$[z+2]===`
|
|
120
|
-
`))X+=z>q?$.slice(q,z+1):J}else X+=J}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return X}function
|
|
120
|
+
`))X+=z>q?$.slice(q,z+1):J}else X+=J}if($[$.length-1]!=='"'||$.length===1)Z($.length,"MISSING_CHAR",'Missing closing "quote');return X}function TW($,Z){let X="",z=$[Z+1];while(z===" "||z==="\t"||z===`
|
|
121
121
|
`||z==="\r"){if(z==="\r"&&$[Z+2]!==`
|
|
122
122
|
`)break;if(z===`
|
|
123
123
|
`)X+=`
|
|
124
|
-
`;Z+=1,z=$[Z+1]}if(!X)X=" ";return{fold:X,offset:Z}}var
|
|
125
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function
|
|
124
|
+
`;Z+=1,z=$[Z+1]}if(!X)X=" ";return{fold:X,offset:Z}}var MW={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
125
|
+
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function OW($,Z,X,z){let J=$.substr(Z,X),Q=J.length===X&&/^[0-9a-fA-F]+$/.test(J)?parseInt(J,16):NaN;if(isNaN(Q)){let Y=$.substr(Z-2,X+2);return z(Z-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${Y}`),Y}return String.fromCodePoint(Q)}wW.resolveFlowScalar=DW});var oX=I((EW)=>{var I$=f(),aX=z0(),FW=U5(),AW=H5();function PW($,Z,X,z){let{value:J,type:q,comment:Q,range:Y}=Z.type==="block-scalar"?FW.resolveBlockScalar($,Z,z):AW.resolveFlowScalar(Z,$.options.strict,z),G=X?$.directives.tagName(X.source,(V)=>z(X,"TAG_RESOLVE_FAILED",V)):null,U;if($.options.stringKeys&&$.atKey)U=$.schema[I$.SCALAR];else if(G)U=_W($.schema,J,G,X,z);else if(Z.type==="scalar")U=CW($,J,Z,z);else U=$.schema[I$.SCALAR];let W;try{let V=U.resolve(J,(H)=>z(X??Z,"TAG_RESOLVE_FAILED",H),$.options);W=I$.isScalar(V)?V:new aX.Scalar(V)}catch(V){let H=V instanceof Error?V.message:String(V);z(X??Z,"TAG_RESOLVE_FAILED",H),W=new aX.Scalar(J)}if(W.range=Y,W.source=J,q)W.type=q;if(G)W.tag=G;if(U.format)W.format=U.format;if(Q)W.comment=Q;return W}function _W($,Z,X,z,J){if(X==="!")return $[I$.SCALAR];let q=[];for(let Y of $.tags)if(!Y.collection&&Y.tag===X)if(Y.default&&Y.test)q.push(Y);else return Y;for(let Y of q)if(Y.test?.test(Z))return Y;let Q=$.knownTags[X];if(Q&&!Q.collection)return $.tags.push(Object.assign({},Q,{default:!1,test:void 0})),Q;return J(z,"TAG_RESOLVE_FAILED",`Unresolved tag: ${X}`,X!=="tag:yaml.org,2002:str"),$[I$.SCALAR]}function CW({atKey:$,directives:Z,schema:X},z,J,q){let Q=X.tags.find((Y)=>(Y.default===!0||$&&Y.default==="key")&&Y.test?.test(z))||X[I$.SCALAR];if(X.compat){let Y=X.compat.find((G)=>G.default&&G.test?.test(z))??X[I$.SCALAR];if(Q.tag!==Y.tag){let G=Z.tagString(Q.tag),U=Z.tagString(Y.tag),W=`Value may be parsed as either ${G} or ${U}`;q(J,"TAG_RESOLVE_FAILED",W,!0)}}return Q}EW.composeScalar=PW});var tX=I((bW)=>{function jW($,Z,X){if(Z){X??(X=Z.length);for(let z=X-1;z>=0;--z){let J=Z[z];switch(J.type){case"space":case"comment":case"newline":$-=J.source.length;continue}J=Z[++z];while(J?.type==="space")$+=J.source.length,J=Z[++z];break}}return $}bW.emptyScalarPosition=jW});var Zz=I((mW)=>{var kW=I6(),yW=f(),fW=sX(),eX=oX(),gW=h$(),hW=tX(),vW={composeNode:$z,composeEmptyNode:V5};function $z($,Z,X,z){let J=$.atKey,{spaceBefore:q,comment:Q,anchor:Y,tag:G}=X,U,W=!0;switch(Z.type){case"alias":if(U=uW($,Z,z),Y||G)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=eX.composeScalar($,Z,G,z),Y)U.anchor=Y.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":try{if(U=fW.composeCollection(vW,$,Z,X,z),Y)U.anchor=Y.source.substring(1)}catch(V){let H=V instanceof Error?V.message:String(V);z(Z,"RESOURCE_EXHAUSTION",H)}break;default:{let V=Z.type==="error"?Z.message:`Unsupported token (type: ${Z.type})`;z(Z,"UNEXPECTED_TOKEN",V),W=!1}}if(U??(U=V5($,Z.offset,void 0,null,X,z)),Y&&U.anchor==="")z(Y,"BAD_ALIAS","Anchor cannot be an empty string");if(J&&$.options.stringKeys&&(!yW.isScalar(U)||typeof U.value!=="string"||U.tag&&U.tag!=="tag:yaml.org,2002:str"))z(G??Z,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(q)U.spaceBefore=!0;if(Q)if(Z.type==="scalar"&&Z.source==="")U.comment=Q;else U.commentBefore=Q;if($.options.keepSourceTokens&&W)U.srcToken=Z;return U}function V5($,Z,X,z,{spaceBefore:J,comment:q,anchor:Q,tag:Y,end:G},U){let W={type:"scalar",offset:hW.emptyScalarPosition(Z,X,z),indent:-1,source:""},V=eX.composeScalar($,W,Y,U);if(Q){if(V.anchor=Q.source.substring(1),V.anchor==="")U(Q,"BAD_ALIAS","Anchor cannot be an empty string")}if(J)V.spaceBefore=!0;if(q)V.comment=q,V.range[2]=G;return V}function uW({options:$},{offset:Z,source:X,end:z},J){let q=new kW.Alias(X.substring(1));if(q.source==="")J(Z,"BAD_ALIAS","Alias cannot be an empty string");if(q.source.endsWith(":"))J(Z+X.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let Q=Z+X.length,Y=gW.resolveEnd(z,Q,$.strict,J);if(q.range=[Z,Q,Y.offset],Y.comment)q.comment=Y.comment;return q}mW.composeEmptyNode=V5;mW.composeNode=$z});var zz=I((sW)=>{var pW=x6(),Xz=Zz(),lW=h$(),iW=y6();function nW($,Z,{offset:X,start:z,value:J,end:q},Q){let Y=Object.assign({_directives:Z},$),G=new pW.Document(void 0,Y),U={atKey:!1,atRoot:!0,directives:G.directives,options:G.options,schema:G.schema},W=iW.resolveProps(z,{indicator:"doc-start",next:J??q?.[0],offset:X,onError:Q,parentIndent:0,startOnNewline:!0});if(W.found){if(G.directives.docStart=!0,J&&(J.type==="block-map"||J.type==="block-seq")&&!W.hasNewline)Q(W.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}G.contents=J?Xz.composeNode(U,J,W,Q):Xz.composeEmptyNode(U,W.end,z,null,W,Q);let V=G.contents.range[2],H=lW.resolveEnd(q,V,!1,Q);if(H.comment)G.comment=H.comment;return G.range=[X,V,H.offset],G}sW.composeDoc=nW});var K5=I((ZH)=>{var aW=G0("process"),oW=NZ(),tW=x6(),f6=k6(),Jz=f(),eW=zz(),$H=h$();function g6($){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 qz($){let Z="",X=!1,z=!1;for(let J=0;J<$.length;++J){let q=$[J];switch(q[0]){case"#":Z+=(Z===""?"":z?`
|
|
126
126
|
|
|
127
127
|
`:`
|
|
128
|
-
`)+(q.substring(1)||" "),X=!0,z=!1;break;case"%":if($[J+1]?.[0]!=="#")J+=1;X=!1;break;default:if(!X)z=!0;X=!1}}return{comment:Z,afterEmptyLine:z}}class
|
|
129
|
-
${X}`:X;else if(z||$.directives.docStart||!J)$.commentBefore=X;else if(
|
|
128
|
+
`)+(q.substring(1)||" "),X=!0,z=!1;break;case"%":if($[J+1]?.[0]!=="#")J+=1;X=!1;break;default:if(!X)z=!0;X=!1}}return{comment:Z,afterEmptyLine:z}}class Qz{constructor($={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(Z,X,z,J)=>{let q=g6(Z);if(J)this.warnings.push(new f6.YAMLWarning(q,X,z));else this.errors.push(new f6.YAMLParseError(q,X,z))},this.directives=new oW.Directives({version:$.version||"1.2"}),this.options=$}decorate($,Z){let{comment:X,afterEmptyLine:z}=qz(this.prelude);if(X){let J=$.contents;if(Z)$.comment=$.comment?`${$.comment}
|
|
129
|
+
${X}`:X;else if(z||$.directives.docStart||!J)$.commentBefore=X;else if(Jz.isCollection(J)&&!J.flow&&J.items.length>0){let q=J.items[0];if(Jz.isPair(q))q=q.key;let Q=q.commentBefore;q.commentBefore=Q?`${X}
|
|
130
130
|
${Q}`:X}else{let q=J.commentBefore;J.commentBefore=q?`${X}
|
|
131
|
-
${q}`: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:
|
|
132
|
-
${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new
|
|
131
|
+
${q}`: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:qz(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(aW.env.LOG_STREAM)console.dir($,{depth:null});switch($.type){case"directive":this.directives.add($.source,(Z,X,z)=>{let J=g6($);J[0]+=Z,this.onError(J,"BAD_DIRECTIVE",X,z)}),this.prelude.push($.source),this.atDirectives=!0;break;case"document":{let Z=eW.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 f6.YAMLParseError(g6($),"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 f6.YAMLParseError(g6($),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let Z=$H.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}
|
|
132
|
+
${Z.comment}`:Z.comment}this.doc.range[2]=Z.offset;break}default:this.errors.push(new f6.YAMLParseError(g6($),"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 tW.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}}}ZH.Composer=Qz});var Uz=I((WH)=>{var zH=U5(),JH=H5(),qH=k6(),Yz=w6();function QH($,Z=!0,X){if($){let z=(J,q,Q)=>{let Y=typeof J==="number"?J:Array.isArray(J)?J[0]:J.offset;if(X)X(Y,q,Q);else throw new qH.YAMLParseError([Y,Y+1],q,Q)};switch($.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return JH.resolveFlowScalar($,Z,z);case"block-scalar":return zH.resolveBlockScalar({options:{strict:Z}},$,z)}}return null}function YH($,Z){let{implicitKey:X=!1,indent:z,inFlow:J=!1,offset:q=-1,type:Q="PLAIN"}=Z,Y=Yz.stringifyString({type:Q,value:$},{implicitKey:X,indent:z>0?" ".repeat(z):"",inFlow:J,options:{blockQuote:!0,lineWidth:-1}}),G=Z.end??[{type:"newline",offset:-1,indent:z,source:`
|
|
133
133
|
`}];switch(Y[0]){case"|":case">":{let U=Y.indexOf(`
|
|
134
134
|
`),W=Y.substring(0,U),V=Y.substring(U+1)+`
|
|
135
|
-
`,H=[{type:"block-scalar-header",offset:q,indent:z,source:W}];if(!
|
|
136
|
-
`});return{type:"block-scalar",offset:q,indent:z,props:H,source:V}}case'"':return{type:"double-quoted-scalar",offset:q,indent:z,source:Y,end:G};case"'":return{type:"single-quoted-scalar",offset:q,indent:z,source:Y,end:G};default:return{type:"scalar",offset:q,indent:z,source:Y,end:G}}}function
|
|
135
|
+
`,H=[{type:"block-scalar-header",offset:q,indent:z,source:W}];if(!Gz(H,G))H.push({type:"newline",offset:-1,indent:z,source:`
|
|
136
|
+
`});return{type:"block-scalar",offset:q,indent:z,props:H,source:V}}case'"':return{type:"double-quoted-scalar",offset:q,indent:z,source:Y,end:G};case"'":return{type:"single-quoted-scalar",offset:q,indent:z,source:Y,end:G};default:return{type:"scalar",offset:q,indent:z,source:Y,end:G}}}function GH($,Z,X={}){let{afterKey:z=!1,implicitKey:J=!1,inFlow:q=!1,type:Q}=X,Y="indent"in $?$.indent:null;if(z&&typeof Y==="number")Y+=2;if(!Q)switch($.type){case"single-quoted-scalar":Q="QUOTE_SINGLE";break;case"double-quoted-scalar":Q="QUOTE_DOUBLE";break;case"block-scalar":{let U=$.props[0];if(U.type!=="block-scalar-header")throw Error("Invalid block scalar header");Q=U.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:Q="PLAIN"}let G=Yz.stringifyString({type:Q,value:Z},{implicitKey:J||Y===null,indent:Y!==null&&Y>0?" ".repeat(Y):"",inFlow:q,options:{blockQuote:!0,lineWidth:-1}});switch(G[0]){case"|":case">":UH($,G);break;case'"':B5($,G,"double-quoted-scalar");break;case"'":B5($,G,"single-quoted-scalar");break;default:B5($,G,"scalar")}}function UH($,Z){let X=Z.indexOf(`
|
|
137
137
|
`),z=Z.substring(0,X),J=Z.substring(X+1)+`
|
|
138
|
-
`;if($.type==="block-scalar"){let q=$.props[0];if(q.type!=="block-scalar-header")throw Error("Invalid block scalar header");q.source=z,$.source=J}else{let{offset:q}=$,Q="indent"in $?$.indent:-1,Y=[{type:"block-scalar-header",offset:q,indent:Q,source:z}];if(!
|
|
139
|
-
`});for(let G of Object.keys($))if(G!=="type"&&G!=="offset")delete $[G];Object.assign($,{type:"block-scalar",indent:Q,props:Y,source:J})}}function
|
|
140
|
-
`};delete $.items,Object.assign($,{type:X,source:Z,end:[J]});break}default:{let z="indent"in $?$.indent:-1,J="end"in $&&Array.isArray($.end)?$.end.filter((q)=>q.type==="space"||q.type==="comment"||q.type==="newline"):[];for(let q of Object.keys($))if(q!=="type"&&q!=="offset")delete $[q];Object.assign($,{type:X,indent:z,source:Z,end:J})}}}
|
|
138
|
+
`;if($.type==="block-scalar"){let q=$.props[0];if(q.type!=="block-scalar-header")throw Error("Invalid block scalar header");q.source=z,$.source=J}else{let{offset:q}=$,Q="indent"in $?$.indent:-1,Y=[{type:"block-scalar-header",offset:q,indent:Q,source:z}];if(!Gz(Y,"end"in $?$.end:void 0))Y.push({type:"newline",offset:-1,indent:Q,source:`
|
|
139
|
+
`});for(let G of Object.keys($))if(G!=="type"&&G!=="offset")delete $[G];Object.assign($,{type:"block-scalar",indent:Q,props:Y,source:J})}}function Gz($,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 B5($,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),J=Z.length;if($.props[0].type==="block-scalar-header")J-=$.props[0].source.length;for(let q of z)q.offset+=J;delete $.props,Object.assign($,{type:X,source:Z,end:z});break}case"block-map":case"block-seq":{let J={type:"newline",offset:$.offset+Z.length,indent:$.indent,source:`
|
|
140
|
+
`};delete $.items,Object.assign($,{type:X,source:Z,end:[J]});break}default:{let z="indent"in $?$.indent:-1,J="end"in $&&Array.isArray($.end)?$.end.filter((q)=>q.type==="space"||q.type==="comment"||q.type==="newline"):[];for(let q of Object.keys($))if(q!=="type"&&q!=="offset")delete $[q];Object.assign($,{type:X,indent:z,source:Z,end:J})}}}WH.createScalarToken=YH;WH.resolveAsScalar=QH;WH.setScalarValue=GH});var Wz=I((DH)=>{var BH=($)=>("type"in $)?K2($):V2($);function K2($){switch($.type){case"block-scalar":{let Z="";for(let X of $.props)Z+=K2(X);return Z+$.source}case"block-map":case"block-seq":{let Z="";for(let X of $.items)Z+=V2(X);return Z}case"flow-collection":{let Z=$.start.source;for(let X of $.items)Z+=V2(X);for(let X of $.end)Z+=X.source;return Z}case"document":{let Z=V2($);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 V2({start:$,key:Z,sep:X,value:z}){let J="";for(let q of $)J+=q.source;if(Z)J+=K2(Z);if(X)for(let q of X)J+=q.source;if(z)J+=K2(z);return J}DH.stringify=BH});var Kz=I((IH)=>{var D5=Symbol("break visit"),NH=Symbol("skip children"),Hz=Symbol("remove item");function T$($,Z){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};Vz(Object.freeze([]),$,Z)}T$.BREAK=D5;T$.SKIP=NH;T$.REMOVE=Hz;T$.itemAtPath=($,Z)=>{let X=$;for(let[z,J]of Z){let q=X?.[z];if(q&&"items"in q)X=q.items[J];else return}return X};T$.parentCollection=($,Z)=>{let X=T$.itemAtPath($,Z.slice(0,-1)),z=Z[Z.length-1][0],J=X?.[z];if(J&&"items"in J)return J;throw Error("Parent collection not found")};function Vz($,Z,X){let z=X(Z,$);if(typeof z==="symbol")return z;for(let J of["key","value"]){let q=Z[J];if(q&&"items"in q){for(let Q=0;Q<q.items.length;++Q){let Y=Vz(Object.freeze($.concat([[J,Q]])),q.items[Q],X);if(typeof Y==="number")Q=Y-1;else if(Y===D5)return D5;else if(Y===Hz)q.items.splice(Q,1),Q-=1}if(typeof z==="function"&&J==="key")z=z(Z,$)}}return typeof z==="function"?z(Z,$):z}IH.visit=T$});var B2=I((PH)=>{var L5=Uz(),MH=Wz(),OH=Kz(),N5="\uFEFF",I5="\x02",T5="\x18",M5="\x1F",wH=($)=>!!$&&("items"in $),RH=($)=>!!$&&($.type==="scalar"||$.type==="single-quoted-scalar"||$.type==="double-quoted-scalar"||$.type==="block-scalar");function FH($){switch($){case N5:return"<BOM>";case I5:return"<DOC>";case T5:return"<FLOW_END>";case M5:return"<SCALAR>";default:return JSON.stringify($)}}function AH($){switch($){case N5:return"byte-order-mark";case I5:return"doc-mode";case T5:return"flow-error-end";case M5:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
141
141
|
`:case`\r
|
|
142
|
-
`: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}
|
|
143
|
-
`:case"\r":case"\t":return!0;default:return!1}}var
|
|
144
|
-
\r `),
|
|
142
|
+
`: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}PH.createScalarToken=L5.createScalarToken;PH.resolveAsScalar=L5.resolveAsScalar;PH.setScalarValue=L5.setScalarValue;PH.stringify=MH.stringify;PH.visit=OH.visit;PH.BOM=N5;PH.DOCUMENT=I5;PH.FLOW_END=T5;PH.SCALAR=M5;PH.isCollection=wH;PH.isScalar=RH;PH.prettyToken=FH;PH.tokenType=AH});var w5=I((dH)=>{var h6=B2();function A0($){switch($){case void 0:case" ":case`
|
|
143
|
+
`:case"\r":case"\t":return!0;default:return!1}}var Bz=new Set("0123456789ABCDEFabcdef"),uH=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),D2=new Set(",[]{}"),mH=new Set(` ,[]{}
|
|
144
|
+
\r `),O5=($)=>!$||mH.has($);class Dz{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===`
|
|
145
145
|
`)return!0;if(Z==="\r")return this.buffer[$+1]===`
|
|
146
146
|
`;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===`
|
|
147
147
|
`||!z&&!this.atEnd)return $+X+1}return Z===`
|
|
148
|
-
`||X>=this.indentNext||!Z&&!this.atEnd?$+X:-1}if(Z==="-"||Z==="."){let X=this.buffer.substr($,3);if((X==="---"||X==="...")&&
|
|
149
|
-
`,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]===
|
|
148
|
+
`||X>=this.indentNext||!Z&&!this.atEnd?$+X:-1}if(Z==="-"||Z==="."){let X=this.buffer.substr($,3);if((X==="---"||X==="...")&&A0(this.buffer[$+3]))return-1}return $}getLine(){let $=this.lineEndPos;if(typeof $!=="number"||$!==-1&&$<this.pos)$=this.buffer.indexOf(`
|
|
149
|
+
`,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]===h6.BOM)yield*this.pushCount(1),$=$.substring(1);if($[0]==="%"){let Z=$.length,X=$.indexOf("#");while(X!==-1){let J=$[X-1];if(J===" "||J==="\t"){Z=X-1;break}else X=$.indexOf("#",X+1)}while(!0){let J=$[Z-1];if(J===" "||J==="\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 h6.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==="...")&&A0(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&&!A0(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(($==="-"||$==="?"||$===":")&&A0(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(O5),"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("..."))&&A0(z[3])){if(!(X===this.indentNext-1&&this.flowLevel===1&&(z[0]==="]"||z[0]==="}")))return this.flowLevel=0,yield h6.FLOW_END,yield*this.parseLineStart()}let J=0;while(z[J]===",")J+=yield*this.pushCount(1),J+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(J+=yield*this.pushIndicators(),z[J]){case void 0:return"flow";case"#":return yield*this.pushCount(z.length-J),"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(O5),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let q=this.charAt(1);if(this.flowKey||A0(q)||q===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let $=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 J=0;while(this.buffer[Z-1-J]==="\\")J+=1;if(J%2===0)break;Z=this.buffer.indexOf('"',Z+1)}let X=this.buffer.substring(0,Z),z=X.indexOf(`
|
|
150
150
|
`,this.pos);if(z!==-1){while(z!==-1){let J=this.continueScalar(z+1);if(J===-1)break;z=X.indexOf(`
|
|
151
|
-
`,J)}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)=>
|
|
151
|
+
`,J)}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)=>A0(Z)||Z==="#")}*parseBlockScalar(){let $=this.pos-1,Z=0,X;$:for(let J=this.pos;X=this.buffer[J];++J)switch(X){case" ":Z+=1;break;case`
|
|
152
152
|
`:$=J,Z=0;break;case"\r":{let q=this.buffer[J+1];if(!q&&!this.atEnd)return this.setNext("block-scalar");if(q===`
|
|
153
153
|
`)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 J=this.continueScalar($+1);if(J===-1)break;$=this.buffer.indexOf(`
|
|
154
154
|
`,J)}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===`
|
|
155
155
|
`)X=this.buffer[++z];$=z-1}else if(!this.blockScalarKeep)do{let J=$-1,q=this.buffer[J];if(q==="\r")q=this.buffer[--J];let Q=J;while(q===" ")q=this.buffer[--J];if(q===`
|
|
156
|
-
`&&J>=this.pos&&J+1+Z>Q)$=J;else break}while(!0);return yield
|
|
156
|
+
`&&J>=this.pos&&J+1+Z>Q)$=J;else break}while(!0);return yield h6.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 J=this.buffer[X+1];if(A0(J)||$&&D2.has(J))break;Z=X}else if(A0(z)){let J=this.buffer[X+1];if(z==="\r")if(J===`
|
|
157
157
|
`)X+=1,z=`
|
|
158
|
-
`,J=this.buffer[X+1];else Z=X;if(J==="#"||$&&
|
|
159
|
-
`){let q=this.continueScalar(X+1);if(q===-1)break;X=Math.max(X,q-2)}}else{if($&&
|
|
158
|
+
`,J=this.buffer[X+1];else Z=X;if(J==="#"||$&&D2.has(J))break;if(z===`
|
|
159
|
+
`){let q=this.continueScalar(X+1);if(q===-1)break;X=Math.max(X,q-2)}}else{if($&&D2.has(z))break;Z=X}if(!z&&!this.atEnd)return this.setNext("plain-scalar");return yield h6.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(O5))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let $=this.flowLevel>0,Z=this.charAt(1);if(A0(Z)||$&&D2.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(!A0(Z)&&Z!==">")Z=this.buffer[++$];return yield*this.pushToIndex(Z===">"?$+1:$,!1)}else{let $=this.pos+1,Z=this.buffer[$];while(Z)if(uH.has(Z))Z=this.buffer[++$];else if(Z==="%"&&Bz.has(this.buffer[$+1])&&Bz.has(this.buffer[$+2]))Z=this.buffer[$+=3];else break;return yield*this.pushToIndex($,!1)}}*pushNewline(){let $=this.buffer[this.pos];if($===`
|
|
160
160
|
`)return yield*this.pushCount(1);else if($==="\r"&&this.charAt(1)===`
|
|
161
|
-
`)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)}}
|
|
161
|
+
`)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)}}dH.Lexer=Dz});var R5=I((pH)=>{class Lz{constructor(){this.lineStarts=[],this.addNewLine=($)=>this.lineStarts.push($),this.linePos=($)=>{let Z=0,X=this.lineStarts.length;while(Z<X){let J=Z+X>>1;if(this.lineStarts[J]<$)Z=J+1;else X=J}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}}}}pH.LineCounter=Lz});var F5=I((sH)=>{var iH=G0("process"),Nz=B2(),nH=w5();function t0($,Z){for(let X=0;X<$.length;++X)if($[X].type===Z)return!0;return!1}function Iz($){for(let Z=0;Z<$.length;++Z)switch($[Z].type){case"space":case"comment":case"newline":break;default:return Z}return-1}function Mz($){switch($?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function L2($){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 v$($){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 Tz($){if($.start.type==="flow-seq-start"){for(let Z of $.items)if(Z.sep&&!Z.value&&!t0(Z.start,"explicit-key-ind")&&!t0(Z.sep,"map-value-ind")){if(Z.key)Z.value=Z.key;if(delete Z.key,Mz(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 Oz{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 nH.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=$,iH.env.LOG_TOKENS)console.log("|",Nz.prettyToken($));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=$.length;return}let Z=Nz.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")Tz(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&&Iz(z.start)===-1&&(Z.indent===0||z.start.every((J)=>J.type!=="comment"||J.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(Iz($.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=L2(this.peek(2)),X=v$(Z),z;if($.end)z=$.end,z.push(this.sourceToken),delete $.end;else z=[this.sourceToken];let J={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:X,key:$,sep:z}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=J}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(`
|
|
162
162
|
`)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
|
|
163
|
-
`,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",J=[];if(z&&Z.sep&&!Z.value){let q=[];for(let Q=0;Q<Z.sep.length;++Q){let Y=Z.sep[Q];switch(Y.type){case"newline":q.push(Q);break;case"space":break;case"comment":if(Y.indent>$.indent)q.length=0;break;default:q.length=0}}if(q.length>=2)J=Z.sep.splice(q[1])}switch(this.type){case"anchor":case"tag":if(z||Z.value)J.push(this.sourceToken),$.items.push({start:J}),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)J.push(this.sourceToken),$.items.push({start:J,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(
|
|
163
|
+
`,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",J=[];if(z&&Z.sep&&!Z.value){let q=[];for(let Q=0;Q<Z.sep.length;++Q){let Y=Z.sep[Q];switch(Y.type){case"newline":q.push(Q);break;case"space":break;case"comment":if(Y.indent>$.indent)q.length=0;break;default:q.length=0}}if(q.length>=2)J=Z.sep.splice(q[1])}switch(this.type){case"anchor":case"tag":if(z||Z.value)J.push(this.sourceToken),$.items.push({start:J}),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)J.push(this.sourceToken),$.items.push({start:J,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(t0(Z.start,"newline"))Object.assign(Z,{key:null,sep:[this.sourceToken]});else{let q=v$(Z.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:q,key:null,sep:[this.sourceToken]}]})}else if(Z.value)$.items.push({start:[],key:null,sep:[this.sourceToken]});else if(t0(Z.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:J,key:null,sep:[this.sourceToken]}]});else if(Mz(Z.key)&&!t0(Z.sep,"newline")){let q=v$(Z.start),Q=Z.key,Y=Z.sep;Y.push(this.sourceToken),delete Z.key,delete Z.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:q,key:Q,sep:Y}]})}else if(J.length>0)Z.sep=Z.sep.concat(J,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:J,key:null,sep:[this.sourceToken]});else if(t0(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 q=this.flowScalar(this.type);if(z||Z.value)$.items.push({start:J,key:q,sep:[]}),this.onKeyLine=!0;else if(Z.sep)this.stack.push(q);else Object.assign(Z,{key:q,sep:[]}),this.onKeyLine=!0;return}default:{let q=this.startBlockValue($);if(q){if(q.type==="block-seq"){if(!Z.explicitKey&&Z.sep&&!t0(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:J});this.stack.push(q);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||t0(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=L2(X),J=v$(z);Tz($);let q=$.end.splice(1,$.end.length);q.push(this.sourceToken);let Q={type:"block-map",offset:$.offset,indent:$.indent,items:[{start:J,key:$,sep:q}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=Q}else yield*this.lineEnd($)}}flowScalar($){if(this.onNewLine){let Z=this.source.indexOf(`
|
|
164
164
|
`)+1;while(Z!==0)this.onNewLine(this.offset+Z),Z=this.source.indexOf(`
|
|
165
|
-
`,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=W2($),X=k$(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=W2($),X=k$(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()}}}bH.Parser=G9});var K9=I((mH)=>{var U9=J5(),kH=_6(),x6=C6(),yH=DZ(),fH=f(),gH=D5(),W9=B5();function H9($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new gH.LineCounter||null,prettyErrors:Z}}function hH($,Z={}){let{lineCounter:X,prettyErrors:z}=H9(Z),J=new W9.Parser(X?.addNewLine),q=new U9.Composer(Z),Q=Array.from(q.compose(J.parse($)));if(z&&X)for(let Y of Q)Y.errors.forEach(x6.prettifyError($,X)),Y.warnings.forEach(x6.prettifyError($,X));if(Q.length>0)return Q;return Object.assign([],{empty:!0},q.streamInfo())}function V9($,Z={}){let{lineCounter:X,prettyErrors:z}=H9(Z),J=new W9.Parser(X?.addNewLine),q=new U9.Composer(Z),Q=null;for(let Y of q.compose(J.parse($),!0,$.length))if(!Q)Q=Y;else if(Q.options.logLevel!=="silent"){Q.errors.push(new x6.YAMLParseError(Y.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)Q.errors.forEach(x6.prettifyError($,X)),Q.warnings.forEach(x6.prettifyError($,X));return Q}function vH($,Z,X){let z=void 0;if(typeof Z==="function")z=Z;else if(X===void 0&&Z&&typeof Z==="object")X=Z;let J=V9($,X);if(!J)return null;if(J.warnings.forEach((q)=>yH.warn(J.options.logLevel,q)),J.errors.length>0)if(J.options.logLevel!=="silent")throw J.errors[0];else J.errors=[];return J.toJS(Object.assign({reviver:z},X))}function uH($,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 J=Math.round(X);X=J<1?void 0:J>8?{indent:8}:{indent:J}}if($===void 0){let{keepUndefined:J}=X??Z??{};if(!J)return}if(fH.isDocument($)&&!z)return $.toString(X);return new kH.Document($,z,X).toString(X)}mH.parse=vH;mH.parseAllDocuments=hH;mH.parseDocument=V9;mH.stringify=uH});var M9=I((yV,T9)=>{var __dirname="/Users/wolfejam/FAF/cli/node_modules/faf-scoring-kernel",L9={};L9.__wbindgen_placeholder__=yV;var V2=null;function y$(){if(V2===null||V2.byteLength===0)V2=new Uint8Array(v.memory.buffer);return V2}var I9=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});I9.decode();function EV($,Z){return I9.decode(y$().subarray($,$+Z))}function B$($,Z){return $=$>>>0,EV($,Z)}yV.sdk_version=function(){let $,Z;try{let X=v.sdk_version();return $=X[0],Z=X[1],B$(X[0],X[1])}finally{v.__wbindgen_free($,Z,1)}};var C0=0,y6=new TextEncoder;if(!("encodeInto"in y6))y6.encodeInto=function($,Z){let X=y6.encode($);return Z.set(X),{read:$.length,written:X.length}};function K2($,Z,X){if(X===void 0){let Y=y6.encode($),G=Z(Y.length,1)>>>0;return y$().subarray(G,G+Y.length).set(Y),C0=Y.length,G}let z=$.length,J=Z(z,1)>>>0,q=y$(),Q=0;for(;Q<z;Q++){let Y=$.charCodeAt(Q);if(Y>127)break;q[J+Q]=Y}if(Q!==z){if(Q!==0)$=$.slice(Q);J=X(J,z,z=Q+$.length*3,1)>>>0;let Y=y$().subarray(J+Q,J+z),G=y6.encodeInto($,Y);Q+=G.written,J=X(J,z,Q,1)>>>0}return C0=Q,J}function f$($){let Z=v.__wbindgen_externrefs.get($);return v.__externref_table_dealloc($),Z}yV.score_faf_enterprise=function($){let Z,X;try{let q=K2($,v.__wbindgen_malloc,v.__wbindgen_realloc),Q=C0,Y=v.score_faf_enterprise(q,Q);var z=Y[0],J=Y[1];if(Y[3])throw z=0,J=0,f$(Y[2]);return Z=z,X=J,B$(z,J)}finally{v.__wbindgen_free(Z,X,1)}};yV.score_faf=function($){let Z,X;try{let q=K2($,v.__wbindgen_malloc,v.__wbindgen_realloc),Q=C0,Y=v.score_faf(q,Q);var z=Y[0],J=Y[1];if(Y[3])throw z=0,J=0,f$(Y[2]);return Z=z,X=J,B$(z,J)}finally{v.__wbindgen_free(Z,X,1)}};function I5($,Z){let X=Z($.length*1,1)>>>0;return y$().set($,X/1),C0=$.length,X}yV.decompile_fafb=function($){let Z,X;try{let q=I5($,v.__wbindgen_malloc),Q=C0,Y=v.decompile_fafb(q,Q);var z=Y[0],J=Y[1];if(Y[3])throw z=0,J=0,f$(Y[2]);return Z=z,X=J,B$(z,J)}finally{v.__wbindgen_free(Z,X,1)}};yV.score_fafb=function($){let Z,X;try{let q=I5($,v.__wbindgen_malloc),Q=C0,Y=v.score_fafb(q,Q);var z=Y[0],J=Y[1];if(Y[3])throw z=0,J=0,f$(Y[2]);return Z=z,X=J,B$(z,J)}finally{v.__wbindgen_free(Z,X,1)}};yV.validate_faf=function($){let Z=K2($,v.__wbindgen_malloc,v.__wbindgen_realloc),X=C0;return v.validate_faf(Z,X)!==0};function jV($,Z){return $=$>>>0,y$().subarray($/1,$/1+Z)}yV.compile_fafb=function($){let Z=K2($,v.__wbindgen_malloc,v.__wbindgen_realloc),X=C0,z=v.compile_fafb(Z,X);if(z[3])throw f$(z[2]);var J=jV(z[0],z[1]).slice();return v.__wbindgen_free(z[0],z[1]*1,1),J};yV.fafb_info=function($){let Z,X;try{let q=I5($,v.__wbindgen_malloc),Q=C0,Y=v.fafb_info(q,Q);var z=Y[0],J=Y[1];if(Y[3])throw z=0,J=0,f$(Y[2]);return Z=z,X=J,B$(z,J)}finally{v.__wbindgen_free(Z,X,1)}};yV.__wbindgen_cast_2241b6af4c4b2941=function($,Z){return B$($,Z)};yV.__wbindgen_init_externref_table=function(){let $=v.__wbindgen_externrefs,Z=$.grow(4);$.set(0,void 0),$.set(Z+0,void 0),$.set(Z+1,null),$.set(Z+2,!0),$.set(Z+3,!1)};var bV=`${__dirname}/faf_wasm_sdk_bg.wasm`,xV=Q0("fs").readFileSync(bV),kV=new WebAssembly.Module(xV),v=yV.__wasm=new WebAssembly.Instance(kV,L9).exports;v.__wbindgen_start()});var A9={};d4(A9,{orange:()=>a0,italic:()=>iV,fafCyan:()=>w,dim:()=>L,bold:()=>b});var M5=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,b,L,iV,w=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,a0=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var c=j(()=>{b=M5("1"),L=M5("2"),iV=M5("3")});var zz=I((uI,FK)=>{FK.exports={name:"faf-cli",version:"6.0.9",description:"Persistent AI Context Standard — project DNA for AI. IANA-registered. Anthropic-approved.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{bun:"./src/index.ts",default:"./dist/index.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",build:"bun build src/cli.ts --outfile dist/cli.js --target=node --minify && bun build src/index.ts --outfile dist/index.js --target=node --minify",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test","test:watch":"bun test --watch",lint:"eslint src/**/*.ts",format:"prettier --write 'src/**/*.ts'",prepublishOnly:"bun run build"},keywords:["faf","ai-context","project-dna","bi-sync","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.1","faf-scoring-kernel":"^2.0.3",open:"8.4.2",yaml:"^2.4.1"},optionalDependencies:{"@anthropic-ai/sdk":"^0.74.0"},devDependencies:{"@types/node":"^22.15.0",typescript:"^5.3.3",eslint:"^9.39.2","@typescript-eslint/eslint-plugin":"^8.41.0","@typescript-eslint/parser":"^8.41.0",prettier:"^3.2.5"},engines:{node:">=18.0.0"},publishConfig:{access:"public"}}});var x5=I((RT,Bz)=>{var Dz=Q0("fs"),b5;function bK(){try{return Dz.statSync("/.dockerenv"),!0}catch($){return!1}}function xK(){try{return Dz.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch($){return!1}}Bz.exports=()=>{if(b5===void 0)b5=bK()||xK();return b5}});var Iz=I((AT,k5)=>{var kK=Q0("os"),yK=Q0("fs"),Nz=x5(),Lz=()=>{if(process.platform!=="linux")return!1;if(kK.release().toLowerCase().includes("microsoft")){if(Nz())return!1;return!0}try{return yK.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Nz():!1}catch($){return!1}};if(process.env.__IS_WSL_TEST__)k5.exports=Lz;else k5.exports=Lz()});var Mz=I((PT,Tz)=>{Tz.exports=($,Z,X)=>{let z=(J)=>Object.defineProperty($,Z,{value:J,enumerable:!0,writable:!0});return Object.defineProperty($,Z,{configurable:!0,enumerable:!0,get(){let J=X();return z(J),J},set(J){z(J)}}),$}});var _z=I((_T,Pz)=>{var __dirname="/Users/wolfejam/FAF/cli/node_modules/open",fK=Q0("path"),gK=Q0("child_process"),{promises:M2,constants:Az}=Q0("fs"),T2=Iz(),hK=x5(),f5=Mz(),Oz=fK.join(__dirname,"xdg-open"),{platform:m$,arch:wz}=process,vK=()=>{try{return M2.statSync("/run/.containerenv"),!0}catch{return!1}},y5;function uK(){if(y5===void 0)y5=vK()||hK();return y5}var mK=(()=>{let Z;return async function(){if(Z)return Z;let X="/etc/wsl.conf",z=!1;try{await M2.access(X,Az.F_OK),z=!0}catch{}if(!z)return"/mnt/";let J=await M2.readFile(X,{encoding:"utf8"}),q=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(J);if(!q)return"/mnt/";return Z=q.groups.mountPoint.trim(),Z=Z.endsWith("/")?Z:`${Z}/`,Z}})(),Fz=async($,Z)=>{let X;for(let z of $)try{return await Z(z)}catch(J){X=J}throw X},O2=async($)=>{if($={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...$},Array.isArray($.app))return Fz($.app,(Y)=>O2({...$,app:Y}));let{name:Z,arguments:X=[]}=$.app||{};if(X=[...X],Array.isArray(Z))return Fz(Z,(Y)=>O2({...$,app:{name:Y,arguments:X}}));let z,J=[],q={};if(m$==="darwin"){if(z="open",$.wait)J.push("--wait-apps");if($.background)J.push("--background");if($.newInstance)J.push("--new");if(Z)J.push("-a",Z)}else if(m$==="win32"||T2&&!uK()&&!Z){let Y=await mK();if(z=T2?`${Y}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,J.push("-NoProfile","-NonInteractive","–ExecutionPolicy","Bypass","-EncodedCommand"),!T2)q.windowsVerbatimArguments=!0;let G=["Start"];if($.wait)G.push("-Wait");if(Z){if(G.push(`"\`"${Z}\`""`,"-ArgumentList"),$.target)X.unshift($.target)}else if($.target)G.push(`"${$.target}"`);if(X.length>0)X=X.map((U)=>`"\`"${U}\`""`),G.push(X.join(","));$.target=Buffer.from(G.join(" "),"utf16le").toString("base64")}else{if(Z)z=Z;else{let Y=!__dirname||__dirname==="/",G=!1;try{await M2.access(Oz,Az.X_OK),G=!0}catch{}z=process.versions.electron||m$==="android"||Y||!G?"xdg-open":Oz}if(X.length>0)J.push(...X);if(!$.wait)q.stdio="ignore",q.detached=!0}if($.target)J.push($.target);if(m$==="darwin"&&X.length>0)J.push("--args",...X);let Q=gK.spawn(z,J,q);if($.wait)return new Promise((Y,G)=>{Q.once("error",G),Q.once("close",(U)=>{if(!$.allowNonzeroExitCode&&U>0){G(Error(`Exited with code ${U}`));return}Y(Q)})});return Q.unref(),Q},g5=($,Z)=>{if(typeof $!=="string")throw TypeError("Expected a `target`");return O2({...Z,target:$})},dK=($,Z)=>{if(typeof $!=="string")throw TypeError("Expected a `name`");let{arguments:X=[]}=Z||{};if(X!==void 0&&X!==null&&!Array.isArray(X))throw TypeError("Expected `appArguments` as Array type");return O2({...Z,app:{name:$,arguments:X}})};function Rz($){if(typeof $==="string"||Array.isArray($))return $;let{[wz]:Z}=$;if(!Z)throw Error(`${wz} is not supported`);return Z}function h5({[m$]:$},{wsl:Z}){if(Z&&T2)return Rz(Z);if(!$)throw Error(`${m$} is not supported`);return Rz($)}var w2={};f5(w2,"chrome",()=>h5({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));f5(w2,"firefox",()=>h5({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));f5(w2,"edge",()=>h5({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));g5.apps=w2;g5.openApp=dK;Pz.exports=g5});function O($,Z,X,z,J){if(z==="m")throw TypeError("Private method is not writable");if(z==="a"&&!J)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!J:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?J.call($,X):J?J.value=X:Z.set($,X),X}function K($,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($)}var k0=()=>{};var v5=function(){let{crypto:$}=globalThis;if($?.randomUUID)return v5=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),X=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(z)=>(+z^X()&15>>+z/4).toString(16))};function y0($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var m6=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var R,X0,G0,t0,d$,c$,p$,l$,i$,n$,s$,r$,a$;var V0=j(()=>{R=class R extends Error{};X0=class X0 extends R{constructor($,Z,X,z){super(`${X0.makeMessage($,Z,X)}`);this.status=$,this.headers=z,this.requestID=z?.get("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 t0({message:X,cause:m6(Z)});let J=Z;if($===400)return new c$($,J,X,z);if($===401)return new p$($,J,X,z);if($===403)return new l$($,J,X,z);if($===404)return new i$($,J,X,z);if($===409)return new n$($,J,X,z);if($===422)return new s$($,J,X,z);if($===429)return new r$($,J,X,z);if($>=500)return new a$($,J,X,z);return new X0($,J,X,z)}};G0=class G0 extends X0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};t0=class t0 extends X0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};d$=class d$ extends t0{constructor({message:$}={}){super({message:$??"Request timed out."})}};c$=class c$ extends X0{};p$=class p$ extends X0{};l$=class l$ extends X0{};i$=class i$ extends X0{};n$=class n$ extends X0{};s$=class s$ extends X0{};r$=class r$ extends X0{};a$=class a$ extends X0{}});function F2($){if(typeof $!=="object")return{};return $??{}}function gz($){if(!$)return!0;for(let Z in $)return!1;return!0}function hz($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var YD,fz=($)=>{return YD.test($)},u5=($)=>(u5=Array.isArray,u5($)),m5,vz=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new R(`${$} must be an integer`);if(Z<0)throw new R(`${$} must be a positive integer`);return Z},R2=($)=>{try{return JSON.parse($)}catch(Z){return}};var I$=j(()=>{V0();YD=/^[a-z][a-z0-9+.-]*:/i,m5=u5});var uz=($)=>new Promise((Z)=>setTimeout(Z,$));var e0="0.74.0";function GD(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function WD(){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 J=z[1]||0,q=z[2]||0,Q=z[3]||0;return{browser:Z,version:`${J}.${q}.${Q}`}}}return null}var pz=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},UD=()=>{let $=GD();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":e0,"X-Stainless-OS":dz(Deno.build.os),"X-Stainless-Arch":mz(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":e0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":e0,"X-Stainless-OS":dz(globalThis.process.platform??"unknown"),"X-Stainless-Arch":mz(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=WD();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":e0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":e0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},mz=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},dz=($)=>{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"},cz,lz=()=>{return cz??(cz=UD())};var d5=()=>{};function iz(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function c5(...$){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...$)}function A2($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return c5({start(){},async pull(X){let{done:z,value:J}=await Z.next();if(z)X.close();else X.enqueue(J)},async cancel(){await Z.return?.()}})}function d6($){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}}}async function nz($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),X=Z.cancel();Z.releaseLock(),await X}var sz=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function oz($){let Z=0;for(let J of $)Z+=J.length;let X=new Uint8Array(Z),z=0;for(let J of $)X.set(J,z),z+=J.length;return X}function c6($){let Z;return(rz??(Z=new globalThis.TextEncoder,rz=Z.encode.bind(Z)))($)}function p5($){let Z;return(az??(Z=new globalThis.TextDecoder,az=Z.decode.bind(Z)))($)}var rz,az;class $${constructor(){K0.set(this,void 0),D0.set(this,void 0),O(this,K0,new Uint8Array,"f"),O(this,D0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?c6($):$;O(this,K0,oz([K(this,K0,"f"),Z]),"f");let X=[],z;while((z=KD(K(this,K0,"f"),K(this,D0,"f")))!=null){if(z.carriage&&K(this,D0,"f")==null){O(this,D0,z.index,"f");continue}if(K(this,D0,"f")!=null&&(z.index!==K(this,D0,"f")+1||z.carriage)){X.push(p5(K(this,K0,"f").subarray(0,K(this,D0,"f")-1))),O(this,K0,K(this,K0,"f").subarray(K(this,D0,"f")),"f"),O(this,D0,null,"f");continue}let J=K(this,D0,"f")!==null?z.preceding-1:z.preceding,q=p5(K(this,K0,"f").subarray(0,J));X.push(q),O(this,K0,K(this,K0,"f").subarray(z.index),"f"),O(this,D0,null,"f")}return X}flush(){if(!K(this,K0,"f").length)return[];return this.decode(`
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],J}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,X,z]=LD($,":");if(z.startsWith(" "))z=z.substring(1);if(Z==="event")this.event=z;else if(Z==="data")this.data.push(z);return null}}function LD($,Z){let X=$.indexOf(Z);if(X!==-1)return[$.substring(0,X),Z,$.substring(X+Z.length)];return[$,"",""]}var l6,B0;var n5=j(()=>{k0();V0();l5();I$();C2();V0();B0=class B0{constructor($,Z,X){this.iterator=$,l6.set(this,void 0),this.controller=Z,O(this,l6,X,"f")}static fromSSEResponse($,Z,X){let z=!1,J=X?Y0(X):console;async function*q(){if(z)throw new R("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Q=!1;try{for await(let Y of BD($,Z)){if(Y.event==="completion")try{yield JSON.parse(Y.data)}catch(G){throw J.error("Could not parse message into JSON:",Y.data),J.error("From chunk:",Y.raw),G}if(Y.event==="message_start"||Y.event==="message_delta"||Y.event==="message_stop"||Y.event==="content_block_start"||Y.event==="content_block_delta"||Y.event==="content_block_stop")try{yield JSON.parse(Y.data)}catch(G){throw J.error("Could not parse message into JSON:",Y.data),J.error("From chunk:",Y.raw),G}if(Y.event==="ping")continue;if(Y.event==="error")throw new X0(void 0,R2(Y.data)??Y.data,void 0,$.headers)}Q=!0}catch(Y){if(y0(Y))return;throw Y}finally{if(!Q)Z.abort()}}return new B0(q,Z,X)}static fromReadableStream($,Z,X){let z=!1;async function*J(){let Q=new $$,Y=d6($);for await(let G of Y)for(let U of Q.decode(G))yield U;for(let G of Q.flush())yield G}async function*q(){if(z)throw new R("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Q=!1;try{for await(let Y of J()){if(Q)continue;if(Y)yield JSON.parse(Y)}Q=!0}catch(Y){if(y0(Y))return;throw Y}finally{if(!Q)Z.abort()}}return new B0(q,Z,X)}[(l6=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],X=this.iterator(),z=(J)=>{return{next:()=>{if(J.length===0){let q=X.next();$.push(q),Z.push(q)}return J.shift()}}};return[new B0(()=>z($),this.controller,K(this,l6,"f")),new B0(()=>z(Z),this.controller,K(this,l6,"f"))]}toReadableStream(){let $=this,Z;return c5({async start(){Z=$[Symbol.asyncIterator]()},async pull(X){try{let{value:z,done:J}=await Z.next();if(J)return X.close();let q=c6(JSON.stringify(z)+`
|
|
169
|
-
`);
|
|
165
|
+
`,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=L2($),X=v$(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=L2($),X=v$(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()}}}sH.Parser=Oz});var Pz=I((zV)=>{var wz=K5(),aH=x6(),v6=k6(),oH=RZ(),tH=f(),eH=R5(),Rz=F5();function Fz($){let Z=$.prettyErrors!==!1;return{lineCounter:$.lineCounter||Z&&new eH.LineCounter||null,prettyErrors:Z}}function $V($,Z={}){let{lineCounter:X,prettyErrors:z}=Fz(Z),J=new Rz.Parser(X?.addNewLine),q=new wz.Composer(Z),Q=Array.from(q.compose(J.parse($)));if(z&&X)for(let Y of Q)Y.errors.forEach(v6.prettifyError($,X)),Y.warnings.forEach(v6.prettifyError($,X));if(Q.length>0)return Q;return Object.assign([],{empty:!0},q.streamInfo())}function Az($,Z={}){let{lineCounter:X,prettyErrors:z}=Fz(Z),J=new Rz.Parser(X?.addNewLine),q=new wz.Composer(Z),Q=null;for(let Y of q.compose(J.parse($),!0,$.length))if(!Q)Q=Y;else if(Q.options.logLevel!=="silent"){Q.errors.push(new v6.YAMLParseError(Y.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(z&&X)Q.errors.forEach(v6.prettifyError($,X)),Q.warnings.forEach(v6.prettifyError($,X));return Q}function ZV($,Z,X){let z=void 0;if(typeof Z==="function")z=Z;else if(X===void 0&&Z&&typeof Z==="object")X=Z;let J=Az($,X);if(!J)return null;if(J.warnings.forEach((q)=>oH.warn(J.options.logLevel,q)),J.errors.length>0)if(J.options.logLevel!=="silent")throw J.errors[0];else J.errors=[];return J.toJS(Object.assign({reviver:z},X))}function XV($,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 J=Math.round(X);X=J<1?void 0:J>8?{indent:8}:{indent:J}}if($===void 0){let{keepUndefined:J}=X??Z??{};if(!J)return}if(tH.isDocument($)&&!z)return $.toString(X);return new aH.Document($,z,X).toString(X)}zV.parse=ZV;zV.parseAllDocuments=$V;zV.parseDocument=Az;zV.stringify=XV});var GV,UV,WV,A5,HV,e0,VV,KV,BV,DV,tL,LV,NV,IV,N2,_z,TV,MV,OV,wV,RV,FV,AV,PV,_V,CV,EV,SV,jV,bV,xV,kV,yV,fV,gV,hV,vV,uV,u6,mV,dV,P5,cV,pV;var _5=_(()=>{GV=K5(),UV=x6(),WV=oZ(),A5=k6(),HV=I6(),e0=f(),VV=s0(),KV=z0(),BV=a0(),DV=o0(),tL=B2(),LV=w5(),NV=R5(),IV=F5(),N2=Pz(),_z=L6();TV=GV.Composer,MV=UV.Document,OV=WV.Schema,wV=A5.YAMLError,RV=A5.YAMLParseError,FV=A5.YAMLWarning,AV=HV.Alias,PV=e0.isAlias,_V=e0.isCollection,CV=e0.isDocument,EV=e0.isMap,SV=e0.isNode,jV=e0.isPair,bV=e0.isScalar,xV=e0.isSeq,kV=VV.Pair,yV=KV.Scalar,fV=BV.YAMLMap,gV=DV.YAMLSeq,hV=LV.Lexer,vV=NV.LineCounter,uV=IV.Parser,u6=N2.parse,mV=N2.parseAllDocuments,dV=N2.parseDocument,P5=N2.stringify,cV=_z.visit,pV=_z.visitAsync});import{readFileSync as Ez,writeFileSync as lV,existsSync as Cz}from"fs";function c($){let Z=Ez($,"utf-8");return u6(Z)}function s($,Z){let X=P5(Z,{lineWidth:0});lV($,X,"utf-8")}function m($){return Ez($,"utf-8")}function g($=process.cwd()){let Z=["project.faf",".faf"];for(let z of Z){let J=`${$}/${z}`;if(Cz(J))return J}let X=$.replace(/\/[^/]+$/,"");if(X!==$)for(let z of Z){let J=`${X}/${z}`;if(Cz(J))return J}return null}var Z0=_(()=>{_5()});var xz=I((oV,bz)=>{var __dirname="/Users/wolfejam/FAF/cli/node_modules/faf-scoring-kernel",Sz={};Sz.__wbindgen_placeholder__=oV;var I2=null;function u$(){if(I2===null||I2.byteLength===0)I2=new Uint8Array(u.memory.buffer);return I2}var jz=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0});jz.decode();function iV($,Z){return jz.decode(u$().subarray($,$+Z))}function M$($,Z){return $=$>>>0,iV($,Z)}oV.sdk_version=function(){let $,Z;try{let X=u.sdk_version();return $=X[0],Z=X[1],M$(X[0],X[1])}finally{u.__wbindgen_free($,Z,1)}};var j0=0,m6=new TextEncoder;if(!("encodeInto"in m6))m6.encodeInto=function($,Z){let X=m6.encode($);return Z.set(X),{read:$.length,written:X.length}};function T2($,Z,X){if(X===void 0){let Y=m6.encode($),G=Z(Y.length,1)>>>0;return u$().subarray(G,G+Y.length).set(Y),j0=Y.length,G}let z=$.length,J=Z(z,1)>>>0,q=u$(),Q=0;for(;Q<z;Q++){let Y=$.charCodeAt(Q);if(Y>127)break;q[J+Q]=Y}if(Q!==z){if(Q!==0)$=$.slice(Q);J=X(J,z,z=Q+$.length*3,1)>>>0;let Y=u$().subarray(J+Q,J+z),G=m6.encodeInto($,Y);Q+=G.written,J=X(J,z,Q,1)>>>0}return j0=Q,J}function m$($){let Z=u.__wbindgen_externrefs.get($);return u.__externref_table_dealloc($),Z}oV.score_faf_enterprise=function($){let Z,X;try{let q=T2($,u.__wbindgen_malloc,u.__wbindgen_realloc),Q=j0,Y=u.score_faf_enterprise(q,Q);var z=Y[0],J=Y[1];if(Y[3])throw z=0,J=0,m$(Y[2]);return Z=z,X=J,M$(z,J)}finally{u.__wbindgen_free(Z,X,1)}};oV.score_faf=function($){let Z,X;try{let q=T2($,u.__wbindgen_malloc,u.__wbindgen_realloc),Q=j0,Y=u.score_faf(q,Q);var z=Y[0],J=Y[1];if(Y[3])throw z=0,J=0,m$(Y[2]);return Z=z,X=J,M$(z,J)}finally{u.__wbindgen_free(Z,X,1)}};function C5($,Z){let X=Z($.length*1,1)>>>0;return u$().set($,X/1),j0=$.length,X}oV.decompile_fafb=function($){let Z,X;try{let q=C5($,u.__wbindgen_malloc),Q=j0,Y=u.decompile_fafb(q,Q);var z=Y[0],J=Y[1];if(Y[3])throw z=0,J=0,m$(Y[2]);return Z=z,X=J,M$(z,J)}finally{u.__wbindgen_free(Z,X,1)}};oV.score_fafb=function($){let Z,X;try{let q=C5($,u.__wbindgen_malloc),Q=j0,Y=u.score_fafb(q,Q);var z=Y[0],J=Y[1];if(Y[3])throw z=0,J=0,m$(Y[2]);return Z=z,X=J,M$(z,J)}finally{u.__wbindgen_free(Z,X,1)}};oV.validate_faf=function($){let Z=T2($,u.__wbindgen_malloc,u.__wbindgen_realloc),X=j0;return u.validate_faf(Z,X)!==0};function nV($,Z){return $=$>>>0,u$().subarray($/1,$/1+Z)}oV.compile_fafb=function($){let Z=T2($,u.__wbindgen_malloc,u.__wbindgen_realloc),X=j0,z=u.compile_fafb(Z,X);if(z[3])throw m$(z[2]);var J=nV(z[0],z[1]).slice();return u.__wbindgen_free(z[0],z[1]*1,1),J};oV.fafb_info=function($){let Z,X;try{let q=C5($,u.__wbindgen_malloc),Q=j0,Y=u.fafb_info(q,Q);var z=Y[0],J=Y[1];if(Y[3])throw z=0,J=0,m$(Y[2]);return Z=z,X=J,M$(z,J)}finally{u.__wbindgen_free(Z,X,1)}};oV.__wbindgen_cast_2241b6af4c4b2941=function($,Z){return M$($,Z)};oV.__wbindgen_init_externref_table=function(){let $=u.__wbindgen_externrefs,Z=$.grow(4);$.set(0,void 0),$.set(Z+0,void 0),$.set(Z+1,null),$.set(Z+2,!0),$.set(Z+3,!1)};var sV=`${__dirname}/faf_wasm_sdk_bg.wasm`,rV=G0("fs").readFileSync(sV),aV=new WebAssembly.Module(rV),u=oV.__wasm=new WebAssembly.Instance(aV,Sz).exports;u.__wbindgen_start()});function d6(){if(!E5)try{E5=xz()}catch{throw Error(`faf-scoring-kernel not installed.
|
|
166
|
+
|
|
167
|
+
Run: npm install faf-scoring-kernel
|
|
168
|
+
`)}return E5}function t($){return JSON.parse(d6().score_faf($))}function kz($){return d6().validate_faf($)}function yz($){return d6().compile_fafb($)}function fz($){return JSON.parse(d6().decompile_fafb($))}function gz(){return d6().sdk_version()}var E5=null;var hz={};QZ(hz,{orange:()=>$$,italic:()=>GK,fafCyan:()=>O,dim:()=>N,bold:()=>b});var S5=($)=>(Z)=>`\x1B[${$}m${Z}\x1B[0m`,b,N,GK,O=($)=>`\x1B[38;2;0;212;212m${$}\x1B[0m`,$$=($)=>`\x1B[38;5;208m${$}\x1B[0m`;var l=_(()=>{b=S5("1"),N=S5("2"),GK=S5("3")});function M2($){return $.indicator}function vz($){for(let Z of j5)if($>=Z.threshold)return Z;return j5[j5.length-1]}var j5;var O2=_(()=>{l();j5=[{name:"TROPHY",indicator:`${$$("\uD83C\uDFC6")} ${$$("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${$$(b("★"))} ${$$("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${O("◆")} ${O("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${O("◇")} ${O("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${b("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${N("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${N("○")} RED`,threshold:1},{name:"WHITE",indicator:`${N("♡")}`,threshold:0}]});function e($){return{score:$.score,tier:vz($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}var P0=_(()=>{O2()});function J0($,Z,X=!1){let z=M2($.tier),J=b(`${$.score}%`);if(console.log(`${z} ${J} ${N(`${$.populated}/${$.active} slots`)} ${N("—")} ${Z}`),$.tier.name!=="TROPHY"&&$.empty>0)console.log(N(` ${$.empty} empty`));if(X)console.log(""),UK($)}function UK($){for(let[Z,X]of Object.entries($.slots)){let z=X==="populated"?O("●"):X==="slotignored"?N("—"):N("○");console.log(` ${z} ${X==="slotignored"?N(Z):Z}`)}}var b0=_(()=>{O2();l()});function d$($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return WK.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var H0,IN,TN,WK,c$;var h0=_(()=>{H0=[{index:1,path:"project.name",description:"Project name",category:"project"},{index:2,path:"project.goal",description:"What the project does",category:"project"},{index:3,path:"project.main_language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",description:"Who is building this",category:"human"},{index:5,path:"human_context.what",description:"What are they building",category:"human"},{index:6,path:"human_context.why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",description:"State management",category:"frontend"},{index:14,path:"stack.backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",description:"Database",category:"backend"},{index:18,path:"stack.connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",description:"Remote build cache",category:"enterprise_ops"}],IN=new Map(H0.map(($)=>[$.path,$])),TN=H0.filter(($)=>$.index<=21),WK=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);c$={cli:["project","human"],library:["project","human"],mcp:["project","backend","universal","human"],backend:["project","backend","universal","human"],"data-science":["project","backend","human"],frontend:["project","frontend","human"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]}});var uz;var mz=_(()=>{uz=[{name:"Next.js",slug:"nextjs",category:"frontend",signals:[{type:"dependency",key:"next"},{type:"file",pattern:"next.config.*"}]},{name:"React",slug:"react",category:"frontend",signals:[{type:"dependency",key:"react"}]},{name:"SvelteKit",slug:"sveltekit",category:"frontend",signals:[{type:"dependency",key:"@sveltejs/kit"},{type:"file",pattern:"svelte.config.*"}]},{name:"Svelte",slug:"svelte",category:"frontend",signals:[{type:"dependency",key:"svelte"},{type:"devDependency",key:"svelte"}]},{name:"Vue.js",slug:"vue",category:"frontend",signals:[{type:"dependency",key:"vue"}]},{name:"Nuxt",slug:"nuxt",category:"frontend",signals:[{type:"dependency",key:"nuxt"},{type:"file",pattern:"nuxt.config.*"}]},{name:"Angular",slug:"angular",category:"frontend",signals:[{type:"dependency",key:"@angular/core"},{type:"file",pattern:"angular.json"}]},{name:"Astro",slug:"astro",category:"frontend",signals:[{type:"dependency",key:"astro"},{type:"file",pattern:"astro.config.*"}]},{name:"Solid",slug:"solid",category:"frontend",signals:[{type:"dependency",key:"solid-js"}]},{name:"Remix",slug:"remix",category:"frontend",signals:[{type:"dependency",key:"@remix-run/react"}]},{name:"Gatsby",slug:"gatsby",category:"frontend",signals:[{type:"dependency",key:"gatsby"},{type:"file",pattern:"gatsby-config.*"}]},{name:"Qwik",slug:"qwik",category:"frontend",signals:[{type:"dependency",key:"@builder.io/qwik"}]},{name:"Vercel (SvelteKit)",slug:"adapter-vercel",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-vercel"},{type:"devDependency",key:"@sveltejs/adapter-vercel"}]},{name:"Node (SvelteKit)",slug:"adapter-node",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-node"},{type:"devDependency",key:"@sveltejs/adapter-node"}]},{name:"Static (SvelteKit)",slug:"adapter-static",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-static"},{type:"devDependency",key:"@sveltejs/adapter-static"}]},{name:"Cloudflare (SvelteKit)",slug:"adapter-cloudflare",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-cloudflare"},{type:"devDependency",key:"@sveltejs/adapter-cloudflare"}]},{name:"Netlify (SvelteKit)",slug:"adapter-netlify",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-netlify"},{type:"devDependency",key:"@sveltejs/adapter-netlify"}]},{name:"Tailwind CSS",slug:"tailwind",category:"css",signals:[{type:"dependency",key:"tailwindcss"},{type:"devDependency",key:"tailwindcss"},{type:"file",pattern:"tailwind.config.*"}]},{name:"Bootstrap",slug:"bootstrap",category:"css",signals:[{type:"dependency",key:"bootstrap"}]},{name:"Styled Components",slug:"styled-components",category:"css",signals:[{type:"dependency",key:"styled-components"}]},{name:"shadcn/ui",slug:"shadcn",category:"ui",signals:[{type:"file",pattern:"components.json"},{type:"dependency",key:"@radix-ui/react-dialog"}]},{name:"Material UI",slug:"mui",category:"ui",signals:[{type:"dependency",key:"@mui/material"}]},{name:"Chakra UI",slug:"chakra",category:"ui",signals:[{type:"dependency",key:"@chakra-ui/react"}]},{name:"Ant Design",slug:"antd",category:"ui",signals:[{type:"dependency",key:"antd"}]},{name:"Redux",slug:"redux",category:"state",signals:[{type:"dependency",key:"@reduxjs/toolkit"}]},{name:"Zustand",slug:"zustand",category:"state",signals:[{type:"dependency",key:"zustand"}]},{name:"Jotai",slug:"jotai",category:"state",signals:[{type:"dependency",key:"jotai"}]},{name:"Pinia",slug:"pinia",category:"state",signals:[{type:"dependency",key:"pinia"}]},{name:"Express",slug:"express",category:"backend",signals:[{type:"dependency",key:"express"}]},{name:"Fastify",slug:"fastify",category:"backend",signals:[{type:"dependency",key:"fastify"}]},{name:"Hono",slug:"hono",category:"backend",signals:[{type:"dependency",key:"hono"}]},{name:"Elysia",slug:"elysia",category:"backend",signals:[{type:"dependency",key:"elysia"}]},{name:"NestJS",slug:"nestjs",category:"backend",signals:[{type:"dependency",key:"@nestjs/core"}]},{name:"Koa",slug:"koa",category:"backend",signals:[{type:"dependency",key:"koa"}]},{name:"FastAPI",slug:"fastapi",category:"backend",signals:[{type:"dependency",key:"fastapi"}]},{name:"Django",slug:"django",category:"backend",signals:[{type:"dependency",key:"django"},{type:"file",pattern:"manage.py"}]},{name:"Flask",slug:"flask",category:"backend",signals:[{type:"dependency",key:"flask"},{type:"file",pattern:"app.py"}]},{name:"Rails",slug:"rails",category:"backend",signals:[{type:"file",pattern:"Gemfile"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"file",pattern:"pom.xml"},{type:"file",pattern:"build.gradle"}]},{name:"Prisma",slug:"prisma",category:"database",signals:[{type:"dependency",key:"prisma"},{type:"devDependency",key:"prisma"},{type:"file",pattern:"prisma/schema.prisma"}]},{name:"Drizzle",slug:"drizzle",category:"database",signals:[{type:"dependency",key:"drizzle-orm"},{type:"file",pattern:"drizzle.config.*"}]},{name:"TypeORM",slug:"typeorm",category:"database",signals:[{type:"dependency",key:"typeorm"}]},{name:"Mongoose",slug:"mongoose",category:"database",signals:[{type:"dependency",key:"mongoose"}]},{name:"SQLAlchemy",slug:"sqlalchemy",category:"database",signals:[{type:"dependency",key:"sqlalchemy"}]},{name:"Tortoise ORM",slug:"tortoise",category:"database",signals:[{type:"dependency",key:"tortoise-orm"}]},{name:"Vite",slug:"vite",category:"build",signals:[{type:"dependency",key:"vite"},{type:"devDependency",key:"vite"},{type:"file",pattern:"vite.config.*"}]},{name:"webpack",slug:"webpack",category:"build",signals:[{type:"dependency",key:"webpack"},{type:"devDependency",key:"webpack"},{type:"file",pattern:"webpack.config.*"}]},{name:"esbuild",slug:"esbuild",category:"build",signals:[{type:"dependency",key:"esbuild"},{type:"devDependency",key:"esbuild"}]},{name:"Turbopack",slug:"turbopack",category:"build",signals:[{type:"file",pattern:"turbo.json"}]},{name:"Jest",slug:"jest",category:"testing",signals:[{type:"devDependency",key:"jest"},{type:"file",pattern:"jest.config.*"}]},{name:"Vitest",slug:"vitest",category:"testing",signals:[{type:"devDependency",key:"vitest"}]},{name:"Playwright",slug:"playwright",category:"testing",signals:[{type:"devDependency",key:"@playwright/test"},{type:"file",pattern:"playwright.config.*"}]},{name:"Cypress",slug:"cypress",category:"testing",signals:[{type:"devDependency",key:"cypress"},{type:"file",pattern:"cypress.config.*"}]},{name:"Turborepo",slug:"turborepo",category:"monorepo",signals:[{type:"devDependency",key:"turbo"},{type:"file",pattern:"turbo.json"}]},{name:"Nx",slug:"nx",category:"monorepo",signals:[{type:"devDependency",key:"nx"},{type:"file",pattern:"nx.json"}]},{name:"Lerna",slug:"lerna",category:"monorepo",signals:[{type:"devDependency",key:"lerna"},{type:"file",pattern:"lerna.json"}]},{name:"MCP SDK (TS)",slug:"mcp-sdk-ts",category:"mcp",signals:[{type:"dependency",key:"@modelcontextprotocol/sdk"}]},{name:"FastMCP",slug:"fastmcp",category:"mcp",signals:[{type:"dependency",key:"fastmcp"}]},{name:"MCP SDK (Python)",slug:"mcp-sdk-py",category:"mcp",signals:[{type:"dependency",key:"mcp"}]},{name:"rmcp",slug:"rmcp",category:"mcp",signals:[{type:"dependency",key:"rmcp"}]},{name:"MCP Go",slug:"mcp-go",category:"mcp",signals:[{type:"dependency",key:"github.com/mark3labs/mcp-go"}]},{name:"MCP .NET",slug:"mcp-dotnet",category:"mcp",signals:[{type:"dependency",key:"ModelContextProtocol"}]},{name:"FastMCP (TS)",slug:"fastmcp-ts",category:"mcp",signals:[{type:"dependency",key:"@fastmcp/server"}]},{name:"Anthropic SDK",slug:"anthropic",category:"ai",signals:[{type:"dependency",key:"@anthropic-ai/sdk"}]},{name:"OpenAI SDK",slug:"openai",category:"ai",signals:[{type:"dependency",key:"openai"}]},{name:"LangChain",slug:"langchain",category:"ai",signals:[{type:"dependency",key:"langchain"}]},{name:"Vercel",slug:"vercel",category:"hosting",signals:[{type:"file",pattern:"vercel.json"}]},{name:"Netlify",slug:"netlify",category:"hosting",signals:[{type:"file",pattern:"netlify.toml"}]},{name:"Docker",slug:"docker",category:"hosting",signals:[{type:"file",pattern:"Dockerfile"},{type:"file",pattern:"docker-compose.yml"}]},{name:"Cloudflare Workers",slug:"cloudflare",category:"hosting",signals:[{type:"file",pattern:"wrangler.toml"},{type:"dependency",key:"wrangler"}]},{name:"GitHub Actions",slug:"github-actions",category:"cicd",signals:[{type:"file",pattern:".github/workflows/*.yml"}]},{name:"Commander.js",slug:"commander",category:"cli",signals:[{type:"dependency",key:"commander"}]}]});import{existsSync as k,readFileSync as p$,readdirSync as dz}from"fs";import{join as x}from"path";function Z$($){let Z=x($,"package.json");if(!k(Z))return null;try{return JSON.parse(p$(Z,"utf-8"))}catch{return null}}function cz($){let Z=Z$($);if(Z?.name)return{name:Z.name,description:Z.description};let X=x($,"pyproject.toml");if(k(X))try{let J=p$(X,"utf-8"),q=J.match(/^\s*name\s*=\s*"([^"]+)"/m),Q=J.match(/^\s*description\s*=\s*"([^"]+)"/m);if(q)return{name:q[1],description:Q?.[1]}}catch{}let z=x($,"Cargo.toml");if(k(z))try{let J=p$(z,"utf-8"),q=J.match(/^\s*name\s*=\s*"([^"]+)"/m),Q=J.match(/^\s*description\s*=\s*"([^"]+)"/m);if(q)return{name:q[1],description:Q?.[1]}}catch{}return null}function HK($,Z){if(!Z.includes("*"))return k(x($,Z));let X=Z.split("/");if(X.length===1){let Y=Z.split("*")[0];try{return dz($).some((G)=>G.startsWith(Y))}catch{return!1}}let z=x($,...X.slice(0,-1)),J=X[X.length-1],q=J.split("*")[0],Q=J.split("*")[1]||"";try{return dz(z).some((Y)=>Y.startsWith(q)&&Y.endsWith(Q))}catch{return!1}}function VK($,Z,X){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return HK(X,$.pattern);default:return!1}}function KK($){let Z=x($,"pyproject.toml");if(!k(Z))return{};try{let X=p$(Z,"utf-8"),z={},J=X.match(/dependencies\s*=\s*\[([\s\S]*)\]/);if(J){let q=J[1].match(/"([^"]+)"/g)||[];for(let Q of q){let Y=Q.replace(/"/g,"").replace(/\[.*/,"").split(/[>=<]/)[0].trim().toLowerCase();if(Y)z[Y]="*"}}return z}catch{return{}}}function BK($){let Z=x($,"Cargo.toml");if(!k(Z))return{};try{let X=p$(Z,"utf-8"),z={},J=X.match(/\[dependencies\]([\s\S]*?)(?:\[|$)/);if(J){let q=J[1].split(`
|
|
169
|
+
`);for(let Q of q){let Y=Q.match(/^\s*([a-zA-Z_-]+)\s*=/);if(Y)z[Y[1].toLowerCase()]="*"}}return z}catch{return{}}}function x5($){let Z=Z$($),X=KK($),z=BK($),J={...X,...z},q=Z?{...Z,dependencies:{...Z.dependencies,...J}}:Object.keys(J).length>0?{dependencies:J}:null,Q=uz.map((U)=>{let V=U.signals.filter((H)=>VK(H,q,$)).length/U.signals.length;return{name:U.name,slug:U.slug,category:U.category,confidence:V}}).filter((U)=>U.confidence>0).sort((U,W)=>W.confidence-U.confidence),Y=new Set(Q.map((U)=>U.slug)),G=new Set;if(Y.has("nextjs"))G.add("react");if(Y.has("nuxt"))G.add("vue");if(Y.has("sveltekit"))G.add("svelte");return Q.filter((U)=>!G.has(U.slug))}function pz($){let Z=Z$($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(k(x($,"tsconfig.json")))return"TypeScript";if(k(x($,"Cargo.toml")))return"Rust";if(k(x($,"go.mod")))return"Go";if(k(x($,"pyproject.toml"))||k(x($,"setup.py")))return"Python";if(k(x($,"Gemfile")))return"Ruby";if(k(x($,"pom.xml"))||k(x($,"build.gradle")))return"Java";if(k(x($,"Package.swift")))return"Swift";if(k(x($,"build.zig")))return"Zig";if(Z)return"JavaScript";return"Unknown"}function lz($){let Z=Z$($),X=x5($);if(X.some((U)=>U.category==="mcp"))return"mcp";if(Z?.bin)return"cli";let J=X.some((U)=>U.slug==="svelte"||U.slug==="sveltekit");if(Z?.private===!0&&(k(x($,"pnpm-workspace.yaml"))||Z?.workspaces!==void 0)&&J)return"framework";if(J)return"svelte";if(X.some((U)=>U.slug==="nextjs"||U.slug==="nuxt"))return"fullstack";let Y=X.some((U)=>U.category==="frontend"),G=X.some((U)=>U.category==="backend");if(Y&&G)return"fullstack";if(Y)return"frontend";if(G)return"backend";if(Z?.main&&!Z?.bin)return"library";return"library"}function iz($){if(k(x($,"bunfig.toml")))return"Bun";if(k(x($,"deno.json"))||k(x($,"deno.jsonc")))return"Deno";if(Z$($))return"Node.js";if(k(x($,"Cargo.toml")))return"Rust";if(k(x($,"go.mod")))return"Go";return"Unknown"}function nz($){if(k(x($,"bun.lockb"))||k(x($,"bun.lock")))return"bun";if(k(x($,"pnpm-lock.yaml")))return"pnpm";if(k(x($,"yarn.lock")))return"yarn";if(k(x($,"package-lock.json")))return"npm";return"npm"}function sz($){if(k(x($,".github/workflows")))return"GitHub Actions";if(k(x($,".gitlab-ci.yml")))return"GitLab CI";if(k(x($,".circleci")))return"CircleCI";if(k(x($,"Jenkinsfile")))return"Jenkins";return null}function rz($){if(k(x($,"vercel.json")))return"Vercel";if(k(x($,"netlify.toml")))return"Netlify";if(k(x($,"wrangler.toml")))return"Cloudflare";if(k(x($,"Dockerfile")))return"Docker";if(k(x($,"fly.toml")))return"Fly.io";if(k(x($,"render.yaml")))return"Render";return null}function az($){let Z=x($,"svelte.config.js");if(!k(Z))return null;try{let z=p$(Z,"utf-8").match(/@sveltejs\/adapter-(\w+)/);if(z){let J=z[1];switch(J){case"vercel":return"Vercel";case"node":return"Node";case"static":return"Static";case"cloudflare":return"Cloudflare";case"netlify":return"Netlify";case"auto":return"Auto";default:return J}}return null}catch{return null}}function oz($){let Z=Z$($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return"Vite";if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(k(x($,"tsconfig.json"))&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}var tz=_(()=>{mz()});function l$($){let Z=Z$($),X=x5($),z=pz($),J=lz($),q=iz($),Q=nz($),Y=sz($),G=rz($),U=oz($),W=X.find((p)=>p.category==="frontend"),V=X.find((p)=>p.category==="css"),H=X.find((p)=>p.category==="ui"),D=X.find((p)=>p.category==="state"),T=X.find((p)=>p.category==="backend"),B=X.find((p)=>p.category==="database"),L=c$[J]||c$.library,w=J==="framework",A=X.some((p)=>p.slug==="svelte"||p.slug==="sveltekit"),P=w&&A?"svelte":w?null:null,C=J==="mcp",S=C?X.find((p)=>p.category==="mcp"):null,E=S?.slug??null,h=J==="svelte"||P==="svelte",R=h?az($):null,o=h&&X.some((p)=>p.slug==="sveltekit"),C0=new Set(["css_framework","ui_library","database","connection","hosting"]),d={},$0=H0.filter((p)=>p.path.startsWith("stack."));for(let p of $0){let i=p.path.replace("stack.","");if(!L.includes(p.category)){d[i]="slotignored";continue}if(w&&C0.has(i)){d[i]="slotignored";continue}switch(i){case"frontend":d[i]=W?.name??(J==="cli"?"CLI":"");break;case"css_framework":d[i]=V?.name??"";break;case"ui_library":d[i]=H?.name??"";break;case"state_management":d[i]=h?D?.name??"Runes":D?.name??"";break;case"backend":if(C&&S)d[i]=S.name;else if(h)d[i]=o?"SvelteKit":T?.name??"";else d[i]=T?.name??"";break;case"api_type":if(C)d[i]="MCP (stdio/SSE)";else if(o)d[i]="Server Routes";else d[i]="";break;case"runtime":d[i]=q!=="Unknown"?q:"";break;case"database":d[i]=B?.name??"";break;case"connection":d[i]=B?.name??"";break;case"hosting":if(h&&R)d[i]=R;else d[i]=G??"";break;case"build":d[i]=h?"Vite":U??"";break;case"cicd":d[i]=Y??"";break;case"package_manager":d[i]=Q;break;default:d[i]="";break}}let C$={},$q=H0.filter((p)=>p.path.startsWith("monorepo."));for(let p of $q){let i=p.path.replace("monorepo.","");if(!L.includes(p.category))C$[i]="slotignored";else C$[i]=""}let Z7=cz($),JZ={name:Z7?.name??$.split("/").pop()??"project",goal:Z7?.description??"",main_language:z,type:J};if(w&&P)JZ.framework=P;if(C&&E)JZ.framework=E;return{faf_version:"3.0",project:JZ,stack:d,human_context:{who:"",what:Z?.description??"",why:"",where:"",when:"",how:""},monorepo:C$}}var w2=_(()=>{h0();tz()});var Z9={};QZ(Z9,{autoCommand:()=>y5});import{existsSync as LK}from"fs";import{join as NK}from"path";function y5(){let $=process.cwd(),Z=NK($,"project.faf"),X=l$($);if(LK(Z)){let q=c(Z),Q=$9(q,X);s(Z,Q),console.log(`${O("updated")} ${Z}`)}else{let q=X.project?.type??"library",Q=c$[q]||c$.library;for(let Y of H0)if(!Q.includes(Y.category)){let[G,U]=Y.path.split(".");if(G==="stack"&&X.stack)X.stack[U]="slotignored";if(G==="monorepo"&&X.monorepo)X.monorepo[U]="slotignored"}s(Z,X),console.log(`${O("created")} ${Z}`)}let z=m(Z),J=e(t(z));if(J0(J,Z),J.score<100)console.log(N(`
|
|
170
|
+
run ${b("'faf go'")} to reach 100%`))}function $9($,Z){let X={...$};for(let[z,J]of Object.entries(Z))if(!(z in X)||X[z]===null||X[z]===void 0)X[z]=J;else if(typeof J==="object"&&J!==null&&!Array.isArray(J))X[z]=$9(X[z]??{},J);return X}var f5=_(()=>{w2();Z0();P0();b0();l();h0()});var I9=I((zT,mK)=>{mK.exports={name:"faf-cli",version:"6.0.11",description:"Persistent AI Context Standard — project DNA for AI. IANA-registered. Anthropic-approved.",type:"module",icon:"https://faf.one/orange-smiley.svg",logo:"https://faf.one/orange-smiley.svg",main:"dist/index.js",bin:{faf:"dist/cli.js","faf-cli":"dist/cli.js"},exports:{".":{bun:"./src/index.ts",default:"./dist/index.js"}},files:["dist/**/*","README.md","LICENSE","project.faf"],scripts:{dev:"bun src/cli.ts",build:"bun build src/cli.ts --outfile dist/cli.js --target=node --minify && bun build src/index.ts --outfile dist/index.js --target=node --minify",compile:"bun build src/cli.ts --compile --bytecode --minify --outfile faf","compile:all":"bun build src/cli.ts --compile --target=bun-darwin-arm64 --outfile faf-darwin-arm64 && bun build src/cli.ts --compile --target=bun-darwin-x64 --outfile faf-darwin-x64 && bun build src/cli.ts --compile --target=bun-linux-x64 --outfile faf-linux-x64 && bun build src/cli.ts --compile --target=bun-windows-x64 --outfile faf-windows-x64.exe",test:"bun test","test:watch":"bun test --watch",lint:"eslint src/**/*.ts",format:"prettier --write 'src/**/*.ts'",prepublishOnly:"bun run build"},keywords:["faf","ai-context","project-dna","bi-sync","cli","claude","gemini","cursor","mcp","model-context-protocol","persistent-context","ai-readiness","foundational"],author:"wolfejam <wolfejam@faf.one>",license:"MIT",repository:{type:"git",url:"https://github.com/Wolfe-Jam/faf-cli.git"},homepage:"https://faf.one",bugs:{url:"https://github.com/Wolfe-Jam/faf-cli/issues"},dependencies:{commander:"^14.0.1","faf-scoring-kernel":"^2.0.3",open:"8.4.2",yaml:"^2.4.1"},optionalDependencies:{"@anthropic-ai/sdk":"^0.74.0"},devDependencies:{"@types/node":"^22.15.0","@typescript-eslint/eslint-plugin":"^8.41.0","@typescript-eslint/parser":"^8.41.0",eslint:"^9.39.2",prettier:"^3.2.5",typescript:"^5.3.3","typescript-eslint":"^8.57.2"},engines:{node:">=18.0.0"},publishConfig:{access:"public"}}});var i5=I((mT,S9)=>{var E9=G0("fs"),l5;function aK(){try{return E9.statSync("/.dockerenv"),!0}catch($){return!1}}function oK(){try{return E9.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch($){return!1}}S9.exports=()=>{if(l5===void 0)l5=aK()||oK();return l5}});var x9=I((dT,n5)=>{var tK=G0("os"),eK=G0("fs"),j9=i5(),b9=()=>{if(process.platform!=="linux")return!1;if(tK.release().toLowerCase().includes("microsoft")){if(j9())return!1;return!0}try{return eK.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!j9():!1}catch($){return!1}};if(process.env.__IS_WSL_TEST__)n5.exports=b9;else n5.exports=b9()});var y9=I((cT,k9)=>{k9.exports=($,Z,X)=>{let z=(J)=>Object.defineProperty($,Z,{value:J,enumerable:!0,writable:!0});return Object.defineProperty($,Z,{configurable:!0,enumerable:!0,get(){let J=X();return z(J),J},set(J){z(J)}}),$}});var d9=I((pT,m9)=>{var __dirname="/Users/wolfejam/FAF/cli/node_modules/open",$B=G0("path"),ZB=G0("child_process"),{promises:_2,constants:u9}=G0("fs"),P2=x9(),XB=i5(),r5=y9(),f9=$B.join(__dirname,"xdg-open"),{platform:n$,arch:g9}=process,zB=()=>{try{return _2.statSync("/run/.containerenv"),!0}catch{return!1}},s5;function JB(){if(s5===void 0)s5=zB()||XB();return s5}var qB=(()=>{let Z;return async function(){if(Z)return Z;let X="/etc/wsl.conf",z=!1;try{await _2.access(X,u9.F_OK),z=!0}catch{}if(!z)return"/mnt/";let J=await _2.readFile(X,{encoding:"utf8"}),q=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(J);if(!q)return"/mnt/";return Z=q.groups.mountPoint.trim(),Z=Z.endsWith("/")?Z:`${Z}/`,Z}})(),h9=async($,Z)=>{let X;for(let z of $)try{return await Z(z)}catch(J){X=J}throw X},C2=async($)=>{if($={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...$},Array.isArray($.app))return h9($.app,(Y)=>C2({...$,app:Y}));let{name:Z,arguments:X=[]}=$.app||{};if(X=[...X],Array.isArray(Z))return h9(Z,(Y)=>C2({...$,app:{name:Y,arguments:X}}));let z,J=[],q={};if(n$==="darwin"){if(z="open",$.wait)J.push("--wait-apps");if($.background)J.push("--background");if($.newInstance)J.push("--new");if(Z)J.push("-a",Z)}else if(n$==="win32"||P2&&!JB()&&!Z){let Y=await qB();if(z=P2?`${Y}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${process.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,J.push("-NoProfile","-NonInteractive","–ExecutionPolicy","Bypass","-EncodedCommand"),!P2)q.windowsVerbatimArguments=!0;let G=["Start"];if($.wait)G.push("-Wait");if(Z){if(G.push(`"\`"${Z}\`""`,"-ArgumentList"),$.target)X.unshift($.target)}else if($.target)G.push(`"${$.target}"`);if(X.length>0)X=X.map((U)=>`"\`"${U}\`""`),G.push(X.join(","));$.target=Buffer.from(G.join(" "),"utf16le").toString("base64")}else{if(Z)z=Z;else{let Y=!__dirname||__dirname==="/",G=!1;try{await _2.access(f9,u9.X_OK),G=!0}catch{}z=process.versions.electron||n$==="android"||Y||!G?"xdg-open":f9}if(X.length>0)J.push(...X);if(!$.wait)q.stdio="ignore",q.detached=!0}if($.target)J.push($.target);if(n$==="darwin"&&X.length>0)J.push("--args",...X);let Q=ZB.spawn(z,J,q);if($.wait)return new Promise((Y,G)=>{Q.once("error",G),Q.once("close",(U)=>{if(!$.allowNonzeroExitCode&&U>0){G(Error(`Exited with code ${U}`));return}Y(Q)})});return Q.unref(),Q},a5=($,Z)=>{if(typeof $!=="string")throw TypeError("Expected a `target`");return C2({...Z,target:$})},QB=($,Z)=>{if(typeof $!=="string")throw TypeError("Expected a `name`");let{arguments:X=[]}=Z||{};if(X!==void 0&&X!==null&&!Array.isArray(X))throw TypeError("Expected `appArguments` as Array type");return C2({...Z,app:{name:$,arguments:X}})};function v9($){if(typeof $==="string"||Array.isArray($))return $;let{[g9]:Z}=$;if(!Z)throw Error(`${g9} is not supported`);return Z}function o5({[n$]:$},{wsl:Z}){if(Z&&P2)return v9(Z);if(!$)throw Error(`${n$} is not supported`);return v9($)}var E2={};r5(E2,"chrome",()=>o5({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));r5(E2,"firefox",()=>o5({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));r5(E2,"edge",()=>o5({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));a5.apps=E2;a5.openApp=QB;m9.exports=a5});function M($,Z,X,z,J){if(z==="m")throw TypeError("Private method is not writable");if(z==="a"&&!J)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?$!==Z||!J:!Z.has($))throw TypeError("Cannot write private member to an object whose class did not declare it");return z==="a"?J.call($,X):J?J.value=X:Z.set($,X),X}function K($,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($)}var v0=()=>{};var t5=function(){let{crypto:$}=globalThis;if($?.randomUUID)return t5=$.randomUUID.bind($),$.randomUUID();let Z=new Uint8Array(1),X=$?()=>$.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(z)=>(+z^X()&15>>+z/4).toString(16))};function u0($){return typeof $==="object"&&$!==null&&(("name"in $)&&$.name==="AbortError"||("message"in $)&&String($.message).includes("FetchRequestCanceledException"))}var n6=($)=>{if($ instanceof Error)return $;if(typeof $==="object"&&$!==null){try{if(Object.prototype.toString.call($)==="[object Error]"){let Z=Error($.message,$.cause?{cause:$.cause}:{});if($.stack)Z.stack=$.stack;if($.cause&&!Z.cause)Z.cause=$.cause;if($.name)Z.name=$.name;return Z}}catch{}try{return Error(JSON.stringify($))}catch{}}return Error($)};var F,q0,W0,z$,s$,r$,a$,o$,t$,e$,$6,Z6,X6;var B0=_(()=>{F=class F extends Error{};q0=class q0 extends F{constructor($,Z,X,z){super(`${q0.makeMessage($,Z,X)}`);this.status=$,this.headers=z,this.requestID=z?.get("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 z$({message:X,cause:n6(Z)});let J=Z;if($===400)return new r$($,J,X,z);if($===401)return new a$($,J,X,z);if($===403)return new o$($,J,X,z);if($===404)return new t$($,J,X,z);if($===409)return new e$($,J,X,z);if($===422)return new $6($,J,X,z);if($===429)return new Z6($,J,X,z);if($>=500)return new X6($,J,X,z);return new q0($,J,X,z)}};W0=class W0 extends q0{constructor({message:$}={}){super(void 0,void 0,$||"Request was aborted.",void 0)}};z$=class z$ extends q0{constructor({message:$,cause:Z}){super(void 0,void 0,$||"Connection error.",void 0);if(Z)this.cause=Z}};s$=class s$ extends z${constructor({message:$}={}){super({message:$??"Request timed out."})}};r$=class r$ extends q0{};a$=class a$ extends q0{};o$=class o$ extends q0{};t$=class t$ extends q0{};e$=class e$ extends q0{};$6=class $6 extends q0{};Z6=class Z6 extends q0{};X6=class X6 extends q0{}});function S2($){if(typeof $!=="object")return{};return $??{}}function t9($){if(!$)return!0;for(let Z in $)return!1;return!0}function e9($,Z){return Object.prototype.hasOwnProperty.call($,Z)}var AB,o9=($)=>{return AB.test($)},e5=($)=>(e5=Array.isArray,e5($)),$4,$J=($,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new F(`${$} must be an integer`);if(Z<0)throw new F(`${$} must be a positive integer`);return Z},j2=($)=>{try{return JSON.parse($)}catch(Z){return}};var w$=_(()=>{B0();AB=/^[a-z][a-z0-9+.-]*:/i,$4=e5});var ZJ=($)=>new Promise((Z)=>setTimeout(Z,$));var J$="0.74.0";function PB(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function CB(){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 J=z[1]||0,q=z[2]||0,Q=z[3]||0;return{browser:Z,version:`${J}.${q}.${Q}`}}}return null}var qJ=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},_B=()=>{let $=PB();if($==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":J$,"X-Stainless-OS":zJ(Deno.build.os),"X-Stainless-Arch":XJ(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":J$,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if($==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":J$,"X-Stainless-OS":zJ(globalThis.process.platform??"unknown"),"X-Stainless-Arch":XJ(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=CB();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":J$,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":J$,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},XJ=($)=>{if($==="x32")return"x32";if($==="x86_64"||$==="x64")return"x64";if($==="arm")return"arm";if($==="aarch64"||$==="arm64")return"arm64";if($)return`other:${$}`;return"unknown"},zJ=($)=>{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"},JJ,QJ=()=>{return JJ??(JJ=_B())};var Z4=()=>{};function YJ(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function X4(...$){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...$)}function b2($){let Z=Symbol.asyncIterator in $?$[Symbol.asyncIterator]():$[Symbol.iterator]();return X4({start(){},async pull(X){let{done:z,value:J}=await Z.next();if(z)X.close();else X.enqueue(J)},async cancel(){await Z.return?.()}})}function s6($){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}}}async function GJ($){if($===null||typeof $!=="object")return;if($[Symbol.asyncIterator]){await $[Symbol.asyncIterator]().return?.();return}let Z=$.getReader(),X=Z.cancel();Z.releaseLock(),await X}var UJ=({headers:$,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};function VJ($){let Z=0;for(let J of $)Z+=J.length;let X=new Uint8Array(Z),z=0;for(let J of $)X.set(J,z),z+=J.length;return X}function r6($){let Z;return(WJ??(Z=new globalThis.TextEncoder,WJ=Z.encode.bind(Z)))($)}function z4($){let Z;return(HJ??(Z=new globalThis.TextDecoder,HJ=Z.decode.bind(Z)))($)}var WJ,HJ;class q${constructor(){D0.set(this,void 0),L0.set(this,void 0),M(this,D0,new Uint8Array,"f"),M(this,L0,null,"f")}decode($){if($==null)return[];let Z=$ instanceof ArrayBuffer?new Uint8Array($):typeof $==="string"?r6($):$;M(this,D0,VJ([K(this,D0,"f"),Z]),"f");let X=[],z;while((z=jB(K(this,D0,"f"),K(this,L0,"f")))!=null){if(z.carriage&&K(this,L0,"f")==null){M(this,L0,z.index,"f");continue}if(K(this,L0,"f")!=null&&(z.index!==K(this,L0,"f")+1||z.carriage)){X.push(z4(K(this,D0,"f").subarray(0,K(this,L0,"f")-1))),M(this,D0,K(this,D0,"f").subarray(K(this,L0,"f")),"f"),M(this,L0,null,"f");continue}let J=K(this,L0,"f")!==null?z.preceding-1:z.preceding,q=z4(K(this,D0,"f").subarray(0,J));X.push(q),M(this,D0,K(this,D0,"f").subarray(z.index),"f"),M(this,L0,null,"f")}return X}flush(){if(!K(this,D0,"f").length)return[];return this.decode(`
|
|
171
|
+
`)}}function jB($,Z){for(let J=Z??0;J<$.length;J++){if($[J]===10)return{preceding:J,index:J+1,carriage:!1};if($[J]===13)return{preceding:J,index:J+1,carriage:!0}}return null}function KJ($){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}var D0,L0;var J4=_(()=>{v0();D0=new WeakMap,L0=new WeakMap;q$.NEWLINE_CHARS=new Set([`
|
|
172
|
+
`,"\r"]);q$.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function a6(){}function x2($,Z,X){if(!Z||k2[$]>k2[X])return a6;else return Z[$].bind(Z)}function U0($){let Z=$.logger,X=$.logLevel??"off";if(!Z)return bB;let z=BJ.get(Z);if(z&&z[0]===X)return z[1];let J={error:x2("error",Z,X),warn:x2("warn",Z,X),info:x2("info",Z,X),debug:x2("debug",Z,X)};return BJ.set(Z,[X,J]),J}var k2,q4=($,Z,X)=>{if(!$)return;if(e9(k2,$))return $;U0(X).warn(`${Z} was set to ${JSON.stringify($)}, expected one of ${JSON.stringify(Object.keys(k2))}`);return},bB,BJ,m0=($)=>{if($.options)$.options={...$.options},delete $.options.headers;if($.headers)$.headers=Object.fromEntries(($.headers instanceof Headers?[...$.headers]:Object.entries($.headers)).map(([Z,X])=>[Z,Z.toLowerCase()==="x-api-key"||Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":X]));if("retryOfRequestLogID"in $){if($.retryOfRequestLogID)$.retryOf=$.retryOfRequestLogID;delete $.retryOfRequestLogID}return $};var y2=_(()=>{w$();k2={off:0,error:200,warn:300,info:400,debug:500};bB={error:a6,warn:a6,info:a6,debug:a6},BJ=new WeakMap});async function*xB($,Z){if(!$.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new F("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new F("Attempted to iterate over a response with no body")}let X=new DJ,z=new q$,J=s6($.body);for await(let q of kB(J))for(let Q of z.decode(q)){let Y=X.decode(Q);if(Y)yield Y}for(let q of z.flush()){let Q=X.decode(q);if(Q)yield Q}}async function*kB($){let Z=new Uint8Array;for await(let X of $){if(X==null)continue;let z=X instanceof ArrayBuffer?new Uint8Array(X):typeof X==="string"?r6(X):X,J=new Uint8Array(Z.length+z.length);J.set(Z),J.set(z,Z.length),Z=J;let q;while((q=KJ(Z))!==-1)yield Z.slice(0,q),Z=Z.slice(q)}if(Z.length>0)yield Z}class DJ{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 J={event:this.event,data:this.data.join(`
|
|
173
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],J}if(this.chunks.push($),$.startsWith(":"))return null;let[Z,X,z]=yB($,":");if(z.startsWith(" "))z=z.substring(1);if(Z==="event")this.event=z;else if(Z==="data")this.data.push(z);return null}}function yB($,Z){let X=$.indexOf(Z);if(X!==-1)return[$.substring(0,X),Z,$.substring(X+Z.length)];return[$,"",""]}var o6,N0;var Q4=_(()=>{v0();B0();J4();w$();y2();B0();N0=class N0{constructor($,Z,X){this.iterator=$,o6.set(this,void 0),this.controller=Z,M(this,o6,X,"f")}static fromSSEResponse($,Z,X){let z=!1,J=X?U0(X):console;async function*q(){if(z)throw new F("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Q=!1;try{for await(let Y of xB($,Z)){if(Y.event==="completion")try{yield JSON.parse(Y.data)}catch(G){throw J.error("Could not parse message into JSON:",Y.data),J.error("From chunk:",Y.raw),G}if(Y.event==="message_start"||Y.event==="message_delta"||Y.event==="message_stop"||Y.event==="content_block_start"||Y.event==="content_block_delta"||Y.event==="content_block_stop")try{yield JSON.parse(Y.data)}catch(G){throw J.error("Could not parse message into JSON:",Y.data),J.error("From chunk:",Y.raw),G}if(Y.event==="ping")continue;if(Y.event==="error")throw new q0(void 0,j2(Y.data)??Y.data,void 0,$.headers)}Q=!0}catch(Y){if(u0(Y))return;throw Y}finally{if(!Q)Z.abort()}}return new N0(q,Z,X)}static fromReadableStream($,Z,X){let z=!1;async function*J(){let Q=new q$,Y=s6($);for await(let G of Y)for(let U of Q.decode(G))yield U;for(let G of Q.flush())yield G}async function*q(){if(z)throw new F("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");z=!0;let Q=!1;try{for await(let Y of J()){if(Q)continue;if(Y)yield JSON.parse(Y)}Q=!0}catch(Y){if(u0(Y))return;throw Y}finally{if(!Q)Z.abort()}}return new N0(q,Z,X)}[(o6=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let $=[],Z=[],X=this.iterator(),z=(J)=>{return{next:()=>{if(J.length===0){let q=X.next();$.push(q),Z.push(q)}return J.shift()}}};return[new N0(()=>z($),this.controller,K(this,o6,"f")),new N0(()=>z(Z),this.controller,K(this,o6,"f"))]}toReadableStream(){let $=this,Z;return X4({async start(){Z=$[Symbol.asyncIterator]()},async pull(X){try{let{value:z,done:J}=await Z.next();if(J)return X.close();let q=r6(JSON.stringify(z)+`
|
|
174
|
+
`);X.enqueue(q)}catch(z){X.error(z)}},async cancel(){await Z.return?.()}})}}});async function f2($,Z){let{response:X,requestLogID:z,retryOfRequestLogID:J,startTime:q}=Z,Q=await(async()=>{if(Z.options.stream){if(U0($).debug("response",X.status,X.url,X.headers,X.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(X,Z.controller);return N0.fromSSEResponse(X,Z.controller)}if(X.status===204)return null;if(Z.options.__binaryResponse)return X;let G=X.headers.get("content-type")?.split(";")[0]?.trim();if(G?.includes("application/json")||G?.endsWith("+json")){if(X.headers.get("content-length")==="0")return;let H=await X.json();return Y4(H,X)}return await X.text()})();return U0($).debug(`[${z}] response parsed`,m0({retryOfRequestLogID:J,url:X.url,status:X.status,body:Q,durationMs:Date.now()-q})),Q}function Y4($,Z){if(!$||typeof $!=="object"||Array.isArray($))return $;return Object.defineProperty($,"_request_id",{value:Z.headers.get("request-id"),enumerable:!1})}var G4=_(()=>{Q4();y2()});var t6,Q$;var g2=_(()=>{v0();G4();Q$=class Q$ extends Promise{constructor($,Z,X=f2){super((z)=>{z(null)});this.responsePromise=Z,this.parseResponse=X,t6.set(this,void 0),M(this,t6,$,"f")}_thenUnwrap($){return new Q$(K(this,t6,"f"),this.responsePromise,async(Z,X)=>Y4($(await this.parseResponse(Z,X),X),X.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(K(this,t6,"f"),$));return this.parsedPromise}then($,Z){return this.parse().then($,Z)}catch($){return this.parse().catch($)}finally($){return this.parse().finally($)}};t6=new WeakMap});var h2,U4,e6,_0,$8;var x0=_(()=>{v0();B0();G4();g2();w$();U4=class U4{constructor($,Z,X,z){h2.set(this,void 0),M(this,h2,$,"f"),this.options=z,this.response=Z,this.body=X}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let $=this.nextPageRequestOptions();if(!$)throw new F("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await K(this,h2,"f").requestAPIList(this.constructor,$)}async*iterPages(){let $=this;yield $;while($.hasNextPage())$=await $.getNextPage(),yield $}async*[(h2=new WeakMap,Symbol.asyncIterator)](){for await(let $ of this.iterPages())for(let Z of $.getPaginatedItems())yield Z}};e6=class e6 extends Q${constructor($,Z,X){super($,Z,async(z,J)=>new X(z,J.response,await f2(z,J),J.options))}async*[Symbol.asyncIterator](){let $=await this;for await(let Z of $)yield Z}};_0=class _0 extends U4{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()}nextPageRequestOptions(){if(this.options.query?.before_id){let Z=this.first_id;if(!Z)return null;return{...this.options,query:{...S2(this.options.query),before_id:Z}}}let $=this.last_id;if(!$)return null;return{...this.options,query:{...S2(this.options.query),after_id:$}}}};$8=class $8 extends U4{constructor($,Z,X,z){super($,Z,X,z);this.data=X.data||[],this.has_more=X.has_more||!1,this.next_page=X.next_page||null}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let $=this.next_page;if(!$)return null;return{...this.options,query:{...S2(this.options.query),page:$}}}}});function R$($,Z,X){return H4(),new File($,Z??"unknown_file",X)}function Z8($,Z){let X=typeof $==="object"&&$!==null&&(("name"in $)&&$.name&&String($.name)||("url"in $)&&$.url&&String($.url)||("filename"in $)&&$.filename&&String($.filename)||("path"in $)&&$.path&&String($.path))||"";return Z?X.split(/[\\/]/).pop()||void 0:X}function gB($){let Z=typeof $==="function"?$:$.fetch,X=LJ.get(Z);if(X)return X;let z=(async()=>{try{let J="Response"in Z?Z.Response:(await Z("data:,")).constructor,q=new FormData;if(q.toString()===await new J(q).text())return!1;return!0}catch{return!0}})();return LJ.set(Z,z),z}var H4=()=>{if(typeof File>"u"){let{process:$}=globalThis,Z=typeof $?.versions?.node==="string"&&parseInt($.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(Z?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}},V4=($)=>$!=null&&typeof $==="object"&&typeof $[Symbol.asyncIterator]==="function",z6=async($,Z,X=!0)=>{return{...$,body:await hB($.body,Z,X)}},LJ,hB=async($,Z,X=!0)=>{if(!await gB(Z))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let z=new FormData;return await Promise.all(Object.entries($||{}).map(([J,q])=>W4(z,J,q,X))),z},vB=($)=>$ instanceof Blob&&("name"in $),W4=async($,Z,X,z)=>{if(X===void 0)return;if(X==null)throw TypeError(`Received null for "${Z}"; to pass null in FormData, you must use the string 'null'`);if(typeof X==="string"||typeof X==="number"||typeof X==="boolean")$.append(Z,String(X));else if(X instanceof Response){let J={},q=X.headers.get("Content-Type");if(q)J={type:q};$.append(Z,R$([await X.blob()],Z8(X,z),J))}else if(V4(X))$.append(Z,R$([await new Response(b2(X)).blob()],Z8(X,z)));else if(vB(X))$.append(Z,R$([X],Z8(X,z),{type:X.type}));else if(Array.isArray(X))await Promise.all(X.map((J)=>W4($,Z+"[]",J,z)));else if(typeof X==="object")await Promise.all(Object.entries(X).map(([J,q])=>W4($,`${Z}[${J}]`,q,z)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${X} instead`)};var J6=_(()=>{LJ=new WeakMap});async function X8($,Z,X){if(H4(),$=await $,Z||(Z=Z8($,!0)),uB($)){if($ instanceof File&&Z==null&&X==null)return $;return R$([await $.arrayBuffer()],Z??$.name,{type:$.type,lastModified:$.lastModified,...X})}if(mB($)){let J=await $.blob();return Z||(Z=new URL($.url).pathname.split(/[\\/]/).pop()),R$(await K4(J),Z,X)}let z=await K4($);if(!X?.type){let J=z.find((q)=>typeof q==="object"&&("type"in q)&&q.type);if(typeof J==="string")X={...X,type:J}}return R$(z,Z,X)}async function K4($){let Z=[];if(typeof $==="string"||ArrayBuffer.isView($)||$ instanceof ArrayBuffer)Z.push($);else if(NJ($))Z.push($ instanceof Blob?$:await $.arrayBuffer());else if(V4($))for await(let X of $)Z.push(...await K4(X));else{let X=$?.constructor?.name;throw Error(`Unexpected data type: ${typeof $}${X?`; constructor: ${X}`:""}${dB($)}`)}return Z}function dB($){if(typeof $!=="object"||$===null)return"";return`; props: [${Object.getOwnPropertyNames($).map((X)=>`"${X}"`).join(", ")}]`}var NJ=($)=>$!=null&&typeof $==="object"&&typeof $.size==="number"&&typeof $.type==="string"&&typeof $.text==="function"&&typeof $.slice==="function"&&typeof $.arrayBuffer==="function",uB=($)=>$!=null&&typeof $==="object"&&typeof $.name==="string"&&typeof $.lastModified==="number"&&NJ($),mB=($)=>$!=null&&typeof $==="object"&&typeof $.url==="string"&&typeof $.blob==="function";var IJ=_(()=>{J6();J6()});var B4=_(()=>{IJ()});var TJ=()=>{};class r{constructor($){this._client=$}}function*pB($){if(!$)return;if(MJ in $){let{values:z,nulls:J}=$;yield*z.entries();for(let q of J)yield[q,null];return}let Z=!1,X;if($ instanceof Headers)X=$.entries();else if($4($))X=$;else Z=!0,X=Object.entries($??{});for(let z of X){let J=z[0];if(typeof J!=="string")throw TypeError("expected header name to be a string");let q=$4(z[1])?z[1]:[z[1]],Q=!1;for(let Y of q){if(Y===void 0)continue;if(Z&&!Q)Q=!0,yield[J,null];yield[J,Y]}}}var MJ,j=($)=>{let Z=new Headers,X=new Set;for(let z of $){let J=new Set;for(let[q,Q]of pB(z)){let Y=q.toLowerCase();if(!J.has(Y))Z.delete(q),J.add(Y);if(Q===null)Z.delete(q),X.add(Y);else Z.append(q,Q),X.delete(Y)}}return{[MJ]:!0,values:Z,nulls:X}};var I0=_(()=>{w$();MJ=Symbol.for("brand.privateNullableHeaders")});function v2($){return typeof $==="object"&&$!==null&&z8 in $}function D4($,Z){let X=new Set;if($){for(let z of $)if(v2(z))X.add(z[z8])}if(Z)for(let z of Z){if(v2(z))X.add(z[z8]);if(Array.isArray(z.content)){for(let J of z.content)if(v2(J))X.add(J[z8])}}return Array.from(X)}function u2($,Z){let X=D4($,Z);if(X.length===0)return{};return{"x-stainless-helper":X.join(", ")}}function OJ($){if(v2($))return{"x-stainless-helper":$[z8]};return{}}var z8;var J8=_(()=>{z8=Symbol("anthropic.sdk.stainlessHelper")});function RJ($){return $.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var wJ,lB=($=RJ)=>function(X,...z){if(X.length===1)return X[0];let J=!1,q=[],Q=X.reduce((W,V,H)=>{if(/[?#]/.test(V))J=!0;let D=z[H],T=(J?encodeURIComponent:$)(""+D);if(H!==z.length&&(D==null||typeof D==="object"&&D.toString===Object.getPrototypeOf(Object.getPrototypeOf(D.hasOwnProperty??wJ)??wJ)?.toString))T=D+"",q.push({start:W.length+V.length,length:T.length,error:`Value of type ${Object.prototype.toString.call(D).slice(8,-1)} is not a valid path parameter`});return W+V+(H===z.length?"":T)},""),Y=Q.split(/[?#]/,1)[0],G=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,U;while((U=G.exec(Y))!==null)q.push({start:U.index,length:U[0].length,error:`Value "${U[0]}" can't be safely passed as a path parameter`});if(q.sort((W,V)=>W.start-V.start),q.length>0){let W=0,V=q.reduce((H,D)=>{let T=" ".repeat(D.start-W),B="^".repeat(D.length);return W=D.start+D.length,H+T+B},"");throw new F(`Path parameters result in path with invalid segments:
|
|
170
175
|
${q.map((H)=>H.error).join(`
|
|
171
176
|
`)}
|
|
172
177
|
${Q}
|
|
173
|
-
${V}`)}return Q},l;var X$=j(()=>{V0();YJ=Object.freeze(Object.create(null)),l=_D(GJ)});var e6;var z4=j(()=>{S0();N0();t6();t$();X$();e6=class e6 extends n{list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/files",A0,{query:z,...Z,headers:E([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(l`/v1/files/${$}`,{...X,headers:E([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}download($,Z={},X){let{betas:z}=Z??{};return this._client.get(l`/v1/files/${$}/content`,{...X,headers:E([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},X?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},X){let{betas:z}=Z??{};return this._client.get(l`/v1/files/${$}`,{...X,headers:E([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}upload($,Z){let{betas:X,...z}=$;return this._client.post("/v1/files",o$({body:z,...Z,headers:E([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},QJ(z.file),Z?.headers])},this._client))}}});var $8;var J4=j(()=>{S0();N0();X$();$8=class $8 extends n{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(l`/v1/models/${$}?beta=true`,{...X,headers:E([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models?beta=true",A0,{query:z,...Z,headers:E([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var e$=j(()=>{V0()});var k2;var q4=j(()=>{k2={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192}});function UJ($){return $?.output_format??$?.output_config?.format}function Q4($,Z,X){let z=UJ(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text"){let q=Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(q,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return J}),parsed_output:null};return Y4($,Z,X)}function Y4($,Z,X){let z=null,J=$.content.map((q)=>{if(q.type==="text"){let Q=ED(Z,q.text);if(z===null)z=Q;let Y=Object.defineProperty({...q},"parsed_output",{value:Q,enumerable:!1});return Object.defineProperty(Y,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Q},enumerable:!1})}return q});return{...$,content:J,parsed_output:z}}function ED($,Z){let X=UJ($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new R(`Failed to parse structured output: ${z}`)}}var G4=j(()=>{V0()});var jD=($)=>{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 Y="",G=!1;z=$[++Z];while(z!=='"'){if(Z===$.length){G=!0;break}if(z==="\\"){if(Z++,Z===$.length){G=!0;break}Y+=z+$[Z],z=$[++Z]}else Y+=z,z=$[++Z]}if(z=$[++Z],!G)X.push({type:"string",value:Y});continue}if(z&&/\s/.test(z)){Z++;continue}let q=/[0-9]/;if(z&&q.test(z)||z==="-"||z==="."){let Y="";if(z==="-")Y+=z,z=$[++Z];while(z&&q.test(z)||z===".")Y+=z,z=$[++Z];X.push({type:"number",value:Y});continue}let Q=/[a-z]/i;if(z&&Q.test(z)){let Y="";while(z&&Q.test(z)){if(Z===$.length)break;Y+=z,z=$[++Z]}if(Y=="true"||Y=="false"||Y==="null")X.push({type:"name",value:Y});else{Z++;continue}continue}Z++}return X},$6=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),$6($);break;case"number":let X=Z.value[Z.value.length-1];if(X==="."||X==="-")return $=$.slice(0,$.length-1),$6($);case"string":let z=$[$.length-2];if(z?.type==="delimiter")return $=$.slice(0,$.length-1),$6($);else if(z?.type==="brace"&&z.value==="{")return $=$.slice(0,$.length-1),$6($);break;case"delimiter":return $=$.slice(0,$.length-1),$6($);break}return $},bD=($)=>{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 $},xD=($)=>{let Z="";return $.map((X)=>{switch(X.type){case"string":Z+='"'+X.value+'"';break;default:Z+=X.value;break}}),Z},y2=($)=>JSON.parse(xD(bD($6(jD($)))));var U4=()=>{};var W4=j(()=>{n5()});function KJ($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function DJ($){}var O0,z$,Z6,Z8,f2,X8,z8,g2,J8,g0,q8,h2,v2,M$,u2,m2,Q8,H4,WJ,d2,V4,K4,D4,HJ,VJ="__json_buf",Y8;var BJ=j(()=>{k0();U4();e$();W4();G4();Y8=class Y8{constructor($,Z){O0.add(this),this.messages=[],this.receivedMessages=[],z$.set(this,void 0),Z6.set(this,null),this.controller=new AbortController,Z8.set(this,void 0),f2.set(this,()=>{}),X8.set(this,()=>{}),z8.set(this,void 0),g2.set(this,()=>{}),J8.set(this,()=>{}),g0.set(this,{}),q8.set(this,!1),h2.set(this,!1),v2.set(this,!1),M$.set(this,!1),u2.set(this,void 0),m2.set(this,void 0),Q8.set(this,void 0),d2.set(this,(X)=>{if(O(this,h2,!0,"f"),y0(X))X=new G0;if(X instanceof G0)return O(this,v2,!0,"f"),this._emit("abort",X);if(X instanceof R)return this._emit("error",X);if(X instanceof Error){let z=new R(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new R(String(X)))}),O(this,Z8,new Promise((X,z)=>{O(this,f2,X,"f"),O(this,X8,z,"f")}),"f"),O(this,z8,new Promise((X,z)=>{O(this,g2,X,"f"),O(this,J8,z,"f")}),"f"),K(this,Z8,"f").catch(()=>{}),K(this,z8,"f").catch(()=>{}),O(this,Z6,$,"f"),O(this,Q8,Z?.logger??console,"f")}get response(){return K(this,u2,"f")}get request_id(){return K(this,m2,"f")}async withResponse(){O(this,M$,!0,"f");let $=await K(this,Z8,"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 Y8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new Y8(Z,{logger:z});for(let q of Z.messages)J._addMessageParam(q);return O(J,Z6,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},K(this,d2,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{K(this,O0,"m",V4).call(this);let{response:q,data:Q}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(q);for await(let Y of Q)K(this,O0,"m",K4).call(this,Y);if(Q.controller.signal?.aborted)throw new G0;K(this,O0,"m",D4).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;O(this,u2,$,"f"),O(this,m2,$?.headers.get("request-id"),"f"),K(this,f2,"f").call(this,$),this._emit("connect")}get ended(){return K(this,q8,"f")}get errored(){return K(this,h2,"f")}get aborted(){return K(this,v2,"f")}abort(){this.controller.abort()}on($,Z){return(K(this,g0,"f")[$]||(K(this,g0,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=K(this,g0,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(K(this,g0,"f")[$]||(K(this,g0,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(O(this,M$,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){O(this,M$,!0,"f"),await K(this,z8,"f")}get currentMessage(){return K(this,z$,"f")}async finalMessage(){return await this.done(),K(this,O0,"m",H4).call(this)}async finalText(){return await this.done(),K(this,O0,"m",WJ).call(this)}_emit($,...Z){if(K(this,q8,"f"))return;if($==="end")O(this,q8,!0,"f"),K(this,g2,"f").call(this);let X=K(this,g0,"f")[$];if(X)K(this,g0,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!K(this,M$,"f")&&!X?.length)Promise.reject(z);K(this,X8,"f").call(this,z),K(this,J8,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!K(this,M$,"f")&&!X?.length)Promise.reject(z);K(this,X8,"f").call(this,z),K(this,J8,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",K(this,O0,"m",H4).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{K(this,O0,"m",V4).call(this),this._connected(null);let J=B0.fromReadableStream($,this.controller);for await(let q of J)K(this,O0,"m",K4).call(this,q);if(J.controller.signal?.aborted)throw new G0;K(this,O0,"m",D4).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(z$=new WeakMap,Z6=new WeakMap,Z8=new WeakMap,f2=new WeakMap,X8=new WeakMap,z8=new WeakMap,g2=new WeakMap,J8=new WeakMap,g0=new WeakMap,q8=new WeakMap,h2=new WeakMap,v2=new WeakMap,M$=new WeakMap,u2=new WeakMap,m2=new WeakMap,Q8=new WeakMap,d2=new WeakMap,O0=new WeakSet,H4=function(){if(this.receivedMessages.length===0)throw new R("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},WJ=function(){if(this.receivedMessages.length===0)throw new R("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 R("stream ended without producing a content block with type=text");return Z.join(" ")},V4=function(){if(this.ended)return;O(this,z$,void 0,"f")},K4=function(Z){if(this.ended)return;let X=K(this,O0,"m",HJ).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(KJ(z)&&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}case"compaction_delta":{if(z.type==="compaction"&&z.content)this._emit("compaction",z.content);break}default:DJ(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(Q4(X,K(this,Z6,"f"),{logger:K(this,Q8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{O(this,z$,X,"f");break}case"content_block_start":case"message_delta":break}},D4=function(){if(this.ended)throw new R("stream has ended, this shouldn't happen");let Z=K(this,z$,"f");if(!Z)throw new R("request ended without sending any chunks");return O(this,z$,void 0,"f"),Q4(Z,K(this,Z6,"f"),{logger:K(this,Q8,"f")})},HJ=function(Z){let X=K(this,z$,"f");if(Z.type==="message_start"){if(X)throw new R(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new R(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.container=Z.delta.container,X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,X.context_management=Z.context_management,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)X.usage.iterations=Z.usage.iterations;return 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")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&KJ(z)){let J=z[VJ]||"";J+=Z.delta.partial_json;let q={...z};if(Object.defineProperty(q,VJ,{value:J,enumerable:!1,writable:!0}),J)try{q.input=y2(J)}catch(Q){let Y=new R(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Q}. JSON: ${J}`);K(this,d2,"f").call(this,Y)}X.content[Z.index]=q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}case"compaction_delta":{if(z?.type==="compaction")X.content[Z.index]={...z,content:(z.content||"")+Z.delta.content};break}default:DJ(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.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 J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,q)=>Z.push({resolve:J,reject:q})).then((J)=>J?{value:J,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 B0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var X6;var c2=j(()=>{X6=class X6 extends Error{constructor($){let Z=typeof $==="string"?$:$.map((X)=>{if(X.type==="text")return X.text;return`[${X.type}]`}).join(" ");super(Z);this.name="ToolError",this.content=$}}});var NJ=1e5,LJ=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
|
|
178
|
+
${V}`)}return Q},n;var Y$=_(()=>{B0();wJ=Object.freeze(Object.create(null)),n=lB(RJ)});var q8;var L4=_(()=>{x0();I0();J8();J6();Y$();q8=class q8 extends r{list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/files",_0,{query:z,...Z,headers:j([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(n`/v1/files/${$}`,{...X,headers:j([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}download($,Z={},X){let{betas:z}=Z??{};return this._client.get(n`/v1/files/${$}/content`,{...X,headers:j([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString(),Accept:"application/binary"},X?.headers]),__binaryResponse:!0})}retrieveMetadata($,Z={},X){let{betas:z}=Z??{};return this._client.get(n`/v1/files/${$}`,{...X,headers:j([{"anthropic-beta":[...z??[],"files-api-2025-04-14"].toString()},X?.headers])})}upload($,Z){let{betas:X,...z}=$;return this._client.post("/v1/files",z6({body:z,...Z,headers:j([{"anthropic-beta":[...X??[],"files-api-2025-04-14"].toString()},OJ(z.file),Z?.headers])},this._client))}}});var Q8;var N4=_(()=>{x0();I0();Y$();Q8=class Q8 extends r{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(n`/v1/models/${$}?beta=true`,{...X,headers:j([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models?beta=true",_0,{query:z,...Z,headers:j([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var q6=_(()=>{B0()});var m2;var I4=_(()=>{m2={"claude-opus-4-20250514":8192,"claude-opus-4-0":8192,"claude-4-opus-20250514":8192,"anthropic.claude-opus-4-20250514-v1:0":8192,"claude-opus-4@20250514":8192,"claude-opus-4-1-20250805":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192}});function FJ($){return $?.output_format??$?.output_config?.format}function T4($,Z,X){let z=FJ(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text"){let q=Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return Object.defineProperty(q,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null},enumerable:!1})}return J}),parsed_output:null};return M4($,Z,X)}function M4($,Z,X){let z=null,J=$.content.map((q)=>{if(q.type==="text"){let Q=sB(Z,q.text);if(z===null)z=Q;let Y=Object.defineProperty({...q},"parsed_output",{value:Q,enumerable:!1});return Object.defineProperty(Y,"parsed",{get(){return X.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),Q},enumerable:!1})}return q});return{...$,content:J,parsed_output:z}}function sB($,Z){let X=FJ($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new F(`Failed to parse structured output: ${z}`)}}var O4=_(()=>{B0()});var rB=($)=>{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 Y="",G=!1;z=$[++Z];while(z!=='"'){if(Z===$.length){G=!0;break}if(z==="\\"){if(Z++,Z===$.length){G=!0;break}Y+=z+$[Z],z=$[++Z]}else Y+=z,z=$[++Z]}if(z=$[++Z],!G)X.push({type:"string",value:Y});continue}if(z&&/\s/.test(z)){Z++;continue}let q=/[0-9]/;if(z&&q.test(z)||z==="-"||z==="."){let Y="";if(z==="-")Y+=z,z=$[++Z];while(z&&q.test(z)||z===".")Y+=z,z=$[++Z];X.push({type:"number",value:Y});continue}let Q=/[a-z]/i;if(z&&Q.test(z)){let Y="";while(z&&Q.test(z)){if(Z===$.length)break;Y+=z,z=$[++Z]}if(Y=="true"||Y=="false"||Y==="null")X.push({type:"name",value:Y});else{Z++;continue}continue}Z++}return X},Q6=($)=>{if($.length===0)return $;let Z=$[$.length-1];switch(Z.type){case"separator":return $=$.slice(0,$.length-1),Q6($);break;case"number":let X=Z.value[Z.value.length-1];if(X==="."||X==="-")return $=$.slice(0,$.length-1),Q6($);case"string":let z=$[$.length-2];if(z?.type==="delimiter")return $=$.slice(0,$.length-1),Q6($);else if(z?.type==="brace"&&z.value==="{")return $=$.slice(0,$.length-1),Q6($);break;case"delimiter":return $=$.slice(0,$.length-1),Q6($);break}return $},aB=($)=>{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 $},oB=($)=>{let Z="";return $.map((X)=>{switch(X.type){case"string":Z+='"'+X.value+'"';break;default:Z+=X.value;break}}),Z},d2=($)=>JSON.parse(oB(aB(Q6(rB($)))));var w4=()=>{};var R4=_(()=>{Q4()});function CJ($){return $.type==="tool_use"||$.type==="server_tool_use"||$.type==="mcp_tool_use"}function EJ($){}var w0,G$,Y6,Y8,c2,G8,U8,p2,W8,d0,H8,l2,i2,F$,n2,s2,V8,F4,AJ,r2,A4,P4,_4,PJ,_J="__json_buf",K8;var SJ=_(()=>{v0();w4();q6();R4();O4();K8=class K8{constructor($,Z){w0.add(this),this.messages=[],this.receivedMessages=[],G$.set(this,void 0),Y6.set(this,null),this.controller=new AbortController,Y8.set(this,void 0),c2.set(this,()=>{}),G8.set(this,()=>{}),U8.set(this,void 0),p2.set(this,()=>{}),W8.set(this,()=>{}),d0.set(this,{}),H8.set(this,!1),l2.set(this,!1),i2.set(this,!1),F$.set(this,!1),n2.set(this,void 0),s2.set(this,void 0),V8.set(this,void 0),r2.set(this,(X)=>{if(M(this,l2,!0,"f"),u0(X))X=new W0;if(X instanceof W0)return M(this,i2,!0,"f"),this._emit("abort",X);if(X instanceof F)return this._emit("error",X);if(X instanceof Error){let z=new F(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new F(String(X)))}),M(this,Y8,new Promise((X,z)=>{M(this,c2,X,"f"),M(this,G8,z,"f")}),"f"),M(this,U8,new Promise((X,z)=>{M(this,p2,X,"f"),M(this,W8,z,"f")}),"f"),K(this,Y8,"f").catch(()=>{}),K(this,U8,"f").catch(()=>{}),M(this,Y6,$,"f"),M(this,V8,Z?.logger??console,"f")}get response(){return K(this,n2,"f")}get request_id(){return K(this,s2,"f")}async withResponse(){M(this,F$,!0,"f");let $=await K(this,Y8,"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 K8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new K8(Z,{logger:z});for(let q of Z.messages)J._addMessageParam(q);return M(J,Y6,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},K(this,r2,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{K(this,w0,"m",A4).call(this);let{response:q,data:Q}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(q);for await(let Y of Q)K(this,w0,"m",P4).call(this,Y);if(Q.controller.signal?.aborted)throw new W0;K(this,w0,"m",_4).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;M(this,n2,$,"f"),M(this,s2,$?.headers.get("request-id"),"f"),K(this,c2,"f").call(this,$),this._emit("connect")}get ended(){return K(this,H8,"f")}get errored(){return K(this,l2,"f")}get aborted(){return K(this,i2,"f")}abort(){this.controller.abort()}on($,Z){return(K(this,d0,"f")[$]||(K(this,d0,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=K(this,d0,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(K(this,d0,"f")[$]||(K(this,d0,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(M(this,F$,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){M(this,F$,!0,"f"),await K(this,U8,"f")}get currentMessage(){return K(this,G$,"f")}async finalMessage(){return await this.done(),K(this,w0,"m",F4).call(this)}async finalText(){return await this.done(),K(this,w0,"m",AJ).call(this)}_emit($,...Z){if(K(this,H8,"f"))return;if($==="end")M(this,H8,!0,"f"),K(this,p2,"f").call(this);let X=K(this,d0,"f")[$];if(X)K(this,d0,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!K(this,F$,"f")&&!X?.length)Promise.reject(z);K(this,G8,"f").call(this,z),K(this,W8,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!K(this,F$,"f")&&!X?.length)Promise.reject(z);K(this,G8,"f").call(this,z),K(this,W8,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",K(this,w0,"m",F4).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{K(this,w0,"m",A4).call(this),this._connected(null);let J=N0.fromReadableStream($,this.controller);for await(let q of J)K(this,w0,"m",P4).call(this,q);if(J.controller.signal?.aborted)throw new W0;K(this,w0,"m",_4).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(G$=new WeakMap,Y6=new WeakMap,Y8=new WeakMap,c2=new WeakMap,G8=new WeakMap,U8=new WeakMap,p2=new WeakMap,W8=new WeakMap,d0=new WeakMap,H8=new WeakMap,l2=new WeakMap,i2=new WeakMap,F$=new WeakMap,n2=new WeakMap,s2=new WeakMap,V8=new WeakMap,r2=new WeakMap,w0=new WeakSet,F4=function(){if(this.receivedMessages.length===0)throw new F("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},AJ=function(){if(this.receivedMessages.length===0)throw new F("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 F("stream ended without producing a content block with type=text");return Z.join(" ")},A4=function(){if(this.ended)return;M(this,G$,void 0,"f")},P4=function(Z){if(this.ended)return;let X=K(this,w0,"m",PJ).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(CJ(z)&&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}case"compaction_delta":{if(z.type==="compaction"&&z.content)this._emit("compaction",z.content);break}default:EJ(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(T4(X,K(this,Y6,"f"),{logger:K(this,V8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{M(this,G$,X,"f");break}case"content_block_start":case"message_delta":break}},_4=function(){if(this.ended)throw new F("stream has ended, this shouldn't happen");let Z=K(this,G$,"f");if(!Z)throw new F("request ended without sending any chunks");return M(this,G$,void 0,"f"),T4(Z,K(this,Y6,"f"),{logger:K(this,V8,"f")})},PJ=function(Z){let X=K(this,G$,"f");if(Z.type==="message_start"){if(X)throw new F(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new F(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.container=Z.delta.container,X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,X.context_management=Z.context_management,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;if(Z.usage.iterations!=null)X.usage.iterations=Z.usage.iterations;return 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")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&CJ(z)){let J=z[_J]||"";J+=Z.delta.partial_json;let q={...z};if(Object.defineProperty(q,_J,{value:J,enumerable:!1,writable:!0}),J)try{q.input=d2(J)}catch(Q){let Y=new F(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${Q}. JSON: ${J}`);K(this,r2,"f").call(this,Y)}X.content[Z.index]=q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}case"compaction_delta":{if(z?.type==="compaction")X.content[Z.index]={...z,content:(z.content||"")+Z.delta.content};break}default:EJ(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.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 J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,q)=>Z.push({resolve:J,reject:q})).then((J)=>J?{value:J,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 N0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var G6;var a2=_(()=>{G6=class G6 extends Error{constructor($){let Z=typeof $==="string"?$:$.map((X)=>{if(X.type==="text")return X.text;return`[${X.type}]`}).join(" ");super(Z);this.name="ToolError",this.content=$}}});var jJ=1e5,bJ=`You have been working on the task described above but have not yet completed it. Write a continuation summary that will allow you (or another instance of yourself) to resume work efficiently in a future context window where the conversation history will be replaced with this summary. Your summary should be structured, concise, and actionable. Include:
|
|
174
179
|
1. Task Overview
|
|
175
180
|
The user's core request and success criteria
|
|
176
181
|
Any clarifications or constraints they specified
|
|
@@ -192,69 +197,65 @@ User preferences or style requirements
|
|
|
192
197
|
Domain-specific details that aren't obvious
|
|
193
198
|
Any promises made to the user
|
|
194
199
|
Be concise but complete—err on the side of including information that would prevent duplicate work or repeated mistakes. Write in a way that enables immediate resumption of the task.
|
|
195
|
-
Wrap your summary in <summary></summary> tags.`;function
|
|
196
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(J.model in fD&&J.thinking&&J.thinking.type==="enabled")console.warn(`Using Claude with ${J.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let q=this._client._options.timeout;if(!J.stream&&q==null){let Y=k2[J.model]??void 0;q=this._client.calculateNonstreamingTimeout(J.max_tokens,Y)}let Q=x2(J.tools,J.messages);return this._client.post("/v1/messages?beta=true",{body:J,timeout:q??600000,...Z,headers:E([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Q,Z?.headers]),stream:X.stream??!1})}parse($,Z){return Z={...Z,headers:E([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((X)=>Y4(X,$,{logger:this._client.logger??console}))}stream($,Z){return Y8.createMessage(this,$,Z)}countTokens($,Z){let X=OJ($),{betas:z,...J}=X;return this._client.post("/v1/messages/count_tokens?beta=true",{body:J,...Z,headers:E([{"anthropic-beta":[...z??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new H8(this._client,$,Z)}};q$.Batches=V8;q$.BetaToolRunner=H8;q$.ToolError=X6});var K8;var M4=j(()=>{S0();N0();t$();X$();K8=class K8 extends n{create($,Z={},X){let{betas:z,...J}=Z??{};return this._client.post(l`/v1/skills/${$}/versions?beta=true`,o$({body:J,...X,headers:E([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])},this._client))}retrieve($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.get(l`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:E([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(l`/v1/skills/${$}/versions?beta=true`,s6,{query:J,...X,headers:E([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}delete($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.delete(l`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:E([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}}});var q6;var O4=j(()=>{M4();M4();S0();N0();t$();X$();q6=class q6 extends n{constructor(){super(...arguments);this.versions=new K8(this._client)}create($={},Z){let{betas:X,...z}=$??{};return this._client.post("/v1/skills?beta=true",o$({body:z,...Z,headers:E([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(l`/v1/skills/${$}?beta=true`,{...X,headers:E([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/skills?beta=true",s6,{query:z,...Z,headers:E([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(l`/v1/skills/${$}?beta=true`,{...X,headers:E([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}};q6.Versions=K8});var E0;var w4=j(()=>{z4();z4();J4();J4();T4();T4();O4();O4();E0=class E0 extends n{constructor(){super(...arguments);this.models=new $8(this._client),this.messages=new q$(this._client),this.files=new e6(this._client),this.skills=new q6(this._client)}};E0.Models=$8;E0.Messages=q$;E0.Files=e6;E0.Skills=q6});var Q6;var F4=j(()=>{N0();Q6=class Q6 extends n{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/complete",{body:z,timeout:this._client._options.timeout??600000,...Z,headers:E([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function wJ($){return $?.output_config?.format}function R4($,Z,X){let z=wJ(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text")return Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return J}),parsed_output:null};return A4($,Z,X)}function A4($,Z,X){let z=null,J=$.content.map((q)=>{if(q.type==="text"){let Q=uD(Z,q.text);if(z===null)z=Q;return Object.defineProperty({...q},"parsed_output",{value:Q,enumerable:!1})}return q});return{...$,content:J,parsed_output:z}}function uD($,Z){let X=wJ($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new R(`Failed to parse structured output: ${z}`)}}var P4=j(()=>{V0()});function PJ($){return $.type==="tool_use"||$.type==="server_tool_use"}function _J($){}var w0,Q$,Y6,D8,p2,B8,N8,l2,L8,v0,I8,i2,n2,w$,s2,r2,T8,_4,FJ,C4,S4,E4,j4,RJ,AJ="__json_buf",M8;var CJ=j(()=>{k0();e$();W4();U4();P4();M8=class M8{constructor($,Z){w0.add(this),this.messages=[],this.receivedMessages=[],Q$.set(this,void 0),Y6.set(this,null),this.controller=new AbortController,D8.set(this,void 0),p2.set(this,()=>{}),B8.set(this,()=>{}),N8.set(this,void 0),l2.set(this,()=>{}),L8.set(this,()=>{}),v0.set(this,{}),I8.set(this,!1),i2.set(this,!1),n2.set(this,!1),w$.set(this,!1),s2.set(this,void 0),r2.set(this,void 0),T8.set(this,void 0),C4.set(this,(X)=>{if(O(this,i2,!0,"f"),y0(X))X=new G0;if(X instanceof G0)return O(this,n2,!0,"f"),this._emit("abort",X);if(X instanceof R)return this._emit("error",X);if(X instanceof Error){let z=new R(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new R(String(X)))}),O(this,D8,new Promise((X,z)=>{O(this,p2,X,"f"),O(this,B8,z,"f")}),"f"),O(this,N8,new Promise((X,z)=>{O(this,l2,X,"f"),O(this,L8,z,"f")}),"f"),K(this,D8,"f").catch(()=>{}),K(this,N8,"f").catch(()=>{}),O(this,Y6,$,"f"),O(this,T8,Z?.logger??console,"f")}get response(){return K(this,s2,"f")}get request_id(){return K(this,r2,"f")}async withResponse(){O(this,w$,!0,"f");let $=await K(this,D8,"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 M8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new M8(Z,{logger:z});for(let q of Z.messages)J._addMessageParam(q);return O(J,Y6,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},K(this,C4,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{K(this,w0,"m",S4).call(this);let{response:q,data:Q}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(q);for await(let Y of Q)K(this,w0,"m",E4).call(this,Y);if(Q.controller.signal?.aborted)throw new G0;K(this,w0,"m",j4).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;O(this,s2,$,"f"),O(this,r2,$?.headers.get("request-id"),"f"),K(this,p2,"f").call(this,$),this._emit("connect")}get ended(){return K(this,I8,"f")}get errored(){return K(this,i2,"f")}get aborted(){return K(this,n2,"f")}abort(){this.controller.abort()}on($,Z){return(K(this,v0,"f")[$]||(K(this,v0,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=K(this,v0,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(K(this,v0,"f")[$]||(K(this,v0,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(O(this,w$,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){O(this,w$,!0,"f"),await K(this,N8,"f")}get currentMessage(){return K(this,Q$,"f")}async finalMessage(){return await this.done(),K(this,w0,"m",_4).call(this)}async finalText(){return await this.done(),K(this,w0,"m",FJ).call(this)}_emit($,...Z){if(K(this,I8,"f"))return;if($==="end")O(this,I8,!0,"f"),K(this,l2,"f").call(this);let X=K(this,v0,"f")[$];if(X)K(this,v0,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!K(this,w$,"f")&&!X?.length)Promise.reject(z);K(this,B8,"f").call(this,z),K(this,L8,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!K(this,w$,"f")&&!X?.length)Promise.reject(z);K(this,B8,"f").call(this,z),K(this,L8,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",K(this,w0,"m",_4).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{K(this,w0,"m",S4).call(this),this._connected(null);let J=B0.fromReadableStream($,this.controller);for await(let q of J)K(this,w0,"m",E4).call(this,q);if(J.controller.signal?.aborted)throw new G0;K(this,w0,"m",j4).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(Q$=new WeakMap,Y6=new WeakMap,D8=new WeakMap,p2=new WeakMap,B8=new WeakMap,N8=new WeakMap,l2=new WeakMap,L8=new WeakMap,v0=new WeakMap,I8=new WeakMap,i2=new WeakMap,n2=new WeakMap,w$=new WeakMap,s2=new WeakMap,r2=new WeakMap,T8=new WeakMap,C4=new WeakMap,w0=new WeakSet,_4=function(){if(this.receivedMessages.length===0)throw new R("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},FJ=function(){if(this.receivedMessages.length===0)throw new R("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 R("stream ended without producing a content block with type=text");return Z.join(" ")},S4=function(){if(this.ended)return;O(this,Q$,void 0,"f")},E4=function(Z){if(this.ended)return;let X=K(this,w0,"m",RJ).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(PJ(z)&&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:_J(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(R4(X,K(this,Y6,"f"),{logger:K(this,T8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{O(this,Q$,X,"f");break}case"content_block_start":case"message_delta":break}},j4=function(){if(this.ended)throw new R("stream has ended, this shouldn't happen");let Z=K(this,Q$,"f");if(!Z)throw new R("request ended without sending any chunks");return O(this,Q$,void 0,"f"),R4(Z,K(this,Y6,"f"),{logger:K(this,T8,"f")})},RJ=function(Z){let X=K(this,Q$,"f");if(Z.type==="message_start"){if(X)throw new R(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new R(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;return 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")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&PJ(z)){let J=z[AJ]||"";J+=Z.delta.partial_json;let q={...z};if(Object.defineProperty(q,AJ,{value:J,enumerable:!1,writable:!0}),J)q.input=y2(J);X.content[Z.index]=q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}default:_J(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.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 J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,q)=>Z.push({resolve:J,reject:q})).then((J)=>J?{value:J,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 B0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var O8;var b4=j(()=>{S0();N0();L4();e$();X$();O8=class O8 extends n{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(l`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",A0,{query:$,...Z})}delete($,Z){return this._client.delete(l`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(l`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let X=await this.retrieve($);if(!X.results_url)throw new R(`No batch \`results_url\`; Has it finished processing? ${X.processing_status} - ${X.id}`);return this._client.get(X.results_url,{...Z,headers:E([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((z,J)=>J6.fromResponse(J.response,J.controller))}}});var F$,SJ,dD;var x4=j(()=>{N0();t6();CJ();P4();b4();b4();q4();F$=class F$ extends n{constructor(){super(...arguments);this.batches=new O8(this._client)}create($,Z){if($.model in SJ)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${SJ[$.model]}
|
|
197
|
-
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if($.model in
|
|
200
|
+
Wrap your summary in <summary></summary> tags.`;function kJ(){let $,Z;return{promise:new Promise((z,J)=>{$=z,Z=J}),resolve:$,reject:Z}}async function tB($,Z=$.messages.at(-1)){if(!Z||Z.role!=="assistant"||!Z.content||typeof Z.content==="string")return null;let X=Z.content.filter((J)=>J.type==="tool_use");if(X.length===0)return null;return{role:"user",content:await Promise.all(X.map(async(J)=>{let q=$.tools.find((Q)=>("name"in Q?Q.name:Q.mcp_server_name)===J.name);if(!q||!("run"in q))return{type:"tool_result",tool_use_id:J.id,content:`Error: Tool '${J.name}' not found`,is_error:!0};try{let Q=J.input;if("parse"in q&&q.parse)Q=q.parse(Q);let Y=await q.run(Q);return{type:"tool_result",tool_use_id:J.id,content:Y}}catch(Q){return{type:"tool_result",tool_use_id:J.id,content:Q instanceof G6?Q.content:`Error: ${Q instanceof Error?Q.message:String(Q)}`,is_error:!0}}}))}}var B8,U6,A$,Y0,D8,T0,c0,U$,L8,xJ,C4,N8;var E4=_(()=>{v0();a2();B0();I0();J8();N8=class N8{constructor($,Z,X){B8.add(this),this.client=$,U6.set(this,!1),A$.set(this,!1),Y0.set(this,void 0),D8.set(this,void 0),T0.set(this,void 0),c0.set(this,void 0),U$.set(this,void 0),L8.set(this,0),M(this,Y0,{params:{...Z,messages:structuredClone(Z.messages)}},"f");let J=["BetaToolRunner",...D4(Z.tools,Z.messages)].join(", ");M(this,D8,{...X,headers:j([{"x-stainless-helper":J},X?.headers])},"f"),M(this,U$,kJ(),"f")}async*[(U6=new WeakMap,A$=new WeakMap,Y0=new WeakMap,D8=new WeakMap,T0=new WeakMap,c0=new WeakMap,U$=new WeakMap,L8=new WeakMap,B8=new WeakSet,xJ=async function(){let Z=K(this,Y0,"f").params.compactionControl;if(!Z||!Z.enabled)return!1;let X=0;if(K(this,T0,"f")!==void 0)try{let G=await K(this,T0,"f");X=G.usage.input_tokens+(G.usage.cache_creation_input_tokens??0)+(G.usage.cache_read_input_tokens??0)+G.usage.output_tokens}catch{return!1}let z=Z.contextTokenThreshold??jJ;if(X<z)return!1;let J=Z.model??K(this,Y0,"f").params.model,q=Z.summaryPrompt??bJ,Q=K(this,Y0,"f").params.messages;if(Q[Q.length-1].role==="assistant"){let G=Q[Q.length-1];if(Array.isArray(G.content)){let U=G.content.filter((W)=>W.type!=="tool_use");if(U.length===0)Q.pop();else G.content=U}}let Y=await this.client.beta.messages.create({model:J,messages:[...Q,{role:"user",content:[{type:"text",text:q}]}],max_tokens:K(this,Y0,"f").params.max_tokens},{headers:{"x-stainless-helper":"compaction"}});if(Y.content[0]?.type!=="text")throw new F("Expected text response for compaction");return K(this,Y0,"f").params.messages=[{role:"user",content:Y.content}],!0},Symbol.asyncIterator)](){var $;if(K(this,U6,"f"))throw new F("Cannot iterate over a consumed stream");M(this,U6,!0,"f"),M(this,A$,!0,"f"),M(this,c0,void 0,"f");try{while(!0){let Z;try{if(K(this,Y0,"f").params.max_iterations&&K(this,L8,"f")>=K(this,Y0,"f").params.max_iterations)break;M(this,A$,!1,"f"),M(this,c0,void 0,"f"),M(this,L8,($=K(this,L8,"f"),$++,$),"f"),M(this,T0,void 0,"f");let{max_iterations:X,compactionControl:z,...J}=K(this,Y0,"f").params;if(J.stream)Z=this.client.beta.messages.stream({...J},K(this,D8,"f")),M(this,T0,Z.finalMessage(),"f"),K(this,T0,"f").catch(()=>{}),yield Z;else M(this,T0,this.client.beta.messages.create({...J,stream:!1},K(this,D8,"f")),"f"),yield K(this,T0,"f");if(!await K(this,B8,"m",xJ).call(this)){if(!K(this,A$,"f")){let{role:Y,content:G}=await K(this,T0,"f");K(this,Y0,"f").params.messages.push({role:Y,content:G})}let Q=await K(this,B8,"m",C4).call(this,K(this,Y0,"f").params.messages.at(-1));if(Q)K(this,Y0,"f").params.messages.push(Q);else if(!K(this,A$,"f"))break}}finally{if(Z)Z.abort()}}if(!K(this,T0,"f"))throw new F("ToolRunner concluded without a message from the server");K(this,U$,"f").resolve(await K(this,T0,"f"))}catch(Z){throw M(this,U6,!1,"f"),K(this,U$,"f").promise.catch(()=>{}),K(this,U$,"f").reject(Z),M(this,U$,kJ(),"f"),Z}}setMessagesParams($){if(typeof $==="function")K(this,Y0,"f").params=$(K(this,Y0,"f").params);else K(this,Y0,"f").params=$;M(this,A$,!0,"f"),M(this,c0,void 0,"f")}async generateToolResponse(){let $=await K(this,T0,"f")??this.params.messages.at(-1);if(!$)return null;return K(this,B8,"m",C4).call(this,$)}done(){return K(this,U$,"f").promise}async runUntilDone(){if(!K(this,U6,"f"))for await(let $ of this);return this.done()}get params(){return K(this,Y0,"f").params}pushMessages(...$){this.setMessagesParams((Z)=>({...Z,messages:[...Z.messages,...$]}))}then($,Z){return this.runUntilDone().then($,Z)}};C4=async function(Z){if(K(this,c0,"f")!==void 0)return K(this,c0,"f");return M(this,c0,tB(K(this,Y0,"f").params,Z),"f"),K(this,c0,"f")}});var W6;var S4=_(()=>{B0();J4();W6=class W6{constructor($,Z){this.iterator=$,this.controller=Z}async*decoder(){let $=new q$;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){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new F("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new F("Attempted to iterate over a response with no body")}return new W6(s6($.body),Z)}}});var I8;var j4=_(()=>{x0();I0();S4();q6();Y$();I8=class I8 extends r{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/messages/batches?beta=true",{body:z,...Z,headers:j([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(n`/v1/messages/batches/${$}?beta=true`,{...X,headers:j([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/messages/batches?beta=true",_0,{query:z,...Z,headers:j([{"anthropic-beta":[...X??[],"message-batches-2024-09-24"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(n`/v1/messages/batches/${$}?beta=true`,{...X,headers:j([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}cancel($,Z={},X){let{betas:z}=Z??{};return this._client.post(n`/v1/messages/batches/${$}/cancel?beta=true`,{...X,headers:j([{"anthropic-beta":[...z??[],"message-batches-2024-09-24"].toString()},X?.headers])})}async results($,Z={},X){let z=await this.retrieve($);if(!z.results_url)throw new F(`No batch \`results_url\`; Has it finished processing? ${z.processing_status} - ${z.id}`);let{betas:J}=Z??{};return this._client.get(z.results_url,{...X,headers:j([{"anthropic-beta":[...J??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary"},X?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((q,Q)=>W6.fromResponse(Q.response,Q.controller))}}});function fJ($){if(!$.output_format)return $;if($.output_config?.format)throw new F("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).");let{output_format:Z,...X}=$;return{...X,output_config:{...$.output_config,format:Z}}}var yJ,$D,W$;var b4=_(()=>{q6();I4();I0();J8();O4();SJ();E4();a2();j4();j4();E4();a2();yJ={"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-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026"},$D=["claude-opus-4-6"];W$=class W$ extends r{constructor(){super(...arguments);this.batches=new I8(this._client)}create($,Z){let X=fJ($),{betas:z,...J}=X;if(J.model in yJ)console.warn(`The model '${J.model}' is deprecated and will reach end-of-life on ${yJ[J.model]}
|
|
201
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if(J.model in $D&&J.thinking&&J.thinking.type==="enabled")console.warn(`Using Claude with ${J.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let q=this._client._options.timeout;if(!J.stream&&q==null){let Y=m2[J.model]??void 0;q=this._client.calculateNonstreamingTimeout(J.max_tokens,Y)}let Q=u2(J.tools,J.messages);return this._client.post("/v1/messages?beta=true",{body:J,timeout:q??600000,...Z,headers:j([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},Q,Z?.headers]),stream:X.stream??!1})}parse($,Z){return Z={...Z,headers:j([{"anthropic-beta":[...$.betas??[],"structured-outputs-2025-12-15"].toString()},Z?.headers])},this.create($,Z).then((X)=>M4(X,$,{logger:this._client.logger??console}))}stream($,Z){return K8.createMessage(this,$,Z)}countTokens($,Z){let X=fJ($),{betas:z,...J}=X;return this._client.post("/v1/messages/count_tokens?beta=true",{body:J,...Z,headers:j([{"anthropic-beta":[...z??[],"token-counting-2024-11-01"].toString()},Z?.headers])})}toolRunner($,Z){return new N8(this._client,$,Z)}};W$.Batches=I8;W$.BetaToolRunner=N8;W$.ToolError=G6});var T8;var x4=_(()=>{x0();I0();J6();Y$();T8=class T8 extends r{create($,Z={},X){let{betas:z,...J}=Z??{};return this._client.post(n`/v1/skills/${$}/versions?beta=true`,z6({body:J,...X,headers:j([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])},this._client))}retrieve($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.get(n`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:j([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}list($,Z={},X){let{betas:z,...J}=Z??{};return this._client.getAPIList(n`/v1/skills/${$}/versions?beta=true`,$8,{query:J,...X,headers:j([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}delete($,Z,X){let{skill_id:z,betas:J}=Z;return this._client.delete(n`/v1/skills/${z}/versions/${$}?beta=true`,{...X,headers:j([{"anthropic-beta":[...J??[],"skills-2025-10-02"].toString()},X?.headers])})}}});var H6;var k4=_(()=>{x4();x4();x0();I0();J6();Y$();H6=class H6 extends r{constructor(){super(...arguments);this.versions=new T8(this._client)}create($={},Z){let{betas:X,...z}=$??{};return this._client.post("/v1/skills?beta=true",z6({body:z,...Z,headers:j([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])},this._client,!1))}retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(n`/v1/skills/${$}?beta=true`,{...X,headers:j([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/skills?beta=true",$8,{query:z,...Z,headers:j([{"anthropic-beta":[...X??[],"skills-2025-10-02"].toString()},Z?.headers])})}delete($,Z={},X){let{betas:z}=Z??{};return this._client.delete(n`/v1/skills/${$}?beta=true`,{...X,headers:j([{"anthropic-beta":[...z??[],"skills-2025-10-02"].toString()},X?.headers])})}};H6.Versions=T8});var k0;var y4=_(()=>{L4();L4();N4();N4();b4();b4();k4();k4();k0=class k0 extends r{constructor(){super(...arguments);this.models=new Q8(this._client),this.messages=new W$(this._client),this.files=new q8(this._client),this.skills=new H6(this._client)}};k0.Models=Q8;k0.Messages=W$;k0.Files=q8;k0.Skills=H6});var V6;var f4=_(()=>{I0();V6=class V6 extends r{create($,Z){let{betas:X,...z}=$;return this._client.post("/v1/complete",{body:z,timeout:this._client._options.timeout??600000,...Z,headers:j([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers]),stream:$.stream??!1})}}});function gJ($){return $?.output_config?.format}function g4($,Z,X){let z=gJ(Z);if(!Z||!("parse"in(z??{})))return{...$,content:$.content.map((J)=>{if(J.type==="text")return Object.defineProperty({...J},"parsed_output",{value:null,enumerable:!1});return J}),parsed_output:null};return h4($,Z,X)}function h4($,Z,X){let z=null,J=$.content.map((q)=>{if(q.type==="text"){let Q=JD(Z,q.text);if(z===null)z=Q;return Object.defineProperty({...q},"parsed_output",{value:Q,enumerable:!1})}return q});return{...$,content:J,parsed_output:z}}function JD($,Z){let X=gJ($);if(X?.type!=="json_schema")return null;try{if("parse"in X)return X.parse(Z);return JSON.parse(Z)}catch(z){throw new F(`Failed to parse structured output: ${z}`)}}var v4=_(()=>{B0()});function mJ($){return $.type==="tool_use"||$.type==="server_tool_use"}function dJ($){}var R0,H$,K6,M8,o2,O8,w8,t2,R8,p0,F8,e2,$Z,P$,ZZ,XZ,A8,u4,hJ,m4,d4,c4,p4,vJ,uJ="__json_buf",P8;var cJ=_(()=>{v0();q6();R4();w4();v4();P8=class P8{constructor($,Z){R0.add(this),this.messages=[],this.receivedMessages=[],H$.set(this,void 0),K6.set(this,null),this.controller=new AbortController,M8.set(this,void 0),o2.set(this,()=>{}),O8.set(this,()=>{}),w8.set(this,void 0),t2.set(this,()=>{}),R8.set(this,()=>{}),p0.set(this,{}),F8.set(this,!1),e2.set(this,!1),$Z.set(this,!1),P$.set(this,!1),ZZ.set(this,void 0),XZ.set(this,void 0),A8.set(this,void 0),m4.set(this,(X)=>{if(M(this,e2,!0,"f"),u0(X))X=new W0;if(X instanceof W0)return M(this,$Z,!0,"f"),this._emit("abort",X);if(X instanceof F)return this._emit("error",X);if(X instanceof Error){let z=new F(X.message);return z.cause=X,this._emit("error",z)}return this._emit("error",new F(String(X)))}),M(this,M8,new Promise((X,z)=>{M(this,o2,X,"f"),M(this,O8,z,"f")}),"f"),M(this,w8,new Promise((X,z)=>{M(this,t2,X,"f"),M(this,R8,z,"f")}),"f"),K(this,M8,"f").catch(()=>{}),K(this,w8,"f").catch(()=>{}),M(this,K6,$,"f"),M(this,A8,Z?.logger??console,"f")}get response(){return K(this,ZZ,"f")}get request_id(){return K(this,XZ,"f")}async withResponse(){M(this,P$,!0,"f");let $=await K(this,M8,"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 P8(null);return Z._run(()=>Z._fromReadableStream($)),Z}static createMessage($,Z,X,{logger:z}={}){let J=new P8(Z,{logger:z});for(let q of Z.messages)J._addMessageParam(q);return M(J,K6,{...Z,stream:!0},"f"),J._run(()=>J._createMessage($,{...Z,stream:!0},{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}_run($){$().then(()=>{this._emitFinal(),this._emit("end")},K(this,m4,"f"))}_addMessageParam($){this.messages.push($)}_addMessage($,Z=!0){if(this.receivedMessages.push($),Z)this._emit("message",$)}async _createMessage($,Z,X){let z=X?.signal,J;if(z){if(z.aborted)this.controller.abort();J=this.controller.abort.bind(this.controller),z.addEventListener("abort",J)}try{K(this,R0,"m",d4).call(this);let{response:q,data:Q}=await $.create({...Z,stream:!0},{...X,signal:this.controller.signal}).withResponse();this._connected(q);for await(let Y of Q)K(this,R0,"m",c4).call(this,Y);if(Q.controller.signal?.aborted)throw new W0;K(this,R0,"m",p4).call(this)}finally{if(z&&J)z.removeEventListener("abort",J)}}_connected($){if(this.ended)return;M(this,ZZ,$,"f"),M(this,XZ,$?.headers.get("request-id"),"f"),K(this,o2,"f").call(this,$),this._emit("connect")}get ended(){return K(this,F8,"f")}get errored(){return K(this,e2,"f")}get aborted(){return K(this,$Z,"f")}abort(){this.controller.abort()}on($,Z){return(K(this,p0,"f")[$]||(K(this,p0,"f")[$]=[])).push({listener:Z}),this}off($,Z){let X=K(this,p0,"f")[$];if(!X)return this;let z=X.findIndex((J)=>J.listener===Z);if(z>=0)X.splice(z,1);return this}once($,Z){return(K(this,p0,"f")[$]||(K(this,p0,"f")[$]=[])).push({listener:Z,once:!0}),this}emitted($){return new Promise((Z,X)=>{if(M(this,P$,!0,"f"),$!=="error")this.once("error",X);this.once($,Z)})}async done(){M(this,P$,!0,"f"),await K(this,w8,"f")}get currentMessage(){return K(this,H$,"f")}async finalMessage(){return await this.done(),K(this,R0,"m",u4).call(this)}async finalText(){return await this.done(),K(this,R0,"m",hJ).call(this)}_emit($,...Z){if(K(this,F8,"f"))return;if($==="end")M(this,F8,!0,"f"),K(this,t2,"f").call(this);let X=K(this,p0,"f")[$];if(X)K(this,p0,"f")[$]=X.filter((z)=>!z.once),X.forEach(({listener:z})=>z(...Z));if($==="abort"){let z=Z[0];if(!K(this,P$,"f")&&!X?.length)Promise.reject(z);K(this,O8,"f").call(this,z),K(this,R8,"f").call(this,z),this._emit("end");return}if($==="error"){let z=Z[0];if(!K(this,P$,"f")&&!X?.length)Promise.reject(z);K(this,O8,"f").call(this,z),K(this,R8,"f").call(this,z),this._emit("end")}}_emitFinal(){if(this.receivedMessages.at(-1))this._emit("finalMessage",K(this,R0,"m",u4).call(this))}async _fromReadableStream($,Z){let X=Z?.signal,z;if(X){if(X.aborted)this.controller.abort();z=this.controller.abort.bind(this.controller),X.addEventListener("abort",z)}try{K(this,R0,"m",d4).call(this),this._connected(null);let J=N0.fromReadableStream($,this.controller);for await(let q of J)K(this,R0,"m",c4).call(this,q);if(J.controller.signal?.aborted)throw new W0;K(this,R0,"m",p4).call(this)}finally{if(X&&z)X.removeEventListener("abort",z)}}[(H$=new WeakMap,K6=new WeakMap,M8=new WeakMap,o2=new WeakMap,O8=new WeakMap,w8=new WeakMap,t2=new WeakMap,R8=new WeakMap,p0=new WeakMap,F8=new WeakMap,e2=new WeakMap,$Z=new WeakMap,P$=new WeakMap,ZZ=new WeakMap,XZ=new WeakMap,A8=new WeakMap,m4=new WeakMap,R0=new WeakSet,u4=function(){if(this.receivedMessages.length===0)throw new F("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},hJ=function(){if(this.receivedMessages.length===0)throw new F("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 F("stream ended without producing a content block with type=text");return Z.join(" ")},d4=function(){if(this.ended)return;M(this,H$,void 0,"f")},c4=function(Z){if(this.ended)return;let X=K(this,R0,"m",vJ).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(mJ(z)&&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:dJ(Z.delta)}break}case"message_stop":{this._addMessageParam(X),this._addMessage(g4(X,K(this,K6,"f"),{logger:K(this,A8,"f")}),!0);break}case"content_block_stop":{this._emit("contentBlock",X.content.at(-1));break}case"message_start":{M(this,H$,X,"f");break}case"content_block_start":case"message_delta":break}},p4=function(){if(this.ended)throw new F("stream has ended, this shouldn't happen");let Z=K(this,H$,"f");if(!Z)throw new F("request ended without sending any chunks");return M(this,H$,void 0,"f"),g4(Z,K(this,K6,"f"),{logger:K(this,A8,"f")})},vJ=function(Z){let X=K(this,H$,"f");if(Z.type==="message_start"){if(X)throw new F(`Unexpected event order, got ${Z.type} before receiving "message_stop"`);return Z.message}if(!X)throw new F(`Unexpected event order, got ${Z.type} before "message_start"`);switch(Z.type){case"message_stop":return X;case"message_delta":if(X.stop_reason=Z.delta.stop_reason,X.stop_sequence=Z.delta.stop_sequence,X.usage.output_tokens=Z.usage.output_tokens,Z.usage.input_tokens!=null)X.usage.input_tokens=Z.usage.input_tokens;if(Z.usage.cache_creation_input_tokens!=null)X.usage.cache_creation_input_tokens=Z.usage.cache_creation_input_tokens;if(Z.usage.cache_read_input_tokens!=null)X.usage.cache_read_input_tokens=Z.usage.cache_read_input_tokens;if(Z.usage.server_tool_use!=null)X.usage.server_tool_use=Z.usage.server_tool_use;return 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")X.content[Z.index]={...z,text:(z.text||"")+Z.delta.text};break}case"citations_delta":{if(z?.type==="text")X.content[Z.index]={...z,citations:[...z.citations??[],Z.delta.citation]};break}case"input_json_delta":{if(z&&mJ(z)){let J=z[uJ]||"";J+=Z.delta.partial_json;let q={...z};if(Object.defineProperty(q,uJ,{value:J,enumerable:!1,writable:!0}),J)q.input=d2(J);X.content[Z.index]=q}break}case"thinking_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,thinking:z.thinking+Z.delta.thinking};break}case"signature_delta":{if(z?.type==="thinking")X.content[Z.index]={...z,signature:Z.delta.signature};break}default:dJ(Z.delta)}return X}case"content_block_stop":return X}},Symbol.asyncIterator)](){let $=[],Z=[],X=!1;return this.on("streamEvent",(z)=>{let J=Z.shift();if(J)J.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 J of Z)J.reject(z);Z.length=0}),this.on("error",(z)=>{X=!0;for(let J of Z)J.reject(z);Z.length=0}),{next:async()=>{if(!$.length){if(X)return{value:void 0,done:!0};return new Promise((J,q)=>Z.push({resolve:J,reject:q})).then((J)=>J?{value:J,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 N0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var _8;var l4=_(()=>{x0();I0();S4();q6();Y$();_8=class _8 extends r{create($,Z){return this._client.post("/v1/messages/batches",{body:$,...Z})}retrieve($,Z){return this._client.get(n`/v1/messages/batches/${$}`,Z)}list($={},Z){return this._client.getAPIList("/v1/messages/batches",_0,{query:$,...Z})}delete($,Z){return this._client.delete(n`/v1/messages/batches/${$}`,Z)}cancel($,Z){return this._client.post(n`/v1/messages/batches/${$}/cancel`,Z)}async results($,Z){let X=await this.retrieve($);if(!X.results_url)throw new F(`No batch \`results_url\`; Has it finished processing? ${X.processing_status} - ${X.id}`);return this._client.get(X.results_url,{...Z,headers:j([{Accept:"application/binary"},Z?.headers]),stream:!0,__binaryResponse:!0})._thenUnwrap((z,J)=>W6.fromResponse(J.response,J.controller))}}});var _$,pJ,QD;var i4=_(()=>{I0();J8();cJ();v4();l4();l4();I4();_$=class _$ extends r{constructor(){super(...arguments);this.batches=new _8(this._client)}create($,Z){if($.model in pJ)console.warn(`The model '${$.model}' is deprecated and will reach end-of-life on ${pJ[$.model]}
|
|
202
|
+
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`);if($.model in QD&&$.thinking&&$.thinking.type==="enabled")console.warn(`Using Claude with ${$.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let X=this._client._options.timeout;if(!$.stream&&X==null){let J=m2[$.model]??void 0;X=this._client.calculateNonstreamingTimeout($.max_tokens,J)}let z=u2($.tools,$.messages);return this._client.post("/v1/messages",{body:$,timeout:X??600000,...Z,headers:j([z,Z?.headers]),stream:$.stream??!1})}parse($,Z){return this.create($,Z).then((X)=>h4(X,$,{logger:this._client.logger??console}))}stream($,Z){return P8.createMessage(this,$,Z,{logger:this._client.logger??console})}countTokens($,Z){return this._client.post("/v1/messages/count_tokens",{body:$,...Z})}};pJ={"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-3-opus-20240229":"January 5th, 2026","claude-2.1":"July 21st, 2025","claude-2.0":"July 21st, 2025","claude-3-7-sonnet-latest":"February 19th, 2026","claude-3-7-sonnet-20250219":"February 19th, 2026","claude-3-5-haiku-latest":"February 19th, 2026","claude-3-5-haiku-20241022":"February 19th, 2026"},QD=["claude-opus-4-6"];_$.Batches=_8});var B6;var n4=_(()=>{x0();I0();Y$();B6=class B6 extends r{retrieve($,Z={},X){let{betas:z}=Z??{};return this._client.get(n`/v1/models/${$}`,{...X,headers:j([{...z?.toString()!=null?{"anthropic-beta":z?.toString()}:void 0},X?.headers])})}list($={},Z){let{betas:X,...z}=$??{};return this._client.getAPIList("/v1/models",_0,{query:z,...Z,headers:j([{...X?.toString()!=null?{"anthropic-beta":X?.toString()}:void 0},Z?.headers])})}}});var lJ=_(()=>{y4();f4();i4();n4();TJ()});var C8=($)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[$]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.($)?.trim();return};class a{constructor({baseURL:$=C8("ANTHROPIC_BASE_URL"),apiKey:Z=C8("ANTHROPIC_API_KEY")??null,authToken:X=C8("ANTHROPIC_AUTH_TOKEN")??null,...z}={}){s4.add(this),zZ.set(this,void 0);let J={apiKey:Z,authToken:X,...z,baseURL:$||"https://api.anthropic.com"};if(!J.dangerouslyAllowBrowser&&qJ())throw new F(`It looks like you're running in a browser-like environment.
|
|
198
203
|
|
|
199
204
|
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
200
205
|
If you understand the risks and have appropriate mitigations in place,
|
|
201
206
|
you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
202
207
|
|
|
203
208
|
new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
|
|
204
|
-
`);this.baseURL=J.baseURL,this.timeout=J.timeout??f4.DEFAULT_TIMEOUT,this.logger=J.logger??console;let q="warn";this.logLevel=q,this.logLevel=i5(J.logLevel,"ClientOptions.logLevel",this)??i5(w8("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??q,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??iz(),O(this,a2,sz,"f"),this._options=J,this.apiKey=typeof Z==="string"?Z:null,this.authToken=X}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))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')}async authHeaders($){return E([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return E([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return E([{Authorization:`Bearer ${this.authToken}`}])}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 R(`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("&")}getUserAgent(){return`${this.constructor.name}/JS ${e0}`}defaultIdempotencyKey(){return`stainless-node-retry-${v5()}`}makeStatusError($,Z,X,z){return X0.generate($,Z,X,z)}buildURL($,Z,X){let z=!K(this,y4,"m",jJ).call(this)&&X||this.baseURL,J=fz($)?new URL($):new URL(z+(z.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),q=this.defaultQuery();if(!gz(q))Z={...q,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))J.search=this.stringifyQuery(Z);return J.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new R("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:X}){}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((z)=>{return{method:$,path:Z,...z}}))}request($,Z=null){return new Z$(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,X){let z=await $,J=z.maxRetries??this.maxRetries;if(Z==null)Z=J;await this.prepareOptions(z);let{req:q,url:Q,timeout:Y}=await this.buildRequest(z,{retryCount:J-Z});await this.prepareRequest(q,{url:Q,options:z});let G="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),U=X===void 0?"":`, retryOf: ${X}`,W=Date.now();if(Y0(this).debug(`[${G}] sending request`,f0({retryOfRequestLogID:X,method:z.method,url:Q,options:z,headers:q.headers})),z.signal?.aborted)throw new G0;let V=new AbortController,H=await this.fetchWithTimeout(Q,q,Y,V).catch(m6),B=Date.now();if(H instanceof globalThis.Error){let N=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new G0;let F=y0(H)||/timed? ?out/i.test(String(H)+("cause"in H?String(H.cause):""));if(Z)return Y0(this).info(`[${G}] connection ${F?"timed out":"failed"} - ${N}`),Y0(this).debug(`[${G}] connection ${F?"timed out":"failed"} (${N})`,f0({retryOfRequestLogID:X,url:Q,durationMs:B-W,message:H.message})),this.retryRequest(z,Z,X??G);if(Y0(this).info(`[${G}] connection ${F?"timed out":"failed"} - error; no more retries left`),Y0(this).debug(`[${G}] connection ${F?"timed out":"failed"} (error; no more retries left)`,f0({retryOfRequestLogID:X,url:Q,durationMs:B-W,message:H.message})),F)throw new d$;throw new t0({cause:H})}let T=[...H.headers.entries()].filter(([N])=>N==="request-id").map(([N,F])=>", "+N+": "+JSON.stringify(F)).join(""),D=`[${G}${U}${T}] ${q.method} ${Q} ${H.ok?"succeeded":"failed"} with status ${H.status} in ${B-W}ms`;if(!H.ok){let N=await this.shouldRetry(H);if(Z&&N){let C=`retrying, ${Z} attempts remaining`;return await nz(H.body),Y0(this).info(`${D} - ${C}`),Y0(this).debug(`[${G}] response error (${C})`,f0({retryOfRequestLogID:X,url:H.url,status:H.status,headers:H.headers,durationMs:B-W})),this.retryRequest(z,Z,X??G,H.headers)}let F=N?"error; no more retries left":"error; not retryable";Y0(this).info(`${D} - ${F}`);let A=await H.text().catch((C)=>m6(C).message),_=R2(A),P=_?void 0:A;throw Y0(this).debug(`[${G}] response error (${F})`,f0({retryOfRequestLogID:X,url:H.url,status:H.status,headers:H.headers,message:P,durationMs:Date.now()-W})),this.makeStatusError(H.status,_,P,H.headers)}return Y0(this).info(D),Y0(this).debug(`[${G}] response start`,f0({retryOfRequestLogID:X,url:H.url,status:H.status,headers:H.headers,durationMs:B-W})),{response:H,options:z,controller:V,requestLogID:G,retryOfRequestLogID:X,startTime:W}}getAPIList($,Z,X){return this.requestAPIList(Z,X&&"then"in X?X.then((z)=>({method:"get",path:$,...z})):{method:"get",path:$,...X})}requestAPIList($,Z){let X=this.makeRequest(Z,null,void 0);return new n6(this,X,$)}async fetchWithTimeout($,Z,X,z){let{signal:J,method:q,...Q}=Z||{},Y=this._makeAbort(z);if(J)J.addEventListener("abort",Y,{once:!0});let G=setTimeout(Y,X),U=globalThis.ReadableStream&&Q.body instanceof globalThis.ReadableStream||typeof Q.body==="object"&&Q.body!==null&&Symbol.asyncIterator in Q.body,W={signal:z.signal,...U?{duplex:"half"}:{},method:"GET",...Q};if(q)W.method=q.toUpperCase();try{return await this.fetch.call(void 0,$,W)}finally{clearTimeout(G)}}async 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,z){let J,q=z?.get("retry-after-ms");if(q){let Y=parseFloat(q);if(!Number.isNaN(Y))J=Y}let Q=z?.get("retry-after");if(Q&&!J){let Y=parseFloat(Q);if(!Number.isNaN(Y))J=Y*1000;else J=Date.parse(Q)-Date.now()}if(!(J&&0<=J&&J<60000)){let Y=$.maxRetries??this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis(Z,Y)}return await uz(J),this.makeRequest($,Z-1,X)}calculateDefaultRetryTimeoutMillis($,Z){let J=Z-$,q=Math.min(0.5*Math.pow(2,J),8),Q=1-Math.random()*0.25;return q*Q*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new R("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let X={...$},{method:z,path:J,query:q,defaultBaseURL:Q}=X,Y=this.buildURL(J,q,Q);if("timeout"in X)vz("timeout",X.timeout);X.timeout=X.timeout??this.timeout;let{bodyHeaders:G,body:U}=this.buildBody({options:X}),W=await this.buildHeaders({options:$,method:z,bodyHeaders:G,retryCount:Z});return{req:{method:z,headers:W,...X.signal&&{signal:X.signal},...globalThis.ReadableStream&&U instanceof globalThis.ReadableStream&&{duplex:"half"},...U&&{body:U},...this.fetchOptions??{},...X.fetchOptions??{}},url:Y,timeout:X.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:X,retryCount:z}){let J={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();J[this.idempotencyHeader]=$.idempotencyKey}let q=E([J,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...lz(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,X,$.headers]);return this.validateHeaders(q),q.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let X=E([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&X.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:A2($)};else return K(this,a2,"f").call(this,{body:$,headers:X})}}var y4,f4,a2,jJ,g4="\\n\\nHuman:",h4="\\n\\nAssistant:",Y$;var v4=j(()=>{k0();I$();d5();V0();S0();Z4();EJ();E2();F4();k4();w4();x4();d5();N0();C2();I$();f4=s,a2=new WeakMap,y4=new WeakSet,jJ=function(){return this.baseURL!=="https://api.anthropic.com"};s.Anthropic=f4;s.HUMAN_PROMPT=g4;s.AI_PROMPT=h4;s.DEFAULT_TIMEOUT=600000;s.AnthropicError=R;s.APIError=X0;s.APIConnectionError=t0;s.APIConnectionTimeoutError=d$;s.APIUserAbortError=G0;s.NotFoundError=i$;s.ConflictError=n$;s.RateLimitError=r$;s.BadRequestError=c$;s.AuthenticationError=p$;s.InternalServerError=a$;s.PermissionDeniedError=l$;s.UnprocessableEntityError=s$;s.toFile=a6;Y$=class Y$ extends s{constructor(){super(...arguments);this.completions=new Q6(this),this.messages=new F$(this),this.models=new G6(this),this.beta=new E0(this)}};Y$.Completions=Q6;Y$.Messages=F$;Y$.Models=G6;Y$.Beta=E0});var bJ={};d4(bJ,{toFile:()=>a6,default:()=>Y$,UnprocessableEntityError:()=>s$,RateLimitError:()=>r$,PermissionDeniedError:()=>l$,PagePromise:()=>n6,NotFoundError:()=>i$,InternalServerError:()=>a$,HUMAN_PROMPT:()=>g4,ConflictError:()=>n$,BaseAnthropic:()=>s,BadRequestError:()=>c$,AuthenticationError:()=>p$,AnthropicError:()=>R,Anthropic:()=>Y$,APIUserAbortError:()=>G0,APIPromise:()=>Z$,APIError:()=>X0,APIConnectionTimeoutError:()=>d$,APIConnectionError:()=>t0,AI_PROMPT:()=>h4});var xJ=j(()=>{v4();Z4();E2();v4();S0();V0()});var q7=cJ(J7(),1),{program:QB,createCommand:YB,createArgument:GB,createOption:UB,CommanderError:WB,InvalidArgumentError:HB,InvalidOptionArgumentError:VB,Command:Q7,Argument:KB,Option:DB,Help:BB}=q7.default;import{readFileSync as N9,writeFileSync as SV,existsSync as B9}from"fs";var iH=J5(),nH=_6(),sH=dZ(),N5=C6(),rH=V6(),r0=f(),aH=p0(),oH=$0(),tH=i0(),eH=n0(),kN=G2(),$V=K5(),ZV=D5(),XV=B5(),H2=K9(),D9=W6();var zV=iH.Composer,JV=nH.Document,qV=sH.Schema,QV=N5.YAMLError,YV=N5.YAMLParseError,GV=N5.YAMLWarning,UV=rH.Alias,WV=r0.isAlias,HV=r0.isCollection,VV=r0.isDocument,KV=r0.isMap,DV=r0.isNode,BV=r0.isPair,NV=r0.isScalar,LV=r0.isSeq,IV=aH.Pair,TV=oH.Scalar,MV=tH.YAMLMap,OV=eH.YAMLSeq;var wV=$V.Lexer,FV=ZV.LineCounter,RV=XV.Parser,k6=H2.parse,AV=H2.parseAllDocuments,PV=H2.parseDocument,L5=H2.stringify,_V=D9.visit,CV=D9.visitAsync;function d($){let Z=N9($,"utf-8");return k6(Z)}function i($,Z){let X=L5(Z,{lineWidth:0});SV($,X,"utf-8")}function u($){return N9($,"utf-8")}function g($=process.cwd()){let Z=["project.faf",".faf"];for(let z of Z){let J=`${$}/${z}`;if(B9(J))return J}let X=$.replace(/\/[^/]+$/,"");if(X!==$)for(let z of Z){let J=`${X}/${z}`;if(B9(J))return J}return null}var T5=null;function f6(){if(!T5)try{T5=M9()}catch{throw Error(`faf-scoring-kernel not installed.
|
|
205
|
-
|
|
206
|
-
Run: npm install faf-scoring-kernel
|
|
207
|
-
`)}return T5}function o($){return JSON.parse(f6().score_faf($))}function O9($){return f6().validate_faf($)}function w9($){return f6().compile_fafb($)}function F9($){return JSON.parse(f6().decompile_fafb($))}function R9(){return f6().sdk_version()}c();var O5=[{name:"TROPHY",indicator:`${a0("\uD83C\uDFC6")} ${a0("TROPHY")}`,threshold:100},{name:"GOLD",indicator:`${a0(b("★"))} ${a0("GOLD")}`,threshold:99},{name:"SILVER",indicator:`${w("◆")} ${w("SILVER")}`,threshold:95},{name:"BRONZE",indicator:`${w("◇")} ${w("BRONZE")}`,threshold:85},{name:"GREEN",indicator:`${b("●")} GREEN`,threshold:70},{name:"YELLOW",indicator:`${L("●")} YELLOW`,threshold:55},{name:"RED",indicator:`${L("○")} RED`,threshold:1},{name:"WHITE",indicator:`${L("♡")}`,threshold:0}];function D2($){return $.indicator}function P9($){for(let Z of O5)if($>=Z.threshold)return Z;return O5[O5.length-1]}function t($){return{score:$.score,tier:P9($.score),populated:$.populated,empty:$.empty,ignored:$.ignored,active:$.active,total:$.total,slots:$.slots}}c();function Z0($,Z,X=!1){let z=D2($.tier),J=b(`${$.score}%`);if(console.log(`${z} ${J} ${L(`${$.populated}/${$.active} slots`)} ${L("—")} ${Z}`),$.tier.name!=="TROPHY"&&$.empty>0)console.log(L(` ${$.empty} empty`));if(X)console.log(""),nV($)}function nV($){for(let[Z,X]of Object.entries($.slots)){let z=X==="populated"?w("●"):X==="slotignored"?L("—"):L("○");console.log(` ${z} ${X==="slotignored"?L(Z):Z}`)}}c();function B2($,Z={}){let X=$??g();if(!X)console.error(`Error: project.faf not found
|
|
209
|
+
`);this.baseURL=J.baseURL,this.timeout=J.timeout??r4.DEFAULT_TIMEOUT,this.logger=J.logger??console;let q="warn";this.logLevel=q,this.logLevel=q4(J.logLevel,"ClientOptions.logLevel",this)??q4(C8("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",this)??q,this.fetchOptions=J.fetchOptions,this.maxRetries=J.maxRetries??2,this.fetch=J.fetch??YJ(),M(this,zZ,UJ,"f"),this._options=J,this.apiKey=typeof Z==="string"?Z:null,this.authToken=X}withOptions($){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...$})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:$,nulls:Z}){if($.get("x-api-key")||$.get("authorization"))return;if(this.apiKey&&$.get("x-api-key"))return;if(Z.has("x-api-key"))return;if(this.authToken&&$.get("authorization"))return;if(Z.has("authorization"))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')}async authHeaders($){return j([await this.apiKeyAuth($),await this.bearerAuth($)])}async apiKeyAuth($){if(this.apiKey==null)return;return j([{"X-Api-Key":this.apiKey}])}async bearerAuth($){if(this.authToken==null)return;return j([{Authorization:`Bearer ${this.authToken}`}])}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 F(`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("&")}getUserAgent(){return`${this.constructor.name}/JS ${J$}`}defaultIdempotencyKey(){return`stainless-node-retry-${t5()}`}makeStatusError($,Z,X,z){return q0.generate($,Z,X,z)}buildURL($,Z,X){let z=!K(this,s4,"m",iJ).call(this)&&X||this.baseURL,J=o9($)?new URL($):new URL(z+(z.endsWith("/")&&$.startsWith("/")?$.slice(1):$)),q=this.defaultQuery();if(!t9(q))Z={...q,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))J.search=this.stringifyQuery(Z);return J.toString()}_calculateNonstreamingTimeout($){if(3600*$/128000>600)throw new F("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details");return 600000}async prepareOptions($){}async prepareRequest($,{url:Z,options:X}){}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((z)=>{return{method:$,path:Z,...z}}))}request($,Z=null){return new Q$(this,this.makeRequest($,Z,void 0))}async makeRequest($,Z,X){let z=await $,J=z.maxRetries??this.maxRetries;if(Z==null)Z=J;await this.prepareOptions(z);let{req:q,url:Q,timeout:Y}=await this.buildRequest(z,{retryCount:J-Z});await this.prepareRequest(q,{url:Q,options:z});let G="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),U=X===void 0?"":`, retryOf: ${X}`,W=Date.now();if(U0(this).debug(`[${G}] sending request`,m0({retryOfRequestLogID:X,method:z.method,url:Q,options:z,headers:q.headers})),z.signal?.aborted)throw new W0;let V=new AbortController,H=await this.fetchWithTimeout(Q,q,Y,V).catch(n6),D=Date.now();if(H instanceof globalThis.Error){let L=`retrying, ${Z} attempts remaining`;if(z.signal?.aborted)throw new W0;let w=u0(H)||/timed? ?out/i.test(String(H)+("cause"in H?String(H.cause):""));if(Z)return U0(this).info(`[${G}] connection ${w?"timed out":"failed"} - ${L}`),U0(this).debug(`[${G}] connection ${w?"timed out":"failed"} (${L})`,m0({retryOfRequestLogID:X,url:Q,durationMs:D-W,message:H.message})),this.retryRequest(z,Z,X??G);if(U0(this).info(`[${G}] connection ${w?"timed out":"failed"} - error; no more retries left`),U0(this).debug(`[${G}] connection ${w?"timed out":"failed"} (error; no more retries left)`,m0({retryOfRequestLogID:X,url:Q,durationMs:D-W,message:H.message})),w)throw new s$;throw new z$({cause:H})}let T=[...H.headers.entries()].filter(([L])=>L==="request-id").map(([L,w])=>", "+L+": "+JSON.stringify(w)).join(""),B=`[${G}${U}${T}] ${q.method} ${Q} ${H.ok?"succeeded":"failed"} with status ${H.status} in ${D-W}ms`;if(!H.ok){let L=await this.shouldRetry(H);if(Z&&L){let E=`retrying, ${Z} attempts remaining`;return await GJ(H.body),U0(this).info(`${B} - ${E}`),U0(this).debug(`[${G}] response error (${E})`,m0({retryOfRequestLogID:X,url:H.url,status:H.status,headers:H.headers,durationMs:D-W})),this.retryRequest(z,Z,X??G,H.headers)}let w=L?"error; no more retries left":"error; not retryable";U0(this).info(`${B} - ${w}`);let A=await H.text().catch((E)=>n6(E).message),P=j2(A),C=P?void 0:A;throw U0(this).debug(`[${G}] response error (${w})`,m0({retryOfRequestLogID:X,url:H.url,status:H.status,headers:H.headers,message:C,durationMs:Date.now()-W})),this.makeStatusError(H.status,P,C,H.headers)}return U0(this).info(B),U0(this).debug(`[${G}] response start`,m0({retryOfRequestLogID:X,url:H.url,status:H.status,headers:H.headers,durationMs:D-W})),{response:H,options:z,controller:V,requestLogID:G,retryOfRequestLogID:X,startTime:W}}getAPIList($,Z,X){return this.requestAPIList(Z,X&&"then"in X?X.then((z)=>({method:"get",path:$,...z})):{method:"get",path:$,...X})}requestAPIList($,Z){let X=this.makeRequest(Z,null,void 0);return new e6(this,X,$)}async fetchWithTimeout($,Z,X,z){let{signal:J,method:q,...Q}=Z||{},Y=this._makeAbort(z);if(J)J.addEventListener("abort",Y,{once:!0});let G=setTimeout(Y,X),U=globalThis.ReadableStream&&Q.body instanceof globalThis.ReadableStream||typeof Q.body==="object"&&Q.body!==null&&Symbol.asyncIterator in Q.body,W={signal:z.signal,...U?{duplex:"half"}:{},method:"GET",...Q};if(q)W.method=q.toUpperCase();try{return await this.fetch.call(void 0,$,W)}finally{clearTimeout(G)}}async 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,z){let J,q=z?.get("retry-after-ms");if(q){let Y=parseFloat(q);if(!Number.isNaN(Y))J=Y}let Q=z?.get("retry-after");if(Q&&!J){let Y=parseFloat(Q);if(!Number.isNaN(Y))J=Y*1000;else J=Date.parse(Q)-Date.now()}if(!(J&&0<=J&&J<60000)){let Y=$.maxRetries??this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis(Z,Y)}return await ZJ(J),this.makeRequest($,Z-1,X)}calculateDefaultRetryTimeoutMillis($,Z){let J=Z-$,q=Math.min(0.5*Math.pow(2,J),8),Q=1-Math.random()*0.25;return q*Q*1000}calculateNonstreamingTimeout($,Z){if(3600000*$/128000>600000||Z!=null&&$>Z)throw new F("Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details");return 600000}async buildRequest($,{retryCount:Z=0}={}){let X={...$},{method:z,path:J,query:q,defaultBaseURL:Q}=X,Y=this.buildURL(J,q,Q);if("timeout"in X)$J("timeout",X.timeout);X.timeout=X.timeout??this.timeout;let{bodyHeaders:G,body:U}=this.buildBody({options:X}),W=await this.buildHeaders({options:$,method:z,bodyHeaders:G,retryCount:Z});return{req:{method:z,headers:W,...X.signal&&{signal:X.signal},...globalThis.ReadableStream&&U instanceof globalThis.ReadableStream&&{duplex:"half"},...U&&{body:U},...this.fetchOptions??{},...X.fetchOptions??{}},url:Y,timeout:X.timeout}}async buildHeaders({options:$,method:Z,bodyHeaders:X,retryCount:z}){let J={};if(this.idempotencyHeader&&Z!=="get"){if(!$.idempotencyKey)$.idempotencyKey=this.defaultIdempotencyKey();J[this.idempotencyHeader]=$.idempotencyKey}let q=j([J,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(z),...$.timeout?{"X-Stainless-Timeout":String(Math.trunc($.timeout/1000))}:{},...QJ(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2023-06-01"},await this.authHeaders($),this._options.defaultHeaders,X,$.headers]);return this.validateHeaders(q),q.values}_makeAbort($){return()=>$.abort()}buildBody({options:{body:$,headers:Z}}){if(!$)return{bodyHeaders:void 0,body:void 0};let X=j([Z]);if(ArrayBuffer.isView($)||$ instanceof ArrayBuffer||$ instanceof DataView||typeof $==="string"&&X.values.has("content-type")||globalThis.Blob&&$ instanceof globalThis.Blob||$ instanceof FormData||$ instanceof URLSearchParams||globalThis.ReadableStream&&$ instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:$};else if(typeof $==="object"&&((Symbol.asyncIterator in $)||(Symbol.iterator in $)&&("next"in $)&&typeof $.next==="function"))return{bodyHeaders:void 0,body:b2($)};else return K(this,zZ,"f").call(this,{body:$,headers:X})}}var s4,r4,zZ,iJ,a4="\\n\\nHuman:",o4="\\n\\nAssistant:",V$;var t4=_(()=>{v0();w$();Z4();B0();x0();B4();lJ();g2();f4();n4();y4();i4();Z4();I0();y2();w$();r4=a,zZ=new WeakMap,s4=new WeakSet,iJ=function(){return this.baseURL!=="https://api.anthropic.com"};a.Anthropic=r4;a.HUMAN_PROMPT=a4;a.AI_PROMPT=o4;a.DEFAULT_TIMEOUT=600000;a.AnthropicError=F;a.APIError=q0;a.APIConnectionError=z$;a.APIConnectionTimeoutError=s$;a.APIUserAbortError=W0;a.NotFoundError=t$;a.ConflictError=e$;a.RateLimitError=Z6;a.BadRequestError=r$;a.AuthenticationError=a$;a.InternalServerError=X6;a.PermissionDeniedError=o$;a.UnprocessableEntityError=$6;a.toFile=X8;V$=class V$ extends a{constructor(){super(...arguments);this.completions=new V6(this),this.messages=new _$(this),this.models=new B6(this),this.beta=new k0(this)}};V$.Completions=V6;V$.Messages=_$;V$.Models=B6;V$.Beta=k0});var nJ={};QZ(nJ,{toFile:()=>X8,default:()=>V$,UnprocessableEntityError:()=>$6,RateLimitError:()=>Z6,PermissionDeniedError:()=>o$,PagePromise:()=>e6,NotFoundError:()=>t$,InternalServerError:()=>X6,HUMAN_PROMPT:()=>a4,ConflictError:()=>e$,BaseAnthropic:()=>a,BadRequestError:()=>r$,AuthenticationError:()=>a$,AnthropicError:()=>F,Anthropic:()=>V$,APIUserAbortError:()=>W0,APIPromise:()=>Q$,APIError:()=>q0,APIConnectionTimeoutError:()=>s$,APIConnectionError:()=>z$,AI_PROMPT:()=>o4});var sJ=_(()=>{t4();B4();g2();t4();x0();B0()});var I7=qq(N7(),1),{program:FD,createCommand:AD,createArgument:PD,createOption:_D,CommanderError:CD,InvalidArgumentError:ED,InvalidOptionArgumentError:SD,Command:T7,Argument:jD,Option:bD,Help:xD}=I7.default;Z0();P0();b0();O2();l();function b5($,Z={}){let X=$??g();if(!X)console.error(`Error: project.faf not found
|
|
208
210
|
|
|
209
|
-
Run 'faf init' to create one.`),process.exit(2);let z=u(X),J=o(z),q=t(J);if(Z.json){console.log(JSON.stringify(q,null,2));return}if(Z.status){console.log(`${D2(q.tier)} ${b(`${q.score}%`)}`);return}Z0(q,X,Z.verbose)}import{existsSync as oV}from"fs";import{join as h9}from"path";var U0=[{index:1,path:"project.name",description:"Project name",category:"project"},{index:2,path:"project.goal",description:"What the project does",category:"project"},{index:3,path:"project.main_language",description:"Primary language",category:"project"},{index:4,path:"human_context.who",description:"Who is building this",category:"human"},{index:5,path:"human_context.what",description:"What are they building",category:"human"},{index:6,path:"human_context.why",description:"Why does it exist",category:"human"},{index:7,path:"human_context.where",description:"Where does it run",category:"human"},{index:8,path:"human_context.when",description:"When was it started / timeline",category:"human"},{index:9,path:"human_context.how",description:"How is it built",category:"human"},{index:10,path:"stack.frontend",description:"Framework (React, Svelte, etc.)",category:"frontend"},{index:11,path:"stack.css_framework",description:"CSS framework",category:"frontend"},{index:12,path:"stack.ui_library",description:"UI component library",category:"frontend"},{index:13,path:"stack.state_management",description:"State management",category:"frontend"},{index:14,path:"stack.backend",description:"Backend framework",category:"backend"},{index:15,path:"stack.api_type",description:"API style (REST, GraphQL, etc.)",category:"backend"},{index:16,path:"stack.runtime",description:"Runtime (Node, Bun, Python, etc.)",category:"backend"},{index:17,path:"stack.database",description:"Database",category:"backend"},{index:18,path:"stack.connection",description:"Connection method (Prisma, etc.)",category:"backend"},{index:19,path:"stack.hosting",description:"Hosting platform",category:"universal"},{index:20,path:"stack.build",description:"Build tool",category:"universal"},{index:21,path:"stack.cicd",description:"CI/CD",category:"universal"},{index:22,path:"stack.monorepo_tool",description:"Monorepo tool",category:"enterprise_infra"},{index:23,path:"stack.package_manager",description:"Package manager",category:"enterprise_infra"},{index:24,path:"stack.workspaces",description:"Workspace configuration",category:"enterprise_infra"},{index:25,path:"monorepo.packages_count",description:"Number of packages",category:"enterprise_infra"},{index:26,path:"monorepo.build_orchestrator",description:"Build orchestration tool",category:"enterprise_infra"},{index:27,path:"stack.admin",description:"Admin panel",category:"enterprise_app"},{index:28,path:"stack.cache",description:"Caching layer",category:"enterprise_app"},{index:29,path:"stack.search",description:"Search engine",category:"enterprise_app"},{index:30,path:"stack.storage",description:"Object storage",category:"enterprise_app"},{index:31,path:"monorepo.versioning_strategy",description:"Version strategy",category:"enterprise_ops"},{index:32,path:"monorepo.shared_configs",description:"Shared configs",category:"enterprise_ops"},{index:33,path:"monorepo.remote_cache",description:"Remote build cache",category:"enterprise_ops"}],$L=new Map(U0.map(($)=>[$.path,$]));var ZL=U0.filter(($)=>$.index<=21);var sV=new Set(["describe your project goal","development teams","cloud platform","null","none","unknown","n/a","not applicable"]);function g$($){if($===null||$===void 0||$==="")return!0;if(typeof $==="string")return sV.has($.toLowerCase().trim());if(Array.isArray($)&&$.length===0)return!0;if(typeof $==="object"&&Object.keys($).length===0)return!0;return!1}var h$={cli:["project","human"],library:["project","human"],mcp:["project","backend","human"],backend:["project","backend","universal","human"],"data-science":["project","backend","human"],frontend:["project","frontend","human"],fullstack:["project","frontend","backend","universal","human"],svelte:["project","frontend","backend","universal","human"],framework:["project","frontend","backend","universal","human"],enterprise:["project","frontend","backend","universal","human","enterprise_infra","enterprise_app","enterprise_ops"]};import{existsSync as k,readFileSync as S9,readdirSync as C9}from"fs";import{join as x}from"path";var _9=[{name:"Next.js",slug:"nextjs",category:"frontend",signals:[{type:"dependency",key:"next"},{type:"file",pattern:"next.config.*"}]},{name:"React",slug:"react",category:"frontend",signals:[{type:"dependency",key:"react"}]},{name:"SvelteKit",slug:"sveltekit",category:"frontend",signals:[{type:"dependency",key:"@sveltejs/kit"},{type:"file",pattern:"svelte.config.*"}]},{name:"Svelte",slug:"svelte",category:"frontend",signals:[{type:"dependency",key:"svelte"},{type:"devDependency",key:"svelte"}]},{name:"Vue.js",slug:"vue",category:"frontend",signals:[{type:"dependency",key:"vue"}]},{name:"Nuxt",slug:"nuxt",category:"frontend",signals:[{type:"dependency",key:"nuxt"},{type:"file",pattern:"nuxt.config.*"}]},{name:"Angular",slug:"angular",category:"frontend",signals:[{type:"dependency",key:"@angular/core"},{type:"file",pattern:"angular.json"}]},{name:"Astro",slug:"astro",category:"frontend",signals:[{type:"dependency",key:"astro"},{type:"file",pattern:"astro.config.*"}]},{name:"Solid",slug:"solid",category:"frontend",signals:[{type:"dependency",key:"solid-js"}]},{name:"Remix",slug:"remix",category:"frontend",signals:[{type:"dependency",key:"@remix-run/react"}]},{name:"Gatsby",slug:"gatsby",category:"frontend",signals:[{type:"dependency",key:"gatsby"},{type:"file",pattern:"gatsby-config.*"}]},{name:"Qwik",slug:"qwik",category:"frontend",signals:[{type:"dependency",key:"@builder.io/qwik"}]},{name:"Vercel (SvelteKit)",slug:"adapter-vercel",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-vercel"},{type:"devDependency",key:"@sveltejs/adapter-vercel"}]},{name:"Node (SvelteKit)",slug:"adapter-node",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-node"},{type:"devDependency",key:"@sveltejs/adapter-node"}]},{name:"Static (SvelteKit)",slug:"adapter-static",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-static"},{type:"devDependency",key:"@sveltejs/adapter-static"}]},{name:"Cloudflare (SvelteKit)",slug:"adapter-cloudflare",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-cloudflare"},{type:"devDependency",key:"@sveltejs/adapter-cloudflare"}]},{name:"Netlify (SvelteKit)",slug:"adapter-netlify",category:"hosting",signals:[{type:"dependency",key:"@sveltejs/adapter-netlify"},{type:"devDependency",key:"@sveltejs/adapter-netlify"}]},{name:"Tailwind CSS",slug:"tailwind",category:"css",signals:[{type:"dependency",key:"tailwindcss"},{type:"devDependency",key:"tailwindcss"},{type:"file",pattern:"tailwind.config.*"}]},{name:"Bootstrap",slug:"bootstrap",category:"css",signals:[{type:"dependency",key:"bootstrap"}]},{name:"Styled Components",slug:"styled-components",category:"css",signals:[{type:"dependency",key:"styled-components"}]},{name:"shadcn/ui",slug:"shadcn",category:"ui",signals:[{type:"file",pattern:"components.json"},{type:"dependency",key:"@radix-ui/react-dialog"}]},{name:"Material UI",slug:"mui",category:"ui",signals:[{type:"dependency",key:"@mui/material"}]},{name:"Chakra UI",slug:"chakra",category:"ui",signals:[{type:"dependency",key:"@chakra-ui/react"}]},{name:"Ant Design",slug:"antd",category:"ui",signals:[{type:"dependency",key:"antd"}]},{name:"Redux",slug:"redux",category:"state",signals:[{type:"dependency",key:"@reduxjs/toolkit"}]},{name:"Zustand",slug:"zustand",category:"state",signals:[{type:"dependency",key:"zustand"}]},{name:"Jotai",slug:"jotai",category:"state",signals:[{type:"dependency",key:"jotai"}]},{name:"Pinia",slug:"pinia",category:"state",signals:[{type:"dependency",key:"pinia"}]},{name:"Express",slug:"express",category:"backend",signals:[{type:"dependency",key:"express"}]},{name:"Fastify",slug:"fastify",category:"backend",signals:[{type:"dependency",key:"fastify"}]},{name:"Hono",slug:"hono",category:"backend",signals:[{type:"dependency",key:"hono"}]},{name:"Elysia",slug:"elysia",category:"backend",signals:[{type:"dependency",key:"elysia"}]},{name:"NestJS",slug:"nestjs",category:"backend",signals:[{type:"dependency",key:"@nestjs/core"}]},{name:"Koa",slug:"koa",category:"backend",signals:[{type:"dependency",key:"koa"}]},{name:"Django",slug:"django",category:"backend",signals:[{type:"file",pattern:"manage.py"},{type:"file",pattern:"settings.py"}]},{name:"Flask",slug:"flask",category:"backend",signals:[{type:"file",pattern:"app.py"}]},{name:"FastAPI",slug:"fastapi",category:"backend",signals:[{type:"file",pattern:"main.py"}]},{name:"Rails",slug:"rails",category:"backend",signals:[{type:"file",pattern:"Gemfile"},{type:"file",pattern:"config/routes.rb"}]},{name:"Spring Boot",slug:"spring",category:"backend",signals:[{type:"file",pattern:"pom.xml"},{type:"file",pattern:"build.gradle"}]},{name:"Prisma",slug:"prisma",category:"database",signals:[{type:"dependency",key:"prisma"},{type:"devDependency",key:"prisma"},{type:"file",pattern:"prisma/schema.prisma"}]},{name:"Drizzle",slug:"drizzle",category:"database",signals:[{type:"dependency",key:"drizzle-orm"},{type:"file",pattern:"drizzle.config.*"}]},{name:"TypeORM",slug:"typeorm",category:"database",signals:[{type:"dependency",key:"typeorm"}]},{name:"Mongoose",slug:"mongoose",category:"database",signals:[{type:"dependency",key:"mongoose"}]},{name:"Vite",slug:"vite",category:"build",signals:[{type:"dependency",key:"vite"},{type:"devDependency",key:"vite"},{type:"file",pattern:"vite.config.*"}]},{name:"webpack",slug:"webpack",category:"build",signals:[{type:"dependency",key:"webpack"},{type:"devDependency",key:"webpack"},{type:"file",pattern:"webpack.config.*"}]},{name:"esbuild",slug:"esbuild",category:"build",signals:[{type:"dependency",key:"esbuild"},{type:"devDependency",key:"esbuild"}]},{name:"Turbopack",slug:"turbopack",category:"build",signals:[{type:"file",pattern:"turbo.json"}]},{name:"Jest",slug:"jest",category:"testing",signals:[{type:"devDependency",key:"jest"},{type:"file",pattern:"jest.config.*"}]},{name:"Vitest",slug:"vitest",category:"testing",signals:[{type:"devDependency",key:"vitest"}]},{name:"Playwright",slug:"playwright",category:"testing",signals:[{type:"devDependency",key:"@playwright/test"},{type:"file",pattern:"playwright.config.*"}]},{name:"Cypress",slug:"cypress",category:"testing",signals:[{type:"devDependency",key:"cypress"},{type:"file",pattern:"cypress.config.*"}]},{name:"Turborepo",slug:"turborepo",category:"monorepo",signals:[{type:"devDependency",key:"turbo"},{type:"file",pattern:"turbo.json"}]},{name:"Nx",slug:"nx",category:"monorepo",signals:[{type:"devDependency",key:"nx"},{type:"file",pattern:"nx.json"}]},{name:"Lerna",slug:"lerna",category:"monorepo",signals:[{type:"devDependency",key:"lerna"},{type:"file",pattern:"lerna.json"}]},{name:"MCP SDK",slug:"mcp",category:"ai",signals:[{type:"dependency",key:"@modelcontextprotocol/sdk"}]},{name:"Anthropic SDK",slug:"anthropic",category:"ai",signals:[{type:"dependency",key:"@anthropic-ai/sdk"}]},{name:"OpenAI SDK",slug:"openai",category:"ai",signals:[{type:"dependency",key:"openai"}]},{name:"LangChain",slug:"langchain",category:"ai",signals:[{type:"dependency",key:"langchain"}]},{name:"Vercel",slug:"vercel",category:"hosting",signals:[{type:"file",pattern:"vercel.json"}]},{name:"Netlify",slug:"netlify",category:"hosting",signals:[{type:"file",pattern:"netlify.toml"}]},{name:"Docker",slug:"docker",category:"hosting",signals:[{type:"file",pattern:"Dockerfile"},{type:"file",pattern:"docker-compose.yml"}]},{name:"Cloudflare Workers",slug:"cloudflare",category:"hosting",signals:[{type:"file",pattern:"wrangler.toml"},{type:"dependency",key:"wrangler"}]},{name:"GitHub Actions",slug:"github-actions",category:"cicd",signals:[{type:"file",pattern:".github/workflows/*.yml"}]},{name:"Commander.js",slug:"commander",category:"cli",signals:[{type:"dependency",key:"commander"}]}];function N$($){let Z=x($,"package.json");if(!k(Z))return null;try{return JSON.parse(S9(Z,"utf-8"))}catch{return null}}function rV($,Z){if(!Z.includes("*"))return k(x($,Z));let X=Z.split("/");if(X.length===1){let Y=Z.split("*")[0];try{return C9($).some((G)=>G.startsWith(Y))}catch{return!1}}let z=x($,...X.slice(0,-1)),J=X[X.length-1],q=J.split("*")[0],Q=J.split("*")[1]||"";try{return C9(z).some((Y)=>Y.startsWith(q)&&Y.endsWith(Q))}catch{return!1}}function aV($,Z,X){switch($.type){case"dependency":return!!Z?.dependencies?.[$.key];case"devDependency":return!!Z?.devDependencies?.[$.key];case"file":return rV(X,$.pattern);default:return!1}}function w5($){let Z=N$($);return _9.map((X)=>{let J=X.signals.filter((q)=>aV(q,Z,$)).length/X.signals.length;return{name:X.name,slug:X.slug,category:X.category,confidence:J}}).filter((X)=>X.confidence>0).sort((X,z)=>z.confidence-X.confidence)}function E9($){let Z=N$($);if(Z?.devDependencies?.typescript||Z?.dependencies?.typescript)return"TypeScript";if(k(x($,"tsconfig.json")))return"TypeScript";if(k(x($,"Cargo.toml")))return"Rust";if(k(x($,"go.mod")))return"Go";if(k(x($,"pyproject.toml"))||k(x($,"setup.py")))return"Python";if(k(x($,"Gemfile")))return"Ruby";if(k(x($,"pom.xml"))||k(x($,"build.gradle")))return"Java";if(k(x($,"Package.swift")))return"Swift";if(k(x($,"build.zig")))return"Zig";if(Z)return"JavaScript";return"Unknown"}function j9($){let Z=N$($),X=w5($);if(Z?.bin)return"cli";if(X.some((U)=>U.slug==="mcp"))return"mcp";let J=X.some((U)=>U.slug==="svelte"||U.slug==="sveltekit");if(Z?.private===!0&&(k(x($,"pnpm-workspace.yaml"))||Z?.workspaces!==void 0)&&J)return"framework";if(J)return"svelte";if(X.some((U)=>U.slug==="nextjs"||U.slug==="nuxt"))return"fullstack";let Y=X.some((U)=>U.category==="frontend"),G=X.some((U)=>U.category==="backend");if(Y&&G)return"fullstack";if(Y)return"frontend";if(G)return"backend";if(Z?.main&&!Z?.bin)return"library";return"library"}function b9($){if(k(x($,"bunfig.toml")))return"Bun";if(k(x($,"deno.json"))||k(x($,"deno.jsonc")))return"Deno";if(N$($))return"Node.js";if(k(x($,"Cargo.toml")))return"Rust";if(k(x($,"go.mod")))return"Go";return"Unknown"}function x9($){if(k(x($,"bun.lockb"))||k(x($,"bun.lock")))return"bun";if(k(x($,"pnpm-lock.yaml")))return"pnpm";if(k(x($,"yarn.lock")))return"yarn";if(k(x($,"package-lock.json")))return"npm";return"npm"}function k9($){if(k(x($,".github/workflows")))return"GitHub Actions";if(k(x($,".gitlab-ci.yml")))return"GitLab CI";if(k(x($,".circleci")))return"CircleCI";if(k(x($,"Jenkinsfile")))return"Jenkins";return null}function y9($){if(k(x($,"vercel.json")))return"Vercel";if(k(x($,"netlify.toml")))return"Netlify";if(k(x($,"wrangler.toml")))return"Cloudflare";if(k(x($,"Dockerfile")))return"Docker";if(k(x($,"fly.toml")))return"Fly.io";if(k(x($,"render.yaml")))return"Render";return null}function f9($){let Z=x($,"svelte.config.js");if(!k(Z))return null;try{let z=S9(Z,"utf-8").match(/@sveltejs\/adapter-(\w+)/);if(z){let J=z[1];switch(J){case"vercel":return"Vercel";case"node":return"Node";case"static":return"Static";case"cloudflare":return"Cloudflare";case"netlify":return"Netlify";case"auto":return"Auto";default:return J}}return null}catch{return null}}function g9($){let Z=N$($);if(Z?.devDependencies?.vite||Z?.dependencies?.vite)return"Vite";if(Z?.devDependencies?.webpack||Z?.dependencies?.webpack)return"webpack";if(Z?.devDependencies?.esbuild||Z?.dependencies?.esbuild)return"esbuild";if(k(x($,"tsconfig.json"))&&Z?.devDependencies?.typescript)return"TypeScript (tsc)";return null}function v$($){let Z=N$($),X=w5($),z=E9($),J=j9($),q=b9($),Q=x9($),Y=k9($),G=y9($),U=g9($),W=X.find((m)=>m.category==="frontend"),V=X.find((m)=>m.category==="css"),H=X.find((m)=>m.category==="ui"),B=X.find((m)=>m.category==="state"),T=X.find((m)=>m.category==="backend"),D=X.find((m)=>m.category==="database"),N=h$[J]||h$.library,F=J==="framework",A=X.some((m)=>m.slug==="svelte"||m.slug==="sveltekit"),_=F&&A?"svelte":F?null:null,P=J==="svelte"||_==="svelte",S=P?f9($):null,C=P&&X.some((m)=>m.slug==="sveltekit"),p=new Set(["css_framework","ui_library","database","connection","hosting"]),M={},e=U0.filter((m)=>m.path.startsWith("stack."));for(let m of e){let a=m.path.replace("stack.","");if(!N.includes(m.category)){M[a]="slotignored";continue}if(F&&p.has(a)){M[a]="slotignored";continue}switch(a){case"frontend":M[a]=W?.name??(J==="cli"?"CLI":"");break;case"css_framework":M[a]=V?.name??"";break;case"ui_library":M[a]=H?.name??"";break;case"state_management":M[a]=P?B?.name??"Runes":B?.name??"";break;case"backend":M[a]=P?C?"SvelteKit":T?.name??"":T?.name??"";break;case"api_type":M[a]=C?"Server Routes":"";break;case"runtime":M[a]=q!=="Unknown"?q:"";break;case"database":M[a]=D?.name??"";break;case"connection":M[a]=D?.name??"";break;case"hosting":if(P&&S)M[a]=S;else M[a]=G??"";break;case"build":M[a]=P?"Vite":U??"";break;case"cicd":M[a]=Y??"";break;case"package_manager":M[a]=Q;break;default:M[a]="";break}}let I0={},u0=U0.filter((m)=>m.path.startsWith("monorepo."));for(let m of u0){let a=m.path.replace("monorepo.","");if(!N.includes(m.category))I0[a]="slotignored";else I0[a]=""}let r={name:Z?.name??$.split("/").pop()??"project",goal:Z?.description??"",main_language:z,type:J};if(F&&_)r.framework=_;return{faf_version:"2.5.0",project:r,stack:M,human_context:{who:"",what:Z?.description??"",why:"",where:"",when:"",how:""},monorepo:I0}}c();function F5($={}){let Z=process.cwd(),X=$.output?$.output.endsWith(".faf")?$.output:h9(Z,$.output):h9(Z,"project.faf");if(oV(X)&&!$.force)console.error(`project.faf already exists. Use ${b("--force")} to overwrite.`),process.exit(1);let z=v$(Z);i(X,z);let J=u(X),q=t(o(J));if(console.log(`${w("created")} ${X}`),Z0(q,X),q.score<100)console.log(L(`
|
|
210
|
-
run ${b("'faf go'")} to fill empty slots`))}import{existsSync as
|
|
211
|
-
|
|
212
|
-
`)}function p9($,Z){let X=o0(Z),z=$.split(`
|
|
211
|
+
Run 'faf init' to create one.`),process.exit(2);let z=m(X),J=t(z),q=e(J);if(Z.json){console.log(JSON.stringify(q,null,2));return}if(Z.status){console.log(`${M2(q.tier)} ${b(`${q.score}%`)}`);return}J0(q,X,Z.verbose)}w2();Z0();P0();b0();l();import{existsSync as DK}from"fs";import{join as ez}from"path";function k5($={}){let Z=process.cwd(),X=$.output?$.output.endsWith(".faf")?$.output:ez(Z,$.output):ez(Z,"project.faf");if(DK(X)&&!$.force)console.error(`project.faf already exists. Use ${b("--force")} to overwrite.`),process.exit(1);let z=l$(Z);s(X,z);let J=m(X),q=e(t(J));if(console.log(`${O("created")} ${X}`),J0(q,X),q.score<100)console.log(N(`
|
|
212
|
+
run ${b("'faf go'")} to fill empty slots`))}f5();Z0();import{existsSync as O$,statSync as F2}from"fs";import{join as v5}from"path";import{readFileSync as IK,writeFileSync as TK,existsSync as MK,statSync as iN}from"fs";import{join as X9}from"path";var z9="CLAUDE.md",OK="STATUS: BI-SYNC ACTIVE";function g5($){let Z=X9($,z9);if(!MK(Z))return null;return IK(Z,"utf-8")}function h5($,Z){let X=X9($,z9);TK(X,Z,"utf-8")}function X$($){return`<!-- faf: ${[$.project?.name,$.project?.main_language,$.project?.goal].filter(Boolean).map((X)=>String(X).trim()).join(" | ")} -->`}function J9($){let Z=[],X=$.project?.name??"Project",z=$.project?.main_language??"",J=$.project?.goal??"";if(Z.push(X$($)),Z.push(""),Z.push(`# CLAUDE.md — ${X}`),Z.push(""),J)Z.push("## What This Is"),Z.push(""),Z.push(J),Z.push("");let q=$.stack??{},Q=[];if(z)Q.push(`**Language:** ${z}`);for(let[U,W]of Object.entries(q))if(W&&W!=="slotignored"&&String(W).trim()){let V=U.replace(/_/g," ").replace(/\b\w/g,(H)=>H.toUpperCase());Q.push(`**${V}:** ${W}`)}if(Q.length>0){Z.push("## Stack"),Z.push("");for(let U of Q)Z.push(`- ${U}`);Z.push("")}let Y=$.human_context??{},G=[["Who",Y.who],["What",Y.what],["Why",Y.why],["Where",Y.where],["When",Y.when],["How",Y.how]].filter(([U,W])=>W&&String(W).trim());if(G.length>0){Z.push("## Context"),Z.push("");for(let[U,W]of G)Z.push(`- **${U}:** ${W}`);Z.push("")}return Z.push("---"),Z.push(""),Z.push(`*${OK} — ${new Date().toISOString()}*`),Z.push(""),Z.join(`
|
|
213
|
+
`)}function q9($,Z){let X=X$(Z),z=$.split(`
|
|
213
214
|
`);if(z[0]?.startsWith("<!-- faf:")){if(z[0]===X)return{content:$,changed:!1};return z[0]=X,{content:z.join(`
|
|
214
|
-
`),changed:!0}}return{content
|
|
215
|
+
`),changed:!0}}return{content:`${X}
|
|
215
216
|
|
|
216
|
-
|
|
217
|
+
${$}`,changed:!0}}function R2($){let Z={project:{}},X=$.match(/^# CLAUDE\.md\s*[—–-]\s*(.+)$/m);if(X)Z.project.name=X[1].trim();if(!Z.project.name){let q=$.match(/\*\*Name:\*\*\s*(.+)/);if(q)Z.project.name=q[1].trim()}let z=$.match(/## What This Is\s*\n\s*\n(.+)/);if(z)Z.project.goal=z[1].trim();if(!Z.project.goal){let q=$.match(/\*\*What Building:\*\*\s*(.+)/);if(q)Z.project.goal=q[1].trim()}let J=$.match(/\*\*Language:\*\*\s*(.+)/);if(J)Z.project.main_language=J[1].trim();if(!Z.project.main_language){let q=$.match(/\*\*Main Language:\*\*\s*(.+)/);if(q)Z.project.main_language=q[1].trim()}return Z}import{readFileSync as aN,writeFileSync as wK,existsSync as oN}from"fs";import{join as RK}from"path";function Q9($,Z){wK(RK($,"MEMORY.md"),Z,"utf-8")}P0();b0();l();function i$(){return process.env.FAF_PRO==="1"||process.env.FAF_PRO==="true"}function u5($={}){let Z=process.cwd(),X=g(Z);if(!X)console.error(`Error: project.faf not found
|
|
217
218
|
|
|
218
|
-
Run 'faf init' to create one.`),process.exit(2);let z=
|
|
219
|
-
`)
|
|
220
|
-
`}function
|
|
219
|
+
Run 'faf init' to create one.`),process.exit(2);let z=v5(Z,"CLAUDE.md"),J=v5(Z,"MEMORY.md"),q=$.direction??"auto";if(q==="auto")Y9(X,z,Z);else if(q==="push")G9(X,Z);else if(q==="pull")m5(X,z);if(i$())U9(X,J,Z);if($.watch)console.log(N("watching for changes... (Ctrl+C to stop)")),AK(X,z,J,Z)}function Y9($,Z,X){let z=F2($).mtimeMs,J=O$(Z)?F2(Z).mtimeMs:0;if(!O$(Z)||z>J)G9($,X);else m5($,Z)}function G9($,Z){let X=v5(Z,"CLAUDE.md"),z=c($);if(O$(X)){let Q=g5(Z);if(Q){let{content:Y,changed:G}=q9(Q,z);if(G)h5(Z,Y),console.log(`${O("◆")} sync .faf → CLAUDE.md (stamped) ${N("← bi-sync")}`);else console.log(`${O("◆")} sync CLAUDE.md up-to-date ${N("← bi-sync")}`)}m5($,X);return}let J=J9(z);h5(Z,J),console.log(`${O("◆")} sync .faf → CLAUDE.md (created) ${N("← bi-sync")}`);let q=e(t(m($)));J0(q,$)}function m5($,Z){let X=g5(Z.replace("/CLAUDE.md",""));if(!X){console.error("CLAUDE.md not found.");return}let z=R2(X),J=c($);if(z.project?.name)J.project={...J.project,name:z.project.name};if(z.project?.goal)J.project={...J.project,goal:z.project.goal};if(z.project?.main_language)J.project={...J.project,main_language:z.project.main_language};s($,J),console.log(`${O("◆")} sync CLAUDE.md → .faf ${N("← bi-sync")}`);let q=e(t(m($)));J0(q,$)}function U9($,Z,X){let z=c($),J=F2($).mtimeMs,q=O$(Z)?F2(Z).mtimeMs:0;if(!O$(Z)||J>q){let Q=FK(z);Q9(X,Q),console.log(`${O("◆")} sync .faf → MEMORY.md ${N("← tri-sync")}`)}else console.log(`${O("◆")} sync MEMORY.md → .faf ${N("← tri-sync")}`)}function FK($){let Z=$.project??{},X=[`# ${Z.name??"Project"} — Memory Topics`,"","> Generated by faf sync (tri-sync)",""];if(Z.name)X.push(`- **Project:** ${Z.name}`);if(Z.goal)X.push(`- **Goal:** ${Z.goal}`);if(Z.main_language)X.push(`- **Language:** ${Z.main_language}`);if(Z.type)X.push(`- **Type:** ${Z.type}`);return`${X.join(`
|
|
220
|
+
`)}
|
|
221
|
+
`}function AK($,Z,X,z){let{watch:J}=G0("fs"),q=null,Q=()=>{if(q)clearTimeout(q);q=setTimeout(()=>{if(console.log(N("change detected...")),Y9($,Z,z),i$())U9($,X,z)},200)};if(J($,Q),O$(Z))J(Z,Q);if(i$()&&O$(X))J(X,Q)}Z0();l();import{writeFileSync as PK}from"fs";function W9($,Z={}){let X=$??g();if(!X)console.error(`Error: project.faf not found
|
|
221
222
|
|
|
222
|
-
Run 'faf init' to create one.`),process.exit(2);let z=
|
|
223
|
+
Run 'faf init' to create one.`),process.exit(2);let z=m(X),J=yz(z),q=Z.output??X.replace(/\.faf$/,".fafb");PK(q,J),console.log(`${O("compiled")} ${q} ${N(`(${J.length} bytes)`)}`)}import{readFileSync as _K}from"fs";function H9($,Z={}){if(!$)console.error("Error: Please specify a .fafb file to decompile."),process.exit(1);let X=new Uint8Array(_K($));if(String.fromCharCode(X[0],X[1],X[2],X[3])!=="FAFB")console.error("Error: Not a valid .fafb file (missing FAFB magic bytes)."),process.exit(3);let z=fz(X);console.log(JSON.stringify(z,null,2))}Z0();function V9($){let Z=[];if(!$||typeof $!=="object")return Z.push("File is not a valid YAML mapping"),{valid:!1,errors:Z};let X=$;if(!X.faf_version)Z.push("Missing required field: faf_version");if(!X.project?.name)Z.push("Missing required field: project.name");return{valid:Z.length===0,errors:Z}}P0();b0();l();function d5($,Z={}){let X=$??g();if(!X)console.error(`Error: project.faf not found
|
|
223
224
|
|
|
224
|
-
Run 'faf init' to create one.`),process.exit(2);let z=
|
|
225
|
-
--strict requires 100%`)),process.exit(1)}import{writeFileSync as
|
|
226
|
-
`)}function
|
|
227
|
-
`)}function
|
|
228
|
-
`)}function
|
|
225
|
+
Run 'faf init' to create one.`),process.exit(2);let z=c(X),J=V9(z);if(!J.valid){console.log(`${b("invalid")} ${X}`);for(let Y of J.errors)console.log(` ${N("x")} ${Y}`);process.exit(3)}let q=m(X);if(!kz(q))console.log(`${b("invalid yaml")} ${X}`),process.exit(3);console.log(`${O("valid")} ${X}`);let Q=e(t(q));if(J0(Q,X),Z.strict&&Q.score<100)console.log(N(`
|
|
226
|
+
--strict requires 100%`)),process.exit(1)}Z0();import{writeFileSync as CK}from"fs";import{join as EK}from"path";function SK($){let Z=[];if(Z.push(X$($)),Z.push(""),Z.push(`# AGENTS.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Auto-generated from project.faf — do not edit directly"),Z.push(""),Z.push("## Project Context"),Z.push(""),$.project?.name)Z.push(`- **Name:** ${$.project.name}`);if($.project?.goal)Z.push(`- **Goal:** ${$.project.goal}`);if($.project?.main_language)Z.push(`- **Language:** ${$.project.main_language}`);if(Z.push(""),Z.push("## Stack"),Z.push(""),$.stack){for(let[X,z]of Object.entries($.stack))if(z&&z!=="slotignored"&&z!=="")Z.push(`- **${X}:** ${z}`)}if($.human_context){Z.push(""),Z.push("## Human Context"),Z.push("");for(let[X,z]of Object.entries($.human_context))if(z&&z!=="")Z.push(`- **${X}:** ${z}`)}return Z.push(""),Z.join(`
|
|
227
|
+
`)}function K9($,Z){CK(EK($,"AGENTS.md"),SK(Z),"utf-8")}import{writeFileSync as jK}from"fs";import{join as bK}from"path";function xK($){let Z=[];if(Z.push(X$($)),Z.push(""),Z.push("# .cursorrules"),Z.push(`# Auto-generated from project.faf — ${$.project?.name??"Project"}`),Z.push(""),$.project?.main_language)Z.push(`language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("# Stack");for(let[X,z]of Object.entries($.stack))if(z&&z!=="slotignored"&&z!=="")Z.push(`# ${X}: ${z}`)}return Z.push(""),Z.join(`
|
|
228
|
+
`)}function B9($,Z){jK(bK($,".cursorrules"),xK(Z),"utf-8")}import{writeFileSync as kK}from"fs";import{join as yK}from"path";function fK($){let Z=[];if(Z.push(X$($)),Z.push(""),Z.push(`# GEMINI.md — ${$.project?.name??"Project"}`),Z.push(""),Z.push("> Auto-generated from project.faf"),Z.push(""),$.project?.name)Z.push(`Project: ${$.project.name}`);if($.project?.goal)Z.push(`Goal: ${$.project.goal}`);if($.project?.main_language)Z.push(`Language: ${$.project.main_language}`);if($.stack){Z.push(""),Z.push("## Stack");for(let[X,z]of Object.entries($.stack))if(z&&z!=="slotignored"&&z!=="")Z.push(`- ${X}: ${z}`)}return Z.push(""),Z.join(`
|
|
229
|
+
`)}function D9($,Z){kK(yK($,"GEMINI.md"),fK(Z),"utf-8")}l();function c6($={}){let Z=g();if(!Z)console.error(`Error: project.faf not found
|
|
229
230
|
|
|
230
|
-
Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=
|
|
231
|
+
Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=c(Z),J=$.all||!$.agents&&!$.cursor&&!$.gemini&&!$.conductor;if(J||$.agents)K9(X,z),console.log(" AGENTS.md");if(J||$.cursor)B9(X,z),console.log(" .cursorrules");if(J||$.gemini)D9(X,z),console.log(" GEMINI.md");console.log(`${O("exported")} ${N(`from ${Z}`)}`)}w2();Z0();P0();b0();l();import{mkdirSync as gK,rmSync as hK}from"fs";import{join as L9}from"path";import{execSync as vK}from"child_process";import{tmpdir as uK}from"os";function N9($){if(!$)console.error(`Error: Please provide a GitHub URL.
|
|
231
232
|
|
|
232
|
-
Usage: faf git <url>`),process.exit(1);let Z=$.endsWith(".git")?$:`${$}.git`,X=
|
|
233
|
-
`);let $=new Map;for(let Z of
|
|
233
|
+
Usage: faf git <url>`),process.exit(1);let Z=$.endsWith(".git")?$:`${$}.git`,X=L9(uK(),`faf-git-${Date.now()}`);gK(X,{recursive:!0});try{console.log(N(`cloning ${$}...`)),vK(`git clone --depth 1 ${Z} ${X}`,{stdio:"pipe"});let z=l$(X),J=L9(process.cwd(),"project.faf");s(J,z),console.log(`${O("created")} ${J}`);let q=m(J),Q=e(t(q));J0(Q,J)}finally{hK(X,{recursive:!0,force:!0})}}l();function T9($={}){if($.version||Object.keys($).length===0)dK()}function dK(){let $=I9();console.log(`${O(b("faf"))} v${$.version}`),console.log(N(`kernel ${gz()} IANA application/vnd.faf+yaml`))}var p6=[{name:"HTML",extensions:[".html",".htm"],category:"web"},{name:"CSS",extensions:[".css"],category:"web"},{name:"JavaScript",extensions:[".js",".mjs",".cjs"],category:"web"},{name:"TypeScript",extensions:[".ts",".tsx",".mts",".cts"],category:"web"},{name:"JSX",extensions:[".jsx"],category:"web"},{name:"Vue",extensions:[".vue"],category:"web"},{name:"Svelte",extensions:[".svelte"],category:"web"},{name:"Astro",extensions:[".astro"],category:"web"},{name:"JSON",extensions:[".json"],category:"data"},{name:"YAML",extensions:[".yml",".yaml"],category:"data"},{name:"TOML",extensions:[".toml"],category:"data"},{name:"XML",extensions:[".xml"],category:"data"},{name:"CSV",extensions:[".csv"],category:"data"},{name:"INI",extensions:[".ini",".cfg"],category:"config"},{name:"Env",extensions:[".env"],category:"config"},{name:"Dockerfile",extensions:["Dockerfile"],category:"config"},{name:"Rust",extensions:[".rs"],category:"systems"},{name:"Go",extensions:[".go"],category:"systems"},{name:"C",extensions:[".c",".h"],category:"systems"},{name:"C++",extensions:[".cpp",".cc",".hpp"],category:"systems"},{name:"Zig",extensions:[".zig"],category:"systems"},{name:"Python",extensions:[".py"],category:"scripting"},{name:"Ruby",extensions:[".rb"],category:"scripting"},{name:"Shell",extensions:[".sh",".bash",".zsh"],category:"scripting"},{name:"Lua",extensions:[".lua"],category:"scripting"},{name:"Java",extensions:[".java"],category:"jvm"},{name:"Kotlin",extensions:[".kt",".kts"],category:"jvm"},{name:"Scala",extensions:[".scala"],category:"jvm"},{name:"C#",extensions:[".cs"],category:"dotnet"},{name:"F#",extensions:[".fs"],category:"dotnet"},{name:"Swift",extensions:[".swift"],category:"mobile"},{name:"Dart",extensions:[".dart"],category:"mobile"},{name:"Markdown",extensions:[".md",".mdx"],category:"docs"},{name:"LaTeX",extensions:[".tex"],category:"docs"},{name:"reStructuredText",extensions:[".rst"],category:"docs"},{name:"FAF",extensions:[".faf"],category:"faf"},{name:"FAFb",extensions:[".fafb"],category:"faf"}];l();function M9(){console.log(`${O("formats")} ${N("— supported file types")}
|
|
234
|
+
`);let $=new Map;for(let Z of p6){let X=$.get(Z.category)??[];X.push(Z),$.set(Z.category,X)}for(let[Z,X]of $){console.log(` ${b(Z)}`);for(let z of X)console.log(` ${z.name} ${N(z.extensions.join(", "))}`);console.log()}console.log(N(` ${p6.length} formats across ${$.size} categories`))}l();import{readdirSync as cK,rmSync as pK}from"fs";import{tmpdir as lK}from"os";import{join as iK}from"path";function O9(){let $=lK(),Z=0;try{let X=cK($);for(let z of X)if(z.startsWith("faf-git-"))pK(iK($,z),{recursive:!0,force:!0}),Z++}catch{}if(Z>0)console.log(`${O("cleared")} ${Z} cached director${Z===1?"y":"ies"}`);else console.log(N("nothing to clear"))}Z0();function w9($={}){let Z=g();if(!Z)console.error(`Error: project.faf not found
|
|
234
235
|
|
|
235
|
-
Run 'faf init' to create one.`),process.exit(2);if($.json){let X=
|
|
236
|
+
Run 'faf init' to create one.`),process.exit(2);if($.json){let X=c(Z);console.log(JSON.stringify(X,null,2))}else{let X=m(Z);console.log(X)}}Z0();h0();l();function R9(){let $=g();if(!$)console.error(`Error: project.faf not found
|
|
236
237
|
|
|
237
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
238
|
-
`))}import{existsSync as
|
|
238
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=c($),X=[];for(let z of H0){let[J,q]=z.path.split("."),Y=Z[J]?.[q];if(d$(Y)||Y==="slotignored")continue;X.push(`${z.path}: ${Y}`)}if(X.length===0){console.log(N("no populated slots"));return}console.log(X.join(`
|
|
239
|
+
`))}Z0();l();import{existsSync as nK,statSync as F9}from"fs";import{join as sK}from"path";var rK=["CLAUDE.md","AGENTS.md",".cursorrules","GEMINI.md"];function A9(){let $=g();if(!$)console.error(`Error: project.faf not found
|
|
239
240
|
|
|
240
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=
|
|
241
|
-
`),console.log(` ${b(".faf")} ${
|
|
242
|
-
run ${b("'faf sync'")} to resolve drift`))}function
|
|
241
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=process.cwd(),X=F9($).mtimeMs;console.log(`${O("drift")} ${N("— context file sync status")}
|
|
242
|
+
`),console.log(` ${b(".faf")} ${N(c5(X))}`);let z=0;for(let J of rK){let q=sK(Z,J);if(!nK(q)){console.log(` ${N("○")} ${J} ${N("missing")}`);continue}let Q=F9(q).mtimeMs,Y=Q-X;if(Math.abs(Y)<1000)console.log(` ${O("●")} ${J} ${N("in sync")}`);else if(Y>0)console.log(` ${b("!")} ${J} ${b("newer")} ${N(c5(Q))}`),z++;else console.log(` ${N("○")} ${J} ${N("older")} ${N(c5(Q))}`),z++}if(z>0)console.log(N(`
|
|
243
|
+
run ${b("'faf sync'")} to resolve drift`))}function c5($){let Z=Date.now()-$,X=Math.floor(Z/1000);if(X<60)return`${X}s ago`;let z=Math.floor(X/60);if(z<60)return`${z}m ago`;let J=Math.floor(z/60);if(J<24)return`${J}h ago`;return`${Math.floor(J/24)}d ago`}Z0();l();function P9($,Z){if(!$||Z===void 0)console.error(`Usage: faf edit <path> <value>
|
|
243
244
|
|
|
244
245
|
Example: faf edit project.name "My Project"`),process.exit(1);let X=g();if(!X)console.error(`Error: project.faf not found
|
|
245
246
|
|
|
246
|
-
Run 'faf init' to create one.`),process.exit(2);let z=
|
|
247
|
+
Run 'faf init' to create one.`),process.exit(2);let z=c(X),J=$.split(".");if(J.length!==2)console.error("Error: path must be section.field (e.g. project.name)"),process.exit(1);let[q,Q]=J;if(!z[q]||typeof z[q]!=="object")z[q]={};z[q][Q]=Z,s(X,z),console.log(`${O("updated")} ${$} ${N("→")} ${Z}`)}Z0();import{existsSync as A2,readFileSync as p5}from"fs";import{join as l6}from"path";l();function _9(){let $=process.cwd(),Z=[],X={faf_version:"3.0",project:{}},z=l6($,"CLAUDE.md");if(A2(z)){let G=p5(z,"utf-8"),U=R2(G);if(U.project?.name)X.project.name=U.project.name;if(U.project?.goal)X.project.goal=U.project.goal;if(U.project?.main_language)X.project.main_language=U.project.main_language;Z.push("CLAUDE.md")}let J=l6($,"AGENTS.md");if(A2(J)){let G=p5(J,"utf-8");if(!X.project.name){let U=G.match(/^#\s+(.+)/m);if(U)X.project.name=U[1].trim()}Z.push("AGENTS.md")}let q=l6($,"GEMINI.md");if(A2(q)){let G=p5(q,"utf-8");if(!X.project.name){let U=G.match(/^#\s+(.+)/m);if(U)X.project.name=U[1].trim()}Z.push("GEMINI.md")}let Q=l6($,".cursorrules");if(A2(Q))Z.push(".cursorrules");if(Z.length===0)console.error("No context files found (CLAUDE.md, AGENTS.md, GEMINI.md, .cursorrules)."),process.exit(2);let Y=g($);if(Y){let G=c(Y);if(!G.project)G.project={};if(X.project.name&&!G.project.name)G.project.name=X.project.name;if(X.project.goal&&!G.project.goal)G.project.goal=X.project.goal;if(X.project.main_language&&!G.project.main_language)G.project.main_language=X.project.main_language;s(Y,G),console.log(`${O("◆")} recover merged into ${Y}`)}else{let G=l6($,"project.faf");s(G,X),console.log(`${O("◆")} recover created ${G}`)}console.log(N(` sources: ${Z.join(", ")}`))}Z0();l();var i6="3.0";function C9($={}){let Z=g();if(!Z)console.error(`Error: project.faf not found
|
|
247
248
|
|
|
248
|
-
Run 'faf init' to create one.`),process.exit(2);let X=
|
|
249
|
-
`),console.log(` Status: ${
|
|
250
|
-
`);let $=[["tri-sync",".faf ↔ CLAUDE.md ↔ MEMORY.md"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,X]of $)console.log(` ${
|
|
251
|
-
`),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(
|
|
249
|
+
Run 'faf init' to create one.`),process.exit(2);let X=c(Z),z=X.faf_version??"unknown";if(z===i6){console.log(`${O("◆")} migrate already at v${i6}`);return}if(X.faf_version=i6,!X.project)X.project={};if(!X.stack)X.stack={};if(!X.human_context)X.human_context={};if(!X.monorepo)X.monorepo={};if($.dryRun){console.log(`${O("◆")} migrate ${N("(dry run)")} v${z} → v${i6}`),console.log(N(` would update ${Z}`));return}s(Z,X),console.log(`${O("◆")} migrate v${z} → v${i6}`),console.log(N(` updated ${Z}`))}l();function c9($){if($==="features")GB();else if($==="activate")UB();else YB()}function YB(){let $=i$();if(console.log(`${O("pro")} ${N("— FAF Pro status")}
|
|
250
|
+
`),console.log(` Status: ${$?$$(b("PRO")):b("Free")}`),console.log(""),!$)console.log(N(" Upgrade: faf pro activate"))}function GB(){console.log(`${O("pro")} ${N("— Pro features")}
|
|
251
|
+
`);let $=[["tri-sync",".faf ↔ CLAUDE.md ↔ MEMORY.md"],["enterprise slots","33-slot scoring (slots 22-33)"],["advanced analytics","Drift tracking & team metrics"]];for(let[Z,X]of $)console.log(` ${O("◆")} ${b(Z)} ${N("—")} ${X}`);console.log("")}function UB(){console.log(`${O("pro")} ${N("— activate")}
|
|
252
|
+
`),console.log(" Set FAF_PRO=1 in your environment to enable Pro features."),console.log(""),console.log(N(" export FAF_PRO=1")),console.log("");try{d9()("https://faf.one/pro")}catch{console.log(N(" Visit: https://faf.one/pro"))}}Z0();l();import{gzipSync as WB}from"zlib";function p9($={}){let Z=g();if(!Z)console.error(`Error: project.faf not found
|
|
252
253
|
|
|
253
|
-
Run 'faf init' to create one.`),process.exit(2);let X=
|
|
254
|
-
`),console.log(` ${q}`),$.copy)try{let{execSync:Q}=
|
|
255
|
-
copied to clipboard`))}catch{console.log(
|
|
256
|
-
copy failed — install xclip or pbcopy`))}}import{mkdirSync as
|
|
257
|
-
`);let Z=`faf_version:
|
|
254
|
+
Run 'faf init' to create one.`),process.exit(2);let X=m(Z),J=WB(Buffer.from(X)).toString("base64url");if($.raw){console.log(J);return}let q=`https://faf.one/share?d=${J}`;if(console.log(`${O("◆")} share ${N(Z)}
|
|
255
|
+
`),console.log(` ${q}`),$.copy)try{let{execSync:Q}=G0("child_process"),Y=process.platform;if(Y==="darwin")Q("pbcopy",{input:q});else if(Y==="linux")Q("xclip -selection clipboard",{input:q});console.log(N(`
|
|
256
|
+
copied to clipboard`))}catch{console.log(N(`
|
|
257
|
+
copy failed — install xclip or pbcopy`))}}Z0();P0();b0();l();import{mkdirSync as HB,writeFileSync as VB,rmSync as KB}from"fs";import{tmpdir as BB}from"os";import{join as l9}from"path";function i9(){let $=l9(BB(),`faf-demo-${Date.now()}`);HB($,{recursive:!0}),console.log(`${O("demo")} ${N("— FAF in action")}
|
|
258
|
+
`);let Z=`faf_version: "3.0"
|
|
258
259
|
project:
|
|
259
260
|
name: acme-app
|
|
260
261
|
goal: Full-stack web application for team collaboration
|
|
@@ -279,25 +280,25 @@ human_context:
|
|
|
279
280
|
where: Cloud (Vercel + AWS)
|
|
280
281
|
when: "2026"
|
|
281
282
|
how: Agile sprints with CI/CD
|
|
282
|
-
`,X=
|
|
283
|
-
`)),console.log(` ${b("2.")} Scoring...`);let z=t(
|
|
284
|
-
${
|
|
285
|
-
`);for(let Q of q)console.log(` ${b(`#${Q.index}`)} ${Q.path} ${
|
|
286
|
-
`);for(let Q of q)console.log(` ${b(Q.name)} ${
|
|
283
|
+
`,X=l9($,"project.faf");VB(X,Z),console.log(` ${b("1.")} Created sample project.faf`),console.log(N(` ${X}
|
|
284
|
+
`)),console.log(` ${b("2.")} Scoring...`);let z=e(t(m(X)));console.log(""),J0(z,"project.faf",!0),KB($,{recursive:!0,force:!0}),console.log(`
|
|
285
|
+
${N(' Demo complete. Run "faf init" in your project to get started.')}`)}h0();l();function n9($,Z={}){if(!$)console.error("Usage: faf search <keyword>"),process.exit(2);let X=$.toLowerCase(),z=!Z.slots&&!Z.formats,J=0;if(z||Z.slots){let q=H0.filter((Q)=>Q.path.toLowerCase().includes(X)||Q.description.toLowerCase().includes(X)||Q.category.toLowerCase().includes(X));if(q.length>0){console.log(`${O("slots")} ${N(`— ${q.length} match${q.length===1?"":"es"}`)}
|
|
286
|
+
`);for(let Q of q)console.log(` ${b(`#${Q.index}`)} ${Q.path} ${N("—")} ${Q.description} ${N(`[${Q.category}]`)}`);console.log(""),J+=q.length}}if(z||Z.formats){let q=p6.filter((Q)=>Q.name.toLowerCase().includes(X)||Q.extensions.some((Y)=>Y.toLowerCase().includes(X))||Q.category.toLowerCase().includes(X));if(q.length>0){console.log(`${O("formats")} ${N(`— ${q.length} match${q.length===1?"":"es"}`)}
|
|
287
|
+
`);for(let Q of q)console.log(` ${b(Q.name)} ${N(Q.extensions.join(", "))} ${N(`[${Q.category}]`)}`);console.log(""),J+=q.length}}if(J===0)console.log(N(` No results for "${$}"`))}Z0();P0();l();import{writeFileSync as DB}from"fs";function s9($={}){let Z=g();if(!Z)console.error(`Error: project.faf not found
|
|
287
288
|
|
|
288
|
-
Run 'faf init' to create one.`),process.exit(2);let X=
|
|
289
|
+
Run 'faf init' to create one.`),process.exit(2);let X=c(Z),z=m(Z),J=e(t(z)),q={taf_version:"1.0.0",generated:new Date().toISOString(),source:Z,project:X.project?.name??"unknown",faf_version:X.faf_version??"unknown",score:J.score,tier:J.tier.name,populated:J.populated,active:J.active,total:J.total,slots:J.slots},Q=JSON.stringify(q,null,2);if($.output)DB($.output,Q,"utf-8"),console.log(`${O("◆")} taf receipt written to ${$.output}`);else console.log(Q)}Z0();h0();h0();P0();b0();l();import{createInterface as LB}from"readline";import{existsSync as r9,readFileSync as NB,writeFileSync as IB,unlinkSync as TB}from"fs";import{join as MB}from"path";var OB=".faf-session.json";function wB($,Z){let X=Z.split("."),z=$;for(let J of X){if(z===null||z===void 0||typeof z!=="object")return;z=z[J]}return z}function RB($,Z,X){let z=Z.split("."),J=$;for(let q=0;q<z.length-1;q++){if(!J[z[q]]||typeof J[z[q]]!=="object")J[z[q]]={};J=J[z[q]]}J[z[z.length-1]]=X}async function a9($={}){let Z=g();if(!Z)console.error(`Error: project.faf not found
|
|
289
290
|
|
|
290
|
-
Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=
|
|
291
|
-
`));let Y=
|
|
292
|
-
session saved. Resume with: faf go --resume`));break}if(T.toLowerCase()==="skip"||T.trim()==="")continue;
|
|
293
|
-
${
|
|
294
|
-
`),console.log(` ${b("faf ai enhance")} ${
|
|
291
|
+
Run 'faf init' to create one.`),process.exit(2);let X=process.cwd(),z=MB(X,OB),J=0;if($.resume&&r9(z))try{J=JSON.parse(NB(z,"utf-8")).slotIndex,console.log(N(` resuming from slot #${J+1}`))}catch{}let q=c(Z),Q=H0.filter((H)=>{let D=wB(q,H.path);return d$(D)&&D!=="slotignored"});if(Q.length===0){console.log(`${O("◆")} go all slots populated`);let H=e(t(m(Z)));J0(H,Z);return}console.log(`${O("go")} ${N("— guided interview")}`),console.log(N(` ${Q.length} empty slots. Enter a value, "skip" to skip, or "quit" to stop.
|
|
292
|
+
`));let Y=LB({input:process.stdin,output:process.stdout}),G=(H)=>new Promise((D)=>Y.question(H,D)),U=0,W=Q.slice(J);for(let H=0;H<W.length;H++){let D=W[H],T=await G(` ${b(`#${D.index}`)} ${D.description} ${N(`(${D.path})`)}: `);if(T.toLowerCase()==="quit"){let B={slotIndex:J+H,fafPath:Z};IB(z,JSON.stringify(B),"utf-8"),console.log(N(`
|
|
293
|
+
session saved. Resume with: faf go --resume`));break}if(T.toLowerCase()==="skip"||T.trim()==="")continue;RB(q,D.path,T.trim()),U++}if(Y.close(),U>0)s(Z,q),console.log(`
|
|
294
|
+
${O("◆")} go filled ${U} slot${U===1?"":"s"}`);let V=e(t(m(Z)));if(J0(V,Z),r9(z))try{TB(z)}catch{}}Z0();h0();h0();P0();b0();l();function GD($,Z){let X=Z.split("."),z=$;for(let J of X){if(z===null||z===void 0||typeof z!=="object")return;z=z[J]}return z}function UD($,Z,X){let z=Z.split("."),J=$;for(let q=0;q<z.length-1;q++){if(!J[z[q]]||typeof J[z[q]]!=="object")J[z[q]]={};J=J[z[q]]}J[z[z.length-1]]=X}async function rJ($){if($==="analyze")await HD();else if($==="enhance")await WD();else console.log(`${O("ai")} ${N("— AI-powered features")}
|
|
295
|
+
`),console.log(` ${b("faf ai enhance")} ${N("— fill empty slots via Claude")}`),console.log(` ${b("faf ai analyze")} ${N("— get improvement suggestions")}`),console.log(""),console.log(N(" Requires ANTHROPIC_API_KEY environment variable."))}async function aJ(){let $=process.env.ANTHROPIC_API_KEY;if(!$)console.error(`Error: ANTHROPIC_API_KEY not set.
|
|
295
296
|
|
|
296
|
-
export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (
|
|
297
|
+
export ANTHROPIC_API_KEY=sk-...`),process.exit(2);try{let{default:Z}=await Promise.resolve().then(() => (sJ(),nJ));return new Z({apiKey:$})}catch{console.error(`Error: @anthropic-ai/sdk not installed.
|
|
297
298
|
|
|
298
|
-
npm install @anthropic-ai/sdk`),process.exit(2)}}async function
|
|
299
|
+
npm install @anthropic-ai/sdk`),process.exit(2)}}async function WD(){let $=g();if(!$)console.error(`Error: project.faf not found
|
|
299
300
|
|
|
300
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
301
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=c($),X=m($),z=H0.filter((G)=>{let U=GD(Z,G.path);return d$(U)&&U!=="slotignored"});if(z.length===0){console.log(`${O("◆")} ai enhance all slots populated`);return}console.log(`${O("ai")} enhance ${N(`filling ${z.length} empty slots...`)}`);let J=await aJ(),q=z.map((G)=>`- ${G.path}: ${G.description}`).join(`
|
|
301
302
|
`),Q=`Given this project .faf file:
|
|
302
303
|
|
|
303
304
|
${X}
|
|
@@ -307,14 +308,14 @@ Fill in these empty slots with reasonable values based on the project context. R
|
|
|
307
308
|
Empty slots:
|
|
308
309
|
${q}
|
|
309
310
|
|
|
310
|
-
Respond with ONLY valid JSON, no markdown fences.`,Y=await J.messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:Q}]});try{let G=Y.content[0].text,U=JSON.parse(G),W=0;for(let V of z){let H=U[V.path];if(H&&typeof H==="string")
|
|
311
|
-
${
|
|
311
|
+
Respond with ONLY valid JSON, no markdown fences.`,Y=await J.messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:Q}]});try{let G=Y.content[0].text,U=JSON.parse(G),W=0;for(let V of z){let H=U[V.path];if(H&&typeof H==="string")UD(Z,V.path,H),console.log(` ${O("●")} ${V.path} ${N("←")} ${H}`),W++}if(W>0){s($,Z),console.log(`
|
|
312
|
+
${O("◆")} ai enhance filled ${W} slot${W===1?"":"s"}`);let V=e(t(m($)));J0(V,$)}}catch{console.error("Error: Could not parse AI response.")}}async function HD(){let $=g();if(!$)console.error(`Error: project.faf not found
|
|
312
313
|
|
|
313
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
314
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=m($);console.log(`${O("ai")} analyze ${N("getting suggestions...")}`);let z=await(await aJ()).messages.create({model:"claude-haiku-4-5-20251001",max_tokens:1024,messages:[{role:"user",content:`Analyze this .faf project context file and provide 3-5 specific suggestions for improvement. Focus on completeness, accuracy, and best practices.
|
|
314
315
|
|
|
315
316
|
${Z}
|
|
316
317
|
|
|
317
|
-
Be concise. One line per suggestion.`}]});console.log(""),console.log(z.content[0].text)}import{existsSync as
|
|
318
|
-
`),console.log(` ${b("faf conductor import <path>")} ${
|
|
318
|
+
Be concise. One line per suggestion.`}]});console.log(""),console.log(z.content[0].text)}Z0();_5();l();import{existsSync as e4,readFileSync as $7,readdirSync as VD}from"fs";import{join as oJ}from"path";function tJ($,Z){if($==="import")KD(Z);else if($==="export")BD();else console.log(`${O("conductor")} ${N("— conductor integration")}
|
|
319
|
+
`),console.log(` ${b("faf conductor import <path>")} ${N("— import conductor config into .faf")}`),console.log(` ${b("faf conductor export")} ${N("— generate conductor config from .faf")}`)}function KD($){if(!$)console.error("Usage: faf conductor import <path>"),process.exit(2);if(!e4($))console.error(`Error: path not found: ${$}`),process.exit(2);let Z={faf_version:"3.0",project:{}};if(e4($)&&$.endsWith(".json")){let J=JSON.parse($7($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)Z.project.goal=J.description;if(J.language)Z.project.main_language=J.language}else if(e4($)&&($.endsWith(".yml")||$.endsWith(".yaml"))){let J=u6($7($,"utf-8"));if(J.name)Z.project.name=J.name;if(J.description)Z.project.goal=J.description;if(J.language)Z.project.main_language=J.language}else try{let J=VD($);for(let q of J){let Q=oJ($,q);if(q.endsWith(".json"))try{let Y=JSON.parse($7(Q,"utf-8"));if(Y.name&&!Z.project.name)Z.project.name=Y.name;if(Y.description&&!Z.project.goal)Z.project.goal=Y.description}catch{}}}catch{console.error(`Error: could not read directory: ${$}`),process.exit(2)}let X=process.cwd(),z=g(X);if(z){let J=c(z);if(!J.project)J.project={};if(Z.project.name&&!J.project.name)J.project.name=Z.project.name;if(Z.project.goal&&!J.project.goal)J.project.goal=Z.project.goal;if(Z.project.main_language&&!J.project.main_language)J.project.main_language=Z.project.main_language;s(z,J),console.log(`${O("◆")} conductor import merged into ${z}`)}else{let J=oJ(X,"project.faf");s(J,Z),console.log(`${O("◆")} conductor import created ${J}`)}}function BD(){let $=g();if(!$)console.error(`Error: project.faf not found
|
|
319
320
|
|
|
320
|
-
Run 'faf init' to create one.`),process.exit(2);let Z=
|
|
321
|
+
Run 'faf init' to create one.`),process.exit(2);let Z=c($),X={name:Z.project?.name??"",description:Z.project?.goal??"",language:Z.project?.main_language??"",stack:Z.stack??{}};console.log(JSON.stringify(X,null,2))}var eJ="6.0.11",y=new T7;y.name("faf").description("Foundational AI-Context Format — project DNA for any AI").version(eJ,"-v, --version");y.command("init").description("Create .faf from your project").option("--yolo","Quick init with sensible defaults").option("--quick","Alias for --yolo").option("--force","Overwrite existing project.faf").option("--output <path>","Output path").action(($)=>k5($));y.command("auto").description("Zero to 100% in one command").action(()=>y5());y.command("go").description("Guided interview to gold code").option("--resume","Resume previous session").action(($)=>a9($));y.command("score [file]").description("Score a .faf file").option("--verbose","Show slot breakdown").option("--status","Compact one-liner output").option("--json","Output as JSON").action(($,Z)=>b5($,Z));y.command("sync").description(".faf ↔ CLAUDE.md (bi-sync, mtime auto-direction)").option("--watch","Watch for changes").option("--direction <dir>","Force direction: auto|push|pull","auto").action(($)=>u5($));y.command("compile [file]").description("Compile .faf to .fafb binary").option("--output <path>","Output path").action(($,Z)=>W9($,Z));y.command("decompile <file>").description("Decompile .fafb to JSON").option("--output <path>","Output path").action(($,Z)=>H9($,Z));y.command("git <url>").description("Instant .faf from any GitHub repo").action(($)=>N9($));y.command("export").description("Export context files from .faf").option("--agents","Generate AGENTS.md").option("--cursor","Generate .cursorrules").option("--gemini","Generate GEMINI.md").option("--conductor","Generate conductor config").option("--all","Generate all formats").action(($)=>c6($));y.command("check [file]").description("Validate .faf file").option("--strict","Require 100% score").option("--fix","Auto-fix issues").option("--doctor","Full diagnostic").option("--trust","Verify trust chain").action(($,Z)=>d5($,Z));y.command("info").description("Show version and system info").option("--version","Show version").option("--faq","Show FAQ").option("--index","Show command index").option("--stacks","Show supported stacks").action(($)=>T9($));y.command("formats").description("Show supported formats").action(()=>M9());y.command("clear").description("Clear cached data").action(()=>O9());y.command("convert").description("Convert .faf to other formats").option("--json","Output as JSON").action(($)=>w9($));y.command("context").description("Generate context output").action(()=>R9());y.command("drift").description("Check context drift").action(()=>A9());y.command("edit <path> <value>").description("Edit .faf fields").action(($,Z)=>P9($,Z));y.command("recover").description("Recover .faf from context files").action(()=>_9());y.command("migrate").description("Migrate .faf to latest version").option("--dry-run","Preview changes without writing").action(($)=>C9($));y.command("pro [subcommand]").description("Pro features & licensing").action(($)=>c9($));y.command("share").description("Share .faf via URL").option("--copy","Copy to clipboard").option("--raw","Output encoded string only").action(($)=>p9($));y.command("demo").description("Demo walkthrough").action(()=>i9());y.command("search <query>").description("Search slots and formats").option("--slots","Search slots only").option("--formats","Search formats only").action(($,Z)=>n9($,Z));y.command("taf").description("Test Archive Format receipt").option("--output <path>","Write receipt to file").action(($)=>s9($));y.command("ai [subcommand]").description("AI-powered features (enhance|analyze)").action(($)=>rJ($));y.command("conductor [subcommand] [path]").description("Conductor integration").action(($,Z)=>tJ($,Z));y.command("bi-sync",{hidden:!0}).action(()=>u5());y.command("status",{hidden:!0}).action(()=>b5(void 0,{status:!0}));y.command("agents",{hidden:!0}).action(()=>c6({agents:!0}));y.command("cursor",{hidden:!0}).action(()=>c6({cursor:!0}));y.command("gemini",{hidden:!0}).action(()=>c6({gemini:!0}));y.command("validate",{hidden:!0}).action(($)=>d5($));y.command("yolo",{hidden:!0}).action(()=>k5({yolo:!0}));if(process.argv.length<=2){let{bold:$,dim:Z,fafCyan:X}=await Promise.resolve().then(() => (l(),hz)),{autoCommand:z}=await Promise.resolve().then(() => (f5(),Z9)),J=process.cwd().replace(process.env.HOME??"","~"),q="\x1B[38;2;150;150;150m",Q="\x1B[48;2;150;150;150m",Y="\x1B[38;2;29;29;29m",G="\x1B[48;2;29;29;29m",U="\x1B[0m";console.log(""),console.log(`\x1B[48;2;29;29;29m ${"\x1B[38;2;150;150;150m"}▄${"\x1B[48;2;150;150;150m"}███████${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▄${"\x1B[0m"}`),console.log(`\x1B[48;2;29;29;29m \x1B[48;2;150;150;150m${"\x1B[38;2;150;150;150m"}█${"\x1B[48;2;29;29;29m"}${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}███████${"\x1B[0m"} ${X($("faf"))} ${Z(`v${eJ}`)}`);let W="\x1B[38;2;39;174;96m";console.log(`\x1B[48;2;29;29;29m${"\x1B[38;2;150;150;150m"}▀${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;29;29;29m"}▄${"\x1B[48;2;29;29;29m"}${W}░${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"}${W}░░${"\x1B[48;2;150;150;150m"}${"\x1B[38;2;150;150;150m"}██${"\x1B[48;2;29;29;29m"}${W}░${"\x1B[0m"} ${Z("Nelly Never Forgets")}`),console.log(`${W}▔▔▔▔▔▔▔▔▔▔▔▔${"\x1B[0m"}`),console.log(`${Z(` ${J}`)}`),console.log(""),z(),console.log(""),console.log(` ${Z("Run")} ${X("faf --help")} ${Z("for commands")}`)}else y.parse(process.argv);
|