@uipath/coder-tool 1.199.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -0
- package/dist/browser-strategy-123m6nc9.js +16 -0
- package/dist/browser-strategy-fdkppa2b.js +98 -0
- package/dist/index.js +10107 -0
- package/dist/node-strategy-7affvvq6.js +62 -0
- package/dist/node-strategy-xkysgydj.js +10 -0
- package/dist/templates/uipath-cli.md +38 -0
- package/dist/tool-0nch3910.js +10656 -0
- package/dist/tool-80c1s5ej.js +10652 -0
- package/dist/tool-9cbadqp9.js +10713 -0
- package/dist/tool-9pd3s4a8.js +4 -0
- package/dist/tool-9qecd4wb.js +14 -0
- package/dist/tool-9qrx1e8d.js +81 -0
- package/dist/tool-amd86zqj.js +10681 -0
- package/dist/tool-dn9fkh6p.js +10652 -0
- package/dist/tool-dsqjx6h8.js +10729 -0
- package/dist/tool-eqyd37dw.js +144 -0
- package/dist/tool-g78rq70d.js +10871 -0
- package/dist/tool-jjb10rbq.js +4 -0
- package/dist/tool-nvhfxv67.js +1159 -0
- package/dist/tool-vc9mne6b.js +44 -0
- package/dist/tool-vgtq99tg.js +10714 -0
- package/dist/tool.js +29799 -0
- package/package.json +29 -0
- package/src/commands/chat.spec.ts +224 -0
- package/src/commands/chat.ts +156 -0
- package/src/index.ts +27 -0
- package/src/providers/uipath.spec.ts +296 -0
- package/src/providers/uipath.ts +195 -0
- package/src/tool.spec.ts +38 -0
- package/src/tool.ts +20 -0
- package/templates/uipath-cli.md +38 -0
- package/tests/coding-agent.e2e.test.ts +17 -0
- package/tsconfig.json +9 -0
- package/vitest.config.ts +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// ../auth/src/utils/platform.ts
|
|
2
|
+
function isBrowser() {
|
|
3
|
+
return typeof globalThis !== "undefined" && "window" in globalThis && "document" in globalThis;
|
|
4
|
+
}
|
|
5
|
+
function getGlobalThis() {
|
|
6
|
+
if (typeof globalThis !== "undefined") {
|
|
7
|
+
return globalThis;
|
|
8
|
+
}
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { isBrowser, getGlobalThis };
|
|
13
|
+
|
|
14
|
+
//# debugId=718223FBC10121D064756E2164756E21
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import{e as u0}from"./tool-9pd3s4a8.js";import{g as d,h as s}from"./tool-eqyd37dw.js";import{j as P1,k as w0,l as B0,m as b4,n as v4,o as _8}from"./tool-jjb10rbq.js";var o0=w0((y8)=>{class r4 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 M6 extends r4{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}y8.CommanderError=r4;y8.InvalidArgumentError=M6});var O4=w0((m8)=>{var{InvalidArgumentError:f8}=o0();class U6{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 f8(`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 h8($){let Z=$.name()+($.variadic===!0?"...":"");return $.required?"<"+Z+">":"["+Z+"]"}m8.Argument=U6;m8.humanReadableArgName=h8});var s4=w0((c8)=>{var{humanReadableArgName:p8}=O4();class R6{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((Q)=>!Q._hidden),X=$._getHelpCommand();if(X&&!X._hidden)Z.push(X);if(this.sortSubcommands)Z.sort((Q,G)=>{return Q.name().localeCompare(G.name())});return Z}compareOptions($,Z){let X=(Q)=>{return Q.short?Q.short.replace(/^-/,""):Q.long.replace(/^--/,"")};return X($).localeCompare(X(Z))}visibleOptions($){let Z=$.options.filter((Q)=>!Q.hidden),X=$._getHelpOption();if(X&&!X.hidden){let Q=X.short&&$._findOption(X.short),G=X.long&&$._findOption(X.long);if(!Q&&!G)Z.push(X);else if(X.long&&!G)Z.push($.createOption(X.long,X.description));else if(X.short&&!Q)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 Q=X.options.filter((G)=>!G.hidden);Z.push(...Q)}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)=>p8(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,Q)=>{return Math.max(X,this.displayWidth(Z.styleSubcommandTerm(Z.subcommandTerm(Q))))},0)}longestOptionTermLength($,Z){return Z.visibleOptions($).reduce((X,Q)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestGlobalOptionTermLength($,Z){return Z.visibleGlobalOptions($).reduce((X,Q)=>{return Math.max(X,this.displayWidth(Z.styleOptionTerm(Z.optionTerm(Q))))},0)}longestArgumentTermLength($,Z){return Z.visibleArguments($).reduce((X,Q)=>{return Math.max(X,this.displayWidth(Z.styleArgumentTerm(Z.argumentTerm(Q))))},0)}commandUsage($){let Z=$._name;if($._aliases[0])Z=Z+"|"+$._aliases[0];let X="";for(let Q=$.parent;Q;Q=Q.parent)X=Q.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 Q=new Map;return $.forEach((G)=>{let z=X(G);if(!Q.has(z))Q.set(z,[])}),Z.forEach((G)=>{let z=X(G);if(!Q.has(z))Q.set(z,[]);Q.get(z).push(G)}),Q}formatHelp($,Z){let X=Z.padWidth($,Z),Q=Z.helpWidth??80;function G(q,M){return Z.formatItem(q,X,M,Z)}let z=[`${Z.styleTitle("Usage:")} ${Z.styleUsage(Z.commandUsage($))}`,""],Y=Z.commandDescription($);if(Y.length>0)z=z.concat([Z.boxWrap(Z.styleCommandDescription(Y),Q),""]);let K=Z.visibleArguments($).map((q)=>{return G(Z.styleArgumentTerm(Z.argumentTerm(q)),Z.styleArgumentDescription(Z.argumentDescription(q)))});if(z=z.concat(this.formatItemList("Arguments:",K,Z)),this.groupItems($.options,Z.visibleOptions($),(q)=>q.helpGroupHeading??"Options:").forEach((q,M)=>{let C=q.map((E)=>{return G(Z.styleOptionTerm(Z.optionTerm(E)),Z.styleOptionDescription(Z.optionDescription(E)))});z=z.concat(this.formatItemList(M,C,Z))}),Z.showGlobalOptions){let q=Z.visibleGlobalOptions($).map((M)=>{return G(Z.styleOptionTerm(Z.optionTerm(M)),Z.styleOptionDescription(Z.optionDescription(M)))});z=z.concat(this.formatItemList("Global Options:",q,Z))}return this.groupItems($.commands,Z.visibleCommands($),(q)=>q.helpGroup()||"Commands:").forEach((q,M)=>{let C=q.map((E)=>{return G(Z.styleSubcommandTerm(Z.subcommandTerm(E)),Z.styleSubcommandDescription(Z.subcommandDescription(E)))});z=z.concat(this.formatItemList(M,C,Z))}),z.join(`
|
|
2
|
+
`)}displayWidth($){return j6($).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,Q){let z=" ".repeat(2);if(!X)return z+$;let Y=$.padEnd(Z+$.length-Q.displayWidth($)),K=2,H=(this.helpWidth??80)-Z-K-2,q;if(H<this.minWidthToWrap||Q.preformatted(X))q=X;else q=Q.boxWrap(X,H).replace(/\n/g,`
|
|
3
|
+
`+" ".repeat(Z+K));return z+Y+" ".repeat(K)+q.replace(/\n/g,`
|
|
4
|
+
${z}`)}boxWrap($,Z){if(Z<this.minWidthToWrap)return $;let X=$.split(/\r\n|\n/),Q=/[\s]*[^\s]+/g,G=[];return X.forEach((z)=>{let Y=z.match(Q);if(Y===null){G.push("");return}let K=[Y.shift()],D=this.displayWidth(K[0]);Y.forEach((H)=>{let q=this.displayWidth(H);if(D+q<=Z){K.push(H),D+=q;return}G.push(K.join(""));let M=H.trimStart();K=[M],D=this.displayWidth(M)}),G.push(K.join(""))}),G.join(`
|
|
5
|
+
`)}}function j6($){let Z=/\x1b\[\d*(;\d*)*m/g;return $.replace(Z,"")}c8.Help=R6;c8.stripColor=j6});var a4=w0((o8)=>{var{InvalidArgumentError:i8}=o0();class _6{constructor($,Z){this.flags=$,this.description=Z||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let X=n8($);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 i8(`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 O6(this.name().replace(/^no-/,""));return O6(this.name())}helpGroup($){return this.helpGroupHeading=$,this}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class F6{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 Q=this.negativeOptions.get(X).presetArg,G=Q!==void 0?Q:!1;return Z.negate===(G===$)}}function O6($){return $.split("-").reduce((Z,X)=>{return Z+X[0].toUpperCase()+X.slice(1)})}function n8($){let Z,X,Q=/^-[^-]$/,G=/^--[^-]/,z=$.split(/[ |,]+/).concat("guard");if(Q.test(z[0]))Z=z.shift();if(G.test(z[0]))X=z.shift();if(!Z&&Q.test(z[0]))Z=z.shift();if(!Z&&G.test(z[0]))Z=X,X=z.shift();if(z[0].startsWith("-")){let Y=z[0],K=`option creation failed due to '${Y}' in option flags '${$}'`;if(/^-[^-][^-]/.test(Y))throw Error(`${K}
|
|
6
|
+
- a short flag is a single dash and a single character
|
|
7
|
+
- either use a single dash and a single character (for a short flag)
|
|
8
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`);if(Q.test(Y))throw Error(`${K}
|
|
9
|
+
- too many short flags`);if(G.test(Y))throw Error(`${K}
|
|
10
|
+
- too many long flags`);throw Error(`${K}
|
|
11
|
+
- 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}}o8.Option=_6;o8.DualOptions=F6});var I6=w0((e8)=>{function a8($,Z){if(Math.abs($.length-Z.length)>3)return Math.max($.length,Z.length);let X=[];for(let Q=0;Q<=$.length;Q++)X[Q]=[Q];for(let Q=0;Q<=Z.length;Q++)X[0][Q]=Q;for(let Q=1;Q<=Z.length;Q++)for(let G=1;G<=$.length;G++){let z=1;if($[G-1]===Z[Q-1])z=0;else z=1;if(X[G][Q]=Math.min(X[G-1][Q]+1,X[G][Q-1]+1,X[G-1][Q-1]+z),G>1&&Q>1&&$[G-1]===Z[Q-2]&&$[G-2]===Z[Q-1])X[G][Q]=Math.min(X[G][Q],X[G-2][Q-2]+1)}return X[$.length][Z.length]}function t8($,Z){if(!Z||Z.length===0)return"";Z=Array.from(new Set(Z));let X=$.startsWith("--");if(X)$=$.slice(2),Z=Z.map((Y)=>Y.slice(2));let Q=[],G=3,z=0.4;if(Z.forEach((Y)=>{if(Y.length<=1)return;let K=a8($,Y),D=Math.max($.length,Y.length);if((D-K)/D>z){if(K<G)G=K,Q=[Y];else if(K===G)Q.push(Y)}}),Q.sort((Y,K)=>Y.localeCompare(K)),X)Q=Q.map((Y)=>`--${Y}`);if(Q.length>1)return`
|
|
12
|
+
(Did you mean one of ${Q.join(", ")}?)`;if(Q.length===1)return`
|
|
13
|
+
(Did you mean ${Q[0]}?)`;return""}e8.suggestSimilar=t8});var w6=w0((Y1)=>{var Z1=B0("node:events").EventEmitter,t4=B0("node:child_process"),V0=B0("node:path"),_4=B0("node:fs"),u=B0("node:process"),{Argument:X1,humanReadableArgName:J1}=O4(),{CommanderError:e4}=o0(),{Help:Q1,stripColor:G1}=s4(),{Option:L6,DualOptions:z1}=a4(),{suggestSimilar:P6}=I6();class Z9 extends Z1{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)=>u.stdout.write(Z),writeErr:(Z)=>u.stderr.write(Z),outputError:(Z,X)=>X(Z),getOutHelpWidth:()=>u.stdout.isTTY?u.stdout.columns:void 0,getErrHelpWidth:()=>u.stderr.isTTY?u.stderr.columns:void 0,getOutHasColors:()=>$9()??(u.stdout.isTTY&&u.stdout.hasColors?.()),getErrHasColors:()=>$9()??(u.stderr.isTTY&&u.stderr.hasColors?.()),stripColor:(Z)=>G1(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 Q=Z,G=X;if(typeof Q==="object"&&Q!==null)G=Q,Q=null;G=G||{};let[,z,Y]=$.match(/([^ ]+) *(.*)/),K=this.createCommand(z);if(Q)K.description(Q),K._executableHandler=!0;if(G.isDefault)this._defaultCommandName=K._name;if(K._hidden=!!(G.noHelp||G.hidden),K._executableFile=G.executableFile||null,Y)K.arguments(Y);if(this._registerCommand(K),K.parent=this,K.copyInheritedSettings(this),Q)return this;return K}createCommand($){return new Z9($)}createHelp(){return Object.assign(new Q1,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
|
|
14
|
+
- 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 X1($,Z)}argument($,Z,X,Q){let G=this.createArgument($,Z);if(typeof X==="function")G.default(Q).argParser(X);else G.default(X);return this.addArgument(G),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]",[,Q,G]=X.match(/([^ ]+) *(.*)/),z=Z??"display help for command",Y=this.createCommand(Q);if(Y.helpOption(!1),G)Y.arguments(G);if(z)Y.description(z);if(this._addImplicitHelpCommand=!0,this._helpCommand=Y,$||Z)this._initCommandGroup(Y);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 : '${$}'.
|
|
15
|
+
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 e4($,Z,X));u.exit($)}action($){let Z=(X)=>{let Q=this.registeredArguments.length,G=X.slice(0,Q);if(this._storeOptionsAsProperties)G[Q]=this;else G[Q]=this.opts();return G.push(this),$.apply(this,G)};return this._actionHandler=Z,this}createOption($,Z){return new L6($,Z)}_callParseArg($,Z,X,Q){try{return $.parseArg(Z,X)}catch(G){if(G.code==="commander.invalidArgument"){let z=`${Q} ${G.message}`;this.error(z,{exitCode:G.exitCode,code:G.code})}throw G}}_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}'
|
|
16
|
+
- already used by option '${Z.flags}'`)}this._initOptionGroup($),this.options.push($)}_registerCommand($){let Z=(Q)=>{return[Q.name()].concat(Q.aliases())},X=Z($).find((Q)=>this._findCommand(Q));if(X){let Q=Z(this._findCommand(X)).join("|"),G=Z($).join("|");throw Error(`cannot add command '${G}' as already have command '${Q}'`)}this._initCommandGroup($),this.commands.push($)}addOption($){this._registerOption($);let Z=$.name(),X=$.attributeName();if($.negate){let G=$.long.replace(/^--no-/,"--");if(!this._findOption(G))this.setOptionValueWithSource(X,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(X,$.defaultValue,"default");let Q=(G,z,Y)=>{if(G==null&&$.presetArg!==void 0)G=$.presetArg;let K=this.getOptionValue(X);if(G!==null&&$.parseArg)G=this._callParseArg($,G,K,z);else if(G!==null&&$.variadic)G=$._collectValue(G,K);if(G==null)if($.negate)G=!1;else if($.isBoolean()||$.optional)G=!0;else G="";this.setOptionValueWithSource(X,G,Y)};if(this.on("option:"+Z,(G)=>{let z=`error: option '${$.flags}' argument '${G}' is invalid.`;Q(G,z,"cli")}),$.envVar)this.on("optionEnv:"+Z,(G)=>{let z=`error: option '${$.flags}' value '${G}' from env '${$.envVar}' is invalid.`;Q(G,z,"env")});return this}_optionEx($,Z,X,Q,G){if(typeof Z==="object"&&Z instanceof L6)throw Error("To add an Option object use addOption() instead of option() or requiredOption()");let z=this.createOption(Z,X);if(z.makeOptionMandatory(!!$.mandatory),typeof Q==="function")z.default(G).argParser(Q);else if(Q instanceof RegExp){let Y=Q;Q=(K,D)=>{let H=Y.exec(K);return H?H[0]:D},z.default(G).argParser(Q)}else z.default(Q);return this.addOption(z)}option($,Z,X,Q){return this._optionEx({},$,Z,X,Q)}requiredOption($,Z,X,Q){return this._optionEx({mandatory:!0},$,Z,X,Q)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){return this._passThroughOptions=!!$,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties($=!0){if(this.options.length)throw Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,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(u.versions?.electron)Z.from="electron";let Q=u.execArgv??[];if(Q.includes("-e")||Q.includes("--eval")||Q.includes("-p")||Q.includes("--print"))Z.from="eval"}if($===void 0)$=u.argv;this.rawArgs=$.slice();let X;switch(Z.from){case void 0:case"node":this._scriptPath=$[1],X=$.slice(2);break;case"electron":if(u.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.
|
|
17
|
+
- 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(_4.existsSync($))return;let Q=Z?`searched for local subcommand relative to directory '${Z}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",G=`'${$}' does not exist
|
|
18
|
+
- if '${X}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
19
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
20
|
+
- ${Q}`;throw Error(G)}_executeSubCommand($,Z){Z=Z.slice();let X=!1,Q=[".js",".ts",".tsx",".mjs",".cjs"];function G(H,q){let M=V0.resolve(H,q);if(_4.existsSync(M))return M;if(Q.includes(V0.extname(q)))return;let C=Q.find((E)=>_4.existsSync(`${M}${E}`));if(C)return`${M}${C}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let z=$._executableFile||`${this._name}-${$._name}`,Y=this._executableDir||"";if(this._scriptPath){let H;try{H=_4.realpathSync(this._scriptPath)}catch{H=this._scriptPath}Y=V0.resolve(V0.dirname(H),Y)}if(Y){let H=G(Y,z);if(!H&&!$._executableFile&&this._scriptPath){let q=V0.basename(this._scriptPath,V0.extname(this._scriptPath));if(q!==this._name)H=G(Y,`${q}-${$._name}`)}z=H||z}X=Q.includes(V0.extname(z));let K;if(u.platform!=="win32")if(X)Z.unshift(z),Z=C6(u.execArgv).concat(Z),K=t4.spawn(u.argv[0],Z,{stdio:"inherit"});else K=t4.spawn(z,Z,{stdio:"inherit"});else this._checkForMissingExecutable(z,Y,$._name),Z.unshift(z),Z=C6(u.execArgv).concat(Z),K=t4.spawn(u.execPath,Z,{stdio:"inherit"});if(!K.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((q)=>{u.on(q,()=>{if(K.killed===!1&&K.exitCode===null)K.kill(q)})});let D=this._exitCallback;K.on("close",(H)=>{if(H=H??1,!D)u.exit(H);else D(new e4(H,"commander.executeSubCommandAsync","(close)"))}),K.on("error",(H)=>{if(H.code==="ENOENT")this._checkForMissingExecutable(z,Y,$._name);else if(H.code==="EACCES")throw Error(`'${z}' not executable`);if(!D)u.exit(1);else{let q=new e4(1,"commander.executeSubCommandAsync","(error)");q.nestedError=H,D(q)}}),this.runningCommand=K}_dispatchSubcommand($,Z,X){let Q=this._findCommand($);if(!Q)this.help({error:!0});Q._prepareForParse();let G;return G=this._chainOrCallSubCommandHook(G,Q,"preSubcommand"),G=this._chainOrCall(G,()=>{if(Q._executableHandler)this._executeSubCommand(Q,Z.concat(X));else return Q._parseCommand(Z,X)}),G}_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,Q,G)=>{let z=Q;if(Q!==null&&X.parseArg){let Y=`error: command-argument value '${Q}' is invalid for argument '${X.name()}'.`;z=this._callParseArg(X,Q,G,Y)}return z};this._checkNumberOfArguments();let Z=[];this.registeredArguments.forEach((X,Q)=>{let G=X.defaultValue;if(X.variadic){if(Q<this.args.length){if(G=this.args.slice(Q),X.parseArg)G=G.reduce((z,Y)=>{return $(X,Y,z)},X.defaultValue)}else if(G===void 0)G=[]}else if(Q<this.args.length){if(G=this.args[Q],X.parseArg)G=$(X,G,X.defaultValue)}Z[Q]=G}),this.processedArgs=Z}_chainOrCall($,Z){if($?.then&&typeof $.then==="function")return $.then(()=>Z());return Z()}_chainOrCallHooks($,Z){let X=$,Q=[];if(this._getCommandAndAncestors().reverse().filter((G)=>G._lifeCycleHooks[Z]!==void 0).forEach((G)=>{G._lifeCycleHooks[Z].forEach((z)=>{Q.push({hookedCommand:G,callback:z})})}),Z==="postAction")Q.reverse();return Q.forEach((G)=>{X=this._chainOrCall(X,()=>{return G.callback(G.hookedCommand,this)})}),X}_chainOrCallSubCommandHook($,Z,X){let Q=$;if(this._lifeCycleHooks[X]!==void 0)this._lifeCycleHooks[X].forEach((G)=>{Q=this._chainOrCall(Q,()=>{return G(this,Z)})});return Q}_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 Q=()=>{if(X.unknown.length>0)this.unknownOption(X.unknown[0])},G=`command:${this.name()}`;if(this._actionHandler){Q(),this._processArguments();let z;if(z=this._chainOrCallHooks(z,"preAction"),z=this._chainOrCall(z,()=>this._actionHandler(this.processedArgs)),this.parent)z=this._chainOrCall(z,()=>{this.parent.emit(G,$,Z)});return z=this._chainOrCallHooks(z,"postAction"),z}if(this.parent?.listenerCount(G))Q(),this._processArguments(),this.parent.emit(G,$,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 Q(),this._processArguments()}else if(this.commands.length)Q(),this.help({error:!0});else Q(),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 Q=X.attributeName();if(this.getOptionValue(Q)===void 0)return!1;return this.getOptionValueSource(Q)!=="default"});$.filter((X)=>X.conflictsWith.length>0).forEach((X)=>{let Q=$.find((G)=>X.conflictsWith.includes(G.attributeName()));if(Q)this._conflictingOption(X,Q)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let Z=[],X=[],Q=Z;function G(H){return H.length>1&&H[0]==="-"}let z=(H)=>{if(!/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(H))return!1;return!this._getCommandAndAncestors().some((q)=>q.options.map((M)=>M.short).some((M)=>/^-\d$/.test(M)))},Y=null,K=null,D=0;while(D<$.length||K){let H=K??$[D++];if(K=null,H==="--"){if(Q===X)Q.push(H);Q.push(...$.slice(D));break}if(Y&&(!G(H)||z(H))){this.emit(`option:${Y.name()}`,H);continue}if(Y=null,G(H)){let q=this._findOption(H);if(q){if(q.required){let M=$[D++];if(M===void 0)this.optionMissingArgument(q);this.emit(`option:${q.name()}`,M)}else if(q.optional){let M=null;if(D<$.length&&(!G($[D])||z($[D])))M=$[D++];this.emit(`option:${q.name()}`,M)}else this.emit(`option:${q.name()}`);Y=q.variadic?q:null;continue}}if(H.length>2&&H[0]==="-"&&H[1]!=="-"){let q=this._findOption(`-${H[1]}`);if(q){if(q.required||q.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${q.name()}`,H.slice(2));else this.emit(`option:${q.name()}`),K=`-${H.slice(2)}`;continue}}if(/^--[^=]+=/.test(H)){let q=H.indexOf("="),M=this._findOption(H.slice(0,q));if(M&&(M.required||M.optional)){this.emit(`option:${M.name()}`,H.slice(q+1));continue}}if(Q===Z&&G(H)&&!(this.commands.length===0&&z(H)))Q=X;if((this._enablePositionalOptions||this._passThroughOptions)&&Z.length===0&&X.length===0){if(this._findCommand(H)){Z.push(H),X.push(...$.slice(D));break}else if(this._getHelpCommand()&&H===this._getHelpCommand().name()){Z.push(H,...$.slice(D));break}else if(this._defaultCommandName){X.push(H,...$.slice(D));break}}if(this._passThroughOptions){Q.push(H,...$.slice(D));break}Q.push(H)}return{operands:Z,unknown:X}}opts(){if(this._storeOptionsAsProperties){let $={},Z=this.options.length;for(let X=0;X<Z;X++){let Q=this.options[X].attributeName();$[Q]=Q===this._versionOptionName?this._version:this[Q]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,Z)=>Object.assign($,Z.opts()),{})}error($,Z){if(this._outputConfiguration.outputError(`${$}
|
|
21
|
+
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
22
|
+
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
|
|
23
|
+
`),this.outputHelp({error:!0});let X=Z||{},Q=X.exitCode||1,G=X.code||"commander.error";this._exit(Q,G,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in u.env){let Z=$.attributeName();if(this.getOptionValue(Z)===void 0||["default","config","env"].includes(this.getOptionValueSource(Z)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,u.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new z1(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((Q)=>!Z(Q)).forEach((Q)=>{this.setOptionValueWithSource(Q,X.implied[Q],"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=(z)=>{let Y=z.attributeName(),K=this.getOptionValue(Y),D=this.options.find((q)=>q.negate&&Y===q.attributeName()),H=this.options.find((q)=>!q.negate&&Y===q.attributeName());if(D&&(D.presetArg===void 0&&K===!1||D.presetArg!==void 0&&K===D.presetArg))return D;return H||z},Q=(z)=>{let Y=X(z),K=Y.attributeName();if(this.getOptionValueSource(K)==="env")return`environment variable '${Y.envVar}'`;return`option '${Y.flags}'`},G=`error: ${Q($)} cannot be used with ${Q(Z)}`;this.error(G,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let Z="";if($.startsWith("--")&&this._showSuggestionAfterError){let Q=[],G=this;do{let z=G.createHelp().visibleOptions(G).filter((Y)=>Y.long).map((Y)=>Y.long);Q=Q.concat(z),G=G.parent}while(G&&!G._enablePositionalOptions);Z=P6($,Q)}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",G=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Z} argument${X} but got ${$.length}.`;this.error(G,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],Z="";if(this._showSuggestionAfterError){let Q=[];this.createHelp().visibleCommands(this).forEach((G)=>{if(Q.push(G.name()),G.alias())Q.push(G.alias())}),Z=P6($,Q)}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 Q=this.createOption(Z,X);return this._versionOptionName=Q.attributeName(),this._registerOption(Q),this.on("option:"+Q.name(),()=>{this._outputConfiguration.writeOut(`${$}
|
|
24
|
+
`),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 Q=[X.name()].concat(X.aliases()).join("|");throw Error(`cannot add alias '${$}' to command '${this.name()}' as already have command '${Q}'`)}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 J1(X)});return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Z:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}helpGroup($){if($===void 0)return this._helpGroupHeading??"";return this._helpGroupHeading=$,this}commandsGroup($){if($===void 0)return this._defaultCommandGroup??"";return this._defaultCommandGroup=$,this}optionsGroup($){if($===void 0)return this._defaultOptionGroup??"";return this._defaultOptionGroup=$,this}_initOptionGroup($){if(this._defaultOptionGroup&&!$.helpGroupHeading)$.helpGroup(this._defaultOptionGroup)}_initCommandGroup($){if(this._defaultCommandGroup&&!$.helpGroup())$.helpGroup(this._defaultCommandGroup)}nameFromFilename($){return this._name=V0.basename($,V0.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let Z=this.createHelp(),X=this._getOutputContext($);Z.prepareContext({error:X.error,helpWidth:X.helpWidth,outputHasColors:X.hasColors});let Q=Z.formatHelp(this,Z);if(X.hasColors)return Q;return this._outputConfiguration.stripColor(Q)}_getOutputContext($){$=$||{};let Z=!!$.error,X,Q,G;if(Z)X=(Y)=>this._outputConfiguration.writeErr(Y),Q=this._outputConfiguration.getErrHasColors(),G=this._outputConfiguration.getErrHelpWidth();else X=(Y)=>this._outputConfiguration.writeOut(Y),Q=this._outputConfiguration.getOutHasColors(),G=this._outputConfiguration.getOutHelpWidth();return{error:Z,write:(Y)=>{if(!Q)Y=this._outputConfiguration.stripColor(Y);return X(Y)},hasColors:Q,helpWidth:G}}outputHelp($){let Z;if(typeof $==="function")Z=$,$=void 0;let X=this._getOutputContext($),Q={error:X.error,write:X.write,command:this};this._getCommandAndAncestors().reverse().forEach((z)=>z.emit("beforeAllHelp",Q)),this.emit("beforeHelp",Q);let G=this.helpInformation({error:X.error});if(Z){if(G=Z(G),typeof G!=="string"&&!Buffer.isBuffer(G))throw Error("outputHelp callback must return a string or a Buffer")}if(X.write(G),this._getHelpOption()?.long)this.emit(this._getHelpOption().long);this.emit("afterHelp",Q),this._getCommandAndAncestors().forEach((z)=>z.emit("afterAllHelp",Q))}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(u.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.
|
|
25
|
+
Expecting one of '${X.join("', '")}'`);let Q=`${$}Help`;return this.on(Q,(G)=>{let z;if(typeof Z==="function")z=Z({error:G.error,command:G.command});else z=Z;if(z)G.write(`${z}
|
|
26
|
+
`)}),this}_outputHelpIfRequested($){let Z=this._getHelpOption();if(Z&&$.find((Q)=>Z.is(Q)))this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)")}}function C6($){return $.map((Z)=>{if(!Z.startsWith("--inspect"))return Z;let X,Q="127.0.0.1",G="9229",z;if((z=Z.match(/^(--inspect(-brk)?)$/))!==null)X=z[1];else if((z=Z.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(X=z[1],/^\d+$/.test(z[3]))G=z[3];else Q=z[3];else if((z=Z.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)X=z[1],Q=z[3],G=z[4];if(X&&G!=="0")return`${X}=${Q}:${parseInt(G)+1}`;return Z})}function $9(){if(u.env.NO_COLOR||u.env.FORCE_COLOR==="0"||u.env.FORCE_COLOR==="false")return!1;if(u.env.FORCE_COLOR||u.env.CLICOLOR_FORCE!==void 0)return!0;return}Y1.Command=Z9;Y1.useColor=$9});var A6=w0((D1)=>{var{Argument:N6}=O4(),{Command:X9}=w6(),{CommanderError:H1,InvalidArgumentError:T6}=o0(),{Help:q1}=s4(),{Option:S6}=a4();D1.program=new X9;D1.createCommand=($)=>new X9($);D1.createOption=($,Z)=>new S6($,Z);D1.createArgument=($,Z)=>new N6($,Z);D1.Command=X9;D1.Option=S6;D1.Argument=N6;D1.Help=q1;D1.CommanderError=H1;D1.InvalidArgumentError=T6;D1.InvalidOptionArgumentError=T6});function V6($){return $!==null&&typeof $==="object"&&typeof $.then==="function"}function o($){if(V6($))return B6($);try{let Z=$();if(V6(Z))return B6(Z);return[void 0,Z]}catch(Z){return[Z instanceof Error?Z:Error(String(Z)),void 0]}}function B6($){return Promise.resolve($).then((Z)=>[void 0,Z]).catch((Z)=>[Z instanceof Error?Z:Error(String(Z)),void 0])}var z7="The server's TLS certificate could not be verified. Most often a corporate proxy/firewall re-signs HTTPS with a root CA that Node does "+"not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY "+"if you connect through a proxy). If the certificate is instead expired or its hostname does not match, fix the endpoint URL or the system clock. Then retry.";var E6=P1(A6(),1),{program:_7,createCommand:F7,createArgument:I7,createOption:L7,CommanderError:P7,InvalidArgumentError:C1,InvalidOptionArgumentError:C7,Command:N0,Argument:w7,Option:w1,Help:N7}=E6.default;var N1=new WeakMap;N0.prototype.examples=function($){return N1.set(this,$),this};var r0=globalThis;function f($){let Z=typeof $==="string"?$:$.name,X=Symbol.for("@uipath/common/"+Z);return{get(Q){return r0[X]??Q},set(Q){r0[X]=Q},clear(){delete r0[X]},getOrInit(Q,G){let z=r0[X];if(z!=null&&typeof z==="object"){if(!G||G(z))return z}let Y=Q();return r0[X]=Y,Y}}}function T1(){let[$,Z]=o(()=>B0("node:async_hooks"));if($||typeof Z?.AsyncLocalStorage!=="function")return{getStore:()=>{return},run:(X,Q)=>Q()};return new Z.AsyncLocalStorage}var S1=f("OutputStorage"),A1=f("OutputSink"),E1=S1.getOrInit(T1,($)=>("getStore"in $)),x1={writeOut:($)=>process.stdout.write($),writeErr:($)=>process.stderr.write($),writeLog:($)=>process.stdout.write($),capabilities:{isInteractive:!1,canReadInput:!1,supportsColor:!1,outputWidth:80}};function $0(){return E1.getStore()??A1.get()??x1}var x6=($)=>{return $!==null&&Object.prototype.toString.call($)==="[object Object]"},I4=($,Z)=>{if($===Z)return!0;if(typeof $!==typeof Z)return!1;if(Array.isArray($)&&Array.isArray(Z)){if($.length!==Z.length)return!1;for(let X=0;X<$.length;X+=1)if(!I4($[X],Z[X]))return!1;return!0}if(x6($)&&x6(Z)){let X=Object.entries($),Q=new Set(Object.keys(Z));if(X.length!==Q.size)return!1;for(let[G,z]of X){if(!I4(z,Z[G]))return!1;Q.delete(G)}return Q.size===0}return!1},s0=($)=>{if($===null||$===void 0||$===!1)return!0;if(typeof $==="string")return $==="";if(typeof $==="object"){if(Array.isArray($))return $.length===0;if($===null)return!0;return Object.keys($).length===0}return!1},k6=($)=>{return $>="a"&&$<="z"||$>="A"&&$<="Z"||$==="_"},J9=($)=>{return $>="0"&&$<="9"||$==="-"},k1=($)=>{return $>="a"&&$<="z"||$>="A"&&$<="Z"||$>="0"&&$<="9"||$==="_"},L4=($)=>{if(typeof $!=="number"||Math.floor($)!==$)throw Error("invalid-value: expecting an integer.");return $},z9=($)=>{if(typeof $!=="number"||$<0||Math.floor($)!==$)throw Error("invalid-value: expecting a non-negative integer.");return $},R0=(...$)=>{for(let Z=0;Z<$.length;Z++){if($[Z]===null||$[Z]===void 0)throw Error("not-a-number: undefined");if(typeof $[Z]!=="number")throw Error("not-a-number")}},f6=($)=>{if($=+$,!$)throw Error("not-a-number: divide by zero");return $},y1=($,Z)=>{return R0($,Z),$+Z},b1=($,Z)=>{return R0($,Z),$-Z},v1=($,Z)=>{return R0($,Z),$*Z},f1=($,Z)=>{return R0($,Z),$/f6(Z)},h1=($,Z)=>{return R0($,Z),Math.floor($/f6(Z))},m1=($,Z)=>{return R0($,Z),$%Z},g1=($,Z,X,Q)=>{if(!$||!Z)return null;X=Math.max(L4(X=X||0),0),Q=Math.min(L4(Q=Q||$.length),$.length);let G=$.slice(X,Q).indexOf(Z);return G===-1?null:G+X},u1=($,Z,X,Q)=>{if(!$||!Z)return null;X=Math.max(L4(X=X||0),0),Q=Math.min(L4(Q=Q||$.length),$.length);let G=$.slice(X,Q).lastIndexOf(Z);return G===-1?null:G+X},p1=($)=>$.toLowerCase(),h6=($,Z,X)=>{if(X=X||" ",X.length>1)throw Error(`invalid value, ${$} expects its 'pad' parameter to be a valid string with a single codepoint`);return z9(Z),X},c1=($,Z,X)=>{return X=h6("pad_left",Z,X),$&&$.padStart(Z,X)||""},d1=($,Z,X)=>{return X=h6("pad_right",Z,X),$&&$.padEnd(Z,X)||""},G9=($,Z,X,Q)=>{if(Q===0)return $;if(!Q)return $.split(Z).join(X);return z9(Q),[...Array(Q).keys()].map(()=>$=$.replace(Z,X)),$},l1=($,Z,X)=>{if($.length==0&&Z.length===0)return[];if(X===null||X===void 0)return $.split(Z);if(z9(X),X===0)return[$];let Q=$.split(Z);return[...Q.slice(0,X),Q.slice(X).join(Z)]},i1=($,Z)=>{return m6(g6($,Z),Z)},m6=($,Z)=>{return u6($,(X)=>new RegExp(`^[${X}]*(.*?)`),Z)},g6=($,Z)=>{return u6($,(X)=>new RegExp(`(.*?)[${X}]*$`),Z)},u6=($,Z,X)=>{let Q=X?X.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"):"\\s
";return $.replace(Z(Q),"$1")},n1=($)=>$.toUpperCase(),y6={"(":"Lparen",")":"Rparen","*":"Star",",":"Comma",".":"Dot",":":"Colon","@":"Current","]":"Rbracket","{":"Lbrace","}":"Rbrace","+":"Plus","%":"Modulo","?":"Question","−":"Minus","×":"Multiply","÷":"Divide"},o1={"!":!0,"<":!0,"=":!0,">":!0,"&":!0,"|":!0,"/":!0},r1={"\t":!0,"\n":!0,"\r":!0," ":!0},s1=class{_current=0;_enable_legacy_literals=!1;tokenize($,Z){let X=[];this._current=0,this._enable_legacy_literals=Z?.enable_legacy_literals||!1;let Q,G,z;while(this._current<$.length)if(k6($[this._current]))Q=this._current,G=this.consumeUnquotedIdentifier($),X.push({start:Q,type:"UnquotedIdentifier",value:G});else if(y6[$[this._current]]!==void 0)X.push({start:this._current,type:y6[$[this._current]],value:$[this._current]}),this._current+=1;else if($[this._current]==="$")if(Q=this._current,this._current+1<$.length&&k6($[this._current+1]))this._current+=1,G=this.consumeUnquotedIdentifier($),X.push({start:Q,type:"Variable",value:G});else X.push({start:Q,type:"Root",value:$[this._current]}),this._current+=1;else if($[this._current]==="-")if(this._current+1<$.length&&J9($[this._current+1])){let Y=this.consumeNumber($);Y&&X.push(Y)}else{let Y={start:this._current,type:"Minus",value:"-"};X.push(Y),this._current+=1}else if(J9($[this._current]))z=this.consumeNumber($),X.push(z);else if($[this._current]==="[")z=this.consumeLBracket($),X.push(z);else if($[this._current]==='"')Q=this._current,G=this.consumeQuotedIdentifier($),X.push({start:Q,type:"QuotedIdentifier",value:G});else if($[this._current]==="'")Q=this._current,G=this.consumeRawStringLiteral($),X.push({start:Q,type:"Literal",value:G});else if($[this._current]==="`"){Q=this._current;let Y=this.consumeLiteral($);X.push({start:Q,type:"Literal",value:Y})}else if(o1[$[this._current]]!==void 0)z=this.consumeOperator($),z&&X.push(z);else if(r1[$[this._current]]!==void 0)this._current+=1;else{let Y=Error(`Syntax error: unknown character: ${$[this._current]}`);throw Y.name="LexerError",Y}return X}consumeUnquotedIdentifier($){let Z=this._current;this._current+=1;while(this._current<$.length&&k1($[this._current]))this._current+=1;return $.slice(Z,this._current)}consumeQuotedIdentifier($){let Z=this._current;this._current+=1;let X=$.length;while($[this._current]!=='"'&&this._current<X){let z=this._current;if($[z]==="\\"&&($[z+1]==="\\"||$[z+1]==='"'))z+=2;else z+=1;this._current=z}this._current+=1;let[Q,G]=this.parseJSON($.slice(Z,this._current));if(!G){let z=Error("syntax: unexpected end of JSON input");throw z.name="LexerError",z}return Q}consumeRawStringLiteral($){let Z=this._current;this._current+=1;let X=$.length;while($[this._current]!=="'"&&this._current<X){let G=this._current;if($[G]==="\\"&&($[G+1]==="\\"||$[G+1]==="'"))G+=2;else G+=1;this._current=G}this._current+=1;let Q=$.slice(Z+1,this._current-1);return G9(G9(Q,"\\\\","\\"),"\\'","'")}consumeNumber($){let Z=this._current;this._current+=1;let X=$.length;while(J9($[this._current])&&this._current<X)this._current+=1;let Q=parseInt($.slice(Z,this._current),10);return{start:Z,value:Q,type:"Number"}}consumeLBracket($){let Z=this._current;if(this._current+=1,$[this._current]==="?")return this._current+=1,{start:Z,type:"Filter",value:"[?"};if($[this._current]==="]")return this._current+=1,{start:Z,type:"Flatten",value:"[]"};return{start:Z,type:"Lbracket",value:"["}}consumeOrElse($,Z,X,Q){let G=this._current;if(this._current+=1,this._current<$.length&&$[this._current]===Z)return this._current+=1,{start:G,type:Q,value:$.slice(G,this._current)};return{start:G,type:X,value:$[G]}}consumeOperator($){let Z=this._current;switch($[Z]){case"!":return this.consumeOrElse($,"=","Not","NE");case"<":return this.consumeOrElse($,"=","LT","LTE");case">":return this.consumeOrElse($,"=","GT","GTE");case"=":return this.consumeOrElse($,"=","Assign","EQ");case"&":return this.consumeOrElse($,"&","Expref","And");case"|":return this.consumeOrElse($,"|","Pipe","Or");case"/":return this.consumeOrElse($,"/","Divide","Div")}}consumeLiteral($){this._current+=1;let Z=this._current,X=$.length;while($[this._current]!=="`"&&this._current<X){let Y=this._current;if($[Y]==="\\"&&($[Y+1]==="\\"||$[Y+1]==="`"))Y+=2;else Y+=1;this._current=Y}let Q=$.slice(Z,this._current).trimStart();Q=Q.replace("\\`","`");let G=null,z=!1;if(this.looksLikeJSON(Q))[G,z]=this.parseJSON(Q);if(!z&&this._enable_legacy_literals)[G,z]=this.parseJSON(`"${Q}"`);if(!z){let Y=Error(`Syntax error: unexpected end of JSON input or invalid format for a JSON literal: ${$[this._current]}`);throw Y.name="LexerError",Y}return this._current+=1,G}looksLikeJSON($){let X=["true","false","null"],Q="-0123456789";if($==="")return!1;if('[{"'.includes($[0]))return!0;if(X.includes($))return!0;if("-0123456789".includes($[0])){let[G,z]=this.parseJSON($);return z}return!1}parseJSON($){try{return[JSON.parse($),!0]}catch{return[null,!1]}}},a1=new s1,t1=a1,i={["EOF"]:0,["Variable"]:0,["UnquotedIdentifier"]:0,["QuotedIdentifier"]:0,["Rbracket"]:0,["Rparen"]:0,["Comma"]:0,["Rbrace"]:0,["Number"]:0,["Current"]:0,["Expref"]:0,["Root"]:0,["Assign"]:1,["Pipe"]:1,["Question"]:2,["Or"]:3,["And"]:4,["EQ"]:5,["GT"]:5,["LT"]:5,["GTE"]:5,["LTE"]:5,["NE"]:5,["Minus"]:6,["Plus"]:6,["Div"]:7,["Divide"]:7,["Modulo"]:7,["Multiply"]:7,["Flatten"]:9,["Star"]:20,["Filter"]:21,["Dot"]:40,["Not"]:45,["Lbrace"]:50,["Lbracket"]:55,["Lparen"]:60},e1=class ${index=0;tokens=[];parse(Z,X){this.loadTokens(Z,X||{enable_legacy_literals:!1}),this.index=0;let Q=this.expression(0);if(this.lookahead(0)!=="EOF"){let G=this.lookaheadToken(0);this.errorToken(G,`Syntax error: unexpected token type: ${G.type}, value: ${G.value}`)}return Q}loadTokens(Z,X){this.tokens=t1.tokenize(Z,X),this.tokens.push({type:"EOF",value:"",start:Z.length})}expression(Z){let X=this.lookaheadToken(0);this.advance();let Q=this.nud(X),G=this.lookahead(0);while(Z<i[G])this.advance(),Q=this.led(G,Q),G=this.lookahead(0);return Q}lookahead(Z){return this.tokens[this.index+Z].type}lookaheadToken(Z){return this.tokens[this.index+Z]}advance(){this.index+=1}nud(Z){switch(Z.type){case"Variable":return{type:"Variable",name:Z.value};case"Literal":return{type:"Literal",value:Z.value};case"UnquotedIdentifier":if($.isKeyword(Z,"let")&&this.lookahead(0)==="Variable")return this.parseLetExpression();else return{type:"Field",name:Z.value};case"QuotedIdentifier":if(this.lookahead(0)==="Lparen")throw Error("Syntax error: quoted identifier not allowed for function names.");else return{type:"Field",name:Z.value};case"Not":return{type:"NotExpression",child:this.expression(i.Not)};case"Minus":{let X=this.expression(i.Minus);return{type:"Unary",operator:Z.type,operand:X}}case"Plus":{let X=this.expression(i.Plus);return{type:"Unary",operator:Z.type,operand:X}}case"Star":return{type:"ValueProjection",left:{type:"Identity"},right:this.parseProjectionRHS(i.Star)};case"Filter":return this.led(Z.type,{type:"Identity"});case"Lbrace":return this.parseMultiselectHash();case"Flatten":{let X={type:"Flatten",child:{type:"Identity"}},Q=this.parseProjectionRHS(i.Flatten);return{type:"Projection",left:X,right:Q}}case"Lbracket":{if(this.lookahead(0)==="Number"||this.lookahead(0)==="Colon"){let X=this.parseIndexExpression();return this.projectIfSlice({type:"Identity"},X)}if(this.lookahead(0)==="Star"&&this.lookahead(1)==="Rbracket"){this.advance(),this.advance();let X=this.parseProjectionRHS(i.Star);return{left:{type:"Identity"},right:X,type:"Projection"}}return this.parseMultiselectList()}case"Current":return{type:"Current"};case"Root":return{type:"Root"};case"Expref":return{type:"ExpressionReference",child:this.expression(i.Expref)};case"Lparen":{let X=this.expression(0);return this.match("Rparen"),X}default:this.errorToken(Z)}}led(Z,X){switch(Z){case"Question":{let Q=this.expression(0);this.match("Colon");let G=this.expression(0);return{type:"Ternary",condition:X,trueExpr:Q,falseExpr:G}}case"Dot":{let Q=i.Dot;if(this.lookahead(0)!=="Star"){let z=this.parseDotRHS(Q);return{type:"Subexpression",left:X,right:z}}this.advance();let G=this.parseProjectionRHS(Q);return{type:"ValueProjection",left:X,right:G}}case"Pipe":{let Q=this.expression(i.Pipe);return{type:"Pipe",left:X,right:Q}}case"Or":{let Q=this.expression(i.Or);return{type:"OrExpression",left:X,right:Q}}case"And":{let Q=this.expression(i.And);return{type:"AndExpression",left:X,right:Q}}case"Lparen":{if(X.type!=="Field")throw Error("Syntax error: expected a Field node");let Q=X.name,G=this.parseCommaSeparatedExpressionsUntilToken("Rparen");return{name:Q,type:"Function",children:G}}case"Filter":{let Q=this.expression(0);this.match("Rbracket");let G=this.lookahead(0)==="Flatten"?{type:"Identity"}:this.parseProjectionRHS(i.Filter);return{type:"FilterProjection",left:X,right:G,condition:Q}}case"Flatten":{let Q={type:"Flatten",child:X},G=this.parseProjectionRHS(i.Flatten);return{type:"Projection",left:Q,right:G}}case"Assign":{let Q=X,G=this.expression(0);return{type:"Binding",variable:Q.name,reference:G}}case"EQ":case"NE":case"GT":case"GTE":case"LT":case"LTE":return this.parseComparator(X,Z);case"Plus":case"Minus":case"Multiply":case"Star":case"Divide":case"Modulo":case"Div":return this.parseArithmetic(X,Z);case"Lbracket":{let Q=this.lookaheadToken(0);if(Q.type==="Number"||Q.type==="Colon"){let z=this.parseIndexExpression();return this.projectIfSlice(X,z)}this.match("Star"),this.match("Rbracket");let G=this.parseProjectionRHS(i.Star);return{type:"Projection",left:X,right:G}}default:return this.errorToken(this.lookaheadToken(0))}}static isKeyword(Z,X){return Z.type==="UnquotedIdentifier"&&Z.value===X}match(Z){if(this.lookahead(0)===Z){this.advance();return}else{let X=this.lookaheadToken(0);this.errorToken(X,`Syntax error: expected ${Z}, got: ${X.type}`)}}errorToken(Z,X=""){let Q=Error(X||`Syntax error: invalid token (${Z.type}): "${Z.value}"`);throw Q.name="ParserError",Q}parseIndexExpression(){if(this.lookahead(0)==="Colon"||this.lookahead(1)==="Colon")return this.parseSliceExpression();let Z=Number(this.lookaheadToken(0).value);return this.advance(),this.match("Rbracket"),{type:"Index",value:Z}}projectIfSlice(Z,X){let Q={type:"IndexExpression",left:Z,right:X};if(X.type==="Slice")return{left:Q,right:this.parseProjectionRHS(i.Star),type:"Projection"};return Q}parseSliceExpression(){let Z=[null,null,null],X=0,Q=this.lookaheadToken(0);while(Q.type!="Rbracket"&&X<3){if(Q.type==="Colon"){if(X++,X===3)this.errorToken(this.lookaheadToken(0),"Syntax error, too many colons in slice expression");this.advance()}else if(Q.type==="Number"){let K=this.lookaheadToken(0).value;Z[X]=K,this.advance()}else{let K=this.lookaheadToken(0);this.errorToken(K,`Syntax error, unexpected token: ${K.value}(${K.type})`)}Q=this.lookaheadToken(0)}this.match("Rbracket");let[G,z,Y]=Z;return{type:"Slice",start:G,stop:z,step:Y}}parseLetExpression(){let Z=this.parseCommaSeparatedExpressionsUntilKeyword("in"),X=this.expression(0);return{type:"LetExpression",bindings:Z.map((G)=>G),expression:X}}parseCommaSeparatedExpressionsUntilKeyword(Z){return this.parseCommaSeparatedExpressionsUntil(()=>{return $.isKeyword(this.lookaheadToken(0),Z)},()=>{this.advance()})}parseCommaSeparatedExpressionsUntilToken(Z){return this.parseCommaSeparatedExpressionsUntil(()=>{return this.lookahead(0)===Z},()=>{return this.match(Z)})}parseCommaSeparatedExpressionsUntil(Z,X){let Q=[],G;while(!Z()){if(G=this.expression(0),this.lookahead(0)==="Comma")this.match("Comma");Q.push(G)}return X(),Q}parseComparator(Z,X){let Q=this.expression(i[X]);return{type:"Comparator",name:X,left:Z,right:Q}}parseArithmetic(Z,X){let Q=this.expression(i[X]);return{type:"Arithmetic",operator:X,left:Z,right:Q}}parseDotRHS(Z){let X=this.lookahead(0);if(["UnquotedIdentifier","QuotedIdentifier","Star"].includes(X))return this.expression(Z);if(X==="Lbracket")return this.match("Lbracket"),this.parseMultiselectList();if(X==="Lbrace")return this.match("Lbrace"),this.parseMultiselectHash();let G=this.lookaheadToken(0);this.errorToken(G,`Syntax error, unexpected token: ${G.value}(${G.type})`)}parseProjectionRHS(Z){if(i[this.lookahead(0)]<10)return{type:"Identity"};if(this.lookahead(0)==="Lbracket")return this.expression(Z);if(this.lookahead(0)==="Filter")return this.expression(Z);if(this.lookahead(0)==="Dot")return this.match("Dot"),this.parseDotRHS(Z);let X=this.lookaheadToken(0);this.errorToken(X,`Syntax error, unexpected token: ${X.value}(${X.type})`)}parseMultiselectList(){let Z=[];while(this.lookahead(0)!=="Rbracket"){let X=this.expression(0);if(Z.push(X),this.lookahead(0)==="Comma"){if(this.match("Comma"),this.lookahead(0)==="Rbracket")throw Error("Syntax error: unexpected token Rbracket")}}return this.match("Rbracket"),{type:"MultiSelectList",children:Z}}parseMultiselectHash(){let Z=[],X=["UnquotedIdentifier","QuotedIdentifier"],Q,G,z;for(;;){if(Q=this.lookaheadToken(0),!X.includes(Q.type))throw Error(`Syntax error: expecting an identifier token, got: ${Q.type}`);if(G=Q.value,this.advance(),this.match("Colon"),z=this.expression(0),Z.push({value:z,type:"KeyValuePair",name:G}),this.lookahead(0)==="Comma")this.match("Comma");else if(this.lookahead(0)==="Rbrace"){this.match("Rbrace");break}}return{type:"MultiSelectHash",children:Z}}},$2=new e1,Z2=$2,F4=class ${_text;constructor(Z){this._text=Z}get string(){return this._text}get length(){return this.codePoints.length}compareTo(Z){return $.compare(this,new $(Z))}static get comparer(){return(X,Q)=>{return new $(X).compareTo(Q)}}static compare(Z,X){let Q=Z.codePoints,G=X.codePoints;for(let z=0;z<Math.min(Q.length,G.length);z++){if(Q[z]===G[z])continue;return Q[z]-G[z]>0?1:-1}return Q.length-G.length>0?1:-1}reverse(){return String.fromCodePoint(...this.codePoints.reverse())}get codePoints(){return[...this._text].map((X)=>X.codePointAt(0))}},Q9=($)=>([Z])=>$(Z),b6=($)=>([Z])=>$(Z),v6=($)=>([Z])=>$(Z),X2=class{_interpreter;_functionTable;_customFunctions=new Set;TYPE_NAME_TABLE=Object.freeze({[0]:"number",[1]:"any",[2]:"string",[3]:"array",[4]:"object",[5]:"boolean",[6]:"expression",[7]:"null",[8]:"Array<number>",[10]:"Array<object>",[9]:"Array<string>",[11]:"Array<Array<any>>"});constructor($){this._interpreter=$,this._functionTable=this.buildFunctionTable()}buildFunctionTable(){return{abs:{_func:Q9(Math.abs),_signature:[{types:[0]}]},ceil:{_func:Q9(Math.ceil),_signature:[{types:[0]}]},floor:{_func:Q9(Math.floor),_signature:[{types:[0]}]},lower:{_func:b6(p1),_signature:[{types:[2]}]},upper:{_func:b6(n1),_signature:[{types:[2]}]},keys:{_func:v6(Object.keys),_signature:[{types:[4]}]},values:{_func:v6(Object.values),_signature:[{types:[4]}]},avg:{_func:this.functionAvg,_signature:[{types:[8]}]},contains:{_func:this.functionContains,_signature:[{types:[2,3]},{types:[1]}]},ends_with:{_func:this.functionEndsWith,_signature:[{types:[2]},{types:[2]}]},find_first:{_func:this.functionFindFirst,_signature:[{types:[2]},{types:[2]},{types:[0],optional:!0},{types:[0],optional:!0}]},find_last:{_func:this.functionFindLast,_signature:[{types:[2]},{types:[2]},{types:[0],optional:!0},{types:[0],optional:!0}]},from_items:{_func:this.functionFromItems,_signature:[{types:[11]}]},group_by:{_func:this.functionGroupBy,_signature:[{types:[3]},{types:[6]}]},items:{_func:this.functionItems,_signature:[{types:[4]}]},join:{_func:this.functionJoin,_signature:[{types:[2]},{types:[9]}]},length:{_func:this.functionLength,_signature:[{types:[2,3,4]}]},map:{_func:this.functionMap,_signature:[{types:[6]},{types:[3]}]},max:{_func:this.functionMax,_signature:[{types:[8,9]}]},max_by:{_func:this.functionMaxBy,_signature:[{types:[3]},{types:[6]}]},merge:{_func:this.functionMerge,_signature:[{types:[4],variadic:!0}]},min:{_func:this.functionMin,_signature:[{types:[8,9]}]},min_by:{_func:this.functionMinBy,_signature:[{types:[3]},{types:[6]}]},not_null:{_func:this.functionNotNull,_signature:[{types:[1],variadic:!0}]},pad_left:{_func:this.functionPadLeft,_signature:[{types:[2]},{types:[0]},{types:[2],optional:!0}]},pad_right:{_func:this.functionPadRight,_signature:[{types:[2]},{types:[0]},{types:[2],optional:!0}]},replace:{_func:this.functionReplace,_signature:[{types:[2]},{types:[2]},{types:[2]},{types:[0],optional:!0}]},reverse:{_func:this.functionReverse,_signature:[{types:[2,3]}]},sort:{_func:this.functionSort,_signature:[{types:[9,8]}]},sort_by:{_func:this.functionSortBy,_signature:[{types:[3]},{types:[6]}]},split:{_func:this.functionSplit,_signature:[{types:[2]},{types:[2]},{types:[0],optional:!0}]},starts_with:{_func:this.functionStartsWith,_signature:[{types:[2]},{types:[2]}]},sum:{_func:this.functionSum,_signature:[{types:[8]}]},to_array:{_func:this.functionToArray,_signature:[{types:[1]}]},to_number:{_func:this.functionToNumber,_signature:[{types:[1]}]},to_string:{_func:this.functionToString,_signature:[{types:[1]}]},trim:{_func:this.functionTrim,_signature:[{types:[2]},{types:[2],optional:!0}]},trim_left:{_func:this.functionTrimLeft,_signature:[{types:[2]},{types:[2],optional:!0}]},trim_right:{_func:this.functionTrimRight,_signature:[{types:[2]},{types:[2],optional:!0}]},type:{_func:this.functionType,_signature:[{types:[1]}]},zip:{_func:this.functionZip,_signature:[{types:[3],variadic:!0}]}}}registerFunction($,Z,X,Q){let G=this._registerInternal($,Z,X,Q);if(!G.success)throw Error(G.message)}_registerInternal($,Z,X,Q={}){if(!$||typeof $!=="string"||$.trim()==="")return{success:!1,reason:"invalid-name",message:"Function name must be a non-empty string"};try{this.validateInputSignatures($,X)}catch(D){return{success:!1,reason:"invalid-signature",message:D instanceof Error?D.message:"Invalid function signature"}}let{override:G=!1,warn:z=!1}=Q,Y=$ in this._functionTable;if(Y&&!G)return{success:!1,reason:"already-exists",message:`Function already defined: ${$}(). Use { override: true } to replace it.`};if(Y&&G&&z)console.warn(`Warning: Overriding existing function: ${$}()`);return this._functionTable[$]={_func:Z.bind(this),_signature:X},this._customFunctions.add($),{success:!0,message:Y?`Function ${$}() overridden successfully`:`Function ${$}() registered successfully`}}register($,Z,X,Q={}){return this._registerInternal($,Z,X,Q)}unregister($){if(!this._customFunctions.has($))return!1;return delete this._functionTable[$],this._customFunctions.delete($),!0}isRegistered($){return $ in this._functionTable}getRegistered(){return Object.keys(this._functionTable)}getCustomFunctions(){return Array.from(this._customFunctions)}clearCustomFunctions(){for(let $ of this._customFunctions)delete this._functionTable[$];this._customFunctions.clear()}callFunction($,Z){let X=this._functionTable[$];if(X===void 0)throw Error(`Unknown function: ${$}()`);return this.validateArgs($,Z,X._signature),X._func.call(this,Z)}validateInputSignatures($,Z){for(let X=0;X<Z.length;X+=1)if("variadic"in Z[X]&&X!==Z.length-1)throw Error(`Invalid arity: ${$}() 'variadic' argument ${X+1} must occur last`)}validateArgs($,Z,X){this.validateInputSignatures($,X),this.validateArity($,Z,X),this.validateTypes($,Z,X)}validateArity($,Z,X){let Q=X.filter((K)=>!(K.optional??!1)).length,G=X[X.length-1]?.variadic??!1,z=Z.length<Q,Y=Z.length>X.length;if(G&&z||!G&&(z||Y)){let K=z&&(!G&&Q>1||G)?"at least ":"",D=X.length>1;throw Error(`Invalid arity: ${$}() takes ${K}${Q} argument${D&&"s"||""} but received ${Z.length}`)}}validateTypes($,Z,X){for(let Q=0;Q<X.length;Q+=1){let G=X[Q].types,z=this.getTypeName(Z[Q]);if(z===void 0)continue;if(!G.some((K)=>this.typeMatches(z,K,Z[Q]))){let K=G.map((D)=>this.TYPE_NAME_TABLE[D]).join(" | ");throw Error(`Invalid type: ${$}() expected argument ${Q+1} to be type (${K}) but received type ${this.TYPE_NAME_TABLE[z]} instead.`)}}}typeMatches($,Z,X){if(Z===1)return!0;if(Z===9||Z===8||Z===10||Z===11||Z===3){if(Z===3)return $===3;if($===3){let Q;if(Z===8)Q=0;else if(Z===10)Q=4;else if(Z===9)Q=2;else if(Z===11)Q=3;let G=X;for(let z=0;z<G.length;z+=1){let Y=this.getTypeName(G[z]);if(Y!==void 0&&Q!==void 0&&!this.typeMatches(Y,Q,G[z]))return!1}return!0}}else return $===Z;return!1}getTypeName($){if($===null)return 7;if(typeof $==="string")return 2;if(typeof $==="number")return 0;if(typeof $==="boolean")return 5;if(Array.isArray($))return 3;if(typeof $==="object"){if($.expref)return 6;return 4}return}createKeyFunction($,Z){let X=this._interpreter;return(G)=>{let z=X.visit($,G);if(!Z.includes(this.getTypeName(z))){let Y=`Invalid type: expected one of (${Z.map((K)=>this.TYPE_NAME_TABLE[K]).join(" | ")}), received ${this.TYPE_NAME_TABLE[this.getTypeName(z)]}`;throw Error(Y)}return z}}functionAvg=([$])=>{if(!$||$.length==0)return null;let Z=0;for(let X=0;X<$.length;X+=1)Z+=$[X];return Z/$.length};functionContains=([$,Z])=>{if(Array.isArray($))return $.includes(Z);if(typeof $==="string"){let X=$;if(typeof Z==="string")return X.includes(Z)}return null};functionEndsWith=($)=>{let[Z,X]=$;return Z.includes(X,Z.length-X.length)};functionFindFirst=this.createFindFunction(g1);functionFindLast=this.createFindFunction(u1);createFindFunction($){return(Z)=>{let X=Z[0],Q=Z[1],G=Z.length>2?Z[2]:void 0,z=Z.length>3?Z[3]:void 0;return $(X,Q,G,z)}}functionFromItems=([$])=>{return $.map((Z)=>{if(Z.length!=2||typeof Z[0]!=="string")throw Error("invalid value, each array must contain two elements, a pair of string and value")}),Object.fromEntries($)};functionGroupBy=([$,Z])=>{let X=this.createKeyFunction(Z,[2]);return $.reduce((Q,G)=>{let z=X(G??{});return(Q[z]=Q[z]||[]).push(G),Q},{})};functionItems=([$])=>{return Object.entries($)};functionJoin=($)=>{let[Z,X]=$;return X.join(Z)};functionLength=([$])=>{if(typeof $==="string")return new F4($).length;if(Array.isArray($))return $.length;return Object.keys($).length};functionMap=([$,Z])=>{if(!this._interpreter)return[];let X=[],Q=this._interpreter;for(let G=0;G<Z.length;G+=1)X.push(Q.visit($,Z[G]));return X};functionMax=([$])=>{if(!$.length)return null;if(this.getTypeName($[0])===0)return Math.max(...$);let X=$,Q=X[0];for(let G=1;G<X.length;G+=1)if(Q.localeCompare(X[G])<0)Q=X[G];return Q};functionMaxBy=($)=>{let Z=$[1],X=$[0],Q=this.createKeyFunction(Z,[0,2]),G=-1/0,z,Y;for(let K=0;K<X.length;K+=1)if(Y=Q&&Q(X[K]),Y!==void 0&&Y>G)G=Y,z=X[K];return z||null};functionMerge=($)=>{let Z={};for(let X=0;X<$.length;X+=1){let Q=$[X];Z=Object.assign(Z,Q)}return Z};functionMin=([$])=>{if(!$.length)return null;if(this.getTypeName($[0])===0)return Math.min(...$);let X=$,Q=X[0];for(let G=1;G<X.length;G+=1)if(X[G].localeCompare(Q)<0)Q=X[G];return Q};functionMinBy=($)=>{let Z=$[1],X=$[0],Q=this.createKeyFunction(Z,[0,2]),G=1/0,z,Y;for(let K=0;K<X.length;K+=1)if(Y=Q&&Q(X[K]),Y!==void 0&&Y<G)G=Y,z=X[K];return z||null};functionNotNull=($)=>{for(let Z=0;Z<$.length;Z+=1)if(this.getTypeName($[Z])!==7)return $[Z];return null};functionPadLeft=this.createPadFunction(c1);functionPadRight=this.createPadFunction(d1);createPadFunction($){return(Z)=>{let X=Z[0],Q=Z[1],G=Z.length>2?Z[2]:void 0;return $(X,Q,G)}}functionReplace=($)=>{let Z=$[0],X=$[1],Q=$[2];return G9(Z,X,Q,$.length>3?$[3]:void 0)};functionSplit=($)=>{let Z=$[0],X=$[1];return l1(Z,X,$.length>2?$[2]:void 0)};functionReverse=([$])=>{if(this.getTypeName($)===2)return new F4($).reverse();let X=$.slice(0);return X.reverse(),X};functionSort=([$])=>{if($.length==0)return $;if(typeof $[0]==="string")return[...$].sort(F4.comparer);return[...$].sort()};functionSortBy=($)=>{let Z=$[0].slice(0);if(Z.length===0)return Z;let X=this._interpreter,Q=$[1],G=this.getTypeName(X.visit(Q,Z[0]));if(G!==void 0&&![0,2].includes(G))throw Error(`Invalid type: unexpected type (${this.TYPE_NAME_TABLE[G]})`);function z(Y,K){throw Error(`Invalid type: expected (${Y.TYPE_NAME_TABLE[G]}), received ${Y.TYPE_NAME_TABLE[Y.getTypeName(K)]}`)}return Z.sort((Y,K)=>{let D=X.visit(Q,Y),H=X.visit(Q,K);if(this.getTypeName(D)!==G)z(this,D);else if(this.getTypeName(H)!==G)z(this,H);if(G===2)return F4.comparer(D,H);return D-H})};functionStartsWith=([$,Z])=>{return $.startsWith(Z)};functionSum=([$])=>{return $.reduce((Z,X)=>Z+X,0)};functionToArray=([$])=>{if(this.getTypeName($)===3)return $;return[$]};functionToNumber=([$])=>{let Z=this.getTypeName($),X;if(Z===0)return $;if(Z===2){if(X=+$,!isNaN(X))return X}return null};functionToString=([$])=>{if(this.getTypeName($)===2)return $;return JSON.stringify($)};functionTrim=this.createTrimFunction(i1);functionTrimLeft=this.createTrimFunction(m6);functionTrimRight=this.createTrimFunction(g6);createTrimFunction($){return(Z)=>{let X=Z[0],Q=Z.length>1?Z[1]:void 0;return $(X,Q)}}functionType=([$])=>{switch(this.getTypeName($)){case 0:return"number";case 2:return"string";case 3:return"array";case 4:return"object";case 5:return"boolean";case 7:return"null";default:throw Error("invalid-type")}};functionZip=($)=>{let Z=Math.min(...$.map((Q)=>Q.length));return Array(Z).fill(null).map((Q,G)=>$.map((z)=>z[G]))}},p6=class ${inner=void 0;data={};get currentScopeData(){return this.data}withScope(Z){let X=new $;return X.inner=this,X.data=Z,X}getValue(Z){if(Object.prototype.hasOwnProperty.call(this.data,Z))return this.data[Z];if(this.inner)return this.inner.getValue(Z);return null}},J2=new p6,Q2=class ${runtime;_rootValue=null;_scope;constructor(){this.runtime=new X2(this),this._scope=new p6}withScope(Z){let X=new $;return X.runtime._functionTable=this.runtime._functionTable,X._rootValue=this._rootValue,X._scope=this._scope.withScope(Z),X}search(Z,X){return this._rootValue=X,this._scope=J2,this.visit(Z,X)}visit(Z,X){switch(Z.type){case"Ternary":{let G=this.visit(Z.condition,X);if(!s0(G))return this.visit(Z.trueExpr,X);return this.visit(Z.falseExpr,X)}case"Field":let Q=Z.name;if(X===null||typeof X!=="object"||Array.isArray(X))return null;return X[Q]??null;case"LetExpression":{let{bindings:G,expression:z}=Z,Y={};return G.forEach((K)=>{let D=this.visit(K,X);Y={...Y,...D}}),this.withScope(Y).visit(z,X)}case"Binding":{let{variable:G,reference:z}=Z,Y=this.visit(z,X);return{[G]:Y}}case"Variable":{let G=Z.name;if(!this._scope.getValue(G)&&!Object.prototype.hasOwnProperty.call(this._scope.currentScopeData,G))throw Error(`Error referencing undefined variable ${G}`);return this._scope.getValue(G)}case"IndexExpression":return this.visit(Z.right,this.visit(Z.left,X));case"Subexpression":{let G=this.visit(Z.left,X);return G!=null?this.visit(Z.right,G)??null:null}case"Index":{if(!Array.isArray(X))return null;let G=Z.value<0?X.length+Z.value:Z.value;return X[G]??null}case"Slice":{if(!Array.isArray(X)&&typeof X!=="string")return null;let{start:G,stop:z,step:Y}=this.computeSliceParams(X.length,Z);if(typeof X==="string"){let K=[...X];return this.slice(K,G,z,Y).join("")}else return this.slice(X,G,z,Y)}case"Projection":{let{left:G,right:z}=Z,Y=!1;if(G.type==="IndexExpression"&&G.right.type==="Slice")Y=!0;let K=this.visit(G,X);if(Y&&typeof K==="string")return this.visit(z,K);if(!Array.isArray(K))return null;let D=[];for(let H of K){let q=this.visit(z,H);if(q!==null)D.push(q)}return D}case"ValueProjection":{let{left:G,right:z}=Z,Y=this.visit(G,X);if(Y===null||typeof Y!=="object"||Array.isArray(Y))return null;let K=[],D=Object.values(Y);for(let H of D){let q=this.visit(z,H);if(q!==null)K.push(q)}return K}case"FilterProjection":{let{left:G,right:z,condition:Y}=Z,K=this.visit(G,X);if(!Array.isArray(K))return null;let D=[];for(let H of K){let q=this.visit(Y,H);if(s0(q))continue;let M=this.visit(z,H);if(M!==null)D.push(M)}return D}case"Arithmetic":{let G=this.visit(Z.left,X),z=this.visit(Z.right,X);switch(Z.operator){case"Plus":return y1(G,z);case"Minus":return b1(G,z);case"Multiply":case"Star":return v1(G,z);case"Divide":return f1(G,z);case"Modulo":return m1(G,z);case"Div":return h1(G,z);default:throw Error(`Syntax error: unknown arithmetic operator: ${Z.operator}`)}}case"Unary":{let G=this.visit(Z.operand,X);switch(Z.operator){case"Plus":return R0(G),G;case"Minus":return R0(G),-G;default:throw Error(`Syntax error: unknown arithmetic operator: ${Z.operator}`)}}case"Comparator":{let G=this.visit(Z.left,X),z=this.visit(Z.right,X);switch(Z.name){case"EQ":return I4(G,z);case"NE":return!I4(G,z)}if(typeof G!=="number"||typeof z!=="number")return null;switch(Z.name){case"GT":return G>z;case"GTE":return G>=z;case"LT":return G<z;case"LTE":return G<=z}}case"Flatten":{let G=this.visit(Z.child,X);return Array.isArray(G)?G.flat():null}case"Root":return this._rootValue;case"MultiSelectList":{let G=[];for(let z of Z.children)G.push(this.visit(z,X));return G}case"MultiSelectHash":{let G={};for(let z of Z.children)G[z.name]=this.visit(z.value,X);return G}case"OrExpression":{let G=this.visit(Z.left,X);if(s0(G))return this.visit(Z.right,X);return G}case"AndExpression":{let G=this.visit(Z.left,X);if(s0(G))return G;return this.visit(Z.right,X)}case"NotExpression":return s0(this.visit(Z.child,X));case"Literal":return Z.value;case"Pipe":return this.visit(Z.right,this.visit(Z.left,X));case"Function":{let G=[];for(let z of Z.children)G.push(this.visit(z,X));return this.runtime.callFunction(Z.name,G)}case"ExpressionReference":return{expref:!0,...Z.child};case"Current":case"Identity":return X}}computeSliceParams(Z,X){let{start:Q,stop:G,step:z}=X;if(z===null)z=1;else if(z===0){let Y=Error("Invalid value: slice step cannot be 0");throw Y.name="RuntimeError",Y}return Q=Q===null?z<0?Z-1:0:this.capSliceRange(Z,Q,z),G=G===null?z<0?-1:Z:this.capSliceRange(Z,G,z),{start:Q,stop:G,step:z}}capSliceRange(Z,X,Q){let G=X;if(G<0){if(G+=Z,G<0)G=Q<0?-1:0}else if(G>=Z)G=Q<0?Z-1:Z;return G}slice(Z,X,Q,G){let z=[];if(G>0)for(let Y=X;Y<Q;Y+=G)z.push(Z[Y]);else for(let Y=X;Y>Q;Y+=G)z.push(Z[Y]);return z}},G2=new Q2,z2=G2;function c6($,Z,X){let Q=Z2.parse(Z,X);return z2.search(Q,$)}function Y2($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var a={},P4={},j0={},d6;function a0(){if(d6)return j0;d6=1;function $(Y){return typeof Y>"u"||Y===null}function Z(Y){return typeof Y==="object"&&Y!==null}function X(Y){if(Array.isArray(Y))return Y;else if($(Y))return[];return[Y]}function Q(Y,K){if(K){let D=Object.keys(K);for(let H=0,q=D.length;H<q;H+=1){let M=D[H];Y[M]=K[M]}}return Y}function G(Y,K){let D="";for(let H=0;H<K;H+=1)D+=Y;return D}function z(Y){return Y===0&&Number.NEGATIVE_INFINITY===1/Y}return j0.isNothing=$,j0.isObject=Z,j0.toArray=X,j0.repeat=G,j0.isNegativeZero=z,j0.extend=Q,j0}var Y9,l6;function t0(){if(l6)return Y9;l6=1;function $(X,Q){let G="",z=X.reason||"(unknown reason)";if(!X.mark)return z;if(X.mark.name)G+='in "'+X.mark.name+'" ';if(G+="("+(X.mark.line+1)+":"+(X.mark.column+1)+")",!Q&&X.mark.snippet)G+=`
|
|
27
|
+
|
|
28
|
+
`+X.mark.snippet;return z+" "+G}function Z(X,Q){if(Error.call(this),this.name="YAMLException",this.reason=X,this.mark=Q,this.message=$(this,!1),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else this.stack=Error().stack||""}return Z.prototype=Object.create(Error.prototype),Z.prototype.constructor=Z,Z.prototype.toString=function(Q){return this.name+": "+$(this,Q)},Y9=Z,Y9}var W9,i6;function W2(){if(i6)return W9;i6=1;let $=a0();function Z(G,z,Y,K,D){let H="",q="",M=Math.floor(D/2)-1;if(K-z>M)H=" ... ",z=K-M+H.length;if(Y-K>M)q=" ...",Y=K+M-q.length;return{str:H+G.slice(z,Y).replace(/\t/g,"→")+q,pos:K-z+H.length}}function X(G,z){return $.repeat(" ",z-G.length)+G}function Q(G,z){if(z=Object.create(z||null),!G.buffer)return null;if(!z.maxLength)z.maxLength=79;if(typeof z.indent!=="number")z.indent=1;if(typeof z.linesBefore!=="number")z.linesBefore=3;if(typeof z.linesAfter!=="number")z.linesAfter=2;let Y=/\r?\n|\r|\0/g,K=[0],D=[],H,q=-1;while(H=Y.exec(G.buffer))if(D.push(H.index),K.push(H.index+H[0].length),G.position<=H.index&&q<0)q=K.length-2;if(q<0)q=K.length-1;let M="",C=Math.min(G.line+z.linesAfter,D.length).toString().length,E=z.maxLength-(z.indent+C+3);for(let y=1;y<=z.linesBefore;y++){if(q-y<0)break;let x=Z(G.buffer,K[q-y],D[q-y],G.position-(K[q]-K[q-y]),E);M=$.repeat(" ",z.indent)+X((G.line-y+1).toString(),C)+" | "+x.str+`
|
|
29
|
+
`+M}let g=Z(G.buffer,K[q],D[q],G.position,E);M+=$.repeat(" ",z.indent)+X((G.line+1).toString(),C)+" | "+g.str+`
|
|
30
|
+
`,M+=$.repeat("-",z.indent+C+3+g.pos)+`^
|
|
31
|
+
`;for(let y=1;y<=z.linesAfter;y++){if(q+y>=D.length)break;let x=Z(G.buffer,K[q+y],D[q+y],G.position-(K[q]-K[q+y]),E);M+=$.repeat(" ",z.indent)+X((G.line+y+1).toString(),C)+" | "+x.str+`
|
|
32
|
+
`}return M.replace(/\n$/,"")}return W9=Q,W9}var K9,n6;function Z0(){if(n6)return K9;n6=1;let $=t0(),Z=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],X=["scalar","sequence","mapping"];function Q(z){let Y={};if(z!==null)Object.keys(z).forEach(function(K){z[K].forEach(function(D){Y[String(D)]=K})});return Y}function G(z,Y){if(Y=Y||{},Object.keys(Y).forEach(function(K){if(Z.indexOf(K)===-1)throw new $('Unknown option "'+K+'" is met in definition of "'+z+'" YAML type.')}),this.options=Y,this.tag=z,this.kind=Y.kind||null,this.resolve=Y.resolve||function(){return!0},this.construct=Y.construct||function(K){return K},this.instanceOf=Y.instanceOf||null,this.predicate=Y.predicate||null,this.represent=Y.represent||null,this.representName=Y.representName||null,this.defaultStyle=Y.defaultStyle||null,this.multi=Y.multi||!1,this.styleAliases=Q(Y.styleAliases||null),X.indexOf(this.kind)===-1)throw new $('Unknown kind "'+this.kind+'" is specified for "'+z+'" YAML type.')}return K9=G,K9}var H9,o6;function M$(){if(o6)return H9;o6=1;let $=t0(),Z=Z0();function X(z,Y){let K=[];return z[Y].forEach(function(D){let H=K.length;K.forEach(function(q,M){if(q.tag===D.tag&&q.kind===D.kind&&q.multi===D.multi)H=M}),K[H]=D}),K}function Q(){let z={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function Y(K){if(K.multi)z.multi[K.kind].push(K),z.multi.fallback.push(K);else z[K.kind][K.tag]=z.fallback[K.tag]=K}for(let K=0,D=arguments.length;K<D;K+=1)arguments[K].forEach(Y);return z}function G(z){return this.extend(z)}return G.prototype.extend=function(Y){let K=[],D=[];if(Y instanceof Z)D.push(Y);else if(Array.isArray(Y))D=D.concat(Y);else if(Y&&(Array.isArray(Y.implicit)||Array.isArray(Y.explicit))){if(Y.implicit)K=K.concat(Y.implicit);if(Y.explicit)D=D.concat(Y.explicit)}else throw new $("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");K.forEach(function(q){if(!(q instanceof Z))throw new $("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(q.loadKind&&q.loadKind!=="scalar")throw new $("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(q.multi)throw new $("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),D.forEach(function(q){if(!(q instanceof Z))throw new $("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let H=Object.create(G.prototype);return H.implicit=(this.implicit||[]).concat(K),H.explicit=(this.explicit||[]).concat(D),H.compiledImplicit=X(H,"implicit"),H.compiledExplicit=X(H,"explicit"),H.compiledTypeMap=Q(H.compiledImplicit,H.compiledExplicit),H},H9=G,H9}var q9,r6;function U$(){if(r6)return q9;return r6=1,q9=new(Z0())("tag:yaml.org,2002:str",{kind:"scalar",construct:function(Z){return Z!==null?Z:""}}),q9}var D9,s6;function R$(){if(s6)return D9;return s6=1,D9=new(Z0())("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(Z){return Z!==null?Z:[]}}),D9}var V9,a6;function j$(){if(a6)return V9;return a6=1,V9=new(Z0())("tag:yaml.org,2002:map",{kind:"mapping",construct:function(Z){return Z!==null?Z:{}}}),V9}var B9,t6;function O$(){if(t6)return B9;return t6=1,B9=new(M$())({explicit:[U$(),R$(),j$()]}),B9}var M9,e6;function _$(){if(e6)return M9;e6=1;let $=Z0();function Z(G){if(G===null)return!0;let z=G.length;return z===1&&G==="~"||z===4&&(G==="null"||G==="Null"||G==="NULL")}function X(){return null}function Q(G){return G===null}return M9=new $("tag:yaml.org,2002:null",{kind:"scalar",resolve:Z,construct:X,predicate:Q,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),M9}var U9,$$;function F$(){if($$)return U9;$$=1;let $=Z0();function Z(G){if(G===null)return!1;let z=G.length;return z===4&&(G==="true"||G==="True"||G==="TRUE")||z===5&&(G==="false"||G==="False"||G==="FALSE")}function X(G){return G==="true"||G==="True"||G==="TRUE"}function Q(G){return Object.prototype.toString.call(G)==="[object Boolean]"}return U9=new $("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Z,construct:X,predicate:Q,represent:{lowercase:function(G){return G?"true":"false"},uppercase:function(G){return G?"TRUE":"FALSE"},camelcase:function(G){return G?"True":"False"}},defaultStyle:"lowercase"}),U9}var R9,Z$;function I$(){if(Z$)return R9;Z$=1;let $=a0(),Z=Z0();function X(H){return H>=48&&H<=57||H>=65&&H<=70||H>=97&&H<=102}function Q(H){return H>=48&&H<=55}function G(H){return H>=48&&H<=57}function z(H){if(H===null)return!1;let q=H.length,M=0,C=!1;if(!q)return!1;let E=H[M];if(E==="-"||E==="+")E=H[++M];if(E==="0"){if(M+1===q)return!0;if(E=H[++M],E==="b"){M++;for(;M<q;M++){if(E=H[M],E!=="0"&&E!=="1")return!1;C=!0}return C&&isFinite(Y(H))}if(E==="x"){M++;for(;M<q;M++){if(!X(H.charCodeAt(M)))return!1;C=!0}return C&&isFinite(Y(H))}if(E==="o"){M++;for(;M<q;M++){if(!Q(H.charCodeAt(M)))return!1;C=!0}return C&&isFinite(Y(H))}}for(;M<q;M++){if(!G(H.charCodeAt(M)))return!1;C=!0}if(!C)return!1;return isFinite(Y(H))}function Y(H){let q=H,M=1,C=q[0];if(C==="-"||C==="+"){if(C==="-")M=-1;q=q.slice(1),C=q[0]}if(q==="0")return 0;if(C==="0"){if(q[1]==="b")return M*parseInt(q.slice(2),2);if(q[1]==="x")return M*parseInt(q.slice(2),16);if(q[1]==="o")return M*parseInt(q.slice(2),8)}return M*parseInt(q,10)}function K(H){return Y(H)}function D(H){return Object.prototype.toString.call(H)==="[object Number]"&&(H%1===0&&!$.isNegativeZero(H))}return R9=new Z("tag:yaml.org,2002:int",{kind:"scalar",resolve:z,construct:K,predicate:D,represent:{binary:function(H){return H>=0?"0b"+H.toString(2):"-0b"+H.toString(2).slice(1)},octal:function(H){return H>=0?"0o"+H.toString(8):"-0o"+H.toString(8).slice(1)},decimal:function(H){return H.toString(10)},hexadecimal:function(H){return H>=0?"0x"+H.toString(16).toUpperCase():"-0x"+H.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),R9}var j9,X$;function L$(){if(X$)return j9;X$=1;let $=a0(),Z=Z0(),X=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),Q=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function G(H){if(H===null)return!1;if(!X.test(H))return!1;if(isFinite(parseFloat(H,10)))return!0;return Q.test(H)}function z(H){let q=H.toLowerCase(),M=q[0]==="-"?-1:1;if("+-".indexOf(q[0])>=0)q=q.slice(1);if(q===".inf")return M===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;else if(q===".nan")return NaN;return M*parseFloat(q,10)}let Y=/^[-+]?[0-9]+e/;function K(H,q){if(isNaN(H))switch(q){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===H)switch(q){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===H)switch(q){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if($.isNegativeZero(H))return"-0.0";let M=H.toString(10);return Y.test(M)?M.replace("e",".e"):M}function D(H){return Object.prototype.toString.call(H)==="[object Number]"&&(H%1!==0||$.isNegativeZero(H))}return j9=new Z("tag:yaml.org,2002:float",{kind:"scalar",resolve:G,construct:z,predicate:D,represent:K,defaultStyle:"lowercase"}),j9}var O9,J$;function P$(){if(J$)return O9;return J$=1,O9=O$().extend({implicit:[_$(),F$(),I$(),L$()]}),O9}var _9,Q$;function C$(){if(Q$)return _9;return Q$=1,_9=P$(),_9}var F9,G$;function w$(){if(G$)return F9;G$=1;let $=Z0(),Z=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),X=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Q(Y){if(Y===null)return!1;if(Z.exec(Y)!==null)return!0;if(X.exec(Y)!==null)return!0;return!1}function G(Y){let K=0,D=null,H=Z.exec(Y);if(H===null)H=X.exec(Y);if(H===null)throw Error("Date resolve error");let q=+H[1],M=+H[2]-1,C=+H[3];if(!H[4])return new Date(Date.UTC(q,M,C));let E=+H[4],g=+H[5],y=+H[6];if(H[7]){K=H[7].slice(0,3);while(K.length<3)K+="0";K=+K}if(H[9]){let b=+H[10],v=+(H[11]||0);if(D=(b*60+v)*60000,H[9]==="-")D=-D}let x=new Date(Date.UTC(q,M,C,E,g,y,K));if(D)x.setTime(x.getTime()-D);return x}function z(Y){return Y.toISOString()}return F9=new $("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Q,construct:G,instanceOf:Date,represent:z}),F9}var I9,z$;function N$(){if(z$)return I9;z$=1;let $=Z0();function Z(X){return X==="<<"||X===null}return I9=new $("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Z}),I9}var L9,Y$;function T$(){if(Y$)return L9;Y$=1;let $=Z0(),Z=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
33
|
+
\r`;function X(Y){if(Y===null)return!1;let K=0,D=Y.length,H=Z;for(let q=0;q<D;q++){let M=H.indexOf(Y.charAt(q));if(M>64)continue;if(M<0)return!1;K+=6}return K%8===0}function Q(Y){let K=Y.replace(/[\r\n=]/g,""),D=K.length,H=Z,q=0,M=[];for(let E=0;E<D;E++){if(E%4===0&&E)M.push(q>>16&255),M.push(q>>8&255),M.push(q&255);q=q<<6|H.indexOf(K.charAt(E))}let C=D%4*6;if(C===0)M.push(q>>16&255),M.push(q>>8&255),M.push(q&255);else if(C===18)M.push(q>>10&255),M.push(q>>2&255);else if(C===12)M.push(q>>4&255);return new Uint8Array(M)}function G(Y){let K="",D=0,H=Y.length,q=Z;for(let C=0;C<H;C++){if(C%3===0&&C)K+=q[D>>18&63],K+=q[D>>12&63],K+=q[D>>6&63],K+=q[D&63];D=(D<<8)+Y[C]}let M=H%3;if(M===0)K+=q[D>>18&63],K+=q[D>>12&63],K+=q[D>>6&63],K+=q[D&63];else if(M===2)K+=q[D>>10&63],K+=q[D>>4&63],K+=q[D<<2&63],K+=q[64];else if(M===1)K+=q[D>>2&63],K+=q[D<<4&63],K+=q[64],K+=q[64];return K}function z(Y){return Object.prototype.toString.call(Y)==="[object Uint8Array]"}return L9=new $("tag:yaml.org,2002:binary",{kind:"scalar",resolve:X,construct:Q,predicate:z,represent:G}),L9}var P9,W$;function S$(){if(W$)return P9;W$=1;let $=Z0(),Z=Object.prototype.hasOwnProperty,X=Object.prototype.toString;function Q(z){if(z===null)return!0;let Y=[],K=z;for(let D=0,H=K.length;D<H;D+=1){let q=K[D],M=!1;if(X.call(q)!=="[object Object]")return!1;let C;for(C in q)if(Z.call(q,C))if(!M)M=!0;else return!1;if(!M)return!1;if(Y.indexOf(C)===-1)Y.push(C);else return!1}return!0}function G(z){return z!==null?z:[]}return P9=new $("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Q,construct:G}),P9}var C9,K$;function A$(){if(K$)return C9;K$=1;let $=Z0(),Z=Object.prototype.toString;function X(G){if(G===null)return!0;let z=G,Y=Array(z.length);for(let K=0,D=z.length;K<D;K+=1){let H=z[K];if(Z.call(H)!=="[object Object]")return!1;let q=Object.keys(H);if(q.length!==1)return!1;Y[K]=[q[0],H[q[0]]]}return!0}function Q(G){if(G===null)return[];let z=G,Y=Array(z.length);for(let K=0,D=z.length;K<D;K+=1){let H=z[K],q=Object.keys(H);Y[K]=[q[0],H[q[0]]]}return Y}return C9=new $("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:X,construct:Q}),C9}var w9,H$;function E$(){if(H$)return w9;H$=1;let $=Z0(),Z=Object.prototype.hasOwnProperty;function X(G){if(G===null)return!0;let z=G;for(let Y in z)if(Z.call(z,Y)){if(z[Y]!==null)return!1}return!0}function Q(G){return G!==null?G:{}}return w9=new $("tag:yaml.org,2002:set",{kind:"mapping",resolve:X,construct:Q}),w9}var N9,q$;function S9(){if(q$)return N9;return q$=1,N9=C$().extend({implicit:[w$(),N$()],explicit:[T$(),S$(),A$(),E$()]}),N9}var D$;function K2(){if(D$)return P4;D$=1;let $=a0(),Z=t0(),X=W2(),Q=S9(),G=Object.prototype.hasOwnProperty,z=1,Y=2,K=3,D=4,H=1,q=2,M=3,C=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,E=/[\x85\u2028\u2029]/,g=/[,\[\]{}]/,y=/^(?:!|!!|![0-9A-Za-z-]+!)$/,x=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function b(J){return Object.prototype.toString.call(J)}function v(J){return J===10||J===13}function T(J){return J===9||J===32}function h(J){return J===9||J===32||J===10||J===13}function p(J){return J===44||J===91||J===93||J===123||J===125}function X0(J){if(J>=48&&J<=57)return J-48;let V=J|32;if(V>=97&&V<=102)return V-97+10;return-1}function Q0(J){if(J===120)return 2;if(J===117)return 4;if(J===85)return 8;return 0}function G0(J){if(J>=48&&J<=57)return J-48;return-1}function e(J){switch(J){case 48:return"\x00";case 97:return"\x07";case 98:return"\b";case 116:return"\t";case 9:return"\t";case 110:return`
|
|
34
|
+
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"
";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function Y0(J){if(J<=65535)return String.fromCharCode(J);return String.fromCharCode((J-65536>>10)+55296,(J-65536&1023)+56320)}function M0(J,V,R){if(V==="__proto__")Object.defineProperty(J,V,{configurable:!0,enumerable:!0,writable:!0,value:R});else J[V]=R}let P0=Array(256),E0=Array(256);for(let J=0;J<256;J++)P0[J]=e(J)?1:0,E0[J]=e(J);function n(J,V){this.input=J,this.filename=V.filename||null,this.schema=V.schema||Q,this.onWarning=V.onWarning||null,this.legacy=V.legacy||!1,this.json=V.json||!1,this.listener=V.listener||null,this.maxDepth=typeof V.maxDepth==="number"?V.maxDepth:100,this.maxTotalMergeKeys=typeof V.maxTotalMergeKeys==="number"?V.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=J.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function W4(J,V){let R={name:J.filename,buffer:J.input.slice(0,-1),position:J.position,line:J.line,column:J.position-J.lineStart};return R.snippet=X(R),new Z(V,R)}function S(J,V){throw W4(J,V)}function x0(J,V){if(J.onWarning)J.onWarning.call(null,W4(J,V))}function W0(J,V,R){let _=J.anchorMapTransactions;if(_.length!==0){let U=_[_.length-1];if(!G.call(U,V))U[V]={existed:G.call(J.anchorMap,V),value:J.anchorMap[V]}}J.anchorMap[V]=R}function c4(J){J.anchorMapTransactions.push(Object.create(null))}function C0(J){let V=J.anchorMapTransactions.pop(),R=J.anchorMapTransactions;if(R.length===0)return;let _=R[R.length-1],U=Object.keys(V);for(let P=0,W=U.length;P<W;P+=1){let B=U[P];if(!G.call(_,B))_[B]=V[B]}}function d4(J){let V=J.anchorMapTransactions.pop(),R=Object.keys(V);for(let _=R.length-1;_>=0;_-=1){let U=V[R[_]];if(U.existed)J.anchorMap[R[_]]=U.value;else delete J.anchorMap[R[_]]}}function d0(J){return{position:J.position,line:J.line,lineStart:J.lineStart,lineIndent:J.lineIndent,firstTabInLine:J.firstTabInLine,tag:J.tag,anchor:J.anchor,kind:J.kind,result:J.result}}function k0(J,V){J.position=V.position,J.line=V.line,J.lineStart=V.lineStart,J.lineIndent=V.lineIndent,J.firstTabInLine=V.firstTabInLine,J.tag=V.tag,J.anchor=V.anchor,J.kind=V.kind,J.result=V.result}let K4={YAML:function(V,R,_){if(V.version!==null)S(V,"duplication of %YAML directive");if(_.length!==1)S(V,"YAML directive accepts exactly one argument");let U=/^([0-9]+)\.([0-9]+)$/.exec(_[0]);if(U===null)S(V,"ill-formed argument of the YAML directive");let P=parseInt(U[1],10),W=parseInt(U[2],10);if(P!==1)S(V,"unacceptable YAML version of the document");if(V.version=_[0],V.checkLineBreaks=W<2,W!==1&&W!==2)x0(V,"unsupported YAML version of the document")},TAG:function(V,R,_){let U;if(_.length!==2)S(V,"TAG directive accepts exactly two arguments");let P=_[0];if(U=_[1],!y.test(P))S(V,"ill-formed tag handle (first argument) of the TAG directive");if(G.call(V.tagMap,P))S(V,'there is a previously declared suffix for "'+P+'" tag handle');if(!x.test(U))S(V,"ill-formed tag prefix (second argument) of the TAG directive");try{U=decodeURIComponent(U)}catch(W){S(V,"tag prefix is malformed: "+U)}V.tagMap[P]=U}};function J0(J,V,R,_){if(V<R){let U=J.input.slice(V,R);if(_)for(let P=0,W=U.length;P<W;P+=1){let B=U.charCodeAt(P);if(!(B===9||B>=32&&B<=1114111))S(J,"expected valid JSON character")}else if(C.test(U))S(J,"the stream contains non-printable characters");J.result+=U}}function U0(J,V,R,_){if(!$.isObject(R))S(J,"cannot merge mappings; the provided source object is unacceptable");let U=Object.keys(R);for(let P=0,W=U.length;P<W;P+=1){let B=U[P];if(J.maxTotalMergeKeys!==-1&&++J.totalMergeKeys>J.maxTotalMergeKeys)S(J,"merge keys exceeded maxTotalMergeKeys ("+J.maxTotalMergeKeys+")");if(!G.call(V,B))M0(V,B,R[B]),_[B]=!0}}function K0(J,V,R,_,U,P,W,B,I){if(Array.isArray(U)){U=Array.prototype.slice.call(U);for(let j=0,O=U.length;j<O;j+=1){if(Array.isArray(U[j]))S(J,"nested arrays are not supported inside keys");if(typeof U==="object"&&b(U[j])==="[object Object]")U[j]="[object Object]"}}if(typeof U==="object"&&b(U)==="[object Object]")U="[object Object]";if(U=String(U),V===null)V={};if(_==="tag:yaml.org,2002:merge")if(Array.isArray(P))for(let j=0,O=P.length;j<O;j+=1)U0(J,V,P[j],R);else U0(J,V,P,R);else{if(!J.json&&!G.call(R,U)&&G.call(V,U))J.line=W||J.line,J.lineStart=B||J.lineStart,J.position=I||J.position,S(J,"duplicated mapping key");M0(V,U,P),delete R[U]}return V}function y0(J){let V=J.input.charCodeAt(J.position);if(V===10)J.position++;else if(V===13){if(J.position++,J.input.charCodeAt(J.position)===10)J.position++}else S(J,"a line break is expected");J.line+=1,J.lineStart=J.position,J.firstTabInLine=-1}function l(J,V,R){let _=0,U=J.input.charCodeAt(J.position);while(U!==0){while(T(U)){if(U===9&&J.firstTabInLine===-1)J.firstTabInLine=J.position;U=J.input.charCodeAt(++J.position)}if(V&&U===35)do U=J.input.charCodeAt(++J.position);while(U!==10&&U!==13&&U!==0);if(v(U)){y0(J),U=J.input.charCodeAt(J.position),_++,J.lineIndent=0;while(U===32)J.lineIndent++,U=J.input.charCodeAt(++J.position)}else break}if(R!==-1&&_!==0&&J.lineIndent<R)x0(J,"deficient indentation");return _}function b0(J){let V=J.position,R=J.input.charCodeAt(V);if((R===45||R===46)&&R===J.input.charCodeAt(V+1)&&R===J.input.charCodeAt(V+2)){if(V+=3,R=J.input.charCodeAt(V),R===0||h(R))return!0}return!1}function H0(J,V){if(V===1)J.result+=" ";else if(V>1)J.result+=$.repeat(`
|
|
35
|
+
`,V-1)}function H4(J,V,R){let _,U,P,W,B,I,j=J.kind,O=J.result,L=J.input.charCodeAt(J.position);if(h(L)||p(L)||L===35||L===38||L===42||L===33||L===124||L===62||L===39||L===34||L===37||L===64||L===96)return!1;if(L===63||L===45){let F=J.input.charCodeAt(J.position+1);if(h(F)||R&&p(F))return!1}J.kind="scalar",J.result="",_=U=J.position,P=!1;while(L!==0){if(L===58){let F=J.input.charCodeAt(J.position+1);if(h(F)||R&&p(F))break}else if(L===35){let F=J.input.charCodeAt(J.position-1);if(h(F))break}else if(J.position===J.lineStart&&b0(J)||R&&p(L))break;else if(v(L))if(W=J.line,B=J.lineStart,I=J.lineIndent,l(J,!1,-1),J.lineIndent>=V){P=!0,L=J.input.charCodeAt(J.position);continue}else{J.position=U,J.line=W,J.lineStart=B,J.lineIndent=I;break}if(P)J0(J,_,U,!1),H0(J,J.line-W),_=U=J.position,P=!1;if(!T(L))U=J.position+1;L=J.input.charCodeAt(++J.position)}if(J0(J,_,U,!1),J.result)return!0;return J.kind=j,J.result=O,!1}function q4(J,V){let R,_,U=J.input.charCodeAt(J.position);if(U!==39)return!1;J.kind="scalar",J.result="",J.position++,R=_=J.position;while((U=J.input.charCodeAt(J.position))!==0)if(U===39)if(J0(J,R,J.position,!0),U=J.input.charCodeAt(++J.position),U===39)R=J.position,J.position++,_=J.position;else return!0;else if(v(U))J0(J,R,_,!0),H0(J,l(J,!1,V)),R=_=J.position;else if(J.position===J.lineStart&&b0(J))S(J,"unexpected end of the document within a single quoted scalar");else if(J.position++,!T(U))_=J.position;S(J,"unexpected end of the stream within a single quoted scalar")}function l0(J,V){let R,_,U,P=J.input.charCodeAt(J.position);if(P!==34)return!1;J.kind="scalar",J.result="",J.position++,R=_=J.position;while((P=J.input.charCodeAt(J.position))!==0)if(P===34)return J0(J,R,J.position,!0),J.position++,!0;else if(P===92){if(J0(J,R,J.position,!0),P=J.input.charCodeAt(++J.position),v(P))l(J,!1,V);else if(P<256&&P0[P])J.result+=E0[P],J.position++;else if((U=Q0(P))>0){let W=U,B=0;for(;W>0;W--)if(P=J.input.charCodeAt(++J.position),(U=X0(P))>=0)B=(B<<4)+U;else S(J,"expected hexadecimal character");J.result+=Y0(B),J.position++}else S(J,"unknown escape sequence");R=_=J.position}else if(v(P))J0(J,R,_,!0),H0(J,l(J,!1,V)),R=_=J.position;else if(J.position===J.lineStart&&b0(J))S(J,"unexpected end of the document within a double quoted scalar");else if(J.position++,!T(P))_=J.position;S(J,"unexpected end of the stream within a double quoted scalar")}function D4(J,V){let R=!0,_,U,P,W=J.tag,B,I=J.anchor,j,O,L,F,N=Object.create(null),w,A,k,m=J.input.charCodeAt(J.position);if(m===91)j=93,F=!1,B=[];else if(m===123)j=125,F=!0,B={};else return!1;if(J.anchor!==null)W0(J,J.anchor,B);m=J.input.charCodeAt(++J.position);while(m!==0){if(l(J,!0,V),m=J.input.charCodeAt(J.position),m===j)return J.position++,J.tag=W,J.anchor=I,J.kind=F?"mapping":"sequence",J.result=B,!0;else if(!R)S(J,"missed comma between flow collection entries");else if(m===44)S(J,"expected the node content, but found ','");if(A=w=k=null,O=L=!1,m===63){let c=J.input.charCodeAt(J.position+1);if(h(c))O=L=!0,J.position++,l(J,!0,V)}if(_=J.line,U=J.lineStart,P=J.position,D0(J,V,z,!1,!0),A=J.tag,w=J.result,l(J,!0,V),m=J.input.charCodeAt(J.position),(L||J.line===_)&&m===58)O=!0,m=J.input.charCodeAt(++J.position),l(J,!0,V),D0(J,V,z,!1,!0),k=J.result;if(F)K0(J,B,N,A,w,k,_,U,P);else if(O)B.push(K0(J,null,N,A,w,k,_,U,P));else B.push(w);if(l(J,!0,V),m=J.input.charCodeAt(J.position),m===44)R=!0,m=J.input.charCodeAt(++J.position);else R=!1}S(J,"unexpected end of the stream within a flow collection")}function V4(J,V){let R,_=H,U=!1,P=!1,W=V,B=0,I=!1,j,O=J.input.charCodeAt(J.position);if(O===124)R=!1;else if(O===62)R=!0;else return!1;J.kind="scalar",J.result="";while(O!==0)if(O=J.input.charCodeAt(++J.position),O===43||O===45)if(H===_)_=O===43?M:q;else S(J,"repeat of a chomping mode identifier");else if((j=G0(O))>=0)if(j===0)S(J,"bad explicit indentation width of a block scalar; it cannot be less than one");else if(!P)W=V+j-1,P=!0;else S(J,"repeat of an indentation width identifier");else break;if(T(O)){do O=J.input.charCodeAt(++J.position);while(T(O));if(O===35)do O=J.input.charCodeAt(++J.position);while(!v(O)&&O!==0)}while(O!==0){y0(J),J.lineIndent=0,O=J.input.charCodeAt(J.position);while((!P||J.lineIndent<W)&&O===32)J.lineIndent++,O=J.input.charCodeAt(++J.position);if(!P&&J.lineIndent>W)W=J.lineIndent;if(v(O)){B++;continue}if(!P&&W===0)S(J,"missing indentation for block scalar");if(J.lineIndent<W){if(_===M)J.result+=$.repeat(`
|
|
36
|
+
`,U?1+B:B);else if(_===H){if(U)J.result+=`
|
|
37
|
+
`}break}if(R)if(T(O))I=!0,J.result+=$.repeat(`
|
|
38
|
+
`,U?1+B:B);else if(I)I=!1,J.result+=$.repeat(`
|
|
39
|
+
`,B+1);else if(B===0){if(U)J.result+=" "}else J.result+=$.repeat(`
|
|
40
|
+
`,B);else J.result+=$.repeat(`
|
|
41
|
+
`,U?1+B:B);U=!0,P=!0,B=0;let L=J.position;while(!v(O)&&O!==0)O=J.input.charCodeAt(++J.position);J0(J,L,J.position,!1)}return!0}function q0(J,V){let{tag:R,anchor:_}=J,U=[],P=!1;if(J.firstTabInLine!==-1)return!1;if(J.anchor!==null)W0(J,J.anchor,U);let W=J.input.charCodeAt(J.position);while(W!==0){if(J.firstTabInLine!==-1)J.position=J.firstTabInLine,S(J,"tab characters must not be used in indentation");if(W!==45)break;let B=J.input.charCodeAt(J.position+1);if(!h(B))break;if(P=!0,J.position++,l(J,!0,-1)){if(J.lineIndent<=V){U.push(null),W=J.input.charCodeAt(J.position);continue}}let I=J.line;if(D0(J,V,K,!1,!0),U.push(J.result),l(J,!0,-1),W=J.input.charCodeAt(J.position),(J.line===I||J.lineIndent>V)&&W!==0)S(J,"bad indentation of a sequence entry");else if(J.lineIndent<V)break}if(P)return J.tag=R,J.anchor=_,J.kind="sequence",J.result=U,!0;return!1}function B4(J,V,R){let _,U,P,W,B=J.tag,I=J.anchor,j={},O=Object.create(null),L=null,F=null,N=null,w=!1,A=!1;if(J.firstTabInLine!==-1)return!1;if(J.anchor!==null)W0(J,J.anchor,j);let k=J.input.charCodeAt(J.position);while(k!==0){if(!w&&J.firstTabInLine!==-1)J.position=J.firstTabInLine,S(J,"tab characters must not be used in indentation");let m=J.input.charCodeAt(J.position+1),c=J.line;if((k===63||k===58)&&h(m)){if(k===63){if(w)K0(J,j,O,L,F,null,U,P,W),L=F=N=null;A=!0,w=!0,_=!0}else if(w)w=!1,_=!0;else S(J,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");J.position+=1,k=m}else{if(U=J.line,P=J.lineStart,W=J.position,!D0(J,R,Y,!1,!0))break;if(J.line===c){k=J.input.charCodeAt(J.position);while(T(k))k=J.input.charCodeAt(++J.position);if(k===58){if(k=J.input.charCodeAt(++J.position),!h(k))S(J,"a whitespace character is expected after the key-value separator within a block mapping");if(w)K0(J,j,O,L,F,null,U,P,W),L=F=N=null;A=!0,w=!1,_=!1,L=J.tag,F=J.result}else if(A)S(J,"can not read an implicit mapping pair; a colon is missed");else return J.tag=B,J.anchor=I,!0}else if(A)S(J,"can not read a block mapping entry; a multiline key may not be an implicit key");else return J.tag=B,J.anchor=I,!0}if(J.line===c||J.lineIndent>V){if(w)U=J.line,P=J.lineStart,W=J.position;if(D0(J,V,D,!0,_))if(w)F=J.result;else N=J.result;if(!w)K0(J,j,O,L,F,N,U,P,W),L=F=N=null;l(J,!0,-1),k=J.input.charCodeAt(J.position)}if((J.line===c||J.lineIndent>V)&&k!==0)S(J,"bad indentation of a mapping entry");else if(J.lineIndent<V)break}if(w)K0(J,j,O,L,F,null,U,P,W);if(A)J.tag=B,J.anchor=I,J.kind="mapping",J.result=j;return A}function l4(J){let V=!1,R=!1,_,U,P=J.input.charCodeAt(J.position);if(P!==33)return!1;if(J.tag!==null)S(J,"duplication of a tag property");if(P=J.input.charCodeAt(++J.position),P===60)V=!0,P=J.input.charCodeAt(++J.position);else if(P===33)R=!0,_="!!",P=J.input.charCodeAt(++J.position);else _="!";let W=J.position;if(V){do P=J.input.charCodeAt(++J.position);while(P!==0&&P!==62);if(J.position<J.length)U=J.input.slice(W,J.position),P=J.input.charCodeAt(++J.position);else S(J,"unexpected end of the stream within a verbatim tag")}else{while(P!==0&&!h(P)){if(P===33)if(!R){if(_=J.input.slice(W-1,J.position+1),!y.test(_))S(J,"named tag handle cannot contain such characters");R=!0,W=J.position+1}else S(J,"tag suffix cannot contain exclamation marks");P=J.input.charCodeAt(++J.position)}if(U=J.input.slice(W,J.position),g.test(U))S(J,"tag suffix cannot contain flow indicator characters")}if(U&&!x.test(U))S(J,"tag name cannot contain such characters: "+U);try{U=decodeURIComponent(U)}catch(B){S(J,"tag name is malformed: "+U)}if(V)J.tag=U;else if(G.call(J.tagMap,_))J.tag=J.tagMap[_]+U;else if(_==="!")J.tag="!"+U;else if(_==="!!")J.tag="tag:yaml.org,2002:"+U;else S(J,'undeclared tag handle "'+_+'"');return!0}function M4(J){let V=J.input.charCodeAt(J.position);if(V!==38)return!1;if(J.anchor!==null)S(J,"duplication of an anchor property");V=J.input.charCodeAt(++J.position);let R=J.position;while(V!==0&&!h(V)&&!p(V))V=J.input.charCodeAt(++J.position);if(J.position===R)S(J,"name of an anchor node must contain at least one character");return J.anchor=J.input.slice(R,J.position),!0}function U4(J){let V=J.input.charCodeAt(J.position);if(V!==42)return!1;V=J.input.charCodeAt(++J.position);let R=J.position;while(V!==0&&!h(V)&&!p(V))V=J.input.charCodeAt(++J.position);if(J.position===R)S(J,"name of an alias node must contain at least one character");let _=J.input.slice(R,J.position);if(!G.call(J.anchorMap,_))S(J,'unidentified alias "'+_+'"');return J.result=J.anchorMap[_],l(J,!0,-1),!0}function i4(J,V,R,_){let U=d0(J);if(c4(J),k0(J,V),J.tag=null,J.anchor=null,J.kind=null,J.result=null,B4(J,R,_)&&J.kind==="mapping")return C0(J),!0;return d4(J),k0(J,U),!1}function D0(J,V,R,_,U){let P,W,B=1,I=!1,j=!1,O=null,L,F,N;if(J.depth>=J.maxDepth)S(J,"nesting exceeded maxDepth ("+J.maxDepth+")");if(J.depth+=1,J.listener!==null)J.listener("open",J);J.tag=null,J.anchor=null,J.kind=null,J.result=null;let w=P=W=D===R||K===R;if(_){if(l(J,!0,-1)){if(I=!0,J.lineIndent>V)B=1;else if(J.lineIndent===V)B=0;else if(J.lineIndent<V)B=-1}}if(B===1)while(!0){let A=J.input.charCodeAt(J.position),k=d0(J);if(I&&(A===33&&J.tag!==null||A===38&&J.anchor!==null))break;if(!l4(J)&&!M4(J))break;if(O===null)O=k;if(l(J,!0,-1)){if(I=!0,W=w,J.lineIndent>V)B=1;else if(J.lineIndent===V)B=0;else if(J.lineIndent<V)B=-1}else W=!1}if(W)W=I||U;if(B===1||D===R){if(z===R||Y===R)F=V;else F=V+1;if(N=J.position-J.lineStart,B===1)if(W&&(q0(J,N)||B4(J,N,F))||D4(J,F))j=!0;else{let A=J.input.charCodeAt(J.position);if(O!==null&&w&&!W&&A!==124&&A!==62&&i4(J,O,O.position-O.lineStart,F))j=!0;else if(P&&V4(J,F)||q4(J,F)||l0(J,F))j=!0;else if(U4(J)){if(j=!0,J.tag!==null||J.anchor!==null)S(J,"alias node should not have any properties")}else if(H4(J,F,z===R)){if(j=!0,J.tag===null)J.tag="?"}if(J.anchor!==null)W0(J,J.anchor,J.result)}else if(B===0)j=W&&q0(J,N)}if(J.tag===null){if(J.anchor!==null)W0(J,J.anchor,J.result)}else if(J.tag==="?"){if(J.result!==null&&J.kind!=="scalar")S(J,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+J.kind+'"');for(let A=0,k=J.implicitTypes.length;A<k;A+=1)if(L=J.implicitTypes[A],L.resolve(J.result)){if(J.result=L.construct(J.result),J.tag=L.tag,J.anchor!==null)W0(J,J.anchor,J.result);break}}else if(J.tag!=="!"){if(G.call(J.typeMap[J.kind||"fallback"],J.tag))L=J.typeMap[J.kind||"fallback"][J.tag];else{L=null;let A=J.typeMap.multi[J.kind||"fallback"];for(let k=0,m=A.length;k<m;k+=1)if(J.tag.slice(0,A[k].tag.length)===A[k].tag){L=A[k];break}}if(!L)S(J,"unknown tag !<"+J.tag+">");if(J.result!==null&&L.kind!==J.kind)S(J,"unacceptable node kind for !<"+J.tag+'> tag; it should be "'+L.kind+'", not "'+J.kind+'"');if(!L.resolve(J.result,J.tag))S(J,"cannot resolve a node with !<"+J.tag+"> explicit tag");else if(J.result=L.construct(J.result,J.tag),J.anchor!==null)W0(J,J.anchor,J.result)}if(J.listener!==null)J.listener("close",J);return J.depth-=1,J.tag!==null||J.anchor!==null||j}function n4(J){let V=J.position,R=!1,_;J.version=null,J.checkLineBreaks=J.legacy,J.tagMap=Object.create(null),J.anchorMap=Object.create(null);while((_=J.input.charCodeAt(J.position))!==0){if(l(J,!0,-1),_=J.input.charCodeAt(J.position),J.lineIndent>0||_!==37)break;R=!0,_=J.input.charCodeAt(++J.position);let U=J.position;while(_!==0&&!h(_))_=J.input.charCodeAt(++J.position);let P=J.input.slice(U,J.position),W=[];if(P.length<1)S(J,"directive name must not be less than one character in length");while(_!==0){while(T(_))_=J.input.charCodeAt(++J.position);if(_===35){do _=J.input.charCodeAt(++J.position);while(_!==0&&!v(_));break}if(v(_))break;U=J.position;while(_!==0&&!h(_))_=J.input.charCodeAt(++J.position);W.push(J.input.slice(U,J.position))}if(_!==0)y0(J);if(G.call(K4,P))K4[P](J,P,W);else x0(J,'unknown document directive "'+P+'"')}if(l(J,!0,-1),J.lineIndent===0&&J.input.charCodeAt(J.position)===45&&J.input.charCodeAt(J.position+1)===45&&J.input.charCodeAt(J.position+2)===45)J.position+=3,l(J,!0,-1);else if(R)S(J,"directives end mark is expected");if(D0(J,J.lineIndent-1,D,!1,!0),l(J,!0,-1),J.checkLineBreaks&&E.test(J.input.slice(V,J.position)))x0(J,"non-ASCII line breaks are interpreted as content");if(J.documents.push(J.result),J.position===J.lineStart&&b0(J)){if(J.input.charCodeAt(J.position)===46)J.position+=3,l(J,!0,-1);return}if(J.position<J.length-1)S(J,"end of the stream or a document separator is expected")}function R4(J,V){if(J=String(J),V=V||{},J.length!==0){if(J.charCodeAt(J.length-1)!==10&&J.charCodeAt(J.length-1)!==13)J+=`
|
|
42
|
+
`;if(J.charCodeAt(0)===65279)J=J.slice(1)}let R=new n(J,V),_=J.indexOf("\x00");if(_!==-1)R.position=_,S(R,"null byte is not allowed in input");R.input+="\x00";while(R.input.charCodeAt(R.position)===32)R.lineIndent+=1,R.position+=1;while(R.position<R.length-1)n4(R);return R.documents}function j4(J,V,R){if(V!==null&&typeof V==="object"&&typeof R>"u")R=V,V=null;let _=R4(J,R);if(typeof V!=="function")return _;for(let U=0,P=_.length;U<P;U+=1)V(_[U])}function o4(J,V){let R=R4(J,V);if(R.length===0)return;else if(R.length===1)return R[0];throw new Z("expected a single document in the stream, but found more")}return P4.loadAll=j4,P4.load=o4,P4}var T9={},V$;function H2(){if(V$)return T9;V$=1;let $=a0(),Z=t0(),X=S9(),Q=Object.prototype.toString,G=Object.prototype.hasOwnProperty,z=65279,Y=9,K=10,D=13,H=32,q=33,M=34,C=35,E=37,g=38,y=39,x=42,b=44,v=45,T=58,h=61,p=62,X0=63,Q0=64,G0=91,e=93,Y0=96,M0=123,P0=124,E0=125,n={};n[0]="\\0",n[7]="\\a",n[8]="\\b",n[9]="\\t",n[10]="\\n",n[11]="\\v",n[12]="\\f",n[13]="\\r",n[27]="\\e",n[34]="\\\"",n[92]="\\\\",n[133]="\\N",n[160]="\\_",n[8232]="\\L",n[8233]="\\P";let W4=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],S=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function x0(W,B){if(B===null)return{};let I={},j=Object.keys(B);for(let O=0,L=j.length;O<L;O+=1){let F=j[O],N=String(B[F]);if(F.slice(0,2)==="!!")F="tag:yaml.org,2002:"+F.slice(2);let w=W.compiledTypeMap.fallback[F];if(w&&G.call(w.styleAliases,N))N=w.styleAliases[N];I[F]=N}return I}function W0(W){let B,I,j=W.toString(16).toUpperCase();if(W<=255)B="x",I=2;else if(W<=65535)B="u",I=4;else if(W<=4294967295)B="U",I=8;else throw new Z("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+B+$.repeat("0",I-j.length)+j}let c4=1,C0=2;function d4(W){this.schema=W.schema||X,this.indent=Math.max(1,W.indent||2),this.noArrayIndent=W.noArrayIndent||!1,this.skipInvalid=W.skipInvalid||!1,this.flowLevel=$.isNothing(W.flowLevel)?-1:W.flowLevel,this.styleMap=x0(this.schema,W.styles||null),this.sortKeys=W.sortKeys||!1,this.lineWidth=W.lineWidth||80,this.noRefs=W.noRefs||!1,this.noCompatMode=W.noCompatMode||!1,this.condenseFlow=W.condenseFlow||!1,this.quotingType=W.quotingType==='"'?C0:c4,this.forceQuotes=W.forceQuotes||!1,this.replacer=typeof W.replacer==="function"?W.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function d0(W,B){let I=$.repeat(" ",B),j=0,O="",L=W.length;while(j<L){let F,N=W.indexOf(`
|
|
43
|
+
`,j);if(N===-1)F=W.slice(j),j=L;else F=W.slice(j,N+1),j=N+1;if(F.length&&F!==`
|
|
44
|
+
`)O+=I;O+=F}return O}function k0(W,B){return`
|
|
45
|
+
`+$.repeat(" ",W.indent*B)}function K4(W,B){for(let I=0,j=W.implicitTypes.length;I<j;I+=1)if(W.implicitTypes[I].resolve(B))return!0;return!1}function J0(W){return W===H||W===Y}function U0(W){return W>=32&&W<=126||W>=161&&W<=55295&&W!==8232&&W!==8233||W>=57344&&W<=65533&&W!==z||W>=65536&&W<=1114111}function K0(W){return U0(W)&&W!==z&&W!==D&&W!==K}function y0(W,B,I){let j=K0(W),O=j&&!J0(W);return(I?j:j&&W!==b&&W!==G0&&W!==e&&W!==M0&&W!==E0)&&W!==C&&!(B===T&&!O)||K0(B)&&!J0(B)&&W===C||B===T&&O}function l(W){return U0(W)&&W!==z&&!J0(W)&&W!==v&&W!==X0&&W!==T&&W!==b&&W!==G0&&W!==e&&W!==M0&&W!==E0&&W!==C&&W!==g&&W!==x&&W!==q&&W!==P0&&W!==h&&W!==p&&W!==y&&W!==M&&W!==E&&W!==Q0&&W!==Y0}function b0(W){return!J0(W)&&W!==T}function H0(W,B){let I=W.charCodeAt(B),j;if(I>=55296&&I<=56319&&B+1<W.length){if(j=W.charCodeAt(B+1),j>=56320&&j<=57343)return(I-55296)*1024+j-56320+65536}return I}function H4(W){return/^\n* /.test(W)}let q4=1,l0=2,D4=3,V4=4,q0=5;function B4(W,B,I,j,O,L,F,N){let w,A=0,k=null,m=!1,c=!1,D6=j!==-1,i0=-1,n0=l(H0(W,0))&&b0(H0(W,W.length-1));if(B||F)for(w=0;w<W.length;A>=65536?w+=2:w++){if(A=H0(W,w),!U0(A))return q0;n0=n0&&y0(A,k,N),k=A}else{for(w=0;w<W.length;A>=65536?w+=2:w++){if(A=H0(W,w),A===K){if(m=!0,D6)c=c||w-i0-1>j&&W[i0+1]!==" ",i0=w}else if(!U0(A))return q0;n0=n0&&y0(A,k,N),k=A}c=c||D6&&(w-i0-1>j&&W[i0+1]!==" ")}if(!m&&!c){if(n0&&!F&&!O(W))return q4;return L===C0?q0:l0}if(I>9&&H4(W))return q0;if(!F)return c?V4:D4;return L===C0?q0:l0}function l4(W,B,I,j,O){W.dump=function(){if(B.length===0)return W.quotingType===C0?'""':"''";if(!W.noCompatMode){if(W4.indexOf(B)!==-1||S.test(B))return W.quotingType===C0?'"'+B+'"':"'"+B+"'"}let L=W.indent*Math.max(1,I),F=W.lineWidth===-1?-1:Math.max(Math.min(W.lineWidth,40),W.lineWidth-L),N=j||W.flowLevel>-1&&I>=W.flowLevel;function w(A){return K4(W,A)}switch(B4(B,N,W.indent,F,w,W.quotingType,W.forceQuotes&&!j,O)){case q4:return B;case l0:return"'"+B.replace(/'/g,"''")+"'";case D4:return"|"+M4(B,W.indent)+U4(d0(B,L));case V4:return">"+M4(B,W.indent)+U4(d0(i4(B,F),L));case q0:return'"'+n4(B)+'"';default:throw new Z("impossible error: invalid scalar style")}}()}function M4(W,B){let I=H4(W)?String(B):"",j=W[W.length-1]===`
|
|
46
|
+
`,L=j&&(W[W.length-2]===`
|
|
47
|
+
`||W===`
|
|
48
|
+
`)?"+":j?"":"-";return I+L+`
|
|
49
|
+
`}function U4(W){return W[W.length-1]===`
|
|
50
|
+
`?W.slice(0,-1):W}function i4(W,B){let I=/(\n+)([^\n]*)/g,j=function(){let N=W.indexOf(`
|
|
51
|
+
`);return N=N!==-1?N:W.length,I.lastIndex=N,D0(W.slice(0,N),B)}(),O=W[0]===`
|
|
52
|
+
`||W[0]===" ",L,F;while(F=I.exec(W)){let N=F[1],w=F[2];L=w[0]===" ",j+=N+(!O&&!L&&w!==""?`
|
|
53
|
+
`:"")+D0(w,B),O=L}return j}function D0(W,B){if(W===""||W[0]===" ")return W;let I=/ [^ ]/g,j,O=0,L,F=0,N=0,w="";while(j=I.exec(W)){if(N=j.index,N-O>B)L=F>O?F:N,w+=`
|
|
54
|
+
`+W.slice(O,L),O=L+1;F=N}if(w+=`
|
|
55
|
+
`,W.length-O>B&&F>O)w+=W.slice(O,F)+`
|
|
56
|
+
`+W.slice(F+1);else w+=W.slice(O);return w.slice(1)}function n4(W){let B="",I=0;for(let j=0;j<W.length;I>=65536?j+=2:j++){I=H0(W,j);let O=n[I];if(!O&&U0(I)){if(B+=W[j],I>=65536)B+=W[j+1]}else B+=O||W0(I)}return B}function R4(W,B,I){let j="",O=W.tag;for(let L=0,F=I.length;L<F;L+=1){let N=I[L];if(W.replacer)N=W.replacer.call(I,String(L),N);if(R(W,B,N,!1,!1)||typeof N>"u"&&R(W,B,null,!1,!1)){if(j!=="")j+=","+(!W.condenseFlow?" ":"");j+=W.dump}}W.tag=O,W.dump="["+j+"]"}function j4(W,B,I,j){let O="",L=W.tag;for(let F=0,N=I.length;F<N;F+=1){let w=I[F];if(W.replacer)w=W.replacer.call(I,String(F),w);if(R(W,B+1,w,!0,!0,!1,!0)||typeof w>"u"&&R(W,B+1,null,!0,!0,!1,!0)){if(!j||O!=="")O+=k0(W,B);if(W.dump&&K===W.dump.charCodeAt(0))O+="-";else O+="- ";O+=W.dump}}W.tag=L,W.dump=O||"[]"}function o4(W,B,I){let j="",O=W.tag,L=Object.keys(I);for(let F=0,N=L.length;F<N;F+=1){let w="";if(j!=="")w+=", ";if(W.condenseFlow)w+='"';let A=L[F],k=I[A];if(W.replacer)k=W.replacer.call(I,A,k);if(!R(W,B,A,!1,!1))continue;if(W.dump.length>1024)w+="? ";if(w+=W.dump+(W.condenseFlow?'"':"")+":"+(W.condenseFlow?"":" "),!R(W,B,k,!1,!1))continue;w+=W.dump,j+=w}W.tag=O,W.dump="{"+j+"}"}function J(W,B,I,j){let O="",L=W.tag,F=Object.keys(I);if(W.sortKeys===!0)F.sort();else if(typeof W.sortKeys==="function")F.sort(W.sortKeys);else if(W.sortKeys)throw new Z("sortKeys must be a boolean or a function");for(let N=0,w=F.length;N<w;N+=1){let A="";if(!j||O!=="")A+=k0(W,B);let k=F[N],m=I[k];if(W.replacer)m=W.replacer.call(I,k,m);if(!R(W,B+1,k,!0,!0,!0))continue;let c=W.tag!==null&&W.tag!=="?"||W.dump&&W.dump.length>1024;if(c)if(W.dump&&K===W.dump.charCodeAt(0))A+="?";else A+="? ";if(A+=W.dump,c)A+=k0(W,B);if(!R(W,B+1,m,!0,c))continue;if(W.dump&&K===W.dump.charCodeAt(0))A+=":";else A+=": ";A+=W.dump,O+=A}W.tag=L,W.dump=O||"{}"}function V(W,B,I){let j=I?W.explicitTypes:W.implicitTypes;for(let O=0,L=j.length;O<L;O+=1){let F=j[O];if((F.instanceOf||F.predicate)&&(!F.instanceOf||typeof B==="object"&&B instanceof F.instanceOf)&&(!F.predicate||F.predicate(B))){if(I)if(F.multi&&F.representName)W.tag=F.representName(B);else W.tag=F.tag;else W.tag="?";if(F.represent){let N=W.styleMap[F.tag]||F.defaultStyle,w;if(Q.call(F.represent)==="[object Function]")w=F.represent(B,N);else if(G.call(F.represent,N))w=F.represent[N](B,N);else throw new Z("!<"+F.tag+'> tag resolver accepts not "'+N+'" style');W.dump=w}return!0}}return!1}function R(W,B,I,j,O,L,F){if(W.tag=null,W.dump=I,!V(W,I,!1))V(W,I,!0);let N=Q.call(W.dump),w=j;if(j)j=W.flowLevel<0||W.flowLevel>B;let A=N==="[object Object]"||N==="[object Array]",k,m;if(A)k=W.duplicates.indexOf(I),m=k!==-1;if(W.tag!==null&&W.tag!=="?"||m||W.indent!==2&&B>0)O=!1;if(m&&W.usedDuplicates[k])W.dump="*ref_"+k;else{if(A&&m&&!W.usedDuplicates[k])W.usedDuplicates[k]=!0;if(N==="[object Object]"){if(j&&Object.keys(W.dump).length!==0){if(J(W,B,W.dump,O),m)W.dump="&ref_"+k+W.dump}else if(o4(W,B,W.dump),m)W.dump="&ref_"+k+" "+W.dump}else if(N==="[object Array]"){if(j&&W.dump.length!==0){if(W.noArrayIndent&&!F&&B>0)j4(W,B-1,W.dump,O);else j4(W,B,W.dump,O);if(m)W.dump="&ref_"+k+W.dump}else if(R4(W,B,W.dump),m)W.dump="&ref_"+k+" "+W.dump}else if(N==="[object String]"){if(W.tag!=="?")l4(W,W.dump,B,L,w)}else if(N==="[object Undefined]")return!1;else{if(W.skipInvalid)return!1;throw new Z("unacceptable kind of an object to dump "+N)}if(W.tag!==null&&W.tag!=="?"){let c=encodeURI(W.tag[0]==="!"?W.tag.slice(1):W.tag).replace(/!/g,"%21");if(W.tag[0]==="!")c="!"+c;else if(c.slice(0,18)==="tag:yaml.org,2002:")c="!!"+c.slice(18);else c="!<"+c+">";W.dump=c+" "+W.dump}}return!0}function _(W,B){let I=[],j=[];U(W,I,j);let O=j.length;for(let L=0;L<O;L+=1)B.duplicates.push(I[j[L]]);B.usedDuplicates=Array(O)}function U(W,B,I){if(W!==null&&typeof W==="object"){let j=B.indexOf(W);if(j!==-1){if(I.indexOf(j)===-1)I.push(j)}else if(B.push(W),Array.isArray(W))for(let O=0,L=W.length;O<L;O+=1)U(W[O],B,I);else{let O=Object.keys(W);for(let L=0,F=O.length;L<F;L+=1)U(W[O[L]],B,I)}}}function P(W,B){B=B||{};let I=new d4(B);if(!I.noRefs)_(W,I);let j=W;if(I.replacer)j=I.replacer.call({"":j},"",j);if(R(I,0,j,!0,!0))return I.dump+`
|
|
57
|
+
`;return""}return T9.dump=P,T9}var B$;function q2(){if(B$)return a;B$=1;let $=K2(),Z=H2();function X(Q,G){return function(){throw Error("Function yaml."+Q+" is removed in js-yaml 4. Use yaml."+G+" instead, which is now safe by default.")}}return a.Type=Z0(),a.Schema=M$(),a.FAILSAFE_SCHEMA=O$(),a.JSON_SCHEMA=P$(),a.CORE_SCHEMA=C$(),a.DEFAULT_SCHEMA=S9(),a.load=$.load,a.loadAll=$.loadAll,a.dump=Z.dump,a.YAMLException=t0(),a.types={binary:T$(),float:L$(),map:j$(),null:_$(),pairs:A$(),set:E$(),timestamp:w$(),bool:F$(),int:I$(),merge:N$(),omap:S$(),seq:R$(),str:U$()},a.safeLoad=X("safeLoad","load"),a.safeLoadAll=X("safeLoadAll","loadAll"),a.safeDump=X("safeDump","dump"),a}var D2=q2(),V2=Y2(D2),{Type:d7,Schema:l7,FAILSAFE_SCHEMA:i7,JSON_SCHEMA:n7,CORE_SCHEMA:o7,DEFAULT_SCHEMA:r7,load:s7,loadAll:a7,dump:x$,YAMLException:t7,types:e7,safeLoad:$X,safeLoadAll:ZX,safeDump:XX}=V2;var v$=f("logFilePath");function k$($){v$.set($)}function A9(){return v$.get("")}var y$=3;class T0{__brand="SimpleLogger";level;logFilePath;fileLoggingEnabled;pendingWrites=Promise.resolve();pendingInit=Promise.resolve();constructor(){this.level=T0.resolveLevel(),this.logFilePath="",this.fileLoggingEnabled=!1}static getInstance(){return b$.getOrInit(()=>new T0,($)=>("__brand"in $)&&$.__brand==="SimpleLogger")}static resetInstance(){b$.clear()}static isNode=typeof process<"u"&&!!process.versions?.node;static resolveLevel(){if(T0.isNode){let X=T0.parseLevel(process.env?.UIP_LOG_LEVEL??"");if(X!==void 0)return X;let Q=process.env?.DEBUG;if(Q==="true"||Q==="1")return 0;return y$}let[$,Z]=o(()=>typeof localStorage<"u"&&!!localStorage.getItem("debug"));if(!$&&Z)return 0;return y$}static parseLevel($){switch($.toLowerCase()){case"debug":return 0;case"info":return 1;case"warn":return 2;case"error":return 3;default:return}}format($,Z){if(Z.length===0)return`${$}
|
|
58
|
+
`;return`${$} ${Z.map(String).join(" ")}
|
|
59
|
+
`}isFileLoggingActive(){return this.fileLoggingEnabled||!!A9()}writeToFile($){let Z=this.logFilePath||A9();if(!Z)return;let X=new Date().toISOString();this.pendingWrites=Promise.all([this.pendingWrites,this.pendingInit]).then(()=>d().appendFile(Z,`${X} ${$}`).catch(()=>{}))}debug($,...Z){if(this.level>0)return;let X=this.format(`[DEBUG] ${$}`,Z);if(this.isFileLoggingActive())this.writeToFile(X);else $0().writeErr(X)}info($,...Z){if(this.level>1)return;let X=this.format($,Z);if(this.isFileLoggingActive())this.writeToFile(X);else $0().writeErr(X)}warn($,...Z){if(this.level>2)return;let X=this.format(`[WARN] ${$}`,Z);if(this.isFileLoggingActive())this.writeToFile(X);else $0().writeErr(X)}error($,...Z){if(this.level>3)return;let X=this.format(`[ERROR] ${$}`,Z);if(this.isFileLoggingActive())this.writeToFile(X);else $0().writeErr(X)}getLevel(){return this.level}setLevel($){this.level=$}setFileLogging($){if(this.fileLoggingEnabled=$,!$)this.logFilePath="",k$("")}setLogFile($){if(this.logFilePath=$,k$($),!$)return;this.fileLoggingEnabled=!0;let Z=d();this.pendingInit=(async()=>{let[X]=await o((async()=>{await Z.mkdir(Z.path.dirname($)),await Z.writeFile($,"")})());if(X)this.fileLoggingEnabled=!1})()}async flushFile(){await this.pendingInit,await this.pendingWrites}getLogFilePath(){return this.logFilePath||A9()}handleLog=($)=>{let Z=[];if($.source)Z.push(`[${$.source}]`);if($.sourceTarget)Z.push(`[${$.sourceTarget}]`);Z.push($.message);let X=Z.join(" ");switch($.logLevel){case"Debug":this.debug(X);break;case"Information":this.info(X);break;case"Warning":this.warn(X);break;case"Error":this.error(X);break;default:this.info(X);break}}}var b$=f(T0),r=T0.getInstance();function C4(){return r.getLogFilePath()}var M2=f("OutputFormat"),HX=f("OutputFormatExplicit"),qX=f("HelpRequested"),U2=f("OutputFilter");function e0(){return M2.get("json")}function E9(){return U2.get()}var w4=f("CommandTelemetryFailure"),R2=new Set(["authentication_required","permission_denied"]),j2=new Set(["invalid_argument"]),O2=new Set(["network_error","rate_limited","server_error","not_found","method_not_allowed"]),_2=new Set(["timeout"]),F2=new Set(["ECONNREFUSED","ECONNRESET","ENOTFOUND","EAI_AGAIN","EPIPE","EHOSTUNREACH","ENETUNREACH","EAI_FAIL"]),I2=new Set(["ETIMEDOUT","ESOCKETTIMEDOUT"]),L2=new Set(["SELF_SIGNED_CERT_IN_CHAIN","DEPTH_ZERO_SELF_SIGNED_CERT","UNABLE_TO_VERIFY_LEAF_SIGNATURE","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_GET_ISSUER_CERT","CERT_HAS_EXPIRED","CERT_UNTRUSTED","ERR_TLS_CERT_ALTNAME_INVALID"]),P2=new Set(["MODULE_NOT_FOUND","ERR_MODULE_NOT_FOUND"]),C2=new Set(["TypeError","ReferenceError","SyntaxError","RangeError"]);function x9($){return $!==null&&typeof $==="object"}function $4($,Z){if(!x9($))return;let X=$[Z];return typeof X==="string"?X:void 0}function w2($,Z){if(!x9($))return;let X=$[Z];return typeof X==="number"?X:void 0}function N4($,Z){let X=$;for(let Q=0;Q<5&&X!==null&&typeof X==="object";Q++){let G=$4(X,Z);if(G)return G;X=X.cause}return}function f$($){return N4($,"code")}function N2($){if(f$($)!=="ENOENT")return!1;return N4($,"syscall")?.startsWith("spawn")===!0}function T2($,Z,X){if(Z===130)return!0;if(!x9($))return!1;if(w2($,"exitCode")===130)return!0;let Q=$4($,"name");if(Q==="ExitPromptError")return!0;if(Q==="AbortError"&&X?.aborted)return!0;return $4($,"message")?.includes("SIGINT")===!0}function S2($,Z){if($.recordedFailure?.terminalSignal)return $.recordedFailure.terminalSignal;let X=N4($.error,"terminalSignal")??N4($.error,"signal");if(X)return X;return Z==="cancelled"?"SIGINT":void 0}function A2($){if($===401||$===403)return"auth";if($===400||$===409||$===422)return"validation";if($===408)return"timeout";return"network_http"}function E2($){switch($){case"AuthenticationError":return"auth";case"ValidationError":return"validation";case"TimeoutError":return"timeout";default:return}}function x2($){if(!$)return;if(R2.has($))return"auth";if(j2.has($))return"validation";if(_2.has($))return"timeout";if(O2.has($))return"network_http";return}function k2($){let Z=f$($);if(Z){if(Z.startsWith("commander."))return"validation";if(F2.has(Z)||L2.has(Z))return"network_http";if(I2.has(Z))return"timeout";if(P2.has(Z)||N2($))return"missing_dependency"}if($4($,"message")?.includes("fetch failed")===!0)return"network_http";let Q=$4($,"name");if(Q&&C2.has(Q))return"internal";return}function y2($){let Z=$.recordedFailure;if(Z?.errorClass)return Z.errorClass;let X=Z?.context?.httpStatus;if(X!==void 0)return A2(X);return E2(Z?.result)??x2(Z?.errorCode)??k2($.error)??"unknown"}function h$($){w4.set($)}function m$(){w4.clear()}function g$(){let $=w4.get();return w4.clear(),$}function u$($){let Z=T2($.error,$.exitCode,$.pollSignal),X=$.recordedFailure?.terminalOutcome??($.exitCode===0?"success":Z?"cancelled":"failure"),Q=X==="success"||X==="no_op"?void 0:X==="cancelled"?"user_cancelled":y2($),G=S2($,X);return{exit_code:$.exitCode,terminal_outcome:X,...Q?{error_class:Q}:{},...G?{terminal_signal:G}:{}}}var k9={Error:"uip.error",ShipSucceeded:"ship_succeeded"};import{execFileSync as b2}from"node:child_process";function p$($,Z){if(process.platform!=="win32")return"";let[X,Q]=o(()=>b2("reg",["query",$,"/v",Z],{encoding:"utf-8",stdio:["pipe","pipe","pipe"]}));if(X)return"";return Q.match(new RegExp(`${Z}\\s+REG_SZ\\s+(.+)`))?.[1]?.trim()??""}class y9{analyticsUniqueId;constructor(){this.analyticsUniqueId=p$("HKCU\\Software\\UiPath","AnalyticsUniqueId")}enrich($){return{...$,...this.analyticsUniqueId?{analyticsUniqueId:this.analyticsUniqueId}:{}}}async trackEvent($,Z){r.debug(T4("Event",$,this.enrich(Z)))}async trackException($,Z){r.error(T4("Exception",$.message,this.enrich({...Z,stack:$.stack})))}async trackRequest($,Z,X,Q){r.debug(T4("Request",$,this.enrich({...Q,duration:`${Z}ms`,success:X})))}async trackDependency($,Z,X,Q,G){r.debug(T4("Dependency",$,this.enrich({...G,type:Z,duration:`${X}ms`,success:Q})))}}function T4($,Z,X){let Q=`[Telemetry] [${$}] ${Z}`;if(X&&Object.keys(X).length>0){let G=Object.entries(X).filter(([z,Y])=>Y!==void 0).map(([z,Y])=>`${z}=${Y}`).join(", ");if(G)Q+=` | ${G}`}return Q}var v2=[{envVar:"CLAUDECODE",value:"1",id:"claude-code"},{envVar:"CURSOR_AGENT",value:"1",id:"cursor"},{envVar:"GEMINI_CLI",value:"1",id:"gemini-cli"},{envVar:"CODEX_THREAD_ID",id:"codex"},{envVar:"CODEX_SANDBOX",id:"codex"},{envVar:"AUGMENT_AGENT",value:"1",id:"augment"},{envVar:"CLINE_ACTIVE",value:"true",id:"cline"}];function c$($){for(let X of v2){let Q=$[X.envVar];if(X.value!==void 0){if(Q===X.value)return X.id}else if(Q)return X.id}let Z=$.AGENT;if(Z){if(Z==="1"||Z==="true")return"unknown";if(Z.length<=32)return Z.toLowerCase()}return}var f2=f("TelemetryExecutionContextAuthSignal"),z0=($)=>$!==void 0&&$!==""&&$!=="0"&&$.toLowerCase()!=="false",h2=($,Z)=>$?.toLowerCase()===Z,m2=[{provider:"github_actions",matches:($)=>z0($.GITHUB_ACTIONS),isScheduler:($)=>$.GITHUB_EVENT_NAME==="schedule"},{provider:"azure_devops",matches:($)=>z0($.TF_BUILD),isScheduler:($)=>h2($.BUILD_REASON,"schedule")},{provider:"gitlab",matches:($)=>z0($.GITLAB_CI),isScheduler:($)=>$.CI_PIPELINE_SOURCE==="schedule"},{provider:"circleci",matches:($)=>z0($.CIRCLECI),isScheduler:($)=>$.CIRCLE_PIPELINE_TRIGGER_SOURCE==="scheduled_pipeline"},{provider:"jenkins",matches:($)=>z0($.JENKINS_URL)||z0($.JENKINS_HOME)},{provider:"teamcity",matches:($)=>z0($.TEAMCITY_VERSION)},{provider:"buildkite",matches:($)=>z0($.BUILDKITE),isScheduler:($)=>$.BUILDKITE_SOURCE==="schedule"},{provider:"bitbucket",matches:($)=>z0($.BITBUCKET_BUILD_NUMBER)},{provider:"travis",matches:($)=>z0($.TRAVIS)},{provider:"appveyor",matches:($)=>z0($.APPVEYOR)},{provider:"generic",matches:($)=>z0($.CI)}];function g2(){return typeof process>"u"?{}:process.env}function u2(){if(typeof process>"u")return!1;return Boolean(process.stdout?.isTTY||process.stdin?.isTTY||process.stderr?.isTTY)}function p2($){let Z=m2.find((X)=>X.matches($));if(!Z)return;return{executionContext:Z.isScheduler?.($)?"scheduler":"ci",ciProvider:Z.provider}}function d$($={}){let Z=$.env??g2(),X=p2(Z);if(X)return X;if($.agent??c$(Z))return{executionContext:"agent"};if(($.authSignal??f2.get())==="service_account")return{executionContext:"service_account"};if($.isTty??u2())return{executionContext:"manual"};return{executionContext:"unknown"}}function b9(){let $=d$();return{execution_context:$.executionContext,...$.ciProvider?{ci_provider:$.ciProvider}:{}}}import{AsyncLocalStorage as c2}from"node:async_hooks";class S4{storage=new c2;run($,Z){return this.storage.run($,Z)}getContext(){return this.storage.getStore()}}var d2=/^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;function l2(){return globalThis.process?.env}function l$($){if(!$)return;let Z=d2.exec($.trim().toLowerCase());if(!Z)return;let[,X,Q]=Z;if(/^0+$/.test(X)||/^0+$/.test(Q))return;return{traceId:X,parentSpanId:Q}}function Z4(){return l$(l2()?.TRACEPARENT)}var n$="UIPATH_SESSION_ID",O0="session_id",yX=f("TelemetrySessionId"),i$=f("TelemetryOperationId");function i2(){return globalThis.process?.env}function o$($){if(typeof $!=="string"&&typeof $!=="number"&&typeof $!=="boolean")return;return String($).trim()||void 0}function r$(){return o$(i2()?.[n$])}function v9($){return r$()??o$($)}function X4(){let $=i$.get();if($)return $;let X=Z4()?.traceId??crypto.randomUUID().replaceAll("-","");return i$.set(X),X}var n2=f("TelemetryDefaultProps");function J4(){return n2.get()}var o2=new Set(["token","tokens","secret","secrets","password","passwords","pwd","credential","credentials","auth","authentication","authorization","authority","cert","certificate","certificates"]),r2=new Set(["api","access","client","private","public","signing","encryption","session","master","shared","root","ssh","rsa","aes","hmac","oauth"]),s2=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,a2=/\b[^\s@]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,t2=/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,e2=/\b[A-Za-z0-9_-]{40,}\b/g,$Z=/([/\\])(Users|home)([/\\])([^/\\]+)/gi,ZZ=/\bhttps?:\/\/[^\s,;]+/gi,XZ=/[.,;:!?)\]}>'"]+$/;function f9($){let Z=2166136261;for(let X=0;X<$.length;X++)Z^=$.charCodeAt(X),Z=Math.imul(Z,16777619);return(Z>>>0).toString(16).padStart(8,"0")}function JZ($){try{let Z=new URL($);return`${Z.protocol}//${Z.host}`}catch{return`url#${f9($)}`}}function A4($){let Z=$;if(Z=Z.replace(t2,()=>"[REDACTED]"),Z=Z.replace(ZZ,(X)=>{let Q=X.match(XZ)?.[0]??"",G=Q?X.slice(0,-Q.length):X;return`${JZ(G)}${Q}`}),Z=Z.replace($Z,(X,Q,G,z)=>`${Q}${G}${z}<user>`),Z=Z.replace(a2,(X)=>`email#${f9(X)}`),Z=Z.replace(s2,(X)=>`uuid#${f9(X)}`),Z=Z.replace(e2,()=>"[REDACTED]"),Z.length>200)Z=`${Z.slice(0,200)}…`;return Z}function h9($){return A4($)}function m9($){let Z=Error(A4($.message??""));return Z.name=$.name,Z.stack=typeof $.stack==="string"?A4($.stack):void 0,Z}function QZ($){return $.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[\s._-]+/).map((Z)=>Z.toLowerCase()).filter(Boolean)}function GZ($){let Z=QZ($);for(let X=0;X<Z.length;X++){let Q=Z[X];if(o2.has(Q))return!0;if(Q==="key"||Q==="keys"){let G=Z[X-1];if(G&&r2.has(G))return!0}}return!1}function s$($,Z){if(Z===void 0||Z===null)return;if(GZ($))return"[REDACTED]";if(typeof Z==="boolean"||typeof Z==="number")return Z;if(typeof Z!=="string")return"[OBJECT]";return A4(Z)}function v0($){let Z={};for(let[X,Q]of Object.entries($)){let G=s$(X,Q);if(G!==void 0)Z[X]=G}return Z}var g9="uip.trace.operation_id",u9="uip.trace.parent_id",p9="uip.trace.span_id";class E4{telemetryProvider;contextStorage;operationId;defaultProperties;constructor($,Z){this.telemetryProvider=$;this.contextStorage=Z}setOperationId($){this.operationId=$}setProvider($){this.telemetryProvider=$}setDefaultProperties($){this.defaultProperties=$===void 0?void 0:{...this.defaultProperties,...$}}trackEvent($,Z){let X=this.getCurrentContext(),Q=this.enrichPropertiesWithContext(Z,X);this.telemetryProvider.trackEvent($,Q)}trackException($,Z){let X=this.getCurrentContext(),Q=this.enrichPropertiesWithContext(Z,X);this.telemetryProvider.trackException(m9($),Q)}async trackRequest($,Z,X){let Q=this.getCurrentContext(),G=Q?.operationId??this.operationId??X4(),z=Q?Q.id:this.inboundParentIdFor(G),Y={operationId:G,...z!==void 0?{parentId:z}:{},id:this.generateId()},K=performance.now();try{let D=await this.contextStorage.run(Y,Z),H=performance.now()-K,q=this.enrichPropertiesWithContext(X,Y);return await this.telemetryProvider.trackRequest($,H,!0,q),D}catch(D){let H=performance.now()-K,q=D instanceof Error?D:Error(String(D)),M=this.enrichPropertiesWithContext({...X,errorMessage:q.message},Y);throw await this.telemetryProvider.trackRequest($,H,!1,M),D}}trackRequestResult($,Z,X,Q,G){let z=G??{operationId:this.operationId??X4(),id:this.generateId()},Y=this.enrichPropertiesWithContext(Q,z);this.telemetryProvider.trackRequest($,Z,X,Y)}createRequestContext(){let $=this.operationId??X4(),Z=this.inboundParentIdFor($);return{operationId:$,...Z!==void 0?{parentId:Z}:{},id:this.generateId()}}inboundParentIdFor($){let Z=Z4();return Z&&Z.traceId===$?Z.parentSpanId:void 0}runWithContext($,Z){return this.contextStorage.run($,Z)}createDependencyContext(){let $=this.getCurrentContext();if(!$)return;return{operationId:$.operationId,parentId:$.id,id:this.generateId()}}trackDependencyResult($,Z,X,Q,G,z,Y){let K=this.enrichPropertiesWithContext(G,z);this.telemetryProvider.trackDependency(h9($),Z,X,Q,K,Y)}async trackDependencyOperation($,Z,X,Q){let G=this.getCurrentContext();if(!G)throw Error("trackDependencyOperation must be called within a trackRequest block.");let z={operationId:G.operationId,parentId:G.id,id:this.generateId()},Y=performance.now();try{let K=await this.contextStorage.run(z,X),D=performance.now()-Y,H=this.enrichPropertiesWithContext(Q,z);return await this.telemetryProvider.trackDependency($,Z,D,!0,H),K}catch(K){let D=performance.now()-Y,H=K instanceof Error?K:Error(String(K)),q=this.enrichPropertiesWithContext({...Q,errorMessage:H.message},z);throw await this.telemetryProvider.trackDependency($,Z,D,!1,q),K}}getCurrentContext(){return this.contextStorage.getContext()}enrichPropertiesWithContext($,Z){let X=J4(),Q=$?.[O0]??this.defaultProperties?.[O0]??X?.[O0],G=v9(Q),z={...b9(),...X,...this.defaultProperties,...v0($??{}),...Z?{[g9]:Z.operationId,...Z.parentId!==void 0?{[u9]:Z.parentId}:{},[p9]:Z.id}:{}};if(G===void 0)delete z[O0];else z[O0]=G;return z}generateId(){let $=new Uint8Array(8),Z="";do{crypto.getRandomValues($),Z="";for(let X of $)Z+=X.toString(16).padStart(2,"0")}while(/^0+$/.test(Z));return Z}}var OJ=f("TelemetryProvider");var YZ=f("TelemetryService"),EJ=atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");function WZ(){let $=YZ.get();if($&&typeof $==="object"&&"trackEvent"in $&&typeof $.trackEvent==="function")return $;return}var c9;function KZ(){let $=WZ();if($)return $;if(!c9)c9=new E4(new y9,new S4);return c9}var _0=new Proxy({},{get($,Z){let X=KZ(),Q=X[Z];return typeof Q==="function"?Q.bind(X):Q}});var Q8=["invalid_argument","authentication_required","permission_denied","not_found","rate_limited","network_error","timeout","server_error","method_not_allowed","configuration_error","unknown_error"],G8=["RetryWillNotFix","RetryLater","RetryAfter1Second","RetryAfter10Seconds","RetryAfter30Seconds","RetryAfter60Seconds"],t={Success:"Success",Failure:"Failure",ConfigError:"ConfigError",AuthenticationError:"AuthenticationError",ValidationError:"ValidationError",TimeoutError:"TimeoutError"},k4={Success:0,Failure:1,ConfigError:1,AuthenticationError:2,ValidationError:3,TimeoutError:4};class HZ{Result=t.Success;Code;Data;Pagination;Instructions;Log;constructor($,Z){this.Code=$,this.Data=Z;let X=C4();if(X)this.Log=X}}function z8($){return $.replace(/[\u0080-\uffff]/g,(Z)=>{return`\\u${Z.charCodeAt(0).toString(16).padStart(4,"0")}`})}function n9($){return process.platform==="win32"&&!$.capabilities.isInteractive}function y4($){if($===null||typeof $!=="object")return!1;let Z=Object.getPrototypeOf($);return Z===Object.prototype||Z===null}function e$($){if(Array.isArray($)||!y4($))return null;let Z=Object.values($);if(Z.length===0)return null;let X=null,Q=!1;for(let G of Z)if(Array.isArray(G)){if(X!==null)return null;X=G}else if(G!==null&&typeof G==="object")return null;else Q=!0;if(X===null||!Q)return null;return X}function qZ($){if(!$)return $;if(/[_\-\s]/.test($)){let[Z,...X]=$.split(/[_\-\s]+/).filter(Boolean);if(!Z)return $;return[d9(Z),...X.map((Q)=>{let G=d9(Q);return G.charAt(0).toUpperCase()+G.slice(1)})].join("")}return d9($)}function d9($){if(/^[A-Z0-9]+$/.test($))return $.toLowerCase();return $.replace(/^[A-Z]+(?=[A-Z][a-z]|\d|$)|^[A-Z]/,(Z)=>Z.toLowerCase())}function Y8($){let Z=qZ($);return Z?Z.charAt(0).toUpperCase()+Z.slice(1):Z}function Q4($){if(Array.isArray($))return $.map(Q4);if(!y4($))return $;let Z={};for(let[X,Q]of Object.entries($))Z[Y8(X)]=Q4(Q);return Z}function x4($){return Q4($)}function l9($){let Z={};for(let[X,Q]of Object.entries($)){let G=Y8(X);Z[G]=G==="Data"?Q:Q4(Q)}return Z}function W8($,Z="json",X,Q=!1){if(!$){X("Empty response object. No data to display.");return}switch(Z){case"json":{let G=JSON.stringify($,null,2);X(Q?z8(G):G);break}case"yaml":X(VZ($));break;case"plain":{if("Data"in $&&$.Data!=null)(e$($.Data)??(Array.isArray($.Data)?$.Data:[$.Data])).forEach((Y)=>{let K=Object.values(Y).map((D)=>D??"").join("\t");X(K)});else{let G=Object.values($).map((z)=>z??"").join("\t");X(G)}break}default:{let G="Data"in $&&$.Data!=null,z=G?e$($.Data):null,Y=z?z:Array.isArray($.Data)?$.Data:null;if(G&&!(Y!==null&&Y.length===0)){let K=$.Log;if(Y!==null)H8(Y,X,K);else K8($.Data,X,K)}else o9([{...$}],X);break}}}function $8($,Z="json"){let X=$0();W8($,Z,(Q)=>X.writeOut(`${Q}
|
|
60
|
+
`),n9(X))}function f0($){return $!=null&&typeof $==="object"?JSON.stringify($):String($??"")}function DZ($,Z){if($.length<=Z)return[$];let X=[];for(let Q=0;Q<$.length;Q+=Z)X.push($.substring(Q,Q+Z));return X}function o9($,Z,X){if($.length===0)return;let Q=Object.keys($[0]).filter((Y)=>!["code","log"].includes(Y.toLowerCase())),G=Q.map((Y)=>Math.max(Y.length,...$.map((K)=>f0(K[Y]).length))),z=Q.map((Y,K)=>Y.padEnd(G[K])).join(" | ");if(Z(z),Z(Q.map((Y,K)=>"-".repeat(G[K])).join("-|-")),$.forEach((Y)=>{let K=Q.map((D,H)=>f0(Y[D]).padEnd(G[H])).join(" | ");Z(K)}),X)Z(""),Z(`Log: ${X}`)}function Z8($){return Array.isArray($)&&$.length>0&&$.every(y4)}function X8($){return y4($)&&Object.keys($).length>0}var i9=" ";function K8($,Z=console.log,X){let Q=Object.keys($).filter((H)=>!["code","log"].includes(H.toLowerCase()));if(Q.length===0)return;let G=(H)=>Z8(H)||X8(H),z=Q.filter((H)=>!G($[H])),Y=z.length>0?Math.max(...z.map((H)=>H.length)):0,K=process.stdout.columns||120,D=Math.max(K-i9.length,1);if(Q.forEach((H)=>{let q=$[H];if(Z8(q)){Z(`${H}:`),H8(q,(C)=>Z(`${i9}${C}`),void 0,D);return}if(X8(q)){Z(`${H}:`),K8(q,(C)=>Z(`${i9}${C}`));return}let M=H.padEnd(Y);Z(`${M} | ${f0(q)}`)}),X)Z(""),Z(`Log: ${X}`)}function H8($,Z=console.log,X,Q){if($.length===0)return;let G=Object.keys($[0]).filter((x)=>!["code","log"].includes(x.toLowerCase()));if(G.length===0)return;if(!process.stdout.isTTY){o9($,Z,X);return}let z=G.map((x)=>Math.max(x.length,...$.map((b)=>f0(b[x]).length))),Y=(G.length-1)*3,K=z.reduce((x,b)=>x+b,0)+Y,D=Q??(process.stdout.columns||120);if(K<=D){o9($,Z,X);return}let H=K-D,q=10,M=G.map((x)=>Math.max(x.length,q)),C=-1,E=1/0;for(let x=0;x<G.length;x++){if(z[x]-M[x]<H)continue;let v=z[x]-H,T=0;for(let h of $){let p=f0(h[G[x]]).length;if(p>v)T+=Math.ceil(p/v)-1}if(T<E)E=T,C=x}let g=[...z];if(C!==-1)g[C]=z[C]-H;else{let x=H,b=G.map((v,T)=>({index:T,potential:z[T]-M[T]})).filter((v)=>v.potential>0).sort((v,T)=>T.potential-v.potential);for(let v of b){if(x<=0)break;let T=Math.min(x,v.potential);g[v.index]-=T,x-=T}}let y=G.map((x,b)=>x.padEnd(g[b])).join(" | ");if(Z(y),Z(G.map((x,b)=>"-".repeat(g[b])).join("-|-")),$.forEach((x)=>{let b=G.map((T,h)=>DZ(f0(x[T]),g[h])),v=Math.max(...b.map((T)=>T.length));for(let T=0;T<v;T++){let h=G.map((p,X0)=>{return(T<b[X0].length?b[X0][T]:"").padEnd(g[X0])}).join(" | ");Z(h)}}),X)Z(""),Z(`Log: ${X}`)}function VZ($){return x$($)}class q8 extends Error{__brand="FilterEvaluationError";filter;errorCode="invalid_argument";instructions;retry="RetryWillNotFix";result=t.ValidationError;constructor($,Z){let X=Z instanceof Error?Z.message:String(Z);super(`Filter '${$}' failed to evaluate: ${X}`);this.name="FilterEvaluationError",this.filter=$,this.instructions=`The --output-filter expression '${$}' failed at evaluation time. Note that --output-filter operates on the 'Data' field of the envelope, not the full object. For example, on a list result use 'length(@)' instead of 'Data | length(@)'.`}}function J8($,Z){let X;try{X=c6($,Z)}catch(Q){throw new q8(Z,Q)}if(X==null)return[];if(Array.isArray(X)){if(X.length>0&&typeof X[0]!=="object"){let Q=Z.match(/\.(\w+)$/),G=Q?Q[1]:"Value";return X.map((z)=>({[G]:z}))}return X}if(typeof X==="object")return X;return{Value:X}}function BZ($){switch($){case t.AuthenticationError:return"authentication_required";case t.ConfigError:return"configuration_error";case t.ValidationError:return"invalid_argument";case t.TimeoutError:return"timeout";default:return"unknown_error"}}function MZ($){let Z=/^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec($.trim());if(!Z)return;let X=Number(Z[1]);return Number.isInteger(X)&&X>=100&&X<=599?X:void 0}function UZ($){if($===void 0)return;if($===400||$===409||$===422)return"invalid_argument";if($===401)return"authentication_required";if($===403)return"permission_denied";if($===404)return"not_found";if($===405)return"method_not_allowed";if($===408)return"timeout";if($===429)return"rate_limited";if($>=500&&$<600)return"server_error";return}function RZ($){if($.Result===t.Failure){let Z=$.Context?.httpStatus??MZ($.Message),X=UZ(Z);if(X)return X}return BZ($.Result)}function jZ($){switch($){case"network_error":case"rate_limited":case"server_error":case"timeout":return"RetryLater";default:return"RetryWillNotFix"}}var h0;((pJ)=>{function $(z,Y){z.Log??=C4()||void 0;let K=!Y?.preserveDataKeys;if(K)z.Data=x4(z.Data);let D=E9();if(D){let H=J8(z.Data,D);z.Data=K?x4(H):H}$8(l9(z),e0())}pJ.success=$;function Z(z){z.Log??=C4()||void 0,z.ErrorCode??=RZ(z),z.Retry??=jZ(z.ErrorCode),process.exitCode=k4[z.Result]??1,h$({result:z.Result,errorCode:z.ErrorCode,retry:z.Retry,message:z.Message,context:z.Context,exitCode:process.exitCode,errorClass:z.TelemetryErrorClass,terminalOutcome:z.TelemetryTerminalOutcome,terminalSignal:z.TelemetryTerminalSignal});let Y=z.SuppressTelemetry===!0,K={...z};if(delete K.SuppressTelemetry,delete K.TelemetryErrorClass,delete K.TelemetryTerminalOutcome,delete K.TelemetryTerminalSignal,!Y)_0.trackEvent(k9.Error,{result:z.Result,errorCode:z.ErrorCode,retry:z.Retry,message:z.Message});$8(l9(K),e0())}pJ.error=Z;function X(z,Y,K){let D={Result:t.Success,Code:z,Data:Y};if(Y.length===0&&K?.emptyInstructions)D.Instructions=K.emptyInstructions;if(K?.warning)D.Warning=K.warning;if(K?.pagination)D.Pagination=K.pagination;$(D)}pJ.emitList=X;function Q(z){let Y=e0(),K=$0(),D=Q4(z);if(Y==="json"){let H=JSON.stringify(D),q=n9(K)?z8(H):H;K.writeErr(`${q}
|
|
61
|
+
`)}else for(let[H,q]of Object.entries(D))K.writeErr(`${H}: ${q}
|
|
62
|
+
`)}pJ.log=Q;function G(z){let Y=E9();if("Data"in z&&z.Data!=null){if(z.Data=x4(z.Data),Y)z.Data=x4(J8(z.Data,Y))}let K=l9(z),D=[],H=$0();return W8(K,e0(),(q)=>{D.push(q)},n9(H)),D.join(`
|
|
63
|
+
`)}pJ.formatToString=G})(h0||={});var OZ=/^[a-z0-9][a-z0-9-]*[a-z0-9]$/;function D8($,Z){return{product_area:$,mode:Z}}function _Z($){let Z={};for(let[X,Q,G]of $){let z=D8(X,Q);for(let Y of G)Z[Y]=z}return Z}function FZ($){let Z=[];for(let[X,Q,G]of $){let z=D8(X,Q);for(let Y of G)Z.push({prefix:Y,attribution:z})}return Z}var IZ=_Z([["admin","operate",["uipath-admin"]],["agents","build",["uipath-agents"]],["api-workflow","build",["uipath-api-workflow"]],["automation-discovery","build",["uipath-automation-discovery"]],["coded-apps","build",["uipath-coded-apps"]],["data-fabric","operate",["uipath-data-fabric"]],["cli","troubleshoot",["uipath-feedback"]],["governance","operate",["uipath-governance"]],["action-center","build",["uipath-human-in-the-loop"]],["document-understanding","build",["uipath-ixp"]],["maestro","build",["uipath-maestro-bpmn","uipath-maestro-case","uipath-maestro-flow"]],["agenthub","build",["uipath-mcp-servers"]],["solution","build",["uipath-planner","uipath-solution"]],["platform","operate",["uipath-platform"]],["quality","troubleshoot",["uipath-review"]],["rpa","build",["uipath-rpa"]],["cli","operate",["uipath-skill-catalog"]],["action-center","operate",["uipath-tasks"]],["test-manager","operate",["uipath-test"]],["platform","troubleshoot",["uipath-troubleshoot"]]]),LZ=new Set(Object.keys(IZ)),PZ=FZ([["cli","troubleshoot",["uip.feedback"]],["llm-gateway","operate",["uip.llm-gateway"]],["llm-gateway","operate",["uip.llm-configuration","uip.model-hub"]],["context-grounding","build",["uip.context-grounding"]],["api-workflow","build",["uip.api-workflow"]],["rpa","build",["uip.rpa-legacy"]],["conversational","operate",["uip.conversational"]],["agents","build",["uip.codedagent","uip.agent"]],["agenthub","build",["uip.agenthub"]],["coded-apps","build",["uip.codedapp"]],["functions","build",["uip.function","uip.functions"]],["solution","build",["uip.solution"]],["maestro","build",["uip.maestro","uip.case","uip.flow"]],["llm-observability","troubleshoot",["uip.traces"]],["platform","operate",["uip.platform"]],["admin","operate",["uip.admin"]],["automation-ops","operate",["uip.aops"]],["documentation","troubleshoot",["uip.docsai"]],["governance","operate",["uip.gov"]],["insights","operate",["uip.insights"]],["document-understanding","build",["uip.ixp"]],["process-mining","operate",["uip.pm"]],["action-center","operate",["uip.tasks"]],["test-manager","operate",["uip.tm"]],["vertical-solutions","build",["uip.vss"]],["data-fabric","operate",["uip.df"]],["integration-service","build",["uip.is"]],["orchestrator","operate",["uip.or"]],["cli","operate",["uip.login","uip.logout","uip.user","uip.config","uip.tools","uip.skills","uip.completion","uip.update","uip.mcp","uip.track"]]]).sort(($,Z)=>Z.prefix.length-$.prefix.length);function CZ($){if(typeof $!=="string")return;let Z=$.trim().toLowerCase();if(!Z)return;let X=Z.includes(" ")?Z.split(/\s+/).filter((G)=>G.length>0).filter((G)=>!G.startsWith("-")):Z.split(".").filter((G)=>G.length>0);if(X.length===0)return;return(X[0]==="uip"?X:["uip",...X]).join(".")}function wZ($){let Z=CZ($);if(!Z)return;return PZ.find(({prefix:X})=>Z===X||Z.startsWith(`${X}.`))?.attribution}function NZ($,Z){if(typeof $!=="string")return;let X=$.trim().toLowerCase();if(!X)return;let Q=X.startsWith("uipath:");if(Q&&!Z.allowLegacyNamespace)return;let G=Q?X.slice(7):X;if(G.length>80||!OZ.test(G)||!LZ.has(G))return;return G}function TZ($){return NZ($,{allowLegacyNamespace:!1})}function V8($,Z){let X=TZ(Z);return{...X?{skill_name:X}:{},...wZ($)}}var SZ=f("PollSignal"),AZ=new Set(Q8),EZ=new Set(G8),B8="uip.cmd.arg.",r9={exit:($)=>{process.exitCode=$},get pollSignal(){return SZ.get()}};function xZ($){let Z={},X=(z,Y)=>{if(z&&Y!==void 0)Z[`${B8}${z}`]=Y},Q=$.registeredArguments??[],G=$.processedArgs??[];for(let z=0;z<Q.length;z++)X(Q[z].name(),G[z]);for(let[z,Y]of Object.entries($.opts()))X(z,Y);return Z}function kZ($){let Z=[],X=$;while(X){let Q=X.name();if(Q)Z.unshift(Q);X=X.parent}if(Z.length>1)Z.shift();return["uip",...Z.filter((Q)=>Q!=="uip")].join(".")}function yZ($){return typeof $==="string"&&AZ.has($)}function bZ($){return typeof $==="string"&&EZ.has($)}function vZ($){return $!==null&&typeof $==="object"}function fZ($){return`An unexpected error occurred. Run '${$.replace(/\./g," ")} --help' to verify command syntax, or run with --log-level debug for details.`}function hZ($){return $ instanceof Error&&$.name==="ExitPromptError"}function mZ($){return typeof process.exitCode==="number"?process.exitCode:$}N0.prototype.trackedAction=function($,Z,X){let Q=this;return this.action(async(...G)=>{let z=kZ(Q),Y=typeof X==="function"?X(...G):X,K=_0.createRequestContext(),D=performance.now(),H,q=k4.Success;m$();let[M]=await o(_0.runWithContext(K,()=>Z(...G)));if(M){H=M instanceof Error?M.message:String(M),r.debug(`[trackedAction] ${z} failed: ${H}`);let T=M,h=typeof T.instructions==="string"?T.instructions:void 0,X0=(typeof T.result==="string"&&T.result!==t.Success&&Object.values(t).includes(T.result)?T.result:void 0)??t.Failure,Q0=T.errorCode??T.ErrorCode,G0=yZ(Q0)?Q0:void 0,e=T.retry??T.Retry,Y0=bZ(e)?e:void 0,M0=T.context??T.Context,P0=vZ(M0)?M0:void 0;q=(T.exitCode===130||hZ(M)?130:void 0)??k4[X0],h0.error({Result:X0,...G0?{ErrorCode:G0}:{},Message:H,Instructions:h??fZ(z),...Y0?{Retry:Y0}:{},...P0?{Context:P0}:{}}),$.exit(q)}let C=performance.now()-D,E=q===130?q:mZ(q),g=g$(),y=!M&&E===0,x=u$({error:M,exitCode:E,recordedFailure:g,pollSignal:$.pollSignal}),b=xZ(Q);if(Y)for(let T of Object.keys(Y))delete b[`${B8}${T}`];let v=v0({...b,...Y,...V8(z,process.env.UIPATH_SKILL),command:"true",...x,...H?{errorMessage:H}:{}});_0.trackRequestResult(z,C,y,v,K)})};var zQ=f("ConsoleGuardInstalled"),YQ=f("ConsoleGuardOriginals");var jQ=f("InteractivityMode"),OQ=f("InteractiveFlag");var S0={Completed:"completed",Timeout:"timeout",Interrupted:"interrupted",Aborted:"aborted",Failed:"failed"};var kQ={[S0.Timeout]:"poll_timeout",[S0.Failed]:"poll_failed",[S0.Interrupted]:"poll_failed",[S0.Aborted]:"poll_aborted"};var M8=f("PreviewBuild");function XG($){M8.set($)}function U8(){return M8.get(!1)??!1}function R8($){if(U8())$()}N0.prototype.previewCommand=function($,Z){if(U8())return this.command($,Z);return new N0($.split(/\s+/)[0]??$)};var lZ;((GG)=>{function $(Z){$0().writeErr(`${Z}
|
|
64
|
+
`)}GG.progress=$})(lZ||={});var HG=f("SdkUserAgentHostToken");var OG=f("ShipSucceededDedupeKeys");var NG=f("PackagerFactoryProvider");var j8={name:"@uipath/coder-tool",license:"MIT",version:"1.200.0",description:"Interactive coding agent (Pi) with UiPath LLM Gateway and BYO provider support.",type:"module",main:"./dist/tool.js",exports:{".":"./dist/tool.js"},bin:{"coder-tool":"./dist/index.js"},scripts:{build:"bun ../../tools/build-tool.ts",package:"bun run build && bun pm pack",test:"vitest run","test:coverage":"vitest run --coverage",lint:"biome check .","lint:fix":"biome check --write ."},dependencies:{"@earendil-works/pi-coding-agent":"^0.80.6"},devDependencies:{commander:"^14.0.3","@uipath/common":"workspace:*","@uipath/auth":"workspace:*","@uipath/filesystem":"workspace:*","@types/node":"^25.5.2",typescript:"^7.0.2"}};import{fileURLToPath as e5}from"node:url";var O8="36dea5b8-e8bb-423d-8e7b-c808df8f1c00",nZ=Symbol.for("@uipath/auth/AuthFileConfig"),oZ=globalThis;var rZ=()=>oZ[nZ]??{};class m0 extends Error{url;reason;constructor($,Z){super(`Invalid base URL: "${$}"
|
|
65
|
+
Reason: ${Z}
|
|
66
|
+
|
|
67
|
+
Expected format: an https:// URL, e.g. https://cloud.uipath.com (commercial), https://govcloud.uipath.us (Public Sector), or your Automation Suite host (https://<your-host>).
|
|
68
|
+
You can specify the URL via:
|
|
69
|
+
`+` • --authority flag
|
|
70
|
+
`+` • UIPATH_URL environment variable
|
|
71
|
+
`+" • auth.authority in config file");this.url=$;this.reason=Z;this.name="InvalidBaseUrlError"}}var sZ=["openid","profile","offline_access"],s9=($)=>{let Z=$;if(Z.endsWith("/identity_/"))Z=Z.slice(0,-11);else if(Z.endsWith("/identity_"))Z=Z.slice(0,-10);while(Z.endsWith("/"))Z=Z.slice(0,-1);let X=Z,[Q,G]=s(()=>new URL(X));if(Q)throw new m0(Z,`Malformed URL. ${Q instanceof Error?Q.message:"Unknown error"}`);if(G.protocol!=="https:")throw new m0(Z,`Authority must use https:// scheme, got ${G.protocol}//. OIDC token exchange requires TLS end-to-end.`);return G.pathname.length>1?G.origin:Z},aZ=($,Z,X)=>{let Q=Z?.length?Z:X??[];if($)return Q;return[...new Set([...sZ,...Q])]},g0=async({customAuthority:$,customClientId:Z,customClientSecret:X,customClientAssertion:Q,customScopes:G}={})=>{let z=rZ(),Y=$;if(!Y)Y=process.env.UIPATH_URL;if(!Y&&z.authority)Y=z.authority;if(!Y)Y=_8;Y=s9(Y);let K=Z;if(!K&&z.clientId)K=z.clientId;if(!K)K=O8;let D=X;if(!D&&z.clientSecret)D=z.clientSecret;let H=K!==O8&&(Boolean(D)||Boolean(Q)),q=aZ(H,G,z.scopes);return{clientId:K,clientSecret:D,scopes:q,baseUrl:Y,authorizationEndpoint:`${Y}/identity_/connect/authorize`,tokenEndpoint:`${Y}/identity_/connect/token`}};var I8="default",tZ="profiles",eZ=/^[A-Za-z0-9._-]+$/,$5=Symbol.for("@uipath/auth/ActiveAuthProfile"),F8=Symbol.for("@uipath/auth/ProfileStorage"),a9=globalThis;function Z5($){return $!==null&&typeof $==="object"&&"getStore"in $&&"run"in $}function X5(){let[$,Z]=s(()=>B0("node:async_hooks"));if($||typeof Z?.AsyncLocalStorage!=="function")return{getStore:()=>{return},run:(X,Q)=>Q()};return new Z.AsyncLocalStorage}function J5(){let $=a9[F8];if(Z5($))return $;let Z=X5();return a9[F8]=Z,Z}var Q5=J5();class t9 extends Error{constructor($){super($);this.name="AuthProfileValidationError"}}function G5($){if($===void 0||$===I8)return;if($.length===0||$==="."||$===".."||!eZ.test($))throw new t9(`Invalid profile name "${$}". Profile names may contain only letters, numbers, '.', '_', and '-'.`);return $}function e9(){let $=Q5.getStore();if($!==void 0)return $.profile;return a9[$5]?.profile}function z5($){let Z=G5($);if(Z===void 0)throw new t9(`"${I8}" is the built-in profile and does not have a profile file path.`);let X=d();return X.path.join(X.env.homedir(),b4,tZ,Z,v4)}function $6(){let $=e9();return $?z5($):void 0}class Z6 extends Error{expected;actual;constructor($,Z){let X=Z??"<missing>";super(`Token issuer does not match the authority used to log in.
|
|
72
|
+
Expected: ${$}
|
|
73
|
+
Actual: ${X}
|
|
74
|
+
|
|
75
|
+
The identity server that issued this token is not the one you pointed --authority at. Refusing to save credentials.`);this.expected=$;this.actual=Z;this.name="InvalidIssuerError"}}var A0=($)=>{try{let X=$.split(".")[1];if(!X)throw Error("Invalid JWT token format - missing payload section");let Q=X.replace(/-/g,"+").replace(/_/g,"/"),G;if(u0()&&typeof atob<"u")G=atob(Q);else G=Buffer.from(Q,"base64").toString();let z=decodeURIComponent(G.split("").map((K)=>`%${`00${K.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(z)}catch(Z){throw Error(`Failed to parse JWT: ${Z instanceof Error?Z.message:"Unknown error"}`)}},X6=($,Z)=>{let X;try{X=A0($)}catch(Y){throw new Z6(`${Z.replace(/\/+$/,"")}/identity_`,`<unparseable: ${Y instanceof Error?Y.message:"unknown error"}>`)}let Q=(Y)=>Y.replace(/\/+$/,""),G=`${Q(Z)}/identity_`;if((typeof X.iss==="string"?Q(X.iss):void 0)!==G)throw new Z6(G,X.iss)},F0=($)=>{try{let Z=$.split(".");if(Z.length!==3)return;let Q=Z[1].replace(/-/g,"+").replace(/_/g,"/"),G=Q+"=".repeat((4-Q.length%4)%4),z=atob(G),Y=JSON.parse(z);if(typeof Y.exp!=="number")return;return new Date(Y.exp*1000)}catch{return}};var z4="UIPATH_CLI_ENABLE_ENV_AUTH",p0="UIPATH_CLI_ENFORCE_ROBOT_AUTH",I0={token:"UIPATH_CLI_AUTH_TOKEN",organizationName:"UIPATH_CLI_ORGANIZATION_NAME",organizationId:"UIPATH_CLI_ORGANIZATION_ID",tenantName:"UIPATH_CLI_TENANT_NAME",tenantId:"UIPATH_CLI_TENANT_ID"};class L0 extends Error{constructor($){super($);this.name="EnvAuthConfigError"}}var f4=()=>process.env[z4]==="true",J6=()=>process.env[p0]==="true",G4=($)=>{let Z=process.env[$];if(!Z)throw new L0(`${z4}=true but ${$} is not set. Set ${$} to enable env-var authentication.`);return Z},Q6=()=>{let $=G4(I0.token),Z=G4(I0.organizationName),X=G4(I0.organizationId),Q=G4(I0.tenantName),G=G4(I0.tenantId),[z,Y]=s(()=>A0($));if(z)throw new L0(`${I0.token} is not a valid JWT: ${z instanceof Error?z.message:String(z)}`);let K=Y.iss;if(typeof K!=="string"||K.length===0)throw new L0(`${I0.token} has no 'iss' claim; cannot determine the UiPath server. Ensure the token was issued by a UiPath identity server.`);let[D,H]=s(()=>s9(K));if(D){if(D instanceof m0)throw D;throw new L0(`Failed to derive server URL from token 'iss' claim: ${D instanceof Error?D.message:String(D)}`)}let q=F0($);return{loginStatus:q&&q<=new Date?"Expired":"Logged in",accessToken:$,baseUrl:H,organizationName:Z,organizationId:X,tenantName:Q,tenantId:G,expiration:q,source:"env"}};var Y5=".refresh-state",W5=60000,K5=3600000,H5=3600000;async function h4($){let Z=new TextEncoder().encode($);if(globalThis.crypto?.subtle){let Q=await globalThis.crypto.subtle.digest("SHA-256",Z);return Array.from(new Uint8Array(Q),(G)=>G.toString(16).padStart(2,"0")).join("").slice(0,16)}let{createHash:X}=await import("node:crypto");return X("sha256").update($).digest("hex").slice(0,16)}function G6($){return`${$}${Y5}`}async function z6($){let Z=d();try{let X=await Z.readFile(G6($),"utf-8");if(!X)return{};let Q=JSON.parse(X);return Q&&typeof Q==="object"?Q:{}}catch{return{}}}async function Y6($,Z){try{let X=d(),Q=G6($);await X.mkdir(X.path.dirname(Q));let G=`${Q}.tmp`;await X.writeFile(G,JSON.stringify(Z)),await X.rename(G,Q)}catch{}}async function m4($){let Z=d(),X=G6($);try{if(await Z.exists(X))await Z.rm(X)}catch{}}function L8($){let Z=Math.max(0,$-1);return Math.min(W5*2**Z,K5)}function P8($,Z){if($.lastSurfacedAtMs===void 0)return!0;return Z-$.lastSurfacedAtMs>=H5}var q5=1000,D5=500,C8="UiPathUserServices",V5=`${C8}Alternate`,B5=103,M5=async()=>{let $=d(),Z=$.env.getenv("USER")??$.env.getenv("USERNAME");if(!Z)throw Error("Unable to determine current username");let X=$.env.getenv("TMPDIR")??"/tmp/";return[C8,V5].map((Q)=>$.path.join(X,`${Q}_${Z}`).substring(0,B5))},U5=async()=>{if(process.platform==="win32")return!0;let[$,Z]=await s(M5());if($||!Z)return!1;let X=d();for(let Q of Z){let[G,z]=await s(X.exists(Q));if(!G&&z===!0)return!0}return!1},g4=($,Z)=>new Promise((X,Q)=>{let G=setTimeout(()=>Q(Error(`Robot IPC call timed out after ${Z}ms`)),Z);$.then((z)=>{clearTimeout(G),X(z)},(z)=>{clearTimeout(G),Q(z)})}),R5=($)=>{let[Z,X]=s(()=>new URL($));if(Z||!X)return;let Q=X.pathname.split("/").filter(Boolean);return{baseUrl:X.origin,organizationName:Q[0],tenantName:Q[1]}},j5=Symbol.for("@uipath/auth/RobotClientLoader");var O5=()=>{let $=globalThis[j5];return typeof $==="function"?$:void 0},_5=async()=>{let $=O5();if(!$)return;let[Z,X]=await s(()=>$());if(Z||!X)return;return X},w8=async($={})=>{if(u0())return;if(!$.force){if(process.env.CI||process.env.GITHUB_ACTIONS)return;if(process.env.UIPATH_URL)return}let Z=$.timeoutMs??q5,X=$.isRobotIpcAvailable??U5,Q=$.loadModule??_5;if(!await X())return;let G=await Q();if(!G)return;let[z,Y]=s(()=>new G.RobotProxyConstructor);if(z||!Y)return;try{if(!await g4(Y.interactiveConnectFlow.IsEnabled(),Z))return;let[D,H]=await Promise.all([g4(Y.accessProvider.GetResourceUrl("Orchestrator"),Z),g4(Y.accessProvider.GetAccessToken("Orchestrator",!1),Z)]);if(!H)return;let q=R5(D);if(!q)return;let M,C,E,[g,y]=s(()=>A0(H));if(!g&&y){let x=y.prtId??y.organizationId??y.prt_id;if(typeof x==="string"&&x.length>0)M=x;let b=y.tenantId??y.tenant_id;if(typeof b==="string"&&b.length>0)C=b;let v=y.iss;if(typeof v==="string"&&v.length>0)E=v}return{accessToken:H,baseUrl:q.baseUrl,organizationName:q.organizationName,organizationId:M??q.organizationName,tenantName:q.tenantName,tenantId:C,issuer:E}}catch{return}finally{await s(()=>g4(Y.CloseAsync(),D5))}};var F5="Token refresh failed. Run 'uip login' to re-authenticate.";class W6 extends Error{__brand="TokenRefreshOAuthError";constructor(){super(F5);this.name="TokenRefreshOAuthError"}}function N8($){return $ instanceof W6}var T8=async({refreshToken:$,tokenEndpoint:Z,clientId:X,expectedAuthority:Q})=>{let G=new URLSearchParams({grant_type:"refresh_token",refresh_token:$,client_id:X}),z=await fetch(Z,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:G}),Y=await z.json();if(!z.ok)throw new W6;let{access_token:K,refresh_token:D}=Y;if(typeof K!=="string"||typeof D!=="string")throw Error("Token refresh response is missing access_token or refresh_token");if(Q)X6(K,Q);return{accessToken:K,refreshToken:D}};var c0=`${b4}/${v4}`,I5=new Set(["EISDIR","EACCES","EPERM","ELOOP","ENOTDIR","EUNKNOWN"]),L5=($)=>{if($!==null&&typeof $==="object"&&"code"in $&&typeof $.code==="string"){let Z=$.code;return I5.has(Z)?Z:"EUNKNOWN"}return"EUNKNOWN"},K6=async($,Z)=>{try{let X=await $.stat(Z);if(X===null)return{exists:!1};if(!X.isFile())return{exists:!1,unusable:{reason:"not-a-file",code:"EISDIR",message:`Path is not a regular file: ${Z}`}};return{exists:!0}}catch(X){return{exists:!1,unusable:{reason:"unreadable",code:L5(X),message:X instanceof Error?X.message:String(X)}}}},S8=async($=c0,Z)=>{let X=d();if(X.path.isAbsolute($)){let K=await K6(X,$);return K.exists?{exists:!0,absolutePath:$,source:"absolute"}:{exists:!1,absolutePath:$,source:"absolute",...K.unusable?{unusable:K.unusable}:{}}}let Q=Z?.cwd??X.env.cwd(),G=Q;while(!0){let K=X.path.join(G,$);if((await K6(X,K)).exists)return{exists:!0,absolutePath:K,source:G===Q?"cwd":"ancestor"};let H=X.path.dirname(G);if(H===G)break;G=H}let z=X.path.join(X.env.homedir(),$),Y=await K6(X,z);if(Y.exists)return{exists:!0,absolutePath:z,source:"home"};return{exists:!1,absolutePath:z,source:"default",...Y.unusable?{unusable:Y.unusable}:{}}},u4=async($=c0,Z)=>{let X=await S8($,Z);if(X.exists)return{absolutePath:X.absolutePath};return{absolutePath:void 0,errorMessage:X.source==="absolute"?`Environment file not found: ${$}`:`Unable to locate environment file: ${$}. Run 'uip login' to authenticate.`}},Y4=async({envPath:$})=>{let Z=d(),X=Z.path.isAbsolute($)?$:Z.path.join(Z.env.cwd(),$);if(!await Z.exists(X))throw Error(`Environment file not found: ${$}`);let Q=await Z.readFile(X,"utf-8");if(Q===null)throw Error(`Environment file not found: ${$}`);let G={};for(let z of Q.split(`
|
|
76
|
+
`)){let Y=z.trim();if(!Y||Y.startsWith("#"))continue;let K=Y.indexOf("=");if(K===-1)continue;let D=Y.slice(0,K).trim(),H=Y.slice(K+1).trim();if(H.startsWith('"')&&H.endsWith('"')||H.startsWith("'")&&H.endsWith("'"))H=H.slice(1,-1);G[D]=H}return G},p4=async({envPath:$,data:Z,merge:X=!0})=>{let Q=d(),G=Q.path.isAbsolute($)?$:Q.path.join(Q.env.homedir(),$),z={};if(X&&await Q.exists(G))try{z=await Y4({envPath:G})}catch{}let Y={...z,...Z},K=[];for(let[M,C]of Object.entries(Y)){if(C===void 0)continue;let g=C.includes(" ")||C.includes("#")?`"${C}"`:C;K.push(`${M}=${g}`)}let D=`${K.join(`
|
|
77
|
+
`)}
|
|
78
|
+
`,H=Q.path.dirname(G);await Q.mkdir(H);let q=`${G}.tmp`;await Q.writeFile(q,D),await Q.rename(q,G)};var q6=async($={})=>{return P5($)},P5=async($={},Z={})=>{let{resolveEnvFilePath:X=u4,loadEnvFile:Q=Y4,saveEnvFile:G=p4,getFs:z=d,refreshToken:Y=T8,resolveConfig:K=g0,robotFallback:D=w8,loadBreaker:H=z6,saveBreaker:q=Y6,clearBreaker:M=m4}=Z;if(J6())return C5(D);if(f4())return Q6();let C=e9(),E=$6(),g=C!==void 0&&($.envFilePath===void 0||$.envFilePath===E),y=$.envFilePath??E??c0,{ensureTokenValidityMinutes:x}=$,{absolutePath:b}=await X(y);if(b===void 0){if(g)return{loginStatus:"Not logged in",hint:`No credentials found for profile "${C}". Run 'uip login --profile ${C}' to authenticate this profile.`};return w5(D)}let v=await N5(Q,b);if("status"in v)return v.status;let{credentials:T}=v,h=()=>g?Promise.resolve(void 0):T5(z,Q,b,y),p=F0(T.UIPATH_ACCESS_TOKEN),X0=A8(x),Q0={accessToken:T.UIPATH_ACCESS_TOKEN,refreshToken:T.UIPATH_REFRESH_TOKEN,expiration:p,lockReleaseFailed:!1},G0=T.UIPATH_REFRESH_TOKEN;if(p&&p<=X0&&G0){let e=await S5({absolutePath:b,credentials:T,accessToken:T.UIPATH_ACCESS_TOKEN,refreshToken:G0,expiration:p,ensureTokenValidityMinutes:x,getFs:z,loadEnvFile:Q,saveEnvFile:G,refreshFn:Y,resolveConfig:K,loadBreaker:H,saveBreaker:q,clearBreaker:M,globalHint:h});if(e.kind==="terminal")return e.status;Q0=e.tokens}return A5(Q0,T,h)};async function C5($){if(f4())throw new L0(`${z4}=true and ${p0}=true are mutually exclusive. Unset one of them and re-run.`);let Z=await $({force:!0});if(!Z)return{loginStatus:"Not logged in",hint:`${p0}=true but the UiPath Robot session is unavailable. Start and sign in to the Assistant, or unset ${p0} to fall back to file or env-var authentication.`};return E8(Z)}async function w5($){let Z=await $();return Z?E8(Z):{loginStatus:"Not logged in"}}async function N5($,Z){let X;try{X=await $({envPath:Z})}catch(Q){if(E5(Q))return{status:{loginStatus:"Not logged in"}};throw Q}if(!X.UIPATH_ACCESS_TOKEN)return{status:{loginStatus:"Not logged in"}};return{credentials:X}}async function T5($,Z,X,Q){let G=$(),z=G.path.join(G.env.homedir(),Q);if(X===z)return;if(!await G.exists(z))return;try{let Y=await Z({envPath:z});if(!Y.UIPATH_ACCESS_TOKEN)return;let K=F0(Y.UIPATH_ACCESS_TOKEN);if(K&&K<=new Date)return;return`Local credentials file at ${X} has expired credentials. Valid credentials exist in ${z}. Remove the local file or run 'uip login' to re-authenticate.`}catch{return}}function A8($){return new Date(Date.now()+($??0)*60*1000)}async function S5($){let Z=await x5($);if(Z)return{kind:"terminal",status:Z};let X;try{X=await $.getFs().acquireLock($.absolutePath)}catch(Y){return{kind:"terminal",status:await k5($,Y)}}let Q,G=!1,z;try{let Y=await y5({absolutePath:$.absolutePath,refreshToken:$.refreshToken,customAuthority:$.credentials.UIPATH_URL,ensureTokenValidityMinutes:$.ensureTokenValidityMinutes,loadEnvFile:$.loadEnvFile,saveEnvFile:$.saveEnvFile,refreshFn:$.refreshFn,resolveConfig:$.resolveConfig,loadBreaker:$.loadBreaker,saveBreaker:$.saveBreaker,clearBreaker:$.clearBreaker});if(Y.kind==="fail")Q=Y.status;else z=Y}finally{try{await X()}catch{G=!0}}if(Q){let Y=await $.globalHint(),K=Y?{...Q,loginStatus:"Expired",hint:Y}:Q;return{kind:"terminal",status:G?{...K,lockReleaseFailed:!0}:K}}return{kind:"refreshed",tokens:{accessToken:z?.accessToken,refreshToken:z?.refreshToken,expiration:z?.expiration,tokenRefresh:z?.tokenRefresh,persistenceWarning:z?.persistenceWarning,lockReleaseFailed:G}}}async function A5($,Z,X){let Q={loginStatus:$.expiration&&$.expiration<=new Date?"Expired":"Logged in",accessToken:$.accessToken,refreshToken:$.refreshToken,baseUrl:Z.UIPATH_URL,organizationName:Z.UIPATH_ORGANIZATION_NAME,organizationId:Z.UIPATH_ORGANIZATION_ID,tenantName:Z.UIPATH_TENANT_NAME,tenantId:Z.UIPATH_TENANT_ID,expiration:$.expiration,source:"file",...$.persistenceWarning?{hint:$.persistenceWarning,persistenceFailed:!0}:{},...$.lockReleaseFailed?{lockReleaseFailed:!0}:{},...$.tokenRefresh?{tokenRefresh:$.tokenRefresh}:{}};if(Q.loginStatus==="Expired"){let G=await X();if(G)Q.hint=G}return Q}function E8($){return{loginStatus:"Logged in",accessToken:$.accessToken,baseUrl:$.baseUrl,organizationName:$.organizationName,organizationId:$.organizationId,tenantName:$.tenantName,tenantId:$.tenantId,issuer:$.issuer,expiration:F0($.accessToken),source:"robot"}}var E5=($)=>{if(!($ instanceof Object))return!1;return $.code==="ENOENT"};async function x5($){let{absolutePath:Z,refreshToken:X,accessToken:Q,credentials:G,expiration:z,loadBreaker:Y,saveBreaker:K,clearBreaker:D}=$,H=await h4(X),q=await Y(Z).catch(()=>({}));if(q.deadTokenFp&&q.deadTokenFp!==H)await D(Z),q.deadTokenFp=void 0;let M=Date.now(),C=q.deadTokenFp===H,E=q.backoffUntilMs!==void 0&&M<q.backoffUntilMs;if(!C&&!E)return;let g=await $.globalHint(),y=!P8(q,M);if(!y)await K(Z,{...q,lastSurfacedAtMs:M});let x="Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired. In a non-interactive context, authenticate with: uip login --client-id <id> --client-secret <secret> -t <tenant>.",b="Token refresh is temporarily backed off after a recent network error and will retry automatically once the backoff window elapses.";return{loginStatus:g?"Expired":"Refresh Failed",...g?{accessToken:Q,refreshToken:X,baseUrl:G.UIPATH_URL,organizationName:G.UIPATH_ORGANIZATION_NAME,organizationId:G.UIPATH_ORGANIZATION_ID,tenantName:G.UIPATH_TENANT_NAME,tenantId:G.UIPATH_TENANT_ID,expiration:z,source:"file"}:{},hint:g??(C?x:b),refreshCircuitOpen:!0,refreshTelemetrySuppressed:y,tokenRefresh:{attempted:!1,success:!1}}}async function k5($,Z){let X=H6(Z),Q=await $.globalHint();if(Q)return{loginStatus:"Expired",accessToken:$.accessToken,refreshToken:$.refreshToken,baseUrl:$.credentials.UIPATH_URL,organizationName:$.credentials.UIPATH_ORGANIZATION_NAME,organizationId:$.credentials.UIPATH_ORGANIZATION_ID,tenantName:$.credentials.UIPATH_TENANT_NAME,tenantId:$.credentials.UIPATH_TENANT_ID,expiration:$.expiration,source:"file",hint:Q,tokenRefresh:{attempted:!1,success:!1,errorMessage:`lock acquisition failed: ${X}`}};return{loginStatus:"Refresh Failed",hint:"Could not acquire the auth-file lock — too many concurrent `uip` processes, or a permission issue on the auth directory. Retry, or run 'uip login' to re-authenticate.",tokenRefresh:{attempted:!1,success:!1,errorMessage:`lock acquisition failed: ${X}`}}}async function y5($){let{absolutePath:Z,refreshToken:X,customAuthority:Q,ensureTokenValidityMinutes:G,loadEnvFile:z,saveEnvFile:Y,refreshFn:K,resolveConfig:D,loadBreaker:H,saveBreaker:q,clearBreaker:M}=$,C=A8(G),E;try{E=await z({envPath:Z})}catch(h){return{kind:"fail",status:{loginStatus:"Refresh Failed",hint:"Could not read the auth file while refreshing. Retry, or run 'uip login' to re-authenticate.",tokenRefresh:{attempted:!1,success:!1,errorMessage:`auth file read failed: ${H6(h)}`}}}}let g=E.UIPATH_ACCESS_TOKEN,y=g?F0(g):void 0;if(g&&y&&y>C)return await M(Z),{kind:"ok",accessToken:g,refreshToken:E.UIPATH_REFRESH_TOKEN??X,expiration:y,tokenRefresh:{attempted:!1,success:!0}};let x=E.UIPATH_REFRESH_TOKEN??X,b,v;try{let h=await D({customAuthority:Q}),p=await K({refreshToken:x,tokenEndpoint:h.tokenEndpoint,clientId:h.clientId,expectedAuthority:Q});b=p.accessToken,v=p.refreshToken}catch(h){let p=N8(h),X0=p?"Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired. In a non-interactive context, authenticate with: uip login --client-id <id> --client-secret <secret> -t <tenant>.":"Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.",Q0=p?b5():v5(),G0=await h4(x);if(p)await q(Z,{deadTokenFp:G0});else{let e=await H(Z).catch(()=>({})),Y0=(e.attempts??0)+1;await q(Z,{...e,deadTokenFp:void 0,attempts:Y0,backoffUntilMs:Date.now()+L8(Y0)})}return{kind:"fail",status:{loginStatus:"Refresh Failed",hint:X0,tokenRefresh:{attempted:!0,success:!1,errorMessage:Q0}}}}let T=F0(b);if(!T||T<=new Date)return{kind:"fail",status:{loginStatus:"Refresh Failed",hint:"The identity server returned an unusable token. Run 'uip login' to re-authenticate.",tokenRefresh:{attempted:!0,success:!1,errorMessage:"refreshed token has no valid expiration claim"}}};await M(Z);try{return await Y({envPath:Z,data:{UIPATH_ACCESS_TOKEN:b,UIPATH_REFRESH_TOKEN:v},merge:!0}),{kind:"ok",accessToken:b,refreshToken:v,expiration:T,tokenRefresh:{attempted:!0,success:!0}}}catch(h){let p=H6(h);return{kind:"ok",accessToken:b,refreshToken:v,expiration:T,persistenceWarning:`Access token refreshed in memory but could not be written to ${Z}: ${p}. The next CLI invocation will fail until the file can be updated — run 'uip login' to re-authenticate.`,tokenRefresh:{attempted:!0,success:!0,errorMessage:`persistence failed: ${p}`}}}}function b5(){return"stored refresh token is invalid or expired"}function v5(){return"token refresh failed before authentication completed"}function H6($){return $ instanceof Error?$.message:String($)}var c5="uipath",d5=30,l5=300000,i5=128000,n5=16384,o5=5000,r5=["gpt-4o-2024-11-20","gpt-4o-mini-2024-07-18"],s5=($)=>{let Z=$.organizationId??$.organizationName,X=$.tenantName??$.tenantId;if($.loginStatus!=="Logged in"||!$.accessToken||!$.baseUrl||!Z||!X)return;return{accessToken:$.accessToken,gatewayBase:`${$.baseUrl}/${Z}/${X}/agenthub_/llm`,expiration:$.expiration}},a5=async($)=>{let[Z,X]=await o(fetch(`${$.gatewayBase}/api/chat/completions`,{headers:{Authorization:`Bearer ${$.accessToken}`},signal:AbortSignal.timeout(o5)}));if(Z||!X.ok){r.debug(`[coder-tool] LLM Gateway model discovery failed: ${Z?.message??X?.status}`);return}let[Q,G]=await o(X.json());if(Q)return;let z=G!==null&&typeof G==="object"&&!Array.isArray(G)?G:void 0,Y=Array.isArray(G)?G:z?.supportedModels??z?.models??z?.data;if(!Array.isArray(Y))return;let K=Y.map((D)=>{if(typeof D==="string")return{id:D};if(D&&typeof D==="object"){let H=D,q=H.model??H.name??H.id;if(typeof q==="string"&&q.length>0)return{id:q,contextWindow:typeof H.contextWindow==="number"?H.contextWindow:void 0,maxTokens:typeof H.maxTokens==="number"?H.maxTokens:void 0}}return}).filter((D)=>D!==void 0);return K.length>0?K:void 0},t5=($,Z)=>Z.map((X)=>({id:X.id,name:`${X.id} (UiPath)`,baseUrl:`${$.gatewayBase}/openai/deployments/${encodeURIComponent(X.id)}`,reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:X.contextWindow??i5,maxTokens:X.maxTokens??n5})),x8=()=>{let $,Z,X=async(Q)=>{let[G,z]=await o(q6({ensureTokenValidityMinutes:d5}));if(G)return r.debug(`[coder-tool] Could not resolve UiPath login: ${G.message}`),!1;let Y=s5(z);if(!Y)return r.debug("[coder-tool] Not logged in to UiPath — 'uipath' provider not registered. Run 'uip login' to enable it."),!1;Z=Y.expiration,$??=await a5(Y);let K=$??r5.map((D)=>({id:D}));return Q.registerProvider(c5,{name:"UiPath LLM Gateway",baseUrl:`${Y.gatewayBase}/openai`,apiKey:Y.accessToken,api:"openai-completions",models:t5(Y,K)}),!0};return{name:"uipath-llm-gateway",factory:async(Q)=>{if(!await X(Q))return;Q.on("agent_start",async()=>{if(Z===void 0||Z.getTime()-Date.now()<l5)await X(Q)})}}};var $7=new Set(["install","remove","uninstall","update","list","config"]);async function Z7(){let $=d(),Z=[new URL("./templates/uipath-cli.md",import.meta.url),new URL("../../templates/uipath-cli.md",import.meta.url)];for(let X of Z){let Q=e5(X);if(await $.exists(Q))return await $.readFile(Q,"utf-8")??void 0}return}function X7($,Z){if(!Z)return $;let X=$[0];if(X!==void 0&&$7.has(X))return $;return["--append-system-prompt",Z,...$]}async function J7($,Z){let{main:X}=await import("@earendil-works/pi-coding-agent"),Q=process.exit,G,z=()=>{},Y=new Promise((K)=>{z=K});process.exit=(K)=>{G=typeof K==="number"?K:process.exitCode??0,z(G);return};try{let K=X($,{extensionFactories:[x8()]}).then(()=>G??0);return K.catch(()=>{}),await Promise.race([K,Y])}finally{process.exit=Q;let K=Z??((D)=>Q(D));setImmediate(()=>K(process.exitCode??G??0))}}function k8($,Z=r9,X){$.argument("[args...]","arguments forwarded to the Pi coding agent (see 'uip coder --help')").allowUnknownOption().allowExcessArguments(!0).helpOption(!1).trackedAction(Z,async(Q,G,z)=>{let Y=await Z7(),K=await J7(X7(z.args,Y),X);if(K!==0)h0.error({Result:t.Failure,Message:`The coding agent exited with code ${K}.`,Instructions:"Check the agent output above for the underlying error. Run 'uip coder --help' for usage, or 'uip login' if the uipath provider is missing."}),Z.exit(K)})}var dW={name:"coder-tool",version:j8.version,description:"Build UiPath automations with an AI agent (Pi) that drives uip — via UiPath LLM Gateway or your own model keys.",commandPrefix:"coder"},lW=async($)=>{R8(()=>k8($))};
|
|
79
|
+
export{N0 as a,XG as b,dW as c,lW as d};
|
|
80
|
+
|
|
81
|
+
//# debugId=444754BBFB6BAD7664756E2164756E21
|